From 850349b8520af5494ef3ad4bf43c118806453914 Mon Sep 17 00:00:00 2001 From: Andrea Bianco Date: Fri, 4 Oct 2019 17:24:44 +0200 Subject: [PATCH] Built motion from commit (unavailable).|2.3.5 --- 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/intDynamics365Account/index.js | 2 +- .../intDynamics365Account.attributes.js | 2 +- .../intDynamics365Account.controller.js | 2 +- .../intDynamics365Account.model.js | 2 +- .../intDynamics365Account.rpc.js | 2 +- server/api/intDynamics365Configuration/index.js | 2 +- .../intDynamics365Configuration.attributes.js | 2 +- .../intDynamics365Configuration.controller.js | 2 +- .../intDynamics365Configuration.model.js | 2 +- .../intDynamics365Configuration.rpc.js | 2 +- server/api/intDynamics365Field/index.js | 2 +- .../intDynamics365Field.attributes.js | 2 +- .../intDynamics365Field.controller.js | 2 +- .../intDynamics365Field.model.js | 2 +- .../intDynamics365Field/intDynamics365Field.rpc.js | 2 +- server/api/intFreshdeskAccount/index.js | 2 +- .../intFreshdeskAccount.attributes.js | 2 +- .../intFreshdeskAccount.controller.js | 2 +- .../intFreshdeskAccount.model.js | 2 +- .../intFreshdeskAccount/intFreshdeskAccount.rpc.js | 2 +- server/api/intFreshdeskConfiguration/index.js | 2 +- .../intFreshdeskConfiguration.attributes.js | 2 +- .../intFreshdeskConfiguration.controller.js | 2 +- .../intFreshdeskConfiguration.model.js | 2 +- .../intFreshdeskConfiguration.rpc.js | 2 +- server/api/intFreshdeskField/index.js | 2 +- .../intFreshdeskField.attributes.js | 2 +- .../intFreshdeskField.controller.js | 2 +- .../intFreshdeskField/intFreshdeskField.model.js | 2 +- .../api/intFreshdeskField/intFreshdeskField.rpc.js | 2 +- server/api/intSalesforceAccount/index.js | 2 +- .../intSalesforceAccount.attributes.js | 2 +- .../intSalesforceAccount.controller.js | 2 +- .../intSalesforceAccount.model.js | 2 +- .../intSalesforceAccount.rpc.js | 2 +- server/api/intSalesforceConfiguration/index.js | 2 +- .../intSalesforceConfiguration.attributes.js | 2 +- .../intSalesforceConfiguration.controller.js | 2 +- .../intSalesforceConfiguration.model.js | 2 +- .../intSalesforceConfiguration.rpc.js | 2 +- server/api/intSalesforceField/index.js | 2 +- .../intSalesforceField.attributes.js | 2 +- .../intSalesforceField.controller.js | 2 +- .../intSalesforceField/intSalesforceField.model.js | 2 +- .../intSalesforceField/intSalesforceField.rpc.js | 2 +- server/api/intServicenowAccount/index.js | 2 +- .../intServicenowAccount.attributes.js | 2 +- .../intServicenowAccount.controller.js | 2 +- .../intServicenowAccount.model.js | 2 +- .../intServicenowAccount.rpc.js | 2 +- server/api/intServicenowConfiguration/index.js | 2 +- .../intServicenowConfiguration.attributes.js | 2 +- .../intServicenowConfiguration.controller.js | 2 +- .../intServicenowConfiguration.model.js | 2 +- .../intServicenowConfiguration.rpc.js | 2 +- server/api/intServicenowField/index.js | 2 +- .../intServicenowField.attributes.js | 2 +- .../intServicenowField.controller.js | 2 +- .../intServicenowField/intServicenowField.model.js | 2 +- .../intServicenowField/intServicenowField.rpc.js | 2 +- server/api/intSugarcrmAccount/index.js | 2 +- .../intSugarcrmAccount.attributes.js | 2 +- .../intSugarcrmAccount.controller.js | 2 +- .../intSugarcrmAccount/intSugarcrmAccount.model.js | 2 +- .../intSugarcrmAccount/intSugarcrmAccount.rpc.js | 2 +- server/api/intSugarcrmConfiguration/index.js | 2 +- .../intSugarcrmConfiguration.attributes.js | 2 +- .../intSugarcrmConfiguration.controller.js | 2 +- .../intSugarcrmConfiguration.model.js | 2 +- .../intSugarcrmConfiguration.rpc.js | 2 +- server/api/intSugarcrmField/index.js | 2 +- .../intSugarcrmField.attributes.js | 2 +- .../intSugarcrmField.controller.js | 2 +- .../api/intSugarcrmField/intSugarcrmField.model.js | 2 +- .../api/intSugarcrmField/intSugarcrmField.rpc.js | 2 +- server/api/intVtigerAccount/index.js | 2 +- .../intVtigerAccount.attributes.js | 2 +- .../intVtigerAccount.controller.js | 2 +- .../api/intVtigerAccount/intVtigerAccount.model.js | 2 +- .../api/intVtigerAccount/intVtigerAccount.rpc.js | 2 +- server/api/intVtigerConfiguration/index.js | 2 +- .../intVtigerConfiguration.attributes.js | 2 +- .../intVtigerConfiguration.controller.js | 2 +- .../intVtigerConfiguration.model.js | 2 +- .../intVtigerConfiguration.rpc.js | 2 +- server/api/intVtigerField/index.js | 2 +- .../intVtigerField/intVtigerField.attributes.js | 2 +- .../intVtigerField/intVtigerField.controller.js | 2 +- server/api/intVtigerField/intVtigerField.model.js | 2 +- server/api/intVtigerField/intVtigerField.rpc.js | 2 +- server/api/intZendeskAccount/index.js | 2 +- .../intZendeskAccount.attributes.js | 2 +- .../intZendeskAccount.controller.js | 2 +- .../intZendeskAccount/intZendeskAccount.model.js | 2 +- .../api/intZendeskAccount/intZendeskAccount.rpc.js | 2 +- server/api/intZendeskConfiguration/index.js | 2 +- .../intZendeskConfiguration.attributes.js | 2 +- .../intZendeskConfiguration.controller.js | 2 +- .../intZendeskConfiguration.model.js | 2 +- .../intZendeskConfiguration.rpc.js | 2 +- server/api/intZendeskField/index.js | 2 +- .../intZendeskField/intZendeskField.attributes.js | 2 +- .../intZendeskField/intZendeskField.controller.js | 2 +- .../api/intZendeskField/intZendeskField.model.js | 2 +- server/api/intZendeskField/intZendeskField.rpc.js | 2 +- server/api/intZohoAccount/index.js | 2 +- .../intZohoAccount/intZohoAccount.attributes.js | 2 +- .../intZohoAccount/intZohoAccount.controller.js | 2 +- server/api/intZohoAccount/intZohoAccount.model.js | 2 +- server/api/intZohoAccount/intZohoAccount.rpc.js | 2 +- server/api/intZohoConfiguration/index.js | 2 +- .../intZohoConfiguration.attributes.js | 2 +- .../intZohoConfiguration.controller.js | 2 +- .../intZohoConfiguration.model.js | 2 +- .../intZohoConfiguration.rpc.js | 2 +- server/api/intZohoField/index.js | 2 +- server/api/intZohoField/intZohoField.attributes.js | 2 +- server/api/intZohoField/intZohoField.controller.js | 2 +- server/api/intZohoField/intZohoField.model.js | 2 +- server/api/intZohoField/intZohoField.rpc.js | 2 +- server/api/integration/index.js | 2 +- server/api/integration/integration.attributes.js | 2 +- server/api/integration/integration.controller.js | 2 +- server/api/integration/integration.model.js | 2 +- server/api/integration/integration.rpc.js | 2 +- server/api/integrationReport/index.js | 2 +- .../integrationReport.attributes.js | 2 +- .../integrationReport.controller.js | 2 +- .../integrationReport/integrationReport.model.js | 2 +- .../api/integrationReport/integrationReport.rpc.js | 2 +- server/api/interval/index.js | 2 +- server/api/interval/interval.attributes.js | 2 +- server/api/interval/interval.controller.js | 2 +- server/api/interval/interval.model.js | 2 +- server/api/interval/interval.rpc.js | 2 +- server/api/jira/index.js | 2 +- server/api/jira/jira.controller.js | 2 +- server/api/jscriptyAnswerReport/index.js | 2 +- .../jscriptyAnswerReport.attributes.js | 2 +- .../jscriptyAnswerReport.controller.js | 2 +- .../jscriptyAnswerReport.model.js | 2 +- .../jscriptyAnswerReport.rpc.js | 2 +- server/api/jscriptyProject/index.js | 2 +- .../jscriptyProject/jscriptyProject.attributes.js | 2 +- .../jscriptyProject/jscriptyProject.controller.js | 2 +- .../api/jscriptyProject/jscriptyProject.model.js | 2 +- server/api/jscriptyProject/jscriptyProject.rpc.js | 2 +- server/api/jscriptyQuestionReport/index.js | 2 +- .../jscriptyQuestionReport.attributes.js | 2 +- .../jscriptyQuestionReport.controller.js | 2 +- .../jscriptyQuestionReport.model.js | 2 +- .../jscriptyQuestionReport.rpc.js | 2 +- server/api/jscriptySessionReport/index.js | 2 +- .../jscriptySessionReport.attributes.js | 2 +- .../jscriptySessionReport.controller.js | 2 +- .../jscriptySessionReport.model.js | 2 +- .../jscriptySessionReport.rpc.js | 2 +- server/api/license/index.js | 2 +- server/api/license/license.attributes.js | 2 +- server/api/license/license.controller.js | 2 +- server/api/license/license.model.js | 2 +- server/api/license/license.rpc.js | 2 +- server/api/mailAccount/index.js | 2 +- server/api/mailAccount/mailAccount.attributes.js | 2 +- server/api/mailAccount/mailAccount.controller.js | 2 +- server/api/mailAccount/mailAccount.events.js | 2 +- server/api/mailAccount/mailAccount.model.js | 2 +- server/api/mailAccount/mailAccount.rpc.js | 2 +- server/api/mailAccount/mailAccount.socket.js | 2 +- server/api/mailApplication/index.js | 2 +- .../mailApplication/mailApplication.attributes.js | 2 +- .../mailApplication/mailApplication.controller.js | 2 +- .../api/mailApplication/mailApplication.model.js | 2 +- server/api/mailApplication/mailApplication.rpc.js | 2 +- server/api/mailInteraction/index.js | 2 +- .../mailInteraction/mailInteraction.attributes.js | 2 +- .../mailInteraction/mailInteraction.controller.js | 2 +- .../api/mailInteraction/mailInteraction.events.js | 2 +- .../api/mailInteraction/mailInteraction.model.js | 2 +- server/api/mailInteraction/mailInteraction.rpc.js | 2 +- .../api/mailInteraction/mailInteraction.socket.js | 2 +- server/api/mailMessage/index.js | 2 +- server/api/mailMessage/mailMessage.attributes.js | 2 +- server/api/mailMessage/mailMessage.controller.js | 2 +- server/api/mailMessage/mailMessage.events.js | 2 +- server/api/mailMessage/mailMessage.model.js | 2 +- server/api/mailMessage/mailMessage.rpc.js | 2 +- server/api/mailMessage/mailMessage.socket.js | 2 +- server/api/mailQueue/index.js | 2 +- server/api/mailQueue/mailQueue.attributes.js | 2 +- server/api/mailQueue/mailQueue.controller.js | 2 +- server/api/mailQueue/mailQueue.events.js | 2 +- server/api/mailQueue/mailQueue.model.js | 2 +- server/api/mailQueue/mailQueue.rpc.js | 2 +- server/api/mailQueue/mailQueue.socket.js | 2 +- server/api/mailQueueReport/index.js | 2 +- .../mailQueueReport/mailQueueReport.attributes.js | 2 +- .../mailQueueReport/mailQueueReport.controller.js | 2 +- .../api/mailQueueReport/mailQueueReport.model.js | 2 +- server/api/mailQueueReport/mailQueueReport.rpc.js | 2 +- server/api/mailServerIn/index.js | 2 +- server/api/mailServerIn/mailServerIn.attributes.js | 2 +- server/api/mailServerIn/mailServerIn.model.js | 2 +- server/api/mailServerIn/mailServerIn.rpc.js | 2 +- server/api/mailServerOut/index.js | 2 +- .../api/mailServerOut/mailServerOut.attributes.js | 2 +- .../api/mailServerOut/mailServerOut.controller.js | 2 +- server/api/mailServerOut/mailServerOut.model.js | 2 +- server/api/mailServerOut/mailServerOut.rpc.js | 2 +- server/api/mailSubstatus/index.js | 2 +- .../api/mailSubstatus/mailSubstatus.attributes.js | 2 +- .../api/mailSubstatus/mailSubstatus.controller.js | 2 +- server/api/mailSubstatus/mailSubstatus.model.js | 2 +- server/api/mailSubstatus/mailSubstatus.rpc.js | 2 +- server/api/mailTransferReport/index.js | 2 +- .../mailTransferReport.attributes.js | 2 +- .../mailTransferReport.controller.js | 2 +- .../mailTransferReport/mailTransferReport.model.js | 2 +- .../mailTransferReport/mailTransferReport.rpc.js | 2 +- server/api/memberReport/index.js | 2 +- server/api/memberReport/memberReport.attributes.js | 2 +- server/api/memberReport/memberReport.controller.js | 2 +- server/api/memberReport/memberReport.model.js | 2 +- server/api/memberReport/memberReport.rpc.js | 2 +- server/api/migration/index.js | 2 +- server/api/migration/migration.attributes.js | 2 +- server/api/migration/migration.controller.js | 2 +- server/api/migration/migration.model.js | 2 +- server/api/migration/migration.rpc.js | 2 +- server/api/network/index.js | 2 +- server/api/network/network.attributes.js | 2 +- server/api/network/network.controller.js | 2 +- server/api/network/network.model.js | 2 +- server/api/network/network.rpc.js | 2 +- server/api/openchannelAccount/index.js | 2 +- .../openchannelAccount.attributes.js | 2 +- .../openchannelAccount.controller.js | 2 +- .../openchannelAccount.events.js | 2 +- .../openchannelAccount/openchannelAccount.model.js | 2 +- .../openchannelAccount/openchannelAccount.rpc.js | 2 +- .../openchannelAccount.socket.js | 2 +- server/api/openchannelApplication/index.js | 2 +- .../openchannelApplication.attributes.js | 2 +- .../openchannelApplication.controller.js | 2 +- .../openchannelApplication.model.js | 2 +- .../openchannelApplication.rpc.js | 2 +- server/api/openchannelInteraction/index.js | 2 +- .../openchannelInteraction.attributes.js | 2 +- .../openchannelInteraction.controller.js | 2 +- .../openchannelInteraction.events.js | 2 +- .../openchannelInteraction.model.js | 2 +- .../openchannelInteraction.rpc.js | 2 +- .../openchannelInteraction.socket.js | 2 +- server/api/openchannelMessage/index.js | 2 +- .../openchannelMessage.attributes.js | 2 +- .../openchannelMessage.controller.js | 2 +- .../openchannelMessage.events.js | 2 +- .../openchannelMessage/openchannelMessage.model.js | 2 +- .../openchannelMessage/openchannelMessage.rpc.js | 2 +- .../openchannelMessage.socket.js | 2 +- server/api/openchannelQueue/index.js | 2 +- .../openchannelQueue.attributes.js | 2 +- .../openchannelQueue.controller.js | 2 +- .../openchannelQueue/openchannelQueue.events.js | 2 +- .../api/openchannelQueue/openchannelQueue.model.js | 2 +- .../api/openchannelQueue/openchannelQueue.rpc.js | 2 +- .../openchannelQueue/openchannelQueue.socket.js | 2 +- server/api/openchannelQueueReport/index.js | 2 +- .../openchannelQueueReport.attributes.js | 2 +- .../openchannelQueueReport.controller.js | 2 +- .../openchannelQueueReport.model.js | 2 +- .../openchannelQueueReport.rpc.js | 2 +- server/api/openchannelTransferReport/index.js | 2 +- .../openchannelTransferReport.attributes.js | 2 +- .../openchannelTransferReport.controller.js | 2 +- .../openchannelTransferReport.model.js | 2 +- .../openchannelTransferReport.rpc.js | 2 +- server/api/pause/index.js | 2 +- server/api/pause/pause.attributes.js | 2 +- server/api/pause/pause.controller.js | 2 +- server/api/pause/pause.model.js | 2 +- server/api/pause/pause.rpc.js | 2 +- server/api/plugin/index.js | 2 +- server/api/plugin/plugin.attributes.js | 2 +- server/api/plugin/plugin.controller.js | 2 +- server/api/plugin/plugin.events.js | 2 +- server/api/plugin/plugin.model.js | 2 +- server/api/plugin/plugin.rpc.js | 2 +- server/api/plugin/plugin.socket.js | 2 +- server/api/pm2/index.js | 2 +- server/api/pm2/pm2.controller.js | 2 +- server/api/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/squareMessage/index.js | 2 +- .../api/squareMessage/squareMessage.attributes.js | 2 +- .../api/squareMessage/squareMessage.controller.js | 2 +- server/api/squareMessage/squareMessage.model.js | 2 +- server/api/squareMessage/squareMessage.rpc.js | 2 +- server/api/squareOdbc/index.js | 2 +- server/api/squareOdbc/squareOdbc.attributes.js | 2 +- server/api/squareOdbc/squareOdbc.controller.js | 2 +- server/api/squareOdbc/squareOdbc.model.js | 2 +- server/api/squareOdbc/squareOdbc.rpc.js | 2 +- server/api/squareProject/index.js | 2 +- .../api/squareProject/squareProject.attributes.js | 2 +- .../api/squareProject/squareProject.controller.js | 2 +- server/api/squareProject/squareProject.events.js | 2 +- server/api/squareProject/squareProject.model.js | 2 +- server/api/squareProject/squareProject.rpc.js | 2 +- server/api/squareProject/squareProject.socket.js | 2 +- server/api/squareRecording/index.js | 2 +- .../squareRecording/squareRecording.attributes.js | 2 +- .../squareRecording/squareRecording.controller.js | 2 +- .../api/squareRecording/squareRecording.model.js | 2 +- server/api/squareRecording/squareRecording.rpc.js | 2 +- server/api/squareReport/index.js | 2 +- server/api/squareReport/squareReport.attributes.js | 2 +- server/api/squareReport/squareReport.controller.js | 2 +- server/api/squareReport/squareReport.model.js | 2 +- server/api/squareReport/squareReport.rpc.js | 2 +- server/api/squareReportDetail/index.js | 2 +- .../squareReportDetail.attributes.js | 2 +- .../squareReportDetail.controller.js | 2 +- .../squareReportDetail/squareReportDetail.model.js | 2 +- .../squareReportDetail/squareReportDetail.rpc.js | 2 +- server/api/system/index.js | 2 +- server/api/system/system.controller.js | 2 +- server/api/tag/index.js | 2 +- server/api/tag/tag.attributes.js | 2 +- server/api/tag/tag.controller.js | 2 +- server/api/tag/tag.model.js | 2 +- server/api/tag/tag.rpc.js | 2 +- server/api/team/index.js | 2 +- server/api/team/team.attributes.js | 2 +- server/api/team/team.controller.js | 2 +- server/api/team/team.events.js | 2 +- server/api/team/team.model.js | 2 +- server/api/team/team.rpc.js | 2 +- server/api/team/team.socket.js | 2 +- server/api/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/userProfile/index.js | 2 +- server/api/userProfile/userProfile.attributes.js | 2 +- server/api/userProfile/userProfile.controller.js | 2 +- server/api/userProfile/userProfile.events.js | 2 +- server/api/userProfile/userProfile.model.js | 2 +- server/api/userProfile/userProfile.rpc.js | 2 +- server/api/userProfile/userProfile.socket.js | 2 +- server/api/userProfileResource/index.js | 2 +- .../userProfileResource.attributes.js | 2 +- .../userProfileResource.controller.js | 2 +- .../userProfileResource.model.js | 2 +- .../userProfileResource/userProfileResource.rpc.js | 2 +- server/api/userProfileSection/index.js | 2 +- .../userProfileSection.attributes.js | 2 +- .../userProfileSection.controller.js | 2 +- .../userProfileSection/userProfileSection.model.js | 2 +- .../userProfileSection/userProfileSection.rpc.js | 2 +- server/api/userSmsQueue/index.js | 2 +- server/api/userSmsQueue/userSmsQueue.attributes.js | 2 +- server/api/userSmsQueue/userSmsQueue.model.js | 2 +- server/api/userSmsQueue/userSmsQueue.rpc.js | 2 +- server/api/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/mysqldb/index.js | 2 +- server/routes.js | 2 +- server/rpc/index.js | 2 +- server/services/agi/channel.js | 2 +- server/services/agi/error.js | 2 +- server/services/agi/graph/index.js | 2 +- server/services/agi/index.js | 2 +- server/services/agi/mailRpc/index.js | 2 +- server/services/agi/reply.js | 2 +- server/services/agi/rpc/index.js | 2 +- server/services/agi/scripts/aws/index.js | 2 +- server/services/agi/scripts/aws/lex/index.js | 2 +- server/services/agi/scripts/aws/lex/lib/api.js | 2 +- server/services/agi/scripts/aws/polly/index.js | 2 +- server/services/agi/scripts/aws/polly/lib/api.js | 2 +- server/services/agi/scripts/google/asr/index.js | 2 +- server/services/agi/scripts/google/asr/lib/api.js | 2 +- server/services/agi/scripts/google/index.js | 2 +- server/services/agi/scripts/index.js | 2 +- server/services/agi/scripts/sestek/index.js | 2 +- server/services/agi/scripts/sestek/nda/index.js | 2 +- server/services/agi/scripts/tilde/asr/index.js | 2 +- server/services/agi/scripts/tilde/asr/lib/api.js | 2 +- server/services/agi/scripts/tilde/index.js | 2 +- server/services/agi/server.js | 2 +- server/services/agi/vertices.js | 2 +- server/services/ami/acw/index.js | 2 +- server/services/ami/ami.js | 2 +- server/services/ami/client.js | 2 +- server/services/ami/dialer/action.js | 2 +- server/services/ami/dialer/agentComplete.js | 2 +- server/services/ami/dialer/final.js | 2 +- server/services/ami/dialer/hangup.js | 2 +- server/services/ami/dialer/history.js | 2 +- server/services/ami/dialer/index.js | 2 +- server/services/ami/dialer/queueCallerAbandon.js | 2 +- server/services/ami/fax/action.js | 2 +- server/services/ami/fax/index.js | 2 +- server/services/ami/fax/rpcDb.js | 2 +- server/services/ami/fax/util/gs.js | 2 +- server/services/ami/fax/util/util.js | 2 +- server/services/ami/index.js | 2 +- server/services/ami/model/agent.js | 2 +- server/services/ami/model/campaign.js | 2 +- server/services/ami/model/channel.js | 2 +- server/services/ami/model/deskAccount.js | 2 +- server/services/ami/model/dynamics365Account.js | 2 +- server/services/ami/model/faxAccount.js | 2 +- server/services/ami/model/freshdeskAccount.js | 2 +- server/services/ami/model/queueReport.js | 2 +- server/services/ami/model/salesforceAccount.js | 2 +- server/services/ami/model/servicenowAccount.js | 2 +- server/services/ami/model/sugarcrmAccount.js | 2 +- server/services/ami/model/telephone.js | 2 +- server/services/ami/model/template.js | 2 +- server/services/ami/model/trigger.js | 2 +- server/services/ami/model/trunk.js | 2 +- server/services/ami/model/voiceExtension.js | 2 +- server/services/ami/model/voiceQueue.js | 2 +- server/services/ami/model/vtigerAccount.js | 2 +- server/services/ami/model/zendeskAccount.js | 2 +- server/services/ami/model/zohoAccount.js | 2 +- server/services/ami/preview/action.js | 2 +- server/services/ami/preview/index.js | 2 +- server/services/ami/preview/rpcDb.js | 2 +- server/services/ami/preview/util/util.js | 2 +- server/services/ami/properties.js | 2 +- server/services/ami/realtime/index.js | 2 +- server/services/ami/report/index.js | 2 +- server/services/ami/report/userReport.js | 2 +- server/services/ami/report/voiceAgentReport.js | 2 +- server/services/ami/report/voiceCallReport.js | 2 +- server/services/ami/report/voiceDialReport.js | 2 +- server/services/ami/report/voiceQueueReport.js | 2 +- server/services/ami/rpc/agentReportPreview.js | 2 +- server/services/ami/rpc/attachment.js | 2 +- server/services/ami/rpc/campaign.js | 2 +- server/services/ami/rpc/cmContact.js | 2 +- server/services/ami/rpc/cmHopper.js | 2 +- server/services/ami/rpc/cmHopperBlack.js | 2 +- server/services/ami/rpc/cmHopperFinal.js | 2 +- server/services/ami/rpc/cmHopperHistory.js | 2 +- server/services/ami/rpc/faxAccount.js | 2 +- server/services/ami/rpc/faxMessage.js | 2 +- server/services/ami/rpc/integrations/desk.js | 2 +- .../services/ami/rpc/integrations/dynamics365.js | 2 +- server/services/ami/rpc/integrations/freshdesk.js | 2 +- server/services/ami/rpc/integrations/salesforce.js | 2 +- server/services/ami/rpc/integrations/servicenow.js | 2 +- server/services/ami/rpc/integrations/sugarcrm.js | 2 +- server/services/ami/rpc/integrations/vtiger.js | 2 +- server/services/ami/rpc/integrations/zendesk.js | 2 +- server/services/ami/rpc/integrations/zoho.js | 2 +- server/services/ami/rpc/memberReport.js | 2 +- server/services/ami/rpc/template.js | 2 +- server/services/ami/rpc/trigger.js | 2 +- server/services/ami/rpc/trunk.js | 2 +- server/services/ami/rpc/user.js | 2 +- server/services/ami/rpc/voiceAgentReport.js | 2 +- server/services/ami/rpc/voiceCallReport.js | 2 +- server/services/ami/rpc/voiceDialReport.js | 2 +- server/services/ami/rpc/voiceExtension.js | 2 +- server/services/ami/rpc/voiceQueue.js | 2 +- server/services/ami/rpc/voiceQueueReport.js | 2 +- server/services/ami/rpc/voiceQueueRt.js | 2 +- server/services/ami/rpc/voiceRecording.js | 2 +- server/services/ami/rpc/voiceTransferReport.js | 2 +- server/services/ami/server/index.js | 2 +- server/services/ami/trigger/cmContact/index.js | 2 +- server/services/ami/trigger/index.js | 2 +- server/services/ami/trigger/integration/desk.js | 2 +- .../ami/trigger/integration/dynamics365.js | 2 +- .../services/ami/trigger/integration/freshdesk.js | 2 +- server/services/ami/trigger/integration/index.js | 2 +- .../services/ami/trigger/integration/salesforce.js | 2 +- .../services/ami/trigger/integration/servicenow.js | 2 +- .../services/ami/trigger/integration/sugarcrm.js | 2 +- server/services/ami/trigger/integration/util.js | 2 +- server/services/ami/trigger/integration/vtiger.js | 2 +- server/services/ami/trigger/integration/zendesk.js | 2 +- server/services/ami/trigger/integration/zoho.js | 2 +- server/services/ami/trigger/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/amazonlex.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 +- server/services/xdr/agents.controller.js | 2 +- server/services/xdr/calls.controller.js | 2 +- server/services/xdr/core.controller.js | 2 +- server/services/xdr/dials.controller.js | 2 +- server/services/xdr/index.js | 2 +- server/services/xdr/members.controller.js | 2 +- server/services/xdr/queues.controller.js | 2 +- server/services/xdr/recordings.controller.js | 2 +- server/services/xdr/transfers.controller.js | 2 +- server/services/xdr/utils.js | 2 +- 1045 files changed, 1045 insertions(+), 1045 deletions(-) diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 9d691e6..73dd99b 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.3.5", "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 or API Key.

\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 API Key.

\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

API Key

\n

In your request, specify the API Key in apikey query parameter

\n

Example:

\n
curl -u admin:password https://motion.xcally.com/api/users?apikey=eyJhbGciOiJIUzUxMiIsInR5cC...\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-10-04T15:00:45.401Z", "url": "http://apidocjs.com", "version": "0.17.7" } }); +define({ "name": "xCALLY Motion API", "version": "2.3.5", "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 or API Key.

\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 API Key.

\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

API Key

\n

In your request, specify the API Key in apikey query parameter

\n

Example:

\n
curl -u admin:password https://motion.xcally.com/api/users?apikey=eyJhbGciOiJIUzUxMiIsInR5cC...\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-10-04T15:19:02.836Z", "url": "http://apidocjs.com", "version": "0.17.7" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 4656081..7a083ca 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1 +1 @@ -{ "name": "xCALLY Motion API", "version": "2.3.5", "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 or API Key.

\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 API Key.

\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

API Key

\n

In your request, specify the API Key in apikey query parameter

\n

Example:

\n
curl -u admin:password https://motion.xcally.com/api/users?apikey=eyJhbGciOiJIUzUxMiIsInR5cC...\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-10-04T15:00:45.401Z", "url": "http://apidocjs.com", "version": "0.17.7" } } +{ "name": "xCALLY Motion API", "version": "2.3.5", "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 or API Key.

\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 API Key.

\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

API Key

\n

In your request, specify the API Key in apikey query parameter

\n

Example:

\n
curl -u admin:password https://motion.xcally.com/api/users?apikey=eyJhbGciOiJIUzUxMiIsInR5cC...\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-10-04T15:19:02.836Z", "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 783c9e5..cd648c4 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 _0xabce=['exports','VIRTUAL','getDataValue','contactManager','integration','motionbar','browser','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot','STRING','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0xabce,0x103));var _0xeabc=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xabce[_0x5608a3];return _0x1ed50a;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'name':{'type':Sequelize[_0xeabc('0x2')],'get':function(_0x572221){return this[_0xeabc('0x3')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xeabc('0x4'),_0xeabc('0x5'),_0xeabc('0x6'),'jscripty','urlForward',_0xeabc('0x7'),'bot']],'msg':_0xeabc('0x8')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot'},'data1':{'type':Sequelize[_0xeabc('0x9')](0x1000),'comment':_0xeabc('0xa')},'data2':{'type':Sequelize[_0xeabc('0x9')](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0xeabc('0x9')](0x1000),'comment':_0xeabc('0xb')},'data4':{'type':Sequelize[_0xeabc('0x9')](0x1000)},'data5':{'type':Sequelize[_0xeabc('0x9')](0x1000)},'data6':{'type':Sequelize[_0xeabc('0x9')]},'data7':{'type':Sequelize[_0xeabc('0xc')]}}; \ No newline at end of file +var _0x2eb2=['VIRTUAL','getDataValue','action','STRING','integration','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot','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]','exports'];(function(_0x25c3d7,_0x2ac33b){var _0x24a7da=function(_0x636105){while(--_0x636105){_0x25c3d7['push'](_0x25c3d7['shift']());}};_0x24a7da(++_0x2ac33b);}(_0x2eb2,0x19f));var _0x22eb=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x2eb2[_0x373dee];return _0x46798f;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'name':{'type':Sequelize[_0x22eb('0x1')],'get':function(_0x2ac73a){return this[_0x22eb('0x2')](_0x22eb('0x3'));}},'action':{'type':Sequelize[_0x22eb('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x22eb('0x5'),'motionbar','jscripty',_0x22eb('0x6'),_0x22eb('0x7'),_0x22eb('0x8')]],'msg':_0x22eb('0x9')}},'comment':_0x22eb('0x9')},'data1':{'type':Sequelize[_0x22eb('0x4')](0x1000),'comment':_0x22eb('0xa')},'data2':{'type':Sequelize[_0x22eb('0x4')](0x1000),'comment':_0x22eb('0xb')},'data3':{'type':Sequelize[_0x22eb('0x4')](0x1000),'comment':_0x22eb('0xc')},'data4':{'type':Sequelize[_0x22eb('0x4')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0x22eb('0x4')]},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 0396a5d..9898ae8 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 _0x9551=['mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','update','body','Action','params','catch','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9551,0x113));var _0x1955=function(_0x4144c0,_0x253e2b){_0x4144c0=_0x4144c0-0x0;var _0x424d45=_0x9551[_0x4144c0];return _0x424d45;};'use strict';var pdf=require(_0x1955('0x0'));var emlformat=require(_0x1955('0x1'));var rimraf=require(_0x1955('0x2'));var zipdir=require(_0x1955('0x3'));var jsonpatch=require(_0x1955('0x4'));var rp=require('request-promise');var moment=require(_0x1955('0x5'));var BPromise=require(_0x1955('0x6'));var Mustache=require(_0x1955('0x7'));var util=require(_0x1955('0x8'));var path=require(_0x1955('0x9'));var sox=require(_0x1955('0xa'));var csv=require(_0x1955('0xb'));var ejs=require(_0x1955('0xc'));var fs=require('fs');var _=require(_0x1955('0xd'));var squel=require(_0x1955('0xe'));var crypto=require(_0x1955('0xf'));var jsforce=require(_0x1955('0x10'));var deskjs=require(_0x1955('0x11'));var toCsv=require(_0x1955('0xb'));var querystring=require(_0x1955('0x12'));var Papa=require(_0x1955('0x13'));var authService=require(_0x1955('0x14'));var hardwareService=require(_0x1955('0x15'));var Redis=require(_0x1955('0x16'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0x1955('0x17'));var config=require('../../config/environment');var db=require(_0x1955('0x18'))['db'];function respondWithStatusCode(_0x1d49b3,_0x59ea76){_0x59ea76=_0x59ea76||0xcc;return function(_0x1e0185){if(_0x1e0185){return _0x1d49b3[_0x1955('0x19')](_0x59ea76);}return _0x1d49b3[_0x1955('0x1a')](_0x59ea76)[_0x1955('0x1b')]();};}function respondWithResult(_0xa5c91,_0x103857){_0x103857=_0x103857||0xc8;return function(_0x13ed62){if(_0x13ed62){return _0xa5c91['status'](_0x103857)[_0x1955('0x1c')](_0x13ed62);}};}function respondWithFilteredResult(_0x1bff0a,_0x382fae){return function(_0x51fc76){if(_0x51fc76){var _0x554ef8=_0x51fc76['count'],_0xfe3064=_0x382fae[_0x1955('0x1d')],_0x217ca9=_0x382fae[_0x1955('0x1d')]+_0x382fae[_0x1955('0x1e')],_0x1dc407;if(_0x217ca9>=_0x554ef8){_0x217ca9=_0x554ef8;_0x1dc407=0xc8;}else{_0x1dc407=0xce;}_0x1bff0a['status'](_0x1dc407);return _0x1bff0a[_0x1955('0x1f')](_0x1955('0x20'),_0xfe3064+'-'+_0x217ca9+'/'+_0x554ef8)[_0x1955('0x1c')](_0x51fc76);}return null;};}function patchUpdates(_0x58c11d){return function(_0xc2eb42){try{jsonpatch[_0x1955('0x21')](_0xc2eb42,_0x58c11d,!![]);}catch(_0x1e5b4c){return BPromise[_0x1955('0x22')](_0x1e5b4c);}return _0xc2eb42[_0x1955('0x23')]();};}function saveUpdates(_0xfa18c2,_0x22e25d){return function(_0x1b245f){if(_0x1b245f){return _0x1b245f['update'](_0xfa18c2)['then'](function(_0x2fd20e){return _0x2fd20e;});}return null;};}function removeEntity(_0x1a2140,_0x6b60fc){return function(_0x1f0b2c){if(_0x1f0b2c){return _0x1f0b2c[_0x1955('0x24')]()[_0x1955('0x25')](function(){_0x1a2140['status'](0xcc)[_0x1955('0x1b')]();});}};}function handleEntityNotFound(_0x5914f0,_0xc9e653){return function(_0x543b92){if(!_0x543b92){_0x5914f0[_0x1955('0x19')](0x194);}return _0x543b92;};}function handleError(_0xecfd6,_0x527ad3){_0x527ad3=_0x527ad3||0x1f4;return function(_0x4a1659){logger[_0x1955('0x26')](_0x4a1659[_0x1955('0x27')]);if(_0x4a1659[_0x1955('0x28')]){delete _0x4a1659[_0x1955('0x28')];}_0xecfd6[_0x1955('0x1a')](_0x527ad3)['send'](_0x4a1659);};}exports[_0x1955('0x29')]=function(_0x45dd9f,_0x32420f){if(_0x45dd9f['body']['id']){delete _0x45dd9f[_0x1955('0x2a')]['id'];}return db[_0x1955('0x2b')]['find']({'where':{'id':_0x45dd9f[_0x1955('0x2c')]['id']}})['then'](handleEntityNotFound(_0x32420f,null))[_0x1955('0x25')](saveUpdates(_0x45dd9f['body'],null))[_0x1955('0x25')](respondWithResult(_0x32420f,null))[_0x1955('0x2d')](handleError(_0x32420f,null));};exports[_0x1955('0x24')]=function(_0x47bb06,_0x1f01d6){return db['Action'][_0x1955('0x2e')]({'where':{'id':_0x47bb06[_0x1955('0x2c')]['id']}})[_0x1955('0x25')](handleEntityNotFound(_0x1f01d6,null))[_0x1955('0x25')](removeEntity(_0x1f01d6,null))[_0x1955('0x2d')](handleError(_0x1f01d6,null));}; \ No newline at end of file +var _0x7da0=['send','body','find','params','catch','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../config/license/hardware','ioredis','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','Content-Range','apply','reject','update','destroy','then','name'];(function(_0x178856,_0x41f045){var _0x3c7fe7=function(_0x4d9ce4){while(--_0x4d9ce4){_0x178856['push'](_0x178856['shift']());}};_0x3c7fe7(++_0x41f045);}(_0x7da0,0x9d));var _0x07da=function(_0x56ab6e,_0x4bcfb){_0x56ab6e=_0x56ab6e-0x0;var _0x30fa55=_0x7da0[_0x56ab6e];return _0x30fa55;};'use strict';var pdf=require(_0x07da('0x0'));var emlformat=require(_0x07da('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x07da('0x2'));var jsonpatch=require(_0x07da('0x3'));var rp=require('request-promise');var moment=require(_0x07da('0x4'));var BPromise=require(_0x07da('0x5'));var Mustache=require(_0x07da('0x6'));var util=require(_0x07da('0x7'));var path=require(_0x07da('0x8'));var sox=require(_0x07da('0x9'));var csv=require('to-csv');var ejs=require(_0x07da('0xa'));var fs=require('fs');var _=require(_0x07da('0xb'));var squel=require('squel');var crypto=require(_0x07da('0xc'));var jsforce=require(_0x07da('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x07da('0xe'));var querystring=require(_0x07da('0xf'));var Papa=require(_0x07da('0x10'));var authService=require('../../components/auth/service');var hardwareService=require(_0x07da('0x11'));var Redis=require(_0x07da('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0x07da('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x07da('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c6f44,_0x373444){_0x373444=_0x373444||0xcc;return function(_0x5a52c9){if(_0x5a52c9){return _0x4c6f44[_0x07da('0x15')](_0x373444);}return _0x4c6f44[_0x07da('0x16')](_0x373444)[_0x07da('0x17')]();};}function respondWithResult(_0x2d2dee,_0x1bba37){_0x1bba37=_0x1bba37||0xc8;return function(_0x4e99d1){if(_0x4e99d1){return _0x2d2dee[_0x07da('0x16')](_0x1bba37)[_0x07da('0x18')](_0x4e99d1);}};}function respondWithFilteredResult(_0x35c0bc,_0x1f4b6f){return function(_0x3f2e95){if(_0x3f2e95){var _0xc3aab2=_0x3f2e95['count'],_0x5392d6=_0x1f4b6f[_0x07da('0x19')],_0x58c960=_0x1f4b6f[_0x07da('0x19')]+_0x1f4b6f['limit'],_0x70da62;if(_0x58c960>=_0xc3aab2){_0x58c960=_0xc3aab2;_0x70da62=0xc8;}else{_0x70da62=0xce;}_0x35c0bc[_0x07da('0x16')](_0x70da62);return _0x35c0bc['set'](_0x07da('0x1a'),_0x5392d6+'-'+_0x58c960+'/'+_0xc3aab2)[_0x07da('0x18')](_0x3f2e95);}return null;};}function patchUpdates(_0x1184ee){return function(_0x5a5c7f){try{jsonpatch[_0x07da('0x1b')](_0x5a5c7f,_0x1184ee,!![]);}catch(_0x1fa2ac){return BPromise[_0x07da('0x1c')](_0x1fa2ac);}return _0x5a5c7f['save']();};}function saveUpdates(_0x4ca9e7,_0x1b2bd9){return function(_0x5c4b53){if(_0x5c4b53){return _0x5c4b53[_0x07da('0x1d')](_0x4ca9e7)['then'](function(_0x17aaa6){return _0x17aaa6;});}return null;};}function removeEntity(_0x1c8dfd,_0x1bdb21){return function(_0xc41790){if(_0xc41790){return _0xc41790[_0x07da('0x1e')]()[_0x07da('0x1f')](function(){_0x1c8dfd[_0x07da('0x16')](0xcc)[_0x07da('0x17')]();});}};}function handleEntityNotFound(_0x412a2b,_0x303951){return function(_0x3707d1){if(!_0x3707d1){_0x412a2b[_0x07da('0x15')](0x194);}return _0x3707d1;};}function handleError(_0x376520,_0x122d7c){_0x122d7c=_0x122d7c||0x1f4;return function(_0x5c461a){logger['error'](_0x5c461a['stack']);if(_0x5c461a[_0x07da('0x20')]){delete _0x5c461a['name'];}_0x376520[_0x07da('0x16')](_0x122d7c)[_0x07da('0x21')](_0x5c461a);};}exports['update']=function(_0x5d1ee9,_0xea4cba){if(_0x5d1ee9[_0x07da('0x22')]['id']){delete _0x5d1ee9['body']['id'];}return db['Action'][_0x07da('0x23')]({'where':{'id':_0x5d1ee9['params']['id']}})[_0x07da('0x1f')](handleEntityNotFound(_0xea4cba,null))[_0x07da('0x1f')](saveUpdates(_0x5d1ee9[_0x07da('0x22')],null))[_0x07da('0x1f')](respondWithResult(_0xea4cba,null))['catch'](handleError(_0xea4cba,null));};exports['destroy']=function(_0x29258e,_0x112163){return db['Action']['find']({'where':{'id':_0x29258e[_0x07da('0x24')]['id']}})[_0x07da('0x1f')](handleEntityNotFound(_0x112163,null))[_0x07da('0x1f')](removeEntity(_0x112163,null))[_0x07da('0x25')](handleError(_0x112163,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 28e2532..e357080 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 _0xfdf7=['bluebird','request-promise','./action.attributes','exports','define','Action','util','../../config/logger'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0xfdf7,0x14e));var _0x7fdf=function(_0x3690de,_0xaad404){_0x3690de=_0x3690de-0x0;var _0x9737de=_0xfdf7[_0x3690de];return _0x9737de;};'use strict';var _=require('lodash');var util=require(_0x7fdf('0x0'));var logger=require(_0x7fdf('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7fdf('0x2'));var rp=require(_0x7fdf('0x3'));var attributes=require(_0x7fdf('0x4'));module[_0x7fdf('0x5')]=function(_0x520701,_0x24cb37){return _0x520701[_0x7fdf('0x6')](_0x7fdf('0x7'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ab9=['../../config/logger','api','moment','bluebird','request-promise','./action.attributes','exports','Action','tools_actions','lodash','util'];(function(_0x5acd3a,_0x4ec17a){var _0x4ccd7f=function(_0xa2e92c){while(--_0xa2e92c){_0x5acd3a['push'](_0x5acd3a['shift']());}};_0x4ccd7f(++_0x4ec17a);}(_0x9ab9,0x82));var _0x99ab=function(_0x5687da,_0x5a2494){_0x5687da=_0x5687da-0x0;var _0x1dec5f=_0x9ab9[_0x5687da];return _0x1dec5f;};'use strict';var _=require(_0x99ab('0x0'));var util=require(_0x99ab('0x1'));var logger=require(_0x99ab('0x2'))(_0x99ab('0x3'));var moment=require(_0x99ab('0x4'));var BPromise=require(_0x99ab('0x5'));var rp=require(_0x99ab('0x6'));var attributes=require(_0x99ab('0x7'));module[_0x99ab('0x8')]=function(_0x1e3cf4,_0x5236a4){return _0x1e3cf4['define'](_0x99ab('0x9'),attributes,{'tableName':_0x99ab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index fcb5d5c..fd11dc1 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 _0x8ece=['client','http','then','info','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','Action,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8ece,0x195));var _0xe8ec=function(_0x48764a,_0x1590bc){_0x48764a=_0x48764a-0x0;var _0x31828b=_0x8ece[_0x48764a];return _0x31828b;};'use strict';var _=require(_0xe8ec('0x0'));var util=require(_0xe8ec('0x1'));var moment=require(_0xe8ec('0x2'));var BPromise=require(_0xe8ec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe8ec('0x4'))['db'];var utils=require(_0xe8ec('0x5'));var logger=require(_0xe8ec('0x6'))(_0xe8ec('0x7'));var config=require(_0xe8ec('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe8ec('0x9')][_0xe8ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x64ed4c,_0x234b67,_0x3682cb){return new BPromise(function(_0x122f36,_0x406f7e){return client['request'](_0x64ed4c,_0x3682cb)[_0xe8ec('0xb')](function(_0x5e1fe9){logger[_0xe8ec('0xc')]('Action,\x20%s,\x20%s',_0x234b67,_0xe8ec('0xd'));logger[_0xe8ec('0xe')](_0xe8ec('0xf'),_0x234b67,_0xe8ec('0xd'),JSON[_0xe8ec('0x10')](_0x5e1fe9));if(_0x5e1fe9[_0xe8ec('0x11')]){if(_0x5e1fe9[_0xe8ec('0x11')][_0xe8ec('0x12')]===0x1f4){logger[_0xe8ec('0x11')](_0xe8ec('0x13'),_0x234b67,_0x5e1fe9[_0xe8ec('0x11')][_0xe8ec('0x14')]);return _0x406f7e(_0x5e1fe9[_0xe8ec('0x11')]['message']);}logger[_0xe8ec('0x11')](_0xe8ec('0x13'),_0x234b67,_0x5e1fe9[_0xe8ec('0x11')][_0xe8ec('0x14')]);return _0x122f36(_0x5e1fe9[_0xe8ec('0x11')][_0xe8ec('0x14')]);}else{logger[_0xe8ec('0xc')](_0xe8ec('0x13'),_0x234b67,'request\x20sent');_0x122f36(_0x5e1fe9[_0xe8ec('0x15')][_0xe8ec('0x14')]);}})[_0xe8ec('0x16')](function(_0x50f8ed){logger[_0xe8ec('0x11')](_0xe8ec('0x13'),_0x234b67,_0x50f8ed);_0x406f7e(_0x50f8ed);});});} \ No newline at end of file +var _0x291c=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','code'];(function(_0x458760,_0x531cd3){var _0x589176=function(_0x496c01){while(--_0x496c01){_0x458760['push'](_0x458760['shift']());}};_0x589176(++_0x531cd3);}(_0x291c,0x137));var _0xc291=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x291c[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xc291('0x0'));var util=require(_0xc291('0x1'));var moment=require(_0xc291('0x2'));var BPromise=require(_0xc291('0x3'));var rs=require(_0xc291('0x4'));var fs=require('fs');var Redis=require(_0xc291('0x5'));var db=require(_0xc291('0x6'))['db'];var utils=require(_0xc291('0x7'));var logger=require(_0xc291('0x8'))(_0xc291('0x9'));var config=require(_0xc291('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc291('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a7459,_0x40dc89,_0x2d3526){return new BPromise(function(_0x42a6ac,_0x26e775){return client['request'](_0x5a7459,_0x2d3526)[_0xc291('0xc')](function(_0x2beb3b){logger[_0xc291('0xd')](_0xc291('0xe'),_0x40dc89,_0xc291('0xf'));logger[_0xc291('0x10')](_0xc291('0x11'),_0x40dc89,_0xc291('0xf'),JSON['stringify'](_0x2beb3b));if(_0x2beb3b['error']){if(_0x2beb3b['error'][_0xc291('0x12')]===0x1f4){logger[_0xc291('0x13')](_0xc291('0xe'),_0x40dc89,_0x2beb3b['error'][_0xc291('0x14')]);return _0x26e775(_0x2beb3b['error'][_0xc291('0x14')]);}logger[_0xc291('0x13')](_0xc291('0xe'),_0x40dc89,_0x2beb3b[_0xc291('0x13')][_0xc291('0x14')]);return _0x42a6ac(_0x2beb3b[_0xc291('0x13')][_0xc291('0x14')]);}else{logger[_0xc291('0xd')](_0xc291('0xe'),_0x40dc89,_0xc291('0xf'));_0x42a6ac(_0x2beb3b['result'][_0xc291('0x14')]);}})[_0xc291('0x15')](function(_0x5888de){logger[_0xc291('0x13')]('Action,\x20%s,\x20%s',_0x40dc89,_0x5888de);_0x26e775(_0x5888de);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 7de3cce..bd417ec 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 _0x4fc2=['./action.controller','put','isAuthenticated','update','/:id','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xfd85fd,_0x5b13a8){var _0x53e0ec=function(_0x2171f4){while(--_0x2171f4){_0xfd85fd['push'](_0xfd85fd['shift']());}};_0x53e0ec(++_0x5b13a8);}(_0x4fc2,0x111));var _0x24fc=function(_0x268186,_0x4dc3e4){_0x268186=_0x268186-0x0;var _0x3c3d1a=_0x4fc2[_0x268186];return _0x3c3d1a;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var auth=require(_0x24fc('0x5'));var interaction=require(_0x24fc('0x6'));var config=require('../../config/environment');var controller=require(_0x24fc('0x7'));router[_0x24fc('0x8')]('/:id',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['delete'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);module[_0x24fc('0xd')]=router; \ No newline at end of file +var _0x3cfb=['./action.controller','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4f431d,_0xd51a3b){var _0x4f31e1=function(_0x1c688d){while(--_0x1c688d){_0x4f431d['push'](_0x4f431d['shift']());}};_0x4f31e1(++_0xd51a3b);}(_0x3cfb,0x1b8));var _0xb3cf=function(_0x16fc82,_0x207615){_0x16fc82=_0x16fc82-0x0;var _0x205198=_0x3cfb[_0x16fc82];return _0x205198;};'use strict';var multer=require(_0xb3cf('0x0'));var util=require(_0xb3cf('0x1'));var path=require(_0xb3cf('0x2'));var timeout=require(_0xb3cf('0x3'));var express=require(_0xb3cf('0x4'));var router=express[_0xb3cf('0x5')]();var auth=require(_0xb3cf('0x6'));var interaction=require(_0xb3cf('0x7'));var config=require('../../config/environment');var controller=require(_0xb3cf('0x8'));router[_0xb3cf('0x9')](_0xb3cf('0xa'),auth['isAuthenticated'](),controller[_0xb3cf('0xb')]);router[_0xb3cf('0xc')](_0xb3cf('0xa'),auth['isAuthenticated'](),controller[_0xb3cf('0xd')]);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 fe8c850..d602c09 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 _0x290f=['exports','STRING','TEXT','sequelize'];(function(_0x3b60b1,_0x3d575c){var _0x30e8cd=function(_0xd95ea8){while(--_0xd95ea8){_0x3b60b1['push'](_0x3b60b1['shift']());}};_0x30e8cd(++_0x3d575c);}(_0x290f,0x123));var _0xf290=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x290f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf290('0x0'));module[_0xf290('0x1')]={'name':{'type':Sequelize[_0xf290('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf290('0x2')]},'parent':{'type':Sequelize[_0xf290('0x2')]},'table':{'type':Sequelize[_0xf290('0x2')]},'conditions':{'type':Sequelize[_0xf290('0x3')]},'joins':{'type':Sequelize[_0xf290('0x3')]}}; \ No newline at end of file +var _0x1500=['sequelize','STRING','TEXT'];(function(_0x30a580,_0x271716){var _0x30c819=function(_0x173eef){while(--_0x173eef){_0x30a580['push'](_0x30a580['shift']());}};_0x30c819(++_0x271716);}(_0x1500,0x96));var _0x0150=function(_0x10effe,_0x1e5835){_0x10effe=_0x10effe-0x0;var _0x5530ee=_0x1500[_0x10effe];return _0x5530ee;};'use strict';var Sequelize=require(_0x0150('0x0'));module['exports']={'name':{'type':Sequelize[_0x0150('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x0150('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x0150('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index ef828d4..7615ac9 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 _0xfd07=['findAll','rows','catch','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','params','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','DESC','joins','type','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','AnalyticMetric','from','alias','parse','clone','No\x20available\x20data','%s-%s.%s','randomstring','generate','output','csv','custom','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','run','runReport','right_join','html-pdf','eml-format','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','get','CustomReports','UserProfileResource','error','stack','name','send','index','AnalyticCustomReport','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','merge','map','VIRTUAL','field','filter','options','include'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0xfd07,0x104));var _0x7fd0=function(_0x4709c8,_0x3384ca){_0x4709c8=_0x4709c8-0x0;var _0x478cdd=_0xfd07[_0x4709c8];return _0x478cdd;};'use strict';var pdf=require(_0x7fd0('0x0'));var emlformat=require(_0x7fd0('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7fd0('0x2'));var BPromise=require(_0x7fd0('0x3'));var Mustache=require(_0x7fd0('0x4'));var util=require('util');var path=require('path');var sox=require(_0x7fd0('0x5'));var csv=require(_0x7fd0('0x6'));var ejs=require(_0x7fd0('0x7'));var fs=require('fs');var _=require(_0x7fd0('0x8'));var squel=require('squel');var crypto=require(_0x7fd0('0x9'));var jsforce=require(_0x7fd0('0xa'));var deskjs=require(_0x7fd0('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7fd0('0xc'));var authService=require('../../components/auth/service');var hardwareService=require(_0x7fd0('0xd'));var Redis=require(_0x7fd0('0xe'));var qs=require(_0x7fd0('0xf'));var logger=require(_0x7fd0('0x10'))(_0x7fd0('0x11'));var utils=require(_0x7fd0('0x12'));var config=require(_0x7fd0('0x13'));var db=require(_0x7fd0('0x14'))['db'];function respondWithStatusCode(_0x34e71a,_0x5d4afa){_0x5d4afa=_0x5d4afa||0xcc;return function(_0x5922ac){if(_0x5922ac){return _0x34e71a[_0x7fd0('0x15')](_0x5d4afa);}return _0x34e71a[_0x7fd0('0x16')](_0x5d4afa)[_0x7fd0('0x17')]();};}function respondWithResult(_0x3095c7,_0x15ba65){_0x15ba65=_0x15ba65||0xc8;return function(_0x463526){if(_0x463526){return _0x3095c7[_0x7fd0('0x16')](_0x15ba65)['json'](_0x463526);}};}function respondWithFilteredResult(_0x3719ee,_0x407ae9){return function(_0x3bf1be){if(_0x3bf1be){var _0x3289f1=_0x3bf1be[_0x7fd0('0x18')],_0x2ab283=_0x407ae9['offset'],_0x11115=_0x407ae9[_0x7fd0('0x19')]+_0x407ae9[_0x7fd0('0x1a')],_0x213f54;if(_0x11115>=_0x3289f1){_0x11115=_0x3289f1;_0x213f54=0xc8;}else{_0x213f54=0xce;}_0x3719ee['status'](_0x213f54);return _0x3719ee[_0x7fd0('0x1b')](_0x7fd0('0x1c'),_0x2ab283+'-'+_0x11115+'/'+_0x3289f1)[_0x7fd0('0x1d')](_0x3bf1be);}return null;};}function patchUpdates(_0x1db0e6){return function(_0x173b76){try{jsonpatch[_0x7fd0('0x1e')](_0x173b76,_0x1db0e6,!![]);}catch(_0x458622){return BPromise[_0x7fd0('0x1f')](_0x458622);}return _0x173b76[_0x7fd0('0x20')]();};}function saveUpdates(_0x4b00df,_0x34dfc0){return function(_0x1ec783){if(_0x1ec783){return _0x1ec783[_0x7fd0('0x21')](_0x4b00df)['then'](function(_0x30d9d6){return _0x30d9d6;});}return null;};}function removeEntity(_0x3879be,_0x5a7caf){return function(_0x19b2e3){if(_0x19b2e3){return _0x19b2e3[_0x7fd0('0x22')]()[_0x7fd0('0x23')](function(){var _0x3ee637=_0x19b2e3[_0x7fd0('0x24')]({'plain':!![]});var _0x3090a6=_0x7fd0('0x25');return db[_0x7fd0('0x26')][_0x7fd0('0x22')]({'where':{'type':_0x3090a6,'resourceId':_0x3ee637['id']}})[_0x7fd0('0x23')](function(){return _0x19b2e3;});})['then'](function(){_0x3879be[_0x7fd0('0x16')](0xcc)[_0x7fd0('0x17')]();});}};}function handleEntityNotFound(_0x525bd0,_0x17caca){return function(_0x2bcf60){if(!_0x2bcf60){_0x525bd0['sendStatus'](0x194);}return _0x2bcf60;};}function handleError(_0x308c4e,_0x434b38){_0x434b38=_0x434b38||0x1f4;return function(_0x4a80ee){logger[_0x7fd0('0x27')](_0x4a80ee[_0x7fd0('0x28')]);if(_0x4a80ee[_0x7fd0('0x29')]){delete _0x4a80ee[_0x7fd0('0x29')];}_0x308c4e[_0x7fd0('0x16')](_0x434b38)[_0x7fd0('0x2a')](_0x4a80ee);};}exports[_0x7fd0('0x2b')]=function(_0x48a42f,_0x2279bc){var _0x7561fa={},_0x326688={},_0x1b2c68={'count':0x0,'rows':[]};var _0x23cbf0=db[_0x7fd0('0x2c')]['rawAttributes'];_0x326688[_0x7fd0('0x2d')]=_['keys'](_0x23cbf0);_0x326688[_0x7fd0('0x2e')]=_[_0x7fd0('0x2f')](_0x48a42f[_0x7fd0('0x2e')]);_0x326688[_0x7fd0('0x30')]=_['intersection'](_0x326688[_0x7fd0('0x2d')],_0x326688[_0x7fd0('0x2e')]);_0x7561fa[_0x7fd0('0x31')]=_[_0x7fd0('0x32')](_0x326688[_0x7fd0('0x2d')],qs['fields'](_0x48a42f[_0x7fd0('0x2e')][_0x7fd0('0x33')]));_0x7561fa[_0x7fd0('0x31')]=_0x7561fa[_0x7fd0('0x31')][_0x7fd0('0x34')]?_0x7561fa[_0x7fd0('0x31')]:_0x326688[_0x7fd0('0x2d')];if(!_0x48a42f[_0x7fd0('0x2e')]['hasOwnProperty'](_0x7fd0('0x35'))){_0x7561fa[_0x7fd0('0x1a')]=qs['limit'](_0x48a42f[_0x7fd0('0x2e')][_0x7fd0('0x1a')]);_0x7561fa[_0x7fd0('0x19')]=qs[_0x7fd0('0x19')](_0x48a42f[_0x7fd0('0x2e')][_0x7fd0('0x19')]);}_0x7561fa['order']=qs[_0x7fd0('0x36')](_0x48a42f[_0x7fd0('0x2e')]['sort']);_0x7561fa[_0x7fd0('0x37')]=qs[_0x7fd0('0x30')](_[_0x7fd0('0x38')](_0x48a42f[_0x7fd0('0x2e')],_0x326688[_0x7fd0('0x30')]));if(_0x48a42f[_0x7fd0('0x2e')]['filter']){_0x7561fa[_0x7fd0('0x37')]=_[_0x7fd0('0x39')](_0x7561fa[_0x7fd0('0x37')],{'$or':_[_0x7fd0('0x3a')](_0x23cbf0,function(_0x26e9c0){if(_0x26e9c0['type']['key']!==_0x7fd0('0x3b')){var _0xba1eb2={};_0xba1eb2[_0x26e9c0[_0x7fd0('0x3c')]]={'$like':'%'+_0x48a42f[_0x7fd0('0x2e')][_0x7fd0('0x3d')]+'%'};return _0xba1eb2;}})});}_0x7561fa=_['merge']({},_0x7561fa,_0x48a42f[_0x7fd0('0x3e')]);var _0x10a303={'where':_0x7561fa[_0x7fd0('0x37')]};return db['AnalyticCustomReport'][_0x7fd0('0x18')](_0x10a303)[_0x7fd0('0x23')](function(_0xb39b1e){_0x1b2c68['count']=_0xb39b1e;if(_0x48a42f[_0x7fd0('0x2e')]['includeAll']){_0x7561fa[_0x7fd0('0x3f')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x7fd0('0x40')](_0x7561fa);})[_0x7fd0('0x23')](function(_0x405b11){_0x1b2c68[_0x7fd0('0x41')]=_0x405b11;return _0x1b2c68;})['then'](respondWithFilteredResult(_0x2279bc,_0x7561fa))[_0x7fd0('0x42')](handleError(_0x2279bc,null));};exports['show']=function(_0x2e0496,_0x22c6da){var _0x4042f6={'raw':![],'where':{'id':_0x2e0496['params']['id']}},_0x1a5ae0={};_0x1a5ae0[_0x7fd0('0x2d')]=_[_0x7fd0('0x2f')](db[_0x7fd0('0x2c')][_0x7fd0('0x43')]);_0x1a5ae0['query']=_[_0x7fd0('0x2f')](_0x2e0496[_0x7fd0('0x2e')]);_0x1a5ae0[_0x7fd0('0x30')]=_['intersection'](_0x1a5ae0[_0x7fd0('0x2d')],_0x1a5ae0[_0x7fd0('0x2e')]);_0x4042f6[_0x7fd0('0x31')]=_[_0x7fd0('0x32')](_0x1a5ae0[_0x7fd0('0x2d')],qs[_0x7fd0('0x33')](_0x2e0496['query'][_0x7fd0('0x33')]));_0x4042f6[_0x7fd0('0x31')]=_0x4042f6[_0x7fd0('0x31')]['length']?_0x4042f6[_0x7fd0('0x31')]:_0x1a5ae0[_0x7fd0('0x2d')];if(_0x2e0496['query'][_0x7fd0('0x44')]){_0x4042f6['include']=[{'all':!![]}];}_0x4042f6=_['merge']({},_0x4042f6,_0x2e0496['options']);return db[_0x7fd0('0x2c')][_0x7fd0('0x45')](_0x4042f6)['then'](handleEntityNotFound(_0x22c6da,null))[_0x7fd0('0x23')](respondWithResult(_0x22c6da,null))[_0x7fd0('0x42')](handleError(_0x22c6da,null));};exports[_0x7fd0('0x46')]=function(_0xd611e2,_0x4c4334){return db[_0x7fd0('0x2c')][_0x7fd0('0x46')](_0xd611e2[_0x7fd0('0x47')],{})[_0x7fd0('0x23')](function(_0xea516a){var _0x25229d=_0xd611e2[_0x7fd0('0x48')][_0x7fd0('0x24')]({'plain':!![]});if(!_0x25229d)throw new Error(_0x7fd0('0x49'));if(_0x25229d[_0x7fd0('0x4a')]==='user'){var _0x21cb49=_0xea516a['get']({'plain':!![]});var _0x3434af=_0x7fd0('0x4b');return db[_0x7fd0('0x4c')]['find']({'where':{'name':_0x3434af,'userProfileId':_0x25229d[_0x7fd0('0x4d')]},'raw':!![]})['then'](function(_0x427bae){if(_0x427bae&&_0x427bae['autoAssociation']===0x0){return db[_0x7fd0('0x26')][_0x7fd0('0x46')]({'name':_0x21cb49[_0x7fd0('0x29')],'resourceId':_0x21cb49['id'],'type':_0x7fd0('0x25'),'sectionId':_0x427bae['id']},{})[_0x7fd0('0x23')](function(){return _0xea516a;});}else{return _0xea516a;}})['catch'](function(_0x2cb87e){logger[_0x7fd0('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cb87e);throw _0x2cb87e;});}return _0xea516a;})[_0x7fd0('0x23')](respondWithResult(_0x4c4334,0xc9))[_0x7fd0('0x42')](handleError(_0x4c4334,null));};exports[_0x7fd0('0x21')]=function(_0x49d31d,_0x3c432c){if(_0x49d31d[_0x7fd0('0x47')]['id']){delete _0x49d31d[_0x7fd0('0x47')]['id'];}return db[_0x7fd0('0x2c')][_0x7fd0('0x45')]({'where':{'id':_0x49d31d[_0x7fd0('0x4e')]['id']}})[_0x7fd0('0x23')](handleEntityNotFound(_0x3c432c,null))[_0x7fd0('0x23')](saveUpdates(_0x49d31d['body'],null))[_0x7fd0('0x23')](respondWithResult(_0x3c432c,null))[_0x7fd0('0x42')](handleError(_0x3c432c,null));};exports['destroy']=function(_0x17fc5b,_0x2d9ed8){return db[_0x7fd0('0x2c')][_0x7fd0('0x45')]({'where':{'id':_0x17fc5b[_0x7fd0('0x4e')]['id']}})[_0x7fd0('0x23')](handleEntityNotFound(_0x2d9ed8,null))[_0x7fd0('0x23')](removeEntity(_0x2d9ed8,null))[_0x7fd0('0x42')](handleError(_0x2d9ed8,null));};exports[_0x7fd0('0x4f')]=function(_0x34a155,_0x4725a6){var _0x62cb3=0xa;var _0x13aefc=[_0x7fd0('0x50'),_0x7fd0('0x51'),'right_join',_0x7fd0('0x52')];var _0x540bba={'SUM':_0x7fd0('0x53'),'COUNT':_0x7fd0('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7fd0('0x55'),'MIN':_0x7fd0('0x56'),'AVG':_0x7fd0('0x57'),'GROUP_CONCAT':_0x7fd0('0x58'),'GROUP_CONCAT ASC':_0x7fd0('0x59'),'GROUP_CONCAT DESC':_0x7fd0('0x5a')};var _0x32cc3d={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x7fd0('0x5b'),'HOUR':_0x7fd0('0x5c'),'ROUND':_0x7fd0('0x5d'),'UNIX_TIMESTAMP':_0x7fd0('0x5e')};var _0x3b81ba=function(_0x4c6c92){return!_[_0x7fd0('0x5f')]([_0x7fd0('0x60'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x7fd0('0x61')],_0x4c6c92);};var _0x2068ca=function(_0x5b2df1){if(!_0x5b2df1||!_0x5b2df1[_0x7fd0('0x62')]['length']){return'';}for(var _0x122a99='(',_0x4fd5f4=0x0;_0x4fd5f4<_0x5b2df1[_0x7fd0('0x62')][_0x7fd0('0x34')];_0x4fd5f4+=0x1){_0x4fd5f4>0x0&&(_0x122a99+='\x20'+_0x5b2df1[_0x7fd0('0x63')]+'\x20');_0x122a99+=_0x5b2df1[_0x7fd0('0x62')][_0x4fd5f4][_0x7fd0('0x64')]?_0x2068ca(_0x5b2df1[_0x7fd0('0x62')][_0x4fd5f4][_0x7fd0('0x64')]):_0x5b2df1[_0x7fd0('0x62')][_0x4fd5f4]['field']+'\x20'+_0x5b2df1[_0x7fd0('0x62')][_0x4fd5f4]['condition']+(_0x3b81ba(_0x5b2df1[_0x7fd0('0x62')][_0x4fd5f4][_0x7fd0('0x65')])?'\x20'+_0x5b2df1[_0x7fd0('0x62')][_0x4fd5f4][_0x7fd0('0x66')]:'');}return _0x122a99+')';};var _0x4dbe79={'where':{'id':_0x34a155[_0x7fd0('0x4e')]['id']}},_0x175ec7,_0x833b95,_0x1870ea,_0x2826c7,_0x5b440c;_0x4dbe79=_[_0x7fd0('0x39')]({},_0x4dbe79,_0x34a155[_0x7fd0('0x3e')]);return db[_0x7fd0('0x2c')][_0x7fd0('0x45')](_0x4dbe79)[_0x7fd0('0x23')](function(_0x34c86c){if(_0x34c86c){_0x175ec7=_0x34c86c;return _0x34c86c[_0x7fd0('0x67')]();}return null;})[_0x7fd0('0x23')](function(_0x3ff784){if(_0x3ff784){if(!_0x3ff784['length']){throw new db[(_0x7fd0('0x68'))][(_0x7fd0('0x69'))](_0x7fd0('0x6a'),0x193);}_0x833b95=_0x3ff784;return db['AnalyticMetric'][_0x7fd0('0x40')]({'raw':!![]});}return null;})[_0x7fd0('0x23')](function(_0x371acb){if(_0x371acb){_0x1870ea=_[_0x7fd0('0x6b')](_0x371acb,'id');var _0x46180c;var _0x2ade7b=squel[_0x7fd0('0x6c')]();_0x2ade7b['from'](_0x175ec7[_0x7fd0('0x6d')]);for(var _0x31c2f4=0x0;_0x31c2f4<_0x833b95['length'];_0x31c2f4+=0x1){_0x46180c=_0x833b95[_0x31c2f4][_0x7fd0('0x6e')]?_0x1870ea[_0x833b95[_0x31c2f4][_0x7fd0('0x6e')]][_0x7fd0('0x6f')]:_0x833b95[_0x31c2f4][_0x7fd0('0x3c')];_0x46180c=_0x833b95[_0x31c2f4][_0x7fd0('0x70')]?_[_0x7fd0('0x71')](_0x540bba[_0x833b95[_0x31c2f4]['function']],'%s',_0x46180c):_0x46180c;_0x46180c=_0x833b95[_0x31c2f4]['format']?_[_0x7fd0('0x71')](_0x32cc3d[_0x833b95[_0x31c2f4][_0x7fd0('0x72')]],'%s',_0x46180c):_0x46180c;if(_0x833b95[_0x31c2f4][_0x7fd0('0x73')]){_0x2ade7b[_0x7fd0('0x64')](_0x46180c);}_0x833b95[_0x31c2f4][_0x7fd0('0x74')]&&_0x2ade7b[_0x7fd0('0x75')](_0x46180c,_0x833b95[_0x31c2f4][_0x7fd0('0x74')]===_0x7fd0('0x76')?![]:!![]);_0x2ade7b[_0x7fd0('0x3c')](_0x46180c,_0x833b95[_0x31c2f4]['alias']||_0x46180c);}if(_0x175ec7[_0x7fd0('0x77')]){_0x175ec7[_0x7fd0('0x77')]=JSON['parse'](_0x175ec7[_0x7fd0('0x77')]);for(var _0x3caa6e=0x0;_0x3caa6e<_0x175ec7[_0x7fd0('0x77')][_0x7fd0('0x34')];_0x3caa6e+=0x1){if(_0x175ec7[_0x7fd0('0x77')][_0x3caa6e][_0x7fd0('0x78')]&&_[_0x7fd0('0x5f')](_0x13aefc,_0x175ec7[_0x7fd0('0x77')][_0x3caa6e]['type'])&&_0x175ec7[_0x7fd0('0x77')][_0x3caa6e][_0x7fd0('0x79')]&&_0x175ec7[_0x7fd0('0x77')][_0x3caa6e]['foreignTable']&&_0x175ec7[_0x7fd0('0x77')][_0x3caa6e][_0x7fd0('0x7a')]){_0x2ade7b[_0x175ec7[_0x7fd0('0x77')][_0x3caa6e][_0x7fd0('0x78')]](_0x175ec7[_0x7fd0('0x77')][_0x3caa6e][_0x7fd0('0x7b')],null,util[_0x7fd0('0x72')](_0x7fd0('0x7c'),_0x175ec7[_0x7fd0('0x6d')],_0x175ec7[_0x7fd0('0x77')][_0x3caa6e][_0x7fd0('0x79')],_0x175ec7['joins'][_0x3caa6e][_0x7fd0('0x7b')],_0x175ec7[_0x7fd0('0x77')][_0x3caa6e][_0x7fd0('0x7a')]));}}}if(_0x175ec7['conditions']){_0x175ec7[_0x7fd0('0x7d')]=JSON['parse'](_0x175ec7[_0x7fd0('0x7d')]);_0x2ade7b['where'](_0x2068ca(_0x175ec7[_0x7fd0('0x7d')][_0x7fd0('0x64')]));}_0x5b440c=_0x2ade7b['clone']();_0x2ade7b[_0x7fd0('0x1a')](_0x62cb3);_0x2ade7b[_0x7fd0('0x19')](0x0);logger[_0x7fd0('0x7e')](_0x7fd0('0x7f'),_0x2ade7b[_0x7fd0('0x80')]());return db['sequelize'][_0x7fd0('0x2e')](_0x2ade7b[_0x7fd0('0x80')](),{'type':db[_0x7fd0('0x81')][_0x7fd0('0x82')][_0x7fd0('0x83')]});}})[_0x7fd0('0x23')](respondWithResult(_0x4725a6,null))[_0x7fd0('0x42')](handleError(_0x4725a6,null));};function runReport(_0x18d7bf,_0x54a610,_0x1b6149){var _0x2e2d14=_0x54a610[_0x7fd0('0x29')];var _0x2a7c94=0xa;var _0x1337bf=[_0x7fd0('0x50'),_0x7fd0('0x51'),'right_join',_0x7fd0('0x52')];var _0x42216d={'SUM':_0x7fd0('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x7fd0('0x84'),'MAX':_0x7fd0('0x55'),'MIN':_0x7fd0('0x56'),'AVG':_0x7fd0('0x57'),'GROUP_CONCAT':_0x7fd0('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7fd0('0x5a')};var _0x5332e4={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x7fd0('0x5c'),'ROUND':_0x7fd0('0x5d'),'UNIX_TIMESTAMP':_0x7fd0('0x5e')};var _0x3728e2=function(_0x445864){return!_['includes'](['IS\x20NULL',_0x7fd0('0x85'),_0x7fd0('0x86'),_0x7fd0('0x61')],_0x445864);};var _0x3c8913=function(_0x3197f9){if(!_0x3197f9||!_0x3197f9[_0x7fd0('0x62')][_0x7fd0('0x34')]){return'';}for(var _0x7697ce='(',_0xb633f6=0x0;_0xb633f6<_0x3197f9[_0x7fd0('0x62')]['length'];_0xb633f6+=0x1){_0xb633f6>0x0&&(_0x7697ce+='\x20'+_0x3197f9[_0x7fd0('0x63')]+'\x20');_0x7697ce+=_0x3197f9[_0x7fd0('0x62')][_0xb633f6][_0x7fd0('0x64')]?_0x3c8913(_0x3197f9['rules'][_0xb633f6][_0x7fd0('0x64')]):_0x3197f9[_0x7fd0('0x62')][_0xb633f6][_0x7fd0('0x3c')]+'\x20'+_0x3197f9[_0x7fd0('0x62')][_0xb633f6][_0x7fd0('0x65')]+(_0x3728e2(_0x3197f9[_0x7fd0('0x62')][_0xb633f6][_0x7fd0('0x65')])?'\x20'+_0x3197f9[_0x7fd0('0x62')][_0xb633f6]['value']:'');}return _0x7697ce+')';};var _0x24da1b={'where':{'id':_0x18d7bf['id']}},_0x2f7263,_0x60f57c,_0x3d5aca,_0x3d9132,_0x38c66f;_0x24da1b=_[_0x7fd0('0x39')]({},_0x24da1b,_0x1b6149);return db['AnalyticCustomReport'][_0x7fd0('0x45')](_0x24da1b)[_0x7fd0('0x23')](function(_0x24a00f){if(_0x24a00f){_0x2f7263=_0x24a00f;return _0x24a00f[_0x7fd0('0x67')]();}return null;})[_0x7fd0('0x23')](function(_0x59e526){if(_0x59e526){if(!_0x59e526[_0x7fd0('0x34')]){throw new db[(_0x7fd0('0x68'))][(_0x7fd0('0x69'))](_0x7fd0('0x6a'),0x193);}_0x60f57c=_0x59e526;return db[_0x7fd0('0x87')][_0x7fd0('0x40')]({'raw':!![]});}return null;})[_0x7fd0('0x23')](function(_0x424651){if(_0x424651){_0x3d5aca=_[_0x7fd0('0x6b')](_0x424651,'id');var _0x2df832;var _0x568bf0=squel[_0x7fd0('0x6c')]();_0x568bf0[_0x7fd0('0x88')](_0x2f7263[_0x7fd0('0x6d')]);for(var _0x1e005c=0x0;_0x1e005c<_0x60f57c[_0x7fd0('0x34')];_0x1e005c+=0x1){_0x2df832=_0x60f57c[_0x1e005c]['MetricId']?_0x3d5aca[_0x60f57c[_0x1e005c]['MetricId']][_0x7fd0('0x6f')]:_0x60f57c[_0x1e005c][_0x7fd0('0x3c')];_0x2df832=_0x60f57c[_0x1e005c][_0x7fd0('0x70')]?_[_0x7fd0('0x71')](_0x42216d[_0x60f57c[_0x1e005c][_0x7fd0('0x70')]],'%s',_0x2df832):_0x2df832;_0x2df832=_0x60f57c[_0x1e005c][_0x7fd0('0x72')]?_['replace'](_0x5332e4[_0x60f57c[_0x1e005c][_0x7fd0('0x72')]],'%s',_0x2df832):_0x2df832;if(_0x60f57c[_0x1e005c][_0x7fd0('0x73')]){_0x568bf0[_0x7fd0('0x64')](_0x2df832);}_0x60f57c[_0x1e005c][_0x7fd0('0x74')]&&_0x568bf0[_0x7fd0('0x75')](_0x2df832,_0x60f57c[_0x1e005c][_0x7fd0('0x74')]===_0x7fd0('0x76')?![]:!![]);_0x568bf0['field'](_0x2df832,_0x60f57c[_0x1e005c][_0x7fd0('0x89')]||_0x2df832);}if(_0x2f7263[_0x7fd0('0x77')]){_0x2f7263[_0x7fd0('0x77')]=JSON[_0x7fd0('0x8a')](_0x2f7263[_0x7fd0('0x77')]);for(var _0x1b4af7=0x0;_0x1b4af7<_0x2f7263[_0x7fd0('0x77')][_0x7fd0('0x34')];_0x1b4af7+=0x1){if(_0x2f7263[_0x7fd0('0x77')][_0x1b4af7][_0x7fd0('0x78')]&&_[_0x7fd0('0x5f')](_0x1337bf,_0x2f7263['joins'][_0x1b4af7][_0x7fd0('0x78')])&&_0x2f7263[_0x7fd0('0x77')][_0x1b4af7][_0x7fd0('0x79')]&&_0x2f7263[_0x7fd0('0x77')][_0x1b4af7][_0x7fd0('0x7b')]&&_0x2f7263['joins'][_0x1b4af7]['foreignKey']){_0x568bf0[_0x2f7263[_0x7fd0('0x77')][_0x1b4af7][_0x7fd0('0x78')]](_0x2f7263[_0x7fd0('0x77')][_0x1b4af7][_0x7fd0('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2f7263[_0x7fd0('0x6d')],_0x2f7263['joins'][_0x1b4af7][_0x7fd0('0x79')],_0x2f7263[_0x7fd0('0x77')][_0x1b4af7][_0x7fd0('0x7b')],_0x2f7263[_0x7fd0('0x77')][_0x1b4af7]['foreignKey']));}}}if(_0x2f7263[_0x7fd0('0x7d')]){_0x2f7263[_0x7fd0('0x7d')]=JSON[_0x7fd0('0x8a')](_0x2f7263['conditions']);_0x568bf0[_0x7fd0('0x37')](_0x3c8913(_0x2f7263[_0x7fd0('0x7d')][_0x7fd0('0x64')]));}_0x38c66f=_0x568bf0[_0x7fd0('0x8b')]();_0x568bf0[_0x7fd0('0x1a')](_0x2a7c94);_0x568bf0[_0x7fd0('0x19')](0x0);logger[_0x7fd0('0x7e')](_0x7fd0('0x7f'),_0x568bf0[_0x7fd0('0x80')]());return db['sequelize']['query'](_0x568bf0[_0x7fd0('0x80')](),{'type':db[_0x7fd0('0x81')]['QueryTypes'][_0x7fd0('0x83')]});}})[_0x7fd0('0x23')](function(_0x126fa6){if(!_0x126fa6['length']){throw new db[(_0x7fd0('0x68'))][(_0x7fd0('0x69'))](_0x7fd0('0x8c'),0xcc);}if(_0x54a610['output']==='web'){return null;}var _0x13fffa=_[_0x7fd0('0x39')](_0x54a610,{'name':_0x54a610['fullPath']||_0x54a610[_0x7fd0('0x29')]||_0x2f7263['name'],'basename':_0x2e2d14,'savename':util['format'](_0x7fd0('0x8d'),_0x54a610[_0x7fd0('0x29')]||_0x2f7263[_0x7fd0('0x29')],require(_0x7fd0('0x8e'))[_0x7fd0('0x8f')](0x4),_0x54a610[_0x7fd0('0x90')]||_0x7fd0('0x91')),'reportId':_0x2f7263['id'],'reportType':_0x7fd0('0x92')});return db[_0x7fd0('0x93')]['create'](_0x13fffa,{'raw':!![]});})[_0x7fd0('0x23')](function(_0x5ba03e){if(_0x2f7263[_0x7fd0('0x6d')]===_0x7fd0('0x94')){_0x38c66f[_0x7fd0('0x37')](_0x2f7263[_0x7fd0('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x54a610[_0x7fd0('0x95')],_0x54a610[_0x7fd0('0x96')]);}else{_0x38c66f[_0x7fd0('0x37')](_0x2f7263[_0x7fd0('0x6d')]+_0x7fd0('0x97'),_0x54a610[_0x7fd0('0x95')],_0x54a610['endDate']);}if(_0x5ba03e){logger['info'](_0x7fd0('0x98'),_0x38c66f[_0x7fd0('0x80')]());require(_0x7fd0('0x99'))[_0x7fd0('0x9a')](path[_0x7fd0('0x50')](__dirname,_0x7fd0('0x9b'),_0x5ba03e[_0x7fd0('0x90')]),[_0x5ba03e['id'],_0x38c66f['toString'](),path['join'](__dirname,_0x7fd0('0x9c'),_0x5ba03e['savename']),_0x2e2d14]);return _0x5ba03e;}else{var _0x16401c=squel[_0x7fd0('0x6c')]();_0x16401c[_0x7fd0('0x88')]('('+_0x38c66f[_0x7fd0('0x80')]()+')',_0x7fd0('0x9d'));_0x16401c[_0x7fd0('0x3c')](_0x7fd0('0x9e'),_0x7fd0('0x18'));_0x38c66f['limit'](_0x54a610[_0x7fd0('0x1a')]||_0x2a7c94);_0x38c66f[_0x7fd0('0x19')](_0x54a610[_0x7fd0('0x19')]||0x0);return db[_0x7fd0('0x81')][_0x7fd0('0x2e')](_0x16401c['toString'](),{'type':db[_0x7fd0('0x81')][_0x7fd0('0x82')][_0x7fd0('0x83')]})['then'](function(_0x21bb5e){if(!_0x21bb5e[_0x7fd0('0x34')]){_0x3d9132=0x0;}else{_0x3d9132=_0x21bb5e[0x0]['count']||0x0;}return db['sequelize'][_0x7fd0('0x2e')](_0x38c66f[_0x7fd0('0x80')](),{'type':db[_0x7fd0('0x81')]['QueryTypes'][_0x7fd0('0x83')]});})['then'](function(_0x576ffb){return{'rows':_0x576ffb||[],'count':_0x3d9132};});}});}exports[_0x7fd0('0x9f')]=function(_0x479e56,_0x11368c){return runReport(_0x479e56[_0x7fd0('0x4e')],_0x479e56[_0x7fd0('0x2e')],_0x479e56['options'])[_0x7fd0('0x23')](respondWithResult(_0x11368c,null))[_0x7fd0('0x42')](handleError(_0x11368c,null));};exports[_0x7fd0('0xa0')]=runReport;exports[_0x7fd0('0x2e')]=function(_0x2f44ea,_0x568c37){var _0x52b703=0xa;var _0xfc7552=['join',_0x7fd0('0x51'),_0x7fd0('0xa1'),'cross_join'];var _0x2a3a1c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x7fd0('0x84'),'MAX':_0x7fd0('0x55'),'MIN':_0x7fd0('0x56'),'AVG':_0x7fd0('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x7fd0('0x59'),'GROUP_CONCAT DESC':_0x7fd0('0x5a')};var _0x554d4f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x7fd0('0x5b'),'HOUR':_0x7fd0('0x5c'),'ROUND':_0x7fd0('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xfedb3f=function(_0x44c6df){return!_[_0x7fd0('0x5f')]([_0x7fd0('0x60'),_0x7fd0('0x85'),_0x7fd0('0x86'),_0x7fd0('0x61')],_0x44c6df);};var _0x37b274=function(_0x448d40){if(!_0x448d40||!_0x448d40[_0x7fd0('0x62')][_0x7fd0('0x34')]){return'';}for(var _0x29ba5b='(',_0x2e569d=0x0;_0x2e569d<_0x448d40[_0x7fd0('0x62')][_0x7fd0('0x34')];_0x2e569d+=0x1){_0x2e569d>0x0&&(_0x29ba5b+='\x20'+_0x448d40[_0x7fd0('0x63')]+'\x20');_0x29ba5b+=_0x448d40['rules'][_0x2e569d]['group']?_0x37b274(_0x448d40[_0x7fd0('0x62')][_0x2e569d][_0x7fd0('0x64')]):_0x448d40[_0x7fd0('0x62')][_0x2e569d][_0x7fd0('0x3c')]+'\x20'+_0x448d40[_0x7fd0('0x62')][_0x2e569d][_0x7fd0('0x65')]+(_0xfedb3f(_0x448d40['rules'][_0x2e569d]['condition'])?'\x20'+_0x448d40[_0x7fd0('0x62')][_0x2e569d]['value']:'');}return _0x29ba5b+')';};var _0x64c721={'where':{'id':_0x2f44ea[_0x7fd0('0x4e')]['id']}},_0x395254,_0x269cef,_0xdc374d,_0x180e0e,_0x560063;_0x64c721=_['merge']({},_0x64c721,_0x2f44ea[_0x7fd0('0x3e')]);return db['AnalyticCustomReport'][_0x7fd0('0x45')](_0x64c721)['then'](function(_0x39d99f){if(_0x39d99f){_0x395254=_0x39d99f;return _0x39d99f[_0x7fd0('0x67')]();}return null;})['then'](function(_0x2f8fce){if(_0x2f8fce){if(!_0x2f8fce['length']){throw new db['Sequelize']['ValidationErrorItem'](_0x7fd0('0x6a'),0x193);}_0x269cef=_0x2f8fce;return db[_0x7fd0('0x87')][_0x7fd0('0x40')]({'raw':!![]});}return null;})[_0x7fd0('0x23')](function(_0x34bc64){if(_0x34bc64){_0xdc374d=_[_0x7fd0('0x6b')](_0x34bc64,'id');var _0x2f43fd;var _0x23bd7a=squel[_0x7fd0('0x6c')]();_0x23bd7a['from'](_0x395254[_0x7fd0('0x6d')]);for(var _0x5a4a60=0x0;_0x5a4a60<_0x269cef[_0x7fd0('0x34')];_0x5a4a60+=0x1){_0x2f43fd=_0x269cef[_0x5a4a60][_0x7fd0('0x6e')]?_0xdc374d[_0x269cef[_0x5a4a60]['MetricId']][_0x7fd0('0x6f')]:_0x269cef[_0x5a4a60]['field'];_0x2f43fd=_0x269cef[_0x5a4a60][_0x7fd0('0x70')]?_[_0x7fd0('0x71')](_0x2a3a1c[_0x269cef[_0x5a4a60][_0x7fd0('0x70')]],'%s',_0x2f43fd):_0x2f43fd;_0x2f43fd=_0x269cef[_0x5a4a60]['format']?_[_0x7fd0('0x71')](_0x554d4f[_0x269cef[_0x5a4a60]['format']],'%s',_0x2f43fd):_0x2f43fd;if(_0x269cef[_0x5a4a60][_0x7fd0('0x73')]){_0x23bd7a[_0x7fd0('0x64')](_0x2f43fd);}_0x269cef[_0x5a4a60]['orderBy']&&_0x23bd7a['order'](_0x2f43fd,_0x269cef[_0x5a4a60][_0x7fd0('0x74')]==='DESC'?![]:!![]);_0x23bd7a['field'](_0x2f43fd,_0x269cef[_0x5a4a60]['alias']||_0x2f43fd);}if(_0x395254['joins']){_0x395254[_0x7fd0('0x77')]=JSON[_0x7fd0('0x8a')](_0x395254[_0x7fd0('0x77')]);for(var _0x2b513e=0x0;_0x2b513e<_0x395254[_0x7fd0('0x77')][_0x7fd0('0x34')];_0x2b513e+=0x1){if(_0x395254[_0x7fd0('0x77')][_0x2b513e][_0x7fd0('0x78')]&&_[_0x7fd0('0x5f')](_0xfc7552,_0x395254[_0x7fd0('0x77')][_0x2b513e]['type'])&&_0x395254[_0x7fd0('0x77')][_0x2b513e][_0x7fd0('0x79')]&&_0x395254[_0x7fd0('0x77')][_0x2b513e]['foreignTable']&&_0x395254[_0x7fd0('0x77')][_0x2b513e][_0x7fd0('0x7a')]){_0x23bd7a[_0x395254[_0x7fd0('0x77')][_0x2b513e]['type']](_0x395254[_0x7fd0('0x77')][_0x2b513e][_0x7fd0('0x7b')],null,util[_0x7fd0('0x72')](_0x7fd0('0x7c'),_0x395254[_0x7fd0('0x6d')],_0x395254['joins'][_0x2b513e][_0x7fd0('0x79')],_0x395254[_0x7fd0('0x77')][_0x2b513e][_0x7fd0('0x7b')],_0x395254[_0x7fd0('0x77')][_0x2b513e]['foreignKey']));}}}if(_0x395254[_0x7fd0('0x7d')]){_0x395254[_0x7fd0('0x7d')]=JSON[_0x7fd0('0x8a')](_0x395254[_0x7fd0('0x7d')]);_0x23bd7a[_0x7fd0('0x37')](_0x37b274(_0x395254[_0x7fd0('0x7d')][_0x7fd0('0x64')]));}_0x560063=_0x23bd7a[_0x7fd0('0x8b')]();_0x23bd7a['limit'](_0x52b703);_0x23bd7a[_0x7fd0('0x19')](0x0);logger[_0x7fd0('0x7e')](_0x7fd0('0x7f'),_0x23bd7a['toString']());return db[_0x7fd0('0x81')][_0x7fd0('0x2e')](_0x23bd7a[_0x7fd0('0x80')](),{'type':db[_0x7fd0('0x81')][_0x7fd0('0x82')][_0x7fd0('0x83')]});}})[_0x7fd0('0x23')](function(){return{'sql':_0x560063[_0x7fd0('0x80')]()};})[_0x7fd0('0x23')](respondWithResult(_0x568c37,null))[_0x7fd0('0x42')](handleError(_0x568c37,null));}; \ No newline at end of file +var _0xd136=['to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','get','CustomReports','destroy','error','name','index','AnalyticCustomReport','rawAttributes','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','field','options','includeAll','findAll','rows','catch','show','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','Sequelize','ValidationErrorItem','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','getFields','AnalyticMetric','metric','DESC','toString','web','fullPath','%s-%s.%s','randomstring','output','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','IS\x20NOT\x20NULL','Please\x20insert\x20at\x20least\x20one\x20field','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x54c90e,_0x1bd32a){var _0x40a410=function(_0x48da00){while(--_0x48da00){_0x54c90e['push'](_0x54c90e['shift']());}};_0x40a410(++_0x1bd32a);}(_0xd136,0x94));var _0x6d13=function(_0x2acd14,_0x4d5b02){_0x2acd14=_0x2acd14-0x0;var _0x27c170=_0xd136[_0x2acd14];return _0x27c170;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6d13('0x0'));var rimraf=require(_0x6d13('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d13('0x2'));var rp=require(_0x6d13('0x3'));var moment=require(_0x6d13('0x4'));var BPromise=require(_0x6d13('0x5'));var Mustache=require(_0x6d13('0x6'));var util=require(_0x6d13('0x7'));var path=require(_0x6d13('0x8'));var sox=require(_0x6d13('0x9'));var csv=require(_0x6d13('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6d13('0xb'));var squel=require(_0x6d13('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6d13('0xd'));var toCsv=require(_0x6d13('0xa'));var querystring=require(_0x6d13('0xe'));var Papa=require(_0x6d13('0xf'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x6d13('0x10'));var qs=require(_0x6d13('0x11'));var logger=require(_0x6d13('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x6d13('0x13'));var db=require(_0x6d13('0x14'))['db'];function respondWithStatusCode(_0x28fe97,_0x47d637){_0x47d637=_0x47d637||0xcc;return function(_0x1b4cc3){if(_0x1b4cc3){return _0x28fe97[_0x6d13('0x15')](_0x47d637);}return _0x28fe97[_0x6d13('0x16')](_0x47d637)[_0x6d13('0x17')]();};}function respondWithResult(_0x5a07f8,_0x5807ea){_0x5807ea=_0x5807ea||0xc8;return function(_0x4ca95d){if(_0x4ca95d){return _0x5a07f8[_0x6d13('0x16')](_0x5807ea)[_0x6d13('0x18')](_0x4ca95d);}};}function respondWithFilteredResult(_0x3a334f,_0xa5897c){return function(_0x2f4c2b){if(_0x2f4c2b){var _0x4f1bdf=_0x2f4c2b[_0x6d13('0x19')],_0xf27049=_0xa5897c[_0x6d13('0x1a')],_0x405368=_0xa5897c[_0x6d13('0x1a')]+_0xa5897c[_0x6d13('0x1b')],_0x2959a8;if(_0x405368>=_0x4f1bdf){_0x405368=_0x4f1bdf;_0x2959a8=0xc8;}else{_0x2959a8=0xce;}_0x3a334f[_0x6d13('0x16')](_0x2959a8);return _0x3a334f[_0x6d13('0x1c')]('Content-Range',_0xf27049+'-'+_0x405368+'/'+_0x4f1bdf)[_0x6d13('0x18')](_0x2f4c2b);}return null;};}function patchUpdates(_0x269f27){return function(_0x78eef7){try{jsonpatch[_0x6d13('0x1d')](_0x78eef7,_0x269f27,!![]);}catch(_0x1f3603){return BPromise[_0x6d13('0x1e')](_0x1f3603);}return _0x78eef7[_0x6d13('0x1f')]();};}function saveUpdates(_0x9f04de,_0x40ca19){return function(_0x427bb8){if(_0x427bb8){return _0x427bb8[_0x6d13('0x20')](_0x9f04de)[_0x6d13('0x21')](function(_0x18889d){return _0x18889d;});}return null;};}function removeEntity(_0x691833,_0xccc4d1){return function(_0x208876){if(_0x208876){return _0x208876['destroy']()[_0x6d13('0x21')](function(){var _0x4f490b=_0x208876[_0x6d13('0x22')]({'plain':!![]});var _0x204438=_0x6d13('0x23');return db['UserProfileResource'][_0x6d13('0x24')]({'where':{'type':_0x204438,'resourceId':_0x4f490b['id']}})[_0x6d13('0x21')](function(){return _0x208876;});})[_0x6d13('0x21')](function(){_0x691833[_0x6d13('0x16')](0xcc)[_0x6d13('0x17')]();});}};}function handleEntityNotFound(_0x361432,_0x66e464){return function(_0x821eea){if(!_0x821eea){_0x361432['sendStatus'](0x194);}return _0x821eea;};}function handleError(_0xacf472,_0x4f70e2){_0x4f70e2=_0x4f70e2||0x1f4;return function(_0x4c8526){logger[_0x6d13('0x25')](_0x4c8526['stack']);if(_0x4c8526[_0x6d13('0x26')]){delete _0x4c8526[_0x6d13('0x26')];}_0xacf472[_0x6d13('0x16')](_0x4f70e2)['send'](_0x4c8526);};}exports[_0x6d13('0x27')]=function(_0xd469b6,_0x573080){var _0x2fcdfd={},_0x1eda96={},_0xb82395={'count':0x0,'rows':[]};var _0x438e93=db[_0x6d13('0x28')][_0x6d13('0x29')];_0x1eda96[_0x6d13('0x2a')]=_[_0x6d13('0x2b')](_0x438e93);_0x1eda96['query']=_[_0x6d13('0x2b')](_0xd469b6[_0x6d13('0x2c')]);_0x1eda96['filters']=_[_0x6d13('0x2d')](_0x1eda96[_0x6d13('0x2a')],_0x1eda96[_0x6d13('0x2c')]);_0x2fcdfd['attributes']=_[_0x6d13('0x2d')](_0x1eda96[_0x6d13('0x2a')],qs[_0x6d13('0x2e')](_0xd469b6[_0x6d13('0x2c')][_0x6d13('0x2e')]));_0x2fcdfd[_0x6d13('0x2f')]=_0x2fcdfd[_0x6d13('0x2f')]['length']?_0x2fcdfd[_0x6d13('0x2f')]:_0x1eda96['model'];if(!_0xd469b6[_0x6d13('0x2c')][_0x6d13('0x30')](_0x6d13('0x31'))){_0x2fcdfd[_0x6d13('0x1b')]=qs[_0x6d13('0x1b')](_0xd469b6[_0x6d13('0x2c')]['limit']);_0x2fcdfd['offset']=qs[_0x6d13('0x1a')](_0xd469b6[_0x6d13('0x2c')][_0x6d13('0x1a')]);}_0x2fcdfd[_0x6d13('0x32')]=qs[_0x6d13('0x33')](_0xd469b6[_0x6d13('0x2c')]['sort']);_0x2fcdfd[_0x6d13('0x34')]=qs[_0x6d13('0x35')](_[_0x6d13('0x36')](_0xd469b6[_0x6d13('0x2c')],_0x1eda96[_0x6d13('0x35')]));if(_0xd469b6[_0x6d13('0x2c')][_0x6d13('0x37')]){_0x2fcdfd[_0x6d13('0x34')]=_[_0x6d13('0x38')](_0x2fcdfd[_0x6d13('0x34')],{'$or':_['map'](_0x438e93,function(_0x571571){if(_0x571571[_0x6d13('0x39')]['key']!=='VIRTUAL'){var _0x435bd4={};_0x435bd4[_0x571571[_0x6d13('0x3a')]]={'$like':'%'+_0xd469b6[_0x6d13('0x2c')]['filter']+'%'};return _0x435bd4;}})});}_0x2fcdfd=_[_0x6d13('0x38')]({},_0x2fcdfd,_0xd469b6[_0x6d13('0x3b')]);var _0x392519={'where':_0x2fcdfd['where']};return db[_0x6d13('0x28')]['count'](_0x392519)[_0x6d13('0x21')](function(_0x4d2bdd){_0xb82395['count']=_0x4d2bdd;if(_0xd469b6[_0x6d13('0x2c')][_0x6d13('0x3c')]){_0x2fcdfd['include']=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x6d13('0x3d')](_0x2fcdfd);})[_0x6d13('0x21')](function(_0x2a6d57){_0xb82395[_0x6d13('0x3e')]=_0x2a6d57;return _0xb82395;})['then'](respondWithFilteredResult(_0x573080,_0x2fcdfd))[_0x6d13('0x3f')](handleError(_0x573080,null));};exports[_0x6d13('0x40')]=function(_0x4b4cc5,_0x42e8cc){var _0x3bc919={'raw':![],'where':{'id':_0x4b4cc5[_0x6d13('0x41')]['id']}},_0x42a347={};_0x42a347[_0x6d13('0x2a')]=_[_0x6d13('0x2b')](db[_0x6d13('0x28')]['rawAttributes']);_0x42a347[_0x6d13('0x2c')]=_[_0x6d13('0x2b')](_0x4b4cc5[_0x6d13('0x2c')]);_0x42a347[_0x6d13('0x35')]=_[_0x6d13('0x2d')](_0x42a347[_0x6d13('0x2a')],_0x42a347[_0x6d13('0x2c')]);_0x3bc919['attributes']=_[_0x6d13('0x2d')](_0x42a347['model'],qs[_0x6d13('0x2e')](_0x4b4cc5[_0x6d13('0x2c')][_0x6d13('0x2e')]));_0x3bc919[_0x6d13('0x2f')]=_0x3bc919[_0x6d13('0x2f')][_0x6d13('0x42')]?_0x3bc919[_0x6d13('0x2f')]:_0x42a347[_0x6d13('0x2a')];if(_0x4b4cc5['query'][_0x6d13('0x3c')]){_0x3bc919['include']=[{'all':!![]}];}_0x3bc919=_[_0x6d13('0x38')]({},_0x3bc919,_0x4b4cc5[_0x6d13('0x3b')]);return db[_0x6d13('0x28')][_0x6d13('0x43')](_0x3bc919)[_0x6d13('0x21')](handleEntityNotFound(_0x42e8cc,null))[_0x6d13('0x21')](respondWithResult(_0x42e8cc,null))[_0x6d13('0x3f')](handleError(_0x42e8cc,null));};exports[_0x6d13('0x44')]=function(_0x1fa37d,_0x865d9c){return db[_0x6d13('0x28')]['create'](_0x1fa37d[_0x6d13('0x45')],{})[_0x6d13('0x21')](function(_0x3ae25c){var _0x4f21f1=_0x1fa37d['user'][_0x6d13('0x22')]({'plain':!![]});if(!_0x4f21f1)throw new Error(_0x6d13('0x46'));if(_0x4f21f1[_0x6d13('0x47')]==='user'){var _0x3ac978=_0x3ae25c[_0x6d13('0x22')]({'plain':!![]});var _0x33631b='Reports';return db[_0x6d13('0x48')][_0x6d13('0x43')]({'where':{'name':_0x33631b,'userProfileId':_0x4f21f1['userProfileId']},'raw':!![]})['then'](function(_0x171461){if(_0x171461&&_0x171461[_0x6d13('0x49')]===0x0){return db[_0x6d13('0x4a')][_0x6d13('0x44')]({'name':_0x3ac978[_0x6d13('0x26')],'resourceId':_0x3ac978['id'],'type':_0x6d13('0x23'),'sectionId':_0x171461['id']},{})['then'](function(){return _0x3ae25c;});}else{return _0x3ae25c;}})['catch'](function(_0x30c590){logger[_0x6d13('0x25')](_0x6d13('0x4b'),_0x30c590);throw _0x30c590;});}return _0x3ae25c;})[_0x6d13('0x21')](respondWithResult(_0x865d9c,0xc9))[_0x6d13('0x3f')](handleError(_0x865d9c,null));};exports['update']=function(_0x1bb289,_0x48ea56){if(_0x1bb289[_0x6d13('0x45')]['id']){delete _0x1bb289[_0x6d13('0x45')]['id'];}return db[_0x6d13('0x28')]['find']({'where':{'id':_0x1bb289[_0x6d13('0x41')]['id']}})['then'](handleEntityNotFound(_0x48ea56,null))['then'](saveUpdates(_0x1bb289[_0x6d13('0x45')],null))['then'](respondWithResult(_0x48ea56,null))[_0x6d13('0x3f')](handleError(_0x48ea56,null));};exports['destroy']=function(_0x13c342,_0x4962cd){return db[_0x6d13('0x28')][_0x6d13('0x43')]({'where':{'id':_0x13c342['params']['id']}})[_0x6d13('0x21')](handleEntityNotFound(_0x4962cd,null))['then'](removeEntity(_0x4962cd,null))[_0x6d13('0x3f')](handleError(_0x4962cd,null));};exports[_0x6d13('0x4c')]=function(_0x2daf24,_0x2d032f){var _0x48b1f6=0xa;var _0x16e6eb=[_0x6d13('0x4d'),_0x6d13('0x4e'),_0x6d13('0x4f'),_0x6d13('0x50')];var _0x1dbea={'SUM':_0x6d13('0x51'),'COUNT':_0x6d13('0x52'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x6d13('0x53'),'MIN':_0x6d13('0x54'),'AVG':_0x6d13('0x55'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x6d13('0x56'),'GROUP_CONCAT DESC':_0x6d13('0x57')};var _0x3b3a8b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x6d13('0x58'),'HOUR':_0x6d13('0x59'),'ROUND':_0x6d13('0x5a'),'UNIX_TIMESTAMP':_0x6d13('0x5b')};var _0x100e3e=function(_0x3962e7){return!_[_0x6d13('0x5c')]([_0x6d13('0x5d'),'IS\x20NOT\x20NULL',_0x6d13('0x5e'),_0x6d13('0x5f')],_0x3962e7);};var _0x466d14=function(_0xb44c71){if(!_0xb44c71||!_0xb44c71[_0x6d13('0x60')][_0x6d13('0x42')]){return'';}for(var _0x15408d='(',_0x2fc38a=0x0;_0x2fc38a<_0xb44c71[_0x6d13('0x60')][_0x6d13('0x42')];_0x2fc38a+=0x1){_0x2fc38a>0x0&&(_0x15408d+='\x20'+_0xb44c71[_0x6d13('0x61')]+'\x20');_0x15408d+=_0xb44c71[_0x6d13('0x60')][_0x2fc38a]['group']?_0x466d14(_0xb44c71[_0x6d13('0x60')][_0x2fc38a][_0x6d13('0x62')]):_0xb44c71[_0x6d13('0x60')][_0x2fc38a][_0x6d13('0x3a')]+'\x20'+_0xb44c71[_0x6d13('0x60')][_0x2fc38a][_0x6d13('0x63')]+(_0x100e3e(_0xb44c71[_0x6d13('0x60')][_0x2fc38a]['condition'])?'\x20'+_0xb44c71[_0x6d13('0x60')][_0x2fc38a][_0x6d13('0x64')]:'');}return _0x15408d+')';};var _0x538021={'where':{'id':_0x2daf24[_0x6d13('0x41')]['id']}},_0x346760,_0x2ff022,_0xd61683,_0x1a16fd,_0x255e3d;_0x538021=_[_0x6d13('0x38')]({},_0x538021,_0x2daf24[_0x6d13('0x3b')]);return db[_0x6d13('0x28')][_0x6d13('0x43')](_0x538021)[_0x6d13('0x21')](function(_0x2e1fd0){if(_0x2e1fd0){_0x346760=_0x2e1fd0;return _0x2e1fd0['getFields']();}return null;})[_0x6d13('0x21')](function(_0x476439){if(_0x476439){if(!_0x476439['length']){throw new db[(_0x6d13('0x65'))][(_0x6d13('0x66'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2ff022=_0x476439;return db['AnalyticMetric'][_0x6d13('0x3d')]({'raw':!![]});}return null;})[_0x6d13('0x21')](function(_0x4f4180){if(_0x4f4180){_0xd61683=_[_0x6d13('0x67')](_0x4f4180,'id');var _0x44f035;var _0x166c46=squel[_0x6d13('0x68')]();_0x166c46[_0x6d13('0x69')](_0x346760[_0x6d13('0x6a')]);for(var _0x13b540=0x0;_0x13b540<_0x2ff022[_0x6d13('0x42')];_0x13b540+=0x1){_0x44f035=_0x2ff022[_0x13b540][_0x6d13('0x6b')]?_0xd61683[_0x2ff022[_0x13b540]['MetricId']]['metric']:_0x2ff022[_0x13b540][_0x6d13('0x3a')];_0x44f035=_0x2ff022[_0x13b540][_0x6d13('0x6c')]?_[_0x6d13('0x6d')](_0x1dbea[_0x2ff022[_0x13b540]['function']],'%s',_0x44f035):_0x44f035;_0x44f035=_0x2ff022[_0x13b540][_0x6d13('0x6e')]?_[_0x6d13('0x6d')](_0x3b3a8b[_0x2ff022[_0x13b540]['format']],'%s',_0x44f035):_0x44f035;if(_0x2ff022[_0x13b540][_0x6d13('0x6f')]){_0x166c46['group'](_0x44f035);}_0x2ff022[_0x13b540][_0x6d13('0x70')]&&_0x166c46[_0x6d13('0x32')](_0x44f035,_0x2ff022[_0x13b540][_0x6d13('0x70')]==='DESC'?![]:!![]);_0x166c46['field'](_0x44f035,_0x2ff022[_0x13b540][_0x6d13('0x71')]||_0x44f035);}if(_0x346760['joins']){_0x346760[_0x6d13('0x72')]=JSON['parse'](_0x346760[_0x6d13('0x72')]);for(var _0x38b1d4=0x0;_0x38b1d4<_0x346760[_0x6d13('0x72')]['length'];_0x38b1d4+=0x1){if(_0x346760[_0x6d13('0x72')][_0x38b1d4]['type']&&_[_0x6d13('0x5c')](_0x16e6eb,_0x346760[_0x6d13('0x72')][_0x38b1d4]['type'])&&_0x346760[_0x6d13('0x72')][_0x38b1d4][_0x6d13('0x73')]&&_0x346760[_0x6d13('0x72')][_0x38b1d4][_0x6d13('0x74')]&&_0x346760['joins'][_0x38b1d4][_0x6d13('0x75')]){_0x166c46[_0x346760[_0x6d13('0x72')][_0x38b1d4][_0x6d13('0x39')]](_0x346760[_0x6d13('0x72')][_0x38b1d4]['foreignTable'],null,util[_0x6d13('0x6e')](_0x6d13('0x76'),_0x346760['table'],_0x346760[_0x6d13('0x72')][_0x38b1d4]['parentKey'],_0x346760[_0x6d13('0x72')][_0x38b1d4][_0x6d13('0x74')],_0x346760[_0x6d13('0x72')][_0x38b1d4][_0x6d13('0x75')]));}}}if(_0x346760[_0x6d13('0x77')]){_0x346760['conditions']=JSON[_0x6d13('0x78')](_0x346760['conditions']);_0x166c46['where'](_0x466d14(_0x346760[_0x6d13('0x77')][_0x6d13('0x62')]));}_0x255e3d=_0x166c46[_0x6d13('0x79')]();_0x166c46[_0x6d13('0x1b')](_0x48b1f6);_0x166c46[_0x6d13('0x1a')](0x0);logger[_0x6d13('0x7a')](_0x6d13('0x7b'),_0x166c46['toString']());return db[_0x6d13('0x7c')][_0x6d13('0x2c')](_0x166c46['toString'](),{'type':db[_0x6d13('0x7c')][_0x6d13('0x7d')][_0x6d13('0x7e')]});}})[_0x6d13('0x21')](respondWithResult(_0x2d032f,null))[_0x6d13('0x3f')](handleError(_0x2d032f,null));};function runReport(_0x4c8698,_0x37507a,_0x43ea59){var _0x251fff=_0x37507a[_0x6d13('0x26')];var _0x313d14=0xa;var _0x4e422d=[_0x6d13('0x4d'),'left_join','right_join',_0x6d13('0x50')];var _0x164e8d={'SUM':_0x6d13('0x51'),'COUNT':_0x6d13('0x52'),'COUNT DISTINCT':_0x6d13('0x7f'),'MAX':_0x6d13('0x53'),'MIN':'MIN(%s)','AVG':_0x6d13('0x55'),'GROUP_CONCAT':_0x6d13('0x80'),'GROUP_CONCAT ASC':_0x6d13('0x56'),'GROUP_CONCAT DESC':_0x6d13('0x57')};var _0x1e8779={'SEC_TO_TIME':_0x6d13('0x81'),'DATE':_0x6d13('0x58'),'HOUR':_0x6d13('0x59'),'ROUND':_0x6d13('0x5a'),'UNIX_TIMESTAMP':_0x6d13('0x5b')};var _0x41edc9=function(_0x5e62bc){return!_[_0x6d13('0x5c')]([_0x6d13('0x5d'),'IS\x20NOT\x20NULL',_0x6d13('0x5e'),_0x6d13('0x5f')],_0x5e62bc);};var _0x56c974=function(_0x1d34e7){if(!_0x1d34e7||!_0x1d34e7['rules'][_0x6d13('0x42')]){return'';}for(var _0x4f12d4='(',_0x49c0a9=0x0;_0x49c0a9<_0x1d34e7[_0x6d13('0x60')][_0x6d13('0x42')];_0x49c0a9+=0x1){_0x49c0a9>0x0&&(_0x4f12d4+='\x20'+_0x1d34e7[_0x6d13('0x61')]+'\x20');_0x4f12d4+=_0x1d34e7['rules'][_0x49c0a9][_0x6d13('0x62')]?_0x56c974(_0x1d34e7['rules'][_0x49c0a9][_0x6d13('0x62')]):_0x1d34e7['rules'][_0x49c0a9][_0x6d13('0x3a')]+'\x20'+_0x1d34e7[_0x6d13('0x60')][_0x49c0a9]['condition']+(_0x41edc9(_0x1d34e7[_0x6d13('0x60')][_0x49c0a9][_0x6d13('0x63')])?'\x20'+_0x1d34e7[_0x6d13('0x60')][_0x49c0a9]['value']:'');}return _0x4f12d4+')';};var _0x2b6791={'where':{'id':_0x4c8698['id']}},_0x2d4653,_0x45d7f1,_0x485ad8,_0x356366,_0x344e15;_0x2b6791=_[_0x6d13('0x38')]({},_0x2b6791,_0x43ea59);return db['AnalyticCustomReport'][_0x6d13('0x43')](_0x2b6791)['then'](function(_0x108372){if(_0x108372){_0x2d4653=_0x108372;return _0x108372[_0x6d13('0x82')]();}return null;})[_0x6d13('0x21')](function(_0x3350e1){if(_0x3350e1){if(!_0x3350e1['length']){throw new db[(_0x6d13('0x65'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x45d7f1=_0x3350e1;return db[_0x6d13('0x83')][_0x6d13('0x3d')]({'raw':!![]});}return null;})[_0x6d13('0x21')](function(_0x163f00){if(_0x163f00){_0x485ad8=_['keyBy'](_0x163f00,'id');var _0x1c1154;var _0x499652=squel[_0x6d13('0x68')]();_0x499652[_0x6d13('0x69')](_0x2d4653[_0x6d13('0x6a')]);for(var _0x3cf31a=0x0;_0x3cf31a<_0x45d7f1[_0x6d13('0x42')];_0x3cf31a+=0x1){_0x1c1154=_0x45d7f1[_0x3cf31a][_0x6d13('0x6b')]?_0x485ad8[_0x45d7f1[_0x3cf31a][_0x6d13('0x6b')]][_0x6d13('0x84')]:_0x45d7f1[_0x3cf31a][_0x6d13('0x3a')];_0x1c1154=_0x45d7f1[_0x3cf31a]['function']?_[_0x6d13('0x6d')](_0x164e8d[_0x45d7f1[_0x3cf31a][_0x6d13('0x6c')]],'%s',_0x1c1154):_0x1c1154;_0x1c1154=_0x45d7f1[_0x3cf31a][_0x6d13('0x6e')]?_['replace'](_0x1e8779[_0x45d7f1[_0x3cf31a]['format']],'%s',_0x1c1154):_0x1c1154;if(_0x45d7f1[_0x3cf31a][_0x6d13('0x6f')]){_0x499652[_0x6d13('0x62')](_0x1c1154);}_0x45d7f1[_0x3cf31a][_0x6d13('0x70')]&&_0x499652[_0x6d13('0x32')](_0x1c1154,_0x45d7f1[_0x3cf31a][_0x6d13('0x70')]===_0x6d13('0x85')?![]:!![]);_0x499652[_0x6d13('0x3a')](_0x1c1154,_0x45d7f1[_0x3cf31a]['alias']||_0x1c1154);}if(_0x2d4653[_0x6d13('0x72')]){_0x2d4653[_0x6d13('0x72')]=JSON[_0x6d13('0x78')](_0x2d4653[_0x6d13('0x72')]);for(var _0x4e45e5=0x0;_0x4e45e5<_0x2d4653[_0x6d13('0x72')][_0x6d13('0x42')];_0x4e45e5+=0x1){if(_0x2d4653[_0x6d13('0x72')][_0x4e45e5][_0x6d13('0x39')]&&_[_0x6d13('0x5c')](_0x4e422d,_0x2d4653[_0x6d13('0x72')][_0x4e45e5]['type'])&&_0x2d4653[_0x6d13('0x72')][_0x4e45e5][_0x6d13('0x73')]&&_0x2d4653[_0x6d13('0x72')][_0x4e45e5][_0x6d13('0x74')]&&_0x2d4653[_0x6d13('0x72')][_0x4e45e5][_0x6d13('0x75')]){_0x499652[_0x2d4653['joins'][_0x4e45e5][_0x6d13('0x39')]](_0x2d4653[_0x6d13('0x72')][_0x4e45e5]['foreignTable'],null,util[_0x6d13('0x6e')](_0x6d13('0x76'),_0x2d4653[_0x6d13('0x6a')],_0x2d4653['joins'][_0x4e45e5][_0x6d13('0x73')],_0x2d4653[_0x6d13('0x72')][_0x4e45e5][_0x6d13('0x74')],_0x2d4653[_0x6d13('0x72')][_0x4e45e5][_0x6d13('0x75')]));}}}if(_0x2d4653[_0x6d13('0x77')]){_0x2d4653[_0x6d13('0x77')]=JSON['parse'](_0x2d4653[_0x6d13('0x77')]);_0x499652['where'](_0x56c974(_0x2d4653[_0x6d13('0x77')][_0x6d13('0x62')]));}_0x344e15=_0x499652['clone']();_0x499652['limit'](_0x313d14);_0x499652['offset'](0x0);logger[_0x6d13('0x7a')](_0x6d13('0x7b'),_0x499652[_0x6d13('0x86')]());return db[_0x6d13('0x7c')][_0x6d13('0x2c')](_0x499652[_0x6d13('0x86')](),{'type':db[_0x6d13('0x7c')]['QueryTypes']['SELECT']});}})[_0x6d13('0x21')](function(_0x3f2944){if(!_0x3f2944[_0x6d13('0x42')]){throw new db[(_0x6d13('0x65'))]['ValidationErrorItem']('No\x20available\x20data',0xcc);}if(_0x37507a['output']===_0x6d13('0x87')){return null;}var _0x1c0793=_[_0x6d13('0x38')](_0x37507a,{'name':_0x37507a[_0x6d13('0x88')]||_0x37507a[_0x6d13('0x26')]||_0x2d4653[_0x6d13('0x26')],'basename':_0x251fff,'savename':util[_0x6d13('0x6e')](_0x6d13('0x89'),_0x37507a[_0x6d13('0x26')]||_0x2d4653[_0x6d13('0x26')],require(_0x6d13('0x8a'))['generate'](0x4),_0x37507a[_0x6d13('0x8b')]||_0x6d13('0x8c')),'reportId':_0x2d4653['id'],'reportType':_0x6d13('0x8d')});return db[_0x6d13('0x8e')][_0x6d13('0x44')](_0x1c0793,{'raw':!![]});})[_0x6d13('0x21')](function(_0x32275f){if(_0x2d4653[_0x6d13('0x6a')]===_0x6d13('0x8f')){_0x344e15[_0x6d13('0x34')](_0x2d4653[_0x6d13('0x6a')]+_0x6d13('0x90'),_0x37507a[_0x6d13('0x91')],_0x37507a[_0x6d13('0x92')]);}else{_0x344e15[_0x6d13('0x34')](_0x2d4653['table']+_0x6d13('0x93'),_0x37507a[_0x6d13('0x91')],_0x37507a[_0x6d13('0x92')]);}if(_0x32275f){logger['info'](_0x6d13('0x94'),_0x344e15[_0x6d13('0x86')]());require(_0x6d13('0x95'))['fork'](path[_0x6d13('0x4d')](__dirname,_0x6d13('0x96'),_0x32275f['output']),[_0x32275f['id'],_0x344e15[_0x6d13('0x86')](),path[_0x6d13('0x4d')](__dirname,_0x6d13('0x97'),_0x32275f[_0x6d13('0x98')]),_0x251fff]);return _0x32275f;}else{var _0xa16b81=squel[_0x6d13('0x68')]();_0xa16b81['from']('('+_0x344e15[_0x6d13('0x86')]()+')',_0x6d13('0x99'));_0xa16b81['field'](_0x6d13('0x9a'),'count');_0x344e15[_0x6d13('0x1b')](_0x37507a[_0x6d13('0x1b')]||_0x313d14);_0x344e15['offset'](_0x37507a[_0x6d13('0x1a')]||0x0);return db[_0x6d13('0x7c')][_0x6d13('0x2c')](_0xa16b81[_0x6d13('0x86')](),{'type':db[_0x6d13('0x7c')][_0x6d13('0x7d')][_0x6d13('0x7e')]})[_0x6d13('0x21')](function(_0x58e370){if(!_0x58e370[_0x6d13('0x42')]){_0x356366=0x0;}else{_0x356366=_0x58e370[0x0][_0x6d13('0x19')]||0x0;}return db[_0x6d13('0x7c')][_0x6d13('0x2c')](_0x344e15[_0x6d13('0x86')](),{'type':db['sequelize'][_0x6d13('0x7d')][_0x6d13('0x7e')]});})[_0x6d13('0x21')](function(_0x5f12b6){return{'rows':_0x5f12b6||[],'count':_0x356366};});}});}exports['run']=function(_0x435803,_0x28247c){return runReport(_0x435803['params'],_0x435803[_0x6d13('0x2c')],_0x435803[_0x6d13('0x3b')])['then'](respondWithResult(_0x28247c,null))['catch'](handleError(_0x28247c,null));};exports[_0x6d13('0x9b')]=runReport;exports[_0x6d13('0x2c')]=function(_0x520968,_0x55d903){var _0x1a81fa=0xa;var _0x25b6af=['join','left_join',_0x6d13('0x4f'),_0x6d13('0x50')];var _0x5bce4e={'SUM':_0x6d13('0x51'),'COUNT':_0x6d13('0x52'),'COUNT DISTINCT':_0x6d13('0x7f'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x6d13('0x55'),'GROUP_CONCAT':_0x6d13('0x80'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x6d13('0x57')};var _0xc74338={'SEC_TO_TIME':_0x6d13('0x81'),'DATE':_0x6d13('0x58'),'HOUR':_0x6d13('0x59'),'ROUND':_0x6d13('0x5a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x19ea28=function(_0x43abb6){return!_[_0x6d13('0x5c')]([_0x6d13('0x5d'),_0x6d13('0x9c'),_0x6d13('0x5e'),_0x6d13('0x5f')],_0x43abb6);};var _0x5ba252=function(_0x1d745f){if(!_0x1d745f||!_0x1d745f['rules'][_0x6d13('0x42')]){return'';}for(var _0x1940b2='(',_0x12a033=0x0;_0x12a033<_0x1d745f[_0x6d13('0x60')][_0x6d13('0x42')];_0x12a033+=0x1){_0x12a033>0x0&&(_0x1940b2+='\x20'+_0x1d745f['operator']+'\x20');_0x1940b2+=_0x1d745f[_0x6d13('0x60')][_0x12a033][_0x6d13('0x62')]?_0x5ba252(_0x1d745f['rules'][_0x12a033][_0x6d13('0x62')]):_0x1d745f[_0x6d13('0x60')][_0x12a033][_0x6d13('0x3a')]+'\x20'+_0x1d745f[_0x6d13('0x60')][_0x12a033][_0x6d13('0x63')]+(_0x19ea28(_0x1d745f[_0x6d13('0x60')][_0x12a033][_0x6d13('0x63')])?'\x20'+_0x1d745f[_0x6d13('0x60')][_0x12a033][_0x6d13('0x64')]:'');}return _0x1940b2+')';};var _0x3fa89d={'where':{'id':_0x520968[_0x6d13('0x41')]['id']}},_0x5c7040,_0x504d97,_0xe11ddf,_0x5d9259,_0x48781c;_0x3fa89d=_[_0x6d13('0x38')]({},_0x3fa89d,_0x520968[_0x6d13('0x3b')]);return db[_0x6d13('0x28')][_0x6d13('0x43')](_0x3fa89d)[_0x6d13('0x21')](function(_0x215b33){if(_0x215b33){_0x5c7040=_0x215b33;return _0x215b33[_0x6d13('0x82')]();}return null;})[_0x6d13('0x21')](function(_0x217408){if(_0x217408){if(!_0x217408[_0x6d13('0x42')]){throw new db[(_0x6d13('0x65'))][(_0x6d13('0x66'))](_0x6d13('0x9d'),0x193);}_0x504d97=_0x217408;return db[_0x6d13('0x83')][_0x6d13('0x3d')]({'raw':!![]});}return null;})[_0x6d13('0x21')](function(_0x31f05c){if(_0x31f05c){_0xe11ddf=_[_0x6d13('0x67')](_0x31f05c,'id');var _0x39bc78;var _0x36d2cf=squel[_0x6d13('0x68')]();_0x36d2cf[_0x6d13('0x69')](_0x5c7040['table']);for(var _0x3ecbb6=0x0;_0x3ecbb6<_0x504d97[_0x6d13('0x42')];_0x3ecbb6+=0x1){_0x39bc78=_0x504d97[_0x3ecbb6][_0x6d13('0x6b')]?_0xe11ddf[_0x504d97[_0x3ecbb6][_0x6d13('0x6b')]][_0x6d13('0x84')]:_0x504d97[_0x3ecbb6][_0x6d13('0x3a')];_0x39bc78=_0x504d97[_0x3ecbb6][_0x6d13('0x6c')]?_['replace'](_0x5bce4e[_0x504d97[_0x3ecbb6][_0x6d13('0x6c')]],'%s',_0x39bc78):_0x39bc78;_0x39bc78=_0x504d97[_0x3ecbb6][_0x6d13('0x6e')]?_[_0x6d13('0x6d')](_0xc74338[_0x504d97[_0x3ecbb6][_0x6d13('0x6e')]],'%s',_0x39bc78):_0x39bc78;if(_0x504d97[_0x3ecbb6][_0x6d13('0x6f')]){_0x36d2cf[_0x6d13('0x62')](_0x39bc78);}_0x504d97[_0x3ecbb6][_0x6d13('0x70')]&&_0x36d2cf[_0x6d13('0x32')](_0x39bc78,_0x504d97[_0x3ecbb6][_0x6d13('0x70')]==='DESC'?![]:!![]);_0x36d2cf[_0x6d13('0x3a')](_0x39bc78,_0x504d97[_0x3ecbb6][_0x6d13('0x71')]||_0x39bc78);}if(_0x5c7040[_0x6d13('0x72')]){_0x5c7040['joins']=JSON['parse'](_0x5c7040['joins']);for(var _0x654062=0x0;_0x654062<_0x5c7040['joins'][_0x6d13('0x42')];_0x654062+=0x1){if(_0x5c7040[_0x6d13('0x72')][_0x654062][_0x6d13('0x39')]&&_[_0x6d13('0x5c')](_0x25b6af,_0x5c7040[_0x6d13('0x72')][_0x654062]['type'])&&_0x5c7040['joins'][_0x654062][_0x6d13('0x73')]&&_0x5c7040[_0x6d13('0x72')][_0x654062][_0x6d13('0x74')]&&_0x5c7040[_0x6d13('0x72')][_0x654062][_0x6d13('0x75')]){_0x36d2cf[_0x5c7040['joins'][_0x654062][_0x6d13('0x39')]](_0x5c7040['joins'][_0x654062][_0x6d13('0x74')],null,util[_0x6d13('0x6e')](_0x6d13('0x76'),_0x5c7040[_0x6d13('0x6a')],_0x5c7040['joins'][_0x654062]['parentKey'],_0x5c7040['joins'][_0x654062][_0x6d13('0x74')],_0x5c7040[_0x6d13('0x72')][_0x654062]['foreignKey']));}}}if(_0x5c7040['conditions']){_0x5c7040['conditions']=JSON[_0x6d13('0x78')](_0x5c7040['conditions']);_0x36d2cf[_0x6d13('0x34')](_0x5ba252(_0x5c7040[_0x6d13('0x77')][_0x6d13('0x62')]));}_0x48781c=_0x36d2cf[_0x6d13('0x79')]();_0x36d2cf['limit'](_0x1a81fa);_0x36d2cf[_0x6d13('0x1a')](0x0);logger[_0x6d13('0x7a')]('Limited\x20Query:',_0x36d2cf[_0x6d13('0x86')]());return db[_0x6d13('0x7c')][_0x6d13('0x2c')](_0x36d2cf[_0x6d13('0x86')](),{'type':db[_0x6d13('0x7c')]['QueryTypes'][_0x6d13('0x7e')]});}})['then'](function(){return{'sql':_0x48781c[_0x6d13('0x86')]()};})[_0x6d13('0x21')](respondWithResult(_0x55d903,null))[_0x6d13('0x3f')](handleError(_0x55d903,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 2c02f71..19640cd 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 _0xf882=['lodash','util','../../config/logger','api','moment','define'];(function(_0x5d0609,_0x127562){var _0xaa3fd1=function(_0x47f457){while(--_0x47f457){_0x5d0609['push'](_0x5d0609['shift']());}};_0xaa3fd1(++_0x127562);}(_0xf882,0x114));var _0x2f88=function(_0x1ddd09,_0x406881){_0x1ddd09=_0x1ddd09-0x0;var _0x5d3f99=_0xf882[_0x1ddd09];return _0x5d3f99;};'use strict';var _=require(_0x2f88('0x0'));var util=require(_0x2f88('0x1'));var logger=require(_0x2f88('0x2'))(_0x2f88('0x3'));var moment=require(_0x2f88('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./analyticCustomReport.attributes');module['exports']=function(_0x1f0f03,_0x23dbed){return _0x1f0f03[_0x2f88('0x5')]('AnalyticCustomReport',attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26c9=['./analyticCustomReport.attributes','exports','AnalyticCustomReport','analytics_custom_reports','../../config/logger','api','moment','request-promise'];(function(_0x47cb4f,_0x49ef45){var _0x458d98=function(_0x13a858){while(--_0x13a858){_0x47cb4f['push'](_0x47cb4f['shift']());}};_0x458d98(++_0x49ef45);}(_0x26c9,0x11c));var _0x926c=function(_0x4e1f20,_0x144d8d){_0x4e1f20=_0x4e1f20-0x0;var _0x45b9ec=_0x26c9[_0x4e1f20];return _0x45b9ec;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x926c('0x0'))(_0x926c('0x1'));var moment=require(_0x926c('0x2'));var BPromise=require('bluebird');var rp=require(_0x926c('0x3'));var attributes=require(_0x926c('0x4'));module[_0x926c('0x5')]=function(_0x36c750,_0x522c5d){return _0x36c750['define'](_0x926c('0x6'),attributes,{'tableName':_0x926c('0x7'),'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 c6193bc..e4dff8d 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x4b1bb0,_0x7dc32b){var _0x549407=function(_0xa08deb){while(--_0xa08deb){_0x4b1bb0['push'](_0x4b1bb0['shift']());}};_0x549407(++_0x7dc32b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x111777,_0x43e893){var _0x18b652=function(_0x24a8fa){while(--_0x24a8fa){_0x111777['push'](_0x111777['shift']());}};_0x18b652(++_0x43e893);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index c3e74c2..1c320ea 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 _0x7916=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','preview','run','query','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout','Router'];(function(_0x40bdbc,_0x3fabcd){var _0xc603a8=function(_0x17c0e6){while(--_0x17c0e6){_0x40bdbc['push'](_0x40bdbc['shift']());}};_0xc603a8(++_0x3fabcd);}(_0x7916,0x128));var _0x6791=function(_0xc22bec,_0x177297){_0xc22bec=_0xc22bec-0x0;var _0x17b2d2=_0x7916[_0xc22bec];return _0x17b2d2;};'use strict';var multer=require(_0x6791('0x0'));var util=require('util');var path=require(_0x6791('0x1'));var timeout=require(_0x6791('0x2'));var express=require('express');var router=express[_0x6791('0x3')]();var auth=require(_0x6791('0x4'));var interaction=require(_0x6791('0x5'));var config=require(_0x6791('0x6'));var controller=require('./analyticCustomReport.controller');router[_0x6791('0x7')]('/',auth['isAuthenticated'](),controller[_0x6791('0x8')]);router[_0x6791('0x7')]('/:id',auth[_0x6791('0x9')](),controller['show']);router[_0x6791('0x7')]('/:id/preview',auth['isAuthenticated'](),controller[_0x6791('0xa')]);router[_0x6791('0x7')]('/:id/run',auth[_0x6791('0x9')](),controller[_0x6791('0xb')]);router[_0x6791('0x7')]('/:id/query',auth[_0x6791('0x9')](),controller[_0x6791('0xc')]);router[_0x6791('0xd')]('/',auth[_0x6791('0x9')](),controller[_0x6791('0xe')]);router[_0x6791('0xf')](_0x6791('0x10'),auth[_0x6791('0x9')](),controller[_0x6791('0x11')]);router[_0x6791('0x12')](_0x6791('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x6791('0x13')]=router; \ No newline at end of file +var _0x3de3=['multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','preview','run','/:id/query','query','post','create','put','/:id','update','delete','destroy','exports'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x3de3,0x1ce));var _0x33de=function(_0xb8938d,_0x28f730){_0xb8938d=_0xb8938d-0x0;var _0x44a651=_0x3de3[_0xb8938d];return _0x44a651;};'use strict';var multer=require(_0x33de('0x0'));var util=require('util');var path=require(_0x33de('0x1'));var timeout=require(_0x33de('0x2'));var express=require('express');var router=express[_0x33de('0x3')]();var auth=require(_0x33de('0x4'));var interaction=require(_0x33de('0x5'));var config=require(_0x33de('0x6'));var controller=require('./analyticCustomReport.controller');router[_0x33de('0x7')]('/',auth[_0x33de('0x8')](),controller['index']);router[_0x33de('0x7')]('/:id',auth[_0x33de('0x8')](),controller[_0x33de('0x9')]);router[_0x33de('0x7')]('/:id/preview',auth[_0x33de('0x8')](),controller[_0x33de('0xa')]);router[_0x33de('0x7')]('/:id/run',auth[_0x33de('0x8')](),controller[_0x33de('0xb')]);router[_0x33de('0x7')](_0x33de('0xc'),auth[_0x33de('0x8')](),controller[_0x33de('0xd')]);router[_0x33de('0xe')]('/',auth[_0x33de('0x8')](),controller[_0x33de('0xf')]);router[_0x33de('0x10')](_0x33de('0x11'),auth['isAuthenticated'](),controller[_0x33de('0x12')]);router[_0x33de('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x33de('0x14')]);module[_0x33de('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 d873301..e51ddc4 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 _0xe59d=['TEXT','exports','STRING'];(function(_0x47f44a,_0x357462){var _0x25f7b3=function(_0x59b1f4){while(--_0x59b1f4){_0x47f44a['push'](_0x47f44a['shift']());}};_0x25f7b3(++_0x357462);}(_0xe59d,0xf1));var _0xde59=function(_0x24a7c9,_0x157c78){_0x24a7c9=_0x24a7c9-0x0;var _0x451a81=_0xe59d[_0x24a7c9];return _0x451a81;};'use strict';var Sequelize=require('sequelize');module[_0xde59('0x0')]={'name':{'type':Sequelize[_0xde59('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xde59('0x1')]},'parent':{'type':Sequelize[_0xde59('0x1')]},'table':{'type':Sequelize[_0xde59('0x1')]},'conditions':{'type':Sequelize[_0xde59('0x2')]},'joins':{'type':Sequelize[_0xde59('0x2')]}}; \ No newline at end of file +var _0x464d=['exports','STRING','TEXT','sequelize'];(function(_0x31b300,_0x5d2ea8){var _0x64e7b4=function(_0x133c71){while(--_0x133c71){_0x31b300['push'](_0x31b300['shift']());}};_0x64e7b4(++_0x5d2ea8);}(_0x464d,0x17b));var _0xd464=function(_0x515a4d,_0x537654){_0x515a4d=_0x515a4d-0x0;var _0x32f090=_0x464d[_0x515a4d];return _0x32f090;};'use strict';var Sequelize=require(_0xd464('0x0'));module[_0xd464('0x1')]={'name':{'type':Sequelize[_0xd464('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xd464('0x2')]},'table':{'type':Sequelize[_0xd464('0x2')]},'conditions':{'type':Sequelize[_0xd464('0x3')]},'joins':{'type':Sequelize[_0xd464('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index a04f306..567827e 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 _0x969f=['csv','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','left_join','SUM(%s)','MAX(%s)','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/environment','../../mysqldb','status','end','json','offset','set','Content-Range','apply','reject','update','then','get','DefaultReports','destroy','sendStatus','error','name','AnalyticDefaultReport','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','map','key','field','merge','options','count','includeAll','rows','catch','show','params','rawAttributes','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','userProfileId','autoAssociation','UserProfileResource','create','preview','join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%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','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','findAll','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','type','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','parentKey','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x969f,0x15b));var _0xf969=function(_0x560589,_0x3889f0){_0x560589=_0x560589-0x0;var _0x386054=_0x969f[_0x560589];return _0x386054;};'use strict';var pdf=require(_0xf969('0x0'));var emlformat=require(_0xf969('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf969('0x2'));var jsonpatch=require(_0xf969('0x3'));var rp=require('request-promise');var moment=require(_0xf969('0x4'));var BPromise=require(_0xf969('0x5'));var Mustache=require('mustache');var util=require(_0xf969('0x6'));var path=require(_0xf969('0x7'));var sox=require(_0xf969('0x8'));var csv=require(_0xf969('0x9'));var ejs=require(_0xf969('0xa'));var fs=require('fs');var _=require(_0xf969('0xb'));var squel=require(_0xf969('0xc'));var crypto=require(_0xf969('0xd'));var jsforce=require(_0xf969('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf969('0x9'));var querystring=require(_0xf969('0xf'));var Papa=require(_0xf969('0x10'));var authService=require(_0xf969('0x11'));var hardwareService=require(_0xf969('0x12'));var Redis=require(_0xf969('0x13'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xf969('0x14'));var utils=require('../../config/utils');var config=require(_0xf969('0x15'));var db=require(_0xf969('0x16'))['db'];function respondWithStatusCode(_0x4fdc45,_0x1dee84){_0x1dee84=_0x1dee84||0xcc;return function(_0x32bc3c){if(_0x32bc3c){return _0x4fdc45['sendStatus'](_0x1dee84);}return _0x4fdc45[_0xf969('0x17')](_0x1dee84)[_0xf969('0x18')]();};}function respondWithResult(_0x335389,_0x45bbba){_0x45bbba=_0x45bbba||0xc8;return function(_0x51d344){if(_0x51d344){return _0x335389[_0xf969('0x17')](_0x45bbba)[_0xf969('0x19')](_0x51d344);}};}function respondWithFilteredResult(_0x4da5f2,_0x752e6){return function(_0x2239da){if(_0x2239da){var _0x584fae=_0x2239da['count'],_0xcd1680=_0x752e6[_0xf969('0x1a')],_0xa14401=_0x752e6[_0xf969('0x1a')]+_0x752e6['limit'],_0x52c089;if(_0xa14401>=_0x584fae){_0xa14401=_0x584fae;_0x52c089=0xc8;}else{_0x52c089=0xce;}_0x4da5f2[_0xf969('0x17')](_0x52c089);return _0x4da5f2[_0xf969('0x1b')](_0xf969('0x1c'),_0xcd1680+'-'+_0xa14401+'/'+_0x584fae)[_0xf969('0x19')](_0x2239da);}return null;};}function patchUpdates(_0x421b65){return function(_0x2695f0){try{jsonpatch[_0xf969('0x1d')](_0x2695f0,_0x421b65,!![]);}catch(_0x219e16){return BPromise[_0xf969('0x1e')](_0x219e16);}return _0x2695f0['save']();};}function saveUpdates(_0x2c4a46,_0x218236){return function(_0x3dbc0e){if(_0x3dbc0e){return _0x3dbc0e[_0xf969('0x1f')](_0x2c4a46)[_0xf969('0x20')](function(_0x3ac470){return _0x3ac470;});}return null;};}function removeEntity(_0x3f434f,_0x12bfb4){return function(_0x332d8b){if(_0x332d8b){return _0x332d8b['destroy']()['then'](function(){var _0x48efb4=_0x332d8b[_0xf969('0x21')]({'plain':!![]});var _0x22e657=_0xf969('0x22');return db['UserProfileResource'][_0xf969('0x23')]({'where':{'type':_0x22e657,'resourceId':_0x48efb4['id']}})['then'](function(){return _0x332d8b;});})[_0xf969('0x20')](function(){_0x3f434f['status'](0xcc)[_0xf969('0x18')]();});}};}function handleEntityNotFound(_0x1419c7,_0x156cf7){return function(_0x1a7464){if(!_0x1a7464){_0x1419c7[_0xf969('0x24')](0x194);}return _0x1a7464;};}function handleError(_0xb807c1,_0x362196){_0x362196=_0x362196||0x1f4;return function(_0x8dc4c6){logger[_0xf969('0x25')](_0x8dc4c6['stack']);if(_0x8dc4c6[_0xf969('0x26')]){delete _0x8dc4c6[_0xf969('0x26')];}_0xb807c1['status'](_0x362196)['send'](_0x8dc4c6);};}exports['index']=function(_0x61ee31,_0x3ce494){var _0x2c4e91={},_0x3a0dad={},_0x4e6a0b={'count':0x0,'rows':[]};var _0x2d35bd=db[_0xf969('0x27')]['rawAttributes'];_0x3a0dad[_0xf969('0x28')]=_[_0xf969('0x29')](_0x2d35bd);_0x3a0dad[_0xf969('0x2a')]=_[_0xf969('0x29')](_0x61ee31[_0xf969('0x2a')]);_0x3a0dad[_0xf969('0x2b')]=_['intersection'](_0x3a0dad[_0xf969('0x28')],_0x3a0dad[_0xf969('0x2a')]);_0x2c4e91[_0xf969('0x2c')]=_[_0xf969('0x2d')](_0x3a0dad['model'],qs[_0xf969('0x2e')](_0x61ee31['query'][_0xf969('0x2e')]));_0x2c4e91[_0xf969('0x2c')]=_0x2c4e91[_0xf969('0x2c')][_0xf969('0x2f')]?_0x2c4e91[_0xf969('0x2c')]:_0x3a0dad[_0xf969('0x28')];if(!_0x61ee31[_0xf969('0x2a')][_0xf969('0x30')](_0xf969('0x31'))){_0x2c4e91[_0xf969('0x32')]=qs[_0xf969('0x32')](_0x61ee31['query'][_0xf969('0x32')]);_0x2c4e91['offset']=qs[_0xf969('0x1a')](_0x61ee31['query'][_0xf969('0x1a')]);}_0x2c4e91[_0xf969('0x33')]=qs['sort'](_0x61ee31[_0xf969('0x2a')][_0xf969('0x34')]);_0x2c4e91[_0xf969('0x35')]=qs[_0xf969('0x2b')](_[_0xf969('0x36')](_0x61ee31[_0xf969('0x2a')],_0x3a0dad[_0xf969('0x2b')]));if(_0x61ee31['query'][_0xf969('0x37')]){_0x2c4e91[_0xf969('0x35')]=_['merge'](_0x2c4e91[_0xf969('0x35')],{'$or':_[_0xf969('0x38')](_0x2d35bd,function(_0x473d05){if(_0x473d05['type'][_0xf969('0x39')]!=='VIRTUAL'){var _0x4b0e95={};_0x4b0e95[_0x473d05[_0xf969('0x3a')]]={'$like':'%'+_0x61ee31['query'][_0xf969('0x37')]+'%'};return _0x4b0e95;}})});}_0x2c4e91=_[_0xf969('0x3b')]({},_0x2c4e91,_0x61ee31[_0xf969('0x3c')]);var _0x3f58dc={'where':_0x2c4e91[_0xf969('0x35')]};return db[_0xf969('0x27')][_0xf969('0x3d')](_0x3f58dc)[_0xf969('0x20')](function(_0x5bba0d){_0x4e6a0b[_0xf969('0x3d')]=_0x5bba0d;if(_0x61ee31[_0xf969('0x2a')][_0xf969('0x3e')]){_0x2c4e91['include']=[{'all':!![]}];}return db[_0xf969('0x27')]['findAll'](_0x2c4e91);})[_0xf969('0x20')](function(_0x4b054f){_0x4e6a0b[_0xf969('0x3f')]=_0x4b054f;return _0x4e6a0b;})['then'](respondWithFilteredResult(_0x3ce494,_0x2c4e91))[_0xf969('0x40')](handleError(_0x3ce494,null));};exports[_0xf969('0x41')]=function(_0x3ace82,_0x36ed77){var _0x9001e1={'raw':!![],'where':{'id':_0x3ace82[_0xf969('0x42')]['id']}},_0x2c843f={};_0x2c843f[_0xf969('0x28')]=_[_0xf969('0x29')](db[_0xf969('0x27')][_0xf969('0x43')]);_0x2c843f['query']=_['keys'](_0x3ace82[_0xf969('0x2a')]);_0x2c843f[_0xf969('0x2b')]=_[_0xf969('0x2d')](_0x2c843f['model'],_0x2c843f[_0xf969('0x2a')]);_0x9001e1[_0xf969('0x2c')]=_['intersection'](_0x2c843f[_0xf969('0x28')],qs[_0xf969('0x2e')](_0x3ace82[_0xf969('0x2a')][_0xf969('0x2e')]));_0x9001e1['attributes']=_0x9001e1[_0xf969('0x2c')][_0xf969('0x2f')]?_0x9001e1[_0xf969('0x2c')]:_0x2c843f[_0xf969('0x28')];if(_0x3ace82['query'][_0xf969('0x3e')]){_0x9001e1[_0xf969('0x44')]=[{'all':!![]}];}_0x9001e1=_[_0xf969('0x3b')]({},_0x9001e1,_0x3ace82['options']);return db['AnalyticDefaultReport'][_0xf969('0x45')](_0x9001e1)['then'](handleEntityNotFound(_0x36ed77,null))[_0xf969('0x20')](respondWithResult(_0x36ed77,null))['catch'](handleError(_0x36ed77,null));};exports['create']=function(_0x55b1ce,_0x5eda44){return db['AnalyticDefaultReport']['create'](_0x55b1ce[_0xf969('0x46')],{})[_0xf969('0x20')](function(_0x16e1eb){var _0x44ed55=_0x55b1ce[_0xf969('0x47')][_0xf969('0x21')]({'plain':!![]});if(!_0x44ed55)throw new Error(_0xf969('0x48'));if(_0x44ed55['role']==='user'){var _0x47b32b=_0x16e1eb[_0xf969('0x21')]({'plain':!![]});var _0x19c883=_0xf969('0x49');return db['UserProfileSection'][_0xf969('0x45')]({'where':{'name':_0x19c883,'userProfileId':_0x44ed55[_0xf969('0x4a')]},'raw':!![]})[_0xf969('0x20')](function(_0x3c2626){if(_0x3c2626&&_0x3c2626[_0xf969('0x4b')]===0x0){return db[_0xf969('0x4c')][_0xf969('0x4d')]({'name':_0x47b32b[_0xf969('0x26')],'resourceId':_0x47b32b['id'],'type':_0xf969('0x22'),'sectionId':_0x3c2626['id']},{})[_0xf969('0x20')](function(){return _0x16e1eb;});}else{return _0x16e1eb;}})[_0xf969('0x40')](function(_0x13e6a6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13e6a6);throw _0x13e6a6;});}return _0x16e1eb;})[_0xf969('0x20')](respondWithResult(_0x5eda44,0xc9))[_0xf969('0x40')](handleError(_0x5eda44,null));};exports[_0xf969('0x1f')]=function(_0x15bb68,_0x1af1ad){if(_0x15bb68[_0xf969('0x46')]['id']){delete _0x15bb68[_0xf969('0x46')]['id'];}return db[_0xf969('0x27')][_0xf969('0x45')]({'where':{'id':_0x15bb68['params']['id']}})[_0xf969('0x20')](handleEntityNotFound(_0x1af1ad,null))[_0xf969('0x20')](saveUpdates(_0x15bb68[_0xf969('0x46')],null))[_0xf969('0x20')](respondWithResult(_0x1af1ad,null))['catch'](handleError(_0x1af1ad,null));};exports[_0xf969('0x23')]=function(_0x331902,_0x238bb9){return db[_0xf969('0x27')][_0xf969('0x45')]({'where':{'id':_0x331902[_0xf969('0x42')]['id']}})[_0xf969('0x20')](handleEntityNotFound(_0x238bb9,null))['then'](removeEntity(_0x238bb9,null))['catch'](handleError(_0x238bb9,null));};exports[_0xf969('0x4e')]=function(_0x59b451,_0x5b462a){var _0x27f64a=0xa;var _0x14f4ea=[_0xf969('0x4f'),'left_join',_0xf969('0x50'),_0xf969('0x51')];var _0x581cc8={'SUM':'SUM(%s)','COUNT':_0xf969('0x52'),'COUNT DISTINCT':_0xf969('0x53'),'MAX':'MAX(%s)','MIN':_0xf969('0x54'),'AVG':_0xf969('0x55'),'GROUP_CONCAT':_0xf969('0x56'),'GROUP_CONCAT ASC':_0xf969('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x156f20={'SEC_TO_TIME':_0xf969('0x58'),'DATE':_0xf969('0x59'),'HOUR':_0xf969('0x5a'),'ROUND':_0xf969('0x5b'),'UNIX_TIMESTAMP':_0xf969('0x5c')};var _0x50596a=function(_0x3b4355){return!_[_0xf969('0x5d')]([_0xf969('0x5e'),_0xf969('0x5f'),_0xf969('0x60'),_0xf969('0x61')],_0x3b4355);};var _0x4bb6f7=function(_0x22682f){if(!_0x22682f||!_0x22682f[_0xf969('0x62')]['length']){return'';}for(var _0x37ea21='(',_0x1c61a2=0x0;_0x1c61a2<_0x22682f[_0xf969('0x62')][_0xf969('0x2f')];_0x1c61a2+=0x1){_0x1c61a2>0x0&&(_0x37ea21+='\x20'+_0x22682f[_0xf969('0x63')]+'\x20');_0x37ea21+=_0x22682f['rules'][_0x1c61a2][_0xf969('0x64')]?_0x4bb6f7(_0x22682f[_0xf969('0x62')][_0x1c61a2][_0xf969('0x64')]):_0x22682f[_0xf969('0x62')][_0x1c61a2][_0xf969('0x3a')]+'\x20'+_0x22682f[_0xf969('0x62')][_0x1c61a2]['condition']+(_0x50596a(_0x22682f[_0xf969('0x62')][_0x1c61a2][_0xf969('0x65')])?'\x20'+_0x22682f[_0xf969('0x62')][_0x1c61a2][_0xf969('0x66')]:'');}return _0x37ea21+')';};var _0x17f0c2={'where':{'id':_0x59b451['params']['id']}},_0x6d37e3,_0x37101b,_0x5c1417,_0x40c297,_0xd4ad90;_0x17f0c2=_[_0xf969('0x3b')]({},_0x17f0c2,_0x59b451['options']);return db[_0xf969('0x27')][_0xf969('0x45')](_0x17f0c2)[_0xf969('0x20')](function(_0x5dabd4){if(_0x5dabd4){_0x6d37e3=_0x5dabd4;return _0x5dabd4[_0xf969('0x67')]();}return null;})['then'](function(_0x22176c){if(_0x22176c){if(!_0x22176c['length']){throw new db[(_0xf969('0x68'))][(_0xf969('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x37101b=_0x22176c;return db['AnalyticMetric'][_0xf969('0x6a')]({'raw':!![]});}return null;})[_0xf969('0x20')](function(_0x5eba77){if(_0x5eba77){_0x5c1417=_[_0xf969('0x6b')](_0x5eba77,'id');var _0xa8ead6;var _0x565221=squel[_0xf969('0x6c')]();_0x565221[_0xf969('0x6d')](_0x6d37e3[_0xf969('0x6e')]);for(var _0x97ef66=0x0;_0x97ef66<_0x37101b[_0xf969('0x2f')];_0x97ef66+=0x1){_0xa8ead6=_0x37101b[_0x97ef66][_0xf969('0x6f')]?_0x5c1417[_0x37101b[_0x97ef66]['MetricId']][_0xf969('0x70')]:_0x37101b[_0x97ef66][_0xf969('0x3a')];_0xa8ead6=_0x37101b[_0x97ef66][_0xf969('0x71')]?_[_0xf969('0x72')](_0x581cc8[_0x37101b[_0x97ef66]['function']],'%s',_0xa8ead6):_0xa8ead6;_0xa8ead6=_0x37101b[_0x97ef66][_0xf969('0x73')]?_[_0xf969('0x72')](_0x156f20[_0x37101b[_0x97ef66][_0xf969('0x73')]],'%s',_0xa8ead6):_0xa8ead6;if(_0x37101b[_0x97ef66][_0xf969('0x74')]){_0x565221['group'](_0xa8ead6);}_0x37101b[_0x97ef66][_0xf969('0x75')]&&_0x565221['order'](_0xa8ead6,_0x37101b[_0x97ef66]['orderBy']===_0xf969('0x76')?![]:!![]);_0x565221[_0xf969('0x3a')](_0xa8ead6,_0x37101b[_0x97ef66][_0xf969('0x77')]||_0xa8ead6);}if(_0x6d37e3[_0xf969('0x78')]){_0x6d37e3['joins']=JSON[_0xf969('0x79')](_0x6d37e3[_0xf969('0x78')]);for(var _0xe9975a=0x0;_0xe9975a<_0x6d37e3['joins'][_0xf969('0x2f')];_0xe9975a+=0x1){if(_0x6d37e3[_0xf969('0x78')][_0xe9975a][_0xf969('0x7a')]&&_[_0xf969('0x5d')](_0x14f4ea,_0x6d37e3[_0xf969('0x78')][_0xe9975a][_0xf969('0x7a')])&&_0x6d37e3[_0xf969('0x78')][_0xe9975a]['parentKey']&&_0x6d37e3[_0xf969('0x78')][_0xe9975a][_0xf969('0x7b')]&&_0x6d37e3[_0xf969('0x78')][_0xe9975a]['foreignKey']){_0x565221[_0x6d37e3[_0xf969('0x78')][_0xe9975a][_0xf969('0x7a')]](_0x6d37e3[_0xf969('0x78')][_0xe9975a][_0xf969('0x7b')],null,util['format'](_0xf969('0x7c'),_0x6d37e3[_0xf969('0x6e')],_0x6d37e3[_0xf969('0x78')][_0xe9975a]['parentKey'],_0x6d37e3[_0xf969('0x78')][_0xe9975a][_0xf969('0x7b')],_0x6d37e3['joins'][_0xe9975a][_0xf969('0x7d')]));}}}if(_0x6d37e3[_0xf969('0x7e')]){_0x6d37e3['conditions']=JSON[_0xf969('0x79')](_0x6d37e3[_0xf969('0x7e')]);_0x565221['where'](_0x4bb6f7(_0x6d37e3['conditions'][_0xf969('0x64')]));}_0xd4ad90=_0x565221[_0xf969('0x7f')]();_0x565221['limit'](_0x27f64a);_0x565221['offset'](0x0);logger[_0xf969('0x80')](_0xf969('0x81'),_0x565221[_0xf969('0x82')]());return db[_0xf969('0x83')][_0xf969('0x2a')](_0x565221[_0xf969('0x82')](),{'type':db[_0xf969('0x83')][_0xf969('0x84')][_0xf969('0x85')]});}})[_0xf969('0x20')](respondWithResult(_0x5b462a,null))[_0xf969('0x40')](handleError(_0x5b462a,null));};function runReport(_0x247e6d,_0xe4e695,_0x7c5827){var _0x422a88=_0xe4e695[_0xf969('0x26')];var _0x2ebc2b=0xa;var _0x280cd1=[_0xf969('0x4f'),'left_join',_0xf969('0x50'),_0xf969('0x51')];var _0x20ef9d={'SUM':'SUM(%s)','COUNT':_0xf969('0x52'),'COUNT DISTINCT':_0xf969('0x53'),'MAX':'MAX(%s)','MIN':_0xf969('0x54'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xf969('0x56'),'GROUP_CONCAT ASC':_0xf969('0x57'),'GROUP_CONCAT DESC':_0xf969('0x86')};var _0x12db7a={'SEC_TO_TIME':_0xf969('0x58'),'DATE':'DATE(%s)','HOUR':_0xf969('0x5a'),'ROUND':_0xf969('0x5b'),'UNIX_TIMESTAMP':_0xf969('0x5c')};var _0x32e7f6=function(_0x5ba312){return!_['includes'](['IS\x20NULL',_0xf969('0x5f'),'IS\x20EMPTY',_0xf969('0x61')],_0x5ba312);};var _0x28812a=function(_0x394671){if(!_0x394671||!_0x394671[_0xf969('0x62')][_0xf969('0x2f')]){return'';}for(var _0x375898='(',_0xc6eddc=0x0;_0xc6eddc<_0x394671['rules']['length'];_0xc6eddc+=0x1){_0xc6eddc>0x0&&(_0x375898+='\x20'+_0x394671[_0xf969('0x63')]+'\x20');_0x375898+=_0x394671['rules'][_0xc6eddc][_0xf969('0x64')]?_0x28812a(_0x394671['rules'][_0xc6eddc][_0xf969('0x64')]):_0x394671[_0xf969('0x62')][_0xc6eddc][_0xf969('0x3a')]+'\x20'+_0x394671['rules'][_0xc6eddc]['condition']+(_0x32e7f6(_0x394671['rules'][_0xc6eddc]['condition'])?'\x20'+_0x394671[_0xf969('0x62')][_0xc6eddc][_0xf969('0x66')]:'');}return _0x375898+')';};var _0x15084d={'where':{'id':_0x247e6d['id']}},_0x28a5f1,_0x1b3f6d,_0x48e1f9,_0x4bf0c1,_0xa618c1;_0x15084d=_[_0xf969('0x3b')]({},_0x15084d,_0x7c5827);return db['AnalyticDefaultReport'][_0xf969('0x45')](_0x15084d)[_0xf969('0x20')](function(_0x50b30a){if(_0x50b30a){_0x28a5f1=_0x50b30a;return _0x50b30a['getFields']();}return null;})[_0xf969('0x20')](function(_0x11e09e){if(_0x11e09e){if(!_0x11e09e[_0xf969('0x2f')]){throw new db[(_0xf969('0x68'))][(_0xf969('0x69'))](_0xf969('0x87'),0x193);}_0x1b3f6d=_0x11e09e;return db[_0xf969('0x88')][_0xf969('0x6a')]({'raw':!![]});}return null;})[_0xf969('0x20')](function(_0x1b5d43){if(_0x1b5d43){_0x48e1f9=_['keyBy'](_0x1b5d43,'id');var _0x1dd68b;var _0x599252=squel[_0xf969('0x6c')]();_0x599252[_0xf969('0x6d')](_0x28a5f1[_0xf969('0x6e')]);for(var _0x356147=0x0;_0x356147<_0x1b3f6d[_0xf969('0x2f')];_0x356147+=0x1){_0x1dd68b=_0x1b3f6d[_0x356147]['MetricId']?_0x48e1f9[_0x1b3f6d[_0x356147][_0xf969('0x6f')]]['metric']:_0x1b3f6d[_0x356147][_0xf969('0x3a')];_0x1dd68b=_0x1b3f6d[_0x356147][_0xf969('0x71')]?_['replace'](_0x20ef9d[_0x1b3f6d[_0x356147][_0xf969('0x71')]],'%s',_0x1dd68b):_0x1dd68b;_0x1dd68b=_0x1b3f6d[_0x356147][_0xf969('0x73')]?_[_0xf969('0x72')](_0x12db7a[_0x1b3f6d[_0x356147]['format']],'%s',_0x1dd68b):_0x1dd68b;if(_0x1b3f6d[_0x356147][_0xf969('0x74')]){_0x599252[_0xf969('0x64')](_0x1dd68b);}_0x1b3f6d[_0x356147][_0xf969('0x75')]&&_0x599252[_0xf969('0x33')](_0x1dd68b,_0x1b3f6d[_0x356147][_0xf969('0x75')]===_0xf969('0x76')?![]:!![]);_0x599252[_0xf969('0x3a')](_0x1dd68b,_0x1b3f6d[_0x356147]['alias']||_0x1dd68b);}if(_0x28a5f1['joins']){_0x28a5f1[_0xf969('0x78')]=JSON['parse'](_0x28a5f1[_0xf969('0x78')]);for(var _0xccbe8b=0x0;_0xccbe8b<_0x28a5f1[_0xf969('0x78')][_0xf969('0x2f')];_0xccbe8b+=0x1){if(_0x28a5f1[_0xf969('0x78')][_0xccbe8b][_0xf969('0x7a')]&&_[_0xf969('0x5d')](_0x280cd1,_0x28a5f1[_0xf969('0x78')][_0xccbe8b][_0xf969('0x7a')])&&_0x28a5f1[_0xf969('0x78')][_0xccbe8b][_0xf969('0x89')]&&_0x28a5f1[_0xf969('0x78')][_0xccbe8b][_0xf969('0x7b')]&&_0x28a5f1[_0xf969('0x78')][_0xccbe8b][_0xf969('0x7d')]){_0x599252[_0x28a5f1[_0xf969('0x78')][_0xccbe8b][_0xf969('0x7a')]](_0x28a5f1[_0xf969('0x78')][_0xccbe8b][_0xf969('0x7b')],null,util[_0xf969('0x73')]('%s.%s\x20=\x20%s.%s',_0x28a5f1[_0xf969('0x6e')],_0x28a5f1['joins'][_0xccbe8b][_0xf969('0x89')],_0x28a5f1[_0xf969('0x78')][_0xccbe8b][_0xf969('0x7b')],_0x28a5f1[_0xf969('0x78')][_0xccbe8b][_0xf969('0x7d')]));}}}if(_0x28a5f1[_0xf969('0x7e')]){_0x28a5f1[_0xf969('0x7e')]=JSON[_0xf969('0x79')](_0x28a5f1[_0xf969('0x7e')]);_0x599252['where'](_0x28812a(_0x28a5f1[_0xf969('0x7e')][_0xf969('0x64')]));}_0xa618c1=_0x599252['clone']();_0x599252['limit'](_0x2ebc2b);_0x599252[_0xf969('0x1a')](0x0);logger[_0xf969('0x80')](_0xf969('0x81'),_0x599252[_0xf969('0x82')]());return db[_0xf969('0x83')][_0xf969('0x2a')](_0x599252[_0xf969('0x82')](),{'type':db[_0xf969('0x83')][_0xf969('0x84')]['SELECT']});}})[_0xf969('0x20')](function(_0x1560ca){if(!_0x1560ca[_0xf969('0x2f')]){throw new db[(_0xf969('0x68'))][(_0xf969('0x69'))](_0xf969('0x8a'),0xcc);}if(_0xe4e695[_0xf969('0x8b')]===_0xf969('0x8c')){return null;}var _0x754339=_[_0xf969('0x3b')](_0xe4e695,{'name':_0xe4e695[_0xf969('0x8d')]||_0xe4e695[_0xf969('0x26')]||_0x28a5f1[_0xf969('0x26')],'basename':_0x422a88,'savename':util[_0xf969('0x73')](_0xf969('0x8e'),_0xe4e695[_0xf969('0x26')]||_0x28a5f1[_0xf969('0x26')],require(_0xf969('0x8f'))[_0xf969('0x90')](0x4),_0xe4e695['output']||_0xf969('0x91')),'reportId':_0x28a5f1['id'],'reportType':_0xf969('0x92')});return db[_0xf969('0x93')][_0xf969('0x4d')](_0x754339,{'raw':!![]});})[_0xf969('0x20')](function(_0x1df0e5){if(_0x28a5f1[_0xf969('0x6e')]===_0xf969('0x94')){_0xa618c1['where'](_0x28a5f1[_0xf969('0x6e')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xe4e695[_0xf969('0x95')],_0xe4e695['endDate']);}else{_0xa618c1[_0xf969('0x35')](_0x28a5f1[_0xf969('0x6e')]+_0xf969('0x96'),_0xe4e695[_0xf969('0x95')],_0xe4e695[_0xf969('0x97')]);}if(_0x1df0e5){logger[_0xf969('0x98')](_0xf969('0x99'),_0xa618c1[_0xf969('0x82')]());require(_0xf969('0x9a'))['fork'](path['join'](__dirname,_0xf969('0x9b'),_0x1df0e5[_0xf969('0x8b')]),[_0x1df0e5['id'],_0xa618c1[_0xf969('0x82')](),path[_0xf969('0x4f')](__dirname,_0xf969('0x9c'),_0x1df0e5[_0xf969('0x9d')]),_0x422a88]);return _0x1df0e5;}else{var _0x2e971f=squel[_0xf969('0x6c')]();_0x2e971f[_0xf969('0x6d')]('('+_0xa618c1[_0xf969('0x82')]()+')',_0xf969('0x9e'));_0x2e971f['field'](_0xf969('0x9f'),_0xf969('0x3d'));_0xa618c1[_0xf969('0x32')](_0xe4e695['limit']||_0x2ebc2b);_0xa618c1[_0xf969('0x1a')](_0xe4e695['offset']||0x0);return db[_0xf969('0x83')]['query'](_0x2e971f[_0xf969('0x82')](),{'type':db['sequelize'][_0xf969('0x84')][_0xf969('0x85')]})[_0xf969('0x20')](function(_0xefafa){if(!_0xefafa['length']){_0x4bf0c1=0x0;}else{_0x4bf0c1=_0xefafa[0x0][_0xf969('0x3d')]||0x0;}return db['sequelize'][_0xf969('0x2a')](_0xa618c1[_0xf969('0x82')](),{'type':db[_0xf969('0x83')][_0xf969('0x84')][_0xf969('0x85')]});})['then'](function(_0x93c156){return{'rows':_0x93c156||[],'count':_0x4bf0c1};});}});}exports['run']=function(_0x18b2d3,_0x55a78f){return runReport(_0x18b2d3[_0xf969('0x42')],_0x18b2d3[_0xf969('0x2a')],_0x18b2d3[_0xf969('0x3c')])[_0xf969('0x20')](respondWithResult(_0x55a78f,null))[_0xf969('0x40')](handleError(_0x55a78f,null));};exports[_0xf969('0xa0')]=runReport;exports[_0xf969('0x2a')]=function(_0x3d8c0d,_0x2ffde5){var _0x1e44be=0xa;var _0x5b4ad4=[_0xf969('0x4f'),_0xf969('0xa1'),_0xf969('0x50'),_0xf969('0x51')];var _0x4ad4cd={'SUM':_0xf969('0xa2'),'COUNT':_0xf969('0x52'),'COUNT DISTINCT':_0xf969('0x53'),'MAX':_0xf969('0xa3'),'MIN':_0xf969('0x54'),'AVG':_0xf969('0x55'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xf969('0x57'),'GROUP_CONCAT DESC':_0xf969('0x86')};var _0xc737e2={'SEC_TO_TIME':_0xf969('0x58'),'DATE':_0xf969('0x59'),'HOUR':_0xf969('0x5a'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xf969('0x5c')};var _0x26090b=function(_0x413d93){return!_[_0xf969('0x5d')]([_0xf969('0x5e'),_0xf969('0x5f'),_0xf969('0x60'),_0xf969('0x61')],_0x413d93);};var _0x50b7ce=function(_0x224b83){if(!_0x224b83||!_0x224b83[_0xf969('0x62')]['length']){return'';}for(var _0x18e456='(',_0x31af68=0x0;_0x31af68<_0x224b83['rules'][_0xf969('0x2f')];_0x31af68+=0x1){_0x31af68>0x0&&(_0x18e456+='\x20'+_0x224b83[_0xf969('0x63')]+'\x20');_0x18e456+=_0x224b83[_0xf969('0x62')][_0x31af68][_0xf969('0x64')]?_0x50b7ce(_0x224b83[_0xf969('0x62')][_0x31af68][_0xf969('0x64')]):_0x224b83[_0xf969('0x62')][_0x31af68][_0xf969('0x3a')]+'\x20'+_0x224b83[_0xf969('0x62')][_0x31af68][_0xf969('0x65')]+(_0x26090b(_0x224b83[_0xf969('0x62')][_0x31af68][_0xf969('0x65')])?'\x20'+_0x224b83[_0xf969('0x62')][_0x31af68][_0xf969('0x66')]:'');}return _0x18e456+')';};var _0x491b2c={'where':{'id':_0x3d8c0d[_0xf969('0x42')]['id']}},_0x1d0526,_0x1af673,_0x4cf594,_0x2433b6,_0x4e0af0;_0x491b2c=_['merge']({},_0x491b2c,_0x3d8c0d[_0xf969('0x3c')]);return db[_0xf969('0x27')][_0xf969('0x45')](_0x491b2c)[_0xf969('0x20')](function(_0x1b4cbd){if(_0x1b4cbd){_0x1d0526=_0x1b4cbd;return _0x1b4cbd[_0xf969('0x67')]();}return null;})[_0xf969('0x20')](function(_0x568f8c){if(_0x568f8c){if(!_0x568f8c[_0xf969('0x2f')]){throw new db['Sequelize'][(_0xf969('0x69'))](_0xf969('0x87'),0x193);}_0x1af673=_0x568f8c;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xf969('0x20')](function(_0x28e6a5){if(_0x28e6a5){_0x4cf594=_[_0xf969('0x6b')](_0x28e6a5,'id');var _0x2ed2d7;var _0x1ea396=squel['select']();_0x1ea396[_0xf969('0x6d')](_0x1d0526[_0xf969('0x6e')]);for(var _0x515767=0x0;_0x515767<_0x1af673['length'];_0x515767+=0x1){_0x2ed2d7=_0x1af673[_0x515767][_0xf969('0x6f')]?_0x4cf594[_0x1af673[_0x515767][_0xf969('0x6f')]]['metric']:_0x1af673[_0x515767]['field'];_0x2ed2d7=_0x1af673[_0x515767][_0xf969('0x71')]?_['replace'](_0x4ad4cd[_0x1af673[_0x515767][_0xf969('0x71')]],'%s',_0x2ed2d7):_0x2ed2d7;_0x2ed2d7=_0x1af673[_0x515767][_0xf969('0x73')]?_[_0xf969('0x72')](_0xc737e2[_0x1af673[_0x515767]['format']],'%s',_0x2ed2d7):_0x2ed2d7;if(_0x1af673[_0x515767]['groupBy']){_0x1ea396['group'](_0x2ed2d7);}_0x1af673[_0x515767][_0xf969('0x75')]&&_0x1ea396[_0xf969('0x33')](_0x2ed2d7,_0x1af673[_0x515767][_0xf969('0x75')]===_0xf969('0x76')?![]:!![]);_0x1ea396[_0xf969('0x3a')](_0x2ed2d7,_0x1af673[_0x515767][_0xf969('0x77')]||_0x2ed2d7);}if(_0x1d0526['joins']){_0x1d0526[_0xf969('0x78')]=JSON[_0xf969('0x79')](_0x1d0526[_0xf969('0x78')]);for(var _0x26a7dd=0x0;_0x26a7dd<_0x1d0526[_0xf969('0x78')][_0xf969('0x2f')];_0x26a7dd+=0x1){if(_0x1d0526[_0xf969('0x78')][_0x26a7dd][_0xf969('0x7a')]&&_[_0xf969('0x5d')](_0x5b4ad4,_0x1d0526[_0xf969('0x78')][_0x26a7dd][_0xf969('0x7a')])&&_0x1d0526[_0xf969('0x78')][_0x26a7dd][_0xf969('0x89')]&&_0x1d0526[_0xf969('0x78')][_0x26a7dd]['foreignTable']&&_0x1d0526[_0xf969('0x78')][_0x26a7dd][_0xf969('0x7d')]){_0x1ea396[_0x1d0526[_0xf969('0x78')][_0x26a7dd][_0xf969('0x7a')]](_0x1d0526[_0xf969('0x78')][_0x26a7dd][_0xf969('0x7b')],null,util[_0xf969('0x73')](_0xf969('0x7c'),_0x1d0526[_0xf969('0x6e')],_0x1d0526[_0xf969('0x78')][_0x26a7dd]['parentKey'],_0x1d0526[_0xf969('0x78')][_0x26a7dd][_0xf969('0x7b')],_0x1d0526[_0xf969('0x78')][_0x26a7dd][_0xf969('0x7d')]));}}}if(_0x1d0526[_0xf969('0x7e')]){_0x1d0526[_0xf969('0x7e')]=JSON[_0xf969('0x79')](_0x1d0526[_0xf969('0x7e')]);_0x1ea396['where'](_0x50b7ce(_0x1d0526[_0xf969('0x7e')][_0xf969('0x64')]));}_0x4e0af0=_0x1ea396[_0xf969('0x7f')]();_0x1ea396[_0xf969('0x32')](_0x1e44be);_0x1ea396[_0xf969('0x1a')](0x0);logger['debug'](_0xf969('0x81'),_0x1ea396[_0xf969('0x82')]());return db[_0xf969('0x83')][_0xf969('0x2a')](_0x1ea396[_0xf969('0x82')](),{'type':db[_0xf969('0x83')][_0xf969('0x84')][_0xf969('0x85')]});}})[_0xf969('0x20')](function(){return{'sql':_0x4e0af0[_0xf969('0x82')]()};})[_0xf969('0x20')](respondWithResult(_0x2ffde5,null))[_0xf969('0x40')](handleError(_0x2ffde5,null));}; \ No newline at end of file +var _0x54bd=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','end','count','offset','status','set','Content-Range','json','apply','reject','save','get','DefaultReports','UserProfileResource','destroy','then','sendStatus','error','stack','name','send','index','rawAttributes','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','field','AnalyticDefaultReport','includeAll','include','rows','catch','show','params','find','body','user','role','Reports','userProfileId','autoAssociation','create','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','options','ValidationErrorItem','keyBy','select','from','table','MetricId','function','format','replace','orderBy','DESC','alias','joins','parse','type','parentKey','foreignTable','foreignKey','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','MIN(%s)','IS\x20NOT\x20NULL','operator','condition','value','getFields','Sequelize','metric','groupBy','%s.%s\x20=\x20%s.%s','clone','No\x20available\x20data','output','web','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../files/reports','countTable','run','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x5ddc45,_0x2b5ddd){var _0x3c984d=function(_0x1abf5e){while(--_0x1abf5e){_0x5ddc45['push'](_0x5ddc45['shift']());}};_0x3c984d(++_0x2b5ddd);}(_0x54bd,0x9a));var _0xd54b=function(_0x31c155,_0x3cd1ca){_0x31c155=_0x31c155-0x0;var _0x2200d1=_0x54bd[_0x31c155];return _0x2200d1;};'use strict';var pdf=require(_0xd54b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd54b('0x1'));var zipdir=require(_0xd54b('0x2'));var jsonpatch=require(_0xd54b('0x3'));var rp=require(_0xd54b('0x4'));var moment=require(_0xd54b('0x5'));var BPromise=require(_0xd54b('0x6'));var Mustache=require(_0xd54b('0x7'));var util=require('util');var path=require(_0xd54b('0x8'));var sox=require(_0xd54b('0x9'));var csv=require(_0xd54b('0xa'));var ejs=require(_0xd54b('0xb'));var fs=require('fs');var _=require(_0xd54b('0xc'));var squel=require(_0xd54b('0xd'));var crypto=require(_0xd54b('0xe'));var jsforce=require(_0xd54b('0xf'));var deskjs=require(_0xd54b('0x10'));var toCsv=require('to-csv');var querystring=require(_0xd54b('0x11'));var Papa=require('papaparse');var authService=require(_0xd54b('0x12'));var hardwareService=require(_0xd54b('0x13'));var Redis=require('ioredis');var qs=require(_0xd54b('0x14'));var logger=require(_0xd54b('0x15'))(_0xd54b('0x16'));var utils=require(_0xd54b('0x17'));var config=require(_0xd54b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a3942,_0x2b367b){_0x2b367b=_0x2b367b||0xcc;return function(_0x3e2cc4){if(_0x3e2cc4){return _0x1a3942['sendStatus'](_0x2b367b);}return _0x1a3942['status'](_0x2b367b)[_0xd54b('0x19')]();};}function respondWithResult(_0x1d43c5,_0x13362e){_0x13362e=_0x13362e||0xc8;return function(_0x5874bf){if(_0x5874bf){return _0x1d43c5['status'](_0x13362e)['json'](_0x5874bf);}};}function respondWithFilteredResult(_0x50ce8d,_0x14cbb3){return function(_0x44652c){if(_0x44652c){var _0xae0f49=_0x44652c[_0xd54b('0x1a')],_0x2cf1af=_0x14cbb3[_0xd54b('0x1b')],_0x2572f9=_0x14cbb3[_0xd54b('0x1b')]+_0x14cbb3['limit'],_0x5a0fb1;if(_0x2572f9>=_0xae0f49){_0x2572f9=_0xae0f49;_0x5a0fb1=0xc8;}else{_0x5a0fb1=0xce;}_0x50ce8d[_0xd54b('0x1c')](_0x5a0fb1);return _0x50ce8d[_0xd54b('0x1d')](_0xd54b('0x1e'),_0x2cf1af+'-'+_0x2572f9+'/'+_0xae0f49)[_0xd54b('0x1f')](_0x44652c);}return null;};}function patchUpdates(_0x521274){return function(_0x433907){try{jsonpatch[_0xd54b('0x20')](_0x433907,_0x521274,!![]);}catch(_0x36ca08){return BPromise[_0xd54b('0x21')](_0x36ca08);}return _0x433907[_0xd54b('0x22')]();};}function saveUpdates(_0x35c9f6,_0x6080ce){return function(_0x54723c){if(_0x54723c){return _0x54723c['update'](_0x35c9f6)['then'](function(_0x2d6474){return _0x2d6474;});}return null;};}function removeEntity(_0x40eca8,_0x1aabf8){return function(_0x3df14e){if(_0x3df14e){return _0x3df14e['destroy']()['then'](function(){var _0x1dbe54=_0x3df14e[_0xd54b('0x23')]({'plain':!![]});var _0x4fdcc7=_0xd54b('0x24');return db[_0xd54b('0x25')][_0xd54b('0x26')]({'where':{'type':_0x4fdcc7,'resourceId':_0x1dbe54['id']}})['then'](function(){return _0x3df14e;});})[_0xd54b('0x27')](function(){_0x40eca8[_0xd54b('0x1c')](0xcc)[_0xd54b('0x19')]();});}};}function handleEntityNotFound(_0x367f00,_0xe39e8b){return function(_0x4bc43e){if(!_0x4bc43e){_0x367f00[_0xd54b('0x28')](0x194);}return _0x4bc43e;};}function handleError(_0x1cff92,_0x3dfa6d){_0x3dfa6d=_0x3dfa6d||0x1f4;return function(_0x58fc1a){logger[_0xd54b('0x29')](_0x58fc1a[_0xd54b('0x2a')]);if(_0x58fc1a['name']){delete _0x58fc1a[_0xd54b('0x2b')];}_0x1cff92[_0xd54b('0x1c')](_0x3dfa6d)[_0xd54b('0x2c')](_0x58fc1a);};}exports[_0xd54b('0x2d')]=function(_0xbb1140,_0x55b2c6){var _0x3e22fe={},_0x58d13c={},_0x11a4f5={'count':0x0,'rows':[]};var _0x32943a=db['AnalyticDefaultReport'][_0xd54b('0x2e')];_0x58d13c['model']=_[_0xd54b('0x2f')](_0x32943a);_0x58d13c[_0xd54b('0x30')]=_[_0xd54b('0x2f')](_0xbb1140[_0xd54b('0x30')]);_0x58d13c[_0xd54b('0x31')]=_['intersection'](_0x58d13c['model'],_0x58d13c['query']);_0x3e22fe[_0xd54b('0x32')]=_[_0xd54b('0x33')](_0x58d13c[_0xd54b('0x34')],qs['fields'](_0xbb1140[_0xd54b('0x30')][_0xd54b('0x35')]));_0x3e22fe[_0xd54b('0x32')]=_0x3e22fe[_0xd54b('0x32')][_0xd54b('0x36')]?_0x3e22fe['attributes']:_0x58d13c[_0xd54b('0x34')];if(!_0xbb1140[_0xd54b('0x30')][_0xd54b('0x37')](_0xd54b('0x38'))){_0x3e22fe['limit']=qs['limit'](_0xbb1140[_0xd54b('0x30')][_0xd54b('0x39')]);_0x3e22fe['offset']=qs['offset'](_0xbb1140['query'][_0xd54b('0x1b')]);}_0x3e22fe[_0xd54b('0x3a')]=qs[_0xd54b('0x3b')](_0xbb1140[_0xd54b('0x30')][_0xd54b('0x3b')]);_0x3e22fe[_0xd54b('0x3c')]=qs[_0xd54b('0x31')](_[_0xd54b('0x3d')](_0xbb1140[_0xd54b('0x30')],_0x58d13c[_0xd54b('0x31')]));if(_0xbb1140[_0xd54b('0x30')][_0xd54b('0x3e')]){_0x3e22fe['where']=_[_0xd54b('0x3f')](_0x3e22fe[_0xd54b('0x3c')],{'$or':_[_0xd54b('0x40')](_0x32943a,function(_0x4919d9){if(_0x4919d9['type']['key']!==_0xd54b('0x41')){var _0x5e0cf2={};_0x5e0cf2[_0x4919d9[_0xd54b('0x42')]]={'$like':'%'+_0xbb1140['query']['filter']+'%'};return _0x5e0cf2;}})});}_0x3e22fe=_[_0xd54b('0x3f')]({},_0x3e22fe,_0xbb1140['options']);var _0x364c8e={'where':_0x3e22fe[_0xd54b('0x3c')]};return db[_0xd54b('0x43')]['count'](_0x364c8e)[_0xd54b('0x27')](function(_0x4bce39){_0x11a4f5[_0xd54b('0x1a')]=_0x4bce39;if(_0xbb1140[_0xd54b('0x30')][_0xd54b('0x44')]){_0x3e22fe[_0xd54b('0x45')]=[{'all':!![]}];}return db['AnalyticDefaultReport']['findAll'](_0x3e22fe);})[_0xd54b('0x27')](function(_0x162376){_0x11a4f5[_0xd54b('0x46')]=_0x162376;return _0x11a4f5;})['then'](respondWithFilteredResult(_0x55b2c6,_0x3e22fe))[_0xd54b('0x47')](handleError(_0x55b2c6,null));};exports[_0xd54b('0x48')]=function(_0x5a4d7d,_0x3ca542){var _0x59d9ac={'raw':!![],'where':{'id':_0x5a4d7d[_0xd54b('0x49')]['id']}},_0x32c50a={};_0x32c50a[_0xd54b('0x34')]=_[_0xd54b('0x2f')](db[_0xd54b('0x43')]['rawAttributes']);_0x32c50a[_0xd54b('0x30')]=_[_0xd54b('0x2f')](_0x5a4d7d[_0xd54b('0x30')]);_0x32c50a[_0xd54b('0x31')]=_[_0xd54b('0x33')](_0x32c50a['model'],_0x32c50a[_0xd54b('0x30')]);_0x59d9ac[_0xd54b('0x32')]=_['intersection'](_0x32c50a[_0xd54b('0x34')],qs['fields'](_0x5a4d7d['query'][_0xd54b('0x35')]));_0x59d9ac['attributes']=_0x59d9ac[_0xd54b('0x32')]['length']?_0x59d9ac['attributes']:_0x32c50a[_0xd54b('0x34')];if(_0x5a4d7d[_0xd54b('0x30')][_0xd54b('0x44')]){_0x59d9ac[_0xd54b('0x45')]=[{'all':!![]}];}_0x59d9ac=_[_0xd54b('0x3f')]({},_0x59d9ac,_0x5a4d7d['options']);return db[_0xd54b('0x43')][_0xd54b('0x4a')](_0x59d9ac)['then'](handleEntityNotFound(_0x3ca542,null))[_0xd54b('0x27')](respondWithResult(_0x3ca542,null))[_0xd54b('0x47')](handleError(_0x3ca542,null));};exports['create']=function(_0x879066,_0x40a11e){return db[_0xd54b('0x43')]['create'](_0x879066[_0xd54b('0x4b')],{})[_0xd54b('0x27')](function(_0x63ed7e){var _0x29206f=_0x879066[_0xd54b('0x4c')][_0xd54b('0x23')]({'plain':!![]});if(!_0x29206f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29206f[_0xd54b('0x4d')]==='user'){var _0x4f90d1=_0x63ed7e['get']({'plain':!![]});var _0x3b8c40=_0xd54b('0x4e');return db['UserProfileSection']['find']({'where':{'name':_0x3b8c40,'userProfileId':_0x29206f[_0xd54b('0x4f')]},'raw':!![]})[_0xd54b('0x27')](function(_0x2484e3){if(_0x2484e3&&_0x2484e3[_0xd54b('0x50')]===0x0){return db['UserProfileResource'][_0xd54b('0x51')]({'name':_0x4f90d1[_0xd54b('0x2b')],'resourceId':_0x4f90d1['id'],'type':_0xd54b('0x24'),'sectionId':_0x2484e3['id']},{})[_0xd54b('0x27')](function(){return _0x63ed7e;});}else{return _0x63ed7e;}})[_0xd54b('0x47')](function(_0x147eae){logger[_0xd54b('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x147eae);throw _0x147eae;});}return _0x63ed7e;})['then'](respondWithResult(_0x40a11e,0xc9))[_0xd54b('0x47')](handleError(_0x40a11e,null));};exports[_0xd54b('0x52')]=function(_0x3c4366,_0x3a9f41){if(_0x3c4366[_0xd54b('0x4b')]['id']){delete _0x3c4366[_0xd54b('0x4b')]['id'];}return db['AnalyticDefaultReport'][_0xd54b('0x4a')]({'where':{'id':_0x3c4366[_0xd54b('0x49')]['id']}})['then'](handleEntityNotFound(_0x3a9f41,null))[_0xd54b('0x27')](saveUpdates(_0x3c4366[_0xd54b('0x4b')],null))[_0xd54b('0x27')](respondWithResult(_0x3a9f41,null))[_0xd54b('0x47')](handleError(_0x3a9f41,null));};exports['destroy']=function(_0x55d924,_0x5788e3){return db['AnalyticDefaultReport']['find']({'where':{'id':_0x55d924[_0xd54b('0x49')]['id']}})[_0xd54b('0x27')](handleEntityNotFound(_0x5788e3,null))[_0xd54b('0x27')](removeEntity(_0x5788e3,null))[_0xd54b('0x47')](handleError(_0x5788e3,null));};exports[_0xd54b('0x53')]=function(_0x47683b,_0x599303){var _0x1156ef=0xa;var _0x415e81=[_0xd54b('0x54'),_0xd54b('0x55'),_0xd54b('0x56'),_0xd54b('0x57')];var _0x3a54ce={'SUM':_0xd54b('0x58'),'COUNT':_0xd54b('0x59'),'COUNT DISTINCT':_0xd54b('0x5a'),'MAX':_0xd54b('0x5b'),'MIN':'MIN(%s)','AVG':_0xd54b('0x5c'),'GROUP_CONCAT':_0xd54b('0x5d'),'GROUP_CONCAT ASC':_0xd54b('0x5e'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3f2e3f={'SEC_TO_TIME':_0xd54b('0x5f'),'DATE':_0xd54b('0x60'),'HOUR':_0xd54b('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xd54b('0x62')};var _0x5a9e3f=function(_0x21d9ea){return!_[_0xd54b('0x63')]([_0xd54b('0x64'),'IS\x20NOT\x20NULL',_0xd54b('0x65'),_0xd54b('0x66')],_0x21d9ea);};var _0x36ba90=function(_0x3d1e95){if(!_0x3d1e95||!_0x3d1e95['rules'][_0xd54b('0x36')]){return'';}for(var _0x187d2c='(',_0xd1381c=0x0;_0xd1381c<_0x3d1e95[_0xd54b('0x67')][_0xd54b('0x36')];_0xd1381c+=0x1){_0xd1381c>0x0&&(_0x187d2c+='\x20'+_0x3d1e95['operator']+'\x20');_0x187d2c+=_0x3d1e95['rules'][_0xd1381c][_0xd54b('0x68')]?_0x36ba90(_0x3d1e95[_0xd54b('0x67')][_0xd1381c]['group']):_0x3d1e95[_0xd54b('0x67')][_0xd1381c][_0xd54b('0x42')]+'\x20'+_0x3d1e95[_0xd54b('0x67')][_0xd1381c]['condition']+(_0x5a9e3f(_0x3d1e95[_0xd54b('0x67')][_0xd1381c]['condition'])?'\x20'+_0x3d1e95['rules'][_0xd1381c]['value']:'');}return _0x187d2c+')';};var _0x3bac22={'where':{'id':_0x47683b['params']['id']}},_0x3169b1,_0x31ecd5,_0x18ea4e,_0x3c5a3e,_0xf08f8e;_0x3bac22=_[_0xd54b('0x3f')]({},_0x3bac22,_0x47683b[_0xd54b('0x69')]);return db[_0xd54b('0x43')][_0xd54b('0x4a')](_0x3bac22)[_0xd54b('0x27')](function(_0x11a7fc){if(_0x11a7fc){_0x3169b1=_0x11a7fc;return _0x11a7fc['getFields']();}return null;})['then'](function(_0xd8bc51){if(_0xd8bc51){if(!_0xd8bc51[_0xd54b('0x36')]){throw new db['Sequelize'][(_0xd54b('0x6a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x31ecd5=_0xd8bc51;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x5b6f60){if(_0x5b6f60){_0x18ea4e=_[_0xd54b('0x6b')](_0x5b6f60,'id');var _0x19e19b;var _0xd7b51e=squel[_0xd54b('0x6c')]();_0xd7b51e[_0xd54b('0x6d')](_0x3169b1[_0xd54b('0x6e')]);for(var _0x3fc6a3=0x0;_0x3fc6a3<_0x31ecd5['length'];_0x3fc6a3+=0x1){_0x19e19b=_0x31ecd5[_0x3fc6a3][_0xd54b('0x6f')]?_0x18ea4e[_0x31ecd5[_0x3fc6a3][_0xd54b('0x6f')]]['metric']:_0x31ecd5[_0x3fc6a3]['field'];_0x19e19b=_0x31ecd5[_0x3fc6a3][_0xd54b('0x70')]?_['replace'](_0x3a54ce[_0x31ecd5[_0x3fc6a3][_0xd54b('0x70')]],'%s',_0x19e19b):_0x19e19b;_0x19e19b=_0x31ecd5[_0x3fc6a3][_0xd54b('0x71')]?_[_0xd54b('0x72')](_0x3f2e3f[_0x31ecd5[_0x3fc6a3][_0xd54b('0x71')]],'%s',_0x19e19b):_0x19e19b;if(_0x31ecd5[_0x3fc6a3]['groupBy']){_0xd7b51e[_0xd54b('0x68')](_0x19e19b);}_0x31ecd5[_0x3fc6a3]['orderBy']&&_0xd7b51e['order'](_0x19e19b,_0x31ecd5[_0x3fc6a3][_0xd54b('0x73')]===_0xd54b('0x74')?![]:!![]);_0xd7b51e[_0xd54b('0x42')](_0x19e19b,_0x31ecd5[_0x3fc6a3][_0xd54b('0x75')]||_0x19e19b);}if(_0x3169b1['joins']){_0x3169b1[_0xd54b('0x76')]=JSON[_0xd54b('0x77')](_0x3169b1['joins']);for(var _0xc5495d=0x0;_0xc5495d<_0x3169b1['joins']['length'];_0xc5495d+=0x1){if(_0x3169b1[_0xd54b('0x76')][_0xc5495d][_0xd54b('0x78')]&&_[_0xd54b('0x63')](_0x415e81,_0x3169b1[_0xd54b('0x76')][_0xc5495d][_0xd54b('0x78')])&&_0x3169b1[_0xd54b('0x76')][_0xc5495d][_0xd54b('0x79')]&&_0x3169b1[_0xd54b('0x76')][_0xc5495d][_0xd54b('0x7a')]&&_0x3169b1[_0xd54b('0x76')][_0xc5495d][_0xd54b('0x7b')]){_0xd7b51e[_0x3169b1[_0xd54b('0x76')][_0xc5495d]['type']](_0x3169b1[_0xd54b('0x76')][_0xc5495d]['foreignTable'],null,util[_0xd54b('0x71')]('%s.%s\x20=\x20%s.%s',_0x3169b1[_0xd54b('0x6e')],_0x3169b1['joins'][_0xc5495d][_0xd54b('0x79')],_0x3169b1[_0xd54b('0x76')][_0xc5495d][_0xd54b('0x7a')],_0x3169b1[_0xd54b('0x76')][_0xc5495d][_0xd54b('0x7b')]));}}}if(_0x3169b1[_0xd54b('0x7c')]){_0x3169b1[_0xd54b('0x7c')]=JSON[_0xd54b('0x77')](_0x3169b1['conditions']);_0xd7b51e[_0xd54b('0x3c')](_0x36ba90(_0x3169b1[_0xd54b('0x7c')][_0xd54b('0x68')]));}_0xf08f8e=_0xd7b51e['clone']();_0xd7b51e[_0xd54b('0x39')](_0x1156ef);_0xd7b51e['offset'](0x0);logger[_0xd54b('0x7d')](_0xd54b('0x7e'),_0xd7b51e[_0xd54b('0x7f')]());return db[_0xd54b('0x80')][_0xd54b('0x30')](_0xd7b51e[_0xd54b('0x7f')](),{'type':db['sequelize'][_0xd54b('0x81')][_0xd54b('0x82')]});}})[_0xd54b('0x27')](respondWithResult(_0x599303,null))['catch'](handleError(_0x599303,null));};function runReport(_0x5672c2,_0x58e652,_0x4cb674){var _0x28bff1=_0x58e652['name'];var _0x568b00=0xa;var _0x10df51=['join',_0xd54b('0x55'),_0xd54b('0x56'),_0xd54b('0x57')];var _0x2baf59={'SUM':_0xd54b('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd54b('0x5b'),'MIN':_0xd54b('0x83'),'AVG':_0xd54b('0x5c'),'GROUP_CONCAT':_0xd54b('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x294293={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd54b('0x60'),'HOUR':_0xd54b('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xd54b('0x62')};var _0x316e2e=function(_0x561d4f){return!_[_0xd54b('0x63')]([_0xd54b('0x64'),_0xd54b('0x84'),_0xd54b('0x65'),_0xd54b('0x66')],_0x561d4f);};var _0x15910d=function(_0x7f774a){if(!_0x7f774a||!_0x7f774a[_0xd54b('0x67')][_0xd54b('0x36')]){return'';}for(var _0x453460='(',_0x1d05e2=0x0;_0x1d05e2<_0x7f774a[_0xd54b('0x67')]['length'];_0x1d05e2+=0x1){_0x1d05e2>0x0&&(_0x453460+='\x20'+_0x7f774a[_0xd54b('0x85')]+'\x20');_0x453460+=_0x7f774a['rules'][_0x1d05e2][_0xd54b('0x68')]?_0x15910d(_0x7f774a[_0xd54b('0x67')][_0x1d05e2][_0xd54b('0x68')]):_0x7f774a[_0xd54b('0x67')][_0x1d05e2][_0xd54b('0x42')]+'\x20'+_0x7f774a[_0xd54b('0x67')][_0x1d05e2][_0xd54b('0x86')]+(_0x316e2e(_0x7f774a[_0xd54b('0x67')][_0x1d05e2][_0xd54b('0x86')])?'\x20'+_0x7f774a[_0xd54b('0x67')][_0x1d05e2][_0xd54b('0x87')]:'');}return _0x453460+')';};var _0x364bf7={'where':{'id':_0x5672c2['id']}},_0xbd1336,_0x80ceb1,_0x4f2fb1,_0x3d2a1b,_0x3f552d;_0x364bf7=_[_0xd54b('0x3f')]({},_0x364bf7,_0x4cb674);return db[_0xd54b('0x43')]['find'](_0x364bf7)[_0xd54b('0x27')](function(_0x5803ec){if(_0x5803ec){_0xbd1336=_0x5803ec;return _0x5803ec[_0xd54b('0x88')]();}return null;})['then'](function(_0x4c6a4d){if(_0x4c6a4d){if(!_0x4c6a4d[_0xd54b('0x36')]){throw new db[(_0xd54b('0x89'))][(_0xd54b('0x6a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x80ceb1=_0x4c6a4d;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xd54b('0x27')](function(_0x437d60){if(_0x437d60){_0x4f2fb1=_['keyBy'](_0x437d60,'id');var _0x5daafd;var _0x1bded2=squel[_0xd54b('0x6c')]();_0x1bded2[_0xd54b('0x6d')](_0xbd1336[_0xd54b('0x6e')]);for(var _0x2f2811=0x0;_0x2f2811<_0x80ceb1[_0xd54b('0x36')];_0x2f2811+=0x1){_0x5daafd=_0x80ceb1[_0x2f2811][_0xd54b('0x6f')]?_0x4f2fb1[_0x80ceb1[_0x2f2811][_0xd54b('0x6f')]][_0xd54b('0x8a')]:_0x80ceb1[_0x2f2811][_0xd54b('0x42')];_0x5daafd=_0x80ceb1[_0x2f2811]['function']?_[_0xd54b('0x72')](_0x2baf59[_0x80ceb1[_0x2f2811][_0xd54b('0x70')]],'%s',_0x5daafd):_0x5daafd;_0x5daafd=_0x80ceb1[_0x2f2811]['format']?_[_0xd54b('0x72')](_0x294293[_0x80ceb1[_0x2f2811][_0xd54b('0x71')]],'%s',_0x5daafd):_0x5daafd;if(_0x80ceb1[_0x2f2811][_0xd54b('0x8b')]){_0x1bded2['group'](_0x5daafd);}_0x80ceb1[_0x2f2811][_0xd54b('0x73')]&&_0x1bded2[_0xd54b('0x3a')](_0x5daafd,_0x80ceb1[_0x2f2811][_0xd54b('0x73')]===_0xd54b('0x74')?![]:!![]);_0x1bded2[_0xd54b('0x42')](_0x5daafd,_0x80ceb1[_0x2f2811][_0xd54b('0x75')]||_0x5daafd);}if(_0xbd1336['joins']){_0xbd1336[_0xd54b('0x76')]=JSON['parse'](_0xbd1336[_0xd54b('0x76')]);for(var _0xa63687=0x0;_0xa63687<_0xbd1336[_0xd54b('0x76')][_0xd54b('0x36')];_0xa63687+=0x1){if(_0xbd1336[_0xd54b('0x76')][_0xa63687]['type']&&_[_0xd54b('0x63')](_0x10df51,_0xbd1336['joins'][_0xa63687][_0xd54b('0x78')])&&_0xbd1336[_0xd54b('0x76')][_0xa63687][_0xd54b('0x79')]&&_0xbd1336[_0xd54b('0x76')][_0xa63687][_0xd54b('0x7a')]&&_0xbd1336[_0xd54b('0x76')][_0xa63687][_0xd54b('0x7b')]){_0x1bded2[_0xbd1336['joins'][_0xa63687]['type']](_0xbd1336[_0xd54b('0x76')][_0xa63687][_0xd54b('0x7a')],null,util[_0xd54b('0x71')](_0xd54b('0x8c'),_0xbd1336[_0xd54b('0x6e')],_0xbd1336[_0xd54b('0x76')][_0xa63687][_0xd54b('0x79')],_0xbd1336[_0xd54b('0x76')][_0xa63687][_0xd54b('0x7a')],_0xbd1336[_0xd54b('0x76')][_0xa63687][_0xd54b('0x7b')]));}}}if(_0xbd1336[_0xd54b('0x7c')]){_0xbd1336[_0xd54b('0x7c')]=JSON['parse'](_0xbd1336[_0xd54b('0x7c')]);_0x1bded2[_0xd54b('0x3c')](_0x15910d(_0xbd1336[_0xd54b('0x7c')][_0xd54b('0x68')]));}_0x3f552d=_0x1bded2[_0xd54b('0x8d')]();_0x1bded2[_0xd54b('0x39')](_0x568b00);_0x1bded2[_0xd54b('0x1b')](0x0);logger[_0xd54b('0x7d')]('Limited\x20Query:',_0x1bded2[_0xd54b('0x7f')]());return db[_0xd54b('0x80')][_0xd54b('0x30')](_0x1bded2[_0xd54b('0x7f')](),{'type':db[_0xd54b('0x80')][_0xd54b('0x81')][_0xd54b('0x82')]});}})['then'](function(_0x2d3e2f){if(!_0x2d3e2f[_0xd54b('0x36')]){throw new db[(_0xd54b('0x89'))][(_0xd54b('0x6a'))](_0xd54b('0x8e'),0xcc);}if(_0x58e652[_0xd54b('0x8f')]===_0xd54b('0x90')){return null;}var _0xeadd2f=_[_0xd54b('0x3f')](_0x58e652,{'name':_0x58e652[_0xd54b('0x91')]||_0x58e652[_0xd54b('0x2b')]||_0xbd1336[_0xd54b('0x2b')],'basename':_0x28bff1,'savename':util['format'](_0xd54b('0x92'),_0x58e652[_0xd54b('0x2b')]||_0xbd1336[_0xd54b('0x2b')],require('randomstring')[_0xd54b('0x93')](0x4),_0x58e652[_0xd54b('0x8f')]||_0xd54b('0x94')),'reportId':_0xbd1336['id'],'reportType':_0xd54b('0x95')});return db[_0xd54b('0x96')][_0xd54b('0x51')](_0xeadd2f,{'raw':!![]});})[_0xd54b('0x27')](function(_0x5c621e){if(_0xbd1336[_0xd54b('0x6e')]===_0xd54b('0x97')){_0x3f552d[_0xd54b('0x3c')](_0xbd1336[_0xd54b('0x6e')]+_0xd54b('0x98'),_0x58e652[_0xd54b('0x99')],_0x58e652[_0xd54b('0x9a')]);}else{_0x3f552d['where'](_0xbd1336[_0xd54b('0x6e')]+_0xd54b('0x9b'),_0x58e652[_0xd54b('0x99')],_0x58e652[_0xd54b('0x9a')]);}if(_0x5c621e){logger['info'](_0xd54b('0x9c'),_0x3f552d[_0xd54b('0x7f')]());require(_0xd54b('0x9d'))[_0xd54b('0x9e')](path[_0xd54b('0x54')](__dirname,'../../components/export/',_0x5c621e[_0xd54b('0x8f')]),[_0x5c621e['id'],_0x3f552d[_0xd54b('0x7f')](),path[_0xd54b('0x54')](__dirname,_0xd54b('0x9f'),_0x5c621e['savename']),_0x28bff1]);return _0x5c621e;}else{var _0x396a78=squel['select']();_0x396a78[_0xd54b('0x6d')]('('+_0x3f552d[_0xd54b('0x7f')]()+')',_0xd54b('0xa0'));_0x396a78[_0xd54b('0x42')]('COUNT(*)','count');_0x3f552d['limit'](_0x58e652[_0xd54b('0x39')]||_0x568b00);_0x3f552d[_0xd54b('0x1b')](_0x58e652[_0xd54b('0x1b')]||0x0);return db[_0xd54b('0x80')]['query'](_0x396a78[_0xd54b('0x7f')](),{'type':db[_0xd54b('0x80')][_0xd54b('0x81')]['SELECT']})[_0xd54b('0x27')](function(_0x346475){if(!_0x346475[_0xd54b('0x36')]){_0x3d2a1b=0x0;}else{_0x3d2a1b=_0x346475[0x0]['count']||0x0;}return db[_0xd54b('0x80')][_0xd54b('0x30')](_0x3f552d[_0xd54b('0x7f')](),{'type':db['sequelize']['QueryTypes'][_0xd54b('0x82')]});})[_0xd54b('0x27')](function(_0xa9e3c3){return{'rows':_0xa9e3c3||[],'count':_0x3d2a1b};});}});}exports[_0xd54b('0xa1')]=function(_0x182754,_0x370b32){return runReport(_0x182754[_0xd54b('0x49')],_0x182754['query'],_0x182754['options'])['then'](respondWithResult(_0x370b32,null))['catch'](handleError(_0x370b32,null));};exports['runReport']=runReport;exports[_0xd54b('0x30')]=function(_0x37b4f3,_0x4a3dd9){var _0x19eb9d=0xa;var _0x1c2a2f=[_0xd54b('0x54'),_0xd54b('0x55'),'right_join','cross_join'];var _0x3ac93b={'SUM':'SUM(%s)','COUNT':_0xd54b('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd54b('0x5b'),'MIN':_0xd54b('0x83'),'AVG':_0xd54b('0x5c'),'GROUP_CONCAT':_0xd54b('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xa29294={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd54b('0x60'),'HOUR':_0xd54b('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xd54b('0x62')};var _0x344860=function(_0x515404){return!_['includes']([_0xd54b('0x64'),_0xd54b('0x84'),_0xd54b('0x65'),_0xd54b('0x66')],_0x515404);};var _0x562549=function(_0x1bd29a){if(!_0x1bd29a||!_0x1bd29a['rules'][_0xd54b('0x36')]){return'';}for(var _0x9cfa42='(',_0x580f1a=0x0;_0x580f1a<_0x1bd29a[_0xd54b('0x67')][_0xd54b('0x36')];_0x580f1a+=0x1){_0x580f1a>0x0&&(_0x9cfa42+='\x20'+_0x1bd29a[_0xd54b('0x85')]+'\x20');_0x9cfa42+=_0x1bd29a[_0xd54b('0x67')][_0x580f1a][_0xd54b('0x68')]?_0x562549(_0x1bd29a['rules'][_0x580f1a][_0xd54b('0x68')]):_0x1bd29a[_0xd54b('0x67')][_0x580f1a][_0xd54b('0x42')]+'\x20'+_0x1bd29a[_0xd54b('0x67')][_0x580f1a][_0xd54b('0x86')]+(_0x344860(_0x1bd29a[_0xd54b('0x67')][_0x580f1a][_0xd54b('0x86')])?'\x20'+_0x1bd29a[_0xd54b('0x67')][_0x580f1a][_0xd54b('0x87')]:'');}return _0x9cfa42+')';};var _0x5916ee={'where':{'id':_0x37b4f3[_0xd54b('0x49')]['id']}},_0x699224,_0x19cfc0,_0x19b4fb,_0x38e710,_0x18b93c;_0x5916ee=_[_0xd54b('0x3f')]({},_0x5916ee,_0x37b4f3['options']);return db[_0xd54b('0x43')][_0xd54b('0x4a')](_0x5916ee)[_0xd54b('0x27')](function(_0xc8a20f){if(_0xc8a20f){_0x699224=_0xc8a20f;return _0xc8a20f[_0xd54b('0x88')]();}return null;})['then'](function(_0x1b6af7){if(_0x1b6af7){if(!_0x1b6af7['length']){throw new db['Sequelize'][(_0xd54b('0x6a'))](_0xd54b('0xa2'),0x193);}_0x19cfc0=_0x1b6af7;return db[_0xd54b('0xa3')][_0xd54b('0xa4')]({'raw':!![]});}return null;})[_0xd54b('0x27')](function(_0x42e309){if(_0x42e309){_0x19b4fb=_[_0xd54b('0x6b')](_0x42e309,'id');var _0x110b3b;var _0x4af2d1=squel[_0xd54b('0x6c')]();_0x4af2d1[_0xd54b('0x6d')](_0x699224[_0xd54b('0x6e')]);for(var _0x465448=0x0;_0x465448<_0x19cfc0[_0xd54b('0x36')];_0x465448+=0x1){_0x110b3b=_0x19cfc0[_0x465448][_0xd54b('0x6f')]?_0x19b4fb[_0x19cfc0[_0x465448][_0xd54b('0x6f')]]['metric']:_0x19cfc0[_0x465448][_0xd54b('0x42')];_0x110b3b=_0x19cfc0[_0x465448][_0xd54b('0x70')]?_[_0xd54b('0x72')](_0x3ac93b[_0x19cfc0[_0x465448][_0xd54b('0x70')]],'%s',_0x110b3b):_0x110b3b;_0x110b3b=_0x19cfc0[_0x465448]['format']?_[_0xd54b('0x72')](_0xa29294[_0x19cfc0[_0x465448][_0xd54b('0x71')]],'%s',_0x110b3b):_0x110b3b;if(_0x19cfc0[_0x465448][_0xd54b('0x8b')]){_0x4af2d1[_0xd54b('0x68')](_0x110b3b);}_0x19cfc0[_0x465448][_0xd54b('0x73')]&&_0x4af2d1[_0xd54b('0x3a')](_0x110b3b,_0x19cfc0[_0x465448]['orderBy']===_0xd54b('0x74')?![]:!![]);_0x4af2d1['field'](_0x110b3b,_0x19cfc0[_0x465448][_0xd54b('0x75')]||_0x110b3b);}if(_0x699224[_0xd54b('0x76')]){_0x699224[_0xd54b('0x76')]=JSON[_0xd54b('0x77')](_0x699224[_0xd54b('0x76')]);for(var _0x20ca13=0x0;_0x20ca13<_0x699224[_0xd54b('0x76')][_0xd54b('0x36')];_0x20ca13+=0x1){if(_0x699224[_0xd54b('0x76')][_0x20ca13][_0xd54b('0x78')]&&_[_0xd54b('0x63')](_0x1c2a2f,_0x699224[_0xd54b('0x76')][_0x20ca13][_0xd54b('0x78')])&&_0x699224[_0xd54b('0x76')][_0x20ca13][_0xd54b('0x79')]&&_0x699224[_0xd54b('0x76')][_0x20ca13]['foreignTable']&&_0x699224[_0xd54b('0x76')][_0x20ca13]['foreignKey']){_0x4af2d1[_0x699224[_0xd54b('0x76')][_0x20ca13]['type']](_0x699224[_0xd54b('0x76')][_0x20ca13][_0xd54b('0x7a')],null,util[_0xd54b('0x71')](_0xd54b('0x8c'),_0x699224[_0xd54b('0x6e')],_0x699224[_0xd54b('0x76')][_0x20ca13]['parentKey'],_0x699224[_0xd54b('0x76')][_0x20ca13]['foreignTable'],_0x699224[_0xd54b('0x76')][_0x20ca13]['foreignKey']));}}}if(_0x699224['conditions']){_0x699224['conditions']=JSON[_0xd54b('0x77')](_0x699224[_0xd54b('0x7c')]);_0x4af2d1[_0xd54b('0x3c')](_0x562549(_0x699224['conditions'][_0xd54b('0x68')]));}_0x18b93c=_0x4af2d1['clone']();_0x4af2d1[_0xd54b('0x39')](_0x19eb9d);_0x4af2d1[_0xd54b('0x1b')](0x0);logger[_0xd54b('0x7d')](_0xd54b('0x7e'),_0x4af2d1[_0xd54b('0x7f')]());return db[_0xd54b('0x80')]['query'](_0x4af2d1['toString'](),{'type':db[_0xd54b('0x80')][_0xd54b('0x81')][_0xd54b('0x82')]});}})[_0xd54b('0x27')](function(){return{'sql':_0x18b93c['toString']()};})[_0xd54b('0x27')](respondWithResult(_0x4a3dd9,null))['catch'](handleError(_0x4a3dd9,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index a72eaf4..c272595 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 _0xa089=['define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','bluebird','request-promise','./analyticDefaultReport.attributes','exports'];(function(_0x41fc84,_0x21ba0a){var _0x511e01=function(_0x120406){while(--_0x120406){_0x41fc84['push'](_0x41fc84['shift']());}};_0x511e01(++_0x21ba0a);}(_0xa089,0x1e7));var _0x9a08=function(_0x35dea9,_0x5adbbc){_0x35dea9=_0x35dea9-0x0;var _0xc6b2f=_0xa089[_0x35dea9];return _0xc6b2f;};'use strict';var _=require(_0x9a08('0x0'));var util=require(_0x9a08('0x1'));var logger=require(_0x9a08('0x2'))(_0x9a08('0x3'));var moment=require('moment');var BPromise=require(_0x9a08('0x4'));var rp=require(_0x9a08('0x5'));var attributes=require(_0x9a08('0x6'));module[_0x9a08('0x7')]=function(_0x4ea4f5,_0x196454){return _0x4ea4f5[_0x9a08('0x8')](_0x9a08('0x9'),attributes,{'tableName':_0x9a08('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9b0=['bluebird','request-promise','./analyticDefaultReport.attributes','exports','analytics_default_reports','lodash','../../config/logger','api','moment'];(function(_0x358b8b,_0x2ac041){var _0x595e97=function(_0x293824){while(--_0x293824){_0x358b8b['push'](_0x358b8b['shift']());}};_0x595e97(++_0x2ac041);}(_0xa9b0,0x1d0));var _0x0a9b=function(_0x40b2ed,_0x2b1765){_0x40b2ed=_0x40b2ed-0x0;var _0x18397d=_0xa9b0[_0x40b2ed];return _0x18397d;};'use strict';var _=require(_0x0a9b('0x0'));var util=require('util');var logger=require(_0x0a9b('0x1'))(_0x0a9b('0x2'));var moment=require(_0x0a9b('0x3'));var BPromise=require(_0x0a9b('0x4'));var rp=require(_0x0a9b('0x5'));var attributes=require(_0x0a9b('0x6'));module[_0x0a9b('0x7')]=function(_0x2d342e,_0x2f3b33){return _0x2d342e['define']('AnalyticDefaultReport',attributes,{'tableName':_0x0a9b('0x8'),'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 47e419c..8dca1c5 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 _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','catch','util'];(function(_0x491116,_0x241ab8){var _0x1a7da5=function(_0x4353ac){while(--_0x4353ac){_0x491116['push'](_0x491116['shift']());}};_0x1a7da5(++_0x241ab8);}(_0xedd9,0xfc));var _0x9edd=function(_0x4ecb3c,_0x173145){_0x4ecb3c=_0x4ecb3c-0x0;var _0x539874=_0xedd9[_0x4ecb3c];return _0x539874;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file +var _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0xd9d6e6,_0x487376){var _0xac3fec=function(_0x1432db){while(--_0x1432db){_0xd9d6e6['push'](_0xd9d6e6['shift']());}};_0xac3fec(++_0x487376);}(_0x54ef,0x112));var _0xf54e=function(_0x6d9720,_0x3dd023){_0x6d9720=_0x6d9720-0x0;var _0x29b0e1=_0x54ef[_0x6d9720];return _0x29b0e1;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index c6a2c0c..44f21b0 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 _0xa4f6=['express','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','destroy','multer','util','path','connect-timeout'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xa4f6,0x194));var _0x6a4f=function(_0x4e6810,_0x5aff26){_0x4e6810=_0x4e6810-0x0;var _0x5187b8=_0xa4f6[_0x4e6810];return _0x5187b8;};'use strict';var multer=require(_0x6a4f('0x0'));var util=require(_0x6a4f('0x1'));var path=require(_0x6a4f('0x2'));var timeout=require(_0x6a4f('0x3'));var express=require(_0x6a4f('0x4'));var router=express['Router']();var auth=require(_0x6a4f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6a4f('0x6'));var controller=require(_0x6a4f('0x7'));router[_0x6a4f('0x8')]('/',auth[_0x6a4f('0x9')](),controller[_0x6a4f('0xa')]);router['get'](_0x6a4f('0xb'),auth['isAuthenticated'](),controller[_0x6a4f('0xc')]);router['get'](_0x6a4f('0xd'),auth[_0x6a4f('0x9')](),controller[_0x6a4f('0xe')]);router[_0x6a4f('0x8')](_0x6a4f('0xf'),auth[_0x6a4f('0x9')](),controller[_0x6a4f('0x10')]);router['get'](_0x6a4f('0x11'),auth[_0x6a4f('0x9')](),controller[_0x6a4f('0x12')]);router[_0x6a4f('0x13')]('/',auth[_0x6a4f('0x9')](),controller[_0x6a4f('0x14')]);router[_0x6a4f('0x15')](_0x6a4f('0xb'),auth[_0x6a4f('0x9')](),controller[_0x6a4f('0x16')]);router['delete'](_0x6a4f('0xb'),auth['isAuthenticated'](),controller[_0x6a4f('0x17')]);module['exports']=router; \ No newline at end of file +var _0xc78f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','query','post','put','update','destroy','multer','util','connect-timeout','express'];(function(_0x4db549,_0x307907){var _0x4a8493=function(_0x2aef74){while(--_0x2aef74){_0x4db549['push'](_0x4db549['shift']());}};_0x4a8493(++_0x307907);}(_0xc78f,0x10d));var _0xfc78=function(_0x3129d6,_0x49a78a){_0x3129d6=_0x3129d6-0x0;var _0x47352e=_0xc78f[_0x3129d6];return _0x47352e;};'use strict';var multer=require(_0xfc78('0x0'));var util=require(_0xfc78('0x1'));var path=require('path');var timeout=require(_0xfc78('0x2'));var express=require(_0xfc78('0x3'));var router=express['Router']();var auth=require(_0xfc78('0x4'));var interaction=require(_0xfc78('0x5'));var config=require(_0xfc78('0x6'));var controller=require(_0xfc78('0x7'));router[_0xfc78('0x8')]('/',auth[_0xfc78('0x9')](),controller[_0xfc78('0xa')]);router[_0xfc78('0x8')](_0xfc78('0xb'),auth[_0xfc78('0x9')](),controller['show']);router[_0xfc78('0x8')](_0xfc78('0xc'),auth[_0xfc78('0x9')](),controller[_0xfc78('0xd')]);router[_0xfc78('0x8')](_0xfc78('0xe'),auth[_0xfc78('0x9')](),controller[_0xfc78('0xf')]);router[_0xfc78('0x8')]('/:id/query',auth['isAuthenticated'](),controller[_0xfc78('0x10')]);router[_0xfc78('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfc78('0x12')](_0xfc78('0xb'),auth[_0xfc78('0x9')](),controller[_0xfc78('0x13')]);router['delete']('/:id',auth[_0xfc78('0x9')](),controller[_0xfc78('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 7f85e40..ad09378 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 _0x0e33=['INTEGER','UNSIGNED','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','manual','scheduled'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0e33,0x176));var _0x30e3=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0e33[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x30e3('0x0'));module[_0x30e3('0x1')]={'name':{'type':Sequelize[_0x30e3('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x30e3('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x30e3('0x3')](_0x30e3('0x4'),_0x30e3('0x5'),_0x30e3('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x30e3('0x7')]},'status':{'type':Sequelize[_0x30e3('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x30e3('0x3')](_0x30e3('0x8'),_0x30e3('0x9')),'allowNull':![],'defaultValue':_0x30e3('0x8')},'reportId':{'type':Sequelize[_0x30e3('0xa')](0xb)[_0x30e3('0xb')]},'reportType':{'type':Sequelize[_0x30e3('0x2')]}}; \ No newline at end of file +var _0xc5cb=['manual','scheduled','INTEGER','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE'];(function(_0x122237,_0x47d5e6){var _0x1dcac1=function(_0x516d15){while(--_0x516d15){_0x122237['push'](_0x122237['shift']());}};_0x1dcac1(++_0x47d5e6);}(_0xc5cb,0x9f));var _0xbc5c=function(_0x57ca46,_0x510392){_0x57ca46=_0x57ca46-0x0;var _0x5e42da=_0xc5cb[_0x57ca46];return _0x5e42da;};'use strict';var Sequelize=require(_0xbc5c('0x0'));var moment=require(_0xbc5c('0x1'));module[_0xbc5c('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xbc5c('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xbc5c('0x4')](_0xbc5c('0x5'),_0xbc5c('0x6'),_0xbc5c('0x7')),'allowNull':![],'defaultValue':_0xbc5c('0x5')},'savename':{'type':Sequelize[_0xbc5c('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xbc5c('0x8')]},'endDate':{'type':Sequelize[_0xbc5c('0x8')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xbc5c('0x4')](_0xbc5c('0x9'),_0xbc5c('0xa')),'allowNull':![],'defaultValue':_0xbc5c('0x9')},'reportId':{'type':Sequelize[_0xbc5c('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 1bbef85..dbea6ba 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 _0x94ce=['output','existsSync','root','server/files/reports','Sequelize','ValidationError','exists','join','%s.%s','toLowerCase','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','Content-Range','reject','save','update','then','get','ExtractedReports','UserProfileResource','end','sendStatus','stack','name','send','index','AnalyticExtractedReport','rawAttributes','model','keys','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','key','field','includeAll','include','findAll','rows','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename'];(function(_0x61d9d7,_0x38fdb4){var _0x2bf78d=function(_0x5aa803){while(--_0x5aa803){_0x61d9d7['push'](_0x61d9d7['shift']());}};_0x2bf78d(++_0x38fdb4);}(_0x94ce,0x182));var _0xe94c=function(_0x139b32,_0x43cce7){_0x139b32=_0x139b32-0x0;var _0x267588=_0x94ce[_0x139b32];return _0x267588;};'use strict';var pdf=require(_0xe94c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe94c('0x1'));var zipdir=require(_0xe94c('0x2'));var jsonpatch=require(_0xe94c('0x3'));var rp=require('request-promise');var moment=require(_0xe94c('0x4'));var BPromise=require(_0xe94c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe94c('0x6'));var sox=require(_0xe94c('0x7'));var csv=require(_0xe94c('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe94c('0x9'));var squel=require(_0xe94c('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe94c('0xb'));var toCsv=require(_0xe94c('0x8'));var querystring=require(_0xe94c('0xc'));var Papa=require(_0xe94c('0xd'));var authService=require(_0xe94c('0xe'));var hardwareService=require(_0xe94c('0xf'));var Redis=require(_0xe94c('0x10'));var qs=require(_0xe94c('0x11'));var logger=require(_0xe94c('0x12'))(_0xe94c('0x13'));var utils=require(_0xe94c('0x14'));var config=require(_0xe94c('0x15'));var db=require(_0xe94c('0x16'))['db'];function respondWithStatusCode(_0x25c8af,_0x44e4c4){_0x44e4c4=_0x44e4c4||0xcc;return function(_0x5ad4b1){if(_0x5ad4b1){return _0x25c8af['sendStatus'](_0x44e4c4);}return _0x25c8af[_0xe94c('0x17')](_0x44e4c4)['end']();};}function respondWithResult(_0x40ebe0,_0x2cbf41){_0x2cbf41=_0x2cbf41||0xc8;return function(_0x53ef5d){if(_0x53ef5d){return _0x40ebe0[_0xe94c('0x17')](_0x2cbf41)[_0xe94c('0x18')](_0x53ef5d);}};}function respondWithFilteredResult(_0x2176f7,_0x9bab69){return function(_0x330a9b){if(_0x330a9b){var _0x59b8a7=_0x330a9b[_0xe94c('0x19')],_0x7847e3=_0x9bab69[_0xe94c('0x1a')],_0x4140cb=_0x9bab69['offset']+_0x9bab69[_0xe94c('0x1b')],_0x42e6ab;if(_0x4140cb>=_0x59b8a7){_0x4140cb=_0x59b8a7;_0x42e6ab=0xc8;}else{_0x42e6ab=0xce;}_0x2176f7[_0xe94c('0x17')](_0x42e6ab);return _0x2176f7['set'](_0xe94c('0x1c'),_0x7847e3+'-'+_0x4140cb+'/'+_0x59b8a7)[_0xe94c('0x18')](_0x330a9b);}return null;};}function patchUpdates(_0x237d5b){return function(_0x4c21b9){try{jsonpatch['apply'](_0x4c21b9,_0x237d5b,!![]);}catch(_0x3b1f85){return BPromise[_0xe94c('0x1d')](_0x3b1f85);}return _0x4c21b9[_0xe94c('0x1e')]();};}function saveUpdates(_0x4f1811,_0x3a8a46){return function(_0x24cbde){if(_0x24cbde){return _0x24cbde[_0xe94c('0x1f')](_0x4f1811)[_0xe94c('0x20')](function(_0x87f702){return _0x87f702;});}return null;};}function removeEntity(_0x2fd0b4,_0x24de97){return function(_0x31b793){if(_0x31b793){return _0x31b793['destroy']()[_0xe94c('0x20')](function(){var _0x451fb8=_0x31b793[_0xe94c('0x21')]({'plain':!![]});var _0x18a942=_0xe94c('0x22');return db[_0xe94c('0x23')]['destroy']({'where':{'type':_0x18a942,'resourceId':_0x451fb8['id']}})[_0xe94c('0x20')](function(){return _0x31b793;});})[_0xe94c('0x20')](function(){_0x2fd0b4['status'](0xcc)[_0xe94c('0x24')]();});}};}function handleEntityNotFound(_0x384bfb,_0x95e1ac){return function(_0x50394a){if(!_0x50394a){_0x384bfb[_0xe94c('0x25')](0x194);}return _0x50394a;};}function handleError(_0x303ed1,_0x5a24da){_0x5a24da=_0x5a24da||0x1f4;return function(_0x5cb455){logger['error'](_0x5cb455[_0xe94c('0x26')]);if(_0x5cb455['name']){delete _0x5cb455[_0xe94c('0x27')];}_0x303ed1['status'](_0x5a24da)[_0xe94c('0x28')](_0x5cb455);};}exports[_0xe94c('0x29')]=function(_0x303c7,_0x2d07f2){var _0xc80174={},_0x4cbe66={},_0x3f9035={'count':0x0,'rows':[]};var _0x266637=db[_0xe94c('0x2a')][_0xe94c('0x2b')];_0x4cbe66[_0xe94c('0x2c')]=_['keys'](_0x266637);_0x4cbe66['query']=_[_0xe94c('0x2d')](_0x303c7['query']);_0x4cbe66[_0xe94c('0x2e')]=_[_0xe94c('0x2f')](_0x4cbe66['model'],_0x4cbe66['query']);_0xc80174[_0xe94c('0x30')]=_[_0xe94c('0x2f')](_0x4cbe66[_0xe94c('0x2c')],qs['fields'](_0x303c7[_0xe94c('0x31')][_0xe94c('0x32')]));_0xc80174[_0xe94c('0x30')]=_0xc80174['attributes'][_0xe94c('0x33')]?_0xc80174[_0xe94c('0x30')]:_0x4cbe66[_0xe94c('0x2c')];if(!_0x303c7[_0xe94c('0x31')][_0xe94c('0x34')](_0xe94c('0x35'))){_0xc80174[_0xe94c('0x1b')]=qs[_0xe94c('0x1b')](_0x303c7[_0xe94c('0x31')]['limit']);_0xc80174[_0xe94c('0x1a')]=qs[_0xe94c('0x1a')](_0x303c7['query'][_0xe94c('0x1a')]);}_0xc80174[_0xe94c('0x36')]=qs[_0xe94c('0x37')](_0x303c7[_0xe94c('0x31')][_0xe94c('0x37')]);_0xc80174[_0xe94c('0x38')]=qs[_0xe94c('0x2e')](_[_0xe94c('0x39')](_0x303c7[_0xe94c('0x31')],_0x4cbe66[_0xe94c('0x2e')]));if(_0x303c7[_0xe94c('0x31')][_0xe94c('0x3a')]){_0xc80174[_0xe94c('0x38')]=_[_0xe94c('0x3b')](_0xc80174[_0xe94c('0x38')],{'$or':_[_0xe94c('0x3c')](_0x266637,function(_0x144a6b){if(_0x144a6b['type'][_0xe94c('0x3d')]!=='VIRTUAL'){var _0x382b8d={};_0x382b8d[_0x144a6b[_0xe94c('0x3e')]]={'$like':'%'+_0x303c7[_0xe94c('0x31')]['filter']+'%'};return _0x382b8d;}})});}_0xc80174=_['merge']({},_0xc80174,_0x303c7['options']);var _0x163fe9={'where':_0xc80174[_0xe94c('0x38')]};return db['AnalyticExtractedReport']['count'](_0x163fe9)[_0xe94c('0x20')](function(_0x13d1d0){_0x3f9035[_0xe94c('0x19')]=_0x13d1d0;if(_0x303c7[_0xe94c('0x31')][_0xe94c('0x3f')]){_0xc80174[_0xe94c('0x40')]=[{'all':!![]}];}return db[_0xe94c('0x2a')][_0xe94c('0x41')](_0xc80174);})[_0xe94c('0x20')](function(_0x55e4f1){_0x3f9035[_0xe94c('0x42')]=_0x55e4f1;return _0x3f9035;})['then'](respondWithFilteredResult(_0x2d07f2,_0xc80174))['catch'](handleError(_0x2d07f2,null));};exports[_0xe94c('0x43')]=function(_0x2cf677,_0xdbd494){var _0x326697={'raw':!![],'where':{'id':_0x2cf677[_0xe94c('0x44')]['id']}},_0x178e5e={};_0x178e5e[_0xe94c('0x2c')]=_[_0xe94c('0x2d')](db[_0xe94c('0x2a')]['rawAttributes']);_0x178e5e['query']=_['keys'](_0x2cf677['query']);_0x178e5e['filters']=_[_0xe94c('0x2f')](_0x178e5e[_0xe94c('0x2c')],_0x178e5e['query']);_0x326697['attributes']=_[_0xe94c('0x2f')](_0x178e5e[_0xe94c('0x2c')],qs[_0xe94c('0x32')](_0x2cf677[_0xe94c('0x31')]['fields']));_0x326697[_0xe94c('0x30')]=_0x326697['attributes'][_0xe94c('0x33')]?_0x326697[_0xe94c('0x30')]:_0x178e5e[_0xe94c('0x2c')];if(_0x2cf677[_0xe94c('0x31')][_0xe94c('0x3f')]){_0x326697['include']=[{'all':!![]}];}_0x326697=_[_0xe94c('0x3b')]({},_0x326697,_0x2cf677['options']);return db[_0xe94c('0x2a')]['find'](_0x326697)[_0xe94c('0x20')](handleEntityNotFound(_0xdbd494,null))[_0xe94c('0x20')](respondWithResult(_0xdbd494,null))['catch'](handleError(_0xdbd494,null));};exports[_0xe94c('0x45')]=function(_0x26a29e,_0x5e0b61){return db[_0xe94c('0x2a')][_0xe94c('0x45')](_0x26a29e[_0xe94c('0x46')],{})['then'](function(_0x21b8c6){var _0x5eb7d6=_0x26a29e['user'][_0xe94c('0x21')]({'plain':!![]});if(!_0x5eb7d6)throw new Error(_0xe94c('0x47'));if(_0x5eb7d6[_0xe94c('0x48')]===_0xe94c('0x49')){var _0x5f334d=_0x21b8c6[_0xe94c('0x21')]({'plain':!![]});var _0x1e326b='ExtractedReports';return db[_0xe94c('0x4a')][_0xe94c('0x4b')]({'where':{'name':_0x1e326b,'userProfileId':_0x5eb7d6[_0xe94c('0x4c')]},'raw':!![]})[_0xe94c('0x20')](function(_0x116b42){if(_0x116b42&&_0x116b42[_0xe94c('0x4d')]===0x0){return db[_0xe94c('0x23')]['create']({'name':_0x5f334d[_0xe94c('0x27')],'resourceId':_0x5f334d['id'],'type':_0x116b42['name'],'sectionId':_0x116b42['id']},{})[_0xe94c('0x20')](function(){return _0x21b8c6;});}else{return _0x21b8c6;}})[_0xe94c('0x4e')](function(_0x1a3f50){logger[_0xe94c('0x4f')](_0xe94c('0x50'),_0x1a3f50);throw _0x1a3f50;});}return _0x21b8c6;})[_0xe94c('0x20')](respondWithResult(_0x5e0b61,0xc9))[_0xe94c('0x4e')](handleError(_0x5e0b61,null));};exports[_0xe94c('0x1f')]=function(_0x52c049,_0x1d0087){if(_0x52c049[_0xe94c('0x46')]['id']){delete _0x52c049[_0xe94c('0x46')]['id'];}return db[_0xe94c('0x2a')][_0xe94c('0x4b')]({'where':{'id':_0x52c049['params']['id']}})[_0xe94c('0x20')](handleEntityNotFound(_0x1d0087,null))[_0xe94c('0x20')](saveUpdates(_0x52c049[_0xe94c('0x46')],null))[_0xe94c('0x20')](respondWithResult(_0x1d0087,null))[_0xe94c('0x4e')](handleError(_0x1d0087,null));};exports['destroy']=function(_0x1f4a01,_0x130c49){return db[_0xe94c('0x2a')][_0xe94c('0x4b')]({'where':{'id':_0x1f4a01['params']['id']}})['then'](handleEntityNotFound(_0x130c49,null))[_0xe94c('0x20')](removeEntity(_0x130c49,null))['catch'](handleError(_0x130c49,null));};exports[_0xe94c('0x51')]=function(_0x130570,_0x4cfdb5,_0x2e2857){return db[_0xe94c('0x2a')]['find']({'where':{'id':_0x130570[_0xe94c('0x44')]['id']},'attributes':['name',_0xe94c('0x52'),_0xe94c('0x53'),_0xe94c('0x54')],'raw':!![]})[_0xe94c('0x20')](handleEntityNotFound(_0x4cfdb5,null))['then'](function(_0x582a0c){if(_0x582a0c){if(!fs[_0xe94c('0x55')](path['join'](config[_0xe94c('0x56')],_0xe94c('0x57'),_0x582a0c['savename']))){throw new db[(_0xe94c('0x58'))][(_0xe94c('0x59'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x130570[_0xe94c('0x31')][_0xe94c('0x5a')]){return _0x4cfdb5[_0xe94c('0x25')](0xc8);}return _0x4cfdb5[_0xe94c('0x51')](path[_0xe94c('0x5b')](config[_0xe94c('0x56')],_0xe94c('0x57'),_0x582a0c[_0xe94c('0x53')]),util['format'](_0xe94c('0x5c'),_0x582a0c[_0xe94c('0x52')]||_0x582a0c[_0xe94c('0x27')],_0x582a0c['output'][_0xe94c('0x5d')]()));}})['catch'](handleError(_0x4cfdb5,null));}; \ No newline at end of file +var _0x0e9d=['download','root','format','%s.%s','basename','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','destroy','ExtractedReports','error','stack','name','send','index','AnalyticExtractedReport','rawAttributes','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','key','VIRTUAL','field','options','includeAll','include','findAll','show','params','keys','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','savename','output','existsSync','join','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists'];(function(_0x4afc22,_0x4c334e){var _0x108da5=function(_0x175922){while(--_0x175922){_0x4afc22['push'](_0x4afc22['shift']());}};_0x108da5(++_0x4c334e);}(_0x0e9d,0x65));var _0xd0e9=function(_0x27ba6e,_0x4eaf91){_0x27ba6e=_0x27ba6e-0x0;var _0x3e0a74=_0x0e9d[_0x27ba6e];return _0x3e0a74;};'use strict';var pdf=require(_0xd0e9('0x0'));var emlformat=require(_0xd0e9('0x1'));var rimraf=require(_0xd0e9('0x2'));var zipdir=require(_0xd0e9('0x3'));var jsonpatch=require(_0xd0e9('0x4'));var rp=require('request-promise');var moment=require(_0xd0e9('0x5'));var BPromise=require(_0xd0e9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd0e9('0x7'));var sox=require('sox');var csv=require(_0xd0e9('0x8'));var ejs=require(_0xd0e9('0x9'));var fs=require('fs');var _=require(_0xd0e9('0xa'));var squel=require(_0xd0e9('0xb'));var crypto=require(_0xd0e9('0xc'));var jsforce=require(_0xd0e9('0xd'));var deskjs=require(_0xd0e9('0xe'));var toCsv=require(_0xd0e9('0x8'));var querystring=require(_0xd0e9('0xf'));var Papa=require(_0xd0e9('0x10'));var authService=require(_0xd0e9('0x11'));var hardwareService=require(_0xd0e9('0x12'));var Redis=require(_0xd0e9('0x13'));var qs=require(_0xd0e9('0x14'));var logger=require(_0xd0e9('0x15'))(_0xd0e9('0x16'));var utils=require('../../config/utils');var config=require(_0xd0e9('0x17'));var db=require(_0xd0e9('0x18'))['db'];function respondWithStatusCode(_0x38d927,_0x401b86){_0x401b86=_0x401b86||0xcc;return function(_0x4f739c){if(_0x4f739c){return _0x38d927[_0xd0e9('0x19')](_0x401b86);}return _0x38d927[_0xd0e9('0x1a')](_0x401b86)[_0xd0e9('0x1b')]();};}function respondWithResult(_0x52720f,_0x446cdc){_0x446cdc=_0x446cdc||0xc8;return function(_0x958c6b){if(_0x958c6b){return _0x52720f['status'](_0x446cdc)[_0xd0e9('0x1c')](_0x958c6b);}};}function respondWithFilteredResult(_0x310e7f,_0x5b6571){return function(_0x5814a4){if(_0x5814a4){var _0x1cfc25=_0x5814a4[_0xd0e9('0x1d')],_0x1417a7=_0x5b6571['offset'],_0xcd702=_0x5b6571[_0xd0e9('0x1e')]+_0x5b6571['limit'],_0x105d77;if(_0xcd702>=_0x1cfc25){_0xcd702=_0x1cfc25;_0x105d77=0xc8;}else{_0x105d77=0xce;}_0x310e7f['status'](_0x105d77);return _0x310e7f['set'](_0xd0e9('0x1f'),_0x1417a7+'-'+_0xcd702+'/'+_0x1cfc25)[_0xd0e9('0x1c')](_0x5814a4);}return null;};}function patchUpdates(_0x3732d7){return function(_0x3eb107){try{jsonpatch[_0xd0e9('0x20')](_0x3eb107,_0x3732d7,!![]);}catch(_0x3d8a55){return BPromise[_0xd0e9('0x21')](_0x3d8a55);}return _0x3eb107[_0xd0e9('0x22')]();};}function saveUpdates(_0x380108,_0xaa99a2){return function(_0x32fa41){if(_0x32fa41){return _0x32fa41['update'](_0x380108)[_0xd0e9('0x23')](function(_0x5a0fc6){return _0x5a0fc6;});}return null;};}function removeEntity(_0x5a7bab,_0x1be0ca){return function(_0x1092fe){if(_0x1092fe){return _0x1092fe[_0xd0e9('0x24')]()[_0xd0e9('0x23')](function(){var _0x50dc95=_0x1092fe['get']({'plain':!![]});var _0x55938c=_0xd0e9('0x25');return db['UserProfileResource'][_0xd0e9('0x24')]({'where':{'type':_0x55938c,'resourceId':_0x50dc95['id']}})[_0xd0e9('0x23')](function(){return _0x1092fe;});})[_0xd0e9('0x23')](function(){_0x5a7bab[_0xd0e9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4396e2,_0x3a081b){return function(_0x3b48d2){if(!_0x3b48d2){_0x4396e2[_0xd0e9('0x19')](0x194);}return _0x3b48d2;};}function handleError(_0x24751c,_0xa459bb){_0xa459bb=_0xa459bb||0x1f4;return function(_0x1b0814){logger[_0xd0e9('0x26')](_0x1b0814[_0xd0e9('0x27')]);if(_0x1b0814[_0xd0e9('0x28')]){delete _0x1b0814[_0xd0e9('0x28')];}_0x24751c[_0xd0e9('0x1a')](_0xa459bb)[_0xd0e9('0x29')](_0x1b0814);};}exports[_0xd0e9('0x2a')]=function(_0x208b35,_0x541e36){var _0x18320e={},_0x37335a={},_0x2895c8={'count':0x0,'rows':[]};var _0x173f40=db[_0xd0e9('0x2b')][_0xd0e9('0x2c')];_0x37335a[_0xd0e9('0x2d')]=_['keys'](_0x173f40);_0x37335a[_0xd0e9('0x2e')]=_['keys'](_0x208b35['query']);_0x37335a[_0xd0e9('0x2f')]=_[_0xd0e9('0x30')](_0x37335a[_0xd0e9('0x2d')],_0x37335a[_0xd0e9('0x2e')]);_0x18320e[_0xd0e9('0x31')]=_['intersection'](_0x37335a[_0xd0e9('0x2d')],qs[_0xd0e9('0x32')](_0x208b35[_0xd0e9('0x2e')][_0xd0e9('0x32')]));_0x18320e[_0xd0e9('0x31')]=_0x18320e[_0xd0e9('0x31')]['length']?_0x18320e['attributes']:_0x37335a[_0xd0e9('0x2d')];if(!_0x208b35[_0xd0e9('0x2e')][_0xd0e9('0x33')](_0xd0e9('0x34'))){_0x18320e['limit']=qs[_0xd0e9('0x35')](_0x208b35[_0xd0e9('0x2e')][_0xd0e9('0x35')]);_0x18320e[_0xd0e9('0x1e')]=qs[_0xd0e9('0x1e')](_0x208b35[_0xd0e9('0x2e')][_0xd0e9('0x1e')]);}_0x18320e['order']=qs[_0xd0e9('0x36')](_0x208b35[_0xd0e9('0x2e')][_0xd0e9('0x36')]);_0x18320e[_0xd0e9('0x37')]=qs[_0xd0e9('0x2f')](_[_0xd0e9('0x38')](_0x208b35['query'],_0x37335a[_0xd0e9('0x2f')]));if(_0x208b35[_0xd0e9('0x2e')][_0xd0e9('0x39')]){_0x18320e[_0xd0e9('0x37')]=_[_0xd0e9('0x3a')](_0x18320e[_0xd0e9('0x37')],{'$or':_['map'](_0x173f40,function(_0x28bef9){if(_0x28bef9['type'][_0xd0e9('0x3b')]!==_0xd0e9('0x3c')){var _0x1987dd={};_0x1987dd[_0x28bef9[_0xd0e9('0x3d')]]={'$like':'%'+_0x208b35[_0xd0e9('0x2e')]['filter']+'%'};return _0x1987dd;}})});}_0x18320e=_['merge']({},_0x18320e,_0x208b35[_0xd0e9('0x3e')]);var _0x146bc3={'where':_0x18320e['where']};return db[_0xd0e9('0x2b')][_0xd0e9('0x1d')](_0x146bc3)['then'](function(_0x36534d){_0x2895c8[_0xd0e9('0x1d')]=_0x36534d;if(_0x208b35[_0xd0e9('0x2e')][_0xd0e9('0x3f')]){_0x18320e[_0xd0e9('0x40')]=[{'all':!![]}];}return db[_0xd0e9('0x2b')][_0xd0e9('0x41')](_0x18320e);})[_0xd0e9('0x23')](function(_0x362f85){_0x2895c8['rows']=_0x362f85;return _0x2895c8;})[_0xd0e9('0x23')](respondWithFilteredResult(_0x541e36,_0x18320e))['catch'](handleError(_0x541e36,null));};exports[_0xd0e9('0x42')]=function(_0x557a82,_0x5abb6b){var _0x13c2b7={'raw':!![],'where':{'id':_0x557a82[_0xd0e9('0x43')]['id']}},_0x5b1088={};_0x5b1088[_0xd0e9('0x2d')]=_['keys'](db['AnalyticExtractedReport'][_0xd0e9('0x2c')]);_0x5b1088[_0xd0e9('0x2e')]=_[_0xd0e9('0x44')](_0x557a82['query']);_0x5b1088['filters']=_[_0xd0e9('0x30')](_0x5b1088[_0xd0e9('0x2d')],_0x5b1088['query']);_0x13c2b7[_0xd0e9('0x31')]=_[_0xd0e9('0x30')](_0x5b1088[_0xd0e9('0x2d')],qs[_0xd0e9('0x32')](_0x557a82[_0xd0e9('0x2e')][_0xd0e9('0x32')]));_0x13c2b7[_0xd0e9('0x31')]=_0x13c2b7[_0xd0e9('0x31')]['length']?_0x13c2b7[_0xd0e9('0x31')]:_0x5b1088[_0xd0e9('0x2d')];if(_0x557a82[_0xd0e9('0x2e')][_0xd0e9('0x3f')]){_0x13c2b7['include']=[{'all':!![]}];}_0x13c2b7=_[_0xd0e9('0x3a')]({},_0x13c2b7,_0x557a82[_0xd0e9('0x3e')]);return db['AnalyticExtractedReport']['find'](_0x13c2b7)[_0xd0e9('0x23')](handleEntityNotFound(_0x5abb6b,null))[_0xd0e9('0x23')](respondWithResult(_0x5abb6b,null))[_0xd0e9('0x45')](handleError(_0x5abb6b,null));};exports['create']=function(_0x580138,_0x1fe9d0){return db[_0xd0e9('0x2b')][_0xd0e9('0x46')](_0x580138['body'],{})['then'](function(_0x5027a1){var _0x35fa1d=_0x580138[_0xd0e9('0x47')][_0xd0e9('0x48')]({'plain':!![]});if(!_0x35fa1d)throw new Error(_0xd0e9('0x49'));if(_0x35fa1d[_0xd0e9('0x4a')]===_0xd0e9('0x47')){var _0x27720a=_0x5027a1[_0xd0e9('0x48')]({'plain':!![]});var _0x355682=_0xd0e9('0x25');return db['UserProfileSection'][_0xd0e9('0x4b')]({'where':{'name':_0x355682,'userProfileId':_0x35fa1d[_0xd0e9('0x4c')]},'raw':!![]})[_0xd0e9('0x23')](function(_0x28ebc2){if(_0x28ebc2&&_0x28ebc2[_0xd0e9('0x4d')]===0x0){return db[_0xd0e9('0x4e')][_0xd0e9('0x46')]({'name':_0x27720a[_0xd0e9('0x28')],'resourceId':_0x27720a['id'],'type':_0x28ebc2[_0xd0e9('0x28')],'sectionId':_0x28ebc2['id']},{})[_0xd0e9('0x23')](function(){return _0x5027a1;});}else{return _0x5027a1;}})[_0xd0e9('0x45')](function(_0x3435be){logger[_0xd0e9('0x26')](_0xd0e9('0x4f'),_0x3435be);throw _0x3435be;});}return _0x5027a1;})[_0xd0e9('0x23')](respondWithResult(_0x1fe9d0,0xc9))[_0xd0e9('0x45')](handleError(_0x1fe9d0,null));};exports['update']=function(_0x5c9361,_0xf06436){if(_0x5c9361[_0xd0e9('0x50')]['id']){delete _0x5c9361[_0xd0e9('0x50')]['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x5c9361[_0xd0e9('0x43')]['id']}})['then'](handleEntityNotFound(_0xf06436,null))[_0xd0e9('0x23')](saveUpdates(_0x5c9361[_0xd0e9('0x50')],null))[_0xd0e9('0x23')](respondWithResult(_0xf06436,null))[_0xd0e9('0x45')](handleError(_0xf06436,null));};exports[_0xd0e9('0x24')]=function(_0x236b3c,_0x5a70a3){return db[_0xd0e9('0x2b')][_0xd0e9('0x4b')]({'where':{'id':_0x236b3c[_0xd0e9('0x43')]['id']}})['then'](handleEntityNotFound(_0x5a70a3,null))[_0xd0e9('0x23')](removeEntity(_0x5a70a3,null))[_0xd0e9('0x45')](handleError(_0x5a70a3,null));};exports['download']=function(_0x554ece,_0x22939e,_0x1cd3b7){return db[_0xd0e9('0x2b')][_0xd0e9('0x4b')]({'where':{'id':_0x554ece[_0xd0e9('0x43')]['id']},'attributes':[_0xd0e9('0x28'),'basename',_0xd0e9('0x51'),_0xd0e9('0x52')],'raw':!![]})[_0xd0e9('0x23')](handleEntityNotFound(_0x22939e,null))['then'](function(_0x45e3b1){if(_0x45e3b1){if(!fs[_0xd0e9('0x53')](path[_0xd0e9('0x54')](config['root'],_0xd0e9('0x55'),_0x45e3b1[_0xd0e9('0x51')]))){throw new db[(_0xd0e9('0x56'))]['ValidationError'](_0xd0e9('0x57'));}if(_0x554ece[_0xd0e9('0x2e')][_0xd0e9('0x58')]){return _0x22939e[_0xd0e9('0x19')](0xc8);}return _0x22939e[_0xd0e9('0x59')](path[_0xd0e9('0x54')](config[_0xd0e9('0x5a')],_0xd0e9('0x55'),_0x45e3b1[_0xd0e9('0x51')]),util[_0xd0e9('0x5b')](_0xd0e9('0x5c'),_0x45e3b1[_0xd0e9('0x5d')]||_0x45e3b1[_0xd0e9('0x28')],_0x45e3b1['output'][_0xd0e9('0x5e')]()));}})['catch'](handleError(_0x22939e,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 757039c..c0c5e36 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 _0x5cbb=['api','moment','bluebird','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','lodash','util','../../config/logger'];(function(_0x502d97,_0x59277f){var _0x2c7f54=function(_0x18197c){while(--_0x18197c){_0x502d97['push'](_0x502d97['shift']());}};_0x2c7f54(++_0x59277f);}(_0x5cbb,0xe3));var _0xb5cb=function(_0x17addc,_0x586ece){_0x17addc=_0x17addc-0x0;var _0x3da7d6=_0x5cbb[_0x17addc];return _0x3da7d6;};'use strict';var _=require(_0xb5cb('0x0'));var util=require(_0xb5cb('0x1'));var logger=require(_0xb5cb('0x2'))(_0xb5cb('0x3'));var moment=require(_0xb5cb('0x4'));var BPromise=require(_0xb5cb('0x5'));var rp=require('request-promise');var attributes=require(_0xb5cb('0x6'));module[_0xb5cb('0x7')]=function(_0x634d4e,_0xd48eb1){return _0x634d4e[_0xb5cb('0x8')]('AnalyticExtractedReport',attributes,{'tableName':_0xb5cb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3264=['../../config/logger','api','moment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','util'];(function(_0x13ff4f,_0x4defc2){var _0xd04dee=function(_0x516beb){while(--_0x516beb){_0x13ff4f['push'](_0x13ff4f['shift']());}};_0xd04dee(++_0x4defc2);}(_0x3264,0x7f));var _0x4326=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x3264[_0x13b02f];return _0x12e9a6;};'use strict';var _=require('lodash');var util=require(_0x4326('0x0'));var logger=require(_0x4326('0x1'))(_0x4326('0x2'));var moment=require(_0x4326('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x4326('0x4'));module['exports']=function(_0x5555ac,_0x27ff99){return _0x5555ac[_0x4326('0x5')](_0x4326('0x6'),attributes,{'tableName':_0x4326('0x7'),'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 696f2d0..64f669b 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 _0x4d9e=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x4d9e,0x7b));var _0xe4d9=function(_0x50f6c6,_0x1907a8){_0x50f6c6=_0x50f6c6-0x0;var _0x33790e=_0x4d9e[_0x50f6c6];return _0x33790e;};'use strict';var _=require(_0xe4d9('0x0'));var util=require(_0xe4d9('0x1'));var moment=require(_0xe4d9('0x2'));var BPromise=require(_0xe4d9('0x3'));var rs=require(_0xe4d9('0x4'));var fs=require('fs');var Redis=require(_0xe4d9('0x5'));var db=require(_0xe4d9('0x6'))['db'];var utils=require(_0xe4d9('0x7'));var logger=require(_0xe4d9('0x8'))(_0xe4d9('0x9'));var config=require('../../config/environment');var jayson=require(_0xe4d9('0xa'));var client=jayson[_0xe4d9('0xb')][_0xe4d9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x587bc3,_0x3c7a1d,_0x16a8ea){return new BPromise(function(_0x378b94,_0x50b230){return client[_0xe4d9('0xd')](_0x587bc3,_0x16a8ea)['then'](function(_0x31dae6){logger['info'](_0xe4d9('0xe'),_0x3c7a1d,_0xe4d9('0xf'));logger[_0xe4d9('0x10')](_0xe4d9('0x11'),_0x3c7a1d,_0xe4d9('0xf'),JSON['stringify'](_0x31dae6));if(_0x31dae6['error']){if(_0x31dae6[_0xe4d9('0x12')][_0xe4d9('0x13')]===0x1f4){logger[_0xe4d9('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3c7a1d,_0x31dae6[_0xe4d9('0x12')][_0xe4d9('0x14')]);return _0x50b230(_0x31dae6[_0xe4d9('0x12')][_0xe4d9('0x14')]);}logger[_0xe4d9('0x12')](_0xe4d9('0xe'),_0x3c7a1d,_0x31dae6[_0xe4d9('0x12')][_0xe4d9('0x14')]);return _0x378b94(_0x31dae6[_0xe4d9('0x12')]['message']);}else{logger[_0xe4d9('0x15')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3c7a1d,_0xe4d9('0xf'));_0x378b94(_0x31dae6[_0xe4d9('0x16')][_0xe4d9('0x14')]);}})[_0xe4d9('0x17')](function(_0x1d7e3e){logger[_0xe4d9('0x12')](_0xe4d9('0xe'),_0x3c7a1d,_0x1d7e3e);_0x50b230(_0x1d7e3e);});});} \ No newline at end of file +var _0x201c=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0xa45bf6,_0x4e1f58){var _0x174b3f=function(_0x220228){while(--_0x220228){_0xa45bf6['push'](_0xa45bf6['shift']());}};_0x174b3f(++_0x4e1f58);}(_0x201c,0x105));var _0xc201=function(_0x57d376,_0x2a9324){_0x57d376=_0x57d376-0x0;var _0x1837f9=_0x201c[_0x57d376];return _0x1837f9;};'use strict';var _=require(_0xc201('0x0'));var util=require('util');var moment=require(_0xc201('0x1'));var BPromise=require(_0xc201('0x2'));var rs=require(_0xc201('0x3'));var fs=require('fs');var Redis=require(_0xc201('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc201('0x5'));var logger=require(_0xc201('0x6'))(_0xc201('0x7'));var config=require(_0xc201('0x8'));var jayson=require(_0xc201('0x9'));var client=jayson[_0xc201('0xa')][_0xc201('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3cf65b,_0xd6063a,_0x2e7d8a){return new BPromise(function(_0x1fc6b3,_0x210680){return client[_0xc201('0xc')](_0x3cf65b,_0x2e7d8a)[_0xc201('0xd')](function(_0x5cb176){logger[_0xc201('0xe')](_0xc201('0xf'),_0xd6063a,_0xc201('0x10'));logger['debug'](_0xc201('0x11'),_0xd6063a,'request\x20sent',JSON[_0xc201('0x12')](_0x5cb176));if(_0x5cb176[_0xc201('0x13')]){if(_0x5cb176['error'][_0xc201('0x14')]===0x1f4){logger[_0xc201('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xd6063a,_0x5cb176[_0xc201('0x13')][_0xc201('0x15')]);return _0x210680(_0x5cb176[_0xc201('0x13')][_0xc201('0x15')]);}logger[_0xc201('0x13')](_0xc201('0xf'),_0xd6063a,_0x5cb176['error']['message']);return _0x1fc6b3(_0x5cb176[_0xc201('0x13')][_0xc201('0x15')]);}else{logger[_0xc201('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xd6063a,_0xc201('0x10'));_0x1fc6b3(_0x5cb176[_0xc201('0x16')][_0xc201('0x15')]);}})[_0xc201('0x17')](function(_0x2e593c){logger[_0xc201('0x13')](_0xc201('0xf'),_0xd6063a,_0x2e593c);_0x210680(_0x2e593c);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index fe20108..467c735 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 _0x7443=['Router','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','destroy','exports','multer','path','connect-timeout'];(function(_0x34ecbf,_0x210898){var _0x115f8a=function(_0x559567){while(--_0x559567){_0x34ecbf['push'](_0x34ecbf['shift']());}};_0x115f8a(++_0x210898);}(_0x7443,0x1c5));var _0x3744=function(_0x3d14c4,_0x5c5807){_0x3d14c4=_0x3d14c4-0x0;var _0x359196=_0x7443[_0x3d14c4];return _0x359196;};'use strict';var multer=require(_0x3744('0x0'));var util=require('util');var path=require(_0x3744('0x1'));var timeout=require(_0x3744('0x2'));var express=require('express');var router=express[_0x3744('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3744('0x4'));var controller=require(_0x3744('0x5'));router[_0x3744('0x6')]('/',auth[_0x3744('0x7')](),controller[_0x3744('0x8')]);router['get'](_0x3744('0x9'),auth[_0x3744('0x7')](),controller[_0x3744('0xa')]);router['get'](_0x3744('0xb'),auth[_0x3744('0x7')](),controller[_0x3744('0xc')]);router[_0x3744('0xd')]('/',auth[_0x3744('0x7')](),controller[_0x3744('0xe')]);router[_0x3744('0xf')](_0x3744('0x9'),auth['isAuthenticated'](),controller[_0x3744('0x10')]);router['delete'](_0x3744('0x9'),auth[_0x3744('0x7')](),controller[_0x3744('0x11')]);module[_0x3744('0x12')]=router; \ No newline at end of file +var _0xa849=['put','/:id','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/download','download','post','create'];(function(_0x2ae22a,_0x4fe753){var _0x286a82=function(_0x256e58){while(--_0x256e58){_0x2ae22a['push'](_0x2ae22a['shift']());}};_0x286a82(++_0x4fe753);}(_0xa849,0x133));var _0x9a84=function(_0x42a612,_0x4d6764){_0x42a612=_0x42a612-0x0;var _0x3dd547=_0xa849[_0x42a612];return _0x3dd547;};'use strict';var multer=require(_0x9a84('0x0'));var util=require('util');var path=require(_0x9a84('0x1'));var timeout=require(_0x9a84('0x2'));var express=require(_0x9a84('0x3'));var router=express[_0x9a84('0x4')]();var auth=require(_0x9a84('0x5'));var interaction=require(_0x9a84('0x6'));var config=require(_0x9a84('0x7'));var controller=require('./analyticExtractedReport.controller');router[_0x9a84('0x8')]('/',auth[_0x9a84('0x9')](),controller[_0x9a84('0xa')]);router[_0x9a84('0x8')]('/:id',auth[_0x9a84('0x9')](),controller[_0x9a84('0xb')]);router[_0x9a84('0x8')](_0x9a84('0xc'),auth[_0x9a84('0x9')](),controller[_0x9a84('0xd')]);router[_0x9a84('0xe')]('/',auth[_0x9a84('0x9')](),controller[_0x9a84('0xf')]);router[_0x9a84('0x10')](_0x9a84('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x9a84('0x12')](_0x9a84('0x11'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index fcee9ce..6913a7f 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 _0x652a=['STRING','BOOLEAN'];(function(_0x4d4825,_0x24a9be){var _0x255015=function(_0x11495c){while(--_0x11495c){_0x4d4825['push'](_0x4d4825['shift']());}};_0x255015(++_0x24a9be);}(_0x652a,0xe6));var _0xa652=function(_0x53428a,_0x153b97){_0x53428a=_0x53428a-0x0;var _0x2d4a58=_0x652a[_0x53428a];return _0x2d4a58;};'use strict';var Sequelize=require('sequelize');module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xa652('0x0')]},'function':{'type':Sequelize[_0xa652('0x0')]},'format':{'type':Sequelize[_0xa652('0x0')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xa652('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xcd84=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x43ea0a,_0x3d3777){var _0x32c07e=function(_0x4ee738){while(--_0x4ee738){_0x43ea0a['push'](_0x43ea0a['shift']());}};_0x32c07e(++_0x3d3777);}(_0xcd84,0x190));var _0x4cd8=function(_0x4193cd,_0x1d8537){_0x4193cd=_0x4193cd-0x0;var _0x383618=_0xcd84[_0x4193cd];return _0x383618;};'use strict';var Sequelize=require(_0x4cd8('0x0'));module[_0x4cd8('0x1')]={'field':{'type':Sequelize[_0x4cd8('0x2')]},'alias':{'type':Sequelize[_0x4cd8('0x3')]},'function':{'type':Sequelize[_0x4cd8('0x3')]},'format':{'type':Sequelize[_0x4cd8('0x3')]},'groupBy':{'type':Sequelize[_0x4cd8('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x4cd8('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 4c21719..4b42d84 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 _0x7404=['end','stack','name','send','index','AnalyticFieldReport','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','VIRTUAL','field','include','then','rows','catch','show','params','includeAll','merge','options','find','create','body','bulkCreate','update','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','destroy'];(function(_0x118a12,_0x2b1f67){var _0x53cad1=function(_0x3b6334){while(--_0x3b6334){_0x118a12['push'](_0x118a12['shift']());}};_0x53cad1(++_0x2b1f67);}(_0x7404,0x1d0));var _0x4740=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x7404[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0x4740('0x0'));var emlformat=require(_0x4740('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4740('0x2'));var jsonpatch=require(_0x4740('0x3'));var rp=require(_0x4740('0x4'));var moment=require(_0x4740('0x5'));var BPromise=require(_0x4740('0x6'));var Mustache=require(_0x4740('0x7'));var util=require('util');var path=require(_0x4740('0x8'));var sox=require('sox');var csv=require(_0x4740('0x9'));var ejs=require(_0x4740('0xa'));var fs=require('fs');var _=require(_0x4740('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4740('0xc'));var deskjs=require(_0x4740('0xd'));var toCsv=require(_0x4740('0x9'));var querystring=require(_0x4740('0xe'));var Papa=require(_0x4740('0xf'));var authService=require('../../components/auth/service');var hardwareService=require(_0x4740('0x10'));var Redis=require(_0x4740('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0x4740('0x12'))(_0x4740('0x13'));var utils=require(_0x4740('0x14'));var config=require(_0x4740('0x15'));var db=require(_0x4740('0x16'))['db'];function respondWithStatusCode(_0x171329,_0x51aad1){_0x51aad1=_0x51aad1||0xcc;return function(_0x53bf20){if(_0x53bf20){return _0x171329[_0x4740('0x17')](_0x51aad1);}return _0x171329[_0x4740('0x18')](_0x51aad1)['end']();};}function respondWithResult(_0x5cbe9a,_0xc65308){_0xc65308=_0xc65308||0xc8;return function(_0x28ef13){if(_0x28ef13){return _0x5cbe9a[_0x4740('0x18')](_0xc65308)[_0x4740('0x19')](_0x28ef13);}};}function respondWithFilteredResult(_0x5c0ff3,_0x1fd05a){return function(_0x4884aa){if(_0x4884aa){var _0x26a06d=_0x4884aa[_0x4740('0x1a')],_0x12b82e=_0x1fd05a['offset'],_0x2ac75a=_0x1fd05a[_0x4740('0x1b')]+_0x1fd05a[_0x4740('0x1c')],_0x1fd2eb;if(_0x2ac75a>=_0x26a06d){_0x2ac75a=_0x26a06d;_0x1fd2eb=0xc8;}else{_0x1fd2eb=0xce;}_0x5c0ff3[_0x4740('0x18')](_0x1fd2eb);return _0x5c0ff3[_0x4740('0x1d')]('Content-Range',_0x12b82e+'-'+_0x2ac75a+'/'+_0x26a06d)[_0x4740('0x19')](_0x4884aa);}return null;};}function patchUpdates(_0x3344cb){return function(_0x136656){try{jsonpatch[_0x4740('0x1e')](_0x136656,_0x3344cb,!![]);}catch(_0x4a559e){return BPromise[_0x4740('0x1f')](_0x4a559e);}return _0x136656[_0x4740('0x20')]();};}function saveUpdates(_0x2dd724,_0x3f43fe){return function(_0x3a35b6){if(_0x3a35b6){return _0x3a35b6['update'](_0x2dd724)['then'](function(_0x358580){return _0x358580;});}return null;};}function removeEntity(_0x2398f2,_0x2e0aa7){return function(_0x2a2460){if(_0x2a2460){return _0x2a2460[_0x4740('0x21')]()['then'](function(){_0x2398f2[_0x4740('0x18')](0xcc)[_0x4740('0x22')]();});}};}function handleEntityNotFound(_0xb5ef4d,_0x2b199f){return function(_0x1abf60){if(!_0x1abf60){_0xb5ef4d[_0x4740('0x17')](0x194);}return _0x1abf60;};}function handleError(_0xe7342f,_0xc3ccda){_0xc3ccda=_0xc3ccda||0x1f4;return function(_0x369970){logger['error'](_0x369970[_0x4740('0x23')]);if(_0x369970[_0x4740('0x24')]){delete _0x369970['name'];}_0xe7342f[_0x4740('0x18')](_0xc3ccda)[_0x4740('0x25')](_0x369970);};}exports[_0x4740('0x26')]=function(_0x3a970c,_0x1a1505){var _0x1cd9f9={},_0x2534d1={},_0x38a7b5={'count':0x0,'rows':[]};var _0x12846b=db[_0x4740('0x27')][_0x4740('0x28')];_0x2534d1[_0x4740('0x29')]=_[_0x4740('0x2a')](_0x12846b);_0x2534d1[_0x4740('0x2b')]=_['keys'](_0x3a970c[_0x4740('0x2b')]);_0x2534d1[_0x4740('0x2c')]=_['intersection'](_0x2534d1[_0x4740('0x29')],_0x2534d1['query']);_0x1cd9f9[_0x4740('0x2d')]=_[_0x4740('0x2e')](_0x2534d1[_0x4740('0x29')],qs[_0x4740('0x2f')](_0x3a970c[_0x4740('0x2b')]['fields']));_0x1cd9f9['attributes']=_0x1cd9f9[_0x4740('0x2d')][_0x4740('0x30')]?_0x1cd9f9[_0x4740('0x2d')]:_0x2534d1['model'];if(!_0x3a970c[_0x4740('0x2b')][_0x4740('0x31')](_0x4740('0x32'))){_0x1cd9f9[_0x4740('0x1c')]=qs[_0x4740('0x1c')](_0x3a970c[_0x4740('0x2b')][_0x4740('0x1c')]);_0x1cd9f9[_0x4740('0x1b')]=qs[_0x4740('0x1b')](_0x3a970c[_0x4740('0x2b')][_0x4740('0x1b')]);}_0x1cd9f9[_0x4740('0x33')]=qs[_0x4740('0x34')](_0x3a970c[_0x4740('0x2b')][_0x4740('0x34')]);_0x1cd9f9[_0x4740('0x35')]=qs[_0x4740('0x2c')](_[_0x4740('0x36')](_0x3a970c['query'],_0x2534d1[_0x4740('0x2c')]));if(_0x3a970c[_0x4740('0x2b')][_0x4740('0x37')]){_0x1cd9f9['where']=_['merge'](_0x1cd9f9[_0x4740('0x35')],{'$or':_[_0x4740('0x38')](_0x12846b,function(_0x59e88c){if(_0x59e88c[_0x4740('0x39')]['key']!==_0x4740('0x3a')){var _0x27e849={};_0x27e849[_0x59e88c[_0x4740('0x3b')]]={'$like':'%'+_0x3a970c[_0x4740('0x2b')][_0x4740('0x37')]+'%'};return _0x27e849;}})});}_0x1cd9f9=_['merge']({},_0x1cd9f9,_0x3a970c['options']);var _0x5196c5={'where':_0x1cd9f9[_0x4740('0x35')]};return db[_0x4740('0x27')]['count'](_0x5196c5)['then'](function(_0x57f892){_0x38a7b5[_0x4740('0x1a')]=_0x57f892;if(_0x3a970c[_0x4740('0x2b')]['includeAll']){_0x1cd9f9[_0x4740('0x3c')]=[{'all':!![]}];}return db[_0x4740('0x27')]['findAll'](_0x1cd9f9);})[_0x4740('0x3d')](function(_0x58a3be){_0x38a7b5[_0x4740('0x3e')]=_0x58a3be;return _0x38a7b5;})[_0x4740('0x3d')](respondWithFilteredResult(_0x1a1505,_0x1cd9f9))[_0x4740('0x3f')](handleError(_0x1a1505,null));};exports[_0x4740('0x40')]=function(_0x12a71c,_0x22a765){var _0x3bd2c2={'raw':![],'where':{'id':_0x12a71c[_0x4740('0x41')]['id']}},_0x281feb={};_0x281feb[_0x4740('0x29')]=_['keys'](db[_0x4740('0x27')]['rawAttributes']);_0x281feb['query']=_[_0x4740('0x2a')](_0x12a71c[_0x4740('0x2b')]);_0x281feb[_0x4740('0x2c')]=_['intersection'](_0x281feb[_0x4740('0x29')],_0x281feb[_0x4740('0x2b')]);_0x3bd2c2['attributes']=_[_0x4740('0x2e')](_0x281feb['model'],qs['fields'](_0x12a71c['query']['fields']));_0x3bd2c2['attributes']=_0x3bd2c2['attributes'][_0x4740('0x30')]?_0x3bd2c2[_0x4740('0x2d')]:_0x281feb[_0x4740('0x29')];if(_0x12a71c[_0x4740('0x2b')][_0x4740('0x42')]){_0x3bd2c2[_0x4740('0x3c')]=[{'all':!![]}];}_0x3bd2c2=_[_0x4740('0x43')]({},_0x3bd2c2,_0x12a71c[_0x4740('0x44')]);return db[_0x4740('0x27')][_0x4740('0x45')](_0x3bd2c2)['then'](handleEntityNotFound(_0x22a765,null))[_0x4740('0x3d')](respondWithResult(_0x22a765,null))[_0x4740('0x3f')](handleError(_0x22a765,null));};exports[_0x4740('0x46')]=function(_0x828180,_0x591cdd){return db['AnalyticFieldReport']['create'](_0x828180[_0x4740('0x47')],{})[_0x4740('0x3d')](respondWithResult(_0x591cdd,0xc9))[_0x4740('0x3f')](handleError(_0x591cdd,null));};exports[_0x4740('0x48')]=function(_0x214d2c,_0x374b3c){return db[_0x4740('0x27')][_0x4740('0x48')](_0x214d2c[_0x4740('0x47')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x374b3c,0xc9))[_0x4740('0x3f')](handleError(_0x374b3c,null));};exports[_0x4740('0x49')]=function(_0xd94921,_0x5498b9){if(_0xd94921[_0x4740('0x47')]['id']){delete _0xd94921[_0x4740('0x47')]['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0xd94921[_0x4740('0x41')]['id']}})[_0x4740('0x3d')](handleEntityNotFound(_0x5498b9,null))[_0x4740('0x3d')](saveUpdates(_0xd94921[_0x4740('0x47')],null))[_0x4740('0x3d')](respondWithResult(_0x5498b9,null))[_0x4740('0x3f')](handleError(_0x5498b9,null));};exports[_0x4740('0x21')]=function(_0x468ec3,_0x396564){return db['AnalyticFieldReport'][_0x4740('0x45')]({'where':{'id':_0x468ec3[_0x4740('0x41')]['id']}})[_0x4740('0x3d')](handleEntityNotFound(_0x396564,null))[_0x4740('0x3d')](removeEntity(_0x396564,null))[_0x4740('0x3f')](handleError(_0x396564,null));};exports[_0x4740('0x4a')]=function(_0x1ad97b,_0x40cc7e){return db['AnalyticFieldReport'][_0x4740('0x21')]({'where':{'id':_0x1ad97b[_0x4740('0x2b')][_0x4740('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x4740('0x3d')](respondWithResult(_0x40cc7e,0xcc))['catch'](handleError(_0x40cc7e,null));};exports[_0x4740('0x4c')]=function(_0x12f082,_0x812d4b,_0x29f7ea){return db[_0x4740('0x4d')][_0x4740('0x4e')]({'where':{'id':_0x12f082[_0x4740('0x41')]['id']}})['then'](handleEntityNotFound(_0x812d4b,null))['then'](function(_0x244f70){if(_0x244f70){return db[_0x4740('0x4f')][_0x4740('0x50')](function(_0x334116){return db[_0x4740('0x27')][_0x4740('0x21')]({'where':{'CustomReportId':_0x12f082[_0x4740('0x41')]['id']},'transaction':_0x334116})['then'](function(_0x588eb0){var _0x30c75e=_[_0x4740('0x38')](_0x12f082[_0x4740('0x47')],function(_0x1f7082){delete _0x1f7082['id'];_0x1f7082[_0x4740('0x51')]=_0x12f082[_0x4740('0x41')]['id'];return _0x1f7082;});return db['AnalyticFieldReport'][_0x4740('0x48')](_0x30c75e,{'transaction':_0x334116});});})['then'](function(){return db[_0x4740('0x27')][_0x4740('0x52')]({'where':{'CustomReportId':_0x12f082[_0x4740('0x41')]['id']}});});}})[_0x4740('0x3d')](respondWithResult(_0x812d4b,null))[_0x4740('0x3f')](handleError(_0x812d4b,null));}; \ No newline at end of file +var _0xcddb=['reject','save','then','destroy','sendStatus','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','keys','query','filters','attributes','model','fields','length','nolimit','order','sort','where','merge','map','type','key','VIRTUAL','field','options','include','findAll','rows','show','params','intersection','includeAll','find','catch','create','body','bulkCreate','bulkDestroy','ids','findOne','sequelize','transaction','CustomReportId','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set'];(function(_0x47824,_0x163079){var _0x4eaf53=function(_0x6c2a54){while(--_0x6c2a54){_0x47824['push'](_0x47824['shift']());}};_0x4eaf53(++_0x163079);}(_0xcddb,0x168));var _0xbcdd=function(_0x2a4e85,_0x1264aa){_0x2a4e85=_0x2a4e85-0x0;var _0x5e5d81=_0xcddb[_0x2a4e85];return _0x5e5d81;};'use strict';var pdf=require(_0xbcdd('0x0'));var emlformat=require(_0xbcdd('0x1'));var rimraf=require(_0xbcdd('0x2'));var zipdir=require(_0xbcdd('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbcdd('0x4'));var moment=require('moment');var BPromise=require(_0xbcdd('0x5'));var Mustache=require(_0xbcdd('0x6'));var util=require('util');var path=require('path');var sox=require(_0xbcdd('0x7'));var csv=require(_0xbcdd('0x8'));var ejs=require(_0xbcdd('0x9'));var fs=require('fs');var _=require(_0xbcdd('0xa'));var squel=require(_0xbcdd('0xb'));var crypto=require(_0xbcdd('0xc'));var jsforce=require(_0xbcdd('0xd'));var deskjs=require(_0xbcdd('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbcdd('0xf'));var authService=require(_0xbcdd('0x10'));var hardwareService=require(_0xbcdd('0x11'));var Redis=require('ioredis');var qs=require(_0xbcdd('0x12'));var logger=require(_0xbcdd('0x13'))(_0xbcdd('0x14'));var utils=require('../../config/utils');var config=require(_0xbcdd('0x15'));var db=require(_0xbcdd('0x16'))['db'];function respondWithStatusCode(_0x187b97,_0x3458ae){_0x3458ae=_0x3458ae||0xcc;return function(_0x3a083a){if(_0x3a083a){return _0x187b97['sendStatus'](_0x3458ae);}return _0x187b97[_0xbcdd('0x17')](_0x3458ae)[_0xbcdd('0x18')]();};}function respondWithResult(_0x13fe36,_0x33bcca){_0x33bcca=_0x33bcca||0xc8;return function(_0x243e24){if(_0x243e24){return _0x13fe36[_0xbcdd('0x17')](_0x33bcca)[_0xbcdd('0x19')](_0x243e24);}};}function respondWithFilteredResult(_0x335970,_0x77b66a){return function(_0x10a8e3){if(_0x10a8e3){var _0x79a87=_0x10a8e3[_0xbcdd('0x1a')],_0x2ee9b0=_0x77b66a[_0xbcdd('0x1b')],_0xd35176=_0x77b66a['offset']+_0x77b66a[_0xbcdd('0x1c')],_0x4e001b;if(_0xd35176>=_0x79a87){_0xd35176=_0x79a87;_0x4e001b=0xc8;}else{_0x4e001b=0xce;}_0x335970[_0xbcdd('0x17')](_0x4e001b);return _0x335970[_0xbcdd('0x1d')]('Content-Range',_0x2ee9b0+'-'+_0xd35176+'/'+_0x79a87)[_0xbcdd('0x19')](_0x10a8e3);}return null;};}function patchUpdates(_0x5a3495){return function(_0x2ecceb){try{jsonpatch['apply'](_0x2ecceb,_0x5a3495,!![]);}catch(_0x4bb075){return BPromise[_0xbcdd('0x1e')](_0x4bb075);}return _0x2ecceb[_0xbcdd('0x1f')]();};}function saveUpdates(_0x3bea7b,_0x386aaa){return function(_0x48fc17){if(_0x48fc17){return _0x48fc17['update'](_0x3bea7b)[_0xbcdd('0x20')](function(_0x429e8f){return _0x429e8f;});}return null;};}function removeEntity(_0xa2e105,_0x5ee0a2){return function(_0x16c6c7){if(_0x16c6c7){return _0x16c6c7[_0xbcdd('0x21')]()[_0xbcdd('0x20')](function(){_0xa2e105[_0xbcdd('0x17')](0xcc)[_0xbcdd('0x18')]();});}};}function handleEntityNotFound(_0x457c9d,_0x506e1d){return function(_0x5a1bae){if(!_0x5a1bae){_0x457c9d[_0xbcdd('0x22')](0x194);}return _0x5a1bae;};}function handleError(_0x9a430d,_0x4b96a7){_0x4b96a7=_0x4b96a7||0x1f4;return function(_0x453a8e){logger[_0xbcdd('0x23')](_0x453a8e[_0xbcdd('0x24')]);if(_0x453a8e['name']){delete _0x453a8e[_0xbcdd('0x25')];}_0x9a430d[_0xbcdd('0x17')](_0x4b96a7)[_0xbcdd('0x26')](_0x453a8e);};}exports[_0xbcdd('0x27')]=function(_0x31a447,_0x162d47){var _0x568bb9={},_0x4fbcaa={},_0x391dc7={'count':0x0,'rows':[]};var _0x4effbe=db[_0xbcdd('0x28')][_0xbcdd('0x29')];_0x4fbcaa['model']=_[_0xbcdd('0x2a')](_0x4effbe);_0x4fbcaa[_0xbcdd('0x2b')]=_[_0xbcdd('0x2a')](_0x31a447['query']);_0x4fbcaa[_0xbcdd('0x2c')]=_['intersection'](_0x4fbcaa['model'],_0x4fbcaa['query']);_0x568bb9[_0xbcdd('0x2d')]=_['intersection'](_0x4fbcaa[_0xbcdd('0x2e')],qs[_0xbcdd('0x2f')](_0x31a447['query'][_0xbcdd('0x2f')]));_0x568bb9['attributes']=_0x568bb9[_0xbcdd('0x2d')][_0xbcdd('0x30')]?_0x568bb9[_0xbcdd('0x2d')]:_0x4fbcaa[_0xbcdd('0x2e')];if(!_0x31a447['query']['hasOwnProperty'](_0xbcdd('0x31'))){_0x568bb9[_0xbcdd('0x1c')]=qs[_0xbcdd('0x1c')](_0x31a447['query'][_0xbcdd('0x1c')]);_0x568bb9[_0xbcdd('0x1b')]=qs[_0xbcdd('0x1b')](_0x31a447[_0xbcdd('0x2b')]['offset']);}_0x568bb9[_0xbcdd('0x32')]=qs[_0xbcdd('0x33')](_0x31a447[_0xbcdd('0x2b')]['sort']);_0x568bb9[_0xbcdd('0x34')]=qs[_0xbcdd('0x2c')](_['pick'](_0x31a447['query'],_0x4fbcaa[_0xbcdd('0x2c')]));if(_0x31a447[_0xbcdd('0x2b')]['filter']){_0x568bb9[_0xbcdd('0x34')]=_[_0xbcdd('0x35')](_0x568bb9['where'],{'$or':_[_0xbcdd('0x36')](_0x4effbe,function(_0x57dcd0){if(_0x57dcd0[_0xbcdd('0x37')][_0xbcdd('0x38')]!==_0xbcdd('0x39')){var _0x1361ee={};_0x1361ee[_0x57dcd0[_0xbcdd('0x3a')]]={'$like':'%'+_0x31a447[_0xbcdd('0x2b')]['filter']+'%'};return _0x1361ee;}})});}_0x568bb9=_['merge']({},_0x568bb9,_0x31a447[_0xbcdd('0x3b')]);var _0x36020d={'where':_0x568bb9[_0xbcdd('0x34')]};return db['AnalyticFieldReport'][_0xbcdd('0x1a')](_0x36020d)['then'](function(_0x50726b){_0x391dc7['count']=_0x50726b;if(_0x31a447[_0xbcdd('0x2b')]['includeAll']){_0x568bb9[_0xbcdd('0x3c')]=[{'all':!![]}];}return db[_0xbcdd('0x28')][_0xbcdd('0x3d')](_0x568bb9);})[_0xbcdd('0x20')](function(_0x280781){_0x391dc7[_0xbcdd('0x3e')]=_0x280781;return _0x391dc7;})[_0xbcdd('0x20')](respondWithFilteredResult(_0x162d47,_0x568bb9))['catch'](handleError(_0x162d47,null));};exports[_0xbcdd('0x3f')]=function(_0x49cbb4,_0x58529f){var _0x48ab38={'raw':![],'where':{'id':_0x49cbb4[_0xbcdd('0x40')]['id']}},_0x1b0d10={};_0x1b0d10['model']=_[_0xbcdd('0x2a')](db[_0xbcdd('0x28')][_0xbcdd('0x29')]);_0x1b0d10[_0xbcdd('0x2b')]=_[_0xbcdd('0x2a')](_0x49cbb4[_0xbcdd('0x2b')]);_0x1b0d10[_0xbcdd('0x2c')]=_['intersection'](_0x1b0d10[_0xbcdd('0x2e')],_0x1b0d10['query']);_0x48ab38[_0xbcdd('0x2d')]=_[_0xbcdd('0x41')](_0x1b0d10[_0xbcdd('0x2e')],qs['fields'](_0x49cbb4[_0xbcdd('0x2b')]['fields']));_0x48ab38[_0xbcdd('0x2d')]=_0x48ab38[_0xbcdd('0x2d')][_0xbcdd('0x30')]?_0x48ab38[_0xbcdd('0x2d')]:_0x1b0d10[_0xbcdd('0x2e')];if(_0x49cbb4[_0xbcdd('0x2b')][_0xbcdd('0x42')]){_0x48ab38['include']=[{'all':!![]}];}_0x48ab38=_['merge']({},_0x48ab38,_0x49cbb4[_0xbcdd('0x3b')]);return db[_0xbcdd('0x28')][_0xbcdd('0x43')](_0x48ab38)[_0xbcdd('0x20')](handleEntityNotFound(_0x58529f,null))[_0xbcdd('0x20')](respondWithResult(_0x58529f,null))[_0xbcdd('0x44')](handleError(_0x58529f,null));};exports[_0xbcdd('0x45')]=function(_0x94ccef,_0x1c6c94){return db[_0xbcdd('0x28')][_0xbcdd('0x45')](_0x94ccef[_0xbcdd('0x46')],{})[_0xbcdd('0x20')](respondWithResult(_0x1c6c94,0xc9))['catch'](handleError(_0x1c6c94,null));};exports['bulkCreate']=function(_0x19396a,_0x574c41){return db[_0xbcdd('0x28')][_0xbcdd('0x47')](_0x19396a['body'],{'raw':![],'individualHooks':!![]})[_0xbcdd('0x20')](respondWithResult(_0x574c41,0xc9))[_0xbcdd('0x44')](handleError(_0x574c41,null));};exports['update']=function(_0xc46a20,_0x9fc1a6){if(_0xc46a20[_0xbcdd('0x46')]['id']){delete _0xc46a20[_0xbcdd('0x46')]['id'];}return db[_0xbcdd('0x28')][_0xbcdd('0x43')]({'where':{'id':_0xc46a20[_0xbcdd('0x40')]['id']}})[_0xbcdd('0x20')](handleEntityNotFound(_0x9fc1a6,null))[_0xbcdd('0x20')](saveUpdates(_0xc46a20[_0xbcdd('0x46')],null))['then'](respondWithResult(_0x9fc1a6,null))['catch'](handleError(_0x9fc1a6,null));};exports[_0xbcdd('0x21')]=function(_0x4a4278,_0x20f076){return db['AnalyticFieldReport'][_0xbcdd('0x43')]({'where':{'id':_0x4a4278[_0xbcdd('0x40')]['id']}})[_0xbcdd('0x20')](handleEntityNotFound(_0x20f076,null))['then'](removeEntity(_0x20f076,null))[_0xbcdd('0x44')](handleError(_0x20f076,null));};exports[_0xbcdd('0x48')]=function(_0x511dc3,_0x173a22){return db[_0xbcdd('0x28')][_0xbcdd('0x21')]({'where':{'id':_0x511dc3['query'][_0xbcdd('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0xbcdd('0x20')](respondWithResult(_0x173a22,0xcc))[_0xbcdd('0x44')](handleError(_0x173a22,null));};exports['addFields']=function(_0x4d3018,_0x51917c,_0x6d6f40){return db['AnalyticCustomReport'][_0xbcdd('0x4a')]({'where':{'id':_0x4d3018[_0xbcdd('0x40')]['id']}})[_0xbcdd('0x20')](handleEntityNotFound(_0x51917c,null))[_0xbcdd('0x20')](function(_0x5a1422){if(_0x5a1422){return db[_0xbcdd('0x4b')][_0xbcdd('0x4c')](function(_0x21b0c1){return db[_0xbcdd('0x28')][_0xbcdd('0x21')]({'where':{'CustomReportId':_0x4d3018[_0xbcdd('0x40')]['id']},'transaction':_0x21b0c1})[_0xbcdd('0x20')](function(_0x1a4ffb){var _0x231d9a=_[_0xbcdd('0x36')](_0x4d3018[_0xbcdd('0x46')],function(_0x3c6445){delete _0x3c6445['id'];_0x3c6445[_0xbcdd('0x4d')]=_0x4d3018[_0xbcdd('0x40')]['id'];return _0x3c6445;});return db[_0xbcdd('0x28')][_0xbcdd('0x47')](_0x231d9a,{'transaction':_0x21b0c1});});})[_0xbcdd('0x20')](function(){return db[_0xbcdd('0x28')][_0xbcdd('0x3d')]({'where':{'CustomReportId':_0x4d3018['params']['id']}});});}})[_0xbcdd('0x20')](respondWithResult(_0x51917c,null))[_0xbcdd('0x44')](handleError(_0x51917c,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 425f93c..986cabb 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 _0x5476=['request-promise','./analyticFieldReport.attributes','exports','define','lodash','../../config/logger','moment','bluebird'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5476,0x11c));var _0x6547=function(_0x57b6a7,_0x45d4f8){_0x57b6a7=_0x57b6a7-0x0;var _0x490e6a=_0x5476[_0x57b6a7];return _0x490e6a;};'use strict';var _=require(_0x6547('0x0'));var util=require('util');var logger=require(_0x6547('0x1'))('api');var moment=require(_0x6547('0x2'));var BPromise=require(_0x6547('0x3'));var rp=require(_0x6547('0x4'));var attributes=require(_0x6547('0x5'));module[_0x6547('0x6')]=function(_0x524cb6,_0xfbf562){return _0x524cb6[_0x6547('0x7')]('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc654=['AnalyticFieldReport','lodash','api','moment','bluebird','request-promise','exports','define'];(function(_0x2f25ec,_0x2db94e){var _0x41b266=function(_0x44d056){while(--_0x44d056){_0x2f25ec['push'](_0x2f25ec['shift']());}};_0x41b266(++_0x2db94e);}(_0xc654,0xb9));var _0x4c65=function(_0x39fdad,_0x1b8980){_0x39fdad=_0x39fdad-0x0;var _0x2089a1=_0xc654[_0x39fdad];return _0x2089a1;};'use strict';var _=require(_0x4c65('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4c65('0x1'));var moment=require(_0x4c65('0x2'));var BPromise=require(_0x4c65('0x3'));var rp=require(_0x4c65('0x4'));var attributes=require('./analyticFieldReport.attributes');module[_0x4c65('0x5')]=function(_0x41c803,_0x49d808){return _0x41c803[_0x4c65('0x6')](_0x4c65('0x7'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index e487676..c7421b9 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 _0xbbbd=['request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbbbd,0x86));var _0xdbbb=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xbbbd[_0x31ced5];return _0x10d9e5;};'use strict';var _=require(_0xdbbb('0x0'));var util=require(_0xdbbb('0x1'));var moment=require(_0xdbbb('0x2'));var BPromise=require(_0xdbbb('0x3'));var rs=require(_0xdbbb('0x4'));var fs=require('fs');var Redis=require(_0xdbbb('0x5'));var db=require(_0xdbbb('0x6'))['db'];var utils=require(_0xdbbb('0x7'));var logger=require(_0xdbbb('0x8'))(_0xdbbb('0x9'));var config=require(_0xdbbb('0xa'));var jayson=require(_0xdbbb('0xb'));var client=jayson['client'][_0xdbbb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42ea38,_0x197916,_0x478756){return new BPromise(function(_0x463ea6,_0x28a1fd){return client[_0xdbbb('0xd')](_0x42ea38,_0x478756)[_0xdbbb('0xe')](function(_0x2def2e){logger[_0xdbbb('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x197916,_0xdbbb('0x10'));logger['debug'](_0xdbbb('0x11'),_0x197916,'request\x20sent',JSON[_0xdbbb('0x12')](_0x2def2e));if(_0x2def2e[_0xdbbb('0x13')]){if(_0x2def2e[_0xdbbb('0x13')][_0xdbbb('0x14')]===0x1f4){logger[_0xdbbb('0x13')](_0xdbbb('0x15'),_0x197916,_0x2def2e[_0xdbbb('0x13')][_0xdbbb('0x16')]);return _0x28a1fd(_0x2def2e[_0xdbbb('0x13')]['message']);}logger[_0xdbbb('0x13')](_0xdbbb('0x15'),_0x197916,_0x2def2e[_0xdbbb('0x13')][_0xdbbb('0x16')]);return _0x463ea6(_0x2def2e[_0xdbbb('0x13')][_0xdbbb('0x16')]);}else{logger[_0xdbbb('0xf')](_0xdbbb('0x15'),_0x197916,_0xdbbb('0x10'));_0x463ea6(_0x2def2e[_0xdbbb('0x17')][_0xdbbb('0x16')]);}})[_0xdbbb('0x18')](function(_0x203feb){logger[_0xdbbb('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x197916,_0x203feb);_0x28a1fd(_0x203feb);});});} \ No newline at end of file +var _0xe132=['debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent'];(function(_0x30df75,_0x21ebdc){var _0x525282=function(_0x3ea479){while(--_0x3ea479){_0x30df75['push'](_0x30df75['shift']());}};_0x525282(++_0x21ebdc);}(_0xe132,0x162));var _0x2e13=function(_0x445977,_0x1790bb){_0x445977=_0x445977-0x0;var _0x3242b0=_0xe132[_0x445977];return _0x3242b0;};'use strict';var _=require(_0x2e13('0x0'));var util=require('util');var moment=require(_0x2e13('0x1'));var BPromise=require(_0x2e13('0x2'));var rs=require(_0x2e13('0x3'));var fs=require('fs');var Redis=require(_0x2e13('0x4'));var db=require(_0x2e13('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e13('0x6'))(_0x2e13('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2e13('0x8')][_0x2e13('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c670b,_0x71f9d3,_0x3be5dc){return new BPromise(function(_0x2d9487,_0x370a85){return client[_0x2e13('0xa')](_0x1c670b,_0x3be5dc)[_0x2e13('0xb')](function(_0x240bc3){logger['info'](_0x2e13('0xc'),_0x71f9d3,_0x2e13('0xd'));logger[_0x2e13('0xe')](_0x2e13('0xf'),_0x71f9d3,_0x2e13('0xd'),JSON[_0x2e13('0x10')](_0x240bc3));if(_0x240bc3[_0x2e13('0x11')]){if(_0x240bc3['error'][_0x2e13('0x12')]===0x1f4){logger[_0x2e13('0x11')](_0x2e13('0xc'),_0x71f9d3,_0x240bc3[_0x2e13('0x11')][_0x2e13('0x13')]);return _0x370a85(_0x240bc3[_0x2e13('0x11')][_0x2e13('0x13')]);}logger['error'](_0x2e13('0xc'),_0x71f9d3,_0x240bc3[_0x2e13('0x11')][_0x2e13('0x13')]);return _0x2d9487(_0x240bc3['error'][_0x2e13('0x13')]);}else{logger[_0x2e13('0x14')](_0x2e13('0xc'),_0x71f9d3,'request\x20sent');_0x2d9487(_0x240bc3[_0x2e13('0x15')][_0x2e13('0x13')]);}})[_0x2e13('0x16')](function(_0x4a466b){logger['error'](_0x2e13('0xc'),_0x71f9d3,_0x4a466b);_0x370a85(_0x4a466b);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index c763d21..7e0ed23 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 _0xbdb7=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','post','isAuthenticated','/create_many','bulkCreate','/:id/create_many','addFields','put','delete','/destroy_many','bulkDestroy','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x2f8bfa,_0x424acb){var _0x559544=function(_0x3222d3){while(--_0x3222d3){_0x2f8bfa['push'](_0x2f8bfa['shift']());}};_0x559544(++_0x424acb);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1b8e60,_0x21b885){_0x1b8e60=_0x1b8e60-0x0;var _0x363363=_0xbdb7[_0x1b8e60];return _0x363363;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var auth=require(_0x7bdb('0x6'));var interaction=require(_0x7bdb('0x7'));var config=require(_0x7bdb('0x8'));var controller=require('./analyticFieldReport.controller');router[_0x7bdb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7bdb('0x9')](_0x7bdb('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x7bdb('0xb')]('/',auth[_0x7bdb('0xc')](),controller['create']);router['post'](_0x7bdb('0xd'),auth[_0x7bdb('0xc')](),controller[_0x7bdb('0xe')]);router[_0x7bdb('0xb')](_0x7bdb('0xf'),auth[_0x7bdb('0xc')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7bdb('0x12')](_0x7bdb('0x13'),auth['isAuthenticated'](),controller[_0x7bdb('0x14')]);router['delete']('/:id',auth[_0x7bdb('0xc')](),controller[_0x7bdb('0x15')]);module['exports']=router; \ No newline at end of file +var _0xae60=['util','path','express','Router','../../components/auth/service','../../config/environment','./analyticFieldReport.controller','isAuthenticated','index','get','/:id','show','post','/create_many','bulkCreate','/:id/create_many','addFields','put','update','delete','/destroy_many','bulkDestroy','exports','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xae60,0x1c7));var _0x0ae6=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xae60[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var path=require(_0x0ae6('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ae6('0x3'));var router=express[_0x0ae6('0x4')]();var auth=require(_0x0ae6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0ae6('0x6'));var controller=require(_0x0ae6('0x7'));router['get']('/',auth[_0x0ae6('0x8')](),controller[_0x0ae6('0x9')]);router[_0x0ae6('0xa')](_0x0ae6('0xb'),auth[_0x0ae6('0x8')](),controller[_0x0ae6('0xc')]);router[_0x0ae6('0xd')]('/',auth[_0x0ae6('0x8')](),controller['create']);router[_0x0ae6('0xd')](_0x0ae6('0xe'),auth[_0x0ae6('0x8')](),controller[_0x0ae6('0xf')]);router['post'](_0x0ae6('0x10'),auth[_0x0ae6('0x8')](),controller[_0x0ae6('0x11')]);router[_0x0ae6('0x12')](_0x0ae6('0xb'),auth[_0x0ae6('0x8')](),controller[_0x0ae6('0x13')]);router[_0x0ae6('0x14')](_0x0ae6('0x15'),auth[_0x0ae6('0x8')](),controller[_0x0ae6('0x16')]);router[_0x0ae6('0x14')](_0x0ae6('0xb'),auth[_0x0ae6('0x8')](),controller['destroy']);module[_0x0ae6('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 3022573..5428465 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 _0x3ce1=['name','sequelize','exports','STRING'];(function(_0x49cd8b,_0x41fd5f){var _0xbccea4=function(_0x19725d){while(--_0x19725d){_0x49cd8b['push'](_0x49cd8b['shift']());}};_0xbccea4(++_0x41fd5f);}(_0x3ce1,0x105));var _0x13ce=function(_0x26777c,_0x5a63ba){_0x26777c=_0x26777c-0x0;var _0x47f4a5=_0x3ce1[_0x26777c];return _0x47f4a5;};'use strict';var Sequelize=require(_0x13ce('0x0'));module[_0x13ce('0x1')]={'name':{'type':Sequelize[_0x13ce('0x2')],'allowNull':![],'unique':_0x13ce('0x3')},'table':{'type':Sequelize[_0x13ce('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x13ce('0x2')]}}; \ No newline at end of file +var _0x6f96=['exports','name','STRING','TEXT','sequelize'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x6f96,0x13f));var _0x66f9=function(_0x1fdf38,_0x8c2f82){_0x1fdf38=_0x1fdf38-0x0;var _0x305202=_0x6f96[_0x1fdf38];return _0x305202;};'use strict';var Sequelize=require(_0x66f9('0x0'));module[_0x66f9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x66f9('0x2')},'table':{'type':Sequelize[_0x66f9('0x3')]},'metric':{'type':Sequelize[_0x66f9('0x4')]},'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 309a877..31e1d8a 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 _0xe2cf=['apply','reject','update','then','destroy','get','Metrics','UserProfileResource','end','error','stack','name','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','map','key','field','options','AnalyticMetric','includeAll','include','rows','catch','params','length','find','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','desk.js','to-csv','querystring','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range'];(function(_0x2dd3db,_0x2e59b3){var _0x51c9e2=function(_0x364c98){while(--_0x364c98){_0x2dd3db['push'](_0x2dd3db['shift']());}};_0x51c9e2(++_0x2e59b3);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x928aa1,_0x16bd67){_0x928aa1=_0x928aa1-0x0;var _0x37b02b=_0xe2cf[_0x928aa1];return _0x37b02b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfe2c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfe2c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe2c('0x2'));var moment=require(_0xfe2c('0x3'));var BPromise=require(_0xfe2c('0x4'));var Mustache=require(_0xfe2c('0x5'));var util=require('util');var path=require(_0xfe2c('0x6'));var sox=require(_0xfe2c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xfe2c('0x8'));var squel=require(_0xfe2c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfe2c('0xa'));var toCsv=require(_0xfe2c('0xb'));var querystring=require(_0xfe2c('0xc'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0xfe2c('0xd'));var Redis=require(_0xfe2c('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0xfe2c('0xf'))(_0xfe2c('0x10'));var utils=require(_0xfe2c('0x11'));var config=require(_0xfe2c('0x12'));var db=require(_0xfe2c('0x13'))['db'];function respondWithStatusCode(_0x45aa82,_0x39ce22){_0x39ce22=_0x39ce22||0xcc;return function(_0x4af8b7){if(_0x4af8b7){return _0x45aa82['sendStatus'](_0x39ce22);}return _0x45aa82['status'](_0x39ce22)['end']();};}function respondWithResult(_0x11eb5e,_0x54d2d4){_0x54d2d4=_0x54d2d4||0xc8;return function(_0x5a6ad5){if(_0x5a6ad5){return _0x11eb5e[_0xfe2c('0x14')](_0x54d2d4)[_0xfe2c('0x15')](_0x5a6ad5);}};}function respondWithFilteredResult(_0x2aa7df,_0x12e4c4){return function(_0x522692){if(_0x522692){var _0x5039cb=_0x522692[_0xfe2c('0x16')],_0x1a4684=_0x12e4c4['offset'],_0x3b3ebd=_0x12e4c4[_0xfe2c('0x17')]+_0x12e4c4[_0xfe2c('0x18')],_0x1dbed4;if(_0x3b3ebd>=_0x5039cb){_0x3b3ebd=_0x5039cb;_0x1dbed4=0xc8;}else{_0x1dbed4=0xce;}_0x2aa7df[_0xfe2c('0x14')](_0x1dbed4);return _0x2aa7df[_0xfe2c('0x19')](_0xfe2c('0x1a'),_0x1a4684+'-'+_0x3b3ebd+'/'+_0x5039cb)[_0xfe2c('0x15')](_0x522692);}return null;};}function patchUpdates(_0x4afea3){return function(_0x22481a){try{jsonpatch[_0xfe2c('0x1b')](_0x22481a,_0x4afea3,!![]);}catch(_0x1d7852){return BPromise[_0xfe2c('0x1c')](_0x1d7852);}return _0x22481a['save']();};}function saveUpdates(_0x1139fe,_0x59bdeb){return function(_0x4e9137){if(_0x4e9137){return _0x4e9137[_0xfe2c('0x1d')](_0x1139fe)[_0xfe2c('0x1e')](function(_0x4bf7c0){return _0x4bf7c0;});}return null;};}function removeEntity(_0xc42d82,_0x1e2519){return function(_0x5e609f){if(_0x5e609f){return _0x5e609f[_0xfe2c('0x1f')]()['then'](function(){var _0x4481ff=_0x5e609f[_0xfe2c('0x20')]({'plain':!![]});var _0x8b5c0d=_0xfe2c('0x21');return db[_0xfe2c('0x22')][_0xfe2c('0x1f')]({'where':{'type':_0x8b5c0d,'resourceId':_0x4481ff['id']}})['then'](function(){return _0x5e609f;});})[_0xfe2c('0x1e')](function(){_0xc42d82[_0xfe2c('0x14')](0xcc)[_0xfe2c('0x23')]();});}};}function handleEntityNotFound(_0x26448c,_0x3486b5){return function(_0x10afde){if(!_0x10afde){_0x26448c['sendStatus'](0x194);}return _0x10afde;};}function handleError(_0x205da8,_0x5e8abf){_0x5e8abf=_0x5e8abf||0x1f4;return function(_0x16daf3){logger[_0xfe2c('0x24')](_0x16daf3[_0xfe2c('0x25')]);if(_0x16daf3['name']){delete _0x16daf3[_0xfe2c('0x26')];}_0x205da8[_0xfe2c('0x14')](_0x5e8abf)['send'](_0x16daf3);};}exports[_0xfe2c('0x27')]=function(_0x1b6eb7,_0x3352e8){var _0x53a8c1={},_0x170026={},_0x1b7c91={'count':0x0,'rows':[]};var _0x55aed7=db['AnalyticMetric'][_0xfe2c('0x28')];_0x170026[_0xfe2c('0x29')]=_[_0xfe2c('0x2a')](_0x55aed7);_0x170026[_0xfe2c('0x2b')]=_[_0xfe2c('0x2a')](_0x1b6eb7['query']);_0x170026[_0xfe2c('0x2c')]=_[_0xfe2c('0x2d')](_0x170026[_0xfe2c('0x29')],_0x170026[_0xfe2c('0x2b')]);_0x53a8c1[_0xfe2c('0x2e')]=_[_0xfe2c('0x2d')](_0x170026[_0xfe2c('0x29')],qs[_0xfe2c('0x2f')](_0x1b6eb7[_0xfe2c('0x2b')][_0xfe2c('0x2f')]));_0x53a8c1[_0xfe2c('0x2e')]=_0x53a8c1[_0xfe2c('0x2e')]['length']?_0x53a8c1[_0xfe2c('0x2e')]:_0x170026[_0xfe2c('0x29')];if(!_0x1b6eb7[_0xfe2c('0x2b')]['hasOwnProperty'](_0xfe2c('0x30'))){_0x53a8c1[_0xfe2c('0x18')]=qs['limit'](_0x1b6eb7[_0xfe2c('0x2b')][_0xfe2c('0x18')]);_0x53a8c1[_0xfe2c('0x17')]=qs['offset'](_0x1b6eb7[_0xfe2c('0x2b')][_0xfe2c('0x17')]);}_0x53a8c1[_0xfe2c('0x31')]=qs[_0xfe2c('0x32')](_0x1b6eb7[_0xfe2c('0x2b')][_0xfe2c('0x32')]);_0x53a8c1[_0xfe2c('0x33')]=qs['filters'](_['pick'](_0x1b6eb7[_0xfe2c('0x2b')],_0x170026[_0xfe2c('0x2c')]));if(_0x1b6eb7[_0xfe2c('0x2b')][_0xfe2c('0x34')]){_0x53a8c1['where']=_[_0xfe2c('0x35')](_0x53a8c1['where'],{'$or':_[_0xfe2c('0x36')](_0x55aed7,function(_0x31ba48){if(_0x31ba48['type'][_0xfe2c('0x37')]!=='VIRTUAL'){var _0x5d726a={};_0x5d726a[_0x31ba48[_0xfe2c('0x38')]]={'$like':'%'+_0x1b6eb7[_0xfe2c('0x2b')][_0xfe2c('0x34')]+'%'};return _0x5d726a;}})});}_0x53a8c1=_[_0xfe2c('0x35')]({},_0x53a8c1,_0x1b6eb7[_0xfe2c('0x39')]);var _0x38d2be={'where':_0x53a8c1[_0xfe2c('0x33')]};return db[_0xfe2c('0x3a')][_0xfe2c('0x16')](_0x38d2be)[_0xfe2c('0x1e')](function(_0x222335){_0x1b7c91['count']=_0x222335;if(_0x1b6eb7[_0xfe2c('0x2b')][_0xfe2c('0x3b')]){_0x53a8c1[_0xfe2c('0x3c')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x53a8c1);})['then'](function(_0xc97c16){_0x1b7c91[_0xfe2c('0x3d')]=_0xc97c16;return _0x1b7c91;})[_0xfe2c('0x1e')](respondWithFilteredResult(_0x3352e8,_0x53a8c1))[_0xfe2c('0x3e')](handleError(_0x3352e8,null));};exports['show']=function(_0x1ed30b,_0x645585){var _0x2337a2={'raw':!![],'where':{'id':_0x1ed30b[_0xfe2c('0x3f')]['id']}},_0x278acb={};_0x278acb['model']=_[_0xfe2c('0x2a')](db[_0xfe2c('0x3a')][_0xfe2c('0x28')]);_0x278acb[_0xfe2c('0x2b')]=_['keys'](_0x1ed30b['query']);_0x278acb[_0xfe2c('0x2c')]=_[_0xfe2c('0x2d')](_0x278acb['model'],_0x278acb[_0xfe2c('0x2b')]);_0x2337a2[_0xfe2c('0x2e')]=_[_0xfe2c('0x2d')](_0x278acb[_0xfe2c('0x29')],qs['fields'](_0x1ed30b[_0xfe2c('0x2b')][_0xfe2c('0x2f')]));_0x2337a2[_0xfe2c('0x2e')]=_0x2337a2[_0xfe2c('0x2e')][_0xfe2c('0x40')]?_0x2337a2[_0xfe2c('0x2e')]:_0x278acb[_0xfe2c('0x29')];if(_0x1ed30b[_0xfe2c('0x2b')]['includeAll']){_0x2337a2[_0xfe2c('0x3c')]=[{'all':!![]}];}_0x2337a2=_['merge']({},_0x2337a2,_0x1ed30b[_0xfe2c('0x39')]);return db[_0xfe2c('0x3a')][_0xfe2c('0x41')](_0x2337a2)[_0xfe2c('0x1e')](handleEntityNotFound(_0x645585,null))['then'](respondWithResult(_0x645585,null))['catch'](handleError(_0x645585,null));};exports['create']=function(_0x56eaca,_0x4ff262){return db[_0xfe2c('0x3a')]['create'](_0x56eaca['body'],{})[_0xfe2c('0x1e')](function(_0x5d76be){var _0x2c02d1=_0x56eaca['user'][_0xfe2c('0x20')]({'plain':!![]});if(!_0x2c02d1)throw new Error(_0xfe2c('0x42'));if(_0x2c02d1[_0xfe2c('0x43')]===_0xfe2c('0x44')){var _0x3cfda2=_0x5d76be['get']({'plain':!![]});var _0x3dbd10=_0xfe2c('0x21');return db[_0xfe2c('0x45')]['find']({'where':{'name':_0x3dbd10,'userProfileId':_0x2c02d1[_0xfe2c('0x46')]},'raw':!![]})[_0xfe2c('0x1e')](function(_0x579b6b){if(_0x579b6b&&_0x579b6b['autoAssociation']===0x0){return db['UserProfileResource'][_0xfe2c('0x47')]({'name':_0x3cfda2[_0xfe2c('0x26')],'resourceId':_0x3cfda2['id'],'type':_0x579b6b[_0xfe2c('0x26')],'sectionId':_0x579b6b['id']},{})[_0xfe2c('0x1e')](function(){return _0x5d76be;});}else{return _0x5d76be;}})[_0xfe2c('0x3e')](function(_0x583dc5){logger[_0xfe2c('0x24')](_0xfe2c('0x48'),_0x583dc5);throw _0x583dc5;});}return _0x5d76be;})[_0xfe2c('0x1e')](respondWithResult(_0x4ff262,0xc9))['catch'](handleError(_0x4ff262,null));};exports['update']=function(_0x3e7c9f,_0xa711b0){if(_0x3e7c9f[_0xfe2c('0x49')]['id']){delete _0x3e7c9f[_0xfe2c('0x49')]['id'];}return db[_0xfe2c('0x3a')][_0xfe2c('0x41')]({'where':{'id':_0x3e7c9f[_0xfe2c('0x3f')]['id']}})[_0xfe2c('0x1e')](handleEntityNotFound(_0xa711b0,null))[_0xfe2c('0x1e')](saveUpdates(_0x3e7c9f[_0xfe2c('0x49')],null))['then'](respondWithResult(_0xa711b0,null))[_0xfe2c('0x3e')](handleError(_0xa711b0,null));};exports[_0xfe2c('0x1f')]=function(_0x3b4485,_0x18259c){return db[_0xfe2c('0x3a')][_0xfe2c('0x41')]({'where':{'id':_0x3b4485[_0xfe2c('0x3f')]['id']}})[_0xfe2c('0x1e')](handleEntityNotFound(_0x18259c,null))[_0xfe2c('0x1e')](removeEntity(_0x18259c,null))[_0xfe2c('0x3e')](handleError(_0x18259c,null));}; \ No newline at end of file +var _0x7c88=['keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','type','key','VIRTUAL','filter','options','AnalyticMetric','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','save','update','then','get','Metrics','UserProfileResource','destroy','sendStatus','name','index','model','query'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7c88,0x156));var _0x87c8=function(_0x22fda3,_0x1b28cc){_0x22fda3=_0x22fda3-0x0;var _0x19e120=_0x7c88[_0x22fda3];return _0x19e120;};'use strict';var pdf=require(_0x87c8('0x0'));var emlformat=require(_0x87c8('0x1'));var rimraf=require(_0x87c8('0x2'));var zipdir=require(_0x87c8('0x3'));var jsonpatch=require(_0x87c8('0x4'));var rp=require('request-promise');var moment=require(_0x87c8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x87c8('0x6'));var util=require(_0x87c8('0x7'));var path=require('path');var sox=require(_0x87c8('0x8'));var csv=require(_0x87c8('0x9'));var ejs=require(_0x87c8('0xa'));var fs=require('fs');var _=require(_0x87c8('0xb'));var squel=require(_0x87c8('0xc'));var crypto=require(_0x87c8('0xd'));var jsforce=require(_0x87c8('0xe'));var deskjs=require(_0x87c8('0xf'));var toCsv=require('to-csv');var querystring=require(_0x87c8('0x10'));var Papa=require(_0x87c8('0x11'));var authService=require(_0x87c8('0x12'));var hardwareService=require(_0x87c8('0x13'));var Redis=require('ioredis');var qs=require(_0x87c8('0x14'));var logger=require(_0x87c8('0x15'))(_0x87c8('0x16'));var utils=require('../../config/utils');var config=require(_0x87c8('0x17'));var db=require(_0x87c8('0x18'))['db'];function respondWithStatusCode(_0x583691,_0x35d178){_0x35d178=_0x35d178||0xcc;return function(_0x487b71){if(_0x487b71){return _0x583691['sendStatus'](_0x35d178);}return _0x583691[_0x87c8('0x19')](_0x35d178)[_0x87c8('0x1a')]();};}function respondWithResult(_0x1c4e4c,_0x2954d2){_0x2954d2=_0x2954d2||0xc8;return function(_0x39d7f8){if(_0x39d7f8){return _0x1c4e4c['status'](_0x2954d2)[_0x87c8('0x1b')](_0x39d7f8);}};}function respondWithFilteredResult(_0x2c1115,_0x3a0c5a){return function(_0x5b54dc){if(_0x5b54dc){var _0x154341=_0x5b54dc['count'],_0x4f6b72=_0x3a0c5a[_0x87c8('0x1c')],_0x61784a=_0x3a0c5a[_0x87c8('0x1c')]+_0x3a0c5a[_0x87c8('0x1d')],_0x1dad15;if(_0x61784a>=_0x154341){_0x61784a=_0x154341;_0x1dad15=0xc8;}else{_0x1dad15=0xce;}_0x2c1115['status'](_0x1dad15);return _0x2c1115[_0x87c8('0x1e')]('Content-Range',_0x4f6b72+'-'+_0x61784a+'/'+_0x154341)[_0x87c8('0x1b')](_0x5b54dc);}return null;};}function patchUpdates(_0x2320b7){return function(_0x11bba0){try{jsonpatch['apply'](_0x11bba0,_0x2320b7,!![]);}catch(_0x456d23){return BPromise['reject'](_0x456d23);}return _0x11bba0[_0x87c8('0x1f')]();};}function saveUpdates(_0x14f0ac,_0x288a4c){return function(_0x3377d8){if(_0x3377d8){return _0x3377d8[_0x87c8('0x20')](_0x14f0ac)['then'](function(_0x381ef2){return _0x381ef2;});}return null;};}function removeEntity(_0x4d4a0b,_0x150174){return function(_0x422df9){if(_0x422df9){return _0x422df9['destroy']()[_0x87c8('0x21')](function(){var _0x520cb5=_0x422df9[_0x87c8('0x22')]({'plain':!![]});var _0x31102a=_0x87c8('0x23');return db[_0x87c8('0x24')][_0x87c8('0x25')]({'where':{'type':_0x31102a,'resourceId':_0x520cb5['id']}})[_0x87c8('0x21')](function(){return _0x422df9;});})[_0x87c8('0x21')](function(){_0x4d4a0b[_0x87c8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x111101,_0x4f4e33){return function(_0x45642e){if(!_0x45642e){_0x111101[_0x87c8('0x26')](0x194);}return _0x45642e;};}function handleError(_0x56a184,_0x522ef9){_0x522ef9=_0x522ef9||0x1f4;return function(_0x13fbb6){logger['error'](_0x13fbb6['stack']);if(_0x13fbb6[_0x87c8('0x27')]){delete _0x13fbb6['name'];}_0x56a184[_0x87c8('0x19')](_0x522ef9)['send'](_0x13fbb6);};}exports[_0x87c8('0x28')]=function(_0x5b8853,_0x40284f){var _0x380ed6={},_0x3c36e2={},_0x37021c={'count':0x0,'rows':[]};var _0x542378=db['AnalyticMetric']['rawAttributes'];_0x3c36e2[_0x87c8('0x29')]=_['keys'](_0x542378);_0x3c36e2[_0x87c8('0x2a')]=_[_0x87c8('0x2b')](_0x5b8853['query']);_0x3c36e2['filters']=_[_0x87c8('0x2c')](_0x3c36e2[_0x87c8('0x29')],_0x3c36e2['query']);_0x380ed6[_0x87c8('0x2d')]=_[_0x87c8('0x2c')](_0x3c36e2[_0x87c8('0x29')],qs[_0x87c8('0x2e')](_0x5b8853[_0x87c8('0x2a')]['fields']));_0x380ed6[_0x87c8('0x2d')]=_0x380ed6[_0x87c8('0x2d')][_0x87c8('0x2f')]?_0x380ed6[_0x87c8('0x2d')]:_0x3c36e2[_0x87c8('0x29')];if(!_0x5b8853[_0x87c8('0x2a')][_0x87c8('0x30')](_0x87c8('0x31'))){_0x380ed6[_0x87c8('0x1d')]=qs[_0x87c8('0x1d')](_0x5b8853['query']['limit']);_0x380ed6[_0x87c8('0x1c')]=qs[_0x87c8('0x1c')](_0x5b8853[_0x87c8('0x2a')][_0x87c8('0x1c')]);}_0x380ed6[_0x87c8('0x32')]=qs[_0x87c8('0x33')](_0x5b8853[_0x87c8('0x2a')][_0x87c8('0x33')]);_0x380ed6['where']=qs[_0x87c8('0x34')](_['pick'](_0x5b8853[_0x87c8('0x2a')],_0x3c36e2['filters']));if(_0x5b8853[_0x87c8('0x2a')]['filter']){_0x380ed6[_0x87c8('0x35')]=_[_0x87c8('0x36')](_0x380ed6[_0x87c8('0x35')],{'$or':_['map'](_0x542378,function(_0x417285){if(_0x417285[_0x87c8('0x37')][_0x87c8('0x38')]!==_0x87c8('0x39')){var _0x674202={};_0x674202[_0x417285['field']]={'$like':'%'+_0x5b8853['query'][_0x87c8('0x3a')]+'%'};return _0x674202;}})});}_0x380ed6=_['merge']({},_0x380ed6,_0x5b8853[_0x87c8('0x3b')]);var _0x3ac77f={'where':_0x380ed6['where']};return db[_0x87c8('0x3c')][_0x87c8('0x3d')](_0x3ac77f)[_0x87c8('0x21')](function(_0xa505f5){_0x37021c['count']=_0xa505f5;if(_0x5b8853[_0x87c8('0x2a')][_0x87c8('0x3e')]){_0x380ed6[_0x87c8('0x3f')]=[{'all':!![]}];}return db[_0x87c8('0x3c')][_0x87c8('0x40')](_0x380ed6);})[_0x87c8('0x21')](function(_0x4909cd){_0x37021c[_0x87c8('0x41')]=_0x4909cd;return _0x37021c;})[_0x87c8('0x21')](respondWithFilteredResult(_0x40284f,_0x380ed6))[_0x87c8('0x42')](handleError(_0x40284f,null));};exports[_0x87c8('0x43')]=function(_0x160cb8,_0x3c0774){var _0x22a0ff={'raw':!![],'where':{'id':_0x160cb8[_0x87c8('0x44')]['id']}},_0x2b4ce9={};_0x2b4ce9[_0x87c8('0x29')]=_[_0x87c8('0x2b')](db[_0x87c8('0x3c')][_0x87c8('0x45')]);_0x2b4ce9[_0x87c8('0x2a')]=_[_0x87c8('0x2b')](_0x160cb8['query']);_0x2b4ce9[_0x87c8('0x34')]=_['intersection'](_0x2b4ce9[_0x87c8('0x29')],_0x2b4ce9[_0x87c8('0x2a')]);_0x22a0ff['attributes']=_[_0x87c8('0x2c')](_0x2b4ce9[_0x87c8('0x29')],qs[_0x87c8('0x2e')](_0x160cb8[_0x87c8('0x2a')][_0x87c8('0x2e')]));_0x22a0ff['attributes']=_0x22a0ff['attributes'][_0x87c8('0x2f')]?_0x22a0ff[_0x87c8('0x2d')]:_0x2b4ce9[_0x87c8('0x29')];if(_0x160cb8[_0x87c8('0x2a')][_0x87c8('0x3e')]){_0x22a0ff[_0x87c8('0x3f')]=[{'all':!![]}];}_0x22a0ff=_[_0x87c8('0x36')]({},_0x22a0ff,_0x160cb8[_0x87c8('0x3b')]);return db[_0x87c8('0x3c')][_0x87c8('0x46')](_0x22a0ff)['then'](handleEntityNotFound(_0x3c0774,null))[_0x87c8('0x21')](respondWithResult(_0x3c0774,null))[_0x87c8('0x42')](handleError(_0x3c0774,null));};exports[_0x87c8('0x47')]=function(_0x2c348d,_0x4f3a5c){return db[_0x87c8('0x3c')][_0x87c8('0x47')](_0x2c348d[_0x87c8('0x48')],{})[_0x87c8('0x21')](function(_0x11a9ae){var _0x43c9b1=_0x2c348d[_0x87c8('0x49')][_0x87c8('0x22')]({'plain':!![]});if(!_0x43c9b1)throw new Error(_0x87c8('0x4a'));if(_0x43c9b1['role']===_0x87c8('0x49')){var _0x38cde5=_0x11a9ae['get']({'plain':!![]});var _0x2f3cb0=_0x87c8('0x23');return db['UserProfileSection'][_0x87c8('0x46')]({'where':{'name':_0x2f3cb0,'userProfileId':_0x43c9b1[_0x87c8('0x4b')]},'raw':!![]})[_0x87c8('0x21')](function(_0xd77215){if(_0xd77215&&_0xd77215['autoAssociation']===0x0){return db[_0x87c8('0x24')]['create']({'name':_0x38cde5[_0x87c8('0x27')],'resourceId':_0x38cde5['id'],'type':_0xd77215[_0x87c8('0x27')],'sectionId':_0xd77215['id']},{})[_0x87c8('0x21')](function(){return _0x11a9ae;});}else{return _0x11a9ae;}})[_0x87c8('0x42')](function(_0x4c041c){logger['error'](_0x87c8('0x4c'),_0x4c041c);throw _0x4c041c;});}return _0x11a9ae;})['then'](respondWithResult(_0x4f3a5c,0xc9))[_0x87c8('0x42')](handleError(_0x4f3a5c,null));};exports['update']=function(_0x2e1121,_0x2dcabb){if(_0x2e1121['body']['id']){delete _0x2e1121[_0x87c8('0x48')]['id'];}return db[_0x87c8('0x3c')][_0x87c8('0x46')]({'where':{'id':_0x2e1121[_0x87c8('0x44')]['id']}})[_0x87c8('0x21')](handleEntityNotFound(_0x2dcabb,null))[_0x87c8('0x21')](saveUpdates(_0x2e1121[_0x87c8('0x48')],null))[_0x87c8('0x21')](respondWithResult(_0x2dcabb,null))[_0x87c8('0x42')](handleError(_0x2dcabb,null));};exports[_0x87c8('0x25')]=function(_0x184999,_0x31fa9c){return db['AnalyticMetric'][_0x87c8('0x46')]({'where':{'id':_0x184999['params']['id']}})[_0x87c8('0x21')](handleEntityNotFound(_0x31fa9c,null))[_0x87c8('0x21')](removeEntity(_0x31fa9c,null))[_0x87c8('0x42')](handleError(_0x31fa9c,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index cde63b9..abd52e5 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 _0x2924=['AnalyticMetric','lodash','bluebird','exports','define'];(function(_0x28d679,_0x1ffe40){var _0x3ae338=function(_0x532d3a){while(--_0x532d3a){_0x28d679['push'](_0x28d679['shift']());}};_0x3ae338(++_0x1ffe40);}(_0x2924,0x92));var _0x4292=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0x2924[_0x1d87fc];return _0x492b56;};'use strict';var _=require(_0x4292('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4292('0x1'));var rp=require('request-promise');var attributes=require('./analyticMetric.attributes');module[_0x4292('0x2')]=function(_0x1da117,_0x50712e){return _0x1da117[_0x4292('0x3')](_0x4292('0x4'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28bf=['util','../../config/logger','moment','bluebird','request-promise','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash'];(function(_0x1cf55e,_0x5151f1){var _0x53a978=function(_0x10cb0d){while(--_0x10cb0d){_0x1cf55e['push'](_0x1cf55e['shift']());}};_0x53a978(++_0x5151f1);}(_0x28bf,0x78));var _0xf28b=function(_0x12531d,_0x3a5747){_0x12531d=_0x12531d-0x0;var _0x16ea2e=_0x28bf[_0x12531d];return _0x16ea2e;};'use strict';var _=require(_0xf28b('0x0'));var util=require(_0xf28b('0x1'));var logger=require(_0xf28b('0x2'))('api');var moment=require(_0xf28b('0x3'));var BPromise=require(_0xf28b('0x4'));var rp=require(_0xf28b('0x5'));var attributes=require(_0xf28b('0x6'));module[_0xf28b('0x7')]=function(_0x65f141,_0x2f188d){return _0x65f141[_0xf28b('0x8')](_0xf28b('0x9'),attributes,{'tableName':_0xf28b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 78760ef..1cf3687 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 _0x4a9c=['AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x458140,_0x20964a){var _0x5e4ba1=function(_0x240ca4){while(--_0x240ca4){_0x458140['push'](_0x458140['shift']());}};_0x5e4ba1(++_0x20964a);}(_0x4a9c,0xcc));var _0xc4a9=function(_0x51d724,_0x3114bc){_0x51d724=_0x51d724-0x0;var _0x4390dc=_0x4a9c[_0x51d724];return _0x4390dc;};'use strict';var _=require(_0xc4a9('0x0'));var util=require(_0xc4a9('0x1'));var moment=require(_0xc4a9('0x2'));var BPromise=require(_0xc4a9('0x3'));var rs=require(_0xc4a9('0x4'));var fs=require('fs');var Redis=require(_0xc4a9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc4a9('0x6'));var logger=require(_0xc4a9('0x7'))(_0xc4a9('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc4a9('0x9')][_0xc4a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45f405,_0x569ce3,_0x49bbe0){return new BPromise(function(_0x2853c8,_0x57f8b5){return client['request'](_0x45f405,_0x49bbe0)[_0xc4a9('0xb')](function(_0x29272c){logger[_0xc4a9('0xc')](_0xc4a9('0xd'),_0x569ce3,_0xc4a9('0xe'));logger[_0xc4a9('0xf')](_0xc4a9('0x10'),_0x569ce3,_0xc4a9('0xe'),JSON[_0xc4a9('0x11')](_0x29272c));if(_0x29272c[_0xc4a9('0x12')]){if(_0x29272c[_0xc4a9('0x12')]['code']===0x1f4){logger[_0xc4a9('0x12')](_0xc4a9('0xd'),_0x569ce3,_0x29272c[_0xc4a9('0x12')]['message']);return _0x57f8b5(_0x29272c[_0xc4a9('0x12')][_0xc4a9('0x13')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x569ce3,_0x29272c[_0xc4a9('0x12')]['message']);return _0x2853c8(_0x29272c[_0xc4a9('0x12')][_0xc4a9('0x13')]);}else{logger[_0xc4a9('0xc')](_0xc4a9('0xd'),_0x569ce3,_0xc4a9('0xe'));_0x2853c8(_0x29272c['result'][_0xc4a9('0x13')]);}})['catch'](function(_0x5e83dc){logger['error'](_0xc4a9('0xd'),_0x569ce3,_0x5e83dc);_0x57f8b5(_0x5e83dc);});});} \ No newline at end of file +var _0x5db8=['info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x5db8,0xbb));var _0x85db=function(_0x4bcb3c,_0x192122){_0x4bcb3c=_0x4bcb3c-0x0;var _0xfe09bb=_0x5db8[_0x4bcb3c];return _0xfe09bb;};'use strict';var _=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var moment=require(_0x85db('0x2'));var BPromise=require('bluebird');var rs=require(_0x85db('0x3'));var fs=require('fs');var Redis=require(_0x85db('0x4'));var db=require(_0x85db('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x85db('0x6'));var config=require(_0x85db('0x7'));var jayson=require(_0x85db('0x8'));var client=jayson[_0x85db('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x489b13,_0x2b9f25,_0x3a10dd){return new BPromise(function(_0xc6fd00,_0x308988){return client['request'](_0x489b13,_0x3a10dd)[_0x85db('0xa')](function(_0x54f0c1){logger[_0x85db('0xb')](_0x85db('0xc'),_0x2b9f25,_0x85db('0xd'));logger[_0x85db('0xe')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x2b9f25,'request\x20sent',JSON['stringify'](_0x54f0c1));if(_0x54f0c1[_0x85db('0xf')]){if(_0x54f0c1[_0x85db('0xf')]['code']===0x1f4){logger[_0x85db('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x2b9f25,_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);return _0x308988(_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);}logger[_0x85db('0xf')](_0x85db('0xc'),_0x2b9f25,_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);return _0xc6fd00(_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);}else{logger[_0x85db('0xb')](_0x85db('0xc'),_0x2b9f25,_0x85db('0xd'));_0xc6fd00(_0x54f0c1['result'][_0x85db('0x10')]);}})[_0x85db('0x11')](function(_0x11e7da){logger[_0x85db('0xf')](_0x85db('0xc'),_0x2b9f25,_0x11e7da);_0x308988(_0x11e7da);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 63d127c..633e534 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 _0x1775=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports'];(function(_0x1314d4,_0xb0b16d){var _0x584ba5=function(_0x394269){while(--_0x394269){_0x1314d4['push'](_0x1314d4['shift']());}};_0x584ba5(++_0xb0b16d);}(_0x1775,0x1db));var _0x5177=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1775[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x5177('0x0'));var path=require(_0x5177('0x1'));var timeout=require(_0x5177('0x2'));var express=require(_0x5177('0x3'));var router=express[_0x5177('0x4')]();var auth=require(_0x5177('0x5'));var interaction=require(_0x5177('0x6'));var config=require(_0x5177('0x7'));var controller=require(_0x5177('0x8'));router[_0x5177('0x9')]('/',auth[_0x5177('0xa')](),controller[_0x5177('0xb')]);router[_0x5177('0x9')](_0x5177('0xc'),auth[_0x5177('0xa')](),controller[_0x5177('0xd')]);router[_0x5177('0xe')]('/',auth[_0x5177('0xa')](),controller[_0x5177('0xf')]);router[_0x5177('0x10')](_0x5177('0xc'),auth[_0x5177('0xa')](),controller['update']);router['delete'](_0x5177('0xc'),auth[_0x5177('0xa')](),controller[_0x5177('0x11')]);module[_0x5177('0x12')]=router; \ No newline at end of file +var _0x3de3=['../../config/environment','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x166e33,_0x127e77){var _0x1a2409=function(_0x48edd3){while(--_0x48edd3){_0x166e33['push'](_0x166e33['shift']());}};_0x1a2409(++_0x127e77);}(_0x3de3,0x1ce));var _0x33de=function(_0xb45998,_0x350e69){_0xb45998=_0xb45998-0x0;var _0x30572f=_0x3de3[_0xb45998];return _0x30572f;};'use strict';var multer=require(_0x33de('0x0'));var util=require('util');var path=require(_0x33de('0x1'));var timeout=require(_0x33de('0x2'));var express=require('express');var router=express[_0x33de('0x3')]();var auth=require(_0x33de('0x4'));var interaction=require(_0x33de('0x5'));var config=require(_0x33de('0x6'));var controller=require('./analyticMetric.controller');router[_0x33de('0x7')]('/',auth[_0x33de('0x8')](),controller['index']);router[_0x33de('0x7')]('/:id',auth[_0x33de('0x8')](),controller[_0x33de('0x9')]);router[_0x33de('0xa')]('/',auth['isAuthenticated'](),controller[_0x33de('0xb')]);router[_0x33de('0xc')](_0x33de('0xd'),auth['isAuthenticated'](),controller[_0x33de('0xe')]);router[_0x33de('0xf')](_0x33de('0xd'),auth[_0x33de('0x8')](),controller[_0x33de('0x10')]);module[_0x33de('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 942e7de..e3ea6c5 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 _0x33e6=['exports','TEXT'];(function(_0xd578cb,_0x2167a3){var _0x775533=function(_0x1c340d){while(--_0x1c340d){_0xd578cb['push'](_0xd578cb['shift']());}};_0x775533(++_0x2167a3);}(_0x33e6,0x1aa));var _0x633e=function(_0x247556,_0x11b925){_0x247556=_0x247556-0x0;var _0x3ea230=_0x33e6[_0x247556];return _0x3ea230;};'use strict';var Sequelize=require('sequelize');module[_0x633e('0x0')]={'tree':{'type':Sequelize[_0x633e('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xb1ca=['exports','TEXT','sequelize'];(function(_0x2a6474,_0x1f7b9c){var _0x5f55eb=function(_0x1f1c25){while(--_0x1f1c25){_0x2a6474['push'](_0x2a6474['shift']());}};_0x5f55eb(++_0x1f7b9c);}(_0xb1ca,0x128));var _0xab1c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xb1ca[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xab1c('0x0'));module[_0xab1c('0x1')]={'tree':{'type':Sequelize[_0xab1c('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index d4dba25..2f0037e 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 _0x0e4b=['stack','name','index','AnalyticTreeReport','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','map','type','merge','includeAll','params','include','options','find','catch','create','body','html-pdf','eml-format','rimraf','fast-json-patch','util','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','sendStatus','error'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x5b7802,_0x41639b){_0x5b7802=_0x5b7802-0x0;var _0x263f29=_0x0e4b[_0x5b7802];return _0x263f29;};'use strict';var pdf=require(_0xb0e4('0x0'));var emlformat=require(_0xb0e4('0x1'));var rimraf=require(_0xb0e4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb0e4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb0e4('0x4'));var path=require(_0xb0e4('0x5'));var sox=require('sox');var csv=require(_0xb0e4('0x6'));var ejs=require(_0xb0e4('0x7'));var fs=require('fs');var _=require(_0xb0e4('0x8'));var squel=require(_0xb0e4('0x9'));var crypto=require(_0xb0e4('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb0e4('0x6'));var querystring=require(_0xb0e4('0xb'));var Papa=require(_0xb0e4('0xc'));var authService=require(_0xb0e4('0xd'));var hardwareService=require(_0xb0e4('0xe'));var Redis=require(_0xb0e4('0xf'));var qs=require(_0xb0e4('0x10'));var logger=require(_0xb0e4('0x11'))(_0xb0e4('0x12'));var utils=require(_0xb0e4('0x13'));var config=require(_0xb0e4('0x14'));var db=require(_0xb0e4('0x15'))['db'];function respondWithStatusCode(_0x17ab2e,_0x3fdf0f){_0x3fdf0f=_0x3fdf0f||0xcc;return function(_0xdfa7fd){if(_0xdfa7fd){return _0x17ab2e['sendStatus'](_0x3fdf0f);}return _0x17ab2e[_0xb0e4('0x16')](_0x3fdf0f)[_0xb0e4('0x17')]();};}function respondWithResult(_0x585441,_0x39fbf7){_0x39fbf7=_0x39fbf7||0xc8;return function(_0x26f664){if(_0x26f664){return _0x585441[_0xb0e4('0x16')](_0x39fbf7)[_0xb0e4('0x18')](_0x26f664);}};}function respondWithFilteredResult(_0x1e1ca5,_0x57ba9d){return function(_0x4b3f3f){if(_0x4b3f3f){var _0x17419f=_0x4b3f3f[_0xb0e4('0x19')],_0x3a140c=_0x57ba9d[_0xb0e4('0x1a')],_0x5b219a=_0x57ba9d[_0xb0e4('0x1a')]+_0x57ba9d[_0xb0e4('0x1b')],_0x152ceb;if(_0x5b219a>=_0x17419f){_0x5b219a=_0x17419f;_0x152ceb=0xc8;}else{_0x152ceb=0xce;}_0x1e1ca5[_0xb0e4('0x16')](_0x152ceb);return _0x1e1ca5['set']('Content-Range',_0x3a140c+'-'+_0x5b219a+'/'+_0x17419f)['json'](_0x4b3f3f);}return null;};}function patchUpdates(_0x42e43d){return function(_0x41b3c1){try{jsonpatch[_0xb0e4('0x1c')](_0x41b3c1,_0x42e43d,!![]);}catch(_0x690682){return BPromise[_0xb0e4('0x1d')](_0x690682);}return _0x41b3c1[_0xb0e4('0x1e')]();};}function saveUpdates(_0x54b7ff,_0x436667){return function(_0x459684){if(_0x459684){return _0x459684[_0xb0e4('0x1f')](_0x54b7ff)[_0xb0e4('0x20')](function(_0x4bbb10){return _0x4bbb10;});}return null;};}function removeEntity(_0x501668,_0x4f2488){return function(_0x52b55e){if(_0x52b55e){return _0x52b55e[_0xb0e4('0x21')]()[_0xb0e4('0x20')](function(){_0x501668[_0xb0e4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a6810,_0x4d4f7f){return function(_0x4bc636){if(!_0x4bc636){_0x1a6810[_0xb0e4('0x22')](0x194);}return _0x4bc636;};}function handleError(_0x39db8d,_0x139c84){_0x139c84=_0x139c84||0x1f4;return function(_0x26420c){logger[_0xb0e4('0x23')](_0x26420c[_0xb0e4('0x24')]);if(_0x26420c[_0xb0e4('0x25')]){delete _0x26420c['name'];}_0x39db8d[_0xb0e4('0x16')](_0x139c84)['send'](_0x26420c);};}exports[_0xb0e4('0x26')]=function(_0x22033f,_0x37b2fc){var _0xfef785={},_0x4fc624={},_0x1ed356={'count':0x0,'rows':[]};var _0x2ccef1=db[_0xb0e4('0x27')][_0xb0e4('0x28')];_0x4fc624[_0xb0e4('0x29')]=_[_0xb0e4('0x2a')](_0x2ccef1);_0x4fc624[_0xb0e4('0x2b')]=_[_0xb0e4('0x2a')](_0x22033f['query']);_0x4fc624[_0xb0e4('0x2c')]=_['intersection'](_0x4fc624[_0xb0e4('0x29')],_0x4fc624[_0xb0e4('0x2b')]);_0xfef785['attributes']=_[_0xb0e4('0x2d')](_0x4fc624[_0xb0e4('0x29')],qs[_0xb0e4('0x2e')](_0x22033f[_0xb0e4('0x2b')][_0xb0e4('0x2e')]));_0xfef785[_0xb0e4('0x2f')]=_0xfef785['attributes'][_0xb0e4('0x30')]?_0xfef785['attributes']:_0x4fc624['model'];if(!_0x22033f[_0xb0e4('0x2b')]['hasOwnProperty'](_0xb0e4('0x31'))){_0xfef785['limit']=qs[_0xb0e4('0x1b')](_0x22033f['query'][_0xb0e4('0x1b')]);_0xfef785[_0xb0e4('0x1a')]=qs[_0xb0e4('0x1a')](_0x22033f['query'][_0xb0e4('0x1a')]);}_0xfef785['order']=qs[_0xb0e4('0x32')](_0x22033f[_0xb0e4('0x2b')][_0xb0e4('0x32')]);_0xfef785[_0xb0e4('0x33')]=qs[_0xb0e4('0x2c')](_['pick'](_0x22033f[_0xb0e4('0x2b')],_0x4fc624['filters']));if(_0x22033f[_0xb0e4('0x2b')][_0xb0e4('0x34')]){_0xfef785[_0xb0e4('0x33')]=_['merge'](_0xfef785[_0xb0e4('0x33')],{'$or':_[_0xb0e4('0x35')](_0x2ccef1,function(_0x4708ce){if(_0x4708ce[_0xb0e4('0x36')]['key']!=='VIRTUAL'){var _0x4af7f6={};_0x4af7f6[_0x4708ce['field']]={'$like':'%'+_0x22033f[_0xb0e4('0x2b')]['filter']+'%'};return _0x4af7f6;}})});}_0xfef785=_[_0xb0e4('0x37')]({},_0xfef785,_0x22033f['options']);var _0x2415ce={'where':_0xfef785['where']};return db[_0xb0e4('0x27')][_0xb0e4('0x19')](_0x2415ce)[_0xb0e4('0x20')](function(_0x270b6e){_0x1ed356['count']=_0x270b6e;if(_0x22033f[_0xb0e4('0x2b')][_0xb0e4('0x38')]){_0xfef785['include']=[{'all':!![]}];}return db[_0xb0e4('0x27')]['findAll'](_0xfef785);})[_0xb0e4('0x20')](function(_0x15d92c){_0x1ed356['rows']=_0x15d92c;return _0x1ed356;})[_0xb0e4('0x20')](respondWithFilteredResult(_0x37b2fc,_0xfef785))['catch'](handleError(_0x37b2fc,null));};exports['show']=function(_0x4ec8c6,_0x114098){var _0x3fbde8={'raw':!![],'where':{'id':_0x4ec8c6[_0xb0e4('0x39')]['id']}},_0x5d2d60={};_0x5d2d60['model']=_[_0xb0e4('0x2a')](db[_0xb0e4('0x27')][_0xb0e4('0x28')]);_0x5d2d60[_0xb0e4('0x2b')]=_['keys'](_0x4ec8c6[_0xb0e4('0x2b')]);_0x5d2d60[_0xb0e4('0x2c')]=_[_0xb0e4('0x2d')](_0x5d2d60[_0xb0e4('0x29')],_0x5d2d60[_0xb0e4('0x2b')]);_0x3fbde8[_0xb0e4('0x2f')]=_[_0xb0e4('0x2d')](_0x5d2d60[_0xb0e4('0x29')],qs[_0xb0e4('0x2e')](_0x4ec8c6[_0xb0e4('0x2b')][_0xb0e4('0x2e')]));_0x3fbde8[_0xb0e4('0x2f')]=_0x3fbde8[_0xb0e4('0x2f')][_0xb0e4('0x30')]?_0x3fbde8[_0xb0e4('0x2f')]:_0x5d2d60[_0xb0e4('0x29')];if(_0x4ec8c6['query'][_0xb0e4('0x38')]){_0x3fbde8[_0xb0e4('0x3a')]=[{'all':!![]}];}_0x3fbde8=_[_0xb0e4('0x37')]({},_0x3fbde8,_0x4ec8c6[_0xb0e4('0x3b')]);return db['AnalyticTreeReport'][_0xb0e4('0x3c')](_0x3fbde8)[_0xb0e4('0x20')](handleEntityNotFound(_0x114098,null))['then'](respondWithResult(_0x114098,null))[_0xb0e4('0x3d')](handleError(_0x114098,null));};exports[_0xb0e4('0x3e')]=function(_0x47107e,_0x40a365){return db['AnalyticTreeReport'][_0xb0e4('0x3e')](_0x47107e[_0xb0e4('0x3f')],{})[_0xb0e4('0x20')](respondWithResult(_0x40a365,0xc9))[_0xb0e4('0x3d')](handleError(_0x40a365,null));};exports[_0xb0e4('0x1f')]=function(_0x2ffb16,_0x2a5b12){if(_0x2ffb16[_0xb0e4('0x3f')]['id']){delete _0x2ffb16[_0xb0e4('0x3f')]['id'];}return db[_0xb0e4('0x27')][_0xb0e4('0x3c')]({'where':{'id':_0x2ffb16['params']['id']}})[_0xb0e4('0x20')](handleEntityNotFound(_0x2a5b12,null))[_0xb0e4('0x20')](saveUpdates(_0x2ffb16['body'],null))['then'](respondWithResult(_0x2a5b12,null))['catch'](handleError(_0x2a5b12,null));};exports[_0xb0e4('0x21')]=function(_0x335b20,_0x4c2036){return db['AnalyticTreeReport']['find']({'where':{'id':_0x335b20['params']['id']}})['then'](handleEntityNotFound(_0x4c2036,null))['then'](removeEntity(_0x4c2036,null))[_0xb0e4('0x3d')](handleError(_0x4c2036,null));}; \ No newline at end of file +var _0x5d95=['Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','AnalyticTreeReport','rawAttributes','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','set'];(function(_0x1a1f19,_0x2d656f){var _0x3a4c0c=function(_0x42be49){while(--_0x42be49){_0x1a1f19['push'](_0x1a1f19['shift']());}};_0x3a4c0c(++_0x2d656f);}(_0x5d95,0x184));var _0x55d9=function(_0x8bb9af,_0x3d1e63){_0x8bb9af=_0x8bb9af-0x0;var _0x3073d5=_0x5d95[_0x8bb9af];return _0x3073d5;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x55d9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x55d9('0x1'));var rp=require(_0x55d9('0x2'));var moment=require(_0x55d9('0x3'));var BPromise=require(_0x55d9('0x4'));var Mustache=require(_0x55d9('0x5'));var util=require(_0x55d9('0x6'));var path=require('path');var sox=require(_0x55d9('0x7'));var csv=require('to-csv');var ejs=require(_0x55d9('0x8'));var fs=require('fs');var _=require(_0x55d9('0x9'));var squel=require(_0x55d9('0xa'));var crypto=require(_0x55d9('0xb'));var jsforce=require(_0x55d9('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x55d9('0xd'));var authService=require(_0x55d9('0xe'));var hardwareService=require(_0x55d9('0xf'));var Redis=require('ioredis');var qs=require(_0x55d9('0x10'));var logger=require(_0x55d9('0x11'))('api');var utils=require(_0x55d9('0x12'));var config=require(_0x55d9('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x247bba,_0x5a8bfc){_0x5a8bfc=_0x5a8bfc||0xcc;return function(_0x3131a9){if(_0x3131a9){return _0x247bba[_0x55d9('0x14')](_0x5a8bfc);}return _0x247bba['status'](_0x5a8bfc)['end']();};}function respondWithResult(_0x46edce,_0x40e54a){_0x40e54a=_0x40e54a||0xc8;return function(_0x2e5a97){if(_0x2e5a97){return _0x46edce[_0x55d9('0x15')](_0x40e54a)[_0x55d9('0x16')](_0x2e5a97);}};}function respondWithFilteredResult(_0x576f89,_0x56d607){return function(_0x4fe106){if(_0x4fe106){var _0x1061c3=_0x4fe106[_0x55d9('0x17')],_0x253a57=_0x56d607[_0x55d9('0x18')],_0x8dab84=_0x56d607[_0x55d9('0x18')]+_0x56d607['limit'],_0x12fa95;if(_0x8dab84>=_0x1061c3){_0x8dab84=_0x1061c3;_0x12fa95=0xc8;}else{_0x12fa95=0xce;}_0x576f89['status'](_0x12fa95);return _0x576f89[_0x55d9('0x19')](_0x55d9('0x1a'),_0x253a57+'-'+_0x8dab84+'/'+_0x1061c3)[_0x55d9('0x16')](_0x4fe106);}return null;};}function patchUpdates(_0x2caa8b){return function(_0x2da099){try{jsonpatch[_0x55d9('0x1b')](_0x2da099,_0x2caa8b,!![]);}catch(_0x58adc7){return BPromise[_0x55d9('0x1c')](_0x58adc7);}return _0x2da099[_0x55d9('0x1d')]();};}function saveUpdates(_0x3a4d84,_0x56e752){return function(_0xe535f5){if(_0xe535f5){return _0xe535f5[_0x55d9('0x1e')](_0x3a4d84)[_0x55d9('0x1f')](function(_0x509ac6){return _0x509ac6;});}return null;};}function removeEntity(_0x31e5f8,_0x3e7361){return function(_0x1588d2){if(_0x1588d2){return _0x1588d2[_0x55d9('0x20')]()[_0x55d9('0x1f')](function(){_0x31e5f8[_0x55d9('0x15')](0xcc)[_0x55d9('0x21')]();});}};}function handleEntityNotFound(_0x4e6c18,_0x4ab3c1){return function(_0x5e6143){if(!_0x5e6143){_0x4e6c18[_0x55d9('0x14')](0x194);}return _0x5e6143;};}function handleError(_0x190a68,_0x402459){_0x402459=_0x402459||0x1f4;return function(_0x141917){logger[_0x55d9('0x22')](_0x141917[_0x55d9('0x23')]);if(_0x141917[_0x55d9('0x24')]){delete _0x141917[_0x55d9('0x24')];}_0x190a68[_0x55d9('0x15')](_0x402459)['send'](_0x141917);};}exports[_0x55d9('0x25')]=function(_0x440eda,_0x325664){var _0x6fd5c1={},_0x5bf941={},_0x434691={'count':0x0,'rows':[]};var _0xa65752=db[_0x55d9('0x26')][_0x55d9('0x27')];_0x5bf941[_0x55d9('0x28')]=_[_0x55d9('0x29')](_0xa65752);_0x5bf941[_0x55d9('0x2a')]=_['keys'](_0x440eda['query']);_0x5bf941[_0x55d9('0x2b')]=_[_0x55d9('0x2c')](_0x5bf941['model'],_0x5bf941['query']);_0x6fd5c1['attributes']=_['intersection'](_0x5bf941['model'],qs['fields'](_0x440eda[_0x55d9('0x2a')][_0x55d9('0x2d')]));_0x6fd5c1[_0x55d9('0x2e')]=_0x6fd5c1[_0x55d9('0x2e')]['length']?_0x6fd5c1[_0x55d9('0x2e')]:_0x5bf941[_0x55d9('0x28')];if(!_0x440eda[_0x55d9('0x2a')][_0x55d9('0x2f')](_0x55d9('0x30'))){_0x6fd5c1[_0x55d9('0x31')]=qs[_0x55d9('0x31')](_0x440eda['query'][_0x55d9('0x31')]);_0x6fd5c1[_0x55d9('0x18')]=qs[_0x55d9('0x18')](_0x440eda[_0x55d9('0x2a')][_0x55d9('0x18')]);}_0x6fd5c1[_0x55d9('0x32')]=qs['sort'](_0x440eda[_0x55d9('0x2a')][_0x55d9('0x33')]);_0x6fd5c1[_0x55d9('0x34')]=qs[_0x55d9('0x2b')](_[_0x55d9('0x35')](_0x440eda['query'],_0x5bf941[_0x55d9('0x2b')]));if(_0x440eda[_0x55d9('0x2a')][_0x55d9('0x36')]){_0x6fd5c1[_0x55d9('0x34')]=_[_0x55d9('0x37')](_0x6fd5c1[_0x55d9('0x34')],{'$or':_[_0x55d9('0x38')](_0xa65752,function(_0x5e60f3){if(_0x5e60f3['type']['key']!==_0x55d9('0x39')){var _0x90b283={};_0x90b283[_0x5e60f3['field']]={'$like':'%'+_0x440eda[_0x55d9('0x2a')]['filter']+'%'};return _0x90b283;}})});}_0x6fd5c1=_[_0x55d9('0x37')]({},_0x6fd5c1,_0x440eda[_0x55d9('0x3a')]);var _0x20fb46={'where':_0x6fd5c1['where']};return db[_0x55d9('0x26')][_0x55d9('0x17')](_0x20fb46)['then'](function(_0x5d0068){_0x434691[_0x55d9('0x17')]=_0x5d0068;if(_0x440eda[_0x55d9('0x2a')][_0x55d9('0x3b')]){_0x6fd5c1[_0x55d9('0x3c')]=[{'all':!![]}];}return db[_0x55d9('0x26')][_0x55d9('0x3d')](_0x6fd5c1);})[_0x55d9('0x1f')](function(_0x15f0e3){_0x434691[_0x55d9('0x3e')]=_0x15f0e3;return _0x434691;})[_0x55d9('0x1f')](respondWithFilteredResult(_0x325664,_0x6fd5c1))['catch'](handleError(_0x325664,null));};exports[_0x55d9('0x3f')]=function(_0x1d045d,_0xaecf42){var _0x3bb0a1={'raw':!![],'where':{'id':_0x1d045d[_0x55d9('0x40')]['id']}},_0x103350={};_0x103350['model']=_[_0x55d9('0x29')](db[_0x55d9('0x26')][_0x55d9('0x27')]);_0x103350[_0x55d9('0x2a')]=_[_0x55d9('0x29')](_0x1d045d[_0x55d9('0x2a')]);_0x103350[_0x55d9('0x2b')]=_['intersection'](_0x103350[_0x55d9('0x28')],_0x103350['query']);_0x3bb0a1[_0x55d9('0x2e')]=_[_0x55d9('0x2c')](_0x103350[_0x55d9('0x28')],qs['fields'](_0x1d045d[_0x55d9('0x2a')][_0x55d9('0x2d')]));_0x3bb0a1[_0x55d9('0x2e')]=_0x3bb0a1['attributes']['length']?_0x3bb0a1[_0x55d9('0x2e')]:_0x103350[_0x55d9('0x28')];if(_0x1d045d[_0x55d9('0x2a')][_0x55d9('0x3b')]){_0x3bb0a1[_0x55d9('0x3c')]=[{'all':!![]}];}_0x3bb0a1=_[_0x55d9('0x37')]({},_0x3bb0a1,_0x1d045d[_0x55d9('0x3a')]);return db[_0x55d9('0x26')][_0x55d9('0x41')](_0x3bb0a1)[_0x55d9('0x1f')](handleEntityNotFound(_0xaecf42,null))[_0x55d9('0x1f')](respondWithResult(_0xaecf42,null))['catch'](handleError(_0xaecf42,null));};exports[_0x55d9('0x42')]=function(_0x3eb62d,_0x183d0e){return db[_0x55d9('0x26')][_0x55d9('0x42')](_0x3eb62d[_0x55d9('0x43')],{})[_0x55d9('0x1f')](respondWithResult(_0x183d0e,0xc9))[_0x55d9('0x44')](handleError(_0x183d0e,null));};exports[_0x55d9('0x1e')]=function(_0x41a14e,_0x525e5b){if(_0x41a14e['body']['id']){delete _0x41a14e[_0x55d9('0x43')]['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x41a14e['params']['id']}})[_0x55d9('0x1f')](handleEntityNotFound(_0x525e5b,null))[_0x55d9('0x1f')](saveUpdates(_0x41a14e[_0x55d9('0x43')],null))['then'](respondWithResult(_0x525e5b,null))[_0x55d9('0x44')](handleError(_0x525e5b,null));};exports[_0x55d9('0x20')]=function(_0x29328e,_0x33a9f8){return db['AnalyticTreeReport'][_0x55d9('0x41')]({'where':{'id':_0x29328e['params']['id']}})[_0x55d9('0x1f')](handleEntityNotFound(_0x33a9f8,null))[_0x55d9('0x1f')](removeEntity(_0x33a9f8,null))[_0x55d9('0x44')](handleError(_0x33a9f8,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 8f0972c..fc94b26 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 _0x7562=['bluebird','request-promise','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','api'];(function(_0x148634,_0xb2a21c){var _0x4bf6ae=function(_0x46bc48){while(--_0x46bc48){_0x148634['push'](_0x148634['shift']());}};_0x4bf6ae(++_0xb2a21c);}(_0x7562,0x10b));var _0x2756=function(_0x4c3fed,_0x5dddb5){_0x4c3fed=_0x4c3fed-0x0;var _0x4e00e8=_0x7562[_0x4c3fed];return _0x4e00e8;};'use strict';var _=require('lodash');var util=require(_0x2756('0x0'));var logger=require(_0x2756('0x1'))(_0x2756('0x2'));var moment=require('moment');var BPromise=require(_0x2756('0x3'));var rp=require(_0x2756('0x4'));var attributes=require(_0x2756('0x5'));module['exports']=function(_0x25b908,_0xe3a4f8){return _0x25b908[_0x2756('0x6')](_0x2756('0x7'),attributes,{'tableName':_0x2756('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b97=['request-promise','exports','define','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','moment','bluebird'];(function(_0x18b5e8,_0x51e875){var _0x25baed=function(_0x3fcdf9){while(--_0x3fcdf9){_0x18b5e8['push'](_0x18b5e8['shift']());}};_0x25baed(++_0x51e875);}(_0x5b97,0x12e));var _0x75b9=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0x5b97[_0x1a0daa];return _0x1dbe15;};'use strict';var _=require('lodash');var util=require(_0x75b9('0x0'));var logger=require(_0x75b9('0x1'))('api');var moment=require(_0x75b9('0x2'));var BPromise=require(_0x75b9('0x3'));var rp=require(_0x75b9('0x4'));var attributes=require('./analyticTreeReport.attributes');module[_0x75b9('0x5')]=function(_0x639e3b,_0x5bde6b){return _0x639e3b[_0x75b9('0x6')](_0x75b9('0x7'),attributes,{'tableName':_0x75b9('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 66b1b55..dec046b 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 _0xf3ab=['result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x3df743,_0x2ec4bb){var _0x264e87=function(_0x16c1d2){while(--_0x16c1d2){_0x3df743['push'](_0x3df743['shift']());}};_0x264e87(++_0x2ec4bb);}(_0xf3ab,0x145));var _0xbf3a=function(_0x46a3ff,_0x470b9a){_0x46a3ff=_0x46a3ff-0x0;var _0x404bc2=_0xf3ab[_0x46a3ff];return _0x404bc2;};'use strict';var _=require(_0xbf3a('0x0'));var util=require(_0xbf3a('0x1'));var moment=require(_0xbf3a('0x2'));var BPromise=require(_0xbf3a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf3a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf3a('0x5'))('rpc');var config=require(_0xbf3a('0x6'));var jayson=require(_0xbf3a('0x7'));var client=jayson['client'][_0xbf3a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x262c29,_0x49a77f,_0x3ef608){return new BPromise(function(_0x4926dd,_0x2e5293){return client['request'](_0x262c29,_0x3ef608)['then'](function(_0x1fb9f8){logger[_0xbf3a('0x9')](_0xbf3a('0xa'),_0x49a77f,_0xbf3a('0xb'));logger[_0xbf3a('0xc')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x49a77f,_0xbf3a('0xb'),JSON[_0xbf3a('0xd')](_0x1fb9f8));if(_0x1fb9f8[_0xbf3a('0xe')]){if(_0x1fb9f8['error'][_0xbf3a('0xf')]===0x1f4){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x49a77f,_0x1fb9f8[_0xbf3a('0xe')][_0xbf3a('0x10')]);return _0x2e5293(_0x1fb9f8[_0xbf3a('0xe')][_0xbf3a('0x10')]);}logger['error'](_0xbf3a('0xa'),_0x49a77f,_0x1fb9f8['error'][_0xbf3a('0x10')]);return _0x4926dd(_0x1fb9f8['error'][_0xbf3a('0x10')]);}else{logger[_0xbf3a('0x9')](_0xbf3a('0xa'),_0x49a77f,'request\x20sent');_0x4926dd(_0x1fb9f8[_0xbf3a('0x11')][_0xbf3a('0x10')]);}})['catch'](function(_0x533865){logger['error'](_0xbf3a('0xa'),_0x49a77f,_0x533865);_0x2e5293(_0x533865);});});} \ No newline at end of file +var _0x68f6=['debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','http','then','AnalyticTreeReport,\x20%s,\x20%s'];(function(_0xb74c89,_0x246040){var _0xe4ccef=function(_0x12b652){while(--_0x12b652){_0xb74c89['push'](_0xb74c89['shift']());}};_0xe4ccef(++_0x246040);}(_0x68f6,0x19a));var _0x668f=function(_0x393a0d,_0x303a27){_0x393a0d=_0x393a0d-0x0;var _0x24ea2a=_0x68f6[_0x393a0d];return _0x24ea2a;};'use strict';var _=require(_0x668f('0x0'));var util=require('util');var moment=require(_0x668f('0x1'));var BPromise=require(_0x668f('0x2'));var rs=require(_0x668f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x668f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x668f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x668f('0x6'));var client=jayson['client'][_0x668f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4b790d,_0x3dc685,_0x11256c){return new BPromise(function(_0x5a71b8,_0x2b5206){return client['request'](_0x4b790d,_0x11256c)[_0x668f('0x8')](function(_0x1615d0){logger['info'](_0x668f('0x9'),_0x3dc685,'request\x20sent');logger[_0x668f('0xa')](_0x668f('0xb'),_0x3dc685,'request\x20sent',JSON[_0x668f('0xc')](_0x1615d0));if(_0x1615d0[_0x668f('0xd')]){if(_0x1615d0[_0x668f('0xd')][_0x668f('0xe')]===0x1f4){logger[_0x668f('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x3dc685,_0x1615d0['error'][_0x668f('0xf')]);return _0x2b5206(_0x1615d0[_0x668f('0xd')]['message']);}logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x3dc685,_0x1615d0[_0x668f('0xd')]['message']);return _0x5a71b8(_0x1615d0[_0x668f('0xd')]['message']);}else{logger[_0x668f('0x10')](_0x668f('0x9'),_0x3dc685,_0x668f('0x11'));_0x5a71b8(_0x1615d0[_0x668f('0x12')]['message']);}})[_0x668f('0x13')](function(_0x4ab25c){logger[_0x668f('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x3dc685,_0x4ab25c);_0x2b5206(_0x4ab25c);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 510c52f..5f61bfa 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 _0x7e73=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','/:id','isAuthenticated','show','post','put','update','destroy','exports'];(function(_0xb4b64d,_0x2964d6){var _0x4edb89=function(_0x3504c7){while(--_0x3504c7){_0xb4b64d['push'](_0xb4b64d['shift']());}};_0x4edb89(++_0x2964d6);}(_0x7e73,0x110));var _0x37e7=function(_0x2260fb,_0x5bfa2b){_0x2260fb=_0x2260fb-0x0;var _0x96782=_0x7e73[_0x2260fb];return _0x96782;};'use strict';var multer=require('multer');var util=require(_0x37e7('0x0'));var path=require(_0x37e7('0x1'));var timeout=require(_0x37e7('0x2'));var express=require(_0x37e7('0x3'));var router=express[_0x37e7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x37e7('0x5'));var config=require(_0x37e7('0x6'));var controller=require(_0x37e7('0x7'));router[_0x37e7('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x37e7('0x9'),auth[_0x37e7('0xa')](),controller[_0x37e7('0xb')]);router[_0x37e7('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x37e7('0xd')](_0x37e7('0x9'),auth[_0x37e7('0xa')](),controller[_0x37e7('0xe')]);router['delete'](_0x37e7('0x9'),auth[_0x37e7('0xa')](),controller[_0x37e7('0xf')]);module[_0x37e7('0x10')]=router; \ No newline at end of file +var _0x833e=['update','destroy','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x56afc9,_0x3ac83b){var _0x174caa=function(_0x31e7e2){while(--_0x31e7e2){_0x56afc9['push'](_0x56afc9['shift']());}};_0x174caa(++_0x3ac83b);}(_0x833e,0x112));var _0xe833=function(_0x1e0c57,_0x4f0f4a){_0x1e0c57=_0x1e0c57-0x0;var _0x5c9e30=_0x833e[_0x1e0c57];return _0x5c9e30;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe833('0x0'));var timeout=require('connect-timeout');var express=require(_0xe833('0x1'));var router=express['Router']();var auth=require(_0xe833('0x2'));var interaction=require(_0xe833('0x3'));var config=require(_0xe833('0x4'));var controller=require(_0xe833('0x5'));router[_0xe833('0x6')]('/',auth[_0xe833('0x7')](),controller[_0xe833('0x8')]);router[_0xe833('0x6')](_0xe833('0x9'),auth[_0xe833('0x7')](),controller[_0xe833('0xa')]);router[_0xe833('0xb')]('/',auth['isAuthenticated'](),controller[_0xe833('0xc')]);router[_0xe833('0xd')]('/:id',auth[_0xe833('0x7')](),controller[_0xe833('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe833('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 91e5b77..659bf6c 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 _0xc301=['exports','STRING','sequelize'];(function(_0x44eb26,_0x570f9c){var _0x16c548=function(_0x4b1852){while(--_0x4b1852){_0x44eb26['push'](_0x44eb26['shift']());}};_0x16c548(++_0x570f9c);}(_0xc301,0x6e));var _0x1c30=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xc301[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0x1c30('0x0'));module[_0x1c30('0x1')]={'name':{'type':Sequelize[_0x1c30('0x2')]},'basename':{'type':Sequelize[_0x1c30('0x2')]},'type':{'type':Sequelize[_0x1c30('0x2')]}}; \ No newline at end of file +var _0xbb27=['STRING','sequelize','exports'];(function(_0x26695a,_0x1a5705){var _0x43938b=function(_0x403d8a){while(--_0x403d8a){_0x26695a['push'](_0x26695a['shift']());}};_0x43938b(++_0x1a5705);}(_0xbb27,0xaf));var _0x7bb2=function(_0x4f967c,_0x149b1a){_0x4f967c=_0x4f967c-0x0;var _0x40793d=_0xbb27[_0x4f967c];return _0x40793d;};'use strict';var Sequelize=require(_0x7bb2('0x0'));module[_0x7bb2('0x1')]={'name':{'type':Sequelize[_0x7bb2('0x2')]},'basename':{'type':Sequelize[_0x7bb2('0x2')]},'type':{'type':Sequelize[_0x7bb2('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index adc356e..1f4b1e6 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 _0x564f=['server/files/attachments/','html-pdf','eml-format','rimraf','fast-json-patch','moment','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','Attachment','rawAttributes','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','body','params','create','file','basename','mimetype','join','root'];(function(_0x2aec7d,_0x4baaab){var _0x488617=function(_0x56f9e8){while(--_0x56f9e8){_0x2aec7d['push'](_0x2aec7d['shift']());}};_0x488617(++_0x4baaab);}(_0x564f,0x141));var _0xf564=function(_0x106d61,_0x507af3){_0x106d61=_0x106d61-0x0;var _0x590936=_0x564f[_0x106d61];return _0x590936;};'use strict';var pdf=require(_0xf564('0x0'));var emlformat=require(_0xf564('0x1'));var rimraf=require(_0xf564('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf564('0x3'));var rp=require('request-promise');var moment=require(_0xf564('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf564('0x5'));var path=require(_0xf564('0x6'));var sox=require(_0xf564('0x7'));var csv=require('to-csv');var ejs=require(_0xf564('0x8'));var fs=require('fs');var _=require(_0xf564('0x9'));var squel=require('squel');var crypto=require(_0xf564('0xa'));var jsforce=require(_0xf564('0xb'));var deskjs=require(_0xf564('0xc'));var toCsv=require(_0xf564('0xd'));var querystring=require('querystring');var Papa=require(_0xf564('0xe'));var authService=require(_0xf564('0xf'));var hardwareService=require(_0xf564('0x10'));var Redis=require(_0xf564('0x11'));var qs=require(_0xf564('0x12'));var logger=require('../../config/logger')(_0xf564('0x13'));var utils=require(_0xf564('0x14'));var config=require(_0xf564('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e5a8b,_0x427e94){_0x427e94=_0x427e94||0xcc;return function(_0x3e5f06){if(_0x3e5f06){return _0x2e5a8b[_0xf564('0x16')](_0x427e94);}return _0x2e5a8b[_0xf564('0x17')](_0x427e94)[_0xf564('0x18')]();};}function respondWithResult(_0x5617ba,_0x4c018a){_0x4c018a=_0x4c018a||0xc8;return function(_0x176f61){if(_0x176f61){return _0x5617ba['status'](_0x4c018a)['json'](_0x176f61);}};}function respondWithFilteredResult(_0x889508,_0x5bef1f){return function(_0x4b8f73){if(_0x4b8f73){var _0x5a26be=_0x4b8f73[_0xf564('0x19')],_0x380e7a=_0x5bef1f[_0xf564('0x1a')],_0x2b44a4=_0x5bef1f[_0xf564('0x1a')]+_0x5bef1f[_0xf564('0x1b')],_0x5ad3b2;if(_0x2b44a4>=_0x5a26be){_0x2b44a4=_0x5a26be;_0x5ad3b2=0xc8;}else{_0x5ad3b2=0xce;}_0x889508['status'](_0x5ad3b2);return _0x889508[_0xf564('0x1c')](_0xf564('0x1d'),_0x380e7a+'-'+_0x2b44a4+'/'+_0x5a26be)[_0xf564('0x1e')](_0x4b8f73);}return null;};}function patchUpdates(_0x220489){return function(_0x212add){try{jsonpatch[_0xf564('0x1f')](_0x212add,_0x220489,!![]);}catch(_0x3a4ae7){return BPromise[_0xf564('0x20')](_0x3a4ae7);}return _0x212add[_0xf564('0x21')]();};}function saveUpdates(_0x4da6bd,_0xb11ca4){return function(_0x43acd5){if(_0x43acd5){return _0x43acd5[_0xf564('0x22')](_0x4da6bd)[_0xf564('0x23')](function(_0x165cfd){return _0x165cfd;});}return null;};}function removeEntity(_0x3495fc,_0x58daf8){return function(_0x49d24b){if(_0x49d24b){return _0x49d24b[_0xf564('0x24')]()[_0xf564('0x23')](function(){_0x3495fc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x445cfd,_0x506789){return function(_0x1173dd){if(!_0x1173dd){_0x445cfd[_0xf564('0x16')](0x194);}return _0x1173dd;};}function handleError(_0x222ed6,_0x484271){_0x484271=_0x484271||0x1f4;return function(_0x44f9a3){logger[_0xf564('0x25')](_0x44f9a3['stack']);if(_0x44f9a3[_0xf564('0x26')]){delete _0x44f9a3[_0xf564('0x26')];}_0x222ed6[_0xf564('0x17')](_0x484271)[_0xf564('0x27')](_0x44f9a3);};}exports[_0xf564('0x28')]=function(_0x321b7d,_0x215f81){var _0xc58053={},_0x2eb2fe={},_0x36fe52={'count':0x0,'rows':[]};var _0x337733=db[_0xf564('0x29')][_0xf564('0x2a')];_0x2eb2fe['model']=_['keys'](_0x337733);_0x2eb2fe[_0xf564('0x2b')]=_[_0xf564('0x2c')](_0x321b7d[_0xf564('0x2b')]);_0x2eb2fe[_0xf564('0x2d')]=_[_0xf564('0x2e')](_0x2eb2fe['model'],_0x2eb2fe['query']);_0xc58053[_0xf564('0x2f')]=_[_0xf564('0x2e')](_0x2eb2fe[_0xf564('0x30')],qs[_0xf564('0x31')](_0x321b7d[_0xf564('0x2b')][_0xf564('0x31')]));_0xc58053[_0xf564('0x2f')]=_0xc58053[_0xf564('0x2f')][_0xf564('0x32')]?_0xc58053[_0xf564('0x2f')]:_0x2eb2fe[_0xf564('0x30')];if(!_0x321b7d[_0xf564('0x2b')][_0xf564('0x33')](_0xf564('0x34'))){_0xc58053[_0xf564('0x1b')]=qs[_0xf564('0x1b')](_0x321b7d['query'][_0xf564('0x1b')]);_0xc58053['offset']=qs[_0xf564('0x1a')](_0x321b7d[_0xf564('0x2b')][_0xf564('0x1a')]);}_0xc58053[_0xf564('0x35')]=qs[_0xf564('0x36')](_0x321b7d[_0xf564('0x2b')][_0xf564('0x36')]);_0xc58053[_0xf564('0x37')]=qs[_0xf564('0x2d')](_[_0xf564('0x38')](_0x321b7d['query'],_0x2eb2fe[_0xf564('0x2d')]));if(_0x321b7d[_0xf564('0x2b')][_0xf564('0x39')]){_0xc58053[_0xf564('0x37')]=_[_0xf564('0x3a')](_0xc58053[_0xf564('0x37')],{'$or':_[_0xf564('0x3b')](_0x337733,function(_0x390274){if(_0x390274[_0xf564('0x3c')][_0xf564('0x3d')]!==_0xf564('0x3e')){var _0x3264d7={};_0x3264d7[_0x390274['field']]={'$like':'%'+_0x321b7d[_0xf564('0x2b')][_0xf564('0x39')]+'%'};return _0x3264d7;}})});}_0xc58053=_[_0xf564('0x3a')]({},_0xc58053,_0x321b7d[_0xf564('0x3f')]);var _0x2c379f={'where':_0xc58053[_0xf564('0x37')]};return db[_0xf564('0x29')][_0xf564('0x19')](_0x2c379f)[_0xf564('0x23')](function(_0x280951){_0x36fe52[_0xf564('0x19')]=_0x280951;if(_0x321b7d['query']['includeAll']){_0xc58053[_0xf564('0x40')]=[{'all':!![]}];}return db[_0xf564('0x29')][_0xf564('0x41')](_0xc58053);})[_0xf564('0x23')](function(_0x2a793d){_0x36fe52[_0xf564('0x42')]=_0x2a793d;return _0x36fe52;})[_0xf564('0x23')](respondWithFilteredResult(_0x215f81,_0xc58053))[_0xf564('0x43')](handleError(_0x215f81,null));};exports[_0xf564('0x44')]=function(_0x49f19f,_0x38f422){var _0x5ebcc8={'raw':!![],'where':{'id':_0x49f19f['params']['id']}},_0x8a35bd={};_0x8a35bd[_0xf564('0x30')]=_['keys'](db[_0xf564('0x29')]['rawAttributes']);_0x8a35bd['query']=_[_0xf564('0x2c')](_0x49f19f['query']);_0x8a35bd[_0xf564('0x2d')]=_[_0xf564('0x2e')](_0x8a35bd['model'],_0x8a35bd[_0xf564('0x2b')]);_0x5ebcc8[_0xf564('0x2f')]=_['intersection'](_0x8a35bd[_0xf564('0x30')],qs['fields'](_0x49f19f['query'][_0xf564('0x31')]));_0x5ebcc8[_0xf564('0x2f')]=_0x5ebcc8[_0xf564('0x2f')]['length']?_0x5ebcc8[_0xf564('0x2f')]:_0x8a35bd[_0xf564('0x30')];if(_0x49f19f[_0xf564('0x2b')][_0xf564('0x45')]){_0x5ebcc8['include']=[{'all':!![]}];}_0x5ebcc8=_[_0xf564('0x3a')]({},_0x5ebcc8,_0x49f19f['options']);return db['Attachment'][_0xf564('0x46')](_0x5ebcc8)[_0xf564('0x23')](handleEntityNotFound(_0x38f422,null))['then'](respondWithResult(_0x38f422,null))[_0xf564('0x43')](handleError(_0x38f422,null));};exports[_0xf564('0x22')]=function(_0x31dbee,_0x573d4c){if(_0x31dbee[_0xf564('0x47')]['id']){delete _0x31dbee[_0xf564('0x47')]['id'];}return db['Attachment']['find']({'where':{'id':_0x31dbee[_0xf564('0x48')]['id']}})[_0xf564('0x23')](handleEntityNotFound(_0x573d4c,null))['then'](saveUpdates(_0x31dbee[_0xf564('0x47')],null))[_0xf564('0x23')](respondWithResult(_0x573d4c,null))[_0xf564('0x43')](handleError(_0x573d4c,null));};exports[_0xf564('0x24')]=function(_0x5cc582,_0x577b0b){return db[_0xf564('0x29')]['find']({'where':{'id':_0x5cc582[_0xf564('0x48')]['id']}})['then'](handleEntityNotFound(_0x577b0b,null))[_0xf564('0x23')](removeEntity(_0x577b0b,null))[_0xf564('0x43')](handleError(_0x577b0b,null));};exports[_0xf564('0x49')]=function(_0x20c153,_0x5dd106,_0x725be4){_0x20c153['body']['name']=_0x20c153[_0xf564('0x4a')]['originalname'];_0x20c153[_0xf564('0x47')][_0xf564('0x4b')]=_0x20c153[_0xf564('0x4a')]['filename'];_0x20c153['body'][_0xf564('0x3c')]=_0x20c153['file'][_0xf564('0x4c')];return db[_0xf564('0x29')][_0xf564('0x49')](_0x20c153[_0xf564('0x47')])['then'](respondWithResult(_0x5dd106,0xc9))[_0xf564('0x43')](handleError(_0x5dd106,null));};exports['download']=function(_0x2ce6c5,_0x5ebe90,_0x1a2434){return db[_0xf564('0x29')]['findOne']({'where':{'id':_0x2ce6c5[_0xf564('0x48')]['id']},'raw':!![]})[_0xf564('0x23')](handleEntityNotFound(_0x5ebe90,null))[_0xf564('0x23')](function(_0x1ad9dc){if(_0x1ad9dc){return _0x5ebe90['download'](path[_0xf564('0x4d')](config[_0xf564('0x4e')],_0xf564('0x4f'),_0x1ad9dc[_0xf564('0x4b')]));}})[_0xf564('0x43')](handleError(_0x5ebe90,null));}; \ No newline at end of file +var _0x4d64=['destroy','error','stack','name','send','index','rawAttributes','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','Attachment','includeAll','include','findAll','catch','show','params','length','find','body','create','file','originalname','basename','filename','mimetype','download','server/files/attachments/','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','querystring','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','save','update','then'];(function(_0x3805f4,_0x1113e2){var _0x1fb3a7=function(_0xac1dad){while(--_0xac1dad){_0x3805f4['push'](_0x3805f4['shift']());}};_0x1fb3a7(++_0x1113e2);}(_0x4d64,0x1f0));var _0x44d6=function(_0x169b4a,_0xfd99ab){_0x169b4a=_0x169b4a-0x0;var _0xfef033=_0x4d64[_0x169b4a];return _0xfef033;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x44d6('0x0'));var rimraf=require(_0x44d6('0x1'));var zipdir=require(_0x44d6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x44d6('0x3'));var moment=require(_0x44d6('0x4'));var BPromise=require(_0x44d6('0x5'));var Mustache=require(_0x44d6('0x6'));var util=require(_0x44d6('0x7'));var path=require(_0x44d6('0x8'));var sox=require('sox');var csv=require(_0x44d6('0x9'));var ejs=require(_0x44d6('0xa'));var fs=require('fs');var _=require(_0x44d6('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x44d6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44d6('0xd'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0x44d6('0xe'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x44d6('0xf'))(_0x44d6('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x44d6('0x11'))['db'];function respondWithStatusCode(_0x42cf41,_0x423a3f){_0x423a3f=_0x423a3f||0xcc;return function(_0x56efe4){if(_0x56efe4){return _0x42cf41[_0x44d6('0x12')](_0x423a3f);}return _0x42cf41[_0x44d6('0x13')](_0x423a3f)[_0x44d6('0x14')]();};}function respondWithResult(_0x369aaf,_0x1b786d){_0x1b786d=_0x1b786d||0xc8;return function(_0x4180d8){if(_0x4180d8){return _0x369aaf['status'](_0x1b786d)[_0x44d6('0x15')](_0x4180d8);}};}function respondWithFilteredResult(_0x4fdfdf,_0x5674c8){return function(_0xbd317d){if(_0xbd317d){var _0x1a5031=_0xbd317d[_0x44d6('0x16')],_0x37dee1=_0x5674c8[_0x44d6('0x17')],_0x298fdc=_0x5674c8[_0x44d6('0x17')]+_0x5674c8[_0x44d6('0x18')],_0x285e89;if(_0x298fdc>=_0x1a5031){_0x298fdc=_0x1a5031;_0x285e89=0xc8;}else{_0x285e89=0xce;}_0x4fdfdf[_0x44d6('0x13')](_0x285e89);return _0x4fdfdf['set']('Content-Range',_0x37dee1+'-'+_0x298fdc+'/'+_0x1a5031)[_0x44d6('0x15')](_0xbd317d);}return null;};}function patchUpdates(_0x36f795){return function(_0xe45558){try{jsonpatch[_0x44d6('0x19')](_0xe45558,_0x36f795,!![]);}catch(_0x1f706a){return BPromise['reject'](_0x1f706a);}return _0xe45558[_0x44d6('0x1a')]();};}function saveUpdates(_0x3fd888,_0xfdaea){return function(_0x3c2ecb){if(_0x3c2ecb){return _0x3c2ecb[_0x44d6('0x1b')](_0x3fd888)[_0x44d6('0x1c')](function(_0x923818){return _0x923818;});}return null;};}function removeEntity(_0x136fa0,_0x53aec6){return function(_0xfd13b2){if(_0xfd13b2){return _0xfd13b2[_0x44d6('0x1d')]()[_0x44d6('0x1c')](function(){_0x136fa0[_0x44d6('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b6e91,_0x5a4428){return function(_0x3839b0){if(!_0x3839b0){_0x1b6e91['sendStatus'](0x194);}return _0x3839b0;};}function handleError(_0x1baf9b,_0x1c9a29){_0x1c9a29=_0x1c9a29||0x1f4;return function(_0x1b678f){logger[_0x44d6('0x1e')](_0x1b678f[_0x44d6('0x1f')]);if(_0x1b678f[_0x44d6('0x20')]){delete _0x1b678f['name'];}_0x1baf9b[_0x44d6('0x13')](_0x1c9a29)[_0x44d6('0x21')](_0x1b678f);};}exports[_0x44d6('0x22')]=function(_0x1c83b2,_0x1d70b9){var _0x483bd7={},_0x420a89={},_0x6de01f={'count':0x0,'rows':[]};var _0x7b0549=db['Attachment'][_0x44d6('0x23')];_0x420a89['model']=_['keys'](_0x7b0549);_0x420a89['query']=_[_0x44d6('0x24')](_0x1c83b2[_0x44d6('0x25')]);_0x420a89[_0x44d6('0x26')]=_[_0x44d6('0x27')](_0x420a89['model'],_0x420a89[_0x44d6('0x25')]);_0x483bd7[_0x44d6('0x28')]=_[_0x44d6('0x27')](_0x420a89[_0x44d6('0x29')],qs[_0x44d6('0x2a')](_0x1c83b2[_0x44d6('0x25')][_0x44d6('0x2a')]));_0x483bd7['attributes']=_0x483bd7['attributes']['length']?_0x483bd7[_0x44d6('0x28')]:_0x420a89['model'];if(!_0x1c83b2['query'][_0x44d6('0x2b')](_0x44d6('0x2c'))){_0x483bd7[_0x44d6('0x18')]=qs[_0x44d6('0x18')](_0x1c83b2[_0x44d6('0x25')][_0x44d6('0x18')]);_0x483bd7[_0x44d6('0x17')]=qs[_0x44d6('0x17')](_0x1c83b2[_0x44d6('0x25')][_0x44d6('0x17')]);}_0x483bd7[_0x44d6('0x2d')]=qs[_0x44d6('0x2e')](_0x1c83b2[_0x44d6('0x25')][_0x44d6('0x2e')]);_0x483bd7[_0x44d6('0x2f')]=qs[_0x44d6('0x26')](_[_0x44d6('0x30')](_0x1c83b2[_0x44d6('0x25')],_0x420a89[_0x44d6('0x26')]));if(_0x1c83b2[_0x44d6('0x25')][_0x44d6('0x31')]){_0x483bd7[_0x44d6('0x2f')]=_[_0x44d6('0x32')](_0x483bd7[_0x44d6('0x2f')],{'$or':_[_0x44d6('0x33')](_0x7b0549,function(_0x213440){if(_0x213440[_0x44d6('0x34')][_0x44d6('0x35')]!==_0x44d6('0x36')){var _0x5a3015={};_0x5a3015[_0x213440[_0x44d6('0x37')]]={'$like':'%'+_0x1c83b2['query'][_0x44d6('0x31')]+'%'};return _0x5a3015;}})});}_0x483bd7=_[_0x44d6('0x32')]({},_0x483bd7,_0x1c83b2[_0x44d6('0x38')]);var _0x1c7db6={'where':_0x483bd7[_0x44d6('0x2f')]};return db[_0x44d6('0x39')][_0x44d6('0x16')](_0x1c7db6)[_0x44d6('0x1c')](function(_0x22442a){_0x6de01f[_0x44d6('0x16')]=_0x22442a;if(_0x1c83b2['query'][_0x44d6('0x3a')]){_0x483bd7[_0x44d6('0x3b')]=[{'all':!![]}];}return db['Attachment'][_0x44d6('0x3c')](_0x483bd7);})['then'](function(_0x23e28c){_0x6de01f['rows']=_0x23e28c;return _0x6de01f;})[_0x44d6('0x1c')](respondWithFilteredResult(_0x1d70b9,_0x483bd7))[_0x44d6('0x3d')](handleError(_0x1d70b9,null));};exports[_0x44d6('0x3e')]=function(_0x321c30,_0x34fff4){var _0x2749dd={'raw':!![],'where':{'id':_0x321c30[_0x44d6('0x3f')]['id']}},_0x29e061={};_0x29e061[_0x44d6('0x29')]=_[_0x44d6('0x24')](db[_0x44d6('0x39')][_0x44d6('0x23')]);_0x29e061[_0x44d6('0x25')]=_[_0x44d6('0x24')](_0x321c30[_0x44d6('0x25')]);_0x29e061[_0x44d6('0x26')]=_['intersection'](_0x29e061[_0x44d6('0x29')],_0x29e061['query']);_0x2749dd[_0x44d6('0x28')]=_[_0x44d6('0x27')](_0x29e061[_0x44d6('0x29')],qs[_0x44d6('0x2a')](_0x321c30[_0x44d6('0x25')][_0x44d6('0x2a')]));_0x2749dd[_0x44d6('0x28')]=_0x2749dd[_0x44d6('0x28')][_0x44d6('0x40')]?_0x2749dd['attributes']:_0x29e061[_0x44d6('0x29')];if(_0x321c30[_0x44d6('0x25')][_0x44d6('0x3a')]){_0x2749dd['include']=[{'all':!![]}];}_0x2749dd=_['merge']({},_0x2749dd,_0x321c30['options']);return db[_0x44d6('0x39')][_0x44d6('0x41')](_0x2749dd)[_0x44d6('0x1c')](handleEntityNotFound(_0x34fff4,null))['then'](respondWithResult(_0x34fff4,null))[_0x44d6('0x3d')](handleError(_0x34fff4,null));};exports['update']=function(_0x143bed,_0x2b8974){if(_0x143bed['body']['id']){delete _0x143bed['body']['id'];}return db[_0x44d6('0x39')][_0x44d6('0x41')]({'where':{'id':_0x143bed['params']['id']}})[_0x44d6('0x1c')](handleEntityNotFound(_0x2b8974,null))[_0x44d6('0x1c')](saveUpdates(_0x143bed[_0x44d6('0x42')],null))['then'](respondWithResult(_0x2b8974,null))[_0x44d6('0x3d')](handleError(_0x2b8974,null));};exports['destroy']=function(_0xafbe2e,_0x4a4795){return db['Attachment'][_0x44d6('0x41')]({'where':{'id':_0xafbe2e[_0x44d6('0x3f')]['id']}})[_0x44d6('0x1c')](handleEntityNotFound(_0x4a4795,null))[_0x44d6('0x1c')](removeEntity(_0x4a4795,null))['catch'](handleError(_0x4a4795,null));};exports[_0x44d6('0x43')]=function(_0x534d07,_0x451228,_0x515a3d){_0x534d07['body'][_0x44d6('0x20')]=_0x534d07[_0x44d6('0x44')][_0x44d6('0x45')];_0x534d07[_0x44d6('0x42')][_0x44d6('0x46')]=_0x534d07[_0x44d6('0x44')][_0x44d6('0x47')];_0x534d07['body']['type']=_0x534d07[_0x44d6('0x44')][_0x44d6('0x48')];return db[_0x44d6('0x39')][_0x44d6('0x43')](_0x534d07[_0x44d6('0x42')])[_0x44d6('0x1c')](respondWithResult(_0x451228,0xc9))[_0x44d6('0x3d')](handleError(_0x451228,null));};exports[_0x44d6('0x49')]=function(_0x5da480,_0x564e33,_0x249b15){return db['Attachment']['findOne']({'where':{'id':_0x5da480[_0x44d6('0x3f')]['id']},'raw':!![]})[_0x44d6('0x1c')](handleEntityNotFound(_0x564e33,null))[_0x44d6('0x1c')](function(_0x14a31a){if(_0x14a31a){return _0x564e33[_0x44d6('0x49')](path['join'](config['root'],_0x44d6('0x4a'),_0x14a31a[_0x44d6('0x46')]));}})[_0x44d6('0x3d')](handleError(_0x564e33,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index f19865b..e87f4f1 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 _0xa41a=['moment','bluebird','request-promise','./attachment.attributes','exports','Attachment','attachments','lodash','util','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa41a,0x6b));var _0xaa41=function(_0x254000,_0x501689){_0x254000=_0x254000-0x0;var _0x2312b3=_0xa41a[_0x254000];return _0x2312b3;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var attributes=require(_0xaa41('0x6'));module[_0xaa41('0x7')]=function(_0x42896b,_0x251efa){return _0x42896b['define'](_0xaa41('0x8'),attributes,{'tableName':_0xaa41('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6aa7=['lodash','../../config/logger','api','moment','bluebird','./attachment.attributes','exports','Attachment'];(function(_0x4fdcb0,_0x1e5d29){var _0x469816=function(_0x28df37){while(--_0x28df37){_0x4fdcb0['push'](_0x4fdcb0['shift']());}};_0x469816(++_0x1e5d29);}(_0x6aa7,0x178));var _0x76aa=function(_0x4da8d6,_0x269dd3){_0x4da8d6=_0x4da8d6-0x0;var _0x3b9978=_0x6aa7[_0x4da8d6];return _0x3b9978;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var attributes=require(_0x76aa('0x5'));module[_0x76aa('0x6')]=function(_0x1d6e04,_0x511588){return _0x1d6e04['define'](_0x76aa('0x7'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 10a647c..7a06ba3 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 _0xb0ee=['code','message','catch','CreateAttachment','Attachment','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1237d4,_0x20bbfc){var _0x441fb6=function(_0x31736b){while(--_0x31736b){_0x1237d4['push'](_0x1237d4['shift']());}};_0x441fb6(++_0x20bbfc);}(_0xb0ee,0x18f));var _0xeb0e=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xb0ee[_0x616290];return _0x453879;};'use strict';var _=require('lodash');var util=require(_0xeb0e('0x0'));var moment=require(_0xeb0e('0x1'));var BPromise=require(_0xeb0e('0x2'));var rs=require(_0xeb0e('0x3'));var fs=require('fs');var Redis=require(_0xeb0e('0x4'));var db=require(_0xeb0e('0x5'))['db'];var utils=require(_0xeb0e('0x6'));var logger=require(_0xeb0e('0x7'))(_0xeb0e('0x8'));var config=require(_0xeb0e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb0e('0xa')][_0xeb0e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x423095,_0x3e7872,_0x572ee1){return new BPromise(function(_0x3b3c6e,_0x1dcf56){return client[_0xeb0e('0xc')](_0x423095,_0x572ee1)[_0xeb0e('0xd')](function(_0x2b90ba){logger[_0xeb0e('0xe')](_0xeb0e('0xf'),_0x3e7872,_0xeb0e('0x10'));logger[_0xeb0e('0x11')](_0xeb0e('0x12'),_0x3e7872,_0xeb0e('0x10'),JSON[_0xeb0e('0x13')](_0x2b90ba));if(_0x2b90ba[_0xeb0e('0x14')]){if(_0x2b90ba[_0xeb0e('0x14')][_0xeb0e('0x15')]===0x1f4){logger[_0xeb0e('0x14')](_0xeb0e('0xf'),_0x3e7872,_0x2b90ba[_0xeb0e('0x14')]['message']);return _0x1dcf56(_0x2b90ba['error'][_0xeb0e('0x16')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x3e7872,_0x2b90ba[_0xeb0e('0x14')][_0xeb0e('0x16')]);return _0x3b3c6e(_0x2b90ba[_0xeb0e('0x14')][_0xeb0e('0x16')]);}else{logger['info'](_0xeb0e('0xf'),_0x3e7872,_0xeb0e('0x10'));_0x3b3c6e(_0x2b90ba['result'][_0xeb0e('0x16')]);}})[_0xeb0e('0x17')](function(_0xa9a9c4){logger[_0xeb0e('0x14')](_0xeb0e('0xf'),_0x3e7872,_0xa9a9c4);_0x1dcf56(_0xa9a9c4);});});}exports[_0xeb0e('0x18')]=function(_0x2c78aa){var _0x51f14d=this;return new Promise(function(_0x1396a4,_0x972b84){return db[_0xeb0e('0x19')][_0xeb0e('0x1a')](_0x2c78aa[_0xeb0e('0x1b')],{'raw':_0x2c78aa[_0xeb0e('0x1c')]?_0x2c78aa[_0xeb0e('0x1c')][_0xeb0e('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x2f0e1b){logger[_0xeb0e('0xe')]('CreateAttachment',_0x2c78aa);logger['debug'](_0xeb0e('0x18'),_0x2c78aa,JSON[_0xeb0e('0x13')](_0x2f0e1b));_0x1396a4(_0x2f0e1b);})['catch'](function(_0xd6ad44){logger[_0xeb0e('0x14')]('CreateAttachment',_0xd6ad44[_0xeb0e('0x16')],_0x2c78aa);_0x972b84(_0x51f14d['error'](0x1f4,_0xd6ad44['message']));});});}; \ No newline at end of file +var _0x5554=['message','result','catch','Attachment','body','options','raw','then','CreateAttachment','util','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x178618,_0x302d34){var _0x4f0331=function(_0x439ac9){while(--_0x439ac9){_0x178618['push'](_0x178618['shift']());}};_0x4f0331(++_0x302d34);}(_0x5554,0x167));var _0x4555=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x5554[_0x2a6809];return _0x11c371;};'use strict';var _=require('lodash');var util=require(_0x4555('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4555('0x1'));var fs=require('fs');var Redis=require(_0x4555('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4555('0x3'));var logger=require(_0x4555('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4555('0x5'));var client=jayson[_0x4555('0x6')][_0x4555('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2fc846,_0x2b1d78,_0x58426c){return new BPromise(function(_0x5397fb,_0x32278b){return client[_0x4555('0x8')](_0x2fc846,_0x58426c)['then'](function(_0x2f8107){logger[_0x4555('0x9')](_0x4555('0xa'),_0x2b1d78,_0x4555('0xb'));logger[_0x4555('0xc')]('Attachment,\x20%s,\x20%s,\x20%s',_0x2b1d78,_0x4555('0xb'),JSON[_0x4555('0xd')](_0x2f8107));if(_0x2f8107[_0x4555('0xe')]){if(_0x2f8107[_0x4555('0xe')][_0x4555('0xf')]===0x1f4){logger[_0x4555('0xe')](_0x4555('0xa'),_0x2b1d78,_0x2f8107['error'][_0x4555('0x10')]);return _0x32278b(_0x2f8107[_0x4555('0xe')][_0x4555('0x10')]);}logger[_0x4555('0xe')](_0x4555('0xa'),_0x2b1d78,_0x2f8107[_0x4555('0xe')][_0x4555('0x10')]);return _0x5397fb(_0x2f8107['error']['message']);}else{logger[_0x4555('0x9')]('Attachment,\x20%s,\x20%s',_0x2b1d78,'request\x20sent');_0x5397fb(_0x2f8107[_0x4555('0x11')][_0x4555('0x10')]);}})[_0x4555('0x12')](function(_0x4b7c84){logger[_0x4555('0xe')]('Attachment,\x20%s,\x20%s',_0x2b1d78,_0x4b7c84);_0x32278b(_0x4b7c84);});});}exports['CreateAttachment']=function(_0x5193f8){var _0x283ce2=this;return new Promise(function(_0x5e9617,_0x51918b){return db[_0x4555('0x13')]['create'](_0x5193f8[_0x4555('0x14')],{'raw':_0x5193f8[_0x4555('0x15')]?_0x5193f8[_0x4555('0x15')][_0x4555('0x16')]===undefined?!![]:![]:!![]})[_0x4555('0x17')](function(_0x31212e){logger[_0x4555('0x9')](_0x4555('0x18'),_0x5193f8);logger['debug']('CreateAttachment',_0x5193f8,JSON[_0x4555('0xd')](_0x31212e));_0x5e9617(_0x31212e);})[_0x4555('0x12')](function(_0x309eec){logger[_0x4555('0xe')](_0x4555('0x18'),_0x309eec[_0x4555('0x10')],_0x5193f8);_0x51918b(_0x283ce2[_0x4555('0xe')](0x1f4,_0x309eec[_0x4555('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 1fca405..676304a 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 _0xd52d=['/:id','show','/:id/download','download','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','single','file','create','update','delete','destroy','exports','util','path','express','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd52d,0x1c7));var _0xdd52=function(_0xa012d0,_0xea2f85){_0xa012d0=_0xa012d0-0x0;var _0x491590=_0xd52d[_0xa012d0];return _0x491590;};'use strict';var multer=require('multer');var util=require(_0xdd52('0x0'));var path=require(_0xdd52('0x1'));var timeout=require('connect-timeout');var express=require(_0xdd52('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xdd52('0x3'));var config=require(_0xdd52('0x4'));var controller=require(_0xdd52('0x5'));router[_0xdd52('0x6')]('/',auth[_0xdd52('0x7')](),controller[_0xdd52('0x8')]);router[_0xdd52('0x6')](_0xdd52('0x9'),auth['isAuthenticated'](),controller[_0xdd52('0xa')]);router[_0xdd52('0x6')](_0xdd52('0xb'),auth[_0xdd52('0x7')](),controller[_0xdd52('0xc')]);var upload=multer({'storage':multer[_0xdd52('0xd')]({'destination':function(_0x3fd2b9,_0x3e41e1,_0x20f7ba){_0x20f7ba(null,path[_0xdd52('0xe')](config[_0xdd52('0xf')],_0xdd52('0x10')));},'filename':function(_0x1cfc7f,_0x4d2066,_0xe1fe3c){_0xe1fe3c(null,util[_0xdd52('0x11')](_0xdd52('0x12'),Date[_0xdd52('0x13')](),_0x4d2066[_0xdd52('0x14')][_0xdd52('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload[_0xdd52('0x16')](_0xdd52('0x17')),controller[_0xdd52('0x18')]);router['put'](_0xdd52('0x9'),auth[_0xdd52('0x7')](),controller[_0xdd52('0x19')]);router[_0xdd52('0x1a')](_0xdd52('0x9'),auth[_0xdd52('0x7')](),controller[_0xdd52('0x1b')]);module[_0xdd52('0x1c')]=router; \ No newline at end of file +var _0xe739=['originalname','replace','post','file','create','put','update','destroy','multer','path','connect-timeout','express','../../config/environment','./attachment.controller','get','isAuthenticated','/:id','/:id/download','download','diskStorage','server/files/attachments/','format','now'];(function(_0x223c06,_0x204326){var _0x459df8=function(_0x2a2221){while(--_0x2a2221){_0x223c06['push'](_0x223c06['shift']());}};_0x459df8(++_0x204326);}(_0xe739,0x105));var _0x9e73=function(_0x1ef0c9,_0x374f20){_0x1ef0c9=_0x1ef0c9-0x0;var _0x5019cd=_0xe739[_0x1ef0c9];return _0x5019cd;};'use strict';var multer=require(_0x9e73('0x0'));var util=require('util');var path=require(_0x9e73('0x1'));var timeout=require(_0x9e73('0x2'));var express=require(_0x9e73('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9e73('0x4'));var controller=require(_0x9e73('0x5'));router[_0x9e73('0x6')]('/',auth[_0x9e73('0x7')](),controller['index']);router[_0x9e73('0x6')](_0x9e73('0x8'),auth[_0x9e73('0x7')](),controller['show']);router[_0x9e73('0x6')](_0x9e73('0x9'),auth[_0x9e73('0x7')](),controller[_0x9e73('0xa')]);var upload=multer({'storage':multer[_0x9e73('0xb')]({'destination':function(_0x2edd7b,_0x52393d,_0x33ce2d){_0x33ce2d(null,path['join'](config['root'],_0x9e73('0xc')));},'filename':function(_0x530e27,_0x186b89,_0x312b37){_0x312b37(null,util[_0x9e73('0xd')]('%s-%s',Date[_0x9e73('0xe')](),_0x186b89[_0x9e73('0xf')][_0x9e73('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x9e73('0x11')]('/',upload['single'](_0x9e73('0x12')),controller[_0x9e73('0x13')]);router[_0x9e73('0x14')]('/:id',auth[_0x9e73('0x7')](),controller[_0x9e73('0x15')]);router['delete'](_0x9e73('0x8'),auth[_0x9e73('0x7')](),controller[_0x9e73('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 825d13f..0ef4d45 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 _0xd397=['clientSecret','secret','callbackURL','User','find','emails','value','admin','user','agent','then','lodash','passport','Strategy','../../mysqldb','../../config/environment','../../components/auth/service','login','google','/login','profile','email','authenticate','use'];(function(_0x29bb30,_0x1f6cea){var _0x5c734c=function(_0x28c739){while(--_0x28c739){_0x29bb30['push'](_0x29bb30['shift']());}};_0x5c734c(++_0x1f6cea);}(_0xd397,0x113));var _0x7d39=function(_0x4ffc5f,_0xd553c4){_0x4ffc5f=_0x4ffc5f-0x0;var _0x658ff2=_0xd397[_0x4ffc5f];return _0x658ff2;};'use strict';var _=require(_0x7d39('0x0'));var passport=require(_0x7d39('0x1'));var GoogleStrategy=require('passport-google-oauth20')[_0x7d39('0x2')];var db=require(_0x7d39('0x3'))['db'];var config=require(_0x7d39('0x4'));var signToken=require(_0x7d39('0x5'))['signToken'];exports[_0x7d39('0x6')]=passport['authenticate'](_0x7d39('0x7'),{'failureRedirect':_0x7d39('0x8'),'scope':[_0x7d39('0x9'),_0x7d39('0xa')],'session':![]});exports['callback']=passport[_0x7d39('0xb')](_0x7d39('0x7'),{'failureRedirect':_0x7d39('0x8'),'session':![]});passport[_0x7d39('0xc')](new GoogleStrategy({'clientID':config[_0x7d39('0x7')]?config['google']['clientID']:'id','clientSecret':config[_0x7d39('0x7')]?config[_0x7d39('0x7')][_0x7d39('0xd')]:_0x7d39('0xe'),'callbackURL':config[_0x7d39('0x7')]?config[_0x7d39('0x7')][_0x7d39('0xf')]:''},function(_0x45669b,_0x20c957,_0x3675dd,_0x292d5c){db[_0x7d39('0x10')][_0x7d39('0x11')]({'where':{'email':_['map'](_0x3675dd[_0x7d39('0x12')],_0x7d39('0x13')),'role':{'$or':[_0x7d39('0x14'),_0x7d39('0x15'),_0x7d39('0x16')]}}})[_0x7d39('0x17')](function(_0x161b54){if(_0x161b54){return _0x292d5c(null,_0x161b54);}_0x292d5c('User\x20email\x20not\x20found!');})['catch'](function(_0x55b494){_0x292d5c(_0x55b494);});})); \ No newline at end of file +var _0x11b7=['authenticate','google','/login','email','callback','use','clientID','clientSecret','callbackURL','User','value','admin','user','then','User\x20email\x20not\x20found!','catch','lodash','passport','Strategy','../../mysqldb','../../config/environment','signToken','login'];(function(_0x4fc165,_0x43de15){var _0x5d8121=function(_0xec399a){while(--_0xec399a){_0x4fc165['push'](_0x4fc165['shift']());}};_0x5d8121(++_0x43de15);}(_0x11b7,0x180));var _0x711b=function(_0x34357e,_0x5af72a){_0x34357e=_0x34357e-0x0;var _0x488189=_0x11b7[_0x34357e];return _0x488189;};'use strict';var _=require(_0x711b('0x0'));var passport=require(_0x711b('0x1'));var GoogleStrategy=require('passport-google-oauth20')[_0x711b('0x2')];var db=require(_0x711b('0x3'))['db'];var config=require(_0x711b('0x4'));var signToken=require('../../components/auth/service')[_0x711b('0x5')];exports[_0x711b('0x6')]=passport[_0x711b('0x7')](_0x711b('0x8'),{'failureRedirect':_0x711b('0x9'),'scope':['profile',_0x711b('0xa')],'session':![]});exports[_0x711b('0xb')]=passport[_0x711b('0x7')](_0x711b('0x8'),{'failureRedirect':_0x711b('0x9'),'session':![]});passport[_0x711b('0xc')](new GoogleStrategy({'clientID':config[_0x711b('0x8')]?config['google'][_0x711b('0xd')]:'id','clientSecret':config[_0x711b('0x8')]?config[_0x711b('0x8')][_0x711b('0xe')]:'secret','callbackURL':config['google']?config[_0x711b('0x8')][_0x711b('0xf')]:''},function(_0x3ceeb9,_0x47eb2b,_0x1591b7,_0x55adfd){db[_0x711b('0x10')]['find']({'where':{'email':_['map'](_0x1591b7['emails'],_0x711b('0x11')),'role':{'$or':[_0x711b('0x12'),_0x711b('0x13'),'agent']}}})[_0x711b('0x14')](function(_0x8689a1){if(_0x8689a1){return _0x55adfd(null,_0x8689a1);}_0x55adfd(_0x711b('0x15'));})[_0x711b('0x16')](function(_0x4c0151){_0x55adfd(_0x4c0151);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 8fbbabe..a1cd4c4 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 _0x181b=['callback','exports','express','passport','../../components/auth/service','setTokenCookie','login','get','/callback'];(function(_0x530bf4,_0x43837f){var _0x5aad64=function(_0x18950c){while(--_0x18950c){_0x530bf4['push'](_0x530bf4['shift']());}};_0x5aad64(++_0x43837f);}(_0x181b,0x14f));var _0xb181=function(_0x3bc6cf,_0x2b3a36){_0x3bc6cf=_0x3bc6cf-0x0;var _0x2e4b94=_0x181b[_0x3bc6cf];return _0x2e4b94;};'use strict';var express=require(_0xb181('0x0'));var passport=require(_0xb181('0x1'));var router=express['Router']();var controller=require('./authGoogle.controller');var setTokenCookie=require(_0xb181('0x2'))[_0xb181('0x3')];router['get']('/',controller[_0xb181('0x4')]);router[_0xb181('0x5')](_0xb181('0x6'),controller[_0xb181('0x7')],setTokenCookie);module[_0xb181('0x8')]=router; \ No newline at end of file +var _0xfa85=['get','/callback','callback','exports','express','passport','./authGoogle.controller','../../components/auth/service','setTokenCookie'];(function(_0xfd9239,_0x2fea4f){var _0x48f447=function(_0x49af16){while(--_0x49af16){_0xfd9239['push'](_0xfd9239['shift']());}};_0x48f447(++_0x2fea4f);}(_0xfa85,0x1b4));var _0x5fa8=function(_0x1c9d38,_0x1f42fd){_0x1c9d38=_0x1c9d38-0x0;var _0x5e172a=_0xfa85[_0x1c9d38];return _0x5e172a;};'use strict';var express=require(_0x5fa8('0x0'));var passport=require(_0x5fa8('0x1'));var router=express['Router']();var controller=require(_0x5fa8('0x2'));var setTokenCookie=require(_0x5fa8('0x3'))[_0x5fa8('0x4')];router[_0x5fa8('0x5')]('/',controller['login']);router['get'](_0x5fa8('0x6'),controller[_0x5fa8('0x7')],setTokenCookie);module[_0x5fa8('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 5c67a21..a904275 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 _0xb235=['admin','user','authenticate','This\x20password\x20is\x20not\x20correct','MailAccount','find','name','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','login','local','json','online','forgot','body','email','Email\x20parameter\x20is\x20missing','generate','trim','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','password','Password\x20reset!','use','Strategy','bluebird','jayson/promise','lodash','../../config/logger','api','randomstring','../../components/auth/service','signToken','client','role','User','count','agent','then','../../config/license/util','getLicense','agents','catch'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xb235,0x10d));var _0x5b23=function(_0x4814a7,_0x1a084d){_0x4814a7=_0x4814a7-0x0;var _0x406700=_0xb235[_0x4814a7];return _0x406700;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require('passport-local')[_0x5b23('0x0')];var BPromise=require(_0x5b23('0x1'));var jayson=require(_0x5b23('0x2'));var _=require(_0x5b23('0x3'));var logger=require(_0x5b23('0x4'))(_0x5b23('0x5'));var rs=require(_0x5b23('0x6'));var db=require('../../mysqldb')['db'];var signToken=require(_0x5b23('0x7'))[_0x5b23('0x8')];var client=jayson[_0x5b23('0x9')]['http']({'port':0x232b});var getLicense=function(_0x819497){return new BPromise(function(_0x5b86d2,_0x5bea9e){var _0x12d845=0x0;_0x819497[_0x5b23('0xa')]!=='agent'&&_0x5b86d2(_0x819497);return db[_0x5b23('0xb')][_0x5b23('0xc')]({'where':{'role':_0x5b23('0xd'),'online':!![],'id':{'$ne':_0x819497['id']}}})[_0x5b23('0xe')](function(_0x14b68c){_0x12d845=_0x14b68c;return require(_0x5b23('0xf'))[_0x5b23('0x10')]();})[_0x5b23('0xe')](function(_0x33c486){if(_0x33c486&&_0x33c486[_0x5b23('0x11')]&&_0x12d845>=_0x33c486[_0x5b23('0x11')]){return _0x5bea9e({'message':'Maximum\x20login\x20has\x20been\x20reached'});}return _0x5b86d2(_0x819497);})[_0x5b23('0x12')](function(_0x36726a){return _0x5bea9e(_0x36726a);});});};function localAuthenticate(_0x108156,_0xeaabd9,_0x29706d,_0xda27ec){_0x108156['find']({'where':{'name':_0xeaabd9,'role':{'$or':[_0x5b23('0x13'),_0x5b23('0x14'),_0x5b23('0xd')]}}})['then'](function(_0xb84240){if(!_0xb84240||_0xb84240&&_0xb84240['name']!==_0xeaabd9){return _0xda27ec(null,![],{'message':'This\x20name\x20is\x20not\x20registered'});}return getLicense(_0xb84240);})[_0x5b23('0xe')](function(_0x311f01){_0x311f01[_0x5b23('0x15')](_0x29706d,function(_0x113022,_0x1c1226){if(_0x113022){return _0xda27ec(_0x113022);}if(!_0x1c1226){return _0xda27ec(null,![],{'message':_0x5b23('0x16')});}else{return _0xda27ec(null,_0x311f01);}});})[_0x5b23('0x12')](function(_0x549911){_0xda27ec(_0x549911);});}function sendServiceMail(_0x2ad9b7){return db[_0x5b23('0x17')][_0x5b23('0x18')]({'where':{'service':!![]},'attributes':['id',_0x5b23('0x19'),'email'],'include':[{'model':db[_0x5b23('0x1a')],'as':_0x5b23('0x1b')}]})['then'](function(_0x4ce369){if(!_0x4ce369){throw new Error(_0x5b23('0x1c'));}var _0xddc560={'tls':{'rejectUnauthorized':![]}};if(_0x4ce369[_0x5b23('0x1b')][_0x5b23('0x1d')]){_0xddc560[_0x5b23('0x1d')]=_0x4ce369[_0x5b23('0x1b')]['service'];}else{_0xddc560[_0x5b23('0x1e')]=_0x4ce369[_0x5b23('0x1b')][_0x5b23('0x1e')];_0xddc560[_0x5b23('0x1f')]=_0x4ce369[_0x5b23('0x1b')][_0x5b23('0x1f')];_0xddc560[_0x5b23('0x20')]=_0x4ce369[_0x5b23('0x1b')]['secure'];}if(_0x4ce369[_0x5b23('0x1b')][_0x5b23('0x21')]){_0xddc560[_0x5b23('0x22')]={'user':_0x4ce369[_0x5b23('0x1b')][_0x5b23('0x14')],'pass':_0x4ce369['Smtp'][_0x5b23('0x23')]};}var _0x5e8d24={'account':_0xddc560,'message':_[_0x5b23('0x24')]({'from':util[_0x5b23('0x25')](_0x5b23('0x26'),_0x4ce369[_0x5b23('0x19')],_0x4ce369['email']||_0x4ce369[_0x5b23('0x1b')]['user'])},_0x2ad9b7)};return client[_0x5b23('0x27')]('SendMail',_0x5e8d24);})[_0x5b23('0xe')](function(_0x125850){if(_0x125850[_0x5b23('0x28')]){throw new Error(util[_0x5b23('0x25')](_0x5b23('0x29'),_0x125850[_0x5b23('0x28')]['message']||JSON[_0x5b23('0x2a')](_0x125850[_0x5b23('0x28')])));}return!![];});}function handleError(_0x2c4f28,_0x46572c,_0x3e5c5e){return _0x2c4f28[_0x5b23('0x2b')](_0x46572c||0x1f4)[_0x5b23('0x2c')]({'message':_0x3e5c5e?_0x3e5c5e['message']||_0x3e5c5e:''});}exports[_0x5b23('0x2d')]=function(_0x4e10d3,_0x481218,_0xd98be){passport['authenticate'](_0x5b23('0x2e'),function(_0x4bb818,_0x274474,_0x45a049){var _0x1a877d=_0x4bb818||_0x45a049;if(_0x1a877d){return handleError(_0x481218,0x191,_0x1a877d);}if(!_0x274474){return handleError(_0x481218,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}var _0x3f87e1=signToken(_0x274474['id'],_0x274474[_0x5b23('0xa')]);_0x481218[_0x5b23('0x2f')]({'id':_0x274474['id'],'token':_0x3f87e1,'statusCall':'','isAlreadyLogged':_0x274474[_0x5b23('0x30')]});})(_0x4e10d3,_0x481218,_0xd98be);};exports[_0x5b23('0x31')]=function(_0x22ef90,_0x23d7fd,_0x228b87){if(!_0x22ef90[_0x5b23('0x32')][_0x5b23('0x33')]){return handleError(_0x23d7fd,0x1f4,{'message':_0x5b23('0x34')});}var _0x26c1fa=rs[_0x5b23('0x35')]();_0x22ef90[_0x5b23('0x32')]['email']=_0x22ef90[_0x5b23('0x32')]['email'][_0x5b23('0x36')]()['toLowerCase']();return db[_0x5b23('0xb')][_0x5b23('0x18')]({'where':{'email':_0x22ef90[_0x5b23('0x32')][_0x5b23('0x33')]}})[_0x5b23('0xe')](function(_0x140b43){if(!_0x140b43){throw new Error('This\x20email\x20is\x20not\x20registered.');}_0x140b43[_0x5b23('0x37')]=_0x26c1fa;_0x140b43[_0x5b23('0x38')]=Date['now']()+0x36ee80;return _0x140b43[_0x5b23('0x39')]();})['then'](function(){return sendServiceMail({'to':_0x22ef90[_0x5b23('0x32')]['email'],'subject':_0x5b23('0x3a'),'text':_0x5b23('0x3b')+_0x5b23('0x3c')+_0x5b23('0x3d')+_0x22ef90[_0x5b23('0x3e')][_0x5b23('0x1e')]+_0x5b23('0x3f')+_0x26c1fa+'\x0a\x0a'+_0x5b23('0x40')});})[_0x5b23('0xe')](function(){_0x23d7fd[_0x5b23('0x2b')](0xc8)[_0x5b23('0x2c')]({'message':'Reset\x20Email\x20sent!'});})[_0x5b23('0x12')](function(_0x447789){return handleError(_0x23d7fd,0x1f4,_0x447789);});};exports[_0x5b23('0x41')]=function(_0x163078,_0x2f27f5,_0x184336){return db[_0x5b23('0xb')]['find']({'where':{'resetPasswordToken':_0x163078[_0x5b23('0x42')][_0x5b23('0x43')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x322018){if(!_0x322018){throw new Error(_0x5b23('0x44'));}_0x322018[_0x5b23('0x45')]=_0x163078[_0x5b23('0x32')][_0x5b23('0x45')];_0x322018[_0x5b23('0x37')]=null;_0x322018['resetPasswordExpires']=null;return _0x322018[_0x5b23('0x39')]();})['then'](function(){_0x2f27f5[_0x5b23('0x2b')](0xc8)[_0x5b23('0x2c')]({'message':_0x5b23('0x46')});})[_0x5b23('0x12')](function(_0x36074b){return handleError(_0x2f27f5,0x1f4,_0x36074b);});};passport[_0x5b23('0x47')](new LocalStrategy({'usernameField':'name','passwordField':_0x5b23('0x45')},function(_0x2cbde6,_0x42c95c,_0x278941){return localAuthenticate(db['User'],_0x2cbde6,_0x42c95c,_0x278941);})); \ No newline at end of file +var _0x4f52=['MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','authentication','auth','user','pass','merge','format','\x22%s\x22\x20<%s>','email','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','login','local','json','online','forgot','generate','body','trim','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','http://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','send','Reset\x20Email\x20sent!','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','password','resetPasswordExpires','use','util','passport','passport-local','bluebird','lodash','../../config/logger','api','../../mysqldb','../../components/auth/service','signToken','client','role','agent','User','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','name','This\x20name\x20is\x20not\x20registered','authenticate','MailAccount','find'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4f52,0x18c));var _0x24f5=function(_0x14ad1f,_0x325de2){_0x14ad1f=_0x14ad1f-0x0;var _0x1c97ae=_0x4f52[_0x14ad1f];return _0x1c97ae;};'use strict';var util=require(_0x24f5('0x0'));var passport=require(_0x24f5('0x1'));var LocalStrategy=require(_0x24f5('0x2'))['Strategy'];var BPromise=require(_0x24f5('0x3'));var jayson=require('jayson/promise');var _=require(_0x24f5('0x4'));var logger=require(_0x24f5('0x5'))(_0x24f5('0x6'));var rs=require('randomstring');var db=require(_0x24f5('0x7'))['db'];var signToken=require(_0x24f5('0x8'))[_0x24f5('0x9')];var client=jayson[_0x24f5('0xa')]['http']({'port':0x232b});var getLicense=function(_0x2966c3){return new BPromise(function(_0x2e8afb,_0x262252){var _0x179912=0x0;_0x2966c3[_0x24f5('0xb')]!==_0x24f5('0xc')&&_0x2e8afb(_0x2966c3);return db[_0x24f5('0xd')]['count']({'where':{'role':_0x24f5('0xc'),'online':!![],'id':{'$ne':_0x2966c3['id']}}})[_0x24f5('0xe')](function(_0x459b99){_0x179912=_0x459b99;return require('../../config/license/util')[_0x24f5('0xf')]();})[_0x24f5('0xe')](function(_0x1f611e){if(_0x1f611e&&_0x1f611e[_0x24f5('0x10')]&&_0x179912>=_0x1f611e[_0x24f5('0x10')]){return _0x262252({'message':_0x24f5('0x11')});}return _0x2e8afb(_0x2966c3);})[_0x24f5('0x12')](function(_0x92f594){return _0x262252(_0x92f594);});});};function localAuthenticate(_0x3b01dd,_0x1ea8eb,_0x179a79,_0x3ff99a){_0x3b01dd['find']({'where':{'name':_0x1ea8eb,'role':{'$or':['admin','user',_0x24f5('0xc')]}}})[_0x24f5('0xe')](function(_0x40095){if(!_0x40095||_0x40095&&_0x40095[_0x24f5('0x13')]!==_0x1ea8eb){return _0x3ff99a(null,![],{'message':_0x24f5('0x14')});}return getLicense(_0x40095);})[_0x24f5('0xe')](function(_0x2483bf){_0x2483bf[_0x24f5('0x15')](_0x179a79,function(_0x1c9e76,_0x148d43){if(_0x1c9e76){return _0x3ff99a(_0x1c9e76);}if(!_0x148d43){return _0x3ff99a(null,![],{'message':'This\x20password\x20is\x20not\x20correct'});}else{return _0x3ff99a(null,_0x2483bf);}});})[_0x24f5('0x12')](function(_0x2a2017){_0x3ff99a(_0x2a2017);});}function sendServiceMail(_0x4d7ad3){return db[_0x24f5('0x16')][_0x24f5('0x17')]({'where':{'service':!![]},'attributes':['id',_0x24f5('0x13'),'email'],'include':[{'model':db[_0x24f5('0x18')],'as':_0x24f5('0x19')}]})[_0x24f5('0xe')](function(_0x2aadd0){if(!_0x2aadd0){throw new Error(_0x24f5('0x1a'));}var _0x19facb={'tls':{'rejectUnauthorized':![]}};if(_0x2aadd0['Smtp']['service']){_0x19facb[_0x24f5('0x1b')]=_0x2aadd0['Smtp'][_0x24f5('0x1b')];}else{_0x19facb[_0x24f5('0x1c')]=_0x2aadd0[_0x24f5('0x19')][_0x24f5('0x1c')];_0x19facb[_0x24f5('0x1d')]=_0x2aadd0[_0x24f5('0x19')][_0x24f5('0x1d')];_0x19facb['secure']=_0x2aadd0[_0x24f5('0x19')]['secure'];}if(_0x2aadd0[_0x24f5('0x19')][_0x24f5('0x1e')]){_0x19facb[_0x24f5('0x1f')]={'user':_0x2aadd0[_0x24f5('0x19')][_0x24f5('0x20')],'pass':_0x2aadd0['Smtp'][_0x24f5('0x21')]};}var _0x4f3ceb={'account':_0x19facb,'message':_[_0x24f5('0x22')]({'from':util[_0x24f5('0x23')](_0x24f5('0x24'),_0x2aadd0['name'],_0x2aadd0[_0x24f5('0x25')]||_0x2aadd0[_0x24f5('0x19')][_0x24f5('0x20')])},_0x4d7ad3)};return client[_0x24f5('0x26')](_0x24f5('0x27'),_0x4f3ceb);})['then'](function(_0x50a113){if(_0x50a113[_0x24f5('0x28')]){throw new Error(util['format'](_0x24f5('0x29'),_0x50a113[_0x24f5('0x28')][_0x24f5('0x2a')]||JSON[_0x24f5('0x2b')](_0x50a113[_0x24f5('0x28')])));}return!![];});}function handleError(_0x25bfaf,_0x1e9fc4,_0x449bc7){return _0x25bfaf['status'](_0x1e9fc4||0x1f4)['send']({'message':_0x449bc7?_0x449bc7[_0x24f5('0x2a')]||_0x449bc7:''});}exports[_0x24f5('0x2c')]=function(_0x25dead,_0x373fa3,_0x112c4c){passport[_0x24f5('0x15')](_0x24f5('0x2d'),function(_0x207df9,_0xddc278,_0x3e4eec){var _0x6b78b4=_0x207df9||_0x3e4eec;if(_0x6b78b4){return handleError(_0x373fa3,0x191,_0x6b78b4);}if(!_0xddc278){return handleError(_0x373fa3,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}var _0x535bfb=signToken(_0xddc278['id'],_0xddc278[_0x24f5('0xb')]);_0x373fa3[_0x24f5('0x2e')]({'id':_0xddc278['id'],'token':_0x535bfb,'statusCall':'','isAlreadyLogged':_0xddc278[_0x24f5('0x2f')]});})(_0x25dead,_0x373fa3,_0x112c4c);};exports[_0x24f5('0x30')]=function(_0x5fae84,_0x2b4b46,_0xda00c9){if(!_0x5fae84['body'][_0x24f5('0x25')]){return handleError(_0x2b4b46,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x5895d6=rs[_0x24f5('0x31')]();_0x5fae84[_0x24f5('0x32')][_0x24f5('0x25')]=_0x5fae84[_0x24f5('0x32')][_0x24f5('0x25')][_0x24f5('0x33')]()['toLowerCase']();return db[_0x24f5('0xd')][_0x24f5('0x17')]({'where':{'email':_0x5fae84['body'][_0x24f5('0x25')]}})['then'](function(_0x4c6635){if(!_0x4c6635){throw new Error(_0x24f5('0x34'));}_0x4c6635[_0x24f5('0x35')]=_0x5895d6;_0x4c6635['resetPasswordExpires']=Date[_0x24f5('0x36')]()+0x36ee80;return _0x4c6635[_0x24f5('0x37')]();})['then'](function(){return sendServiceMail({'to':_0x5fae84[_0x24f5('0x32')][_0x24f5('0x25')],'subject':_0x24f5('0x38'),'text':_0x24f5('0x39')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x24f5('0x3a')+_0x5fae84['headers']['host']+_0x24f5('0x3b')+_0x5895d6+'\x0a\x0a'+_0x24f5('0x3c')});})[_0x24f5('0xe')](function(){_0x2b4b46[_0x24f5('0x3d')](0xc8)[_0x24f5('0x3e')]({'message':_0x24f5('0x3f')});})['catch'](function(_0x27646c){return handleError(_0x2b4b46,0x1f4,_0x27646c);});};exports[_0x24f5('0x40')]=function(_0x3189d8,_0x247a82,_0x203d54){return db[_0x24f5('0xd')][_0x24f5('0x17')]({'where':{'resetPasswordToken':_0x3189d8[_0x24f5('0x41')]['token'],'resetPasswordExpires':{'$gt':Date[_0x24f5('0x36')]()}}})[_0x24f5('0xe')](function(_0x45173f){if(!_0x45173f){throw new Error(_0x24f5('0x42'));}_0x45173f[_0x24f5('0x43')]=_0x3189d8[_0x24f5('0x32')]['password'];_0x45173f[_0x24f5('0x35')]=null;_0x45173f[_0x24f5('0x44')]=null;return _0x45173f[_0x24f5('0x37')]();})[_0x24f5('0xe')](function(){_0x247a82['status'](0xc8)['send']({'message':'Password\x20reset!'});})[_0x24f5('0x12')](function(_0x1224b9){return handleError(_0x247a82,0x1f4,_0x1224b9);});};passport[_0x24f5('0x45')](new LocalStrategy({'usernameField':_0x24f5('0x13'),'passwordField':'password'},function(_0x3b0a7e,_0x24e050,_0x2b197e){return localAuthenticate(db[_0x24f5('0xd')],_0x3b0a7e,_0x24e050,_0x2b197e);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index e964e51..351e0a5 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 _0xad19=['reset','express','Router','login','post','/forgot','forgot','/reset/:token'];(function(_0x43076d,_0x5d4d8d){var _0x45c9be=function(_0xa9d712){while(--_0xa9d712){_0x43076d['push'](_0x43076d['shift']());}};_0x45c9be(++_0x5d4d8d);}(_0xad19,0x171));var _0x9ad1=function(_0x16be5c,_0xb38e8b){_0x16be5c=_0x16be5c-0x0;var _0x56e934=_0xad19[_0x16be5c];return _0x56e934;};'use strict';var express=require(_0x9ad1('0x0'));var router=express[_0x9ad1('0x1')]();var controller=require('./authLocal.controller');router['post']('/',controller[_0x9ad1('0x2')]);router[_0x9ad1('0x3')](_0x9ad1('0x4'),controller[_0x9ad1('0x5')]);router[_0x9ad1('0x3')](_0x9ad1('0x6'),controller[_0x9ad1('0x7')]);module['exports']=router; \ No newline at end of file +var _0x8aca=['/reset/:token','reset','exports','express','post','login','/forgot','forgot'];(function(_0x4222de,_0x567252){var _0x1ff142=function(_0x4859ae){while(--_0x4859ae){_0x4222de['push'](_0x4222de['shift']());}};_0x1ff142(++_0x567252);}(_0x8aca,0x113));var _0xa8ac=function(_0x235f49,_0x2992b4){_0x235f49=_0x235f49-0x0;var _0x551139=_0x8aca[_0x235f49];return _0x551139;};'use strict';var express=require(_0xa8ac('0x0'));var router=express['Router']();var controller=require('./authLocal.controller');router[_0xa8ac('0x1')]('/',controller[_0xa8ac('0x2')]);router[_0xa8ac('0x1')](_0xa8ac('0x3'),controller[_0xa8ac('0x4')]);router[_0xa8ac('0x1')](_0xa8ac('0x5'),controller[_0xa8ac('0x6')]);module[_0xa8ac('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 35b645c..0225ba7 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 _0x6a6e=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x6a6e,0xe3));var _0xe6a6=function(_0x5ab90e,_0x9d6d92){_0x5ab90e=_0x5ab90e-0x0;var _0x546739=_0x6a6e[_0x5ab90e];return _0x546739;};'use strict';var Sequelize=require(_0xe6a6('0x0'));module[_0xe6a6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xe6a6('0x2')]},'description':{'type':Sequelize[_0xe6a6('0x2')]},'status':{'type':Sequelize[_0xe6a6('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xe6a6('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x7df3=['sequelize','exports','STRING','BOOLEAN'];(function(_0xede691,_0x422dcb){var _0x565fe8=function(_0x4dd244){while(--_0x4dd244){_0xede691['push'](_0xede691['shift']());}};_0x565fe8(++_0x422dcb);}(_0x7df3,0x1cc));var _0x37df=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x7df3[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require(_0x37df('0x0'));module[_0x37df('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x37df('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x37df('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 510c4dd..e7c3570 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 _0x7616=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','update','then','end','error','stack','name','send','index','Automation','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','type','key','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','addConditions','Condition','ids','getConditions','order','pick','addActions','Action','omit','findOne','getActions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','api'];(function(_0x470bfb,_0x389787){var _0x2f5d97=function(_0x3431b4){while(--_0x3431b4){_0x470bfb['push'](_0x470bfb['shift']());}};_0x2f5d97(++_0x389787);}(_0x7616,0x133));var _0x6761=function(_0xa4f78d,_0x1eeee4){_0xa4f78d=_0xa4f78d-0x0;var _0x33ee85=_0x7616[_0xa4f78d];return _0x33ee85;};'use strict';var pdf=require(_0x6761('0x0'));var emlformat=require(_0x6761('0x1'));var rimraf=require(_0x6761('0x2'));var zipdir=require(_0x6761('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6761('0x4'));var moment=require(_0x6761('0x5'));var BPromise=require(_0x6761('0x6'));var Mustache=require(_0x6761('0x7'));var util=require(_0x6761('0x8'));var path=require(_0x6761('0x9'));var sox=require('sox');var csv=require(_0x6761('0xa'));var ejs=require(_0x6761('0xb'));var fs=require('fs');var _=require(_0x6761('0xc'));var squel=require(_0x6761('0xd'));var crypto=require('crypto');var jsforce=require(_0x6761('0xe'));var deskjs=require(_0x6761('0xf'));var toCsv=require(_0x6761('0xa'));var querystring=require('querystring');var Papa=require(_0x6761('0x10'));var authService=require(_0x6761('0x11'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x6761('0x12'));var qs=require(_0x6761('0x13'));var logger=require('../../config/logger')(_0x6761('0x14'));var utils=require(_0x6761('0x15'));var config=require(_0x6761('0x16'));var db=require(_0x6761('0x17'))['db'];function respondWithStatusCode(_0xbb954d,_0x1e8871){_0x1e8871=_0x1e8871||0xcc;return function(_0x3e713a){if(_0x3e713a){return _0xbb954d[_0x6761('0x18')](_0x1e8871);}return _0xbb954d[_0x6761('0x19')](_0x1e8871)['end']();};}function respondWithResult(_0x41dd98,_0x43785b){_0x43785b=_0x43785b||0xc8;return function(_0x3f3351){if(_0x3f3351){return _0x41dd98[_0x6761('0x19')](_0x43785b)[_0x6761('0x1a')](_0x3f3351);}};}function respondWithFilteredResult(_0x639ce2,_0x43632f){return function(_0x50620f){if(_0x50620f){var _0x4da8ce=_0x50620f['count'],_0x49f0e9=_0x43632f[_0x6761('0x1b')],_0x14838b=_0x43632f['offset']+_0x43632f[_0x6761('0x1c')],_0x4e648e;if(_0x14838b>=_0x4da8ce){_0x14838b=_0x4da8ce;_0x4e648e=0xc8;}else{_0x4e648e=0xce;}_0x639ce2[_0x6761('0x19')](_0x4e648e);return _0x639ce2[_0x6761('0x1d')](_0x6761('0x1e'),_0x49f0e9+'-'+_0x14838b+'/'+_0x4da8ce)[_0x6761('0x1a')](_0x50620f);}return null;};}function patchUpdates(_0x4812fa){return function(_0x34ef1e){try{jsonpatch['apply'](_0x34ef1e,_0x4812fa,!![]);}catch(_0x540cb3){return BPromise['reject'](_0x540cb3);}return _0x34ef1e['save']();};}function saveUpdates(_0x30a6ee,_0x4fb45a){return function(_0x5cfbc6){if(_0x5cfbc6){return _0x5cfbc6[_0x6761('0x1f')](_0x30a6ee)[_0x6761('0x20')](function(_0x1087c7){return _0x1087c7;});}return null;};}function removeEntity(_0x2d7f50,_0x1c1382){return function(_0x158dae){if(_0x158dae){return _0x158dae['destroy']()['then'](function(){_0x2d7f50['status'](0xcc)[_0x6761('0x21')]();});}};}function handleEntityNotFound(_0x57f96b,_0x52c5d8){return function(_0x4b2c94){if(!_0x4b2c94){_0x57f96b[_0x6761('0x18')](0x194);}return _0x4b2c94;};}function handleError(_0x1fa42e,_0x592855){_0x592855=_0x592855||0x1f4;return function(_0x46a623){logger[_0x6761('0x22')](_0x46a623[_0x6761('0x23')]);if(_0x46a623[_0x6761('0x24')]){delete _0x46a623[_0x6761('0x24')];}_0x1fa42e[_0x6761('0x19')](_0x592855)[_0x6761('0x25')](_0x46a623);};}exports[_0x6761('0x26')]=function(_0x3f9f70,_0x53f63f){var _0x761450={},_0x3f062e={},_0x5ab55f={'count':0x0,'rows':[]};var _0x18630e=db[_0x6761('0x27')][_0x6761('0x28')];_0x3f062e[_0x6761('0x29')]=_[_0x6761('0x2a')](_0x18630e);_0x3f062e[_0x6761('0x2b')]=_[_0x6761('0x2a')](_0x3f9f70['query']);_0x3f062e[_0x6761('0x2c')]=_[_0x6761('0x2d')](_0x3f062e['model'],_0x3f062e['query']);_0x761450['attributes']=_['intersection'](_0x3f062e[_0x6761('0x29')],qs[_0x6761('0x2e')](_0x3f9f70[_0x6761('0x2b')][_0x6761('0x2e')]));_0x761450[_0x6761('0x2f')]=_0x761450[_0x6761('0x2f')][_0x6761('0x30')]?_0x761450[_0x6761('0x2f')]:_0x3f062e[_0x6761('0x29')];if(!_0x3f9f70[_0x6761('0x2b')][_0x6761('0x31')](_0x6761('0x32'))){_0x761450[_0x6761('0x1c')]=qs[_0x6761('0x1c')](_0x3f9f70['query']['limit']);_0x761450[_0x6761('0x1b')]=qs[_0x6761('0x1b')](_0x3f9f70['query'][_0x6761('0x1b')]);}_0x761450['order']=qs[_0x6761('0x33')](_0x3f9f70[_0x6761('0x2b')][_0x6761('0x33')]);_0x761450[_0x6761('0x34')]=qs[_0x6761('0x2c')](_['pick'](_0x3f9f70[_0x6761('0x2b')],_0x3f062e[_0x6761('0x2c')]));if(_0x3f9f70[_0x6761('0x2b')][_0x6761('0x35')]){_0x761450[_0x6761('0x34')]=_[_0x6761('0x36')](_0x761450[_0x6761('0x34')],{'$or':_[_0x6761('0x37')](_0x18630e,function(_0x5e3dec){if(_0x5e3dec[_0x6761('0x38')][_0x6761('0x39')]!==_0x6761('0x3a')){var _0x267185={};_0x267185[_0x5e3dec['field']]={'$like':'%'+_0x3f9f70[_0x6761('0x2b')][_0x6761('0x35')]+'%'};return _0x267185;}})});}_0x761450=_[_0x6761('0x36')]({},_0x761450,_0x3f9f70[_0x6761('0x3b')]);var _0x7b05ba={'where':_0x761450['where']};return db[_0x6761('0x27')]['count'](_0x7b05ba)[_0x6761('0x20')](function(_0x5ca3dc){_0x5ab55f['count']=_0x5ca3dc;if(_0x3f9f70[_0x6761('0x2b')][_0x6761('0x3c')]){_0x761450[_0x6761('0x3d')]=[{'all':!![]}];}return db['Automation'][_0x6761('0x3e')](_0x761450);})['then'](function(_0x283322){_0x5ab55f[_0x6761('0x3f')]=_0x283322;return _0x5ab55f;})[_0x6761('0x20')](respondWithFilteredResult(_0x53f63f,_0x761450))[_0x6761('0x40')](handleError(_0x53f63f,null));};exports[_0x6761('0x41')]=function(_0xe31f0,_0x195666){var _0x5a38a7={'raw':![],'where':{'id':_0xe31f0[_0x6761('0x42')]['id']}},_0x3d141a={};_0x3d141a[_0x6761('0x29')]=_[_0x6761('0x2a')](db[_0x6761('0x27')][_0x6761('0x28')]);_0x3d141a[_0x6761('0x2b')]=_[_0x6761('0x2a')](_0xe31f0[_0x6761('0x2b')]);_0x3d141a[_0x6761('0x2c')]=_[_0x6761('0x2d')](_0x3d141a[_0x6761('0x29')],_0x3d141a[_0x6761('0x2b')]);_0x5a38a7['attributes']=_[_0x6761('0x2d')](_0x3d141a['model'],qs[_0x6761('0x2e')](_0xe31f0[_0x6761('0x2b')][_0x6761('0x2e')]));_0x5a38a7[_0x6761('0x2f')]=_0x5a38a7['attributes']['length']?_0x5a38a7[_0x6761('0x2f')]:_0x3d141a[_0x6761('0x29')];if(_0xe31f0[_0x6761('0x2b')][_0x6761('0x3c')]){_0x5a38a7['include']=[{'all':!![]}];}_0x5a38a7=_[_0x6761('0x36')]({},_0x5a38a7,_0xe31f0[_0x6761('0x3b')]);return db['Automation'][_0x6761('0x43')](_0x5a38a7)[_0x6761('0x20')](handleEntityNotFound(_0x195666,null))[_0x6761('0x20')](respondWithResult(_0x195666,null))[_0x6761('0x40')](handleError(_0x195666,null));};exports['create']=function(_0x244b75,_0x2eb1a1){return db['Automation'][_0x6761('0x44')](_0x244b75[_0x6761('0x45')],{})[_0x6761('0x20')](respondWithResult(_0x2eb1a1,0xc9))['catch'](handleError(_0x2eb1a1,null));};exports['update']=function(_0x461207,_0x1f4176){if(_0x461207[_0x6761('0x45')]['id']){delete _0x461207[_0x6761('0x45')]['id'];}return db[_0x6761('0x27')][_0x6761('0x43')]({'where':{'id':_0x461207[_0x6761('0x42')]['id']}})['then'](handleEntityNotFound(_0x1f4176,null))[_0x6761('0x20')](saveUpdates(_0x461207[_0x6761('0x45')],null))[_0x6761('0x20')](respondWithResult(_0x1f4176,null))[_0x6761('0x40')](handleError(_0x1f4176,null));};exports[_0x6761('0x46')]=function(_0x1fe20f,_0x42b7db){return db[_0x6761('0x27')][_0x6761('0x43')]({'where':{'id':_0x1fe20f[_0x6761('0x42')]['id']}})[_0x6761('0x20')](handleEntityNotFound(_0x42b7db,null))['then'](removeEntity(_0x42b7db,null))['catch'](handleError(_0x42b7db,null));};exports[_0x6761('0x47')]=function(_0x56161f,_0x2b7693,_0x416b39){return db[_0x6761('0x48')][_0x6761('0x43')]({'where':{'id':_0x56161f[_0x6761('0x42')]['id']}})[_0x6761('0x20')](handleEntityNotFound(_0x2b7693,null))[_0x6761('0x20')](function(_0x16cc0e){if(_0x16cc0e){return _0x16cc0e[_0x6761('0x47')](_0x56161f[_0x6761('0x45')][_0x6761('0x49')],_['omit'](_0x56161f[_0x6761('0x45')],['ids','id'])||{});}})['then'](respondWithResult(_0x2b7693,null))['catch'](handleError(_0x2b7693,null));};exports[_0x6761('0x4a')]=function(_0x351939,_0x903079,_0x3d669f){var _0x15d384={};var _0x34dc30={};var _0x34ae97;var _0x49aeff;return db[_0x6761('0x27')]['findOne']({'where':{'id':_0x351939[_0x6761('0x42')]['id']}})['then'](handleEntityNotFound(_0x903079,null))['then'](function(_0x3f0ceb){if(_0x3f0ceb){_0x34ae97=_0x3f0ceb;_0x34dc30[_0x6761('0x29')]=_[_0x6761('0x2a')](db['Condition'][_0x6761('0x28')]);_0x34dc30[_0x6761('0x2b')]=_[_0x6761('0x2a')](_0x351939[_0x6761('0x2b')]);_0x34dc30[_0x6761('0x2c')]=_[_0x6761('0x2d')](_0x34dc30[_0x6761('0x29')],_0x34dc30[_0x6761('0x2b')]);_0x15d384[_0x6761('0x2f')]=_[_0x6761('0x2d')](_0x34dc30[_0x6761('0x29')],qs[_0x6761('0x2e')](_0x351939['query']['fields']));_0x15d384[_0x6761('0x2f')]=_0x15d384[_0x6761('0x2f')][_0x6761('0x30')]?_0x15d384[_0x6761('0x2f')]:_0x34dc30[_0x6761('0x29')];_0x15d384[_0x6761('0x4b')]=qs[_0x6761('0x33')](_0x351939[_0x6761('0x2b')][_0x6761('0x33')]);_0x15d384[_0x6761('0x34')]=qs[_0x6761('0x2c')](_[_0x6761('0x4c')](_0x351939[_0x6761('0x2b')],_0x34dc30[_0x6761('0x2c')]));if(_0x351939[_0x6761('0x2b')]['filter']){_0x15d384[_0x6761('0x34')]=_['merge'](_0x15d384['where'],{'$or':_['map'](_0x15d384[_0x6761('0x2f')],function(_0x5ac353){var _0x32a609={};_0x32a609[_0x5ac353]={'$like':'%'+_0x351939[_0x6761('0x2b')][_0x6761('0x35')]+'%'};return _0x32a609;})});}_0x15d384=_[_0x6761('0x36')]({},_0x15d384,_0x351939[_0x6761('0x3b')]);return _0x34ae97['getConditions'](_0x15d384);}})[_0x6761('0x20')](function(_0x2eb5be){if(_0x2eb5be){_0x49aeff=_0x2eb5be['length'];if(!_0x351939[_0x6761('0x2b')][_0x6761('0x31')](_0x6761('0x32'))){_0x15d384[_0x6761('0x1c')]=qs[_0x6761('0x1c')](_0x351939[_0x6761('0x2b')]['limit']);_0x15d384[_0x6761('0x1b')]=qs[_0x6761('0x1b')](_0x351939[_0x6761('0x2b')][_0x6761('0x1b')]);}return _0x34ae97[_0x6761('0x4a')](_0x15d384);}})[_0x6761('0x20')](function(_0x5b274f){if(_0x5b274f){return _0x5b274f?{'count':_0x49aeff,'rows':_0x5b274f}:null;}})[_0x6761('0x20')](respondWithResult(_0x903079,null))[_0x6761('0x40')](handleError(_0x903079,null));};exports[_0x6761('0x4d')]=function(_0x448cb1,_0x56cb0d,_0x5af52b){return db[_0x6761('0x4e')][_0x6761('0x43')]({'where':{'id':_0x448cb1[_0x6761('0x42')]['id']}})['then'](handleEntityNotFound(_0x56cb0d,null))['then'](function(_0x5a41e9){if(_0x5a41e9){return _0x5a41e9[_0x6761('0x4d')](_0x448cb1['body'][_0x6761('0x49')],_[_0x6761('0x4f')](_0x448cb1[_0x6761('0x45')],[_0x6761('0x49'),'id'])||{});}})[_0x6761('0x20')](respondWithResult(_0x56cb0d,null))['catch'](handleError(_0x56cb0d,null));};exports['getActions']=function(_0x404506,_0x589b90,_0x5cb3ee){var _0x2e6e24={};var _0x169482={};var _0xa9a3ed;var _0x19dc56;return db[_0x6761('0x27')][_0x6761('0x50')]({'where':{'id':_0x404506['params']['id']}})[_0x6761('0x20')](handleEntityNotFound(_0x589b90,null))['then'](function(_0x46020d){if(_0x46020d){_0xa9a3ed=_0x46020d;_0x169482[_0x6761('0x29')]=_['keys'](db[_0x6761('0x4e')]['rawAttributes']);_0x169482[_0x6761('0x2b')]=_[_0x6761('0x2a')](_0x404506['query']);_0x169482['filters']=_[_0x6761('0x2d')](_0x169482[_0x6761('0x29')],_0x169482['query']);_0x2e6e24['attributes']=_[_0x6761('0x2d')](_0x169482[_0x6761('0x29')],qs[_0x6761('0x2e')](_0x404506[_0x6761('0x2b')][_0x6761('0x2e')]));_0x2e6e24[_0x6761('0x2f')]=_0x2e6e24['attributes'][_0x6761('0x30')]?_0x2e6e24[_0x6761('0x2f')]:_0x169482[_0x6761('0x29')];_0x2e6e24[_0x6761('0x4b')]=qs['sort'](_0x404506[_0x6761('0x2b')][_0x6761('0x33')]);_0x2e6e24[_0x6761('0x34')]=qs[_0x6761('0x2c')](_[_0x6761('0x4c')](_0x404506['query'],_0x169482[_0x6761('0x2c')]));if(_0x404506['query'][_0x6761('0x35')]){_0x2e6e24[_0x6761('0x34')]=_[_0x6761('0x36')](_0x2e6e24[_0x6761('0x34')],{'$or':_[_0x6761('0x37')](_0x2e6e24[_0x6761('0x2f')],function(_0x4156a9){var _0x473563={};_0x473563[_0x4156a9]={'$like':'%'+_0x404506['query']['filter']+'%'};return _0x473563;})});}_0x2e6e24=_['merge']({},_0x2e6e24,_0x404506['options']);return _0xa9a3ed[_0x6761('0x51')](_0x2e6e24);}})[_0x6761('0x20')](function(_0x396fdd){if(_0x396fdd){_0x19dc56=_0x396fdd['length'];if(!_0x404506[_0x6761('0x2b')][_0x6761('0x31')](_0x6761('0x32'))){_0x2e6e24['limit']=qs[_0x6761('0x1c')](_0x404506[_0x6761('0x2b')][_0x6761('0x1c')]);_0x2e6e24[_0x6761('0x1b')]=qs[_0x6761('0x1b')](_0x404506[_0x6761('0x2b')][_0x6761('0x1b')]);}return _0xa9a3ed[_0x6761('0x51')](_0x2e6e24);}})[_0x6761('0x20')](function(_0x11c02f){if(_0x11c02f){return _0x11c02f?{'count':_0x19dc56,'rows':_0x11c02f}:null;}})[_0x6761('0x20')](respondWithResult(_0x589b90,null))['catch'](handleError(_0x589b90,null));}; \ No newline at end of file +var _0xc4ab=['getActions','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','save','update','then','destroy','error','index','Automation','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','type','key','VIRTUAL','field','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','Condition','ids','omit','getConditions','findOne','pick','map','addActions','Action'];(function(_0x12152b,_0x5d47e2){var _0x5e171e=function(_0x10f1b2){while(--_0x10f1b2){_0x12152b['push'](_0x12152b['shift']());}};_0x5e171e(++_0x5d47e2);}(_0xc4ab,0x13d));var _0xbc4a=function(_0x4a4e8b,_0x2e3242){_0x4a4e8b=_0x4a4e8b-0x0;var _0x47eac1=_0xc4ab[_0x4a4e8b];return _0x47eac1;};'use strict';var pdf=require(_0xbc4a('0x0'));var emlformat=require(_0xbc4a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbc4a('0x2'));var moment=require(_0xbc4a('0x3'));var BPromise=require(_0xbc4a('0x4'));var Mustache=require(_0xbc4a('0x5'));var util=require(_0xbc4a('0x6'));var path=require('path');var sox=require(_0xbc4a('0x7'));var csv=require(_0xbc4a('0x8'));var ejs=require(_0xbc4a('0x9'));var fs=require('fs');var _=require(_0xbc4a('0xa'));var squel=require(_0xbc4a('0xb'));var crypto=require(_0xbc4a('0xc'));var jsforce=require(_0xbc4a('0xd'));var deskjs=require(_0xbc4a('0xe'));var toCsv=require(_0xbc4a('0x8'));var querystring=require(_0xbc4a('0xf'));var Papa=require(_0xbc4a('0x10'));var authService=require(_0xbc4a('0x11'));var hardwareService=require(_0xbc4a('0x12'));var Redis=require(_0xbc4a('0x13'));var qs=require(_0xbc4a('0x14'));var logger=require(_0xbc4a('0x15'))(_0xbc4a('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xbc4a('0x17'))['db'];function respondWithStatusCode(_0x319696,_0x3980bc){_0x3980bc=_0x3980bc||0xcc;return function(_0x2c0169){if(_0x2c0169){return _0x319696[_0xbc4a('0x18')](_0x3980bc);}return _0x319696[_0xbc4a('0x19')](_0x3980bc)[_0xbc4a('0x1a')]();};}function respondWithResult(_0x109989,_0x590d0b){_0x590d0b=_0x590d0b||0xc8;return function(_0x34c24b){if(_0x34c24b){return _0x109989['status'](_0x590d0b)['json'](_0x34c24b);}};}function respondWithFilteredResult(_0x22661c,_0x5b1c05){return function(_0x5704a6){if(_0x5704a6){var _0x3d4863=_0x5704a6[_0xbc4a('0x1b')],_0x5c406c=_0x5b1c05[_0xbc4a('0x1c')],_0x202e5c=_0x5b1c05[_0xbc4a('0x1c')]+_0x5b1c05[_0xbc4a('0x1d')],_0xded5f8;if(_0x202e5c>=_0x3d4863){_0x202e5c=_0x3d4863;_0xded5f8=0xc8;}else{_0xded5f8=0xce;}_0x22661c[_0xbc4a('0x19')](_0xded5f8);return _0x22661c[_0xbc4a('0x1e')](_0xbc4a('0x1f'),_0x5c406c+'-'+_0x202e5c+'/'+_0x3d4863)[_0xbc4a('0x20')](_0x5704a6);}return null;};}function patchUpdates(_0x2b4604){return function(_0x1f545d){try{jsonpatch['apply'](_0x1f545d,_0x2b4604,!![]);}catch(_0x46ac26){return BPromise['reject'](_0x46ac26);}return _0x1f545d[_0xbc4a('0x21')]();};}function saveUpdates(_0x34e0be,_0x4a8bee){return function(_0x2bf2a7){if(_0x2bf2a7){return _0x2bf2a7[_0xbc4a('0x22')](_0x34e0be)[_0xbc4a('0x23')](function(_0x6939cd){return _0x6939cd;});}return null;};}function removeEntity(_0x38b70f,_0x46b024){return function(_0x2218a1){if(_0x2218a1){return _0x2218a1[_0xbc4a('0x24')]()[_0xbc4a('0x23')](function(){_0x38b70f[_0xbc4a('0x19')](0xcc)[_0xbc4a('0x1a')]();});}};}function handleEntityNotFound(_0x4ff36d,_0x4c6155){return function(_0x5c143a){if(!_0x5c143a){_0x4ff36d[_0xbc4a('0x18')](0x194);}return _0x5c143a;};}function handleError(_0x408289,_0x127f1f){_0x127f1f=_0x127f1f||0x1f4;return function(_0x1fb021){logger[_0xbc4a('0x25')](_0x1fb021['stack']);if(_0x1fb021['name']){delete _0x1fb021['name'];}_0x408289[_0xbc4a('0x19')](_0x127f1f)['send'](_0x1fb021);};}exports[_0xbc4a('0x26')]=function(_0xc77bf2,_0x572d6e){var _0x3fbfb1={},_0xb2264d={},_0x2959d2={'count':0x0,'rows':[]};var _0xb43b7a=db[_0xbc4a('0x27')][_0xbc4a('0x28')];_0xb2264d[_0xbc4a('0x29')]=_[_0xbc4a('0x2a')](_0xb43b7a);_0xb2264d[_0xbc4a('0x2b')]=_[_0xbc4a('0x2a')](_0xc77bf2[_0xbc4a('0x2b')]);_0xb2264d[_0xbc4a('0x2c')]=_[_0xbc4a('0x2d')](_0xb2264d[_0xbc4a('0x29')],_0xb2264d[_0xbc4a('0x2b')]);_0x3fbfb1[_0xbc4a('0x2e')]=_[_0xbc4a('0x2d')](_0xb2264d[_0xbc4a('0x29')],qs[_0xbc4a('0x2f')](_0xc77bf2['query'][_0xbc4a('0x2f')]));_0x3fbfb1[_0xbc4a('0x2e')]=_0x3fbfb1[_0xbc4a('0x2e')][_0xbc4a('0x30')]?_0x3fbfb1[_0xbc4a('0x2e')]:_0xb2264d[_0xbc4a('0x29')];if(!_0xc77bf2[_0xbc4a('0x2b')]['hasOwnProperty'](_0xbc4a('0x31'))){_0x3fbfb1[_0xbc4a('0x1d')]=qs[_0xbc4a('0x1d')](_0xc77bf2[_0xbc4a('0x2b')][_0xbc4a('0x1d')]);_0x3fbfb1[_0xbc4a('0x1c')]=qs['offset'](_0xc77bf2[_0xbc4a('0x2b')]['offset']);}_0x3fbfb1[_0xbc4a('0x32')]=qs[_0xbc4a('0x33')](_0xc77bf2['query']['sort']);_0x3fbfb1[_0xbc4a('0x34')]=qs['filters'](_['pick'](_0xc77bf2['query'],_0xb2264d[_0xbc4a('0x2c')]));if(_0xc77bf2[_0xbc4a('0x2b')]['filter']){_0x3fbfb1[_0xbc4a('0x34')]=_[_0xbc4a('0x35')](_0x3fbfb1['where'],{'$or':_['map'](_0xb43b7a,function(_0x408a2c){if(_0x408a2c[_0xbc4a('0x36')][_0xbc4a('0x37')]!==_0xbc4a('0x38')){var _0x54eea3={};_0x54eea3[_0x408a2c[_0xbc4a('0x39')]]={'$like':'%'+_0xc77bf2[_0xbc4a('0x2b')][_0xbc4a('0x3a')]+'%'};return _0x54eea3;}})});}_0x3fbfb1=_[_0xbc4a('0x35')]({},_0x3fbfb1,_0xc77bf2[_0xbc4a('0x3b')]);var _0x77095e={'where':_0x3fbfb1[_0xbc4a('0x34')]};return db[_0xbc4a('0x27')]['count'](_0x77095e)[_0xbc4a('0x23')](function(_0x400bb1){_0x2959d2[_0xbc4a('0x1b')]=_0x400bb1;if(_0xc77bf2[_0xbc4a('0x2b')][_0xbc4a('0x3c')]){_0x3fbfb1[_0xbc4a('0x3d')]=[{'all':!![]}];}return db['Automation'][_0xbc4a('0x3e')](_0x3fbfb1);})['then'](function(_0x1cc867){_0x2959d2[_0xbc4a('0x3f')]=_0x1cc867;return _0x2959d2;})[_0xbc4a('0x23')](respondWithFilteredResult(_0x572d6e,_0x3fbfb1))[_0xbc4a('0x40')](handleError(_0x572d6e,null));};exports['show']=function(_0x442d67,_0x550f5b){var _0x3ed937={'raw':![],'where':{'id':_0x442d67[_0xbc4a('0x41')]['id']}},_0x1a590f={};_0x1a590f['model']=_[_0xbc4a('0x2a')](db['Automation']['rawAttributes']);_0x1a590f['query']=_[_0xbc4a('0x2a')](_0x442d67[_0xbc4a('0x2b')]);_0x1a590f[_0xbc4a('0x2c')]=_['intersection'](_0x1a590f['model'],_0x1a590f[_0xbc4a('0x2b')]);_0x3ed937[_0xbc4a('0x2e')]=_[_0xbc4a('0x2d')](_0x1a590f[_0xbc4a('0x29')],qs['fields'](_0x442d67['query'][_0xbc4a('0x2f')]));_0x3ed937[_0xbc4a('0x2e')]=_0x3ed937['attributes'][_0xbc4a('0x30')]?_0x3ed937[_0xbc4a('0x2e')]:_0x1a590f[_0xbc4a('0x29')];if(_0x442d67[_0xbc4a('0x2b')][_0xbc4a('0x3c')]){_0x3ed937[_0xbc4a('0x3d')]=[{'all':!![]}];}_0x3ed937=_['merge']({},_0x3ed937,_0x442d67[_0xbc4a('0x3b')]);return db[_0xbc4a('0x27')][_0xbc4a('0x42')](_0x3ed937)['then'](handleEntityNotFound(_0x550f5b,null))[_0xbc4a('0x23')](respondWithResult(_0x550f5b,null))[_0xbc4a('0x40')](handleError(_0x550f5b,null));};exports['create']=function(_0x475808,_0x1000c0){return db[_0xbc4a('0x27')][_0xbc4a('0x43')](_0x475808[_0xbc4a('0x44')],{})['then'](respondWithResult(_0x1000c0,0xc9))[_0xbc4a('0x40')](handleError(_0x1000c0,null));};exports[_0xbc4a('0x22')]=function(_0x33a673,_0x59d6f7){if(_0x33a673[_0xbc4a('0x44')]['id']){delete _0x33a673[_0xbc4a('0x44')]['id'];}return db[_0xbc4a('0x27')]['find']({'where':{'id':_0x33a673[_0xbc4a('0x41')]['id']}})['then'](handleEntityNotFound(_0x59d6f7,null))[_0xbc4a('0x23')](saveUpdates(_0x33a673[_0xbc4a('0x44')],null))[_0xbc4a('0x23')](respondWithResult(_0x59d6f7,null))[_0xbc4a('0x40')](handleError(_0x59d6f7,null));};exports[_0xbc4a('0x24')]=function(_0x16cce2,_0x3ebfd1){return db['Automation'][_0xbc4a('0x42')]({'where':{'id':_0x16cce2['params']['id']}})['then'](handleEntityNotFound(_0x3ebfd1,null))['then'](removeEntity(_0x3ebfd1,null))[_0xbc4a('0x40')](handleError(_0x3ebfd1,null));};exports['addConditions']=function(_0x2a2db7,_0x1fe54d,_0x1a84ee){return db[_0xbc4a('0x45')][_0xbc4a('0x42')]({'where':{'id':_0x2a2db7[_0xbc4a('0x41')]['id']}})[_0xbc4a('0x23')](handleEntityNotFound(_0x1fe54d,null))['then'](function(_0x3b40a5){if(_0x3b40a5){return _0x3b40a5['addConditions'](_0x2a2db7['body'][_0xbc4a('0x46')],_[_0xbc4a('0x47')](_0x2a2db7[_0xbc4a('0x44')],[_0xbc4a('0x46'),'id'])||{});}})[_0xbc4a('0x23')](respondWithResult(_0x1fe54d,null))['catch'](handleError(_0x1fe54d,null));};exports[_0xbc4a('0x48')]=function(_0x147d06,_0x4f34c7,_0x1c69de){var _0x54a6a6={};var _0x7d3f41={};var _0x4e89cc;var _0x2c1b21;return db[_0xbc4a('0x27')][_0xbc4a('0x49')]({'where':{'id':_0x147d06[_0xbc4a('0x41')]['id']}})[_0xbc4a('0x23')](handleEntityNotFound(_0x4f34c7,null))[_0xbc4a('0x23')](function(_0x203398){if(_0x203398){_0x4e89cc=_0x203398;_0x7d3f41[_0xbc4a('0x29')]=_['keys'](db[_0xbc4a('0x45')][_0xbc4a('0x28')]);_0x7d3f41['query']=_[_0xbc4a('0x2a')](_0x147d06[_0xbc4a('0x2b')]);_0x7d3f41[_0xbc4a('0x2c')]=_[_0xbc4a('0x2d')](_0x7d3f41[_0xbc4a('0x29')],_0x7d3f41[_0xbc4a('0x2b')]);_0x54a6a6[_0xbc4a('0x2e')]=_[_0xbc4a('0x2d')](_0x7d3f41[_0xbc4a('0x29')],qs[_0xbc4a('0x2f')](_0x147d06[_0xbc4a('0x2b')][_0xbc4a('0x2f')]));_0x54a6a6[_0xbc4a('0x2e')]=_0x54a6a6['attributes'][_0xbc4a('0x30')]?_0x54a6a6['attributes']:_0x7d3f41['model'];_0x54a6a6[_0xbc4a('0x32')]=qs[_0xbc4a('0x33')](_0x147d06[_0xbc4a('0x2b')][_0xbc4a('0x33')]);_0x54a6a6[_0xbc4a('0x34')]=qs[_0xbc4a('0x2c')](_[_0xbc4a('0x4a')](_0x147d06[_0xbc4a('0x2b')],_0x7d3f41[_0xbc4a('0x2c')]));if(_0x147d06['query'][_0xbc4a('0x3a')]){_0x54a6a6[_0xbc4a('0x34')]=_[_0xbc4a('0x35')](_0x54a6a6[_0xbc4a('0x34')],{'$or':_[_0xbc4a('0x4b')](_0x54a6a6[_0xbc4a('0x2e')],function(_0x1901cf){var _0x13c028={};_0x13c028[_0x1901cf]={'$like':'%'+_0x147d06[_0xbc4a('0x2b')][_0xbc4a('0x3a')]+'%'};return _0x13c028;})});}_0x54a6a6=_[_0xbc4a('0x35')]({},_0x54a6a6,_0x147d06[_0xbc4a('0x3b')]);return _0x4e89cc['getConditions'](_0x54a6a6);}})['then'](function(_0x489357){if(_0x489357){_0x2c1b21=_0x489357['length'];if(!_0x147d06[_0xbc4a('0x2b')]['hasOwnProperty']('nolimit')){_0x54a6a6[_0xbc4a('0x1d')]=qs[_0xbc4a('0x1d')](_0x147d06[_0xbc4a('0x2b')]['limit']);_0x54a6a6['offset']=qs[_0xbc4a('0x1c')](_0x147d06['query'][_0xbc4a('0x1c')]);}return _0x4e89cc[_0xbc4a('0x48')](_0x54a6a6);}})[_0xbc4a('0x23')](function(_0x51a60f){if(_0x51a60f){return _0x51a60f?{'count':_0x2c1b21,'rows':_0x51a60f}:null;}})[_0xbc4a('0x23')](respondWithResult(_0x4f34c7,null))[_0xbc4a('0x40')](handleError(_0x4f34c7,null));};exports[_0xbc4a('0x4c')]=function(_0x128db5,_0x27b00f,_0x40d82d){return db[_0xbc4a('0x4d')][_0xbc4a('0x42')]({'where':{'id':_0x128db5[_0xbc4a('0x41')]['id']}})[_0xbc4a('0x23')](handleEntityNotFound(_0x27b00f,null))['then'](function(_0x88190c){if(_0x88190c){return _0x88190c[_0xbc4a('0x4c')](_0x128db5[_0xbc4a('0x44')][_0xbc4a('0x46')],_[_0xbc4a('0x47')](_0x128db5[_0xbc4a('0x44')],['ids','id'])||{});}})[_0xbc4a('0x23')](respondWithResult(_0x27b00f,null))[_0xbc4a('0x40')](handleError(_0x27b00f,null));};exports['getActions']=function(_0xf69585,_0x13594c,_0x418001){var _0x510267={};var _0x2eaa6c={};var _0x5ac1f4;var _0x464bff;return db[_0xbc4a('0x27')][_0xbc4a('0x49')]({'where':{'id':_0xf69585[_0xbc4a('0x41')]['id']}})[_0xbc4a('0x23')](handleEntityNotFound(_0x13594c,null))['then'](function(_0xea41d){if(_0xea41d){_0x5ac1f4=_0xea41d;_0x2eaa6c[_0xbc4a('0x29')]=_['keys'](db[_0xbc4a('0x4d')]['rawAttributes']);_0x2eaa6c[_0xbc4a('0x2b')]=_[_0xbc4a('0x2a')](_0xf69585[_0xbc4a('0x2b')]);_0x2eaa6c[_0xbc4a('0x2c')]=_[_0xbc4a('0x2d')](_0x2eaa6c[_0xbc4a('0x29')],_0x2eaa6c[_0xbc4a('0x2b')]);_0x510267[_0xbc4a('0x2e')]=_[_0xbc4a('0x2d')](_0x2eaa6c['model'],qs[_0xbc4a('0x2f')](_0xf69585[_0xbc4a('0x2b')]['fields']));_0x510267[_0xbc4a('0x2e')]=_0x510267[_0xbc4a('0x2e')][_0xbc4a('0x30')]?_0x510267[_0xbc4a('0x2e')]:_0x2eaa6c[_0xbc4a('0x29')];_0x510267[_0xbc4a('0x32')]=qs[_0xbc4a('0x33')](_0xf69585['query'][_0xbc4a('0x33')]);_0x510267[_0xbc4a('0x34')]=qs['filters'](_['pick'](_0xf69585[_0xbc4a('0x2b')],_0x2eaa6c['filters']));if(_0xf69585[_0xbc4a('0x2b')][_0xbc4a('0x3a')]){_0x510267[_0xbc4a('0x34')]=_[_0xbc4a('0x35')](_0x510267[_0xbc4a('0x34')],{'$or':_[_0xbc4a('0x4b')](_0x510267[_0xbc4a('0x2e')],function(_0x570dfc){var _0xd83a11={};_0xd83a11[_0x570dfc]={'$like':'%'+_0xf69585[_0xbc4a('0x2b')][_0xbc4a('0x3a')]+'%'};return _0xd83a11;})});}_0x510267=_[_0xbc4a('0x35')]({},_0x510267,_0xf69585[_0xbc4a('0x3b')]);return _0x5ac1f4[_0xbc4a('0x4e')](_0x510267);}})['then'](function(_0xc4590b){if(_0xc4590b){_0x464bff=_0xc4590b[_0xbc4a('0x30')];if(!_0xf69585[_0xbc4a('0x2b')]['hasOwnProperty']('nolimit')){_0x510267[_0xbc4a('0x1d')]=qs[_0xbc4a('0x1d')](_0xf69585['query'][_0xbc4a('0x1d')]);_0x510267[_0xbc4a('0x1c')]=qs['offset'](_0xf69585[_0xbc4a('0x2b')]['offset']);}return _0x5ac1f4[_0xbc4a('0x4e')](_0x510267);}})[_0xbc4a('0x23')](function(_0x50f8a5){if(_0x50f8a5){return _0x50f8a5?{'count':_0x464bff,'rows':_0x50f8a5}:null;}})[_0xbc4a('0x23')](respondWithResult(_0x13594c,null))[_0xbc4a('0x40')](handleError(_0x13594c,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 71264e4..c8140e0 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 _0x301a=['tools_automations','lodash','moment','bluebird','./automation.attributes','exports','define','Automation'];(function(_0x43a506,_0x3cb74e){var _0x46f337=function(_0x36c72){while(--_0x36c72){_0x43a506['push'](_0x43a506['shift']());}};_0x46f337(++_0x3cb74e);}(_0x301a,0xf1));var _0xa301=function(_0x1ddb05,_0x2f7566){_0x1ddb05=_0x1ddb05-0x0;var _0x102dbb=_0x301a[_0x1ddb05];return _0x102dbb;};'use strict';var _=require(_0xa301('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa301('0x1'));var BPromise=require(_0xa301('0x2'));var rp=require('request-promise');var attributes=require(_0xa301('0x3'));module[_0xa301('0x4')]=function(_0x625716,_0xe6bae){return _0x625716[_0xa301('0x5')](_0xa301('0x6'),attributes,{'tableName':_0xa301('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x325f=['Automation','tools_automations','lodash','../../config/logger','api','bluebird','request-promise','./automation.attributes','exports','define'];(function(_0xf3897e,_0x3ac8b7){var _0x26b187=function(_0x320783){while(--_0x320783){_0xf3897e['push'](_0xf3897e['shift']());}};_0x26b187(++_0x3ac8b7);}(_0x325f,0x174));var _0xf325=function(_0x4454c9,_0xd4c662){_0x4454c9=_0x4454c9-0x0;var _0x429555=_0x325f[_0x4454c9];return _0x429555;};'use strict';var _=require(_0xf325('0x0'));var util=require('util');var logger=require(_0xf325('0x1'))(_0xf325('0x2'));var moment=require('moment');var BPromise=require(_0xf325('0x3'));var rp=require(_0xf325('0x4'));var attributes=require(_0xf325('0x5'));module[_0xf325('0x6')]=function(_0x96ef39,_0x2b33bb){return _0x96ef39[_0xf325('0x7')](_0xf325('0x8'),attributes,{'tableName':_0xf325('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 3a68a25..08abb88 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 _0x0f36=['jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3b9007,_0x482404){var _0xfe01e7=function(_0x199ebf){while(--_0x199ebf){_0x3b9007['push'](_0x3b9007['shift']());}};_0xfe01e7(++_0x482404);}(_0x0f36,0x8b));var _0x60f3=function(_0x34559b,_0x42b8ed){_0x34559b=_0x34559b-0x0;var _0x517ca8=_0x0f36[_0x34559b];return _0x517ca8;};'use strict';var _=require(_0x60f3('0x0'));var util=require(_0x60f3('0x1'));var moment=require(_0x60f3('0x2'));var BPromise=require(_0x60f3('0x3'));var rs=require(_0x60f3('0x4'));var fs=require('fs');var Redis=require(_0x60f3('0x5'));var db=require(_0x60f3('0x6'))['db'];var utils=require(_0x60f3('0x7'));var logger=require(_0x60f3('0x8'))(_0x60f3('0x9'));var config=require(_0x60f3('0xa'));var jayson=require(_0x60f3('0xb'));var client=jayson[_0x60f3('0xc')][_0x60f3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xd8fc9d,_0x4b34ee,_0x6b5250){return new BPromise(function(_0x1a4402,_0x4ef52b){return client[_0x60f3('0xe')](_0xd8fc9d,_0x6b5250)[_0x60f3('0xf')](function(_0x3271cb){logger[_0x60f3('0x10')](_0x60f3('0x11'),_0x4b34ee,_0x60f3('0x12'));logger['debug'](_0x60f3('0x13'),_0x4b34ee,_0x60f3('0x12'),JSON[_0x60f3('0x14')](_0x3271cb));if(_0x3271cb[_0x60f3('0x15')]){if(_0x3271cb[_0x60f3('0x15')]['code']===0x1f4){logger[_0x60f3('0x15')](_0x60f3('0x11'),_0x4b34ee,_0x3271cb[_0x60f3('0x15')][_0x60f3('0x16')]);return _0x4ef52b(_0x3271cb[_0x60f3('0x15')]['message']);}logger['error'](_0x60f3('0x11'),_0x4b34ee,_0x3271cb[_0x60f3('0x15')][_0x60f3('0x16')]);return _0x1a4402(_0x3271cb['error'][_0x60f3('0x16')]);}else{logger['info'](_0x60f3('0x11'),_0x4b34ee,_0x60f3('0x12'));_0x1a4402(_0x3271cb[_0x60f3('0x17')][_0x60f3('0x16')]);}})[_0x60f3('0x18')](function(_0x1f4990){logger[_0x60f3('0x15')](_0x60f3('0x11'),_0x4b34ee,_0x1f4990);_0x4ef52b(_0x1f4990);});});} \ No newline at end of file +var _0x43ef=['http','then','Automation,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x4dade1,_0x48c433){var _0x45c45c=function(_0x4d59ba){while(--_0x4d59ba){_0x4dade1['push'](_0x4dade1['shift']());}};_0x45c45c(++_0x48c433);}(_0x43ef,0x19a));var _0xf43e=function(_0x4528a0,_0x746949){_0x4528a0=_0x4528a0-0x0;var _0x105090=_0x43ef[_0x4528a0];return _0x105090;};'use strict';var _=require(_0xf43e('0x0'));var util=require(_0xf43e('0x1'));var moment=require('moment');var BPromise=require(_0xf43e('0x2'));var rs=require(_0xf43e('0x3'));var fs=require('fs');var Redis=require(_0xf43e('0x4'));var db=require(_0xf43e('0x5'))['db'];var utils=require(_0xf43e('0x6'));var logger=require('../../config/logger')(_0xf43e('0x7'));var config=require('../../config/environment');var jayson=require(_0xf43e('0x8'));var client=jayson[_0xf43e('0x9')][_0xf43e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8bf32a,_0x57ea27,_0x20e4ae){return new BPromise(function(_0x240d1b,_0x2e4e07){return client['request'](_0x8bf32a,_0x20e4ae)[_0xf43e('0xb')](function(_0x4084c4){logger['info'](_0xf43e('0xc'),_0x57ea27,'request\x20sent');logger[_0xf43e('0xd')]('Automation,\x20%s,\x20%s,\x20%s',_0x57ea27,_0xf43e('0xe'),JSON[_0xf43e('0xf')](_0x4084c4));if(_0x4084c4['error']){if(_0x4084c4['error'][_0xf43e('0x10')]===0x1f4){logger[_0xf43e('0x11')](_0xf43e('0xc'),_0x57ea27,_0x4084c4[_0xf43e('0x11')][_0xf43e('0x12')]);return _0x2e4e07(_0x4084c4[_0xf43e('0x11')][_0xf43e('0x12')]);}logger[_0xf43e('0x11')]('Automation,\x20%s,\x20%s',_0x57ea27,_0x4084c4['error'][_0xf43e('0x12')]);return _0x240d1b(_0x4084c4[_0xf43e('0x11')][_0xf43e('0x12')]);}else{logger[_0xf43e('0x13')]('Automation,\x20%s,\x20%s',_0x57ea27,_0xf43e('0xe'));_0x240d1b(_0x4084c4['result'][_0xf43e('0x12')]);}})[_0xf43e('0x14')](function(_0x124860){logger['error'](_0xf43e('0xc'),_0x57ea27,_0x124860);_0x2e4e07(_0x124860);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index a78033e..13a97ab 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 _0xca93=['index','/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get'];(function(_0x7fcfd9,_0x39eb71){var _0x56e197=function(_0x4b5b44){while(--_0x4b5b44){_0x7fcfd9['push'](_0x7fcfd9['shift']());}};_0x56e197(++_0x39eb71);}(_0xca93,0x123));var _0x3ca9=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xca93[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0x3ca9('0x0'));var util=require(_0x3ca9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3ca9('0x2'));var router=express[_0x3ca9('0x3')]();var auth=require(_0x3ca9('0x4'));var interaction=require(_0x3ca9('0x5'));var config=require(_0x3ca9('0x6'));var controller=require(_0x3ca9('0x7'));router[_0x3ca9('0x8')]('/',auth['isAuthenticated'](),controller[_0x3ca9('0x9')]);router[_0x3ca9('0x8')](_0x3ca9('0xa'),auth[_0x3ca9('0xb')](),controller[_0x3ca9('0xc')]);router['get'](_0x3ca9('0xd'),auth['isAuthenticated'](),controller[_0x3ca9('0xe')]);router[_0x3ca9('0x8')](_0x3ca9('0xf'),auth[_0x3ca9('0xb')](),controller[_0x3ca9('0x10')]);router[_0x3ca9('0x11')]('/',auth['isAuthenticated'](),controller[_0x3ca9('0x12')]);router['post'](_0x3ca9('0xd'),auth['isAuthenticated'](),controller[_0x3ca9('0x13')]);router['post'](_0x3ca9('0xf'),auth['isAuthenticated'](),controller[_0x3ca9('0x14')]);router['put'](_0x3ca9('0xa'),auth[_0x3ca9('0xb')](),controller[_0x3ca9('0x15')]);router[_0x3ca9('0x16')](_0x3ca9('0xa'),auth[_0x3ca9('0xb')](),controller[_0x3ca9('0x17')]);module[_0x3ca9('0x18')]=router; \ No newline at end of file +var _0xdebb=['addActions','put','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions'];(function(_0x54d250,_0x2267ad){var _0x37faf0=function(_0x392dee){while(--_0x392dee){_0x54d250['push'](_0x54d250['shift']());}};_0x37faf0(++_0x2267ad);}(_0xdebb,0x19c));var _0xbdeb=function(_0x4a82e3,_0x5ef734){_0x4a82e3=_0x4a82e3-0x0;var _0x666c92=_0xdebb[_0x4a82e3];return _0x666c92;};'use strict';var multer=require(_0xbdeb('0x0'));var util=require(_0xbdeb('0x1'));var path=require(_0xbdeb('0x2'));var timeout=require(_0xbdeb('0x3'));var express=require('express');var router=express[_0xbdeb('0x4')]();var auth=require(_0xbdeb('0x5'));var interaction=require(_0xbdeb('0x6'));var config=require(_0xbdeb('0x7'));var controller=require(_0xbdeb('0x8'));router[_0xbdeb('0x9')]('/',auth[_0xbdeb('0xa')](),controller[_0xbdeb('0xb')]);router['get'](_0xbdeb('0xc'),auth[_0xbdeb('0xa')](),controller['show']);router[_0xbdeb('0x9')](_0xbdeb('0xd'),auth['isAuthenticated'](),controller[_0xbdeb('0xe')]);router[_0xbdeb('0x9')](_0xbdeb('0xf'),auth[_0xbdeb('0xa')](),controller[_0xbdeb('0x10')]);router[_0xbdeb('0x11')]('/',auth[_0xbdeb('0xa')](),controller[_0xbdeb('0x12')]);router[_0xbdeb('0x11')]('/:id/conditions',auth[_0xbdeb('0xa')](),controller[_0xbdeb('0x13')]);router['post'](_0xbdeb('0xf'),auth['isAuthenticated'](),controller[_0xbdeb('0x14')]);router[_0xbdeb('0x15')]('/:id',auth[_0xbdeb('0xa')](),controller['update']);router[_0xbdeb('0x16')](_0xbdeb('0xc'),auth[_0xbdeb('0xa')](),controller['destroy']);module[_0xbdeb('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 6b7396e..b1445ce 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 _0x214b=['#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','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','sequelize','exports','STRING','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting'];(function(_0x3c1b16,_0x59c016){var _0x5dc8d6=function(_0x29cb39){while(--_0x29cb39){_0x3c1b16['push'](_0x3c1b16['shift']());}};_0x5dc8d6(++_0x59c016);}(_0x214b,0x1d2));var _0xb214=function(_0x503d4f,_0x1d70dd){_0x503d4f=_0x503d4f-0x0;var _0x1cecfc=_0x214b[_0x503d4f];return _0x1cecfc;};'use strict';var Sequelize=require(_0xb214('0x0'));module[_0xb214('0x1')]={'name':{'type':Sequelize[_0xb214('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xb214('0x3')](_0xb214('0x4')),'allowNull':![],'defaultValue':_0xb214('0x4')},'description':{'type':Sequelize[_0xb214('0x2')]},'active':{'type':Sequelize[_0xb214('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xb214('0x6')](0x4)[_0xb214('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xb214('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xb214('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xb214('0x6')](0x3)[_0xb214('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb214('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xb214('0x6')](0x3)[_0xb214('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb214('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xb214('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb214('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xb214('0x6')](0x3)[_0xb214('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb214('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xb214('0x6')](0x5)[_0xb214('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb214('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xb214('0x6')](0x3)[_0xb214('0x7')],'defaultValue':0x3,'comment':_0xb214('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xb214('0x6')](0x5)[_0xb214('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb214('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0xb214('0x6')](0x3)[_0xb214('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xb214('0x10')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xb214('0x2')],'defaultValue':_0xb214('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0xb214('0x3')](_0xb214('0x12'),_0xb214('0x13'),_0xb214('0x14')),'defaultValue':_0xb214('0x12')},'dialAMDActive':{'type':Sequelize[_0xb214('0x5')],'defaultValue':0x0,'comment':_0xb214('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0xb214('0x6')](0x9)[_0xb214('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xb214('0x16')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xb214('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xb214('0x6')](0x9)[_0xb214('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xb214('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xb214('0x6')](0x9)[_0xb214('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb214('0x19')},'dialAMDMinWordLength':{'type':Sequelize[_0xb214('0x6')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xb214('0x1a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xb214('0x6')](0x9)[_0xb214('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xb214('0x1b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xb214('0x6')](0x9)[_0xb214('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xb214('0x1c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xb214('0x6')](0x5)[_0xb214('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xb214('0x1d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xb214('0x6')](0x9)[_0xb214('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb214('0x1e')},'dialOrderByScheduledAt':{'type':Sequelize[_0xb214('0x3')](_0xb214('0x1f'),_0xb214('0x20')),'defaultValue':_0xb214('0x1f')},'dialPrefix':{'type':Sequelize[_0xb214('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xb214('0x6')](0x3)[_0xb214('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb214('0x21')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xb214('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb214('0x22')}}; \ No newline at end of file +var _0x41b1=['INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','UNSIGNED','Max\x20200\x20calls.'];(function(_0x390999,_0x5d56d7){var _0x4a524b=function(_0x3a2a9c){while(--_0x3a2a9c){_0x390999['push'](_0x390999['shift']());}};_0x4a524b(++_0x5d56d7);}(_0x41b1,0x14b));var _0x141b=function(_0x316c42,_0x3391f0){_0x316c42=_0x316c42-0x0;var _0x2b38f7=_0x41b1[_0x316c42];return _0x2b38f7;};'use strict';var Sequelize=require(_0x141b('0x0'));module[_0x141b('0x1')]={'name':{'type':Sequelize[_0x141b('0x2')],'unique':_0x141b('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x141b('0x4')](_0x141b('0x5')),'allowNull':![],'defaultValue':_0x141b('0x5')},'description':{'type':Sequelize[_0x141b('0x2')]},'active':{'type':Sequelize[_0x141b('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x141b('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x141b('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x141b('0x9')](0x3)[_0x141b('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x141b('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x141b('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x141b('0x9')](0x5)[_0x141b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x141b('0xb')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x141b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x141b('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x141b('0x9')](0x5)[_0x141b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x141b('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x141b('0x7')],'defaultValue':0x3,'comment':_0x141b('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x141b('0x9')](0x5)[_0x141b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x141b('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x141b('0x9')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x141b('0x10')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x141b('0x2')],'defaultValue':_0x141b('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x141b('0x4')](_0x141b('0x12'),_0x141b('0x13'),_0x141b('0x14')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x141b('0x6')],'defaultValue':0x0,'comment':_0x141b('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0x141b('0x9')](0x9)[_0x141b('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x141b('0x16')},'dialAMDGreeting':{'type':Sequelize[_0x141b('0x9')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x141b('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x141b('0x9')](0x9)[_0x141b('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x141b('0x9')](0x9)[_0x141b('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x141b('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0x141b('0x9')](0x9)[_0x141b('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x141b('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x141b('0x9')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x141b('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x141b('0x9')](0x9)[_0x141b('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x141b('0x1b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x141b('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x141b('0x1c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x141b('0x9')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x141b('0x1d')},'dialOrderByScheduledAt':{'type':Sequelize[_0x141b('0x4')](_0x141b('0x1e'),_0x141b('0x1f')),'defaultValue':_0x141b('0x1e')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x141b('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x141b('0x20')},'dialCutDigit':{'type':Sequelize[_0x141b('0x9')](0x3)[_0x141b('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x141b('0x21')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 16c7420..f356240 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 _0xa6a8=['catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','createdAt','updatedAt','body','omit','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getHoppers','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','findAll','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','fromQuery','phone','scheduledAt','select','NOW()','ContactId','CmListId','toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','into','push','removeLists','addBlackLists','cm_hopper_black','sequelize','all','removeBlackLists','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','IvrCampaigns','destroy','error','stack','name','send','index','Campaign','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','key','field','options','include','rows','includeAll','find'];(function(_0x5b563c,_0x4150e0){var _0x18c9d3=function(_0x4cf309){while(--_0x4cf309){_0x5b563c['push'](_0x5b563c['shift']());}};_0x18c9d3(++_0x4150e0);}(_0xa6a8,0x1c7));var _0x8a6a=function(_0x163045,_0x4a9e8b){_0x163045=_0x163045-0x0;var _0x2c1903=_0xa6a8[_0x163045];return _0x2c1903;};'use strict';var pdf=require(_0x8a6a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8a6a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8a6a('0x2'));var rp=require(_0x8a6a('0x3'));var moment=require('moment');var BPromise=require(_0x8a6a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8a6a('0x5'));var sox=require(_0x8a6a('0x6'));var csv=require(_0x8a6a('0x7'));var ejs=require(_0x8a6a('0x8'));var fs=require('fs');var _=require(_0x8a6a('0x9'));var squel=require('squel');var crypto=require(_0x8a6a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8a6a('0xb'));var toCsv=require(_0x8a6a('0x7'));var querystring=require(_0x8a6a('0xc'));var Papa=require(_0x8a6a('0xd'));var authService=require(_0x8a6a('0xe'));var hardwareService=require(_0x8a6a('0xf'));var Redis=require(_0x8a6a('0x10'));var qs=require(_0x8a6a('0x11'));var logger=require('../../config/logger')(_0x8a6a('0x12'));var utils=require(_0x8a6a('0x13'));var config=require(_0x8a6a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5107f0,_0x27a09a){_0x27a09a=_0x27a09a||0xcc;return function(_0x4f0ce5){if(_0x4f0ce5){return _0x5107f0[_0x8a6a('0x15')](_0x27a09a);}return _0x5107f0[_0x8a6a('0x16')](_0x27a09a)[_0x8a6a('0x17')]();};}function respondWithResult(_0x23b17e,_0x789f69){_0x789f69=_0x789f69||0xc8;return function(_0x40405f){if(_0x40405f){return _0x23b17e[_0x8a6a('0x16')](_0x789f69)['json'](_0x40405f);}};}function respondWithFilteredResult(_0x43650a,_0x485390){return function(_0x3a24b3){if(_0x3a24b3){var _0x1586ee=_0x3a24b3[_0x8a6a('0x18')],_0x583cec=_0x485390[_0x8a6a('0x19')],_0x354874=_0x485390['offset']+_0x485390[_0x8a6a('0x1a')],_0x53c7f7;if(_0x354874>=_0x1586ee){_0x354874=_0x1586ee;_0x53c7f7=0xc8;}else{_0x53c7f7=0xce;}_0x43650a[_0x8a6a('0x16')](_0x53c7f7);return _0x43650a[_0x8a6a('0x1b')](_0x8a6a('0x1c'),_0x583cec+'-'+_0x354874+'/'+_0x1586ee)['json'](_0x3a24b3);}return null;};}function patchUpdates(_0x3bce65){return function(_0x190afa){try{jsonpatch[_0x8a6a('0x1d')](_0x190afa,_0x3bce65,!![]);}catch(_0x1e199c){return BPromise[_0x8a6a('0x1e')](_0x1e199c);}return _0x190afa[_0x8a6a('0x1f')]();};}function saveUpdates(_0x488227,_0x3c2c3b){return function(_0x1587b8){if(_0x1587b8){return _0x1587b8[_0x8a6a('0x20')](_0x488227)[_0x8a6a('0x21')](function(_0x58db6a){return _0x58db6a;});}return null;};}function removeEntity(_0x36d500,_0x1879ae){return function(_0x10864f){if(_0x10864f){return _0x10864f['destroy']()['then'](function(){var _0x1563cc=_0x10864f[_0x8a6a('0x22')]({'plain':!![]});var _0x145183=_0x8a6a('0x23');return db['UserProfileResource'][_0x8a6a('0x24')]({'where':{'type':_0x145183,'resourceId':_0x1563cc['id']}})[_0x8a6a('0x21')](function(){return _0x10864f;});})[_0x8a6a('0x21')](function(){_0x36d500[_0x8a6a('0x16')](0xcc)[_0x8a6a('0x17')]();});}};}function handleEntityNotFound(_0x43e98b,_0x4a97c6){return function(_0x396107){if(!_0x396107){_0x43e98b[_0x8a6a('0x15')](0x194);}return _0x396107;};}function handleError(_0x3198af,_0xfdaf32){_0xfdaf32=_0xfdaf32||0x1f4;return function(_0x15cb2b){logger[_0x8a6a('0x25')](_0x15cb2b[_0x8a6a('0x26')]);if(_0x15cb2b['name']){delete _0x15cb2b[_0x8a6a('0x27')];}_0x3198af['status'](_0xfdaf32)[_0x8a6a('0x28')](_0x15cb2b);};}exports[_0x8a6a('0x29')]=function(_0x13c33a,_0x1ba02b){var _0x339395={},_0xd38347={},_0x5d8f6e={'count':0x0,'rows':[]};var _0x49a93f=db[_0x8a6a('0x2a')][_0x8a6a('0x2b')];_0xd38347[_0x8a6a('0x2c')]=_[_0x8a6a('0x2d')](_0x49a93f);_0xd38347[_0x8a6a('0x2e')]=_[_0x8a6a('0x2d')](_0x13c33a['query']);_0xd38347[_0x8a6a('0x2f')]=_[_0x8a6a('0x30')](_0xd38347[_0x8a6a('0x2c')],_0xd38347[_0x8a6a('0x2e')]);_0x339395['attributes']=_[_0x8a6a('0x30')](_0xd38347[_0x8a6a('0x2c')],qs[_0x8a6a('0x31')](_0x13c33a[_0x8a6a('0x2e')]['fields']));_0x339395[_0x8a6a('0x32')]=_0x339395[_0x8a6a('0x32')][_0x8a6a('0x33')]?_0x339395[_0x8a6a('0x32')]:_0xd38347[_0x8a6a('0x2c')];if(!_0x13c33a['query'][_0x8a6a('0x34')](_0x8a6a('0x35'))){_0x339395[_0x8a6a('0x1a')]=qs['limit'](_0x13c33a[_0x8a6a('0x2e')][_0x8a6a('0x1a')]);_0x339395['offset']=qs['offset'](_0x13c33a[_0x8a6a('0x2e')][_0x8a6a('0x19')]);}_0x339395[_0x8a6a('0x36')]=qs[_0x8a6a('0x37')](_0x13c33a['query'][_0x8a6a('0x37')]);_0x339395['where']=qs['filters'](_[_0x8a6a('0x38')](_0x13c33a[_0x8a6a('0x2e')],_0xd38347[_0x8a6a('0x2f')]));if(_0x13c33a['query'][_0x8a6a('0x39')]){_0x339395[_0x8a6a('0x3a')]=_[_0x8a6a('0x3b')](_0x339395[_0x8a6a('0x3a')],{'$or':_[_0x8a6a('0x3c')](_0x49a93f,function(_0x27c04a){if(_0x27c04a[_0x8a6a('0x3d')][_0x8a6a('0x3e')]!=='VIRTUAL'){var _0x1e8606={};_0x1e8606[_0x27c04a[_0x8a6a('0x3f')]]={'$like':'%'+_0x13c33a['query'][_0x8a6a('0x39')]+'%'};return _0x1e8606;}})});}_0x339395=_[_0x8a6a('0x3b')]({},_0x339395,_0x13c33a[_0x8a6a('0x40')]);var _0x4a8875={'where':_0x339395[_0x8a6a('0x3a')]};return db[_0x8a6a('0x2a')][_0x8a6a('0x18')](_0x4a8875)[_0x8a6a('0x21')](function(_0x47d2df){_0x5d8f6e[_0x8a6a('0x18')]=_0x47d2df;if(_0x13c33a[_0x8a6a('0x2e')]['includeAll']){_0x339395[_0x8a6a('0x41')]=[{'all':!![]}];}return db[_0x8a6a('0x2a')]['findAll'](_0x339395);})[_0x8a6a('0x21')](function(_0x329a97){_0x5d8f6e[_0x8a6a('0x42')]=_0x329a97;return _0x5d8f6e;})[_0x8a6a('0x21')](respondWithFilteredResult(_0x1ba02b,_0x339395))['catch'](handleError(_0x1ba02b,null));};exports['show']=function(_0x418c98,_0x11d565){var _0x340778={'raw':![],'where':{'id':_0x418c98['params']['id']}},_0x5bb2e3={};_0x5bb2e3[_0x8a6a('0x2c')]=_['keys'](db['Campaign']['rawAttributes']);_0x5bb2e3[_0x8a6a('0x2e')]=_['keys'](_0x418c98[_0x8a6a('0x2e')]);_0x5bb2e3['filters']=_['intersection'](_0x5bb2e3[_0x8a6a('0x2c')],_0x5bb2e3[_0x8a6a('0x2e')]);_0x340778['attributes']=_[_0x8a6a('0x30')](_0x5bb2e3[_0x8a6a('0x2c')],qs[_0x8a6a('0x31')](_0x418c98[_0x8a6a('0x2e')][_0x8a6a('0x31')]));_0x340778[_0x8a6a('0x32')]=_0x340778['attributes'][_0x8a6a('0x33')]?_0x340778[_0x8a6a('0x32')]:_0x5bb2e3['model'];if(_0x418c98['query'][_0x8a6a('0x43')]){_0x340778['include']=[{'all':!![]}];}_0x340778=_['merge']({},_0x340778,_0x418c98[_0x8a6a('0x40')]);return db['Campaign'][_0x8a6a('0x44')](_0x340778)[_0x8a6a('0x21')](handleEntityNotFound(_0x11d565,null))[_0x8a6a('0x21')](respondWithResult(_0x11d565,null))[_0x8a6a('0x45')](handleError(_0x11d565,null));};exports[_0x8a6a('0x46')]=function(_0x347718,_0x136b54){return db[_0x8a6a('0x2a')]['create'](_0x347718['body'],{})[_0x8a6a('0x21')](function(_0x42591e){var _0x1a5307=_0x347718['user'][_0x8a6a('0x22')]({'plain':!![]});if(!_0x1a5307)throw new Error(_0x8a6a('0x47'));if(_0x1a5307[_0x8a6a('0x48')]===_0x8a6a('0x49')){var _0x10e79e=_0x42591e['get']({'plain':!![]});var _0x301058=_0x8a6a('0x23');return db[_0x8a6a('0x4a')]['find']({'where':{'name':_0x301058,'userProfileId':_0x1a5307[_0x8a6a('0x4b')]},'raw':!![]})[_0x8a6a('0x21')](function(_0x499a75){if(_0x499a75&&_0x499a75[_0x8a6a('0x4c')]===0x0){return db[_0x8a6a('0x4d')][_0x8a6a('0x46')]({'name':_0x10e79e['name'],'resourceId':_0x10e79e['id'],'type':_0x499a75['name'],'sectionId':_0x499a75['id']},{})[_0x8a6a('0x21')](function(){return _0x42591e;});}else{return _0x42591e;}})[_0x8a6a('0x45')](function(_0x3d23cb){logger[_0x8a6a('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d23cb);throw _0x3d23cb;});}return _0x42591e;})[_0x8a6a('0x21')](respondWithResult(_0x136b54,0xc9))[_0x8a6a('0x45')](handleError(_0x136b54,null));};exports['clone']=function(_0x4c7f34,_0x48c605){var _0x286092={'raw':![],'where':{'id':_0x4c7f34['params']['id']}},_0x5a5943={};_0x5a5943['model']=_[_0x8a6a('0x2d')](db['Campaign'][_0x8a6a('0x2b')]);_0x286092[_0x8a6a('0x32')]=_['intersection'](_0x5a5943[_0x8a6a('0x2c')],qs[_0x8a6a('0x31')](_0x4c7f34[_0x8a6a('0x2e')]['fields']));_0x286092[_0x8a6a('0x32')]=_0x286092[_0x8a6a('0x32')][_0x8a6a('0x33')]?_0x286092[_0x8a6a('0x32')]:_0x5a5943[_0x8a6a('0x2c')];if(_0x4c7f34[_0x8a6a('0x2e')][_0x8a6a('0x43')]){_0x286092['include']=[{'all':!![]}];}_0x286092=_[_0x8a6a('0x3b')]({},_0x286092,_0x4c7f34[_0x8a6a('0x40')]);return db[_0x8a6a('0x2a')]['find'](_0x286092)[_0x8a6a('0x21')](handleEntityNotFound(_0x48c605,null))[_0x8a6a('0x21')](function(_0x7ed242){if(_0x7ed242){var _0x5c84df=_0x7ed242[_0x8a6a('0x22')]({'plain':!![]});_0x5c84df=qs['omit'](_0x5c84df,['id',_0x8a6a('0x4e'),_0x8a6a('0x4f')]);_0x4c7f34[_0x8a6a('0x50')]=_[_0x8a6a('0x51')](_0x4c7f34['body'],['id',_0x8a6a('0x4e'),_0x8a6a('0x4f')]);return db['Campaign']['create'](_[_0x8a6a('0x3b')](_0x5c84df,_0x4c7f34['body']),{'include':_0x4c7f34[_0x8a6a('0x2e')][_0x8a6a('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0x3a7034){var _0x22c58b=_0x4c7f34[_0x8a6a('0x49')]['get']({'plain':!![]});if(!_0x22c58b)throw new Error(_0x8a6a('0x47'));if(_0x22c58b['role']==='user'){var _0x17f9e4=_0x3a7034[_0x8a6a('0x22')]({'plain':!![]});var _0xbfb0ba=_0x8a6a('0x23');return db[_0x8a6a('0x4a')][_0x8a6a('0x44')]({'where':{'name':_0xbfb0ba,'userProfileId':_0x22c58b[_0x8a6a('0x4b')]},'raw':!![]})[_0x8a6a('0x21')](function(_0x516488){if(_0x516488&&_0x516488[_0x8a6a('0x4c')]===0x0){return db[_0x8a6a('0x4d')]['create']({'name':_0x17f9e4[_0x8a6a('0x27')],'resourceId':_0x17f9e4['id'],'type':_0x516488[_0x8a6a('0x27')],'sectionId':_0x516488['id']},{})[_0x8a6a('0x21')](function(){return _0x3a7034;});}else{return _0x3a7034;}})[_0x8a6a('0x45')](function(_0x1df195){logger[_0x8a6a('0x25')](_0x8a6a('0x52'),_0x1df195);throw _0x1df195;});}return _0x3a7034;});}})[_0x8a6a('0x21')](respondWithResult(_0x48c605,0xc9))[_0x8a6a('0x45')](handleError(_0x48c605,null));};exports[_0x8a6a('0x20')]=function(_0x285895,_0x1eae32){if(_0x285895[_0x8a6a('0x50')]['id']){delete _0x285895[_0x8a6a('0x50')]['id'];}return db[_0x8a6a('0x2a')][_0x8a6a('0x44')]({'where':{'id':_0x285895[_0x8a6a('0x53')]['id']}})['then'](handleEntityNotFound(_0x1eae32,null))['then'](saveUpdates(_0x285895[_0x8a6a('0x50')],null))['then'](respondWithResult(_0x1eae32,null))[_0x8a6a('0x45')](handleError(_0x1eae32,null));};exports[_0x8a6a('0x24')]=function(_0x1ed9de,_0x1bcb3a){return db[_0x8a6a('0x2a')][_0x8a6a('0x44')]({'where':{'id':_0x1ed9de[_0x8a6a('0x53')]['id']}})[_0x8a6a('0x21')](handleEntityNotFound(_0x1bcb3a,null))[_0x8a6a('0x21')](removeEntity(_0x1bcb3a,null))['catch'](handleError(_0x1bcb3a,null));};exports[_0x8a6a('0x54')]=function(_0x17f5b5,_0x444a9e,_0x549a88){var _0x37457e={'raw':!![],'where':{}};var _0x5a86d9={};var _0x24fce3={'count':0x0,'rows':[]};return db['Campaign'][_0x8a6a('0x55')]({'where':{'id':_0x17f5b5[_0x8a6a('0x53')]['id']}})[_0x8a6a('0x21')](handleEntityNotFound(_0x444a9e,null))[_0x8a6a('0x21')](function(_0x3aa4b3){if(_0x3aa4b3){_0x5a86d9[_0x8a6a('0x2c')]=_[_0x8a6a('0x2d')](db[_0x8a6a('0x56')]['rawAttributes']);_0x5a86d9[_0x8a6a('0x2e')]=_[_0x8a6a('0x2d')](_0x17f5b5[_0x8a6a('0x2e')]);_0x5a86d9[_0x8a6a('0x2f')]=_[_0x8a6a('0x30')](_0x5a86d9['model'],_0x5a86d9[_0x8a6a('0x2e')]);_0x37457e['attributes']=_[_0x8a6a('0x30')](_0x5a86d9[_0x8a6a('0x2c')],qs[_0x8a6a('0x31')](_0x17f5b5[_0x8a6a('0x2e')][_0x8a6a('0x31')]));_0x37457e[_0x8a6a('0x32')]=_0x37457e['attributes'][_0x8a6a('0x33')]?_0x37457e[_0x8a6a('0x32')]:_0x5a86d9[_0x8a6a('0x2c')];if(!_0x17f5b5[_0x8a6a('0x2e')]['hasOwnProperty'](_0x8a6a('0x35'))){_0x37457e[_0x8a6a('0x1a')]=qs[_0x8a6a('0x1a')](_0x17f5b5['query']['limit']);_0x37457e['offset']=qs[_0x8a6a('0x19')](_0x17f5b5[_0x8a6a('0x2e')][_0x8a6a('0x19')]);}_0x37457e[_0x8a6a('0x36')]=qs['sort'](_0x17f5b5[_0x8a6a('0x2e')]['sort']);_0x37457e[_0x8a6a('0x3a')]=qs[_0x8a6a('0x2f')](_[_0x8a6a('0x38')](_0x17f5b5[_0x8a6a('0x2e')],_0x5a86d9[_0x8a6a('0x2f')]));_0x37457e[_0x8a6a('0x3a')][_0x8a6a('0x57')]=_0x3aa4b3['id'];if(_0x17f5b5['query'][_0x8a6a('0x39')]){_0x37457e[_0x8a6a('0x3a')]=_[_0x8a6a('0x3b')](_0x37457e['where'],{'$or':_['map'](_0x37457e[_0x8a6a('0x32')],function(_0x5f5b94){var _0x474c3e={};_0x474c3e[_0x5f5b94]={'$like':'%'+_0x17f5b5[_0x8a6a('0x2e')][_0x8a6a('0x39')]+'%'};return _0x474c3e;})});}_0x37457e=_[_0x8a6a('0x3b')]({},_0x37457e,_0x17f5b5[_0x8a6a('0x40')]);return db[_0x8a6a('0x56')][_0x8a6a('0x18')]({'where':_0x37457e['where']})['then'](function(_0x3865cf){_0x24fce3[_0x8a6a('0x18')]=_0x3865cf;if(_0x17f5b5[_0x8a6a('0x2e')][_0x8a6a('0x43')]){_0x37457e[_0x8a6a('0x41')]=[{'all':!![]}];}return db[_0x8a6a('0x56')]['findAll'](_0x37457e);})['then'](function(_0x5412c2){_0x24fce3[_0x8a6a('0x42')]=_0x5412c2;return _0x24fce3;});}})[_0x8a6a('0x21')](respondWithFilteredResult(_0x444a9e,_0x37457e))[_0x8a6a('0x45')](handleError(_0x444a9e,null));};exports[_0x8a6a('0x58')]=function(_0x2d2097,_0x317c82,_0x502f74){var _0x5df9d6={'raw':!![],'where':{}};var _0xe85369={};var _0x1a2b4e={'count':0x0,'rows':[]};return db[_0x8a6a('0x2a')][_0x8a6a('0x55')]({'where':{'id':_0x2d2097[_0x8a6a('0x53')]['id']}})[_0x8a6a('0x21')](handleEntityNotFound(_0x317c82,null))[_0x8a6a('0x21')](function(_0x181983){if(_0x181983){_0xe85369[_0x8a6a('0x2c')]=_['keys'](db[_0x8a6a('0x59')][_0x8a6a('0x2b')]);_0xe85369[_0x8a6a('0x2e')]=_[_0x8a6a('0x2d')](_0x2d2097[_0x8a6a('0x2e')]);_0xe85369[_0x8a6a('0x2f')]=_['intersection'](_0xe85369['model'],_0xe85369[_0x8a6a('0x2e')]);_0x5df9d6[_0x8a6a('0x32')]=_[_0x8a6a('0x30')](_0xe85369[_0x8a6a('0x2c')],qs[_0x8a6a('0x31')](_0x2d2097['query'][_0x8a6a('0x31')]));_0x5df9d6[_0x8a6a('0x32')]=_0x5df9d6[_0x8a6a('0x32')][_0x8a6a('0x33')]?_0x5df9d6[_0x8a6a('0x32')]:_0xe85369[_0x8a6a('0x2c')];if(!_0x2d2097[_0x8a6a('0x2e')][_0x8a6a('0x34')]('nolimit')){_0x5df9d6[_0x8a6a('0x1a')]=qs[_0x8a6a('0x1a')](_0x2d2097['query']['limit']);_0x5df9d6[_0x8a6a('0x19')]=qs['offset'](_0x2d2097['query'][_0x8a6a('0x19')]);}_0x5df9d6['order']=qs[_0x8a6a('0x37')](_0x2d2097['query'][_0x8a6a('0x37')]);_0x5df9d6[_0x8a6a('0x3a')]=qs[_0x8a6a('0x2f')](_[_0x8a6a('0x38')](_0x2d2097[_0x8a6a('0x2e')],_0xe85369[_0x8a6a('0x2f')]));_0x5df9d6[_0x8a6a('0x3a')][_0x8a6a('0x57')]=_0x181983['id'];if(_0x2d2097['query']['filter']){_0x5df9d6['where']=_[_0x8a6a('0x3b')](_0x5df9d6[_0x8a6a('0x3a')],{'$or':_[_0x8a6a('0x3c')](_0x5df9d6[_0x8a6a('0x32')],function(_0x3a6091){var _0x21ec7f={};_0x21ec7f[_0x3a6091]={'$like':'%'+_0x2d2097[_0x8a6a('0x2e')]['filter']+'%'};return _0x21ec7f;})});}_0x5df9d6=_[_0x8a6a('0x3b')]({},_0x5df9d6,_0x2d2097[_0x8a6a('0x40')]);return db['CmHopperHistory'][_0x8a6a('0x18')]({'where':_0x5df9d6['where']})['then'](function(_0xa04670){_0x1a2b4e[_0x8a6a('0x18')]=_0xa04670;if(_0x2d2097[_0x8a6a('0x2e')][_0x8a6a('0x43')]){_0x5df9d6['include']=[{'all':!![]}];}return db[_0x8a6a('0x59')][_0x8a6a('0x5a')](_0x5df9d6);})[_0x8a6a('0x21')](function(_0x2fa828){_0x1a2b4e[_0x8a6a('0x42')]=_0x2fa828;return _0x1a2b4e;});}})[_0x8a6a('0x21')](respondWithFilteredResult(_0x317c82,_0x5df9d6))['catch'](handleError(_0x317c82,null));};exports[_0x8a6a('0x5b')]=function(_0xa19712,_0x2291a3,_0x4ba467){var _0x1eb852={'raw':!![],'where':{}};var _0x3e5ce4={};var _0x2a2ec4={'count':0x0,'rows':[]};return db['Campaign'][_0x8a6a('0x55')]({'where':{'id':_0xa19712[_0x8a6a('0x53')]['id']}})['then'](handleEntityNotFound(_0x2291a3,null))[_0x8a6a('0x21')](function(_0x528c71){if(_0x528c71){_0x3e5ce4[_0x8a6a('0x2c')]=_[_0x8a6a('0x2d')](db['CmHopperFinal']['rawAttributes']);_0x3e5ce4['query']=_[_0x8a6a('0x2d')](_0xa19712[_0x8a6a('0x2e')]);_0x3e5ce4['filters']=_['intersection'](_0x3e5ce4[_0x8a6a('0x2c')],_0x3e5ce4[_0x8a6a('0x2e')]);_0x1eb852[_0x8a6a('0x32')]=_[_0x8a6a('0x30')](_0x3e5ce4[_0x8a6a('0x2c')],qs[_0x8a6a('0x31')](_0xa19712[_0x8a6a('0x2e')][_0x8a6a('0x31')]));_0x1eb852[_0x8a6a('0x32')]=_0x1eb852[_0x8a6a('0x32')][_0x8a6a('0x33')]?_0x1eb852[_0x8a6a('0x32')]:_0x3e5ce4[_0x8a6a('0x2c')];if(!_0xa19712[_0x8a6a('0x2e')][_0x8a6a('0x34')](_0x8a6a('0x35'))){_0x1eb852[_0x8a6a('0x1a')]=qs['limit'](_0xa19712[_0x8a6a('0x2e')][_0x8a6a('0x1a')]);_0x1eb852[_0x8a6a('0x19')]=qs['offset'](_0xa19712['query'][_0x8a6a('0x19')]);}_0x1eb852[_0x8a6a('0x36')]=qs[_0x8a6a('0x37')](_0xa19712['query'][_0x8a6a('0x37')]);_0x1eb852[_0x8a6a('0x3a')]=qs[_0x8a6a('0x2f')](_[_0x8a6a('0x38')](_0xa19712[_0x8a6a('0x2e')],_0x3e5ce4[_0x8a6a('0x2f')]));_0x1eb852['where'][_0x8a6a('0x57')]=_0x528c71['id'];if(_0xa19712[_0x8a6a('0x2e')][_0x8a6a('0x39')]){_0x1eb852[_0x8a6a('0x3a')]=_[_0x8a6a('0x3b')](_0x1eb852['where'],{'$or':_[_0x8a6a('0x3c')](_0x1eb852['attributes'],function(_0x334034){var _0x378352={};_0x378352[_0x334034]={'$like':'%'+_0xa19712['query']['filter']+'%'};return _0x378352;})});}_0x1eb852=_[_0x8a6a('0x3b')]({},_0x1eb852,_0xa19712[_0x8a6a('0x40')]);return db[_0x8a6a('0x5c')][_0x8a6a('0x18')]({'where':_0x1eb852[_0x8a6a('0x3a')]})[_0x8a6a('0x21')](function(_0x4af675){_0x2a2ec4[_0x8a6a('0x18')]=_0x4af675;if(_0xa19712[_0x8a6a('0x2e')][_0x8a6a('0x43')]){_0x1eb852[_0x8a6a('0x41')]=[{'all':!![]}];}return db[_0x8a6a('0x5c')][_0x8a6a('0x5a')](_0x1eb852);})[_0x8a6a('0x21')](function(_0xd60f42){_0x2a2ec4[_0x8a6a('0x42')]=_0xd60f42;return _0x2a2ec4;});}})[_0x8a6a('0x21')](respondWithFilteredResult(_0x2291a3,_0x1eb852))[_0x8a6a('0x45')](handleError(_0x2291a3,null));};exports[_0x8a6a('0x5d')]=function(_0x3a3262,_0xdf7ffe,_0x450c82){var _0x548f7f={'raw':!![],'where':{}};var _0x4f7fdb={};var _0x5cf7db={'count':0x0,'rows':[]};return db['Campaign'][_0x8a6a('0x55')]({'where':{'id':_0x3a3262[_0x8a6a('0x53')]['id']}})['then'](handleEntityNotFound(_0xdf7ffe,null))['then'](function(_0x4701d6){if(_0x4701d6){_0x4f7fdb['model']=_[_0x8a6a('0x2d')](db[_0x8a6a('0x5e')]['rawAttributes']);_0x4f7fdb[_0x8a6a('0x2e')]=_[_0x8a6a('0x2d')](_0x3a3262[_0x8a6a('0x2e')]);_0x4f7fdb[_0x8a6a('0x2f')]=_[_0x8a6a('0x30')](_0x4f7fdb[_0x8a6a('0x2c')],_0x4f7fdb[_0x8a6a('0x2e')]);_0x548f7f[_0x8a6a('0x32')]=_[_0x8a6a('0x30')](_0x4f7fdb['model'],qs[_0x8a6a('0x31')](_0x3a3262[_0x8a6a('0x2e')][_0x8a6a('0x31')]));_0x548f7f[_0x8a6a('0x32')]=_0x548f7f[_0x8a6a('0x32')]['length']?_0x548f7f[_0x8a6a('0x32')]:_0x4f7fdb[_0x8a6a('0x2c')];if(!_0x3a3262[_0x8a6a('0x2e')][_0x8a6a('0x34')](_0x8a6a('0x35'))){_0x548f7f['limit']=qs['limit'](_0x3a3262['query'][_0x8a6a('0x1a')]);_0x548f7f[_0x8a6a('0x19')]=qs[_0x8a6a('0x19')](_0x3a3262[_0x8a6a('0x2e')]['offset']);}_0x548f7f[_0x8a6a('0x36')]=qs['sort'](_0x3a3262[_0x8a6a('0x2e')][_0x8a6a('0x37')]);_0x548f7f[_0x8a6a('0x3a')]=qs['filters'](_[_0x8a6a('0x38')](_0x3a3262[_0x8a6a('0x2e')],_0x4f7fdb[_0x8a6a('0x2f')]));_0x548f7f[_0x8a6a('0x3a')][_0x8a6a('0x57')]=_0x4701d6['id'];if(_0x3a3262[_0x8a6a('0x2e')][_0x8a6a('0x39')]){_0x548f7f['where']=_[_0x8a6a('0x3b')](_0x548f7f[_0x8a6a('0x3a')],{'$or':_[_0x8a6a('0x3c')](_0x548f7f[_0x8a6a('0x32')],function(_0x100518){var _0x1f0888={};_0x1f0888[_0x100518]={'$like':'%'+_0x3a3262[_0x8a6a('0x2e')][_0x8a6a('0x39')]+'%'};return _0x1f0888;})});}_0x548f7f=_[_0x8a6a('0x3b')]({},_0x548f7f,_0x3a3262[_0x8a6a('0x40')]);return db[_0x8a6a('0x5e')][_0x8a6a('0x18')]({'where':_0x548f7f['where']})[_0x8a6a('0x21')](function(_0x258a82){_0x5cf7db[_0x8a6a('0x18')]=_0x258a82;if(_0x3a3262[_0x8a6a('0x2e')][_0x8a6a('0x43')]){_0x548f7f[_0x8a6a('0x41')]=[{'all':!![]}];}return db[_0x8a6a('0x5e')][_0x8a6a('0x5a')](_0x548f7f);})[_0x8a6a('0x21')](function(_0x453e8d){_0x5cf7db[_0x8a6a('0x42')]=_0x453e8d;return _0x5cf7db;});}})[_0x8a6a('0x21')](respondWithFilteredResult(_0xdf7ffe,_0x548f7f))[_0x8a6a('0x45')](handleError(_0xdf7ffe,null));};exports[_0x8a6a('0x5f')]=function(_0x3dd6ff,_0xb62ffd,_0x2ad9b9){var _0x202a70={};var _0x380512={};var _0x4ab285;var _0x172ae0;return db[_0x8a6a('0x2a')][_0x8a6a('0x55')]({'where':{'id':_0x3dd6ff[_0x8a6a('0x53')]['id']}})[_0x8a6a('0x21')](handleEntityNotFound(_0xb62ffd,null))['then'](function(_0x4e8146){if(_0x4e8146){_0x4ab285=_0x4e8146;_0x380512[_0x8a6a('0x2c')]=_[_0x8a6a('0x2d')](db[_0x8a6a('0x60')][_0x8a6a('0x2b')]);_0x380512['query']=_[_0x8a6a('0x2d')](_0x3dd6ff[_0x8a6a('0x2e')]);_0x380512['filters']=_[_0x8a6a('0x30')](_0x380512['model'],_0x380512['query']);_0x202a70[_0x8a6a('0x32')]=_[_0x8a6a('0x30')](_0x380512[_0x8a6a('0x2c')],qs[_0x8a6a('0x31')](_0x3dd6ff[_0x8a6a('0x2e')]['fields']));_0x202a70[_0x8a6a('0x32')]=_0x202a70[_0x8a6a('0x32')][_0x8a6a('0x33')]?_0x202a70[_0x8a6a('0x32')]:_0x380512[_0x8a6a('0x2c')];_0x202a70[_0x8a6a('0x36')]=qs['sort'](_0x3dd6ff[_0x8a6a('0x2e')]['sort']);_0x202a70['where']=qs[_0x8a6a('0x2f')](_[_0x8a6a('0x38')](_0x3dd6ff['query'],_0x380512[_0x8a6a('0x2f')]));if(_0x3dd6ff[_0x8a6a('0x2e')][_0x8a6a('0x39')]){_0x202a70[_0x8a6a('0x3a')]=_[_0x8a6a('0x3b')](_0x202a70['where'],{'$or':_[_0x8a6a('0x3c')](_0x202a70[_0x8a6a('0x32')],function(_0x5ee2e6){var _0x75ad30={};_0x75ad30[_0x5ee2e6]={'$like':'%'+_0x3dd6ff[_0x8a6a('0x2e')][_0x8a6a('0x39')]+'%'};return _0x75ad30;})});}_0x202a70=_[_0x8a6a('0x3b')]({},_0x202a70,_0x3dd6ff['options']);return _0x4ab285['getLists'](_0x202a70);}})[_0x8a6a('0x21')](function(_0xece97a){if(_0xece97a){_0x172ae0=_0xece97a[_0x8a6a('0x33')];if(!_0x3dd6ff[_0x8a6a('0x2e')]['hasOwnProperty'](_0x8a6a('0x35'))){_0x202a70[_0x8a6a('0x1a')]=qs[_0x8a6a('0x1a')](_0x3dd6ff['query'][_0x8a6a('0x1a')]);_0x202a70['offset']=qs[_0x8a6a('0x19')](_0x3dd6ff['query'][_0x8a6a('0x19')]);}return _0x4ab285['getLists'](_0x202a70);}})[_0x8a6a('0x21')](function(_0x2eaa70){if(_0x2eaa70){return _0x2eaa70?{'count':_0x172ae0,'rows':_0x2eaa70}:null;}})[_0x8a6a('0x21')](respondWithResult(_0xb62ffd,null))[_0x8a6a('0x45')](handleError(_0xb62ffd,null));};exports[_0x8a6a('0x61')]=function(_0x47dc9d,_0x416575,_0x271d71){var _0x4cf20d,_0x74ea3e;return db[_0x8a6a('0x2a')][_0x8a6a('0x44')]({'where':{'id':_0x47dc9d[_0x8a6a('0x53')]['id']}})['then'](handleEntityNotFound(_0x416575,null))[_0x8a6a('0x21')](function(_0xd9ee18){if(_0xd9ee18){_0x74ea3e=_0xd9ee18;return _0xd9ee18[_0x8a6a('0x61')](_0x47dc9d[_0x8a6a('0x50')][_0x8a6a('0x62')],_['omit'](_0x47dc9d[_0x8a6a('0x50')],[_0x8a6a('0x62'),'id'])||{});}return null;})[_0x8a6a('0x63')](function(_0x285ef3){var _0x25539f;_0x4cf20d=_0x285ef3||[];var _0x45e50b=[];if(_0x285ef3){for(var _0x545ee9=0x0;_0x545ee9<_0x285ef3[_0x8a6a('0x33')];_0x545ee9+=0x1){var _0x264a52=_0x285ef3[_0x545ee9][_0x8a6a('0x22')]({'plain':!![]});_0x74ea3e['dialCheckDuplicateType']=_0x47dc9d[_0x8a6a('0x50')][_0x8a6a('0x64')]?_0x47dc9d['body'][_0x8a6a('0x64')]:_0x74ea3e[_0x8a6a('0x64')];switch(_0x74ea3e['dialCheckDuplicateType']){case _0x8a6a('0x65'):_0x25539f=squel[_0x8a6a('0x66')]()['into']('cm_hopper')[_0x8a6a('0x67')]([_0x8a6a('0x68'),_0x8a6a('0x69'),'ContactId','ListId','CampaignId',_0x8a6a('0x4e'),'updatedAt'],squel[_0x8a6a('0x6a')]()[_0x8a6a('0x3f')](_0x8a6a('0x68'),_0x8a6a('0x68'))[_0x8a6a('0x3f')](_0x8a6a('0x6b'),_0x8a6a('0x69'))[_0x8a6a('0x3f')]('id',_0x8a6a('0x6c'))[_0x8a6a('0x3f')](_0x264a52[_0x8a6a('0x6d')][_0x8a6a('0x6e')](),_0x8a6a('0x6f'))[_0x8a6a('0x3f')](_0x47dc9d['params']['id'][_0x8a6a('0x6e')](),_0x8a6a('0x57'))[_0x8a6a('0x3f')](_0x8a6a('0x6b'),_0x8a6a('0x4e'))[_0x8a6a('0x3f')]('NOW()',_0x8a6a('0x4f'))[_0x8a6a('0x70')](_0x8a6a('0x71'))[_0x8a6a('0x3a')](_0x8a6a('0x72'))[_0x8a6a('0x3a')](_0x8a6a('0x73'),_0x264a52['CmListId'][_0x8a6a('0x6e')]())[_0x8a6a('0x3a')](_0x8a6a('0x74'))[_0x8a6a('0x3a')](_0x8a6a('0x75'),squel['select']()[_0x8a6a('0x3f')](_0x8a6a('0x76'))[_0x8a6a('0x70')](_0x8a6a('0x77'))[_0x8a6a('0x3a')](_0x8a6a('0x78'),_0x47dc9d[_0x8a6a('0x53')]['id']['toString']()))[_0x8a6a('0x3a')](_0x8a6a('0x75'),squel['select']()[_0x8a6a('0x3f')](_0x8a6a('0x79'))[_0x8a6a('0x70')](_0x8a6a('0x7a'))[_0x8a6a('0x3a')](_0x8a6a('0x78'),_0x47dc9d[_0x8a6a('0x53')]['id'][_0x8a6a('0x6e')]())))[_0x8a6a('0x6e')]();break;case'onlyIfOpen':_0x25539f=squel['insert']()[_0x8a6a('0x7b')]('cm_hopper')['fromQuery']([_0x8a6a('0x68'),'scheduledAt','ContactId',_0x8a6a('0x6f'),_0x8a6a('0x57'),'createdAt',_0x8a6a('0x4f')],squel[_0x8a6a('0x6a')]()[_0x8a6a('0x3f')]('phone','phone')[_0x8a6a('0x3f')](_0x8a6a('0x6b'),_0x8a6a('0x69'))[_0x8a6a('0x3f')]('id',_0x8a6a('0x6c'))[_0x8a6a('0x3f')](_0x264a52[_0x8a6a('0x6d')][_0x8a6a('0x6e')](),_0x8a6a('0x6f'))['field'](_0x47dc9d['params']['id'][_0x8a6a('0x6e')](),'CampaignId')['field'](_0x8a6a('0x6b'),_0x8a6a('0x4e'))[_0x8a6a('0x3f')](_0x8a6a('0x6b'),'updatedAt')[_0x8a6a('0x70')](_0x8a6a('0x71'))['where']('deletedAt\x20IS\x20NULL')[_0x8a6a('0x3a')]('ListId\x20=\x20?',_0x264a52[_0x8a6a('0x6d')]['toString']())[_0x8a6a('0x3a')]('phone\x20IS\x20NOT\x20NULL')[_0x8a6a('0x3a')](_0x8a6a('0x75'),squel['select']()['field'](_0x8a6a('0x79'))[_0x8a6a('0x70')](_0x8a6a('0x7a'))[_0x8a6a('0x3a')](_0x8a6a('0x78'),_0x47dc9d[_0x8a6a('0x53')]['id'][_0x8a6a('0x6e')]())))[_0x8a6a('0x6e')]();break;default:_0x25539f=squel[_0x8a6a('0x66')]()[_0x8a6a('0x7b')](_0x8a6a('0x7a'))[_0x8a6a('0x67')]([_0x8a6a('0x68'),_0x8a6a('0x69'),_0x8a6a('0x6c'),_0x8a6a('0x6f'),_0x8a6a('0x57'),_0x8a6a('0x4e'),'updatedAt'],squel[_0x8a6a('0x6a')]()[_0x8a6a('0x3f')]('phone',_0x8a6a('0x68'))[_0x8a6a('0x3f')]('NOW()','scheduledAt')[_0x8a6a('0x3f')]('id','ContactId')[_0x8a6a('0x3f')](_0x264a52[_0x8a6a('0x6d')]['toString'](),'ListId')[_0x8a6a('0x3f')](_0x47dc9d[_0x8a6a('0x53')]['id'][_0x8a6a('0x6e')](),_0x8a6a('0x57'))[_0x8a6a('0x3f')]('NOW()',_0x8a6a('0x4e'))[_0x8a6a('0x3f')](_0x8a6a('0x6b'),_0x8a6a('0x4f'))['from']('cm_contacts')[_0x8a6a('0x3a')](_0x8a6a('0x72'))['where'](_0x8a6a('0x73'),_0x264a52[_0x8a6a('0x6d')][_0x8a6a('0x6e')]())[_0x8a6a('0x3a')]('phone\x20IS\x20NOT\x20NULL'))[_0x8a6a('0x6e')]();}_0x45e50b[_0x8a6a('0x7c')](db['sequelize'][_0x8a6a('0x2e')](_0x25539f));}return BPromise['all'](_0x45e50b);}})['then'](function(){return _0x4cf20d;})[_0x8a6a('0x21')](respondWithResult(_0x416575,null))[_0x8a6a('0x45')](handleError(_0x416575,null));};exports[_0x8a6a('0x7d')]=function(_0x4d0a9d,_0x49d5b2,_0x4ce420){var _0x5d3504;return db['Campaign'][_0x8a6a('0x44')]({'where':{'id':_0x4d0a9d[_0x8a6a('0x53')]['id']}})['then'](handleEntityNotFound(_0x49d5b2,null))[_0x8a6a('0x21')](function(_0x3a2bc0){if(_0x3a2bc0){return _0x3a2bc0[_0x8a6a('0x7d')](_0x4d0a9d[_0x8a6a('0x2e')][_0x8a6a('0x62')]);}})[_0x8a6a('0x21')](function(_0x2e585d){if(_0x2e585d){_0x5d3504=_0x2e585d;return db[_0x8a6a('0x56')][_0x8a6a('0x24')]({'where':{'ListId':_0x4d0a9d[_0x8a6a('0x2e')][_0x8a6a('0x62')],'CampaignId':_0x4d0a9d[_0x8a6a('0x53')]['id']}})['then'](function(){return _0x5d3504;});}})[_0x8a6a('0x21')](respondWithStatusCode(_0x49d5b2,null))['catch'](handleError(_0x49d5b2,null));};exports['getBlackLists']=function(_0x3c4afd,_0x224717,_0x367bf2){var _0x37bcde={'raw':!![],'where':{}};var _0x5d7e0d={};var _0x172391={'count':0x0,'rows':[]};return db['Campaign'][_0x8a6a('0x55')]({'where':{'id':_0x3c4afd[_0x8a6a('0x53')]['id']}})[_0x8a6a('0x21')](handleEntityNotFound(_0x224717,null))[_0x8a6a('0x21')](function(_0x52d09c){if(_0x52d09c){_0x5d7e0d[_0x8a6a('0x2c')]=_['keys'](db['CmList'][_0x8a6a('0x2b')]);_0x5d7e0d[_0x8a6a('0x2e')]=_['keys'](_0x3c4afd[_0x8a6a('0x2e')]);_0x5d7e0d[_0x8a6a('0x2f')]=_[_0x8a6a('0x30')](_0x5d7e0d[_0x8a6a('0x2c')],_0x5d7e0d['query']);_0x37bcde[_0x8a6a('0x32')]=_[_0x8a6a('0x30')](_0x5d7e0d[_0x8a6a('0x2c')],qs['fields'](_0x3c4afd['query'][_0x8a6a('0x31')]));_0x37bcde[_0x8a6a('0x32')]=_0x37bcde['attributes']['length']?_0x37bcde[_0x8a6a('0x32')]:_0x5d7e0d[_0x8a6a('0x2c')];if(!_0x3c4afd['query'][_0x8a6a('0x34')](_0x8a6a('0x35'))){_0x37bcde['limit']=qs[_0x8a6a('0x1a')](_0x3c4afd[_0x8a6a('0x2e')][_0x8a6a('0x1a')]);_0x37bcde[_0x8a6a('0x19')]=qs[_0x8a6a('0x19')](_0x3c4afd['query']['offset']);}_0x37bcde['order']=qs[_0x8a6a('0x37')](_0x3c4afd[_0x8a6a('0x2e')][_0x8a6a('0x37')]);_0x37bcde[_0x8a6a('0x3a')]=qs[_0x8a6a('0x2f')](_[_0x8a6a('0x38')](_0x3c4afd[_0x8a6a('0x2e')],_0x5d7e0d[_0x8a6a('0x2f')]));_0x37bcde[_0x8a6a('0x3a')][_0x8a6a('0x57')]=_0x52d09c['id'];if(_0x3c4afd[_0x8a6a('0x2e')][_0x8a6a('0x39')]){_0x37bcde[_0x8a6a('0x3a')]=_['merge'](_0x37bcde['where'],{'$or':_[_0x8a6a('0x3c')](_0x37bcde[_0x8a6a('0x32')],function(_0x5294c3){var _0x3dee6f={};_0x3dee6f[_0x5294c3]={'$like':'%'+_0x3c4afd[_0x8a6a('0x2e')]['filter']+'%'};return _0x3dee6f;})});}_0x37bcde=_[_0x8a6a('0x3b')]({},_0x37bcde,_0x3c4afd[_0x8a6a('0x40')]);return db[_0x8a6a('0x60')]['count']({'where':_0x37bcde[_0x8a6a('0x3a')]})[_0x8a6a('0x21')](function(_0x222353){_0x172391[_0x8a6a('0x18')]=_0x222353;if(_0x3c4afd[_0x8a6a('0x2e')]['includeAll']){_0x37bcde[_0x8a6a('0x41')]=[{'all':!![]}];}return db[_0x8a6a('0x60')]['findAll'](_0x37bcde);})[_0x8a6a('0x21')](function(_0x3aca72){_0x172391[_0x8a6a('0x42')]=_0x3aca72;return _0x172391;});}})[_0x8a6a('0x21')](respondWithFilteredResult(_0x224717,_0x37bcde))[_0x8a6a('0x45')](handleError(_0x224717,null));};exports[_0x8a6a('0x7e')]=function(_0x33da9b,_0x17c534,_0x3cc02a){var _0x3c0e0b,_0x3cb586;return db[_0x8a6a('0x2a')][_0x8a6a('0x44')]({'where':{'id':_0x33da9b['params']['id']}})[_0x8a6a('0x21')](handleEntityNotFound(_0x17c534,null))[_0x8a6a('0x21')](function(_0x37c446){if(_0x37c446){_0x3cb586=_0x37c446;return _0x37c446['addBlackLists'](_0x33da9b[_0x8a6a('0x50')][_0x8a6a('0x62')],_[_0x8a6a('0x51')](_0x33da9b['body'],[_0x8a6a('0x62'),'id'])||{});}return null;})['spread'](function(_0x2c3b70){var _0x33b661;_0x3c0e0b=_0x2c3b70||[];var _0x222c31=[];if(_0x2c3b70){for(var _0x3a6e51=0x0;_0x3a6e51<_0x2c3b70['length'];_0x3a6e51+=0x1){var _0x293e88=_0x2c3b70[_0x3a6e51]['get']({'plain':!![]});_0x33b661=squel[_0x8a6a('0x66')]()[_0x8a6a('0x7b')](_0x8a6a('0x7f'))[_0x8a6a('0x67')]([_0x8a6a('0x68'),_0x8a6a('0x6c'),_0x8a6a('0x6f'),_0x8a6a('0x57'),_0x8a6a('0x4e'),_0x8a6a('0x4f')],squel[_0x8a6a('0x6a')]()['field']('phone',_0x8a6a('0x68'))[_0x8a6a('0x3f')]('id','ContactId')[_0x8a6a('0x3f')](_0x293e88[_0x8a6a('0x6d')][_0x8a6a('0x6e')](),_0x8a6a('0x6f'))[_0x8a6a('0x3f')](_0x33da9b[_0x8a6a('0x53')]['id'][_0x8a6a('0x6e')](),_0x8a6a('0x57'))[_0x8a6a('0x3f')](_0x8a6a('0x6b'),'createdAt')['field'](_0x8a6a('0x6b'),_0x8a6a('0x4f'))[_0x8a6a('0x70')](_0x8a6a('0x71'))['where']('deletedAt\x20IS\x20NULL')[_0x8a6a('0x3a')](_0x8a6a('0x73'),_0x293e88[_0x8a6a('0x6d')]['toString']())[_0x8a6a('0x3a')](_0x8a6a('0x74')))['toString']();_0x222c31[_0x8a6a('0x7c')](db[_0x8a6a('0x80')][_0x8a6a('0x2e')](_0x33b661));}return BPromise[_0x8a6a('0x81')](_0x222c31);}})['then'](function(){return _0x3c0e0b;})['then'](respondWithResult(_0x17c534,null))[_0x8a6a('0x45')](handleError(_0x17c534,null));};exports[_0x8a6a('0x82')]=function(_0x10e334,_0x5393f5,_0x5ec694){var _0x281843;return db[_0x8a6a('0x2a')]['find']({'where':{'id':_0x10e334['params']['id']}})[_0x8a6a('0x21')](handleEntityNotFound(_0x5393f5,null))['then'](function(_0x2bfdba){if(_0x2bfdba){return _0x2bfdba[_0x8a6a('0x82')](_0x10e334['query'][_0x8a6a('0x62')]);}})[_0x8a6a('0x21')](function(_0xfaa1a8){if(_0xfaa1a8){_0x281843=_0xfaa1a8;return db[_0x8a6a('0x5e')][_0x8a6a('0x24')]({'where':{'ListId':_0x10e334[_0x8a6a('0x2e')][_0x8a6a('0x62')],'CampaignId':_0x10e334[_0x8a6a('0x53')]['id']}})[_0x8a6a('0x21')](function(){return _0x281843;});}})[_0x8a6a('0x21')](respondWithStatusCode(_0x5393f5,null))[_0x8a6a('0x45')](handleError(_0x5393f5,null));}; \ No newline at end of file +var _0x6b5f=['util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/utils','end','status','count','offset','Content-Range','json','reject','save','update','destroy','get','IvrCampaigns','UserProfileResource','then','error','name','send','index','Campaign','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','type','key','field','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','omit','getHoppers','CmHopper','sort','map','getHopperHistories','findOne','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','insert','fromQuery','phone','scheduledAt','ContactId','ListId','updatedAt','select','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','into','cm_hopper','push','sequelize','all','removeLists','ids','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache'];(function(_0x1c06e7,_0x18f1a6){var _0x27df54=function(_0x2ebdf3){while(--_0x2ebdf3){_0x1c06e7['push'](_0x1c06e7['shift']());}};_0x27df54(++_0x18f1a6);}(_0x6b5f,0xf8));var _0xf6b5=function(_0x1bf2b5,_0x2909ed){_0x1bf2b5=_0x1bf2b5-0x0;var _0x3f02e6=_0x6b5f[_0x1bf2b5];return _0x3f02e6;};'use strict';var pdf=require(_0xf6b5('0x0'));var emlformat=require(_0xf6b5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf6b5('0x2'));var rp=require('request-promise');var moment=require(_0xf6b5('0x3'));var BPromise=require(_0xf6b5('0x4'));var Mustache=require(_0xf6b5('0x5'));var util=require(_0xf6b5('0x6'));var path=require(_0xf6b5('0x7'));var sox=require(_0xf6b5('0x8'));var csv=require(_0xf6b5('0x9'));var ejs=require(_0xf6b5('0xa'));var fs=require('fs');var _=require(_0xf6b5('0xb'));var squel=require(_0xf6b5('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf6b5('0xd'));var toCsv=require(_0xf6b5('0x9'));var querystring=require(_0xf6b5('0xe'));var Papa=require(_0xf6b5('0xf'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0xf6b5('0x10'));var qs=require(_0xf6b5('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xf6b5('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53405a,_0xe7729b){_0xe7729b=_0xe7729b||0xcc;return function(_0x33aa56){if(_0x33aa56){return _0x53405a['sendStatus'](_0xe7729b);}return _0x53405a['status'](_0xe7729b)[_0xf6b5('0x13')]();};}function respondWithResult(_0x277895,_0x537ca5){_0x537ca5=_0x537ca5||0xc8;return function(_0x2c666f){if(_0x2c666f){return _0x277895[_0xf6b5('0x14')](_0x537ca5)['json'](_0x2c666f);}};}function respondWithFilteredResult(_0x53ab70,_0x26acab){return function(_0x511ae1){if(_0x511ae1){var _0x4f3d61=_0x511ae1[_0xf6b5('0x15')],_0x1cb019=_0x26acab['offset'],_0x1e48c3=_0x26acab[_0xf6b5('0x16')]+_0x26acab['limit'],_0xd19265;if(_0x1e48c3>=_0x4f3d61){_0x1e48c3=_0x4f3d61;_0xd19265=0xc8;}else{_0xd19265=0xce;}_0x53ab70[_0xf6b5('0x14')](_0xd19265);return _0x53ab70['set'](_0xf6b5('0x17'),_0x1cb019+'-'+_0x1e48c3+'/'+_0x4f3d61)[_0xf6b5('0x18')](_0x511ae1);}return null;};}function patchUpdates(_0x25da44){return function(_0x5195e5){try{jsonpatch['apply'](_0x5195e5,_0x25da44,!![]);}catch(_0x342054){return BPromise[_0xf6b5('0x19')](_0x342054);}return _0x5195e5[_0xf6b5('0x1a')]();};}function saveUpdates(_0x2008d5,_0x5020f0){return function(_0x4a4758){if(_0x4a4758){return _0x4a4758[_0xf6b5('0x1b')](_0x2008d5)['then'](function(_0x47ae0d){return _0x47ae0d;});}return null;};}function removeEntity(_0x4a6a7f,_0x3167a2){return function(_0x1410fc){if(_0x1410fc){return _0x1410fc[_0xf6b5('0x1c')]()['then'](function(){var _0x1834a9=_0x1410fc[_0xf6b5('0x1d')]({'plain':!![]});var _0x119d60=_0xf6b5('0x1e');return db[_0xf6b5('0x1f')][_0xf6b5('0x1c')]({'where':{'type':_0x119d60,'resourceId':_0x1834a9['id']}})['then'](function(){return _0x1410fc;});})[_0xf6b5('0x20')](function(){_0x4a6a7f[_0xf6b5('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b38bb,_0x3ff389){return function(_0x58ccd1){if(!_0x58ccd1){_0x1b38bb['sendStatus'](0x194);}return _0x58ccd1;};}function handleError(_0x2752a9,_0x2a1abb){_0x2a1abb=_0x2a1abb||0x1f4;return function(_0x46b362){logger[_0xf6b5('0x21')](_0x46b362['stack']);if(_0x46b362[_0xf6b5('0x22')]){delete _0x46b362[_0xf6b5('0x22')];}_0x2752a9[_0xf6b5('0x14')](_0x2a1abb)[_0xf6b5('0x23')](_0x46b362);};}exports[_0xf6b5('0x24')]=function(_0x32f8e8,_0x22c7be){var _0x1fecb8={},_0x5b9bf9={},_0x2a9464={'count':0x0,'rows':[]};var _0x3d56c0=db[_0xf6b5('0x25')][_0xf6b5('0x26')];_0x5b9bf9['model']=_[_0xf6b5('0x27')](_0x3d56c0);_0x5b9bf9[_0xf6b5('0x28')]=_[_0xf6b5('0x27')](_0x32f8e8[_0xf6b5('0x28')]);_0x5b9bf9[_0xf6b5('0x29')]=_[_0xf6b5('0x2a')](_0x5b9bf9[_0xf6b5('0x2b')],_0x5b9bf9[_0xf6b5('0x28')]);_0x1fecb8[_0xf6b5('0x2c')]=_['intersection'](_0x5b9bf9[_0xf6b5('0x2b')],qs['fields'](_0x32f8e8[_0xf6b5('0x28')][_0xf6b5('0x2d')]));_0x1fecb8[_0xf6b5('0x2c')]=_0x1fecb8[_0xf6b5('0x2c')][_0xf6b5('0x2e')]?_0x1fecb8['attributes']:_0x5b9bf9[_0xf6b5('0x2b')];if(!_0x32f8e8['query'][_0xf6b5('0x2f')](_0xf6b5('0x30'))){_0x1fecb8[_0xf6b5('0x31')]=qs[_0xf6b5('0x31')](_0x32f8e8[_0xf6b5('0x28')]['limit']);_0x1fecb8[_0xf6b5('0x16')]=qs[_0xf6b5('0x16')](_0x32f8e8[_0xf6b5('0x28')]['offset']);}_0x1fecb8[_0xf6b5('0x32')]=qs['sort'](_0x32f8e8[_0xf6b5('0x28')]['sort']);_0x1fecb8[_0xf6b5('0x33')]=qs['filters'](_[_0xf6b5('0x34')](_0x32f8e8[_0xf6b5('0x28')],_0x5b9bf9[_0xf6b5('0x29')]));if(_0x32f8e8[_0xf6b5('0x28')][_0xf6b5('0x35')]){_0x1fecb8[_0xf6b5('0x33')]=_[_0xf6b5('0x36')](_0x1fecb8[_0xf6b5('0x33')],{'$or':_['map'](_0x3d56c0,function(_0x3a99f5){if(_0x3a99f5[_0xf6b5('0x37')][_0xf6b5('0x38')]!=='VIRTUAL'){var _0x4e287b={};_0x4e287b[_0x3a99f5[_0xf6b5('0x39')]]={'$like':'%'+_0x32f8e8[_0xf6b5('0x28')]['filter']+'%'};return _0x4e287b;}})});}_0x1fecb8=_['merge']({},_0x1fecb8,_0x32f8e8['options']);var _0x3a136b={'where':_0x1fecb8[_0xf6b5('0x33')]};return db[_0xf6b5('0x25')]['count'](_0x3a136b)[_0xf6b5('0x20')](function(_0x265cfd){_0x2a9464['count']=_0x265cfd;if(_0x32f8e8[_0xf6b5('0x28')][_0xf6b5('0x3a')]){_0x1fecb8[_0xf6b5('0x3b')]=[{'all':!![]}];}return db[_0xf6b5('0x25')][_0xf6b5('0x3c')](_0x1fecb8);})['then'](function(_0x2f557f){_0x2a9464[_0xf6b5('0x3d')]=_0x2f557f;return _0x2a9464;})[_0xf6b5('0x20')](respondWithFilteredResult(_0x22c7be,_0x1fecb8))[_0xf6b5('0x3e')](handleError(_0x22c7be,null));};exports[_0xf6b5('0x3f')]=function(_0x35812b,_0x78028b){var _0x3fc9d8={'raw':![],'where':{'id':_0x35812b[_0xf6b5('0x40')]['id']}},_0x4185ed={};_0x4185ed[_0xf6b5('0x2b')]=_[_0xf6b5('0x27')](db['Campaign']['rawAttributes']);_0x4185ed['query']=_[_0xf6b5('0x27')](_0x35812b[_0xf6b5('0x28')]);_0x4185ed[_0xf6b5('0x29')]=_[_0xf6b5('0x2a')](_0x4185ed['model'],_0x4185ed[_0xf6b5('0x28')]);_0x3fc9d8['attributes']=_[_0xf6b5('0x2a')](_0x4185ed['model'],qs['fields'](_0x35812b[_0xf6b5('0x28')][_0xf6b5('0x2d')]));_0x3fc9d8[_0xf6b5('0x2c')]=_0x3fc9d8[_0xf6b5('0x2c')][_0xf6b5('0x2e')]?_0x3fc9d8['attributes']:_0x4185ed[_0xf6b5('0x2b')];if(_0x35812b[_0xf6b5('0x28')]['includeAll']){_0x3fc9d8['include']=[{'all':!![]}];}_0x3fc9d8=_[_0xf6b5('0x36')]({},_0x3fc9d8,_0x35812b[_0xf6b5('0x41')]);return db[_0xf6b5('0x25')][_0xf6b5('0x42')](_0x3fc9d8)[_0xf6b5('0x20')](handleEntityNotFound(_0x78028b,null))[_0xf6b5('0x20')](respondWithResult(_0x78028b,null))[_0xf6b5('0x3e')](handleError(_0x78028b,null));};exports[_0xf6b5('0x43')]=function(_0x426769,_0x596db1){return db[_0xf6b5('0x25')][_0xf6b5('0x43')](_0x426769[_0xf6b5('0x44')],{})[_0xf6b5('0x20')](function(_0x4ae919){var _0x5ca84b=_0x426769['user']['get']({'plain':!![]});if(!_0x5ca84b)throw new Error(_0xf6b5('0x45'));if(_0x5ca84b[_0xf6b5('0x46')]===_0xf6b5('0x47')){var _0x138a08=_0x4ae919[_0xf6b5('0x1d')]({'plain':!![]});var _0x3a945f='IvrCampaigns';return db[_0xf6b5('0x48')][_0xf6b5('0x42')]({'where':{'name':_0x3a945f,'userProfileId':_0x5ca84b[_0xf6b5('0x49')]},'raw':!![]})[_0xf6b5('0x20')](function(_0x2b086b){if(_0x2b086b&&_0x2b086b[_0xf6b5('0x4a')]===0x0){return db[_0xf6b5('0x1f')][_0xf6b5('0x43')]({'name':_0x138a08[_0xf6b5('0x22')],'resourceId':_0x138a08['id'],'type':_0x2b086b[_0xf6b5('0x22')],'sectionId':_0x2b086b['id']},{})[_0xf6b5('0x20')](function(){return _0x4ae919;});}else{return _0x4ae919;}})[_0xf6b5('0x3e')](function(_0x417667){logger[_0xf6b5('0x21')](_0xf6b5('0x4b'),_0x417667);throw _0x417667;});}return _0x4ae919;})[_0xf6b5('0x20')](respondWithResult(_0x596db1,0xc9))[_0xf6b5('0x3e')](handleError(_0x596db1,null));};exports[_0xf6b5('0x4c')]=function(_0xfaf122,_0x6776c5){var _0x344235={'raw':![],'where':{'id':_0xfaf122[_0xf6b5('0x40')]['id']}},_0x3f28f1={};_0x3f28f1[_0xf6b5('0x2b')]=_[_0xf6b5('0x27')](db[_0xf6b5('0x25')][_0xf6b5('0x26')]);_0x344235[_0xf6b5('0x2c')]=_[_0xf6b5('0x2a')](_0x3f28f1[_0xf6b5('0x2b')],qs[_0xf6b5('0x2d')](_0xfaf122['query'][_0xf6b5('0x2d')]));_0x344235[_0xf6b5('0x2c')]=_0x344235['attributes'][_0xf6b5('0x2e')]?_0x344235['attributes']:_0x3f28f1[_0xf6b5('0x2b')];if(_0xfaf122['query'][_0xf6b5('0x3a')]){_0x344235[_0xf6b5('0x3b')]=[{'all':!![]}];}_0x344235=_[_0xf6b5('0x36')]({},_0x344235,_0xfaf122[_0xf6b5('0x41')]);return db[_0xf6b5('0x25')][_0xf6b5('0x42')](_0x344235)[_0xf6b5('0x20')](handleEntityNotFound(_0x6776c5,null))['then'](function(_0x5e512b){if(_0x5e512b){var _0x2bd06a=_0x5e512b[_0xf6b5('0x1d')]({'plain':!![]});_0x2bd06a=qs['omit'](_0x2bd06a,['id',_0xf6b5('0x4d'),'updatedAt']);_0xfaf122[_0xf6b5('0x44')]=_[_0xf6b5('0x4e')](_0xfaf122[_0xf6b5('0x44')],['id','createdAt','updatedAt']);return db[_0xf6b5('0x25')][_0xf6b5('0x43')](_['merge'](_0x2bd06a,_0xfaf122[_0xf6b5('0x44')]),{'include':_0xfaf122[_0xf6b5('0x28')][_0xf6b5('0x3a')]?[{'all':!![]}]:undefined})[_0xf6b5('0x20')](function(_0x349b08){var _0x51dcc9=_0xfaf122['user']['get']({'plain':!![]});if(!_0x51dcc9)throw new Error(_0xf6b5('0x45'));if(_0x51dcc9[_0xf6b5('0x46')]===_0xf6b5('0x47')){var _0x4f2cad=_0x349b08['get']({'plain':!![]});var _0x1e5959=_0xf6b5('0x1e');return db[_0xf6b5('0x48')][_0xf6b5('0x42')]({'where':{'name':_0x1e5959,'userProfileId':_0x51dcc9[_0xf6b5('0x49')]},'raw':!![]})[_0xf6b5('0x20')](function(_0x16f88e){if(_0x16f88e&&_0x16f88e[_0xf6b5('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f2cad[_0xf6b5('0x22')],'resourceId':_0x4f2cad['id'],'type':_0x16f88e[_0xf6b5('0x22')],'sectionId':_0x16f88e['id']},{})[_0xf6b5('0x20')](function(){return _0x349b08;});}else{return _0x349b08;}})[_0xf6b5('0x3e')](function(_0x2fb9a3){logger[_0xf6b5('0x21')](_0xf6b5('0x4b'),_0x2fb9a3);throw _0x2fb9a3;});}return _0x349b08;});}})[_0xf6b5('0x20')](respondWithResult(_0x6776c5,0xc9))[_0xf6b5('0x3e')](handleError(_0x6776c5,null));};exports[_0xf6b5('0x1b')]=function(_0xee10c1,_0x11ae99){if(_0xee10c1[_0xf6b5('0x44')]['id']){delete _0xee10c1[_0xf6b5('0x44')]['id'];}return db['Campaign'][_0xf6b5('0x42')]({'where':{'id':_0xee10c1[_0xf6b5('0x40')]['id']}})[_0xf6b5('0x20')](handleEntityNotFound(_0x11ae99,null))[_0xf6b5('0x20')](saveUpdates(_0xee10c1[_0xf6b5('0x44')],null))[_0xf6b5('0x20')](respondWithResult(_0x11ae99,null))['catch'](handleError(_0x11ae99,null));};exports[_0xf6b5('0x1c')]=function(_0x158dba,_0x34ac2b){return db['Campaign'][_0xf6b5('0x42')]({'where':{'id':_0x158dba[_0xf6b5('0x40')]['id']}})['then'](handleEntityNotFound(_0x34ac2b,null))[_0xf6b5('0x20')](removeEntity(_0x34ac2b,null))[_0xf6b5('0x3e')](handleError(_0x34ac2b,null));};exports[_0xf6b5('0x4f')]=function(_0x477adf,_0x2e2268,_0x2b9ea2){var _0x59c146={'raw':!![],'where':{}};var _0x4e05bd={};var _0x3130c0={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x477adf[_0xf6b5('0x40')]['id']}})[_0xf6b5('0x20')](handleEntityNotFound(_0x2e2268,null))[_0xf6b5('0x20')](function(_0x146180){if(_0x146180){_0x4e05bd[_0xf6b5('0x2b')]=_[_0xf6b5('0x27')](db[_0xf6b5('0x50')][_0xf6b5('0x26')]);_0x4e05bd[_0xf6b5('0x28')]=_[_0xf6b5('0x27')](_0x477adf['query']);_0x4e05bd[_0xf6b5('0x29')]=_[_0xf6b5('0x2a')](_0x4e05bd[_0xf6b5('0x2b')],_0x4e05bd[_0xf6b5('0x28')]);_0x59c146['attributes']=_['intersection'](_0x4e05bd[_0xf6b5('0x2b')],qs[_0xf6b5('0x2d')](_0x477adf['query'][_0xf6b5('0x2d')]));_0x59c146[_0xf6b5('0x2c')]=_0x59c146[_0xf6b5('0x2c')][_0xf6b5('0x2e')]?_0x59c146[_0xf6b5('0x2c')]:_0x4e05bd[_0xf6b5('0x2b')];if(!_0x477adf[_0xf6b5('0x28')][_0xf6b5('0x2f')](_0xf6b5('0x30'))){_0x59c146['limit']=qs['limit'](_0x477adf[_0xf6b5('0x28')][_0xf6b5('0x31')]);_0x59c146[_0xf6b5('0x16')]=qs[_0xf6b5('0x16')](_0x477adf[_0xf6b5('0x28')][_0xf6b5('0x16')]);}_0x59c146[_0xf6b5('0x32')]=qs['sort'](_0x477adf[_0xf6b5('0x28')][_0xf6b5('0x51')]);_0x59c146['where']=qs[_0xf6b5('0x29')](_['pick'](_0x477adf[_0xf6b5('0x28')],_0x4e05bd[_0xf6b5('0x29')]));_0x59c146[_0xf6b5('0x33')]['CampaignId']=_0x146180['id'];if(_0x477adf[_0xf6b5('0x28')][_0xf6b5('0x35')]){_0x59c146[_0xf6b5('0x33')]=_[_0xf6b5('0x36')](_0x59c146[_0xf6b5('0x33')],{'$or':_[_0xf6b5('0x52')](_0x59c146[_0xf6b5('0x2c')],function(_0x40e2be){var _0x30c2dd={};_0x30c2dd[_0x40e2be]={'$like':'%'+_0x477adf[_0xf6b5('0x28')][_0xf6b5('0x35')]+'%'};return _0x30c2dd;})});}_0x59c146=_[_0xf6b5('0x36')]({},_0x59c146,_0x477adf[_0xf6b5('0x41')]);return db['CmHopper'][_0xf6b5('0x15')]({'where':_0x59c146['where']})[_0xf6b5('0x20')](function(_0x188b42){_0x3130c0[_0xf6b5('0x15')]=_0x188b42;if(_0x477adf[_0xf6b5('0x28')][_0xf6b5('0x3a')]){_0x59c146['include']=[{'all':!![]}];}return db[_0xf6b5('0x50')][_0xf6b5('0x3c')](_0x59c146);})[_0xf6b5('0x20')](function(_0x1f5e23){_0x3130c0[_0xf6b5('0x3d')]=_0x1f5e23;return _0x3130c0;});}})[_0xf6b5('0x20')](respondWithFilteredResult(_0x2e2268,_0x59c146))['catch'](handleError(_0x2e2268,null));};exports[_0xf6b5('0x53')]=function(_0x469f25,_0x2ce951,_0x5a257c){var _0x5add4a={'raw':!![],'where':{}};var _0x58775c={};var _0x9842c={'count':0x0,'rows':[]};return db['Campaign'][_0xf6b5('0x54')]({'where':{'id':_0x469f25[_0xf6b5('0x40')]['id']}})[_0xf6b5('0x20')](handleEntityNotFound(_0x2ce951,null))[_0xf6b5('0x20')](function(_0x25271c){if(_0x25271c){_0x58775c['model']=_[_0xf6b5('0x27')](db[_0xf6b5('0x55')][_0xf6b5('0x26')]);_0x58775c[_0xf6b5('0x28')]=_[_0xf6b5('0x27')](_0x469f25[_0xf6b5('0x28')]);_0x58775c[_0xf6b5('0x29')]=_[_0xf6b5('0x2a')](_0x58775c[_0xf6b5('0x2b')],_0x58775c['query']);_0x5add4a[_0xf6b5('0x2c')]=_[_0xf6b5('0x2a')](_0x58775c['model'],qs[_0xf6b5('0x2d')](_0x469f25[_0xf6b5('0x28')][_0xf6b5('0x2d')]));_0x5add4a[_0xf6b5('0x2c')]=_0x5add4a['attributes'][_0xf6b5('0x2e')]?_0x5add4a[_0xf6b5('0x2c')]:_0x58775c['model'];if(!_0x469f25[_0xf6b5('0x28')][_0xf6b5('0x2f')](_0xf6b5('0x30'))){_0x5add4a[_0xf6b5('0x31')]=qs[_0xf6b5('0x31')](_0x469f25[_0xf6b5('0x28')][_0xf6b5('0x31')]);_0x5add4a[_0xf6b5('0x16')]=qs['offset'](_0x469f25[_0xf6b5('0x28')][_0xf6b5('0x16')]);}_0x5add4a[_0xf6b5('0x32')]=qs[_0xf6b5('0x51')](_0x469f25[_0xf6b5('0x28')][_0xf6b5('0x51')]);_0x5add4a[_0xf6b5('0x33')]=qs[_0xf6b5('0x29')](_['pick'](_0x469f25[_0xf6b5('0x28')],_0x58775c[_0xf6b5('0x29')]));_0x5add4a[_0xf6b5('0x33')][_0xf6b5('0x56')]=_0x25271c['id'];if(_0x469f25[_0xf6b5('0x28')][_0xf6b5('0x35')]){_0x5add4a[_0xf6b5('0x33')]=_[_0xf6b5('0x36')](_0x5add4a[_0xf6b5('0x33')],{'$or':_[_0xf6b5('0x52')](_0x5add4a[_0xf6b5('0x2c')],function(_0x534308){var _0x4ba33b={};_0x4ba33b[_0x534308]={'$like':'%'+_0x469f25[_0xf6b5('0x28')][_0xf6b5('0x35')]+'%'};return _0x4ba33b;})});}_0x5add4a=_[_0xf6b5('0x36')]({},_0x5add4a,_0x469f25[_0xf6b5('0x41')]);return db[_0xf6b5('0x55')]['count']({'where':_0x5add4a['where']})['then'](function(_0x35b772){_0x9842c['count']=_0x35b772;if(_0x469f25[_0xf6b5('0x28')]['includeAll']){_0x5add4a[_0xf6b5('0x3b')]=[{'all':!![]}];}return db[_0xf6b5('0x55')]['findAll'](_0x5add4a);})[_0xf6b5('0x20')](function(_0x523601){_0x9842c[_0xf6b5('0x3d')]=_0x523601;return _0x9842c;});}})[_0xf6b5('0x20')](respondWithFilteredResult(_0x2ce951,_0x5add4a))['catch'](handleError(_0x2ce951,null));};exports[_0xf6b5('0x57')]=function(_0x377ce4,_0xb2d7f1,_0x1ab615){var _0x4e5e48={'raw':!![],'where':{}};var _0xfac3a3={};var _0x34441d={'count':0x0,'rows':[]};return db['Campaign'][_0xf6b5('0x54')]({'where':{'id':_0x377ce4[_0xf6b5('0x40')]['id']}})[_0xf6b5('0x20')](handleEntityNotFound(_0xb2d7f1,null))[_0xf6b5('0x20')](function(_0x5589af){if(_0x5589af){_0xfac3a3['model']=_['keys'](db[_0xf6b5('0x58')][_0xf6b5('0x26')]);_0xfac3a3['query']=_[_0xf6b5('0x27')](_0x377ce4[_0xf6b5('0x28')]);_0xfac3a3[_0xf6b5('0x29')]=_[_0xf6b5('0x2a')](_0xfac3a3[_0xf6b5('0x2b')],_0xfac3a3[_0xf6b5('0x28')]);_0x4e5e48[_0xf6b5('0x2c')]=_[_0xf6b5('0x2a')](_0xfac3a3[_0xf6b5('0x2b')],qs[_0xf6b5('0x2d')](_0x377ce4[_0xf6b5('0x28')][_0xf6b5('0x2d')]));_0x4e5e48[_0xf6b5('0x2c')]=_0x4e5e48[_0xf6b5('0x2c')]['length']?_0x4e5e48[_0xf6b5('0x2c')]:_0xfac3a3[_0xf6b5('0x2b')];if(!_0x377ce4[_0xf6b5('0x28')][_0xf6b5('0x2f')](_0xf6b5('0x30'))){_0x4e5e48['limit']=qs[_0xf6b5('0x31')](_0x377ce4[_0xf6b5('0x28')][_0xf6b5('0x31')]);_0x4e5e48[_0xf6b5('0x16')]=qs[_0xf6b5('0x16')](_0x377ce4['query']['offset']);}_0x4e5e48[_0xf6b5('0x32')]=qs[_0xf6b5('0x51')](_0x377ce4[_0xf6b5('0x28')]['sort']);_0x4e5e48[_0xf6b5('0x33')]=qs['filters'](_['pick'](_0x377ce4[_0xf6b5('0x28')],_0xfac3a3[_0xf6b5('0x29')]));_0x4e5e48[_0xf6b5('0x33')][_0xf6b5('0x56')]=_0x5589af['id'];if(_0x377ce4[_0xf6b5('0x28')][_0xf6b5('0x35')]){_0x4e5e48[_0xf6b5('0x33')]=_[_0xf6b5('0x36')](_0x4e5e48[_0xf6b5('0x33')],{'$or':_[_0xf6b5('0x52')](_0x4e5e48[_0xf6b5('0x2c')],function(_0x3f9025){var _0x42df12={};_0x42df12[_0x3f9025]={'$like':'%'+_0x377ce4[_0xf6b5('0x28')][_0xf6b5('0x35')]+'%'};return _0x42df12;})});}_0x4e5e48=_[_0xf6b5('0x36')]({},_0x4e5e48,_0x377ce4[_0xf6b5('0x41')]);return db['CmHopperFinal'][_0xf6b5('0x15')]({'where':_0x4e5e48['where']})[_0xf6b5('0x20')](function(_0x4d5256){_0x34441d[_0xf6b5('0x15')]=_0x4d5256;if(_0x377ce4[_0xf6b5('0x28')][_0xf6b5('0x3a')]){_0x4e5e48[_0xf6b5('0x3b')]=[{'all':!![]}];}return db[_0xf6b5('0x58')][_0xf6b5('0x3c')](_0x4e5e48);})['then'](function(_0x21bf55){_0x34441d[_0xf6b5('0x3d')]=_0x21bf55;return _0x34441d;});}})['then'](respondWithFilteredResult(_0xb2d7f1,_0x4e5e48))[_0xf6b5('0x3e')](handleError(_0xb2d7f1,null));};exports[_0xf6b5('0x59')]=function(_0x3468e0,_0xa630e9,_0x4dac97){var _0x375b0c={'raw':!![],'where':{}};var _0x5226d4={};var _0x1baeea={'count':0x0,'rows':[]};return db[_0xf6b5('0x25')][_0xf6b5('0x54')]({'where':{'id':_0x3468e0[_0xf6b5('0x40')]['id']}})['then'](handleEntityNotFound(_0xa630e9,null))[_0xf6b5('0x20')](function(_0x3f742b){if(_0x3f742b){_0x5226d4['model']=_[_0xf6b5('0x27')](db['CmHopperBlack']['rawAttributes']);_0x5226d4[_0xf6b5('0x28')]=_[_0xf6b5('0x27')](_0x3468e0['query']);_0x5226d4[_0xf6b5('0x29')]=_[_0xf6b5('0x2a')](_0x5226d4[_0xf6b5('0x2b')],_0x5226d4['query']);_0x375b0c['attributes']=_['intersection'](_0x5226d4[_0xf6b5('0x2b')],qs['fields'](_0x3468e0[_0xf6b5('0x28')][_0xf6b5('0x2d')]));_0x375b0c[_0xf6b5('0x2c')]=_0x375b0c['attributes'][_0xf6b5('0x2e')]?_0x375b0c[_0xf6b5('0x2c')]:_0x5226d4[_0xf6b5('0x2b')];if(!_0x3468e0[_0xf6b5('0x28')]['hasOwnProperty']('nolimit')){_0x375b0c['limit']=qs[_0xf6b5('0x31')](_0x3468e0['query'][_0xf6b5('0x31')]);_0x375b0c['offset']=qs[_0xf6b5('0x16')](_0x3468e0[_0xf6b5('0x28')][_0xf6b5('0x16')]);}_0x375b0c['order']=qs['sort'](_0x3468e0['query'][_0xf6b5('0x51')]);_0x375b0c[_0xf6b5('0x33')]=qs[_0xf6b5('0x29')](_[_0xf6b5('0x34')](_0x3468e0['query'],_0x5226d4['filters']));_0x375b0c[_0xf6b5('0x33')]['CampaignId']=_0x3f742b['id'];if(_0x3468e0[_0xf6b5('0x28')][_0xf6b5('0x35')]){_0x375b0c[_0xf6b5('0x33')]=_[_0xf6b5('0x36')](_0x375b0c[_0xf6b5('0x33')],{'$or':_[_0xf6b5('0x52')](_0x375b0c[_0xf6b5('0x2c')],function(_0x15231e){var _0x16eeaf={};_0x16eeaf[_0x15231e]={'$like':'%'+_0x3468e0['query'][_0xf6b5('0x35')]+'%'};return _0x16eeaf;})});}_0x375b0c=_[_0xf6b5('0x36')]({},_0x375b0c,_0x3468e0['options']);return db[_0xf6b5('0x5a')][_0xf6b5('0x15')]({'where':_0x375b0c[_0xf6b5('0x33')]})['then'](function(_0x187ee3){_0x1baeea['count']=_0x187ee3;if(_0x3468e0['query'][_0xf6b5('0x3a')]){_0x375b0c['include']=[{'all':!![]}];}return db[_0xf6b5('0x5a')][_0xf6b5('0x3c')](_0x375b0c);})[_0xf6b5('0x20')](function(_0x5af961){_0x1baeea[_0xf6b5('0x3d')]=_0x5af961;return _0x1baeea;});}})[_0xf6b5('0x20')](respondWithFilteredResult(_0xa630e9,_0x375b0c))[_0xf6b5('0x3e')](handleError(_0xa630e9,null));};exports[_0xf6b5('0x5b')]=function(_0x3fe597,_0x49c3d4,_0x53409f){var _0x12254d={};var _0x1268a7={};var _0x1f6832;var _0x50ee71;return db['Campaign'][_0xf6b5('0x54')]({'where':{'id':_0x3fe597['params']['id']}})[_0xf6b5('0x20')](handleEntityNotFound(_0x49c3d4,null))[_0xf6b5('0x20')](function(_0x120a4e){if(_0x120a4e){_0x1f6832=_0x120a4e;_0x1268a7['model']=_['keys'](db[_0xf6b5('0x5c')][_0xf6b5('0x26')]);_0x1268a7['query']=_['keys'](_0x3fe597[_0xf6b5('0x28')]);_0x1268a7[_0xf6b5('0x29')]=_[_0xf6b5('0x2a')](_0x1268a7[_0xf6b5('0x2b')],_0x1268a7[_0xf6b5('0x28')]);_0x12254d['attributes']=_[_0xf6b5('0x2a')](_0x1268a7[_0xf6b5('0x2b')],qs[_0xf6b5('0x2d')](_0x3fe597[_0xf6b5('0x28')]['fields']));_0x12254d[_0xf6b5('0x2c')]=_0x12254d[_0xf6b5('0x2c')][_0xf6b5('0x2e')]?_0x12254d['attributes']:_0x1268a7['model'];_0x12254d[_0xf6b5('0x32')]=qs[_0xf6b5('0x51')](_0x3fe597[_0xf6b5('0x28')][_0xf6b5('0x51')]);_0x12254d[_0xf6b5('0x33')]=qs['filters'](_[_0xf6b5('0x34')](_0x3fe597[_0xf6b5('0x28')],_0x1268a7[_0xf6b5('0x29')]));if(_0x3fe597['query'][_0xf6b5('0x35')]){_0x12254d['where']=_[_0xf6b5('0x36')](_0x12254d['where'],{'$or':_[_0xf6b5('0x52')](_0x12254d['attributes'],function(_0x39c76d){var _0x27421f={};_0x27421f[_0x39c76d]={'$like':'%'+_0x3fe597[_0xf6b5('0x28')][_0xf6b5('0x35')]+'%'};return _0x27421f;})});}_0x12254d=_[_0xf6b5('0x36')]({},_0x12254d,_0x3fe597[_0xf6b5('0x41')]);return _0x1f6832[_0xf6b5('0x5b')](_0x12254d);}})[_0xf6b5('0x20')](function(_0x197745){if(_0x197745){_0x50ee71=_0x197745[_0xf6b5('0x2e')];if(!_0x3fe597[_0xf6b5('0x28')]['hasOwnProperty']('nolimit')){_0x12254d[_0xf6b5('0x31')]=qs['limit'](_0x3fe597[_0xf6b5('0x28')]['limit']);_0x12254d['offset']=qs[_0xf6b5('0x16')](_0x3fe597[_0xf6b5('0x28')][_0xf6b5('0x16')]);}return _0x1f6832['getLists'](_0x12254d);}})[_0xf6b5('0x20')](function(_0xaaae60){if(_0xaaae60){return _0xaaae60?{'count':_0x50ee71,'rows':_0xaaae60}:null;}})['then'](respondWithResult(_0x49c3d4,null))[_0xf6b5('0x3e')](handleError(_0x49c3d4,null));};exports[_0xf6b5('0x5d')]=function(_0x5e4734,_0x56c7ce,_0x4eacd5){var _0xccaddb,_0x81ae8b;return db['Campaign'][_0xf6b5('0x42')]({'where':{'id':_0x5e4734[_0xf6b5('0x40')]['id']}})[_0xf6b5('0x20')](handleEntityNotFound(_0x56c7ce,null))[_0xf6b5('0x20')](function(_0x34cd63){if(_0x34cd63){_0x81ae8b=_0x34cd63;return _0x34cd63[_0xf6b5('0x5d')](_0x5e4734[_0xf6b5('0x44')]['ids'],_[_0xf6b5('0x4e')](_0x5e4734['body'],['ids','id'])||{});}return null;})[_0xf6b5('0x5e')](function(_0x10e5fb){var _0x281d2b;_0xccaddb=_0x10e5fb||[];var _0x2d5d94=[];if(_0x10e5fb){for(var _0x57c5e3=0x0;_0x57c5e3<_0x10e5fb[_0xf6b5('0x2e')];_0x57c5e3+=0x1){var _0x311e69=_0x10e5fb[_0x57c5e3][_0xf6b5('0x1d')]({'plain':!![]});_0x81ae8b[_0xf6b5('0x5f')]=_0x5e4734[_0xf6b5('0x44')][_0xf6b5('0x5f')]?_0x5e4734[_0xf6b5('0x44')][_0xf6b5('0x5f')]:_0x81ae8b[_0xf6b5('0x5f')];switch(_0x81ae8b[_0xf6b5('0x5f')]){case _0xf6b5('0x60'):_0x281d2b=squel[_0xf6b5('0x61')]()['into']('cm_hopper')[_0xf6b5('0x62')]([_0xf6b5('0x63'),_0xf6b5('0x64'),_0xf6b5('0x65'),_0xf6b5('0x66'),_0xf6b5('0x56'),_0xf6b5('0x4d'),_0xf6b5('0x67')],squel[_0xf6b5('0x68')]()[_0xf6b5('0x39')]('phone','phone')[_0xf6b5('0x39')](_0xf6b5('0x69'),'scheduledAt')['field']('id','ContactId')[_0xf6b5('0x39')](_0x311e69[_0xf6b5('0x6a')][_0xf6b5('0x6b')](),_0xf6b5('0x66'))[_0xf6b5('0x39')](_0x5e4734[_0xf6b5('0x40')]['id'][_0xf6b5('0x6b')](),'CampaignId')[_0xf6b5('0x39')](_0xf6b5('0x69'),_0xf6b5('0x4d'))[_0xf6b5('0x39')](_0xf6b5('0x69'),_0xf6b5('0x67'))[_0xf6b5('0x6c')](_0xf6b5('0x6d'))[_0xf6b5('0x33')](_0xf6b5('0x6e'))[_0xf6b5('0x33')](_0xf6b5('0x6f'),_0x311e69[_0xf6b5('0x6a')]['toString']())[_0xf6b5('0x33')](_0xf6b5('0x70'))['where'](_0xf6b5('0x71'),squel[_0xf6b5('0x68')]()[_0xf6b5('0x39')]('COALESCE(calleridnum,\x27\x27)')['from']('cm_hopper_final')[_0xf6b5('0x33')](_0xf6b5('0x72'),_0x5e4734['params']['id'][_0xf6b5('0x6b')]()))[_0xf6b5('0x33')](_0xf6b5('0x71'),squel['select']()[_0xf6b5('0x39')](_0xf6b5('0x73'))[_0xf6b5('0x6c')]('cm_hopper')['where'](_0xf6b5('0x72'),_0x5e4734['params']['id']['toString']())))[_0xf6b5('0x6b')]();break;case'onlyIfOpen':_0x281d2b=squel[_0xf6b5('0x61')]()[_0xf6b5('0x74')]('cm_hopper')[_0xf6b5('0x62')]([_0xf6b5('0x63'),'scheduledAt',_0xf6b5('0x65'),_0xf6b5('0x66'),_0xf6b5('0x56'),_0xf6b5('0x4d'),_0xf6b5('0x67')],squel[_0xf6b5('0x68')]()['field'](_0xf6b5('0x63'),'phone')[_0xf6b5('0x39')](_0xf6b5('0x69'),_0xf6b5('0x64'))[_0xf6b5('0x39')]('id',_0xf6b5('0x65'))['field'](_0x311e69[_0xf6b5('0x6a')][_0xf6b5('0x6b')](),_0xf6b5('0x66'))[_0xf6b5('0x39')](_0x5e4734[_0xf6b5('0x40')]['id'][_0xf6b5('0x6b')](),_0xf6b5('0x56'))[_0xf6b5('0x39')](_0xf6b5('0x69'),_0xf6b5('0x4d'))[_0xf6b5('0x39')](_0xf6b5('0x69'),_0xf6b5('0x67'))[_0xf6b5('0x6c')]('cm_contacts')[_0xf6b5('0x33')](_0xf6b5('0x6e'))[_0xf6b5('0x33')](_0xf6b5('0x6f'),_0x311e69[_0xf6b5('0x6a')][_0xf6b5('0x6b')]())[_0xf6b5('0x33')](_0xf6b5('0x70'))[_0xf6b5('0x33')](_0xf6b5('0x71'),squel['select']()[_0xf6b5('0x39')]('COALESCE(phone,\x27\x27)')[_0xf6b5('0x6c')](_0xf6b5('0x75'))[_0xf6b5('0x33')](_0xf6b5('0x72'),_0x5e4734['params']['id']['toString']())))[_0xf6b5('0x6b')]();break;default:_0x281d2b=squel['insert']()['into']('cm_hopper')[_0xf6b5('0x62')]([_0xf6b5('0x63'),_0xf6b5('0x64'),_0xf6b5('0x65'),'ListId',_0xf6b5('0x56'),_0xf6b5('0x4d'),_0xf6b5('0x67')],squel[_0xf6b5('0x68')]()[_0xf6b5('0x39')](_0xf6b5('0x63'),_0xf6b5('0x63'))[_0xf6b5('0x39')](_0xf6b5('0x69'),'scheduledAt')[_0xf6b5('0x39')]('id',_0xf6b5('0x65'))['field'](_0x311e69['CmListId'][_0xf6b5('0x6b')](),_0xf6b5('0x66'))[_0xf6b5('0x39')](_0x5e4734[_0xf6b5('0x40')]['id'][_0xf6b5('0x6b')](),_0xf6b5('0x56'))['field'](_0xf6b5('0x69'),_0xf6b5('0x4d'))['field']('NOW()',_0xf6b5('0x67'))['from'](_0xf6b5('0x6d'))[_0xf6b5('0x33')](_0xf6b5('0x6e'))[_0xf6b5('0x33')]('ListId\x20=\x20?',_0x311e69['CmListId'][_0xf6b5('0x6b')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0xf6b5('0x6b')]();}_0x2d5d94[_0xf6b5('0x76')](db[_0xf6b5('0x77')][_0xf6b5('0x28')](_0x281d2b));}return BPromise[_0xf6b5('0x78')](_0x2d5d94);}})['then'](function(){return _0xccaddb;})[_0xf6b5('0x20')](respondWithResult(_0x56c7ce,null))['catch'](handleError(_0x56c7ce,null));};exports[_0xf6b5('0x79')]=function(_0x40cbb7,_0x1050f2,_0x291bb0){var _0x31dced;return db[_0xf6b5('0x25')][_0xf6b5('0x42')]({'where':{'id':_0x40cbb7['params']['id']}})[_0xf6b5('0x20')](handleEntityNotFound(_0x1050f2,null))[_0xf6b5('0x20')](function(_0x2fdb78){if(_0x2fdb78){return _0x2fdb78['removeLists'](_0x40cbb7[_0xf6b5('0x28')]['ids']);}})[_0xf6b5('0x20')](function(_0x2876cd){if(_0x2876cd){_0x31dced=_0x2876cd;return db[_0xf6b5('0x50')][_0xf6b5('0x1c')]({'where':{'ListId':_0x40cbb7[_0xf6b5('0x28')][_0xf6b5('0x7a')],'CampaignId':_0x40cbb7[_0xf6b5('0x40')]['id']}})['then'](function(){return _0x31dced;});}})[_0xf6b5('0x20')](respondWithStatusCode(_0x1050f2,null))[_0xf6b5('0x3e')](handleError(_0x1050f2,null));};exports[_0xf6b5('0x7b')]=function(_0x207103,_0x2fe99e,_0x18b3d1){var _0x278668={'raw':!![],'where':{}};var _0x3af37b={};var _0x56236b={'count':0x0,'rows':[]};return db[_0xf6b5('0x25')]['findOne']({'where':{'id':_0x207103[_0xf6b5('0x40')]['id']}})[_0xf6b5('0x20')](handleEntityNotFound(_0x2fe99e,null))[_0xf6b5('0x20')](function(_0xfebfe2){if(_0xfebfe2){_0x3af37b['model']=_[_0xf6b5('0x27')](db[_0xf6b5('0x5c')][_0xf6b5('0x26')]);_0x3af37b[_0xf6b5('0x28')]=_[_0xf6b5('0x27')](_0x207103['query']);_0x3af37b[_0xf6b5('0x29')]=_['intersection'](_0x3af37b[_0xf6b5('0x2b')],_0x3af37b[_0xf6b5('0x28')]);_0x278668[_0xf6b5('0x2c')]=_[_0xf6b5('0x2a')](_0x3af37b[_0xf6b5('0x2b')],qs[_0xf6b5('0x2d')](_0x207103[_0xf6b5('0x28')][_0xf6b5('0x2d')]));_0x278668[_0xf6b5('0x2c')]=_0x278668[_0xf6b5('0x2c')][_0xf6b5('0x2e')]?_0x278668[_0xf6b5('0x2c')]:_0x3af37b[_0xf6b5('0x2b')];if(!_0x207103[_0xf6b5('0x28')][_0xf6b5('0x2f')](_0xf6b5('0x30'))){_0x278668['limit']=qs[_0xf6b5('0x31')](_0x207103['query'][_0xf6b5('0x31')]);_0x278668[_0xf6b5('0x16')]=qs[_0xf6b5('0x16')](_0x207103[_0xf6b5('0x28')][_0xf6b5('0x16')]);}_0x278668[_0xf6b5('0x32')]=qs[_0xf6b5('0x51')](_0x207103[_0xf6b5('0x28')][_0xf6b5('0x51')]);_0x278668['where']=qs[_0xf6b5('0x29')](_[_0xf6b5('0x34')](_0x207103[_0xf6b5('0x28')],_0x3af37b[_0xf6b5('0x29')]));_0x278668[_0xf6b5('0x33')][_0xf6b5('0x56')]=_0xfebfe2['id'];if(_0x207103['query']['filter']){_0x278668[_0xf6b5('0x33')]=_['merge'](_0x278668[_0xf6b5('0x33')],{'$or':_[_0xf6b5('0x52')](_0x278668['attributes'],function(_0x33a1d1){var _0x583970={};_0x583970[_0x33a1d1]={'$like':'%'+_0x207103[_0xf6b5('0x28')]['filter']+'%'};return _0x583970;})});}_0x278668=_['merge']({},_0x278668,_0x207103[_0xf6b5('0x41')]);return db['CmList'][_0xf6b5('0x15')]({'where':_0x278668[_0xf6b5('0x33')]})['then'](function(_0x2a0c9c){_0x56236b[_0xf6b5('0x15')]=_0x2a0c9c;if(_0x207103[_0xf6b5('0x28')][_0xf6b5('0x3a')]){_0x278668[_0xf6b5('0x3b')]=[{'all':!![]}];}return db[_0xf6b5('0x5c')][_0xf6b5('0x3c')](_0x278668);})['then'](function(_0x36362c){_0x56236b['rows']=_0x36362c;return _0x56236b;});}})['then'](respondWithFilteredResult(_0x2fe99e,_0x278668))['catch'](handleError(_0x2fe99e,null));};exports[_0xf6b5('0x7c')]=function(_0x441b70,_0x573abe,_0x254199){var _0x2b7218,_0x3b0055;return db[_0xf6b5('0x25')]['find']({'where':{'id':_0x441b70[_0xf6b5('0x40')]['id']}})[_0xf6b5('0x20')](handleEntityNotFound(_0x573abe,null))[_0xf6b5('0x20')](function(_0x4562d1){if(_0x4562d1){_0x3b0055=_0x4562d1;return _0x4562d1[_0xf6b5('0x7c')](_0x441b70[_0xf6b5('0x44')]['ids'],_[_0xf6b5('0x4e')](_0x441b70[_0xf6b5('0x44')],[_0xf6b5('0x7a'),'id'])||{});}return null;})[_0xf6b5('0x5e')](function(_0x2497d6){var _0x48daef;_0x2b7218=_0x2497d6||[];var _0x558c81=[];if(_0x2497d6){for(var _0x16fbf2=0x0;_0x16fbf2<_0x2497d6[_0xf6b5('0x2e')];_0x16fbf2+=0x1){var _0x53b855=_0x2497d6[_0x16fbf2]['get']({'plain':!![]});_0x48daef=squel['insert']()['into'](_0xf6b5('0x7d'))[_0xf6b5('0x62')]([_0xf6b5('0x63'),'ContactId',_0xf6b5('0x66'),'CampaignId',_0xf6b5('0x4d'),'updatedAt'],squel[_0xf6b5('0x68')]()[_0xf6b5('0x39')](_0xf6b5('0x63'),'phone')[_0xf6b5('0x39')]('id',_0xf6b5('0x65'))[_0xf6b5('0x39')](_0x53b855[_0xf6b5('0x6a')][_0xf6b5('0x6b')](),_0xf6b5('0x66'))[_0xf6b5('0x39')](_0x441b70[_0xf6b5('0x40')]['id'][_0xf6b5('0x6b')](),'CampaignId')[_0xf6b5('0x39')](_0xf6b5('0x69'),_0xf6b5('0x4d'))[_0xf6b5('0x39')](_0xf6b5('0x69'),_0xf6b5('0x67'))['from'](_0xf6b5('0x6d'))['where']('deletedAt\x20IS\x20NULL')[_0xf6b5('0x33')](_0xf6b5('0x6f'),_0x53b855[_0xf6b5('0x6a')][_0xf6b5('0x6b')]())['where'](_0xf6b5('0x70')))[_0xf6b5('0x6b')]();_0x558c81[_0xf6b5('0x76')](db[_0xf6b5('0x77')]['query'](_0x48daef));}return BPromise['all'](_0x558c81);}})[_0xf6b5('0x20')](function(){return _0x2b7218;})[_0xf6b5('0x20')](respondWithResult(_0x573abe,null))[_0xf6b5('0x3e')](handleError(_0x573abe,null));};exports['removeBlackLists']=function(_0x4fa559,_0x234b94,_0xe63632){var _0x20108a;return db['Campaign'][_0xf6b5('0x42')]({'where':{'id':_0x4fa559[_0xf6b5('0x40')]['id']}})['then'](handleEntityNotFound(_0x234b94,null))[_0xf6b5('0x20')](function(_0x1ef6bb){if(_0x1ef6bb){return _0x1ef6bb[_0xf6b5('0x7e')](_0x4fa559[_0xf6b5('0x28')][_0xf6b5('0x7a')]);}})['then'](function(_0x206411){if(_0x206411){_0x20108a=_0x206411;return db[_0xf6b5('0x5a')]['destroy']({'where':{'ListId':_0x4fa559['query'][_0xf6b5('0x7a')],'CampaignId':_0x4fa559['params']['id']}})[_0xf6b5('0x20')](function(){return _0x20108a;});}})['then'](respondWithStatusCode(_0x234b94,null))[_0xf6b5('0x3e')](handleError(_0x234b94,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index cfb90a1..d637cc9 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 _0x159a=['util','../../config/logger','api','moment','request-promise','./campaign.attributes','exports','Campaign'];(function(_0x2731f0,_0x126b1b){var _0x36a180=function(_0x44d1a9){while(--_0x44d1a9){_0x2731f0['push'](_0x2731f0['shift']());}};_0x36a180(++_0x126b1b);}(_0x159a,0x180));var _0xa159=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0x159a[_0x49d19d];return _0x4ebef1;};'use strict';var _=require('lodash');var util=require(_0xa159('0x0'));var logger=require(_0xa159('0x1'))(_0xa159('0x2'));var moment=require(_0xa159('0x3'));var BPromise=require('bluebird');var rp=require(_0xa159('0x4'));var attributes=require(_0xa159('0x5'));module[_0xa159('0x6')]=function(_0x5cbb91,_0x450227){return _0x5cbb91['define'](_0xa159('0x7'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9955=['define','Campaign','campaigns','lodash','util','../../config/logger','moment','bluebird','request-promise','./campaign.attributes','exports'];(function(_0x402c5e,_0x5d91bf){var _0x493c93=function(_0x5f48f9){while(--_0x5f48f9){_0x402c5e['push'](_0x402c5e['shift']());}};_0x493c93(++_0x5d91bf);}(_0x9955,0x7c));var _0x5995=function(_0x4785f7,_0xebe6a2){_0x4785f7=_0x4785f7-0x0;var _0x4f5d1b=_0x9955[_0x4785f7];return _0x4f5d1b;};'use strict';var _=require(_0x5995('0x0'));var util=require(_0x5995('0x1'));var logger=require(_0x5995('0x2'))('api');var moment=require(_0x5995('0x3'));var BPromise=require(_0x5995('0x4'));var rp=require(_0x5995('0x5'));var attributes=require(_0x5995('0x6'));module[_0x5995('0x7')]=function(_0x2beecd,_0xcb5e7d){return _0x2beecd[_0x5995('0x8')](_0x5995('0x9'),attributes,{'tableName':_0x5995('0xa'),'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 129f6a7..b037f55 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 _0xbfd0=['error','code','Campaign,\x20%s,\x20%s','message','info','result','catch','GetCampaign','findAll','options','raw','where','attributes','limit','include','map','model','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x35fff3,_0x14c28f){var _0x42b127=function(_0x4e556b){while(--_0x4e556b){_0x35fff3['push'](_0x35fff3['shift']());}};_0x42b127(++_0x14c28f);}(_0xbfd0,0x78));var _0x0bfd=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xbfd0[_0x1f36bb];return _0xaf97fa;};'use strict';var _=require(_0x0bfd('0x0'));var util=require(_0x0bfd('0x1'));var moment=require(_0x0bfd('0x2'));var BPromise=require(_0x0bfd('0x3'));var rs=require(_0x0bfd('0x4'));var fs=require('fs');var Redis=require(_0x0bfd('0x5'));var db=require(_0x0bfd('0x6'))['db'];var utils=require(_0x0bfd('0x7'));var logger=require('../../config/logger')(_0x0bfd('0x8'));var config=require(_0x0bfd('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0bfd('0xa')][_0x0bfd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33be01,_0x14c1fc,_0x108ffc){return new BPromise(function(_0x42600c,_0x372d8f){return client['request'](_0x33be01,_0x108ffc)['then'](function(_0xee3fe){logger['info']('Campaign,\x20%s,\x20%s',_0x14c1fc,_0x0bfd('0xc'));logger[_0x0bfd('0xd')](_0x0bfd('0xe'),_0x14c1fc,_0x0bfd('0xc'),JSON[_0x0bfd('0xf')](_0xee3fe));if(_0xee3fe[_0x0bfd('0x10')]){if(_0xee3fe[_0x0bfd('0x10')][_0x0bfd('0x11')]===0x1f4){logger[_0x0bfd('0x10')](_0x0bfd('0x12'),_0x14c1fc,_0xee3fe[_0x0bfd('0x10')][_0x0bfd('0x13')]);return _0x372d8f(_0xee3fe[_0x0bfd('0x10')][_0x0bfd('0x13')]);}logger['error'](_0x0bfd('0x12'),_0x14c1fc,_0xee3fe[_0x0bfd('0x10')]['message']);return _0x42600c(_0xee3fe['error'][_0x0bfd('0x13')]);}else{logger[_0x0bfd('0x14')]('Campaign,\x20%s,\x20%s',_0x14c1fc,_0x0bfd('0xc'));_0x42600c(_0xee3fe[_0x0bfd('0x15')][_0x0bfd('0x13')]);}})[_0x0bfd('0x16')](function(_0x297dd4){logger[_0x0bfd('0x10')](_0x0bfd('0x12'),_0x14c1fc,_0x297dd4);_0x372d8f(_0x297dd4);});});}exports[_0x0bfd('0x17')]=function(_0x19f576){var _0x4181e1=this;return new Promise(function(_0x871be0,_0xcf1de8){return db['Campaign'][_0x0bfd('0x18')]({'raw':_0x19f576[_0x0bfd('0x19')]?_0x19f576[_0x0bfd('0x19')][_0x0bfd('0x1a')]===undefined?!![]:![]:!![],'where':_0x19f576['options']?_0x19f576[_0x0bfd('0x19')][_0x0bfd('0x1b')]||null:null,'attributes':_0x19f576[_0x0bfd('0x19')]?_0x19f576['options'][_0x0bfd('0x1c')]||null:null,'limit':_0x19f576[_0x0bfd('0x19')]?_0x19f576[_0x0bfd('0x19')][_0x0bfd('0x1d')]||null:null,'include':_0x19f576[_0x0bfd('0x19')]?_0x19f576[_0x0bfd('0x19')][_0x0bfd('0x1e')]?_[_0x0bfd('0x1f')](_0x19f576[_0x0bfd('0x19')][_0x0bfd('0x1e')],function(_0x43d9af){return{'model':db[_0x43d9af['model']],'as':_0x43d9af['as'],'attributes':_0x43d9af[_0x0bfd('0x1c')],'include':_0x43d9af['include']?_[_0x0bfd('0x1f')](_0x43d9af[_0x0bfd('0x1e')],function(_0x391663){return{'model':db[_0x391663[_0x0bfd('0x20')]],'as':_0x391663['as'],'attributes':_0x391663[_0x0bfd('0x1c')],'include':_0x391663[_0x0bfd('0x1e')]?_[_0x0bfd('0x1f')](_0x391663[_0x0bfd('0x1e')],function(_0x33fd38){return{'model':db[_0x33fd38[_0x0bfd('0x20')]],'as':_0x33fd38['as'],'attributes':_0x33fd38[_0x0bfd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0bfd('0x21')](function(_0x45c78a){logger[_0x0bfd('0x14')]('GetCampaign',_0x19f576);logger[_0x0bfd('0xd')](_0x0bfd('0x17'),_0x19f576,JSON[_0x0bfd('0xf')](_0x45c78a));_0x871be0(_0x45c78a);})[_0x0bfd('0x16')](function(_0x45ed0a){logger['error'](_0x0bfd('0x17'),_0x45ed0a['message'],_0x19f576);_0xcf1de8(_0x4181e1[_0x0bfd('0x10')](0x1f4,_0x45ed0a[_0x0bfd('0x13')]));});});}; \ No newline at end of file +var _0x1005=['debug','request\x20sent','stringify','code','error','message','result','GetCampaign','Campaign','options','where','attributes','limit','include','map','model','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','Campaign,\x20%s,\x20%s'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x1005,0xa7));var _0x5100=function(_0x29a882,_0x506c37){_0x29a882=_0x29a882-0x0;var _0x489691=_0x1005[_0x29a882];return _0x489691;};'use strict';var _=require('lodash');var util=require(_0x5100('0x0'));var moment=require(_0x5100('0x1'));var BPromise=require(_0x5100('0x2'));var rs=require(_0x5100('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5100('0x4'))['db'];var utils=require(_0x5100('0x5'));var logger=require(_0x5100('0x6'))('rpc');var config=require(_0x5100('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5100('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cd5a1,_0x2115b0,_0x4022a9){return new BPromise(function(_0x5ba005,_0x3ff549){return client[_0x5100('0x9')](_0x3cd5a1,_0x4022a9)[_0x5100('0xa')](function(_0x2dd0df){logger[_0x5100('0xb')](_0x5100('0xc'),_0x2115b0,'request\x20sent');logger[_0x5100('0xd')]('Campaign,\x20%s,\x20%s,\x20%s',_0x2115b0,_0x5100('0xe'),JSON[_0x5100('0xf')](_0x2dd0df));if(_0x2dd0df['error']){if(_0x2dd0df['error'][_0x5100('0x10')]===0x1f4){logger[_0x5100('0x11')]('Campaign,\x20%s,\x20%s',_0x2115b0,_0x2dd0df[_0x5100('0x11')][_0x5100('0x12')]);return _0x3ff549(_0x2dd0df[_0x5100('0x11')]['message']);}logger['error'](_0x5100('0xc'),_0x2115b0,_0x2dd0df[_0x5100('0x11')][_0x5100('0x12')]);return _0x5ba005(_0x2dd0df['error']['message']);}else{logger[_0x5100('0xb')](_0x5100('0xc'),_0x2115b0,_0x5100('0xe'));_0x5ba005(_0x2dd0df[_0x5100('0x13')][_0x5100('0x12')]);}})['catch'](function(_0x514ad4){logger[_0x5100('0x11')](_0x5100('0xc'),_0x2115b0,_0x514ad4);_0x3ff549(_0x514ad4);});});}exports[_0x5100('0x14')]=function(_0x2d421d){var _0x917a30=this;return new Promise(function(_0x23df08,_0x20400c){return db[_0x5100('0x15')]['findAll']({'raw':_0x2d421d[_0x5100('0x16')]?_0x2d421d[_0x5100('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2d421d[_0x5100('0x16')]?_0x2d421d['options'][_0x5100('0x17')]||null:null,'attributes':_0x2d421d[_0x5100('0x16')]?_0x2d421d[_0x5100('0x16')][_0x5100('0x18')]||null:null,'limit':_0x2d421d['options']?_0x2d421d[_0x5100('0x16')][_0x5100('0x19')]||null:null,'include':_0x2d421d['options']?_0x2d421d[_0x5100('0x16')][_0x5100('0x1a')]?_[_0x5100('0x1b')](_0x2d421d[_0x5100('0x16')][_0x5100('0x1a')],function(_0x5bf3b3){return{'model':db[_0x5bf3b3['model']],'as':_0x5bf3b3['as'],'attributes':_0x5bf3b3[_0x5100('0x18')],'include':_0x5bf3b3[_0x5100('0x1a')]?_['map'](_0x5bf3b3['include'],function(_0x245515){return{'model':db[_0x245515[_0x5100('0x1c')]],'as':_0x245515['as'],'attributes':_0x245515[_0x5100('0x18')],'include':_0x245515[_0x5100('0x1a')]?_[_0x5100('0x1b')](_0x245515['include'],function(_0x239b2){return{'model':db[_0x239b2['model']],'as':_0x239b2['as'],'attributes':_0x239b2[_0x5100('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5100('0xa')](function(_0x5b4a87){logger[_0x5100('0xb')](_0x5100('0x14'),_0x2d421d);logger[_0x5100('0xd')]('GetCampaign',_0x2d421d,JSON['stringify'](_0x5b4a87));_0x23df08(_0x5b4a87);})[_0x5100('0x1d')](function(_0x4f0ead){logger[_0x5100('0x11')](_0x5100('0x14'),_0x4f0ead[_0x5100('0x12')],_0x2d421d);_0x20400c(_0x917a30[_0x5100('0x11')](0x1f4,_0x4f0ead[_0x5100('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 0b508aa..17dc6ef 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 _0x3671=['/:id','delete','removeBlackLists','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./campaign.controller','isAuthenticated','index','get','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addBlackLists','put'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3671,0x19a));var _0x1367=function(_0x49873f,_0xebd2b8){_0x49873f=_0x49873f-0x0;var _0x518b6d=_0x3671[_0x49873f];return _0x518b6d;};'use strict';var multer=require(_0x1367('0x0'));var util=require(_0x1367('0x1'));var path=require(_0x1367('0x2'));var timeout=require(_0x1367('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x1367('0x4'));var interaction=require(_0x1367('0x5'));var config=require('../../config/environment');var controller=require(_0x1367('0x6'));router['get']('/',auth[_0x1367('0x7')](),controller[_0x1367('0x8')]);router[_0x1367('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x1367('0xa')]);router[_0x1367('0x9')](_0x1367('0xb'),auth['isAuthenticated'](),controller['getHoppers']);router['get'](_0x1367('0xc'),auth[_0x1367('0x7')](),controller[_0x1367('0xd')]);router[_0x1367('0x9')](_0x1367('0xe'),auth[_0x1367('0x7')](),controller[_0x1367('0xf')]);router[_0x1367('0x9')](_0x1367('0x10'),auth[_0x1367('0x7')](),controller['getHopperBlacks']);router[_0x1367('0x9')](_0x1367('0x11'),auth[_0x1367('0x7')](),controller['getLists']);router['get'](_0x1367('0x12'),auth[_0x1367('0x7')](),controller[_0x1367('0x13')]);router['post']('/',auth[_0x1367('0x7')](),controller['create']);router[_0x1367('0x14')](_0x1367('0x15'),auth[_0x1367('0x7')](),controller[_0x1367('0x16')]);router['post'](_0x1367('0x11'),auth['isAuthenticated'](),controller['addLists']);router[_0x1367('0x14')](_0x1367('0x12'),auth['isAuthenticated'](),controller[_0x1367('0x17')]);router[_0x1367('0x18')](_0x1367('0x19'),auth[_0x1367('0x7')](),controller['update']);router[_0x1367('0x1a')](_0x1367('0x19'),auth[_0x1367('0x7')](),controller['destroy']);router[_0x1367('0x1a')](_0x1367('0x11'),auth[_0x1367('0x7')](),controller['removeLists']);router['delete'](_0x1367('0x12'),auth[_0x1367('0x7')](),controller[_0x1367('0x1b')]);module[_0x1367('0x1c')]=router; \ No newline at end of file +var _0x3ffa=['addLists','update','destroy','removeLists','delete','util','express','Router','../../config/environment','./campaign.controller','index','/:id','isAuthenticated','show','get','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','post','/:id/clone'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x3ffa,0x14a));var _0xa3ff=function(_0x4510ff,_0x5393a4){_0x4510ff=_0x4510ff-0x0;var _0x2e148d=_0x3ffa[_0x4510ff];return _0x2e148d;};'use strict';var multer=require('multer');var util=require(_0xa3ff('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa3ff('0x1'));var router=express[_0xa3ff('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa3ff('0x3'));var controller=require(_0xa3ff('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0xa3ff('0x5')]);router['get'](_0xa3ff('0x6'),auth[_0xa3ff('0x7')](),controller[_0xa3ff('0x8')]);router[_0xa3ff('0x9')](_0xa3ff('0xa'),auth[_0xa3ff('0x7')](),controller[_0xa3ff('0xb')]);router[_0xa3ff('0x9')](_0xa3ff('0xc'),auth[_0xa3ff('0x7')](),controller[_0xa3ff('0xd')]);router[_0xa3ff('0x9')](_0xa3ff('0xe'),auth[_0xa3ff('0x7')](),controller[_0xa3ff('0xf')]);router[_0xa3ff('0x9')]('/:id/hopper_black',auth[_0xa3ff('0x7')](),controller[_0xa3ff('0x10')]);router['get'](_0xa3ff('0x11'),auth[_0xa3ff('0x7')](),controller['getLists']);router[_0xa3ff('0x9')]('/:id/blacklists',auth[_0xa3ff('0x7')](),controller['getBlackLists']);router['post']('/',auth[_0xa3ff('0x7')](),controller['create']);router[_0xa3ff('0x12')](_0xa3ff('0x13'),auth[_0xa3ff('0x7')](),controller['clone']);router[_0xa3ff('0x12')]('/:id/lists',auth[_0xa3ff('0x7')](),controller[_0xa3ff('0x14')]);router['post']('/:id/blacklists',auth['isAuthenticated'](),controller['addBlackLists']);router['put'](_0xa3ff('0x6'),auth[_0xa3ff('0x7')](),controller[_0xa3ff('0x15')]);router['delete'](_0xa3ff('0x6'),auth[_0xa3ff('0x7')](),controller[_0xa3ff('0x16')]);router['delete']('/:id/lists',auth[_0xa3ff('0x7')](),controller[_0xa3ff('0x17')]);router[_0xa3ff('0x18')]('/:id/blacklists',auth[_0xa3ff('0x7')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 8d92b14..e838011 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 _0xd87c=['sequelize','exports','STRING','TEXT','VIRTUAL','key'];(function(_0x2123f7,_0x8c9b6a){var _0x4a6b0b=function(_0x2cb06e){while(--_0x2cb06e){_0x2123f7['push'](_0x2123f7['shift']());}};_0x4a6b0b(++_0x8c9b6a);}(_0xd87c,0x1c2));var _0xcd87=function(_0x52d2b4,_0x1d67fa){_0x52d2b4=_0x52d2b4-0x0;var _0x149ff5=_0xd87c[_0x52d2b4];return _0x149ff5;};'use strict';var Sequelize=require(_0xcd87('0x0'));module[_0xcd87('0x1')]={'key':{'type':Sequelize[_0xcd87('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xcd87('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xcd87('0x4')],'get':function(){return this['getDataValue'](_0xcd87('0x5'));}}}; \ No newline at end of file +var _0x205d=['key','sequelize','VIRTUAL'];(function(_0x91ed5c,_0xdb6b34){var _0x2387d8=function(_0x1a9d15){while(--_0x1a9d15){_0x91ed5c['push'](_0x91ed5c['shift']());}};_0x2387d8(++_0xdb6b34);}(_0x205d,0xdc));var _0xd205=function(_0xeb94a4,_0x166c7b){_0xeb94a4=_0xeb94a4-0x0;var _0x5a9285=_0x205d[_0xeb94a4];return _0x5a9285;};'use strict';var Sequelize=require(_0xd205('0x0'));module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xd205('0x1')],'get':function(){return this['getDataValue'](_0xd205('0x2'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index d2ead75..7223d57 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 _0xa403=['json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','get','end','error','stack','name','send','index','CannedAnswer','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','where','merge','map','type','key','field','options','includeAll','include','findAll','rows','show','params','find','catch','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','CannedAnswers','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','status'];(function(_0x3386fd,_0x8596f4){var _0x19e6f6=function(_0x4bd4ec){while(--_0x4bd4ec){_0x3386fd['push'](_0x3386fd['shift']());}};_0x19e6f6(++_0x8596f4);}(_0xa403,0xe8));var _0x3a40=function(_0x58c20f,_0x4cdb1b){_0x58c20f=_0x58c20f-0x0;var _0x3b0318=_0xa403[_0x58c20f];return _0x3b0318;};'use strict';var pdf=require(_0x3a40('0x0'));var emlformat=require(_0x3a40('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3a40('0x2'));var rp=require(_0x3a40('0x3'));var moment=require(_0x3a40('0x4'));var BPromise=require(_0x3a40('0x5'));var Mustache=require('mustache');var util=require(_0x3a40('0x6'));var path=require(_0x3a40('0x7'));var sox=require(_0x3a40('0x8'));var csv=require(_0x3a40('0x9'));var ejs=require(_0x3a40('0xa'));var fs=require('fs');var _=require(_0x3a40('0xb'));var squel=require(_0x3a40('0xc'));var crypto=require(_0x3a40('0xd'));var jsforce=require(_0x3a40('0xe'));var deskjs=require(_0x3a40('0xf'));var toCsv=require(_0x3a40('0x9'));var querystring=require(_0x3a40('0x10'));var Papa=require(_0x3a40('0x11'));var authService=require(_0x3a40('0x12'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x3a40('0x13'));var qs=require(_0x3a40('0x14'));var logger=require('../../config/logger')(_0x3a40('0x15'));var utils=require(_0x3a40('0x16'));var config=require(_0x3a40('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14667b,_0x5aeeaa){_0x5aeeaa=_0x5aeeaa||0xcc;return function(_0x28f8c5){if(_0x28f8c5){return _0x14667b[_0x3a40('0x18')](_0x5aeeaa);}return _0x14667b[_0x3a40('0x19')](_0x5aeeaa)['end']();};}function respondWithResult(_0x1fc0d6,_0x3890f9){_0x3890f9=_0x3890f9||0xc8;return function(_0xe30b53){if(_0xe30b53){return _0x1fc0d6[_0x3a40('0x19')](_0x3890f9)[_0x3a40('0x1a')](_0xe30b53);}};}function respondWithFilteredResult(_0x4b7465,_0x4c9a71){return function(_0x5cc9cc){if(_0x5cc9cc){var _0x2d3b18=_0x5cc9cc[_0x3a40('0x1b')],_0x4cf6b6=_0x4c9a71['offset'],_0x5cc144=_0x4c9a71[_0x3a40('0x1c')]+_0x4c9a71[_0x3a40('0x1d')],_0x47d302;if(_0x5cc144>=_0x2d3b18){_0x5cc144=_0x2d3b18;_0x47d302=0xc8;}else{_0x47d302=0xce;}_0x4b7465['status'](_0x47d302);return _0x4b7465['set'](_0x3a40('0x1e'),_0x4cf6b6+'-'+_0x5cc144+'/'+_0x2d3b18)[_0x3a40('0x1a')](_0x5cc9cc);}return null;};}function patchUpdates(_0xd6d4a4){return function(_0x521fa7){try{jsonpatch[_0x3a40('0x1f')](_0x521fa7,_0xd6d4a4,!![]);}catch(_0x435a57){return BPromise[_0x3a40('0x20')](_0x435a57);}return _0x521fa7['save']();};}function saveUpdates(_0xe6307,_0x417b17){return function(_0x3dc026){if(_0x3dc026){return _0x3dc026[_0x3a40('0x21')](_0xe6307)[_0x3a40('0x22')](function(_0x5c7cab){return _0x5c7cab;});}return null;};}function removeEntity(_0x228cf5,_0x34c8c6){return function(_0x373c81){if(_0x373c81){return _0x373c81[_0x3a40('0x23')]()[_0x3a40('0x22')](function(){var _0x52fbf9=_0x373c81[_0x3a40('0x24')]({'plain':!![]});var _0x16dc1a='CannedAnswers';return db['UserProfileResource']['destroy']({'where':{'type':_0x16dc1a,'resourceId':_0x52fbf9['id']}})['then'](function(){return _0x373c81;});})[_0x3a40('0x22')](function(){_0x228cf5[_0x3a40('0x19')](0xcc)[_0x3a40('0x25')]();});}};}function handleEntityNotFound(_0x37821b,_0x4d64a9){return function(_0x18e37a){if(!_0x18e37a){_0x37821b[_0x3a40('0x18')](0x194);}return _0x18e37a;};}function handleError(_0x7d7815,_0x4edd7f){_0x4edd7f=_0x4edd7f||0x1f4;return function(_0x408b24){logger[_0x3a40('0x26')](_0x408b24[_0x3a40('0x27')]);if(_0x408b24[_0x3a40('0x28')]){delete _0x408b24[_0x3a40('0x28')];}_0x7d7815[_0x3a40('0x19')](_0x4edd7f)[_0x3a40('0x29')](_0x408b24);};}exports[_0x3a40('0x2a')]=function(_0x1b2b5f,_0x2940ba){var _0x3acd6a={},_0x1570bb={},_0x148ee2={'count':0x0,'rows':[]};var _0x5c2d0a=db[_0x3a40('0x2b')][_0x3a40('0x2c')];_0x1570bb[_0x3a40('0x2d')]=_['keys'](_0x5c2d0a);_0x1570bb[_0x3a40('0x2e')]=_[_0x3a40('0x2f')](_0x1b2b5f['query']);_0x1570bb[_0x3a40('0x30')]=_['intersection'](_0x1570bb[_0x3a40('0x2d')],_0x1570bb[_0x3a40('0x2e')]);_0x3acd6a[_0x3a40('0x31')]=_[_0x3a40('0x32')](_0x1570bb[_0x3a40('0x2d')],qs[_0x3a40('0x33')](_0x1b2b5f[_0x3a40('0x2e')]['fields']));_0x3acd6a['attributes']=_0x3acd6a[_0x3a40('0x31')][_0x3a40('0x34')]?_0x3acd6a[_0x3a40('0x31')]:_0x1570bb[_0x3a40('0x2d')];if(!_0x1b2b5f[_0x3a40('0x2e')][_0x3a40('0x35')]('nolimit')){_0x3acd6a['limit']=qs[_0x3a40('0x1d')](_0x1b2b5f['query'][_0x3a40('0x1d')]);_0x3acd6a[_0x3a40('0x1c')]=qs[_0x3a40('0x1c')](_0x1b2b5f[_0x3a40('0x2e')][_0x3a40('0x1c')]);}_0x3acd6a[_0x3a40('0x36')]=qs[_0x3a40('0x37')](_0x1b2b5f[_0x3a40('0x2e')][_0x3a40('0x37')]);_0x3acd6a['where']=qs[_0x3a40('0x30')](_['pick'](_0x1b2b5f[_0x3a40('0x2e')],_0x1570bb['filters']));if(_0x1b2b5f[_0x3a40('0x2e')][_0x3a40('0x38')]){_0x3acd6a[_0x3a40('0x39')]=_[_0x3a40('0x3a')](_0x3acd6a['where'],{'$or':_[_0x3a40('0x3b')](_0x5c2d0a,function(_0x23ef8e){if(_0x23ef8e[_0x3a40('0x3c')][_0x3a40('0x3d')]!=='VIRTUAL'){var _0x3a0ca3={};_0x3a0ca3[_0x23ef8e[_0x3a40('0x3e')]]={'$like':'%'+_0x1b2b5f[_0x3a40('0x2e')]['filter']+'%'};return _0x3a0ca3;}})});}_0x3acd6a=_['merge']({},_0x3acd6a,_0x1b2b5f[_0x3a40('0x3f')]);var _0x443b0e={'where':_0x3acd6a[_0x3a40('0x39')]};return db['CannedAnswer'][_0x3a40('0x1b')](_0x443b0e)[_0x3a40('0x22')](function(_0x28edb2){_0x148ee2[_0x3a40('0x1b')]=_0x28edb2;if(_0x1b2b5f['query'][_0x3a40('0x40')]){_0x3acd6a[_0x3a40('0x41')]=[{'all':!![]}];}return db['CannedAnswer'][_0x3a40('0x42')](_0x3acd6a);})[_0x3a40('0x22')](function(_0x2651a5){_0x148ee2[_0x3a40('0x43')]=_0x2651a5;return _0x148ee2;})[_0x3a40('0x22')](respondWithFilteredResult(_0x2940ba,_0x3acd6a))['catch'](handleError(_0x2940ba,null));};exports[_0x3a40('0x44')]=function(_0x45425b,_0x4fc963){var _0x30468c={'raw':!![],'where':{'id':_0x45425b[_0x3a40('0x45')]['id']}},_0x5a9ab0={};_0x5a9ab0[_0x3a40('0x2d')]=_[_0x3a40('0x2f')](db[_0x3a40('0x2b')][_0x3a40('0x2c')]);_0x5a9ab0[_0x3a40('0x2e')]=_[_0x3a40('0x2f')](_0x45425b[_0x3a40('0x2e')]);_0x5a9ab0[_0x3a40('0x30')]=_[_0x3a40('0x32')](_0x5a9ab0['model'],_0x5a9ab0[_0x3a40('0x2e')]);_0x30468c[_0x3a40('0x31')]=_[_0x3a40('0x32')](_0x5a9ab0[_0x3a40('0x2d')],qs[_0x3a40('0x33')](_0x45425b['query'][_0x3a40('0x33')]));_0x30468c[_0x3a40('0x31')]=_0x30468c[_0x3a40('0x31')]['length']?_0x30468c[_0x3a40('0x31')]:_0x5a9ab0[_0x3a40('0x2d')];if(_0x45425b['query'][_0x3a40('0x40')]){_0x30468c['include']=[{'all':!![]}];}_0x30468c=_[_0x3a40('0x3a')]({},_0x30468c,_0x45425b[_0x3a40('0x3f')]);return db[_0x3a40('0x2b')][_0x3a40('0x46')](_0x30468c)['then'](handleEntityNotFound(_0x4fc963,null))[_0x3a40('0x22')](respondWithResult(_0x4fc963,null))[_0x3a40('0x47')](handleError(_0x4fc963,null));};exports[_0x3a40('0x21')]=function(_0x1e26c3,_0x503d48){if(_0x1e26c3[_0x3a40('0x48')]['id']){delete _0x1e26c3['body']['id'];}return db['CannedAnswer']['find']({'where':{'id':_0x1e26c3['params']['id']}})[_0x3a40('0x22')](handleEntityNotFound(_0x503d48,null))[_0x3a40('0x22')](saveUpdates(_0x1e26c3[_0x3a40('0x48')],null))[_0x3a40('0x22')](respondWithResult(_0x503d48,null))[_0x3a40('0x47')](handleError(_0x503d48,null));};exports['destroy']=function(_0x2e4c5b,_0x3d8dbc){return db[_0x3a40('0x2b')]['find']({'where':{'id':_0x2e4c5b[_0x3a40('0x45')]['id']}})[_0x3a40('0x22')](handleEntityNotFound(_0x3d8dbc,null))[_0x3a40('0x22')](removeEntity(_0x3d8dbc,null))['catch'](handleError(_0x3d8dbc,null));};exports['create']=function(_0x90ef6a,_0x36d198){var _0x4212c5={'key':_0x90ef6a[_0x3a40('0x48')][_0x3a40('0x3d')]};if(_0x90ef6a[_0x3a40('0x48')][_0x3a40('0x49')]){_0x4212c5[_0x3a40('0x49')]=_0x90ef6a[_0x3a40('0x48')][_0x3a40('0x49')];}else if(_0x90ef6a[_0x3a40('0x48')]['SmsAccountId']){_0x4212c5[_0x3a40('0x4a')]=_0x90ef6a[_0x3a40('0x48')]['SmsAccountId'];}else if(_0x90ef6a['body'][_0x3a40('0x4b')]){_0x4212c5['OpenchannelAccountId']=_0x90ef6a[_0x3a40('0x48')]['OpenchannelAccountId'];}else if(_0x90ef6a['body'][_0x3a40('0x4c')]){_0x4212c5[_0x3a40('0x4c')]=_0x90ef6a[_0x3a40('0x48')][_0x3a40('0x4c')];}return db[_0x3a40('0x2b')]['find']({'where':_0x4212c5})[_0x3a40('0x22')](function(_0x2aed8b){if(_0x2aed8b){throw new db[(_0x3a40('0x4d'))]['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x3a40('0x2b')][_0x3a40('0x4e')](_0x90ef6a[_0x3a40('0x48')]);})[_0x3a40('0x22')](function(_0x2fb42c){var _0x509c3e=_0x90ef6a[_0x3a40('0x4f')][_0x3a40('0x24')]({'plain':!![]});if(!_0x509c3e)throw new Error(_0x3a40('0x50'));if(_0x509c3e['role']===_0x3a40('0x4f')){var _0x3a8b26=_0x2fb42c['get']({'plain':!![]});return db[_0x3a40('0x51')][_0x3a40('0x46')]({'where':{'name':_0x3a40('0x52'),'userProfileId':_0x509c3e['userProfileId']},'raw':!![]})[_0x3a40('0x22')](function(_0x1b59cb){if(_0x1b59cb&&_0x1b59cb[_0x3a40('0x53')]===0x0){return db[_0x3a40('0x54')][_0x3a40('0x4e')]({'name':_0x3a8b26[_0x3a40('0x28')],'resourceId':_0x3a8b26['id'],'type':_0x1b59cb[_0x3a40('0x28')],'sectionId':_0x1b59cb['id']},{})['then'](function(){return _0x2fb42c;});}else{return _0x2fb42c;}})['catch'](function(_0x17955c){logger['error'](_0x3a40('0x55'),_0x17955c);throw _0x17955c;});}return _0x2fb42c;})[_0x3a40('0x22')](respondWithResult(_0x36d198,0xc9))[_0x3a40('0x47')](handleError(_0x36d198,null));}; \ No newline at end of file +var _0x7136=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../config/logger','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','then','get','CannedAnswers','UserProfileResource','destroy','end','name','send','CannedAnswer','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','offset','sort','pick','filter','merge','where','map','type','key','VIRTUAL','field','options','include','rows','catch','params','rawAttributes','includeAll','update','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x7136,0xa4));var _0x6713=function(_0x25a787,_0x6926e7){_0x25a787=_0x25a787-0x0;var _0x37712a=_0x7136[_0x25a787];return _0x37712a;};'use strict';var pdf=require(_0x6713('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6713('0x1'));var zipdir=require(_0x6713('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6713('0x3'));var BPromise=require(_0x6713('0x4'));var Mustache=require(_0x6713('0x5'));var util=require('util');var path=require(_0x6713('0x6'));var sox=require('sox');var csv=require(_0x6713('0x7'));var ejs=require(_0x6713('0x8'));var fs=require('fs');var _=require(_0x6713('0x9'));var squel=require(_0x6713('0xa'));var crypto=require('crypto');var jsforce=require(_0x6713('0xb'));var deskjs=require(_0x6713('0xc'));var toCsv=require(_0x6713('0x7'));var querystring=require(_0x6713('0xd'));var Papa=require(_0x6713('0xe'));var authService=require(_0x6713('0xf'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x6713('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0x6713('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x6713('0x12'))['db'];function respondWithStatusCode(_0x254558,_0x2b7e24){_0x2b7e24=_0x2b7e24||0xcc;return function(_0xf9e97c){if(_0xf9e97c){return _0x254558[_0x6713('0x13')](_0x2b7e24);}return _0x254558[_0x6713('0x14')](_0x2b7e24)['end']();};}function respondWithResult(_0x3bfb2f,_0x156fe){_0x156fe=_0x156fe||0xc8;return function(_0x2b6a48){if(_0x2b6a48){return _0x3bfb2f[_0x6713('0x14')](_0x156fe)[_0x6713('0x15')](_0x2b6a48);}};}function respondWithFilteredResult(_0x5988a0,_0x15f955){return function(_0x2f4165){if(_0x2f4165){var _0x481494=_0x2f4165[_0x6713('0x16')],_0x586f64=_0x15f955['offset'],_0x3c2e11=_0x15f955['offset']+_0x15f955[_0x6713('0x17')],_0x231953;if(_0x3c2e11>=_0x481494){_0x3c2e11=_0x481494;_0x231953=0xc8;}else{_0x231953=0xce;}_0x5988a0[_0x6713('0x14')](_0x231953);return _0x5988a0[_0x6713('0x18')](_0x6713('0x19'),_0x586f64+'-'+_0x3c2e11+'/'+_0x481494)['json'](_0x2f4165);}return null;};}function patchUpdates(_0x23ad7c){return function(_0x1da96d){try{jsonpatch[_0x6713('0x1a')](_0x1da96d,_0x23ad7c,!![]);}catch(_0x73471f){return BPromise[_0x6713('0x1b')](_0x73471f);}return _0x1da96d['save']();};}function saveUpdates(_0x21e440,_0x3af9e9){return function(_0x492475){if(_0x492475){return _0x492475['update'](_0x21e440)[_0x6713('0x1c')](function(_0x7c07c7){return _0x7c07c7;});}return null;};}function removeEntity(_0x26fe26,_0x3d88bb){return function(_0x35823a){if(_0x35823a){return _0x35823a['destroy']()[_0x6713('0x1c')](function(){var _0x13764e=_0x35823a[_0x6713('0x1d')]({'plain':!![]});var _0x2526d1=_0x6713('0x1e');return db[_0x6713('0x1f')][_0x6713('0x20')]({'where':{'type':_0x2526d1,'resourceId':_0x13764e['id']}})[_0x6713('0x1c')](function(){return _0x35823a;});})[_0x6713('0x1c')](function(){_0x26fe26['status'](0xcc)[_0x6713('0x21')]();});}};}function handleEntityNotFound(_0xa3d846,_0x5dc96d){return function(_0x1c81e3){if(!_0x1c81e3){_0xa3d846[_0x6713('0x13')](0x194);}return _0x1c81e3;};}function handleError(_0x2c7769,_0xecbc31){_0xecbc31=_0xecbc31||0x1f4;return function(_0x22628f){logger['error'](_0x22628f['stack']);if(_0x22628f['name']){delete _0x22628f[_0x6713('0x22')];}_0x2c7769['status'](_0xecbc31)[_0x6713('0x23')](_0x22628f);};}exports['index']=function(_0x2eb579,_0x1d8fb5){var _0x128d4f={},_0x3027b5={},_0x31086d={'count':0x0,'rows':[]};var _0x1b97c7=db[_0x6713('0x24')]['rawAttributes'];_0x3027b5['model']=_[_0x6713('0x25')](_0x1b97c7);_0x3027b5[_0x6713('0x26')]=_[_0x6713('0x25')](_0x2eb579[_0x6713('0x26')]);_0x3027b5[_0x6713('0x27')]=_[_0x6713('0x28')](_0x3027b5[_0x6713('0x29')],_0x3027b5[_0x6713('0x26')]);_0x128d4f[_0x6713('0x2a')]=_[_0x6713('0x28')](_0x3027b5['model'],qs['fields'](_0x2eb579[_0x6713('0x26')][_0x6713('0x2b')]));_0x128d4f[_0x6713('0x2a')]=_0x128d4f['attributes']['length']?_0x128d4f['attributes']:_0x3027b5[_0x6713('0x29')];if(!_0x2eb579[_0x6713('0x26')][_0x6713('0x2c')]('nolimit')){_0x128d4f[_0x6713('0x17')]=qs[_0x6713('0x17')](_0x2eb579[_0x6713('0x26')]['limit']);_0x128d4f[_0x6713('0x2d')]=qs[_0x6713('0x2d')](_0x2eb579[_0x6713('0x26')][_0x6713('0x2d')]);}_0x128d4f['order']=qs[_0x6713('0x2e')](_0x2eb579[_0x6713('0x26')][_0x6713('0x2e')]);_0x128d4f['where']=qs['filters'](_[_0x6713('0x2f')](_0x2eb579[_0x6713('0x26')],_0x3027b5[_0x6713('0x27')]));if(_0x2eb579[_0x6713('0x26')][_0x6713('0x30')]){_0x128d4f['where']=_[_0x6713('0x31')](_0x128d4f[_0x6713('0x32')],{'$or':_[_0x6713('0x33')](_0x1b97c7,function(_0x295157){if(_0x295157[_0x6713('0x34')][_0x6713('0x35')]!==_0x6713('0x36')){var _0x27410d={};_0x27410d[_0x295157[_0x6713('0x37')]]={'$like':'%'+_0x2eb579[_0x6713('0x26')][_0x6713('0x30')]+'%'};return _0x27410d;}})});}_0x128d4f=_[_0x6713('0x31')]({},_0x128d4f,_0x2eb579[_0x6713('0x38')]);var _0x1ef7e6={'where':_0x128d4f['where']};return db[_0x6713('0x24')][_0x6713('0x16')](_0x1ef7e6)['then'](function(_0x4d954b){_0x31086d[_0x6713('0x16')]=_0x4d954b;if(_0x2eb579['query']['includeAll']){_0x128d4f[_0x6713('0x39')]=[{'all':!![]}];}return db[_0x6713('0x24')]['findAll'](_0x128d4f);})[_0x6713('0x1c')](function(_0x5086b6){_0x31086d[_0x6713('0x3a')]=_0x5086b6;return _0x31086d;})['then'](respondWithFilteredResult(_0x1d8fb5,_0x128d4f))[_0x6713('0x3b')](handleError(_0x1d8fb5,null));};exports['show']=function(_0x486a6c,_0xf2f6f3){var _0x1f2095={'raw':!![],'where':{'id':_0x486a6c[_0x6713('0x3c')]['id']}},_0x7bbcad={};_0x7bbcad[_0x6713('0x29')]=_[_0x6713('0x25')](db['CannedAnswer'][_0x6713('0x3d')]);_0x7bbcad[_0x6713('0x26')]=_['keys'](_0x486a6c[_0x6713('0x26')]);_0x7bbcad[_0x6713('0x27')]=_[_0x6713('0x28')](_0x7bbcad['model'],_0x7bbcad[_0x6713('0x26')]);_0x1f2095[_0x6713('0x2a')]=_[_0x6713('0x28')](_0x7bbcad[_0x6713('0x29')],qs[_0x6713('0x2b')](_0x486a6c[_0x6713('0x26')][_0x6713('0x2b')]));_0x1f2095[_0x6713('0x2a')]=_0x1f2095[_0x6713('0x2a')]['length']?_0x1f2095[_0x6713('0x2a')]:_0x7bbcad[_0x6713('0x29')];if(_0x486a6c[_0x6713('0x26')][_0x6713('0x3e')]){_0x1f2095[_0x6713('0x39')]=[{'all':!![]}];}_0x1f2095=_[_0x6713('0x31')]({},_0x1f2095,_0x486a6c['options']);return db[_0x6713('0x24')]['find'](_0x1f2095)[_0x6713('0x1c')](handleEntityNotFound(_0xf2f6f3,null))[_0x6713('0x1c')](respondWithResult(_0xf2f6f3,null))[_0x6713('0x3b')](handleError(_0xf2f6f3,null));};exports[_0x6713('0x3f')]=function(_0x1257b7,_0x51d285){if(_0x1257b7['body']['id']){delete _0x1257b7[_0x6713('0x40')]['id'];}return db[_0x6713('0x24')][_0x6713('0x41')]({'where':{'id':_0x1257b7[_0x6713('0x3c')]['id']}})['then'](handleEntityNotFound(_0x51d285,null))['then'](saveUpdates(_0x1257b7[_0x6713('0x40')],null))[_0x6713('0x1c')](respondWithResult(_0x51d285,null))['catch'](handleError(_0x51d285,null));};exports[_0x6713('0x20')]=function(_0x4aeb8c,_0x2035f7){return db[_0x6713('0x24')][_0x6713('0x41')]({'where':{'id':_0x4aeb8c[_0x6713('0x3c')]['id']}})[_0x6713('0x1c')](handleEntityNotFound(_0x2035f7,null))[_0x6713('0x1c')](removeEntity(_0x2035f7,null))[_0x6713('0x3b')](handleError(_0x2035f7,null));};exports[_0x6713('0x42')]=function(_0x3669c7,_0x142b72){var _0x1b2965={'key':_0x3669c7['body'][_0x6713('0x35')]};if(_0x3669c7[_0x6713('0x40')][_0x6713('0x43')]){_0x1b2965[_0x6713('0x43')]=_0x3669c7[_0x6713('0x40')][_0x6713('0x43')];}else if(_0x3669c7['body'][_0x6713('0x44')]){_0x1b2965[_0x6713('0x44')]=_0x3669c7[_0x6713('0x40')]['SmsAccountId'];}else if(_0x3669c7['body'][_0x6713('0x45')]){_0x1b2965['OpenchannelAccountId']=_0x3669c7[_0x6713('0x40')][_0x6713('0x45')];}else if(_0x3669c7[_0x6713('0x40')][_0x6713('0x46')]){_0x1b2965[_0x6713('0x46')]=_0x3669c7[_0x6713('0x40')][_0x6713('0x46')];}return db[_0x6713('0x24')][_0x6713('0x41')]({'where':_0x1b2965})[_0x6713('0x1c')](function(_0x8eda0a){if(_0x8eda0a){throw new db[(_0x6713('0x47'))]['ValidationError'](_0x6713('0x48'));}return db[_0x6713('0x24')][_0x6713('0x42')](_0x3669c7['body']);})['then'](function(_0x330162){var _0xd9110a=_0x3669c7[_0x6713('0x49')][_0x6713('0x1d')]({'plain':!![]});if(!_0xd9110a)throw new Error(_0x6713('0x4a'));if(_0xd9110a[_0x6713('0x4b')]==='user'){var _0x18c1cd=_0x330162[_0x6713('0x1d')]({'plain':!![]});return db[_0x6713('0x4c')][_0x6713('0x41')]({'where':{'name':_0x6713('0x1e'),'userProfileId':_0xd9110a[_0x6713('0x4d')]},'raw':!![]})['then'](function(_0x3d641c){if(_0x3d641c&&_0x3d641c[_0x6713('0x4e')]===0x0){return db[_0x6713('0x1f')][_0x6713('0x42')]({'name':_0x18c1cd[_0x6713('0x22')],'resourceId':_0x18c1cd['id'],'type':_0x3d641c[_0x6713('0x22')],'sectionId':_0x3d641c['id']},{})[_0x6713('0x1c')](function(){return _0x330162;});}else{return _0x330162;}})[_0x6713('0x3b')](function(_0x2c100a){logger[_0x6713('0x4f')](_0x6713('0x50'),_0x2c100a);throw _0x2c100a;});}return _0x330162;})['then'](respondWithResult(_0x142b72,0xc9))[_0x6713('0x3b')](handleError(_0x142b72,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index bff1486..994b88c 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 _0x005f=['bluebird','request-promise','./cannedAnswer.attributes','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x005f,0x15b));var _0xf005=function(_0x2e193d,_0x4a0cff){_0x2e193d=_0x2e193d-0x0;var _0x485867=_0x005f[_0x2e193d];return _0x485867;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf005('0x0'))(_0xf005('0x1'));var moment=require(_0xf005('0x2'));var BPromise=require(_0xf005('0x3'));var rp=require(_0xf005('0x4'));var attributes=require(_0xf005('0x5'));module['exports']=function(_0x2b040b,_0x52bbc8){return _0x2b040b[_0xf005('0x6')](_0xf005('0x7'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf005('0x8'),'collate':_0xf005('0x9')});}; \ No newline at end of file +var _0x027f=['utf8mb4','util','../../config/logger','moment','bluebird','request-promise','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers'];(function(_0x13c70c,_0x546b34){var _0x50f0f2=function(_0x2a2991){while(--_0x2a2991){_0x13c70c['push'](_0x13c70c['shift']());}};_0x50f0f2(++_0x546b34);}(_0x027f,0x97));var _0xf027=function(_0x4c4d44,_0x199ab7){_0x4c4d44=_0x4c4d44-0x0;var _0x23af06=_0x027f[_0x4c4d44];return _0x23af06;};'use strict';var _=require('lodash');var util=require(_0xf027('0x0'));var logger=require(_0xf027('0x1'))('api');var moment=require(_0xf027('0x2'));var BPromise=require(_0xf027('0x3'));var rp=require(_0xf027('0x4'));var attributes=require(_0xf027('0x5'));module[_0xf027('0x6')]=function(_0x3bdcd8,_0x207861){return _0x3bdcd8['define'](_0xf027('0x7'),attributes,{'tableName':_0xf027('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf027('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index f775392..5acf1e0 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 _0x14b8=['CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CannedAnswer,\x20%s,\x20%s','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug'];(function(_0x1e902d,_0x3ed393){var _0x35c56f=function(_0x1e8094){while(--_0x1e8094){_0x1e902d['push'](_0x1e902d['shift']());}};_0x35c56f(++_0x3ed393);}(_0x14b8,0x7c));var _0x814b=function(_0x1afcaa,_0x253e70){_0x1afcaa=_0x1afcaa-0x0;var _0x5ee667=_0x14b8[_0x1afcaa];return _0x5ee667;};'use strict';var _=require(_0x814b('0x0'));var util=require(_0x814b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x814b('0x2'));var db=require(_0x814b('0x3'))['db'];var utils=require(_0x814b('0x4'));var logger=require(_0x814b('0x5'))(_0x814b('0x6'));var config=require(_0x814b('0x7'));var jayson=require(_0x814b('0x8'));var client=jayson[_0x814b('0x9')][_0x814b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42ed8c,_0x828e73,_0x51696f){return new BPromise(function(_0x46b250,_0x38dd37){return client[_0x814b('0xb')](_0x42ed8c,_0x51696f)['then'](function(_0x5c1962){logger[_0x814b('0xc')]('CannedAnswer,\x20%s,\x20%s',_0x828e73,'request\x20sent');logger[_0x814b('0xd')](_0x814b('0xe'),_0x828e73,_0x814b('0xf'),JSON[_0x814b('0x10')](_0x5c1962));if(_0x5c1962[_0x814b('0x11')]){if(_0x5c1962[_0x814b('0x11')][_0x814b('0x12')]===0x1f4){logger[_0x814b('0x11')]('CannedAnswer,\x20%s,\x20%s',_0x828e73,_0x5c1962['error'][_0x814b('0x13')]);return _0x38dd37(_0x5c1962['error'][_0x814b('0x13')]);}logger[_0x814b('0x11')](_0x814b('0x14'),_0x828e73,_0x5c1962[_0x814b('0x11')]['message']);return _0x46b250(_0x5c1962['error']['message']);}else{logger['info']('CannedAnswer,\x20%s,\x20%s',_0x828e73,_0x814b('0xf'));_0x46b250(_0x5c1962[_0x814b('0x15')]['message']);}})[_0x814b('0x16')](function(_0x3633e4){logger[_0x814b('0x11')](_0x814b('0x14'),_0x828e73,_0x3633e4);_0x38dd37(_0x3633e4);});});} \ No newline at end of file +var _0xc485=['lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','CannedAnswer,\x20%s,\x20%s,\x20%s','error','code','message','CannedAnswer,\x20%s,\x20%s','result','catch'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xc485,0x1a2));var _0x5c48=function(_0x2ffea9,_0x4f90ae){_0x2ffea9=_0x2ffea9-0x0;var _0x715534=_0xc485[_0x2ffea9];return _0x715534;};'use strict';var _=require(_0x5c48('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5c48('0x1'));var rs=require(_0x5c48('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c48('0x3'))['db'];var utils=require(_0x5c48('0x4'));var logger=require('../../config/logger')(_0x5c48('0x5'));var config=require(_0x5c48('0x6'));var jayson=require(_0x5c48('0x7'));var client=jayson[_0x5c48('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ac69a,_0x2ee8de,_0x58e7d6){return new BPromise(function(_0x2b8cbd,_0x57b05f){return client[_0x5c48('0x9')](_0x3ac69a,_0x58e7d6)['then'](function(_0x2fe74e){logger[_0x5c48('0xa')]('CannedAnswer,\x20%s,\x20%s',_0x2ee8de,_0x5c48('0xb'));logger['debug'](_0x5c48('0xc'),_0x2ee8de,_0x5c48('0xb'),JSON['stringify'](_0x2fe74e));if(_0x2fe74e[_0x5c48('0xd')]){if(_0x2fe74e[_0x5c48('0xd')][_0x5c48('0xe')]===0x1f4){logger[_0x5c48('0xd')]('CannedAnswer,\x20%s,\x20%s',_0x2ee8de,_0x2fe74e[_0x5c48('0xd')][_0x5c48('0xf')]);return _0x57b05f(_0x2fe74e[_0x5c48('0xd')][_0x5c48('0xf')]);}logger['error'](_0x5c48('0x10'),_0x2ee8de,_0x2fe74e[_0x5c48('0xd')][_0x5c48('0xf')]);return _0x2b8cbd(_0x2fe74e[_0x5c48('0xd')][_0x5c48('0xf')]);}else{logger[_0x5c48('0xa')](_0x5c48('0x10'),_0x2ee8de,_0x5c48('0xb'));_0x2b8cbd(_0x2fe74e[_0x5c48('0x11')][_0x5c48('0xf')]);}})[_0x5c48('0x12')](function(_0x28be07){logger[_0x5c48('0xd')](_0x5c48('0x10'),_0x2ee8de,_0x28be07);_0x57b05f(_0x28be07);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 3384633..ac9239b 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 _0x35a7=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x33d470,_0x291d9a){var _0x1fc855=function(_0x6443fd){while(--_0x6443fd){_0x33d470['push'](_0x33d470['shift']());}};_0x1fc855(++_0x291d9a);}(_0x35a7,0x1cd));var _0x735a=function(_0x1b91c7,_0x539acd){_0x1b91c7=_0x1b91c7-0x0;var _0xbbe014=_0x35a7[_0x1b91c7];return _0xbbe014;};'use strict';var multer=require(_0x735a('0x0'));var util=require(_0x735a('0x1'));var path=require(_0x735a('0x2'));var timeout=require(_0x735a('0x3'));var express=require(_0x735a('0x4'));var router=express[_0x735a('0x5')]();var auth=require(_0x735a('0x6'));var interaction=require(_0x735a('0x7'));var config=require(_0x735a('0x8'));var controller=require('./cannedAnswer.controller');router[_0x735a('0x9')]('/',auth[_0x735a('0xa')](),controller['index']);router['get'](_0x735a('0xb'),auth[_0x735a('0xa')](),controller[_0x735a('0xc')]);router[_0x735a('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x735a('0xe')](_0x735a('0xb'),auth[_0x735a('0xa')](),controller['update']);router[_0x735a('0xf')](_0x735a('0xb'),auth['isAuthenticated'](),controller[_0x735a('0x10')]);module[_0x735a('0x11')]=router; \ No newline at end of file +var _0xf958=['show','post','create','put','update','destroy','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x3cd516,_0x55540e){var _0x3c263c=function(_0x285593){while(--_0x285593){_0x3cd516['push'](_0x3cd516['shift']());}};_0x3c263c(++_0x55540e);}(_0xf958,0xe6));var _0x8f95=function(_0x209efa,_0x4f0e52){_0x209efa=_0x209efa-0x0;var _0x2ed5e2=_0xf958[_0x209efa];return _0x2ed5e2;};'use strict';var multer=require(_0x8f95('0x0'));var util=require('util');var path=require(_0x8f95('0x1'));var timeout=require('connect-timeout');var express=require(_0x8f95('0x2'));var router=express['Router']();var auth=require(_0x8f95('0x3'));var interaction=require(_0x8f95('0x4'));var config=require(_0x8f95('0x5'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0x8f95('0x6')](),controller[_0x8f95('0x7')]);router[_0x8f95('0x8')](_0x8f95('0x9'),auth['isAuthenticated'](),controller[_0x8f95('0xa')]);router[_0x8f95('0xb')]('/',auth[_0x8f95('0x6')](),controller[_0x8f95('0xc')]);router[_0x8f95('0xd')]('/:id',auth[_0x8f95('0x6')](),controller[_0x8f95('0xe')]);router['delete'](_0x8f95('0x9'),auth[_0x8f95('0x6')](),controller[_0x8f95('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 7e5c1b8..145e387 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 _0xd2b9=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd2b9,0x1ba));var _0x9d2b=function(_0x1d8c86,_0x35919a){_0x1d8c86=_0x1d8c86-0x0;var _0x47c8a5=_0xd2b9[_0x1d8c86];return _0x47c8a5;};'use strict';var Sequelize=require(_0x9d2b('0x0'));module[_0x9d2b('0x1')]={'calldate':{'type':Sequelize[_0x9d2b('0x2')],'allowNull':![],'defaultValue':_0x9d2b('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x9d2b('0x4')]},'dcontext':{'type':Sequelize[_0x9d2b('0x4')]},'channel':{'type':Sequelize[_0x9d2b('0x4')]},'dstchannel':{'type':Sequelize[_0x9d2b('0x4')]},'lastapp':{'type':Sequelize[_0x9d2b('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x9d2b('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x9d2b('0x4')]},'userfield':{'type':Sequelize[_0x9d2b('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x9d2b('0x4')]},'peeraccount':{'type':Sequelize[_0x9d2b('0x4')]},'type':{'type':Sequelize[_0x9d2b('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x363a=['STRING','INTEGER','exports','1970-01-01\x2000:00:01'];(function(_0x58c7b0,_0x4cb178){var _0x22a17d=function(_0xdb4bc){while(--_0xdb4bc){_0x58c7b0['push'](_0x58c7b0['shift']());}};_0x22a17d(++_0x4cb178);}(_0x363a,0x116));var _0xa363=function(_0x2a9197,_0x5225eb){_0x2a9197=_0x2a9197-0x0;var _0x588c8a=_0x363a[_0x2a9197];return _0x588c8a;};'use strict';var Sequelize=require('sequelize');module[_0xa363('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xa363('0x1')},'clid':{'type':Sequelize[_0xa363('0x2')]},'src':{'type':Sequelize[_0xa363('0x2')]},'dst':{'type':Sequelize[_0xa363('0x2')]},'dcontext':{'type':Sequelize[_0xa363('0x2')]},'channel':{'type':Sequelize[_0xa363('0x2')]},'dstchannel':{'type':Sequelize[_0xa363('0x2')]},'lastapp':{'type':Sequelize[_0xa363('0x2')]},'lastdata':{'type':Sequelize[_0xa363('0x2')]},'duration':{'type':Sequelize[_0xa363('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa363('0x2')]},'amaflags':{'type':Sequelize[_0xa363('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xa363('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xa363('0x2')]},'sequence':{'type':Sequelize[_0xa363('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xa363('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index db0c21c..d8c49f9 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 _0x2c18=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','map','type','key','field','options','Cdr','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','end','json','count','offset','limit','status','set','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','model','keys','query'];(function(_0x24bb2c,_0x239429){var _0x9497e8=function(_0x408021){while(--_0x408021){_0x24bb2c['push'](_0x24bb2c['shift']());}};_0x9497e8(++_0x239429);}(_0x2c18,0x68));var _0x82c1=function(_0x46e523,_0xe6fccb){_0x46e523=_0x46e523-0x0;var _0x5da0ee=_0x2c18[_0x46e523];return _0x5da0ee;};'use strict';var pdf=require(_0x82c1('0x0'));var emlformat=require(_0x82c1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x82c1('0x2'));var jsonpatch=require(_0x82c1('0x3'));var rp=require(_0x82c1('0x4'));var moment=require('moment');var BPromise=require(_0x82c1('0x5'));var Mustache=require(_0x82c1('0x6'));var util=require('util');var path=require(_0x82c1('0x7'));var sox=require(_0x82c1('0x8'));var csv=require(_0x82c1('0x9'));var ejs=require(_0x82c1('0xa'));var fs=require('fs');var _=require(_0x82c1('0xb'));var squel=require(_0x82c1('0xc'));var crypto=require(_0x82c1('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x82c1('0x9'));var querystring=require(_0x82c1('0xe'));var Papa=require(_0x82c1('0xf'));var authService=require(_0x82c1('0x10'));var hardwareService=require(_0x82c1('0x11'));var Redis=require(_0x82c1('0x12'));var qs=require(_0x82c1('0x13'));var logger=require('../../config/logger')(_0x82c1('0x14'));var utils=require(_0x82c1('0x15'));var config=require(_0x82c1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x339c8c,_0x3d5c08){_0x3d5c08=_0x3d5c08||0xcc;return function(_0x21be08){if(_0x21be08){return _0x339c8c[_0x82c1('0x17')](_0x3d5c08);}return _0x339c8c['status'](_0x3d5c08)[_0x82c1('0x18')]();};}function respondWithResult(_0x148a67,_0xae8110){_0xae8110=_0xae8110||0xc8;return function(_0x5ca1f7){if(_0x5ca1f7){return _0x148a67['status'](_0xae8110)[_0x82c1('0x19')](_0x5ca1f7);}};}function respondWithFilteredResult(_0x5c3ce3,_0xa06212){return function(_0x304214){if(_0x304214){var _0x2ac471=_0x304214[_0x82c1('0x1a')],_0x475ae6=_0xa06212[_0x82c1('0x1b')],_0x2cd5de=_0xa06212[_0x82c1('0x1b')]+_0xa06212[_0x82c1('0x1c')],_0x39b719;if(_0x2cd5de>=_0x2ac471){_0x2cd5de=_0x2ac471;_0x39b719=0xc8;}else{_0x39b719=0xce;}_0x5c3ce3[_0x82c1('0x1d')](_0x39b719);return _0x5c3ce3[_0x82c1('0x1e')]('Content-Range',_0x475ae6+'-'+_0x2cd5de+'/'+_0x2ac471)[_0x82c1('0x19')](_0x304214);}return null;};}function patchUpdates(_0x2b7e79){return function(_0x324b74){try{jsonpatch['apply'](_0x324b74,_0x2b7e79,!![]);}catch(_0x1c1443){return BPromise[_0x82c1('0x1f')](_0x1c1443);}return _0x324b74[_0x82c1('0x20')]();};}function saveUpdates(_0x276191,_0x2a6c79){return function(_0x81b5ee){if(_0x81b5ee){return _0x81b5ee[_0x82c1('0x21')](_0x276191)[_0x82c1('0x22')](function(_0x32c37a){return _0x32c37a;});}return null;};}function removeEntity(_0x337897,_0x3721d4){return function(_0x3fa856){if(_0x3fa856){return _0x3fa856[_0x82c1('0x23')]()[_0x82c1('0x22')](function(){_0x337897['status'](0xcc)[_0x82c1('0x18')]();});}};}function handleEntityNotFound(_0x36dc4b,_0x5aade4){return function(_0x20c7dc){if(!_0x20c7dc){_0x36dc4b['sendStatus'](0x194);}return _0x20c7dc;};}function handleError(_0x288f1a,_0xf55c78){_0xf55c78=_0xf55c78||0x1f4;return function(_0x260f82){logger['error'](_0x260f82[_0x82c1('0x24')]);if(_0x260f82[_0x82c1('0x25')]){delete _0x260f82[_0x82c1('0x25')];}_0x288f1a[_0x82c1('0x1d')](_0xf55c78)[_0x82c1('0x26')](_0x260f82);};}exports[_0x82c1('0x27')]=function(_0x418331,_0x4ac500){var _0x5f2b9e={},_0x1346ab={},_0x2e7517={'count':0x0,'rows':[]};var _0x4c540e=db['Cdr'][_0x82c1('0x28')];_0x1346ab[_0x82c1('0x29')]=_[_0x82c1('0x2a')](_0x4c540e);_0x1346ab[_0x82c1('0x2b')]=_[_0x82c1('0x2a')](_0x418331[_0x82c1('0x2b')]);_0x1346ab['filters']=_['intersection'](_0x1346ab['model'],_0x1346ab['query']);_0x5f2b9e['attributes']=_[_0x82c1('0x2c')](_0x1346ab['model'],qs[_0x82c1('0x2d')](_0x418331['query'][_0x82c1('0x2d')]));_0x5f2b9e[_0x82c1('0x2e')]=_0x5f2b9e['attributes'][_0x82c1('0x2f')]?_0x5f2b9e[_0x82c1('0x2e')]:_0x1346ab[_0x82c1('0x29')];if(!_0x418331[_0x82c1('0x2b')][_0x82c1('0x30')](_0x82c1('0x31'))){_0x5f2b9e['limit']=qs[_0x82c1('0x1c')](_0x418331[_0x82c1('0x2b')][_0x82c1('0x1c')]);_0x5f2b9e[_0x82c1('0x1b')]=qs[_0x82c1('0x1b')](_0x418331[_0x82c1('0x2b')][_0x82c1('0x1b')]);}_0x5f2b9e[_0x82c1('0x32')]=qs[_0x82c1('0x33')](_0x418331[_0x82c1('0x2b')][_0x82c1('0x33')]);_0x5f2b9e['where']=qs[_0x82c1('0x34')](_[_0x82c1('0x35')](_0x418331[_0x82c1('0x2b')],_0x1346ab[_0x82c1('0x34')]));if(_0x418331[_0x82c1('0x2b')][_0x82c1('0x36')]){_0x5f2b9e[_0x82c1('0x37')]=_[_0x82c1('0x38')](_0x5f2b9e[_0x82c1('0x37')],{'$or':_[_0x82c1('0x39')](_0x4c540e,function(_0x53a2ae){if(_0x53a2ae[_0x82c1('0x3a')][_0x82c1('0x3b')]!=='VIRTUAL'){var _0x27d3a4={};_0x27d3a4[_0x53a2ae[_0x82c1('0x3c')]]={'$like':'%'+_0x418331[_0x82c1('0x2b')][_0x82c1('0x36')]+'%'};return _0x27d3a4;}})});}_0x5f2b9e=_['merge']({},_0x5f2b9e,_0x418331[_0x82c1('0x3d')]);var _0x55c92e={'where':_0x5f2b9e[_0x82c1('0x37')]};return db[_0x82c1('0x3e')][_0x82c1('0x1a')](_0x55c92e)['then'](function(_0x3649b4){_0x2e7517[_0x82c1('0x1a')]=_0x3649b4;if(_0x418331[_0x82c1('0x2b')][_0x82c1('0x3f')]){_0x5f2b9e['include']=[{'all':!![]}];}return db[_0x82c1('0x3e')][_0x82c1('0x40')](_0x5f2b9e);})[_0x82c1('0x22')](function(_0x8fbc6a){_0x2e7517[_0x82c1('0x41')]=_0x8fbc6a;return _0x2e7517;})[_0x82c1('0x22')](respondWithFilteredResult(_0x4ac500,_0x5f2b9e))[_0x82c1('0x42')](handleError(_0x4ac500,null));};exports[_0x82c1('0x43')]=function(_0x441771,_0x1c51a5){var _0x10d8e3={'raw':!![],'where':{'id':_0x441771[_0x82c1('0x44')]['id']}},_0x1611cf={};_0x1611cf[_0x82c1('0x29')]=_[_0x82c1('0x2a')](db[_0x82c1('0x3e')][_0x82c1('0x28')]);_0x1611cf[_0x82c1('0x2b')]=_['keys'](_0x441771['query']);_0x1611cf[_0x82c1('0x34')]=_[_0x82c1('0x2c')](_0x1611cf[_0x82c1('0x29')],_0x1611cf[_0x82c1('0x2b')]);_0x10d8e3[_0x82c1('0x2e')]=_['intersection'](_0x1611cf[_0x82c1('0x29')],qs['fields'](_0x441771[_0x82c1('0x2b')][_0x82c1('0x2d')]));_0x10d8e3[_0x82c1('0x2e')]=_0x10d8e3[_0x82c1('0x2e')][_0x82c1('0x2f')]?_0x10d8e3[_0x82c1('0x2e')]:_0x1611cf[_0x82c1('0x29')];if(_0x441771[_0x82c1('0x2b')][_0x82c1('0x3f')]){_0x10d8e3[_0x82c1('0x45')]=[{'all':!![]}];}_0x10d8e3=_[_0x82c1('0x38')]({},_0x10d8e3,_0x441771[_0x82c1('0x3d')]);return db[_0x82c1('0x3e')][_0x82c1('0x46')](_0x10d8e3)['then'](handleEntityNotFound(_0x1c51a5,null))[_0x82c1('0x22')](respondWithResult(_0x1c51a5,null))['catch'](handleError(_0x1c51a5,null));};exports[_0x82c1('0x47')]=function(_0x110748,_0x528407){return db['Cdr']['create'](_0x110748['body'],{})['then'](respondWithResult(_0x528407,0xc9))[_0x82c1('0x42')](handleError(_0x528407,null));};exports[_0x82c1('0x21')]=function(_0x27d14d,_0x42c110){if(_0x27d14d[_0x82c1('0x48')]['id']){delete _0x27d14d[_0x82c1('0x48')]['id'];}return db[_0x82c1('0x3e')][_0x82c1('0x46')]({'where':{'id':_0x27d14d[_0x82c1('0x44')]['id']}})[_0x82c1('0x22')](handleEntityNotFound(_0x42c110,null))['then'](saveUpdates(_0x27d14d[_0x82c1('0x48')],null))[_0x82c1('0x22')](respondWithResult(_0x42c110,null))[_0x82c1('0x42')](handleError(_0x42c110,null));};exports['destroy']=function(_0x32f9b9,_0x427767){return db['Cdr'][_0x82c1('0x46')]({'where':{'id':_0x32f9b9[_0x82c1('0x44')]['id']}})[_0x82c1('0x22')](handleEntityNotFound(_0x427767,null))[_0x82c1('0x22')](removeEntity(_0x427767,null))[_0x82c1('0x42')](handleError(_0x427767,null));};exports[_0x82c1('0x49')]=function(_0x23afd7,_0x1bf225){return db[_0x82c1('0x3e')][_0x82c1('0x49')]()['then'](respondWithResult(_0x1bf225,null))['catch'](handleError(_0x1bf225,null));}; \ No newline at end of file +var _0xf1a4=['stack','name','send','index','Cdr','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','type','key','VIRTUAL','field','options','includeAll','findAll','catch','params','include','find','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','error'];(function(_0x152121,_0x120c53){var _0x592a85=function(_0x241cab){while(--_0x241cab){_0x152121['push'](_0x152121['shift']());}};_0x592a85(++_0x120c53);}(_0xf1a4,0x69));var _0x4f1a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf1a4[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x4f1a('0x0'));var emlformat=require(_0x4f1a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4f1a('0x2'));var jsonpatch=require(_0x4f1a('0x3'));var rp=require(_0x4f1a('0x4'));var moment=require(_0x4f1a('0x5'));var BPromise=require(_0x4f1a('0x6'));var Mustache=require(_0x4f1a('0x7'));var util=require(_0x4f1a('0x8'));var path=require(_0x4f1a('0x9'));var sox=require(_0x4f1a('0xa'));var csv=require(_0x4f1a('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4f1a('0xc'));var squel=require(_0x4f1a('0xd'));var crypto=require('crypto');var jsforce=require(_0x4f1a('0xe'));var deskjs=require(_0x4f1a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4f1a('0x10'));var Papa=require(_0x4f1a('0x11'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x4f1a('0x12'));var qs=require(_0x4f1a('0x13'));var logger=require(_0x4f1a('0x14'))(_0x4f1a('0x15'));var utils=require(_0x4f1a('0x16'));var config=require(_0x4f1a('0x17'));var db=require(_0x4f1a('0x18'))['db'];function respondWithStatusCode(_0x49fe16,_0x1ba9e8){_0x1ba9e8=_0x1ba9e8||0xcc;return function(_0x408593){if(_0x408593){return _0x49fe16[_0x4f1a('0x19')](_0x1ba9e8);}return _0x49fe16[_0x4f1a('0x1a')](_0x1ba9e8)[_0x4f1a('0x1b')]();};}function respondWithResult(_0x445aaf,_0x3860d2){_0x3860d2=_0x3860d2||0xc8;return function(_0x17773f){if(_0x17773f){return _0x445aaf[_0x4f1a('0x1a')](_0x3860d2)[_0x4f1a('0x1c')](_0x17773f);}};}function respondWithFilteredResult(_0x224c05,_0x1fcfc8){return function(_0x5caa57){if(_0x5caa57){var _0x1e4789=_0x5caa57[_0x4f1a('0x1d')],_0x13d829=_0x1fcfc8[_0x4f1a('0x1e')],_0x33a99a=_0x1fcfc8['offset']+_0x1fcfc8[_0x4f1a('0x1f')],_0x47ba9d;if(_0x33a99a>=_0x1e4789){_0x33a99a=_0x1e4789;_0x47ba9d=0xc8;}else{_0x47ba9d=0xce;}_0x224c05[_0x4f1a('0x1a')](_0x47ba9d);return _0x224c05[_0x4f1a('0x20')](_0x4f1a('0x21'),_0x13d829+'-'+_0x33a99a+'/'+_0x1e4789)[_0x4f1a('0x1c')](_0x5caa57);}return null;};}function patchUpdates(_0x5226a6){return function(_0x2a9ee2){try{jsonpatch[_0x4f1a('0x22')](_0x2a9ee2,_0x5226a6,!![]);}catch(_0x387fb7){return BPromise[_0x4f1a('0x23')](_0x387fb7);}return _0x2a9ee2['save']();};}function saveUpdates(_0x2df79a,_0x12e8b8){return function(_0x198589){if(_0x198589){return _0x198589['update'](_0x2df79a)[_0x4f1a('0x24')](function(_0x425e2b){return _0x425e2b;});}return null;};}function removeEntity(_0x4adb52,_0x4a5406){return function(_0x32a63b){if(_0x32a63b){return _0x32a63b[_0x4f1a('0x25')]()[_0x4f1a('0x24')](function(){_0x4adb52['status'](0xcc)[_0x4f1a('0x1b')]();});}};}function handleEntityNotFound(_0xac71a1,_0xc3616a){return function(_0x405c0){if(!_0x405c0){_0xac71a1[_0x4f1a('0x19')](0x194);}return _0x405c0;};}function handleError(_0x269ebc,_0x4d0e12){_0x4d0e12=_0x4d0e12||0x1f4;return function(_0x43aaff){logger[_0x4f1a('0x26')](_0x43aaff[_0x4f1a('0x27')]);if(_0x43aaff[_0x4f1a('0x28')]){delete _0x43aaff[_0x4f1a('0x28')];}_0x269ebc['status'](_0x4d0e12)[_0x4f1a('0x29')](_0x43aaff);};}exports[_0x4f1a('0x2a')]=function(_0x34d3ba,_0x5a2d46){var _0x4dfdad={},_0x3c3ead={},_0xbe37f={'count':0x0,'rows':[]};var _0x1df419=db[_0x4f1a('0x2b')][_0x4f1a('0x2c')];_0x3c3ead['model']=_[_0x4f1a('0x2d')](_0x1df419);_0x3c3ead[_0x4f1a('0x2e')]=_[_0x4f1a('0x2d')](_0x34d3ba[_0x4f1a('0x2e')]);_0x3c3ead[_0x4f1a('0x2f')]=_[_0x4f1a('0x30')](_0x3c3ead[_0x4f1a('0x31')],_0x3c3ead[_0x4f1a('0x2e')]);_0x4dfdad[_0x4f1a('0x32')]=_[_0x4f1a('0x30')](_0x3c3ead[_0x4f1a('0x31')],qs[_0x4f1a('0x33')](_0x34d3ba[_0x4f1a('0x2e')][_0x4f1a('0x33')]));_0x4dfdad[_0x4f1a('0x32')]=_0x4dfdad[_0x4f1a('0x32')][_0x4f1a('0x34')]?_0x4dfdad[_0x4f1a('0x32')]:_0x3c3ead[_0x4f1a('0x31')];if(!_0x34d3ba[_0x4f1a('0x2e')]['hasOwnProperty']('nolimit')){_0x4dfdad[_0x4f1a('0x1f')]=qs[_0x4f1a('0x1f')](_0x34d3ba[_0x4f1a('0x2e')][_0x4f1a('0x1f')]);_0x4dfdad[_0x4f1a('0x1e')]=qs['offset'](_0x34d3ba[_0x4f1a('0x2e')]['offset']);}_0x4dfdad[_0x4f1a('0x35')]=qs[_0x4f1a('0x36')](_0x34d3ba[_0x4f1a('0x2e')][_0x4f1a('0x36')]);_0x4dfdad[_0x4f1a('0x37')]=qs[_0x4f1a('0x2f')](_[_0x4f1a('0x38')](_0x34d3ba[_0x4f1a('0x2e')],_0x3c3ead[_0x4f1a('0x2f')]));if(_0x34d3ba['query'][_0x4f1a('0x39')]){_0x4dfdad['where']=_[_0x4f1a('0x3a')](_0x4dfdad[_0x4f1a('0x37')],{'$or':_['map'](_0x1df419,function(_0x1b0eeb){if(_0x1b0eeb[_0x4f1a('0x3b')][_0x4f1a('0x3c')]!==_0x4f1a('0x3d')){var _0x454638={};_0x454638[_0x1b0eeb[_0x4f1a('0x3e')]]={'$like':'%'+_0x34d3ba['query'][_0x4f1a('0x39')]+'%'};return _0x454638;}})});}_0x4dfdad=_[_0x4f1a('0x3a')]({},_0x4dfdad,_0x34d3ba[_0x4f1a('0x3f')]);var _0x24f52c={'where':_0x4dfdad[_0x4f1a('0x37')]};return db['Cdr'][_0x4f1a('0x1d')](_0x24f52c)[_0x4f1a('0x24')](function(_0x1e032c){_0xbe37f[_0x4f1a('0x1d')]=_0x1e032c;if(_0x34d3ba[_0x4f1a('0x2e')][_0x4f1a('0x40')]){_0x4dfdad['include']=[{'all':!![]}];}return db[_0x4f1a('0x2b')][_0x4f1a('0x41')](_0x4dfdad);})[_0x4f1a('0x24')](function(_0x4dd860){_0xbe37f['rows']=_0x4dd860;return _0xbe37f;})['then'](respondWithFilteredResult(_0x5a2d46,_0x4dfdad))[_0x4f1a('0x42')](handleError(_0x5a2d46,null));};exports['show']=function(_0x5733b0,_0xc239a9){var _0x4d6f95={'raw':!![],'where':{'id':_0x5733b0[_0x4f1a('0x43')]['id']}},_0x2e5264={};_0x2e5264[_0x4f1a('0x31')]=_[_0x4f1a('0x2d')](db[_0x4f1a('0x2b')][_0x4f1a('0x2c')]);_0x2e5264['query']=_['keys'](_0x5733b0[_0x4f1a('0x2e')]);_0x2e5264[_0x4f1a('0x2f')]=_[_0x4f1a('0x30')](_0x2e5264[_0x4f1a('0x31')],_0x2e5264[_0x4f1a('0x2e')]);_0x4d6f95['attributes']=_[_0x4f1a('0x30')](_0x2e5264[_0x4f1a('0x31')],qs[_0x4f1a('0x33')](_0x5733b0[_0x4f1a('0x2e')][_0x4f1a('0x33')]));_0x4d6f95['attributes']=_0x4d6f95['attributes'][_0x4f1a('0x34')]?_0x4d6f95[_0x4f1a('0x32')]:_0x2e5264[_0x4f1a('0x31')];if(_0x5733b0[_0x4f1a('0x2e')][_0x4f1a('0x40')]){_0x4d6f95[_0x4f1a('0x44')]=[{'all':!![]}];}_0x4d6f95=_[_0x4f1a('0x3a')]({},_0x4d6f95,_0x5733b0[_0x4f1a('0x3f')]);return db[_0x4f1a('0x2b')][_0x4f1a('0x45')](_0x4d6f95)[_0x4f1a('0x24')](handleEntityNotFound(_0xc239a9,null))[_0x4f1a('0x24')](respondWithResult(_0xc239a9,null))[_0x4f1a('0x42')](handleError(_0xc239a9,null));};exports['create']=function(_0x1e0bd0,_0x394b55){return db[_0x4f1a('0x2b')]['create'](_0x1e0bd0['body'],{})[_0x4f1a('0x24')](respondWithResult(_0x394b55,0xc9))[_0x4f1a('0x42')](handleError(_0x394b55,null));};exports['update']=function(_0x5a622b,_0x3931f6){if(_0x5a622b['body']['id']){delete _0x5a622b[_0x4f1a('0x46')]['id'];}return db[_0x4f1a('0x2b')][_0x4f1a('0x45')]({'where':{'id':_0x5a622b[_0x4f1a('0x43')]['id']}})[_0x4f1a('0x24')](handleEntityNotFound(_0x3931f6,null))[_0x4f1a('0x24')](saveUpdates(_0x5a622b[_0x4f1a('0x46')],null))[_0x4f1a('0x24')](respondWithResult(_0x3931f6,null))[_0x4f1a('0x42')](handleError(_0x3931f6,null));};exports[_0x4f1a('0x25')]=function(_0xa235bf,_0x1bf174){return db[_0x4f1a('0x2b')][_0x4f1a('0x45')]({'where':{'id':_0xa235bf['params']['id']}})[_0x4f1a('0x24')](handleEntityNotFound(_0x1bf174,null))[_0x4f1a('0x24')](removeEntity(_0x1bf174,null))[_0x4f1a('0x42')](handleError(_0x1bf174,null));};exports[_0x4f1a('0x47')]=function(_0x5cb015,_0x2dd3c0){return db[_0x4f1a('0x2b')]['describe']()[_0x4f1a('0x24')](respondWithResult(_0x2dd3c0,null))[_0x4f1a('0x42')](handleError(_0x2dd3c0,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 7c0a6e1..0f7caba 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 _0x5062=['cdr','calldate','disposition','dst','src','uniqueid','util','../../config/logger','api','moment','bluebird','define','Cdr'];(function(_0x3005d5,_0xf588c7){var _0x547c7e=function(_0x4514dc){while(--_0x4514dc){_0x3005d5['push'](_0x3005d5['shift']());}};_0x547c7e(++_0xf588c7);}(_0x5062,0x1f4));var _0x2506=function(_0x55ddf7,_0x27fb41){_0x55ddf7=_0x55ddf7-0x0;var _0x378a98=_0x5062[_0x55ddf7];return _0x378a98;};'use strict';var _=require('lodash');var util=require(_0x2506('0x0'));var logger=require(_0x2506('0x1'))(_0x2506('0x2'));var moment=require(_0x2506('0x3'));var BPromise=require(_0x2506('0x4'));var rp=require('request-promise');var attributes=require('./cdr.attributes');module['exports']=function(_0x367af9,_0x3c56c6){return _0x367af9[_0x2506('0x5')](_0x2506('0x6'),attributes,{'tableName':_0x2506('0x7'),'paranoid':![],'indexes':[{'name':'accountcode','fields':['accountcode']},{'name':_0x2506('0x8'),'fields':[_0x2506('0x8')]},{'name':_0x2506('0x9'),'fields':[_0x2506('0x9')]},{'name':_0x2506('0xa'),'fields':[_0x2506('0xa')]},{'name':_0x2506('0xb'),'fields':[_0x2506('0xb')]},{'name':_0x2506('0xc'),'fields':[_0x2506('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xc953=['util','../../config/logger','moment','bluebird','request-promise','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','dst','src','uniqueid'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc953,0x78));var _0x3c95=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0xc953[_0x40bffc];return _0x3007e9;};'use strict';var _=require('lodash');var util=require(_0x3c95('0x0'));var logger=require(_0x3c95('0x1'))('api');var moment=require(_0x3c95('0x2'));var BPromise=require(_0x3c95('0x3'));var rp=require(_0x3c95('0x4'));var attributes=require(_0x3c95('0x5'));module[_0x3c95('0x6')]=function(_0x23119e,_0x3214c2){return _0x23119e[_0x3c95('0x7')](_0x3c95('0x8'),attributes,{'tableName':_0x3c95('0x9'),'paranoid':![],'indexes':[{'name':_0x3c95('0xa'),'fields':[_0x3c95('0xa')]},{'name':_0x3c95('0xb'),'fields':[_0x3c95('0xb')]},{'name':'disposition','fields':['disposition']},{'name':'dst','fields':[_0x3c95('0xc')]},{'name':_0x3c95('0xd'),'fields':[_0x3c95('0xd')]},{'name':_0x3c95('0xe'),'fields':[_0x3c95('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 46d1c36..7ad6e9b 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 _0xee80=['../../config/environment','jayson/promise','client','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee80,0xc9));var _0x0ee8=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xee80[_0x565ed7];return _0x183ad7;};'use strict';var _=require('lodash');var util=require(_0x0ee8('0x0'));var moment=require(_0x0ee8('0x1'));var BPromise=require(_0x0ee8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ee8('0x3'));var db=require(_0x0ee8('0x4'))['db'];var utils=require(_0x0ee8('0x5'));var logger=require(_0x0ee8('0x6'))(_0x0ee8('0x7'));var config=require(_0x0ee8('0x8'));var jayson=require(_0x0ee8('0x9'));var client=jayson[_0x0ee8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49fae9,_0x1441d6,_0x1286a0){return new BPromise(function(_0x548cc6,_0x3e9ae2){return client[_0x0ee8('0xb')](_0x49fae9,_0x1286a0)['then'](function(_0xc6d91){logger[_0x0ee8('0xc')](_0x0ee8('0xd'),_0x1441d6,_0x0ee8('0xe'));logger[_0x0ee8('0xf')]('Cdr,\x20%s,\x20%s,\x20%s',_0x1441d6,'request\x20sent',JSON[_0x0ee8('0x10')](_0xc6d91));if(_0xc6d91['error']){if(_0xc6d91[_0x0ee8('0x11')]['code']===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x1441d6,_0xc6d91[_0x0ee8('0x11')][_0x0ee8('0x12')]);return _0x3e9ae2(_0xc6d91[_0x0ee8('0x11')]['message']);}logger['error'](_0x0ee8('0xd'),_0x1441d6,_0xc6d91[_0x0ee8('0x11')]['message']);return _0x548cc6(_0xc6d91[_0x0ee8('0x11')]['message']);}else{logger[_0x0ee8('0xc')]('Cdr,\x20%s,\x20%s',_0x1441d6,'request\x20sent');_0x548cc6(_0xc6d91['result'][_0x0ee8('0x12')]);}})['catch'](function(_0x58de17){logger[_0x0ee8('0x11')](_0x0ee8('0xd'),_0x1441d6,_0x58de17);_0x3e9ae2(_0x58de17);});});} \ No newline at end of file +var _0xa5b1=['message','result','catch','lodash','util','bluebird','../../mysqldb','rpc','jayson/promise','client','http','request','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x59a40c,_0x4bc224){var _0x284b51=function(_0xb78403){while(--_0xb78403){_0x59a40c['push'](_0x59a40c['shift']());}};_0x284b51(++_0x4bc224);}(_0xa5b1,0x17f));var _0x1a5b=function(_0xb64e9e,_0x519fb2){_0xb64e9e=_0xb64e9e-0x0;var _0x1c63f4=_0xa5b1[_0xb64e9e];return _0x1c63f4;};'use strict';var _=require(_0x1a5b('0x0'));var util=require(_0x1a5b('0x1'));var moment=require('moment');var BPromise=require(_0x1a5b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a5b('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a5b('0x4'));var config=require('../../config/environment');var jayson=require(_0x1a5b('0x5'));var client=jayson[_0x1a5b('0x6')][_0x1a5b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xecde2d,_0x51eae2,_0x773a9c){return new BPromise(function(_0x2c6237,_0x245403){return client[_0x1a5b('0x8')](_0xecde2d,_0x773a9c)['then'](function(_0x95c19a){logger[_0x1a5b('0x9')](_0x1a5b('0xa'),_0x51eae2,_0x1a5b('0xb'));logger['debug'](_0x1a5b('0xc'),_0x51eae2,_0x1a5b('0xb'),JSON[_0x1a5b('0xd')](_0x95c19a));if(_0x95c19a[_0x1a5b('0xe')]){if(_0x95c19a[_0x1a5b('0xe')][_0x1a5b('0xf')]===0x1f4){logger[_0x1a5b('0xe')](_0x1a5b('0xa'),_0x51eae2,_0x95c19a[_0x1a5b('0xe')][_0x1a5b('0x10')]);return _0x245403(_0x95c19a[_0x1a5b('0xe')][_0x1a5b('0x10')]);}logger[_0x1a5b('0xe')]('Cdr,\x20%s,\x20%s',_0x51eae2,_0x95c19a[_0x1a5b('0xe')][_0x1a5b('0x10')]);return _0x2c6237(_0x95c19a['error'][_0x1a5b('0x10')]);}else{logger[_0x1a5b('0x9')](_0x1a5b('0xa'),_0x51eae2,_0x1a5b('0xb'));_0x2c6237(_0x95c19a[_0x1a5b('0x11')][_0x1a5b('0x10')]);}})[_0x1a5b('0x12')](function(_0x1789e4){logger[_0x1a5b('0xe')](_0x1a5b('0xa'),_0x51eae2,_0x1789e4);_0x245403(_0x1789e4);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index ecd159e..d4c7bfe 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 _0xfa80=['./cdr.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x4f2861,_0x236452){var _0x5e1067=function(_0x598506){while(--_0x598506){_0x4f2861['push'](_0x4f2861['shift']());}};_0x5e1067(++_0x236452);}(_0xfa80,0x6a));var _0x0fa8=function(_0x3a47bb,_0x4164a8){_0x3a47bb=_0x3a47bb-0x0;var _0x53d947=_0xfa80[_0x3a47bb];return _0x53d947;};'use strict';var multer=require(_0x0fa8('0x0'));var util=require(_0x0fa8('0x1'));var path=require(_0x0fa8('0x2'));var timeout=require(_0x0fa8('0x3'));var express=require(_0x0fa8('0x4'));var router=express[_0x0fa8('0x5')]();var auth=require(_0x0fa8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0fa8('0x7'));var controller=require(_0x0fa8('0x8'));router[_0x0fa8('0x9')]('/',auth[_0x0fa8('0xa')](),controller[_0x0fa8('0xb')]);router[_0x0fa8('0x9')](_0x0fa8('0xc'),auth['isAuthenticated'](),controller[_0x0fa8('0xd')]);router[_0x0fa8('0x9')](_0x0fa8('0xe'),auth[_0x0fa8('0xa')](),controller[_0x0fa8('0xf')]);router[_0x0fa8('0x10')]('/',auth[_0x0fa8('0xa')](),controller['create']);router[_0x0fa8('0x11')](_0x0fa8('0xe'),auth[_0x0fa8('0xa')](),controller[_0x0fa8('0x12')]);router['delete'](_0x0fa8('0xe'),auth[_0x0fa8('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9aee=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','isAuthenticated','get','/:id','show','post','put','delete','destroy','exports','multer'];(function(_0x56dd68,_0x8c1cd1){var _0x3f2728=function(_0x2bfff5){while(--_0x2bfff5){_0x56dd68['push'](_0x56dd68['shift']());}};_0x3f2728(++_0x8c1cd1);}(_0x9aee,0x71));var _0xe9ae=function(_0x5cef3c,_0x4a327a){_0x5cef3c=_0x5cef3c-0x0;var _0xa1b932=_0x9aee[_0x5cef3c];return _0xa1b932;};'use strict';var multer=require(_0xe9ae('0x0'));var util=require(_0xe9ae('0x1'));var path=require(_0xe9ae('0x2'));var timeout=require(_0xe9ae('0x3'));var express=require(_0xe9ae('0x4'));var router=express[_0xe9ae('0x5')]();var auth=require(_0xe9ae('0x6'));var interaction=require(_0xe9ae('0x7'));var config=require(_0xe9ae('0x8'));var controller=require('./cdr.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe9ae('0x9')]);router['get']('/describe',auth[_0xe9ae('0xa')](),controller['describe']);router[_0xe9ae('0xb')](_0xe9ae('0xc'),auth['isAuthenticated'](),controller[_0xe9ae('0xd')]);router[_0xe9ae('0xe')]('/',auth[_0xe9ae('0xa')](),controller['create']);router[_0xe9ae('0xf')](_0xe9ae('0xc'),auth[_0xe9ae('0xa')](),controller['update']);router[_0xe9ae('0x10')]('/:id',auth[_0xe9ae('0xa')](),controller[_0xe9ae('0x11')]);module[_0xe9ae('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 180cfd3..03e1adc 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 _0xd301=['sequelize','noop','TEXT','STRING','*,*,*,*'];(function(_0x30da39,_0x295701){var _0x30316a=function(_0x4052b8){while(--_0x4052b8){_0x30da39['push'](_0x30da39['shift']());}};_0x30316a(++_0x295701);}(_0xd301,0x145));var _0x1d30=function(_0x188998,_0x2a082e){_0x188998=_0x188998-0x0;var _0x17801b=_0xd301[_0x188998];return _0x17801b;};'use strict';var Sequelize=require(_0x1d30('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1d30('0x1')},'appdata':{'type':Sequelize[_0x1d30('0x2')]()},'description':{'type':Sequelize[_0x1d30('0x3')]},'interval':{'type':Sequelize[_0x1d30('0x3')],'defaultValue':_0x1d30('0x4')}}; \ No newline at end of file +var _0x2e54=['noop','TEXT','*,*,*,*','INTEGER','STRING'];(function(_0x28d7d8,_0x153240){var _0x217958=function(_0xa9fcb9){while(--_0xa9fcb9){_0x28d7d8['push'](_0x28d7d8['shift']());}};_0x217958(++_0x153240);}(_0x2e54,0xc1));var _0x42e5=function(_0x26030b,_0x1ec0a8){_0x26030b=_0x26030b-0x0;var _0x5b7107=_0x2e54[_0x26030b];return _0x5b7107;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x42e5('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x42e5('0x1')],'allowNull':![],'defaultValue':_0x42e5('0x2')},'appdata':{'type':Sequelize[_0x42e5('0x3')]()},'description':{'type':Sequelize[_0x42e5('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x42e5('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index a066409..ff005e0 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 _0x479a=['api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','then','destroy','stack','name','send','show','params','model','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','merge','options','ChatApplication','catch','body','find','html-pdf','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','ejs','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger'];(function(_0x11deef,_0x34bbdb){var _0xe9ba85=function(_0x591377){while(--_0x591377){_0x11deef['push'](_0x11deef['shift']());}};_0xe9ba85(++_0x34bbdb);}(_0x479a,0xb9));var _0xa479=function(_0x14e4c2,_0x32bbf4){_0x14e4c2=_0x14e4c2-0x0;var _0x5bcf07=_0x479a[_0x14e4c2];return _0x5bcf07;};'use strict';var pdf=require(_0xa479('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa479('0x1'));var zipdir=require(_0xa479('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa479('0x3'));var Mustache=require(_0xa479('0x4'));var util=require('util');var path=require(_0xa479('0x5'));var sox=require(_0xa479('0x6'));var csv=require(_0xa479('0x7'));var ejs=require(_0xa479('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa479('0x9'));var deskjs=require(_0xa479('0xa'));var toCsv=require(_0xa479('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0xa479('0xb'));var hardwareService=require(_0xa479('0xc'));var Redis=require(_0xa479('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0xa479('0xe'))(_0xa479('0xf'));var utils=require(_0xa479('0x10'));var config=require('../../config/environment');var db=require(_0xa479('0x11'))['db'];function respondWithStatusCode(_0x4e253a,_0x5bda61){_0x5bda61=_0x5bda61||0xcc;return function(_0x16e952){if(_0x16e952){return _0x4e253a[_0xa479('0x12')](_0x5bda61);}return _0x4e253a[_0xa479('0x13')](_0x5bda61)[_0xa479('0x14')]();};}function respondWithResult(_0x36f1ea,_0x587e91){_0x587e91=_0x587e91||0xc8;return function(_0x1795ad){if(_0x1795ad){return _0x36f1ea[_0xa479('0x13')](_0x587e91)[_0xa479('0x15')](_0x1795ad);}};}function respondWithFilteredResult(_0x395302,_0x44e836){return function(_0x3af276){if(_0x3af276){var _0x3e3cd9=_0x3af276[_0xa479('0x16')],_0x1414f0=_0x44e836[_0xa479('0x17')],_0x43184d=_0x44e836[_0xa479('0x17')]+_0x44e836[_0xa479('0x18')],_0x1423fc;if(_0x43184d>=_0x3e3cd9){_0x43184d=_0x3e3cd9;_0x1423fc=0xc8;}else{_0x1423fc=0xce;}_0x395302[_0xa479('0x13')](_0x1423fc);return _0x395302[_0xa479('0x19')]('Content-Range',_0x1414f0+'-'+_0x43184d+'/'+_0x3e3cd9)['json'](_0x3af276);}return null;};}function patchUpdates(_0x3dfbcb){return function(_0x4d79f7){try{jsonpatch[_0xa479('0x1a')](_0x4d79f7,_0x3dfbcb,!![]);}catch(_0x1da201){return BPromise['reject'](_0x1da201);}return _0x4d79f7[_0xa479('0x1b')]();};}function saveUpdates(_0x16a997,_0x20a962){return function(_0x5e76d1){if(_0x5e76d1){return _0x5e76d1['update'](_0x16a997)[_0xa479('0x1c')](function(_0x2ef912){return _0x2ef912;});}return null;};}function removeEntity(_0x43e25f,_0x3f497d){return function(_0x287266){if(_0x287266){return _0x287266[_0xa479('0x1d')]()['then'](function(){_0x43e25f[_0xa479('0x13')](0xcc)[_0xa479('0x14')]();});}};}function handleEntityNotFound(_0x32da11,_0x3db167){return function(_0x5dfa99){if(!_0x5dfa99){_0x32da11[_0xa479('0x12')](0x194);}return _0x5dfa99;};}function handleError(_0x2f54ad,_0x59d7f6){_0x59d7f6=_0x59d7f6||0x1f4;return function(_0xd4ce6){logger['error'](_0xd4ce6[_0xa479('0x1e')]);if(_0xd4ce6['name']){delete _0xd4ce6[_0xa479('0x1f')];}_0x2f54ad[_0xa479('0x13')](_0x59d7f6)[_0xa479('0x20')](_0xd4ce6);};}exports[_0xa479('0x21')]=function(_0x591a36,_0x2ae183){var _0x92d38c={'raw':!![],'where':{'id':_0x591a36[_0xa479('0x22')]['id']}},_0xf6c00d={};_0xf6c00d[_0xa479('0x23')]=_['keys'](db['ChatApplication'][_0xa479('0x24')]);_0xf6c00d[_0xa479('0x25')]=_['keys'](_0x591a36[_0xa479('0x25')]);_0xf6c00d['filters']=_[_0xa479('0x26')](_0xf6c00d[_0xa479('0x23')],_0xf6c00d[_0xa479('0x25')]);_0x92d38c[_0xa479('0x27')]=_['intersection'](_0xf6c00d['model'],qs[_0xa479('0x28')](_0x591a36[_0xa479('0x25')][_0xa479('0x28')]));_0x92d38c[_0xa479('0x27')]=_0x92d38c[_0xa479('0x27')][_0xa479('0x29')]?_0x92d38c['attributes']:_0xf6c00d[_0xa479('0x23')];if(_0x591a36[_0xa479('0x25')][_0xa479('0x2a')]){_0x92d38c[_0xa479('0x2b')]=[{'all':!![]}];}_0x92d38c=_[_0xa479('0x2c')]({},_0x92d38c,_0x591a36[_0xa479('0x2d')]);return db[_0xa479('0x2e')]['find'](_0x92d38c)[_0xa479('0x1c')](handleEntityNotFound(_0x2ae183,null))[_0xa479('0x1c')](respondWithResult(_0x2ae183,null))[_0xa479('0x2f')](handleError(_0x2ae183,null));};exports['update']=function(_0xa8d444,_0x53d6d9){if(_0xa8d444[_0xa479('0x30')]['id']){delete _0xa8d444[_0xa479('0x30')]['id'];}return db[_0xa479('0x2e')][_0xa479('0x31')]({'where':{'id':_0xa8d444[_0xa479('0x22')]['id']}})['then'](handleEntityNotFound(_0x53d6d9,null))[_0xa479('0x1c')](saveUpdates(_0xa8d444[_0xa479('0x30')],null))[_0xa479('0x1c')](respondWithResult(_0x53d6d9,null))[_0xa479('0x2f')](handleError(_0x53d6d9,null));};exports[_0xa479('0x1d')]=function(_0x338d43,_0x465d1d){return db[_0xa479('0x2e')][_0xa479('0x31')]({'where':{'id':_0x338d43[_0xa479('0x22')]['id']}})[_0xa479('0x1c')](handleEntityNotFound(_0x465d1d,null))[_0xa479('0x1c')](removeEntity(_0x465d1d,null))[_0xa479('0x2f')](handleError(_0x465d1d,null));}; \ No newline at end of file +var _0xa479=['includeAll','include','merge','options','ChatApplication','find','body','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../config/logger','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length'];(function(_0x4aba15,_0x4e90aa){var _0x1c8122=function(_0x568dba){while(--_0x568dba){_0x4aba15['push'](_0x4aba15['shift']());}};_0x1c8122(++_0x4e90aa);}(_0xa479,0xb9));var _0x9a47=function(_0x5976e6,_0x2e259f){_0x5976e6=_0x5976e6-0x0;var _0x1020e4=_0xa479[_0x5976e6];return _0x1020e4;};'use strict';var pdf=require(_0x9a47('0x0'));var emlformat=require(_0x9a47('0x1'));var rimraf=require(_0x9a47('0x2'));var zipdir=require(_0x9a47('0x3'));var jsonpatch=require(_0x9a47('0x4'));var rp=require(_0x9a47('0x5'));var moment=require(_0x9a47('0x6'));var BPromise=require(_0x9a47('0x7'));var Mustache=require('mustache');var util=require(_0x9a47('0x8'));var path=require('path');var sox=require(_0x9a47('0x9'));var csv=require(_0x9a47('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9a47('0xb'));var squel=require(_0x9a47('0xc'));var crypto=require('crypto');var jsforce=require(_0x9a47('0xd'));var deskjs=require(_0x9a47('0xe'));var toCsv=require(_0x9a47('0xa'));var querystring=require(_0x9a47('0xf'));var Papa=require(_0x9a47('0x10'));var authService=require(_0x9a47('0x11'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x9a47('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0x9a47('0x13'))('api');var utils=require(_0x9a47('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa135f4,_0x1d43cb){_0x1d43cb=_0x1d43cb||0xcc;return function(_0x2d2531){if(_0x2d2531){return _0xa135f4[_0x9a47('0x15')](_0x1d43cb);}return _0xa135f4[_0x9a47('0x16')](_0x1d43cb)[_0x9a47('0x17')]();};}function respondWithResult(_0x3c2f4d,_0x3ca6f9){_0x3ca6f9=_0x3ca6f9||0xc8;return function(_0x1f39cf){if(_0x1f39cf){return _0x3c2f4d[_0x9a47('0x16')](_0x3ca6f9)[_0x9a47('0x18')](_0x1f39cf);}};}function respondWithFilteredResult(_0x3dd752,_0xe645be){return function(_0x33a750){if(_0x33a750){var _0x576e62=_0x33a750[_0x9a47('0x19')],_0x15a130=_0xe645be[_0x9a47('0x1a')],_0x1fa135=_0xe645be[_0x9a47('0x1a')]+_0xe645be[_0x9a47('0x1b')],_0x303dc1;if(_0x1fa135>=_0x576e62){_0x1fa135=_0x576e62;_0x303dc1=0xc8;}else{_0x303dc1=0xce;}_0x3dd752[_0x9a47('0x16')](_0x303dc1);return _0x3dd752[_0x9a47('0x1c')](_0x9a47('0x1d'),_0x15a130+'-'+_0x1fa135+'/'+_0x576e62)[_0x9a47('0x18')](_0x33a750);}return null;};}function patchUpdates(_0x3a08e8){return function(_0x2227fe){try{jsonpatch[_0x9a47('0x1e')](_0x2227fe,_0x3a08e8,!![]);}catch(_0x31284f){return BPromise[_0x9a47('0x1f')](_0x31284f);}return _0x2227fe[_0x9a47('0x20')]();};}function saveUpdates(_0x20a9ed,_0x4fc1c3){return function(_0x3c6b19){if(_0x3c6b19){return _0x3c6b19[_0x9a47('0x21')](_0x20a9ed)[_0x9a47('0x22')](function(_0x432356){return _0x432356;});}return null;};}function removeEntity(_0x47d09a,_0x420664){return function(_0x45d906){if(_0x45d906){return _0x45d906[_0x9a47('0x23')]()['then'](function(){_0x47d09a[_0x9a47('0x16')](0xcc)[_0x9a47('0x17')]();});}};}function handleEntityNotFound(_0x37cef6,_0x17e9e7){return function(_0x2efa9f){if(!_0x2efa9f){_0x37cef6[_0x9a47('0x15')](0x194);}return _0x2efa9f;};}function handleError(_0x7c0f91,_0x2a9ba9){_0x2a9ba9=_0x2a9ba9||0x1f4;return function(_0x572dff){logger[_0x9a47('0x24')](_0x572dff[_0x9a47('0x25')]);if(_0x572dff['name']){delete _0x572dff[_0x9a47('0x26')];}_0x7c0f91['status'](_0x2a9ba9)[_0x9a47('0x27')](_0x572dff);};}exports[_0x9a47('0x28')]=function(_0x100a2a,_0x51d6b5){var _0x5112b8={'raw':!![],'where':{'id':_0x100a2a[_0x9a47('0x29')]['id']}},_0x300b8d={};_0x300b8d[_0x9a47('0x2a')]=_[_0x9a47('0x2b')](db['ChatApplication'][_0x9a47('0x2c')]);_0x300b8d['query']=_[_0x9a47('0x2b')](_0x100a2a[_0x9a47('0x2d')]);_0x300b8d[_0x9a47('0x2e')]=_[_0x9a47('0x2f')](_0x300b8d[_0x9a47('0x2a')],_0x300b8d[_0x9a47('0x2d')]);_0x5112b8['attributes']=_[_0x9a47('0x2f')](_0x300b8d['model'],qs['fields'](_0x100a2a[_0x9a47('0x2d')][_0x9a47('0x30')]));_0x5112b8[_0x9a47('0x31')]=_0x5112b8['attributes'][_0x9a47('0x32')]?_0x5112b8['attributes']:_0x300b8d[_0x9a47('0x2a')];if(_0x100a2a[_0x9a47('0x2d')][_0x9a47('0x33')]){_0x5112b8[_0x9a47('0x34')]=[{'all':!![]}];}_0x5112b8=_[_0x9a47('0x35')]({},_0x5112b8,_0x100a2a[_0x9a47('0x36')]);return db[_0x9a47('0x37')][_0x9a47('0x38')](_0x5112b8)[_0x9a47('0x22')](handleEntityNotFound(_0x51d6b5,null))[_0x9a47('0x22')](respondWithResult(_0x51d6b5,null))['catch'](handleError(_0x51d6b5,null));};exports[_0x9a47('0x21')]=function(_0x4f6f59,_0x21e8f4){if(_0x4f6f59[_0x9a47('0x39')]['id']){delete _0x4f6f59[_0x9a47('0x39')]['id'];}return db['ChatApplication'][_0x9a47('0x38')]({'where':{'id':_0x4f6f59[_0x9a47('0x29')]['id']}})['then'](handleEntityNotFound(_0x21e8f4,null))[_0x9a47('0x22')](saveUpdates(_0x4f6f59[_0x9a47('0x39')],null))[_0x9a47('0x22')](respondWithResult(_0x21e8f4,null))[_0x9a47('0x3a')](handleError(_0x21e8f4,null));};exports[_0x9a47('0x23')]=function(_0x8ab214,_0x4fe274){return db[_0x9a47('0x37')][_0x9a47('0x38')]({'where':{'id':_0x8ab214[_0x9a47('0x29')]['id']}})[_0x9a47('0x22')](handleEntityNotFound(_0x4fe274,null))[_0x9a47('0x22')](removeEntity(_0x4fe274,null))[_0x9a47('0x3a')](handleError(_0x4fe274,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 5ef04d1..fb0f40c 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 _0x90c6=['chat_applications','util','../../config/logger','moment','bluebird','request-promise','exports','ChatApplication'];(function(_0x5a0950,_0x38e796){var _0x52b631=function(_0x1cfcab){while(--_0x1cfcab){_0x5a0950['push'](_0x5a0950['shift']());}};_0x52b631(++_0x38e796);}(_0x90c6,0x1a1));var _0x690c=function(_0x14c93a,_0xe83766){_0x14c93a=_0x14c93a-0x0;var _0x280591=_0x90c6[_0x14c93a];return _0x280591;};'use strict';var _=require('lodash');var util=require(_0x690c('0x0'));var logger=require(_0x690c('0x1'))('api');var moment=require(_0x690c('0x2'));var BPromise=require(_0x690c('0x3'));var rp=require(_0x690c('0x4'));var attributes=require('./chatApplication.attributes');module[_0x690c('0x5')]=function(_0xae4a9a,_0xbf3e6f){return _0xae4a9a['define'](_0x690c('0x6'),attributes,{'tableName':_0x690c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24b0=['util','../../config/logger','api','bluebird','request-promise','exports','ChatApplication','chat_applications','lodash'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x24b0,0x1a6));var _0x024b=function(_0x313bab,_0x3f00c4){_0x313bab=_0x313bab-0x0;var _0x51d5ca=_0x24b0[_0x313bab];return _0x51d5ca;};'use strict';var _=require(_0x024b('0x0'));var util=require(_0x024b('0x1'));var logger=require(_0x024b('0x2'))(_0x024b('0x3'));var moment=require('moment');var BPromise=require(_0x024b('0x4'));var rp=require(_0x024b('0x5'));var attributes=require('./chatApplication.attributes');module[_0x024b('0x6')]=function(_0x2a8a57,_0x18cc49){return _0x2a8a57['define'](_0x024b('0x7'),attributes,{'tableName':_0x024b('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 3e0549d..ad96f95 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 _0x292e=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code','message','ChatApplication,\x20%s,\x20%s','result'];(function(_0x456032,_0x1a799d){var _0x1a53cd=function(_0x162cc8){while(--_0x162cc8){_0x456032['push'](_0x456032['shift']());}};_0x1a53cd(++_0x1a799d);}(_0x292e,0x1a3));var _0xe292=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x292e[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xe292('0x0'));var util=require(_0xe292('0x1'));var moment=require(_0xe292('0x2'));var BPromise=require(_0xe292('0x3'));var rs=require(_0xe292('0x4'));var fs=require('fs');var Redis=require(_0xe292('0x5'));var db=require(_0xe292('0x6'))['db'];var utils=require(_0xe292('0x7'));var logger=require('../../config/logger')(_0xe292('0x8'));var config=require('../../config/environment');var jayson=require(_0xe292('0x9'));var client=jayson[_0xe292('0xa')][_0xe292('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46ebc1,_0x125420,_0x5053a7){return new BPromise(function(_0x48dd5a,_0x2b10e8){return client[_0xe292('0xc')](_0x46ebc1,_0x5053a7)['then'](function(_0x5e5106){logger[_0xe292('0xd')]('ChatApplication,\x20%s,\x20%s',_0x125420,_0xe292('0xe'));logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x125420,_0xe292('0xe'),JSON[_0xe292('0xf')](_0x5e5106));if(_0x5e5106[_0xe292('0x10')]){if(_0x5e5106[_0xe292('0x10')][_0xe292('0x11')]===0x1f4){logger[_0xe292('0x10')]('ChatApplication,\x20%s,\x20%s',_0x125420,_0x5e5106[_0xe292('0x10')][_0xe292('0x12')]);return _0x2b10e8(_0x5e5106[_0xe292('0x10')][_0xe292('0x12')]);}logger['error'](_0xe292('0x13'),_0x125420,_0x5e5106['error'][_0xe292('0x12')]);return _0x48dd5a(_0x5e5106[_0xe292('0x10')][_0xe292('0x12')]);}else{logger[_0xe292('0xd')]('ChatApplication,\x20%s,\x20%s',_0x125420,'request\x20sent');_0x48dd5a(_0x5e5106[_0xe292('0x14')][_0xe292('0x12')]);}})[_0xe292('0x15')](function(_0x51445b){logger[_0xe292('0x10')]('ChatApplication,\x20%s,\x20%s',_0x125420,_0x51445b);_0x2b10e8(_0x51445b);});});} \ No newline at end of file +var _0xfad7=['jayson/promise','client','http','request','then','info','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','ChatApplication,\x20%s,\x20%s','message','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x354ab1,_0xec5b21){var _0x9918a1=function(_0x1becca){while(--_0x1becca){_0x354ab1['push'](_0x354ab1['shift']());}};_0x9918a1(++_0xec5b21);}(_0xfad7,0x175));var _0x7fad=function(_0x815632,_0x24eabb){_0x815632=_0x815632-0x0;var _0x2b26e9=_0xfad7[_0x815632];return _0x2b26e9;};'use strict';var _=require('lodash');var util=require(_0x7fad('0x0'));var moment=require(_0x7fad('0x1'));var BPromise=require(_0x7fad('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7fad('0x3'));var db=require(_0x7fad('0x4'))['db'];var utils=require(_0x7fad('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7fad('0x6'));var jayson=require(_0x7fad('0x7'));var client=jayson[_0x7fad('0x8')][_0x7fad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49a7dd,_0x224e77,_0x55fc6f){return new BPromise(function(_0x3bacca,_0x1ab329){return client[_0x7fad('0xa')](_0x49a7dd,_0x55fc6f)[_0x7fad('0xb')](function(_0xdf853d){logger[_0x7fad('0xc')]('ChatApplication,\x20%s,\x20%s',_0x224e77,'request\x20sent');logger[_0x7fad('0xd')](_0x7fad('0xe'),_0x224e77,'request\x20sent',JSON[_0x7fad('0xf')](_0xdf853d));if(_0xdf853d['error']){if(_0xdf853d[_0x7fad('0x10')]['code']===0x1f4){logger[_0x7fad('0x10')](_0x7fad('0x11'),_0x224e77,_0xdf853d[_0x7fad('0x10')][_0x7fad('0x12')]);return _0x1ab329(_0xdf853d[_0x7fad('0x10')][_0x7fad('0x12')]);}logger[_0x7fad('0x10')](_0x7fad('0x11'),_0x224e77,_0xdf853d['error']['message']);return _0x3bacca(_0xdf853d[_0x7fad('0x10')][_0x7fad('0x12')]);}else{logger[_0x7fad('0xc')](_0x7fad('0x11'),_0x224e77,'request\x20sent');_0x3bacca(_0xdf853d['result']['message']);}})['catch'](function(_0x2af965){logger[_0x7fad('0x10')]('ChatApplication,\x20%s,\x20%s',_0x224e77,_0x2af965);_0x1ab329(_0x2af965);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 3d783b9..e293909 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 _0x9048=['connect-timeout','express','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','update','destroy','exports','multer','path'];(function(_0x7e3c77,_0x176143){var _0x538a54=function(_0x381970){while(--_0x381970){_0x7e3c77['push'](_0x7e3c77['shift']());}};_0x538a54(++_0x176143);}(_0x9048,0xc2));var _0x8904=function(_0x6b9f51,_0x10645e){_0x6b9f51=_0x6b9f51-0x0;var _0x40e202=_0x9048[_0x6b9f51];return _0x40e202;};'use strict';var multer=require(_0x8904('0x0'));var util=require('util');var path=require(_0x8904('0x1'));var timeout=require(_0x8904('0x2'));var express=require(_0x8904('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8904('0x4'));var config=require(_0x8904('0x5'));var controller=require(_0x8904('0x6'));router[_0x8904('0x7')](_0x8904('0x8'),auth[_0x8904('0x9')](),controller[_0x8904('0xa')]);router['put'](_0x8904('0x8'),auth[_0x8904('0x9')](),controller[_0x8904('0xb')]);router['delete'](_0x8904('0x8'),auth[_0x8904('0x9')](),controller[_0x8904('0xc')]);module[_0x8904('0xd')]=router; \ No newline at end of file +var _0x7244=['Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','put','/:id','delete','destroy','util','path','connect-timeout','express'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x7244,0x1f4));var _0x4724=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x7244[_0x1203f];return _0x365f0a;};'use strict';var multer=require('multer');var util=require(_0x4724('0x0'));var path=require(_0x4724('0x1'));var timeout=require(_0x4724('0x2'));var express=require(_0x4724('0x3'));var router=express[_0x4724('0x4')]();var auth=require(_0x4724('0x5'));var interaction=require(_0x4724('0x6'));var config=require('../../config/environment');var controller=require('./chatApplication.controller');router[_0x4724('0x7')]('/:id',auth[_0x4724('0x8')](),controller[_0x4724('0x9')]);router[_0x4724('0xa')](_0x4724('0xb'),auth[_0x4724('0x8')](),controller['update']);router[_0x4724('0xc')](_0x4724('0xb'),auth[_0x4724('0x8')](),controller[_0x4724('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index fba0367..0775e88 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 _0x5d1a=['STRING','BOOLEAN','sequelize','exports'];(function(_0x11b782,_0x1aab9d){var _0x41da54=function(_0x806990){while(--_0x806990){_0x11b782['push'](_0x11b782['shift']());}};_0x41da54(++_0x1aab9d);}(_0x5d1a,0xae));var _0xa5d1=function(_0x344adc,_0x183c37){_0x344adc=_0x344adc-0x0;var _0x4014b2=_0x5d1a[_0x344adc];return _0x4014b2;};'use strict';var Sequelize=require(_0xa5d1('0x0'));module[_0xa5d1('0x1')]={'name':{'type':Sequelize[_0xa5d1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa5d1('0x2')]},'write':{'type':Sequelize[_0xa5d1('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xdd20=['sequelize','STRING'];(function(_0x531ea2,_0x5bbc8b){var _0x1b0545=function(_0x5cca90){while(--_0x5cca90){_0x531ea2['push'](_0x531ea2['shift']());}};_0x1b0545(++_0x5bbc8b);}(_0xdd20,0x120));var _0x0dd2=function(_0x33b63f,_0x958d7e){_0x33b63f=_0x33b63f-0x0;var _0x176914=_0xdd20[_0x33b63f];return _0x176914;};'use strict';var Sequelize=require(_0x0dd2('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x0dd2('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index ec95969..4468f1b 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 _0x16e2=['jsforce','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','destroy','end','stack','name','send','index','ChatGroup','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','type','key','field','options','count','includeAll','include','findAll','show','params','rawAttributes','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','findOne','User','pick','getMembers','removeMembers','addMessage','ChatGroupId','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','to-csv','squel','crypto'];(function(_0x113526,_0x4bb069){var _0x352160=function(_0xc826a3){while(--_0xc826a3){_0x113526['push'](_0x113526['shift']());}};_0x352160(++_0x4bb069);}(_0x16e2,0xc5));var _0x216e=function(_0x550c2e,_0x1e482b){_0x550c2e=_0x550c2e-0x0;var _0x503f08=_0x16e2[_0x550c2e];return _0x503f08;};'use strict';var pdf=require(_0x216e('0x0'));var emlformat=require(_0x216e('0x1'));var rimraf=require(_0x216e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x216e('0x3'));var rp=require(_0x216e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x216e('0x5'));var util=require(_0x216e('0x6'));var path=require(_0x216e('0x7'));var sox=require('sox');var csv=require(_0x216e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x216e('0x9'));var crypto=require(_0x216e('0xa'));var jsforce=require(_0x216e('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x216e('0xc'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x216e('0xd'));var qs=require(_0x216e('0xe'));var logger=require(_0x216e('0xf'))('api');var utils=require(_0x216e('0x10'));var config=require('../../config/environment');var db=require(_0x216e('0x11'))['db'];config[_0x216e('0x12')]=_[_0x216e('0x13')](config[_0x216e('0x12')],{'host':_0x216e('0x14'),'port':0x18eb});var socket=require(_0x216e('0x15'))(new Redis(config[_0x216e('0x12')]));require('./chatGroup.socket')[_0x216e('0x16')](socket);var jayson=require(_0x216e('0x17'));var client=jayson['client'][_0x216e('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x279629,_0x419d8b,_0x1007aa,_0x3680fc){return new BPromise(function(_0x4803d5,_0x37840f){var _0x298474=_0x3680fc||client;return _0x298474[_0x216e('0x19')](_0x279629,_0x1007aa)[_0x216e('0x1a')](function(_0x1ad0ae){logger['info'](_0x216e('0x1b'),_0x419d8b,_0x216e('0x1c'));logger[_0x216e('0x1d')](_0x216e('0x1e'),_0x419d8b,'request\x20sent',JSON[_0x216e('0x1f')](_0x1ad0ae));if(_0x1ad0ae[_0x216e('0x20')]){if(_0x1ad0ae['error'][_0x216e('0x21')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x419d8b,_0x1ad0ae['error'][_0x216e('0x22')]);return _0x37840f(_0x1ad0ae[_0x216e('0x20')][_0x216e('0x22')]);}logger[_0x216e('0x20')](_0x216e('0x1b'),_0x419d8b,_0x1ad0ae[_0x216e('0x20')][_0x216e('0x22')]);return _0x4803d5(_0x1ad0ae['error'][_0x216e('0x22')]);}else{logger[_0x216e('0x23')]('ChatGroup,\x20%s,\x20%s',_0x419d8b,_0x216e('0x1c'));_0x4803d5(_0x1ad0ae[_0x216e('0x24')][_0x216e('0x22')]);}})[_0x216e('0x25')](function(_0x5711e4){logger[_0x216e('0x20')](_0x216e('0x1b'),_0x419d8b,_0x5711e4);_0x37840f(_0x5711e4);});});}function respondWithStatusCode(_0x3bd30f,_0x1e5b66){_0x1e5b66=_0x1e5b66||0xcc;return function(_0x49c6cb){if(_0x49c6cb){return _0x3bd30f[_0x216e('0x26')](_0x1e5b66);}return _0x3bd30f['status'](_0x1e5b66)['end']();};}function respondWithResult(_0x287520,_0x1709c1){_0x1709c1=_0x1709c1||0xc8;return function(_0xc5c6b6){if(_0xc5c6b6){return _0x287520[_0x216e('0x27')](_0x1709c1)[_0x216e('0x28')](_0xc5c6b6);}};}function respondWithFilteredResult(_0x589d8b,_0x511ea9){return function(_0x1709ba){if(_0x1709ba){var _0x25890b=_0x1709ba['count'],_0x1f7957=_0x511ea9[_0x216e('0x29')],_0xbadd30=_0x511ea9[_0x216e('0x29')]+_0x511ea9['limit'],_0x3d74e8;if(_0xbadd30>=_0x25890b){_0xbadd30=_0x25890b;_0x3d74e8=0xc8;}else{_0x3d74e8=0xce;}_0x589d8b[_0x216e('0x27')](_0x3d74e8);return _0x589d8b[_0x216e('0x2a')](_0x216e('0x2b'),_0x1f7957+'-'+_0xbadd30+'/'+_0x25890b)[_0x216e('0x28')](_0x1709ba);}return null;};}function patchUpdates(_0x30f9db){return function(_0x109b06){try{jsonpatch[_0x216e('0x2c')](_0x109b06,_0x30f9db,!![]);}catch(_0x3539f1){return BPromise[_0x216e('0x2d')](_0x3539f1);}return _0x109b06[_0x216e('0x2e')]();};}function saveUpdates(_0x557478,_0xacb7f8){return function(_0x4a69ae){if(_0x4a69ae){return _0x4a69ae['update'](_0x557478)[_0x216e('0x1a')](function(_0x29e1e3){return _0x29e1e3;});}return null;};}function removeEntity(_0x1d3ccd,_0x28b0a4){return function(_0x1ebee2){if(_0x1ebee2){return _0x1ebee2[_0x216e('0x2f')]()[_0x216e('0x1a')](function(){_0x1d3ccd[_0x216e('0x27')](0xcc)[_0x216e('0x30')]();});}};}function handleEntityNotFound(_0x4459c7,_0x3c0a77){return function(_0x4551e6){if(!_0x4551e6){_0x4459c7[_0x216e('0x26')](0x194);}return _0x4551e6;};}function handleError(_0x509aff,_0x192560){_0x192560=_0x192560||0x1f4;return function(_0x10974e){logger[_0x216e('0x20')](_0x10974e[_0x216e('0x31')]);if(_0x10974e['name']){delete _0x10974e[_0x216e('0x32')];}_0x509aff['status'](_0x192560)[_0x216e('0x33')](_0x10974e);};}exports[_0x216e('0x34')]=function(_0x4c01d2,_0x73a185){var _0x20f6a3={},_0x100879={},_0x4a8af2={'count':0x0,'rows':[]};var _0x33ae23=db[_0x216e('0x35')]['rawAttributes'];_0x100879['model']=_[_0x216e('0x36')](_0x33ae23);_0x100879[_0x216e('0x37')]=_[_0x216e('0x36')](_0x4c01d2[_0x216e('0x37')]);_0x100879['filters']=_[_0x216e('0x38')](_0x100879['model'],_0x100879['query']);_0x20f6a3[_0x216e('0x39')]=_['intersection'](_0x100879[_0x216e('0x3a')],qs[_0x216e('0x3b')](_0x4c01d2['query']['fields']));_0x20f6a3[_0x216e('0x39')]=_0x20f6a3[_0x216e('0x39')][_0x216e('0x3c')]?_0x20f6a3[_0x216e('0x39')]:_0x100879['model'];if(!_0x4c01d2[_0x216e('0x37')][_0x216e('0x3d')](_0x216e('0x3e'))){_0x20f6a3['limit']=qs[_0x216e('0x3f')](_0x4c01d2['query'][_0x216e('0x3f')]);_0x20f6a3['offset']=qs[_0x216e('0x29')](_0x4c01d2[_0x216e('0x37')][_0x216e('0x29')]);}_0x20f6a3[_0x216e('0x40')]=qs['sort'](_0x4c01d2[_0x216e('0x37')][_0x216e('0x41')]);_0x20f6a3[_0x216e('0x42')]=qs[_0x216e('0x43')](_['pick'](_0x4c01d2[_0x216e('0x37')],_0x100879['filters']));if(_0x4c01d2['query'][_0x216e('0x44')]){_0x20f6a3[_0x216e('0x42')]=_[_0x216e('0x45')](_0x20f6a3[_0x216e('0x42')],{'$or':_['map'](_0x33ae23,function(_0x4ffdfa){if(_0x4ffdfa[_0x216e('0x46')][_0x216e('0x47')]!=='VIRTUAL'){var _0x3198bc={};_0x3198bc[_0x4ffdfa[_0x216e('0x48')]]={'$like':'%'+_0x4c01d2[_0x216e('0x37')][_0x216e('0x44')]+'%'};return _0x3198bc;}})});}_0x20f6a3=_['merge']({},_0x20f6a3,_0x4c01d2[_0x216e('0x49')]);var _0x12f415={'where':_0x20f6a3[_0x216e('0x42')]};return db['ChatGroup'][_0x216e('0x4a')](_0x12f415)[_0x216e('0x1a')](function(_0xc94a10){_0x4a8af2['count']=_0xc94a10;if(_0x4c01d2[_0x216e('0x37')][_0x216e('0x4b')]){_0x20f6a3[_0x216e('0x4c')]=[{'all':!![]}];}return db['ChatGroup'][_0x216e('0x4d')](_0x20f6a3);})[_0x216e('0x1a')](function(_0x179651){_0x4a8af2['rows']=_0x179651;return _0x4a8af2;})[_0x216e('0x1a')](respondWithFilteredResult(_0x73a185,_0x20f6a3))['catch'](handleError(_0x73a185,null));};exports[_0x216e('0x4e')]=function(_0x1206cd,_0x3ee5de){var _0x433eb6={'raw':!![],'where':{'id':_0x1206cd[_0x216e('0x4f')]['id']}},_0x3b891f={};_0x3b891f[_0x216e('0x3a')]=_[_0x216e('0x36')](db['ChatGroup'][_0x216e('0x50')]);_0x3b891f[_0x216e('0x37')]=_['keys'](_0x1206cd['query']);_0x3b891f[_0x216e('0x43')]=_[_0x216e('0x38')](_0x3b891f['model'],_0x3b891f[_0x216e('0x37')]);_0x433eb6['attributes']=_[_0x216e('0x38')](_0x3b891f[_0x216e('0x3a')],qs[_0x216e('0x3b')](_0x1206cd[_0x216e('0x37')]['fields']));_0x433eb6[_0x216e('0x39')]=_0x433eb6['attributes']['length']?_0x433eb6[_0x216e('0x39')]:_0x3b891f[_0x216e('0x3a')];if(_0x1206cd[_0x216e('0x37')][_0x216e('0x4b')]){_0x433eb6[_0x216e('0x4c')]=[{'all':!![]}];}_0x433eb6=_[_0x216e('0x45')]({},_0x433eb6,_0x1206cd[_0x216e('0x49')]);return db['ChatGroup'][_0x216e('0x51')](_0x433eb6)[_0x216e('0x1a')](handleEntityNotFound(_0x3ee5de,null))['then'](respondWithResult(_0x3ee5de,null))[_0x216e('0x25')](handleError(_0x3ee5de,null));};exports[_0x216e('0x52')]=function(_0x3f702b,_0x5c3f8d){return db[_0x216e('0x35')]['create'](_0x3f702b['body'],{})[_0x216e('0x1a')](respondWithResult(_0x5c3f8d,0xc9))[_0x216e('0x25')](handleError(_0x5c3f8d,null));};exports['update']=function(_0xea5d16,_0x458b84){if(_0xea5d16[_0x216e('0x53')]['id']){delete _0xea5d16[_0x216e('0x53')]['id'];}return db[_0x216e('0x35')][_0x216e('0x51')]({'where':{'id':_0xea5d16[_0x216e('0x4f')]['id']}})[_0x216e('0x1a')](handleEntityNotFound(_0x458b84,null))[_0x216e('0x1a')](saveUpdates(_0xea5d16[_0x216e('0x53')],null))[_0x216e('0x1a')](respondWithResult(_0x458b84,null))[_0x216e('0x25')](handleError(_0x458b84,null));};exports[_0x216e('0x2f')]=function(_0x144604,_0xb463e0){return db[_0x216e('0x35')][_0x216e('0x51')]({'where':{'id':_0x144604['params']['id']}})[_0x216e('0x1a')](handleEntityNotFound(_0xb463e0,null))[_0x216e('0x1a')](removeEntity(_0xb463e0,null))[_0x216e('0x25')](handleError(_0xb463e0,null));};exports[_0x216e('0x54')]=function(_0x18525d,_0x3792fa){return db['ChatGroup'][_0x216e('0x54')]()['then'](respondWithResult(_0x3792fa,null))[_0x216e('0x25')](handleError(_0x3792fa,null));};exports[_0x216e('0x55')]=function(_0x379beb,_0x2acfe1,_0x57ce1f){return db[_0x216e('0x56')][_0x216e('0x4a')]({'where':{'ChatGroupId':_0x379beb['params']['id'],'ToId':_0x379beb[_0x216e('0x57')]['id'],'read':![]}})[_0x216e('0x1a')](function(_0x4c1669){return{'id':_[_0x216e('0x58')](_0x379beb[_0x216e('0x4f')]['id']),'count':_0x4c1669};})['then'](respondWithResult(_0x2acfe1,null))[_0x216e('0x25')](handleError(_0x2acfe1,null));};exports[_0x216e('0x59')]=function(_0x55c8d7,_0x1f8a87,_0x43cddb){return db[_0x216e('0x35')]['find']({'where':{'id':_0x55c8d7[_0x216e('0x4f')]['id']}})[_0x216e('0x1a')](handleEntityNotFound(_0x1f8a87,null))[_0x216e('0x1a')](function(_0xe0710a){if(_0xe0710a){return _0xe0710a['addMembers'](_0x55c8d7['body']['ids'],_[_0x216e('0x5a')](_0x55c8d7[_0x216e('0x53')],[_0x216e('0x5b'),'id'])||{});}})[_0x216e('0x1a')](respondWithResult(_0x1f8a87,null))[_0x216e('0x25')](handleError(_0x1f8a87,null));};exports['getMembers']=function(_0x4100d0,_0x408200,_0x2eb4b9){var _0x349fe1={};var _0x5c1a1b={};var _0x59d428;var _0x4ed532;return db[_0x216e('0x35')][_0x216e('0x5c')]({'where':{'id':_0x4100d0[_0x216e('0x4f')]['id']}})[_0x216e('0x1a')](handleEntityNotFound(_0x408200,null))['then'](function(_0x55e597){if(_0x55e597){_0x59d428=_0x55e597;_0x5c1a1b['model']=_['keys'](db[_0x216e('0x5d')][_0x216e('0x50')]);_0x5c1a1b[_0x216e('0x37')]=_['keys'](_0x4100d0[_0x216e('0x37')]);_0x5c1a1b['filters']=_['intersection'](_0x5c1a1b[_0x216e('0x3a')],_0x5c1a1b[_0x216e('0x37')]);_0x349fe1[_0x216e('0x39')]=_[_0x216e('0x38')](_0x5c1a1b[_0x216e('0x3a')],qs[_0x216e('0x3b')](_0x4100d0['query'][_0x216e('0x3b')]));_0x349fe1[_0x216e('0x39')]=_0x349fe1[_0x216e('0x39')][_0x216e('0x3c')]?_0x349fe1['attributes']:_0x5c1a1b[_0x216e('0x3a')];_0x349fe1[_0x216e('0x40')]=qs[_0x216e('0x41')](_0x4100d0['query']['sort']);_0x349fe1[_0x216e('0x42')]=qs[_0x216e('0x43')](_[_0x216e('0x5e')](_0x4100d0[_0x216e('0x37')],_0x5c1a1b[_0x216e('0x43')]));if(_0x4100d0[_0x216e('0x37')]['filter']){_0x349fe1[_0x216e('0x42')]=_[_0x216e('0x45')](_0x349fe1[_0x216e('0x42')],{'$or':_['map'](_0x349fe1[_0x216e('0x39')],function(_0x29de1b){var _0x13d83d={};_0x13d83d[_0x29de1b]={'$like':'%'+_0x4100d0[_0x216e('0x37')][_0x216e('0x44')]+'%'};return _0x13d83d;})});}_0x349fe1=_['merge']({},_0x349fe1,_0x4100d0['options']);return _0x59d428['getMembers'](_0x349fe1);}})[_0x216e('0x1a')](function(_0x1bb32a){if(_0x1bb32a){_0x4ed532=_0x1bb32a[_0x216e('0x3c')];if(!_0x4100d0['query'][_0x216e('0x3d')](_0x216e('0x3e'))){_0x349fe1[_0x216e('0x3f')]=qs[_0x216e('0x3f')](_0x4100d0[_0x216e('0x37')][_0x216e('0x3f')]);_0x349fe1[_0x216e('0x29')]=qs[_0x216e('0x29')](_0x4100d0[_0x216e('0x37')][_0x216e('0x29')]);}return _0x59d428[_0x216e('0x5f')](_0x349fe1);}})[_0x216e('0x1a')](function(_0x5a6278){if(_0x5a6278){return _0x5a6278?{'count':_0x4ed532,'rows':_0x5a6278}:null;}})[_0x216e('0x1a')](respondWithResult(_0x408200,null))[_0x216e('0x25')](handleError(_0x408200,null));};exports[_0x216e('0x60')]=function(_0x1e720c,_0x479019,_0x340f74){var _0x53a1ed;return db[_0x216e('0x35')][_0x216e('0x51')]({'where':{'id':_0x1e720c[_0x216e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x479019,null))['then'](function(_0x453e73){if(_0x453e73){return _0x453e73[_0x216e('0x60')](_0x1e720c[_0x216e('0x37')][_0x216e('0x5b')]);}})[_0x216e('0x1a')](respondWithStatusCode(_0x479019,null))['catch'](handleError(_0x479019,null));};exports[_0x216e('0x61')]=function(_0x4fea01,_0x2fc8b8,_0xb02731){if(_0x4fea01[_0x216e('0x53')]['id']){delete _0x4fea01[_0x216e('0x53')]['id'];}return db[_0x216e('0x35')][_0x216e('0x51')]({'where':{'id':_0x4fea01[_0x216e('0x4f')]['id']}})[_0x216e('0x1a')](handleEntityNotFound(_0x2fc8b8,null))['then'](function(_0x1ccb95){if(_0x1ccb95){_0x4fea01[_0x216e('0x53')][_0x216e('0x62')]=_0x1ccb95['id'];return db[_0x216e('0x56')][_0x216e('0x52')](_0x4fea01[_0x216e('0x53')]);}})[_0x216e('0x1a')](respondWithResult(_0x2fc8b8,null))[_0x216e('0x25')](handleError(_0x2fc8b8,null));};exports['getMessages']=function(_0x3158b0,_0x18dd68,_0x5acdda){var _0x10e505={};var _0x4bc4d1={};var _0x34c1e3;var _0x4cef20;return db[_0x216e('0x35')]['findOne']({'where':{'id':_0x3158b0[_0x216e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x18dd68,null))[_0x216e('0x1a')](function(_0x44edd6){if(_0x44edd6){_0x34c1e3=_0x44edd6;_0x4bc4d1[_0x216e('0x3a')]=_[_0x216e('0x36')](db[_0x216e('0x56')][_0x216e('0x50')]);_0x4bc4d1[_0x216e('0x37')]=_[_0x216e('0x36')](_0x3158b0[_0x216e('0x37')]);_0x4bc4d1['filters']=_[_0x216e('0x38')](_0x4bc4d1[_0x216e('0x3a')],_0x4bc4d1[_0x216e('0x37')]);_0x10e505[_0x216e('0x39')]=_[_0x216e('0x38')](_0x4bc4d1[_0x216e('0x3a')],qs[_0x216e('0x3b')](_0x3158b0[_0x216e('0x37')][_0x216e('0x3b')]));_0x10e505[_0x216e('0x39')]=_0x10e505[_0x216e('0x39')][_0x216e('0x3c')]?_0x10e505[_0x216e('0x39')]:_0x4bc4d1[_0x216e('0x3a')];_0x10e505[_0x216e('0x40')]=qs['sort'](_0x3158b0['query'][_0x216e('0x41')]);_0x10e505[_0x216e('0x42')]=qs['filters'](_[_0x216e('0x5e')](_0x3158b0[_0x216e('0x37')],_0x4bc4d1[_0x216e('0x43')]));if(_0x3158b0[_0x216e('0x37')][_0x216e('0x44')]){_0x10e505[_0x216e('0x42')]=_[_0x216e('0x45')](_0x10e505['where'],{'$or':_[_0x216e('0x63')](_0x10e505[_0x216e('0x39')],function(_0x46539a){var _0x436dd1={};_0x436dd1[_0x46539a]={'$like':'%'+_0x3158b0[_0x216e('0x37')][_0x216e('0x44')]+'%'};return _0x436dd1;})});}if(_0x3158b0[_0x216e('0x37')][_0x216e('0x64')]){var _0x3d2b3f=_0x3158b0['query']['$gte']['split'](',');var _0x5650a6={};_0x5650a6[_0x3d2b3f[0x0]]={'$gte':moment(_0x3d2b3f[0x1])[_0x216e('0x65')](_0x216e('0x66'))};_0x10e505[_0x216e('0x42')]=_[_0x216e('0x45')](_0x10e505[_0x216e('0x42')],_0x5650a6);}_0x10e505=_[_0x216e('0x45')]({},_0x10e505,_0x3158b0[_0x216e('0x49')]);return _0x34c1e3['getMessages'](_0x10e505);}})[_0x216e('0x1a')](function(_0x4fb648){if(_0x4fb648){_0x4cef20=_0x4fb648[_0x216e('0x3c')];if(!_0x3158b0[_0x216e('0x37')][_0x216e('0x3d')](_0x216e('0x3e'))){_0x10e505[_0x216e('0x3f')]=qs['limit'](_0x3158b0['query'][_0x216e('0x3f')]);_0x10e505[_0x216e('0x29')]=qs[_0x216e('0x29')](_0x3158b0[_0x216e('0x37')][_0x216e('0x29')]);}return _0x34c1e3[_0x216e('0x67')](_0x10e505);}})['then'](function(_0x37587c){if(_0x37587c){return _0x37587c?{'count':_0x4cef20,'rows':_0x37587c}:null;}})[_0x216e('0x1a')](respondWithResult(_0x18dd68,null))[_0x216e('0x25')](handleError(_0x18dd68,null));}; \ No newline at end of file +var _0x5b66=['describe','getUnread','ChatInternalMessage','addMembers','ids','omit','getMembers','findOne','User','filter','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','querystring','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','jayson/promise','http','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','reject','save','destroy','stack','name','send','index','ChatGroup','rawAttributes','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','type','VIRTUAL','field','includeAll','include','findAll','show','fields','options','find','create','body','params'];(function(_0xa7e836,_0x613d38){var _0x167c6d=function(_0x3bc0d8){while(--_0x3bc0d8){_0xa7e836['push'](_0xa7e836['shift']());}};_0x167c6d(++_0x613d38);}(_0x5b66,0xe4));var _0x65b6=function(_0x4e787c,_0x24321f){_0x4e787c=_0x4e787c-0x0;var _0x506f13=_0x5b66[_0x4e787c];return _0x506f13;};'use strict';var pdf=require(_0x65b6('0x0'));var emlformat=require(_0x65b6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x65b6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x65b6('0x3'));var moment=require(_0x65b6('0x4'));var BPromise=require(_0x65b6('0x5'));var Mustache=require(_0x65b6('0x6'));var util=require(_0x65b6('0x7'));var path=require(_0x65b6('0x8'));var sox=require(_0x65b6('0x9'));var csv=require(_0x65b6('0xa'));var ejs=require(_0x65b6('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x65b6('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x65b6('0xd'));var Papa=require('papaparse');var authService=require(_0x65b6('0xe'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x65b6('0xf'));var qs=require(_0x65b6('0x10'));var logger=require(_0x65b6('0x11'))(_0x65b6('0x12'));var utils=require(_0x65b6('0x13'));var config=require('../../config/environment');var db=require(_0x65b6('0x14'))['db'];config[_0x65b6('0x15')]=_[_0x65b6('0x16')](config[_0x65b6('0x15')],{'host':_0x65b6('0x17'),'port':0x18eb});var socket=require(_0x65b6('0x18'))(new Redis(config[_0x65b6('0x15')]));require(_0x65b6('0x19'))['register'](socket);var jayson=require(_0x65b6('0x1a'));var client=jayson['client'][_0x65b6('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x369f87,_0x5c9a20,_0x5e434d,_0x3a571c){return new BPromise(function(_0x387065,_0x84b07){var _0x588af1=_0x3a571c||client;return _0x588af1[_0x65b6('0x1c')](_0x369f87,_0x5e434d)[_0x65b6('0x1d')](function(_0x43114c){logger[_0x65b6('0x1e')](_0x65b6('0x1f'),_0x5c9a20,_0x65b6('0x20'));logger[_0x65b6('0x21')](_0x65b6('0x22'),_0x5c9a20,_0x65b6('0x20'),JSON[_0x65b6('0x23')](_0x43114c));if(_0x43114c[_0x65b6('0x24')]){if(_0x43114c[_0x65b6('0x24')][_0x65b6('0x25')]===0x1f4){logger['error'](_0x65b6('0x1f'),_0x5c9a20,_0x43114c[_0x65b6('0x24')][_0x65b6('0x26')]);return _0x84b07(_0x43114c[_0x65b6('0x24')]['message']);}logger[_0x65b6('0x24')]('ChatGroup,\x20%s,\x20%s',_0x5c9a20,_0x43114c[_0x65b6('0x24')][_0x65b6('0x26')]);return _0x387065(_0x43114c['error']['message']);}else{logger[_0x65b6('0x1e')](_0x65b6('0x1f'),_0x5c9a20,'request\x20sent');_0x387065(_0x43114c[_0x65b6('0x27')][_0x65b6('0x26')]);}})[_0x65b6('0x28')](function(_0x2d62a4){logger[_0x65b6('0x24')](_0x65b6('0x1f'),_0x5c9a20,_0x2d62a4);_0x84b07(_0x2d62a4);});});}function respondWithStatusCode(_0x45aebf,_0x22bf60){_0x22bf60=_0x22bf60||0xcc;return function(_0x5190a1){if(_0x5190a1){return _0x45aebf[_0x65b6('0x29')](_0x22bf60);}return _0x45aebf['status'](_0x22bf60)[_0x65b6('0x2a')]();};}function respondWithResult(_0x2a2503,_0x122cbc){_0x122cbc=_0x122cbc||0xc8;return function(_0x5093ab){if(_0x5093ab){return _0x2a2503[_0x65b6('0x2b')](_0x122cbc)['json'](_0x5093ab);}};}function respondWithFilteredResult(_0x141f8f,_0x2aaa83){return function(_0x2a0c41){if(_0x2a0c41){var _0x2b2d64=_0x2a0c41[_0x65b6('0x2c')],_0x421e78=_0x2aaa83[_0x65b6('0x2d')],_0x2c2980=_0x2aaa83[_0x65b6('0x2d')]+_0x2aaa83[_0x65b6('0x2e')],_0x393ec6;if(_0x2c2980>=_0x2b2d64){_0x2c2980=_0x2b2d64;_0x393ec6=0xc8;}else{_0x393ec6=0xce;}_0x141f8f[_0x65b6('0x2b')](_0x393ec6);return _0x141f8f['set'](_0x65b6('0x2f'),_0x421e78+'-'+_0x2c2980+'/'+_0x2b2d64)[_0x65b6('0x30')](_0x2a0c41);}return null;};}function patchUpdates(_0x338d56){return function(_0x45b5e8){try{jsonpatch[_0x65b6('0x31')](_0x45b5e8,_0x338d56,!![]);}catch(_0x4ed9ec){return BPromise[_0x65b6('0x32')](_0x4ed9ec);}return _0x45b5e8[_0x65b6('0x33')]();};}function saveUpdates(_0x4ad07c,_0x51afe0){return function(_0x5e8d9f){if(_0x5e8d9f){return _0x5e8d9f['update'](_0x4ad07c)[_0x65b6('0x1d')](function(_0x228a29){return _0x228a29;});}return null;};}function removeEntity(_0x59ef35,_0x11832b){return function(_0x3d6bad){if(_0x3d6bad){return _0x3d6bad[_0x65b6('0x34')]()[_0x65b6('0x1d')](function(){_0x59ef35[_0x65b6('0x2b')](0xcc)[_0x65b6('0x2a')]();});}};}function handleEntityNotFound(_0x513e79,_0x2df22c){return function(_0x3ae0a4){if(!_0x3ae0a4){_0x513e79['sendStatus'](0x194);}return _0x3ae0a4;};}function handleError(_0x27ec62,_0xc4c5eb){_0xc4c5eb=_0xc4c5eb||0x1f4;return function(_0x4feebf){logger[_0x65b6('0x24')](_0x4feebf[_0x65b6('0x35')]);if(_0x4feebf['name']){delete _0x4feebf[_0x65b6('0x36')];}_0x27ec62[_0x65b6('0x2b')](_0xc4c5eb)[_0x65b6('0x37')](_0x4feebf);};}exports[_0x65b6('0x38')]=function(_0x1ddb43,_0xaf8654){var _0x11ab04={},_0x1bf222={},_0x51af50={'count':0x0,'rows':[]};var _0x10077c=db[_0x65b6('0x39')][_0x65b6('0x3a')];_0x1bf222[_0x65b6('0x3b')]=_[_0x65b6('0x3c')](_0x10077c);_0x1bf222[_0x65b6('0x3d')]=_['keys'](_0x1ddb43[_0x65b6('0x3d')]);_0x1bf222[_0x65b6('0x3e')]=_[_0x65b6('0x3f')](_0x1bf222[_0x65b6('0x3b')],_0x1bf222['query']);_0x11ab04[_0x65b6('0x40')]=_[_0x65b6('0x3f')](_0x1bf222[_0x65b6('0x3b')],qs['fields'](_0x1ddb43['query']['fields']));_0x11ab04[_0x65b6('0x40')]=_0x11ab04[_0x65b6('0x40')][_0x65b6('0x41')]?_0x11ab04['attributes']:_0x1bf222[_0x65b6('0x3b')];if(!_0x1ddb43[_0x65b6('0x3d')][_0x65b6('0x42')](_0x65b6('0x43'))){_0x11ab04['limit']=qs[_0x65b6('0x2e')](_0x1ddb43[_0x65b6('0x3d')][_0x65b6('0x2e')]);_0x11ab04[_0x65b6('0x2d')]=qs['offset'](_0x1ddb43[_0x65b6('0x3d')][_0x65b6('0x2d')]);}_0x11ab04[_0x65b6('0x44')]=qs[_0x65b6('0x45')](_0x1ddb43[_0x65b6('0x3d')]['sort']);_0x11ab04['where']=qs[_0x65b6('0x3e')](_[_0x65b6('0x46')](_0x1ddb43[_0x65b6('0x3d')],_0x1bf222[_0x65b6('0x3e')]));if(_0x1ddb43[_0x65b6('0x3d')]['filter']){_0x11ab04[_0x65b6('0x47')]=_[_0x65b6('0x48')](_0x11ab04[_0x65b6('0x47')],{'$or':_[_0x65b6('0x49')](_0x10077c,function(_0x46f950){if(_0x46f950[_0x65b6('0x4a')]['key']!==_0x65b6('0x4b')){var _0x31ae30={};_0x31ae30[_0x46f950[_0x65b6('0x4c')]]={'$like':'%'+_0x1ddb43[_0x65b6('0x3d')]['filter']+'%'};return _0x31ae30;}})});}_0x11ab04=_[_0x65b6('0x48')]({},_0x11ab04,_0x1ddb43['options']);var _0x51e473={'where':_0x11ab04[_0x65b6('0x47')]};return db['ChatGroup']['count'](_0x51e473)['then'](function(_0x4a2194){_0x51af50[_0x65b6('0x2c')]=_0x4a2194;if(_0x1ddb43['query'][_0x65b6('0x4d')]){_0x11ab04[_0x65b6('0x4e')]=[{'all':!![]}];}return db[_0x65b6('0x39')][_0x65b6('0x4f')](_0x11ab04);})['then'](function(_0x583611){_0x51af50['rows']=_0x583611;return _0x51af50;})[_0x65b6('0x1d')](respondWithFilteredResult(_0xaf8654,_0x11ab04))[_0x65b6('0x28')](handleError(_0xaf8654,null));};exports[_0x65b6('0x50')]=function(_0x515dae,_0x2cf246){var _0x31f38d={'raw':!![],'where':{'id':_0x515dae['params']['id']}},_0x1850d1={};_0x1850d1[_0x65b6('0x3b')]=_[_0x65b6('0x3c')](db[_0x65b6('0x39')]['rawAttributes']);_0x1850d1[_0x65b6('0x3d')]=_[_0x65b6('0x3c')](_0x515dae['query']);_0x1850d1[_0x65b6('0x3e')]=_[_0x65b6('0x3f')](_0x1850d1[_0x65b6('0x3b')],_0x1850d1[_0x65b6('0x3d')]);_0x31f38d[_0x65b6('0x40')]=_[_0x65b6('0x3f')](_0x1850d1[_0x65b6('0x3b')],qs[_0x65b6('0x51')](_0x515dae[_0x65b6('0x3d')]['fields']));_0x31f38d[_0x65b6('0x40')]=_0x31f38d['attributes'][_0x65b6('0x41')]?_0x31f38d[_0x65b6('0x40')]:_0x1850d1[_0x65b6('0x3b')];if(_0x515dae[_0x65b6('0x3d')]['includeAll']){_0x31f38d[_0x65b6('0x4e')]=[{'all':!![]}];}_0x31f38d=_['merge']({},_0x31f38d,_0x515dae[_0x65b6('0x52')]);return db[_0x65b6('0x39')][_0x65b6('0x53')](_0x31f38d)[_0x65b6('0x1d')](handleEntityNotFound(_0x2cf246,null))[_0x65b6('0x1d')](respondWithResult(_0x2cf246,null))['catch'](handleError(_0x2cf246,null));};exports[_0x65b6('0x54')]=function(_0x3962ed,_0x2f679d){return db[_0x65b6('0x39')][_0x65b6('0x54')](_0x3962ed[_0x65b6('0x55')],{})[_0x65b6('0x1d')](respondWithResult(_0x2f679d,0xc9))['catch'](handleError(_0x2f679d,null));};exports['update']=function(_0x50b89c,_0x1f00d9){if(_0x50b89c[_0x65b6('0x55')]['id']){delete _0x50b89c[_0x65b6('0x55')]['id'];}return db[_0x65b6('0x39')]['find']({'where':{'id':_0x50b89c[_0x65b6('0x56')]['id']}})[_0x65b6('0x1d')](handleEntityNotFound(_0x1f00d9,null))[_0x65b6('0x1d')](saveUpdates(_0x50b89c['body'],null))[_0x65b6('0x1d')](respondWithResult(_0x1f00d9,null))[_0x65b6('0x28')](handleError(_0x1f00d9,null));};exports[_0x65b6('0x34')]=function(_0x44173b,_0x47f6e3){return db[_0x65b6('0x39')]['find']({'where':{'id':_0x44173b[_0x65b6('0x56')]['id']}})[_0x65b6('0x1d')](handleEntityNotFound(_0x47f6e3,null))[_0x65b6('0x1d')](removeEntity(_0x47f6e3,null))['catch'](handleError(_0x47f6e3,null));};exports[_0x65b6('0x57')]=function(_0x47e8e4,_0x46dc67){return db['ChatGroup']['describe']()['then'](respondWithResult(_0x46dc67,null))[_0x65b6('0x28')](handleError(_0x46dc67,null));};exports[_0x65b6('0x58')]=function(_0x5bac41,_0x169036,_0x582393){return db[_0x65b6('0x59')][_0x65b6('0x2c')]({'where':{'ChatGroupId':_0x5bac41[_0x65b6('0x56')]['id'],'ToId':_0x5bac41['user']['id'],'read':![]}})[_0x65b6('0x1d')](function(_0x480f06){return{'id':_['toInteger'](_0x5bac41[_0x65b6('0x56')]['id']),'count':_0x480f06};})['then'](respondWithResult(_0x169036,null))[_0x65b6('0x28')](handleError(_0x169036,null));};exports[_0x65b6('0x5a')]=function(_0x597a48,_0x58276d,_0x11cd6f){return db['ChatGroup'][_0x65b6('0x53')]({'where':{'id':_0x597a48[_0x65b6('0x56')]['id']}})[_0x65b6('0x1d')](handleEntityNotFound(_0x58276d,null))[_0x65b6('0x1d')](function(_0x142382){if(_0x142382){return _0x142382['addMembers'](_0x597a48['body'][_0x65b6('0x5b')],_[_0x65b6('0x5c')](_0x597a48['body'],['ids','id'])||{});}})[_0x65b6('0x1d')](respondWithResult(_0x58276d,null))['catch'](handleError(_0x58276d,null));};exports[_0x65b6('0x5d')]=function(_0x55d5e9,_0x11ec09,_0xde431b){var _0x2e82c6={};var _0x472268={};var _0x4dd6a1;var _0x586aff;return db[_0x65b6('0x39')][_0x65b6('0x5e')]({'where':{'id':_0x55d5e9[_0x65b6('0x56')]['id']}})[_0x65b6('0x1d')](handleEntityNotFound(_0x11ec09,null))[_0x65b6('0x1d')](function(_0x5c4a6e){if(_0x5c4a6e){_0x4dd6a1=_0x5c4a6e;_0x472268[_0x65b6('0x3b')]=_[_0x65b6('0x3c')](db[_0x65b6('0x5f')][_0x65b6('0x3a')]);_0x472268[_0x65b6('0x3d')]=_['keys'](_0x55d5e9[_0x65b6('0x3d')]);_0x472268[_0x65b6('0x3e')]=_[_0x65b6('0x3f')](_0x472268[_0x65b6('0x3b')],_0x472268[_0x65b6('0x3d')]);_0x2e82c6[_0x65b6('0x40')]=_[_0x65b6('0x3f')](_0x472268[_0x65b6('0x3b')],qs[_0x65b6('0x51')](_0x55d5e9['query'][_0x65b6('0x51')]));_0x2e82c6[_0x65b6('0x40')]=_0x2e82c6[_0x65b6('0x40')][_0x65b6('0x41')]?_0x2e82c6['attributes']:_0x472268[_0x65b6('0x3b')];_0x2e82c6[_0x65b6('0x44')]=qs[_0x65b6('0x45')](_0x55d5e9[_0x65b6('0x3d')][_0x65b6('0x45')]);_0x2e82c6[_0x65b6('0x47')]=qs[_0x65b6('0x3e')](_['pick'](_0x55d5e9[_0x65b6('0x3d')],_0x472268['filters']));if(_0x55d5e9[_0x65b6('0x3d')][_0x65b6('0x60')]){_0x2e82c6[_0x65b6('0x47')]=_['merge'](_0x2e82c6[_0x65b6('0x47')],{'$or':_[_0x65b6('0x49')](_0x2e82c6[_0x65b6('0x40')],function(_0x141ac4){var _0xcb3406={};_0xcb3406[_0x141ac4]={'$like':'%'+_0x55d5e9[_0x65b6('0x3d')][_0x65b6('0x60')]+'%'};return _0xcb3406;})});}_0x2e82c6=_[_0x65b6('0x48')]({},_0x2e82c6,_0x55d5e9['options']);return _0x4dd6a1[_0x65b6('0x5d')](_0x2e82c6);}})[_0x65b6('0x1d')](function(_0x870420){if(_0x870420){_0x586aff=_0x870420[_0x65b6('0x41')];if(!_0x55d5e9[_0x65b6('0x3d')][_0x65b6('0x42')]('nolimit')){_0x2e82c6[_0x65b6('0x2e')]=qs[_0x65b6('0x2e')](_0x55d5e9[_0x65b6('0x3d')][_0x65b6('0x2e')]);_0x2e82c6['offset']=qs[_0x65b6('0x2d')](_0x55d5e9[_0x65b6('0x3d')][_0x65b6('0x2d')]);}return _0x4dd6a1['getMembers'](_0x2e82c6);}})['then'](function(_0x338cb0){if(_0x338cb0){return _0x338cb0?{'count':_0x586aff,'rows':_0x338cb0}:null;}})['then'](respondWithResult(_0x11ec09,null))[_0x65b6('0x28')](handleError(_0x11ec09,null));};exports[_0x65b6('0x61')]=function(_0x533130,_0x148fb1,_0x559880){var _0x2ee472;return db[_0x65b6('0x39')][_0x65b6('0x53')]({'where':{'id':_0x533130[_0x65b6('0x56')]['id']}})[_0x65b6('0x1d')](handleEntityNotFound(_0x148fb1,null))['then'](function(_0x5227db){if(_0x5227db){return _0x5227db[_0x65b6('0x61')](_0x533130[_0x65b6('0x3d')][_0x65b6('0x5b')]);}})[_0x65b6('0x1d')](respondWithStatusCode(_0x148fb1,null))[_0x65b6('0x28')](handleError(_0x148fb1,null));};exports[_0x65b6('0x62')]=function(_0x128d13,_0xaa4052,_0x7a59a8){if(_0x128d13[_0x65b6('0x55')]['id']){delete _0x128d13[_0x65b6('0x55')]['id'];}return db[_0x65b6('0x39')]['find']({'where':{'id':_0x128d13['params']['id']}})[_0x65b6('0x1d')](handleEntityNotFound(_0xaa4052,null))[_0x65b6('0x1d')](function(_0xa85f27){if(_0xa85f27){_0x128d13[_0x65b6('0x55')][_0x65b6('0x63')]=_0xa85f27['id'];return db['ChatInternalMessage'][_0x65b6('0x54')](_0x128d13[_0x65b6('0x55')]);}})[_0x65b6('0x1d')](respondWithResult(_0xaa4052,null))[_0x65b6('0x28')](handleError(_0xaa4052,null));};exports[_0x65b6('0x64')]=function(_0x46aa94,_0x451290,_0x2ab673){var _0x58158e={};var _0x529b56={};var _0x424a47;var _0x44d3e3;return db[_0x65b6('0x39')][_0x65b6('0x5e')]({'where':{'id':_0x46aa94[_0x65b6('0x56')]['id']}})['then'](handleEntityNotFound(_0x451290,null))['then'](function(_0x3ef20c){if(_0x3ef20c){_0x424a47=_0x3ef20c;_0x529b56[_0x65b6('0x3b')]=_[_0x65b6('0x3c')](db[_0x65b6('0x59')][_0x65b6('0x3a')]);_0x529b56['query']=_[_0x65b6('0x3c')](_0x46aa94['query']);_0x529b56[_0x65b6('0x3e')]=_[_0x65b6('0x3f')](_0x529b56[_0x65b6('0x3b')],_0x529b56['query']);_0x58158e[_0x65b6('0x40')]=_[_0x65b6('0x3f')](_0x529b56[_0x65b6('0x3b')],qs[_0x65b6('0x51')](_0x46aa94[_0x65b6('0x3d')]['fields']));_0x58158e[_0x65b6('0x40')]=_0x58158e[_0x65b6('0x40')]['length']?_0x58158e[_0x65b6('0x40')]:_0x529b56[_0x65b6('0x3b')];_0x58158e[_0x65b6('0x44')]=qs[_0x65b6('0x45')](_0x46aa94[_0x65b6('0x3d')][_0x65b6('0x45')]);_0x58158e[_0x65b6('0x47')]=qs[_0x65b6('0x3e')](_['pick'](_0x46aa94['query'],_0x529b56['filters']));if(_0x46aa94[_0x65b6('0x3d')][_0x65b6('0x60')]){_0x58158e[_0x65b6('0x47')]=_[_0x65b6('0x48')](_0x58158e[_0x65b6('0x47')],{'$or':_[_0x65b6('0x49')](_0x58158e[_0x65b6('0x40')],function(_0x1f5987){var _0xf9ed83={};_0xf9ed83[_0x1f5987]={'$like':'%'+_0x46aa94[_0x65b6('0x3d')]['filter']+'%'};return _0xf9ed83;})});}if(_0x46aa94[_0x65b6('0x3d')]['$gte']){var _0x281929=_0x46aa94['query'][_0x65b6('0x65')][_0x65b6('0x66')](',');var _0x568a1f={};_0x568a1f[_0x281929[0x0]]={'$gte':moment(_0x281929[0x1])[_0x65b6('0x67')](_0x65b6('0x68'))};_0x58158e['where']=_[_0x65b6('0x48')](_0x58158e['where'],_0x568a1f);}_0x58158e=_[_0x65b6('0x48')]({},_0x58158e,_0x46aa94['options']);return _0x424a47['getMessages'](_0x58158e);}})[_0x65b6('0x1d')](function(_0x1ec418){if(_0x1ec418){_0x44d3e3=_0x1ec418[_0x65b6('0x41')];if(!_0x46aa94['query'][_0x65b6('0x42')](_0x65b6('0x43'))){_0x58158e[_0x65b6('0x2e')]=qs[_0x65b6('0x2e')](_0x46aa94['query']['limit']);_0x58158e[_0x65b6('0x2d')]=qs[_0x65b6('0x2d')](_0x46aa94['query'][_0x65b6('0x2d')]);}return _0x424a47[_0x65b6('0x64')](_0x58158e);}})[_0x65b6('0x1d')](function(_0x11924b){if(_0x11924b){return _0x11924b?{'count':_0x44d3e3,'rows':_0x11924b}:null;}})[_0x65b6('0x1d')](respondWithResult(_0x451290,null))['catch'](handleError(_0x451290,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 7339f77..20049db 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 _0x8851=['save','update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x58aa5e,_0x2bad85){var _0x563d72=function(_0x5b6a82){while(--_0x5b6a82){_0x58aa5e['push'](_0x58aa5e['shift']());}};_0x563d72(++_0x2bad85);}(_0x8851,0xb2));var _0x1885=function(_0x98a7f4,_0x26a940){_0x98a7f4=_0x98a7f4-0x0;var _0x1d8a5a=_0x8851[_0x98a7f4];return _0x1d8a5a;};'use strict';var EventEmitter=require(_0x1885('0x0'));var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x1885('0x1')](0x0);var events={'afterCreate':_0x1885('0x2'),'afterUpdate':_0x1885('0x3'),'afterDestroy':_0x1885('0x4')};function emitEvent(_0x12c7ef){return function(_0x52ac19,_0x1bc20d,_0x547e33){ChatGroupEvents[_0x1885('0x5')](_0x12c7ef+':'+_0x52ac19['id'],_0x52ac19);ChatGroupEvents[_0x1885('0x5')](_0x12c7ef,_0x52ac19);_0x547e33(null);};}for(var e in events){if(events[_0x1885('0x6')](e)){var event=events[e];ChatGroup[_0x1885('0x7')](e,emitEvent(event));}}module[_0x1885('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0xdb35=['hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit'];(function(_0x34828a,_0x83f9b2){var _0x899b52=function(_0x14abe9){while(--_0x14abe9){_0x34828a['push'](_0x34828a['shift']());}};_0x899b52(++_0x83f9b2);}(_0xdb35,0x185));var _0x5db3=function(_0x51941c,_0x3fe3b6){_0x51941c=_0x51941c-0x0;var _0xf641fd=_0xdb35[_0x51941c];return _0xf641fd;};'use strict';var EventEmitter=require(_0x5db3('0x0'));var ChatGroup=require(_0x5db3('0x1'))['db'][_0x5db3('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x5db3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5db3('0x4'),'afterDestroy':_0x5db3('0x5')};function emitEvent(_0x5ad2b1){return function(_0x5aff06,_0x1027d9,_0x2158b6){ChatGroupEvents[_0x5db3('0x6')](_0x5ad2b1+':'+_0x5aff06['id'],_0x5aff06);ChatGroupEvents['emit'](_0x5ad2b1,_0x5aff06);_0x2158b6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x5db3('0x7')](e,emitEvent(event));}}module[_0x5db3('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 9d23976..707d894 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 _0x3d70=['request-promise','exports','define','ChatGroup','lodash','util','../../config/logger','moment','bluebird'];(function(_0x5684c2,_0x1dc38f){var _0x53311a=function(_0x32b236){while(--_0x32b236){_0x5684c2['push'](_0x5684c2['shift']());}};_0x53311a(++_0x1dc38f);}(_0x3d70,0x112));var _0x03d7=function(_0x4ec7f2,_0x3d92d2){_0x4ec7f2=_0x4ec7f2-0x0;var _0x118004=_0x3d70[_0x4ec7f2];return _0x118004;};'use strict';var _=require(_0x03d7('0x0'));var util=require(_0x03d7('0x1'));var logger=require(_0x03d7('0x2'))('api');var moment=require(_0x03d7('0x3'));var BPromise=require(_0x03d7('0x4'));var rp=require(_0x03d7('0x5'));var attributes=require('./chatGroup.attributes');module[_0x03d7('0x6')]=function(_0x3f4553,_0x37fa4d){return _0x3f4553[_0x03d7('0x7')](_0x03d7('0x8'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd46b=['./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x45bee0,_0x42bf09){var _0x1fcfd5=function(_0x235b6a){while(--_0x235b6a){_0x45bee0['push'](_0x45bee0['shift']());}};_0x1fcfd5(++_0x42bf09);}(_0xd46b,0x14f));var _0xbd46=function(_0x2514ec,_0x51e1c2){_0x2514ec=_0x2514ec-0x0;var _0x4a4ec3=_0xd46b[_0x2514ec];return _0x4a4ec3;};'use strict';var _=require(_0xbd46('0x0'));var util=require(_0xbd46('0x1'));var logger=require(_0xbd46('0x2'))(_0xbd46('0x3'));var moment=require(_0xbd46('0x4'));var BPromise=require('bluebird');var rp=require(_0xbd46('0x5'));var attributes=require(_0xbd46('0x6'));module[_0xbd46('0x7')]=function(_0x3a3586,_0x56ae17){return _0x3a3586[_0xbd46('0x8')](_0xbd46('0x9'),attributes,{'tableName':_0xbd46('0xa'),'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 eff494c..d52b8bd 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 _0x54ef=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./chatGroup.socket','request','then','info','request\x20sent','stringify','error','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x14036,_0x85c99f){var _0x1d913f=function(_0x4b95a5){while(--_0x4b95a5){_0x14036['push'](_0x14036['shift']());}};_0x1d913f(++_0x85c99f);}(_0x54ef,0x112));var _0xf54e=function(_0xfc350e,_0x52c955){_0xfc350e=_0xfc350e-0x0;var _0x5b5182=_0x54ef[_0xfc350e];return _0x5b5182;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});config[_0xf54e('0xb')]=_[_0xf54e('0xc')](config['redis'],{'host':_0xf54e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf54e('0xb')]));require(_0xf54e('0xe'))['register'](socket);function respondWithRpcPromise(_0x26fc3e,_0xefa1c0,_0x6b9e61){return new BPromise(function(_0x3ecfb3,_0x5f232a){return client[_0xf54e('0xf')](_0x26fc3e,_0x6b9e61)[_0xf54e('0x10')](function(_0x143d66){logger[_0xf54e('0x11')]('ChatGroup,\x20%s,\x20%s',_0xefa1c0,_0xf54e('0x12'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0xefa1c0,_0xf54e('0x12'),JSON[_0xf54e('0x13')](_0x143d66));if(_0x143d66[_0xf54e('0x14')]){if(_0x143d66[_0xf54e('0x14')]['code']===0x1f4){logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x143d66[_0xf54e('0x14')][_0xf54e('0x16')]);return _0x5f232a(_0x143d66['error'][_0xf54e('0x16')]);}logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x143d66['error']['message']);return _0x3ecfb3(_0x143d66[_0xf54e('0x14')][_0xf54e('0x16')]);}else{logger[_0xf54e('0x11')](_0xf54e('0x15'),_0xefa1c0,_0xf54e('0x12'));_0x3ecfb3(_0x143d66[_0xf54e('0x17')][_0xf54e('0x16')]);}})[_0xf54e('0x18')](function(_0x1dcc04){logger[_0xf54e('0x14')](_0xf54e('0x15'),_0xefa1c0,_0x1dcc04);_0x5f232a(_0x1dcc04);});});} \ No newline at end of file +var _0xeec6=['localhost','socket.io-emitter','./chatGroup.socket','register','request','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis'];(function(_0x3307b3,_0x1828c6){var _0x48829e=function(_0x2d4143){while(--_0x2d4143){_0x3307b3['push'](_0x3307b3['shift']());}};_0x48829e(++_0x1828c6);}(_0xeec6,0x1c2));var _0x6eec=function(_0x191c44,_0x20a896){_0x191c44=_0x191c44-0x0;var _0x1086cd=_0xeec6[_0x191c44];return _0x1086cd;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var BPromise=require(_0x6eec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eec('0xa')][_0x6eec('0xb')]({'port':0x232a});config['redis']=_[_0x6eec('0xc')](config[_0x6eec('0xd')],{'host':_0x6eec('0xe'),'port':0x18eb});var socket=require(_0x6eec('0xf'))(new Redis(config['redis']));require(_0x6eec('0x10'))[_0x6eec('0x11')](socket);function respondWithRpcPromise(_0x1c774d,_0x49ad4c,_0x595dd4){return new BPromise(function(_0x5e8aba,_0x295cae){return client[_0x6eec('0x12')](_0x1c774d,_0x595dd4)['then'](function(_0x4b8de1){logger[_0x6eec('0x13')]('ChatGroup,\x20%s,\x20%s',_0x49ad4c,_0x6eec('0x14'));logger[_0x6eec('0x15')](_0x6eec('0x16'),_0x49ad4c,_0x6eec('0x14'),JSON[_0x6eec('0x17')](_0x4b8de1));if(_0x4b8de1['error']){if(_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x19')]===0x1f4){logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x1b')]);return _0x295cae(_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x1b')]);}logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x4b8de1['error'][_0x6eec('0x1b')]);return _0x5e8aba(_0x4b8de1['error'][_0x6eec('0x1b')]);}else{logger[_0x6eec('0x13')]('ChatGroup,\x20%s,\x20%s',_0x49ad4c,_0x6eec('0x14'));_0x5e8aba(_0x4b8de1[_0x6eec('0x1c')][_0x6eec('0x1b')]);}})['catch'](function(_0x87f3be){logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x87f3be);_0x295cae(_0x87f3be);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 04ffe07..c817bb1 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 _0xff96=['chatGroup:','./chatGroup.events','save','remove','update','emit','removeListener','register'];(function(_0x22ae67,_0x3c884c){var _0x2ea3e1=function(_0x24450d){while(--_0x24450d){_0x22ae67['push'](_0x22ae67['shift']());}};_0x2ea3e1(++_0x3c884c);}(_0xff96,0x179));var _0x6ff9=function(_0xe1a964,_0x5ec09d){_0xe1a964=_0xe1a964-0x0;var _0x3de37b=_0xff96[_0xe1a964];return _0x3de37b;};'use strict';var ChatGroupEvents=require(_0x6ff9('0x0'));var events=[_0x6ff9('0x1'),_0x6ff9('0x2'),_0x6ff9('0x3')];function createListener(_0xa3cf6b,_0x19b956){return function(_0xc1de29){_0x19b956[_0x6ff9('0x4')](_0xa3cf6b,_0xc1de29);};}function removeListener(_0x3561d7,_0x207c06){return function(){ChatGroupEvents[_0x6ff9('0x5')](_0x3561d7,_0x207c06);};}exports[_0x6ff9('0x6')]=function(_0x4adb77){for(var _0x3efaff=0x0,_0x5509ee=events['length'];_0x3efaff<_0x5509ee;_0x3efaff++){var _0x4f982b=events[_0x3efaff];var _0x5d56f4=createListener(_0x6ff9('0x7')+_0x4f982b,_0x4adb77);ChatGroupEvents['on'](_0x4f982b,_0x5d56f4);}}; \ No newline at end of file +var _0x34e5=['update','emit','removeListener','register','length','chatGroup:','save'];(function(_0x4978b6,_0x1780cd){var _0x5f3821=function(_0x4ea812){while(--_0x4ea812){_0x4978b6['push'](_0x4978b6['shift']());}};_0x5f3821(++_0x1780cd);}(_0x34e5,0x172));var _0x534e=function(_0x549bec,_0x48eeb3){_0x549bec=_0x549bec-0x0;var _0x2648db=_0x34e5[_0x549bec];return _0x2648db;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x534e('0x0'),'remove',_0x534e('0x1')];function createListener(_0x467e3e,_0x425ae8){return function(_0x246650){_0x425ae8[_0x534e('0x2')](_0x467e3e,_0x246650);};}function removeListener(_0x50b790,_0x11a158){return function(){ChatGroupEvents[_0x534e('0x3')](_0x50b790,_0x11a158);};}exports[_0x534e('0x4')]=function(_0x117f0c){for(var _0x436a92=0x0,_0x2d0370=events[_0x534e('0x5')];_0x436a92<_0x2d0370;_0x436a92++){var _0x5620d4=events[_0x436a92];var _0x24d562=createListener(_0x534e('0x6')+_0x5620d4,_0x117f0c);ChatGroupEvents['on'](_0x5620d4,_0x24d562);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 741f763..6d0de0f 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 _0x79d9=['multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','/:id/unread','/:id/members','getMessages','create','post','addMembers','/:id/messages','addMessage','put','update','delete','destroy','exports'];(function(_0x6552e9,_0x232ad2){var _0x30d56b=function(_0x2d346f){while(--_0x2d346f){_0x6552e9['push'](_0x6552e9['shift']());}};_0x30d56b(++_0x232ad2);}(_0x79d9,0xcf));var _0x979d=function(_0x115b6f,_0x1bc6ce){_0x115b6f=_0x115b6f-0x0;var _0x2327b2=_0x79d9[_0x115b6f];return _0x2327b2;};'use strict';var multer=require(_0x979d('0x0'));var util=require(_0x979d('0x1'));var path=require('path');var timeout=require(_0x979d('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x979d('0x3'));var interaction=require(_0x979d('0x4'));var config=require('../../config/environment');var controller=require('./chatGroup.controller');router[_0x979d('0x5')]('/',auth[_0x979d('0x6')](),controller[_0x979d('0x7')]);router[_0x979d('0x5')]('/describe',auth['isAuthenticated'](),controller[_0x979d('0x8')]);router[_0x979d('0x5')](_0x979d('0x9'),auth[_0x979d('0x6')](),controller['show']);router[_0x979d('0x5')](_0x979d('0xa'),auth[_0x979d('0x6')](),controller['getUnread']);router[_0x979d('0x5')](_0x979d('0xb'),auth[_0x979d('0x6')](),controller['getMembers']);router[_0x979d('0x5')]('/:id/messages',auth[_0x979d('0x6')](),controller[_0x979d('0xc')]);router['post']('/',auth[_0x979d('0x6')](),controller[_0x979d('0xd')]);router[_0x979d('0xe')](_0x979d('0xb'),auth[_0x979d('0x6')](),controller[_0x979d('0xf')]);router[_0x979d('0xe')](_0x979d('0x10'),auth['isAuthenticated'](),controller[_0x979d('0x11')]);router[_0x979d('0x12')](_0x979d('0x9'),auth['isAuthenticated'](),controller[_0x979d('0x13')]);router[_0x979d('0x14')](_0x979d('0x9'),auth[_0x979d('0x6')](),controller[_0x979d('0x15')]);router[_0x979d('0x14')]('/:id/members',auth[_0x979d('0x6')](),controller['removeMembers']);module[_0x979d('0x16')]=router; \ No newline at end of file +var _0x8b29=['getUnread','/:id/members','getMembers','getMessages','post','addMembers','/:id/messages','put','/:id','delete','removeMembers','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','describe','show','/:id/unread'];(function(_0x24954e,_0x226bf7){var _0x5ffc3d=function(_0xc8fcaa){while(--_0xc8fcaa){_0x24954e['push'](_0x24954e['shift']());}};_0x5ffc3d(++_0x226bf7);}(_0x8b29,0x11a));var _0x98b2=function(_0x425cf5,_0x108ec5){_0x425cf5=_0x425cf5-0x0;var _0x214930=_0x8b29[_0x425cf5];return _0x214930;};'use strict';var multer=require(_0x98b2('0x0'));var util=require(_0x98b2('0x1'));var path=require('path');var timeout=require(_0x98b2('0x2'));var express=require(_0x98b2('0x3'));var router=express[_0x98b2('0x4')]();var auth=require(_0x98b2('0x5'));var interaction=require(_0x98b2('0x6'));var config=require(_0x98b2('0x7'));var controller=require(_0x98b2('0x8'));router[_0x98b2('0x9')]('/',auth[_0x98b2('0xa')](),controller[_0x98b2('0xb')]);router['get']('/describe',auth[_0x98b2('0xa')](),controller[_0x98b2('0xc')]);router[_0x98b2('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x98b2('0xd')]);router[_0x98b2('0x9')](_0x98b2('0xe'),auth[_0x98b2('0xa')](),controller[_0x98b2('0xf')]);router[_0x98b2('0x9')](_0x98b2('0x10'),auth[_0x98b2('0xa')](),controller[_0x98b2('0x11')]);router[_0x98b2('0x9')]('/:id/messages',auth[_0x98b2('0xa')](),controller[_0x98b2('0x12')]);router[_0x98b2('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x98b2('0x13')](_0x98b2('0x10'),auth[_0x98b2('0xa')](),controller[_0x98b2('0x14')]);router['post'](_0x98b2('0x15'),auth[_0x98b2('0xa')](),controller['addMessage']);router[_0x98b2('0x16')](_0x98b2('0x17'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x98b2('0xa')](),controller['destroy']);router[_0x98b2('0x18')](_0x98b2('0x10'),auth[_0x98b2('0xa')](),controller[_0x98b2('0x19')]);module[_0x98b2('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index bb3ab77..eb47987 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 _0xe605=['star','thumb','TEXT','STRING','DATE','long','sequelize','exports','INTEGER','ENUM'];(function(_0x3bd33c,_0x3439f7){var _0x1dc232=function(_0x1934d2){while(--_0x1934d2){_0x3bd33c['push'](_0x3bd33c['shift']());}};_0x1dc232(++_0x3439f7);}(_0xe605,0x92));var _0x5e60=function(_0x36dd4a,_0x1b54c5){_0x36dd4a=_0x36dd4a-0x0;var _0x4f9607=_0xe605[_0x36dd4a];return _0x4f9607;};'use strict';var Sequelize=require(_0x5e60('0x0'));module[_0x5e60('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x5e60('0x2')]},'ratingType':{'type':Sequelize[_0x5e60('0x3')](_0x5e60('0x4'),_0x5e60('0x5')),'defaultValue':_0x5e60('0x4')},'ratingMessage':{'type':Sequelize[_0x5e60('0x6')]},'pathTranscript':{'type':Sequelize[_0x5e60('0x6')]},'mailTranscript':{'type':Sequelize[_0x5e60('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x5e60('0x8')]},'disposition':{'type':Sequelize[_0x5e60('0x7')]},'note':{'type':Sequelize[_0x5e60('0x7')]},'browserName':{'type':Sequelize[_0x5e60('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x5e60('0x7')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x5e60('0x7')]},'referer':{'type':Sequelize[_0x5e60('0x7')]},'customerIp':{'type':Sequelize[_0x5e60('0x7')]},'formData':{'type':Sequelize[_0x5e60('0x6')](_0x5e60('0x9'))},'read1stAt':{'type':Sequelize[_0x5e60('0x8')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x5e60('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x5e60('0x7')]}}; \ No newline at end of file +var _0x4483=['out','sequelize','exports','BOOLEAN','ENUM','star','thumb','TEXT','STRING','DATE','long'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x4483,0x1a3));var _0x3448=function(_0x472a36,_0x11414e){_0x472a36=_0x472a36-0x0;var _0x55ce9d=_0x4483[_0x472a36];return _0x55ce9d;};'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 bc74f40..b062053 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 _0x17e8=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','map','type','key','VIRTUAL','field','include','tag','push','Tag','distinct','read','ChatMessage','Messages','createdAt','count','includeAll','Users','CmContact','Contact','User','Owner','fullname','internal','ChatWebsite','direction','color','ThroughTags','findAll','show','params','options','find','create','body','describe','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','UserId','Sequelize','ValidationError','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','originalname','basename','Attachment','attachmentDownload','findOne','Unauthorized','download','join','root','server/files/attachments/','mailTranscript','server/files/chat/upload/','format','now','pathTranscript','ChatWebsiteId','ContactId','System','customer','%s%d','agentIdentifier','website_alias','agentAlias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','auth','user','pass','SendMail','\x22%s\x22\x20<%s>','email','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','limit','$gte','split','YYYY-MM-DD\x20HH:mm:ss','merge','rows','getMyMessages','order','pick','includeAgent','addTags','spread','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','attachments','interaction-%s.zip','firstName','1cm','mkdirSync','

Chat\x20Interaction:\x20#%d

','
','','%s:\x20%s

','','existsSync','createReadStream','pipe','createWriteStream','toFile','.pdf','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','client','http','then','info','request\x20sent','debug','error','ChatInteraction,\x20%s,\x20%s','message','catch','status','end','json','offset','set','Content-Range','apply','save','update','destroy','stack','name','send','index','ChatInteraction','rawAttributes','model','keys'];(function(_0x4489b1,_0x27205d){var _0x550d9e=function(_0xafa2eb){while(--_0xafa2eb){_0x4489b1['push'](_0x4489b1['shift']());}};_0x550d9e(++_0x27205d);}(_0x17e8,0x8f));var _0x817e=function(_0xf89d72,_0x559cae){_0xf89d72=_0xf89d72-0x0;var _0x3853a9=_0x17e8[_0xf89d72];return _0x3853a9;};'use strict';var pdf=require(_0x817e('0x0'));var emlformat=require(_0x817e('0x1'));var rimraf=require(_0x817e('0x2'));var zipdir=require(_0x817e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x817e('0x4'));var moment=require(_0x817e('0x5'));var BPromise=require(_0x817e('0x6'));var Mustache=require('mustache');var util=require(_0x817e('0x7'));var path=require(_0x817e('0x8'));var sox=require('sox');var csv=require(_0x817e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x817e('0xa'));var crypto=require(_0x817e('0xb'));var jsforce=require(_0x817e('0xc'));var deskjs=require(_0x817e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x817e('0xe'));var Papa=require(_0x817e('0xf'));var authService=require(_0x817e('0x10'));var hardwareService=require(_0x817e('0x11'));var Redis=require(_0x817e('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0x817e('0x13'))('api');var utils=require(_0x817e('0x14'));var config=require(_0x817e('0x15'));var db=require(_0x817e('0x16'))['db'];config[_0x817e('0x17')]=_['defaults'](config[_0x817e('0x17')],{'host':_0x817e('0x18'),'port':0x18eb});var socket=require(_0x817e('0x19'))(new Redis(config['redis']));require(_0x817e('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x817e('0x1b')][_0x817e('0x1c')]({'port':0x232b});var client9004=jayson[_0x817e('0x1b')]['http']({'port':0x232c});function respondWithRpcPromise(_0x17ec27,_0x1b7f28,_0x4508a5,_0x4080d8){return new BPromise(function(_0xb5614,_0x15a3b2){var _0x4ced54=_0x4080d8||client;return _0x4ced54['request'](_0x17ec27,_0x4508a5)[_0x817e('0x1d')](function(_0x49ce7f){logger[_0x817e('0x1e')]('ChatInteraction,\x20%s,\x20%s',_0x1b7f28,_0x817e('0x1f'));logger[_0x817e('0x20')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x1b7f28,_0x817e('0x1f'),JSON['stringify'](_0x49ce7f));if(_0x49ce7f[_0x817e('0x21')]){if(_0x49ce7f['error']['code']===0x1f4){logger['error'](_0x817e('0x22'),_0x1b7f28,_0x49ce7f[_0x817e('0x21')]['message']);return _0x15a3b2(_0x49ce7f['error'][_0x817e('0x23')]);}logger[_0x817e('0x21')](_0x817e('0x22'),_0x1b7f28,_0x49ce7f[_0x817e('0x21')][_0x817e('0x23')]);return _0xb5614(_0x49ce7f[_0x817e('0x21')]['message']);}else{logger[_0x817e('0x1e')](_0x817e('0x22'),_0x1b7f28,_0x817e('0x1f'));_0xb5614(_0x49ce7f['result'][_0x817e('0x23')]);}})[_0x817e('0x24')](function(_0xcae78d){logger[_0x817e('0x21')]('ChatInteraction,\x20%s,\x20%s',_0x1b7f28,_0xcae78d);_0x15a3b2(_0xcae78d);});});}function respondWithStatusCode(_0x21c823,_0x5b7c41){_0x5b7c41=_0x5b7c41||0xcc;return function(_0xc378bb){if(_0xc378bb){return _0x21c823['sendStatus'](_0x5b7c41);}return _0x21c823[_0x817e('0x25')](_0x5b7c41)[_0x817e('0x26')]();};}function respondWithResult(_0x4162d0,_0x589de3){_0x589de3=_0x589de3||0xc8;return function(_0x17f006){if(_0x17f006){return _0x4162d0[_0x817e('0x25')](_0x589de3)[_0x817e('0x27')](_0x17f006);}};}function respondWithFilteredResult(_0x4d8497,_0x5f5091){return function(_0x50d809){if(_0x50d809){var _0xe28ab3=_0x50d809['count'],_0x3746cc=_0x5f5091[_0x817e('0x28')],_0x197751=_0x5f5091[_0x817e('0x28')]+_0x5f5091['limit'],_0x508d67;if(_0x197751>=_0xe28ab3){_0x197751=_0xe28ab3;_0x508d67=0xc8;}else{_0x508d67=0xce;}_0x4d8497[_0x817e('0x25')](_0x508d67);return _0x4d8497[_0x817e('0x29')](_0x817e('0x2a'),_0x3746cc+'-'+_0x197751+'/'+_0xe28ab3)[_0x817e('0x27')](_0x50d809);}return null;};}function patchUpdates(_0x277209){return function(_0x16ca5b){try{jsonpatch[_0x817e('0x2b')](_0x16ca5b,_0x277209,!![]);}catch(_0x2d9dad){return BPromise['reject'](_0x2d9dad);}return _0x16ca5b[_0x817e('0x2c')]();};}function saveUpdates(_0xb8ddaa,_0x42c9f3){return function(_0x31b75b){if(_0x31b75b){return _0x31b75b[_0x817e('0x2d')](_0xb8ddaa)[_0x817e('0x1d')](function(_0x5ff018){return _0x5ff018;});}return null;};}function removeEntity(_0x248b56,_0x185da7){return function(_0x3f4520){if(_0x3f4520){return _0x3f4520[_0x817e('0x2e')]()[_0x817e('0x1d')](function(){_0x248b56[_0x817e('0x25')](0xcc)[_0x817e('0x26')]();});}};}function handleEntityNotFound(_0x47f3c0,_0x5c8afd){return function(_0x18c8d6){if(!_0x18c8d6){_0x47f3c0['sendStatus'](0x194);}return _0x18c8d6;};}function handleError(_0x158d67,_0x459fd3){_0x459fd3=_0x459fd3||0x1f4;return function(_0x3aedb2){logger[_0x817e('0x21')](_0x3aedb2[_0x817e('0x2f')]);if(_0x3aedb2[_0x817e('0x30')]){delete _0x3aedb2['name'];}_0x158d67[_0x817e('0x25')](_0x459fd3)[_0x817e('0x31')](_0x3aedb2);};}exports[_0x817e('0x32')]=function(_0x3b3b70,_0x35e89a){var _0x76d266={},_0x279603={},_0x5e3e8c={'count':0x0,'rows':[]};var _0x1af411=db[_0x817e('0x33')][_0x817e('0x34')];_0x279603[_0x817e('0x35')]=_[_0x817e('0x36')](_0x1af411);_0x279603[_0x817e('0x37')]=_['keys'](_0x3b3b70[_0x817e('0x37')]);_0x279603[_0x817e('0x38')]=_[_0x817e('0x39')](_0x279603['model'],_0x279603['query']);_0x76d266[_0x817e('0x3a')]=_[_0x817e('0x39')](_0x279603[_0x817e('0x35')],qs[_0x817e('0x3b')](_0x3b3b70[_0x817e('0x37')][_0x817e('0x3b')]));_0x76d266['attributes']=_0x76d266[_0x817e('0x3a')][_0x817e('0x3c')]?_0x76d266[_0x817e('0x3a')]:_0x279603[_0x817e('0x35')];if(!_0x3b3b70[_0x817e('0x37')][_0x817e('0x3d')](_0x817e('0x3e'))){_0x76d266['limit']=qs['limit'](_0x3b3b70[_0x817e('0x37')]['limit']);_0x76d266[_0x817e('0x28')]=qs[_0x817e('0x28')](_0x3b3b70[_0x817e('0x37')][_0x817e('0x28')]);}_0x76d266['order']=qs[_0x817e('0x3f')](_0x3b3b70[_0x817e('0x37')][_0x817e('0x3f')]);_0x76d266['where']=qs[_0x817e('0x38')](_['pick'](_0x3b3b70['query'],_0x279603[_0x817e('0x38')]));if(_0x3b3b70['query'][_0x817e('0x40')]){_0x76d266[_0x817e('0x41')]=_['merge'](_0x76d266[_0x817e('0x41')],{'$or':_[_0x817e('0x42')](_0x1af411,function(_0x284200){if(_0x284200[_0x817e('0x43')][_0x817e('0x44')]!==_0x817e('0x45')){var _0x531d75={};_0x531d75[_0x284200[_0x817e('0x46')]]={'$like':'%'+_0x3b3b70[_0x817e('0x37')][_0x817e('0x40')]+'%'};return _0x531d75;}})});}_0x76d266=_['merge']({},_0x76d266,_0x3b3b70['options']);var _0x45e9ec={'where':_0x76d266[_0x817e('0x41')]};_0x45e9ec[_0x817e('0x47')]=[];if(_0x3b3b70[_0x817e('0x37')][_0x817e('0x48')]){_0x45e9ec['include'][_0x817e('0x49')]({'model':db[_0x817e('0x4a')],'as':'Tags','attributes':['id'],'where':{'id':_0x3b3b70[_0x817e('0x37')]['tag']},'required':!![]});_0x45e9ec[_0x817e('0x4b')]=!![];}if(_0x3b3b70['query'][_0x817e('0x4c')]){_0x45e9ec[_0x817e('0x47')][_0x817e('0x49')]({'model':db[_0x817e('0x4d')],'as':_0x817e('0x4e'),'attributes':['id','direction',_0x817e('0x4f'),_0x817e('0x4c')],'where':{'direction':'in','read':_0x3b3b70[_0x817e('0x37')][_0x817e('0x4c')]||![]},'required':!![]});_0x45e9ec[_0x817e('0x4b')]=!![];}return db['ChatInteraction'][_0x817e('0x50')](_0x45e9ec)[_0x817e('0x1d')](function(_0x31085f){_0x5e3e8c['count']=_0x31085f;if(_0x3b3b70[_0x817e('0x37')][_0x817e('0x51')]){_0x76d266[_0x817e('0x47')]=[{'model':db['User'],'as':_0x817e('0x52'),'required':![],'attributes':['id','name','fullname']},{'model':db[_0x817e('0x53')],'as':_0x817e('0x54'),'required':![]},{'model':db[_0x817e('0x55')],'as':_0x817e('0x56'),'attributes':[_0x817e('0x30'),_0x817e('0x57'),_0x817e('0x58')],'required':![]},{'model':db[_0x817e('0x59')],'as':'Account','attributes':[_0x817e('0x30'),_0x817e('0x44')],'required':![]},{'model':db['ChatMessage'],'as':'Messages','attributes':['id',_0x817e('0x5a'),'createdAt','read'],'where':{'direction':'in','read':_0x3b3b70[_0x817e('0x37')][_0x817e('0x4c')]||![]},'required':_0x3b3b70[_0x817e('0x37')]['read']||![]},{'model':db[_0x817e('0x4a')],'as':'Tags','attributes':['id',_0x817e('0x30'),_0x817e('0x5b')],'required':_0x3b3b70[_0x817e('0x37')][_0x817e('0x48')]?!![]:![]},{'model':db[_0x817e('0x4a')],'as':_0x817e('0x5c'),'attributes':['id',_0x817e('0x30'),_0x817e('0x5b')],'through':_0x3b3b70['query'][_0x817e('0x48')]?{'attributes':[],'where':{'TagId':_0x3b3b70[_0x817e('0x37')]['tag']||undefined}}:{},'required':_0x3b3b70[_0x817e('0x37')]['tag']?!![]:![]}];}return db[_0x817e('0x33')][_0x817e('0x5d')](_0x76d266);})[_0x817e('0x1d')](function(_0x4da919){_0x5e3e8c['rows']=_0x4da919;return _0x5e3e8c;})[_0x817e('0x1d')](respondWithFilteredResult(_0x35e89a,_0x76d266))['catch'](handleError(_0x35e89a,null));};exports[_0x817e('0x5e')]=function(_0x11606e,_0x2b6523){var _0xf34aa7={'raw':![],'where':{'id':_0x11606e[_0x817e('0x5f')]['id']}},_0x5dcea5={};_0x5dcea5[_0x817e('0x35')]=_['keys'](db[_0x817e('0x33')][_0x817e('0x34')]);_0x5dcea5['query']=_[_0x817e('0x36')](_0x11606e[_0x817e('0x37')]);_0x5dcea5[_0x817e('0x38')]=_[_0x817e('0x39')](_0x5dcea5['model'],_0x5dcea5[_0x817e('0x37')]);_0xf34aa7[_0x817e('0x3a')]=_[_0x817e('0x39')](_0x5dcea5[_0x817e('0x35')],qs[_0x817e('0x3b')](_0x11606e['query'][_0x817e('0x3b')]));_0xf34aa7[_0x817e('0x3a')]=_0xf34aa7[_0x817e('0x3a')][_0x817e('0x3c')]?_0xf34aa7[_0x817e('0x3a')]:_0x5dcea5[_0x817e('0x35')];if(_0x11606e[_0x817e('0x37')]['includeAll']){_0xf34aa7[_0x817e('0x47')]=[{'all':!![]}];}_0xf34aa7=_['merge']({},_0xf34aa7,_0x11606e[_0x817e('0x60')]);return db[_0x817e('0x33')][_0x817e('0x61')](_0xf34aa7)[_0x817e('0x1d')](handleEntityNotFound(_0x2b6523,null))[_0x817e('0x1d')](respondWithResult(_0x2b6523,null))[_0x817e('0x24')](handleError(_0x2b6523,null));};exports[_0x817e('0x62')]=function(_0x52fa1e,_0x5d589f){return db[_0x817e('0x33')]['create'](_0x52fa1e[_0x817e('0x63')],{})[_0x817e('0x1d')](respondWithResult(_0x5d589f,0xc9))['catch'](handleError(_0x5d589f,null));};exports[_0x817e('0x2d')]=function(_0x296fd0,_0x127d4c){if(_0x296fd0[_0x817e('0x63')]['id']){delete _0x296fd0[_0x817e('0x63')]['id'];}return db[_0x817e('0x33')][_0x817e('0x61')]({'where':{'id':_0x296fd0[_0x817e('0x5f')]['id']}})[_0x817e('0x1d')](handleEntityNotFound(_0x127d4c,null))[_0x817e('0x1d')](saveUpdates(_0x296fd0[_0x817e('0x63')],null))[_0x817e('0x1d')](respondWithResult(_0x127d4c,null))[_0x817e('0x24')](handleError(_0x127d4c,null));};exports['destroy']=function(_0x5342e8,_0x300b10){return db['ChatInteraction'][_0x817e('0x61')]({'where':{'id':_0x5342e8[_0x817e('0x5f')]['id']}})[_0x817e('0x1d')](handleEntityNotFound(_0x300b10,null))['then'](removeEntity(_0x300b10,null))['catch'](handleError(_0x300b10,null));};exports[_0x817e('0x64')]=function(_0x4361f2,_0x58cca7){return db[_0x817e('0x33')][_0x817e('0x64')]()['then'](respondWithResult(_0x58cca7,null))['catch'](handleError(_0x58cca7,null));};exports[_0x817e('0x65')]=function(_0x4fd400,_0x2958c2){if(_0x4fd400[_0x817e('0x63')]['id']){delete _0x4fd400['body']['id'];}return db['ChatInteraction'][_0x817e('0x61')]({'where':{'id':_0x4fd400[_0x817e('0x5f')]['id']}})[_0x817e('0x1d')](handleEntityNotFound(_0x2958c2,null))['then'](saveUpdates(_0x4fd400['body'],null))[_0x817e('0x1d')](respondWithResult(_0x2958c2,null))[_0x817e('0x24')](handleError(_0x2958c2,null));};exports[_0x817e('0x66')]=function(_0x3a1454,_0x3b0fc3,_0x39875c){if(_0x3a1454[_0x817e('0x63')]['id']){delete _0x3a1454[_0x817e('0x63')]['id'];}return db[_0x817e('0x33')][_0x817e('0x61')]({'where':{'id':_0x3a1454[_0x817e('0x5f')]['id']}})['then'](function(_0x32d714){if(!_0x32d714){logger[_0x817e('0x21')](_0x817e('0x67'),_0x817e('0x66'),0x194,_0x817e('0x68'));_0x3b0fc3[_0x817e('0x69')](0x194);}else{if(_0x32d714[_0x817e('0x6a')]){throw new db[(_0x817e('0x6b'))][(_0x817e('0x6c'))](_0x817e('0x6d'));}}return _0x32d714;})['then'](function(_0x216b3e){if(_0x216b3e){return _0x216b3e[_0x817e('0x2d')]({'closed':_0x3a1454[_0x817e('0x63')][_0x817e('0x6e')],'disposition':_0x3a1454[_0x817e('0x63')][_0x817e('0x6f')]})[_0x817e('0x1d')](function(_0x262bb1){return _0x262bb1;});}})[_0x817e('0x1d')](function(_0x166954){return respondWithRpcPromise(_0x817e('0x70'),_0x817e('0x66'),_0x3a1454[_0x817e('0x63')],client9004);})[_0x817e('0x1d')](respondWithResult(_0x3b0fc3,null))[_0x817e('0x24')](handleError(_0x3b0fc3,null));};exports['attachmentUpload']=function(_0x185a07,_0x2ce78a,_0x39313e){_0x185a07[_0x817e('0x63')]['name']=_0x185a07[_0x817e('0x71')][_0x817e('0x72')];_0x185a07[_0x817e('0x63')][_0x817e('0x73')]=_0x185a07[_0x817e('0x71')]['filename'];_0x185a07[_0x817e('0x63')]['type']=_0x185a07[_0x817e('0x71')]['mimetype'];return db[_0x817e('0x74')][_0x817e('0x62')](_0x185a07[_0x817e('0x63')])[_0x817e('0x1d')](respondWithResult(_0x2ce78a,0xc9))[_0x817e('0x24')](handleError(_0x2ce78a,null));};exports[_0x817e('0x75')]=function(_0x1fe32a,_0x5ee082,_0x536909){return db[_0x817e('0x33')][_0x817e('0x76')]({'where':{'id':_0x1fe32a[_0x817e('0x5f')]['id']},'raw':!![]})[_0x817e('0x1d')](handleEntityNotFound(_0x5ee082,null))[_0x817e('0x1d')](function(_0x326d39){if(_0x326d39){if(_0x326d39['closed']){return _0x5ee082[_0x817e('0x25')](0x193)[_0x817e('0x27')]({'status':0x193,'message':_0x817e('0x77')});}return db[_0x817e('0x74')][_0x817e('0x76')]({'where':{'id':_0x1fe32a['query']['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x5ee082,null));}})[_0x817e('0x1d')](function(_0x3ed15b){if(_0x3ed15b){return _0x5ee082[_0x817e('0x78')](path[_0x817e('0x79')](config[_0x817e('0x7a')],_0x817e('0x7b'),_0x3ed15b[_0x817e('0x73')]));}})[_0x817e('0x24')](handleError(_0x5ee082,null));};exports['close']=function(_0x210f4c,_0x399e5f){var _0x6c14fd=null;var _0x4cebc3=null;var _0x59ddbc=null;var _0x3aa6c3=null;if(_0x210f4c['body']['id']){delete _0x210f4c[_0x817e('0x63')]['id'];}if(_0x210f4c['body'][_0x817e('0x7c')]){_0x3aa6c3=path['join'](config['root'],_0x817e('0x7d'),util[_0x817e('0x7e')]('transcript-%s.txt',Date[_0x817e('0x7f')]()));_0x210f4c[_0x817e('0x63')][_0x817e('0x80')]=_0x3aa6c3;}return db[_0x817e('0x33')][_0x817e('0x61')]({'where':{'id':_0x210f4c[_0x817e('0x5f')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x817e('0x4e'),'include':[{'model':db[_0x817e('0x55')],'as':_0x817e('0x55')}]}]})[_0x817e('0x1d')](handleEntityNotFound(_0x399e5f,null))['then'](saveUpdates(_0x210f4c[_0x817e('0x63')],null))[_0x817e('0x1d')](function(_0x50bd45){if(_0x50bd45){_0x6c14fd=_0x50bd45;return db[_0x817e('0x59')][_0x817e('0x61')]({'where':{'id':_0x6c14fd[_0x817e('0x81')]}});}})[_0x817e('0x1d')](function(_0x1a36c3){if(_0x1a36c3){_0x59ddbc=_0x1a36c3;return db[_0x817e('0x53')][_0x817e('0x61')]({'where':{'id':_0x6c14fd[_0x817e('0x82')]}});}})['then'](function(_0x246beb){if(_0x246beb){_0x4cebc3=_0x246beb;if(_0x3aa6c3){var _0x2863d1=null;for(var _0x1f8cd8=0x1;_0x1f8cd8<_0x6c14fd[_0x817e('0x4e')][_0x817e('0x3c')];++_0x1f8cd8){_0x2863d1=_0x6c14fd[_0x817e('0x4e')][_0x1f8cd8];var _0x5ddc7e=_0x2863d1[_0x817e('0x6a')]?util['format']('%s%d',_0x59ddbc['agentAlias'],_0x2863d1['UserId']):_0x817e('0x83');var _0x42af49=_0x210f4c[_0x817e('0x63')][_0x817e('0x84')]||util[_0x817e('0x7e')](_0x817e('0x85'),'Visitor',_0x2863d1['ContactId']);switch(_0x59ddbc[_0x817e('0x86')]){case _0x817e('0x87'):_0x5ddc7e=_0x2863d1[_0x817e('0x6a')]?util['format']('%s%d',_0x59ddbc[_0x817e('0x88')],_0x2863d1[_0x817e('0x6a')]):_0x817e('0x83');break;case _0x817e('0x89'):_0x5ddc7e=_0x2863d1[_0x817e('0x6a')]?_0x2863d1[_0x817e('0x55')]['alias']||_0x2863d1[_0x817e('0x55')][_0x817e('0x57')]:_0x817e('0x83');break;case _0x817e('0x8a'):_0x5ddc7e=_0x2863d1['UserId']?_0x2863d1[_0x817e('0x55')]['fullname']:_0x817e('0x83');break;default:_0x5ddc7e=_0x2863d1[_0x817e('0x6a')]?util['format']('%s%d',_0x59ddbc[_0x817e('0x88')],_0x2863d1['UserId']):_0x817e('0x83');}var _0x3f913f=util[_0x817e('0x7e')](_0x817e('0x8b'),moment(_0x2863d1[_0x817e('0x4f')])['format'](_0x817e('0x8c')),_0x2863d1[_0x817e('0x5a')]==='in'?_0x42af49:_0x5ddc7e,_0x2863d1[_0x817e('0x63')]);if(!_0x2863d1[_0x817e('0x8d')]){fs[_0x817e('0x8e')](_0x3aa6c3,_0x3f913f);}}return db[_0x817e('0x8f')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}}})[_0x817e('0x1d')](function(_0x4ca86c){if(_0x4ca86c&&_0x4ca86c[_0x817e('0x90')]&&_0x210f4c[_0x817e('0x63')]){var _0x3d1e44={'tls':{'rejectUnauthorized':![]}};if(_0x4ca86c[_0x817e('0x90')]['service']){_0x3d1e44[_0x817e('0x91')]=_0x4ca86c[_0x817e('0x90')]['service'];}else{_0x3d1e44[_0x817e('0x92')]=_0x4ca86c[_0x817e('0x90')][_0x817e('0x92')];_0x3d1e44[_0x817e('0x93')]=_0x4ca86c[_0x817e('0x90')][_0x817e('0x93')];_0x3d1e44[_0x817e('0x94')]=_0x4ca86c[_0x817e('0x90')][_0x817e('0x94')];}if(_0x4ca86c[_0x817e('0x90')]['authentication']){_0x3d1e44[_0x817e('0x95')]={'user':_0x4ca86c[_0x817e('0x90')][_0x817e('0x96')],'pass':_0x4ca86c['Smtp'][_0x817e('0x97')]};}return respondWithRpcPromise(_0x817e('0x98'),'sendMail',{'account':_0x3d1e44,'message':{'from':util['format'](_0x817e('0x99'),_0x4ca86c[_0x817e('0x30')],_0x4ca86c[_0x817e('0x9a')]||_0x4ca86c['Smtp'][_0x817e('0x96')]),'to':_0x210f4c[_0x817e('0x63')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0x817e('0x7e')](_0x817e('0x9b'),_0x210f4c[_0x817e('0x63')][_0x817e('0x7c')]),'attachments':[{'path':_0x3aa6c3}]}})[_0x817e('0x1d')](function(){return _0x6c14fd;})[_0x817e('0x24')](function(_0x289ab8){console[_0x817e('0x21')](_0x289ab8);});}else{return _0x6c14fd;}})[_0x817e('0x1d')](respondWithStatusCode(_0x399e5f,0xc8))[_0x817e('0x24')](handleError(_0x399e5f,null));};exports[_0x817e('0x9c')]=function(_0x338905,_0x450b08,_0x4c467b){return db[_0x817e('0x4d')]['find']({'where':{'id':_0x338905[_0x817e('0x5f')]['id']}})[_0x817e('0x1d')](handleEntityNotFound(_0x450b08,null))[_0x817e('0x1d')](function(_0xbcc749){if(_0xbcc749){return _0xbcc749[_0x817e('0x9c')](_0x338905[_0x817e('0x63')][_0x817e('0x9d')],_[_0x817e('0x9e')](_0x338905[_0x817e('0x63')],[_0x817e('0x9d'),'id'])||{});}})[_0x817e('0x1d')](respondWithResult(_0x450b08,null))[_0x817e('0x24')](handleError(_0x450b08,null));};exports[_0x817e('0x9f')]=function(_0xd2a853,_0x4a6196,_0x33f8a3){var _0x3d9a17={'raw':![],'where':{}};var _0x19331f={};var _0x4fef1f={'count':0x0,'rows':[]};return db[_0x817e('0x33')][_0x817e('0x76')]({'where':{'id':_0xd2a853[_0x817e('0x5f')]['id']}})[_0x817e('0x1d')](handleEntityNotFound(_0x4a6196,null))[_0x817e('0x1d')](function(_0xe80b44){if(_0xe80b44){_0x19331f[_0x817e('0x35')]=_[_0x817e('0x36')](db[_0x817e('0x4d')][_0x817e('0x34')]);_0x19331f[_0x817e('0x37')]=_[_0x817e('0x36')](_0xd2a853[_0x817e('0x37')]);_0x19331f[_0x817e('0x38')]=_[_0x817e('0x39')](_0x19331f[_0x817e('0x35')],_0x19331f[_0x817e('0x37')]);_0x3d9a17['attributes']=_[_0x817e('0x39')](_0x19331f['model'],qs[_0x817e('0x3b')](_0xd2a853['query'][_0x817e('0x3b')]));_0x3d9a17[_0x817e('0x3a')]=_0x3d9a17[_0x817e('0x3a')][_0x817e('0x3c')]?_0x3d9a17['attributes']:_0x19331f[_0x817e('0x35')];if(!_0xd2a853[_0x817e('0x37')][_0x817e('0x3d')]('nolimit')){_0x3d9a17[_0x817e('0xa0')]=qs[_0x817e('0xa0')](_0xd2a853[_0x817e('0x37')][_0x817e('0xa0')]);_0x3d9a17['offset']=qs['offset'](_0xd2a853['query']['offset']);}_0x3d9a17['order']=qs[_0x817e('0x3f')](_0xd2a853[_0x817e('0x37')][_0x817e('0x3f')]);_0x3d9a17[_0x817e('0x41')]=qs[_0x817e('0x38')](_['pick'](_0xd2a853[_0x817e('0x37')],_0x19331f[_0x817e('0x38')]));_0x3d9a17['where']['ChatInteractionId']=_0xe80b44['id'];if(_0xd2a853['query'][_0x817e('0x40')]){_0x3d9a17[_0x817e('0x41')]=_['merge'](_0x3d9a17['where'],{'$or':_[_0x817e('0x42')](_0x3d9a17[_0x817e('0x3a')],function(_0x3d5609){var _0x1b4f0c={};_0x1b4f0c[_0x3d5609]={'$like':'%'+_0xd2a853[_0x817e('0x37')][_0x817e('0x40')]+'%'};return _0x1b4f0c;})});}if(_0xd2a853[_0x817e('0x37')][_0x817e('0xa1')]){var _0x456503=_0xd2a853[_0x817e('0x37')][_0x817e('0xa1')][_0x817e('0xa2')](',');var _0x308286={};_0x308286[_0x456503[0x0]]={'$gte':moment(_0x456503[0x1])['format'](_0x817e('0xa3'))};_0x3d9a17[_0x817e('0x41')]=_[_0x817e('0xa4')](_0x3d9a17[_0x817e('0x41')],_0x308286);}_0x3d9a17=_['merge']({},_0x3d9a17,_0xd2a853[_0x817e('0x60')]);return db[_0x817e('0x4d')]['count']({'where':_0x3d9a17[_0x817e('0x41')]})[_0x817e('0x1d')](function(_0x43bbb3){_0x4fef1f[_0x817e('0x50')]=_0x43bbb3;if(_0xd2a853[_0x817e('0x37')][_0x817e('0x51')]){_0x3d9a17[_0x817e('0x47')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x3d9a17);})[_0x817e('0x1d')](function(_0x537906){_0x4fef1f[_0x817e('0xa5')]=_0x537906;return _0x4fef1f;});}})[_0x817e('0x1d')](respondWithFilteredResult(_0x4a6196,_0x3d9a17))['catch'](handleError(_0x4a6196,null));};exports[_0x817e('0xa6')]=function(_0x4e38ad,_0x2d7d41,_0x5273f5){var _0x129fb8={'where':{}},_0x33d027={},_0xad8ca2={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x817e('0x76')]({'where':{'id':_0x4e38ad[_0x817e('0x5f')]['id']}})[_0x817e('0x1d')](handleEntityNotFound(_0x2d7d41,null))[_0x817e('0x1d')](function(_0x12e81e){if(_0x12e81e){_0x33d027[_0x817e('0x35')]=_[_0x817e('0x36')](db[_0x817e('0x4d')][_0x817e('0x34')]);_0x33d027[_0x817e('0x37')]=_[_0x817e('0x36')](_0x4e38ad['query']);_0x33d027[_0x817e('0x38')]=_['intersection'](_0x33d027[_0x817e('0x35')],_0x33d027[_0x817e('0x37')]);_0x129fb8[_0x817e('0x3a')]=_[_0x817e('0x39')](_0x33d027[_0x817e('0x35')],qs[_0x817e('0x3b')](_0x4e38ad['query'][_0x817e('0x3b')]));_0x129fb8[_0x817e('0x3a')]=_0x129fb8[_0x817e('0x3a')]['length']?_0x129fb8[_0x817e('0x3a')]:_0x33d027[_0x817e('0x35')];if(!_0x4e38ad[_0x817e('0x37')][_0x817e('0x3d')](_0x817e('0x3e'))){_0x129fb8['limit']=qs[_0x817e('0xa0')](_0x4e38ad[_0x817e('0x37')][_0x817e('0xa0')]);_0x129fb8['offset']=qs[_0x817e('0x28')](_0x4e38ad[_0x817e('0x37')]['offset']);}_0x129fb8[_0x817e('0xa7')]=qs[_0x817e('0x3f')](_0x4e38ad[_0x817e('0x37')]['sort']);_0x129fb8[_0x817e('0x41')]=qs[_0x817e('0x38')](_[_0x817e('0xa8')](_0x4e38ad['query'],_0x33d027[_0x817e('0x38')]));_0x129fb8[_0x817e('0x41')]['ChatInteractionId']=_0x12e81e['id'];if(_0x4e38ad[_0x817e('0x37')][_0x817e('0x40')]){_0x129fb8[_0x817e('0x41')]=_[_0x817e('0xa4')](_0x129fb8[_0x817e('0x41')],{'$or':_[_0x817e('0x42')](_0x129fb8[_0x817e('0x3a')],function(_0x4e0fe5){var _0x49edd9={};_0x49edd9[_0x4e0fe5]={'$like':'%'+_0x4e38ad['query']['filter']+'%'};return _0x49edd9;})});}_0x129fb8[_0x817e('0x41')]['secret']=![];if(_0x4e38ad[_0x817e('0x37')]['id']){_0x129fb8['where']['id']={'$gt':_0x4e38ad[_0x817e('0x37')]['id']};}_0x129fb8=_[_0x817e('0xa4')]({},_0x129fb8,_0x4e38ad[_0x817e('0x60')]);return db[_0x817e('0x4d')][_0x817e('0x50')]({'where':_0x129fb8['where']})[_0x817e('0x1d')](function(_0x5ee5de){_0xad8ca2[_0x817e('0x50')]=_0x5ee5de;_0x129fb8[_0x817e('0x47')]=[];if(_0x4e38ad[_0x817e('0x37')][_0x817e('0xa9')]){_0x129fb8['include'][_0x817e('0x49')]({'model':db[_0x817e('0x55')],'as':_0x817e('0x55'),'attributes':['id',_0x817e('0x57'),'alias']});}if(_0x4e38ad[_0x817e('0x37')][_0x817e('0x51')]){_0x129fb8['include']=[{'all':!![]}];}return db[_0x817e('0x4d')][_0x817e('0x5d')](_0x129fb8);})[_0x817e('0x1d')](function(_0x43d205){_0xad8ca2['rows']=_0x43d205;return _0xad8ca2;});}})[_0x817e('0x1d')](respondWithFilteredResult(_0x2d7d41,_0x129fb8))['catch'](handleError(_0x2d7d41,null));};exports[_0x817e('0xaa')]=function(_0x182062,_0x1e42a3,_0x4fb9a0){return db[_0x817e('0x33')][_0x817e('0x61')]({'where':{'id':_0x182062['params']['id']}})[_0x817e('0x1d')](handleEntityNotFound(_0x1e42a3,null))[_0x817e('0x1d')](function(_0x4979e6){if(_0x4979e6){return _0x4979e6['setTags'](_0x182062[_0x817e('0x63')][_0x817e('0x9d')],_[_0x817e('0x9e')](_0x182062['body'],[_0x817e('0x9d'),'id'])||{})[_0x817e('0xab')](function(){return db['Tag'][_0x817e('0x5d')]({'attributes':['id','name',_0x817e('0x5b')],'where':{'id':_0x182062[_0x817e('0x63')][_0x817e('0x9d')]}});})['then'](function(_0x247190){socket[_0x817e('0xac')](_0x817e('0xad'),{'id':Number(_0x182062['params']['id']),'tags':_0x247190||[]});return{'id':Number(_0x182062[_0x817e('0x5f')]['id']),'tags':_0x247190||[]};});}})[_0x817e('0x1d')](respondWithResult(_0x1e42a3,null))[_0x817e('0x24')](handleError(_0x1e42a3,null));};exports['removeTags']=function(_0x37b5ac,_0x2abb0a,_0x1adc84){var _0x3e1783;return db[_0x817e('0x33')][_0x817e('0x61')]({'where':{'id':_0x37b5ac[_0x817e('0x5f')]['id']}})[_0x817e('0x1d')](handleEntityNotFound(_0x2abb0a,null))[_0x817e('0x1d')](function(_0xd67c39){if(_0xd67c39){return _0xd67c39[_0x817e('0xae')](_0x37b5ac[_0x817e('0x37')][_0x817e('0x9d')]);}})[_0x817e('0x1d')](respondWithStatusCode(_0x2abb0a,null))[_0x817e('0x24')](handleError(_0x2abb0a,null));};exports[_0x817e('0x78')]=function(_0x39f4aa,_0x2cac00){var _0x32fe8e=moment()[_0x817e('0xaf')]()[_0x817e('0xb0')]();var _0x40912b=path[_0x817e('0x79')](config[_0x817e('0x7a')],_0x817e('0xb1'),_0x817e('0xb2'),_0x817e('0xb3'));var _0x343cc5=path['join'](config[_0x817e('0x7a')],'server',_0x817e('0xb2'),_0x817e('0xb4'));var _0x58790f=path[_0x817e('0x79')](_0x40912b,_0x32fe8e);var _0x38d813=util[_0x817e('0x7e')](_0x817e('0xb5'),_0x32fe8e);var _0xdded3d=path['join'](_0x40912b,_0x38d813);var _0x21c2b3=![];return db[_0x817e('0x33')][_0x817e('0x61')]({'where':{'id':_0x39f4aa['params']['id']},'include':[{'model':db[_0x817e('0x4d')],'as':'Messages','attributes':['id',_0x817e('0x63')],'include':[{'model':db[_0x817e('0x55')],'as':'User','attributes':['id',_0x817e('0x57')],'raw':!![]},{'model':db[_0x817e('0x53')],'as':'Contact','attributes':['id',_0x817e('0xb6')],'raw':!![]},{'model':db[_0x817e('0x74')],'as':_0x817e('0x74'),'raw':!![]}]}]})[_0x817e('0x1d')](handleEntityNotFound(_0x2cac00,null))[_0x817e('0x1d')](function(_0x29b835){if(_0x29b835){_0x21c2b3=!![];var _0x36d99b='';var _0x1e531d={'format':'Letter','border':_0x817e('0xb7')};fs[_0x817e('0xb8')](_0x58790f);_0x36d99b+=util[_0x817e('0x7e')](_0x817e('0xb9'),_0x29b835['id']);_0x36d99b+=util[_0x817e('0x7e')]('

Date:\x20%s

',moment()[_0x817e('0x7e')]('MMMM\x20Do\x20YYYY,\x20HH:mm:ss')[_0x817e('0xb0')]());_0x36d99b+=_0x817e('0xba');for(var _0x213ff8=0x1;_0x213ff8<_0x29b835[_0x817e('0x4e')][_0x817e('0x3c')];_0x213ff8++){var _0x5c5647=_0x29b835['Messages'][_0x213ff8];_0x36d99b+=_0x817e('0xbb');_0x36d99b+=util[_0x817e('0x7e')](_0x817e('0xbc'),_0x5c5647[_0x817e('0x55')]?_0x5c5647['User']['fullname']:_0x5c5647[_0x817e('0x54')][_0x817e('0xb6')],_0x5c5647[_0x817e('0x63')]);_0x36d99b+=_0x817e('0xbd');if(_0x5c5647[_0x817e('0x74')]){var _0x4a7c49=_0x5c5647[_0x817e('0x74')];var _0x5ecc9a=path[_0x817e('0x79')](_0x343cc5,_0x4a7c49[_0x817e('0x73')]);if(fs[_0x817e('0xbe')](_0x5ecc9a)){fs[_0x817e('0xbf')](_0x5ecc9a)[_0x817e('0xc0')](fs[_0x817e('0xc1')](path[_0x817e('0x79')](_0x58790f,_0x4a7c49[_0x817e('0x73')])));}}}return new BPromise(function(_0x3e3a26,_0x5c3095){pdf['create'](_0x36d99b,_0x1e531d)[_0x817e('0xc2')](path[_0x817e('0x79')](_0x58790f,'interaction-'+_0x32fe8e+_0x817e('0xc3')),function(_0x5ad875,_0x1ddb74){if(_0x5ad875)return _0x5c3095(_0x5ad875);_0x3e3a26(_0x1ddb74);});});}})['then'](function(){if(_0x21c2b3){return new BPromise(function(_0x45f78c,_0x2efa2f){zipdir(_0x58790f,{'saveTo':_0xdded3d},function(_0x5b4993,_0x9096ae){if(_0x5b4993)return _0x2efa2f(_0x5b4993);return _0x45f78c(_0x9096ae);});});}})[_0x817e('0x1d')](function(){if(_0x21c2b3){return new BPromise(function(_0x439dba,_0x127d73){rimraf(_0x58790f,function(_0x2e98dd){if(_0x2e98dd)_0x127d73(_0x2e98dd);return _0x439dba();});});}})[_0x817e('0x1d')](function(){if(_0x21c2b3){return _0x2cac00[_0x817e('0x78')](_0xdded3d,_0x38d813,function(_0x1fc348){if(_0x1fc348){console['log'](_0x817e('0xc4'),_0x1fc348);}else{fs[_0x817e('0xc5')](_0xdded3d);}});}else{return _0x2cac00[_0x817e('0x69')](0xc8);}})[_0x817e('0x24')](handleError(_0x2cac00,null));}; \ No newline at end of file +var _0x7ef9=['setTags','spread','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','attachments','interaction-%s.zip','Contact','firstName','

Chat\x20Interaction:\x20#%d

','

Date:\x20%s

','','%s:\x20%s

','','existsSync','createReadStream','pipe','createWriteStream','.pdf','log','err','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','redis','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','client','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','reject','save','destroy','sendStatus','send','index','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','map','key','VIRTUAL','options','include','tag','push','Tag','Tags','distinct','read','Messages','direction','createdAt','ChatInteraction','includeAll','Users','name','fullname','CmContact','User','Owner','internal','ChatWebsite','color','ThroughTags','findAll','show','params','rawAttributes','find','create','body','update','describe','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Sequelize','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','type','mimetype','Attachment','attachmentDownload','findOne','Unauthorized','attachId','download','join','root','server/files/attachments/','close','mailTranscript','format','transcript-%s.txt','now','pathTranscript','ChatMessage','ChatWebsiteId','ContactId','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','user','pass','SendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','getMessages','order','ChatInteractionId','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','includeAgent'];(function(_0xc4d9ac,_0x313006){var _0x17f386=function(_0x273365){while(--_0x273365){_0xc4d9ac['push'](_0xc4d9ac['shift']());}};_0x17f386(++_0x313006);}(_0x7ef9,0xe2));var _0x97ef=function(_0x36c504,_0x2389a5){_0x36c504=_0x36c504-0x0;var _0x54ef33=_0x7ef9[_0x36c504];return _0x54ef33;};'use strict';var pdf=require(_0x97ef('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x97ef('0x1'));var zipdir=require(_0x97ef('0x2'));var jsonpatch=require(_0x97ef('0x3'));var rp=require('request-promise');var moment=require(_0x97ef('0x4'));var BPromise=require(_0x97ef('0x5'));var Mustache=require('mustache');var util=require(_0x97ef('0x6'));var path=require('path');var sox=require(_0x97ef('0x7'));var csv=require(_0x97ef('0x8'));var ejs=require(_0x97ef('0x9'));var fs=require('fs');var _=require(_0x97ef('0xa'));var squel=require(_0x97ef('0xb'));var crypto=require('crypto');var jsforce=require(_0x97ef('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x97ef('0x8'));var querystring=require(_0x97ef('0xd'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0x97ef('0xe'));var Redis=require(_0x97ef('0xf'));var qs=require(_0x97ef('0x10'));var logger=require(_0x97ef('0x11'))(_0x97ef('0x12'));var utils=require(_0x97ef('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x97ef('0x14')]=_['defaults'](config[_0x97ef('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x97ef('0x15'))(new Redis(config[_0x97ef('0x14')]));require(_0x97ef('0x16'))[_0x97ef('0x17')](socket);var jayson=require(_0x97ef('0x18'));var client=jayson['client'][_0x97ef('0x19')]({'port':0x232b});var client9004=jayson[_0x97ef('0x1a')][_0x97ef('0x19')]({'port':0x232c});function respondWithRpcPromise(_0xb84aaa,_0x35922b,_0x3de43c,_0x31fb9b){return new BPromise(function(_0x2f63f7,_0x202f5d){var _0xdc49ed=_0x31fb9b||client;return _0xdc49ed[_0x97ef('0x1b')](_0xb84aaa,_0x3de43c)[_0x97ef('0x1c')](function(_0x41184b){logger[_0x97ef('0x1d')](_0x97ef('0x1e'),_0x35922b,_0x97ef('0x1f'));logger[_0x97ef('0x20')](_0x97ef('0x21'),_0x35922b,_0x97ef('0x1f'),JSON[_0x97ef('0x22')](_0x41184b));if(_0x41184b[_0x97ef('0x23')]){if(_0x41184b[_0x97ef('0x23')][_0x97ef('0x24')]===0x1f4){logger[_0x97ef('0x23')](_0x97ef('0x1e'),_0x35922b,_0x41184b[_0x97ef('0x23')]['message']);return _0x202f5d(_0x41184b[_0x97ef('0x23')][_0x97ef('0x25')]);}logger[_0x97ef('0x23')](_0x97ef('0x1e'),_0x35922b,_0x41184b[_0x97ef('0x23')][_0x97ef('0x25')]);return _0x2f63f7(_0x41184b['error'][_0x97ef('0x25')]);}else{logger['info'](_0x97ef('0x1e'),_0x35922b,_0x97ef('0x1f'));_0x2f63f7(_0x41184b[_0x97ef('0x26')][_0x97ef('0x25')]);}})[_0x97ef('0x27')](function(_0x1a13ff){logger[_0x97ef('0x23')]('ChatInteraction,\x20%s,\x20%s',_0x35922b,_0x1a13ff);_0x202f5d(_0x1a13ff);});});}function respondWithStatusCode(_0x1ce617,_0x410431){_0x410431=_0x410431||0xcc;return function(_0x504f79){if(_0x504f79){return _0x1ce617['sendStatus'](_0x410431);}return _0x1ce617[_0x97ef('0x28')](_0x410431)[_0x97ef('0x29')]();};}function respondWithResult(_0x5b2f01,_0x46f492){_0x46f492=_0x46f492||0xc8;return function(_0x42185f){if(_0x42185f){return _0x5b2f01[_0x97ef('0x28')](_0x46f492)[_0x97ef('0x2a')](_0x42185f);}};}function respondWithFilteredResult(_0x19804c,_0x514999){return function(_0x1559cc){if(_0x1559cc){var _0x2064b6=_0x1559cc[_0x97ef('0x2b')],_0x41e000=_0x514999[_0x97ef('0x2c')],_0x3077f7=_0x514999['offset']+_0x514999[_0x97ef('0x2d')],_0x13855e;if(_0x3077f7>=_0x2064b6){_0x3077f7=_0x2064b6;_0x13855e=0xc8;}else{_0x13855e=0xce;}_0x19804c[_0x97ef('0x28')](_0x13855e);return _0x19804c[_0x97ef('0x2e')]('Content-Range',_0x41e000+'-'+_0x3077f7+'/'+_0x2064b6)['json'](_0x1559cc);}return null;};}function patchUpdates(_0x490f8f){return function(_0x225d34){try{jsonpatch['apply'](_0x225d34,_0x490f8f,!![]);}catch(_0x2eb42e){return BPromise[_0x97ef('0x2f')](_0x2eb42e);}return _0x225d34[_0x97ef('0x30')]();};}function saveUpdates(_0x133bb1,_0x5b1a6b){return function(_0x2e4904){if(_0x2e4904){return _0x2e4904['update'](_0x133bb1)[_0x97ef('0x1c')](function(_0x492f73){return _0x492f73;});}return null;};}function removeEntity(_0x6baf5b,_0x10d57b){return function(_0x1683ea){if(_0x1683ea){return _0x1683ea[_0x97ef('0x31')]()['then'](function(){_0x6baf5b[_0x97ef('0x28')](0xcc)[_0x97ef('0x29')]();});}};}function handleEntityNotFound(_0x589fc1,_0x30841f){return function(_0x3ef870){if(!_0x3ef870){_0x589fc1[_0x97ef('0x32')](0x194);}return _0x3ef870;};}function handleError(_0x1fca79,_0x352cbf){_0x352cbf=_0x352cbf||0x1f4;return function(_0x41ab49){logger[_0x97ef('0x23')](_0x41ab49['stack']);if(_0x41ab49['name']){delete _0x41ab49['name'];}_0x1fca79[_0x97ef('0x28')](_0x352cbf)[_0x97ef('0x33')](_0x41ab49);};}exports[_0x97ef('0x34')]=function(_0x13cc7f,_0x218f86){var _0x156dcc={},_0x1c6542={},_0x2e55f1={'count':0x0,'rows':[]};var _0x32d793=db['ChatInteraction']['rawAttributes'];_0x1c6542[_0x97ef('0x35')]=_[_0x97ef('0x36')](_0x32d793);_0x1c6542[_0x97ef('0x37')]=_['keys'](_0x13cc7f['query']);_0x1c6542[_0x97ef('0x38')]=_[_0x97ef('0x39')](_0x1c6542[_0x97ef('0x35')],_0x1c6542[_0x97ef('0x37')]);_0x156dcc[_0x97ef('0x3a')]=_[_0x97ef('0x39')](_0x1c6542['model'],qs['fields'](_0x13cc7f['query'][_0x97ef('0x3b')]));_0x156dcc['attributes']=_0x156dcc[_0x97ef('0x3a')][_0x97ef('0x3c')]?_0x156dcc[_0x97ef('0x3a')]:_0x1c6542[_0x97ef('0x35')];if(!_0x13cc7f[_0x97ef('0x37')]['hasOwnProperty'](_0x97ef('0x3d'))){_0x156dcc[_0x97ef('0x2d')]=qs[_0x97ef('0x2d')](_0x13cc7f[_0x97ef('0x37')][_0x97ef('0x2d')]);_0x156dcc['offset']=qs[_0x97ef('0x2c')](_0x13cc7f[_0x97ef('0x37')][_0x97ef('0x2c')]);}_0x156dcc['order']=qs[_0x97ef('0x3e')](_0x13cc7f[_0x97ef('0x37')][_0x97ef('0x3e')]);_0x156dcc[_0x97ef('0x3f')]=qs[_0x97ef('0x38')](_['pick'](_0x13cc7f['query'],_0x1c6542['filters']));if(_0x13cc7f[_0x97ef('0x37')][_0x97ef('0x40')]){_0x156dcc[_0x97ef('0x3f')]=_[_0x97ef('0x41')](_0x156dcc[_0x97ef('0x3f')],{'$or':_[_0x97ef('0x42')](_0x32d793,function(_0x1c399c){if(_0x1c399c['type'][_0x97ef('0x43')]!==_0x97ef('0x44')){var _0x24191a={};_0x24191a[_0x1c399c['field']]={'$like':'%'+_0x13cc7f[_0x97ef('0x37')][_0x97ef('0x40')]+'%'};return _0x24191a;}})});}_0x156dcc=_[_0x97ef('0x41')]({},_0x156dcc,_0x13cc7f[_0x97ef('0x45')]);var _0x309aec={'where':_0x156dcc[_0x97ef('0x3f')]};_0x309aec[_0x97ef('0x46')]=[];if(_0x13cc7f[_0x97ef('0x37')][_0x97ef('0x47')]){_0x309aec[_0x97ef('0x46')][_0x97ef('0x48')]({'model':db[_0x97ef('0x49')],'as':_0x97ef('0x4a'),'attributes':['id'],'where':{'id':_0x13cc7f[_0x97ef('0x37')][_0x97ef('0x47')]},'required':!![]});_0x309aec[_0x97ef('0x4b')]=!![];}if(_0x13cc7f[_0x97ef('0x37')][_0x97ef('0x4c')]){_0x309aec[_0x97ef('0x46')]['push']({'model':db['ChatMessage'],'as':_0x97ef('0x4d'),'attributes':['id',_0x97ef('0x4e'),_0x97ef('0x4f'),_0x97ef('0x4c')],'where':{'direction':'in','read':_0x13cc7f['query'][_0x97ef('0x4c')]||![]},'required':!![]});_0x309aec[_0x97ef('0x4b')]=!![];}return db[_0x97ef('0x50')][_0x97ef('0x2b')](_0x309aec)[_0x97ef('0x1c')](function(_0x1d928c){_0x2e55f1['count']=_0x1d928c;if(_0x13cc7f[_0x97ef('0x37')][_0x97ef('0x51')]){_0x156dcc[_0x97ef('0x46')]=[{'model':db['User'],'as':_0x97ef('0x52'),'required':![],'attributes':['id',_0x97ef('0x53'),_0x97ef('0x54')]},{'model':db[_0x97ef('0x55')],'as':'Contact','required':![]},{'model':db[_0x97ef('0x56')],'as':_0x97ef('0x57'),'attributes':[_0x97ef('0x53'),_0x97ef('0x54'),_0x97ef('0x58')],'required':![]},{'model':db[_0x97ef('0x59')],'as':'Account','attributes':[_0x97ef('0x53'),_0x97ef('0x43')],'required':![]},{'model':db['ChatMessage'],'as':_0x97ef('0x4d'),'attributes':['id',_0x97ef('0x4e'),'createdAt',_0x97ef('0x4c')],'where':{'direction':'in','read':_0x13cc7f[_0x97ef('0x37')]['read']||![]},'required':_0x13cc7f[_0x97ef('0x37')]['read']||![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x97ef('0x53'),_0x97ef('0x5a')],'required':_0x13cc7f[_0x97ef('0x37')][_0x97ef('0x47')]?!![]:![]},{'model':db[_0x97ef('0x49')],'as':_0x97ef('0x5b'),'attributes':['id',_0x97ef('0x53'),'color'],'through':_0x13cc7f['query'][_0x97ef('0x47')]?{'attributes':[],'where':{'TagId':_0x13cc7f[_0x97ef('0x37')][_0x97ef('0x47')]||undefined}}:{},'required':_0x13cc7f[_0x97ef('0x37')][_0x97ef('0x47')]?!![]:![]}];}return db['ChatInteraction'][_0x97ef('0x5c')](_0x156dcc);})[_0x97ef('0x1c')](function(_0x3c013e){_0x2e55f1['rows']=_0x3c013e;return _0x2e55f1;})[_0x97ef('0x1c')](respondWithFilteredResult(_0x218f86,_0x156dcc))[_0x97ef('0x27')](handleError(_0x218f86,null));};exports[_0x97ef('0x5d')]=function(_0x244a89,_0x3db109){var _0x301a08={'raw':![],'where':{'id':_0x244a89[_0x97ef('0x5e')]['id']}},_0x46dfd8={};_0x46dfd8['model']=_[_0x97ef('0x36')](db['ChatInteraction'][_0x97ef('0x5f')]);_0x46dfd8[_0x97ef('0x37')]=_[_0x97ef('0x36')](_0x244a89['query']);_0x46dfd8[_0x97ef('0x38')]=_[_0x97ef('0x39')](_0x46dfd8['model'],_0x46dfd8[_0x97ef('0x37')]);_0x301a08[_0x97ef('0x3a')]=_['intersection'](_0x46dfd8['model'],qs[_0x97ef('0x3b')](_0x244a89[_0x97ef('0x37')][_0x97ef('0x3b')]));_0x301a08[_0x97ef('0x3a')]=_0x301a08[_0x97ef('0x3a')]['length']?_0x301a08[_0x97ef('0x3a')]:_0x46dfd8[_0x97ef('0x35')];if(_0x244a89[_0x97ef('0x37')][_0x97ef('0x51')]){_0x301a08[_0x97ef('0x46')]=[{'all':!![]}];}_0x301a08=_[_0x97ef('0x41')]({},_0x301a08,_0x244a89['options']);return db[_0x97ef('0x50')][_0x97ef('0x60')](_0x301a08)[_0x97ef('0x1c')](handleEntityNotFound(_0x3db109,null))[_0x97ef('0x1c')](respondWithResult(_0x3db109,null))[_0x97ef('0x27')](handleError(_0x3db109,null));};exports[_0x97ef('0x61')]=function(_0x5a0b8a,_0x1c36ca){return db[_0x97ef('0x50')][_0x97ef('0x61')](_0x5a0b8a[_0x97ef('0x62')],{})['then'](respondWithResult(_0x1c36ca,0xc9))[_0x97ef('0x27')](handleError(_0x1c36ca,null));};exports[_0x97ef('0x63')]=function(_0x4c8a3e,_0x74204b){if(_0x4c8a3e[_0x97ef('0x62')]['id']){delete _0x4c8a3e[_0x97ef('0x62')]['id'];}return db[_0x97ef('0x50')][_0x97ef('0x60')]({'where':{'id':_0x4c8a3e['params']['id']}})[_0x97ef('0x1c')](handleEntityNotFound(_0x74204b,null))[_0x97ef('0x1c')](saveUpdates(_0x4c8a3e[_0x97ef('0x62')],null))[_0x97ef('0x1c')](respondWithResult(_0x74204b,null))[_0x97ef('0x27')](handleError(_0x74204b,null));};exports['destroy']=function(_0x1648b2,_0x18c4a7){return db[_0x97ef('0x50')][_0x97ef('0x60')]({'where':{'id':_0x1648b2[_0x97ef('0x5e')]['id']}})['then'](handleEntityNotFound(_0x18c4a7,null))[_0x97ef('0x1c')](removeEntity(_0x18c4a7,null))[_0x97ef('0x27')](handleError(_0x18c4a7,null));};exports['describe']=function(_0x369648,_0x5b2ed0){return db[_0x97ef('0x50')][_0x97ef('0x64')]()[_0x97ef('0x1c')](respondWithResult(_0x5b2ed0,null))[_0x97ef('0x27')](handleError(_0x5b2ed0,null));};exports[_0x97ef('0x65')]=function(_0x27810f,_0x58d095){if(_0x27810f[_0x97ef('0x62')]['id']){delete _0x27810f['body']['id'];}return db[_0x97ef('0x50')][_0x97ef('0x60')]({'where':{'id':_0x27810f[_0x97ef('0x5e')]['id']}})[_0x97ef('0x1c')](handleEntityNotFound(_0x58d095,null))[_0x97ef('0x1c')](saveUpdates(_0x27810f['body'],null))[_0x97ef('0x1c')](respondWithResult(_0x58d095,null))['catch'](handleError(_0x58d095,null));};exports[_0x97ef('0x66')]=function(_0x356579,_0x58093,_0x2eebbb){if(_0x356579[_0x97ef('0x62')]['id']){delete _0x356579[_0x97ef('0x62')]['id'];}return db['ChatInteraction'][_0x97ef('0x60')]({'where':{'id':_0x356579[_0x97ef('0x5e')]['id']}})['then'](function(_0x314e73){if(!_0x314e73){logger[_0x97ef('0x23')](_0x97ef('0x67'),_0x97ef('0x66'),0x194,_0x97ef('0x68'));_0x58093['sendStatus'](0x194);}else{if(_0x314e73[_0x97ef('0x69')]){throw new db[(_0x97ef('0x6a'))]['ValidationError'](_0x97ef('0x6b'));}}return _0x314e73;})[_0x97ef('0x1c')](function(_0x2d8c00){if(_0x2d8c00){return _0x2d8c00[_0x97ef('0x63')]({'closed':_0x356579[_0x97ef('0x62')][_0x97ef('0x6c')],'disposition':_0x356579[_0x97ef('0x62')][_0x97ef('0x6d')]})[_0x97ef('0x1c')](function(_0x2349ef){return _0x2349ef;});}})[_0x97ef('0x1c')](function(_0x17c21c){return respondWithRpcPromise(_0x97ef('0x6e'),_0x97ef('0x66'),_0x356579[_0x97ef('0x62')],client9004);})[_0x97ef('0x1c')](respondWithResult(_0x58093,null))[_0x97ef('0x27')](handleError(_0x58093,null));};exports[_0x97ef('0x6f')]=function(_0x4e0489,_0x2aad6d,_0x4d3dfc){_0x4e0489['body'][_0x97ef('0x53')]=_0x4e0489[_0x97ef('0x70')][_0x97ef('0x71')];_0x4e0489[_0x97ef('0x62')][_0x97ef('0x72')]=_0x4e0489[_0x97ef('0x70')][_0x97ef('0x73')];_0x4e0489[_0x97ef('0x62')][_0x97ef('0x74')]=_0x4e0489[_0x97ef('0x70')][_0x97ef('0x75')];return db[_0x97ef('0x76')]['create'](_0x4e0489[_0x97ef('0x62')])[_0x97ef('0x1c')](respondWithResult(_0x2aad6d,0xc9))['catch'](handleError(_0x2aad6d,null));};exports[_0x97ef('0x77')]=function(_0x270f4d,_0x17d3f2,_0x95e3ac){return db[_0x97ef('0x50')][_0x97ef('0x78')]({'where':{'id':_0x270f4d['params']['id']},'raw':!![]})[_0x97ef('0x1c')](handleEntityNotFound(_0x17d3f2,null))['then'](function(_0x1ef9c4){if(_0x1ef9c4){if(_0x1ef9c4[_0x97ef('0x6c')]){return _0x17d3f2['status'](0x193)[_0x97ef('0x2a')]({'status':0x193,'message':_0x97ef('0x79')});}return db[_0x97ef('0x76')][_0x97ef('0x78')]({'where':{'id':_0x270f4d[_0x97ef('0x37')][_0x97ef('0x7a')]},'raw':!![]})[_0x97ef('0x1c')](handleEntityNotFound(_0x17d3f2,null));}})[_0x97ef('0x1c')](function(_0x363136){if(_0x363136){return _0x17d3f2[_0x97ef('0x7b')](path[_0x97ef('0x7c')](config[_0x97ef('0x7d')],_0x97ef('0x7e'),_0x363136[_0x97ef('0x72')]));}})[_0x97ef('0x27')](handleError(_0x17d3f2,null));};exports[_0x97ef('0x7f')]=function(_0x1fb700,_0x2a9964){var _0x2a8f12=null;var _0x21ff84=null;var _0x42c98e=null;var _0x1c514b=null;if(_0x1fb700[_0x97ef('0x62')]['id']){delete _0x1fb700[_0x97ef('0x62')]['id'];}if(_0x1fb700['body'][_0x97ef('0x80')]){_0x1c514b=path[_0x97ef('0x7c')](config[_0x97ef('0x7d')],'server/files/chat/upload/',util[_0x97ef('0x81')](_0x97ef('0x82'),Date[_0x97ef('0x83')]()));_0x1fb700[_0x97ef('0x62')][_0x97ef('0x84')]=_0x1c514b;}return db['ChatInteraction'][_0x97ef('0x60')]({'where':{'id':_0x1fb700['params']['id']},'include':[{'model':db[_0x97ef('0x85')],'as':_0x97ef('0x4d'),'include':[{'model':db[_0x97ef('0x56')],'as':_0x97ef('0x56')}]}]})[_0x97ef('0x1c')](handleEntityNotFound(_0x2a9964,null))[_0x97ef('0x1c')](saveUpdates(_0x1fb700[_0x97ef('0x62')],null))[_0x97ef('0x1c')](function(_0x4fdff4){if(_0x4fdff4){_0x2a8f12=_0x4fdff4;return db[_0x97ef('0x59')][_0x97ef('0x60')]({'where':{'id':_0x2a8f12[_0x97ef('0x86')]}});}})[_0x97ef('0x1c')](function(_0xa72cdd){if(_0xa72cdd){_0x42c98e=_0xa72cdd;return db[_0x97ef('0x55')][_0x97ef('0x60')]({'where':{'id':_0x2a8f12[_0x97ef('0x87')]}});}})[_0x97ef('0x1c')](function(_0x4ccf91){if(_0x4ccf91){_0x21ff84=_0x4ccf91;if(_0x1c514b){var _0x598b91=null;for(var _0x31e1e5=0x1;_0x31e1e5<_0x2a8f12['Messages']['length'];++_0x31e1e5){_0x598b91=_0x2a8f12[_0x97ef('0x4d')][_0x31e1e5];var _0x4ef79c=_0x598b91['UserId']?util[_0x97ef('0x81')](_0x97ef('0x88'),_0x42c98e[_0x97ef('0x89')],_0x598b91[_0x97ef('0x69')]):_0x97ef('0x8a');var _0x564ced=_0x1fb700['body'][_0x97ef('0x8b')]||util[_0x97ef('0x81')]('%s%d',_0x97ef('0x8c'),_0x598b91[_0x97ef('0x87')]);switch(_0x42c98e[_0x97ef('0x8d')]){case _0x97ef('0x8e'):_0x4ef79c=_0x598b91['UserId']?util[_0x97ef('0x81')](_0x97ef('0x88'),_0x42c98e[_0x97ef('0x89')],_0x598b91[_0x97ef('0x69')]):_0x97ef('0x8a');break;case _0x97ef('0x8f'):_0x4ef79c=_0x598b91[_0x97ef('0x69')]?_0x598b91[_0x97ef('0x56')][_0x97ef('0x90')]||_0x598b91[_0x97ef('0x56')][_0x97ef('0x54')]:_0x97ef('0x8a');break;case _0x97ef('0x91'):_0x4ef79c=_0x598b91['UserId']?_0x598b91[_0x97ef('0x56')][_0x97ef('0x54')]:_0x97ef('0x8a');break;default:_0x4ef79c=_0x598b91[_0x97ef('0x69')]?util[_0x97ef('0x81')](_0x97ef('0x88'),_0x42c98e['agentAlias'],_0x598b91['UserId']):'System';}var _0x4e08bb=util[_0x97ef('0x81')]('[%s]\x20%s:\x20%s\x0a',moment(_0x598b91[_0x97ef('0x4f')])['format'](_0x97ef('0x92')),_0x598b91[_0x97ef('0x4e')]==='in'?_0x564ced:_0x4ef79c,_0x598b91[_0x97ef('0x62')]);if(!_0x598b91[_0x97ef('0x93')]){fs[_0x97ef('0x94')](_0x1c514b,_0x4e08bb);}}return db[_0x97ef('0x95')][_0x97ef('0x78')]({'where':{'service':!![]},'include':[{'model':db[_0x97ef('0x96')],'as':_0x97ef('0x97'),'raw':!![]}]});}}})['then'](function(_0x55cc75){if(_0x55cc75&&_0x55cc75[_0x97ef('0x97')]&&_0x1fb700[_0x97ef('0x62')]){var _0x3134a={'tls':{'rejectUnauthorized':![]}};if(_0x55cc75[_0x97ef('0x97')][_0x97ef('0x98')]){_0x3134a[_0x97ef('0x98')]=_0x55cc75[_0x97ef('0x97')]['service'];}else{_0x3134a[_0x97ef('0x99')]=_0x55cc75[_0x97ef('0x97')][_0x97ef('0x99')];_0x3134a[_0x97ef('0x9a')]=_0x55cc75[_0x97ef('0x97')][_0x97ef('0x9a')];_0x3134a[_0x97ef('0x9b')]=_0x55cc75[_0x97ef('0x97')][_0x97ef('0x9b')];}if(_0x55cc75[_0x97ef('0x97')][_0x97ef('0x9c')]){_0x3134a['auth']={'user':_0x55cc75[_0x97ef('0x97')][_0x97ef('0x9d')],'pass':_0x55cc75[_0x97ef('0x97')][_0x97ef('0x9e')]};}return respondWithRpcPromise(_0x97ef('0x9f'),'sendMail',{'account':_0x3134a,'message':{'from':util[_0x97ef('0x81')](_0x97ef('0xa0'),_0x55cc75[_0x97ef('0x53')],_0x55cc75['email']||_0x55cc75[_0x97ef('0x97')][_0x97ef('0x9d')]),'to':_0x1fb700[_0x97ef('0x62')]['mailTranscript'],'subject':_0x97ef('0xa1'),'text':util[_0x97ef('0x81')](_0x97ef('0xa2'),_0x1fb700[_0x97ef('0x62')][_0x97ef('0x80')]),'attachments':[{'path':_0x1c514b}]}})[_0x97ef('0x1c')](function(){return _0x2a8f12;})['catch'](function(_0x4d8aa7){console['error'](_0x4d8aa7);});}else{return _0x2a8f12;}})[_0x97ef('0x1c')](respondWithStatusCode(_0x2a9964,0xc8))[_0x97ef('0x27')](handleError(_0x2a9964,null));};exports[_0x97ef('0xa3')]=function(_0x53f4e8,_0xe4baef,_0x3e8d6f){return db['ChatMessage'][_0x97ef('0x60')]({'where':{'id':_0x53f4e8[_0x97ef('0x5e')]['id']}})[_0x97ef('0x1c')](handleEntityNotFound(_0xe4baef,null))[_0x97ef('0x1c')](function(_0x19514d){if(_0x19514d){return _0x19514d['addMessage'](_0x53f4e8[_0x97ef('0x62')]['ids'],_[_0x97ef('0xa4')](_0x53f4e8[_0x97ef('0x62')],[_0x97ef('0xa5'),'id'])||{});}})[_0x97ef('0x1c')](respondWithResult(_0xe4baef,null))[_0x97ef('0x27')](handleError(_0xe4baef,null));};exports[_0x97ef('0xa6')]=function(_0x305643,_0x3d80c8,_0x452cc9){var _0x6e2cda={'raw':![],'where':{}};var _0x3320a6={};var _0x774924={'count':0x0,'rows':[]};return db[_0x97ef('0x50')][_0x97ef('0x78')]({'where':{'id':_0x305643[_0x97ef('0x5e')]['id']}})[_0x97ef('0x1c')](handleEntityNotFound(_0x3d80c8,null))[_0x97ef('0x1c')](function(_0x23010a){if(_0x23010a){_0x3320a6[_0x97ef('0x35')]=_[_0x97ef('0x36')](db[_0x97ef('0x85')][_0x97ef('0x5f')]);_0x3320a6[_0x97ef('0x37')]=_['keys'](_0x305643[_0x97ef('0x37')]);_0x3320a6[_0x97ef('0x38')]=_[_0x97ef('0x39')](_0x3320a6[_0x97ef('0x35')],_0x3320a6[_0x97ef('0x37')]);_0x6e2cda['attributes']=_['intersection'](_0x3320a6[_0x97ef('0x35')],qs[_0x97ef('0x3b')](_0x305643['query']['fields']));_0x6e2cda[_0x97ef('0x3a')]=_0x6e2cda[_0x97ef('0x3a')][_0x97ef('0x3c')]?_0x6e2cda[_0x97ef('0x3a')]:_0x3320a6['model'];if(!_0x305643[_0x97ef('0x37')]['hasOwnProperty'](_0x97ef('0x3d'))){_0x6e2cda[_0x97ef('0x2d')]=qs['limit'](_0x305643[_0x97ef('0x37')][_0x97ef('0x2d')]);_0x6e2cda[_0x97ef('0x2c')]=qs['offset'](_0x305643['query'][_0x97ef('0x2c')]);}_0x6e2cda[_0x97ef('0xa7')]=qs[_0x97ef('0x3e')](_0x305643[_0x97ef('0x37')][_0x97ef('0x3e')]);_0x6e2cda[_0x97ef('0x3f')]=qs['filters'](_['pick'](_0x305643['query'],_0x3320a6['filters']));_0x6e2cda[_0x97ef('0x3f')][_0x97ef('0xa8')]=_0x23010a['id'];if(_0x305643[_0x97ef('0x37')][_0x97ef('0x40')]){_0x6e2cda[_0x97ef('0x3f')]=_['merge'](_0x6e2cda[_0x97ef('0x3f')],{'$or':_['map'](_0x6e2cda[_0x97ef('0x3a')],function(_0x3ad2d6){var _0x309d47={};_0x309d47[_0x3ad2d6]={'$like':'%'+_0x305643['query'][_0x97ef('0x40')]+'%'};return _0x309d47;})});}if(_0x305643[_0x97ef('0x37')][_0x97ef('0xa9')]){var _0x45a0c8=_0x305643['query'][_0x97ef('0xa9')]['split'](',');var _0x3383da={};_0x3383da[_0x45a0c8[0x0]]={'$gte':moment(_0x45a0c8[0x1])[_0x97ef('0x81')](_0x97ef('0xaa'))};_0x6e2cda[_0x97ef('0x3f')]=_[_0x97ef('0x41')](_0x6e2cda['where'],_0x3383da);}_0x6e2cda=_['merge']({},_0x6e2cda,_0x305643['options']);return db[_0x97ef('0x85')][_0x97ef('0x2b')]({'where':_0x6e2cda[_0x97ef('0x3f')]})[_0x97ef('0x1c')](function(_0x442712){_0x774924[_0x97ef('0x2b')]=_0x442712;if(_0x305643[_0x97ef('0x37')][_0x97ef('0x51')]){_0x6e2cda[_0x97ef('0x46')]=[{'all':!![]}];}return db[_0x97ef('0x85')][_0x97ef('0x5c')](_0x6e2cda);})[_0x97ef('0x1c')](function(_0x29fb7b){_0x774924[_0x97ef('0xab')]=_0x29fb7b;return _0x774924;});}})['then'](respondWithFilteredResult(_0x3d80c8,_0x6e2cda))[_0x97ef('0x27')](handleError(_0x3d80c8,null));};exports[_0x97ef('0xac')]=function(_0x48fc56,_0xfed050,_0x2e5ff){var _0xdb2013={'where':{}},_0x4ef413={},_0x10da69={'count':0x0,'rows':[]};return db[_0x97ef('0x50')][_0x97ef('0x78')]({'where':{'id':_0x48fc56[_0x97ef('0x5e')]['id']}})[_0x97ef('0x1c')](handleEntityNotFound(_0xfed050,null))[_0x97ef('0x1c')](function(_0x50ffc8){if(_0x50ffc8){_0x4ef413[_0x97ef('0x35')]=_['keys'](db[_0x97ef('0x85')]['rawAttributes']);_0x4ef413['query']=_[_0x97ef('0x36')](_0x48fc56[_0x97ef('0x37')]);_0x4ef413[_0x97ef('0x38')]=_[_0x97ef('0x39')](_0x4ef413['model'],_0x4ef413['query']);_0xdb2013[_0x97ef('0x3a')]=_['intersection'](_0x4ef413[_0x97ef('0x35')],qs[_0x97ef('0x3b')](_0x48fc56[_0x97ef('0x37')][_0x97ef('0x3b')]));_0xdb2013['attributes']=_0xdb2013['attributes'][_0x97ef('0x3c')]?_0xdb2013[_0x97ef('0x3a')]:_0x4ef413[_0x97ef('0x35')];if(!_0x48fc56[_0x97ef('0x37')]['hasOwnProperty'](_0x97ef('0x3d'))){_0xdb2013[_0x97ef('0x2d')]=qs['limit'](_0x48fc56[_0x97ef('0x37')][_0x97ef('0x2d')]);_0xdb2013[_0x97ef('0x2c')]=qs[_0x97ef('0x2c')](_0x48fc56[_0x97ef('0x37')][_0x97ef('0x2c')]);}_0xdb2013[_0x97ef('0xa7')]=qs['sort'](_0x48fc56[_0x97ef('0x37')][_0x97ef('0x3e')]);_0xdb2013['where']=qs[_0x97ef('0x38')](_['pick'](_0x48fc56['query'],_0x4ef413['filters']));_0xdb2013[_0x97ef('0x3f')][_0x97ef('0xa8')]=_0x50ffc8['id'];if(_0x48fc56[_0x97ef('0x37')][_0x97ef('0x40')]){_0xdb2013['where']=_[_0x97ef('0x41')](_0xdb2013['where'],{'$or':_['map'](_0xdb2013[_0x97ef('0x3a')],function(_0x2e099c){var _0x291ce8={};_0x291ce8[_0x2e099c]={'$like':'%'+_0x48fc56[_0x97ef('0x37')]['filter']+'%'};return _0x291ce8;})});}_0xdb2013[_0x97ef('0x3f')][_0x97ef('0x93')]=![];if(_0x48fc56[_0x97ef('0x37')]['id']){_0xdb2013['where']['id']={'$gt':_0x48fc56[_0x97ef('0x37')]['id']};}_0xdb2013=_[_0x97ef('0x41')]({},_0xdb2013,_0x48fc56[_0x97ef('0x45')]);return db[_0x97ef('0x85')][_0x97ef('0x2b')]({'where':_0xdb2013[_0x97ef('0x3f')]})[_0x97ef('0x1c')](function(_0x5cc4ac){_0x10da69[_0x97ef('0x2b')]=_0x5cc4ac;_0xdb2013[_0x97ef('0x46')]=[];if(_0x48fc56[_0x97ef('0x37')][_0x97ef('0xad')]){_0xdb2013['include'][_0x97ef('0x48')]({'model':db['User'],'as':_0x97ef('0x56'),'attributes':['id',_0x97ef('0x54'),'alias']});}if(_0x48fc56['query'][_0x97ef('0x51')]){_0xdb2013[_0x97ef('0x46')]=[{'all':!![]}];}return db[_0x97ef('0x85')]['findAll'](_0xdb2013);})[_0x97ef('0x1c')](function(_0x5965a5){_0x10da69[_0x97ef('0xab')]=_0x5965a5;return _0x10da69;});}})['then'](respondWithFilteredResult(_0xfed050,_0xdb2013))[_0x97ef('0x27')](handleError(_0xfed050,null));};exports['addTags']=function(_0x2ba626,_0x159322,_0x3ec72e){return db[_0x97ef('0x50')][_0x97ef('0x60')]({'where':{'id':_0x2ba626['params']['id']}})[_0x97ef('0x1c')](handleEntityNotFound(_0x159322,null))[_0x97ef('0x1c')](function(_0x18bf70){if(_0x18bf70){return _0x18bf70[_0x97ef('0xae')](_0x2ba626[_0x97ef('0x62')][_0x97ef('0xa5')],_['omit'](_0x2ba626[_0x97ef('0x62')],[_0x97ef('0xa5'),'id'])||{})[_0x97ef('0xaf')](function(){return db[_0x97ef('0x49')]['findAll']({'attributes':['id',_0x97ef('0x53'),'color'],'where':{'id':_0x2ba626[_0x97ef('0x62')][_0x97ef('0xa5')]}});})['then'](function(_0x5224b5){socket[_0x97ef('0xb0')](_0x97ef('0xb1'),{'id':Number(_0x2ba626[_0x97ef('0x5e')]['id']),'tags':_0x5224b5||[]});return{'id':Number(_0x2ba626[_0x97ef('0x5e')]['id']),'tags':_0x5224b5||[]};});}})['then'](respondWithResult(_0x159322,null))[_0x97ef('0x27')](handleError(_0x159322,null));};exports[_0x97ef('0xb2')]=function(_0x27c38a,_0x49d4f8,_0x38a51a){var _0x4e3c95;return db[_0x97ef('0x50')]['find']({'where':{'id':_0x27c38a[_0x97ef('0x5e')]['id']}})[_0x97ef('0x1c')](handleEntityNotFound(_0x49d4f8,null))[_0x97ef('0x1c')](function(_0x2587a1){if(_0x2587a1){return _0x2587a1[_0x97ef('0xb2')](_0x27c38a[_0x97ef('0x37')][_0x97ef('0xa5')]);}})[_0x97ef('0x1c')](respondWithStatusCode(_0x49d4f8,null))['catch'](handleError(_0x49d4f8,null));};exports[_0x97ef('0x7b')]=function(_0x45ddaa,_0x332375){var _0x3cfc12=moment()[_0x97ef('0xb3')]()[_0x97ef('0xb4')]();var _0x22091c=path[_0x97ef('0x7c')](config[_0x97ef('0x7d')],_0x97ef('0xb5'),'files','tmp');var _0x355949=path['join'](config['root'],_0x97ef('0xb5'),_0x97ef('0xb6'),_0x97ef('0xb7'));var _0x511fd6=path['join'](_0x22091c,_0x3cfc12);var _0x55e619=util[_0x97ef('0x81')](_0x97ef('0xb8'),_0x3cfc12);var _0x57dee2=path[_0x97ef('0x7c')](_0x22091c,_0x55e619);var _0x2894b3=![];return db[_0x97ef('0x50')][_0x97ef('0x60')]({'where':{'id':_0x45ddaa[_0x97ef('0x5e')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x97ef('0x4d'),'attributes':['id',_0x97ef('0x62')],'include':[{'model':db['User'],'as':'User','attributes':['id',_0x97ef('0x54')],'raw':!![]},{'model':db[_0x97ef('0x55')],'as':_0x97ef('0xb9'),'attributes':['id',_0x97ef('0xba')],'raw':!![]},{'model':db[_0x97ef('0x76')],'as':_0x97ef('0x76'),'raw':!![]}]}]})[_0x97ef('0x1c')](handleEntityNotFound(_0x332375,null))[_0x97ef('0x1c')](function(_0x300cb2){if(_0x300cb2){_0x2894b3=!![];var _0x1334c7='';var _0x6838be={'format':'Letter','border':'1cm'};fs['mkdirSync'](_0x511fd6);_0x1334c7+=util['format'](_0x97ef('0xbb'),_0x300cb2['id']);_0x1334c7+=util['format'](_0x97ef('0xbc'),moment()[_0x97ef('0x81')]('MMMM\x20Do\x20YYYY,\x20HH:mm:ss')[_0x97ef('0xb4')]());_0x1334c7+='
';for(var _0x8657a9=0x1;_0x8657a9<_0x300cb2[_0x97ef('0x4d')]['length'];_0x8657a9++){var _0x4ad568=_0x300cb2['Messages'][_0x8657a9];_0x1334c7+=_0x97ef('0xbd');_0x1334c7+=util[_0x97ef('0x81')](_0x97ef('0xbe'),_0x4ad568['User']?_0x4ad568['User']['fullname']:_0x4ad568[_0x97ef('0xb9')][_0x97ef('0xba')],_0x4ad568[_0x97ef('0x62')]);_0x1334c7+=_0x97ef('0xbf');if(_0x4ad568[_0x97ef('0x76')]){var _0x4f3315=_0x4ad568[_0x97ef('0x76')];var _0x473ad2=path['join'](_0x355949,_0x4f3315['basename']);if(fs[_0x97ef('0xc0')](_0x473ad2)){fs[_0x97ef('0xc1')](_0x473ad2)[_0x97ef('0xc2')](fs[_0x97ef('0xc3')](path['join'](_0x511fd6,_0x4f3315[_0x97ef('0x72')])));}}}return new BPromise(function(_0x46a0d3,_0x56c539){pdf[_0x97ef('0x61')](_0x1334c7,_0x6838be)['toFile'](path[_0x97ef('0x7c')](_0x511fd6,'interaction-'+_0x3cfc12+_0x97ef('0xc4')),function(_0x2101fe,_0x431fd3){if(_0x2101fe)return _0x56c539(_0x2101fe);_0x46a0d3(_0x431fd3);});});}})[_0x97ef('0x1c')](function(){if(_0x2894b3){return new BPromise(function(_0x410353,_0x23a9ce){zipdir(_0x511fd6,{'saveTo':_0x57dee2},function(_0x55b441,_0x132cf3){if(_0x55b441)return _0x23a9ce(_0x55b441);return _0x410353(_0x132cf3);});});}})[_0x97ef('0x1c')](function(){if(_0x2894b3){return new BPromise(function(_0x4052ad,_0x559272){rimraf(_0x511fd6,function(_0x58b548){if(_0x58b548)_0x559272(_0x58b548);return _0x4052ad();});});}})['then'](function(){if(_0x2894b3){return _0x332375[_0x97ef('0x7b')](_0x57dee2,_0x55e619,function(_0xb31482){if(_0xb31482){console[_0x97ef('0xc5')](_0x97ef('0xc6'),_0xb31482);}else{fs[_0x97ef('0xc7')](_0x57dee2);}});}else{return _0x332375['sendStatus'](0xc8);}})[_0x97ef('0x27')](handleError(_0x332375,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 911352d..dc11818 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 _0xf247=['update','remove','emit','hasOwnProperty','hook','exports','ChatInteraction','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf247,0xa6));var _0x7f24=function(_0x9077a4,_0x41748c){_0x9077a4=_0x9077a4-0x0;var _0x204bdc=_0xf247[_0x9077a4];return _0x204bdc;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db'][_0x7f24('0x0')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7f24('0x1'),'afterUpdate':_0x7f24('0x2'),'afterDestroy':_0x7f24('0x3')};function emitEvent(_0x22481e){return function(_0x15600c,_0x451cac,_0x59971f){ChatInteractionEvents[_0x7f24('0x4')](_0x22481e+':'+_0x15600c['id'],_0x15600c);ChatInteractionEvents[_0x7f24('0x4')](_0x22481e,_0x15600c);_0x59971f(null);};}for(var e in events){if(events[_0x7f24('0x5')](e)){var event=events[e];ChatInteraction[_0x7f24('0x6')](e,emitEvent(event));}}module[_0x7f24('0x7')]=ChatInteractionEvents; \ No newline at end of file +var _0x2711=['events','../../mysqldb','ChatInteraction','setMaxListeners','update','remove','emit'];(function(_0x225663,_0x2b04ad){var _0x415563=function(_0x3d68ba){while(--_0x3d68ba){_0x225663['push'](_0x225663['shift']());}};_0x415563(++_0x2b04ad);}(_0x2711,0x181));var _0x1271=function(_0x445869,_0x3c3086){_0x445869=_0x445869-0x0;var _0x4f7f0d=_0x2711[_0x445869];return _0x4f7f0d;};'use strict';var EventEmitter=require(_0x1271('0x0'));var ChatInteraction=require(_0x1271('0x1'))['db'][_0x1271('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x1271('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1271('0x4'),'afterDestroy':_0x1271('0x5')};function emitEvent(_0x3fa4ec){return function(_0xa3a975,_0x4fc951,_0x3583c0){ChatInteractionEvents['emit'](_0x3fa4ec+':'+_0xa3a975['id'],_0xa3a975);ChatInteractionEvents[_0x1271('0x6')](_0x3fa4ec,_0xa3a975);_0x3583c0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index aeb6f23..a9ff6c0 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 _0x1f64=['chat_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','./chatInteraction.attributes','define'];(function(_0x13484c,_0x137c72){var _0x1b559c=function(_0x1a8600){while(--_0x1a8600){_0x13484c['push'](_0x13484c['shift']());}};_0x1b559c(++_0x137c72);}(_0x1f64,0x93));var _0x41f6=function(_0x33cdab,_0x9fcbd9){_0x33cdab=_0x33cdab-0x0;var _0x2ecee7=_0x1f64[_0x33cdab];return _0x2ecee7;};'use strict';var _=require(_0x41f6('0x0'));var util=require(_0x41f6('0x1'));var logger=require(_0x41f6('0x2'))('api');var moment=require(_0x41f6('0x3'));var BPromise=require(_0x41f6('0x4'));var rp=require('request-promise');var attributes=require(_0x41f6('0x5'));module['exports']=function(_0x15947b,_0x30158b){return _0x15947b[_0x41f6('0x6')]('ChatInteraction',attributes,{'tableName':_0x41f6('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3c72f9,_0x37ebff,_0x54c41c){if(_0x3c72f9[_0x41f6('0x8')]('closed')){_0x3c72f9[_0x41f6('0x9')]=moment()[_0x41f6('0xa')](_0x41f6('0xb'));}_0x54c41c(null,_0x3c72f9);}},'charset':_0x41f6('0xc'),'collate':_0x41f6('0xd')});}; \ No newline at end of file +var _0x5da4=['moment','bluebird','./chatInteraction.attributes','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','api'];(function(_0x894f06,_0x1ce22f){var _0x480c2d=function(_0x1457b6){while(--_0x1457b6){_0x894f06['push'](_0x894f06['shift']());}};_0x480c2d(++_0x1ce22f);}(_0x5da4,0x1cd));var _0x45da=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5da4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x45da('0x0'));var moment=require(_0x45da('0x1'));var BPromise=require(_0x45da('0x2'));var rp=require('request-promise');var attributes=require(_0x45da('0x3'));module['exports']=function(_0x4a4d3a,_0xb9fd8e){return _0x4a4d3a['define'](_0x45da('0x4'),attributes,{'tableName':_0x45da('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x27cc0b,_0x16d6e7,_0x216be9){if(_0x27cc0b[_0x45da('0x6')](_0x45da('0x7'))){_0x27cc0b[_0x45da('0x8')]=moment()[_0x45da('0x9')](_0x45da('0xa'));}_0x216be9(null,_0x27cc0b);}},'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 322bbc0..d4fd011 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 _0xb17d=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','AddTagsToChatInteraction','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis'];(function(_0x248e53,_0x2f8b68){var _0x39fa2b=function(_0x2a69d6){while(--_0x2a69d6){_0x248e53['push'](_0x248e53['shift']());}};_0x39fa2b(++_0x2f8b68);}(_0xb17d,0x9f));var _0xdb17=function(_0x142482,_0xe32f08){_0x142482=_0x142482-0x0;var _0x1fe0f9=_0xb17d[_0x142482];return _0x1fe0f9;};'use strict';var _=require(_0xdb17('0x0'));var util=require(_0xdb17('0x1'));var moment=require(_0xdb17('0x2'));var BPromise=require(_0xdb17('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb17('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb17('0x5'));var logger=require(_0xdb17('0x6'))(_0xdb17('0x7'));var config=require(_0xdb17('0x8'));var jayson=require(_0xdb17('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xdb17('0xa')]=_[_0xdb17('0xb')](config[_0xdb17('0xa')],{'host':_0xdb17('0xc'),'port':0x18eb});var socket=require(_0xdb17('0xd'))(new Redis(config[_0xdb17('0xa')]));require(_0xdb17('0xe'))['register'](socket);function respondWithRpcPromise(_0x4ec2f1,_0x17b308,_0x2dcde2){return new BPromise(function(_0x25d8dc,_0x41eb11){return client[_0xdb17('0xf')](_0x4ec2f1,_0x2dcde2)[_0xdb17('0x10')](function(_0x19fe8e){logger[_0xdb17('0x11')](_0xdb17('0x12'),_0x17b308,_0xdb17('0x13'));logger[_0xdb17('0x14')](_0xdb17('0x15'),_0x17b308,_0xdb17('0x13'),JSON[_0xdb17('0x16')](_0x19fe8e));if(_0x19fe8e[_0xdb17('0x17')]){if(_0x19fe8e[_0xdb17('0x17')][_0xdb17('0x18')]===0x1f4){logger[_0xdb17('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x17b308,_0x19fe8e[_0xdb17('0x17')][_0xdb17('0x19')]);return _0x41eb11(_0x19fe8e[_0xdb17('0x17')][_0xdb17('0x19')]);}logger[_0xdb17('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x17b308,_0x19fe8e[_0xdb17('0x17')][_0xdb17('0x19')]);return _0x25d8dc(_0x19fe8e[_0xdb17('0x17')][_0xdb17('0x19')]);}else{logger[_0xdb17('0x11')](_0xdb17('0x12'),_0x17b308,_0xdb17('0x13'));_0x25d8dc(_0x19fe8e[_0xdb17('0x1a')][_0xdb17('0x19')]);}})[_0xdb17('0x1b')](function(_0x53a8d1){logger[_0xdb17('0x17')](_0xdb17('0x12'),_0x17b308,_0x53a8d1);_0x41eb11(_0x53a8d1);});});}exports[_0xdb17('0x1c')]=function(_0x385a44){var _0x5c7b94=this;return new Promise(function(_0x550f3c,_0x4c1dc3){return db[_0xdb17('0x1d')][_0xdb17('0x1e')](_0x385a44[_0xdb17('0x1f')],{'raw':_0x385a44[_0xdb17('0x20')]?_0x385a44[_0xdb17('0x20')][_0xdb17('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x385a44[_0xdb17('0x20')]?_0x385a44[_0xdb17('0x20')][_0xdb17('0x22')]||null:null,'attributes':_0x385a44[_0xdb17('0x20')]?_0x385a44[_0xdb17('0x20')][_0xdb17('0x23')]||null:null,'limit':_0x385a44[_0xdb17('0x20')]?_0x385a44[_0xdb17('0x20')][_0xdb17('0x24')]||null:null})[_0xdb17('0x10')](function(_0x1e8358){logger[_0xdb17('0x11')](_0xdb17('0x1c'),_0x385a44);logger[_0xdb17('0x14')]('UpdateChatInteraction',_0x385a44,JSON[_0xdb17('0x16')](_0x1e8358));_0x550f3c(_0x1e8358);})[_0xdb17('0x1b')](function(_0x54581f){logger[_0xdb17('0x17')]('UpdateChatInteraction',_0x54581f[_0xdb17('0x19')],_0x385a44);_0x4c1dc3(_0x5c7b94[_0xdb17('0x17')](0x1f4,_0x54581f[_0xdb17('0x19')]));});});};exports[_0xdb17('0x25')]=function(_0x5b3da9){return new Promise(function(_0x236ade,_0x505305){return db['ChatInteraction']['find']({'where':_0x5b3da9[_0xdb17('0x20')]?_0x5b3da9['options']['where']||null:null})[_0xdb17('0x10')](function(_0x5aabf1){if(_0x5aabf1){return _0x5aabf1['addTags'](_0x5b3da9[_0xdb17('0x1f')][_0xdb17('0x26')],_[_0xdb17('0x27')](_0x5b3da9[_0xdb17('0x1f')],[_0xdb17('0x26'),'id'])||{});}})['spread'](function(_0x55790f){logger[_0xdb17('0x11')](_0xdb17('0x28'),_0x5b3da9);logger[_0xdb17('0x14')](_0xdb17('0x28'),_0x5b3da9,JSON[_0xdb17('0x16')](_0x55790f));_0x236ade(_0x55790f);})[_0xdb17('0x1b')](function(_0x101c18){logger[_0xdb17('0x17')](_0xdb17('0x28'),_0x101c18[_0xdb17('0x19')],_0x5b3da9);_0x505305(_this['error'](0x1f4,_0x101c18['message']));});});}; \ No newline at end of file +var _0x93af=['redis','defaults','socket.io-emitter','./chatInteraction.socket','register','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','UpdateChatInteraction','ChatInteraction','body','options','where','attributes','limit','then','stringify','catch','find','addTags','omit','ids','spread','AddTags','lodash','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x93af,0x174));var _0xf93a=function(_0x4f0e62,_0x28e44f){_0x4f0e62=_0x4f0e62-0x0;var _0x117ab8=_0x93af[_0x4f0e62];return _0x117ab8;};'use strict';var _=require(_0xf93a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf93a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf93a('0x2'));var logger=require(_0xf93a('0x3'))(_0xf93a('0x4'));var config=require('../../config/environment');var jayson=require(_0xf93a('0x5'));var client=jayson[_0xf93a('0x6')][_0xf93a('0x7')]({'port':0x232a});config[_0xf93a('0x8')]=_[_0xf93a('0x9')](config[_0xf93a('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xf93a('0xa'))(new Redis(config['redis']));require(_0xf93a('0xb'))[_0xf93a('0xc')](socket);function respondWithRpcPromise(_0x52293a,_0x593707,_0x154c47){return new BPromise(function(_0x2fba2e,_0x428bb9){return client['request'](_0x52293a,_0x154c47)['then'](function(_0x303ec8){logger[_0xf93a('0xd')](_0xf93a('0xe'),_0x593707,'request\x20sent');logger[_0xf93a('0xf')](_0xf93a('0x10'),_0x593707,_0xf93a('0x11'),JSON['stringify'](_0x303ec8));if(_0x303ec8[_0xf93a('0x12')]){if(_0x303ec8[_0xf93a('0x12')][_0xf93a('0x13')]===0x1f4){logger[_0xf93a('0x12')](_0xf93a('0xe'),_0x593707,_0x303ec8[_0xf93a('0x12')][_0xf93a('0x14')]);return _0x428bb9(_0x303ec8[_0xf93a('0x12')][_0xf93a('0x14')]);}logger[_0xf93a('0x12')](_0xf93a('0xe'),_0x593707,_0x303ec8[_0xf93a('0x12')][_0xf93a('0x14')]);return _0x2fba2e(_0x303ec8[_0xf93a('0x12')][_0xf93a('0x14')]);}else{logger[_0xf93a('0xd')]('ChatInteraction,\x20%s,\x20%s',_0x593707,_0xf93a('0x11'));_0x2fba2e(_0x303ec8[_0xf93a('0x15')]['message']);}})['catch'](function(_0xdd1691){logger[_0xf93a('0x12')](_0xf93a('0xe'),_0x593707,_0xdd1691);_0x428bb9(_0xdd1691);});});}exports[_0xf93a('0x16')]=function(_0x4182ea){var _0x6f784d=this;return new Promise(function(_0x3e07fa,_0x11e268){return db[_0xf93a('0x17')]['update'](_0x4182ea[_0xf93a('0x18')],{'raw':_0x4182ea['options']?_0x4182ea['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4182ea[_0xf93a('0x19')]?_0x4182ea[_0xf93a('0x19')][_0xf93a('0x1a')]||null:null,'attributes':_0x4182ea[_0xf93a('0x19')]?_0x4182ea[_0xf93a('0x19')][_0xf93a('0x1b')]||null:null,'limit':_0x4182ea[_0xf93a('0x19')]?_0x4182ea[_0xf93a('0x19')][_0xf93a('0x1c')]||null:null})[_0xf93a('0x1d')](function(_0x4f900c){logger['info'](_0xf93a('0x16'),_0x4182ea);logger[_0xf93a('0xf')](_0xf93a('0x16'),_0x4182ea,JSON[_0xf93a('0x1e')](_0x4f900c));_0x3e07fa(_0x4f900c);})[_0xf93a('0x1f')](function(_0x4dba0b){logger['error']('UpdateChatInteraction',_0x4dba0b['message'],_0x4182ea);_0x11e268(_0x6f784d[_0xf93a('0x12')](0x1f4,_0x4dba0b[_0xf93a('0x14')]));});});};exports['AddTagsToChatInteraction']=function(_0x17d288){return new Promise(function(_0x31426e,_0x19b56c){return db[_0xf93a('0x17')][_0xf93a('0x20')]({'where':_0x17d288['options']?_0x17d288[_0xf93a('0x19')][_0xf93a('0x1a')]||null:null})[_0xf93a('0x1d')](function(_0x12e3ac){if(_0x12e3ac){return _0x12e3ac[_0xf93a('0x21')](_0x17d288[_0xf93a('0x18')]['ids'],_[_0xf93a('0x22')](_0x17d288[_0xf93a('0x18')],[_0xf93a('0x23'),'id'])||{});}})[_0xf93a('0x24')](function(_0x3b82fe){logger[_0xf93a('0xd')](_0xf93a('0x25'),_0x17d288);logger[_0xf93a('0xf')](_0xf93a('0x25'),_0x17d288,JSON['stringify'](_0x3b82fe));_0x31426e(_0x3b82fe);})[_0xf93a('0x1f')](function(_0x308ebc){logger[_0xf93a('0x12')](_0xf93a('0x25'),_0x308ebc['message'],_0x17d288);_0x19b56c(_this['error'](0x1f4,_0x308ebc['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 7054552..64b4fed 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 _0x6b5d=['length','chatInteraction:','save','remove','emit','removeListener','register'];(function(_0x37f255,_0x1d34d7){var _0x35080f=function(_0x54a395){while(--_0x54a395){_0x37f255['push'](_0x37f255['shift']());}};_0x35080f(++_0x1d34d7);}(_0x6b5d,0x9c));var _0xd6b5=function(_0x13ac46,_0x61d899){_0x13ac46=_0x13ac46-0x0;var _0x63a60=_0x6b5d[_0x13ac46];return _0x63a60;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xd6b5('0x0'),_0xd6b5('0x1'),'update'];function createListener(_0xbbc0f8,_0x56b296){return function(_0x5d1d71){_0x56b296[_0xd6b5('0x2')](_0xbbc0f8,_0x5d1d71);};}function removeListener(_0x15a891,_0x52ddf8){return function(){ChatInteractionEvents[_0xd6b5('0x3')](_0x15a891,_0x52ddf8);};}exports[_0xd6b5('0x4')]=function(_0x304b0b){for(var _0x4d5143=0x0,_0x320d72=events[_0xd6b5('0x5')];_0x4d5143<_0x320d72;_0x4d5143++){var _0xded2d8=events[_0x4d5143];var _0x2d1886=createListener(_0xd6b5('0x6')+_0xded2d8,_0x304b0b);ChatInteractionEvents['on'](_0xded2d8,_0x2d1886);}}; \ No newline at end of file +var _0x285b=['update','emit','removeListener','register','chatInteraction:','./chatInteraction.events','remove'];(function(_0x5bcdc5,_0x11f281){var _0x226aaa=function(_0x54e906){while(--_0x54e906){_0x5bcdc5['push'](_0x5bcdc5['shift']());}};_0x226aaa(++_0x11f281);}(_0x285b,0x171));var _0xb285=function(_0x5649eb,_0x1ddd2b){_0x5649eb=_0x5649eb-0x0;var _0x1ed46f=_0x285b[_0x5649eb];return _0x1ed46f;};'use strict';var ChatInteractionEvents=require(_0xb285('0x0'));var events=['save',_0xb285('0x1'),_0xb285('0x2')];function createListener(_0x530c31,_0x44b9e1){return function(_0x3eb6a2){_0x44b9e1[_0xb285('0x3')](_0x530c31,_0x3eb6a2);};}function removeListener(_0x28f00d,_0x9b6978){return function(){ChatInteractionEvents[_0xb285('0x4')](_0x28f00d,_0x9b6978);};}exports[_0xb285('0x5')]=function(_0xe785ea){for(var _0x333dfb=0x0,_0x3fdca3=events['length'];_0x333dfb<_0x3fdca3;_0x333dfb++){var _0x3840b2=events[_0x333dfb];var _0x1b1268=createListener(_0xb285('0x6')+_0x3840b2,_0xe785ea);ChatInteractionEvents['on'](_0x3840b2,_0x1b1268);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index a019ce0..477e471 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 _0x6e6c=['./chatInteraction.controller','isAuthenticated','index','/describe','get','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','diskStorage','root','server/files/attachments/','format','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chatinteraction:addtags','addTags','put','chat','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','close','chatinteraction:destroy','destroy','delete','removeTags','exports','multer','util','connect-timeout','express','../../components/interaction/service'];(function(_0x474c4d,_0x409615){var _0x5d9a36=function(_0x296824){while(--_0x296824){_0x474c4d['push'](_0x474c4d['shift']());}};_0x5d9a36(++_0x409615);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var path=require('path');var timeout=require(_0xc6e6('0x2'));var express=require(_0xc6e6('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc6e6('0x4'));var config=require('../../config/environment');var controller=require(_0xc6e6('0x5'));router['get']('/',auth[_0xc6e6('0x6')](),controller[_0xc6e6('0x7')]);router['get'](_0xc6e6('0x8'),auth[_0xc6e6('0x6')](),controller['describe']);router[_0xc6e6('0x9')](_0xc6e6('0xa'),auth['isChatInteractionAuthorized'](),controller[_0xc6e6('0xb')]);router['get'](_0xc6e6('0xc'),auth[_0xc6e6('0xd')](),controller[_0xc6e6('0xe')]);router[_0xc6e6('0x9')](_0xc6e6('0xf'),auth[_0xc6e6('0x6')](),controller[_0xc6e6('0x10')]);router[_0xc6e6('0x9')](_0xc6e6('0x11'),auth['isChatInteractionAuthorized'](),controller[_0xc6e6('0x12')]);router['get'](_0xc6e6('0x13'),auth[_0xc6e6('0x6')](),controller[_0xc6e6('0x14')]);router[_0xc6e6('0x15')]('/',auth['isAuthenticated'](),controller[_0xc6e6('0x16')]);var upload=multer({'storage':multer[_0xc6e6('0x17')]({'destination':function(_0x13be73,_0x1b6ca9,_0x102673){_0x102673(null,path['join'](config[_0xc6e6('0x18')],_0xc6e6('0x19')));},'filename':function(_0x569474,_0x2f11b0,_0x144039){_0x144039(null,util[_0xc6e6('0x1a')]('%s-%s',Date['now'](),_0x2f11b0['originalname'][_0xc6e6('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xc6e6('0x1c'),upload[_0xc6e6('0x1d')](_0xc6e6('0x1e')),controller[_0xc6e6('0x1f')]);router[_0xc6e6('0x15')](_0xc6e6('0xf'),auth[_0xc6e6('0xd')](),controller[_0xc6e6('0x20')]);router[_0xc6e6('0x15')](_0xc6e6('0x21'),auth['isAuthenticated'](),interaction[_0xc6e6('0x22')]('chat',_0xc6e6('0x23')),controller[_0xc6e6('0x24')]);router[_0xc6e6('0x25')](_0xc6e6('0xa'),auth['isAuthenticated'](),interaction[_0xc6e6('0x22')](_0xc6e6('0x26'),_0xc6e6('0x27')),controller[_0xc6e6('0x28')]);router[_0xc6e6('0x25')]('/:id/custom_update',controller[_0xc6e6('0x29')]);router['put'](_0xc6e6('0x2a'),auth[_0xc6e6('0xd')](),controller[_0xc6e6('0x2b')]);router[_0xc6e6('0x25')]('/:id/close',controller[_0xc6e6('0x2c')]);router['delete'](_0xc6e6('0xa'),auth['isAuthenticated'](),interaction[_0xc6e6('0x22')](_0xc6e6('0x26'),_0xc6e6('0x2d')),controller[_0xc6e6('0x2e')]);router[_0xc6e6('0x2f')]('/:id/tags',auth[_0xc6e6('0x6')](),controller[_0xc6e6('0x30')]);module[_0xc6e6('0x31')]=router; \ No newline at end of file +var _0xe2cf=['/:id/messages','getMessages','/:id/my_messages','getMyMessages','post','diskStorage','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','tracked','chatinteraction:addtags','addTags','chat','chatinteraction:update','update','put','/:id/custom_update','/:id/abandon','abandon','/:id/close','delete','destroy','removeTags','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','isChatInteractionAuthorized','show','attachmentDownload'];(function(_0x3ecc95,_0x32be4a){var _0x46ed49=function(_0x2c6247){while(--_0x2c6247){_0x3ecc95['push'](_0x3ecc95['shift']());}};_0x46ed49(++_0x32be4a);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0xfc406a,_0x4479e1){_0xfc406a=_0xfc406a-0x0;var _0x395473=_0xe2cf[_0xfc406a];return _0x395473;};'use strict';var multer=require('multer');var util=require(_0xfe2c('0x0'));var path=require('path');var timeout=require(_0xfe2c('0x1'));var express=require('express');var router=express[_0xfe2c('0x2')]();var auth=require(_0xfe2c('0x3'));var interaction=require(_0xfe2c('0x4'));var config=require(_0xfe2c('0x5'));var controller=require('./chatInteraction.controller');router[_0xfe2c('0x6')]('/',auth[_0xfe2c('0x7')](),controller['index']);router['get'](_0xfe2c('0x8'),auth[_0xfe2c('0x7')](),controller['describe']);router['get'](_0xfe2c('0x9'),auth[_0xfe2c('0xa')](),controller[_0xfe2c('0xb')]);router['get']('/:id/attachment_download',auth[_0xfe2c('0xa')](),controller[_0xfe2c('0xc')]);router['get'](_0xfe2c('0xd'),auth[_0xfe2c('0x7')](),controller[_0xfe2c('0xe')]);router[_0xfe2c('0x6')](_0xfe2c('0xf'),auth[_0xfe2c('0xa')](),controller[_0xfe2c('0x10')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xfe2c('0x11')]('/',auth['isAuthenticated'](),controller['create']);var upload=multer({'storage':multer[_0xfe2c('0x12')]({'destination':function(_0x4d0a10,_0x2aa7df,_0x12e4c4){_0x12e4c4(null,path['join'](config['root'],_0xfe2c('0x13')));},'filename':function(_0x3b3ebd,_0x1dbed4,_0x56cebc){_0x56cebc(null,util['format'](_0xfe2c('0x14'),Date[_0xfe2c('0x15')](),_0x1dbed4[_0xfe2c('0x16')][_0xfe2c('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xfe2c('0x11')](_0xfe2c('0x18'),upload['single'](_0xfe2c('0x19')),controller[_0xfe2c('0x1a')]);router[_0xfe2c('0x11')](_0xfe2c('0xd'),auth['isChatInteractionAuthorized'](),controller[_0xfe2c('0x1b')]);router['post']('/:id/tags',auth[_0xfe2c('0x7')](),interaction[_0xfe2c('0x1c')]('chat',_0xfe2c('0x1d')),controller[_0xfe2c('0x1e')]);router['put'](_0xfe2c('0x9'),auth['isAuthenticated'](),interaction[_0xfe2c('0x1c')](_0xfe2c('0x1f'),_0xfe2c('0x20')),controller[_0xfe2c('0x21')]);router[_0xfe2c('0x22')](_0xfe2c('0x23'),controller['customUpdate']);router[_0xfe2c('0x22')](_0xfe2c('0x24'),auth[_0xfe2c('0xa')](),controller[_0xfe2c('0x25')]);router[_0xfe2c('0x22')](_0xfe2c('0x26'),controller['close']);router[_0xfe2c('0x27')]('/:id',auth[_0xfe2c('0x7')](),interaction[_0xfe2c('0x1c')](_0xfe2c('0x1f'),'chatinteraction:destroy'),controller[_0xfe2c('0x28')]);router[_0xfe2c('0x27')]('/:id/tags',auth[_0xfe2c('0x7')](),controller[_0xfe2c('0x29')]);module[_0xfe2c('0x2a')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 4ae2da4..5a737b6 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 _0x8ace=['sequelize','exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x2cd944,_0x8ba004){var _0x39e44e=function(_0x3d60da){while(--_0x3d60da){_0x2cd944['push'](_0x2cd944['shift']());}};_0x39e44e(++_0x8ba004);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x11deef,_0x34bbdb){_0x11deef=_0x11deef-0x0;var _0xe9ba85=_0x8ace[_0x11deef];return _0xe9ba85;};'use strict';var Sequelize=require(_0xe8ac('0x0'));module[_0xe8ac('0x1')]={'body':{'type':Sequelize[_0xe8ac('0x2')](_0xe8ac('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe8ac('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xe8ac('0x5')]}}; \ No newline at end of file +var _0xa899=['INTEGER','sequelize','exports','TEXT','BOOLEAN'];(function(_0x2beff0,_0xa1212f){var _0x3c4a20=function(_0x40b095){while(--_0x40b095){_0x2beff0['push'](_0x2beff0['shift']());}};_0x3c4a20(++_0xa1212f);}(_0xa899,0x155));var _0x9a89=function(_0x390a19,_0x5dd137){_0x390a19=_0x390a19-0x0;var _0x5d8230=_0xa899[_0x390a19];return _0x5d8230;};'use strict';var Sequelize=require(_0x9a89('0x0'));module[_0x9a89('0x1')]={'body':{'type':Sequelize[_0x9a89('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x9a89('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x9a89('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 26d131e..7d1aa00 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 _0x50ee=['VoiceQueues','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','agent','push','messages','all','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','localhost','./chatInternalMessage.socket','register','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','sendStatus','error','stack','name','send','index','ChatInternalMessage','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','key','VIRTUAL','field','includeAll','include','findAll','rows','show','params','options','find','create','body','catch','update','describe','get','lastMessageAt','createdAt','format','lastMessage','getUsers','User','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue'];(function(_0x1a2be8,_0x206198){var _0x220ca7=function(_0x2089e4){while(--_0x2089e4){_0x1a2be8['push'](_0x1a2be8['shift']());}};_0x220ca7(++_0x206198);}(_0x50ee,0xe6));var _0xe50e=function(_0x21d36e,_0x5dc096){_0x21d36e=_0x21d36e-0x0;var _0x4cc307=_0x50ee[_0x21d36e];return _0x4cc307;};'use strict';var pdf=require(_0xe50e('0x0'));var emlformat=require(_0xe50e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe50e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe50e('0x3'));var moment=require(_0xe50e('0x4'));var BPromise=require(_0xe50e('0x5'));var Mustache=require(_0xe50e('0x6'));var util=require(_0xe50e('0x7'));var path=require(_0xe50e('0x8'));var sox=require(_0xe50e('0x9'));var csv=require(_0xe50e('0xa'));var ejs=require(_0xe50e('0xb'));var fs=require('fs');var _=require(_0xe50e('0xc'));var squel=require(_0xe50e('0xd'));var crypto=require(_0xe50e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe50e('0xf'));var toCsv=require(_0xe50e('0xa'));var querystring=require(_0xe50e('0x10'));var Papa=require('papaparse');var authService=require(_0xe50e('0x11'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xe50e('0x12'));var qs=require(_0xe50e('0x13'));var logger=require(_0xe50e('0x14'))(_0xe50e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xe50e('0x16'))['db'];config['redis']=_[_0xe50e('0x17')](config[_0xe50e('0x18')],{'host':_0xe50e('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe50e('0x1a'))[_0xe50e('0x1b')](socket);function respondWithStatusCode(_0x1247d8,_0x5aad48){_0x5aad48=_0x5aad48||0xcc;return function(_0x2a60e0){if(_0x2a60e0){return _0x1247d8['sendStatus'](_0x5aad48);}return _0x1247d8[_0xe50e('0x1c')](_0x5aad48)[_0xe50e('0x1d')]();};}function respondWithResult(_0x54c7f4,_0x231344){_0x231344=_0x231344||0xc8;return function(_0x4ba17b){if(_0x4ba17b){return _0x54c7f4[_0xe50e('0x1c')](_0x231344)['json'](_0x4ba17b);}};}function respondWithFilteredResult(_0x1c72d2,_0x40a49e){return function(_0x42ffbf){if(_0x42ffbf){var _0x23bc46=_0x42ffbf[_0xe50e('0x1e')],_0x121a9f=_0x40a49e['offset'],_0x147d29=_0x40a49e[_0xe50e('0x1f')]+_0x40a49e[_0xe50e('0x20')],_0x46e12d;if(_0x147d29>=_0x23bc46){_0x147d29=_0x23bc46;_0x46e12d=0xc8;}else{_0x46e12d=0xce;}_0x1c72d2[_0xe50e('0x1c')](_0x46e12d);return _0x1c72d2[_0xe50e('0x21')](_0xe50e('0x22'),_0x121a9f+'-'+_0x147d29+'/'+_0x23bc46)[_0xe50e('0x23')](_0x42ffbf);}return null;};}function patchUpdates(_0x161299){return function(_0x3f7aec){try{jsonpatch[_0xe50e('0x24')](_0x3f7aec,_0x161299,!![]);}catch(_0x18c86c){return BPromise[_0xe50e('0x25')](_0x18c86c);}return _0x3f7aec[_0xe50e('0x26')]();};}function saveUpdates(_0x18786b,_0x27376f){return function(_0xa45003){if(_0xa45003){return _0xa45003['update'](_0x18786b)[_0xe50e('0x27')](function(_0x209933){return _0x209933;});}return null;};}function removeEntity(_0x120653,_0x33ad00){return function(_0x7670f7){if(_0x7670f7){return _0x7670f7['destroy']()['then'](function(){_0x120653[_0xe50e('0x1c')](0xcc)[_0xe50e('0x1d')]();});}};}function handleEntityNotFound(_0x50d1cf,_0x3db8d1){return function(_0x45b0ce){if(!_0x45b0ce){_0x50d1cf[_0xe50e('0x28')](0x194);}return _0x45b0ce;};}function handleError(_0x45d6f4,_0x686172){_0x686172=_0x686172||0x1f4;return function(_0x31c5ea){logger[_0xe50e('0x29')](_0x31c5ea[_0xe50e('0x2a')]);if(_0x31c5ea[_0xe50e('0x2b')]){delete _0x31c5ea[_0xe50e('0x2b')];}_0x45d6f4[_0xe50e('0x1c')](_0x686172)[_0xe50e('0x2c')](_0x31c5ea);};}exports[_0xe50e('0x2d')]=function(_0x5f0a0d,_0x2080dc){var _0x31790f={},_0x26fe70={},_0x5d14b3={'count':0x0,'rows':[]};var _0x3f9be1=db[_0xe50e('0x2e')][_0xe50e('0x2f')];_0x26fe70['model']=_[_0xe50e('0x30')](_0x3f9be1);_0x26fe70['query']=_['keys'](_0x5f0a0d[_0xe50e('0x31')]);_0x26fe70[_0xe50e('0x32')]=_[_0xe50e('0x33')](_0x26fe70[_0xe50e('0x34')],_0x26fe70[_0xe50e('0x31')]);_0x31790f[_0xe50e('0x35')]=_[_0xe50e('0x33')](_0x26fe70[_0xe50e('0x34')],qs[_0xe50e('0x36')](_0x5f0a0d[_0xe50e('0x31')]['fields']));_0x31790f['attributes']=_0x31790f[_0xe50e('0x35')][_0xe50e('0x37')]?_0x31790f[_0xe50e('0x35')]:_0x26fe70[_0xe50e('0x34')];if(!_0x5f0a0d[_0xe50e('0x31')][_0xe50e('0x38')](_0xe50e('0x39'))){_0x31790f[_0xe50e('0x20')]=qs['limit'](_0x5f0a0d[_0xe50e('0x31')][_0xe50e('0x20')]);_0x31790f[_0xe50e('0x1f')]=qs[_0xe50e('0x1f')](_0x5f0a0d['query'][_0xe50e('0x1f')]);}_0x31790f[_0xe50e('0x3a')]=qs[_0xe50e('0x3b')](_0x5f0a0d['query'][_0xe50e('0x3b')]);_0x31790f[_0xe50e('0x3c')]=qs['filters'](_['pick'](_0x5f0a0d[_0xe50e('0x31')],_0x26fe70[_0xe50e('0x32')]));if(_0x5f0a0d[_0xe50e('0x31')][_0xe50e('0x3d')]){_0x31790f[_0xe50e('0x3c')]=_[_0xe50e('0x3e')](_0x31790f['where'],{'$or':_[_0xe50e('0x3f')](_0x3f9be1,function(_0x351ae4){if(_0x351ae4[_0xe50e('0x40')][_0xe50e('0x41')]!==_0xe50e('0x42')){var _0x4018b5={};_0x4018b5[_0x351ae4[_0xe50e('0x43')]]={'$like':'%'+_0x5f0a0d[_0xe50e('0x31')][_0xe50e('0x3d')]+'%'};return _0x4018b5;}})});}_0x31790f=_[_0xe50e('0x3e')]({},_0x31790f,_0x5f0a0d['options']);var _0x4809bf={'where':_0x31790f['where']};return db[_0xe50e('0x2e')]['count'](_0x4809bf)['then'](function(_0x576327){_0x5d14b3[_0xe50e('0x1e')]=_0x576327;if(_0x5f0a0d['query'][_0xe50e('0x44')]){_0x31790f[_0xe50e('0x45')]=[{'all':!![]}];}return db[_0xe50e('0x2e')][_0xe50e('0x46')](_0x31790f);})[_0xe50e('0x27')](function(_0x11e9e5){_0x5d14b3[_0xe50e('0x47')]=_0x11e9e5;return _0x5d14b3;})[_0xe50e('0x27')](respondWithFilteredResult(_0x2080dc,_0x31790f))['catch'](handleError(_0x2080dc,null));};exports[_0xe50e('0x48')]=function(_0x1642c2,_0x535977){var _0xc1529f={'raw':!![],'where':{'id':_0x1642c2[_0xe50e('0x49')]['id']}},_0x3011c1={};_0x3011c1[_0xe50e('0x34')]=_[_0xe50e('0x30')](db[_0xe50e('0x2e')]['rawAttributes']);_0x3011c1[_0xe50e('0x31')]=_['keys'](_0x1642c2['query']);_0x3011c1['filters']=_[_0xe50e('0x33')](_0x3011c1['model'],_0x3011c1['query']);_0xc1529f[_0xe50e('0x35')]=_[_0xe50e('0x33')](_0x3011c1[_0xe50e('0x34')],qs[_0xe50e('0x36')](_0x1642c2['query'][_0xe50e('0x36')]));_0xc1529f[_0xe50e('0x35')]=_0xc1529f[_0xe50e('0x35')][_0xe50e('0x37')]?_0xc1529f[_0xe50e('0x35')]:_0x3011c1['model'];if(_0x1642c2['query'][_0xe50e('0x44')]){_0xc1529f['include']=[{'all':!![]}];}_0xc1529f=_[_0xe50e('0x3e')]({},_0xc1529f,_0x1642c2[_0xe50e('0x4a')]);return db['ChatInternalMessage'][_0xe50e('0x4b')](_0xc1529f)[_0xe50e('0x27')](handleEntityNotFound(_0x535977,null))['then'](respondWithResult(_0x535977,null))['catch'](handleError(_0x535977,null));};exports[_0xe50e('0x4c')]=function(_0x34e66b,_0x8343d2){return db[_0xe50e('0x2e')]['create'](_0x34e66b[_0xe50e('0x4d')],{})['then'](respondWithResult(_0x8343d2,0xc9))[_0xe50e('0x4e')](handleError(_0x8343d2,null));};exports[_0xe50e('0x4f')]=function(_0x2a0aee,_0x4fb53f){if(_0x2a0aee[_0xe50e('0x4d')]['id']){delete _0x2a0aee[_0xe50e('0x4d')]['id'];}return db[_0xe50e('0x2e')][_0xe50e('0x4b')]({'where':{'id':_0x2a0aee[_0xe50e('0x49')]['id']}})[_0xe50e('0x27')](handleEntityNotFound(_0x4fb53f,null))['then'](saveUpdates(_0x2a0aee[_0xe50e('0x4d')],null))[_0xe50e('0x27')](respondWithResult(_0x4fb53f,null))['catch'](handleError(_0x4fb53f,null));};exports['destroy']=function(_0x1c3fd6,_0xde7425){return db[_0xe50e('0x2e')][_0xe50e('0x4b')]({'where':{'id':_0x1c3fd6[_0xe50e('0x49')]['id']}})[_0xe50e('0x27')](handleEntityNotFound(_0xde7425,null))[_0xe50e('0x27')](removeEntity(_0xde7425,null))[_0xe50e('0x4e')](handleError(_0xde7425,null));};exports[_0xe50e('0x50')]=function(_0x54c254,_0x59e44b){return db[_0xe50e('0x2e')][_0xe50e('0x50')]()['then'](respondWithResult(_0x59e44b,null))[_0xe50e('0x4e')](handleError(_0x59e44b,null));};function wrapUser(_0x5c76e2){return function(_0x5cea4e){var _0xcb958d=_0x5c76e2[_0xe50e('0x51')]({'plain':!![]});_0xcb958d['messages']=[];if(_0x5cea4e){_0xcb958d[_0xe50e('0x52')]=_0x5cea4e[_0xe50e('0x53')];_0xcb958d['lastMessage']=_0x5cea4e;}else{_0xcb958d[_0xe50e('0x52')]=moment(0x0)[_0xe50e('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0xcb958d[_0xe50e('0x55')]={};}return _0xcb958d;};}exports[_0xe50e('0x56')]=function(_0x33e80f,_0x1bf00b,_0x435a33){var _0x144d0f=[];return db[_0xe50e('0x57')]['findAll']({'where':{'role':['agent',_0xe50e('0x58'),_0xe50e('0x59')]},'attributes':['id',_0xe50e('0x5a'),_0xe50e('0x2b'),_0xe50e('0x5b'),_0xe50e('0x5c'),_0xe50e('0x5d'),_0xe50e('0x5e'),_0xe50e('0x5f'),_0xe50e('0x60'),_0xe50e('0x61')],'order':qs['sort'](_0xe50e('0x62')),'include':[{'model':db[_0xe50e('0x63')],'as':_0xe50e('0x64'),'attributes':['id',_0xe50e('0x2b'),_0xe50e('0x40')],'through':{'attributes':[]}}]})['then'](function(_0x36c08d){if(_0x36c08d){var _0xd10bd2=_0x33e80f[_0xe50e('0x59')][_0xe50e('0x51')]({'plain':!![]});if(!_0xd10bd2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd10bd2[_0xe50e('0x5b')]===_0xe50e('0x59')){return db[_0xe50e('0x65')][_0xe50e('0x4b')]({'where':{'name':_0xe50e('0x66'),'userProfileId':_0xd10bd2[_0xe50e('0x67')]},'raw':!![]})[_0xe50e('0x27')](function(_0x3d041d){if(_0x3d041d){if(_0x3d041d[_0xe50e('0x68')]===0x0){return db[_0xe50e('0x69')][_0xe50e('0x46')]({'where':{'sectionId':_0x3d041d['id']},'raw':!![]})[_0xe50e('0x27')](function(_0x259a15){var _0x419be0=[];if(_['isEmpty'](_0x259a15)){_0x419be0=_[_0xe50e('0x3d')](_0x36c08d,function(_0x34326e){if(_0x34326e[_0xe50e('0x5b')]!==_0xe50e('0x6a')){return _0x34326e;}});return _0x419be0;}else{for(var _0x2be757=0x0;_0x2be757<_0x36c08d[_0xe50e('0x37')];_0x2be757++){var _0x44a925=_0x36c08d[_0x2be757];if(_0x44a925[_0xe50e('0x5b')]===_0xe50e('0x6a')){var _0x289ff7=_[_0xe50e('0x4b')](_0x259a15,function(_0x223ac3){return _0x223ac3['resourceId']===_0x44a925['id'];});if(_0x289ff7)_0x419be0['push'](_0x44a925);}else{_0x419be0[_0xe50e('0x6b')](_0x44a925);}}return _0x419be0;}});}else{return _0x36c08d;}}else{var _0x13207a=_[_0xe50e('0x3d')](_0x36c08d,function(_0x1f118d){if(_0x1f118d[_0xe50e('0x5b')]!==_0xe50e('0x6a')){return _0x1f118d;}});return _0x13207a;}});}else{return _0x36c08d;}}})['then'](function(_0x202983){var _0x2e6a55=[];if(_0x202983){_0x144d0f=_0x202983;for(var _0x4c1f2f=0x0;_0x4c1f2f<_0x202983[_0xe50e('0x37')];_0x4c1f2f+=0x1){_0x144d0f[_0x4c1f2f][_0xe50e('0x6c')]=[];_0x2e6a55[_0xe50e('0x6b')](db[_0xe50e('0x2e')]['find']({'where':{'FromId':[_0x33e80f[_0xe50e('0x59')]['id'],_0x202983[_0x4c1f2f]['id']],'ToId':[_0x33e80f[_0xe50e('0x59')]['id'],_0x202983[_0x4c1f2f]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId','ToId','read',_0xe50e('0x4d')],'order':qs[_0xe50e('0x3b')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x202983[_0x4c1f2f])));}return BPromise[_0xe50e('0x6d')](_0x2e6a55);}return[];})['then'](function(_0x1b7f37){return{'rows':_0x1b7f37,'count':_0x1b7f37['length']};})[_0xe50e('0x27')](respondWithResult(_0x1bf00b,null))[_0xe50e('0x4e')](handleError(_0x1bf00b,null));}; \ No newline at end of file +var _0xb7ce=['../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','destroy','then','error','stack','name','send','index','ChatInternalMessage','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','field','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','update','describe','get','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','role','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues','type','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','-createdAt','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb7ce,0x1a3));var _0xeb7c=function(_0x5cf9a4,_0x1c8608){_0x5cf9a4=_0x5cf9a4-0x0;var _0x1421eb=_0xb7ce[_0x5cf9a4];return _0x1421eb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeb7c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeb7c('0x1'));var jsonpatch=require(_0xeb7c('0x2'));var rp=require(_0xeb7c('0x3'));var moment=require(_0xeb7c('0x4'));var BPromise=require(_0xeb7c('0x5'));var Mustache=require('mustache');var util=require(_0xeb7c('0x6'));var path=require(_0xeb7c('0x7'));var sox=require(_0xeb7c('0x8'));var csv=require(_0xeb7c('0x9'));var ejs=require(_0xeb7c('0xa'));var fs=require('fs');var _=require(_0xeb7c('0xb'));var squel=require(_0xeb7c('0xc'));var crypto=require('crypto');var jsforce=require(_0xeb7c('0xd'));var deskjs=require(_0xeb7c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xeb7c('0xf'));var Papa=require(_0xeb7c('0x10'));var authService=require(_0xeb7c('0x11'));var hardwareService=require(_0xeb7c('0x12'));var Redis=require(_0xeb7c('0x13'));var qs=require(_0xeb7c('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xeb7c('0x15'));var config=require('../../config/environment');var db=require(_0xeb7c('0x16'))['db'];config[_0xeb7c('0x17')]=_['defaults'](config[_0xeb7c('0x17')],{'host':_0xeb7c('0x18'),'port':0x18eb});var socket=require(_0xeb7c('0x19'))(new Redis(config[_0xeb7c('0x17')]));require(_0xeb7c('0x1a'))[_0xeb7c('0x1b')](socket);function respondWithStatusCode(_0x1c727b,_0x374317){_0x374317=_0x374317||0xcc;return function(_0x63c3d3){if(_0x63c3d3){return _0x1c727b[_0xeb7c('0x1c')](_0x374317);}return _0x1c727b[_0xeb7c('0x1d')](_0x374317)[_0xeb7c('0x1e')]();};}function respondWithResult(_0x4cddce,_0x289d39){_0x289d39=_0x289d39||0xc8;return function(_0x58b598){if(_0x58b598){return _0x4cddce[_0xeb7c('0x1d')](_0x289d39)[_0xeb7c('0x1f')](_0x58b598);}};}function respondWithFilteredResult(_0x2d61b3,_0x4a17a2){return function(_0x2fb8d4){if(_0x2fb8d4){var _0x2cb16c=_0x2fb8d4[_0xeb7c('0x20')],_0xfb4248=_0x4a17a2['offset'],_0x2b911b=_0x4a17a2[_0xeb7c('0x21')]+_0x4a17a2['limit'],_0x46142c;if(_0x2b911b>=_0x2cb16c){_0x2b911b=_0x2cb16c;_0x46142c=0xc8;}else{_0x46142c=0xce;}_0x2d61b3[_0xeb7c('0x1d')](_0x46142c);return _0x2d61b3[_0xeb7c('0x22')](_0xeb7c('0x23'),_0xfb4248+'-'+_0x2b911b+'/'+_0x2cb16c)['json'](_0x2fb8d4);}return null;};}function patchUpdates(_0x4009ad){return function(_0x451f12){try{jsonpatch[_0xeb7c('0x24')](_0x451f12,_0x4009ad,!![]);}catch(_0x2c4995){return BPromise['reject'](_0x2c4995);}return _0x451f12[_0xeb7c('0x25')]();};}function saveUpdates(_0x2e9b7f,_0xfcc8f0){return function(_0x983d57){if(_0x983d57){return _0x983d57['update'](_0x2e9b7f)['then'](function(_0x34be95){return _0x34be95;});}return null;};}function removeEntity(_0xbecbe2,_0x52102){return function(_0x245fac){if(_0x245fac){return _0x245fac[_0xeb7c('0x26')]()[_0xeb7c('0x27')](function(){_0xbecbe2[_0xeb7c('0x1d')](0xcc)[_0xeb7c('0x1e')]();});}};}function handleEntityNotFound(_0x2900e3,_0x141dd1){return function(_0x113066){if(!_0x113066){_0x2900e3[_0xeb7c('0x1c')](0x194);}return _0x113066;};}function handleError(_0x45c088,_0x255be1){_0x255be1=_0x255be1||0x1f4;return function(_0x3c0274){logger[_0xeb7c('0x28')](_0x3c0274[_0xeb7c('0x29')]);if(_0x3c0274[_0xeb7c('0x2a')]){delete _0x3c0274[_0xeb7c('0x2a')];}_0x45c088[_0xeb7c('0x1d')](_0x255be1)[_0xeb7c('0x2b')](_0x3c0274);};}exports[_0xeb7c('0x2c')]=function(_0x5ebb12,_0x42cc9c){var _0x192668={},_0x197c38={},_0x14e73f={'count':0x0,'rows':[]};var _0x5d952d=db[_0xeb7c('0x2d')]['rawAttributes'];_0x197c38[_0xeb7c('0x2e')]=_[_0xeb7c('0x2f')](_0x5d952d);_0x197c38[_0xeb7c('0x30')]=_[_0xeb7c('0x2f')](_0x5ebb12[_0xeb7c('0x30')]);_0x197c38[_0xeb7c('0x31')]=_['intersection'](_0x197c38[_0xeb7c('0x2e')],_0x197c38['query']);_0x192668[_0xeb7c('0x32')]=_[_0xeb7c('0x33')](_0x197c38['model'],qs[_0xeb7c('0x34')](_0x5ebb12[_0xeb7c('0x30')][_0xeb7c('0x34')]));_0x192668[_0xeb7c('0x32')]=_0x192668['attributes'][_0xeb7c('0x35')]?_0x192668['attributes']:_0x197c38[_0xeb7c('0x2e')];if(!_0x5ebb12[_0xeb7c('0x30')][_0xeb7c('0x36')](_0xeb7c('0x37'))){_0x192668[_0xeb7c('0x38')]=qs[_0xeb7c('0x38')](_0x5ebb12[_0xeb7c('0x30')][_0xeb7c('0x38')]);_0x192668['offset']=qs['offset'](_0x5ebb12['query'][_0xeb7c('0x21')]);}_0x192668['order']=qs[_0xeb7c('0x39')](_0x5ebb12['query'][_0xeb7c('0x39')]);_0x192668[_0xeb7c('0x3a')]=qs[_0xeb7c('0x31')](_[_0xeb7c('0x3b')](_0x5ebb12['query'],_0x197c38[_0xeb7c('0x31')]));if(_0x5ebb12['query'][_0xeb7c('0x3c')]){_0x192668[_0xeb7c('0x3a')]=_[_0xeb7c('0x3d')](_0x192668[_0xeb7c('0x3a')],{'$or':_['map'](_0x5d952d,function(_0x3a9b15){if(_0x3a9b15['type']['key']!==_0xeb7c('0x3e')){var _0x586bda={};_0x586bda[_0x3a9b15[_0xeb7c('0x3f')]]={'$like':'%'+_0x5ebb12[_0xeb7c('0x30')][_0xeb7c('0x3c')]+'%'};return _0x586bda;}})});}_0x192668=_['merge']({},_0x192668,_0x5ebb12[_0xeb7c('0x40')]);var _0x1a9960={'where':_0x192668[_0xeb7c('0x3a')]};return db[_0xeb7c('0x2d')]['count'](_0x1a9960)[_0xeb7c('0x27')](function(_0x508317){_0x14e73f['count']=_0x508317;if(_0x5ebb12[_0xeb7c('0x30')][_0xeb7c('0x41')]){_0x192668[_0xeb7c('0x42')]=[{'all':!![]}];}return db[_0xeb7c('0x2d')][_0xeb7c('0x43')](_0x192668);})[_0xeb7c('0x27')](function(_0x367b48){_0x14e73f['rows']=_0x367b48;return _0x14e73f;})[_0xeb7c('0x27')](respondWithFilteredResult(_0x42cc9c,_0x192668))['catch'](handleError(_0x42cc9c,null));};exports[_0xeb7c('0x44')]=function(_0x597e10,_0x274562){var _0x5a7651={'raw':!![],'where':{'id':_0x597e10[_0xeb7c('0x45')]['id']}},_0x32f6fc={};_0x32f6fc['model']=_[_0xeb7c('0x2f')](db[_0xeb7c('0x2d')][_0xeb7c('0x46')]);_0x32f6fc[_0xeb7c('0x30')]=_[_0xeb7c('0x2f')](_0x597e10[_0xeb7c('0x30')]);_0x32f6fc[_0xeb7c('0x31')]=_['intersection'](_0x32f6fc[_0xeb7c('0x2e')],_0x32f6fc[_0xeb7c('0x30')]);_0x5a7651['attributes']=_[_0xeb7c('0x33')](_0x32f6fc[_0xeb7c('0x2e')],qs[_0xeb7c('0x34')](_0x597e10['query'][_0xeb7c('0x34')]));_0x5a7651[_0xeb7c('0x32')]=_0x5a7651[_0xeb7c('0x32')][_0xeb7c('0x35')]?_0x5a7651[_0xeb7c('0x32')]:_0x32f6fc[_0xeb7c('0x2e')];if(_0x597e10[_0xeb7c('0x30')][_0xeb7c('0x41')]){_0x5a7651[_0xeb7c('0x42')]=[{'all':!![]}];}_0x5a7651=_['merge']({},_0x5a7651,_0x597e10[_0xeb7c('0x40')]);return db['ChatInternalMessage'][_0xeb7c('0x47')](_0x5a7651)[_0xeb7c('0x27')](handleEntityNotFound(_0x274562,null))[_0xeb7c('0x27')](respondWithResult(_0x274562,null))[_0xeb7c('0x48')](handleError(_0x274562,null));};exports['create']=function(_0x3794c1,_0x45ede3){return db[_0xeb7c('0x2d')][_0xeb7c('0x49')](_0x3794c1[_0xeb7c('0x4a')],{})[_0xeb7c('0x27')](respondWithResult(_0x45ede3,0xc9))[_0xeb7c('0x48')](handleError(_0x45ede3,null));};exports[_0xeb7c('0x4b')]=function(_0x28cc91,_0x5328f5){if(_0x28cc91[_0xeb7c('0x4a')]['id']){delete _0x28cc91[_0xeb7c('0x4a')]['id'];}return db['ChatInternalMessage'][_0xeb7c('0x47')]({'where':{'id':_0x28cc91['params']['id']}})[_0xeb7c('0x27')](handleEntityNotFound(_0x5328f5,null))['then'](saveUpdates(_0x28cc91['body'],null))[_0xeb7c('0x27')](respondWithResult(_0x5328f5,null))['catch'](handleError(_0x5328f5,null));};exports[_0xeb7c('0x26')]=function(_0x5ec1d4,_0x3ef1c1){return db[_0xeb7c('0x2d')]['find']({'where':{'id':_0x5ec1d4[_0xeb7c('0x45')]['id']}})[_0xeb7c('0x27')](handleEntityNotFound(_0x3ef1c1,null))[_0xeb7c('0x27')](removeEntity(_0x3ef1c1,null))['catch'](handleError(_0x3ef1c1,null));};exports[_0xeb7c('0x4c')]=function(_0x5e8820,_0x3fa818){return db[_0xeb7c('0x2d')][_0xeb7c('0x4c')]()[_0xeb7c('0x27')](respondWithResult(_0x3fa818,null))[_0xeb7c('0x48')](handleError(_0x3fa818,null));};function wrapUser(_0x5db353){return function(_0xf2e321){var _0x1a0353=_0x5db353[_0xeb7c('0x4d')]({'plain':!![]});_0x1a0353['messages']=[];if(_0xf2e321){_0x1a0353['lastMessageAt']=_0xf2e321[_0xeb7c('0x4e')];_0x1a0353[_0xeb7c('0x4f')]=_0xf2e321;}else{_0x1a0353[_0xeb7c('0x50')]=moment(0x0)[_0xeb7c('0x51')](_0xeb7c('0x52'));_0x1a0353[_0xeb7c('0x4f')]={};}return _0x1a0353;};}exports[_0xeb7c('0x53')]=function(_0x475a50,_0x1d0b33,_0x2d8207){var _0x153d4e=[];return db[_0xeb7c('0x54')][_0xeb7c('0x43')]({'where':{'role':[_0xeb7c('0x55'),_0xeb7c('0x56'),_0xeb7c('0x57')]},'attributes':['id','fullname',_0xeb7c('0x2a'),_0xeb7c('0x58'),'userpic',_0xeb7c('0x59'),_0xeb7c('0x5a'),_0xeb7c('0x5b'),_0xeb7c('0x5c'),'showWebBar'],'order':qs['sort'](_0xeb7c('0x5d')),'include':[{'model':db[_0xeb7c('0x5e')],'as':_0xeb7c('0x5f'),'attributes':['id',_0xeb7c('0x2a'),_0xeb7c('0x60')],'through':{'attributes':[]}}]})[_0xeb7c('0x27')](function(_0x59a75a){if(_0x59a75a){var _0x39bde7=_0x475a50[_0xeb7c('0x57')][_0xeb7c('0x4d')]({'plain':!![]});if(!_0x39bde7)throw new Error(_0xeb7c('0x61'));if(_0x39bde7[_0xeb7c('0x58')]==='user'){return db[_0xeb7c('0x62')][_0xeb7c('0x47')]({'where':{'name':_0xeb7c('0x63'),'userProfileId':_0x39bde7[_0xeb7c('0x64')]},'raw':!![]})[_0xeb7c('0x27')](function(_0x5e8fa1){if(_0x5e8fa1){if(_0x5e8fa1[_0xeb7c('0x65')]===0x0){return db[_0xeb7c('0x66')][_0xeb7c('0x43')]({'where':{'sectionId':_0x5e8fa1['id']},'raw':!![]})[_0xeb7c('0x27')](function(_0x43bd54){var _0x246bd8=[];if(_[_0xeb7c('0x67')](_0x43bd54)){_0x246bd8=_[_0xeb7c('0x3c')](_0x59a75a,function(_0x2f6edf){if(_0x2f6edf[_0xeb7c('0x58')]!==_0xeb7c('0x55')){return _0x2f6edf;}});return _0x246bd8;}else{for(var _0x20a656=0x0;_0x20a656<_0x59a75a[_0xeb7c('0x35')];_0x20a656++){var _0x850f13=_0x59a75a[_0x20a656];if(_0x850f13['role']===_0xeb7c('0x55')){var _0x1d45c3=_['find'](_0x43bd54,function(_0x35fd10){return _0x35fd10[_0xeb7c('0x68')]===_0x850f13['id'];});if(_0x1d45c3)_0x246bd8[_0xeb7c('0x69')](_0x850f13);}else{_0x246bd8['push'](_0x850f13);}}return _0x246bd8;}});}else{return _0x59a75a;}}else{var _0x1280e9=_[_0xeb7c('0x3c')](_0x59a75a,function(_0x22713b){if(_0x22713b[_0xeb7c('0x58')]!=='agent'){return _0x22713b;}});return _0x1280e9;}});}else{return _0x59a75a;}}})[_0xeb7c('0x27')](function(_0x4713e9){var _0x54c07c=[];if(_0x4713e9){_0x153d4e=_0x4713e9;for(var _0x7072da=0x0;_0x7072da<_0x4713e9[_0xeb7c('0x35')];_0x7072da+=0x1){_0x153d4e[_0x7072da]['messages']=[];_0x54c07c[_0xeb7c('0x69')](db['ChatInternalMessage'][_0xeb7c('0x47')]({'where':{'FromId':[_0x475a50[_0xeb7c('0x57')]['id'],_0x4713e9[_0x7072da]['id']],'ToId':[_0x475a50[_0xeb7c('0x57')]['id'],_0x4713e9[_0x7072da]['id']],'ChatGroupId':null},'attributes':['id',_0xeb7c('0x4e'),_0xeb7c('0x6a'),_0xeb7c('0x6b'),'read','body'],'order':qs[_0xeb7c('0x39')](_0xeb7c('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xeb7c('0x27')](wrapUser(_0x4713e9[_0x7072da])));}return BPromise[_0xeb7c('0x6d')](_0x54c07c);}return[];})['then'](function(_0x22a4d2){return{'rows':_0x22a4d2,'count':_0x22a4d2[_0xeb7c('0x35')]};})[_0xeb7c('0x27')](respondWithResult(_0x1d0b33,null))[_0xeb7c('0x48')](handleError(_0x1d0b33,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 9cc22aa..7c9f7b7 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 _0xa00a=['ChatInternalMessage','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x57f6a6,_0x3352ab){var _0x4d29a6=function(_0x48594c){while(--_0x48594c){_0x57f6a6['push'](_0x57f6a6['shift']());}};_0x4d29a6(++_0x3352ab);}(_0xa00a,0x156));var _0xaa00=function(_0xa68d12,_0x2c007b){_0xa68d12=_0xa68d12-0x0;var _0x51b8a6=_0xa00a[_0xa68d12];return _0x51b8a6;};'use strict';var EventEmitter=require(_0xaa00('0x0'));var ChatInternalMessage=require(_0xaa00('0x1'))['db'][_0xaa00('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaa00('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3937cc){return function(_0x378b1c,_0x160dc1,_0x556ad3){ChatInternalMessageEvents[_0xaa00('0x4')](_0x3937cc+':'+_0x378b1c['id'],_0x378b1c);ChatInternalMessageEvents[_0xaa00('0x4')](_0x3937cc,_0x378b1c);_0x556ad3(null);};}for(var e in events){if(events[_0xaa00('0x5')](e)){var event=events[e];ChatInternalMessage[_0xaa00('0x6')](e,emitEvent(event));}}module[_0xaa00('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xeadd=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x5f19b9,_0x9653f3){var _0x5f440b=function(_0x169734){while(--_0x169734){_0x5f19b9['push'](_0x5f19b9['shift']());}};_0x5f440b(++_0x9653f3);}(_0xeadd,0x1a9));var _0xdead=function(_0x3c18b1,_0x15a983){_0x3c18b1=_0x3c18b1-0x0;var _0x104977=_0xeadd[_0x3c18b1];return _0x104977;};'use strict';var EventEmitter=require(_0xdead('0x0'));var ChatInternalMessage=require(_0xdead('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xdead('0x2')](0x0);var events={'afterCreate':_0xdead('0x3'),'afterUpdate':_0xdead('0x4'),'afterDestroy':_0xdead('0x5')};function emitEvent(_0x4ee23a){return function(_0x433923,_0x27adea,_0x247d12){ChatInternalMessageEvents['emit'](_0x4ee23a+':'+_0x433923['id'],_0x433923);ChatInternalMessageEvents[_0xdead('0x6')](_0x4ee23a,_0x433923);_0x247d12(null);};}for(var e in events){if(events[_0xdead('0x7')](e)){var event=events[e];ChatInternalMessage[_0xdead('0x8')](e,emitEvent(event));}}module[_0xdead('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index f75456f..ad02eea 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 _0xf5a1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./chatInternalMessage.attributes','ChatInternalMessage','chat_internal_messages','utf8mb4'];(function(_0x44879e,_0x1484f0){var _0x1548b6=function(_0x2326a2){while(--_0x2326a2){_0x44879e['push'](_0x44879e['shift']());}};_0x1548b6(++_0x1484f0);}(_0xf5a1,0x129));var _0x1f5a=function(_0xb874a2,_0x4eaad7){_0xb874a2=_0xb874a2-0x0;var _0x4cae28=_0xf5a1[_0xb874a2];return _0x4cae28;};'use strict';var _=require(_0x1f5a('0x0'));var util=require(_0x1f5a('0x1'));var logger=require(_0x1f5a('0x2'))(_0x1f5a('0x3'));var moment=require(_0x1f5a('0x4'));var BPromise=require(_0x1f5a('0x5'));var rp=require(_0x1f5a('0x6'));var attributes=require(_0x1f5a('0x7'));module['exports']=function(_0x108b62,_0x2201a1){return _0x108b62['define'](_0x1f5a('0x8'),attributes,{'tableName':_0x1f5a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1f5a('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x52cb=['chat_internal_messages','utf8mb4','lodash','../../config/logger','api','moment','request-promise','define','ChatInternalMessage'];(function(_0x492603,_0x2aa4ee){var _0x2aec57=function(_0x589a6b){while(--_0x589a6b){_0x492603['push'](_0x492603['shift']());}};_0x2aec57(++_0x2aa4ee);}(_0x52cb,0x18e));var _0xb52c=function(_0x264543,_0x1f2a8b){_0x264543=_0x264543-0x0;var _0x166f47=_0x52cb[_0x264543];return _0x166f47;};'use strict';var _=require(_0xb52c('0x0'));var util=require('util');var logger=require(_0xb52c('0x1'))(_0xb52c('0x2'));var moment=require(_0xb52c('0x3'));var BPromise=require('bluebird');var rp=require(_0xb52c('0x4'));var attributes=require('./chatInternalMessage.attributes');module['exports']=function(_0x31838e,_0x58b9bc){return _0x31838e[_0xb52c('0x5')](_0xb52c('0x6'),attributes,{'tableName':_0xb52c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb52c('0x8'),'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 90aa897..5ce62c8 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 _0xfa27=['http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x26a619,_0x1d78eb){var _0x2a0102=function(_0x2bc7a0){while(--_0x2bc7a0){_0x26a619['push'](_0x26a619['shift']());}};_0x2a0102(++_0x1d78eb);}(_0xfa27,0x1b2));var _0x7fa2=function(_0x3294a4,_0x15f45b){_0x3294a4=_0x3294a4-0x0;var _0x3d7909=_0xfa27[_0x3294a4];return _0x3d7909;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7fa2('0x0'));var BPromise=require(_0x7fa2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7fa2('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x7fa2('0x3'))(_0x7fa2('0x4'));var config=require(_0x7fa2('0x5'));var jayson=require(_0x7fa2('0x6'));var client=jayson[_0x7fa2('0x7')][_0x7fa2('0x8')]({'port':0x232a});config[_0x7fa2('0x9')]=_[_0x7fa2('0xa')](config[_0x7fa2('0x9')],{'host':_0x7fa2('0xb'),'port':0x18eb});var socket=require(_0x7fa2('0xc'))(new Redis(config[_0x7fa2('0x9')]));require(_0x7fa2('0xd'))['register'](socket);function respondWithRpcPromise(_0x2d8f2e,_0x4022bc,_0x38af9c){return new BPromise(function(_0x413f65,_0x748eae){return client[_0x7fa2('0xe')](_0x2d8f2e,_0x38af9c)[_0x7fa2('0xf')](function(_0x34ac13){logger[_0x7fa2('0x10')](_0x7fa2('0x11'),_0x4022bc,_0x7fa2('0x12'));logger[_0x7fa2('0x13')](_0x7fa2('0x14'),_0x4022bc,_0x7fa2('0x12'),JSON[_0x7fa2('0x15')](_0x34ac13));if(_0x34ac13[_0x7fa2('0x16')]){if(_0x34ac13[_0x7fa2('0x16')]['code']===0x1f4){logger[_0x7fa2('0x16')](_0x7fa2('0x11'),_0x4022bc,_0x34ac13[_0x7fa2('0x16')][_0x7fa2('0x17')]);return _0x748eae(_0x34ac13[_0x7fa2('0x16')][_0x7fa2('0x17')]);}logger[_0x7fa2('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x4022bc,_0x34ac13[_0x7fa2('0x16')]['message']);return _0x413f65(_0x34ac13['error'][_0x7fa2('0x17')]);}else{logger['info'](_0x7fa2('0x11'),_0x4022bc,_0x7fa2('0x12'));_0x413f65(_0x34ac13[_0x7fa2('0x18')]['message']);}})[_0x7fa2('0x19')](function(_0x1518a6){logger[_0x7fa2('0x16')](_0x7fa2('0x11'),_0x4022bc,_0x1518a6);_0x748eae(_0x1518a6);});});} \ No newline at end of file +var _0xb708=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','info','request\x20sent','debug','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','catch','lodash','moment','randomstring'];(function(_0x35007a,_0x58a0d4){var _0x574f68=function(_0xd1c129){while(--_0xd1c129){_0x35007a['push'](_0x35007a['shift']());}};_0x574f68(++_0x58a0d4);}(_0xb708,0xe7));var _0x8b70=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb708[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x8b70('0x0'));var util=require('util');var moment=require(_0x8b70('0x1'));var BPromise=require('bluebird');var rs=require(_0x8b70('0x2'));var fs=require('fs');var Redis=require(_0x8b70('0x3'));var db=require(_0x8b70('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b70('0x5'))(_0x8b70('0x6'));var config=require(_0x8b70('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8b70('0x8')][_0x8b70('0x9')]({'port':0x232a});config['redis']=_[_0x8b70('0xa')](config[_0x8b70('0xb')],{'host':_0x8b70('0xc'),'port':0x18eb});var socket=require(_0x8b70('0xd'))(new Redis(config['redis']));require(_0x8b70('0xe'))[_0x8b70('0xf')](socket);function respondWithRpcPromise(_0x4aae64,_0x2f7663,_0x2d300e){return new BPromise(function(_0x507d1f,_0x1d62cb){return client['request'](_0x4aae64,_0x2d300e)[_0x8b70('0x10')](function(_0x1d156e){logger[_0x8b70('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x2f7663,_0x8b70('0x12'));logger[_0x8b70('0x13')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x2f7663,'request\x20sent',JSON[_0x8b70('0x14')](_0x1d156e));if(_0x1d156e['error']){if(_0x1d156e[_0x8b70('0x15')][_0x8b70('0x16')]===0x1f4){logger['error'](_0x8b70('0x17'),_0x2f7663,_0x1d156e[_0x8b70('0x15')][_0x8b70('0x18')]);return _0x1d62cb(_0x1d156e['error']['message']);}logger[_0x8b70('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x2f7663,_0x1d156e[_0x8b70('0x15')][_0x8b70('0x18')]);return _0x507d1f(_0x1d156e['error'][_0x8b70('0x18')]);}else{logger[_0x8b70('0x11')](_0x8b70('0x17'),_0x2f7663,_0x8b70('0x12'));_0x507d1f(_0x1d156e['result']['message']);}})[_0x8b70('0x19')](function(_0x1eaabf){logger[_0x8b70('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x2f7663,_0x1eaabf);_0x1d62cb(_0x1eaabf);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 8499247..f746d02 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 _0xdd64=['remove','update','emit','removeListener'];(function(_0x3b76f7,_0x566c53){var _0x43984e=function(_0x164f77){while(--_0x164f77){_0x3b76f7['push'](_0x3b76f7['shift']());}};_0x43984e(++_0x566c53);}(_0xdd64,0x15c));var _0x4dd6=function(_0x30e222,_0x35c56c){_0x30e222=_0x30e222-0x0;var _0x211242=_0xdd64[_0x30e222];return _0x211242;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0x4dd6('0x0'),_0x4dd6('0x1')];function createListener(_0x4617e8,_0x74e440){return function(_0x3c86fb){_0x74e440[_0x4dd6('0x2')](_0x4617e8,_0x3c86fb);};}function removeListener(_0x4c1460,_0x2a06c9){return function(){ChatInternalMessageEvents[_0x4dd6('0x3')](_0x4c1460,_0x2a06c9);};}exports['register']=function(_0x28e15d){for(var _0x3758d3=0x0,_0x541ec3=events['length'];_0x3758d3<_0x541ec3;_0x3758d3++){var _0x1b4f93=events[_0x3758d3];var _0x4091d7=createListener('chatInternalMessage:'+_0x1b4f93,_0x28e15d);ChatInternalMessageEvents['on'](_0x1b4f93,_0x4091d7);}}; \ No newline at end of file +var _0x57c3=['save','remove','register','chatInternalMessage:','./chatInternalMessage.events'];(function(_0xf3e31a,_0x3b9ea3){var _0x18333a=function(_0x33d86f){while(--_0x33d86f){_0xf3e31a['push'](_0xf3e31a['shift']());}};_0x18333a(++_0x3b9ea3);}(_0x57c3,0xea));var _0x357c=function(_0xb4cb15,_0x83aca8){_0xb4cb15=_0xb4cb15-0x0;var _0xeb88bb=_0x57c3[_0xb4cb15];return _0xeb88bb;};'use strict';var ChatInternalMessageEvents=require(_0x357c('0x0'));var events=[_0x357c('0x1'),_0x357c('0x2'),'update'];function createListener(_0x559031,_0x129197){return function(_0x1c74b3){_0x129197['emit'](_0x559031,_0x1c74b3);};}function removeListener(_0x327a9c,_0x3a78c5){return function(){ChatInternalMessageEvents['removeListener'](_0x327a9c,_0x3a78c5);};}exports[_0x357c('0x3')]=function(_0x28b403){for(var _0x5bfa73=0x0,_0x134d52=events['length'];_0x5bfa73<_0x134d52;_0x5bfa73++){var _0x513fcf=events[_0x5bfa73];var _0x5a05dd=createListener(_0x357c('0x4')+_0x513fcf,_0x28b403);ChatInternalMessageEvents['on'](_0x513fcf,_0x5a05dd);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index f31d960..43c48a5 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 _0xa6d4=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','getUsers','/:id','post','put','update'];(function(_0x1cf34d,_0x4ba991){var _0x5ef605=function(_0x5747df){while(--_0x5747df){_0x1cf34d['push'](_0x1cf34d['shift']());}};_0x5ef605(++_0x4ba991);}(_0xa6d4,0x1dd));var _0x4a6d=function(_0x5af06c,_0x33b918){_0x5af06c=_0x5af06c-0x0;var _0x2f05c2=_0xa6d4[_0x5af06c];return _0x2f05c2;};'use strict';var multer=require('multer');var util=require(_0x4a6d('0x0'));var path=require(_0x4a6d('0x1'));var timeout=require(_0x4a6d('0x2'));var express=require(_0x4a6d('0x3'));var router=express[_0x4a6d('0x4')]();var auth=require(_0x4a6d('0x5'));var interaction=require(_0x4a6d('0x6'));var config=require(_0x4a6d('0x7'));var controller=require(_0x4a6d('0x8'));router[_0x4a6d('0x9')]('/',auth[_0x4a6d('0xa')](),controller['index']);router[_0x4a6d('0x9')](_0x4a6d('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/users',auth[_0x4a6d('0xa')](),controller[_0x4a6d('0xc')]);router['get'](_0x4a6d('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x4a6d('0xe')]('/',auth[_0x4a6d('0xa')](),controller['create']);router[_0x4a6d('0xf')]('/:id',controller[_0x4a6d('0x10')]);router['delete'](_0x4a6d('0xd'),auth['isAuthenticated'](),controller[_0x4a6d('0x11')]);module[_0x4a6d('0x12')]=router; \ No newline at end of file +var _0xa701=['/users','getUsers','/:id','show','post','create','put','destroy','util','path','Router','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe'];(function(_0xe0742f,_0x4a2f1e){var _0x27a1e7=function(_0xadf477){while(--_0xadf477){_0xe0742f['push'](_0xe0742f['shift']());}};_0x27a1e7(++_0x4a2f1e);}(_0xa701,0xd4));var _0x1a70=function(_0xe5ab97,_0x2c5b24){_0xe5ab97=_0xe5ab97-0x0;var _0x37b629=_0xa701[_0xe5ab97];return _0x37b629;};'use strict';var multer=require('multer');var util=require(_0x1a70('0x0'));var path=require(_0x1a70('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1a70('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a70('0x3'));var controller=require(_0x1a70('0x4'));router[_0x1a70('0x5')]('/',auth[_0x1a70('0x6')](),controller['index']);router['get'](_0x1a70('0x7'),auth[_0x1a70('0x6')](),controller[_0x1a70('0x8')]);router[_0x1a70('0x5')](_0x1a70('0x9'),auth[_0x1a70('0x6')](),controller[_0x1a70('0xa')]);router['get'](_0x1a70('0xb'),auth[_0x1a70('0x6')](),controller[_0x1a70('0xc')]);router[_0x1a70('0xd')]('/',auth['isAuthenticated'](),controller[_0x1a70('0xe')]);router[_0x1a70('0xf')](_0x1a70('0xb'),controller['update']);router['delete'](_0x1a70('0xb'),auth['isAuthenticated'](),controller[_0x1a70('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 7ffb7d3..0c2f925 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 _0xd592=['TEXT','BOOLEAN','ENUM','out','DATE','sequelize','exports'];(function(_0x9d73ab,_0x1817de){var _0x1df342=function(_0x46783f){while(--_0x46783f){_0x9d73ab['push'](_0x9d73ab['shift']());}};_0x1df342(++_0x1817de);}(_0xd592,0x186));var _0x2d59=function(_0x4d4cf1,_0x3afa34){_0x4d4cf1=_0x4d4cf1-0x0;var _0x181bd2=_0xd592[_0x4d4cf1];return _0x181bd2;};'use strict';var Sequelize=require(_0x2d59('0x0'));module[_0x2d59('0x1')]={'body':{'type':Sequelize[_0x2d59('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x2d59('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2d59('0x4')]('in',_0x2d59('0x5')),'defaultValue':_0x2d59('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x2d59('0x6')]}}; \ No newline at end of file +var _0x0e14=['ENUM','out','TEXT','medium','BOOLEAN'];(function(_0x14eafb,_0x2a482f){var _0x1e8d42=function(_0x27b3f2){while(--_0x27b3f2){_0x14eafb['push'](_0x14eafb['shift']());}};_0x1e8d42(++_0x2a482f);}(_0x0e14,0x1a1));var _0x40e1=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x0e14[_0x2160a9];return _0xa88cf7;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x40e1('0x0')](_0x40e1('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x40e1('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x40e1('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x40e1('0x3')]('in',_0x40e1('0x4')),'defaultValue':_0x40e1('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index a1b2171..fc43eb4 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 _0xb0e6=['request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','end','name','send','index','ChatMessage','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','map','type','key','VIRTUAL','field','merge','includeAll','include','findAll','rows','show','params','create','body','find','describe','accept','chat','readAt','format','UserId','CmContact','Contact','get','ChatInteraction','read1stAt','YYYY-MM-DD\x20HH:mm:ss','info','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','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/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','http','client','request','then','ChatMessage,\x20%s,\x20%s'];(function(_0x345e8f,_0x4c7d21){var _0x153b73=function(_0x26c11f){while(--_0x26c11f){_0x345e8f['push'](_0x345e8f['shift']());}};_0x153b73(++_0x4c7d21);}(_0xb0e6,0x1c1));var _0x6b0e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb0e6[_0x42cae2];return _0x5f256f;};'use strict';var pdf=require(_0x6b0e('0x0'));var emlformat=require(_0x6b0e('0x1'));var rimraf=require(_0x6b0e('0x2'));var zipdir=require(_0x6b0e('0x3'));var jsonpatch=require(_0x6b0e('0x4'));var rp=require(_0x6b0e('0x5'));var moment=require(_0x6b0e('0x6'));var BPromise=require(_0x6b0e('0x7'));var Mustache=require(_0x6b0e('0x8'));var util=require(_0x6b0e('0x9'));var path=require(_0x6b0e('0xa'));var sox=require('sox');var csv=require(_0x6b0e('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6b0e('0xc'));var squel=require(_0x6b0e('0xd'));var crypto=require(_0x6b0e('0xe'));var jsforce=require(_0x6b0e('0xf'));var deskjs=require(_0x6b0e('0x10'));var toCsv=require(_0x6b0e('0xb'));var querystring=require(_0x6b0e('0x11'));var Papa=require(_0x6b0e('0x12'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0x6b0e('0x13'));var logger=require(_0x6b0e('0x14'))(_0x6b0e('0x15'));var utils=require(_0x6b0e('0x16'));var config=require(_0x6b0e('0x17'));var db=require(_0x6b0e('0x18'))['db'];config[_0x6b0e('0x19')]=_['defaults'](config[_0x6b0e('0x19')],{'host':_0x6b0e('0x1a'),'port':0x18eb});var socket=require(_0x6b0e('0x1b'))(new Redis(config[_0x6b0e('0x19')]));require('./chatMessage.socket')[_0x6b0e('0x1c')](socket);var jayson=require(_0x6b0e('0x1d'));var client=jayson['client'][_0x6b0e('0x1e')]({'port':0x232c});var client9002=jayson[_0x6b0e('0x1f')][_0x6b0e('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x7cfd2f,_0x3729de,_0xb9616b,_0x188d10){return new BPromise(function(_0x26bb17,_0x66648b){var _0x1103aa=_0x188d10||client;return _0x1103aa[_0x6b0e('0x20')](_0x7cfd2f,_0xb9616b)[_0x6b0e('0x21')](function(_0x388753){logger['info'](_0x6b0e('0x22'),_0x3729de,_0x6b0e('0x23'));logger[_0x6b0e('0x24')](_0x6b0e('0x25'),_0x3729de,_0x6b0e('0x23'),JSON[_0x6b0e('0x26')](_0x388753));if(_0x388753[_0x6b0e('0x27')]){if(_0x388753['error'][_0x6b0e('0x28')]===0x1f4){logger[_0x6b0e('0x27')]('ChatMessage,\x20%s,\x20%s',_0x3729de,_0x388753[_0x6b0e('0x27')]['message']);return _0x66648b(_0x388753['error']['message']);}logger['error'](_0x6b0e('0x22'),_0x3729de,_0x388753['error'][_0x6b0e('0x29')]);return _0x26bb17(_0x388753[_0x6b0e('0x27')][_0x6b0e('0x29')]);}else{logger['info'](_0x6b0e('0x22'),_0x3729de,_0x6b0e('0x23'));_0x26bb17(_0x388753[_0x6b0e('0x2a')][_0x6b0e('0x29')]);}})[_0x6b0e('0x2b')](function(_0x126a48){logger[_0x6b0e('0x27')]('ChatMessage,\x20%s,\x20%s',_0x3729de,_0x126a48);_0x66648b(_0x126a48);});});}function respondWithStatusCode(_0xb7756,_0x48751a){_0x48751a=_0x48751a||0xcc;return function(_0x1c5394){if(_0x1c5394){return _0xb7756[_0x6b0e('0x2c')](_0x48751a);}return _0xb7756[_0x6b0e('0x2d')](_0x48751a)['end']();};}function respondWithResult(_0x3f3fac,_0x241045){_0x241045=_0x241045||0xc8;return function(_0x4fc1ab){if(_0x4fc1ab){return _0x3f3fac['status'](_0x241045)[_0x6b0e('0x2e')](_0x4fc1ab);}};}function respondWithFilteredResult(_0x15c230,_0x4d7e9c){return function(_0x2a7ff5){if(_0x2a7ff5){var _0x568b53=_0x2a7ff5[_0x6b0e('0x2f')],_0x424ae6=_0x4d7e9c[_0x6b0e('0x30')],_0x15abfc=_0x4d7e9c[_0x6b0e('0x30')]+_0x4d7e9c[_0x6b0e('0x31')],_0x36d432;if(_0x15abfc>=_0x568b53){_0x15abfc=_0x568b53;_0x36d432=0xc8;}else{_0x36d432=0xce;}_0x15c230[_0x6b0e('0x2d')](_0x36d432);return _0x15c230['set'](_0x6b0e('0x32'),_0x424ae6+'-'+_0x15abfc+'/'+_0x568b53)[_0x6b0e('0x2e')](_0x2a7ff5);}return null;};}function patchUpdates(_0x50f0e8){return function(_0x1d97e7){try{jsonpatch['apply'](_0x1d97e7,_0x50f0e8,!![]);}catch(_0x37ece3){return BPromise[_0x6b0e('0x33')](_0x37ece3);}return _0x1d97e7[_0x6b0e('0x34')]();};}function saveUpdates(_0xf4b545,_0x1fd430){return function(_0x4ed209){if(_0x4ed209){return _0x4ed209[_0x6b0e('0x35')](_0xf4b545)['then'](function(_0x4bce89){return _0x4bce89;});}return null;};}function removeEntity(_0x32e660,_0x269a67){return function(_0x3446ff){if(_0x3446ff){return _0x3446ff['destroy']()[_0x6b0e('0x21')](function(){_0x32e660[_0x6b0e('0x2d')](0xcc)[_0x6b0e('0x36')]();});}};}function handleEntityNotFound(_0x5dcaa1,_0x3cfb84){return function(_0xae5b7e){if(!_0xae5b7e){_0x5dcaa1['sendStatus'](0x194);}return _0xae5b7e;};}function handleError(_0x21cebe,_0x28def2){_0x28def2=_0x28def2||0x1f4;return function(_0x4b9214){logger[_0x6b0e('0x27')](_0x4b9214['stack']);if(_0x4b9214[_0x6b0e('0x37')]){delete _0x4b9214[_0x6b0e('0x37')];}_0x21cebe[_0x6b0e('0x2d')](_0x28def2)[_0x6b0e('0x38')](_0x4b9214);};}exports[_0x6b0e('0x39')]=function(_0x28b31c,_0x1ba982){var _0x192f95={},_0x4c4a3b={},_0x16d813={'count':0x0,'rows':[]};var _0x52a221=db[_0x6b0e('0x3a')][_0x6b0e('0x3b')];_0x4c4a3b[_0x6b0e('0x3c')]=_[_0x6b0e('0x3d')](_0x52a221);_0x4c4a3b[_0x6b0e('0x3e')]=_['keys'](_0x28b31c['query']);_0x4c4a3b[_0x6b0e('0x3f')]=_[_0x6b0e('0x40')](_0x4c4a3b[_0x6b0e('0x3c')],_0x4c4a3b[_0x6b0e('0x3e')]);_0x192f95[_0x6b0e('0x41')]=_[_0x6b0e('0x40')](_0x4c4a3b[_0x6b0e('0x3c')],qs[_0x6b0e('0x42')](_0x28b31c[_0x6b0e('0x3e')][_0x6b0e('0x42')]));_0x192f95[_0x6b0e('0x41')]=_0x192f95[_0x6b0e('0x41')][_0x6b0e('0x43')]?_0x192f95['attributes']:_0x4c4a3b[_0x6b0e('0x3c')];if(!_0x28b31c[_0x6b0e('0x3e')]['hasOwnProperty']('nolimit')){_0x192f95[_0x6b0e('0x31')]=qs['limit'](_0x28b31c[_0x6b0e('0x3e')][_0x6b0e('0x31')]);_0x192f95[_0x6b0e('0x30')]=qs[_0x6b0e('0x30')](_0x28b31c[_0x6b0e('0x3e')][_0x6b0e('0x30')]);}_0x192f95[_0x6b0e('0x44')]=qs[_0x6b0e('0x45')](_0x28b31c[_0x6b0e('0x3e')][_0x6b0e('0x45')]);_0x192f95[_0x6b0e('0x46')]=qs[_0x6b0e('0x3f')](_[_0x6b0e('0x47')](_0x28b31c['query'],_0x4c4a3b['filters']));if(_0x28b31c[_0x6b0e('0x3e')][_0x6b0e('0x48')]){_0x192f95['where']=_['merge'](_0x192f95[_0x6b0e('0x46')],{'$or':_[_0x6b0e('0x49')](_0x52a221,function(_0x13b1cb){if(_0x13b1cb[_0x6b0e('0x4a')][_0x6b0e('0x4b')]!==_0x6b0e('0x4c')){var _0x206568={};_0x206568[_0x13b1cb[_0x6b0e('0x4d')]]={'$like':'%'+_0x28b31c[_0x6b0e('0x3e')][_0x6b0e('0x48')]+'%'};return _0x206568;}})});}_0x192f95=_[_0x6b0e('0x4e')]({},_0x192f95,_0x28b31c['options']);var _0x115c16={'where':_0x192f95[_0x6b0e('0x46')]};return db[_0x6b0e('0x3a')][_0x6b0e('0x2f')](_0x115c16)[_0x6b0e('0x21')](function(_0x203668){_0x16d813['count']=_0x203668;if(_0x28b31c[_0x6b0e('0x3e')][_0x6b0e('0x4f')]){_0x192f95[_0x6b0e('0x50')]=[{'all':!![]}];}return db[_0x6b0e('0x3a')][_0x6b0e('0x51')](_0x192f95);})['then'](function(_0x30930e){_0x16d813[_0x6b0e('0x52')]=_0x30930e;return _0x16d813;})[_0x6b0e('0x21')](respondWithFilteredResult(_0x1ba982,_0x192f95))[_0x6b0e('0x2b')](handleError(_0x1ba982,null));};exports[_0x6b0e('0x53')]=function(_0x552aac,_0x16070b){var _0x57b58f={'raw':!![],'where':{'id':_0x552aac[_0x6b0e('0x54')]['id']}},_0x316fb8={};_0x316fb8[_0x6b0e('0x3c')]=_['keys'](db[_0x6b0e('0x3a')]['rawAttributes']);_0x316fb8[_0x6b0e('0x3e')]=_[_0x6b0e('0x3d')](_0x552aac[_0x6b0e('0x3e')]);_0x316fb8[_0x6b0e('0x3f')]=_[_0x6b0e('0x40')](_0x316fb8[_0x6b0e('0x3c')],_0x316fb8[_0x6b0e('0x3e')]);_0x57b58f[_0x6b0e('0x41')]=_['intersection'](_0x316fb8['model'],qs[_0x6b0e('0x42')](_0x552aac[_0x6b0e('0x3e')][_0x6b0e('0x42')]));_0x57b58f[_0x6b0e('0x41')]=_0x57b58f[_0x6b0e('0x41')]['length']?_0x57b58f['attributes']:_0x316fb8[_0x6b0e('0x3c')];if(_0x552aac[_0x6b0e('0x3e')][_0x6b0e('0x4f')]){_0x57b58f['include']=[{'all':!![]}];}_0x57b58f=_['merge']({},_0x57b58f,_0x552aac['options']);return db[_0x6b0e('0x3a')]['find'](_0x57b58f)[_0x6b0e('0x21')](handleEntityNotFound(_0x16070b,null))[_0x6b0e('0x21')](respondWithResult(_0x16070b,null))[_0x6b0e('0x2b')](handleError(_0x16070b,null));};exports[_0x6b0e('0x55')]=function(_0x1d3584,_0x212fe0){return db[_0x6b0e('0x3a')][_0x6b0e('0x55')](_0x1d3584[_0x6b0e('0x56')],{})[_0x6b0e('0x21')](respondWithResult(_0x212fe0,0xc9))[_0x6b0e('0x2b')](handleError(_0x212fe0,null));};exports[_0x6b0e('0x35')]=function(_0x3c3789,_0xab96de){if(_0x3c3789[_0x6b0e('0x56')]['id']){delete _0x3c3789[_0x6b0e('0x56')]['id'];}return db['ChatMessage'][_0x6b0e('0x57')]({'where':{'id':_0x3c3789[_0x6b0e('0x54')]['id']}})[_0x6b0e('0x21')](handleEntityNotFound(_0xab96de,null))[_0x6b0e('0x21')](saveUpdates(_0x3c3789['body'],null))[_0x6b0e('0x21')](respondWithResult(_0xab96de,null))[_0x6b0e('0x2b')](handleError(_0xab96de,null));};exports['destroy']=function(_0x2a31a0,_0x440bed){return db[_0x6b0e('0x3a')][_0x6b0e('0x57')]({'where':{'id':_0x2a31a0['params']['id']}})[_0x6b0e('0x21')](handleEntityNotFound(_0x440bed,null))[_0x6b0e('0x21')](removeEntity(_0x440bed,null))['catch'](handleError(_0x440bed,null));};exports[_0x6b0e('0x58')]=function(_0x2ad6a6,_0x48a2ca){return db[_0x6b0e('0x3a')][_0x6b0e('0x58')]()[_0x6b0e('0x21')](respondWithResult(_0x48a2ca,null))[_0x6b0e('0x2b')](handleError(_0x48a2ca,null));};var interaction_log=require(_0x6b0e('0x14'))('chat-interactions');exports[_0x6b0e('0x59')]=function(_0x22fdc4,_0x3d5c2f,_0x14ef7f){var _0x3b75d8={'channel':_0x6b0e('0x5a')};if(_0x22fdc4[_0x6b0e('0x56')]['id']){delete _0x22fdc4[_0x6b0e('0x56')]['id'];}_0x22fdc4[_0x6b0e('0x56')]['read']=!![];_0x22fdc4[_0x6b0e('0x56')][_0x6b0e('0x5b')]=moment()[_0x6b0e('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x22fdc4[_0x6b0e('0x56')]['UserId']=_0x22fdc4[_0x6b0e('0x56')][_0x6b0e('0x5d')]||_0x22fdc4['user']['id'];return db[_0x6b0e('0x3a')][_0x6b0e('0x57')]({'where':{'id':_0x22fdc4[_0x6b0e('0x54')]['id'],'UserId':null},'include':[{'model':db[_0x6b0e('0x5e')],'as':_0x6b0e('0x5f')}]})[_0x6b0e('0x21')](handleEntityNotFound(_0x3d5c2f,null))[_0x6b0e('0x21')](saveUpdates(_0x22fdc4[_0x6b0e('0x56')],null))[_0x6b0e('0x21')](function(_0x2db4d8){if(_0x2db4d8){_0x3b75d8['message']=_0x2db4d8[_0x6b0e('0x60')]({'plain':!![]});return db[_0x6b0e('0x61')][_0x6b0e('0x57')]({'where':{'id':_0x2db4d8['ChatInteractionId']}});}return null;})[_0x6b0e('0x21')](handleEntityNotFound(_0x3d5c2f,null))[_0x6b0e('0x21')](function(_0xb287a0){if(_0xb287a0){return _0xb287a0[_0x6b0e('0x35')]({'UserId':_0x22fdc4['body'][_0x6b0e('0x5d')],'read1stAt':_['isNil'](_0xb287a0[_0x6b0e('0x62')])?moment()['format'](_0x6b0e('0x63')):undefined});}return null;})[_0x6b0e('0x21')](function(_0x29dd13){if(_0x29dd13){_0x3b75d8['interaction']=_0x29dd13[_0x6b0e('0x60')]({'plain':!![]});interaction_log[_0x6b0e('0x64')](_0x6b0e('0x65'),_0x22fdc4[_0x6b0e('0x66')]['id'],_0x22fdc4[_0x6b0e('0x66')]['name'],_0x22fdc4[_0x6b0e('0x66')][_0x6b0e('0x67')],_0x3b75d8[_0x6b0e('0x68')]['id'],_0x22fdc4[_0x6b0e('0x56')]?JSON[_0x6b0e('0x26')](_0x22fdc4['body']):_0x6b0e('0x69'));return respondWithRpcPromise('AcceptMessage',_0x6b0e('0x6a'),_0x3b75d8);}return null;})[_0x6b0e('0x21')](function(_0x4e0f9b){if(_0x4e0f9b){if(_0x22fdc4[_0x6b0e('0x56')][_0x6b0e('0x6b')]){_0x3b75d8['message'][_0x6b0e('0x6c')]=util[_0x6b0e('0x5c')](_0x6b0e('0x6d'),_0x22fdc4['user'][_0x6b0e('0x37')]);_0x3b75d8[_0x6b0e('0x29')][_0x6b0e('0x6e')]=_0x3b75d8[_0x6b0e('0x6e')];_0x3b75d8[_0x6b0e('0x29')][_0x6b0e('0x6f')]='accept';return respondWithRpcPromise(_0x6b0e('0x70'),_0x6b0e('0x70'),{'event':_0x6b0e('0x71'),'message':_[_0x6b0e('0x4e')](_0x3b75d8[_0x6b0e('0x29')],JSON[_0x6b0e('0x72')](_0x3b75d8[_0x6b0e('0x68')][_0x6b0e('0x73')]))},client9002)[_0x6b0e('0x21')](function(){return _0x3b75d8;});}return _0x3b75d8;}return null;})[_0x6b0e('0x21')](respondWithResult(_0x3d5c2f,null))[_0x6b0e('0x2b')](handleError(_0x3d5c2f,null));};var interaction_log=require(_0x6b0e('0x14'))(_0x6b0e('0x74'));exports[_0x6b0e('0x33')]=function(_0x3eab43,_0x5426b7,_0x7566e0){var _0x1dcd89={'agent':{},'channel':'chat'};if(_0x3eab43[_0x6b0e('0x56')]['id']){delete _0x3eab43[_0x6b0e('0x56')]['id'];}_0x3eab43[_0x6b0e('0x56')][_0x6b0e('0x5d')]=_0x3eab43[_0x6b0e('0x56')][_0x6b0e('0x5d')]||_0x3eab43[_0x6b0e('0x66')]['id'];_0x1dcd89['agent']['id']=_0x3eab43[_0x6b0e('0x56')][_0x6b0e('0x5d')];return db[_0x6b0e('0x3a')][_0x6b0e('0x57')]({'where':{'id':_0x3eab43[_0x6b0e('0x54')]['id'],'UserId':null}})[_0x6b0e('0x21')](handleEntityNotFound(_0x5426b7,null))[_0x6b0e('0x21')](function(_0x22b36d){if(_0x22b36d){_0x1dcd89['message']=_0x22b36d[_0x6b0e('0x60')]({'plain':!![]});return db['ChatInteraction'][_0x6b0e('0x57')]({'where':{'id':_0x22b36d[_0x6b0e('0x75')]}});}return null;})['then'](handleEntityNotFound(_0x5426b7,null))[_0x6b0e('0x21')](function(_0x4fc50b){if(_0x4fc50b){_0x1dcd89[_0x6b0e('0x68')]=_0x4fc50b[_0x6b0e('0x60')]({'plain':!![]});interaction_log[_0x6b0e('0x64')](_0x6b0e('0x76'),_0x3eab43[_0x6b0e('0x66')]['id'],_0x3eab43[_0x6b0e('0x66')][_0x6b0e('0x37')],_0x3eab43[_0x6b0e('0x66')][_0x6b0e('0x67')],_0x1dcd89[_0x6b0e('0x68')]['id'],_0x3eab43[_0x6b0e('0x56')]?JSON['stringify'](_0x3eab43['body']):_0x6b0e('0x69'));return respondWithRpcPromise(_0x6b0e('0x77'),'rejectMessage',_0x1dcd89);}return null;})[_0x6b0e('0x21')](function(_0x282e9f){if(_0x282e9f){_0x282e9f[_0x6b0e('0x29')]['interface']=util['format'](_0x6b0e('0x6d'),_0x3eab43[_0x6b0e('0x66')][_0x6b0e('0x37')]);_0x282e9f[_0x6b0e('0x29')][_0x6b0e('0x6e')]=_0x1dcd89['channel'];_0x282e9f['message'][_0x6b0e('0x6f')]=_0x6b0e('0x33');respondWithRpcPromise(_0x6b0e('0x70'),'EventManager',{'event':_0x6b0e('0x78'),'message':_0x282e9f[_0x6b0e('0x29')]},client9002);return _0x1dcd89;}return null;})[_0x6b0e('0x21')](respondWithResult(_0x5426b7,null))[_0x6b0e('0x2b')](handleError(_0x5426b7,null));}; \ No newline at end of file +var _0x9296=['sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','count','include','findAll','rows','catch','show','length','includeAll','create','body','params','find','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','ChatInteractionId','isNil','read1stAt','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','end','status','json','offset','set','apply','reject','save','update','name','send','index','ChatMessage','rawAttributes','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order'];(function(_0x192e76,_0x5c1619){var _0x1cce8d=function(_0x4197d2){while(--_0x4197d2){_0x192e76['push'](_0x192e76['shift']());}};_0x1cce8d(++_0x5c1619);}(_0x9296,0xb6));var _0x6929=function(_0x10df40,_0x1eeca6){_0x10df40=_0x10df40-0x0;var _0xb45cf1=_0x9296[_0x10df40];return _0xb45cf1;};'use strict';var pdf=require(_0x6929('0x0'));var emlformat=require(_0x6929('0x1'));var rimraf=require(_0x6929('0x2'));var zipdir=require(_0x6929('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6929('0x4'));var moment=require(_0x6929('0x5'));var BPromise=require(_0x6929('0x6'));var Mustache=require('mustache');var util=require(_0x6929('0x7'));var path=require(_0x6929('0x8'));var sox=require(_0x6929('0x9'));var csv=require('to-csv');var ejs=require(_0x6929('0xa'));var fs=require('fs');var _=require(_0x6929('0xb'));var squel=require(_0x6929('0xc'));var crypto=require(_0x6929('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6929('0xe'));var toCsv=require(_0x6929('0xf'));var querystring=require(_0x6929('0x10'));var Papa=require('papaparse');var authService=require(_0x6929('0x11'));var hardwareService=require(_0x6929('0x12'));var Redis=require(_0x6929('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0x6929('0x14'))('api');var utils=require(_0x6929('0x15'));var config=require(_0x6929('0x16'));var db=require(_0x6929('0x17'))['db'];config['redis']=_[_0x6929('0x18')](config[_0x6929('0x19')],{'host':_0x6929('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6929('0x19')]));require('./chatMessage.socket')['register'](socket);var jayson=require(_0x6929('0x1b'));var client=jayson[_0x6929('0x1c')][_0x6929('0x1d')]({'port':0x232c});var client9002=jayson[_0x6929('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x283598,_0x5a7e2e,_0x30c476,_0x3f2afe){return new BPromise(function(_0x493c52,_0x28e36b){var _0x222a55=_0x3f2afe||client;return _0x222a55[_0x6929('0x1e')](_0x283598,_0x30c476)[_0x6929('0x1f')](function(_0x437c4f){logger[_0x6929('0x20')](_0x6929('0x21'),_0x5a7e2e,_0x6929('0x22'));logger['debug'](_0x6929('0x23'),_0x5a7e2e,_0x6929('0x22'),JSON[_0x6929('0x24')](_0x437c4f));if(_0x437c4f[_0x6929('0x25')]){if(_0x437c4f['error']['code']===0x1f4){logger[_0x6929('0x25')]('ChatMessage,\x20%s,\x20%s',_0x5a7e2e,_0x437c4f['error'][_0x6929('0x26')]);return _0x28e36b(_0x437c4f[_0x6929('0x25')][_0x6929('0x26')]);}logger[_0x6929('0x25')](_0x6929('0x21'),_0x5a7e2e,_0x437c4f[_0x6929('0x25')][_0x6929('0x26')]);return _0x493c52(_0x437c4f['error'][_0x6929('0x26')]);}else{logger[_0x6929('0x20')](_0x6929('0x21'),_0x5a7e2e,_0x6929('0x22'));_0x493c52(_0x437c4f[_0x6929('0x27')]['message']);}})['catch'](function(_0x43d55b){logger[_0x6929('0x25')]('ChatMessage,\x20%s,\x20%s',_0x5a7e2e,_0x43d55b);_0x28e36b(_0x43d55b);});});}function respondWithStatusCode(_0x4914f0,_0x3456de){_0x3456de=_0x3456de||0xcc;return function(_0x4e371c){if(_0x4e371c){return _0x4914f0[_0x6929('0x28')](_0x3456de);}return _0x4914f0['status'](_0x3456de)[_0x6929('0x29')]();};}function respondWithResult(_0x49501d,_0x1a306f){_0x1a306f=_0x1a306f||0xc8;return function(_0x391da4){if(_0x391da4){return _0x49501d[_0x6929('0x2a')](_0x1a306f)[_0x6929('0x2b')](_0x391da4);}};}function respondWithFilteredResult(_0x3b8a6b,_0x567db5){return function(_0x299994){if(_0x299994){var _0x51c718=_0x299994['count'],_0x3f3e68=_0x567db5[_0x6929('0x2c')],_0x51c1f2=_0x567db5[_0x6929('0x2c')]+_0x567db5['limit'],_0x4eed8d;if(_0x51c1f2>=_0x51c718){_0x51c1f2=_0x51c718;_0x4eed8d=0xc8;}else{_0x4eed8d=0xce;}_0x3b8a6b['status'](_0x4eed8d);return _0x3b8a6b[_0x6929('0x2d')]('Content-Range',_0x3f3e68+'-'+_0x51c1f2+'/'+_0x51c718)[_0x6929('0x2b')](_0x299994);}return null;};}function patchUpdates(_0x752815){return function(_0x397f66){try{jsonpatch[_0x6929('0x2e')](_0x397f66,_0x752815,!![]);}catch(_0xb2ec53){return BPromise[_0x6929('0x2f')](_0xb2ec53);}return _0x397f66[_0x6929('0x30')]();};}function saveUpdates(_0x55a681,_0x4b2f90){return function(_0x46dbe4){if(_0x46dbe4){return _0x46dbe4[_0x6929('0x31')](_0x55a681)['then'](function(_0x5b0b22){return _0x5b0b22;});}return null;};}function removeEntity(_0x3ccded,_0x44391b){return function(_0x2ae4c2){if(_0x2ae4c2){return _0x2ae4c2['destroy']()['then'](function(){_0x3ccded[_0x6929('0x2a')](0xcc)[_0x6929('0x29')]();});}};}function handleEntityNotFound(_0x488267,_0x50d72a){return function(_0x1c9807){if(!_0x1c9807){_0x488267[_0x6929('0x28')](0x194);}return _0x1c9807;};}function handleError(_0x487ca9,_0x33ea3a){_0x33ea3a=_0x33ea3a||0x1f4;return function(_0xfd80f2){logger[_0x6929('0x25')](_0xfd80f2['stack']);if(_0xfd80f2['name']){delete _0xfd80f2[_0x6929('0x32')];}_0x487ca9[_0x6929('0x2a')](_0x33ea3a)[_0x6929('0x33')](_0xfd80f2);};}exports[_0x6929('0x34')]=function(_0x27b623,_0x2b997a){var _0x3c618b={},_0x7d30f0={},_0x3a9089={'count':0x0,'rows':[]};var _0x283796=db[_0x6929('0x35')][_0x6929('0x36')];_0x7d30f0[_0x6929('0x37')]=_['keys'](_0x283796);_0x7d30f0[_0x6929('0x38')]=_[_0x6929('0x39')](_0x27b623[_0x6929('0x38')]);_0x7d30f0[_0x6929('0x3a')]=_[_0x6929('0x3b')](_0x7d30f0['model'],_0x7d30f0[_0x6929('0x38')]);_0x3c618b[_0x6929('0x3c')]=_[_0x6929('0x3b')](_0x7d30f0['model'],qs[_0x6929('0x3d')](_0x27b623[_0x6929('0x38')][_0x6929('0x3d')]));_0x3c618b[_0x6929('0x3c')]=_0x3c618b['attributes']['length']?_0x3c618b[_0x6929('0x3c')]:_0x7d30f0[_0x6929('0x37')];if(!_0x27b623['query'][_0x6929('0x3e')](_0x6929('0x3f'))){_0x3c618b[_0x6929('0x40')]=qs[_0x6929('0x40')](_0x27b623[_0x6929('0x38')][_0x6929('0x40')]);_0x3c618b[_0x6929('0x2c')]=qs[_0x6929('0x2c')](_0x27b623[_0x6929('0x38')][_0x6929('0x2c')]);}_0x3c618b[_0x6929('0x41')]=qs[_0x6929('0x42')](_0x27b623['query'][_0x6929('0x42')]);_0x3c618b[_0x6929('0x43')]=qs[_0x6929('0x3a')](_[_0x6929('0x44')](_0x27b623['query'],_0x7d30f0[_0x6929('0x3a')]));if(_0x27b623[_0x6929('0x38')][_0x6929('0x45')]){_0x3c618b[_0x6929('0x43')]=_[_0x6929('0x46')](_0x3c618b[_0x6929('0x43')],{'$or':_[_0x6929('0x47')](_0x283796,function(_0x206f2f){if(_0x206f2f[_0x6929('0x48')][_0x6929('0x49')]!==_0x6929('0x4a')){var _0xf5995e={};_0xf5995e[_0x206f2f[_0x6929('0x4b')]]={'$like':'%'+_0x27b623[_0x6929('0x38')]['filter']+'%'};return _0xf5995e;}})});}_0x3c618b=_['merge']({},_0x3c618b,_0x27b623[_0x6929('0x4c')]);var _0x4d6341={'where':_0x3c618b[_0x6929('0x43')]};return db[_0x6929('0x35')][_0x6929('0x4d')](_0x4d6341)[_0x6929('0x1f')](function(_0x4a1c65){_0x3a9089[_0x6929('0x4d')]=_0x4a1c65;if(_0x27b623[_0x6929('0x38')]['includeAll']){_0x3c618b[_0x6929('0x4e')]=[{'all':!![]}];}return db[_0x6929('0x35')][_0x6929('0x4f')](_0x3c618b);})['then'](function(_0x5e69bf){_0x3a9089[_0x6929('0x50')]=_0x5e69bf;return _0x3a9089;})[_0x6929('0x1f')](respondWithFilteredResult(_0x2b997a,_0x3c618b))[_0x6929('0x51')](handleError(_0x2b997a,null));};exports[_0x6929('0x52')]=function(_0x343c22,_0xd91e60){var _0x84ee69={'raw':!![],'where':{'id':_0x343c22['params']['id']}},_0x174e03={};_0x174e03['model']=_[_0x6929('0x39')](db[_0x6929('0x35')][_0x6929('0x36')]);_0x174e03['query']=_['keys'](_0x343c22[_0x6929('0x38')]);_0x174e03[_0x6929('0x3a')]=_[_0x6929('0x3b')](_0x174e03[_0x6929('0x37')],_0x174e03[_0x6929('0x38')]);_0x84ee69[_0x6929('0x3c')]=_[_0x6929('0x3b')](_0x174e03[_0x6929('0x37')],qs[_0x6929('0x3d')](_0x343c22[_0x6929('0x38')][_0x6929('0x3d')]));_0x84ee69['attributes']=_0x84ee69[_0x6929('0x3c')][_0x6929('0x53')]?_0x84ee69[_0x6929('0x3c')]:_0x174e03[_0x6929('0x37')];if(_0x343c22['query'][_0x6929('0x54')]){_0x84ee69['include']=[{'all':!![]}];}_0x84ee69=_[_0x6929('0x46')]({},_0x84ee69,_0x343c22[_0x6929('0x4c')]);return db[_0x6929('0x35')]['find'](_0x84ee69)[_0x6929('0x1f')](handleEntityNotFound(_0xd91e60,null))[_0x6929('0x1f')](respondWithResult(_0xd91e60,null))[_0x6929('0x51')](handleError(_0xd91e60,null));};exports['create']=function(_0x5eff37,_0x3e57de){return db[_0x6929('0x35')][_0x6929('0x55')](_0x5eff37[_0x6929('0x56')],{})[_0x6929('0x1f')](respondWithResult(_0x3e57de,0xc9))['catch'](handleError(_0x3e57de,null));};exports[_0x6929('0x31')]=function(_0x8cc018,_0x5e2a55){if(_0x8cc018[_0x6929('0x56')]['id']){delete _0x8cc018[_0x6929('0x56')]['id'];}return db[_0x6929('0x35')]['find']({'where':{'id':_0x8cc018[_0x6929('0x57')]['id']}})[_0x6929('0x1f')](handleEntityNotFound(_0x5e2a55,null))[_0x6929('0x1f')](saveUpdates(_0x8cc018[_0x6929('0x56')],null))[_0x6929('0x1f')](respondWithResult(_0x5e2a55,null))['catch'](handleError(_0x5e2a55,null));};exports['destroy']=function(_0x374b15,_0x4687a0){return db[_0x6929('0x35')][_0x6929('0x58')]({'where':{'id':_0x374b15[_0x6929('0x57')]['id']}})['then'](handleEntityNotFound(_0x4687a0,null))[_0x6929('0x1f')](removeEntity(_0x4687a0,null))[_0x6929('0x51')](handleError(_0x4687a0,null));};exports['describe']=function(_0x30d70d,_0x5569fc){return db[_0x6929('0x35')][_0x6929('0x59')]()[_0x6929('0x1f')](respondWithResult(_0x5569fc,null))[_0x6929('0x51')](handleError(_0x5569fc,null));};var interaction_log=require(_0x6929('0x14'))(_0x6929('0x5a'));exports[_0x6929('0x5b')]=function(_0x4bf149,_0x54aa4c,_0x19a795){var _0x2fd7e6={'channel':_0x6929('0x5c')};if(_0x4bf149[_0x6929('0x56')]['id']){delete _0x4bf149[_0x6929('0x56')]['id'];}_0x4bf149['body'][_0x6929('0x5d')]=!![];_0x4bf149[_0x6929('0x56')][_0x6929('0x5e')]=moment()[_0x6929('0x5f')](_0x6929('0x60'));_0x4bf149[_0x6929('0x56')][_0x6929('0x61')]=_0x4bf149[_0x6929('0x56')][_0x6929('0x61')]||_0x4bf149['user']['id'];return db['ChatMessage'][_0x6929('0x58')]({'where':{'id':_0x4bf149[_0x6929('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x6929('0x62')],'as':_0x6929('0x63')}]})[_0x6929('0x1f')](handleEntityNotFound(_0x54aa4c,null))[_0x6929('0x1f')](saveUpdates(_0x4bf149[_0x6929('0x56')],null))['then'](function(_0x4b334f){if(_0x4b334f){_0x2fd7e6[_0x6929('0x26')]=_0x4b334f['get']({'plain':!![]});return db['ChatInteraction'][_0x6929('0x58')]({'where':{'id':_0x4b334f[_0x6929('0x64')]}});}return null;})[_0x6929('0x1f')](handleEntityNotFound(_0x54aa4c,null))['then'](function(_0x28971a){if(_0x28971a){return _0x28971a[_0x6929('0x31')]({'UserId':_0x4bf149[_0x6929('0x56')][_0x6929('0x61')],'read1stAt':_[_0x6929('0x65')](_0x28971a[_0x6929('0x66')])?moment()[_0x6929('0x5f')](_0x6929('0x60')):undefined});}return null;})[_0x6929('0x1f')](function(_0x2b0b9a){if(_0x2b0b9a){_0x2fd7e6['interaction']=_0x2b0b9a[_0x6929('0x67')]({'plain':!![]});interaction_log[_0x6929('0x20')](_0x6929('0x68'),_0x4bf149['user']['id'],_0x4bf149[_0x6929('0x69')][_0x6929('0x32')],_0x4bf149[_0x6929('0x69')][_0x6929('0x6a')],_0x2fd7e6[_0x6929('0x6b')]['id'],_0x4bf149[_0x6929('0x56')]?JSON[_0x6929('0x24')](_0x4bf149[_0x6929('0x56')]):_0x6929('0x6c'));return respondWithRpcPromise(_0x6929('0x6d'),_0x6929('0x6e'),_0x2fd7e6);}return null;})[_0x6929('0x1f')](function(_0x36a2c7){if(_0x36a2c7){if(_0x4bf149[_0x6929('0x56')]['manual']){_0x2fd7e6[_0x6929('0x26')]['interface']=util[_0x6929('0x5f')](_0x6929('0x6f'),_0x4bf149['user'][_0x6929('0x32')]);_0x2fd7e6[_0x6929('0x26')][_0x6929('0x70')]=_0x2fd7e6[_0x6929('0x70')];_0x2fd7e6[_0x6929('0x26')][_0x6929('0x71')]='accept';return respondWithRpcPromise(_0x6929('0x72'),_0x6929('0x72'),{'event':_0x6929('0x73'),'message':_[_0x6929('0x46')](_0x2fd7e6['message'],JSON[_0x6929('0x74')](_0x2fd7e6['interaction'][_0x6929('0x75')]))},client9002)['then'](function(){return _0x2fd7e6;});}return _0x2fd7e6;}return null;})[_0x6929('0x1f')](respondWithResult(_0x54aa4c,null))[_0x6929('0x51')](handleError(_0x54aa4c,null));};var interaction_log=require('../../config/logger')(_0x6929('0x5a'));exports[_0x6929('0x2f')]=function(_0x15c695,_0x31da9c,_0x109de8){var _0x59dc61={'agent':{},'channel':_0x6929('0x5c')};if(_0x15c695[_0x6929('0x56')]['id']){delete _0x15c695[_0x6929('0x56')]['id'];}_0x15c695[_0x6929('0x56')][_0x6929('0x61')]=_0x15c695[_0x6929('0x56')][_0x6929('0x61')]||_0x15c695[_0x6929('0x69')]['id'];_0x59dc61[_0x6929('0x76')]['id']=_0x15c695['body'][_0x6929('0x61')];return db[_0x6929('0x35')][_0x6929('0x58')]({'where':{'id':_0x15c695['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x31da9c,null))[_0x6929('0x1f')](function(_0x443d60){if(_0x443d60){_0x59dc61[_0x6929('0x26')]=_0x443d60[_0x6929('0x67')]({'plain':!![]});return db['ChatInteraction'][_0x6929('0x58')]({'where':{'id':_0x443d60[_0x6929('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x31da9c,null))[_0x6929('0x1f')](function(_0x5d9e4c){if(_0x5d9e4c){_0x59dc61[_0x6929('0x6b')]=_0x5d9e4c['get']({'plain':!![]});interaction_log[_0x6929('0x20')](_0x6929('0x77'),_0x15c695[_0x6929('0x69')]['id'],_0x15c695[_0x6929('0x69')][_0x6929('0x32')],_0x15c695[_0x6929('0x69')][_0x6929('0x6a')],_0x59dc61[_0x6929('0x6b')]['id'],_0x15c695[_0x6929('0x56')]?JSON[_0x6929('0x24')](_0x15c695[_0x6929('0x56')]):_0x6929('0x6c'));return respondWithRpcPromise(_0x6929('0x78'),_0x6929('0x79'),_0x59dc61);}return null;})[_0x6929('0x1f')](function(_0xced79b){if(_0xced79b){_0xced79b[_0x6929('0x26')][_0x6929('0x7a')]=util[_0x6929('0x5f')](_0x6929('0x6f'),_0x15c695[_0x6929('0x69')][_0x6929('0x32')]);_0xced79b[_0x6929('0x26')][_0x6929('0x70')]=_0x59dc61[_0x6929('0x70')];_0xced79b['message']['event']=_0x6929('0x2f');respondWithRpcPromise(_0x6929('0x72'),'EventManager',{'event':_0x6929('0x7b'),'message':_0xced79b[_0x6929('0x26')]},client9002);return _0x59dc61;}return null;})[_0x6929('0x1f')](respondWithResult(_0x31da9c,null))[_0x6929('0x51')](handleError(_0x31da9c,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 86821c8..c31cdd8 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 _0x56d8=['hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove','emit'];(function(_0x4dcb70,_0x1befe7){var _0x2941d5=function(_0x3e8bc7){while(--_0x3e8bc7){_0x4dcb70['push'](_0x4dcb70['shift']());}};_0x2941d5(++_0x1befe7);}(_0x56d8,0x1a1));var _0x856d=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x56d8[_0x36eaaa];return _0x461349;};'use strict';var EventEmitter=require(_0x856d('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x856d('0x1')](0x0);var events={'afterCreate':_0x856d('0x2'),'afterUpdate':_0x856d('0x3'),'afterDestroy':_0x856d('0x4')};function emitEvent(_0x573969){return function(_0x301bf6,_0x6c9777,_0x525f30){ChatMessageEvents['emit'](_0x573969+':'+_0x301bf6['id'],_0x301bf6);ChatMessageEvents[_0x856d('0x5')](_0x573969,_0x301bf6);_0x525f30(null);};}for(var e in events){if(events[_0x856d('0x6')](e)){var event=events[e];ChatMessage[_0x856d('0x7')](e,emitEvent(event));}}module[_0x856d('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x28ed=['exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x26aa3d,_0x417101){var _0x5cd7e5=function(_0x3e8c23){while(--_0x3e8c23){_0x26aa3d['push'](_0x26aa3d['shift']());}};_0x5cd7e5(++_0x417101);}(_0x28ed,0x1b9));var _0xd28e=function(_0x4aa8f4,_0x33151e){_0x4aa8f4=_0x4aa8f4-0x0;var _0x5accfa=_0x28ed[_0x4aa8f4];return _0x5accfa;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xd28e('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xd28e('0x1')](0x0);var events={'afterCreate':_0xd28e('0x2'),'afterUpdate':_0xd28e('0x3'),'afterDestroy':_0xd28e('0x4')};function emitEvent(_0x1598bf){return function(_0x18ff20,_0x2714bf,_0x321cbd){ChatMessageEvents[_0xd28e('0x5')](_0x1598bf+':'+_0x18ff20['id'],_0x18ff20);ChatMessageEvents['emit'](_0x1598bf,_0x18ff20);_0x321cbd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xd28e('0x6')](e,emitEvent(event));}}module[_0xd28e('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index b075041..5bcd7fa 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 _0x8783=['createdAt','body','catch','error','utf8mb4_unicode_ci','util','api','moment','request-promise','define','ChatMessage','models','toLowerCase','direction','UserId','ChatInteraction','findOne','then'];(function(_0x257017,_0x330627){var _0x38536d=function(_0xdf92e){while(--_0xdf92e){_0x257017['push'](_0x257017['shift']());}};_0x38536d(++_0x330627);}(_0x8783,0x1eb));var _0x3878=function(_0x2ea93d,_0x236de4){_0x2ea93d=_0x2ea93d-0x0;var _0x3c29b0=_0x8783[_0x2ea93d];return _0x3c29b0;};'use strict';var _=require('lodash');var util=require(_0x3878('0x0'));var logger=require('../../config/logger')(_0x3878('0x1'));var moment=require(_0x3878('0x2'));var BPromise=require('bluebird');var rp=require(_0x3878('0x3'));var attributes=require('./chatMessage.attributes');module['exports']=function(_0x46712f,_0xecb5c2){return _0x46712f[_0x3878('0x4')](_0x3878('0x5'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c234a,_0x5be758,_0x2a961c){var _0xc2b46e=_0x46712f[_0x3878('0x6')];var _0x2d7ee3=_0x3c234a['get']({'plain':!![]});if(_0x2d7ee3['direction'][_0x3878('0x7')]()==='in'||_0x2d7ee3[_0x3878('0x8')]['toLowerCase']()==='out'&&!_0x2d7ee3['secret']&&!_['isNil'](_0x2d7ee3[_0x3878('0x9')])){_0xc2b46e[_0x3878('0xa')][_0x3878('0xb')]({'where':{'id':_0x2d7ee3['ChatInteractionId']}})[_0x3878('0xc')](function(_0x180889){if(_0x180889){_0x180889['update']({'lastMsgAt':_0x2d7ee3[_0x3878('0xd')],'lastMsgDirection':_0x2d7ee3[_0x3878('0x8')][_0x3878('0x7')](),'lastMsgBody':_0x2d7ee3[_0x3878('0xe')]});}})[_0x3878('0xf')](function(_0x255f21){console[_0x3878('0x10')](_0x255f21);});}_0x2a961c();}},'charset':'utf8mb4','collate':_0x3878('0x11')});}; \ No newline at end of file +var _0xd217=['chat_messages','get','direction','toLowerCase','out','secret','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','body','catch','error','utf8mb4','lodash','../../config/logger','bluebird','./chatMessage.attributes','exports','define'];(function(_0x804e15,_0x480a05){var _0x360cb3=function(_0x10ee30){while(--_0x10ee30){_0x804e15['push'](_0x804e15['shift']());}};_0x360cb3(++_0x480a05);}(_0xd217,0xb2));var _0x7d21=function(_0x45d47f,_0x797620){_0x45d47f=_0x45d47f-0x0;var _0x1769d5=_0xd217[_0x45d47f];return _0x1769d5;};'use strict';var _=require(_0x7d21('0x0'));var util=require('util');var logger=require(_0x7d21('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7d21('0x2'));var rp=require('request-promise');var attributes=require(_0x7d21('0x3'));module[_0x7d21('0x4')]=function(_0x593e2d,_0x1f1606){return _0x593e2d[_0x7d21('0x5')]('ChatMessage',attributes,{'tableName':_0x7d21('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xe0ecb0,_0x512bde,_0x491b28){var _0x5b686d=_0x593e2d['models'];var _0xabea4c=_0xe0ecb0[_0x7d21('0x7')]({'plain':!![]});if(_0xabea4c[_0x7d21('0x8')][_0x7d21('0x9')]()==='in'||_0xabea4c['direction']['toLowerCase']()===_0x7d21('0xa')&&!_0xabea4c[_0x7d21('0xb')]&&!_['isNil'](_0xabea4c[_0x7d21('0xc')])){_0x5b686d[_0x7d21('0xd')][_0x7d21('0xe')]({'where':{'id':_0xabea4c[_0x7d21('0xf')]}})[_0x7d21('0x10')](function(_0x1442cf){if(_0x1442cf){_0x1442cf[_0x7d21('0x11')]({'lastMsgAt':_0xabea4c[_0x7d21('0x12')],'lastMsgDirection':_0xabea4c[_0x7d21('0x8')][_0x7d21('0x9')](),'lastMsgBody':_0xabea4c[_0x7d21('0x13')]});}})[_0x7d21('0x14')](function(_0x4efddb){console[_0x7d21('0x15')](_0x4efddb);});}_0x491b28();}},'charset':_0x7d21('0x16'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index e3508b6..93fbd7f 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 _0xfb98=['create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','./chatMessage.socket','register','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','CreateChatMessage','ChatMessage'];(function(_0x284b22,_0x1e0f2c){var _0x261e08=function(_0x167b12){while(--_0x167b12){_0x284b22['push'](_0x284b22['shift']());}};_0x261e08(++_0x1e0f2c);}(_0xfb98,0x1d2));var _0x8fb9=function(_0x292c24,_0x2c9917){_0x292c24=_0x292c24-0x0;var _0x414d9b=_0xfb98[_0x292c24];return _0x414d9b;};'use strict';var _=require(_0x8fb9('0x0'));var util=require(_0x8fb9('0x1'));var moment=require(_0x8fb9('0x2'));var BPromise=require(_0x8fb9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8fb9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8fb9('0x5'));var logger=require('../../config/logger')(_0x8fb9('0x6'));var config=require(_0x8fb9('0x7'));var jayson=require(_0x8fb9('0x8'));var client=jayson[_0x8fb9('0x9')][_0x8fb9('0xa')]({'port':0x232a});config['redis']=_[_0x8fb9('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8fb9('0xc'))(new Redis(config['redis']));require(_0x8fb9('0xd'))[_0x8fb9('0xe')](socket);function respondWithRpcPromise(_0x18dbeb,_0x3e9303,_0x7c2af8){return new BPromise(function(_0x16d130,_0x449d29){return client['request'](_0x18dbeb,_0x7c2af8)[_0x8fb9('0xf')](function(_0x5c6430){logger['info'](_0x8fb9('0x10'),_0x3e9303,_0x8fb9('0x11'));logger[_0x8fb9('0x12')](_0x8fb9('0x13'),_0x3e9303,_0x8fb9('0x11'),JSON[_0x8fb9('0x14')](_0x5c6430));if(_0x5c6430['error']){if(_0x5c6430['error'][_0x8fb9('0x15')]===0x1f4){logger[_0x8fb9('0x16')](_0x8fb9('0x10'),_0x3e9303,_0x5c6430[_0x8fb9('0x16')][_0x8fb9('0x17')]);return _0x449d29(_0x5c6430[_0x8fb9('0x16')][_0x8fb9('0x17')]);}logger[_0x8fb9('0x16')](_0x8fb9('0x10'),_0x3e9303,_0x5c6430['error'][_0x8fb9('0x17')]);return _0x16d130(_0x5c6430[_0x8fb9('0x16')]['message']);}else{logger[_0x8fb9('0x18')](_0x8fb9('0x10'),_0x3e9303,_0x8fb9('0x11'));_0x16d130(_0x5c6430[_0x8fb9('0x19')][_0x8fb9('0x17')]);}})[_0x8fb9('0x1a')](function(_0x7f6c69){logger['error'](_0x8fb9('0x10'),_0x3e9303,_0x7f6c69);_0x449d29(_0x7f6c69);});});}exports[_0x8fb9('0x1b')]=function(_0x2631e2){var _0x523f60=this;return new Promise(function(_0x53028c,_0x2a4c34){return db[_0x8fb9('0x1c')][_0x8fb9('0x1d')](_0x2631e2[_0x8fb9('0x1e')],{'raw':_0x2631e2[_0x8fb9('0x1f')]?_0x2631e2[_0x8fb9('0x1f')][_0x8fb9('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x51f4a0){logger[_0x8fb9('0x18')](_0x8fb9('0x1b'),_0x2631e2);logger[_0x8fb9('0x12')](_0x8fb9('0x1b'),_0x2631e2,JSON['stringify'](_0x51f4a0));_0x53028c(_0x51f4a0);})['catch'](function(_0x3232dd){logger[_0x8fb9('0x16')](_0x8fb9('0x1b'),_0x3232dd[_0x8fb9('0x17')],_0x2631e2);_0x2a4c34(_0x523f60[_0x8fb9('0x16')](0x1f4,_0x3232dd[_0x8fb9('0x17')]));});});}; \ No newline at end of file +var _0x6c72=['ChatMessage','create','options','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateChatMessage'];(function(_0x1ba43c,_0x5bd2e8){var _0x2f60eb=function(_0x349dff){while(--_0x349dff){_0x1ba43c['push'](_0x1ba43c['shift']());}};_0x2f60eb(++_0x5bd2e8);}(_0x6c72,0x197));var _0x26c7=function(_0x27e52f,_0x329483){_0x27e52f=_0x27e52f-0x0;var _0x394a8b=_0x6c72[_0x27e52f];return _0x394a8b;};'use strict';var _=require('lodash');var util=require(_0x26c7('0x0'));var moment=require(_0x26c7('0x1'));var BPromise=require(_0x26c7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x26c7('0x3'));var db=require(_0x26c7('0x4'))['db'];var utils=require(_0x26c7('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x26c7('0x6'));var client=jayson[_0x26c7('0x7')][_0x26c7('0x8')]({'port':0x232a});config[_0x26c7('0x9')]=_[_0x26c7('0xa')](config[_0x26c7('0x9')],{'host':_0x26c7('0xb'),'port':0x18eb});var socket=require(_0x26c7('0xc'))(new Redis(config[_0x26c7('0x9')]));require(_0x26c7('0xd'))[_0x26c7('0xe')](socket);function respondWithRpcPromise(_0x29675f,_0x428b9d,_0x3f27b6){return new BPromise(function(_0xdb6e8b,_0x56f30c){return client[_0x26c7('0xf')](_0x29675f,_0x3f27b6)[_0x26c7('0x10')](function(_0x45e86d){logger[_0x26c7('0x11')](_0x26c7('0x12'),_0x428b9d,_0x26c7('0x13'));logger[_0x26c7('0x14')](_0x26c7('0x15'),_0x428b9d,_0x26c7('0x13'),JSON['stringify'](_0x45e86d));if(_0x45e86d[_0x26c7('0x16')]){if(_0x45e86d[_0x26c7('0x16')][_0x26c7('0x17')]===0x1f4){logger[_0x26c7('0x16')]('ChatMessage,\x20%s,\x20%s',_0x428b9d,_0x45e86d[_0x26c7('0x16')]['message']);return _0x56f30c(_0x45e86d['error']['message']);}logger[_0x26c7('0x16')]('ChatMessage,\x20%s,\x20%s',_0x428b9d,_0x45e86d['error'][_0x26c7('0x18')]);return _0xdb6e8b(_0x45e86d['error'][_0x26c7('0x18')]);}else{logger['info'](_0x26c7('0x12'),_0x428b9d,_0x26c7('0x13'));_0xdb6e8b(_0x45e86d['result'][_0x26c7('0x18')]);}})[_0x26c7('0x19')](function(_0xa3ea2f){logger[_0x26c7('0x16')](_0x26c7('0x12'),_0x428b9d,_0xa3ea2f);_0x56f30c(_0xa3ea2f);});});}exports[_0x26c7('0x1a')]=function(_0x5ef975){var _0x246162=this;return new Promise(function(_0x5ce2c4,_0x4bf175){return db[_0x26c7('0x1b')][_0x26c7('0x1c')](_0x5ef975['body'],{'raw':_0x5ef975[_0x26c7('0x1d')]?_0x5ef975[_0x26c7('0x1d')][_0x26c7('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x35b6a7){logger[_0x26c7('0x11')](_0x26c7('0x1a'),_0x5ef975);logger[_0x26c7('0x14')](_0x26c7('0x1a'),_0x5ef975,JSON['stringify'](_0x35b6a7));_0x5ce2c4(_0x35b6a7);})[_0x26c7('0x19')](function(_0x2792a2){logger[_0x26c7('0x16')](_0x26c7('0x1a'),_0x2792a2[_0x26c7('0x18')],_0x5ef975);_0x4bf175(_0x246162[_0x26c7('0x16')](0x1f4,_0x2792a2[_0x26c7('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index a550be0..ad38ad2 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 _0x34e8=['register','length','chatMessage:','./chatMessage.events','save','remove','update','emit','removeListener'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0x34e8,0x12c));var _0x834e=function(_0x21b151,_0x1e558d){_0x21b151=_0x21b151-0x0;var _0x237c69=_0x34e8[_0x21b151];return _0x237c69;};'use strict';var ChatMessageEvents=require(_0x834e('0x0'));var events=[_0x834e('0x1'),_0x834e('0x2'),_0x834e('0x3')];function createListener(_0x530939,_0x832422){return function(_0x21e2e0){_0x832422[_0x834e('0x4')](_0x530939,_0x21e2e0);};}function removeListener(_0x31bf20,_0x289ef2){return function(){ChatMessageEvents[_0x834e('0x5')](_0x31bf20,_0x289ef2);};}exports[_0x834e('0x6')]=function(_0x4a2018){for(var _0x858aa1=0x0,_0x52056d=events[_0x834e('0x7')];_0x858aa1<_0x52056d;_0x858aa1++){var _0x3cc2e3=events[_0x858aa1];var _0x3a3ef6=createListener(_0x834e('0x8')+_0x3cc2e3,_0x4a2018);ChatMessageEvents['on'](_0x3cc2e3,_0x3a3ef6);}}; \ No newline at end of file +var _0x3e74=['emit','removeListener','register','length','chatMessage:','./chatMessage.events','remove','update'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x3e74,0x175));var _0x43e7=function(_0x3b72db,_0x5c945c){_0x3b72db=_0x3b72db-0x0;var _0x25330d=_0x3e74[_0x3b72db];return _0x25330d;};'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 8aeaf0f..1537d79 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 _0x306a=['/describe','isAuthenticated','describe','/:id','show','post','chat','chatmessage:create','create','put','update','/:id/accept','accept','reject','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x306a,0x147));var _0xa306=function(_0x1f42bc,_0x208463){_0x1f42bc=_0x1f42bc-0x0;var _0x23f159=_0x306a[_0x1f42bc];return _0x23f159;};'use strict';var multer=require(_0xa306('0x0'));var util=require('util');var path=require(_0xa306('0x1'));var timeout=require(_0xa306('0x2'));var express=require(_0xa306('0x3'));var router=express['Router']();var auth=require(_0xa306('0x4'));var interaction=require(_0xa306('0x5'));var config=require(_0xa306('0x6'));var controller=require('./chatMessage.controller');router[_0xa306('0x7')]('/',auth['isAuthenticated'](),controller[_0xa306('0x8')]);router['get'](_0xa306('0x9'),auth[_0xa306('0xa')](),controller[_0xa306('0xb')]);router[_0xa306('0x7')](_0xa306('0xc'),auth['isAuthenticated'](),controller[_0xa306('0xd')]);router[_0xa306('0xe')]('/',auth[_0xa306('0xa')](),interaction['tracked'](_0xa306('0xf'),_0xa306('0x10')),controller[_0xa306('0x11')]);router[_0xa306('0x12')](_0xa306('0xc'),controller[_0xa306('0x13')]);router['put'](_0xa306('0x14'),auth[_0xa306('0xa')](),controller[_0xa306('0x15')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0xa306('0x16')]);router['delete'](_0xa306('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xa306('0x17')]=router; \ No newline at end of file +var _0xa079=['/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','describe','/:id','show','tracked','chat','chatmessage:create','create','put','update'];(function(_0x2ef771,_0x25330f){var _0x139b2c=function(_0x2fcf94){while(--_0x2fcf94){_0x2ef771['push'](_0x2ef771['shift']());}};_0x139b2c(++_0x25330f);}(_0xa079,0x84));var _0x9a07=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa079[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9a07('0x0'));var util=require('util');var path=require(_0x9a07('0x1'));var timeout=require(_0x9a07('0x2'));var express=require('express');var router=express[_0x9a07('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x9a07('0x4'));var config=require(_0x9a07('0x5'));var controller=require('./chatMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x9a07('0x6')]);router[_0x9a07('0x7')]('/describe',auth[_0x9a07('0x8')](),controller[_0x9a07('0x9')]);router[_0x9a07('0x7')](_0x9a07('0xa'),auth[_0x9a07('0x8')](),controller[_0x9a07('0xb')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x9a07('0xc')](_0x9a07('0xd'),_0x9a07('0xe')),controller[_0x9a07('0xf')]);router[_0x9a07('0x10')]('/:id',controller[_0x9a07('0x11')]);router['put'](_0x9a07('0x12'),auth[_0x9a07('0x8')](),controller[_0x9a07('0x13')]);router[_0x9a07('0x10')](_0x9a07('0x14'),auth[_0x9a07('0x8')](),controller[_0x9a07('0x15')]);router[_0x9a07('0x16')]('/:id',auth[_0x9a07('0x8')](),controller[_0x9a07('0x17')]);module[_0x9a07('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index ae51745..fc1681c 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 _0xf58e=['medium','sequelize','exports','TEXT'];(function(_0x43daef,_0x6fa2e6){var _0x23bbbb=function(_0x1d026a){while(--_0x1d026a){_0x43daef['push'](_0x43daef['shift']());}};_0x23bbbb(++_0x6fa2e6);}(_0xf58e,0xc1));var _0xef58=function(_0x5826a7,_0x1e58b9){_0x5826a7=_0x5826a7-0x0;var _0x18ebd6=_0xf58e[_0x5826a7];return _0x18ebd6;};'use strict';var Sequelize=require(_0xef58('0x0'));module[_0xef58('0x1')]={'body':{'type':Sequelize[_0xef58('0x2')](_0xef58('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x320e=['sequelize','exports','medium'];(function(_0x589d15,_0x3086f5){var _0x284c4d=function(_0x52dd8b){while(--_0x52dd8b){_0x589d15['push'](_0x589d15['shift']());}};_0x284c4d(++_0x3086f5);}(_0x320e,0x1dd));var _0xe320=function(_0x19abc7,_0x5aadb6){_0x19abc7=_0x19abc7-0x0;var _0xc24f10=_0x320e[_0x19abc7];return _0xc24f10;};'use strict';var Sequelize=require(_0xe320('0x0'));module[_0xe320('0x1')]={'body':{'type':Sequelize['TEXT'](_0xe320('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 2fae365..4272fb5 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 _0x2e16=['save','then','error','name','send','index','ChatOfflineMessage','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','key','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','update','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range'];(function(_0x5f0575,_0x5e0da9){var _0xa7a1fa=function(_0x5ab8ef){while(--_0x5ab8ef){_0x5f0575['push'](_0x5f0575['shift']());}};_0xa7a1fa(++_0x5e0da9);}(_0x2e16,0x139));var _0x62e1=function(_0x5308c5,_0x34445a){_0x5308c5=_0x5308c5-0x0;var _0x42affc=_0x2e16[_0x5308c5];return _0x42affc;};'use strict';var pdf=require(_0x62e1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x62e1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x62e1('0x2'));var rp=require(_0x62e1('0x3'));var moment=require(_0x62e1('0x4'));var BPromise=require(_0x62e1('0x5'));var Mustache=require(_0x62e1('0x6'));var util=require(_0x62e1('0x7'));var path=require(_0x62e1('0x8'));var sox=require('sox');var csv=require(_0x62e1('0x9'));var ejs=require(_0x62e1('0xa'));var fs=require('fs');var _=require(_0x62e1('0xb'));var squel=require(_0x62e1('0xc'));var crypto=require(_0x62e1('0xd'));var jsforce=require(_0x62e1('0xe'));var deskjs=require(_0x62e1('0xf'));var toCsv=require(_0x62e1('0x9'));var querystring=require(_0x62e1('0x10'));var Papa=require(_0x62e1('0x11'));var authService=require(_0x62e1('0x12'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0x62e1('0x13'));var logger=require(_0x62e1('0x14'))(_0x62e1('0x15'));var utils=require('../../config/utils');var config=require(_0x62e1('0x16'));var db=require(_0x62e1('0x17'))['db'];function respondWithStatusCode(_0x18e914,_0x2f0cbe){_0x2f0cbe=_0x2f0cbe||0xcc;return function(_0x86d036){if(_0x86d036){return _0x18e914['sendStatus'](_0x2f0cbe);}return _0x18e914['status'](_0x2f0cbe)[_0x62e1('0x18')]();};}function respondWithResult(_0x5e486c,_0x2cf238){_0x2cf238=_0x2cf238||0xc8;return function(_0x2f194a){if(_0x2f194a){return _0x5e486c[_0x62e1('0x19')](_0x2cf238)[_0x62e1('0x1a')](_0x2f194a);}};}function respondWithFilteredResult(_0x5898c9,_0x36a70e){return function(_0x40fdc8){if(_0x40fdc8){var _0x4d10be=_0x40fdc8[_0x62e1('0x1b')],_0x3d1a9d=_0x36a70e[_0x62e1('0x1c')],_0x516db0=_0x36a70e[_0x62e1('0x1c')]+_0x36a70e[_0x62e1('0x1d')],_0xcabeca;if(_0x516db0>=_0x4d10be){_0x516db0=_0x4d10be;_0xcabeca=0xc8;}else{_0xcabeca=0xce;}_0x5898c9['status'](_0xcabeca);return _0x5898c9[_0x62e1('0x1e')](_0x62e1('0x1f'),_0x3d1a9d+'-'+_0x516db0+'/'+_0x4d10be)['json'](_0x40fdc8);}return null;};}function patchUpdates(_0x4f5896){return function(_0x3da082){try{jsonpatch['apply'](_0x3da082,_0x4f5896,!![]);}catch(_0x332215){return BPromise['reject'](_0x332215);}return _0x3da082[_0x62e1('0x20')]();};}function saveUpdates(_0x49bf3e,_0x217560){return function(_0x1ecbd3){if(_0x1ecbd3){return _0x1ecbd3['update'](_0x49bf3e)[_0x62e1('0x21')](function(_0x7a9750){return _0x7a9750;});}return null;};}function removeEntity(_0x819600,_0x5b0b3f){return function(_0x35a1bd){if(_0x35a1bd){return _0x35a1bd['destroy']()[_0x62e1('0x21')](function(){_0x819600[_0x62e1('0x19')](0xcc)[_0x62e1('0x18')]();});}};}function handleEntityNotFound(_0x40117f,_0x4d2a39){return function(_0xbd9cd4){if(!_0xbd9cd4){_0x40117f['sendStatus'](0x194);}return _0xbd9cd4;};}function handleError(_0x5402aa,_0x57069e){_0x57069e=_0x57069e||0x1f4;return function(_0x46c6cd){logger[_0x62e1('0x22')](_0x46c6cd['stack']);if(_0x46c6cd[_0x62e1('0x23')]){delete _0x46c6cd[_0x62e1('0x23')];}_0x5402aa[_0x62e1('0x19')](_0x57069e)[_0x62e1('0x24')](_0x46c6cd);};}exports[_0x62e1('0x25')]=function(_0x5ea667,_0x3abfe1){var _0x1d7933={},_0x26b960={},_0x25f9a3={'count':0x0,'rows':[]};var _0x4cd7d4=db[_0x62e1('0x26')][_0x62e1('0x27')];_0x26b960[_0x62e1('0x28')]=_[_0x62e1('0x29')](_0x4cd7d4);_0x26b960[_0x62e1('0x2a')]=_[_0x62e1('0x29')](_0x5ea667[_0x62e1('0x2a')]);_0x26b960[_0x62e1('0x2b')]=_[_0x62e1('0x2c')](_0x26b960['model'],_0x26b960[_0x62e1('0x2a')]);_0x1d7933[_0x62e1('0x2d')]=_[_0x62e1('0x2c')](_0x26b960[_0x62e1('0x28')],qs[_0x62e1('0x2e')](_0x5ea667[_0x62e1('0x2a')][_0x62e1('0x2e')]));_0x1d7933['attributes']=_0x1d7933[_0x62e1('0x2d')][_0x62e1('0x2f')]?_0x1d7933[_0x62e1('0x2d')]:_0x26b960[_0x62e1('0x28')];if(!_0x5ea667[_0x62e1('0x2a')][_0x62e1('0x30')]('nolimit')){_0x1d7933[_0x62e1('0x1d')]=qs[_0x62e1('0x1d')](_0x5ea667[_0x62e1('0x2a')][_0x62e1('0x1d')]);_0x1d7933[_0x62e1('0x1c')]=qs[_0x62e1('0x1c')](_0x5ea667[_0x62e1('0x2a')]['offset']);}_0x1d7933[_0x62e1('0x31')]=qs[_0x62e1('0x32')](_0x5ea667[_0x62e1('0x2a')][_0x62e1('0x32')]);_0x1d7933[_0x62e1('0x33')]=qs[_0x62e1('0x2b')](_[_0x62e1('0x34')](_0x5ea667[_0x62e1('0x2a')],_0x26b960[_0x62e1('0x2b')]));if(_0x5ea667[_0x62e1('0x2a')][_0x62e1('0x35')]){_0x1d7933[_0x62e1('0x33')]=_[_0x62e1('0x36')](_0x1d7933[_0x62e1('0x33')],{'$or':_['map'](_0x4cd7d4,function(_0x4c0cfa){if(_0x4c0cfa['type'][_0x62e1('0x37')]!==_0x62e1('0x38')){var _0x3f15e8={};_0x3f15e8[_0x4c0cfa['field']]={'$like':'%'+_0x5ea667[_0x62e1('0x2a')][_0x62e1('0x35')]+'%'};return _0x3f15e8;}})});}_0x1d7933=_[_0x62e1('0x36')]({},_0x1d7933,_0x5ea667[_0x62e1('0x39')]);var _0x263809={'where':_0x1d7933['where']};return db[_0x62e1('0x26')][_0x62e1('0x1b')](_0x263809)[_0x62e1('0x21')](function(_0x151f02){_0x25f9a3[_0x62e1('0x1b')]=_0x151f02;if(_0x5ea667[_0x62e1('0x2a')][_0x62e1('0x3a')]){_0x1d7933[_0x62e1('0x3b')]=[{'all':!![]}];}return db[_0x62e1('0x26')]['findAll'](_0x1d7933);})[_0x62e1('0x21')](function(_0x3c3e13){_0x25f9a3[_0x62e1('0x3c')]=_0x3c3e13;return _0x25f9a3;})[_0x62e1('0x21')](respondWithFilteredResult(_0x3abfe1,_0x1d7933))[_0x62e1('0x3d')](handleError(_0x3abfe1,null));};exports[_0x62e1('0x3e')]=function(_0x1a4b7c,_0x5f1165){var _0x2267f4={'raw':!![],'where':{'id':_0x1a4b7c[_0x62e1('0x3f')]['id']}},_0x374f61={};_0x374f61[_0x62e1('0x28')]=_[_0x62e1('0x29')](db['ChatOfflineMessage']['rawAttributes']);_0x374f61[_0x62e1('0x2a')]=_['keys'](_0x1a4b7c[_0x62e1('0x2a')]);_0x374f61[_0x62e1('0x2b')]=_[_0x62e1('0x2c')](_0x374f61[_0x62e1('0x28')],_0x374f61[_0x62e1('0x2a')]);_0x2267f4[_0x62e1('0x2d')]=_['intersection'](_0x374f61[_0x62e1('0x28')],qs['fields'](_0x1a4b7c['query'][_0x62e1('0x2e')]));_0x2267f4[_0x62e1('0x2d')]=_0x2267f4['attributes']['length']?_0x2267f4[_0x62e1('0x2d')]:_0x374f61[_0x62e1('0x28')];if(_0x1a4b7c[_0x62e1('0x2a')][_0x62e1('0x3a')]){_0x2267f4['include']=[{'all':!![]}];}_0x2267f4=_[_0x62e1('0x36')]({},_0x2267f4,_0x1a4b7c[_0x62e1('0x39')]);return db[_0x62e1('0x26')][_0x62e1('0x40')](_0x2267f4)[_0x62e1('0x21')](handleEntityNotFound(_0x5f1165,null))[_0x62e1('0x21')](respondWithResult(_0x5f1165,null))[_0x62e1('0x3d')](handleError(_0x5f1165,null));};exports[_0x62e1('0x41')]=function(_0x22b34f,_0x3df13f){return db[_0x62e1('0x26')]['create'](_0x22b34f[_0x62e1('0x42')],{})[_0x62e1('0x21')](respondWithResult(_0x3df13f,0xc9))['catch'](handleError(_0x3df13f,null));};exports[_0x62e1('0x43')]=function(_0x4ea767,_0xc5bac){if(_0x4ea767[_0x62e1('0x42')]['id']){delete _0x4ea767['body']['id'];}return db[_0x62e1('0x26')]['find']({'where':{'id':_0x4ea767['params']['id']}})[_0x62e1('0x21')](handleEntityNotFound(_0xc5bac,null))['then'](saveUpdates(_0x4ea767[_0x62e1('0x42')],null))[_0x62e1('0x21')](respondWithResult(_0xc5bac,null))[_0x62e1('0x3d')](handleError(_0xc5bac,null));};exports['destroy']=function(_0x5f3710,_0x521596){return db['ChatOfflineMessage']['find']({'where':{'id':_0x5f3710[_0x62e1('0x3f')]['id']}})[_0x62e1('0x21')](handleEntityNotFound(_0x521596,null))[_0x62e1('0x21')](removeEntity(_0x521596,null))['catch'](handleError(_0x521596,null));};exports[_0x62e1('0x44')]=function(_0xd5ee39,_0x483746){return db['ChatOfflineMessage'][_0x62e1('0x44')]()[_0x62e1('0x21')](respondWithResult(_0x483746,null))['catch'](handleError(_0x483746,null));}; \ No newline at end of file +var _0x6f8a=['ChatOfflineMessage','rawAttributes','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','map','type','count','includeAll','show','params','fields','include','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','offset','status','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index'];(function(_0x40c843,_0x4440b8){var _0x323a46=function(_0x559de4){while(--_0x559de4){_0x40c843['push'](_0x40c843['shift']());}};_0x323a46(++_0x4440b8);}(_0x6f8a,0x1ce));var _0xa6f8=function(_0x41198e,_0x291030){_0x41198e=_0x41198e-0x0;var _0x4c0ab7=_0x6f8a[_0x41198e];return _0x4c0ab7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa6f8('0x0'));var rimraf=require(_0xa6f8('0x1'));var zipdir=require(_0xa6f8('0x2'));var jsonpatch=require(_0xa6f8('0x3'));var rp=require(_0xa6f8('0x4'));var moment=require(_0xa6f8('0x5'));var BPromise=require(_0xa6f8('0x6'));var Mustache=require(_0xa6f8('0x7'));var util=require(_0xa6f8('0x8'));var path=require(_0xa6f8('0x9'));var sox=require('sox');var csv=require(_0xa6f8('0xa'));var ejs=require(_0xa6f8('0xb'));var fs=require('fs');var _=require(_0xa6f8('0xc'));var squel=require(_0xa6f8('0xd'));var crypto=require('crypto');var jsforce=require(_0xa6f8('0xe'));var deskjs=require(_0xa6f8('0xf'));var toCsv=require(_0xa6f8('0xa'));var querystring=require(_0xa6f8('0x10'));var Papa=require(_0xa6f8('0x11'));var authService=require(_0xa6f8('0x12'));var hardwareService=require(_0xa6f8('0x13'));var Redis=require(_0xa6f8('0x14'));var qs=require('../../components/parsers/qs');var logger=require(_0xa6f8('0x15'))('api');var utils=require(_0xa6f8('0x16'));var config=require(_0xa6f8('0x17'));var db=require(_0xa6f8('0x18'))['db'];function respondWithStatusCode(_0x2316a3,_0x2ee0f8){_0x2ee0f8=_0x2ee0f8||0xcc;return function(_0x36812e){if(_0x36812e){return _0x2316a3['sendStatus'](_0x2ee0f8);}return _0x2316a3['status'](_0x2ee0f8)[_0xa6f8('0x19')]();};}function respondWithResult(_0x1c4c08,_0x2aa7f8){_0x2aa7f8=_0x2aa7f8||0xc8;return function(_0x1c5285){if(_0x1c5285){return _0x1c4c08['status'](_0x2aa7f8)[_0xa6f8('0x1a')](_0x1c5285);}};}function respondWithFilteredResult(_0x29d1b9,_0x1c5e87){return function(_0x1bca3e){if(_0x1bca3e){var _0x47f6a8=_0x1bca3e['count'],_0x3abe1f=_0x1c5e87[_0xa6f8('0x1b')],_0x5acba6=_0x1c5e87[_0xa6f8('0x1b')]+_0x1c5e87['limit'],_0x4b2ec4;if(_0x5acba6>=_0x47f6a8){_0x5acba6=_0x47f6a8;_0x4b2ec4=0xc8;}else{_0x4b2ec4=0xce;}_0x29d1b9[_0xa6f8('0x1c')](_0x4b2ec4);return _0x29d1b9[_0xa6f8('0x1d')](_0xa6f8('0x1e'),_0x3abe1f+'-'+_0x5acba6+'/'+_0x47f6a8)[_0xa6f8('0x1a')](_0x1bca3e);}return null;};}function patchUpdates(_0x4c8eae){return function(_0x72dae3){try{jsonpatch[_0xa6f8('0x1f')](_0x72dae3,_0x4c8eae,!![]);}catch(_0x46f1ca){return BPromise[_0xa6f8('0x20')](_0x46f1ca);}return _0x72dae3['save']();};}function saveUpdates(_0x26a62e,_0x377e1e){return function(_0x470b56){if(_0x470b56){return _0x470b56[_0xa6f8('0x21')](_0x26a62e)['then'](function(_0x1d1f5c){return _0x1d1f5c;});}return null;};}function removeEntity(_0x2fd32c,_0x426567){return function(_0xd2a565){if(_0xd2a565){return _0xd2a565[_0xa6f8('0x22')]()[_0xa6f8('0x23')](function(){_0x2fd32c[_0xa6f8('0x1c')](0xcc)[_0xa6f8('0x19')]();});}};}function handleEntityNotFound(_0x42f4fc,_0x19f8c3){return function(_0x29108f){if(!_0x29108f){_0x42f4fc[_0xa6f8('0x24')](0x194);}return _0x29108f;};}function handleError(_0x2dd21d,_0xe55877){_0xe55877=_0xe55877||0x1f4;return function(_0x54286e){logger[_0xa6f8('0x25')](_0x54286e[_0xa6f8('0x26')]);if(_0x54286e[_0xa6f8('0x27')]){delete _0x54286e[_0xa6f8('0x27')];}_0x2dd21d['status'](_0xe55877)[_0xa6f8('0x28')](_0x54286e);};}exports[_0xa6f8('0x29')]=function(_0x5e4d86,_0x6eb481){var _0x203094={},_0x3edbf6={},_0x3adb6c={'count':0x0,'rows':[]};var _0x31b646=db[_0xa6f8('0x2a')][_0xa6f8('0x2b')];_0x3edbf6[_0xa6f8('0x2c')]=_[_0xa6f8('0x2d')](_0x31b646);_0x3edbf6[_0xa6f8('0x2e')]=_[_0xa6f8('0x2d')](_0x5e4d86[_0xa6f8('0x2e')]);_0x3edbf6[_0xa6f8('0x2f')]=_[_0xa6f8('0x30')](_0x3edbf6[_0xa6f8('0x2c')],_0x3edbf6[_0xa6f8('0x2e')]);_0x203094[_0xa6f8('0x31')]=_[_0xa6f8('0x30')](_0x3edbf6[_0xa6f8('0x2c')],qs['fields'](_0x5e4d86[_0xa6f8('0x2e')]['fields']));_0x203094[_0xa6f8('0x31')]=_0x203094['attributes'][_0xa6f8('0x32')]?_0x203094['attributes']:_0x3edbf6[_0xa6f8('0x2c')];if(!_0x5e4d86[_0xa6f8('0x2e')][_0xa6f8('0x33')](_0xa6f8('0x34'))){_0x203094[_0xa6f8('0x35')]=qs[_0xa6f8('0x35')](_0x5e4d86[_0xa6f8('0x2e')][_0xa6f8('0x35')]);_0x203094[_0xa6f8('0x1b')]=qs['offset'](_0x5e4d86['query'][_0xa6f8('0x1b')]);}_0x203094['order']=qs[_0xa6f8('0x36')](_0x5e4d86['query'][_0xa6f8('0x36')]);_0x203094[_0xa6f8('0x37')]=qs['filters'](_[_0xa6f8('0x38')](_0x5e4d86[_0xa6f8('0x2e')],_0x3edbf6[_0xa6f8('0x2f')]));if(_0x5e4d86['query'][_0xa6f8('0x39')]){_0x203094[_0xa6f8('0x37')]=_[_0xa6f8('0x3a')](_0x203094[_0xa6f8('0x37')],{'$or':_[_0xa6f8('0x3b')](_0x31b646,function(_0x573f25){if(_0x573f25[_0xa6f8('0x3c')]['key']!=='VIRTUAL'){var _0x2e8aed={};_0x2e8aed[_0x573f25['field']]={'$like':'%'+_0x5e4d86[_0xa6f8('0x2e')][_0xa6f8('0x39')]+'%'};return _0x2e8aed;}})});}_0x203094=_[_0xa6f8('0x3a')]({},_0x203094,_0x5e4d86['options']);var _0x7bdd8a={'where':_0x203094[_0xa6f8('0x37')]};return db[_0xa6f8('0x2a')][_0xa6f8('0x3d')](_0x7bdd8a)['then'](function(_0x11b446){_0x3adb6c[_0xa6f8('0x3d')]=_0x11b446;if(_0x5e4d86[_0xa6f8('0x2e')][_0xa6f8('0x3e')]){_0x203094['include']=[{'all':!![]}];}return db[_0xa6f8('0x2a')]['findAll'](_0x203094);})['then'](function(_0x2b6a3b){_0x3adb6c['rows']=_0x2b6a3b;return _0x3adb6c;})[_0xa6f8('0x23')](respondWithFilteredResult(_0x6eb481,_0x203094))['catch'](handleError(_0x6eb481,null));};exports[_0xa6f8('0x3f')]=function(_0x6c9f96,_0x42a4dc){var _0x1c341a={'raw':!![],'where':{'id':_0x6c9f96[_0xa6f8('0x40')]['id']}},_0x457957={};_0x457957[_0xa6f8('0x2c')]=_[_0xa6f8('0x2d')](db[_0xa6f8('0x2a')][_0xa6f8('0x2b')]);_0x457957[_0xa6f8('0x2e')]=_[_0xa6f8('0x2d')](_0x6c9f96[_0xa6f8('0x2e')]);_0x457957['filters']=_['intersection'](_0x457957[_0xa6f8('0x2c')],_0x457957['query']);_0x1c341a['attributes']=_[_0xa6f8('0x30')](_0x457957[_0xa6f8('0x2c')],qs[_0xa6f8('0x41')](_0x6c9f96[_0xa6f8('0x2e')][_0xa6f8('0x41')]));_0x1c341a[_0xa6f8('0x31')]=_0x1c341a[_0xa6f8('0x31')]['length']?_0x1c341a['attributes']:_0x457957[_0xa6f8('0x2c')];if(_0x6c9f96[_0xa6f8('0x2e')][_0xa6f8('0x3e')]){_0x1c341a[_0xa6f8('0x42')]=[{'all':!![]}];}_0x1c341a=_['merge']({},_0x1c341a,_0x6c9f96['options']);return db[_0xa6f8('0x2a')]['find'](_0x1c341a)['then'](handleEntityNotFound(_0x42a4dc,null))['then'](respondWithResult(_0x42a4dc,null))[_0xa6f8('0x43')](handleError(_0x42a4dc,null));};exports[_0xa6f8('0x44')]=function(_0x3189e8,_0x1cba72){return db[_0xa6f8('0x2a')][_0xa6f8('0x44')](_0x3189e8[_0xa6f8('0x45')],{})['then'](respondWithResult(_0x1cba72,0xc9))[_0xa6f8('0x43')](handleError(_0x1cba72,null));};exports[_0xa6f8('0x21')]=function(_0x2c6427,_0x503777){if(_0x2c6427['body']['id']){delete _0x2c6427[_0xa6f8('0x45')]['id'];}return db[_0xa6f8('0x2a')]['find']({'where':{'id':_0x2c6427[_0xa6f8('0x40')]['id']}})[_0xa6f8('0x23')](handleEntityNotFound(_0x503777,null))['then'](saveUpdates(_0x2c6427['body'],null))[_0xa6f8('0x23')](respondWithResult(_0x503777,null))['catch'](handleError(_0x503777,null));};exports['destroy']=function(_0xf1d592,_0x2386d6){return db['ChatOfflineMessage'][_0xa6f8('0x46')]({'where':{'id':_0xf1d592[_0xa6f8('0x40')]['id']}})[_0xa6f8('0x23')](handleEntityNotFound(_0x2386d6,null))[_0xa6f8('0x23')](removeEntity(_0x2386d6,null))['catch'](handleError(_0x2386d6,null));};exports['describe']=function(_0x276eb0,_0x5e4827){return db[_0xa6f8('0x2a')][_0xa6f8('0x47')]()['then'](respondWithResult(_0x5e4827,null))[_0xa6f8('0x43')](handleError(_0x5e4827,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 67736e5..9f3b797 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 _0xe65d=['utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','./chatOfflineMessage.attributes','define','chat_offline_messages','utf8mb4'];(function(_0x469abc,_0x21cef7){var _0x470488=function(_0x294940){while(--_0x294940){_0x469abc['push'](_0x469abc['shift']());}};_0x470488(++_0x21cef7);}(_0xe65d,0x1da));var _0xde65=function(_0x4cf7ce,_0x3eca18){_0x4cf7ce=_0x4cf7ce-0x0;var _0x477ae6=_0xe65d[_0x4cf7ce];return _0x477ae6;};'use strict';var _=require(_0xde65('0x0'));var util=require(_0xde65('0x1'));var logger=require('../../config/logger')(_0xde65('0x2'));var moment=require(_0xde65('0x3'));var BPromise=require(_0xde65('0x4'));var rp=require(_0xde65('0x5'));var attributes=require(_0xde65('0x6'));module['exports']=function(_0x5a3ac4,_0x4e77ee){return _0x5a3ac4[_0xde65('0x7')]('ChatOfflineMessage',attributes,{'tableName':_0xde65('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xde65('0x9'),'collate':_0xde65('0xa')});}; \ No newline at end of file +var _0x3076=['util','api','moment','bluebird','request-promise','exports','utf8mb4_unicode_ci'];(function(_0x2319a0,_0x551eab){var _0x3ba01e=function(_0xc1827d){while(--_0xc1827d){_0x2319a0['push'](_0x2319a0['shift']());}};_0x3ba01e(++_0x551eab);}(_0x3076,0xb6));var _0x6307=function(_0x54b82a,_0xa88a0b){_0x54b82a=_0x54b82a-0x0;var _0x20a5f2=_0x3076[_0x54b82a];return _0x20a5f2;};'use strict';var _=require('lodash');var util=require(_0x6307('0x0'));var logger=require('../../config/logger')(_0x6307('0x1'));var moment=require(_0x6307('0x2'));var BPromise=require(_0x6307('0x3'));var rp=require(_0x6307('0x4'));var attributes=require('./chatOfflineMessage.attributes');module[_0x6307('0x5')]=function(_0x5f101e,_0x174fd9){return _0x5f101e['define']('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6307('0x6')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 474afba..7941e59 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 _0x1ff5=['request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','client','http','request','then','info'];(function(_0x118411,_0xa991be){var _0xa9941=function(_0x542f85){while(--_0x542f85){_0x118411['push'](_0x118411['shift']());}};_0xa9941(++_0xa991be);}(_0x1ff5,0x86));var _0x51ff=function(_0x32b1e7,_0x24ca1a){_0x32b1e7=_0x32b1e7-0x0;var _0x1b7de2=_0x1ff5[_0x32b1e7];return _0x1b7de2;};'use strict';var _=require(_0x51ff('0x0'));var util=require(_0x51ff('0x1'));var moment=require(_0x51ff('0x2'));var BPromise=require(_0x51ff('0x3'));var rs=require(_0x51ff('0x4'));var fs=require('fs');var Redis=require(_0x51ff('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x51ff('0x6'));var logger=require('../../config/logger')(_0x51ff('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x51ff('0x8')][_0x51ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d9ba8,_0x4bc840,_0x48373d){return new BPromise(function(_0x18666b,_0x3be2d7){return client[_0x51ff('0xa')](_0x3d9ba8,_0x48373d)[_0x51ff('0xb')](function(_0x49fcdc){logger[_0x51ff('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x4bc840,_0x51ff('0xd'));logger[_0x51ff('0xe')](_0x51ff('0xf'),_0x4bc840,_0x51ff('0xd'),JSON[_0x51ff('0x10')](_0x49fcdc));if(_0x49fcdc[_0x51ff('0x11')]){if(_0x49fcdc[_0x51ff('0x11')]['code']===0x1f4){logger[_0x51ff('0x11')](_0x51ff('0x12'),_0x4bc840,_0x49fcdc[_0x51ff('0x11')]['message']);return _0x3be2d7(_0x49fcdc[_0x51ff('0x11')][_0x51ff('0x13')]);}logger['error'](_0x51ff('0x12'),_0x4bc840,_0x49fcdc[_0x51ff('0x11')][_0x51ff('0x13')]);return _0x18666b(_0x49fcdc[_0x51ff('0x11')]['message']);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x4bc840,_0x51ff('0xd'));_0x18666b(_0x49fcdc[_0x51ff('0x14')][_0x51ff('0x13')]);}})['catch'](function(_0x2f2e34){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x4bc840,_0x2f2e34);_0x3be2d7(_0x2f2e34);});});} \ No newline at end of file +var _0x3b84=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','debug','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring'];(function(_0x25c856,_0x426670){var _0x40480b=function(_0x2c60ae){while(--_0x2c60ae){_0x25c856['push'](_0x25c856['shift']());}};_0x40480b(++_0x426670);}(_0x3b84,0x1f4));var _0x43b8=function(_0x92e196,_0x553069){_0x92e196=_0x92e196-0x0;var _0x953af8=_0x3b84[_0x92e196];return _0x953af8;};'use strict';var _=require(_0x43b8('0x0'));var util=require('util');var moment=require(_0x43b8('0x1'));var BPromise=require(_0x43b8('0x2'));var rs=require(_0x43b8('0x3'));var fs=require('fs');var Redis=require(_0x43b8('0x4'));var db=require(_0x43b8('0x5'))['db'];var utils=require(_0x43b8('0x6'));var logger=require(_0x43b8('0x7'))(_0x43b8('0x8'));var config=require('../../config/environment');var jayson=require(_0x43b8('0x9'));var client=jayson[_0x43b8('0xa')][_0x43b8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x477eef,_0x385f36,_0x3a09d3){return new BPromise(function(_0x43c0ef,_0x4cb6be){return client[_0x43b8('0xc')](_0x477eef,_0x3a09d3)['then'](function(_0x5980a0){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x385f36,_0x43b8('0xd'));logger[_0x43b8('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x385f36,_0x43b8('0xd'),JSON['stringify'](_0x5980a0));if(_0x5980a0[_0x43b8('0xf')]){if(_0x5980a0['error'][_0x43b8('0x10')]===0x1f4){logger[_0x43b8('0xf')](_0x43b8('0x11'),_0x385f36,_0x5980a0[_0x43b8('0xf')]['message']);return _0x4cb6be(_0x5980a0[_0x43b8('0xf')][_0x43b8('0x12')]);}logger['error'](_0x43b8('0x11'),_0x385f36,_0x5980a0[_0x43b8('0xf')][_0x43b8('0x12')]);return _0x43c0ef(_0x5980a0[_0x43b8('0xf')][_0x43b8('0x12')]);}else{logger[_0x43b8('0x13')](_0x43b8('0x11'),_0x385f36,_0x43b8('0xd'));_0x43c0ef(_0x5980a0['result'][_0x43b8('0x12')]);}})[_0x43b8('0x14')](function(_0x2714f9){logger[_0x43b8('0xf')](_0x43b8('0x11'),_0x385f36,_0x2714f9);_0x4cb6be(_0x2714f9);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 5c1f1e0..9ed2a94 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 _0xe3ed=['../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3a731a,_0xc89d11){var _0x5ee15e=function(_0x4fda02){while(--_0x4fda02){_0x3a731a['push'](_0x3a731a['shift']());}};_0x5ee15e(++_0xc89d11);}(_0xe3ed,0x8d));var _0xde3e=function(_0x44e3e0,_0x13b4b0){_0x44e3e0=_0x44e3e0-0x0;var _0x68a959=_0xe3ed[_0x44e3e0];return _0x68a959;};'use strict';var multer=require(_0xde3e('0x0'));var util=require(_0xde3e('0x1'));var path=require(_0xde3e('0x2'));var timeout=require(_0xde3e('0x3'));var express=require(_0xde3e('0x4'));var router=express[_0xde3e('0x5')]();var auth=require(_0xde3e('0x6'));var interaction=require(_0xde3e('0x7'));var config=require('../../config/environment');var controller=require(_0xde3e('0x8'));router[_0xde3e('0x9')]('/',auth['isAuthenticated'](),controller[_0xde3e('0xa')]);router['get'](_0xde3e('0xb'),auth[_0xde3e('0xc')](),controller['describe']);router[_0xde3e('0x9')](_0xde3e('0xd'),auth[_0xde3e('0xc')](),controller[_0xde3e('0xe')]);router[_0xde3e('0xf')]('/',auth['isAuthenticated'](),controller[_0xde3e('0x10')]);router[_0xde3e('0x11')](_0xde3e('0xd'),auth[_0xde3e('0xc')](),controller['update']);router[_0xde3e('0x12')](_0xde3e('0xd'),auth['isAuthenticated'](),controller[_0xde3e('0x13')]);module[_0xde3e('0x14')]=router; \ No newline at end of file +var _0x402f=['path','Router','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','put','update','multer'];(function(_0x415d81,_0x96f84a){var _0x5ac9c7=function(_0x1f5f36){while(--_0x1f5f36){_0x415d81['push'](_0x415d81['shift']());}};_0x5ac9c7(++_0x96f84a);}(_0x402f,0x6f));var _0xf402=function(_0x179cfa,_0x5a9dc){_0x179cfa=_0x179cfa-0x0;var _0x2be985=_0x402f[_0x179cfa];return _0x2be985;};'use strict';var multer=require(_0xf402('0x0'));var util=require('util');var path=require(_0xf402('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf402('0x2')]();var auth=require(_0xf402('0x3'));var interaction=require(_0xf402('0x4'));var config=require('../../config/environment');var controller=require(_0xf402('0x5'));router['get']('/',auth[_0xf402('0x6')](),controller[_0xf402('0x7')]);router[_0xf402('0x8')](_0xf402('0x9'),auth[_0xf402('0x6')](),controller['describe']);router['get'](_0xf402('0xa'),auth[_0xf402('0x6')](),controller[_0xf402('0xb')]);router[_0xf402('0xc')]('/',auth[_0xf402('0x6')](),controller[_0xf402('0xd')]);router[_0xf402('0xe')](_0xf402('0xa'),auth['isAuthenticated'](),controller[_0xf402('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 569e6fb..8d55fbf 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 _0xd5fc=['mouseOver','timeout','STRING','INTEGER','sequelize'];(function(_0x26b4b6,_0x29b33b){var _0x16e838=function(_0x1efdc5){while(--_0x1efdc5){_0x26b4b6['push'](_0x26b4b6['shift']());}};_0x16e838(++_0x29b33b);}(_0xd5fc,0xae));var _0xcd5f=function(_0x4df582,_0x11dcc2){_0x4df582=_0x4df582-0x0;var _0x307451=_0xd5fc[_0x4df582];return _0x307451;};'use strict';var Sequelize=require(_0xcd5f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xcd5f('0x1'),_0xcd5f('0x2')),'defaultValue':_0xcd5f('0x1')},'selector':{'type':Sequelize[_0xcd5f('0x3')]},'timeout':{'type':Sequelize[_0xcd5f('0x4')]}}; \ No newline at end of file +var _0x6b36=['INTEGER','sequelize','exports','STRING','mouseOver','timeout'];(function(_0x70ba34,_0x15dde0){var _0x8dc19a=function(_0x471da9){while(--_0x471da9){_0x70ba34['push'](_0x70ba34['shift']());}};_0x8dc19a(++_0x15dde0);}(_0x6b36,0x1c9));var _0x66b3=function(_0x23fcc3,_0x3485f0){_0x23fcc3=_0x23fcc3-0x0;var _0x23411d=_0x6b36[_0x23fcc3];return _0x23411d;};'use strict';var Sequelize=require(_0x66b3('0x0'));module[_0x66b3('0x1')]={'name':{'type':Sequelize[_0x66b3('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x66b3('0x3'),_0x66b3('0x4')),'defaultValue':_0x66b3('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x66b3('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 2cbcee8..6d01ed9 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 _0x602c=['path','sox','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','keys','rawAttributes','query','filters','intersection','attributes','fields','length','model','includeAll','include','merge','options','ChatProactiveAction','find','then','catch','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util'];(function(_0x43ad18,_0x21f334){var _0x3bdc6a=function(_0x16fbd5){while(--_0x16fbd5){_0x43ad18['push'](_0x43ad18['shift']());}};_0x3bdc6a(++_0x21f334);}(_0x602c,0x11a));var _0xc602=function(_0x275f3a,_0x59f599){_0x275f3a=_0x275f3a-0x0;var _0xe3c45d=_0x602c[_0x275f3a];return _0xe3c45d;};'use strict';var pdf=require(_0xc602('0x0'));var emlformat=require(_0xc602('0x1'));var rimraf=require(_0xc602('0x2'));var zipdir=require(_0xc602('0x3'));var jsonpatch=require(_0xc602('0x4'));var rp=require(_0xc602('0x5'));var moment=require(_0xc602('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc602('0x7'));var path=require(_0xc602('0x8'));var sox=require(_0xc602('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc602('0xa'));var crypto=require(_0xc602('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc602('0xc'));var toCsv=require(_0xc602('0xd'));var querystring=require(_0xc602('0xe'));var Papa=require(_0xc602('0xf'));var authService=require(_0xc602('0x10'));var hardwareService=require(_0xc602('0x11'));var Redis=require(_0xc602('0x12'));var qs=require(_0xc602('0x13'));var logger=require('../../config/logger')(_0xc602('0x14'));var utils=require(_0xc602('0x15'));var config=require(_0xc602('0x16'));var db=require(_0xc602('0x17'))['db'];function respondWithStatusCode(_0x5ba5de,_0x2c70c3){_0x2c70c3=_0x2c70c3||0xcc;return function(_0x443f30){if(_0x443f30){return _0x5ba5de[_0xc602('0x18')](_0x2c70c3);}return _0x5ba5de[_0xc602('0x19')](_0x2c70c3)[_0xc602('0x1a')]();};}function respondWithResult(_0x476eb3,_0x4f1623){_0x4f1623=_0x4f1623||0xc8;return function(_0x416e3a){if(_0x416e3a){return _0x476eb3[_0xc602('0x19')](_0x4f1623)[_0xc602('0x1b')](_0x416e3a);}};}function respondWithFilteredResult(_0x219717,_0x204395){return function(_0x271cd4){if(_0x271cd4){var _0x29cbc2=_0x271cd4['count'],_0x2933e0=_0x204395['offset'],_0x19f685=_0x204395[_0xc602('0x1c')]+_0x204395['limit'],_0x1d0101;if(_0x19f685>=_0x29cbc2){_0x19f685=_0x29cbc2;_0x1d0101=0xc8;}else{_0x1d0101=0xce;}_0x219717[_0xc602('0x19')](_0x1d0101);return _0x219717[_0xc602('0x1d')](_0xc602('0x1e'),_0x2933e0+'-'+_0x19f685+'/'+_0x29cbc2)[_0xc602('0x1b')](_0x271cd4);}return null;};}function patchUpdates(_0x34cf15){return function(_0x294d2e){try{jsonpatch[_0xc602('0x1f')](_0x294d2e,_0x34cf15,!![]);}catch(_0x119213){return BPromise[_0xc602('0x20')](_0x119213);}return _0x294d2e[_0xc602('0x21')]();};}function saveUpdates(_0x26d54f,_0x6b5608){return function(_0xfaf6b5){if(_0xfaf6b5){return _0xfaf6b5['update'](_0x26d54f)['then'](function(_0xde9e31){return _0xde9e31;});}return null;};}function removeEntity(_0x1d7c06,_0x20d7d1){return function(_0x4b78ba){if(_0x4b78ba){return _0x4b78ba[_0xc602('0x22')]()['then'](function(){_0x1d7c06[_0xc602('0x19')](0xcc)[_0xc602('0x1a')]();});}};}function handleEntityNotFound(_0x5aac9d,_0x4d810b){return function(_0x3a4005){if(!_0x3a4005){_0x5aac9d['sendStatus'](0x194);}return _0x3a4005;};}function handleError(_0x330a10,_0x16fd5b){_0x16fd5b=_0x16fd5b||0x1f4;return function(_0x225397){logger['error'](_0x225397[_0xc602('0x23')]);if(_0x225397[_0xc602('0x24')]){delete _0x225397['name'];}_0x330a10['status'](_0x16fd5b)[_0xc602('0x25')](_0x225397);};}exports['show']=function(_0x2ad3ad,_0x463c34){var _0x43a40c={'raw':!![],'where':{'id':_0x2ad3ad['params']['id']}},_0x16f60={};_0x16f60['model']=_[_0xc602('0x26')](db['ChatProactiveAction'][_0xc602('0x27')]);_0x16f60[_0xc602('0x28')]=_[_0xc602('0x26')](_0x2ad3ad[_0xc602('0x28')]);_0x16f60[_0xc602('0x29')]=_[_0xc602('0x2a')](_0x16f60['model'],_0x16f60[_0xc602('0x28')]);_0x43a40c[_0xc602('0x2b')]=_[_0xc602('0x2a')](_0x16f60['model'],qs[_0xc602('0x2c')](_0x2ad3ad[_0xc602('0x28')][_0xc602('0x2c')]));_0x43a40c[_0xc602('0x2b')]=_0x43a40c[_0xc602('0x2b')][_0xc602('0x2d')]?_0x43a40c['attributes']:_0x16f60[_0xc602('0x2e')];if(_0x2ad3ad['query'][_0xc602('0x2f')]){_0x43a40c[_0xc602('0x30')]=[{'all':!![]}];}_0x43a40c=_[_0xc602('0x31')]({},_0x43a40c,_0x2ad3ad[_0xc602('0x32')]);return db[_0xc602('0x33')][_0xc602('0x34')](_0x43a40c)[_0xc602('0x35')](handleEntityNotFound(_0x463c34,null))[_0xc602('0x35')](respondWithResult(_0x463c34,null))[_0xc602('0x36')](handleError(_0x463c34,null));};exports[_0xc602('0x37')]=function(_0x3daa21,_0x16aacf){return db['ChatProactiveAction'][_0xc602('0x37')](_0x3daa21[_0xc602('0x38')],{})[_0xc602('0x35')](respondWithResult(_0x16aacf,0xc9))['catch'](handleError(_0x16aacf,null));};exports['update']=function(_0x1e2fba,_0x1c2c0e){if(_0x1e2fba[_0xc602('0x38')]['id']){delete _0x1e2fba[_0xc602('0x38')]['id'];}return db[_0xc602('0x33')][_0xc602('0x34')]({'where':{'id':_0x1e2fba['params']['id']}})[_0xc602('0x35')](handleEntityNotFound(_0x1c2c0e,null))[_0xc602('0x35')](saveUpdates(_0x1e2fba[_0xc602('0x38')],null))[_0xc602('0x35')](respondWithResult(_0x1c2c0e,null))[_0xc602('0x36')](handleError(_0x1c2c0e,null));};exports[_0xc602('0x22')]=function(_0x4b2d6e,_0x89491b){return db['ChatProactiveAction'][_0xc602('0x34')]({'where':{'id':_0x4b2d6e[_0xc602('0x39')]['id']}})['then'](handleEntityNotFound(_0x89491b,null))[_0xc602('0x35')](removeEntity(_0x89491b,null))[_0xc602('0x36')](handleError(_0x89491b,null));}; \ No newline at end of file +var _0x188d=['save','update','then','destroy','error','stack','name','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','merge','options','ChatProactiveAction','find','catch','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','api','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x4859e6,_0x210603){var _0x30a3e4=function(_0x747d0){while(--_0x747d0){_0x4859e6['push'](_0x4859e6['shift']());}};_0x30a3e4(++_0x210603);}(_0x188d,0x169));var _0xd188=function(_0x63500b,_0x508aa1){_0x63500b=_0x63500b-0x0;var _0x492332=_0x188d[_0x63500b];return _0x492332;};'use strict';var pdf=require(_0xd188('0x0'));var emlformat=require(_0xd188('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd188('0x2'));var jsonpatch=require(_0xd188('0x3'));var rp=require(_0xd188('0x4'));var moment=require(_0xd188('0x5'));var BPromise=require(_0xd188('0x6'));var Mustache=require(_0xd188('0x7'));var util=require('util');var path=require('path');var sox=require(_0xd188('0x8'));var csv=require('to-csv');var ejs=require(_0xd188('0x9'));var fs=require('fs');var _=require(_0xd188('0xa'));var squel=require('squel');var crypto=require(_0xd188('0xb'));var jsforce=require(_0xd188('0xc'));var deskjs=require(_0xd188('0xd'));var toCsv=require(_0xd188('0xe'));var querystring=require('querystring');var Papa=require(_0xd188('0xf'));var authService=require(_0xd188('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xd188('0x11'));var qs=require(_0xd188('0x12'));var logger=require('../../config/logger')(_0xd188('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xd188('0x14'))['db'];function respondWithStatusCode(_0xd23033,_0x53f20d){_0x53f20d=_0x53f20d||0xcc;return function(_0x5c1889){if(_0x5c1889){return _0xd23033['sendStatus'](_0x53f20d);}return _0xd23033['status'](_0x53f20d)[_0xd188('0x15')]();};}function respondWithResult(_0x202792,_0x4f9e93){_0x4f9e93=_0x4f9e93||0xc8;return function(_0x355b06){if(_0x355b06){return _0x202792[_0xd188('0x16')](_0x4f9e93)[_0xd188('0x17')](_0x355b06);}};}function respondWithFilteredResult(_0x2a7ed9,_0x4ed0f9){return function(_0x526af8){if(_0x526af8){var _0x50e48f=_0x526af8[_0xd188('0x18')],_0x304934=_0x4ed0f9[_0xd188('0x19')],_0xaef36=_0x4ed0f9[_0xd188('0x19')]+_0x4ed0f9[_0xd188('0x1a')],_0x41ee30;if(_0xaef36>=_0x50e48f){_0xaef36=_0x50e48f;_0x41ee30=0xc8;}else{_0x41ee30=0xce;}_0x2a7ed9[_0xd188('0x16')](_0x41ee30);return _0x2a7ed9[_0xd188('0x1b')](_0xd188('0x1c'),_0x304934+'-'+_0xaef36+'/'+_0x50e48f)[_0xd188('0x17')](_0x526af8);}return null;};}function patchUpdates(_0x41a1c3){return function(_0x3234c6){try{jsonpatch[_0xd188('0x1d')](_0x3234c6,_0x41a1c3,!![]);}catch(_0x419e0a){return BPromise[_0xd188('0x1e')](_0x419e0a);}return _0x3234c6[_0xd188('0x1f')]();};}function saveUpdates(_0x5d287b,_0x36da3b){return function(_0x4837a1){if(_0x4837a1){return _0x4837a1[_0xd188('0x20')](_0x5d287b)[_0xd188('0x21')](function(_0x4bed55){return _0x4bed55;});}return null;};}function removeEntity(_0x5f57ff,_0x501333){return function(_0x5b2297){if(_0x5b2297){return _0x5b2297[_0xd188('0x22')]()[_0xd188('0x21')](function(){_0x5f57ff[_0xd188('0x16')](0xcc)[_0xd188('0x15')]();});}};}function handleEntityNotFound(_0x4917df,_0xc8a668){return function(_0x8877ac){if(!_0x8877ac){_0x4917df['sendStatus'](0x194);}return _0x8877ac;};}function handleError(_0x32941a,_0x2f61bd){_0x2f61bd=_0x2f61bd||0x1f4;return function(_0xf129b2){logger[_0xd188('0x23')](_0xf129b2[_0xd188('0x24')]);if(_0xf129b2[_0xd188('0x25')]){delete _0xf129b2['name'];}_0x32941a[_0xd188('0x16')](_0x2f61bd)['send'](_0xf129b2);};}exports[_0xd188('0x26')]=function(_0x4dfd44,_0x331b97){var _0x5b7033={'raw':!![],'where':{'id':_0x4dfd44[_0xd188('0x27')]['id']}},_0x274425={};_0x274425[_0xd188('0x28')]=_[_0xd188('0x29')](db['ChatProactiveAction']['rawAttributes']);_0x274425['query']=_[_0xd188('0x29')](_0x4dfd44[_0xd188('0x2a')]);_0x274425[_0xd188('0x2b')]=_[_0xd188('0x2c')](_0x274425['model'],_0x274425[_0xd188('0x2a')]);_0x5b7033[_0xd188('0x2d')]=_[_0xd188('0x2c')](_0x274425[_0xd188('0x28')],qs[_0xd188('0x2e')](_0x4dfd44[_0xd188('0x2a')][_0xd188('0x2e')]));_0x5b7033[_0xd188('0x2d')]=_0x5b7033[_0xd188('0x2d')][_0xd188('0x2f')]?_0x5b7033[_0xd188('0x2d')]:_0x274425[_0xd188('0x28')];if(_0x4dfd44['query'][_0xd188('0x30')]){_0x5b7033['include']=[{'all':!![]}];}_0x5b7033=_[_0xd188('0x31')]({},_0x5b7033,_0x4dfd44[_0xd188('0x32')]);return db[_0xd188('0x33')][_0xd188('0x34')](_0x5b7033)[_0xd188('0x21')](handleEntityNotFound(_0x331b97,null))['then'](respondWithResult(_0x331b97,null))[_0xd188('0x35')](handleError(_0x331b97,null));};exports[_0xd188('0x36')]=function(_0x3fb306,_0x5d1cb8){return db[_0xd188('0x33')]['create'](_0x3fb306['body'],{})[_0xd188('0x21')](respondWithResult(_0x5d1cb8,0xc9))[_0xd188('0x35')](handleError(_0x5d1cb8,null));};exports['update']=function(_0x27e3cd,_0x287721){if(_0x27e3cd[_0xd188('0x37')]['id']){delete _0x27e3cd[_0xd188('0x37')]['id'];}return db['ChatProactiveAction'][_0xd188('0x34')]({'where':{'id':_0x27e3cd[_0xd188('0x27')]['id']}})[_0xd188('0x21')](handleEntityNotFound(_0x287721,null))[_0xd188('0x21')](saveUpdates(_0x27e3cd['body'],null))[_0xd188('0x21')](respondWithResult(_0x287721,null))[_0xd188('0x35')](handleError(_0x287721,null));};exports['destroy']=function(_0x495952,_0x4ae35c){return db[_0xd188('0x33')]['find']({'where':{'id':_0x495952[_0xd188('0x27')]['id']}})['then'](handleEntityNotFound(_0x4ae35c,null))['then'](removeEntity(_0x4ae35c,null))['catch'](handleError(_0x4ae35c,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index c4da5b9..671df31 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 _0x5f2f=['request-promise','./chatProactiveAction.attributes','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4dccbf,_0x50ac20){var _0x23011a=function(_0x414862){while(--_0x414862){_0x4dccbf['push'](_0x4dccbf['shift']());}};_0x23011a(++_0x50ac20);}(_0x5f2f,0x73));var _0xf5f2=function(_0x39124e,_0x15f4bf){_0x39124e=_0x39124e-0x0;var _0x1ad849=_0x5f2f[_0x39124e];return _0x1ad849;};'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':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8603=['util','../../config/logger','api','request-promise','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions'];(function(_0x118334,_0x3aebc7){var _0x3f7a15=function(_0xfad8f5){while(--_0xfad8f5){_0x118334['push'](_0x118334['shift']());}};_0x3f7a15(++_0x3aebc7);}(_0x8603,0x190));var _0x3860=function(_0xd4e38e,_0x14b9c6){_0xd4e38e=_0xd4e38e-0x0;var _0x2a96be=_0x8603[_0xd4e38e];return _0x2a96be;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var logger=require(_0x3860('0x1'))(_0x3860('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3860('0x3'));var attributes=require(_0x3860('0x4'));module[_0x3860('0x5')]=function(_0x490262,_0x2fc97a){return _0x490262['define'](_0x3860('0x6'),attributes,{'tableName':_0x3860('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 df96f33..8ab6210 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 _0xa9e0=['http','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x334bb9,_0x73ced4){var _0x54d425=function(_0x484452){while(--_0x484452){_0x334bb9['push'](_0x334bb9['shift']());}};_0x54d425(++_0x73ced4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x53ef5c,_0x26e77f){var _0x44094e=function(_0x4f3e25){while(--_0x4f3e25){_0x53ef5c['push'](_0x53ef5c['shift']());}};_0x44094e(++_0x26e77f);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 1811708..8eecb27 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 _0x9805=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','isAuthenticated','show','post','create','put','/:id','update','delete','multer'];(function(_0x4050ab,_0xca3177){var _0x356427=function(_0x1748a6){while(--_0x1748a6){_0x4050ab['push'](_0x4050ab['shift']());}};_0x356427(++_0xca3177);}(_0x9805,0x18f));var _0x5980=function(_0x39665a,_0xc729df){_0x39665a=_0x39665a-0x0;var _0x173185=_0x9805[_0x39665a];return _0x173185;};'use strict';var multer=require(_0x5980('0x0'));var util=require(_0x5980('0x1'));var path=require(_0x5980('0x2'));var timeout=require(_0x5980('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x5980('0x4'));var interaction=require(_0x5980('0x5'));var config=require(_0x5980('0x6'));var controller=require(_0x5980('0x7'));router['get']('/:id',auth[_0x5980('0x8')](),controller[_0x5980('0x9')]);router[_0x5980('0xa')]('/',auth[_0x5980('0x8')](),controller[_0x5980('0xb')]);router[_0x5980('0xc')](_0x5980('0xd'),auth[_0x5980('0x8')](),controller[_0x5980('0xe')]);router[_0x5980('0xf')](_0x5980('0xd'),auth[_0x5980('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe9e8=['post','put','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','get','isAuthenticated','show'];(function(_0x2e1c24,_0x52fce3){var _0x7a94a1=function(_0x133b87){while(--_0x133b87){_0x2e1c24['push'](_0x2e1c24['shift']());}};_0x7a94a1(++_0x52fce3);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x364a31,_0x2c1171){_0x364a31=_0x364a31-0x0;var _0x48f928=_0xe9e8[_0x364a31];return _0x48f928;};'use strict';var multer=require(_0x8e9e('0x0'));var util=require(_0x8e9e('0x1'));var path=require(_0x8e9e('0x2'));var timeout=require(_0x8e9e('0x3'));var express=require(_0x8e9e('0x4'));var router=express[_0x8e9e('0x5')]();var auth=require(_0x8e9e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8e9e('0x7'));var controller=require(_0x8e9e('0x8'));router[_0x8e9e('0x9')]('/:id',auth[_0x8e9e('0xa')](),controller[_0x8e9e('0xb')]);router[_0x8e9e('0xc')]('/',auth[_0x8e9e('0xa')](),controller['create']);router[_0x8e9e('0xd')](_0x8e9e('0xe'),auth[_0x8e9e('0xa')](),controller['update']);router[_0x8e9e('0xf')](_0x8e9e('0xe'),auth[_0x8e9e('0xa')](),controller['destroy']);module[_0x8e9e('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 327d8be..a3f0c6e 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 _0x17d1=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0xffddd,_0xd7dc18){var _0x3d580b=function(_0x3b0236){while(--_0x3b0236){_0xffddd['push'](_0xffddd['shift']());}};_0x3d580b(++_0xd7dc18);}(_0x17d1,0x125));var _0x117d=function(_0x44aa8a,_0x3a89bb){_0x44aa8a=_0x44aa8a-0x0;var _0x2c61c1=_0x17d1[_0x44aa8a];return _0x2c61c1;};'use strict';var Sequelize=require(_0x117d('0x0'));module['exports']={'name':{'type':Sequelize[_0x117d('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x117d('0x1')]},'timeout':{'type':Sequelize[_0x117d('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x117d('0x3')](_0x117d('0x4'),_0x117d('0x5'),_0x117d('0x6'))}}; \ No newline at end of file +var _0x83ac=['beepall','roundrobin','sequelize','STRING','INTEGER','ENUM','rrmemory'];(function(_0x393d69,_0x3a8c83){var _0x3cee37=function(_0x462682){while(--_0x462682){_0x393d69['push'](_0x393d69['shift']());}};_0x3cee37(++_0x3a8c83);}(_0x83ac,0xbf));var _0xc83a=function(_0x2d7766,_0x2e63fb){_0x2d7766=_0x2d7766-0x0;var _0x135f56=_0x83ac[_0x2d7766];return _0x135f56;};'use strict';var Sequelize=require(_0xc83a('0x0'));module['exports']={'name':{'type':Sequelize[_0xc83a('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc83a('0x1')]},'timeout':{'type':Sequelize[_0xc83a('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc83a('0x3')](_0xc83a('0x4'),_0xc83a('0x5'),_0xc83a('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 7fd3229..cd7a58a 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 _0x2bcf=['message','result','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','ChatQueues','UserProfileResource','stack','name','send','ChatQueue','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','limit','sort','where','filters','pick','filter','merge','type','key','field','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','order','ChatQueueId','User','findAndCountAll','map','UserId','chatPause','updatedAt','format','%s/%s','createdAt','Team','getTeams','addTeams','ids','Agents','union','removeTeams','removeAgents','addAgents','omit','spread','emit','userChatQueue:save','isArray','userChatQueue:remove','getAgents','nolimit','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x59d2a3,_0x4e8480){var _0x3aa0de=function(_0x28ef61){while(--_0x28ef61){_0x59d2a3['push'](_0x59d2a3['shift']());}};_0x3aa0de(++_0x4e8480);}(_0x2bcf,0x159));var _0xf2bc=function(_0x358f87,_0x5a4d20){_0x358f87=_0x358f87-0x0;var _0x4b2fdb=_0x2bcf[_0x358f87];return _0x4b2fdb;};'use strict';var pdf=require(_0xf2bc('0x0'));var emlformat=require(_0xf2bc('0x1'));var rimraf=require(_0xf2bc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf2bc('0x3'));var rp=require(_0xf2bc('0x4'));var moment=require(_0xf2bc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf2bc('0x6'));var util=require(_0xf2bc('0x7'));var path=require(_0xf2bc('0x8'));var sox=require(_0xf2bc('0x9'));var csv=require(_0xf2bc('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf2bc('0xb'));var crypto=require(_0xf2bc('0xc'));var jsforce=require(_0xf2bc('0xd'));var deskjs=require(_0xf2bc('0xe'));var toCsv=require(_0xf2bc('0xa'));var querystring=require(_0xf2bc('0xf'));var Papa=require(_0xf2bc('0x10'));var authService=require(_0xf2bc('0x11'));var hardwareService=require(_0xf2bc('0x12'));var Redis=require(_0xf2bc('0x13'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0xf2bc('0x14'));var config=require(_0xf2bc('0x15'));var db=require('../../mysqldb')['db'];config[_0xf2bc('0x16')]=_[_0xf2bc('0x17')](config[_0xf2bc('0x16')],{'host':_0xf2bc('0x18'),'port':0x18eb});var socket=require(_0xf2bc('0x19'))(new Redis(config[_0xf2bc('0x16')]));require(_0xf2bc('0x1a'))[_0xf2bc('0x1b')](socket);var jayson=require(_0xf2bc('0x1c'));var client=jayson[_0xf2bc('0x1d')][_0xf2bc('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x598d87,_0x1d012f,_0x2ae1fe,_0x1acdb8){return new BPromise(function(_0x176093,_0x3ee1bf){var _0x2c6690=_0x1acdb8||client;return _0x2c6690[_0xf2bc('0x1f')](_0x598d87,_0x2ae1fe)[_0xf2bc('0x20')](function(_0xba8f72){logger[_0xf2bc('0x21')](_0xf2bc('0x22'),_0x1d012f,_0xf2bc('0x23'));logger[_0xf2bc('0x24')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x1d012f,_0xf2bc('0x23'),JSON['stringify'](_0xba8f72));if(_0xba8f72[_0xf2bc('0x25')]){if(_0xba8f72[_0xf2bc('0x25')][_0xf2bc('0x26')]===0x1f4){logger[_0xf2bc('0x25')](_0xf2bc('0x22'),_0x1d012f,_0xba8f72['error'][_0xf2bc('0x27')]);return _0x3ee1bf(_0xba8f72[_0xf2bc('0x25')][_0xf2bc('0x27')]);}logger['error'](_0xf2bc('0x22'),_0x1d012f,_0xba8f72['error'][_0xf2bc('0x27')]);return _0x176093(_0xba8f72[_0xf2bc('0x25')]['message']);}else{logger[_0xf2bc('0x21')](_0xf2bc('0x22'),_0x1d012f,_0xf2bc('0x23'));_0x176093(_0xba8f72[_0xf2bc('0x28')][_0xf2bc('0x27')]);}})['catch'](function(_0x1a47ad){logger[_0xf2bc('0x25')](_0xf2bc('0x22'),_0x1d012f,_0x1a47ad);_0x3ee1bf(_0x1a47ad);});});}function respondWithStatusCode(_0x298cb3,_0x1eff36){_0x1eff36=_0x1eff36||0xcc;return function(_0x1a5ff9){if(_0x1a5ff9){return _0x298cb3[_0xf2bc('0x29')](_0x1eff36);}return _0x298cb3[_0xf2bc('0x2a')](_0x1eff36)[_0xf2bc('0x2b')]();};}function respondWithResult(_0xd28632,_0x310450){_0x310450=_0x310450||0xc8;return function(_0x533bf2){if(_0x533bf2){return _0xd28632['status'](_0x310450)[_0xf2bc('0x2c')](_0x533bf2);}};}function respondWithFilteredResult(_0x51943b,_0x5b05ea){return function(_0x2796f8){if(_0x2796f8){var _0x261647=_0x2796f8[_0xf2bc('0x2d')],_0x160dc3=_0x5b05ea[_0xf2bc('0x2e')],_0xa0540e=_0x5b05ea[_0xf2bc('0x2e')]+_0x5b05ea['limit'],_0x101dc7;if(_0xa0540e>=_0x261647){_0xa0540e=_0x261647;_0x101dc7=0xc8;}else{_0x101dc7=0xce;}_0x51943b[_0xf2bc('0x2a')](_0x101dc7);return _0x51943b[_0xf2bc('0x2f')](_0xf2bc('0x30'),_0x160dc3+'-'+_0xa0540e+'/'+_0x261647)[_0xf2bc('0x2c')](_0x2796f8);}return null;};}function patchUpdates(_0x269596){return function(_0x3ee9a9){try{jsonpatch['apply'](_0x3ee9a9,_0x269596,!![]);}catch(_0x253997){return BPromise[_0xf2bc('0x31')](_0x253997);}return _0x3ee9a9[_0xf2bc('0x32')]();};}function saveUpdates(_0x4effbb,_0x43ff0a){return function(_0x24829c){if(_0x24829c){return _0x24829c[_0xf2bc('0x33')](_0x4effbb)[_0xf2bc('0x20')](function(_0x52a294){return _0x52a294;});}return null;};}function removeEntity(_0x15e27c,_0x523bfb){return function(_0x5d2cb6){if(_0x5d2cb6){return _0x5d2cb6[_0xf2bc('0x34')]()[_0xf2bc('0x20')](function(){var _0x1de010=_0x5d2cb6['get']({'plain':!![]});var _0x11b1cf=_0xf2bc('0x35');return db[_0xf2bc('0x36')][_0xf2bc('0x34')]({'where':{'type':_0x11b1cf,'resourceId':_0x1de010['id']}})[_0xf2bc('0x20')](function(){return _0x5d2cb6;});})[_0xf2bc('0x20')](function(){_0x15e27c[_0xf2bc('0x2a')](0xcc)[_0xf2bc('0x2b')]();});}};}function handleEntityNotFound(_0x566f1c,_0x24816c){return function(_0x44d798){if(!_0x44d798){_0x566f1c[_0xf2bc('0x29')](0x194);}return _0x44d798;};}function handleError(_0x2449c6,_0x43fa25){_0x43fa25=_0x43fa25||0x1f4;return function(_0x55aaec){logger[_0xf2bc('0x25')](_0x55aaec[_0xf2bc('0x37')]);if(_0x55aaec[_0xf2bc('0x38')]){delete _0x55aaec[_0xf2bc('0x38')];}_0x2449c6[_0xf2bc('0x2a')](_0x43fa25)[_0xf2bc('0x39')](_0x55aaec);};}exports['index']=function(_0x8b06a2,_0x335571){var _0x496249={},_0xedbbca={},_0x4a9f5a={'count':0x0,'rows':[]};var _0x410b66=db[_0xf2bc('0x3a')]['rawAttributes'];_0xedbbca['model']=_['keys'](_0x410b66);_0xedbbca[_0xf2bc('0x3b')]=_[_0xf2bc('0x3c')](_0x8b06a2[_0xf2bc('0x3b')]);_0xedbbca['filters']=_[_0xf2bc('0x3d')](_0xedbbca['model'],_0xedbbca[_0xf2bc('0x3b')]);_0x496249[_0xf2bc('0x3e')]=_[_0xf2bc('0x3d')](_0xedbbca[_0xf2bc('0x3f')],qs[_0xf2bc('0x40')](_0x8b06a2['query'][_0xf2bc('0x40')]));_0x496249[_0xf2bc('0x3e')]=_0x496249[_0xf2bc('0x3e')][_0xf2bc('0x41')]?_0x496249[_0xf2bc('0x3e')]:_0xedbbca[_0xf2bc('0x3f')];if(!_0x8b06a2['query'][_0xf2bc('0x42')]('nolimit')){_0x496249['limit']=qs['limit'](_0x8b06a2[_0xf2bc('0x3b')][_0xf2bc('0x43')]);_0x496249['offset']=qs['offset'](_0x8b06a2[_0xf2bc('0x3b')][_0xf2bc('0x2e')]);}_0x496249['order']=qs[_0xf2bc('0x44')](_0x8b06a2[_0xf2bc('0x3b')]['sort']);_0x496249[_0xf2bc('0x45')]=qs[_0xf2bc('0x46')](_[_0xf2bc('0x47')](_0x8b06a2[_0xf2bc('0x3b')],_0xedbbca['filters']));if(_0x8b06a2[_0xf2bc('0x3b')][_0xf2bc('0x48')]){_0x496249['where']=_[_0xf2bc('0x49')](_0x496249[_0xf2bc('0x45')],{'$or':_['map'](_0x410b66,function(_0x239ab4){if(_0x239ab4[_0xf2bc('0x4a')][_0xf2bc('0x4b')]!=='VIRTUAL'){var _0x1cd22a={};_0x1cd22a[_0x239ab4[_0xf2bc('0x4c')]]={'$like':'%'+_0x8b06a2['query'][_0xf2bc('0x48')]+'%'};return _0x1cd22a;}})});}_0x496249=_[_0xf2bc('0x49')]({},_0x496249,_0x8b06a2[_0xf2bc('0x4d')]);var _0x37ad72={'where':_0x496249[_0xf2bc('0x45')]};return db[_0xf2bc('0x3a')][_0xf2bc('0x2d')](_0x37ad72)[_0xf2bc('0x20')](function(_0x5df7da){_0x4a9f5a[_0xf2bc('0x2d')]=_0x5df7da;if(_0x8b06a2[_0xf2bc('0x3b')][_0xf2bc('0x4e')]){_0x496249[_0xf2bc('0x4f')]=[{'all':!![]}];}return db[_0xf2bc('0x3a')][_0xf2bc('0x50')](_0x496249);})[_0xf2bc('0x20')](function(_0xe7b4e7){_0x4a9f5a[_0xf2bc('0x51')]=_0xe7b4e7;return _0x4a9f5a;})[_0xf2bc('0x20')](respondWithFilteredResult(_0x335571,_0x496249))[_0xf2bc('0x52')](handleError(_0x335571,null));};exports['show']=function(_0x77643d,_0x4c8c5e){var _0x230f14={'raw':!![],'where':{'id':_0x77643d[_0xf2bc('0x53')]['id']}},_0xabc1bc={};_0xabc1bc[_0xf2bc('0x3f')]=_[_0xf2bc('0x3c')](db[_0xf2bc('0x3a')][_0xf2bc('0x54')]);_0xabc1bc[_0xf2bc('0x3b')]=_[_0xf2bc('0x3c')](_0x77643d['query']);_0xabc1bc['filters']=_[_0xf2bc('0x3d')](_0xabc1bc['model'],_0xabc1bc['query']);_0x230f14[_0xf2bc('0x3e')]=_[_0xf2bc('0x3d')](_0xabc1bc[_0xf2bc('0x3f')],qs['fields'](_0x77643d['query'][_0xf2bc('0x40')]));_0x230f14[_0xf2bc('0x3e')]=_0x230f14[_0xf2bc('0x3e')][_0xf2bc('0x41')]?_0x230f14[_0xf2bc('0x3e')]:_0xabc1bc[_0xf2bc('0x3f')];if(_0x77643d[_0xf2bc('0x3b')][_0xf2bc('0x4e')]){_0x230f14[_0xf2bc('0x4f')]=[{'all':!![]}];}_0x230f14=_[_0xf2bc('0x49')]({},_0x230f14,_0x77643d[_0xf2bc('0x4d')]);return db[_0xf2bc('0x3a')][_0xf2bc('0x55')](_0x230f14)[_0xf2bc('0x20')](handleEntityNotFound(_0x4c8c5e,null))[_0xf2bc('0x20')](respondWithResult(_0x4c8c5e,null))['catch'](handleError(_0x4c8c5e,null));};exports['create']=function(_0x193ac4,_0x45ddc4){return db[_0xf2bc('0x3a')][_0xf2bc('0x56')](_0x193ac4[_0xf2bc('0x57')],{})[_0xf2bc('0x20')](function(_0x277d66){var _0x5f563e=_0x193ac4['user'][_0xf2bc('0x58')]({'plain':!![]});if(!_0x5f563e)throw new Error(_0xf2bc('0x59'));if(_0x5f563e[_0xf2bc('0x5a')]===_0xf2bc('0x5b')){var _0x218a40=_0x277d66[_0xf2bc('0x58')]({'plain':!![]});var _0x2214e2=_0xf2bc('0x35');return db[_0xf2bc('0x5c')]['find']({'where':{'name':_0x2214e2,'userProfileId':_0x5f563e[_0xf2bc('0x5d')]},'raw':!![]})[_0xf2bc('0x20')](function(_0x42dc83){if(_0x42dc83&&_0x42dc83[_0xf2bc('0x5e')]===0x0){return db[_0xf2bc('0x36')]['create']({'name':_0x218a40['name'],'resourceId':_0x218a40['id'],'type':_0x42dc83[_0xf2bc('0x38')],'sectionId':_0x42dc83['id']},{})[_0xf2bc('0x20')](function(){return _0x277d66;});}else{return _0x277d66;}})[_0xf2bc('0x52')](function(_0x55fe2a){logger[_0xf2bc('0x25')](_0xf2bc('0x5f'),_0x55fe2a);throw _0x55fe2a;});}return _0x277d66;})[_0xf2bc('0x20')](respondWithResult(_0x45ddc4,0xc9))['catch'](handleError(_0x45ddc4,null));};exports[_0xf2bc('0x33')]=function(_0x1860b2,_0x5ee02e){if(_0x1860b2['body']['id']){delete _0x1860b2[_0xf2bc('0x57')]['id'];}return db[_0xf2bc('0x3a')][_0xf2bc('0x55')]({'where':{'id':_0x1860b2[_0xf2bc('0x53')]['id']}})[_0xf2bc('0x20')](handleEntityNotFound(_0x5ee02e,null))[_0xf2bc('0x20')](saveUpdates(_0x1860b2[_0xf2bc('0x57')],null))[_0xf2bc('0x20')](respondWithResult(_0x5ee02e,null))[_0xf2bc('0x52')](handleError(_0x5ee02e,null));};exports[_0xf2bc('0x34')]=function(_0x24b02d,_0x246158){return db[_0xf2bc('0x3a')][_0xf2bc('0x55')]({'where':{'id':_0x24b02d[_0xf2bc('0x53')]['id']}})[_0xf2bc('0x20')](handleEntityNotFound(_0x246158,null))[_0xf2bc('0x20')](removeEntity(_0x246158,null))[_0xf2bc('0x52')](handleError(_0x246158,null));};exports[_0xf2bc('0x60')]=function(_0x35c122,_0x3489ac){return db['ChatQueue'][_0xf2bc('0x60')]()[_0xf2bc('0x20')](respondWithResult(_0x3489ac,null))[_0xf2bc('0x52')](handleError(_0x3489ac,null));};exports[_0xf2bc('0x61')]=function(_0x46cb3d,_0x1af78a,_0xf04a93){var _0x45a6e6={'raw':!![],'where':{}},_0x57df53={},_0x3336e5;return db[_0xf2bc('0x3a')][_0xf2bc('0x62')]({'where':{'id':_0x46cb3d['params']['id']}})['then'](handleEntityNotFound(_0x1af78a,null))[_0xf2bc('0x20')](function(_0x515c7){if(_0x515c7){_0x3336e5=_0x515c7[_0xf2bc('0x58')]({'plain':!![]});_0x57df53[_0xf2bc('0x3f')]=_[_0xf2bc('0x3c')](db[_0xf2bc('0x63')][_0xf2bc('0x54')]);_0x57df53[_0xf2bc('0x3b')]=_['keys'](_0x46cb3d[_0xf2bc('0x3b')]);_0x57df53[_0xf2bc('0x46')]=_[_0xf2bc('0x3d')](_0x57df53['model'],_0x57df53[_0xf2bc('0x3b')]);_0x45a6e6['attributes']=_[_0xf2bc('0x3d')](_0x57df53[_0xf2bc('0x3f')],qs[_0xf2bc('0x40')](_0x46cb3d[_0xf2bc('0x3b')][_0xf2bc('0x40')]));_0x45a6e6[_0xf2bc('0x3e')]=_0x45a6e6[_0xf2bc('0x3e')][_0xf2bc('0x41')]?_0x45a6e6[_0xf2bc('0x3e')]:_0x57df53[_0xf2bc('0x3f')];if(!_0x46cb3d['query']['hasOwnProperty']('nolimit')){_0x45a6e6[_0xf2bc('0x43')]=qs['limit'](_0x46cb3d['query'][_0xf2bc('0x43')]);_0x45a6e6[_0xf2bc('0x2e')]=qs[_0xf2bc('0x2e')](_0x46cb3d[_0xf2bc('0x3b')][_0xf2bc('0x2e')]);}_0x45a6e6[_0xf2bc('0x64')]=qs[_0xf2bc('0x44')](_0x46cb3d[_0xf2bc('0x3b')][_0xf2bc('0x44')]);_0x45a6e6[_0xf2bc('0x45')]=qs[_0xf2bc('0x46')](_[_0xf2bc('0x47')](_0x46cb3d['query'],_0x57df53['filters']));_0x45a6e6[_0xf2bc('0x45')][_0xf2bc('0x65')]=_0x515c7['id'];if(_0x46cb3d[_0xf2bc('0x3b')]['filter']){_0x45a6e6[_0xf2bc('0x45')]=_[_0xf2bc('0x49')](_0x45a6e6['where'],{'$or':_['map'](_0x45a6e6['attributes'],function(_0xe70ba7){var _0x39185c={};_0x39185c[_0xe70ba7]={'$like':'%'+_0x46cb3d['query'][_0xf2bc('0x48')]+'%'};return _0x39185c;})});}_0x45a6e6=_['merge']({},_0x45a6e6,_0x46cb3d[_0xf2bc('0x4d')]);return db[_0xf2bc('0x63')][_0xf2bc('0x50')](_0x45a6e6);}})['then'](function(_0xa31c2a){if(_0xa31c2a){return db[_0xf2bc('0x66')][_0xf2bc('0x67')]({'where':{'id':_[_0xf2bc('0x68')](_0xa31c2a,_0xf2bc('0x69')),'role':'agent'},'attributes':['id','name',_0xf2bc('0x6a'),_0xf2bc('0x6b'),'createdAt']});}})['then'](function(_0x529e9e){if(_0x529e9e){return{'count':_0x529e9e['count'],'rows':_['map'](_0x529e9e[_0xf2bc('0x51')],function(_0x1c9ed8){return{'membername':_0x1c9ed8[_0xf2bc('0x38')],'UserId':_0x1c9ed8['id'],'queue_name':_0x3336e5['name'],'ChatQueueId':_0x3336e5['id'],'interface':util[_0xf2bc('0x6c')](_0xf2bc('0x6d'),'SIP',_0x1c9ed8[_0xf2bc('0x38')]),'penalty':0x0,'paused':_0x1c9ed8[_0xf2bc('0x6a')],'createdAt':_0x1c9ed8[_0xf2bc('0x6e')],'updatedAt':_0x1c9ed8['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xf2bc('0x20')](respondWithFilteredResult(_0x1af78a,_0x45a6e6))['catch'](handleError(_0x1af78a,null));};exports['getTeams']=function(_0x3f4f64,_0x258fc0,_0xe0dea6){var _0x287729={};var _0x4367c4={};var _0x2fce91;var _0x4934b6;return db[_0xf2bc('0x3a')][_0xf2bc('0x62')]({'where':{'id':_0x3f4f64[_0xf2bc('0x53')]['id']}})[_0xf2bc('0x20')](handleEntityNotFound(_0x258fc0,null))[_0xf2bc('0x20')](function(_0x2c9262){if(_0x2c9262){_0x2fce91=_0x2c9262;_0x4367c4[_0xf2bc('0x3f')]=_[_0xf2bc('0x3c')](db[_0xf2bc('0x6f')][_0xf2bc('0x54')]);_0x4367c4[_0xf2bc('0x3b')]=_[_0xf2bc('0x3c')](_0x3f4f64['query']);_0x4367c4[_0xf2bc('0x46')]=_[_0xf2bc('0x3d')](_0x4367c4[_0xf2bc('0x3f')],_0x4367c4['query']);_0x287729[_0xf2bc('0x3e')]=_[_0xf2bc('0x3d')](_0x4367c4['model'],qs[_0xf2bc('0x40')](_0x3f4f64[_0xf2bc('0x3b')][_0xf2bc('0x40')]));_0x287729[_0xf2bc('0x3e')]=_0x287729['attributes'][_0xf2bc('0x41')]?_0x287729[_0xf2bc('0x3e')]:_0x4367c4[_0xf2bc('0x3f')];_0x287729['order']=qs[_0xf2bc('0x44')](_0x3f4f64[_0xf2bc('0x3b')]['sort']);_0x287729['where']=qs[_0xf2bc('0x46')](_[_0xf2bc('0x47')](_0x3f4f64[_0xf2bc('0x3b')],_0x4367c4[_0xf2bc('0x46')]));if(_0x3f4f64[_0xf2bc('0x3b')][_0xf2bc('0x48')]){_0x287729[_0xf2bc('0x45')]=_[_0xf2bc('0x49')](_0x287729[_0xf2bc('0x45')],{'$or':_[_0xf2bc('0x68')](_0x287729[_0xf2bc('0x3e')],function(_0x5be36c){var _0x97e503={};_0x97e503[_0x5be36c]={'$like':'%'+_0x3f4f64[_0xf2bc('0x3b')][_0xf2bc('0x48')]+'%'};return _0x97e503;})});}_0x287729=_['merge']({},_0x287729,_0x3f4f64[_0xf2bc('0x4d')]);return _0x2fce91[_0xf2bc('0x70')](_0x287729);}})[_0xf2bc('0x20')](function(_0x198e2a){if(_0x198e2a){_0x4934b6=_0x198e2a['length'];if(!_0x3f4f64[_0xf2bc('0x3b')]['hasOwnProperty']('nolimit')){_0x287729[_0xf2bc('0x43')]=qs[_0xf2bc('0x43')](_0x3f4f64[_0xf2bc('0x3b')][_0xf2bc('0x43')]);_0x287729[_0xf2bc('0x2e')]=qs['offset'](_0x3f4f64['query'][_0xf2bc('0x2e')]);}return _0x2fce91[_0xf2bc('0x70')](_0x287729);}})['then'](function(_0x18e85a){if(_0x18e85a){return _0x18e85a?{'count':_0x4934b6,'rows':_0x18e85a}:null;}})[_0xf2bc('0x20')](respondWithResult(_0x258fc0,null))[_0xf2bc('0x52')](handleError(_0x258fc0,null));};exports[_0xf2bc('0x71')]=function(_0x16913e,_0x5e7c99,_0x2d3bdb){var _0x44ff99=[];var _0x3dd4fe;return db[_0xf2bc('0x6f')]['findAll']({'where':{'id':_0x16913e[_0xf2bc('0x57')][_0xf2bc('0x72')]},'attributes':['id'],'include':[{'model':db[_0xf2bc('0x66')],'as':_0xf2bc('0x73'),'attributes':['id'],'raw':!![]}]})[_0xf2bc('0x20')](function(_0x17ce4f){if(_0x17ce4f){for(var _0x3bda5c=0x0;_0x3bda5c<_0x17ce4f[_0xf2bc('0x41')];_0x3bda5c+=0x1){for(var _0x29573d=0x0;_0x29573d<_0x17ce4f[_0x3bda5c][_0xf2bc('0x73')][_0xf2bc('0x41')];_0x29573d+=0x1){_0x44ff99=_[_0xf2bc('0x74')](_0x44ff99,[_0x17ce4f[_0x3bda5c][_0xf2bc('0x73')][_0x29573d]['id']]);}}return _0x44ff99;}})[_0xf2bc('0x20')](function(_0x403d5a){if(_0x403d5a){return db[_0xf2bc('0x3a')]['find']({'where':{'id':_0x16913e['params']['id']}});}})[_0xf2bc('0x20')](function(_0x40c0fb){if(_0x40c0fb){_0x3dd4fe=_0x40c0fb;return _0x3dd4fe['addAgents'](_0x44ff99,{'penalty':_0x16913e[_0xf2bc('0x57')]['penalty']});}})['then'](function(_0x21431e){if(_0x21431e){return _0x3dd4fe['addTeams'](_0x16913e[_0xf2bc('0x57')][_0xf2bc('0x72')]);}})['then'](handleEntityNotFound(_0x5e7c99,null))['then'](respondWithStatusCode(_0x5e7c99,null))[_0xf2bc('0x52')](handleError(_0x5e7c99,null));};exports[_0xf2bc('0x75')]=function(_0x1de6c3,_0x1e4645,_0x7e8943){var _0x196a12=[];var _0xc4e1ac;return db[_0xf2bc('0x6f')][_0xf2bc('0x50')]({'where':{'id':_0x1de6c3['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xf2bc('0x66')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](function(_0x1bcf6a){if(_0x1bcf6a){for(var _0x324b1c=0x0;_0x324b1c<_0x1bcf6a[_0xf2bc('0x41')];_0x324b1c+=0x1){for(var _0xfad0e1=0x0;_0xfad0e1<_0x1bcf6a[_0x324b1c]['Agents'][_0xf2bc('0x41')];_0xfad0e1+=0x1){_0x196a12=_[_0xf2bc('0x74')](_0x196a12,[_0x1bcf6a[_0x324b1c][_0xf2bc('0x73')][_0xfad0e1]['id']]);}}return _0x196a12;}})[_0xf2bc('0x20')](function(_0x48cc88){if(_0x48cc88){return db[_0xf2bc('0x3a')][_0xf2bc('0x55')]({'where':{'id':_0x1de6c3['params']['id']}});}})[_0xf2bc('0x20')](function(_0x5edbfd){if(_0x5edbfd){_0xc4e1ac=_0x5edbfd;return _0xc4e1ac[_0xf2bc('0x76')](_0x196a12);}})[_0xf2bc('0x20')](function(_0xb0a4e){if(_0xc4e1ac){return _0xc4e1ac['removeTeams'](_0x1de6c3[_0xf2bc('0x3b')]['ids']);}})['then'](handleEntityNotFound(_0x1e4645,null))[_0xf2bc('0x20')](respondWithStatusCode(_0x1e4645,null))[_0xf2bc('0x52')](handleError(_0x1e4645,null));};exports[_0xf2bc('0x77')]=function(_0xa714d5,_0x229ed6,_0x412db7){return db[_0xf2bc('0x3a')][_0xf2bc('0x55')]({'where':{'id':_0xa714d5['params']['id']}})[_0xf2bc('0x20')](handleEntityNotFound(_0x229ed6,null))[_0xf2bc('0x20')](function(_0x2d5e95){if(_0x2d5e95){return _0x2d5e95[_0xf2bc('0x77')](_0xa714d5[_0xf2bc('0x57')][_0xf2bc('0x72')],_[_0xf2bc('0x78')](_0xa714d5[_0xf2bc('0x57')],[_0xf2bc('0x72'),'id'])||{})[_0xf2bc('0x79')](function(_0x2f11a2){for(var _0x197610=0x0;_0x197610<_0xa714d5[_0xf2bc('0x57')][_0xf2bc('0x72')][_0xf2bc('0x41')];_0x197610+=0x1){socket[_0xf2bc('0x7a')](_0xf2bc('0x7b'),{'UserId':_0xa714d5[_0xf2bc('0x57')][_0xf2bc('0x72')][_0x197610],'ChatQueueId':_0xa714d5[_0xf2bc('0x53')]['id']});}return _0x2f11a2;});}})[_0xf2bc('0x20')](respondWithResult(_0x229ed6,null))[_0xf2bc('0x52')](handleError(_0x229ed6,null));};exports[_0xf2bc('0x76')]=function(_0x107f99,_0x2b15fd,_0x3c8286){var _0x58cb4f;return db[_0xf2bc('0x3a')][_0xf2bc('0x55')]({'where':{'id':_0x107f99['params']['id']}})[_0xf2bc('0x20')](handleEntityNotFound(_0x2b15fd,null))[_0xf2bc('0x20')](function(_0x2b24b5){if(_0x2b24b5){return _0x2b24b5[_0xf2bc('0x76')](_0x107f99['query'][_0xf2bc('0x72')])[_0xf2bc('0x20')](function(_0x64bd25){if(_[_0xf2bc('0x7c')](_0x107f99[_0xf2bc('0x3b')][_0xf2bc('0x72')])){for(var _0x3b6f39=0x0;_0x3b6f39<_0x107f99[_0xf2bc('0x3b')][_0xf2bc('0x72')][_0xf2bc('0x41')];_0x3b6f39+=0x1){socket[_0xf2bc('0x7a')](_0xf2bc('0x7d'),{'UserId':_0x107f99['query'][_0xf2bc('0x72')][_0x3b6f39],'ChatQueueId':_0x107f99[_0xf2bc('0x53')]['id']});}}else{socket['emit']('userChatQueue:remove',{'UserId':_0x107f99[_0xf2bc('0x3b')]['ids'],'ChatQueueId':_0x107f99[_0xf2bc('0x53')]['id']});}});}})[_0xf2bc('0x20')](respondWithStatusCode(_0x2b15fd,null))[_0xf2bc('0x52')](handleError(_0x2b15fd,null));};exports[_0xf2bc('0x7e')]=function(_0x20ca7c,_0x58734c,_0x4ef89f){var _0x322747={};var _0x55f7e1={};var _0x1c2078;var _0x17d427;return db['ChatQueue']['findOne']({'where':{'id':_0x20ca7c[_0xf2bc('0x53')]['id']}})[_0xf2bc('0x20')](handleEntityNotFound(_0x58734c,null))['then'](function(_0x448f04){if(_0x448f04){_0x1c2078=_0x448f04;_0x55f7e1[_0xf2bc('0x3f')]=_[_0xf2bc('0x3c')](db['User']['rawAttributes']);_0x55f7e1[_0xf2bc('0x3b')]=_['keys'](_0x20ca7c[_0xf2bc('0x3b')]);_0x55f7e1['filters']=_['intersection'](_0x55f7e1[_0xf2bc('0x3f')],_0x55f7e1[_0xf2bc('0x3b')]);_0x322747[_0xf2bc('0x3e')]=_[_0xf2bc('0x3d')](_0x55f7e1['model'],qs[_0xf2bc('0x40')](_0x20ca7c['query'][_0xf2bc('0x40')]));_0x322747['attributes']=_0x322747[_0xf2bc('0x3e')][_0xf2bc('0x41')]?_0x322747[_0xf2bc('0x3e')]:_0x55f7e1[_0xf2bc('0x3f')];_0x322747[_0xf2bc('0x64')]=qs[_0xf2bc('0x44')](_0x20ca7c[_0xf2bc('0x3b')]['sort']);_0x322747[_0xf2bc('0x45')]=qs[_0xf2bc('0x46')](_[_0xf2bc('0x47')](_0x20ca7c['query'],_0x55f7e1[_0xf2bc('0x46')]));if(_0x20ca7c['query']['filter']){_0x322747[_0xf2bc('0x45')]=_[_0xf2bc('0x49')](_0x322747['where'],{'$or':_[_0xf2bc('0x68')](_0x322747[_0xf2bc('0x3e')],function(_0x22542e){var _0xc436b4={};_0xc436b4[_0x22542e]={'$like':'%'+_0x20ca7c[_0xf2bc('0x3b')]['filter']+'%'};return _0xc436b4;})});}_0x322747=_[_0xf2bc('0x49')]({},_0x322747,_0x20ca7c[_0xf2bc('0x4d')]);return _0x1c2078[_0xf2bc('0x7e')](_0x322747);}})[_0xf2bc('0x20')](function(_0x5e5ed6){if(_0x5e5ed6){_0x17d427=_0x5e5ed6[_0xf2bc('0x41')];if(!_0x20ca7c[_0xf2bc('0x3b')][_0xf2bc('0x42')](_0xf2bc('0x7f'))){_0x322747[_0xf2bc('0x43')]=qs[_0xf2bc('0x43')](_0x20ca7c['query'][_0xf2bc('0x43')]);_0x322747[_0xf2bc('0x2e')]=qs[_0xf2bc('0x2e')](_0x20ca7c[_0xf2bc('0x3b')][_0xf2bc('0x2e')]);}return _0x1c2078[_0xf2bc('0x7e')](_0x322747);}})[_0xf2bc('0x20')](function(_0x1eef04){if(_0x1eef04){return _0x1eef04?{'count':_0x17d427,'rows':_0x1eef04}:null;}})[_0xf2bc('0x20')](respondWithResult(_0x58734c,null))[_0xf2bc('0x52')](handleError(_0x58734c,null));}; \ No newline at end of file +var _0x5269=['client','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','stack','send','index','ChatQueue','rawAttributes','model','keys','filters','intersection','attributes','fields','query','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','options','includeAll','include','rows','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','name','params','describe','getMembers','findOne','UserChatQueue','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','hasOwnProperty','addTeams','findAll','Agents','union','addAgents','penalty','ids','removeTeams','removeAgents','omit','spread','userChatQueue:save','isArray','userChatQueue:remove','emit','getAgents','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','defaults','redis','socket.io-emitter','./chatQueue.socket','register','jayson/promise'];(function(_0x313349,_0x4b8293){var _0x4a5e63=function(_0x2246bf){while(--_0x2246bf){_0x313349['push'](_0x313349['shift']());}};_0x4a5e63(++_0x4b8293);}(_0x5269,0x166));var _0x9526=function(_0x5c008c,_0x183176){_0x5c008c=_0x5c008c-0x0;var _0x243acf=_0x5269[_0x5c008c];return _0x243acf;};'use strict';var pdf=require(_0x9526('0x0'));var emlformat=require(_0x9526('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9526('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9526('0x3'));var BPromise=require(_0x9526('0x4'));var Mustache=require(_0x9526('0x5'));var util=require(_0x9526('0x6'));var path=require(_0x9526('0x7'));var sox=require('sox');var csv=require(_0x9526('0x8'));var ejs=require(_0x9526('0x9'));var fs=require('fs');var _=require(_0x9526('0xa'));var squel=require(_0x9526('0xb'));var crypto=require(_0x9526('0xc'));var jsforce=require(_0x9526('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9526('0x8'));var querystring=require(_0x9526('0xe'));var Papa=require(_0x9526('0xf'));var authService=require(_0x9526('0x10'));var hardwareService=require(_0x9526('0x11'));var Redis=require(_0x9526('0x12'));var qs=require(_0x9526('0x13'));var logger=require(_0x9526('0x14'))(_0x9526('0x15'));var utils=require(_0x9526('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x9526('0x17')](config[_0x9526('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x9526('0x19'))(new Redis(config[_0x9526('0x18')]));require(_0x9526('0x1a'))[_0x9526('0x1b')](socket);var jayson=require(_0x9526('0x1c'));var client=jayson[_0x9526('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x435414,_0x261fae,_0x5642ae,_0x2cb4cd){return new BPromise(function(_0x443e06,_0x3143f1){var _0x2c95e9=_0x2cb4cd||client;return _0x2c95e9[_0x9526('0x1e')](_0x435414,_0x5642ae)[_0x9526('0x1f')](function(_0x1e3f23){logger[_0x9526('0x20')](_0x9526('0x21'),_0x261fae,_0x9526('0x22'));logger['debug'](_0x9526('0x23'),_0x261fae,_0x9526('0x22'),JSON[_0x9526('0x24')](_0x1e3f23));if(_0x1e3f23[_0x9526('0x25')]){if(_0x1e3f23['error'][_0x9526('0x26')]===0x1f4){logger[_0x9526('0x25')](_0x9526('0x21'),_0x261fae,_0x1e3f23[_0x9526('0x25')]['message']);return _0x3143f1(_0x1e3f23[_0x9526('0x25')][_0x9526('0x27')]);}logger[_0x9526('0x25')]('ChatQueue,\x20%s,\x20%s',_0x261fae,_0x1e3f23[_0x9526('0x25')][_0x9526('0x27')]);return _0x443e06(_0x1e3f23[_0x9526('0x25')]['message']);}else{logger[_0x9526('0x20')](_0x9526('0x21'),_0x261fae,_0x9526('0x22'));_0x443e06(_0x1e3f23[_0x9526('0x28')]['message']);}})[_0x9526('0x29')](function(_0x12dfad){logger[_0x9526('0x25')]('ChatQueue,\x20%s,\x20%s',_0x261fae,_0x12dfad);_0x3143f1(_0x12dfad);});});}function respondWithStatusCode(_0x372ebc,_0x4eeaab){_0x4eeaab=_0x4eeaab||0xcc;return function(_0x34571c){if(_0x34571c){return _0x372ebc[_0x9526('0x2a')](_0x4eeaab);}return _0x372ebc['status'](_0x4eeaab)[_0x9526('0x2b')]();};}function respondWithResult(_0x5eceb9,_0x534b6b){_0x534b6b=_0x534b6b||0xc8;return function(_0x5c4ffa){if(_0x5c4ffa){return _0x5eceb9[_0x9526('0x2c')](_0x534b6b)['json'](_0x5c4ffa);}};}function respondWithFilteredResult(_0xcf2931,_0x1c76ad){return function(_0x4e2fdf){if(_0x4e2fdf){var _0x87b3d5=_0x4e2fdf[_0x9526('0x2d')],_0x2e05b3=_0x1c76ad[_0x9526('0x2e')],_0x5431f8=_0x1c76ad[_0x9526('0x2e')]+_0x1c76ad[_0x9526('0x2f')],_0x2f9341;if(_0x5431f8>=_0x87b3d5){_0x5431f8=_0x87b3d5;_0x2f9341=0xc8;}else{_0x2f9341=0xce;}_0xcf2931[_0x9526('0x2c')](_0x2f9341);return _0xcf2931['set'](_0x9526('0x30'),_0x2e05b3+'-'+_0x5431f8+'/'+_0x87b3d5)[_0x9526('0x31')](_0x4e2fdf);}return null;};}function patchUpdates(_0x3ac056){return function(_0x4f1745){try{jsonpatch[_0x9526('0x32')](_0x4f1745,_0x3ac056,!![]);}catch(_0x32596a){return BPromise[_0x9526('0x33')](_0x32596a);}return _0x4f1745[_0x9526('0x34')]();};}function saveUpdates(_0x182c3e,_0x27d437){return function(_0x2cd565){if(_0x2cd565){return _0x2cd565[_0x9526('0x35')](_0x182c3e)['then'](function(_0x448d3f){return _0x448d3f;});}return null;};}function removeEntity(_0x15b2e7,_0x523824){return function(_0x515692){if(_0x515692){return _0x515692[_0x9526('0x36')]()['then'](function(){var _0x5d3a1c=_0x515692[_0x9526('0x37')]({'plain':!![]});var _0x21e14c=_0x9526('0x38');return db[_0x9526('0x39')][_0x9526('0x36')]({'where':{'type':_0x21e14c,'resourceId':_0x5d3a1c['id']}})[_0x9526('0x1f')](function(){return _0x515692;});})[_0x9526('0x1f')](function(){_0x15b2e7[_0x9526('0x2c')](0xcc)[_0x9526('0x2b')]();});}};}function handleEntityNotFound(_0x34fe8d,_0x25393e){return function(_0x172d06){if(!_0x172d06){_0x34fe8d[_0x9526('0x2a')](0x194);}return _0x172d06;};}function handleError(_0x2206ee,_0x518894){_0x518894=_0x518894||0x1f4;return function(_0x2184dd){logger[_0x9526('0x25')](_0x2184dd[_0x9526('0x3a')]);if(_0x2184dd['name']){delete _0x2184dd['name'];}_0x2206ee[_0x9526('0x2c')](_0x518894)[_0x9526('0x3b')](_0x2184dd);};}exports[_0x9526('0x3c')]=function(_0x5d90d3,_0x683984){var _0x5258d4={},_0x1578b5={},_0x1bd80a={'count':0x0,'rows':[]};var _0x9e7b63=db[_0x9526('0x3d')][_0x9526('0x3e')];_0x1578b5[_0x9526('0x3f')]=_[_0x9526('0x40')](_0x9e7b63);_0x1578b5['query']=_['keys'](_0x5d90d3['query']);_0x1578b5[_0x9526('0x41')]=_[_0x9526('0x42')](_0x1578b5[_0x9526('0x3f')],_0x1578b5['query']);_0x5258d4[_0x9526('0x43')]=_[_0x9526('0x42')](_0x1578b5[_0x9526('0x3f')],qs[_0x9526('0x44')](_0x5d90d3[_0x9526('0x45')][_0x9526('0x44')]));_0x5258d4[_0x9526('0x43')]=_0x5258d4[_0x9526('0x43')]['length']?_0x5258d4[_0x9526('0x43')]:_0x1578b5[_0x9526('0x3f')];if(!_0x5d90d3[_0x9526('0x45')]['hasOwnProperty'](_0x9526('0x46'))){_0x5258d4[_0x9526('0x2f')]=qs['limit'](_0x5d90d3[_0x9526('0x45')][_0x9526('0x2f')]);_0x5258d4[_0x9526('0x2e')]=qs['offset'](_0x5d90d3[_0x9526('0x45')]['offset']);}_0x5258d4[_0x9526('0x47')]=qs[_0x9526('0x48')](_0x5d90d3[_0x9526('0x45')][_0x9526('0x48')]);_0x5258d4[_0x9526('0x49')]=qs['filters'](_[_0x9526('0x4a')](_0x5d90d3[_0x9526('0x45')],_0x1578b5['filters']));if(_0x5d90d3[_0x9526('0x45')][_0x9526('0x4b')]){_0x5258d4[_0x9526('0x49')]=_[_0x9526('0x4c')](_0x5258d4[_0x9526('0x49')],{'$or':_[_0x9526('0x4d')](_0x9e7b63,function(_0x2b2e85){if(_0x2b2e85[_0x9526('0x4e')][_0x9526('0x4f')]!==_0x9526('0x50')){var _0x3c1b26={};_0x3c1b26[_0x2b2e85['field']]={'$like':'%'+_0x5d90d3[_0x9526('0x45')][_0x9526('0x4b')]+'%'};return _0x3c1b26;}})});}_0x5258d4=_[_0x9526('0x4c')]({},_0x5258d4,_0x5d90d3[_0x9526('0x51')]);var _0x3dae2a={'where':_0x5258d4[_0x9526('0x49')]};return db[_0x9526('0x3d')][_0x9526('0x2d')](_0x3dae2a)[_0x9526('0x1f')](function(_0x2e034f){_0x1bd80a['count']=_0x2e034f;if(_0x5d90d3['query'][_0x9526('0x52')]){_0x5258d4[_0x9526('0x53')]=[{'all':!![]}];}return db[_0x9526('0x3d')]['findAll'](_0x5258d4);})[_0x9526('0x1f')](function(_0x55b2f1){_0x1bd80a[_0x9526('0x54')]=_0x55b2f1;return _0x1bd80a;})['then'](respondWithFilteredResult(_0x683984,_0x5258d4))[_0x9526('0x29')](handleError(_0x683984,null));};exports[_0x9526('0x55')]=function(_0x2a0c9f,_0x562fc5){var _0x212cb3={'raw':!![],'where':{'id':_0x2a0c9f['params']['id']}},_0x17a7ae={};_0x17a7ae[_0x9526('0x3f')]=_['keys'](db[_0x9526('0x3d')][_0x9526('0x3e')]);_0x17a7ae[_0x9526('0x45')]=_[_0x9526('0x40')](_0x2a0c9f['query']);_0x17a7ae[_0x9526('0x41')]=_[_0x9526('0x42')](_0x17a7ae[_0x9526('0x3f')],_0x17a7ae[_0x9526('0x45')]);_0x212cb3['attributes']=_[_0x9526('0x42')](_0x17a7ae[_0x9526('0x3f')],qs['fields'](_0x2a0c9f[_0x9526('0x45')][_0x9526('0x44')]));_0x212cb3[_0x9526('0x43')]=_0x212cb3[_0x9526('0x43')][_0x9526('0x56')]?_0x212cb3[_0x9526('0x43')]:_0x17a7ae['model'];if(_0x2a0c9f['query'][_0x9526('0x52')]){_0x212cb3[_0x9526('0x53')]=[{'all':!![]}];}_0x212cb3=_[_0x9526('0x4c')]({},_0x212cb3,_0x2a0c9f['options']);return db[_0x9526('0x3d')][_0x9526('0x57')](_0x212cb3)[_0x9526('0x1f')](handleEntityNotFound(_0x562fc5,null))[_0x9526('0x1f')](respondWithResult(_0x562fc5,null))[_0x9526('0x29')](handleError(_0x562fc5,null));};exports[_0x9526('0x58')]=function(_0x2bcae4,_0x515993){return db[_0x9526('0x3d')]['create'](_0x2bcae4[_0x9526('0x59')],{})['then'](function(_0x1db160){var _0x1a5eae=_0x2bcae4[_0x9526('0x5a')][_0x9526('0x37')]({'plain':!![]});if(!_0x1a5eae)throw new Error(_0x9526('0x5b'));if(_0x1a5eae[_0x9526('0x5c')]===_0x9526('0x5a')){var _0x399468=_0x1db160[_0x9526('0x37')]({'plain':!![]});var _0x571751=_0x9526('0x38');return db['UserProfileSection'][_0x9526('0x57')]({'where':{'name':_0x571751,'userProfileId':_0x1a5eae[_0x9526('0x5d')]},'raw':!![]})[_0x9526('0x1f')](function(_0x41297c){if(_0x41297c&&_0x41297c[_0x9526('0x5e')]===0x0){return db[_0x9526('0x39')][_0x9526('0x58')]({'name':_0x399468[_0x9526('0x5f')],'resourceId':_0x399468['id'],'type':_0x41297c['name'],'sectionId':_0x41297c['id']},{})[_0x9526('0x1f')](function(){return _0x1db160;});}else{return _0x1db160;}})[_0x9526('0x29')](function(_0x454d47){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x454d47);throw _0x454d47;});}return _0x1db160;})['then'](respondWithResult(_0x515993,0xc9))[_0x9526('0x29')](handleError(_0x515993,null));};exports[_0x9526('0x35')]=function(_0x289fbe,_0x29a9aa){if(_0x289fbe[_0x9526('0x59')]['id']){delete _0x289fbe[_0x9526('0x59')]['id'];}return db['ChatQueue'][_0x9526('0x57')]({'where':{'id':_0x289fbe[_0x9526('0x60')]['id']}})[_0x9526('0x1f')](handleEntityNotFound(_0x29a9aa,null))[_0x9526('0x1f')](saveUpdates(_0x289fbe[_0x9526('0x59')],null))['then'](respondWithResult(_0x29a9aa,null))[_0x9526('0x29')](handleError(_0x29a9aa,null));};exports[_0x9526('0x36')]=function(_0x4846aa,_0x510ca9){return db[_0x9526('0x3d')][_0x9526('0x57')]({'where':{'id':_0x4846aa['params']['id']}})[_0x9526('0x1f')](handleEntityNotFound(_0x510ca9,null))['then'](removeEntity(_0x510ca9,null))[_0x9526('0x29')](handleError(_0x510ca9,null));};exports[_0x9526('0x61')]=function(_0x4d08f1,_0x38990a){return db[_0x9526('0x3d')][_0x9526('0x61')]()[_0x9526('0x1f')](respondWithResult(_0x38990a,null))[_0x9526('0x29')](handleError(_0x38990a,null));};exports[_0x9526('0x62')]=function(_0x17f79b,_0x3eb46e,_0x14ef98){var _0x1f4377={'raw':!![],'where':{}},_0x3ede03={},_0x461181;return db['ChatQueue'][_0x9526('0x63')]({'where':{'id':_0x17f79b[_0x9526('0x60')]['id']}})[_0x9526('0x1f')](handleEntityNotFound(_0x3eb46e,null))['then'](function(_0x39cd40){if(_0x39cd40){_0x461181=_0x39cd40[_0x9526('0x37')]({'plain':!![]});_0x3ede03['model']=_['keys'](db[_0x9526('0x64')][_0x9526('0x3e')]);_0x3ede03[_0x9526('0x45')]=_[_0x9526('0x40')](_0x17f79b[_0x9526('0x45')]);_0x3ede03[_0x9526('0x41')]=_[_0x9526('0x42')](_0x3ede03[_0x9526('0x3f')],_0x3ede03['query']);_0x1f4377[_0x9526('0x43')]=_[_0x9526('0x42')](_0x3ede03[_0x9526('0x3f')],qs[_0x9526('0x44')](_0x17f79b[_0x9526('0x45')][_0x9526('0x44')]));_0x1f4377[_0x9526('0x43')]=_0x1f4377[_0x9526('0x43')][_0x9526('0x56')]?_0x1f4377[_0x9526('0x43')]:_0x3ede03[_0x9526('0x3f')];if(!_0x17f79b[_0x9526('0x45')]['hasOwnProperty']('nolimit')){_0x1f4377[_0x9526('0x2f')]=qs['limit'](_0x17f79b[_0x9526('0x45')][_0x9526('0x2f')]);_0x1f4377[_0x9526('0x2e')]=qs[_0x9526('0x2e')](_0x17f79b['query'][_0x9526('0x2e')]);}_0x1f4377['order']=qs['sort'](_0x17f79b['query'][_0x9526('0x48')]);_0x1f4377[_0x9526('0x49')]=qs[_0x9526('0x41')](_[_0x9526('0x4a')](_0x17f79b[_0x9526('0x45')],_0x3ede03[_0x9526('0x41')]));_0x1f4377[_0x9526('0x49')]['ChatQueueId']=_0x39cd40['id'];if(_0x17f79b[_0x9526('0x45')][_0x9526('0x4b')]){_0x1f4377[_0x9526('0x49')]=_['merge'](_0x1f4377[_0x9526('0x49')],{'$or':_[_0x9526('0x4d')](_0x1f4377['attributes'],function(_0x10d16b){var _0x4809c1={};_0x4809c1[_0x10d16b]={'$like':'%'+_0x17f79b['query'][_0x9526('0x4b')]+'%'};return _0x4809c1;})});}_0x1f4377=_['merge']({},_0x1f4377,_0x17f79b[_0x9526('0x51')]);return db[_0x9526('0x64')]['findAll'](_0x1f4377);}})[_0x9526('0x1f')](function(_0x317540){if(_0x317540){return db[_0x9526('0x65')][_0x9526('0x66')]({'where':{'id':_[_0x9526('0x4d')](_0x317540,_0x9526('0x67')),'role':_0x9526('0x68')},'attributes':['id','name',_0x9526('0x69'),_0x9526('0x6a'),_0x9526('0x6b')]});}})[_0x9526('0x1f')](function(_0x4632e4){if(_0x4632e4){return{'count':_0x4632e4[_0x9526('0x2d')],'rows':_[_0x9526('0x4d')](_0x4632e4[_0x9526('0x54')],function(_0x4554c9){return{'membername':_0x4554c9['name'],'UserId':_0x4554c9['id'],'queue_name':_0x461181[_0x9526('0x5f')],'ChatQueueId':_0x461181['id'],'interface':util['format'](_0x9526('0x6c'),_0x9526('0x6d'),_0x4554c9[_0x9526('0x5f')]),'penalty':0x0,'paused':_0x4554c9['chatPause'],'createdAt':_0x4554c9['createdAt'],'updatedAt':_0x4554c9[_0x9526('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9526('0x1f')](respondWithFilteredResult(_0x3eb46e,_0x1f4377))['catch'](handleError(_0x3eb46e,null));};exports[_0x9526('0x6e')]=function(_0x28f428,_0x23fef9,_0x279dc5){var _0x34b905={};var _0x512da4={};var _0x811062;var _0x2f89bc;return db['ChatQueue'][_0x9526('0x63')]({'where':{'id':_0x28f428[_0x9526('0x60')]['id']}})[_0x9526('0x1f')](handleEntityNotFound(_0x23fef9,null))[_0x9526('0x1f')](function(_0x457582){if(_0x457582){_0x811062=_0x457582;_0x512da4[_0x9526('0x3f')]=_['keys'](db[_0x9526('0x6f')][_0x9526('0x3e')]);_0x512da4[_0x9526('0x45')]=_[_0x9526('0x40')](_0x28f428['query']);_0x512da4[_0x9526('0x41')]=_[_0x9526('0x42')](_0x512da4['model'],_0x512da4[_0x9526('0x45')]);_0x34b905['attributes']=_[_0x9526('0x42')](_0x512da4[_0x9526('0x3f')],qs[_0x9526('0x44')](_0x28f428[_0x9526('0x45')][_0x9526('0x44')]));_0x34b905['attributes']=_0x34b905['attributes'][_0x9526('0x56')]?_0x34b905[_0x9526('0x43')]:_0x512da4['model'];_0x34b905[_0x9526('0x47')]=qs[_0x9526('0x48')](_0x28f428[_0x9526('0x45')]['sort']);_0x34b905[_0x9526('0x49')]=qs[_0x9526('0x41')](_['pick'](_0x28f428[_0x9526('0x45')],_0x512da4[_0x9526('0x41')]));if(_0x28f428[_0x9526('0x45')]['filter']){_0x34b905[_0x9526('0x49')]=_['merge'](_0x34b905['where'],{'$or':_['map'](_0x34b905[_0x9526('0x43')],function(_0xa4dd3a){var _0x347423={};_0x347423[_0xa4dd3a]={'$like':'%'+_0x28f428['query'][_0x9526('0x4b')]+'%'};return _0x347423;})});}_0x34b905=_[_0x9526('0x4c')]({},_0x34b905,_0x28f428[_0x9526('0x51')]);return _0x811062[_0x9526('0x6e')](_0x34b905);}})['then'](function(_0x11fdda){if(_0x11fdda){_0x2f89bc=_0x11fdda[_0x9526('0x56')];if(!_0x28f428[_0x9526('0x45')][_0x9526('0x70')]('nolimit')){_0x34b905[_0x9526('0x2f')]=qs[_0x9526('0x2f')](_0x28f428[_0x9526('0x45')][_0x9526('0x2f')]);_0x34b905[_0x9526('0x2e')]=qs['offset'](_0x28f428[_0x9526('0x45')][_0x9526('0x2e')]);}return _0x811062['getTeams'](_0x34b905);}})[_0x9526('0x1f')](function(_0x20fefc){if(_0x20fefc){return _0x20fefc?{'count':_0x2f89bc,'rows':_0x20fefc}:null;}})[_0x9526('0x1f')](respondWithResult(_0x23fef9,null))[_0x9526('0x29')](handleError(_0x23fef9,null));};exports[_0x9526('0x71')]=function(_0x55cb60,_0x5bc94b,_0x4f0d1b){var _0x13419e=[];var _0x511585;return db[_0x9526('0x6f')][_0x9526('0x72')]({'where':{'id':_0x55cb60[_0x9526('0x59')]['ids']},'attributes':['id'],'include':[{'model':db[_0x9526('0x65')],'as':_0x9526('0x73'),'attributes':['id'],'raw':!![]}]})[_0x9526('0x1f')](function(_0x45aaec){if(_0x45aaec){for(var _0x59f9e3=0x0;_0x59f9e3<_0x45aaec[_0x9526('0x56')];_0x59f9e3+=0x1){for(var _0x1e18dc=0x0;_0x1e18dc<_0x45aaec[_0x59f9e3]['Agents'][_0x9526('0x56')];_0x1e18dc+=0x1){_0x13419e=_[_0x9526('0x74')](_0x13419e,[_0x45aaec[_0x59f9e3][_0x9526('0x73')][_0x1e18dc]['id']]);}}return _0x13419e;}})['then'](function(_0x48e72d){if(_0x48e72d){return db[_0x9526('0x3d')][_0x9526('0x57')]({'where':{'id':_0x55cb60[_0x9526('0x60')]['id']}});}})[_0x9526('0x1f')](function(_0x1748d9){if(_0x1748d9){_0x511585=_0x1748d9;return _0x511585[_0x9526('0x75')](_0x13419e,{'penalty':_0x55cb60['body'][_0x9526('0x76')]});}})[_0x9526('0x1f')](function(_0x4f2a85){if(_0x4f2a85){return _0x511585[_0x9526('0x71')](_0x55cb60[_0x9526('0x59')][_0x9526('0x77')]);}})[_0x9526('0x1f')](handleEntityNotFound(_0x5bc94b,null))[_0x9526('0x1f')](respondWithStatusCode(_0x5bc94b,null))['catch'](handleError(_0x5bc94b,null));};exports[_0x9526('0x78')]=function(_0x3eafd9,_0x3f425a,_0x58872f){var _0x1158a2=[];var _0x40e83f;return db['Team'][_0x9526('0x72')]({'where':{'id':_0x3eafd9['query'][_0x9526('0x77')]},'attributes':['id'],'include':[{'model':db[_0x9526('0x65')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9526('0x1f')](function(_0x3fa033){if(_0x3fa033){for(var _0x370e25=0x0;_0x370e25<_0x3fa033[_0x9526('0x56')];_0x370e25+=0x1){for(var _0x2bf613=0x0;_0x2bf613<_0x3fa033[_0x370e25][_0x9526('0x73')][_0x9526('0x56')];_0x2bf613+=0x1){_0x1158a2=_[_0x9526('0x74')](_0x1158a2,[_0x3fa033[_0x370e25][_0x9526('0x73')][_0x2bf613]['id']]);}}return _0x1158a2;}})['then'](function(_0x32c2cc){if(_0x32c2cc){return db['ChatQueue']['find']({'where':{'id':_0x3eafd9[_0x9526('0x60')]['id']}});}})['then'](function(_0x1af3e9){if(_0x1af3e9){_0x40e83f=_0x1af3e9;return _0x40e83f[_0x9526('0x79')](_0x1158a2);}})[_0x9526('0x1f')](function(_0x460139){if(_0x40e83f){return _0x40e83f[_0x9526('0x78')](_0x3eafd9[_0x9526('0x45')][_0x9526('0x77')]);}})['then'](handleEntityNotFound(_0x3f425a,null))[_0x9526('0x1f')](respondWithStatusCode(_0x3f425a,null))['catch'](handleError(_0x3f425a,null));};exports[_0x9526('0x75')]=function(_0x7c5664,_0x33bdfc,_0x4f6c95){return db['ChatQueue'][_0x9526('0x57')]({'where':{'id':_0x7c5664[_0x9526('0x60')]['id']}})['then'](handleEntityNotFound(_0x33bdfc,null))[_0x9526('0x1f')](function(_0x5ce384){if(_0x5ce384){return _0x5ce384[_0x9526('0x75')](_0x7c5664[_0x9526('0x59')][_0x9526('0x77')],_[_0x9526('0x7a')](_0x7c5664[_0x9526('0x59')],[_0x9526('0x77'),'id'])||{})[_0x9526('0x7b')](function(_0x479e7a){for(var _0x237efe=0x0;_0x237efe<_0x7c5664['body'][_0x9526('0x77')]['length'];_0x237efe+=0x1){socket['emit'](_0x9526('0x7c'),{'UserId':_0x7c5664[_0x9526('0x59')]['ids'][_0x237efe],'ChatQueueId':_0x7c5664[_0x9526('0x60')]['id']});}return _0x479e7a;});}})['then'](respondWithResult(_0x33bdfc,null))['catch'](handleError(_0x33bdfc,null));};exports[_0x9526('0x79')]=function(_0x20bebc,_0x3f55d5,_0x5b78e5){var _0x1f8d18;return db[_0x9526('0x3d')]['find']({'where':{'id':_0x20bebc[_0x9526('0x60')]['id']}})['then'](handleEntityNotFound(_0x3f55d5,null))['then'](function(_0x3b0f58){if(_0x3b0f58){return _0x3b0f58[_0x9526('0x79')](_0x20bebc[_0x9526('0x45')]['ids'])[_0x9526('0x1f')](function(_0x221f4a){if(_[_0x9526('0x7d')](_0x20bebc[_0x9526('0x45')][_0x9526('0x77')])){for(var _0x42687c=0x0;_0x42687c<_0x20bebc['query'][_0x9526('0x77')]['length'];_0x42687c+=0x1){socket['emit'](_0x9526('0x7e'),{'UserId':_0x20bebc['query'][_0x9526('0x77')][_0x42687c],'ChatQueueId':_0x20bebc[_0x9526('0x60')]['id']});}}else{socket[_0x9526('0x7f')]('userChatQueue:remove',{'UserId':_0x20bebc[_0x9526('0x45')]['ids'],'ChatQueueId':_0x20bebc[_0x9526('0x60')]['id']});}});}})[_0x9526('0x1f')](respondWithStatusCode(_0x3f55d5,null))[_0x9526('0x29')](handleError(_0x3f55d5,null));};exports[_0x9526('0x80')]=function(_0x14f3b9,_0x297b22,_0x402c46){var _0x55c954={};var _0x4fb9c4={};var _0x420be0;var _0x2120c0;return db[_0x9526('0x3d')][_0x9526('0x63')]({'where':{'id':_0x14f3b9[_0x9526('0x60')]['id']}})[_0x9526('0x1f')](handleEntityNotFound(_0x297b22,null))[_0x9526('0x1f')](function(_0x2683fc){if(_0x2683fc){_0x420be0=_0x2683fc;_0x4fb9c4[_0x9526('0x3f')]=_[_0x9526('0x40')](db['User']['rawAttributes']);_0x4fb9c4['query']=_[_0x9526('0x40')](_0x14f3b9[_0x9526('0x45')]);_0x4fb9c4[_0x9526('0x41')]=_[_0x9526('0x42')](_0x4fb9c4['model'],_0x4fb9c4[_0x9526('0x45')]);_0x55c954[_0x9526('0x43')]=_[_0x9526('0x42')](_0x4fb9c4[_0x9526('0x3f')],qs[_0x9526('0x44')](_0x14f3b9[_0x9526('0x45')]['fields']));_0x55c954[_0x9526('0x43')]=_0x55c954['attributes'][_0x9526('0x56')]?_0x55c954[_0x9526('0x43')]:_0x4fb9c4[_0x9526('0x3f')];_0x55c954['order']=qs[_0x9526('0x48')](_0x14f3b9[_0x9526('0x45')]['sort']);_0x55c954[_0x9526('0x49')]=qs[_0x9526('0x41')](_[_0x9526('0x4a')](_0x14f3b9['query'],_0x4fb9c4[_0x9526('0x41')]));if(_0x14f3b9[_0x9526('0x45')][_0x9526('0x4b')]){_0x55c954[_0x9526('0x49')]=_[_0x9526('0x4c')](_0x55c954[_0x9526('0x49')],{'$or':_[_0x9526('0x4d')](_0x55c954[_0x9526('0x43')],function(_0x3c143c){var _0x46ae17={};_0x46ae17[_0x3c143c]={'$like':'%'+_0x14f3b9['query'][_0x9526('0x4b')]+'%'};return _0x46ae17;})});}_0x55c954=_[_0x9526('0x4c')]({},_0x55c954,_0x14f3b9[_0x9526('0x51')]);return _0x420be0[_0x9526('0x80')](_0x55c954);}})['then'](function(_0x51b502){if(_0x51b502){_0x2120c0=_0x51b502[_0x9526('0x56')];if(!_0x14f3b9[_0x9526('0x45')][_0x9526('0x70')](_0x9526('0x46'))){_0x55c954['limit']=qs[_0x9526('0x2f')](_0x14f3b9[_0x9526('0x45')][_0x9526('0x2f')]);_0x55c954[_0x9526('0x2e')]=qs[_0x9526('0x2e')](_0x14f3b9[_0x9526('0x45')][_0x9526('0x2e')]);}return _0x420be0[_0x9526('0x80')](_0x55c954);}})[_0x9526('0x1f')](function(_0xe413a4){if(_0xe413a4){return _0xe413a4?{'count':_0x2120c0,'rows':_0xe413a4}:null;}})[_0x9526('0x1f')](respondWithResult(_0x297b22,null))['catch'](handleError(_0x297b22,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 22a9ca2..2fc8691 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 _0xde71=['../../mysqldb','ChatQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2670ae,_0x5b7d7c){var _0x57f9fa=function(_0x67e13){while(--_0x67e13){_0x2670ae['push'](_0x2670ae['shift']());}};_0x57f9fa(++_0x5b7d7c);}(_0xde71,0x1c1));var _0x1de7=function(_0x590b63,_0x14debb){_0x590b63=_0x590b63-0x0;var _0x3c9380=_0xde71[_0x590b63];return _0x3c9380;};'use strict';var EventEmitter=require(_0x1de7('0x0'));var ChatQueue=require(_0x1de7('0x1'))['db'][_0x1de7('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x1de7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1de7('0x4'),'afterDestroy':_0x1de7('0x5')};function emitEvent(_0x8a6dd4){return function(_0x2807c6,_0x38e2e1,_0x388826){ChatQueueEvents['emit'](_0x8a6dd4+':'+_0x2807c6['id'],_0x2807c6);ChatQueueEvents[_0x1de7('0x6')](_0x8a6dd4,_0x2807c6);_0x388826(null);};}for(var e in events){if(events[_0x1de7('0x7')](e)){var event=events[e];ChatQueue[_0x1de7('0x8')](e,emitEvent(event));}}module[_0x1de7('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0x77f1=['emit','hasOwnProperty','hook','../../mysqldb','ChatQueue','setMaxListeners'];(function(_0x42c6d6,_0x522db7){var _0x31da6f=function(_0x1fe8d2){while(--_0x1fe8d2){_0x42c6d6['push'](_0x42c6d6['shift']());}};_0x31da6f(++_0x522db7);}(_0x77f1,0x1dd));var _0x177f=function(_0xc9393f,_0x441595){_0xc9393f=_0xc9393f-0x0;var _0x30013c=_0x77f1[_0xc9393f];return _0x30013c;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x177f('0x0'))['db'][_0x177f('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x177f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x379958){return function(_0x139df2,_0x57dc73,_0x68cb6a){ChatQueueEvents[_0x177f('0x3')](_0x379958+':'+_0x139df2['id'],_0x139df2);ChatQueueEvents[_0x177f('0x3')](_0x379958,_0x139df2);_0x68cb6a(null);};}for(var e in events){if(events[_0x177f('0x4')](e)){var event=events[e];ChatQueue[_0x177f('0x5')](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 02e8884..bb3d48f 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 _0xb66c=['exports','define','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xb66c,0x175));var _0xcb66=function(_0x38d952,_0x1c3c66){_0x38d952=_0x38d952-0x0;var _0xa18067=_0xb66c[_0x38d952];return _0xa18067;};'use strict';var _=require(_0xcb66('0x0'));var util=require('util');var logger=require(_0xcb66('0x1'))('api');var moment=require(_0xcb66('0x2'));var BPromise=require(_0xcb66('0x3'));var rp=require(_0xcb66('0x4'));var attributes=require('./chatQueue.attributes');module[_0xcb66('0x5')]=function(_0x386241,_0x3f7cc7){return _0x386241[_0xcb66('0x6')]('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3435=['lodash','util','../../config/logger','api','moment','bluebird','./chatQueue.attributes','exports','define','ChatQueue'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x3435,0xfa));var _0x5343=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0x3435[_0x14fad0];return _0x5c665f;};'use strict';var _=require(_0x5343('0x0'));var util=require(_0x5343('0x1'));var logger=require(_0x5343('0x2'))(_0x5343('0x3'));var moment=require(_0x5343('0x4'));var BPromise=require(_0x5343('0x5'));var rp=require('request-promise');var attributes=require(_0x5343('0x6'));module[_0x5343('0x7')]=function(_0x578a24,_0x4ca9ba){return _0x578a24[_0x5343('0x8')](_0x5343('0x9'),attributes,{'tableName':'chat_queues','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 8969bf1..09b624e 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 _0x5ec1=['./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetChatQueue','ChatQueue','findAll','options','attributes','limit','map','include','model','then','debug','catch','ShowChatQueue','find','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x5ec1,0x8c));var _0x15ec=function(_0x53f897,_0x539857){_0x53f897=_0x53f897-0x0;var _0x6879f8=_0x5ec1[_0x53f897];return _0x6879f8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x15ec('0x0'));var BPromise=require('bluebird');var rs=require(_0x15ec('0x1'));var fs=require('fs');var Redis=require(_0x15ec('0x2'));var db=require(_0x15ec('0x3'))['db'];var utils=require(_0x15ec('0x4'));var logger=require(_0x15ec('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x15ec('0x6'));var client=jayson[_0x15ec('0x7')][_0x15ec('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x15ec('0x9')],{'host':_0x15ec('0xa'),'port':0x18eb});var socket=require(_0x15ec('0xb'))(new Redis(config['redis']));require(_0x15ec('0xc'))[_0x15ec('0xd')](socket);function respondWithRpcPromise(_0x1dda07,_0x2a34ed,_0x1cf915){return new BPromise(function(_0x257997,_0x459bed){return client[_0x15ec('0xe')](_0x1dda07,_0x1cf915)['then'](function(_0x2bc8dc){logger[_0x15ec('0xf')](_0x15ec('0x10'),_0x2a34ed,_0x15ec('0x11'));logger['debug'](_0x15ec('0x12'),_0x2a34ed,_0x15ec('0x11'),JSON[_0x15ec('0x13')](_0x2bc8dc));if(_0x2bc8dc[_0x15ec('0x14')]){if(_0x2bc8dc[_0x15ec('0x14')][_0x15ec('0x15')]===0x1f4){logger[_0x15ec('0x14')](_0x15ec('0x10'),_0x2a34ed,_0x2bc8dc[_0x15ec('0x14')]['message']);return _0x459bed(_0x2bc8dc[_0x15ec('0x14')]['message']);}logger[_0x15ec('0x14')](_0x15ec('0x10'),_0x2a34ed,_0x2bc8dc['error'][_0x15ec('0x16')]);return _0x257997(_0x2bc8dc[_0x15ec('0x14')][_0x15ec('0x16')]);}else{logger[_0x15ec('0xf')](_0x15ec('0x10'),_0x2a34ed,'request\x20sent');_0x257997(_0x2bc8dc[_0x15ec('0x17')]['message']);}})['catch'](function(_0x105394){logger[_0x15ec('0x14')](_0x15ec('0x10'),_0x2a34ed,_0x105394);_0x459bed(_0x105394);});});}exports[_0x15ec('0x18')]=function(_0x877930){var _0x4e2b3c=this;return new Promise(function(_0x18cb4f,_0x4e4f7c){return db[_0x15ec('0x19')][_0x15ec('0x1a')]({'raw':_0x877930[_0x15ec('0x1b')]?_0x877930['options']['raw']===undefined?!![]:![]:!![],'where':_0x877930[_0x15ec('0x1b')]?_0x877930[_0x15ec('0x1b')]['where']||null:null,'attributes':_0x877930['options']?_0x877930['options'][_0x15ec('0x1c')]||null:null,'limit':_0x877930[_0x15ec('0x1b')]?_0x877930['options'][_0x15ec('0x1d')]||null:null,'include':_0x877930[_0x15ec('0x1b')]?_0x877930[_0x15ec('0x1b')]['include']?_[_0x15ec('0x1e')](_0x877930[_0x15ec('0x1b')][_0x15ec('0x1f')],function(_0x4e9fb0){return{'model':db[_0x4e9fb0[_0x15ec('0x20')]],'as':_0x4e9fb0['as'],'attributes':_0x4e9fb0['attributes'],'include':_0x4e9fb0[_0x15ec('0x1f')]?_[_0x15ec('0x1e')](_0x4e9fb0[_0x15ec('0x1f')],function(_0x584ab2){return{'model':db[_0x584ab2[_0x15ec('0x20')]],'as':_0x584ab2['as'],'attributes':_0x584ab2[_0x15ec('0x1c')],'include':_0x584ab2['include']?_[_0x15ec('0x1e')](_0x584ab2['include'],function(_0x3f6242){return{'model':db[_0x3f6242['model']],'as':_0x3f6242['as'],'attributes':_0x3f6242['attributes']};}):[]};}):[]};}):[]:[]})[_0x15ec('0x21')](function(_0x364e7){logger['info'](_0x15ec('0x18'),_0x877930);logger[_0x15ec('0x22')]('GetChatQueue',_0x877930,JSON[_0x15ec('0x13')](_0x364e7));_0x18cb4f(_0x364e7);})[_0x15ec('0x23')](function(_0x6d28b5){logger[_0x15ec('0x14')](_0x15ec('0x18'),_0x6d28b5['message'],_0x877930);_0x4e4f7c(_0x4e2b3c[_0x15ec('0x14')](0x1f4,_0x6d28b5[_0x15ec('0x16')]));});});};exports[_0x15ec('0x24')]=function(_0x52bc2b){var _0x523a5a=this;return new Promise(function(_0x5bce45,_0x34ee68){return db['ChatQueue'][_0x15ec('0x25')]({'raw':_0x52bc2b['options']?_0x52bc2b['options']['raw']===undefined?!![]:![]:!![],'where':_0x52bc2b[_0x15ec('0x1b')]?_0x52bc2b['options']['where']||null:null,'attributes':_0x52bc2b[_0x15ec('0x1b')]?_0x52bc2b[_0x15ec('0x1b')][_0x15ec('0x1c')]||null:null,'include':_0x52bc2b[_0x15ec('0x1b')]?_0x52bc2b[_0x15ec('0x1b')]['include']?_[_0x15ec('0x1e')](_0x52bc2b['options'][_0x15ec('0x1f')],function(_0xb42236){return{'model':db[_0xb42236[_0x15ec('0x20')]],'as':_0xb42236['as'],'attributes':_0xb42236[_0x15ec('0x1c')],'include':_0xb42236['include']?_[_0x15ec('0x1e')](_0xb42236[_0x15ec('0x1f')],function(_0x1b503c){return{'model':db[_0x1b503c[_0x15ec('0x20')]],'as':_0x1b503c['as'],'attributes':_0x1b503c[_0x15ec('0x1c')],'include':_0x1b503c[_0x15ec('0x1f')]?_[_0x15ec('0x1e')](_0x1b503c['include'],function(_0x5a9734){return{'model':db[_0x5a9734[_0x15ec('0x20')]],'as':_0x5a9734['as'],'attributes':_0x5a9734[_0x15ec('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x185ee2){logger['info'](_0x15ec('0x24'),_0x52bc2b);logger[_0x15ec('0x22')](_0x15ec('0x24'),_0x52bc2b,JSON['stringify'](_0x185ee2));_0x5bce45(_0x185ee2);})['catch'](function(_0x477442){logger[_0x15ec('0x14')](_0x15ec('0x24'),_0x477442[_0x15ec('0x16')],_0x52bc2b);_0x34ee68(_0x523a5a['error'](0x1f4,_0x477442[_0x15ec('0x16')]));});});}; \ No newline at end of file +var _0x07a6=['error','code','message','result','catch','ChatQueue','options','raw','where','attributes','limit','map','include','model','GetChatQueue','ShowChatQueue','find','then','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./chatQueue.socket','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x38a48b,_0x33b457){var _0x5333f1=function(_0x19e1c8){while(--_0x19e1c8){_0x38a48b['push'](_0x38a48b['shift']());}};_0x5333f1(++_0x33b457);}(_0x07a6,0x1e6));var _0x607a=function(_0x956ff4,_0x9cd7f6){_0x956ff4=_0x956ff4-0x0;var _0x4a3be6=_0x07a6[_0x956ff4];return _0x4a3be6;};'use strict';var _=require(_0x607a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x607a('0x1'));var fs=require('fs');var Redis=require(_0x607a('0x2'));var db=require(_0x607a('0x3'))['db'];var utils=require(_0x607a('0x4'));var logger=require(_0x607a('0x5'))(_0x607a('0x6'));var config=require(_0x607a('0x7'));var jayson=require(_0x607a('0x8'));var client=jayson[_0x607a('0x9')][_0x607a('0xa')]({'port':0x232a});config['redis']=_[_0x607a('0xb')](config['redis'],{'host':_0x607a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x607a('0xd')]));require(_0x607a('0xe'))['register'](socket);function respondWithRpcPromise(_0x292e6f,_0xd83bf3,_0xacf955){return new BPromise(function(_0x50b369,_0x14ad2d){return client['request'](_0x292e6f,_0xacf955)['then'](function(_0x5b103c){logger[_0x607a('0xf')](_0x607a('0x10'),_0xd83bf3,_0x607a('0x11'));logger[_0x607a('0x12')](_0x607a('0x13'),_0xd83bf3,'request\x20sent',JSON[_0x607a('0x14')](_0x5b103c));if(_0x5b103c['error']){if(_0x5b103c[_0x607a('0x15')][_0x607a('0x16')]===0x1f4){logger[_0x607a('0x15')](_0x607a('0x10'),_0xd83bf3,_0x5b103c[_0x607a('0x15')][_0x607a('0x17')]);return _0x14ad2d(_0x5b103c[_0x607a('0x15')][_0x607a('0x17')]);}logger['error'](_0x607a('0x10'),_0xd83bf3,_0x5b103c[_0x607a('0x15')][_0x607a('0x17')]);return _0x50b369(_0x5b103c['error']['message']);}else{logger['info'](_0x607a('0x10'),_0xd83bf3,_0x607a('0x11'));_0x50b369(_0x5b103c[_0x607a('0x18')][_0x607a('0x17')]);}})[_0x607a('0x19')](function(_0x21ee21){logger[_0x607a('0x15')](_0x607a('0x10'),_0xd83bf3,_0x21ee21);_0x14ad2d(_0x21ee21);});});}exports['GetChatQueue']=function(_0x12e243){var _0x352012=this;return new Promise(function(_0x2cac34,_0x126c8b){return db[_0x607a('0x1a')]['findAll']({'raw':_0x12e243[_0x607a('0x1b')]?_0x12e243[_0x607a('0x1b')][_0x607a('0x1c')]===undefined?!![]:![]:!![],'where':_0x12e243[_0x607a('0x1b')]?_0x12e243[_0x607a('0x1b')][_0x607a('0x1d')]||null:null,'attributes':_0x12e243['options']?_0x12e243[_0x607a('0x1b')][_0x607a('0x1e')]||null:null,'limit':_0x12e243['options']?_0x12e243[_0x607a('0x1b')][_0x607a('0x1f')]||null:null,'include':_0x12e243[_0x607a('0x1b')]?_0x12e243[_0x607a('0x1b')]['include']?_[_0x607a('0x20')](_0x12e243[_0x607a('0x1b')][_0x607a('0x21')],function(_0x280573){return{'model':db[_0x280573['model']],'as':_0x280573['as'],'attributes':_0x280573['attributes'],'include':_0x280573[_0x607a('0x21')]?_[_0x607a('0x20')](_0x280573[_0x607a('0x21')],function(_0x122161){return{'model':db[_0x122161[_0x607a('0x22')]],'as':_0x122161['as'],'attributes':_0x122161[_0x607a('0x1e')],'include':_0x122161[_0x607a('0x21')]?_[_0x607a('0x20')](_0x122161[_0x607a('0x21')],function(_0x3df374){return{'model':db[_0x3df374[_0x607a('0x22')]],'as':_0x3df374['as'],'attributes':_0x3df374[_0x607a('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48aec9){logger[_0x607a('0xf')]('GetChatQueue',_0x12e243);logger[_0x607a('0x12')](_0x607a('0x23'),_0x12e243,JSON[_0x607a('0x14')](_0x48aec9));_0x2cac34(_0x48aec9);})['catch'](function(_0x57a9de){logger[_0x607a('0x15')]('GetChatQueue',_0x57a9de[_0x607a('0x17')],_0x12e243);_0x126c8b(_0x352012[_0x607a('0x15')](0x1f4,_0x57a9de[_0x607a('0x17')]));});});};exports[_0x607a('0x24')]=function(_0x42e612){var _0x42d904=this;return new Promise(function(_0x25be66,_0x23e842){return db[_0x607a('0x1a')][_0x607a('0x25')]({'raw':_0x42e612[_0x607a('0x1b')]?_0x42e612[_0x607a('0x1b')][_0x607a('0x1c')]===undefined?!![]:![]:!![],'where':_0x42e612['options']?_0x42e612[_0x607a('0x1b')][_0x607a('0x1d')]||null:null,'attributes':_0x42e612[_0x607a('0x1b')]?_0x42e612[_0x607a('0x1b')][_0x607a('0x1e')]||null:null,'include':_0x42e612[_0x607a('0x1b')]?_0x42e612[_0x607a('0x1b')][_0x607a('0x21')]?_[_0x607a('0x20')](_0x42e612[_0x607a('0x1b')]['include'],function(_0x26826a){return{'model':db[_0x26826a[_0x607a('0x22')]],'as':_0x26826a['as'],'attributes':_0x26826a[_0x607a('0x1e')],'include':_0x26826a[_0x607a('0x21')]?_['map'](_0x26826a['include'],function(_0x228b95){return{'model':db[_0x228b95[_0x607a('0x22')]],'as':_0x228b95['as'],'attributes':_0x228b95[_0x607a('0x1e')],'include':_0x228b95[_0x607a('0x21')]?_['map'](_0x228b95['include'],function(_0x5d4e80){return{'model':db[_0x5d4e80[_0x607a('0x22')]],'as':_0x5d4e80['as'],'attributes':_0x5d4e80[_0x607a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x607a('0x26')](function(_0x5142ed){logger['info']('ShowChatQueue',_0x42e612);logger[_0x607a('0x12')]('ShowChatQueue',_0x42e612,JSON[_0x607a('0x14')](_0x5142ed));_0x25be66(_0x5142ed);})[_0x607a('0x19')](function(_0x2616e0){logger[_0x607a('0x15')](_0x607a('0x24'),_0x2616e0[_0x607a('0x17')],_0x42e612);_0x23e842(_0x42d904[_0x607a('0x15')](0x1f4,_0x2616e0[_0x607a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 4361eab..34df126 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 f7b5338..06d2762 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 _0x8d75=['destroy','removeTeams','removeAgents','exports','multer','path','Router','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getAgents','addTeams','post','/:id/users','addAgents','put','/:id','update','delete'];(function(_0x14991d,_0x1e10e6){var _0x3b2047=function(_0xc64128){while(--_0xc64128){_0x14991d['push'](_0x14991d['shift']());}};_0x3b2047(++_0x1e10e6);}(_0x8d75,0x17b));var _0x58d7=function(_0x4429e9,_0x4bb9cf){_0x4429e9=_0x4429e9-0x0;var _0x1a70b3=_0x8d75[_0x4429e9];return _0x1a70b3;};'use strict';var multer=require(_0x58d7('0x0'));var util=require('util');var path=require(_0x58d7('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x58d7('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatQueue.controller');router[_0x58d7('0x3')]('/',auth[_0x58d7('0x4')](),controller[_0x58d7('0x5')]);router[_0x58d7('0x3')](_0x58d7('0x6'),auth[_0x58d7('0x4')](),controller[_0x58d7('0x7')]);router[_0x58d7('0x3')]('/:id',auth[_0x58d7('0x4')](),controller[_0x58d7('0x8')]);router[_0x58d7('0x3')](_0x58d7('0x9'),auth[_0x58d7('0x4')](),controller[_0x58d7('0xa')]);router[_0x58d7('0x3')](_0x58d7('0xb'),auth[_0x58d7('0x4')](),controller['getTeams']);router[_0x58d7('0x3')]('/:id/users',auth[_0x58d7('0x4')](),controller[_0x58d7('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0x58d7('0xd')]);router[_0x58d7('0xe')](_0x58d7('0xf'),auth[_0x58d7('0x4')](),controller[_0x58d7('0x10')]);router[_0x58d7('0x11')](_0x58d7('0x12'),auth[_0x58d7('0x4')](),controller[_0x58d7('0x13')]);router[_0x58d7('0x14')](_0x58d7('0x12'),auth[_0x58d7('0x4')](),controller[_0x58d7('0x15')]);router['delete'](_0x58d7('0xb'),auth[_0x58d7('0x4')](),controller[_0x58d7('0x16')]);router[_0x58d7('0x14')](_0x58d7('0xf'),auth['isAuthenticated'](),controller[_0x58d7('0x17')]);module[_0x58d7('0x18')]=router; \ No newline at end of file +var _0x947e=['/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','post','create','addAgents','update','delete','/:id','destroy','removeTeams','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated'];(function(_0x4c4037,_0x15054b){var _0x357862=function(_0x480015){while(--_0x480015){_0x4c4037['push'](_0x4c4037['shift']());}};_0x357862(++_0x15054b);}(_0x947e,0x146));var _0xe947=function(_0x4dae51,_0x461cfa){_0x4dae51=_0x4dae51-0x0;var _0x755ff1=_0x947e[_0x4dae51];return _0x755ff1;};'use strict';var multer=require(_0xe947('0x0'));var util=require(_0xe947('0x1'));var path=require(_0xe947('0x2'));var timeout=require(_0xe947('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xe947('0x4'));var interaction=require(_0xe947('0x5'));var config=require(_0xe947('0x6'));var controller=require(_0xe947('0x7'));router[_0xe947('0x8')]('/',auth[_0xe947('0x9')](),controller['index']);router[_0xe947('0x8')](_0xe947('0xa'),auth[_0xe947('0x9')](),controller[_0xe947('0xb')]);router[_0xe947('0x8')]('/:id',auth[_0xe947('0x9')](),controller[_0xe947('0xc')]);router[_0xe947('0x8')](_0xe947('0xd'),auth[_0xe947('0x9')](),controller[_0xe947('0xe')]);router[_0xe947('0x8')](_0xe947('0xf'),auth[_0xe947('0x9')](),controller[_0xe947('0x10')]);router[_0xe947('0x8')]('/:id/users',auth[_0xe947('0x9')](),controller['getAgents']);router[_0xe947('0x11')]('/',auth[_0xe947('0x9')](),controller[_0xe947('0x12')]);router[_0xe947('0x11')](_0xe947('0xf'),auth['isAuthenticated'](),controller['addTeams']);router[_0xe947('0x11')]('/:id/users',auth[_0xe947('0x9')](),controller[_0xe947('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xe947('0x14')]);router[_0xe947('0x15')](_0xe947('0x16'),auth['isAuthenticated'](),controller[_0xe947('0x17')]);router[_0xe947('0x15')](_0xe947('0xf'),auth[_0xe947('0x9')](),controller[_0xe947('0x18')]);router['delete'](_0xe947('0x19'),auth[_0xe947('0x9')](),controller[_0xe947('0x1a')]);module[_0xe947('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 011606a..90c3428 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 _0x511a=['sequelize','exports','STRING','DATE'];(function(_0x2f5158,_0x1a9325){var _0x5aa921=function(_0x7888f4){while(--_0x7888f4){_0x2f5158['push'](_0x2f5158['shift']());}};_0x5aa921(++_0x1a9325);}(_0x511a,0x1b0));var _0xa511=function(_0x59889b,_0xbf8260){_0x59889b=_0x59889b-0x0;var _0x4cdda9=_0x511a[_0x59889b];return _0x4cdda9;};'use strict';var moment=require('moment');var Sequelize=require(_0xa511('0x0'));module[_0xa511('0x1')]={'uniqueid':{'type':Sequelize[_0xa511('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa511('0x2')]},'joinAt':{'type':Sequelize[_0xa511('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa511('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa511('0x2')]}}; \ No newline at end of file +var _0xc59c=['exports','STRING','DATE','sequelize'];(function(_0x4bcc6a,_0x3d5fc2){var _0x31e476=function(_0x5f1bde){while(--_0x5f1bde){_0x4bcc6a['push'](_0x4bcc6a['shift']());}};_0x31e476(++_0x3d5fc2);}(_0xc59c,0xc3));var _0xcc59=function(_0x53ed59,_0x4beb34){_0x53ed59=_0x53ed59-0x0;var _0x5834ca=_0xc59c[_0x53ed59];return _0x5834ca;};'use strict';var moment=require('moment');var Sequelize=require(_0xcc59('0x0'));module[_0xcc59('0x1')]={'uniqueid':{'type':Sequelize[_0xcc59('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xcc59('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xcc59('0x3')]},'exitAt':{'type':Sequelize[_0xcc59('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 7bda7b4..cb05b80 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 _0x605d=['../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','end','error','name','send','index','ChatQueueReport','rawAttributes','model','keys','filters','query','intersection','fields','attributes','length','nolimit','order','sort','pick','where','merge','map','type','key','filter','options','include','findAll','catch','show','params','includeAll','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x605d,0xc5));var _0xd605=function(_0x33654f,_0x1313a8){_0x33654f=_0x33654f-0x0;var _0x1e01b4=_0x605d[_0x33654f];return _0x1e01b4;};'use strict';var pdf=require(_0xd605('0x0'));var emlformat=require(_0xd605('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd605('0x2'));var jsonpatch=require(_0xd605('0x3'));var rp=require('request-promise');var moment=require(_0xd605('0x4'));var BPromise=require(_0xd605('0x5'));var Mustache=require(_0xd605('0x6'));var util=require(_0xd605('0x7'));var path=require(_0xd605('0x8'));var sox=require('sox');var csv=require(_0xd605('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd605('0xa'));var squel=require('squel');var crypto=require(_0xd605('0xb'));var jsforce=require(_0xd605('0xc'));var deskjs=require(_0xd605('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd605('0xe'));var Papa=require(_0xd605('0xf'));var authService=require(_0xd605('0x10'));var hardwareService=require(_0xd605('0x11'));var Redis=require('ioredis');var qs=require(_0xd605('0x12'));var logger=require(_0xd605('0x13'))(_0xd605('0x14'));var utils=require(_0xd605('0x15'));var config=require(_0xd605('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8f7988,_0x217c63){_0x217c63=_0x217c63||0xcc;return function(_0x5c04c6){if(_0x5c04c6){return _0x8f7988[_0xd605('0x17')](_0x217c63);}return _0x8f7988[_0xd605('0x18')](_0x217c63)['end']();};}function respondWithResult(_0x230711,_0xf57ebf){_0xf57ebf=_0xf57ebf||0xc8;return function(_0x15874b){if(_0x15874b){return _0x230711['status'](_0xf57ebf)[_0xd605('0x19')](_0x15874b);}};}function respondWithFilteredResult(_0x222095,_0x3482b7){return function(_0x2ff974){if(_0x2ff974){var _0x332e23=_0x2ff974[_0xd605('0x1a')],_0x424433=_0x3482b7[_0xd605('0x1b')],_0x51049b=_0x3482b7[_0xd605('0x1b')]+_0x3482b7[_0xd605('0x1c')],_0x34ad83;if(_0x51049b>=_0x332e23){_0x51049b=_0x332e23;_0x34ad83=0xc8;}else{_0x34ad83=0xce;}_0x222095[_0xd605('0x18')](_0x34ad83);return _0x222095['set'](_0xd605('0x1d'),_0x424433+'-'+_0x51049b+'/'+_0x332e23)[_0xd605('0x19')](_0x2ff974);}return null;};}function patchUpdates(_0x22615d){return function(_0x2fb19d){try{jsonpatch[_0xd605('0x1e')](_0x2fb19d,_0x22615d,!![]);}catch(_0x228745){return BPromise[_0xd605('0x1f')](_0x228745);}return _0x2fb19d[_0xd605('0x20')]();};}function saveUpdates(_0x42de8f,_0x490202){return function(_0x4ecc46){if(_0x4ecc46){return _0x4ecc46[_0xd605('0x21')](_0x42de8f)[_0xd605('0x22')](function(_0x5a5b35){return _0x5a5b35;});}return null;};}function removeEntity(_0x3e3d1c,_0x467ccd){return function(_0x1a1edc){if(_0x1a1edc){return _0x1a1edc['destroy']()[_0xd605('0x22')](function(){_0x3e3d1c['status'](0xcc)[_0xd605('0x23')]();});}};}function handleEntityNotFound(_0x454697,_0x24402b){return function(_0x5c6db4){if(!_0x5c6db4){_0x454697[_0xd605('0x17')](0x194);}return _0x5c6db4;};}function handleError(_0x112e27,_0x482592){_0x482592=_0x482592||0x1f4;return function(_0x24fa39){logger[_0xd605('0x24')](_0x24fa39['stack']);if(_0x24fa39[_0xd605('0x25')]){delete _0x24fa39['name'];}_0x112e27[_0xd605('0x18')](_0x482592)[_0xd605('0x26')](_0x24fa39);};}exports[_0xd605('0x27')]=function(_0x289c4d,_0x14ea66){var _0x2aead5={},_0x14316c={},_0x26cb23={'count':0x0,'rows':[]};var _0x46b787=db[_0xd605('0x28')][_0xd605('0x29')];_0x14316c[_0xd605('0x2a')]=_[_0xd605('0x2b')](_0x46b787);_0x14316c['query']=_[_0xd605('0x2b')](_0x289c4d['query']);_0x14316c[_0xd605('0x2c')]=_['intersection'](_0x14316c['model'],_0x14316c[_0xd605('0x2d')]);_0x2aead5['attributes']=_[_0xd605('0x2e')](_0x14316c['model'],qs[_0xd605('0x2f')](_0x289c4d[_0xd605('0x2d')][_0xd605('0x2f')]));_0x2aead5[_0xd605('0x30')]=_0x2aead5[_0xd605('0x30')][_0xd605('0x31')]?_0x2aead5['attributes']:_0x14316c['model'];if(!_0x289c4d[_0xd605('0x2d')]['hasOwnProperty'](_0xd605('0x32'))){_0x2aead5[_0xd605('0x1c')]=qs['limit'](_0x289c4d[_0xd605('0x2d')][_0xd605('0x1c')]);_0x2aead5[_0xd605('0x1b')]=qs[_0xd605('0x1b')](_0x289c4d['query'][_0xd605('0x1b')]);}_0x2aead5[_0xd605('0x33')]=qs[_0xd605('0x34')](_0x289c4d[_0xd605('0x2d')][_0xd605('0x34')]);_0x2aead5['where']=qs[_0xd605('0x2c')](_[_0xd605('0x35')](_0x289c4d[_0xd605('0x2d')],_0x14316c[_0xd605('0x2c')]));if(_0x289c4d[_0xd605('0x2d')]['filter']){_0x2aead5[_0xd605('0x36')]=_[_0xd605('0x37')](_0x2aead5['where'],{'$or':_[_0xd605('0x38')](_0x46b787,function(_0x5adaf8){if(_0x5adaf8[_0xd605('0x39')][_0xd605('0x3a')]!=='VIRTUAL'){var _0x350afa={};_0x350afa[_0x5adaf8['field']]={'$like':'%'+_0x289c4d['query'][_0xd605('0x3b')]+'%'};return _0x350afa;}})});}_0x2aead5=_[_0xd605('0x37')]({},_0x2aead5,_0x289c4d[_0xd605('0x3c')]);var _0x5edc47={'where':_0x2aead5[_0xd605('0x36')]};return db[_0xd605('0x28')][_0xd605('0x1a')](_0x5edc47)[_0xd605('0x22')](function(_0x47c43d){_0x26cb23[_0xd605('0x1a')]=_0x47c43d;if(_0x289c4d[_0xd605('0x2d')]['includeAll']){_0x2aead5[_0xd605('0x3d')]=[{'all':!![]}];}return db[_0xd605('0x28')][_0xd605('0x3e')](_0x2aead5);})[_0xd605('0x22')](function(_0x3eb4a8){_0x26cb23['rows']=_0x3eb4a8;return _0x26cb23;})['then'](respondWithFilteredResult(_0x14ea66,_0x2aead5))[_0xd605('0x3f')](handleError(_0x14ea66,null));};exports[_0xd605('0x40')]=function(_0x455f71,_0x124b18){var _0x34738a={'raw':!![],'where':{'id':_0x455f71[_0xd605('0x41')]['id']}},_0x58d106={};_0x58d106[_0xd605('0x2a')]=_[_0xd605('0x2b')](db[_0xd605('0x28')][_0xd605('0x29')]);_0x58d106[_0xd605('0x2d')]=_[_0xd605('0x2b')](_0x455f71[_0xd605('0x2d')]);_0x58d106[_0xd605('0x2c')]=_[_0xd605('0x2e')](_0x58d106[_0xd605('0x2a')],_0x58d106['query']);_0x34738a['attributes']=_['intersection'](_0x58d106[_0xd605('0x2a')],qs[_0xd605('0x2f')](_0x455f71[_0xd605('0x2d')][_0xd605('0x2f')]));_0x34738a[_0xd605('0x30')]=_0x34738a[_0xd605('0x30')][_0xd605('0x31')]?_0x34738a[_0xd605('0x30')]:_0x58d106['model'];if(_0x455f71['query'][_0xd605('0x42')]){_0x34738a[_0xd605('0x3d')]=[{'all':!![]}];}_0x34738a=_[_0xd605('0x37')]({},_0x34738a,_0x455f71[_0xd605('0x3c')]);return db['ChatQueueReport'][_0xd605('0x43')](_0x34738a)[_0xd605('0x22')](handleEntityNotFound(_0x124b18,null))['then'](respondWithResult(_0x124b18,null))['catch'](handleError(_0x124b18,null));};exports[_0xd605('0x44')]=function(_0x4d0bb7,_0x3f9c5b){return db[_0xd605('0x28')][_0xd605('0x44')](_0x4d0bb7['body'],{})[_0xd605('0x22')](respondWithResult(_0x3f9c5b,0xc9))[_0xd605('0x3f')](handleError(_0x3f9c5b,null));};exports[_0xd605('0x21')]=function(_0x43c194,_0xcccaf3){if(_0x43c194[_0xd605('0x45')]['id']){delete _0x43c194['body']['id'];}return db['ChatQueueReport'][_0xd605('0x43')]({'where':{'id':_0x43c194[_0xd605('0x41')]['id']}})[_0xd605('0x22')](handleEntityNotFound(_0xcccaf3,null))[_0xd605('0x22')](saveUpdates(_0x43c194[_0xd605('0x45')],null))[_0xd605('0x22')](respondWithResult(_0xcccaf3,null))[_0xd605('0x3f')](handleError(_0xcccaf3,null));};exports['destroy']=function(_0xab9737,_0x3b0150){return db[_0xd605('0x28')]['find']({'where':{'id':_0xab9737[_0xd605('0x41')]['id']}})['then'](handleEntityNotFound(_0x3b0150,null))[_0xd605('0x22')](removeEntity(_0x3b0150,null))[_0xd605('0x3f')](handleError(_0x3b0150,null));};exports[_0xd605('0x46')]=function(_0x3d08a3,_0x53eb2d){return db[_0xd605('0x28')][_0xd605('0x46')]()[_0xd605('0x22')](respondWithResult(_0x53eb2d,null))['catch'](handleError(_0x53eb2d,null));}; \ No newline at end of file +var _0xa835=['query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','map','key','VIRTUAL','field','options','count','include','findAll','params','includeAll','find','catch','create','body','describe','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','index','ChatQueueReport','rawAttributes','model','keys'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa835,0x174));var _0x5a83=function(_0x47d855,_0x199f11){_0x47d855=_0x47d855-0x0;var _0x47393a=_0xa835[_0x47d855];return _0x47393a;};'use strict';var pdf=require(_0x5a83('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5a83('0x1'));var rp=require(_0x5a83('0x2'));var moment=require(_0x5a83('0x3'));var BPromise=require(_0x5a83('0x4'));var Mustache=require(_0x5a83('0x5'));var util=require(_0x5a83('0x6'));var path=require(_0x5a83('0x7'));var sox=require('sox');var csv=require(_0x5a83('0x8'));var ejs=require(_0x5a83('0x9'));var fs=require('fs');var _=require(_0x5a83('0xa'));var squel=require(_0x5a83('0xb'));var crypto=require(_0x5a83('0xc'));var jsforce=require(_0x5a83('0xd'));var deskjs=require(_0x5a83('0xe'));var toCsv=require(_0x5a83('0x8'));var querystring=require(_0x5a83('0xf'));var Papa=require(_0x5a83('0x10'));var authService=require('../../components/auth/service');var hardwareService=require(_0x5a83('0x11'));var Redis=require(_0x5a83('0x12'));var qs=require(_0x5a83('0x13'));var logger=require(_0x5a83('0x14'))('api');var utils=require(_0x5a83('0x15'));var config=require(_0x5a83('0x16'));var db=require(_0x5a83('0x17'))['db'];function respondWithStatusCode(_0x2c4a11,_0x2ef568){_0x2ef568=_0x2ef568||0xcc;return function(_0x188c76){if(_0x188c76){return _0x2c4a11['sendStatus'](_0x2ef568);}return _0x2c4a11[_0x5a83('0x18')](_0x2ef568)['end']();};}function respondWithResult(_0x1b8942,_0x346ab2){_0x346ab2=_0x346ab2||0xc8;return function(_0x502497){if(_0x502497){return _0x1b8942['status'](_0x346ab2)[_0x5a83('0x19')](_0x502497);}};}function respondWithFilteredResult(_0x47e767,_0x254225){return function(_0x35bd18){if(_0x35bd18){var _0x84fa9=_0x35bd18['count'],_0x59f30c=_0x254225['offset'],_0x8a45eb=_0x254225[_0x5a83('0x1a')]+_0x254225['limit'],_0x5eb8b1;if(_0x8a45eb>=_0x84fa9){_0x8a45eb=_0x84fa9;_0x5eb8b1=0xc8;}else{_0x5eb8b1=0xce;}_0x47e767['status'](_0x5eb8b1);return _0x47e767['set'](_0x5a83('0x1b'),_0x59f30c+'-'+_0x8a45eb+'/'+_0x84fa9)[_0x5a83('0x19')](_0x35bd18);}return null;};}function patchUpdates(_0x40cd2c){return function(_0x454222){try{jsonpatch['apply'](_0x454222,_0x40cd2c,!![]);}catch(_0x45c806){return BPromise[_0x5a83('0x1c')](_0x45c806);}return _0x454222[_0x5a83('0x1d')]();};}function saveUpdates(_0x221e1d,_0x21d18a){return function(_0x1c226b){if(_0x1c226b){return _0x1c226b[_0x5a83('0x1e')](_0x221e1d)[_0x5a83('0x1f')](function(_0x5efb22){return _0x5efb22;});}return null;};}function removeEntity(_0x16c8aa,_0x45a4d1){return function(_0x444722){if(_0x444722){return _0x444722[_0x5a83('0x20')]()[_0x5a83('0x1f')](function(){_0x16c8aa[_0x5a83('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x420589,_0x1624a3){return function(_0x120f4b){if(!_0x120f4b){_0x420589[_0x5a83('0x21')](0x194);}return _0x120f4b;};}function handleError(_0x378e16,_0x137adc){_0x137adc=_0x137adc||0x1f4;return function(_0x3b22d5){logger['error'](_0x3b22d5[_0x5a83('0x22')]);if(_0x3b22d5[_0x5a83('0x23')]){delete _0x3b22d5[_0x5a83('0x23')];}_0x378e16[_0x5a83('0x18')](_0x137adc)[_0x5a83('0x24')](_0x3b22d5);};}exports[_0x5a83('0x25')]=function(_0x39ec54,_0x28233e){var _0x11e15f={},_0x16fa3c={},_0x59063c={'count':0x0,'rows':[]};var _0x27fe6e=db[_0x5a83('0x26')][_0x5a83('0x27')];_0x16fa3c[_0x5a83('0x28')]=_[_0x5a83('0x29')](_0x27fe6e);_0x16fa3c['query']=_[_0x5a83('0x29')](_0x39ec54[_0x5a83('0x2a')]);_0x16fa3c['filters']=_[_0x5a83('0x2b')](_0x16fa3c[_0x5a83('0x28')],_0x16fa3c[_0x5a83('0x2a')]);_0x11e15f[_0x5a83('0x2c')]=_[_0x5a83('0x2b')](_0x16fa3c['model'],qs[_0x5a83('0x2d')](_0x39ec54[_0x5a83('0x2a')]['fields']));_0x11e15f['attributes']=_0x11e15f[_0x5a83('0x2c')][_0x5a83('0x2e')]?_0x11e15f[_0x5a83('0x2c')]:_0x16fa3c[_0x5a83('0x28')];if(!_0x39ec54[_0x5a83('0x2a')]['hasOwnProperty'](_0x5a83('0x2f'))){_0x11e15f['limit']=qs['limit'](_0x39ec54['query']['limit']);_0x11e15f[_0x5a83('0x1a')]=qs[_0x5a83('0x1a')](_0x39ec54['query'][_0x5a83('0x1a')]);}_0x11e15f[_0x5a83('0x30')]=qs[_0x5a83('0x31')](_0x39ec54[_0x5a83('0x2a')][_0x5a83('0x31')]);_0x11e15f[_0x5a83('0x32')]=qs[_0x5a83('0x33')](_[_0x5a83('0x34')](_0x39ec54[_0x5a83('0x2a')],_0x16fa3c[_0x5a83('0x33')]));if(_0x39ec54[_0x5a83('0x2a')]['filter']){_0x11e15f['where']=_[_0x5a83('0x35')](_0x11e15f['where'],{'$or':_[_0x5a83('0x36')](_0x27fe6e,function(_0x5154bb){if(_0x5154bb['type'][_0x5a83('0x37')]!==_0x5a83('0x38')){var _0x310dbc={};_0x310dbc[_0x5154bb[_0x5a83('0x39')]]={'$like':'%'+_0x39ec54[_0x5a83('0x2a')]['filter']+'%'};return _0x310dbc;}})});}_0x11e15f=_[_0x5a83('0x35')]({},_0x11e15f,_0x39ec54[_0x5a83('0x3a')]);var _0x2fde8d={'where':_0x11e15f['where']};return db[_0x5a83('0x26')][_0x5a83('0x3b')](_0x2fde8d)[_0x5a83('0x1f')](function(_0x26826e){_0x59063c[_0x5a83('0x3b')]=_0x26826e;if(_0x39ec54[_0x5a83('0x2a')]['includeAll']){_0x11e15f[_0x5a83('0x3c')]=[{'all':!![]}];}return db[_0x5a83('0x26')][_0x5a83('0x3d')](_0x11e15f);})[_0x5a83('0x1f')](function(_0x517aef){_0x59063c['rows']=_0x517aef;return _0x59063c;})[_0x5a83('0x1f')](respondWithFilteredResult(_0x28233e,_0x11e15f))['catch'](handleError(_0x28233e,null));};exports['show']=function(_0x9095d0,_0x5f72b2){var _0x2966f6={'raw':!![],'where':{'id':_0x9095d0[_0x5a83('0x3e')]['id']}},_0x20de47={};_0x20de47[_0x5a83('0x28')]=_[_0x5a83('0x29')](db[_0x5a83('0x26')][_0x5a83('0x27')]);_0x20de47['query']=_[_0x5a83('0x29')](_0x9095d0[_0x5a83('0x2a')]);_0x20de47['filters']=_[_0x5a83('0x2b')](_0x20de47[_0x5a83('0x28')],_0x20de47[_0x5a83('0x2a')]);_0x2966f6[_0x5a83('0x2c')]=_[_0x5a83('0x2b')](_0x20de47[_0x5a83('0x28')],qs[_0x5a83('0x2d')](_0x9095d0[_0x5a83('0x2a')][_0x5a83('0x2d')]));_0x2966f6[_0x5a83('0x2c')]=_0x2966f6[_0x5a83('0x2c')][_0x5a83('0x2e')]?_0x2966f6[_0x5a83('0x2c')]:_0x20de47[_0x5a83('0x28')];if(_0x9095d0['query'][_0x5a83('0x3f')]){_0x2966f6[_0x5a83('0x3c')]=[{'all':!![]}];}_0x2966f6=_[_0x5a83('0x35')]({},_0x2966f6,_0x9095d0[_0x5a83('0x3a')]);return db[_0x5a83('0x26')][_0x5a83('0x40')](_0x2966f6)[_0x5a83('0x1f')](handleEntityNotFound(_0x5f72b2,null))[_0x5a83('0x1f')](respondWithResult(_0x5f72b2,null))[_0x5a83('0x41')](handleError(_0x5f72b2,null));};exports[_0x5a83('0x42')]=function(_0x5f5954,_0x42519e){return db[_0x5a83('0x26')]['create'](_0x5f5954[_0x5a83('0x43')],{})['then'](respondWithResult(_0x42519e,0xc9))[_0x5a83('0x41')](handleError(_0x42519e,null));};exports[_0x5a83('0x1e')]=function(_0x34737e,_0x5c8323){if(_0x34737e[_0x5a83('0x43')]['id']){delete _0x34737e[_0x5a83('0x43')]['id'];}return db[_0x5a83('0x26')][_0x5a83('0x40')]({'where':{'id':_0x34737e[_0x5a83('0x3e')]['id']}})[_0x5a83('0x1f')](handleEntityNotFound(_0x5c8323,null))[_0x5a83('0x1f')](saveUpdates(_0x34737e[_0x5a83('0x43')],null))[_0x5a83('0x1f')](respondWithResult(_0x5c8323,null))[_0x5a83('0x41')](handleError(_0x5c8323,null));};exports[_0x5a83('0x20')]=function(_0x3629c6,_0x479b56){return db[_0x5a83('0x26')][_0x5a83('0x40')]({'where':{'id':_0x3629c6[_0x5a83('0x3e')]['id']}})['then'](handleEntityNotFound(_0x479b56,null))[_0x5a83('0x1f')](removeEntity(_0x479b56,null))[_0x5a83('0x41')](handleError(_0x479b56,null));};exports[_0x5a83('0x44')]=function(_0x388060,_0x2bbe37){return db['ChatQueueReport']['describe']()['then'](respondWithResult(_0x2bbe37,null))[_0x5a83('0x41')](handleError(_0x2bbe37,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 22abbe9..8c938bd 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 _0x5fc3=['moment','bluebird','request-promise','./chatQueueReport.attributes','define','uniqueid','lodash','util','api'];(function(_0x466247,_0x5d69e3){var _0x4b352e=function(_0x58c71b){while(--_0x58c71b){_0x466247['push'](_0x466247['shift']());}};_0x4b352e(++_0x5d69e3);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2b9cf5,_0x2a7804){_0x2b9cf5=_0x2b9cf5-0x0;var _0xd0cf15=_0x5fc3[_0x2b9cf5];return _0xd0cf15;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var attributes=require(_0x35fc('0x6'));module['exports']=function(_0x2d1404,_0x1d5fec){return _0x2d1404[_0x35fc('0x7')]('ChatQueueReport',attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x35fc('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['ChatQueueReport','report_chat_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','./chatQueueReport.attributes','exports','define'];(function(_0x1c7586,_0x1d46bd){var _0x3bd9a1=function(_0x2f2d4d){while(--_0x2f2d4d){_0x1c7586['push'](_0x1c7586['shift']());}};_0x3bd9a1(++_0x1d46bd);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var attributes=require(_0x7995('0x6'));module[_0x7995('0x7')]=function(_0x576d89,_0x744bea){return _0x576d89[_0x7995('0x8')](_0x7995('0x9'),attributes,{'tableName':_0x7995('0xa'),'paranoid':![],'indexes':[{'name':_0x7995('0xb'),'fields':[_0x7995('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 1a53cc6..4ff6cfc 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 _0x3e00=['then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','debug','UpdateChatQueueReport','update','attributes','lodash','util','moment','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request'];(function(_0x50f0b8,_0x30b8e3){var _0x4a4b11=function(_0x6503c9){while(--_0x6503c9){_0x50f0b8['push'](_0x50f0b8['shift']());}};_0x4a4b11(++_0x30b8e3);}(_0x3e00,0xc8));var _0x03e0=function(_0x5ea970,_0x3227f8){_0x5ea970=_0x5ea970-0x0;var _0x501704=_0x3e00[_0x5ea970];return _0x501704;};'use strict';var _=require(_0x03e0('0x0'));var util=require(_0x03e0('0x1'));var moment=require(_0x03e0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x03e0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x03e0('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x03e0('0x5'));var jayson=require(_0x03e0('0x6'));var client=jayson[_0x03e0('0x7')][_0x03e0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4daaf1,_0x66c63f,_0x28f726){return new BPromise(function(_0x1cb843,_0x3db5a7){return client[_0x03e0('0x9')](_0x4daaf1,_0x28f726)[_0x03e0('0xa')](function(_0x1cc8cf){logger[_0x03e0('0xb')](_0x03e0('0xc'),_0x66c63f,_0x03e0('0xd'));logger['debug'](_0x03e0('0xe'),_0x66c63f,_0x03e0('0xd'),JSON[_0x03e0('0xf')](_0x1cc8cf));if(_0x1cc8cf[_0x03e0('0x10')]){if(_0x1cc8cf['error'][_0x03e0('0x11')]===0x1f4){logger[_0x03e0('0x10')](_0x03e0('0xc'),_0x66c63f,_0x1cc8cf[_0x03e0('0x10')][_0x03e0('0x12')]);return _0x3db5a7(_0x1cc8cf['error'][_0x03e0('0x12')]);}logger[_0x03e0('0x10')](_0x03e0('0xc'),_0x66c63f,_0x1cc8cf[_0x03e0('0x10')][_0x03e0('0x12')]);return _0x1cb843(_0x1cc8cf[_0x03e0('0x10')][_0x03e0('0x12')]);}else{logger['info'](_0x03e0('0xc'),_0x66c63f,_0x03e0('0xd'));_0x1cb843(_0x1cc8cf[_0x03e0('0x13')][_0x03e0('0x12')]);}})[_0x03e0('0x14')](function(_0x5b76be){logger[_0x03e0('0x10')](_0x03e0('0xc'),_0x66c63f,_0x5b76be);_0x3db5a7(_0x5b76be);});});}exports[_0x03e0('0x15')]=function(_0x2e3f8c){var _0x1bcea6=this;return new Promise(function(_0x25505e,_0x1c5666){return db[_0x03e0('0x16')]['create'](_0x2e3f8c[_0x03e0('0x17')],{'raw':_0x2e3f8c[_0x03e0('0x18')]?_0x2e3f8c[_0x03e0('0x18')][_0x03e0('0x19')]===undefined?!![]:![]:!![]})[_0x03e0('0xa')](function(_0x2640b4){logger[_0x03e0('0xb')](_0x03e0('0x15'),_0x2e3f8c);logger[_0x03e0('0x1a')](_0x03e0('0x15'),_0x2e3f8c,JSON[_0x03e0('0xf')](_0x2640b4));_0x25505e(_0x2640b4);})[_0x03e0('0x14')](function(_0x3f38d9){logger['error']('CreateChatQueueReport',_0x3f38d9[_0x03e0('0x12')],_0x2e3f8c);_0x1c5666(_0x1bcea6[_0x03e0('0x10')](0x1f4,_0x3f38d9['message']));});});};exports[_0x03e0('0x1b')]=function(_0x122a58){var _0x4b5720=this;return new Promise(function(_0x5837d1,_0x1df56a){return db[_0x03e0('0x16')][_0x03e0('0x1c')](_0x122a58[_0x03e0('0x17')],{'raw':_0x122a58['options']?_0x122a58['options'][_0x03e0('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x122a58[_0x03e0('0x18')]?_0x122a58[_0x03e0('0x18')]['where']||null:null,'attributes':_0x122a58[_0x03e0('0x18')]?_0x122a58[_0x03e0('0x18')][_0x03e0('0x1d')]||null:null,'limit':_0x122a58[_0x03e0('0x18')]?_0x122a58[_0x03e0('0x18')]['limit']||null:null})[_0x03e0('0xa')](function(_0x3e60f1){logger[_0x03e0('0xb')](_0x03e0('0x1b'),_0x122a58);logger[_0x03e0('0x1a')](_0x03e0('0x1b'),_0x122a58,JSON[_0x03e0('0xf')](_0x3e60f1));_0x5837d1(_0x3e60f1);})[_0x03e0('0x14')](function(_0xca99d8){logger[_0x03e0('0x10')](_0x03e0('0x1b'),_0xca99d8[_0x03e0('0x12')],_0x122a58);_0x1df56a(_0x4b5720[_0x03e0('0x10')](0x1f4,_0xca99d8[_0x03e0('0x12')]));});});}; \ No newline at end of file +var _0xead9=['ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','then','stringify','where','attributes','limit','UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1d07cf,_0x2a9897){var _0x2538fb=function(_0xaadc39){while(--_0xaadc39){_0x1d07cf['push'](_0x1d07cf['shift']());}};_0x2538fb(++_0x2a9897);}(_0xead9,0x74));var _0x9ead=function(_0x4fea90,_0x587fb7){_0x4fea90=_0x4fea90-0x0;var _0x79fb44=_0xead9[_0x4fea90];return _0x79fb44;};'use strict';var _=require(_0x9ead('0x0'));var util=require(_0x9ead('0x1'));var moment=require(_0x9ead('0x2'));var BPromise=require(_0x9ead('0x3'));var rs=require(_0x9ead('0x4'));var fs=require('fs');var Redis=require(_0x9ead('0x5'));var db=require(_0x9ead('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9ead('0x7'))(_0x9ead('0x8'));var config=require(_0x9ead('0x9'));var jayson=require(_0x9ead('0xa'));var client=jayson[_0x9ead('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x471af1,_0x391380,_0x189b3b){return new BPromise(function(_0x57110e,_0x48da2d){return client['request'](_0x471af1,_0x189b3b)['then'](function(_0x3feac1){logger[_0x9ead('0xc')](_0x9ead('0xd'),_0x391380,_0x9ead('0xe'));logger[_0x9ead('0xf')](_0x9ead('0x10'),_0x391380,_0x9ead('0xe'),JSON['stringify'](_0x3feac1));if(_0x3feac1[_0x9ead('0x11')]){if(_0x3feac1['error'][_0x9ead('0x12')]===0x1f4){logger[_0x9ead('0x11')](_0x9ead('0xd'),_0x391380,_0x3feac1['error'][_0x9ead('0x13')]);return _0x48da2d(_0x3feac1[_0x9ead('0x11')][_0x9ead('0x13')]);}logger['error'](_0x9ead('0xd'),_0x391380,_0x3feac1[_0x9ead('0x11')][_0x9ead('0x13')]);return _0x57110e(_0x3feac1[_0x9ead('0x11')][_0x9ead('0x13')]);}else{logger[_0x9ead('0xc')](_0x9ead('0xd'),_0x391380,'request\x20sent');_0x57110e(_0x3feac1[_0x9ead('0x14')][_0x9ead('0x13')]);}})[_0x9ead('0x15')](function(_0x52502f){logger[_0x9ead('0x11')](_0x9ead('0xd'),_0x391380,_0x52502f);_0x48da2d(_0x52502f);});});}exports[_0x9ead('0x16')]=function(_0x4399b0){var _0x5e929d=this;return new Promise(function(_0x211d0a,_0x23c238){return db[_0x9ead('0x17')][_0x9ead('0x18')](_0x4399b0['body'],{'raw':_0x4399b0['options']?_0x4399b0[_0x9ead('0x19')][_0x9ead('0x1a')]===undefined?!![]:![]:!![]})[_0x9ead('0x1b')](function(_0x45cc6b){logger[_0x9ead('0xc')]('CreateChatQueueReport',_0x4399b0);logger[_0x9ead('0xf')](_0x9ead('0x16'),_0x4399b0,JSON[_0x9ead('0x1c')](_0x45cc6b));_0x211d0a(_0x45cc6b);})[_0x9ead('0x15')](function(_0xd1b712){logger[_0x9ead('0x11')](_0x9ead('0x16'),_0xd1b712['message'],_0x4399b0);_0x23c238(_0x5e929d[_0x9ead('0x11')](0x1f4,_0xd1b712[_0x9ead('0x13')]));});});};exports['UpdateChatQueueReport']=function(_0x4ecfa4){var _0x5d8ba0=this;return new Promise(function(_0x1bcd75,_0xe7ed84){return db[_0x9ead('0x17')]['update'](_0x4ecfa4['body'],{'raw':_0x4ecfa4[_0x9ead('0x19')]?_0x4ecfa4[_0x9ead('0x19')][_0x9ead('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ecfa4[_0x9ead('0x19')]?_0x4ecfa4['options'][_0x9ead('0x1d')]||null:null,'attributes':_0x4ecfa4[_0x9ead('0x19')]?_0x4ecfa4[_0x9ead('0x19')][_0x9ead('0x1e')]||null:null,'limit':_0x4ecfa4[_0x9ead('0x19')]?_0x4ecfa4[_0x9ead('0x19')][_0x9ead('0x1f')]||null:null})[_0x9ead('0x1b')](function(_0x39be79){logger[_0x9ead('0xc')](_0x9ead('0x20'),_0x4ecfa4);logger[_0x9ead('0xf')]('UpdateChatQueueReport',_0x4ecfa4,JSON[_0x9ead('0x1c')](_0x39be79));_0x1bcd75(_0x39be79);})[_0x9ead('0x15')](function(_0x14aac5){logger[_0x9ead('0x11')](_0x9ead('0x20'),_0x14aac5['message'],_0x4ecfa4);_0xe7ed84(_0x5d8ba0[_0x9ead('0x11')](0x1f4,_0x14aac5[_0x9ead('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 3b712c8..31a6141 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 _0x99d4=['index','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated'];(function(_0x5aa3c1,_0x168c56){var _0x4dbfce=function(_0x38fe60){while(--_0x38fe60){_0x5aa3c1['push'](_0x5aa3c1['shift']());}};_0x4dbfce(++_0x168c56);}(_0x99d4,0x74));var _0x499d=function(_0x481f53,_0x2eae5b){_0x481f53=_0x481f53-0x0;var _0xe47aee=_0x99d4[_0x481f53];return _0xe47aee;};'use strict';var multer=require(_0x499d('0x0'));var util=require(_0x499d('0x1'));var path=require(_0x499d('0x2'));var timeout=require(_0x499d('0x3'));var express=require(_0x499d('0x4'));var router=express[_0x499d('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x499d('0x6'));var config=require('../../config/environment');var controller=require(_0x499d('0x7'));router[_0x499d('0x8')]('/',auth[_0x499d('0x9')](),controller[_0x499d('0xa')]);router['get']('/describe',auth[_0x499d('0x9')](),controller['describe']);router[_0x499d('0x8')](_0x499d('0xb'),auth[_0x499d('0x9')](),controller[_0x499d('0xc')]);router[_0x499d('0xd')]('/',auth[_0x499d('0x9')](),controller[_0x499d('0xe')]);router['put']('/:id',auth[_0x499d('0x9')](),controller['update']);router[_0x499d('0xf')](_0x499d('0xb'),auth[_0x499d('0x9')](),controller[_0x499d('0x10')]);module[_0x499d('0x11')]=router; \ No newline at end of file +var _0x48fc=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','exports','multer','path','Router','../../components/interaction/service','../../config/environment','./chatQueueReport.controller'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x48fc,0xc6));var _0xc48f=function(_0x1def55,_0x14ac6b){_0x1def55=_0x1def55-0x0;var _0x565468=_0x48fc[_0x1def55];return _0x565468;};'use strict';var multer=require(_0xc48f('0x0'));var util=require('util');var path=require(_0xc48f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc48f('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xc48f('0x3'));var config=require(_0xc48f('0x4'));var controller=require(_0xc48f('0x5'));router[_0xc48f('0x6')]('/',auth[_0xc48f('0x7')](),controller[_0xc48f('0x8')]);router['get'](_0xc48f('0x9'),auth[_0xc48f('0x7')](),controller[_0xc48f('0xa')]);router['get'](_0xc48f('0xb'),auth[_0xc48f('0x7')](),controller[_0xc48f('0xc')]);router[_0xc48f('0xd')]('/',auth[_0xc48f('0x7')](),controller[_0xc48f('0xe')]);router['put']('/:id',auth[_0xc48f('0x7')](),controller[_0xc48f('0xf')]);router['delete'](_0xc48f('0xb'),auth[_0xc48f('0x7')](),controller['destroy']);module[_0xc48f('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 43569b9..df01afe 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 _0x4822=['queue','DATE','NOW','moment','sequelize','exports','STRING','ENUM','account','agent'];(function(_0x24eb04,_0x360096){var _0x2243cf=function(_0x3dc6a2){while(--_0x3dc6a2){_0x24eb04['push'](_0x24eb04['shift']());}};_0x2243cf(++_0x360096);}(_0x4822,0x19d));var _0x2482=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0x4822[_0x4c6d6f];return _0x2d4478;};'use strict';var moment=require(_0x2482('0x0'));var Sequelize=require(_0x2482('0x1'));module[_0x2482('0x2')]={'uniqueid':{'type':Sequelize[_0x2482('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x2482('0x4')](_0x2482('0x5'),_0x2482('0x6'),_0x2482('0x7')),'allowNull':![],'defaultValue':_0x2482('0x7')},'transferredAt':{'type':Sequelize[_0x2482('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x2482('0x9')]}}; \ No newline at end of file +var _0xb244=['exports','ENUM','account','agent','queue','DATE','NOW','moment'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0xb244,0x1c7));var _0x4b24=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb244[_0x397e5f];return _0x5302b8;};'use strict';var moment=require(_0x4b24('0x0'));var Sequelize=require('sequelize');module[_0x4b24('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x4b24('0x2')](_0x4b24('0x3'),_0x4b24('0x4'),_0x4b24('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x4b24('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x4b24('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 20ae4db..d5399bc 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 _0x781f=['attributes','fields','hasOwnProperty','order','sort','where','pick','filter','map','type','key','field','merge','ChatTransferReport','count','includeAll','include','findAll','show','params','length','options','create','update','body','find','catch','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','set','apply','reject','then','destroy','error','stack','name','send','index','model','keys','query','filters','intersection'];(function(_0x44cf8b,_0x18e4dd){var _0x1c18b5=function(_0x5bb756){while(--_0x5bb756){_0x44cf8b['push'](_0x44cf8b['shift']());}};_0x1c18b5(++_0x18e4dd);}(_0x781f,0x13f));var _0xf781=function(_0x5b5cde,_0x1f7c5f){_0x5b5cde=_0x5b5cde-0x0;var _0x364ad2=_0x781f[_0x5b5cde];return _0x364ad2;};'use strict';var pdf=require(_0xf781('0x0'));var emlformat=require(_0xf781('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf781('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf781('0x3'));var moment=require(_0xf781('0x4'));var BPromise=require(_0xf781('0x5'));var Mustache=require(_0xf781('0x6'));var util=require(_0xf781('0x7'));var path=require(_0xf781('0x8'));var sox=require(_0xf781('0x9'));var csv=require(_0xf781('0xa'));var ejs=require(_0xf781('0xb'));var fs=require('fs');var _=require(_0xf781('0xc'));var squel=require(_0xf781('0xd'));var crypto=require(_0xf781('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf781('0xf'));var toCsv=require(_0xf781('0xa'));var querystring=require('querystring');var Papa=require(_0xf781('0x10'));var authService=require(_0xf781('0x11'));var hardwareService=require(_0xf781('0x12'));var Redis=require(_0xf781('0x13'));var qs=require(_0xf781('0x14'));var logger=require(_0xf781('0x15'))(_0xf781('0x16'));var utils=require(_0xf781('0x17'));var config=require(_0xf781('0x18'));var db=require(_0xf781('0x19'))['db'];function respondWithStatusCode(_0x2e960f,_0x25bac5){_0x25bac5=_0x25bac5||0xcc;return function(_0x1a96ec){if(_0x1a96ec){return _0x2e960f['sendStatus'](_0x25bac5);}return _0x2e960f['status'](_0x25bac5)[_0xf781('0x1a')]();};}function respondWithResult(_0x57e1db,_0x4f174a){_0x4f174a=_0x4f174a||0xc8;return function(_0x5db85e){if(_0x5db85e){return _0x57e1db[_0xf781('0x1b')](_0x4f174a)[_0xf781('0x1c')](_0x5db85e);}};}function respondWithFilteredResult(_0x5ec07b,_0x28cbaa){return function(_0x5a7c68){if(_0x5a7c68){var _0x17d79e=_0x5a7c68['count'],_0x1b80d5=_0x28cbaa[_0xf781('0x1d')],_0x350940=_0x28cbaa['offset']+_0x28cbaa[_0xf781('0x1e')],_0x342b02;if(_0x350940>=_0x17d79e){_0x350940=_0x17d79e;_0x342b02=0xc8;}else{_0x342b02=0xce;}_0x5ec07b[_0xf781('0x1b')](_0x342b02);return _0x5ec07b[_0xf781('0x1f')]('Content-Range',_0x1b80d5+'-'+_0x350940+'/'+_0x17d79e)[_0xf781('0x1c')](_0x5a7c68);}return null;};}function patchUpdates(_0x523ffc){return function(_0x477f98){try{jsonpatch[_0xf781('0x20')](_0x477f98,_0x523ffc,!![]);}catch(_0x5d5531){return BPromise[_0xf781('0x21')](_0x5d5531);}return _0x477f98['save']();};}function saveUpdates(_0x4f7b18,_0x452943){return function(_0x574c3c){if(_0x574c3c){return _0x574c3c['update'](_0x4f7b18)[_0xf781('0x22')](function(_0x41c2fd){return _0x41c2fd;});}return null;};}function removeEntity(_0x158a11,_0x5b0088){return function(_0x564d33){if(_0x564d33){return _0x564d33[_0xf781('0x23')]()[_0xf781('0x22')](function(){_0x158a11[_0xf781('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50edd0,_0x56a7b5){return function(_0x18a1b9){if(!_0x18a1b9){_0x50edd0['sendStatus'](0x194);}return _0x18a1b9;};}function handleError(_0x1e8ec8,_0x27755d){_0x27755d=_0x27755d||0x1f4;return function(_0x35c2e8){logger[_0xf781('0x24')](_0x35c2e8[_0xf781('0x25')]);if(_0x35c2e8['name']){delete _0x35c2e8[_0xf781('0x26')];}_0x1e8ec8['status'](_0x27755d)[_0xf781('0x27')](_0x35c2e8);};}exports[_0xf781('0x28')]=function(_0xe1a2a9,_0x14b421){var _0x2f40ee={},_0x46d81f={},_0x26e54a={'count':0x0,'rows':[]};var _0x110f27=db['ChatTransferReport']['rawAttributes'];_0x46d81f[_0xf781('0x29')]=_[_0xf781('0x2a')](_0x110f27);_0x46d81f[_0xf781('0x2b')]=_[_0xf781('0x2a')](_0xe1a2a9[_0xf781('0x2b')]);_0x46d81f[_0xf781('0x2c')]=_[_0xf781('0x2d')](_0x46d81f[_0xf781('0x29')],_0x46d81f['query']);_0x2f40ee[_0xf781('0x2e')]=_[_0xf781('0x2d')](_0x46d81f['model'],qs[_0xf781('0x2f')](_0xe1a2a9[_0xf781('0x2b')]['fields']));_0x2f40ee[_0xf781('0x2e')]=_0x2f40ee[_0xf781('0x2e')]['length']?_0x2f40ee[_0xf781('0x2e')]:_0x46d81f[_0xf781('0x29')];if(!_0xe1a2a9['query'][_0xf781('0x30')]('nolimit')){_0x2f40ee[_0xf781('0x1e')]=qs[_0xf781('0x1e')](_0xe1a2a9[_0xf781('0x2b')][_0xf781('0x1e')]);_0x2f40ee['offset']=qs[_0xf781('0x1d')](_0xe1a2a9[_0xf781('0x2b')][_0xf781('0x1d')]);}_0x2f40ee[_0xf781('0x31')]=qs['sort'](_0xe1a2a9['query'][_0xf781('0x32')]);_0x2f40ee[_0xf781('0x33')]=qs['filters'](_[_0xf781('0x34')](_0xe1a2a9[_0xf781('0x2b')],_0x46d81f['filters']));if(_0xe1a2a9['query'][_0xf781('0x35')]){_0x2f40ee[_0xf781('0x33')]=_['merge'](_0x2f40ee[_0xf781('0x33')],{'$or':_[_0xf781('0x36')](_0x110f27,function(_0x3f34aa){if(_0x3f34aa[_0xf781('0x37')][_0xf781('0x38')]!=='VIRTUAL'){var _0x56b0da={};_0x56b0da[_0x3f34aa[_0xf781('0x39')]]={'$like':'%'+_0xe1a2a9[_0xf781('0x2b')]['filter']+'%'};return _0x56b0da;}})});}_0x2f40ee=_[_0xf781('0x3a')]({},_0x2f40ee,_0xe1a2a9['options']);var _0x29f262={'where':_0x2f40ee[_0xf781('0x33')]};return db[_0xf781('0x3b')]['count'](_0x29f262)['then'](function(_0x1cc639){_0x26e54a[_0xf781('0x3c')]=_0x1cc639;if(_0xe1a2a9[_0xf781('0x2b')][_0xf781('0x3d')]){_0x2f40ee[_0xf781('0x3e')]=[{'all':!![]}];}return db[_0xf781('0x3b')][_0xf781('0x3f')](_0x2f40ee);})['then'](function(_0x335d72){_0x26e54a['rows']=_0x335d72;return _0x26e54a;})['then'](respondWithFilteredResult(_0x14b421,_0x2f40ee))['catch'](handleError(_0x14b421,null));};exports[_0xf781('0x40')]=function(_0x4122c3,_0x3d28e7){var _0x4e8e3f={'raw':!![],'where':{'id':_0x4122c3[_0xf781('0x41')]['id']}},_0x37b275={};_0x37b275['model']=_[_0xf781('0x2a')](db[_0xf781('0x3b')]['rawAttributes']);_0x37b275[_0xf781('0x2b')]=_['keys'](_0x4122c3[_0xf781('0x2b')]);_0x37b275[_0xf781('0x2c')]=_['intersection'](_0x37b275['model'],_0x37b275[_0xf781('0x2b')]);_0x4e8e3f[_0xf781('0x2e')]=_[_0xf781('0x2d')](_0x37b275['model'],qs[_0xf781('0x2f')](_0x4122c3['query']['fields']));_0x4e8e3f[_0xf781('0x2e')]=_0x4e8e3f[_0xf781('0x2e')][_0xf781('0x42')]?_0x4e8e3f[_0xf781('0x2e')]:_0x37b275[_0xf781('0x29')];if(_0x4122c3[_0xf781('0x2b')][_0xf781('0x3d')]){_0x4e8e3f[_0xf781('0x3e')]=[{'all':!![]}];}_0x4e8e3f=_[_0xf781('0x3a')]({},_0x4e8e3f,_0x4122c3[_0xf781('0x43')]);return db[_0xf781('0x3b')]['find'](_0x4e8e3f)[_0xf781('0x22')](handleEntityNotFound(_0x3d28e7,null))['then'](respondWithResult(_0x3d28e7,null))['catch'](handleError(_0x3d28e7,null));};exports[_0xf781('0x44')]=function(_0x111325,_0x4dc59f){return db[_0xf781('0x3b')][_0xf781('0x44')](_0x111325['body'],{})[_0xf781('0x22')](respondWithResult(_0x4dc59f,0xc9))['catch'](handleError(_0x4dc59f,null));};exports[_0xf781('0x45')]=function(_0x5000a3,_0x1d15dc){if(_0x5000a3['body']['id']){delete _0x5000a3[_0xf781('0x46')]['id'];}return db['ChatTransferReport'][_0xf781('0x47')]({'where':{'id':_0x5000a3[_0xf781('0x41')]['id']}})[_0xf781('0x22')](handleEntityNotFound(_0x1d15dc,null))[_0xf781('0x22')](saveUpdates(_0x5000a3[_0xf781('0x46')],null))[_0xf781('0x22')](respondWithResult(_0x1d15dc,null))[_0xf781('0x48')](handleError(_0x1d15dc,null));};exports[_0xf781('0x23')]=function(_0x21b512,_0x19e8a3){return db[_0xf781('0x3b')][_0xf781('0x47')]({'where':{'id':_0x21b512[_0xf781('0x41')]['id']}})[_0xf781('0x22')](handleEntityNotFound(_0x19e8a3,null))['then'](removeEntity(_0x19e8a3,null))[_0xf781('0x48')](handleError(_0x19e8a3,null));};exports['describe']=function(_0x2d678a,_0x2eb2b4){return db['ChatTransferReport']['describe']()[_0xf781('0x22')](respondWithResult(_0x2eb2b4,null))[_0xf781('0x48')](handleError(_0x2eb2b4,null));}; \ No newline at end of file +var _0x1516=['filter','where','map','type','key','VIRTUAL','options','ChatTransferReport','includeAll','include','findAll','rows','catch','params','merge','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x486236,_0x325e27){var _0x58d527=function(_0x4ad5f9){while(--_0x4ad5f9){_0x486236['push'](_0x486236['shift']());}};_0x58d527(++_0x325e27);}(_0x1516,0xb0));var _0x6151=function(_0x24356b,_0x5d4b98){_0x24356b=_0x24356b-0x0;var _0x7e0a92=_0x1516[_0x24356b];return _0x7e0a92;};'use strict';var pdf=require(_0x6151('0x0'));var emlformat=require(_0x6151('0x1'));var rimraf=require(_0x6151('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6151('0x3'));var rp=require(_0x6151('0x4'));var moment=require(_0x6151('0x5'));var BPromise=require(_0x6151('0x6'));var Mustache=require(_0x6151('0x7'));var util=require('util');var path=require(_0x6151('0x8'));var sox=require('sox');var csv=require(_0x6151('0x9'));var ejs=require(_0x6151('0xa'));var fs=require('fs');var _=require(_0x6151('0xb'));var squel=require(_0x6151('0xc'));var crypto=require(_0x6151('0xd'));var jsforce=require(_0x6151('0xe'));var deskjs=require(_0x6151('0xf'));var toCsv=require(_0x6151('0x9'));var querystring=require(_0x6151('0x10'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0x6151('0x11'));var Redis=require(_0x6151('0x12'));var qs=require(_0x6151('0x13'));var logger=require(_0x6151('0x14'))(_0x6151('0x15'));var utils=require(_0x6151('0x16'));var config=require(_0x6151('0x17'));var db=require(_0x6151('0x18'))['db'];function respondWithStatusCode(_0x8306aa,_0x573f0f){_0x573f0f=_0x573f0f||0xcc;return function(_0x55b225){if(_0x55b225){return _0x8306aa[_0x6151('0x19')](_0x573f0f);}return _0x8306aa[_0x6151('0x1a')](_0x573f0f)[_0x6151('0x1b')]();};}function respondWithResult(_0x5752bb,_0x1fe484){_0x1fe484=_0x1fe484||0xc8;return function(_0x382030){if(_0x382030){return _0x5752bb[_0x6151('0x1a')](_0x1fe484)[_0x6151('0x1c')](_0x382030);}};}function respondWithFilteredResult(_0x57d9a8,_0xe0b0f){return function(_0x591057){if(_0x591057){var _0x3c411e=_0x591057[_0x6151('0x1d')],_0x21fa5f=_0xe0b0f[_0x6151('0x1e')],_0x34d111=_0xe0b0f[_0x6151('0x1e')]+_0xe0b0f[_0x6151('0x1f')],_0xf393d1;if(_0x34d111>=_0x3c411e){_0x34d111=_0x3c411e;_0xf393d1=0xc8;}else{_0xf393d1=0xce;}_0x57d9a8['status'](_0xf393d1);return _0x57d9a8[_0x6151('0x20')](_0x6151('0x21'),_0x21fa5f+'-'+_0x34d111+'/'+_0x3c411e)['json'](_0x591057);}return null;};}function patchUpdates(_0x168b79){return function(_0x24bfbd){try{jsonpatch[_0x6151('0x22')](_0x24bfbd,_0x168b79,!![]);}catch(_0xe5958d){return BPromise[_0x6151('0x23')](_0xe5958d);}return _0x24bfbd[_0x6151('0x24')]();};}function saveUpdates(_0x38bcac,_0x3792b9){return function(_0x18a908){if(_0x18a908){return _0x18a908[_0x6151('0x25')](_0x38bcac)[_0x6151('0x26')](function(_0x1d7509){return _0x1d7509;});}return null;};}function removeEntity(_0x35d5fc,_0x15344b){return function(_0x452035){if(_0x452035){return _0x452035['destroy']()[_0x6151('0x26')](function(){_0x35d5fc[_0x6151('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x582c40,_0x245340){return function(_0x3ed0ac){if(!_0x3ed0ac){_0x582c40['sendStatus'](0x194);}return _0x3ed0ac;};}function handleError(_0x45a3c1,_0x2c57fc){_0x2c57fc=_0x2c57fc||0x1f4;return function(_0x4810dd){logger[_0x6151('0x27')](_0x4810dd[_0x6151('0x28')]);if(_0x4810dd[_0x6151('0x29')]){delete _0x4810dd[_0x6151('0x29')];}_0x45a3c1['status'](_0x2c57fc)[_0x6151('0x2a')](_0x4810dd);};}exports[_0x6151('0x2b')]=function(_0x431b75,_0x14f735){var _0x51030d={},_0x1a6fd2={},_0x14ea6b={'count':0x0,'rows':[]};var _0x99ea9f=db['ChatTransferReport'][_0x6151('0x2c')];_0x1a6fd2[_0x6151('0x2d')]=_['keys'](_0x99ea9f);_0x1a6fd2[_0x6151('0x2e')]=_[_0x6151('0x2f')](_0x431b75[_0x6151('0x2e')]);_0x1a6fd2[_0x6151('0x30')]=_[_0x6151('0x31')](_0x1a6fd2[_0x6151('0x2d')],_0x1a6fd2[_0x6151('0x2e')]);_0x51030d[_0x6151('0x32')]=_[_0x6151('0x31')](_0x1a6fd2[_0x6151('0x2d')],qs[_0x6151('0x33')](_0x431b75[_0x6151('0x2e')][_0x6151('0x33')]));_0x51030d[_0x6151('0x32')]=_0x51030d[_0x6151('0x32')][_0x6151('0x34')]?_0x51030d[_0x6151('0x32')]:_0x1a6fd2[_0x6151('0x2d')];if(!_0x431b75[_0x6151('0x2e')][_0x6151('0x35')](_0x6151('0x36'))){_0x51030d['limit']=qs[_0x6151('0x1f')](_0x431b75['query'][_0x6151('0x1f')]);_0x51030d[_0x6151('0x1e')]=qs['offset'](_0x431b75[_0x6151('0x2e')]['offset']);}_0x51030d[_0x6151('0x37')]=qs[_0x6151('0x38')](_0x431b75[_0x6151('0x2e')][_0x6151('0x38')]);_0x51030d['where']=qs[_0x6151('0x30')](_[_0x6151('0x39')](_0x431b75[_0x6151('0x2e')],_0x1a6fd2['filters']));if(_0x431b75[_0x6151('0x2e')][_0x6151('0x3a')]){_0x51030d[_0x6151('0x3b')]=_['merge'](_0x51030d[_0x6151('0x3b')],{'$or':_[_0x6151('0x3c')](_0x99ea9f,function(_0x56ac0b){if(_0x56ac0b[_0x6151('0x3d')][_0x6151('0x3e')]!==_0x6151('0x3f')){var _0x470035={};_0x470035[_0x56ac0b['field']]={'$like':'%'+_0x431b75['query'][_0x6151('0x3a')]+'%'};return _0x470035;}})});}_0x51030d=_['merge']({},_0x51030d,_0x431b75[_0x6151('0x40')]);var _0x2e1f4c={'where':_0x51030d[_0x6151('0x3b')]};return db[_0x6151('0x41')][_0x6151('0x1d')](_0x2e1f4c)[_0x6151('0x26')](function(_0x4e1a41){_0x14ea6b[_0x6151('0x1d')]=_0x4e1a41;if(_0x431b75[_0x6151('0x2e')][_0x6151('0x42')]){_0x51030d[_0x6151('0x43')]=[{'all':!![]}];}return db[_0x6151('0x41')][_0x6151('0x44')](_0x51030d);})[_0x6151('0x26')](function(_0x228a3a){_0x14ea6b[_0x6151('0x45')]=_0x228a3a;return _0x14ea6b;})[_0x6151('0x26')](respondWithFilteredResult(_0x14f735,_0x51030d))[_0x6151('0x46')](handleError(_0x14f735,null));};exports['show']=function(_0x54eee0,_0x3cff45){var _0x1bebcd={'raw':!![],'where':{'id':_0x54eee0[_0x6151('0x47')]['id']}},_0x2c56a7={};_0x2c56a7[_0x6151('0x2d')]=_['keys'](db['ChatTransferReport']['rawAttributes']);_0x2c56a7['query']=_[_0x6151('0x2f')](_0x54eee0[_0x6151('0x2e')]);_0x2c56a7[_0x6151('0x30')]=_[_0x6151('0x31')](_0x2c56a7[_0x6151('0x2d')],_0x2c56a7[_0x6151('0x2e')]);_0x1bebcd[_0x6151('0x32')]=_['intersection'](_0x2c56a7[_0x6151('0x2d')],qs[_0x6151('0x33')](_0x54eee0[_0x6151('0x2e')][_0x6151('0x33')]));_0x1bebcd[_0x6151('0x32')]=_0x1bebcd[_0x6151('0x32')]['length']?_0x1bebcd[_0x6151('0x32')]:_0x2c56a7['model'];if(_0x54eee0[_0x6151('0x2e')][_0x6151('0x42')]){_0x1bebcd['include']=[{'all':!![]}];}_0x1bebcd=_[_0x6151('0x48')]({},_0x1bebcd,_0x54eee0['options']);return db[_0x6151('0x41')]['find'](_0x1bebcd)[_0x6151('0x26')](handleEntityNotFound(_0x3cff45,null))[_0x6151('0x26')](respondWithResult(_0x3cff45,null))[_0x6151('0x46')](handleError(_0x3cff45,null));};exports[_0x6151('0x49')]=function(_0x225426,_0x533238){return db['ChatTransferReport'][_0x6151('0x49')](_0x225426[_0x6151('0x4a')],{})[_0x6151('0x26')](respondWithResult(_0x533238,0xc9))[_0x6151('0x46')](handleError(_0x533238,null));};exports['update']=function(_0x34892e,_0x2d8368){if(_0x34892e[_0x6151('0x4a')]['id']){delete _0x34892e[_0x6151('0x4a')]['id'];}return db[_0x6151('0x41')][_0x6151('0x4b')]({'where':{'id':_0x34892e[_0x6151('0x47')]['id']}})[_0x6151('0x26')](handleEntityNotFound(_0x2d8368,null))[_0x6151('0x26')](saveUpdates(_0x34892e[_0x6151('0x4a')],null))[_0x6151('0x26')](respondWithResult(_0x2d8368,null))[_0x6151('0x46')](handleError(_0x2d8368,null));};exports[_0x6151('0x4c')]=function(_0x599f3a,_0x5c68f6){return db['ChatTransferReport'][_0x6151('0x4b')]({'where':{'id':_0x599f3a[_0x6151('0x47')]['id']}})[_0x6151('0x26')](handleEntityNotFound(_0x5c68f6,null))[_0x6151('0x26')](removeEntity(_0x5c68f6,null))[_0x6151('0x46')](handleError(_0x5c68f6,null));};exports[_0x6151('0x4d')]=function(_0x59e3c6,_0x31e9c8){return db[_0x6151('0x41')][_0x6151('0x4d')]()[_0x6151('0x26')](respondWithResult(_0x31e9c8,null))['catch'](handleError(_0x31e9c8,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 3e3e35e..9565f7e 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 _0xc0c6=['exports','define','ChatTransferReport','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x3fcf7e,_0x326215){var _0x40d85e=function(_0xa08dca){while(--_0xa08dca){_0x3fcf7e['push'](_0x3fcf7e['shift']());}};_0x40d85e(++_0x326215);}(_0xc0c6,0x93));var _0x6c0c=function(_0x1bf6fd,_0x5a7d5f){_0x1bf6fd=_0x1bf6fd-0x0;var _0x30fa4b=_0xc0c6[_0x1bf6fd];return _0x30fa4b;};'use strict';var _=require(_0x6c0c('0x0'));var util=require(_0x6c0c('0x1'));var logger=require(_0x6c0c('0x2'))(_0x6c0c('0x3'));var moment=require(_0x6c0c('0x4'));var BPromise=require('bluebird');var rp=require(_0x6c0c('0x5'));var attributes=require('./chatTransferReport.attributes');module[_0x6c0c('0x6')]=function(_0x9e9533,_0x2e8ec2){return _0x9e9533[_0x6c0c('0x7')](_0x6c0c('0x8'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1041=['uniqueid','lodash','util','../../config/logger','moment','bluebird','./chatTransferReport.attributes','exports','define','report_chat_transfer'];(function(_0x1a26dd,_0x23c949){var _0x3a4c3f=function(_0x6a0bb7){while(--_0x6a0bb7){_0x1a26dd['push'](_0x1a26dd['shift']());}};_0x3a4c3f(++_0x23c949);}(_0x1041,0x1d7));var _0x1104=function(_0x2b1cdd,_0x1c47ef){_0x2b1cdd=_0x2b1cdd-0x0;var _0xc554f2=_0x1041[_0x2b1cdd];return _0xc554f2;};'use strict';var _=require(_0x1104('0x0'));var util=require(_0x1104('0x1'));var logger=require(_0x1104('0x2'))('api');var moment=require(_0x1104('0x3'));var BPromise=require(_0x1104('0x4'));var rp=require('request-promise');var attributes=require(_0x1104('0x5'));module[_0x1104('0x6')]=function(_0x27ec90,_0xfd3e65){return _0x27ec90[_0x1104('0x7')]('ChatTransferReport',attributes,{'tableName':_0x1104('0x8'),'paranoid':![],'indexes':[{'name':_0x1104('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index e7dffd4..63f9b11 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 _0x2e31=['code','message','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','info','ChatTransferReport,\x20%s,\x20%s','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5734e1,_0x3e1d75){var _0x22c784=function(_0x4fe1eb){while(--_0x4fe1eb){_0x5734e1['push'](_0x5734e1['shift']());}};_0x22c784(++_0x3e1d75);}(_0x2e31,0x145));var _0x12e3=function(_0x3e88b0,_0x261fc9){_0x3e88b0=_0x3e88b0-0x0;var _0x38eb00=_0x2e31[_0x3e88b0];return _0x38eb00;};'use strict';var _=require(_0x12e3('0x0'));var util=require(_0x12e3('0x1'));var moment=require(_0x12e3('0x2'));var BPromise=require('bluebird');var rs=require(_0x12e3('0x3'));var fs=require('fs');var Redis=require(_0x12e3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x12e3('0x5'))(_0x12e3('0x6'));var config=require(_0x12e3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x12e3('0x8')][_0x12e3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5aefcf,_0x5f056f,_0x37f287){return new BPromise(function(_0x403cc5,_0x31e2cf){return client[_0x12e3('0xa')](_0x5aefcf,_0x37f287)['then'](function(_0x438c7e){logger[_0x12e3('0xb')](_0x12e3('0xc'),_0x5f056f,'request\x20sent');logger['debug'](_0x12e3('0xd'),_0x5f056f,_0x12e3('0xe'),JSON[_0x12e3('0xf')](_0x438c7e));if(_0x438c7e[_0x12e3('0x10')]){if(_0x438c7e[_0x12e3('0x10')][_0x12e3('0x11')]===0x1f4){logger[_0x12e3('0x10')](_0x12e3('0xc'),_0x5f056f,_0x438c7e[_0x12e3('0x10')][_0x12e3('0x12')]);return _0x31e2cf(_0x438c7e[_0x12e3('0x10')][_0x12e3('0x12')]);}logger['error'](_0x12e3('0xc'),_0x5f056f,_0x438c7e[_0x12e3('0x10')][_0x12e3('0x12')]);return _0x403cc5(_0x438c7e['error'][_0x12e3('0x12')]);}else{logger[_0x12e3('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x5f056f,'request\x20sent');_0x403cc5(_0x438c7e['result'][_0x12e3('0x12')]);}})['catch'](function(_0x2f26b1){logger[_0x12e3('0x10')](_0x12e3('0xc'),_0x5f056f,_0x2f26b1);_0x31e2cf(_0x2f26b1);});});} \ No newline at end of file +var _0xfa4b=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring'];(function(_0x28d225,_0x43be18){var _0x1f79e1=function(_0x362c23){while(--_0x362c23){_0x28d225['push'](_0x28d225['shift']());}};_0x1f79e1(++_0x43be18);}(_0xfa4b,0x175));var _0xbfa4=function(_0x3c3920,_0x286666){_0x3c3920=_0x3c3920-0x0;var _0x3a6ddb=_0xfa4b[_0x3c3920];return _0x3a6ddb;};'use strict';var _=require(_0xbfa4('0x0'));var util=require(_0xbfa4('0x1'));var moment=require(_0xbfa4('0x2'));var BPromise=require(_0xbfa4('0x3'));var rs=require(_0xbfa4('0x4'));var fs=require('fs');var Redis=require(_0xbfa4('0x5'));var db=require(_0xbfa4('0x6'))['db'];var utils=require(_0xbfa4('0x7'));var logger=require('../../config/logger')(_0xbfa4('0x8'));var config=require('../../config/environment');var jayson=require(_0xbfa4('0x9'));var client=jayson['client'][_0xbfa4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21c828,_0x3488eb,_0x1696bb){return new BPromise(function(_0x64eeb7,_0x5c7502){return client[_0xbfa4('0xb')](_0x21c828,_0x1696bb)['then'](function(_0x5224cb){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x3488eb,_0xbfa4('0xc'));logger['debug'](_0xbfa4('0xd'),_0x3488eb,_0xbfa4('0xc'),JSON[_0xbfa4('0xe')](_0x5224cb));if(_0x5224cb['error']){if(_0x5224cb[_0xbfa4('0xf')][_0xbfa4('0x10')]===0x1f4){logger['error'](_0xbfa4('0x11'),_0x3488eb,_0x5224cb['error'][_0xbfa4('0x12')]);return _0x5c7502(_0x5224cb[_0xbfa4('0xf')]['message']);}logger[_0xbfa4('0xf')](_0xbfa4('0x11'),_0x3488eb,_0x5224cb[_0xbfa4('0xf')][_0xbfa4('0x12')]);return _0x64eeb7(_0x5224cb[_0xbfa4('0xf')][_0xbfa4('0x12')]);}else{logger[_0xbfa4('0x13')](_0xbfa4('0x11'),_0x3488eb,_0xbfa4('0xc'));_0x64eeb7(_0x5224cb[_0xbfa4('0x14')][_0xbfa4('0x12')]);}})['catch'](function(_0x4e0a24){logger[_0xbfa4('0xf')](_0xbfa4('0x11'),_0x3488eb,_0x4e0a24);_0x5c7502(_0x4e0a24);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 0653200..07fc1d6 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 _0xd318=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x44fbfd,_0x3ad672){var _0x22ee46=function(_0x45a9e0){while(--_0x45a9e0){_0x44fbfd['push'](_0x44fbfd['shift']());}};_0x22ee46(++_0x3ad672);}(_0xd318,0x69));var _0x8d31=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xd318[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x8d31('0x0'));var util=require(_0x8d31('0x1'));var path=require(_0x8d31('0x2'));var timeout=require(_0x8d31('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x8d31('0x4'));var interaction=require(_0x8d31('0x5'));var config=require(_0x8d31('0x6'));var controller=require(_0x8d31('0x7'));router[_0x8d31('0x8')]('/',auth['isAuthenticated'](),controller[_0x8d31('0x9')]);router[_0x8d31('0x8')](_0x8d31('0xa'),auth[_0x8d31('0xb')](),controller[_0x8d31('0xc')]);router[_0x8d31('0x8')](_0x8d31('0xd'),auth[_0x8d31('0xb')](),controller[_0x8d31('0xe')]);router[_0x8d31('0xf')]('/',auth[_0x8d31('0xb')](),controller['create']);router[_0x8d31('0x10')]('/:id',auth[_0x8d31('0xb')](),controller[_0x8d31('0x11')]);router[_0x8d31('0x12')](_0x8d31('0xd'),auth[_0x8d31('0xb')](),controller[_0x8d31('0x13')]);module[_0x8d31('0x14')]=router; \ No newline at end of file +var _0x9950=['../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','show','post','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x40124e,_0x47920b){var _0x2e8dc2=function(_0x3a6674){while(--_0x3a6674){_0x40124e['push'](_0x40124e['shift']());}};_0x2e8dc2(++_0x47920b);}(_0x9950,0x1c3));var _0x0995=function(_0x17050b,_0xfddcf3){_0x17050b=_0x17050b-0x0;var _0xb4176f=_0x9950[_0x17050b];return _0xb4176f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0995('0x0'));var timeout=require(_0x0995('0x1'));var express=require(_0x0995('0x2'));var router=express[_0x0995('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0995('0x4'));var config=require(_0x0995('0x5'));var controller=require(_0x0995('0x6'));router[_0x0995('0x7')]('/',auth[_0x0995('0x8')](),controller['index']);router[_0x0995('0x7')](_0x0995('0x9'),auth['isAuthenticated'](),controller[_0x0995('0xa')]);router[_0x0995('0x7')]('/:id',auth[_0x0995('0x8')](),controller[_0x0995('0xb')]);router[_0x0995('0xc')]('/',auth[_0x0995('0x8')](),controller['create']);router[_0x0995('0xd')](_0x0995('0xe'),auth['isAuthenticated'](),controller[_0x0995('0xf')]);router[_0x0995('0x10')](_0x0995('0xe'),auth[_0x0995('0x8')](),controller[_0x0995('0x11')]);module[_0x0995('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 7fc0edd..6609205 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 _0xf871=['New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','website_alias','bottom_right','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','sequelize','STRING','address','email','Agent','#ffffff','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Send','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','star','TEXT','stringify','input','name','text','getDataValue','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','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.'];(function(_0x2da1d0,_0x16f2a2){var _0x29bb32=function(_0x1eca40){while(--_0x1eca40){_0x2da1d0['push'](_0x2da1d0['shift']());}};_0x29bb32(++_0x16f2a2);}(_0xf871,0x161));var _0x1f87=function(_0x3d34da,_0x3abcc1){_0x3d34da=_0x3d34da-0x0;var _0xcf6af8=_0xf871[_0x3d34da];return _0xcf6af8;};'use strict';var Sequelize=require(_0x1f87('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x1f87('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x1f87('0x1')],'allowNull':![],'unique':_0x1f87('0x2')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x1f87('0x1')],'defaultValue':_0x1f87('0x3')},'mapKeyOffline':{'type':Sequelize[_0x1f87('0x1')],'defaultValue':_0x1f87('0x3')},'key':{'type':Sequelize[_0x1f87('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x1f87('0x1')],'defaultValue':_0x1f87('0x4')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#9f946a','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x1f87('0x1')],'allowNull':![],'defaultValue':'#9f946a','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1f87('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x1f87('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x1f87('0x1')]},'animation':{'type':Sequelize[_0x1f87('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x1f87('0x8'),_0x1f87('0x9')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x1f87('0x1')],'defaultValue':_0x1f87('0xa')},'start_chat_button':{'type':Sequelize[_0x1f87('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x1f87('0x1')],'defaultValue':_0x1f87('0xb')},'header_offline':{'type':Sequelize[_0x1f87('0x1')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x1f87('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x1f87('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x1f87('0xc')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x1f87('0x1')],'defaultValue':_0x1f87('0xd')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x1f87('0x1')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x1f87('0x1')],'defaultValue':_0x1f87('0xe')},'placeholderMessage':{'type':Sequelize[_0x1f87('0x1')],'defaultValue':_0x1f87('0xf')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x1f87('0x10')},'closingMessageButton':{'type':Sequelize[_0x1f87('0x1')],'defaultValue':_0x1f87('0xb')},'skipMessageButton':{'type':Sequelize[_0x1f87('0x1')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x1f87('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x1f87('0x7')],'defaultValue':![]},'ratingType':{'type':Sequelize['ENUM'](_0x1f87('0x11'),'thumb'),'defaultValue':_0x1f87('0x11')},'ratingStarsNumber':{'type':Sequelize[_0x1f87('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x1f87('0x12')],'defaultValue':function(){return JSON[_0x1f87('0x13')]({'items':[{'type':_0x1f87('0x14'),'variable':null,'config':{'placeholder':_0x1f87('0x15'),'type':_0x1f87('0x16'),'required':!![]},'props':{'title':_0x1f87('0x15'),'helpText':''}},{'type':_0x1f87('0x14'),'props':{'title':_0x1f87('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x1f87('0x3'),'type':_0x1f87('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x1f87('0x17')](_0x1f87('0x18'))?JSON[_0x1f87('0x19')](this['getDataValue']('onlineForm')):{};},'set':function(_0x26c364){return this['setDataValue']('onlineForm',JSON[_0x1f87('0x13')](_0x26c364));}},'offlineForm':{'type':Sequelize[_0x1f87('0x12')],'defaultValue':function(){return JSON[_0x1f87('0x13')]({'items':[{'type':_0x1f87('0x14'),'props':{'title':_0x1f87('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x1f87('0x3')},'variable':null},{'type':_0x1f87('0x1a'),'config':{'placeholder':'Comments'},'props':{'title':_0x1f87('0x1b'),'helpText':_0x1f87('0x1c')}}],'fromKey':0x0});},'get':function(){return this[_0x1f87('0x17')]('offlineForm')?JSON[_0x1f87('0x19')](this[_0x1f87('0x17')](_0x1f87('0x1d'))):{};},'set':function(_0x263893){return this[_0x1f87('0x1e')](_0x1f87('0x1d'),JSON['stringify'](_0x263893));}},'token':{'type':Sequelize[_0x1f87('0x1')],'defaultValue':function(){return rs[_0x1f87('0x1f')]();}},'autoclose':{'type':Sequelize[_0x1f87('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x1f87('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x1f87('0x1')]},'forwardOffline':{'type':Sequelize[_0x1f87('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x1f87('0x1')]},'waitingTitle':{'type':Sequelize[_0x1f87('0x1')],'defaultValue':_0x1f87('0x20')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x1f87('0x21')},'offlineMessageSubject':{'type':Sequelize[_0x1f87('0x1')],'defaultValue':_0x1f87('0x22')},'offlineMessageBody':{'type':Sequelize[_0x1f87('0x1')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x1f87('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x1f87('0x1')],'defaultValue':_0x1f87('0x23')},'skipUnmanaged':{'type':Sequelize[_0x1f87('0x1')],'defaultValue':_0x1f87('0x24')},'sendUnmanaged':{'type':Sequelize[_0x1f87('0x1')],'defaultValue':_0x1f87('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0x1f87('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x1f87('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x1f87('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x1f87('0x1')]},'notificationTemplate':{'type':Sequelize[_0x1f87('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x1f87('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x1f87('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x1f87('0x1')],'defaultValue':_0x1f87('0x25')},'waitForTheAssignedAgent':{'type':Sequelize[_0x1f87('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x1f87('0x1')],'defaultValue':_0x1f87('0x26')},'verticalAlignment':{'type':Sequelize[_0x1f87('0x6')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x1f87('0x1')],'defaultValue':_0x1f87('0x27')},'defaultTitle':{'type':Sequelize[_0x1f87('0x1')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x1f87('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1f87('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1f87('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1f87('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x1f87('0x1')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x1f87('0x12')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1f87('0x6')],'comment':_0x1f87('0x29')},'mandatoryDisposition':{'type':Sequelize[_0x1f87('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x63b93e){if(!_0x63b93e)this['setDataValue'](_0x1f87('0x2a'),null);this[_0x1f87('0x1e')]('mandatoryDisposition',_0x63b93e);}}}; \ No newline at end of file +var _0x61c7=['getDataValue','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','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.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','website_alias','bottom_right','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','Agent','#9f946a','#ffffff','INTEGER','ENUM','rounded','squared','We\x20are\x20here!','Chat','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Type\x20a\x20message','Send','star','name','text','input','onlineForm','parse'];(function(_0x2a8f90,_0x12c2cc){var _0x4a4aa5=function(_0x5f0cf9){while(--_0x5f0cf9){_0x2a8f90['push'](_0x2a8f90['shift']());}};_0x4a4aa5(++_0x12c2cc);}(_0x61c7,0x134));var _0x761c=function(_0x3620f3,_0x5ef1f7){_0x3620f3=_0x3620f3-0x0;var _0x51e748=_0x61c7[_0x3620f3];return _0x51e748;};'use strict';var Sequelize=require(_0x761c('0x0'));var rs=require(_0x761c('0x1'));module[_0x761c('0x2')]={'name':{'type':Sequelize[_0x761c('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x761c('0x3')],'allowNull':![],'unique':_0x761c('0x4')},'description':{'type':Sequelize[_0x761c('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x761c('0x5')},'mapKeyOffline':{'type':Sequelize[_0x761c('0x3')],'defaultValue':_0x761c('0x5')},'key':{'type':Sequelize[_0x761c('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x761c('0x3')],'defaultValue':_0x761c('0x6')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x761c('0x3')],'allowNull':![],'defaultValue':_0x761c('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x761c('0x3')],'allowNull':![],'defaultValue':'#9f946a','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x761c('0x3')],'allowNull':![],'defaultValue':_0x761c('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x761c('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x761c('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x761c('0xa')](_0x761c('0xb'),_0x761c('0xc')),'defaultValue':_0x761c('0xb')},'header_online':{'type':Sequelize[_0x761c('0x3')],'defaultValue':_0x761c('0xd')},'start_chat_button':{'type':Sequelize[_0x761c('0x3')],'defaultValue':_0x761c('0xe')},'offline_chat_button':{'type':Sequelize[_0x761c('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x761c('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x761c('0xf')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x761c('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x761c('0x3')],'defaultValue':_0x761c('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x761c('0xf')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x761c('0x11')]},'closingQuestion':{'type':Sequelize[_0x761c('0x3')],'defaultValue':_0x761c('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x761c('0x3')],'defaultValue':_0x761c('0x13')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x761c('0x3')],'defaultValue':_0x761c('0x14')},'closingMessage':{'type':Sequelize[_0x761c('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x761c('0x3')],'defaultValue':_0x761c('0x15')},'skipMessageButton':{'type':Sequelize[_0x761c('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x761c('0xf')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x761c('0xf')],'defaultValue':![]},'ratingType':{'type':Sequelize[_0x761c('0xa')](_0x761c('0x16'),'thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x761c('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x761c('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x761c('0x17'),'type':_0x761c('0x18'),'required':!![]},'props':{'title':_0x761c('0x17'),'helpText':''}},{'type':_0x761c('0x19'),'props':{'title':_0x761c('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x761c('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x761c('0x1a'))?JSON[_0x761c('0x1b')](this[_0x761c('0x1c')]('onlineForm')):{};},'set':function(_0x19eeb0){return this[_0x761c('0x1d')](_0x761c('0x1a'),JSON[_0x761c('0x1e')](_0x19eeb0));}},'offlineForm':{'type':Sequelize[_0x761c('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x761c('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x761c('0x5'),'type':_0x761c('0x5')},'variable':null},{'type':_0x761c('0x1f'),'config':{'placeholder':_0x761c('0x20')},'props':{'title':_0x761c('0x20'),'helpText':_0x761c('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x761c('0x1c')](_0x761c('0x22'))?JSON[_0x761c('0x1b')](this[_0x761c('0x1c')](_0x761c('0x22'))):{};},'set':function(_0x48df2e){return this['setDataValue'](_0x761c('0x22'),JSON[_0x761c('0x1e')](_0x48df2e));}},'token':{'type':Sequelize[_0x761c('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x761c('0xf')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x761c('0xf')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x761c('0xf')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x761c('0x3')]},'forwardOffline':{'type':Sequelize[_0x761c('0xf')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x761c('0x3')]},'waitingTitle':{'type':Sequelize[_0x761c('0x3')],'defaultValue':_0x761c('0x23')},'waitingMessage':{'type':Sequelize[_0x761c('0x3')],'defaultValue':_0x761c('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x761c('0x3')],'defaultValue':_0x761c('0x25')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x761c('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x761c('0xf')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x761c('0x3')],'defaultValue':_0x761c('0x27')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x761c('0x28')},'sendUnmanaged':{'type':Sequelize[_0x761c('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x761c('0xf')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x761c('0xf')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x761c('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x761c('0xf')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x761c('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x761c('0xf')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x761c('0x3')],'defaultValue':_0x761c('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x761c('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x761c('0x3')],'defaultValue':_0x761c('0x2a')},'verticalAlignment':{'type':Sequelize[_0x761c('0x9')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x761c('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x761c('0x3')]},'customerAvatar':{'type':Sequelize[_0x761c('0x11')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x761c('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x761c('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x761c('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x761c('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x761c('0x3')],'defaultValue':_0x761c('0x2b')},'systemAvatar':{'type':Sequelize[_0x761c('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x761c('0x9')],'comment':_0x761c('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0x761c('0xf')],'defaultValue':![],'comment':_0x761c('0x2d'),'set':function(_0xf58c0f){if(!_0xf58c0f)this[_0x761c('0x1d')](_0x761c('0x2e'),null);this['setDataValue'](_0x761c('0x2f'),_0xf58c0f);}}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 2d552e1..b024490 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 _0xcb91=['showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','contact','firstName','lastName','customerIp','referer','browser','version','format','%s\x20%s','unknown','vendor','%s\x20%s\x20%s','device','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','CompanyId','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','findOrCreate','readFileSync','utf8','render','toPairs','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','sendMail','email','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','fullname','internal','Tag','Tags','color','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','info','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','inspect','Interval','Intervals','increment','chatLicenseExceeded','all','some','remote','x-forwarded-for','x-real-ip','remoteAddress','virtual','alignment','addApplications','sequelize','bulkCreate','getApplications','chatProactiveAction','addProactiveActions','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./chatWebsite.socket','register','jayson/promise','http','client','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','end','json','offset','limit','Content-Range','apply','reject','update','destroy','get','ChatWebsites','UserProfileResource','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','merge','map','type','key','VIRTUAL','field','filter','options','count','include','findAll','rows','params','fields','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','findOne','Disposition','nolimit','order','ChatWebsiteId','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addLogo','file','filename','addAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.png','sitepic','../../config/license/util','getLicense','custom','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x35fb56,_0x5dadff){_0x35fb56=_0x35fb56-0x0;var _0x2fd52c=_0xcb91[_0x35fb56];return _0x2fd52c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x1cb9('0xd'));var hardwareService=require(_0x1cb9('0xe'));var Redis=require(_0x1cb9('0xf'));var qs=require(_0x1cb9('0x10'));var logger=require(_0x1cb9('0x11'))('api');var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var db=require(_0x1cb9('0x14'))['db'];config[_0x1cb9('0x15')]=_[_0x1cb9('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1cb9('0x15')]));require(_0x1cb9('0x17'))[_0x1cb9('0x18')](socket);var jayson=require(_0x1cb9('0x19'));var client=jayson['client'][_0x1cb9('0x1a')]({'port':0x232c});var client9002=jayson[_0x1cb9('0x1b')][_0x1cb9('0x1a')]({'port':0x232a});var client9003=jayson[_0x1cb9('0x1b')][_0x1cb9('0x1a')]({'port':0x232b});function respondWithRpcPromise(_0x5806d8,_0x5572cb,_0xd446a3,_0x3cc765){return new BPromise(function(_0x3904b7,_0x3f1376){var _0x3e21e0=_0x3cc765||client;return _0x3e21e0[_0x1cb9('0x1c')](_0x5806d8,_0xd446a3)[_0x1cb9('0x1d')](function(_0x4e1340){logger['info'](_0x1cb9('0x1e'),_0x5572cb,_0x1cb9('0x1f'));logger[_0x1cb9('0x20')](_0x1cb9('0x21'),_0x5572cb,_0x1cb9('0x1f'),JSON[_0x1cb9('0x22')](_0x4e1340));if(_0x4e1340[_0x1cb9('0x23')]){if(_0x4e1340['error']['code']===0x1f4){logger[_0x1cb9('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x5572cb,_0x4e1340[_0x1cb9('0x23')][_0x1cb9('0x24')]);return _0x3f1376(_0x4e1340['error']['message']);}logger[_0x1cb9('0x23')](_0x1cb9('0x1e'),_0x5572cb,_0x4e1340[_0x1cb9('0x23')][_0x1cb9('0x24')]);return _0x3904b7(_0x4e1340[_0x1cb9('0x23')][_0x1cb9('0x24')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x5572cb,_0x1cb9('0x1f'));_0x3904b7(_0x4e1340['result'][_0x1cb9('0x24')]);}})[_0x1cb9('0x25')](function(_0x69b4c8){logger[_0x1cb9('0x23')](_0x1cb9('0x1e'),_0x5572cb,_0x69b4c8);_0x3f1376(_0x69b4c8);});});}function respondWithStatusCode(_0x53f9fa,_0x195f16){_0x195f16=_0x195f16||0xcc;return function(_0x9df250){if(_0x9df250){return _0x53f9fa['sendStatus'](_0x195f16);}return _0x53f9fa[_0x1cb9('0x26')](_0x195f16)[_0x1cb9('0x27')]();};}function respondWithResult(_0x41a9a0,_0x1804fd){_0x1804fd=_0x1804fd||0xc8;return function(_0x406821){if(_0x406821){return _0x41a9a0[_0x1cb9('0x26')](_0x1804fd)[_0x1cb9('0x28')](_0x406821);}};}function respondWithFilteredResult(_0xb644b3,_0x41e5c2){return function(_0x9de64b){if(_0x9de64b){var _0x48888d=_0x9de64b['count'],_0x405a2f=_0x41e5c2[_0x1cb9('0x29')],_0x536635=_0x41e5c2[_0x1cb9('0x29')]+_0x41e5c2[_0x1cb9('0x2a')],_0x110282;if(_0x536635>=_0x48888d){_0x536635=_0x48888d;_0x110282=0xc8;}else{_0x110282=0xce;}_0xb644b3[_0x1cb9('0x26')](_0x110282);return _0xb644b3['set'](_0x1cb9('0x2b'),_0x405a2f+'-'+_0x536635+'/'+_0x48888d)['json'](_0x9de64b);}return null;};}function patchUpdates(_0xe0a0e2){return function(_0x336a98){try{jsonpatch[_0x1cb9('0x2c')](_0x336a98,_0xe0a0e2,!![]);}catch(_0x5d8793){return BPromise[_0x1cb9('0x2d')](_0x5d8793);}return _0x336a98['save']();};}function saveUpdates(_0x3a3543,_0x58f4f5){return function(_0x2164e3){if(_0x2164e3){return _0x2164e3[_0x1cb9('0x2e')](_0x3a3543)[_0x1cb9('0x1d')](function(_0xae910){return _0xae910;});}return null;};}function removeEntity(_0x56c3e0,_0x2114a4){return function(_0xf71b9a){if(_0xf71b9a){return _0xf71b9a[_0x1cb9('0x2f')]()[_0x1cb9('0x1d')](function(){var _0xc6784c=_0xf71b9a[_0x1cb9('0x30')]({'plain':!![]});var _0xc6d5fd=_0x1cb9('0x31');return db[_0x1cb9('0x32')][_0x1cb9('0x2f')]({'where':{'type':_0xc6d5fd,'resourceId':_0xc6784c['id']}})[_0x1cb9('0x1d')](function(){return _0xf71b9a;});})[_0x1cb9('0x1d')](function(){_0x56c3e0[_0x1cb9('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54c6e6,_0x299ff8){return function(_0x30f7e4){if(!_0x30f7e4){_0x54c6e6[_0x1cb9('0x33')](0x194);}return _0x30f7e4;};}function handleError(_0x29f451,_0x385daa){_0x385daa=_0x385daa||0x1f4;return function(_0x3a06e6){logger[_0x1cb9('0x23')](_0x3a06e6[_0x1cb9('0x34')]);if(_0x3a06e6['name']){delete _0x3a06e6[_0x1cb9('0x35')];}_0x29f451[_0x1cb9('0x26')](_0x385daa)[_0x1cb9('0x36')](_0x3a06e6);};}exports['index']=function(_0x2a5aac,_0x5c7cd0){var _0x313e34={'include':[{'model':db[_0x1cb9('0x37')],'as':_0x1cb9('0x38')}]},_0x5701a3={},_0x2a73f2={'count':0x0,'rows':[]};var _0x2bcacd=db[_0x1cb9('0x39')][_0x1cb9('0x3a')];_0x5701a3[_0x1cb9('0x3b')]=_['keys'](_0x2bcacd);_0x5701a3['query']=_[_0x1cb9('0x3c')](_0x2a5aac[_0x1cb9('0x3d')]);_0x5701a3[_0x1cb9('0x3e')]=_[_0x1cb9('0x3f')](_0x5701a3[_0x1cb9('0x3b')],_0x5701a3[_0x1cb9('0x3d')]);_0x313e34[_0x1cb9('0x40')]=_['intersection'](_0x5701a3[_0x1cb9('0x3b')],qs['fields'](_0x2a5aac['query']['fields']));_0x313e34[_0x1cb9('0x40')]=_0x313e34[_0x1cb9('0x40')][_0x1cb9('0x41')]?_0x313e34[_0x1cb9('0x40')]:_0x5701a3[_0x1cb9('0x3b')];if(!_0x2a5aac['query'][_0x1cb9('0x42')]('nolimit')){_0x313e34[_0x1cb9('0x2a')]=qs[_0x1cb9('0x2a')](_0x2a5aac[_0x1cb9('0x3d')]['limit']);_0x313e34[_0x1cb9('0x29')]=qs['offset'](_0x2a5aac[_0x1cb9('0x3d')][_0x1cb9('0x29')]);}_0x313e34['order']=qs['sort'](_0x2a5aac[_0x1cb9('0x3d')][_0x1cb9('0x43')]);_0x313e34[_0x1cb9('0x44')]=qs[_0x1cb9('0x3e')](_[_0x1cb9('0x45')](_0x2a5aac['query'],_0x5701a3[_0x1cb9('0x3e')]));if(_0x2a5aac['query']['filter']){_0x313e34['where']=_[_0x1cb9('0x46')](_0x313e34[_0x1cb9('0x44')],{'$or':_[_0x1cb9('0x47')](_0x2bcacd,function(_0x11cea5){if(_0x11cea5[_0x1cb9('0x48')][_0x1cb9('0x49')]!==_0x1cb9('0x4a')){var _0x409b89={};_0x409b89[_0x11cea5[_0x1cb9('0x4b')]]={'$like':'%'+_0x2a5aac[_0x1cb9('0x3d')][_0x1cb9('0x4c')]+'%'};return _0x409b89;}})});}_0x313e34=_['merge']({},_0x313e34,_0x2a5aac[_0x1cb9('0x4d')]);var _0x237125={'where':_0x313e34[_0x1cb9('0x44')]};return db['ChatWebsite'][_0x1cb9('0x4e')](_0x237125)[_0x1cb9('0x1d')](function(_0x3c6044){_0x2a73f2[_0x1cb9('0x4e')]=_0x3c6044;if(_0x2a5aac[_0x1cb9('0x3d')]['includeAll']){_0x313e34[_0x1cb9('0x4f')]=[{'all':!![]}];}return db['ChatWebsite'][_0x1cb9('0x50')](_0x313e34);})['then'](function(_0x1cf2ee){_0x2a73f2[_0x1cb9('0x51')]=_0x1cf2ee;return _0x2a73f2;})[_0x1cb9('0x1d')](respondWithFilteredResult(_0x5c7cd0,_0x313e34))[_0x1cb9('0x25')](handleError(_0x5c7cd0,null));};exports['show']=function(_0x298475,_0x1149b9){var _0x1b750d={'raw':![],'where':{'id':_0x298475[_0x1cb9('0x52')]['id']},'include':[{'model':db[_0x1cb9('0x37')],'as':_0x1cb9('0x38')}]},_0x3561a5={};_0x3561a5[_0x1cb9('0x3b')]=_[_0x1cb9('0x3c')](db[_0x1cb9('0x39')]['rawAttributes']);_0x3561a5['query']=_[_0x1cb9('0x3c')](_0x298475[_0x1cb9('0x3d')]);_0x3561a5[_0x1cb9('0x3e')]=_[_0x1cb9('0x3f')](_0x3561a5[_0x1cb9('0x3b')],_0x3561a5[_0x1cb9('0x3d')]);_0x1b750d[_0x1cb9('0x40')]=_[_0x1cb9('0x3f')](_0x3561a5[_0x1cb9('0x3b')],qs[_0x1cb9('0x53')](_0x298475['query'][_0x1cb9('0x53')]));_0x1b750d['attributes']=_0x1b750d[_0x1cb9('0x40')]['length']?_0x1b750d[_0x1cb9('0x40')]:_0x3561a5['model'];if(_0x298475['query'][_0x1cb9('0x54')]){_0x1b750d[_0x1cb9('0x4f')]=[{'all':!![]}];}_0x1b750d=_[_0x1cb9('0x46')]({},_0x1b750d,_0x298475['options']);return db[_0x1cb9('0x39')][_0x1cb9('0x55')](_0x1b750d)['then'](handleEntityNotFound(_0x1149b9,null))['then'](respondWithResult(_0x1149b9,null))[_0x1cb9('0x25')](handleError(_0x1149b9,null));};exports[_0x1cb9('0x56')]=function(_0x3e70fc,_0x2b3f2a){return db[_0x1cb9('0x39')][_0x1cb9('0x56')](_0x3e70fc[_0x1cb9('0x57')],{})['then'](function(_0x345ddd){var _0x2607c7=_0x3e70fc[_0x1cb9('0x58')]['get']({'plain':!![]});if(!_0x2607c7)throw new Error(_0x1cb9('0x59'));if(_0x2607c7[_0x1cb9('0x5a')]===_0x1cb9('0x58')){var _0xf6eb2d=_0x345ddd[_0x1cb9('0x30')]({'plain':!![]});var _0x3c4681='ChatWebsites';return db[_0x1cb9('0x5b')][_0x1cb9('0x55')]({'where':{'name':_0x3c4681,'userProfileId':_0x2607c7[_0x1cb9('0x5c')]},'raw':!![]})[_0x1cb9('0x1d')](function(_0x4ad7cd){if(_0x4ad7cd&&_0x4ad7cd[_0x1cb9('0x5d')]===0x0){return db[_0x1cb9('0x32')][_0x1cb9('0x56')]({'name':_0xf6eb2d[_0x1cb9('0x35')],'resourceId':_0xf6eb2d['id'],'type':_0x4ad7cd[_0x1cb9('0x35')],'sectionId':_0x4ad7cd['id']},{})[_0x1cb9('0x1d')](function(){return _0x345ddd;});}else{return _0x345ddd;}})['catch'](function(_0xfc39e1){logger[_0x1cb9('0x23')](_0x1cb9('0x5e'),_0xfc39e1);throw _0xfc39e1;});}return _0x345ddd;})[_0x1cb9('0x1d')](respondWithResult(_0x2b3f2a,0xc9))['catch'](handleError(_0x2b3f2a,null));};exports['update']=function(_0x319358,_0x2f8f27){if(_0x319358[_0x1cb9('0x57')]['id']){delete _0x319358[_0x1cb9('0x57')]['id'];}return db[_0x1cb9('0x39')][_0x1cb9('0x55')]({'where':{'id':_0x319358[_0x1cb9('0x52')]['id']},'include':[{'model':db[_0x1cb9('0x37')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x2f8f27,null))[_0x1cb9('0x1d')](saveUpdates(_0x319358['body'],null))['then'](respondWithResult(_0x2f8f27,null))['catch'](handleError(_0x2f8f27,null));};exports['destroy']=function(_0x5d349b,_0x455c40){return db[_0x1cb9('0x39')][_0x1cb9('0x55')]({'where':{'id':_0x5d349b[_0x1cb9('0x52')]['id']}})[_0x1cb9('0x1d')](handleEntityNotFound(_0x455c40,null))[_0x1cb9('0x1d')](removeEntity(_0x455c40,null))['catch'](handleError(_0x455c40,null));};exports[_0x1cb9('0x5f')]=function(_0x3e1207,_0x5a72c8){return db['ChatWebsite'][_0x1cb9('0x5f')]()[_0x1cb9('0x1d')](respondWithResult(_0x5a72c8,null))[_0x1cb9('0x25')](handleError(_0x5a72c8,null));};exports[_0x1cb9('0x60')]=function(_0x13ff8b,_0x51ce73,_0x538ff0){if(_0x13ff8b['body']['id']){delete _0x13ff8b[_0x1cb9('0x57')]['id'];}return db[_0x1cb9('0x39')][_0x1cb9('0x55')]({'where':{'id':_0x13ff8b[_0x1cb9('0x52')]['id']}})[_0x1cb9('0x1d')](handleEntityNotFound(_0x51ce73,null))['then'](function(_0x357c33){if(_0x357c33){_0x13ff8b[_0x1cb9('0x57')]['ChatWebsiteId']=_0x357c33['id'];return db['Disposition'][_0x1cb9('0x56')](_0x13ff8b['body']);}})[_0x1cb9('0x1d')](respondWithResult(_0x51ce73,null))[_0x1cb9('0x25')](handleError(_0x51ce73,null));};exports[_0x1cb9('0x61')]=function(_0x1e7561,_0x3619a2,_0x398779){var _0x4aeeff={'raw':![],'where':{}};var _0xde0d93={};var _0x15fc04={'count':0x0,'rows':[]};return db[_0x1cb9('0x39')][_0x1cb9('0x62')]({'where':{'id':_0x1e7561['params']['id']}})['then'](handleEntityNotFound(_0x3619a2,null))[_0x1cb9('0x1d')](function(_0x457b76){if(_0x457b76){_0xde0d93[_0x1cb9('0x3b')]=_[_0x1cb9('0x3c')](db[_0x1cb9('0x63')][_0x1cb9('0x3a')]);_0xde0d93['query']=_[_0x1cb9('0x3c')](_0x1e7561['query']);_0xde0d93[_0x1cb9('0x3e')]=_[_0x1cb9('0x3f')](_0xde0d93['model'],_0xde0d93[_0x1cb9('0x3d')]);_0x4aeeff[_0x1cb9('0x40')]=_[_0x1cb9('0x3f')](_0xde0d93['model'],qs[_0x1cb9('0x53')](_0x1e7561[_0x1cb9('0x3d')][_0x1cb9('0x53')]));_0x4aeeff[_0x1cb9('0x40')]=_0x4aeeff[_0x1cb9('0x40')][_0x1cb9('0x41')]?_0x4aeeff['attributes']:_0xde0d93[_0x1cb9('0x3b')];if(!_0x1e7561[_0x1cb9('0x3d')][_0x1cb9('0x42')](_0x1cb9('0x64'))){_0x4aeeff[_0x1cb9('0x2a')]=qs[_0x1cb9('0x2a')](_0x1e7561[_0x1cb9('0x3d')][_0x1cb9('0x2a')]);_0x4aeeff['offset']=qs[_0x1cb9('0x29')](_0x1e7561[_0x1cb9('0x3d')]['offset']);}_0x4aeeff[_0x1cb9('0x65')]=qs['sort'](_0x1e7561[_0x1cb9('0x3d')]['sort']);_0x4aeeff['where']=qs[_0x1cb9('0x3e')](_[_0x1cb9('0x45')](_0x1e7561['query'],_0xde0d93[_0x1cb9('0x3e')]));_0x4aeeff['where'][_0x1cb9('0x66')]=_0x457b76['id'];if(_0x1e7561[_0x1cb9('0x3d')][_0x1cb9('0x4c')]){_0x4aeeff[_0x1cb9('0x44')]=_['merge'](_0x4aeeff[_0x1cb9('0x44')],{'$or':_[_0x1cb9('0x47')](_0x4aeeff[_0x1cb9('0x40')],function(_0x27cc3c){var _0x4f8d74={};_0x4f8d74[_0x27cc3c]={'$like':'%'+_0x1e7561[_0x1cb9('0x3d')]['filter']+'%'};return _0x4f8d74;})});}_0x4aeeff=_[_0x1cb9('0x46')]({},_0x4aeeff,_0x1e7561[_0x1cb9('0x4d')]);return db[_0x1cb9('0x63')][_0x1cb9('0x4e')]({'where':_0x4aeeff[_0x1cb9('0x44')]})[_0x1cb9('0x1d')](function(_0x5e07ba){_0x15fc04[_0x1cb9('0x4e')]=_0x5e07ba;if(_0x1e7561[_0x1cb9('0x3d')]['includeAll']){_0x4aeeff[_0x1cb9('0x4f')]=[{'all':!![]}];}return db[_0x1cb9('0x63')][_0x1cb9('0x50')](_0x4aeeff);})[_0x1cb9('0x1d')](function(_0x2effa8){_0x15fc04[_0x1cb9('0x51')]=_0x2effa8;return _0x15fc04;});}})[_0x1cb9('0x1d')](respondWithFilteredResult(_0x3619a2,_0x4aeeff))['catch'](handleError(_0x3619a2,null));};exports[_0x1cb9('0x67')]=function(_0x4b9169,_0x3a89f5,_0xb5eac1){var _0x50dd60;return db[_0x1cb9('0x39')][_0x1cb9('0x55')]({'where':{'id':_0x4b9169[_0x1cb9('0x52')]['id']}})[_0x1cb9('0x1d')](handleEntityNotFound(_0x3a89f5,null))['then'](function(_0x113367){if(_0x113367){return _0x113367[_0x1cb9('0x67')](_0x4b9169[_0x1cb9('0x3d')]['ids']);}})[_0x1cb9('0x1d')](respondWithStatusCode(_0x3a89f5,null))[_0x1cb9('0x25')](handleError(_0x3a89f5,null));};exports[_0x1cb9('0x68')]=function(_0x3d287f,_0x10b508,_0x1ea329){if(_0x3d287f[_0x1cb9('0x57')]['id']){delete _0x3d287f['body']['id'];}return db[_0x1cb9('0x39')]['find']({'where':{'id':_0x3d287f[_0x1cb9('0x52')]['id']}})[_0x1cb9('0x1d')](handleEntityNotFound(_0x10b508,null))[_0x1cb9('0x1d')](function(_0x329175){if(_0x329175){_0x3d287f['body'][_0x1cb9('0x66')]=_0x329175['id'];return db[_0x1cb9('0x69')]['create'](_0x3d287f[_0x1cb9('0x57')]);}})[_0x1cb9('0x1d')](respondWithResult(_0x10b508,null))[_0x1cb9('0x25')](handleError(_0x10b508,null));};exports[_0x1cb9('0x6a')]=function(_0x453fa3,_0x52a3f1,_0x5e0e56){var _0x544d2d={'raw':![],'where':{}};var _0x5ad853={};var _0x19daa1={'count':0x0,'rows':[]};return db[_0x1cb9('0x39')][_0x1cb9('0x62')]({'where':{'id':_0x453fa3[_0x1cb9('0x52')]['id']}})[_0x1cb9('0x1d')](handleEntityNotFound(_0x52a3f1,null))[_0x1cb9('0x1d')](function(_0x1e6402){if(_0x1e6402){_0x5ad853[_0x1cb9('0x3b')]=_['keys'](db[_0x1cb9('0x69')][_0x1cb9('0x3a')]);_0x5ad853[_0x1cb9('0x3d')]=_['keys'](_0x453fa3[_0x1cb9('0x3d')]);_0x5ad853[_0x1cb9('0x3e')]=_['intersection'](_0x5ad853[_0x1cb9('0x3b')],_0x5ad853[_0x1cb9('0x3d')]);_0x544d2d[_0x1cb9('0x40')]=_[_0x1cb9('0x3f')](_0x5ad853['model'],qs[_0x1cb9('0x53')](_0x453fa3[_0x1cb9('0x3d')]['fields']));_0x544d2d['attributes']=_0x544d2d[_0x1cb9('0x40')][_0x1cb9('0x41')]?_0x544d2d['attributes']:_0x5ad853['model'];if(!_0x453fa3[_0x1cb9('0x3d')][_0x1cb9('0x42')]('nolimit')){_0x544d2d['limit']=qs[_0x1cb9('0x2a')](_0x453fa3['query']['limit']);_0x544d2d['offset']=qs[_0x1cb9('0x29')](_0x453fa3['query'][_0x1cb9('0x29')]);}_0x544d2d[_0x1cb9('0x65')]=qs[_0x1cb9('0x43')](_0x453fa3['query'][_0x1cb9('0x43')]);_0x544d2d[_0x1cb9('0x44')]=qs[_0x1cb9('0x3e')](_['pick'](_0x453fa3[_0x1cb9('0x3d')],_0x5ad853[_0x1cb9('0x3e')]));_0x544d2d[_0x1cb9('0x44')][_0x1cb9('0x66')]=_0x1e6402['id'];if(_0x453fa3[_0x1cb9('0x3d')]['filter']){_0x544d2d[_0x1cb9('0x44')]=_[_0x1cb9('0x46')](_0x544d2d[_0x1cb9('0x44')],{'$or':_['map'](_0x544d2d[_0x1cb9('0x40')],function(_0x81962d){var _0x534378={};_0x534378[_0x81962d]={'$like':'%'+_0x453fa3[_0x1cb9('0x3d')][_0x1cb9('0x4c')]+'%'};return _0x534378;})});}_0x544d2d=_['merge']({},_0x544d2d,_0x453fa3[_0x1cb9('0x4d')]);return db[_0x1cb9('0x69')][_0x1cb9('0x4e')]({'where':_0x544d2d[_0x1cb9('0x44')]})[_0x1cb9('0x1d')](function(_0x1768b8){_0x19daa1[_0x1cb9('0x4e')]=_0x1768b8;if(_0x453fa3[_0x1cb9('0x3d')][_0x1cb9('0x54')]){_0x544d2d[_0x1cb9('0x4f')]=[{'all':!![]}];}return db[_0x1cb9('0x69')][_0x1cb9('0x50')](_0x544d2d);})[_0x1cb9('0x1d')](function(_0x1b2b1c){_0x19daa1[_0x1cb9('0x51')]=_0x1b2b1c;return _0x19daa1;});}})[_0x1cb9('0x1d')](respondWithFilteredResult(_0x52a3f1,_0x544d2d))[_0x1cb9('0x25')](handleError(_0x52a3f1,null));};exports[_0x1cb9('0x6b')]=function(_0x48e879,_0x508a75,_0x13ba32){var _0x94d2c2;return db[_0x1cb9('0x39')][_0x1cb9('0x55')]({'where':{'id':_0x48e879[_0x1cb9('0x52')]['id']}})[_0x1cb9('0x1d')](handleEntityNotFound(_0x508a75,null))[_0x1cb9('0x1d')](function(_0x56251d){if(_0x56251d){return _0x56251d['removeAnswers'](_0x48e879[_0x1cb9('0x3d')][_0x1cb9('0x6c')]);}})[_0x1cb9('0x1d')](respondWithStatusCode(_0x508a75,null))[_0x1cb9('0x25')](handleError(_0x508a75,null));};exports[_0x1cb9('0x6d')]=function(_0x51ff2b,_0xacf226,_0x23777c){_0x51ff2b[_0x1cb9('0x57')]['sitepic']=_0x51ff2b[_0x1cb9('0x6e')][_0x1cb9('0x6f')];return db[_0x1cb9('0x39')]['find']({'where':{'id':_0x51ff2b[_0x1cb9('0x52')]['id']}})[_0x1cb9('0x1d')](handleEntityNotFound(_0xacf226,null))[_0x1cb9('0x1d')](saveUpdates(_0x51ff2b['body'],null))['then'](respondWithResult(_0xacf226,null))['catch'](handleError(_0xacf226,null));};exports[_0x1cb9('0x70')]=function(_0x32b1a0,_0x32064a,_0x523ca9){_0x32b1a0[_0x1cb9('0x57')]['agentAvatar']=_0x32b1a0['file'][_0x1cb9('0x6f')];return db[_0x1cb9('0x39')][_0x1cb9('0x55')]({'where':{'id':_0x32b1a0[_0x1cb9('0x52')]['id']}})[_0x1cb9('0x1d')](handleEntityNotFound(_0x32064a,null))[_0x1cb9('0x1d')](saveUpdates(_0x32b1a0[_0x1cb9('0x57')],null))[_0x1cb9('0x1d')](respondWithResult(_0x32064a,null))[_0x1cb9('0x25')](handleError(_0x32064a,null));};exports[_0x1cb9('0x71')]=function(_0x5182fb,_0x4ff2da,_0x23b4fb){_0x5182fb[_0x1cb9('0x57')]['customerAvatar']=_0x5182fb['file']['filename'];return db['ChatWebsite'][_0x1cb9('0x55')]({'where':{'id':_0x5182fb[_0x1cb9('0x52')]['id']}})['then'](handleEntityNotFound(_0x4ff2da,null))[_0x1cb9('0x1d')](saveUpdates(_0x5182fb[_0x1cb9('0x57')],null))[_0x1cb9('0x1d')](respondWithResult(_0x4ff2da,null))[_0x1cb9('0x25')](handleError(_0x4ff2da,null));};exports[_0x1cb9('0x72')]=function(_0x5218ea,_0x3a029e,_0x1767f8){_0x5218ea[_0x1cb9('0x57')][_0x1cb9('0x73')]=_0x5218ea['file'][_0x1cb9('0x6f')];return db[_0x1cb9('0x39')]['find']({'where':{'id':_0x5218ea['params']['id']}})['then'](handleEntityNotFound(_0x3a029e,null))[_0x1cb9('0x1d')](saveUpdates(_0x5218ea['body'],null))[_0x1cb9('0x1d')](respondWithResult(_0x3a029e,null))[_0x1cb9('0x25')](handleError(_0x3a029e,null));};exports[_0x1cb9('0x74')]=function(_0xf3c554,_0x31d1e5,_0x274e7d){var _0x5aeacf=path[_0x1cb9('0x75')](config[_0x1cb9('0x76')],_0x1cb9('0x77'));var _0x242cad={'where':{'id':_0xf3c554[_0x1cb9('0x52')]['id']},'attributes':['id',_0x1cb9('0x78')],'raw':!![]};var _0x237e3b=![];return require(_0x1cb9('0x79'))[_0x1cb9('0x7a')]()[_0x1cb9('0x1d')](function(_0xa2b077){if(_0xa2b077){_0x237e3b=_0xa2b077[_0x1cb9('0x7b')];}})[_0x1cb9('0x1d')](function(){return db[_0x1cb9('0x39')][_0x1cb9('0x55')](_0x242cad);})['then'](handleEntityNotFound(_0x31d1e5,null))['then'](function(_0x5aae4c){if(_0x5aae4c){if(!_[_0x1cb9('0x7c')](_0x5aae4c[_0x1cb9('0x78')])){if(fs['existsSync'](path[_0x1cb9('0x75')](config[_0x1cb9('0x76')],_0x1cb9('0x7d'),_0x5aae4c['sitepic']))&&_0x237e3b){_0x5aeacf=path[_0x1cb9('0x75')](config[_0x1cb9('0x76')],_0x1cb9('0x7d'),_0x5aae4c[_0x1cb9('0x78')]);}}return _0x31d1e5[_0x1cb9('0x7e')](_0x5aeacf);}})['catch'](handleError(_0x31d1e5,null));};exports[_0x1cb9('0x7f')]=function(_0x4e71c6,_0x4bc0ce,_0x191988){var _0x8f08f9=path[_0x1cb9('0x75')](config[_0x1cb9('0x76')],_0x1cb9('0x80'));var _0x2b0ab9={'where':{'id':_0x4e71c6[_0x1cb9('0x52')]['id']},'attributes':['id',_0x1cb9('0x81')],'raw':!![]};return db['ChatWebsite'][_0x1cb9('0x55')](_0x2b0ab9)[_0x1cb9('0x1d')](handleEntityNotFound(_0x4bc0ce,null))[_0x1cb9('0x1d')](function(_0x2d8585){if(_0x2d8585){if(!_[_0x1cb9('0x7c')](_0x2d8585['agentAvatar'])){if(fs[_0x1cb9('0x82')](path[_0x1cb9('0x75')](config[_0x1cb9('0x76')],_0x1cb9('0x83'),_0x2d8585[_0x1cb9('0x81')]))){_0x8f08f9=path['join'](config[_0x1cb9('0x76')],_0x1cb9('0x83'),_0x2d8585[_0x1cb9('0x81')]);}}return _0x4bc0ce['download'](_0x8f08f9);}})[_0x1cb9('0x25')](handleError(_0x4bc0ce,null));};exports[_0x1cb9('0x84')]=function(_0x42d642,_0x1181d0,_0x3ca4cf){var _0x30300c=path['join'](config[_0x1cb9('0x76')],_0x1cb9('0x85'));var _0x17fdd1={'where':{'id':_0x42d642['params']['id']},'attributes':['id',_0x1cb9('0x86'),_0x1cb9('0x87')],'raw':!![]};return db['ChatWebsite']['find'](_0x17fdd1)[_0x1cb9('0x1d')](handleEntityNotFound(_0x1181d0,null))[_0x1cb9('0x1d')](function(_0xe867bd){if(_0xe867bd){if(!_[_0x1cb9('0x7c')](_0xe867bd[_0x1cb9('0x86')])){if(fs['existsSync'](path[_0x1cb9('0x75')](config[_0x1cb9('0x76')],_0x1cb9('0x83'),_0xe867bd[_0x1cb9('0x86')]))&&_0xe867bd[_0x1cb9('0x87')]){_0x30300c=path['join'](config['root'],_0x1cb9('0x83'),_0xe867bd[_0x1cb9('0x86')]);}}return _0x1181d0[_0x1cb9('0x7e')](_0x30300c);}})['catch'](handleError(_0x1181d0,null));};exports['getSystemAvatar']=function(_0x40d403,_0x3c4b2b,_0x33d06a){var _0x4f49ca=path['join'](config['root'],_0x1cb9('0x88'));var _0x194d6d={'where':{'id':_0x40d403[_0x1cb9('0x52')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x1cb9('0x39')]['find'](_0x194d6d)[_0x1cb9('0x1d')](handleEntityNotFound(_0x3c4b2b,null))[_0x1cb9('0x1d')](function(_0x476985){if(_0x476985){if(!_[_0x1cb9('0x7c')](_0x476985[_0x1cb9('0x73')])){if(fs['existsSync'](path[_0x1cb9('0x75')](config['root'],_0x1cb9('0x83'),_0x476985[_0x1cb9('0x73')]))){_0x4f49ca=path[_0x1cb9('0x75')](config[_0x1cb9('0x76')],_0x1cb9('0x83'),_0x476985['systemAvatar']);}}return _0x3c4b2b[_0x1cb9('0x7e')](_0x4f49ca);}})[_0x1cb9('0x25')](handleError(_0x3c4b2b,null));};exports[_0x1cb9('0x89')]=function(_0x218d0b,_0x3b4e77,_0x42c4d6){var _0x2af217=require('user-agent-parser');var _0x5e6070=new _0x2af217();var _0x100f8c=_0x5e6070[_0x1cb9('0x8a')](_0x218d0b[_0x1cb9('0x8b')][_0x1cb9('0x8c')])[_0x1cb9('0x8d')]();var _0x54b0d0={'body':_0x218d0b[_0x1cb9('0x57')],'channel':_0x1cb9('0x8e')};var _0x550d51=[];var _0x47a8ea=[];var _0xb742d4={};var _0x48c8e7=![];return db[_0x1cb9('0x8f')]['describe']()[_0x1cb9('0x1d')](function(_0x358bad){if(!_0x358bad){throw new db[(_0x1cb9('0x90'))][(_0x1cb9('0x91'))](_0x1cb9('0x92'));}_0x550d51=_[_0x1cb9('0x93')](_[_0x1cb9('0x3c')](_0x358bad),[_0x1cb9('0x94'),_0x1cb9('0x95')]);_0x47a8ea=_[_0x1cb9('0x93')](_[_0x1cb9('0x3c')](_0x358bad),[_0x1cb9('0x94'),'updatedAt','CompanyId','ListId']);if(_0x218d0b['body']['id']){delete _0x218d0b[_0x1cb9('0x57')]['id'];}if(_[_0x1cb9('0x7c')](_0x218d0b['body']['from'])){throw new db['Sequelize'][(_0x1cb9('0x91'))](_0x1cb9('0x96'));}if(_[_0x1cb9('0x7c')](_0x218d0b[_0x1cb9('0x57')]['body'])||_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0x57')]===''){throw new db[(_0x1cb9('0x90'))]['ValidationError'](_0x1cb9('0x97'));}if(_[_0x1cb9('0x7c')](_0x218d0b['body'][_0x1cb9('0x98')])){throw new db['Sequelize'][(_0x1cb9('0x91'))](_0x1cb9('0x99')+_0x47a8ea);}if(!_[_0x1cb9('0x9a')](_0x47a8ea,_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0x98')])){throw new db[(_0x1cb9('0x90'))][(_0x1cb9('0x91'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x47a8ea);}_0xb742d4[_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0x98')]]=_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0x9b')];})[_0x1cb9('0x1d')](function(){return db[_0x1cb9('0x39')][_0x1cb9('0x55')]({'where':{'id':_0x218d0b[_0x1cb9('0x52')]['id']},'include':[{'model':db[_0x1cb9('0x9c')],'as':_0x1cb9('0x9d'),'include':[{'model':db['CmContact'],'as':_0x1cb9('0x9e'),'where':_0xb742d4,'limit':0x1,'order':[[_0x1cb9('0x95'),_0x1cb9('0x9f')]]}]},{'model':db[_0x1cb9('0xa0')],'as':_0x1cb9('0xa1')}]});})['then'](handleEntityNotFound(_0x3b4e77,null))[_0x1cb9('0x1d')](function(_0x4f7e79){if(_0x4f7e79&&_0x4f7e79['List']){_0x54b0d0[_0x1cb9('0xa2')]=_0x4f7e79;_0x54b0d0[_0x1cb9('0xa3')]=_0x4f7e79[_0x1cb9('0xa1')];_0x54b0d0[_0x1cb9('0xa4')]=_0x4f7e79[_0x1cb9('0x9d')];_0x54b0d0[_0x1cb9('0xa3')]=_[_0x1cb9('0xa5')](_0x54b0d0[_0x1cb9('0xa3')],[_0x1cb9('0xa6')],['asc']);if(_0x54b0d0['account'][_0x1cb9('0xa1')]){delete _0x54b0d0[_0x1cb9('0xa2')][_0x1cb9('0xa1')];}if(_0x54b0d0[_0x1cb9('0xa2')][_0x1cb9('0x9d')]&&_0x54b0d0[_0x1cb9('0xa2')][_0x1cb9('0x9d')][_0x1cb9('0x9e')][_0x1cb9('0x41')]){return _0x54b0d0[_0x1cb9('0xa2')]['List'][_0x1cb9('0x9e')][0x0];}var _0x5101a9=_[_0x1cb9('0x16')](_0x218d0b[_0x1cb9('0x57')],{'firstName':_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0x9b')],'ListId':_0x4f7e79['ListId']});_0x5101a9[_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0x98')]]=_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0x9b')];return db[_0x1cb9('0x8f')][_0x1cb9('0x56')](_0x5101a9,{'fields':_0x550d51,'raw':!![]});}})[_0x1cb9('0x1d')](handleEntityNotFound(_0x3b4e77,null))['then'](function(_0x200ad9){_0x54b0d0[_0x1cb9('0xa7')]=_0x200ad9;if(_0x200ad9){var _0x276900={'ContactId':_0x200ad9['id'],'ChatWebsiteId':_0x218d0b[_0x1cb9('0x52')]['id'],'from':(_0x200ad9[_0x1cb9('0xa8')]||'')+'\x20'+(_0x200ad9[_0x1cb9('0xa9')]||''),'customerIp':_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0xaa')],'referer':_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0xab')],'browserName':_0x100f8c[_0x1cb9('0xac')][_0x1cb9('0x35')]&&_0x100f8c[_0x1cb9('0xac')][_0x1cb9('0xad')]?util[_0x1cb9('0xae')](_0x1cb9('0xaf'),_0x100f8c[_0x1cb9('0xac')][_0x1cb9('0x35')],_0x100f8c[_0x1cb9('0xac')][_0x1cb9('0xad')]):_0x1cb9('0xb0'),'browserVersion':_0x100f8c[_0x1cb9('0xac')]['version']||_0x1cb9('0xb0'),'osName':util[_0x1cb9('0xae')](_0x1cb9('0xaf'),_0x100f8c['os'][_0x1cb9('0x35')],_0x100f8c['os'][_0x1cb9('0xad')]),'osVersion':_0x100f8c['os'][_0x1cb9('0xad')],'deviceModel':_0x100f8c['device'][_0x1cb9('0x3b')]&&_0x100f8c['device'][_0x1cb9('0xb1')]?util[_0x1cb9('0xae')](_0x1cb9('0xb2'),_0x100f8c['device'][_0x1cb9('0x3b')],_0x100f8c[_0x1cb9('0xb3')][_0x1cb9('0xb1')],_0x100f8c[_0x1cb9('0xb3')]['type']):null,'deviceVendor':_0x100f8c[_0x1cb9('0xb3')][_0x1cb9('0xb1')],'deviceType':_0x100f8c[_0x1cb9('0xb3')][_0x1cb9('0x48')],'formData':JSON['stringify'](_0x218d0b[_0x1cb9('0x57')])};var _0x44f71b={'ChatWebsiteId':_0x218d0b['params']['id'],'closed':![]};if(_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0xb4')]){_0x44f71b[_0x1cb9('0xb4')]=_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0xb4')];return db[_0x1cb9('0xb5')][_0x1cb9('0x55')]({'where':_0x44f71b})[_0x1cb9('0x1d')](function(_0x263688){if(_0x263688){return[_0x263688,![]];}_0x276900[_0x1cb9('0xb4')]=_0x218d0b[_0x1cb9('0x57')]['threadId'];_0x276900[_0x1cb9('0xb6')]=_0x218d0b['body'][_0x1cb9('0xb6')];return db[_0x1cb9('0xb5')][_0x1cb9('0x56')](_0x276900)[_0x1cb9('0x1d')](function(_0x12acc9){return[_0x12acc9,!![]];});});}_0x44f71b[_0x1cb9('0xb7')]=_0x200ad9['id'];if(_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0xb8')]&&_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0xb8')]['id']){_0x44f71b['id']=_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0xb8')]['id'];return db[_0x1cb9('0xb5')]['find']({'where':_0x44f71b})[_0x1cb9('0x1d')](function(_0x3921fc){if(_0x3921fc){return[_0x3921fc,![]];}return db[_0x1cb9('0xb5')]['create'](_0x276900)['then'](function(_0x4946fd){return[_0x4946fd,!![]];});});}return db[_0x1cb9('0xb5')][_0x1cb9('0x56')](_0x276900)['then'](function(_0x47d696){return[_0x47d696,!![]];});}})[_0x1cb9('0xb9')](function(_0x395792,_0x427b1d){if(_0x395792){_0x48c8e7=_0x427b1d;if(!_0x427b1d){var _0x24ca62={'from':(_0x54b0d0['contact'][_0x1cb9('0xa8')]||'')+'\x20'+(_0x54b0d0[_0x1cb9('0xa7')][_0x1cb9('0xa9')]||'')};if(_0x218d0b[_0x1cb9('0x57')]['threadId']&&_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0xba')]&&_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0xb4')]!=_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0xba')]){_0x24ca62['threadId']=_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0xba')];}return _0x395792[_0x1cb9('0x2e')](_0x24ca62);}else{return _0x395792;}}})[_0x1cb9('0x1d')](function(_0x339ed4){_0x54b0d0[_0x1cb9('0xb8')]=_0x339ed4[_0x1cb9('0x30')]({'plain':!![]});_0x54b0d0[_0x1cb9('0xb8')][_0x1cb9('0xbb')]=_0x48c8e7;if(_0x54b0d0[_0x1cb9('0xb8')][_0x1cb9('0xbb')]){if(_0x54b0d0['account'][_0x1cb9('0xbc')]){_0x54b0d0[_0x1cb9('0xa3')]['push']({'id':0x0,'priority':_0x54b0d0[_0x1cb9('0xa3')]['length']+0x1,'app':_0x1cb9('0xbd'),'appdata':_0x1cb9('0xbe'),'interval':_0x1cb9('0xbf')});}}return db[_0x1cb9('0xc0')][_0x1cb9('0x56')]({'body':_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0x57')],'ChatWebsiteId':_0x218d0b[_0x1cb9('0x52')]['id'],'ChatInteractionId':_0x339ed4['id'],'direction':'in','ContactId':_0x54b0d0[_0x1cb9('0xa7')]['id'],'AttachmentId':_0x218d0b['body']['AttachmentId']});})['then'](function(_0x3f7130){_0x54b0d0[_0x1cb9('0x24')]=_0x3f7130;if(_0x54b0d0[_0x1cb9('0xb8')]['UserId']){return db[_0x1cb9('0xc1')][_0x1cb9('0x55')]({'attributes':['id',_0x1cb9('0x35')],'where':{'id':_0x54b0d0[_0x1cb9('0xb8')]['UserId']}})['then'](function(_0xa15bbd){if(_0xa15bbd){_0x54b0d0[_0x1cb9('0xa3')]['unshift']({'id':0x0,'priority':0x0,'app':_0x1cb9('0xc2'),'appdata':_0xa15bbd[_0x1cb9('0x35')]+','+(_0x54b0d0['account'][_0x1cb9('0xc3')]||0xa),'interval':_0x1cb9('0xbf')});_0x54b0d0[_0x1cb9('0xc4')]=!![];}return respondWithRpcPromise('Start','startRouting',_0x54b0d0);});}return respondWithRpcPromise(_0x1cb9('0xc5'),_0x1cb9('0xc6'),_0x54b0d0);})['then'](function(_0x3ebdf2){respondWithRpcPromise(_0x1cb9('0xc7'),_0x1cb9('0xc7'),{'event':_0x1cb9('0x89'),'message':_0x3ebdf2},client9002);return _0x3ebdf2;})['then'](respondWithResult(_0x3b4e77,null))[_0x1cb9('0x25')](handleError(_0x3b4e77,null));};exports[_0x1cb9('0xc8')]=function(_0x36f697,_0x1f56f0,_0x238efb){var _0x55ca8f,_0x1324f4,_0x570a8c;var _0x299d6b=[];var _0x478f5e=[];var _0x1199ed={};return db['CmContact'][_0x1cb9('0x5f')]()[_0x1cb9('0x1d')](function(_0x1616e2){if(!_0x1616e2){throw new db[(_0x1cb9('0x90'))][(_0x1cb9('0x91'))](_0x1cb9('0x92'));}_0x478f5e=_[_0x1cb9('0x93')](_[_0x1cb9('0x3c')](_0x1616e2),['createdAt',_0x1cb9('0x95')]);_0x299d6b=_[_0x1cb9('0x93')](_[_0x1cb9('0x3c')](_0x1616e2),[_0x1cb9('0x94'),_0x1cb9('0x95'),_0x1cb9('0xc9'),'ListId']);if(_0x36f697['body']['id']){delete _0x36f697[_0x1cb9('0x57')]['id'];}if(_[_0x1cb9('0x7c')](_0x36f697[_0x1cb9('0x57')][_0x1cb9('0x9b')])){throw _0x1f56f0[_0x1cb9('0x26')](0x1f4)[_0x1cb9('0x36')](new db['Sequelize']['ValidationError'](_0x1cb9('0x96')));}if(_[_0x1cb9('0x7c')](_0x36f697[_0x1cb9('0x57')]['body'])||_0x36f697[_0x1cb9('0x57')][_0x1cb9('0x57')]===''){throw _0x1f56f0[_0x1cb9('0x26')](0x1f4)['send'](new db[(_0x1cb9('0x90'))][(_0x1cb9('0x91'))](_0x1cb9('0x97')));}if(_[_0x1cb9('0x7c')](_0x36f697[_0x1cb9('0x57')][_0x1cb9('0xca')])){throw _0x1f56f0[_0x1cb9('0x26')](0x1f4)[_0x1cb9('0x36')](new db[(_0x1cb9('0x90'))][(_0x1cb9('0x91'))](_0x1cb9('0xcb')+_0x299d6b));}if(!_[_0x1cb9('0x9a')](_0x299d6b,_0x36f697['body'][_0x1cb9('0xca')])){throw _0x1f56f0['status'](0x1f4)['send'](new db['Sequelize']['ValidationError'](_0x1cb9('0xcc')+_0x299d6b));}_0x1199ed[_0x36f697[_0x1cb9('0x57')]['mapKeyOffline']]=_0x36f697[_0x1cb9('0x57')]['from'];})[_0x1cb9('0x1d')](function(){return db[_0x1cb9('0x39')][_0x1cb9('0x55')]({'where':{'id':_0x36f697['params']['id']},'include':[{'model':db[_0x1cb9('0x9c')],'as':_0x1cb9('0x9d')}]});})[_0x1cb9('0x1d')](handleEntityNotFound(_0x1f56f0,null))[_0x1cb9('0x1d')](function(_0x1b7b90){if(_0x1b7b90&&_0x1b7b90[_0x1cb9('0x9d')]){_0x1324f4=_0x1b7b90;var _0x2ddb5f=_[_0x1cb9('0x16')](_0x36f697['body'],{'firstName':_0x36f697[_0x1cb9('0x57')]['from'],'phone':_0x36f697[_0x1cb9('0x57')]['from'],'ListId':_0x1b7b90[_0x1cb9('0xcd')]});_0x2ddb5f[_0x36f697[_0x1cb9('0x57')][_0x1cb9('0xca')]]=_0x36f697['body'][_0x1cb9('0x9b')];return db[_0x1cb9('0x8f')][_0x1cb9('0xce')]({'where':_0x1199ed,'defaults':_0x2ddb5f});}})[_0x1cb9('0xb9')](function(_0x134436){if(_0x134436){_0x570a8c=_0x134436;var _0x5e3c80=fs[_0x1cb9('0xcf')](path[_0x1cb9('0x75')](config[_0x1cb9('0x76')],'server/files/templates/chatOfflineMessage.ejs'),_0x1cb9('0xd0'));var _0x1978d3=ejs[_0x1cb9('0xd1')](_0x5e3c80,{'body':_[_0x1cb9('0xd2')](_0x36f697['body'][_0x1cb9('0x57')]),'bodyTitle':_0x1324f4['offlineMessageBody']});return db['ChatOfflineMessage'][_0x1cb9('0x56')]({'body':_0x1978d3,'ContactId':_0x134436['id'],'ChatWebsiteId':_0x1324f4['id']});}})['then'](function(_0x209ba0){if(_0x209ba0){_0x55ca8f=_0x209ba0;return db['MailAccount'][_0x1cb9('0x62')]({'where':{'service':!![]},'include':[{'model':db[_0x1cb9('0xd3')],'as':'Smtp','raw':!![]}]});}})[_0x1cb9('0x1d')](function(_0x1054e7){if(_0x1054e7&&_0x1054e7[_0x1cb9('0xd4')]&&_0x1324f4[_0x1cb9('0xd5')]){var _0x1effea={'tls':{'rejectUnauthorized':![]}};if(_0x1054e7[_0x1cb9('0xd4')]['service']){_0x1effea[_0x1cb9('0xd6')]=_0x1054e7[_0x1cb9('0xd4')][_0x1cb9('0xd6')];}else{_0x1effea[_0x1cb9('0xd7')]=_0x1054e7[_0x1cb9('0xd4')][_0x1cb9('0xd7')];_0x1effea['port']=_0x1054e7['Smtp'][_0x1cb9('0xd8')];_0x1effea[_0x1cb9('0xd9')]=_0x1054e7[_0x1cb9('0xd4')][_0x1cb9('0xd9')];}if(_0x1054e7['Smtp'][_0x1cb9('0xda')]){_0x1effea[_0x1cb9('0xdb')]={'user':_0x1054e7[_0x1cb9('0xd4')]['user'],'pass':_0x1054e7[_0x1cb9('0xd4')][_0x1cb9('0xdc')]};}return respondWithRpcPromise('SendMail',_0x1cb9('0xdd'),{'account':_0x1effea,'message':{'from':util[_0x1cb9('0xae')]('\x22%s\x22\x20<%s>',_0x1054e7[_0x1cb9('0x35')],_0x1054e7[_0x1cb9('0xde')]||_0x1054e7[_0x1cb9('0xd4')][_0x1cb9('0x58')]),'to':_0x1324f4[_0x1cb9('0xd5')],'subject':_0x1324f4[_0x1cb9('0xdf')],'text':_0x55ca8f[_0x1cb9('0x57')]}},client9003)['then'](function(){return _0x55ca8f;})[_0x1cb9('0x25')](function(_0x495fe6){console[_0x1cb9('0x23')](_0x495fe6);});}})[_0x1cb9('0x1d')](function(){if(_0x55ca8f){return _0x55ca8f;}})[_0x1cb9('0x1d')](respondWithResult(_0x1f56f0,null))[_0x1cb9('0x25')](handleError(_0x1f56f0,null));};exports['addInteraction']=function(_0xe12117,_0x4f2772,_0x55c1ee){return db['ChatInteraction'][_0x1cb9('0x55')]({'where':{'id':_0xe12117['params']['id']}})['then'](handleEntityNotFound(_0x4f2772,null))[_0x1cb9('0x1d')](function(_0x5172c5){if(_0x5172c5){return _0x5172c5[_0x1cb9('0xe0')](_0xe12117['body'][_0x1cb9('0x6c')],_[_0x1cb9('0xe1')](_0xe12117[_0x1cb9('0x57')],[_0x1cb9('0x6c'),'id'])||{});}})[_0x1cb9('0x1d')](respondWithResult(_0x4f2772,null))[_0x1cb9('0x25')](handleError(_0x4f2772,null));};exports[_0x1cb9('0xe2')]=function(_0x3cbd38,_0x1a4b8c,_0x2db5cd){var _0x217471={'raw':![],'where':{}};var _0x24d864={};var _0x1b40ed={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x1cb9('0x62')]({'where':{'id':_0x3cbd38[_0x1cb9('0x52')]['id']}})['then'](handleEntityNotFound(_0x1a4b8c,null))['then'](function(_0xc2f0cc){if(_0xc2f0cc){_0x24d864[_0x1cb9('0x3b')]=_[_0x1cb9('0x3c')](db['ChatInteraction'][_0x1cb9('0x3a')]);_0x24d864[_0x1cb9('0x3d')]=_['keys'](_0x3cbd38[_0x1cb9('0x3d')]);_0x24d864[_0x1cb9('0x3e')]=_[_0x1cb9('0x3f')](_0x24d864[_0x1cb9('0x3b')],_0x24d864[_0x1cb9('0x3d')]);_0x217471[_0x1cb9('0x40')]=_['intersection'](_0x24d864[_0x1cb9('0x3b')],qs['fields'](_0x3cbd38[_0x1cb9('0x3d')]['fields']));_0x217471[_0x1cb9('0x40')]=_0x217471[_0x1cb9('0x40')][_0x1cb9('0x41')]?_0x217471[_0x1cb9('0x40')]:_0x24d864[_0x1cb9('0x3b')];if(!_0x3cbd38[_0x1cb9('0x3d')]['hasOwnProperty'](_0x1cb9('0x64'))){_0x217471[_0x1cb9('0x2a')]=qs[_0x1cb9('0x2a')](_0x3cbd38['query']['limit']);_0x217471[_0x1cb9('0x29')]=qs['offset'](_0x3cbd38[_0x1cb9('0x3d')][_0x1cb9('0x29')]);}_0x217471['order']=qs[_0x1cb9('0x43')](_0x3cbd38[_0x1cb9('0x3d')][_0x1cb9('0x43')]);_0x217471[_0x1cb9('0x44')]=qs[_0x1cb9('0x3e')](_[_0x1cb9('0x45')](_0x3cbd38[_0x1cb9('0x3d')],_0x24d864[_0x1cb9('0x3e')]));_0x217471[_0x1cb9('0x44')][_0x1cb9('0x66')]=_0xc2f0cc['id'];if(_0x3cbd38[_0x1cb9('0x3d')][_0x1cb9('0x4c')]){_0x217471['where']=_[_0x1cb9('0x46')](_0x217471[_0x1cb9('0x44')],{'$or':_[_0x1cb9('0x47')](_0x217471[_0x1cb9('0x40')],function(_0xeab9b9){var _0x5d0cd8={};_0x5d0cd8[_0xeab9b9]={'$like':'%'+_0x3cbd38[_0x1cb9('0x3d')][_0x1cb9('0x4c')]+'%'};return _0x5d0cd8;})});}_0x217471=_['merge']({},_0x217471,_0x3cbd38[_0x1cb9('0x4d')]);return db[_0x1cb9('0xb5')][_0x1cb9('0x4e')]({'where':_0x217471[_0x1cb9('0x44')]})[_0x1cb9('0x1d')](function(_0x3c3e9e){_0x1b40ed['count']=_0x3c3e9e;if(_0x3cbd38[_0x1cb9('0x3d')][_0x1cb9('0x54')]){_0x217471['include']=[{'model':db[_0x1cb9('0x8f')],'as':_0x1cb9('0xe3'),'required':![]},{'model':db[_0x1cb9('0xc1')],'as':'Owner','attributes':['name',_0x1cb9('0xe4'),_0x1cb9('0xe5')],'required':![]},{'model':db[_0x1cb9('0xe6')],'as':_0x1cb9('0xe7'),'attributes':['id',_0x1cb9('0x35'),_0x1cb9('0xe8')],'where':_0x3cbd38[_0x1cb9('0x3d')]['tag']?{'id':_0x3cbd38['query']['tag']}:undefined,'required':_0x3cbd38[_0x1cb9('0x3d')]['tag']?!![]:![]}];}return db[_0x1cb9('0xb5')][_0x1cb9('0x50')](_0x217471);})[_0x1cb9('0x1d')](function(_0x45581c){_0x1b40ed[_0x1cb9('0x51')]=_0x45581c;return _0x1b40ed;});}})['then'](respondWithFilteredResult(_0x1a4b8c,_0x217471))[_0x1cb9('0x25')](handleError(_0x1a4b8c,null));};function iftimePromise(_0x590374,_0x4ecf13){return respondWithRpcPromise(_0x1cb9('0xe9'),_0x1cb9('0xea'),{'command':_0x4ecf13[_0x1cb9('0xeb')]?util['format'](_0x1cb9('0xec'),_0x590374[_0x1cb9('0xed')],_0x4ecf13[_0x1cb9('0xeb')]):util[_0x1cb9('0xae')](_0x1cb9('0xee'),_0x590374[_0x1cb9('0xed')])},client9002)[_0x1cb9('0x1d')](function(_0x3ab9a0){var _0x30e355=_0x3ab9a0&&_0x3ab9a0[_0x1cb9('0xef')](_0x1cb9('0xf0'))>=0x0?!![]:![];logger[_0x1cb9('0xf1')](_0x1cb9('0xf2'),_0x4ecf13['id'],_0x590374['id'],_0x590374[_0x1cb9('0xed')],_0x30e355?_0x1cb9('0xf3'):'OFFLINE',_0x4ecf13[_0x1cb9('0xeb')]?_0x4ecf13['timezone']:'No\x20timezone');return _0x30e355;})[_0x1cb9('0x25')](function(_0x3bd28f){logger[_0x1cb9('0x23')](_0x1cb9('0xf2'),_0x4ecf13['id'],_0x590374['id'],_0x590374[_0x1cb9('0xed')],util[_0x1cb9('0xf4')](_0x3bd28f,{'showHidden':![],'depth':null}),_0x4ecf13[_0x1cb9('0xeb')]?_0x4ecf13['timezone']:'No\x20timezone');return![];});}exports['getSnippet']=function(_0x326ed4,_0x1ae2e4,_0x485400){var _0x4cd96f=0x0;var _0x23bda7=0x0;var _0x28d76e=![];var _0x15e440;var _0x5d2d8a;return db[_0x1cb9('0x39')][_0x1cb9('0x55')]({'where':{'id':_0x326ed4['params']['id']},'include':[{'model':db[_0x1cb9('0xf5')],'as':_0x1cb9('0xf5'),'include':[{'model':db[_0x1cb9('0xf5')],'as':_0x1cb9('0xf6'),'attributes':['id',_0x1cb9('0xed')],'raw':!![]}]}]})[_0x1cb9('0x1d')](handleEntityNotFound(_0x1ae2e4,null))['then'](function(_0x51b930){if(_0x51b930){_0x15e440=_0x51b930;return _0x51b930['getProactiveActions']({'raw':!![]});}})[_0x1cb9('0x1d')](function(_0x4ec950){if(_0x15e440){if(_0x4ec950){_0x5d2d8a=_0x4ec950;}}return require('../../config/license/util')[_0x1cb9('0x7a')]();})['then'](function(_0x18af58){if(_0x18af58){_0x23bda7=_0x18af58['virtual'];_0x28d76e=_0x18af58[_0x1cb9('0x7b')];}})['then'](function(){return db[_0x1cb9('0xb5')]['count']({'where':{'closed':![]}});})[_0x1cb9('0x1d')](function(_0x230406){_0x4cd96f=_0x230406;if(_0x23bda7&&_0x230406>_0x23bda7){return db['License'][_0x1cb9('0x62')]({'where':{'id':0x1}})[_0x1cb9('0x1d')](function(_0x2d4546){if(_0x2d4546){_0x2d4546[_0x1cb9('0xf7')](_0x1cb9('0xf8'));}});}})['then'](function(){if(_0x15e440[_0x1cb9('0xf5')]&&_0x15e440['Interval'][_0x1cb9('0xf6')]){var _0xfa7f26=[];for(var _0x13bd91=0x0;_0x13bd91<_0x15e440[_0x1cb9('0xf5')][_0x1cb9('0xf6')][_0x1cb9('0x41')];_0x13bd91++){var _0x360400=_0x15e440[_0x1cb9('0xf5')]['Intervals'][_0x13bd91]['get']({'plain':!![]});_0xfa7f26['push'](iftimePromise(_0x360400,_0x15e440));}return BPromise[_0x1cb9('0xf9')](_0xfa7f26)[_0x1cb9('0x1d')](function(_0x453693){return _[_0x1cb9('0xfa')](_0x453693);});}else{return!![];}})[_0x1cb9('0x1d')](function(_0x45d47e){var _0x18a571=fs[_0x1cb9('0xcf')](path[_0x1cb9('0x75')](config['root'],'server/files/chat/iframe.js'),_0x1cb9('0xd0'));var _0x35d396={'remote':_0x15e440[_0x1cb9('0xfb')],'query':querystring[_0x1cb9('0x22')](_[_0x1cb9('0x46')](_0x15e440[_0x1cb9('0x30')]({'plain':!![]}),{'customerIp':_0x326ed4[_0x1cb9('0x8b')][_0x1cb9('0xfc')]||_0x326ed4[_0x1cb9('0x8b')][_0x1cb9('0xfd')]||_0x326ed4['connection'][_0x1cb9('0xfe')]||_0x326ed4['ip'],'referer':_0x326ed4[_0x1cb9('0x8b')][_0x1cb9('0xab')],'openedInteractions':_0x4cd96f,'maxInteractions':_0x23bda7,'virtual':_0x28d76e[_0x1cb9('0xff')],'online':_0x45d47e,'custom':_0x28d76e}))['replace'](/'/g,'\x5c\x27')};_0x1ae2e4[_0x1cb9('0x36')](ejs[_0x1cb9('0xd1')](Mustache[_0x1cb9('0xd1')](_0x18a571,_0x35d396),{'proactiveActions':_0x5d2d8a,'alignment':_0x15e440[_0x1cb9('0x100')],'verticalAlignment':_0x15e440['verticalAlignment']}));})[_0x1cb9('0x25')](handleError(_0x1ae2e4,null));};exports[_0x1cb9('0x101')]=function(_0x272b2b,_0x4583f9,_0x418cd4){return db[_0x1cb9('0x39')][_0x1cb9('0x62')]({'where':{'id':_0x272b2b[_0x1cb9('0x52')]['id']}})['then'](handleEntityNotFound(_0x4583f9,null))['then'](function(_0x5cafca){if(_0x5cafca){return db[_0x1cb9('0x102')]['transaction'](function(_0x5de7c9){return db[_0x1cb9('0xa0')][_0x1cb9('0x2f')]({'where':{'ChatWebsiteId':_0x272b2b['params']['id']},'transaction':_0x5de7c9})[_0x1cb9('0x1d')](function(_0x2ca68a){var _0x4ea59b=_[_0x1cb9('0x47')](_0x272b2b[_0x1cb9('0x57')],function(_0x5368b1){_0x5368b1[_0x1cb9('0x66')]=_0x272b2b[_0x1cb9('0x52')]['id'];return _0x5368b1;});return db[_0x1cb9('0xa0')][_0x1cb9('0x103')](_0x4ea59b,{'transaction':_0x5de7c9});});})[_0x1cb9('0x1d')](function(){return db[_0x1cb9('0xa0')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x272b2b['params']['id']},'order':_0x1cb9('0xa6')});});}})[_0x1cb9('0x1d')](respondWithResult(_0x4583f9,null))['catch'](handleError(_0x4583f9,null));};exports[_0x1cb9('0x104')]=function(_0x3d26ca,_0x2d6c56,_0x58509f){var _0x5ca624={};var _0x14106e={};var _0x1babdc;var _0x57c223;return db[_0x1cb9('0x39')][_0x1cb9('0x62')]({'where':{'id':_0x3d26ca[_0x1cb9('0x52')]['id']}})['then'](handleEntityNotFound(_0x2d6c56,null))['then'](function(_0x31b47e){if(_0x31b47e){_0x1babdc=_0x31b47e;_0x14106e[_0x1cb9('0x3b')]=_[_0x1cb9('0x3c')](db[_0x1cb9('0xa0')]['rawAttributes']);_0x14106e[_0x1cb9('0x3d')]=_[_0x1cb9('0x3c')](_0x3d26ca[_0x1cb9('0x3d')]);_0x14106e[_0x1cb9('0x3e')]=_[_0x1cb9('0x3f')](_0x14106e['model'],_0x14106e['query']);_0x5ca624[_0x1cb9('0x40')]=_[_0x1cb9('0x3f')](_0x14106e[_0x1cb9('0x3b')],qs[_0x1cb9('0x53')](_0x3d26ca[_0x1cb9('0x3d')][_0x1cb9('0x53')]));_0x5ca624['attributes']=_0x5ca624[_0x1cb9('0x40')]['length']?_0x5ca624[_0x1cb9('0x40')]:_0x14106e[_0x1cb9('0x3b')];_0x5ca624['order']=qs['sort'](_0x3d26ca[_0x1cb9('0x3d')][_0x1cb9('0x43')]);_0x5ca624['where']=qs[_0x1cb9('0x3e')](_[_0x1cb9('0x45')](_0x3d26ca[_0x1cb9('0x3d')],_0x14106e[_0x1cb9('0x3e')]));if(_0x3d26ca[_0x1cb9('0x3d')][_0x1cb9('0x4c')]){_0x5ca624[_0x1cb9('0x44')]=_[_0x1cb9('0x46')](_0x5ca624[_0x1cb9('0x44')],{'$or':_[_0x1cb9('0x47')](_0x5ca624[_0x1cb9('0x40')],function(_0x3cf954){var _0x3e8470={};_0x3e8470[_0x3cf954]={'$like':'%'+_0x3d26ca['query'][_0x1cb9('0x4c')]+'%'};return _0x3e8470;})});}_0x5ca624=_[_0x1cb9('0x46')]({},_0x5ca624,_0x3d26ca[_0x1cb9('0x4d')]);return _0x1babdc[_0x1cb9('0x104')](_0x5ca624);}})[_0x1cb9('0x1d')](function(_0x355c3a){if(_0x355c3a){_0x57c223=_0x355c3a['length'];if(!_0x3d26ca[_0x1cb9('0x3d')][_0x1cb9('0x42')]('nolimit')){_0x5ca624[_0x1cb9('0x2a')]=qs[_0x1cb9('0x2a')](_0x3d26ca['query'][_0x1cb9('0x2a')]);_0x5ca624[_0x1cb9('0x29')]=qs[_0x1cb9('0x29')](_0x3d26ca[_0x1cb9('0x3d')][_0x1cb9('0x29')]);}return _0x1babdc[_0x1cb9('0x104')](_0x5ca624);}})['then'](function(_0x412c66){if(_0x412c66){return _0x412c66?{'count':_0x57c223,'rows':_0x412c66}:null;}})[_0x1cb9('0x1d')](respondWithResult(_0x2d6c56,null))[_0x1cb9('0x25')](handleError(_0x2d6c56,null));};exports['addProactiveActions']=function(_0xbaff47,_0x4af331,_0x5ad938){return db[_0x1cb9('0x105')][_0x1cb9('0x55')]({'where':{'id':_0xbaff47[_0x1cb9('0x52')]['id']}})[_0x1cb9('0x1d')](handleEntityNotFound(_0x4af331,null))['then'](function(_0xd31a99){if(_0xd31a99){return _0xd31a99[_0x1cb9('0x106')](_0xbaff47[_0x1cb9('0x57')][_0x1cb9('0x6c')],_[_0x1cb9('0xe1')](_0xbaff47[_0x1cb9('0x57')],[_0x1cb9('0x6c'),'id'])||{});}})['then'](respondWithResult(_0x4af331,null))[_0x1cb9('0x25')](handleError(_0x4af331,null));};exports[_0x1cb9('0x107')]=function(_0x398fc1,_0x5e3666,_0x20db03){var _0x572ef7={};var _0x396540={};var _0x4561cc;var _0x2733af;return db[_0x1cb9('0x39')][_0x1cb9('0x62')]({'where':{'id':_0x398fc1['params']['id']}})['then'](handleEntityNotFound(_0x5e3666,null))['then'](function(_0x4fbe4a){if(_0x4fbe4a){_0x4561cc=_0x4fbe4a;_0x396540[_0x1cb9('0x3b')]=_['keys'](db[_0x1cb9('0x108')]['rawAttributes']);_0x396540[_0x1cb9('0x3d')]=_[_0x1cb9('0x3c')](_0x398fc1[_0x1cb9('0x3d')]);_0x396540[_0x1cb9('0x3e')]=_[_0x1cb9('0x3f')](_0x396540[_0x1cb9('0x3b')],_0x396540[_0x1cb9('0x3d')]);_0x572ef7[_0x1cb9('0x40')]=_['intersection'](_0x396540[_0x1cb9('0x3b')],qs[_0x1cb9('0x53')](_0x398fc1[_0x1cb9('0x3d')][_0x1cb9('0x53')]));_0x572ef7[_0x1cb9('0x40')]=_0x572ef7['attributes']['length']?_0x572ef7[_0x1cb9('0x40')]:_0x396540['model'];_0x572ef7['order']=qs['sort'](_0x398fc1[_0x1cb9('0x3d')][_0x1cb9('0x43')]);_0x572ef7[_0x1cb9('0x44')]=qs[_0x1cb9('0x3e')](_[_0x1cb9('0x45')](_0x398fc1['query'],_0x396540[_0x1cb9('0x3e')]));if(_0x398fc1[_0x1cb9('0x3d')]['filter']){_0x572ef7[_0x1cb9('0x44')]=_[_0x1cb9('0x46')](_0x572ef7[_0x1cb9('0x44')],{'$or':_[_0x1cb9('0x47')](_0x572ef7[_0x1cb9('0x40')],function(_0x74cb14){var _0x39b4fa={};_0x39b4fa[_0x74cb14]={'$like':'%'+_0x398fc1['query'][_0x1cb9('0x4c')]+'%'};return _0x39b4fa;})});}_0x572ef7=_['merge']({},_0x572ef7,_0x398fc1['options']);return _0x4561cc[_0x1cb9('0x107')](_0x572ef7);}})['then'](function(_0x2c9609){if(_0x2c9609){_0x2733af=_0x2c9609[_0x1cb9('0x41')];if(!_0x398fc1[_0x1cb9('0x3d')]['hasOwnProperty'](_0x1cb9('0x64'))){_0x572ef7[_0x1cb9('0x2a')]=qs[_0x1cb9('0x2a')](_0x398fc1[_0x1cb9('0x3d')][_0x1cb9('0x2a')]);_0x572ef7[_0x1cb9('0x29')]=qs['offset'](_0x398fc1[_0x1cb9('0x3d')][_0x1cb9('0x29')]);}return _0x4561cc['getProactiveActions'](_0x572ef7);}})['then'](function(_0x216681){if(_0x216681){return _0x216681?{'count':_0x2733af,'rows':_0x216681}:null;}})[_0x1cb9('0x1d')](respondWithResult(_0x5e3666,null))[_0x1cb9('0x25')](handleError(_0x5e3666,null));};exports[_0x1cb9('0x109')]=function(_0x42615a,_0x5eafc3,_0x329d38){var _0x52c1cd=_0x42615a[_0x1cb9('0x3d')][_0x1cb9('0x10a')]===_0x1cb9('0x10b')?_0x1cb9('0x10c'):_0x1cb9('0x10d');return db['ChatWebsite'][_0x1cb9('0x55')]({'attributes':['id',_0x52c1cd],'where':{'id':_0x42615a['params']['id']}})[_0x1cb9('0x1d')](handleEntityNotFound(_0x5eafc3,null))['then'](function(_0x2d699d){if(_0x2d699d){var _0x37a414=_0x2d699d[_0x52c1cd];var _0x56042a=_0x37a414&&_0x37a414[_0x1cb9('0x10e')]?_0x37a414['items']:[];_0x5eafc3[_0x1cb9('0x36')]({'fromKey':_[_0x1cb9('0x7c')](_0x37a414['fromKey'])?undefined:_0x37a414[_0x1cb9('0x10f')],'count':_0x56042a[_0x1cb9('0x41')],'rows':_0x56042a});}})[_0x1cb9('0x25')](handleError(_0x5eafc3,null));};exports[_0x1cb9('0x110')]=function(_0x4c47c5,_0x50e7f3,_0x9adb8d){var _0x44edbf={'raw':!![],'where':{}};var _0x45e5cd={};var _0x1403ae={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x1cb9('0x62')]({'where':{'id':_0x4c47c5[_0x1cb9('0x52')]['id']}})['then'](handleEntityNotFound(_0x50e7f3,null))[_0x1cb9('0x1d')](function(_0x18a18f){if(_0x18a18f){_0x45e5cd[_0x1cb9('0x3b')]=_['keys'](db[_0x1cb9('0x111')]['rawAttributes']);_0x45e5cd[_0x1cb9('0x3d')]=_[_0x1cb9('0x3c')](_0x4c47c5['query']);_0x45e5cd[_0x1cb9('0x3e')]=_[_0x1cb9('0x3f')](_0x45e5cd[_0x1cb9('0x3b')],_0x45e5cd['query']);_0x44edbf[_0x1cb9('0x40')]=_[_0x1cb9('0x3f')](_0x45e5cd['model'],qs[_0x1cb9('0x53')](_0x4c47c5[_0x1cb9('0x3d')][_0x1cb9('0x53')]));_0x44edbf[_0x1cb9('0x40')]=_0x44edbf['attributes'][_0x1cb9('0x41')]?_0x44edbf['attributes']:_0x45e5cd['model'];if(!_0x4c47c5[_0x1cb9('0x3d')]['hasOwnProperty'](_0x1cb9('0x64'))){_0x44edbf[_0x1cb9('0x2a')]=qs[_0x1cb9('0x2a')](_0x4c47c5['query'][_0x1cb9('0x2a')]);_0x44edbf[_0x1cb9('0x29')]=qs[_0x1cb9('0x29')](_0x4c47c5[_0x1cb9('0x3d')][_0x1cb9('0x29')]);}_0x44edbf[_0x1cb9('0x65')]=qs[_0x1cb9('0x43')](_0x4c47c5[_0x1cb9('0x3d')][_0x1cb9('0x43')]);_0x44edbf[_0x1cb9('0x44')]=qs[_0x1cb9('0x3e')](_[_0x1cb9('0x45')](_0x4c47c5['query'],_0x45e5cd[_0x1cb9('0x3e')]));_0x44edbf[_0x1cb9('0x44')][_0x1cb9('0x66')]=_0x18a18f['id'];if(_0x4c47c5[_0x1cb9('0x3d')][_0x1cb9('0x4c')]){_0x44edbf[_0x1cb9('0x44')]=_['merge'](_0x44edbf[_0x1cb9('0x44')],{'$or':_[_0x1cb9('0x47')](_0x44edbf[_0x1cb9('0x40')],function(_0x43f3af){var _0x44ad12={};_0x44ad12[_0x43f3af]={'$like':'%'+_0x4c47c5['query'][_0x1cb9('0x4c')]+'%'};return _0x44ad12;})});}_0x44edbf=_['merge']({},_0x44edbf,_0x4c47c5[_0x1cb9('0x4d')]);return db[_0x1cb9('0x111')][_0x1cb9('0x4e')]({'where':_0x44edbf[_0x1cb9('0x44')]})[_0x1cb9('0x1d')](function(_0x46fd23){_0x1403ae[_0x1cb9('0x4e')]=_0x46fd23;if(_0x4c47c5[_0x1cb9('0x3d')][_0x1cb9('0x54')]){_0x44edbf['include']=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x1cb9('0x50')](_0x44edbf);})[_0x1cb9('0x1d')](function(_0x411704){_0x1403ae[_0x1cb9('0x51')]=_0x411704;return _0x1403ae;});}})[_0x1cb9('0x1d')](respondWithFilteredResult(_0x50e7f3,_0x44edbf))[_0x1cb9('0x25')](handleError(_0x50e7f3,null));};exports[_0x1cb9('0x112')]=function(_0x50bcf7,_0xdbdf68,_0x5bd3dc){return db[_0x1cb9('0x39')]['find']({'where':{'id':_0x50bcf7[_0x1cb9('0x52')]['id']}})[_0x1cb9('0x1d')](handleEntityNotFound(_0xdbdf68,null))[_0x1cb9('0x1d')](function(_0x50e87a){if(_0x50e87a){return _0x50e87a['addAgents'](_0x50bcf7[_0x1cb9('0x57')]['ids'],_[_0x1cb9('0xe1')](_0x50bcf7[_0x1cb9('0x57')],[_0x1cb9('0x6c'),'id'])||{})[_0x1cb9('0xb9')](function(_0x380938){for(var _0x49bc3a=0x0;_0x49bc3a<_0x50bcf7[_0x1cb9('0x57')][_0x1cb9('0x6c')][_0x1cb9('0x41')];_0x49bc3a+=0x1){socket[_0x1cb9('0x113')](_0x1cb9('0x114'),{'UserId':_0x50bcf7[_0x1cb9('0x57')][_0x1cb9('0x6c')][_0x49bc3a],'ChatWebsiteId':_0x50bcf7['params']['id']});}return _0x380938;});}})[_0x1cb9('0x1d')](respondWithResult(_0xdbdf68,null))['catch'](handleError(_0xdbdf68,null));};exports['removeAgents']=function(_0x3f1ebf,_0x32b643,_0x5cf703){var _0xb79d5a;return db[_0x1cb9('0x39')][_0x1cb9('0x55')]({'where':{'id':_0x3f1ebf[_0x1cb9('0x52')]['id']}})[_0x1cb9('0x1d')](handleEntityNotFound(_0x32b643,null))[_0x1cb9('0x1d')](function(_0x55c04a){if(_0x55c04a){return _0x55c04a[_0x1cb9('0x115')](_0x3f1ebf['query'][_0x1cb9('0x6c')])[_0x1cb9('0x1d')](function(_0x3bf6e4){if(_['isArray'](_0x3f1ebf['query'][_0x1cb9('0x6c')])){for(var _0x4be607=0x0;_0x4be607<_0x3f1ebf['query'][_0x1cb9('0x6c')][_0x1cb9('0x41')];_0x4be607+=0x1){socket['emit'](_0x1cb9('0x116'),{'UserId':_0x3f1ebf[_0x1cb9('0x3d')][_0x1cb9('0x6c')][_0x4be607],'ChatWebsiteId':_0x3f1ebf[_0x1cb9('0x52')]['id']});}}else{socket[_0x1cb9('0x113')]('userChatWebsite:remove',{'UserId':_0x3f1ebf[_0x1cb9('0x3d')][_0x1cb9('0x6c')],'ChatWebsiteId':_0x3f1ebf[_0x1cb9('0x52')]['id']});}});}})[_0x1cb9('0x1d')](respondWithStatusCode(_0x32b643,null))['catch'](handleError(_0x32b643,null));};exports[_0x1cb9('0x117')]=function(_0x38b52e,_0x5e0361,_0x230de0){var _0x566828={};var _0x12868a={};var _0x446490;var _0x3f318d;return db[_0x1cb9('0x39')]['findOne']({'where':{'id':_0x38b52e[_0x1cb9('0x52')]['id']}})['then'](handleEntityNotFound(_0x5e0361,null))[_0x1cb9('0x1d')](function(_0x863d6b){if(_0x863d6b){_0x446490=_0x863d6b;_0x12868a[_0x1cb9('0x3b')]=_[_0x1cb9('0x3c')](db[_0x1cb9('0xc1')][_0x1cb9('0x3a')]);_0x12868a[_0x1cb9('0x3d')]=_[_0x1cb9('0x3c')](_0x38b52e[_0x1cb9('0x3d')]);_0x12868a[_0x1cb9('0x3e')]=_[_0x1cb9('0x3f')](_0x12868a[_0x1cb9('0x3b')],_0x12868a['query']);_0x566828[_0x1cb9('0x40')]=_[_0x1cb9('0x3f')](_0x12868a[_0x1cb9('0x3b')],qs[_0x1cb9('0x53')](_0x38b52e[_0x1cb9('0x3d')][_0x1cb9('0x53')]));_0x566828[_0x1cb9('0x40')]=_0x566828[_0x1cb9('0x40')]['length']?_0x566828[_0x1cb9('0x40')]:_0x12868a[_0x1cb9('0x3b')];_0x566828[_0x1cb9('0x65')]=qs['sort'](_0x38b52e[_0x1cb9('0x3d')]['sort']);_0x566828[_0x1cb9('0x44')]=qs[_0x1cb9('0x3e')](_['pick'](_0x38b52e['query'],_0x12868a[_0x1cb9('0x3e')]));if(_0x38b52e[_0x1cb9('0x3d')][_0x1cb9('0x4c')]){_0x566828[_0x1cb9('0x44')]=_[_0x1cb9('0x46')](_0x566828['where'],{'$or':_['map'](_0x566828['attributes'],function(_0x1cdcb6){var _0x1c5709={};_0x1c5709[_0x1cdcb6]={'$like':'%'+_0x38b52e[_0x1cb9('0x3d')][_0x1cb9('0x4c')]+'%'};return _0x1c5709;})});}_0x566828=_[_0x1cb9('0x46')]({},_0x566828,_0x38b52e[_0x1cb9('0x4d')]);return _0x446490['getAgents'](_0x566828);}})['then'](function(_0x37d45c){if(_0x37d45c){_0x3f318d=_0x37d45c[_0x1cb9('0x41')];if(!_0x38b52e[_0x1cb9('0x3d')][_0x1cb9('0x42')]('nolimit')){_0x566828[_0x1cb9('0x2a')]=qs[_0x1cb9('0x2a')](_0x38b52e[_0x1cb9('0x3d')][_0x1cb9('0x2a')]);_0x566828[_0x1cb9('0x29')]=qs[_0x1cb9('0x29')](_0x38b52e['query']['offset']);}return _0x446490['getAgents'](_0x566828);}})[_0x1cb9('0x1d')](function(_0x3bf219){if(_0x3bf219){return _0x3bf219?{'count':_0x3f318d,'rows':_0x3bf219}:null;}})['then'](respondWithResult(_0x5e0361,null))[_0x1cb9('0x25')](handleError(_0x5e0361,null));}; \ No newline at end of file +var _0xcb91=['showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','contact','firstName','lastName','customerIp','referer','browser','version','format','%s\x20%s','unknown','vendor','%s\x20%s\x20%s','device','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','CompanyId','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','findOrCreate','readFileSync','utf8','render','toPairs','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','sendMail','email','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','fullname','internal','Tag','Tags','color','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','info','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','inspect','Interval','Intervals','increment','chatLicenseExceeded','all','some','remote','x-forwarded-for','x-real-ip','remoteAddress','virtual','alignment','addApplications','sequelize','bulkCreate','getApplications','chatProactiveAction','addProactiveActions','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./chatWebsite.socket','register','jayson/promise','http','client','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','end','json','offset','limit','Content-Range','apply','reject','update','destroy','get','ChatWebsites','UserProfileResource','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','merge','map','type','key','VIRTUAL','field','filter','options','count','include','findAll','rows','params','fields','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','findOne','Disposition','nolimit','order','ChatWebsiteId','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addLogo','file','filename','addAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.png','sitepic','../../config/license/util','getLicense','custom','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xcb91[_0x17b6e3];return _0x3906f3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x1cb9('0xd'));var hardwareService=require(_0x1cb9('0xe'));var Redis=require(_0x1cb9('0xf'));var qs=require(_0x1cb9('0x10'));var logger=require(_0x1cb9('0x11'))('api');var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var db=require(_0x1cb9('0x14'))['db'];config[_0x1cb9('0x15')]=_[_0x1cb9('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1cb9('0x15')]));require(_0x1cb9('0x17'))[_0x1cb9('0x18')](socket);var jayson=require(_0x1cb9('0x19'));var client=jayson['client'][_0x1cb9('0x1a')]({'port':0x232c});var client9002=jayson[_0x1cb9('0x1b')][_0x1cb9('0x1a')]({'port':0x232a});var client9003=jayson[_0x1cb9('0x1b')][_0x1cb9('0x1a')]({'port':0x232b});function respondWithRpcPromise(_0x5806d8,_0x5572cb,_0xd446a3,_0x3cc765){return new BPromise(function(_0x3904b7,_0x3f1376){var _0x3e21e0=_0x3cc765||client;return _0x3e21e0[_0x1cb9('0x1c')](_0x5806d8,_0xd446a3)[_0x1cb9('0x1d')](function(_0x4e1340){logger['info'](_0x1cb9('0x1e'),_0x5572cb,_0x1cb9('0x1f'));logger[_0x1cb9('0x20')](_0x1cb9('0x21'),_0x5572cb,_0x1cb9('0x1f'),JSON[_0x1cb9('0x22')](_0x4e1340));if(_0x4e1340[_0x1cb9('0x23')]){if(_0x4e1340['error']['code']===0x1f4){logger[_0x1cb9('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x5572cb,_0x4e1340[_0x1cb9('0x23')][_0x1cb9('0x24')]);return _0x3f1376(_0x4e1340['error']['message']);}logger[_0x1cb9('0x23')](_0x1cb9('0x1e'),_0x5572cb,_0x4e1340[_0x1cb9('0x23')][_0x1cb9('0x24')]);return _0x3904b7(_0x4e1340[_0x1cb9('0x23')][_0x1cb9('0x24')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x5572cb,_0x1cb9('0x1f'));_0x3904b7(_0x4e1340['result'][_0x1cb9('0x24')]);}})[_0x1cb9('0x25')](function(_0x69b4c8){logger[_0x1cb9('0x23')](_0x1cb9('0x1e'),_0x5572cb,_0x69b4c8);_0x3f1376(_0x69b4c8);});});}function respondWithStatusCode(_0x53f9fa,_0x195f16){_0x195f16=_0x195f16||0xcc;return function(_0x9df250){if(_0x9df250){return _0x53f9fa['sendStatus'](_0x195f16);}return _0x53f9fa[_0x1cb9('0x26')](_0x195f16)[_0x1cb9('0x27')]();};}function respondWithResult(_0x41a9a0,_0x1804fd){_0x1804fd=_0x1804fd||0xc8;return function(_0x406821){if(_0x406821){return _0x41a9a0[_0x1cb9('0x26')](_0x1804fd)[_0x1cb9('0x28')](_0x406821);}};}function respondWithFilteredResult(_0xb644b3,_0x41e5c2){return function(_0x9de64b){if(_0x9de64b){var _0x48888d=_0x9de64b['count'],_0x405a2f=_0x41e5c2[_0x1cb9('0x29')],_0x536635=_0x41e5c2[_0x1cb9('0x29')]+_0x41e5c2[_0x1cb9('0x2a')],_0x110282;if(_0x536635>=_0x48888d){_0x536635=_0x48888d;_0x110282=0xc8;}else{_0x110282=0xce;}_0xb644b3[_0x1cb9('0x26')](_0x110282);return _0xb644b3['set'](_0x1cb9('0x2b'),_0x405a2f+'-'+_0x536635+'/'+_0x48888d)['json'](_0x9de64b);}return null;};}function patchUpdates(_0xe0a0e2){return function(_0x336a98){try{jsonpatch[_0x1cb9('0x2c')](_0x336a98,_0xe0a0e2,!![]);}catch(_0x5d8793){return BPromise[_0x1cb9('0x2d')](_0x5d8793);}return _0x336a98['save']();};}function saveUpdates(_0x3a3543,_0x58f4f5){return function(_0x2164e3){if(_0x2164e3){return _0x2164e3[_0x1cb9('0x2e')](_0x3a3543)[_0x1cb9('0x1d')](function(_0xae910){return _0xae910;});}return null;};}function removeEntity(_0x56c3e0,_0x2114a4){return function(_0xf71b9a){if(_0xf71b9a){return _0xf71b9a[_0x1cb9('0x2f')]()[_0x1cb9('0x1d')](function(){var _0xc6784c=_0xf71b9a[_0x1cb9('0x30')]({'plain':!![]});var _0xc6d5fd=_0x1cb9('0x31');return db[_0x1cb9('0x32')][_0x1cb9('0x2f')]({'where':{'type':_0xc6d5fd,'resourceId':_0xc6784c['id']}})[_0x1cb9('0x1d')](function(){return _0xf71b9a;});})[_0x1cb9('0x1d')](function(){_0x56c3e0[_0x1cb9('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54c6e6,_0x299ff8){return function(_0x30f7e4){if(!_0x30f7e4){_0x54c6e6[_0x1cb9('0x33')](0x194);}return _0x30f7e4;};}function handleError(_0x29f451,_0x385daa){_0x385daa=_0x385daa||0x1f4;return function(_0x3a06e6){logger[_0x1cb9('0x23')](_0x3a06e6[_0x1cb9('0x34')]);if(_0x3a06e6['name']){delete _0x3a06e6[_0x1cb9('0x35')];}_0x29f451[_0x1cb9('0x26')](_0x385daa)[_0x1cb9('0x36')](_0x3a06e6);};}exports['index']=function(_0x2a5aac,_0x5c7cd0){var _0x313e34={'include':[{'model':db[_0x1cb9('0x37')],'as':_0x1cb9('0x38')}]},_0x5701a3={},_0x2a73f2={'count':0x0,'rows':[]};var _0x2bcacd=db[_0x1cb9('0x39')][_0x1cb9('0x3a')];_0x5701a3[_0x1cb9('0x3b')]=_['keys'](_0x2bcacd);_0x5701a3['query']=_[_0x1cb9('0x3c')](_0x2a5aac[_0x1cb9('0x3d')]);_0x5701a3[_0x1cb9('0x3e')]=_[_0x1cb9('0x3f')](_0x5701a3[_0x1cb9('0x3b')],_0x5701a3[_0x1cb9('0x3d')]);_0x313e34[_0x1cb9('0x40')]=_['intersection'](_0x5701a3[_0x1cb9('0x3b')],qs['fields'](_0x2a5aac['query']['fields']));_0x313e34[_0x1cb9('0x40')]=_0x313e34[_0x1cb9('0x40')][_0x1cb9('0x41')]?_0x313e34[_0x1cb9('0x40')]:_0x5701a3[_0x1cb9('0x3b')];if(!_0x2a5aac['query'][_0x1cb9('0x42')]('nolimit')){_0x313e34[_0x1cb9('0x2a')]=qs[_0x1cb9('0x2a')](_0x2a5aac[_0x1cb9('0x3d')]['limit']);_0x313e34[_0x1cb9('0x29')]=qs['offset'](_0x2a5aac[_0x1cb9('0x3d')][_0x1cb9('0x29')]);}_0x313e34['order']=qs['sort'](_0x2a5aac[_0x1cb9('0x3d')][_0x1cb9('0x43')]);_0x313e34[_0x1cb9('0x44')]=qs[_0x1cb9('0x3e')](_[_0x1cb9('0x45')](_0x2a5aac['query'],_0x5701a3[_0x1cb9('0x3e')]));if(_0x2a5aac['query']['filter']){_0x313e34['where']=_[_0x1cb9('0x46')](_0x313e34[_0x1cb9('0x44')],{'$or':_[_0x1cb9('0x47')](_0x2bcacd,function(_0x11cea5){if(_0x11cea5[_0x1cb9('0x48')][_0x1cb9('0x49')]!==_0x1cb9('0x4a')){var _0x409b89={};_0x409b89[_0x11cea5[_0x1cb9('0x4b')]]={'$like':'%'+_0x2a5aac[_0x1cb9('0x3d')][_0x1cb9('0x4c')]+'%'};return _0x409b89;}})});}_0x313e34=_['merge']({},_0x313e34,_0x2a5aac[_0x1cb9('0x4d')]);var _0x237125={'where':_0x313e34[_0x1cb9('0x44')]};return db['ChatWebsite'][_0x1cb9('0x4e')](_0x237125)[_0x1cb9('0x1d')](function(_0x3c6044){_0x2a73f2[_0x1cb9('0x4e')]=_0x3c6044;if(_0x2a5aac[_0x1cb9('0x3d')]['includeAll']){_0x313e34[_0x1cb9('0x4f')]=[{'all':!![]}];}return db['ChatWebsite'][_0x1cb9('0x50')](_0x313e34);})['then'](function(_0x1cf2ee){_0x2a73f2[_0x1cb9('0x51')]=_0x1cf2ee;return _0x2a73f2;})[_0x1cb9('0x1d')](respondWithFilteredResult(_0x5c7cd0,_0x313e34))[_0x1cb9('0x25')](handleError(_0x5c7cd0,null));};exports['show']=function(_0x298475,_0x1149b9){var _0x1b750d={'raw':![],'where':{'id':_0x298475[_0x1cb9('0x52')]['id']},'include':[{'model':db[_0x1cb9('0x37')],'as':_0x1cb9('0x38')}]},_0x3561a5={};_0x3561a5[_0x1cb9('0x3b')]=_[_0x1cb9('0x3c')](db[_0x1cb9('0x39')]['rawAttributes']);_0x3561a5['query']=_[_0x1cb9('0x3c')](_0x298475[_0x1cb9('0x3d')]);_0x3561a5[_0x1cb9('0x3e')]=_[_0x1cb9('0x3f')](_0x3561a5[_0x1cb9('0x3b')],_0x3561a5[_0x1cb9('0x3d')]);_0x1b750d[_0x1cb9('0x40')]=_[_0x1cb9('0x3f')](_0x3561a5[_0x1cb9('0x3b')],qs[_0x1cb9('0x53')](_0x298475['query'][_0x1cb9('0x53')]));_0x1b750d['attributes']=_0x1b750d[_0x1cb9('0x40')]['length']?_0x1b750d[_0x1cb9('0x40')]:_0x3561a5['model'];if(_0x298475['query'][_0x1cb9('0x54')]){_0x1b750d[_0x1cb9('0x4f')]=[{'all':!![]}];}_0x1b750d=_[_0x1cb9('0x46')]({},_0x1b750d,_0x298475['options']);return db[_0x1cb9('0x39')][_0x1cb9('0x55')](_0x1b750d)['then'](handleEntityNotFound(_0x1149b9,null))['then'](respondWithResult(_0x1149b9,null))[_0x1cb9('0x25')](handleError(_0x1149b9,null));};exports[_0x1cb9('0x56')]=function(_0x3e70fc,_0x2b3f2a){return db[_0x1cb9('0x39')][_0x1cb9('0x56')](_0x3e70fc[_0x1cb9('0x57')],{})['then'](function(_0x345ddd){var _0x2607c7=_0x3e70fc[_0x1cb9('0x58')]['get']({'plain':!![]});if(!_0x2607c7)throw new Error(_0x1cb9('0x59'));if(_0x2607c7[_0x1cb9('0x5a')]===_0x1cb9('0x58')){var _0xf6eb2d=_0x345ddd[_0x1cb9('0x30')]({'plain':!![]});var _0x3c4681='ChatWebsites';return db[_0x1cb9('0x5b')][_0x1cb9('0x55')]({'where':{'name':_0x3c4681,'userProfileId':_0x2607c7[_0x1cb9('0x5c')]},'raw':!![]})[_0x1cb9('0x1d')](function(_0x4ad7cd){if(_0x4ad7cd&&_0x4ad7cd[_0x1cb9('0x5d')]===0x0){return db[_0x1cb9('0x32')][_0x1cb9('0x56')]({'name':_0xf6eb2d[_0x1cb9('0x35')],'resourceId':_0xf6eb2d['id'],'type':_0x4ad7cd[_0x1cb9('0x35')],'sectionId':_0x4ad7cd['id']},{})[_0x1cb9('0x1d')](function(){return _0x345ddd;});}else{return _0x345ddd;}})['catch'](function(_0xfc39e1){logger[_0x1cb9('0x23')](_0x1cb9('0x5e'),_0xfc39e1);throw _0xfc39e1;});}return _0x345ddd;})[_0x1cb9('0x1d')](respondWithResult(_0x2b3f2a,0xc9))['catch'](handleError(_0x2b3f2a,null));};exports['update']=function(_0x319358,_0x2f8f27){if(_0x319358[_0x1cb9('0x57')]['id']){delete _0x319358[_0x1cb9('0x57')]['id'];}return db[_0x1cb9('0x39')][_0x1cb9('0x55')]({'where':{'id':_0x319358[_0x1cb9('0x52')]['id']},'include':[{'model':db[_0x1cb9('0x37')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x2f8f27,null))[_0x1cb9('0x1d')](saveUpdates(_0x319358['body'],null))['then'](respondWithResult(_0x2f8f27,null))['catch'](handleError(_0x2f8f27,null));};exports['destroy']=function(_0x5d349b,_0x455c40){return db[_0x1cb9('0x39')][_0x1cb9('0x55')]({'where':{'id':_0x5d349b[_0x1cb9('0x52')]['id']}})[_0x1cb9('0x1d')](handleEntityNotFound(_0x455c40,null))[_0x1cb9('0x1d')](removeEntity(_0x455c40,null))['catch'](handleError(_0x455c40,null));};exports[_0x1cb9('0x5f')]=function(_0x3e1207,_0x5a72c8){return db['ChatWebsite'][_0x1cb9('0x5f')]()[_0x1cb9('0x1d')](respondWithResult(_0x5a72c8,null))[_0x1cb9('0x25')](handleError(_0x5a72c8,null));};exports[_0x1cb9('0x60')]=function(_0x13ff8b,_0x51ce73,_0x538ff0){if(_0x13ff8b['body']['id']){delete _0x13ff8b[_0x1cb9('0x57')]['id'];}return db[_0x1cb9('0x39')][_0x1cb9('0x55')]({'where':{'id':_0x13ff8b[_0x1cb9('0x52')]['id']}})[_0x1cb9('0x1d')](handleEntityNotFound(_0x51ce73,null))['then'](function(_0x357c33){if(_0x357c33){_0x13ff8b[_0x1cb9('0x57')]['ChatWebsiteId']=_0x357c33['id'];return db['Disposition'][_0x1cb9('0x56')](_0x13ff8b['body']);}})[_0x1cb9('0x1d')](respondWithResult(_0x51ce73,null))[_0x1cb9('0x25')](handleError(_0x51ce73,null));};exports[_0x1cb9('0x61')]=function(_0x1e7561,_0x3619a2,_0x398779){var _0x4aeeff={'raw':![],'where':{}};var _0xde0d93={};var _0x15fc04={'count':0x0,'rows':[]};return db[_0x1cb9('0x39')][_0x1cb9('0x62')]({'where':{'id':_0x1e7561['params']['id']}})['then'](handleEntityNotFound(_0x3619a2,null))[_0x1cb9('0x1d')](function(_0x457b76){if(_0x457b76){_0xde0d93[_0x1cb9('0x3b')]=_[_0x1cb9('0x3c')](db[_0x1cb9('0x63')][_0x1cb9('0x3a')]);_0xde0d93['query']=_[_0x1cb9('0x3c')](_0x1e7561['query']);_0xde0d93[_0x1cb9('0x3e')]=_[_0x1cb9('0x3f')](_0xde0d93['model'],_0xde0d93[_0x1cb9('0x3d')]);_0x4aeeff[_0x1cb9('0x40')]=_[_0x1cb9('0x3f')](_0xde0d93['model'],qs[_0x1cb9('0x53')](_0x1e7561[_0x1cb9('0x3d')][_0x1cb9('0x53')]));_0x4aeeff[_0x1cb9('0x40')]=_0x4aeeff[_0x1cb9('0x40')][_0x1cb9('0x41')]?_0x4aeeff['attributes']:_0xde0d93[_0x1cb9('0x3b')];if(!_0x1e7561[_0x1cb9('0x3d')][_0x1cb9('0x42')](_0x1cb9('0x64'))){_0x4aeeff[_0x1cb9('0x2a')]=qs[_0x1cb9('0x2a')](_0x1e7561[_0x1cb9('0x3d')][_0x1cb9('0x2a')]);_0x4aeeff['offset']=qs[_0x1cb9('0x29')](_0x1e7561[_0x1cb9('0x3d')]['offset']);}_0x4aeeff[_0x1cb9('0x65')]=qs['sort'](_0x1e7561[_0x1cb9('0x3d')]['sort']);_0x4aeeff['where']=qs[_0x1cb9('0x3e')](_[_0x1cb9('0x45')](_0x1e7561['query'],_0xde0d93[_0x1cb9('0x3e')]));_0x4aeeff['where'][_0x1cb9('0x66')]=_0x457b76['id'];if(_0x1e7561[_0x1cb9('0x3d')][_0x1cb9('0x4c')]){_0x4aeeff[_0x1cb9('0x44')]=_['merge'](_0x4aeeff[_0x1cb9('0x44')],{'$or':_[_0x1cb9('0x47')](_0x4aeeff[_0x1cb9('0x40')],function(_0x27cc3c){var _0x4f8d74={};_0x4f8d74[_0x27cc3c]={'$like':'%'+_0x1e7561[_0x1cb9('0x3d')]['filter']+'%'};return _0x4f8d74;})});}_0x4aeeff=_[_0x1cb9('0x46')]({},_0x4aeeff,_0x1e7561[_0x1cb9('0x4d')]);return db[_0x1cb9('0x63')][_0x1cb9('0x4e')]({'where':_0x4aeeff[_0x1cb9('0x44')]})[_0x1cb9('0x1d')](function(_0x5e07ba){_0x15fc04[_0x1cb9('0x4e')]=_0x5e07ba;if(_0x1e7561[_0x1cb9('0x3d')]['includeAll']){_0x4aeeff[_0x1cb9('0x4f')]=[{'all':!![]}];}return db[_0x1cb9('0x63')][_0x1cb9('0x50')](_0x4aeeff);})[_0x1cb9('0x1d')](function(_0x2effa8){_0x15fc04[_0x1cb9('0x51')]=_0x2effa8;return _0x15fc04;});}})[_0x1cb9('0x1d')](respondWithFilteredResult(_0x3619a2,_0x4aeeff))['catch'](handleError(_0x3619a2,null));};exports[_0x1cb9('0x67')]=function(_0x4b9169,_0x3a89f5,_0xb5eac1){var _0x50dd60;return db[_0x1cb9('0x39')][_0x1cb9('0x55')]({'where':{'id':_0x4b9169[_0x1cb9('0x52')]['id']}})[_0x1cb9('0x1d')](handleEntityNotFound(_0x3a89f5,null))['then'](function(_0x113367){if(_0x113367){return _0x113367[_0x1cb9('0x67')](_0x4b9169[_0x1cb9('0x3d')]['ids']);}})[_0x1cb9('0x1d')](respondWithStatusCode(_0x3a89f5,null))[_0x1cb9('0x25')](handleError(_0x3a89f5,null));};exports[_0x1cb9('0x68')]=function(_0x3d287f,_0x10b508,_0x1ea329){if(_0x3d287f[_0x1cb9('0x57')]['id']){delete _0x3d287f['body']['id'];}return db[_0x1cb9('0x39')]['find']({'where':{'id':_0x3d287f[_0x1cb9('0x52')]['id']}})[_0x1cb9('0x1d')](handleEntityNotFound(_0x10b508,null))[_0x1cb9('0x1d')](function(_0x329175){if(_0x329175){_0x3d287f['body'][_0x1cb9('0x66')]=_0x329175['id'];return db[_0x1cb9('0x69')]['create'](_0x3d287f[_0x1cb9('0x57')]);}})[_0x1cb9('0x1d')](respondWithResult(_0x10b508,null))[_0x1cb9('0x25')](handleError(_0x10b508,null));};exports[_0x1cb9('0x6a')]=function(_0x453fa3,_0x52a3f1,_0x5e0e56){var _0x544d2d={'raw':![],'where':{}};var _0x5ad853={};var _0x19daa1={'count':0x0,'rows':[]};return db[_0x1cb9('0x39')][_0x1cb9('0x62')]({'where':{'id':_0x453fa3[_0x1cb9('0x52')]['id']}})[_0x1cb9('0x1d')](handleEntityNotFound(_0x52a3f1,null))[_0x1cb9('0x1d')](function(_0x1e6402){if(_0x1e6402){_0x5ad853[_0x1cb9('0x3b')]=_['keys'](db[_0x1cb9('0x69')][_0x1cb9('0x3a')]);_0x5ad853[_0x1cb9('0x3d')]=_['keys'](_0x453fa3[_0x1cb9('0x3d')]);_0x5ad853[_0x1cb9('0x3e')]=_['intersection'](_0x5ad853[_0x1cb9('0x3b')],_0x5ad853[_0x1cb9('0x3d')]);_0x544d2d[_0x1cb9('0x40')]=_[_0x1cb9('0x3f')](_0x5ad853['model'],qs[_0x1cb9('0x53')](_0x453fa3[_0x1cb9('0x3d')]['fields']));_0x544d2d['attributes']=_0x544d2d[_0x1cb9('0x40')][_0x1cb9('0x41')]?_0x544d2d['attributes']:_0x5ad853['model'];if(!_0x453fa3[_0x1cb9('0x3d')][_0x1cb9('0x42')]('nolimit')){_0x544d2d['limit']=qs[_0x1cb9('0x2a')](_0x453fa3['query']['limit']);_0x544d2d['offset']=qs[_0x1cb9('0x29')](_0x453fa3['query'][_0x1cb9('0x29')]);}_0x544d2d[_0x1cb9('0x65')]=qs[_0x1cb9('0x43')](_0x453fa3['query'][_0x1cb9('0x43')]);_0x544d2d[_0x1cb9('0x44')]=qs[_0x1cb9('0x3e')](_['pick'](_0x453fa3[_0x1cb9('0x3d')],_0x5ad853[_0x1cb9('0x3e')]));_0x544d2d[_0x1cb9('0x44')][_0x1cb9('0x66')]=_0x1e6402['id'];if(_0x453fa3[_0x1cb9('0x3d')]['filter']){_0x544d2d[_0x1cb9('0x44')]=_[_0x1cb9('0x46')](_0x544d2d[_0x1cb9('0x44')],{'$or':_['map'](_0x544d2d[_0x1cb9('0x40')],function(_0x81962d){var _0x534378={};_0x534378[_0x81962d]={'$like':'%'+_0x453fa3[_0x1cb9('0x3d')][_0x1cb9('0x4c')]+'%'};return _0x534378;})});}_0x544d2d=_['merge']({},_0x544d2d,_0x453fa3[_0x1cb9('0x4d')]);return db[_0x1cb9('0x69')][_0x1cb9('0x4e')]({'where':_0x544d2d[_0x1cb9('0x44')]})[_0x1cb9('0x1d')](function(_0x1768b8){_0x19daa1[_0x1cb9('0x4e')]=_0x1768b8;if(_0x453fa3[_0x1cb9('0x3d')][_0x1cb9('0x54')]){_0x544d2d[_0x1cb9('0x4f')]=[{'all':!![]}];}return db[_0x1cb9('0x69')][_0x1cb9('0x50')](_0x544d2d);})[_0x1cb9('0x1d')](function(_0x1b2b1c){_0x19daa1[_0x1cb9('0x51')]=_0x1b2b1c;return _0x19daa1;});}})[_0x1cb9('0x1d')](respondWithFilteredResult(_0x52a3f1,_0x544d2d))[_0x1cb9('0x25')](handleError(_0x52a3f1,null));};exports[_0x1cb9('0x6b')]=function(_0x48e879,_0x508a75,_0x13ba32){var _0x94d2c2;return db[_0x1cb9('0x39')][_0x1cb9('0x55')]({'where':{'id':_0x48e879[_0x1cb9('0x52')]['id']}})[_0x1cb9('0x1d')](handleEntityNotFound(_0x508a75,null))[_0x1cb9('0x1d')](function(_0x56251d){if(_0x56251d){return _0x56251d['removeAnswers'](_0x48e879[_0x1cb9('0x3d')][_0x1cb9('0x6c')]);}})[_0x1cb9('0x1d')](respondWithStatusCode(_0x508a75,null))[_0x1cb9('0x25')](handleError(_0x508a75,null));};exports[_0x1cb9('0x6d')]=function(_0x51ff2b,_0xacf226,_0x23777c){_0x51ff2b[_0x1cb9('0x57')]['sitepic']=_0x51ff2b[_0x1cb9('0x6e')][_0x1cb9('0x6f')];return db[_0x1cb9('0x39')]['find']({'where':{'id':_0x51ff2b[_0x1cb9('0x52')]['id']}})[_0x1cb9('0x1d')](handleEntityNotFound(_0xacf226,null))[_0x1cb9('0x1d')](saveUpdates(_0x51ff2b['body'],null))['then'](respondWithResult(_0xacf226,null))['catch'](handleError(_0xacf226,null));};exports[_0x1cb9('0x70')]=function(_0x32b1a0,_0x32064a,_0x523ca9){_0x32b1a0[_0x1cb9('0x57')]['agentAvatar']=_0x32b1a0['file'][_0x1cb9('0x6f')];return db[_0x1cb9('0x39')][_0x1cb9('0x55')]({'where':{'id':_0x32b1a0[_0x1cb9('0x52')]['id']}})[_0x1cb9('0x1d')](handleEntityNotFound(_0x32064a,null))[_0x1cb9('0x1d')](saveUpdates(_0x32b1a0[_0x1cb9('0x57')],null))[_0x1cb9('0x1d')](respondWithResult(_0x32064a,null))[_0x1cb9('0x25')](handleError(_0x32064a,null));};exports[_0x1cb9('0x71')]=function(_0x5182fb,_0x4ff2da,_0x23b4fb){_0x5182fb[_0x1cb9('0x57')]['customerAvatar']=_0x5182fb['file']['filename'];return db['ChatWebsite'][_0x1cb9('0x55')]({'where':{'id':_0x5182fb[_0x1cb9('0x52')]['id']}})['then'](handleEntityNotFound(_0x4ff2da,null))[_0x1cb9('0x1d')](saveUpdates(_0x5182fb[_0x1cb9('0x57')],null))[_0x1cb9('0x1d')](respondWithResult(_0x4ff2da,null))[_0x1cb9('0x25')](handleError(_0x4ff2da,null));};exports[_0x1cb9('0x72')]=function(_0x5218ea,_0x3a029e,_0x1767f8){_0x5218ea[_0x1cb9('0x57')][_0x1cb9('0x73')]=_0x5218ea['file'][_0x1cb9('0x6f')];return db[_0x1cb9('0x39')]['find']({'where':{'id':_0x5218ea['params']['id']}})['then'](handleEntityNotFound(_0x3a029e,null))[_0x1cb9('0x1d')](saveUpdates(_0x5218ea['body'],null))[_0x1cb9('0x1d')](respondWithResult(_0x3a029e,null))[_0x1cb9('0x25')](handleError(_0x3a029e,null));};exports[_0x1cb9('0x74')]=function(_0xf3c554,_0x31d1e5,_0x274e7d){var _0x5aeacf=path[_0x1cb9('0x75')](config[_0x1cb9('0x76')],_0x1cb9('0x77'));var _0x242cad={'where':{'id':_0xf3c554[_0x1cb9('0x52')]['id']},'attributes':['id',_0x1cb9('0x78')],'raw':!![]};var _0x237e3b=![];return require(_0x1cb9('0x79'))[_0x1cb9('0x7a')]()[_0x1cb9('0x1d')](function(_0xa2b077){if(_0xa2b077){_0x237e3b=_0xa2b077[_0x1cb9('0x7b')];}})[_0x1cb9('0x1d')](function(){return db[_0x1cb9('0x39')][_0x1cb9('0x55')](_0x242cad);})['then'](handleEntityNotFound(_0x31d1e5,null))['then'](function(_0x5aae4c){if(_0x5aae4c){if(!_[_0x1cb9('0x7c')](_0x5aae4c[_0x1cb9('0x78')])){if(fs['existsSync'](path[_0x1cb9('0x75')](config[_0x1cb9('0x76')],_0x1cb9('0x7d'),_0x5aae4c['sitepic']))&&_0x237e3b){_0x5aeacf=path[_0x1cb9('0x75')](config[_0x1cb9('0x76')],_0x1cb9('0x7d'),_0x5aae4c[_0x1cb9('0x78')]);}}return _0x31d1e5[_0x1cb9('0x7e')](_0x5aeacf);}})['catch'](handleError(_0x31d1e5,null));};exports[_0x1cb9('0x7f')]=function(_0x4e71c6,_0x4bc0ce,_0x191988){var _0x8f08f9=path[_0x1cb9('0x75')](config[_0x1cb9('0x76')],_0x1cb9('0x80'));var _0x2b0ab9={'where':{'id':_0x4e71c6[_0x1cb9('0x52')]['id']},'attributes':['id',_0x1cb9('0x81')],'raw':!![]};return db['ChatWebsite'][_0x1cb9('0x55')](_0x2b0ab9)[_0x1cb9('0x1d')](handleEntityNotFound(_0x4bc0ce,null))[_0x1cb9('0x1d')](function(_0x2d8585){if(_0x2d8585){if(!_[_0x1cb9('0x7c')](_0x2d8585['agentAvatar'])){if(fs[_0x1cb9('0x82')](path[_0x1cb9('0x75')](config[_0x1cb9('0x76')],_0x1cb9('0x83'),_0x2d8585[_0x1cb9('0x81')]))){_0x8f08f9=path['join'](config[_0x1cb9('0x76')],_0x1cb9('0x83'),_0x2d8585[_0x1cb9('0x81')]);}}return _0x4bc0ce['download'](_0x8f08f9);}})[_0x1cb9('0x25')](handleError(_0x4bc0ce,null));};exports[_0x1cb9('0x84')]=function(_0x42d642,_0x1181d0,_0x3ca4cf){var _0x30300c=path['join'](config[_0x1cb9('0x76')],_0x1cb9('0x85'));var _0x17fdd1={'where':{'id':_0x42d642['params']['id']},'attributes':['id',_0x1cb9('0x86'),_0x1cb9('0x87')],'raw':!![]};return db['ChatWebsite']['find'](_0x17fdd1)[_0x1cb9('0x1d')](handleEntityNotFound(_0x1181d0,null))[_0x1cb9('0x1d')](function(_0xe867bd){if(_0xe867bd){if(!_[_0x1cb9('0x7c')](_0xe867bd[_0x1cb9('0x86')])){if(fs['existsSync'](path[_0x1cb9('0x75')](config[_0x1cb9('0x76')],_0x1cb9('0x83'),_0xe867bd[_0x1cb9('0x86')]))&&_0xe867bd[_0x1cb9('0x87')]){_0x30300c=path['join'](config['root'],_0x1cb9('0x83'),_0xe867bd[_0x1cb9('0x86')]);}}return _0x1181d0[_0x1cb9('0x7e')](_0x30300c);}})['catch'](handleError(_0x1181d0,null));};exports['getSystemAvatar']=function(_0x40d403,_0x3c4b2b,_0x33d06a){var _0x4f49ca=path['join'](config['root'],_0x1cb9('0x88'));var _0x194d6d={'where':{'id':_0x40d403[_0x1cb9('0x52')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x1cb9('0x39')]['find'](_0x194d6d)[_0x1cb9('0x1d')](handleEntityNotFound(_0x3c4b2b,null))[_0x1cb9('0x1d')](function(_0x476985){if(_0x476985){if(!_[_0x1cb9('0x7c')](_0x476985[_0x1cb9('0x73')])){if(fs['existsSync'](path[_0x1cb9('0x75')](config['root'],_0x1cb9('0x83'),_0x476985[_0x1cb9('0x73')]))){_0x4f49ca=path[_0x1cb9('0x75')](config[_0x1cb9('0x76')],_0x1cb9('0x83'),_0x476985['systemAvatar']);}}return _0x3c4b2b[_0x1cb9('0x7e')](_0x4f49ca);}})[_0x1cb9('0x25')](handleError(_0x3c4b2b,null));};exports[_0x1cb9('0x89')]=function(_0x218d0b,_0x3b4e77,_0x42c4d6){var _0x2af217=require('user-agent-parser');var _0x5e6070=new _0x2af217();var _0x100f8c=_0x5e6070[_0x1cb9('0x8a')](_0x218d0b[_0x1cb9('0x8b')][_0x1cb9('0x8c')])[_0x1cb9('0x8d')]();var _0x54b0d0={'body':_0x218d0b[_0x1cb9('0x57')],'channel':_0x1cb9('0x8e')};var _0x550d51=[];var _0x47a8ea=[];var _0xb742d4={};var _0x48c8e7=![];return db[_0x1cb9('0x8f')]['describe']()[_0x1cb9('0x1d')](function(_0x358bad){if(!_0x358bad){throw new db[(_0x1cb9('0x90'))][(_0x1cb9('0x91'))](_0x1cb9('0x92'));}_0x550d51=_[_0x1cb9('0x93')](_[_0x1cb9('0x3c')](_0x358bad),[_0x1cb9('0x94'),_0x1cb9('0x95')]);_0x47a8ea=_[_0x1cb9('0x93')](_[_0x1cb9('0x3c')](_0x358bad),[_0x1cb9('0x94'),'updatedAt','CompanyId','ListId']);if(_0x218d0b['body']['id']){delete _0x218d0b[_0x1cb9('0x57')]['id'];}if(_[_0x1cb9('0x7c')](_0x218d0b['body']['from'])){throw new db['Sequelize'][(_0x1cb9('0x91'))](_0x1cb9('0x96'));}if(_[_0x1cb9('0x7c')](_0x218d0b[_0x1cb9('0x57')]['body'])||_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0x57')]===''){throw new db[(_0x1cb9('0x90'))]['ValidationError'](_0x1cb9('0x97'));}if(_[_0x1cb9('0x7c')](_0x218d0b['body'][_0x1cb9('0x98')])){throw new db['Sequelize'][(_0x1cb9('0x91'))](_0x1cb9('0x99')+_0x47a8ea);}if(!_[_0x1cb9('0x9a')](_0x47a8ea,_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0x98')])){throw new db[(_0x1cb9('0x90'))][(_0x1cb9('0x91'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x47a8ea);}_0xb742d4[_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0x98')]]=_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0x9b')];})[_0x1cb9('0x1d')](function(){return db[_0x1cb9('0x39')][_0x1cb9('0x55')]({'where':{'id':_0x218d0b[_0x1cb9('0x52')]['id']},'include':[{'model':db[_0x1cb9('0x9c')],'as':_0x1cb9('0x9d'),'include':[{'model':db['CmContact'],'as':_0x1cb9('0x9e'),'where':_0xb742d4,'limit':0x1,'order':[[_0x1cb9('0x95'),_0x1cb9('0x9f')]]}]},{'model':db[_0x1cb9('0xa0')],'as':_0x1cb9('0xa1')}]});})['then'](handleEntityNotFound(_0x3b4e77,null))[_0x1cb9('0x1d')](function(_0x4f7e79){if(_0x4f7e79&&_0x4f7e79['List']){_0x54b0d0[_0x1cb9('0xa2')]=_0x4f7e79;_0x54b0d0[_0x1cb9('0xa3')]=_0x4f7e79[_0x1cb9('0xa1')];_0x54b0d0[_0x1cb9('0xa4')]=_0x4f7e79[_0x1cb9('0x9d')];_0x54b0d0[_0x1cb9('0xa3')]=_[_0x1cb9('0xa5')](_0x54b0d0[_0x1cb9('0xa3')],[_0x1cb9('0xa6')],['asc']);if(_0x54b0d0['account'][_0x1cb9('0xa1')]){delete _0x54b0d0[_0x1cb9('0xa2')][_0x1cb9('0xa1')];}if(_0x54b0d0[_0x1cb9('0xa2')][_0x1cb9('0x9d')]&&_0x54b0d0[_0x1cb9('0xa2')][_0x1cb9('0x9d')][_0x1cb9('0x9e')][_0x1cb9('0x41')]){return _0x54b0d0[_0x1cb9('0xa2')]['List'][_0x1cb9('0x9e')][0x0];}var _0x5101a9=_[_0x1cb9('0x16')](_0x218d0b[_0x1cb9('0x57')],{'firstName':_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0x9b')],'ListId':_0x4f7e79['ListId']});_0x5101a9[_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0x98')]]=_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0x9b')];return db[_0x1cb9('0x8f')][_0x1cb9('0x56')](_0x5101a9,{'fields':_0x550d51,'raw':!![]});}})[_0x1cb9('0x1d')](handleEntityNotFound(_0x3b4e77,null))['then'](function(_0x200ad9){_0x54b0d0[_0x1cb9('0xa7')]=_0x200ad9;if(_0x200ad9){var _0x276900={'ContactId':_0x200ad9['id'],'ChatWebsiteId':_0x218d0b[_0x1cb9('0x52')]['id'],'from':(_0x200ad9[_0x1cb9('0xa8')]||'')+'\x20'+(_0x200ad9[_0x1cb9('0xa9')]||''),'customerIp':_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0xaa')],'referer':_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0xab')],'browserName':_0x100f8c[_0x1cb9('0xac')][_0x1cb9('0x35')]&&_0x100f8c[_0x1cb9('0xac')][_0x1cb9('0xad')]?util[_0x1cb9('0xae')](_0x1cb9('0xaf'),_0x100f8c[_0x1cb9('0xac')][_0x1cb9('0x35')],_0x100f8c[_0x1cb9('0xac')][_0x1cb9('0xad')]):_0x1cb9('0xb0'),'browserVersion':_0x100f8c[_0x1cb9('0xac')]['version']||_0x1cb9('0xb0'),'osName':util[_0x1cb9('0xae')](_0x1cb9('0xaf'),_0x100f8c['os'][_0x1cb9('0x35')],_0x100f8c['os'][_0x1cb9('0xad')]),'osVersion':_0x100f8c['os'][_0x1cb9('0xad')],'deviceModel':_0x100f8c['device'][_0x1cb9('0x3b')]&&_0x100f8c['device'][_0x1cb9('0xb1')]?util[_0x1cb9('0xae')](_0x1cb9('0xb2'),_0x100f8c['device'][_0x1cb9('0x3b')],_0x100f8c[_0x1cb9('0xb3')][_0x1cb9('0xb1')],_0x100f8c[_0x1cb9('0xb3')]['type']):null,'deviceVendor':_0x100f8c[_0x1cb9('0xb3')][_0x1cb9('0xb1')],'deviceType':_0x100f8c[_0x1cb9('0xb3')][_0x1cb9('0x48')],'formData':JSON['stringify'](_0x218d0b[_0x1cb9('0x57')])};var _0x44f71b={'ChatWebsiteId':_0x218d0b['params']['id'],'closed':![]};if(_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0xb4')]){_0x44f71b[_0x1cb9('0xb4')]=_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0xb4')];return db[_0x1cb9('0xb5')][_0x1cb9('0x55')]({'where':_0x44f71b})[_0x1cb9('0x1d')](function(_0x263688){if(_0x263688){return[_0x263688,![]];}_0x276900[_0x1cb9('0xb4')]=_0x218d0b[_0x1cb9('0x57')]['threadId'];_0x276900[_0x1cb9('0xb6')]=_0x218d0b['body'][_0x1cb9('0xb6')];return db[_0x1cb9('0xb5')][_0x1cb9('0x56')](_0x276900)[_0x1cb9('0x1d')](function(_0x12acc9){return[_0x12acc9,!![]];});});}_0x44f71b[_0x1cb9('0xb7')]=_0x200ad9['id'];if(_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0xb8')]&&_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0xb8')]['id']){_0x44f71b['id']=_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0xb8')]['id'];return db[_0x1cb9('0xb5')]['find']({'where':_0x44f71b})[_0x1cb9('0x1d')](function(_0x3921fc){if(_0x3921fc){return[_0x3921fc,![]];}return db[_0x1cb9('0xb5')]['create'](_0x276900)['then'](function(_0x4946fd){return[_0x4946fd,!![]];});});}return db[_0x1cb9('0xb5')][_0x1cb9('0x56')](_0x276900)['then'](function(_0x47d696){return[_0x47d696,!![]];});}})[_0x1cb9('0xb9')](function(_0x395792,_0x427b1d){if(_0x395792){_0x48c8e7=_0x427b1d;if(!_0x427b1d){var _0x24ca62={'from':(_0x54b0d0['contact'][_0x1cb9('0xa8')]||'')+'\x20'+(_0x54b0d0[_0x1cb9('0xa7')][_0x1cb9('0xa9')]||'')};if(_0x218d0b[_0x1cb9('0x57')]['threadId']&&_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0xba')]&&_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0xb4')]!=_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0xba')]){_0x24ca62['threadId']=_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0xba')];}return _0x395792[_0x1cb9('0x2e')](_0x24ca62);}else{return _0x395792;}}})[_0x1cb9('0x1d')](function(_0x339ed4){_0x54b0d0[_0x1cb9('0xb8')]=_0x339ed4[_0x1cb9('0x30')]({'plain':!![]});_0x54b0d0[_0x1cb9('0xb8')][_0x1cb9('0xbb')]=_0x48c8e7;if(_0x54b0d0[_0x1cb9('0xb8')][_0x1cb9('0xbb')]){if(_0x54b0d0['account'][_0x1cb9('0xbc')]){_0x54b0d0[_0x1cb9('0xa3')]['push']({'id':0x0,'priority':_0x54b0d0[_0x1cb9('0xa3')]['length']+0x1,'app':_0x1cb9('0xbd'),'appdata':_0x1cb9('0xbe'),'interval':_0x1cb9('0xbf')});}}return db[_0x1cb9('0xc0')][_0x1cb9('0x56')]({'body':_0x218d0b[_0x1cb9('0x57')][_0x1cb9('0x57')],'ChatWebsiteId':_0x218d0b[_0x1cb9('0x52')]['id'],'ChatInteractionId':_0x339ed4['id'],'direction':'in','ContactId':_0x54b0d0[_0x1cb9('0xa7')]['id'],'AttachmentId':_0x218d0b['body']['AttachmentId']});})['then'](function(_0x3f7130){_0x54b0d0[_0x1cb9('0x24')]=_0x3f7130;if(_0x54b0d0[_0x1cb9('0xb8')]['UserId']){return db[_0x1cb9('0xc1')][_0x1cb9('0x55')]({'attributes':['id',_0x1cb9('0x35')],'where':{'id':_0x54b0d0[_0x1cb9('0xb8')]['UserId']}})['then'](function(_0xa15bbd){if(_0xa15bbd){_0x54b0d0[_0x1cb9('0xa3')]['unshift']({'id':0x0,'priority':0x0,'app':_0x1cb9('0xc2'),'appdata':_0xa15bbd[_0x1cb9('0x35')]+','+(_0x54b0d0['account'][_0x1cb9('0xc3')]||0xa),'interval':_0x1cb9('0xbf')});_0x54b0d0[_0x1cb9('0xc4')]=!![];}return respondWithRpcPromise('Start','startRouting',_0x54b0d0);});}return respondWithRpcPromise(_0x1cb9('0xc5'),_0x1cb9('0xc6'),_0x54b0d0);})['then'](function(_0x3ebdf2){respondWithRpcPromise(_0x1cb9('0xc7'),_0x1cb9('0xc7'),{'event':_0x1cb9('0x89'),'message':_0x3ebdf2},client9002);return _0x3ebdf2;})['then'](respondWithResult(_0x3b4e77,null))[_0x1cb9('0x25')](handleError(_0x3b4e77,null));};exports[_0x1cb9('0xc8')]=function(_0x36f697,_0x1f56f0,_0x238efb){var _0x55ca8f,_0x1324f4,_0x570a8c;var _0x299d6b=[];var _0x478f5e=[];var _0x1199ed={};return db['CmContact'][_0x1cb9('0x5f')]()[_0x1cb9('0x1d')](function(_0x1616e2){if(!_0x1616e2){throw new db[(_0x1cb9('0x90'))][(_0x1cb9('0x91'))](_0x1cb9('0x92'));}_0x478f5e=_[_0x1cb9('0x93')](_[_0x1cb9('0x3c')](_0x1616e2),['createdAt',_0x1cb9('0x95')]);_0x299d6b=_[_0x1cb9('0x93')](_[_0x1cb9('0x3c')](_0x1616e2),[_0x1cb9('0x94'),_0x1cb9('0x95'),_0x1cb9('0xc9'),'ListId']);if(_0x36f697['body']['id']){delete _0x36f697[_0x1cb9('0x57')]['id'];}if(_[_0x1cb9('0x7c')](_0x36f697[_0x1cb9('0x57')][_0x1cb9('0x9b')])){throw _0x1f56f0[_0x1cb9('0x26')](0x1f4)[_0x1cb9('0x36')](new db['Sequelize']['ValidationError'](_0x1cb9('0x96')));}if(_[_0x1cb9('0x7c')](_0x36f697[_0x1cb9('0x57')]['body'])||_0x36f697[_0x1cb9('0x57')][_0x1cb9('0x57')]===''){throw _0x1f56f0[_0x1cb9('0x26')](0x1f4)['send'](new db[(_0x1cb9('0x90'))][(_0x1cb9('0x91'))](_0x1cb9('0x97')));}if(_[_0x1cb9('0x7c')](_0x36f697[_0x1cb9('0x57')][_0x1cb9('0xca')])){throw _0x1f56f0[_0x1cb9('0x26')](0x1f4)[_0x1cb9('0x36')](new db[(_0x1cb9('0x90'))][(_0x1cb9('0x91'))](_0x1cb9('0xcb')+_0x299d6b));}if(!_[_0x1cb9('0x9a')](_0x299d6b,_0x36f697['body'][_0x1cb9('0xca')])){throw _0x1f56f0['status'](0x1f4)['send'](new db['Sequelize']['ValidationError'](_0x1cb9('0xcc')+_0x299d6b));}_0x1199ed[_0x36f697[_0x1cb9('0x57')]['mapKeyOffline']]=_0x36f697[_0x1cb9('0x57')]['from'];})[_0x1cb9('0x1d')](function(){return db[_0x1cb9('0x39')][_0x1cb9('0x55')]({'where':{'id':_0x36f697['params']['id']},'include':[{'model':db[_0x1cb9('0x9c')],'as':_0x1cb9('0x9d')}]});})[_0x1cb9('0x1d')](handleEntityNotFound(_0x1f56f0,null))[_0x1cb9('0x1d')](function(_0x1b7b90){if(_0x1b7b90&&_0x1b7b90[_0x1cb9('0x9d')]){_0x1324f4=_0x1b7b90;var _0x2ddb5f=_[_0x1cb9('0x16')](_0x36f697['body'],{'firstName':_0x36f697[_0x1cb9('0x57')]['from'],'phone':_0x36f697[_0x1cb9('0x57')]['from'],'ListId':_0x1b7b90[_0x1cb9('0xcd')]});_0x2ddb5f[_0x36f697[_0x1cb9('0x57')][_0x1cb9('0xca')]]=_0x36f697['body'][_0x1cb9('0x9b')];return db[_0x1cb9('0x8f')][_0x1cb9('0xce')]({'where':_0x1199ed,'defaults':_0x2ddb5f});}})[_0x1cb9('0xb9')](function(_0x134436){if(_0x134436){_0x570a8c=_0x134436;var _0x5e3c80=fs[_0x1cb9('0xcf')](path[_0x1cb9('0x75')](config[_0x1cb9('0x76')],'server/files/templates/chatOfflineMessage.ejs'),_0x1cb9('0xd0'));var _0x1978d3=ejs[_0x1cb9('0xd1')](_0x5e3c80,{'body':_[_0x1cb9('0xd2')](_0x36f697['body'][_0x1cb9('0x57')]),'bodyTitle':_0x1324f4['offlineMessageBody']});return db['ChatOfflineMessage'][_0x1cb9('0x56')]({'body':_0x1978d3,'ContactId':_0x134436['id'],'ChatWebsiteId':_0x1324f4['id']});}})['then'](function(_0x209ba0){if(_0x209ba0){_0x55ca8f=_0x209ba0;return db['MailAccount'][_0x1cb9('0x62')]({'where':{'service':!![]},'include':[{'model':db[_0x1cb9('0xd3')],'as':'Smtp','raw':!![]}]});}})[_0x1cb9('0x1d')](function(_0x1054e7){if(_0x1054e7&&_0x1054e7[_0x1cb9('0xd4')]&&_0x1324f4[_0x1cb9('0xd5')]){var _0x1effea={'tls':{'rejectUnauthorized':![]}};if(_0x1054e7[_0x1cb9('0xd4')]['service']){_0x1effea[_0x1cb9('0xd6')]=_0x1054e7[_0x1cb9('0xd4')][_0x1cb9('0xd6')];}else{_0x1effea[_0x1cb9('0xd7')]=_0x1054e7[_0x1cb9('0xd4')][_0x1cb9('0xd7')];_0x1effea['port']=_0x1054e7['Smtp'][_0x1cb9('0xd8')];_0x1effea[_0x1cb9('0xd9')]=_0x1054e7[_0x1cb9('0xd4')][_0x1cb9('0xd9')];}if(_0x1054e7['Smtp'][_0x1cb9('0xda')]){_0x1effea[_0x1cb9('0xdb')]={'user':_0x1054e7[_0x1cb9('0xd4')]['user'],'pass':_0x1054e7[_0x1cb9('0xd4')][_0x1cb9('0xdc')]};}return respondWithRpcPromise('SendMail',_0x1cb9('0xdd'),{'account':_0x1effea,'message':{'from':util[_0x1cb9('0xae')]('\x22%s\x22\x20<%s>',_0x1054e7[_0x1cb9('0x35')],_0x1054e7[_0x1cb9('0xde')]||_0x1054e7[_0x1cb9('0xd4')][_0x1cb9('0x58')]),'to':_0x1324f4[_0x1cb9('0xd5')],'subject':_0x1324f4[_0x1cb9('0xdf')],'text':_0x55ca8f[_0x1cb9('0x57')]}},client9003)['then'](function(){return _0x55ca8f;})[_0x1cb9('0x25')](function(_0x495fe6){console[_0x1cb9('0x23')](_0x495fe6);});}})[_0x1cb9('0x1d')](function(){if(_0x55ca8f){return _0x55ca8f;}})[_0x1cb9('0x1d')](respondWithResult(_0x1f56f0,null))[_0x1cb9('0x25')](handleError(_0x1f56f0,null));};exports['addInteraction']=function(_0xe12117,_0x4f2772,_0x55c1ee){return db['ChatInteraction'][_0x1cb9('0x55')]({'where':{'id':_0xe12117['params']['id']}})['then'](handleEntityNotFound(_0x4f2772,null))[_0x1cb9('0x1d')](function(_0x5172c5){if(_0x5172c5){return _0x5172c5[_0x1cb9('0xe0')](_0xe12117['body'][_0x1cb9('0x6c')],_[_0x1cb9('0xe1')](_0xe12117[_0x1cb9('0x57')],[_0x1cb9('0x6c'),'id'])||{});}})[_0x1cb9('0x1d')](respondWithResult(_0x4f2772,null))[_0x1cb9('0x25')](handleError(_0x4f2772,null));};exports[_0x1cb9('0xe2')]=function(_0x3cbd38,_0x1a4b8c,_0x2db5cd){var _0x217471={'raw':![],'where':{}};var _0x24d864={};var _0x1b40ed={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x1cb9('0x62')]({'where':{'id':_0x3cbd38[_0x1cb9('0x52')]['id']}})['then'](handleEntityNotFound(_0x1a4b8c,null))['then'](function(_0xc2f0cc){if(_0xc2f0cc){_0x24d864[_0x1cb9('0x3b')]=_[_0x1cb9('0x3c')](db['ChatInteraction'][_0x1cb9('0x3a')]);_0x24d864[_0x1cb9('0x3d')]=_['keys'](_0x3cbd38[_0x1cb9('0x3d')]);_0x24d864[_0x1cb9('0x3e')]=_[_0x1cb9('0x3f')](_0x24d864[_0x1cb9('0x3b')],_0x24d864[_0x1cb9('0x3d')]);_0x217471[_0x1cb9('0x40')]=_['intersection'](_0x24d864[_0x1cb9('0x3b')],qs['fields'](_0x3cbd38[_0x1cb9('0x3d')]['fields']));_0x217471[_0x1cb9('0x40')]=_0x217471[_0x1cb9('0x40')][_0x1cb9('0x41')]?_0x217471[_0x1cb9('0x40')]:_0x24d864[_0x1cb9('0x3b')];if(!_0x3cbd38[_0x1cb9('0x3d')]['hasOwnProperty'](_0x1cb9('0x64'))){_0x217471[_0x1cb9('0x2a')]=qs[_0x1cb9('0x2a')](_0x3cbd38['query']['limit']);_0x217471[_0x1cb9('0x29')]=qs['offset'](_0x3cbd38[_0x1cb9('0x3d')][_0x1cb9('0x29')]);}_0x217471['order']=qs[_0x1cb9('0x43')](_0x3cbd38[_0x1cb9('0x3d')][_0x1cb9('0x43')]);_0x217471[_0x1cb9('0x44')]=qs[_0x1cb9('0x3e')](_[_0x1cb9('0x45')](_0x3cbd38[_0x1cb9('0x3d')],_0x24d864[_0x1cb9('0x3e')]));_0x217471[_0x1cb9('0x44')][_0x1cb9('0x66')]=_0xc2f0cc['id'];if(_0x3cbd38[_0x1cb9('0x3d')][_0x1cb9('0x4c')]){_0x217471['where']=_[_0x1cb9('0x46')](_0x217471[_0x1cb9('0x44')],{'$or':_[_0x1cb9('0x47')](_0x217471[_0x1cb9('0x40')],function(_0xeab9b9){var _0x5d0cd8={};_0x5d0cd8[_0xeab9b9]={'$like':'%'+_0x3cbd38[_0x1cb9('0x3d')][_0x1cb9('0x4c')]+'%'};return _0x5d0cd8;})});}_0x217471=_['merge']({},_0x217471,_0x3cbd38[_0x1cb9('0x4d')]);return db[_0x1cb9('0xb5')][_0x1cb9('0x4e')]({'where':_0x217471[_0x1cb9('0x44')]})[_0x1cb9('0x1d')](function(_0x3c3e9e){_0x1b40ed['count']=_0x3c3e9e;if(_0x3cbd38[_0x1cb9('0x3d')][_0x1cb9('0x54')]){_0x217471['include']=[{'model':db[_0x1cb9('0x8f')],'as':_0x1cb9('0xe3'),'required':![]},{'model':db[_0x1cb9('0xc1')],'as':'Owner','attributes':['name',_0x1cb9('0xe4'),_0x1cb9('0xe5')],'required':![]},{'model':db[_0x1cb9('0xe6')],'as':_0x1cb9('0xe7'),'attributes':['id',_0x1cb9('0x35'),_0x1cb9('0xe8')],'where':_0x3cbd38[_0x1cb9('0x3d')]['tag']?{'id':_0x3cbd38['query']['tag']}:undefined,'required':_0x3cbd38[_0x1cb9('0x3d')]['tag']?!![]:![]}];}return db[_0x1cb9('0xb5')][_0x1cb9('0x50')](_0x217471);})[_0x1cb9('0x1d')](function(_0x45581c){_0x1b40ed[_0x1cb9('0x51')]=_0x45581c;return _0x1b40ed;});}})['then'](respondWithFilteredResult(_0x1a4b8c,_0x217471))[_0x1cb9('0x25')](handleError(_0x1a4b8c,null));};function iftimePromise(_0x590374,_0x4ecf13){return respondWithRpcPromise(_0x1cb9('0xe9'),_0x1cb9('0xea'),{'command':_0x4ecf13[_0x1cb9('0xeb')]?util['format'](_0x1cb9('0xec'),_0x590374[_0x1cb9('0xed')],_0x4ecf13[_0x1cb9('0xeb')]):util[_0x1cb9('0xae')](_0x1cb9('0xee'),_0x590374[_0x1cb9('0xed')])},client9002)[_0x1cb9('0x1d')](function(_0x3ab9a0){var _0x30e355=_0x3ab9a0&&_0x3ab9a0[_0x1cb9('0xef')](_0x1cb9('0xf0'))>=0x0?!![]:![];logger[_0x1cb9('0xf1')](_0x1cb9('0xf2'),_0x4ecf13['id'],_0x590374['id'],_0x590374[_0x1cb9('0xed')],_0x30e355?_0x1cb9('0xf3'):'OFFLINE',_0x4ecf13[_0x1cb9('0xeb')]?_0x4ecf13['timezone']:'No\x20timezone');return _0x30e355;})[_0x1cb9('0x25')](function(_0x3bd28f){logger[_0x1cb9('0x23')](_0x1cb9('0xf2'),_0x4ecf13['id'],_0x590374['id'],_0x590374[_0x1cb9('0xed')],util[_0x1cb9('0xf4')](_0x3bd28f,{'showHidden':![],'depth':null}),_0x4ecf13[_0x1cb9('0xeb')]?_0x4ecf13['timezone']:'No\x20timezone');return![];});}exports['getSnippet']=function(_0x326ed4,_0x1ae2e4,_0x485400){var _0x4cd96f=0x0;var _0x23bda7=0x0;var _0x28d76e=![];var _0x15e440;var _0x5d2d8a;return db[_0x1cb9('0x39')][_0x1cb9('0x55')]({'where':{'id':_0x326ed4['params']['id']},'include':[{'model':db[_0x1cb9('0xf5')],'as':_0x1cb9('0xf5'),'include':[{'model':db[_0x1cb9('0xf5')],'as':_0x1cb9('0xf6'),'attributes':['id',_0x1cb9('0xed')],'raw':!![]}]}]})[_0x1cb9('0x1d')](handleEntityNotFound(_0x1ae2e4,null))['then'](function(_0x51b930){if(_0x51b930){_0x15e440=_0x51b930;return _0x51b930['getProactiveActions']({'raw':!![]});}})[_0x1cb9('0x1d')](function(_0x4ec950){if(_0x15e440){if(_0x4ec950){_0x5d2d8a=_0x4ec950;}}return require('../../config/license/util')[_0x1cb9('0x7a')]();})['then'](function(_0x18af58){if(_0x18af58){_0x23bda7=_0x18af58['virtual'];_0x28d76e=_0x18af58[_0x1cb9('0x7b')];}})['then'](function(){return db[_0x1cb9('0xb5')]['count']({'where':{'closed':![]}});})[_0x1cb9('0x1d')](function(_0x230406){_0x4cd96f=_0x230406;if(_0x23bda7&&_0x230406>_0x23bda7){return db['License'][_0x1cb9('0x62')]({'where':{'id':0x1}})[_0x1cb9('0x1d')](function(_0x2d4546){if(_0x2d4546){_0x2d4546[_0x1cb9('0xf7')](_0x1cb9('0xf8'));}});}})['then'](function(){if(_0x15e440[_0x1cb9('0xf5')]&&_0x15e440['Interval'][_0x1cb9('0xf6')]){var _0xfa7f26=[];for(var _0x13bd91=0x0;_0x13bd91<_0x15e440[_0x1cb9('0xf5')][_0x1cb9('0xf6')][_0x1cb9('0x41')];_0x13bd91++){var _0x360400=_0x15e440[_0x1cb9('0xf5')]['Intervals'][_0x13bd91]['get']({'plain':!![]});_0xfa7f26['push'](iftimePromise(_0x360400,_0x15e440));}return BPromise[_0x1cb9('0xf9')](_0xfa7f26)[_0x1cb9('0x1d')](function(_0x453693){return _[_0x1cb9('0xfa')](_0x453693);});}else{return!![];}})[_0x1cb9('0x1d')](function(_0x45d47e){var _0x18a571=fs[_0x1cb9('0xcf')](path[_0x1cb9('0x75')](config['root'],'server/files/chat/iframe.js'),_0x1cb9('0xd0'));var _0x35d396={'remote':_0x15e440[_0x1cb9('0xfb')],'query':querystring[_0x1cb9('0x22')](_[_0x1cb9('0x46')](_0x15e440[_0x1cb9('0x30')]({'plain':!![]}),{'customerIp':_0x326ed4[_0x1cb9('0x8b')][_0x1cb9('0xfc')]||_0x326ed4[_0x1cb9('0x8b')][_0x1cb9('0xfd')]||_0x326ed4['connection'][_0x1cb9('0xfe')]||_0x326ed4['ip'],'referer':_0x326ed4[_0x1cb9('0x8b')][_0x1cb9('0xab')],'openedInteractions':_0x4cd96f,'maxInteractions':_0x23bda7,'virtual':_0x28d76e[_0x1cb9('0xff')],'online':_0x45d47e,'custom':_0x28d76e}))['replace'](/'/g,'\x5c\x27')};_0x1ae2e4[_0x1cb9('0x36')](ejs[_0x1cb9('0xd1')](Mustache[_0x1cb9('0xd1')](_0x18a571,_0x35d396),{'proactiveActions':_0x5d2d8a,'alignment':_0x15e440[_0x1cb9('0x100')],'verticalAlignment':_0x15e440['verticalAlignment']}));})[_0x1cb9('0x25')](handleError(_0x1ae2e4,null));};exports[_0x1cb9('0x101')]=function(_0x272b2b,_0x4583f9,_0x418cd4){return db[_0x1cb9('0x39')][_0x1cb9('0x62')]({'where':{'id':_0x272b2b[_0x1cb9('0x52')]['id']}})['then'](handleEntityNotFound(_0x4583f9,null))['then'](function(_0x5cafca){if(_0x5cafca){return db[_0x1cb9('0x102')]['transaction'](function(_0x5de7c9){return db[_0x1cb9('0xa0')][_0x1cb9('0x2f')]({'where':{'ChatWebsiteId':_0x272b2b['params']['id']},'transaction':_0x5de7c9})[_0x1cb9('0x1d')](function(_0x2ca68a){var _0x4ea59b=_[_0x1cb9('0x47')](_0x272b2b[_0x1cb9('0x57')],function(_0x5368b1){_0x5368b1[_0x1cb9('0x66')]=_0x272b2b[_0x1cb9('0x52')]['id'];return _0x5368b1;});return db[_0x1cb9('0xa0')][_0x1cb9('0x103')](_0x4ea59b,{'transaction':_0x5de7c9});});})[_0x1cb9('0x1d')](function(){return db[_0x1cb9('0xa0')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x272b2b['params']['id']},'order':_0x1cb9('0xa6')});});}})[_0x1cb9('0x1d')](respondWithResult(_0x4583f9,null))['catch'](handleError(_0x4583f9,null));};exports[_0x1cb9('0x104')]=function(_0x3d26ca,_0x2d6c56,_0x58509f){var _0x5ca624={};var _0x14106e={};var _0x1babdc;var _0x57c223;return db[_0x1cb9('0x39')][_0x1cb9('0x62')]({'where':{'id':_0x3d26ca[_0x1cb9('0x52')]['id']}})['then'](handleEntityNotFound(_0x2d6c56,null))['then'](function(_0x31b47e){if(_0x31b47e){_0x1babdc=_0x31b47e;_0x14106e[_0x1cb9('0x3b')]=_[_0x1cb9('0x3c')](db[_0x1cb9('0xa0')]['rawAttributes']);_0x14106e[_0x1cb9('0x3d')]=_[_0x1cb9('0x3c')](_0x3d26ca[_0x1cb9('0x3d')]);_0x14106e[_0x1cb9('0x3e')]=_[_0x1cb9('0x3f')](_0x14106e['model'],_0x14106e['query']);_0x5ca624[_0x1cb9('0x40')]=_[_0x1cb9('0x3f')](_0x14106e[_0x1cb9('0x3b')],qs[_0x1cb9('0x53')](_0x3d26ca[_0x1cb9('0x3d')][_0x1cb9('0x53')]));_0x5ca624['attributes']=_0x5ca624[_0x1cb9('0x40')]['length']?_0x5ca624[_0x1cb9('0x40')]:_0x14106e[_0x1cb9('0x3b')];_0x5ca624['order']=qs['sort'](_0x3d26ca[_0x1cb9('0x3d')][_0x1cb9('0x43')]);_0x5ca624['where']=qs[_0x1cb9('0x3e')](_[_0x1cb9('0x45')](_0x3d26ca[_0x1cb9('0x3d')],_0x14106e[_0x1cb9('0x3e')]));if(_0x3d26ca[_0x1cb9('0x3d')][_0x1cb9('0x4c')]){_0x5ca624[_0x1cb9('0x44')]=_[_0x1cb9('0x46')](_0x5ca624[_0x1cb9('0x44')],{'$or':_[_0x1cb9('0x47')](_0x5ca624[_0x1cb9('0x40')],function(_0x3cf954){var _0x3e8470={};_0x3e8470[_0x3cf954]={'$like':'%'+_0x3d26ca['query'][_0x1cb9('0x4c')]+'%'};return _0x3e8470;})});}_0x5ca624=_[_0x1cb9('0x46')]({},_0x5ca624,_0x3d26ca[_0x1cb9('0x4d')]);return _0x1babdc[_0x1cb9('0x104')](_0x5ca624);}})[_0x1cb9('0x1d')](function(_0x355c3a){if(_0x355c3a){_0x57c223=_0x355c3a['length'];if(!_0x3d26ca[_0x1cb9('0x3d')][_0x1cb9('0x42')]('nolimit')){_0x5ca624[_0x1cb9('0x2a')]=qs[_0x1cb9('0x2a')](_0x3d26ca['query'][_0x1cb9('0x2a')]);_0x5ca624[_0x1cb9('0x29')]=qs[_0x1cb9('0x29')](_0x3d26ca[_0x1cb9('0x3d')][_0x1cb9('0x29')]);}return _0x1babdc[_0x1cb9('0x104')](_0x5ca624);}})['then'](function(_0x412c66){if(_0x412c66){return _0x412c66?{'count':_0x57c223,'rows':_0x412c66}:null;}})[_0x1cb9('0x1d')](respondWithResult(_0x2d6c56,null))[_0x1cb9('0x25')](handleError(_0x2d6c56,null));};exports['addProactiveActions']=function(_0xbaff47,_0x4af331,_0x5ad938){return db[_0x1cb9('0x105')][_0x1cb9('0x55')]({'where':{'id':_0xbaff47[_0x1cb9('0x52')]['id']}})[_0x1cb9('0x1d')](handleEntityNotFound(_0x4af331,null))['then'](function(_0xd31a99){if(_0xd31a99){return _0xd31a99[_0x1cb9('0x106')](_0xbaff47[_0x1cb9('0x57')][_0x1cb9('0x6c')],_[_0x1cb9('0xe1')](_0xbaff47[_0x1cb9('0x57')],[_0x1cb9('0x6c'),'id'])||{});}})['then'](respondWithResult(_0x4af331,null))[_0x1cb9('0x25')](handleError(_0x4af331,null));};exports[_0x1cb9('0x107')]=function(_0x398fc1,_0x5e3666,_0x20db03){var _0x572ef7={};var _0x396540={};var _0x4561cc;var _0x2733af;return db[_0x1cb9('0x39')][_0x1cb9('0x62')]({'where':{'id':_0x398fc1['params']['id']}})['then'](handleEntityNotFound(_0x5e3666,null))['then'](function(_0x4fbe4a){if(_0x4fbe4a){_0x4561cc=_0x4fbe4a;_0x396540[_0x1cb9('0x3b')]=_['keys'](db[_0x1cb9('0x108')]['rawAttributes']);_0x396540[_0x1cb9('0x3d')]=_[_0x1cb9('0x3c')](_0x398fc1[_0x1cb9('0x3d')]);_0x396540[_0x1cb9('0x3e')]=_[_0x1cb9('0x3f')](_0x396540[_0x1cb9('0x3b')],_0x396540[_0x1cb9('0x3d')]);_0x572ef7[_0x1cb9('0x40')]=_['intersection'](_0x396540[_0x1cb9('0x3b')],qs[_0x1cb9('0x53')](_0x398fc1[_0x1cb9('0x3d')][_0x1cb9('0x53')]));_0x572ef7[_0x1cb9('0x40')]=_0x572ef7['attributes']['length']?_0x572ef7[_0x1cb9('0x40')]:_0x396540['model'];_0x572ef7['order']=qs['sort'](_0x398fc1[_0x1cb9('0x3d')][_0x1cb9('0x43')]);_0x572ef7[_0x1cb9('0x44')]=qs[_0x1cb9('0x3e')](_[_0x1cb9('0x45')](_0x398fc1['query'],_0x396540[_0x1cb9('0x3e')]));if(_0x398fc1[_0x1cb9('0x3d')]['filter']){_0x572ef7[_0x1cb9('0x44')]=_[_0x1cb9('0x46')](_0x572ef7[_0x1cb9('0x44')],{'$or':_[_0x1cb9('0x47')](_0x572ef7[_0x1cb9('0x40')],function(_0x74cb14){var _0x39b4fa={};_0x39b4fa[_0x74cb14]={'$like':'%'+_0x398fc1['query'][_0x1cb9('0x4c')]+'%'};return _0x39b4fa;})});}_0x572ef7=_['merge']({},_0x572ef7,_0x398fc1['options']);return _0x4561cc[_0x1cb9('0x107')](_0x572ef7);}})['then'](function(_0x2c9609){if(_0x2c9609){_0x2733af=_0x2c9609[_0x1cb9('0x41')];if(!_0x398fc1[_0x1cb9('0x3d')]['hasOwnProperty'](_0x1cb9('0x64'))){_0x572ef7[_0x1cb9('0x2a')]=qs[_0x1cb9('0x2a')](_0x398fc1[_0x1cb9('0x3d')][_0x1cb9('0x2a')]);_0x572ef7[_0x1cb9('0x29')]=qs['offset'](_0x398fc1[_0x1cb9('0x3d')][_0x1cb9('0x29')]);}return _0x4561cc['getProactiveActions'](_0x572ef7);}})['then'](function(_0x216681){if(_0x216681){return _0x216681?{'count':_0x2733af,'rows':_0x216681}:null;}})[_0x1cb9('0x1d')](respondWithResult(_0x5e3666,null))[_0x1cb9('0x25')](handleError(_0x5e3666,null));};exports[_0x1cb9('0x109')]=function(_0x42615a,_0x5eafc3,_0x329d38){var _0x52c1cd=_0x42615a[_0x1cb9('0x3d')][_0x1cb9('0x10a')]===_0x1cb9('0x10b')?_0x1cb9('0x10c'):_0x1cb9('0x10d');return db['ChatWebsite'][_0x1cb9('0x55')]({'attributes':['id',_0x52c1cd],'where':{'id':_0x42615a['params']['id']}})[_0x1cb9('0x1d')](handleEntityNotFound(_0x5eafc3,null))['then'](function(_0x2d699d){if(_0x2d699d){var _0x37a414=_0x2d699d[_0x52c1cd];var _0x56042a=_0x37a414&&_0x37a414[_0x1cb9('0x10e')]?_0x37a414['items']:[];_0x5eafc3[_0x1cb9('0x36')]({'fromKey':_[_0x1cb9('0x7c')](_0x37a414['fromKey'])?undefined:_0x37a414[_0x1cb9('0x10f')],'count':_0x56042a[_0x1cb9('0x41')],'rows':_0x56042a});}})[_0x1cb9('0x25')](handleError(_0x5eafc3,null));};exports[_0x1cb9('0x110')]=function(_0x4c47c5,_0x50e7f3,_0x9adb8d){var _0x44edbf={'raw':!![],'where':{}};var _0x45e5cd={};var _0x1403ae={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x1cb9('0x62')]({'where':{'id':_0x4c47c5[_0x1cb9('0x52')]['id']}})['then'](handleEntityNotFound(_0x50e7f3,null))[_0x1cb9('0x1d')](function(_0x18a18f){if(_0x18a18f){_0x45e5cd[_0x1cb9('0x3b')]=_['keys'](db[_0x1cb9('0x111')]['rawAttributes']);_0x45e5cd[_0x1cb9('0x3d')]=_[_0x1cb9('0x3c')](_0x4c47c5['query']);_0x45e5cd[_0x1cb9('0x3e')]=_[_0x1cb9('0x3f')](_0x45e5cd[_0x1cb9('0x3b')],_0x45e5cd['query']);_0x44edbf[_0x1cb9('0x40')]=_[_0x1cb9('0x3f')](_0x45e5cd['model'],qs[_0x1cb9('0x53')](_0x4c47c5[_0x1cb9('0x3d')][_0x1cb9('0x53')]));_0x44edbf[_0x1cb9('0x40')]=_0x44edbf['attributes'][_0x1cb9('0x41')]?_0x44edbf['attributes']:_0x45e5cd['model'];if(!_0x4c47c5[_0x1cb9('0x3d')]['hasOwnProperty'](_0x1cb9('0x64'))){_0x44edbf[_0x1cb9('0x2a')]=qs[_0x1cb9('0x2a')](_0x4c47c5['query'][_0x1cb9('0x2a')]);_0x44edbf[_0x1cb9('0x29')]=qs[_0x1cb9('0x29')](_0x4c47c5[_0x1cb9('0x3d')][_0x1cb9('0x29')]);}_0x44edbf[_0x1cb9('0x65')]=qs[_0x1cb9('0x43')](_0x4c47c5[_0x1cb9('0x3d')][_0x1cb9('0x43')]);_0x44edbf[_0x1cb9('0x44')]=qs[_0x1cb9('0x3e')](_[_0x1cb9('0x45')](_0x4c47c5['query'],_0x45e5cd[_0x1cb9('0x3e')]));_0x44edbf[_0x1cb9('0x44')][_0x1cb9('0x66')]=_0x18a18f['id'];if(_0x4c47c5[_0x1cb9('0x3d')][_0x1cb9('0x4c')]){_0x44edbf[_0x1cb9('0x44')]=_['merge'](_0x44edbf[_0x1cb9('0x44')],{'$or':_[_0x1cb9('0x47')](_0x44edbf[_0x1cb9('0x40')],function(_0x43f3af){var _0x44ad12={};_0x44ad12[_0x43f3af]={'$like':'%'+_0x4c47c5['query'][_0x1cb9('0x4c')]+'%'};return _0x44ad12;})});}_0x44edbf=_['merge']({},_0x44edbf,_0x4c47c5[_0x1cb9('0x4d')]);return db[_0x1cb9('0x111')][_0x1cb9('0x4e')]({'where':_0x44edbf[_0x1cb9('0x44')]})[_0x1cb9('0x1d')](function(_0x46fd23){_0x1403ae[_0x1cb9('0x4e')]=_0x46fd23;if(_0x4c47c5[_0x1cb9('0x3d')][_0x1cb9('0x54')]){_0x44edbf['include']=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x1cb9('0x50')](_0x44edbf);})[_0x1cb9('0x1d')](function(_0x411704){_0x1403ae[_0x1cb9('0x51')]=_0x411704;return _0x1403ae;});}})[_0x1cb9('0x1d')](respondWithFilteredResult(_0x50e7f3,_0x44edbf))[_0x1cb9('0x25')](handleError(_0x50e7f3,null));};exports[_0x1cb9('0x112')]=function(_0x50bcf7,_0xdbdf68,_0x5bd3dc){return db[_0x1cb9('0x39')]['find']({'where':{'id':_0x50bcf7[_0x1cb9('0x52')]['id']}})[_0x1cb9('0x1d')](handleEntityNotFound(_0xdbdf68,null))[_0x1cb9('0x1d')](function(_0x50e87a){if(_0x50e87a){return _0x50e87a['addAgents'](_0x50bcf7[_0x1cb9('0x57')]['ids'],_[_0x1cb9('0xe1')](_0x50bcf7[_0x1cb9('0x57')],[_0x1cb9('0x6c'),'id'])||{})[_0x1cb9('0xb9')](function(_0x380938){for(var _0x49bc3a=0x0;_0x49bc3a<_0x50bcf7[_0x1cb9('0x57')][_0x1cb9('0x6c')][_0x1cb9('0x41')];_0x49bc3a+=0x1){socket[_0x1cb9('0x113')](_0x1cb9('0x114'),{'UserId':_0x50bcf7[_0x1cb9('0x57')][_0x1cb9('0x6c')][_0x49bc3a],'ChatWebsiteId':_0x50bcf7['params']['id']});}return _0x380938;});}})[_0x1cb9('0x1d')](respondWithResult(_0xdbdf68,null))['catch'](handleError(_0xdbdf68,null));};exports['removeAgents']=function(_0x3f1ebf,_0x32b643,_0x5cf703){var _0xb79d5a;return db[_0x1cb9('0x39')][_0x1cb9('0x55')]({'where':{'id':_0x3f1ebf[_0x1cb9('0x52')]['id']}})[_0x1cb9('0x1d')](handleEntityNotFound(_0x32b643,null))[_0x1cb9('0x1d')](function(_0x55c04a){if(_0x55c04a){return _0x55c04a[_0x1cb9('0x115')](_0x3f1ebf['query'][_0x1cb9('0x6c')])[_0x1cb9('0x1d')](function(_0x3bf6e4){if(_['isArray'](_0x3f1ebf['query'][_0x1cb9('0x6c')])){for(var _0x4be607=0x0;_0x4be607<_0x3f1ebf['query'][_0x1cb9('0x6c')][_0x1cb9('0x41')];_0x4be607+=0x1){socket['emit'](_0x1cb9('0x116'),{'UserId':_0x3f1ebf[_0x1cb9('0x3d')][_0x1cb9('0x6c')][_0x4be607],'ChatWebsiteId':_0x3f1ebf[_0x1cb9('0x52')]['id']});}}else{socket[_0x1cb9('0x113')]('userChatWebsite:remove',{'UserId':_0x3f1ebf[_0x1cb9('0x3d')][_0x1cb9('0x6c')],'ChatWebsiteId':_0x3f1ebf[_0x1cb9('0x52')]['id']});}});}})[_0x1cb9('0x1d')](respondWithStatusCode(_0x32b643,null))['catch'](handleError(_0x32b643,null));};exports[_0x1cb9('0x117')]=function(_0x38b52e,_0x5e0361,_0x230de0){var _0x566828={};var _0x12868a={};var _0x446490;var _0x3f318d;return db[_0x1cb9('0x39')]['findOne']({'where':{'id':_0x38b52e[_0x1cb9('0x52')]['id']}})['then'](handleEntityNotFound(_0x5e0361,null))[_0x1cb9('0x1d')](function(_0x863d6b){if(_0x863d6b){_0x446490=_0x863d6b;_0x12868a[_0x1cb9('0x3b')]=_[_0x1cb9('0x3c')](db[_0x1cb9('0xc1')][_0x1cb9('0x3a')]);_0x12868a[_0x1cb9('0x3d')]=_[_0x1cb9('0x3c')](_0x38b52e[_0x1cb9('0x3d')]);_0x12868a[_0x1cb9('0x3e')]=_[_0x1cb9('0x3f')](_0x12868a[_0x1cb9('0x3b')],_0x12868a['query']);_0x566828[_0x1cb9('0x40')]=_[_0x1cb9('0x3f')](_0x12868a[_0x1cb9('0x3b')],qs[_0x1cb9('0x53')](_0x38b52e[_0x1cb9('0x3d')][_0x1cb9('0x53')]));_0x566828[_0x1cb9('0x40')]=_0x566828[_0x1cb9('0x40')]['length']?_0x566828[_0x1cb9('0x40')]:_0x12868a[_0x1cb9('0x3b')];_0x566828[_0x1cb9('0x65')]=qs['sort'](_0x38b52e[_0x1cb9('0x3d')]['sort']);_0x566828[_0x1cb9('0x44')]=qs[_0x1cb9('0x3e')](_['pick'](_0x38b52e['query'],_0x12868a[_0x1cb9('0x3e')]));if(_0x38b52e[_0x1cb9('0x3d')][_0x1cb9('0x4c')]){_0x566828[_0x1cb9('0x44')]=_[_0x1cb9('0x46')](_0x566828['where'],{'$or':_['map'](_0x566828['attributes'],function(_0x1cdcb6){var _0x1c5709={};_0x1c5709[_0x1cdcb6]={'$like':'%'+_0x38b52e[_0x1cb9('0x3d')][_0x1cb9('0x4c')]+'%'};return _0x1c5709;})});}_0x566828=_[_0x1cb9('0x46')]({},_0x566828,_0x38b52e[_0x1cb9('0x4d')]);return _0x446490['getAgents'](_0x566828);}})['then'](function(_0x37d45c){if(_0x37d45c){_0x3f318d=_0x37d45c[_0x1cb9('0x41')];if(!_0x38b52e[_0x1cb9('0x3d')][_0x1cb9('0x42')]('nolimit')){_0x566828[_0x1cb9('0x2a')]=qs[_0x1cb9('0x2a')](_0x38b52e[_0x1cb9('0x3d')][_0x1cb9('0x2a')]);_0x566828[_0x1cb9('0x29')]=qs[_0x1cb9('0x29')](_0x38b52e['query']['offset']);}return _0x446490['getAgents'](_0x566828);}})[_0x1cb9('0x1d')](function(_0x3bf219){if(_0x3bf219){return _0x3bf219?{'count':_0x3f318d,'rows':_0x3bf219}:null;}})['then'](respondWithResult(_0x5e0361,null))[_0x1cb9('0x25')](handleError(_0x5e0361,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 586c9ad..6d5849e 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 _0x5c0e=['hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5c0e,0x160));var _0xe5c0=function(_0x189d3c,_0x5efebf){_0x189d3c=_0x189d3c-0x0;var _0x485959=_0x5c0e[_0x189d3c];return _0x485959;};'use strict';var EventEmitter=require(_0xe5c0('0x0'));var ChatWebsite=require(_0xe5c0('0x1'))['db'][_0xe5c0('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xe5c0('0x3')](0x0);var events={'afterCreate':_0xe5c0('0x4'),'afterUpdate':_0xe5c0('0x5'),'afterDestroy':_0xe5c0('0x6')};function emitEvent(_0x50f25a){return function(_0x361b5d,_0x4c9bf9,_0x43fb02){ChatWebsiteEvents[_0xe5c0('0x7')](_0x50f25a+':'+_0x361b5d['id'],_0x361b5d);ChatWebsiteEvents[_0xe5c0('0x7')](_0x50f25a,_0x361b5d);_0x43fb02(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xe5c0('0x8')](e,emitEvent(event));}}module[_0xe5c0('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0xa400=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatWebsite'];(function(_0x46e812,_0x62b334){var _0x215cca=function(_0x38432b){while(--_0x38432b){_0x46e812['push'](_0x46e812['shift']());}};_0x215cca(++_0x62b334);}(_0xa400,0xc1));var _0x0a40=function(_0x3b36a9,_0x415c2b){_0x3b36a9=_0x3b36a9-0x0;var _0x73f3c1=_0xa400[_0x3b36a9];return _0x73f3c1;};'use strict';var EventEmitter=require(_0x0a40('0x0'));var ChatWebsite=require(_0x0a40('0x1'))['db'][_0x0a40('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0a40('0x3')};function emitEvent(_0x469d2e){return function(_0x59877a,_0x38d543,_0x53965c){ChatWebsiteEvents[_0x0a40('0x4')](_0x469d2e+':'+_0x59877a['id'],_0x59877a);ChatWebsiteEvents[_0x0a40('0x4')](_0x469d2e,_0x59877a);_0x53965c(null);};}for(var e in events){if(events[_0x0a40('0x5')](e)){var event=events[e];ChatWebsite[_0x0a40('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 a467cb0..836b2a0 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 _0x5b02=['ChatWebsite','lodash','util','../../config/logger','api','request-promise','exports','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5b02,0xe9));var _0x25b0=function(_0x43cee5,_0x198a8c){_0x43cee5=_0x43cee5-0x0;var _0x2f8182=_0x5b02[_0x43cee5];return _0x2f8182;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var logger=require(_0x25b0('0x2'))(_0x25b0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x25b0('0x4'));var attributes=require('./chatWebsite.attributes');module[_0x25b0('0x5')]=function(_0x31c9c2,_0x38dc14){return _0x31c9c2[_0x25b0('0x6')](_0x25b0('0x7'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc73e=['chat_websites','lodash','util','api','moment','exports','define','ChatWebsite'];(function(_0x2f419d,_0x4f6155){var _0x4d3591=function(_0x3d230b){while(--_0x3d230b){_0x2f419d['push'](_0x2f419d['shift']());}};_0x4d3591(++_0x4f6155);}(_0xc73e,0x1e9));var _0xec73=function(_0x2c27dc,_0xd892d9){_0x2c27dc=_0x2c27dc-0x0;var _0x366685=_0xc73e[_0x2c27dc];return _0x366685;};'use strict';var _=require(_0xec73('0x0'));var util=require(_0xec73('0x1'));var logger=require('../../config/logger')(_0xec73('0x2'));var moment=require(_0xec73('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./chatWebsite.attributes');module[_0xec73('0x4')]=function(_0x3b35a2,_0x4fbf12){return _0x3b35a2[_0xec73('0x5')](_0xec73('0x6'),attributes,{'tableName':_0xec73('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 8f5d444..f8f8f7e 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 _0xdfc8=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','catch','lodash','util'];(function(_0x581f8e,_0x5617cb){var _0x18aec=function(_0x4536c7){while(--_0x4536c7){_0x581f8e['push'](_0x581f8e['shift']());}};_0x18aec(++_0x5617cb);}(_0xdfc8,0x127));var _0x8dfc=function(_0x1911d9,_0x1a5392){_0x1911d9=_0x1911d9-0x0;var _0xc8aa6=_0xdfc8[_0x1911d9];return _0xc8aa6;};'use strict';var _=require(_0x8dfc('0x0'));var util=require(_0x8dfc('0x1'));var moment=require('moment');var BPromise=require(_0x8dfc('0x2'));var rs=require(_0x8dfc('0x3'));var fs=require('fs');var Redis=require(_0x8dfc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8dfc('0x5'));var logger=require(_0x8dfc('0x6'))(_0x8dfc('0x7'));var config=require(_0x8dfc('0x8'));var jayson=require(_0x8dfc('0x9'));var client=jayson[_0x8dfc('0xa')][_0x8dfc('0xb')]({'port':0x232a});config[_0x8dfc('0xc')]=_[_0x8dfc('0xd')](config['redis'],{'host':_0x8dfc('0xe'),'port':0x18eb});var socket=require(_0x8dfc('0xf'))(new Redis(config[_0x8dfc('0xc')]));require(_0x8dfc('0x10'))[_0x8dfc('0x11')](socket);function respondWithRpcPromise(_0x31f81d,_0x21b338,_0x4c3de3){return new BPromise(function(_0x2a6ce5,_0x23ee7e){return client[_0x8dfc('0x12')](_0x31f81d,_0x4c3de3)[_0x8dfc('0x13')](function(_0x410d6f){logger[_0x8dfc('0x14')](_0x8dfc('0x15'),_0x21b338,'request\x20sent');logger['debug'](_0x8dfc('0x16'),_0x21b338,'request\x20sent',JSON['stringify'](_0x410d6f));if(_0x410d6f[_0x8dfc('0x17')]){if(_0x410d6f['error']['code']===0x1f4){logger[_0x8dfc('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x21b338,_0x410d6f[_0x8dfc('0x17')][_0x8dfc('0x18')]);return _0x23ee7e(_0x410d6f[_0x8dfc('0x17')][_0x8dfc('0x18')]);}logger[_0x8dfc('0x17')](_0x8dfc('0x15'),_0x21b338,_0x410d6f[_0x8dfc('0x17')][_0x8dfc('0x18')]);return _0x2a6ce5(_0x410d6f[_0x8dfc('0x17')][_0x8dfc('0x18')]);}else{logger[_0x8dfc('0x14')](_0x8dfc('0x15'),_0x21b338,_0x8dfc('0x19'));_0x2a6ce5(_0x410d6f['result']['message']);}})[_0x8dfc('0x1a')](function(_0x5cb75){logger['error'](_0x8dfc('0x15'),_0x21b338,_0x5cb75);_0x23ee7e(_0x5cb75);});});} \ No newline at end of file +var _0xdb84=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xdb84,0xa8));var _0x4db8=function(_0x5b9ee6,_0x1abce4){_0x5b9ee6=_0x5b9ee6-0x0;var _0x315bb2=_0xdb84[_0x5b9ee6];return _0x315bb2;};'use strict';var _=require('lodash');var util=require(_0x4db8('0x0'));var moment=require(_0x4db8('0x1'));var BPromise=require('bluebird');var rs=require(_0x4db8('0x2'));var fs=require('fs');var Redis=require(_0x4db8('0x3'));var db=require(_0x4db8('0x4'))['db'];var utils=require(_0x4db8('0x5'));var logger=require(_0x4db8('0x6'))(_0x4db8('0x7'));var config=require(_0x4db8('0x8'));var jayson=require(_0x4db8('0x9'));var client=jayson[_0x4db8('0xa')][_0x4db8('0xb')]({'port':0x232a});config[_0x4db8('0xc')]=_[_0x4db8('0xd')](config[_0x4db8('0xc')],{'host':_0x4db8('0xe'),'port':0x18eb});var socket=require(_0x4db8('0xf'))(new Redis(config['redis']));require(_0x4db8('0x10'))[_0x4db8('0x11')](socket);function respondWithRpcPromise(_0x304e80,_0x2ffcfe,_0x356da5){return new BPromise(function(_0x2076f1,_0x6e3e22){return client[_0x4db8('0x12')](_0x304e80,_0x356da5)[_0x4db8('0x13')](function(_0x59eaea){logger[_0x4db8('0x14')](_0x4db8('0x15'),_0x2ffcfe,_0x4db8('0x16'));logger[_0x4db8('0x17')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x2ffcfe,_0x4db8('0x16'),JSON['stringify'](_0x59eaea));if(_0x59eaea[_0x4db8('0x18')]){if(_0x59eaea[_0x4db8('0x18')][_0x4db8('0x19')]===0x1f4){logger[_0x4db8('0x18')](_0x4db8('0x15'),_0x2ffcfe,_0x59eaea[_0x4db8('0x18')][_0x4db8('0x1a')]);return _0x6e3e22(_0x59eaea[_0x4db8('0x18')][_0x4db8('0x1a')]);}logger[_0x4db8('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x2ffcfe,_0x59eaea['error'][_0x4db8('0x1a')]);return _0x2076f1(_0x59eaea['error'][_0x4db8('0x1a')]);}else{logger['info'](_0x4db8('0x15'),_0x2ffcfe,'request\x20sent');_0x2076f1(_0x59eaea[_0x4db8('0x1b')][_0x4db8('0x1a')]);}})['catch'](function(_0x19501e){logger['error'](_0x4db8('0x15'),_0x2ffcfe,_0x19501e);_0x6e3e22(_0x19501e);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index f75de87..9784a57 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 _0x9f81=['remove','update','emit','./chatWebsite.events','save'];(function(_0x2b4965,_0xf6aa56){var _0xdf7318=function(_0x367ed6){while(--_0x367ed6){_0x2b4965['push'](_0x2b4965['shift']());}};_0xdf7318(++_0xf6aa56);}(_0x9f81,0x1e8));var _0x19f8=function(_0x5b5b25,_0x2a8256){_0x5b5b25=_0x5b5b25-0x0;var _0x441ffc=_0x9f81[_0x5b5b25];return _0x441ffc;};'use strict';var ChatWebsiteEvents=require(_0x19f8('0x0'));var events=[_0x19f8('0x1'),_0x19f8('0x2'),_0x19f8('0x3')];function createListener(_0x3c9d61,_0xabacd8){return function(_0xe3c7dc){_0xabacd8[_0x19f8('0x4')](_0x3c9d61,_0xe3c7dc);};}function removeListener(_0x50cc73,_0x11f3d1){return function(){ChatWebsiteEvents['removeListener'](_0x50cc73,_0x11f3d1);};}exports['register']=function(_0x20da8b){for(var _0x44210b=0x0,_0x21af9f=events['length'];_0x44210b<_0x21af9f;_0x44210b++){var _0x397a6d=events[_0x44210b];var _0x31106f=createListener('chatWebsite:'+_0x397a6d,_0x20da8b);ChatWebsiteEvents['on'](_0x397a6d,_0x31106f);}}; \ No newline at end of file +var _0x7b92=['removeListener','length','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7b92,0x1e3));var _0x27b9=function(_0x2b1551,_0x1776fe){_0x2b1551=_0x2b1551-0x0;var _0x2fc2a1=_0x7b92[_0x2b1551];return _0x2fc2a1;};'use strict';var ChatWebsiteEvents=require(_0x27b9('0x0'));var events=['save',_0x27b9('0x1'),_0x27b9('0x2')];function createListener(_0x4e8c23,_0x47b25e){return function(_0x23a455){_0x47b25e['emit'](_0x4e8c23,_0x23a455);};}function removeListener(_0x4927e6,_0x1a09ed){return function(){ChatWebsiteEvents[_0x27b9('0x3')](_0x4927e6,_0x1a09ed);};}exports['register']=function(_0x2d4c78){for(var _0x28e9a3=0x0,_0x4cd230=events[_0x27b9('0x4')];_0x28e9a3<_0x4cd230;_0x28e9a3++){var _0x1160bb=events[_0x28e9a3];var _0x52274f=createListener(_0x27b9('0x5')+_0x1160bb,_0x2d4c78);ChatWebsiteEvents['on'](_0x1160bb,_0x52274f);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 7847461..9313694 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 _0x8d97=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','server/files/images/logos/','format','%s-%s','originalname','single','file','diskStorage','server/files/images/avatars/','now','join','root','/:id/notify','notify','/:id/offline','offline','addInteraction','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','exports','util','path'];(function(_0x1f9936,_0x3ac035){var _0x50930b=function(_0x27b655){while(--_0x27b655){_0x1f9936['push'](_0x1f9936['shift']());}};_0x50930b(++_0x3ac035);}(_0x8d97,0x82));var _0x78d9=function(_0x429745,_0x3b04b4){_0x429745=_0x429745-0x0;var _0x53e0f1=_0x8d97[_0x429745];return _0x53e0f1;};'use strict';var multer=require('multer');var util=require(_0x78d9('0x0'));var path=require(_0x78d9('0x1'));var timeout=require('connect-timeout');var express=require(_0x78d9('0x2'));var router=express[_0x78d9('0x3')]();var auth=require(_0x78d9('0x4'));var interaction=require(_0x78d9('0x5'));var config=require(_0x78d9('0x6'));var controller=require('./chatWebsite.controller');router[_0x78d9('0x7')]('/',auth[_0x78d9('0x8')](),controller[_0x78d9('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x78d9('0xa')]);router[_0x78d9('0x7')](_0x78d9('0xb'),auth[_0x78d9('0x8')](),controller[_0x78d9('0xc')]);router[_0x78d9('0x7')]('/:id/dispositions',auth[_0x78d9('0x8')](),controller[_0x78d9('0xd')]);router[_0x78d9('0x7')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x78d9('0xe')]);router[_0x78d9('0x7')](_0x78d9('0xf'),controller[_0x78d9('0x10')]);router[_0x78d9('0x7')](_0x78d9('0x11'),controller['getAvatar']);router[_0x78d9('0x7')](_0x78d9('0x12'),controller[_0x78d9('0x13')]);router[_0x78d9('0x7')](_0x78d9('0x14'),controller[_0x78d9('0x15')]);router[_0x78d9('0x7')](_0x78d9('0x16'),auth[_0x78d9('0x8')](),controller[_0x78d9('0x17')]);router[_0x78d9('0x7')](_0x78d9('0x18'),controller[_0x78d9('0x19')]);router[_0x78d9('0x7')](_0x78d9('0x1a'),auth[_0x78d9('0x8')](),controller[_0x78d9('0x1b')]);router['get'](_0x78d9('0x1c'),auth[_0x78d9('0x8')](),controller[_0x78d9('0x1d')]);router[_0x78d9('0x7')](_0x78d9('0x1e'),controller[_0x78d9('0x1f')]);router[_0x78d9('0x7')](_0x78d9('0x20'),auth[_0x78d9('0x8')](),controller[_0x78d9('0x21')]);router[_0x78d9('0x7')](_0x78d9('0x22'),auth[_0x78d9('0x8')](),controller[_0x78d9('0x23')]);router[_0x78d9('0x24')]('/',auth[_0x78d9('0x8')](),controller['create']);router[_0x78d9('0x24')](_0x78d9('0x25'),auth[_0x78d9('0x8')](),controller[_0x78d9('0x26')]);router['post'](_0x78d9('0x27'),auth[_0x78d9('0x8')](),controller[_0x78d9('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x51c4ce,_0x30e434,_0x4946a5){_0x4946a5(null,path['join'](config['root'],_0x78d9('0x29')));},'filename':function(_0x1fa9a1,_0x361a5e,_0xacd80c){_0xacd80c(null,util[_0x78d9('0x2a')](_0x78d9('0x2b'),Date['now'](),_0x361a5e[_0x78d9('0x2c')]));}})});router['post'](_0x78d9('0xf'),upload[_0x78d9('0x2d')](_0x78d9('0x2e')),controller['addLogo']);var upload=multer({'storage':multer[_0x78d9('0x2f')]({'destination':function(_0x337816,_0x59b9d2,_0x47f189){_0x47f189(null,path['join'](config['root'],_0x78d9('0x30')));},'filename':function(_0xcbb803,_0x146396,_0x45002a){_0x45002a(null,util[_0x78d9('0x2a')](_0x78d9('0x2b'),Date[_0x78d9('0x31')](),_0x146396[_0x78d9('0x2c')]));}})});router[_0x78d9('0x24')](_0x78d9('0x11'),upload['single'](_0x78d9('0x2e')),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x28bc5f,_0xafa1fd,_0x3ea15e){_0x3ea15e(null,path[_0x78d9('0x32')](config[_0x78d9('0x33')],_0x78d9('0x30')));},'filename':function(_0x19978f,_0x5cc2c0,_0x294492){_0x294492(null,util[_0x78d9('0x2a')](_0x78d9('0x2b'),Date[_0x78d9('0x31')](),_0x5cc2c0['originalname']));}})});router[_0x78d9('0x24')]('/:id/customer_avatar',upload['single']('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x78d9('0x2f')]({'destination':function(_0x52d40c,_0x117f33,_0x7ea81f){_0x7ea81f(null,path[_0x78d9('0x32')](config[_0x78d9('0x33')],_0x78d9('0x30')));},'filename':function(_0x423edd,_0x2e326c,_0x216ae7){_0x216ae7(null,util[_0x78d9('0x2a')](_0x78d9('0x2b'),Date[_0x78d9('0x31')](),_0x2e326c[_0x78d9('0x2c')]));}})});router[_0x78d9('0x24')](_0x78d9('0x14'),upload[_0x78d9('0x2d')](_0x78d9('0x2e')),controller['addSystemAvatar']);router['post'](_0x78d9('0x34'),controller[_0x78d9('0x35')]);router[_0x78d9('0x24')](_0x78d9('0x36'),controller[_0x78d9('0x37')]);router[_0x78d9('0x24')]('/:id/interactions',auth[_0x78d9('0x8')](),controller[_0x78d9('0x38')]);router[_0x78d9('0x24')](_0x78d9('0x1a'),auth[_0x78d9('0x8')](),controller['addApplications']);router[_0x78d9('0x24')](_0x78d9('0x1c'),auth[_0x78d9('0x8')](),controller[_0x78d9('0x39')]);router['post'](_0x78d9('0x22'),auth[_0x78d9('0x8')](),controller[_0x78d9('0x3a')]);router[_0x78d9('0x3b')](_0x78d9('0xb'),auth[_0x78d9('0x8')](),controller[_0x78d9('0x3c')]);router[_0x78d9('0x3d')](_0x78d9('0xb'),auth['isAuthenticated'](),controller[_0x78d9('0x3e')]);router[_0x78d9('0x3d')](_0x78d9('0x25'),auth[_0x78d9('0x8')](),controller[_0x78d9('0x3f')]);router[_0x78d9('0x3d')](_0x78d9('0x27'),auth[_0x78d9('0x8')](),controller[_0x78d9('0x40')]);router[_0x78d9('0x3d')](_0x78d9('0x22'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x78d9('0x41')]=router; \ No newline at end of file +var _0xa9e5=['/:id/users','addAgents','put','update','delete','destroy','removeAnswers','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','getAgents','post','/:id/dispositions','join','root','server/files/images/logos/','now','originalname','single','file','addLogo','diskStorage','server/files/images/avatars/','format','%s-%s','/:id/avatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','addApplications','/:id/proactive_actions'];(function(_0x200aa5,_0x197802){var _0x458200=function(_0x594959){while(--_0x594959){_0x200aa5['push'](_0x200aa5['shift']());}};_0x458200(++_0x197802);}(_0xa9e5,0x8a));var _0x5a9e=function(_0x54380d,_0x533450){_0x54380d=_0x54380d-0x0;var _0x131213=_0xa9e5[_0x54380d];return _0x131213;};'use strict';var multer=require(_0x5a9e('0x0'));var util=require(_0x5a9e('0x1'));var path=require('path');var timeout=require(_0x5a9e('0x2'));var express=require(_0x5a9e('0x3'));var router=express[_0x5a9e('0x4')]();var auth=require(_0x5a9e('0x5'));var interaction=require(_0x5a9e('0x6'));var config=require(_0x5a9e('0x7'));var controller=require(_0x5a9e('0x8'));router[_0x5a9e('0x9')]('/',auth[_0x5a9e('0xa')](),controller[_0x5a9e('0xb')]);router[_0x5a9e('0x9')](_0x5a9e('0xc'),auth[_0x5a9e('0xa')](),controller[_0x5a9e('0xd')]);router['get'](_0x5a9e('0xe'),auth[_0x5a9e('0xa')](),controller[_0x5a9e('0xf')]);router[_0x5a9e('0x9')]('/:id/dispositions',auth[_0x5a9e('0xa')](),controller['getDispositions']);router[_0x5a9e('0x9')](_0x5a9e('0x10'),auth[_0x5a9e('0xa')](),controller[_0x5a9e('0x11')]);router[_0x5a9e('0x9')](_0x5a9e('0x12'),controller[_0x5a9e('0x13')]);router[_0x5a9e('0x9')]('/:id/avatar',controller['getAvatar']);router[_0x5a9e('0x9')](_0x5a9e('0x14'),controller[_0x5a9e('0x15')]);router[_0x5a9e('0x9')]('/:id/system_avatar',controller[_0x5a9e('0x16')]);router['get'](_0x5a9e('0x17'),auth[_0x5a9e('0xa')](),controller['getInteractions']);router[_0x5a9e('0x9')](_0x5a9e('0x18'),controller[_0x5a9e('0x19')]);router[_0x5a9e('0x9')](_0x5a9e('0x1a'),auth[_0x5a9e('0xa')](),controller[_0x5a9e('0x1b')]);router[_0x5a9e('0x9')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x5a9e('0x1c')]);router[_0x5a9e('0x9')](_0x5a9e('0x1d'),controller['getFields']);router[_0x5a9e('0x9')](_0x5a9e('0x1e'),auth[_0x5a9e('0xa')](),controller[_0x5a9e('0x1f')]);router[_0x5a9e('0x9')]('/:id/users',auth[_0x5a9e('0xa')](),controller[_0x5a9e('0x20')]);router[_0x5a9e('0x21')]('/',auth[_0x5a9e('0xa')](),controller['create']);router[_0x5a9e('0x21')](_0x5a9e('0x22'),auth[_0x5a9e('0xa')](),controller['addDisposition']);router[_0x5a9e('0x21')](_0x5a9e('0x10'),auth[_0x5a9e('0xa')](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3f8e00,_0x60c8a0,_0xfb4173){_0xfb4173(null,path[_0x5a9e('0x23')](config[_0x5a9e('0x24')],_0x5a9e('0x25')));},'filename':function(_0x4f5c58,_0x3f25c8,_0x1d3807){_0x1d3807(null,util['format']('%s-%s',Date[_0x5a9e('0x26')](),_0x3f25c8[_0x5a9e('0x27')]));}})});router['post'](_0x5a9e('0x12'),upload[_0x5a9e('0x28')](_0x5a9e('0x29')),controller[_0x5a9e('0x2a')]);var upload=multer({'storage':multer[_0x5a9e('0x2b')]({'destination':function(_0x16f24d,_0x303b3f,_0x170e9f){_0x170e9f(null,path[_0x5a9e('0x23')](config[_0x5a9e('0x24')],_0x5a9e('0x2c')));},'filename':function(_0x32f73d,_0x371c90,_0xcccf5d){_0xcccf5d(null,util[_0x5a9e('0x2d')](_0x5a9e('0x2e'),Date[_0x5a9e('0x26')](),_0x371c90['originalname']));}})});router[_0x5a9e('0x21')](_0x5a9e('0x2f'),upload['single'](_0x5a9e('0x29')),controller['addAvatar']);var upload=multer({'storage':multer[_0x5a9e('0x2b')]({'destination':function(_0x4fceb0,_0xa3557b,_0x24e741){_0x24e741(null,path[_0x5a9e('0x23')](config['root'],_0x5a9e('0x2c')));},'filename':function(_0x32dbaf,_0x4c1062,_0x273b93){_0x273b93(null,util['format'](_0x5a9e('0x2e'),Date[_0x5a9e('0x26')](),_0x4c1062[_0x5a9e('0x27')]));}})});router[_0x5a9e('0x21')](_0x5a9e('0x14'),upload[_0x5a9e('0x28')](_0x5a9e('0x29')),controller[_0x5a9e('0x30')]);var upload=multer({'storage':multer[_0x5a9e('0x2b')]({'destination':function(_0x3d34bb,_0x1c6e7a,_0x3b7031){_0x3b7031(null,path[_0x5a9e('0x23')](config[_0x5a9e('0x24')],_0x5a9e('0x2c')));},'filename':function(_0x554e0c,_0x174ff3,_0x103851){_0x103851(null,util[_0x5a9e('0x2d')](_0x5a9e('0x2e'),Date[_0x5a9e('0x26')](),_0x174ff3['originalname']));}})});router['post'](_0x5a9e('0x31'),upload[_0x5a9e('0x28')]('file'),controller[_0x5a9e('0x32')]);router[_0x5a9e('0x21')](_0x5a9e('0x33'),controller[_0x5a9e('0x34')]);router[_0x5a9e('0x21')](_0x5a9e('0x35'),controller[_0x5a9e('0x36')]);router[_0x5a9e('0x21')](_0x5a9e('0x17'),auth[_0x5a9e('0xa')](),controller['addInteraction']);router[_0x5a9e('0x21')](_0x5a9e('0x1a'),auth[_0x5a9e('0xa')](),controller[_0x5a9e('0x37')]);router[_0x5a9e('0x21')](_0x5a9e('0x38'),auth['isAuthenticated'](),controller['addProactiveActions']);router['post'](_0x5a9e('0x39'),auth[_0x5a9e('0xa')](),controller[_0x5a9e('0x3a')]);router[_0x5a9e('0x3b')]('/:id',auth[_0x5a9e('0xa')](),controller[_0x5a9e('0x3c')]);router[_0x5a9e('0x3d')](_0x5a9e('0xe'),auth['isAuthenticated'](),controller[_0x5a9e('0x3e')]);router[_0x5a9e('0x3d')](_0x5a9e('0x22'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x5a9e('0x3d')](_0x5a9e('0x10'),auth[_0x5a9e('0xa')](),controller[_0x5a9e('0x3f')]);router[_0x5a9e('0x3d')](_0x5a9e('0x39'),auth[_0x5a9e('0xa')](),controller['removeAgents']);module[_0x5a9e('0x40')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index ea34ffb..dd3c4fb 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 _0x5b22=['STRING'];(function(_0x4bc007,_0x2f3ef8){var _0x246b81=function(_0x1ad635){while(--_0x1ad635){_0x4bc007['push'](_0x4bc007['shift']());}};_0x246b81(++_0x2f3ef8);}(_0x5b22,0x178));var _0x25b2=function(_0xafba8f,_0x5579fe){_0xafba8f=_0xafba8f-0x0;var _0x41033d=_0x5b22[_0xafba8f];return _0x41033d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x25b2('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x25b2('0x0')]},'companyId':{'type':Sequelize[_0x25b2('0x0')]},'website':{'type':Sequelize[_0x25b2('0x0')]},'phone':{'type':Sequelize[_0x25b2('0x0')]},'fax':{'type':Sequelize[_0x25b2('0x0')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x25b2('0x0')]},'postalCode':{'type':Sequelize[_0x25b2('0x0')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x25b2('0x0')]},'email':{'type':Sequelize[_0x25b2('0x0')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x25b2('0x0')]},'sStreet':{'type':Sequelize[_0x25b2('0x0')]},'sPostalCode':{'type':Sequelize[_0x25b2('0x0')]},'sCity':{'type':Sequelize[_0x25b2('0x0')]},'sCountry':{'type':Sequelize[_0x25b2('0x0')]},'description':{'type':Sequelize[_0x25b2('0x0')]}}; \ No newline at end of file +var _0xd3ba=['STRING','exports'];(function(_0x541dc4,_0xb884e3){var _0x26aeda=function(_0x33ad14){while(--_0x33ad14){_0x541dc4['push'](_0x541dc4['shift']());}};_0x26aeda(++_0xb884e3);}(_0xd3ba,0x99));var _0xad3b=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xd3ba[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require('sequelize');module[_0xad3b('0x0')]={'name':{'type':Sequelize[_0xad3b('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xad3b('0x1')]},'phone':{'type':Sequelize[_0xad3b('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xad3b('0x1')]},'city':{'type':Sequelize[_0xad3b('0x1')]},'country':{'type':Sequelize[_0xad3b('0x1')]},'email':{'type':Sequelize[_0xad3b('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xad3b('0x1')]},'sPostalCode':{'type':Sequelize[_0xad3b('0x1')]},'sCity':{'type':Sequelize[_0xad3b('0x1')]},'sCountry':{'type':Sequelize[_0xad3b('0x1')]},'description':{'type':Sequelize[_0xad3b('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 633102a..e139825 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 _0x1166=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','getContacts','findOne','fields','order','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','save','update','get','destroy','then','error','stack','name','send','index','CmCompany','model','query','keys','filters','intersection','attributes','nolimit','sort','where','pick','filter','map','type','key','VIRTUAL','field','merge','options','count','includeAll','include','findAll','catch','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Companies','UserProfileSection','userProfileId'];(function(_0x172002,_0x4e0955){var _0x37bf74=function(_0x1a9e08){while(--_0x1a9e08){_0x172002['push'](_0x172002['shift']());}};_0x37bf74(++_0x4e0955);}(_0x1166,0xbf));var _0x6116=function(_0x1853bd,_0x2693e6){_0x1853bd=_0x1853bd-0x0;var _0x21341b=_0x1166[_0x1853bd];return _0x21341b;};'use strict';var pdf=require(_0x6116('0x0'));var emlformat=require(_0x6116('0x1'));var rimraf=require(_0x6116('0x2'));var zipdir=require(_0x6116('0x3'));var jsonpatch=require(_0x6116('0x4'));var rp=require(_0x6116('0x5'));var moment=require(_0x6116('0x6'));var BPromise=require(_0x6116('0x7'));var Mustache=require(_0x6116('0x8'));var util=require(_0x6116('0x9'));var path=require('path');var sox=require(_0x6116('0xa'));var csv=require(_0x6116('0xb'));var ejs=require(_0x6116('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6116('0xd'));var crypto=require('crypto');var jsforce=require(_0x6116('0xe'));var deskjs=require(_0x6116('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6116('0x10'));var Papa=require(_0x6116('0x11'));var authService=require(_0x6116('0x12'));var hardwareService=require(_0x6116('0x13'));var Redis=require(_0x6116('0x14'));var qs=require(_0x6116('0x15'));var logger=require(_0x6116('0x16'))(_0x6116('0x17'));var utils=require(_0x6116('0x18'));var config=require('../../config/environment');var db=require(_0x6116('0x19'))['db'];function respondWithStatusCode(_0x2b228a,_0x220740){_0x220740=_0x220740||0xcc;return function(_0x20239b){if(_0x20239b){return _0x2b228a[_0x6116('0x1a')](_0x220740);}return _0x2b228a[_0x6116('0x1b')](_0x220740)[_0x6116('0x1c')]();};}function respondWithResult(_0x363021,_0x38dc50){_0x38dc50=_0x38dc50||0xc8;return function(_0x1761d7){if(_0x1761d7){return _0x363021[_0x6116('0x1b')](_0x38dc50)[_0x6116('0x1d')](_0x1761d7);}};}function respondWithFilteredResult(_0x588e8f,_0x176193){return function(_0x3e3d72){if(_0x3e3d72){var _0x58163c=_0x3e3d72['count'],_0x27fdd7=_0x176193[_0x6116('0x1e')],_0x47c08c=_0x176193['offset']+_0x176193[_0x6116('0x1f')],_0xa277d1;if(_0x47c08c>=_0x58163c){_0x47c08c=_0x58163c;_0xa277d1=0xc8;}else{_0xa277d1=0xce;}_0x588e8f[_0x6116('0x1b')](_0xa277d1);return _0x588e8f['set'](_0x6116('0x20'),_0x27fdd7+'-'+_0x47c08c+'/'+_0x58163c)['json'](_0x3e3d72);}return null;};}function patchUpdates(_0x2fa292){return function(_0x5463cc){try{jsonpatch[_0x6116('0x21')](_0x5463cc,_0x2fa292,!![]);}catch(_0x1d5bb7){return BPromise['reject'](_0x1d5bb7);}return _0x5463cc[_0x6116('0x22')]();};}function saveUpdates(_0x507888,_0x2ebe0d){return function(_0x14afcb){if(_0x14afcb){return _0x14afcb[_0x6116('0x23')](_0x507888)['then'](function(_0x296e1d){return _0x296e1d;});}return null;};}function removeEntity(_0x5428d4,_0x51b793){return function(_0x2065fb){if(_0x2065fb){return _0x2065fb['destroy']()['then'](function(){var _0x17cd25=_0x2065fb[_0x6116('0x24')]({'plain':!![]});var _0x533b81='Companies';return db['UserProfileResource'][_0x6116('0x25')]({'where':{'type':_0x533b81,'resourceId':_0x17cd25['id']}})[_0x6116('0x26')](function(){return _0x2065fb;});})['then'](function(){_0x5428d4[_0x6116('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x571ddb,_0x57b79d){return function(_0xd2516a){if(!_0xd2516a){_0x571ddb[_0x6116('0x1a')](0x194);}return _0xd2516a;};}function handleError(_0x5e2607,_0x3e6c3c){_0x3e6c3c=_0x3e6c3c||0x1f4;return function(_0x310deb){logger[_0x6116('0x27')](_0x310deb[_0x6116('0x28')]);if(_0x310deb[_0x6116('0x29')]){delete _0x310deb['name'];}_0x5e2607['status'](_0x3e6c3c)[_0x6116('0x2a')](_0x310deb);};}exports[_0x6116('0x2b')]=function(_0x47c091,_0x4dd740){var _0x4fe209={},_0x5eb571={},_0x3269c1={'count':0x0,'rows':[]};var _0x3c0986=db[_0x6116('0x2c')]['rawAttributes'];_0x5eb571[_0x6116('0x2d')]=_['keys'](_0x3c0986);_0x5eb571[_0x6116('0x2e')]=_[_0x6116('0x2f')](_0x47c091['query']);_0x5eb571[_0x6116('0x30')]=_[_0x6116('0x31')](_0x5eb571[_0x6116('0x2d')],_0x5eb571[_0x6116('0x2e')]);_0x4fe209['attributes']=_[_0x6116('0x31')](_0x5eb571['model'],qs['fields'](_0x47c091[_0x6116('0x2e')]['fields']));_0x4fe209[_0x6116('0x32')]=_0x4fe209['attributes']['length']?_0x4fe209[_0x6116('0x32')]:_0x5eb571['model'];if(!_0x47c091['query']['hasOwnProperty'](_0x6116('0x33'))){_0x4fe209[_0x6116('0x1f')]=qs['limit'](_0x47c091[_0x6116('0x2e')][_0x6116('0x1f')]);_0x4fe209['offset']=qs[_0x6116('0x1e')](_0x47c091['query'][_0x6116('0x1e')]);}_0x4fe209['order']=qs['sort'](_0x47c091['query'][_0x6116('0x34')]);_0x4fe209[_0x6116('0x35')]=qs[_0x6116('0x30')](_[_0x6116('0x36')](_0x47c091[_0x6116('0x2e')],_0x5eb571['filters']));if(_0x47c091[_0x6116('0x2e')][_0x6116('0x37')]){_0x4fe209[_0x6116('0x35')]=_['merge'](_0x4fe209[_0x6116('0x35')],{'$or':_[_0x6116('0x38')](_0x3c0986,function(_0x5aabf6){if(_0x5aabf6[_0x6116('0x39')][_0x6116('0x3a')]!==_0x6116('0x3b')){var _0x490f33={};_0x490f33[_0x5aabf6[_0x6116('0x3c')]]={'$like':'%'+_0x47c091[_0x6116('0x2e')][_0x6116('0x37')]+'%'};return _0x490f33;}})});}_0x4fe209=_[_0x6116('0x3d')]({},_0x4fe209,_0x47c091[_0x6116('0x3e')]);var _0x1169a2={'where':_0x4fe209[_0x6116('0x35')]};return db[_0x6116('0x2c')]['count'](_0x1169a2)[_0x6116('0x26')](function(_0x3916f7){_0x3269c1[_0x6116('0x3f')]=_0x3916f7;if(_0x47c091[_0x6116('0x2e')][_0x6116('0x40')]){_0x4fe209[_0x6116('0x41')]=[{'all':!![]}];}return db[_0x6116('0x2c')][_0x6116('0x42')](_0x4fe209);})[_0x6116('0x26')](function(_0x5b588a){_0x3269c1['rows']=_0x5b588a;return _0x3269c1;})[_0x6116('0x26')](respondWithFilteredResult(_0x4dd740,_0x4fe209))[_0x6116('0x43')](handleError(_0x4dd740,null));};exports['show']=function(_0xcb7d16,_0x3d2fc4){var _0x4050f7={'raw':![],'where':{'id':_0xcb7d16[_0x6116('0x44')]['id']}},_0x4daa71={};_0x4daa71[_0x6116('0x2d')]=_[_0x6116('0x2f')](db[_0x6116('0x2c')][_0x6116('0x45')]);_0x4daa71['query']=_[_0x6116('0x2f')](_0xcb7d16[_0x6116('0x2e')]);_0x4daa71['filters']=_[_0x6116('0x31')](_0x4daa71[_0x6116('0x2d')],_0x4daa71[_0x6116('0x2e')]);_0x4050f7[_0x6116('0x32')]=_['intersection'](_0x4daa71[_0x6116('0x2d')],qs['fields'](_0xcb7d16[_0x6116('0x2e')]['fields']));_0x4050f7[_0x6116('0x32')]=_0x4050f7[_0x6116('0x32')][_0x6116('0x46')]?_0x4050f7['attributes']:_0x4daa71[_0x6116('0x2d')];if(_0xcb7d16[_0x6116('0x2e')]['includeAll']){_0x4050f7[_0x6116('0x41')]=[{'all':!![]}];}_0x4050f7=_['merge']({},_0x4050f7,_0xcb7d16[_0x6116('0x3e')]);return db[_0x6116('0x2c')][_0x6116('0x47')](_0x4050f7)[_0x6116('0x26')](handleEntityNotFound(_0x3d2fc4,null))[_0x6116('0x26')](respondWithResult(_0x3d2fc4,null))[_0x6116('0x43')](handleError(_0x3d2fc4,null));};exports[_0x6116('0x48')]=function(_0x94a89f,_0x4b5d78){return db[_0x6116('0x2c')][_0x6116('0x48')](_0x94a89f[_0x6116('0x49')],{})[_0x6116('0x26')](function(_0xd76696){var _0x25b80b=_0x94a89f[_0x6116('0x4a')][_0x6116('0x24')]({'plain':!![]});if(!_0x25b80b)throw new Error(_0x6116('0x4b'));if(_0x25b80b['role']==='user'){var _0x7d8191=_0xd76696[_0x6116('0x24')]({'plain':!![]});var _0x104138=_0x6116('0x4c');return db[_0x6116('0x4d')][_0x6116('0x47')]({'where':{'name':_0x104138,'userProfileId':_0x25b80b[_0x6116('0x4e')]},'raw':!![]})[_0x6116('0x26')](function(_0x4db355){if(_0x4db355&&_0x4db355[_0x6116('0x4f')]===0x0){return db['UserProfileResource'][_0x6116('0x48')]({'name':_0x7d8191['name'],'resourceId':_0x7d8191['id'],'type':_0x4db355['name'],'sectionId':_0x4db355['id']},{})['then'](function(){return _0xd76696;});}else{return _0xd76696;}})[_0x6116('0x43')](function(_0x598fac){logger['error'](_0x6116('0x50'),_0x598fac);throw _0x598fac;});}return _0xd76696;})[_0x6116('0x26')](respondWithResult(_0x4b5d78,0xc9))[_0x6116('0x43')](handleError(_0x4b5d78,null));};exports[_0x6116('0x23')]=function(_0xbb6de0,_0x4751a9){if(_0xbb6de0[_0x6116('0x49')]['id']){delete _0xbb6de0[_0x6116('0x49')]['id'];}return db[_0x6116('0x2c')]['find']({'where':{'id':_0xbb6de0['params']['id']}})[_0x6116('0x26')](handleEntityNotFound(_0x4751a9,null))[_0x6116('0x26')](saveUpdates(_0xbb6de0[_0x6116('0x49')],null))[_0x6116('0x26')](respondWithResult(_0x4751a9,null))[_0x6116('0x43')](handleError(_0x4751a9,null));};exports[_0x6116('0x25')]=function(_0x3485e1,_0x5114a1){return db[_0x6116('0x2c')][_0x6116('0x47')]({'where':{'id':_0x3485e1['params']['id']}})[_0x6116('0x26')](handleEntityNotFound(_0x5114a1,null))[_0x6116('0x26')](removeEntity(_0x5114a1,null))['catch'](handleError(_0x5114a1,null));};exports[_0x6116('0x51')]=function(_0x3ce970,_0x4c4acd,_0x176e0a){return db[_0x6116('0x52')][_0x6116('0x47')]({'where':{'id':_0x3ce970[_0x6116('0x44')]['id']}})[_0x6116('0x26')](handleEntityNotFound(_0x4c4acd,null))[_0x6116('0x26')](function(_0x4563a2){if(_0x4563a2){return _0x4563a2['addContacts'](_0x3ce970[_0x6116('0x49')][_0x6116('0x53')],_[_0x6116('0x54')](_0x3ce970[_0x6116('0x49')],[_0x6116('0x53'),'id'])||{});}})[_0x6116('0x26')](respondWithResult(_0x4c4acd,null))['catch'](handleError(_0x4c4acd,null));};exports[_0x6116('0x55')]=function(_0x55a506,_0x58f7bd,_0x2b9f80){var _0x3e8b01={};var _0x145a0c={};var _0x33888c;var _0xab1283;return db['CmCompany'][_0x6116('0x56')]({'where':{'id':_0x55a506[_0x6116('0x44')]['id']}})[_0x6116('0x26')](handleEntityNotFound(_0x58f7bd,null))[_0x6116('0x26')](function(_0x35ee2b){if(_0x35ee2b){_0x33888c=_0x35ee2b;_0x145a0c[_0x6116('0x2d')]=_[_0x6116('0x2f')](db[_0x6116('0x52')][_0x6116('0x45')]);_0x145a0c[_0x6116('0x2e')]=_['keys'](_0x55a506[_0x6116('0x2e')]);_0x145a0c[_0x6116('0x30')]=_[_0x6116('0x31')](_0x145a0c['model'],_0x145a0c[_0x6116('0x2e')]);_0x3e8b01[_0x6116('0x32')]=_[_0x6116('0x31')](_0x145a0c[_0x6116('0x2d')],qs[_0x6116('0x57')](_0x55a506[_0x6116('0x2e')]['fields']));_0x3e8b01['attributes']=_0x3e8b01['attributes'][_0x6116('0x46')]?_0x3e8b01[_0x6116('0x32')]:_0x145a0c[_0x6116('0x2d')];_0x3e8b01[_0x6116('0x58')]=qs[_0x6116('0x34')](_0x55a506['query'][_0x6116('0x34')]);_0x3e8b01[_0x6116('0x35')]=qs[_0x6116('0x30')](_[_0x6116('0x36')](_0x55a506[_0x6116('0x2e')],_0x145a0c['filters']));if(_0x55a506[_0x6116('0x2e')][_0x6116('0x37')]){_0x3e8b01[_0x6116('0x35')]=_[_0x6116('0x3d')](_0x3e8b01['where'],{'$or':_[_0x6116('0x38')](_0x3e8b01[_0x6116('0x32')],function(_0x28f97d){var _0x2408c8={};_0x2408c8[_0x28f97d]={'$like':'%'+_0x55a506[_0x6116('0x2e')][_0x6116('0x37')]+'%'};return _0x2408c8;})});}_0x3e8b01=_[_0x6116('0x3d')]({},_0x3e8b01,_0x55a506[_0x6116('0x3e')]);return _0x33888c['getContacts'](_0x3e8b01);}})[_0x6116('0x26')](function(_0x463733){if(_0x463733){_0xab1283=_0x463733['length'];if(!_0x55a506[_0x6116('0x2e')][_0x6116('0x59')]('nolimit')){_0x3e8b01[_0x6116('0x1f')]=qs['limit'](_0x55a506[_0x6116('0x2e')][_0x6116('0x1f')]);_0x3e8b01[_0x6116('0x1e')]=qs[_0x6116('0x1e')](_0x55a506[_0x6116('0x2e')][_0x6116('0x1e')]);}return _0x33888c[_0x6116('0x55')](_0x3e8b01);}})[_0x6116('0x26')](function(_0x4f2982){if(_0x4f2982){return _0x4f2982?{'count':_0xab1283,'rows':_0x4f2982}:null;}})['then'](respondWithResult(_0x58f7bd,null))[_0x6116('0x43')](handleError(_0x58f7bd,null));}; \ No newline at end of file +var _0x55c4=['CmCompany','findAll','rows','catch','show','model','rawAttributes','includeAll','include','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','body','params','addContacts','ids','getContacts','findOne','CmContact','nolimit','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','count','offset','limit','Content-Range','json','apply','reject','save','then','destroy','Companies','UserProfileResource','status','error','stack','name','send','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','key','VIRTUAL','field'];(function(_0x5d1718,_0x3c0926){var _0x1cd8ff=function(_0xd52d24){while(--_0xd52d24){_0x5d1718['push'](_0x5d1718['shift']());}};_0x1cd8ff(++_0x3c0926);}(_0x55c4,0x17b));var _0x455c=function(_0xc3258d,_0x58a53b){_0xc3258d=_0xc3258d-0x0;var _0x5a538c=_0x55c4[_0xc3258d];return _0x5a538c;};'use strict';var pdf=require(_0x455c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x455c('0x1'));var zipdir=require(_0x455c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x455c('0x3'));var moment=require(_0x455c('0x4'));var BPromise=require(_0x455c('0x5'));var Mustache=require('mustache');var util=require(_0x455c('0x6'));var path=require(_0x455c('0x7'));var sox=require(_0x455c('0x8'));var csv=require(_0x455c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x455c('0xa'));var squel=require(_0x455c('0xb'));var crypto=require(_0x455c('0xc'));var jsforce=require(_0x455c('0xd'));var deskjs=require(_0x455c('0xe'));var toCsv=require(_0x455c('0x9'));var querystring=require(_0x455c('0xf'));var Papa=require('papaparse');var authService=require(_0x455c('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x455c('0x11'));var qs=require(_0x455c('0x12'));var logger=require(_0x455c('0x13'))(_0x455c('0x14'));var utils=require(_0x455c('0x15'));var config=require(_0x455c('0x16'));var db=require(_0x455c('0x17'))['db'];function respondWithStatusCode(_0x5e8a55,_0x5f00b0){_0x5f00b0=_0x5f00b0||0xcc;return function(_0x23ed5f){if(_0x23ed5f){return _0x5e8a55[_0x455c('0x18')](_0x5f00b0);}return _0x5e8a55['status'](_0x5f00b0)[_0x455c('0x19')]();};}function respondWithResult(_0x50a4d7,_0x443a03){_0x443a03=_0x443a03||0xc8;return function(_0x494462){if(_0x494462){return _0x50a4d7['status'](_0x443a03)['json'](_0x494462);}};}function respondWithFilteredResult(_0x3df804,_0x3c757e){return function(_0x55e4ae){if(_0x55e4ae){var _0x1e3fd5=_0x55e4ae[_0x455c('0x1a')],_0x408a32=_0x3c757e[_0x455c('0x1b')],_0x56adac=_0x3c757e[_0x455c('0x1b')]+_0x3c757e[_0x455c('0x1c')],_0x470acc;if(_0x56adac>=_0x1e3fd5){_0x56adac=_0x1e3fd5;_0x470acc=0xc8;}else{_0x470acc=0xce;}_0x3df804['status'](_0x470acc);return _0x3df804['set'](_0x455c('0x1d'),_0x408a32+'-'+_0x56adac+'/'+_0x1e3fd5)[_0x455c('0x1e')](_0x55e4ae);}return null;};}function patchUpdates(_0x5857f7){return function(_0x546a43){try{jsonpatch[_0x455c('0x1f')](_0x546a43,_0x5857f7,!![]);}catch(_0x4a0001){return BPromise[_0x455c('0x20')](_0x4a0001);}return _0x546a43[_0x455c('0x21')]();};}function saveUpdates(_0x2ab486,_0x579663){return function(_0x27a0e9){if(_0x27a0e9){return _0x27a0e9['update'](_0x2ab486)[_0x455c('0x22')](function(_0x26a43e){return _0x26a43e;});}return null;};}function removeEntity(_0x230e74,_0x13e60d){return function(_0x1a7373){if(_0x1a7373){return _0x1a7373[_0x455c('0x23')]()[_0x455c('0x22')](function(){var _0x250099=_0x1a7373['get']({'plain':!![]});var _0x6bc602=_0x455c('0x24');return db[_0x455c('0x25')][_0x455c('0x23')]({'where':{'type':_0x6bc602,'resourceId':_0x250099['id']}})[_0x455c('0x22')](function(){return _0x1a7373;});})[_0x455c('0x22')](function(){_0x230e74[_0x455c('0x26')](0xcc)[_0x455c('0x19')]();});}};}function handleEntityNotFound(_0x1cca57,_0x316704){return function(_0x16d0f3){if(!_0x16d0f3){_0x1cca57[_0x455c('0x18')](0x194);}return _0x16d0f3;};}function handleError(_0xd67539,_0x1344ae){_0x1344ae=_0x1344ae||0x1f4;return function(_0x5b7269){logger[_0x455c('0x27')](_0x5b7269[_0x455c('0x28')]);if(_0x5b7269[_0x455c('0x29')]){delete _0x5b7269[_0x455c('0x29')];}_0xd67539[_0x455c('0x26')](_0x1344ae)[_0x455c('0x2a')](_0x5b7269);};}exports['index']=function(_0x4f3621,_0x7146f5){var _0x466c4c={},_0x57ec27={},_0x43abbe={'count':0x0,'rows':[]};var _0x5e8f2f=db['CmCompany']['rawAttributes'];_0x57ec27['model']=_[_0x455c('0x2b')](_0x5e8f2f);_0x57ec27[_0x455c('0x2c')]=_[_0x455c('0x2b')](_0x4f3621[_0x455c('0x2c')]);_0x57ec27[_0x455c('0x2d')]=_['intersection'](_0x57ec27['model'],_0x57ec27[_0x455c('0x2c')]);_0x466c4c[_0x455c('0x2e')]=_[_0x455c('0x2f')](_0x57ec27['model'],qs[_0x455c('0x30')](_0x4f3621[_0x455c('0x2c')][_0x455c('0x30')]));_0x466c4c[_0x455c('0x2e')]=_0x466c4c[_0x455c('0x2e')][_0x455c('0x31')]?_0x466c4c[_0x455c('0x2e')]:_0x57ec27['model'];if(!_0x4f3621[_0x455c('0x2c')][_0x455c('0x32')]('nolimit')){_0x466c4c['limit']=qs[_0x455c('0x1c')](_0x4f3621[_0x455c('0x2c')][_0x455c('0x1c')]);_0x466c4c[_0x455c('0x1b')]=qs[_0x455c('0x1b')](_0x4f3621['query']['offset']);}_0x466c4c[_0x455c('0x33')]=qs[_0x455c('0x34')](_0x4f3621[_0x455c('0x2c')]['sort']);_0x466c4c[_0x455c('0x35')]=qs[_0x455c('0x2d')](_[_0x455c('0x36')](_0x4f3621[_0x455c('0x2c')],_0x57ec27[_0x455c('0x2d')]));if(_0x4f3621[_0x455c('0x2c')][_0x455c('0x37')]){_0x466c4c['where']=_[_0x455c('0x38')](_0x466c4c[_0x455c('0x35')],{'$or':_[_0x455c('0x39')](_0x5e8f2f,function(_0x277dff){if(_0x277dff['type'][_0x455c('0x3a')]!==_0x455c('0x3b')){var _0x301b2b={};_0x301b2b[_0x277dff[_0x455c('0x3c')]]={'$like':'%'+_0x4f3621[_0x455c('0x2c')][_0x455c('0x37')]+'%'};return _0x301b2b;}})});}_0x466c4c=_[_0x455c('0x38')]({},_0x466c4c,_0x4f3621['options']);var _0x2deb23={'where':_0x466c4c['where']};return db[_0x455c('0x3d')][_0x455c('0x1a')](_0x2deb23)[_0x455c('0x22')](function(_0x33da66){_0x43abbe['count']=_0x33da66;if(_0x4f3621[_0x455c('0x2c')]['includeAll']){_0x466c4c['include']=[{'all':!![]}];}return db[_0x455c('0x3d')][_0x455c('0x3e')](_0x466c4c);})[_0x455c('0x22')](function(_0x2051ae){_0x43abbe[_0x455c('0x3f')]=_0x2051ae;return _0x43abbe;})[_0x455c('0x22')](respondWithFilteredResult(_0x7146f5,_0x466c4c))[_0x455c('0x40')](handleError(_0x7146f5,null));};exports[_0x455c('0x41')]=function(_0x4276e6,_0x111e22){var _0x5e990d={'raw':![],'where':{'id':_0x4276e6['params']['id']}},_0x493df7={};_0x493df7[_0x455c('0x42')]=_[_0x455c('0x2b')](db['CmCompany'][_0x455c('0x43')]);_0x493df7[_0x455c('0x2c')]=_[_0x455c('0x2b')](_0x4276e6[_0x455c('0x2c')]);_0x493df7[_0x455c('0x2d')]=_[_0x455c('0x2f')](_0x493df7[_0x455c('0x42')],_0x493df7[_0x455c('0x2c')]);_0x5e990d[_0x455c('0x2e')]=_[_0x455c('0x2f')](_0x493df7[_0x455c('0x42')],qs['fields'](_0x4276e6[_0x455c('0x2c')]['fields']));_0x5e990d[_0x455c('0x2e')]=_0x5e990d[_0x455c('0x2e')][_0x455c('0x31')]?_0x5e990d[_0x455c('0x2e')]:_0x493df7[_0x455c('0x42')];if(_0x4276e6[_0x455c('0x2c')][_0x455c('0x44')]){_0x5e990d[_0x455c('0x45')]=[{'all':!![]}];}_0x5e990d=_[_0x455c('0x38')]({},_0x5e990d,_0x4276e6[_0x455c('0x46')]);return db[_0x455c('0x3d')][_0x455c('0x47')](_0x5e990d)['then'](handleEntityNotFound(_0x111e22,null))['then'](respondWithResult(_0x111e22,null))[_0x455c('0x40')](handleError(_0x111e22,null));};exports[_0x455c('0x48')]=function(_0x3c7bff,_0x56222a){return db['CmCompany'][_0x455c('0x48')](_0x3c7bff['body'],{})[_0x455c('0x22')](function(_0x4ebece){var _0x37ab2a=_0x3c7bff[_0x455c('0x49')][_0x455c('0x4a')]({'plain':!![]});if(!_0x37ab2a)throw new Error(_0x455c('0x4b'));if(_0x37ab2a['role']===_0x455c('0x49')){var _0x31a293=_0x4ebece['get']({'plain':!![]});var _0x11085c='Companies';return db[_0x455c('0x4c')]['find']({'where':{'name':_0x11085c,'userProfileId':_0x37ab2a[_0x455c('0x4d')]},'raw':!![]})[_0x455c('0x22')](function(_0x278bdf){if(_0x278bdf&&_0x278bdf[_0x455c('0x4e')]===0x0){return db[_0x455c('0x25')][_0x455c('0x48')]({'name':_0x31a293[_0x455c('0x29')],'resourceId':_0x31a293['id'],'type':_0x278bdf[_0x455c('0x29')],'sectionId':_0x278bdf['id']},{})[_0x455c('0x22')](function(){return _0x4ebece;});}else{return _0x4ebece;}})['catch'](function(_0xc8b8af){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc8b8af);throw _0xc8b8af;});}return _0x4ebece;})[_0x455c('0x22')](respondWithResult(_0x56222a,0xc9))[_0x455c('0x40')](handleError(_0x56222a,null));};exports[_0x455c('0x4f')]=function(_0x4aadd4,_0x6b6d30){if(_0x4aadd4[_0x455c('0x50')]['id']){delete _0x4aadd4[_0x455c('0x50')]['id'];}return db[_0x455c('0x3d')]['find']({'where':{'id':_0x4aadd4[_0x455c('0x51')]['id']}})[_0x455c('0x22')](handleEntityNotFound(_0x6b6d30,null))[_0x455c('0x22')](saveUpdates(_0x4aadd4[_0x455c('0x50')],null))[_0x455c('0x22')](respondWithResult(_0x6b6d30,null))[_0x455c('0x40')](handleError(_0x6b6d30,null));};exports[_0x455c('0x23')]=function(_0x511e16,_0x1d177a){return db[_0x455c('0x3d')]['find']({'where':{'id':_0x511e16[_0x455c('0x51')]['id']}})[_0x455c('0x22')](handleEntityNotFound(_0x1d177a,null))[_0x455c('0x22')](removeEntity(_0x1d177a,null))['catch'](handleError(_0x1d177a,null));};exports[_0x455c('0x52')]=function(_0x3ce029,_0x3d439c,_0x21af6f){return db['CmContact'][_0x455c('0x47')]({'where':{'id':_0x3ce029['params']['id']}})[_0x455c('0x22')](handleEntityNotFound(_0x3d439c,null))[_0x455c('0x22')](function(_0x36ec8d){if(_0x36ec8d){return _0x36ec8d[_0x455c('0x52')](_0x3ce029[_0x455c('0x50')]['ids'],_['omit'](_0x3ce029[_0x455c('0x50')],[_0x455c('0x53'),'id'])||{});}})[_0x455c('0x22')](respondWithResult(_0x3d439c,null))[_0x455c('0x40')](handleError(_0x3d439c,null));};exports[_0x455c('0x54')]=function(_0x48175a,_0x4160c7,_0x55bd6c){var _0x352d7d={};var _0x3d4f61={};var _0x2aa915;var _0x56265c;return db[_0x455c('0x3d')][_0x455c('0x55')]({'where':{'id':_0x48175a['params']['id']}})[_0x455c('0x22')](handleEntityNotFound(_0x4160c7,null))[_0x455c('0x22')](function(_0x25293f){if(_0x25293f){_0x2aa915=_0x25293f;_0x3d4f61[_0x455c('0x42')]=_['keys'](db[_0x455c('0x56')]['rawAttributes']);_0x3d4f61[_0x455c('0x2c')]=_[_0x455c('0x2b')](_0x48175a[_0x455c('0x2c')]);_0x3d4f61[_0x455c('0x2d')]=_['intersection'](_0x3d4f61[_0x455c('0x42')],_0x3d4f61[_0x455c('0x2c')]);_0x352d7d['attributes']=_[_0x455c('0x2f')](_0x3d4f61[_0x455c('0x42')],qs[_0x455c('0x30')](_0x48175a[_0x455c('0x2c')][_0x455c('0x30')]));_0x352d7d[_0x455c('0x2e')]=_0x352d7d[_0x455c('0x2e')]['length']?_0x352d7d[_0x455c('0x2e')]:_0x3d4f61[_0x455c('0x42')];_0x352d7d[_0x455c('0x33')]=qs['sort'](_0x48175a[_0x455c('0x2c')]['sort']);_0x352d7d[_0x455c('0x35')]=qs[_0x455c('0x2d')](_[_0x455c('0x36')](_0x48175a[_0x455c('0x2c')],_0x3d4f61[_0x455c('0x2d')]));if(_0x48175a['query']['filter']){_0x352d7d[_0x455c('0x35')]=_[_0x455c('0x38')](_0x352d7d[_0x455c('0x35')],{'$or':_[_0x455c('0x39')](_0x352d7d[_0x455c('0x2e')],function(_0x14bcf5){var _0x92bb97={};_0x92bb97[_0x14bcf5]={'$like':'%'+_0x48175a[_0x455c('0x2c')][_0x455c('0x37')]+'%'};return _0x92bb97;})});}_0x352d7d=_[_0x455c('0x38')]({},_0x352d7d,_0x48175a['options']);return _0x2aa915[_0x455c('0x54')](_0x352d7d);}})[_0x455c('0x22')](function(_0x10d128){if(_0x10d128){_0x56265c=_0x10d128['length'];if(!_0x48175a[_0x455c('0x2c')][_0x455c('0x32')](_0x455c('0x57'))){_0x352d7d[_0x455c('0x1c')]=qs[_0x455c('0x1c')](_0x48175a[_0x455c('0x2c')][_0x455c('0x1c')]);_0x352d7d[_0x455c('0x1b')]=qs[_0x455c('0x1b')](_0x48175a[_0x455c('0x2c')][_0x455c('0x1b')]);}return _0x2aa915[_0x455c('0x54')](_0x352d7d);}})[_0x455c('0x22')](function(_0x32d157){if(_0x32d157){return _0x32d157?{'count':_0x56265c,'rows':_0x32d157}:null;}})['then'](respondWithResult(_0x4160c7,null))[_0x455c('0x40')](handleError(_0x4160c7,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index d5521cd..8c0240f 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','./cmCompany.attributes','exports','define','CmCompany','cm_companies','util'];(function(_0x49939b,_0x528667){var _0x2f0680=function(_0xb3d57e){while(--_0xb3d57e){_0x49939b['push'](_0x49939b['shift']());}};_0x2f0680(++_0x528667);}(_0xedd9,0xfc));var _0x9edd=function(_0x3631d5,_0xa09d1){_0x3631d5=_0x3631d5-0x0;var _0x2dd46b=_0xedd9[_0x3631d5];return _0x2dd46b;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var attributes=require(_0x9edd('0x6'));module[_0x9edd('0x7')]=function(_0x5943b3,_0x33679f){return _0x5943b3[_0x9edd('0x8')](_0x9edd('0x9'),attributes,{'tableName':_0x9edd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2b3=['define','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xb2b3,0x71));var _0x3b2b=function(_0x281a0c,_0x17b6ad){_0x281a0c=_0x281a0c-0x0;var _0x54e2cc=_0xb2b3[_0x281a0c];return _0x54e2cc;};'use strict';var _=require(_0x3b2b('0x0'));var util=require(_0x3b2b('0x1'));var logger=require(_0x3b2b('0x2'))(_0x3b2b('0x3'));var moment=require(_0x3b2b('0x4'));var BPromise=require(_0x3b2b('0x5'));var rp=require(_0x3b2b('0x6'));var attributes=require('./cmCompany.attributes');module[_0x3b2b('0x7')]=function(_0x222c10,_0x2343de){return _0x222c10[_0x3b2b('0x8')](_0x3b2b('0x9'),attributes,{'tableName':_0x3b2b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index c7731f9..1459b98 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 _0x7599=['CmCompany,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent'];(function(_0x333587,_0x284f3d){var _0x2f73b3=function(_0x563074){while(--_0x563074){_0x333587['push'](_0x333587['shift']());}};_0x2f73b3(++_0x284f3d);}(_0x7599,0x13a));var _0x9759=function(_0x15660b,_0x3b7f69){_0x15660b=_0x15660b-0x0;var _0x2c74ff=_0x7599[_0x15660b];return _0x2c74ff;};'use strict';var _=require(_0x9759('0x0'));var util=require(_0x9759('0x1'));var moment=require(_0x9759('0x2'));var BPromise=require('bluebird');var rs=require(_0x9759('0x3'));var fs=require('fs');var Redis=require(_0x9759('0x4'));var db=require(_0x9759('0x5'))['db'];var utils=require(_0x9759('0x6'));var logger=require(_0x9759('0x7'))(_0x9759('0x8'));var config=require(_0x9759('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9759('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c9985,_0x16f19d,_0x4f3177){return new BPromise(function(_0x4356b5,_0x40d025){return client[_0x9759('0xb')](_0x1c9985,_0x4f3177)[_0x9759('0xc')](function(_0x126a14){logger[_0x9759('0xd')](_0x9759('0xe'),_0x16f19d,_0x9759('0xf'));logger['debug'](_0x9759('0x10'),_0x16f19d,'request\x20sent',JSON[_0x9759('0x11')](_0x126a14));if(_0x126a14['error']){if(_0x126a14['error'][_0x9759('0x12')]===0x1f4){logger[_0x9759('0x13')](_0x9759('0xe'),_0x16f19d,_0x126a14[_0x9759('0x13')]['message']);return _0x40d025(_0x126a14[_0x9759('0x13')][_0x9759('0x14')]);}logger[_0x9759('0x13')]('CmCompany,\x20%s,\x20%s',_0x16f19d,_0x126a14[_0x9759('0x13')][_0x9759('0x14')]);return _0x4356b5(_0x126a14['error'][_0x9759('0x14')]);}else{logger[_0x9759('0xd')](_0x9759('0xe'),_0x16f19d,'request\x20sent');_0x4356b5(_0x126a14['result'][_0x9759('0x14')]);}})[_0x9759('0x15')](function(_0xc58779){logger[_0x9759('0x13')](_0x9759('0xe'),_0x16f19d,_0xc58779);_0x40d025(_0xc58779);});});} \ No newline at end of file +var _0xb598=['CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x407754,_0x3b5d0f){var _0x2a5903=function(_0x348312){while(--_0x348312){_0x407754['push'](_0x407754['shift']());}};_0x2a5903(++_0x3b5d0f);}(_0xb598,0x11e));var _0x8b59=function(_0x443dbc,_0x406fd3){_0x443dbc=_0x443dbc-0x0;var _0x381549=_0xb598[_0x443dbc];return _0x381549;};'use strict';var _=require(_0x8b59('0x0'));var util=require('util');var moment=require(_0x8b59('0x1'));var BPromise=require(_0x8b59('0x2'));var rs=require(_0x8b59('0x3'));var fs=require('fs');var Redis=require(_0x8b59('0x4'));var db=require(_0x8b59('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b59('0x6'))('rpc');var config=require(_0x8b59('0x7'));var jayson=require(_0x8b59('0x8'));var client=jayson[_0x8b59('0x9')][_0x8b59('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcb6c59,_0x2fae11,_0x5264bf){return new BPromise(function(_0x2ecb7b,_0x148023){return client['request'](_0xcb6c59,_0x5264bf)[_0x8b59('0xb')](function(_0x2793ad){logger[_0x8b59('0xc')](_0x8b59('0xd'),_0x2fae11,_0x8b59('0xe'));logger[_0x8b59('0xf')](_0x8b59('0x10'),_0x2fae11,_0x8b59('0xe'),JSON[_0x8b59('0x11')](_0x2793ad));if(_0x2793ad[_0x8b59('0x12')]){if(_0x2793ad[_0x8b59('0x12')][_0x8b59('0x13')]===0x1f4){logger[_0x8b59('0x12')]('CmCompany,\x20%s,\x20%s',_0x2fae11,_0x2793ad[_0x8b59('0x12')][_0x8b59('0x14')]);return _0x148023(_0x2793ad[_0x8b59('0x12')][_0x8b59('0x14')]);}logger[_0x8b59('0x12')](_0x8b59('0xd'),_0x2fae11,_0x2793ad[_0x8b59('0x12')][_0x8b59('0x14')]);return _0x2ecb7b(_0x2793ad[_0x8b59('0x12')][_0x8b59('0x14')]);}else{logger['info'](_0x8b59('0xd'),_0x2fae11,'request\x20sent');_0x2ecb7b(_0x2793ad[_0x8b59('0x15')]['message']);}})[_0x8b59('0x16')](function(_0x4feaaa){logger[_0x8b59('0x12')](_0x8b59('0xd'),_0x2fae11,_0x4feaaa);_0x148023(_0x4feaaa);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index ca69807..7e74a65 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 _0x65d4=['get','index','/:id','isAuthenticated','/:id/contacts','create','addContacts','put','destroy','exports','multer','path','connect-timeout','express','Router','./cmCompany.controller'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x65d4,0x11a));var _0x465d=function(_0x37a62b,_0x445eac){_0x37a62b=_0x37a62b-0x0;var _0x2aa542=_0x65d4[_0x37a62b];return _0x2aa542;};'use strict';var multer=require(_0x465d('0x0'));var util=require('util');var path=require(_0x465d('0x1'));var timeout=require(_0x465d('0x2'));var express=require(_0x465d('0x3'));var router=express[_0x465d('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x465d('0x5'));router[_0x465d('0x6')]('/',auth['isAuthenticated'](),controller[_0x465d('0x7')]);router[_0x465d('0x6')](_0x465d('0x8'),auth[_0x465d('0x9')](),controller['show']);router['get'](_0x465d('0xa'),auth[_0x465d('0x9')](),controller['getContacts']);router['post']('/',auth[_0x465d('0x9')](),controller[_0x465d('0xb')]);router['post'](_0x465d('0xa'),auth[_0x465d('0x9')](),controller[_0x465d('0xc')]);router[_0x465d('0xd')](_0x465d('0x8'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x465d('0x8'),auth[_0x465d('0x9')](),controller[_0x465d('0xe')]);module[_0x465d('0xf')]=router; \ No newline at end of file +var _0x9910=['express','Router','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/:id','show','getContacts','post','create','/:id/contacts','put','update','destroy','exports','multer','util'];(function(_0x2ae0d5,_0x5937c3){var _0x461f03=function(_0x167609){while(--_0x167609){_0x2ae0d5['push'](_0x2ae0d5['shift']());}};_0x461f03(++_0x5937c3);}(_0x9910,0x1b6));var _0x0991=function(_0x211ead,_0x1963fa){_0x211ead=_0x211ead-0x0;var _0x21a596=_0x9910[_0x211ead];return _0x21a596;};'use strict';var multer=require(_0x0991('0x0'));var util=require(_0x0991('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0991('0x2'));var router=express[_0x0991('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0991('0x4'));var config=require(_0x0991('0x5'));var controller=require(_0x0991('0x6'));router[_0x0991('0x7')]('/',auth[_0x0991('0x8')](),controller[_0x0991('0x9')]);router['get'](_0x0991('0xa'),auth[_0x0991('0x8')](),controller[_0x0991('0xb')]);router[_0x0991('0x7')]('/:id/contacts',auth[_0x0991('0x8')](),controller[_0x0991('0xc')]);router[_0x0991('0xd')]('/',auth[_0x0991('0x8')](),controller[_0x0991('0xe')]);router[_0x0991('0xd')](_0x0991('0xf'),auth[_0x0991('0x8')](),controller['addContacts']);router[_0x0991('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x0991('0x11')]);router['delete'](_0x0991('0xa'),auth[_0x0991('0x8')](),controller[_0x0991('0x12')]);module[_0x0991('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index e398dfa..bdee17b 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 _0x2066=['STRING','TEXT','INTEGER','DATE','lodash','sequelize','exports'];(function(_0x4cecf1,_0x32dbdc){var _0x2c6e09=function(_0x80aa2d){while(--_0x80aa2d){_0x4cecf1['push'](_0x4cecf1['shift']());}};_0x2c6e09(++_0x32dbdc);}(_0x2066,0x10e));var _0x6206=function(_0x2e9dfd,_0x2908eb){_0x2e9dfd=_0x2e9dfd-0x0;var _0x479208=_0x2066[_0x2e9dfd];return _0x479208;};'use strict';var _=require(_0x6206('0x0'));var Sequelize=require(_0x6206('0x1'));module[_0x6206('0x2')]={'firstName':{'type':Sequelize[_0x6206('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x6206('0x3')]},'street':{'type':Sequelize[_0x6206('0x3')]},'postalCode':{'type':Sequelize[_0x6206('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x6206('0x3')]},'dateOfBirth':{'type':Sequelize[_0x6206('0x3')]},'description':{'type':Sequelize[_0x6206('0x4')]},'phone':{'type':Sequelize[_0x6206('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x6206('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x6206('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x6206('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x6206('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x6206('0x3')]},'UserId':{'type':Sequelize[_0x6206('0x5')]},'priority':{'type':Sequelize[_0x6206('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x6206('0x6')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x3d89=['sequelize','STRING','TEXT','INTEGER','UNSIGNED','NOW','lodash'];(function(_0x49b58d,_0x3fc231){var _0x43a185=function(_0x559fbc){while(--_0x559fbc){_0x49b58d['push'](_0x49b58d['shift']());}};_0x43a185(++_0x3fc231);}(_0x3d89,0x1b1));var _0x93d8=function(_0x45c203,_0x2c3ae7){_0x45c203=_0x45c203-0x0;var _0x226826=_0x3d89[_0x45c203];return _0x226826;};'use strict';var _=require(_0x93d8('0x0'));var Sequelize=require(_0x93d8('0x1'));module['exports']={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x93d8('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x93d8('0x2')]},'description':{'type':Sequelize[_0x93d8('0x3')]},'phone':{'type':Sequelize[_0x93d8('0x2')]},'mobile':{'type':Sequelize[_0x93d8('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x93d8('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x93d8('0x2')]},'twitter':{'type':Sequelize[_0x93d8('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x93d8('0x2')]},'line':{'type':Sequelize[_0x93d8('0x2')]},'wechat':{'type':Sequelize[_0x93d8('0x2')]},'telegram':{'type':Sequelize[_0x93d8('0x2')]},'UserId':{'type':Sequelize[_0x93d8('0x4')]},'priority':{'type':Sequelize[_0x93d8('0x4')](0x2)[_0x93d8('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x93d8('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 2bc85a2..2fe9402 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 _0xfd0b=['No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','0777','child_process','fork','pid','upload','createReadStream','parse','meta','import','agent','binding','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmContact.socket','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','CmContact','describe','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','map','merge','options','include','push','Tags','tag','distinct','includeAll','Tag','ThroughTags','color','findAll','rows','find','params','catch','cf_','columnName','displayName','CmCustomField','alias','body','get','mergeWith','isArray','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','from','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','create','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','bulkCreate','duplicates','$or','ListId','findOrCreate','spread','show','$and','omit','format','pickBy','startsWith','cf_%d','isEmpty','table','cm_contacts','id\x20=\x20?','toParam','sequelize','text','values','phone','getTags','findOne','rawAttributes','setTags','ids','getHoppers','ContactId','getHopperHistories','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified'];(function(_0x4e93fa,_0x363189){var _0x36a09f=function(_0x4524a9){while(--_0x4524a9){_0x4e93fa['push'](_0x4e93fa['shift']());}};_0x36a09f(++_0x363189);}(_0xfd0b,0xcd));var _0xbfd0=function(_0xdfa16e,_0x2290cd){_0xdfa16e=_0xdfa16e-0x0;var _0x7d9d9e=_0xfd0b[_0xdfa16e];return _0x7d9d9e;};'use strict';var pdf=require(_0xbfd0('0x0'));var emlformat=require(_0xbfd0('0x1'));var rimraf=require(_0xbfd0('0x2'));var zipdir=require(_0xbfd0('0x3'));var jsonpatch=require(_0xbfd0('0x4'));var rp=require('request-promise');var moment=require(_0xbfd0('0x5'));var BPromise=require(_0xbfd0('0x6'));var Mustache=require(_0xbfd0('0x7'));var util=require('util');var path=require(_0xbfd0('0x8'));var sox=require('sox');var csv=require(_0xbfd0('0x9'));var ejs=require(_0xbfd0('0xa'));var fs=require('fs');var _=require(_0xbfd0('0xb'));var squel=require(_0xbfd0('0xc'));var crypto=require('crypto');var jsforce=require(_0xbfd0('0xd'));var deskjs=require(_0xbfd0('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbfd0('0xf'));var Papa=require(_0xbfd0('0x10'));var authService=require(_0xbfd0('0x11'));var hardwareService=require(_0xbfd0('0x12'));var Redis=require(_0xbfd0('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0xbfd0('0x14'))(_0xbfd0('0x15'));var utils=require(_0xbfd0('0x16'));var config=require(_0xbfd0('0x17'));var db=require(_0xbfd0('0x18'))['db'];config['redis']=_[_0xbfd0('0x19')](config[_0xbfd0('0x1a')],{'host':_0xbfd0('0x1b'),'port':0x18eb});var socket=require(_0xbfd0('0x1c'))(new Redis(config[_0xbfd0('0x1a')]));require(_0xbfd0('0x1d'))['register'](socket);function respondWithStatusCode(_0x40ec32,_0x180514){_0x180514=_0x180514||0xcc;return function(_0x5b48bc){if(_0x5b48bc){return _0x40ec32['sendStatus'](_0x180514);}return _0x40ec32[_0xbfd0('0x1e')](_0x180514)['end']();};}function respondWithResult(_0x40ba83,_0x473f9d){_0x473f9d=_0x473f9d||0xc8;return function(_0x472bf6){if(_0x472bf6){return _0x40ba83[_0xbfd0('0x1e')](_0x473f9d)[_0xbfd0('0x1f')](_0x472bf6);}};}function respondWithFilteredResult(_0x2bc6ff,_0x164b1b){return function(_0x11281f){if(_0x11281f){var _0x9081ff=_0x11281f[_0xbfd0('0x20')],_0x3ee46f=_0x164b1b[_0xbfd0('0x21')],_0x3a6cc5=_0x164b1b[_0xbfd0('0x21')]+_0x164b1b[_0xbfd0('0x22')],_0x598afa;if(_0x3a6cc5>=_0x9081ff){_0x3a6cc5=_0x9081ff;_0x598afa=0xc8;}else{_0x598afa=0xce;}_0x2bc6ff[_0xbfd0('0x1e')](_0x598afa);return _0x2bc6ff[_0xbfd0('0x23')](_0xbfd0('0x24'),_0x3ee46f+'-'+_0x3a6cc5+'/'+_0x9081ff)[_0xbfd0('0x1f')](_0x11281f);}return null;};}function patchUpdates(_0x5894ed){return function(_0x538272){try{jsonpatch[_0xbfd0('0x25')](_0x538272,_0x5894ed,!![]);}catch(_0x5ed1e5){return BPromise[_0xbfd0('0x26')](_0x5ed1e5);}return _0x538272[_0xbfd0('0x27')]();};}function saveUpdates(_0x1e87d3,_0x42c116){return function(_0xc96985){if(_0xc96985){return _0xc96985[_0xbfd0('0x28')](_0x1e87d3)[_0xbfd0('0x29')](function(_0xf7351f){return _0xf7351f;});}return null;};}function removeEntity(_0x230260,_0x1cabe4){return function(_0x58c6b5){if(_0x58c6b5){return _0x58c6b5[_0xbfd0('0x2a')]()[_0xbfd0('0x29')](function(){_0x230260[_0xbfd0('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44054d,_0x5db5b5){return function(_0x4d93f4){if(!_0x4d93f4){_0x44054d[_0xbfd0('0x2b')](0x194);}return _0x4d93f4;};}function handleError(_0x33a0a4,_0x6f0d94){_0x6f0d94=_0x6f0d94||0x1f4;return function(_0x465811){logger[_0xbfd0('0x2c')](_0x465811[_0xbfd0('0x2d')]);if(_0x465811[_0xbfd0('0x2e')]){delete _0x465811[_0xbfd0('0x2e')];}_0x33a0a4[_0xbfd0('0x1e')](_0x6f0d94)[_0xbfd0('0x2f')](_0x465811);};}exports[_0xbfd0('0x30')]=function(_0x435bc2,_0x114f43){var _0x483bc6={},_0x2177b2={},_0x4c320b={'count':0x0,'rows':[]};return db[_0xbfd0('0x31')][_0xbfd0('0x32')]()[_0xbfd0('0x29')](function(_0x521d69){_0x2177b2['model']=_[_0xbfd0('0x33')](_0x521d69);_0x2177b2[_0xbfd0('0x34')]=_[_0xbfd0('0x33')](_0x435bc2['query']);_0x2177b2['filters']=_[_0xbfd0('0x35')](_0x2177b2[_0xbfd0('0x36')],_0x2177b2[_0xbfd0('0x34')]);_0x483bc6['attributes']=_[_0xbfd0('0x35')](_0x2177b2[_0xbfd0('0x36')],qs['fields'](_0x435bc2[_0xbfd0('0x34')][_0xbfd0('0x37')]));_0x483bc6[_0xbfd0('0x38')]=_0x483bc6[_0xbfd0('0x38')][_0xbfd0('0x39')]?_0x483bc6[_0xbfd0('0x38')]:_0x2177b2[_0xbfd0('0x36')];if(!_0x435bc2[_0xbfd0('0x34')][_0xbfd0('0x3a')](_0xbfd0('0x3b'))){_0x483bc6['limit']=qs[_0xbfd0('0x22')](_0x435bc2[_0xbfd0('0x34')][_0xbfd0('0x22')]);_0x483bc6[_0xbfd0('0x21')]=qs[_0xbfd0('0x21')](_0x435bc2[_0xbfd0('0x34')][_0xbfd0('0x21')]);}_0x483bc6[_0xbfd0('0x3c')]=qs[_0xbfd0('0x3d')](_0x435bc2[_0xbfd0('0x34')]['sort']);_0x483bc6[_0xbfd0('0x3e')]=qs[_0xbfd0('0x3f')](_[_0xbfd0('0x40')](_0x435bc2[_0xbfd0('0x34')],_0x2177b2[_0xbfd0('0x3f')]));if(_0x435bc2[_0xbfd0('0x34')][_0xbfd0('0x41')]){_0x483bc6[_0xbfd0('0x3e')]=_['merge'](_0x483bc6[_0xbfd0('0x3e')],{'$or':_[_0xbfd0('0x42')](_0x483bc6[_0xbfd0('0x38')],function(_0x2c7da3){var _0x1ada9b={};_0x1ada9b[_0x2c7da3]={'$like':'%'+_0x435bc2[_0xbfd0('0x34')][_0xbfd0('0x41')]+'%'};return _0x1ada9b;})});}_0x483bc6=_[_0xbfd0('0x43')]({},_0x483bc6,_0x435bc2[_0xbfd0('0x44')]);var _0x40db1f={'where':_0x483bc6['where']};_0x40db1f['include']=[];if(_0x435bc2[_0xbfd0('0x34')]['tag']){_0x40db1f[_0xbfd0('0x45')][_0xbfd0('0x46')]({'model':db['Tag'],'as':_0xbfd0('0x47'),'attributes':['id'],'where':{'id':_0x435bc2[_0xbfd0('0x34')][_0xbfd0('0x48')]},'required':!![]});_0x40db1f[_0xbfd0('0x49')]=!![];}return db['CmContact'][_0xbfd0('0x20')](_0x40db1f)['then'](function(_0xb29845){_0x4c320b[_0xbfd0('0x20')]=_0xb29845;if(_0x435bc2[_0xbfd0('0x34')][_0xbfd0('0x4a')]){_0x483bc6[_0xbfd0('0x45')]=[{'model':db[_0xbfd0('0x4b')],'as':_0xbfd0('0x47'),'attributes':['id',_0xbfd0('0x2e'),'color'],'required':_0x435bc2[_0xbfd0('0x34')][_0xbfd0('0x48')]?!![]:![]},{'model':db[_0xbfd0('0x4b')],'as':_0xbfd0('0x4c'),'attributes':['id',_0xbfd0('0x2e'),_0xbfd0('0x4d')],'through':_0x435bc2[_0xbfd0('0x34')][_0xbfd0('0x48')]?{'attributes':[],'where':{'TagId':_0x435bc2['query'][_0xbfd0('0x48')]||undefined}}:{},'required':_0x435bc2[_0xbfd0('0x34')][_0xbfd0('0x48')]?!![]:![]}];}return db[_0xbfd0('0x31')][_0xbfd0('0x4e')](_0x483bc6);})['then'](function(_0x508a9b){_0x4c320b[_0xbfd0('0x4f')]=_0x508a9b;return _0x4c320b;})[_0xbfd0('0x29')](respondWithFilteredResult(_0x114f43,_0x483bc6))['catch'](handleError(_0x114f43,null));});};exports[_0xbfd0('0x2a')]=function(_0x14bec3,_0x487081){return db[_0xbfd0('0x31')][_0xbfd0('0x50')]({'where':{'id':_0x14bec3[_0xbfd0('0x51')]['id']}})[_0xbfd0('0x29')](handleEntityNotFound(_0x487081,null))[_0xbfd0('0x29')](removeEntity(_0x487081,null))[_0xbfd0('0x52')](handleError(_0x487081,null));};exports[_0xbfd0('0x32')]=function(_0x2e9570,_0x11cfb6){return db[_0xbfd0('0x31')][_0xbfd0('0x32')]()[_0xbfd0('0x29')](function(_0x5181e0){for(var _0x2e0434=0x0;_0x2e0434=_0x69907c){_0x671b93=_0x69907c;_0x5b5301=0xc8;}else{_0x5b5301=0xce;}_0xcb99fa['status'](_0x5b5301);return _0xcb99fa['set'](_0x0fb2('0x1a'),_0x274831+'-'+_0x671b93+'/'+_0x69907c)[_0x0fb2('0x16')](_0x4481ad);}return null;};}function patchUpdates(_0x3b6424){return function(_0x13b75e){try{jsonpatch[_0x0fb2('0x1b')](_0x13b75e,_0x3b6424,!![]);}catch(_0x1dbde1){return BPromise[_0x0fb2('0x1c')](_0x1dbde1);}return _0x13b75e[_0x0fb2('0x1d')]();};}function saveUpdates(_0x4d49c4,_0x4606c8){return function(_0x293b7c){if(_0x293b7c){return _0x293b7c[_0x0fb2('0x1e')](_0x4d49c4)['then'](function(_0x3c16d8){return _0x3c16d8;});}return null;};}function removeEntity(_0x3197d8,_0x32a549){return function(_0x15c51e){if(_0x15c51e){return _0x15c51e['destroy']()[_0x0fb2('0x1f')](function(){_0x3197d8[_0x0fb2('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57f34f,_0x5693d9){return function(_0xa1314c){if(!_0xa1314c){_0x57f34f[_0x0fb2('0x15')](0x194);}return _0xa1314c;};}function handleError(_0x10af71,_0x6f824){_0x6f824=_0x6f824||0x1f4;return function(_0x4ca3de){logger[_0x0fb2('0x21')](_0x4ca3de['stack']);if(_0x4ca3de[_0x0fb2('0x22')]){delete _0x4ca3de['name'];}_0x10af71['status'](_0x6f824)['send'](_0x4ca3de);};}exports[_0x0fb2('0x23')]=function(_0x3bdedc,_0x7c8562){var _0x4ee34a={},_0x10b904={},_0x1ffedc={'count':0x0,'rows':[]};return db[_0x0fb2('0x24')][_0x0fb2('0x25')]()[_0x0fb2('0x1f')](function(_0x1a85a2){_0x10b904[_0x0fb2('0x26')]=_[_0x0fb2('0x27')](_0x1a85a2);_0x10b904['query']=_[_0x0fb2('0x27')](_0x3bdedc['query']);_0x10b904[_0x0fb2('0x28')]=_[_0x0fb2('0x29')](_0x10b904[_0x0fb2('0x26')],_0x10b904[_0x0fb2('0x2a')]);_0x4ee34a[_0x0fb2('0x2b')]=_[_0x0fb2('0x29')](_0x10b904[_0x0fb2('0x26')],qs[_0x0fb2('0x2c')](_0x3bdedc['query'][_0x0fb2('0x2c')]));_0x4ee34a[_0x0fb2('0x2b')]=_0x4ee34a[_0x0fb2('0x2b')][_0x0fb2('0x2d')]?_0x4ee34a['attributes']:_0x10b904['model'];if(!_0x3bdedc['query'][_0x0fb2('0x2e')](_0x0fb2('0x2f'))){_0x4ee34a[_0x0fb2('0x19')]=qs[_0x0fb2('0x19')](_0x3bdedc['query'][_0x0fb2('0x19')]);_0x4ee34a[_0x0fb2('0x18')]=qs['offset'](_0x3bdedc['query']['offset']);}_0x4ee34a[_0x0fb2('0x30')]=qs[_0x0fb2('0x31')](_0x3bdedc[_0x0fb2('0x2a')]['sort']);_0x4ee34a[_0x0fb2('0x32')]=qs[_0x0fb2('0x28')](_[_0x0fb2('0x33')](_0x3bdedc[_0x0fb2('0x2a')],_0x10b904[_0x0fb2('0x28')]));if(_0x3bdedc[_0x0fb2('0x2a')][_0x0fb2('0x34')]){_0x4ee34a[_0x0fb2('0x32')]=_[_0x0fb2('0x35')](_0x4ee34a['where'],{'$or':_[_0x0fb2('0x36')](_0x4ee34a[_0x0fb2('0x2b')],function(_0x5d650a){var _0x29e5bc={};_0x29e5bc[_0x5d650a]={'$like':'%'+_0x3bdedc[_0x0fb2('0x2a')][_0x0fb2('0x34')]+'%'};return _0x29e5bc;})});}_0x4ee34a=_['merge']({},_0x4ee34a,_0x3bdedc[_0x0fb2('0x37')]);var _0x2d63da={'where':_0x4ee34a[_0x0fb2('0x32')]};_0x2d63da[_0x0fb2('0x38')]=[];if(_0x3bdedc[_0x0fb2('0x2a')][_0x0fb2('0x39')]){_0x2d63da['include']['push']({'model':db[_0x0fb2('0x3a')],'as':_0x0fb2('0x3b'),'attributes':['id'],'where':{'id':_0x3bdedc['query'][_0x0fb2('0x39')]},'required':!![]});_0x2d63da[_0x0fb2('0x3c')]=!![];}return db['CmContact'][_0x0fb2('0x17')](_0x2d63da)['then'](function(_0x126da1){_0x1ffedc[_0x0fb2('0x17')]=_0x126da1;if(_0x3bdedc[_0x0fb2('0x2a')][_0x0fb2('0x3d')]){_0x4ee34a[_0x0fb2('0x38')]=[{'model':db[_0x0fb2('0x3a')],'as':_0x0fb2('0x3b'),'attributes':['id',_0x0fb2('0x22'),'color'],'required':_0x3bdedc['query'][_0x0fb2('0x39')]?!![]:![]},{'model':db['Tag'],'as':_0x0fb2('0x3e'),'attributes':['id',_0x0fb2('0x22'),_0x0fb2('0x3f')],'through':_0x3bdedc[_0x0fb2('0x2a')][_0x0fb2('0x39')]?{'attributes':[],'where':{'TagId':_0x3bdedc['query']['tag']||undefined}}:{},'required':_0x3bdedc[_0x0fb2('0x2a')]['tag']?!![]:![]}];}return db[_0x0fb2('0x24')]['findAll'](_0x4ee34a);})[_0x0fb2('0x1f')](function(_0x19c0f5){_0x1ffedc[_0x0fb2('0x40')]=_0x19c0f5;return _0x1ffedc;})[_0x0fb2('0x1f')](respondWithFilteredResult(_0x7c8562,_0x4ee34a))[_0x0fb2('0x41')](handleError(_0x7c8562,null));});};exports[_0x0fb2('0x42')]=function(_0x5171bb,_0x3400cd){return db[_0x0fb2('0x24')][_0x0fb2('0x43')]({'where':{'id':_0x5171bb[_0x0fb2('0x44')]['id']}})[_0x0fb2('0x1f')](handleEntityNotFound(_0x3400cd,null))[_0x0fb2('0x1f')](removeEntity(_0x3400cd,null))['catch'](handleError(_0x3400cd,null));};exports[_0x0fb2('0x25')]=function(_0x5e1217,_0x4dc193){return db[_0x0fb2('0x24')][_0x0fb2('0x25')]()['then'](function(_0x34d43d){for(var _0x51220d=0x0;_0x51220d{}\s\\|]/g,'-');_0x1d97ef(null,util['format'](_0xed84('0x22'),path[_0xed84('0x23')](_0x5a40ca[_0xed84('0x20')],path[_0xed84('0x24')](_0x5a40ca[_0xed84('0x20')])),Date[_0xed84('0x25')](),path['extname'](_0x5a40ca[_0xed84('0x20')])));}})});router[_0xed84('0x18')](_0xed84('0x26'),upload[_0xed84('0x27')](_0xed84('0x28')),controller[_0xed84('0x29')]);var upload=multer({'storage':multer[_0xed84('0x1c')]({'destination':function(_0x762a35,_0x5e5726,_0x2401d7){_0x2401d7(null,path[_0xed84('0x1d')](config[_0xed84('0x1e')],_0xed84('0x1f')));},'filename':function(_0x5dbee5,_0x32125e,_0x28423e){_0x32125e['originalname']=_0x32125e[_0xed84('0x20')][_0xed84('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x28423e(null,util[_0xed84('0x2a')]('%s-%s%s',path[_0xed84('0x23')](_0x32125e[_0xed84('0x20')],path['extname'](_0x32125e[_0xed84('0x20')])),Date[_0xed84('0x25')](),path['extname'](_0x32125e[_0xed84('0x20')])));}})});router['post'](_0xed84('0x2b'),upload[_0xed84('0x27')](_0xed84('0x28')),controller[_0xed84('0x2c')]);router[_0xed84('0x18')](_0xed84('0x2d'),auth[_0xed84('0xb')](),controller[_0xed84('0x2e')]);router['put'](_0xed84('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xed84('0x2f')]('/:id',auth[_0xed84('0xb')](),controller[_0xed84('0x30')]);module[_0xed84('0x31')]=router; \ No newline at end of file +var _0x8f0b=['/upload/:id','import','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmContact.controller','index','isAuthenticated','describe','get','/:id','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','post','/merge','/create_many','setTags','diskStorage','join','root','server/files/tmp','originalname','replace','format','%s-%s%s','basename','extname','now','/csv','single','file','/upload','upload'];(function(_0xe6e78c,_0x582369){var _0x2a09c8=function(_0x470ccc){while(--_0x470ccc){_0xe6e78c['push'](_0xe6e78c['shift']());}};_0x2a09c8(++_0x582369);}(_0x8f0b,0xc6));var _0xb8f0=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8f0b[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require('multer');var util=require(_0xb8f0('0x0'));var path=require(_0xb8f0('0x1'));var timeout=require(_0xb8f0('0x2'));var express=require(_0xb8f0('0x3'));var router=express[_0xb8f0('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb8f0('0x5'));var config=require(_0xb8f0('0x6'));var controller=require(_0xb8f0('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xb8f0('0x8')]);router['get']('/describe',auth[_0xb8f0('0x9')](),controller[_0xb8f0('0xa')]);router[_0xb8f0('0xb')](_0xb8f0('0xc'),auth[_0xb8f0('0x9')](),controller[_0xb8f0('0xd')]);router['get'](_0xb8f0('0xe'),auth[_0xb8f0('0x9')](),controller[_0xb8f0('0xf')]);router[_0xb8f0('0xb')](_0xb8f0('0x10'),auth[_0xb8f0('0x9')](),controller[_0xb8f0('0x11')]);router['get']('/:id/hopper_histories',auth[_0xb8f0('0x9')](),controller['getHopperHistories']);router['get'](_0xb8f0('0x12'),auth[_0xb8f0('0x9')](),controller[_0xb8f0('0x13')]);router[_0xb8f0('0xb')](_0xb8f0('0x14'),auth[_0xb8f0('0x9')](),controller[_0xb8f0('0x15')]);router[_0xb8f0('0x16')](_0xb8f0('0x17'),auth[_0xb8f0('0x9')](),controller['merge']);router[_0xb8f0('0x16')]('/',auth[_0xb8f0('0x9')](),controller['create']);router[_0xb8f0('0x16')](_0xb8f0('0x18'),auth[_0xb8f0('0x9')](),controller['bulkCreate']);router[_0xb8f0('0x16')](_0xb8f0('0xe'),auth['isAuthenticated'](),controller[_0xb8f0('0x19')]);var upload=multer({'storage':multer[_0xb8f0('0x1a')]({'destination':function(_0x12e7cf,_0x5ae445,_0x8b8eeb){_0x8b8eeb(null,path[_0xb8f0('0x1b')](config[_0xb8f0('0x1c')],_0xb8f0('0x1d')));},'filename':function(_0x64fec8,_0x316bfc,_0x4601f7){_0x316bfc['originalname']=_0x316bfc[_0xb8f0('0x1e')][_0xb8f0('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4601f7(null,util[_0xb8f0('0x20')](_0xb8f0('0x21'),path[_0xb8f0('0x22')](_0x316bfc['originalname'],path[_0xb8f0('0x23')](_0x316bfc[_0xb8f0('0x1e')])),Date[_0xb8f0('0x24')](),path[_0xb8f0('0x23')](_0x316bfc['originalname'])));}})});router[_0xb8f0('0x16')](_0xb8f0('0x25'),upload[_0xb8f0('0x26')](_0xb8f0('0x27')),controller['uploadCsv']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1893c9,_0x205de6,_0xdac44){_0xdac44(null,path['join'](config[_0xb8f0('0x1c')],_0xb8f0('0x1d')));},'filename':function(_0x4672f5,_0x54fada,_0x49da5a){_0x54fada[_0xb8f0('0x1e')]=_0x54fada['originalname'][_0xb8f0('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x49da5a(null,util[_0xb8f0('0x20')](_0xb8f0('0x21'),path[_0xb8f0('0x22')](_0x54fada[_0xb8f0('0x1e')],path[_0xb8f0('0x23')](_0x54fada[_0xb8f0('0x1e')])),Date[_0xb8f0('0x24')](),path[_0xb8f0('0x23')](_0x54fada[_0xb8f0('0x1e')])));}})});router[_0xb8f0('0x16')](_0xb8f0('0x28'),upload[_0xb8f0('0x26')](_0xb8f0('0x27')),controller[_0xb8f0('0x29')]);router[_0xb8f0('0x16')](_0xb8f0('0x2a'),auth[_0xb8f0('0x9')](),controller[_0xb8f0('0x2b')]);router[_0xb8f0('0x2c')](_0xb8f0('0xc'),auth['isAuthenticated'](),controller[_0xb8f0('0x2d')]);router[_0xb8f0('0x2e')]('/:id',auth[_0xb8f0('0x9')](),controller[_0xb8f0('0x2f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 18e0bb0..93ac00f 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 _0x7b74=['exports','getDataValue','setDataValue','alias','name','STRING','TEXT','long','type','select','values','isArray','stringify','BOOLEAN','sequelize','lodash'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x7b74,0x1ce));var _0x47b7=function(_0x30aa4e,_0x433067){_0x30aa4e=_0x30aa4e-0x0;var _0x3f8683=_0x7b74[_0x30aa4e];return _0x3f8683;};'use strict';var Sequelize=require(_0x47b7('0x0'));var _=require(_0x47b7('0x1'));module[_0x47b7('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x14e954){return this[_0x47b7('0x3')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x2d1eac){this[_0x47b7('0x4')](_0x47b7('0x5'),_0x2d1eac?_0x2d1eac:this[_0x47b7('0x3')](_0x47b7('0x6')));}},'type':{'type':Sequelize[_0x47b7('0x7')],'allowNull':![]},'values':{'type':Sequelize[_0x47b7('0x8')](_0x47b7('0x9')),'get':function(){if(this[_0x47b7('0x3')](_0x47b7('0xa'))===_0x47b7('0xb')){return JSON['parse'](this[_0x47b7('0x3')](_0x47b7('0xc')));}else{return this[_0x47b7('0x3')](_0x47b7('0xc'));}},'set':function(_0x57a72a){if(Array[_0x47b7('0xd')](_0x57a72a)){this[_0x47b7('0x4')](_0x47b7('0xc'),JSON[_0x47b7('0xe')](_0x57a72a));}else{this[_0x47b7('0x4')](_0x47b7('0xc'),_0x57a72a);}}},'required':{'type':Sequelize[_0x47b7('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0x33a2=['values','BOOLEAN','sequelize','lodash','exports','VIRTUAL','alias','STRING','setDataValue','getDataValue','name','TEXT','long','type','parse'];(function(_0x26399f,_0x1cff77){var _0x11b070=function(_0x1f2037){while(--_0x1f2037){_0x26399f['push'](_0x26399f['shift']());}};_0x11b070(++_0x1cff77);}(_0x33a2,0xd4));var _0x233a=function(_0x5932d0,_0x3f528d){_0x5932d0=_0x5932d0-0x0;var _0x4b2218=_0x33a2[_0x5932d0];return _0x4b2218;};'use strict';var Sequelize=require(_0x233a('0x0'));var _=require(_0x233a('0x1'));module[_0x233a('0x2')]={'name':{'type':Sequelize[_0x233a('0x3')],'get':function(_0x256f94){return this['getDataValue'](_0x233a('0x4'));}},'alias':{'type':Sequelize[_0x233a('0x5')],'allowNull':![],'set':function(_0x378e5a){this[_0x233a('0x6')]('alias',_0x378e5a?_0x378e5a:this[_0x233a('0x7')](_0x233a('0x8')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x233a('0x9')](_0x233a('0xa')),'get':function(){if(this[_0x233a('0x7')](_0x233a('0xb'))==='select'){return JSON[_0x233a('0xc')](this['getDataValue']('values'));}else{return this[_0x233a('0x7')](_0x233a('0xd'));}},'set':function(_0x1c4571){if(Array['isArray'](_0x1c4571)){this['setDataValue'](_0x233a('0xd'),JSON['stringify'](_0x1c4571));}else{this[_0x233a('0x6')](_0x233a('0xd'),_0x1c4571);}}},'required':{'type':Sequelize[_0x233a('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 22a5443..dcfafb4 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 _0x8c3d=['save','update','then','destroy','end','sendStatus','error','stack','name','send','CmCustomField','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','type','key','field','include','rows','catch','show','params','rawAttributes','includeAll','find','body','sequelize','transaction','create','Sequelize','TEXT','text','INTEGER','BOOLEAN','defaultValue','addColumn','cm_contacts','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x3783a2,_0x310e64){var _0x2eccb4=function(_0x240eeb){while(--_0x240eeb){_0x3783a2['push'](_0x3783a2['shift']());}};_0x2eccb4(++_0x310e64);}(_0x8c3d,0x170));var _0xd8c3=function(_0x29a91c,_0x5ac2c5){_0x29a91c=_0x29a91c-0x0;var _0x2ab4ff=_0x8c3d[_0x29a91c];return _0x2ab4ff;};'use strict';var pdf=require(_0xd8c3('0x0'));var emlformat=require(_0xd8c3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd8c3('0x2'));var jsonpatch=require(_0xd8c3('0x3'));var rp=require(_0xd8c3('0x4'));var moment=require(_0xd8c3('0x5'));var BPromise=require(_0xd8c3('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd8c3('0x7'));var csv=require(_0xd8c3('0x8'));var ejs=require(_0xd8c3('0x9'));var fs=require('fs');var _=require(_0xd8c3('0xa'));var squel=require(_0xd8c3('0xb'));var crypto=require(_0xd8c3('0xc'));var jsforce=require(_0xd8c3('0xd'));var deskjs=require(_0xd8c3('0xe'));var toCsv=require(_0xd8c3('0x8'));var querystring=require('querystring');var Papa=require(_0xd8c3('0xf'));var authService=require(_0xd8c3('0x10'));var hardwareService=require(_0xd8c3('0x11'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xd8c3('0x12'))(_0xd8c3('0x13'));var utils=require(_0xd8c3('0x14'));var config=require(_0xd8c3('0x15'));var db=require(_0xd8c3('0x16'))['db'];function respondWithStatusCode(_0x4e5023,_0xfce84d){_0xfce84d=_0xfce84d||0xcc;return function(_0x1d22e0){if(_0x1d22e0){return _0x4e5023['sendStatus'](_0xfce84d);}return _0x4e5023['status'](_0xfce84d)['end']();};}function respondWithResult(_0x4c102c,_0x1602a9){_0x1602a9=_0x1602a9||0xc8;return function(_0x52c9fe){if(_0x52c9fe){return _0x4c102c[_0xd8c3('0x17')](_0x1602a9)[_0xd8c3('0x18')](_0x52c9fe);}};}function respondWithFilteredResult(_0x4eb806,_0x434e17){return function(_0x4a9c7e){if(_0x4a9c7e){var _0x33fa30=_0x4a9c7e[_0xd8c3('0x19')],_0x41d258=_0x434e17[_0xd8c3('0x1a')],_0xf6f21b=_0x434e17[_0xd8c3('0x1a')]+_0x434e17[_0xd8c3('0x1b')],_0x19b998;if(_0xf6f21b>=_0x33fa30){_0xf6f21b=_0x33fa30;_0x19b998=0xc8;}else{_0x19b998=0xce;}_0x4eb806['status'](_0x19b998);return _0x4eb806[_0xd8c3('0x1c')](_0xd8c3('0x1d'),_0x41d258+'-'+_0xf6f21b+'/'+_0x33fa30)[_0xd8c3('0x18')](_0x4a9c7e);}return null;};}function patchUpdates(_0x144c10){return function(_0x599954){try{jsonpatch[_0xd8c3('0x1e')](_0x599954,_0x144c10,!![]);}catch(_0x19d5e1){return BPromise[_0xd8c3('0x1f')](_0x19d5e1);}return _0x599954[_0xd8c3('0x20')]();};}function saveUpdates(_0x4f3397,_0x3fd964){return function(_0x30968b){if(_0x30968b){return _0x30968b[_0xd8c3('0x21')](_0x4f3397)[_0xd8c3('0x22')](function(_0x31e1eb){return _0x31e1eb;});}return null;};}function removeEntity(_0x1bcb4e,_0x47d42d){return function(_0x21297b){if(_0x21297b){return _0x21297b[_0xd8c3('0x23')]()[_0xd8c3('0x22')](function(){_0x1bcb4e[_0xd8c3('0x17')](0xcc)[_0xd8c3('0x24')]();});}};}function handleEntityNotFound(_0x492564,_0xe13513){return function(_0x1aab6f){if(!_0x1aab6f){_0x492564[_0xd8c3('0x25')](0x194);}return _0x1aab6f;};}function handleError(_0x21bf06,_0x44bbd1){_0x44bbd1=_0x44bbd1||0x1f4;return function(_0x2e06d9){logger[_0xd8c3('0x26')](_0x2e06d9[_0xd8c3('0x27')]);if(_0x2e06d9['name']){delete _0x2e06d9[_0xd8c3('0x28')];}_0x21bf06['status'](_0x44bbd1)[_0xd8c3('0x29')](_0x2e06d9);};}exports['index']=function(_0x222527,_0x1b33a1){var _0x4b0988={},_0x235e0b={},_0x393cdd={'count':0x0,'rows':[]};var _0x25d649=db[_0xd8c3('0x2a')]['rawAttributes'];_0x235e0b[_0xd8c3('0x2b')]=_['differenceBy'](_[_0xd8c3('0x2c')](_0x25d649),[_0xd8c3('0x28')]);_0x235e0b[_0xd8c3('0x2d')]=_['keys'](_0x222527[_0xd8c3('0x2d')]);_0x235e0b[_0xd8c3('0x2e')]=_['intersection'](_0x235e0b[_0xd8c3('0x2b')],_0x235e0b[_0xd8c3('0x2d')]);_0x4b0988['attributes']=_[_0xd8c3('0x2f')](_0x235e0b[_0xd8c3('0x2b')],qs[_0xd8c3('0x30')](_0x222527[_0xd8c3('0x2d')][_0xd8c3('0x30')]));_0x4b0988[_0xd8c3('0x31')]=_0x4b0988[_0xd8c3('0x31')][_0xd8c3('0x32')]?_0x4b0988[_0xd8c3('0x31')]:_0x235e0b[_0xd8c3('0x2b')];if(!_0x222527[_0xd8c3('0x2d')]['hasOwnProperty'](_0xd8c3('0x33'))){_0x4b0988[_0xd8c3('0x1b')]=qs[_0xd8c3('0x1b')](_0x222527[_0xd8c3('0x2d')][_0xd8c3('0x1b')]);_0x4b0988[_0xd8c3('0x1a')]=qs[_0xd8c3('0x1a')](_0x222527['query'][_0xd8c3('0x1a')]);}_0x4b0988[_0xd8c3('0x34')]=qs[_0xd8c3('0x35')](_0x222527[_0xd8c3('0x2d')][_0xd8c3('0x35')]);_0x4b0988[_0xd8c3('0x36')]=qs[_0xd8c3('0x2e')](_[_0xd8c3('0x37')](_0x222527[_0xd8c3('0x2d')],_0x235e0b[_0xd8c3('0x2e')]));if(_0x222527[_0xd8c3('0x2d')]['filter']){_0x4b0988[_0xd8c3('0x36')]=_[_0xd8c3('0x38')](_0x4b0988[_0xd8c3('0x36')],{'$or':_['map'](_0x25d649,function(_0x7a1508){if(_0x7a1508[_0xd8c3('0x39')][_0xd8c3('0x3a')]!=='VIRTUAL'){var _0xbb26fa={};_0xbb26fa[_0x7a1508[_0xd8c3('0x3b')]]={'$like':'%'+_0x222527[_0xd8c3('0x2d')]['filter']+'%'};return _0xbb26fa;}})});}_0x4b0988=_[_0xd8c3('0x38')]({},_0x4b0988,_0x222527['options']);var _0x431a9d={'where':_0x4b0988[_0xd8c3('0x36')]};return db[_0xd8c3('0x2a')]['count'](_0x431a9d)['then'](function(_0x3f32e7){_0x393cdd['count']=_0x3f32e7;if(_0x222527[_0xd8c3('0x2d')]['includeAll']){_0x4b0988[_0xd8c3('0x3c')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x4b0988);})[_0xd8c3('0x22')](function(_0x5296fd){_0x393cdd[_0xd8c3('0x3d')]=_0x5296fd;return _0x393cdd;})['then'](respondWithFilteredResult(_0x1b33a1,_0x4b0988))[_0xd8c3('0x3e')](handleError(_0x1b33a1,null));};exports[_0xd8c3('0x3f')]=function(_0x1e46ba,_0x29e5f8){var _0x72cc3a={'raw':!![],'where':{'id':_0x1e46ba[_0xd8c3('0x40')]['id']}},_0x19ef7f={};_0x19ef7f[_0xd8c3('0x2b')]=_[_0xd8c3('0x2c')](db[_0xd8c3('0x2a')][_0xd8c3('0x41')]);_0x19ef7f['query']=_[_0xd8c3('0x2c')](_0x1e46ba[_0xd8c3('0x2d')]);_0x19ef7f[_0xd8c3('0x2e')]=_[_0xd8c3('0x2f')](_0x19ef7f[_0xd8c3('0x2b')],_0x19ef7f[_0xd8c3('0x2d')]);_0x72cc3a[_0xd8c3('0x31')]=_[_0xd8c3('0x2f')](_0x19ef7f[_0xd8c3('0x2b')],qs[_0xd8c3('0x30')](_0x1e46ba[_0xd8c3('0x2d')]['fields']));_0x72cc3a['attributes']=_0x72cc3a[_0xd8c3('0x31')]['length']?_0x72cc3a[_0xd8c3('0x31')]:_0x19ef7f[_0xd8c3('0x2b')];if(_0x1e46ba['query'][_0xd8c3('0x42')]){_0x72cc3a[_0xd8c3('0x3c')]=[{'all':!![]}];}_0x72cc3a=_['merge']({},_0x72cc3a,_0x1e46ba['options']);return db['CmCustomField'][_0xd8c3('0x43')](_0x72cc3a)[_0xd8c3('0x22')](handleEntityNotFound(_0x29e5f8,null))[_0xd8c3('0x22')](respondWithResult(_0x29e5f8,null))['catch'](handleError(_0x29e5f8,null));};exports[_0xd8c3('0x21')]=function(_0x4d9a67,_0x52dcd3){if(_0x4d9a67[_0xd8c3('0x44')]['id']){delete _0x4d9a67['body']['id'];}return db[_0xd8c3('0x2a')][_0xd8c3('0x43')]({'where':{'id':_0x4d9a67[_0xd8c3('0x40')]['id']}})[_0xd8c3('0x22')](handleEntityNotFound(_0x52dcd3,null))['then'](saveUpdates(_0x4d9a67[_0xd8c3('0x44')],null))[_0xd8c3('0x22')](respondWithResult(_0x52dcd3,null))[_0xd8c3('0x3e')](handleError(_0x52dcd3,null));};exports[_0xd8c3('0x23')]=function(_0x35a966,_0x1c221f){return db['CmCustomField'][_0xd8c3('0x43')]({'where':{'id':_0x35a966[_0xd8c3('0x40')]['id']}})[_0xd8c3('0x22')](handleEntityNotFound(_0x1c221f,null))['then'](removeEntity(_0x1c221f,null))['catch'](handleError(_0x1c221f,null));};exports['create']=function(_0x572c2e,_0x594651){var _0x1d28eb;return db[_0xd8c3('0x45')][_0xd8c3('0x46')](function(_0x218e28){return db[_0xd8c3('0x2a')][_0xd8c3('0x47')](_0x572c2e['body'],{'transaction':_0x218e28})[_0xd8c3('0x22')](function(_0x8c6dce){_0x1d28eb=_0x8c6dce;var _0x5f5ccc={'type':db[_0xd8c3('0x48')][_0xd8c3('0x49')],'transaction':_0x218e28};switch(_0x572c2e[_0xd8c3('0x44')][_0xd8c3('0x39')]){case _0xd8c3('0x4a'):_0x5f5ccc[_0xd8c3('0x39')]=db['Sequelize'][_0xd8c3('0x49')];break;case'number':_0x5f5ccc[_0xd8c3('0x39')]=db[_0xd8c3('0x48')][_0xd8c3('0x4b')];break;case'switch':_0x5f5ccc['type']=db[_0xd8c3('0x48')][_0xd8c3('0x4c')];_0x5f5ccc[_0xd8c3('0x4d')]=![];break;default:}return db['sequelize']['queryInterface'][_0xd8c3('0x4e')](_0xd8c3('0x4f'),util['format']('cf_%d',_0x1d28eb['id']),_0x5f5ccc);})[_0xd8c3('0x22')](function(){return _0x1d28eb;});})['then'](respondWithResult(_0x594651,0xc9))['catch'](handleError(_0x594651,null));}; \ No newline at end of file +var _0x7b27=['merge','type','key','VIRTUAL','field','includeAll','include','findAll','catch','show','options','find','body','params','create','sequelize','Sequelize','TEXT','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','format','cf_%d','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','CmCustomField','rawAttributes','model','differenceBy','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter'];(function(_0x2d67c3,_0x489c8a){var _0x131f73=function(_0x486be3){while(--_0x486be3){_0x2d67c3['push'](_0x2d67c3['shift']());}};_0x131f73(++_0x489c8a);}(_0x7b27,0x162));var _0x77b2=function(_0x4091c7,_0x54ba13){_0x4091c7=_0x4091c7-0x0;var _0x2ca4d3=_0x7b27[_0x4091c7];return _0x2ca4d3;};'use strict';var pdf=require(_0x77b2('0x0'));var emlformat=require(_0x77b2('0x1'));var rimraf=require(_0x77b2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x77b2('0x3'));var moment=require(_0x77b2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x77b2('0x5'));var util=require(_0x77b2('0x6'));var path=require(_0x77b2('0x7'));var sox=require(_0x77b2('0x8'));var csv=require(_0x77b2('0x9'));var ejs=require(_0x77b2('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x77b2('0xb'));var jsforce=require(_0x77b2('0xc'));var deskjs=require(_0x77b2('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x77b2('0xe'));var authService=require(_0x77b2('0xf'));var hardwareService=require(_0x77b2('0x10'));var Redis=require(_0x77b2('0x11'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x77b2('0x12'));var utils=require('../../config/utils');var config=require(_0x77b2('0x13'));var db=require(_0x77b2('0x14'))['db'];function respondWithStatusCode(_0x23f069,_0x497519){_0x497519=_0x497519||0xcc;return function(_0x5d35ee){if(_0x5d35ee){return _0x23f069[_0x77b2('0x15')](_0x497519);}return _0x23f069[_0x77b2('0x16')](_0x497519)[_0x77b2('0x17')]();};}function respondWithResult(_0x2529fe,_0x111f8e){_0x111f8e=_0x111f8e||0xc8;return function(_0x25c1fb){if(_0x25c1fb){return _0x2529fe[_0x77b2('0x16')](_0x111f8e)[_0x77b2('0x18')](_0x25c1fb);}};}function respondWithFilteredResult(_0x1f7c18,_0x5c8b34){return function(_0x1e6e45){if(_0x1e6e45){var _0x2d3885=_0x1e6e45[_0x77b2('0x19')],_0x2d0d51=_0x5c8b34[_0x77b2('0x1a')],_0xa50c44=_0x5c8b34[_0x77b2('0x1a')]+_0x5c8b34[_0x77b2('0x1b')],_0x73dde1;if(_0xa50c44>=_0x2d3885){_0xa50c44=_0x2d3885;_0x73dde1=0xc8;}else{_0x73dde1=0xce;}_0x1f7c18[_0x77b2('0x16')](_0x73dde1);return _0x1f7c18['set'](_0x77b2('0x1c'),_0x2d0d51+'-'+_0xa50c44+'/'+_0x2d3885)[_0x77b2('0x18')](_0x1e6e45);}return null;};}function patchUpdates(_0x1f5bd1){return function(_0x562507){try{jsonpatch[_0x77b2('0x1d')](_0x562507,_0x1f5bd1,!![]);}catch(_0x27b276){return BPromise['reject'](_0x27b276);}return _0x562507[_0x77b2('0x1e')]();};}function saveUpdates(_0x25dc88,_0x7c23fc){return function(_0xb8478c){if(_0xb8478c){return _0xb8478c[_0x77b2('0x1f')](_0x25dc88)[_0x77b2('0x20')](function(_0x8ccccb){return _0x8ccccb;});}return null;};}function removeEntity(_0x49e0e5,_0x1fd504){return function(_0x507941){if(_0x507941){return _0x507941[_0x77b2('0x21')]()[_0x77b2('0x20')](function(){_0x49e0e5[_0x77b2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x306ea2,_0x361d49){return function(_0x5aa9b1){if(!_0x5aa9b1){_0x306ea2['sendStatus'](0x194);}return _0x5aa9b1;};}function handleError(_0x557ab0,_0x327467){_0x327467=_0x327467||0x1f4;return function(_0x292c53){logger[_0x77b2('0x22')](_0x292c53[_0x77b2('0x23')]);if(_0x292c53[_0x77b2('0x24')]){delete _0x292c53['name'];}_0x557ab0[_0x77b2('0x16')](_0x327467)[_0x77b2('0x25')](_0x292c53);};}exports[_0x77b2('0x26')]=function(_0x2d7d7d,_0x437bdb){var _0x23588f={},_0x4c3350={},_0x585d45={'count':0x0,'rows':[]};var _0x2d090d=db[_0x77b2('0x27')][_0x77b2('0x28')];_0x4c3350[_0x77b2('0x29')]=_[_0x77b2('0x2a')](_[_0x77b2('0x2b')](_0x2d090d),['name']);_0x4c3350[_0x77b2('0x2c')]=_[_0x77b2('0x2b')](_0x2d7d7d[_0x77b2('0x2c')]);_0x4c3350[_0x77b2('0x2d')]=_[_0x77b2('0x2e')](_0x4c3350[_0x77b2('0x29')],_0x4c3350[_0x77b2('0x2c')]);_0x23588f[_0x77b2('0x2f')]=_['intersection'](_0x4c3350['model'],qs[_0x77b2('0x30')](_0x2d7d7d['query']['fields']));_0x23588f[_0x77b2('0x2f')]=_0x23588f[_0x77b2('0x2f')][_0x77b2('0x31')]?_0x23588f[_0x77b2('0x2f')]:_0x4c3350['model'];if(!_0x2d7d7d[_0x77b2('0x2c')]['hasOwnProperty'](_0x77b2('0x32'))){_0x23588f[_0x77b2('0x1b')]=qs[_0x77b2('0x1b')](_0x2d7d7d[_0x77b2('0x2c')][_0x77b2('0x1b')]);_0x23588f['offset']=qs[_0x77b2('0x1a')](_0x2d7d7d['query'][_0x77b2('0x1a')]);}_0x23588f[_0x77b2('0x33')]=qs[_0x77b2('0x34')](_0x2d7d7d['query'][_0x77b2('0x34')]);_0x23588f[_0x77b2('0x35')]=qs['filters'](_[_0x77b2('0x36')](_0x2d7d7d[_0x77b2('0x2c')],_0x4c3350['filters']));if(_0x2d7d7d['query'][_0x77b2('0x37')]){_0x23588f[_0x77b2('0x35')]=_[_0x77b2('0x38')](_0x23588f['where'],{'$or':_['map'](_0x2d090d,function(_0xaef992){if(_0xaef992[_0x77b2('0x39')][_0x77b2('0x3a')]!==_0x77b2('0x3b')){var _0x390a24={};_0x390a24[_0xaef992[_0x77b2('0x3c')]]={'$like':'%'+_0x2d7d7d[_0x77b2('0x2c')][_0x77b2('0x37')]+'%'};return _0x390a24;}})});}_0x23588f=_[_0x77b2('0x38')]({},_0x23588f,_0x2d7d7d['options']);var _0x206fd0={'where':_0x23588f[_0x77b2('0x35')]};return db[_0x77b2('0x27')][_0x77b2('0x19')](_0x206fd0)['then'](function(_0x531b0d){_0x585d45[_0x77b2('0x19')]=_0x531b0d;if(_0x2d7d7d[_0x77b2('0x2c')][_0x77b2('0x3d')]){_0x23588f[_0x77b2('0x3e')]=[{'all':!![]}];}return db[_0x77b2('0x27')][_0x77b2('0x3f')](_0x23588f);})['then'](function(_0x28ea7f){_0x585d45['rows']=_0x28ea7f;return _0x585d45;})['then'](respondWithFilteredResult(_0x437bdb,_0x23588f))[_0x77b2('0x40')](handleError(_0x437bdb,null));};exports[_0x77b2('0x41')]=function(_0x22d90a,_0x465a9a){var _0x2d0875={'raw':!![],'where':{'id':_0x22d90a['params']['id']}},_0x437ccd={};_0x437ccd[_0x77b2('0x29')]=_['keys'](db[_0x77b2('0x27')][_0x77b2('0x28')]);_0x437ccd[_0x77b2('0x2c')]=_['keys'](_0x22d90a[_0x77b2('0x2c')]);_0x437ccd[_0x77b2('0x2d')]=_['intersection'](_0x437ccd[_0x77b2('0x29')],_0x437ccd[_0x77b2('0x2c')]);_0x2d0875[_0x77b2('0x2f')]=_[_0x77b2('0x2e')](_0x437ccd[_0x77b2('0x29')],qs[_0x77b2('0x30')](_0x22d90a[_0x77b2('0x2c')][_0x77b2('0x30')]));_0x2d0875[_0x77b2('0x2f')]=_0x2d0875[_0x77b2('0x2f')][_0x77b2('0x31')]?_0x2d0875[_0x77b2('0x2f')]:_0x437ccd[_0x77b2('0x29')];if(_0x22d90a[_0x77b2('0x2c')][_0x77b2('0x3d')]){_0x2d0875['include']=[{'all':!![]}];}_0x2d0875=_['merge']({},_0x2d0875,_0x22d90a[_0x77b2('0x42')]);return db[_0x77b2('0x27')][_0x77b2('0x43')](_0x2d0875)[_0x77b2('0x20')](handleEntityNotFound(_0x465a9a,null))['then'](respondWithResult(_0x465a9a,null))[_0x77b2('0x40')](handleError(_0x465a9a,null));};exports[_0x77b2('0x1f')]=function(_0x2c3ec2,_0x5634d6){if(_0x2c3ec2[_0x77b2('0x44')]['id']){delete _0x2c3ec2[_0x77b2('0x44')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x2c3ec2[_0x77b2('0x45')]['id']}})['then'](handleEntityNotFound(_0x5634d6,null))[_0x77b2('0x20')](saveUpdates(_0x2c3ec2[_0x77b2('0x44')],null))[_0x77b2('0x20')](respondWithResult(_0x5634d6,null))['catch'](handleError(_0x5634d6,null));};exports[_0x77b2('0x21')]=function(_0x458352,_0x1f04f9){return db['CmCustomField'][_0x77b2('0x43')]({'where':{'id':_0x458352[_0x77b2('0x45')]['id']}})['then'](handleEntityNotFound(_0x1f04f9,null))[_0x77b2('0x20')](removeEntity(_0x1f04f9,null))[_0x77b2('0x40')](handleError(_0x1f04f9,null));};exports[_0x77b2('0x46')]=function(_0x4c7b99,_0x42443b){var _0x10fd78;return db[_0x77b2('0x47')]['transaction'](function(_0x43111e){return db[_0x77b2('0x27')][_0x77b2('0x46')](_0x4c7b99[_0x77b2('0x44')],{'transaction':_0x43111e})[_0x77b2('0x20')](function(_0x1d9d93){_0x10fd78=_0x1d9d93;var _0x156a4c={'type':db[_0x77b2('0x48')][_0x77b2('0x49')],'transaction':_0x43111e};switch(_0x4c7b99[_0x77b2('0x44')]['type']){case'text':_0x156a4c[_0x77b2('0x39')]=db[_0x77b2('0x48')]['TEXT'];break;case _0x77b2('0x4a'):_0x156a4c['type']=db[_0x77b2('0x48')][_0x77b2('0x4b')];break;case'switch':_0x156a4c[_0x77b2('0x39')]=db[_0x77b2('0x48')][_0x77b2('0x4c')];_0x156a4c[_0x77b2('0x4d')]=![];break;default:}return db[_0x77b2('0x47')][_0x77b2('0x4e')][_0x77b2('0x4f')]('cm_contacts',util[_0x77b2('0x50')](_0x77b2('0x51'),_0x10fd78['id']),_0x156a4c);})[_0x77b2('0x20')](function(){return _0x10fd78;});})[_0x77b2('0x20')](respondWithResult(_0x42443b,0xc9))['catch'](handleError(_0x42443b,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 85bb388..368ec0f 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 _0x4428=['./cmCustomField.attributes','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4b155d,_0x39b082){var _0x3d3c65=function(_0x466908){while(--_0x466908){_0x4b155d['push'](_0x4b155d['shift']());}};_0x3d3c65(++_0x39b082);}(_0x4428,0xca));var _0x8442=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x4428[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0x8442('0x0'));var util=require(_0x8442('0x1'));var logger=require(_0x8442('0x2'))(_0x8442('0x3'));var moment=require(_0x8442('0x4'));var BPromise=require(_0x8442('0x5'));var rp=require(_0x8442('0x6'));var attributes=require(_0x8442('0x7'));module['exports']=function(_0xa01ed7,_0x115125){return _0xa01ed7[_0x8442('0x8')](_0x8442('0x9'),attributes,{'tableName':_0x8442('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2172=['cm_custom_fields','lodash','util','../../config/logger','api','bluebird','define','CmCustomField'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x2172,0x1e9));var _0x2217=function(_0x4131f6,_0x3d3827){_0x4131f6=_0x4131f6-0x0;var _0x364e66=_0x2172[_0x4131f6];return _0x364e66;};'use strict';var _=require(_0x2217('0x0'));var util=require(_0x2217('0x1'));var logger=require(_0x2217('0x2'))(_0x2217('0x3'));var moment=require('moment');var BPromise=require(_0x2217('0x4'));var rp=require('request-promise');var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x58735f,_0x1bde04){return _0x58735f[_0x2217('0x5')](_0x2217('0x6'),attributes,{'tableName':_0x2217('0x7'),'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 d020d47..0b55dc5 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 _0xf489=['http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x331674,_0x246ec0){var _0x2773fb=function(_0x5723c1){while(--_0x5723c1){_0x331674['push'](_0x331674['shift']());}};_0x2773fb(++_0x246ec0);}(_0xf489,0x114));var _0x9f48=function(_0x3c7cfa,_0x4681de){_0x3c7cfa=_0x3c7cfa-0x0;var _0x533f09=_0xf489[_0x3c7cfa];return _0x533f09;};'use strict';var _=require(_0x9f48('0x0'));var util=require(_0x9f48('0x1'));var moment=require(_0x9f48('0x2'));var BPromise=require(_0x9f48('0x3'));var rs=require(_0x9f48('0x4'));var fs=require('fs');var Redis=require(_0x9f48('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9f48('0x6'));var logger=require(_0x9f48('0x7'))(_0x9f48('0x8'));var config=require(_0x9f48('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9f48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x218464,_0x17494a,_0x1aa9ad){return new BPromise(function(_0x59f0dd,_0x5e05f9){return client[_0x9f48('0xb')](_0x218464,_0x1aa9ad)[_0x9f48('0xc')](function(_0x379132){logger[_0x9f48('0xd')](_0x9f48('0xe'),_0x17494a,_0x9f48('0xf'));logger[_0x9f48('0x10')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x17494a,'request\x20sent',JSON[_0x9f48('0x11')](_0x379132));if(_0x379132[_0x9f48('0x12')]){if(_0x379132[_0x9f48('0x12')][_0x9f48('0x13')]===0x1f4){logger[_0x9f48('0x12')](_0x9f48('0xe'),_0x17494a,_0x379132['error'][_0x9f48('0x14')]);return _0x5e05f9(_0x379132['error'][_0x9f48('0x14')]);}logger[_0x9f48('0x12')](_0x9f48('0xe'),_0x17494a,_0x379132['error'][_0x9f48('0x14')]);return _0x59f0dd(_0x379132[_0x9f48('0x12')][_0x9f48('0x14')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x17494a,_0x9f48('0xf'));_0x59f0dd(_0x379132['result'][_0x9f48('0x14')]);}})[_0x9f48('0x15')](function(_0x33bf42){logger[_0x9f48('0x12')](_0x9f48('0xe'),_0x17494a,_0x33bf42);_0x5e05f9(_0x33bf42);});});} \ No newline at end of file +var _0xc179=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmCustomField,\x20%s,\x20%s','result','catch'];(function(_0xf168d3,_0x43dcfc){var _0x17fb54=function(_0x3d9674){while(--_0x3d9674){_0xf168d3['push'](_0xf168d3['shift']());}};_0x17fb54(++_0x43dcfc);}(_0xc179,0x165));var _0x9c17=function(_0x3c30a4,_0x152fd6){_0x3c30a4=_0x3c30a4-0x0;var _0x4f3e14=_0xc179[_0x3c30a4];return _0x4f3e14;};'use strict';var _=require(_0x9c17('0x0'));var util=require(_0x9c17('0x1'));var moment=require(_0x9c17('0x2'));var BPromise=require('bluebird');var rs=require(_0x9c17('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c17('0x4'))['db'];var utils=require(_0x9c17('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x9c17('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9c17('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x188458,_0x12e9b7,_0x206ea1){return new BPromise(function(_0xe43ce8,_0x3a5244){return client[_0x9c17('0x8')](_0x188458,_0x206ea1)[_0x9c17('0x9')](function(_0x23294d){logger[_0x9c17('0xa')]('CmCustomField,\x20%s,\x20%s',_0x12e9b7,_0x9c17('0xb'));logger[_0x9c17('0xc')](_0x9c17('0xd'),_0x12e9b7,_0x9c17('0xb'),JSON[_0x9c17('0xe')](_0x23294d));if(_0x23294d[_0x9c17('0xf')]){if(_0x23294d[_0x9c17('0xf')][_0x9c17('0x10')]===0x1f4){logger[_0x9c17('0xf')]('CmCustomField,\x20%s,\x20%s',_0x12e9b7,_0x23294d[_0x9c17('0xf')][_0x9c17('0x11')]);return _0x3a5244(_0x23294d[_0x9c17('0xf')][_0x9c17('0x11')]);}logger[_0x9c17('0xf')](_0x9c17('0x12'),_0x12e9b7,_0x23294d[_0x9c17('0xf')][_0x9c17('0x11')]);return _0xe43ce8(_0x23294d[_0x9c17('0xf')]['message']);}else{logger[_0x9c17('0xa')]('CmCustomField,\x20%s,\x20%s',_0x12e9b7,_0x9c17('0xb'));_0xe43ce8(_0x23294d[_0x9c17('0x13')][_0x9c17('0x11')]);}})[_0x9c17('0x14')](function(_0x4d1825){logger[_0x9c17('0xf')](_0x9c17('0x12'),_0x12e9b7,_0x4d1825);_0x3a5244(_0x4d1825);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 49956c1..6704d25 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 _0x1130=['get','isAuthenticated','index','/:id','show','post','create','delete','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller'];(function(_0x1a757e,_0x78b99f){var _0x386c0c=function(_0x4f9bcf){while(--_0x4f9bcf){_0x1a757e['push'](_0x1a757e['shift']());}};_0x386c0c(++_0x78b99f);}(_0x1130,0xa8));var _0x0113=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x1130[_0x1ac595];return _0x455fff;};'use strict';var multer=require('multer');var util=require(_0x0113('0x0'));var path=require(_0x0113('0x1'));var timeout=require(_0x0113('0x2'));var express=require('express');var router=express[_0x0113('0x3')]();var auth=require(_0x0113('0x4'));var interaction=require(_0x0113('0x5'));var config=require(_0x0113('0x6'));var controller=require(_0x0113('0x7'));router[_0x0113('0x8')]('/',auth[_0x0113('0x9')](),controller[_0x0113('0xa')]);router[_0x0113('0x8')](_0x0113('0xb'),auth[_0x0113('0x9')](),controller[_0x0113('0xc')]);router[_0x0113('0xd')]('/',auth[_0x0113('0x9')](),controller[_0x0113('0xe')]);router['put']('/:id',auth[_0x0113('0x9')](),controller['update']);router[_0x0113('0xf')]('/:id',auth[_0x0113('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8eba=['./cmCustomField.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x485f35,_0x45a0fc){var _0x2ad118=function(_0x296650){while(--_0x296650){_0x485f35['push'](_0x485f35['shift']());}};_0x2ad118(++_0x45a0fc);}(_0x8eba,0x10f));var _0xa8eb=function(_0x28f1de,_0x355054){_0x28f1de=_0x28f1de-0x0;var _0x5b5dad=_0x8eba[_0x28f1de];return _0x5b5dad;};'use strict';var multer=require(_0xa8eb('0x0'));var util=require(_0xa8eb('0x1'));var path=require(_0xa8eb('0x2'));var timeout=require(_0xa8eb('0x3'));var express=require(_0xa8eb('0x4'));var router=express[_0xa8eb('0x5')]();var auth=require(_0xa8eb('0x6'));var interaction=require(_0xa8eb('0x7'));var config=require(_0xa8eb('0x8'));var controller=require(_0xa8eb('0x9'));router[_0xa8eb('0xa')]('/',auth[_0xa8eb('0xb')](),controller['index']);router[_0xa8eb('0xa')](_0xa8eb('0xc'),auth[_0xa8eb('0xb')](),controller[_0xa8eb('0xd')]);router[_0xa8eb('0xe')]('/',auth['isAuthenticated'](),controller[_0xa8eb('0xf')]);router[_0xa8eb('0x10')](_0xa8eb('0xc'),auth[_0xa8eb('0xb')](),controller[_0xa8eb('0x11')]);router['delete'](_0xa8eb('0xc'),auth[_0xa8eb('0xb')](),controller[_0xa8eb('0x12')]);module[_0xa8eb('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index bf0c042..795a05b 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 _0xec1a=['sequelize','exports','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue','moment'];(function(_0x201477,_0x4de14b){var _0x30905e=function(_0x10b654){while(--_0x10b654){_0x201477['push'](_0x201477['shift']());}};_0x30905e(++_0x4de14b);}(_0xec1a,0x77));var _0xaec1=function(_0x4d0a38,_0x250363){_0x4d0a38=_0x4d0a38-0x0;var _0x3c9435=_0xec1a[_0x4d0a38];return _0x3c9435;};'use strict';var moment=require(_0xaec1('0x0'));var Sequelize=require(_0xaec1('0x1'));module[_0xaec1('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xaec1('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xaec1('0x4')],'defaultValue':moment()['format'](_0xaec1('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xaec1('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xaec1('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xaec1('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xaec1('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xaec1('0x4')]},'priority':{'type':Sequelize[_0xaec1('0x6')](0x2)[_0xaec1('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xaec1('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xaec1('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xaec1('0x6')],'unique':_0xaec1('0x9')},'CampaignId':{'type':Sequelize[_0xaec1('0x6')]}}; \ No newline at end of file +var _0x7a1a=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue','moment','sequelize','BOOLEAN'];(function(_0x2984d0,_0x1a7211){var _0x2885f2=function(_0x42f3da){while(--_0x42f3da){_0x2984d0['push'](_0x2984d0['shift']());}};_0x2885f2(++_0x1a7211);}(_0x7a1a,0x1d3));var _0xa7a1=function(_0x148c9e,_0x36c285){_0x148c9e=_0x148c9e-0x0;var _0x3b1585=_0x7a1a[_0x148c9e];return _0x3b1585;};'use strict';var moment=require(_0xa7a1('0x0'));var Sequelize=require(_0xa7a1('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xa7a1('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa7a1('0x3')],'defaultValue':moment()[_0xa7a1('0x4')](_0xa7a1('0x5'))},'countbusyretry':{'type':Sequelize[_0xa7a1('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa7a1('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa7a1('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa7a1('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xa7a1('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xa7a1('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xa7a1('0x9')},'ListId':{'type':Sequelize[_0xa7a1('0x6')],'unique':_0xa7a1('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xa7a1('0x6')],'unique':_0xa7a1('0x9')},'CampaignId':{'type':Sequelize[_0xa7a1('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 2968967..dbbafce 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 _0xcdcd=['json','getOpenContacts','entity\x20not\x20found','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','concat','$or','$gt','$gte','$lt','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$any','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','field','filter','options','CmHopper','findAll','rows','params','length','include','find','catch','create','body','describe','VoiceQueueId','CampaignId','Campaign','createdAt','updatedAt','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','CmContact','ContactId','isNil','firstName','lastName','calleridname','finally','CmHopperFinal','outbound','preview','dialOrderByScheduledAt','transaction','direction','prev','hopperIds','priority','ASC','scheduledAt','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','List','Queue','dialActive','getVoiceQueues','map','isNumber'];(function(_0x2a64dc,_0x148569){var _0x5006e1=function(_0xd19d7c){while(--_0xd19d7c){_0x2a64dc['push'](_0x2a64dc['shift']());}};_0x5006e1(++_0x148569);}(_0xcdcd,0x123));var _0xdcdc=function(_0x437808,_0x5d54e4){_0x437808=_0x437808-0x0;var _0x3752ac=_0xcdcd[_0x437808];return _0x3752ac;};'use strict';var pdf=require(_0xdcdc('0x0'));var emlformat=require(_0xdcdc('0x1'));var rimraf=require(_0xdcdc('0x2'));var zipdir=require(_0xdcdc('0x3'));var jsonpatch=require(_0xdcdc('0x4'));var rp=require(_0xdcdc('0x5'));var moment=require(_0xdcdc('0x6'));var BPromise=require(_0xdcdc('0x7'));var Mustache=require('mustache');var util=require(_0xdcdc('0x8'));var path=require(_0xdcdc('0x9'));var sox=require(_0xdcdc('0xa'));var csv=require(_0xdcdc('0xb'));var ejs=require(_0xdcdc('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdcdc('0xd'));var crypto=require(_0xdcdc('0xe'));var jsforce=require(_0xdcdc('0xf'));var deskjs=require(_0xdcdc('0x10'));var toCsv=require('to-csv');var querystring=require(_0xdcdc('0x11'));var Papa=require(_0xdcdc('0x12'));var authService=require(_0xdcdc('0x13'));var hardwareService=require(_0xdcdc('0x14'));var Redis=require('ioredis');var qs=require(_0xdcdc('0x15'));var logger=require('../../config/logger')(_0xdcdc('0x16'));var utils=require(_0xdcdc('0x17'));var config=require('../../config/environment');var db=require(_0xdcdc('0x18'))['db'];function respondWithStatusCode(_0x156a81,_0x2e9828){_0x2e9828=_0x2e9828||0xcc;return function(_0x306f39){if(_0x306f39){return _0x156a81[_0xdcdc('0x19')](_0x2e9828);}return _0x156a81[_0xdcdc('0x1a')](_0x2e9828)[_0xdcdc('0x1b')]();};}function respondWithResult(_0x192f06,_0x1379f0){_0x1379f0=_0x1379f0||0xc8;return function(_0x3d2a84){if(_0x3d2a84){return _0x192f06[_0xdcdc('0x1a')](_0x1379f0)['json'](_0x3d2a84);}};}function respondWithFilteredResult(_0xd6210d,_0x2452ca){return function(_0x33d435){if(_0x33d435){var _0x2ea6f9=_0x33d435[_0xdcdc('0x1c')],_0x3fc1ed=_0x2452ca[_0xdcdc('0x1d')],_0x139cea=_0x2452ca[_0xdcdc('0x1d')]+_0x2452ca['limit'],_0x56a501;if(_0x139cea>=_0x2ea6f9){_0x139cea=_0x2ea6f9;_0x56a501=0xc8;}else{_0x56a501=0xce;}_0xd6210d[_0xdcdc('0x1a')](_0x56a501);return _0xd6210d['set'](_0xdcdc('0x1e'),_0x3fc1ed+'-'+_0x139cea+'/'+_0x2ea6f9)['json'](_0x33d435);}return null;};}function patchUpdates(_0x2d85a3){return function(_0xa2257e){try{jsonpatch['apply'](_0xa2257e,_0x2d85a3,!![]);}catch(_0x5500e6){return BPromise[_0xdcdc('0x1f')](_0x5500e6);}return _0xa2257e[_0xdcdc('0x20')]();};}function saveUpdates(_0x172632,_0x9408d){return function(_0x54bab7){if(_0x54bab7){return _0x54bab7[_0xdcdc('0x21')](_0x172632)[_0xdcdc('0x22')](function(_0x177241){return _0x177241;});}return null;};}function removeEntity(_0x529c01,_0x5e4cc8){return function(_0x4908eb){if(_0x4908eb){return _0x4908eb[_0xdcdc('0x23')]()[_0xdcdc('0x22')](function(){_0x529c01[_0xdcdc('0x1a')](0xcc)[_0xdcdc('0x1b')]();});}};}function handleEntityNotFound(_0x508426,_0x13db1c){return function(_0x73c628){if(!_0x73c628){_0x508426[_0xdcdc('0x19')](0x194);}return _0x73c628;};}function handleError(_0x367453,_0x380513){_0x380513=_0x380513||0x1f4;return function(_0x40cd28){logger[_0xdcdc('0x24')](_0x40cd28[_0xdcdc('0x25')]);if(_0x40cd28[_0xdcdc('0x26')]){delete _0x40cd28[_0xdcdc('0x26')];}_0x367453[_0xdcdc('0x1a')](_0x380513)[_0xdcdc('0x27')](_0x40cd28);};}exports[_0xdcdc('0x28')]=function(_0x24221a,_0x5c61cb){var _0x12215a={},_0x22ef26={},_0x33f59d={'count':0x0,'rows':[]};var _0x512ee6=db['CmHopper'][_0xdcdc('0x29')];_0x22ef26[_0xdcdc('0x2a')]=_[_0xdcdc('0x2b')](_0x512ee6);_0x22ef26['query']=_[_0xdcdc('0x2b')](_0x24221a[_0xdcdc('0x2c')]);_0x22ef26[_0xdcdc('0x2d')]=_[_0xdcdc('0x2e')](_0x22ef26[_0xdcdc('0x2a')],_0x22ef26[_0xdcdc('0x2c')]);_0x22ef26[_0xdcdc('0x2d')]=_[_0xdcdc('0x2f')](_0x22ef26[_0xdcdc('0x2d')],['$and',_0xdcdc('0x30'),_0xdcdc('0x31'),_0xdcdc('0x32'),_0xdcdc('0x33'),'$lte','$ne','$eq',_0xdcdc('0x34'),_0xdcdc('0x35'),_0xdcdc('0x36'),_0xdcdc('0x37'),_0xdcdc('0x38'),_0xdcdc('0x39'),_0xdcdc('0x3a'),_0xdcdc('0x3b'),_0xdcdc('0x3c'),_0xdcdc('0x39'),_0xdcdc('0x3d'),'$contains','$contained',_0xdcdc('0x3e')]);_0x12215a['attributes']=_[_0xdcdc('0x2e')](_0x22ef26[_0xdcdc('0x2a')],qs[_0xdcdc('0x3f')](_0x24221a[_0xdcdc('0x2c')][_0xdcdc('0x3f')]));_0x12215a['attributes']=_0x12215a[_0xdcdc('0x40')]['length']?_0x12215a['attributes']:_0x22ef26[_0xdcdc('0x2a')];if(!_0x24221a[_0xdcdc('0x2c')][_0xdcdc('0x41')](_0xdcdc('0x42'))){_0x12215a[_0xdcdc('0x43')]=qs[_0xdcdc('0x43')](_0x24221a['query'][_0xdcdc('0x43')]);_0x12215a[_0xdcdc('0x1d')]=qs[_0xdcdc('0x1d')](_0x24221a['query']['offset']);}_0x12215a[_0xdcdc('0x44')]=qs[_0xdcdc('0x45')](_0x24221a[_0xdcdc('0x2c')][_0xdcdc('0x45')]);_0x12215a['where']=qs[_0xdcdc('0x2d')](_[_0xdcdc('0x46')](_0x24221a['query'],_0x22ef26[_0xdcdc('0x2d')]));if(_0x24221a[_0xdcdc('0x2c')]['filter']){_0x12215a[_0xdcdc('0x47')]=_[_0xdcdc('0x48')](_0x12215a[_0xdcdc('0x47')],{'$or':_['map'](_0x512ee6,function(_0x50f713){if(_0x50f713['type']['key']!==_0xdcdc('0x49')){var _0x2bd0a8={};_0x2bd0a8[_0x50f713[_0xdcdc('0x4a')]]={'$like':'%'+_0x24221a[_0xdcdc('0x2c')][_0xdcdc('0x4b')]+'%'};return _0x2bd0a8;}})});}_0x12215a=_[_0xdcdc('0x48')]({},_0x12215a,_0x24221a[_0xdcdc('0x4c')]);var _0x4ef819={'where':_0x12215a[_0xdcdc('0x47')]};return db[_0xdcdc('0x4d')][_0xdcdc('0x1c')](_0x4ef819)[_0xdcdc('0x22')](function(_0xf17bef){_0x33f59d[_0xdcdc('0x1c')]=_0xf17bef;if(_0x24221a[_0xdcdc('0x2c')]['includeAll']){_0x12215a['include']=[{'all':!![]}];}return db[_0xdcdc('0x4d')][_0xdcdc('0x4e')](_0x12215a);})['then'](function(_0x3b69d7){_0x33f59d[_0xdcdc('0x4f')]=_0x3b69d7;return _0x33f59d;})['then'](respondWithFilteredResult(_0x5c61cb,_0x12215a))['catch'](handleError(_0x5c61cb,null));};exports['show']=function(_0x4eae0a,_0x58fed9){var _0x153ebd={'raw':!![],'where':{'id':_0x4eae0a[_0xdcdc('0x50')]['id']}},_0x4c2eb2={};_0x4c2eb2['model']=_[_0xdcdc('0x2b')](db['CmHopper'][_0xdcdc('0x29')]);_0x4c2eb2[_0xdcdc('0x2c')]=_['keys'](_0x4eae0a[_0xdcdc('0x2c')]);_0x4c2eb2['filters']=_[_0xdcdc('0x2e')](_0x4c2eb2[_0xdcdc('0x2a')],_0x4c2eb2['query']);_0x153ebd['attributes']=_[_0xdcdc('0x2e')](_0x4c2eb2[_0xdcdc('0x2a')],qs['fields'](_0x4eae0a['query'][_0xdcdc('0x3f')]));_0x153ebd['attributes']=_0x153ebd['attributes'][_0xdcdc('0x51')]?_0x153ebd[_0xdcdc('0x40')]:_0x4c2eb2[_0xdcdc('0x2a')];if(_0x4eae0a[_0xdcdc('0x2c')]['includeAll']){_0x153ebd[_0xdcdc('0x52')]=[{'all':!![]}];}_0x153ebd=_[_0xdcdc('0x48')]({},_0x153ebd,_0x4eae0a['options']);return db[_0xdcdc('0x4d')][_0xdcdc('0x53')](_0x153ebd)[_0xdcdc('0x22')](handleEntityNotFound(_0x58fed9,null))[_0xdcdc('0x22')](respondWithResult(_0x58fed9,null))[_0xdcdc('0x54')](handleError(_0x58fed9,null));};exports[_0xdcdc('0x55')]=function(_0x27cc60,_0x59870b){return db[_0xdcdc('0x4d')]['create'](_0x27cc60['body'],{})[_0xdcdc('0x22')](respondWithResult(_0x59870b,0xc9))[_0xdcdc('0x54')](handleError(_0x59870b,null));};exports['update']=function(_0x1f44de,_0x2f7cd8){if(_0x1f44de[_0xdcdc('0x56')]['id']){delete _0x1f44de[_0xdcdc('0x56')]['id'];}return db[_0xdcdc('0x4d')]['find']({'where':{'id':_0x1f44de['params']['id']}})[_0xdcdc('0x22')](handleEntityNotFound(_0x2f7cd8,null))['then'](saveUpdates(_0x1f44de[_0xdcdc('0x56')],null))[_0xdcdc('0x22')](respondWithResult(_0x2f7cd8,null))[_0xdcdc('0x54')](handleError(_0x2f7cd8,null));};exports[_0xdcdc('0x57')]=function(_0x44d066,_0x21bd72){return db[_0xdcdc('0x4d')][_0xdcdc('0x57')]()[_0xdcdc('0x22')](respondWithResult(_0x21bd72,null))[_0xdcdc('0x54')](handleError(_0x21bd72,null));};exports[_0xdcdc('0x23')]=function(_0x22c748,_0x114997){var _0x4bb83d;return db[_0xdcdc('0x4d')][_0xdcdc('0x53')]({'where':{'id':_0x22c748[_0xdcdc('0x50')]['id']}})['then'](handleEntityNotFound(_0x114997,null))['then'](function(_0x5b3492){if(_0x5b3492){return _0x5b3492[_0xdcdc('0x23')]()[_0xdcdc('0x22')](function(_0x453d00){return _0x453d00;});}})[_0xdcdc('0x22')](function(_0x11da90){_0x4bb83d=_0x11da90;if(_0x11da90){if(_0x11da90[_0xdcdc('0x58')]||_0x11da90[_0xdcdc('0x59')]){return db[_0x11da90[_0xdcdc('0x58')]?'VoiceQueue':_0xdcdc('0x5a')][_0xdcdc('0x53')]({'where':{'id':_0x11da90[_0xdcdc('0x58')]?_0x11da90[_0xdcdc('0x58')]:_0x11da90[_0xdcdc('0x59')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x2600a7){var _0x18946b={};if(_0x2600a7){_['merge'](_0x18946b,_['omit'](_0x4bb83d['dataValues'],[_0xdcdc('0x5b'),_0xdcdc('0x5c'),'id']));_0x18946b['state']=0x15;_0x18946b[_0xdcdc('0x5d')]=_0xdcdc('0x5e');_0x18946b['campaign']=_0x2600a7[_0xdcdc('0x26')];_0x18946b[_0xdcdc('0x5f')]=_0x22c748[_0xdcdc('0x60')][_0xdcdc('0x26')];_0x18946b[_0xdcdc('0x61')]=_0x22c748[_0xdcdc('0x60')]['id'];_0x18946b[_0xdcdc('0x5e')]=!![];_0x18946b[_0xdcdc('0x62')]=moment()[_0xdcdc('0x63')](_0xdcdc('0x64'));_0x18946b[_0xdcdc('0x65')]=_0x4bb83d['phone'];_0x18946b[_0xdcdc('0x66')]=_0x4bb83d[_0xdcdc('0x58')]?_0xdcdc('0x67'):'ivr';return db[_0xdcdc('0x68')][_0xdcdc('0x53')]({'where':{'id':_0x18946b[_0xdcdc('0x69')]},'attributes':['firstName','lastName']})[_0xdcdc('0x22')](function(_0x1e6018){if(!_[_0xdcdc('0x6a')](_0x114997)&&!_[_0xdcdc('0x6a')](_0x1e6018[_0xdcdc('0x6b')])){_0x18946b['calleridname']=_0x1e6018[_0xdcdc('0x6b')];if(!_[_0xdcdc('0x6a')](_0x1e6018[_0xdcdc('0x6c')])){_0x18946b[_0xdcdc('0x6d')]+='\x20'+_0x1e6018['lastName'];}}})[_0xdcdc('0x6e')](function(){return db[_0xdcdc('0x6f')]['create'](_0x18946b);});}})['then'](function(){return _0x114997[_0xdcdc('0x1a')](0xcc)[_0xdcdc('0x1b')]();})[_0xdcdc('0x54')](handleError(_0x114997,null));};exports['getPreview']=function(_0x44d240,_0x1d267b,_0x5279ae){var _0x251fac=[];return db[_0xdcdc('0x68')][_0xdcdc('0x57')]()['then'](function(_0x5abb99){_0x251fac=_[_0xdcdc('0x2b')](_0x5abb99);return _0x44d240[_0xdcdc('0x60')]['getVoiceQueues']({'where':{'type':_0xdcdc('0x70'),'dialActive':!![],'dialMethod':_0xdcdc('0x71')},'attributes':['id',_0xdcdc('0x72')],'raw':!![]});})[_0xdcdc('0x22')](function(_0x228eb1){if(_0x228eb1&&_0x228eb1[_0xdcdc('0x51')]){return db['sequelize'][_0xdcdc('0x73')](function(_0x564e0b){var _0xce2a1={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xdcdc('0x63')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x228eb1,'id')},'$or':[{'UserId':null},{'UserId':_0x44d240[_0xdcdc('0x60')]['id']}]};var _0x27b8b2=[];if(_0x44d240[_0xdcdc('0x56')][_0xdcdc('0x74')]&&_0x44d240[_0xdcdc('0x56')]['direction']===_0xdcdc('0x75')){if(!_['isEmpty'](_0x44d240['body'][_0xdcdc('0x76')])){_0xce2a1['id']={'$in':_0x44d240['body'][_0xdcdc('0x76')]};}_0x27b8b2=[[_0xdcdc('0x77'),_0xdcdc('0x78')],[_0xdcdc('0x79'),_0x228eb1[0x0][_0xdcdc('0x72')]==='ASC'?_0xdcdc('0x7a'):_0xdcdc('0x78')],db[_0xdcdc('0x7b')][_0xdcdc('0x7c')](_0xdcdc('0x7d')),['id',_0xdcdc('0x7a')]];}else{if(!_[_0xdcdc('0x7e')](_0x44d240[_0xdcdc('0x56')]['hopperIds'])){_0xce2a1['id']={'$notIn':_0x44d240[_0xdcdc('0x56')][_0xdcdc('0x76')]};}_0x27b8b2=[[_0xdcdc('0x77'),_0xdcdc('0x7a')],['scheduledAt',_0x228eb1[0x0]['dialOrderByScheduledAt']],db[_0xdcdc('0x7b')][_0xdcdc('0x7c')](_0xdcdc('0x7f')),['id',_0xdcdc('0x78')]];}return db[_0xdcdc('0x4d')][_0xdcdc('0x80')]({'attributes':['id',_0xdcdc('0x81')],'where':_0xce2a1,'order':_0x27b8b2,'transaction':_0x564e0b,'lock':_0x564e0b[_0xdcdc('0x82')][_0xdcdc('0x83')],'include':[{'model':db[_0xdcdc('0x68')],'as':_0xdcdc('0x84'),'attributes':_0x251fac,'include':[{'model':db[_0xdcdc('0x85')],'as':_0xdcdc('0x86'),'attributes':['id',_0xdcdc('0x26')]}]},{'model':db['CmList'],'as':_0xdcdc('0x87'),'attributes':['id',_0xdcdc('0x26')]},{'model':db['VoiceQueue'],'as':_0xdcdc('0x88'),'attributes':['id',_0xdcdc('0x26'),_0xdcdc('0x89')]}]})[_0xdcdc('0x22')](function(_0x14242c){if(_0x14242c){return _0x14242c[_0xdcdc('0x21')]({'UserId':_0x44d240[_0xdcdc('0x60')]['id']},{'transaction':_0x564e0b});}});});}})[_0xdcdc('0x22')](handleEntityNotFound(_0x1d267b,null))[_0xdcdc('0x22')](respondWithResult(_0x1d267b,null))[_0xdcdc('0x54')](handleError(_0x1d267b,null));};exports['getOpenContacts']=function(_0x456ace,_0xdbd330,_0x1cd42a){return _0x456ace[_0xdcdc('0x60')][_0xdcdc('0x8a')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xdcdc('0x22')](function(_0x17b906){if(_0x17b906&&_0x17b906[_0xdcdc('0x51')]){return db['CmHopper'][_0xdcdc('0x1c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xdcdc('0x63')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xdcdc('0x8b')](_0x17b906,'id')},'$or':[{'UserId':null},{'UserId':_0x456ace['user']['id']}]}});}return 0x0;})['then'](function(_0x196205){if(!_['isNil'](_0x196205)&&_[_0xdcdc('0x8c')](_0x196205)){return _0xdbd330[_0xdcdc('0x1a')](0xc8)[_0xdcdc('0x8d')]({'contacts':_0x196205});}else{logger[_0xdcdc('0x24')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xdcdc('0x8e'),0x194,_0xdcdc('0x8f'));_0xdbd330[_0xdcdc('0x19')](0x194);}})[_0xdcdc('0x54')](handleError(_0xdbd330,null));}; \ No newline at end of file +var _0x8b6a=['format','calleridnum','campaigntype','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','YYYY-MM-DD\x20HH:mm:ss','map','direction','isEmpty','hopperIds','priority','scheduledAt','ASC','literal','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','CmContact','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','save','update','destroy','error','stack','name','send','index','rawAttributes','keys','intersection','model','query','filters','concat','$and','$or','$gt','$lt','$lte','$ne','$not','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','key','field','options','count','then','include','CmHopper','findAll','rows','catch','show','params','includeAll','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','state','deleted','campaign','membername','user','deletedat'];(function(_0x2c4260,_0x19882c){var _0x13972e=function(_0x3e7fe6){while(--_0x3e7fe6){_0x2c4260['push'](_0x2c4260['shift']());}};_0x13972e(++_0x19882c);}(_0x8b6a,0xbc));var _0xa8b6=function(_0xa7a148,_0x801ca5){_0xa7a148=_0xa7a148-0x0;var _0x1166f9=_0x8b6a[_0xa7a148];return _0x1166f9;};'use strict';var pdf=require(_0xa8b6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa8b6('0x1'));var zipdir=require(_0xa8b6('0x2'));var jsonpatch=require(_0xa8b6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa8b6('0x4'));var Mustache=require(_0xa8b6('0x5'));var util=require(_0xa8b6('0x6'));var path=require('path');var sox=require(_0xa8b6('0x7'));var csv=require(_0xa8b6('0x8'));var ejs=require(_0xa8b6('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa8b6('0xa'));var crypto=require(_0xa8b6('0xb'));var jsforce=require(_0xa8b6('0xc'));var deskjs=require(_0xa8b6('0xd'));var toCsv=require(_0xa8b6('0x8'));var querystring=require(_0xa8b6('0xe'));var Papa=require('papaparse');var authService=require(_0xa8b6('0xf'));var hardwareService=require(_0xa8b6('0x10'));var Redis=require(_0xa8b6('0x11'));var qs=require(_0xa8b6('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xa8b6('0x13'))['db'];function respondWithStatusCode(_0x55894b,_0x151e63){_0x151e63=_0x151e63||0xcc;return function(_0x4c4bb1){if(_0x4c4bb1){return _0x55894b[_0xa8b6('0x14')](_0x151e63);}return _0x55894b['status'](_0x151e63)[_0xa8b6('0x15')]();};}function respondWithResult(_0x3eaf64,_0x27f498){_0x27f498=_0x27f498||0xc8;return function(_0x2733b4){if(_0x2733b4){return _0x3eaf64[_0xa8b6('0x16')](_0x27f498)[_0xa8b6('0x17')](_0x2733b4);}};}function respondWithFilteredResult(_0x10bc7d,_0x1a515f){return function(_0x373c95){if(_0x373c95){var _0x7f195f=_0x373c95['count'],_0x52dec4=_0x1a515f['offset'],_0x56e0dc=_0x1a515f[_0xa8b6('0x18')]+_0x1a515f[_0xa8b6('0x19')],_0x4c293b;if(_0x56e0dc>=_0x7f195f){_0x56e0dc=_0x7f195f;_0x4c293b=0xc8;}else{_0x4c293b=0xce;}_0x10bc7d[_0xa8b6('0x16')](_0x4c293b);return _0x10bc7d[_0xa8b6('0x1a')](_0xa8b6('0x1b'),_0x52dec4+'-'+_0x56e0dc+'/'+_0x7f195f)[_0xa8b6('0x17')](_0x373c95);}return null;};}function patchUpdates(_0x21e7f1){return function(_0x10a993){try{jsonpatch['apply'](_0x10a993,_0x21e7f1,!![]);}catch(_0x3bd73a){return BPromise[_0xa8b6('0x1c')](_0x3bd73a);}return _0x10a993[_0xa8b6('0x1d')]();};}function saveUpdates(_0x39dbd4,_0x392055){return function(_0x1eed20){if(_0x1eed20){return _0x1eed20[_0xa8b6('0x1e')](_0x39dbd4)['then'](function(_0xa0cf74){return _0xa0cf74;});}return null;};}function removeEntity(_0x1ad503,_0x22aebd){return function(_0x41957a){if(_0x41957a){return _0x41957a[_0xa8b6('0x1f')]()['then'](function(){_0x1ad503[_0xa8b6('0x16')](0xcc)[_0xa8b6('0x15')]();});}};}function handleEntityNotFound(_0x5c048d,_0x5ae067){return function(_0x24d0e9){if(!_0x24d0e9){_0x5c048d[_0xa8b6('0x14')](0x194);}return _0x24d0e9;};}function handleError(_0x4b3b7a,_0x1942fb){_0x1942fb=_0x1942fb||0x1f4;return function(_0x55d1f6){logger[_0xa8b6('0x20')](_0x55d1f6[_0xa8b6('0x21')]);if(_0x55d1f6['name']){delete _0x55d1f6[_0xa8b6('0x22')];}_0x4b3b7a['status'](_0x1942fb)[_0xa8b6('0x23')](_0x55d1f6);};}exports[_0xa8b6('0x24')]=function(_0x1c4cde,_0x32a718){var _0x28d7d5={},_0x2c7c26={},_0x3607e5={'count':0x0,'rows':[]};var _0x44b91f=db['CmHopper'][_0xa8b6('0x25')];_0x2c7c26['model']=_[_0xa8b6('0x26')](_0x44b91f);_0x2c7c26['query']=_[_0xa8b6('0x26')](_0x1c4cde['query']);_0x2c7c26['filters']=_[_0xa8b6('0x27')](_0x2c7c26[_0xa8b6('0x28')],_0x2c7c26[_0xa8b6('0x29')]);_0x2c7c26[_0xa8b6('0x2a')]=_[_0xa8b6('0x2b')](_0x2c7c26[_0xa8b6('0x2a')],[_0xa8b6('0x2c'),_0xa8b6('0x2d'),_0xa8b6('0x2e'),'$gte',_0xa8b6('0x2f'),_0xa8b6('0x30'),_0xa8b6('0x31'),'$eq',_0xa8b6('0x32'),_0xa8b6('0x33'),_0xa8b6('0x34'),'$in',_0xa8b6('0x35'),_0xa8b6('0x36'),_0xa8b6('0x37'),_0xa8b6('0x38'),_0xa8b6('0x39'),'$like',_0xa8b6('0x3a'),_0xa8b6('0x3b'),_0xa8b6('0x3c'),_0xa8b6('0x3d')]);_0x28d7d5[_0xa8b6('0x3e')]=_['intersection'](_0x2c7c26['model'],qs[_0xa8b6('0x3f')](_0x1c4cde[_0xa8b6('0x29')]['fields']));_0x28d7d5[_0xa8b6('0x3e')]=_0x28d7d5['attributes'][_0xa8b6('0x40')]?_0x28d7d5['attributes']:_0x2c7c26[_0xa8b6('0x28')];if(!_0x1c4cde[_0xa8b6('0x29')][_0xa8b6('0x41')](_0xa8b6('0x42'))){_0x28d7d5[_0xa8b6('0x19')]=qs[_0xa8b6('0x19')](_0x1c4cde[_0xa8b6('0x29')][_0xa8b6('0x19')]);_0x28d7d5[_0xa8b6('0x18')]=qs['offset'](_0x1c4cde[_0xa8b6('0x29')][_0xa8b6('0x18')]);}_0x28d7d5[_0xa8b6('0x43')]=qs[_0xa8b6('0x44')](_0x1c4cde['query'][_0xa8b6('0x44')]);_0x28d7d5[_0xa8b6('0x45')]=qs['filters'](_[_0xa8b6('0x46')](_0x1c4cde[_0xa8b6('0x29')],_0x2c7c26[_0xa8b6('0x2a')]));if(_0x1c4cde[_0xa8b6('0x29')]['filter']){_0x28d7d5[_0xa8b6('0x45')]=_[_0xa8b6('0x47')](_0x28d7d5[_0xa8b6('0x45')],{'$or':_['map'](_0x44b91f,function(_0x41cfb9){if(_0x41cfb9['type'][_0xa8b6('0x48')]!=='VIRTUAL'){var _0x53ba5b={};_0x53ba5b[_0x41cfb9[_0xa8b6('0x49')]]={'$like':'%'+_0x1c4cde[_0xa8b6('0x29')]['filter']+'%'};return _0x53ba5b;}})});}_0x28d7d5=_[_0xa8b6('0x47')]({},_0x28d7d5,_0x1c4cde[_0xa8b6('0x4a')]);var _0x264c7b={'where':_0x28d7d5[_0xa8b6('0x45')]};return db['CmHopper'][_0xa8b6('0x4b')](_0x264c7b)[_0xa8b6('0x4c')](function(_0xa095ee){_0x3607e5[_0xa8b6('0x4b')]=_0xa095ee;if(_0x1c4cde[_0xa8b6('0x29')]['includeAll']){_0x28d7d5[_0xa8b6('0x4d')]=[{'all':!![]}];}return db[_0xa8b6('0x4e')][_0xa8b6('0x4f')](_0x28d7d5);})[_0xa8b6('0x4c')](function(_0x59aa44){_0x3607e5[_0xa8b6('0x50')]=_0x59aa44;return _0x3607e5;})[_0xa8b6('0x4c')](respondWithFilteredResult(_0x32a718,_0x28d7d5))[_0xa8b6('0x51')](handleError(_0x32a718,null));};exports[_0xa8b6('0x52')]=function(_0x137c7e,_0x3f055b){var _0xbeba73={'raw':!![],'where':{'id':_0x137c7e[_0xa8b6('0x53')]['id']}},_0x474c56={};_0x474c56['model']=_['keys'](db[_0xa8b6('0x4e')]['rawAttributes']);_0x474c56[_0xa8b6('0x29')]=_[_0xa8b6('0x26')](_0x137c7e[_0xa8b6('0x29')]);_0x474c56['filters']=_[_0xa8b6('0x27')](_0x474c56[_0xa8b6('0x28')],_0x474c56[_0xa8b6('0x29')]);_0xbeba73[_0xa8b6('0x3e')]=_['intersection'](_0x474c56[_0xa8b6('0x28')],qs[_0xa8b6('0x3f')](_0x137c7e[_0xa8b6('0x29')][_0xa8b6('0x3f')]));_0xbeba73[_0xa8b6('0x3e')]=_0xbeba73[_0xa8b6('0x3e')][_0xa8b6('0x40')]?_0xbeba73[_0xa8b6('0x3e')]:_0x474c56[_0xa8b6('0x28')];if(_0x137c7e[_0xa8b6('0x29')][_0xa8b6('0x54')]){_0xbeba73[_0xa8b6('0x4d')]=[{'all':!![]}];}_0xbeba73=_[_0xa8b6('0x47')]({},_0xbeba73,_0x137c7e[_0xa8b6('0x4a')]);return db[_0xa8b6('0x4e')][_0xa8b6('0x55')](_0xbeba73)[_0xa8b6('0x4c')](handleEntityNotFound(_0x3f055b,null))['then'](respondWithResult(_0x3f055b,null))[_0xa8b6('0x51')](handleError(_0x3f055b,null));};exports[_0xa8b6('0x56')]=function(_0x13e2c9,_0x39bdaa){return db[_0xa8b6('0x4e')][_0xa8b6('0x56')](_0x13e2c9[_0xa8b6('0x57')],{})[_0xa8b6('0x4c')](respondWithResult(_0x39bdaa,0xc9))[_0xa8b6('0x51')](handleError(_0x39bdaa,null));};exports[_0xa8b6('0x1e')]=function(_0x529199,_0x201d85){if(_0x529199[_0xa8b6('0x57')]['id']){delete _0x529199[_0xa8b6('0x57')]['id'];}return db[_0xa8b6('0x4e')][_0xa8b6('0x55')]({'where':{'id':_0x529199[_0xa8b6('0x53')]['id']}})[_0xa8b6('0x4c')](handleEntityNotFound(_0x201d85,null))[_0xa8b6('0x4c')](saveUpdates(_0x529199['body'],null))['then'](respondWithResult(_0x201d85,null))[_0xa8b6('0x51')](handleError(_0x201d85,null));};exports[_0xa8b6('0x58')]=function(_0x544a96,_0x5670c6){return db[_0xa8b6('0x4e')][_0xa8b6('0x58')]()[_0xa8b6('0x4c')](respondWithResult(_0x5670c6,null))[_0xa8b6('0x51')](handleError(_0x5670c6,null));};exports[_0xa8b6('0x1f')]=function(_0x4e6a47,_0x4cbcc3){var _0x1e6b7e;return db[_0xa8b6('0x4e')][_0xa8b6('0x55')]({'where':{'id':_0x4e6a47['params']['id']}})[_0xa8b6('0x4c')](handleEntityNotFound(_0x4cbcc3,null))[_0xa8b6('0x4c')](function(_0x157b44){if(_0x157b44){return _0x157b44[_0xa8b6('0x1f')]()['then'](function(_0x271bdc){return _0x271bdc;});}})[_0xa8b6('0x4c')](function(_0x1f7825){_0x1e6b7e=_0x1f7825;if(_0x1f7825){if(_0x1f7825[_0xa8b6('0x59')]||_0x1f7825[_0xa8b6('0x5a')]){return db[_0x1f7825[_0xa8b6('0x59')]?_0xa8b6('0x5b'):'Campaign'][_0xa8b6('0x55')]({'where':{'id':_0x1f7825[_0xa8b6('0x59')]?_0x1f7825[_0xa8b6('0x59')]:_0x1f7825[_0xa8b6('0x5a')]},'attributes':['id',_0xa8b6('0x22')],'raw':!![]});}}})['then'](function(_0x3c58c0){var _0xce948a={};if(_0x3c58c0){_[_0xa8b6('0x47')](_0xce948a,_[_0xa8b6('0x5c')](_0x1e6b7e[_0xa8b6('0x5d')],['createdAt','updatedAt','id']));_0xce948a[_0xa8b6('0x5e')]=0x15;_0xce948a['statedesc']=_0xa8b6('0x5f');_0xce948a[_0xa8b6('0x60')]=_0x3c58c0[_0xa8b6('0x22')];_0xce948a[_0xa8b6('0x61')]=_0x4e6a47[_0xa8b6('0x62')]['name'];_0xce948a['UserId']=_0x4e6a47[_0xa8b6('0x62')]['id'];_0xce948a[_0xa8b6('0x5f')]=!![];_0xce948a[_0xa8b6('0x63')]=moment()[_0xa8b6('0x64')]('YYYY-MM-DD\x20HH:mm:ss');_0xce948a[_0xa8b6('0x65')]=_0x1e6b7e['phone'];_0xce948a[_0xa8b6('0x66')]=_0x1e6b7e[_0xa8b6('0x59')]?_0xa8b6('0x67'):_0xa8b6('0x68');return db['CmContact'][_0xa8b6('0x55')]({'where':{'id':_0xce948a[_0xa8b6('0x69')]},'attributes':[_0xa8b6('0x6a'),_0xa8b6('0x6b')]})[_0xa8b6('0x4c')](function(_0x405587){if(!_['isNil'](_0x4cbcc3)&&!_[_0xa8b6('0x6c')](_0x405587[_0xa8b6('0x6a')])){_0xce948a['calleridname']=_0x405587[_0xa8b6('0x6a')];if(!_[_0xa8b6('0x6c')](_0x405587[_0xa8b6('0x6b')])){_0xce948a[_0xa8b6('0x6d')]+='\x20'+_0x405587[_0xa8b6('0x6b')];}}})[_0xa8b6('0x6e')](function(){return db[_0xa8b6('0x6f')]['create'](_0xce948a);});}})[_0xa8b6('0x4c')](function(){return _0x4cbcc3[_0xa8b6('0x16')](0xcc)[_0xa8b6('0x15')]();})[_0xa8b6('0x51')](handleError(_0x4cbcc3,null));};exports[_0xa8b6('0x70')]=function(_0x5ef578,_0x57886a,_0x5b040a){var _0xd9bc22=[];return db['CmContact'][_0xa8b6('0x58')]()[_0xa8b6('0x4c')](function(_0x5bb979){_0xd9bc22=_[_0xa8b6('0x26')](_0x5bb979);return _0x5ef578[_0xa8b6('0x62')][_0xa8b6('0x71')]({'where':{'type':_0xa8b6('0x72'),'dialActive':!![],'dialMethod':_0xa8b6('0x73')},'attributes':['id',_0xa8b6('0x74')],'raw':!![]});})[_0xa8b6('0x4c')](function(_0x53c33b){if(_0x53c33b&&_0x53c33b[_0xa8b6('0x40')]){return db[_0xa8b6('0x75')]['transaction'](function(_0x65989d){var _0x4cce0d={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa8b6('0x64')](_0xa8b6('0x76'))},'VoiceQueueId':{'$in':_[_0xa8b6('0x77')](_0x53c33b,'id')},'$or':[{'UserId':null},{'UserId':_0x5ef578[_0xa8b6('0x62')]['id']}]};var _0x5c4d17=[];if(_0x5ef578[_0xa8b6('0x57')][_0xa8b6('0x78')]&&_0x5ef578['body'][_0xa8b6('0x78')]==='prev'){if(!_[_0xa8b6('0x79')](_0x5ef578[_0xa8b6('0x57')][_0xa8b6('0x7a')])){_0x4cce0d['id']={'$in':_0x5ef578['body'][_0xa8b6('0x7a')]};}_0x5c4d17=[[_0xa8b6('0x7b'),'ASC'],[_0xa8b6('0x7c'),_0x53c33b[0x0]['dialOrderByScheduledAt']===_0xa8b6('0x7d')?'DESC':'ASC'],db['sequelize'][_0xa8b6('0x7e')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xa8b6('0x7f')]];}else{if(!_[_0xa8b6('0x79')](_0x5ef578[_0xa8b6('0x57')][_0xa8b6('0x7a')])){_0x4cce0d['id']={'$notIn':_0x5ef578[_0xa8b6('0x57')][_0xa8b6('0x7a')]};}_0x5c4d17=[[_0xa8b6('0x7b'),_0xa8b6('0x7f')],['scheduledAt',_0x53c33b[0x0][_0xa8b6('0x74')]],db[_0xa8b6('0x75')]['literal'](_0xa8b6('0x80')),['id',_0xa8b6('0x7d')]];}return db[_0xa8b6('0x4e')][_0xa8b6('0x81')]({'attributes':['id',_0xa8b6('0x82')],'where':_0x4cce0d,'order':_0x5c4d17,'transaction':_0x65989d,'lock':_0x65989d[_0xa8b6('0x83')][_0xa8b6('0x84')],'include':[{'model':db[_0xa8b6('0x85')],'as':_0xa8b6('0x86'),'attributes':_0xd9bc22,'include':[{'model':db[_0xa8b6('0x87')],'as':_0xa8b6('0x88'),'attributes':['id',_0xa8b6('0x22')]}]},{'model':db[_0xa8b6('0x89')],'as':_0xa8b6('0x8a'),'attributes':['id',_0xa8b6('0x22')]},{'model':db[_0xa8b6('0x5b')],'as':_0xa8b6('0x8b'),'attributes':['id',_0xa8b6('0x22'),_0xa8b6('0x8c')]}]})[_0xa8b6('0x4c')](function(_0x5a10a8){if(_0x5a10a8){return _0x5a10a8['update']({'UserId':_0x5ef578[_0xa8b6('0x62')]['id']},{'transaction':_0x65989d});}});});}})['then'](handleEntityNotFound(_0x57886a,null))[_0xa8b6('0x4c')](respondWithResult(_0x57886a,null))[_0xa8b6('0x51')](handleError(_0x57886a,null));};exports[_0xa8b6('0x8d')]=function(_0xc62b53,_0x5792e8,_0x5f39b1){return _0xc62b53[_0xa8b6('0x62')][_0xa8b6('0x71')]({'where':{'type':_0xa8b6('0x72'),'dialActive':!![],'dialMethod':_0xa8b6('0x73')},'attributes':['id'],'raw':!![]})[_0xa8b6('0x4c')](function(_0x533430){if(_0x533430&&_0x533430[_0xa8b6('0x40')]){return db[_0xa8b6('0x4e')][_0xa8b6('0x4b')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa8b6('0x64')](_0xa8b6('0x76'))},'VoiceQueueId':{'$in':_[_0xa8b6('0x77')](_0x533430,'id')},'$or':[{'UserId':null},{'UserId':_0xc62b53[_0xa8b6('0x62')]['id']}]}});}return 0x0;})['then'](function(_0x1bfd36){if(!_[_0xa8b6('0x6c')](_0x1bfd36)&&_[_0xa8b6('0x8e')](_0x1bfd36)){return _0x5792e8[_0xa8b6('0x16')](0xc8)[_0xa8b6('0x17')]({'contacts':_0x1bfd36});}else{logger['error'](_0xa8b6('0x8f'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x5792e8[_0xa8b6('0x14')](0x194);}})[_0xa8b6('0x51')](handleError(_0x5792e8,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index edd77e1..4e6de4c 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 _0xd20b=['priority','lodash','util','../../config/logger','api','moment','bluebird','./cmHopper.attributes','exports','cm_hopper','scheduledat','phone'];(function(_0xb27e6f,_0x128917){var _0x247dd2=function(_0xb0d655){while(--_0xb0d655){_0xb27e6f['push'](_0xb27e6f['shift']());}};_0x247dd2(++_0x128917);}(_0xd20b,0x175));var _0xbd20=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0xd20b[_0x503950];return _0x1657a9;};'use strict';var _=require(_0xbd20('0x0'));var util=require(_0xbd20('0x1'));var logger=require(_0xbd20('0x2'))(_0xbd20('0x3'));var moment=require(_0xbd20('0x4'));var BPromise=require(_0xbd20('0x5'));var rp=require('request-promise');var attributes=require(_0xbd20('0x6'));module[_0xbd20('0x7')]=function(_0x2cbbbf,_0xe61c51){return _0x2cbbbf['define']('CmHopper',attributes,{'tableName':_0xbd20('0x8'),'paranoid':![],'indexes':[{'name':_0xbd20('0x9'),'fields':['scheduledat']},{'name':_0xbd20('0xa'),'fields':[_0xbd20('0xa')]},{'name':_0xbd20('0xb'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3609=['phone','priority','util','../../config/logger','api','bluebird','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat'];(function(_0x5b1c7c,_0x59def9){var _0x975d48=function(_0x533ccc){while(--_0x533ccc){_0x5b1c7c['push'](_0x5b1c7c['shift']());}};_0x975d48(++_0x59def9);}(_0x3609,0x1d6));var _0x9360=function(_0x5496b3,_0x237988){_0x5496b3=_0x5496b3-0x0;var _0x358681=_0x3609[_0x5496b3];return _0x358681;};'use strict';var _=require('lodash');var util=require(_0x9360('0x0'));var logger=require(_0x9360('0x1'))(_0x9360('0x2'));var moment=require('moment');var BPromise=require(_0x9360('0x3'));var rp=require('request-promise');var attributes=require(_0x9360('0x4'));module[_0x9360('0x5')]=function(_0x28abb3,_0x22dd2d){return _0x28abb3[_0x9360('0x6')](_0x9360('0x7'),attributes,{'tableName':_0x9360('0x8'),'paranoid':![],'indexes':[{'name':_0x9360('0x9'),'fields':[_0x9360('0x9')]},{'name':_0x9360('0xa'),'fields':['phone']},{'name':'priority','fields':[_0x9360('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 0333780..8e4002f 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 _0xa535=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetCmHopper','CmHopper','findAll','raw','options','where','attributes','map','model','include','catch','ShowCmHopper','CreateCmHopper','create','body','update','limit','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','UPDATE','Contact','keys','length','CmHopperFinal','MoveContactManagedDialer','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','order','UserId','LOCK','push','all','lodash','util'];(function(_0x3fa1fc,_0x591dc7){var _0x185018=function(_0x3a5bf2){while(--_0x3a5bf2){_0x3fa1fc['push'](_0x3fa1fc['shift']());}};_0x185018(++_0x591dc7);}(_0xa535,0x10a));var _0x5a53=function(_0x209d38,_0x1e2ec3){_0x209d38=_0x209d38-0x0;var _0xf9030d=_0xa535[_0x209d38];return _0xf9030d;};'use strict';var _=require(_0x5a53('0x0'));var util=require(_0x5a53('0x1'));var moment=require(_0x5a53('0x2'));var BPromise=require(_0x5a53('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5a53('0x4'));var db=require(_0x5a53('0x5'))['db'];var utils=require(_0x5a53('0x6'));var logger=require(_0x5a53('0x7'))(_0x5a53('0x8'));var config=require(_0x5a53('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5a53('0xa')][_0x5a53('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18ab45,_0x15b012,_0xcc0c86){return new BPromise(function(_0x1d9d39,_0x1b858a){return client[_0x5a53('0xc')](_0x18ab45,_0xcc0c86)[_0x5a53('0xd')](function(_0x33a05e){logger['info'](_0x5a53('0xe'),_0x15b012,_0x5a53('0xf'));logger[_0x5a53('0x10')](_0x5a53('0x11'),_0x15b012,_0x5a53('0xf'),JSON[_0x5a53('0x12')](_0x33a05e));if(_0x33a05e[_0x5a53('0x13')]){if(_0x33a05e[_0x5a53('0x13')][_0x5a53('0x14')]===0x1f4){logger[_0x5a53('0x13')](_0x5a53('0xe'),_0x15b012,_0x33a05e['error']['message']);return _0x1b858a(_0x33a05e['error'][_0x5a53('0x15')]);}logger[_0x5a53('0x13')](_0x5a53('0xe'),_0x15b012,_0x33a05e[_0x5a53('0x13')]['message']);return _0x1d9d39(_0x33a05e[_0x5a53('0x13')]['message']);}else{logger[_0x5a53('0x16')](_0x5a53('0xe'),_0x15b012,'request\x20sent');_0x1d9d39(_0x33a05e[_0x5a53('0x17')]['message']);}})['catch'](function(_0x58ac09){logger[_0x5a53('0x13')](_0x5a53('0xe'),_0x15b012,_0x58ac09);_0x1b858a(_0x58ac09);});});}exports[_0x5a53('0x18')]=function(_0x3ea699){var _0x360182=this;return new Promise(function(_0x52922d,_0xe7def){return db[_0x5a53('0x19')][_0x5a53('0x1a')]({'raw':_0x3ea699['options']?_0x3ea699['options'][_0x5a53('0x1b')]===undefined?!![]:![]:!![],'where':_0x3ea699['options']?_0x3ea699[_0x5a53('0x1c')][_0x5a53('0x1d')]||null:null,'attributes':_0x3ea699[_0x5a53('0x1c')]?_0x3ea699['options'][_0x5a53('0x1e')]||null:null,'limit':_0x3ea699[_0x5a53('0x1c')]?_0x3ea699[_0x5a53('0x1c')]['limit']||null:null,'include':_0x3ea699[_0x5a53('0x1c')]?_0x3ea699[_0x5a53('0x1c')]['include']?_[_0x5a53('0x1f')](_0x3ea699[_0x5a53('0x1c')]['include'],function(_0x16dd90){return{'model':db[_0x16dd90[_0x5a53('0x20')]],'as':_0x16dd90['as'],'attributes':_0x16dd90[_0x5a53('0x1e')],'include':_0x16dd90[_0x5a53('0x21')]?_[_0x5a53('0x1f')](_0x16dd90['include'],function(_0x39266f){return{'model':db[_0x39266f[_0x5a53('0x20')]],'as':_0x39266f['as'],'attributes':_0x39266f[_0x5a53('0x1e')],'include':_0x39266f[_0x5a53('0x21')]?_[_0x5a53('0x1f')](_0x39266f[_0x5a53('0x21')],function(_0x820eff){return{'model':db[_0x820eff['model']],'as':_0x820eff['as'],'attributes':_0x820eff['attributes']};}):[]};}):[]};}):[]:[]})[_0x5a53('0xd')](function(_0x577835){logger[_0x5a53('0x16')]('GetCmHopper',_0x3ea699);logger[_0x5a53('0x10')](_0x5a53('0x18'),_0x3ea699,JSON[_0x5a53('0x12')](_0x577835));_0x52922d(_0x577835);})[_0x5a53('0x22')](function(_0x34786d){logger['error'](_0x5a53('0x18'),_0x34786d[_0x5a53('0x15')],_0x3ea699);_0xe7def(_0x360182['error'](0x1f4,_0x34786d[_0x5a53('0x15')]));});});};exports[_0x5a53('0x23')]=function(_0x24ed20){var _0x1532e1=this;return new Promise(function(_0x4cb8cd,_0x234518){return db['CmHopper']['find']({'raw':_0x24ed20['options']?_0x24ed20[_0x5a53('0x1c')][_0x5a53('0x1b')]===undefined?!![]:![]:!![],'where':_0x24ed20[_0x5a53('0x1c')]?_0x24ed20[_0x5a53('0x1c')]['where']||null:null,'attributes':_0x24ed20[_0x5a53('0x1c')]?_0x24ed20[_0x5a53('0x1c')][_0x5a53('0x1e')]||null:null,'include':_0x24ed20['options']?_0x24ed20['options'][_0x5a53('0x21')]?_[_0x5a53('0x1f')](_0x24ed20[_0x5a53('0x1c')][_0x5a53('0x21')],function(_0x8606f1){return{'model':db[_0x8606f1[_0x5a53('0x20')]],'as':_0x8606f1['as'],'attributes':_0x8606f1[_0x5a53('0x1e')],'include':_0x8606f1[_0x5a53('0x21')]?_[_0x5a53('0x1f')](_0x8606f1[_0x5a53('0x21')],function(_0x4beb7a){return{'model':db[_0x4beb7a['model']],'as':_0x4beb7a['as'],'attributes':_0x4beb7a[_0x5a53('0x1e')],'include':_0x4beb7a[_0x5a53('0x21')]?_[_0x5a53('0x1f')](_0x4beb7a['include'],function(_0x56d9df){return{'model':db[_0x56d9df[_0x5a53('0x20')]],'as':_0x56d9df['as'],'attributes':_0x56d9df[_0x5a53('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5a53('0xd')](function(_0x5c97db){logger[_0x5a53('0x16')](_0x5a53('0x23'),_0x24ed20);logger[_0x5a53('0x10')](_0x5a53('0x23'),_0x24ed20,JSON[_0x5a53('0x12')](_0x5c97db));_0x4cb8cd(_0x5c97db);})[_0x5a53('0x22')](function(_0x5db58d){logger['error'](_0x5a53('0x23'),_0x5db58d[_0x5a53('0x15')],_0x24ed20);_0x234518(_0x1532e1[_0x5a53('0x13')](0x1f4,_0x5db58d['message']));});});};exports[_0x5a53('0x24')]=function(_0x1fcf89){var _0xc6e80b=this;return new Promise(function(_0xa579d5,_0x14dae8){return db[_0x5a53('0x19')][_0x5a53('0x25')](_0x1fcf89[_0x5a53('0x26')],{'raw':_0x1fcf89[_0x5a53('0x1c')]?_0x1fcf89['options'][_0x5a53('0x1b')]===undefined?!![]:![]:!![]})[_0x5a53('0xd')](function(_0xb14712){logger['info']('CreateCmHopper',_0x1fcf89);logger[_0x5a53('0x10')](_0x5a53('0x24'),_0x1fcf89,JSON[_0x5a53('0x12')](_0xb14712));_0xa579d5(_0xb14712);})[_0x5a53('0x22')](function(_0x55e275){logger[_0x5a53('0x13')]('CreateCmHopper',_0x55e275[_0x5a53('0x15')],_0x1fcf89);_0x14dae8(_0xc6e80b['error'](0x1f4,_0x55e275[_0x5a53('0x15')]));});});};exports['UpdateCmHopper']=function(_0x14e42d){var _0x451eee=this;return new Promise(function(_0x2f5a89,_0x333313){return db['CmHopper'][_0x5a53('0x27')](_0x14e42d[_0x5a53('0x26')],{'raw':_0x14e42d[_0x5a53('0x1c')]?_0x14e42d[_0x5a53('0x1c')][_0x5a53('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14e42d[_0x5a53('0x1c')]?_0x14e42d['options'][_0x5a53('0x1d')]||null:null,'attributes':_0x14e42d[_0x5a53('0x1c')]?_0x14e42d[_0x5a53('0x1c')]['attributes']||null:null,'limit':_0x14e42d['options']?_0x14e42d['options'][_0x5a53('0x28')]||null:null})[_0x5a53('0xd')](function(_0x2921a5){logger[_0x5a53('0x16')](_0x5a53('0x29'),_0x14e42d);logger['debug'](_0x5a53('0x29'),_0x14e42d,JSON['stringify'](_0x2921a5));_0x2f5a89(_0x2921a5);})['catch'](function(_0x575b18){logger[_0x5a53('0x13')](_0x5a53('0x29'),_0x575b18[_0x5a53('0x15')],_0x14e42d);_0x333313(_0x451eee[_0x5a53('0x13')](0x1f4,_0x575b18['message']));});});};exports[_0x5a53('0x2a')]=function(_0x925121){var _0x199938=this;return new Promise(function(_0x33e5cc,_0x32421c){return db[_0x5a53('0x19')][_0x5a53('0x2b')]({'where':_0x925121[_0x5a53('0x1c')]?_0x925121[_0x5a53('0x1c')]['where']||null:null})[_0x5a53('0xd')](function(_0x4fb52d){logger[_0x5a53('0x16')](_0x5a53('0x2a'),_0x925121);logger[_0x5a53('0x10')](_0x5a53('0x2a'),_0x925121,JSON[_0x5a53('0x12')](_0x4fb52d));_0x33e5cc(_0x4fb52d);})[_0x5a53('0x22')](function(_0x5a93dc){logger[_0x5a53('0x13')]('DestroyCmHopper',_0x5a93dc[_0x5a53('0x15')],_0x925121);_0x32421c(_0x199938[_0x5a53('0x13')](0x1f4,_0x5a93dc['message']));});});};exports[_0x5a53('0x2c')]=function(_0x2b4e81){var _0x3e84d1=this;return new Promise(function(_0x62e1ad,_0x112989){return db[_0x5a53('0x2d')][_0x5a53('0x2e')]()[_0x5a53('0xd')](function(_0x136da3){return db[_0x5a53('0x2f')][_0x5a53('0x30')](function(_0x132156){return db[_0x5a53('0x19')]['findAll']({'where':_0x2b4e81['options']?_0x2b4e81[_0x5a53('0x1c')][_0x5a53('0x1d')]||null:null,'attributes':_0x2b4e81['options']?_0x2b4e81[_0x5a53('0x1c')]['attributes']||null:null,'limit':_0x2b4e81[_0x5a53('0x1c')]?_0x2b4e81[_0x5a53('0x1c')][_0x5a53('0x28')]||null:null,'order':_0x2b4e81[_0x5a53('0x1c')]?_0x2b4e81[_0x5a53('0x1c')]['order']||null:null,'transaction':_0x132156,'lock':_0x132156['LOCK'][_0x5a53('0x31')],'include':[{'model':db[_0x5a53('0x2d')],'as':_0x5a53('0x32'),'attributes':_[_0x5a53('0x33')](_0x136da3)}]})['then'](function(_0xa72355){var _0x19b0aa=[];for(var _0x317167=0x0;_0x317167<_0xa72355[_0x5a53('0x34')];_0x317167+=0x1){_0x19b0aa['push'](_0xa72355[_0x317167][_0x5a53('0x27')](_0x2b4e81[_0x5a53('0x26')],{'transaction':_0x132156}));}return BPromise['all'](_0x19b0aa);});})[_0x5a53('0xd')](function(_0x2e3076){logger[_0x5a53('0x16')](_0x5a53('0x2c'),_0x2b4e81);logger[_0x5a53('0x10')](_0x5a53('0x2c'),_0x2b4e81,JSON[_0x5a53('0x12')](_0x2e3076));_0x62e1ad(_0x2e3076);})['catch'](function(_0x4ebffd){logger[_0x5a53('0x13')](_0x5a53('0x2c'),_0x4ebffd[_0x5a53('0x15')],_0x2b4e81);_0x112989(_0x3e84d1[_0x5a53('0x13')](0x1f4,_0x4ebffd[_0x5a53('0x15')]));});});});};exports['MoveContactManagedDialer']=function(_0x1dd129){var _0x30c666=this;return new Promise(function(_0x3fe9ff,_0x414050){return db[_0x5a53('0x2f')][_0x5a53('0x30')](function(_0x5698c3){return db[_0x5a53('0x35')][_0x5a53('0x25')](_0x1dd129['body'],{'raw':_0x1dd129[_0x5a53('0x1c')]?_0x1dd129[_0x5a53('0x1c')][_0x5a53('0x1b')]===undefined?!![]:![]:!![],'transaction':_0x5698c3})[_0x5a53('0xd')](function(){return db[_0x5a53('0x19')][_0x5a53('0x2b')]({'where':_0x1dd129[_0x5a53('0x1c')]?_0x1dd129[_0x5a53('0x1c')][_0x5a53('0x1d')]||null:null,'transaction':_0x5698c3});});})[_0x5a53('0xd')](function(_0x24e59c){logger[_0x5a53('0x16')](_0x5a53('0x36'),_0x1dd129);logger[_0x5a53('0x10')]('MoveContactManagedDialer',_0x1dd129,JSON['stringify'](_0x24e59c));_0x3fe9ff(_0x24e59c);})[_0x5a53('0x22')](function(_0x4ca64f){logger[_0x5a53('0x13')](_0x5a53('0x36'),_0x4ca64f['message'],_0x1dd129);_0x414050(_0x30c666[_0x5a53('0x13')](0x1f4,_0x4ca64f[_0x5a53('0x15')]));});});};exports['CountReScheduled']=function(_0x4894ea){var _0x144d9f=this;return new Promise(function(_0x3240aa,_0x22f510){return db[_0x5a53('0x19')][_0x5a53('0x1a')]({'raw':_0x4894ea[_0x5a53('0x1c')]?_0x4894ea[_0x5a53('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4894ea[_0x5a53('0x1c')]?_0x4894ea[_0x5a53('0x1c')][_0x5a53('0x1d')]||null:null,'attributes':[[db[_0x5a53('0x2f')]['fn']('COUNT',db[_0x5a53('0x2f')]['fn']('IF',db['sequelize']['literal'](_0x5a53('0x37')+util[_0x5a53('0x38')](_0x5a53('0x39'),moment()[_0x5a53('0x38')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x5a53('0x3a')))),_0x5a53('0x3b')]]})[_0x5a53('0xd')](function(_0x221a4c){logger['info'](_0x5a53('0x3c'),_0x4894ea);logger[_0x5a53('0x10')](_0x5a53('0x3c'),_0x4894ea,JSON[_0x5a53('0x12')](_0x221a4c));_0x3240aa(_0x221a4c);})[_0x5a53('0x22')](function(_0x47fda5){logger[_0x5a53('0x13')](_0x5a53('0x3c'),_0x47fda5[_0x5a53('0x15')],_0x4894ea);_0x22f510(_0x144d9f[_0x5a53('0x13')](0x1f4,_0x47fda5[_0x5a53('0x15')]));});});};exports[_0x5a53('0x3d')]=function(_0x49427a){var _0x4c4f63=this;return new Promise(function(_0xe48653,_0x4e7cf0){return db['CmContact']['describe']()[_0x5a53('0xd')](function(_0x7296ce){return db[_0x5a53('0x2f')][_0x5a53('0x30')](function(_0x42afdc){return db[_0x5a53('0x19')][_0x5a53('0x1a')]({'where':_0x49427a[_0x5a53('0x1c')]?_0x49427a[_0x5a53('0x1c')][_0x5a53('0x1d')]||null:null,'attributes':_0x49427a[_0x5a53('0x1c')]?_0x49427a[_0x5a53('0x1c')][_0x5a53('0x1e')]||null:null,'limit':0x1,'order':_0x49427a['options']?_0x49427a['options'][_0x5a53('0x3e')]||null:null,'group':db[_0x5a53('0x19')][_0x5a53('0x3f')],'transaction':_0x42afdc,'lock':_0x42afdc[_0x5a53('0x40')][_0x5a53('0x31')],'include':_0x49427a[_0x5a53('0x1c')]?_0x49427a[_0x5a53('0x1c')][_0x5a53('0x21')]?_[_0x5a53('0x1f')](_0x49427a[_0x5a53('0x1c')][_0x5a53('0x21')],function(_0xd80716){return{'model':db[_0xd80716[_0x5a53('0x20')]],'as':_0xd80716['as'],'attributes':_0xd80716['attributes'],'include':_0xd80716[_0x5a53('0x21')]?_[_0x5a53('0x1f')](_0xd80716[_0x5a53('0x21')],function(_0x56509f){return{'model':db[_0x56509f[_0x5a53('0x20')]],'as':_0x56509f['as'],'attributes':_0x56509f['attributes'],'include':_0x56509f[_0x5a53('0x21')]?_[_0x5a53('0x1f')](_0x56509f[_0x5a53('0x21')],function(_0x484d85){return{'model':db[_0x484d85[_0x5a53('0x20')]],'as':_0x484d85['as'],'attributes':_0x484d85[_0x5a53('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5a53('0xd')](function(_0xd6d0b3){var _0x823b1e=[];for(var _0x2f1c98=0x0;_0x2f1c98<_0xd6d0b3[_0x5a53('0x34')];_0x2f1c98+=0x1){_0x823b1e[_0x5a53('0x41')](_0xd6d0b3[_0x2f1c98]['update'](_0x49427a[_0x5a53('0x26')],{'transaction':_0x42afdc}));}return BPromise[_0x5a53('0x42')](_0x823b1e);});})[_0x5a53('0xd')](function(_0x35ebe9){logger[_0x5a53('0x16')](_0x5a53('0x3d'),_0x49427a);logger['debug'](_0x5a53('0x3d'),_0x49427a,JSON[_0x5a53('0x12')](_0x35ebe9));_0xe48653(_0x35ebe9);})['catch'](function(_0x3fb91f){logger[_0x5a53('0x13')](_0x5a53('0x3d'),_0x3fb91f['message'],_0x49427a);_0x4e7cf0(_0x4c4f63[_0x5a53('0x13')](0x1f4,_0x3fb91f[_0x5a53('0x15')]));});});});}; \ No newline at end of file +var _0x80da=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetCmHopper','CmHopper','options','raw','where','attributes','include','model','map','debug','ShowCmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','limit','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','findAll','order','LOCK','keys','length','push','update','all','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','contactsRescheduled','GetContactRecallMe','UserId','UPDATE','lodash','bluebird','randomstring'];(function(_0x68c988,_0x14ea9f){var _0x5b56ce=function(_0x5f0c22){while(--_0x5f0c22){_0x68c988['push'](_0x68c988['shift']());}};_0x5b56ce(++_0x14ea9f);}(_0x80da,0xbd));var _0xa80d=function(_0x5679a4,_0x405e86){_0x5679a4=_0x5679a4-0x0;var _0xdf2d8=_0x80da[_0x5679a4];return _0xdf2d8;};'use strict';var _=require(_0xa80d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa80d('0x1'));var rs=require(_0xa80d('0x2'));var fs=require('fs');var Redis=require(_0xa80d('0x3'));var db=require(_0xa80d('0x4'))['db'];var utils=require(_0xa80d('0x5'));var logger=require('../../config/logger')(_0xa80d('0x6'));var config=require(_0xa80d('0x7'));var jayson=require(_0xa80d('0x8'));var client=jayson['client'][_0xa80d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x448718,_0x2e2068,_0x275a2d){return new BPromise(function(_0xaac4ac,_0x3b48ae){return client[_0xa80d('0xa')](_0x448718,_0x275a2d)[_0xa80d('0xb')](function(_0x1b174c){logger['info'](_0xa80d('0xc'),_0x2e2068,_0xa80d('0xd'));logger['debug'](_0xa80d('0xe'),_0x2e2068,_0xa80d('0xd'),JSON[_0xa80d('0xf')](_0x1b174c));if(_0x1b174c['error']){if(_0x1b174c[_0xa80d('0x10')][_0xa80d('0x11')]===0x1f4){logger[_0xa80d('0x10')](_0xa80d('0xc'),_0x2e2068,_0x1b174c['error'][_0xa80d('0x12')]);return _0x3b48ae(_0x1b174c['error']['message']);}logger['error'](_0xa80d('0xc'),_0x2e2068,_0x1b174c[_0xa80d('0x10')][_0xa80d('0x12')]);return _0xaac4ac(_0x1b174c[_0xa80d('0x10')]['message']);}else{logger[_0xa80d('0x13')]('CmHopper,\x20%s,\x20%s',_0x2e2068,'request\x20sent');_0xaac4ac(_0x1b174c[_0xa80d('0x14')][_0xa80d('0x12')]);}})[_0xa80d('0x15')](function(_0x210a26){logger['error'](_0xa80d('0xc'),_0x2e2068,_0x210a26);_0x3b48ae(_0x210a26);});});}exports[_0xa80d('0x16')]=function(_0x3bb4c6){var _0x3f20b0=this;return new Promise(function(_0x38a4f8,_0x21143f){return db[_0xa80d('0x17')]['findAll']({'raw':_0x3bb4c6[_0xa80d('0x18')]?_0x3bb4c6[_0xa80d('0x18')][_0xa80d('0x19')]===undefined?!![]:![]:!![],'where':_0x3bb4c6[_0xa80d('0x18')]?_0x3bb4c6[_0xa80d('0x18')][_0xa80d('0x1a')]||null:null,'attributes':_0x3bb4c6[_0xa80d('0x18')]?_0x3bb4c6[_0xa80d('0x18')][_0xa80d('0x1b')]||null:null,'limit':_0x3bb4c6['options']?_0x3bb4c6[_0xa80d('0x18')]['limit']||null:null,'include':_0x3bb4c6[_0xa80d('0x18')]?_0x3bb4c6['options'][_0xa80d('0x1c')]?_['map'](_0x3bb4c6[_0xa80d('0x18')]['include'],function(_0x269f50){return{'model':db[_0x269f50[_0xa80d('0x1d')]],'as':_0x269f50['as'],'attributes':_0x269f50['attributes'],'include':_0x269f50[_0xa80d('0x1c')]?_[_0xa80d('0x1e')](_0x269f50['include'],function(_0x288146){return{'model':db[_0x288146[_0xa80d('0x1d')]],'as':_0x288146['as'],'attributes':_0x288146[_0xa80d('0x1b')],'include':_0x288146[_0xa80d('0x1c')]?_[_0xa80d('0x1e')](_0x288146['include'],function(_0x33e84f){return{'model':db[_0x33e84f['model']],'as':_0x33e84f['as'],'attributes':_0x33e84f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4aff49){logger[_0xa80d('0x13')]('GetCmHopper',_0x3bb4c6);logger[_0xa80d('0x1f')](_0xa80d('0x16'),_0x3bb4c6,JSON[_0xa80d('0xf')](_0x4aff49));_0x38a4f8(_0x4aff49);})[_0xa80d('0x15')](function(_0x307b18){logger[_0xa80d('0x10')](_0xa80d('0x16'),_0x307b18[_0xa80d('0x12')],_0x3bb4c6);_0x21143f(_0x3f20b0[_0xa80d('0x10')](0x1f4,_0x307b18[_0xa80d('0x12')]));});});};exports[_0xa80d('0x20')]=function(_0x4326e7){var _0x54dd18=this;return new Promise(function(_0x5d56b7,_0x2bb90f){return db[_0xa80d('0x17')][_0xa80d('0x21')]({'raw':_0x4326e7[_0xa80d('0x18')]?_0x4326e7[_0xa80d('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4326e7[_0xa80d('0x18')]?_0x4326e7['options'][_0xa80d('0x1a')]||null:null,'attributes':_0x4326e7[_0xa80d('0x18')]?_0x4326e7['options'][_0xa80d('0x1b')]||null:null,'include':_0x4326e7[_0xa80d('0x18')]?_0x4326e7[_0xa80d('0x18')][_0xa80d('0x1c')]?_[_0xa80d('0x1e')](_0x4326e7[_0xa80d('0x18')]['include'],function(_0x2b9a56){return{'model':db[_0x2b9a56[_0xa80d('0x1d')]],'as':_0x2b9a56['as'],'attributes':_0x2b9a56[_0xa80d('0x1b')],'include':_0x2b9a56['include']?_[_0xa80d('0x1e')](_0x2b9a56[_0xa80d('0x1c')],function(_0x47f392){return{'model':db[_0x47f392[_0xa80d('0x1d')]],'as':_0x47f392['as'],'attributes':_0x47f392[_0xa80d('0x1b')],'include':_0x47f392[_0xa80d('0x1c')]?_[_0xa80d('0x1e')](_0x47f392[_0xa80d('0x1c')],function(_0x4a8a64){return{'model':db[_0x4a8a64[_0xa80d('0x1d')]],'as':_0x4a8a64['as'],'attributes':_0x4a8a64['attributes']};}):[]};}):[]};}):[]:[]})[_0xa80d('0xb')](function(_0x2f4db5){logger[_0xa80d('0x13')]('ShowCmHopper',_0x4326e7);logger['debug'](_0xa80d('0x20'),_0x4326e7,JSON[_0xa80d('0xf')](_0x2f4db5));_0x5d56b7(_0x2f4db5);})[_0xa80d('0x15')](function(_0x4209b6){logger[_0xa80d('0x10')]('ShowCmHopper',_0x4209b6[_0xa80d('0x12')],_0x4326e7);_0x2bb90f(_0x54dd18[_0xa80d('0x10')](0x1f4,_0x4209b6[_0xa80d('0x12')]));});});};exports[_0xa80d('0x22')]=function(_0x45b95e){var _0x4dfd72=this;return new Promise(function(_0x519dc8,_0x4a10df){return db[_0xa80d('0x17')][_0xa80d('0x23')](_0x45b95e[_0xa80d('0x24')],{'raw':_0x45b95e[_0xa80d('0x18')]?_0x45b95e[_0xa80d('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xa80d('0xb')](function(_0x24e901){logger[_0xa80d('0x13')](_0xa80d('0x22'),_0x45b95e);logger['debug'](_0xa80d('0x22'),_0x45b95e,JSON[_0xa80d('0xf')](_0x24e901));_0x519dc8(_0x24e901);})[_0xa80d('0x15')](function(_0x1a6dcc){logger[_0xa80d('0x10')]('CreateCmHopper',_0x1a6dcc['message'],_0x45b95e);_0x4a10df(_0x4dfd72[_0xa80d('0x10')](0x1f4,_0x1a6dcc['message']));});});};exports[_0xa80d('0x25')]=function(_0x744554){var _0x469e39=this;return new Promise(function(_0x5c71f7,_0x4b4425){return db[_0xa80d('0x17')]['update'](_0x744554[_0xa80d('0x24')],{'raw':_0x744554[_0xa80d('0x18')]?_0x744554[_0xa80d('0x18')][_0xa80d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x744554[_0xa80d('0x18')]?_0x744554[_0xa80d('0x18')][_0xa80d('0x1a')]||null:null,'attributes':_0x744554['options']?_0x744554['options']['attributes']||null:null,'limit':_0x744554[_0xa80d('0x18')]?_0x744554[_0xa80d('0x18')][_0xa80d('0x26')]||null:null})[_0xa80d('0xb')](function(_0x3babf2){logger[_0xa80d('0x13')]('UpdateCmHopper',_0x744554);logger[_0xa80d('0x1f')](_0xa80d('0x25'),_0x744554,JSON[_0xa80d('0xf')](_0x3babf2));_0x5c71f7(_0x3babf2);})[_0xa80d('0x15')](function(_0xe683a8){logger[_0xa80d('0x10')](_0xa80d('0x25'),_0xe683a8[_0xa80d('0x12')],_0x744554);_0x4b4425(_0x469e39[_0xa80d('0x10')](0x1f4,_0xe683a8[_0xa80d('0x12')]));});});};exports[_0xa80d('0x27')]=function(_0x2e2c89){var _0x22da5a=this;return new Promise(function(_0xda37d0,_0x1d7a01){return db['CmHopper'][_0xa80d('0x28')]({'where':_0x2e2c89[_0xa80d('0x18')]?_0x2e2c89[_0xa80d('0x18')][_0xa80d('0x1a')]||null:null})['then'](function(_0x38bd9d){logger[_0xa80d('0x13')](_0xa80d('0x27'),_0x2e2c89);logger[_0xa80d('0x1f')](_0xa80d('0x27'),_0x2e2c89,JSON[_0xa80d('0xf')](_0x38bd9d));_0xda37d0(_0x38bd9d);})[_0xa80d('0x15')](function(_0x36f1da){logger[_0xa80d('0x10')](_0xa80d('0x27'),_0x36f1da['message'],_0x2e2c89);_0x1d7a01(_0x22da5a['error'](0x1f4,_0x36f1da['message']));});});};exports[_0xa80d('0x29')]=function(_0x37fda5){var _0x1ef788=this;return new Promise(function(_0x27d433,_0x10ebca){return db[_0xa80d('0x2a')][_0xa80d('0x2b')]()[_0xa80d('0xb')](function(_0x4fa61a){return db[_0xa80d('0x2c')][_0xa80d('0x2d')](function(_0x2b7e1c){return db[_0xa80d('0x17')][_0xa80d('0x2e')]({'where':_0x37fda5[_0xa80d('0x18')]?_0x37fda5[_0xa80d('0x18')][_0xa80d('0x1a')]||null:null,'attributes':_0x37fda5['options']?_0x37fda5[_0xa80d('0x18')][_0xa80d('0x1b')]||null:null,'limit':_0x37fda5[_0xa80d('0x18')]?_0x37fda5['options'][_0xa80d('0x26')]||null:null,'order':_0x37fda5[_0xa80d('0x18')]?_0x37fda5[_0xa80d('0x18')][_0xa80d('0x2f')]||null:null,'transaction':_0x2b7e1c,'lock':_0x2b7e1c[_0xa80d('0x30')]['UPDATE'],'include':[{'model':db[_0xa80d('0x2a')],'as':'Contact','attributes':_[_0xa80d('0x31')](_0x4fa61a)}]})[_0xa80d('0xb')](function(_0x55857c){var _0x22d907=[];for(var _0x4a33bb=0x0;_0x4a33bb<_0x55857c[_0xa80d('0x32')];_0x4a33bb+=0x1){_0x22d907[_0xa80d('0x33')](_0x55857c[_0x4a33bb][_0xa80d('0x34')](_0x37fda5['body'],{'transaction':_0x2b7e1c}));}return BPromise[_0xa80d('0x35')](_0x22d907);});})[_0xa80d('0xb')](function(_0x48c216){logger[_0xa80d('0x13')](_0xa80d('0x29'),_0x37fda5);logger[_0xa80d('0x1f')](_0xa80d('0x29'),_0x37fda5,JSON['stringify'](_0x48c216));_0x27d433(_0x48c216);})['catch'](function(_0x2fcbcd){logger[_0xa80d('0x10')]('GetContactDialer',_0x2fcbcd[_0xa80d('0x12')],_0x37fda5);_0x10ebca(_0x1ef788[_0xa80d('0x10')](0x1f4,_0x2fcbcd[_0xa80d('0x12')]));});});});};exports[_0xa80d('0x36')]=function(_0x3f4481){var _0x2534fe=this;return new Promise(function(_0x5c2457,_0x49e352){return db['sequelize'][_0xa80d('0x2d')](function(_0x2ee47f){return db['CmHopperFinal']['create'](_0x3f4481[_0xa80d('0x24')],{'raw':_0x3f4481['options']?_0x3f4481[_0xa80d('0x18')][_0xa80d('0x19')]===undefined?!![]:![]:!![],'transaction':_0x2ee47f})[_0xa80d('0xb')](function(){return db[_0xa80d('0x17')]['destroy']({'where':_0x3f4481[_0xa80d('0x18')]?_0x3f4481[_0xa80d('0x18')][_0xa80d('0x1a')]||null:null,'transaction':_0x2ee47f});});})[_0xa80d('0xb')](function(_0x1e2262){logger['info']('MoveContactManagedDialer',_0x3f4481);logger[_0xa80d('0x1f')](_0xa80d('0x36'),_0x3f4481,JSON[_0xa80d('0xf')](_0x1e2262));_0x5c2457(_0x1e2262);})[_0xa80d('0x15')](function(_0x3a56fd){logger[_0xa80d('0x10')](_0xa80d('0x36'),_0x3a56fd[_0xa80d('0x12')],_0x3f4481);_0x49e352(_0x2534fe[_0xa80d('0x10')](0x1f4,_0x3a56fd[_0xa80d('0x12')]));});});};exports[_0xa80d('0x37')]=function(_0x509336){var _0x14c0e7=this;return new Promise(function(_0x1b7fdf,_0x2d8914){return db[_0xa80d('0x17')]['findAll']({'raw':_0x509336['options']?_0x509336['options'][_0xa80d('0x19')]===undefined?!![]:![]:!![],'where':_0x509336[_0xa80d('0x18')]?_0x509336[_0xa80d('0x18')][_0xa80d('0x1a')]||null:null,'attributes':[[db[_0xa80d('0x2c')]['fn'](_0xa80d('0x38'),db[_0xa80d('0x2c')]['fn']('IF',db[_0xa80d('0x2c')][_0xa80d('0x39')](_0xa80d('0x3a')+util[_0xa80d('0x3b')]('\x22%s\x22',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),_0xa80d('0x3c')]]})[_0xa80d('0xb')](function(_0xa9a59){logger['info']('CountReScheduled',_0x509336);logger[_0xa80d('0x1f')](_0xa80d('0x37'),_0x509336,JSON[_0xa80d('0xf')](_0xa9a59));_0x1b7fdf(_0xa9a59);})[_0xa80d('0x15')](function(_0x56cef7){logger['error'](_0xa80d('0x37'),_0x56cef7[_0xa80d('0x12')],_0x509336);_0x2d8914(_0x14c0e7[_0xa80d('0x10')](0x1f4,_0x56cef7[_0xa80d('0x12')]));});});};exports[_0xa80d('0x3d')]=function(_0x1a0de1){var _0x9800ec=this;return new Promise(function(_0x300186,_0x4c7baf){return db['CmContact'][_0xa80d('0x2b')]()[_0xa80d('0xb')](function(_0x266336){return db['sequelize'][_0xa80d('0x2d')](function(_0x11ada9){return db[_0xa80d('0x17')][_0xa80d('0x2e')]({'where':_0x1a0de1['options']?_0x1a0de1[_0xa80d('0x18')][_0xa80d('0x1a')]||null:null,'attributes':_0x1a0de1[_0xa80d('0x18')]?_0x1a0de1[_0xa80d('0x18')][_0xa80d('0x1b')]||null:null,'limit':0x1,'order':_0x1a0de1['options']?_0x1a0de1[_0xa80d('0x18')][_0xa80d('0x2f')]||null:null,'group':db[_0xa80d('0x17')][_0xa80d('0x3e')],'transaction':_0x11ada9,'lock':_0x11ada9[_0xa80d('0x30')][_0xa80d('0x3f')],'include':_0x1a0de1['options']?_0x1a0de1['options'][_0xa80d('0x1c')]?_[_0xa80d('0x1e')](_0x1a0de1[_0xa80d('0x18')][_0xa80d('0x1c')],function(_0x1738c0){return{'model':db[_0x1738c0[_0xa80d('0x1d')]],'as':_0x1738c0['as'],'attributes':_0x1738c0[_0xa80d('0x1b')],'include':_0x1738c0['include']?_['map'](_0x1738c0[_0xa80d('0x1c')],function(_0x21afd3){return{'model':db[_0x21afd3[_0xa80d('0x1d')]],'as':_0x21afd3['as'],'attributes':_0x21afd3['attributes'],'include':_0x21afd3[_0xa80d('0x1c')]?_[_0xa80d('0x1e')](_0x21afd3[_0xa80d('0x1c')],function(_0xb0c2b4){return{'model':db[_0xb0c2b4[_0xa80d('0x1d')]],'as':_0xb0c2b4['as'],'attributes':_0xb0c2b4['attributes']};}):[]};}):[]};}):[]:[]})[_0xa80d('0xb')](function(_0x59e6cc){var _0x230410=[];for(var _0x3dd54c=0x0;_0x3dd54c<_0x59e6cc['length'];_0x3dd54c+=0x1){_0x230410['push'](_0x59e6cc[_0x3dd54c]['update'](_0x1a0de1[_0xa80d('0x24')],{'transaction':_0x11ada9}));}return BPromise[_0xa80d('0x35')](_0x230410);});})['then'](function(_0xe57ae9){logger[_0xa80d('0x13')]('GetContactRecallMe',_0x1a0de1);logger[_0xa80d('0x1f')](_0xa80d('0x3d'),_0x1a0de1,JSON[_0xa80d('0xf')](_0xe57ae9));_0x300186(_0xe57ae9);})['catch'](function(_0x14fcb4){logger['error'](_0xa80d('0x3d'),_0x14fcb4[_0xa80d('0x12')],_0x1a0de1);_0x4c7baf(_0x9800ec['error'](0x1f4,_0x14fcb4[_0xa80d('0x12')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 4c90ad3..1da04b9 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 _0x9957=['/:id','show','post','/preview','getPreview','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./cmHopper.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['describe']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x8')](_0x7995('0xe'),auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0x10')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0x10')](_0x7995('0x11'),auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x13')](_0x7995('0xe'),auth[_0x7995('0x9')](),controller[_0x7995('0x14')]);router[_0x7995('0x15')](_0x7995('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x16')]=router; \ No newline at end of file +var _0x9957=['/:id','show','post','/preview','getPreview','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./cmHopper.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['describe']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x8')](_0x7995('0xe'),auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0x10')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0x10')](_0x7995('0x11'),auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x13')](_0x7995('0xe'),auth[_0x7995('0x9')](),controller[_0x7995('0x14')]);router[_0x7995('0x15')](_0x7995('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 638d73d..aeae34e 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 _0xb326=['moment','sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb326,0x96));var _0x6b32=function(_0x46cdc4,_0x23f900){_0x46cdc4=_0x46cdc4-0x0;var _0x2fd078=_0xb326[_0x46cdc4];return _0x2fd078;};'use strict';var moment=require(_0x6b32('0x0'));var Sequelize=require(_0x6b32('0x1'));module[_0x6b32('0x2')]={'phone':{'type':Sequelize[_0x6b32('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x6b32('0x4')],'unique':_0x6b32('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x6b32('0x4')],'unique':_0x6b32('0x5')}}; \ No newline at end of file +var _0xc796=['contactListQueue','moment','sequelize','INTEGER'];(function(_0x3eff8f,_0x58a445){var _0x23eabd=function(_0xb93f18){while(--_0xb93f18){_0x3eff8f['push'](_0x3eff8f['shift']());}};_0x23eabd(++_0x58a445);}(_0xc796,0x129));var _0x6c79=function(_0xd3e0b9,_0xd80d4d){_0xd3e0b9=_0xd3e0b9-0x0;var _0x470133=_0xc796[_0xd3e0b9];return _0x470133;};'use strict';var moment=require(_0x6c79('0x0'));var Sequelize=require(_0x6c79('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x6c79('0x2')],'unique':_0x6c79('0x3')},'ListId':{'type':Sequelize[_0x6c79('0x2')],'unique':_0x6c79('0x3')},'VoiceQueueId':{'type':Sequelize[_0x6c79('0x2')],'unique':_0x6c79('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index dcd9125..23d5182 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 _0xf2f1=['reject','update','then','destroy','error','stack','name','send','index','CmHopperBlack','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','key','field','count','include','findAll','rows','catch','show','params','options','find','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','apply'];(function(_0x41af7c,_0x51a65b){var _0x567636=function(_0x50aa24){while(--_0x50aa24){_0x41af7c['push'](_0x41af7c['shift']());}};_0x567636(++_0x51a65b);}(_0xf2f1,0x14d));var _0x1f2f=function(_0x189dbd,_0x1d3cad){_0x189dbd=_0x189dbd-0x0;var _0x7861fb=_0xf2f1[_0x189dbd];return _0x7861fb;};'use strict';var pdf=require(_0x1f2f('0x0'));var emlformat=require(_0x1f2f('0x1'));var rimraf=require(_0x1f2f('0x2'));var zipdir=require(_0x1f2f('0x3'));var jsonpatch=require(_0x1f2f('0x4'));var rp=require(_0x1f2f('0x5'));var moment=require(_0x1f2f('0x6'));var BPromise=require(_0x1f2f('0x7'));var Mustache=require(_0x1f2f('0x8'));var util=require('util');var path=require(_0x1f2f('0x9'));var sox=require(_0x1f2f('0xa'));var csv=require(_0x1f2f('0xb'));var ejs=require(_0x1f2f('0xc'));var fs=require('fs');var _=require(_0x1f2f('0xd'));var squel=require(_0x1f2f('0xe'));var crypto=require(_0x1f2f('0xf'));var jsforce=require(_0x1f2f('0x10'));var deskjs=require(_0x1f2f('0x11'));var toCsv=require(_0x1f2f('0xb'));var querystring=require('querystring');var Papa=require(_0x1f2f('0x12'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x1f2f('0x13'));var qs=require(_0x1f2f('0x14'));var logger=require(_0x1f2f('0x15'))(_0x1f2f('0x16'));var utils=require(_0x1f2f('0x17'));var config=require(_0x1f2f('0x18'));var db=require(_0x1f2f('0x19'))['db'];function respondWithStatusCode(_0x544f6c,_0x43052d){_0x43052d=_0x43052d||0xcc;return function(_0x354ee7){if(_0x354ee7){return _0x544f6c[_0x1f2f('0x1a')](_0x43052d);}return _0x544f6c[_0x1f2f('0x1b')](_0x43052d)[_0x1f2f('0x1c')]();};}function respondWithResult(_0x3ff3ea,_0x183bf7){_0x183bf7=_0x183bf7||0xc8;return function(_0x27f6b8){if(_0x27f6b8){return _0x3ff3ea[_0x1f2f('0x1b')](_0x183bf7)[_0x1f2f('0x1d')](_0x27f6b8);}};}function respondWithFilteredResult(_0x2ac4da,_0x468f3a){return function(_0x448238){if(_0x448238){var _0x2d646f=_0x448238['count'],_0x17b2f5=_0x468f3a[_0x1f2f('0x1e')],_0x10aa94=_0x468f3a[_0x1f2f('0x1e')]+_0x468f3a['limit'],_0x151528;if(_0x10aa94>=_0x2d646f){_0x10aa94=_0x2d646f;_0x151528=0xc8;}else{_0x151528=0xce;}_0x2ac4da[_0x1f2f('0x1b')](_0x151528);return _0x2ac4da['set']('Content-Range',_0x17b2f5+'-'+_0x10aa94+'/'+_0x2d646f)['json'](_0x448238);}return null;};}function patchUpdates(_0x1efdb3){return function(_0x2fca5c){try{jsonpatch[_0x1f2f('0x1f')](_0x2fca5c,_0x1efdb3,!![]);}catch(_0x168ce7){return BPromise[_0x1f2f('0x20')](_0x168ce7);}return _0x2fca5c['save']();};}function saveUpdates(_0x1fb4d9,_0x3290d8){return function(_0x14ef38){if(_0x14ef38){return _0x14ef38[_0x1f2f('0x21')](_0x1fb4d9)[_0x1f2f('0x22')](function(_0x3a68af){return _0x3a68af;});}return null;};}function removeEntity(_0x3db290,_0x3555ef){return function(_0x184d57){if(_0x184d57){return _0x184d57[_0x1f2f('0x23')]()[_0x1f2f('0x22')](function(){_0x3db290[_0x1f2f('0x1b')](0xcc)[_0x1f2f('0x1c')]();});}};}function handleEntityNotFound(_0x55185d,_0x416690){return function(_0x5b6c5a){if(!_0x5b6c5a){_0x55185d[_0x1f2f('0x1a')](0x194);}return _0x5b6c5a;};}function handleError(_0x5dac7c,_0x550719){_0x550719=_0x550719||0x1f4;return function(_0x3ba91a){logger[_0x1f2f('0x24')](_0x3ba91a[_0x1f2f('0x25')]);if(_0x3ba91a[_0x1f2f('0x26')]){delete _0x3ba91a[_0x1f2f('0x26')];}_0x5dac7c[_0x1f2f('0x1b')](_0x550719)[_0x1f2f('0x27')](_0x3ba91a);};}exports[_0x1f2f('0x28')]=function(_0x3ae864,_0x8d33c1){var _0x3a31d4={},_0x4e9a39={},_0x472f05={'count':0x0,'rows':[]};var _0x2113cf=db[_0x1f2f('0x29')][_0x1f2f('0x2a')];_0x4e9a39[_0x1f2f('0x2b')]=_[_0x1f2f('0x2c')](_0x2113cf);_0x4e9a39[_0x1f2f('0x2d')]=_['keys'](_0x3ae864[_0x1f2f('0x2d')]);_0x4e9a39[_0x1f2f('0x2e')]=_[_0x1f2f('0x2f')](_0x4e9a39[_0x1f2f('0x2b')],_0x4e9a39[_0x1f2f('0x2d')]);_0x3a31d4[_0x1f2f('0x30')]=_[_0x1f2f('0x2f')](_0x4e9a39[_0x1f2f('0x2b')],qs['fields'](_0x3ae864[_0x1f2f('0x2d')][_0x1f2f('0x31')]));_0x3a31d4[_0x1f2f('0x30')]=_0x3a31d4[_0x1f2f('0x30')]['length']?_0x3a31d4[_0x1f2f('0x30')]:_0x4e9a39[_0x1f2f('0x2b')];if(!_0x3ae864[_0x1f2f('0x2d')][_0x1f2f('0x32')](_0x1f2f('0x33'))){_0x3a31d4[_0x1f2f('0x34')]=qs['limit'](_0x3ae864[_0x1f2f('0x2d')][_0x1f2f('0x34')]);_0x3a31d4[_0x1f2f('0x1e')]=qs[_0x1f2f('0x1e')](_0x3ae864[_0x1f2f('0x2d')][_0x1f2f('0x1e')]);}_0x3a31d4[_0x1f2f('0x35')]=qs[_0x1f2f('0x36')](_0x3ae864['query'][_0x1f2f('0x36')]);_0x3a31d4[_0x1f2f('0x37')]=qs['filters'](_[_0x1f2f('0x38')](_0x3ae864[_0x1f2f('0x2d')],_0x4e9a39['filters']));if(_0x3ae864[_0x1f2f('0x2d')][_0x1f2f('0x39')]){_0x3a31d4[_0x1f2f('0x37')]=_[_0x1f2f('0x3a')](_0x3a31d4[_0x1f2f('0x37')],{'$or':_['map'](_0x2113cf,function(_0x37b4b8){if(_0x37b4b8[_0x1f2f('0x3b')][_0x1f2f('0x3c')]!=='VIRTUAL'){var _0x2b752d={};_0x2b752d[_0x37b4b8[_0x1f2f('0x3d')]]={'$like':'%'+_0x3ae864['query'][_0x1f2f('0x39')]+'%'};return _0x2b752d;}})});}_0x3a31d4=_['merge']({},_0x3a31d4,_0x3ae864['options']);var _0x4e7004={'where':_0x3a31d4[_0x1f2f('0x37')]};return db['CmHopperBlack']['count'](_0x4e7004)[_0x1f2f('0x22')](function(_0x2d34c2){_0x472f05[_0x1f2f('0x3e')]=_0x2d34c2;if(_0x3ae864[_0x1f2f('0x2d')]['includeAll']){_0x3a31d4[_0x1f2f('0x3f')]=[{'all':!![]}];}return db[_0x1f2f('0x29')][_0x1f2f('0x40')](_0x3a31d4);})[_0x1f2f('0x22')](function(_0x8e482a){_0x472f05[_0x1f2f('0x41')]=_0x8e482a;return _0x472f05;})[_0x1f2f('0x22')](respondWithFilteredResult(_0x8d33c1,_0x3a31d4))[_0x1f2f('0x42')](handleError(_0x8d33c1,null));};exports[_0x1f2f('0x43')]=function(_0x4760fd,_0x22684b){var _0x43a4c2={'raw':!![],'where':{'id':_0x4760fd[_0x1f2f('0x44')]['id']}},_0x18b12a={};_0x18b12a['model']=_[_0x1f2f('0x2c')](db['CmHopperBlack'][_0x1f2f('0x2a')]);_0x18b12a['query']=_[_0x1f2f('0x2c')](_0x4760fd[_0x1f2f('0x2d')]);_0x18b12a['filters']=_[_0x1f2f('0x2f')](_0x18b12a[_0x1f2f('0x2b')],_0x18b12a['query']);_0x43a4c2[_0x1f2f('0x30')]=_[_0x1f2f('0x2f')](_0x18b12a[_0x1f2f('0x2b')],qs['fields'](_0x4760fd[_0x1f2f('0x2d')][_0x1f2f('0x31')]));_0x43a4c2[_0x1f2f('0x30')]=_0x43a4c2[_0x1f2f('0x30')]['length']?_0x43a4c2['attributes']:_0x18b12a[_0x1f2f('0x2b')];if(_0x4760fd[_0x1f2f('0x2d')]['includeAll']){_0x43a4c2['include']=[{'all':!![]}];}_0x43a4c2=_[_0x1f2f('0x3a')]({},_0x43a4c2,_0x4760fd[_0x1f2f('0x45')]);return db[_0x1f2f('0x29')][_0x1f2f('0x46')](_0x43a4c2)['then'](handleEntityNotFound(_0x22684b,null))[_0x1f2f('0x22')](respondWithResult(_0x22684b,null))['catch'](handleError(_0x22684b,null));};exports['update']=function(_0x59bcc2,_0x18070d){if(_0x59bcc2[_0x1f2f('0x47')]['id']){delete _0x59bcc2['body']['id'];}return db['CmHopperBlack'][_0x1f2f('0x46')]({'where':{'id':_0x59bcc2['params']['id']}})['then'](handleEntityNotFound(_0x18070d,null))[_0x1f2f('0x22')](saveUpdates(_0x59bcc2[_0x1f2f('0x47')],null))[_0x1f2f('0x22')](respondWithResult(_0x18070d,null))[_0x1f2f('0x42')](handleError(_0x18070d,null));};exports[_0x1f2f('0x23')]=function(_0x2cf635,_0x1efe6a){return db['CmHopperBlack'][_0x1f2f('0x46')]({'where':{'id':_0x2cf635['params']['id']}})['then'](handleEntityNotFound(_0x1efe6a,null))[_0x1f2f('0x22')](removeEntity(_0x1efe6a,null))['catch'](handleError(_0x1efe6a,null));};exports[_0x1f2f('0x48')]=function(_0x2b834b,_0x125c39){return db[_0x1f2f('0x29')][_0x1f2f('0x48')]()[_0x1f2f('0x22')](respondWithResult(_0x125c39,null))[_0x1f2f('0x42')](handleError(_0x125c39,null));}; \ No newline at end of file +var _0xbf3d=['rimraf','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','map','type','VIRTUAL','CmHopperBlack','includeAll','include','findAll','rows','catch','show','params','options','find','body','destroy','describe','eml-format'];(function(_0x14fd34,_0x557b6b){var _0x2aadda=function(_0x54dc92){while(--_0x54dc92){_0x14fd34['push'](_0x14fd34['shift']());}};_0x2aadda(++_0x557b6b);}(_0xbf3d,0x1b5));var _0xdbf3=function(_0x5caf81,_0x478b94){_0x5caf81=_0x5caf81-0x0;var _0x47f23f=_0xbf3d[_0x5caf81];return _0x47f23f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdbf3('0x0'));var rimraf=require(_0xdbf3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdbf3('0x2'));var rp=require('request-promise');var moment=require(_0xdbf3('0x3'));var BPromise=require(_0xdbf3('0x4'));var Mustache=require(_0xdbf3('0x5'));var util=require(_0xdbf3('0x6'));var path=require(_0xdbf3('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdbf3('0x8'));var fs=require('fs');var _=require(_0xdbf3('0x9'));var squel=require('squel');var crypto=require(_0xdbf3('0xa'));var jsforce=require(_0xdbf3('0xb'));var deskjs=require(_0xdbf3('0xc'));var toCsv=require(_0xdbf3('0xd'));var querystring=require(_0xdbf3('0xe'));var Papa=require(_0xdbf3('0xf'));var authService=require(_0xdbf3('0x10'));var hardwareService=require(_0xdbf3('0x11'));var Redis=require(_0xdbf3('0x12'));var qs=require(_0xdbf3('0x13'));var logger=require(_0xdbf3('0x14'))('api');var utils=require(_0xdbf3('0x15'));var config=require(_0xdbf3('0x16'));var db=require(_0xdbf3('0x17'))['db'];function respondWithStatusCode(_0x227e53,_0x7fe987){_0x7fe987=_0x7fe987||0xcc;return function(_0x52a8b8){if(_0x52a8b8){return _0x227e53[_0xdbf3('0x18')](_0x7fe987);}return _0x227e53[_0xdbf3('0x19')](_0x7fe987)[_0xdbf3('0x1a')]();};}function respondWithResult(_0x53749b,_0x31afd6){_0x31afd6=_0x31afd6||0xc8;return function(_0x2cc5df){if(_0x2cc5df){return _0x53749b[_0xdbf3('0x19')](_0x31afd6)['json'](_0x2cc5df);}};}function respondWithFilteredResult(_0x2927b5,_0x364f7a){return function(_0x12003d){if(_0x12003d){var _0x2d541f=_0x12003d[_0xdbf3('0x1b')],_0x17c6a2=_0x364f7a[_0xdbf3('0x1c')],_0x13434d=_0x364f7a[_0xdbf3('0x1c')]+_0x364f7a[_0xdbf3('0x1d')],_0x382774;if(_0x13434d>=_0x2d541f){_0x13434d=_0x2d541f;_0x382774=0xc8;}else{_0x382774=0xce;}_0x2927b5[_0xdbf3('0x19')](_0x382774);return _0x2927b5[_0xdbf3('0x1e')](_0xdbf3('0x1f'),_0x17c6a2+'-'+_0x13434d+'/'+_0x2d541f)['json'](_0x12003d);}return null;};}function patchUpdates(_0x41282a){return function(_0x161541){try{jsonpatch[_0xdbf3('0x20')](_0x161541,_0x41282a,!![]);}catch(_0x58ccef){return BPromise[_0xdbf3('0x21')](_0x58ccef);}return _0x161541[_0xdbf3('0x22')]();};}function saveUpdates(_0x591f04,_0x3f5297){return function(_0x269c1d){if(_0x269c1d){return _0x269c1d[_0xdbf3('0x23')](_0x591f04)[_0xdbf3('0x24')](function(_0x4e39d1){return _0x4e39d1;});}return null;};}function removeEntity(_0x171691,_0x204146){return function(_0x13b717){if(_0x13b717){return _0x13b717['destroy']()[_0xdbf3('0x24')](function(){_0x171691[_0xdbf3('0x19')](0xcc)[_0xdbf3('0x1a')]();});}};}function handleEntityNotFound(_0x2cf448,_0x319518){return function(_0x34218a){if(!_0x34218a){_0x2cf448[_0xdbf3('0x18')](0x194);}return _0x34218a;};}function handleError(_0x2b57a5,_0x101f90){_0x101f90=_0x101f90||0x1f4;return function(_0x281e52){logger[_0xdbf3('0x25')](_0x281e52[_0xdbf3('0x26')]);if(_0x281e52['name']){delete _0x281e52[_0xdbf3('0x27')];}_0x2b57a5[_0xdbf3('0x19')](_0x101f90)[_0xdbf3('0x28')](_0x281e52);};}exports[_0xdbf3('0x29')]=function(_0x1d61a3,_0x41c821){var _0x486f3d={},_0x29efb8={},_0x14f1f3={'count':0x0,'rows':[]};var _0x434770=db['CmHopperBlack'][_0xdbf3('0x2a')];_0x29efb8[_0xdbf3('0x2b')]=_['keys'](_0x434770);_0x29efb8[_0xdbf3('0x2c')]=_[_0xdbf3('0x2d')](_0x1d61a3['query']);_0x29efb8[_0xdbf3('0x2e')]=_[_0xdbf3('0x2f')](_0x29efb8[_0xdbf3('0x2b')],_0x29efb8['query']);_0x486f3d[_0xdbf3('0x30')]=_[_0xdbf3('0x2f')](_0x29efb8[_0xdbf3('0x2b')],qs['fields'](_0x1d61a3[_0xdbf3('0x2c')][_0xdbf3('0x31')]));_0x486f3d[_0xdbf3('0x30')]=_0x486f3d['attributes'][_0xdbf3('0x32')]?_0x486f3d[_0xdbf3('0x30')]:_0x29efb8[_0xdbf3('0x2b')];if(!_0x1d61a3[_0xdbf3('0x2c')][_0xdbf3('0x33')]('nolimit')){_0x486f3d[_0xdbf3('0x1d')]=qs[_0xdbf3('0x1d')](_0x1d61a3[_0xdbf3('0x2c')][_0xdbf3('0x1d')]);_0x486f3d[_0xdbf3('0x1c')]=qs[_0xdbf3('0x1c')](_0x1d61a3[_0xdbf3('0x2c')][_0xdbf3('0x1c')]);}_0x486f3d[_0xdbf3('0x34')]=qs['sort'](_0x1d61a3['query']['sort']);_0x486f3d[_0xdbf3('0x35')]=qs[_0xdbf3('0x2e')](_[_0xdbf3('0x36')](_0x1d61a3['query'],_0x29efb8['filters']));if(_0x1d61a3[_0xdbf3('0x2c')][_0xdbf3('0x37')]){_0x486f3d[_0xdbf3('0x35')]=_[_0xdbf3('0x38')](_0x486f3d[_0xdbf3('0x35')],{'$or':_[_0xdbf3('0x39')](_0x434770,function(_0x194122){if(_0x194122[_0xdbf3('0x3a')]['key']!==_0xdbf3('0x3b')){var _0xab31ba={};_0xab31ba[_0x194122['field']]={'$like':'%'+_0x1d61a3['query'][_0xdbf3('0x37')]+'%'};return _0xab31ba;}})});}_0x486f3d=_[_0xdbf3('0x38')]({},_0x486f3d,_0x1d61a3['options']);var _0x39034b={'where':_0x486f3d[_0xdbf3('0x35')]};return db[_0xdbf3('0x3c')][_0xdbf3('0x1b')](_0x39034b)['then'](function(_0x3e3115){_0x14f1f3[_0xdbf3('0x1b')]=_0x3e3115;if(_0x1d61a3[_0xdbf3('0x2c')][_0xdbf3('0x3d')]){_0x486f3d[_0xdbf3('0x3e')]=[{'all':!![]}];}return db[_0xdbf3('0x3c')][_0xdbf3('0x3f')](_0x486f3d);})[_0xdbf3('0x24')](function(_0x5bff5a){_0x14f1f3[_0xdbf3('0x40')]=_0x5bff5a;return _0x14f1f3;})[_0xdbf3('0x24')](respondWithFilteredResult(_0x41c821,_0x486f3d))[_0xdbf3('0x41')](handleError(_0x41c821,null));};exports[_0xdbf3('0x42')]=function(_0x4ca524,_0x417a26){var _0x4b2efc={'raw':!![],'where':{'id':_0x4ca524[_0xdbf3('0x43')]['id']}},_0x31120d={};_0x31120d[_0xdbf3('0x2b')]=_[_0xdbf3('0x2d')](db['CmHopperBlack'][_0xdbf3('0x2a')]);_0x31120d['query']=_[_0xdbf3('0x2d')](_0x4ca524[_0xdbf3('0x2c')]);_0x31120d[_0xdbf3('0x2e')]=_[_0xdbf3('0x2f')](_0x31120d['model'],_0x31120d[_0xdbf3('0x2c')]);_0x4b2efc[_0xdbf3('0x30')]=_[_0xdbf3('0x2f')](_0x31120d[_0xdbf3('0x2b')],qs[_0xdbf3('0x31')](_0x4ca524['query'][_0xdbf3('0x31')]));_0x4b2efc[_0xdbf3('0x30')]=_0x4b2efc[_0xdbf3('0x30')]['length']?_0x4b2efc['attributes']:_0x31120d[_0xdbf3('0x2b')];if(_0x4ca524['query'][_0xdbf3('0x3d')]){_0x4b2efc['include']=[{'all':!![]}];}_0x4b2efc=_['merge']({},_0x4b2efc,_0x4ca524[_0xdbf3('0x44')]);return db['CmHopperBlack'][_0xdbf3('0x45')](_0x4b2efc)[_0xdbf3('0x24')](handleEntityNotFound(_0x417a26,null))['then'](respondWithResult(_0x417a26,null))[_0xdbf3('0x41')](handleError(_0x417a26,null));};exports[_0xdbf3('0x23')]=function(_0x4bac92,_0x3846d5){if(_0x4bac92[_0xdbf3('0x46')]['id']){delete _0x4bac92[_0xdbf3('0x46')]['id'];}return db['CmHopperBlack'][_0xdbf3('0x45')]({'where':{'id':_0x4bac92[_0xdbf3('0x43')]['id']}})[_0xdbf3('0x24')](handleEntityNotFound(_0x3846d5,null))[_0xdbf3('0x24')](saveUpdates(_0x4bac92[_0xdbf3('0x46')],null))[_0xdbf3('0x24')](respondWithResult(_0x3846d5,null))[_0xdbf3('0x41')](handleError(_0x3846d5,null));};exports[_0xdbf3('0x47')]=function(_0x69b62c,_0x53cbf7){return db[_0xdbf3('0x3c')][_0xdbf3('0x45')]({'where':{'id':_0x69b62c['params']['id']}})[_0xdbf3('0x24')](handleEntityNotFound(_0x53cbf7,null))[_0xdbf3('0x24')](removeEntity(_0x53cbf7,null))['catch'](handleError(_0x53cbf7,null));};exports[_0xdbf3('0x48')]=function(_0x415741,_0x26e6ab){return db['CmHopperBlack']['describe']()[_0xdbf3('0x24')](respondWithResult(_0x26e6ab,null))[_0xdbf3('0x41')](handleError(_0x26e6ab,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index d4bad01..495bcf8 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 _0x8f1e=['moment','request-promise','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','lodash','api'];(function(_0x570a14,_0x34e430){var _0x21819e=function(_0x28532a){while(--_0x28532a){_0x570a14['push'](_0x570a14['shift']());}};_0x21819e(++_0x34e430);}(_0x8f1e,0x76));var _0xe8f1=function(_0x29d316,_0x38e58f){_0x29d316=_0x29d316-0x0;var _0x5d468c=_0x8f1e[_0x29d316];return _0x5d468c;};'use strict';var _=require(_0xe8f1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe8f1('0x1'));var moment=require(_0xe8f1('0x2'));var BPromise=require('bluebird');var rp=require(_0xe8f1('0x3'));var attributes=require(_0xe8f1('0x4'));module['exports']=function(_0x18d61f,_0x4aee15){return _0x18d61f[_0xe8f1('0x5')](_0xe8f1('0x6'),attributes,{'tableName':_0xe8f1('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x347f=['bluebird','./cmHopperBlack.attributes','CmHopperBlack','cm_hopper_black','../../config/logger','api','moment'];(function(_0xa388a2,_0x40bde6){var _0x7ce7f6=function(_0x5a242a){while(--_0x5a242a){_0xa388a2['push'](_0xa388a2['shift']());}};_0x7ce7f6(++_0x40bde6);}(_0x347f,0x17e));var _0xf347=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x347f[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf347('0x0'))(_0xf347('0x1'));var moment=require(_0xf347('0x2'));var BPromise=require(_0xf347('0x3'));var rp=require('request-promise');var attributes=require(_0xf347('0x4'));module['exports']=function(_0xe9d38b,_0x18f5a5){return _0xe9d38b['define'](_0xf347('0x5'),attributes,{'tableName':_0xf347('0x6'),'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 9b6547a..6ba30a4 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 _0xd5b7=['catch','GetCmHopperBlack','CmHopperBlack','findAll','options','where','attributes','limit','map','include','model','then','UpdateCmHopperBlack','update','body','raw','destroy','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x1c9e42,_0x3c61ee){var _0x50135d=function(_0x2e245a){while(--_0x2e245a){_0x1c9e42['push'](_0x1c9e42['shift']());}};_0x50135d(++_0x3c61ee);}(_0xd5b7,0x66));var _0x7d5b=function(_0xee3051,_0xbe4f18){_0xee3051=_0xee3051-0x0;var _0x139e81=_0xd5b7[_0xee3051];return _0x139e81;};'use strict';var _=require(_0x7d5b('0x0'));var util=require(_0x7d5b('0x1'));var moment=require(_0x7d5b('0x2'));var BPromise=require(_0x7d5b('0x3'));var rs=require(_0x7d5b('0x4'));var fs=require('fs');var Redis=require(_0x7d5b('0x5'));var db=require(_0x7d5b('0x6'))['db'];var utils=require(_0x7d5b('0x7'));var logger=require(_0x7d5b('0x8'))(_0x7d5b('0x9'));var config=require(_0x7d5b('0xa'));var jayson=require(_0x7d5b('0xb'));var client=jayson[_0x7d5b('0xc')][_0x7d5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x36e716,_0x35da23,_0xcb57a5){return new BPromise(function(_0x307a62,_0x469c52){return client[_0x7d5b('0xe')](_0x36e716,_0xcb57a5)['then'](function(_0x544cea){logger[_0x7d5b('0xf')](_0x7d5b('0x10'),_0x35da23,_0x7d5b('0x11'));logger[_0x7d5b('0x12')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x35da23,'request\x20sent',JSON[_0x7d5b('0x13')](_0x544cea));if(_0x544cea[_0x7d5b('0x14')]){if(_0x544cea[_0x7d5b('0x14')][_0x7d5b('0x15')]===0x1f4){logger[_0x7d5b('0x14')](_0x7d5b('0x10'),_0x35da23,_0x544cea[_0x7d5b('0x14')][_0x7d5b('0x16')]);return _0x469c52(_0x544cea[_0x7d5b('0x14')][_0x7d5b('0x16')]);}logger[_0x7d5b('0x14')](_0x7d5b('0x10'),_0x35da23,_0x544cea[_0x7d5b('0x14')][_0x7d5b('0x16')]);return _0x307a62(_0x544cea[_0x7d5b('0x14')][_0x7d5b('0x16')]);}else{logger[_0x7d5b('0xf')](_0x7d5b('0x10'),_0x35da23,_0x7d5b('0x11'));_0x307a62(_0x544cea[_0x7d5b('0x17')]['message']);}})[_0x7d5b('0x18')](function(_0xd93e0b){logger[_0x7d5b('0x14')](_0x7d5b('0x10'),_0x35da23,_0xd93e0b);_0x469c52(_0xd93e0b);});});}exports[_0x7d5b('0x19')]=function(_0x352a35){var _0x539730=this;return new Promise(function(_0x3b98f7,_0x1943e4){return db[_0x7d5b('0x1a')][_0x7d5b('0x1b')]({'raw':_0x352a35[_0x7d5b('0x1c')]?_0x352a35[_0x7d5b('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x352a35[_0x7d5b('0x1c')]?_0x352a35['options'][_0x7d5b('0x1d')]||null:null,'attributes':_0x352a35[_0x7d5b('0x1c')]?_0x352a35[_0x7d5b('0x1c')][_0x7d5b('0x1e')]||null:null,'limit':_0x352a35[_0x7d5b('0x1c')]?_0x352a35[_0x7d5b('0x1c')][_0x7d5b('0x1f')]||null:null,'include':_0x352a35[_0x7d5b('0x1c')]?_0x352a35['options']['include']?_[_0x7d5b('0x20')](_0x352a35[_0x7d5b('0x1c')][_0x7d5b('0x21')],function(_0x13106d){return{'model':db[_0x13106d[_0x7d5b('0x22')]],'as':_0x13106d['as'],'attributes':_0x13106d['attributes'],'include':_0x13106d[_0x7d5b('0x21')]?_['map'](_0x13106d['include'],function(_0x580ca8){return{'model':db[_0x580ca8[_0x7d5b('0x22')]],'as':_0x580ca8['as'],'attributes':_0x580ca8[_0x7d5b('0x1e')],'include':_0x580ca8['include']?_[_0x7d5b('0x20')](_0x580ca8[_0x7d5b('0x21')],function(_0xd113b4){return{'model':db[_0xd113b4[_0x7d5b('0x22')]],'as':_0xd113b4['as'],'attributes':_0xd113b4['attributes']};}):[]};}):[]};}):[]:[]})[_0x7d5b('0x23')](function(_0xcc32fa){logger['info'](_0x7d5b('0x19'),_0x352a35);logger[_0x7d5b('0x12')](_0x7d5b('0x19'),_0x352a35,JSON[_0x7d5b('0x13')](_0xcc32fa));_0x3b98f7(_0xcc32fa);})['catch'](function(_0x1795e1){logger[_0x7d5b('0x14')]('GetCmHopperBlack',_0x1795e1['message'],_0x352a35);_0x1943e4(_0x539730[_0x7d5b('0x14')](0x1f4,_0x1795e1['message']));});});};exports[_0x7d5b('0x24')]=function(_0x496cc3){var _0x2d938e=this;return new Promise(function(_0x10c0ec,_0x4734a8){return db['CmHopperBlack'][_0x7d5b('0x25')](_0x496cc3[_0x7d5b('0x26')],{'raw':_0x496cc3[_0x7d5b('0x1c')]?_0x496cc3['options'][_0x7d5b('0x27')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x496cc3['options']?_0x496cc3[_0x7d5b('0x1c')][_0x7d5b('0x1d')]||null:null,'attributes':_0x496cc3['options']?_0x496cc3[_0x7d5b('0x1c')][_0x7d5b('0x1e')]||null:null,'limit':_0x496cc3['options']?_0x496cc3['options'][_0x7d5b('0x1f')]||null:null})[_0x7d5b('0x23')](function(_0x40a860){logger['info'](_0x7d5b('0x24'),_0x496cc3);logger[_0x7d5b('0x12')](_0x7d5b('0x24'),_0x496cc3,JSON[_0x7d5b('0x13')](_0x40a860));_0x10c0ec(_0x40a860);})[_0x7d5b('0x18')](function(_0x43d3b7){logger[_0x7d5b('0x14')]('UpdateCmHopperBlack',_0x43d3b7[_0x7d5b('0x16')],_0x496cc3);_0x4734a8(_0x2d938e[_0x7d5b('0x14')](0x1f4,_0x43d3b7[_0x7d5b('0x16')]));});});};exports['DestroyCmHopperBlack']=function(_0x189cf4){var _0x568919=this;return new Promise(function(_0x45bff6,_0x392913){return db[_0x7d5b('0x1a')][_0x7d5b('0x28')]({'where':_0x189cf4[_0x7d5b('0x1c')]?_0x189cf4['options'][_0x7d5b('0x1d')]||null:null})['then'](function(_0x46c1aa){logger[_0x7d5b('0xf')](_0x7d5b('0x29'),_0x189cf4);logger['debug']('DestroyCmHopperBlack',_0x189cf4,JSON['stringify'](_0x46c1aa));_0x45bff6(_0x46c1aa);})[_0x7d5b('0x18')](function(_0x29a0b8){logger[_0x7d5b('0x14')](_0x7d5b('0x29'),_0x29a0b8[_0x7d5b('0x16')],_0x189cf4);_0x392913(_0x568919['error'](0x1f4,_0x29a0b8[_0x7d5b('0x16')]));});});}; \ No newline at end of file +var _0x5c28=['attributes','UpdateCmHopperBlack','raw','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','where','limit','include','map','model'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5c28,0x124));var _0x85c2=function(_0x419885,_0x798a7e){_0x419885=_0x419885-0x0;var _0x39f249=_0x5c28[_0x419885];return _0x39f249;};'use strict';var _=require(_0x85c2('0x0'));var util=require(_0x85c2('0x1'));var moment=require(_0x85c2('0x2'));var BPromise=require(_0x85c2('0x3'));var rs=require(_0x85c2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x85c2('0x5'))['db'];var utils=require(_0x85c2('0x6'));var logger=require(_0x85c2('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x85c2('0x8'));var client=jayson[_0x85c2('0x9')][_0x85c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18ab35,_0x520394,_0x1c46f6){return new BPromise(function(_0x87c8b9,_0x4b8fae){return client[_0x85c2('0xb')](_0x18ab35,_0x1c46f6)[_0x85c2('0xc')](function(_0xc530f1){logger[_0x85c2('0xd')](_0x85c2('0xe'),_0x520394,_0x85c2('0xf'));logger[_0x85c2('0x10')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x520394,_0x85c2('0xf'),JSON[_0x85c2('0x11')](_0xc530f1));if(_0xc530f1['error']){if(_0xc530f1[_0x85c2('0x12')][_0x85c2('0x13')]===0x1f4){logger[_0x85c2('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x520394,_0xc530f1['error']['message']);return _0x4b8fae(_0xc530f1[_0x85c2('0x12')][_0x85c2('0x14')]);}logger[_0x85c2('0x12')](_0x85c2('0xe'),_0x520394,_0xc530f1[_0x85c2('0x12')][_0x85c2('0x14')]);return _0x87c8b9(_0xc530f1[_0x85c2('0x12')]['message']);}else{logger[_0x85c2('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x520394,_0x85c2('0xf'));_0x87c8b9(_0xc530f1[_0x85c2('0x15')][_0x85c2('0x14')]);}})[_0x85c2('0x16')](function(_0x3f8d2a){logger['error'](_0x85c2('0xe'),_0x520394,_0x3f8d2a);_0x4b8fae(_0x3f8d2a);});});}exports[_0x85c2('0x17')]=function(_0x2a7edc){var _0x4ca7fc=this;return new Promise(function(_0x177c59,_0x4c1dca){return db[_0x85c2('0x18')][_0x85c2('0x19')]({'raw':_0x2a7edc[_0x85c2('0x1a')]?_0x2a7edc['options']['raw']===undefined?!![]:![]:!![],'where':_0x2a7edc[_0x85c2('0x1a')]?_0x2a7edc[_0x85c2('0x1a')][_0x85c2('0x1b')]||null:null,'attributes':_0x2a7edc[_0x85c2('0x1a')]?_0x2a7edc['options']['attributes']||null:null,'limit':_0x2a7edc[_0x85c2('0x1a')]?_0x2a7edc[_0x85c2('0x1a')][_0x85c2('0x1c')]||null:null,'include':_0x2a7edc[_0x85c2('0x1a')]?_0x2a7edc[_0x85c2('0x1a')][_0x85c2('0x1d')]?_[_0x85c2('0x1e')](_0x2a7edc[_0x85c2('0x1a')][_0x85c2('0x1d')],function(_0x1c76d8){return{'model':db[_0x1c76d8[_0x85c2('0x1f')]],'as':_0x1c76d8['as'],'attributes':_0x1c76d8[_0x85c2('0x20')],'include':_0x1c76d8[_0x85c2('0x1d')]?_[_0x85c2('0x1e')](_0x1c76d8[_0x85c2('0x1d')],function(_0x1c9e68){return{'model':db[_0x1c9e68[_0x85c2('0x1f')]],'as':_0x1c9e68['as'],'attributes':_0x1c9e68[_0x85c2('0x20')],'include':_0x1c9e68[_0x85c2('0x1d')]?_[_0x85c2('0x1e')](_0x1c9e68[_0x85c2('0x1d')],function(_0x83a3c3){return{'model':db[_0x83a3c3['model']],'as':_0x83a3c3['as'],'attributes':_0x83a3c3['attributes']};}):[]};}):[]};}):[]:[]})[_0x85c2('0xc')](function(_0x3b1d24){logger[_0x85c2('0xd')]('GetCmHopperBlack',_0x2a7edc);logger[_0x85c2('0x10')]('GetCmHopperBlack',_0x2a7edc,JSON[_0x85c2('0x11')](_0x3b1d24));_0x177c59(_0x3b1d24);})['catch'](function(_0x427e8a){logger[_0x85c2('0x12')](_0x85c2('0x17'),_0x427e8a['message'],_0x2a7edc);_0x4c1dca(_0x4ca7fc[_0x85c2('0x12')](0x1f4,_0x427e8a[_0x85c2('0x14')]));});});};exports[_0x85c2('0x21')]=function(_0x26fa21){var _0x5a4a32=this;return new Promise(function(_0x4f6859,_0x3025db){return db['CmHopperBlack']['update'](_0x26fa21['body'],{'raw':_0x26fa21[_0x85c2('0x1a')]?_0x26fa21[_0x85c2('0x1a')][_0x85c2('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26fa21[_0x85c2('0x1a')]?_0x26fa21[_0x85c2('0x1a')][_0x85c2('0x1b')]||null:null,'attributes':_0x26fa21[_0x85c2('0x1a')]?_0x26fa21['options'][_0x85c2('0x20')]||null:null,'limit':_0x26fa21[_0x85c2('0x1a')]?_0x26fa21[_0x85c2('0x1a')][_0x85c2('0x1c')]||null:null})[_0x85c2('0xc')](function(_0x532c5f){logger[_0x85c2('0xd')](_0x85c2('0x21'),_0x26fa21);logger[_0x85c2('0x10')](_0x85c2('0x21'),_0x26fa21,JSON[_0x85c2('0x11')](_0x532c5f));_0x4f6859(_0x532c5f);})[_0x85c2('0x16')](function(_0x1861cc){logger['error'](_0x85c2('0x21'),_0x1861cc[_0x85c2('0x14')],_0x26fa21);_0x3025db(_0x5a4a32['error'](0x1f4,_0x1861cc[_0x85c2('0x14')]));});});};exports[_0x85c2('0x23')]=function(_0x72cfc1){var _0x4c7d1a=this;return new Promise(function(_0x39a441,_0x2f8b35){return db[_0x85c2('0x18')]['destroy']({'where':_0x72cfc1['options']?_0x72cfc1[_0x85c2('0x1a')][_0x85c2('0x1b')]||null:null})[_0x85c2('0xc')](function(_0x3ffdcb){logger[_0x85c2('0xd')](_0x85c2('0x23'),_0x72cfc1);logger[_0x85c2('0x10')](_0x85c2('0x23'),_0x72cfc1,JSON[_0x85c2('0x11')](_0x3ffdcb));_0x39a441(_0x3ffdcb);})[_0x85c2('0x16')](function(_0x36625b){logger[_0x85c2('0x12')]('DestroyCmHopperBlack',_0x36625b[_0x85c2('0x14')],_0x72cfc1);_0x2f8b35(_0x4c7d1a['error'](0x1f4,_0x36625b['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 83e4c33..b4fc7c7 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 _0x4944=['express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','put','destroy','multer','path','connect-timeout'];(function(_0x4213cf,_0x139ba4){var _0x431c85=function(_0x2017cd){while(--_0x2017cd){_0x4213cf['push'](_0x4213cf['shift']());}};_0x431c85(++_0x139ba4);}(_0x4944,0x6d));var _0x4494=function(_0x1352aa,_0xb03cda){_0x1352aa=_0x1352aa-0x0;var _0x247c01=_0x4944[_0x1352aa];return _0x247c01;};'use strict';var multer=require(_0x4494('0x0'));var util=require('util');var path=require(_0x4494('0x1'));var timeout=require(_0x4494('0x2'));var express=require(_0x4494('0x3'));var router=express[_0x4494('0x4')]();var auth=require(_0x4494('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4494('0x6'));var controller=require('./cmHopperBlack.controller');router[_0x4494('0x7')]('/',auth[_0x4494('0x8')](),controller[_0x4494('0x9')]);router[_0x4494('0x7')](_0x4494('0xa'),auth[_0x4494('0x8')](),controller[_0x4494('0xb')]);router[_0x4494('0x7')](_0x4494('0xc'),auth['isAuthenticated'](),controller[_0x4494('0xd')]);router[_0x4494('0xe')](_0x4494('0xc'),auth[_0x4494('0x8')](),controller['update']);router['delete'](_0x4494('0xc'),auth[_0x4494('0x8')](),controller[_0x4494('0xf')]);module['exports']=router; \ No newline at end of file +var _0x8b2d=['describe','/:id','put','update','delete','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x23649a,_0x3296e9){var _0x5236d1=function(_0x1a8792){while(--_0x1a8792){_0x23649a['push'](_0x23649a['shift']());}};_0x5236d1(++_0x3296e9);}(_0x8b2d,0xe5));var _0xd8b2=function(_0x437545,_0x4ab48b){_0x437545=_0x437545-0x0;var _0x408060=_0x8b2d[_0x437545];return _0x408060;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd8b2('0x0'));var timeout=require('connect-timeout');var express=require(_0xd8b2('0x1'));var router=express[_0xd8b2('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xd8b2('0x3'));var config=require(_0xd8b2('0x4'));var controller=require('./cmHopperBlack.controller');router[_0xd8b2('0x5')]('/',auth[_0xd8b2('0x6')](),controller[_0xd8b2('0x7')]);router[_0xd8b2('0x5')](_0xd8b2('0x8'),auth[_0xd8b2('0x6')](),controller[_0xd8b2('0x9')]);router[_0xd8b2('0x5')](_0xd8b2('0xa'),auth[_0xd8b2('0x6')](),controller['show']);router[_0xd8b2('0xb')]('/:id',auth[_0xd8b2('0x6')](),controller[_0xd8b2('0xc')]);router[_0xd8b2('0xd')](_0xd8b2('0xa'),auth[_0xd8b2('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 3b97c9d..64a4547 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 _0x18a4=['endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','getDataValue'];(function(_0x10b929,_0x337b37){var _0x4306ed=function(_0xeda777){while(--_0xeda777){_0x10b929['push'](_0x10b929['shift']());}};_0x4306ed(++_0x337b37);}(_0x18a4,0xbd));var _0x418a=function(_0x8906bc,_0x104d0c){_0x8906bc=_0x8906bc-0x0;var _0x12e910=_0x18a4[_0x8906bc];return _0x12e910;};'use strict';var Sequelize=require(_0x418a('0x0'));var moment=require(_0x418a('0x1'));module['exports']={'state':{'type':Sequelize[_0x418a('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x418a('0x3')]},'scheduledat':{'type':Sequelize[_0x418a('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x418a('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x418a('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x418a('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x418a('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x418a('0x3')]},'originatecalleridname':{'type':Sequelize[_0x418a('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x418a('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x418a('0x4')]},'answertime':{'type':Sequelize[_0x418a('0x4')]},'droptime':{'type':Sequelize[_0x418a('0x4')]},'endtime':{'type':Sequelize[_0x418a('0x4')]},'ringtime':{'type':Sequelize[_0x418a('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x418a('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x418a('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x418a('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x418a('0x3')]},'campaign':{'type':Sequelize[_0x418a('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x418a('0x3')]},'reason':{'type':Sequelize[_0x418a('0x3')]},'disposition':{'type':Sequelize[_0x418a('0x3')]},'dispositionat':{'type':Sequelize[_0x418a('0x4')],'set':function(_0x56b88d){var _0x3cd596=this[_0x418a('0x5')](_0x418a('0x6'));if(_0x3cd596&&_0x56b88d){this[_0x418a('0x7')](_0x418a('0x8'),moment(_0x56b88d)[_0x418a('0x9')](moment(_0x3cd596),_0x418a('0xa')));}return this['setDataValue'](_0x418a('0xb'),_0x56b88d);}},'amd':{'type':Sequelize[_0x418a('0xc')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x418a('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x418a('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x418a('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x418a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x418a('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x418a('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x418a('0x4')]}}; \ No newline at end of file +var _0x3c57=['getDataValue','endtime','setDataValue','followuptime','seconds','BOOLEAN','sequelize','moment','STRING','DATE','INTEGER'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x3c57,0x187));var _0x73c5=function(_0x250e1b,_0x4e3f2f){_0x250e1b=_0x250e1b-0x0;var _0x4e1787=_0x3c57[_0x250e1b];return _0x4e1787;};'use strict';var Sequelize=require(_0x73c5('0x0'));var moment=require(_0x73c5('0x1'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x73c5('0x2')]},'scheduledat':{'type':Sequelize[_0x73c5('0x3')]},'countbusyretry':{'type':Sequelize[_0x73c5('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x73c5('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x73c5('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x73c5('0x2')]},'originatecalleridname':{'type':Sequelize[_0x73c5('0x2')]},'calleridnum':{'type':Sequelize[_0x73c5('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x73c5('0x3')]},'responsetime':{'type':Sequelize[_0x73c5('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x73c5('0x3')]},'endtime':{'type':Sequelize[_0x73c5('0x3')]},'ringtime':{'type':Sequelize[_0x73c5('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x73c5('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x73c5('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x73c5('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x73c5('0x2')]},'campaign':{'type':Sequelize[_0x73c5('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x73c5('0x2')]},'reason':{'type':Sequelize[_0x73c5('0x2')]},'disposition':{'type':Sequelize[_0x73c5('0x2')]},'dispositionat':{'type':Sequelize[_0x73c5('0x3')],'set':function(_0x470b04){var _0x337922=this[_0x73c5('0x5')](_0x73c5('0x6'));if(_0x337922&&_0x470b04){this[_0x73c5('0x7')](_0x73c5('0x8'),moment(_0x470b04)['diff'](moment(_0x337922),_0x73c5('0x9')));}return this[_0x73c5('0x7')]('dispositionat',_0x470b04);}},'amd':{'type':Sequelize[_0x73c5('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x73c5('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x73c5('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x73c5('0x3')]},'callback':{'type':Sequelize[_0x73c5('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x73c5('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x73c5('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x73c5('0x3')]},'recallme':{'type':Sequelize[_0x73c5('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x73c5('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 57f42c9..ad0c458 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 _0xac4a=['filter','merge','map','type','key','VIRTUAL','field','options','includeAll','findAll','rows','catch','params','length','find','describe','update','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','literal','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x2010\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','select','cm_hopper','calleridnum','cm_hopper_final','state\x20=\x204','group','Campaign','into','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','save','then','destroy','stack','index','CmHopperFinal','rawAttributes','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xac4a,0x13f));var _0xaac4=function(_0x5a750a,_0xbf8a02){_0x5a750a=_0x5a750a-0x0;var _0x2911e8=_0xac4a[_0x5a750a];return _0x2911e8;};'use strict';var pdf=require(_0xaac4('0x0'));var emlformat=require(_0xaac4('0x1'));var rimraf=require(_0xaac4('0x2'));var zipdir=require(_0xaac4('0x3'));var jsonpatch=require(_0xaac4('0x4'));var rp=require(_0xaac4('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaac4('0x6'));var util=require(_0xaac4('0x7'));var path=require(_0xaac4('0x8'));var sox=require('sox');var csv=require(_0xaac4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var authService=require(_0xaac4('0xe'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0xaac4('0xf'));var logger=require(_0xaac4('0x10'))(_0xaac4('0x11'));var utils=require(_0xaac4('0x12'));var config=require(_0xaac4('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x508e14,_0x2348c2){_0x2348c2=_0x2348c2||0xcc;return function(_0x2e2d02){if(_0x2e2d02){return _0x508e14[_0xaac4('0x14')](_0x2348c2);}return _0x508e14['status'](_0x2348c2)[_0xaac4('0x15')]();};}function respondWithResult(_0x45c129,_0x5bcacd){_0x5bcacd=_0x5bcacd||0xc8;return function(_0xf06b1d){if(_0xf06b1d){return _0x45c129[_0xaac4('0x16')](_0x5bcacd)[_0xaac4('0x17')](_0xf06b1d);}};}function respondWithFilteredResult(_0x150fdd,_0x187624){return function(_0x2fbeb7){if(_0x2fbeb7){var _0x31b7e5=_0x2fbeb7[_0xaac4('0x18')],_0x1df9ae=_0x187624[_0xaac4('0x19')],_0x233278=_0x187624[_0xaac4('0x19')]+_0x187624['limit'],_0xb8466e;if(_0x233278>=_0x31b7e5){_0x233278=_0x31b7e5;_0xb8466e=0xc8;}else{_0xb8466e=0xce;}_0x150fdd[_0xaac4('0x16')](_0xb8466e);return _0x150fdd['set'](_0xaac4('0x1a'),_0x1df9ae+'-'+_0x233278+'/'+_0x31b7e5)['json'](_0x2fbeb7);}return null;};}function patchUpdates(_0x3ce35a){return function(_0x27fe7b){try{jsonpatch[_0xaac4('0x1b')](_0x27fe7b,_0x3ce35a,!![]);}catch(_0x271bcb){return BPromise[_0xaac4('0x1c')](_0x271bcb);}return _0x27fe7b[_0xaac4('0x1d')]();};}function saveUpdates(_0x44f0e8,_0x25b946){return function(_0x4166ee){if(_0x4166ee){return _0x4166ee['update'](_0x44f0e8)[_0xaac4('0x1e')](function(_0x4e1e89){return _0x4e1e89;});}return null;};}function removeEntity(_0x3303f1,_0x2013b7){return function(_0x43625c){if(_0x43625c){return _0x43625c[_0xaac4('0x1f')]()[_0xaac4('0x1e')](function(){_0x3303f1[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43ccdc,_0x27a84d){return function(_0x174860){if(!_0x174860){_0x43ccdc[_0xaac4('0x14')](0x194);}return _0x174860;};}function handleError(_0x3dd059,_0x2dcc59){_0x2dcc59=_0x2dcc59||0x1f4;return function(_0xb2577b){logger['error'](_0xb2577b[_0xaac4('0x20')]);if(_0xb2577b['name']){delete _0xb2577b['name'];}_0x3dd059['status'](_0x2dcc59)['send'](_0xb2577b);};}exports[_0xaac4('0x21')]=function(_0x17d25f,_0x22cda2){var _0xe93120={},_0x3c1445={},_0x249a5d={'count':0x0,'rows':[]};var _0x43b122=db[_0xaac4('0x22')][_0xaac4('0x23')];_0x3c1445[_0xaac4('0x24')]=_['keys'](_0x43b122);_0x3c1445[_0xaac4('0x25')]=_[_0xaac4('0x26')](_0x17d25f[_0xaac4('0x25')]);_0x3c1445[_0xaac4('0x27')]=_[_0xaac4('0x28')](_0x3c1445[_0xaac4('0x24')],_0x3c1445['query']);_0xe93120[_0xaac4('0x29')]=_['intersection'](_0x3c1445[_0xaac4('0x24')],qs[_0xaac4('0x2a')](_0x17d25f[_0xaac4('0x25')][_0xaac4('0x2a')]));_0xe93120['attributes']=_0xe93120['attributes']['length']?_0xe93120[_0xaac4('0x29')]:_0x3c1445[_0xaac4('0x24')];if(!_0x17d25f[_0xaac4('0x25')][_0xaac4('0x2b')](_0xaac4('0x2c'))){_0xe93120[_0xaac4('0x2d')]=qs[_0xaac4('0x2d')](_0x17d25f[_0xaac4('0x25')][_0xaac4('0x2d')]);_0xe93120[_0xaac4('0x19')]=qs[_0xaac4('0x19')](_0x17d25f[_0xaac4('0x25')][_0xaac4('0x19')]);}_0xe93120[_0xaac4('0x2e')]=qs[_0xaac4('0x2f')](_0x17d25f['query']['sort']);_0xe93120[_0xaac4('0x30')]=qs[_0xaac4('0x27')](_[_0xaac4('0x31')](_0x17d25f['query'],_0x3c1445[_0xaac4('0x27')]));if(_0x17d25f[_0xaac4('0x25')][_0xaac4('0x32')]){_0xe93120[_0xaac4('0x30')]=_[_0xaac4('0x33')](_0xe93120[_0xaac4('0x30')],{'$or':_[_0xaac4('0x34')](_0x43b122,function(_0x53b7cb){if(_0x53b7cb[_0xaac4('0x35')][_0xaac4('0x36')]!==_0xaac4('0x37')){var _0x5d64a2={};_0x5d64a2[_0x53b7cb[_0xaac4('0x38')]]={'$like':'%'+_0x17d25f['query']['filter']+'%'};return _0x5d64a2;}})});}_0xe93120=_[_0xaac4('0x33')]({},_0xe93120,_0x17d25f[_0xaac4('0x39')]);var _0x2da28a={'where':_0xe93120['where']};return db['CmHopperFinal'][_0xaac4('0x18')](_0x2da28a)[_0xaac4('0x1e')](function(_0x2f7300){_0x249a5d[_0xaac4('0x18')]=_0x2f7300;if(_0x17d25f[_0xaac4('0x25')][_0xaac4('0x3a')]){_0xe93120['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xaac4('0x3b')](_0xe93120);})[_0xaac4('0x1e')](function(_0x5371b4){_0x249a5d[_0xaac4('0x3c')]=_0x5371b4;return _0x249a5d;})[_0xaac4('0x1e')](respondWithFilteredResult(_0x22cda2,_0xe93120))[_0xaac4('0x3d')](handleError(_0x22cda2,null));};exports['show']=function(_0x74a1c,_0x4a4773){var _0x2259fc={'raw':!![],'where':{'id':_0x74a1c[_0xaac4('0x3e')]['id']}},_0x5bc387={};_0x5bc387[_0xaac4('0x24')]=_[_0xaac4('0x26')](db[_0xaac4('0x22')]['rawAttributes']);_0x5bc387[_0xaac4('0x25')]=_['keys'](_0x74a1c['query']);_0x5bc387[_0xaac4('0x27')]=_[_0xaac4('0x28')](_0x5bc387[_0xaac4('0x24')],_0x5bc387[_0xaac4('0x25')]);_0x2259fc[_0xaac4('0x29')]=_[_0xaac4('0x28')](_0x5bc387[_0xaac4('0x24')],qs[_0xaac4('0x2a')](_0x74a1c['query'][_0xaac4('0x2a')]));_0x2259fc[_0xaac4('0x29')]=_0x2259fc[_0xaac4('0x29')][_0xaac4('0x3f')]?_0x2259fc['attributes']:_0x5bc387[_0xaac4('0x24')];if(_0x74a1c[_0xaac4('0x25')][_0xaac4('0x3a')]){_0x2259fc['include']=[{'all':!![]}];}_0x2259fc=_[_0xaac4('0x33')]({},_0x2259fc,_0x74a1c[_0xaac4('0x39')]);return db[_0xaac4('0x22')][_0xaac4('0x40')](_0x2259fc)['then'](handleEntityNotFound(_0x4a4773,null))[_0xaac4('0x1e')](respondWithResult(_0x4a4773,null))[_0xaac4('0x3d')](handleError(_0x4a4773,null));};exports[_0xaac4('0x41')]=function(_0x57a7ab,_0xf404b9){return db[_0xaac4('0x22')][_0xaac4('0x41')]()[_0xaac4('0x1e')](respondWithResult(_0xf404b9,null))[_0xaac4('0x3d')](handleError(_0xf404b9,null));};exports[_0xaac4('0x42')]=function(_0x25e1b1,_0xa8d1c9){if(_0x25e1b1[_0xaac4('0x43')]['uniqueid']){delete _0x25e1b1[_0xaac4('0x43')][_0xaac4('0x44')];}return db[_0xaac4('0x22')][_0xaac4('0x40')]({'where':{'uniqueid':_0x25e1b1[_0xaac4('0x3e')]['id']}})['then'](handleEntityNotFound(_0xa8d1c9,null))['then'](saveUpdates(_0x25e1b1[_0xaac4('0x43')],null))[_0xaac4('0x1e')](respondWithResult(_0xa8d1c9,null))[_0xaac4('0x3d')](handleError(_0xa8d1c9,null));};exports[_0xaac4('0x45')]=function(_0x5f33ea,_0x283d51,_0x528f3f){return db[_0xaac4('0x22')][_0xaac4('0x3b')]({'raw':![],'where':{'VoiceQueueId':_0x5f33ea['params']['id']},'attributes':[[db[_0xaac4('0x46')]['fn'](_0xaac4('0x47'),db[_0xaac4('0x46')]['fn']('IF',db['sequelize']['literal'](_0xaac4('0x48')))),_0xaac4('0x49')],[db[_0xaac4('0x46')]['fn'](_0xaac4('0x47'),db[_0xaac4('0x46')]['fn']('IF',db[_0xaac4('0x46')]['literal'](_0xaac4('0x4a')))),_0xaac4('0x4b')],[db[_0xaac4('0x46')]['fn'](_0xaac4('0x47'),db['sequelize']['fn']('IF',db[_0xaac4('0x46')]['literal'](_0xaac4('0x4c')))),_0xaac4('0x4d')],[db[_0xaac4('0x46')]['fn'](_0xaac4('0x47'),db[_0xaac4('0x46')]['fn']('IF',db[_0xaac4('0x46')][_0xaac4('0x4e')](_0xaac4('0x4f')))),_0xaac4('0x50')],[db[_0xaac4('0x46')]['fn'](_0xaac4('0x47'),db[_0xaac4('0x46')]['fn']('IF',db[_0xaac4('0x46')][_0xaac4('0x4e')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xaac4('0x51')],[db[_0xaac4('0x46')]['fn'](_0xaac4('0x47'),db[_0xaac4('0x46')]['fn']('IF',db[_0xaac4('0x46')][_0xaac4('0x4e')](_0xaac4('0x52')))),_0xaac4('0x53')],[db['sequelize']['fn'](_0xaac4('0x47'),db['sequelize']['fn']('IF',db[_0xaac4('0x46')]['literal'](_0xaac4('0x54')))),'reCallContacts'],[db['sequelize']['fn'](_0xaac4('0x47'),db[_0xaac4('0x46')]['fn']('IF',db['sequelize'][_0xaac4('0x4e')](_0xaac4('0x55')))),_0xaac4('0x56')]]})[_0xaac4('0x1e')](handleEntityNotFound(_0x283d51,null))[_0xaac4('0x1e')](respondWithResult(_0x283d51,null))[_0xaac4('0x3d')](handleError(_0x283d51,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x346f4c,_0x586a10,_0x2656ed){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x346f4c['params']['id']},'attributes':[[db[_0xaac4('0x46')]['fn'](_0xaac4('0x47'),db[_0xaac4('0x46')]['fn']('IF',db[_0xaac4('0x46')]['literal'](_0xaac4('0x48')))),_0xaac4('0x49')],[db[_0xaac4('0x46')]['fn']('COUNT',db[_0xaac4('0x46')]['fn']('IF',db[_0xaac4('0x46')][_0xaac4('0x4e')](_0xaac4('0x4a')))),_0xaac4('0x4b')],[db[_0xaac4('0x46')]['fn'](_0xaac4('0x47'),db['sequelize']['fn']('IF',db['sequelize'][_0xaac4('0x4e')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0xaac4('0x46')]['fn']('COUNT',db[_0xaac4('0x46')]['fn']('IF',db['sequelize'][_0xaac4('0x4e')](_0xaac4('0x4f')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xaac4('0x46')][_0xaac4('0x4e')](_0xaac4('0x57')))),_0xaac4('0x51')],[db['sequelize']['fn'](_0xaac4('0x47'),db[_0xaac4('0x46')]['fn']('IF',db[_0xaac4('0x46')][_0xaac4('0x4e')](_0xaac4('0x52')))),_0xaac4('0x53')],[db[_0xaac4('0x46')]['fn'](_0xaac4('0x47'),db[_0xaac4('0x46')]['fn']('IF',db[_0xaac4('0x46')][_0xaac4('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0xaac4('0x46')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xaac4('0x46')]['literal'](_0xaac4('0x55')))),_0xaac4('0x56')]]})[_0xaac4('0x1e')](handleEntityNotFound(_0x586a10,null))[_0xaac4('0x1e')](respondWithResult(_0x586a10,null))['catch'](handleError(_0x586a10,null));};exports[_0xaac4('0x58')]=function(_0x2de8d4,_0x987b2e,_0xd5e0e2){return db[_0xaac4('0x59')][_0xaac4('0x40')]({'where':{'id':_0x2de8d4['params']['id']}})[_0xaac4('0x1e')](handleEntityNotFound(_0x987b2e,null))[_0xaac4('0x1e')](function(_0x5b5e57){var _0x2e3fd9;if(_0x5b5e57){_0x2e3fd9=squel[_0xaac4('0x5a')]()['into']('cm_hopper')[_0xaac4('0x5b')]([_0xaac4('0x5c'),_0xaac4('0x5d'),_0xaac4('0x5e'),_0xaac4('0x5f'),_0xaac4('0x60'),_0xaac4('0x61'),_0xaac4('0x62')],squel['select']()[_0xaac4('0x38')](_0xaac4('0x63'),_0xaac4('0x5c'))[_0xaac4('0x38')](_0xaac4('0x64'),_0xaac4('0x5d'))['field'](_0xaac4('0x65'),_0xaac4('0x5e'))['field']('ANY_VALUE(ListId)','ListId')[_0xaac4('0x38')]('ANY_VALUE(VoiceQueueId)','VoiceQueueId')['field']('NOW()','createdAt')[_0xaac4('0x38')](_0xaac4('0x64'),_0xaac4('0x62'))[_0xaac4('0x66')]('cm_hopper_final')[_0xaac4('0x30')](_0xaac4('0x67'),_0x2de8d4[_0xaac4('0x3e')]['id'][_0xaac4('0x68')]())[_0xaac4('0x30')](_0xaac4('0x69'),_0x2de8d4[_0xaac4('0x43')]['state'][_0xaac4('0x68')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0xaac4('0x30')](_0xaac4('0x6a'),squel[_0xaac4('0x6b')]()[_0xaac4('0x38')](_0xaac4('0x5c'))[_0xaac4('0x66')](_0xaac4('0x6c'))[_0xaac4('0x30')](_0xaac4('0x67'),_0x2de8d4[_0xaac4('0x3e')]['id'][_0xaac4('0x68')]()))[_0xaac4('0x30')](_0xaac4('0x6a'),squel[_0xaac4('0x6b')]()[_0xaac4('0x38')](_0xaac4('0x6d'))[_0xaac4('0x66')](_0xaac4('0x6e'))[_0xaac4('0x30')](_0xaac4('0x67'),_0x2de8d4[_0xaac4('0x3e')]['id'][_0xaac4('0x68')]())[_0xaac4('0x30')](_0xaac4('0x6f')))[_0xaac4('0x70')]('ContactId'))[_0xaac4('0x68')]();return db[_0xaac4('0x46')][_0xaac4('0x25')](_0x2e3fd9);}return[];})[_0xaac4('0x1e')](respondWithResult(_0x987b2e,null))[_0xaac4('0x3d')](handleError(_0x987b2e,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1bbb55,_0x334462,_0x13d2aa){return db[_0xaac4('0x71')][_0xaac4('0x40')]({'where':{'id':_0x1bbb55['params']['id']}})[_0xaac4('0x1e')](handleEntityNotFound(_0x334462,null))['then'](function(_0xbf2dc8){var _0x36d642;if(_0xbf2dc8){_0x36d642=squel['insert']()[_0xaac4('0x72')]('cm_hopper')[_0xaac4('0x5b')]([_0xaac4('0x5c'),'scheduledAt',_0xaac4('0x5e'),_0xaac4('0x5f'),'CampaignId',_0xaac4('0x61'),_0xaac4('0x62')],squel[_0xaac4('0x6b')]()[_0xaac4('0x38')](_0xaac4('0x63'),_0xaac4('0x5c'))[_0xaac4('0x38')](_0xaac4('0x64'),_0xaac4('0x5d'))['field'](_0xaac4('0x65'),_0xaac4('0x5e'))[_0xaac4('0x38')]('ANY_VALUE(ListId)',_0xaac4('0x5f'))[_0xaac4('0x38')](_0xaac4('0x73'),_0xaac4('0x74'))[_0xaac4('0x38')](_0xaac4('0x64'),_0xaac4('0x61'))[_0xaac4('0x38')](_0xaac4('0x64'),_0xaac4('0x62'))[_0xaac4('0x66')](_0xaac4('0x6e'))[_0xaac4('0x30')](_0xaac4('0x75'),_0x1bbb55[_0xaac4('0x3e')]['id'][_0xaac4('0x68')]())['where'](_0xaac4('0x69'),_0x1bbb55[_0xaac4('0x43')][_0xaac4('0x76')]['toString']())[_0xaac4('0x30')](_0xaac4('0x77'))['where'](_0xaac4('0x6a'),squel['select']()[_0xaac4('0x38')](_0xaac4('0x5c'))[_0xaac4('0x66')](_0xaac4('0x6c'))[_0xaac4('0x30')](_0xaac4('0x75'),_0x1bbb55['params']['id'][_0xaac4('0x68')]()))[_0xaac4('0x30')](_0xaac4('0x6a'),squel[_0xaac4('0x6b')]()['field'](_0xaac4('0x6d'))[_0xaac4('0x66')](_0xaac4('0x6e'))['where'](_0xaac4('0x75'),_0x1bbb55[_0xaac4('0x3e')]['id'][_0xaac4('0x68')]())[_0xaac4('0x30')](_0xaac4('0x6f')))['group']('ContactId'))[_0xaac4('0x68')]();return db[_0xaac4('0x46')][_0xaac4('0x25')](_0x36d642);}return[];})[_0xaac4('0x1e')](respondWithResult(_0x334462,null))['catch'](handleError(_0x334462,null));};exports[_0xaac4('0x78')]=function(_0x233cb4,_0x43a593,_0x35d3a9){return db[_0xaac4('0x79')][_0xaac4('0x7a')]({'where':{'VoiceQueueId':_0x233cb4[_0xaac4('0x43')][_0xaac4('0x60')],'CampaignId':_0x233cb4[_0xaac4('0x43')][_0xaac4('0x74')],'ContactId':_0x233cb4[_0xaac4('0x43')][_0xaac4('0x5e')]}})[_0xaac4('0x1e')](handleEntityNotFound(_0x43a593,null))['then'](function(_0x2ac631){if(_0x2ac631){return _0x2ac631;}return null;})[_0xaac4('0x1e')](respondWithResult(_0x43a593,null))[_0xaac4('0x3d')](handleError(_0x43a593,null));}; \ No newline at end of file +var _0xbaf0=['`state`\x20=\x200,\x201,\x20null','noSuchContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','ListId','createdAt','updatedAt','ANY_VALUE(calleridnum)','NOW()','scheduledAt','ANY_VALUE(ContactId)','ContactId','VoiceQueueId','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','from','calleridnum','group','moveContactsIvrCampaignHopperFinal','Campaign','ANY_VALUE(ListId)','cm_hopper_final','CampaignId\x20=\x20?','state\x20=\x204','checkContactHopper','CampaignId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','update','then','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','map','key','VIRTUAL','field','options','includeAll','include','findAll','rows','show','params','catch','describe','uniqueid','body','find','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal'];(function(_0x3df5fb,_0x4451a5){var _0x5a3fc7=function(_0x306755){while(--_0x306755){_0x3df5fb['push'](_0x3df5fb['shift']());}};_0x5a3fc7(++_0x4451a5);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0baf('0x0'));var rimraf=require(_0x0baf('0x1'));var zipdir=require(_0x0baf('0x2'));var jsonpatch=require(_0x0baf('0x3'));var rp=require(_0x0baf('0x4'));var moment=require(_0x0baf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0baf('0x6'));var util=require(_0x0baf('0x7'));var path=require(_0x0baf('0x8'));var sox=require(_0x0baf('0x9'));var csv=require(_0x0baf('0xa'));var ejs=require(_0x0baf('0xb'));var fs=require('fs');var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var authService=require(_0x0baf('0x12'));var hardwareService=require(_0x0baf('0x13'));var Redis=require(_0x0baf('0x14'));var qs=require(_0x0baf('0x15'));var logger=require(_0x0baf('0x16'))(_0x0baf('0x17'));var utils=require(_0x0baf('0x18'));var config=require(_0x0baf('0x19'));var db=require(_0x0baf('0x1a'))['db'];function respondWithStatusCode(_0x51d93c,_0x5a53e2){_0x5a53e2=_0x5a53e2||0xcc;return function(_0x465dd7){if(_0x465dd7){return _0x51d93c[_0x0baf('0x1b')](_0x5a53e2);}return _0x51d93c[_0x0baf('0x1c')](_0x5a53e2)[_0x0baf('0x1d')]();};}function respondWithResult(_0x5a0583,_0x2ab33e){_0x2ab33e=_0x2ab33e||0xc8;return function(_0x49e44b){if(_0x49e44b){return _0x5a0583[_0x0baf('0x1c')](_0x2ab33e)[_0x0baf('0x1e')](_0x49e44b);}};}function respondWithFilteredResult(_0x7fbf67,_0x2bc381){return function(_0xb8339e){if(_0xb8339e){var _0x469599=_0xb8339e[_0x0baf('0x1f')],_0x4f80a8=_0x2bc381[_0x0baf('0x20')],_0x4cd79d=_0x2bc381[_0x0baf('0x20')]+_0x2bc381[_0x0baf('0x21')],_0x2312c7;if(_0x4cd79d>=_0x469599){_0x4cd79d=_0x469599;_0x2312c7=0xc8;}else{_0x2312c7=0xce;}_0x7fbf67[_0x0baf('0x1c')](_0x2312c7);return _0x7fbf67['set'](_0x0baf('0x22'),_0x4f80a8+'-'+_0x4cd79d+'/'+_0x469599)[_0x0baf('0x1e')](_0xb8339e);}return null;};}function patchUpdates(_0x1ef0e5){return function(_0x3e9cb4){try{jsonpatch[_0x0baf('0x23')](_0x3e9cb4,_0x1ef0e5,!![]);}catch(_0x42b7f2){return BPromise['reject'](_0x42b7f2);}return _0x3e9cb4['save']();};}function saveUpdates(_0x1410ec,_0x154f48){return function(_0x32e839){if(_0x32e839){return _0x32e839[_0x0baf('0x24')](_0x1410ec)[_0x0baf('0x25')](function(_0x3e3e20){return _0x3e3e20;});}return null;};}function removeEntity(_0x210cd8,_0x636a13){return function(_0x2c42e2){if(_0x2c42e2){return _0x2c42e2[_0x0baf('0x26')]()['then'](function(){_0x210cd8[_0x0baf('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf6c158,_0x5dbf00){return function(_0x4de74c){if(!_0x4de74c){_0xf6c158[_0x0baf('0x1b')](0x194);}return _0x4de74c;};}function handleError(_0x48a0e9,_0x4be1b9){_0x4be1b9=_0x4be1b9||0x1f4;return function(_0x47c4b){logger[_0x0baf('0x27')](_0x47c4b[_0x0baf('0x28')]);if(_0x47c4b[_0x0baf('0x29')]){delete _0x47c4b[_0x0baf('0x29')];}_0x48a0e9['status'](_0x4be1b9)[_0x0baf('0x2a')](_0x47c4b);};}exports[_0x0baf('0x2b')]=function(_0x1ca35a,_0x366e71){var _0x3843b8={},_0x3b9b31={},_0x453525={'count':0x0,'rows':[]};var _0x549fd0=db[_0x0baf('0x2c')][_0x0baf('0x2d')];_0x3b9b31[_0x0baf('0x2e')]=_[_0x0baf('0x2f')](_0x549fd0);_0x3b9b31['query']=_[_0x0baf('0x2f')](_0x1ca35a[_0x0baf('0x30')]);_0x3b9b31['filters']=_[_0x0baf('0x31')](_0x3b9b31[_0x0baf('0x2e')],_0x3b9b31[_0x0baf('0x30')]);_0x3843b8[_0x0baf('0x32')]=_[_0x0baf('0x31')](_0x3b9b31[_0x0baf('0x2e')],qs[_0x0baf('0x33')](_0x1ca35a['query'][_0x0baf('0x33')]));_0x3843b8[_0x0baf('0x32')]=_0x3843b8[_0x0baf('0x32')][_0x0baf('0x34')]?_0x3843b8[_0x0baf('0x32')]:_0x3b9b31[_0x0baf('0x2e')];if(!_0x1ca35a[_0x0baf('0x30')][_0x0baf('0x35')](_0x0baf('0x36'))){_0x3843b8[_0x0baf('0x21')]=qs[_0x0baf('0x21')](_0x1ca35a[_0x0baf('0x30')][_0x0baf('0x21')]);_0x3843b8[_0x0baf('0x20')]=qs['offset'](_0x1ca35a[_0x0baf('0x30')]['offset']);}_0x3843b8[_0x0baf('0x37')]=qs[_0x0baf('0x38')](_0x1ca35a[_0x0baf('0x30')][_0x0baf('0x38')]);_0x3843b8['where']=qs[_0x0baf('0x39')](_[_0x0baf('0x3a')](_0x1ca35a['query'],_0x3b9b31[_0x0baf('0x39')]));if(_0x1ca35a[_0x0baf('0x30')][_0x0baf('0x3b')]){_0x3843b8[_0x0baf('0x3c')]=_[_0x0baf('0x3d')](_0x3843b8[_0x0baf('0x3c')],{'$or':_[_0x0baf('0x3e')](_0x549fd0,function(_0x675461){if(_0x675461['type'][_0x0baf('0x3f')]!==_0x0baf('0x40')){var _0x5b991f={};_0x5b991f[_0x675461[_0x0baf('0x41')]]={'$like':'%'+_0x1ca35a['query']['filter']+'%'};return _0x5b991f;}})});}_0x3843b8=_[_0x0baf('0x3d')]({},_0x3843b8,_0x1ca35a[_0x0baf('0x42')]);var _0x5d3ad1={'where':_0x3843b8['where']};return db[_0x0baf('0x2c')][_0x0baf('0x1f')](_0x5d3ad1)[_0x0baf('0x25')](function(_0xb2d9ab){_0x453525[_0x0baf('0x1f')]=_0xb2d9ab;if(_0x1ca35a[_0x0baf('0x30')][_0x0baf('0x43')]){_0x3843b8[_0x0baf('0x44')]=[{'all':!![]}];}return db[_0x0baf('0x2c')][_0x0baf('0x45')](_0x3843b8);})[_0x0baf('0x25')](function(_0x148540){_0x453525[_0x0baf('0x46')]=_0x148540;return _0x453525;})[_0x0baf('0x25')](respondWithFilteredResult(_0x366e71,_0x3843b8))['catch'](handleError(_0x366e71,null));};exports[_0x0baf('0x47')]=function(_0x1435d5,_0x4f1de9){var _0x38006a={'raw':!![],'where':{'id':_0x1435d5[_0x0baf('0x48')]['id']}},_0x324369={};_0x324369[_0x0baf('0x2e')]=_[_0x0baf('0x2f')](db[_0x0baf('0x2c')]['rawAttributes']);_0x324369[_0x0baf('0x30')]=_[_0x0baf('0x2f')](_0x1435d5['query']);_0x324369[_0x0baf('0x39')]=_[_0x0baf('0x31')](_0x324369[_0x0baf('0x2e')],_0x324369[_0x0baf('0x30')]);_0x38006a['attributes']=_[_0x0baf('0x31')](_0x324369[_0x0baf('0x2e')],qs[_0x0baf('0x33')](_0x1435d5[_0x0baf('0x30')][_0x0baf('0x33')]));_0x38006a[_0x0baf('0x32')]=_0x38006a[_0x0baf('0x32')][_0x0baf('0x34')]?_0x38006a[_0x0baf('0x32')]:_0x324369[_0x0baf('0x2e')];if(_0x1435d5['query'][_0x0baf('0x43')]){_0x38006a[_0x0baf('0x44')]=[{'all':!![]}];}_0x38006a=_[_0x0baf('0x3d')]({},_0x38006a,_0x1435d5[_0x0baf('0x42')]);return db[_0x0baf('0x2c')]['find'](_0x38006a)[_0x0baf('0x25')](handleEntityNotFound(_0x4f1de9,null))[_0x0baf('0x25')](respondWithResult(_0x4f1de9,null))[_0x0baf('0x49')](handleError(_0x4f1de9,null));};exports[_0x0baf('0x4a')]=function(_0x35b5db,_0x54ed41){return db[_0x0baf('0x2c')][_0x0baf('0x4a')]()[_0x0baf('0x25')](respondWithResult(_0x54ed41,null))[_0x0baf('0x49')](handleError(_0x54ed41,null));};exports[_0x0baf('0x24')]=function(_0x22d10f,_0x178995){if(_0x22d10f['body'][_0x0baf('0x4b')]){delete _0x22d10f[_0x0baf('0x4c')][_0x0baf('0x4b')];}return db['CmHopperFinal'][_0x0baf('0x4d')]({'where':{'uniqueid':_0x22d10f[_0x0baf('0x48')]['id']}})[_0x0baf('0x25')](handleEntityNotFound(_0x178995,null))[_0x0baf('0x25')](saveUpdates(_0x22d10f[_0x0baf('0x4c')],null))[_0x0baf('0x25')](respondWithResult(_0x178995,null))[_0x0baf('0x49')](handleError(_0x178995,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x22c451,_0x428c9b,_0x214a1d){return db[_0x0baf('0x2c')][_0x0baf('0x45')]({'raw':![],'where':{'VoiceQueueId':_0x22c451[_0x0baf('0x48')]['id']},'attributes':[[db[_0x0baf('0x4e')]['fn'](_0x0baf('0x4f'),db[_0x0baf('0x4e')]['fn']('IF',db[_0x0baf('0x4e')][_0x0baf('0x50')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x0baf('0x4e')]['fn'](_0x0baf('0x4f'),db[_0x0baf('0x4e')]['fn']('IF',db[_0x0baf('0x4e')][_0x0baf('0x50')](_0x0baf('0x51')))),_0x0baf('0x52')],[db['sequelize']['fn'](_0x0baf('0x4f'),db[_0x0baf('0x4e')]['fn']('IF',db[_0x0baf('0x4e')][_0x0baf('0x50')](_0x0baf('0x53')))),_0x0baf('0x54')],[db['sequelize']['fn'](_0x0baf('0x4f'),db['sequelize']['fn']('IF',db[_0x0baf('0x4e')]['literal'](_0x0baf('0x55')))),'congestionContacts'],[db[_0x0baf('0x4e')]['fn']('COUNT',db[_0x0baf('0x4e')]['fn']('IF',db[_0x0baf('0x4e')][_0x0baf('0x50')](_0x0baf('0x56')))),_0x0baf('0x57')],[db['sequelize']['fn'](_0x0baf('0x4f'),db[_0x0baf('0x4e')]['fn']('IF',db[_0x0baf('0x4e')][_0x0baf('0x50')](_0x0baf('0x58')))),_0x0baf('0x59')],[db['sequelize']['fn'](_0x0baf('0x4f'),db[_0x0baf('0x4e')]['fn']('IF',db[_0x0baf('0x4e')][_0x0baf('0x50')](_0x0baf('0x5a')))),_0x0baf('0x5b')],[db[_0x0baf('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0baf('0x4e')][_0x0baf('0x50')](_0x0baf('0x5c')))),_0x0baf('0x5d')]]})[_0x0baf('0x25')](handleEntityNotFound(_0x428c9b,null))[_0x0baf('0x25')](respondWithResult(_0x428c9b,null))[_0x0baf('0x49')](handleError(_0x428c9b,null));};exports[_0x0baf('0x5e')]=function(_0x3d9a32,_0x585969,_0x3238f9){return db[_0x0baf('0x2c')][_0x0baf('0x45')]({'raw':![],'where':{'CampaignId':_0x3d9a32[_0x0baf('0x48')]['id']},'attributes':[[db[_0x0baf('0x4e')]['fn'](_0x0baf('0x4f'),db[_0x0baf('0x4e')]['fn']('IF',db['sequelize'][_0x0baf('0x50')](_0x0baf('0x5f')))),_0x0baf('0x60')],[db[_0x0baf('0x4e')]['fn'](_0x0baf('0x4f'),db[_0x0baf('0x4e')]['fn']('IF',db[_0x0baf('0x4e')][_0x0baf('0x50')]('`state`\x20=\x203,\x201,\x20null'))),_0x0baf('0x52')],[db['sequelize']['fn'](_0x0baf('0x4f'),db['sequelize']['fn']('IF',db['sequelize'][_0x0baf('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x0baf('0x54')],[db[_0x0baf('0x4e')]['fn']('COUNT',db[_0x0baf('0x4e')]['fn']('IF',db[_0x0baf('0x4e')][_0x0baf('0x50')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x0baf('0x4e')]['fn'](_0x0baf('0x4f'),db[_0x0baf('0x4e')]['fn']('IF',db[_0x0baf('0x4e')][_0x0baf('0x50')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x0baf('0x57')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0baf('0x4e')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x0baf('0x59')],[db[_0x0baf('0x4e')]['fn'](_0x0baf('0x4f'),db[_0x0baf('0x4e')]['fn']('IF',db[_0x0baf('0x4e')][_0x0baf('0x50')]('`state`\x20=\x2022,\x201,\x20null'))),_0x0baf('0x5b')],[db[_0x0baf('0x4e')]['fn'](_0x0baf('0x4f'),db[_0x0baf('0x4e')]['fn']('IF',db[_0x0baf('0x4e')][_0x0baf('0x50')]('`state`\x20=\x2019,\x201,\x20null'))),_0x0baf('0x5d')]]})[_0x0baf('0x25')](handleEntityNotFound(_0x585969,null))[_0x0baf('0x25')](respondWithResult(_0x585969,null))['catch'](handleError(_0x585969,null));};exports[_0x0baf('0x61')]=function(_0x1e474f,_0x3d333d,_0x2c20fe){return db[_0x0baf('0x62')][_0x0baf('0x4d')]({'where':{'id':_0x1e474f[_0x0baf('0x48')]['id']}})['then'](handleEntityNotFound(_0x3d333d,null))['then'](function(_0x4b7caa){var _0x6ce83c;if(_0x4b7caa){_0x6ce83c=squel[_0x0baf('0x63')]()[_0x0baf('0x64')](_0x0baf('0x65'))[_0x0baf('0x66')]([_0x0baf('0x67'),'scheduledAt','ContactId',_0x0baf('0x68'),'VoiceQueueId',_0x0baf('0x69'),_0x0baf('0x6a')],squel['select']()[_0x0baf('0x41')](_0x0baf('0x6b'),_0x0baf('0x67'))[_0x0baf('0x41')](_0x0baf('0x6c'),_0x0baf('0x6d'))[_0x0baf('0x41')](_0x0baf('0x6e'),_0x0baf('0x6f'))['field']('ANY_VALUE(ListId)','ListId')['field']('ANY_VALUE(VoiceQueueId)',_0x0baf('0x70'))[_0x0baf('0x41')](_0x0baf('0x6c'),_0x0baf('0x69'))['field'](_0x0baf('0x6c'),_0x0baf('0x6a'))['from']('cm_hopper_final')[_0x0baf('0x3c')](_0x0baf('0x71'),_0x1e474f[_0x0baf('0x48')]['id'][_0x0baf('0x72')]())[_0x0baf('0x3c')](_0x0baf('0x73'),_0x1e474f[_0x0baf('0x4c')][_0x0baf('0x74')]['toString']())[_0x0baf('0x3c')](_0x0baf('0x75'))['where'](_0x0baf('0x76'),squel[_0x0baf('0x77')]()['field'](_0x0baf('0x67'))[_0x0baf('0x78')](_0x0baf('0x65'))[_0x0baf('0x3c')](_0x0baf('0x71'),_0x1e474f['params']['id']['toString']()))[_0x0baf('0x3c')](_0x0baf('0x76'),squel['select']()[_0x0baf('0x41')](_0x0baf('0x79'))[_0x0baf('0x78')]('cm_hopper_final')[_0x0baf('0x3c')](_0x0baf('0x71'),_0x1e474f[_0x0baf('0x48')]['id']['toString']())[_0x0baf('0x3c')]('state\x20=\x204'))[_0x0baf('0x7a')](_0x0baf('0x6f')))[_0x0baf('0x72')]();return db[_0x0baf('0x4e')][_0x0baf('0x30')](_0x6ce83c);}return[];})['then'](respondWithResult(_0x3d333d,null))[_0x0baf('0x49')](handleError(_0x3d333d,null));};exports[_0x0baf('0x7b')]=function(_0x5c8805,_0xc895a6,_0x205c3d){return db[_0x0baf('0x7c')][_0x0baf('0x4d')]({'where':{'id':_0x5c8805[_0x0baf('0x48')]['id']}})[_0x0baf('0x25')](handleEntityNotFound(_0xc895a6,null))[_0x0baf('0x25')](function(_0x1cda78){var _0x44ef57;if(_0x1cda78){_0x44ef57=squel[_0x0baf('0x63')]()[_0x0baf('0x64')](_0x0baf('0x65'))['fromQuery'](['phone',_0x0baf('0x6d'),_0x0baf('0x6f'),_0x0baf('0x68'),'CampaignId','createdAt',_0x0baf('0x6a')],squel[_0x0baf('0x77')]()[_0x0baf('0x41')](_0x0baf('0x6b'),_0x0baf('0x67'))[_0x0baf('0x41')](_0x0baf('0x6c'),_0x0baf('0x6d'))[_0x0baf('0x41')]('ANY_VALUE(ContactId)',_0x0baf('0x6f'))[_0x0baf('0x41')](_0x0baf('0x7d'),_0x0baf('0x68'))['field']('ANY_VALUE(CampaignId)','CampaignId')[_0x0baf('0x41')](_0x0baf('0x6c'),'createdAt')['field'](_0x0baf('0x6c'),_0x0baf('0x6a'))['from'](_0x0baf('0x7e'))[_0x0baf('0x3c')](_0x0baf('0x7f'),_0x5c8805[_0x0baf('0x48')]['id'][_0x0baf('0x72')]())[_0x0baf('0x3c')](_0x0baf('0x73'),_0x5c8805[_0x0baf('0x4c')][_0x0baf('0x74')][_0x0baf('0x72')]())[_0x0baf('0x3c')](_0x0baf('0x75'))['where'](_0x0baf('0x76'),squel[_0x0baf('0x77')]()[_0x0baf('0x41')](_0x0baf('0x67'))[_0x0baf('0x78')](_0x0baf('0x65'))['where'](_0x0baf('0x7f'),_0x5c8805[_0x0baf('0x48')]['id'][_0x0baf('0x72')]()))[_0x0baf('0x3c')](_0x0baf('0x76'),squel['select']()[_0x0baf('0x41')](_0x0baf('0x79'))[_0x0baf('0x78')](_0x0baf('0x7e'))[_0x0baf('0x3c')]('CampaignId\x20=\x20?',_0x5c8805['params']['id'][_0x0baf('0x72')]())['where'](_0x0baf('0x80')))['group'](_0x0baf('0x6f')))[_0x0baf('0x72')]();return db[_0x0baf('0x4e')][_0x0baf('0x30')](_0x44ef57);}return[];})['then'](respondWithResult(_0xc895a6,null))[_0x0baf('0x49')](handleError(_0xc895a6,null));};exports[_0x0baf('0x81')]=function(_0xf7a9d0,_0x551df3,_0x487aec){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0xf7a9d0[_0x0baf('0x4c')][_0x0baf('0x70')],'CampaignId':_0xf7a9d0[_0x0baf('0x4c')][_0x0baf('0x82')],'ContactId':_0xf7a9d0['body'][_0x0baf('0x6f')]}})[_0x0baf('0x25')](handleEntityNotFound(_0x551df3,null))[_0x0baf('0x25')](function(_0x4b4ef8){if(_0x4b4ef8){return _0x4b4ef8;}return null;})[_0x0baf('0x25')](respondWithResult(_0x551df3,null))[_0x0baf('0x49')](handleError(_0x551df3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 15c8a9e..dec2b46 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(_0x5864c9,_0x4d263f){var _0x1b8d1b=function(_0x18b045){while(--_0x18b045){_0x5864c9['push'](_0x5864c9['shift']());}};_0x1b8d1b(++_0x4d263f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3621b4,_0xd5dae1){_0x3621b4=_0x3621b4-0x0;var _0x134bca=_0x5f2f[_0x3621b4];return _0x134bca;};'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 _0x5f66=['request-promise','./cmHopperFinal.attributes','define','CmHopperFinal','calleridnum','uniqueid','util','api','moment','bluebird'];(function(_0x60286b,_0x3247c1){var _0x5dff69=function(_0x4ecfcf){while(--_0x4ecfcf){_0x60286b['push'](_0x60286b['shift']());}};_0x5dff69(++_0x3247c1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var attributes=require(_0x65f6('0x5'));module['exports']=function(_0x3c5029,_0x5150c8){return _0x3c5029[_0x65f6('0x6')](_0x65f6('0x7'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x65f6('0x8')]},{'name':_0x65f6('0x9'),'fields':[_0x65f6('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 07ba7e5..5ef2c4e 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 _0xa9e0=['message','result','catch','CmHopperFinal','create','body','options','raw','then','CreateCmHopperFinal','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x3d0e47,_0xa68ea1){var _0x2d9673=function(_0x16dc9e){while(--_0x16dc9e){_0x3d0e47['push'](_0x3d0e47['shift']());}};_0x2d9673(++_0xa68ea1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['CreateCmHopperFinal']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateCmHopperFinal',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file +var _0x0bb5=['then','info','CmHopperFinal,\x20%s,\x20%s','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','body','options','raw','CreateCmHopperFinal','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x55a95c,_0x1017ee){var _0x5c4533=function(_0x1e9e09){while(--_0x1e9e09){_0x55a95c['push'](_0x55a95c['shift']());}};_0x5c4533(++_0x1017ee);}(_0x0bb5,0x148));var _0x50bb=function(_0x4df7c6,_0x2c5888){_0x4df7c6=_0x4df7c6-0x0;var _0x10c506=_0x0bb5[_0x4df7c6];return _0x10c506;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x50bb('0x2'));var fs=require('fs');var Redis=require(_0x50bb('0x3'));var db=require(_0x50bb('0x4'))['db'];var utils=require(_0x50bb('0x5'));var logger=require(_0x50bb('0x6'))(_0x50bb('0x7'));var config=require(_0x50bb('0x8'));var jayson=require(_0x50bb('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfd7aeb,_0x35de5d,_0x2e5463){return new BPromise(function(_0x33ff54,_0x4f9172){return client['request'](_0xfd7aeb,_0x2e5463)[_0x50bb('0xa')](function(_0x1c2174){logger[_0x50bb('0xb')](_0x50bb('0xc'),_0x35de5d,'request\x20sent');logger[_0x50bb('0xd')](_0x50bb('0xe'),_0x35de5d,_0x50bb('0xf'),JSON[_0x50bb('0x10')](_0x1c2174));if(_0x1c2174[_0x50bb('0x11')]){if(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x12')]===0x1f4){logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174['error'][_0x50bb('0x13')]);return _0x4f9172(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);}logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);return _0x33ff54(_0x1c2174['error'][_0x50bb('0x13')]);}else{logger['info'](_0x50bb('0xc'),_0x35de5d,_0x50bb('0xf'));_0x33ff54(_0x1c2174[_0x50bb('0x14')][_0x50bb('0x13')]);}})[_0x50bb('0x15')](function(_0x4f2897){logger[_0x50bb('0x11')](_0x50bb('0xc'),_0x35de5d,_0x4f2897);_0x4f9172(_0x4f2897);});});}exports['CreateCmHopperFinal']=function(_0x24ba19){var _0x4796ec=this;return new Promise(function(_0x301f61,_0x431ed4){return db['CmHopperFinal']['create'](_0x24ba19[_0x50bb('0x16')],{'raw':_0x24ba19[_0x50bb('0x17')]?_0x24ba19[_0x50bb('0x17')][_0x50bb('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x19dc5d){logger[_0x50bb('0xb')](_0x50bb('0x19'),_0x24ba19);logger['debug'](_0x50bb('0x19'),_0x24ba19,JSON[_0x50bb('0x10')](_0x19dc5d));_0x301f61(_0x19dc5d);})[_0x50bb('0x15')](function(_0x4825f8){logger[_0x50bb('0x11')]('CreateCmHopperFinal',_0x4825f8[_0x50bb('0x13')],_0x24ba19);_0x431ed4(_0x4796ec[_0x50bb('0x11')](0x1f4,_0x4825f8[_0x50bb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 55392bf..32a91a3 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 _0x3e74=['isAuthenticated','index','describe','/:id','countContactsQueueCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','update','exports','multer','path','connect-timeout','express','../../components/interaction/service','./cmHopperFinal.controller','get'];(function(_0x191154,_0x56f74c){var _0x3dcd73=function(_0x51c321){while(--_0x51c321){_0x191154['push'](_0x191154['shift']());}};_0x3dcd73(++_0x56f74c);}(_0x3e74,0x175));var _0x43e7=function(_0x42815d,_0x411c0e){_0x42815d=_0x42815d-0x0;var _0x5817ee=_0x3e74[_0x42815d];return _0x5817ee;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/describe',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['show']);router[_0x43e7('0x6')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0x43e7('0xb')]);router[_0x43e7('0x6')]('/campaign/countAttributes/:id',auth[_0x43e7('0x7')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x43e7('0xc')](_0x43e7('0xd'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xc')](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0x43e7('0x10'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x11')]);router['put']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x12')]);module[_0x43e7('0x13')]=router; \ No newline at end of file +var _0x9957=['isAuthenticated','index','/describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./cmHopperFinal.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['describe']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x8')](_0x7995('0xe'),auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0x8')](_0x7995('0x10'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')]('/voice/queue/moveContacts/:id',auth[_0x7995('0x9')](),controller[_0x7995('0x13')]);router[_0x7995('0x12')](_0x7995('0x14'),auth[_0x7995('0x9')](),controller[_0x7995('0x15')]);router[_0x7995('0x12')]('/checkContactHopper',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0x9')](),controller[_0x7995('0x18')]);module[_0x7995('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 94426e8..2066bb9 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 _0x5785=['exports','INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x5785,0x119));var _0x5578=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x5785[_0x38ced4];return _0x547c07;};'use strict';var Sequelize=require(_0x5578('0x0'));module[_0x5578('0x1')]={'state':{'type':Sequelize[_0x5578('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5578('0x3')]},'scheduledat':{'type':Sequelize[_0x5578('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5578('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5578('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5578('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5578('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x5578('0x3')]},'originatecalleridname':{'type':Sequelize[_0x5578('0x3')]},'calleridnum':{'type':Sequelize[_0x5578('0x3')]},'calleridname':{'type':Sequelize[_0x5578('0x3')]},'starttime':{'type':Sequelize[_0x5578('0x4')]},'responsetime':{'type':Sequelize[_0x5578('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x5578('0x4')]},'endtime':{'type':Sequelize[_0x5578('0x4')]},'ringtime':{'type':Sequelize[_0x5578('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5578('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5578('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x5578('0x3')]},'membername':{'type':Sequelize[_0x5578('0x3')]},'reason':{'type':Sequelize[_0x5578('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x5578('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5578('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5578('0x4')]},'recallme':{'type':Sequelize[_0x5578('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x5578('0x4')]},'edited':{'type':Sequelize[_0x5578('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x3ca4=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3ca4,0x17d));var _0x43ca=function(_0x24f35b,_0x16825e){_0x24f35b=_0x24f35b-0x0;var _0x40b97e=_0x3ca4[_0x24f35b];return _0x40b97e;};'use strict';var Sequelize=require(_0x43ca('0x0'));module[_0x43ca('0x1')]={'state':{'type':Sequelize[_0x43ca('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x43ca('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x43ca('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x43ca('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x43ca('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x43ca('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x43ca('0x3')]},'originatecalleridname':{'type':Sequelize[_0x43ca('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x43ca('0x3')]},'starttime':{'type':Sequelize[_0x43ca('0x4')]},'responsetime':{'type':Sequelize[_0x43ca('0x4')]},'answertime':{'type':Sequelize[_0x43ca('0x4')]},'droptime':{'type':Sequelize[_0x43ca('0x4')]},'endtime':{'type':Sequelize[_0x43ca('0x4')]},'ringtime':{'type':Sequelize[_0x43ca('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x43ca('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x43ca('0x3')]},'campaign':{'type':Sequelize[_0x43ca('0x3')]},'campaigntype':{'type':Sequelize[_0x43ca('0x3')]},'membername':{'type':Sequelize[_0x43ca('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x43ca('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x43ca('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x43ca('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x43ca('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x43ca('0x4')]},'recallme':{'type':Sequelize[_0x43ca('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x43ca('0x4')]},'edited':{'type':Sequelize[_0x43ca('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 dbe0796..a14fb29 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 _0x6325=['include','findAll','rows','catch','params','find','create','body','describe','uniqueid','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','CmHopperHistory','rawAttributes','model','query','keys','intersection','attributes','fields','length','order','where','filters','pick','merge','map','type','key','VIRTUAL','field','filter','options','includeAll'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6325,0xe8));var _0x5632=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6325[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x5632('0x0'));var emlformat=require(_0x5632('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5632('0x2'));var rp=require(_0x5632('0x3'));var moment=require(_0x5632('0x4'));var BPromise=require(_0x5632('0x5'));var Mustache=require(_0x5632('0x6'));var util=require(_0x5632('0x7'));var path=require('path');var sox=require(_0x5632('0x8'));var csv=require(_0x5632('0x9'));var ejs=require(_0x5632('0xa'));var fs=require('fs');var _=require(_0x5632('0xb'));var squel=require('squel');var crypto=require(_0x5632('0xc'));var jsforce=require(_0x5632('0xd'));var deskjs=require(_0x5632('0xe'));var toCsv=require(_0x5632('0x9'));var querystring=require(_0x5632('0xf'));var Papa=require('papaparse');var authService=require(_0x5632('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0x5632('0x11'));var logger=require(_0x5632('0x12'))(_0x5632('0x13'));var utils=require(_0x5632('0x14'));var config=require(_0x5632('0x15'));var db=require(_0x5632('0x16'))['db'];function respondWithStatusCode(_0x3bf09c,_0x53b67c){_0x53b67c=_0x53b67c||0xcc;return function(_0x1589e8){if(_0x1589e8){return _0x3bf09c[_0x5632('0x17')](_0x53b67c);}return _0x3bf09c[_0x5632('0x18')](_0x53b67c)[_0x5632('0x19')]();};}function respondWithResult(_0x19dd34,_0x1257e6){_0x1257e6=_0x1257e6||0xc8;return function(_0xad5ae2){if(_0xad5ae2){return _0x19dd34[_0x5632('0x18')](_0x1257e6)[_0x5632('0x1a')](_0xad5ae2);}};}function respondWithFilteredResult(_0x43fcac,_0x32237a){return function(_0x582985){if(_0x582985){var _0x582189=_0x582985[_0x5632('0x1b')],_0x5e385c=_0x32237a[_0x5632('0x1c')],_0x262034=_0x32237a[_0x5632('0x1c')]+_0x32237a[_0x5632('0x1d')],_0x461126;if(_0x262034>=_0x582189){_0x262034=_0x582189;_0x461126=0xc8;}else{_0x461126=0xce;}_0x43fcac[_0x5632('0x18')](_0x461126);return _0x43fcac[_0x5632('0x1e')](_0x5632('0x1f'),_0x5e385c+'-'+_0x262034+'/'+_0x582189)[_0x5632('0x1a')](_0x582985);}return null;};}function patchUpdates(_0x4a431f){return function(_0x1c6310){try{jsonpatch[_0x5632('0x20')](_0x1c6310,_0x4a431f,!![]);}catch(_0x436278){return BPromise[_0x5632('0x21')](_0x436278);}return _0x1c6310[_0x5632('0x22')]();};}function saveUpdates(_0x2d8cdd,_0x5f1027){return function(_0x2c3b24){if(_0x2c3b24){return _0x2c3b24[_0x5632('0x23')](_0x2d8cdd)[_0x5632('0x24')](function(_0x18205a){return _0x18205a;});}return null;};}function removeEntity(_0x2b35f0,_0x2cd423){return function(_0x95d909){if(_0x95d909){return _0x95d909[_0x5632('0x25')]()[_0x5632('0x24')](function(){_0x2b35f0[_0x5632('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20f19d,_0x5beee5){return function(_0x2c308f){if(!_0x2c308f){_0x20f19d[_0x5632('0x17')](0x194);}return _0x2c308f;};}function handleError(_0x26f83d,_0x8e96){_0x8e96=_0x8e96||0x1f4;return function(_0x2adf93){logger[_0x5632('0x26')](_0x2adf93[_0x5632('0x27')]);if(_0x2adf93[_0x5632('0x28')]){delete _0x2adf93[_0x5632('0x28')];}_0x26f83d[_0x5632('0x18')](_0x8e96)[_0x5632('0x29')](_0x2adf93);};}exports['index']=function(_0x10249f,_0xe3af1f){var _0x278f1e={},_0x26b13e={},_0xddb3be={'count':0x0,'rows':[]};var _0x362466=db[_0x5632('0x2a')][_0x5632('0x2b')];_0x26b13e[_0x5632('0x2c')]=_['keys'](_0x362466);_0x26b13e[_0x5632('0x2d')]=_[_0x5632('0x2e')](_0x10249f[_0x5632('0x2d')]);_0x26b13e['filters']=_[_0x5632('0x2f')](_0x26b13e[_0x5632('0x2c')],_0x26b13e['query']);_0x278f1e[_0x5632('0x30')]=_[_0x5632('0x2f')](_0x26b13e[_0x5632('0x2c')],qs[_0x5632('0x31')](_0x10249f[_0x5632('0x2d')][_0x5632('0x31')]));_0x278f1e[_0x5632('0x30')]=_0x278f1e[_0x5632('0x30')][_0x5632('0x32')]?_0x278f1e[_0x5632('0x30')]:_0x26b13e[_0x5632('0x2c')];if(!_0x10249f['query']['hasOwnProperty']('nolimit')){_0x278f1e['limit']=qs[_0x5632('0x1d')](_0x10249f[_0x5632('0x2d')][_0x5632('0x1d')]);_0x278f1e[_0x5632('0x1c')]=qs[_0x5632('0x1c')](_0x10249f[_0x5632('0x2d')][_0x5632('0x1c')]);}_0x278f1e[_0x5632('0x33')]=qs['sort'](_0x10249f[_0x5632('0x2d')]['sort']);_0x278f1e[_0x5632('0x34')]=qs[_0x5632('0x35')](_[_0x5632('0x36')](_0x10249f[_0x5632('0x2d')],_0x26b13e[_0x5632('0x35')]));if(_0x10249f['query']['filter']){_0x278f1e[_0x5632('0x34')]=_[_0x5632('0x37')](_0x278f1e[_0x5632('0x34')],{'$or':_[_0x5632('0x38')](_0x362466,function(_0x5d6b9e){if(_0x5d6b9e[_0x5632('0x39')][_0x5632('0x3a')]!==_0x5632('0x3b')){var _0x521ae3={};_0x521ae3[_0x5d6b9e[_0x5632('0x3c')]]={'$like':'%'+_0x10249f['query'][_0x5632('0x3d')]+'%'};return _0x521ae3;}})});}_0x278f1e=_[_0x5632('0x37')]({},_0x278f1e,_0x10249f[_0x5632('0x3e')]);var _0x5123b8={'where':_0x278f1e['where']};return db[_0x5632('0x2a')][_0x5632('0x1b')](_0x5123b8)[_0x5632('0x24')](function(_0x151c02){_0xddb3be['count']=_0x151c02;if(_0x10249f[_0x5632('0x2d')][_0x5632('0x3f')]){_0x278f1e[_0x5632('0x40')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x5632('0x41')](_0x278f1e);})['then'](function(_0x3d1522){_0xddb3be[_0x5632('0x42')]=_0x3d1522;return _0xddb3be;})[_0x5632('0x24')](respondWithFilteredResult(_0xe3af1f,_0x278f1e))[_0x5632('0x43')](handleError(_0xe3af1f,null));};exports['show']=function(_0x53f3dd,_0x43edbe){var _0x409035={'raw':!![],'where':{'id':_0x53f3dd[_0x5632('0x44')]['id']}},_0x275de0={};_0x275de0[_0x5632('0x2c')]=_['keys'](db[_0x5632('0x2a')][_0x5632('0x2b')]);_0x275de0['query']=_[_0x5632('0x2e')](_0x53f3dd[_0x5632('0x2d')]);_0x275de0[_0x5632('0x35')]=_['intersection'](_0x275de0[_0x5632('0x2c')],_0x275de0[_0x5632('0x2d')]);_0x409035[_0x5632('0x30')]=_['intersection'](_0x275de0['model'],qs[_0x5632('0x31')](_0x53f3dd[_0x5632('0x2d')][_0x5632('0x31')]));_0x409035['attributes']=_0x409035['attributes']['length']?_0x409035[_0x5632('0x30')]:_0x275de0[_0x5632('0x2c')];if(_0x53f3dd['query'][_0x5632('0x3f')]){_0x409035[_0x5632('0x40')]=[{'all':!![]}];}_0x409035=_[_0x5632('0x37')]({},_0x409035,_0x53f3dd[_0x5632('0x3e')]);return db['CmHopperHistory'][_0x5632('0x45')](_0x409035)[_0x5632('0x24')](handleEntityNotFound(_0x43edbe,null))['then'](respondWithResult(_0x43edbe,null))['catch'](handleError(_0x43edbe,null));};exports['create']=function(_0x1cdfab,_0x20c388){return db[_0x5632('0x2a')][_0x5632('0x46')](_0x1cdfab[_0x5632('0x47')],{})[_0x5632('0x24')](respondWithResult(_0x20c388,0xc9))[_0x5632('0x43')](handleError(_0x20c388,null));};exports['describe']=function(_0x312845,_0x4a99d2){return db[_0x5632('0x2a')][_0x5632('0x48')]()[_0x5632('0x24')](respondWithResult(_0x4a99d2,null))[_0x5632('0x43')](handleError(_0x4a99d2,null));};exports[_0x5632('0x23')]=function(_0x339a8f,_0xef6a13){if(_0x339a8f[_0x5632('0x47')][_0x5632('0x49')]){delete _0x339a8f['body'][_0x5632('0x49')];}return db[_0x5632('0x2a')][_0x5632('0x45')]({'where':{'uniqueid':_0x339a8f[_0x5632('0x44')]['id']}})[_0x5632('0x24')](handleEntityNotFound(_0xef6a13,null))[_0x5632('0x24')](saveUpdates(_0x339a8f[_0x5632('0x47')],null))[_0x5632('0x24')](respondWithResult(_0xef6a13,null))[_0x5632('0x43')](handleError(_0xef6a13,null));}; \ No newline at end of file +var _0x4fdc=['set','apply','reject','save','update','stack','name','send','CmHopperHistory','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','type','key','VIRTUAL','options','includeAll','include','rows','show','then','create','body','catch','describe','uniqueid','find','params','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x4fdc,0xf9));var _0xc4fd=function(_0x45ac0b,_0x32c36c){_0x45ac0b=_0x45ac0b-0x0;var _0xc142dc=_0x4fdc[_0x45ac0b];return _0xc142dc;};'use strict';var pdf=require(_0xc4fd('0x0'));var emlformat=require(_0xc4fd('0x1'));var rimraf=require(_0xc4fd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc4fd('0x3'));var moment=require(_0xc4fd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc4fd('0x5'));var util=require(_0xc4fd('0x6'));var path=require(_0xc4fd('0x7'));var sox=require('sox');var csv=require(_0xc4fd('0x8'));var ejs=require(_0xc4fd('0x9'));var fs=require('fs');var _=require(_0xc4fd('0xa'));var squel=require('squel');var crypto=require(_0xc4fd('0xb'));var jsforce=require(_0xc4fd('0xc'));var deskjs=require(_0xc4fd('0xd'));var toCsv=require(_0xc4fd('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0xc4fd('0xe'));var hardwareService=require(_0xc4fd('0xf'));var Redis=require(_0xc4fd('0x10'));var qs=require(_0xc4fd('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xc4fd('0x12'));var config=require(_0xc4fd('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13807d,_0x4f662d){_0x4f662d=_0x4f662d||0xcc;return function(_0x5524dd){if(_0x5524dd){return _0x13807d[_0xc4fd('0x14')](_0x4f662d);}return _0x13807d[_0xc4fd('0x15')](_0x4f662d)[_0xc4fd('0x16')]();};}function respondWithResult(_0x1b49cd,_0xe82d34){_0xe82d34=_0xe82d34||0xc8;return function(_0x1d1e66){if(_0x1d1e66){return _0x1b49cd[_0xc4fd('0x15')](_0xe82d34)[_0xc4fd('0x17')](_0x1d1e66);}};}function respondWithFilteredResult(_0x1e44ff,_0x5441e1){return function(_0x3be186){if(_0x3be186){var _0x43964b=_0x3be186[_0xc4fd('0x18')],_0x596b40=_0x5441e1['offset'],_0x432b9b=_0x5441e1[_0xc4fd('0x19')]+_0x5441e1[_0xc4fd('0x1a')],_0x57c487;if(_0x432b9b>=_0x43964b){_0x432b9b=_0x43964b;_0x57c487=0xc8;}else{_0x57c487=0xce;}_0x1e44ff[_0xc4fd('0x15')](_0x57c487);return _0x1e44ff[_0xc4fd('0x1b')]('Content-Range',_0x596b40+'-'+_0x432b9b+'/'+_0x43964b)['json'](_0x3be186);}return null;};}function patchUpdates(_0x2e080a){return function(_0x291d34){try{jsonpatch[_0xc4fd('0x1c')](_0x291d34,_0x2e080a,!![]);}catch(_0x496a6d){return BPromise[_0xc4fd('0x1d')](_0x496a6d);}return _0x291d34[_0xc4fd('0x1e')]();};}function saveUpdates(_0x287686,_0x322041){return function(_0x2a124e){if(_0x2a124e){return _0x2a124e[_0xc4fd('0x1f')](_0x287686)['then'](function(_0x588204){return _0x588204;});}return null;};}function removeEntity(_0x31fd71,_0x274a40){return function(_0x4a366b){if(_0x4a366b){return _0x4a366b['destroy']()['then'](function(){_0x31fd71[_0xc4fd('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c827b,_0x32f0bf){return function(_0x4c60b4){if(!_0x4c60b4){_0x1c827b['sendStatus'](0x194);}return _0x4c60b4;};}function handleError(_0x26010b,_0x29fe78){_0x29fe78=_0x29fe78||0x1f4;return function(_0x53c4cc){logger['error'](_0x53c4cc[_0xc4fd('0x20')]);if(_0x53c4cc[_0xc4fd('0x21')]){delete _0x53c4cc[_0xc4fd('0x21')];}_0x26010b['status'](_0x29fe78)[_0xc4fd('0x22')](_0x53c4cc);};}exports['index']=function(_0x20b13d,_0x53eef5){var _0x5e0a37={},_0xc04747={},_0x4c04ad={'count':0x0,'rows':[]};var _0x502458=db[_0xc4fd('0x23')][_0xc4fd('0x24')];_0xc04747[_0xc4fd('0x25')]=_[_0xc4fd('0x26')](_0x502458);_0xc04747[_0xc4fd('0x27')]=_['keys'](_0x20b13d[_0xc4fd('0x27')]);_0xc04747[_0xc4fd('0x28')]=_[_0xc4fd('0x29')](_0xc04747[_0xc4fd('0x25')],_0xc04747[_0xc4fd('0x27')]);_0x5e0a37[_0xc4fd('0x2a')]=_[_0xc4fd('0x29')](_0xc04747['model'],qs[_0xc4fd('0x2b')](_0x20b13d['query'][_0xc4fd('0x2b')]));_0x5e0a37[_0xc4fd('0x2a')]=_0x5e0a37[_0xc4fd('0x2a')][_0xc4fd('0x2c')]?_0x5e0a37[_0xc4fd('0x2a')]:_0xc04747['model'];if(!_0x20b13d[_0xc4fd('0x27')][_0xc4fd('0x2d')](_0xc4fd('0x2e'))){_0x5e0a37['limit']=qs[_0xc4fd('0x1a')](_0x20b13d['query'][_0xc4fd('0x1a')]);_0x5e0a37[_0xc4fd('0x19')]=qs[_0xc4fd('0x19')](_0x20b13d[_0xc4fd('0x27')][_0xc4fd('0x19')]);}_0x5e0a37['order']=qs[_0xc4fd('0x2f')](_0x20b13d[_0xc4fd('0x27')][_0xc4fd('0x2f')]);_0x5e0a37[_0xc4fd('0x30')]=qs[_0xc4fd('0x28')](_[_0xc4fd('0x31')](_0x20b13d[_0xc4fd('0x27')],_0xc04747[_0xc4fd('0x28')]));if(_0x20b13d[_0xc4fd('0x27')][_0xc4fd('0x32')]){_0x5e0a37['where']=_[_0xc4fd('0x33')](_0x5e0a37['where'],{'$or':_[_0xc4fd('0x34')](_0x502458,function(_0x3bf102){if(_0x3bf102[_0xc4fd('0x35')][_0xc4fd('0x36')]!==_0xc4fd('0x37')){var _0x4a078a={};_0x4a078a[_0x3bf102['field']]={'$like':'%'+_0x20b13d[_0xc4fd('0x27')]['filter']+'%'};return _0x4a078a;}})});}_0x5e0a37=_['merge']({},_0x5e0a37,_0x20b13d[_0xc4fd('0x38')]);var _0x3673ac={'where':_0x5e0a37[_0xc4fd('0x30')]};return db[_0xc4fd('0x23')][_0xc4fd('0x18')](_0x3673ac)['then'](function(_0x2f62f1){_0x4c04ad[_0xc4fd('0x18')]=_0x2f62f1;if(_0x20b13d[_0xc4fd('0x27')][_0xc4fd('0x39')]){_0x5e0a37[_0xc4fd('0x3a')]=[{'all':!![]}];}return db[_0xc4fd('0x23')]['findAll'](_0x5e0a37);})['then'](function(_0x23f88b){_0x4c04ad[_0xc4fd('0x3b')]=_0x23f88b;return _0x4c04ad;})['then'](respondWithFilteredResult(_0x53eef5,_0x5e0a37))['catch'](handleError(_0x53eef5,null));};exports[_0xc4fd('0x3c')]=function(_0x1e843a,_0x49405a){var _0x44f424={'raw':!![],'where':{'id':_0x1e843a['params']['id']}},_0x265a49={};_0x265a49[_0xc4fd('0x25')]=_['keys'](db[_0xc4fd('0x23')][_0xc4fd('0x24')]);_0x265a49[_0xc4fd('0x27')]=_[_0xc4fd('0x26')](_0x1e843a[_0xc4fd('0x27')]);_0x265a49[_0xc4fd('0x28')]=_['intersection'](_0x265a49[_0xc4fd('0x25')],_0x265a49[_0xc4fd('0x27')]);_0x44f424[_0xc4fd('0x2a')]=_[_0xc4fd('0x29')](_0x265a49[_0xc4fd('0x25')],qs['fields'](_0x1e843a[_0xc4fd('0x27')][_0xc4fd('0x2b')]));_0x44f424[_0xc4fd('0x2a')]=_0x44f424[_0xc4fd('0x2a')][_0xc4fd('0x2c')]?_0x44f424[_0xc4fd('0x2a')]:_0x265a49[_0xc4fd('0x25')];if(_0x1e843a[_0xc4fd('0x27')][_0xc4fd('0x39')]){_0x44f424[_0xc4fd('0x3a')]=[{'all':!![]}];}_0x44f424=_[_0xc4fd('0x33')]({},_0x44f424,_0x1e843a[_0xc4fd('0x38')]);return db['CmHopperHistory']['find'](_0x44f424)[_0xc4fd('0x3d')](handleEntityNotFound(_0x49405a,null))[_0xc4fd('0x3d')](respondWithResult(_0x49405a,null))['catch'](handleError(_0x49405a,null));};exports[_0xc4fd('0x3e')]=function(_0x5f5672,_0x10d88a){return db[_0xc4fd('0x23')][_0xc4fd('0x3e')](_0x5f5672[_0xc4fd('0x3f')],{})[_0xc4fd('0x3d')](respondWithResult(_0x10d88a,0xc9))[_0xc4fd('0x40')](handleError(_0x10d88a,null));};exports['describe']=function(_0x1c1b79,_0x2f0b0e){return db['CmHopperHistory'][_0xc4fd('0x41')]()[_0xc4fd('0x3d')](respondWithResult(_0x2f0b0e,null))['catch'](handleError(_0x2f0b0e,null));};exports[_0xc4fd('0x1f')]=function(_0x5dee8a,_0x189453){if(_0x5dee8a['body']['uniqueid']){delete _0x5dee8a['body'][_0xc4fd('0x42')];}return db['CmHopperHistory'][_0xc4fd('0x43')]({'where':{'uniqueid':_0x5dee8a[_0xc4fd('0x44')]['id']}})[_0xc4fd('0x3d')](handleEntityNotFound(_0x189453,null))[_0xc4fd('0x3d')](saveUpdates(_0x5dee8a['body'],null))[_0xc4fd('0x3d')](respondWithResult(_0x189453,null))['catch'](handleError(_0x189453,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 0ade18a..772fc17 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 _0x2876=['exports','define','CmHopperHistory','endtime','uniqueid','lodash','util','api','bluebird','request-promise','./cmHopperHistory.attributes'];(function(_0x32ff61,_0x5731dc){var _0x4896b7=function(_0x17dff3){while(--_0x17dff3){_0x32ff61['push'](_0x32ff61['shift']());}};_0x4896b7(++_0x5731dc);}(_0x2876,0x165));var _0x6287=function(_0x43330e,_0x3ddaae){_0x43330e=_0x43330e-0x0;var _0x9fedf4=_0x2876[_0x43330e];return _0x9fedf4;};'use strict';var _=require(_0x6287('0x0'));var util=require(_0x6287('0x1'));var logger=require('../../config/logger')(_0x6287('0x2'));var moment=require('moment');var BPromise=require(_0x6287('0x3'));var rp=require(_0x6287('0x4'));var attributes=require(_0x6287('0x5'));module[_0x6287('0x6')]=function(_0x4d83c6,_0x578622){return _0x4d83c6[_0x6287('0x7')](_0x6287('0x8'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x6287('0x9'),'fields':[_0x6287('0x9')]},{'name':_0x6287('0xa'),'fields':[_0x6287('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaff9=['exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','./cmHopperHistory.attributes'];(function(_0x419e17,_0x7fe78c){var _0x1f2044=function(_0x3723e6){while(--_0x3723e6){_0x419e17['push'](_0x419e17['shift']());}};_0x1f2044(++_0x7fe78c);}(_0xaff9,0x1a6));var _0x9aff=function(_0x2918e4,_0x5992b7){_0x2918e4=_0x2918e4-0x0;var _0x3eab98=_0xaff9[_0x2918e4];return _0x3eab98;};'use strict';var _=require(_0x9aff('0x0'));var util=require(_0x9aff('0x1'));var logger=require(_0x9aff('0x2'))(_0x9aff('0x3'));var moment=require(_0x9aff('0x4'));var BPromise=require('bluebird');var rp=require(_0x9aff('0x5'));var attributes=require(_0x9aff('0x6'));module[_0x9aff('0x7')]=function(_0x3b1894,_0x5c7557){return _0x3b1894[_0x9aff('0x8')](_0x9aff('0x9'),attributes,{'tableName':_0x9aff('0xa'),'paranoid':![],'indexes':[{'name':_0x9aff('0xb'),'fields':[_0x9aff('0xb')]},{'name':_0x9aff('0xc'),'fields':[_0x9aff('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 35a3bbe..1645473 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 _0x99b7=['CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','CreateCmHopperHistory','create','body','raw','AvgHandleTime','CmHopperHistory','findAll','options','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','stringify','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','campaign','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x362496,_0x2778a0){var _0x593aba=function(_0x50addc){while(--_0x50addc){_0x362496['push'](_0x362496['shift']());}};_0x593aba(++_0x2778a0);}(_0x99b7,0x14e));var _0x799b=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0x99b7[_0x1bc013];return _0x55df36;};'use strict';var _=require(_0x799b('0x0'));var util=require('util');var moment=require(_0x799b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x799b('0x2'))['db'];var utils=require(_0x799b('0x3'));var logger=require(_0x799b('0x4'))('rpc');var config=require(_0x799b('0x5'));var jayson=require(_0x799b('0x6'));var client=jayson[_0x799b('0x7')][_0x799b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xfd685a,_0x1316b3,_0x4b901a){return new BPromise(function(_0x418a70,_0x1b0b13){return client[_0x799b('0x9')](_0xfd685a,_0x4b901a)[_0x799b('0xa')](function(_0x291e49){logger['info'](_0x799b('0xb'),_0x1316b3,_0x799b('0xc'));logger[_0x799b('0xd')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x1316b3,_0x799b('0xc'),JSON['stringify'](_0x291e49));if(_0x291e49['error']){if(_0x291e49[_0x799b('0xe')]['code']===0x1f4){logger[_0x799b('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x1316b3,_0x291e49[_0x799b('0xe')]['message']);return _0x1b0b13(_0x291e49['error'][_0x799b('0xf')]);}logger[_0x799b('0xe')](_0x799b('0xb'),_0x1316b3,_0x291e49[_0x799b('0xe')][_0x799b('0xf')]);return _0x418a70(_0x291e49[_0x799b('0xe')]['message']);}else{logger[_0x799b('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x1316b3,_0x799b('0xc'));_0x418a70(_0x291e49[_0x799b('0x11')]['message']);}})[_0x799b('0x12')](function(_0x19fab8){logger['error'](_0x799b('0xb'),_0x1316b3,_0x19fab8);_0x1b0b13(_0x19fab8);});});}exports[_0x799b('0x13')]=function(_0x3f5cbb){var _0x5d3012=this;return new Promise(function(_0x51d53c,_0x16a031){return db['CmHopperHistory'][_0x799b('0x14')](_0x3f5cbb[_0x799b('0x15')],{'raw':_0x3f5cbb['options']?_0x3f5cbb['options'][_0x799b('0x16')]===undefined?!![]:![]:!![]})[_0x799b('0xa')](function(_0x590d88){logger[_0x799b('0x10')](_0x799b('0x13'),_0x3f5cbb);logger[_0x799b('0xd')](_0x799b('0x13'),_0x3f5cbb,JSON['stringify'](_0x590d88));_0x51d53c(_0x590d88);})['catch'](function(_0x4109dd){logger[_0x799b('0xe')]('CreateCmHopperHistory',_0x4109dd[_0x799b('0xf')],_0x3f5cbb);_0x16a031(_0x5d3012[_0x799b('0xe')](0x1f4,_0x4109dd[_0x799b('0xf')]));});});};exports[_0x799b('0x17')]=function(_0x107e5e){var _0x4d2b79=this;return new Promise(function(_0x329809,_0x2dc880){return db[_0x799b('0x18')][_0x799b('0x19')]({'raw':_0x107e5e[_0x799b('0x1a')]?_0x107e5e[_0x799b('0x1a')][_0x799b('0x16')]===undefined?!![]:![]:!![],'where':_0x107e5e[_0x799b('0x1a')]?_0x107e5e[_0x799b('0x1a')]['where']||null:null,'attributes':[[db[_0x799b('0x1b')]['fn'](_0x799b('0x1c'),db[_0x799b('0x1b')][_0x799b('0x1d')]('id')),_0x799b('0x1e')],[db[_0x799b('0x1b')]['fn'](_0x799b('0x1c'),db[_0x799b('0x1b')]['fn']('IF',db['sequelize'][_0x799b('0x1f')](_0x799b('0x20')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0x799b('0x1c'),db['sequelize']['fn']('IF',db[_0x799b('0x1b')][_0x799b('0x1f')]('`state`\x20=\x2010,\x201,\x20null'))),_0x799b('0x21')],[db[_0x799b('0x1b')]['fn'](_0x799b('0x1c'),db[_0x799b('0x1b')]['fn']('IF',db['sequelize'][_0x799b('0x1f')]('`state`\x20=\x2011,\x201,\x20null'))),_0x799b('0x22')],[db['sequelize']['fn']('AVG',db[_0x799b('0x1b')]['fn']('IF',db[_0x799b('0x1b')][_0x799b('0x1f')](_0x799b('0x23')))),_0x799b('0x24')],[db[_0x799b('0x1b')]['fn'](_0x799b('0x25'),db[_0x799b('0x1b')]['fn']('IF',db[_0x799b('0x1b')][_0x799b('0x1f')](_0x799b('0x26')))),_0x799b('0x27')]]})[_0x799b('0xa')](function(_0x863741){logger[_0x799b('0x10')](_0x799b('0x17'),_0x107e5e);logger[_0x799b('0xd')](_0x799b('0x17'),_0x107e5e,JSON[_0x799b('0x28')](_0x863741));_0x329809(_0x863741);})[_0x799b('0x12')](function(_0x1beddf){logger['error'](_0x799b('0x17'),_0x1beddf[_0x799b('0xf')],_0x107e5e);_0x2dc880(_0x4d2b79['error'](0x1f4,_0x1beddf[_0x799b('0xf')]));});});};exports[_0x799b('0x29')]=function(_0x4f8bf7){var _0x521a8b=this;return new Promise(function(_0x410f77,_0x36ebcb){return db['CmHopperHistory'][_0x799b('0x19')]({'raw':_0x4f8bf7[_0x799b('0x1a')]?_0x4f8bf7[_0x799b('0x1a')][_0x799b('0x16')]===undefined?!![]:![]:!![],'where':_0x4f8bf7[_0x799b('0x1a')]?_0x4f8bf7[_0x799b('0x1a')]['where']||null:null,'attributes':[['campaign',_0x799b('0x2a')],[db[_0x799b('0x1b')]['fn'](_0x799b('0x1c'),db[_0x799b('0x1b')]['fn']('IF',db[_0x799b('0x1b')][_0x799b('0x1f')](_0x799b('0x2b')))),'outboundNoSuchCallsDay'],[db[_0x799b('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x799b('0x1b')][_0x799b('0x1f')](_0x799b('0x2c')))),_0x799b('0x2d')],[db['sequelize']['fn']('COUNT',db[_0x799b('0x1b')]['fn']('IF',db[_0x799b('0x1b')][_0x799b('0x1f')]('`state`\x20=\x204,\x201,\x20null'))),_0x799b('0x2e')],[db[_0x799b('0x1b')]['fn'](_0x799b('0x1c'),db[_0x799b('0x1b')]['fn']('IF',db[_0x799b('0x1b')]['literal'](_0x799b('0x2f')))),_0x799b('0x30')],[db[_0x799b('0x1b')]['fn']('COUNT',db[_0x799b('0x1b')]['fn']('IF',db[_0x799b('0x1b')]['literal'](_0x799b('0x31')))),_0x799b('0x32')],[db[_0x799b('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x799b('0x1b')][_0x799b('0x1f')](_0x799b('0x33')))),_0x799b('0x34')],[db[_0x799b('0x1b')]['fn'](_0x799b('0x1c'),db['sequelize']['fn']('IF',db[_0x799b('0x1b')][_0x799b('0x1f')](_0x799b('0x35')))),_0x799b('0x36')],[db[_0x799b('0x1b')]['fn'](_0x799b('0x1c'),db[_0x799b('0x1b')]['fn']('IF',db[_0x799b('0x1b')][_0x799b('0x1f')](_0x799b('0x37')))),_0x799b('0x38')],[db[_0x799b('0x1b')]['fn'](_0x799b('0x1c'),db[_0x799b('0x1b')]['fn']('IF',db[_0x799b('0x1b')][_0x799b('0x1f')]('`state`\x20=\x2013,\x201,\x20null'))),'outboundBlacklistCallsDay'],[db[_0x799b('0x1b')]['fn'](_0x799b('0x1c'),db[_0x799b('0x1b')]['fn']('IF',db[_0x799b('0x1b')][_0x799b('0x1f')](_0x799b('0x39')))),_0x799b('0x3a')],[db['sequelize']['fn'](_0x799b('0x1c'),db[_0x799b('0x1b')]['fn']('IF',db['sequelize'][_0x799b('0x1f')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x799b('0x1b')]['fn'](_0x799b('0x1c'),db[_0x799b('0x1b')]['fn']('IF',db[_0x799b('0x1b')][_0x799b('0x1f')](_0x799b('0x3b')))),_0x799b('0x3c')],[db['sequelize']['fn']('COUNT',db[_0x799b('0x1b')]['fn']('IF',db[_0x799b('0x1b')]['literal'](_0x799b('0x3d')))),_0x799b('0x3e')],[db[_0x799b('0x1b')]['fn']('COUNT',db[_0x799b('0x1b')]['fn']('IF',db['sequelize'][_0x799b('0x1f')](_0x799b('0x3f')))),_0x799b('0x40')]],'group':['campaign']})['then'](function(_0x56a441){logger[_0x799b('0x10')](_0x799b('0x29'),_0x4f8bf7);logger[_0x799b('0xd')](_0x799b('0x29'),_0x4f8bf7,JSON[_0x799b('0x28')](_0x56a441));_0x410f77(_0x56a441);})[_0x799b('0x12')](function(_0x3c484a){logger[_0x799b('0xe')](_0x799b('0x29'),_0x3c484a[_0x799b('0xf')],_0x4f8bf7);_0x36ebcb(_0x521a8b[_0x799b('0xe')](0x1f4,_0x3c484a[_0x799b('0xf')]));});});};exports[_0x799b('0x41')]=function(_0x5791a7){var _0x2ada6b=this;return new Promise(function(_0x3f3672,_0x3137d3){return db['CmHopperHistory'][_0x799b('0x19')]({'raw':_0x5791a7[_0x799b('0x1a')]?_0x5791a7[_0x799b('0x1a')][_0x799b('0x16')]===undefined?!![]:![]:!![],'where':_0x5791a7[_0x799b('0x1a')]?_0x5791a7['options']['where']||null:null,'attributes':[[_0x799b('0x42'),_0x799b('0x2a')],[db[_0x799b('0x1b')]['fn'](_0x799b('0x1c'),db[_0x799b('0x1b')][_0x799b('0x1d')]('id')),_0x799b('0x43')],[db[_0x799b('0x1b')]['fn'](_0x799b('0x1c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x799b('0x20')))),_0x799b('0x44')]],'group':[_0x799b('0x42')]})[_0x799b('0xa')](function(_0x44de3e){logger['info']('GetCampaignHopperHistory',_0x5791a7);logger[_0x799b('0xd')](_0x799b('0x41'),_0x5791a7,JSON['stringify'](_0x44de3e));_0x3f3672(_0x44de3e);})['catch'](function(_0x41b091){logger[_0x799b('0xe')](_0x799b('0x41'),_0x41b091[_0x799b('0xf')],_0x5791a7);_0x3137d3(_0x2ada6b[_0x799b('0xe')](0x1f4,_0x41b091[_0x799b('0xf')]));});});}; \ No newline at end of file +var _0x6427=['CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','create','body','options','raw','AvgHandleTime','CmHopperHistory','findAll','where','COUNT','sequelize','col','`state`\x20=\x204,\x201,\x20null','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','GetVoiceQueueHopperHistory','campaign','name','outboundNoSuchCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x339d7c,_0x198360){var _0x3bbc0a=function(_0x8f3e06){while(--_0x8f3e06){_0x339d7c['push'](_0x339d7c['shift']());}};_0x3bbc0a(++_0x198360);}(_0x6427,0xbe));var _0x7642=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x6427[_0x1e7b16];return _0x37fadc;};'use strict';var _=require('lodash');var util=require(_0x7642('0x0'));var moment=require(_0x7642('0x1'));var BPromise=require(_0x7642('0x2'));var rs=require(_0x7642('0x3'));var fs=require('fs');var Redis=require(_0x7642('0x4'));var db=require(_0x7642('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7642('0x6'))(_0x7642('0x7'));var config=require(_0x7642('0x8'));var jayson=require(_0x7642('0x9'));var client=jayson[_0x7642('0xa')][_0x7642('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cd5f4,_0x266b9b,_0xd37092){return new BPromise(function(_0x30946f,_0x5e4b1f){return client['request'](_0x1cd5f4,_0xd37092)[_0x7642('0xc')](function(_0x17527f){logger[_0x7642('0xd')](_0x7642('0xe'),_0x266b9b,_0x7642('0xf'));logger[_0x7642('0x10')](_0x7642('0x11'),_0x266b9b,_0x7642('0xf'),JSON[_0x7642('0x12')](_0x17527f));if(_0x17527f[_0x7642('0x13')]){if(_0x17527f[_0x7642('0x13')][_0x7642('0x14')]===0x1f4){logger[_0x7642('0x13')](_0x7642('0xe'),_0x266b9b,_0x17527f[_0x7642('0x13')][_0x7642('0x15')]);return _0x5e4b1f(_0x17527f[_0x7642('0x13')]['message']);}logger[_0x7642('0x13')](_0x7642('0xe'),_0x266b9b,_0x17527f['error'][_0x7642('0x15')]);return _0x30946f(_0x17527f['error'][_0x7642('0x15')]);}else{logger['info'](_0x7642('0xe'),_0x266b9b,_0x7642('0xf'));_0x30946f(_0x17527f[_0x7642('0x16')][_0x7642('0x15')]);}})[_0x7642('0x17')](function(_0x2febf8){logger[_0x7642('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x266b9b,_0x2febf8);_0x5e4b1f(_0x2febf8);});});}exports[_0x7642('0x18')]=function(_0x392686){var _0x123f99=this;return new Promise(function(_0x96bc79,_0x543f00){return db['CmHopperHistory'][_0x7642('0x19')](_0x392686[_0x7642('0x1a')],{'raw':_0x392686['options']?_0x392686[_0x7642('0x1b')][_0x7642('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x503c13){logger[_0x7642('0xd')](_0x7642('0x18'),_0x392686);logger['debug']('CreateCmHopperHistory',_0x392686,JSON[_0x7642('0x12')](_0x503c13));_0x96bc79(_0x503c13);})[_0x7642('0x17')](function(_0x37de2b){logger['error'](_0x7642('0x18'),_0x37de2b[_0x7642('0x15')],_0x392686);_0x543f00(_0x123f99['error'](0x1f4,_0x37de2b[_0x7642('0x15')]));});});};exports[_0x7642('0x1d')]=function(_0xf31489){var _0x21cdfe=this;return new Promise(function(_0x5174fa,_0x1987bb){return db[_0x7642('0x1e')][_0x7642('0x1f')]({'raw':_0xf31489[_0x7642('0x1b')]?_0xf31489['options'][_0x7642('0x1c')]===undefined?!![]:![]:!![],'where':_0xf31489[_0x7642('0x1b')]?_0xf31489[_0x7642('0x1b')][_0x7642('0x20')]||null:null,'attributes':[[db['sequelize']['fn'](_0x7642('0x21'),db[_0x7642('0x22')][_0x7642('0x23')]('id')),'predictiveIntervalTotalCalls'],[db[_0x7642('0x22')]['fn']('COUNT',db[_0x7642('0x22')]['fn']('IF',db[_0x7642('0x22')]['literal'](_0x7642('0x24')))),'predictiveIntervalAnsweredCalls'],[db[_0x7642('0x22')]['fn'](_0x7642('0x21'),db[_0x7642('0x22')]['fn']('IF',db[_0x7642('0x22')][_0x7642('0x25')](_0x7642('0x26')))),_0x7642('0x27')],[db[_0x7642('0x22')]['fn'](_0x7642('0x21'),db[_0x7642('0x22')]['fn']('IF',db[_0x7642('0x22')][_0x7642('0x25')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x7642('0x22')]['fn'](_0x7642('0x28'),db[_0x7642('0x22')]['fn']('IF',db['sequelize'][_0x7642('0x25')](_0x7642('0x29')))),'predictiveIntervalAvgHoldtime'],[db[_0x7642('0x22')]['fn']('AVG',db[_0x7642('0x22')]['fn']('IF',db[_0x7642('0x22')][_0x7642('0x25')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0x7642('0xc')](function(_0x5b7f24){logger['info']('AvgHandleTime',_0xf31489);logger['debug'](_0x7642('0x1d'),_0xf31489,JSON[_0x7642('0x12')](_0x5b7f24));_0x5174fa(_0x5b7f24);})[_0x7642('0x17')](function(_0x40c778){logger[_0x7642('0x13')](_0x7642('0x1d'),_0x40c778[_0x7642('0x15')],_0xf31489);_0x1987bb(_0x21cdfe[_0x7642('0x13')](0x1f4,_0x40c778[_0x7642('0x15')]));});});};exports[_0x7642('0x2a')]=function(_0x4e5aec){var _0x4975c5=this;return new Promise(function(_0x5600d9,_0xc5edf3){return db[_0x7642('0x1e')][_0x7642('0x1f')]({'raw':_0x4e5aec[_0x7642('0x1b')]?_0x4e5aec[_0x7642('0x1b')][_0x7642('0x1c')]===undefined?!![]:![]:!![],'where':_0x4e5aec[_0x7642('0x1b')]?_0x4e5aec[_0x7642('0x1b')]['where']||null:null,'attributes':[[_0x7642('0x2b'),_0x7642('0x2c')],[db[_0x7642('0x22')]['fn'](_0x7642('0x21'),db[_0x7642('0x22')]['fn']('IF',db['sequelize'][_0x7642('0x25')]('`state`\x20=\x200,\x201,\x20null'))),_0x7642('0x2d')],[db[_0x7642('0x22')]['fn']('COUNT',db[_0x7642('0x22')]['fn']('IF',db['sequelize'][_0x7642('0x25')]('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db[_0x7642('0x22')]['fn'](_0x7642('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0x7642('0x25')](_0x7642('0x24')))),_0x7642('0x2e')],[db['sequelize']['fn'](_0x7642('0x21'),db[_0x7642('0x22')]['fn']('IF',db[_0x7642('0x22')][_0x7642('0x25')](_0x7642('0x2f')))),_0x7642('0x30')],[db[_0x7642('0x22')]['fn'](_0x7642('0x21'),db[_0x7642('0x22')]['fn']('IF',db[_0x7642('0x22')]['literal'](_0x7642('0x31')))),_0x7642('0x32')],[db[_0x7642('0x22')]['fn'](_0x7642('0x21'),db[_0x7642('0x22')]['fn']('IF',db[_0x7642('0x22')][_0x7642('0x25')](_0x7642('0x33')))),'outboundDropCallsDayTimeout'],[db[_0x7642('0x22')]['fn']('COUNT',db[_0x7642('0x22')]['fn']('IF',db['sequelize'][_0x7642('0x25')](_0x7642('0x34')))),_0x7642('0x35')],[db[_0x7642('0x22')]['fn'](_0x7642('0x21'),db[_0x7642('0x22')]['fn']('IF',db['sequelize'][_0x7642('0x25')](_0x7642('0x36')))),_0x7642('0x37')],[db['sequelize']['fn'](_0x7642('0x21'),db[_0x7642('0x22')]['fn']('IF',db[_0x7642('0x22')][_0x7642('0x25')](_0x7642('0x38')))),_0x7642('0x39')],[db[_0x7642('0x22')]['fn'](_0x7642('0x21'),db[_0x7642('0x22')]['fn']('IF',db[_0x7642('0x22')]['literal'](_0x7642('0x3a')))),'outboundOriginateFailureCallsDay'],[db[_0x7642('0x22')]['fn'](_0x7642('0x21'),db[_0x7642('0x22')]['fn']('IF',db[_0x7642('0x22')][_0x7642('0x25')](_0x7642('0x3b')))),_0x7642('0x3c')],[db['sequelize']['fn'](_0x7642('0x21'),db[_0x7642('0x22')]['fn']('IF',db[_0x7642('0x22')][_0x7642('0x25')]('`state`\x20=\x2016,\x201,\x20null'))),_0x7642('0x3d')],[db[_0x7642('0x22')]['fn'](_0x7642('0x21'),db[_0x7642('0x22')]['fn']('IF',db['sequelize'][_0x7642('0x25')](_0x7642('0x3e')))),_0x7642('0x3c')],[db[_0x7642('0x22')]['fn']('COUNT',db[_0x7642('0x22')]['fn']('IF',db['sequelize']['literal'](_0x7642('0x3f')))),_0x7642('0x40')]],'group':[_0x7642('0x2b')]})[_0x7642('0xc')](function(_0x193624){logger[_0x7642('0xd')](_0x7642('0x2a'),_0x4e5aec);logger['debug'](_0x7642('0x2a'),_0x4e5aec,JSON[_0x7642('0x12')](_0x193624));_0x5600d9(_0x193624);})['catch'](function(_0x1952ea){logger[_0x7642('0x13')](_0x7642('0x2a'),_0x1952ea['message'],_0x4e5aec);_0xc5edf3(_0x4975c5[_0x7642('0x13')](0x1f4,_0x1952ea[_0x7642('0x15')]));});});};exports[_0x7642('0x41')]=function(_0x566b41){var _0x3ad09e=this;return new Promise(function(_0x2a97a6,_0x12914f){return db[_0x7642('0x1e')][_0x7642('0x1f')]({'raw':_0x566b41['options']?_0x566b41[_0x7642('0x1b')][_0x7642('0x1c')]===undefined?!![]:![]:!![],'where':_0x566b41[_0x7642('0x1b')]?_0x566b41['options'][_0x7642('0x20')]||null:null,'attributes':[[_0x7642('0x2b'),_0x7642('0x2c')],[db[_0x7642('0x22')]['fn'](_0x7642('0x21'),db['sequelize'][_0x7642('0x23')]('id')),_0x7642('0x42')],[db[_0x7642('0x22')]['fn']('COUNT',db[_0x7642('0x22')]['fn']('IF',db['sequelize'][_0x7642('0x25')](_0x7642('0x24')))),_0x7642('0x43')]],'group':[_0x7642('0x2b')]})[_0x7642('0xc')](function(_0x1cad79){logger['info']('GetCampaignHopperHistory',_0x566b41);logger['debug'](_0x7642('0x41'),_0x566b41,JSON['stringify'](_0x1cad79));_0x2a97a6(_0x1cad79);})['catch'](function(_0xa3ba0d){logger[_0x7642('0x13')](_0x7642('0x41'),_0xa3ba0d[_0x7642('0x15')],_0x566b41);_0x12914f(_0x3ad09e['error'](0x1f4,_0xa3ba0d[_0x7642('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index d3ba03a..3c3d6f7 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 _0x3468=['../../components/interaction/service','../../config/environment','index','/describe','isAuthenticated','describe','get','/:id','show','post','create','put','exports','multer','connect-timeout','../../components/auth/service'];(function(_0x26c315,_0x57e2be){var _0x3510c6=function(_0xe550cc){while(--_0xe550cc){_0x26c315['push'](_0x26c315['shift']());}};_0x3510c6(++_0x57e2be);}(_0x3468,0x8d));var _0x8346=function(_0x46d3c5,_0x3d5cf1){_0x46d3c5=_0x46d3c5-0x0;var _0x1ce952=_0x3468[_0x46d3c5];return _0x1ce952;};'use strict';var multer=require(_0x8346('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8346('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x8346('0x2'));var interaction=require(_0x8346('0x3'));var config=require(_0x8346('0x4'));var controller=require('./cmHopperHistory.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8346('0x5')]);router['get'](_0x8346('0x6'),auth[_0x8346('0x7')](),controller[_0x8346('0x8')]);router[_0x8346('0x9')](_0x8346('0xa'),auth[_0x8346('0x7')](),controller[_0x8346('0xb')]);router[_0x8346('0xc')]('/',auth[_0x8346('0x7')](),controller[_0x8346('0xd')]);router[_0x8346('0xe')](_0x8346('0xa'),auth[_0x8346('0x7')](),controller['update']);module[_0x8346('0xf')]=router; \ No newline at end of file +var _0x6fc4=['./cmHopperHistory.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update','multer','util','express','../../config/environment'];(function(_0x54a36e,_0x4a5c87){var _0x26c996=function(_0x594b1f){while(--_0x594b1f){_0x54a36e['push'](_0x54a36e['shift']());}};_0x26c996(++_0x4a5c87);}(_0x6fc4,0x1a0));var _0x46fc=function(_0x29cd14,_0x245c40){_0x29cd14=_0x29cd14-0x0;var _0x4229d1=_0x6fc4[_0x29cd14];return _0x4229d1;};'use strict';var multer=require(_0x46fc('0x0'));var util=require(_0x46fc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x46fc('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x46fc('0x3'));var controller=require(_0x46fc('0x4'));router[_0x46fc('0x5')]('/',auth[_0x46fc('0x6')](),controller[_0x46fc('0x7')]);router[_0x46fc('0x5')](_0x46fc('0x8'),auth[_0x46fc('0x6')](),controller['describe']);router['get'](_0x46fc('0x9'),auth[_0x46fc('0x6')](),controller[_0x46fc('0xa')]);router[_0x46fc('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x46fc('0xc')](_0x46fc('0x9'),auth['isAuthenticated'](),controller[_0x46fc('0xd')]);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 f5f8404..c394280 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 _0x814b=['STRING','name','sequelize','exports'];(function(_0x3ba170,_0x731f13){var _0x2f4579=function(_0xfb2e14){while(--_0xfb2e14){_0x3ba170['push'](_0x3ba170['shift']());}};_0x2f4579(++_0x731f13);}(_0x814b,0x1a2));var _0xb814=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0x814b[_0x4c0622];return _0x1799d8;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'name':{'type':Sequelize[_0xb814('0x2')],'unique':_0xb814('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb814('0x2')]},'dialPrefix':{'type':Sequelize[_0xb814('0x2')]}}; \ No newline at end of file +var _0x4819=['name','exports','STRING'];(function(_0x5d3e8e,_0x336d2f){var _0x474566=function(_0x2aa893){while(--_0x2aa893){_0x5d3e8e['push'](_0x5d3e8e['shift']());}};_0x474566(++_0x336d2f);}(_0x4819,0xcd));var _0x9481=function(_0x1dbaee,_0x433c30){_0x1dbaee=_0x1dbaee-0x0;var _0x55b745=_0x4819[_0x1dbaee];return _0x55b745;};'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 diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index b7596a7..ac67582 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 _0xe7d5=['attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','sequelize','Sequelize','TEXT','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','localhost','socket.io-emitter','./cmList.socket','status','count','offset','limit','set','json','apply','reject','save','then','destroy','get','Lists','UserProfileResource','end','stack','name','index','rawAttributes','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','type','key','VIRTUAL','field','options','CmList','include','rows','catch','params','keys','includeAll','merge','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','Disposition','findOne','hasOwnProperty','ListId','map','findAll','removeDispositions','addContacts','CmContact','tags','join','isArray','push','each','omit','ids','success','message','getContacts','CustomFields','concat','format','cf_%d','pick','raw','getContactsCsv','CmCustomField','isEmpty','now','setHeader','Content-disposition'];(function(_0xa1e3ca,_0x559022){var _0x5005ab=function(_0x12f90e){while(--_0x12f90e){_0xa1e3ca['push'](_0xa1e3ca['shift']());}};_0x5005ab(++_0x559022);}(_0xe7d5,0x1be));var _0x5e7d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe7d5[_0x21a9d9];return _0x46adce;};'use strict';var pdf=require(_0x5e7d('0x0'));var emlformat=require(_0x5e7d('0x1'));var rimraf=require(_0x5e7d('0x2'));var zipdir=require(_0x5e7d('0x3'));var jsonpatch=require(_0x5e7d('0x4'));var rp=require(_0x5e7d('0x5'));var moment=require(_0x5e7d('0x6'));var BPromise=require(_0x5e7d('0x7'));var Mustache=require(_0x5e7d('0x8'));var util=require(_0x5e7d('0x9'));var path=require('path');var sox=require(_0x5e7d('0xa'));var csv=require('to-csv');var ejs=require(_0x5e7d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5e7d('0xc'));var crypto=require('crypto');var jsforce=require(_0x5e7d('0xd'));var deskjs=require(_0x5e7d('0xe'));var toCsv=require(_0x5e7d('0xf'));var querystring=require(_0x5e7d('0x10'));var Papa=require(_0x5e7d('0x11'));var authService=require(_0x5e7d('0x12'));var hardwareService=require(_0x5e7d('0x13'));var Redis=require(_0x5e7d('0x14'));var qs=require(_0x5e7d('0x15'));var logger=require('../../config/logger')(_0x5e7d('0x16'));var utils=require(_0x5e7d('0x17'));var config=require(_0x5e7d('0x18'));var db=require(_0x5e7d('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x5e7d('0x1a'),'port':0x18eb});var socket=require(_0x5e7d('0x1b'))(new Redis(config['redis']));require(_0x5e7d('0x1c'))['register'](socket);function respondWithStatusCode(_0x3bbddd,_0x8da917){_0x8da917=_0x8da917||0xcc;return function(_0x236c5e){if(_0x236c5e){return _0x3bbddd['sendStatus'](_0x8da917);}return _0x3bbddd[_0x5e7d('0x1d')](_0x8da917)['end']();};}function respondWithResult(_0x56777e,_0x26b439){_0x26b439=_0x26b439||0xc8;return function(_0x19e8a8){if(_0x19e8a8){return _0x56777e['status'](_0x26b439)['json'](_0x19e8a8);}};}function respondWithFilteredResult(_0x21a686,_0xf9a6d7){return function(_0x1d3e71){if(_0x1d3e71){var _0xf36d81=_0x1d3e71[_0x5e7d('0x1e')],_0x4859af=_0xf9a6d7['offset'],_0x27380a=_0xf9a6d7[_0x5e7d('0x1f')]+_0xf9a6d7[_0x5e7d('0x20')],_0x3e0a75;if(_0x27380a>=_0xf36d81){_0x27380a=_0xf36d81;_0x3e0a75=0xc8;}else{_0x3e0a75=0xce;}_0x21a686[_0x5e7d('0x1d')](_0x3e0a75);return _0x21a686[_0x5e7d('0x21')]('Content-Range',_0x4859af+'-'+_0x27380a+'/'+_0xf36d81)[_0x5e7d('0x22')](_0x1d3e71);}return null;};}function patchUpdates(_0x30972d){return function(_0x32ac13){try{jsonpatch[_0x5e7d('0x23')](_0x32ac13,_0x30972d,!![]);}catch(_0x5e0e23){return BPromise[_0x5e7d('0x24')](_0x5e0e23);}return _0x32ac13[_0x5e7d('0x25')]();};}function saveUpdates(_0x44f550,_0x3ad1de){return function(_0x554b9a){if(_0x554b9a){return _0x554b9a['update'](_0x44f550)[_0x5e7d('0x26')](function(_0xcff4ad){return _0xcff4ad;});}return null;};}function removeEntity(_0x1f65db,_0x582e81){return function(_0x1b318b){if(_0x1b318b){return _0x1b318b[_0x5e7d('0x27')]()[_0x5e7d('0x26')](function(){var _0x478e7c=_0x1b318b[_0x5e7d('0x28')]({'plain':!![]});var _0x2fbae7=_0x5e7d('0x29');return db[_0x5e7d('0x2a')][_0x5e7d('0x27')]({'where':{'type':_0x2fbae7,'resourceId':_0x478e7c['id']}})[_0x5e7d('0x26')](function(){return _0x1b318b;});})[_0x5e7d('0x26')](function(){_0x1f65db['status'](0xcc)[_0x5e7d('0x2b')]();});}};}function handleEntityNotFound(_0x2f5720,_0xc43df){return function(_0x4c9c79){if(!_0x4c9c79){_0x2f5720['sendStatus'](0x194);}return _0x4c9c79;};}function handleError(_0x26848e,_0x41835f){_0x41835f=_0x41835f||0x1f4;return function(_0x51329f){logger['error'](_0x51329f[_0x5e7d('0x2c')]);if(_0x51329f[_0x5e7d('0x2d')]){delete _0x51329f[_0x5e7d('0x2d')];}_0x26848e[_0x5e7d('0x1d')](_0x41835f)['send'](_0x51329f);};}exports[_0x5e7d('0x2e')]=function(_0x148fe7,_0x1607cb){var _0x2d2204={},_0x437d4={},_0x23406d={'count':0x0,'rows':[]};var _0x160cd4=db['CmList'][_0x5e7d('0x2f')];_0x437d4[_0x5e7d('0x30')]=_['keys'](_0x160cd4);_0x437d4[_0x5e7d('0x31')]=_['keys'](_0x148fe7[_0x5e7d('0x31')]);_0x437d4[_0x5e7d('0x32')]=_[_0x5e7d('0x33')](_0x437d4[_0x5e7d('0x30')],_0x437d4[_0x5e7d('0x31')]);_0x2d2204[_0x5e7d('0x34')]=_[_0x5e7d('0x33')](_0x437d4['model'],qs[_0x5e7d('0x35')](_0x148fe7[_0x5e7d('0x31')]['fields']));_0x2d2204[_0x5e7d('0x34')]=_0x2d2204['attributes'][_0x5e7d('0x36')]?_0x2d2204[_0x5e7d('0x34')]:_0x437d4[_0x5e7d('0x30')];if(!_0x148fe7['query']['hasOwnProperty'](_0x5e7d('0x37'))){_0x2d2204['limit']=qs[_0x5e7d('0x20')](_0x148fe7[_0x5e7d('0x31')][_0x5e7d('0x20')]);_0x2d2204[_0x5e7d('0x1f')]=qs['offset'](_0x148fe7['query'][_0x5e7d('0x1f')]);}_0x2d2204[_0x5e7d('0x38')]=qs[_0x5e7d('0x39')](_0x148fe7[_0x5e7d('0x31')][_0x5e7d('0x39')]);_0x2d2204[_0x5e7d('0x3a')]=qs[_0x5e7d('0x32')](_['pick'](_0x148fe7[_0x5e7d('0x31')],_0x437d4[_0x5e7d('0x32')]));if(_0x148fe7['query'][_0x5e7d('0x3b')]){_0x2d2204[_0x5e7d('0x3a')]=_['merge'](_0x2d2204['where'],{'$or':_['map'](_0x160cd4,function(_0x291b87){if(_0x291b87[_0x5e7d('0x3c')][_0x5e7d('0x3d')]!==_0x5e7d('0x3e')){var _0x357767={};_0x357767[_0x291b87[_0x5e7d('0x3f')]]={'$like':'%'+_0x148fe7[_0x5e7d('0x31')][_0x5e7d('0x3b')]+'%'};return _0x357767;}})});}_0x2d2204=_['merge']({},_0x2d2204,_0x148fe7[_0x5e7d('0x40')]);var _0x33335e={'where':_0x2d2204[_0x5e7d('0x3a')]};return db[_0x5e7d('0x41')][_0x5e7d('0x1e')](_0x33335e)['then'](function(_0x54988e){_0x23406d[_0x5e7d('0x1e')]=_0x54988e;if(_0x148fe7[_0x5e7d('0x31')]['includeAll']){_0x2d2204[_0x5e7d('0x42')]=[{'all':!![]}];}return db['CmList']['findAll'](_0x2d2204);})['then'](function(_0x35d543){_0x23406d[_0x5e7d('0x43')]=_0x35d543;return _0x23406d;})[_0x5e7d('0x26')](respondWithFilteredResult(_0x1607cb,_0x2d2204))[_0x5e7d('0x44')](handleError(_0x1607cb,null));};exports['show']=function(_0x5936af,_0x3f3875){var _0x17dd6b={'raw':![],'where':{'id':_0x5936af[_0x5e7d('0x45')]['id']}},_0x5e19e8={};_0x5e19e8[_0x5e7d('0x30')]=_['keys'](db['CmList'][_0x5e7d('0x2f')]);_0x5e19e8['query']=_[_0x5e7d('0x46')](_0x5936af[_0x5e7d('0x31')]);_0x5e19e8['filters']=_[_0x5e7d('0x33')](_0x5e19e8[_0x5e7d('0x30')],_0x5e19e8[_0x5e7d('0x31')]);_0x17dd6b[_0x5e7d('0x34')]=_[_0x5e7d('0x33')](_0x5e19e8[_0x5e7d('0x30')],qs[_0x5e7d('0x35')](_0x5936af['query'][_0x5e7d('0x35')]));_0x17dd6b['attributes']=_0x17dd6b[_0x5e7d('0x34')][_0x5e7d('0x36')]?_0x17dd6b[_0x5e7d('0x34')]:_0x5e19e8[_0x5e7d('0x30')];if(_0x5936af[_0x5e7d('0x31')][_0x5e7d('0x47')]){_0x17dd6b[_0x5e7d('0x42')]=[{'all':!![]}];}_0x17dd6b=_[_0x5e7d('0x48')]({},_0x17dd6b,_0x5936af[_0x5e7d('0x40')]);return db[_0x5e7d('0x41')]['find'](_0x17dd6b)[_0x5e7d('0x26')](handleEntityNotFound(_0x3f3875,null))[_0x5e7d('0x26')](respondWithResult(_0x3f3875,null))[_0x5e7d('0x44')](handleError(_0x3f3875,null));};exports[_0x5e7d('0x49')]=function(_0x2823ca,_0x1ba76d){return db[_0x5e7d('0x41')][_0x5e7d('0x49')](_0x2823ca['body'],{})[_0x5e7d('0x26')](function(_0x540084){var _0x465448=_0x2823ca[_0x5e7d('0x4a')][_0x5e7d('0x28')]({'plain':!![]});if(!_0x465448)throw new Error(_0x5e7d('0x4b'));if(_0x465448['role']===_0x5e7d('0x4a')){var _0x1eab62=_0x540084[_0x5e7d('0x28')]({'plain':!![]});var _0x2f39fd='Lists';return db['UserProfileSection'][_0x5e7d('0x4c')]({'where':{'name':_0x2f39fd,'userProfileId':_0x465448[_0x5e7d('0x4d')]},'raw':!![]})['then'](function(_0x22a508){if(_0x22a508&&_0x22a508['autoAssociation']===0x0){return db[_0x5e7d('0x2a')][_0x5e7d('0x49')]({'name':_0x1eab62['name'],'resourceId':_0x1eab62['id'],'type':_0x22a508['name'],'sectionId':_0x22a508['id']},{})[_0x5e7d('0x26')](function(){return _0x540084;});}else{return _0x540084;}})[_0x5e7d('0x44')](function(_0x498ce1){logger['error'](_0x5e7d('0x4e'),_0x498ce1);throw _0x498ce1;});}return _0x540084;})['then'](respondWithResult(_0x1ba76d,0xc9))['catch'](handleError(_0x1ba76d,null));};exports[_0x5e7d('0x4f')]=function(_0x264903,_0x10973c){if(_0x264903['body']['id']){delete _0x264903[_0x5e7d('0x50')]['id'];}return db[_0x5e7d('0x41')][_0x5e7d('0x4c')]({'where':{'id':_0x264903['params']['id']}})['then'](handleEntityNotFound(_0x10973c,null))[_0x5e7d('0x26')](saveUpdates(_0x264903['body'],null))['then'](respondWithResult(_0x10973c,null))[_0x5e7d('0x44')](handleError(_0x10973c,null));};exports[_0x5e7d('0x27')]=function(_0x213255,_0xdb7a69){return db[_0x5e7d('0x41')]['find']({'where':{'id':_0x213255[_0x5e7d('0x45')]['id']}})[_0x5e7d('0x26')](handleEntityNotFound(_0xdb7a69,null))[_0x5e7d('0x26')](removeEntity(_0xdb7a69,null))['catch'](handleError(_0xdb7a69,null));};exports[_0x5e7d('0x51')]=function(_0x10bfdc,_0x2d6c77){return db[_0x5e7d('0x41')][_0x5e7d('0x51')]()[_0x5e7d('0x26')](respondWithResult(_0x2d6c77,null))[_0x5e7d('0x44')](handleError(_0x2d6c77,null));};exports[_0x5e7d('0x52')]=function(_0x4a6688,_0x45ad6d,_0x3d52e3){if(_0x4a6688[_0x5e7d('0x50')]['id']){delete _0x4a6688[_0x5e7d('0x50')]['id'];}return db[_0x5e7d('0x41')][_0x5e7d('0x4c')]({'where':{'id':_0x4a6688['params']['id']}})[_0x5e7d('0x26')](handleEntityNotFound(_0x45ad6d,null))['then'](function(_0x2d9b73){if(_0x2d9b73){_0x4a6688['body']['ListId']=_0x2d9b73['id'];return db[_0x5e7d('0x53')][_0x5e7d('0x49')](_0x4a6688[_0x5e7d('0x50')]);}})[_0x5e7d('0x26')](respondWithResult(_0x45ad6d,null))['catch'](handleError(_0x45ad6d,null));};exports['getDispositions']=function(_0x48bf7e,_0x52b763,_0x37506d){var _0x39783b={'raw':![],'where':{}};var _0x3832c8={};var _0x26520c={'count':0x0,'rows':[]};return db[_0x5e7d('0x41')][_0x5e7d('0x54')]({'where':{'id':_0x48bf7e['params']['id']}})[_0x5e7d('0x26')](handleEntityNotFound(_0x52b763,null))['then'](function(_0x2bec1d){if(_0x2bec1d){_0x3832c8[_0x5e7d('0x30')]=_['keys'](db['Disposition'][_0x5e7d('0x2f')]);_0x3832c8[_0x5e7d('0x31')]=_[_0x5e7d('0x46')](_0x48bf7e[_0x5e7d('0x31')]);_0x3832c8[_0x5e7d('0x32')]=_['intersection'](_0x3832c8[_0x5e7d('0x30')],_0x3832c8[_0x5e7d('0x31')]);_0x39783b[_0x5e7d('0x34')]=_[_0x5e7d('0x33')](_0x3832c8[_0x5e7d('0x30')],qs[_0x5e7d('0x35')](_0x48bf7e[_0x5e7d('0x31')][_0x5e7d('0x35')]));_0x39783b[_0x5e7d('0x34')]=_0x39783b[_0x5e7d('0x34')][_0x5e7d('0x36')]?_0x39783b['attributes']:_0x3832c8['model'];if(!_0x48bf7e[_0x5e7d('0x31')][_0x5e7d('0x55')](_0x5e7d('0x37'))){_0x39783b[_0x5e7d('0x20')]=qs['limit'](_0x48bf7e[_0x5e7d('0x31')][_0x5e7d('0x20')]);_0x39783b[_0x5e7d('0x1f')]=qs[_0x5e7d('0x1f')](_0x48bf7e[_0x5e7d('0x31')][_0x5e7d('0x1f')]);}_0x39783b[_0x5e7d('0x38')]=qs[_0x5e7d('0x39')](_0x48bf7e[_0x5e7d('0x31')][_0x5e7d('0x39')]);_0x39783b[_0x5e7d('0x3a')]=qs[_0x5e7d('0x32')](_['pick'](_0x48bf7e[_0x5e7d('0x31')],_0x3832c8[_0x5e7d('0x32')]));_0x39783b[_0x5e7d('0x3a')][_0x5e7d('0x56')]=_0x2bec1d['id'];if(_0x48bf7e[_0x5e7d('0x31')][_0x5e7d('0x3b')]){_0x39783b[_0x5e7d('0x3a')]=_['merge'](_0x39783b[_0x5e7d('0x3a')],{'$or':_[_0x5e7d('0x57')](_0x39783b['attributes'],function(_0x7113be){var _0x4456dd={};_0x4456dd[_0x7113be]={'$like':'%'+_0x48bf7e[_0x5e7d('0x31')][_0x5e7d('0x3b')]+'%'};return _0x4456dd;})});}_0x39783b=_[_0x5e7d('0x48')]({},_0x39783b,_0x48bf7e[_0x5e7d('0x40')]);return db[_0x5e7d('0x53')][_0x5e7d('0x1e')]({'where':_0x39783b[_0x5e7d('0x3a')]})[_0x5e7d('0x26')](function(_0x376ead){_0x26520c[_0x5e7d('0x1e')]=_0x376ead;if(_0x48bf7e[_0x5e7d('0x31')]['includeAll']){_0x39783b['include']=[{'all':!![]}];}return db['Disposition'][_0x5e7d('0x58')](_0x39783b);})[_0x5e7d('0x26')](function(_0x11bb69){_0x26520c[_0x5e7d('0x43')]=_0x11bb69;return _0x26520c;});}})[_0x5e7d('0x26')](respondWithFilteredResult(_0x52b763,_0x39783b))[_0x5e7d('0x44')](handleError(_0x52b763,null));};exports[_0x5e7d('0x59')]=function(_0x4ce9ee,_0x54d90a,_0x4f85a3){var _0x49d9e0;return db[_0x5e7d('0x41')]['find']({'where':{'id':_0x4ce9ee[_0x5e7d('0x45')]['id']}})[_0x5e7d('0x26')](handleEntityNotFound(_0x54d90a,null))[_0x5e7d('0x26')](function(_0x1cef13){if(_0x1cef13){return _0x1cef13[_0x5e7d('0x59')](_0x4ce9ee['query']['ids']);}})[_0x5e7d('0x26')](respondWithStatusCode(_0x54d90a,null))[_0x5e7d('0x44')](handleError(_0x54d90a,null));};exports[_0x5e7d('0x5a')]=function(_0x33a675,_0x454ae5,_0x133cec){return db[_0x5e7d('0x41')][_0x5e7d('0x4c')]({'where':{'id':_0x33a675[_0x5e7d('0x45')]['id']}})[_0x5e7d('0x26')](handleEntityNotFound(_0x454ae5,null))[_0x5e7d('0x26')](function(_0x1dda2b){if(_0x1dda2b){var _0x219230=[];var _0x4279e0={'success':[],'errors':[]};return db[_0x5e7d('0x5b')]['describe']()[_0x5e7d('0x26')](function(_0x1424bf){if(_0x33a675[_0x5e7d('0x50')]['tags']&&_['isArray'](_0x33a675['body']['tags'])){if(_0x33a675[_0x5e7d('0x50')][_0x5e7d('0x5c')][_0x5e7d('0x36')]){_0x33a675['body'][_0x5e7d('0x5c')]=_0x33a675[_0x5e7d('0x50')]['tags'][_0x5e7d('0x5d')](';')+';';}else{_0x33a675[_0x5e7d('0x50')][_0x5e7d('0x5c')]=null;}}else{_0x33a675[_0x5e7d('0x50')][_0x5e7d('0x5c')]=null;}if(_0x33a675['body']&&_[_0x5e7d('0x5e')](_0x33a675[_0x5e7d('0x50')])){for(var _0x25e383=0x0;_0x25e383<_0x33a675[_0x5e7d('0x50')][_0x5e7d('0x36')];_0x25e383+=0x1){_0x33a675[_0x5e7d('0x50')][_0x25e383][_0x5e7d('0x56')]=_0x33a675[_0x5e7d('0x45')]['id'];_0x219230[_0x5e7d('0x5f')](_0x33a675[_0x5e7d('0x50')][_0x25e383]);}return BPromise[_0x5e7d('0x60')](_0x219230,function(_0x3c7310){return db[_0x5e7d('0x5b')][_0x5e7d('0x49')](_[_0x5e7d('0x61')](_0x3c7310,[_0x5e7d('0x62'),'id'])||{},{'fields':_['keys'](_0x1424bf),'raw':!![]})[_0x5e7d('0x26')](function(_0x29c210){_0x4279e0[_0x5e7d('0x63')][_0x5e7d('0x5f')](_0x29c210['dataValues']);})[_0x5e7d('0x44')](function(_0x19ef51){_0x4279e0['errors'][_0x5e7d('0x5f')]({'data':_0x3c7310,'error':_0x19ef51[_0x5e7d('0x64')]});});})[_0x5e7d('0x26')](function(_0x44ad7a){return _0x4279e0;})['catch'](function(_0x16aa55){return _0x16aa55;});}else{_0x454ae5[_0x5e7d('0x1d')](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0x5e7d('0x26')](respondWithResult(_0x454ae5,null))['catch'](handleError(_0x454ae5,null));};exports[_0x5e7d('0x65')]=function(_0x4726fb,_0x45c58a,_0x2d56d5){var _0x503676;return db['CmList'][_0x5e7d('0x4c')]({'where':{'id':_0x4726fb['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x5e7d('0x66')}]})[_0x5e7d('0x26')](handleEntityNotFound(_0x45c58a,null))['then'](function(_0x31db23){if(_0x31db23){_0x503676=_0x31db23;return db[_0x5e7d('0x5b')][_0x5e7d('0x2f')];}})[_0x5e7d('0x26')](function(_0x5449bb){if(_0x5449bb){var _0x19c868={};var _0x18f61e={};_0x18f61e[_0x5e7d('0x30')]=_[_0x5e7d('0x67')](_[_0x5e7d('0x46')](_0x5449bb),_[_0x5e7d('0x57')](_0x503676['CustomFields'],function(_0x5de99b){return util[_0x5e7d('0x68')](_0x5e7d('0x69'),_0x5de99b['id']);}));_0x18f61e[_0x5e7d('0x31')]=_[_0x5e7d('0x46')](_0x4726fb[_0x5e7d('0x31')]);_0x18f61e[_0x5e7d('0x32')]=_[_0x5e7d('0x33')](_0x18f61e['model'],_0x18f61e[_0x5e7d('0x31')]);_0x19c868['attributes']=_[_0x5e7d('0x33')](_0x18f61e[_0x5e7d('0x30')],qs[_0x5e7d('0x35')](_0x4726fb[_0x5e7d('0x31')]['fields']));_0x19c868[_0x5e7d('0x34')]=_0x19c868[_0x5e7d('0x34')][_0x5e7d('0x36')]?_0x19c868[_0x5e7d('0x34')]:_0x18f61e[_0x5e7d('0x30')];if(!_0x4726fb[_0x5e7d('0x31')][_0x5e7d('0x55')]('nolimit')){_0x19c868[_0x5e7d('0x20')]=qs[_0x5e7d('0x20')](_0x4726fb[_0x5e7d('0x31')][_0x5e7d('0x20')]);_0x19c868['offset']=qs[_0x5e7d('0x1f')](_0x4726fb[_0x5e7d('0x31')]['offset']);}_0x19c868[_0x5e7d('0x38')]=qs['sort'](_0x4726fb[_0x5e7d('0x31')]['sort']);_0x19c868[_0x5e7d('0x3a')]=qs['filters'](_[_0x5e7d('0x6a')](_0x4726fb[_0x5e7d('0x31')],_0x18f61e[_0x5e7d('0x32')]));_0x19c868[_0x5e7d('0x6b')]=!![];if(_0x4726fb[_0x5e7d('0x31')][_0x5e7d('0x3b')]){_0x19c868['where']=_[_0x5e7d('0x48')](_0x19c868[_0x5e7d('0x3a')],{'$or':_[_0x5e7d('0x57')](_0x19c868['attributes'],function(_0x5bd47f){var _0x4dc467={};_0x4dc467[_0x5bd47f]={'$like':'%'+_0x4726fb[_0x5e7d('0x31')][_0x5e7d('0x3b')]+'%'};return _0x4dc467;})});}_0x19c868=_[_0x5e7d('0x48')]({},_0x19c868,_0x4726fb[_0x5e7d('0x40')]);return _0x503676['getContacts'](_0x19c868);}})[_0x5e7d('0x26')](respondWithResult(_0x45c58a,null))[_0x5e7d('0x44')](handleError(_0x45c58a,null));};exports[_0x5e7d('0x6c')]=function(_0x12b228,_0x378e2f,_0x5596b6){var _0x3264bd;return db['CmList'][_0x5e7d('0x4c')]({'where':{'id':_0x12b228['params']['id']},'include':[{'model':db[_0x5e7d('0x6d')],'as':_0x5e7d('0x66')}]})[_0x5e7d('0x26')](handleEntityNotFound(_0x378e2f,null))[_0x5e7d('0x26')](function(_0x3b4952){if(_0x3b4952){_0x3264bd=_0x3b4952;return db[_0x5e7d('0x5b')]['rawAttributes'];}})[_0x5e7d('0x26')](function(_0x8dbf56){if(_0x8dbf56){var _0xd17de2={};var _0x50084e={};_0x50084e[_0x5e7d('0x30')]=_[_0x5e7d('0x67')](_[_0x5e7d('0x46')](_0x8dbf56),_[_0x5e7d('0x57')](_0x3264bd[_0x5e7d('0x66')],function(_0x3ddaa5){return util[_0x5e7d('0x68')](_0x5e7d('0x69'),_0x3ddaa5['id']);}));_0x50084e[_0x5e7d('0x31')]=_[_0x5e7d('0x46')](_0x12b228[_0x5e7d('0x31')]);_0x50084e[_0x5e7d('0x32')]=_[_0x5e7d('0x33')](_0x50084e[_0x5e7d('0x30')],_0x50084e[_0x5e7d('0x31')]);_0xd17de2[_0x5e7d('0x34')]=_[_0x5e7d('0x33')](_0x50084e[_0x5e7d('0x30')],qs['fields'](_0x12b228[_0x5e7d('0x31')][_0x5e7d('0x35')]));_0xd17de2['attributes']=_0xd17de2['attributes'][_0x5e7d('0x36')]?_0xd17de2['attributes']:_0x50084e[_0x5e7d('0x30')];if(!_0x12b228['query'][_0x5e7d('0x55')](_0x5e7d('0x37'))){_0xd17de2['limit']=qs[_0x5e7d('0x20')](_0x12b228[_0x5e7d('0x31')][_0x5e7d('0x20')]);_0xd17de2[_0x5e7d('0x1f')]=qs[_0x5e7d('0x1f')](_0x12b228[_0x5e7d('0x31')][_0x5e7d('0x1f')]);}_0xd17de2[_0x5e7d('0x38')]=qs[_0x5e7d('0x39')](_0x12b228[_0x5e7d('0x31')][_0x5e7d('0x39')]);_0xd17de2[_0x5e7d('0x3a')]=qs[_0x5e7d('0x32')](_[_0x5e7d('0x6a')](_0x12b228[_0x5e7d('0x31')],_0x50084e[_0x5e7d('0x32')]));_0xd17de2['raw']=!![];if(_0x12b228[_0x5e7d('0x31')][_0x5e7d('0x3b')]){_0xd17de2[_0x5e7d('0x3a')]=_['merge'](_0xd17de2[_0x5e7d('0x3a')],{'$or':_[_0x5e7d('0x57')](_0xd17de2[_0x5e7d('0x34')],function(_0x1c2193){var _0x444db8={};_0x444db8[_0x1c2193]={'$like':'%'+_0x12b228[_0x5e7d('0x31')][_0x5e7d('0x3b')]+'%'};return _0x444db8;})});}_0xd17de2=_['merge']({},_0xd17de2,_0x12b228[_0x5e7d('0x40')]);return _0x3264bd[_0x5e7d('0x65')](_0xd17de2);}})['then'](function(_0x25c5b1){if(!_[_0x5e7d('0x6e')](_0x25c5b1)){var _0x406460=toCsv(_0x25c5b1);var _0xc21c0b=Date[_0x5e7d('0x6f')]();fs['writeFileSync'](util[_0x5e7d('0x68')]('/tmp/list_%d_%s.csv',_0x3264bd['id'],_0xc21c0b),_0x406460);_0x378e2f[_0x5e7d('0x70')](_0x5e7d('0x71'),_0x5e7d('0x72')+util[_0x5e7d('0x68')](_0x5e7d('0x73'),_0x3264bd['id'],_0xc21c0b));_0x378e2f['setHeader'](_0x5e7d('0x74'),_0x5e7d('0x75'));return _0x378e2f[_0x5e7d('0x76')](util[_0x5e7d('0x68')](_0x5e7d('0x77'),_0x3264bd['id'],_0xc21c0b));}else{return _0x378e2f['sendStatus'](0xcc);}})[_0x5e7d('0x44')](handleError(_0x378e2f,null));};exports['addCustomField']=function(_0x515ec2,_0x3e6286,_0x4de26c){var _0x44cba5;delete _0x515ec2[_0x5e7d('0x50')]['id'];return db['CmList'][_0x5e7d('0x54')]({'where':{'id':_0x515ec2[_0x5e7d('0x45')]['id']}})['then'](handleEntityNotFound(_0x3e6286,null))[_0x5e7d('0x26')](function(_0x47102e){if(_0x47102e){return db[_0x5e7d('0x78')]['transaction'](function(_0x1ddd71){return db['CmCustomField'][_0x5e7d('0x49')](_0x515ec2['body'],{'transaction':_0x1ddd71})[_0x5e7d('0x26')](function(_0x159da7){_0x44cba5=_0x159da7;return _0x47102e['addCustomFields'](_0x159da7,{'transaction':_0x1ddd71});})['then'](function(){var _0x4af1cc={'type':db[_0x5e7d('0x79')][_0x5e7d('0x7a')],'transaction':_0x1ddd71};switch(_0x515ec2[_0x5e7d('0x50')]['type']){case'text':_0x4af1cc[_0x5e7d('0x3c')]=db['Sequelize'][_0x5e7d('0x7a')];break;case _0x5e7d('0x7b'):_0x4af1cc['type']=db[_0x5e7d('0x79')]['INTEGER'];break;case _0x5e7d('0x7c'):_0x4af1cc['type']=db[_0x5e7d('0x79')][_0x5e7d('0x7d')];_0x4af1cc[_0x5e7d('0x7e')]=![];break;default:}return db['sequelize'][_0x5e7d('0x7f')][_0x5e7d('0x80')]('cm_contacts',util[_0x5e7d('0x68')](_0x5e7d('0x81'),_0x44cba5['id']),_0x4af1cc);})[_0x5e7d('0x26')](function(){return _0x44cba5;});});}})[_0x5e7d('0x26')](respondWithResult(_0x3e6286,null))[_0x5e7d('0x44')](handleError(_0x3e6286,null));};exports[_0x5e7d('0x82')]=function(_0x4fa5ee,_0x54fd09,_0x26f98a){var _0x5c5b66={};var _0x5bcf9f={};var _0x3b9ba2;var _0x133996;return db['CmList'][_0x5e7d('0x54')]({'where':{'id':_0x4fa5ee[_0x5e7d('0x45')]['id']}})[_0x5e7d('0x26')](handleEntityNotFound(_0x54fd09,null))[_0x5e7d('0x26')](function(_0x44affb){if(_0x44affb){_0x3b9ba2=_0x44affb;_0x5bcf9f[_0x5e7d('0x30')]=_[_0x5e7d('0x46')](db[_0x5e7d('0x6d')][_0x5e7d('0x2f')]);_0x5bcf9f[_0x5e7d('0x31')]=_[_0x5e7d('0x46')](_0x4fa5ee[_0x5e7d('0x31')]);_0x5bcf9f[_0x5e7d('0x32')]=_['intersection'](_0x5bcf9f[_0x5e7d('0x30')],_0x5bcf9f['query']);_0x5c5b66[_0x5e7d('0x34')]=_['intersection'](_0x5bcf9f[_0x5e7d('0x30')],qs[_0x5e7d('0x35')](_0x4fa5ee[_0x5e7d('0x31')][_0x5e7d('0x35')]));_0x5c5b66[_0x5e7d('0x34')]=_0x5c5b66[_0x5e7d('0x34')][_0x5e7d('0x36')]?_0x5c5b66[_0x5e7d('0x34')]:_0x5bcf9f[_0x5e7d('0x30')];_0x5c5b66[_0x5e7d('0x38')]=qs[_0x5e7d('0x39')](_0x4fa5ee[_0x5e7d('0x31')][_0x5e7d('0x39')]);_0x5c5b66[_0x5e7d('0x3a')]=qs[_0x5e7d('0x32')](_[_0x5e7d('0x6a')](_0x4fa5ee[_0x5e7d('0x31')],_0x5bcf9f[_0x5e7d('0x32')]));_0x5c5b66[_0x5e7d('0x3a')]=_[_0x5e7d('0x48')](_0x5c5b66[_0x5e7d('0x3a')],{'$or':[{'ListId':_0x44affb['id']},{'ListId':null}]});if(_0x4fa5ee['query'][_0x5e7d('0x3b')]){_0x5c5b66['where']=_[_0x5e7d('0x48')](_0x5c5b66[_0x5e7d('0x3a')],{'$or':_[_0x5e7d('0x57')](_0x5c5b66[_0x5e7d('0x34')],function(_0x398bc3){var _0x227e5b={};_0x227e5b[_0x398bc3]={'$like':'%'+_0x4fa5ee[_0x5e7d('0x31')]['filter']+'%'};return _0x227e5b;})});}_0x5c5b66=_[_0x5e7d('0x48')]({},_0x5c5b66,_0x4fa5ee['options']);return db[_0x5e7d('0x6d')][_0x5e7d('0x83')](_0x5c5b66);}})['then'](respondWithResult(_0x54fd09,null))[_0x5e7d('0x44')](handleError(_0x54fd09,null));};exports[_0x5e7d('0x84')]=function(_0x29bcae,_0x59f221,_0x3e907c){return db['CmList'][_0x5e7d('0x4c')]({'where':{'id':_0x29bcae['params']['id']}})[_0x5e7d('0x26')](handleEntityNotFound(_0x59f221,null))[_0x5e7d('0x26')](function(_0x11dc64){if(_0x11dc64){return _0x11dc64['addAgents'](_0x29bcae[_0x5e7d('0x50')][_0x5e7d('0x62')],_[_0x5e7d('0x61')](_0x29bcae[_0x5e7d('0x50')],[_0x5e7d('0x62'),'id'])||{})[_0x5e7d('0x85')](function(_0x48de04){for(var _0x370c1c=0x0;_0x370c1c<_0x29bcae[_0x5e7d('0x50')][_0x5e7d('0x62')][_0x5e7d('0x36')];_0x370c1c+=0x1){socket[_0x5e7d('0x86')](_0x5e7d('0x87'),{'UserId':_0x29bcae[_0x5e7d('0x50')][_0x5e7d('0x62')][_0x370c1c],'CmListId':_0x29bcae[_0x5e7d('0x45')]['id']});}return _0x48de04;});}})[_0x5e7d('0x26')](respondWithResult(_0x59f221,null))[_0x5e7d('0x44')](handleError(_0x59f221,null));};exports[_0x5e7d('0x88')]=function(_0x447448,_0xf370d0,_0x4105b3){var _0x586738;return db[_0x5e7d('0x41')][_0x5e7d('0x4c')]({'where':{'id':_0x447448[_0x5e7d('0x45')]['id']}})[_0x5e7d('0x26')](handleEntityNotFound(_0xf370d0,null))[_0x5e7d('0x26')](function(_0x34207b){if(_0x34207b){return _0x34207b[_0x5e7d('0x88')](_0x447448[_0x5e7d('0x31')][_0x5e7d('0x62')])[_0x5e7d('0x26')](function(_0x1c0232){if(_[_0x5e7d('0x5e')](_0x447448[_0x5e7d('0x31')][_0x5e7d('0x62')])){for(var _0xbc6f84=0x0;_0xbc6f84<_0x447448[_0x5e7d('0x31')]['ids'][_0x5e7d('0x36')];_0xbc6f84+=0x1){socket[_0x5e7d('0x86')]('userCmList:remove',{'UserId':_0x447448[_0x5e7d('0x31')][_0x5e7d('0x62')][_0xbc6f84],'CmListId':_0x447448[_0x5e7d('0x45')]['id']});}}else{socket[_0x5e7d('0x86')](_0x5e7d('0x89'),{'UserId':_0x447448['query'][_0x5e7d('0x62')],'CmListId':_0x447448[_0x5e7d('0x45')]['id']});}});}})['then'](respondWithStatusCode(_0xf370d0,null))[_0x5e7d('0x44')](handleError(_0xf370d0,null));};exports['getAgents']=function(_0x96a023,_0x583feb,_0x3d8340){var _0xd02897={};var _0x363d39={};var _0x59b728;var _0x13241f;return db[_0x5e7d('0x41')][_0x5e7d('0x54')]({'where':{'id':_0x96a023[_0x5e7d('0x45')]['id']}})[_0x5e7d('0x26')](handleEntityNotFound(_0x583feb,null))[_0x5e7d('0x26')](function(_0x585975){if(_0x585975){_0x59b728=_0x585975;_0x363d39[_0x5e7d('0x30')]=_[_0x5e7d('0x46')](db[_0x5e7d('0x8a')][_0x5e7d('0x2f')]);_0x363d39[_0x5e7d('0x31')]=_[_0x5e7d('0x46')](_0x96a023[_0x5e7d('0x31')]);_0x363d39[_0x5e7d('0x32')]=_[_0x5e7d('0x33')](_0x363d39[_0x5e7d('0x30')],_0x363d39[_0x5e7d('0x31')]);_0xd02897[_0x5e7d('0x34')]=_[_0x5e7d('0x33')](_0x363d39['model'],qs[_0x5e7d('0x35')](_0x96a023[_0x5e7d('0x31')][_0x5e7d('0x35')]));_0xd02897[_0x5e7d('0x34')]=_0xd02897[_0x5e7d('0x34')][_0x5e7d('0x36')]?_0xd02897['attributes']:_0x363d39[_0x5e7d('0x30')];_0xd02897[_0x5e7d('0x38')]=qs['sort'](_0x96a023[_0x5e7d('0x31')]['sort']);_0xd02897[_0x5e7d('0x3a')]=qs[_0x5e7d('0x32')](_[_0x5e7d('0x6a')](_0x96a023['query'],_0x363d39['filters']));if(_0x96a023[_0x5e7d('0x31')][_0x5e7d('0x3b')]){_0xd02897[_0x5e7d('0x3a')]=_[_0x5e7d('0x48')](_0xd02897[_0x5e7d('0x3a')],{'$or':_['map'](_0xd02897[_0x5e7d('0x34')],function(_0x5ea2a6){var _0x1484eb={};_0x1484eb[_0x5ea2a6]={'$like':'%'+_0x96a023['query'][_0x5e7d('0x3b')]+'%'};return _0x1484eb;})});}_0xd02897=_[_0x5e7d('0x48')]({},_0xd02897,_0x96a023[_0x5e7d('0x40')]);return _0x59b728['getAgents'](_0xd02897);}})[_0x5e7d('0x26')](function(_0x20e3f4){if(_0x20e3f4){_0x13241f=_0x20e3f4['length'];if(!_0x96a023[_0x5e7d('0x31')][_0x5e7d('0x55')](_0x5e7d('0x37'))){_0xd02897[_0x5e7d('0x20')]=qs[_0x5e7d('0x20')](_0x96a023[_0x5e7d('0x31')][_0x5e7d('0x20')]);_0xd02897['offset']=qs[_0x5e7d('0x1f')](_0x96a023[_0x5e7d('0x31')][_0x5e7d('0x1f')]);}return _0x59b728[_0x5e7d('0x8b')](_0xd02897);}})[_0x5e7d('0x26')](function(_0x23b044){if(_0x23b044){return _0x23b044?{'count':_0x13241f,'rows':_0x23b044}:null;}})[_0x5e7d('0x26')](respondWithResult(_0x583feb,null))['catch'](handleError(_0x583feb,null));}; \ No newline at end of file +var _0x1160=['squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','defaults','localhost','redis','./cmList.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','destroy','get','Lists','UserProfileResource','then','error','stack','name','send','index','CmList','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','type','VIRTUAL','field','options','includeAll','include','rows','show','params','rawAttributes','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','ListId','Disposition','findOne','pick','findAll','removeDispositions','addContacts','CmContact','tags','isArray','each','omit','ids','success','push','errors','message','Malformed\x20request\x20syntax','CmCustomField','concat','CustomFields','format','cf_%d','raw','getContacts','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','download','addCustomField','sequelize','transaction','TEXT','text','Sequelize','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','User','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','lodash'];(function(_0x803d97,_0x2975f3){var _0x4f08aa=function(_0x1c5570){while(--_0x1c5570){_0x803d97['push'](_0x803d97['shift']());}};_0x4f08aa(++_0x2975f3);}(_0x1160,0x118));var _0x0116=function(_0x423e15,_0x12b2b2){_0x423e15=_0x423e15-0x0;var _0x184279=_0x1160[_0x423e15];return _0x184279;};'use strict';var pdf=require(_0x0116('0x0'));var emlformat=require(_0x0116('0x1'));var rimraf=require(_0x0116('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0116('0x3'));var rp=require(_0x0116('0x4'));var moment=require('moment');var BPromise=require(_0x0116('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0116('0x6'));var sox=require('sox');var csv=require(_0x0116('0x7'));var ejs=require(_0x0116('0x8'));var fs=require('fs');var _=require(_0x0116('0x9'));var squel=require(_0x0116('0xa'));var crypto=require(_0x0116('0xb'));var jsforce=require(_0x0116('0xc'));var deskjs=require(_0x0116('0xd'));var toCsv=require(_0x0116('0x7'));var querystring=require(_0x0116('0xe'));var Papa=require('papaparse');var authService=require(_0x0116('0xf'));var hardwareService=require(_0x0116('0x10'));var Redis=require(_0x0116('0x11'));var qs=require(_0x0116('0x12'));var logger=require(_0x0116('0x13'))(_0x0116('0x14'));var utils=require(_0x0116('0x15'));var config=require('../../config/environment');var db=require(_0x0116('0x16'))['db'];config['redis']=_[_0x0116('0x17')](config['redis'],{'host':_0x0116('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0116('0x19')]));require(_0x0116('0x1a'))['register'](socket);function respondWithStatusCode(_0x314da4,_0x2ae29a){_0x2ae29a=_0x2ae29a||0xcc;return function(_0x40be55){if(_0x40be55){return _0x314da4[_0x0116('0x1b')](_0x2ae29a);}return _0x314da4[_0x0116('0x1c')](_0x2ae29a)[_0x0116('0x1d')]();};}function respondWithResult(_0x3d2cd4,_0x8af561){_0x8af561=_0x8af561||0xc8;return function(_0xea1586){if(_0xea1586){return _0x3d2cd4[_0x0116('0x1c')](_0x8af561)[_0x0116('0x1e')](_0xea1586);}};}function respondWithFilteredResult(_0x16ef32,_0x5d0fc8){return function(_0x4309f2){if(_0x4309f2){var _0x27184a=_0x4309f2[_0x0116('0x1f')],_0x2492be=_0x5d0fc8[_0x0116('0x20')],_0x5c8bd2=_0x5d0fc8[_0x0116('0x20')]+_0x5d0fc8[_0x0116('0x21')],_0x54b6c7;if(_0x5c8bd2>=_0x27184a){_0x5c8bd2=_0x27184a;_0x54b6c7=0xc8;}else{_0x54b6c7=0xce;}_0x16ef32['status'](_0x54b6c7);return _0x16ef32[_0x0116('0x22')](_0x0116('0x23'),_0x2492be+'-'+_0x5c8bd2+'/'+_0x27184a)[_0x0116('0x1e')](_0x4309f2);}return null;};}function patchUpdates(_0x333a09){return function(_0x56b023){try{jsonpatch[_0x0116('0x24')](_0x56b023,_0x333a09,!![]);}catch(_0x2e14b9){return BPromise[_0x0116('0x25')](_0x2e14b9);}return _0x56b023['save']();};}function saveUpdates(_0x40dc1a,_0x3c1152){return function(_0x4889d7){if(_0x4889d7){return _0x4889d7['update'](_0x40dc1a)['then'](function(_0x2d823e){return _0x2d823e;});}return null;};}function removeEntity(_0x131347,_0x460a51){return function(_0x1c2ee2){if(_0x1c2ee2){return _0x1c2ee2[_0x0116('0x26')]()['then'](function(){var _0x88dc13=_0x1c2ee2[_0x0116('0x27')]({'plain':!![]});var _0x551aa5=_0x0116('0x28');return db[_0x0116('0x29')][_0x0116('0x26')]({'where':{'type':_0x551aa5,'resourceId':_0x88dc13['id']}})[_0x0116('0x2a')](function(){return _0x1c2ee2;});})[_0x0116('0x2a')](function(){_0x131347['status'](0xcc)[_0x0116('0x1d')]();});}};}function handleEntityNotFound(_0x51167d,_0x412175){return function(_0x557229){if(!_0x557229){_0x51167d[_0x0116('0x1b')](0x194);}return _0x557229;};}function handleError(_0x42114f,_0x431d69){_0x431d69=_0x431d69||0x1f4;return function(_0x5071be){logger[_0x0116('0x2b')](_0x5071be[_0x0116('0x2c')]);if(_0x5071be[_0x0116('0x2d')]){delete _0x5071be[_0x0116('0x2d')];}_0x42114f[_0x0116('0x1c')](_0x431d69)[_0x0116('0x2e')](_0x5071be);};}exports[_0x0116('0x2f')]=function(_0x154f29,_0x42def2){var _0x708913={},_0x5d8432={},_0x5a2e9a={'count':0x0,'rows':[]};var _0x4db4bc=db[_0x0116('0x30')]['rawAttributes'];_0x5d8432[_0x0116('0x31')]=_['keys'](_0x4db4bc);_0x5d8432[_0x0116('0x32')]=_[_0x0116('0x33')](_0x154f29[_0x0116('0x32')]);_0x5d8432['filters']=_[_0x0116('0x34')](_0x5d8432[_0x0116('0x31')],_0x5d8432[_0x0116('0x32')]);_0x708913[_0x0116('0x35')]=_[_0x0116('0x34')](_0x5d8432['model'],qs[_0x0116('0x36')](_0x154f29[_0x0116('0x32')][_0x0116('0x36')]));_0x708913[_0x0116('0x35')]=_0x708913[_0x0116('0x35')][_0x0116('0x37')]?_0x708913[_0x0116('0x35')]:_0x5d8432[_0x0116('0x31')];if(!_0x154f29[_0x0116('0x32')][_0x0116('0x38')](_0x0116('0x39'))){_0x708913[_0x0116('0x21')]=qs[_0x0116('0x21')](_0x154f29[_0x0116('0x32')]['limit']);_0x708913[_0x0116('0x20')]=qs[_0x0116('0x20')](_0x154f29['query'][_0x0116('0x20')]);}_0x708913[_0x0116('0x3a')]=qs[_0x0116('0x3b')](_0x154f29[_0x0116('0x32')][_0x0116('0x3b')]);_0x708913[_0x0116('0x3c')]=qs[_0x0116('0x3d')](_['pick'](_0x154f29[_0x0116('0x32')],_0x5d8432[_0x0116('0x3d')]));if(_0x154f29[_0x0116('0x32')][_0x0116('0x3e')]){_0x708913[_0x0116('0x3c')]=_[_0x0116('0x3f')](_0x708913[_0x0116('0x3c')],{'$or':_[_0x0116('0x40')](_0x4db4bc,function(_0x214736){if(_0x214736[_0x0116('0x41')]['key']!==_0x0116('0x42')){var _0x537027={};_0x537027[_0x214736[_0x0116('0x43')]]={'$like':'%'+_0x154f29['query'][_0x0116('0x3e')]+'%'};return _0x537027;}})});}_0x708913=_[_0x0116('0x3f')]({},_0x708913,_0x154f29[_0x0116('0x44')]);var _0x5c14eb={'where':_0x708913['where']};return db[_0x0116('0x30')][_0x0116('0x1f')](_0x5c14eb)[_0x0116('0x2a')](function(_0x2ca74c){_0x5a2e9a[_0x0116('0x1f')]=_0x2ca74c;if(_0x154f29['query'][_0x0116('0x45')]){_0x708913[_0x0116('0x46')]=[{'all':!![]}];}return db[_0x0116('0x30')]['findAll'](_0x708913);})[_0x0116('0x2a')](function(_0x5eed6a){_0x5a2e9a[_0x0116('0x47')]=_0x5eed6a;return _0x5a2e9a;})[_0x0116('0x2a')](respondWithFilteredResult(_0x42def2,_0x708913))['catch'](handleError(_0x42def2,null));};exports[_0x0116('0x48')]=function(_0x3e3781,_0x4eb7d7){var _0x3cf420={'raw':![],'where':{'id':_0x3e3781[_0x0116('0x49')]['id']}},_0x4bad1a={};_0x4bad1a[_0x0116('0x31')]=_['keys'](db['CmList'][_0x0116('0x4a')]);_0x4bad1a['query']=_[_0x0116('0x33')](_0x3e3781[_0x0116('0x32')]);_0x4bad1a['filters']=_[_0x0116('0x34')](_0x4bad1a[_0x0116('0x31')],_0x4bad1a[_0x0116('0x32')]);_0x3cf420[_0x0116('0x35')]=_[_0x0116('0x34')](_0x4bad1a[_0x0116('0x31')],qs[_0x0116('0x36')](_0x3e3781[_0x0116('0x32')][_0x0116('0x36')]));_0x3cf420[_0x0116('0x35')]=_0x3cf420['attributes']['length']?_0x3cf420[_0x0116('0x35')]:_0x4bad1a['model'];if(_0x3e3781['query'][_0x0116('0x45')]){_0x3cf420['include']=[{'all':!![]}];}_0x3cf420=_['merge']({},_0x3cf420,_0x3e3781[_0x0116('0x44')]);return db[_0x0116('0x30')][_0x0116('0x4b')](_0x3cf420)[_0x0116('0x2a')](handleEntityNotFound(_0x4eb7d7,null))[_0x0116('0x2a')](respondWithResult(_0x4eb7d7,null))[_0x0116('0x4c')](handleError(_0x4eb7d7,null));};exports[_0x0116('0x4d')]=function(_0x410bbe,_0x106e90){return db['CmList'][_0x0116('0x4d')](_0x410bbe['body'],{})[_0x0116('0x2a')](function(_0x20d13b){var _0x474220=_0x410bbe[_0x0116('0x4e')][_0x0116('0x27')]({'plain':!![]});if(!_0x474220)throw new Error(_0x0116('0x4f'));if(_0x474220[_0x0116('0x50')]===_0x0116('0x4e')){var _0x14b33e=_0x20d13b[_0x0116('0x27')]({'plain':!![]});var _0x15d8c3=_0x0116('0x28');return db[_0x0116('0x51')][_0x0116('0x4b')]({'where':{'name':_0x15d8c3,'userProfileId':_0x474220[_0x0116('0x52')]},'raw':!![]})[_0x0116('0x2a')](function(_0x1ac049){if(_0x1ac049&&_0x1ac049[_0x0116('0x53')]===0x0){return db[_0x0116('0x29')]['create']({'name':_0x14b33e[_0x0116('0x2d')],'resourceId':_0x14b33e['id'],'type':_0x1ac049[_0x0116('0x2d')],'sectionId':_0x1ac049['id']},{})[_0x0116('0x2a')](function(){return _0x20d13b;});}else{return _0x20d13b;}})['catch'](function(_0x2bd24d){logger['error'](_0x0116('0x54'),_0x2bd24d);throw _0x2bd24d;});}return _0x20d13b;})[_0x0116('0x2a')](respondWithResult(_0x106e90,0xc9))[_0x0116('0x4c')](handleError(_0x106e90,null));};exports[_0x0116('0x55')]=function(_0x21bc2e,_0x2635e8){if(_0x21bc2e[_0x0116('0x56')]['id']){delete _0x21bc2e[_0x0116('0x56')]['id'];}return db[_0x0116('0x30')][_0x0116('0x4b')]({'where':{'id':_0x21bc2e['params']['id']}})[_0x0116('0x2a')](handleEntityNotFound(_0x2635e8,null))[_0x0116('0x2a')](saveUpdates(_0x21bc2e[_0x0116('0x56')],null))[_0x0116('0x2a')](respondWithResult(_0x2635e8,null))['catch'](handleError(_0x2635e8,null));};exports['destroy']=function(_0x5d68ca,_0x1b3fce){return db[_0x0116('0x30')][_0x0116('0x4b')]({'where':{'id':_0x5d68ca[_0x0116('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b3fce,null))[_0x0116('0x2a')](removeEntity(_0x1b3fce,null))[_0x0116('0x4c')](handleError(_0x1b3fce,null));};exports['describe']=function(_0x4ae644,_0x588f74){return db[_0x0116('0x30')][_0x0116('0x57')]()[_0x0116('0x2a')](respondWithResult(_0x588f74,null))[_0x0116('0x4c')](handleError(_0x588f74,null));};exports[_0x0116('0x58')]=function(_0x5246cc,_0x2b7f27,_0x555d3f){if(_0x5246cc[_0x0116('0x56')]['id']){delete _0x5246cc[_0x0116('0x56')]['id'];}return db['CmList'][_0x0116('0x4b')]({'where':{'id':_0x5246cc['params']['id']}})[_0x0116('0x2a')](handleEntityNotFound(_0x2b7f27,null))[_0x0116('0x2a')](function(_0x396e3){if(_0x396e3){_0x5246cc[_0x0116('0x56')][_0x0116('0x59')]=_0x396e3['id'];return db[_0x0116('0x5a')][_0x0116('0x4d')](_0x5246cc[_0x0116('0x56')]);}})[_0x0116('0x2a')](respondWithResult(_0x2b7f27,null))[_0x0116('0x4c')](handleError(_0x2b7f27,null));};exports['getDispositions']=function(_0x58c763,_0x3b182a,_0x1cd06b){var _0x16c09a={'raw':![],'where':{}};var _0x4124dc={};var _0x26e546={'count':0x0,'rows':[]};return db['CmList'][_0x0116('0x5b')]({'where':{'id':_0x58c763[_0x0116('0x49')]['id']}})[_0x0116('0x2a')](handleEntityNotFound(_0x3b182a,null))[_0x0116('0x2a')](function(_0x147e03){if(_0x147e03){_0x4124dc[_0x0116('0x31')]=_[_0x0116('0x33')](db[_0x0116('0x5a')]['rawAttributes']);_0x4124dc[_0x0116('0x32')]=_[_0x0116('0x33')](_0x58c763['query']);_0x4124dc['filters']=_[_0x0116('0x34')](_0x4124dc[_0x0116('0x31')],_0x4124dc[_0x0116('0x32')]);_0x16c09a[_0x0116('0x35')]=_[_0x0116('0x34')](_0x4124dc[_0x0116('0x31')],qs[_0x0116('0x36')](_0x58c763[_0x0116('0x32')][_0x0116('0x36')]));_0x16c09a['attributes']=_0x16c09a[_0x0116('0x35')][_0x0116('0x37')]?_0x16c09a['attributes']:_0x4124dc[_0x0116('0x31')];if(!_0x58c763[_0x0116('0x32')][_0x0116('0x38')](_0x0116('0x39'))){_0x16c09a[_0x0116('0x21')]=qs[_0x0116('0x21')](_0x58c763[_0x0116('0x32')][_0x0116('0x21')]);_0x16c09a[_0x0116('0x20')]=qs['offset'](_0x58c763['query'][_0x0116('0x20')]);}_0x16c09a['order']=qs[_0x0116('0x3b')](_0x58c763[_0x0116('0x32')][_0x0116('0x3b')]);_0x16c09a[_0x0116('0x3c')]=qs[_0x0116('0x3d')](_[_0x0116('0x5c')](_0x58c763[_0x0116('0x32')],_0x4124dc['filters']));_0x16c09a[_0x0116('0x3c')][_0x0116('0x59')]=_0x147e03['id'];if(_0x58c763[_0x0116('0x32')][_0x0116('0x3e')]){_0x16c09a[_0x0116('0x3c')]=_['merge'](_0x16c09a[_0x0116('0x3c')],{'$or':_['map'](_0x16c09a[_0x0116('0x35')],function(_0x1e091d){var _0xa42fc6={};_0xa42fc6[_0x1e091d]={'$like':'%'+_0x58c763[_0x0116('0x32')][_0x0116('0x3e')]+'%'};return _0xa42fc6;})});}_0x16c09a=_[_0x0116('0x3f')]({},_0x16c09a,_0x58c763[_0x0116('0x44')]);return db[_0x0116('0x5a')]['count']({'where':_0x16c09a[_0x0116('0x3c')]})[_0x0116('0x2a')](function(_0xc6ad73){_0x26e546[_0x0116('0x1f')]=_0xc6ad73;if(_0x58c763[_0x0116('0x32')][_0x0116('0x45')]){_0x16c09a[_0x0116('0x46')]=[{'all':!![]}];}return db[_0x0116('0x5a')][_0x0116('0x5d')](_0x16c09a);})[_0x0116('0x2a')](function(_0x21e9bb){_0x26e546['rows']=_0x21e9bb;return _0x26e546;});}})['then'](respondWithFilteredResult(_0x3b182a,_0x16c09a))['catch'](handleError(_0x3b182a,null));};exports[_0x0116('0x5e')]=function(_0x48cc89,_0x287af4,_0x551ed4){var _0x55d9fa;return db[_0x0116('0x30')][_0x0116('0x4b')]({'where':{'id':_0x48cc89[_0x0116('0x49')]['id']}})['then'](handleEntityNotFound(_0x287af4,null))[_0x0116('0x2a')](function(_0xd9a707){if(_0xd9a707){return _0xd9a707['removeDispositions'](_0x48cc89[_0x0116('0x32')]['ids']);}})['then'](respondWithStatusCode(_0x287af4,null))[_0x0116('0x4c')](handleError(_0x287af4,null));};exports[_0x0116('0x5f')]=function(_0x5b12de,_0x5962c7,_0x4f3ac9){return db['CmList']['find']({'where':{'id':_0x5b12de['params']['id']}})[_0x0116('0x2a')](handleEntityNotFound(_0x5962c7,null))[_0x0116('0x2a')](function(_0x13e9cd){if(_0x13e9cd){var _0xd0a587=[];var _0x4d7a1e={'success':[],'errors':[]};return db[_0x0116('0x60')]['describe']()[_0x0116('0x2a')](function(_0x199a84){if(_0x5b12de[_0x0116('0x56')][_0x0116('0x61')]&&_[_0x0116('0x62')](_0x5b12de[_0x0116('0x56')][_0x0116('0x61')])){if(_0x5b12de[_0x0116('0x56')][_0x0116('0x61')][_0x0116('0x37')]){_0x5b12de[_0x0116('0x56')][_0x0116('0x61')]=_0x5b12de[_0x0116('0x56')]['tags']['join'](';')+';';}else{_0x5b12de['body'][_0x0116('0x61')]=null;}}else{_0x5b12de[_0x0116('0x56')][_0x0116('0x61')]=null;}if(_0x5b12de[_0x0116('0x56')]&&_[_0x0116('0x62')](_0x5b12de[_0x0116('0x56')])){for(var _0x57441e=0x0;_0x57441e<_0x5b12de[_0x0116('0x56')][_0x0116('0x37')];_0x57441e+=0x1){_0x5b12de[_0x0116('0x56')][_0x57441e]['ListId']=_0x5b12de[_0x0116('0x49')]['id'];_0xd0a587['push'](_0x5b12de[_0x0116('0x56')][_0x57441e]);}return BPromise[_0x0116('0x63')](_0xd0a587,function(_0x171d59){return db[_0x0116('0x60')][_0x0116('0x4d')](_[_0x0116('0x64')](_0x171d59,[_0x0116('0x65'),'id'])||{},{'fields':_['keys'](_0x199a84),'raw':!![]})[_0x0116('0x2a')](function(_0x5b101b){_0x4d7a1e[_0x0116('0x66')][_0x0116('0x67')](_0x5b101b['dataValues']);})['catch'](function(_0x5573b8){_0x4d7a1e[_0x0116('0x68')][_0x0116('0x67')]({'data':_0x171d59,'error':_0x5573b8[_0x0116('0x69')]});});})[_0x0116('0x2a')](function(_0x1d331d){return _0x4d7a1e;})['catch'](function(_0x2481e5){return _0x2481e5;});}else{_0x5962c7[_0x0116('0x1c')](0x190)['json']({'message':_0x0116('0x6a')});}});}})[_0x0116('0x2a')](respondWithResult(_0x5962c7,null))[_0x0116('0x4c')](handleError(_0x5962c7,null));};exports['getContacts']=function(_0xb8b48c,_0x3f0a2d,_0x94e40a){var _0xbed4a4;return db[_0x0116('0x30')][_0x0116('0x4b')]({'where':{'id':_0xb8b48c[_0x0116('0x49')]['id']},'include':[{'model':db[_0x0116('0x6b')],'as':'CustomFields'}]})[_0x0116('0x2a')](handleEntityNotFound(_0x3f0a2d,null))['then'](function(_0x16a675){if(_0x16a675){_0xbed4a4=_0x16a675;return db[_0x0116('0x60')][_0x0116('0x4a')];}})[_0x0116('0x2a')](function(_0x437e14){if(_0x437e14){var _0x34a893={};var _0x3dc21c={};_0x3dc21c[_0x0116('0x31')]=_[_0x0116('0x6c')](_[_0x0116('0x33')](_0x437e14),_['map'](_0xbed4a4[_0x0116('0x6d')],function(_0x45c9d3){return util[_0x0116('0x6e')](_0x0116('0x6f'),_0x45c9d3['id']);}));_0x3dc21c[_0x0116('0x32')]=_['keys'](_0xb8b48c['query']);_0x3dc21c['filters']=_['intersection'](_0x3dc21c[_0x0116('0x31')],_0x3dc21c[_0x0116('0x32')]);_0x34a893[_0x0116('0x35')]=_[_0x0116('0x34')](_0x3dc21c[_0x0116('0x31')],qs['fields'](_0xb8b48c[_0x0116('0x32')][_0x0116('0x36')]));_0x34a893['attributes']=_0x34a893[_0x0116('0x35')]['length']?_0x34a893[_0x0116('0x35')]:_0x3dc21c[_0x0116('0x31')];if(!_0xb8b48c['query'][_0x0116('0x38')]('nolimit')){_0x34a893[_0x0116('0x21')]=qs[_0x0116('0x21')](_0xb8b48c[_0x0116('0x32')][_0x0116('0x21')]);_0x34a893['offset']=qs['offset'](_0xb8b48c[_0x0116('0x32')][_0x0116('0x20')]);}_0x34a893[_0x0116('0x3a')]=qs['sort'](_0xb8b48c[_0x0116('0x32')][_0x0116('0x3b')]);_0x34a893[_0x0116('0x3c')]=qs[_0x0116('0x3d')](_['pick'](_0xb8b48c[_0x0116('0x32')],_0x3dc21c[_0x0116('0x3d')]));_0x34a893[_0x0116('0x70')]=!![];if(_0xb8b48c['query']['filter']){_0x34a893[_0x0116('0x3c')]=_[_0x0116('0x3f')](_0x34a893[_0x0116('0x3c')],{'$or':_[_0x0116('0x40')](_0x34a893['attributes'],function(_0x2bff05){var _0x4b34bd={};_0x4b34bd[_0x2bff05]={'$like':'%'+_0xb8b48c['query']['filter']+'%'};return _0x4b34bd;})});}_0x34a893=_['merge']({},_0x34a893,_0xb8b48c['options']);return _0xbed4a4[_0x0116('0x71')](_0x34a893);}})[_0x0116('0x2a')](respondWithResult(_0x3f0a2d,null))[_0x0116('0x4c')](handleError(_0x3f0a2d,null));};exports['getContactsCsv']=function(_0x5dcf4c,_0x5eb5df,_0x19a20f){var _0x3903c9;return db['CmList'][_0x0116('0x4b')]({'where':{'id':_0x5dcf4c[_0x0116('0x49')]['id']},'include':[{'model':db[_0x0116('0x6b')],'as':'CustomFields'}]})[_0x0116('0x2a')](handleEntityNotFound(_0x5eb5df,null))[_0x0116('0x2a')](function(_0x25a094){if(_0x25a094){_0x3903c9=_0x25a094;return db[_0x0116('0x60')][_0x0116('0x4a')];}})['then'](function(_0x40ffe4){if(_0x40ffe4){var _0x3a3164={};var _0x939b1e={};_0x939b1e[_0x0116('0x31')]=_['concat'](_['keys'](_0x40ffe4),_[_0x0116('0x40')](_0x3903c9['CustomFields'],function(_0x3950f8){return util['format']('cf_%d',_0x3950f8['id']);}));_0x939b1e['query']=_[_0x0116('0x33')](_0x5dcf4c['query']);_0x939b1e[_0x0116('0x3d')]=_[_0x0116('0x34')](_0x939b1e[_0x0116('0x31')],_0x939b1e[_0x0116('0x32')]);_0x3a3164['attributes']=_[_0x0116('0x34')](_0x939b1e[_0x0116('0x31')],qs[_0x0116('0x36')](_0x5dcf4c['query'][_0x0116('0x36')]));_0x3a3164[_0x0116('0x35')]=_0x3a3164['attributes'][_0x0116('0x37')]?_0x3a3164['attributes']:_0x939b1e[_0x0116('0x31')];if(!_0x5dcf4c[_0x0116('0x32')][_0x0116('0x38')](_0x0116('0x39'))){_0x3a3164[_0x0116('0x21')]=qs[_0x0116('0x21')](_0x5dcf4c[_0x0116('0x32')][_0x0116('0x21')]);_0x3a3164[_0x0116('0x20')]=qs[_0x0116('0x20')](_0x5dcf4c[_0x0116('0x32')][_0x0116('0x20')]);}_0x3a3164[_0x0116('0x3a')]=qs[_0x0116('0x3b')](_0x5dcf4c[_0x0116('0x32')][_0x0116('0x3b')]);_0x3a3164['where']=qs['filters'](_[_0x0116('0x5c')](_0x5dcf4c[_0x0116('0x32')],_0x939b1e[_0x0116('0x3d')]));_0x3a3164['raw']=!![];if(_0x5dcf4c[_0x0116('0x32')]['filter']){_0x3a3164[_0x0116('0x3c')]=_[_0x0116('0x3f')](_0x3a3164['where'],{'$or':_[_0x0116('0x40')](_0x3a3164['attributes'],function(_0x5d7faf){var _0xc565d={};_0xc565d[_0x5d7faf]={'$like':'%'+_0x5dcf4c[_0x0116('0x32')][_0x0116('0x3e')]+'%'};return _0xc565d;})});}_0x3a3164=_[_0x0116('0x3f')]({},_0x3a3164,_0x5dcf4c[_0x0116('0x44')]);return _0x3903c9[_0x0116('0x71')](_0x3a3164);}})['then'](function(_0x48192c){if(!_[_0x0116('0x72')](_0x48192c)){var _0x21586e=toCsv(_0x48192c);var _0xf0050f=Date['now']();fs[_0x0116('0x73')](util[_0x0116('0x6e')](_0x0116('0x74'),_0x3903c9['id'],_0xf0050f),_0x21586e);_0x5eb5df[_0x0116('0x75')](_0x0116('0x76'),_0x0116('0x77')+util['format']('list_%d_%s.csv',_0x3903c9['id'],_0xf0050f));_0x5eb5df['setHeader'](_0x0116('0x78'),'text/csv');return _0x5eb5df[_0x0116('0x79')](util[_0x0116('0x6e')](_0x0116('0x74'),_0x3903c9['id'],_0xf0050f));}else{return _0x5eb5df['sendStatus'](0xcc);}})['catch'](handleError(_0x5eb5df,null));};exports[_0x0116('0x7a')]=function(_0x40416a,_0x37063b,_0x1a8eba){var _0x3332e7;delete _0x40416a[_0x0116('0x56')]['id'];return db[_0x0116('0x30')][_0x0116('0x5b')]({'where':{'id':_0x40416a[_0x0116('0x49')]['id']}})['then'](handleEntityNotFound(_0x37063b,null))[_0x0116('0x2a')](function(_0x58c808){if(_0x58c808){return db[_0x0116('0x7b')][_0x0116('0x7c')](function(_0x2d175b){return db[_0x0116('0x6b')][_0x0116('0x4d')](_0x40416a['body'],{'transaction':_0x2d175b})[_0x0116('0x2a')](function(_0x3154cd){_0x3332e7=_0x3154cd;return _0x58c808['addCustomFields'](_0x3154cd,{'transaction':_0x2d175b});})[_0x0116('0x2a')](function(){var _0x1b52d3={'type':db['Sequelize'][_0x0116('0x7d')],'transaction':_0x2d175b};switch(_0x40416a[_0x0116('0x56')][_0x0116('0x41')]){case _0x0116('0x7e'):_0x1b52d3['type']=db[_0x0116('0x7f')]['TEXT'];break;case'number':_0x1b52d3[_0x0116('0x41')]=db[_0x0116('0x7f')][_0x0116('0x80')];break;case _0x0116('0x81'):_0x1b52d3[_0x0116('0x41')]=db['Sequelize'][_0x0116('0x82')];_0x1b52d3[_0x0116('0x83')]=![];break;default:}return db[_0x0116('0x7b')][_0x0116('0x84')][_0x0116('0x85')](_0x0116('0x86'),util[_0x0116('0x6e')](_0x0116('0x87'),_0x3332e7['id']),_0x1b52d3);})[_0x0116('0x2a')](function(){return _0x3332e7;});});}})[_0x0116('0x2a')](respondWithResult(_0x37063b,null))['catch'](handleError(_0x37063b,null));};exports['getCustomFields']=function(_0x3922f2,_0xb7a877,_0x3a8ba8){var _0xc4ba2d={};var _0x6860da={};var _0x3f5a25;var _0x146352;return db[_0x0116('0x30')]['findOne']({'where':{'id':_0x3922f2[_0x0116('0x49')]['id']}})[_0x0116('0x2a')](handleEntityNotFound(_0xb7a877,null))[_0x0116('0x2a')](function(_0x25ebae){if(_0x25ebae){_0x3f5a25=_0x25ebae;_0x6860da[_0x0116('0x31')]=_[_0x0116('0x33')](db[_0x0116('0x6b')]['rawAttributes']);_0x6860da['query']=_[_0x0116('0x33')](_0x3922f2[_0x0116('0x32')]);_0x6860da[_0x0116('0x3d')]=_[_0x0116('0x34')](_0x6860da[_0x0116('0x31')],_0x6860da[_0x0116('0x32')]);_0xc4ba2d[_0x0116('0x35')]=_[_0x0116('0x34')](_0x6860da[_0x0116('0x31')],qs[_0x0116('0x36')](_0x3922f2[_0x0116('0x32')][_0x0116('0x36')]));_0xc4ba2d[_0x0116('0x35')]=_0xc4ba2d[_0x0116('0x35')][_0x0116('0x37')]?_0xc4ba2d[_0x0116('0x35')]:_0x6860da['model'];_0xc4ba2d[_0x0116('0x3a')]=qs[_0x0116('0x3b')](_0x3922f2[_0x0116('0x32')]['sort']);_0xc4ba2d[_0x0116('0x3c')]=qs['filters'](_[_0x0116('0x5c')](_0x3922f2[_0x0116('0x32')],_0x6860da['filters']));_0xc4ba2d['where']=_['merge'](_0xc4ba2d[_0x0116('0x3c')],{'$or':[{'ListId':_0x25ebae['id']},{'ListId':null}]});if(_0x3922f2[_0x0116('0x32')]['filter']){_0xc4ba2d[_0x0116('0x3c')]=_[_0x0116('0x3f')](_0xc4ba2d[_0x0116('0x3c')],{'$or':_['map'](_0xc4ba2d[_0x0116('0x35')],function(_0x354d41){var _0x3899b1={};_0x3899b1[_0x354d41]={'$like':'%'+_0x3922f2['query'][_0x0116('0x3e')]+'%'};return _0x3899b1;})});}_0xc4ba2d=_['merge']({},_0xc4ba2d,_0x3922f2[_0x0116('0x44')]);return db[_0x0116('0x6b')][_0x0116('0x88')](_0xc4ba2d);}})[_0x0116('0x2a')](respondWithResult(_0xb7a877,null))[_0x0116('0x4c')](handleError(_0xb7a877,null));};exports[_0x0116('0x89')]=function(_0x1a79ba,_0xbd5fb6,_0xdd125b){return db[_0x0116('0x30')][_0x0116('0x4b')]({'where':{'id':_0x1a79ba['params']['id']}})[_0x0116('0x2a')](handleEntityNotFound(_0xbd5fb6,null))[_0x0116('0x2a')](function(_0x456ea6){if(_0x456ea6){return _0x456ea6[_0x0116('0x89')](_0x1a79ba['body'][_0x0116('0x65')],_[_0x0116('0x64')](_0x1a79ba[_0x0116('0x56')],[_0x0116('0x65'),'id'])||{})[_0x0116('0x8a')](function(_0x375e21){for(var _0x20b1f7=0x0;_0x20b1f7<_0x1a79ba[_0x0116('0x56')][_0x0116('0x65')][_0x0116('0x37')];_0x20b1f7+=0x1){socket['emit'](_0x0116('0x8b'),{'UserId':_0x1a79ba['body']['ids'][_0x20b1f7],'CmListId':_0x1a79ba[_0x0116('0x49')]['id']});}return _0x375e21;});}})[_0x0116('0x2a')](respondWithResult(_0xbd5fb6,null))[_0x0116('0x4c')](handleError(_0xbd5fb6,null));};exports[_0x0116('0x8c')]=function(_0x377382,_0x34c332,_0x159828){var _0x1c8725;return db[_0x0116('0x30')]['find']({'where':{'id':_0x377382[_0x0116('0x49')]['id']}})[_0x0116('0x2a')](handleEntityNotFound(_0x34c332,null))[_0x0116('0x2a')](function(_0x93ac92){if(_0x93ac92){return _0x93ac92[_0x0116('0x8c')](_0x377382[_0x0116('0x32')][_0x0116('0x65')])['then'](function(_0x46c50b){if(_[_0x0116('0x62')](_0x377382[_0x0116('0x32')][_0x0116('0x65')])){for(var _0x474a67=0x0;_0x474a67<_0x377382['query']['ids']['length'];_0x474a67+=0x1){socket[_0x0116('0x8d')](_0x0116('0x8e'),{'UserId':_0x377382[_0x0116('0x32')][_0x0116('0x65')][_0x474a67],'CmListId':_0x377382[_0x0116('0x49')]['id']});}}else{socket[_0x0116('0x8d')](_0x0116('0x8e'),{'UserId':_0x377382[_0x0116('0x32')]['ids'],'CmListId':_0x377382[_0x0116('0x49')]['id']});}});}})['then'](respondWithStatusCode(_0x34c332,null))['catch'](handleError(_0x34c332,null));};exports['getAgents']=function(_0x3f31e6,_0x189d28,_0x5b06de){var _0xa7c6fe={};var _0x4ced89={};var _0x92a9a1;var _0x1bb3c1;return db[_0x0116('0x30')][_0x0116('0x5b')]({'where':{'id':_0x3f31e6[_0x0116('0x49')]['id']}})['then'](handleEntityNotFound(_0x189d28,null))['then'](function(_0x102adc){if(_0x102adc){_0x92a9a1=_0x102adc;_0x4ced89[_0x0116('0x31')]=_['keys'](db[_0x0116('0x8f')][_0x0116('0x4a')]);_0x4ced89[_0x0116('0x32')]=_[_0x0116('0x33')](_0x3f31e6[_0x0116('0x32')]);_0x4ced89[_0x0116('0x3d')]=_[_0x0116('0x34')](_0x4ced89[_0x0116('0x31')],_0x4ced89['query']);_0xa7c6fe['attributes']=_[_0x0116('0x34')](_0x4ced89['model'],qs['fields'](_0x3f31e6['query'][_0x0116('0x36')]));_0xa7c6fe[_0x0116('0x35')]=_0xa7c6fe[_0x0116('0x35')][_0x0116('0x37')]?_0xa7c6fe[_0x0116('0x35')]:_0x4ced89[_0x0116('0x31')];_0xa7c6fe[_0x0116('0x3a')]=qs[_0x0116('0x3b')](_0x3f31e6['query'][_0x0116('0x3b')]);_0xa7c6fe[_0x0116('0x3c')]=qs[_0x0116('0x3d')](_[_0x0116('0x5c')](_0x3f31e6[_0x0116('0x32')],_0x4ced89['filters']));if(_0x3f31e6[_0x0116('0x32')][_0x0116('0x3e')]){_0xa7c6fe['where']=_[_0x0116('0x3f')](_0xa7c6fe['where'],{'$or':_['map'](_0xa7c6fe[_0x0116('0x35')],function(_0x54ba20){var _0x5df0cb={};_0x5df0cb[_0x54ba20]={'$like':'%'+_0x3f31e6[_0x0116('0x32')][_0x0116('0x3e')]+'%'};return _0x5df0cb;})});}_0xa7c6fe=_[_0x0116('0x3f')]({},_0xa7c6fe,_0x3f31e6['options']);return _0x92a9a1[_0x0116('0x90')](_0xa7c6fe);}})[_0x0116('0x2a')](function(_0x5895ba){if(_0x5895ba){_0x1bb3c1=_0x5895ba[_0x0116('0x37')];if(!_0x3f31e6['query'][_0x0116('0x38')]('nolimit')){_0xa7c6fe['limit']=qs[_0x0116('0x21')](_0x3f31e6[_0x0116('0x32')]['limit']);_0xa7c6fe[_0x0116('0x20')]=qs['offset'](_0x3f31e6['query'][_0x0116('0x20')]);}return _0x92a9a1['getAgents'](_0xa7c6fe);}})[_0x0116('0x2a')](function(_0x7c7b53){if(_0x7c7b53){return _0x7c7b53?{'count':_0x1bb3c1,'rows':_0x7c7b53}:null;}})['then'](respondWithResult(_0x189d28,null))[_0x0116('0x4c')](handleError(_0x189d28,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 7142568..014bb06 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 _0x19b9=['update','remove','emit','exports','events','../../mysqldb'];(function(_0x138b2c,_0x142181){var _0xa8b921=function(_0xc1799e){while(--_0xc1799e){_0x138b2c['push'](_0x138b2c['shift']());}};_0xa8b921(++_0x142181);}(_0x19b9,0x1ba));var _0x919b=function(_0x4f595d,_0x2c0258){_0x4f595d=_0x4f595d-0x0;var _0x31e4e8=_0x19b9[_0x4f595d];return _0x31e4e8;};'use strict';var EventEmitter=require(_0x919b('0x0'));var CmList=require(_0x919b('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x919b('0x2'),'afterDestroy':_0x919b('0x3')};function emitEvent(_0x1c9393){return function(_0xf63948,_0x380af6,_0x5df4e7){CmListEvents[_0x919b('0x4')](_0x1c9393+':'+_0xf63948['id'],_0xf63948);CmListEvents[_0x919b('0x4')](_0x1c9393,_0xf63948);_0x5df4e7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x919b('0x5')]=CmListEvents; \ No newline at end of file +var _0x76d2=['CmList','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4ddbe1,_0x410dc8){var _0x77c157=function(_0x295777){while(--_0x295777){_0x4ddbe1['push'](_0x4ddbe1['shift']());}};_0x77c157(++_0x410dc8);}(_0x76d2,0x1ca));var _0x276d=function(_0x3cba1b,_0x1d85b6){_0x3cba1b=_0x3cba1b-0x0;var _0x1c114a=_0x76d2[_0x3cba1b];return _0x1c114a;};'use strict';var EventEmitter=require(_0x276d('0x0'));var CmList=require(_0x276d('0x1'))['db'][_0x276d('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x276d('0x3')](0x0);var events={'afterCreate':_0x276d('0x4'),'afterUpdate':_0x276d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x22b17b){return function(_0x46fede,_0x332820,_0x1e7233){CmListEvents[_0x276d('0x6')](_0x22b17b+':'+_0x46fede['id'],_0x46fede);CmListEvents['emit'](_0x22b17b,_0x46fede);_0x1e7233(null);};}for(var e in events){if(events[_0x276d('0x7')](e)){var event=events[e];CmList[_0x276d('0x8')](e,emitEvent(event));}}module[_0x276d('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index ff4f627..4fd9f8f 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 _0x0c12=['bluebird','./cmList.attributes','define','CmList','util','../../config/logger','api','moment'];(function(_0x3b477a,_0x1e22ed){var _0x338aba=function(_0x1a2e74){while(--_0x1a2e74){_0x3b477a['push'](_0x3b477a['shift']());}};_0x338aba(++_0x1e22ed);}(_0x0c12,0x19c));var _0x20c1=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0c12[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x20c1('0x0'));var logger=require(_0x20c1('0x1'))(_0x20c1('0x2'));var moment=require(_0x20c1('0x3'));var BPromise=require(_0x20c1('0x4'));var rp=require('request-promise');var attributes=require(_0x20c1('0x5'));module['exports']=function(_0x9e6166,_0x4c4536){return _0x9e6166[_0x20c1('0x6')](_0x20c1('0x7'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ed2=['api','request-promise','./cmList.attributes','exports','define','cm_lists','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ed2,0x1e3));var _0x21ed=function(_0x49c824,_0x18e9be){_0x49c824=_0x49c824-0x0;var _0x29dc99=_0x1ed2[_0x49c824];return _0x29dc99;};'use strict';var _=require(_0x21ed('0x0'));var util=require(_0x21ed('0x1'));var logger=require(_0x21ed('0x2'))(_0x21ed('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x21ed('0x4'));var attributes=require(_0x21ed('0x5'));module[_0x21ed('0x6')]=function(_0x72bcd9,_0x263629){return _0x72bcd9[_0x21ed('0x7')]('CmList',attributes,{'tableName':_0x21ed('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 9ea6d93..9ceb68b 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 _0x5d26=['CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4d7a70,_0x2d3bfa){var _0x3aafbb=function(_0x43fbf2){while(--_0x43fbf2){_0x4d7a70['push'](_0x4d7a70['shift']());}};_0x3aafbb(++_0x2d3bfa);}(_0x5d26,0x11e));var _0x65d2=function(_0x462ba4,_0x1b7b64){_0x462ba4=_0x462ba4-0x0;var _0xdad1b7=_0x5d26[_0x462ba4];return _0xdad1b7;};'use strict';var _=require(_0x65d2('0x0'));var util=require(_0x65d2('0x1'));var moment=require(_0x65d2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x65d2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x65d2('0x4'));var logger=require(_0x65d2('0x5'))(_0x65d2('0x6'));var config=require(_0x65d2('0x7'));var jayson=require(_0x65d2('0x8'));var client=jayson[_0x65d2('0x9')][_0x65d2('0xa')]({'port':0x232a});config[_0x65d2('0xb')]=_[_0x65d2('0xc')](config[_0x65d2('0xb')],{'host':_0x65d2('0xd'),'port':0x18eb});var socket=require(_0x65d2('0xe'))(new Redis(config[_0x65d2('0xb')]));require(_0x65d2('0xf'))['register'](socket);function respondWithRpcPromise(_0xccbc85,_0x2e0490,_0x31a626){return new BPromise(function(_0x1cb9c5,_0x52592e){return client[_0x65d2('0x10')](_0xccbc85,_0x31a626)[_0x65d2('0x11')](function(_0x52e47b){logger[_0x65d2('0x12')](_0x65d2('0x13'),_0x2e0490,_0x65d2('0x14'));logger[_0x65d2('0x15')](_0x65d2('0x16'),_0x2e0490,_0x65d2('0x14'),JSON[_0x65d2('0x17')](_0x52e47b));if(_0x52e47b[_0x65d2('0x18')]){if(_0x52e47b['error'][_0x65d2('0x19')]===0x1f4){logger[_0x65d2('0x18')]('CmList,\x20%s,\x20%s',_0x2e0490,_0x52e47b[_0x65d2('0x18')]['message']);return _0x52592e(_0x52e47b[_0x65d2('0x18')][_0x65d2('0x1a')]);}logger[_0x65d2('0x18')](_0x65d2('0x13'),_0x2e0490,_0x52e47b['error'][_0x65d2('0x1a')]);return _0x1cb9c5(_0x52e47b[_0x65d2('0x18')][_0x65d2('0x1a')]);}else{logger[_0x65d2('0x12')](_0x65d2('0x13'),_0x2e0490,_0x65d2('0x14'));_0x1cb9c5(_0x52e47b['result'][_0x65d2('0x1a')]);}})[_0x65d2('0x1b')](function(_0x25ebe3){logger[_0x65d2('0x18')](_0x65d2('0x13'),_0x2e0490,_0x25ebe3);_0x52592e(_0x25ebe3);});});} \ No newline at end of file +var _0xda68=['request\x20sent','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','redis','localhost','socket.io-emitter','request','then','info','CmList,\x20%s,\x20%s','debug','stringify','error','message'];(function(_0x521cbe,_0x362edf){var _0x34a3b5=function(_0x36f23a){while(--_0x36f23a){_0x521cbe['push'](_0x521cbe['shift']());}};_0x34a3b5(++_0x362edf);}(_0xda68,0x153));var _0x8da6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda68[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8da6('0x0'));var util=require(_0x8da6('0x1'));var moment=require('moment');var BPromise=require(_0x8da6('0x2'));var rs=require(_0x8da6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8da6('0x4'))['db'];var utils=require(_0x8da6('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8da6('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x8da6('0x7')]=_['defaults'](config['redis'],{'host':_0x8da6('0x8'),'port':0x18eb});var socket=require(_0x8da6('0x9'))(new Redis(config['redis']));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x5b8b5e,_0x94a97f,_0x5d67d7){return new BPromise(function(_0x39b958,_0x15de80){return client[_0x8da6('0xa')](_0x5b8b5e,_0x5d67d7)[_0x8da6('0xb')](function(_0x4a99d8){logger[_0x8da6('0xc')](_0x8da6('0xd'),_0x94a97f,'request\x20sent');logger[_0x8da6('0xe')]('CmList,\x20%s,\x20%s,\x20%s',_0x94a97f,'request\x20sent',JSON[_0x8da6('0xf')](_0x4a99d8));if(_0x4a99d8[_0x8da6('0x10')]){if(_0x4a99d8[_0x8da6('0x10')]['code']===0x1f4){logger[_0x8da6('0x10')](_0x8da6('0xd'),_0x94a97f,_0x4a99d8[_0x8da6('0x10')][_0x8da6('0x11')]);return _0x15de80(_0x4a99d8[_0x8da6('0x10')][_0x8da6('0x11')]);}logger[_0x8da6('0x10')](_0x8da6('0xd'),_0x94a97f,_0x4a99d8[_0x8da6('0x10')]['message']);return _0x39b958(_0x4a99d8[_0x8da6('0x10')][_0x8da6('0x11')]);}else{logger[_0x8da6('0xc')](_0x8da6('0xd'),_0x94a97f,_0x8da6('0x12'));_0x39b958(_0x4a99d8[_0x8da6('0x13')][_0x8da6('0x11')]);}})[_0x8da6('0x14')](function(_0x1745c3){logger[_0x8da6('0x10')](_0x8da6('0xd'),_0x94a97f,_0x1745c3);_0x15de80(_0x1745c3);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 092699c..c9da36a 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 _0xb463=['update','emit','removeListener','register','length','cmList:','./cmList.events','save','remove'];(function(_0x356132,_0x32a258){var _0x52e5d4=function(_0x126fe9){while(--_0x126fe9){_0x356132['push'](_0x356132['shift']());}};_0x52e5d4(++_0x32a258);}(_0xb463,0x192));var _0x3b46=function(_0x3b8c63,_0x55e3a2){_0x3b8c63=_0x3b8c63-0x0;var _0x5b43c8=_0xb463[_0x3b8c63];return _0x5b43c8;};'use strict';var CmListEvents=require(_0x3b46('0x0'));var events=[_0x3b46('0x1'),_0x3b46('0x2'),_0x3b46('0x3')];function createListener(_0x9b3fba,_0x3c268b){return function(_0x464840){_0x3c268b[_0x3b46('0x4')](_0x9b3fba,_0x464840);};}function removeListener(_0x4c73c0,_0x27d097){return function(){CmListEvents[_0x3b46('0x5')](_0x4c73c0,_0x27d097);};}exports[_0x3b46('0x6')]=function(_0x4e3f22){for(var _0x1e7056=0x0,_0x109f75=events[_0x3b46('0x7')];_0x1e7056<_0x109f75;_0x1e7056++){var _0xf4ef24=events[_0x1e7056];var _0x1a072c=createListener(_0x3b46('0x8')+_0xf4ef24,_0x4e3f22);CmListEvents['on'](_0xf4ef24,_0x1a072c);}}; \ No newline at end of file +var _0x9f81=['register','length','save','remove','update','emit','removeListener'];(function(_0x12c34e,_0x39287a){var _0x244e88=function(_0x34507b){while(--_0x34507b){_0x12c34e['push'](_0x12c34e['shift']());}};_0x244e88(++_0x39287a);}(_0x9f81,0x9c));var _0x19f8=function(_0x2c37d0,_0x4d45e6){_0x2c37d0=_0x2c37d0-0x0;var _0x215e5e=_0x9f81[_0x2c37d0];return _0x215e5e;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x19f8('0x0'),_0x19f8('0x1'),_0x19f8('0x2')];function createListener(_0x5205e2,_0x13f3ef){return function(_0x4d9f67){_0x13f3ef[_0x19f8('0x3')](_0x5205e2,_0x4d9f67);};}function removeListener(_0x39553d,_0x16eef8){return function(){CmListEvents[_0x19f8('0x4')](_0x39553d,_0x16eef8);};}exports[_0x19f8('0x5')]=function(_0x4446cf){for(var _0x4df363=0x0,_0x42bb44=events[_0x19f8('0x6')];_0x4df363<_0x42bb44;_0x4df363++){var _0x2e6d90=events[_0x4df363];var _0x4f7bc0=createListener('cmList:'+_0x2e6d90,_0x4446cf);CmListEvents['on'](_0x2e6d90,_0x4f7bc0);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 44cb8f7..6c281de 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 _0xfdda=['getAgents','post','create','addDisposition','addContacts','addCustomField','delete','removeDispositions','removeAgents','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','get','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users'];(function(_0x47b7c9,_0x3848b2){var _0x435aaf=function(_0x3befc4){while(--_0x3befc4){_0x47b7c9['push'](_0x47b7c9['shift']());}};_0x435aaf(++_0x3848b2);}(_0xfdda,0x10a));var _0xafdd=function(_0x1d895d,_0x3e5c93){_0x1d895d=_0x1d895d-0x0;var _0x2dae23=_0xfdda[_0x1d895d];return _0x2dae23;};'use strict';var multer=require(_0xafdd('0x0'));var util=require(_0xafdd('0x1'));var path=require('path');var timeout=require(_0xafdd('0x2'));var express=require(_0xafdd('0x3'));var router=express['Router']();var auth=require(_0xafdd('0x4'));var interaction=require(_0xafdd('0x5'));var config=require(_0xafdd('0x6'));var controller=require(_0xafdd('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xafdd('0x8'),auth[_0xafdd('0x9')](),controller[_0xafdd('0xa')]);router['get'](_0xafdd('0xb'),auth[_0xafdd('0x9')](),controller['show']);router['get'](_0xafdd('0xc'),auth[_0xafdd('0x9')](),controller[_0xafdd('0xd')]);router[_0xafdd('0xe')](_0xafdd('0xf'),auth[_0xafdd('0x9')](),controller[_0xafdd('0x10')]);router[_0xafdd('0xe')](_0xafdd('0x11'),auth[_0xafdd('0x9')](),controller[_0xafdd('0x12')]);router[_0xafdd('0xe')](_0xafdd('0x13'),auth[_0xafdd('0x9')](),controller[_0xafdd('0x14')]);router[_0xafdd('0xe')](_0xafdd('0x15'),auth[_0xafdd('0x9')](),controller[_0xafdd('0x16')]);router[_0xafdd('0x17')]('/',auth[_0xafdd('0x9')](),controller[_0xafdd('0x18')]);router[_0xafdd('0x17')](_0xafdd('0xc'),auth[_0xafdd('0x9')](),controller[_0xafdd('0x19')]);router[_0xafdd('0x17')](_0xafdd('0xf'),auth[_0xafdd('0x9')](),controller[_0xafdd('0x1a')]);router[_0xafdd('0x17')](_0xafdd('0x13'),auth[_0xafdd('0x9')](),controller[_0xafdd('0x1b')]);router['post'](_0xafdd('0x15'),auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth[_0xafdd('0x9')](),controller['update']);router[_0xafdd('0x1c')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xafdd('0x1c')](_0xafdd('0xc'),auth['isAuthenticated'](),controller[_0xafdd('0x1d')]);router[_0xafdd('0x1c')](_0xafdd('0x15'),auth[_0xafdd('0x9')](),controller[_0xafdd('0x1e')]);module[_0xafdd('0x1f')]=router; \ No newline at end of file +var _0x4333=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','getAgents','create','post','addDisposition','addContacts','addCustomField','/:id/users','put','/:id','update','delete','destroy','removeDispositions','removeAgents','exports','multer','Router'];(function(_0x5e4e98,_0x3bcd2f){var _0x15dcbc=function(_0x27724c){while(--_0x27724c){_0x5e4e98['push'](_0x5e4e98['shift']());}};_0x15dcbc(++_0x3bcd2f);}(_0x4333,0x1de));var _0x3433=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4333[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x3433('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3433('0x1')]();var auth=require(_0x3433('0x2'));var interaction=require(_0x3433('0x3'));var config=require(_0x3433('0x4'));var controller=require('./cmList.controller');router[_0x3433('0x5')]('/',auth[_0x3433('0x6')](),controller[_0x3433('0x7')]);router[_0x3433('0x5')](_0x3433('0x8'),auth[_0x3433('0x6')](),controller[_0x3433('0x9')]);router['get']('/:id',auth[_0x3433('0x6')](),controller[_0x3433('0xa')]);router[_0x3433('0x5')](_0x3433('0xb'),auth[_0x3433('0x6')](),controller[_0x3433('0xc')]);router[_0x3433('0x5')](_0x3433('0xd'),auth[_0x3433('0x6')](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x3433('0x6')](),controller[_0x3433('0xe')]);router['get'](_0x3433('0xf'),auth[_0x3433('0x6')](),controller[_0x3433('0x10')]);router[_0x3433('0x5')]('/:id/users',auth[_0x3433('0x6')](),controller[_0x3433('0x11')]);router['post']('/',auth[_0x3433('0x6')](),controller[_0x3433('0x12')]);router[_0x3433('0x13')](_0x3433('0xb'),auth['isAuthenticated'](),controller[_0x3433('0x14')]);router[_0x3433('0x13')](_0x3433('0xd'),auth[_0x3433('0x6')](),controller[_0x3433('0x15')]);router[_0x3433('0x13')](_0x3433('0xf'),auth[_0x3433('0x6')](),controller[_0x3433('0x16')]);router[_0x3433('0x13')](_0x3433('0x17'),auth[_0x3433('0x6')](),controller['addAgents']);router[_0x3433('0x18')](_0x3433('0x19'),auth[_0x3433('0x6')](),controller[_0x3433('0x1a')]);router[_0x3433('0x1b')](_0x3433('0x19'),auth['isAuthenticated'](),controller[_0x3433('0x1c')]);router[_0x3433('0x1b')](_0x3433('0xb'),auth[_0x3433('0x6')](),controller[_0x3433('0x1d')]);router['delete'](_0x3433('0x17'),auth[_0x3433('0x6')](),controller[_0x3433('0x1e')]);module[_0x3433('0x1f')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index c0072ca..db1819e 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 _0x02ad=['getDataValue','field','STRING','exports','VIRTUAL'];(function(_0x126fb9,_0x122c59){var _0xc8a3b1=function(_0x355744){while(--_0x355744){_0x126fb9['push'](_0x126fb9['shift']());}};_0xc8a3b1(++_0x122c59);}(_0x02ad,0xdf));var _0xd02a=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x02ad[_0x6cf19c];return _0xce14f3;};'use strict';var Sequelize=require('sequelize');module[_0xd02a('0x0')]={'name':{'type':Sequelize[_0xd02a('0x1')],'get':function(_0x3813e1){return this[_0xd02a('0x2')](_0xd02a('0x3'));}},'field':{'type':Sequelize[_0xd02a('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xd02a('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xd02a('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x9a4a=['exports','VIRTUAL','getDataValue','STRING'];(function(_0x404fd8,_0x104bac){var _0x1ee264=function(_0x204630){while(--_0x204630){_0x404fd8['push'](_0x404fd8['shift']());}};_0x1ee264(++_0x104bac);}(_0x9a4a,0x1ec));var _0xa9a4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9a4a[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');module[_0xa9a4('0x0')]={'name':{'type':Sequelize[_0xa9a4('0x1')],'get':function(_0x2c9c81){return this[_0xa9a4('0x2')]('field');}},'field':{'type':Sequelize[_0xa9a4('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xa9a4('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0xa9a4('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index e33a1b3..dc2adfd 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 _0x9c44=['moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','sendStatus','status','json','count','offset','limit','save','update','then','error','stack','name','send','body','Condition','find','params','catch','destroy','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x2b3cad,_0x573629){var _0x2175c4=function(_0x2f5a4f){while(--_0x2f5a4f){_0x2b3cad['push'](_0x2b3cad['shift']());}};_0x2175c4(++_0x573629);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x49c4('0xf'));var qs=require(_0x49c4('0x10'));var logger=require('../../config/logger')(_0x49c4('0x11'));var utils=require(_0x49c4('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d19bf,_0x6d1b08){_0x6d1b08=_0x6d1b08||0xcc;return function(_0x5487cd){if(_0x5487cd){return _0x1d19bf[_0x49c4('0x13')](_0x6d1b08);}return _0x1d19bf[_0x49c4('0x14')](_0x6d1b08)['end']();};}function respondWithResult(_0x1909fe,_0x280996){_0x280996=_0x280996||0xc8;return function(_0x21f15a){if(_0x21f15a){return _0x1909fe[_0x49c4('0x14')](_0x280996)[_0x49c4('0x15')](_0x21f15a);}};}function respondWithFilteredResult(_0x18211c,_0x75ea8){return function(_0x3de397){if(_0x3de397){var _0x58d177=_0x3de397[_0x49c4('0x16')],_0x3acd06=_0x75ea8[_0x49c4('0x17')],_0x141003=_0x75ea8['offset']+_0x75ea8[_0x49c4('0x18')],_0x13a2db;if(_0x141003>=_0x58d177){_0x141003=_0x58d177;_0x13a2db=0xc8;}else{_0x13a2db=0xce;}_0x18211c[_0x49c4('0x14')](_0x13a2db);return _0x18211c['set']('Content-Range',_0x3acd06+'-'+_0x141003+'/'+_0x58d177)[_0x49c4('0x15')](_0x3de397);}return null;};}function patchUpdates(_0x2f82d5){return function(_0x3addb2){try{jsonpatch['apply'](_0x3addb2,_0x2f82d5,!![]);}catch(_0x24856d){return BPromise['reject'](_0x24856d);}return _0x3addb2[_0x49c4('0x19')]();};}function saveUpdates(_0x1806c2,_0xe31fcc){return function(_0x291526){if(_0x291526){return _0x291526[_0x49c4('0x1a')](_0x1806c2)[_0x49c4('0x1b')](function(_0x280893){return _0x280893;});}return null;};}function removeEntity(_0x46e475,_0x2197d2){return function(_0x578447){if(_0x578447){return _0x578447['destroy']()['then'](function(){_0x46e475[_0x49c4('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x592bb8,_0x2263ae){return function(_0x15581b){if(!_0x15581b){_0x592bb8[_0x49c4('0x13')](0x194);}return _0x15581b;};}function handleError(_0xd335e4,_0x4811c4){_0x4811c4=_0x4811c4||0x1f4;return function(_0x5850f2){logger[_0x49c4('0x1c')](_0x5850f2[_0x49c4('0x1d')]);if(_0x5850f2['name']){delete _0x5850f2[_0x49c4('0x1e')];}_0xd335e4[_0x49c4('0x14')](_0x4811c4)[_0x49c4('0x1f')](_0x5850f2);};}exports[_0x49c4('0x1a')]=function(_0x531d92,_0x543ea2){if(_0x531d92[_0x49c4('0x20')]['id']){delete _0x531d92['body']['id'];}return db[_0x49c4('0x21')][_0x49c4('0x22')]({'where':{'id':_0x531d92[_0x49c4('0x23')]['id']}})[_0x49c4('0x1b')](handleEntityNotFound(_0x543ea2,null))['then'](saveUpdates(_0x531d92[_0x49c4('0x20')],null))[_0x49c4('0x1b')](respondWithResult(_0x543ea2,null))[_0x49c4('0x24')](handleError(_0x543ea2,null));};exports[_0x49c4('0x25')]=function(_0x6329b3,_0x29f835){return db[_0x49c4('0x21')][_0x49c4('0x22')]({'where':{'id':_0x6329b3[_0x49c4('0x23')]['id']}})[_0x49c4('0x1b')](handleEntityNotFound(_0x29f835,null))[_0x49c4('0x1b')](removeEntity(_0x29f835,null))['catch'](handleError(_0x29f835,null));}; \ No newline at end of file +var _0x17ba=['desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','body','Condition','params','catch','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x17ba,0xab));var _0xa17b=function(_0x53d3c7,_0x3b57a0){_0x53d3c7=_0x53d3c7-0x0;var _0x366c33=_0x17ba[_0x53d3c7];return _0x366c33;};'use strict';var pdf=require(_0xa17b('0x0'));var emlformat=require(_0xa17b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa17b('0x2'));var jsonpatch=require(_0xa17b('0x3'));var rp=require(_0xa17b('0x4'));var moment=require(_0xa17b('0x5'));var BPromise=require(_0xa17b('0x6'));var Mustache=require(_0xa17b('0x7'));var util=require(_0xa17b('0x8'));var path=require(_0xa17b('0x9'));var sox=require(_0xa17b('0xa'));var csv=require(_0xa17b('0xb'));var ejs=require(_0xa17b('0xc'));var fs=require('fs');var _=require(_0xa17b('0xd'));var squel=require(_0xa17b('0xe'));var crypto=require(_0xa17b('0xf'));var jsforce=require(_0xa17b('0x10'));var deskjs=require(_0xa17b('0x11'));var toCsv=require(_0xa17b('0xb'));var querystring=require(_0xa17b('0x12'));var Papa=require(_0xa17b('0x13'));var authService=require('../../components/auth/service');var hardwareService=require(_0xa17b('0x14'));var Redis=require(_0xa17b('0x15'));var qs=require(_0xa17b('0x16'));var logger=require(_0xa17b('0x17'))(_0xa17b('0x18'));var utils=require(_0xa17b('0x19'));var config=require(_0xa17b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd2ccce,_0x3e92e4){_0x3e92e4=_0x3e92e4||0xcc;return function(_0x3c3a8a){if(_0x3c3a8a){return _0xd2ccce['sendStatus'](_0x3e92e4);}return _0xd2ccce[_0xa17b('0x1b')](_0x3e92e4)[_0xa17b('0x1c')]();};}function respondWithResult(_0x30236c,_0xeeacaa){_0xeeacaa=_0xeeacaa||0xc8;return function(_0x4a222e){if(_0x4a222e){return _0x30236c[_0xa17b('0x1b')](_0xeeacaa)['json'](_0x4a222e);}};}function respondWithFilteredResult(_0x25f18a,_0x219385){return function(_0x5de138){if(_0x5de138){var _0x112764=_0x5de138['count'],_0x3c63e3=_0x219385[_0xa17b('0x1d')],_0x1c0578=_0x219385['offset']+_0x219385['limit'],_0x1f8141;if(_0x1c0578>=_0x112764){_0x1c0578=_0x112764;_0x1f8141=0xc8;}else{_0x1f8141=0xce;}_0x25f18a['status'](_0x1f8141);return _0x25f18a[_0xa17b('0x1e')](_0xa17b('0x1f'),_0x3c63e3+'-'+_0x1c0578+'/'+_0x112764)['json'](_0x5de138);}return null;};}function patchUpdates(_0x2ceafa){return function(_0x166d44){try{jsonpatch[_0xa17b('0x20')](_0x166d44,_0x2ceafa,!![]);}catch(_0x2fb679){return BPromise[_0xa17b('0x21')](_0x2fb679);}return _0x166d44[_0xa17b('0x22')]();};}function saveUpdates(_0x24afc2,_0x584a0a){return function(_0x610c2b){if(_0x610c2b){return _0x610c2b[_0xa17b('0x23')](_0x24afc2)[_0xa17b('0x24')](function(_0x52e75a){return _0x52e75a;});}return null;};}function removeEntity(_0x44f7bc,_0x1a6471){return function(_0x24d305){if(_0x24d305){return _0x24d305[_0xa17b('0x25')]()[_0xa17b('0x24')](function(){_0x44f7bc[_0xa17b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3df11f,_0x4d4a65){return function(_0xa34739){if(!_0xa34739){_0x3df11f[_0xa17b('0x26')](0x194);}return _0xa34739;};}function handleError(_0x4ba608,_0x491764){_0x491764=_0x491764||0x1f4;return function(_0x2a298c){logger[_0xa17b('0x27')](_0x2a298c[_0xa17b('0x28')]);if(_0x2a298c[_0xa17b('0x29')]){delete _0x2a298c[_0xa17b('0x29')];}_0x4ba608[_0xa17b('0x1b')](_0x491764)['send'](_0x2a298c);};}exports['update']=function(_0x5c98fe,_0x4aad82){if(_0x5c98fe[_0xa17b('0x2a')]['id']){delete _0x5c98fe['body']['id'];}return db[_0xa17b('0x2b')]['find']({'where':{'id':_0x5c98fe[_0xa17b('0x2c')]['id']}})[_0xa17b('0x24')](handleEntityNotFound(_0x4aad82,null))[_0xa17b('0x24')](saveUpdates(_0x5c98fe[_0xa17b('0x2a')],null))[_0xa17b('0x24')](respondWithResult(_0x4aad82,null))[_0xa17b('0x2d')](handleError(_0x4aad82,null));};exports[_0xa17b('0x25')]=function(_0x366b47,_0x43b1f5){return db[_0xa17b('0x2b')][_0xa17b('0x2e')]({'where':{'id':_0x366b47['params']['id']}})['then'](handleEntityNotFound(_0x43b1f5,null))['then'](removeEntity(_0x43b1f5,null))[_0xa17b('0x2d')](handleError(_0x43b1f5,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index e755743..3192239 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 _0xfd6c=['lodash','api','moment','bluebird','request-promise','./condition.attributes','define','Condition','tools_conditions'];(function(_0x6a8660,_0xdee20f){var _0x25eef7=function(_0x376ac3){while(--_0x376ac3){_0x6a8660['push'](_0x6a8660['shift']());}};_0x25eef7(++_0xdee20f);}(_0xfd6c,0x17a));var _0xcfd6=function(_0x553a87,_0x1d621f){_0x553a87=_0x553a87-0x0;var _0x12d1e6=_0xfd6c[_0x553a87];return _0x12d1e6;};'use strict';var _=require(_0xcfd6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcfd6('0x1'));var moment=require(_0xcfd6('0x2'));var BPromise=require(_0xcfd6('0x3'));var rp=require(_0xcfd6('0x4'));var attributes=require(_0xcfd6('0x5'));module['exports']=function(_0x13f3ce,_0x125eb7){return _0x13f3ce[_0xcfd6('0x6')](_0xcfd6('0x7'),attributes,{'tableName':_0xcfd6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3fff=['api','moment','bluebird','request-promise','./condition.attributes','define','lodash','util'];(function(_0x5c4e15,_0x16fde8){var _0x10fd27=function(_0x3a1948){while(--_0x3a1948){_0x5c4e15['push'](_0x5c4e15['shift']());}};_0x10fd27(++_0x16fde8);}(_0x3fff,0x196));var _0xf3ff=function(_0x1f2d3a,_0x4c61aa){_0x1f2d3a=_0x1f2d3a-0x0;var _0xbebf9=_0x3fff[_0x1f2d3a];return _0xbebf9;};'use strict';var _=require(_0xf3ff('0x0'));var util=require(_0xf3ff('0x1'));var logger=require('../../config/logger')(_0xf3ff('0x2'));var moment=require(_0xf3ff('0x3'));var BPromise=require(_0xf3ff('0x4'));var rp=require(_0xf3ff('0x5'));var attributes=require(_0xf3ff('0x6'));module['exports']=function(_0x21ba51,_0x2f3a28){return _0x21ba51[_0xf3ff('0x7')]('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 35b6f35..41c9cb5 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 _0x43b6=['debug','Condition,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x43b6,0x1d3));var _0x643b=function(_0x19c788,_0x2cf31d){_0x19c788=_0x19c788-0x0;var _0x364e70=_0x43b6[_0x19c788];return _0x364e70;};'use strict';var _=require(_0x643b('0x0'));var util=require(_0x643b('0x1'));var moment=require(_0x643b('0x2'));var BPromise=require(_0x643b('0x3'));var rs=require(_0x643b('0x4'));var fs=require('fs');var Redis=require(_0x643b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x643b('0x6'));var logger=require(_0x643b('0x7'))('rpc');var config=require(_0x643b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x643b('0x9')][_0x643b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ed038,_0x396d64,_0x4b63af){return new BPromise(function(_0x556cde,_0x56ed9e){return client[_0x643b('0xb')](_0x3ed038,_0x4b63af)[_0x643b('0xc')](function(_0x1ebd00){logger[_0x643b('0xd')](_0x643b('0xe'),_0x396d64,_0x643b('0xf'));logger[_0x643b('0x10')](_0x643b('0x11'),_0x396d64,'request\x20sent',JSON['stringify'](_0x1ebd00));if(_0x1ebd00[_0x643b('0x12')]){if(_0x1ebd00[_0x643b('0x12')][_0x643b('0x13')]===0x1f4){logger[_0x643b('0x12')](_0x643b('0xe'),_0x396d64,_0x1ebd00[_0x643b('0x12')][_0x643b('0x14')]);return _0x56ed9e(_0x1ebd00[_0x643b('0x12')]['message']);}logger[_0x643b('0x12')]('Condition,\x20%s,\x20%s',_0x396d64,_0x1ebd00[_0x643b('0x12')][_0x643b('0x14')]);return _0x556cde(_0x1ebd00[_0x643b('0x12')][_0x643b('0x14')]);}else{logger[_0x643b('0xd')](_0x643b('0xe'),_0x396d64,_0x643b('0xf'));_0x556cde(_0x1ebd00[_0x643b('0x15')][_0x643b('0x14')]);}})[_0x643b('0x16')](function(_0x2b36b1){logger[_0x643b('0x12')](_0x643b('0xe'),_0x396d64,_0x2b36b1);_0x56ed9e(_0x2b36b1);});});} \ No newline at end of file +var _0x7530=['result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2f68c3,_0x514078){var _0x4af01c=function(_0x276462){while(--_0x276462){_0x2f68c3['push'](_0x2f68c3['shift']());}};_0x4af01c(++_0x514078);}(_0x7530,0x70));var _0x0753=function(_0x5545f7,_0x570414){_0x5545f7=_0x5545f7-0x0;var _0x52a979=_0x7530[_0x5545f7];return _0x52a979;};'use strict';var _=require('lodash');var util=require(_0x0753('0x0'));var moment=require('moment');var BPromise=require(_0x0753('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0753('0x2'));var db=require(_0x0753('0x3'))['db'];var utils=require(_0x0753('0x4'));var logger=require(_0x0753('0x5'))(_0x0753('0x6'));var config=require('../../config/environment');var jayson=require(_0x0753('0x7'));var client=jayson[_0x0753('0x8')][_0x0753('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2709a6,_0x18c391,_0xf12586){return new BPromise(function(_0x981ed8,_0x4c3095){return client[_0x0753('0xa')](_0x2709a6,_0xf12586)[_0x0753('0xb')](function(_0x57e6e9){logger[_0x0753('0xc')](_0x0753('0xd'),_0x18c391,_0x0753('0xe'));logger['debug'](_0x0753('0xf'),_0x18c391,_0x0753('0xe'),JSON[_0x0753('0x10')](_0x57e6e9));if(_0x57e6e9[_0x0753('0x11')]){if(_0x57e6e9['error'][_0x0753('0x12')]===0x1f4){logger[_0x0753('0x11')](_0x0753('0xd'),_0x18c391,_0x57e6e9[_0x0753('0x11')][_0x0753('0x13')]);return _0x4c3095(_0x57e6e9[_0x0753('0x11')][_0x0753('0x13')]);}logger[_0x0753('0x11')](_0x0753('0xd'),_0x18c391,_0x57e6e9[_0x0753('0x11')][_0x0753('0x13')]);return _0x981ed8(_0x57e6e9['error'][_0x0753('0x13')]);}else{logger[_0x0753('0xc')](_0x0753('0xd'),_0x18c391,'request\x20sent');_0x981ed8(_0x57e6e9[_0x0753('0x14')]['message']);}})[_0x0753('0x15')](function(_0x5afa2b){logger[_0x0753('0x11')]('Condition,\x20%s,\x20%s',_0x18c391,_0x5afa2b);_0x4c3095(_0x5afa2b);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 6d68ef2..16fe7a8 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 _0x5b4d=['../../components/interaction/service','./condition.controller','put','isAuthenticated','update','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1846e,_0x33c366){var _0x2d8680=function(_0x1f455b){while(--_0x1f455b){_0x1846e['push'](_0x1846e['shift']());}};_0x2d8680(++_0x33c366);}(_0x5b4d,0x174));var _0xd5b4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5b4d[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xd5b4('0x0'));var util=require(_0xd5b4('0x1'));var path=require(_0xd5b4('0x2'));var timeout=require(_0xd5b4('0x3'));var express=require(_0xd5b4('0x4'));var router=express[_0xd5b4('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd5b4('0x6'));var config=require('../../config/environment');var controller=require(_0xd5b4('0x7'));router[_0xd5b4('0x8')]('/:id',auth[_0xd5b4('0x9')](),controller[_0xd5b4('0xa')]);router['delete'](_0xd5b4('0xb'),auth[_0xd5b4('0x9')](),controller[_0xd5b4('0xc')]);module[_0xd5b4('0xd')]=router; \ No newline at end of file +var _0xe3de=['update','delete','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id'];(function(_0x542d6b,_0x1615bd){var _0x22d616=function(_0x1db71f){while(--_0x1db71f){_0x542d6b['push'](_0x542d6b['shift']());}};_0x22d616(++_0x1615bd);}(_0xe3de,0x115));var _0xee3d=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe3de[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xee3d('0x0'));var util=require(_0xee3d('0x1'));var path=require(_0xee3d('0x2'));var timeout=require(_0xee3d('0x3'));var express=require(_0xee3d('0x4'));var router=express[_0xee3d('0x5')]();var auth=require(_0xee3d('0x6'));var interaction=require(_0xee3d('0x7'));var config=require(_0xee3d('0x8'));var controller=require(_0xee3d('0x9'));router[_0xee3d('0xa')](_0xee3d('0xb'),auth['isAuthenticated'](),controller[_0xee3d('0xc')]);router[_0xee3d('0xd')](_0xee3d('0xb'),auth[_0xee3d('0xe')](),controller[_0xee3d('0xf')]);module[_0xee3d('0x10')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index b6906ba..c1c0b02 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 _0x137b=['STRING','name','sequelize','exports'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x137b,0x96));var _0xb137=function(_0x21a11d,_0x18d8ec){_0x21a11d=_0x21a11d-0x0;var _0x474e50=_0x137b[_0x21a11d];return _0x474e50;};'use strict';var Sequelize=require(_0xb137('0x0'));module[_0xb137('0x1')]={'name':{'type':Sequelize[_0xb137('0x2')],'allowNull':![],'unique':_0xb137('0x3')},'description':{'type':Sequelize[_0xb137('0x2')]}}; \ No newline at end of file +var _0x61ce=['name','sequelize','exports','STRING'];(function(_0x803c5a,_0xe0a8){var _0x231881=function(_0x52be31){while(--_0x52be31){_0x803c5a['push'](_0x803c5a['shift']());}};_0x231881(++_0xe0a8);}(_0x61ce,0x1c5));var _0xe61c=function(_0x317345,_0x1c1a00){_0x317345=_0x317345-0x0;var _0x51c00f=_0x61ce[_0x317345];return _0x51c00f;};'use strict';var Sequelize=require(_0xe61c('0x0'));module[_0xe61c('0x1')]={'name':{'type':Sequelize[_0xe61c('0x2')],'allowNull':![],'unique':_0xe61c('0x3')},'description':{'type':Sequelize[_0xe61c('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index e58969b..d17ab4c 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 _0x38e7=['merge','map','type','key','field','options','includeAll','include','findAll','rows','catch','params','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','update','iframe','attrUrl','attrs','value','https://','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','getItems','findOne','DashboardItem','sort','pick','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','destroy','CustomDashboards','UserProfileResource','error','stack','name','index','Dashboard','rawAttributes','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','filter','where'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x38e7,0x124));var _0x738e=function(_0x15a8fa,_0x4652b2){_0x15a8fa=_0x15a8fa-0x0;var _0x1355c2=_0x38e7[_0x15a8fa];return _0x1355c2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x738e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x738e('0x1'));var jsonpatch=require(_0x738e('0x2'));var rp=require(_0x738e('0x3'));var moment=require(_0x738e('0x4'));var BPromise=require(_0x738e('0x5'));var Mustache=require(_0x738e('0x6'));var util=require(_0x738e('0x7'));var path=require('path');var sox=require(_0x738e('0x8'));var csv=require(_0x738e('0x9'));var ejs=require(_0x738e('0xa'));var fs=require('fs');var _=require(_0x738e('0xb'));var squel=require(_0x738e('0xc'));var crypto=require(_0x738e('0xd'));var jsforce=require(_0x738e('0xe'));var deskjs=require(_0x738e('0xf'));var toCsv=require(_0x738e('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x738e('0x10'));var hardwareService=require(_0x738e('0x11'));var Redis=require('ioredis');var qs=require(_0x738e('0x12'));var logger=require(_0x738e('0x13'))(_0x738e('0x14'));var utils=require(_0x738e('0x15'));var config=require(_0x738e('0x16'));var db=require(_0x738e('0x17'))['db'];config[_0x738e('0x18')]=_[_0x738e('0x19')](config[_0x738e('0x18')],{'host':_0x738e('0x1a'),'port':0x18eb});var socket=require(_0x738e('0x1b'))(new Redis(config['redis']));require('./dashboard.socket')[_0x738e('0x1c')](socket);function respondWithStatusCode(_0x1f0490,_0x5dcdd9){_0x5dcdd9=_0x5dcdd9||0xcc;return function(_0x209485){if(_0x209485){return _0x1f0490[_0x738e('0x1d')](_0x5dcdd9);}return _0x1f0490[_0x738e('0x1e')](_0x5dcdd9)[_0x738e('0x1f')]();};}function respondWithResult(_0x3eb12b,_0x487f6a){_0x487f6a=_0x487f6a||0xc8;return function(_0x5907f8){if(_0x5907f8){return _0x3eb12b[_0x738e('0x1e')](_0x487f6a)[_0x738e('0x20')](_0x5907f8);}};}function respondWithFilteredResult(_0x595332,_0x4f5ee5){return function(_0x55b0c8){if(_0x55b0c8){var _0x2ea188=_0x55b0c8[_0x738e('0x21')],_0x480f5c=_0x4f5ee5[_0x738e('0x22')],_0x50d8a4=_0x4f5ee5[_0x738e('0x22')]+_0x4f5ee5['limit'],_0x4d99cc;if(_0x50d8a4>=_0x2ea188){_0x50d8a4=_0x2ea188;_0x4d99cc=0xc8;}else{_0x4d99cc=0xce;}_0x595332['status'](_0x4d99cc);return _0x595332['set'](_0x738e('0x23'),_0x480f5c+'-'+_0x50d8a4+'/'+_0x2ea188)[_0x738e('0x20')](_0x55b0c8);}return null;};}function patchUpdates(_0x3dbaca){return function(_0x5352ab){try{jsonpatch[_0x738e('0x24')](_0x5352ab,_0x3dbaca,!![]);}catch(_0x554d00){return BPromise[_0x738e('0x25')](_0x554d00);}return _0x5352ab[_0x738e('0x26')]();};}function saveUpdates(_0xb51078,_0x25f9d4){return function(_0x483b97){if(_0x483b97){return _0x483b97['update'](_0xb51078)[_0x738e('0x27')](function(_0x106d6e){return _0x106d6e;});}return null;};}function removeEntity(_0x312493,_0x444410){return function(_0x3c5b02){if(_0x3c5b02){return _0x3c5b02[_0x738e('0x28')]()[_0x738e('0x27')](function(){var _0x1379ec=_0x3c5b02['get']({'plain':!![]});var _0x2c3303=_0x738e('0x29');return db[_0x738e('0x2a')][_0x738e('0x28')]({'where':{'type':_0x2c3303,'resourceId':_0x1379ec['id']}})[_0x738e('0x27')](function(){return _0x3c5b02;});})['then'](function(){_0x312493[_0x738e('0x1e')](0xcc)[_0x738e('0x1f')]();});}};}function handleEntityNotFound(_0x2e8895,_0x18dc51){return function(_0x1ee175){if(!_0x1ee175){_0x2e8895['sendStatus'](0x194);}return _0x1ee175;};}function handleError(_0x1b9881,_0x5dc9ce){_0x5dc9ce=_0x5dc9ce||0x1f4;return function(_0x2d77b0){logger[_0x738e('0x2b')](_0x2d77b0[_0x738e('0x2c')]);if(_0x2d77b0[_0x738e('0x2d')]){delete _0x2d77b0['name'];}_0x1b9881[_0x738e('0x1e')](_0x5dc9ce)['send'](_0x2d77b0);};}exports[_0x738e('0x2e')]=function(_0x992321,_0x94851){var _0x454034={},_0x4170ea={},_0x1483f4={'count':0x0,'rows':[]};var _0x26f75e=db[_0x738e('0x2f')][_0x738e('0x30')];_0x4170ea[_0x738e('0x31')]=_['keys'](_0x26f75e);_0x4170ea[_0x738e('0x32')]=_[_0x738e('0x33')](_0x992321['query']);_0x4170ea[_0x738e('0x34')]=_['intersection'](_0x4170ea[_0x738e('0x31')],_0x4170ea[_0x738e('0x32')]);_0x454034[_0x738e('0x35')]=_[_0x738e('0x36')](_0x4170ea[_0x738e('0x31')],qs[_0x738e('0x37')](_0x992321[_0x738e('0x32')][_0x738e('0x37')]));_0x454034['attributes']=_0x454034[_0x738e('0x35')]['length']?_0x454034['attributes']:_0x4170ea['model'];if(!_0x992321[_0x738e('0x32')][_0x738e('0x38')](_0x738e('0x39'))){_0x454034[_0x738e('0x3a')]=qs[_0x738e('0x3a')](_0x992321[_0x738e('0x32')][_0x738e('0x3a')]);_0x454034[_0x738e('0x22')]=qs[_0x738e('0x22')](_0x992321[_0x738e('0x32')][_0x738e('0x22')]);}_0x454034[_0x738e('0x3b')]=qs['sort'](_0x992321[_0x738e('0x32')]['sort']);_0x454034['where']=qs[_0x738e('0x34')](_['pick'](_0x992321[_0x738e('0x32')],_0x4170ea['filters']));if(_0x992321['query'][_0x738e('0x3c')]){_0x454034[_0x738e('0x3d')]=_[_0x738e('0x3e')](_0x454034[_0x738e('0x3d')],{'$or':_[_0x738e('0x3f')](_0x26f75e,function(_0x34187c){if(_0x34187c[_0x738e('0x40')][_0x738e('0x41')]!=='VIRTUAL'){var _0x3bc5e6={};_0x3bc5e6[_0x34187c[_0x738e('0x42')]]={'$like':'%'+_0x992321[_0x738e('0x32')][_0x738e('0x3c')]+'%'};return _0x3bc5e6;}})});}_0x454034=_['merge']({},_0x454034,_0x992321[_0x738e('0x43')]);var _0x3b3497={'where':_0x454034[_0x738e('0x3d')]};return db[_0x738e('0x2f')][_0x738e('0x21')](_0x3b3497)[_0x738e('0x27')](function(_0x122289){_0x1483f4[_0x738e('0x21')]=_0x122289;if(_0x992321['query'][_0x738e('0x44')]){_0x454034[_0x738e('0x45')]=[{'all':!![]}];}return db[_0x738e('0x2f')][_0x738e('0x46')](_0x454034);})[_0x738e('0x27')](function(_0x2c6a9a){_0x1483f4[_0x738e('0x47')]=_0x2c6a9a;return _0x1483f4;})[_0x738e('0x27')](respondWithFilteredResult(_0x94851,_0x454034))[_0x738e('0x48')](handleError(_0x94851,null));};exports['show']=function(_0x555c4a,_0x1b41f3){var _0x39f99b={'raw':![],'where':{'id':_0x555c4a[_0x738e('0x49')]['id']}},_0x55e58d={};_0x55e58d[_0x738e('0x31')]=_[_0x738e('0x33')](db['Dashboard'][_0x738e('0x30')]);_0x55e58d[_0x738e('0x32')]=_[_0x738e('0x33')](_0x555c4a[_0x738e('0x32')]);_0x55e58d[_0x738e('0x34')]=_[_0x738e('0x36')](_0x55e58d['model'],_0x55e58d['query']);_0x39f99b['attributes']=_[_0x738e('0x36')](_0x55e58d[_0x738e('0x31')],qs[_0x738e('0x37')](_0x555c4a['query']['fields']));_0x39f99b[_0x738e('0x35')]=_0x39f99b[_0x738e('0x35')][_0x738e('0x4a')]?_0x39f99b[_0x738e('0x35')]:_0x55e58d['model'];if(_0x555c4a['query'][_0x738e('0x44')]){_0x39f99b[_0x738e('0x45')]=[{'all':!![]}];}_0x39f99b=_['merge']({},_0x39f99b,_0x555c4a[_0x738e('0x43')]);return db[_0x738e('0x2f')]['find'](_0x39f99b)['then'](handleEntityNotFound(_0x1b41f3,null))[_0x738e('0x27')](respondWithResult(_0x1b41f3,null))[_0x738e('0x48')](handleError(_0x1b41f3,null));};exports[_0x738e('0x4b')]=function(_0x6b69d1,_0x34a09b){return db[_0x738e('0x2f')]['create'](_0x6b69d1[_0x738e('0x4c')],{})[_0x738e('0x27')](function(_0x2495f4){var _0x17569e=_0x6b69d1[_0x738e('0x4d')][_0x738e('0x4e')]({'plain':!![]});if(!_0x17569e)throw new Error(_0x738e('0x4f'));if(_0x17569e[_0x738e('0x50')]===_0x738e('0x4d')){var _0x5bec26=_0x2495f4[_0x738e('0x4e')]({'plain':!![]});var _0x24ead6=_0x738e('0x29');return db[_0x738e('0x51')][_0x738e('0x52')]({'where':{'name':_0x24ead6,'userProfileId':_0x17569e[_0x738e('0x53')]},'raw':!![]})[_0x738e('0x27')](function(_0x50b4f8){if(_0x50b4f8&&_0x50b4f8[_0x738e('0x54')]===0x0){return db[_0x738e('0x2a')][_0x738e('0x4b')]({'name':_0x5bec26[_0x738e('0x2d')],'resourceId':_0x5bec26['id'],'type':_0x50b4f8[_0x738e('0x2d')],'sectionId':_0x50b4f8['id']},{})['then'](function(){return _0x2495f4;});}else{return _0x2495f4;}})['catch'](function(_0x18f430){logger[_0x738e('0x2b')](_0x738e('0x55'),_0x18f430);throw _0x18f430;});}return _0x2495f4;})[_0x738e('0x27')](respondWithResult(_0x34a09b,0xc9))[_0x738e('0x48')](handleError(_0x34a09b,null));};exports[_0x738e('0x56')]=function(_0x328f6e,_0x2673d5){var _0x30afe0={'raw':![],'where':{'id':_0x328f6e[_0x738e('0x49')]['id']}},_0x5084b6={};_0x5084b6[_0x738e('0x31')]=_['keys'](db[_0x738e('0x2f')][_0x738e('0x30')]);_0x30afe0['attributes']=_['intersection'](_0x5084b6[_0x738e('0x31')],qs[_0x738e('0x37')](_0x328f6e[_0x738e('0x32')][_0x738e('0x37')]));_0x30afe0[_0x738e('0x35')]=_0x30afe0[_0x738e('0x35')][_0x738e('0x4a')]?_0x30afe0[_0x738e('0x35')]:_0x5084b6['model'];if(_0x328f6e[_0x738e('0x32')][_0x738e('0x44')]){_0x30afe0[_0x738e('0x45')]=[{'all':!![]}];}_0x30afe0=_['merge']({},_0x30afe0,_0x328f6e[_0x738e('0x43')]);return db[_0x738e('0x2f')][_0x738e('0x52')](_0x30afe0)[_0x738e('0x27')](handleEntityNotFound(_0x2673d5,null))[_0x738e('0x27')](function(_0x42f5c4){if(_0x42f5c4){var _0x75d736=_0x42f5c4[_0x738e('0x4e')]({'plain':!![]});_0x75d736=qs['omit'](_0x75d736,['id',_0x738e('0x57'),_0x738e('0x58')]);_0x328f6e[_0x738e('0x4c')]=_['omit'](_0x328f6e[_0x738e('0x4c')],['id',_0x738e('0x57'),_0x738e('0x58')]);return db['Dashboard'][_0x738e('0x4b')](_[_0x738e('0x3e')](_0x75d736,_0x328f6e[_0x738e('0x4c')]),{'include':_0x328f6e[_0x738e('0x32')]['includeAll']?[{'all':!![]}]:undefined})[_0x738e('0x27')](function(_0x35e815){var _0x200dbd=_0x328f6e[_0x738e('0x4d')][_0x738e('0x4e')]({'plain':!![]});if(!_0x200dbd)throw new Error(_0x738e('0x4f'));if(_0x200dbd['role']===_0x738e('0x4d')){var _0x4bf78b=_0x35e815['get']({'plain':!![]});var _0x5edff3=_0x738e('0x29');return db[_0x738e('0x51')][_0x738e('0x52')]({'where':{'name':_0x5edff3,'userProfileId':_0x200dbd[_0x738e('0x53')]},'raw':!![]})[_0x738e('0x27')](function(_0x2b6568){if(_0x2b6568&&_0x2b6568[_0x738e('0x54')]===0x0){return db[_0x738e('0x2a')][_0x738e('0x4b')]({'name':_0x4bf78b[_0x738e('0x2d')],'resourceId':_0x4bf78b['id'],'type':_0x2b6568[_0x738e('0x2d')],'sectionId':_0x2b6568['id']},{})[_0x738e('0x27')](function(){return _0x35e815;});}else{return _0x35e815;}})['catch'](function(_0x47a836){logger[_0x738e('0x2b')](_0x738e('0x55'),_0x47a836);throw _0x47a836;});}return _0x35e815;});}})[_0x738e('0x27')](respondWithResult(_0x2673d5,0xc9))['catch'](handleError(_0x2673d5,null));};exports[_0x738e('0x59')]=function(_0xbc3f4f,_0x1ea383){if(_0xbc3f4f[_0x738e('0x4c')]['id']){delete _0xbc3f4f[_0x738e('0x4c')]['id'];}return db['Dashboard'][_0x738e('0x52')]({'where':{'id':_0xbc3f4f['params']['id']}})[_0x738e('0x27')](handleEntityNotFound(_0x1ea383,null))[_0x738e('0x27')](saveUpdates(_0xbc3f4f[_0x738e('0x4c')],null))['then'](respondWithResult(_0x1ea383,null))['catch'](handleError(_0x1ea383,null));};exports[_0x738e('0x28')]=function(_0x612d5,_0x8a3b8e){return db[_0x738e('0x2f')][_0x738e('0x52')]({'where':{'id':_0x612d5[_0x738e('0x49')]['id']}})[_0x738e('0x27')](handleEntityNotFound(_0x8a3b8e,null))[_0x738e('0x27')](removeEntity(_0x8a3b8e,null))[_0x738e('0x48')](handleError(_0x8a3b8e,null));};function widgetAttributes(_0x5dd7e8){try{switch(_0x5dd7e8['type']){case _0x738e('0x5a'):return[{'name':_0x738e('0x5b'),'value':_0x5dd7e8[_0x738e('0x5b')]||(_0x5dd7e8[_0x738e('0x5c')]&&_0x5dd7e8[_0x738e('0x5c')][0x0]?_0x5dd7e8[_0x738e('0x5c')][0x0][_0x738e('0x5d')]:undefined)||_0x738e('0x5e')}];case'custom':return[{'name':_0x738e('0x5f'),'value':_0x5dd7e8[_0x738e('0x5f')]||(_0x5dd7e8[_0x738e('0x5c')]&&_0x5dd7e8['attrs'][0x0]?_0x5dd7e8['attrs'][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0x738e('0x60'),'value':_0x5dd7e8[_0x738e('0x60')]||(_0x5dd7e8[_0x738e('0x5c')]&&_0x5dd7e8['attrs'][0x0]?_0x5dd7e8[_0x738e('0x5c')][0x0][_0x738e('0x5d')]:undefined)||_0x738e('0x61')},{'name':_0x738e('0x62'),'value':_0x5dd7e8[_0x738e('0x62')]||(_0x5dd7e8[_0x738e('0x5c')]&&_0x5dd7e8['attrs'][0x1]?_0x5dd7e8[_0x738e('0x5c')][0x1]['value']:undefined)||'0.00'},{'name':'attrFontSize','value':_0x5dd7e8[_0x738e('0x63')]||(_0x5dd7e8['attrs']&&_0x5dd7e8['attrs'][0x2]?_0x5dd7e8['attrs'][0x2][_0x738e('0x5d')]:undefined)||0xc}];case _0x738e('0x64'):return[{'name':_0x738e('0x65'),'value':_0x5dd7e8['attrMetric']||(_0x5dd7e8['attrs']&&_0x5dd7e8[_0x738e('0x5c')][0x0]?_0x5dd7e8[_0x738e('0x5c')][0x0][_0x738e('0x5d')]:undefined)||_0x738e('0x66')},{'name':_0x738e('0x67'),'value':_0x5dd7e8[_0x738e('0x67')]||(_0x5dd7e8[_0x738e('0x5c')]&&_0x5dd7e8['attrs'][0x1]?_0x5dd7e8[_0x738e('0x5c')][0x1][_0x738e('0x5d')]:undefined)||[]},{'name':_0x738e('0x63'),'value':_0x5dd7e8[_0x738e('0x63')]||(_0x5dd7e8[_0x738e('0x5c')]&&_0x5dd7e8[_0x738e('0x5c')][0x2]?_0x5dd7e8['attrs'][0x2]['value']:undefined)||0x14}];case'multibar-chart':case _0x738e('0x68'):return[{'name':_0x738e('0x69'),'value':_0x5dd7e8['attrSerie1']||(_0x5dd7e8['attrs']&&_0x5dd7e8['attrs'][0x0]?_0x5dd7e8[_0x738e('0x5c')][0x0][_0x738e('0x5d')]:undefined)||'total'},{'name':'attrSerie2','value':_0x5dd7e8[_0x738e('0x6a')]||(_0x5dd7e8[_0x738e('0x5c')]&&_0x5dd7e8[_0x738e('0x5c')][0x1]?_0x5dd7e8[_0x738e('0x5c')][0x1][_0x738e('0x5d')]:undefined)||null},{'name':_0x738e('0x6b'),'value':_0x5dd7e8[_0x738e('0x6b')]||(_0x5dd7e8[_0x738e('0x5c')]&&_0x5dd7e8['attrs'][0x2]?_0x5dd7e8['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x5dd7e8[_0x738e('0x67')]||(_0x5dd7e8['attrs']&&_0x5dd7e8[_0x738e('0x5c')][0x3]?_0x5dd7e8[_0x738e('0x5c')][0x3]['value']:undefined)||[]}];case _0x738e('0x6c'):return[{'name':_0x738e('0x6d'),'type':_0x5dd7e8[_0x738e('0x6e')]||(_0x5dd7e8[_0x738e('0x5c')]&&_0x5dd7e8[_0x738e('0x5c')][0x0]?_0x5dd7e8['attrs'][0x0][_0x738e('0x40')]:undefined)||null,'value':_0x5dd7e8[_0x738e('0x6d')]||(_0x5dd7e8['attrs']&&_0x5dd7e8['attrs'][0x0]?_0x5dd7e8['attrs'][0x0][_0x738e('0x5d')]:undefined)||null},{'name':_0x738e('0x6f'),'value':_0x5dd7e8['attrRefresh']||(_0x5dd7e8[_0x738e('0x5c')]&&_0x5dd7e8[_0x738e('0x5c')][0x1]?_0x5dd7e8[_0x738e('0x5c')][0x1][_0x738e('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x5b34c2){logger['error'](_0x738e('0x70'),JSON['stringify'](_0x5b34c2));return[];}}exports['addItem']=function(_0x396f73,_0xa89cdf,_0x2e5dda){if(_0x396f73[_0x738e('0x4c')]['id']){delete _0x396f73[_0x738e('0x4c')]['id'];}return db[_0x738e('0x2f')][_0x738e('0x52')]({'where':{'id':_0x396f73[_0x738e('0x49')]['id']}})[_0x738e('0x27')](handleEntityNotFound(_0xa89cdf,null))[_0x738e('0x27')](function(_0xbb9fff){if(_0xbb9fff){_0x396f73[_0x738e('0x4c')]['DashboardId']=_0xbb9fff['id'];_0x396f73[_0x738e('0x4c')][_0x738e('0x5c')]=widgetAttributes(_0x396f73['body']);return db['DashboardItem'][_0x738e('0x4b')](_0x396f73[_0x738e('0x4c')]);}})[_0x738e('0x27')](respondWithResult(_0xa89cdf,null))[_0x738e('0x48')](handleError(_0xa89cdf,null));};exports[_0x738e('0x71')]=function(_0x1a4219,_0x13a397,_0x46ec24){var _0x2c8239={};var _0x4c7246={};var _0x432c7f;var _0x28583f;return db[_0x738e('0x2f')][_0x738e('0x72')]({'where':{'id':_0x1a4219[_0x738e('0x49')]['id']}})[_0x738e('0x27')](handleEntityNotFound(_0x13a397,null))[_0x738e('0x27')](function(_0x2a0155){if(_0x2a0155){_0x432c7f=_0x2a0155;_0x4c7246[_0x738e('0x31')]=_[_0x738e('0x33')](db[_0x738e('0x73')]['rawAttributes']);_0x4c7246['query']=_[_0x738e('0x33')](_0x1a4219['query']);_0x4c7246[_0x738e('0x34')]=_[_0x738e('0x36')](_0x4c7246['model'],_0x4c7246['query']);_0x2c8239[_0x738e('0x35')]=_[_0x738e('0x36')](_0x4c7246[_0x738e('0x31')],qs[_0x738e('0x37')](_0x1a4219[_0x738e('0x32')][_0x738e('0x37')]));_0x2c8239[_0x738e('0x35')]=_0x2c8239[_0x738e('0x35')][_0x738e('0x4a')]?_0x2c8239[_0x738e('0x35')]:_0x4c7246[_0x738e('0x31')];_0x2c8239[_0x738e('0x3b')]=qs['sort'](_0x1a4219[_0x738e('0x32')][_0x738e('0x74')]);_0x2c8239[_0x738e('0x3d')]=qs[_0x738e('0x34')](_[_0x738e('0x75')](_0x1a4219[_0x738e('0x32')],_0x4c7246['filters']));if(_0x1a4219[_0x738e('0x32')][_0x738e('0x3c')]){_0x2c8239['where']=_[_0x738e('0x3e')](_0x2c8239[_0x738e('0x3d')],{'$or':_[_0x738e('0x3f')](_0x2c8239[_0x738e('0x35')],function(_0x9cc7a1){var _0x4cb40c={};_0x4cb40c[_0x9cc7a1]={'$like':'%'+_0x1a4219[_0x738e('0x32')][_0x738e('0x3c')]+'%'};return _0x4cb40c;})});}_0x2c8239=_[_0x738e('0x3e')]({},_0x2c8239,_0x1a4219['options']);return _0x432c7f['getItems'](_0x2c8239);}})['then'](function(_0x25e6c6){if(_0x25e6c6){_0x28583f=_0x25e6c6[_0x738e('0x4a')];if(!_0x1a4219[_0x738e('0x32')][_0x738e('0x38')]('nolimit')){_0x2c8239[_0x738e('0x3a')]=qs[_0x738e('0x3a')](_0x1a4219[_0x738e('0x32')]['limit']);_0x2c8239[_0x738e('0x22')]=qs[_0x738e('0x22')](_0x1a4219['query'][_0x738e('0x22')]);}return _0x432c7f['getItems'](_0x2c8239);}})[_0x738e('0x27')](function(_0x16aa77){if(_0x16aa77){return _0x16aa77?{'count':_0x28583f,'rows':_0x16aa77}:null;}})['then'](respondWithResult(_0x13a397,null))[_0x738e('0x48')](handleError(_0x13a397,null));}; \ No newline at end of file +var _0xa2a6=['../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','register','status','json','count','offset','set','apply','reject','save','update','then','destroy','CustomDashboards','UserProfileResource','end','sendStatus','name','send','index','Dashboard','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','map','type','key','include','catch','params','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','options','createdAt','updatedAt','body','UserProfileSection','userProfileId','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','desk.js','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs'];(function(_0x6401b6,_0x43e8e5){var _0x2b5aa3=function(_0x820448){while(--_0x820448){_0x6401b6['push'](_0x6401b6['shift']());}};_0x2b5aa3(++_0x43e8e5);}(_0xa2a6,0x1b2));var _0x6a2a=function(_0x2baadc,_0x98f882){_0x2baadc=_0x2baadc-0x0;var _0x363b32=_0xa2a6[_0x2baadc];return _0x363b32;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6a2a('0x0'));var rimraf=require(_0x6a2a('0x1'));var zipdir=require(_0x6a2a('0x2'));var jsonpatch=require(_0x6a2a('0x3'));var rp=require(_0x6a2a('0x4'));var moment=require(_0x6a2a('0x5'));var BPromise=require(_0x6a2a('0x6'));var Mustache=require(_0x6a2a('0x7'));var util=require(_0x6a2a('0x8'));var path=require('path');var sox=require(_0x6a2a('0x9'));var csv=require(_0x6a2a('0xa'));var ejs=require(_0x6a2a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6a2a('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6a2a('0xd'));var toCsv=require(_0x6a2a('0xa'));var querystring=require('querystring');var Papa=require(_0x6a2a('0xe'));var authService=require('../../components/auth/service');var hardwareService=require(_0x6a2a('0xf'));var Redis=require(_0x6a2a('0x10'));var qs=require(_0x6a2a('0x11'));var logger=require(_0x6a2a('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x6a2a('0x13'))['db'];config['redis']=_['defaults'](config[_0x6a2a('0x14')],{'host':_0x6a2a('0x15'),'port':0x18eb});var socket=require(_0x6a2a('0x16'))(new Redis(config[_0x6a2a('0x14')]));require('./dashboard.socket')[_0x6a2a('0x17')](socket);function respondWithStatusCode(_0x27a546,_0x35d107){_0x35d107=_0x35d107||0xcc;return function(_0x4a94a3){if(_0x4a94a3){return _0x27a546['sendStatus'](_0x35d107);}return _0x27a546['status'](_0x35d107)['end']();};}function respondWithResult(_0x5d1aca,_0x1d3106){_0x1d3106=_0x1d3106||0xc8;return function(_0x1e2e06){if(_0x1e2e06){return _0x5d1aca[_0x6a2a('0x18')](_0x1d3106)[_0x6a2a('0x19')](_0x1e2e06);}};}function respondWithFilteredResult(_0x337cc5,_0x2e2a28){return function(_0x374c17){if(_0x374c17){var _0x4480ec=_0x374c17[_0x6a2a('0x1a')],_0x262117=_0x2e2a28['offset'],_0x27dfa2=_0x2e2a28[_0x6a2a('0x1b')]+_0x2e2a28['limit'],_0x4d3c9a;if(_0x27dfa2>=_0x4480ec){_0x27dfa2=_0x4480ec;_0x4d3c9a=0xc8;}else{_0x4d3c9a=0xce;}_0x337cc5['status'](_0x4d3c9a);return _0x337cc5[_0x6a2a('0x1c')]('Content-Range',_0x262117+'-'+_0x27dfa2+'/'+_0x4480ec)[_0x6a2a('0x19')](_0x374c17);}return null;};}function patchUpdates(_0x1b3d52){return function(_0xe48b7d){try{jsonpatch[_0x6a2a('0x1d')](_0xe48b7d,_0x1b3d52,!![]);}catch(_0x3dea0a){return BPromise[_0x6a2a('0x1e')](_0x3dea0a);}return _0xe48b7d[_0x6a2a('0x1f')]();};}function saveUpdates(_0x5ddd04,_0x2fa1cf){return function(_0x558f1a){if(_0x558f1a){return _0x558f1a[_0x6a2a('0x20')](_0x5ddd04)[_0x6a2a('0x21')](function(_0x30ad83){return _0x30ad83;});}return null;};}function removeEntity(_0x39e77b,_0x32ddb4){return function(_0x4cd0e5){if(_0x4cd0e5){return _0x4cd0e5[_0x6a2a('0x22')]()[_0x6a2a('0x21')](function(){var _0x28e3b9=_0x4cd0e5['get']({'plain':!![]});var _0x45a13d=_0x6a2a('0x23');return db[_0x6a2a('0x24')][_0x6a2a('0x22')]({'where':{'type':_0x45a13d,'resourceId':_0x28e3b9['id']}})[_0x6a2a('0x21')](function(){return _0x4cd0e5;});})[_0x6a2a('0x21')](function(){_0x39e77b[_0x6a2a('0x18')](0xcc)[_0x6a2a('0x25')]();});}};}function handleEntityNotFound(_0x2b12eb,_0x35c46e){return function(_0x41e5f8){if(!_0x41e5f8){_0x2b12eb[_0x6a2a('0x26')](0x194);}return _0x41e5f8;};}function handleError(_0x69ecec,_0x5a476f){_0x5a476f=_0x5a476f||0x1f4;return function(_0x113182){logger['error'](_0x113182['stack']);if(_0x113182[_0x6a2a('0x27')]){delete _0x113182['name'];}_0x69ecec[_0x6a2a('0x18')](_0x5a476f)[_0x6a2a('0x28')](_0x113182);};}exports[_0x6a2a('0x29')]=function(_0x2d60bc,_0x7e573d){var _0x1a1761={},_0x36bc65={},_0x50bd19={'count':0x0,'rows':[]};var _0x20b095=db[_0x6a2a('0x2a')]['rawAttributes'];_0x36bc65[_0x6a2a('0x2b')]=_[_0x6a2a('0x2c')](_0x20b095);_0x36bc65['query']=_[_0x6a2a('0x2c')](_0x2d60bc['query']);_0x36bc65[_0x6a2a('0x2d')]=_[_0x6a2a('0x2e')](_0x36bc65[_0x6a2a('0x2b')],_0x36bc65[_0x6a2a('0x2f')]);_0x1a1761['attributes']=_[_0x6a2a('0x2e')](_0x36bc65[_0x6a2a('0x2b')],qs['fields'](_0x2d60bc[_0x6a2a('0x2f')][_0x6a2a('0x30')]));_0x1a1761[_0x6a2a('0x31')]=_0x1a1761[_0x6a2a('0x31')][_0x6a2a('0x32')]?_0x1a1761['attributes']:_0x36bc65[_0x6a2a('0x2b')];if(!_0x2d60bc[_0x6a2a('0x2f')][_0x6a2a('0x33')](_0x6a2a('0x34'))){_0x1a1761['limit']=qs[_0x6a2a('0x35')](_0x2d60bc[_0x6a2a('0x2f')][_0x6a2a('0x35')]);_0x1a1761[_0x6a2a('0x1b')]=qs[_0x6a2a('0x1b')](_0x2d60bc['query'][_0x6a2a('0x1b')]);}_0x1a1761[_0x6a2a('0x36')]=qs[_0x6a2a('0x37')](_0x2d60bc[_0x6a2a('0x2f')][_0x6a2a('0x37')]);_0x1a1761['where']=qs[_0x6a2a('0x2d')](_[_0x6a2a('0x38')](_0x2d60bc[_0x6a2a('0x2f')],_0x36bc65['filters']));if(_0x2d60bc[_0x6a2a('0x2f')][_0x6a2a('0x39')]){_0x1a1761[_0x6a2a('0x3a')]=_[_0x6a2a('0x3b')](_0x1a1761[_0x6a2a('0x3a')],{'$or':_[_0x6a2a('0x3c')](_0x20b095,function(_0x5a855f){if(_0x5a855f[_0x6a2a('0x3d')][_0x6a2a('0x3e')]!=='VIRTUAL'){var _0x348788={};_0x348788[_0x5a855f['field']]={'$like':'%'+_0x2d60bc[_0x6a2a('0x2f')][_0x6a2a('0x39')]+'%'};return _0x348788;}})});}_0x1a1761=_[_0x6a2a('0x3b')]({},_0x1a1761,_0x2d60bc['options']);var _0x3af464={'where':_0x1a1761['where']};return db[_0x6a2a('0x2a')][_0x6a2a('0x1a')](_0x3af464)[_0x6a2a('0x21')](function(_0x576c54){_0x50bd19[_0x6a2a('0x1a')]=_0x576c54;if(_0x2d60bc[_0x6a2a('0x2f')]['includeAll']){_0x1a1761[_0x6a2a('0x3f')]=[{'all':!![]}];}return db[_0x6a2a('0x2a')]['findAll'](_0x1a1761);})['then'](function(_0x4c07df){_0x50bd19['rows']=_0x4c07df;return _0x50bd19;})[_0x6a2a('0x21')](respondWithFilteredResult(_0x7e573d,_0x1a1761))[_0x6a2a('0x40')](handleError(_0x7e573d,null));};exports['show']=function(_0x1144a9,_0x3b0996){var _0xf47fac={'raw':![],'where':{'id':_0x1144a9[_0x6a2a('0x41')]['id']}},_0x19e99e={};_0x19e99e[_0x6a2a('0x2b')]=_[_0x6a2a('0x2c')](db[_0x6a2a('0x2a')]['rawAttributes']);_0x19e99e['query']=_[_0x6a2a('0x2c')](_0x1144a9[_0x6a2a('0x2f')]);_0x19e99e[_0x6a2a('0x2d')]=_[_0x6a2a('0x2e')](_0x19e99e[_0x6a2a('0x2b')],_0x19e99e[_0x6a2a('0x2f')]);_0xf47fac[_0x6a2a('0x31')]=_[_0x6a2a('0x2e')](_0x19e99e['model'],qs['fields'](_0x1144a9[_0x6a2a('0x2f')]['fields']));_0xf47fac['attributes']=_0xf47fac['attributes'][_0x6a2a('0x32')]?_0xf47fac[_0x6a2a('0x31')]:_0x19e99e[_0x6a2a('0x2b')];if(_0x1144a9[_0x6a2a('0x2f')][_0x6a2a('0x42')]){_0xf47fac[_0x6a2a('0x3f')]=[{'all':!![]}];}_0xf47fac=_[_0x6a2a('0x3b')]({},_0xf47fac,_0x1144a9['options']);return db[_0x6a2a('0x2a')][_0x6a2a('0x43')](_0xf47fac)[_0x6a2a('0x21')](handleEntityNotFound(_0x3b0996,null))['then'](respondWithResult(_0x3b0996,null))['catch'](handleError(_0x3b0996,null));};exports[_0x6a2a('0x44')]=function(_0x59cf0e,_0x51dde1){return db[_0x6a2a('0x2a')][_0x6a2a('0x44')](_0x59cf0e['body'],{})[_0x6a2a('0x21')](function(_0x237353){var _0x82e74f=_0x59cf0e[_0x6a2a('0x45')][_0x6a2a('0x46')]({'plain':!![]});if(!_0x82e74f)throw new Error(_0x6a2a('0x47'));if(_0x82e74f[_0x6a2a('0x48')]===_0x6a2a('0x45')){var _0x386ca5=_0x237353[_0x6a2a('0x46')]({'plain':!![]});var _0xd760ce=_0x6a2a('0x23');return db['UserProfileSection'][_0x6a2a('0x43')]({'where':{'name':_0xd760ce,'userProfileId':_0x82e74f['userProfileId']},'raw':!![]})[_0x6a2a('0x21')](function(_0x5badc6){if(_0x5badc6&&_0x5badc6['autoAssociation']===0x0){return db[_0x6a2a('0x24')][_0x6a2a('0x44')]({'name':_0x386ca5[_0x6a2a('0x27')],'resourceId':_0x386ca5['id'],'type':_0x5badc6[_0x6a2a('0x27')],'sectionId':_0x5badc6['id']},{})['then'](function(){return _0x237353;});}else{return _0x237353;}})[_0x6a2a('0x40')](function(_0x1f7184){logger[_0x6a2a('0x49')](_0x6a2a('0x4a'),_0x1f7184);throw _0x1f7184;});}return _0x237353;})[_0x6a2a('0x21')](respondWithResult(_0x51dde1,0xc9))[_0x6a2a('0x40')](handleError(_0x51dde1,null));};exports[_0x6a2a('0x4b')]=function(_0x41b266,_0x2576ed){var _0x5b87d5={'raw':![],'where':{'id':_0x41b266['params']['id']}},_0x24c9dc={};_0x24c9dc[_0x6a2a('0x2b')]=_[_0x6a2a('0x2c')](db[_0x6a2a('0x2a')][_0x6a2a('0x4c')]);_0x5b87d5['attributes']=_[_0x6a2a('0x2e')](_0x24c9dc['model'],qs[_0x6a2a('0x30')](_0x41b266['query'][_0x6a2a('0x30')]));_0x5b87d5[_0x6a2a('0x31')]=_0x5b87d5['attributes'][_0x6a2a('0x32')]?_0x5b87d5[_0x6a2a('0x31')]:_0x24c9dc['model'];if(_0x41b266['query'][_0x6a2a('0x42')]){_0x5b87d5[_0x6a2a('0x3f')]=[{'all':!![]}];}_0x5b87d5=_[_0x6a2a('0x3b')]({},_0x5b87d5,_0x41b266[_0x6a2a('0x4d')]);return db[_0x6a2a('0x2a')][_0x6a2a('0x43')](_0x5b87d5)['then'](handleEntityNotFound(_0x2576ed,null))[_0x6a2a('0x21')](function(_0x74019b){if(_0x74019b){var _0x3a342b=_0x74019b[_0x6a2a('0x46')]({'plain':!![]});_0x3a342b=qs['omit'](_0x3a342b,['id',_0x6a2a('0x4e'),_0x6a2a('0x4f')]);_0x41b266[_0x6a2a('0x50')]=_['omit'](_0x41b266[_0x6a2a('0x50')],['id',_0x6a2a('0x4e'),'updatedAt']);return db[_0x6a2a('0x2a')]['create'](_[_0x6a2a('0x3b')](_0x3a342b,_0x41b266['body']),{'include':_0x41b266[_0x6a2a('0x2f')][_0x6a2a('0x42')]?[{'all':!![]}]:undefined})[_0x6a2a('0x21')](function(_0x5315c8){var _0x5278ec=_0x41b266[_0x6a2a('0x45')][_0x6a2a('0x46')]({'plain':!![]});if(!_0x5278ec)throw new Error(_0x6a2a('0x47'));if(_0x5278ec[_0x6a2a('0x48')]===_0x6a2a('0x45')){var _0x3134da=_0x5315c8['get']({'plain':!![]});var _0x3e2579=_0x6a2a('0x23');return db[_0x6a2a('0x51')][_0x6a2a('0x43')]({'where':{'name':_0x3e2579,'userProfileId':_0x5278ec[_0x6a2a('0x52')]},'raw':!![]})[_0x6a2a('0x21')](function(_0xf0a015){if(_0xf0a015&&_0xf0a015['autoAssociation']===0x0){return db[_0x6a2a('0x24')][_0x6a2a('0x44')]({'name':_0x3134da['name'],'resourceId':_0x3134da['id'],'type':_0xf0a015[_0x6a2a('0x27')],'sectionId':_0xf0a015['id']},{})['then'](function(){return _0x5315c8;});}else{return _0x5315c8;}})[_0x6a2a('0x40')](function(_0x538cd8){logger['error'](_0x6a2a('0x4a'),_0x538cd8);throw _0x538cd8;});}return _0x5315c8;});}})[_0x6a2a('0x21')](respondWithResult(_0x2576ed,0xc9))[_0x6a2a('0x40')](handleError(_0x2576ed,null));};exports[_0x6a2a('0x20')]=function(_0x575e56,_0x119520){if(_0x575e56[_0x6a2a('0x50')]['id']){delete _0x575e56['body']['id'];}return db[_0x6a2a('0x2a')][_0x6a2a('0x43')]({'where':{'id':_0x575e56[_0x6a2a('0x41')]['id']}})[_0x6a2a('0x21')](handleEntityNotFound(_0x119520,null))[_0x6a2a('0x21')](saveUpdates(_0x575e56[_0x6a2a('0x50')],null))['then'](respondWithResult(_0x119520,null))['catch'](handleError(_0x119520,null));};exports[_0x6a2a('0x22')]=function(_0x2e1d94,_0x4f92e8){return db['Dashboard']['find']({'where':{'id':_0x2e1d94[_0x6a2a('0x41')]['id']}})['then'](handleEntityNotFound(_0x4f92e8,null))[_0x6a2a('0x21')](removeEntity(_0x4f92e8,null))[_0x6a2a('0x40')](handleError(_0x4f92e8,null));};function widgetAttributes(_0x44b9cb){try{switch(_0x44b9cb['type']){case _0x6a2a('0x53'):return[{'name':_0x6a2a('0x54'),'value':_0x44b9cb[_0x6a2a('0x54')]||(_0x44b9cb['attrs']&&_0x44b9cb[_0x6a2a('0x55')][0x0]?_0x44b9cb[_0x6a2a('0x55')][0x0][_0x6a2a('0x56')]:undefined)||_0x6a2a('0x57')}];case _0x6a2a('0x58'):return[{'name':_0x6a2a('0x59'),'value':_0x44b9cb[_0x6a2a('0x59')]||(_0x44b9cb[_0x6a2a('0x55')]&&_0x44b9cb[_0x6a2a('0x55')][0x0]?_0x44b9cb[_0x6a2a('0x55')][0x0][_0x6a2a('0x56')]:undefined)||''}];case'clock':return[{'name':_0x6a2a('0x5a'),'value':_0x44b9cb[_0x6a2a('0x5a')]||(_0x44b9cb[_0x6a2a('0x55')]&&_0x44b9cb[_0x6a2a('0x55')][0x0]?_0x44b9cb[_0x6a2a('0x55')][0x0][_0x6a2a('0x56')]:undefined)||_0x6a2a('0x5b')},{'name':_0x6a2a('0x5c'),'value':_0x44b9cb[_0x6a2a('0x5c')]||(_0x44b9cb[_0x6a2a('0x55')]&&_0x44b9cb[_0x6a2a('0x55')][0x1]?_0x44b9cb[_0x6a2a('0x55')][0x1][_0x6a2a('0x56')]:undefined)||_0x6a2a('0x5d')},{'name':'attrFontSize','value':_0x44b9cb[_0x6a2a('0x5e')]||(_0x44b9cb[_0x6a2a('0x55')]&&_0x44b9cb['attrs'][0x2]?_0x44b9cb[_0x6a2a('0x55')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x6a2a('0x5f'),'value':_0x44b9cb['attrMetric']||(_0x44b9cb[_0x6a2a('0x55')]&&_0x44b9cb[_0x6a2a('0x55')][0x0]?_0x44b9cb[_0x6a2a('0x55')][0x0][_0x6a2a('0x56')]:undefined)||_0x6a2a('0x60')},{'name':_0x6a2a('0x61'),'value':_0x44b9cb[_0x6a2a('0x61')]||(_0x44b9cb[_0x6a2a('0x55')]&&_0x44b9cb[_0x6a2a('0x55')][0x1]?_0x44b9cb[_0x6a2a('0x55')][0x1][_0x6a2a('0x56')]:undefined)||[]},{'name':_0x6a2a('0x5e'),'value':_0x44b9cb['attrFontSize']||(_0x44b9cb[_0x6a2a('0x55')]&&_0x44b9cb[_0x6a2a('0x55')][0x2]?_0x44b9cb['attrs'][0x2][_0x6a2a('0x56')]:undefined)||0x14}];case _0x6a2a('0x62'):case'pie-chart':return[{'name':'attrSerie1','value':_0x44b9cb[_0x6a2a('0x63')]||(_0x44b9cb[_0x6a2a('0x55')]&&_0x44b9cb[_0x6a2a('0x55')][0x0]?_0x44b9cb[_0x6a2a('0x55')][0x0]['value']:undefined)||_0x6a2a('0x60')},{'name':'attrSerie2','value':_0x44b9cb[_0x6a2a('0x64')]||(_0x44b9cb[_0x6a2a('0x55')]&&_0x44b9cb[_0x6a2a('0x55')][0x1]?_0x44b9cb[_0x6a2a('0x55')][0x1][_0x6a2a('0x56')]:undefined)||null},{'name':_0x6a2a('0x65'),'value':_0x44b9cb['attrSerie3']||(_0x44b9cb['attrs']&&_0x44b9cb[_0x6a2a('0x55')][0x2]?_0x44b9cb['attrs'][0x2][_0x6a2a('0x56')]:undefined)||null},{'name':_0x6a2a('0x61'),'value':_0x44b9cb[_0x6a2a('0x61')]||(_0x44b9cb[_0x6a2a('0x55')]&&_0x44b9cb['attrs'][0x3]?_0x44b9cb['attrs'][0x3]['value']:undefined)||[]}];case _0x6a2a('0x66'):return[{'name':_0x6a2a('0x67'),'type':_0x44b9cb[_0x6a2a('0x68')]||(_0x44b9cb['attrs']&&_0x44b9cb[_0x6a2a('0x55')][0x0]?_0x44b9cb['attrs'][0x0][_0x6a2a('0x3d')]:undefined)||null,'value':_0x44b9cb[_0x6a2a('0x67')]||(_0x44b9cb['attrs']&&_0x44b9cb[_0x6a2a('0x55')][0x0]?_0x44b9cb[_0x6a2a('0x55')][0x0][_0x6a2a('0x56')]:undefined)||null},{'name':_0x6a2a('0x69'),'value':_0x44b9cb['attrRefresh']||(_0x44b9cb[_0x6a2a('0x55')]&&_0x44b9cb[_0x6a2a('0x55')][0x1]?_0x44b9cb['attrs'][0x1][_0x6a2a('0x56')]:undefined)||0x0}];default:return[];}}catch(_0x1672a3){logger['error'](_0x6a2a('0x6a'),JSON[_0x6a2a('0x6b')](_0x1672a3));return[];}}exports[_0x6a2a('0x6c')]=function(_0x2fe62a,_0x53c78a,_0x19a3b1){if(_0x2fe62a[_0x6a2a('0x50')]['id']){delete _0x2fe62a[_0x6a2a('0x50')]['id'];}return db[_0x6a2a('0x2a')][_0x6a2a('0x43')]({'where':{'id':_0x2fe62a[_0x6a2a('0x41')]['id']}})[_0x6a2a('0x21')](handleEntityNotFound(_0x53c78a,null))[_0x6a2a('0x21')](function(_0x2c33d8){if(_0x2c33d8){_0x2fe62a[_0x6a2a('0x50')][_0x6a2a('0x6d')]=_0x2c33d8['id'];_0x2fe62a['body'][_0x6a2a('0x55')]=widgetAttributes(_0x2fe62a[_0x6a2a('0x50')]);return db[_0x6a2a('0x6e')][_0x6a2a('0x44')](_0x2fe62a[_0x6a2a('0x50')]);}})[_0x6a2a('0x21')](respondWithResult(_0x53c78a,null))[_0x6a2a('0x40')](handleError(_0x53c78a,null));};exports[_0x6a2a('0x6f')]=function(_0x530981,_0x790968,_0x2df53c){var _0x5c4868={};var _0x2734d1={};var _0x155d10;var _0x2f3510;return db[_0x6a2a('0x2a')][_0x6a2a('0x70')]({'where':{'id':_0x530981[_0x6a2a('0x41')]['id']}})['then'](handleEntityNotFound(_0x790968,null))[_0x6a2a('0x21')](function(_0x4631e6){if(_0x4631e6){_0x155d10=_0x4631e6;_0x2734d1[_0x6a2a('0x2b')]=_[_0x6a2a('0x2c')](db[_0x6a2a('0x6e')][_0x6a2a('0x4c')]);_0x2734d1[_0x6a2a('0x2f')]=_[_0x6a2a('0x2c')](_0x530981[_0x6a2a('0x2f')]);_0x2734d1[_0x6a2a('0x2d')]=_['intersection'](_0x2734d1[_0x6a2a('0x2b')],_0x2734d1[_0x6a2a('0x2f')]);_0x5c4868['attributes']=_[_0x6a2a('0x2e')](_0x2734d1[_0x6a2a('0x2b')],qs[_0x6a2a('0x30')](_0x530981[_0x6a2a('0x2f')][_0x6a2a('0x30')]));_0x5c4868[_0x6a2a('0x31')]=_0x5c4868['attributes']['length']?_0x5c4868[_0x6a2a('0x31')]:_0x2734d1['model'];_0x5c4868[_0x6a2a('0x36')]=qs[_0x6a2a('0x37')](_0x530981[_0x6a2a('0x2f')][_0x6a2a('0x37')]);_0x5c4868[_0x6a2a('0x3a')]=qs[_0x6a2a('0x2d')](_[_0x6a2a('0x38')](_0x530981[_0x6a2a('0x2f')],_0x2734d1['filters']));if(_0x530981['query'][_0x6a2a('0x39')]){_0x5c4868['where']=_[_0x6a2a('0x3b')](_0x5c4868[_0x6a2a('0x3a')],{'$or':_[_0x6a2a('0x3c')](_0x5c4868[_0x6a2a('0x31')],function(_0x2d9bd6){var _0xcba4ec={};_0xcba4ec[_0x2d9bd6]={'$like':'%'+_0x530981[_0x6a2a('0x2f')]['filter']+'%'};return _0xcba4ec;})});}_0x5c4868=_[_0x6a2a('0x3b')]({},_0x5c4868,_0x530981['options']);return _0x155d10[_0x6a2a('0x6f')](_0x5c4868);}})[_0x6a2a('0x21')](function(_0x306f58){if(_0x306f58){_0x2f3510=_0x306f58['length'];if(!_0x530981[_0x6a2a('0x2f')][_0x6a2a('0x33')]('nolimit')){_0x5c4868[_0x6a2a('0x35')]=qs[_0x6a2a('0x35')](_0x530981['query'][_0x6a2a('0x35')]);_0x5c4868['offset']=qs['offset'](_0x530981['query'][_0x6a2a('0x1b')]);}return _0x155d10['getItems'](_0x5c4868);}})[_0x6a2a('0x21')](function(_0x3a4530){if(_0x3a4530){return _0x3a4530?{'count':_0x2f3510,'rows':_0x3a4530}:null;}})[_0x6a2a('0x21')](respondWithResult(_0x790968,null))[_0x6a2a('0x40')](handleError(_0x790968,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 93bcf0e..7cb1337 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 _0xae95=['exports','../../mysqldb','Dashboard','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xae95,0xcc));var _0x5ae9=function(_0xfe1555,_0x539c59){_0xfe1555=_0xfe1555-0x0;var _0x225ea9=_0xae95[_0xfe1555];return _0x225ea9;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x5ae9('0x0'))['db'][_0x5ae9('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5ae9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5ae9('0x3')};function emitEvent(_0x56abee){return function(_0x252749,_0x59f7f9,_0x3ff449){DashboardEvents[_0x5ae9('0x4')](_0x56abee+':'+_0x252749['id'],_0x252749);DashboardEvents[_0x5ae9('0x4')](_0x56abee,_0x252749);_0x3ff449(null);};}for(var e in events){if(events[_0x5ae9('0x5')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x5ae9('0x6')]=DashboardEvents; \ No newline at end of file +var _0x6057=['emit','hasOwnProperty','events','../../mysqldb','update','remove'];(function(_0x19e156,_0x212f60){var _0x176479=function(_0x4008b5){while(--_0x4008b5){_0x19e156['push'](_0x19e156['shift']());}};_0x176479(++_0x212f60);}(_0x6057,0x8c));var _0x7605=function(_0x272d90,_0x5e70ff){_0x272d90=_0x272d90-0x0;var _0x2bf4a2=_0x6057[_0x272d90];return _0x2bf4a2;};'use strict';var EventEmitter=require(_0x7605('0x0'));var Dashboard=require(_0x7605('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7605('0x2'),'afterDestroy':_0x7605('0x3')};function emitEvent(_0x75d1d9){return function(_0x1425ff,_0x222bc7,_0x406c25){DashboardEvents[_0x7605('0x4')](_0x75d1d9+':'+_0x1425ff['id'],_0x1425ff);DashboardEvents['emit'](_0x75d1d9,_0x1425ff);_0x406c25(null);};}for(var e in events){if(events[_0x7605('0x5')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 22217c8..e75868a 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 _0x50e5=['bluebird','request-promise','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','api','moment'];(function(_0x3104f0,_0x4239da){var _0x4d4c80=function(_0x41552b){while(--_0x41552b){_0x3104f0['push'](_0x3104f0['shift']());}};_0x4d4c80(++_0x4239da);}(_0x50e5,0xb7));var _0x550e=function(_0x48f559,_0x5318bd){_0x48f559=_0x48f559-0x0;var _0x40a293=_0x50e5[_0x48f559];return _0x40a293;};'use strict';var _=require(_0x550e('0x0'));var util=require(_0x550e('0x1'));var logger=require('../../config/logger')(_0x550e('0x2'));var moment=require(_0x550e('0x3'));var BPromise=require(_0x550e('0x4'));var rp=require(_0x550e('0x5'));var attributes=require(_0x550e('0x6'));module[_0x550e('0x7')]=function(_0x78e6c5,_0xafede5){return _0x78e6c5[_0x550e('0x8')](_0x550e('0x9'),attributes,{'tableName':_0x550e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79a3=['Dashboard','dashboards','lodash','../../config/logger','api','bluebird','define'];(function(_0x4a6ff1,_0x2a00b9){var _0x5eba7c=function(_0xfc3b6c){while(--_0xfc3b6c){_0x4a6ff1['push'](_0x4a6ff1['shift']());}};_0x5eba7c(++_0x2a00b9);}(_0x79a3,0x80));var _0x379a=function(_0x4b2651,_0x3aca34){_0x4b2651=_0x4b2651-0x0;var _0x5a89af=_0x79a3[_0x4b2651];return _0x5a89af;};'use strict';var _=require(_0x379a('0x0'));var util=require('util');var logger=require(_0x379a('0x1'))(_0x379a('0x2'));var moment=require('moment');var BPromise=require(_0x379a('0x3'));var rp=require('request-promise');var attributes=require('./dashboard.attributes');module['exports']=function(_0x187d55,_0x24dda6){return _0x187d55[_0x379a('0x4')](_0x379a('0x5'),attributes,{'tableName':_0x379a('0x6'),'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 295c060..80a885a 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 _0x3572=['catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x2854dc,_0x492c19){var _0x23510f=function(_0x12bf62){while(--_0x12bf62){_0x2854dc['push'](_0x2854dc['shift']());}};_0x23510f(++_0x492c19);}(_0x3572,0x1cc));var _0x2357=function(_0x8b1bc7,_0x54bf20){_0x8b1bc7=_0x8b1bc7-0x0;var _0xea0fd8=_0x3572[_0x8b1bc7];return _0xea0fd8;};'use strict';var _=require('lodash');var util=require(_0x2357('0x0'));var moment=require(_0x2357('0x1'));var BPromise=require(_0x2357('0x2'));var rs=require(_0x2357('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2357('0x4'));var logger=require(_0x2357('0x5'))(_0x2357('0x6'));var config=require(_0x2357('0x7'));var jayson=require(_0x2357('0x8'));var client=jayson[_0x2357('0x9')][_0x2357('0xa')]({'port':0x232a});config['redis']=_[_0x2357('0xb')](config[_0x2357('0xc')],{'host':_0x2357('0xd'),'port':0x18eb});var socket=require(_0x2357('0xe'))(new Redis(config['redis']));require(_0x2357('0xf'))[_0x2357('0x10')](socket);function respondWithRpcPromise(_0x12d6ff,_0x90f9ab,_0x40fa3e){return new BPromise(function(_0x508a0a,_0x396083){return client['request'](_0x12d6ff,_0x40fa3e)[_0x2357('0x11')](function(_0x599a6e){logger[_0x2357('0x12')](_0x2357('0x13'),_0x90f9ab,'request\x20sent');logger[_0x2357('0x14')](_0x2357('0x15'),_0x90f9ab,_0x2357('0x16'),JSON[_0x2357('0x17')](_0x599a6e));if(_0x599a6e[_0x2357('0x18')]){if(_0x599a6e[_0x2357('0x18')]['code']===0x1f4){logger[_0x2357('0x18')](_0x2357('0x13'),_0x90f9ab,_0x599a6e[_0x2357('0x18')][_0x2357('0x19')]);return _0x396083(_0x599a6e[_0x2357('0x18')]['message']);}logger[_0x2357('0x18')](_0x2357('0x13'),_0x90f9ab,_0x599a6e[_0x2357('0x18')][_0x2357('0x19')]);return _0x508a0a(_0x599a6e[_0x2357('0x18')][_0x2357('0x19')]);}else{logger[_0x2357('0x12')](_0x2357('0x13'),_0x90f9ab,'request\x20sent');_0x508a0a(_0x599a6e['result']['message']);}})[_0x2357('0x1a')](function(_0x5956c0){logger[_0x2357('0x18')](_0x2357('0x13'),_0x90f9ab,_0x5956c0);_0x396083(_0x5956c0);});});} \ No newline at end of file +var _0x96a4=['code','Dashboard,\x20%s,\x20%s','message','info','result','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x499009,_0x76d2c){var _0x413967=function(_0x2ec265){while(--_0x2ec265){_0x499009['push'](_0x499009['shift']());}};_0x413967(++_0x76d2c);}(_0x96a4,0xd4));var _0x496a=function(_0x20b8c2,_0x1f10e9){_0x20b8c2=_0x20b8c2-0x0;var _0x5d337e=_0x96a4[_0x20b8c2];return _0x5d337e;};'use strict';var _=require(_0x496a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x496a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x496a('0x2'))['db'];var utils=require(_0x496a('0x3'));var logger=require(_0x496a('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x496a('0x5'));var client=jayson[_0x496a('0x6')][_0x496a('0x7')]({'port':0x232a});config[_0x496a('0x8')]=_[_0x496a('0x9')](config[_0x496a('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x496a('0xa'))(new Redis(config[_0x496a('0x8')]));require(_0x496a('0xb'))[_0x496a('0xc')](socket);function respondWithRpcPromise(_0xe1e64a,_0x452189,_0x4acf1d){return new BPromise(function(_0x42b8c8,_0x58965b){return client['request'](_0xe1e64a,_0x4acf1d)['then'](function(_0x344876){logger['info']('Dashboard,\x20%s,\x20%s',_0x452189,_0x496a('0xd'));logger[_0x496a('0xe')](_0x496a('0xf'),_0x452189,'request\x20sent',JSON[_0x496a('0x10')](_0x344876));if(_0x344876[_0x496a('0x11')]){if(_0x344876[_0x496a('0x11')][_0x496a('0x12')]===0x1f4){logger[_0x496a('0x11')](_0x496a('0x13'),_0x452189,_0x344876['error']['message']);return _0x58965b(_0x344876[_0x496a('0x11')][_0x496a('0x14')]);}logger[_0x496a('0x11')](_0x496a('0x13'),_0x452189,_0x344876[_0x496a('0x11')]['message']);return _0x42b8c8(_0x344876['error']['message']);}else{logger[_0x496a('0x15')]('Dashboard,\x20%s,\x20%s',_0x452189,_0x496a('0xd'));_0x42b8c8(_0x344876[_0x496a('0x16')][_0x496a('0x14')]);}})['catch'](function(_0x339684){logger['error'](_0x496a('0x13'),_0x452189,_0x339684);_0x58965b(_0x339684);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 5ed93da..49cc768 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 _0xc5dd=['save','update','emit','removeListener','register','length','./dashboard.events'];(function(_0x40c402,_0x42ee7d){var _0x4e7680=function(_0x52b150){while(--_0x52b150){_0x40c402['push'](_0x40c402['shift']());}};_0x4e7680(++_0x42ee7d);}(_0xc5dd,0x117));var _0xdc5d=function(_0x531b7f,_0x4606d7){_0x531b7f=_0x531b7f-0x0;var _0x52c687=_0xc5dd[_0x531b7f];return _0x52c687;};'use strict';var DashboardEvents=require(_0xdc5d('0x0'));var events=[_0xdc5d('0x1'),'remove',_0xdc5d('0x2')];function createListener(_0x146499,_0x1020b9){return function(_0x447809){_0x1020b9[_0xdc5d('0x3')](_0x146499,_0x447809);};}function removeListener(_0x3ed902,_0x441d57){return function(){DashboardEvents[_0xdc5d('0x4')](_0x3ed902,_0x441d57);};}exports[_0xdc5d('0x5')]=function(_0x41f85f){for(var _0x53c43=0x0,_0x32549d=events[_0xdc5d('0x6')];_0x53c43<_0x32549d;_0x53c43++){var _0x48d886=events[_0x53c43];var _0x149363=createListener('dashboard:'+_0x48d886,_0x41f85f);DashboardEvents['on'](_0x48d886,_0x149363);}}; \ No newline at end of file +var _0x1568=['removeListener','register','length','dashboard:','remove','update','emit'];(function(_0x16fa26,_0x5eee28){var _0x2f2253=function(_0x5ce619){while(--_0x5ce619){_0x16fa26['push'](_0x16fa26['shift']());}};_0x2f2253(++_0x5eee28);}(_0x1568,0x123));var _0x8156=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1568[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0x8156('0x0'),_0x8156('0x1')];function createListener(_0x2e89ce,_0x1fb0d8){return function(_0x26915c){_0x1fb0d8[_0x8156('0x2')](_0x2e89ce,_0x26915c);};}function removeListener(_0x147f90,_0x42ef11){return function(){DashboardEvents[_0x8156('0x3')](_0x147f90,_0x42ef11);};}exports[_0x8156('0x4')]=function(_0x16eba9){for(var _0x3c10a9=0x0,_0x415dac=events[_0x8156('0x5')];_0x3c10a9<_0x415dac;_0x3c10a9++){var _0x1577b5=events[_0x3c10a9];var _0x3208f9=createListener(_0x8156('0x6')+_0x1577b5,_0x16eba9);DashboardEvents['on'](_0x1577b5,_0x3208f9);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 6a24dad..fd2a73f 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 _0xfd62=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','/:id','isAuthenticated','show','get','/:id/items','getItems','post','create','addItem','put','update','delete','destroy','exports'];(function(_0x4d11cc,_0x3f7ecb){var _0xfe5656=function(_0x5d5bba){while(--_0x5d5bba){_0x4d11cc['push'](_0x4d11cc['shift']());}};_0xfe5656(++_0x3f7ecb);}(_0xfd62,0x1e3));var _0x2fd6=function(_0x572995,_0x294636){_0x572995=_0x572995-0x0;var _0x200691=_0xfd62[_0x572995];return _0x200691;};'use strict';var multer=require('multer');var util=require(_0x2fd6('0x0'));var path=require(_0x2fd6('0x1'));var timeout=require(_0x2fd6('0x2'));var express=require(_0x2fd6('0x3'));var router=express[_0x2fd6('0x4')]();var auth=require(_0x2fd6('0x5'));var interaction=require(_0x2fd6('0x6'));var config=require(_0x2fd6('0x7'));var controller=require(_0x2fd6('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2fd6('0x9'),auth[_0x2fd6('0xa')](),controller[_0x2fd6('0xb')]);router[_0x2fd6('0xc')](_0x2fd6('0xd'),auth[_0x2fd6('0xa')](),controller[_0x2fd6('0xe')]);router[_0x2fd6('0xf')]('/',auth['isAuthenticated'](),controller[_0x2fd6('0x10')]);router[_0x2fd6('0xf')]('/:id/clone',auth[_0x2fd6('0xa')](),controller['clone']);router[_0x2fd6('0xf')](_0x2fd6('0xd'),auth[_0x2fd6('0xa')](),controller[_0x2fd6('0x11')]);router[_0x2fd6('0x12')]('/:id',auth[_0x2fd6('0xa')](),controller[_0x2fd6('0x13')]);router[_0x2fd6('0x14')](_0x2fd6('0x9'),auth['isAuthenticated'](),controller[_0x2fd6('0x15')]);module[_0x2fd6('0x16')]=router; \ No newline at end of file +var _0x73d6=['index','getItems','post','isAuthenticated','clone','addItem','put','/:id','update','delete','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x73d6,0x13c));var _0x673d=function(_0x102037,_0x38ebce){_0x102037=_0x102037-0x0;var _0x56eaf7=_0x73d6[_0x102037];return _0x56eaf7;};'use strict';var multer=require(_0x673d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x673d('0x1'));var express=require('express');var router=express[_0x673d('0x2')]();var auth=require(_0x673d('0x3'));var interaction=require(_0x673d('0x4'));var config=require('../../config/environment');var controller=require(_0x673d('0x5'));router[_0x673d('0x6')]('/',auth['isAuthenticated'](),controller[_0x673d('0x7')]);router[_0x673d('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x673d('0x6')]('/:id/items',auth['isAuthenticated'](),controller[_0x673d('0x8')]);router[_0x673d('0x9')]('/',auth[_0x673d('0xa')](),controller['create']);router[_0x673d('0x9')]('/:id/clone',auth[_0x673d('0xa')](),controller[_0x673d('0xb')]);router['post']('/:id/items',auth[_0x673d('0xa')](),controller[_0x673d('0xc')]);router[_0x673d('0xd')](_0x673d('0xe'),auth['isAuthenticated'](),controller[_0x673d('0xf')]);router[_0x673d('0x10')]('/:id',auth[_0x673d('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index d7e4bad..84d806f 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 _0x1fbb=['INTEGER','#ffffff','sequelize','squel','lodash','exports','STRING','TEXT','parse','attrs','setDataValue','stringify'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x1fbb,0x86));var _0xb1fb=function(_0x191895,_0x2accdd){_0x191895=_0x191895-0x0;var _0x1195a7=_0x1fbb[_0x191895];return _0x1195a7;};'use strict';var Sequelize=require(_0xb1fb('0x0'));var squel=require(_0xb1fb('0x1'));var _=require(_0xb1fb('0x2'));module[_0xb1fb('0x3')]={'title':{'type':Sequelize[_0xb1fb('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xb1fb('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb1fb('0x5')]('long'),'get':function(){try{return JSON[_0xb1fb('0x6')](this['getDataValue'](_0xb1fb('0x7')));}catch(_0x9d2150){return[];}},'set':function(_0x1353a2){try{this[_0xb1fb('0x8')](_0xb1fb('0x7'),JSON[_0xb1fb('0x9')](_0x1353a2));}catch(_0x1f0cad){this[_0xb1fb('0x8')](_0xb1fb('0x7'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xb1fb('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb1fb('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xb1fb('0xa')]},'col':{'type':Sequelize[_0xb1fb('0xa')]},'background':{'type':Sequelize[_0xb1fb('0x4')],'allowNull':![],'defaultValue':_0xb1fb('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x93a2=['STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#2196f3','sequelize','squel','lodash','exports'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x93a2,0x141));var _0x293a=function(_0x18f64a,_0x1c8248){_0x18f64a=_0x18f64a-0x0;var _0x44687f=_0x93a2[_0x18f64a];return _0x44687f;};'use strict';var Sequelize=require(_0x293a('0x0'));var squel=require(_0x293a('0x1'));var _=require(_0x293a('0x2'));module[_0x293a('0x3')]={'title':{'type':Sequelize[_0x293a('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x293a('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x293a('0x5')),'get':function(){try{return JSON[_0x293a('0x6')](this[_0x293a('0x7')](_0x293a('0x8')));}catch(_0x522dec){return[];}},'set':function(_0x5d5603){try{this['setDataValue'](_0x293a('0x8'),JSON['stringify'](_0x5d5603));}catch(_0x36672d){this[_0x293a('0x9')]('attrs',JSON[_0x293a('0xa')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x293a('0xb')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x293a('0x4')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x293a('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x293a('0x4')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 41493e9..edbeb96 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 _0x1636=['widgetAttributes:\x20%s','create','body','html-pdf','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./dashboardItem.socket','register','status','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','end','sendStatus','stack','name','show','model','keys','rawAttributes','query','intersection','attributes','fields','length','include','merge','options','DashboardItem','catch','find','params','iframe','attrs','https://','custom','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','type','attrRefresh','error'];(function(_0x3a89ab,_0x3ed5a2){var _0x92fe7b=function(_0x42f05b){while(--_0x42f05b){_0x3a89ab['push'](_0x3a89ab['shift']());}};_0x92fe7b(++_0x3ed5a2);}(_0x1636,0x1b1));var _0x6163=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1636[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require(_0x6163('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6163('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6163('0x2'));var rp=require(_0x6163('0x3'));var moment=require(_0x6163('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6163('0x5'));var path=require(_0x6163('0x6'));var sox=require(_0x6163('0x7'));var csv=require('to-csv');var ejs=require(_0x6163('0x8'));var fs=require('fs');var _=require(_0x6163('0x9'));var squel=require(_0x6163('0xa'));var crypto=require(_0x6163('0xb'));var jsforce=require(_0x6163('0xc'));var deskjs=require(_0x6163('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6163('0xe'));var Papa=require(_0x6163('0xf'));var authService=require(_0x6163('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x6163('0x11'));var qs=require(_0x6163('0x12'));var logger=require(_0x6163('0x13'))('api');var utils=require(_0x6163('0x14'));var config=require('../../config/environment');var db=require(_0x6163('0x15'))['db'];config['redis']=_[_0x6163('0x16')](config['redis'],{'host':_0x6163('0x17'),'port':0x18eb});var socket=require(_0x6163('0x18'))(new Redis(config[_0x6163('0x19')]));require(_0x6163('0x1a'))[_0x6163('0x1b')](socket);function respondWithStatusCode(_0x4c1db1,_0x3fc78c){_0x3fc78c=_0x3fc78c||0xcc;return function(_0x1263b0){if(_0x1263b0){return _0x4c1db1['sendStatus'](_0x3fc78c);}return _0x4c1db1[_0x6163('0x1c')](_0x3fc78c)['end']();};}function respondWithResult(_0x455daf,_0x1b1abf){_0x1b1abf=_0x1b1abf||0xc8;return function(_0x2f773d){if(_0x2f773d){return _0x455daf[_0x6163('0x1c')](_0x1b1abf)[_0x6163('0x1d')](_0x2f773d);}};}function respondWithFilteredResult(_0x250e6e,_0x509fb0){return function(_0x14ded4){if(_0x14ded4){var _0x104521=_0x14ded4[_0x6163('0x1e')],_0x2500e0=_0x509fb0['offset'],_0x47d9b5=_0x509fb0[_0x6163('0x1f')]+_0x509fb0[_0x6163('0x20')],_0x1dffc4;if(_0x47d9b5>=_0x104521){_0x47d9b5=_0x104521;_0x1dffc4=0xc8;}else{_0x1dffc4=0xce;}_0x250e6e[_0x6163('0x1c')](_0x1dffc4);return _0x250e6e['set'](_0x6163('0x21'),_0x2500e0+'-'+_0x47d9b5+'/'+_0x104521)[_0x6163('0x1d')](_0x14ded4);}return null;};}function patchUpdates(_0x36b795){return function(_0x297d4c){try{jsonpatch[_0x6163('0x22')](_0x297d4c,_0x36b795,!![]);}catch(_0x3acbb0){return BPromise['reject'](_0x3acbb0);}return _0x297d4c[_0x6163('0x23')]();};}function saveUpdates(_0x232d4f,_0x2c6ae2){return function(_0x5afde3){if(_0x5afde3){return _0x5afde3[_0x6163('0x24')](_0x232d4f)[_0x6163('0x25')](function(_0x2c93df){return _0x2c93df;});}return null;};}function removeEntity(_0x3b7122,_0x419f80){return function(_0xe7883e){if(_0xe7883e){return _0xe7883e[_0x6163('0x26')]()['then'](function(){_0x3b7122['status'](0xcc)[_0x6163('0x27')]();});}};}function handleEntityNotFound(_0x42c6d4,_0x426dd1){return function(_0x37bfa7){if(!_0x37bfa7){_0x42c6d4[_0x6163('0x28')](0x194);}return _0x37bfa7;};}function handleError(_0x55bae7,_0x5eeb09){_0x5eeb09=_0x5eeb09||0x1f4;return function(_0x218137){logger['error'](_0x218137[_0x6163('0x29')]);if(_0x218137[_0x6163('0x2a')]){delete _0x218137[_0x6163('0x2a')];}_0x55bae7[_0x6163('0x1c')](_0x5eeb09)['send'](_0x218137);};}exports[_0x6163('0x2b')]=function(_0x41511a,_0x48168d){var _0x1d648c={'raw':![],'where':{'id':_0x41511a['params']['id']}},_0x1021d0={};_0x1021d0[_0x6163('0x2c')]=_[_0x6163('0x2d')](db['DashboardItem'][_0x6163('0x2e')]);_0x1021d0[_0x6163('0x2f')]=_['keys'](_0x41511a[_0x6163('0x2f')]);_0x1021d0['filters']=_[_0x6163('0x30')](_0x1021d0[_0x6163('0x2c')],_0x1021d0[_0x6163('0x2f')]);_0x1d648c[_0x6163('0x31')]=_[_0x6163('0x30')](_0x1021d0[_0x6163('0x2c')],qs[_0x6163('0x32')](_0x41511a[_0x6163('0x2f')][_0x6163('0x32')]));_0x1d648c[_0x6163('0x31')]=_0x1d648c['attributes'][_0x6163('0x33')]?_0x1d648c[_0x6163('0x31')]:_0x1021d0[_0x6163('0x2c')];if(_0x41511a[_0x6163('0x2f')]['includeAll']){_0x1d648c[_0x6163('0x34')]=[{'all':!![]}];}_0x1d648c=_[_0x6163('0x35')]({},_0x1d648c,_0x41511a[_0x6163('0x36')]);return db[_0x6163('0x37')]['find'](_0x1d648c)[_0x6163('0x25')](handleEntityNotFound(_0x48168d,null))[_0x6163('0x25')](respondWithResult(_0x48168d,null))[_0x6163('0x38')](handleError(_0x48168d,null));};exports[_0x6163('0x26')]=function(_0x2a8359,_0x14b5f2){return db[_0x6163('0x37')][_0x6163('0x39')]({'where':{'id':_0x2a8359[_0x6163('0x3a')]['id']}})['then'](handleEntityNotFound(_0x14b5f2,null))[_0x6163('0x25')](removeEntity(_0x14b5f2,null))['catch'](handleError(_0x14b5f2,null));};function widgetAttributes(_0x3f95d0){try{switch(_0x3f95d0['type']){case _0x6163('0x3b'):return[{'name':'attrUrl','value':_0x3f95d0['attrUrl']||(_0x3f95d0[_0x6163('0x3c')]&&_0x3f95d0[_0x6163('0x3c')][0x0]?_0x3f95d0[_0x6163('0x3c')][0x0]['value']:undefined)||_0x6163('0x3d')}];case _0x6163('0x3e'):return[{'name':_0x6163('0x3f'),'value':_0x3f95d0[_0x6163('0x3f')]||(_0x3f95d0[_0x6163('0x3c')]&&_0x3f95d0[_0x6163('0x3c')][0x0]?_0x3f95d0[_0x6163('0x3c')][0x0][_0x6163('0x40')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x3f95d0[_0x6163('0x41')]||(_0x3f95d0[_0x6163('0x3c')]&&_0x3f95d0[_0x6163('0x3c')][0x0]?_0x3f95d0[_0x6163('0x3c')][0x0][_0x6163('0x40')]:undefined)||_0x6163('0x42')},{'name':'attrTimezone','value':_0x3f95d0[_0x6163('0x43')]||(_0x3f95d0['attrs']&&_0x3f95d0[_0x6163('0x3c')][0x1]?_0x3f95d0[_0x6163('0x3c')][0x1]['value']:undefined)||_0x6163('0x44')},{'name':_0x6163('0x45'),'value':_0x3f95d0[_0x6163('0x45')]||(_0x3f95d0[_0x6163('0x3c')]&&_0x3f95d0['attrs'][0x2]?_0x3f95d0[_0x6163('0x3c')][0x2][_0x6163('0x40')]:undefined)||0xc}];case'counter':return[{'name':_0x6163('0x46'),'value':_0x3f95d0[_0x6163('0x46')]||(_0x3f95d0[_0x6163('0x3c')]&&_0x3f95d0[_0x6163('0x3c')][0x0]?_0x3f95d0[_0x6163('0x3c')][0x0]['value']:undefined)||_0x6163('0x47')},{'name':_0x6163('0x48'),'value':_0x3f95d0['attrVoiceQueues']||(_0x3f95d0[_0x6163('0x3c')]&&_0x3f95d0[_0x6163('0x3c')][0x1]?_0x3f95d0[_0x6163('0x3c')][0x1][_0x6163('0x40')]:undefined)||[]},{'name':_0x6163('0x45'),'value':_0x3f95d0['attrFontSize']||(_0x3f95d0[_0x6163('0x3c')]&&_0x3f95d0[_0x6163('0x3c')][0x2]?_0x3f95d0[_0x6163('0x3c')][0x2][_0x6163('0x40')]:undefined)||0x14}];case'multibar-chart':case _0x6163('0x49'):return[{'name':_0x6163('0x4a'),'value':_0x3f95d0['attrSerie1']||(_0x3f95d0[_0x6163('0x3c')]&&_0x3f95d0['attrs'][0x0]?_0x3f95d0[_0x6163('0x3c')][0x0][_0x6163('0x40')]:undefined)||_0x6163('0x47')},{'name':_0x6163('0x4b'),'value':_0x3f95d0[_0x6163('0x4b')]||(_0x3f95d0[_0x6163('0x3c')]&&_0x3f95d0[_0x6163('0x3c')][0x1]?_0x3f95d0['attrs'][0x1][_0x6163('0x40')]:undefined)||null},{'name':_0x6163('0x4c'),'value':_0x3f95d0['attrSerie3']||(_0x3f95d0[_0x6163('0x3c')]&&_0x3f95d0[_0x6163('0x3c')][0x2]?_0x3f95d0['attrs'][0x2]['value']:undefined)||null},{'name':_0x6163('0x48'),'value':_0x3f95d0[_0x6163('0x48')]||(_0x3f95d0[_0x6163('0x3c')]&&_0x3f95d0[_0x6163('0x3c')][0x3]?_0x3f95d0['attrs'][0x3][_0x6163('0x40')]:undefined)||[]}];case _0x6163('0x4d'):return[{'name':_0x6163('0x4e'),'type':_0x3f95d0[_0x6163('0x4f')]||(_0x3f95d0[_0x6163('0x3c')]&&_0x3f95d0['attrs'][0x0]?_0x3f95d0[_0x6163('0x3c')][0x0][_0x6163('0x50')]:undefined)||null,'value':_0x3f95d0[_0x6163('0x4e')]||(_0x3f95d0[_0x6163('0x3c')]&&_0x3f95d0[_0x6163('0x3c')][0x0]?_0x3f95d0[_0x6163('0x3c')][0x0][_0x6163('0x40')]:undefined)||null},{'name':_0x6163('0x51'),'value':_0x3f95d0[_0x6163('0x51')]||(_0x3f95d0[_0x6163('0x3c')]&&_0x3f95d0[_0x6163('0x3c')][0x1]?_0x3f95d0[_0x6163('0x3c')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x37ce6e){logger[_0x6163('0x52')](_0x6163('0x53'),JSON['stringify'](_0x37ce6e));return[];}}exports[_0x6163('0x54')]=function(_0x96e362,_0x129be4){if(_0x96e362['body']){_0x96e362[_0x6163('0x55')][_0x6163('0x3c')]=widgetAttributes(_0x96e362[_0x6163('0x55')]);}return db[_0x6163('0x37')][_0x6163('0x54')](_0x96e362[_0x6163('0x55')],{})['then'](respondWithResult(_0x129be4,0xc9))['catch'](handleError(_0x129be4,null));};exports[_0x6163('0x24')]=function(_0x3ded61,_0x526d5c){if(_0x3ded61['body']['id']){delete _0x3ded61[_0x6163('0x55')]['id'];}_0x3ded61['body']['attrs']=widgetAttributes(_0x3ded61[_0x6163('0x55')]);return db[_0x6163('0x37')][_0x6163('0x39')]({'where':{'id':_0x3ded61[_0x6163('0x3a')]['id']}})['then'](handleEntityNotFound(_0x526d5c,null))[_0x6163('0x25')](saveUpdates(_0x3ded61[_0x6163('0x55')],null))['then'](respondWithResult(_0x526d5c,null))[_0x6163('0x38')](handleError(_0x526d5c,null));}; \ No newline at end of file +var _0xe13c=['attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./dashboardItem.socket','register','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','then','end','error','stack','name','send','show','params','keys','DashboardItem','query','filters','attributes','intersection','model','fields','include','find','catch','destroy','type','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total'];(function(_0x5de532,_0x2941c4){var _0x4e9192=function(_0x548a81){while(--_0x548a81){_0x5de532['push'](_0x5de532['shift']());}};_0x4e9192(++_0x2941c4);}(_0xe13c,0x105));var _0xce13=function(_0x4fedb8,_0x1f9d88){_0x4fedb8=_0x4fedb8-0x0;var _0x137347=_0xe13c[_0x4fedb8];return _0x137347;};'use strict';var pdf=require(_0xce13('0x0'));var emlformat=require(_0xce13('0x1'));var rimraf=require(_0xce13('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xce13('0x3'));var moment=require('moment');var BPromise=require(_0xce13('0x4'));var Mustache=require(_0xce13('0x5'));var util=require(_0xce13('0x6'));var path=require(_0xce13('0x7'));var sox=require('sox');var csv=require(_0xce13('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xce13('0x9'));var squel=require('squel');var crypto=require(_0xce13('0xa'));var jsforce=require(_0xce13('0xb'));var deskjs=require(_0xce13('0xc'));var toCsv=require(_0xce13('0x8'));var querystring=require(_0xce13('0xd'));var Papa=require(_0xce13('0xe'));var authService=require(_0xce13('0xf'));var hardwareService=require(_0xce13('0x10'));var Redis=require(_0xce13('0x11'));var qs=require(_0xce13('0x12'));var logger=require('../../config/logger')(_0xce13('0x13'));var utils=require(_0xce13('0x14'));var config=require(_0xce13('0x15'));var db=require(_0xce13('0x16'))['db'];config[_0xce13('0x17')]=_['defaults'](config[_0xce13('0x17')],{'host':_0xce13('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xce13('0x17')]));require(_0xce13('0x19'))[_0xce13('0x1a')](socket);function respondWithStatusCode(_0x58fd50,_0x1a4802){_0x1a4802=_0x1a4802||0xcc;return function(_0x476d06){if(_0x476d06){return _0x58fd50[_0xce13('0x1b')](_0x1a4802);}return _0x58fd50['status'](_0x1a4802)['end']();};}function respondWithResult(_0x55f6a4,_0x705175){_0x705175=_0x705175||0xc8;return function(_0x2c0890){if(_0x2c0890){return _0x55f6a4[_0xce13('0x1c')](_0x705175)[_0xce13('0x1d')](_0x2c0890);}};}function respondWithFilteredResult(_0x50e29a,_0x1c4dec){return function(_0x1ca2b3){if(_0x1ca2b3){var _0x56c84e=_0x1ca2b3[_0xce13('0x1e')],_0x1772e0=_0x1c4dec[_0xce13('0x1f')],_0x2451fb=_0x1c4dec[_0xce13('0x1f')]+_0x1c4dec['limit'],_0x47bf04;if(_0x2451fb>=_0x56c84e){_0x2451fb=_0x56c84e;_0x47bf04=0xc8;}else{_0x47bf04=0xce;}_0x50e29a[_0xce13('0x1c')](_0x47bf04);return _0x50e29a[_0xce13('0x20')](_0xce13('0x21'),_0x1772e0+'-'+_0x2451fb+'/'+_0x56c84e)[_0xce13('0x1d')](_0x1ca2b3);}return null;};}function patchUpdates(_0x54a661){return function(_0x120477){try{jsonpatch['apply'](_0x120477,_0x54a661,!![]);}catch(_0x27eee4){return BPromise[_0xce13('0x22')](_0x27eee4);}return _0x120477[_0xce13('0x23')]();};}function saveUpdates(_0x213fe8,_0x149fdc){return function(_0x4e1727){if(_0x4e1727){return _0x4e1727[_0xce13('0x24')](_0x213fe8)['then'](function(_0x21250d){return _0x21250d;});}return null;};}function removeEntity(_0x41c413,_0x41757b){return function(_0x5951e5){if(_0x5951e5){return _0x5951e5['destroy']()[_0xce13('0x25')](function(){_0x41c413[_0xce13('0x1c')](0xcc)[_0xce13('0x26')]();});}};}function handleEntityNotFound(_0x46b8a9,_0x527101){return function(_0x170b03){if(!_0x170b03){_0x46b8a9[_0xce13('0x1b')](0x194);}return _0x170b03;};}function handleError(_0x3464f2,_0x11a754){_0x11a754=_0x11a754||0x1f4;return function(_0x12f2c2){logger[_0xce13('0x27')](_0x12f2c2[_0xce13('0x28')]);if(_0x12f2c2[_0xce13('0x29')]){delete _0x12f2c2[_0xce13('0x29')];}_0x3464f2['status'](_0x11a754)[_0xce13('0x2a')](_0x12f2c2);};}exports[_0xce13('0x2b')]=function(_0x379ff7,_0xaebadb){var _0x8d87f5={'raw':![],'where':{'id':_0x379ff7[_0xce13('0x2c')]['id']}},_0x15fb2e={};_0x15fb2e['model']=_[_0xce13('0x2d')](db[_0xce13('0x2e')]['rawAttributes']);_0x15fb2e['query']=_[_0xce13('0x2d')](_0x379ff7[_0xce13('0x2f')]);_0x15fb2e[_0xce13('0x30')]=_['intersection'](_0x15fb2e['model'],_0x15fb2e[_0xce13('0x2f')]);_0x8d87f5[_0xce13('0x31')]=_[_0xce13('0x32')](_0x15fb2e[_0xce13('0x33')],qs[_0xce13('0x34')](_0x379ff7['query'][_0xce13('0x34')]));_0x8d87f5['attributes']=_0x8d87f5[_0xce13('0x31')]['length']?_0x8d87f5['attributes']:_0x15fb2e['model'];if(_0x379ff7[_0xce13('0x2f')]['includeAll']){_0x8d87f5[_0xce13('0x35')]=[{'all':!![]}];}_0x8d87f5=_['merge']({},_0x8d87f5,_0x379ff7['options']);return db['DashboardItem'][_0xce13('0x36')](_0x8d87f5)['then'](handleEntityNotFound(_0xaebadb,null))[_0xce13('0x25')](respondWithResult(_0xaebadb,null))[_0xce13('0x37')](handleError(_0xaebadb,null));};exports[_0xce13('0x38')]=function(_0x42b7db,_0x18bc80){return db['DashboardItem'][_0xce13('0x36')]({'where':{'id':_0x42b7db[_0xce13('0x2c')]['id']}})[_0xce13('0x25')](handleEntityNotFound(_0x18bc80,null))[_0xce13('0x25')](removeEntity(_0x18bc80,null))[_0xce13('0x37')](handleError(_0x18bc80,null));};function widgetAttributes(_0x8cbb47){try{switch(_0x8cbb47[_0xce13('0x39')]){case'iframe':return[{'name':'attrUrl','value':_0x8cbb47[_0xce13('0x3a')]||(_0x8cbb47[_0xce13('0x3b')]&&_0x8cbb47[_0xce13('0x3b')][0x0]?_0x8cbb47[_0xce13('0x3b')][0x0][_0xce13('0x3c')]:undefined)||_0xce13('0x3d')}];case _0xce13('0x3e'):return[{'name':_0xce13('0x3f'),'value':_0x8cbb47[_0xce13('0x3f')]||(_0x8cbb47['attrs']&&_0x8cbb47[_0xce13('0x3b')][0x0]?_0x8cbb47[_0xce13('0x3b')][0x0][_0xce13('0x3c')]:undefined)||''}];case _0xce13('0x40'):return[{'name':_0xce13('0x41'),'value':_0x8cbb47['attrHourFormat']||(_0x8cbb47[_0xce13('0x3b')]&&_0x8cbb47[_0xce13('0x3b')][0x0]?_0x8cbb47[_0xce13('0x3b')][0x0][_0xce13('0x3c')]:undefined)||'HH:mm:ss'},{'name':_0xce13('0x42'),'value':_0x8cbb47[_0xce13('0x42')]||(_0x8cbb47[_0xce13('0x3b')]&&_0x8cbb47[_0xce13('0x3b')][0x1]?_0x8cbb47[_0xce13('0x3b')][0x1][_0xce13('0x3c')]:undefined)||_0xce13('0x43')},{'name':_0xce13('0x44'),'value':_0x8cbb47['attrFontSize']||(_0x8cbb47[_0xce13('0x3b')]&&_0x8cbb47[_0xce13('0x3b')][0x2]?_0x8cbb47[_0xce13('0x3b')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x8cbb47[_0xce13('0x45')]||(_0x8cbb47[_0xce13('0x3b')]&&_0x8cbb47[_0xce13('0x3b')][0x0]?_0x8cbb47[_0xce13('0x3b')][0x0]['value']:undefined)||_0xce13('0x46')},{'name':_0xce13('0x47'),'value':_0x8cbb47[_0xce13('0x47')]||(_0x8cbb47[_0xce13('0x3b')]&&_0x8cbb47[_0xce13('0x3b')][0x1]?_0x8cbb47[_0xce13('0x3b')][0x1][_0xce13('0x3c')]:undefined)||[]},{'name':_0xce13('0x44'),'value':_0x8cbb47[_0xce13('0x44')]||(_0x8cbb47['attrs']&&_0x8cbb47['attrs'][0x2]?_0x8cbb47[_0xce13('0x3b')][0x2][_0xce13('0x3c')]:undefined)||0x14}];case _0xce13('0x48'):case _0xce13('0x49'):return[{'name':_0xce13('0x4a'),'value':_0x8cbb47['attrSerie1']||(_0x8cbb47['attrs']&&_0x8cbb47[_0xce13('0x3b')][0x0]?_0x8cbb47['attrs'][0x0][_0xce13('0x3c')]:undefined)||'total'},{'name':_0xce13('0x4b'),'value':_0x8cbb47['attrSerie2']||(_0x8cbb47[_0xce13('0x3b')]&&_0x8cbb47[_0xce13('0x3b')][0x1]?_0x8cbb47[_0xce13('0x3b')][0x1][_0xce13('0x3c')]:undefined)||null},{'name':_0xce13('0x4c'),'value':_0x8cbb47[_0xce13('0x4c')]||(_0x8cbb47['attrs']&&_0x8cbb47[_0xce13('0x3b')][0x2]?_0x8cbb47[_0xce13('0x3b')][0x2][_0xce13('0x3c')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x8cbb47[_0xce13('0x47')]||(_0x8cbb47['attrs']&&_0x8cbb47[_0xce13('0x3b')][0x3]?_0x8cbb47[_0xce13('0x3b')][0x3][_0xce13('0x3c')]:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x8cbb47[_0xce13('0x4d')]||(_0x8cbb47[_0xce13('0x3b')]&&_0x8cbb47[_0xce13('0x3b')][0x0]?_0x8cbb47[_0xce13('0x3b')][0x0]['type']:undefined)||null,'value':_0x8cbb47['attrReport']||(_0x8cbb47[_0xce13('0x3b')]&&_0x8cbb47['attrs'][0x0]?_0x8cbb47[_0xce13('0x3b')][0x0][_0xce13('0x3c')]:undefined)||null},{'name':'attrRefresh','value':_0x8cbb47[_0xce13('0x4e')]||(_0x8cbb47[_0xce13('0x3b')]&&_0x8cbb47[_0xce13('0x3b')][0x1]?_0x8cbb47[_0xce13('0x3b')][0x1][_0xce13('0x3c')]:undefined)||0x0}];default:return[];}}catch(_0x30ad32){logger[_0xce13('0x27')](_0xce13('0x4f'),JSON[_0xce13('0x50')](_0x30ad32));return[];}}exports[_0xce13('0x51')]=function(_0x585f28,_0x21a01f){if(_0x585f28[_0xce13('0x52')]){_0x585f28['body']['attrs']=widgetAttributes(_0x585f28[_0xce13('0x52')]);}return db[_0xce13('0x2e')][_0xce13('0x51')](_0x585f28['body'],{})[_0xce13('0x25')](respondWithResult(_0x21a01f,0xc9))[_0xce13('0x37')](handleError(_0x21a01f,null));};exports[_0xce13('0x24')]=function(_0x2d054d,_0xd447fd){if(_0x2d054d['body']['id']){delete _0x2d054d['body']['id'];}_0x2d054d[_0xce13('0x52')][_0xce13('0x3b')]=widgetAttributes(_0x2d054d['body']);return db[_0xce13('0x2e')][_0xce13('0x36')]({'where':{'id':_0x2d054d['params']['id']}})[_0xce13('0x25')](handleEntityNotFound(_0xd447fd,null))[_0xce13('0x25')](saveUpdates(_0x2d054d[_0xce13('0x52')],null))[_0xce13('0x25')](respondWithResult(_0xd447fd,null))['catch'](handleError(_0xd447fd,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index ecfe482..b13e1f6 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 _0x5b48=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x2fcadf,_0x401da6){var _0x2a2c05=function(_0x54d612){while(--_0x54d612){_0x2fcadf['push'](_0x2fcadf['shift']());}};_0x2a2c05(++_0x401da6);}(_0x5b48,0x1c8));var _0x85b4=function(_0x52a7a9,_0x4df6fc){_0x52a7a9=_0x52a7a9-0x0;var _0x5253e4=_0x5b48[_0x52a7a9];return _0x5253e4;};'use strict';var EventEmitter=require(_0x85b4('0x0'));var DashboardItem=require(_0x85b4('0x1'))['db'][_0x85b4('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x85b4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x85b4('0x4'),'afterDestroy':_0x85b4('0x5')};function emitEvent(_0x16708b){return function(_0x33197d,_0x31b7e0,_0x3a2f43){DashboardItemEvents[_0x85b4('0x6')](_0x16708b+':'+_0x33197d['id'],_0x33197d);DashboardItemEvents[_0x85b4('0x6')](_0x16708b,_0x33197d);_0x3a2f43(null);};}for(var e in events){if(events[_0x85b4('0x7')](e)){var event=events[e];DashboardItem[_0x85b4('0x8')](e,emitEvent(event));}}module[_0x85b4('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0xcf85=['remove','emit','hasOwnProperty','hook','exports','DashboardItem','save'];(function(_0x3a7a50,_0xf3ba4b){var _0x2f8187=function(_0x5bce83){while(--_0x5bce83){_0x3a7a50['push'](_0x3a7a50['shift']());}};_0x2f8187(++_0xf3ba4b);}(_0xcf85,0xad));var _0x5cf8=function(_0xa94872,_0x4ec3b0){_0xa94872=_0xa94872-0x0;var _0x597214=_0xcf85[_0xa94872];return _0x597214;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0x5cf8('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5cf8('0x1'),'afterUpdate':'update','afterDestroy':_0x5cf8('0x2')};function emitEvent(_0x394a63){return function(_0x68b44e,_0x2cc483,_0x363296){DashboardItemEvents['emit'](_0x394a63+':'+_0x68b44e['id'],_0x68b44e);DashboardItemEvents[_0x5cf8('0x3')](_0x394a63,_0x68b44e);_0x363296(null);};}for(var e in events){if(events[_0x5cf8('0x4')](e)){var event=events[e];DashboardItem[_0x5cf8('0x5')](e,emitEvent(event));}}module[_0x5cf8('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 30123f9..a1109cc 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(_0x4b793b,_0x1ee112){var _0xcfbd6a=function(_0x2eb91c){while(--_0x2eb91c){_0x4b793b['push'](_0x4b793b['shift']());}};_0xcfbd6a(++_0x1ee112);}(_0x7a54,0x106));var _0x47a5=function(_0x239c26,_0x1a9fa5){_0x239c26=_0x239c26-0x0;var _0x2ffd63=_0x7a54[_0x239c26];return _0x2ffd63;};'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(_0x4692a1,_0x41f54f){var _0x128700=function(_0x2661dc){while(--_0x2661dc){_0x4692a1['push'](_0x4692a1['shift']());}};_0x128700(++_0x41f54f);}(_0x7a54,0x106));var _0x47a5=function(_0x4612e3,_0x2507ff){_0x4612e3=_0x4612e3-0x0;var _0x112504=_0x7a54[_0x4612e3];return _0x112504;};'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 ce741d0..34127f1 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 _0xa6c6=['error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0xbf4ddf,_0x66b3cb){var _0x3cb273=function(_0x3cf903){while(--_0x3cf903){_0xbf4ddf['push'](_0xbf4ddf['shift']());}};_0x3cb273(++_0x66b3cb);}(_0xa6c6,0x87));var _0x6a6c=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa6c6[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x6a6c('0x0'));var util=require(_0x6a6c('0x1'));var moment=require('moment');var BPromise=require(_0x6a6c('0x2'));var rs=require(_0x6a6c('0x3'));var fs=require('fs');var Redis=require(_0x6a6c('0x4'));var db=require(_0x6a6c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6a6c('0x6'))(_0x6a6c('0x7'));var config=require(_0x6a6c('0x8'));var jayson=require(_0x6a6c('0x9'));var client=jayson[_0x6a6c('0xa')][_0x6a6c('0xb')]({'port':0x232a});config[_0x6a6c('0xc')]=_['defaults'](config[_0x6a6c('0xc')],{'host':_0x6a6c('0xd'),'port':0x18eb});var socket=require(_0x6a6c('0xe'))(new Redis(config[_0x6a6c('0xc')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x37322b,_0x42398f,_0x149adb){return new BPromise(function(_0x36df46,_0x2c1ed1){return client['request'](_0x37322b,_0x149adb)[_0x6a6c('0xf')](function(_0x3aa20c){logger[_0x6a6c('0x10')](_0x6a6c('0x11'),_0x42398f,_0x6a6c('0x12'));logger[_0x6a6c('0x13')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x42398f,'request\x20sent',JSON[_0x6a6c('0x14')](_0x3aa20c));if(_0x3aa20c[_0x6a6c('0x15')]){if(_0x3aa20c[_0x6a6c('0x15')][_0x6a6c('0x16')]===0x1f4){logger['error'](_0x6a6c('0x11'),_0x42398f,_0x3aa20c['error'][_0x6a6c('0x17')]);return _0x2c1ed1(_0x3aa20c[_0x6a6c('0x15')][_0x6a6c('0x17')]);}logger[_0x6a6c('0x15')](_0x6a6c('0x11'),_0x42398f,_0x3aa20c['error']['message']);return _0x36df46(_0x3aa20c[_0x6a6c('0x15')][_0x6a6c('0x17')]);}else{logger[_0x6a6c('0x10')](_0x6a6c('0x11'),_0x42398f,_0x6a6c('0x12'));_0x36df46(_0x3aa20c[_0x6a6c('0x18')]['message']);}})[_0x6a6c('0x19')](function(_0xa595ed){logger[_0x6a6c('0x15')](_0x6a6c('0x11'),_0x42398f,_0xa595ed);_0x2c1ed1(_0xa595ed);});});} \ No newline at end of file +var _0xc86d=['request','then','info','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','DashboardItem,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket'];(function(_0x52df9a,_0x538555){var _0x339df7=function(_0x16d361){while(--_0x16d361){_0x52df9a['push'](_0x52df9a['shift']());}};_0x339df7(++_0x538555);}(_0xc86d,0x185));var _0xdc86=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xc86d[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0xdc86('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdc86('0x1'));var rs=require(_0xdc86('0x2'));var fs=require('fs');var Redis=require(_0xdc86('0x3'));var db=require(_0xdc86('0x4'))['db'];var utils=require(_0xdc86('0x5'));var logger=require(_0xdc86('0x6'))(_0xdc86('0x7'));var config=require('../../config/environment');var jayson=require(_0xdc86('0x8'));var client=jayson[_0xdc86('0x9')][_0xdc86('0xa')]({'port':0x232a});config[_0xdc86('0xb')]=_[_0xdc86('0xc')](config['redis'],{'host':_0xdc86('0xd'),'port':0x18eb});var socket=require(_0xdc86('0xe'))(new Redis(config[_0xdc86('0xb')]));require(_0xdc86('0xf'))['register'](socket);function respondWithRpcPromise(_0xa4c711,_0x45433a,_0x5b9349){return new BPromise(function(_0x22d37e,_0x3998f7){return client[_0xdc86('0x10')](_0xa4c711,_0x5b9349)[_0xdc86('0x11')](function(_0x18189b){logger[_0xdc86('0x12')]('DashboardItem,\x20%s,\x20%s',_0x45433a,'request\x20sent');logger[_0xdc86('0x13')](_0xdc86('0x14'),_0x45433a,'request\x20sent',JSON['stringify'](_0x18189b));if(_0x18189b[_0xdc86('0x15')]){if(_0x18189b[_0xdc86('0x15')]['code']===0x1f4){logger[_0xdc86('0x15')](_0xdc86('0x16'),_0x45433a,_0x18189b[_0xdc86('0x15')][_0xdc86('0x17')]);return _0x3998f7(_0x18189b[_0xdc86('0x15')]['message']);}logger[_0xdc86('0x15')](_0xdc86('0x16'),_0x45433a,_0x18189b[_0xdc86('0x15')][_0xdc86('0x17')]);return _0x22d37e(_0x18189b[_0xdc86('0x15')]['message']);}else{logger['info'](_0xdc86('0x16'),_0x45433a,_0xdc86('0x18'));_0x22d37e(_0x18189b[_0xdc86('0x19')]['message']);}})[_0xdc86('0x1a')](function(_0x1e627c){logger[_0xdc86('0x15')]('DashboardItem,\x20%s,\x20%s',_0x45433a,_0x1e627c);_0x3998f7(_0x1e627c);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index dc55ada..76ac306 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 _0xedd9=['removeListener','register','length','dashboardItem:','save','remove','update','emit'];(function(_0x249627,_0xe19704){var _0x17b190=function(_0xb765ab){while(--_0xb765ab){_0x249627['push'](_0x249627['shift']());}};_0x17b190(++_0xe19704);}(_0xedd9,0xfc));var _0x9edd=function(_0x30dab0,_0xcbfba2){_0x30dab0=_0x30dab0-0x0;var _0x235cd0=_0xedd9[_0x30dab0];return _0x235cd0;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x9edd('0x0'),_0x9edd('0x1'),_0x9edd('0x2')];function createListener(_0x2c16b8,_0x3b51bc){return function(_0x127cbe){_0x3b51bc[_0x9edd('0x3')](_0x2c16b8,_0x127cbe);};}function removeListener(_0x36b53f,_0x5943b3){return function(){DashboardItemEvents[_0x9edd('0x4')](_0x36b53f,_0x5943b3);};}exports[_0x9edd('0x5')]=function(_0x268f9e){for(var _0x34c1a7=0x0,_0x5319f7=events[_0x9edd('0x6')];_0x34c1a7<_0x5319f7;_0x34c1a7++){var _0x571af9=events[_0x34c1a7];var _0x172522=createListener(_0x9edd('0x7')+_0x571af9,_0x268f9e);DashboardItemEvents['on'](_0x571af9,_0x172522);}}; \ No newline at end of file +var _0x3e74=['emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','remove','update'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x3e74,0x175));var _0x43e7=function(_0x116210,_0x37f487){_0x116210=_0x116210-0x0;var _0x3058a1=_0x3e74[_0x116210];return _0x3058a1;};'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 e1f21eb..ef83cf6 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 _0xc48d=['post','create','put','update','destroy','exports','multer','util','express','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show'];(function(_0x5b5c45,_0x199467){var _0x2cd0dd=function(_0x3f3266){while(--_0x3f3266){_0x5b5c45['push'](_0x5b5c45['shift']());}};_0x2cd0dd(++_0x199467);}(_0xc48d,0x19b));var _0xdc48=function(_0x30a31e,_0x31f766){_0x30a31e=_0x30a31e-0x0;var _0x170879=_0xc48d[_0x30a31e];return _0x170879;};'use strict';var multer=require(_0xdc48('0x0'));var util=require(_0xdc48('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdc48('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xdc48('0x3'));var config=require(_0xdc48('0x4'));var controller=require(_0xdc48('0x5'));router['get'](_0xdc48('0x6'),auth[_0xdc48('0x7')](),controller[_0xdc48('0x8')]);router[_0xdc48('0x9')]('/',auth[_0xdc48('0x7')](),controller[_0xdc48('0xa')]);router[_0xdc48('0xb')](_0xdc48('0x6'),auth['isAuthenticated'](),controller[_0xdc48('0xc')]);router['delete'](_0xdc48('0x6'),auth[_0xdc48('0x7')](),controller[_0xdc48('0xd')]);module[_0xdc48('0xe')]=router; \ No newline at end of file +var _0x56b8=['delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','put','update'];(function(_0x1ec4e3,_0x5af05a){var _0xb2f1bd=function(_0x3a984f){while(--_0x3a984f){_0x1ec4e3['push'](_0x1ec4e3['shift']());}};_0xb2f1bd(++_0x5af05a);}(_0x56b8,0x1a0));var _0x856b=function(_0x4cddf9,_0x476271){_0x4cddf9=_0x4cddf9-0x0;var _0x13b8ad=_0x56b8[_0x4cddf9];return _0x13b8ad;};'use strict';var multer=require(_0x856b('0x0'));var util=require('util');var path=require(_0x856b('0x1'));var timeout=require(_0x856b('0x2'));var express=require(_0x856b('0x3'));var router=express[_0x856b('0x4')]();var auth=require(_0x856b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x856b('0x6'));var controller=require(_0x856b('0x7'));router[_0x856b('0x8')](_0x856b('0x9'),auth[_0x856b('0xa')](),controller[_0x856b('0xb')]);router[_0x856b('0xc')]('/',auth['isAuthenticated'](),controller[_0x856b('0xd')]);router[_0x856b('0xe')]('/:id',auth[_0x856b('0xa')](),controller[_0x856b('0xf')]);router[_0x856b('0x10')]('/:id',auth[_0x856b('0xa')](),controller[_0x856b('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 917b583..07a9057 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 _0x0f4f=['sequelize','exports','STRING'];(function(_0x37c8ef,_0x334449){var _0x5eaee9=function(_0x4b1b98){while(--_0x4b1b98){_0x37c8ef['push'](_0x37c8ef['shift']());}};_0x5eaee9(++_0x334449);}(_0x0f4f,0x168));var _0xf0f4=function(_0x18e097,_0x5efb8c){_0x18e097=_0x18e097-0x0;var _0x448676=_0x0f4f[_0x18e097];return _0x448676;};'use strict';var Sequelize=require(_0xf0f4('0x0'));module[_0xf0f4('0x1')]={'name':{'type':Sequelize[_0xf0f4('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1aa8=['exports','STRING','sequelize'];(function(_0x2c774a,_0x37198c){var _0x45ded1=function(_0x1e35d6){while(--_0x1e35d6){_0x2c774a['push'](_0x2c774a['shift']());}};_0x45ded1(++_0x37198c);}(_0x1aa8,0x167));var _0x81aa=function(_0x479b13,_0x583096){_0x479b13=_0x479b13-0x0;var _0x1567be=_0x1aa8[_0x479b13];return _0x1567be;};'use strict';var Sequelize=require(_0x81aa('0x0'));module[_0x81aa('0x1')]={'name':{'type':Sequelize[_0x81aa('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 8d0c6b1..6ab7d1e 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 _0xbf04=['intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','map','type','key','options','count','include','show','includeAll','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','catch','update','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','reject','save','then','get','Dispositions','UserProfileResource','destroy','error','stack','name','send','index','Disposition','rawAttributes','model','keys','query','filters'];(function(_0x6c67a6,_0x106fdf){var _0x24d98d=function(_0x5a6d90){while(--_0x5a6d90){_0x6c67a6['push'](_0x6c67a6['shift']());}};_0x24d98d(++_0x106fdf);}(_0xbf04,0xc1));var _0x4bf0=function(_0xecba52,_0x52edb4){_0xecba52=_0xecba52-0x0;var _0xfec041=_0xbf04[_0xecba52];return _0xfec041;};'use strict';var pdf=require(_0x4bf0('0x0'));var emlformat=require(_0x4bf0('0x1'));var rimraf=require(_0x4bf0('0x2'));var zipdir=require(_0x4bf0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4bf0('0x4'));var moment=require(_0x4bf0('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4bf0('0x6'));var path=require(_0x4bf0('0x7'));var sox=require('sox');var csv=require(_0x4bf0('0x8'));var ejs=require(_0x4bf0('0x9'));var fs=require('fs');var _=require(_0x4bf0('0xa'));var squel=require(_0x4bf0('0xb'));var crypto=require('crypto');var jsforce=require(_0x4bf0('0xc'));var deskjs=require(_0x4bf0('0xd'));var toCsv=require(_0x4bf0('0x8'));var querystring=require(_0x4bf0('0xe'));var Papa=require(_0x4bf0('0xf'));var authService=require('../../components/auth/service');var hardwareService=require(_0x4bf0('0x10'));var Redis=require('ioredis');var qs=require(_0x4bf0('0x11'));var logger=require(_0x4bf0('0x12'))(_0x4bf0('0x13'));var utils=require(_0x4bf0('0x14'));var config=require('../../config/environment');var db=require(_0x4bf0('0x15'))['db'];function respondWithStatusCode(_0x579e05,_0x5d53d6){_0x5d53d6=_0x5d53d6||0xcc;return function(_0x40df1c){if(_0x40df1c){return _0x579e05[_0x4bf0('0x16')](_0x5d53d6);}return _0x579e05[_0x4bf0('0x17')](_0x5d53d6)[_0x4bf0('0x18')]();};}function respondWithResult(_0x542545,_0x58a47c){_0x58a47c=_0x58a47c||0xc8;return function(_0x4b088f){if(_0x4b088f){return _0x542545[_0x4bf0('0x17')](_0x58a47c)[_0x4bf0('0x19')](_0x4b088f);}};}function respondWithFilteredResult(_0xaa8b5e,_0x3409f6){return function(_0x1ef44f){if(_0x1ef44f){var _0x2659ad=_0x1ef44f['count'],_0x120e39=_0x3409f6['offset'],_0x56c73a=_0x3409f6[_0x4bf0('0x1a')]+_0x3409f6['limit'],_0x11e0fb;if(_0x56c73a>=_0x2659ad){_0x56c73a=_0x2659ad;_0x11e0fb=0xc8;}else{_0x11e0fb=0xce;}_0xaa8b5e[_0x4bf0('0x17')](_0x11e0fb);return _0xaa8b5e[_0x4bf0('0x1b')](_0x4bf0('0x1c'),_0x120e39+'-'+_0x56c73a+'/'+_0x2659ad)[_0x4bf0('0x19')](_0x1ef44f);}return null;};}function patchUpdates(_0x332063){return function(_0x27632c){try{jsonpatch['apply'](_0x27632c,_0x332063,!![]);}catch(_0x358c7c){return BPromise[_0x4bf0('0x1d')](_0x358c7c);}return _0x27632c[_0x4bf0('0x1e')]();};}function saveUpdates(_0x5b98d0,_0x5bfd74){return function(_0x104dfe){if(_0x104dfe){return _0x104dfe['update'](_0x5b98d0)[_0x4bf0('0x1f')](function(_0x1ad928){return _0x1ad928;});}return null;};}function removeEntity(_0x5e3fdd,_0x1c269c){return function(_0x488b71){if(_0x488b71){return _0x488b71['destroy']()[_0x4bf0('0x1f')](function(){var _0x4f9004=_0x488b71[_0x4bf0('0x20')]({'plain':!![]});var _0x4c2835=_0x4bf0('0x21');return db[_0x4bf0('0x22')][_0x4bf0('0x23')]({'where':{'type':_0x4c2835,'resourceId':_0x4f9004['id']}})['then'](function(){return _0x488b71;});})[_0x4bf0('0x1f')](function(){_0x5e3fdd[_0x4bf0('0x17')](0xcc)[_0x4bf0('0x18')]();});}};}function handleEntityNotFound(_0x28f065,_0x3f3708){return function(_0x2ec628){if(!_0x2ec628){_0x28f065[_0x4bf0('0x16')](0x194);}return _0x2ec628;};}function handleError(_0x150427,_0x2b0c8e){_0x2b0c8e=_0x2b0c8e||0x1f4;return function(_0x49bb67){logger[_0x4bf0('0x24')](_0x49bb67[_0x4bf0('0x25')]);if(_0x49bb67['name']){delete _0x49bb67[_0x4bf0('0x26')];}_0x150427['status'](_0x2b0c8e)[_0x4bf0('0x27')](_0x49bb67);};}exports[_0x4bf0('0x28')]=function(_0x4de014,_0x39b5d9){var _0x43d2d3={},_0x479cdf={},_0x4e53f2={'count':0x0,'rows':[]};var _0x5dda42=db[_0x4bf0('0x29')][_0x4bf0('0x2a')];_0x479cdf[_0x4bf0('0x2b')]=_[_0x4bf0('0x2c')](_0x5dda42);_0x479cdf[_0x4bf0('0x2d')]=_[_0x4bf0('0x2c')](_0x4de014[_0x4bf0('0x2d')]);_0x479cdf[_0x4bf0('0x2e')]=_[_0x4bf0('0x2f')](_0x479cdf['model'],_0x479cdf[_0x4bf0('0x2d')]);_0x43d2d3[_0x4bf0('0x30')]=_[_0x4bf0('0x2f')](_0x479cdf[_0x4bf0('0x2b')],qs[_0x4bf0('0x31')](_0x4de014['query'][_0x4bf0('0x31')]));_0x43d2d3[_0x4bf0('0x30')]=_0x43d2d3[_0x4bf0('0x30')][_0x4bf0('0x32')]?_0x43d2d3['attributes']:_0x479cdf[_0x4bf0('0x2b')];if(!_0x4de014[_0x4bf0('0x2d')][_0x4bf0('0x33')](_0x4bf0('0x34'))){_0x43d2d3['limit']=qs['limit'](_0x4de014['query'][_0x4bf0('0x35')]);_0x43d2d3[_0x4bf0('0x1a')]=qs[_0x4bf0('0x1a')](_0x4de014[_0x4bf0('0x2d')][_0x4bf0('0x1a')]);}_0x43d2d3[_0x4bf0('0x36')]=qs[_0x4bf0('0x37')](_0x4de014['query'][_0x4bf0('0x37')]);_0x43d2d3[_0x4bf0('0x38')]=qs[_0x4bf0('0x2e')](_[_0x4bf0('0x39')](_0x4de014[_0x4bf0('0x2d')],_0x479cdf['filters']));if(_0x4de014[_0x4bf0('0x2d')][_0x4bf0('0x3a')]){_0x43d2d3[_0x4bf0('0x38')]=_['merge'](_0x43d2d3[_0x4bf0('0x38')],{'$or':_[_0x4bf0('0x3b')](_0x5dda42,function(_0x578ca9){if(_0x578ca9[_0x4bf0('0x3c')][_0x4bf0('0x3d')]!=='VIRTUAL'){var _0x34f478={};_0x34f478[_0x578ca9['field']]={'$like':'%'+_0x4de014['query'][_0x4bf0('0x3a')]+'%'};return _0x34f478;}})});}_0x43d2d3=_['merge']({},_0x43d2d3,_0x4de014[_0x4bf0('0x3e')]);var _0x59bb06={'where':_0x43d2d3[_0x4bf0('0x38')]};return db[_0x4bf0('0x29')][_0x4bf0('0x3f')](_0x59bb06)[_0x4bf0('0x1f')](function(_0x557c8f){_0x4e53f2[_0x4bf0('0x3f')]=_0x557c8f;if(_0x4de014['query']['includeAll']){_0x43d2d3[_0x4bf0('0x40')]=[{'all':!![]}];}return db[_0x4bf0('0x29')]['findAll'](_0x43d2d3);})[_0x4bf0('0x1f')](function(_0x3cf943){_0x4e53f2['rows']=_0x3cf943;return _0x4e53f2;})[_0x4bf0('0x1f')](respondWithFilteredResult(_0x39b5d9,_0x43d2d3))['catch'](handleError(_0x39b5d9,null));};exports[_0x4bf0('0x41')]=function(_0x3244dc,_0x5641fd){var _0xc31c13={'raw':!![],'where':{'id':_0x3244dc['params']['id']}},_0x13ca49={};_0x13ca49['model']=_['keys'](db[_0x4bf0('0x29')]['rawAttributes']);_0x13ca49[_0x4bf0('0x2d')]=_[_0x4bf0('0x2c')](_0x3244dc['query']);_0x13ca49[_0x4bf0('0x2e')]=_['intersection'](_0x13ca49[_0x4bf0('0x2b')],_0x13ca49[_0x4bf0('0x2d')]);_0xc31c13[_0x4bf0('0x30')]=_[_0x4bf0('0x2f')](_0x13ca49[_0x4bf0('0x2b')],qs[_0x4bf0('0x31')](_0x3244dc[_0x4bf0('0x2d')][_0x4bf0('0x31')]));_0xc31c13[_0x4bf0('0x30')]=_0xc31c13[_0x4bf0('0x30')][_0x4bf0('0x32')]?_0xc31c13['attributes']:_0x13ca49[_0x4bf0('0x2b')];if(_0x3244dc[_0x4bf0('0x2d')][_0x4bf0('0x42')]){_0xc31c13[_0x4bf0('0x40')]=[{'all':!![]}];}_0xc31c13=_[_0x4bf0('0x43')]({},_0xc31c13,_0x3244dc[_0x4bf0('0x3e')]);return db[_0x4bf0('0x29')][_0x4bf0('0x44')](_0xc31c13)[_0x4bf0('0x1f')](handleEntityNotFound(_0x5641fd,null))[_0x4bf0('0x1f')](respondWithResult(_0x5641fd,null))['catch'](handleError(_0x5641fd,null));};exports[_0x4bf0('0x45')]=function(_0x622e4b,_0x2fe255){return db[_0x4bf0('0x29')][_0x4bf0('0x45')](_0x622e4b[_0x4bf0('0x46')],{})[_0x4bf0('0x1f')](function(_0x5c5157){var _0x5e0eea=_0x622e4b['user'][_0x4bf0('0x20')]({'plain':!![]});if(!_0x5e0eea)throw new Error(_0x4bf0('0x47'));if(_0x5e0eea[_0x4bf0('0x48')]===_0x4bf0('0x49')){var _0x52dc0=_0x5c5157['get']({'plain':!![]});var _0x2903c7='Dispositions';return db[_0x4bf0('0x4a')][_0x4bf0('0x44')]({'where':{'name':_0x2903c7,'userProfileId':_0x5e0eea[_0x4bf0('0x4b')]},'raw':!![]})[_0x4bf0('0x1f')](function(_0x1c3158){if(_0x1c3158&&_0x1c3158[_0x4bf0('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x52dc0[_0x4bf0('0x26')],'resourceId':_0x52dc0['id'],'type':_0x1c3158[_0x4bf0('0x26')],'sectionId':_0x1c3158['id']},{})[_0x4bf0('0x1f')](function(){return _0x5c5157;});}else{return _0x5c5157;}})[_0x4bf0('0x4d')](function(_0x1301d2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1301d2);throw _0x1301d2;});}return _0x5c5157;})[_0x4bf0('0x1f')](respondWithResult(_0x2fe255,0xc9))['catch'](handleError(_0x2fe255,null));};exports[_0x4bf0('0x4e')]=function(_0x110431,_0x199aa6){if(_0x110431[_0x4bf0('0x46')]['id']){delete _0x110431[_0x4bf0('0x46')]['id'];}return db[_0x4bf0('0x29')][_0x4bf0('0x44')]({'where':{'id':_0x110431[_0x4bf0('0x4f')]['id']}})['then'](handleEntityNotFound(_0x199aa6,null))[_0x4bf0('0x1f')](saveUpdates(_0x110431[_0x4bf0('0x46')],null))[_0x4bf0('0x1f')](respondWithResult(_0x199aa6,null))[_0x4bf0('0x4d')](handleError(_0x199aa6,null));};exports[_0x4bf0('0x23')]=function(_0x419e13,_0x443f46){return db[_0x4bf0('0x29')][_0x4bf0('0x44')]({'where':{'id':_0x419e13['params']['id']}})[_0x4bf0('0x1f')](handleEntityNotFound(_0x443f46,null))['then'](removeEntity(_0x443f46,null))[_0x4bf0('0x4d')](handleError(_0x443f46,null));}; \ No newline at end of file +var _0x3280=['lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','destroy','get','UserProfileResource','then','error','stack','name','send','index','Disposition','rawAttributes','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','map','type','key','field','merge','includeAll','include','rows','catch','show','params','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x249454,_0x379957){var _0x2ecc79=function(_0x1c0260){while(--_0x1c0260){_0x249454['push'](_0x249454['shift']());}};_0x2ecc79(++_0x379957);}(_0x3280,0x17a));var _0x0328=function(_0x13282f,_0x5cd763){_0x13282f=_0x13282f-0x0;var _0x2c96c4=_0x3280[_0x13282f];return _0x2c96c4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0328('0x0'));var rimraf=require(_0x0328('0x1'));var zipdir=require(_0x0328('0x2'));var jsonpatch=require(_0x0328('0x3'));var rp=require(_0x0328('0x4'));var moment=require(_0x0328('0x5'));var BPromise=require(_0x0328('0x6'));var Mustache=require(_0x0328('0x7'));var util=require('util');var path=require(_0x0328('0x8'));var sox=require(_0x0328('0x9'));var csv=require(_0x0328('0xa'));var ejs=require(_0x0328('0xb'));var fs=require('fs');var _=require(_0x0328('0xc'));var squel=require(_0x0328('0xd'));var crypto=require(_0x0328('0xe'));var jsforce=require(_0x0328('0xf'));var deskjs=require(_0x0328('0x10'));var toCsv=require(_0x0328('0xa'));var querystring=require('querystring');var Papa=require(_0x0328('0x11'));var authService=require(_0x0328('0x12'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x0328('0x13'));var qs=require(_0x0328('0x14'));var logger=require('../../config/logger')(_0x0328('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0328('0x16'))['db'];function respondWithStatusCode(_0x541554,_0x430a57){_0x430a57=_0x430a57||0xcc;return function(_0x5d75df){if(_0x5d75df){return _0x541554[_0x0328('0x17')](_0x430a57);}return _0x541554[_0x0328('0x18')](_0x430a57)[_0x0328('0x19')]();};}function respondWithResult(_0x258e70,_0x326135){_0x326135=_0x326135||0xc8;return function(_0x5c6d93){if(_0x5c6d93){return _0x258e70[_0x0328('0x18')](_0x326135)[_0x0328('0x1a')](_0x5c6d93);}};}function respondWithFilteredResult(_0x4704bb,_0x59d1ba){return function(_0x4225fb){if(_0x4225fb){var _0x47def8=_0x4225fb[_0x0328('0x1b')],_0x31f8e7=_0x59d1ba[_0x0328('0x1c')],_0x918c62=_0x59d1ba[_0x0328('0x1c')]+_0x59d1ba[_0x0328('0x1d')],_0x244ff2;if(_0x918c62>=_0x47def8){_0x918c62=_0x47def8;_0x244ff2=0xc8;}else{_0x244ff2=0xce;}_0x4704bb[_0x0328('0x18')](_0x244ff2);return _0x4704bb[_0x0328('0x1e')](_0x0328('0x1f'),_0x31f8e7+'-'+_0x918c62+'/'+_0x47def8)[_0x0328('0x1a')](_0x4225fb);}return null;};}function patchUpdates(_0x5218e9){return function(_0x51c870){try{jsonpatch['apply'](_0x51c870,_0x5218e9,!![]);}catch(_0x2136a1){return BPromise['reject'](_0x2136a1);}return _0x51c870[_0x0328('0x20')]();};}function saveUpdates(_0x28fc8,_0x38b5fa){return function(_0x225a15){if(_0x225a15){return _0x225a15[_0x0328('0x21')](_0x28fc8)['then'](function(_0x5ee63b){return _0x5ee63b;});}return null;};}function removeEntity(_0x27f7f4,_0x23cdc5){return function(_0x2c77a1){if(_0x2c77a1){return _0x2c77a1[_0x0328('0x22')]()['then'](function(){var _0x45ac5d=_0x2c77a1[_0x0328('0x23')]({'plain':!![]});var _0x27e86b='Dispositions';return db[_0x0328('0x24')][_0x0328('0x22')]({'where':{'type':_0x27e86b,'resourceId':_0x45ac5d['id']}})['then'](function(){return _0x2c77a1;});})[_0x0328('0x25')](function(){_0x27f7f4[_0x0328('0x18')](0xcc)[_0x0328('0x19')]();});}};}function handleEntityNotFound(_0x58de38,_0xa60f5f){return function(_0x2679b9){if(!_0x2679b9){_0x58de38['sendStatus'](0x194);}return _0x2679b9;};}function handleError(_0x5615b2,_0x23727d){_0x23727d=_0x23727d||0x1f4;return function(_0x218b6e){logger[_0x0328('0x26')](_0x218b6e[_0x0328('0x27')]);if(_0x218b6e[_0x0328('0x28')]){delete _0x218b6e[_0x0328('0x28')];}_0x5615b2[_0x0328('0x18')](_0x23727d)[_0x0328('0x29')](_0x218b6e);};}exports[_0x0328('0x2a')]=function(_0x1fa6fe,_0x6dfd9){var _0xfe65c1={},_0x53dc6c={},_0x345b9d={'count':0x0,'rows':[]};var _0x3500e9=db[_0x0328('0x2b')][_0x0328('0x2c')];_0x53dc6c['model']=_[_0x0328('0x2d')](_0x3500e9);_0x53dc6c[_0x0328('0x2e')]=_[_0x0328('0x2d')](_0x1fa6fe[_0x0328('0x2e')]);_0x53dc6c[_0x0328('0x2f')]=_[_0x0328('0x30')](_0x53dc6c[_0x0328('0x31')],_0x53dc6c['query']);_0xfe65c1['attributes']=_[_0x0328('0x30')](_0x53dc6c[_0x0328('0x31')],qs['fields'](_0x1fa6fe[_0x0328('0x2e')][_0x0328('0x32')]));_0xfe65c1[_0x0328('0x33')]=_0xfe65c1[_0x0328('0x33')][_0x0328('0x34')]?_0xfe65c1['attributes']:_0x53dc6c['model'];if(!_0x1fa6fe[_0x0328('0x2e')][_0x0328('0x35')](_0x0328('0x36'))){_0xfe65c1[_0x0328('0x1d')]=qs[_0x0328('0x1d')](_0x1fa6fe[_0x0328('0x2e')][_0x0328('0x1d')]);_0xfe65c1[_0x0328('0x1c')]=qs[_0x0328('0x1c')](_0x1fa6fe[_0x0328('0x2e')][_0x0328('0x1c')]);}_0xfe65c1['order']=qs[_0x0328('0x37')](_0x1fa6fe[_0x0328('0x2e')]['sort']);_0xfe65c1['where']=qs[_0x0328('0x2f')](_[_0x0328('0x38')](_0x1fa6fe['query'],_0x53dc6c[_0x0328('0x2f')]));if(_0x1fa6fe[_0x0328('0x2e')][_0x0328('0x39')]){_0xfe65c1[_0x0328('0x3a')]=_['merge'](_0xfe65c1[_0x0328('0x3a')],{'$or':_[_0x0328('0x3b')](_0x3500e9,function(_0x5b09a4){if(_0x5b09a4[_0x0328('0x3c')][_0x0328('0x3d')]!=='VIRTUAL'){var _0x443bd8={};_0x443bd8[_0x5b09a4[_0x0328('0x3e')]]={'$like':'%'+_0x1fa6fe['query'][_0x0328('0x39')]+'%'};return _0x443bd8;}})});}_0xfe65c1=_[_0x0328('0x3f')]({},_0xfe65c1,_0x1fa6fe['options']);var _0x127b27={'where':_0xfe65c1['where']};return db['Disposition'][_0x0328('0x1b')](_0x127b27)[_0x0328('0x25')](function(_0x49859e){_0x345b9d[_0x0328('0x1b')]=_0x49859e;if(_0x1fa6fe[_0x0328('0x2e')][_0x0328('0x40')]){_0xfe65c1[_0x0328('0x41')]=[{'all':!![]}];}return db[_0x0328('0x2b')]['findAll'](_0xfe65c1);})[_0x0328('0x25')](function(_0x3f62a6){_0x345b9d[_0x0328('0x42')]=_0x3f62a6;return _0x345b9d;})['then'](respondWithFilteredResult(_0x6dfd9,_0xfe65c1))[_0x0328('0x43')](handleError(_0x6dfd9,null));};exports[_0x0328('0x44')]=function(_0x5a06e8,_0x53ef7e){var _0x5da867={'raw':!![],'where':{'id':_0x5a06e8[_0x0328('0x45')]['id']}},_0xe37bfa={};_0xe37bfa['model']=_[_0x0328('0x2d')](db['Disposition']['rawAttributes']);_0xe37bfa['query']=_[_0x0328('0x2d')](_0x5a06e8['query']);_0xe37bfa[_0x0328('0x2f')]=_[_0x0328('0x30')](_0xe37bfa[_0x0328('0x31')],_0xe37bfa[_0x0328('0x2e')]);_0x5da867['attributes']=_[_0x0328('0x30')](_0xe37bfa[_0x0328('0x31')],qs[_0x0328('0x32')](_0x5a06e8[_0x0328('0x2e')][_0x0328('0x32')]));_0x5da867[_0x0328('0x33')]=_0x5da867[_0x0328('0x33')][_0x0328('0x34')]?_0x5da867[_0x0328('0x33')]:_0xe37bfa[_0x0328('0x31')];if(_0x5a06e8['query'][_0x0328('0x40')]){_0x5da867[_0x0328('0x41')]=[{'all':!![]}];}_0x5da867=_[_0x0328('0x3f')]({},_0x5da867,_0x5a06e8[_0x0328('0x46')]);return db[_0x0328('0x2b')][_0x0328('0x47')](_0x5da867)['then'](handleEntityNotFound(_0x53ef7e,null))[_0x0328('0x25')](respondWithResult(_0x53ef7e,null))[_0x0328('0x43')](handleError(_0x53ef7e,null));};exports[_0x0328('0x48')]=function(_0x463be2,_0x575739){return db[_0x0328('0x2b')][_0x0328('0x48')](_0x463be2['body'],{})[_0x0328('0x25')](function(_0x56bf1f){var _0x31428c=_0x463be2['user'][_0x0328('0x23')]({'plain':!![]});if(!_0x31428c)throw new Error(_0x0328('0x49'));if(_0x31428c['role']==='user'){var _0x5b60be=_0x56bf1f[_0x0328('0x23')]({'plain':!![]});var _0x2a3f8b='Dispositions';return db[_0x0328('0x4a')]['find']({'where':{'name':_0x2a3f8b,'userProfileId':_0x31428c[_0x0328('0x4b')]},'raw':!![]})[_0x0328('0x25')](function(_0x324b44){if(_0x324b44&&_0x324b44[_0x0328('0x4c')]===0x0){return db[_0x0328('0x24')][_0x0328('0x48')]({'name':_0x5b60be[_0x0328('0x28')],'resourceId':_0x5b60be['id'],'type':_0x324b44['name'],'sectionId':_0x324b44['id']},{})[_0x0328('0x25')](function(){return _0x56bf1f;});}else{return _0x56bf1f;}})[_0x0328('0x43')](function(_0x2f025e){logger[_0x0328('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f025e);throw _0x2f025e;});}return _0x56bf1f;})[_0x0328('0x25')](respondWithResult(_0x575739,0xc9))[_0x0328('0x43')](handleError(_0x575739,null));};exports[_0x0328('0x21')]=function(_0x2a9d1b,_0x5a5610){if(_0x2a9d1b[_0x0328('0x4d')]['id']){delete _0x2a9d1b[_0x0328('0x4d')]['id'];}return db['Disposition'][_0x0328('0x47')]({'where':{'id':_0x2a9d1b[_0x0328('0x45')]['id']}})[_0x0328('0x25')](handleEntityNotFound(_0x5a5610,null))[_0x0328('0x25')](saveUpdates(_0x2a9d1b[_0x0328('0x4d')],null))[_0x0328('0x25')](respondWithResult(_0x5a5610,null))['catch'](handleError(_0x5a5610,null));};exports['destroy']=function(_0x4323d5,_0x108009){return db[_0x0328('0x2b')][_0x0328('0x47')]({'where':{'id':_0x4323d5[_0x0328('0x45')]['id']}})[_0x0328('0x25')](handleEntityNotFound(_0x108009,null))[_0x0328('0x25')](removeEntity(_0x108009,null))[_0x0328('0x43')](handleError(_0x108009,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 1fd4d4f..93ecea7 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 _0xda2d=['name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','util','../../config/logger','api','moment','bluebird','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat'];(function(_0x18f790,_0x19bda5){var _0x54eda7=function(_0x2164e8){while(--_0x2164e8){_0x18f790['push'](_0x18f790['shift']());}};_0x54eda7(++_0x19bda5);}(_0xda2d,0x102));var _0xdda2=function(_0x41e0cc,_0x5f1536){_0x41e0cc=_0x41e0cc-0x0;var _0x96bbc6=_0xda2d[_0x41e0cc];return _0x96bbc6;};'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('./disposition.attributes');module['exports']=function(_0x357e97,_0x319129){return _0x357e97[_0xdda2('0x5')](_0xdda2('0x6'),attributes,{'tableName':_0xdda2('0x7'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xdda2('0x8'),'fields':[_0xdda2('0x9'),_0xdda2('0xa')]},{'unique':!![],'name':_0xdda2('0xb'),'fields':[_0xdda2('0x9'),'ChatWebsiteId']},{'unique':!![],'name':_0xdda2('0xc'),'fields':[_0xdda2('0x9'),'MailAccountId']},{'unique':!![],'name':_0xdda2('0xd'),'fields':[_0xdda2('0x9'),_0xdda2('0xe')]},{'unique':!![],'name':_0xdda2('0xf'),'fields':[_0xdda2('0x9'),_0xdda2('0x10')]},{'unique':!![],'name':_0xdda2('0x11'),'fields':[_0xdda2('0x9'),'OpenchannelAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1967=['moment','bluebird','request-promise','./disposition.attributes','exports','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','util','../../config/logger','api'];(function(_0x41f543,_0x3b65be){var _0x3fe279=function(_0x12de85){while(--_0x12de85){_0x41f543['push'](_0x41f543['shift']());}};_0x3fe279(++_0x3b65be);}(_0x1967,0x173));var _0x7196=function(_0x3c881f,_0x20f886){_0x3c881f=_0x3c881f-0x0;var _0x2ca3fc=_0x1967[_0x3c881f];return _0x2ca3fc;};'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':[{'unique':!![],'name':_0x7196('0xa'),'fields':[_0x7196('0xb'),_0x7196('0xc')]},{'unique':!![],'name':_0x7196('0xd'),'fields':['name',_0x7196('0xe')]},{'unique':!![],'name':_0x7196('0xf'),'fields':[_0x7196('0xb'),_0x7196('0x10')]},{'unique':!![],'name':_0x7196('0x11'),'fields':['name','SmsAccountId']},{'unique':!![],'name':_0x7196('0x12'),'fields':[_0x7196('0xb'),_0x7196('0x13')]},{'unique':!![],'name':_0x7196('0x14'),'fields':[_0x7196('0xb'),_0x7196('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 0996efb..e60c140 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 _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5bc605,_0x32ee71){var _0x479935=function(_0x44686d){while(--_0x44686d){_0x5bc605['push'](_0x5bc605['shift']());}};_0x479935(++_0x32ee71);}(_0x6aa7,0x178));var _0x76aa=function(_0x3ffbbb,_0x3e0f86){_0x3ffbbb=_0x3ffbbb-0x0;var _0x935384=_0x6aa7[_0x3ffbbb];return _0x935384;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file +var _0x4006=['moment','bluebird','randomstring','../../config/utils','rpc','client','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util'];(function(_0x11d777,_0x39239a){var _0x151ae0=function(_0x33d99c){while(--_0x33d99c){_0x11d777['push'](_0x11d777['shift']());}};_0x151ae0(++_0x39239a);}(_0x4006,0x1c7));var _0x6400=function(_0x13420e,_0x36404c){_0x13420e=_0x13420e-0x0;var _0x536019=_0x4006[_0x13420e];return _0x536019;};'use strict';var _=require('lodash');var util=require(_0x6400('0x0'));var moment=require(_0x6400('0x1'));var BPromise=require(_0x6400('0x2'));var rs=require(_0x6400('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6400('0x4'));var logger=require('../../config/logger')(_0x6400('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6400('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32c0db,_0x2d365b,_0x2bf4f8){return new BPromise(function(_0x250dba,_0x5cbe4f){return client[_0x6400('0x7')](_0x32c0db,_0x2bf4f8)[_0x6400('0x8')](function(_0x31a8d0){logger[_0x6400('0x9')](_0x6400('0xa'),_0x2d365b,_0x6400('0xb'));logger[_0x6400('0xc')](_0x6400('0xd'),_0x2d365b,_0x6400('0xb'),JSON[_0x6400('0xe')](_0x31a8d0));if(_0x31a8d0[_0x6400('0xf')]){if(_0x31a8d0['error'][_0x6400('0x10')]===0x1f4){logger[_0x6400('0xf')](_0x6400('0xa'),_0x2d365b,_0x31a8d0[_0x6400('0xf')]['message']);return _0x5cbe4f(_0x31a8d0[_0x6400('0xf')][_0x6400('0x11')]);}logger['error']('Disposition,\x20%s,\x20%s',_0x2d365b,_0x31a8d0['error'][_0x6400('0x11')]);return _0x250dba(_0x31a8d0[_0x6400('0xf')]['message']);}else{logger[_0x6400('0x9')]('Disposition,\x20%s,\x20%s',_0x2d365b,_0x6400('0xb'));_0x250dba(_0x31a8d0['result'][_0x6400('0x11')]);}})[_0x6400('0x12')](function(_0x276fb2){logger[_0x6400('0xf')]('Disposition,\x20%s,\x20%s',_0x2d365b,_0x276fb2);_0x5cbe4f(_0x276fb2);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index ac284dd..cf7dac5 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 _0x27da=['isAuthenticated','index','get','/:id','show','post','update','destroy','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./disposition.controller'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x27da,0x1ac));var _0xa27d=function(_0x512ea8,_0x141f86){_0x512ea8=_0x512ea8-0x0;var _0x4aad88=_0x27da[_0x512ea8];return _0x4aad88;};'use strict';var multer=require(_0xa27d('0x0'));var util=require('util');var path=require(_0xa27d('0x1'));var timeout=require(_0xa27d('0x2'));var express=require('express');var router=express[_0xa27d('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa27d('0x4'));var config=require(_0xa27d('0x5'));var controller=require(_0xa27d('0x6'));router['get']('/',auth[_0xa27d('0x7')](),controller[_0xa27d('0x8')]);router[_0xa27d('0x9')](_0xa27d('0xa'),auth['isAuthenticated'](),controller[_0xa27d('0xb')]);router[_0xa27d('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa27d('0xa'),auth[_0xa27d('0x7')](),controller[_0xa27d('0xd')]);router['delete'](_0xa27d('0xa'),auth[_0xa27d('0x7')](),controller[_0xa27d('0xe')]);module['exports']=router; \ No newline at end of file +var _0x1015=['exports','multer','express','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete'];(function(_0x1878a8,_0x36d1b2){var _0x5a68d5=function(_0x57f47d){while(--_0x57f47d){_0x1878a8['push'](_0x1878a8['shift']());}};_0x5a68d5(++_0x36d1b2);}(_0x1015,0x79));var _0x5101=function(_0x1e3793,_0x55857c){_0x1e3793=_0x1e3793-0x0;var _0x55dcdb=_0x1015[_0x1e3793];return _0x55dcdb;};'use strict';var multer=require(_0x5101('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5101('0x1'));var router=express['Router']();var auth=require(_0x5101('0x2'));var interaction=require(_0x5101('0x3'));var config=require('../../config/environment');var controller=require(_0x5101('0x4'));router[_0x5101('0x5')]('/',auth[_0x5101('0x6')](),controller[_0x5101('0x7')]);router[_0x5101('0x5')](_0x5101('0x8'),auth[_0x5101('0x6')](),controller['show']);router[_0x5101('0x9')]('/',auth['isAuthenticated'](),controller[_0x5101('0xa')]);router[_0x5101('0xb')](_0x5101('0x8'),auth[_0x5101('0x6')](),controller[_0x5101('0xc')]);router[_0x5101('0xd')](_0x5101('0x8'),auth[_0x5101('0x6')](),controller['destroy']);module[_0x5101('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 0810cbf..43f30e0 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 _0x3153=['7200','14400','INTEGER','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','12000'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3153,0x17d));var _0x3315=function(_0x4b889d,_0x20dc8a){_0x4b889d=_0x4b889d-0x0;var _0x544358=_0x3153[_0x4b889d];return _0x544358;};'use strict';var Sequelize=require(_0x3315('0x0'));module[_0x3315('0x1')]={'name':{'type':Sequelize[_0x3315('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3315('0x2')]},'ecm':{'type':Sequelize[_0x3315('0x3')]('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x3315('0x2')],'defaultValue':_0x3315('0x4')},'localstationid':{'type':Sequelize[_0x3315('0x2')],'unique':_0x3315('0x5')},'minrate':{'type':Sequelize['ENUM'](_0x3315('0x6'),_0x3315('0x7'),'7200',_0x3315('0x8'),_0x3315('0x9'),'14400'),'defaultValue':_0x3315('0x7')},'maxrate':{'type':Sequelize['ENUM'](_0x3315('0x6'),_0x3315('0x7'),_0x3315('0xa'),_0x3315('0x8'),'12000',_0x3315('0xb')),'defaultValue':_0x3315('0xb')},'modem':{'type':Sequelize[_0x3315('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x3315('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x3315('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x3315('0xd'),_0x3315('0xe'),_0x3315('0xf'),'KHOMP'),'defaultValue':_0x3315('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3315('0x10')],'defaultValue':function(){return _0x3315('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3315('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3315('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3315('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3315('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3315('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3315('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x3315('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x3315('0x12')],'defaultValue':![],'comment':_0x3315('0x14'),'set':function(_0x5a5b8c){if(!_0x5a5b8c)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x3315('0x15')](_0x3315('0x16'),_0x5a5b8c);}}}; \ No newline at end of file +var _0xaff0=['9600','7200','14400','INTEGER','SIP','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','yes','localstationid','2400','4800'];(function(_0x152fe3,_0x12b0c8){var _0xc5bb39=function(_0x1fde42){while(--_0x1fde42){_0x152fe3['push'](_0x152fe3['shift']());}};_0xc5bb39(++_0x12b0c8);}(_0xaff0,0x1b2));var _0x0aff=function(_0x3952b1,_0x2bfea1){_0x3952b1=_0x3952b1-0x0;var _0x52b967=_0xaff0[_0x3952b1];return _0x52b967;};'use strict';var Sequelize=require(_0x0aff('0x0'));module['exports']={'name':{'type':Sequelize[_0x0aff('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x0aff('0x2')]('yes','no'),'defaultValue':_0x0aff('0x3')},'headerinfo':{'type':Sequelize[_0x0aff('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x0aff('0x1')],'unique':_0x0aff('0x4')},'minrate':{'type':Sequelize[_0x0aff('0x2')](_0x0aff('0x5'),_0x0aff('0x6'),'7200',_0x0aff('0x7'),'12000','14400'),'defaultValue':_0x0aff('0x6')},'maxrate':{'type':Sequelize[_0x0aff('0x2')](_0x0aff('0x5'),_0x0aff('0x6'),_0x0aff('0x8'),_0x0aff('0x7'),'12000',_0x0aff('0x9')),'defaultValue':_0x0aff('0x9')},'modem':{'type':Sequelize[_0x0aff('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x0aff('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x0aff('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x0aff('0xa')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x0aff('0x2')](_0x0aff('0xb'),_0x0aff('0xc'),'DADHI',_0x0aff('0xd')),'defaultValue':_0x0aff('0xb')},'key':{'type':Sequelize[_0x0aff('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0aff('0xe')],'defaultValue':function(){return _0x0aff('0xf');}},'notificationSound':{'type':Sequelize[_0x0aff('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0aff('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0aff('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0aff('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0aff('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0aff('0xa')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x0aff('0x10')],'defaultValue':![],'comment':_0x0aff('0x11'),'set':function(_0x3dee1d){if(!_0x3dee1d)this[_0x0aff('0x12')](_0x0aff('0x13'),null);this[_0x0aff('0x12')](_0x0aff('0x14'),_0x3dee1d);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 3a90937..4d08d82 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 _0xdbaf=['CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','User','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','update','FaxAccounts','UserProfileResource','destroy','sendStatus','stack','name','send','index','mandatoryDispositionPause','FaxAccount','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','map','type','key','field','merge','includeAll','include','findAll','rows','show','params','Pause','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','options','removeDispositions','ids','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','CmContact','Contact','Owner','Tag','Tags','color','tag','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','omit','tech','createdAt','updatedAt','TrunkId','ListId','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xdbaf,0x1ab));var _0xfdba=function(_0x3cb645,_0x3836af){_0x3cb645=_0x3cb645-0x0;var _0x221214=_0xdbaf[_0x3cb645];return _0x221214;};'use strict';var pdf=require(_0xfdba('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfdba('0x1'));var zipdir=require(_0xfdba('0x2'));var jsonpatch=require(_0xfdba('0x3'));var rp=require(_0xfdba('0x4'));var moment=require('moment');var BPromise=require(_0xfdba('0x5'));var Mustache=require('mustache');var util=require(_0xfdba('0x6'));var path=require(_0xfdba('0x7'));var sox=require(_0xfdba('0x8'));var csv=require(_0xfdba('0x9'));var ejs=require(_0xfdba('0xa'));var fs=require('fs');var _=require(_0xfdba('0xb'));var squel=require(_0xfdba('0xc'));var crypto=require(_0xfdba('0xd'));var jsforce=require(_0xfdba('0xe'));var deskjs=require(_0xfdba('0xf'));var toCsv=require(_0xfdba('0x9'));var querystring=require(_0xfdba('0x10'));var Papa=require(_0xfdba('0x11'));var authService=require(_0xfdba('0x12'));var hardwareService=require(_0xfdba('0x13'));var Redis=require(_0xfdba('0x14'));var qs=require(_0xfdba('0x15'));var logger=require(_0xfdba('0x16'))(_0xfdba('0x17'));var utils=require(_0xfdba('0x18'));var config=require(_0xfdba('0x19'));var db=require(_0xfdba('0x1a'))['db'];config['redis']=_[_0xfdba('0x1b')](config[_0xfdba('0x1c')],{'host':_0xfdba('0x1d'),'port':0x18eb});var socket=require(_0xfdba('0x1e'))(new Redis(config[_0xfdba('0x1c')]));require(_0xfdba('0x1f'))[_0xfdba('0x20')](socket);var jayson=require(_0xfdba('0x21'));var client=jayson[_0xfdba('0x22')][_0xfdba('0x23')]({'port':0x232c});var client9002=jayson[_0xfdba('0x22')][_0xfdba('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x4d8894,_0x58f66d,_0x713e9f,_0x34062e){return new BPromise(function(_0x2963a8,_0x57e5f7){var _0x22f335=_0x34062e||client;return _0x22f335[_0xfdba('0x24')](_0x4d8894,_0x713e9f)[_0xfdba('0x25')](function(_0x23ef00){logger[_0xfdba('0x26')](_0xfdba('0x27'),_0x58f66d,_0xfdba('0x28'));logger[_0xfdba('0x29')](_0xfdba('0x2a'),_0x58f66d,_0xfdba('0x28'),JSON[_0xfdba('0x2b')](_0x23ef00));if(_0x23ef00[_0xfdba('0x2c')]){if(_0x23ef00[_0xfdba('0x2c')]['code']===0x1f4){logger[_0xfdba('0x2c')](_0xfdba('0x27'),_0x58f66d,_0x23ef00[_0xfdba('0x2c')][_0xfdba('0x2d')]);return _0x57e5f7(_0x23ef00[_0xfdba('0x2c')][_0xfdba('0x2d')]);}logger[_0xfdba('0x2c')]('FaxAccount,\x20%s,\x20%s',_0x58f66d,_0x23ef00[_0xfdba('0x2c')][_0xfdba('0x2d')]);return _0x2963a8(_0x23ef00[_0xfdba('0x2c')][_0xfdba('0x2d')]);}else{logger['info'](_0xfdba('0x27'),_0x58f66d,_0xfdba('0x28'));_0x2963a8(_0x23ef00[_0xfdba('0x2e')][_0xfdba('0x2d')]);}})[_0xfdba('0x2f')](function(_0x52faa0){logger[_0xfdba('0x2c')](_0xfdba('0x27'),_0x58f66d,_0x52faa0);_0x57e5f7(_0x52faa0);});});}function respondWithStatusCode(_0x548e4f,_0x28e27e){_0x28e27e=_0x28e27e||0xcc;return function(_0x59b05d){if(_0x59b05d){return _0x548e4f['sendStatus'](_0x28e27e);}return _0x548e4f[_0xfdba('0x30')](_0x28e27e)[_0xfdba('0x31')]();};}function respondWithResult(_0x47160c,_0x294c26){_0x294c26=_0x294c26||0xc8;return function(_0x463fbb){if(_0x463fbb){return _0x47160c[_0xfdba('0x30')](_0x294c26)[_0xfdba('0x32')](_0x463fbb);}};}function respondWithFilteredResult(_0x470d8a,_0xfc8a07){return function(_0x3334d9){if(_0x3334d9){var _0x42cd49=_0x3334d9[_0xfdba('0x33')],_0x5524e9=_0xfc8a07['offset'],_0x4a1cf1=_0xfc8a07[_0xfdba('0x34')]+_0xfc8a07[_0xfdba('0x35')],_0x2da7b2;if(_0x4a1cf1>=_0x42cd49){_0x4a1cf1=_0x42cd49;_0x2da7b2=0xc8;}else{_0x2da7b2=0xce;}_0x470d8a['status'](_0x2da7b2);return _0x470d8a[_0xfdba('0x36')](_0xfdba('0x37'),_0x5524e9+'-'+_0x4a1cf1+'/'+_0x42cd49)['json'](_0x3334d9);}return null;};}function patchUpdates(_0x389b44){return function(_0x223dad){try{jsonpatch[_0xfdba('0x38')](_0x223dad,_0x389b44,!![]);}catch(_0x3d75ac){return BPromise['reject'](_0x3d75ac);}return _0x223dad['save']();};}function saveUpdates(_0x164ba1,_0x4fb093){return function(_0x1ac3f3){if(_0x1ac3f3){return _0x1ac3f3[_0xfdba('0x39')](_0x164ba1)[_0xfdba('0x25')](function(_0x555201){return _0x555201;});}return null;};}function removeEntity(_0xc99345,_0x474fbf){return function(_0x4e979a){if(_0x4e979a){return _0x4e979a['destroy']()[_0xfdba('0x25')](function(){var _0x5b9afa=_0x4e979a['get']({'plain':!![]});var _0x3da544=_0xfdba('0x3a');return db[_0xfdba('0x3b')][_0xfdba('0x3c')]({'where':{'type':_0x3da544,'resourceId':_0x5b9afa['id']}})[_0xfdba('0x25')](function(){return _0x4e979a;});})['then'](function(){_0xc99345[_0xfdba('0x30')](0xcc)[_0xfdba('0x31')]();});}};}function handleEntityNotFound(_0x326d5c,_0x36da69){return function(_0x2f3dcb){if(!_0x2f3dcb){_0x326d5c[_0xfdba('0x3d')](0x194);}return _0x2f3dcb;};}function handleError(_0x189c9a,_0x26a478){_0x26a478=_0x26a478||0x1f4;return function(_0x3241bb){logger[_0xfdba('0x2c')](_0x3241bb[_0xfdba('0x3e')]);if(_0x3241bb['name']){delete _0x3241bb[_0xfdba('0x3f')];}_0x189c9a['status'](_0x26a478)[_0xfdba('0x40')](_0x3241bb);};}exports[_0xfdba('0x41')]=function(_0x358fc0,_0xadcc19){var _0xedee5b={'include':[{'model':db['Pause'],'as':_0xfdba('0x42')}]},_0x125e3f={},_0x53e7b6={'count':0x0,'rows':[]};var _0x3627f4=db[_0xfdba('0x43')][_0xfdba('0x44')];_0x125e3f['model']=_[_0xfdba('0x45')](_0x3627f4);_0x125e3f[_0xfdba('0x46')]=_['keys'](_0x358fc0[_0xfdba('0x46')]);_0x125e3f[_0xfdba('0x47')]=_[_0xfdba('0x48')](_0x125e3f[_0xfdba('0x49')],_0x125e3f[_0xfdba('0x46')]);_0xedee5b[_0xfdba('0x4a')]=_[_0xfdba('0x48')](_0x125e3f[_0xfdba('0x49')],qs[_0xfdba('0x4b')](_0x358fc0[_0xfdba('0x46')][_0xfdba('0x4b')]));_0xedee5b[_0xfdba('0x4a')]=_0xedee5b['attributes'][_0xfdba('0x4c')]?_0xedee5b[_0xfdba('0x4a')]:_0x125e3f[_0xfdba('0x49')];if(!_0x358fc0[_0xfdba('0x46')][_0xfdba('0x4d')]('nolimit')){_0xedee5b[_0xfdba('0x35')]=qs[_0xfdba('0x35')](_0x358fc0['query'][_0xfdba('0x35')]);_0xedee5b[_0xfdba('0x34')]=qs[_0xfdba('0x34')](_0x358fc0[_0xfdba('0x46')]['offset']);}_0xedee5b[_0xfdba('0x4e')]=qs[_0xfdba('0x4f')](_0x358fc0[_0xfdba('0x46')][_0xfdba('0x4f')]);_0xedee5b[_0xfdba('0x50')]=qs[_0xfdba('0x47')](_[_0xfdba('0x51')](_0x358fc0[_0xfdba('0x46')],_0x125e3f['filters']));if(_0x358fc0['query'][_0xfdba('0x52')]){_0xedee5b[_0xfdba('0x50')]=_['merge'](_0xedee5b[_0xfdba('0x50')],{'$or':_[_0xfdba('0x53')](_0x3627f4,function(_0x22594a){if(_0x22594a[_0xfdba('0x54')][_0xfdba('0x55')]!=='VIRTUAL'){var _0x26d8b4={};_0x26d8b4[_0x22594a[_0xfdba('0x56')]]={'$like':'%'+_0x358fc0['query'][_0xfdba('0x52')]+'%'};return _0x26d8b4;}})});}_0xedee5b=_[_0xfdba('0x57')]({},_0xedee5b,_0x358fc0['options']);var _0x4f6f79={'where':_0xedee5b[_0xfdba('0x50')]};return db['FaxAccount'][_0xfdba('0x33')](_0x4f6f79)['then'](function(_0xb57ee4){_0x53e7b6[_0xfdba('0x33')]=_0xb57ee4;if(_0x358fc0[_0xfdba('0x46')][_0xfdba('0x58')]){_0xedee5b[_0xfdba('0x59')]=[{'all':!![]}];}return db[_0xfdba('0x43')][_0xfdba('0x5a')](_0xedee5b);})[_0xfdba('0x25')](function(_0x280eaa){_0x53e7b6[_0xfdba('0x5b')]=_0x280eaa;return _0x53e7b6;})['then'](respondWithFilteredResult(_0xadcc19,_0xedee5b))[_0xfdba('0x2f')](handleError(_0xadcc19,null));};exports[_0xfdba('0x5c')]=function(_0x52c9d4,_0x48a5e4){var _0x269a58={'raw':![],'where':{'id':_0x52c9d4[_0xfdba('0x5d')]['id']},'include':[{'model':db[_0xfdba('0x5e')],'as':_0xfdba('0x42')}]},_0x567e45={};_0x567e45[_0xfdba('0x49')]=_[_0xfdba('0x45')](db['FaxAccount']['rawAttributes']);_0x567e45['query']=_['keys'](_0x52c9d4[_0xfdba('0x46')]);_0x567e45[_0xfdba('0x47')]=_[_0xfdba('0x48')](_0x567e45[_0xfdba('0x49')],_0x567e45[_0xfdba('0x46')]);_0x269a58[_0xfdba('0x4a')]=_['intersection'](_0x567e45[_0xfdba('0x49')],qs[_0xfdba('0x4b')](_0x52c9d4[_0xfdba('0x46')][_0xfdba('0x4b')]));_0x269a58[_0xfdba('0x4a')]=_0x269a58[_0xfdba('0x4a')][_0xfdba('0x4c')]?_0x269a58[_0xfdba('0x4a')]:_0x567e45[_0xfdba('0x49')];if(_0x52c9d4['query'][_0xfdba('0x58')]){_0x269a58['include']=[{'all':!![]}];}_0x269a58=_['merge']({},_0x269a58,_0x52c9d4['options']);return db['FaxAccount']['find'](_0x269a58)[_0xfdba('0x25')](handleEntityNotFound(_0x48a5e4,null))[_0xfdba('0x25')](respondWithResult(_0x48a5e4,null))[_0xfdba('0x2f')](handleError(_0x48a5e4,null));};exports[_0xfdba('0x5f')]=function(_0x48385e,_0x21caef){return db[_0xfdba('0x43')]['create'](_0x48385e['body'],{})[_0xfdba('0x25')](function(_0xbefb71){var _0x4244b4=_0x48385e[_0xfdba('0x60')]['get']({'plain':!![]});if(!_0x4244b4)throw new Error(_0xfdba('0x61'));if(_0x4244b4['role']===_0xfdba('0x60')){var _0xbca098=_0xbefb71[_0xfdba('0x62')]({'plain':!![]});var _0x2f764d=_0xfdba('0x3a');return db['UserProfileSection'][_0xfdba('0x63')]({'where':{'name':_0x2f764d,'userProfileId':_0x4244b4[_0xfdba('0x64')]},'raw':!![]})[_0xfdba('0x25')](function(_0x24e275){if(_0x24e275&&_0x24e275[_0xfdba('0x65')]===0x0){return db[_0xfdba('0x3b')][_0xfdba('0x5f')]({'name':_0xbca098[_0xfdba('0x3f')],'resourceId':_0xbca098['id'],'type':_0x24e275[_0xfdba('0x3f')],'sectionId':_0x24e275['id']},{})[_0xfdba('0x25')](function(){return _0xbefb71;});}else{return _0xbefb71;}})[_0xfdba('0x2f')](function(_0x50c2fa){logger['error'](_0xfdba('0x66'),_0x50c2fa);throw _0x50c2fa;});}return _0xbefb71;})[_0xfdba('0x25')](respondWithResult(_0x21caef,0xc9))[_0xfdba('0x2f')](handleError(_0x21caef,null));};exports[_0xfdba('0x39')]=function(_0x3e6201,_0x39e225){if(_0x3e6201[_0xfdba('0x67')]['id']){delete _0x3e6201[_0xfdba('0x67')]['id'];}return db[_0xfdba('0x43')][_0xfdba('0x63')]({'where':{'id':_0x3e6201[_0xfdba('0x5d')]['id']},'include':[{'model':db[_0xfdba('0x5e')],'as':_0xfdba('0x42')}]})['then'](handleEntityNotFound(_0x39e225,null))[_0xfdba('0x25')](saveUpdates(_0x3e6201[_0xfdba('0x67')],null))[_0xfdba('0x25')](respondWithResult(_0x39e225,null))[_0xfdba('0x2f')](handleError(_0x39e225,null));};exports[_0xfdba('0x3c')]=function(_0x4851e6,_0x176e75){return db[_0xfdba('0x43')]['find']({'where':{'id':_0x4851e6['params']['id']}})[_0xfdba('0x25')](handleEntityNotFound(_0x176e75,null))['then'](removeEntity(_0x176e75,null))[_0xfdba('0x2f')](handleError(_0x176e75,null));};exports[_0xfdba('0x68')]=function(_0x181ad7,_0x5732dc){return db[_0xfdba('0x43')]['describe']()[_0xfdba('0x25')](respondWithResult(_0x5732dc,null))[_0xfdba('0x2f')](handleError(_0x5732dc,null));};exports[_0xfdba('0x69')]=function(_0x462dbd,_0x3bea2e,_0x160730){if(_0x462dbd['body']['id']){delete _0x462dbd[_0xfdba('0x67')]['id'];}return db[_0xfdba('0x43')]['find']({'where':{'id':_0x462dbd[_0xfdba('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3bea2e,null))[_0xfdba('0x25')](function(_0x2d3dc8){if(_0x2d3dc8){_0x462dbd['body'][_0xfdba('0x6a')]=_0x2d3dc8['id'];return db[_0xfdba('0x6b')][_0xfdba('0x5f')](_0x462dbd[_0xfdba('0x67')]);}})[_0xfdba('0x25')](respondWithResult(_0x3bea2e,null))[_0xfdba('0x2f')](handleError(_0x3bea2e,null));};exports[_0xfdba('0x6c')]=function(_0x33eea7,_0x181c2a,_0x5aa314){var _0x149e48={'raw':![],'where':{}};var _0x103f8f={};var _0x1545bb={'count':0x0,'rows':[]};return db[_0xfdba('0x43')][_0xfdba('0x6d')]({'where':{'id':_0x33eea7['params']['id']}})[_0xfdba('0x25')](handleEntityNotFound(_0x181c2a,null))[_0xfdba('0x25')](function(_0x127251){if(_0x127251){_0x103f8f[_0xfdba('0x49')]=_[_0xfdba('0x45')](db[_0xfdba('0x6b')][_0xfdba('0x44')]);_0x103f8f[_0xfdba('0x46')]=_['keys'](_0x33eea7[_0xfdba('0x46')]);_0x103f8f[_0xfdba('0x47')]=_[_0xfdba('0x48')](_0x103f8f[_0xfdba('0x49')],_0x103f8f[_0xfdba('0x46')]);_0x149e48[_0xfdba('0x4a')]=_[_0xfdba('0x48')](_0x103f8f[_0xfdba('0x49')],qs[_0xfdba('0x4b')](_0x33eea7[_0xfdba('0x46')][_0xfdba('0x4b')]));_0x149e48[_0xfdba('0x4a')]=_0x149e48['attributes'][_0xfdba('0x4c')]?_0x149e48[_0xfdba('0x4a')]:_0x103f8f[_0xfdba('0x49')];if(!_0x33eea7['query'][_0xfdba('0x4d')](_0xfdba('0x6e'))){_0x149e48[_0xfdba('0x35')]=qs[_0xfdba('0x35')](_0x33eea7[_0xfdba('0x46')][_0xfdba('0x35')]);_0x149e48['offset']=qs[_0xfdba('0x34')](_0x33eea7['query'][_0xfdba('0x34')]);}_0x149e48['order']=qs['sort'](_0x33eea7['query'][_0xfdba('0x4f')]);_0x149e48[_0xfdba('0x50')]=qs[_0xfdba('0x47')](_[_0xfdba('0x51')](_0x33eea7['query'],_0x103f8f[_0xfdba('0x47')]));_0x149e48[_0xfdba('0x50')][_0xfdba('0x6a')]=_0x127251['id'];if(_0x33eea7['query'][_0xfdba('0x52')]){_0x149e48[_0xfdba('0x50')]=_[_0xfdba('0x57')](_0x149e48[_0xfdba('0x50')],{'$or':_[_0xfdba('0x53')](_0x149e48['attributes'],function(_0x4c1576){var _0x599908={};_0x599908[_0x4c1576]={'$like':'%'+_0x33eea7[_0xfdba('0x46')][_0xfdba('0x52')]+'%'};return _0x599908;})});}_0x149e48=_[_0xfdba('0x57')]({},_0x149e48,_0x33eea7[_0xfdba('0x6f')]);return db[_0xfdba('0x6b')][_0xfdba('0x33')]({'where':_0x149e48[_0xfdba('0x50')]})[_0xfdba('0x25')](function(_0x3a2012){_0x1545bb['count']=_0x3a2012;if(_0x33eea7[_0xfdba('0x46')]['includeAll']){_0x149e48[_0xfdba('0x59')]=[{'all':!![]}];}return db[_0xfdba('0x6b')][_0xfdba('0x5a')](_0x149e48);})[_0xfdba('0x25')](function(_0x397784){_0x1545bb[_0xfdba('0x5b')]=_0x397784;return _0x1545bb;});}})[_0xfdba('0x25')](respondWithFilteredResult(_0x181c2a,_0x149e48))[_0xfdba('0x2f')](handleError(_0x181c2a,null));};exports[_0xfdba('0x70')]=function(_0x725fb,_0x229c3a,_0x4ea05d){var _0x1358e5;return db[_0xfdba('0x43')]['find']({'where':{'id':_0x725fb[_0xfdba('0x5d')]['id']}})['then'](handleEntityNotFound(_0x229c3a,null))[_0xfdba('0x25')](function(_0x2aec79){if(_0x2aec79){return _0x2aec79[_0xfdba('0x70')](_0x725fb[_0xfdba('0x46')][_0xfdba('0x71')]);}})['then'](respondWithStatusCode(_0x229c3a,null))[_0xfdba('0x2f')](handleError(_0x229c3a,null));};exports['addAnswer']=function(_0x5c539a,_0x343ad9,_0x203826){if(_0x5c539a[_0xfdba('0x67')]['id']){delete _0x5c539a[_0xfdba('0x67')]['id'];}return db[_0xfdba('0x43')][_0xfdba('0x63')]({'where':{'id':_0x5c539a[_0xfdba('0x5d')]['id']}})[_0xfdba('0x25')](handleEntityNotFound(_0x343ad9,null))[_0xfdba('0x25')](function(_0x653620){if(_0x653620){_0x5c539a['body'][_0xfdba('0x6a')]=_0x653620['id'];return db['CannedAnswer'][_0xfdba('0x5f')](_0x5c539a[_0xfdba('0x67')]);}})[_0xfdba('0x25')](respondWithResult(_0x343ad9,null))[_0xfdba('0x2f')](handleError(_0x343ad9,null));};exports['getAnswers']=function(_0x5c3c2c,_0x39b3bf,_0x58e747){var _0x3ebc53={'raw':![],'where':{}};var _0x16f2f0={};var _0x568668={'count':0x0,'rows':[]};return db[_0xfdba('0x43')][_0xfdba('0x6d')]({'where':{'id':_0x5c3c2c[_0xfdba('0x5d')]['id']}})[_0xfdba('0x25')](handleEntityNotFound(_0x39b3bf,null))['then'](function(_0x28dacb){if(_0x28dacb){_0x16f2f0[_0xfdba('0x49')]=_[_0xfdba('0x45')](db['CannedAnswer'][_0xfdba('0x44')]);_0x16f2f0[_0xfdba('0x46')]=_['keys'](_0x5c3c2c['query']);_0x16f2f0['filters']=_[_0xfdba('0x48')](_0x16f2f0[_0xfdba('0x49')],_0x16f2f0['query']);_0x3ebc53[_0xfdba('0x4a')]=_[_0xfdba('0x48')](_0x16f2f0[_0xfdba('0x49')],qs[_0xfdba('0x4b')](_0x5c3c2c[_0xfdba('0x46')]['fields']));_0x3ebc53[_0xfdba('0x4a')]=_0x3ebc53['attributes'][_0xfdba('0x4c')]?_0x3ebc53[_0xfdba('0x4a')]:_0x16f2f0['model'];if(!_0x5c3c2c[_0xfdba('0x46')][_0xfdba('0x4d')](_0xfdba('0x6e'))){_0x3ebc53[_0xfdba('0x35')]=qs[_0xfdba('0x35')](_0x5c3c2c['query'][_0xfdba('0x35')]);_0x3ebc53['offset']=qs[_0xfdba('0x34')](_0x5c3c2c[_0xfdba('0x46')][_0xfdba('0x34')]);}_0x3ebc53[_0xfdba('0x4e')]=qs['sort'](_0x5c3c2c[_0xfdba('0x46')][_0xfdba('0x4f')]);_0x3ebc53[_0xfdba('0x50')]=qs[_0xfdba('0x47')](_[_0xfdba('0x51')](_0x5c3c2c[_0xfdba('0x46')],_0x16f2f0[_0xfdba('0x47')]));_0x3ebc53[_0xfdba('0x50')][_0xfdba('0x6a')]=_0x28dacb['id'];if(_0x5c3c2c[_0xfdba('0x46')]['filter']){_0x3ebc53['where']=_[_0xfdba('0x57')](_0x3ebc53['where'],{'$or':_[_0xfdba('0x53')](_0x3ebc53[_0xfdba('0x4a')],function(_0xc657dc){var _0x4b41df={};_0x4b41df[_0xc657dc]={'$like':'%'+_0x5c3c2c[_0xfdba('0x46')][_0xfdba('0x52')]+'%'};return _0x4b41df;})});}_0x3ebc53=_[_0xfdba('0x57')]({},_0x3ebc53,_0x5c3c2c['options']);return db['CannedAnswer'][_0xfdba('0x33')]({'where':_0x3ebc53[_0xfdba('0x50')]})[_0xfdba('0x25')](function(_0x2ca428){_0x568668[_0xfdba('0x33')]=_0x2ca428;if(_0x5c3c2c[_0xfdba('0x46')][_0xfdba('0x58')]){_0x3ebc53[_0xfdba('0x59')]=[{'all':!![]}];}return db[_0xfdba('0x72')]['findAll'](_0x3ebc53);})[_0xfdba('0x25')](function(_0x23d7ab){_0x568668[_0xfdba('0x5b')]=_0x23d7ab;return _0x568668;});}})[_0xfdba('0x25')](respondWithFilteredResult(_0x39b3bf,_0x3ebc53))[_0xfdba('0x2f')](handleError(_0x39b3bf,null));};exports[_0xfdba('0x73')]=function(_0x11d589,_0x1a4f2b,_0x3398a9){var _0x530596;return db[_0xfdba('0x43')][_0xfdba('0x63')]({'where':{'id':_0x11d589[_0xfdba('0x5d')]['id']}})[_0xfdba('0x25')](handleEntityNotFound(_0x1a4f2b,null))[_0xfdba('0x25')](function(_0x74bc0f){if(_0x74bc0f){return _0x74bc0f[_0xfdba('0x73')](_0x11d589[_0xfdba('0x46')]['ids']);}})[_0xfdba('0x25')](respondWithStatusCode(_0x1a4f2b,null))['catch'](handleError(_0x1a4f2b,null));};exports[_0xfdba('0x74')]=function(_0x376af6,_0x581283,_0x3e8550){return db['FaxInteraction'][_0xfdba('0x63')]({'where':{'id':_0x376af6[_0xfdba('0x5d')]['id']}})[_0xfdba('0x25')](handleEntityNotFound(_0x581283,null))['then'](function(_0x5e3e2b){if(_0x5e3e2b){return _0x5e3e2b[_0xfdba('0x74')](_0x376af6[_0xfdba('0x67')][_0xfdba('0x71')],_['omit'](_0x376af6[_0xfdba('0x67')],[_0xfdba('0x71'),'id'])||{});}})[_0xfdba('0x25')](respondWithResult(_0x581283,null))[_0xfdba('0x2f')](handleError(_0x581283,null));};exports['getInteractions']=function(_0x365de7,_0x49af09,_0x2bc99b){var _0x259f8c={'raw':![],'where':{}};var _0x4b8dbf={};var _0x5c1a7b={'count':0x0,'rows':[]};return db[_0xfdba('0x43')]['findOne']({'where':{'id':_0x365de7['params']['id']}})['then'](handleEntityNotFound(_0x49af09,null))[_0xfdba('0x25')](function(_0x5474c9){if(_0x5474c9){_0x4b8dbf['model']=_['keys'](db[_0xfdba('0x75')][_0xfdba('0x44')]);_0x4b8dbf[_0xfdba('0x46')]=_[_0xfdba('0x45')](_0x365de7[_0xfdba('0x46')]);_0x4b8dbf[_0xfdba('0x47')]=_[_0xfdba('0x48')](_0x4b8dbf['model'],_0x4b8dbf[_0xfdba('0x46')]);_0x259f8c['attributes']=_[_0xfdba('0x48')](_0x4b8dbf['model'],qs[_0xfdba('0x4b')](_0x365de7[_0xfdba('0x46')]['fields']));_0x259f8c[_0xfdba('0x4a')]=_0x259f8c[_0xfdba('0x4a')]['length']?_0x259f8c[_0xfdba('0x4a')]:_0x4b8dbf['model'];if(!_0x365de7[_0xfdba('0x46')][_0xfdba('0x4d')](_0xfdba('0x6e'))){_0x259f8c[_0xfdba('0x35')]=qs[_0xfdba('0x35')](_0x365de7[_0xfdba('0x46')][_0xfdba('0x35')]);_0x259f8c[_0xfdba('0x34')]=qs[_0xfdba('0x34')](_0x365de7[_0xfdba('0x46')]['offset']);}_0x259f8c['order']=qs[_0xfdba('0x4f')](_0x365de7[_0xfdba('0x46')][_0xfdba('0x4f')]);_0x259f8c[_0xfdba('0x50')]=qs[_0xfdba('0x47')](_['pick'](_0x365de7['query'],_0x4b8dbf['filters']));_0x259f8c[_0xfdba('0x50')][_0xfdba('0x6a')]=_0x5474c9['id'];if(_0x365de7['query'][_0xfdba('0x52')]){_0x259f8c[_0xfdba('0x50')]=_[_0xfdba('0x57')](_0x259f8c[_0xfdba('0x50')],{'$or':_['map'](_0x259f8c[_0xfdba('0x4a')],function(_0x3a1a64){var _0x124efd={};_0x124efd[_0x3a1a64]={'$like':'%'+_0x365de7[_0xfdba('0x46')][_0xfdba('0x52')]+'%'};return _0x124efd;})});}_0x259f8c=_[_0xfdba('0x57')]({},_0x259f8c,_0x365de7[_0xfdba('0x6f')]);return db[_0xfdba('0x75')][_0xfdba('0x33')]({'where':_0x259f8c['where']})['then'](function(_0x3ae160){_0x5c1a7b[_0xfdba('0x33')]=_0x3ae160;if(_0x365de7[_0xfdba('0x46')][_0xfdba('0x58')]){_0x259f8c['include']=[{'model':db[_0xfdba('0x76')],'as':_0xfdba('0x77'),'required':![]},{'model':db['User'],'as':_0xfdba('0x78'),'attributes':[_0xfdba('0x3f'),'fullname','internal'],'required':![]},{'model':db[_0xfdba('0x79')],'as':_0xfdba('0x7a'),'attributes':['id',_0xfdba('0x3f'),_0xfdba('0x7b')],'where':_0x365de7['query'][_0xfdba('0x7c')]?{'id':_0x365de7[_0xfdba('0x46')][_0xfdba('0x7c')]}:undefined,'required':_0x365de7['query'][_0xfdba('0x7c')]?!![]:![]}];}return db[_0xfdba('0x75')]['findAll'](_0x259f8c);})[_0xfdba('0x25')](function(_0x4108b8){_0x5c1a7b[_0xfdba('0x5b')]=_0x4108b8;return _0x5c1a7b;});}})[_0xfdba('0x25')](respondWithFilteredResult(_0x49af09,_0x259f8c))[_0xfdba('0x2f')](handleError(_0x49af09,null));};exports['addApplications']=function(_0x5b95be,_0x1bfbd3,_0xc09270){return db[_0xfdba('0x43')][_0xfdba('0x6d')]({'where':{'id':_0x5b95be[_0xfdba('0x5d')]['id']}})[_0xfdba('0x25')](handleEntityNotFound(_0x1bfbd3,null))['then'](function(_0x40936e){if(_0x40936e){return db[_0xfdba('0x7d')][_0xfdba('0x7e')](function(_0x5b843e){return db[_0xfdba('0x7f')][_0xfdba('0x3c')]({'where':{'FaxAccountId':_0x5b95be[_0xfdba('0x5d')]['id']},'transaction':_0x5b843e})[_0xfdba('0x25')](function(_0x125c52){var _0x51ff0d=_[_0xfdba('0x53')](_0x5b95be[_0xfdba('0x67')],function(_0x245686){_0x245686[_0xfdba('0x6a')]=_0x5b95be['params']['id'];return _0x245686;});return db[_0xfdba('0x7f')][_0xfdba('0x80')](_0x51ff0d,{'transaction':_0x5b843e});});})['then'](function(){return db[_0xfdba('0x7f')][_0xfdba('0x81')]({'where':{'FaxAccountId':_0x5b95be[_0xfdba('0x5d')]['id']},'order':'priority'});});}})[_0xfdba('0x25')](respondWithResult(_0x1bfbd3,null))[_0xfdba('0x2f')](handleError(_0x1bfbd3,null));};exports[_0xfdba('0x82')]=function(_0x2ae0f9,_0x236599,_0xe10488){var _0x113dbf={};var _0x4c8a6d={};var _0x457133;var _0x1e4a22;return db['FaxAccount'][_0xfdba('0x6d')]({'where':{'id':_0x2ae0f9['params']['id']}})[_0xfdba('0x25')](handleEntityNotFound(_0x236599,null))[_0xfdba('0x25')](function(_0x3d9a54){if(_0x3d9a54){_0x457133=_0x3d9a54;_0x4c8a6d[_0xfdba('0x49')]=_[_0xfdba('0x45')](db[_0xfdba('0x7f')][_0xfdba('0x44')]);_0x4c8a6d[_0xfdba('0x46')]=_[_0xfdba('0x45')](_0x2ae0f9[_0xfdba('0x46')]);_0x4c8a6d[_0xfdba('0x47')]=_[_0xfdba('0x48')](_0x4c8a6d['model'],_0x4c8a6d['query']);_0x113dbf[_0xfdba('0x4a')]=_[_0xfdba('0x48')](_0x4c8a6d[_0xfdba('0x49')],qs['fields'](_0x2ae0f9[_0xfdba('0x46')][_0xfdba('0x4b')]));_0x113dbf[_0xfdba('0x4a')]=_0x113dbf[_0xfdba('0x4a')][_0xfdba('0x4c')]?_0x113dbf['attributes']:_0x4c8a6d[_0xfdba('0x49')];_0x113dbf[_0xfdba('0x4e')]=qs[_0xfdba('0x4f')](_0x2ae0f9['query']['sort']);_0x113dbf[_0xfdba('0x50')]=qs[_0xfdba('0x47')](_[_0xfdba('0x51')](_0x2ae0f9['query'],_0x4c8a6d['filters']));if(_0x2ae0f9[_0xfdba('0x46')][_0xfdba('0x52')]){_0x113dbf[_0xfdba('0x50')]=_[_0xfdba('0x57')](_0x113dbf[_0xfdba('0x50')],{'$or':_[_0xfdba('0x53')](_0x113dbf['attributes'],function(_0x33b2d6){var _0x53c8d9={};_0x53c8d9[_0x33b2d6]={'$like':'%'+_0x2ae0f9['query'][_0xfdba('0x52')]+'%'};return _0x53c8d9;})});}_0x113dbf=_[_0xfdba('0x57')]({},_0x113dbf,_0x2ae0f9[_0xfdba('0x6f')]);return _0x457133[_0xfdba('0x82')](_0x113dbf);}})[_0xfdba('0x25')](function(_0x29366c){if(_0x29366c){_0x1e4a22=_0x29366c[_0xfdba('0x4c')];if(!_0x2ae0f9[_0xfdba('0x46')][_0xfdba('0x4d')]('nolimit')){_0x113dbf[_0xfdba('0x35')]=qs[_0xfdba('0x35')](_0x2ae0f9[_0xfdba('0x46')][_0xfdba('0x35')]);_0x113dbf['offset']=qs[_0xfdba('0x34')](_0x2ae0f9[_0xfdba('0x46')][_0xfdba('0x34')]);}return _0x457133[_0xfdba('0x82')](_0x113dbf);}})[_0xfdba('0x25')](function(_0x5ab716){if(_0x5ab716){return _0x5ab716?{'count':_0x1e4a22,'rows':_0x5ab716}:null;}})['then'](respondWithResult(_0x236599,null))[_0xfdba('0x2f')](handleError(_0x236599,null));};function Extension(_0x1f12c6,_0x57c4fa,_0x11d8ad,_0x415fd9){this[_0xfdba('0x83')]=_0xfdba('0x84');this[_0xfdba('0x85')]=_0x1f12c6[_0xfdba('0x86')];this[_0xfdba('0x87')]=_0x415fd9;this[_0xfdba('0x54')]=_0xfdba('0x88');this[_0xfdba('0x89')]=_0xfdba('0x8a');this[_0xfdba('0x6a')]=_0x1f12c6['id'];this['priority']=_0x57c4fa;this[_0xfdba('0x8b')]=_0x11d8ad;}function createExtensionsReciveFax(_0x10a254){var _0x525539=0x1;var _0x1c8a00=[];_0x1c8a00[_0xfdba('0x8c')](new Extension(_0x10a254,_0x525539,'','Answer'));_0x525539+=0x1;_0x1c8a00[_0xfdba('0x8c')](new Extension(_0x10a254,_0x525539,_0xfdba('0x8d'),_0xfdba('0x8e')));_0x525539+=0x1;for(var _0x508334 in _0x10a254){if(_0x10a254[_0xfdba('0x4d')](_0x508334)&&(_0x508334===_0xfdba('0x8f')||_0x508334===_0xfdba('0x86')||_0x508334===_0xfdba('0x90')||_0x508334==='faxdetect'||_0x508334===_0xfdba('0x91')||_0x508334===_0xfdba('0x92')||_0x508334===_0xfdba('0x93')||_0x508334===_0xfdba('0x94')||_0x508334===_0xfdba('0x95'))){_0x1c8a00[_0xfdba('0x8c')](new Extension(_0x10a254,_0x525539,_0xfdba('0x96')+_0x508334+')='+_0x10a254[_0x508334],_0xfdba('0x8e')));_0x525539+=0x1;}}_0x1c8a00[_0xfdba('0x8c')](new Extension(_0x10a254,_0x525539,'6',_0xfdba('0x97')));_0x525539+=0x1;_0x1c8a00[_0xfdba('0x8c')](new Extension(_0x10a254,_0x525539,'/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',_0xfdba('0x98')));_0x525539=0x0;return _0x1c8a00;}exports[_0xfdba('0x99')]=function(_0x2710fb,_0x1e3664,_0x44394b){var _0x112a83;return db['sequelize'][_0xfdba('0x7e')](function(_0x2f37d3){return db[_0xfdba('0x43')][_0xfdba('0x5f')](_0x2710fb[_0xfdba('0x67')],{'transaction':_0x2f37d3})[_0xfdba('0x25')](function(_0x5389d4){_0x112a83=_0x5389d4[_0xfdba('0x62')]({'plain':!![]});return db[_0xfdba('0x9a')][_0xfdba('0x80')](createExtensionsReciveFax(_0x112a83),{'transaction':_0x2f37d3});});})[_0xfdba('0x25')](function(){return _0x112a83;})['then'](respondWithResult(_0x1e3664,null))[_0xfdba('0x2f')](handleError(_0x1e3664,null));};exports[_0xfdba('0x9b')]=function(_0x225b8e,_0x41f5dd,_0x51c4d0){var _0x3ccfc9;return db[_0xfdba('0x7d')]['transaction'](function(_0x46b74c){return db[_0xfdba('0x43')][_0xfdba('0x39')](_0x225b8e['body'],{'where':{'id':_0x225b8e[_0xfdba('0x67')]['id']},'transaction':_0x46b74c})[_0xfdba('0x25')](function(_0xa3e7f8){return db['VoiceExtension'][_0xfdba('0x3c')]({'where':{'FaxAccountId':_0x225b8e[_0xfdba('0x67')]['id']},'transaction':_0x46b74c})[_0xfdba('0x25')](function(_0x92ad72){return db[_0xfdba('0x9a')][_0xfdba('0x80')](createExtensionsReciveFax(_[_0xfdba('0x9c')](_0x225b8e[_0xfdba('0x67')],[_0xfdba('0x9d'),_0xfdba('0x55'),_0xfdba('0x9e'),_0xfdba('0x9f'),_0xfdba('0xa0'),_0xfdba('0xa1')])),{'transaction':_0x46b74c});});});})[_0xfdba('0x25')](function(){return db['FaxAccount']['findById'](_0x225b8e[_0xfdba('0x67')]['id']);})[_0xfdba('0x25')](respondWithResult(_0x41f5dd,null))[_0xfdba('0x2f')](handleError(_0x41f5dd,null));};exports[_0xfdba('0xa2')]=function(_0x8c48e1,_0x46fb1e,_0x2b168f){var _0x58efb3={'raw':!![],'where':{}};var _0x22da64={};var _0x1dcca5={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x8c48e1['params']['id']}})[_0xfdba('0x25')](handleEntityNotFound(_0x46fb1e,null))[_0xfdba('0x25')](function(_0x58959e){if(_0x58959e){_0x22da64[_0xfdba('0x49')]=_[_0xfdba('0x45')](db[_0xfdba('0xa3')]['rawAttributes']);_0x22da64[_0xfdba('0x46')]=_['keys'](_0x8c48e1[_0xfdba('0x46')]);_0x22da64[_0xfdba('0x47')]=_[_0xfdba('0x48')](_0x22da64[_0xfdba('0x49')],_0x22da64[_0xfdba('0x46')]);_0x58efb3[_0xfdba('0x4a')]=_['intersection'](_0x22da64[_0xfdba('0x49')],qs[_0xfdba('0x4b')](_0x8c48e1['query'][_0xfdba('0x4b')]));_0x58efb3[_0xfdba('0x4a')]=_0x58efb3['attributes'][_0xfdba('0x4c')]?_0x58efb3[_0xfdba('0x4a')]:_0x22da64[_0xfdba('0x49')];if(!_0x8c48e1['query'][_0xfdba('0x4d')](_0xfdba('0x6e'))){_0x58efb3[_0xfdba('0x35')]=qs[_0xfdba('0x35')](_0x8c48e1[_0xfdba('0x46')]['limit']);_0x58efb3['offset']=qs['offset'](_0x8c48e1[_0xfdba('0x46')][_0xfdba('0x34')]);}_0x58efb3[_0xfdba('0x4e')]=qs[_0xfdba('0x4f')](_0x8c48e1[_0xfdba('0x46')][_0xfdba('0x4f')]);_0x58efb3[_0xfdba('0x50')]=qs['filters'](_[_0xfdba('0x51')](_0x8c48e1[_0xfdba('0x46')],_0x22da64[_0xfdba('0x47')]));_0x58efb3['where'][_0xfdba('0x6a')]=_0x58959e['id'];if(_0x8c48e1[_0xfdba('0x46')][_0xfdba('0x52')]){_0x58efb3['where']=_['merge'](_0x58efb3[_0xfdba('0x50')],{'$or':_[_0xfdba('0x53')](_0x58efb3[_0xfdba('0x4a')],function(_0x4386a8){var _0x312ee9={};_0x312ee9[_0x4386a8]={'$like':'%'+_0x8c48e1[_0xfdba('0x46')]['filter']+'%'};return _0x312ee9;})});}if(_0x8c48e1[_0xfdba('0x46')][_0xfdba('0xa4')]){var _0x21aa72=_0x8c48e1[_0xfdba('0x46')]['$gte'][_0xfdba('0xa5')](',');var _0x5a01e2={};_0x5a01e2[_0x21aa72[0x0]]={'$gte':moment(_0x21aa72[0x1])['format'](_0xfdba('0xa6'))};_0x58efb3[_0xfdba('0x50')]=_[_0xfdba('0x57')](_0x58efb3[_0xfdba('0x50')],_0x5a01e2);}_0x58efb3=_[_0xfdba('0x57')]({},_0x58efb3,_0x8c48e1['options']);return db[_0xfdba('0xa3')][_0xfdba('0x33')]({'where':_0x58efb3[_0xfdba('0x50')]})[_0xfdba('0x25')](function(_0x4a6b2e){_0x1dcca5[_0xfdba('0x33')]=_0x4a6b2e;if(_0x8c48e1['query']['includeAll']){_0x58efb3[_0xfdba('0x59')]=[{'all':!![]}];}return db[_0xfdba('0xa3')][_0xfdba('0x5a')](_0x58efb3);})[_0xfdba('0x25')](function(_0x200d43){_0x1dcca5[_0xfdba('0x5b')]=_0x200d43;return _0x1dcca5;});}})[_0xfdba('0x25')](respondWithFilteredResult(_0x46fb1e,_0x58efb3))['catch'](handleError(_0x46fb1e,null));};exports[_0xfdba('0x40')]=function(_0x24f848,_0x413f54,_0x2ffb06){var _0x2d9d89,_0x273c13={},_0xbe98a5;if(_0x24f848[_0xfdba('0x67')]['to']){_0xbe98a5=_0x24f848['body']['to'][0x0];}return db[_0xfdba('0x43')][_0xfdba('0x63')]({'where':{'id':_0x24f848[_0xfdba('0x5d')]['id']},'include':[{'model':db[_0xfdba('0xa7')],'as':_0xfdba('0xa8'),'include':[{'model':db[_0xfdba('0x76')],'as':_0xfdba('0xa9'),'where':{'fax':_0xbe98a5},'limit':0x1,'order':[['updatedAt',_0xfdba('0xaa')]]}]}]})['then'](handleEntityNotFound(_0x413f54,null))[_0xfdba('0x25')](function(_0x500abc){_0x2d9d89=_0x500abc;if(_0x24f848[_0xfdba('0x67')][_0xfdba('0xab')]&&_0x24f848['body'][_0xfdba('0xab')][_0xfdba('0x4c')]){for(var _0xccb768=0x0;_0xccb768<_0x24f848[_0xfdba('0x67')][_0xfdba('0xab')][_0xfdba('0x4c')];_0xccb768+=0x1){_0x24f848[_0xfdba('0x67')][_0xfdba('0xab')][_0xccb768]={'filename':_0x24f848[_0xfdba('0x67')][_0xfdba('0xab')][_0xccb768][_0xfdba('0x3f')],'id':_0x24f848[_0xfdba('0x67')]['attachments'][_0xccb768]['id'],'path':path[_0xfdba('0xac')](config[_0xfdba('0xad')],_0xfdba('0xae'),_0x24f848[_0xfdba('0x67')][_0xfdba('0xab')][_0xccb768][_0xfdba('0xaf')])};}}return respondWithRpcPromise('CheckAfterSend',_0xfdba('0xb0'),{'FaxAccountId':_['isNil'](_0x24f848[_0xfdba('0x5d')]['id'])?undefined:_0x24f848['params']['id'],'path':_[_0xfdba('0xb1')](_0x24f848[_0xfdba('0x67')][_0xfdba('0xab')][0x0][_0xfdba('0x7')])?undefined:_0x24f848[_0xfdba('0x67')][_0xfdba('0xab')][0x0][_0xfdba('0x7')],'fax':_[_0xfdba('0xb1')](_0x24f848[_0xfdba('0x67')]['to'][0x0])?undefined:_0x24f848[_0xfdba('0x67')]['to'][0x0]},client9002);})[_0xfdba('0x25')](function(){if(_0x2d9d89){if(_[_0xfdba('0xb1')](_0x24f848[_0xfdba('0x67')][_0xfdba('0xb2')])){_0x24f848[_0xfdba('0x67')][_0xfdba('0xb2')]=util[_0xfdba('0xb3')](_0xfdba('0xb4'),_0x2d9d89[_0xfdba('0x3f')],_0x2d9d89[_0xfdba('0xb5')]);}if(_0x2d9d89[_0xfdba('0xa8')]){if(_0x2d9d89[_0xfdba('0xa8')][_0xfdba('0xa9')][_0xfdba('0x4c')]){return _0x2d9d89[_0xfdba('0xa8')][_0xfdba('0xa9')][0x0];}else{return db[_0xfdba('0x76')][_0xfdba('0x5f')](_[_0xfdba('0x1b')](_0x24f848[_0xfdba('0x67')],{'firstName':_0x24f848[_0xfdba('0x67')]['to'][0x0],'phone':_0x24f848[_0xfdba('0x67')]['to'][0x0],'fax':_0x24f848[_0xfdba('0x67')]['to'][0x0],'ListId':_0x2d9d89['ListId']}));}}else{throw new Error(_0xfdba('0xb6'));}}else{throw new Error(_0xfdba('0xb7'));}})['then'](function(_0xa68bea){if(_0xa68bea){return db[_0xfdba('0x75')][_0xfdba('0x63')]({'where':{'ContactId':_0xa68bea['id'],'closed':![],'FaxAccountId':_0x2d9d89['id']}})[_0xfdba('0x25')](function(_0x3e9cec){if(_0x3e9cec){return[_0x3e9cec,![]];}return db['FaxInteraction'][_0xfdba('0x5f')]({'UserId':_0x24f848['user']['id'],'ContactId':_0xa68bea['id'],'FaxAccountId':_0x2d9d89['id'],'fax':_0x24f848['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xfdba('0x57')](_0x24f848['body'],{'read':![],'body':_0x24f848['body'][_0xfdba('0xab')][0x0][_0xfdba('0xb8')],'FaxAccountId':_0x2d9d89['id'],'UserId':_0x24f848[_0xfdba('0x60')]['id'],'ContactId':_0xa68bea['id'],'AttachmentId':_0x24f848[_0xfdba('0x67')][_0xfdba('0xab')][0x0]['id']})]},{'include':[{'model':db[_0xfdba('0xa3')],'as':_0xfdba('0xb9')}]})[_0xfdba('0x25')](function(_0x4d7ed1){return[_0x4d7ed1,!![]];});});}else{throw new Error(_0xfdba('0xba'));}})[_0xfdba('0xbb')](function(_0x5536da,_0x10fe54){if(_0x10fe54){return _0x5536da;}return db['FaxMessage']['create']({'direction':_0xfdba('0xbc'),'read':![],'body':_0x24f848[_0xfdba('0x67')][_0xfdba('0xab')][0x0][_0xfdba('0xb8')],'FaxAccountId':_0x2d9d89['id'],'FaxInteractionId':_0x5536da['id'],'UserId':_0x24f848[_0xfdba('0x60')]['id'],'ContactId':_0x5536da[_0xfdba('0xbd')],'AttachmentId':_0x24f848['body'][_0xfdba('0xab')][0x0]['id']})[_0xfdba('0x25')](function(_0x5d76c4){_0x5536da[_0xfdba('0xbe')][_0xfdba('0xb9')]=[];_0x5536da['dataValues'][_0xfdba('0xb9')]['push'](_0x5d76c4[_0xfdba('0xbe')]);return _0x5536da;});})[_0xfdba('0x25')](function(_0x3fcc8d){respondWithRpcPromise(_0xfdba('0xbf'),_0xfdba('0xbf'),{'FaxAccountId':_[_0xfdba('0xb1')](_0x24f848['params']['id'])?undefined:_0x24f848['params']['id'],'path':_[_0xfdba('0xb1')](_0x24f848[_0xfdba('0x67')]['attachments'][0x0][_0xfdba('0x7')])?undefined:_0x24f848[_0xfdba('0x67')]['attachments'][0x0]['path'],'fax':_[_0xfdba('0xb1')](_0x24f848[_0xfdba('0x67')]['to'][0x0])?undefined:_0x24f848[_0xfdba('0x67')]['to'][0x0],'AttachmentId':_0x24f848[_0xfdba('0x67')]['attachments'][0x0]['id']},client9002)[_0xfdba('0x25')](function(_0x53bcb4){logger[_0xfdba('0x26')](_0xfdba('0xc0'),_0x53bcb4);})[_0xfdba('0x2f')](function(_0x4d1362){logger[_0xfdba('0x26')](_0xfdba('0xc0'),_0x4d1362);});return _0x3fcc8d;})[_0xfdba('0x25')](respondWithResult(_0x413f54,null))[_0xfdba('0x2f')](handleError(_0x413f54,null));};exports[_0xfdba('0xc1')]=function(_0x3820cd,_0x23ce0e,_0x37c298){return db[_0xfdba('0x43')]['find']({'where':{'id':_0x3820cd[_0xfdba('0x5d')]['id']}})[_0xfdba('0x25')](handleEntityNotFound(_0x23ce0e,null))[_0xfdba('0x25')](function(_0x46ee5d){if(_0x46ee5d){return _0x46ee5d[_0xfdba('0xc1')](_0x3820cd[_0xfdba('0x67')][_0xfdba('0x71')],_[_0xfdba('0x9c')](_0x3820cd['body'],['ids','id'])||{})[_0xfdba('0xbb')](function(_0x2b2f9b){for(var _0x39028e=0x0;_0x39028e<_0x3820cd[_0xfdba('0x67')][_0xfdba('0x71')]['length'];_0x39028e+=0x1){socket[_0xfdba('0xc2')](_0xfdba('0xc3'),{'UserId':_0x3820cd[_0xfdba('0x67')][_0xfdba('0x71')][_0x39028e],'FaxAccountId':_0x3820cd['params']['id']});}return _0x2b2f9b;});}})['then'](respondWithResult(_0x23ce0e,null))[_0xfdba('0x2f')](handleError(_0x23ce0e,null));};exports[_0xfdba('0xc4')]=function(_0x134b6a,_0x36fbc2,_0x1eda68){var _0x2fd899;return db[_0xfdba('0x43')][_0xfdba('0x63')]({'where':{'id':_0x134b6a[_0xfdba('0x5d')]['id']}})[_0xfdba('0x25')](handleEntityNotFound(_0x36fbc2,null))[_0xfdba('0x25')](function(_0x5c6adb){if(_0x5c6adb){return _0x5c6adb['removeAgents'](_0x134b6a[_0xfdba('0x46')][_0xfdba('0x71')])[_0xfdba('0x25')](function(_0x3b31a5){if(_[_0xfdba('0xc5')](_0x134b6a[_0xfdba('0x46')][_0xfdba('0x71')])){for(var _0x2f9a34=0x0;_0x2f9a34<_0x134b6a[_0xfdba('0x46')][_0xfdba('0x71')][_0xfdba('0x4c')];_0x2f9a34+=0x1){socket[_0xfdba('0xc2')]('userFaxAccount:remove',{'UserId':_0x134b6a['query']['ids'][_0x2f9a34],'FaxAccountId':_0x134b6a[_0xfdba('0x5d')]['id']});}}else{socket['emit'](_0xfdba('0xc6'),{'UserId':_0x134b6a['query'][_0xfdba('0x71')],'FaxAccountId':_0x134b6a[_0xfdba('0x5d')]['id']});}});}})['then'](respondWithStatusCode(_0x36fbc2,null))[_0xfdba('0x2f')](handleError(_0x36fbc2,null));};exports['getAgents']=function(_0x2a00e8,_0x4e12e8,_0x99c71){var _0x49baf7={};var _0x5d9218={};var _0xc96919;var _0xad4c66;return db[_0xfdba('0x43')][_0xfdba('0x6d')]({'where':{'id':_0x2a00e8[_0xfdba('0x5d')]['id']}})[_0xfdba('0x25')](handleEntityNotFound(_0x4e12e8,null))[_0xfdba('0x25')](function(_0x10c1a1){if(_0x10c1a1){_0xc96919=_0x10c1a1;_0x5d9218['model']=_[_0xfdba('0x45')](db[_0xfdba('0xc7')]['rawAttributes']);_0x5d9218['query']=_[_0xfdba('0x45')](_0x2a00e8[_0xfdba('0x46')]);_0x5d9218[_0xfdba('0x47')]=_['intersection'](_0x5d9218[_0xfdba('0x49')],_0x5d9218['query']);_0x49baf7[_0xfdba('0x4a')]=_['intersection'](_0x5d9218['model'],qs[_0xfdba('0x4b')](_0x2a00e8[_0xfdba('0x46')][_0xfdba('0x4b')]));_0x49baf7[_0xfdba('0x4a')]=_0x49baf7[_0xfdba('0x4a')]['length']?_0x49baf7[_0xfdba('0x4a')]:_0x5d9218[_0xfdba('0x49')];_0x49baf7[_0xfdba('0x4e')]=qs[_0xfdba('0x4f')](_0x2a00e8[_0xfdba('0x46')][_0xfdba('0x4f')]);_0x49baf7['where']=qs[_0xfdba('0x47')](_[_0xfdba('0x51')](_0x2a00e8[_0xfdba('0x46')],_0x5d9218[_0xfdba('0x47')]));if(_0x2a00e8[_0xfdba('0x46')][_0xfdba('0x52')]){_0x49baf7[_0xfdba('0x50')]=_[_0xfdba('0x57')](_0x49baf7[_0xfdba('0x50')],{'$or':_[_0xfdba('0x53')](_0x49baf7[_0xfdba('0x4a')],function(_0xe9f7e8){var _0x2b8801={};_0x2b8801[_0xe9f7e8]={'$like':'%'+_0x2a00e8[_0xfdba('0x46')][_0xfdba('0x52')]+'%'};return _0x2b8801;})});}_0x49baf7=_[_0xfdba('0x57')]({},_0x49baf7,_0x2a00e8['options']);return _0xc96919['getAgents'](_0x49baf7);}})[_0xfdba('0x25')](function(_0x46e151){if(_0x46e151){_0xad4c66=_0x46e151[_0xfdba('0x4c')];if(!_0x2a00e8[_0xfdba('0x46')][_0xfdba('0x4d')](_0xfdba('0x6e'))){_0x49baf7[_0xfdba('0x35')]=qs[_0xfdba('0x35')](_0x2a00e8[_0xfdba('0x46')][_0xfdba('0x35')]);_0x49baf7[_0xfdba('0x34')]=qs[_0xfdba('0x34')](_0x2a00e8[_0xfdba('0x46')][_0xfdba('0x34')]);}return _0xc96919[_0xfdba('0xc8')](_0x49baf7);}})[_0xfdba('0x25')](function(_0x1f2306){if(_0x1f2306){return _0x1f2306?{'count':_0xad4c66,'rows':_0x1f2306}:null;}})[_0xfdba('0x25')](respondWithResult(_0x4e12e8,null))[_0xfdba('0x2f')](handleError(_0x4e12e8,null));}; \ No newline at end of file +var _0x05d6=['role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','rawAttributes','hasOwnProperty','nolimit','order','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','exten','localstationid','system','description','Fax\x20Extension','appdata','CDR(type)=inbound-fax','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','t38timeout','push','FAXOPT(','Set','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','updatedAt','ListId','findById','FaxMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','send','CmList','Contacts','DESC','attachments','join','root','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','html-pdf','eml-format','rimraf','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','end','status','count','offset','limit','set','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','sendStatus','name','mandatoryDispositionPause','model','keys','query','filters','intersection','attributes','fields','length','sort','pick','filter','where','merge','map','type','field','FaxAccount','includeAll','include','findAll','rows','show','params','Pause','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x241a0d,_0x1f70cf){var _0x336487=function(_0xba48b){while(--_0xba48b){_0x241a0d['push'](_0x241a0d['shift']());}};_0x336487(++_0x1f70cf);}(_0x05d6,0x1e1));var _0x605d=function(_0x7a761f,_0x174f7c){_0x7a761f=_0x7a761f-0x0;var _0x4e48b5=_0x05d6[_0x7a761f];return _0x4e48b5;};'use strict';var pdf=require(_0x605d('0x0'));var emlformat=require(_0x605d('0x1'));var rimraf=require(_0x605d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x605d('0x3'));var Mustache=require(_0x605d('0x4'));var util=require('util');var path=require(_0x605d('0x5'));var sox=require(_0x605d('0x6'));var csv=require(_0x605d('0x7'));var ejs=require(_0x605d('0x8'));var fs=require('fs');var _=require(_0x605d('0x9'));var squel=require('squel');var crypto=require(_0x605d('0xa'));var jsforce=require(_0x605d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x605d('0x7'));var querystring=require(_0x605d('0xc'));var Papa=require(_0x605d('0xd'));var authService=require(_0x605d('0xe'));var hardwareService=require(_0x605d('0xf'));var Redis=require(_0x605d('0x10'));var qs=require(_0x605d('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x605d('0x12'))['db'];config[_0x605d('0x13')]=_[_0x605d('0x14')](config['redis'],{'host':_0x605d('0x15'),'port':0x18eb});var socket=require(_0x605d('0x16'))(new Redis(config[_0x605d('0x13')]));require(_0x605d('0x17'))[_0x605d('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0x605d('0x19')]['http']({'port':0x232c});var client9002=jayson[_0x605d('0x19')][_0x605d('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x476c97,_0x15e631,_0x213bff,_0x5c7375){return new BPromise(function(_0x1dc63c,_0x576c0a){var _0x1e9028=_0x5c7375||client;return _0x1e9028[_0x605d('0x1b')](_0x476c97,_0x213bff)[_0x605d('0x1c')](function(_0x52fbac){logger[_0x605d('0x1d')]('FaxAccount,\x20%s,\x20%s',_0x15e631,_0x605d('0x1e'));logger[_0x605d('0x1f')](_0x605d('0x20'),_0x15e631,_0x605d('0x1e'),JSON[_0x605d('0x21')](_0x52fbac));if(_0x52fbac['error']){if(_0x52fbac[_0x605d('0x22')][_0x605d('0x23')]===0x1f4){logger[_0x605d('0x22')](_0x605d('0x24'),_0x15e631,_0x52fbac[_0x605d('0x22')][_0x605d('0x25')]);return _0x576c0a(_0x52fbac[_0x605d('0x22')][_0x605d('0x25')]);}logger[_0x605d('0x22')](_0x605d('0x24'),_0x15e631,_0x52fbac[_0x605d('0x22')][_0x605d('0x25')]);return _0x1dc63c(_0x52fbac[_0x605d('0x22')][_0x605d('0x25')]);}else{logger[_0x605d('0x1d')](_0x605d('0x24'),_0x15e631,_0x605d('0x1e'));_0x1dc63c(_0x52fbac[_0x605d('0x26')][_0x605d('0x25')]);}})[_0x605d('0x27')](function(_0x38098b){logger[_0x605d('0x22')](_0x605d('0x24'),_0x15e631,_0x38098b);_0x576c0a(_0x38098b);});});}function respondWithStatusCode(_0x125eea,_0x3622a6){_0x3622a6=_0x3622a6||0xcc;return function(_0x3ab1ec){if(_0x3ab1ec){return _0x125eea['sendStatus'](_0x3622a6);}return _0x125eea['status'](_0x3622a6)[_0x605d('0x28')]();};}function respondWithResult(_0xef0ed7,_0xd804f3){_0xd804f3=_0xd804f3||0xc8;return function(_0x22af45){if(_0x22af45){return _0xef0ed7[_0x605d('0x29')](_0xd804f3)['json'](_0x22af45);}};}function respondWithFilteredResult(_0x205d31,_0x1384c6){return function(_0x2fc993){if(_0x2fc993){var _0x1d597a=_0x2fc993[_0x605d('0x2a')],_0x112807=_0x1384c6['offset'],_0x204cb7=_0x1384c6[_0x605d('0x2b')]+_0x1384c6[_0x605d('0x2c')],_0x494325;if(_0x204cb7>=_0x1d597a){_0x204cb7=_0x1d597a;_0x494325=0xc8;}else{_0x494325=0xce;}_0x205d31[_0x605d('0x29')](_0x494325);return _0x205d31[_0x605d('0x2d')]('Content-Range',_0x112807+'-'+_0x204cb7+'/'+_0x1d597a)['json'](_0x2fc993);}return null;};}function patchUpdates(_0x2dbd6c){return function(_0x26678e){try{jsonpatch[_0x605d('0x2e')](_0x26678e,_0x2dbd6c,!![]);}catch(_0x25cd9e){return BPromise[_0x605d('0x2f')](_0x25cd9e);}return _0x26678e[_0x605d('0x30')]();};}function saveUpdates(_0x33ca35,_0x4f1beb){return function(_0xf39fec){if(_0xf39fec){return _0xf39fec[_0x605d('0x31')](_0x33ca35)[_0x605d('0x1c')](function(_0x395a2a){return _0x395a2a;});}return null;};}function removeEntity(_0x23a809,_0x5653dc){return function(_0x1d05fd){if(_0x1d05fd){return _0x1d05fd[_0x605d('0x32')]()['then'](function(){var _0x42f4da=_0x1d05fd[_0x605d('0x33')]({'plain':!![]});var _0x193f99=_0x605d('0x34');return db[_0x605d('0x35')][_0x605d('0x32')]({'where':{'type':_0x193f99,'resourceId':_0x42f4da['id']}})[_0x605d('0x1c')](function(){return _0x1d05fd;});})[_0x605d('0x1c')](function(){_0x23a809['status'](0xcc)[_0x605d('0x28')]();});}};}function handleEntityNotFound(_0x47194d,_0x1c67af){return function(_0x426a8d){if(!_0x426a8d){_0x47194d[_0x605d('0x36')](0x194);}return _0x426a8d;};}function handleError(_0x2f0297,_0x36cfa3){_0x36cfa3=_0x36cfa3||0x1f4;return function(_0x4f1fd6){logger[_0x605d('0x22')](_0x4f1fd6['stack']);if(_0x4f1fd6[_0x605d('0x37')]){delete _0x4f1fd6[_0x605d('0x37')];}_0x2f0297[_0x605d('0x29')](_0x36cfa3)['send'](_0x4f1fd6);};}exports['index']=function(_0x211121,_0x5f4ffc){var _0x5531f4={'include':[{'model':db['Pause'],'as':_0x605d('0x38')}]},_0x390740={},_0x596926={'count':0x0,'rows':[]};var _0x1f882b=db['FaxAccount']['rawAttributes'];_0x390740[_0x605d('0x39')]=_[_0x605d('0x3a')](_0x1f882b);_0x390740[_0x605d('0x3b')]=_[_0x605d('0x3a')](_0x211121['query']);_0x390740[_0x605d('0x3c')]=_[_0x605d('0x3d')](_0x390740[_0x605d('0x39')],_0x390740['query']);_0x5531f4[_0x605d('0x3e')]=_['intersection'](_0x390740[_0x605d('0x39')],qs[_0x605d('0x3f')](_0x211121[_0x605d('0x3b')][_0x605d('0x3f')]));_0x5531f4['attributes']=_0x5531f4[_0x605d('0x3e')][_0x605d('0x40')]?_0x5531f4[_0x605d('0x3e')]:_0x390740[_0x605d('0x39')];if(!_0x211121[_0x605d('0x3b')]['hasOwnProperty']('nolimit')){_0x5531f4[_0x605d('0x2c')]=qs[_0x605d('0x2c')](_0x211121['query'][_0x605d('0x2c')]);_0x5531f4[_0x605d('0x2b')]=qs[_0x605d('0x2b')](_0x211121['query'][_0x605d('0x2b')]);}_0x5531f4['order']=qs[_0x605d('0x41')](_0x211121[_0x605d('0x3b')][_0x605d('0x41')]);_0x5531f4['where']=qs[_0x605d('0x3c')](_[_0x605d('0x42')](_0x211121[_0x605d('0x3b')],_0x390740[_0x605d('0x3c')]));if(_0x211121['query'][_0x605d('0x43')]){_0x5531f4[_0x605d('0x44')]=_[_0x605d('0x45')](_0x5531f4[_0x605d('0x44')],{'$or':_[_0x605d('0x46')](_0x1f882b,function(_0x670b3f){if(_0x670b3f[_0x605d('0x47')]['key']!=='VIRTUAL'){var _0x4c4f54={};_0x4c4f54[_0x670b3f[_0x605d('0x48')]]={'$like':'%'+_0x211121[_0x605d('0x3b')][_0x605d('0x43')]+'%'};return _0x4c4f54;}})});}_0x5531f4=_['merge']({},_0x5531f4,_0x211121['options']);var _0x28d81f={'where':_0x5531f4[_0x605d('0x44')]};return db[_0x605d('0x49')][_0x605d('0x2a')](_0x28d81f)[_0x605d('0x1c')](function(_0x1e5969){_0x596926[_0x605d('0x2a')]=_0x1e5969;if(_0x211121['query'][_0x605d('0x4a')]){_0x5531f4[_0x605d('0x4b')]=[{'all':!![]}];}return db[_0x605d('0x49')][_0x605d('0x4c')](_0x5531f4);})[_0x605d('0x1c')](function(_0xa0a13c){_0x596926[_0x605d('0x4d')]=_0xa0a13c;return _0x596926;})[_0x605d('0x1c')](respondWithFilteredResult(_0x5f4ffc,_0x5531f4))[_0x605d('0x27')](handleError(_0x5f4ffc,null));};exports[_0x605d('0x4e')]=function(_0x2291c4,_0x3e74e0){var _0x70dea7={'raw':![],'where':{'id':_0x2291c4[_0x605d('0x4f')]['id']},'include':[{'model':db[_0x605d('0x50')],'as':'mandatoryDispositionPause'}]},_0x56e618={};_0x56e618[_0x605d('0x39')]=_[_0x605d('0x3a')](db[_0x605d('0x49')]['rawAttributes']);_0x56e618['query']=_[_0x605d('0x3a')](_0x2291c4[_0x605d('0x3b')]);_0x56e618['filters']=_[_0x605d('0x3d')](_0x56e618[_0x605d('0x39')],_0x56e618[_0x605d('0x3b')]);_0x70dea7[_0x605d('0x3e')]=_[_0x605d('0x3d')](_0x56e618[_0x605d('0x39')],qs[_0x605d('0x3f')](_0x2291c4[_0x605d('0x3b')][_0x605d('0x3f')]));_0x70dea7[_0x605d('0x3e')]=_0x70dea7[_0x605d('0x3e')][_0x605d('0x40')]?_0x70dea7['attributes']:_0x56e618[_0x605d('0x39')];if(_0x2291c4['query'][_0x605d('0x4a')]){_0x70dea7['include']=[{'all':!![]}];}_0x70dea7=_[_0x605d('0x45')]({},_0x70dea7,_0x2291c4[_0x605d('0x51')]);return db[_0x605d('0x49')][_0x605d('0x52')](_0x70dea7)[_0x605d('0x1c')](handleEntityNotFound(_0x3e74e0,null))['then'](respondWithResult(_0x3e74e0,null))[_0x605d('0x27')](handleError(_0x3e74e0,null));};exports[_0x605d('0x53')]=function(_0x1b7b31,_0x5e082b){return db[_0x605d('0x49')]['create'](_0x1b7b31['body'],{})['then'](function(_0x54976d){var _0xb5701d=_0x1b7b31[_0x605d('0x54')][_0x605d('0x33')]({'plain':!![]});if(!_0xb5701d)throw new Error(_0x605d('0x55'));if(_0xb5701d[_0x605d('0x56')]==='user'){var _0x232438=_0x54976d['get']({'plain':!![]});var _0x1f159b=_0x605d('0x34');return db[_0x605d('0x57')][_0x605d('0x52')]({'where':{'name':_0x1f159b,'userProfileId':_0xb5701d[_0x605d('0x58')]},'raw':!![]})[_0x605d('0x1c')](function(_0x5bee31){if(_0x5bee31&&_0x5bee31['autoAssociation']===0x0){return db[_0x605d('0x35')][_0x605d('0x53')]({'name':_0x232438[_0x605d('0x37')],'resourceId':_0x232438['id'],'type':_0x5bee31['name'],'sectionId':_0x5bee31['id']},{})[_0x605d('0x1c')](function(){return _0x54976d;});}else{return _0x54976d;}})['catch'](function(_0xe5fe28){logger['error'](_0x605d('0x59'),_0xe5fe28);throw _0xe5fe28;});}return _0x54976d;})[_0x605d('0x1c')](respondWithResult(_0x5e082b,0xc9))[_0x605d('0x27')](handleError(_0x5e082b,null));};exports[_0x605d('0x31')]=function(_0xfd29d7,_0x329a71){if(_0xfd29d7[_0x605d('0x5a')]['id']){delete _0xfd29d7[_0x605d('0x5a')]['id'];}return db[_0x605d('0x49')][_0x605d('0x52')]({'where':{'id':_0xfd29d7[_0x605d('0x4f')]['id']},'include':[{'model':db[_0x605d('0x50')],'as':_0x605d('0x38')}]})[_0x605d('0x1c')](handleEntityNotFound(_0x329a71,null))[_0x605d('0x1c')](saveUpdates(_0xfd29d7[_0x605d('0x5a')],null))[_0x605d('0x1c')](respondWithResult(_0x329a71,null))['catch'](handleError(_0x329a71,null));};exports['destroy']=function(_0x46234d,_0x156328){return db[_0x605d('0x49')][_0x605d('0x52')]({'where':{'id':_0x46234d[_0x605d('0x4f')]['id']}})[_0x605d('0x1c')](handleEntityNotFound(_0x156328,null))[_0x605d('0x1c')](removeEntity(_0x156328,null))[_0x605d('0x27')](handleError(_0x156328,null));};exports[_0x605d('0x5b')]=function(_0x2cc874,_0x5ca292){return db[_0x605d('0x49')][_0x605d('0x5b')]()['then'](respondWithResult(_0x5ca292,null))[_0x605d('0x27')](handleError(_0x5ca292,null));};exports[_0x605d('0x5c')]=function(_0x26f5ca,_0x173506,_0x182004){if(_0x26f5ca[_0x605d('0x5a')]['id']){delete _0x26f5ca[_0x605d('0x5a')]['id'];}return db['FaxAccount'][_0x605d('0x52')]({'where':{'id':_0x26f5ca['params']['id']}})['then'](handleEntityNotFound(_0x173506,null))[_0x605d('0x1c')](function(_0x14d931){if(_0x14d931){_0x26f5ca['body'][_0x605d('0x5d')]=_0x14d931['id'];return db[_0x605d('0x5e')]['create'](_0x26f5ca['body']);}})['then'](respondWithResult(_0x173506,null))[_0x605d('0x27')](handleError(_0x173506,null));};exports[_0x605d('0x5f')]=function(_0x46c8e7,_0x79584e,_0x5b642d){var _0xdac218={'raw':![],'where':{}};var _0x5cc9eb={};var _0x52b1e8={'count':0x0,'rows':[]};return db[_0x605d('0x49')][_0x605d('0x60')]({'where':{'id':_0x46c8e7[_0x605d('0x4f')]['id']}})[_0x605d('0x1c')](handleEntityNotFound(_0x79584e,null))[_0x605d('0x1c')](function(_0x101de0){if(_0x101de0){_0x5cc9eb[_0x605d('0x39')]=_[_0x605d('0x3a')](db['Disposition'][_0x605d('0x61')]);_0x5cc9eb[_0x605d('0x3b')]=_[_0x605d('0x3a')](_0x46c8e7[_0x605d('0x3b')]);_0x5cc9eb[_0x605d('0x3c')]=_[_0x605d('0x3d')](_0x5cc9eb[_0x605d('0x39')],_0x5cc9eb[_0x605d('0x3b')]);_0xdac218[_0x605d('0x3e')]=_[_0x605d('0x3d')](_0x5cc9eb[_0x605d('0x39')],qs[_0x605d('0x3f')](_0x46c8e7['query'][_0x605d('0x3f')]));_0xdac218[_0x605d('0x3e')]=_0xdac218[_0x605d('0x3e')][_0x605d('0x40')]?_0xdac218[_0x605d('0x3e')]:_0x5cc9eb['model'];if(!_0x46c8e7[_0x605d('0x3b')][_0x605d('0x62')](_0x605d('0x63'))){_0xdac218['limit']=qs[_0x605d('0x2c')](_0x46c8e7[_0x605d('0x3b')][_0x605d('0x2c')]);_0xdac218[_0x605d('0x2b')]=qs[_0x605d('0x2b')](_0x46c8e7[_0x605d('0x3b')][_0x605d('0x2b')]);}_0xdac218[_0x605d('0x64')]=qs[_0x605d('0x41')](_0x46c8e7[_0x605d('0x3b')]['sort']);_0xdac218[_0x605d('0x44')]=qs[_0x605d('0x3c')](_[_0x605d('0x42')](_0x46c8e7[_0x605d('0x3b')],_0x5cc9eb[_0x605d('0x3c')]));_0xdac218['where'][_0x605d('0x5d')]=_0x101de0['id'];if(_0x46c8e7[_0x605d('0x3b')][_0x605d('0x43')]){_0xdac218[_0x605d('0x44')]=_['merge'](_0xdac218['where'],{'$or':_[_0x605d('0x46')](_0xdac218[_0x605d('0x3e')],function(_0x4c62ce){var _0x16f49a={};_0x16f49a[_0x4c62ce]={'$like':'%'+_0x46c8e7['query'][_0x605d('0x43')]+'%'};return _0x16f49a;})});}_0xdac218=_[_0x605d('0x45')]({},_0xdac218,_0x46c8e7[_0x605d('0x51')]);return db[_0x605d('0x5e')][_0x605d('0x2a')]({'where':_0xdac218[_0x605d('0x44')]})['then'](function(_0x3b8ec1){_0x52b1e8[_0x605d('0x2a')]=_0x3b8ec1;if(_0x46c8e7[_0x605d('0x3b')][_0x605d('0x4a')]){_0xdac218[_0x605d('0x4b')]=[{'all':!![]}];}return db[_0x605d('0x5e')][_0x605d('0x4c')](_0xdac218);})['then'](function(_0x2ba136){_0x52b1e8[_0x605d('0x4d')]=_0x2ba136;return _0x52b1e8;});}})[_0x605d('0x1c')](respondWithFilteredResult(_0x79584e,_0xdac218))[_0x605d('0x27')](handleError(_0x79584e,null));};exports[_0x605d('0x65')]=function(_0x357fd6,_0x4e8248,_0x1b753d){var _0x1dea24;return db[_0x605d('0x49')][_0x605d('0x52')]({'where':{'id':_0x357fd6[_0x605d('0x4f')]['id']}})[_0x605d('0x1c')](handleEntityNotFound(_0x4e8248,null))['then'](function(_0x20c52d){if(_0x20c52d){return _0x20c52d['removeDispositions'](_0x357fd6['query'][_0x605d('0x66')]);}})['then'](respondWithStatusCode(_0x4e8248,null))[_0x605d('0x27')](handleError(_0x4e8248,null));};exports['addAnswer']=function(_0x18bc8f,_0x467e3f,_0x5d736d){if(_0x18bc8f[_0x605d('0x5a')]['id']){delete _0x18bc8f[_0x605d('0x5a')]['id'];}return db[_0x605d('0x49')][_0x605d('0x52')]({'where':{'id':_0x18bc8f['params']['id']}})[_0x605d('0x1c')](handleEntityNotFound(_0x467e3f,null))[_0x605d('0x1c')](function(_0x50d002){if(_0x50d002){_0x18bc8f[_0x605d('0x5a')][_0x605d('0x5d')]=_0x50d002['id'];return db[_0x605d('0x67')][_0x605d('0x53')](_0x18bc8f[_0x605d('0x5a')]);}})[_0x605d('0x1c')](respondWithResult(_0x467e3f,null))[_0x605d('0x27')](handleError(_0x467e3f,null));};exports[_0x605d('0x68')]=function(_0x5a7e1,_0xb79849,_0x368040){var _0x5245fd={'raw':![],'where':{}};var _0x4d26d1={};var _0x28bc90={'count':0x0,'rows':[]};return db[_0x605d('0x49')][_0x605d('0x60')]({'where':{'id':_0x5a7e1[_0x605d('0x4f')]['id']}})[_0x605d('0x1c')](handleEntityNotFound(_0xb79849,null))['then'](function(_0x515594){if(_0x515594){_0x4d26d1[_0x605d('0x39')]=_[_0x605d('0x3a')](db[_0x605d('0x67')][_0x605d('0x61')]);_0x4d26d1[_0x605d('0x3b')]=_[_0x605d('0x3a')](_0x5a7e1[_0x605d('0x3b')]);_0x4d26d1['filters']=_[_0x605d('0x3d')](_0x4d26d1['model'],_0x4d26d1[_0x605d('0x3b')]);_0x5245fd[_0x605d('0x3e')]=_['intersection'](_0x4d26d1[_0x605d('0x39')],qs[_0x605d('0x3f')](_0x5a7e1[_0x605d('0x3b')][_0x605d('0x3f')]));_0x5245fd['attributes']=_0x5245fd[_0x605d('0x3e')][_0x605d('0x40')]?_0x5245fd[_0x605d('0x3e')]:_0x4d26d1[_0x605d('0x39')];if(!_0x5a7e1[_0x605d('0x3b')][_0x605d('0x62')](_0x605d('0x63'))){_0x5245fd[_0x605d('0x2c')]=qs['limit'](_0x5a7e1[_0x605d('0x3b')][_0x605d('0x2c')]);_0x5245fd[_0x605d('0x2b')]=qs[_0x605d('0x2b')](_0x5a7e1[_0x605d('0x3b')][_0x605d('0x2b')]);}_0x5245fd[_0x605d('0x64')]=qs[_0x605d('0x41')](_0x5a7e1[_0x605d('0x3b')][_0x605d('0x41')]);_0x5245fd['where']=qs[_0x605d('0x3c')](_['pick'](_0x5a7e1[_0x605d('0x3b')],_0x4d26d1['filters']));_0x5245fd[_0x605d('0x44')]['FaxAccountId']=_0x515594['id'];if(_0x5a7e1[_0x605d('0x3b')]['filter']){_0x5245fd['where']=_[_0x605d('0x45')](_0x5245fd[_0x605d('0x44')],{'$or':_[_0x605d('0x46')](_0x5245fd[_0x605d('0x3e')],function(_0x18ea16){var _0x1842a1={};_0x1842a1[_0x18ea16]={'$like':'%'+_0x5a7e1[_0x605d('0x3b')][_0x605d('0x43')]+'%'};return _0x1842a1;})});}_0x5245fd=_[_0x605d('0x45')]({},_0x5245fd,_0x5a7e1['options']);return db[_0x605d('0x67')][_0x605d('0x2a')]({'where':_0x5245fd[_0x605d('0x44')]})[_0x605d('0x1c')](function(_0x29ac08){_0x28bc90[_0x605d('0x2a')]=_0x29ac08;if(_0x5a7e1[_0x605d('0x3b')][_0x605d('0x4a')]){_0x5245fd[_0x605d('0x4b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x605d('0x4c')](_0x5245fd);})[_0x605d('0x1c')](function(_0x556eb5){_0x28bc90[_0x605d('0x4d')]=_0x556eb5;return _0x28bc90;});}})[_0x605d('0x1c')](respondWithFilteredResult(_0xb79849,_0x5245fd))['catch'](handleError(_0xb79849,null));};exports[_0x605d('0x69')]=function(_0xf2395a,_0x59b8e4,_0x3a7142){var _0x433388;return db[_0x605d('0x49')][_0x605d('0x52')]({'where':{'id':_0xf2395a[_0x605d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x59b8e4,null))['then'](function(_0xb15f39){if(_0xb15f39){return _0xb15f39[_0x605d('0x69')](_0xf2395a[_0x605d('0x3b')][_0x605d('0x66')]);}})['then'](respondWithStatusCode(_0x59b8e4,null))[_0x605d('0x27')](handleError(_0x59b8e4,null));};exports[_0x605d('0x6a')]=function(_0xa2e753,_0xf3a80f,_0x5411a2){return db[_0x605d('0x6b')]['find']({'where':{'id':_0xa2e753[_0x605d('0x4f')]['id']}})[_0x605d('0x1c')](handleEntityNotFound(_0xf3a80f,null))[_0x605d('0x1c')](function(_0x51746d){if(_0x51746d){return _0x51746d[_0x605d('0x6a')](_0xa2e753[_0x605d('0x5a')][_0x605d('0x66')],_[_0x605d('0x6c')](_0xa2e753[_0x605d('0x5a')],['ids','id'])||{});}})[_0x605d('0x1c')](respondWithResult(_0xf3a80f,null))[_0x605d('0x27')](handleError(_0xf3a80f,null));};exports[_0x605d('0x6d')]=function(_0x31437f,_0x227f3b,_0xf7b666){var _0x543397={'raw':![],'where':{}};var _0x496bef={};var _0x5f150e={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x31437f['params']['id']}})[_0x605d('0x1c')](handleEntityNotFound(_0x227f3b,null))[_0x605d('0x1c')](function(_0x2faeba){if(_0x2faeba){_0x496bef[_0x605d('0x39')]=_[_0x605d('0x3a')](db['FaxInteraction'][_0x605d('0x61')]);_0x496bef['query']=_[_0x605d('0x3a')](_0x31437f[_0x605d('0x3b')]);_0x496bef[_0x605d('0x3c')]=_[_0x605d('0x3d')](_0x496bef['model'],_0x496bef['query']);_0x543397[_0x605d('0x3e')]=_[_0x605d('0x3d')](_0x496bef[_0x605d('0x39')],qs[_0x605d('0x3f')](_0x31437f[_0x605d('0x3b')][_0x605d('0x3f')]));_0x543397[_0x605d('0x3e')]=_0x543397[_0x605d('0x3e')]['length']?_0x543397[_0x605d('0x3e')]:_0x496bef[_0x605d('0x39')];if(!_0x31437f[_0x605d('0x3b')][_0x605d('0x62')](_0x605d('0x63'))){_0x543397[_0x605d('0x2c')]=qs['limit'](_0x31437f[_0x605d('0x3b')][_0x605d('0x2c')]);_0x543397[_0x605d('0x2b')]=qs[_0x605d('0x2b')](_0x31437f[_0x605d('0x3b')][_0x605d('0x2b')]);}_0x543397[_0x605d('0x64')]=qs[_0x605d('0x41')](_0x31437f[_0x605d('0x3b')]['sort']);_0x543397[_0x605d('0x44')]=qs['filters'](_[_0x605d('0x42')](_0x31437f[_0x605d('0x3b')],_0x496bef[_0x605d('0x3c')]));_0x543397['where'][_0x605d('0x5d')]=_0x2faeba['id'];if(_0x31437f[_0x605d('0x3b')][_0x605d('0x43')]){_0x543397['where']=_[_0x605d('0x45')](_0x543397[_0x605d('0x44')],{'$or':_[_0x605d('0x46')](_0x543397[_0x605d('0x3e')],function(_0x161ba6){var _0x1a5546={};_0x1a5546[_0x161ba6]={'$like':'%'+_0x31437f[_0x605d('0x3b')][_0x605d('0x43')]+'%'};return _0x1a5546;})});}_0x543397=_[_0x605d('0x45')]({},_0x543397,_0x31437f[_0x605d('0x51')]);return db[_0x605d('0x6b')][_0x605d('0x2a')]({'where':_0x543397[_0x605d('0x44')]})[_0x605d('0x1c')](function(_0x4e49df){_0x5f150e[_0x605d('0x2a')]=_0x4e49df;if(_0x31437f[_0x605d('0x3b')][_0x605d('0x4a')]){_0x543397['include']=[{'model':db[_0x605d('0x6e')],'as':_0x605d('0x6f'),'required':![]},{'model':db['User'],'as':_0x605d('0x70'),'attributes':[_0x605d('0x37'),_0x605d('0x71'),_0x605d('0x72')],'required':![]},{'model':db[_0x605d('0x73')],'as':'Tags','attributes':['id',_0x605d('0x37'),_0x605d('0x74')],'where':_0x31437f[_0x605d('0x3b')][_0x605d('0x75')]?{'id':_0x31437f[_0x605d('0x3b')][_0x605d('0x75')]}:undefined,'required':_0x31437f['query']['tag']?!![]:![]}];}return db[_0x605d('0x6b')][_0x605d('0x4c')](_0x543397);})[_0x605d('0x1c')](function(_0x495547){_0x5f150e[_0x605d('0x4d')]=_0x495547;return _0x5f150e;});}})[_0x605d('0x1c')](respondWithFilteredResult(_0x227f3b,_0x543397))['catch'](handleError(_0x227f3b,null));};exports[_0x605d('0x76')]=function(_0x345cb5,_0x515384,_0x352e76){return db[_0x605d('0x49')][_0x605d('0x60')]({'where':{'id':_0x345cb5[_0x605d('0x4f')]['id']}})[_0x605d('0x1c')](handleEntityNotFound(_0x515384,null))['then'](function(_0x56f9c3){if(_0x56f9c3){return db[_0x605d('0x77')][_0x605d('0x78')](function(_0x497054){return db[_0x605d('0x79')][_0x605d('0x32')]({'where':{'FaxAccountId':_0x345cb5['params']['id']},'transaction':_0x497054})['then'](function(_0x3c2411){var _0x2fea14=_[_0x605d('0x46')](_0x345cb5[_0x605d('0x5a')],function(_0x5da673){_0x5da673['FaxAccountId']=_0x345cb5[_0x605d('0x4f')]['id'];return _0x5da673;});return db[_0x605d('0x79')][_0x605d('0x7a')](_0x2fea14,{'transaction':_0x497054});});})[_0x605d('0x1c')](function(){return db['FaxApplication'][_0x605d('0x7b')]({'where':{'FaxAccountId':_0x345cb5[_0x605d('0x4f')]['id']},'order':_0x605d('0x7c')});});}})['then'](respondWithResult(_0x515384,null))['catch'](handleError(_0x515384,null));};exports['getApplications']=function(_0x3a1df7,_0x3ffa34,_0x283c85){var _0x3fd770={};var _0x3ecf06={};var _0x2d7dd5;var _0x43e7fb;return db[_0x605d('0x49')][_0x605d('0x60')]({'where':{'id':_0x3a1df7['params']['id']}})['then'](handleEntityNotFound(_0x3ffa34,null))[_0x605d('0x1c')](function(_0x245989){if(_0x245989){_0x2d7dd5=_0x245989;_0x3ecf06[_0x605d('0x39')]=_['keys'](db[_0x605d('0x79')][_0x605d('0x61')]);_0x3ecf06[_0x605d('0x3b')]=_[_0x605d('0x3a')](_0x3a1df7[_0x605d('0x3b')]);_0x3ecf06[_0x605d('0x3c')]=_[_0x605d('0x3d')](_0x3ecf06[_0x605d('0x39')],_0x3ecf06[_0x605d('0x3b')]);_0x3fd770[_0x605d('0x3e')]=_['intersection'](_0x3ecf06[_0x605d('0x39')],qs[_0x605d('0x3f')](_0x3a1df7[_0x605d('0x3b')][_0x605d('0x3f')]));_0x3fd770[_0x605d('0x3e')]=_0x3fd770[_0x605d('0x3e')][_0x605d('0x40')]?_0x3fd770['attributes']:_0x3ecf06[_0x605d('0x39')];_0x3fd770[_0x605d('0x64')]=qs[_0x605d('0x41')](_0x3a1df7[_0x605d('0x3b')][_0x605d('0x41')]);_0x3fd770['where']=qs[_0x605d('0x3c')](_['pick'](_0x3a1df7['query'],_0x3ecf06[_0x605d('0x3c')]));if(_0x3a1df7[_0x605d('0x3b')]['filter']){_0x3fd770[_0x605d('0x44')]=_[_0x605d('0x45')](_0x3fd770[_0x605d('0x44')],{'$or':_[_0x605d('0x46')](_0x3fd770['attributes'],function(_0x5d9ee6){var _0x26cb96={};_0x26cb96[_0x5d9ee6]={'$like':'%'+_0x3a1df7[_0x605d('0x3b')][_0x605d('0x43')]+'%'};return _0x26cb96;})});}_0x3fd770=_['merge']({},_0x3fd770,_0x3a1df7[_0x605d('0x51')]);return _0x2d7dd5[_0x605d('0x7d')](_0x3fd770);}})['then'](function(_0x5a8c5e){if(_0x5a8c5e){_0x43e7fb=_0x5a8c5e[_0x605d('0x40')];if(!_0x3a1df7[_0x605d('0x3b')][_0x605d('0x62')](_0x605d('0x63'))){_0x3fd770[_0x605d('0x2c')]=qs[_0x605d('0x2c')](_0x3a1df7[_0x605d('0x3b')]['limit']);_0x3fd770['offset']=qs['offset'](_0x3a1df7[_0x605d('0x3b')][_0x605d('0x2b')]);}return _0x2d7dd5[_0x605d('0x7d')](_0x3fd770);}})[_0x605d('0x1c')](function(_0x464e75){if(_0x464e75){return _0x464e75?{'count':_0x43e7fb,'rows':_0x464e75}:null;}})[_0x605d('0x1c')](respondWithResult(_0x3ffa34,null))[_0x605d('0x27')](handleError(_0x3ffa34,null));};function Extension(_0x3279c2,_0xbec2fd,_0x340c73,_0x375c43){this[_0x605d('0x7e')]='from-voip-provider';this[_0x605d('0x7f')]=_0x3279c2[_0x605d('0x80')];this['app']=_0x375c43;this[_0x605d('0x47')]=_0x605d('0x81');this[_0x605d('0x82')]=_0x605d('0x83');this['FaxAccountId']=_0x3279c2['id'];this['priority']=_0xbec2fd;this[_0x605d('0x84')]=_0x340c73;}function createExtensionsReciveFax(_0x574f7f){var _0x4a528a=0x1;var _0x123050=[];_0x123050['push'](new Extension(_0x574f7f,_0x4a528a,'','Answer'));_0x4a528a+=0x1;_0x123050['push'](new Extension(_0x574f7f,_0x4a528a,_0x605d('0x85'),'Set'));_0x4a528a+=0x1;for(var _0x5cdf65 in _0x574f7f){if(_0x574f7f[_0x605d('0x62')](_0x5cdf65)&&(_0x5cdf65===_0x605d('0x86')||_0x5cdf65===_0x605d('0x80')||_0x5cdf65===_0x605d('0x87')||_0x5cdf65===_0x605d('0x88')||_0x5cdf65===_0x605d('0x89')||_0x5cdf65===_0x605d('0x8a')||_0x5cdf65===_0x605d('0x8b')||_0x5cdf65==='modem'||_0x5cdf65===_0x605d('0x8c'))){_0x123050[_0x605d('0x8d')](new Extension(_0x574f7f,_0x4a528a,_0x605d('0x8e')+_0x5cdf65+')='+_0x574f7f[_0x5cdf65],_0x605d('0x8f')));_0x4a528a+=0x1;}}_0x123050[_0x605d('0x8d')](new Extension(_0x574f7f,_0x4a528a,'6','Wait'));_0x4a528a+=0x1;_0x123050['push'](new Extension(_0x574f7f,_0x4a528a,_0x605d('0x90'),_0x605d('0x91')));_0x4a528a=0x0;return _0x123050;}exports[_0x605d('0x92')]=function(_0x4630c9,_0xb3bf35,_0x4a326e){var _0x4a3485;return db[_0x605d('0x77')]['transaction'](function(_0x1a4175){return db[_0x605d('0x49')][_0x605d('0x53')](_0x4630c9[_0x605d('0x5a')],{'transaction':_0x1a4175})[_0x605d('0x1c')](function(_0x461265){_0x4a3485=_0x461265['get']({'plain':!![]});return db[_0x605d('0x93')][_0x605d('0x7a')](createExtensionsReciveFax(_0x4a3485),{'transaction':_0x1a4175});});})['then'](function(){return _0x4a3485;})[_0x605d('0x1c')](respondWithResult(_0xb3bf35,null))[_0x605d('0x27')](handleError(_0xb3bf35,null));};exports[_0x605d('0x94')]=function(_0x37cdfb,_0x357c15,_0x2663f3){var _0x1c5fc7;return db['sequelize'][_0x605d('0x78')](function(_0x24f48c){return db[_0x605d('0x49')]['update'](_0x37cdfb['body'],{'where':{'id':_0x37cdfb[_0x605d('0x5a')]['id']},'transaction':_0x24f48c})[_0x605d('0x1c')](function(_0x2a03c5){return db[_0x605d('0x93')][_0x605d('0x32')]({'where':{'FaxAccountId':_0x37cdfb[_0x605d('0x5a')]['id']},'transaction':_0x24f48c})['then'](function(_0x775ff8){return db[_0x605d('0x93')][_0x605d('0x7a')](createExtensionsReciveFax(_[_0x605d('0x6c')](_0x37cdfb[_0x605d('0x5a')],[_0x605d('0x95'),'key','createdAt',_0x605d('0x96'),'TrunkId',_0x605d('0x97')])),{'transaction':_0x24f48c});});});})[_0x605d('0x1c')](function(){return db['FaxAccount'][_0x605d('0x98')](_0x37cdfb[_0x605d('0x5a')]['id']);})['then'](respondWithResult(_0x357c15,null))[_0x605d('0x27')](handleError(_0x357c15,null));};exports['getMessages']=function(_0x3b6409,_0x456543,_0x426577){var _0x11b55c={'raw':!![],'where':{}};var _0x1bb2e0={};var _0x340500={'count':0x0,'rows':[]};return db[_0x605d('0x49')][_0x605d('0x60')]({'where':{'id':_0x3b6409[_0x605d('0x4f')]['id']}})[_0x605d('0x1c')](handleEntityNotFound(_0x456543,null))[_0x605d('0x1c')](function(_0x13a07a){if(_0x13a07a){_0x1bb2e0['model']=_['keys'](db[_0x605d('0x99')][_0x605d('0x61')]);_0x1bb2e0[_0x605d('0x3b')]=_['keys'](_0x3b6409[_0x605d('0x3b')]);_0x1bb2e0[_0x605d('0x3c')]=_[_0x605d('0x3d')](_0x1bb2e0[_0x605d('0x39')],_0x1bb2e0[_0x605d('0x3b')]);_0x11b55c['attributes']=_[_0x605d('0x3d')](_0x1bb2e0['model'],qs[_0x605d('0x3f')](_0x3b6409[_0x605d('0x3b')]['fields']));_0x11b55c[_0x605d('0x3e')]=_0x11b55c[_0x605d('0x3e')]['length']?_0x11b55c[_0x605d('0x3e')]:_0x1bb2e0['model'];if(!_0x3b6409['query'][_0x605d('0x62')](_0x605d('0x63'))){_0x11b55c[_0x605d('0x2c')]=qs[_0x605d('0x2c')](_0x3b6409[_0x605d('0x3b')][_0x605d('0x2c')]);_0x11b55c['offset']=qs[_0x605d('0x2b')](_0x3b6409[_0x605d('0x3b')][_0x605d('0x2b')]);}_0x11b55c[_0x605d('0x64')]=qs['sort'](_0x3b6409[_0x605d('0x3b')][_0x605d('0x41')]);_0x11b55c[_0x605d('0x44')]=qs[_0x605d('0x3c')](_[_0x605d('0x42')](_0x3b6409[_0x605d('0x3b')],_0x1bb2e0['filters']));_0x11b55c[_0x605d('0x44')][_0x605d('0x5d')]=_0x13a07a['id'];if(_0x3b6409[_0x605d('0x3b')][_0x605d('0x43')]){_0x11b55c[_0x605d('0x44')]=_[_0x605d('0x45')](_0x11b55c['where'],{'$or':_[_0x605d('0x46')](_0x11b55c['attributes'],function(_0x4e442a){var _0x225e75={};_0x225e75[_0x4e442a]={'$like':'%'+_0x3b6409[_0x605d('0x3b')][_0x605d('0x43')]+'%'};return _0x225e75;})});}if(_0x3b6409[_0x605d('0x3b')][_0x605d('0x9a')]){var _0x42c3e6=_0x3b6409['query']['$gte']['split'](',');var _0x306015={};_0x306015[_0x42c3e6[0x0]]={'$gte':moment(_0x42c3e6[0x1])['format'](_0x605d('0x9b'))};_0x11b55c[_0x605d('0x44')]=_[_0x605d('0x45')](_0x11b55c['where'],_0x306015);}_0x11b55c=_['merge']({},_0x11b55c,_0x3b6409[_0x605d('0x51')]);return db[_0x605d('0x99')][_0x605d('0x2a')]({'where':_0x11b55c[_0x605d('0x44')]})[_0x605d('0x1c')](function(_0x210999){_0x340500[_0x605d('0x2a')]=_0x210999;if(_0x3b6409[_0x605d('0x3b')][_0x605d('0x4a')]){_0x11b55c['include']=[{'all':!![]}];}return db[_0x605d('0x99')][_0x605d('0x4c')](_0x11b55c);})[_0x605d('0x1c')](function(_0x1b4352){_0x340500['rows']=_0x1b4352;return _0x340500;});}})[_0x605d('0x1c')](respondWithFilteredResult(_0x456543,_0x11b55c))[_0x605d('0x27')](handleError(_0x456543,null));};exports[_0x605d('0x9c')]=function(_0x4cef44,_0x52064f,_0x4aec84){var _0x2de703,_0x1dc1d5={},_0xdda2a5;if(_0x4cef44['body']['to']){_0xdda2a5=_0x4cef44['body']['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x4cef44[_0x605d('0x4f')]['id']},'include':[{'model':db[_0x605d('0x9d')],'as':'List','include':[{'model':db['CmContact'],'as':_0x605d('0x9e'),'where':{'fax':_0xdda2a5},'limit':0x1,'order':[[_0x605d('0x96'),_0x605d('0x9f')]]}]}]})[_0x605d('0x1c')](handleEntityNotFound(_0x52064f,null))['then'](function(_0x40d17c){_0x2de703=_0x40d17c;if(_0x4cef44[_0x605d('0x5a')][_0x605d('0xa0')]&&_0x4cef44[_0x605d('0x5a')][_0x605d('0xa0')][_0x605d('0x40')]){for(var _0x21f65c=0x0;_0x21f65c<_0x4cef44['body'][_0x605d('0xa0')]['length'];_0x21f65c+=0x1){_0x4cef44[_0x605d('0x5a')]['attachments'][_0x21f65c]={'filename':_0x4cef44['body'][_0x605d('0xa0')][_0x21f65c]['name'],'id':_0x4cef44[_0x605d('0x5a')][_0x605d('0xa0')][_0x21f65c]['id'],'path':path[_0x605d('0xa1')](config[_0x605d('0xa2')],'server/files/attachments',_0x4cef44[_0x605d('0x5a')][_0x605d('0xa0')][_0x21f65c][_0x605d('0xa3')])};}}return respondWithRpcPromise('CheckAfterSend',_0x605d('0xa4'),{'FaxAccountId':_[_0x605d('0xa5')](_0x4cef44[_0x605d('0x4f')]['id'])?undefined:_0x4cef44['params']['id'],'path':_[_0x605d('0xa5')](_0x4cef44[_0x605d('0x5a')]['attachments'][0x0]['path'])?undefined:_0x4cef44['body'][_0x605d('0xa0')][0x0]['path'],'fax':_[_0x605d('0xa5')](_0x4cef44[_0x605d('0x5a')]['to'][0x0])?undefined:_0x4cef44[_0x605d('0x5a')]['to'][0x0]},client9002);})[_0x605d('0x1c')](function(){if(_0x2de703){if(_[_0x605d('0xa5')](_0x4cef44[_0x605d('0x5a')][_0x605d('0xa6')])){_0x4cef44[_0x605d('0x5a')][_0x605d('0xa6')]=util[_0x605d('0xa7')](_0x605d('0xa8'),_0x2de703[_0x605d('0x37')],_0x2de703[_0x605d('0xa9')]);}if(_0x2de703[_0x605d('0xaa')]){if(_0x2de703[_0x605d('0xaa')][_0x605d('0x9e')][_0x605d('0x40')]){return _0x2de703[_0x605d('0xaa')][_0x605d('0x9e')][0x0];}else{return db[_0x605d('0x6e')][_0x605d('0x53')](_[_0x605d('0x14')](_0x4cef44[_0x605d('0x5a')],{'firstName':_0x4cef44[_0x605d('0x5a')]['to'][0x0],'phone':_0x4cef44['body']['to'][0x0],'fax':_0x4cef44[_0x605d('0x5a')]['to'][0x0],'ListId':_0x2de703[_0x605d('0x97')]}));}}else{throw new Error(_0x605d('0xab'));}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x859672){if(_0x859672){return db[_0x605d('0x6b')][_0x605d('0x52')]({'where':{'ContactId':_0x859672['id'],'closed':![],'FaxAccountId':_0x2de703['id']}})[_0x605d('0x1c')](function(_0x3f5ac5){if(_0x3f5ac5){return[_0x3f5ac5,![]];}return db['FaxInteraction'][_0x605d('0x53')]({'UserId':_0x4cef44[_0x605d('0x54')]['id'],'ContactId':_0x859672['id'],'FaxAccountId':_0x2de703['id'],'fax':_0x4cef44[_0x605d('0x5a')]['to'][0x0],'firstMsgDirection':_0x605d('0xac'),'Messages':[_[_0x605d('0x45')](_0x4cef44[_0x605d('0x5a')],{'read':![],'body':_0x4cef44['body']['attachments'][0x0][_0x605d('0xad')],'FaxAccountId':_0x2de703['id'],'UserId':_0x4cef44[_0x605d('0x54')]['id'],'ContactId':_0x859672['id'],'AttachmentId':_0x4cef44['body']['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x605d('0x99')],'as':_0x605d('0xae')}]})[_0x605d('0x1c')](function(_0x597bd2){return[_0x597bd2,!![]];});});}else{throw new Error(_0x605d('0xaf'));}})[_0x605d('0xb0')](function(_0x3b2a2a,_0xf136be){if(_0xf136be){return _0x3b2a2a;}return db[_0x605d('0x99')]['create']({'direction':_0x605d('0xac'),'read':![],'body':_0x4cef44['body'][_0x605d('0xa0')][0x0][_0x605d('0xad')],'FaxAccountId':_0x2de703['id'],'FaxInteractionId':_0x3b2a2a['id'],'UserId':_0x4cef44['user']['id'],'ContactId':_0x3b2a2a[_0x605d('0xb1')],'AttachmentId':_0x4cef44['body'][_0x605d('0xa0')][0x0]['id']})[_0x605d('0x1c')](function(_0x1af845){_0x3b2a2a['dataValues']['Messages']=[];_0x3b2a2a[_0x605d('0xb2')][_0x605d('0xae')][_0x605d('0x8d')](_0x1af845[_0x605d('0xb2')]);return _0x3b2a2a;});})['then'](function(_0xa2d281){respondWithRpcPromise(_0x605d('0xb3'),_0x605d('0xb3'),{'FaxAccountId':_[_0x605d('0xa5')](_0x4cef44[_0x605d('0x4f')]['id'])?undefined:_0x4cef44[_0x605d('0x4f')]['id'],'path':_[_0x605d('0xa5')](_0x4cef44[_0x605d('0x5a')][_0x605d('0xa0')][0x0][_0x605d('0x5')])?undefined:_0x4cef44[_0x605d('0x5a')]['attachments'][0x0][_0x605d('0x5')],'fax':_[_0x605d('0xa5')](_0x4cef44['body']['to'][0x0])?undefined:_0x4cef44[_0x605d('0x5a')]['to'][0x0],'AttachmentId':_0x4cef44['body'][_0x605d('0xa0')][0x0]['id']},client9002)[_0x605d('0x1c')](function(_0x47b6c8){logger[_0x605d('0x1d')]('SendFaxRpc,\x20%s',_0x47b6c8);})[_0x605d('0x27')](function(_0x4322b9){logger[_0x605d('0x1d')](_0x605d('0xb4'),_0x4322b9);});return _0xa2d281;})[_0x605d('0x1c')](respondWithResult(_0x52064f,null))[_0x605d('0x27')](handleError(_0x52064f,null));};exports[_0x605d('0xb5')]=function(_0x3f3535,_0x1d7c77,_0x1eb719){return db[_0x605d('0x49')]['find']({'where':{'id':_0x3f3535[_0x605d('0x4f')]['id']}})[_0x605d('0x1c')](handleEntityNotFound(_0x1d7c77,null))[_0x605d('0x1c')](function(_0x2d5d48){if(_0x2d5d48){return _0x2d5d48['addAgents'](_0x3f3535['body'][_0x605d('0x66')],_[_0x605d('0x6c')](_0x3f3535[_0x605d('0x5a')],[_0x605d('0x66'),'id'])||{})[_0x605d('0xb0')](function(_0x5a006e){for(var _0x47d406=0x0;_0x47d406<_0x3f3535[_0x605d('0x5a')]['ids'][_0x605d('0x40')];_0x47d406+=0x1){socket[_0x605d('0xb6')](_0x605d('0xb7'),{'UserId':_0x3f3535[_0x605d('0x5a')][_0x605d('0x66')][_0x47d406],'FaxAccountId':_0x3f3535[_0x605d('0x4f')]['id']});}return _0x5a006e;});}})[_0x605d('0x1c')](respondWithResult(_0x1d7c77,null))[_0x605d('0x27')](handleError(_0x1d7c77,null));};exports[_0x605d('0xb8')]=function(_0xdd1fae,_0x87c3b6,_0x509d25){var _0x191877;return db[_0x605d('0x49')][_0x605d('0x52')]({'where':{'id':_0xdd1fae['params']['id']}})[_0x605d('0x1c')](handleEntityNotFound(_0x87c3b6,null))['then'](function(_0x49670c){if(_0x49670c){return _0x49670c[_0x605d('0xb8')](_0xdd1fae[_0x605d('0x3b')][_0x605d('0x66')])[_0x605d('0x1c')](function(_0x5cf1d6){if(_[_0x605d('0xb9')](_0xdd1fae[_0x605d('0x3b')][_0x605d('0x66')])){for(var _0x5d9379=0x0;_0x5d9379<_0xdd1fae['query'][_0x605d('0x66')]['length'];_0x5d9379+=0x1){socket[_0x605d('0xb6')](_0x605d('0xba'),{'UserId':_0xdd1fae['query'][_0x605d('0x66')][_0x5d9379],'FaxAccountId':_0xdd1fae[_0x605d('0x4f')]['id']});}}else{socket['emit'](_0x605d('0xba'),{'UserId':_0xdd1fae[_0x605d('0x3b')]['ids'],'FaxAccountId':_0xdd1fae[_0x605d('0x4f')]['id']});}});}})[_0x605d('0x1c')](respondWithStatusCode(_0x87c3b6,null))[_0x605d('0x27')](handleError(_0x87c3b6,null));};exports[_0x605d('0xbb')]=function(_0x2d95a8,_0x40aad1,_0x56fb98){var _0x5ee8c6={};var _0x27f83a={};var _0x55bd7c;var _0x450282;return db[_0x605d('0x49')][_0x605d('0x60')]({'where':{'id':_0x2d95a8[_0x605d('0x4f')]['id']}})[_0x605d('0x1c')](handleEntityNotFound(_0x40aad1,null))['then'](function(_0x3f0f74){if(_0x3f0f74){_0x55bd7c=_0x3f0f74;_0x27f83a['model']=_['keys'](db[_0x605d('0xbc')][_0x605d('0x61')]);_0x27f83a[_0x605d('0x3b')]=_['keys'](_0x2d95a8[_0x605d('0x3b')]);_0x27f83a[_0x605d('0x3c')]=_[_0x605d('0x3d')](_0x27f83a[_0x605d('0x39')],_0x27f83a[_0x605d('0x3b')]);_0x5ee8c6[_0x605d('0x3e')]=_[_0x605d('0x3d')](_0x27f83a[_0x605d('0x39')],qs[_0x605d('0x3f')](_0x2d95a8['query'][_0x605d('0x3f')]));_0x5ee8c6[_0x605d('0x3e')]=_0x5ee8c6[_0x605d('0x3e')][_0x605d('0x40')]?_0x5ee8c6[_0x605d('0x3e')]:_0x27f83a[_0x605d('0x39')];_0x5ee8c6[_0x605d('0x64')]=qs['sort'](_0x2d95a8[_0x605d('0x3b')][_0x605d('0x41')]);_0x5ee8c6[_0x605d('0x44')]=qs[_0x605d('0x3c')](_['pick'](_0x2d95a8[_0x605d('0x3b')],_0x27f83a[_0x605d('0x3c')]));if(_0x2d95a8[_0x605d('0x3b')]['filter']){_0x5ee8c6['where']=_[_0x605d('0x45')](_0x5ee8c6[_0x605d('0x44')],{'$or':_['map'](_0x5ee8c6[_0x605d('0x3e')],function(_0x3f8545){var _0x130cd4={};_0x130cd4[_0x3f8545]={'$like':'%'+_0x2d95a8[_0x605d('0x3b')]['filter']+'%'};return _0x130cd4;})});}_0x5ee8c6=_[_0x605d('0x45')]({},_0x5ee8c6,_0x2d95a8[_0x605d('0x51')]);return _0x55bd7c[_0x605d('0xbb')](_0x5ee8c6);}})[_0x605d('0x1c')](function(_0x28d201){if(_0x28d201){_0x450282=_0x28d201[_0x605d('0x40')];if(!_0x2d95a8['query'][_0x605d('0x62')]('nolimit')){_0x5ee8c6[_0x605d('0x2c')]=qs[_0x605d('0x2c')](_0x2d95a8[_0x605d('0x3b')][_0x605d('0x2c')]);_0x5ee8c6['offset']=qs[_0x605d('0x2b')](_0x2d95a8[_0x605d('0x3b')][_0x605d('0x2b')]);}return _0x55bd7c['getAgents'](_0x5ee8c6);}})['then'](function(_0x51ea86){if(_0x51ea86){return _0x51ea86?{'count':_0x450282,'rows':_0x51ea86}:null;}})[_0x605d('0x1c')](respondWithResult(_0x40aad1,null))[_0x605d('0x27')](handleError(_0x40aad1,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index ec2b68f..73c4ca8 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 _0x508c=['emit','hasOwnProperty','hook','events','../../mysqldb','FaxAccount','setMaxListeners','update','remove'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x508c,0x12c));var _0xc508=function(_0x57bad4,_0x2575b0){_0x57bad4=_0x57bad4-0x0;var _0x1b41c3=_0x508c[_0x57bad4];return _0x1b41c3;};'use strict';var EventEmitter=require(_0xc508('0x0'));var FaxAccount=require(_0xc508('0x1'))['db'][_0xc508('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xc508('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc508('0x4'),'afterDestroy':_0xc508('0x5')};function emitEvent(_0x470a00){return function(_0x108ac9,_0x2893a8,_0x496da3){FaxAccountEvents[_0xc508('0x6')](_0x470a00+':'+_0x108ac9['id'],_0x108ac9);FaxAccountEvents[_0xc508('0x6')](_0x470a00,_0x108ac9);_0x496da3(null);};}for(var e in events){if(events[_0xc508('0x7')](e)){var event=events[e];FaxAccount[_0xc508('0x8')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x408b=['FaxAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3614f2,_0x1bb103){var _0x5dc391=function(_0x5b82a6){while(--_0x5b82a6){_0x3614f2['push'](_0x3614f2['shift']());}};_0x5dc391(++_0x1bb103);}(_0x408b,0x148));var _0xb408=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x408b[_0x487b0c];return _0x1adbdc;};'use strict';var EventEmitter=require(_0xb408('0x0'));var FaxAccount=require(_0xb408('0x1'))['db'][_0xb408('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xb408('0x3')](0x0);var events={'afterCreate':_0xb408('0x4'),'afterUpdate':_0xb408('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1fb517){return function(_0x29e09d,_0x3052bc,_0x1bf2ee){FaxAccountEvents[_0xb408('0x6')](_0x1fb517+':'+_0x29e09d['id'],_0x29e09d);FaxAccountEvents[_0xb408('0x6')](_0x1fb517,_0x29e09d);_0x1bf2ee(null);};}for(var e in events){if(events[_0xb408('0x7')](e)){var event=events[e];FaxAccount[_0xb408('0x8')](e,emitEvent(event));}}module[_0xb408('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index e5040a2..9822a93 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 _0x9704=['./faxAccount.attributes','lodash','util','../../config/logger','moment','request-promise'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x9704,0x6d));var _0x4970=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9704[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4970('0x0'));var util=require(_0x4970('0x1'));var logger=require(_0x4970('0x2'))('api');var moment=require(_0x4970('0x3'));var BPromise=require('bluebird');var rp=require(_0x4970('0x4'));var attributes=require(_0x4970('0x5'));module['exports']=function(_0x438b76,_0x643d15){return _0x438b76['define']('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91b6=['./faxAccount.attributes','exports','define','lodash','util','api','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x91b6,0x18b));var _0x691b=function(_0xc2adf7,_0xd55f45){_0xc2adf7=_0xc2adf7-0x0;var _0x464209=_0x91b6[_0xc2adf7];return _0x464209;};'use strict';var _=require(_0x691b('0x0'));var util=require(_0x691b('0x1'));var logger=require('../../config/logger')(_0x691b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x691b('0x3'));var attributes=require(_0x691b('0x4'));module[_0x691b('0x5')]=function(_0x28f581,_0xeca3c){return _0x28f581[_0x691b('0x6')]('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index a602905..724e5ab 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 _0xf5ac=['defaults','localhost','socket.io-emitter','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','model','map','catch','NotifyFaxAccount','body','CmContact','describe','ValidationError','difference','keys','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','find','account','List','Contacts','FaxApplication','Applications','get','applications','orderBy','length','create','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','autoclose','close','unmanaged','*,*,*,*','created','interaction','ContactId','UserId','User','unshift','name','waitForTheAssignedAgent','startRouting','Start','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis'];(function(_0x33add6,_0x435ffe){var _0x1d96ec=function(_0xd9d641){while(--_0xd9d641){_0x33add6['push'](_0x33add6['shift']());}};_0x1d96ec(++_0x435ffe);}(_0xf5ac,0x1a9));var _0xcf5a=function(_0x4f1fa8,_0x5dce43){_0x4f1fa8=_0x4f1fa8-0x0;var _0x401d68=_0xf5ac[_0x4f1fa8];return _0x401d68;};'use strict';var _=require(_0xcf5a('0x0'));var util=require('util');var moment=require(_0xcf5a('0x1'));var BPromise=require('bluebird');var rs=require(_0xcf5a('0x2'));var fs=require('fs');var Redis=require(_0xcf5a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcf5a('0x4'));var logger=require(_0xcf5a('0x5'))('rpc');var config=require(_0xcf5a('0x6'));var jayson=require(_0xcf5a('0x7'));var client=jayson[_0xcf5a('0x8')]['http']({'port':0x232c});config[_0xcf5a('0x9')]=_[_0xcf5a('0xa')](config[_0xcf5a('0x9')],{'host':_0xcf5a('0xb'),'port':0x18eb});var socket=require(_0xcf5a('0xc'))(new Redis(config[_0xcf5a('0x9')]));require('./faxAccount.socket')[_0xcf5a('0xd')](socket);function respondWithRpcPromise(_0x2f2541,_0x19c236,_0x5ee147){return new BPromise(function(_0x31bb2a,_0xdfe5ac){return client[_0xcf5a('0xe')](_0x2f2541,_0x5ee147)[_0xcf5a('0xf')](function(_0x5d5169){logger[_0xcf5a('0x10')](_0xcf5a('0x11'),_0x19c236,_0xcf5a('0x12'));logger[_0xcf5a('0x13')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x19c236,'request\x20sent',JSON[_0xcf5a('0x14')](_0x5d5169));if(_0x5d5169[_0xcf5a('0x15')]){if(_0x5d5169[_0xcf5a('0x15')][_0xcf5a('0x16')]===0x1f4){logger[_0xcf5a('0x15')](_0xcf5a('0x11'),_0x19c236,_0x5d5169[_0xcf5a('0x15')][_0xcf5a('0x17')]);return _0xdfe5ac(_0x5d5169['error'][_0xcf5a('0x17')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x19c236,_0x5d5169['error'][_0xcf5a('0x17')]);return _0x31bb2a(_0x5d5169['error']['message']);}else{logger[_0xcf5a('0x10')](_0xcf5a('0x11'),_0x19c236,_0xcf5a('0x12'));_0x31bb2a(_0x5d5169[_0xcf5a('0x18')]['message']);}})['catch'](function(_0x36b54c){logger['error'](_0xcf5a('0x11'),_0x19c236,_0x36b54c);_0xdfe5ac(_0x36b54c);});});}exports[_0xcf5a('0x19')]=function(_0x5193ec){var _0x3c8ac1=this;return new Promise(function(_0x40013c,_0xc96a6c){return db[_0xcf5a('0x1a')][_0xcf5a('0x1b')]({'raw':_0x5193ec[_0xcf5a('0x1c')]?_0x5193ec[_0xcf5a('0x1c')][_0xcf5a('0x1d')]===undefined?!![]:![]:!![],'where':_0x5193ec[_0xcf5a('0x1c')]?_0x5193ec['options'][_0xcf5a('0x1e')]||null:null,'attributes':_0x5193ec[_0xcf5a('0x1c')]?_0x5193ec['options'][_0xcf5a('0x1f')]||null:null,'limit':_0x5193ec[_0xcf5a('0x1c')]?_0x5193ec['options'][_0xcf5a('0x20')]||null:null,'include':_0x5193ec[_0xcf5a('0x1c')]?_0x5193ec[_0xcf5a('0x1c')][_0xcf5a('0x21')]?_['map'](_0x5193ec[_0xcf5a('0x1c')][_0xcf5a('0x21')],function(_0x2f1bf5){return{'model':db[_0x2f1bf5[_0xcf5a('0x22')]],'as':_0x2f1bf5['as'],'attributes':_0x2f1bf5['attributes'],'include':_0x2f1bf5[_0xcf5a('0x21')]?_['map'](_0x2f1bf5[_0xcf5a('0x21')],function(_0x2fe05d){return{'model':db[_0x2fe05d['model']],'as':_0x2fe05d['as'],'attributes':_0x2fe05d[_0xcf5a('0x1f')],'include':_0x2fe05d['include']?_[_0xcf5a('0x23')](_0x2fe05d['include'],function(_0x5e0605){return{'model':db[_0x5e0605[_0xcf5a('0x22')]],'as':_0x5e0605['as'],'attributes':_0x5e0605[_0xcf5a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xcf5a('0xf')](function(_0x3f7c14){logger[_0xcf5a('0x10')]('GetFaxAccount',_0x5193ec);logger[_0xcf5a('0x13')](_0xcf5a('0x19'),_0x5193ec,JSON[_0xcf5a('0x14')](_0x3f7c14));_0x40013c(_0x3f7c14);})[_0xcf5a('0x24')](function(_0x21d1f0){logger['error'](_0xcf5a('0x19'),_0x21d1f0[_0xcf5a('0x17')],_0x5193ec);_0xc96a6c(_0x3c8ac1[_0xcf5a('0x15')](0x1f4,_0x21d1f0[_0xcf5a('0x17')]));});});};exports[_0xcf5a('0x25')]=function(_0x27700c,_0x193202,_0x485819){var _0xa57ca7=this;return new Promise(function(_0x4b1273,_0x5a5be3){var _0x551302={'body':_0x27700c[_0xcf5a('0x26')],'channel':'fax'};var _0x3c53ba=[];var _0x5a6f79=[];var _0x42995e={};return db[_0xcf5a('0x27')][_0xcf5a('0x28')]()[_0xcf5a('0xf')](function(_0x552388){if(!_0x552388){throw new db['Sequelize'][(_0xcf5a('0x29'))]('no\x20available\x20attributes');}_0x3c53ba=_[_0xcf5a('0x2a')](_[_0xcf5a('0x2b')](_0x552388),[_0xcf5a('0x2c'),_0xcf5a('0x2d')]);_0x5a6f79=_[_0xcf5a('0x2a')](_[_0xcf5a('0x2b')](_0x552388),[_0xcf5a('0x2c'),_0xcf5a('0x2d'),_0xcf5a('0x2e'),_0xcf5a('0x2f')]);if(_0x27700c[_0xcf5a('0x26')]['id']){delete _0x27700c[_0xcf5a('0x26')]['id'];}if(_[_0xcf5a('0x30')](_0x27700c[_0xcf5a('0x26')][_0xcf5a('0x31')])){throw new db[(_0xcf5a('0x32'))][(_0xcf5a('0x29'))](_0xcf5a('0x33'));}if(_['isNil'](_0x27700c[_0xcf5a('0x26')][_0xcf5a('0x26')])||_0x27700c[_0xcf5a('0x26')][_0xcf5a('0x26')]===''){throw new db[(_0xcf5a('0x32'))][(_0xcf5a('0x29'))](_0xcf5a('0x34'));}if(_[_0xcf5a('0x30')](_0x27700c[_0xcf5a('0x26')]['mapKey'])){throw new db[(_0xcf5a('0x32'))][(_0xcf5a('0x29'))](_0xcf5a('0x35')+_0x5a6f79);}if(!_[_0xcf5a('0x36')](_0x5a6f79,_0x27700c[_0xcf5a('0x26')][_0xcf5a('0x37')])){throw new db[(_0xcf5a('0x32'))][(_0xcf5a('0x29'))](_0xcf5a('0x38')+_0x5a6f79);}_0x42995e[_0x27700c['body'][_0xcf5a('0x37')]]=_0x27700c[_0xcf5a('0x26')][_0xcf5a('0x31')];})['then'](function(){return db[_0xcf5a('0x1a')][_0xcf5a('0x39')]({'where':{'id':_0x27700c[_0xcf5a('0x3a')]['id']},'include':[{'model':db['CmList'],'as':_0xcf5a('0x3b'),'include':[{'model':db[_0xcf5a('0x27')],'as':_0xcf5a('0x3c'),'where':_0x42995e,'limit':0x1,'order':[[_0xcf5a('0x2d'),'DESC']]}]},{'model':db[_0xcf5a('0x3d')],'as':_0xcf5a('0x3e')}]});})[_0xcf5a('0xf')](function(_0x4d2c40){if(_0x4d2c40&&_0x4d2c40['List']){var _0x5b6100=_0x4d2c40[_0xcf5a('0x3f')]({'plain':!![]});_0x551302[_0xcf5a('0x3a')]=_0x5b6100;_0x551302[_0xcf5a('0x40')]=_0x5b6100[_0xcf5a('0x3e')];_0x551302['list']=_0x5b6100[_0xcf5a('0x3b')];_0x551302['applications']=_[_0xcf5a('0x41')](_0x551302[_0xcf5a('0x40')],['priority'],['asc']);if(_0x551302['account'][_0xcf5a('0x3e')]){delete _0x551302[_0xcf5a('0x3a')][_0xcf5a('0x3e')];}if(_0x551302[_0xcf5a('0x3a')]['List']&&_0x551302[_0xcf5a('0x3a')][_0xcf5a('0x3b')][_0xcf5a('0x3c')][_0xcf5a('0x42')]){return _0x551302['account'][_0xcf5a('0x3b')][_0xcf5a('0x3c')][0x0];}var _0x3f38db=_[_0xcf5a('0xa')](_0x27700c[_0xcf5a('0x26')],{'firstName':_0x27700c[_0xcf5a('0x26')]['from'],'ListId':_0x5b6100[_0xcf5a('0x2f')]});_0x3f38db[_0x27700c[_0xcf5a('0x26')]['mapKey']]=_0x27700c[_0xcf5a('0x26')][_0xcf5a('0x31')];return db[_0xcf5a('0x27')][_0xcf5a('0x43')](_0x3f38db,{'fields':_0x3c53ba,'raw':!![]});}})[_0xcf5a('0xf')](function(_0x1ad87a){_0x551302[_0xcf5a('0x44')]=_0x1ad87a;if(_0x1ad87a){var _0x2f3a7f={'ContactId':_0x1ad87a['id'],'FaxAccountId':_0x27700c[_0xcf5a('0x3a')]['id'],'fax':_0x1ad87a[_0xcf5a('0x45')]};return db[_0xcf5a('0x46')][_0xcf5a('0x39')]({'where':{'ContactId':_0x1ad87a['id'],'closed':![],'FaxAccountId':_0x27700c[_0xcf5a('0x3a')]['id']}})['then'](function(_0x2d0df9){if(_0x2d0df9){return[_0x2d0df9,![]];}return db[_0xcf5a('0x46')][_0xcf5a('0x43')](_0x2f3a7f)['then'](function(_0x430136){return[_0x430136,!![]];});});}else{throw new Error(_0xcf5a('0x47'));}})[_0xcf5a('0x48')](function(_0x10be88,_0x22df9e){var _0x963df7=_0x10be88[_0xcf5a('0x3f')]({'plain':!![]});if(_0x22df9e){if(_0x551302[_0xcf5a('0x3a')][_0xcf5a('0x49')]){_0x551302[_0xcf5a('0x40')]['push']({'id':0x0,'priority':_0x551302['applications'][_0xcf5a('0x42')]+0x1,'app':_0xcf5a('0x4a'),'appdata':_0xcf5a('0x4b'),'interval':_0xcf5a('0x4c')});}_0x963df7[_0xcf5a('0x4d')]=!![];}else{_0x963df7[_0xcf5a('0x4d')]=![];}_0x551302[_0xcf5a('0x4e')]=_0x963df7;return db['FaxMessage'][_0xcf5a('0x43')]({'body':_0x27700c[_0xcf5a('0x26')]['body'],'FaxAccountId':_0x27700c[_0xcf5a('0x3a')]['id'],'FaxInteractionId':_0x10be88['id'],'direction':'in','ContactId':_0x10be88[_0xcf5a('0x4f')],'AttachmentId':_0x27700c[_0xcf5a('0x26')]['AttachmentId']});})[_0xcf5a('0xf')](function(_0x21da04){_0x551302[_0xcf5a('0x17')]=_0x21da04;if(_0x551302[_0xcf5a('0x4e')][_0xcf5a('0x50')]){return db[_0xcf5a('0x51')][_0xcf5a('0x39')]({'attributes':['id','name'],'where':{'id':_0x551302[_0xcf5a('0x4e')][_0xcf5a('0x50')]}})[_0xcf5a('0xf')](function(_0x26df16){if(_0x26df16){_0x551302[_0xcf5a('0x40')][_0xcf5a('0x52')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x26df16[_0xcf5a('0x53')]+','+(_0x551302[_0xcf5a('0x3a')][_0xcf5a('0x54')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xcf5a('0x55'),_0x551302);});}return respondWithRpcPromise(_0xcf5a('0x56'),_0xcf5a('0x55'),_0x551302);})[_0xcf5a('0xf')](function(_0x222a2f){_0x4b1273(_0x222a2f);})['catch'](function(_0x16f068){_0x5a5be3(_0xa57ca7[_0xcf5a('0x15')](0x1f4,_0x16f068['message']));});});}; \ No newline at end of file +var _0x344f=['defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','findAll','options','where','attributes','limit','include','map','model','debug','NotifyFaxAccount','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','CompanyId','ListId','body','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','FaxAccount','find','account','CmList','List','Contacts','Applications','get','applications','list','orderBy','priority','asc','create','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','length','close','unmanaged','interaction','FaxMessage','ContactId','AttachmentId','UserId','name','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis'];(function(_0xe66a96,_0x43b822){var _0x5cdcde=function(_0x500e69){while(--_0x500e69){_0xe66a96['push'](_0xe66a96['shift']());}};_0x5cdcde(++_0x43b822);}(_0x344f,0x103));var _0xf344=function(_0x5bd831,_0x481d2e){_0x5bd831=_0x5bd831-0x0;var _0x5de150=_0x344f[_0x5bd831];return _0x5de150;};'use strict';var _=require(_0xf344('0x0'));var util=require(_0xf344('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf344('0x2'));var fs=require('fs');var Redis=require(_0xf344('0x3'));var db=require(_0xf344('0x4'))['db'];var utils=require(_0xf344('0x5'));var logger=require(_0xf344('0x6'))('rpc');var config=require(_0xf344('0x7'));var jayson=require(_0xf344('0x8'));var client=jayson['client'][_0xf344('0x9')]({'port':0x232c});config[_0xf344('0xa')]=_[_0xf344('0xb')](config['redis'],{'host':_0xf344('0xc'),'port':0x18eb});var socket=require(_0xf344('0xd'))(new Redis(config[_0xf344('0xa')]));require(_0xf344('0xe'))[_0xf344('0xf')](socket);function respondWithRpcPromise(_0x8c8ec8,_0x358406,_0x4c4498){return new BPromise(function(_0x39c009,_0x29644f){return client[_0xf344('0x10')](_0x8c8ec8,_0x4c4498)[_0xf344('0x11')](function(_0x330efe){logger[_0xf344('0x12')](_0xf344('0x13'),_0x358406,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x358406,'request\x20sent',JSON[_0xf344('0x14')](_0x330efe));if(_0x330efe['error']){if(_0x330efe[_0xf344('0x15')][_0xf344('0x16')]===0x1f4){logger['error'](_0xf344('0x13'),_0x358406,_0x330efe[_0xf344('0x15')][_0xf344('0x17')]);return _0x29644f(_0x330efe[_0xf344('0x15')][_0xf344('0x17')]);}logger[_0xf344('0x15')]('FaxAccount,\x20%s,\x20%s',_0x358406,_0x330efe[_0xf344('0x15')][_0xf344('0x17')]);return _0x39c009(_0x330efe[_0xf344('0x15')]['message']);}else{logger[_0xf344('0x12')](_0xf344('0x13'),_0x358406,'request\x20sent');_0x39c009(_0x330efe[_0xf344('0x18')][_0xf344('0x17')]);}})[_0xf344('0x19')](function(_0x564732){logger[_0xf344('0x15')](_0xf344('0x13'),_0x358406,_0x564732);_0x29644f(_0x564732);});});}exports[_0xf344('0x1a')]=function(_0x4854e0){var _0xadbc38=this;return new Promise(function(_0x55cd2a,_0x2bdc4b){return db['FaxAccount'][_0xf344('0x1b')]({'raw':_0x4854e0['options']?_0x4854e0[_0xf344('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4854e0[_0xf344('0x1c')]?_0x4854e0[_0xf344('0x1c')][_0xf344('0x1d')]||null:null,'attributes':_0x4854e0[_0xf344('0x1c')]?_0x4854e0[_0xf344('0x1c')][_0xf344('0x1e')]||null:null,'limit':_0x4854e0[_0xf344('0x1c')]?_0x4854e0['options'][_0xf344('0x1f')]||null:null,'include':_0x4854e0['options']?_0x4854e0['options'][_0xf344('0x20')]?_[_0xf344('0x21')](_0x4854e0[_0xf344('0x1c')][_0xf344('0x20')],function(_0x214fb7){return{'model':db[_0x214fb7[_0xf344('0x22')]],'as':_0x214fb7['as'],'attributes':_0x214fb7['attributes'],'include':_0x214fb7[_0xf344('0x20')]?_[_0xf344('0x21')](_0x214fb7['include'],function(_0x24ebf9){return{'model':db[_0x24ebf9[_0xf344('0x22')]],'as':_0x24ebf9['as'],'attributes':_0x24ebf9[_0xf344('0x1e')],'include':_0x24ebf9[_0xf344('0x20')]?_[_0xf344('0x21')](_0x24ebf9['include'],function(_0x1da442){return{'model':db[_0x1da442[_0xf344('0x22')]],'as':_0x1da442['as'],'attributes':_0x1da442[_0xf344('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf344('0x11')](function(_0x81c820){logger[_0xf344('0x12')]('GetFaxAccount',_0x4854e0);logger[_0xf344('0x23')]('GetFaxAccount',_0x4854e0,JSON['stringify'](_0x81c820));_0x55cd2a(_0x81c820);})['catch'](function(_0x8c6445){logger[_0xf344('0x15')]('GetFaxAccount',_0x8c6445['message'],_0x4854e0);_0x2bdc4b(_0xadbc38[_0xf344('0x15')](0x1f4,_0x8c6445[_0xf344('0x17')]));});});};exports[_0xf344('0x24')]=function(_0x1fce66,_0x5e8fe5,_0x1d6534){var _0x4526f5=this;return new Promise(function(_0x1047d2,_0x4a39eb){var _0x3a68fc={'body':_0x1fce66['body'],'channel':'fax'};var _0x10b828=[];var _0x3b96e5=[];var _0x4e2662={};return db[_0xf344('0x25')][_0xf344('0x26')]()[_0xf344('0x11')](function(_0x45f396){if(!_0x45f396){throw new db[(_0xf344('0x27'))][(_0xf344('0x28'))](_0xf344('0x29'));}_0x10b828=_['difference'](_[_0xf344('0x2a')](_0x45f396),[_0xf344('0x2b'),_0xf344('0x2c')]);_0x3b96e5=_[_0xf344('0x2d')](_[_0xf344('0x2a')](_0x45f396),['createdAt',_0xf344('0x2c'),_0xf344('0x2e'),_0xf344('0x2f')]);if(_0x1fce66[_0xf344('0x30')]['id']){delete _0x1fce66[_0xf344('0x30')]['id'];}if(_[_0xf344('0x31')](_0x1fce66['body'][_0xf344('0x32')])){throw new db[(_0xf344('0x27'))][(_0xf344('0x28'))]('from\x20is\x20mandatory');}if(_[_0xf344('0x31')](_0x1fce66[_0xf344('0x30')][_0xf344('0x30')])||_0x1fce66[_0xf344('0x30')]['body']===''){throw new db[(_0xf344('0x27'))][(_0xf344('0x28'))](_0xf344('0x33'));}if(_[_0xf344('0x31')](_0x1fce66[_0xf344('0x30')][_0xf344('0x34')])){throw new db[(_0xf344('0x27'))]['ValidationError'](_0xf344('0x35')+_0x3b96e5);}if(!_[_0xf344('0x36')](_0x3b96e5,_0x1fce66[_0xf344('0x30')][_0xf344('0x34')])){throw new db[(_0xf344('0x27'))][(_0xf344('0x28'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3b96e5);}_0x4e2662[_0x1fce66[_0xf344('0x30')][_0xf344('0x34')]]=_0x1fce66['body'][_0xf344('0x32')];})['then'](function(){return db[_0xf344('0x37')][_0xf344('0x38')]({'where':{'id':_0x1fce66[_0xf344('0x39')]['id']},'include':[{'model':db[_0xf344('0x3a')],'as':_0xf344('0x3b'),'include':[{'model':db[_0xf344('0x25')],'as':_0xf344('0x3c'),'where':_0x4e2662,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['FaxApplication'],'as':_0xf344('0x3d')}]});})[_0xf344('0x11')](function(_0x400720){if(_0x400720&&_0x400720[_0xf344('0x3b')]){var _0x5d4908=_0x400720[_0xf344('0x3e')]({'plain':!![]});_0x3a68fc[_0xf344('0x39')]=_0x5d4908;_0x3a68fc[_0xf344('0x3f')]=_0x5d4908[_0xf344('0x3d')];_0x3a68fc[_0xf344('0x40')]=_0x5d4908[_0xf344('0x3b')];_0x3a68fc[_0xf344('0x3f')]=_[_0xf344('0x41')](_0x3a68fc['applications'],[_0xf344('0x42')],[_0xf344('0x43')]);if(_0x3a68fc[_0xf344('0x39')][_0xf344('0x3d')]){delete _0x3a68fc[_0xf344('0x39')][_0xf344('0x3d')];}if(_0x3a68fc[_0xf344('0x39')][_0xf344('0x3b')]&&_0x3a68fc[_0xf344('0x39')][_0xf344('0x3b')][_0xf344('0x3c')]['length']){return _0x3a68fc['account'][_0xf344('0x3b')]['Contacts'][0x0];}var _0x14730f=_['defaults'](_0x1fce66[_0xf344('0x30')],{'firstName':_0x1fce66[_0xf344('0x30')]['from'],'ListId':_0x5d4908[_0xf344('0x2f')]});_0x14730f[_0x1fce66['body'][_0xf344('0x34')]]=_0x1fce66['body'][_0xf344('0x32')];return db[_0xf344('0x25')][_0xf344('0x44')](_0x14730f,{'fields':_0x10b828,'raw':!![]});}})[_0xf344('0x11')](function(_0x3dd59f){_0x3a68fc[_0xf344('0x45')]=_0x3dd59f;if(_0x3dd59f){var _0x4ad7af={'ContactId':_0x3dd59f['id'],'FaxAccountId':_0x1fce66[_0xf344('0x39')]['id'],'fax':_0x3dd59f[_0xf344('0x46')]};return db[_0xf344('0x47')][_0xf344('0x38')]({'where':{'ContactId':_0x3dd59f['id'],'closed':![],'FaxAccountId':_0x1fce66['account']['id']}})['then'](function(_0x361f39){if(_0x361f39){return[_0x361f39,![]];}return db[_0xf344('0x47')][_0xf344('0x44')](_0x4ad7af)[_0xf344('0x11')](function(_0x41d9c0){return[_0x41d9c0,!![]];});});}else{throw new Error(_0xf344('0x48'));}})[_0xf344('0x49')](function(_0x54f0ef,_0x480320){var _0x29e9ae=_0x54f0ef[_0xf344('0x3e')]({'plain':!![]});if(_0x480320){if(_0x3a68fc[_0xf344('0x39')][_0xf344('0x4a')]){_0x3a68fc[_0xf344('0x3f')][_0xf344('0x4b')]({'id':0x0,'priority':_0x3a68fc[_0xf344('0x3f')][_0xf344('0x4c')]+0x1,'app':_0xf344('0x4d'),'appdata':_0xf344('0x4e'),'interval':'*,*,*,*'});}_0x29e9ae['created']=!![];}else{_0x29e9ae['created']=![];}_0x3a68fc[_0xf344('0x4f')]=_0x29e9ae;return db[_0xf344('0x50')][_0xf344('0x44')]({'body':_0x1fce66[_0xf344('0x30')][_0xf344('0x30')],'FaxAccountId':_0x1fce66[_0xf344('0x39')]['id'],'FaxInteractionId':_0x54f0ef['id'],'direction':'in','ContactId':_0x54f0ef[_0xf344('0x51')],'AttachmentId':_0x1fce66[_0xf344('0x30')][_0xf344('0x52')]});})[_0xf344('0x11')](function(_0x39c13c){_0x3a68fc['message']=_0x39c13c;if(_0x3a68fc[_0xf344('0x4f')][_0xf344('0x53')]){return db['User'][_0xf344('0x38')]({'attributes':['id',_0xf344('0x54')],'where':{'id':_0x3a68fc[_0xf344('0x4f')][_0xf344('0x53')]}})[_0xf344('0x11')](function(_0x1b1385){if(_0x1b1385){_0x3a68fc['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xf344('0x55'),'appdata':_0x1b1385[_0xf344('0x54')]+','+(_0x3a68fc[_0xf344('0x39')][_0xf344('0x56')]||0xa),'interval':_0xf344('0x57')});}return respondWithRpcPromise(_0xf344('0x58'),_0xf344('0x59'),_0x3a68fc);});}return respondWithRpcPromise(_0xf344('0x58'),'startRouting',_0x3a68fc);})['then'](function(_0x4546c3){_0x1047d2(_0x4546c3);})[_0xf344('0x19')](function(_0x180ce6){_0x4a39eb(_0x4526f5[_0xf344('0x15')](0x1f4,_0x180ce6[_0xf344('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 5bffe24..6f81f4b 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 _0x52f2=['faxAccount:','./faxAccount.events','save','remove','emit','register','length'];(function(_0x2a4556,_0x5bd465){var _0x3dc5bf=function(_0x44cf5e){while(--_0x44cf5e){_0x2a4556['push'](_0x2a4556['shift']());}};_0x3dc5bf(++_0x5bd465);}(_0x52f2,0xb0));var _0x252f=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x52f2[_0x5ddb1c];return _0x354adc;};'use strict';var FaxAccountEvents=require(_0x252f('0x0'));var events=[_0x252f('0x1'),_0x252f('0x2'),'update'];function createListener(_0x457019,_0x367030){return function(_0x8b1e65){_0x367030[_0x252f('0x3')](_0x457019,_0x8b1e65);};}function removeListener(_0x59d038,_0x41a008){return function(){FaxAccountEvents['removeListener'](_0x59d038,_0x41a008);};}exports[_0x252f('0x4')]=function(_0x509ed7){for(var _0x41b9d9=0x0,_0x5b188a=events[_0x252f('0x5')];_0x41b9d9<_0x5b188a;_0x41b9d9++){var _0x116cde=events[_0x41b9d9];var _0x2141ce=createListener(_0x252f('0x6')+_0x116cde,_0x509ed7);FaxAccountEvents['on'](_0x116cde,_0x2141ce);}}; \ No newline at end of file +var _0xfd47=['register','length','faxAccount:','save','remove','update','removeListener'];(function(_0x4dd452,_0x39a8cb){var _0x487a06=function(_0x7493a3){while(--_0x7493a3){_0x4dd452['push'](_0x4dd452['shift']());}};_0x487a06(++_0x39a8cb);}(_0xfd47,0xab));var _0x7fd4=function(_0xc1cefb,_0x1c96d2){_0xc1cefb=_0xc1cefb-0x0;var _0x46603e=_0xfd47[_0xc1cefb];return _0x46603e;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x7fd4('0x0'),_0x7fd4('0x1'),_0x7fd4('0x2')];function createListener(_0x19c31a,_0x2c7fc2){return function(_0x48d419){_0x2c7fc2['emit'](_0x19c31a,_0x48d419);};}function removeListener(_0x2be4e5,_0x58453a){return function(){FaxAccountEvents[_0x7fd4('0x3')](_0x2be4e5,_0x58453a);};}exports[_0x7fd4('0x4')]=function(_0x5c7404){for(var _0x50e9e0=0x0,_0x22d47d=events[_0x7fd4('0x5')];_0x50e9e0<_0x22d47d;_0x50e9e0++){var _0x12f964=events[_0x50e9e0];var _0x1b5abc=createListener(_0x7fd4('0x6')+_0x12f964,_0x5c7404);FaxAccountEvents['on'](_0x12f964,_0x1b5abc);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index c0445fd..70d270e 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 _0xa5a3=['show','/:id/dispositions','/:id/canned_answers','getAnswers','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/interactions','addInteraction','addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','./faxAccount.controller','get','isAuthenticated','index','/describe'];(function(_0x5ee99e,_0x433ba3){var _0x41bc61=function(_0x4fc34f){while(--_0x4fc34f){_0x5ee99e['push'](_0x5ee99e['shift']());}};_0x41bc61(++_0x433ba3);}(_0xa5a3,0x170));var _0x3a5a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa5a3[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x3a5a('0x0'));var util=require(_0x3a5a('0x1'));var path=require(_0x3a5a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x3a5a('0x3'));var interaction=require(_0x3a5a('0x4'));var config=require('../../config/environment');var controller=require(_0x3a5a('0x5'));router[_0x3a5a('0x6')]('/',auth[_0x3a5a('0x7')](),controller[_0x3a5a('0x8')]);router['get'](_0x3a5a('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x3a5a('0x6')]('/:id',auth[_0x3a5a('0x7')](),controller[_0x3a5a('0xa')]);router['get'](_0x3a5a('0xb'),auth[_0x3a5a('0x7')](),controller['getDispositions']);router[_0x3a5a('0x6')](_0x3a5a('0xc'),auth[_0x3a5a('0x7')](),controller[_0x3a5a('0xd')]);router[_0x3a5a('0x6')]('/:id/interactions',auth[_0x3a5a('0x7')](),controller[_0x3a5a('0xe')]);router['get'](_0x3a5a('0xf'),auth[_0x3a5a('0x7')](),controller[_0x3a5a('0x10')]);router[_0x3a5a('0x6')](_0x3a5a('0x11'),auth['isAuthenticated'](),controller[_0x3a5a('0x12')]);router[_0x3a5a('0x6')](_0x3a5a('0x13'),auth[_0x3a5a('0x7')](),controller[_0x3a5a('0x14')]);router[_0x3a5a('0x15')]('/',auth[_0x3a5a('0x7')](),controller[_0x3a5a('0x16')]);router[_0x3a5a('0x15')](_0x3a5a('0xb'),auth[_0x3a5a('0x7')](),controller[_0x3a5a('0x17')]);router['post']('/:id/canned_answers',auth[_0x3a5a('0x7')](),controller[_0x3a5a('0x18')]);router[_0x3a5a('0x15')](_0x3a5a('0x19'),auth[_0x3a5a('0x7')](),controller[_0x3a5a('0x1a')]);router['post']('/:id/applications',auth[_0x3a5a('0x7')](),controller[_0x3a5a('0x1b')]);router['post'](_0x3a5a('0x1c'),auth[_0x3a5a('0x7')](),controller['addAccountApplications']);router[_0x3a5a('0x15')](_0x3a5a('0x1d'),auth[_0x3a5a('0x7')](),controller[_0x3a5a('0x1e')]);router[_0x3a5a('0x15')](_0x3a5a('0x1f'),auth[_0x3a5a('0x7')](),controller['send']);router[_0x3a5a('0x15')](_0x3a5a('0x13'),auth[_0x3a5a('0x7')](),controller[_0x3a5a('0x20')]);router[_0x3a5a('0x21')](_0x3a5a('0x22'),auth['isAuthenticated'](),controller[_0x3a5a('0x23')]);router[_0x3a5a('0x24')](_0x3a5a('0x22'),auth[_0x3a5a('0x7')](),controller[_0x3a5a('0x25')]);router[_0x3a5a('0x24')](_0x3a5a('0xb'),auth[_0x3a5a('0x7')](),controller[_0x3a5a('0x26')]);router['delete'](_0x3a5a('0xc'),auth['isAuthenticated'](),controller[_0x3a5a('0x27')]);router[_0x3a5a('0x24')](_0x3a5a('0x13'),auth['isAuthenticated'](),controller[_0x3a5a('0x28')]);module[_0x3a5a('0x29')]=router; \ No newline at end of file +var _0x2fc2=['/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','util','path','express','Router','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/users','getAgents','post','create','addAnswer','addInteraction','/addaccountapplications'];(function(_0x1e1943,_0x1a6d54){var _0x4989a9=function(_0x4e1e58){while(--_0x4e1e58){_0x1e1943['push'](_0x1e1943['shift']());}};_0x4989a9(++_0x1a6d54);}(_0x2fc2,0x14c));var _0x22fc=function(_0x223f38,_0x370f3c){_0x223f38=_0x223f38-0x0;var _0x27bcf4=_0x2fc2[_0x223f38];return _0x27bcf4;};'use strict';var multer=require('multer');var util=require(_0x22fc('0x0'));var path=require(_0x22fc('0x1'));var timeout=require('connect-timeout');var express=require(_0x22fc('0x2'));var router=express[_0x22fc('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x22fc('0x4'));var config=require(_0x22fc('0x5'));var controller=require(_0x22fc('0x6'));router[_0x22fc('0x7')]('/',auth[_0x22fc('0x8')](),controller[_0x22fc('0x9')]);router['get'](_0x22fc('0xa'),auth[_0x22fc('0x8')](),controller[_0x22fc('0xb')]);router[_0x22fc('0x7')](_0x22fc('0xc'),auth[_0x22fc('0x8')](),controller['show']);router[_0x22fc('0x7')](_0x22fc('0xd'),auth['isAuthenticated'](),controller[_0x22fc('0xe')]);router[_0x22fc('0x7')](_0x22fc('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x22fc('0x7')](_0x22fc('0x10'),auth[_0x22fc('0x8')](),controller[_0x22fc('0x11')]);router[_0x22fc('0x7')](_0x22fc('0x12'),auth[_0x22fc('0x8')](),controller[_0x22fc('0x13')]);router[_0x22fc('0x7')](_0x22fc('0x14'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x22fc('0x15'),auth[_0x22fc('0x8')](),controller[_0x22fc('0x16')]);router[_0x22fc('0x17')]('/',auth[_0x22fc('0x8')](),controller[_0x22fc('0x18')]);router[_0x22fc('0x17')](_0x22fc('0xd'),auth[_0x22fc('0x8')](),controller['addDisposition']);router[_0x22fc('0x17')](_0x22fc('0xf'),auth['isAuthenticated'](),controller[_0x22fc('0x19')]);router[_0x22fc('0x17')](_0x22fc('0x10'),auth['isAuthenticated'](),controller[_0x22fc('0x1a')]);router[_0x22fc('0x17')](_0x22fc('0x12'),auth[_0x22fc('0x8')](),controller['addApplications']);router['post'](_0x22fc('0x1b'),auth[_0x22fc('0x8')](),controller['addAccountApplications']);router[_0x22fc('0x17')](_0x22fc('0x1c'),auth[_0x22fc('0x8')](),controller[_0x22fc('0x1d')]);router[_0x22fc('0x17')](_0x22fc('0x1e'),auth[_0x22fc('0x8')](),controller[_0x22fc('0x1f')]);router[_0x22fc('0x17')](_0x22fc('0x15'),auth[_0x22fc('0x8')](),controller[_0x22fc('0x20')]);router[_0x22fc('0x21')](_0x22fc('0xc'),auth['isAuthenticated'](),controller[_0x22fc('0x22')]);router[_0x22fc('0x23')](_0x22fc('0xc'),auth[_0x22fc('0x8')](),controller[_0x22fc('0x24')]);router[_0x22fc('0x23')](_0x22fc('0xd'),auth['isAuthenticated'](),controller[_0x22fc('0x25')]);router[_0x22fc('0x23')](_0x22fc('0xf'),auth[_0x22fc('0x8')](),controller[_0x22fc('0x26')]);router['delete'](_0x22fc('0x15'),auth[_0x22fc('0x8')](),controller[_0x22fc('0x27')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index e7131a7..1a0bfea 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 _0x8710=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x470f63,_0x48d80b){var _0x4f09e2=function(_0x3aa3a4){while(--_0x3aa3a4){_0x470f63['push'](_0x470f63['shift']());}};_0x4f09e2(++_0x48d80b);}(_0x8710,0x68));var _0x0871=function(_0x412d0e,_0x277de8){_0x412d0e=_0x412d0e-0x0;var _0x25a67d=_0x8710[_0x412d0e];return _0x25a67d;};'use strict';var Sequelize=require(_0x0871('0x0'));module[_0x0871('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0871('0x2')],'allowNull':![],'defaultValue':_0x0871('0x3')},'appdata':{'type':Sequelize[_0x0871('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0871('0x2')],'defaultValue':_0x0871('0x5')}}; \ No newline at end of file +var _0x5ed9=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5ed9[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x95ed('0x0'));module[_0x95ed('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x95ed('0x2')],'allowNull':![],'defaultValue':_0x95ed('0x3')},'appdata':{'type':Sequelize[_0x95ed('0x4')]()},'description':{'type':Sequelize[_0x95ed('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x95ed('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index d0c0124..9824142 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 _0xef1e=['querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','status','count','offset','Content-Range','json','apply','save','update','destroy','then','end','sendStatus','error','stack','name','send','rawAttributes','query','keys','filters','model','attributes','intersection','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','map','type','key','field','options','includeAll','include','FaxApplication','findAll','catch','show','params','fields','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x14fc99,_0x3d5c56){var _0x4b14c8=function(_0x56dfc0){while(--_0x56dfc0){_0x14fc99['push'](_0x14fc99['shift']());}};_0x4b14c8(++_0x3d5c56);}(_0xef1e,0x11b));var _0xeef1=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xef1e[_0x432682];return _0x463d05;};'use strict';var pdf=require(_0xeef1('0x0'));var emlformat=require(_0xeef1('0x1'));var rimraf=require(_0xeef1('0x2'));var zipdir=require(_0xeef1('0x3'));var jsonpatch=require(_0xeef1('0x4'));var rp=require(_0xeef1('0x5'));var moment=require(_0xeef1('0x6'));var BPromise=require(_0xeef1('0x7'));var Mustache=require('mustache');var util=require(_0xeef1('0x8'));var path=require('path');var sox=require(_0xeef1('0x9'));var csv=require(_0xeef1('0xa'));var ejs=require(_0xeef1('0xb'));var fs=require('fs');var _=require(_0xeef1('0xc'));var squel=require(_0xeef1('0xd'));var crypto=require(_0xeef1('0xe'));var jsforce=require(_0xeef1('0xf'));var deskjs=require(_0xeef1('0x10'));var toCsv=require(_0xeef1('0xa'));var querystring=require(_0xeef1('0x11'));var Papa=require(_0xeef1('0x12'));var authService=require(_0xeef1('0x13'));var hardwareService=require(_0xeef1('0x14'));var Redis=require(_0xeef1('0x15'));var qs=require('../../components/parsers/qs');var logger=require(_0xeef1('0x16'))(_0xeef1('0x17'));var utils=require(_0xeef1('0x18'));var config=require(_0xeef1('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29ffa4,_0x42b9d0){_0x42b9d0=_0x42b9d0||0xcc;return function(_0x12d68a){if(_0x12d68a){return _0x29ffa4['sendStatus'](_0x42b9d0);}return _0x29ffa4['status'](_0x42b9d0)['end']();};}function respondWithResult(_0x769f50,_0x324d85){_0x324d85=_0x324d85||0xc8;return function(_0x484ef3){if(_0x484ef3){return _0x769f50[_0xeef1('0x1a')](_0x324d85)['json'](_0x484ef3);}};}function respondWithFilteredResult(_0x43353f,_0x48a357){return function(_0x4900af){if(_0x4900af){var _0x126db4=_0x4900af[_0xeef1('0x1b')],_0x1d2de7=_0x48a357[_0xeef1('0x1c')],_0x240e12=_0x48a357[_0xeef1('0x1c')]+_0x48a357['limit'],_0x43125e;if(_0x240e12>=_0x126db4){_0x240e12=_0x126db4;_0x43125e=0xc8;}else{_0x43125e=0xce;}_0x43353f[_0xeef1('0x1a')](_0x43125e);return _0x43353f['set'](_0xeef1('0x1d'),_0x1d2de7+'-'+_0x240e12+'/'+_0x126db4)[_0xeef1('0x1e')](_0x4900af);}return null;};}function patchUpdates(_0x462ae1){return function(_0x1d831e){try{jsonpatch[_0xeef1('0x1f')](_0x1d831e,_0x462ae1,!![]);}catch(_0x3c0951){return BPromise['reject'](_0x3c0951);}return _0x1d831e[_0xeef1('0x20')]();};}function saveUpdates(_0x5c63a0,_0x1e2925){return function(_0x5c13c0){if(_0x5c13c0){return _0x5c13c0[_0xeef1('0x21')](_0x5c63a0)['then'](function(_0x31ed9c){return _0x31ed9c;});}return null;};}function removeEntity(_0x2e46b0,_0x8fc842){return function(_0x36b72b){if(_0x36b72b){return _0x36b72b[_0xeef1('0x22')]()[_0xeef1('0x23')](function(){_0x2e46b0['status'](0xcc)[_0xeef1('0x24')]();});}};}function handleEntityNotFound(_0x3c5c2c,_0x1c3ad7){return function(_0x44fb8c){if(!_0x44fb8c){_0x3c5c2c[_0xeef1('0x25')](0x194);}return _0x44fb8c;};}function handleError(_0x40ff78,_0x5f109c){_0x5f109c=_0x5f109c||0x1f4;return function(_0x9803c2){logger[_0xeef1('0x26')](_0x9803c2[_0xeef1('0x27')]);if(_0x9803c2['name']){delete _0x9803c2[_0xeef1('0x28')];}_0x40ff78[_0xeef1('0x1a')](_0x5f109c)[_0xeef1('0x29')](_0x9803c2);};}exports['index']=function(_0x237b15,_0x1215a8){var _0x2417c1={},_0xb7277={},_0x1bde99={'count':0x0,'rows':[]};var _0x4e97cc=db['FaxApplication'][_0xeef1('0x2a')];_0xb7277['model']=_['keys'](_0x4e97cc);_0xb7277[_0xeef1('0x2b')]=_[_0xeef1('0x2c')](_0x237b15[_0xeef1('0x2b')]);_0xb7277[_0xeef1('0x2d')]=_['intersection'](_0xb7277[_0xeef1('0x2e')],_0xb7277[_0xeef1('0x2b')]);_0x2417c1[_0xeef1('0x2f')]=_[_0xeef1('0x30')](_0xb7277[_0xeef1('0x2e')],qs['fields'](_0x237b15[_0xeef1('0x2b')]['fields']));_0x2417c1[_0xeef1('0x2f')]=_0x2417c1['attributes']['length']?_0x2417c1['attributes']:_0xb7277[_0xeef1('0x2e')];if(!_0x237b15[_0xeef1('0x2b')][_0xeef1('0x31')](_0xeef1('0x32'))){_0x2417c1[_0xeef1('0x33')]=qs[_0xeef1('0x33')](_0x237b15['query'][_0xeef1('0x33')]);_0x2417c1['offset']=qs[_0xeef1('0x1c')](_0x237b15[_0xeef1('0x2b')][_0xeef1('0x1c')]);}_0x2417c1[_0xeef1('0x34')]=qs[_0xeef1('0x35')](_0x237b15[_0xeef1('0x2b')][_0xeef1('0x35')]);_0x2417c1['where']=qs[_0xeef1('0x2d')](_[_0xeef1('0x36')](_0x237b15[_0xeef1('0x2b')],_0xb7277[_0xeef1('0x2d')]));if(_0x237b15[_0xeef1('0x2b')][_0xeef1('0x37')]){_0x2417c1[_0xeef1('0x38')]=_[_0xeef1('0x39')](_0x2417c1[_0xeef1('0x38')],{'$or':_[_0xeef1('0x3a')](_0x4e97cc,function(_0x320ece){if(_0x320ece[_0xeef1('0x3b')][_0xeef1('0x3c')]!=='VIRTUAL'){var _0x3a88d2={};_0x3a88d2[_0x320ece[_0xeef1('0x3d')]]={'$like':'%'+_0x237b15[_0xeef1('0x2b')]['filter']+'%'};return _0x3a88d2;}})});}_0x2417c1=_[_0xeef1('0x39')]({},_0x2417c1,_0x237b15[_0xeef1('0x3e')]);var _0x7c688e={'where':_0x2417c1[_0xeef1('0x38')]};return db['FaxApplication']['count'](_0x7c688e)[_0xeef1('0x23')](function(_0x2db14c){_0x1bde99[_0xeef1('0x1b')]=_0x2db14c;if(_0x237b15['query'][_0xeef1('0x3f')]){_0x2417c1[_0xeef1('0x40')]=[{'all':!![]}];}return db[_0xeef1('0x41')][_0xeef1('0x42')](_0x2417c1);})['then'](function(_0x253794){_0x1bde99['rows']=_0x253794;return _0x1bde99;})['then'](respondWithFilteredResult(_0x1215a8,_0x2417c1))[_0xeef1('0x43')](handleError(_0x1215a8,null));};exports[_0xeef1('0x44')]=function(_0x1c8b58,_0x108979){var _0x275dd3={'raw':!![],'where':{'id':_0x1c8b58[_0xeef1('0x45')]['id']}},_0x110930={};_0x110930['model']=_[_0xeef1('0x2c')](db[_0xeef1('0x41')][_0xeef1('0x2a')]);_0x110930['query']=_['keys'](_0x1c8b58[_0xeef1('0x2b')]);_0x110930[_0xeef1('0x2d')]=_[_0xeef1('0x30')](_0x110930[_0xeef1('0x2e')],_0x110930[_0xeef1('0x2b')]);_0x275dd3['attributes']=_[_0xeef1('0x30')](_0x110930[_0xeef1('0x2e')],qs[_0xeef1('0x46')](_0x1c8b58[_0xeef1('0x2b')][_0xeef1('0x46')]));_0x275dd3[_0xeef1('0x2f')]=_0x275dd3['attributes'][_0xeef1('0x47')]?_0x275dd3[_0xeef1('0x2f')]:_0x110930['model'];if(_0x1c8b58['query']['includeAll']){_0x275dd3[_0xeef1('0x40')]=[{'all':!![]}];}_0x275dd3=_['merge']({},_0x275dd3,_0x1c8b58[_0xeef1('0x3e')]);return db[_0xeef1('0x41')][_0xeef1('0x48')](_0x275dd3)[_0xeef1('0x23')](handleEntityNotFound(_0x108979,null))[_0xeef1('0x23')](respondWithResult(_0x108979,null))[_0xeef1('0x43')](handleError(_0x108979,null));};exports[_0xeef1('0x49')]=function(_0x335b0c,_0x1506ab){return db[_0xeef1('0x41')][_0xeef1('0x49')](_0x335b0c[_0xeef1('0x4a')],{})[_0xeef1('0x23')](respondWithResult(_0x1506ab,0xc9))[_0xeef1('0x43')](handleError(_0x1506ab,null));};exports[_0xeef1('0x21')]=function(_0xdd6c62,_0xcd6d7c){if(_0xdd6c62[_0xeef1('0x4a')]['id']){delete _0xdd6c62[_0xeef1('0x4a')]['id'];}return db[_0xeef1('0x41')][_0xeef1('0x48')]({'where':{'id':_0xdd6c62['params']['id']}})[_0xeef1('0x23')](handleEntityNotFound(_0xcd6d7c,null))[_0xeef1('0x23')](saveUpdates(_0xdd6c62[_0xeef1('0x4a')],null))[_0xeef1('0x23')](respondWithResult(_0xcd6d7c,null))[_0xeef1('0x43')](handleError(_0xcd6d7c,null));};exports[_0xeef1('0x22')]=function(_0x293b84,_0x4e441d){return db[_0xeef1('0x41')]['find']({'where':{'id':_0x293b84[_0xeef1('0x45')]['id']}})[_0xeef1('0x23')](handleEntityNotFound(_0x4e441d,null))[_0xeef1('0x23')](removeEntity(_0x4e441d,null))[_0xeef1('0x43')](handleError(_0x4e441d,null));}; \ No newline at end of file +var _0x58d1=['mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','name','index','rawAttributes','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','FaxApplication','includeAll','rows','show','params','fields','include','find','catch','create','body','rimraf','request-promise','moment','bluebird'];(function(_0x366b24,_0x1aba82){var _0x45e927=function(_0x12ef4b){while(--_0x12ef4b){_0x366b24['push'](_0x366b24['shift']());}};_0x45e927(++_0x1aba82);}(_0x58d1,0x88));var _0x158d=function(_0x43244c,_0xa2a77f){_0x43244c=_0x43244c-0x0;var _0x34babb=_0x58d1[_0x43244c];return _0x34babb;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x158d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x158d('0x1'));var moment=require(_0x158d('0x2'));var BPromise=require(_0x158d('0x3'));var Mustache=require(_0x158d('0x4'));var util=require(_0x158d('0x5'));var path=require(_0x158d('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x158d('0x7'));var squel=require(_0x158d('0x8'));var crypto=require(_0x158d('0x9'));var jsforce=require(_0x158d('0xa'));var deskjs=require(_0x158d('0xb'));var toCsv=require(_0x158d('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x158d('0xd'));var hardwareService=require(_0x158d('0xe'));var Redis=require(_0x158d('0xf'));var qs=require(_0x158d('0x10'));var logger=require(_0x158d('0x11'))('api');var utils=require(_0x158d('0x12'));var config=require(_0x158d('0x13'));var db=require(_0x158d('0x14'))['db'];function respondWithStatusCode(_0x3b9b8d,_0x2b9e2c){_0x2b9e2c=_0x2b9e2c||0xcc;return function(_0x43929b){if(_0x43929b){return _0x3b9b8d[_0x158d('0x15')](_0x2b9e2c);}return _0x3b9b8d[_0x158d('0x16')](_0x2b9e2c)[_0x158d('0x17')]();};}function respondWithResult(_0x3b2ab0,_0x385138){_0x385138=_0x385138||0xc8;return function(_0x489e71){if(_0x489e71){return _0x3b2ab0['status'](_0x385138)[_0x158d('0x18')](_0x489e71);}};}function respondWithFilteredResult(_0x406aad,_0x303af6){return function(_0x5b3a17){if(_0x5b3a17){var _0xbdb37a=_0x5b3a17[_0x158d('0x19')],_0x3e8cbe=_0x303af6[_0x158d('0x1a')],_0x4cccee=_0x303af6['offset']+_0x303af6[_0x158d('0x1b')],_0x1d7539;if(_0x4cccee>=_0xbdb37a){_0x4cccee=_0xbdb37a;_0x1d7539=0xc8;}else{_0x1d7539=0xce;}_0x406aad['status'](_0x1d7539);return _0x406aad[_0x158d('0x1c')](_0x158d('0x1d'),_0x3e8cbe+'-'+_0x4cccee+'/'+_0xbdb37a)[_0x158d('0x18')](_0x5b3a17);}return null;};}function patchUpdates(_0x71740e){return function(_0x39d025){try{jsonpatch[_0x158d('0x1e')](_0x39d025,_0x71740e,!![]);}catch(_0x4fd848){return BPromise['reject'](_0x4fd848);}return _0x39d025[_0x158d('0x1f')]();};}function saveUpdates(_0x58e72c,_0x287336){return function(_0x5878f8){if(_0x5878f8){return _0x5878f8[_0x158d('0x20')](_0x58e72c)['then'](function(_0x124a2e){return _0x124a2e;});}return null;};}function removeEntity(_0x115259,_0x3c6ae8){return function(_0x1d9fa4){if(_0x1d9fa4){return _0x1d9fa4[_0x158d('0x21')]()[_0x158d('0x22')](function(){_0x115259[_0x158d('0x16')](0xcc)[_0x158d('0x17')]();});}};}function handleEntityNotFound(_0x5d2acb,_0x5950a3){return function(_0x1c84ea){if(!_0x1c84ea){_0x5d2acb[_0x158d('0x15')](0x194);}return _0x1c84ea;};}function handleError(_0x5ee356,_0x2bf9f7){_0x2bf9f7=_0x2bf9f7||0x1f4;return function(_0x1eccd1){logger[_0x158d('0x23')](_0x1eccd1['stack']);if(_0x1eccd1[_0x158d('0x24')]){delete _0x1eccd1[_0x158d('0x24')];}_0x5ee356[_0x158d('0x16')](_0x2bf9f7)['send'](_0x1eccd1);};}exports[_0x158d('0x25')]=function(_0x7ff5e8,_0x3c7315){var _0x2da95f={},_0x1cf60a={},_0x4cea26={'count':0x0,'rows':[]};var _0x52ff19=db['FaxApplication'][_0x158d('0x26')];_0x1cf60a['model']=_[_0x158d('0x27')](_0x52ff19);_0x1cf60a[_0x158d('0x28')]=_['keys'](_0x7ff5e8[_0x158d('0x28')]);_0x1cf60a[_0x158d('0x29')]=_[_0x158d('0x2a')](_0x1cf60a[_0x158d('0x2b')],_0x1cf60a['query']);_0x2da95f['attributes']=_['intersection'](_0x1cf60a[_0x158d('0x2b')],qs['fields'](_0x7ff5e8[_0x158d('0x28')]['fields']));_0x2da95f[_0x158d('0x2c')]=_0x2da95f[_0x158d('0x2c')][_0x158d('0x2d')]?_0x2da95f[_0x158d('0x2c')]:_0x1cf60a[_0x158d('0x2b')];if(!_0x7ff5e8[_0x158d('0x28')][_0x158d('0x2e')]('nolimit')){_0x2da95f['limit']=qs[_0x158d('0x1b')](_0x7ff5e8[_0x158d('0x28')][_0x158d('0x1b')]);_0x2da95f[_0x158d('0x1a')]=qs[_0x158d('0x1a')](_0x7ff5e8[_0x158d('0x28')]['offset']);}_0x2da95f[_0x158d('0x2f')]=qs[_0x158d('0x30')](_0x7ff5e8['query'][_0x158d('0x30')]);_0x2da95f[_0x158d('0x31')]=qs[_0x158d('0x29')](_[_0x158d('0x32')](_0x7ff5e8[_0x158d('0x28')],_0x1cf60a[_0x158d('0x29')]));if(_0x7ff5e8['query'][_0x158d('0x33')]){_0x2da95f[_0x158d('0x31')]=_[_0x158d('0x34')](_0x2da95f[_0x158d('0x31')],{'$or':_[_0x158d('0x35')](_0x52ff19,function(_0x4f2569){if(_0x4f2569[_0x158d('0x36')][_0x158d('0x37')]!==_0x158d('0x38')){var _0x4ec8ed={};_0x4ec8ed[_0x4f2569[_0x158d('0x39')]]={'$like':'%'+_0x7ff5e8[_0x158d('0x28')][_0x158d('0x33')]+'%'};return _0x4ec8ed;}})});}_0x2da95f=_['merge']({},_0x2da95f,_0x7ff5e8[_0x158d('0x3a')]);var _0x4acf32={'where':_0x2da95f[_0x158d('0x31')]};return db[_0x158d('0x3b')][_0x158d('0x19')](_0x4acf32)[_0x158d('0x22')](function(_0x38da5f){_0x4cea26[_0x158d('0x19')]=_0x38da5f;if(_0x7ff5e8['query'][_0x158d('0x3c')]){_0x2da95f['include']=[{'all':!![]}];}return db[_0x158d('0x3b')]['findAll'](_0x2da95f);})[_0x158d('0x22')](function(_0x4400eb){_0x4cea26[_0x158d('0x3d')]=_0x4400eb;return _0x4cea26;})[_0x158d('0x22')](respondWithFilteredResult(_0x3c7315,_0x2da95f))['catch'](handleError(_0x3c7315,null));};exports[_0x158d('0x3e')]=function(_0x531d21,_0x2936ea){var _0x4da4b3={'raw':!![],'where':{'id':_0x531d21[_0x158d('0x3f')]['id']}},_0x4a46d7={};_0x4a46d7[_0x158d('0x2b')]=_[_0x158d('0x27')](db['FaxApplication'][_0x158d('0x26')]);_0x4a46d7[_0x158d('0x28')]=_[_0x158d('0x27')](_0x531d21[_0x158d('0x28')]);_0x4a46d7[_0x158d('0x29')]=_[_0x158d('0x2a')](_0x4a46d7[_0x158d('0x2b')],_0x4a46d7[_0x158d('0x28')]);_0x4da4b3['attributes']=_[_0x158d('0x2a')](_0x4a46d7['model'],qs[_0x158d('0x40')](_0x531d21[_0x158d('0x28')][_0x158d('0x40')]));_0x4da4b3['attributes']=_0x4da4b3['attributes'][_0x158d('0x2d')]?_0x4da4b3['attributes']:_0x4a46d7[_0x158d('0x2b')];if(_0x531d21['query']['includeAll']){_0x4da4b3[_0x158d('0x41')]=[{'all':!![]}];}_0x4da4b3=_[_0x158d('0x34')]({},_0x4da4b3,_0x531d21[_0x158d('0x3a')]);return db['FaxApplication'][_0x158d('0x42')](_0x4da4b3)[_0x158d('0x22')](handleEntityNotFound(_0x2936ea,null))['then'](respondWithResult(_0x2936ea,null))[_0x158d('0x43')](handleError(_0x2936ea,null));};exports[_0x158d('0x44')]=function(_0x10066f,_0x11f238){return db['FaxApplication'][_0x158d('0x44')](_0x10066f[_0x158d('0x45')],{})['then'](respondWithResult(_0x11f238,0xc9))[_0x158d('0x43')](handleError(_0x11f238,null));};exports['update']=function(_0x160848,_0x30159b){if(_0x160848[_0x158d('0x45')]['id']){delete _0x160848[_0x158d('0x45')]['id'];}return db[_0x158d('0x3b')][_0x158d('0x42')]({'where':{'id':_0x160848[_0x158d('0x3f')]['id']}})[_0x158d('0x22')](handleEntityNotFound(_0x30159b,null))[_0x158d('0x22')](saveUpdates(_0x160848[_0x158d('0x45')],null))[_0x158d('0x22')](respondWithResult(_0x30159b,null))[_0x158d('0x43')](handleError(_0x30159b,null));};exports[_0x158d('0x21')]=function(_0x4a5e1b,_0x2bd6cb){return db[_0x158d('0x3b')][_0x158d('0x42')]({'where':{'id':_0x4a5e1b[_0x158d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2bd6cb,null))[_0x158d('0x22')](removeEntity(_0x2bd6cb,null))[_0x158d('0x43')](handleError(_0x2bd6cb,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 9e915a4..b3fd1ad 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 _0x835a=['api','bluebird','request-promise','fax_applications','lodash','../../config/logger'];(function(_0x4c9f40,_0x2dbc1d){var _0x25789c=function(_0x30b725){while(--_0x30b725){_0x4c9f40['push'](_0x4c9f40['shift']());}};_0x25789c(++_0x2dbc1d);}(_0x835a,0x11e));var _0xa835=function(_0x626973,_0x4f7cc8){_0x626973=_0x626973-0x0;var _0x57d214=_0x835a[_0x626973];return _0x57d214;};'use strict';var _=require(_0xa835('0x0'));var util=require('util');var logger=require(_0xa835('0x1'))(_0xa835('0x2'));var moment=require('moment');var BPromise=require(_0xa835('0x3'));var rp=require(_0xa835('0x4'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0x16cf7b,_0x4322f9){return _0x16cf7b['define']('FaxApplication',attributes,{'tableName':_0xa835('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c52=['fax_applications','util','../../config/logger','api','moment','bluebird','request-promise','./faxApplication.attributes','exports','FaxApplication'];(function(_0x18fa06,_0x5da26f){var _0x1c9abc=function(_0x2a61ec){while(--_0x2a61ec){_0x18fa06['push'](_0x18fa06['shift']());}};_0x1c9abc(++_0x5da26f);}(_0x6c52,0xdd));var _0x26c5=function(_0x2c9df6,_0x3cca94){_0x2c9df6=_0x2c9df6-0x0;var _0x66fb63=_0x6c52[_0x2c9df6];return _0x66fb63;};'use strict';var _=require('lodash');var util=require(_0x26c5('0x0'));var logger=require(_0x26c5('0x1'))(_0x26c5('0x2'));var moment=require(_0x26c5('0x3'));var BPromise=require(_0x26c5('0x4'));var rp=require(_0x26c5('0x5'));var attributes=require(_0x26c5('0x6'));module[_0x26c5('0x7')]=function(_0x646091,_0x27d41f){return _0x646091['define'](_0x26c5('0x8'),attributes,{'tableName':_0x26c5('0x9'),'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 861c86f..24f539f 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 _0x2013=['client','http','request','then','info','FaxApplication,\x20%s,\x20%s','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','UpdateFaxApplication','FaxApplication','update','body','options','attributes','limit','debug','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x5b3434,_0x338598){var _0x5686a5=function(_0x156d11){while(--_0x156d11){_0x5b3434['push'](_0x5b3434['shift']());}};_0x5686a5(++_0x338598);}(_0x2013,0x19a));var _0x3201=function(_0x4bf0b9,_0x294137){_0x4bf0b9=_0x4bf0b9-0x0;var _0x2d0f9d=_0x2013[_0x4bf0b9];return _0x2d0f9d;};'use strict';var _=require('lodash');var util=require(_0x3201('0x0'));var moment=require(_0x3201('0x1'));var BPromise=require(_0x3201('0x2'));var rs=require(_0x3201('0x3'));var fs=require('fs');var Redis=require(_0x3201('0x4'));var db=require(_0x3201('0x5'))['db'];var utils=require(_0x3201('0x6'));var logger=require(_0x3201('0x7'))(_0x3201('0x8'));var config=require('../../config/environment');var jayson=require(_0x3201('0x9'));var client=jayson[_0x3201('0xa')][_0x3201('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x534929,_0x100945,_0x3232de){return new BPromise(function(_0x41c1ee,_0x48cab2){return client[_0x3201('0xc')](_0x534929,_0x3232de)[_0x3201('0xd')](function(_0x1e93ce){logger[_0x3201('0xe')](_0x3201('0xf'),_0x100945,'request\x20sent');logger['debug'](_0x3201('0x10'),_0x100945,_0x3201('0x11'),JSON[_0x3201('0x12')](_0x1e93ce));if(_0x1e93ce[_0x3201('0x13')]){if(_0x1e93ce[_0x3201('0x13')]['code']===0x1f4){logger[_0x3201('0x13')](_0x3201('0xf'),_0x100945,_0x1e93ce['error'][_0x3201('0x14')]);return _0x48cab2(_0x1e93ce['error'][_0x3201('0x14')]);}logger[_0x3201('0x13')]('FaxApplication,\x20%s,\x20%s',_0x100945,_0x1e93ce[_0x3201('0x13')][_0x3201('0x14')]);return _0x41c1ee(_0x1e93ce[_0x3201('0x13')][_0x3201('0x14')]);}else{logger[_0x3201('0xe')](_0x3201('0xf'),_0x100945,_0x3201('0x11'));_0x41c1ee(_0x1e93ce['result'][_0x3201('0x14')]);}})['catch'](function(_0x5a7186){logger['error']('FaxApplication,\x20%s,\x20%s',_0x100945,_0x5a7186);_0x48cab2(_0x5a7186);});});}exports[_0x3201('0x15')]=function(_0x13900a){var _0x4fa299=this;return new Promise(function(_0x448a47,_0x1b37d9){return db[_0x3201('0x16')][_0x3201('0x17')](_0x13900a[_0x3201('0x18')],{'raw':_0x13900a[_0x3201('0x19')]?_0x13900a[_0x3201('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13900a['options']?_0x13900a[_0x3201('0x19')]['where']||null:null,'attributes':_0x13900a[_0x3201('0x19')]?_0x13900a['options'][_0x3201('0x1a')]||null:null,'limit':_0x13900a[_0x3201('0x19')]?_0x13900a[_0x3201('0x19')][_0x3201('0x1b')]||null:null})[_0x3201('0xd')](function(_0x26df95){logger[_0x3201('0xe')](_0x3201('0x15'),_0x13900a);logger[_0x3201('0x1c')](_0x3201('0x15'),_0x13900a,JSON[_0x3201('0x12')](_0x26df95));_0x448a47(_0x26df95);})[_0x3201('0x1d')](function(_0x40a3a3){logger['error'](_0x3201('0x15'),_0x40a3a3[_0x3201('0x14')],_0x13900a);_0x1b37d9(_0x4fa299[_0x3201('0x13')](0x1f4,_0x40a3a3[_0x3201('0x14')]));});});}; \ No newline at end of file +var _0xb849=['request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','limit','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x286f76,_0x18190a){var _0x5190ce=function(_0x55094f){while(--_0x55094f){_0x286f76['push'](_0x286f76['shift']());}};_0x5190ce(++_0x18190a);}(_0xb849,0x1f4));var _0x9b84=function(_0x545680,_0x201980){_0x545680=_0x545680-0x0;var _0x304bd9=_0xb849[_0x545680];return _0x304bd9;};'use strict';var _=require(_0x9b84('0x0'));var util=require('util');var moment=require(_0x9b84('0x1'));var BPromise=require(_0x9b84('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b84('0x3'));var db=require(_0x9b84('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b84('0x5'))(_0x9b84('0x6'));var config=require('../../config/environment');var jayson=require(_0x9b84('0x7'));var client=jayson[_0x9b84('0x8')][_0x9b84('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19601d,_0x4ca9b3,_0x3956e5){return new BPromise(function(_0x42bc6d,_0x4a0b12){return client[_0x9b84('0xa')](_0x19601d,_0x3956e5)[_0x9b84('0xb')](function(_0x4b97ef){logger[_0x9b84('0xc')](_0x9b84('0xd'),_0x4ca9b3,_0x9b84('0xe'));logger['debug'](_0x9b84('0xf'),_0x4ca9b3,_0x9b84('0xe'),JSON[_0x9b84('0x10')](_0x4b97ef));if(_0x4b97ef[_0x9b84('0x11')]){if(_0x4b97ef[_0x9b84('0x11')][_0x9b84('0x12')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x4ca9b3,_0x4b97ef[_0x9b84('0x11')]['message']);return _0x4a0b12(_0x4b97ef[_0x9b84('0x11')][_0x9b84('0x13')]);}logger[_0x9b84('0x11')](_0x9b84('0xd'),_0x4ca9b3,_0x4b97ef['error']['message']);return _0x42bc6d(_0x4b97ef['error'][_0x9b84('0x13')]);}else{logger[_0x9b84('0xc')](_0x9b84('0xd'),_0x4ca9b3,_0x9b84('0xe'));_0x42bc6d(_0x4b97ef[_0x9b84('0x14')]['message']);}})[_0x9b84('0x15')](function(_0x8f261f){logger[_0x9b84('0x11')](_0x9b84('0xd'),_0x4ca9b3,_0x8f261f);_0x4a0b12(_0x8f261f);});});}exports[_0x9b84('0x16')]=function(_0x178991){var _0xecd924=this;return new Promise(function(_0x84ae34,_0x476708){return db[_0x9b84('0x17')][_0x9b84('0x18')](_0x178991[_0x9b84('0x19')],{'raw':_0x178991['options']?_0x178991[_0x9b84('0x1a')][_0x9b84('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x178991[_0x9b84('0x1a')]?_0x178991[_0x9b84('0x1a')]['where']||null:null,'attributes':_0x178991[_0x9b84('0x1a')]?_0x178991[_0x9b84('0x1a')]['attributes']||null:null,'limit':_0x178991[_0x9b84('0x1a')]?_0x178991[_0x9b84('0x1a')][_0x9b84('0x1c')]||null:null})[_0x9b84('0xb')](function(_0x221af9){logger[_0x9b84('0xc')](_0x9b84('0x16'),_0x178991);logger[_0x9b84('0x1d')](_0x9b84('0x16'),_0x178991,JSON[_0x9b84('0x10')](_0x221af9));_0x84ae34(_0x221af9);})[_0x9b84('0x15')](function(_0x4be556){logger[_0x9b84('0x11')](_0x9b84('0x16'),_0x4be556[_0x9b84('0x13')],_0x178991);_0x476708(_0xecd924[_0x9b84('0x11')](0x1f4,_0x4be556[_0x9b84('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 4ef043c..70c2308 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 _0xed3c=['post','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x20f990,_0x5a11ab){var _0x5315fa=function(_0x59206a){while(--_0x59206a){_0x20f990['push'](_0x20f990['shift']());}};_0x5315fa(++_0x5a11ab);}(_0xed3c,0x1a6));var _0xced3=function(_0x35181c,_0x82694a){_0x35181c=_0x35181c-0x0;var _0xe14bf9=_0xed3c[_0x35181c];return _0xe14bf9;};'use strict';var multer=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var path=require(_0xced3('0x2'));var timeout=require(_0xced3('0x3'));var express=require('express');var router=express[_0xced3('0x4')]();var auth=require(_0xced3('0x5'));var interaction=require(_0xced3('0x6'));var config=require('../../config/environment');var controller=require('./faxApplication.controller');router[_0xced3('0x7')]('/',auth[_0xced3('0x8')](),controller[_0xced3('0x9')]);router[_0xced3('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xced3('0xa')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xced3('0xb'),auth[_0xced3('0x8')](),controller[_0xced3('0xc')]);router[_0xced3('0xd')](_0xced3('0xb'),auth['isAuthenticated'](),controller[_0xced3('0xe')]);module[_0xced3('0xf')]=router; \ No newline at end of file +var _0x0abf=['index','/:id','show','post','create','update','exports','multer','path','connect-timeout','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated'];(function(_0x5d91f5,_0x31649e){var _0x146dc9=function(_0x1f76c2){while(--_0x1f76c2){_0x5d91f5['push'](_0x5d91f5['shift']());}};_0x146dc9(++_0x31649e);}(_0x0abf,0xe8));var _0xf0ab=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x0abf[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xf0ab('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf0ab('0x4'));var controller=require(_0xf0ab('0x5'));router[_0xf0ab('0x6')]('/',auth[_0xf0ab('0x7')](),controller[_0xf0ab('0x8')]);router[_0xf0ab('0x6')](_0xf0ab('0x9'),auth['isAuthenticated'](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0xb')]('/',auth[_0xf0ab('0x7')](),controller[_0xf0ab('0xc')]);router['put'](_0xf0ab('0x9'),auth[_0xf0ab('0x7')](),controller[_0xf0ab('0xd')]);router['delete']('/:id',auth[_0xf0ab('0x7')](),controller['destroy']);module[_0xf0ab('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 9301e87..4a338fc 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 _0x8abd=['DATE','STRING','ENUM','out','sequelize','BOOLEAN'];(function(_0x3dd69c,_0x75c6aa){var _0x527601=function(_0x10fc13){while(--_0x10fc13){_0x3dd69c['push'](_0x3dd69c['shift']());}};_0x527601(++_0x75c6aa);}(_0x8abd,0x13c));var _0xd8ab=function(_0x55738c,_0x256856){_0x55738c=_0x55738c-0x0;var _0x54a1d1=_0x8abd[_0x55738c];return _0x54a1d1;};'use strict';var Sequelize=require(_0xd8ab('0x0'));module['exports']={'closed':{'type':Sequelize[_0xd8ab('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd8ab('0x2')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd8ab('0x3')]},'read1stAt':{'type':Sequelize[_0xd8ab('0x2')]},'fax':{'type':Sequelize[_0xd8ab('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xd8ab('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd8ab('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xd8ab('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x896b=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x20987a,_0x3bc13b){var _0x2fa89e=function(_0x3a369b){while(--_0x3a369b){_0x20987a['push'](_0x20987a['shift']());}};_0x2fa89e(++_0x3bc13b);}(_0x896b,0xad));var _0xb896=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x896b[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb896('0x0'));module[_0xb896('0x1')]={'closed':{'type':Sequelize[_0xb896('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb896('0x3')]},'disposition':{'type':Sequelize[_0xb896('0x4')]},'note':{'type':Sequelize[_0xb896('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xb896('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xb896('0x5')]('in',_0xb896('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb896('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb896('0x5')]('in',_0xb896('0x6')),'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 e12a8ce..3ab145c 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 _0x6b79=['socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','key','VIRTUAL','field','options','include','push','Tag','Tags','tag','distinct','read','Messages','direction','User','Users','fullname','CmContact','Owner','internal','FaxAccount','Account','FaxMessage','createdAt','color','ThroughTags','FaxInteraction','findAll','rows','catch','show','params','includeAll','find','create','body','describe','addMessage','ids','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','omit','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','root','files','attachments','server','tmp','interaction-%s.zip','Attachment','mkdirSync','existsSync','createReadStream','pipe','createWriteStream','log','err','eml-format','rimraf','zip-dir','request-promise','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost'];(function(_0x25e03b,_0x244b3f){var _0x19dcef=function(_0x21503c){while(--_0x21503c){_0x25e03b['push'](_0x25e03b['shift']());}};_0x19dcef(++_0x244b3f);}(_0x6b79,0x6b));var _0x96b7=function(_0x4d3d75,_0xbd5de0){_0x4d3d75=_0x4d3d75-0x0;var _0x480b4f=_0x6b79[_0x4d3d75];return _0x480b4f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x96b7('0x0'));var rimraf=require(_0x96b7('0x1'));var zipdir=require(_0x96b7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x96b7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x96b7('0x4'));var path=require('path');var sox=require(_0x96b7('0x5'));var csv=require(_0x96b7('0x6'));var ejs=require(_0x96b7('0x7'));var fs=require('fs');var _=require(_0x96b7('0x8'));var squel=require(_0x96b7('0x9'));var crypto=require(_0x96b7('0xa'));var jsforce=require(_0x96b7('0xb'));var deskjs=require(_0x96b7('0xc'));var toCsv=require(_0x96b7('0x6'));var querystring=require(_0x96b7('0xd'));var Papa=require(_0x96b7('0xe'));var authService=require(_0x96b7('0xf'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x96b7('0x10'));var qs=require(_0x96b7('0x11'));var logger=require(_0x96b7('0x12'))(_0x96b7('0x13'));var utils=require(_0x96b7('0x14'));var config=require(_0x96b7('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x96b7('0x16')](config[_0x96b7('0x17')],{'host':_0x96b7('0x18'),'port':0x18eb});var socket=require(_0x96b7('0x19'))(new Redis(config[_0x96b7('0x17')]));require(_0x96b7('0x1a'))[_0x96b7('0x1b')](socket);function respondWithStatusCode(_0x431441,_0xfdfdae){_0xfdfdae=_0xfdfdae||0xcc;return function(_0x5aa5e9){if(_0x5aa5e9){return _0x431441[_0x96b7('0x1c')](_0xfdfdae);}return _0x431441[_0x96b7('0x1d')](_0xfdfdae)[_0x96b7('0x1e')]();};}function respondWithResult(_0x73ec7c,_0x120c6b){_0x120c6b=_0x120c6b||0xc8;return function(_0x2bf5be){if(_0x2bf5be){return _0x73ec7c[_0x96b7('0x1d')](_0x120c6b)[_0x96b7('0x1f')](_0x2bf5be);}};}function respondWithFilteredResult(_0x215add,_0x485df7){return function(_0x59ee4a){if(_0x59ee4a){var _0x5e8735=_0x59ee4a[_0x96b7('0x20')],_0x29aa27=_0x485df7[_0x96b7('0x21')],_0x34acc2=_0x485df7[_0x96b7('0x21')]+_0x485df7[_0x96b7('0x22')],_0x417634;if(_0x34acc2>=_0x5e8735){_0x34acc2=_0x5e8735;_0x417634=0xc8;}else{_0x417634=0xce;}_0x215add[_0x96b7('0x1d')](_0x417634);return _0x215add[_0x96b7('0x23')](_0x96b7('0x24'),_0x29aa27+'-'+_0x34acc2+'/'+_0x5e8735)[_0x96b7('0x1f')](_0x59ee4a);}return null;};}function patchUpdates(_0x10435b){return function(_0x1f12d9){try{jsonpatch[_0x96b7('0x25')](_0x1f12d9,_0x10435b,!![]);}catch(_0x5b189c){return BPromise[_0x96b7('0x26')](_0x5b189c);}return _0x1f12d9[_0x96b7('0x27')]();};}function saveUpdates(_0x4e0d20,_0x5daaa3){return function(_0x3c74e3){if(_0x3c74e3){return _0x3c74e3[_0x96b7('0x28')](_0x4e0d20)[_0x96b7('0x29')](function(_0x1b6335){return _0x1b6335;});}return null;};}function removeEntity(_0x549937,_0x46415e){return function(_0x57fed0){if(_0x57fed0){return _0x57fed0[_0x96b7('0x2a')]()[_0x96b7('0x29')](function(){_0x549937[_0x96b7('0x1d')](0xcc)[_0x96b7('0x1e')]();});}};}function handleEntityNotFound(_0x52fdb7,_0x4d4c4d){return function(_0x29b7e2){if(!_0x29b7e2){_0x52fdb7[_0x96b7('0x1c')](0x194);}return _0x29b7e2;};}function handleError(_0x2109b7,_0x109a2e){_0x109a2e=_0x109a2e||0x1f4;return function(_0x228427){logger[_0x96b7('0x2b')](_0x228427[_0x96b7('0x2c')]);if(_0x228427['name']){delete _0x228427[_0x96b7('0x2d')];}_0x2109b7[_0x96b7('0x1d')](_0x109a2e)['send'](_0x228427);};}exports[_0x96b7('0x2e')]=function(_0x237c04,_0x4a073f){var _0x1677c6={},_0x816ea7={},_0x42edde={'count':0x0,'rows':[]};var _0x3aa45a=db['FaxInteraction'][_0x96b7('0x2f')];_0x816ea7[_0x96b7('0x30')]=_[_0x96b7('0x31')](_0x3aa45a);_0x816ea7['query']=_[_0x96b7('0x31')](_0x237c04[_0x96b7('0x32')]);_0x816ea7[_0x96b7('0x33')]=_['intersection'](_0x816ea7['model'],_0x816ea7[_0x96b7('0x32')]);_0x1677c6[_0x96b7('0x34')]=_[_0x96b7('0x35')](_0x816ea7[_0x96b7('0x30')],qs[_0x96b7('0x36')](_0x237c04[_0x96b7('0x32')]['fields']));_0x1677c6[_0x96b7('0x34')]=_0x1677c6[_0x96b7('0x34')][_0x96b7('0x37')]?_0x1677c6[_0x96b7('0x34')]:_0x816ea7['model'];if(!_0x237c04['query'][_0x96b7('0x38')](_0x96b7('0x39'))){_0x1677c6[_0x96b7('0x22')]=qs[_0x96b7('0x22')](_0x237c04['query'][_0x96b7('0x22')]);_0x1677c6[_0x96b7('0x21')]=qs[_0x96b7('0x21')](_0x237c04[_0x96b7('0x32')][_0x96b7('0x21')]);}_0x1677c6[_0x96b7('0x3a')]=qs[_0x96b7('0x3b')](_0x237c04[_0x96b7('0x32')][_0x96b7('0x3b')]);_0x1677c6[_0x96b7('0x3c')]=qs[_0x96b7('0x33')](_[_0x96b7('0x3d')](_0x237c04['query'],_0x816ea7['filters']));if(_0x237c04[_0x96b7('0x32')][_0x96b7('0x3e')]){_0x1677c6[_0x96b7('0x3c')]=_[_0x96b7('0x3f')](_0x1677c6['where'],{'$or':_[_0x96b7('0x40')](_0x3aa45a,function(_0x34f7ff){if(_0x34f7ff['type'][_0x96b7('0x41')]!==_0x96b7('0x42')){var _0x17f2be={};_0x17f2be[_0x34f7ff[_0x96b7('0x43')]]={'$like':'%'+_0x237c04[_0x96b7('0x32')][_0x96b7('0x3e')]+'%'};return _0x17f2be;}})});}_0x1677c6=_[_0x96b7('0x3f')]({},_0x1677c6,_0x237c04[_0x96b7('0x44')]);var _0xda6d52={'where':_0x1677c6[_0x96b7('0x3c')]};_0xda6d52[_0x96b7('0x45')]=[];if(_0x237c04['query']['tag']){_0xda6d52['include'][_0x96b7('0x46')]({'model':db[_0x96b7('0x47')],'as':_0x96b7('0x48'),'attributes':['id'],'where':{'id':_0x237c04[_0x96b7('0x32')][_0x96b7('0x49')]},'required':!![]});_0xda6d52[_0x96b7('0x4a')]=!![];}if(_0x237c04[_0x96b7('0x32')][_0x96b7('0x4b')]){_0xda6d52[_0x96b7('0x45')][_0x96b7('0x46')]({'model':db['FaxMessage'],'as':_0x96b7('0x4c'),'attributes':['id',_0x96b7('0x4d'),'createdAt','read'],'where':{'direction':'in','read':_0x237c04[_0x96b7('0x32')][_0x96b7('0x4b')]||![]},'required':!![]});_0xda6d52[_0x96b7('0x4a')]=!![];}return db['FaxInteraction'][_0x96b7('0x20')](_0xda6d52)[_0x96b7('0x29')](function(_0x25439b){_0x42edde[_0x96b7('0x20')]=_0x25439b;if(_0x237c04['query']['includeAll']){_0x1677c6[_0x96b7('0x45')]=[{'model':db[_0x96b7('0x4e')],'as':_0x96b7('0x4f'),'required':![],'attributes':['id',_0x96b7('0x2d'),_0x96b7('0x50')]},{'model':db[_0x96b7('0x51')],'as':'Contact','required':![]},{'model':db[_0x96b7('0x4e')],'as':_0x96b7('0x52'),'attributes':[_0x96b7('0x2d'),_0x96b7('0x50'),_0x96b7('0x53')],'required':![]},{'model':db[_0x96b7('0x54')],'as':_0x96b7('0x55'),'attributes':['name',_0x96b7('0x41')],'required':![]},{'model':db[_0x96b7('0x56')],'as':_0x96b7('0x4c'),'attributes':['id',_0x96b7('0x4d'),_0x96b7('0x57'),'read'],'where':{'direction':'in','read':_0x237c04[_0x96b7('0x32')][_0x96b7('0x4b')]||![]},'required':_0x237c04['query'][_0x96b7('0x4b')]||![]},{'model':db[_0x96b7('0x47')],'as':_0x96b7('0x48'),'attributes':['id','name',_0x96b7('0x58')],'required':_0x237c04[_0x96b7('0x32')][_0x96b7('0x49')]?!![]:![]},{'model':db[_0x96b7('0x47')],'as':_0x96b7('0x59'),'attributes':['id',_0x96b7('0x2d'),_0x96b7('0x58')],'through':_0x237c04['query'][_0x96b7('0x49')]?{'attributes':[],'where':{'TagId':_0x237c04[_0x96b7('0x32')][_0x96b7('0x49')]||undefined}}:{},'required':_0x237c04[_0x96b7('0x32')][_0x96b7('0x49')]?!![]:![]}];}return db[_0x96b7('0x5a')][_0x96b7('0x5b')](_0x1677c6);})[_0x96b7('0x29')](function(_0x53afba){_0x42edde[_0x96b7('0x5c')]=_0x53afba;return _0x42edde;})[_0x96b7('0x29')](respondWithFilteredResult(_0x4a073f,_0x1677c6))[_0x96b7('0x5d')](handleError(_0x4a073f,null));};exports[_0x96b7('0x5e')]=function(_0x19282b,_0x5a2c4c){var _0x446e26={'raw':![],'where':{'id':_0x19282b[_0x96b7('0x5f')]['id']}},_0x40afff={};_0x40afff['model']=_[_0x96b7('0x31')](db[_0x96b7('0x5a')][_0x96b7('0x2f')]);_0x40afff['query']=_[_0x96b7('0x31')](_0x19282b['query']);_0x40afff[_0x96b7('0x33')]=_[_0x96b7('0x35')](_0x40afff['model'],_0x40afff['query']);_0x446e26[_0x96b7('0x34')]=_['intersection'](_0x40afff['model'],qs[_0x96b7('0x36')](_0x19282b[_0x96b7('0x32')][_0x96b7('0x36')]));_0x446e26[_0x96b7('0x34')]=_0x446e26[_0x96b7('0x34')][_0x96b7('0x37')]?_0x446e26[_0x96b7('0x34')]:_0x40afff[_0x96b7('0x30')];if(_0x19282b['query'][_0x96b7('0x60')]){_0x446e26[_0x96b7('0x45')]=[{'all':!![]}];}_0x446e26=_[_0x96b7('0x3f')]({},_0x446e26,_0x19282b[_0x96b7('0x44')]);return db[_0x96b7('0x5a')][_0x96b7('0x61')](_0x446e26)[_0x96b7('0x29')](handleEntityNotFound(_0x5a2c4c,null))[_0x96b7('0x29')](respondWithResult(_0x5a2c4c,null))[_0x96b7('0x5d')](handleError(_0x5a2c4c,null));};exports[_0x96b7('0x62')]=function(_0x20f7ea,_0x4958df){return db[_0x96b7('0x5a')][_0x96b7('0x62')](_0x20f7ea[_0x96b7('0x63')],{})[_0x96b7('0x29')](respondWithResult(_0x4958df,0xc9))[_0x96b7('0x5d')](handleError(_0x4958df,null));};exports[_0x96b7('0x28')]=function(_0x3e9273,_0x5e8ceb){if(_0x3e9273[_0x96b7('0x63')]['id']){delete _0x3e9273[_0x96b7('0x63')]['id'];}return db[_0x96b7('0x5a')][_0x96b7('0x61')]({'where':{'id':_0x3e9273['params']['id']}})[_0x96b7('0x29')](handleEntityNotFound(_0x5e8ceb,null))['then'](saveUpdates(_0x3e9273[_0x96b7('0x63')],null))[_0x96b7('0x29')](respondWithResult(_0x5e8ceb,null))[_0x96b7('0x5d')](handleError(_0x5e8ceb,null));};exports[_0x96b7('0x2a')]=function(_0x4c0b84,_0x5343b6){return db['FaxInteraction'][_0x96b7('0x61')]({'where':{'id':_0x4c0b84['params']['id']}})[_0x96b7('0x29')](handleEntityNotFound(_0x5343b6,null))['then'](removeEntity(_0x5343b6,null))[_0x96b7('0x5d')](handleError(_0x5343b6,null));};exports[_0x96b7('0x64')]=function(_0x37e605,_0x5727a4){return db[_0x96b7('0x5a')]['describe']()['then'](respondWithResult(_0x5727a4,null))[_0x96b7('0x5d')](handleError(_0x5727a4,null));};exports[_0x96b7('0x65')]=function(_0x1a1343,_0x43e672,_0x22247b){return db[_0x96b7('0x56')][_0x96b7('0x61')]({'where':{'id':_0x1a1343[_0x96b7('0x5f')]['id']}})[_0x96b7('0x29')](handleEntityNotFound(_0x43e672,null))[_0x96b7('0x29')](function(_0x279131){if(_0x279131){return _0x279131[_0x96b7('0x65')](_0x1a1343[_0x96b7('0x63')][_0x96b7('0x66')],_['omit'](_0x1a1343[_0x96b7('0x63')],['ids','id'])||{});}})['then'](respondWithResult(_0x43e672,null))['catch'](handleError(_0x43e672,null));};exports[_0x96b7('0x67')]=function(_0x38d0ae,_0x3ff7b9,_0xa73bf0){var _0x4cece5={'raw':![],'where':{}};var _0x3d7a6a={};var _0x104680={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x96b7('0x68')]({'where':{'id':_0x38d0ae[_0x96b7('0x5f')]['id']}})[_0x96b7('0x29')](handleEntityNotFound(_0x3ff7b9,null))[_0x96b7('0x29')](function(_0xd3cbcc){if(_0xd3cbcc){_0x3d7a6a['model']=_['keys'](db[_0x96b7('0x56')]['rawAttributes']);_0x3d7a6a[_0x96b7('0x32')]=_[_0x96b7('0x31')](_0x38d0ae[_0x96b7('0x32')]);_0x3d7a6a[_0x96b7('0x33')]=_[_0x96b7('0x35')](_0x3d7a6a['model'],_0x3d7a6a[_0x96b7('0x32')]);_0x4cece5['attributes']=_['intersection'](_0x3d7a6a[_0x96b7('0x30')],qs['fields'](_0x38d0ae[_0x96b7('0x32')]['fields']));_0x4cece5[_0x96b7('0x34')]=_0x4cece5[_0x96b7('0x34')]['length']?_0x4cece5['attributes']:_0x3d7a6a['model'];if(!_0x38d0ae[_0x96b7('0x32')]['hasOwnProperty'](_0x96b7('0x39'))){_0x4cece5[_0x96b7('0x22')]=qs[_0x96b7('0x22')](_0x38d0ae[_0x96b7('0x32')][_0x96b7('0x22')]);_0x4cece5[_0x96b7('0x21')]=qs[_0x96b7('0x21')](_0x38d0ae[_0x96b7('0x32')]['offset']);}_0x4cece5['order']=qs['sort'](_0x38d0ae[_0x96b7('0x32')][_0x96b7('0x3b')]);_0x4cece5[_0x96b7('0x3c')]=qs['filters'](_['pick'](_0x38d0ae[_0x96b7('0x32')],_0x3d7a6a[_0x96b7('0x33')]));_0x4cece5['where']['FaxInteractionId']=_0xd3cbcc['id'];if(_0x38d0ae[_0x96b7('0x32')][_0x96b7('0x3e')]){_0x4cece5['where']=_[_0x96b7('0x3f')](_0x4cece5[_0x96b7('0x3c')],{'$or':_[_0x96b7('0x40')](_0x4cece5[_0x96b7('0x34')],function(_0x133b0d){var _0x3c9923={};_0x3c9923[_0x133b0d]={'$like':'%'+_0x38d0ae[_0x96b7('0x32')]['filter']+'%'};return _0x3c9923;})});}if(_0x38d0ae[_0x96b7('0x32')][_0x96b7('0x69')]){var _0x45d546=_0x38d0ae[_0x96b7('0x32')]['$gte'][_0x96b7('0x6a')](',');var _0x594eaa={};_0x594eaa[_0x45d546[0x0]]={'$gte':moment(_0x45d546[0x1])[_0x96b7('0x6b')](_0x96b7('0x6c'))};_0x4cece5[_0x96b7('0x3c')]=_['merge'](_0x4cece5[_0x96b7('0x3c')],_0x594eaa);}_0x4cece5=_[_0x96b7('0x3f')]({},_0x4cece5,_0x38d0ae[_0x96b7('0x44')]);return db['FaxMessage']['count']({'where':_0x4cece5['where']})[_0x96b7('0x29')](function(_0x1cdec2){_0x104680[_0x96b7('0x20')]=_0x1cdec2;if(_0x38d0ae['query'][_0x96b7('0x60')]){_0x4cece5[_0x96b7('0x45')]=[{'all':!![]}];}return db[_0x96b7('0x56')][_0x96b7('0x5b')](_0x4cece5);})['then'](function(_0x3989ff){_0x104680[_0x96b7('0x5c')]=_0x3989ff;return _0x104680;});}})[_0x96b7('0x29')](respondWithFilteredResult(_0x3ff7b9,_0x4cece5))['catch'](handleError(_0x3ff7b9,null));};exports[_0x96b7('0x6d')]=function(_0x291dce,_0x38dfcc,_0x27197d){return db[_0x96b7('0x5a')][_0x96b7('0x61')]({'where':{'id':_0x291dce[_0x96b7('0x5f')]['id']}})['then'](handleEntityNotFound(_0x38dfcc,null))[_0x96b7('0x29')](function(_0x307e37){if(_0x307e37){return _0x307e37['setTags'](_0x291dce[_0x96b7('0x63')][_0x96b7('0x66')],_[_0x96b7('0x6e')](_0x291dce['body'],['ids','id'])||{})[_0x96b7('0x6f')](function(){return db[_0x96b7('0x47')][_0x96b7('0x5b')]({'attributes':['id','name',_0x96b7('0x58')],'where':{'id':_0x291dce[_0x96b7('0x63')][_0x96b7('0x66')]}});})['then'](function(_0x283e8a){socket[_0x96b7('0x70')](_0x96b7('0x71'),{'id':Number(_0x291dce['params']['id']),'tags':_0x283e8a||[]});return{'id':Number(_0x291dce['params']['id']),'tags':_0x283e8a||[]};});}})[_0x96b7('0x29')](respondWithResult(_0x38dfcc,null))[_0x96b7('0x5d')](handleError(_0x38dfcc,null));};exports[_0x96b7('0x72')]=function(_0x5581c7,_0x229013,_0x389d49){var _0x3c577c;return db[_0x96b7('0x5a')][_0x96b7('0x61')]({'where':{'id':_0x5581c7['params']['id']}})[_0x96b7('0x29')](handleEntityNotFound(_0x229013,null))[_0x96b7('0x29')](function(_0x7d2c89){if(_0x7d2c89){return _0x7d2c89[_0x96b7('0x72')](_0x5581c7[_0x96b7('0x32')][_0x96b7('0x66')]);}})[_0x96b7('0x29')](respondWithStatusCode(_0x229013,null))['catch'](handleError(_0x229013,null));};exports[_0x96b7('0x73')]=function(_0x4ff5c3,_0x295c1f){var _0x4a67ac=moment()[_0x96b7('0x74')]()['toString']();var _0x1863fe=path[_0x96b7('0x75')](config[_0x96b7('0x76')],'server',_0x96b7('0x77'),_0x96b7('0x78'));var _0x4a416c=path[_0x96b7('0x75')](config[_0x96b7('0x76')],_0x96b7('0x79'),_0x96b7('0x77'),_0x96b7('0x7a'));var _0x2ac290=path[_0x96b7('0x75')](_0x4a416c,_0x4a67ac);var _0x1196e8=util[_0x96b7('0x6b')](_0x96b7('0x7b'),_0x4a67ac);var _0x21af2c=path[_0x96b7('0x75')](_0x4a416c,_0x1196e8);var _0x30992e=![];return db[_0x96b7('0x5a')][_0x96b7('0x61')]({'where':{'id':_0x4ff5c3['params']['id']}})[_0x96b7('0x29')](handleEntityNotFound(_0x295c1f,null))[_0x96b7('0x29')](function(_0x4b027b){if(_0x4b027b){return _0x4b027b[_0x96b7('0x67')]({'attributes':['id',_0x96b7('0x63'),'createdAt'],'include':[{'model':db[_0x96b7('0x7c')],'as':_0x96b7('0x7c')}]});}return[];})['then'](function(_0x22960d){_0x30992e=_0x22960d[_0x96b7('0x37')];if(_0x22960d['length']){fs[_0x96b7('0x7d')](_0x2ac290);for(var _0x27bc50=0x0;_0x27bc50<_0x22960d[_0x96b7('0x37')];_0x27bc50++){var _0x25ebef=_0x22960d[_0x27bc50];var _0x2096d4=_0x25ebef['Attachment'];if(_0x2096d4){var _0x1c1d37=path[_0x96b7('0x75')](_0x1863fe,_0x2096d4['basename']);if(fs[_0x96b7('0x7e')](_0x1c1d37)){fs[_0x96b7('0x7f')](_0x1c1d37)[_0x96b7('0x80')](fs[_0x96b7('0x81')](path['join'](_0x2ac290,_0x2096d4['basename'])));}}}}})[_0x96b7('0x29')](function(){if(_0x30992e){return new BPromise(function(_0xc72fe4,_0x27fa1c){zipdir(_0x2ac290,{'saveTo':_0x21af2c},function(_0x2501a3,_0x2dc4b1){if(_0x2501a3)return _0x27fa1c(_0x2501a3);return _0xc72fe4(_0x2dc4b1);});});}})['then'](function(){if(_0x30992e){return new BPromise(function(_0x4eba92,_0x4d0add){rimraf(_0x2ac290,function(_0x100bca){if(_0x100bca)_0x4d0add(_0x100bca);return _0x4eba92();});});}})[_0x96b7('0x29')](function(){if(_0x30992e){return _0x295c1f[_0x96b7('0x73')](_0x21af2c,_0x1196e8,function(_0x26a3f2){if(_0x26a3f2){console[_0x96b7('0x82')](_0x96b7('0x83'),_0x26a3f2);}else{fs['unlinkSync'](_0x21af2c);}});}else{return _0x295c1f[_0x96b7('0x1c')](0xc8);}})[_0x96b7('0x5d')](handleError(_0x295c1f,null));}; \ No newline at end of file +var _0x4b2e=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','FaxInteraction','rawAttributes','model','keys','query','filters','attributes','fields','nolimit','order','sort','where','map','key','VIRTUAL','field','filter','merge','options','include','tag','Tag','distinct','read','push','FaxMessage','Messages','direction','createdAt','includeAll','User','Users','fullname','CmContact','Contact','Owner','internal','FaxAccount','Account','Tags','color','findAll','rows','catch','show','params','intersection','length','find','create','body','describe','addMessage','omit','ids','getMessages','hasOwnProperty','FaxInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','attachments','tmp','interaction-%s.zip','Attachment','mkdirSync','existsSync','pipe','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils'];(function(_0x57d997,_0x367ce4){var _0x2cb473=function(_0x5ed65f){while(--_0x5ed65f){_0x57d997['push'](_0x57d997['shift']());}};_0x2cb473(++_0x367ce4);}(_0x4b2e,0xf5));var _0xe4b2=function(_0x22e1d6,_0x3d9fa1){_0x22e1d6=_0x22e1d6-0x0;var _0xd271b3=_0x4b2e[_0x22e1d6];return _0xd271b3;};'use strict';var pdf=require(_0xe4b2('0x0'));var emlformat=require(_0xe4b2('0x1'));var rimraf=require(_0xe4b2('0x2'));var zipdir=require(_0xe4b2('0x3'));var jsonpatch=require(_0xe4b2('0x4'));var rp=require(_0xe4b2('0x5'));var moment=require(_0xe4b2('0x6'));var BPromise=require(_0xe4b2('0x7'));var Mustache=require(_0xe4b2('0x8'));var util=require(_0xe4b2('0x9'));var path=require(_0xe4b2('0xa'));var sox=require(_0xe4b2('0xb'));var csv=require(_0xe4b2('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe4b2('0xd'));var squel=require('squel');var crypto=require(_0xe4b2('0xe'));var jsforce=require(_0xe4b2('0xf'));var deskjs=require(_0xe4b2('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe4b2('0x11'));var Papa=require(_0xe4b2('0x12'));var authService=require(_0xe4b2('0x13'));var hardwareService=require(_0xe4b2('0x14'));var Redis=require(_0xe4b2('0x15'));var qs=require(_0xe4b2('0x16'));var logger=require('../../config/logger')(_0xe4b2('0x17'));var utils=require(_0xe4b2('0x18'));var config=require('../../config/environment');var db=require(_0xe4b2('0x19'))['db'];config[_0xe4b2('0x1a')]=_[_0xe4b2('0x1b')](config['redis'],{'host':_0xe4b2('0x1c'),'port':0x18eb});var socket=require(_0xe4b2('0x1d'))(new Redis(config[_0xe4b2('0x1a')]));require(_0xe4b2('0x1e'))[_0xe4b2('0x1f')](socket);function respondWithStatusCode(_0x226cd0,_0x28c84b){_0x28c84b=_0x28c84b||0xcc;return function(_0x1b5871){if(_0x1b5871){return _0x226cd0['sendStatus'](_0x28c84b);}return _0x226cd0[_0xe4b2('0x20')](_0x28c84b)['end']();};}function respondWithResult(_0x265f94,_0x597ef3){_0x597ef3=_0x597ef3||0xc8;return function(_0x2e7719){if(_0x2e7719){return _0x265f94[_0xe4b2('0x20')](_0x597ef3)[_0xe4b2('0x21')](_0x2e7719);}};}function respondWithFilteredResult(_0x5b6420,_0x579dfe){return function(_0xaa3a37){if(_0xaa3a37){var _0x3df083=_0xaa3a37[_0xe4b2('0x22')],_0x5ac885=_0x579dfe[_0xe4b2('0x23')],_0x294711=_0x579dfe['offset']+_0x579dfe[_0xe4b2('0x24')],_0x238bd1;if(_0x294711>=_0x3df083){_0x294711=_0x3df083;_0x238bd1=0xc8;}else{_0x238bd1=0xce;}_0x5b6420[_0xe4b2('0x20')](_0x238bd1);return _0x5b6420['set'](_0xe4b2('0x25'),_0x5ac885+'-'+_0x294711+'/'+_0x3df083)['json'](_0xaa3a37);}return null;};}function patchUpdates(_0x19a411){return function(_0x3089b5){try{jsonpatch[_0xe4b2('0x26')](_0x3089b5,_0x19a411,!![]);}catch(_0xc0465c){return BPromise[_0xe4b2('0x27')](_0xc0465c);}return _0x3089b5[_0xe4b2('0x28')]();};}function saveUpdates(_0x628cfd,_0x247978){return function(_0x29b6dc){if(_0x29b6dc){return _0x29b6dc[_0xe4b2('0x29')](_0x628cfd)[_0xe4b2('0x2a')](function(_0x543011){return _0x543011;});}return null;};}function removeEntity(_0x4a6b35,_0x54ac98){return function(_0x2806dd){if(_0x2806dd){return _0x2806dd[_0xe4b2('0x2b')]()[_0xe4b2('0x2a')](function(){_0x4a6b35[_0xe4b2('0x20')](0xcc)[_0xe4b2('0x2c')]();});}};}function handleEntityNotFound(_0x40cc98,_0x47496e){return function(_0x827cd1){if(!_0x827cd1){_0x40cc98[_0xe4b2('0x2d')](0x194);}return _0x827cd1;};}function handleError(_0x2581e5,_0x21ac00){_0x21ac00=_0x21ac00||0x1f4;return function(_0x3237a7){logger[_0xe4b2('0x2e')](_0x3237a7[_0xe4b2('0x2f')]);if(_0x3237a7[_0xe4b2('0x30')]){delete _0x3237a7[_0xe4b2('0x30')];}_0x2581e5[_0xe4b2('0x20')](_0x21ac00)[_0xe4b2('0x31')](_0x3237a7);};}exports[_0xe4b2('0x32')]=function(_0x5d84bf,_0x5402ee){var _0xdb3cee={},_0x108afd={},_0x32a49b={'count':0x0,'rows':[]};var _0x11adbf=db[_0xe4b2('0x33')][_0xe4b2('0x34')];_0x108afd[_0xe4b2('0x35')]=_[_0xe4b2('0x36')](_0x11adbf);_0x108afd[_0xe4b2('0x37')]=_[_0xe4b2('0x36')](_0x5d84bf[_0xe4b2('0x37')]);_0x108afd[_0xe4b2('0x38')]=_['intersection'](_0x108afd['model'],_0x108afd[_0xe4b2('0x37')]);_0xdb3cee[_0xe4b2('0x39')]=_['intersection'](_0x108afd[_0xe4b2('0x35')],qs[_0xe4b2('0x3a')](_0x5d84bf['query'][_0xe4b2('0x3a')]));_0xdb3cee[_0xe4b2('0x39')]=_0xdb3cee[_0xe4b2('0x39')]['length']?_0xdb3cee[_0xe4b2('0x39')]:_0x108afd['model'];if(!_0x5d84bf[_0xe4b2('0x37')]['hasOwnProperty'](_0xe4b2('0x3b'))){_0xdb3cee[_0xe4b2('0x24')]=qs[_0xe4b2('0x24')](_0x5d84bf[_0xe4b2('0x37')][_0xe4b2('0x24')]);_0xdb3cee[_0xe4b2('0x23')]=qs[_0xe4b2('0x23')](_0x5d84bf[_0xe4b2('0x37')][_0xe4b2('0x23')]);}_0xdb3cee[_0xe4b2('0x3c')]=qs['sort'](_0x5d84bf[_0xe4b2('0x37')][_0xe4b2('0x3d')]);_0xdb3cee['where']=qs[_0xe4b2('0x38')](_['pick'](_0x5d84bf['query'],_0x108afd['filters']));if(_0x5d84bf[_0xe4b2('0x37')]['filter']){_0xdb3cee[_0xe4b2('0x3e')]=_['merge'](_0xdb3cee[_0xe4b2('0x3e')],{'$or':_[_0xe4b2('0x3f')](_0x11adbf,function(_0x56dcb4){if(_0x56dcb4['type'][_0xe4b2('0x40')]!==_0xe4b2('0x41')){var _0x3b9b42={};_0x3b9b42[_0x56dcb4[_0xe4b2('0x42')]]={'$like':'%'+_0x5d84bf[_0xe4b2('0x37')][_0xe4b2('0x43')]+'%'};return _0x3b9b42;}})});}_0xdb3cee=_[_0xe4b2('0x44')]({},_0xdb3cee,_0x5d84bf[_0xe4b2('0x45')]);var _0x52b6c0={'where':_0xdb3cee['where']};_0x52b6c0[_0xe4b2('0x46')]=[];if(_0x5d84bf[_0xe4b2('0x37')][_0xe4b2('0x47')]){_0x52b6c0[_0xe4b2('0x46')]['push']({'model':db[_0xe4b2('0x48')],'as':'Tags','attributes':['id'],'where':{'id':_0x5d84bf[_0xe4b2('0x37')][_0xe4b2('0x47')]},'required':!![]});_0x52b6c0[_0xe4b2('0x49')]=!![];}if(_0x5d84bf[_0xe4b2('0x37')][_0xe4b2('0x4a')]){_0x52b6c0[_0xe4b2('0x46')][_0xe4b2('0x4b')]({'model':db[_0xe4b2('0x4c')],'as':_0xe4b2('0x4d'),'attributes':['id',_0xe4b2('0x4e'),_0xe4b2('0x4f'),_0xe4b2('0x4a')],'where':{'direction':'in','read':_0x5d84bf[_0xe4b2('0x37')][_0xe4b2('0x4a')]||![]},'required':!![]});_0x52b6c0['distinct']=!![];}return db[_0xe4b2('0x33')][_0xe4b2('0x22')](_0x52b6c0)[_0xe4b2('0x2a')](function(_0x485936){_0x32a49b['count']=_0x485936;if(_0x5d84bf[_0xe4b2('0x37')][_0xe4b2('0x50')]){_0xdb3cee[_0xe4b2('0x46')]=[{'model':db[_0xe4b2('0x51')],'as':_0xe4b2('0x52'),'required':![],'attributes':['id','name',_0xe4b2('0x53')]},{'model':db[_0xe4b2('0x54')],'as':_0xe4b2('0x55'),'required':![]},{'model':db[_0xe4b2('0x51')],'as':_0xe4b2('0x56'),'attributes':[_0xe4b2('0x30'),_0xe4b2('0x53'),_0xe4b2('0x57')],'required':![]},{'model':db[_0xe4b2('0x58')],'as':_0xe4b2('0x59'),'attributes':['name','key'],'required':![]},{'model':db[_0xe4b2('0x4c')],'as':_0xe4b2('0x4d'),'attributes':['id',_0xe4b2('0x4e'),_0xe4b2('0x4f'),'read'],'where':{'direction':'in','read':_0x5d84bf[_0xe4b2('0x37')][_0xe4b2('0x4a')]||![]},'required':_0x5d84bf[_0xe4b2('0x37')][_0xe4b2('0x4a')]||![]},{'model':db[_0xe4b2('0x48')],'as':_0xe4b2('0x5a'),'attributes':['id',_0xe4b2('0x30'),_0xe4b2('0x5b')],'required':_0x5d84bf[_0xe4b2('0x37')][_0xe4b2('0x47')]?!![]:![]},{'model':db[_0xe4b2('0x48')],'as':'ThroughTags','attributes':['id',_0xe4b2('0x30'),_0xe4b2('0x5b')],'through':_0x5d84bf['query'][_0xe4b2('0x47')]?{'attributes':[],'where':{'TagId':_0x5d84bf[_0xe4b2('0x37')][_0xe4b2('0x47')]||undefined}}:{},'required':_0x5d84bf['query']['tag']?!![]:![]}];}return db['FaxInteraction'][_0xe4b2('0x5c')](_0xdb3cee);})[_0xe4b2('0x2a')](function(_0x59596c){_0x32a49b[_0xe4b2('0x5d')]=_0x59596c;return _0x32a49b;})[_0xe4b2('0x2a')](respondWithFilteredResult(_0x5402ee,_0xdb3cee))[_0xe4b2('0x5e')](handleError(_0x5402ee,null));};exports[_0xe4b2('0x5f')]=function(_0x33b0fd,_0x5a8e68){var _0x45bd8c={'raw':![],'where':{'id':_0x33b0fd[_0xe4b2('0x60')]['id']}},_0xab15c9={};_0xab15c9[_0xe4b2('0x35')]=_['keys'](db['FaxInteraction'][_0xe4b2('0x34')]);_0xab15c9[_0xe4b2('0x37')]=_[_0xe4b2('0x36')](_0x33b0fd[_0xe4b2('0x37')]);_0xab15c9[_0xe4b2('0x38')]=_[_0xe4b2('0x61')](_0xab15c9['model'],_0xab15c9[_0xe4b2('0x37')]);_0x45bd8c[_0xe4b2('0x39')]=_[_0xe4b2('0x61')](_0xab15c9[_0xe4b2('0x35')],qs['fields'](_0x33b0fd['query'][_0xe4b2('0x3a')]));_0x45bd8c[_0xe4b2('0x39')]=_0x45bd8c['attributes'][_0xe4b2('0x62')]?_0x45bd8c[_0xe4b2('0x39')]:_0xab15c9[_0xe4b2('0x35')];if(_0x33b0fd[_0xe4b2('0x37')][_0xe4b2('0x50')]){_0x45bd8c[_0xe4b2('0x46')]=[{'all':!![]}];}_0x45bd8c=_[_0xe4b2('0x44')]({},_0x45bd8c,_0x33b0fd[_0xe4b2('0x45')]);return db[_0xe4b2('0x33')][_0xe4b2('0x63')](_0x45bd8c)[_0xe4b2('0x2a')](handleEntityNotFound(_0x5a8e68,null))['then'](respondWithResult(_0x5a8e68,null))[_0xe4b2('0x5e')](handleError(_0x5a8e68,null));};exports[_0xe4b2('0x64')]=function(_0x4770d6,_0x277436){return db[_0xe4b2('0x33')][_0xe4b2('0x64')](_0x4770d6[_0xe4b2('0x65')],{})['then'](respondWithResult(_0x277436,0xc9))['catch'](handleError(_0x277436,null));};exports[_0xe4b2('0x29')]=function(_0x5cd208,_0x259970){if(_0x5cd208[_0xe4b2('0x65')]['id']){delete _0x5cd208[_0xe4b2('0x65')]['id'];}return db[_0xe4b2('0x33')][_0xe4b2('0x63')]({'where':{'id':_0x5cd208['params']['id']}})[_0xe4b2('0x2a')](handleEntityNotFound(_0x259970,null))[_0xe4b2('0x2a')](saveUpdates(_0x5cd208[_0xe4b2('0x65')],null))[_0xe4b2('0x2a')](respondWithResult(_0x259970,null))[_0xe4b2('0x5e')](handleError(_0x259970,null));};exports[_0xe4b2('0x2b')]=function(_0x12ac5c,_0x4edf58){return db[_0xe4b2('0x33')][_0xe4b2('0x63')]({'where':{'id':_0x12ac5c['params']['id']}})[_0xe4b2('0x2a')](handleEntityNotFound(_0x4edf58,null))[_0xe4b2('0x2a')](removeEntity(_0x4edf58,null))[_0xe4b2('0x5e')](handleError(_0x4edf58,null));};exports[_0xe4b2('0x66')]=function(_0x108e7a,_0x59305e){return db[_0xe4b2('0x33')]['describe']()['then'](respondWithResult(_0x59305e,null))[_0xe4b2('0x5e')](handleError(_0x59305e,null));};exports[_0xe4b2('0x67')]=function(_0x3d2c83,_0x19db0a,_0x3ae25d){return db[_0xe4b2('0x4c')]['find']({'where':{'id':_0x3d2c83['params']['id']}})[_0xe4b2('0x2a')](handleEntityNotFound(_0x19db0a,null))[_0xe4b2('0x2a')](function(_0x2f7559){if(_0x2f7559){return _0x2f7559['addMessage'](_0x3d2c83[_0xe4b2('0x65')]['ids'],_[_0xe4b2('0x68')](_0x3d2c83[_0xe4b2('0x65')],[_0xe4b2('0x69'),'id'])||{});}})[_0xe4b2('0x2a')](respondWithResult(_0x19db0a,null))[_0xe4b2('0x5e')](handleError(_0x19db0a,null));};exports[_0xe4b2('0x6a')]=function(_0x427674,_0x3b100a,_0xe61c16){var _0x343a83={'raw':![],'where':{}};var _0x40c4e7={};var _0x3d52da={'count':0x0,'rows':[]};return db[_0xe4b2('0x33')]['findOne']({'where':{'id':_0x427674['params']['id']}})['then'](handleEntityNotFound(_0x3b100a,null))[_0xe4b2('0x2a')](function(_0x457983){if(_0x457983){_0x40c4e7['model']=_[_0xe4b2('0x36')](db[_0xe4b2('0x4c')][_0xe4b2('0x34')]);_0x40c4e7['query']=_['keys'](_0x427674[_0xe4b2('0x37')]);_0x40c4e7[_0xe4b2('0x38')]=_['intersection'](_0x40c4e7[_0xe4b2('0x35')],_0x40c4e7[_0xe4b2('0x37')]);_0x343a83['attributes']=_[_0xe4b2('0x61')](_0x40c4e7[_0xe4b2('0x35')],qs[_0xe4b2('0x3a')](_0x427674[_0xe4b2('0x37')]['fields']));_0x343a83[_0xe4b2('0x39')]=_0x343a83[_0xe4b2('0x39')]['length']?_0x343a83[_0xe4b2('0x39')]:_0x40c4e7[_0xe4b2('0x35')];if(!_0x427674['query'][_0xe4b2('0x6b')]('nolimit')){_0x343a83[_0xe4b2('0x24')]=qs[_0xe4b2('0x24')](_0x427674[_0xe4b2('0x37')]['limit']);_0x343a83[_0xe4b2('0x23')]=qs[_0xe4b2('0x23')](_0x427674[_0xe4b2('0x37')][_0xe4b2('0x23')]);}_0x343a83[_0xe4b2('0x3c')]=qs[_0xe4b2('0x3d')](_0x427674[_0xe4b2('0x37')]['sort']);_0x343a83[_0xe4b2('0x3e')]=qs[_0xe4b2('0x38')](_['pick'](_0x427674['query'],_0x40c4e7['filters']));_0x343a83['where'][_0xe4b2('0x6c')]=_0x457983['id'];if(_0x427674[_0xe4b2('0x37')][_0xe4b2('0x43')]){_0x343a83[_0xe4b2('0x3e')]=_[_0xe4b2('0x44')](_0x343a83['where'],{'$or':_[_0xe4b2('0x3f')](_0x343a83['attributes'],function(_0xc462a4){var _0x4be8ba={};_0x4be8ba[_0xc462a4]={'$like':'%'+_0x427674[_0xe4b2('0x37')]['filter']+'%'};return _0x4be8ba;})});}if(_0x427674[_0xe4b2('0x37')][_0xe4b2('0x6d')]){var _0x4203ad=_0x427674[_0xe4b2('0x37')][_0xe4b2('0x6d')][_0xe4b2('0x6e')](',');var _0x3f4673={};_0x3f4673[_0x4203ad[0x0]]={'$gte':moment(_0x4203ad[0x1])[_0xe4b2('0x6f')](_0xe4b2('0x70'))};_0x343a83[_0xe4b2('0x3e')]=_['merge'](_0x343a83[_0xe4b2('0x3e')],_0x3f4673);}_0x343a83=_['merge']({},_0x343a83,_0x427674['options']);return db[_0xe4b2('0x4c')][_0xe4b2('0x22')]({'where':_0x343a83[_0xe4b2('0x3e')]})['then'](function(_0x5254de){_0x3d52da[_0xe4b2('0x22')]=_0x5254de;if(_0x427674[_0xe4b2('0x37')][_0xe4b2('0x50')]){_0x343a83[_0xe4b2('0x46')]=[{'all':!![]}];}return db[_0xe4b2('0x4c')][_0xe4b2('0x5c')](_0x343a83);})[_0xe4b2('0x2a')](function(_0x476673){_0x3d52da['rows']=_0x476673;return _0x3d52da;});}})[_0xe4b2('0x2a')](respondWithFilteredResult(_0x3b100a,_0x343a83))['catch'](handleError(_0x3b100a,null));};exports[_0xe4b2('0x71')]=function(_0x58272a,_0x53e93d,_0x4994c7){return db[_0xe4b2('0x33')][_0xe4b2('0x63')]({'where':{'id':_0x58272a[_0xe4b2('0x60')]['id']}})[_0xe4b2('0x2a')](handleEntityNotFound(_0x53e93d,null))[_0xe4b2('0x2a')](function(_0x2842ee){if(_0x2842ee){return _0x2842ee['setTags'](_0x58272a['body']['ids'],_['omit'](_0x58272a[_0xe4b2('0x65')],['ids','id'])||{})[_0xe4b2('0x72')](function(){return db['Tag'][_0xe4b2('0x5c')]({'attributes':['id',_0xe4b2('0x30'),'color'],'where':{'id':_0x58272a[_0xe4b2('0x65')][_0xe4b2('0x69')]}});})[_0xe4b2('0x2a')](function(_0x337686){socket[_0xe4b2('0x73')](_0xe4b2('0x74'),{'id':Number(_0x58272a['params']['id']),'tags':_0x337686||[]});return{'id':Number(_0x58272a[_0xe4b2('0x60')]['id']),'tags':_0x337686||[]};});}})[_0xe4b2('0x2a')](respondWithResult(_0x53e93d,null))['catch'](handleError(_0x53e93d,null));};exports['removeTags']=function(_0x3c735b,_0x2e986b,_0x171d4a){var _0x5ead81;return db[_0xe4b2('0x33')][_0xe4b2('0x63')]({'where':{'id':_0x3c735b[_0xe4b2('0x60')]['id']}})[_0xe4b2('0x2a')](handleEntityNotFound(_0x2e986b,null))['then'](function(_0x57c420){if(_0x57c420){return _0x57c420[_0xe4b2('0x75')](_0x3c735b['query'][_0xe4b2('0x69')]);}})[_0xe4b2('0x2a')](respondWithStatusCode(_0x2e986b,null))['catch'](handleError(_0x2e986b,null));};exports[_0xe4b2('0x76')]=function(_0x5e1824,_0x17e2f5){var _0x2ec4aa=moment()[_0xe4b2('0x77')]()[_0xe4b2('0x78')]();var _0x34a59a=path[_0xe4b2('0x79')](config[_0xe4b2('0x7a')],_0xe4b2('0x7b'),_0xe4b2('0x7c'),_0xe4b2('0x7d'));var _0x42cbb6=path[_0xe4b2('0x79')](config[_0xe4b2('0x7a')],_0xe4b2('0x7b'),_0xe4b2('0x7c'),_0xe4b2('0x7e'));var _0x484be2=path[_0xe4b2('0x79')](_0x42cbb6,_0x2ec4aa);var _0x79f378=util[_0xe4b2('0x6f')](_0xe4b2('0x7f'),_0x2ec4aa);var _0x37a00f=path['join'](_0x42cbb6,_0x79f378);var _0x1cf5b3=![];return db[_0xe4b2('0x33')][_0xe4b2('0x63')]({'where':{'id':_0x5e1824[_0xe4b2('0x60')]['id']}})['then'](handleEntityNotFound(_0x17e2f5,null))[_0xe4b2('0x2a')](function(_0x3ea3e8){if(_0x3ea3e8){return _0x3ea3e8['getMessages']({'attributes':['id',_0xe4b2('0x65'),_0xe4b2('0x4f')],'include':[{'model':db['Attachment'],'as':_0xe4b2('0x80')}]});}return[];})['then'](function(_0x23a1dd){_0x1cf5b3=_0x23a1dd['length'];if(_0x23a1dd[_0xe4b2('0x62')]){fs[_0xe4b2('0x81')](_0x484be2);for(var _0x588e09=0x0;_0x588e09<_0x23a1dd[_0xe4b2('0x62')];_0x588e09++){var _0x2a7579=_0x23a1dd[_0x588e09];var _0x1c94ec=_0x2a7579[_0xe4b2('0x80')];if(_0x1c94ec){var _0x1072d8=path['join'](_0x34a59a,_0x1c94ec['basename']);if(fs[_0xe4b2('0x82')](_0x1072d8)){fs['createReadStream'](_0x1072d8)[_0xe4b2('0x83')](fs['createWriteStream'](path[_0xe4b2('0x79')](_0x484be2,_0x1c94ec['basename'])));}}}}})[_0xe4b2('0x2a')](function(){if(_0x1cf5b3){return new BPromise(function(_0x32a921,_0x18ad12){zipdir(_0x484be2,{'saveTo':_0x37a00f},function(_0x542d46,_0x323a25){if(_0x542d46)return _0x18ad12(_0x542d46);return _0x32a921(_0x323a25);});});}})[_0xe4b2('0x2a')](function(){if(_0x1cf5b3){return new BPromise(function(_0x46bbf0,_0x1add9f){rimraf(_0x484be2,function(_0xdf1c17){if(_0xdf1c17)_0x1add9f(_0xdf1c17);return _0x46bbf0();});});}})['then'](function(){if(_0x1cf5b3){return _0x17e2f5[_0xe4b2('0x76')](_0x37a00f,_0x79f378,function(_0x3e5999){if(_0x3e5999){console[_0xe4b2('0x84')](_0xe4b2('0x85'),_0x3e5999);}else{fs[_0xe4b2('0x86')](_0x37a00f);}});}else{return _0x17e2f5['sendStatus'](0xc8);}})[_0xe4b2('0x5e')](handleError(_0x17e2f5,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index e308875..217283b 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 _0xb9be=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xb9be,0xc5));var _0xeb9b=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0xb9be[_0x100682];return _0xcb6e87;};'use strict';var EventEmitter=require(_0xeb9b('0x0'));var FaxInteraction=require(_0xeb9b('0x1'))['db'][_0xeb9b('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xeb9b('0x3')](0x0);var events={'afterCreate':_0xeb9b('0x4'),'afterUpdate':_0xeb9b('0x5'),'afterDestroy':_0xeb9b('0x6')};function emitEvent(_0x2003d4){return function(_0x288aaa,_0x579a7e,_0x5006b8){FaxInteractionEvents[_0xeb9b('0x7')](_0x2003d4+':'+_0x288aaa['id'],_0x288aaa);FaxInteractionEvents[_0xeb9b('0x7')](_0x2003d4,_0x288aaa);_0x5006b8(null);};}for(var e in events){if(events[_0xeb9b('0x8')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xeb9b('0x9')]=FaxInteractionEvents; \ No newline at end of file +var _0x34b7=['exports','FaxInteraction','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1653b1,_0x35b7d1){var _0x3e0b17=function(_0x5f21fc){while(--_0x5f21fc){_0x1653b1['push'](_0x1653b1['shift']());}};_0x3e0b17(++_0x35b7d1);}(_0x34b7,0x196));var _0x734b=function(_0x251895,_0x414adb){_0x251895=_0x251895-0x0;var _0x70b2dd=_0x34b7[_0x251895];return _0x70b2dd;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db'][_0x734b('0x0')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x734b('0x1')](0x0);var events={'afterCreate':_0x734b('0x2'),'afterUpdate':_0x734b('0x3'),'afterDestroy':_0x734b('0x4')};function emitEvent(_0x2993c6){return function(_0x5de1ae,_0x547652,_0x303067){FaxInteractionEvents[_0x734b('0x5')](_0x2993c6+':'+_0x5de1ae['id'],_0x5de1ae);FaxInteractionEvents[_0x734b('0x5')](_0x2993c6,_0x5de1ae);_0x303067(null);};}for(var e in events){if(events[_0x734b('0x6')](e)){var event=events[e];FaxInteraction[_0x734b('0x7')](e,emitEvent(event));}}module[_0x734b('0x8')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index db438d1..6f0b15b 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 _0xa9e0=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','./faxInteraction.attributes','exports','define','fax_interactions','closed'];(function(_0x13a313,_0x88eaa2){var _0x1d6ad7=function(_0x49a0fc){while(--_0x49a0fc){_0x13a313['push'](_0x13a313['shift']());}};_0x1d6ad7(++_0x88eaa2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var attributes=require(_0x0a9e('0x4'));module[_0x0a9e('0x5')]=function(_0x2ab90b,_0x991246){return _0x2ab90b[_0x0a9e('0x6')]('FaxInteraction',attributes,{'tableName':_0x0a9e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x441e3a,_0x2cc193,_0x5f41ea){if(_0x441e3a['changed'](_0x0a9e('0x8'))){_0x441e3a['closedAt']=moment()['format'](_0x0a9e('0x9'));}_0x5f41ea(null,_0x441e3a);}}});}; \ No newline at end of file +var _0xa9e0=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','./faxInteraction.attributes','exports','define','fax_interactions','closed'];(function(_0x337dcf,_0x4324a9){var _0x5ea3c2=function(_0x4512be){while(--_0x4512be){_0x337dcf['push'](_0x337dcf['shift']());}};_0x5ea3c2(++_0x4324a9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var attributes=require(_0x0a9e('0x4'));module[_0x0a9e('0x5')]=function(_0x2ab90b,_0x991246){return _0x2ab90b[_0x0a9e('0x6')]('FaxInteraction',attributes,{'tableName':_0x0a9e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x441e3a,_0x2cc193,_0x5f41ea){if(_0x441e3a['changed'](_0x0a9e('0x8'))){_0x441e3a['closedAt']=moment()['format'](_0x0a9e('0x9'));}_0x5f41ea(null,_0x441e3a);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index d86ce6a..1a63e3b 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 _0x0595=['./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','where','limit','stringify','AddTagsToFaxInteraction','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0595,0x1a7));var _0x5059=function(_0x526e52,_0x49a176){_0x526e52=_0x526e52-0x0;var _0xc81ae7=_0x0595[_0x526e52];return _0xc81ae7;};'use strict';var _=require(_0x5059('0x0'));var util=require(_0x5059('0x1'));var moment=require('moment');var BPromise=require(_0x5059('0x2'));var rs=require(_0x5059('0x3'));var fs=require('fs');var Redis=require(_0x5059('0x4'));var db=require(_0x5059('0x5'))['db'];var utils=require(_0x5059('0x6'));var logger=require(_0x5059('0x7'))(_0x5059('0x8'));var config=require(_0x5059('0x9'));var jayson=require(_0x5059('0xa'));var client=jayson[_0x5059('0xb')][_0x5059('0xc')]({'port':0x232a});config[_0x5059('0xd')]=_[_0x5059('0xe')](config[_0x5059('0xd')],{'host':_0x5059('0xf'),'port':0x18eb});var socket=require(_0x5059('0x10'))(new Redis(config[_0x5059('0xd')]));require(_0x5059('0x11'))[_0x5059('0x12')](socket);function respondWithRpcPromise(_0x585297,_0x3bb242,_0x50fad7){return new BPromise(function(_0x5d7bac,_0x3ab856){return client[_0x5059('0x13')](_0x585297,_0x50fad7)[_0x5059('0x14')](function(_0x51c682){logger[_0x5059('0x15')](_0x5059('0x16'),_0x3bb242,_0x5059('0x17'));logger[_0x5059('0x18')](_0x5059('0x19'),_0x3bb242,_0x5059('0x17'),JSON['stringify'](_0x51c682));if(_0x51c682[_0x5059('0x1a')]){if(_0x51c682[_0x5059('0x1a')][_0x5059('0x1b')]===0x1f4){logger['error'](_0x5059('0x16'),_0x3bb242,_0x51c682['error'][_0x5059('0x1c')]);return _0x3ab856(_0x51c682['error'][_0x5059('0x1c')]);}logger[_0x5059('0x1a')]('FaxInteraction,\x20%s,\x20%s',_0x3bb242,_0x51c682[_0x5059('0x1a')][_0x5059('0x1c')]);return _0x5d7bac(_0x51c682[_0x5059('0x1a')][_0x5059('0x1c')]);}else{logger[_0x5059('0x15')](_0x5059('0x16'),_0x3bb242,_0x5059('0x17'));_0x5d7bac(_0x51c682[_0x5059('0x1d')][_0x5059('0x1c')]);}})[_0x5059('0x1e')](function(_0x4b8a76){logger[_0x5059('0x1a')](_0x5059('0x16'),_0x3bb242,_0x4b8a76);_0x3ab856(_0x4b8a76);});});}exports[_0x5059('0x1f')]=function(_0x592828){var _0x1b047e=this;return new Promise(function(_0x16a2b9,_0xef85a6){return db[_0x5059('0x20')][_0x5059('0x21')](_0x592828[_0x5059('0x22')],{'raw':_0x592828[_0x5059('0x23')]?_0x592828[_0x5059('0x23')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x592828[_0x5059('0x23')]?_0x592828[_0x5059('0x23')][_0x5059('0x24')]||null:null,'attributes':_0x592828[_0x5059('0x23')]?_0x592828[_0x5059('0x23')]['attributes']||null:null,'limit':_0x592828[_0x5059('0x23')]?_0x592828[_0x5059('0x23')][_0x5059('0x25')]||null:null})[_0x5059('0x14')](function(_0x1d2867){logger[_0x5059('0x15')](_0x5059('0x1f'),_0x592828);logger[_0x5059('0x18')](_0x5059('0x1f'),_0x592828,JSON[_0x5059('0x26')](_0x1d2867));_0x16a2b9(_0x1d2867);})[_0x5059('0x1e')](function(_0x1745f2){logger[_0x5059('0x1a')](_0x5059('0x1f'),_0x1745f2[_0x5059('0x1c')],_0x592828);_0xef85a6(_0x1b047e[_0x5059('0x1a')](0x1f4,_0x1745f2[_0x5059('0x1c')]));});});};exports[_0x5059('0x27')]=function(_0x491d3d){return new Promise(function(_0x2cd555,_0x279e3c){return db[_0x5059('0x20')]['find']({'where':_0x491d3d['options']?_0x491d3d[_0x5059('0x23')]['where']||null:null})[_0x5059('0x14')](function(_0x301a03){if(_0x301a03){return _0x301a03['addTags'](_0x491d3d[_0x5059('0x22')][_0x5059('0x28')],_[_0x5059('0x29')](_0x491d3d[_0x5059('0x22')],[_0x5059('0x28'),'id'])||{});}})[_0x5059('0x2a')](function(_0x299a76){logger[_0x5059('0x15')]('AddTags',_0x491d3d);logger[_0x5059('0x18')](_0x5059('0x2b'),_0x491d3d,JSON[_0x5059('0x26')](_0x299a76));_0x2cd555(_0x299a76);})[_0x5059('0x1e')](function(_0x90c85f){logger[_0x5059('0x1a')](_0x5059('0x2b'),_0x90c85f['message'],_0x491d3d);_0x279e3c(_this[_0x5059('0x1a')](0x1f4,_0x90c85f['message']));});});}; \ No newline at end of file +var _0x3706=['info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','FaxInteraction','update','body','options','where','attributes','then','UpdateFaxInteraction','catch','AddTagsToFaxInteraction','addTags','ids','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./faxInteraction.socket','register','request'];(function(_0x120982,_0x57475c){var _0x537ccd=function(_0x584fe5){while(--_0x584fe5){_0x120982['push'](_0x120982['shift']());}};_0x537ccd(++_0x57475c);}(_0x3706,0x137));var _0x6370=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0x3706[_0x5d4f12];return _0x4eb577;};'use strict';var _=require(_0x6370('0x0'));var util=require('util');var moment=require(_0x6370('0x1'));var BPromise=require(_0x6370('0x2'));var rs=require(_0x6370('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6370('0x4'))['db'];var utils=require(_0x6370('0x5'));var logger=require(_0x6370('0x6'))(_0x6370('0x7'));var config=require(_0x6370('0x8'));var jayson=require(_0x6370('0x9'));var client=jayson['client'][_0x6370('0xa')]({'port':0x232a});config[_0x6370('0xb')]=_[_0x6370('0xc')](config['redis'],{'host':_0x6370('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6370('0xb')]));require(_0x6370('0xe'))[_0x6370('0xf')](socket);function respondWithRpcPromise(_0x5bd054,_0x518adf,_0x4e31cd){return new BPromise(function(_0x53c586,_0x2f0650){return client[_0x6370('0x10')](_0x5bd054,_0x4e31cd)['then'](function(_0x1a4c01){logger[_0x6370('0x11')](_0x6370('0x12'),_0x518adf,_0x6370('0x13'));logger[_0x6370('0x14')](_0x6370('0x15'),_0x518adf,_0x6370('0x13'),JSON[_0x6370('0x16')](_0x1a4c01));if(_0x1a4c01[_0x6370('0x17')]){if(_0x1a4c01[_0x6370('0x17')][_0x6370('0x18')]===0x1f4){logger[_0x6370('0x17')](_0x6370('0x12'),_0x518adf,_0x1a4c01[_0x6370('0x17')][_0x6370('0x19')]);return _0x2f0650(_0x1a4c01[_0x6370('0x17')][_0x6370('0x19')]);}logger[_0x6370('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x518adf,_0x1a4c01['error'][_0x6370('0x19')]);return _0x53c586(_0x1a4c01[_0x6370('0x17')]['message']);}else{logger[_0x6370('0x11')](_0x6370('0x12'),_0x518adf,_0x6370('0x13'));_0x53c586(_0x1a4c01[_0x6370('0x1a')]['message']);}})['catch'](function(_0x510192){logger[_0x6370('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x518adf,_0x510192);_0x2f0650(_0x510192);});});}exports['UpdateFaxInteraction']=function(_0x1f0679){var _0x41658c=this;return new Promise(function(_0xc4d9aa,_0x29e580){return db[_0x6370('0x1b')][_0x6370('0x1c')](_0x1f0679[_0x6370('0x1d')],{'raw':_0x1f0679[_0x6370('0x1e')]?_0x1f0679[_0x6370('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f0679[_0x6370('0x1e')]?_0x1f0679['options'][_0x6370('0x1f')]||null:null,'attributes':_0x1f0679[_0x6370('0x1e')]?_0x1f0679[_0x6370('0x1e')][_0x6370('0x20')]||null:null,'limit':_0x1f0679[_0x6370('0x1e')]?_0x1f0679[_0x6370('0x1e')]['limit']||null:null})[_0x6370('0x21')](function(_0x37a52a){logger[_0x6370('0x11')](_0x6370('0x22'),_0x1f0679);logger[_0x6370('0x14')](_0x6370('0x22'),_0x1f0679,JSON['stringify'](_0x37a52a));_0xc4d9aa(_0x37a52a);})[_0x6370('0x23')](function(_0x519039){logger[_0x6370('0x17')](_0x6370('0x22'),_0x519039['message'],_0x1f0679);_0x29e580(_0x41658c[_0x6370('0x17')](0x1f4,_0x519039[_0x6370('0x19')]));});});};exports[_0x6370('0x24')]=function(_0x49b7ca){return new Promise(function(_0x5e0281,_0x34408a){return db[_0x6370('0x1b')]['find']({'where':_0x49b7ca[_0x6370('0x1e')]?_0x49b7ca[_0x6370('0x1e')]['where']||null:null})[_0x6370('0x21')](function(_0x6b3876){if(_0x6b3876){return _0x6b3876[_0x6370('0x25')](_0x49b7ca[_0x6370('0x1d')][_0x6370('0x26')],_['omit'](_0x49b7ca[_0x6370('0x1d')],['ids','id'])||{});}})[_0x6370('0x27')](function(_0x32fe02){logger[_0x6370('0x11')](_0x6370('0x28'),_0x49b7ca);logger[_0x6370('0x14')](_0x6370('0x28'),_0x49b7ca,JSON[_0x6370('0x16')](_0x32fe02));_0x5e0281(_0x32fe02);})[_0x6370('0x23')](function(_0xd5811f){logger[_0x6370('0x17')](_0x6370('0x28'),_0xd5811f[_0x6370('0x19')],_0x49b7ca);_0x34408a(_this[_0x6370('0x17')](0x1f4,_0xd5811f['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index be98003..a9fe368 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 _0x8686=['removeListener','register','faxInteraction:','./faxInteraction.events','save','remove','emit'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0x8686,0xea));var _0x6868=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0x8686[_0x2ed8f3];return _0x525a55;};'use strict';var FaxInteractionEvents=require(_0x6868('0x0'));var events=[_0x6868('0x1'),_0x6868('0x2'),'update'];function createListener(_0x2cc7fc,_0xd1f675){return function(_0x2afc63){_0xd1f675[_0x6868('0x3')](_0x2cc7fc,_0x2afc63);};}function removeListener(_0x3b5817,_0xa06af1){return function(){FaxInteractionEvents[_0x6868('0x4')](_0x3b5817,_0xa06af1);};}exports[_0x6868('0x5')]=function(_0x3c538e){for(var _0x1748d0=0x0,_0x543613=events['length'];_0x1748d0<_0x543613;_0x1748d0++){var _0x2854d4=events[_0x1748d0];var _0x263e41=createListener(_0x6868('0x6')+_0x2854d4,_0x3c538e);FaxInteractionEvents['on'](_0x2854d4,_0x263e41);}}; \ No newline at end of file +var _0x904a=['removeListener','register','length','faxInteraction:','./faxInteraction.events','remove','emit'];(function(_0x708839,_0x59c079){var _0x5e40c1=function(_0x44108d){while(--_0x44108d){_0x708839['push'](_0x708839['shift']());}};_0x5e40c1(++_0x59c079);}(_0x904a,0x1a8));var _0xa904=function(_0x5d5898,_0x363773){_0x5d5898=_0x5d5898-0x0;var _0x17166a=_0x904a[_0x5d5898];return _0x17166a;};'use strict';var FaxInteractionEvents=require(_0xa904('0x0'));var events=['save',_0xa904('0x1'),'update'];function createListener(_0x1b2ae3,_0x104e7e){return function(_0x181079){_0x104e7e[_0xa904('0x2')](_0x1b2ae3,_0x181079);};}function removeListener(_0x5b7979,_0xd7c9cc){return function(){FaxInteractionEvents[_0xa904('0x3')](_0x5b7979,_0xd7c9cc);};}exports[_0xa904('0x4')]=function(_0x199874){for(var _0x187495=0x0,_0x506f35=events[_0xa904('0x5')];_0x187495<_0x506f35;_0x187495++){var _0x459939=events[_0x187495];var _0x32147f=createListener(_0xa904('0x6')+_0x459939,_0x199874);FaxInteractionEvents['on'](_0x459939,_0x32147f);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 28fad04..378eed7 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 _0x57b6=['post','create','/:id/messages','tracked','fax','faxinteraction:addtags','faxinteraction:update','update','delete','/:id','faxinteraction:destroy','destroy','/:id/tags','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','/describe','describe','show','getMessages','/:id/download','download'];(function(_0x55c253,_0x59f0d8){var _0x3123f1=function(_0x2e63d4){while(--_0x2e63d4){_0x55c253['push'](_0x55c253['shift']());}};_0x3123f1(++_0x59f0d8);}(_0x57b6,0x12f));var _0x657b=function(_0xbb3ccc,_0x38dee5){_0xbb3ccc=_0xbb3ccc-0x0;var _0x1535c4=_0x57b6[_0xbb3ccc];return _0x1535c4;};'use strict';var multer=require('multer');var util=require(_0x657b('0x0'));var path=require(_0x657b('0x1'));var timeout=require(_0x657b('0x2'));var express=require(_0x657b('0x3'));var router=express[_0x657b('0x4')]();var auth=require(_0x657b('0x5'));var interaction=require(_0x657b('0x6'));var config=require('../../config/environment');var controller=require(_0x657b('0x7'));router[_0x657b('0x8')]('/',auth[_0x657b('0x9')](),controller['index']);router[_0x657b('0x8')](_0x657b('0xa'),auth[_0x657b('0x9')](),controller[_0x657b('0xb')]);router[_0x657b('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x657b('0xc')]);router[_0x657b('0x8')]('/:id/messages',auth[_0x657b('0x9')](),controller[_0x657b('0xd')]);router[_0x657b('0x8')](_0x657b('0xe'),auth['isAuthenticated'](),controller[_0x657b('0xf')]);router[_0x657b('0x10')]('/',auth[_0x657b('0x9')](),controller[_0x657b('0x11')]);router['post'](_0x657b('0x12'),auth['isAuthenticated'](),controller['addMessage']);router[_0x657b('0x10')]('/:id/tags',auth[_0x657b('0x9')](),interaction[_0x657b('0x13')](_0x657b('0x14'),_0x657b('0x15')),controller['addTags']);router['put']('/:id',auth[_0x657b('0x9')](),interaction['tracked'](_0x657b('0x14'),_0x657b('0x16')),controller[_0x657b('0x17')]);router[_0x657b('0x18')](_0x657b('0x19'),auth[_0x657b('0x9')](),interaction['tracked'](_0x657b('0x14'),_0x657b('0x1a')),controller[_0x657b('0x1b')]);router[_0x657b('0x18')](_0x657b('0x1c'),auth[_0x657b('0x9')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x04dd=['/:id','faxinteraction:destroy','destroy','/:id/tags','removeTags','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','tracked','fax','addTags','put','faxinteraction:update','delete'];(function(_0x6aa0c1,_0x42d1cc){var _0x29d432=function(_0x57a7a5){while(--_0x57a7a5){_0x6aa0c1['push'](_0x6aa0c1['shift']());}};_0x29d432(++_0x42d1cc);}(_0x04dd,0x18b));var _0xd04d=function(_0x52fe08,_0x529536){_0x52fe08=_0x52fe08-0x0;var _0x506424=_0x04dd[_0x52fe08];return _0x506424;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd04d('0x0'));var timeout=require('connect-timeout');var express=require(_0xd04d('0x1'));var router=express[_0xd04d('0x2')]();var auth=require(_0xd04d('0x3'));var interaction=require(_0xd04d('0x4'));var config=require(_0xd04d('0x5'));var controller=require(_0xd04d('0x6'));router[_0xd04d('0x7')]('/',auth[_0xd04d('0x8')](),controller[_0xd04d('0x9')]);router[_0xd04d('0x7')](_0xd04d('0xa'),auth[_0xd04d('0x8')](),controller[_0xd04d('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd04d('0xc')]);router[_0xd04d('0x7')](_0xd04d('0xd'),auth[_0xd04d('0x8')](),controller[_0xd04d('0xe')]);router[_0xd04d('0x7')](_0xd04d('0xf'),auth[_0xd04d('0x8')](),controller['download']);router[_0xd04d('0x10')]('/',auth[_0xd04d('0x8')](),controller[_0xd04d('0x11')]);router[_0xd04d('0x10')](_0xd04d('0xd'),auth['isAuthenticated'](),controller[_0xd04d('0x12')]);router[_0xd04d('0x10')]('/:id/tags',auth[_0xd04d('0x8')](),interaction[_0xd04d('0x13')](_0xd04d('0x14'),'faxinteraction:addtags'),controller[_0xd04d('0x15')]);router[_0xd04d('0x16')]('/:id',auth[_0xd04d('0x8')](),interaction[_0xd04d('0x13')](_0xd04d('0x14'),_0xd04d('0x17')),controller['update']);router[_0xd04d('0x18')](_0xd04d('0x19'),auth['isAuthenticated'](),interaction['tracked'](_0xd04d('0x14'),_0xd04d('0x1a')),controller[_0xd04d('0x1b')]);router[_0xd04d('0x18')](_0xd04d('0x1c'),auth[_0xd04d('0x8')](),controller[_0xd04d('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 7bef370..6d16576 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 _0x8ead=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT','medium'];(function(_0x264545,_0x5317fb){var _0x3646b2=function(_0xc51042){while(--_0xc51042){_0x264545['push'](_0x264545['shift']());}};_0x3646b2(++_0x5317fb);}(_0x8ead,0x1c4));var _0xd8ea=function(_0x1751a3,_0x51d232){_0x1751a3=_0x1751a3-0x0;var _0xd0d843=_0x8ead[_0x1751a3];return _0xd0d843;};'use strict';var Sequelize=require(_0xd8ea('0x0'));module[_0xd8ea('0x1')]={'body':{'type':Sequelize[_0xd8ea('0x2')](_0xd8ea('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xd8ea('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd8ea('0x5')]('in',_0xd8ea('0x6')),'defaultValue':_0xd8ea('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xd8ea('0x7')]}}; \ No newline at end of file +var _0xf05b=['ENUM','out','TEXT','sequelize','exports','BOOLEAN'];(function(_0x4c56b6,_0x239082){var _0x1ee73a=function(_0x43687e){while(--_0x43687e){_0x4c56b6['push'](_0x4c56b6['shift']());}};_0x1ee73a(++_0x239082);}(_0xf05b,0xbd));var _0xbf05=function(_0x4e8ff6,_0x482b24){_0x4e8ff6=_0x4e8ff6-0x0;var _0x302d2e=_0xf05b[_0x4e8ff6];return _0x302d2e;};'use strict';var Sequelize=require(_0xbf05('0x0'));module[_0xbf05('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xbf05('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbf05('0x3')]('in',_0xbf05('0x4')),'defaultValue':_0xbf05('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xbf05('0x5')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 2ac8e89..4e6c345 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 _0x805c=['../../config/logger','api','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','catch','sendStatus','status','json','count','offset','limit','set','apply','save','destroy','end','stack','name','index','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','map','type','field','merge','options','FaxMessage','includeAll','include','findAll','rows','show','params','rawAttributes','update','body','describe','fax-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','find','CmContact','Contact','get','FaxInteraction','FaxInteractionId','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','fax','RejectMessage','SIP/%s','rejectmessage','create','findOne','ContactId','isNil','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs'];(function(_0x121108,_0x15d321){var _0x39e996=function(_0x44b9bf){while(--_0x44b9bf){_0x121108['push'](_0x121108['shift']());}};_0x39e996(++_0x15d321);}(_0x805c,0x170));var _0xc805=function(_0x511344,_0x4dbc27){_0x511344=_0x511344-0x0;var _0x2124bb=_0x805c[_0x511344];return _0x2124bb;};'use strict';var pdf=require(_0xc805('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc805('0x1'));var jsonpatch=require(_0xc805('0x2'));var rp=require(_0xc805('0x3'));var moment=require(_0xc805('0x4'));var BPromise=require(_0xc805('0x5'));var Mustache=require(_0xc805('0x6'));var util=require(_0xc805('0x7'));var path=require(_0xc805('0x8'));var sox=require(_0xc805('0x9'));var csv=require(_0xc805('0xa'));var ejs=require(_0xc805('0xb'));var fs=require('fs');var _=require(_0xc805('0xc'));var squel=require(_0xc805('0xd'));var crypto=require(_0xc805('0xe'));var jsforce=require(_0xc805('0xf'));var deskjs=require(_0xc805('0x10'));var toCsv=require(_0xc805('0xa'));var querystring=require(_0xc805('0x11'));var Papa=require(_0xc805('0x12'));var authService=require('../../components/auth/service');var hardwareService=require(_0xc805('0x13'));var Redis=require(_0xc805('0x14'));var qs=require(_0xc805('0x15'));var logger=require(_0xc805('0x16'))(_0xc805('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xc805('0x18')]=_['defaults'](config[_0xc805('0x18')],{'host':_0xc805('0x19'),'port':0x18eb});var socket=require(_0xc805('0x1a'))(new Redis(config[_0xc805('0x18')]));require('./faxMessage.socket')[_0xc805('0x1b')](socket);var jayson=require(_0xc805('0x1c'));var client=jayson[_0xc805('0x1d')][_0xc805('0x1e')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53d56d,_0x1b863d,_0xfd0b2a,_0x52b4b6){return new BPromise(function(_0x4fed80,_0x444d7b){var _0x1671e1=_0x52b4b6||client;return _0x1671e1[_0xc805('0x1f')](_0x53d56d,_0xfd0b2a)[_0xc805('0x20')](function(_0x175279){logger['info'](_0xc805('0x21'),_0x1b863d,'request\x20sent');logger[_0xc805('0x22')](_0xc805('0x23'),_0x1b863d,'request\x20sent',JSON[_0xc805('0x24')](_0x175279));if(_0x175279['error']){if(_0x175279[_0xc805('0x25')]['code']===0x1f4){logger[_0xc805('0x25')](_0xc805('0x21'),_0x1b863d,_0x175279[_0xc805('0x25')]['message']);return _0x444d7b(_0x175279[_0xc805('0x25')][_0xc805('0x26')]);}logger[_0xc805('0x25')](_0xc805('0x21'),_0x1b863d,_0x175279['error'][_0xc805('0x26')]);return _0x4fed80(_0x175279[_0xc805('0x25')][_0xc805('0x26')]);}else{logger[_0xc805('0x27')](_0xc805('0x21'),_0x1b863d,_0xc805('0x28'));_0x4fed80(_0x175279['result'][_0xc805('0x26')]);}})[_0xc805('0x29')](function(_0x36ff6d){logger[_0xc805('0x25')](_0xc805('0x21'),_0x1b863d,_0x36ff6d);_0x444d7b(_0x36ff6d);});});}function respondWithStatusCode(_0x2a81a3,_0x5c19cd){_0x5c19cd=_0x5c19cd||0xcc;return function(_0x2c93c6){if(_0x2c93c6){return _0x2a81a3[_0xc805('0x2a')](_0x5c19cd);}return _0x2a81a3[_0xc805('0x2b')](_0x5c19cd)['end']();};}function respondWithResult(_0x52f9ad,_0x5b6a5a){_0x5b6a5a=_0x5b6a5a||0xc8;return function(_0x5f2a23){if(_0x5f2a23){return _0x52f9ad[_0xc805('0x2b')](_0x5b6a5a)[_0xc805('0x2c')](_0x5f2a23);}};}function respondWithFilteredResult(_0x1fda74,_0x1a40e3){return function(_0x38c2d2){if(_0x38c2d2){var _0x15932d=_0x38c2d2[_0xc805('0x2d')],_0x412634=_0x1a40e3[_0xc805('0x2e')],_0x43ea97=_0x1a40e3['offset']+_0x1a40e3[_0xc805('0x2f')],_0x16c15c;if(_0x43ea97>=_0x15932d){_0x43ea97=_0x15932d;_0x16c15c=0xc8;}else{_0x16c15c=0xce;}_0x1fda74[_0xc805('0x2b')](_0x16c15c);return _0x1fda74[_0xc805('0x30')]('Content-Range',_0x412634+'-'+_0x43ea97+'/'+_0x15932d)['json'](_0x38c2d2);}return null;};}function patchUpdates(_0x20cc6d){return function(_0x15d9f9){try{jsonpatch[_0xc805('0x31')](_0x15d9f9,_0x20cc6d,!![]);}catch(_0xedb44a){return BPromise['reject'](_0xedb44a);}return _0x15d9f9[_0xc805('0x32')]();};}function saveUpdates(_0x5f130c,_0x5e2e5f){return function(_0x41e631){if(_0x41e631){return _0x41e631['update'](_0x5f130c)[_0xc805('0x20')](function(_0x21e628){return _0x21e628;});}return null;};}function removeEntity(_0x3ca672,_0x3b47c3){return function(_0x5176a6){if(_0x5176a6){return _0x5176a6[_0xc805('0x33')]()['then'](function(){_0x3ca672[_0xc805('0x2b')](0xcc)[_0xc805('0x34')]();});}};}function handleEntityNotFound(_0x115c48,_0x393a7c){return function(_0x5997d4){if(!_0x5997d4){_0x115c48[_0xc805('0x2a')](0x194);}return _0x5997d4;};}function handleError(_0x4df429,_0x109961){_0x109961=_0x109961||0x1f4;return function(_0x4866bc){logger['error'](_0x4866bc[_0xc805('0x35')]);if(_0x4866bc[_0xc805('0x36')]){delete _0x4866bc[_0xc805('0x36')];}_0x4df429[_0xc805('0x2b')](_0x109961)['send'](_0x4866bc);};}exports[_0xc805('0x37')]=function(_0x34706d,_0x1c074d){var _0x4021b8={},_0x36f9ed={},_0x42fb2a={'count':0x0,'rows':[]};var _0x5a4dc1=db['FaxMessage']['rawAttributes'];_0x36f9ed[_0xc805('0x38')]=_[_0xc805('0x39')](_0x5a4dc1);_0x36f9ed[_0xc805('0x3a')]=_[_0xc805('0x39')](_0x34706d[_0xc805('0x3a')]);_0x36f9ed['filters']=_['intersection'](_0x36f9ed[_0xc805('0x38')],_0x36f9ed['query']);_0x4021b8[_0xc805('0x3b')]=_['intersection'](_0x36f9ed['model'],qs['fields'](_0x34706d[_0xc805('0x3a')][_0xc805('0x3c')]));_0x4021b8[_0xc805('0x3b')]=_0x4021b8[_0xc805('0x3b')][_0xc805('0x3d')]?_0x4021b8[_0xc805('0x3b')]:_0x36f9ed[_0xc805('0x38')];if(!_0x34706d[_0xc805('0x3a')][_0xc805('0x3e')](_0xc805('0x3f'))){_0x4021b8['limit']=qs['limit'](_0x34706d[_0xc805('0x3a')][_0xc805('0x2f')]);_0x4021b8[_0xc805('0x2e')]=qs[_0xc805('0x2e')](_0x34706d[_0xc805('0x3a')][_0xc805('0x2e')]);}_0x4021b8[_0xc805('0x40')]=qs['sort'](_0x34706d[_0xc805('0x3a')][_0xc805('0x41')]);_0x4021b8[_0xc805('0x42')]=qs['filters'](_['pick'](_0x34706d[_0xc805('0x3a')],_0x36f9ed[_0xc805('0x43')]));if(_0x34706d[_0xc805('0x3a')][_0xc805('0x44')]){_0x4021b8[_0xc805('0x42')]=_['merge'](_0x4021b8[_0xc805('0x42')],{'$or':_[_0xc805('0x45')](_0x5a4dc1,function(_0x1105bd){if(_0x1105bd[_0xc805('0x46')]['key']!=='VIRTUAL'){var _0x3b00a8={};_0x3b00a8[_0x1105bd[_0xc805('0x47')]]={'$like':'%'+_0x34706d[_0xc805('0x3a')][_0xc805('0x44')]+'%'};return _0x3b00a8;}})});}_0x4021b8=_[_0xc805('0x48')]({},_0x4021b8,_0x34706d[_0xc805('0x49')]);var _0x2de47e={'where':_0x4021b8[_0xc805('0x42')]};return db[_0xc805('0x4a')]['count'](_0x2de47e)[_0xc805('0x20')](function(_0x308913){_0x42fb2a[_0xc805('0x2d')]=_0x308913;if(_0x34706d[_0xc805('0x3a')][_0xc805('0x4b')]){_0x4021b8[_0xc805('0x4c')]=[{'all':!![]}];}return db[_0xc805('0x4a')][_0xc805('0x4d')](_0x4021b8);})[_0xc805('0x20')](function(_0x500617){_0x42fb2a[_0xc805('0x4e')]=_0x500617;return _0x42fb2a;})['then'](respondWithFilteredResult(_0x1c074d,_0x4021b8))[_0xc805('0x29')](handleError(_0x1c074d,null));};exports[_0xc805('0x4f')]=function(_0x451797,_0x59ed7f){var _0x433690={'raw':!![],'where':{'id':_0x451797[_0xc805('0x50')]['id']}},_0x36e1ac={};_0x36e1ac['model']=_[_0xc805('0x39')](db[_0xc805('0x4a')][_0xc805('0x51')]);_0x36e1ac[_0xc805('0x3a')]=_[_0xc805('0x39')](_0x451797[_0xc805('0x3a')]);_0x36e1ac['filters']=_['intersection'](_0x36e1ac[_0xc805('0x38')],_0x36e1ac[_0xc805('0x3a')]);_0x433690[_0xc805('0x3b')]=_['intersection'](_0x36e1ac[_0xc805('0x38')],qs[_0xc805('0x3c')](_0x451797[_0xc805('0x3a')]['fields']));_0x433690[_0xc805('0x3b')]=_0x433690[_0xc805('0x3b')][_0xc805('0x3d')]?_0x433690['attributes']:_0x36e1ac[_0xc805('0x38')];if(_0x451797['query'][_0xc805('0x4b')]){_0x433690[_0xc805('0x4c')]=[{'all':!![]}];}_0x433690=_[_0xc805('0x48')]({},_0x433690,_0x451797[_0xc805('0x49')]);return db[_0xc805('0x4a')]['find'](_0x433690)['then'](handleEntityNotFound(_0x59ed7f,null))[_0xc805('0x20')](respondWithResult(_0x59ed7f,null))['catch'](handleError(_0x59ed7f,null));};exports[_0xc805('0x52')]=function(_0x189a30,_0x3e4b41){if(_0x189a30['body']['id']){delete _0x189a30[_0xc805('0x53')]['id'];}return db[_0xc805('0x4a')]['find']({'where':{'id':_0x189a30[_0xc805('0x50')]['id']}})[_0xc805('0x20')](handleEntityNotFound(_0x3e4b41,null))[_0xc805('0x20')](saveUpdates(_0x189a30[_0xc805('0x53')],null))['then'](respondWithResult(_0x3e4b41,null))[_0xc805('0x29')](handleError(_0x3e4b41,null));};exports[_0xc805('0x33')]=function(_0x30a3be,_0x2a8625){return db[_0xc805('0x4a')]['find']({'where':{'id':_0x30a3be['params']['id']}})[_0xc805('0x20')](handleEntityNotFound(_0x2a8625,null))[_0xc805('0x20')](removeEntity(_0x2a8625,null))[_0xc805('0x29')](handleError(_0x2a8625,null));};exports[_0xc805('0x54')]=function(_0x1ef631,_0x243840){return db[_0xc805('0x4a')][_0xc805('0x54')]()['then'](respondWithResult(_0x243840,null))[_0xc805('0x29')](handleError(_0x243840,null));};var interaction_log=require(_0xc805('0x16'))(_0xc805('0x55'));exports[_0xc805('0x56')]=function(_0x3e4f30,_0x7849cf,_0x156a74){var _0x417d88={'channel':'fax'};if(_0x3e4f30['body']['id']){delete _0x3e4f30['body']['id'];}_0x3e4f30[_0xc805('0x53')][_0xc805('0x57')]=!![];_0x3e4f30[_0xc805('0x53')][_0xc805('0x58')]=moment()[_0xc805('0x59')](_0xc805('0x5a'));_0x3e4f30[_0xc805('0x53')]['UserId']=_0x3e4f30['body'][_0xc805('0x5b')]||_0x3e4f30[_0xc805('0x5c')]['id'];return db['FaxMessage'][_0xc805('0x5d')]({'where':{'id':_0x3e4f30['params']['id'],'UserId':null},'include':[{'model':db[_0xc805('0x5e')],'as':_0xc805('0x5f')}]})[_0xc805('0x20')](handleEntityNotFound(_0x7849cf,null))['then'](saveUpdates(_0x3e4f30[_0xc805('0x53')],null))[_0xc805('0x20')](function(_0x2f7fe7){if(_0x2f7fe7){_0x417d88[_0xc805('0x26')]=_0x2f7fe7[_0xc805('0x60')]({'plain':!![]});return db[_0xc805('0x61')]['find']({'where':{'id':_0x2f7fe7[_0xc805('0x62')]}});}return null;})[_0xc805('0x20')](handleEntityNotFound(_0x7849cf,null))[_0xc805('0x20')](function(_0x208701){if(_0x208701){return _0x208701[_0xc805('0x52')]({'UserId':_0x3e4f30['body'][_0xc805('0x5b')],'read1stAt':_['isNil'](_0x208701[_0xc805('0x63')])?moment()['format'](_0xc805('0x5a')):undefined});}return null;})['then'](function(_0x4eaaff){if(_0x4eaaff){_0x417d88['interaction']=_0x4eaaff[_0xc805('0x60')]({'plain':!![]});interaction_log[_0xc805('0x27')](_0xc805('0x64'),_0x3e4f30['user']['id'],_0x3e4f30['user']['name'],_0x3e4f30[_0xc805('0x5c')][_0xc805('0x65')],_0x417d88[_0xc805('0x66')]['id'],_0x3e4f30[_0xc805('0x53')]?JSON[_0xc805('0x24')](_0x3e4f30['body']):_0xc805('0x67'));return respondWithRpcPromise('AcceptMessage',_0xc805('0x68'),_0x417d88);}return null;})[_0xc805('0x20')](function(_0x5599c7){if(_0x5599c7){if(_0x3e4f30['body'][_0xc805('0x69')]){_0x417d88['message'][_0xc805('0x6a')]=util['format']('SIP/%s',_0x3e4f30[_0xc805('0x5c')][_0xc805('0x36')]);_0x417d88[_0xc805('0x26')][_0xc805('0x6b')]=_0x417d88['channel'];_0x417d88[_0xc805('0x26')][_0xc805('0x6c')]=_0xc805('0x56');return respondWithRpcPromise(_0xc805('0x6d'),_0xc805('0x6d'),{'event':_0xc805('0x6e'),'message':_0x417d88[_0xc805('0x26')]},client9002)[_0xc805('0x20')](function(){return _0x417d88;});}return _0x417d88;}return null;})['then'](respondWithResult(_0x7849cf,null))['catch'](handleError(_0x7849cf,null));};var interaction_log=require(_0xc805('0x16'))(_0xc805('0x55'));exports['reject']=function(_0x11e74a,_0x4513a4,_0x2dc3b9){var _0x11dfdd={'agent':{},'channel':_0xc805('0x6f')};if(_0x11e74a[_0xc805('0x53')]['id']){delete _0x11e74a[_0xc805('0x53')]['id'];}_0x11e74a[_0xc805('0x53')][_0xc805('0x5b')]=_0x11e74a[_0xc805('0x53')]['UserId']||_0x11e74a[_0xc805('0x5c')]['id'];_0x11dfdd['agent']['id']=_0x11e74a['body'][_0xc805('0x5b')];return db[_0xc805('0x4a')][_0xc805('0x5d')]({'where':{'id':_0x11e74a[_0xc805('0x50')]['id'],'UserId':null}})[_0xc805('0x20')](handleEntityNotFound(_0x4513a4,null))[_0xc805('0x20')](function(_0x216839){if(_0x216839){_0x11dfdd[_0xc805('0x26')]=_0x216839[_0xc805('0x60')]({'plain':!![]});return db[_0xc805('0x61')]['find']({'where':{'id':_0x216839[_0xc805('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x4513a4,null))[_0xc805('0x20')](function(_0x46182b){if(_0x46182b){_0x11dfdd[_0xc805('0x66')]=_0x46182b[_0xc805('0x60')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x11e74a[_0xc805('0x5c')]['id'],_0x11e74a[_0xc805('0x5c')][_0xc805('0x36')],_0x11e74a[_0xc805('0x5c')][_0xc805('0x65')],_0x11dfdd[_0xc805('0x66')]['id'],_0x11e74a['body']?JSON[_0xc805('0x24')](_0x11e74a['body']):_0xc805('0x67'));return respondWithRpcPromise(_0xc805('0x70'),'rejectMessage',_0x11dfdd);}return null;})['then'](function(_0x1b7efd){if(_0x1b7efd){_0x1b7efd['message'][_0xc805('0x6a')]=util['format'](_0xc805('0x71'),_0x11e74a[_0xc805('0x5c')][_0xc805('0x36')]);_0x1b7efd[_0xc805('0x26')][_0xc805('0x6b')]=_0x11dfdd['channel'];_0x1b7efd[_0xc805('0x26')]['event']='reject';respondWithRpcPromise(_0xc805('0x6d'),_0xc805('0x6d'),{'event':_0xc805('0x72'),'message':_0x1b7efd[_0xc805('0x26')]},client9002);return _0x11dfdd;}return null;})['then'](respondWithResult(_0x4513a4,null))[_0xc805('0x29')](handleError(_0x4513a4,null));};exports[_0xc805('0x73')]=function(_0x42ed35,_0x22b729){var _0x5d7eb0;return db[_0xc805('0x4a')][_0xc805('0x73')](_0x42ed35[_0xc805('0x53')],{})['then'](function(_0x26e1e4){_0x5d7eb0=_0x26e1e4;return db['CmContact'][_0xc805('0x74')]({'where':{'id':_0x5d7eb0[_0xc805('0x75')]}});})['then'](function(_0x2b9c52){if(_[_0xc805('0x76')](_0x2b9c52)){return;}else{_0x5d7eb0[_0xc805('0x6f')]=_0x2b9c52[_0xc805('0x6f')];return db[_0xc805('0x77')][_0xc805('0x74')]({'where':{'id':_0x5d7eb0['AttachmentId']}});}})['then'](function(_0x140114){return respondWithRpcPromise(_0xc805('0x78'),_0xc805('0x78'),{'FaxAccountId':_[_0xc805('0x76')](_0x42ed35[_0xc805('0x53')])?undefined:_0x42ed35[_0xc805('0x53')][_0xc805('0x79')],'path':_[_0xc805('0x76')](_0x140114)?undefined:util[_0xc805('0x59')](_0xc805('0x7a'),_0x140114[_0xc805('0x7b')]),'fax':_[_0xc805('0x76')](_0x5d7eb0[_0xc805('0x6f')])?undefined:_0x5d7eb0[_0xc805('0x6f')],'AttachmentId':_0x5d7eb0['AttachmentId']},client9002);})[_0xc805('0x20')](respondWithResult(_0x22b729,0xc9))[_0xc805('0x29')](handleError(_0x22b729,null));};exports[_0xc805('0x7c')]=function(_0x162bc4,_0x3a54b5){var _0x3e53ab=path[_0xc805('0x7d')](config[_0xc805('0x7e')],_0xc805('0x7f'),_0xc805('0x80'),_0xc805('0x81'));return db[_0xc805('0x4a')][_0xc805('0x5d')]({'where':{'id':_0x162bc4[_0xc805('0x50')]['id']},'include':[{'model':db[_0xc805('0x77')],'as':_0xc805('0x77')}]})['then'](handleEntityNotFound(_0x3a54b5,null))[_0xc805('0x20')](function(_0x200008){if(_0x200008){return _0x3a54b5[_0xc805('0x7c')](path['join'](_0x3e53ab,_0x200008[_0xc805('0x77')]['basename']));}})[_0xc805('0x29')](handleError(_0x3a54b5,null));}; \ No newline at end of file +var _0xc344=['offset','set','reject','save','update','then','stack','name','send','index','FaxMessage','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','map','type','key','VIRTUAL','field','merge','count','include','rows','show','params','includeAll','body','find','describe','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','FaxInteractionId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','acceptMessage','manual','interface','channel','EventManager','agent','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','SIP/%s','event','create','findOne','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','root','server','files','join','html-pdf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json'];(function(_0x5ed83b,_0x4b0e47){var _0x613430=function(_0x392d22){while(--_0x392d22){_0x5ed83b['push'](_0x5ed83b['shift']());}};_0x613430(++_0x4b0e47);}(_0xc344,0x1ce));var _0x4c34=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xc344[_0x7e2eb0];return _0xd92de4;};'use strict';var pdf=require(_0x4c34('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4c34('0x1'));var rp=require(_0x4c34('0x2'));var moment=require('moment');var BPromise=require(_0x4c34('0x3'));var Mustache=require(_0x4c34('0x4'));var util=require(_0x4c34('0x5'));var path=require(_0x4c34('0x6'));var sox=require(_0x4c34('0x7'));var csv=require(_0x4c34('0x8'));var ejs=require(_0x4c34('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4c34('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4c34('0x8'));var querystring=require(_0x4c34('0xb'));var Papa=require(_0x4c34('0xc'));var authService=require(_0x4c34('0xd'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x4c34('0xe'));var qs=require(_0x4c34('0xf'));var logger=require(_0x4c34('0x10'))(_0x4c34('0x11'));var utils=require(_0x4c34('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x4c34('0x13')]=_[_0x4c34('0x14')](config[_0x4c34('0x13')],{'host':_0x4c34('0x15'),'port':0x18eb});var socket=require(_0x4c34('0x16'))(new Redis(config[_0x4c34('0x13')]));require('./faxMessage.socket')[_0x4c34('0x17')](socket);var jayson=require(_0x4c34('0x18'));var client=jayson[_0x4c34('0x19')][_0x4c34('0x1a')]({'port':0x232c});var client9002=jayson[_0x4c34('0x19')][_0x4c34('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x17ba97,_0x45dec8,_0x275ad0,_0x508c8e){return new BPromise(function(_0x356fc8,_0x302781){var _0x1b2f34=_0x508c8e||client;return _0x1b2f34['request'](_0x17ba97,_0x275ad0)['then'](function(_0x5e1365){logger[_0x4c34('0x1b')](_0x4c34('0x1c'),_0x45dec8,_0x4c34('0x1d'));logger[_0x4c34('0x1e')](_0x4c34('0x1f'),_0x45dec8,_0x4c34('0x1d'),JSON[_0x4c34('0x20')](_0x5e1365));if(_0x5e1365['error']){if(_0x5e1365[_0x4c34('0x21')][_0x4c34('0x22')]===0x1f4){logger[_0x4c34('0x21')](_0x4c34('0x1c'),_0x45dec8,_0x5e1365[_0x4c34('0x21')][_0x4c34('0x23')]);return _0x302781(_0x5e1365[_0x4c34('0x21')][_0x4c34('0x23')]);}logger[_0x4c34('0x21')](_0x4c34('0x1c'),_0x45dec8,_0x5e1365[_0x4c34('0x21')][_0x4c34('0x23')]);return _0x356fc8(_0x5e1365[_0x4c34('0x21')][_0x4c34('0x23')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x45dec8,_0x4c34('0x1d'));_0x356fc8(_0x5e1365[_0x4c34('0x24')][_0x4c34('0x23')]);}})[_0x4c34('0x25')](function(_0x2c46e9){logger[_0x4c34('0x21')](_0x4c34('0x1c'),_0x45dec8,_0x2c46e9);_0x302781(_0x2c46e9);});});}function respondWithStatusCode(_0x259434,_0x2c42c6){_0x2c42c6=_0x2c42c6||0xcc;return function(_0x456d89){if(_0x456d89){return _0x259434[_0x4c34('0x26')](_0x2c42c6);}return _0x259434[_0x4c34('0x27')](_0x2c42c6)[_0x4c34('0x28')]();};}function respondWithResult(_0x246023,_0x5c2ecc){_0x5c2ecc=_0x5c2ecc||0xc8;return function(_0x165d04){if(_0x165d04){return _0x246023[_0x4c34('0x27')](_0x5c2ecc)[_0x4c34('0x29')](_0x165d04);}};}function respondWithFilteredResult(_0x171af9,_0x465240){return function(_0x1fd364){if(_0x1fd364){var _0x5c28a3=_0x1fd364['count'],_0x4d72e2=_0x465240[_0x4c34('0x2a')],_0xc36bde=_0x465240[_0x4c34('0x2a')]+_0x465240['limit'],_0x3e3772;if(_0xc36bde>=_0x5c28a3){_0xc36bde=_0x5c28a3;_0x3e3772=0xc8;}else{_0x3e3772=0xce;}_0x171af9[_0x4c34('0x27')](_0x3e3772);return _0x171af9[_0x4c34('0x2b')]('Content-Range',_0x4d72e2+'-'+_0xc36bde+'/'+_0x5c28a3)[_0x4c34('0x29')](_0x1fd364);}return null;};}function patchUpdates(_0x79465e){return function(_0x2904ee){try{jsonpatch['apply'](_0x2904ee,_0x79465e,!![]);}catch(_0x5175d0){return BPromise[_0x4c34('0x2c')](_0x5175d0);}return _0x2904ee[_0x4c34('0x2d')]();};}function saveUpdates(_0x4d6b7c,_0x1612da){return function(_0x376db8){if(_0x376db8){return _0x376db8[_0x4c34('0x2e')](_0x4d6b7c)[_0x4c34('0x2f')](function(_0x351593){return _0x351593;});}return null;};}function removeEntity(_0x2707cb,_0x1620b7){return function(_0x365a27){if(_0x365a27){return _0x365a27['destroy']()['then'](function(){_0x2707cb[_0x4c34('0x27')](0xcc)[_0x4c34('0x28')]();});}};}function handleEntityNotFound(_0x13b209,_0x380f4d){return function(_0x1f3e70){if(!_0x1f3e70){_0x13b209[_0x4c34('0x26')](0x194);}return _0x1f3e70;};}function handleError(_0x21047a,_0x5ee4fb){_0x5ee4fb=_0x5ee4fb||0x1f4;return function(_0x1103b5){logger[_0x4c34('0x21')](_0x1103b5[_0x4c34('0x30')]);if(_0x1103b5[_0x4c34('0x31')]){delete _0x1103b5[_0x4c34('0x31')];}_0x21047a[_0x4c34('0x27')](_0x5ee4fb)[_0x4c34('0x32')](_0x1103b5);};}exports[_0x4c34('0x33')]=function(_0x485fdd,_0x36c4ae){var _0x2ebde4={},_0x56e96b={},_0x595805={'count':0x0,'rows':[]};var _0xa2f3b0=db[_0x4c34('0x34')][_0x4c34('0x35')];_0x56e96b[_0x4c34('0x36')]=_[_0x4c34('0x37')](_0xa2f3b0);_0x56e96b[_0x4c34('0x38')]=_[_0x4c34('0x37')](_0x485fdd['query']);_0x56e96b[_0x4c34('0x39')]=_[_0x4c34('0x3a')](_0x56e96b[_0x4c34('0x36')],_0x56e96b['query']);_0x2ebde4[_0x4c34('0x3b')]=_[_0x4c34('0x3a')](_0x56e96b[_0x4c34('0x36')],qs[_0x4c34('0x3c')](_0x485fdd[_0x4c34('0x38')][_0x4c34('0x3c')]));_0x2ebde4[_0x4c34('0x3b')]=_0x2ebde4[_0x4c34('0x3b')][_0x4c34('0x3d')]?_0x2ebde4['attributes']:_0x56e96b['model'];if(!_0x485fdd[_0x4c34('0x38')][_0x4c34('0x3e')](_0x4c34('0x3f'))){_0x2ebde4[_0x4c34('0x40')]=qs[_0x4c34('0x40')](_0x485fdd[_0x4c34('0x38')][_0x4c34('0x40')]);_0x2ebde4[_0x4c34('0x2a')]=qs[_0x4c34('0x2a')](_0x485fdd[_0x4c34('0x38')][_0x4c34('0x2a')]);}_0x2ebde4['order']=qs[_0x4c34('0x41')](_0x485fdd[_0x4c34('0x38')]['sort']);_0x2ebde4[_0x4c34('0x42')]=qs[_0x4c34('0x39')](_[_0x4c34('0x43')](_0x485fdd[_0x4c34('0x38')],_0x56e96b[_0x4c34('0x39')]));if(_0x485fdd[_0x4c34('0x38')][_0x4c34('0x44')]){_0x2ebde4[_0x4c34('0x42')]=_['merge'](_0x2ebde4['where'],{'$or':_[_0x4c34('0x45')](_0xa2f3b0,function(_0x252076){if(_0x252076[_0x4c34('0x46')][_0x4c34('0x47')]!==_0x4c34('0x48')){var _0xd97d26={};_0xd97d26[_0x252076[_0x4c34('0x49')]]={'$like':'%'+_0x485fdd[_0x4c34('0x38')][_0x4c34('0x44')]+'%'};return _0xd97d26;}})});}_0x2ebde4=_[_0x4c34('0x4a')]({},_0x2ebde4,_0x485fdd['options']);var _0x5470d4={'where':_0x2ebde4[_0x4c34('0x42')]};return db[_0x4c34('0x34')][_0x4c34('0x4b')](_0x5470d4)[_0x4c34('0x2f')](function(_0x2c0f1c){_0x595805[_0x4c34('0x4b')]=_0x2c0f1c;if(_0x485fdd[_0x4c34('0x38')]['includeAll']){_0x2ebde4[_0x4c34('0x4c')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x2ebde4);})['then'](function(_0x4e89b2){_0x595805[_0x4c34('0x4d')]=_0x4e89b2;return _0x595805;})['then'](respondWithFilteredResult(_0x36c4ae,_0x2ebde4))[_0x4c34('0x25')](handleError(_0x36c4ae,null));};exports[_0x4c34('0x4e')]=function(_0x1479cd,_0x2c8d06){var _0x1e41aa={'raw':!![],'where':{'id':_0x1479cd[_0x4c34('0x4f')]['id']}},_0x21360c={};_0x21360c[_0x4c34('0x36')]=_[_0x4c34('0x37')](db[_0x4c34('0x34')][_0x4c34('0x35')]);_0x21360c[_0x4c34('0x38')]=_[_0x4c34('0x37')](_0x1479cd[_0x4c34('0x38')]);_0x21360c[_0x4c34('0x39')]=_[_0x4c34('0x3a')](_0x21360c[_0x4c34('0x36')],_0x21360c['query']);_0x1e41aa[_0x4c34('0x3b')]=_[_0x4c34('0x3a')](_0x21360c[_0x4c34('0x36')],qs['fields'](_0x1479cd[_0x4c34('0x38')][_0x4c34('0x3c')]));_0x1e41aa[_0x4c34('0x3b')]=_0x1e41aa[_0x4c34('0x3b')][_0x4c34('0x3d')]?_0x1e41aa[_0x4c34('0x3b')]:_0x21360c[_0x4c34('0x36')];if(_0x1479cd['query'][_0x4c34('0x50')]){_0x1e41aa['include']=[{'all':!![]}];}_0x1e41aa=_[_0x4c34('0x4a')]({},_0x1e41aa,_0x1479cd['options']);return db[_0x4c34('0x34')]['find'](_0x1e41aa)[_0x4c34('0x2f')](handleEntityNotFound(_0x2c8d06,null))[_0x4c34('0x2f')](respondWithResult(_0x2c8d06,null))['catch'](handleError(_0x2c8d06,null));};exports[_0x4c34('0x2e')]=function(_0x1963a8,_0x516dd4){if(_0x1963a8[_0x4c34('0x51')]['id']){delete _0x1963a8[_0x4c34('0x51')]['id'];}return db[_0x4c34('0x34')][_0x4c34('0x52')]({'where':{'id':_0x1963a8[_0x4c34('0x4f')]['id']}})['then'](handleEntityNotFound(_0x516dd4,null))[_0x4c34('0x2f')](saveUpdates(_0x1963a8[_0x4c34('0x51')],null))['then'](respondWithResult(_0x516dd4,null))[_0x4c34('0x25')](handleError(_0x516dd4,null));};exports['destroy']=function(_0x5222bb,_0x3fe965){return db[_0x4c34('0x34')]['find']({'where':{'id':_0x5222bb[_0x4c34('0x4f')]['id']}})[_0x4c34('0x2f')](handleEntityNotFound(_0x3fe965,null))[_0x4c34('0x2f')](removeEntity(_0x3fe965,null))['catch'](handleError(_0x3fe965,null));};exports[_0x4c34('0x53')]=function(_0x387bd2,_0x39853f){return db[_0x4c34('0x34')][_0x4c34('0x53')]()['then'](respondWithResult(_0x39853f,null))[_0x4c34('0x25')](handleError(_0x39853f,null));};var interaction_log=require(_0x4c34('0x10'))(_0x4c34('0x54'));exports[_0x4c34('0x55')]=function(_0x1d94a9,_0x30d4f4,_0x20d99f){var _0x539ee3={'channel':_0x4c34('0x56')};if(_0x1d94a9[_0x4c34('0x51')]['id']){delete _0x1d94a9[_0x4c34('0x51')]['id'];}_0x1d94a9[_0x4c34('0x51')][_0x4c34('0x57')]=!![];_0x1d94a9[_0x4c34('0x51')]['readAt']=moment()[_0x4c34('0x58')](_0x4c34('0x59'));_0x1d94a9[_0x4c34('0x51')][_0x4c34('0x5a')]=_0x1d94a9[_0x4c34('0x51')]['UserId']||_0x1d94a9[_0x4c34('0x5b')]['id'];return db[_0x4c34('0x34')]['find']({'where':{'id':_0x1d94a9[_0x4c34('0x4f')]['id'],'UserId':null},'include':[{'model':db[_0x4c34('0x5c')],'as':'Contact'}]})[_0x4c34('0x2f')](handleEntityNotFound(_0x30d4f4,null))[_0x4c34('0x2f')](saveUpdates(_0x1d94a9[_0x4c34('0x51')],null))[_0x4c34('0x2f')](function(_0x4afdad){if(_0x4afdad){_0x539ee3[_0x4c34('0x23')]=_0x4afdad[_0x4c34('0x5d')]({'plain':!![]});return db['FaxInteraction'][_0x4c34('0x52')]({'where':{'id':_0x4afdad[_0x4c34('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x30d4f4,null))[_0x4c34('0x2f')](function(_0x3eab5a){if(_0x3eab5a){return _0x3eab5a['update']({'UserId':_0x1d94a9[_0x4c34('0x51')][_0x4c34('0x5a')],'read1stAt':_[_0x4c34('0x5f')](_0x3eab5a[_0x4c34('0x60')])?moment()['format'](_0x4c34('0x59')):undefined});}return null;})[_0x4c34('0x2f')](function(_0x3e92ab){if(_0x3e92ab){_0x539ee3['interaction']=_0x3e92ab[_0x4c34('0x5d')]({'plain':!![]});interaction_log[_0x4c34('0x1b')](_0x4c34('0x61'),_0x1d94a9[_0x4c34('0x5b')]['id'],_0x1d94a9[_0x4c34('0x5b')][_0x4c34('0x31')],_0x1d94a9[_0x4c34('0x5b')][_0x4c34('0x62')],_0x539ee3[_0x4c34('0x63')]['id'],_0x1d94a9[_0x4c34('0x51')]?JSON[_0x4c34('0x20')](_0x1d94a9[_0x4c34('0x51')]):'null');return respondWithRpcPromise(_0x4c34('0x64'),_0x4c34('0x65'),_0x539ee3);}return null;})[_0x4c34('0x2f')](function(_0x32fb1c){if(_0x32fb1c){if(_0x1d94a9['body'][_0x4c34('0x66')]){_0x539ee3[_0x4c34('0x23')][_0x4c34('0x67')]=util[_0x4c34('0x58')]('SIP/%s',_0x1d94a9['user'][_0x4c34('0x31')]);_0x539ee3['message'][_0x4c34('0x68')]=_0x539ee3['channel'];_0x539ee3[_0x4c34('0x23')]['event']='accept';return respondWithRpcPromise(_0x4c34('0x69'),_0x4c34('0x69'),{'event':'acceptmessage','message':_0x539ee3[_0x4c34('0x23')]},client9002)['then'](function(){return _0x539ee3;});}return _0x539ee3;}return null;})['then'](respondWithResult(_0x30d4f4,null))[_0x4c34('0x25')](handleError(_0x30d4f4,null));};var interaction_log=require('../../config/logger')(_0x4c34('0x54'));exports[_0x4c34('0x2c')]=function(_0x13b309,_0xa8d9f2,_0x2f28d1){var _0x35b92a={'agent':{},'channel':_0x4c34('0x56')};if(_0x13b309[_0x4c34('0x51')]['id']){delete _0x13b309[_0x4c34('0x51')]['id'];}_0x13b309[_0x4c34('0x51')][_0x4c34('0x5a')]=_0x13b309['body'][_0x4c34('0x5a')]||_0x13b309[_0x4c34('0x5b')]['id'];_0x35b92a[_0x4c34('0x6a')]['id']=_0x13b309['body']['UserId'];return db[_0x4c34('0x34')][_0x4c34('0x52')]({'where':{'id':_0x13b309[_0x4c34('0x4f')]['id'],'UserId':null}})[_0x4c34('0x2f')](handleEntityNotFound(_0xa8d9f2,null))[_0x4c34('0x2f')](function(_0x272051){if(_0x272051){_0x35b92a[_0x4c34('0x23')]=_0x272051[_0x4c34('0x5d')]({'plain':!![]});return db[_0x4c34('0x6b')][_0x4c34('0x52')]({'where':{'id':_0x272051[_0x4c34('0x5e')]}});}return null;})[_0x4c34('0x2f')](handleEntityNotFound(_0xa8d9f2,null))[_0x4c34('0x2f')](function(_0x502f05){if(_0x502f05){_0x35b92a[_0x4c34('0x63')]=_0x502f05[_0x4c34('0x5d')]({'plain':!![]});interaction_log[_0x4c34('0x1b')](_0x4c34('0x6c'),_0x13b309[_0x4c34('0x5b')]['id'],_0x13b309[_0x4c34('0x5b')][_0x4c34('0x31')],_0x13b309['user']['role'],_0x35b92a[_0x4c34('0x63')]['id'],_0x13b309[_0x4c34('0x51')]?JSON[_0x4c34('0x20')](_0x13b309[_0x4c34('0x51')]):_0x4c34('0x6d'));return respondWithRpcPromise('RejectMessage',_0x4c34('0x6e'),_0x35b92a);}return null;})[_0x4c34('0x2f')](function(_0x474a85){if(_0x474a85){_0x474a85['message'][_0x4c34('0x67')]=util[_0x4c34('0x58')](_0x4c34('0x6f'),_0x13b309[_0x4c34('0x5b')][_0x4c34('0x31')]);_0x474a85['message'][_0x4c34('0x68')]=_0x35b92a[_0x4c34('0x68')];_0x474a85[_0x4c34('0x23')][_0x4c34('0x70')]=_0x4c34('0x2c');respondWithRpcPromise(_0x4c34('0x69'),_0x4c34('0x69'),{'event':'rejectmessage','message':_0x474a85[_0x4c34('0x23')]},client9002);return _0x35b92a;}return null;})[_0x4c34('0x2f')](respondWithResult(_0xa8d9f2,null))[_0x4c34('0x25')](handleError(_0xa8d9f2,null));};exports[_0x4c34('0x71')]=function(_0x5c68e3,_0x2bdea5){var _0x1ed8d5;return db[_0x4c34('0x34')][_0x4c34('0x71')](_0x5c68e3[_0x4c34('0x51')],{})[_0x4c34('0x2f')](function(_0x1c63cf){_0x1ed8d5=_0x1c63cf;return db['CmContact'][_0x4c34('0x72')]({'where':{'id':_0x1ed8d5['ContactId']}});})[_0x4c34('0x2f')](function(_0x3bcb7c){if(_[_0x4c34('0x5f')](_0x3bcb7c)){return;}else{_0x1ed8d5['fax']=_0x3bcb7c[_0x4c34('0x56')];return db[_0x4c34('0x73')]['findOne']({'where':{'id':_0x1ed8d5['AttachmentId']}});}})['then'](function(_0x541bd3){return respondWithRpcPromise('SendFax',_0x4c34('0x74'),{'FaxAccountId':_[_0x4c34('0x5f')](_0x5c68e3['body'])?undefined:_0x5c68e3[_0x4c34('0x51')][_0x4c34('0x75')],'path':_[_0x4c34('0x5f')](_0x541bd3)?undefined:util[_0x4c34('0x58')](_0x4c34('0x76'),_0x541bd3[_0x4c34('0x77')]),'fax':_[_0x4c34('0x5f')](_0x1ed8d5[_0x4c34('0x56')])?undefined:_0x1ed8d5[_0x4c34('0x56')],'AttachmentId':_0x1ed8d5[_0x4c34('0x78')]},client9002);})[_0x4c34('0x2f')](respondWithResult(_0x2bdea5,0xc9))[_0x4c34('0x25')](handleError(_0x2bdea5,null));};exports[_0x4c34('0x79')]=function(_0x3b81a6,_0x12d9b4){var _0x4803c9=path['join'](config[_0x4c34('0x7a')],_0x4c34('0x7b'),_0x4c34('0x7c'),'attachments');return db[_0x4c34('0x34')]['find']({'where':{'id':_0x3b81a6[_0x4c34('0x4f')]['id']},'include':[{'model':db['Attachment'],'as':_0x4c34('0x73')}]})[_0x4c34('0x2f')](handleEntityNotFound(_0x12d9b4,null))['then'](function(_0x5af313){if(_0x5af313){return _0x12d9b4[_0x4c34('0x79')](path[_0x4c34('0x7d')](_0x4803c9,_0x5af313[_0x4c34('0x73')][_0x4c34('0x77')]));}})['catch'](handleError(_0x12d9b4,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 88fa8d7..a02c098 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 _0x33d1=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x4d8a5f,_0x4d56fb){var _0x4b45a0=function(_0x17c4b6){while(--_0x17c4b6){_0x4d8a5f['push'](_0x4d8a5f['shift']());}};_0x4b45a0(++_0x4d56fb);}(_0x33d1,0x16c));var _0x133d=function(_0x25cbce,_0x1dea42){_0x25cbce=_0x25cbce-0x0;var _0x48dfc9=_0x33d1[_0x25cbce];return _0x48dfc9;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x133d('0x0'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x133d('0x1')](0x0);var events={'afterCreate':_0x133d('0x2'),'afterUpdate':_0x133d('0x3'),'afterDestroy':_0x133d('0x4')};function emitEvent(_0x29a8ce){return function(_0x1687e4,_0xded5b1,_0x242526){FaxMessageEvents['emit'](_0x29a8ce+':'+_0x1687e4['id'],_0x1687e4);FaxMessageEvents[_0x133d('0x5')](_0x29a8ce,_0x1687e4);_0x242526(null);};}for(var e in events){if(events[_0x133d('0x6')](e)){var event=events[e];FaxMessage[_0x133d('0x7')](e,emitEvent(event));}}module[_0x133d('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0xb08c=['FaxMessage','setMaxListeners','save','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x189692,_0x121175){var _0x2c8b25=function(_0x2a28ed){while(--_0x2a28ed){_0x189692['push'](_0x189692['shift']());}};_0x2c8b25(++_0x121175);}(_0xb08c,0x181));var _0xcb08=function(_0x409dff,_0x3a2350){_0x409dff=_0x409dff-0x0;var _0x1852a7=_0xb08c[_0x409dff];return _0x1852a7;};'use strict';var EventEmitter=require(_0xcb08('0x0'));var FaxMessage=require(_0xcb08('0x1'))['db'][_0xcb08('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xcb08('0x3')](0x0);var events={'afterCreate':_0xcb08('0x4'),'afterUpdate':'update','afterDestroy':_0xcb08('0x5')};function emitEvent(_0x5f2ff3){return function(_0x14a9bc,_0x444a6f,_0x3e8f1a){FaxMessageEvents[_0xcb08('0x6')](_0x5f2ff3+':'+_0x14a9bc['id'],_0x14a9bc);FaxMessageEvents[_0xcb08('0x6')](_0x5f2ff3,_0x14a9bc);_0x3e8f1a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xcb08('0x7')](e,emitEvent(event));}}module[_0xcb08('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 540cd8e..70809c4 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 _0x87ba=['direction','body','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./faxMessage.attributes','define','FaxMessage','models','get','toLowerCase','out','secret','isNil','UserId','FaxInteraction','then','update','createdAt'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x87ba,0x18b));var _0xa87b=function(_0x28db86,_0x45d20f){_0x28db86=_0x28db86-0x0;var _0x3b0ae7=_0x87ba[_0x28db86];return _0x3b0ae7;};'use strict';var _=require(_0xa87b('0x0'));var util=require(_0xa87b('0x1'));var logger=require(_0xa87b('0x2'))(_0xa87b('0x3'));var moment=require(_0xa87b('0x4'));var BPromise=require(_0xa87b('0x5'));var rp=require(_0xa87b('0x6'));var attributes=require(_0xa87b('0x7'));module['exports']=function(_0x4af7c1,_0x3d295c){return _0x4af7c1[_0xa87b('0x8')](_0xa87b('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x575de2,_0x49b5ab,_0x330954){var _0x3edf7f=_0x4af7c1[_0xa87b('0xa')];var _0x3af0d3=_0x575de2[_0xa87b('0xb')]({'plain':!![]});if(_0x3af0d3['direction']['toLowerCase']()==='in'||_0x3af0d3['direction'][_0xa87b('0xc')]()===_0xa87b('0xd')&&!_0x3af0d3[_0xa87b('0xe')]&&!_[_0xa87b('0xf')](_0x3af0d3[_0xa87b('0x10')])){_0x3edf7f[_0xa87b('0x11')]['findOne']({'where':{'id':_0x3af0d3['FaxInteractionId']}})[_0xa87b('0x12')](function(_0x341846){if(_0x341846){_0x341846[_0xa87b('0x13')]({'lastMsgAt':_0x3af0d3[_0xa87b('0x14')],'lastMsgDirection':_0x3af0d3[_0xa87b('0x15')]['toLowerCase'](),'lastMsgBody':_0x3af0d3[_0xa87b('0x16')]});}})[_0xa87b('0x17')](function(_0x35bc73){console[_0xa87b('0x18')](_0x35bc73);});}_0x330954();}},'charset':'utf8mb4','collate':_0xa87b('0x19')});}; \ No newline at end of file +var _0xc789=['FaxInteraction','FaxInteractionId','update','createdAt','body','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','models','get','direction','toLowerCase','secret','isNil'];(function(_0x4b14bb,_0xe7b4d3){var _0x285200=function(_0x48c1d7){while(--_0x48c1d7){_0x4b14bb['push'](_0x4b14bb['shift']());}};_0x285200(++_0xe7b4d3);}(_0xc789,0x19e));var _0x9c78=function(_0x59747e,_0x48e3bb){_0x59747e=_0x59747e-0x0;var _0x1d3285=_0xc789[_0x59747e];return _0x1d3285;};'use strict';var _=require(_0x9c78('0x0'));var util=require(_0x9c78('0x1'));var logger=require(_0x9c78('0x2'))(_0x9c78('0x3'));var moment=require(_0x9c78('0x4'));var BPromise=require(_0x9c78('0x5'));var rp=require(_0x9c78('0x6'));var attributes=require(_0x9c78('0x7'));module[_0x9c78('0x8')]=function(_0x548ef9,_0x16bd0f){return _0x548ef9[_0x9c78('0x9')](_0x9c78('0xa'),attributes,{'tableName':_0x9c78('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1a46cc,_0x13d5b2,_0x17ba06){var _0x3a2d7c=_0x548ef9[_0x9c78('0xc')];var _0x4d416b=_0x1a46cc[_0x9c78('0xd')]({'plain':!![]});if(_0x4d416b[_0x9c78('0xe')][_0x9c78('0xf')]()==='in'||_0x4d416b[_0x9c78('0xe')]['toLowerCase']()==='out'&&!_0x4d416b[_0x9c78('0x10')]&&!_[_0x9c78('0x11')](_0x4d416b['UserId'])){_0x3a2d7c[_0x9c78('0x12')]['findOne']({'where':{'id':_0x4d416b[_0x9c78('0x13')]}})['then'](function(_0x7a20b){if(_0x7a20b){_0x7a20b[_0x9c78('0x14')]({'lastMsgAt':_0x4d416b[_0x9c78('0x15')],'lastMsgDirection':_0x4d416b[_0x9c78('0xe')][_0x9c78('0xf')](),'lastMsgBody':_0x4d416b[_0x9c78('0x16')]});}})[_0x9c78('0x17')](function(_0x3b21ac){console[_0x9c78('0x18')](_0x3b21ac);});}_0x17ba06();}},'charset':_0x9c78('0x19'),'collate':_0x9c78('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 6b13952..b46ad6f 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 _0x9589=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','FaxMessage','create','options','raw','CreateFaxMessage','catch','body','where','limit','UpdateFaxMessage','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x4404cf,_0x3aa117){var _0x121576=function(_0x3fd009){while(--_0x3fd009){_0x4404cf['push'](_0x4404cf['shift']());}};_0x121576(++_0x3aa117);}(_0x9589,0xbc));var _0x9958=function(_0x3cbecd,_0x2b93bf){_0x3cbecd=_0x3cbecd-0x0;var _0x25de30=_0x9589[_0x3cbecd];return _0x25de30;};'use strict';var _=require(_0x9958('0x0'));var util=require(_0x9958('0x1'));var moment=require(_0x9958('0x2'));var BPromise=require(_0x9958('0x3'));var rs=require(_0x9958('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9958('0x5'))['db'];var utils=require(_0x9958('0x6'));var logger=require(_0x9958('0x7'))('rpc');var config=require(_0x9958('0x8'));var jayson=require(_0x9958('0x9'));var client=jayson[_0x9958('0xa')][_0x9958('0xb')]({'port':0x232a});config[_0x9958('0xc')]=_[_0x9958('0xd')](config['redis'],{'host':_0x9958('0xe'),'port':0x18eb});var socket=require(_0x9958('0xf'))(new Redis(config[_0x9958('0xc')]));require(_0x9958('0x10'))[_0x9958('0x11')](socket);function respondWithRpcPromise(_0x185b6b,_0x1e2647,_0x1e5c25){return new BPromise(function(_0x3369b3,_0x68907){return client[_0x9958('0x12')](_0x185b6b,_0x1e5c25)[_0x9958('0x13')](function(_0x242f1b){logger[_0x9958('0x14')](_0x9958('0x15'),_0x1e2647,_0x9958('0x16'));logger[_0x9958('0x17')](_0x9958('0x18'),_0x1e2647,'request\x20sent',JSON[_0x9958('0x19')](_0x242f1b));if(_0x242f1b['error']){if(_0x242f1b[_0x9958('0x1a')]['code']===0x1f4){logger[_0x9958('0x1a')](_0x9958('0x15'),_0x1e2647,_0x242f1b[_0x9958('0x1a')][_0x9958('0x1b')]);return _0x68907(_0x242f1b['error'][_0x9958('0x1b')]);}logger[_0x9958('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x1e2647,_0x242f1b['error'][_0x9958('0x1b')]);return _0x3369b3(_0x242f1b['error'][_0x9958('0x1b')]);}else{logger[_0x9958('0x14')](_0x9958('0x15'),_0x1e2647,_0x9958('0x16'));_0x3369b3(_0x242f1b[_0x9958('0x1c')][_0x9958('0x1b')]);}})['catch'](function(_0x54a10d){logger[_0x9958('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x1e2647,_0x54a10d);_0x68907(_0x54a10d);});});}exports['CreateFaxMessage']=function(_0x2bcce1){var _0x5b8879=this;return new Promise(function(_0x5743d6,_0x4278da){return db[_0x9958('0x1d')][_0x9958('0x1e')](_0x2bcce1['body'],{'raw':_0x2bcce1[_0x9958('0x1f')]?_0x2bcce1[_0x9958('0x1f')][_0x9958('0x20')]===undefined?!![]:![]:!![]})[_0x9958('0x13')](function(_0x65d7e1){logger[_0x9958('0x14')](_0x9958('0x21'),_0x2bcce1);logger[_0x9958('0x17')](_0x9958('0x21'),_0x2bcce1,JSON[_0x9958('0x19')](_0x65d7e1));_0x5743d6(_0x65d7e1);})[_0x9958('0x22')](function(_0x20085d){logger[_0x9958('0x1a')]('CreateFaxMessage',_0x20085d[_0x9958('0x1b')],_0x2bcce1);_0x4278da(_0x5b8879[_0x9958('0x1a')](0x1f4,_0x20085d[_0x9958('0x1b')]));});});};exports['UpdateFaxMessage']=function(_0x3ff265){var _0x18f7bd=this;return new Promise(function(_0x1194ce,_0x22bdfc){return db[_0x9958('0x1d')]['update'](_0x3ff265[_0x9958('0x23')],{'raw':_0x3ff265[_0x9958('0x1f')]?_0x3ff265[_0x9958('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ff265[_0x9958('0x1f')]?_0x3ff265[_0x9958('0x1f')][_0x9958('0x24')]||null:null,'attributes':_0x3ff265[_0x9958('0x1f')]?_0x3ff265[_0x9958('0x1f')]['attributes']||null:null,'limit':_0x3ff265[_0x9958('0x1f')]?_0x3ff265[_0x9958('0x1f')][_0x9958('0x25')]||null:null})[_0x9958('0x13')](function(_0x60f289){logger['info'](_0x9958('0x26'),_0x3ff265);logger['debug'](_0x9958('0x26'),_0x3ff265,JSON[_0x9958('0x19')](_0x60f289));_0x1194ce(_0x60f289);})['catch'](function(_0x2fb388){logger[_0x9958('0x1a')](_0x9958('0x26'),_0x2fb388[_0x9958('0x1b')],_0x3ff265);_0x22bdfc(_0x18f7bd[_0x9958('0x1a')](0x1f4,_0x2fb388[_0x9958('0x1b')]));});});}; \ No newline at end of file +var _0x6011=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxMessage.socket','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','then','UpdateFaxMessage','where','limit','ioredis','../../mysqldb'];(function(_0x150c64,_0x79f2be){var _0x5b30a6=function(_0x3ab652){while(--_0x3ab652){_0x150c64['push'](_0x150c64['shift']());}};_0x5b30a6(++_0x79f2be);}(_0x6011,0x196));var _0x1601=function(_0x70f889,_0x445505){_0x70f889=_0x70f889-0x0;var _0x3700da=_0x6011[_0x70f889];return _0x3700da;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1601('0x0'));var db=require(_0x1601('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x1601('0x2'))(_0x1601('0x3'));var config=require(_0x1601('0x4'));var jayson=require(_0x1601('0x5'));var client=jayson[_0x1601('0x6')][_0x1601('0x7')]({'port':0x232a});config[_0x1601('0x8')]=_[_0x1601('0x9')](config[_0x1601('0x8')],{'host':_0x1601('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1601('0x8')]));require(_0x1601('0xb'))[_0x1601('0xc')](socket);function respondWithRpcPromise(_0x25b02d,_0x33def1,_0x58f45f){return new BPromise(function(_0x4dc693,_0x57e18a){return client[_0x1601('0xd')](_0x25b02d,_0x58f45f)['then'](function(_0x1d42b1){logger[_0x1601('0xe')](_0x1601('0xf'),_0x33def1,_0x1601('0x10'));logger[_0x1601('0x11')](_0x1601('0x12'),_0x33def1,_0x1601('0x10'),JSON[_0x1601('0x13')](_0x1d42b1));if(_0x1d42b1['error']){if(_0x1d42b1[_0x1601('0x14')]['code']===0x1f4){logger[_0x1601('0x14')]('FaxMessage,\x20%s,\x20%s',_0x33def1,_0x1d42b1[_0x1601('0x14')][_0x1601('0x15')]);return _0x57e18a(_0x1d42b1['error'][_0x1601('0x15')]);}logger[_0x1601('0x14')](_0x1601('0xf'),_0x33def1,_0x1d42b1['error']['message']);return _0x4dc693(_0x1d42b1[_0x1601('0x14')][_0x1601('0x15')]);}else{logger[_0x1601('0xe')](_0x1601('0xf'),_0x33def1,_0x1601('0x10'));_0x4dc693(_0x1d42b1[_0x1601('0x16')][_0x1601('0x15')]);}})[_0x1601('0x17')](function(_0x1ce2b2){logger['error']('FaxMessage,\x20%s,\x20%s',_0x33def1,_0x1ce2b2);_0x57e18a(_0x1ce2b2);});});}exports[_0x1601('0x18')]=function(_0x1ce486){var _0xb09057=this;return new Promise(function(_0x5bd8fb,_0x2c3b5d){return db[_0x1601('0x19')][_0x1601('0x1a')](_0x1ce486[_0x1601('0x1b')],{'raw':_0x1ce486[_0x1601('0x1c')]?_0x1ce486['options'][_0x1601('0x1d')]===undefined?!![]:![]:!![]})[_0x1601('0x1e')](function(_0x220313){logger['info'](_0x1601('0x18'),_0x1ce486);logger[_0x1601('0x11')]('CreateFaxMessage',_0x1ce486,JSON[_0x1601('0x13')](_0x220313));_0x5bd8fb(_0x220313);})[_0x1601('0x17')](function(_0x5c9543){logger['error'](_0x1601('0x18'),_0x5c9543[_0x1601('0x15')],_0x1ce486);_0x2c3b5d(_0xb09057[_0x1601('0x14')](0x1f4,_0x5c9543['message']));});});};exports[_0x1601('0x1f')]=function(_0x3810b3){var _0x23a6a9=this;return new Promise(function(_0x250fcc,_0x296c34){return db['FaxMessage']['update'](_0x3810b3[_0x1601('0x1b')],{'raw':_0x3810b3[_0x1601('0x1c')]?_0x3810b3[_0x1601('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3810b3[_0x1601('0x1c')]?_0x3810b3['options'][_0x1601('0x20')]||null:null,'attributes':_0x3810b3[_0x1601('0x1c')]?_0x3810b3[_0x1601('0x1c')]['attributes']||null:null,'limit':_0x3810b3[_0x1601('0x1c')]?_0x3810b3[_0x1601('0x1c')][_0x1601('0x21')]||null:null})[_0x1601('0x1e')](function(_0x5cdcfb){logger[_0x1601('0xe')](_0x1601('0x1f'),_0x3810b3);logger[_0x1601('0x11')](_0x1601('0x1f'),_0x3810b3,JSON[_0x1601('0x13')](_0x5cdcfb));_0x250fcc(_0x5cdcfb);})[_0x1601('0x17')](function(_0x1d6749){logger[_0x1601('0x14')](_0x1601('0x1f'),_0x1d6749[_0x1601('0x15')],_0x3810b3);_0x296c34(_0x23a6a9[_0x1601('0x14')](0x1f4,_0x1d6749[_0x1601('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 8efaef6..3184257 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 _0x0eab=['save','remove','update','emit','register','length','./faxMessage.events'];(function(_0x5baa9c,_0x3ddfc8){var _0x2e8430=function(_0xcfec78){while(--_0xcfec78){_0x5baa9c['push'](_0x5baa9c['shift']());}};_0x2e8430(++_0x3ddfc8);}(_0x0eab,0x1d4));var _0xb0ea=function(_0x2f765a,_0x3799c2){_0x2f765a=_0x2f765a-0x0;var _0x320d52=_0x0eab[_0x2f765a];return _0x320d52;};'use strict';var FaxMessageEvents=require(_0xb0ea('0x0'));var events=[_0xb0ea('0x1'),_0xb0ea('0x2'),_0xb0ea('0x3')];function createListener(_0x419942,_0x32fc0f){return function(_0x2b4b1c){_0x32fc0f[_0xb0ea('0x4')](_0x419942,_0x2b4b1c);};}function removeListener(_0x24a827,_0x663143){return function(){FaxMessageEvents['removeListener'](_0x24a827,_0x663143);};}exports[_0xb0ea('0x5')]=function(_0x721c00){for(var _0x251758=0x0,_0x136b87=events[_0xb0ea('0x6')];_0x251758<_0x136b87;_0x251758++){var _0x5d3174=events[_0x251758];var _0x1d045f=createListener('faxMessage:'+_0x5d3174,_0x721c00);FaxMessageEvents['on'](_0x5d3174,_0x1d045f);}}; \ No newline at end of file +var _0x01f5=['remove','emit','removeListener','faxMessage:','./faxMessage.events','save'];(function(_0x3a342d,_0x3fe841){var _0x8d544d=function(_0x32696a){while(--_0x32696a){_0x3a342d['push'](_0x3a342d['shift']());}};_0x8d544d(++_0x3fe841);}(_0x01f5,0x9a));var _0x501f=function(_0x399b9f,_0x2b6575){_0x399b9f=_0x399b9f-0x0;var _0x3c75f0=_0x01f5[_0x399b9f];return _0x3c75f0;};'use strict';var FaxMessageEvents=require(_0x501f('0x0'));var events=[_0x501f('0x1'),_0x501f('0x2'),'update'];function createListener(_0x515686,_0x1421ab){return function(_0x44ebee){_0x1421ab[_0x501f('0x3')](_0x515686,_0x44ebee);};}function removeListener(_0x366289,_0x2998db){return function(){FaxMessageEvents[_0x501f('0x4')](_0x366289,_0x2998db);};}exports['register']=function(_0x227f07){for(var _0xfa196d=0x0,_0x2363da=events['length'];_0xfa196d<_0x2363da;_0xfa196d++){var _0x358336=events[_0xfa196d];var _0x54ca94=createListener(_0x501f('0x5')+_0x358336,_0x227f07);FaxMessageEvents['on'](_0x358336,_0x54ca94);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 7f8b928..7e7fdcf 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 _0xafb9=['../../config/environment','isAuthenticated','get','describe','/:id','show','/:id/download','download','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1ef95c,_0x21a712){var _0x19760b=function(_0x26ed14){while(--_0x26ed14){_0x1ef95c['push'](_0x1ef95c['shift']());}};_0x19760b(++_0x21a712);}(_0xafb9,0x68));var _0x9afb=function(_0x565e56,_0x38a3b5){_0x565e56=_0x565e56-0x0;var _0x15b642=_0xafb9[_0x565e56];return _0x15b642;};'use strict';var multer=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var path=require(_0x9afb('0x2'));var timeout=require(_0x9afb('0x3'));var express=require(_0x9afb('0x4'));var router=express[_0x9afb('0x5')]();var auth=require(_0x9afb('0x6'));var interaction=require(_0x9afb('0x7'));var config=require(_0x9afb('0x8'));var controller=require('./faxMessage.controller');router['get']('/',auth[_0x9afb('0x9')](),controller['index']);router[_0x9afb('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x9afb('0xb')]);router[_0x9afb('0xa')](_0x9afb('0xc'),auth['isAuthenticated'](),controller[_0x9afb('0xd')]);router[_0x9afb('0xa')](_0x9afb('0xe'),auth[_0x9afb('0x9')](),controller[_0x9afb('0xf')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x9afb('0x10')](_0x9afb('0x11'),_0x9afb('0x12')),controller[_0x9afb('0x13')]);router[_0x9afb('0x14')](_0x9afb('0xc'),auth[_0x9afb('0x9')](),controller[_0x9afb('0x15')]);router[_0x9afb('0x14')](_0x9afb('0x16'),auth['isAuthenticated'](),controller[_0x9afb('0x17')]);router['put']('/:id/reject',auth[_0x9afb('0x9')](),controller[_0x9afb('0x18')]);router[_0x9afb('0x19')](_0x9afb('0xc'),auth[_0x9afb('0x9')](),controller[_0x9afb('0x1a')]);module[_0x9afb('0x1b')]=router; \ No newline at end of file +var _0x0120=['./faxMessage.controller','get','isAuthenticated','describe','/:id','/:id/download','download','fax','faxmessage:create','create','put','update','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x41c53d,_0x39ae9a){var _0x5c9c5d=function(_0xe3a88b){while(--_0xe3a88b){_0x41c53d['push'](_0x41c53d['shift']());}};_0x5c9c5d(++_0x39ae9a);}(_0x0120,0x6f));var _0x0012=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x0120[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var path=require(_0x0012('0x2'));var timeout=require(_0x0012('0x3'));var express=require(_0x0012('0x4'));var router=express[_0x0012('0x5')]();var auth=require(_0x0012('0x6'));var interaction=require(_0x0012('0x7'));var config=require(_0x0012('0x8'));var controller=require(_0x0012('0x9'));router[_0x0012('0xa')]('/',auth[_0x0012('0xb')](),controller['index']);router['get']('/describe',auth[_0x0012('0xb')](),controller[_0x0012('0xc')]);router[_0x0012('0xa')](_0x0012('0xd'),auth[_0x0012('0xb')](),controller['show']);router[_0x0012('0xa')](_0x0012('0xe'),auth[_0x0012('0xb')](),controller[_0x0012('0xf')]);router['post']('/',auth[_0x0012('0xb')](),interaction['tracked'](_0x0012('0x10'),_0x0012('0x11')),controller[_0x0012('0x12')]);router[_0x0012('0x13')](_0x0012('0xd'),auth['isAuthenticated'](),controller[_0x0012('0x14')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x0012('0x13')]('/:id/reject',auth[_0x0012('0xb')](),controller[_0x0012('0x15')]);router['delete'](_0x0012('0xd'),auth[_0x0012('0xb')](),controller[_0x0012('0x16')]);module[_0x0012('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 2ee7b95..61f181f 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 _0x18c6=['rrmemory','beepall','roundrobin','exports','name','STRING','INTEGER','ENUM'];(function(_0x827634,_0x348fb5){var _0x24a95b=function(_0x17a4cd){while(--_0x17a4cd){_0x827634['push'](_0x827634['shift']());}};_0x24a95b(++_0x348fb5);}(_0x18c6,0x7b));var _0x618c=function(_0x504819,_0x5cc34c){_0x504819=_0x504819-0x0;var _0xa5e731=_0x18c6[_0x504819];return _0xa5e731;};'use strict';var Sequelize=require('sequelize');module[_0x618c('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x618c('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x618c('0x2')]},'timeout':{'type':Sequelize[_0x618c('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x618c('0x4')](_0x618c('0x5'),_0x618c('0x6'),_0x618c('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x618c('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe493=['STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x5b95f7,_0x312c80){var _0x4a4c7b=function(_0x436013){while(--_0x436013){_0x5b95f7['push'](_0x5b95f7['shift']());}};_0x4a4c7b(++_0x312c80);}(_0xe493,0x11e));var _0x3e49=function(_0x52d39e,_0x423f95){_0x52d39e=_0x52d39e-0x0;var _0x2a25bb=_0xe493[_0x52d39e];return _0x2a25bb;};'use strict';var Sequelize=require(_0x3e49('0x0'));module[_0x3e49('0x1')]={'name':{'type':Sequelize[_0x3e49('0x2')],'unique':_0x3e49('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3e49('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3e49('0x4')](_0x3e49('0x5'),_0x3e49('0x6'),_0x3e49('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index a15764d..45acd83 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 _0x14f8=['destroy','get','FaxQueues','then','stack','name','rawAttributes','model','keys','query','filters','attributes','intersection','fields','nolimit','offset','sort','where','pick','map','type','key','VIRTUAL','filter','FaxQueue','includeAll','include','findAll','catch','show','params','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserFaxQueue','hasOwnProperty','User','findAndCountAll','UserId','agent','faxPause','updatedAt','format','%s/%s','getTeams','findOne','Team','order','addTeams','ids','Agents','removeAgents','removeTeams','addAgents','spread','emit','userFaxQueue:save','isArray','userFaxQueue:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./faxQueue.socket','register','sendStatus','status','end','json','count','limit','reject','save','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x14f8,0x193));var _0x814f=function(_0x1ba821,_0x386a93){_0x1ba821=_0x1ba821-0x0;var _0x4ec9e7=_0x14f8[_0x1ba821];return _0x4ec9e7;};'use strict';var pdf=require(_0x814f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x814f('0x1'));var zipdir=require(_0x814f('0x2'));var jsonpatch=require(_0x814f('0x3'));var rp=require('request-promise');var moment=require(_0x814f('0x4'));var BPromise=require(_0x814f('0x5'));var Mustache=require(_0x814f('0x6'));var util=require(_0x814f('0x7'));var path=require('path');var sox=require(_0x814f('0x8'));var csv=require(_0x814f('0x9'));var ejs=require(_0x814f('0xa'));var fs=require('fs');var _=require(_0x814f('0xb'));var squel=require('squel');var crypto=require(_0x814f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x814f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x814f('0xe'));var Papa=require('papaparse');var authService=require(_0x814f('0xf'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x814f('0x10'));var qs=require(_0x814f('0x11'));var logger=require(_0x814f('0x12'))(_0x814f('0x13'));var utils=require(_0x814f('0x14'));var config=require(_0x814f('0x15'));var db=require(_0x814f('0x16'))['db'];config['redis']=_[_0x814f('0x17')](config[_0x814f('0x18')],{'host':_0x814f('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x814f('0x1a'))[_0x814f('0x1b')](socket);function respondWithStatusCode(_0x417d3b,_0x2af5fb){_0x2af5fb=_0x2af5fb||0xcc;return function(_0x1fea24){if(_0x1fea24){return _0x417d3b[_0x814f('0x1c')](_0x2af5fb);}return _0x417d3b[_0x814f('0x1d')](_0x2af5fb)[_0x814f('0x1e')]();};}function respondWithResult(_0x49c7e6,_0x171ab4){_0x171ab4=_0x171ab4||0xc8;return function(_0x10b981){if(_0x10b981){return _0x49c7e6[_0x814f('0x1d')](_0x171ab4)[_0x814f('0x1f')](_0x10b981);}};}function respondWithFilteredResult(_0x1767fb,_0x1b3633){return function(_0x41179a){if(_0x41179a){var _0x5d8f54=_0x41179a[_0x814f('0x20')],_0x24c03c=_0x1b3633['offset'],_0x5db7b8=_0x1b3633['offset']+_0x1b3633[_0x814f('0x21')],_0x351f3d;if(_0x5db7b8>=_0x5d8f54){_0x5db7b8=_0x5d8f54;_0x351f3d=0xc8;}else{_0x351f3d=0xce;}_0x1767fb['status'](_0x351f3d);return _0x1767fb['set']('Content-Range',_0x24c03c+'-'+_0x5db7b8+'/'+_0x5d8f54)['json'](_0x41179a);}return null;};}function patchUpdates(_0x3722ef){return function(_0x4ece43){try{jsonpatch['apply'](_0x4ece43,_0x3722ef,!![]);}catch(_0x3b792e){return BPromise[_0x814f('0x22')](_0x3b792e);}return _0x4ece43[_0x814f('0x23')]();};}function saveUpdates(_0x5be5ca,_0x10d18c){return function(_0x67d119){if(_0x67d119){return _0x67d119[_0x814f('0x24')](_0x5be5ca)['then'](function(_0x160e6c){return _0x160e6c;});}return null;};}function removeEntity(_0x3c6144,_0x5a6465){return function(_0x35bbe3){if(_0x35bbe3){return _0x35bbe3[_0x814f('0x25')]()['then'](function(){var _0x2e33fc=_0x35bbe3[_0x814f('0x26')]({'plain':!![]});var _0xc162af=_0x814f('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0xc162af,'resourceId':_0x2e33fc['id']}})['then'](function(){return _0x35bbe3;});})[_0x814f('0x28')](function(){_0x3c6144[_0x814f('0x1d')](0xcc)[_0x814f('0x1e')]();});}};}function handleEntityNotFound(_0x2806ee,_0x425890){return function(_0xd4a47c){if(!_0xd4a47c){_0x2806ee[_0x814f('0x1c')](0x194);}return _0xd4a47c;};}function handleError(_0x3bb382,_0x399a96){_0x399a96=_0x399a96||0x1f4;return function(_0x555aa0){logger['error'](_0x555aa0[_0x814f('0x29')]);if(_0x555aa0[_0x814f('0x2a')]){delete _0x555aa0[_0x814f('0x2a')];}_0x3bb382['status'](_0x399a96)['send'](_0x555aa0);};}exports['index']=function(_0x2c1110,_0x317e52){var _0x3350ff={},_0x3dabe2={},_0x252c0d={'count':0x0,'rows':[]};var _0x477116=db['FaxQueue'][_0x814f('0x2b')];_0x3dabe2[_0x814f('0x2c')]=_[_0x814f('0x2d')](_0x477116);_0x3dabe2[_0x814f('0x2e')]=_[_0x814f('0x2d')](_0x2c1110[_0x814f('0x2e')]);_0x3dabe2[_0x814f('0x2f')]=_['intersection'](_0x3dabe2['model'],_0x3dabe2[_0x814f('0x2e')]);_0x3350ff[_0x814f('0x30')]=_[_0x814f('0x31')](_0x3dabe2[_0x814f('0x2c')],qs[_0x814f('0x32')](_0x2c1110[_0x814f('0x2e')][_0x814f('0x32')]));_0x3350ff[_0x814f('0x30')]=_0x3350ff[_0x814f('0x30')]['length']?_0x3350ff[_0x814f('0x30')]:_0x3dabe2[_0x814f('0x2c')];if(!_0x2c1110[_0x814f('0x2e')]['hasOwnProperty'](_0x814f('0x33'))){_0x3350ff['limit']=qs[_0x814f('0x21')](_0x2c1110[_0x814f('0x2e')][_0x814f('0x21')]);_0x3350ff['offset']=qs['offset'](_0x2c1110['query'][_0x814f('0x34')]);}_0x3350ff['order']=qs[_0x814f('0x35')](_0x2c1110['query']['sort']);_0x3350ff[_0x814f('0x36')]=qs[_0x814f('0x2f')](_[_0x814f('0x37')](_0x2c1110[_0x814f('0x2e')],_0x3dabe2[_0x814f('0x2f')]));if(_0x2c1110['query']['filter']){_0x3350ff[_0x814f('0x36')]=_['merge'](_0x3350ff[_0x814f('0x36')],{'$or':_[_0x814f('0x38')](_0x477116,function(_0x3c905e){if(_0x3c905e[_0x814f('0x39')][_0x814f('0x3a')]!==_0x814f('0x3b')){var _0x3aa4dc={};_0x3aa4dc[_0x3c905e['field']]={'$like':'%'+_0x2c1110['query'][_0x814f('0x3c')]+'%'};return _0x3aa4dc;}})});}_0x3350ff=_['merge']({},_0x3350ff,_0x2c1110['options']);var _0x40c97e={'where':_0x3350ff[_0x814f('0x36')]};return db[_0x814f('0x3d')][_0x814f('0x20')](_0x40c97e)[_0x814f('0x28')](function(_0x326966){_0x252c0d['count']=_0x326966;if(_0x2c1110['query'][_0x814f('0x3e')]){_0x3350ff[_0x814f('0x3f')]=[{'all':!![]}];}return db[_0x814f('0x3d')][_0x814f('0x40')](_0x3350ff);})[_0x814f('0x28')](function(_0x406bf8){_0x252c0d['rows']=_0x406bf8;return _0x252c0d;})[_0x814f('0x28')](respondWithFilteredResult(_0x317e52,_0x3350ff))[_0x814f('0x41')](handleError(_0x317e52,null));};exports[_0x814f('0x42')]=function(_0x44ceef,_0x14d532){var _0x468b1a={'raw':!![],'where':{'id':_0x44ceef[_0x814f('0x43')]['id']}},_0x9385e5={};_0x9385e5[_0x814f('0x2c')]=_[_0x814f('0x2d')](db[_0x814f('0x3d')][_0x814f('0x2b')]);_0x9385e5[_0x814f('0x2e')]=_[_0x814f('0x2d')](_0x44ceef[_0x814f('0x2e')]);_0x9385e5[_0x814f('0x2f')]=_[_0x814f('0x31')](_0x9385e5[_0x814f('0x2c')],_0x9385e5[_0x814f('0x2e')]);_0x468b1a[_0x814f('0x30')]=_[_0x814f('0x31')](_0x9385e5[_0x814f('0x2c')],qs[_0x814f('0x32')](_0x44ceef['query']['fields']));_0x468b1a[_0x814f('0x30')]=_0x468b1a[_0x814f('0x30')][_0x814f('0x44')]?_0x468b1a['attributes']:_0x9385e5[_0x814f('0x2c')];if(_0x44ceef[_0x814f('0x2e')]['includeAll']){_0x468b1a[_0x814f('0x3f')]=[{'all':!![]}];}_0x468b1a=_[_0x814f('0x45')]({},_0x468b1a,_0x44ceef[_0x814f('0x46')]);return db['FaxQueue']['find'](_0x468b1a)[_0x814f('0x28')](handleEntityNotFound(_0x14d532,null))[_0x814f('0x28')](respondWithResult(_0x14d532,null))[_0x814f('0x41')](handleError(_0x14d532,null));};exports[_0x814f('0x47')]=function(_0x23875e,_0x5968a7){return db[_0x814f('0x3d')][_0x814f('0x47')](_0x23875e[_0x814f('0x48')],{})[_0x814f('0x28')](function(_0x289b30){var _0x22b53b=_0x23875e[_0x814f('0x49')][_0x814f('0x26')]({'plain':!![]});if(!_0x22b53b)throw new Error(_0x814f('0x4a'));if(_0x22b53b[_0x814f('0x4b')]===_0x814f('0x49')){var _0x402407=_0x289b30[_0x814f('0x26')]({'plain':!![]});var _0x132701=_0x814f('0x27');return db[_0x814f('0x4c')][_0x814f('0x4d')]({'where':{'name':_0x132701,'userProfileId':_0x22b53b['userProfileId']},'raw':!![]})['then'](function(_0x332337){if(_0x332337&&_0x332337[_0x814f('0x4e')]===0x0){return db[_0x814f('0x4f')][_0x814f('0x47')]({'name':_0x402407['name'],'resourceId':_0x402407['id'],'type':_0x332337['name'],'sectionId':_0x332337['id']},{})[_0x814f('0x28')](function(){return _0x289b30;});}else{return _0x289b30;}})[_0x814f('0x41')](function(_0x5187f1){logger[_0x814f('0x50')](_0x814f('0x51'),_0x5187f1);throw _0x5187f1;});}return _0x289b30;})[_0x814f('0x28')](respondWithResult(_0x5968a7,0xc9))[_0x814f('0x41')](handleError(_0x5968a7,null));};exports[_0x814f('0x24')]=function(_0x5d3cf7,_0x2c5c39){if(_0x5d3cf7[_0x814f('0x48')]['id']){delete _0x5d3cf7[_0x814f('0x48')]['id'];}return db[_0x814f('0x3d')]['find']({'where':{'id':_0x5d3cf7['params']['id']}})['then'](handleEntityNotFound(_0x2c5c39,null))[_0x814f('0x28')](saveUpdates(_0x5d3cf7['body'],null))[_0x814f('0x28')](respondWithResult(_0x2c5c39,null))[_0x814f('0x41')](handleError(_0x2c5c39,null));};exports[_0x814f('0x25')]=function(_0x57cb7a,_0x2865de){return db[_0x814f('0x3d')][_0x814f('0x4d')]({'where':{'id':_0x57cb7a[_0x814f('0x43')]['id']}})['then'](handleEntityNotFound(_0x2865de,null))[_0x814f('0x28')](removeEntity(_0x2865de,null))['catch'](handleError(_0x2865de,null));};exports[_0x814f('0x52')]=function(_0x31272f,_0x9eb492){return db[_0x814f('0x3d')][_0x814f('0x52')]()[_0x814f('0x28')](respondWithResult(_0x9eb492,null))[_0x814f('0x41')](handleError(_0x9eb492,null));};exports[_0x814f('0x53')]=function(_0x1b33c4,_0x23db99,_0xfb3052){var _0x4d2698={'raw':!![],'where':{}},_0x5270d4={},_0x725c13;return db['FaxQueue']['findOne']({'where':{'id':_0x1b33c4[_0x814f('0x43')]['id']}})['then'](handleEntityNotFound(_0x23db99,null))[_0x814f('0x28')](function(_0x364094){if(_0x364094){_0x725c13=_0x364094[_0x814f('0x26')]({'plain':!![]});_0x5270d4['model']=_[_0x814f('0x2d')](db[_0x814f('0x54')][_0x814f('0x2b')]);_0x5270d4[_0x814f('0x2e')]=_[_0x814f('0x2d')](_0x1b33c4['query']);_0x5270d4[_0x814f('0x2f')]=_['intersection'](_0x5270d4[_0x814f('0x2c')],_0x5270d4[_0x814f('0x2e')]);_0x4d2698[_0x814f('0x30')]=_[_0x814f('0x31')](_0x5270d4[_0x814f('0x2c')],qs[_0x814f('0x32')](_0x1b33c4[_0x814f('0x2e')][_0x814f('0x32')]));_0x4d2698['attributes']=_0x4d2698[_0x814f('0x30')][_0x814f('0x44')]?_0x4d2698[_0x814f('0x30')]:_0x5270d4[_0x814f('0x2c')];if(!_0x1b33c4['query'][_0x814f('0x55')](_0x814f('0x33'))){_0x4d2698[_0x814f('0x21')]=qs[_0x814f('0x21')](_0x1b33c4['query'][_0x814f('0x21')]);_0x4d2698[_0x814f('0x34')]=qs[_0x814f('0x34')](_0x1b33c4['query'][_0x814f('0x34')]);}_0x4d2698['order']=qs[_0x814f('0x35')](_0x1b33c4[_0x814f('0x2e')][_0x814f('0x35')]);_0x4d2698[_0x814f('0x36')]=qs[_0x814f('0x2f')](_['pick'](_0x1b33c4[_0x814f('0x2e')],_0x5270d4[_0x814f('0x2f')]));_0x4d2698[_0x814f('0x36')]['FaxQueueId']=_0x364094['id'];if(_0x1b33c4[_0x814f('0x2e')]['filter']){_0x4d2698[_0x814f('0x36')]=_[_0x814f('0x45')](_0x4d2698[_0x814f('0x36')],{'$or':_['map'](_0x4d2698['attributes'],function(_0x266419){var _0x492a2c={};_0x492a2c[_0x266419]={'$like':'%'+_0x1b33c4['query'][_0x814f('0x3c')]+'%'};return _0x492a2c;})});}_0x4d2698=_[_0x814f('0x45')]({},_0x4d2698,_0x1b33c4[_0x814f('0x46')]);return db[_0x814f('0x54')][_0x814f('0x40')](_0x4d2698);}})[_0x814f('0x28')](function(_0x397d14){if(_0x397d14){return db[_0x814f('0x56')][_0x814f('0x57')]({'where':{'id':_[_0x814f('0x38')](_0x397d14,_0x814f('0x58')),'role':_0x814f('0x59')},'attributes':['id',_0x814f('0x2a'),_0x814f('0x5a'),_0x814f('0x5b'),'createdAt']});}})[_0x814f('0x28')](function(_0x2d9719){if(_0x2d9719){return{'count':_0x2d9719['count'],'rows':_[_0x814f('0x38')](_0x2d9719['rows'],function(_0x443cda){return{'membername':_0x443cda['name'],'UserId':_0x443cda['id'],'queue_name':_0x725c13[_0x814f('0x2a')],'FaxQueueId':_0x725c13['id'],'interface':util[_0x814f('0x5c')](_0x814f('0x5d'),'SIP',_0x443cda[_0x814f('0x2a')]),'penalty':0x0,'paused':_0x443cda[_0x814f('0x5a')],'createdAt':_0x443cda['createdAt'],'updatedAt':_0x443cda['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x814f('0x28')](respondWithFilteredResult(_0x23db99,_0x4d2698))[_0x814f('0x41')](handleError(_0x23db99,null));};exports[_0x814f('0x5e')]=function(_0x5273f5,_0x1e49dd,_0x20aadb){var _0x4be689={};var _0x1249a5={};var _0x238d5c;var _0x18919d;return db[_0x814f('0x3d')][_0x814f('0x5f')]({'where':{'id':_0x5273f5[_0x814f('0x43')]['id']}})['then'](handleEntityNotFound(_0x1e49dd,null))['then'](function(_0x1ac836){if(_0x1ac836){_0x238d5c=_0x1ac836;_0x1249a5[_0x814f('0x2c')]=_['keys'](db[_0x814f('0x60')][_0x814f('0x2b')]);_0x1249a5[_0x814f('0x2e')]=_[_0x814f('0x2d')](_0x5273f5[_0x814f('0x2e')]);_0x1249a5[_0x814f('0x2f')]=_[_0x814f('0x31')](_0x1249a5[_0x814f('0x2c')],_0x1249a5['query']);_0x4be689[_0x814f('0x30')]=_['intersection'](_0x1249a5[_0x814f('0x2c')],qs['fields'](_0x5273f5[_0x814f('0x2e')][_0x814f('0x32')]));_0x4be689['attributes']=_0x4be689[_0x814f('0x30')][_0x814f('0x44')]?_0x4be689[_0x814f('0x30')]:_0x1249a5[_0x814f('0x2c')];_0x4be689[_0x814f('0x61')]=qs[_0x814f('0x35')](_0x5273f5[_0x814f('0x2e')]['sort']);_0x4be689[_0x814f('0x36')]=qs[_0x814f('0x2f')](_[_0x814f('0x37')](_0x5273f5[_0x814f('0x2e')],_0x1249a5[_0x814f('0x2f')]));if(_0x5273f5['query'][_0x814f('0x3c')]){_0x4be689['where']=_[_0x814f('0x45')](_0x4be689[_0x814f('0x36')],{'$or':_['map'](_0x4be689[_0x814f('0x30')],function(_0x11be73){var _0x583f05={};_0x583f05[_0x11be73]={'$like':'%'+_0x5273f5[_0x814f('0x2e')][_0x814f('0x3c')]+'%'};return _0x583f05;})});}_0x4be689=_[_0x814f('0x45')]({},_0x4be689,_0x5273f5[_0x814f('0x46')]);return _0x238d5c[_0x814f('0x5e')](_0x4be689);}})[_0x814f('0x28')](function(_0x20ea20){if(_0x20ea20){_0x18919d=_0x20ea20['length'];if(!_0x5273f5['query']['hasOwnProperty']('nolimit')){_0x4be689[_0x814f('0x21')]=qs[_0x814f('0x21')](_0x5273f5[_0x814f('0x2e')]['limit']);_0x4be689[_0x814f('0x34')]=qs[_0x814f('0x34')](_0x5273f5[_0x814f('0x2e')]['offset']);}return _0x238d5c[_0x814f('0x5e')](_0x4be689);}})[_0x814f('0x28')](function(_0x44e129){if(_0x44e129){return _0x44e129?{'count':_0x18919d,'rows':_0x44e129}:null;}})[_0x814f('0x28')](respondWithResult(_0x1e49dd,null))[_0x814f('0x41')](handleError(_0x1e49dd,null));};exports[_0x814f('0x62')]=function(_0x2f3cff,_0x3a5b51,_0x52ec85){var _0x279143=[];var _0x2d999f;return db[_0x814f('0x60')]['findAll']({'where':{'id':_0x2f3cff[_0x814f('0x48')][_0x814f('0x63')]},'attributes':['id'],'include':[{'model':db[_0x814f('0x56')],'as':_0x814f('0x64'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x1b3e3f){if(_0x1b3e3f){for(var _0x1711b9=0x0;_0x1711b9<_0x1b3e3f['length'];_0x1711b9+=0x1){for(var _0x32dc9d=0x0;_0x32dc9d<_0x1b3e3f[_0x1711b9][_0x814f('0x64')][_0x814f('0x44')];_0x32dc9d+=0x1){_0x279143=_['union'](_0x279143,[_0x1b3e3f[_0x1711b9][_0x814f('0x64')][_0x32dc9d]['id']]);}}return _0x279143;}})[_0x814f('0x28')](function(_0x485a71){if(_0x485a71){return db[_0x814f('0x3d')][_0x814f('0x4d')]({'where':{'id':_0x2f3cff[_0x814f('0x43')]['id']}});}})[_0x814f('0x28')](function(_0x4eadfc){if(_0x4eadfc){_0x2d999f=_0x4eadfc;return _0x2d999f['addAgents'](_0x279143,{'penalty':_0x2f3cff[_0x814f('0x48')]['penalty']});}})[_0x814f('0x28')](function(_0x360973){if(_0x360973){return _0x2d999f[_0x814f('0x62')](_0x2f3cff[_0x814f('0x48')][_0x814f('0x63')]);}})['then'](handleEntityNotFound(_0x3a5b51,null))['then'](respondWithStatusCode(_0x3a5b51,null))[_0x814f('0x41')](handleError(_0x3a5b51,null));};exports['removeTeams']=function(_0x35b419,_0x329ee8,_0x2bef54){var _0x1c50c0=[];var _0x127d96;return db[_0x814f('0x60')]['findAll']({'where':{'id':_0x35b419[_0x814f('0x2e')][_0x814f('0x63')]},'attributes':['id'],'include':[{'model':db[_0x814f('0x56')],'as':_0x814f('0x64'),'attributes':['id'],'raw':!![]}]})[_0x814f('0x28')](function(_0x26dd9f){if(_0x26dd9f){for(var _0x4dd480=0x0;_0x4dd480<_0x26dd9f[_0x814f('0x44')];_0x4dd480+=0x1){for(var _0x46e36c=0x0;_0x46e36c<_0x26dd9f[_0x4dd480][_0x814f('0x64')][_0x814f('0x44')];_0x46e36c+=0x1){_0x1c50c0=_['union'](_0x1c50c0,[_0x26dd9f[_0x4dd480][_0x814f('0x64')][_0x46e36c]['id']]);}}return _0x1c50c0;}})[_0x814f('0x28')](function(_0x21e0ca){if(_0x21e0ca){return db[_0x814f('0x3d')]['find']({'where':{'id':_0x35b419[_0x814f('0x43')]['id']}});}})[_0x814f('0x28')](function(_0x5c37c5){if(_0x5c37c5){_0x127d96=_0x5c37c5;return _0x127d96[_0x814f('0x65')](_0x1c50c0);}})[_0x814f('0x28')](function(_0x4d5bde){if(_0x127d96){return _0x127d96[_0x814f('0x66')](_0x35b419[_0x814f('0x2e')]['ids']);}})[_0x814f('0x28')](handleEntityNotFound(_0x329ee8,null))[_0x814f('0x28')](respondWithStatusCode(_0x329ee8,null))[_0x814f('0x41')](handleError(_0x329ee8,null));};exports[_0x814f('0x67')]=function(_0x168a4b,_0x325478,_0x530732){return db[_0x814f('0x3d')]['find']({'where':{'id':_0x168a4b[_0x814f('0x43')]['id']}})[_0x814f('0x28')](handleEntityNotFound(_0x325478,null))[_0x814f('0x28')](function(_0x3e49ac){if(_0x3e49ac){return _0x3e49ac[_0x814f('0x67')](_0x168a4b['body'][_0x814f('0x63')],_['omit'](_0x168a4b[_0x814f('0x48')],[_0x814f('0x63'),'id'])||{})[_0x814f('0x68')](function(_0x479485){for(var _0x2e4760=0x0;_0x2e4760<_0x168a4b[_0x814f('0x48')][_0x814f('0x63')][_0x814f('0x44')];_0x2e4760+=0x1){socket[_0x814f('0x69')](_0x814f('0x6a'),{'UserId':_0x168a4b[_0x814f('0x48')][_0x814f('0x63')][_0x2e4760],'FaxQueueId':_0x168a4b['params']['id']});}return _0x479485;});}})['then'](respondWithResult(_0x325478,null))[_0x814f('0x41')](handleError(_0x325478,null));};exports[_0x814f('0x65')]=function(_0x141231,_0x2c9c49,_0x5a92bb){var _0x20f963;return db[_0x814f('0x3d')]['find']({'where':{'id':_0x141231['params']['id']}})['then'](handleEntityNotFound(_0x2c9c49,null))['then'](function(_0x38f615){if(_0x38f615){return _0x38f615[_0x814f('0x65')](_0x141231['query']['ids'])['then'](function(_0x8619f7){if(_[_0x814f('0x6b')](_0x141231['query'][_0x814f('0x63')])){for(var _0x8ed296=0x0;_0x8ed296<_0x141231['query']['ids'][_0x814f('0x44')];_0x8ed296+=0x1){socket[_0x814f('0x69')](_0x814f('0x6c'),{'UserId':_0x141231[_0x814f('0x2e')][_0x814f('0x63')][_0x8ed296],'FaxQueueId':_0x141231['params']['id']});}}else{socket[_0x814f('0x69')]('userFaxQueue:remove',{'UserId':_0x141231['query']['ids'],'FaxQueueId':_0x141231[_0x814f('0x43')]['id']});}});}})[_0x814f('0x28')](respondWithStatusCode(_0x2c9c49,null))[_0x814f('0x41')](handleError(_0x2c9c49,null));};exports[_0x814f('0x6d')]=function(_0x359a85,_0x58c0f3,_0x3391b6){var _0x8dcd56={};var _0x26c6e6={};var _0x3e15a1;var _0xc1f030;return db[_0x814f('0x3d')]['findOne']({'where':{'id':_0x359a85[_0x814f('0x43')]['id']}})[_0x814f('0x28')](handleEntityNotFound(_0x58c0f3,null))['then'](function(_0x345403){if(_0x345403){_0x3e15a1=_0x345403;_0x26c6e6[_0x814f('0x2c')]=_[_0x814f('0x2d')](db['User'][_0x814f('0x2b')]);_0x26c6e6['query']=_[_0x814f('0x2d')](_0x359a85['query']);_0x26c6e6['filters']=_[_0x814f('0x31')](_0x26c6e6[_0x814f('0x2c')],_0x26c6e6['query']);_0x8dcd56['attributes']=_[_0x814f('0x31')](_0x26c6e6[_0x814f('0x2c')],qs[_0x814f('0x32')](_0x359a85[_0x814f('0x2e')]['fields']));_0x8dcd56[_0x814f('0x30')]=_0x8dcd56[_0x814f('0x30')]['length']?_0x8dcd56[_0x814f('0x30')]:_0x26c6e6[_0x814f('0x2c')];_0x8dcd56[_0x814f('0x61')]=qs[_0x814f('0x35')](_0x359a85['query'][_0x814f('0x35')]);_0x8dcd56[_0x814f('0x36')]=qs['filters'](_[_0x814f('0x37')](_0x359a85[_0x814f('0x2e')],_0x26c6e6[_0x814f('0x2f')]));if(_0x359a85['query']['filter']){_0x8dcd56[_0x814f('0x36')]=_[_0x814f('0x45')](_0x8dcd56[_0x814f('0x36')],{'$or':_[_0x814f('0x38')](_0x8dcd56[_0x814f('0x30')],function(_0x4d3e6e){var _0x3fb6a0={};_0x3fb6a0[_0x4d3e6e]={'$like':'%'+_0x359a85['query'][_0x814f('0x3c')]+'%'};return _0x3fb6a0;})});}_0x8dcd56=_[_0x814f('0x45')]({},_0x8dcd56,_0x359a85['options']);return _0x3e15a1[_0x814f('0x6d')](_0x8dcd56);}})['then'](function(_0x3243ba){if(_0x3243ba){_0xc1f030=_0x3243ba[_0x814f('0x44')];if(!_0x359a85[_0x814f('0x2e')][_0x814f('0x55')](_0x814f('0x33'))){_0x8dcd56[_0x814f('0x21')]=qs[_0x814f('0x21')](_0x359a85[_0x814f('0x2e')][_0x814f('0x21')]);_0x8dcd56['offset']=qs[_0x814f('0x34')](_0x359a85['query'][_0x814f('0x34')]);}return _0x3e15a1[_0x814f('0x6d')](_0x8dcd56);}})['then'](function(_0x41a142){if(_0x41a142){return _0x41a142?{'count':_0xc1f030,'rows':_0x41a142}:null;}})['then'](respondWithResult(_0x58c0f3,null))[_0x814f('0x41')](handleError(_0x58c0f3,null));}; \ No newline at end of file +var _0x048f=['format','%s/%s','SIP','Team','rawAttributes','getTeams','addTeams','ids','Agents','union','addAgents','penalty','removeAgents','removeTeams','omit','spread','emit','userFaxQueue:save','getAgents','pick','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','register','status','end','count','offset','set','Content-Range','json','apply','save','update','then','destroy','UserProfileResource','sendStatus','error','name','index','FaxQueue','model','keys','filters','attributes','intersection','length','query','limit','where','filter','map','type','key','merge','options','include','findAll','catch','show','params','fields','includeAll','find','create','body','user','get','role','FaxQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','order','sort','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','rows'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x048f,0x1e4));var _0xf048=function(_0x91a679,_0x1441cd){_0x91a679=_0x91a679-0x0;var _0x18fd1d=_0x048f[_0x91a679];return _0x18fd1d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf048('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf048('0x1'));var rp=require(_0xf048('0x2'));var moment=require(_0xf048('0x3'));var BPromise=require(_0xf048('0x4'));var Mustache=require(_0xf048('0x5'));var util=require(_0xf048('0x6'));var path=require(_0xf048('0x7'));var sox=require(_0xf048('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf048('0x9'));var crypto=require(_0xf048('0xa'));var jsforce=require(_0xf048('0xb'));var deskjs=require(_0xf048('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf048('0xd'));var Papa=require(_0xf048('0xe'));var authService=require(_0xf048('0xf'));var hardwareService=require(_0xf048('0x10'));var Redis=require(_0xf048('0x11'));var qs=require(_0xf048('0x12'));var logger=require(_0xf048('0x13'))('api');var utils=require(_0xf048('0x14'));var config=require(_0xf048('0x15'));var db=require(_0xf048('0x16'))['db'];config[_0xf048('0x17')]=_[_0xf048('0x18')](config[_0xf048('0x17')],{'host':_0xf048('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf048('0x17')]));require(_0xf048('0x1a'))[_0xf048('0x1b')](socket);function respondWithStatusCode(_0x3bc692,_0x1a8480){_0x1a8480=_0x1a8480||0xcc;return function(_0x361adc){if(_0x361adc){return _0x3bc692['sendStatus'](_0x1a8480);}return _0x3bc692[_0xf048('0x1c')](_0x1a8480)[_0xf048('0x1d')]();};}function respondWithResult(_0x1903bf,_0x2bdd6a){_0x2bdd6a=_0x2bdd6a||0xc8;return function(_0x48bcf3){if(_0x48bcf3){return _0x1903bf[_0xf048('0x1c')](_0x2bdd6a)['json'](_0x48bcf3);}};}function respondWithFilteredResult(_0x5917cd,_0x333e5d){return function(_0x27c61d){if(_0x27c61d){var _0x1e3b08=_0x27c61d[_0xf048('0x1e')],_0x985eaa=_0x333e5d[_0xf048('0x1f')],_0x1ce656=_0x333e5d[_0xf048('0x1f')]+_0x333e5d['limit'],_0x22df0e;if(_0x1ce656>=_0x1e3b08){_0x1ce656=_0x1e3b08;_0x22df0e=0xc8;}else{_0x22df0e=0xce;}_0x5917cd['status'](_0x22df0e);return _0x5917cd[_0xf048('0x20')](_0xf048('0x21'),_0x985eaa+'-'+_0x1ce656+'/'+_0x1e3b08)[_0xf048('0x22')](_0x27c61d);}return null;};}function patchUpdates(_0x39f2cf){return function(_0x304a28){try{jsonpatch[_0xf048('0x23')](_0x304a28,_0x39f2cf,!![]);}catch(_0x5704e9){return BPromise['reject'](_0x5704e9);}return _0x304a28[_0xf048('0x24')]();};}function saveUpdates(_0x4890f8,_0x5eb54b){return function(_0x31ba28){if(_0x31ba28){return _0x31ba28[_0xf048('0x25')](_0x4890f8)[_0xf048('0x26')](function(_0x38d571){return _0x38d571;});}return null;};}function removeEntity(_0x55eb35,_0x3d69ba){return function(_0x18c751){if(_0x18c751){return _0x18c751[_0xf048('0x27')]()[_0xf048('0x26')](function(){var _0x396d2b=_0x18c751['get']({'plain':!![]});var _0x24600e='FaxQueues';return db[_0xf048('0x28')]['destroy']({'where':{'type':_0x24600e,'resourceId':_0x396d2b['id']}})[_0xf048('0x26')](function(){return _0x18c751;});})[_0xf048('0x26')](function(){_0x55eb35[_0xf048('0x1c')](0xcc)[_0xf048('0x1d')]();});}};}function handleEntityNotFound(_0xc9ec5,_0x547529){return function(_0x17f360){if(!_0x17f360){_0xc9ec5[_0xf048('0x29')](0x194);}return _0x17f360;};}function handleError(_0x5ae68c,_0x59c998){_0x59c998=_0x59c998||0x1f4;return function(_0x157f60){logger[_0xf048('0x2a')](_0x157f60['stack']);if(_0x157f60[_0xf048('0x2b')]){delete _0x157f60['name'];}_0x5ae68c[_0xf048('0x1c')](_0x59c998)['send'](_0x157f60);};}exports[_0xf048('0x2c')]=function(_0x47e4dc,_0x57a24f){var _0x154492={},_0x25f3d3={},_0x4169ec={'count':0x0,'rows':[]};var _0x1c114f=db[_0xf048('0x2d')]['rawAttributes'];_0x25f3d3[_0xf048('0x2e')]=_[_0xf048('0x2f')](_0x1c114f);_0x25f3d3['query']=_[_0xf048('0x2f')](_0x47e4dc['query']);_0x25f3d3[_0xf048('0x30')]=_['intersection'](_0x25f3d3['model'],_0x25f3d3['query']);_0x154492[_0xf048('0x31')]=_[_0xf048('0x32')](_0x25f3d3[_0xf048('0x2e')],qs['fields'](_0x47e4dc['query']['fields']));_0x154492[_0xf048('0x31')]=_0x154492[_0xf048('0x31')][_0xf048('0x33')]?_0x154492['attributes']:_0x25f3d3['model'];if(!_0x47e4dc[_0xf048('0x34')]['hasOwnProperty']('nolimit')){_0x154492[_0xf048('0x35')]=qs[_0xf048('0x35')](_0x47e4dc['query'][_0xf048('0x35')]);_0x154492[_0xf048('0x1f')]=qs['offset'](_0x47e4dc[_0xf048('0x34')][_0xf048('0x1f')]);}_0x154492['order']=qs['sort'](_0x47e4dc['query']['sort']);_0x154492[_0xf048('0x36')]=qs[_0xf048('0x30')](_['pick'](_0x47e4dc[_0xf048('0x34')],_0x25f3d3[_0xf048('0x30')]));if(_0x47e4dc[_0xf048('0x34')][_0xf048('0x37')]){_0x154492[_0xf048('0x36')]=_['merge'](_0x154492['where'],{'$or':_[_0xf048('0x38')](_0x1c114f,function(_0x5139ca){if(_0x5139ca[_0xf048('0x39')][_0xf048('0x3a')]!=='VIRTUAL'){var _0x2918e6={};_0x2918e6[_0x5139ca['field']]={'$like':'%'+_0x47e4dc['query'][_0xf048('0x37')]+'%'};return _0x2918e6;}})});}_0x154492=_[_0xf048('0x3b')]({},_0x154492,_0x47e4dc[_0xf048('0x3c')]);var _0x3ac6e8={'where':_0x154492[_0xf048('0x36')]};return db[_0xf048('0x2d')][_0xf048('0x1e')](_0x3ac6e8)[_0xf048('0x26')](function(_0x4ec877){_0x4169ec[_0xf048('0x1e')]=_0x4ec877;if(_0x47e4dc[_0xf048('0x34')]['includeAll']){_0x154492[_0xf048('0x3d')]=[{'all':!![]}];}return db[_0xf048('0x2d')][_0xf048('0x3e')](_0x154492);})[_0xf048('0x26')](function(_0x1ee621){_0x4169ec['rows']=_0x1ee621;return _0x4169ec;})[_0xf048('0x26')](respondWithFilteredResult(_0x57a24f,_0x154492))[_0xf048('0x3f')](handleError(_0x57a24f,null));};exports[_0xf048('0x40')]=function(_0xe5fd02,_0x216fe0){var _0x1bd3c5={'raw':!![],'where':{'id':_0xe5fd02[_0xf048('0x41')]['id']}},_0x39979d={};_0x39979d['model']=_[_0xf048('0x2f')](db[_0xf048('0x2d')]['rawAttributes']);_0x39979d[_0xf048('0x34')]=_[_0xf048('0x2f')](_0xe5fd02[_0xf048('0x34')]);_0x39979d[_0xf048('0x30')]=_['intersection'](_0x39979d[_0xf048('0x2e')],_0x39979d[_0xf048('0x34')]);_0x1bd3c5['attributes']=_['intersection'](_0x39979d['model'],qs[_0xf048('0x42')](_0xe5fd02[_0xf048('0x34')]['fields']));_0x1bd3c5[_0xf048('0x31')]=_0x1bd3c5[_0xf048('0x31')][_0xf048('0x33')]?_0x1bd3c5['attributes']:_0x39979d['model'];if(_0xe5fd02[_0xf048('0x34')][_0xf048('0x43')]){_0x1bd3c5[_0xf048('0x3d')]=[{'all':!![]}];}_0x1bd3c5=_[_0xf048('0x3b')]({},_0x1bd3c5,_0xe5fd02['options']);return db[_0xf048('0x2d')][_0xf048('0x44')](_0x1bd3c5)[_0xf048('0x26')](handleEntityNotFound(_0x216fe0,null))['then'](respondWithResult(_0x216fe0,null))['catch'](handleError(_0x216fe0,null));};exports['create']=function(_0x27fcd2,_0x292b38){return db[_0xf048('0x2d')][_0xf048('0x45')](_0x27fcd2[_0xf048('0x46')],{})[_0xf048('0x26')](function(_0x1c8b92){var _0x12702f=_0x27fcd2[_0xf048('0x47')][_0xf048('0x48')]({'plain':!![]});if(!_0x12702f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12702f[_0xf048('0x49')]==='user'){var _0x3a3aa8=_0x1c8b92[_0xf048('0x48')]({'plain':!![]});var _0x192b63=_0xf048('0x4a');return db[_0xf048('0x4b')][_0xf048('0x44')]({'where':{'name':_0x192b63,'userProfileId':_0x12702f[_0xf048('0x4c')]},'raw':!![]})[_0xf048('0x26')](function(_0x2a5c06){if(_0x2a5c06&&_0x2a5c06[_0xf048('0x4d')]===0x0){return db['UserProfileResource'][_0xf048('0x45')]({'name':_0x3a3aa8[_0xf048('0x2b')],'resourceId':_0x3a3aa8['id'],'type':_0x2a5c06[_0xf048('0x2b')],'sectionId':_0x2a5c06['id']},{})[_0xf048('0x26')](function(){return _0x1c8b92;});}else{return _0x1c8b92;}})[_0xf048('0x3f')](function(_0x469914){logger[_0xf048('0x2a')](_0xf048('0x4e'),_0x469914);throw _0x469914;});}return _0x1c8b92;})[_0xf048('0x26')](respondWithResult(_0x292b38,0xc9))[_0xf048('0x3f')](handleError(_0x292b38,null));};exports[_0xf048('0x25')]=function(_0x29114f,_0x45fda3){if(_0x29114f[_0xf048('0x46')]['id']){delete _0x29114f[_0xf048('0x46')]['id'];}return db[_0xf048('0x2d')][_0xf048('0x44')]({'where':{'id':_0x29114f[_0xf048('0x41')]['id']}})[_0xf048('0x26')](handleEntityNotFound(_0x45fda3,null))['then'](saveUpdates(_0x29114f[_0xf048('0x46')],null))[_0xf048('0x26')](respondWithResult(_0x45fda3,null))[_0xf048('0x3f')](handleError(_0x45fda3,null));};exports[_0xf048('0x27')]=function(_0xc34434,_0x1e3655){return db[_0xf048('0x2d')][_0xf048('0x44')]({'where':{'id':_0xc34434[_0xf048('0x41')]['id']}})[_0xf048('0x26')](handleEntityNotFound(_0x1e3655,null))[_0xf048('0x26')](removeEntity(_0x1e3655,null))['catch'](handleError(_0x1e3655,null));};exports['describe']=function(_0x23efe9,_0x36a2b2){return db['FaxQueue'][_0xf048('0x4f')]()[_0xf048('0x26')](respondWithResult(_0x36a2b2,null))['catch'](handleError(_0x36a2b2,null));};exports[_0xf048('0x50')]=function(_0x3ecf07,_0x3d6f1e,_0x5d733e){var _0x4332a9={'raw':!![],'where':{}},_0x3ebeb8={},_0x3e8c4e;return db[_0xf048('0x2d')][_0xf048('0x51')]({'where':{'id':_0x3ecf07[_0xf048('0x41')]['id']}})['then'](handleEntityNotFound(_0x3d6f1e,null))[_0xf048('0x26')](function(_0xe861e4){if(_0xe861e4){_0x3e8c4e=_0xe861e4[_0xf048('0x48')]({'plain':!![]});_0x3ebeb8[_0xf048('0x2e')]=_['keys'](db[_0xf048('0x52')]['rawAttributes']);_0x3ebeb8[_0xf048('0x34')]=_[_0xf048('0x2f')](_0x3ecf07[_0xf048('0x34')]);_0x3ebeb8[_0xf048('0x30')]=_[_0xf048('0x32')](_0x3ebeb8[_0xf048('0x2e')],_0x3ebeb8[_0xf048('0x34')]);_0x4332a9[_0xf048('0x31')]=_[_0xf048('0x32')](_0x3ebeb8[_0xf048('0x2e')],qs[_0xf048('0x42')](_0x3ecf07[_0xf048('0x34')][_0xf048('0x42')]));_0x4332a9[_0xf048('0x31')]=_0x4332a9[_0xf048('0x31')][_0xf048('0x33')]?_0x4332a9[_0xf048('0x31')]:_0x3ebeb8['model'];if(!_0x3ecf07[_0xf048('0x34')][_0xf048('0x53')](_0xf048('0x54'))){_0x4332a9[_0xf048('0x35')]=qs[_0xf048('0x35')](_0x3ecf07['query'][_0xf048('0x35')]);_0x4332a9['offset']=qs[_0xf048('0x1f')](_0x3ecf07['query'][_0xf048('0x1f')]);}_0x4332a9[_0xf048('0x55')]=qs[_0xf048('0x56')](_0x3ecf07[_0xf048('0x34')][_0xf048('0x56')]);_0x4332a9[_0xf048('0x36')]=qs[_0xf048('0x30')](_['pick'](_0x3ecf07[_0xf048('0x34')],_0x3ebeb8[_0xf048('0x30')]));_0x4332a9[_0xf048('0x36')][_0xf048('0x57')]=_0xe861e4['id'];if(_0x3ecf07[_0xf048('0x34')]['filter']){_0x4332a9[_0xf048('0x36')]=_[_0xf048('0x3b')](_0x4332a9[_0xf048('0x36')],{'$or':_[_0xf048('0x38')](_0x4332a9['attributes'],function(_0x24ee4d){var _0x172c25={};_0x172c25[_0x24ee4d]={'$like':'%'+_0x3ecf07[_0xf048('0x34')][_0xf048('0x37')]+'%'};return _0x172c25;})});}_0x4332a9=_[_0xf048('0x3b')]({},_0x4332a9,_0x3ecf07['options']);return db[_0xf048('0x52')][_0xf048('0x3e')](_0x4332a9);}})[_0xf048('0x26')](function(_0xdeb79b){if(_0xdeb79b){return db[_0xf048('0x58')][_0xf048('0x59')]({'where':{'id':_[_0xf048('0x38')](_0xdeb79b,_0xf048('0x5a')),'role':_0xf048('0x5b')},'attributes':['id',_0xf048('0x2b'),_0xf048('0x5c'),_0xf048('0x5d'),_0xf048('0x5e')]});}})['then'](function(_0x5c4dc4){if(_0x5c4dc4){return{'count':_0x5c4dc4[_0xf048('0x1e')],'rows':_[_0xf048('0x38')](_0x5c4dc4[_0xf048('0x5f')],function(_0x1c4775){return{'membername':_0x1c4775['name'],'UserId':_0x1c4775['id'],'queue_name':_0x3e8c4e[_0xf048('0x2b')],'FaxQueueId':_0x3e8c4e['id'],'interface':util[_0xf048('0x60')](_0xf048('0x61'),_0xf048('0x62'),_0x1c4775[_0xf048('0x2b')]),'penalty':0x0,'paused':_0x1c4775['faxPause'],'createdAt':_0x1c4775[_0xf048('0x5e')],'updatedAt':_0x1c4775[_0xf048('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf048('0x26')](respondWithFilteredResult(_0x3d6f1e,_0x4332a9))[_0xf048('0x3f')](handleError(_0x3d6f1e,null));};exports['getTeams']=function(_0x2d744b,_0x1f4c0f,_0x12509d){var _0x406451={};var _0x3c1a31={};var _0x5a8b99;var _0xd1486f;return db['FaxQueue'][_0xf048('0x51')]({'where':{'id':_0x2d744b[_0xf048('0x41')]['id']}})[_0xf048('0x26')](handleEntityNotFound(_0x1f4c0f,null))[_0xf048('0x26')](function(_0x2a981d){if(_0x2a981d){_0x5a8b99=_0x2a981d;_0x3c1a31[_0xf048('0x2e')]=_[_0xf048('0x2f')](db[_0xf048('0x63')][_0xf048('0x64')]);_0x3c1a31[_0xf048('0x34')]=_['keys'](_0x2d744b[_0xf048('0x34')]);_0x3c1a31[_0xf048('0x30')]=_[_0xf048('0x32')](_0x3c1a31['model'],_0x3c1a31[_0xf048('0x34')]);_0x406451[_0xf048('0x31')]=_[_0xf048('0x32')](_0x3c1a31[_0xf048('0x2e')],qs[_0xf048('0x42')](_0x2d744b['query'][_0xf048('0x42')]));_0x406451[_0xf048('0x31')]=_0x406451[_0xf048('0x31')][_0xf048('0x33')]?_0x406451[_0xf048('0x31')]:_0x3c1a31[_0xf048('0x2e')];_0x406451[_0xf048('0x55')]=qs[_0xf048('0x56')](_0x2d744b[_0xf048('0x34')][_0xf048('0x56')]);_0x406451[_0xf048('0x36')]=qs[_0xf048('0x30')](_['pick'](_0x2d744b['query'],_0x3c1a31[_0xf048('0x30')]));if(_0x2d744b['query']['filter']){_0x406451[_0xf048('0x36')]=_[_0xf048('0x3b')](_0x406451[_0xf048('0x36')],{'$or':_[_0xf048('0x38')](_0x406451[_0xf048('0x31')],function(_0x501c7d){var _0xfa013={};_0xfa013[_0x501c7d]={'$like':'%'+_0x2d744b[_0xf048('0x34')][_0xf048('0x37')]+'%'};return _0xfa013;})});}_0x406451=_['merge']({},_0x406451,_0x2d744b[_0xf048('0x3c')]);return _0x5a8b99[_0xf048('0x65')](_0x406451);}})['then'](function(_0x831631){if(_0x831631){_0xd1486f=_0x831631[_0xf048('0x33')];if(!_0x2d744b['query'][_0xf048('0x53')](_0xf048('0x54'))){_0x406451[_0xf048('0x35')]=qs[_0xf048('0x35')](_0x2d744b[_0xf048('0x34')]['limit']);_0x406451[_0xf048('0x1f')]=qs[_0xf048('0x1f')](_0x2d744b['query'][_0xf048('0x1f')]);}return _0x5a8b99['getTeams'](_0x406451);}})['then'](function(_0x11a1a5){if(_0x11a1a5){return _0x11a1a5?{'count':_0xd1486f,'rows':_0x11a1a5}:null;}})[_0xf048('0x26')](respondWithResult(_0x1f4c0f,null))['catch'](handleError(_0x1f4c0f,null));};exports[_0xf048('0x66')]=function(_0xd1131e,_0x473f4b,_0x3750d7){var _0xc1ea69=[];var _0x3076d8;return db[_0xf048('0x63')][_0xf048('0x3e')]({'where':{'id':_0xd1131e[_0xf048('0x46')][_0xf048('0x67')]},'attributes':['id'],'include':[{'model':db[_0xf048('0x58')],'as':_0xf048('0x68'),'attributes':['id'],'raw':!![]}]})[_0xf048('0x26')](function(_0x12a84d){if(_0x12a84d){for(var _0x1542c1=0x0;_0x1542c1<_0x12a84d[_0xf048('0x33')];_0x1542c1+=0x1){for(var _0x59d01f=0x0;_0x59d01f<_0x12a84d[_0x1542c1]['Agents'][_0xf048('0x33')];_0x59d01f+=0x1){_0xc1ea69=_[_0xf048('0x69')](_0xc1ea69,[_0x12a84d[_0x1542c1][_0xf048('0x68')][_0x59d01f]['id']]);}}return _0xc1ea69;}})[_0xf048('0x26')](function(_0x2482df){if(_0x2482df){return db[_0xf048('0x2d')][_0xf048('0x44')]({'where':{'id':_0xd1131e[_0xf048('0x41')]['id']}});}})[_0xf048('0x26')](function(_0x924718){if(_0x924718){_0x3076d8=_0x924718;return _0x3076d8[_0xf048('0x6a')](_0xc1ea69,{'penalty':_0xd1131e[_0xf048('0x46')][_0xf048('0x6b')]});}})[_0xf048('0x26')](function(_0x51e5fc){if(_0x51e5fc){return _0x3076d8[_0xf048('0x66')](_0xd1131e['body'][_0xf048('0x67')]);}})[_0xf048('0x26')](handleEntityNotFound(_0x473f4b,null))[_0xf048('0x26')](respondWithStatusCode(_0x473f4b,null))[_0xf048('0x3f')](handleError(_0x473f4b,null));};exports['removeTeams']=function(_0x2000c6,_0x8bddcb,_0x54d6a0){var _0x571f29=[];var _0x53b693;return db['Team'][_0xf048('0x3e')]({'where':{'id':_0x2000c6[_0xf048('0x34')][_0xf048('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf048('0x68'),'attributes':['id'],'raw':!![]}]})[_0xf048('0x26')](function(_0x4c1ba3){if(_0x4c1ba3){for(var _0x4ffe7d=0x0;_0x4ffe7d<_0x4c1ba3[_0xf048('0x33')];_0x4ffe7d+=0x1){for(var _0x129a6d=0x0;_0x129a6d<_0x4c1ba3[_0x4ffe7d][_0xf048('0x68')][_0xf048('0x33')];_0x129a6d+=0x1){_0x571f29=_['union'](_0x571f29,[_0x4c1ba3[_0x4ffe7d][_0xf048('0x68')][_0x129a6d]['id']]);}}return _0x571f29;}})['then'](function(_0x4f5dab){if(_0x4f5dab){return db[_0xf048('0x2d')][_0xf048('0x44')]({'where':{'id':_0x2000c6[_0xf048('0x41')]['id']}});}})[_0xf048('0x26')](function(_0x8cde9f){if(_0x8cde9f){_0x53b693=_0x8cde9f;return _0x53b693[_0xf048('0x6c')](_0x571f29);}})[_0xf048('0x26')](function(_0x16fb03){if(_0x53b693){return _0x53b693[_0xf048('0x6d')](_0x2000c6[_0xf048('0x34')][_0xf048('0x67')]);}})[_0xf048('0x26')](handleEntityNotFound(_0x8bddcb,null))['then'](respondWithStatusCode(_0x8bddcb,null))['catch'](handleError(_0x8bddcb,null));};exports[_0xf048('0x6a')]=function(_0x2c8552,_0x5ae346,_0x5764a4){return db[_0xf048('0x2d')][_0xf048('0x44')]({'where':{'id':_0x2c8552[_0xf048('0x41')]['id']}})[_0xf048('0x26')](handleEntityNotFound(_0x5ae346,null))[_0xf048('0x26')](function(_0x11f6d5){if(_0x11f6d5){return _0x11f6d5[_0xf048('0x6a')](_0x2c8552['body'][_0xf048('0x67')],_[_0xf048('0x6e')](_0x2c8552[_0xf048('0x46')],[_0xf048('0x67'),'id'])||{})[_0xf048('0x6f')](function(_0x35c814){for(var _0x2d7579=0x0;_0x2d7579<_0x2c8552['body'][_0xf048('0x67')][_0xf048('0x33')];_0x2d7579+=0x1){socket[_0xf048('0x70')](_0xf048('0x71'),{'UserId':_0x2c8552[_0xf048('0x46')][_0xf048('0x67')][_0x2d7579],'FaxQueueId':_0x2c8552[_0xf048('0x41')]['id']});}return _0x35c814;});}})['then'](respondWithResult(_0x5ae346,null))[_0xf048('0x3f')](handleError(_0x5ae346,null));};exports['removeAgents']=function(_0x582efc,_0x5b848d,_0x188aa4){var _0x57d4c1;return db['FaxQueue'][_0xf048('0x44')]({'where':{'id':_0x582efc[_0xf048('0x41')]['id']}})[_0xf048('0x26')](handleEntityNotFound(_0x5b848d,null))[_0xf048('0x26')](function(_0x234c57){if(_0x234c57){return _0x234c57[_0xf048('0x6c')](_0x582efc[_0xf048('0x34')][_0xf048('0x67')])[_0xf048('0x26')](function(_0x5ef804){if(_['isArray'](_0x582efc[_0xf048('0x34')][_0xf048('0x67')])){for(var _0x1c3627=0x0;_0x1c3627<_0x582efc[_0xf048('0x34')][_0xf048('0x67')][_0xf048('0x33')];_0x1c3627+=0x1){socket[_0xf048('0x70')]('userFaxQueue:remove',{'UserId':_0x582efc[_0xf048('0x34')]['ids'][_0x1c3627],'FaxQueueId':_0x582efc[_0xf048('0x41')]['id']});}}else{socket[_0xf048('0x70')]('userFaxQueue:remove',{'UserId':_0x582efc[_0xf048('0x34')][_0xf048('0x67')],'FaxQueueId':_0x582efc[_0xf048('0x41')]['id']});}});}})[_0xf048('0x26')](respondWithStatusCode(_0x5b848d,null))['catch'](handleError(_0x5b848d,null));};exports[_0xf048('0x72')]=function(_0x460ed5,_0x1459f3,_0x1e74e4){var _0x45f0e3={};var _0x510d27={};var _0x4baec7;var _0x160660;return db[_0xf048('0x2d')][_0xf048('0x51')]({'where':{'id':_0x460ed5[_0xf048('0x41')]['id']}})[_0xf048('0x26')](handleEntityNotFound(_0x1459f3,null))['then'](function(_0x4f428c){if(_0x4f428c){_0x4baec7=_0x4f428c;_0x510d27[_0xf048('0x2e')]=_[_0xf048('0x2f')](db[_0xf048('0x58')]['rawAttributes']);_0x510d27[_0xf048('0x34')]=_[_0xf048('0x2f')](_0x460ed5[_0xf048('0x34')]);_0x510d27[_0xf048('0x30')]=_['intersection'](_0x510d27['model'],_0x510d27[_0xf048('0x34')]);_0x45f0e3[_0xf048('0x31')]=_['intersection'](_0x510d27['model'],qs['fields'](_0x460ed5[_0xf048('0x34')][_0xf048('0x42')]));_0x45f0e3[_0xf048('0x31')]=_0x45f0e3[_0xf048('0x31')][_0xf048('0x33')]?_0x45f0e3[_0xf048('0x31')]:_0x510d27['model'];_0x45f0e3['order']=qs['sort'](_0x460ed5[_0xf048('0x34')][_0xf048('0x56')]);_0x45f0e3[_0xf048('0x36')]=qs[_0xf048('0x30')](_[_0xf048('0x73')](_0x460ed5['query'],_0x510d27[_0xf048('0x30')]));if(_0x460ed5['query'][_0xf048('0x37')]){_0x45f0e3[_0xf048('0x36')]=_[_0xf048('0x3b')](_0x45f0e3[_0xf048('0x36')],{'$or':_[_0xf048('0x38')](_0x45f0e3['attributes'],function(_0x153776){var _0x37a80d={};_0x37a80d[_0x153776]={'$like':'%'+_0x460ed5[_0xf048('0x34')]['filter']+'%'};return _0x37a80d;})});}_0x45f0e3=_[_0xf048('0x3b')]({},_0x45f0e3,_0x460ed5['options']);return _0x4baec7[_0xf048('0x72')](_0x45f0e3);}})[_0xf048('0x26')](function(_0x2ab04c){if(_0x2ab04c){_0x160660=_0x2ab04c[_0xf048('0x33')];if(!_0x460ed5[_0xf048('0x34')][_0xf048('0x53')](_0xf048('0x54'))){_0x45f0e3['limit']=qs['limit'](_0x460ed5[_0xf048('0x34')]['limit']);_0x45f0e3[_0xf048('0x1f')]=qs[_0xf048('0x1f')](_0x460ed5[_0xf048('0x34')][_0xf048('0x1f')]);}return _0x4baec7[_0xf048('0x72')](_0x45f0e3);}})[_0xf048('0x26')](function(_0x50261e){if(_0x50261e){return _0x50261e?{'count':_0x160660,'rows':_0x50261e}:null;}})[_0xf048('0x26')](respondWithResult(_0x1459f3,null))['catch'](handleError(_0x1459f3,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 70b811f..77b1dc0 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 _0x80d9=['events','FaxQueue','setMaxListeners','save','remove','hasOwnProperty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x80d9,0x15c));var _0x980d=function(_0xa8fc57,_0x2c2acc){_0xa8fc57=_0xa8fc57-0x0;var _0x13803f=_0x80d9[_0xa8fc57];return _0x13803f;};'use strict';var EventEmitter=require(_0x980d('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x980d('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x980d('0x2')](0x0);var events={'afterCreate':_0x980d('0x3'),'afterUpdate':'update','afterDestroy':_0x980d('0x4')};function emitEvent(_0x3a9d1e){return function(_0x38d1b9,_0x279d93,_0x290800){FaxQueueEvents['emit'](_0x3a9d1e+':'+_0x38d1b9['id'],_0x38d1b9);FaxQueueEvents['emit'](_0x3a9d1e,_0x38d1b9);_0x290800(null);};}for(var e in events){if(events[_0x980d('0x5')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0xcca7=['../../mysqldb','FaxQueue','setMaxListeners','remove','emit','hasOwnProperty','events'];(function(_0x5390a3,_0x4d60f7){var _0x45d220=function(_0x47904f){while(--_0x47904f){_0x5390a3['push'](_0x5390a3['shift']());}};_0x45d220(++_0x4d60f7);}(_0xcca7,0x1aa));var _0x7cca=function(_0x11fe13,_0x3dcbf8){_0x11fe13=_0x11fe13-0x0;var _0x1c8df3=_0xcca7[_0x11fe13];return _0x1c8df3;};'use strict';var EventEmitter=require(_0x7cca('0x0'));var FaxQueue=require(_0x7cca('0x1'))['db'][_0x7cca('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x7cca('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7cca('0x4')};function emitEvent(_0x533b00){return function(_0x3b86a4,_0x9523f7,_0x2126f7){FaxQueueEvents[_0x7cca('0x5')](_0x533b00+':'+_0x3b86a4['id'],_0x3b86a4);FaxQueueEvents[_0x7cca('0x5')](_0x533b00,_0x3b86a4);_0x2126f7(null);};}for(var e in events){if(events[_0x7cca('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 9fedf89..f8f918c 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 _0x06eb=['request-promise','exports','define','FaxQueue','lodash','util','../../config/logger','api','bluebird'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x06eb,0x70));var _0xb06e=function(_0x4a4d57,_0x19ebee){_0x4a4d57=_0x4a4d57-0x0;var _0x3a82c2=_0x06eb[_0x4a4d57];return _0x3a82c2;};'use strict';var _=require(_0xb06e('0x0'));var util=require(_0xb06e('0x1'));var logger=require(_0xb06e('0x2'))(_0xb06e('0x3'));var moment=require('moment');var BPromise=require(_0xb06e('0x4'));var rp=require(_0xb06e('0x5'));var attributes=require('./faxQueue.attributes');module[_0xb06e('0x6')]=function(_0x4ef0c6,_0x95ee72){return _0x4ef0c6[_0xb06e('0x7')](_0xb06e('0x8'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0165=['fax_queues','lodash','../../config/logger','api','moment','request-promise','define'];(function(_0x4d1e51,_0x54ee9e){var _0x5d131a=function(_0x42644d){while(--_0x42644d){_0x4d1e51['push'](_0x4d1e51['shift']());}};_0x5d131a(++_0x54ee9e);}(_0x0165,0x15f));var _0x5016=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0165[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x5016('0x0'));var util=require('util');var logger=require(_0x5016('0x1'))(_0x5016('0x2'));var moment=require(_0x5016('0x3'));var BPromise=require('bluebird');var rp=require(_0x5016('0x4'));var attributes=require('./faxQueue.attributes');module['exports']=function(_0x4a229e,_0x5e8847){return _0x4a229e[_0x5016('0x5')]('FaxQueue',attributes,{'tableName':_0x5016('0x6'),'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 12c2ea3..6f3f214 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 _0xcdfa=['defaults','socket.io-emitter','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','FaxQueue','findAll','options','where','attributes','limit','include','model','map','GetFaxQueue','ShowFaxQueue','find','raw','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis'];(function(_0xef04fc,_0x383478){var _0x2b6d86=function(_0xaa48ad){while(--_0xaa48ad){_0xef04fc['push'](_0xef04fc['shift']());}};_0x2b6d86(++_0x383478);}(_0xcdfa,0xae));var _0xacdf=function(_0x2cea87,_0x130f22){_0x2cea87=_0x2cea87-0x0;var _0x165441=_0xcdfa[_0x2cea87];return _0x165441;};'use strict';var _=require(_0xacdf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xacdf('0x1'));var rs=require(_0xacdf('0x2'));var fs=require('fs');var Redis=require(_0xacdf('0x3'));var db=require(_0xacdf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xacdf('0x5'))(_0xacdf('0x6'));var config=require(_0xacdf('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xacdf('0x8')][_0xacdf('0x9')]({'port':0x232a});config[_0xacdf('0xa')]=_[_0xacdf('0xb')](config[_0xacdf('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xacdf('0xc'))(new Redis(config[_0xacdf('0xa')]));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x10d66f,_0xd85e28,_0x1df892){return new BPromise(function(_0x4d0f3e,_0x5e73b8){return client[_0xacdf('0xd')](_0x10d66f,_0x1df892)[_0xacdf('0xe')](function(_0x3a3016){logger[_0xacdf('0xf')](_0xacdf('0x10'),_0xd85e28,_0xacdf('0x11'));logger[_0xacdf('0x12')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0xd85e28,'request\x20sent',JSON[_0xacdf('0x13')](_0x3a3016));if(_0x3a3016[_0xacdf('0x14')]){if(_0x3a3016['error']['code']===0x1f4){logger[_0xacdf('0x14')](_0xacdf('0x10'),_0xd85e28,_0x3a3016[_0xacdf('0x14')]['message']);return _0x5e73b8(_0x3a3016[_0xacdf('0x14')][_0xacdf('0x15')]);}logger['error'](_0xacdf('0x10'),_0xd85e28,_0x3a3016[_0xacdf('0x14')][_0xacdf('0x15')]);return _0x4d0f3e(_0x3a3016[_0xacdf('0x14')][_0xacdf('0x15')]);}else{logger[_0xacdf('0xf')](_0xacdf('0x10'),_0xd85e28,_0xacdf('0x11'));_0x4d0f3e(_0x3a3016[_0xacdf('0x16')][_0xacdf('0x15')]);}})[_0xacdf('0x17')](function(_0xeb7be5){logger['error'](_0xacdf('0x10'),_0xd85e28,_0xeb7be5);_0x5e73b8(_0xeb7be5);});});}exports['GetFaxQueue']=function(_0x4645ad){var _0x38d277=this;return new Promise(function(_0x4dd656,_0x5dda6f){return db[_0xacdf('0x18')][_0xacdf('0x19')]({'raw':_0x4645ad[_0xacdf('0x1a')]?_0x4645ad[_0xacdf('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4645ad[_0xacdf('0x1a')]?_0x4645ad['options'][_0xacdf('0x1b')]||null:null,'attributes':_0x4645ad[_0xacdf('0x1a')]?_0x4645ad[_0xacdf('0x1a')][_0xacdf('0x1c')]||null:null,'limit':_0x4645ad[_0xacdf('0x1a')]?_0x4645ad[_0xacdf('0x1a')][_0xacdf('0x1d')]||null:null,'include':_0x4645ad[_0xacdf('0x1a')]?_0x4645ad['options'][_0xacdf('0x1e')]?_['map'](_0x4645ad['options'][_0xacdf('0x1e')],function(_0x53e4e1){return{'model':db[_0x53e4e1[_0xacdf('0x1f')]],'as':_0x53e4e1['as'],'attributes':_0x53e4e1[_0xacdf('0x1c')],'include':_0x53e4e1['include']?_[_0xacdf('0x20')](_0x53e4e1['include'],function(_0x47f3b3){return{'model':db[_0x47f3b3[_0xacdf('0x1f')]],'as':_0x47f3b3['as'],'attributes':_0x47f3b3[_0xacdf('0x1c')],'include':_0x47f3b3[_0xacdf('0x1e')]?_['map'](_0x47f3b3[_0xacdf('0x1e')],function(_0x1b1dd4){return{'model':db[_0x1b1dd4[_0xacdf('0x1f')]],'as':_0x1b1dd4['as'],'attributes':_0x1b1dd4[_0xacdf('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xacdf('0xe')](function(_0x552a1e){logger[_0xacdf('0xf')]('GetFaxQueue',_0x4645ad);logger['debug'](_0xacdf('0x21'),_0x4645ad,JSON[_0xacdf('0x13')](_0x552a1e));_0x4dd656(_0x552a1e);})[_0xacdf('0x17')](function(_0x3ef689){logger[_0xacdf('0x14')](_0xacdf('0x21'),_0x3ef689[_0xacdf('0x15')],_0x4645ad);_0x5dda6f(_0x38d277[_0xacdf('0x14')](0x1f4,_0x3ef689[_0xacdf('0x15')]));});});};exports[_0xacdf('0x22')]=function(_0x5217f0){var _0x3239e9=this;return new Promise(function(_0x168b17,_0x3ddcdb){return db[_0xacdf('0x18')][_0xacdf('0x23')]({'raw':_0x5217f0[_0xacdf('0x1a')]?_0x5217f0['options'][_0xacdf('0x24')]===undefined?!![]:![]:!![],'where':_0x5217f0['options']?_0x5217f0[_0xacdf('0x1a')][_0xacdf('0x1b')]||null:null,'attributes':_0x5217f0[_0xacdf('0x1a')]?_0x5217f0['options'][_0xacdf('0x1c')]||null:null,'include':_0x5217f0[_0xacdf('0x1a')]?_0x5217f0[_0xacdf('0x1a')][_0xacdf('0x1e')]?_[_0xacdf('0x20')](_0x5217f0[_0xacdf('0x1a')]['include'],function(_0x581328){return{'model':db[_0x581328[_0xacdf('0x1f')]],'as':_0x581328['as'],'attributes':_0x581328['attributes'],'include':_0x581328['include']?_[_0xacdf('0x20')](_0x581328[_0xacdf('0x1e')],function(_0x12a303){return{'model':db[_0x12a303[_0xacdf('0x1f')]],'as':_0x12a303['as'],'attributes':_0x12a303['attributes'],'include':_0x12a303[_0xacdf('0x1e')]?_[_0xacdf('0x20')](_0x12a303[_0xacdf('0x1e')],function(_0x112f84){return{'model':db[_0x112f84[_0xacdf('0x1f')]],'as':_0x112f84['as'],'attributes':_0x112f84[_0xacdf('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xacdf('0xe')](function(_0x771b70){logger[_0xacdf('0xf')](_0xacdf('0x22'),_0x5217f0);logger[_0xacdf('0x12')](_0xacdf('0x22'),_0x5217f0,JSON[_0xacdf('0x13')](_0x771b70));_0x168b17(_0x771b70);})['catch'](function(_0x4fb10f){logger[_0xacdf('0x14')](_0xacdf('0x22'),_0x4fb10f['message'],_0x5217f0);_0x3ddcdb(_0x3239e9[_0xacdf('0x14')](0x1f4,_0x4fb10f[_0xacdf('0x15')]));});});}; \ No newline at end of file +var _0x318f=['find','raw','where','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','options','attributes','limit','map','model','include','ShowFaxQueue'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x318f,0xcb));var _0xf318=function(_0x1403f2,_0x334e84){_0x1403f2=_0x1403f2-0x0;var _0x4a2947=_0x318f[_0x1403f2];return _0x4a2947;};'use strict';var _=require(_0xf318('0x0'));var util=require(_0xf318('0x1'));var moment=require(_0xf318('0x2'));var BPromise=require(_0xf318('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf318('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf318('0x5'));var logger=require('../../config/logger')(_0xf318('0x6'));var config=require(_0xf318('0x7'));var jayson=require(_0xf318('0x8'));var client=jayson[_0xf318('0x9')][_0xf318('0xa')]({'port':0x232a});config[_0xf318('0xb')]=_[_0xf318('0xc')](config[_0xf318('0xb')],{'host':_0xf318('0xd'),'port':0x18eb});var socket=require(_0xf318('0xe'))(new Redis(config[_0xf318('0xb')]));require('./faxQueue.socket')[_0xf318('0xf')](socket);function respondWithRpcPromise(_0x1825c4,_0x1733fa,_0x1bdc16){return new BPromise(function(_0x1f1af2,_0x3f0fa4){return client['request'](_0x1825c4,_0x1bdc16)[_0xf318('0x10')](function(_0xa69ad1){logger[_0xf318('0x11')](_0xf318('0x12'),_0x1733fa,'request\x20sent');logger[_0xf318('0x13')](_0xf318('0x14'),_0x1733fa,_0xf318('0x15'),JSON[_0xf318('0x16')](_0xa69ad1));if(_0xa69ad1[_0xf318('0x17')]){if(_0xa69ad1[_0xf318('0x17')][_0xf318('0x18')]===0x1f4){logger['error'](_0xf318('0x12'),_0x1733fa,_0xa69ad1['error'][_0xf318('0x19')]);return _0x3f0fa4(_0xa69ad1[_0xf318('0x17')]['message']);}logger[_0xf318('0x17')]('FaxQueue,\x20%s,\x20%s',_0x1733fa,_0xa69ad1[_0xf318('0x17')][_0xf318('0x19')]);return _0x1f1af2(_0xa69ad1[_0xf318('0x17')][_0xf318('0x19')]);}else{logger['info'](_0xf318('0x12'),_0x1733fa,_0xf318('0x15'));_0x1f1af2(_0xa69ad1[_0xf318('0x1a')][_0xf318('0x19')]);}})[_0xf318('0x1b')](function(_0x29794a){logger[_0xf318('0x17')]('FaxQueue,\x20%s,\x20%s',_0x1733fa,_0x29794a);_0x3f0fa4(_0x29794a);});});}exports[_0xf318('0x1c')]=function(_0x35457f){var _0x1621e4=this;return new Promise(function(_0xfde7e1,_0x582a02){return db[_0xf318('0x1d')]['findAll']({'raw':_0x35457f['options']?_0x35457f[_0xf318('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x35457f['options']?_0x35457f['options']['where']||null:null,'attributes':_0x35457f[_0xf318('0x1e')]?_0x35457f[_0xf318('0x1e')][_0xf318('0x1f')]||null:null,'limit':_0x35457f[_0xf318('0x1e')]?_0x35457f[_0xf318('0x1e')][_0xf318('0x20')]||null:null,'include':_0x35457f[_0xf318('0x1e')]?_0x35457f['options']['include']?_[_0xf318('0x21')](_0x35457f[_0xf318('0x1e')]['include'],function(_0x661edb){return{'model':db[_0x661edb[_0xf318('0x22')]],'as':_0x661edb['as'],'attributes':_0x661edb[_0xf318('0x1f')],'include':_0x661edb['include']?_[_0xf318('0x21')](_0x661edb[_0xf318('0x23')],function(_0x511719){return{'model':db[_0x511719[_0xf318('0x22')]],'as':_0x511719['as'],'attributes':_0x511719[_0xf318('0x1f')],'include':_0x511719['include']?_[_0xf318('0x21')](_0x511719['include'],function(_0xfc713b){return{'model':db[_0xfc713b[_0xf318('0x22')]],'as':_0xfc713b['as'],'attributes':_0xfc713b[_0xf318('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf318('0x10')](function(_0x27258e){logger[_0xf318('0x11')](_0xf318('0x1c'),_0x35457f);logger[_0xf318('0x13')](_0xf318('0x1c'),_0x35457f,JSON['stringify'](_0x27258e));_0xfde7e1(_0x27258e);})[_0xf318('0x1b')](function(_0x2acff9){logger[_0xf318('0x17')](_0xf318('0x1c'),_0x2acff9[_0xf318('0x19')],_0x35457f);_0x582a02(_0x1621e4['error'](0x1f4,_0x2acff9['message']));});});};exports[_0xf318('0x24')]=function(_0x1d6ce8){var _0xd707db=this;return new Promise(function(_0x13330e,_0x4f23c1){return db[_0xf318('0x1d')][_0xf318('0x25')]({'raw':_0x1d6ce8[_0xf318('0x1e')]?_0x1d6ce8[_0xf318('0x1e')][_0xf318('0x26')]===undefined?!![]:![]:!![],'where':_0x1d6ce8[_0xf318('0x1e')]?_0x1d6ce8[_0xf318('0x1e')][_0xf318('0x27')]||null:null,'attributes':_0x1d6ce8[_0xf318('0x1e')]?_0x1d6ce8[_0xf318('0x1e')][_0xf318('0x1f')]||null:null,'include':_0x1d6ce8[_0xf318('0x1e')]?_0x1d6ce8[_0xf318('0x1e')]['include']?_['map'](_0x1d6ce8[_0xf318('0x1e')][_0xf318('0x23')],function(_0x4e9165){return{'model':db[_0x4e9165['model']],'as':_0x4e9165['as'],'attributes':_0x4e9165[_0xf318('0x1f')],'include':_0x4e9165[_0xf318('0x23')]?_[_0xf318('0x21')](_0x4e9165[_0xf318('0x23')],function(_0x37a47f){return{'model':db[_0x37a47f['model']],'as':_0x37a47f['as'],'attributes':_0x37a47f[_0xf318('0x1f')],'include':_0x37a47f[_0xf318('0x23')]?_[_0xf318('0x21')](_0x37a47f[_0xf318('0x23')],function(_0xce179){return{'model':db[_0xce179[_0xf318('0x22')]],'as':_0xce179['as'],'attributes':_0xce179['attributes']};}):[]};}):[]};}):[]:[]})[_0xf318('0x10')](function(_0x43cb35){logger['info'](_0xf318('0x24'),_0x1d6ce8);logger[_0xf318('0x13')](_0xf318('0x24'),_0x1d6ce8,JSON['stringify'](_0x43cb35));_0x13330e(_0x43cb35);})[_0xf318('0x1b')](function(_0x5188c8){logger['error'](_0xf318('0x24'),_0x5188c8[_0xf318('0x19')],_0x1d6ce8);_0x4f23c1(_0xd707db[_0xf318('0x17')](0x1f4,_0x5188c8[_0xf318('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 6951e06..114926f 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 _0x5c6d=['register','length','faxQueue:','save','remove','update','emit'];(function(_0x587288,_0x582bac){var _0x52319e=function(_0x103062){while(--_0x103062){_0x587288['push'](_0x587288['shift']());}};_0x52319e(++_0x582bac);}(_0x5c6d,0x8f));var _0xd5c6=function(_0x3ae35a,_0x465312){_0x3ae35a=_0x3ae35a-0x0;var _0x52e856=_0x5c6d[_0x3ae35a];return _0x52e856;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xd5c6('0x0'),_0xd5c6('0x1'),_0xd5c6('0x2')];function createListener(_0x23af49,_0xc41849){return function(_0x2a4be5){_0xc41849[_0xd5c6('0x3')](_0x23af49,_0x2a4be5);};}function removeListener(_0xb45cbb,_0x5f1635){return function(){FaxQueueEvents['removeListener'](_0xb45cbb,_0x5f1635);};}exports[_0xd5c6('0x4')]=function(_0x4d95c9){for(var _0x361464=0x0,_0x30fd1e=events[_0xd5c6('0x5')];_0x361464<_0x30fd1e;_0x361464++){var _0x2ebe98=events[_0x361464];var _0x4c0bcb=createListener(_0xd5c6('0x6')+_0x2ebe98,_0x4d95c9);FaxQueueEvents['on'](_0x2ebe98,_0x4c0bcb);}}; \ No newline at end of file +var _0x4d28=['update','emit','removeListener','length','faxQueue:','./faxQueue.events','save'];(function(_0x2d82df,_0x448792){var _0xc7f7d9=function(_0x54c680){while(--_0x54c680){_0x2d82df['push'](_0x2d82df['shift']());}};_0xc7f7d9(++_0x448792);}(_0x4d28,0x83));var _0x84d2=function(_0x2c4570,_0x21871d){_0x2c4570=_0x2c4570-0x0;var _0x26f4b0=_0x4d28[_0x2c4570];return _0x26f4b0;};'use strict';var FaxQueueEvents=require(_0x84d2('0x0'));var events=[_0x84d2('0x1'),'remove',_0x84d2('0x2')];function createListener(_0x13bb4b,_0x22cfe0){return function(_0x51fea2){_0x22cfe0[_0x84d2('0x3')](_0x13bb4b,_0x51fea2);};}function removeListener(_0x370cbc,_0x59d7ed){return function(){FaxQueueEvents[_0x84d2('0x4')](_0x370cbc,_0x59d7ed);};}exports['register']=function(_0x24acf6){for(var _0x5c2862=0x0,_0x48c94c=events[_0x84d2('0x5')];_0x5c2862<_0x48c94c;_0x5c2862++){var _0x223476=events[_0x5c2862];var _0x5c9815=createListener(_0x84d2('0x6')+_0x223476,_0x24acf6);FaxQueueEvents['on'](_0x223476,_0x5c9815);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index feaf854..58558ec 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 _0x1d0d=['removeAgents','exports','multer','connect-timeout','express','Router','../../config/environment','./faxQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','getTeams','post','create','/:id/teams','/:id/users','addAgents','delete','removeTeams'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d0d,0xf2));var _0xd1d0=function(_0x59ad0c,_0x34f832){_0x59ad0c=_0x59ad0c-0x0;var _0x4e61c0=_0x1d0d[_0x59ad0c];return _0x4e61c0;};'use strict';var multer=require(_0xd1d0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd1d0('0x1'));var express=require(_0xd1d0('0x2'));var router=express[_0xd1d0('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd1d0('0x4'));var controller=require(_0xd1d0('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd1d0('0x6')](_0xd1d0('0x7'),auth[_0xd1d0('0x8')](),controller[_0xd1d0('0x9')]);router[_0xd1d0('0x6')](_0xd1d0('0xa'),auth[_0xd1d0('0x8')](),controller[_0xd1d0('0xb')]);router['get'](_0xd1d0('0xc'),auth['isAuthenticated'](),controller[_0xd1d0('0xd')]);router[_0xd1d0('0x6')]('/:id/teams',auth['isAuthenticated'](),controller[_0xd1d0('0xe')]);router[_0xd1d0('0x6')]('/:id/users',auth[_0xd1d0('0x8')](),controller['getAgents']);router[_0xd1d0('0xf')]('/',auth['isAuthenticated'](),controller[_0xd1d0('0x10')]);router[_0xd1d0('0xf')](_0xd1d0('0x11'),auth[_0xd1d0('0x8')](),controller['addTeams']);router[_0xd1d0('0xf')](_0xd1d0('0x12'),auth[_0xd1d0('0x8')](),controller[_0xd1d0('0x13')]);router['put'](_0xd1d0('0xa'),auth[_0xd1d0('0x8')](),controller['update']);router[_0xd1d0('0x14')](_0xd1d0('0xa'),auth['isAuthenticated'](),controller['destroy']);router[_0xd1d0('0x14')]('/:id/teams',auth[_0xd1d0('0x8')](),controller[_0xd1d0('0x15')]);router[_0xd1d0('0x14')]('/:id/users',auth[_0xd1d0('0x8')](),controller[_0xd1d0('0x16')]);module[_0xd1d0('0x17')]=router; \ No newline at end of file +var _0xfbc4=['isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','destroy','delete','removeTeams','removeAgents','multer','path','connect-timeout','express','Router','../../components/auth/service','./faxQueue.controller','get'];(function(_0x436660,_0x2b0bbe){var _0x78b0a1=function(_0x2e43f2){while(--_0x2e43f2){_0x436660['push'](_0x436660['shift']());}};_0x78b0a1(++_0x2b0bbe);}(_0xfbc4,0x1d8));var _0x4fbc=function(_0x44f4ac,_0x2e191c){_0x44f4ac=_0x44f4ac-0x0;var _0xcfbd1e=_0xfbc4[_0x44f4ac];return _0xcfbd1e;};'use strict';var multer=require(_0x4fbc('0x0'));var util=require('util');var path=require(_0x4fbc('0x1'));var timeout=require(_0x4fbc('0x2'));var express=require(_0x4fbc('0x3'));var router=express[_0x4fbc('0x4')]();var auth=require(_0x4fbc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4fbc('0x6'));router[_0x4fbc('0x7')]('/',auth[_0x4fbc('0x8')](),controller[_0x4fbc('0x9')]);router[_0x4fbc('0x7')](_0x4fbc('0xa'),auth[_0x4fbc('0x8')](),controller[_0x4fbc('0xb')]);router['get'](_0x4fbc('0xc'),auth[_0x4fbc('0x8')](),controller['show']);router[_0x4fbc('0x7')](_0x4fbc('0xd'),auth['isAuthenticated'](),controller[_0x4fbc('0xe')]);router[_0x4fbc('0x7')](_0x4fbc('0xf'),auth[_0x4fbc('0x8')](),controller[_0x4fbc('0x10')]);router['get'](_0x4fbc('0x11'),auth['isAuthenticated'](),controller['getAgents']);router[_0x4fbc('0x12')]('/',auth[_0x4fbc('0x8')](),controller['create']);router[_0x4fbc('0x12')](_0x4fbc('0xf'),auth[_0x4fbc('0x8')](),controller[_0x4fbc('0x13')]);router[_0x4fbc('0x12')](_0x4fbc('0x11'),auth[_0x4fbc('0x8')](),controller['addAgents']);router['put'](_0x4fbc('0xc'),auth[_0x4fbc('0x8')](),controller['update']);router['delete'](_0x4fbc('0xc'),auth['isAuthenticated'](),controller[_0x4fbc('0x14')]);router[_0x4fbc('0x15')](_0x4fbc('0xf'),auth[_0x4fbc('0x8')](),controller[_0x4fbc('0x16')]);router[_0x4fbc('0x15')]('/:id/users',auth[_0x4fbc('0x8')](),controller[_0x4fbc('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index ddab495..0f45e05 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 _0x8cba=['STRING','DATE','moment','sequelize','exports'];(function(_0x9dd37c,_0x3e255e){var _0x2a522c=function(_0x2ce2ca){while(--_0x2ce2ca){_0x9dd37c['push'](_0x9dd37c['shift']());}};_0x2a522c(++_0x3e255e);}(_0x8cba,0x89));var _0xa8cb=function(_0x57ed68,_0x13cab4){_0x57ed68=_0x57ed68-0x0;var _0x5a46f9=_0x8cba[_0x57ed68];return _0x5a46f9;};'use strict';var moment=require(_0xa8cb('0x0'));var Sequelize=require(_0xa8cb('0x1'));module[_0xa8cb('0x2')]={'uniqueid':{'type':Sequelize[_0xa8cb('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa8cb('0x3')]},'joinAt':{'type':Sequelize[_0xa8cb('0x4')]},'leaveAt':{'type':Sequelize[_0xa8cb('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xa8cb('0x4')]},'reason':{'type':Sequelize[_0xa8cb('0x3')]}}; \ No newline at end of file +var _0xc7fc=['DATE','moment','sequelize','exports','STRING'];(function(_0x5eb874,_0x3d849f){var _0x5bbbd0=function(_0x54c86a){while(--_0x54c86a){_0x5eb874['push'](_0x5eb874['shift']());}};_0x5bbbd0(++_0x3d849f);}(_0xc7fc,0x173));var _0xcc7f=function(_0x58788d,_0x88b74f){_0x58788d=_0x58788d-0x0;var _0x58ceba=_0xc7fc[_0x58788d];return _0x58ceba;};'use strict';var moment=require(_0xcc7f('0x0'));var Sequelize=require(_0xcc7f('0x1'));module[_0xcc7f('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xcc7f('0x3')]},'joinAt':{'type':Sequelize[_0xcc7f('0x4')]},'leaveAt':{'type':Sequelize[_0xcc7f('0x4')]},'acceptAt':{'type':Sequelize[_0xcc7f('0x4')]},'exitAt':{'type':Sequelize[_0xcc7f('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 6d2c38c..d247a50 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 _0x5e2c=['VIRTUAL','field','then','includeAll','include','findAll','catch','params','filters','options','find','create','body','update','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','sendStatus','error','stack','name','send','index','FaxQueueReport','rawAttributes','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key'];(function(_0x954b3a,_0x10a7c1){var _0x3a313e=function(_0x1070ad){while(--_0x1070ad){_0x954b3a['push'](_0x954b3a['shift']());}};_0x3a313e(++_0x10a7c1);}(_0x5e2c,0x138));var _0xc5e2=function(_0x25fa5c,_0x421141){_0x25fa5c=_0x25fa5c-0x0;var _0x1bade2=_0x5e2c[_0x25fa5c];return _0x1bade2;};'use strict';var pdf=require(_0xc5e2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc5e2('0x1'));var zipdir=require(_0xc5e2('0x2'));var jsonpatch=require(_0xc5e2('0x3'));var rp=require(_0xc5e2('0x4'));var moment=require('moment');var BPromise=require(_0xc5e2('0x5'));var Mustache=require(_0xc5e2('0x6'));var util=require(_0xc5e2('0x7'));var path=require('path');var sox=require(_0xc5e2('0x8'));var csv=require(_0xc5e2('0x9'));var ejs=require(_0xc5e2('0xa'));var fs=require('fs');var _=require(_0xc5e2('0xb'));var squel=require('squel');var crypto=require(_0xc5e2('0xc'));var jsforce=require(_0xc5e2('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc5e2('0xe'));var Papa=require(_0xc5e2('0xf'));var authService=require('../../components/auth/service');var hardwareService=require(_0xc5e2('0x10'));var Redis=require(_0xc5e2('0x11'));var qs=require(_0xc5e2('0x12'));var logger=require(_0xc5e2('0x13'))(_0xc5e2('0x14'));var utils=require(_0xc5e2('0x15'));var config=require(_0xc5e2('0x16'));var db=require(_0xc5e2('0x17'))['db'];function respondWithStatusCode(_0x175a87,_0x2358aa){_0x2358aa=_0x2358aa||0xcc;return function(_0x3b42a9){if(_0x3b42a9){return _0x175a87['sendStatus'](_0x2358aa);}return _0x175a87[_0xc5e2('0x18')](_0x2358aa)['end']();};}function respondWithResult(_0xaae2d1,_0x411211){_0x411211=_0x411211||0xc8;return function(_0x5a4b25){if(_0x5a4b25){return _0xaae2d1[_0xc5e2('0x18')](_0x411211)[_0xc5e2('0x19')](_0x5a4b25);}};}function respondWithFilteredResult(_0x251f0a,_0x10194c){return function(_0x449fb1){if(_0x449fb1){var _0x3fed1f=_0x449fb1[_0xc5e2('0x1a')],_0x4237fc=_0x10194c[_0xc5e2('0x1b')],_0x2546fc=_0x10194c[_0xc5e2('0x1b')]+_0x10194c[_0xc5e2('0x1c')],_0x40bd9e;if(_0x2546fc>=_0x3fed1f){_0x2546fc=_0x3fed1f;_0x40bd9e=0xc8;}else{_0x40bd9e=0xce;}_0x251f0a[_0xc5e2('0x18')](_0x40bd9e);return _0x251f0a[_0xc5e2('0x1d')](_0xc5e2('0x1e'),_0x4237fc+'-'+_0x2546fc+'/'+_0x3fed1f)[_0xc5e2('0x19')](_0x449fb1);}return null;};}function patchUpdates(_0x1343f8){return function(_0x2c00b2){try{jsonpatch[_0xc5e2('0x1f')](_0x2c00b2,_0x1343f8,!![]);}catch(_0x42a0c7){return BPromise['reject'](_0x42a0c7);}return _0x2c00b2['save']();};}function saveUpdates(_0x3e13a8,_0x5480c3){return function(_0x5a0647){if(_0x5a0647){return _0x5a0647['update'](_0x3e13a8)['then'](function(_0x23788e){return _0x23788e;});}return null;};}function removeEntity(_0x34bf6e,_0x4db5aa){return function(_0x36ce9a){if(_0x36ce9a){return _0x36ce9a['destroy']()['then'](function(){_0x34bf6e[_0xc5e2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33cad2,_0x1a0529){return function(_0x4fc90c){if(!_0x4fc90c){_0x33cad2[_0xc5e2('0x20')](0x194);}return _0x4fc90c;};}function handleError(_0x54ab18,_0x45671b){_0x45671b=_0x45671b||0x1f4;return function(_0x2aae95){logger[_0xc5e2('0x21')](_0x2aae95[_0xc5e2('0x22')]);if(_0x2aae95[_0xc5e2('0x23')]){delete _0x2aae95[_0xc5e2('0x23')];}_0x54ab18[_0xc5e2('0x18')](_0x45671b)[_0xc5e2('0x24')](_0x2aae95);};}exports[_0xc5e2('0x25')]=function(_0x23b192,_0x3dae7d){var _0x1f995f={},_0x46e77e={},_0x4acfcb={'count':0x0,'rows':[]};var _0x43a946=db[_0xc5e2('0x26')][_0xc5e2('0x27')];_0x46e77e[_0xc5e2('0x28')]=_[_0xc5e2('0x29')](_0x43a946);_0x46e77e[_0xc5e2('0x2a')]=_[_0xc5e2('0x29')](_0x23b192[_0xc5e2('0x2a')]);_0x46e77e['filters']=_['intersection'](_0x46e77e['model'],_0x46e77e[_0xc5e2('0x2a')]);_0x1f995f[_0xc5e2('0x2b')]=_[_0xc5e2('0x2c')](_0x46e77e[_0xc5e2('0x28')],qs[_0xc5e2('0x2d')](_0x23b192['query']['fields']));_0x1f995f[_0xc5e2('0x2b')]=_0x1f995f[_0xc5e2('0x2b')][_0xc5e2('0x2e')]?_0x1f995f['attributes']:_0x46e77e[_0xc5e2('0x28')];if(!_0x23b192[_0xc5e2('0x2a')][_0xc5e2('0x2f')](_0xc5e2('0x30'))){_0x1f995f[_0xc5e2('0x1c')]=qs[_0xc5e2('0x1c')](_0x23b192[_0xc5e2('0x2a')]['limit']);_0x1f995f[_0xc5e2('0x1b')]=qs['offset'](_0x23b192[_0xc5e2('0x2a')][_0xc5e2('0x1b')]);}_0x1f995f[_0xc5e2('0x31')]=qs[_0xc5e2('0x32')](_0x23b192[_0xc5e2('0x2a')]['sort']);_0x1f995f[_0xc5e2('0x33')]=qs['filters'](_[_0xc5e2('0x34')](_0x23b192[_0xc5e2('0x2a')],_0x46e77e['filters']));if(_0x23b192['query'][_0xc5e2('0x35')]){_0x1f995f[_0xc5e2('0x33')]=_[_0xc5e2('0x36')](_0x1f995f[_0xc5e2('0x33')],{'$or':_[_0xc5e2('0x37')](_0x43a946,function(_0x140440){if(_0x140440[_0xc5e2('0x38')][_0xc5e2('0x39')]!==_0xc5e2('0x3a')){var _0x354218={};_0x354218[_0x140440[_0xc5e2('0x3b')]]={'$like':'%'+_0x23b192[_0xc5e2('0x2a')][_0xc5e2('0x35')]+'%'};return _0x354218;}})});}_0x1f995f=_['merge']({},_0x1f995f,_0x23b192['options']);var _0x288bb4={'where':_0x1f995f[_0xc5e2('0x33')]};return db[_0xc5e2('0x26')][_0xc5e2('0x1a')](_0x288bb4)[_0xc5e2('0x3c')](function(_0x5e1d28){_0x4acfcb[_0xc5e2('0x1a')]=_0x5e1d28;if(_0x23b192[_0xc5e2('0x2a')][_0xc5e2('0x3d')]){_0x1f995f[_0xc5e2('0x3e')]=[{'all':!![]}];}return db[_0xc5e2('0x26')][_0xc5e2('0x3f')](_0x1f995f);})['then'](function(_0x2c87ec){_0x4acfcb['rows']=_0x2c87ec;return _0x4acfcb;})[_0xc5e2('0x3c')](respondWithFilteredResult(_0x3dae7d,_0x1f995f))[_0xc5e2('0x40')](handleError(_0x3dae7d,null));};exports['show']=function(_0x42e7f5,_0x11f58a){var _0x506dd6={'raw':!![],'where':{'id':_0x42e7f5[_0xc5e2('0x41')]['id']}},_0x277c45={};_0x277c45['model']=_[_0xc5e2('0x29')](db[_0xc5e2('0x26')][_0xc5e2('0x27')]);_0x277c45[_0xc5e2('0x2a')]=_[_0xc5e2('0x29')](_0x42e7f5[_0xc5e2('0x2a')]);_0x277c45[_0xc5e2('0x42')]=_['intersection'](_0x277c45['model'],_0x277c45[_0xc5e2('0x2a')]);_0x506dd6[_0xc5e2('0x2b')]=_['intersection'](_0x277c45['model'],qs[_0xc5e2('0x2d')](_0x42e7f5[_0xc5e2('0x2a')][_0xc5e2('0x2d')]));_0x506dd6['attributes']=_0x506dd6[_0xc5e2('0x2b')][_0xc5e2('0x2e')]?_0x506dd6[_0xc5e2('0x2b')]:_0x277c45['model'];if(_0x42e7f5['query']['includeAll']){_0x506dd6[_0xc5e2('0x3e')]=[{'all':!![]}];}_0x506dd6=_[_0xc5e2('0x36')]({},_0x506dd6,_0x42e7f5[_0xc5e2('0x43')]);return db[_0xc5e2('0x26')][_0xc5e2('0x44')](_0x506dd6)[_0xc5e2('0x3c')](handleEntityNotFound(_0x11f58a,null))[_0xc5e2('0x3c')](respondWithResult(_0x11f58a,null))[_0xc5e2('0x40')](handleError(_0x11f58a,null));};exports[_0xc5e2('0x45')]=function(_0x3ed0f3,_0x287398){return db[_0xc5e2('0x26')][_0xc5e2('0x45')](_0x3ed0f3[_0xc5e2('0x46')],{})[_0xc5e2('0x3c')](respondWithResult(_0x287398,0xc9))[_0xc5e2('0x40')](handleError(_0x287398,null));};exports[_0xc5e2('0x47')]=function(_0x5aeaab,_0x481951){if(_0x5aeaab[_0xc5e2('0x46')]['id']){delete _0x5aeaab['body']['id'];}return db['FaxQueueReport'][_0xc5e2('0x44')]({'where':{'id':_0x5aeaab[_0xc5e2('0x41')]['id']}})[_0xc5e2('0x3c')](handleEntityNotFound(_0x481951,null))[_0xc5e2('0x3c')](saveUpdates(_0x5aeaab[_0xc5e2('0x46')],null))[_0xc5e2('0x3c')](respondWithResult(_0x481951,null))[_0xc5e2('0x40')](handleError(_0x481951,null));};exports[_0xc5e2('0x48')]=function(_0x57c8ce,_0x4db3fa){return db[_0xc5e2('0x26')][_0xc5e2('0x44')]({'where':{'id':_0x57c8ce[_0xc5e2('0x41')]['id']}})[_0xc5e2('0x3c')](handleEntityNotFound(_0x4db3fa,null))[_0xc5e2('0x3c')](removeEntity(_0x4db3fa,null))[_0xc5e2('0x40')](handleError(_0x4db3fa,null));};exports[_0xc5e2('0x49')]=function(_0x1d1adc,_0x2802e4){return db[_0xc5e2('0x26')]['describe']()[_0xc5e2('0x3c')](respondWithResult(_0x2802e4,null))[_0xc5e2('0x40')](handleError(_0x2802e4,null));}; \ No newline at end of file +var _0x35bd=['squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','reject','update','then','destroy','stack','name','send','index','FaxQueueReport','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','limit','sort','filters','pick','merge','where','map','type','key','field','filter','options','findAll','rows','catch','show','include','find','create','body','params','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x35bd,0x114));var _0xd35b=function(_0x2db893,_0x532baf){_0x2db893=_0x2db893-0x0;var _0x59ced7=_0x35bd[_0x2db893];return _0x59ced7;};'use strict';var pdf=require(_0xd35b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd35b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd35b('0x2'));var rp=require(_0xd35b('0x3'));var moment=require(_0xd35b('0x4'));var BPromise=require(_0xd35b('0x5'));var Mustache=require(_0xd35b('0x6'));var util=require(_0xd35b('0x7'));var path=require('path');var sox=require(_0xd35b('0x8'));var csv=require(_0xd35b('0x9'));var ejs=require(_0xd35b('0xa'));var fs=require('fs');var _=require(_0xd35b('0xb'));var squel=require(_0xd35b('0xc'));var crypto=require('crypto');var jsforce=require(_0xd35b('0xd'));var deskjs=require(_0xd35b('0xe'));var toCsv=require(_0xd35b('0x9'));var querystring=require(_0xd35b('0xf'));var Papa=require(_0xd35b('0x10'));var authService=require(_0xd35b('0x11'));var hardwareService=require(_0xd35b('0x12'));var Redis=require(_0xd35b('0x13'));var qs=require(_0xd35b('0x14'));var logger=require(_0xd35b('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xd35b('0x16'));var db=require(_0xd35b('0x17'))['db'];function respondWithStatusCode(_0x20b0d3,_0x59ee67){_0x59ee67=_0x59ee67||0xcc;return function(_0x1fdb3b){if(_0x1fdb3b){return _0x20b0d3[_0xd35b('0x18')](_0x59ee67);}return _0x20b0d3['status'](_0x59ee67)[_0xd35b('0x19')]();};}function respondWithResult(_0x166f86,_0xb159f4){_0xb159f4=_0xb159f4||0xc8;return function(_0x2f7951){if(_0x2f7951){return _0x166f86[_0xd35b('0x1a')](_0xb159f4)[_0xd35b('0x1b')](_0x2f7951);}};}function respondWithFilteredResult(_0x4d5929,_0x39876f){return function(_0x4b85e9){if(_0x4b85e9){var _0x109a26=_0x4b85e9[_0xd35b('0x1c')],_0x2eddf4=_0x39876f[_0xd35b('0x1d')],_0x220021=_0x39876f[_0xd35b('0x1d')]+_0x39876f['limit'],_0x3ff6b6;if(_0x220021>=_0x109a26){_0x220021=_0x109a26;_0x3ff6b6=0xc8;}else{_0x3ff6b6=0xce;}_0x4d5929[_0xd35b('0x1a')](_0x3ff6b6);return _0x4d5929[_0xd35b('0x1e')](_0xd35b('0x1f'),_0x2eddf4+'-'+_0x220021+'/'+_0x109a26)[_0xd35b('0x1b')](_0x4b85e9);}return null;};}function patchUpdates(_0x10da9b){return function(_0x18cf4c){try{jsonpatch['apply'](_0x18cf4c,_0x10da9b,!![]);}catch(_0x1f28cf){return BPromise[_0xd35b('0x20')](_0x1f28cf);}return _0x18cf4c['save']();};}function saveUpdates(_0x202231,_0x3fc086){return function(_0x1af753){if(_0x1af753){return _0x1af753[_0xd35b('0x21')](_0x202231)[_0xd35b('0x22')](function(_0x6640e5){return _0x6640e5;});}return null;};}function removeEntity(_0x375759,_0x1a8324){return function(_0xbf1408){if(_0xbf1408){return _0xbf1408[_0xd35b('0x23')]()[_0xd35b('0x22')](function(){_0x375759[_0xd35b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f3203,_0x5d8790){return function(_0x1fe45c){if(!_0x1fe45c){_0x3f3203[_0xd35b('0x18')](0x194);}return _0x1fe45c;};}function handleError(_0x1b0b3e,_0x72b50e){_0x72b50e=_0x72b50e||0x1f4;return function(_0x5a3c61){logger['error'](_0x5a3c61[_0xd35b('0x24')]);if(_0x5a3c61[_0xd35b('0x25')]){delete _0x5a3c61[_0xd35b('0x25')];}_0x1b0b3e[_0xd35b('0x1a')](_0x72b50e)[_0xd35b('0x26')](_0x5a3c61);};}exports[_0xd35b('0x27')]=function(_0x571a5e,_0x36a81b){var _0x3c38b2={},_0xb68bf3={},_0x18c917={'count':0x0,'rows':[]};var _0x524935=db[_0xd35b('0x28')][_0xd35b('0x29')];_0xb68bf3[_0xd35b('0x2a')]=_[_0xd35b('0x2b')](_0x524935);_0xb68bf3[_0xd35b('0x2c')]=_[_0xd35b('0x2b')](_0x571a5e[_0xd35b('0x2c')]);_0xb68bf3['filters']=_[_0xd35b('0x2d')](_0xb68bf3[_0xd35b('0x2a')],_0xb68bf3[_0xd35b('0x2c')]);_0x3c38b2[_0xd35b('0x2e')]=_[_0xd35b('0x2d')](_0xb68bf3[_0xd35b('0x2a')],qs[_0xd35b('0x2f')](_0x571a5e['query'][_0xd35b('0x2f')]));_0x3c38b2[_0xd35b('0x2e')]=_0x3c38b2[_0xd35b('0x2e')][_0xd35b('0x30')]?_0x3c38b2[_0xd35b('0x2e')]:_0xb68bf3[_0xd35b('0x2a')];if(!_0x571a5e[_0xd35b('0x2c')][_0xd35b('0x31')]('nolimit')){_0x3c38b2[_0xd35b('0x32')]=qs['limit'](_0x571a5e[_0xd35b('0x2c')][_0xd35b('0x32')]);_0x3c38b2[_0xd35b('0x1d')]=qs[_0xd35b('0x1d')](_0x571a5e[_0xd35b('0x2c')][_0xd35b('0x1d')]);}_0x3c38b2['order']=qs[_0xd35b('0x33')](_0x571a5e[_0xd35b('0x2c')][_0xd35b('0x33')]);_0x3c38b2['where']=qs[_0xd35b('0x34')](_[_0xd35b('0x35')](_0x571a5e[_0xd35b('0x2c')],_0xb68bf3[_0xd35b('0x34')]));if(_0x571a5e[_0xd35b('0x2c')]['filter']){_0x3c38b2['where']=_[_0xd35b('0x36')](_0x3c38b2[_0xd35b('0x37')],{'$or':_[_0xd35b('0x38')](_0x524935,function(_0x1a0812){if(_0x1a0812[_0xd35b('0x39')][_0xd35b('0x3a')]!=='VIRTUAL'){var _0x2da7bc={};_0x2da7bc[_0x1a0812[_0xd35b('0x3b')]]={'$like':'%'+_0x571a5e[_0xd35b('0x2c')][_0xd35b('0x3c')]+'%'};return _0x2da7bc;}})});}_0x3c38b2=_['merge']({},_0x3c38b2,_0x571a5e[_0xd35b('0x3d')]);var _0x1cae81={'where':_0x3c38b2['where']};return db['FaxQueueReport']['count'](_0x1cae81)['then'](function(_0x3eab45){_0x18c917['count']=_0x3eab45;if(_0x571a5e[_0xd35b('0x2c')]['includeAll']){_0x3c38b2['include']=[{'all':!![]}];}return db[_0xd35b('0x28')][_0xd35b('0x3e')](_0x3c38b2);})['then'](function(_0x29b031){_0x18c917[_0xd35b('0x3f')]=_0x29b031;return _0x18c917;})[_0xd35b('0x22')](respondWithFilteredResult(_0x36a81b,_0x3c38b2))[_0xd35b('0x40')](handleError(_0x36a81b,null));};exports[_0xd35b('0x41')]=function(_0x47d8bc,_0x46093d){var _0x138e02={'raw':!![],'where':{'id':_0x47d8bc['params']['id']}},_0x5057ab={};_0x5057ab[_0xd35b('0x2a')]=_[_0xd35b('0x2b')](db[_0xd35b('0x28')][_0xd35b('0x29')]);_0x5057ab[_0xd35b('0x2c')]=_[_0xd35b('0x2b')](_0x47d8bc[_0xd35b('0x2c')]);_0x5057ab[_0xd35b('0x34')]=_[_0xd35b('0x2d')](_0x5057ab[_0xd35b('0x2a')],_0x5057ab['query']);_0x138e02[_0xd35b('0x2e')]=_[_0xd35b('0x2d')](_0x5057ab[_0xd35b('0x2a')],qs[_0xd35b('0x2f')](_0x47d8bc[_0xd35b('0x2c')]['fields']));_0x138e02[_0xd35b('0x2e')]=_0x138e02[_0xd35b('0x2e')][_0xd35b('0x30')]?_0x138e02[_0xd35b('0x2e')]:_0x5057ab[_0xd35b('0x2a')];if(_0x47d8bc[_0xd35b('0x2c')]['includeAll']){_0x138e02[_0xd35b('0x42')]=[{'all':!![]}];}_0x138e02=_[_0xd35b('0x36')]({},_0x138e02,_0x47d8bc[_0xd35b('0x3d')]);return db[_0xd35b('0x28')][_0xd35b('0x43')](_0x138e02)[_0xd35b('0x22')](handleEntityNotFound(_0x46093d,null))['then'](respondWithResult(_0x46093d,null))[_0xd35b('0x40')](handleError(_0x46093d,null));};exports[_0xd35b('0x44')]=function(_0x55bb8f,_0x16e578){return db[_0xd35b('0x28')][_0xd35b('0x44')](_0x55bb8f[_0xd35b('0x45')],{})[_0xd35b('0x22')](respondWithResult(_0x16e578,0xc9))[_0xd35b('0x40')](handleError(_0x16e578,null));};exports[_0xd35b('0x21')]=function(_0x528d80,_0x5d3cf9){if(_0x528d80['body']['id']){delete _0x528d80[_0xd35b('0x45')]['id'];}return db[_0xd35b('0x28')][_0xd35b('0x43')]({'where':{'id':_0x528d80[_0xd35b('0x46')]['id']}})[_0xd35b('0x22')](handleEntityNotFound(_0x5d3cf9,null))[_0xd35b('0x22')](saveUpdates(_0x528d80[_0xd35b('0x45')],null))[_0xd35b('0x22')](respondWithResult(_0x5d3cf9,null))[_0xd35b('0x40')](handleError(_0x5d3cf9,null));};exports[_0xd35b('0x23')]=function(_0x11caee,_0x195262){return db[_0xd35b('0x28')][_0xd35b('0x43')]({'where':{'id':_0x11caee['params']['id']}})[_0xd35b('0x22')](handleEntityNotFound(_0x195262,null))['then'](removeEntity(_0x195262,null))['catch'](handleError(_0x195262,null));};exports[_0xd35b('0x47')]=function(_0x2567f0,_0x238011){return db[_0xd35b('0x28')][_0xd35b('0x47')]()[_0xd35b('0x22')](respondWithResult(_0x238011,null))[_0xd35b('0x40')](handleError(_0x238011,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 1708f9c..086c11f 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 _0xf6b7=['util','../../config/logger','moment','bluebird','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0x19e928,_0x26a0e4){var _0x4e941f=function(_0x52a5cd){while(--_0x52a5cd){_0x19e928['push'](_0x19e928['shift']());}};_0x4e941f(++_0x26a0e4);}(_0xf6b7,0x117));var _0x7f6b=function(_0x4357cd,_0x3e26b3){_0x4357cd=_0x4357cd-0x0;var _0x4161b8=_0xf6b7[_0x4357cd];return _0x4161b8;};'use strict';var _=require(_0x7f6b('0x0'));var util=require(_0x7f6b('0x1'));var logger=require(_0x7f6b('0x2'))('api');var moment=require(_0x7f6b('0x3'));var BPromise=require(_0x7f6b('0x4'));var rp=require('request-promise');var attributes=require('./faxQueueReport.attributes');module[_0x7f6b('0x5')]=function(_0x3d9156,_0x2f50fb){return _0x3d9156[_0x7f6b('0x6')](_0x7f6b('0x7'),attributes,{'tableName':_0x7f6b('0x8'),'paranoid':![],'indexes':[{'name':_0x7f6b('0x9'),'fields':[_0x7f6b('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe028=['moment','bluebird','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x4ca426,_0x265a46){var _0x23edec=function(_0xe03a6a){while(--_0xe03a6a){_0x4ca426['push'](_0x4ca426['shift']());}};_0x23edec(++_0x265a46);}(_0xe028,0x15c));var _0x8e02=function(_0x47cc41,_0x11e552){_0x47cc41=_0x47cc41-0x0;var _0x580c72=_0xe028[_0x47cc41];return _0x580c72;};'use strict';var _=require(_0x8e02('0x0'));var util=require(_0x8e02('0x1'));var logger=require(_0x8e02('0x2'))('api');var moment=require(_0x8e02('0x3'));var BPromise=require(_0x8e02('0x4'));var rp=require('request-promise');var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x1d2232,_0x2dec49){return _0x1d2232[_0x8e02('0x5')](_0x8e02('0x6'),attributes,{'tableName':_0x8e02('0x7'),'paranoid':![],'indexes':[{'name':_0x8e02('0x8'),'fields':[_0x8e02('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 072dbb5..2ef591c 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 _0x315f=['body','options','raw','stringify','UpdateFaxQueueReport','update','where','attributes','lodash','moment','ioredis','../../config/environment','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateFaxQueueReport','create'];(function(_0x3f2855,_0x220576){var _0x20c16f=function(_0x38da20){while(--_0x38da20){_0x3f2855['push'](_0x3f2855['shift']());}};_0x20c16f(++_0x220576);}(_0x315f,0x174));var _0xf315=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x315f[_0x1abb09];return _0xea1c07;};'use strict';var _=require(_0xf315('0x0'));var util=require('util');var moment=require(_0xf315('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf315('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf315('0x3'));var jayson=require('jayson/promise');var client=jayson[_0xf315('0x4')][_0xf315('0x5')]({'port':0x232a});function respondWithRpcPromise(_0xc2344,_0x1e42f7,_0xbfd128){return new BPromise(function(_0x430ba1,_0x48679b){return client['request'](_0xc2344,_0xbfd128)[_0xf315('0x6')](function(_0x529dae){logger[_0xf315('0x7')](_0xf315('0x8'),_0x1e42f7,_0xf315('0x9'));logger[_0xf315('0xa')](_0xf315('0xb'),_0x1e42f7,'request\x20sent',JSON['stringify'](_0x529dae));if(_0x529dae[_0xf315('0xc')]){if(_0x529dae['error']['code']===0x1f4){logger[_0xf315('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x1e42f7,_0x529dae[_0xf315('0xc')][_0xf315('0xd')]);return _0x48679b(_0x529dae[_0xf315('0xc')][_0xf315('0xd')]);}logger['error'](_0xf315('0x8'),_0x1e42f7,_0x529dae[_0xf315('0xc')]['message']);return _0x430ba1(_0x529dae[_0xf315('0xc')]['message']);}else{logger[_0xf315('0x7')](_0xf315('0x8'),_0x1e42f7,_0xf315('0x9'));_0x430ba1(_0x529dae[_0xf315('0xe')][_0xf315('0xd')]);}})[_0xf315('0xf')](function(_0xc4dde8){logger[_0xf315('0xc')](_0xf315('0x8'),_0x1e42f7,_0xc4dde8);_0x48679b(_0xc4dde8);});});}exports[_0xf315('0x10')]=function(_0x3cc17b){var _0x252d9c=this;return new Promise(function(_0x24ae41,_0xb5fcb6){return db['FaxQueueReport'][_0xf315('0x11')](_0x3cc17b[_0xf315('0x12')],{'raw':_0x3cc17b[_0xf315('0x13')]?_0x3cc17b[_0xf315('0x13')][_0xf315('0x14')]===undefined?!![]:![]:!![]})[_0xf315('0x6')](function(_0x46fb5d){logger[_0xf315('0x7')]('CreateFaxQueueReport',_0x3cc17b);logger[_0xf315('0xa')](_0xf315('0x10'),_0x3cc17b,JSON[_0xf315('0x15')](_0x46fb5d));_0x24ae41(_0x46fb5d);})[_0xf315('0xf')](function(_0x21dfad){logger['error'](_0xf315('0x10'),_0x21dfad['message'],_0x3cc17b);_0xb5fcb6(_0x252d9c['error'](0x1f4,_0x21dfad['message']));});});};exports[_0xf315('0x16')]=function(_0x219bf2){var _0x14021d=this;return new Promise(function(_0x3dd922,_0x523ee9){return db['FaxQueueReport'][_0xf315('0x17')](_0x219bf2[_0xf315('0x12')],{'raw':_0x219bf2['options']?_0x219bf2[_0xf315('0x13')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x219bf2[_0xf315('0x13')]?_0x219bf2['options'][_0xf315('0x18')]||null:null,'attributes':_0x219bf2[_0xf315('0x13')]?_0x219bf2[_0xf315('0x13')][_0xf315('0x19')]||null:null,'limit':_0x219bf2[_0xf315('0x13')]?_0x219bf2['options']['limit']||null:null})[_0xf315('0x6')](function(_0x2072db){logger[_0xf315('0x7')](_0xf315('0x16'),_0x219bf2);logger[_0xf315('0xa')](_0xf315('0x16'),_0x219bf2,JSON[_0xf315('0x15')](_0x2072db));_0x3dd922(_0x2072db);})[_0xf315('0xf')](function(_0x11993e){logger['error'](_0xf315('0x16'),_0x11993e[_0xf315('0xd')],_0x219bf2);_0x523ee9(_0x14021d[_0xf315('0xc')](0x1f4,_0x11993e[_0xf315('0xd')]));});});}; \ No newline at end of file +var _0x0bb4=['../../mysqldb','../../config/logger','../../config/environment','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis'];(function(_0x5da38b,_0x49b17c){var _0x23f783=function(_0x299fb1){while(--_0x299fb1){_0x5da38b['push'](_0x5da38b['shift']());}};_0x23f783(++_0x49b17c);}(_0x0bb4,0x77));var _0x40bb=function(_0x259b71,_0xf4e1fd){_0x259b71=_0x259b71-0x0;var _0xafb91=_0x0bb4[_0x259b71];return _0xafb91;};'use strict';var _=require(_0x40bb('0x0'));var util=require(_0x40bb('0x1'));var moment=require('moment');var BPromise=require(_0x40bb('0x2'));var rs=require(_0x40bb('0x3'));var fs=require('fs');var Redis=require(_0x40bb('0x4'));var db=require(_0x40bb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x40bb('0x6'))('rpc');var config=require(_0x40bb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x40bb('0x8')][_0x40bb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d15f6,_0x266c1e,_0x1243f4){return new BPromise(function(_0x50d70f,_0x1dc35d){return client['request'](_0x4d15f6,_0x1243f4)[_0x40bb('0xa')](function(_0x3bc5c5){logger[_0x40bb('0xb')](_0x40bb('0xc'),_0x266c1e,_0x40bb('0xd'));logger[_0x40bb('0xe')](_0x40bb('0xf'),_0x266c1e,_0x40bb('0xd'),JSON[_0x40bb('0x10')](_0x3bc5c5));if(_0x3bc5c5[_0x40bb('0x11')]){if(_0x3bc5c5[_0x40bb('0x11')][_0x40bb('0x12')]===0x1f4){logger[_0x40bb('0x11')](_0x40bb('0xc'),_0x266c1e,_0x3bc5c5[_0x40bb('0x11')][_0x40bb('0x13')]);return _0x1dc35d(_0x3bc5c5[_0x40bb('0x11')]['message']);}logger['error'](_0x40bb('0xc'),_0x266c1e,_0x3bc5c5[_0x40bb('0x11')][_0x40bb('0x13')]);return _0x50d70f(_0x3bc5c5[_0x40bb('0x11')][_0x40bb('0x13')]);}else{logger[_0x40bb('0xb')](_0x40bb('0xc'),_0x266c1e,_0x40bb('0xd'));_0x50d70f(_0x3bc5c5['result'][_0x40bb('0x13')]);}})[_0x40bb('0x14')](function(_0x416d95){logger[_0x40bb('0x11')](_0x40bb('0xc'),_0x266c1e,_0x416d95);_0x1dc35d(_0x416d95);});});}exports['CreateFaxQueueReport']=function(_0x132e44){var _0x55570a=this;return new Promise(function(_0x310548,_0x45e4a7){return db[_0x40bb('0x15')][_0x40bb('0x16')](_0x132e44[_0x40bb('0x17')],{'raw':_0x132e44['options']?_0x132e44[_0x40bb('0x18')][_0x40bb('0x19')]===undefined?!![]:![]:!![]})[_0x40bb('0xa')](function(_0x229619){logger[_0x40bb('0xb')](_0x40bb('0x1a'),_0x132e44);logger[_0x40bb('0xe')](_0x40bb('0x1a'),_0x132e44,JSON[_0x40bb('0x10')](_0x229619));_0x310548(_0x229619);})[_0x40bb('0x14')](function(_0x4699a3){logger[_0x40bb('0x11')]('CreateFaxQueueReport',_0x4699a3[_0x40bb('0x13')],_0x132e44);_0x45e4a7(_0x55570a[_0x40bb('0x11')](0x1f4,_0x4699a3[_0x40bb('0x13')]));});});};exports[_0x40bb('0x1b')]=function(_0x1c8cd2){var _0x3afda5=this;return new Promise(function(_0x3ab03b,_0x2a0278){return db[_0x40bb('0x15')][_0x40bb('0x1c')](_0x1c8cd2[_0x40bb('0x17')],{'raw':_0x1c8cd2['options']?_0x1c8cd2['options'][_0x40bb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c8cd2[_0x40bb('0x18')]?_0x1c8cd2[_0x40bb('0x18')]['where']||null:null,'attributes':_0x1c8cd2[_0x40bb('0x18')]?_0x1c8cd2[_0x40bb('0x18')][_0x40bb('0x1d')]||null:null,'limit':_0x1c8cd2[_0x40bb('0x18')]?_0x1c8cd2[_0x40bb('0x18')][_0x40bb('0x1e')]||null:null})[_0x40bb('0xa')](function(_0x39766a){logger[_0x40bb('0xb')]('UpdateFaxQueueReport',_0x1c8cd2);logger[_0x40bb('0xe')](_0x40bb('0x1b'),_0x1c8cd2,JSON['stringify'](_0x39766a));_0x3ab03b(_0x39766a);})[_0x40bb('0x14')](function(_0x5884ed){logger[_0x40bb('0x11')]('UpdateFaxQueueReport',_0x5884ed['message'],_0x1c8cd2);_0x2a0278(_0x3afda5[_0x40bb('0x11')](0x1f4,_0x5884ed[_0x40bb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 5e3ccbd..da9d168 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 _0x4001=['index','/:id','show','create','update','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated'];(function(_0x215279,_0x19104c){var _0x3cd8dd=function(_0x10c3b1){while(--_0x10c3b1){_0x215279['push'](_0x215279['shift']());}};_0x3cd8dd(++_0x19104c);}(_0x4001,0x1b7));var _0x1400=function(_0x5837a4,_0x15c0f7){_0x5837a4=_0x5837a4-0x0;var _0x1feb62=_0x4001[_0x5837a4];return _0x1feb62;};'use strict';var multer=require('multer');var util=require(_0x1400('0x0'));var path=require('path');var timeout=require(_0x1400('0x1'));var express=require(_0x1400('0x2'));var router=express[_0x1400('0x3')]();var auth=require(_0x1400('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1400('0x5'));var controller=require(_0x1400('0x6'));router[_0x1400('0x7')]('/',auth[_0x1400('0x8')](),controller[_0x1400('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x1400('0x7')](_0x1400('0xa'),auth[_0x1400('0x8')](),controller[_0x1400('0xb')]);router['post']('/',auth[_0x1400('0x8')](),controller[_0x1400('0xc')]);router['put'](_0x1400('0xa'),auth[_0x1400('0x8')](),controller[_0x1400('0xd')]);router[_0x1400('0xe')](_0x1400('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1400('0xf')]=router; \ No newline at end of file +var _0x985d=['delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','index','isAuthenticated','describe','get','/:id','post','update'];(function(_0x28ba9e,_0x1e8204){var _0x18c3cb=function(_0x2cf51b){while(--_0x2cf51b){_0x28ba9e['push'](_0x28ba9e['shift']());}};_0x18c3cb(++_0x1e8204);}(_0x985d,0xa5));var _0xd985=function(_0x293c20,_0x3707e4){_0x293c20=_0x293c20-0x0;var _0xbf2def=_0x985d[_0x293c20];return _0xbf2def;};'use strict';var multer=require(_0xd985('0x0'));var util=require(_0xd985('0x1'));var path=require(_0xd985('0x2'));var timeout=require('connect-timeout');var express=require(_0xd985('0x3'));var router=express[_0xd985('0x4')]();var auth=require(_0xd985('0x5'));var interaction=require(_0xd985('0x6'));var config=require('../../config/environment');var controller=require(_0xd985('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd985('0x8')]);router['get']('/describe',auth[_0xd985('0x9')](),controller[_0xd985('0xa')]);router[_0xd985('0xb')](_0xd985('0xc'),auth[_0xd985('0x9')](),controller['show']);router[_0xd985('0xd')]('/',auth[_0xd985('0x9')](),controller['create']);router['put'](_0xd985('0xc'),auth[_0xd985('0x9')](),controller[_0xd985('0xe')]);router[_0xd985('0xf')](_0xd985('0xc'),auth['isAuthenticated'](),controller[_0xd985('0x10')]);module[_0xd985('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index a2df6c3..8b80fd7 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 _0xa417=['exports','account','queue','DATE','NOW','moment'];(function(_0x405988,_0xbd3ca7){var _0x31b38b=function(_0x1728fc){while(--_0x1728fc){_0x405988['push'](_0x405988['shift']());}};_0x31b38b(++_0xbd3ca7);}(_0xa417,0x89));var _0x7a41=function(_0x105da3,_0x46b913){_0x105da3=_0x105da3-0x0;var _0x478ce9=_0xa417[_0x105da3];return _0x478ce9;};'use strict';var moment=require(_0x7a41('0x0'));var Sequelize=require('sequelize');module[_0x7a41('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7a41('0x2'),'agent',_0x7a41('0x3')),'allowNull':![],'defaultValue':_0x7a41('0x3')},'transferredAt':{'type':Sequelize[_0x7a41('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x7a41('0x5')]}}; \ No newline at end of file +var _0x56c6=['queue','DATE','NOW','exports','STRING','ENUM','account'];(function(_0x41b1fd,_0x3c2f8f){var _0x4dc2cd=function(_0x57d634){while(--_0x57d634){_0x41b1fd['push'](_0x41b1fd['shift']());}};_0x4dc2cd(++_0x3c2f8f);}(_0x56c6,0x73));var _0x656c=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x56c6[_0x209941];return _0x1e8729;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x656c('0x0')]={'uniqueid':{'type':Sequelize[_0x656c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x656c('0x2')](_0x656c('0x3'),'agent',_0x656c('0x4')),'allowNull':![],'defaultValue':_0x656c('0x4')},'transferredAt':{'type':Sequelize[_0x656c('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x656c('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 59951b8..8689f2a 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 _0xdcc4=['pick','filter','merge','map','type','VIRTUAL','field','options','include','findAll','params','keys','includeAll','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','update','then','destroy','stack','name','index','FaxTransferReport','rawAttributes','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x4e5257,_0x24f7ce){var _0x3ba7fa=function(_0x4fad61){while(--_0x4fad61){_0x4e5257['push'](_0x4e5257['shift']());}};_0x3ba7fa(++_0x24f7ce);}(_0xdcc4,0xea));var _0x4dcc=function(_0x1b28de,_0xc8f29c){_0x1b28de=_0x1b28de-0x0;var _0x287080=_0xdcc4[_0x1b28de];return _0x287080;};'use strict';var pdf=require(_0x4dcc('0x0'));var emlformat=require(_0x4dcc('0x1'));var rimraf=require(_0x4dcc('0x2'));var zipdir=require(_0x4dcc('0x3'));var jsonpatch=require(_0x4dcc('0x4'));var rp=require('request-promise');var moment=require(_0x4dcc('0x5'));var BPromise=require(_0x4dcc('0x6'));var Mustache=require(_0x4dcc('0x7'));var util=require(_0x4dcc('0x8'));var path=require(_0x4dcc('0x9'));var sox=require(_0x4dcc('0xa'));var csv=require('to-csv');var ejs=require(_0x4dcc('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4dcc('0xc'));var crypto=require(_0x4dcc('0xd'));var jsforce=require(_0x4dcc('0xe'));var deskjs=require(_0x4dcc('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4dcc('0x10'));var Papa=require(_0x4dcc('0x11'));var authService=require(_0x4dcc('0x12'));var hardwareService=require(_0x4dcc('0x13'));var Redis=require(_0x4dcc('0x14'));var qs=require(_0x4dcc('0x15'));var logger=require(_0x4dcc('0x16'))(_0x4dcc('0x17'));var utils=require('../../config/utils');var config=require(_0x4dcc('0x18'));var db=require(_0x4dcc('0x19'))['db'];function respondWithStatusCode(_0x5b83d2,_0x349b9b){_0x349b9b=_0x349b9b||0xcc;return function(_0x20013a){if(_0x20013a){return _0x5b83d2['sendStatus'](_0x349b9b);}return _0x5b83d2[_0x4dcc('0x1a')](_0x349b9b)[_0x4dcc('0x1b')]();};}function respondWithResult(_0x7df93c,_0x34febb){_0x34febb=_0x34febb||0xc8;return function(_0xa28755){if(_0xa28755){return _0x7df93c[_0x4dcc('0x1a')](_0x34febb)[_0x4dcc('0x1c')](_0xa28755);}};}function respondWithFilteredResult(_0x45a97b,_0x4949bf){return function(_0x4cb7f0){if(_0x4cb7f0){var _0x26c28c=_0x4cb7f0[_0x4dcc('0x1d')],_0x407072=_0x4949bf['offset'],_0xde3a5f=_0x4949bf[_0x4dcc('0x1e')]+_0x4949bf[_0x4dcc('0x1f')],_0x2f41d1;if(_0xde3a5f>=_0x26c28c){_0xde3a5f=_0x26c28c;_0x2f41d1=0xc8;}else{_0x2f41d1=0xce;}_0x45a97b['status'](_0x2f41d1);return _0x45a97b['set']('Content-Range',_0x407072+'-'+_0xde3a5f+'/'+_0x26c28c)[_0x4dcc('0x1c')](_0x4cb7f0);}return null;};}function patchUpdates(_0x31d9fe){return function(_0x50e5ba){try{jsonpatch[_0x4dcc('0x20')](_0x50e5ba,_0x31d9fe,!![]);}catch(_0x3fbb60){return BPromise[_0x4dcc('0x21')](_0x3fbb60);}return _0x50e5ba['save']();};}function saveUpdates(_0x27cb11,_0x1c14d8){return function(_0x39209e){if(_0x39209e){return _0x39209e[_0x4dcc('0x22')](_0x27cb11)[_0x4dcc('0x23')](function(_0x444387){return _0x444387;});}return null;};}function removeEntity(_0x44ae9e,_0x3c6d3b){return function(_0x1b2834){if(_0x1b2834){return _0x1b2834[_0x4dcc('0x24')]()[_0x4dcc('0x23')](function(){_0x44ae9e[_0x4dcc('0x1a')](0xcc)[_0x4dcc('0x1b')]();});}};}function handleEntityNotFound(_0x9007cc,_0xdeab92){return function(_0xc1c37b){if(!_0xc1c37b){_0x9007cc['sendStatus'](0x194);}return _0xc1c37b;};}function handleError(_0x3f3316,_0x21da43){_0x21da43=_0x21da43||0x1f4;return function(_0x23062b){logger['error'](_0x23062b[_0x4dcc('0x25')]);if(_0x23062b['name']){delete _0x23062b[_0x4dcc('0x26')];}_0x3f3316[_0x4dcc('0x1a')](_0x21da43)['send'](_0x23062b);};}exports[_0x4dcc('0x27')]=function(_0x2afff8,_0x4fb23c){var _0x388cc2={},_0x288514={},_0x4b007c={'count':0x0,'rows':[]};var _0x488bf3=db[_0x4dcc('0x28')][_0x4dcc('0x29')];_0x288514[_0x4dcc('0x2a')]=_['keys'](_0x488bf3);_0x288514[_0x4dcc('0x2b')]=_['keys'](_0x2afff8[_0x4dcc('0x2b')]);_0x288514[_0x4dcc('0x2c')]=_[_0x4dcc('0x2d')](_0x288514['model'],_0x288514[_0x4dcc('0x2b')]);_0x388cc2['attributes']=_['intersection'](_0x288514[_0x4dcc('0x2a')],qs['fields'](_0x2afff8[_0x4dcc('0x2b')][_0x4dcc('0x2e')]));_0x388cc2[_0x4dcc('0x2f')]=_0x388cc2[_0x4dcc('0x2f')][_0x4dcc('0x30')]?_0x388cc2[_0x4dcc('0x2f')]:_0x288514[_0x4dcc('0x2a')];if(!_0x2afff8[_0x4dcc('0x2b')][_0x4dcc('0x31')](_0x4dcc('0x32'))){_0x388cc2[_0x4dcc('0x1f')]=qs['limit'](_0x2afff8['query'][_0x4dcc('0x1f')]);_0x388cc2['offset']=qs[_0x4dcc('0x1e')](_0x2afff8[_0x4dcc('0x2b')][_0x4dcc('0x1e')]);}_0x388cc2[_0x4dcc('0x33')]=qs[_0x4dcc('0x34')](_0x2afff8[_0x4dcc('0x2b')][_0x4dcc('0x34')]);_0x388cc2[_0x4dcc('0x35')]=qs['filters'](_[_0x4dcc('0x36')](_0x2afff8['query'],_0x288514[_0x4dcc('0x2c')]));if(_0x2afff8['query'][_0x4dcc('0x37')]){_0x388cc2['where']=_[_0x4dcc('0x38')](_0x388cc2[_0x4dcc('0x35')],{'$or':_[_0x4dcc('0x39')](_0x488bf3,function(_0x2ea31d){if(_0x2ea31d[_0x4dcc('0x3a')]['key']!==_0x4dcc('0x3b')){var _0x4867de={};_0x4867de[_0x2ea31d[_0x4dcc('0x3c')]]={'$like':'%'+_0x2afff8[_0x4dcc('0x2b')][_0x4dcc('0x37')]+'%'};return _0x4867de;}})});}_0x388cc2=_[_0x4dcc('0x38')]({},_0x388cc2,_0x2afff8[_0x4dcc('0x3d')]);var _0x34f22d={'where':_0x388cc2[_0x4dcc('0x35')]};return db[_0x4dcc('0x28')][_0x4dcc('0x1d')](_0x34f22d)[_0x4dcc('0x23')](function(_0x426f9c){_0x4b007c[_0x4dcc('0x1d')]=_0x426f9c;if(_0x2afff8['query']['includeAll']){_0x388cc2[_0x4dcc('0x3e')]=[{'all':!![]}];}return db[_0x4dcc('0x28')][_0x4dcc('0x3f')](_0x388cc2);})['then'](function(_0x478343){_0x4b007c['rows']=_0x478343;return _0x4b007c;})[_0x4dcc('0x23')](respondWithFilteredResult(_0x4fb23c,_0x388cc2))['catch'](handleError(_0x4fb23c,null));};exports['show']=function(_0x12d859,_0x22ec39){var _0x1305a7={'raw':!![],'where':{'id':_0x12d859[_0x4dcc('0x40')]['id']}},_0x2ca9ed={};_0x2ca9ed[_0x4dcc('0x2a')]=_[_0x4dcc('0x41')](db[_0x4dcc('0x28')]['rawAttributes']);_0x2ca9ed['query']=_[_0x4dcc('0x41')](_0x12d859['query']);_0x2ca9ed[_0x4dcc('0x2c')]=_['intersection'](_0x2ca9ed[_0x4dcc('0x2a')],_0x2ca9ed['query']);_0x1305a7[_0x4dcc('0x2f')]=_[_0x4dcc('0x2d')](_0x2ca9ed['model'],qs[_0x4dcc('0x2e')](_0x12d859[_0x4dcc('0x2b')][_0x4dcc('0x2e')]));_0x1305a7['attributes']=_0x1305a7[_0x4dcc('0x2f')][_0x4dcc('0x30')]?_0x1305a7[_0x4dcc('0x2f')]:_0x2ca9ed[_0x4dcc('0x2a')];if(_0x12d859[_0x4dcc('0x2b')][_0x4dcc('0x42')]){_0x1305a7[_0x4dcc('0x3e')]=[{'all':!![]}];}_0x1305a7=_['merge']({},_0x1305a7,_0x12d859[_0x4dcc('0x3d')]);return db[_0x4dcc('0x28')][_0x4dcc('0x43')](_0x1305a7)['then'](handleEntityNotFound(_0x22ec39,null))[_0x4dcc('0x23')](respondWithResult(_0x22ec39,null))[_0x4dcc('0x44')](handleError(_0x22ec39,null));};exports['create']=function(_0xb68cf2,_0x34e7c3){return db[_0x4dcc('0x28')][_0x4dcc('0x45')](_0xb68cf2[_0x4dcc('0x46')],{})[_0x4dcc('0x23')](respondWithResult(_0x34e7c3,0xc9))['catch'](handleError(_0x34e7c3,null));};exports[_0x4dcc('0x22')]=function(_0x1cdac5,_0x3c267e){if(_0x1cdac5['body']['id']){delete _0x1cdac5[_0x4dcc('0x46')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x1cdac5[_0x4dcc('0x40')]['id']}})['then'](handleEntityNotFound(_0x3c267e,null))[_0x4dcc('0x23')](saveUpdates(_0x1cdac5[_0x4dcc('0x46')],null))[_0x4dcc('0x23')](respondWithResult(_0x3c267e,null))['catch'](handleError(_0x3c267e,null));};exports[_0x4dcc('0x24')]=function(_0x53e1f1,_0x33f80c){return db['FaxTransferReport'][_0x4dcc('0x43')]({'where':{'id':_0x53e1f1[_0x4dcc('0x40')]['id']}})['then'](handleEntityNotFound(_0x33f80c,null))[_0x4dcc('0x23')](removeEntity(_0x33f80c,null))[_0x4dcc('0x44')](handleError(_0x33f80c,null));};exports[_0x4dcc('0x47')]=function(_0x213f9a,_0x436cda){return db[_0x4dcc('0x28')][_0x4dcc('0x47')]()['then'](respondWithResult(_0x436cda,null))[_0x4dcc('0x44')](handleError(_0x436cda,null));}; \ No newline at end of file +var _0x5c37=['params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','save','then','destroy','error','stack','name','send','FaxTransferReport','rawAttributes','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','field','options','includeAll','include','findAll','rows','show','find','create','body','catch','update'];(function(_0x217759,_0x2e05fd){var _0x1b673b=function(_0x48305b){while(--_0x48305b){_0x217759['push'](_0x217759['shift']());}};_0x1b673b(++_0x2e05fd);}(_0x5c37,0x11e));var _0x75c3=function(_0x5712f8,_0x17156b){_0x5712f8=_0x5712f8-0x0;var _0x14a364=_0x5c37[_0x5712f8];return _0x14a364;};'use strict';var pdf=require(_0x75c3('0x0'));var emlformat=require(_0x75c3('0x1'));var rimraf=require(_0x75c3('0x2'));var zipdir=require(_0x75c3('0x3'));var jsonpatch=require(_0x75c3('0x4'));var rp=require(_0x75c3('0x5'));var moment=require('moment');var BPromise=require(_0x75c3('0x6'));var Mustache=require(_0x75c3('0x7'));var util=require(_0x75c3('0x8'));var path=require('path');var sox=require(_0x75c3('0x9'));var csv=require(_0x75c3('0xa'));var ejs=require(_0x75c3('0xb'));var fs=require('fs');var _=require(_0x75c3('0xc'));var squel=require('squel');var crypto=require(_0x75c3('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x75c3('0xa'));var querystring=require(_0x75c3('0xe'));var Papa=require('papaparse');var authService=require(_0x75c3('0xf'));var hardwareService=require(_0x75c3('0x10'));var Redis=require(_0x75c3('0x11'));var qs=require(_0x75c3('0x12'));var logger=require(_0x75c3('0x13'))(_0x75c3('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x75c3('0x15'))['db'];function respondWithStatusCode(_0x3c77f8,_0x3251ab){_0x3251ab=_0x3251ab||0xcc;return function(_0x23cb7d){if(_0x23cb7d){return _0x3c77f8[_0x75c3('0x16')](_0x3251ab);}return _0x3c77f8['status'](_0x3251ab)[_0x75c3('0x17')]();};}function respondWithResult(_0x233e25,_0x1b3c92){_0x1b3c92=_0x1b3c92||0xc8;return function(_0x55c296){if(_0x55c296){return _0x233e25['status'](_0x1b3c92)[_0x75c3('0x18')](_0x55c296);}};}function respondWithFilteredResult(_0x27310d,_0xbaafbd){return function(_0x1d34b8){if(_0x1d34b8){var _0x44a812=_0x1d34b8[_0x75c3('0x19')],_0x27fb5d=_0xbaafbd['offset'],_0x1d24cf=_0xbaafbd[_0x75c3('0x1a')]+_0xbaafbd[_0x75c3('0x1b')],_0x1f0d88;if(_0x1d24cf>=_0x44a812){_0x1d24cf=_0x44a812;_0x1f0d88=0xc8;}else{_0x1f0d88=0xce;}_0x27310d[_0x75c3('0x1c')](_0x1f0d88);return _0x27310d[_0x75c3('0x1d')](_0x75c3('0x1e'),_0x27fb5d+'-'+_0x1d24cf+'/'+_0x44a812)[_0x75c3('0x18')](_0x1d34b8);}return null;};}function patchUpdates(_0x2f32f5){return function(_0x13d699){try{jsonpatch[_0x75c3('0x1f')](_0x13d699,_0x2f32f5,!![]);}catch(_0x18dd2f){return BPromise['reject'](_0x18dd2f);}return _0x13d699[_0x75c3('0x20')]();};}function saveUpdates(_0xe6bd0d,_0x4a9345){return function(_0x2acef1){if(_0x2acef1){return _0x2acef1['update'](_0xe6bd0d)[_0x75c3('0x21')](function(_0x1a512c){return _0x1a512c;});}return null;};}function removeEntity(_0x40f416,_0x54f78b){return function(_0x2e7dbf){if(_0x2e7dbf){return _0x2e7dbf[_0x75c3('0x22')]()[_0x75c3('0x21')](function(){_0x40f416[_0x75c3('0x1c')](0xcc)[_0x75c3('0x17')]();});}};}function handleEntityNotFound(_0x5dfd43,_0x47cd8a){return function(_0x14faad){if(!_0x14faad){_0x5dfd43['sendStatus'](0x194);}return _0x14faad;};}function handleError(_0x45335b,_0x1f1a56){_0x1f1a56=_0x1f1a56||0x1f4;return function(_0x7ab611){logger[_0x75c3('0x23')](_0x7ab611[_0x75c3('0x24')]);if(_0x7ab611[_0x75c3('0x25')]){delete _0x7ab611['name'];}_0x45335b[_0x75c3('0x1c')](_0x1f1a56)[_0x75c3('0x26')](_0x7ab611);};}exports['index']=function(_0x3f12f1,_0x4db380){var _0x439d53={},_0x30aae0={},_0x4eede8={'count':0x0,'rows':[]};var _0x5a919d=db[_0x75c3('0x27')][_0x75c3('0x28')];_0x30aae0['model']=_[_0x75c3('0x29')](_0x5a919d);_0x30aae0[_0x75c3('0x2a')]=_[_0x75c3('0x29')](_0x3f12f1[_0x75c3('0x2a')]);_0x30aae0[_0x75c3('0x2b')]=_[_0x75c3('0x2c')](_0x30aae0[_0x75c3('0x2d')],_0x30aae0[_0x75c3('0x2a')]);_0x439d53['attributes']=_[_0x75c3('0x2c')](_0x30aae0[_0x75c3('0x2d')],qs[_0x75c3('0x2e')](_0x3f12f1[_0x75c3('0x2a')][_0x75c3('0x2e')]));_0x439d53[_0x75c3('0x2f')]=_0x439d53[_0x75c3('0x2f')][_0x75c3('0x30')]?_0x439d53[_0x75c3('0x2f')]:_0x30aae0[_0x75c3('0x2d')];if(!_0x3f12f1[_0x75c3('0x2a')][_0x75c3('0x31')]('nolimit')){_0x439d53[_0x75c3('0x1b')]=qs['limit'](_0x3f12f1['query'][_0x75c3('0x1b')]);_0x439d53['offset']=qs[_0x75c3('0x1a')](_0x3f12f1['query'][_0x75c3('0x1a')]);}_0x439d53[_0x75c3('0x32')]=qs[_0x75c3('0x33')](_0x3f12f1[_0x75c3('0x2a')][_0x75c3('0x33')]);_0x439d53[_0x75c3('0x34')]=qs[_0x75c3('0x2b')](_[_0x75c3('0x35')](_0x3f12f1[_0x75c3('0x2a')],_0x30aae0[_0x75c3('0x2b')]));if(_0x3f12f1[_0x75c3('0x2a')][_0x75c3('0x36')]){_0x439d53[_0x75c3('0x34')]=_[_0x75c3('0x37')](_0x439d53[_0x75c3('0x34')],{'$or':_['map'](_0x5a919d,function(_0x2406bd){if(_0x2406bd[_0x75c3('0x38')]['key']!=='VIRTUAL'){var _0xde30a7={};_0xde30a7[_0x2406bd[_0x75c3('0x39')]]={'$like':'%'+_0x3f12f1[_0x75c3('0x2a')][_0x75c3('0x36')]+'%'};return _0xde30a7;}})});}_0x439d53=_[_0x75c3('0x37')]({},_0x439d53,_0x3f12f1[_0x75c3('0x3a')]);var _0x418f5a={'where':_0x439d53[_0x75c3('0x34')]};return db[_0x75c3('0x27')][_0x75c3('0x19')](_0x418f5a)[_0x75c3('0x21')](function(_0x57764f){_0x4eede8[_0x75c3('0x19')]=_0x57764f;if(_0x3f12f1[_0x75c3('0x2a')][_0x75c3('0x3b')]){_0x439d53[_0x75c3('0x3c')]=[{'all':!![]}];}return db[_0x75c3('0x27')][_0x75c3('0x3d')](_0x439d53);})[_0x75c3('0x21')](function(_0x81f4d8){_0x4eede8[_0x75c3('0x3e')]=_0x81f4d8;return _0x4eede8;})[_0x75c3('0x21')](respondWithFilteredResult(_0x4db380,_0x439d53))['catch'](handleError(_0x4db380,null));};exports[_0x75c3('0x3f')]=function(_0x565cfb,_0x420942){var _0x34108b={'raw':!![],'where':{'id':_0x565cfb['params']['id']}},_0x1e1af5={};_0x1e1af5['model']=_['keys'](db[_0x75c3('0x27')][_0x75c3('0x28')]);_0x1e1af5[_0x75c3('0x2a')]=_[_0x75c3('0x29')](_0x565cfb[_0x75c3('0x2a')]);_0x1e1af5[_0x75c3('0x2b')]=_[_0x75c3('0x2c')](_0x1e1af5[_0x75c3('0x2d')],_0x1e1af5['query']);_0x34108b[_0x75c3('0x2f')]=_[_0x75c3('0x2c')](_0x1e1af5['model'],qs[_0x75c3('0x2e')](_0x565cfb[_0x75c3('0x2a')][_0x75c3('0x2e')]));_0x34108b['attributes']=_0x34108b[_0x75c3('0x2f')]['length']?_0x34108b[_0x75c3('0x2f')]:_0x1e1af5[_0x75c3('0x2d')];if(_0x565cfb[_0x75c3('0x2a')][_0x75c3('0x3b')]){_0x34108b[_0x75c3('0x3c')]=[{'all':!![]}];}_0x34108b=_[_0x75c3('0x37')]({},_0x34108b,_0x565cfb[_0x75c3('0x3a')]);return db[_0x75c3('0x27')][_0x75c3('0x40')](_0x34108b)[_0x75c3('0x21')](handleEntityNotFound(_0x420942,null))[_0x75c3('0x21')](respondWithResult(_0x420942,null))['catch'](handleError(_0x420942,null));};exports['create']=function(_0x77a0c2,_0xd698bb){return db[_0x75c3('0x27')][_0x75c3('0x41')](_0x77a0c2[_0x75c3('0x42')],{})[_0x75c3('0x21')](respondWithResult(_0xd698bb,0xc9))[_0x75c3('0x43')](handleError(_0xd698bb,null));};exports[_0x75c3('0x44')]=function(_0x598c9b,_0x37149f){if(_0x598c9b[_0x75c3('0x42')]['id']){delete _0x598c9b[_0x75c3('0x42')]['id'];}return db[_0x75c3('0x27')][_0x75c3('0x40')]({'where':{'id':_0x598c9b[_0x75c3('0x45')]['id']}})[_0x75c3('0x21')](handleEntityNotFound(_0x37149f,null))['then'](saveUpdates(_0x598c9b[_0x75c3('0x42')],null))['then'](respondWithResult(_0x37149f,null))[_0x75c3('0x43')](handleError(_0x37149f,null));};exports['destroy']=function(_0x8558be,_0x2c40ab){return db['FaxTransferReport']['find']({'where':{'id':_0x8558be['params']['id']}})[_0x75c3('0x21')](handleEntityNotFound(_0x2c40ab,null))[_0x75c3('0x21')](removeEntity(_0x2c40ab,null))[_0x75c3('0x43')](handleError(_0x2c40ab,null));};exports[_0x75c3('0x46')]=function(_0x34f7dc,_0x2152f0){return db[_0x75c3('0x27')][_0x75c3('0x46')]()[_0x75c3('0x21')](respondWithResult(_0x2152f0,null))[_0x75c3('0x43')](handleError(_0x2152f0,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 376cea5..c5cd8f7 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 _0xd22f=['define','FaxTransferReport','uniqueid','util','../../config/logger','api','moment','request-promise'];(function(_0x44bae2,_0xede077){var _0x43123f=function(_0x16469c){while(--_0x16469c){_0x44bae2['push'](_0x44bae2['shift']());}};_0x43123f(++_0xede077);}(_0xd22f,0x193));var _0xfd22=function(_0x3cf713,_0x3901a9){_0x3cf713=_0x3cf713-0x0;var _0x174d42=_0xd22f[_0x3cf713];return _0x174d42;};'use strict';var _=require('lodash');var util=require(_0xfd22('0x0'));var logger=require(_0xfd22('0x1'))(_0xfd22('0x2'));var moment=require(_0xfd22('0x3'));var BPromise=require('bluebird');var rp=require(_0xfd22('0x4'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x4ba387,_0x330aef){return _0x4ba387[_0xfd22('0x5')](_0xfd22('0x6'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xfd22('0x7'),'fields':[_0xfd22('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7396=['bluebird','request-promise','./faxTransferReport.attributes','exports','define','lodash','util','moment'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x7396,0xb5));var _0x6739=function(_0xa97a04,_0x2a3e3a){_0xa97a04=_0xa97a04-0x0;var _0x1f5515=_0x7396[_0xa97a04];return _0x1f5515;};'use strict';var _=require(_0x6739('0x0'));var util=require(_0x6739('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6739('0x2'));var BPromise=require(_0x6739('0x3'));var rp=require(_0x6739('0x4'));var attributes=require(_0x6739('0x5'));module[_0x6739('0x6')]=function(_0x2313a4,_0xfa9b3){return _0x2313a4[_0x6739('0x7')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 6513602..b04c8a1 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 _0xbd66=['error','code','message','FaxTransferReport,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x5dc5ce,_0x4b09d8){var _0x178c22=function(_0x3faf79){while(--_0x3faf79){_0x5dc5ce['push'](_0x5dc5ce['shift']());}};_0x178c22(++_0x4b09d8);}(_0xbd66,0x1a7));var _0x6bd6=function(_0x506335,_0x3c2210){_0x506335=_0x506335-0x0;var _0x3f69e1=_0xbd66[_0x506335];return _0x3f69e1;};'use strict';var _=require(_0x6bd6('0x0'));var util=require('util');var moment=require(_0x6bd6('0x1'));var BPromise=require(_0x6bd6('0x2'));var rs=require(_0x6bd6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6bd6('0x4'));var logger=require(_0x6bd6('0x5'))(_0x6bd6('0x6'));var config=require(_0x6bd6('0x7'));var jayson=require(_0x6bd6('0x8'));var client=jayson[_0x6bd6('0x9')][_0x6bd6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b5e63,_0x1dcc51,_0x471b2e){return new BPromise(function(_0x2bebd9,_0x448545){return client[_0x6bd6('0xb')](_0x4b5e63,_0x471b2e)[_0x6bd6('0xc')](function(_0x1ff63e){logger[_0x6bd6('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x1dcc51,_0x6bd6('0xe'));logger[_0x6bd6('0xf')](_0x6bd6('0x10'),_0x1dcc51,_0x6bd6('0xe'),JSON['stringify'](_0x1ff63e));if(_0x1ff63e[_0x6bd6('0x11')]){if(_0x1ff63e[_0x6bd6('0x11')][_0x6bd6('0x12')]===0x1f4){logger[_0x6bd6('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x1dcc51,_0x1ff63e[_0x6bd6('0x11')][_0x6bd6('0x13')]);return _0x448545(_0x1ff63e[_0x6bd6('0x11')][_0x6bd6('0x13')]);}logger['error'](_0x6bd6('0x14'),_0x1dcc51,_0x1ff63e[_0x6bd6('0x11')][_0x6bd6('0x13')]);return _0x2bebd9(_0x1ff63e[_0x6bd6('0x11')][_0x6bd6('0x13')]);}else{logger[_0x6bd6('0xd')](_0x6bd6('0x14'),_0x1dcc51,'request\x20sent');_0x2bebd9(_0x1ff63e[_0x6bd6('0x15')][_0x6bd6('0x13')]);}})['catch'](function(_0x444584){logger[_0x6bd6('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x1dcc51,_0x444584);_0x448545(_0x444584);});});} \ No newline at end of file +var _0xeea9=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x567d9f,_0x44354c){var _0x28ab37=function(_0x1870ad){while(--_0x1870ad){_0x567d9f['push'](_0x567d9f['shift']());}};_0x28ab37(++_0x44354c);}(_0xeea9,0x6a));var _0x9eea=function(_0x519ad5,_0x2dbb51){_0x519ad5=_0x519ad5-0x0;var _0x58c6e0=_0xeea9[_0x519ad5];return _0x58c6e0;};'use strict';var _=require(_0x9eea('0x0'));var util=require(_0x9eea('0x1'));var moment=require('moment');var BPromise=require(_0x9eea('0x2'));var rs=require(_0x9eea('0x3'));var fs=require('fs');var Redis=require(_0x9eea('0x4'));var db=require(_0x9eea('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9eea('0x6'))(_0x9eea('0x7'));var config=require('../../config/environment');var jayson=require(_0x9eea('0x8'));var client=jayson['client'][_0x9eea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x100df4,_0x15d329,_0x1a4883){return new BPromise(function(_0x4d240d,_0x5f5871){return client[_0x9eea('0xa')](_0x100df4,_0x1a4883)[_0x9eea('0xb')](function(_0x3b1cd9){logger['info'](_0x9eea('0xc'),_0x15d329,_0x9eea('0xd'));logger['debug'](_0x9eea('0xe'),_0x15d329,_0x9eea('0xd'),JSON[_0x9eea('0xf')](_0x3b1cd9));if(_0x3b1cd9['error']){if(_0x3b1cd9[_0x9eea('0x10')][_0x9eea('0x11')]===0x1f4){logger['error'](_0x9eea('0xc'),_0x15d329,_0x3b1cd9[_0x9eea('0x10')]['message']);return _0x5f5871(_0x3b1cd9[_0x9eea('0x10')][_0x9eea('0x12')]);}logger[_0x9eea('0x10')](_0x9eea('0xc'),_0x15d329,_0x3b1cd9[_0x9eea('0x10')][_0x9eea('0x12')]);return _0x4d240d(_0x3b1cd9[_0x9eea('0x10')]['message']);}else{logger[_0x9eea('0x13')](_0x9eea('0xc'),_0x15d329,_0x9eea('0xd'));_0x4d240d(_0x3b1cd9['result'][_0x9eea('0x12')]);}})[_0x9eea('0x14')](function(_0xfbaa7){logger[_0x9eea('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x15d329,_0xfbaa7);_0x5f5871(_0xfbaa7);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 7648bc2..fe21633 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 _0x24ca=['put','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x24ca,0x1bc));var _0xa24c=function(_0x3b711c,_0x4b22dc){_0x3b711c=_0x3b711c-0x0;var _0x2685f0=_0x24ca[_0x3b711c];return _0x2685f0;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var auth=require(_0xa24c('0x4'));var interaction=require(_0xa24c('0x5'));var config=require(_0xa24c('0x6'));var controller=require(_0xa24c('0x7'));router[_0xa24c('0x8')]('/',auth[_0xa24c('0x9')](),controller[_0xa24c('0xa')]);router[_0xa24c('0x8')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xc')]);router['get'](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xe')]);router['post']('/',auth[_0xa24c('0x9')](),controller[_0xa24c('0xf')]);router[_0xa24c('0x10')](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x11')]);router[_0xa24c('0x12')](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller['destroy']);module[_0xa24c('0x13')]=router; \ No newline at end of file +var _0x0a9a=['show','post','create','put','update','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x0a9a,0x183));var _0xa0a9=function(_0x2baa1b,_0x175589){_0x2baa1b=_0x2baa1b-0x0;var _0x133e64=_0x0a9a[_0x2baa1b];return _0x133e64;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var auth=require(_0xa0a9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa0a9('0x5'));var controller=require(_0xa0a9('0x6'));router['get']('/',auth[_0xa0a9('0x7')](),controller[_0xa0a9('0x8')]);router[_0xa0a9('0x9')](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xb')]);router['get'](_0xa0a9('0xc'),auth[_0xa0a9('0x7')](),controller[_0xa0a9('0xd')]);router[_0xa0a9('0xe')]('/',auth['isAuthenticated'](),controller[_0xa0a9('0xf')]);router[_0xa0a9('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xa0a9('0x11')]);router[_0xa0a9('0x12')]('/:id',auth[_0xa0a9('0x7')](),controller['destroy']);module[_0xa0a9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index d2411cb..0d1a2bd 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 _0xfba6=['destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','delete'];(function(_0x595a21,_0x24790f){var _0x50df84=function(_0x3c7188){while(--_0x3c7188){_0x595a21['push'](_0x595a21['shift']());}};_0x50df84(++_0x24790f);}(_0xfba6,0x1cf));var _0x6fba=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xfba6[_0x2cfb58];return _0xd99951;};'use strict';var multer=require('multer');var util=require(_0x6fba('0x0'));var path=require('path');var timeout=require(_0x6fba('0x1'));var express=require(_0x6fba('0x2'));var router=express[_0x6fba('0x3')]();var auth=require(_0x6fba('0x4'));var interaction=require(_0x6fba('0x5'));var config=require(_0x6fba('0x6'));var controller=require(_0x6fba('0x7'));router[_0x6fba('0x8')]('/',auth[_0x6fba('0x9')](),controller[_0x6fba('0xa')]);router['get'](_0x6fba('0xb'),auth[_0x6fba('0x9')](),controller['show']);router[_0x6fba('0x8')](_0x6fba('0xc'),auth[_0x6fba('0x9')](),controller[_0x6fba('0xd')]);router[_0x6fba('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x6fba('0xe')]);router[_0x6fba('0xf')]('/',auth[_0x6fba('0x9')](),controller[_0x6fba('0x10')]);router[_0x6fba('0xf')]('/:id/configurations',auth[_0x6fba('0x9')](),controller[_0x6fba('0x11')]);router[_0x6fba('0x12')](_0x6fba('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x6fba('0x13')]('/:id',auth[_0x6fba('0x9')](),controller[_0x6fba('0x14')]);module['exports']=router; \ No newline at end of file +var _0x249c=['/:id/fields','getFields','create','post','addConfiguration','update','delete','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x1cd2c1,_0x2bf87a){var _0x25a296=function(_0x192eec){while(--_0x192eec){_0x1cd2c1['push'](_0x1cd2c1['shift']());}};_0x25a296(++_0x2bf87a);}(_0x249c,0x142));var _0xc249=function(_0x21af3a,_0x386e1d){_0x21af3a=_0x21af3a-0x0;var _0x268a49=_0x249c[_0x21af3a];return _0x268a49;};'use strict';var multer=require('multer');var util=require(_0xc249('0x0'));var path=require(_0xc249('0x1'));var timeout=require(_0xc249('0x2'));var express=require(_0xc249('0x3'));var router=express[_0xc249('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc249('0x5'));var config=require(_0xc249('0x6'));var controller=require(_0xc249('0x7'));router[_0xc249('0x8')]('/',auth[_0xc249('0x9')](),controller[_0xc249('0xa')]);router['get'](_0xc249('0xb'),auth[_0xc249('0x9')](),controller[_0xc249('0xc')]);router['get'](_0xc249('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0xc249('0xe'),auth[_0xc249('0x9')](),controller[_0xc249('0xf')]);router['post']('/',auth[_0xc249('0x9')](),controller[_0xc249('0x10')]);router[_0xc249('0x11')](_0xc249('0xd'),auth['isAuthenticated'](),controller[_0xc249('0x12')]);router['put'](_0xc249('0xb'),auth[_0xc249('0x9')](),controller[_0xc249('0x13')]);router[_0xc249('0x14')](_0xc249('0xb'),auth[_0xc249('0x9')](),controller['destroy']);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 dc3ccf0..54a62b9 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 _0x2ada=['newTab','sequelize','exports','STRING','ENUM','basic','integrationTab'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x2ada,0x7f));var _0xa2ad=function(_0x15876a,_0x15383d){_0x15876a=_0x15876a-0x0;var _0xbd900f=_0x2ada[_0x15876a];return _0xbd900f;};'use strict';var Sequelize=require(_0xa2ad('0x0'));module[_0xa2ad('0x1')]={'name':{'type':Sequelize[_0xa2ad('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa2ad('0x2')]},'authType':{'type':Sequelize[_0xa2ad('0x3')]('basic'),'defaultValue':_0xa2ad('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xa2ad('0x2')]},'consumerSecret':{'type':Sequelize[_0xa2ad('0x2')]},'token':{'type':Sequelize[_0xa2ad('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xa2ad('0x5'),_0xa2ad('0x6')),'defaultValue':_0xa2ad('0x5')}}; \ No newline at end of file +var _0x262b=['integrationTab','sequelize','exports','STRING','basic','ENUM'];(function(_0x5a0c4b,_0x581192){var _0x3cee26=function(_0x55721d){while(--_0x55721d){_0x5a0c4b['push'](_0x5a0c4b['shift']());}};_0x3cee26(++_0x581192);}(_0x262b,0x139));var _0xb262=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x262b[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb262('0x0'));module[_0xb262('0x1')]={'name':{'type':Sequelize[_0xb262('0x2')]},'description':{'type':Sequelize[_0xb262('0x2')]},'username':{'type':Sequelize[_0xb262('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0xb262('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xb262('0x2')]},'consumerKey':{'type':Sequelize[_0xb262('0x2')]},'consumerSecret':{'type':Sequelize[_0xb262('0x2')]},'token':{'type':Sequelize[_0xb262('0x2')]},'tokenSecret':{'type':Sequelize[_0xb262('0x2')]},'serverUrl':{'type':Sequelize[_0xb262('0x2')]},'type':{'type':Sequelize[_0xb262('0x4')](_0xb262('0x5'),'newTab'),'defaultValue':_0xb262('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 5fd57e7..14fa4e7 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 _0x94d2=['../../mysqldb','../../components/integrations/configuration','client','http','request','then','DeskAccount,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','sendStatus','stack','name','send','index','DeskAccount','rawAttributes','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','field','options','includeAll','include','findAll','show','params','intersection','find','create','update','body','DeskConfiguration','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','password','consumerSecret','token','tokenSecret','substring','lastIndexOf','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','%s:%s','username','toString','base64','concat','_embedded','entries','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x94d2,0x1cd));var _0x294d=function(_0x2181fc,_0x7283aa){_0x2181fc=_0x2181fc-0x0;var _0x315da1=_0x94d2[_0x2181fc];return _0x315da1;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x294d('0x0'));var zipdir=require(_0x294d('0x1'));var jsonpatch=require(_0x294d('0x2'));var rp=require(_0x294d('0x3'));var moment=require(_0x294d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x294d('0x5'));var path=require(_0x294d('0x6'));var sox=require(_0x294d('0x7'));var csv=require(_0x294d('0x8'));var ejs=require(_0x294d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x294d('0xa'));var jsforce=require(_0x294d('0xb'));var deskjs=require(_0x294d('0xc'));var toCsv=require(_0x294d('0x8'));var querystring=require(_0x294d('0xd'));var Papa=require('papaparse');var authService=require(_0x294d('0xe'));var hardwareService=require(_0x294d('0xf'));var Redis=require('ioredis');var qs=require(_0x294d('0x10'));var logger=require(_0x294d('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x294d('0x12'));var db=require(_0x294d('0x13'))['db'];var integrations=require(_0x294d('0x14'));var jayson=require('jayson/promise');var client=jayson[_0x294d('0x15')][_0x294d('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x4119da,_0x28066d,_0x47b276,_0xc3a5c8){return new BPromise(function(_0x49c38f,_0x5adc9c){var _0xed0e10=_0xc3a5c8||client;return _0xed0e10[_0x294d('0x17')](_0x4119da,_0x47b276)[_0x294d('0x18')](function(_0x28f7f6){logger['info'](_0x294d('0x19'),_0x28066d,'request\x20sent');logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x28066d,'request\x20sent',JSON[_0x294d('0x1a')](_0x28f7f6));if(_0x28f7f6[_0x294d('0x1b')]){if(_0x28f7f6[_0x294d('0x1b')][_0x294d('0x1c')]===0x1f4){logger[_0x294d('0x1b')](_0x294d('0x19'),_0x28066d,_0x28f7f6[_0x294d('0x1b')][_0x294d('0x1d')]);return _0x5adc9c(_0x28f7f6['error'][_0x294d('0x1d')]);}logger[_0x294d('0x1b')]('DeskAccount,\x20%s,\x20%s',_0x28066d,_0x28f7f6[_0x294d('0x1b')][_0x294d('0x1d')]);return _0x49c38f(_0x28f7f6[_0x294d('0x1b')][_0x294d('0x1d')]);}else{logger[_0x294d('0x1e')](_0x294d('0x19'),_0x28066d,_0x294d('0x1f'));_0x49c38f(_0x28f7f6[_0x294d('0x20')][_0x294d('0x1d')]);}})[_0x294d('0x21')](function(_0x419717){logger[_0x294d('0x1b')](_0x294d('0x19'),_0x28066d,_0x419717);_0x5adc9c(_0x419717);});});}function respondWithStatusCode(_0x2b2a1e,_0x4aa60){_0x4aa60=_0x4aa60||0xcc;return function(_0x524ff2){if(_0x524ff2){return _0x2b2a1e['sendStatus'](_0x4aa60);}return _0x2b2a1e[_0x294d('0x22')](_0x4aa60)[_0x294d('0x23')]();};}function respondWithResult(_0x10fb2e,_0x3f3492){_0x3f3492=_0x3f3492||0xc8;return function(_0x1cf383){if(_0x1cf383){return _0x10fb2e[_0x294d('0x22')](_0x3f3492)['json'](_0x1cf383);}};}function respondWithFilteredResult(_0x12f691,_0x5cac01){return function(_0x4670ae){if(_0x4670ae){var _0x233212=_0x4670ae[_0x294d('0x24')],_0x948f90=_0x5cac01[_0x294d('0x25')],_0x1f2dd7=_0x5cac01['offset']+_0x5cac01[_0x294d('0x26')],_0x160c42;if(_0x1f2dd7>=_0x233212){_0x1f2dd7=_0x233212;_0x160c42=0xc8;}else{_0x160c42=0xce;}_0x12f691[_0x294d('0x22')](_0x160c42);return _0x12f691[_0x294d('0x27')](_0x294d('0x28'),_0x948f90+'-'+_0x1f2dd7+'/'+_0x233212)[_0x294d('0x29')](_0x4670ae);}return null;};}function patchUpdates(_0x338cc1){return function(_0x21f7d5){try{jsonpatch[_0x294d('0x2a')](_0x21f7d5,_0x338cc1,!![]);}catch(_0x4d68ff){return BPromise[_0x294d('0x2b')](_0x4d68ff);}return _0x21f7d5[_0x294d('0x2c')]();};}function saveUpdates(_0x194f02,_0x3cf02d){return function(_0x594c76){if(_0x594c76){return _0x594c76['update'](_0x194f02)[_0x294d('0x18')](function(_0x5da8f){return _0x5da8f;});}return null;};}function removeEntity(_0x33ccc,_0x10ed0f){return function(_0x395ed8){if(_0x395ed8){return _0x395ed8[_0x294d('0x2d')]()[_0x294d('0x18')](function(){_0x33ccc[_0x294d('0x22')](0xcc)[_0x294d('0x23')]();});}};}function handleEntityNotFound(_0x5a1d90,_0x1334d4){return function(_0x2727fe){if(!_0x2727fe){_0x5a1d90[_0x294d('0x2e')](0x194);}return _0x2727fe;};}function handleError(_0x523641,_0xe84c1c){_0xe84c1c=_0xe84c1c||0x1f4;return function(_0x9ab7a0){logger['error'](_0x9ab7a0[_0x294d('0x2f')]);if(_0x9ab7a0[_0x294d('0x30')]){delete _0x9ab7a0['name'];}_0x523641['status'](_0xe84c1c)[_0x294d('0x31')](_0x9ab7a0);};}exports[_0x294d('0x32')]=function(_0x3da365,_0x5260a5){var _0x37aa78={},_0x330568={},_0x39be80={'count':0x0,'rows':[]};var _0xf7f5f9=db[_0x294d('0x33')][_0x294d('0x34')];_0x330568[_0x294d('0x35')]=_[_0x294d('0x36')](_0xf7f5f9);_0x330568[_0x294d('0x37')]=_[_0x294d('0x36')](_0x3da365[_0x294d('0x37')]);_0x330568[_0x294d('0x38')]=_['intersection'](_0x330568[_0x294d('0x35')],_0x330568[_0x294d('0x37')]);_0x37aa78[_0x294d('0x39')]=_['intersection'](_0x330568[_0x294d('0x35')],qs[_0x294d('0x3a')](_0x3da365[_0x294d('0x37')][_0x294d('0x3a')]));_0x37aa78['attributes']=_0x37aa78[_0x294d('0x39')][_0x294d('0x3b')]?_0x37aa78[_0x294d('0x39')]:_0x330568['model'];if(!_0x3da365[_0x294d('0x37')][_0x294d('0x3c')](_0x294d('0x3d'))){_0x37aa78['limit']=qs[_0x294d('0x26')](_0x3da365[_0x294d('0x37')][_0x294d('0x26')]);_0x37aa78[_0x294d('0x25')]=qs[_0x294d('0x25')](_0x3da365[_0x294d('0x37')][_0x294d('0x25')]);}_0x37aa78[_0x294d('0x3e')]=qs[_0x294d('0x3f')](_0x3da365[_0x294d('0x37')][_0x294d('0x3f')]);_0x37aa78[_0x294d('0x40')]=qs[_0x294d('0x38')](_[_0x294d('0x41')](_0x3da365[_0x294d('0x37')],_0x330568[_0x294d('0x38')]));if(_0x3da365[_0x294d('0x37')][_0x294d('0x42')]){_0x37aa78['where']=_[_0x294d('0x43')](_0x37aa78[_0x294d('0x40')],{'$or':_[_0x294d('0x44')](_0xf7f5f9,function(_0x555f4f){if(_0x555f4f[_0x294d('0x45')][_0x294d('0x46')]!=='VIRTUAL'){var _0x96e509={};_0x96e509[_0x555f4f[_0x294d('0x47')]]={'$like':'%'+_0x3da365[_0x294d('0x37')]['filter']+'%'};return _0x96e509;}})});}_0x37aa78=_[_0x294d('0x43')]({},_0x37aa78,_0x3da365[_0x294d('0x48')]);var _0x461679={'where':_0x37aa78[_0x294d('0x40')]};return db[_0x294d('0x33')][_0x294d('0x24')](_0x461679)['then'](function(_0x5caa3e){_0x39be80['count']=_0x5caa3e;if(_0x3da365[_0x294d('0x37')][_0x294d('0x49')]){_0x37aa78[_0x294d('0x4a')]=[{'all':!![]}];}return db[_0x294d('0x33')][_0x294d('0x4b')](_0x37aa78);})['then'](function(_0x366e92){_0x39be80['rows']=_0x366e92;return _0x39be80;})['then'](respondWithFilteredResult(_0x5260a5,_0x37aa78))[_0x294d('0x21')](handleError(_0x5260a5,null));};exports[_0x294d('0x4c')]=function(_0x28c100,_0x4882e3){var _0xb1a774={'raw':![],'where':{'id':_0x28c100[_0x294d('0x4d')]['id']}},_0x412c1a={};_0x412c1a['model']=_['keys'](db['DeskAccount']['rawAttributes']);_0x412c1a[_0x294d('0x37')]=_[_0x294d('0x36')](_0x28c100[_0x294d('0x37')]);_0x412c1a[_0x294d('0x38')]=_[_0x294d('0x4e')](_0x412c1a[_0x294d('0x35')],_0x412c1a[_0x294d('0x37')]);_0xb1a774[_0x294d('0x39')]=_[_0x294d('0x4e')](_0x412c1a[_0x294d('0x35')],qs[_0x294d('0x3a')](_0x28c100['query'][_0x294d('0x3a')]));_0xb1a774[_0x294d('0x39')]=_0xb1a774[_0x294d('0x39')][_0x294d('0x3b')]?_0xb1a774[_0x294d('0x39')]:_0x412c1a['model'];if(_0x28c100[_0x294d('0x37')][_0x294d('0x49')]){_0xb1a774[_0x294d('0x4a')]=[{'all':!![]}];}_0xb1a774=_['merge']({},_0xb1a774,_0x28c100[_0x294d('0x48')]);return db[_0x294d('0x33')][_0x294d('0x4f')](_0xb1a774)[_0x294d('0x18')](handleEntityNotFound(_0x4882e3,null))['then'](respondWithResult(_0x4882e3,null))[_0x294d('0x21')](handleError(_0x4882e3,null));};exports[_0x294d('0x50')]=function(_0x1824be,_0x5203a0){return db[_0x294d('0x33')][_0x294d('0x50')](_0x1824be['body'],{})['then'](respondWithResult(_0x5203a0,0xc9))[_0x294d('0x21')](handleError(_0x5203a0,null));};exports[_0x294d('0x51')]=function(_0x416b87,_0x16ed36){if(_0x416b87['body']['id']){delete _0x416b87['body']['id'];}return db[_0x294d('0x33')]['find']({'where':{'id':_0x416b87[_0x294d('0x4d')]['id']}})[_0x294d('0x18')](handleEntityNotFound(_0x16ed36,null))[_0x294d('0x18')](saveUpdates(_0x416b87[_0x294d('0x52')],null))[_0x294d('0x18')](respondWithResult(_0x16ed36,null))[_0x294d('0x21')](handleError(_0x16ed36,null));};exports[_0x294d('0x2d')]=function(_0x4d7e47,_0x18e44d){return db[_0x294d('0x33')][_0x294d('0x4f')]({'where':{'id':_0x4d7e47[_0x294d('0x4d')]['id']}})[_0x294d('0x18')](handleEntityNotFound(_0x18e44d,null))['then'](removeEntity(_0x18e44d,null))[_0x294d('0x21')](handleError(_0x18e44d,null));};exports['getConfigurations']=function(_0x1708b0,_0x7d892,_0x529be6){var _0x228bfb={};var _0x23455f={};var _0x467216;var _0x31785c;return db[_0x294d('0x33')]['findOne']({'where':{'id':_0x1708b0['params']['id']}})[_0x294d('0x18')](handleEntityNotFound(_0x7d892,null))[_0x294d('0x18')](function(_0x393e59){if(_0x393e59){_0x467216=_0x393e59;_0x23455f[_0x294d('0x35')]=_[_0x294d('0x36')](db[_0x294d('0x53')][_0x294d('0x34')]);_0x23455f[_0x294d('0x37')]=_['keys'](_0x1708b0[_0x294d('0x37')]);_0x23455f[_0x294d('0x38')]=_[_0x294d('0x4e')](_0x23455f['model'],_0x23455f[_0x294d('0x37')]);_0x228bfb[_0x294d('0x39')]=_[_0x294d('0x4e')](_0x23455f[_0x294d('0x35')],qs['fields'](_0x1708b0[_0x294d('0x37')][_0x294d('0x3a')]));_0x228bfb['attributes']=_0x228bfb[_0x294d('0x39')]['length']?_0x228bfb['attributes']:_0x23455f[_0x294d('0x35')];_0x228bfb['order']=qs['sort'](_0x1708b0[_0x294d('0x37')]['sort']);_0x228bfb[_0x294d('0x40')]=qs['filters'](_[_0x294d('0x41')](_0x1708b0[_0x294d('0x37')],_0x23455f[_0x294d('0x38')]));if(_0x1708b0[_0x294d('0x37')][_0x294d('0x42')]){_0x228bfb[_0x294d('0x40')]=_['merge'](_0x228bfb['where'],{'$or':_['map'](_0x228bfb['attributes'],function(_0x5786f8){var _0x846af2={};_0x846af2[_0x5786f8]={'$like':'%'+_0x1708b0[_0x294d('0x37')][_0x294d('0x42')]+'%'};return _0x846af2;})});}_0x228bfb=_['merge']({},_0x228bfb,_0x1708b0['options']);return _0x467216['getConfigurations'](_0x228bfb);}})[_0x294d('0x18')](function(_0x23e99a){if(_0x23e99a){_0x31785c=_0x23e99a[_0x294d('0x3b')];if(!_0x1708b0[_0x294d('0x37')][_0x294d('0x3c')](_0x294d('0x3d'))){_0x228bfb[_0x294d('0x26')]=qs[_0x294d('0x26')](_0x1708b0[_0x294d('0x37')]['limit']);_0x228bfb[_0x294d('0x25')]=qs[_0x294d('0x25')](_0x1708b0[_0x294d('0x37')][_0x294d('0x25')]);}return _0x467216[_0x294d('0x54')](_0x228bfb);}})[_0x294d('0x18')](function(_0x168d57){if(_0x168d57){return _0x168d57?{'count':_0x31785c,'rows':_0x168d57}:null;}})[_0x294d('0x18')](respondWithResult(_0x7d892,null))[_0x294d('0x21')](handleError(_0x7d892,null));};exports[_0x294d('0x55')]=function(_0x5374d3,_0x21cca3,_0x5bfcdc){if(_0x5374d3[_0x294d('0x52')]['id']){delete _0x5374d3[_0x294d('0x52')]['id'];}return db['DeskAccount'][_0x294d('0x56')]({'where':{'id':_0x5374d3[_0x294d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x21cca3,null))['then'](function(_0x2fd2fb){if(_0x2fd2fb){_0x5374d3['body']['AccountId']=_0x2fd2fb['id'];_0x5374d3['body'][_0x294d('0x57')]=integrations[_0x294d('0x58')](_0x5374d3[_0x294d('0x52')][_0x294d('0x59')],_0x5374d3['body']['type']);_0x5374d3['body'][_0x294d('0x5a')]=integrations[_0x294d('0x5b')](_0x5374d3[_0x294d('0x52')][_0x294d('0x59')],_0x5374d3[_0x294d('0x52')]['type']);return db[_0x294d('0x53')][_0x294d('0x50')](_0x5374d3[_0x294d('0x52')],{'include':[{'model':db[_0x294d('0x5c')],'as':'Subjects'},{'model':db[_0x294d('0x5c')],'as':_0x294d('0x5a')}]});}return null;})[_0x294d('0x18')](respondWithResult(_0x21cca3,null))[_0x294d('0x21')](handleError(_0x21cca3,null));};exports[_0x294d('0x5d')]=function(_0x405cc2,_0xfa1a07,_0xf8f564){var _0x15082b=[{'name':_0x294d('0x5e'),'label':_0x294d('0x5e'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x370292='';return db[_0x294d('0x33')]['findOne']({'where':{'id':_0x405cc2[_0x294d('0x4d')]['id']},'attributes':['id',_0x294d('0x5f'),_0x294d('0x60'),'username',_0x294d('0x61'),'consumerKey',_0x294d('0x62'),_0x294d('0x63'),_0x294d('0x64')]})[_0x294d('0x18')](handleEntityNotFound(_0xfa1a07,null))['then'](function(_0x5780cd){if(_0x5780cd){_0x370292=_0x5780cd['remoteUri'];var _0x1cd65b=_0x370292['slice'](-0x1);if(_0x1cd65b==='/'){_0x370292=_0x370292[_0x294d('0x65')](0x0,_0x370292[_0x294d('0x66')](_0x1cd65b));}var _0x275a86={'method':'GET','uri':util[_0x294d('0x67')](_0x294d('0x68'),_0x370292),'headers':{'Content-Type':_0x294d('0x69'),'Accept':_0x294d('0x69')},'json':!![]};if(_0x5780cd[_0x294d('0x60')]===_0x294d('0x6a')){_0x275a86[_0x294d('0x6b')]['Authorization']=util[_0x294d('0x67')](_0x294d('0x6c'),new Buffer(util[_0x294d('0x67')](_0x294d('0x6d'),_0x5780cd[_0x294d('0x6e')],_0x5780cd[_0x294d('0x61')]))[_0x294d('0x6f')](_0x294d('0x70')));}return rp(_0x275a86)[_0x294d('0x18')](function(_0x3eac29){return _0x15082b[_0x294d('0x71')](_[_0x294d('0x44')](_0x3eac29[_0x294d('0x72')][_0x294d('0x73')],function(_0x165938){return{'id':_0x165938[_0x294d('0x30')],'name':_0x165938[_0x294d('0x30')],'type':_0x165938[_0x294d('0x45')],'active':_0x165938['active'],'label':_0x165938[_0x294d('0x74')],'custom':!![]};}));});}})['then'](function(_0x27d8b1){return{'count':_0x27d8b1[_0x294d('0x3b')],'rows':_0x27d8b1};})[_0x294d('0x18')](respondWithResult(_0xfa1a07,null))['catch'](function(_0x2e9452){var _0x589f17=_0x405cc2[_0x294d('0x37')]['test']?0x1f4:_0x2e9452[_0x294d('0x75')]||0x1f4;logger['error'](_0x294d('0x76'),_0x294d('0x5d'),_0x589f17,JSON[_0x294d('0x1a')](_0x2e9452));delete _0x2e9452['name'];if(_0x589f17===0x191){_0x589f17=0x190;}_0xfa1a07[_0x294d('0x22')](_0x589f17)[_0x294d('0x31')](_0x405cc2[_0x294d('0x37')]['test']?{'message':_0x294d('0x77'),'statusCode':_0x2e9452[_0x294d('0x75')]}:_0x2e9452);});}; \ No newline at end of file +var _0x4d46=['find','create','body','destroy','getConfigurations','findOne','sort','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','priority','remoteUri','authType','username','password','consumerKey','token','slice','substring','GET','format','%s/custom_fields','Authorization','Basic\x20%s','%s:%s','base64','concat','map','_embedded','entries','label','test','statusCode','getFields','send','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','count','offset','set','Content-Range','json','apply','save','update','sendStatus','stack','name','index','DeskAccount','rawAttributes','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','limit','order','pick','filter','where','merge','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','params','intersection'];(function(_0x2d0d9f,_0x22c0d8){var _0x30243d=function(_0x29a92b){while(--_0x29a92b){_0x2d0d9f['push'](_0x2d0d9f['shift']());}};_0x30243d(++_0x22c0d8);}(_0x4d46,0x197));var _0x64d4=function(_0x5333c1,_0x5382d3){_0x5333c1=_0x5333c1-0x0;var _0x173c8d=_0x4d46[_0x5333c1];return _0x173c8d;};'use strict';var pdf=require(_0x64d4('0x0'));var emlformat=require(_0x64d4('0x1'));var rimraf=require(_0x64d4('0x2'));var zipdir=require(_0x64d4('0x3'));var jsonpatch=require(_0x64d4('0x4'));var rp=require(_0x64d4('0x5'));var moment=require('moment');var BPromise=require(_0x64d4('0x6'));var Mustache=require(_0x64d4('0x7'));var util=require(_0x64d4('0x8'));var path=require(_0x64d4('0x9'));var sox=require(_0x64d4('0xa'));var csv=require(_0x64d4('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x64d4('0xc'));var squel=require(_0x64d4('0xd'));var crypto=require('crypto');var jsforce=require(_0x64d4('0xe'));var deskjs=require(_0x64d4('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x64d4('0x10'));var qs=require(_0x64d4('0x11'));var logger=require(_0x64d4('0x12'))(_0x64d4('0x13'));var utils=require(_0x64d4('0x14'));var config=require(_0x64d4('0x15'));var db=require(_0x64d4('0x16'))['db'];var integrations=require(_0x64d4('0x17'));var jayson=require(_0x64d4('0x18'));var client=jayson['client'][_0x64d4('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x553f90,_0x3681db,_0x25416d,_0x2043f0){return new BPromise(function(_0x4762a9,_0x13b111){var _0x2b0c39=_0x2043f0||client;return _0x2b0c39['request'](_0x553f90,_0x25416d)[_0x64d4('0x1a')](function(_0x433af8){logger[_0x64d4('0x1b')](_0x64d4('0x1c'),_0x3681db,_0x64d4('0x1d'));logger[_0x64d4('0x1e')](_0x64d4('0x1f'),_0x3681db,'request\x20sent',JSON[_0x64d4('0x20')](_0x433af8));if(_0x433af8[_0x64d4('0x21')]){if(_0x433af8['error'][_0x64d4('0x22')]===0x1f4){logger[_0x64d4('0x21')](_0x64d4('0x1c'),_0x3681db,_0x433af8[_0x64d4('0x21')][_0x64d4('0x23')]);return _0x13b111(_0x433af8[_0x64d4('0x21')][_0x64d4('0x23')]);}logger[_0x64d4('0x21')]('DeskAccount,\x20%s,\x20%s',_0x3681db,_0x433af8[_0x64d4('0x21')][_0x64d4('0x23')]);return _0x4762a9(_0x433af8[_0x64d4('0x21')][_0x64d4('0x23')]);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x3681db,_0x64d4('0x1d'));_0x4762a9(_0x433af8[_0x64d4('0x24')][_0x64d4('0x23')]);}})['catch'](function(_0x3c7a8c){logger[_0x64d4('0x21')](_0x64d4('0x1c'),_0x3681db,_0x3c7a8c);_0x13b111(_0x3c7a8c);});});}function respondWithStatusCode(_0x3259a0,_0x157639){_0x157639=_0x157639||0xcc;return function(_0x2fec7d){if(_0x2fec7d){return _0x3259a0['sendStatus'](_0x157639);}return _0x3259a0[_0x64d4('0x25')](_0x157639)[_0x64d4('0x26')]();};}function respondWithResult(_0x3685f1,_0x2963b5){_0x2963b5=_0x2963b5||0xc8;return function(_0x4ee0b9){if(_0x4ee0b9){return _0x3685f1['status'](_0x2963b5)['json'](_0x4ee0b9);}};}function respondWithFilteredResult(_0x12b605,_0x58d1e8){return function(_0x24c45e){if(_0x24c45e){var _0x512d67=_0x24c45e[_0x64d4('0x27')],_0x3cce9a=_0x58d1e8[_0x64d4('0x28')],_0x44eb42=_0x58d1e8['offset']+_0x58d1e8['limit'],_0x1a35ce;if(_0x44eb42>=_0x512d67){_0x44eb42=_0x512d67;_0x1a35ce=0xc8;}else{_0x1a35ce=0xce;}_0x12b605[_0x64d4('0x25')](_0x1a35ce);return _0x12b605[_0x64d4('0x29')](_0x64d4('0x2a'),_0x3cce9a+'-'+_0x44eb42+'/'+_0x512d67)[_0x64d4('0x2b')](_0x24c45e);}return null;};}function patchUpdates(_0x77912e){return function(_0x1c3347){try{jsonpatch[_0x64d4('0x2c')](_0x1c3347,_0x77912e,!![]);}catch(_0x4cbbde){return BPromise['reject'](_0x4cbbde);}return _0x1c3347[_0x64d4('0x2d')]();};}function saveUpdates(_0x4124ab,_0x572ce0){return function(_0x3e602f){if(_0x3e602f){return _0x3e602f[_0x64d4('0x2e')](_0x4124ab)[_0x64d4('0x1a')](function(_0xcffa8f){return _0xcffa8f;});}return null;};}function removeEntity(_0x592825,_0x485f9d){return function(_0x2f9523){if(_0x2f9523){return _0x2f9523['destroy']()['then'](function(){_0x592825[_0x64d4('0x25')](0xcc)[_0x64d4('0x26')]();});}};}function handleEntityNotFound(_0x569988,_0x378f7f){return function(_0x551ac1){if(!_0x551ac1){_0x569988[_0x64d4('0x2f')](0x194);}return _0x551ac1;};}function handleError(_0x473380,_0x5126d3){_0x5126d3=_0x5126d3||0x1f4;return function(_0x5bcc50){logger[_0x64d4('0x21')](_0x5bcc50[_0x64d4('0x30')]);if(_0x5bcc50[_0x64d4('0x31')]){delete _0x5bcc50[_0x64d4('0x31')];}_0x473380[_0x64d4('0x25')](_0x5126d3)['send'](_0x5bcc50);};}exports[_0x64d4('0x32')]=function(_0x30128d,_0x1acb50){var _0x52a6f2={},_0x5c0847={},_0x2fc272={'count':0x0,'rows':[]};var _0x150bd1=db[_0x64d4('0x33')][_0x64d4('0x34')];_0x5c0847[_0x64d4('0x35')]=_[_0x64d4('0x36')](_0x150bd1);_0x5c0847['query']=_['keys'](_0x30128d[_0x64d4('0x37')]);_0x5c0847[_0x64d4('0x38')]=_['intersection'](_0x5c0847['model'],_0x5c0847[_0x64d4('0x37')]);_0x52a6f2['attributes']=_['intersection'](_0x5c0847['model'],qs['fields'](_0x30128d[_0x64d4('0x37')][_0x64d4('0x39')]));_0x52a6f2[_0x64d4('0x3a')]=_0x52a6f2[_0x64d4('0x3a')][_0x64d4('0x3b')]?_0x52a6f2[_0x64d4('0x3a')]:_0x5c0847['model'];if(!_0x30128d[_0x64d4('0x37')][_0x64d4('0x3c')](_0x64d4('0x3d'))){_0x52a6f2[_0x64d4('0x3e')]=qs[_0x64d4('0x3e')](_0x30128d[_0x64d4('0x37')][_0x64d4('0x3e')]);_0x52a6f2[_0x64d4('0x28')]=qs['offset'](_0x30128d[_0x64d4('0x37')]['offset']);}_0x52a6f2[_0x64d4('0x3f')]=qs['sort'](_0x30128d[_0x64d4('0x37')]['sort']);_0x52a6f2['where']=qs[_0x64d4('0x38')](_[_0x64d4('0x40')](_0x30128d[_0x64d4('0x37')],_0x5c0847[_0x64d4('0x38')]));if(_0x30128d[_0x64d4('0x37')][_0x64d4('0x41')]){_0x52a6f2[_0x64d4('0x42')]=_[_0x64d4('0x43')](_0x52a6f2[_0x64d4('0x42')],{'$or':_['map'](_0x150bd1,function(_0x337020){if(_0x337020[_0x64d4('0x44')][_0x64d4('0x45')]!==_0x64d4('0x46')){var _0x5096e3={};_0x5096e3[_0x337020[_0x64d4('0x47')]]={'$like':'%'+_0x30128d[_0x64d4('0x37')]['filter']+'%'};return _0x5096e3;}})});}_0x52a6f2=_['merge']({},_0x52a6f2,_0x30128d[_0x64d4('0x48')]);var _0x57e59b={'where':_0x52a6f2[_0x64d4('0x42')]};return db['DeskAccount'][_0x64d4('0x27')](_0x57e59b)[_0x64d4('0x1a')](function(_0x358316){_0x2fc272['count']=_0x358316;if(_0x30128d[_0x64d4('0x37')][_0x64d4('0x49')]){_0x52a6f2[_0x64d4('0x4a')]=[{'all':!![]}];}return db[_0x64d4('0x33')][_0x64d4('0x4b')](_0x52a6f2);})[_0x64d4('0x1a')](function(_0x5d1ed1){_0x2fc272[_0x64d4('0x4c')]=_0x5d1ed1;return _0x2fc272;})[_0x64d4('0x1a')](respondWithFilteredResult(_0x1acb50,_0x52a6f2))[_0x64d4('0x4d')](handleError(_0x1acb50,null));};exports[_0x64d4('0x4e')]=function(_0x57d9fe,_0x1048ed){var _0x4f48c2={'raw':![],'where':{'id':_0x57d9fe[_0x64d4('0x4f')]['id']}},_0x1f9689={};_0x1f9689['model']=_['keys'](db[_0x64d4('0x33')][_0x64d4('0x34')]);_0x1f9689['query']=_[_0x64d4('0x36')](_0x57d9fe[_0x64d4('0x37')]);_0x1f9689[_0x64d4('0x38')]=_[_0x64d4('0x50')](_0x1f9689['model'],_0x1f9689[_0x64d4('0x37')]);_0x4f48c2[_0x64d4('0x3a')]=_[_0x64d4('0x50')](_0x1f9689[_0x64d4('0x35')],qs[_0x64d4('0x39')](_0x57d9fe['query'][_0x64d4('0x39')]));_0x4f48c2[_0x64d4('0x3a')]=_0x4f48c2['attributes'][_0x64d4('0x3b')]?_0x4f48c2[_0x64d4('0x3a')]:_0x1f9689[_0x64d4('0x35')];if(_0x57d9fe['query'][_0x64d4('0x49')]){_0x4f48c2['include']=[{'all':!![]}];}_0x4f48c2=_[_0x64d4('0x43')]({},_0x4f48c2,_0x57d9fe[_0x64d4('0x48')]);return db[_0x64d4('0x33')][_0x64d4('0x51')](_0x4f48c2)[_0x64d4('0x1a')](handleEntityNotFound(_0x1048ed,null))[_0x64d4('0x1a')](respondWithResult(_0x1048ed,null))[_0x64d4('0x4d')](handleError(_0x1048ed,null));};exports['create']=function(_0x58db35,_0x54593f){return db[_0x64d4('0x33')][_0x64d4('0x52')](_0x58db35[_0x64d4('0x53')],{})[_0x64d4('0x1a')](respondWithResult(_0x54593f,0xc9))[_0x64d4('0x4d')](handleError(_0x54593f,null));};exports[_0x64d4('0x2e')]=function(_0x4e923d,_0xb22296){if(_0x4e923d[_0x64d4('0x53')]['id']){delete _0x4e923d[_0x64d4('0x53')]['id'];}return db[_0x64d4('0x33')][_0x64d4('0x51')]({'where':{'id':_0x4e923d[_0x64d4('0x4f')]['id']}})[_0x64d4('0x1a')](handleEntityNotFound(_0xb22296,null))[_0x64d4('0x1a')](saveUpdates(_0x4e923d['body'],null))[_0x64d4('0x1a')](respondWithResult(_0xb22296,null))[_0x64d4('0x4d')](handleError(_0xb22296,null));};exports[_0x64d4('0x54')]=function(_0xea990f,_0x146b5b){return db[_0x64d4('0x33')][_0x64d4('0x51')]({'where':{'id':_0xea990f[_0x64d4('0x4f')]['id']}})[_0x64d4('0x1a')](handleEntityNotFound(_0x146b5b,null))[_0x64d4('0x1a')](removeEntity(_0x146b5b,null))[_0x64d4('0x4d')](handleError(_0x146b5b,null));};exports[_0x64d4('0x55')]=function(_0x1ad2a8,_0x3ba14e,_0x462309){var _0x193017={};var _0x972d35={};var _0x3fbff9;var _0xd83dac;return db[_0x64d4('0x33')][_0x64d4('0x56')]({'where':{'id':_0x1ad2a8[_0x64d4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3ba14e,null))['then'](function(_0x3d9f67){if(_0x3d9f67){_0x3fbff9=_0x3d9f67;_0x972d35[_0x64d4('0x35')]=_['keys'](db['DeskConfiguration'][_0x64d4('0x34')]);_0x972d35[_0x64d4('0x37')]=_['keys'](_0x1ad2a8[_0x64d4('0x37')]);_0x972d35[_0x64d4('0x38')]=_[_0x64d4('0x50')](_0x972d35[_0x64d4('0x35')],_0x972d35[_0x64d4('0x37')]);_0x193017['attributes']=_[_0x64d4('0x50')](_0x972d35['model'],qs[_0x64d4('0x39')](_0x1ad2a8[_0x64d4('0x37')][_0x64d4('0x39')]));_0x193017[_0x64d4('0x3a')]=_0x193017[_0x64d4('0x3a')][_0x64d4('0x3b')]?_0x193017['attributes']:_0x972d35[_0x64d4('0x35')];_0x193017[_0x64d4('0x3f')]=qs[_0x64d4('0x57')](_0x1ad2a8[_0x64d4('0x37')]['sort']);_0x193017[_0x64d4('0x42')]=qs['filters'](_[_0x64d4('0x40')](_0x1ad2a8['query'],_0x972d35[_0x64d4('0x38')]));if(_0x1ad2a8[_0x64d4('0x37')][_0x64d4('0x41')]){_0x193017[_0x64d4('0x42')]=_[_0x64d4('0x43')](_0x193017[_0x64d4('0x42')],{'$or':_['map'](_0x193017[_0x64d4('0x3a')],function(_0x4d4864){var _0x48b928={};_0x48b928[_0x4d4864]={'$like':'%'+_0x1ad2a8[_0x64d4('0x37')][_0x64d4('0x41')]+'%'};return _0x48b928;})});}_0x193017=_[_0x64d4('0x43')]({},_0x193017,_0x1ad2a8['options']);return _0x3fbff9[_0x64d4('0x55')](_0x193017);}})[_0x64d4('0x1a')](function(_0x6d8010){if(_0x6d8010){_0xd83dac=_0x6d8010['length'];if(!_0x1ad2a8[_0x64d4('0x37')][_0x64d4('0x3c')]('nolimit')){_0x193017[_0x64d4('0x3e')]=qs[_0x64d4('0x3e')](_0x1ad2a8['query'][_0x64d4('0x3e')]);_0x193017[_0x64d4('0x28')]=qs[_0x64d4('0x28')](_0x1ad2a8[_0x64d4('0x37')]['offset']);}return _0x3fbff9[_0x64d4('0x55')](_0x193017);}})[_0x64d4('0x1a')](function(_0x35be3c){if(_0x35be3c){return _0x35be3c?{'count':_0xd83dac,'rows':_0x35be3c}:null;}})['then'](respondWithResult(_0x3ba14e,null))[_0x64d4('0x4d')](handleError(_0x3ba14e,null));};exports[_0x64d4('0x58')]=function(_0x5b6f09,_0x1e3f5d,_0x719eff){if(_0x5b6f09[_0x64d4('0x53')]['id']){delete _0x5b6f09[_0x64d4('0x53')]['id'];}return db[_0x64d4('0x33')][_0x64d4('0x56')]({'where':{'id':_0x5b6f09[_0x64d4('0x4f')]['id']}})[_0x64d4('0x1a')](handleEntityNotFound(_0x1e3f5d,null))[_0x64d4('0x1a')](function(_0x53160d){if(_0x53160d){_0x5b6f09[_0x64d4('0x53')][_0x64d4('0x59')]=_0x53160d['id'];_0x5b6f09[_0x64d4('0x53')][_0x64d4('0x5a')]=integrations[_0x64d4('0x5b')](_0x5b6f09[_0x64d4('0x53')][_0x64d4('0x5c')],_0x5b6f09[_0x64d4('0x53')][_0x64d4('0x44')]);_0x5b6f09['body'][_0x64d4('0x5d')]=integrations[_0x64d4('0x5e')](_0x5b6f09[_0x64d4('0x53')]['channel'],_0x5b6f09[_0x64d4('0x53')][_0x64d4('0x44')]);return db[_0x64d4('0x5f')]['create'](_0x5b6f09['body'],{'include':[{'model':db[_0x64d4('0x60')],'as':'Subjects'},{'model':db[_0x64d4('0x60')],'as':_0x64d4('0x5d')}]});}return null;})[_0x64d4('0x1a')](respondWithResult(_0x1e3f5d,null))[_0x64d4('0x4d')](handleError(_0x1e3f5d,null));};exports['getFields']=function(_0x1d7a03,_0x6a4ba3,_0x3c7911){var _0x4148b6=[{'name':_0x64d4('0x61'),'label':_0x64d4('0x61'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x369c52='';return db[_0x64d4('0x33')]['findOne']({'where':{'id':_0x1d7a03[_0x64d4('0x4f')]['id']},'attributes':['id',_0x64d4('0x62'),_0x64d4('0x63'),_0x64d4('0x64'),_0x64d4('0x65'),_0x64d4('0x66'),'consumerSecret',_0x64d4('0x67'),'tokenSecret']})[_0x64d4('0x1a')](handleEntityNotFound(_0x6a4ba3,null))['then'](function(_0x3813b7){if(_0x3813b7){_0x369c52=_0x3813b7['remoteUri'];var _0x46e2fa=_0x369c52[_0x64d4('0x68')](-0x1);if(_0x46e2fa==='/'){_0x369c52=_0x369c52[_0x64d4('0x69')](0x0,_0x369c52['lastIndexOf'](_0x46e2fa));}var _0x2268df={'method':_0x64d4('0x6a'),'uri':util[_0x64d4('0x6b')](_0x64d4('0x6c'),_0x369c52),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x3813b7[_0x64d4('0x63')]==='basic'){_0x2268df['headers'][_0x64d4('0x6d')]=util[_0x64d4('0x6b')](_0x64d4('0x6e'),new Buffer(util['format'](_0x64d4('0x6f'),_0x3813b7[_0x64d4('0x64')],_0x3813b7[_0x64d4('0x65')]))['toString'](_0x64d4('0x70')));}return rp(_0x2268df)[_0x64d4('0x1a')](function(_0xce34ac){return _0x4148b6[_0x64d4('0x71')](_[_0x64d4('0x72')](_0xce34ac[_0x64d4('0x73')][_0x64d4('0x74')],function(_0x111d4f){return{'id':_0x111d4f[_0x64d4('0x31')],'name':_0x111d4f[_0x64d4('0x31')],'type':_0x111d4f[_0x64d4('0x44')],'active':_0x111d4f['active'],'label':_0x111d4f[_0x64d4('0x75')],'custom':!![]};}));});}})[_0x64d4('0x1a')](function(_0x379c99){return{'count':_0x379c99[_0x64d4('0x3b')],'rows':_0x379c99};})[_0x64d4('0x1a')](respondWithResult(_0x6a4ba3,null))['catch'](function(_0x48a180){var _0x2b47c3=_0x1d7a03['query'][_0x64d4('0x76')]?0x1f4:_0x48a180[_0x64d4('0x77')]||0x1f4;logger[_0x64d4('0x21')]('getFields,\x20%s,\x20%s,\x20%s',_0x64d4('0x78'),_0x2b47c3,JSON[_0x64d4('0x20')](_0x48a180));delete _0x48a180[_0x64d4('0x31')];if(_0x2b47c3===0x191){_0x2b47c3=0x190;}_0x6a4ba3[_0x64d4('0x25')](_0x2b47c3)[_0x64d4('0x79')](_0x1d7a03['query'][_0x64d4('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x48a180[_0x64d4('0x77')]}:_0x48a180);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 82fdd73..3e057f2 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 _0xa7ee=['DeskAccount','lodash','../../config/logger','api','moment','bluebird','../../components/integrations/configuration','define'];(function(_0x2d7613,_0x11496a){var _0x421e66=function(_0x9a8a7a){while(--_0x9a8a7a){_0x2d7613['push'](_0x2d7613['shift']());}};_0x421e66(++_0x11496a);}(_0xa7ee,0x159));var _0xea7e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa7ee[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0xea7e('0x0'));var util=require('util');var logger=require(_0xea7e('0x1'))(_0xea7e('0x2'));var moment=require(_0xea7e('0x3'));var BPromise=require(_0xea7e('0x4'));var rp=require('request-promise');var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xea7e('0x5'));module['exports']=function(_0x2439f9,_0x40ec63){return _0x2439f9[_0xea7e('0x6')](_0xea7e('0x7'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac35=['api','moment','bluebird','request-promise','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','lodash','util','../../config/logger'];(function(_0x370dd8,_0x11daf3){var _0x39217a=function(_0x19315c){while(--_0x19315c){_0x370dd8['push'](_0x370dd8['shift']());}};_0x39217a(++_0x11daf3);}(_0xac35,0x141));var _0x5ac3=function(_0x2c300b,_0xe5dee6){_0x2c300b=_0x2c300b-0x0;var _0x35fcce=_0xac35[_0x2c300b];return _0x35fcce;};'use strict';var _=require(_0x5ac3('0x0'));var util=require(_0x5ac3('0x1'));var logger=require(_0x5ac3('0x2'))(_0x5ac3('0x3'));var moment=require(_0x5ac3('0x4'));var BPromise=require(_0x5ac3('0x5'));var rp=require(_0x5ac3('0x6'));var attributes=require(_0x5ac3('0x7'));var integrations=require(_0x5ac3('0x8'));module[_0x5ac3('0x9')]=function(_0x3d6646,_0x20278d){return _0x3d6646[_0x5ac3('0xa')](_0x5ac3('0xb'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index f79e91f..cdf8f2e 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 _0xa412=['include','map','model','GetDeskAccount','find','ShowDeskAccount','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','DeskAccount','findAll','options','raw','where','attributes','limit'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0xa412,0x127));var _0x2a41=function(_0x30b21d,_0x6ff965){_0x30b21d=_0x30b21d-0x0;var _0x300bc1=_0xa412[_0x30b21d];return _0x300bc1;};'use strict';var _=require(_0x2a41('0x0'));var util=require(_0x2a41('0x1'));var moment=require(_0x2a41('0x2'));var BPromise=require(_0x2a41('0x3'));var rs=require(_0x2a41('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a41('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2a41('0x6'))(_0x2a41('0x7'));var config=require('../../config/environment');var jayson=require(_0x2a41('0x8'));var client=jayson[_0x2a41('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fb2a5,_0x3c3620,_0x32af58){return new BPromise(function(_0x4d481f,_0x355027){return client[_0x2a41('0xa')](_0x3fb2a5,_0x32af58)[_0x2a41('0xb')](function(_0x21d1f1){logger[_0x2a41('0xc')](_0x2a41('0xd'),_0x3c3620,_0x2a41('0xe'));logger[_0x2a41('0xf')](_0x2a41('0x10'),_0x3c3620,_0x2a41('0xe'),JSON['stringify'](_0x21d1f1));if(_0x21d1f1[_0x2a41('0x11')]){if(_0x21d1f1[_0x2a41('0x11')][_0x2a41('0x12')]===0x1f4){logger[_0x2a41('0x11')](_0x2a41('0xd'),_0x3c3620,_0x21d1f1['error']['message']);return _0x355027(_0x21d1f1[_0x2a41('0x11')][_0x2a41('0x13')]);}logger[_0x2a41('0x11')](_0x2a41('0xd'),_0x3c3620,_0x21d1f1[_0x2a41('0x11')][_0x2a41('0x13')]);return _0x4d481f(_0x21d1f1[_0x2a41('0x11')]['message']);}else{logger[_0x2a41('0xc')]('DeskAccount,\x20%s,\x20%s',_0x3c3620,_0x2a41('0xe'));_0x4d481f(_0x21d1f1[_0x2a41('0x14')]['message']);}})[_0x2a41('0x15')](function(_0x147f46){logger['error'](_0x2a41('0xd'),_0x3c3620,_0x147f46);_0x355027(_0x147f46);});});}exports['GetDeskAccount']=function(_0x94301a){var _0xb8a1b4=this;return new Promise(function(_0x21eb3e,_0x5b1a09){return db[_0x2a41('0x16')][_0x2a41('0x17')]({'raw':_0x94301a[_0x2a41('0x18')]?_0x94301a['options'][_0x2a41('0x19')]===undefined?!![]:![]:!![],'where':_0x94301a['options']?_0x94301a[_0x2a41('0x18')][_0x2a41('0x1a')]||null:null,'attributes':_0x94301a[_0x2a41('0x18')]?_0x94301a[_0x2a41('0x18')][_0x2a41('0x1b')]||null:null,'limit':_0x94301a[_0x2a41('0x18')]?_0x94301a[_0x2a41('0x18')][_0x2a41('0x1c')]||null:null,'include':_0x94301a['options']?_0x94301a[_0x2a41('0x18')][_0x2a41('0x1d')]?_[_0x2a41('0x1e')](_0x94301a[_0x2a41('0x18')][_0x2a41('0x1d')],function(_0x1410b3){return{'model':db[_0x1410b3[_0x2a41('0x1f')]],'as':_0x1410b3['as'],'attributes':_0x1410b3[_0x2a41('0x1b')],'include':_0x1410b3['include']?_[_0x2a41('0x1e')](_0x1410b3[_0x2a41('0x1d')],function(_0x1b3d55){return{'model':db[_0x1b3d55[_0x2a41('0x1f')]],'as':_0x1b3d55['as'],'attributes':_0x1b3d55['attributes'],'include':_0x1b3d55[_0x2a41('0x1d')]?_[_0x2a41('0x1e')](_0x1b3d55[_0x2a41('0x1d')],function(_0x346427){return{'model':db[_0x346427[_0x2a41('0x1f')]],'as':_0x346427['as'],'attributes':_0x346427[_0x2a41('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2a41('0xb')](function(_0x4f0889){logger[_0x2a41('0xc')]('GetDeskAccount',_0x94301a);logger[_0x2a41('0xf')](_0x2a41('0x20'),_0x94301a,JSON['stringify'](_0x4f0889));_0x21eb3e(_0x4f0889);})[_0x2a41('0x15')](function(_0x153285){logger[_0x2a41('0x11')](_0x2a41('0x20'),_0x153285[_0x2a41('0x13')],_0x94301a);_0x5b1a09(_0xb8a1b4[_0x2a41('0x11')](0x1f4,_0x153285[_0x2a41('0x13')]));});});};exports['ShowDeskAccount']=function(_0x125439){var _0x3901c8=this;return new Promise(function(_0x175da2,_0xa8906f){return db[_0x2a41('0x16')][_0x2a41('0x21')]({'raw':_0x125439[_0x2a41('0x18')]?_0x125439['options'][_0x2a41('0x19')]===undefined?!![]:![]:!![],'where':_0x125439[_0x2a41('0x18')]?_0x125439['options'][_0x2a41('0x1a')]||null:null,'attributes':_0x125439[_0x2a41('0x18')]?_0x125439[_0x2a41('0x18')][_0x2a41('0x1b')]||null:null,'include':_0x125439[_0x2a41('0x18')]?_0x125439['options'][_0x2a41('0x1d')]?_[_0x2a41('0x1e')](_0x125439['options']['include'],function(_0x2b9f36){return{'model':db[_0x2b9f36[_0x2a41('0x1f')]],'as':_0x2b9f36['as'],'attributes':_0x2b9f36['attributes'],'include':_0x2b9f36[_0x2a41('0x1d')]?_[_0x2a41('0x1e')](_0x2b9f36['include'],function(_0x131734){return{'model':db[_0x131734[_0x2a41('0x1f')]],'as':_0x131734['as'],'attributes':_0x131734[_0x2a41('0x1b')],'include':_0x131734[_0x2a41('0x1d')]?_[_0x2a41('0x1e')](_0x131734['include'],function(_0x4bdee6){return{'model':db[_0x4bdee6[_0x2a41('0x1f')]],'as':_0x4bdee6['as'],'attributes':_0x4bdee6[_0x2a41('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2a41('0xb')](function(_0x5d6ede){logger[_0x2a41('0xc')](_0x2a41('0x22'),_0x125439);logger[_0x2a41('0xf')](_0x2a41('0x22'),_0x125439,JSON[_0x2a41('0x23')](_0x5d6ede));_0x175da2(_0x5d6ede);})[_0x2a41('0x15')](function(_0x14f6e4){logger['error']('ShowDeskAccount',_0x14f6e4[_0x2a41('0x13')],_0x125439);_0xa8906f(_0x3901c8[_0x2a41('0x11')](0x1f4,_0x14f6e4['message']));});});}; \ No newline at end of file +var _0x7524=['limit','include','map','model','GetDeskAccount','ShowDeskAccount','DeskAccount','find','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','options','raw','where','attributes'];(function(_0x3c3903,_0x553ea3){var _0x56a1b6=function(_0x13e0a3){while(--_0x13e0a3){_0x3c3903['push'](_0x3c3903['shift']());}};_0x56a1b6(++_0x553ea3);}(_0x7524,0xce));var _0x4752=function(_0x47a03e,_0x3f7ac3){_0x47a03e=_0x47a03e-0x0;var _0x5eadc3=_0x7524[_0x47a03e];return _0x5eadc3;};'use strict';var _=require('lodash');var util=require(_0x4752('0x0'));var moment=require(_0x4752('0x1'));var BPromise=require('bluebird');var rs=require(_0x4752('0x2'));var fs=require('fs');var Redis=require(_0x4752('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4752('0x4'))('rpc');var config=require(_0x4752('0x5'));var jayson=require(_0x4752('0x6'));var client=jayson[_0x4752('0x7')][_0x4752('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x104962,_0x5b98c0,_0x1e76cf){return new BPromise(function(_0x1cbf34,_0x59477c){return client['request'](_0x104962,_0x1e76cf)[_0x4752('0x9')](function(_0x45e0ff){logger[_0x4752('0xa')](_0x4752('0xb'),_0x5b98c0,'request\x20sent');logger[_0x4752('0xc')](_0x4752('0xd'),_0x5b98c0,_0x4752('0xe'),JSON[_0x4752('0xf')](_0x45e0ff));if(_0x45e0ff[_0x4752('0x10')]){if(_0x45e0ff['error'][_0x4752('0x11')]===0x1f4){logger[_0x4752('0x10')](_0x4752('0xb'),_0x5b98c0,_0x45e0ff[_0x4752('0x10')][_0x4752('0x12')]);return _0x59477c(_0x45e0ff[_0x4752('0x10')][_0x4752('0x12')]);}logger['error'](_0x4752('0xb'),_0x5b98c0,_0x45e0ff['error'][_0x4752('0x12')]);return _0x1cbf34(_0x45e0ff[_0x4752('0x10')][_0x4752('0x12')]);}else{logger[_0x4752('0xa')](_0x4752('0xb'),_0x5b98c0,_0x4752('0xe'));_0x1cbf34(_0x45e0ff[_0x4752('0x13')]['message']);}})[_0x4752('0x14')](function(_0x1dad7c){logger['error'](_0x4752('0xb'),_0x5b98c0,_0x1dad7c);_0x59477c(_0x1dad7c);});});}exports['GetDeskAccount']=function(_0x1429f4){var _0x3c9ccc=this;return new Promise(function(_0x516f3e,_0x2d7ab6){return db['DeskAccount']['findAll']({'raw':_0x1429f4[_0x4752('0x15')]?_0x1429f4[_0x4752('0x15')][_0x4752('0x16')]===undefined?!![]:![]:!![],'where':_0x1429f4[_0x4752('0x15')]?_0x1429f4[_0x4752('0x15')][_0x4752('0x17')]||null:null,'attributes':_0x1429f4['options']?_0x1429f4[_0x4752('0x15')][_0x4752('0x18')]||null:null,'limit':_0x1429f4[_0x4752('0x15')]?_0x1429f4[_0x4752('0x15')][_0x4752('0x19')]||null:null,'include':_0x1429f4[_0x4752('0x15')]?_0x1429f4['options'][_0x4752('0x1a')]?_[_0x4752('0x1b')](_0x1429f4['options'][_0x4752('0x1a')],function(_0x403005){return{'model':db[_0x403005[_0x4752('0x1c')]],'as':_0x403005['as'],'attributes':_0x403005[_0x4752('0x18')],'include':_0x403005[_0x4752('0x1a')]?_[_0x4752('0x1b')](_0x403005[_0x4752('0x1a')],function(_0x45c557){return{'model':db[_0x45c557[_0x4752('0x1c')]],'as':_0x45c557['as'],'attributes':_0x45c557[_0x4752('0x18')],'include':_0x45c557['include']?_[_0x4752('0x1b')](_0x45c557['include'],function(_0x4b2635){return{'model':db[_0x4b2635['model']],'as':_0x4b2635['as'],'attributes':_0x4b2635[_0x4752('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4752('0x9')](function(_0x1bc71b){logger[_0x4752('0xa')](_0x4752('0x1d'),_0x1429f4);logger[_0x4752('0xc')](_0x4752('0x1d'),_0x1429f4,JSON[_0x4752('0xf')](_0x1bc71b));_0x516f3e(_0x1bc71b);})['catch'](function(_0x5745c0){logger[_0x4752('0x10')](_0x4752('0x1d'),_0x5745c0[_0x4752('0x12')],_0x1429f4);_0x2d7ab6(_0x3c9ccc[_0x4752('0x10')](0x1f4,_0x5745c0[_0x4752('0x12')]));});});};exports[_0x4752('0x1e')]=function(_0x258795){var _0x3164d0=this;return new Promise(function(_0x3b2774,_0x1f54ab){return db[_0x4752('0x1f')][_0x4752('0x20')]({'raw':_0x258795[_0x4752('0x15')]?_0x258795[_0x4752('0x15')][_0x4752('0x16')]===undefined?!![]:![]:!![],'where':_0x258795[_0x4752('0x15')]?_0x258795['options']['where']||null:null,'attributes':_0x258795[_0x4752('0x15')]?_0x258795[_0x4752('0x15')][_0x4752('0x18')]||null:null,'include':_0x258795[_0x4752('0x15')]?_0x258795[_0x4752('0x15')][_0x4752('0x1a')]?_[_0x4752('0x1b')](_0x258795[_0x4752('0x15')][_0x4752('0x1a')],function(_0x3f2f44){return{'model':db[_0x3f2f44['model']],'as':_0x3f2f44['as'],'attributes':_0x3f2f44[_0x4752('0x18')],'include':_0x3f2f44['include']?_[_0x4752('0x1b')](_0x3f2f44[_0x4752('0x1a')],function(_0x4411d6){return{'model':db[_0x4411d6[_0x4752('0x1c')]],'as':_0x4411d6['as'],'attributes':_0x4411d6[_0x4752('0x18')],'include':_0x4411d6['include']?_[_0x4752('0x1b')](_0x4411d6['include'],function(_0x26d283){return{'model':db[_0x26d283[_0x4752('0x1c')]],'as':_0x26d283['as'],'attributes':_0x26d283[_0x4752('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4752('0x9')](function(_0xa96174){logger[_0x4752('0xa')](_0x4752('0x1e'),_0x258795);logger[_0x4752('0xc')](_0x4752('0x1e'),_0x258795,JSON[_0x4752('0xf')](_0xa96174));_0x3b2774(_0xa96174);})['catch'](function(_0x1717ea){logger[_0x4752('0x10')](_0x4752('0x1e'),_0x1717ea[_0x4752('0x12')],_0x258795);_0x1f54ab(_0x3164d0[_0x4752('0x10')](0x1f4,_0x1717ea[_0x4752('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index aedc2ad..94d8eae 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 _0xbcb8=['get','isAuthenticated','index','/:id','show','/:id/subjects','/:id/descriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller'];(function(_0x40174f,_0x3a6751){var _0x40717c=function(_0x5ae03d){while(--_0x5ae03d){_0x40174f['push'](_0x40174f['shift']());}};_0x40717c(++_0x3a6751);}(_0xbcb8,0x89));var _0x8bcb=function(_0x1b870d,_0x1f12a1){_0x1b870d=_0x1b870d-0x0;var _0x543b56=_0xbcb8[_0x1b870d];return _0x543b56;};'use strict';var multer=require(_0x8bcb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8bcb('0x1'));var express=require(_0x8bcb('0x2'));var router=express[_0x8bcb('0x3')]();var auth=require(_0x8bcb('0x4'));var interaction=require(_0x8bcb('0x5'));var config=require('../../config/environment');var controller=require(_0x8bcb('0x6'));router[_0x8bcb('0x7')]('/',auth[_0x8bcb('0x8')](),controller[_0x8bcb('0x9')]);router[_0x8bcb('0x7')](_0x8bcb('0xa'),auth['isAuthenticated'](),controller[_0x8bcb('0xb')]);router[_0x8bcb('0x7')]('/:id/fields',auth[_0x8bcb('0x8')](),controller['getFields']);router[_0x8bcb('0x7')](_0x8bcb('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x8bcb('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router['get'](_0x8bcb('0xe'),auth['isAuthenticated'](),controller[_0x8bcb('0xf')]);router[_0x8bcb('0x10')]('/',auth[_0x8bcb('0x8')](),controller[_0x8bcb('0x11')]);router['post'](_0x8bcb('0xe'),auth[_0x8bcb('0x8')](),controller[_0x8bcb('0x12')]);router[_0x8bcb('0x13')](_0x8bcb('0xa'),auth['isAuthenticated'](),controller[_0x8bcb('0x14')]);router[_0x8bcb('0x15')](_0x8bcb('0xa'),auth[_0x8bcb('0x8')](),controller[_0x8bcb('0x16')]);module[_0x8bcb('0x17')]=router; \ No newline at end of file +var _0x4d3b=['getTags','post','create','setTags','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated','show','getFields','/:id/descriptions','/:id/tags'];(function(_0x2b58f1,_0x3d5289){var _0x1a7518=function(_0x4e411a){while(--_0x4e411a){_0x2b58f1['push'](_0x2b58f1['shift']());}};_0x1a7518(++_0x3d5289);}(_0x4d3b,0x12d));var _0xb4d3=function(_0x1e381e,_0x2567ec){_0x1e381e=_0x1e381e-0x0;var _0x209f2c=_0x4d3b[_0x1e381e];return _0x209f2c;};'use strict';var multer=require('multer');var util=require(_0xb4d3('0x0'));var path=require(_0xb4d3('0x1'));var timeout=require(_0xb4d3('0x2'));var express=require(_0xb4d3('0x3'));var router=express['Router']();var auth=require(_0xb4d3('0x4'));var interaction=require(_0xb4d3('0x5'));var config=require('../../config/environment');var controller=require('./intDeskConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb4d3('0x6')]);router[_0xb4d3('0x7')](_0xb4d3('0x8'),auth[_0xb4d3('0x9')](),controller[_0xb4d3('0xa')]);router[_0xb4d3('0x7')]('/:id/fields',auth[_0xb4d3('0x9')](),controller[_0xb4d3('0xb')]);router['get']('/:id/subjects',auth[_0xb4d3('0x9')](),controller['getSubjects']);router['get'](_0xb4d3('0xc'),auth[_0xb4d3('0x9')](),controller['getDescriptions']);router[_0xb4d3('0x7')](_0xb4d3('0xd'),auth[_0xb4d3('0x9')](),controller[_0xb4d3('0xe')]);router[_0xb4d3('0xf')]('/',auth['isAuthenticated'](),controller[_0xb4d3('0x10')]);router['post'](_0xb4d3('0xd'),auth['isAuthenticated'](),controller[_0xb4d3('0x11')]);router['put'](_0xb4d3('0x8'),auth[_0xb4d3('0x9')](),controller[_0xb4d3('0x12')]);router['delete'](_0xb4d3('0x8'),auth['isAuthenticated'](),controller[_0xb4d3('0x13')]);module[_0xb4d3('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 7e942fc..b1d0bbe 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 _0xff1a=['sequelize','STRING'];(function(_0x11a65f,_0x55c747){var _0x4b88fc=function(_0x5ab5f4){while(--_0x5ab5f4){_0x11a65f['push'](_0x11a65f['shift']());}};_0x4b88fc(++_0x55c747);}(_0xff1a,0x102));var _0xaff1=function(_0xce094,_0x564294){_0xce094=_0xce094-0x0;var _0x130b76=_0xff1a[_0xce094];return _0x130b76;};'use strict';var Sequelize=require(_0xaff1('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaff1('0x1')]}}; \ No newline at end of file +var _0x39de=['STRING','sequelize'];(function(_0x529059,_0x294a33){var _0x156bc2=function(_0x9bc770){while(--_0x9bc770){_0x529059['push'](_0x529059['shift']());}};_0x156bc2(++_0x294a33);}(_0x39de,0x141));var _0xe39d=function(_0x2cf702,_0x333323){_0x2cf702=_0x2cf702-0x0;var _0x15f7a6=_0x39de[_0x2cf702];return _0x15f7a6;};'use strict';var Sequelize=require(_0xe39d('0x0'));module['exports']={'name':{'type':Sequelize[_0xe39d('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 0dc4312..d26d486 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 _0x22fb=['end','status','count','offset','limit','json','apply','reject','save','update','stack','name','send','DeskConfiguration','rawAttributes','model','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','type','key','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','include','find','create','body','destroy','getFields','DeskField','length','map','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','setTags','ids','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','jayson/promise','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','DeskConfiguration,\x20%s,\x20%s','message','catch'];(function(_0x448af8,_0x557881){var _0x201bf9=function(_0xaea341){while(--_0xaea341){_0x448af8['push'](_0x448af8['shift']());}};_0x201bf9(++_0x557881);}(_0x22fb,0x192));var _0xb22f=function(_0x238941,_0x15a7d6){_0x238941=_0x238941-0x0;var _0x5093ac=_0x22fb[_0x238941];return _0x5093ac;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xb22f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb22f('0x1'));var rp=require(_0xb22f('0x2'));var moment=require(_0xb22f('0x3'));var BPromise=require(_0xb22f('0x4'));var Mustache=require(_0xb22f('0x5'));var util=require('util');var path=require(_0xb22f('0x6'));var sox=require(_0xb22f('0x7'));var csv=require(_0xb22f('0x8'));var ejs=require(_0xb22f('0x9'));var fs=require('fs');var _=require(_0xb22f('0xa'));var squel=require(_0xb22f('0xb'));var crypto=require('crypto');var jsforce=require(_0xb22f('0xc'));var deskjs=require(_0xb22f('0xd'));var toCsv=require(_0xb22f('0x8'));var querystring=require(_0xb22f('0xe'));var Papa=require(_0xb22f('0xf'));var authService=require(_0xb22f('0x10'));var hardwareService=require(_0xb22f('0x11'));var Redis=require(_0xb22f('0x12'));var qs=require(_0xb22f('0x13'));var logger=require(_0xb22f('0x14'))(_0xb22f('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0xb22f('0x16'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5bf0b9,_0x45e426,_0x40fcf8,_0x4ae6bb){return new BPromise(function(_0x2f046d,_0x390c53){var _0x32d796=_0x4ae6bb||client;return _0x32d796['request'](_0x5bf0b9,_0x40fcf8)[_0xb22f('0x17')](function(_0x5f1590){logger[_0xb22f('0x18')]('DeskConfiguration,\x20%s,\x20%s',_0x45e426,_0xb22f('0x19'));logger[_0xb22f('0x1a')](_0xb22f('0x1b'),_0x45e426,_0xb22f('0x19'),JSON[_0xb22f('0x1c')](_0x5f1590));if(_0x5f1590['error']){if(_0x5f1590[_0xb22f('0x1d')]['code']===0x1f4){logger[_0xb22f('0x1d')](_0xb22f('0x1e'),_0x45e426,_0x5f1590[_0xb22f('0x1d')][_0xb22f('0x1f')]);return _0x390c53(_0x5f1590[_0xb22f('0x1d')][_0xb22f('0x1f')]);}logger['error'](_0xb22f('0x1e'),_0x45e426,_0x5f1590['error'][_0xb22f('0x1f')]);return _0x2f046d(_0x5f1590[_0xb22f('0x1d')][_0xb22f('0x1f')]);}else{logger[_0xb22f('0x18')](_0xb22f('0x1e'),_0x45e426,'request\x20sent');_0x2f046d(_0x5f1590['result'][_0xb22f('0x1f')]);}})[_0xb22f('0x20')](function(_0xf34e0d){logger[_0xb22f('0x1d')](_0xb22f('0x1e'),_0x45e426,_0xf34e0d);_0x390c53(_0xf34e0d);});});}function respondWithStatusCode(_0xcb9a74,_0x201764){_0x201764=_0x201764||0xcc;return function(_0x286465){if(_0x286465){return _0xcb9a74['sendStatus'](_0x201764);}return _0xcb9a74['status'](_0x201764)[_0xb22f('0x21')]();};}function respondWithResult(_0x33163d,_0x5e1b8c){_0x5e1b8c=_0x5e1b8c||0xc8;return function(_0x3aa0dd){if(_0x3aa0dd){return _0x33163d[_0xb22f('0x22')](_0x5e1b8c)['json'](_0x3aa0dd);}};}function respondWithFilteredResult(_0x4687f2,_0x2918be){return function(_0x4dfb62){if(_0x4dfb62){var _0x3e471f=_0x4dfb62[_0xb22f('0x23')],_0x2c4a9e=_0x2918be[_0xb22f('0x24')],_0xcddbca=_0x2918be[_0xb22f('0x24')]+_0x2918be[_0xb22f('0x25')],_0xec047c;if(_0xcddbca>=_0x3e471f){_0xcddbca=_0x3e471f;_0xec047c=0xc8;}else{_0xec047c=0xce;}_0x4687f2['status'](_0xec047c);return _0x4687f2['set']('Content-Range',_0x2c4a9e+'-'+_0xcddbca+'/'+_0x3e471f)[_0xb22f('0x26')](_0x4dfb62);}return null;};}function patchUpdates(_0x557d96){return function(_0x327200){try{jsonpatch[_0xb22f('0x27')](_0x327200,_0x557d96,!![]);}catch(_0xf268f4){return BPromise[_0xb22f('0x28')](_0xf268f4);}return _0x327200[_0xb22f('0x29')]();};}function saveUpdates(_0x5b2a42,_0x519034){return function(_0x435690){if(_0x435690){return _0x435690[_0xb22f('0x2a')](_0x5b2a42)[_0xb22f('0x17')](function(_0xe9bb83){return _0xe9bb83;});}return null;};}function removeEntity(_0x547bdb,_0x176133){return function(_0x29ad43){if(_0x29ad43){return _0x29ad43['destroy']()[_0xb22f('0x17')](function(){_0x547bdb[_0xb22f('0x22')](0xcc)[_0xb22f('0x21')]();});}};}function handleEntityNotFound(_0x225194,_0x82c88){return function(_0x569202){if(!_0x569202){_0x225194['sendStatus'](0x194);}return _0x569202;};}function handleError(_0xb950d5,_0x2082d5){_0x2082d5=_0x2082d5||0x1f4;return function(_0x20ca22){logger[_0xb22f('0x1d')](_0x20ca22[_0xb22f('0x2b')]);if(_0x20ca22[_0xb22f('0x2c')]){delete _0x20ca22[_0xb22f('0x2c')];}_0xb950d5[_0xb22f('0x22')](_0x2082d5)[_0xb22f('0x2d')](_0x20ca22);};}exports['index']=function(_0xab153b,_0x4eadf7){var _0x5f0d7a={},_0x3a74a7={},_0x27d03d={'count':0x0,'rows':[]};var _0x2a9bf5=db[_0xb22f('0x2e')][_0xb22f('0x2f')];_0x3a74a7[_0xb22f('0x30')]=_[_0xb22f('0x31')](_0x2a9bf5);_0x3a74a7[_0xb22f('0x32')]=_[_0xb22f('0x31')](_0xab153b[_0xb22f('0x32')]);_0x3a74a7[_0xb22f('0x33')]=_[_0xb22f('0x34')](_0x3a74a7[_0xb22f('0x30')],_0x3a74a7['query']);_0x5f0d7a['attributes']=_[_0xb22f('0x34')](_0x3a74a7[_0xb22f('0x30')],qs[_0xb22f('0x35')](_0xab153b['query'][_0xb22f('0x35')]));_0x5f0d7a[_0xb22f('0x36')]=_0x5f0d7a['attributes']['length']?_0x5f0d7a[_0xb22f('0x36')]:_0x3a74a7['model'];if(!_0xab153b[_0xb22f('0x32')]['hasOwnProperty'](_0xb22f('0x37'))){_0x5f0d7a[_0xb22f('0x25')]=qs[_0xb22f('0x25')](_0xab153b['query'][_0xb22f('0x25')]);_0x5f0d7a[_0xb22f('0x24')]=qs[_0xb22f('0x24')](_0xab153b['query'][_0xb22f('0x24')]);}_0x5f0d7a[_0xb22f('0x38')]=qs[_0xb22f('0x39')](_0xab153b[_0xb22f('0x32')][_0xb22f('0x39')]);_0x5f0d7a[_0xb22f('0x3a')]=qs[_0xb22f('0x33')](_[_0xb22f('0x3b')](_0xab153b[_0xb22f('0x32')],_0x3a74a7[_0xb22f('0x33')]));if(_0xab153b['query'][_0xb22f('0x3c')]){_0x5f0d7a[_0xb22f('0x3a')]=_['merge'](_0x5f0d7a[_0xb22f('0x3a')],{'$or':_['map'](_0x2a9bf5,function(_0x58ba40){if(_0x58ba40[_0xb22f('0x3d')][_0xb22f('0x3e')]!==_0xb22f('0x3f')){var _0x394e94={};_0x394e94[_0x58ba40['field']]={'$like':'%'+_0xab153b[_0xb22f('0x32')]['filter']+'%'};return _0x394e94;}})});}_0x5f0d7a=_[_0xb22f('0x40')]({},_0x5f0d7a,_0xab153b[_0xb22f('0x41')]);var _0x454716={'where':_0x5f0d7a[_0xb22f('0x3a')]};return db[_0xb22f('0x2e')][_0xb22f('0x23')](_0x454716)['then'](function(_0x1b8fb9){_0x27d03d['count']=_0x1b8fb9;if(_0xab153b[_0xb22f('0x32')][_0xb22f('0x42')]){_0x5f0d7a['include']=[{'all':!![]}];}return db[_0xb22f('0x2e')][_0xb22f('0x43')](_0x5f0d7a);})['then'](function(_0x48f94e){_0x27d03d[_0xb22f('0x44')]=_0x48f94e;return _0x27d03d;})['then'](respondWithFilteredResult(_0x4eadf7,_0x5f0d7a))[_0xb22f('0x20')](handleError(_0x4eadf7,null));};exports[_0xb22f('0x45')]=function(_0x33520a,_0x1bb648){var _0x490536={'raw':![],'where':{'id':_0x33520a[_0xb22f('0x46')]['id']}},_0x2780ee={};_0x2780ee['model']=_[_0xb22f('0x31')](db[_0xb22f('0x2e')][_0xb22f('0x2f')]);_0x2780ee[_0xb22f('0x32')]=_[_0xb22f('0x31')](_0x33520a['query']);_0x2780ee[_0xb22f('0x33')]=_['intersection'](_0x2780ee['model'],_0x2780ee[_0xb22f('0x32')]);_0x490536[_0xb22f('0x36')]=_[_0xb22f('0x34')](_0x2780ee[_0xb22f('0x30')],qs[_0xb22f('0x35')](_0x33520a['query'][_0xb22f('0x35')]));_0x490536['attributes']=_0x490536[_0xb22f('0x36')]['length']?_0x490536[_0xb22f('0x36')]:_0x2780ee[_0xb22f('0x30')];if(_0x33520a[_0xb22f('0x32')]['includeAll']){_0x490536[_0xb22f('0x47')]=[{'all':!![]}];}_0x490536=_[_0xb22f('0x40')]({},_0x490536,_0x33520a['options']);return db[_0xb22f('0x2e')][_0xb22f('0x48')](_0x490536)['then'](handleEntityNotFound(_0x1bb648,null))['then'](respondWithResult(_0x1bb648,null))[_0xb22f('0x20')](handleError(_0x1bb648,null));};exports[_0xb22f('0x49')]=function(_0x5af426,_0xba9da8){return db[_0xb22f('0x2e')]['create'](_0x5af426['body'],{})[_0xb22f('0x17')](respondWithResult(_0xba9da8,0xc9))[_0xb22f('0x20')](handleError(_0xba9da8,null));};exports['update']=function(_0x13ac40,_0xaec9f){if(_0x13ac40[_0xb22f('0x4a')]['id']){delete _0x13ac40[_0xb22f('0x4a')]['id'];}return db['DeskConfiguration'][_0xb22f('0x48')]({'where':{'id':_0x13ac40[_0xb22f('0x46')]['id']}})['then'](handleEntityNotFound(_0xaec9f,null))['then'](saveUpdates(_0x13ac40[_0xb22f('0x4a')],null))[_0xb22f('0x17')](respondWithResult(_0xaec9f,null))[_0xb22f('0x20')](handleError(_0xaec9f,null));};exports[_0xb22f('0x4b')]=function(_0x4ec174,_0x29523c){return db[_0xb22f('0x2e')]['find']({'where':{'id':_0x4ec174[_0xb22f('0x46')]['id']}})[_0xb22f('0x17')](handleEntityNotFound(_0x29523c,null))[_0xb22f('0x17')](removeEntity(_0x29523c,null))[_0xb22f('0x20')](handleError(_0x29523c,null));};exports[_0xb22f('0x4c')]=function(_0x18c5bb,_0x192580,_0x502c7f){var _0x2dc5bf={};var _0x14637f={};var _0x34e2d4;var _0xc075e7;return db[_0xb22f('0x2e')]['findOne']({'where':{'id':_0x18c5bb['params']['id']}})[_0xb22f('0x17')](handleEntityNotFound(_0x192580,null))[_0xb22f('0x17')](function(_0x14df74){if(_0x14df74){_0x34e2d4=_0x14df74;_0x14637f['model']=_[_0xb22f('0x31')](db[_0xb22f('0x4d')][_0xb22f('0x2f')]);_0x14637f[_0xb22f('0x32')]=_[_0xb22f('0x31')](_0x18c5bb[_0xb22f('0x32')]);_0x14637f[_0xb22f('0x33')]=_[_0xb22f('0x34')](_0x14637f['model'],_0x14637f['query']);_0x2dc5bf[_0xb22f('0x36')]=_[_0xb22f('0x34')](_0x14637f['model'],qs['fields'](_0x18c5bb[_0xb22f('0x32')][_0xb22f('0x35')]));_0x2dc5bf['attributes']=_0x2dc5bf['attributes'][_0xb22f('0x4e')]?_0x2dc5bf['attributes']:_0x14637f[_0xb22f('0x30')];_0x2dc5bf[_0xb22f('0x38')]=qs[_0xb22f('0x39')](_0x18c5bb['query']['sort']);_0x2dc5bf[_0xb22f('0x3a')]=qs['filters'](_[_0xb22f('0x3b')](_0x18c5bb[_0xb22f('0x32')],_0x14637f[_0xb22f('0x33')]));if(_0x18c5bb['query']['filter']){_0x2dc5bf[_0xb22f('0x3a')]=_['merge'](_0x2dc5bf[_0xb22f('0x3a')],{'$or':_[_0xb22f('0x4f')](_0x2dc5bf[_0xb22f('0x36')],function(_0x4d5074){var _0x4464bd={};_0x4464bd[_0x4d5074]={'$like':'%'+_0x18c5bb['query'][_0xb22f('0x3c')]+'%'};return _0x4464bd;})});}_0x2dc5bf=_[_0xb22f('0x40')]({},_0x2dc5bf,_0x18c5bb[_0xb22f('0x41')]);return _0x34e2d4[_0xb22f('0x4c')](_0x2dc5bf);}})[_0xb22f('0x17')](function(_0x1558e1){if(_0x1558e1){_0xc075e7=_0x1558e1[_0xb22f('0x4e')];if(!_0x18c5bb[_0xb22f('0x32')][_0xb22f('0x50')]('nolimit')){_0x2dc5bf[_0xb22f('0x25')]=qs[_0xb22f('0x25')](_0x18c5bb[_0xb22f('0x32')]['limit']);_0x2dc5bf[_0xb22f('0x24')]=qs[_0xb22f('0x24')](_0x18c5bb[_0xb22f('0x32')][_0xb22f('0x24')]);}return _0x34e2d4['getFields'](_0x2dc5bf);}})['then'](function(_0x169215){if(_0x169215){return _0x169215?{'count':_0xc075e7,'rows':_0x169215}:null;}})['then'](respondWithResult(_0x192580,null))[_0xb22f('0x20')](handleError(_0x192580,null));};exports[_0xb22f('0x51')]=function(_0x3a8183,_0x231d23,_0x29c533){var _0x1e7059={};var _0x232b3c={};var _0x410e82;var _0x3a0746;return db[_0xb22f('0x2e')][_0xb22f('0x52')]({'where':{'id':_0x3a8183[_0xb22f('0x46')]['id']}})[_0xb22f('0x17')](handleEntityNotFound(_0x231d23,null))['then'](function(_0x1c3fd1){if(_0x1c3fd1){_0x410e82=_0x1c3fd1;_0x232b3c[_0xb22f('0x30')]=_[_0xb22f('0x31')](db[_0xb22f('0x4d')][_0xb22f('0x2f')]);_0x232b3c[_0xb22f('0x32')]=_[_0xb22f('0x31')](_0x3a8183[_0xb22f('0x32')]);_0x232b3c[_0xb22f('0x33')]=_[_0xb22f('0x34')](_0x232b3c[_0xb22f('0x30')],_0x232b3c[_0xb22f('0x32')]);_0x1e7059['attributes']=_['intersection'](_0x232b3c['model'],qs[_0xb22f('0x35')](_0x3a8183[_0xb22f('0x32')]['fields']));_0x1e7059[_0xb22f('0x36')]=_0x1e7059[_0xb22f('0x36')]['length']?_0x1e7059[_0xb22f('0x36')]:_0x232b3c[_0xb22f('0x30')];_0x1e7059[_0xb22f('0x38')]=qs[_0xb22f('0x39')](_0x3a8183[_0xb22f('0x32')]['sort']);_0x1e7059['where']=qs['filters'](_[_0xb22f('0x3b')](_0x3a8183[_0xb22f('0x32')],_0x232b3c[_0xb22f('0x33')]));if(_0x3a8183['query'][_0xb22f('0x3c')]){_0x1e7059[_0xb22f('0x3a')]=_['merge'](_0x1e7059[_0xb22f('0x3a')],{'$or':_[_0xb22f('0x4f')](_0x1e7059[_0xb22f('0x36')],function(_0x3f110d){var _0x38547c={};_0x38547c[_0x3f110d]={'$like':'%'+_0x3a8183[_0xb22f('0x32')][_0xb22f('0x3c')]+'%'};return _0x38547c;})});}_0x1e7059=_[_0xb22f('0x40')]({},_0x1e7059,_0x3a8183[_0xb22f('0x41')]);return _0x410e82[_0xb22f('0x51')](_0x1e7059);}})['then'](function(_0x47055d){if(_0x47055d){_0x3a0746=_0x47055d[_0xb22f('0x4e')];if(!_0x3a8183[_0xb22f('0x32')][_0xb22f('0x50')](_0xb22f('0x37'))){_0x1e7059[_0xb22f('0x25')]=qs[_0xb22f('0x25')](_0x3a8183['query'][_0xb22f('0x25')]);_0x1e7059[_0xb22f('0x24')]=qs[_0xb22f('0x24')](_0x3a8183[_0xb22f('0x32')][_0xb22f('0x24')]);}return _0x410e82[_0xb22f('0x51')](_0x1e7059);}})['then'](function(_0x1eb672){if(_0x1eb672){return _0x1eb672?{'count':_0x3a0746,'rows':_0x1eb672}:null;}})[_0xb22f('0x17')](respondWithResult(_0x231d23,null))['catch'](handleError(_0x231d23,null));};exports[_0xb22f('0x53')]=function(_0x5ba395,_0x53d73a,_0x5deaac){var _0x317c49={};var _0x5e5f4f={};var _0x27c739;var _0x4e7756;return db['DeskConfiguration'][_0xb22f('0x52')]({'where':{'id':_0x5ba395[_0xb22f('0x46')]['id']}})['then'](handleEntityNotFound(_0x53d73a,null))['then'](function(_0x4442e3){if(_0x4442e3){_0x27c739=_0x4442e3;_0x5e5f4f[_0xb22f('0x30')]=_['keys'](db[_0xb22f('0x4d')]['rawAttributes']);_0x5e5f4f['query']=_[_0xb22f('0x31')](_0x5ba395[_0xb22f('0x32')]);_0x5e5f4f[_0xb22f('0x33')]=_['intersection'](_0x5e5f4f['model'],_0x5e5f4f['query']);_0x317c49[_0xb22f('0x36')]=_[_0xb22f('0x34')](_0x5e5f4f[_0xb22f('0x30')],qs[_0xb22f('0x35')](_0x5ba395['query'][_0xb22f('0x35')]));_0x317c49[_0xb22f('0x36')]=_0x317c49[_0xb22f('0x36')][_0xb22f('0x4e')]?_0x317c49[_0xb22f('0x36')]:_0x5e5f4f['model'];_0x317c49[_0xb22f('0x38')]=qs['sort'](_0x5ba395['query'][_0xb22f('0x39')]);_0x317c49[_0xb22f('0x3a')]=qs[_0xb22f('0x33')](_['pick'](_0x5ba395[_0xb22f('0x32')],_0x5e5f4f[_0xb22f('0x33')]));if(_0x5ba395[_0xb22f('0x32')][_0xb22f('0x3c')]){_0x317c49[_0xb22f('0x3a')]=_[_0xb22f('0x40')](_0x317c49[_0xb22f('0x3a')],{'$or':_[_0xb22f('0x4f')](_0x317c49[_0xb22f('0x36')],function(_0x16370a){var _0x3e742f={};_0x3e742f[_0x16370a]={'$like':'%'+_0x5ba395['query']['filter']+'%'};return _0x3e742f;})});}_0x317c49=_[_0xb22f('0x40')]({},_0x317c49,_0x5ba395[_0xb22f('0x41')]);return _0x27c739['getDescriptions'](_0x317c49);}})[_0xb22f('0x17')](function(_0x21b8ce){if(_0x21b8ce){_0x4e7756=_0x21b8ce[_0xb22f('0x4e')];if(!_0x5ba395[_0xb22f('0x32')][_0xb22f('0x50')](_0xb22f('0x37'))){_0x317c49[_0xb22f('0x25')]=qs[_0xb22f('0x25')](_0x5ba395['query'][_0xb22f('0x25')]);_0x317c49[_0xb22f('0x24')]=qs[_0xb22f('0x24')](_0x5ba395['query'][_0xb22f('0x24')]);}return _0x27c739[_0xb22f('0x53')](_0x317c49);}})[_0xb22f('0x17')](function(_0x5029a6){if(_0x5029a6){return _0x5029a6?{'count':_0x4e7756,'rows':_0x5029a6}:null;}})[_0xb22f('0x17')](respondWithResult(_0x53d73a,null))['catch'](handleError(_0x53d73a,null));};exports[_0xb22f('0x54')]=function(_0x385780,_0x1a5e92,_0x2e6b72){var _0xc8906d={};var _0x3405eb={};var _0x2a2ce7;var _0xaffc3;return db[_0xb22f('0x2e')]['findOne']({'where':{'id':_0x385780[_0xb22f('0x46')]['id']}})[_0xb22f('0x17')](handleEntityNotFound(_0x1a5e92,null))[_0xb22f('0x17')](function(_0x58e63c){if(_0x58e63c){_0x2a2ce7=_0x58e63c;_0x3405eb[_0xb22f('0x30')]=_['keys'](db['Tag']['rawAttributes']);_0x3405eb[_0xb22f('0x32')]=_[_0xb22f('0x31')](_0x385780[_0xb22f('0x32')]);_0x3405eb[_0xb22f('0x33')]=_[_0xb22f('0x34')](_0x3405eb[_0xb22f('0x30')],_0x3405eb[_0xb22f('0x32')]);_0xc8906d['attributes']=_[_0xb22f('0x34')](_0x3405eb[_0xb22f('0x30')],qs[_0xb22f('0x35')](_0x385780[_0xb22f('0x32')][_0xb22f('0x35')]));_0xc8906d[_0xb22f('0x36')]=_0xc8906d[_0xb22f('0x36')][_0xb22f('0x4e')]?_0xc8906d['attributes']:_0x3405eb[_0xb22f('0x30')];_0xc8906d[_0xb22f('0x38')]=qs[_0xb22f('0x39')](_0x385780[_0xb22f('0x32')][_0xb22f('0x39')]);_0xc8906d[_0xb22f('0x3a')]=qs[_0xb22f('0x33')](_[_0xb22f('0x3b')](_0x385780[_0xb22f('0x32')],_0x3405eb[_0xb22f('0x33')]));if(_0x385780[_0xb22f('0x32')]['filter']){_0xc8906d[_0xb22f('0x3a')]=_['merge'](_0xc8906d[_0xb22f('0x3a')],{'$or':_[_0xb22f('0x4f')](_0xc8906d['attributes'],function(_0x4bb29a){var _0x148c96={};_0x148c96[_0x4bb29a]={'$like':'%'+_0x385780[_0xb22f('0x32')][_0xb22f('0x3c')]+'%'};return _0x148c96;})});}_0xc8906d=_[_0xb22f('0x40')]({},_0xc8906d,_0x385780[_0xb22f('0x41')]);return _0x2a2ce7[_0xb22f('0x54')](_0xc8906d);}})['then'](function(_0x3e54be){if(_0x3e54be){_0xaffc3=_0x3e54be['length'];if(!_0x385780[_0xb22f('0x32')]['hasOwnProperty']('nolimit')){_0xc8906d[_0xb22f('0x25')]=qs['limit'](_0x385780[_0xb22f('0x32')][_0xb22f('0x25')]);_0xc8906d[_0xb22f('0x24')]=qs['offset'](_0x385780[_0xb22f('0x32')][_0xb22f('0x24')]);}return _0x2a2ce7[_0xb22f('0x54')](_0xc8906d);}})[_0xb22f('0x17')](function(_0x540013){if(_0x540013){return _0x540013?{'count':_0xaffc3,'rows':_0x540013}:null;}})[_0xb22f('0x17')](respondWithResult(_0x1a5e92,null))[_0xb22f('0x20')](handleError(_0x1a5e92,null));};exports['setTags']=function(_0x495755,_0x3963bb,_0x44692e){if(_0x495755['body']['id']){delete _0x495755['body']['id'];}return db[_0xb22f('0x2e')][_0xb22f('0x52')]({'where':{'id':_0x495755[_0xb22f('0x46')]['id']}})[_0xb22f('0x17')](handleEntityNotFound(_0x3963bb,null))['then'](function(_0x31d7e6){if(_0x31d7e6){return _0x31d7e6[_0xb22f('0x55')](_0x495755[_0xb22f('0x4a')][_0xb22f('0x56')]||[]);}return null;})[_0xb22f('0x17')](respondWithResult(_0x3963bb,null))[_0xb22f('0x20')](handleError(_0x3963bb,null));}; \ No newline at end of file +var _0xf290=['intersection','fields','length','model','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','type','key','field','options','count','includeAll','include','rows','catch','show','params','rawAttributes','attributes','find','create','body','destroy','getFields','DeskField','map','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','status','json','limit','Content-Range','save','update','name','send','index','DeskConfiguration','keys','query','filters'];(function(_0x5e33fd,_0x28cafe){var _0x76bce5=function(_0x5104a7){while(--_0x5104a7){_0x5e33fd['push'](_0x5e33fd['shift']());}};_0x76bce5(++_0x28cafe);}(_0xf290,0xde));var _0x0f29=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0xf290[_0x593564];return _0x211a89;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0f29('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0f29('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f29('0x2'));var moment=require(_0x0f29('0x3'));var BPromise=require(_0x0f29('0x4'));var Mustache=require(_0x0f29('0x5'));var util=require(_0x0f29('0x6'));var path=require('path');var sox=require(_0x0f29('0x7'));var csv=require('to-csv');var ejs=require(_0x0f29('0x8'));var fs=require('fs');var _=require(_0x0f29('0x9'));var squel=require(_0x0f29('0xa'));var crypto=require(_0x0f29('0xb'));var jsforce=require(_0x0f29('0xc'));var deskjs=require(_0x0f29('0xd'));var toCsv=require(_0x0f29('0xe'));var querystring=require(_0x0f29('0xf'));var Papa=require(_0x0f29('0x10'));var authService=require(_0x0f29('0x11'));var hardwareService=require(_0x0f29('0x12'));var Redis=require(_0x0f29('0x13'));var qs=require(_0x0f29('0x14'));var logger=require(_0x0f29('0x15'))(_0x0f29('0x16'));var utils=require('../../config/utils');var config=require(_0x0f29('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x0f29('0x18'));var client=jayson[_0x0f29('0x19')][_0x0f29('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x222c42,_0x195424,_0x2d2573,_0x5519cf){return new BPromise(function(_0x2b2a18,_0x39961f){var _0x2bb7b8=_0x5519cf||client;return _0x2bb7b8[_0x0f29('0x1b')](_0x222c42,_0x2d2573)[_0x0f29('0x1c')](function(_0x2ed9c5){logger[_0x0f29('0x1d')](_0x0f29('0x1e'),_0x195424,'request\x20sent');logger['debug'](_0x0f29('0x1f'),_0x195424,_0x0f29('0x20'),JSON[_0x0f29('0x21')](_0x2ed9c5));if(_0x2ed9c5[_0x0f29('0x22')]){if(_0x2ed9c5['error'][_0x0f29('0x23')]===0x1f4){logger['error'](_0x0f29('0x1e'),_0x195424,_0x2ed9c5['error']['message']);return _0x39961f(_0x2ed9c5['error'][_0x0f29('0x24')]);}logger[_0x0f29('0x22')](_0x0f29('0x1e'),_0x195424,_0x2ed9c5[_0x0f29('0x22')][_0x0f29('0x24')]);return _0x2b2a18(_0x2ed9c5[_0x0f29('0x22')][_0x0f29('0x24')]);}else{logger['info'](_0x0f29('0x1e'),_0x195424,'request\x20sent');_0x2b2a18(_0x2ed9c5['result']['message']);}})['catch'](function(_0x38a1ce){logger[_0x0f29('0x22')]('DeskConfiguration,\x20%s,\x20%s',_0x195424,_0x38a1ce);_0x39961f(_0x38a1ce);});});}function respondWithStatusCode(_0x1ac33e,_0x1840e0){_0x1840e0=_0x1840e0||0xcc;return function(_0x346db8){if(_0x346db8){return _0x1ac33e[_0x0f29('0x25')](_0x1840e0);}return _0x1ac33e[_0x0f29('0x26')](_0x1840e0)['end']();};}function respondWithResult(_0x1f7046,_0x5a440f){_0x5a440f=_0x5a440f||0xc8;return function(_0x127fe2){if(_0x127fe2){return _0x1f7046[_0x0f29('0x26')](_0x5a440f)[_0x0f29('0x27')](_0x127fe2);}};}function respondWithFilteredResult(_0x28cfaa,_0x57667b){return function(_0x13a2c7){if(_0x13a2c7){var _0x540d72=_0x13a2c7['count'],_0x58b201=_0x57667b['offset'],_0x92876=_0x57667b['offset']+_0x57667b[_0x0f29('0x28')],_0x5c0202;if(_0x92876>=_0x540d72){_0x92876=_0x540d72;_0x5c0202=0xc8;}else{_0x5c0202=0xce;}_0x28cfaa[_0x0f29('0x26')](_0x5c0202);return _0x28cfaa['set'](_0x0f29('0x29'),_0x58b201+'-'+_0x92876+'/'+_0x540d72)[_0x0f29('0x27')](_0x13a2c7);}return null;};}function patchUpdates(_0x274c9d){return function(_0x51e7dc){try{jsonpatch['apply'](_0x51e7dc,_0x274c9d,!![]);}catch(_0x37ebcc){return BPromise['reject'](_0x37ebcc);}return _0x51e7dc[_0x0f29('0x2a')]();};}function saveUpdates(_0x561c31,_0x526364){return function(_0x7b10f){if(_0x7b10f){return _0x7b10f[_0x0f29('0x2b')](_0x561c31)[_0x0f29('0x1c')](function(_0x117ebb){return _0x117ebb;});}return null;};}function removeEntity(_0x588ab4,_0x52a501){return function(_0x3bb3c8){if(_0x3bb3c8){return _0x3bb3c8['destroy']()['then'](function(){_0x588ab4[_0x0f29('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x440b21,_0x5367e4){return function(_0x47a350){if(!_0x47a350){_0x440b21[_0x0f29('0x25')](0x194);}return _0x47a350;};}function handleError(_0x462fde,_0x3ea452){_0x3ea452=_0x3ea452||0x1f4;return function(_0x7f2b3b){logger[_0x0f29('0x22')](_0x7f2b3b['stack']);if(_0x7f2b3b[_0x0f29('0x2c')]){delete _0x7f2b3b['name'];}_0x462fde[_0x0f29('0x26')](_0x3ea452)[_0x0f29('0x2d')](_0x7f2b3b);};}exports[_0x0f29('0x2e')]=function(_0x1320a3,_0x4852a5){var _0x1c20f8={},_0x398c15={},_0x5be4fa={'count':0x0,'rows':[]};var _0x356252=db[_0x0f29('0x2f')]['rawAttributes'];_0x398c15['model']=_[_0x0f29('0x30')](_0x356252);_0x398c15[_0x0f29('0x31')]=_[_0x0f29('0x30')](_0x1320a3[_0x0f29('0x31')]);_0x398c15[_0x0f29('0x32')]=_[_0x0f29('0x33')](_0x398c15['model'],_0x398c15[_0x0f29('0x31')]);_0x1c20f8['attributes']=_[_0x0f29('0x33')](_0x398c15['model'],qs[_0x0f29('0x34')](_0x1320a3[_0x0f29('0x31')][_0x0f29('0x34')]));_0x1c20f8['attributes']=_0x1c20f8['attributes'][_0x0f29('0x35')]?_0x1c20f8['attributes']:_0x398c15[_0x0f29('0x36')];if(!_0x1320a3[_0x0f29('0x31')][_0x0f29('0x37')](_0x0f29('0x38'))){_0x1c20f8[_0x0f29('0x28')]=qs['limit'](_0x1320a3[_0x0f29('0x31')][_0x0f29('0x28')]);_0x1c20f8[_0x0f29('0x39')]=qs[_0x0f29('0x39')](_0x1320a3[_0x0f29('0x31')][_0x0f29('0x39')]);}_0x1c20f8[_0x0f29('0x3a')]=qs[_0x0f29('0x3b')](_0x1320a3[_0x0f29('0x31')]['sort']);_0x1c20f8[_0x0f29('0x3c')]=qs[_0x0f29('0x32')](_[_0x0f29('0x3d')](_0x1320a3[_0x0f29('0x31')],_0x398c15['filters']));if(_0x1320a3[_0x0f29('0x31')][_0x0f29('0x3e')]){_0x1c20f8[_0x0f29('0x3c')]=_[_0x0f29('0x3f')](_0x1c20f8[_0x0f29('0x3c')],{'$or':_['map'](_0x356252,function(_0x410c59){if(_0x410c59[_0x0f29('0x40')][_0x0f29('0x41')]!=='VIRTUAL'){var _0x26b976={};_0x26b976[_0x410c59[_0x0f29('0x42')]]={'$like':'%'+_0x1320a3[_0x0f29('0x31')][_0x0f29('0x3e')]+'%'};return _0x26b976;}})});}_0x1c20f8=_[_0x0f29('0x3f')]({},_0x1c20f8,_0x1320a3[_0x0f29('0x43')]);var _0x17d7d4={'where':_0x1c20f8[_0x0f29('0x3c')]};return db['DeskConfiguration']['count'](_0x17d7d4)['then'](function(_0x11f3be){_0x5be4fa[_0x0f29('0x44')]=_0x11f3be;if(_0x1320a3[_0x0f29('0x31')][_0x0f29('0x45')]){_0x1c20f8[_0x0f29('0x46')]=[{'all':!![]}];}return db[_0x0f29('0x2f')]['findAll'](_0x1c20f8);})[_0x0f29('0x1c')](function(_0x583bcf){_0x5be4fa[_0x0f29('0x47')]=_0x583bcf;return _0x5be4fa;})['then'](respondWithFilteredResult(_0x4852a5,_0x1c20f8))[_0x0f29('0x48')](handleError(_0x4852a5,null));};exports[_0x0f29('0x49')]=function(_0x1893ce,_0x379c10){var _0x301fc8={'raw':![],'where':{'id':_0x1893ce[_0x0f29('0x4a')]['id']}},_0x4868a6={};_0x4868a6[_0x0f29('0x36')]=_[_0x0f29('0x30')](db['DeskConfiguration'][_0x0f29('0x4b')]);_0x4868a6['query']=_['keys'](_0x1893ce[_0x0f29('0x31')]);_0x4868a6[_0x0f29('0x32')]=_[_0x0f29('0x33')](_0x4868a6[_0x0f29('0x36')],_0x4868a6[_0x0f29('0x31')]);_0x301fc8[_0x0f29('0x4c')]=_['intersection'](_0x4868a6[_0x0f29('0x36')],qs[_0x0f29('0x34')](_0x1893ce[_0x0f29('0x31')][_0x0f29('0x34')]));_0x301fc8[_0x0f29('0x4c')]=_0x301fc8[_0x0f29('0x4c')][_0x0f29('0x35')]?_0x301fc8[_0x0f29('0x4c')]:_0x4868a6[_0x0f29('0x36')];if(_0x1893ce[_0x0f29('0x31')]['includeAll']){_0x301fc8['include']=[{'all':!![]}];}_0x301fc8=_[_0x0f29('0x3f')]({},_0x301fc8,_0x1893ce[_0x0f29('0x43')]);return db[_0x0f29('0x2f')][_0x0f29('0x4d')](_0x301fc8)['then'](handleEntityNotFound(_0x379c10,null))[_0x0f29('0x1c')](respondWithResult(_0x379c10,null))[_0x0f29('0x48')](handleError(_0x379c10,null));};exports[_0x0f29('0x4e')]=function(_0x30387c,_0xbf8f22){return db[_0x0f29('0x2f')][_0x0f29('0x4e')](_0x30387c['body'],{})[_0x0f29('0x1c')](respondWithResult(_0xbf8f22,0xc9))[_0x0f29('0x48')](handleError(_0xbf8f22,null));};exports[_0x0f29('0x2b')]=function(_0x2c6a95,_0x3c5bd2){if(_0x2c6a95[_0x0f29('0x4f')]['id']){delete _0x2c6a95['body']['id'];}return db[_0x0f29('0x2f')][_0x0f29('0x4d')]({'where':{'id':_0x2c6a95[_0x0f29('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3c5bd2,null))[_0x0f29('0x1c')](saveUpdates(_0x2c6a95['body'],null))[_0x0f29('0x1c')](respondWithResult(_0x3c5bd2,null))['catch'](handleError(_0x3c5bd2,null));};exports[_0x0f29('0x50')]=function(_0x3fcda8,_0x4a490a){return db[_0x0f29('0x2f')][_0x0f29('0x4d')]({'where':{'id':_0x3fcda8[_0x0f29('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4a490a,null))[_0x0f29('0x1c')](removeEntity(_0x4a490a,null))['catch'](handleError(_0x4a490a,null));};exports[_0x0f29('0x51')]=function(_0x311c83,_0x584708,_0x1c46a6){var _0x324042={};var _0x4f2da6={};var _0xbe013b;var _0x4fa132;return db[_0x0f29('0x2f')]['findOne']({'where':{'id':_0x311c83[_0x0f29('0x4a')]['id']}})[_0x0f29('0x1c')](handleEntityNotFound(_0x584708,null))[_0x0f29('0x1c')](function(_0x4ba5c3){if(_0x4ba5c3){_0xbe013b=_0x4ba5c3;_0x4f2da6[_0x0f29('0x36')]=_[_0x0f29('0x30')](db[_0x0f29('0x52')][_0x0f29('0x4b')]);_0x4f2da6['query']=_[_0x0f29('0x30')](_0x311c83['query']);_0x4f2da6[_0x0f29('0x32')]=_['intersection'](_0x4f2da6[_0x0f29('0x36')],_0x4f2da6[_0x0f29('0x31')]);_0x324042[_0x0f29('0x4c')]=_[_0x0f29('0x33')](_0x4f2da6[_0x0f29('0x36')],qs[_0x0f29('0x34')](_0x311c83[_0x0f29('0x31')]['fields']));_0x324042[_0x0f29('0x4c')]=_0x324042['attributes'][_0x0f29('0x35')]?_0x324042[_0x0f29('0x4c')]:_0x4f2da6[_0x0f29('0x36')];_0x324042['order']=qs[_0x0f29('0x3b')](_0x311c83[_0x0f29('0x31')][_0x0f29('0x3b')]);_0x324042[_0x0f29('0x3c')]=qs[_0x0f29('0x32')](_['pick'](_0x311c83['query'],_0x4f2da6[_0x0f29('0x32')]));if(_0x311c83[_0x0f29('0x31')][_0x0f29('0x3e')]){_0x324042['where']=_['merge'](_0x324042[_0x0f29('0x3c')],{'$or':_[_0x0f29('0x53')](_0x324042[_0x0f29('0x4c')],function(_0x4a7e9f){var _0x520e92={};_0x520e92[_0x4a7e9f]={'$like':'%'+_0x311c83['query'][_0x0f29('0x3e')]+'%'};return _0x520e92;})});}_0x324042=_[_0x0f29('0x3f')]({},_0x324042,_0x311c83['options']);return _0xbe013b[_0x0f29('0x51')](_0x324042);}})[_0x0f29('0x1c')](function(_0x481209){if(_0x481209){_0x4fa132=_0x481209[_0x0f29('0x35')];if(!_0x311c83['query'][_0x0f29('0x37')](_0x0f29('0x38'))){_0x324042['limit']=qs[_0x0f29('0x28')](_0x311c83[_0x0f29('0x31')][_0x0f29('0x28')]);_0x324042[_0x0f29('0x39')]=qs[_0x0f29('0x39')](_0x311c83[_0x0f29('0x31')]['offset']);}return _0xbe013b[_0x0f29('0x51')](_0x324042);}})[_0x0f29('0x1c')](function(_0x1c6d58){if(_0x1c6d58){return _0x1c6d58?{'count':_0x4fa132,'rows':_0x1c6d58}:null;}})['then'](respondWithResult(_0x584708,null))[_0x0f29('0x48')](handleError(_0x584708,null));};exports[_0x0f29('0x54')]=function(_0x4bbc7e,_0x2fd40d,_0x497429){var _0x430b0c={};var _0x23b03b={};var _0x2a2562;var _0x4bd8f1;return db[_0x0f29('0x2f')][_0x0f29('0x55')]({'where':{'id':_0x4bbc7e[_0x0f29('0x4a')]['id']}})[_0x0f29('0x1c')](handleEntityNotFound(_0x2fd40d,null))[_0x0f29('0x1c')](function(_0x293477){if(_0x293477){_0x2a2562=_0x293477;_0x23b03b['model']=_[_0x0f29('0x30')](db['DeskField']['rawAttributes']);_0x23b03b[_0x0f29('0x31')]=_[_0x0f29('0x30')](_0x4bbc7e['query']);_0x23b03b[_0x0f29('0x32')]=_[_0x0f29('0x33')](_0x23b03b['model'],_0x23b03b['query']);_0x430b0c['attributes']=_['intersection'](_0x23b03b[_0x0f29('0x36')],qs[_0x0f29('0x34')](_0x4bbc7e['query']['fields']));_0x430b0c[_0x0f29('0x4c')]=_0x430b0c['attributes'][_0x0f29('0x35')]?_0x430b0c[_0x0f29('0x4c')]:_0x23b03b[_0x0f29('0x36')];_0x430b0c[_0x0f29('0x3a')]=qs['sort'](_0x4bbc7e[_0x0f29('0x31')][_0x0f29('0x3b')]);_0x430b0c[_0x0f29('0x3c')]=qs[_0x0f29('0x32')](_[_0x0f29('0x3d')](_0x4bbc7e['query'],_0x23b03b[_0x0f29('0x32')]));if(_0x4bbc7e[_0x0f29('0x31')][_0x0f29('0x3e')]){_0x430b0c[_0x0f29('0x3c')]=_[_0x0f29('0x3f')](_0x430b0c[_0x0f29('0x3c')],{'$or':_[_0x0f29('0x53')](_0x430b0c[_0x0f29('0x4c')],function(_0x12f7bf){var _0x10dd03={};_0x10dd03[_0x12f7bf]={'$like':'%'+_0x4bbc7e[_0x0f29('0x31')][_0x0f29('0x3e')]+'%'};return _0x10dd03;})});}_0x430b0c=_[_0x0f29('0x3f')]({},_0x430b0c,_0x4bbc7e[_0x0f29('0x43')]);return _0x2a2562[_0x0f29('0x54')](_0x430b0c);}})['then'](function(_0x17d81d){if(_0x17d81d){_0x4bd8f1=_0x17d81d[_0x0f29('0x35')];if(!_0x4bbc7e[_0x0f29('0x31')][_0x0f29('0x37')]('nolimit')){_0x430b0c['limit']=qs[_0x0f29('0x28')](_0x4bbc7e[_0x0f29('0x31')][_0x0f29('0x28')]);_0x430b0c['offset']=qs[_0x0f29('0x39')](_0x4bbc7e['query'][_0x0f29('0x39')]);}return _0x2a2562['getSubjects'](_0x430b0c);}})[_0x0f29('0x1c')](function(_0x30edb4){if(_0x30edb4){return _0x30edb4?{'count':_0x4bd8f1,'rows':_0x30edb4}:null;}})[_0x0f29('0x1c')](respondWithResult(_0x2fd40d,null))['catch'](handleError(_0x2fd40d,null));};exports[_0x0f29('0x56')]=function(_0x4d5dec,_0x515748,_0x3606dd){var _0x4878ac={};var _0x34b4ce={};var _0x2b4390;var _0x55b810;return db[_0x0f29('0x2f')][_0x0f29('0x55')]({'where':{'id':_0x4d5dec[_0x0f29('0x4a')]['id']}})[_0x0f29('0x1c')](handleEntityNotFound(_0x515748,null))[_0x0f29('0x1c')](function(_0x37cdfa){if(_0x37cdfa){_0x2b4390=_0x37cdfa;_0x34b4ce[_0x0f29('0x36')]=_[_0x0f29('0x30')](db['DeskField'][_0x0f29('0x4b')]);_0x34b4ce[_0x0f29('0x31')]=_[_0x0f29('0x30')](_0x4d5dec['query']);_0x34b4ce[_0x0f29('0x32')]=_[_0x0f29('0x33')](_0x34b4ce['model'],_0x34b4ce[_0x0f29('0x31')]);_0x4878ac['attributes']=_[_0x0f29('0x33')](_0x34b4ce['model'],qs[_0x0f29('0x34')](_0x4d5dec['query'][_0x0f29('0x34')]));_0x4878ac[_0x0f29('0x4c')]=_0x4878ac[_0x0f29('0x4c')][_0x0f29('0x35')]?_0x4878ac[_0x0f29('0x4c')]:_0x34b4ce[_0x0f29('0x36')];_0x4878ac[_0x0f29('0x3a')]=qs['sort'](_0x4d5dec[_0x0f29('0x31')][_0x0f29('0x3b')]);_0x4878ac[_0x0f29('0x3c')]=qs[_0x0f29('0x32')](_[_0x0f29('0x3d')](_0x4d5dec[_0x0f29('0x31')],_0x34b4ce['filters']));if(_0x4d5dec[_0x0f29('0x31')][_0x0f29('0x3e')]){_0x4878ac[_0x0f29('0x3c')]=_[_0x0f29('0x3f')](_0x4878ac['where'],{'$or':_[_0x0f29('0x53')](_0x4878ac['attributes'],function(_0x3a0ca1){var _0x3885f6={};_0x3885f6[_0x3a0ca1]={'$like':'%'+_0x4d5dec['query']['filter']+'%'};return _0x3885f6;})});}_0x4878ac=_[_0x0f29('0x3f')]({},_0x4878ac,_0x4d5dec[_0x0f29('0x43')]);return _0x2b4390[_0x0f29('0x56')](_0x4878ac);}})['then'](function(_0x2e56b4){if(_0x2e56b4){_0x55b810=_0x2e56b4['length'];if(!_0x4d5dec['query'][_0x0f29('0x37')]('nolimit')){_0x4878ac[_0x0f29('0x28')]=qs[_0x0f29('0x28')](_0x4d5dec[_0x0f29('0x31')]['limit']);_0x4878ac[_0x0f29('0x39')]=qs[_0x0f29('0x39')](_0x4d5dec[_0x0f29('0x31')][_0x0f29('0x39')]);}return _0x2b4390[_0x0f29('0x56')](_0x4878ac);}})[_0x0f29('0x1c')](function(_0x4ace31){if(_0x4ace31){return _0x4ace31?{'count':_0x55b810,'rows':_0x4ace31}:null;}})[_0x0f29('0x1c')](respondWithResult(_0x515748,null))['catch'](handleError(_0x515748,null));};exports[_0x0f29('0x57')]=function(_0x29fc23,_0x52bd0b,_0xfe480d){var _0x140e87={};var _0x4e084a={};var _0x4292cc;var _0x1dbcf9;return db[_0x0f29('0x2f')][_0x0f29('0x55')]({'where':{'id':_0x29fc23['params']['id']}})[_0x0f29('0x1c')](handleEntityNotFound(_0x52bd0b,null))[_0x0f29('0x1c')](function(_0x55f564){if(_0x55f564){_0x4292cc=_0x55f564;_0x4e084a[_0x0f29('0x36')]=_[_0x0f29('0x30')](db[_0x0f29('0x58')][_0x0f29('0x4b')]);_0x4e084a['query']=_[_0x0f29('0x30')](_0x29fc23[_0x0f29('0x31')]);_0x4e084a['filters']=_[_0x0f29('0x33')](_0x4e084a['model'],_0x4e084a['query']);_0x140e87[_0x0f29('0x4c')]=_[_0x0f29('0x33')](_0x4e084a[_0x0f29('0x36')],qs[_0x0f29('0x34')](_0x29fc23[_0x0f29('0x31')][_0x0f29('0x34')]));_0x140e87[_0x0f29('0x4c')]=_0x140e87[_0x0f29('0x4c')][_0x0f29('0x35')]?_0x140e87[_0x0f29('0x4c')]:_0x4e084a['model'];_0x140e87[_0x0f29('0x3a')]=qs[_0x0f29('0x3b')](_0x29fc23[_0x0f29('0x31')][_0x0f29('0x3b')]);_0x140e87['where']=qs[_0x0f29('0x32')](_[_0x0f29('0x3d')](_0x29fc23[_0x0f29('0x31')],_0x4e084a[_0x0f29('0x32')]));if(_0x29fc23[_0x0f29('0x31')][_0x0f29('0x3e')]){_0x140e87['where']=_[_0x0f29('0x3f')](_0x140e87[_0x0f29('0x3c')],{'$or':_['map'](_0x140e87[_0x0f29('0x4c')],function(_0xbeab1b){var _0x56a847={};_0x56a847[_0xbeab1b]={'$like':'%'+_0x29fc23[_0x0f29('0x31')][_0x0f29('0x3e')]+'%'};return _0x56a847;})});}_0x140e87=_[_0x0f29('0x3f')]({},_0x140e87,_0x29fc23[_0x0f29('0x43')]);return _0x4292cc[_0x0f29('0x57')](_0x140e87);}})[_0x0f29('0x1c')](function(_0x4c8712){if(_0x4c8712){_0x1dbcf9=_0x4c8712[_0x0f29('0x35')];if(!_0x29fc23[_0x0f29('0x31')][_0x0f29('0x37')]('nolimit')){_0x140e87['limit']=qs['limit'](_0x29fc23[_0x0f29('0x31')]['limit']);_0x140e87[_0x0f29('0x39')]=qs[_0x0f29('0x39')](_0x29fc23[_0x0f29('0x31')]['offset']);}return _0x4292cc[_0x0f29('0x57')](_0x140e87);}})[_0x0f29('0x1c')](function(_0x527370){if(_0x527370){return _0x527370?{'count':_0x1dbcf9,'rows':_0x527370}:null;}})[_0x0f29('0x1c')](respondWithResult(_0x52bd0b,null))[_0x0f29('0x48')](handleError(_0x52bd0b,null));};exports[_0x0f29('0x59')]=function(_0x35ef6b,_0x23fade,_0xd490f6){if(_0x35ef6b[_0x0f29('0x4f')]['id']){delete _0x35ef6b[_0x0f29('0x4f')]['id'];}return db[_0x0f29('0x2f')][_0x0f29('0x55')]({'where':{'id':_0x35ef6b['params']['id']}})[_0x0f29('0x1c')](handleEntityNotFound(_0x23fade,null))[_0x0f29('0x1c')](function(_0x22648d){if(_0x22648d){return _0x22648d['setTags'](_0x35ef6b[_0x0f29('0x4f')][_0x0f29('0x5a')]||[]);}return null;})[_0x0f29('0x1c')](respondWithResult(_0x23fade,null))[_0x0f29('0x48')](handleError(_0x23fade,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 7c393b9..a92f9a5 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 _0xefda=['moment','request-promise','./intDeskConfiguration.attributes','exports','define','int_desk_configurations','lodash','api'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xefda,0x96));var _0xaefd=function(_0x3c8244,_0x2f960e){_0x3c8244=_0x3c8244-0x0;var _0xc66b60=_0xefda[_0x3c8244];return _0xc66b60;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaefd('0x1'));var moment=require(_0xaefd('0x2'));var BPromise=require('bluebird');var rp=require(_0xaefd('0x3'));var attributes=require(_0xaefd('0x4'));module[_0xaefd('0x5')]=function(_0x22df24,_0x1ef6b4){return _0x22df24[_0xaefd('0x6')]('DeskConfiguration',attributes,{'tableName':_0xaefd('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe511=['util','api','bluebird','request-promise','exports','define','int_desk_configurations','lodash'];(function(_0x16f64f,_0x1b66f9){var _0x558069=function(_0x2a0880){while(--_0x2a0880){_0x16f64f['push'](_0x16f64f['shift']());}};_0x558069(++_0x1b66f9);}(_0xe511,0x16f));var _0x1e51=function(_0x3a87e8,_0x1d8633){_0x3a87e8=_0x3a87e8-0x0;var _0x591e80=_0xe511[_0x3a87e8];return _0x591e80;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var logger=require('../../config/logger')(_0x1e51('0x2'));var moment=require('moment');var BPromise=require(_0x1e51('0x3'));var rp=require(_0x1e51('0x4'));var attributes=require('./intDeskConfiguration.attributes');module[_0x1e51('0x5')]=function(_0x2be2b7,_0x204da7){return _0x2be2b7[_0x1e51('0x6')]('DeskConfiguration',attributes,{'tableName':_0x1e51('0x7'),'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 213a37f..edf282b 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 _0xdc97=['DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xc2bbf0,_0x18aa1e){var _0x1881b6=function(_0x304fd6){while(--_0x304fd6){_0xc2bbf0['push'](_0xc2bbf0['shift']());}};_0x1881b6(++_0x18aa1e);}(_0xdc97,0x13b));var _0x7dc9=function(_0x3db4b8,_0x5b6375){_0x3db4b8=_0x3db4b8-0x0;var _0x294cb1=_0xdc97[_0x3db4b8];return _0x294cb1;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var moment=require(_0x7dc9('0x2'));var BPromise=require('bluebird');var rs=require(_0x7dc9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7dc9('0x4'))['db'];var utils=require(_0x7dc9('0x5'));var logger=require('../../config/logger')(_0x7dc9('0x6'));var config=require(_0x7dc9('0x7'));var jayson=require(_0x7dc9('0x8'));var client=jayson[_0x7dc9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2636ef,_0x4f91c7,_0x4b3229){return new BPromise(function(_0x2ff923,_0x23737d){return client[_0x7dc9('0xa')](_0x2636ef,_0x4b3229)[_0x7dc9('0xb')](function(_0x3dd07e){logger['info'](_0x7dc9('0xc'),_0x4f91c7,_0x7dc9('0xd'));logger[_0x7dc9('0xe')](_0x7dc9('0xf'),_0x4f91c7,_0x7dc9('0xd'),JSON[_0x7dc9('0x10')](_0x3dd07e));if(_0x3dd07e[_0x7dc9('0x11')]){if(_0x3dd07e['error']['code']===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x4f91c7,_0x3dd07e[_0x7dc9('0x11')][_0x7dc9('0x12')]);return _0x23737d(_0x3dd07e['error'][_0x7dc9('0x12')]);}logger[_0x7dc9('0x11')](_0x7dc9('0xc'),_0x4f91c7,_0x3dd07e[_0x7dc9('0x11')][_0x7dc9('0x12')]);return _0x2ff923(_0x3dd07e[_0x7dc9('0x11')]['message']);}else{logger[_0x7dc9('0x13')](_0x7dc9('0xc'),_0x4f91c7,_0x7dc9('0xd'));_0x2ff923(_0x3dd07e[_0x7dc9('0x14')][_0x7dc9('0x12')]);}})[_0x7dc9('0x15')](function(_0x45698c){logger[_0x7dc9('0x11')](_0x7dc9('0xc'),_0x4f91c7,_0x45698c);_0x23737d(_0x45698c);});});} \ No newline at end of file +var _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskConfiguration,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3f2232,_0x14ea67){var _0x50e0d3=function(_0x351111){while(--_0x351111){_0x3f2232['push'](_0x3f2232['shift']());}};_0x50e0d3(++_0x14ea67);}(_0x5fab,0x177));var _0xb5fa=function(_0x2bc326,_0x473cf8){_0x2bc326=_0x2bc326-0x0;var _0x43722e=_0x5fab[_0x2bc326];return _0x43722e;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 23bab21..f14439c 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 _0xc5cc=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','index','get','/:id','show','put','update','delete'];(function(_0x16bd37,_0x28e12b){var _0x32690b=function(_0x193bf6){while(--_0x193bf6){_0x16bd37['push'](_0x16bd37['shift']());}};_0x32690b(++_0x28e12b);}(_0xc5cc,0x10c));var _0xcc5c=function(_0x228636,_0x51d570){_0x228636=_0x228636-0x0;var _0x327b9e=_0xc5cc[_0x228636];return _0x327b9e;};'use strict';var multer=require('multer');var util=require(_0xcc5c('0x0'));var path=require(_0xcc5c('0x1'));var timeout=require(_0xcc5c('0x2'));var express=require(_0xcc5c('0x3'));var router=express[_0xcc5c('0x4')]();var auth=require(_0xcc5c('0x5'));var interaction=require(_0xcc5c('0x6'));var config=require(_0xcc5c('0x7'));var controller=require(_0xcc5c('0x8'));router['get']('/',auth[_0xcc5c('0x9')](),controller[_0xcc5c('0xa')]);router[_0xcc5c('0xb')](_0xcc5c('0xc'),auth['isAuthenticated'](),controller[_0xcc5c('0xd')]);router['post']('/',auth[_0xcc5c('0x9')](),controller['create']);router[_0xcc5c('0xe')](_0xcc5c('0xc'),auth[_0xcc5c('0x9')](),controller[_0xcc5c('0xf')]);router[_0xcc5c('0x10')](_0xcc5c('0xc'),auth[_0xcc5c('0x9')](),controller[_0xcc5c('0x11')]);module[_0xcc5c('0x12')]=router; \ No newline at end of file +var _0x8bea=['get','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','index'];(function(_0x393f03,_0x4a9522){var _0x13abe2=function(_0x5322ea){while(--_0x5322ea){_0x393f03['push'](_0x393f03['shift']());}};_0x13abe2(++_0x4a9522);}(_0x8bea,0x15f));var _0xa8be=function(_0x18da39,_0x55835a){_0x18da39=_0x18da39-0x0;var _0x176a68=_0x8bea[_0x18da39];return _0x176a68;};'use strict';var multer=require(_0xa8be('0x0'));var util=require(_0xa8be('0x1'));var path=require(_0xa8be('0x2'));var timeout=require(_0xa8be('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xa8be('0x4'));var interaction=require(_0xa8be('0x5'));var config=require(_0xa8be('0x6'));var controller=require(_0xa8be('0x7'));router['get']('/',auth[_0xa8be('0x8')](),controller[_0xa8be('0x9')]);router[_0xa8be('0xa')](_0xa8be('0xb'),auth['isAuthenticated'](),controller[_0xa8be('0xc')]);router[_0xa8be('0xd')]('/',auth[_0xa8be('0x8')](),controller[_0xa8be('0xe')]);router[_0xa8be('0xf')](_0xa8be('0xb'),auth[_0xa8be('0x8')](),controller[_0xa8be('0x10')]);router['delete'](_0xa8be('0xb'),auth[_0xa8be('0x8')](),controller[_0xa8be('0x11')]);module[_0xa8be('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index ad143fb..8bf53ed 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 _0x13f6=['variable','customVariable','keyValue','STRING','ENUM','sequelize','exports'];(function(_0xbb3d2a,_0x11c716){var _0x53b2f0=function(_0x25b38e){while(--_0x25b38e){_0xbb3d2a['push'](_0xbb3d2a['shift']());}};_0x53b2f0(++_0x11c716);}(_0x13f6,0x124));var _0x613f=function(_0x2d9524,_0x1939df){_0x2d9524=_0x2d9524-0x0;var _0x3341b1=_0x13f6[_0x2d9524];return _0x3341b1;};'use strict';var Sequelize=require(_0x613f('0x0'));module[_0x613f('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x613f('0x2'),_0x613f('0x3'),_0x613f('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x613f('0x5')]},'key':{'type':Sequelize[_0x613f('0x5')]},'keyType':{'type':Sequelize[_0x613f('0x6')]('string',_0x613f('0x2'),_0x613f('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x613f('0x5')]}}; \ No newline at end of file +var _0x5b02=['BOOLEAN','sequelize','exports','ENUM','string','keyValue','STRING','variable'];(function(_0x3b76b2,_0xfda25){var _0x1f5c22=function(_0x4477e3){while(--_0x4477e3){_0x3b76b2['push'](_0x3b76b2['shift']());}};_0x1f5c22(++_0xfda25);}(_0x5b02,0xe9));var _0x25b0=function(_0x4895de,_0x1d1927){_0x4895de=_0x4895de-0x0;var _0x55f5ea=_0x5b02[_0x4895de];return _0x55f5ea;};'use strict';var Sequelize=require(_0x25b0('0x0'));module[_0x25b0('0x1')]={'type':{'type':Sequelize[_0x25b0('0x2')](_0x25b0('0x3'),'variable','customVariable',_0x25b0('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x25b0('0x5')]},'key':{'type':Sequelize[_0x25b0('0x5')]},'keyType':{'type':Sequelize[_0x25b0('0x2')](_0x25b0('0x3'),_0x25b0('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x25b0('0x5')]},'idField':{'type':Sequelize[_0x25b0('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x25b0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index c6c5f7c..d97f381 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 _0x70e0=['error','name','send','index','DeskField','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','nolimit','offset','sort','where','filter','merge','map','key','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end'];(function(_0x53afe9,_0x2c9f40){var _0x396396=function(_0x1f574d){while(--_0x1f574d){_0x53afe9['push'](_0x53afe9['shift']());}};_0x396396(++_0x2c9f40);}(_0x70e0,0x17b));var _0x070e=function(_0xb8c48f,_0x2a58e7){_0xb8c48f=_0xb8c48f-0x0;var _0x31007f=_0x70e0[_0xb8c48f];return _0x31007f;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var authService=require(_0x070e('0xe'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0x070e('0xf'));var logger=require(_0x070e('0x10'))(_0x070e('0x11'));var utils=require(_0x070e('0x12'));var config=require(_0x070e('0x13'));var db=require(_0x070e('0x14'))['db'];function respondWithStatusCode(_0x25cfe1,_0x1baa12){_0x1baa12=_0x1baa12||0xcc;return function(_0x39d2b9){if(_0x39d2b9){return _0x25cfe1[_0x070e('0x15')](_0x1baa12);}return _0x25cfe1[_0x070e('0x16')](_0x1baa12)['end']();};}function respondWithResult(_0x5dca0f,_0x24baba){_0x24baba=_0x24baba||0xc8;return function(_0x56c7ba){if(_0x56c7ba){return _0x5dca0f['status'](_0x24baba)['json'](_0x56c7ba);}};}function respondWithFilteredResult(_0x11d2ce,_0x14c3fd){return function(_0x51d14d){if(_0x51d14d){var _0x5d3a38=_0x51d14d[_0x070e('0x17')],_0x373d86=_0x14c3fd['offset'],_0xeae1a5=_0x14c3fd['offset']+_0x14c3fd[_0x070e('0x18')],_0x180897;if(_0xeae1a5>=_0x5d3a38){_0xeae1a5=_0x5d3a38;_0x180897=0xc8;}else{_0x180897=0xce;}_0x11d2ce[_0x070e('0x16')](_0x180897);return _0x11d2ce[_0x070e('0x19')](_0x070e('0x1a'),_0x373d86+'-'+_0xeae1a5+'/'+_0x5d3a38)[_0x070e('0x1b')](_0x51d14d);}return null;};}function patchUpdates(_0x5037eb){return function(_0x3938b5){try{jsonpatch[_0x070e('0x1c')](_0x3938b5,_0x5037eb,!![]);}catch(_0x1ad3de){return BPromise[_0x070e('0x1d')](_0x1ad3de);}return _0x3938b5[_0x070e('0x1e')]();};}function saveUpdates(_0x5c16fd,_0x5b2f48){return function(_0x4e958f){if(_0x4e958f){return _0x4e958f[_0x070e('0x1f')](_0x5c16fd)[_0x070e('0x20')](function(_0x20dc60){return _0x20dc60;});}return null;};}function removeEntity(_0x4be0d7,_0x5b184){return function(_0x5dc5d2){if(_0x5dc5d2){return _0x5dc5d2[_0x070e('0x21')]()[_0x070e('0x20')](function(){_0x4be0d7[_0x070e('0x16')](0xcc)[_0x070e('0x22')]();});}};}function handleEntityNotFound(_0x28a1c3,_0xa86797){return function(_0xe405e){if(!_0xe405e){_0x28a1c3[_0x070e('0x15')](0x194);}return _0xe405e;};}function handleError(_0x595c7e,_0x2f8055){_0x2f8055=_0x2f8055||0x1f4;return function(_0x270061){logger[_0x070e('0x23')](_0x270061['stack']);if(_0x270061[_0x070e('0x24')]){delete _0x270061['name'];}_0x595c7e['status'](_0x2f8055)[_0x070e('0x25')](_0x270061);};}exports[_0x070e('0x26')]=function(_0x41deb1,_0x1743cc){var _0x4763c6={},_0x497f58={},_0x374c54={'count':0x0,'rows':[]};var _0x219e48=db[_0x070e('0x27')][_0x070e('0x28')];_0x497f58[_0x070e('0x29')]=_[_0x070e('0x2a')](_0x219e48);_0x497f58[_0x070e('0x2b')]=_[_0x070e('0x2a')](_0x41deb1['query']);_0x497f58[_0x070e('0x2c')]=_[_0x070e('0x2d')](_0x497f58[_0x070e('0x29')],_0x497f58['query']);_0x4763c6['attributes']=_[_0x070e('0x2d')](_0x497f58[_0x070e('0x29')],qs[_0x070e('0x2e')](_0x41deb1['query'][_0x070e('0x2e')]));_0x4763c6[_0x070e('0x2f')]=_0x4763c6[_0x070e('0x2f')][_0x070e('0x30')]?_0x4763c6['attributes']:_0x497f58['model'];if(!_0x41deb1['query']['hasOwnProperty'](_0x070e('0x31'))){_0x4763c6['limit']=qs[_0x070e('0x18')](_0x41deb1[_0x070e('0x2b')]['limit']);_0x4763c6['offset']=qs[_0x070e('0x32')](_0x41deb1[_0x070e('0x2b')]['offset']);}_0x4763c6['order']=qs[_0x070e('0x33')](_0x41deb1[_0x070e('0x2b')][_0x070e('0x33')]);_0x4763c6[_0x070e('0x34')]=qs[_0x070e('0x2c')](_['pick'](_0x41deb1['query'],_0x497f58[_0x070e('0x2c')]));if(_0x41deb1[_0x070e('0x2b')][_0x070e('0x35')]){_0x4763c6[_0x070e('0x34')]=_[_0x070e('0x36')](_0x4763c6['where'],{'$or':_[_0x070e('0x37')](_0x219e48,function(_0x1927f4){if(_0x1927f4['type'][_0x070e('0x38')]!==_0x070e('0x39')){var _0x4ba6f0={};_0x4ba6f0[_0x1927f4['field']]={'$like':'%'+_0x41deb1['query'][_0x070e('0x35')]+'%'};return _0x4ba6f0;}})});}_0x4763c6=_[_0x070e('0x36')]({},_0x4763c6,_0x41deb1[_0x070e('0x3a')]);var _0x334733={'where':_0x4763c6[_0x070e('0x34')]};return db['DeskField'][_0x070e('0x17')](_0x334733)[_0x070e('0x20')](function(_0xb53332){_0x374c54['count']=_0xb53332;if(_0x41deb1[_0x070e('0x2b')][_0x070e('0x3b')]){_0x4763c6[_0x070e('0x3c')]=[{'all':!![]}];}return db['DeskField'][_0x070e('0x3d')](_0x4763c6);})[_0x070e('0x20')](function(_0x4800a9){_0x374c54[_0x070e('0x3e')]=_0x4800a9;return _0x374c54;})['then'](respondWithFilteredResult(_0x1743cc,_0x4763c6))[_0x070e('0x3f')](handleError(_0x1743cc,null));};exports[_0x070e('0x40')]=function(_0x3462d3,_0x30319c){var _0xd03404={'raw':!![],'where':{'id':_0x3462d3[_0x070e('0x41')]['id']}},_0x47b929={};_0x47b929['model']=_['keys'](db[_0x070e('0x27')][_0x070e('0x28')]);_0x47b929[_0x070e('0x2b')]=_['keys'](_0x3462d3[_0x070e('0x2b')]);_0x47b929[_0x070e('0x2c')]=_[_0x070e('0x2d')](_0x47b929[_0x070e('0x29')],_0x47b929['query']);_0xd03404[_0x070e('0x2f')]=_['intersection'](_0x47b929['model'],qs['fields'](_0x3462d3[_0x070e('0x2b')][_0x070e('0x2e')]));_0xd03404[_0x070e('0x2f')]=_0xd03404[_0x070e('0x2f')][_0x070e('0x30')]?_0xd03404['attributes']:_0x47b929[_0x070e('0x29')];if(_0x3462d3['query'][_0x070e('0x3b')]){_0xd03404[_0x070e('0x3c')]=[{'all':!![]}];}_0xd03404=_[_0x070e('0x36')]({},_0xd03404,_0x3462d3['options']);return db['DeskField'][_0x070e('0x42')](_0xd03404)['then'](handleEntityNotFound(_0x30319c,null))[_0x070e('0x20')](respondWithResult(_0x30319c,null))[_0x070e('0x3f')](handleError(_0x30319c,null));};exports[_0x070e('0x43')]=function(_0x5f5675,_0x7c15f9){return db[_0x070e('0x27')]['create'](_0x5f5675['body'],{})[_0x070e('0x20')](respondWithResult(_0x7c15f9,0xc9))[_0x070e('0x3f')](handleError(_0x7c15f9,null));};exports[_0x070e('0x1f')]=function(_0x1fc7c4,_0x253e11){if(_0x1fc7c4['body']['id']){delete _0x1fc7c4[_0x070e('0x44')]['id'];}return db[_0x070e('0x27')][_0x070e('0x42')]({'where':{'id':_0x1fc7c4[_0x070e('0x41')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x253e11,null))[_0x070e('0x20')](saveUpdates(_0x1fc7c4[_0x070e('0x44')],null))[_0x070e('0x20')](respondWithResult(_0x253e11,null))[_0x070e('0x3f')](handleError(_0x253e11,null));};exports[_0x070e('0x21')]=function(_0x210c4d,_0x3be553){return db[_0x070e('0x27')][_0x070e('0x42')]({'where':{'id':_0x210c4d[_0x070e('0x41')]['id']}})['then'](handleEntityNotFound(_0x3be553,null))[_0x070e('0x20')](removeEntity(_0x3be553,null))[_0x070e('0x3f')](handleError(_0x3be553,null));}; \ No newline at end of file +var _0xedd9=['limit','set','apply','save','then','destroy','error','stack','name','send','index','DeskField','rawAttributes','keys','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','field','options','includeAll','include','rows','catch','params','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','../../components/auth/service','ioredis','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x290df5,_0x2cc0cb){var _0x27c215=function(_0x39645a){while(--_0x39645a){_0x290df5['push'](_0x290df5['shift']());}};_0x27c215(++_0x2cc0cb);}(_0xedd9,0xfc));var _0x9edd=function(_0x256b00,_0x137419){_0x256b00=_0x256b00-0x0;var _0x590f4f=_0xedd9[_0x256b00];return _0x590f4f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9edd('0x0'));var rimraf=require(_0x9edd('0x1'));var zipdir=require(_0x9edd('0x2'));var jsonpatch=require(_0x9edd('0x3'));var rp=require(_0x9edd('0x4'));var moment=require(_0x9edd('0x5'));var BPromise=require(_0x9edd('0x6'));var Mustache=require(_0x9edd('0x7'));var util=require('util');var path=require(_0x9edd('0x8'));var sox=require(_0x9edd('0x9'));var csv=require(_0x9edd('0xa'));var ejs=require(_0x9edd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0xa'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var authService=require(_0x9edd('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x9edd('0x11'));var qs=require(_0x9edd('0x12'));var logger=require('../../config/logger')(_0x9edd('0x13'));var utils=require(_0x9edd('0x14'));var config=require('../../config/environment');var db=require(_0x9edd('0x15'))['db'];function respondWithStatusCode(_0x1b73d1,_0x25e64c){_0x25e64c=_0x25e64c||0xcc;return function(_0xfd544a){if(_0xfd544a){return _0x1b73d1[_0x9edd('0x16')](_0x25e64c);}return _0x1b73d1[_0x9edd('0x17')](_0x25e64c)[_0x9edd('0x18')]();};}function respondWithResult(_0xef5498,_0x47eb64){_0x47eb64=_0x47eb64||0xc8;return function(_0x176bfa){if(_0x176bfa){return _0xef5498[_0x9edd('0x17')](_0x47eb64)[_0x9edd('0x19')](_0x176bfa);}};}function respondWithFilteredResult(_0x4d9a7,_0x13b6b6){return function(_0x338f3c){if(_0x338f3c){var _0x1042aa=_0x338f3c[_0x9edd('0x1a')],_0x75a4ab=_0x13b6b6[_0x9edd('0x1b')],_0x4ea60f=_0x13b6b6['offset']+_0x13b6b6[_0x9edd('0x1c')],_0x5f5bf4;if(_0x4ea60f>=_0x1042aa){_0x4ea60f=_0x1042aa;_0x5f5bf4=0xc8;}else{_0x5f5bf4=0xce;}_0x4d9a7[_0x9edd('0x17')](_0x5f5bf4);return _0x4d9a7[_0x9edd('0x1d')]('Content-Range',_0x75a4ab+'-'+_0x4ea60f+'/'+_0x1042aa)[_0x9edd('0x19')](_0x338f3c);}return null;};}function patchUpdates(_0x5d879c){return function(_0x2cdcef){try{jsonpatch[_0x9edd('0x1e')](_0x2cdcef,_0x5d879c,!![]);}catch(_0x4bdb88){return BPromise['reject'](_0x4bdb88);}return _0x2cdcef[_0x9edd('0x1f')]();};}function saveUpdates(_0x50338f,_0x27a95a){return function(_0x54a03f){if(_0x54a03f){return _0x54a03f['update'](_0x50338f)[_0x9edd('0x20')](function(_0x1c46a8){return _0x1c46a8;});}return null;};}function removeEntity(_0x4fb7bf,_0x5823bc){return function(_0x341d67){if(_0x341d67){return _0x341d67[_0x9edd('0x21')]()[_0x9edd('0x20')](function(){_0x4fb7bf['status'](0xcc)[_0x9edd('0x18')]();});}};}function handleEntityNotFound(_0x1dca43,_0x44a6c1){return function(_0x2ca65f){if(!_0x2ca65f){_0x1dca43[_0x9edd('0x16')](0x194);}return _0x2ca65f;};}function handleError(_0x4c75d2,_0x46c383){_0x46c383=_0x46c383||0x1f4;return function(_0xeaf55a){logger[_0x9edd('0x22')](_0xeaf55a[_0x9edd('0x23')]);if(_0xeaf55a[_0x9edd('0x24')]){delete _0xeaf55a['name'];}_0x4c75d2['status'](_0x46c383)[_0x9edd('0x25')](_0xeaf55a);};}exports[_0x9edd('0x26')]=function(_0x8d67aa,_0x25e135){var _0x3c2227={},_0x4fe471={},_0x57a2cc={'count':0x0,'rows':[]};var _0x214d0a=db[_0x9edd('0x27')][_0x9edd('0x28')];_0x4fe471['model']=_[_0x9edd('0x29')](_0x214d0a);_0x4fe471[_0x9edd('0x2a')]=_[_0x9edd('0x29')](_0x8d67aa[_0x9edd('0x2a')]);_0x4fe471['filters']=_[_0x9edd('0x2b')](_0x4fe471[_0x9edd('0x2c')],_0x4fe471[_0x9edd('0x2a')]);_0x3c2227[_0x9edd('0x2d')]=_[_0x9edd('0x2b')](_0x4fe471[_0x9edd('0x2c')],qs[_0x9edd('0x2e')](_0x8d67aa[_0x9edd('0x2a')][_0x9edd('0x2e')]));_0x3c2227[_0x9edd('0x2d')]=_0x3c2227[_0x9edd('0x2d')][_0x9edd('0x2f')]?_0x3c2227[_0x9edd('0x2d')]:_0x4fe471[_0x9edd('0x2c')];if(!_0x8d67aa[_0x9edd('0x2a')]['hasOwnProperty'](_0x9edd('0x30'))){_0x3c2227[_0x9edd('0x1c')]=qs[_0x9edd('0x1c')](_0x8d67aa['query'][_0x9edd('0x1c')]);_0x3c2227[_0x9edd('0x1b')]=qs[_0x9edd('0x1b')](_0x8d67aa[_0x9edd('0x2a')][_0x9edd('0x1b')]);}_0x3c2227[_0x9edd('0x31')]=qs[_0x9edd('0x32')](_0x8d67aa[_0x9edd('0x2a')][_0x9edd('0x32')]);_0x3c2227[_0x9edd('0x33')]=qs[_0x9edd('0x34')](_[_0x9edd('0x35')](_0x8d67aa[_0x9edd('0x2a')],_0x4fe471[_0x9edd('0x34')]));if(_0x8d67aa['query'][_0x9edd('0x36')]){_0x3c2227['where']=_[_0x9edd('0x37')](_0x3c2227[_0x9edd('0x33')],{'$or':_[_0x9edd('0x38')](_0x214d0a,function(_0x434d26){if(_0x434d26[_0x9edd('0x39')]['key']!==_0x9edd('0x3a')){var _0x44dbfc={};_0x44dbfc[_0x434d26[_0x9edd('0x3b')]]={'$like':'%'+_0x8d67aa[_0x9edd('0x2a')][_0x9edd('0x36')]+'%'};return _0x44dbfc;}})});}_0x3c2227=_[_0x9edd('0x37')]({},_0x3c2227,_0x8d67aa[_0x9edd('0x3c')]);var _0x1cbbac={'where':_0x3c2227[_0x9edd('0x33')]};return db[_0x9edd('0x27')]['count'](_0x1cbbac)[_0x9edd('0x20')](function(_0x56a228){_0x57a2cc[_0x9edd('0x1a')]=_0x56a228;if(_0x8d67aa['query'][_0x9edd('0x3d')]){_0x3c2227[_0x9edd('0x3e')]=[{'all':!![]}];}return db[_0x9edd('0x27')]['findAll'](_0x3c2227);})[_0x9edd('0x20')](function(_0xcbd0ef){_0x57a2cc[_0x9edd('0x3f')]=_0xcbd0ef;return _0x57a2cc;})['then'](respondWithFilteredResult(_0x25e135,_0x3c2227))[_0x9edd('0x40')](handleError(_0x25e135,null));};exports['show']=function(_0x1fc4fb,_0xfbc492){var _0x50be2c={'raw':!![],'where':{'id':_0x1fc4fb[_0x9edd('0x41')]['id']}},_0x315f52={};_0x315f52[_0x9edd('0x2c')]=_[_0x9edd('0x29')](db['DeskField'][_0x9edd('0x28')]);_0x315f52['query']=_[_0x9edd('0x29')](_0x1fc4fb[_0x9edd('0x2a')]);_0x315f52['filters']=_[_0x9edd('0x2b')](_0x315f52['model'],_0x315f52['query']);_0x50be2c[_0x9edd('0x2d')]=_[_0x9edd('0x2b')](_0x315f52[_0x9edd('0x2c')],qs[_0x9edd('0x2e')](_0x1fc4fb[_0x9edd('0x2a')][_0x9edd('0x2e')]));_0x50be2c[_0x9edd('0x2d')]=_0x50be2c[_0x9edd('0x2d')][_0x9edd('0x2f')]?_0x50be2c[_0x9edd('0x2d')]:_0x315f52[_0x9edd('0x2c')];if(_0x1fc4fb[_0x9edd('0x2a')][_0x9edd('0x3d')]){_0x50be2c[_0x9edd('0x3e')]=[{'all':!![]}];}_0x50be2c=_[_0x9edd('0x37')]({},_0x50be2c,_0x1fc4fb['options']);return db[_0x9edd('0x27')][_0x9edd('0x42')](_0x50be2c)[_0x9edd('0x20')](handleEntityNotFound(_0xfbc492,null))[_0x9edd('0x20')](respondWithResult(_0xfbc492,null))[_0x9edd('0x40')](handleError(_0xfbc492,null));};exports[_0x9edd('0x43')]=function(_0x10d41e,_0x4e9ad1){return db['DeskField']['create'](_0x10d41e[_0x9edd('0x44')],{})['then'](respondWithResult(_0x4e9ad1,0xc9))[_0x9edd('0x40')](handleError(_0x4e9ad1,null));};exports[_0x9edd('0x45')]=function(_0x2b06d3,_0x8db801){if(_0x2b06d3[_0x9edd('0x44')]['id']){delete _0x2b06d3['body']['id'];}return db[_0x9edd('0x27')][_0x9edd('0x42')]({'where':{'id':_0x2b06d3[_0x9edd('0x41')]['id']}})['then'](handleEntityNotFound(_0x8db801,null))[_0x9edd('0x20')](saveUpdates(_0x2b06d3[_0x9edd('0x44')],null))[_0x9edd('0x20')](respondWithResult(_0x8db801,null))[_0x9edd('0x40')](handleError(_0x8db801,null));};exports[_0x9edd('0x21')]=function(_0x35bdec,_0x4d4f33){return db[_0x9edd('0x27')][_0x9edd('0x42')]({'where':{'id':_0x35bdec['params']['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x20')](removeEntity(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 9e4aad0..7143572 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 _0x3ade=['request-promise','int_desk_fields','desk_unique_index','FieldId','lodash','util','api','bluebird'];(function(_0x5dc6a2,_0x567820){var _0x1776a2=function(_0x15b13f){while(--_0x15b13f){_0x5dc6a2['push'](_0x5dc6a2['shift']());}};_0x1776a2(++_0x567820);}(_0x3ade,0x1ac));var _0xe3ad=function(_0x4b4889,_0x41cc03){_0x4b4889=_0x4b4889-0x0;var _0x38aac9=_0x3ade[_0x4b4889];return _0x38aac9;};'use strict';var _=require(_0xe3ad('0x0'));var util=require(_0xe3ad('0x1'));var logger=require('../../config/logger')(_0xe3ad('0x2'));var moment=require('moment');var BPromise=require(_0xe3ad('0x3'));var rp=require(_0xe3ad('0x4'));var attributes=require('./intDeskField.attributes');module['exports']=function(_0xf97e9d,_0x273b72){return _0xf97e9d['define']('DeskField',attributes,{'tableName':_0xe3ad('0x5'),'paranoid':![],'indexes':[{'name':_0xe3ad('0x6'),'fields':['idField',_0xe3ad('0x7')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a23=['bluebird','request-promise','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x18bd60,_0x288c37){var _0x286d92=function(_0x4e1ce3){while(--_0x4e1ce3){_0x18bd60['push'](_0x18bd60['shift']());}};_0x286d92(++_0x288c37);}(_0x1a23,0x136));var _0x31a2=function(_0x2a1aeb,_0x3b1dcb){_0x2a1aeb=_0x2a1aeb-0x0;var _0x58e2ff=_0x1a23[_0x2a1aeb];return _0x58e2ff;};'use strict';var _=require(_0x31a2('0x0'));var util=require(_0x31a2('0x1'));var logger=require(_0x31a2('0x2'))(_0x31a2('0x3'));var moment=require(_0x31a2('0x4'));var BPromise=require(_0x31a2('0x5'));var rp=require(_0x31a2('0x6'));var attributes=require(_0x31a2('0x7'));module[_0x31a2('0x8')]=function(_0x298353,_0x54c763){return _0x298353[_0x31a2('0x9')](_0x31a2('0xa'),attributes,{'tableName':_0x31a2('0xb'),'paranoid':![],'indexes':[{'name':_0x31a2('0xc'),'fields':[_0x31a2('0xd'),_0x31a2('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 7fd14d5..e2c1896 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 _0x4bc3=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','DeskField,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x59b90f,_0xc01cb8){var _0x35011d=function(_0x54f901){while(--_0x54f901){_0x59b90f['push'](_0x59b90f['shift']());}};_0x35011d(++_0xc01cb8);}(_0x4bc3,0x16e));var _0x34bc=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x4bc3[_0x20589d];return _0x422de9;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var moment=require('moment');var BPromise=require(_0x34bc('0x2'));var rs=require(_0x34bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34bc('0x4'))['db'];var utils=require(_0x34bc('0x5'));var logger=require(_0x34bc('0x6'))(_0x34bc('0x7'));var config=require(_0x34bc('0x8'));var jayson=require(_0x34bc('0x9'));var client=jayson[_0x34bc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21451b,_0x50320d,_0x502087){return new BPromise(function(_0x18a01c,_0x474108){return client[_0x34bc('0xb')](_0x21451b,_0x502087)[_0x34bc('0xc')](function(_0x409105){logger[_0x34bc('0xd')]('DeskField,\x20%s,\x20%s',_0x50320d,'request\x20sent');logger[_0x34bc('0xe')](_0x34bc('0xf'),_0x50320d,_0x34bc('0x10'),JSON['stringify'](_0x409105));if(_0x409105[_0x34bc('0x11')]){if(_0x409105['error'][_0x34bc('0x12')]===0x1f4){logger[_0x34bc('0x11')](_0x34bc('0x13'),_0x50320d,_0x409105['error'][_0x34bc('0x14')]);return _0x474108(_0x409105['error'][_0x34bc('0x14')]);}logger[_0x34bc('0x11')](_0x34bc('0x13'),_0x50320d,_0x409105['error']['message']);return _0x18a01c(_0x409105[_0x34bc('0x11')]['message']);}else{logger[_0x34bc('0xd')](_0x34bc('0x13'),_0x50320d,_0x34bc('0x10'));_0x18a01c(_0x409105[_0x34bc('0x15')][_0x34bc('0x14')]);}})[_0x34bc('0x16')](function(_0x5e132d){logger['error']('DeskField,\x20%s,\x20%s',_0x50320d,_0x5e132d);_0x474108(_0x5e132d);});});} \ No newline at end of file +var _0xa75b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2d5628,_0x7208b2){var _0x34697c=function(_0x1f1dc3){while(--_0x1f1dc3){_0x2d5628['push'](_0x2d5628['shift']());}};_0x34697c(++_0x7208b2);}(_0xa75b,0x170));var _0xba75=function(_0x74f8a8,_0x137546){_0x74f8a8=_0x74f8a8-0x0;var _0x5de56c=_0xa75b[_0x74f8a8];return _0x5de56c;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xba75('0x1'));var rs=require(_0xba75('0x2'));var fs=require('fs');var Redis=require(_0xba75('0x3'));var db=require(_0xba75('0x4'))['db'];var utils=require(_0xba75('0x5'));var logger=require(_0xba75('0x6'))(_0xba75('0x7'));var config=require(_0xba75('0x8'));var jayson=require(_0xba75('0x9'));var client=jayson[_0xba75('0xa')][_0xba75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x238a33,_0x3ccab5,_0x5c79e3){return new BPromise(function(_0x4b842d,_0x731cae){return client['request'](_0x238a33,_0x5c79e3)['then'](function(_0x218dbd){logger['info'](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));logger[_0xba75('0xe')](_0xba75('0xf'),_0x3ccab5,_0xba75('0xd'),JSON[_0xba75('0x10')](_0x218dbd));if(_0x218dbd[_0xba75('0x11')]){if(_0x218dbd[_0xba75('0x11')][_0xba75('0x12')]===0x1f4){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')]['message']);return _0x731cae(_0x218dbd['error'][_0xba75('0x13')]);}logger['error'](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')][_0xba75('0x13')]);return _0x4b842d(_0x218dbd[_0xba75('0x11')]['message']);}else{logger[_0xba75('0x14')](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));_0x4b842d(_0x218dbd[_0xba75('0x15')][_0xba75('0x13')]);}})['catch'](function(_0x350a9d){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x350a9d);_0x731cae(_0x350a9d);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index db43fb4..ae6188d 100644 --- a/server/api/intDynamics365Account/index.js +++ b/server/api/intDynamics365Account/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf352=['../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x26b622,_0x237e9e){var _0x58a028=function(_0xde1652){while(--_0xde1652){_0x26b622['push'](_0x26b622['shift']());}};_0x58a028(++_0x237e9e);}(_0xf352,0x1a9));var _0x2f35=function(_0x37a860,_0x53df08){_0x37a860=_0x37a860-0x0;var _0x5aca85=_0xf352[_0x37a860];return _0x5aca85;};'use strict';var multer=require(_0x2f35('0x0'));var util=require(_0x2f35('0x1'));var path=require(_0x2f35('0x2'));var timeout=require(_0x2f35('0x3'));var express=require(_0x2f35('0x4'));var router=express[_0x2f35('0x5')]();var auth=require(_0x2f35('0x6'));var interaction=require(_0x2f35('0x7'));var config=require(_0x2f35('0x8'));var controller=require(_0x2f35('0x9'));router[_0x2f35('0xa')]('/',auth[_0x2f35('0xb')](),controller[_0x2f35('0xc')]);router[_0x2f35('0xa')](_0x2f35('0xd'),auth[_0x2f35('0xb')](),controller[_0x2f35('0xe')]);router[_0x2f35('0xa')](_0x2f35('0xf'),auth[_0x2f35('0xb')](),controller['getConfigurations']);router[_0x2f35('0xa')](_0x2f35('0x10'),auth['isAuthenticated'](),controller[_0x2f35('0x11')]);router[_0x2f35('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2f35('0x12')](_0x2f35('0xf'),auth[_0x2f35('0xb')](),controller[_0x2f35('0x13')]);router[_0x2f35('0x14')](_0x2f35('0xd'),auth[_0x2f35('0xb')](),controller[_0x2f35('0x15')]);router['delete'](_0x2f35('0xd'),auth[_0x2f35('0xb')](),controller[_0x2f35('0x16')]);module[_0x2f35('0x17')]=router; \ No newline at end of file +var _0x239f=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','get','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','delete','destroy','exports','multer','path'];(function(_0x132943,_0x19856b){var _0x1f84d3=function(_0x40f1c5){while(--_0x40f1c5){_0x132943['push'](_0x132943['shift']());}};_0x1f84d3(++_0x19856b);}(_0x239f,0x1ca));var _0xf239=function(_0x15564f,_0x37540e){_0x15564f=_0x15564f-0x0;var _0x2e5468=_0x239f[_0x15564f];return _0x2e5468;};'use strict';var multer=require(_0xf239('0x0'));var util=require('util');var path=require(_0xf239('0x1'));var timeout=require(_0xf239('0x2'));var express=require(_0xf239('0x3'));var router=express[_0xf239('0x4')]();var auth=require(_0xf239('0x5'));var interaction=require(_0xf239('0x6'));var config=require('../../config/environment');var controller=require('./intDynamics365Account.controller');router['get']('/',auth[_0xf239('0x7')](),controller[_0xf239('0x8')]);router['get'](_0xf239('0x9'),auth[_0xf239('0x7')](),controller['show']);router[_0xf239('0xa')](_0xf239('0xb'),auth[_0xf239('0x7')](),controller[_0xf239('0xc')]);router[_0xf239('0xa')](_0xf239('0xd'),auth[_0xf239('0x7')](),controller['getFields']);router[_0xf239('0xe')]('/',auth[_0xf239('0x7')](),controller['create']);router[_0xf239('0xe')](_0xf239('0xb'),auth[_0xf239('0x7')](),controller[_0xf239('0xf')]);router[_0xf239('0x10')](_0xf239('0x9'),auth[_0xf239('0x7')](),controller['update']);router[_0xf239('0x11')](_0xf239('0x9'),auth[_0xf239('0x7')](),controller[_0xf239('0x12')]);module[_0xf239('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 4e8f244..ef33e0d 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.attributes.js +++ b/server/api/intDynamics365Account/intDynamics365Account.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x50c3=['STRING'];(function(_0x51f67c,_0x1977ec){var _0x3888c5=function(_0x5469be){while(--_0x5469be){_0x51f67c['push'](_0x51f67c['shift']());}};_0x3888c5(++_0x1977ec);}(_0x50c3,0x1b1));var _0x350c=function(_0x57cc47,_0x5492f4){_0x57cc47=_0x57cc47-0x0;var _0x52229c=_0x50c3[_0x57cc47];return _0x52229c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x350c('0x0')]},'username':{'type':Sequelize[_0x350c('0x0')]},'password':{'type':Sequelize[_0x350c('0x0')]},'remoteUri':{'type':Sequelize[_0x350c('0x0')]},'tenantId':{'type':Sequelize[_0x350c('0x0')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x350c('0x0')]},'serverUrl':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd022=['STRING','sequelize','exports'];(function(_0x177e62,_0x3a9ff3){var _0x49b9fc=function(_0x16bb49){while(--_0x16bb49){_0x177e62['push'](_0x177e62['shift']());}};_0x49b9fc(++_0x3a9ff3);}(_0xd022,0x169));var _0x2d02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd022[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2d02('0x0'));module[_0x2d02('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x2d02('0x2')]},'password':{'type':Sequelize[_0x2d02('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x2d02('0x2')]},'clientId':{'type':Sequelize[_0x2d02('0x2')]},'clientSecret':{'type':Sequelize[_0x2d02('0x2')]},'serverUrl':{'type':Sequelize[_0x2d02('0x2')]},'description':{'type':Sequelize[_0x2d02('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 84c6305..49d09cb 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.controller.js +++ b/server/api/intDynamics365Account/intDynamics365Account.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['customeridyominame','entityimage_timestamp','entityimage_url','escalatedon','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','slainvokedidname','slaname','statecode','statuscode','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','remoteUri','tenantId','clientId','clientSecret','slice','substring','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','forEach','@odata.type','lastIndexOf','MetadataId','all','BooleanAttributeMetadata','push','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','log','Dynamics365\x20error:\x20','test','statusCode','stack','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','UserLocalizedLabel','Value','DisplayName','Label',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','Dynamics365Account,\x20%s,\x20%s','message','result','sendStatus','status','json','count','offset','apply','save','update','destroy','name','index','Dynamics365Account','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','findOne','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Configuration','Dynamics365Field','Descriptions','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyyominame','createdbyyominame','createdon','customeridname','customeridtype'];(function(_0x98d0d6,_0x5a8adf){var _0x2b8e6d=function(_0x581d13){while(--_0x581d13){_0x98d0d6['push'](_0x98d0d6['shift']());}};_0x2b8e6d(++_0x5a8adf);}(_0xf494,0x12a));var _0x4f49=function(_0x5637e0,_0x1498f7){_0x5637e0=_0x5637e0-0x0;var _0x44ce5f=_0xf494[_0x5637e0];return _0x44ce5f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4f49('0x0'));var zipdir=require(_0x4f49('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x2'));var moment=require(_0x4f49('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4f49('0x4'));var util=require('util');var path=require(_0x4f49('0x5'));var sox=require(_0x4f49('0x6'));var csv=require('to-csv');var ejs=require(_0x4f49('0x7'));var fs=require('fs');var _=require(_0x4f49('0x8'));var squel=require(_0x4f49('0x9'));var crypto=require('crypto');var jsforce=require(_0x4f49('0xa'));var deskjs=require(_0x4f49('0xb'));var toCsv=require(_0x4f49('0xc'));var querystring=require(_0x4f49('0xd'));var Papa=require(_0x4f49('0xe'));var authService=require(_0x4f49('0xf'));var hardwareService=require(_0x4f49('0x10'));var Redis=require(_0x4f49('0x11'));var qs=require(_0x4f49('0x12'));var logger=require(_0x4f49('0x13'))(_0x4f49('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x4f49('0x15'))['db'];var integrations=require(_0x4f49('0x16'));var jayson=require(_0x4f49('0x17'));var client=jayson[_0x4f49('0x18')][_0x4f49('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3f4ca2,_0x172e2b,_0x12e844,_0x1e1f19){return new BPromise(function(_0x24084d,_0x2340c5){var _0x275b34=_0x1e1f19||client;return _0x275b34['request'](_0x3f4ca2,_0x12e844)[_0x4f49('0x1a')](function(_0x31f36b){logger[_0x4f49('0x1b')]('Dynamics365Account,\x20%s,\x20%s',_0x172e2b,_0x4f49('0x1c'));logger[_0x4f49('0x1d')](_0x4f49('0x1e'),_0x172e2b,_0x4f49('0x1c'),JSON['stringify'](_0x31f36b));if(_0x31f36b['error']){if(_0x31f36b['error']['code']===0x1f4){logger[_0x4f49('0x1f')](_0x4f49('0x20'),_0x172e2b,_0x31f36b[_0x4f49('0x1f')][_0x4f49('0x21')]);return _0x2340c5(_0x31f36b[_0x4f49('0x1f')][_0x4f49('0x21')]);}logger[_0x4f49('0x1f')](_0x4f49('0x20'),_0x172e2b,_0x31f36b[_0x4f49('0x1f')][_0x4f49('0x21')]);return _0x24084d(_0x31f36b[_0x4f49('0x1f')][_0x4f49('0x21')]);}else{logger[_0x4f49('0x1b')](_0x4f49('0x20'),_0x172e2b,_0x4f49('0x1c'));_0x24084d(_0x31f36b[_0x4f49('0x22')][_0x4f49('0x21')]);}})['catch'](function(_0x2207a5){logger[_0x4f49('0x1f')](_0x4f49('0x20'),_0x172e2b,_0x2207a5);_0x2340c5(_0x2207a5);});});}function respondWithStatusCode(_0x25066f,_0x45f167){_0x45f167=_0x45f167||0xcc;return function(_0xad0d24){if(_0xad0d24){return _0x25066f[_0x4f49('0x23')](_0x45f167);}return _0x25066f[_0x4f49('0x24')](_0x45f167)['end']();};}function respondWithResult(_0xaf6e66,_0x1e60e6){_0x1e60e6=_0x1e60e6||0xc8;return function(_0x4e1637){if(_0x4e1637){return _0xaf6e66[_0x4f49('0x24')](_0x1e60e6)[_0x4f49('0x25')](_0x4e1637);}};}function respondWithFilteredResult(_0xb3156d,_0x3de97a){return function(_0xc85e6a){if(_0xc85e6a){var _0x540152=_0xc85e6a[_0x4f49('0x26')],_0x35e8ad=_0x3de97a['offset'],_0x1f538d=_0x3de97a[_0x4f49('0x27')]+_0x3de97a['limit'],_0x52c325;if(_0x1f538d>=_0x540152){_0x1f538d=_0x540152;_0x52c325=0xc8;}else{_0x52c325=0xce;}_0xb3156d[_0x4f49('0x24')](_0x52c325);return _0xb3156d['set']('Content-Range',_0x35e8ad+'-'+_0x1f538d+'/'+_0x540152)[_0x4f49('0x25')](_0xc85e6a);}return null;};}function patchUpdates(_0x4b3f02){return function(_0x32b731){try{jsonpatch[_0x4f49('0x28')](_0x32b731,_0x4b3f02,!![]);}catch(_0x430e53){return BPromise['reject'](_0x430e53);}return _0x32b731[_0x4f49('0x29')]();};}function saveUpdates(_0x5e419a,_0x154e6a){return function(_0x4cca1d){if(_0x4cca1d){return _0x4cca1d[_0x4f49('0x2a')](_0x5e419a)['then'](function(_0x5521df){return _0x5521df;});}return null;};}function removeEntity(_0x12a9c0,_0x5b1a91){return function(_0x5f113c){if(_0x5f113c){return _0x5f113c[_0x4f49('0x2b')]()['then'](function(){_0x12a9c0[_0x4f49('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53446e,_0x5a216c){return function(_0x29146d){if(!_0x29146d){_0x53446e['sendStatus'](0x194);}return _0x29146d;};}function handleError(_0x331764,_0x523c88){_0x523c88=_0x523c88||0x1f4;return function(_0x3647b7){logger[_0x4f49('0x1f')](_0x3647b7['stack']);if(_0x3647b7['name']){delete _0x3647b7[_0x4f49('0x2c')];}_0x331764[_0x4f49('0x24')](_0x523c88)['send'](_0x3647b7);};}exports[_0x4f49('0x2d')]=function(_0x526dd2,_0x492fe9){var _0x5bffb5={},_0x4af050={},_0x399f99={'count':0x0,'rows':[]};var _0x50af31=db[_0x4f49('0x2e')][_0x4f49('0x2f')];_0x4af050[_0x4f49('0x30')]=_[_0x4f49('0x31')](_0x50af31);_0x4af050[_0x4f49('0x32')]=_[_0x4f49('0x31')](_0x526dd2[_0x4f49('0x32')]);_0x4af050[_0x4f49('0x33')]=_[_0x4f49('0x34')](_0x4af050['model'],_0x4af050[_0x4f49('0x32')]);_0x5bffb5[_0x4f49('0x35')]=_[_0x4f49('0x34')](_0x4af050[_0x4f49('0x30')],qs[_0x4f49('0x36')](_0x526dd2[_0x4f49('0x32')]['fields']));_0x5bffb5['attributes']=_0x5bffb5[_0x4f49('0x35')][_0x4f49('0x37')]?_0x5bffb5['attributes']:_0x4af050[_0x4f49('0x30')];if(!_0x526dd2[_0x4f49('0x32')][_0x4f49('0x38')]('nolimit')){_0x5bffb5[_0x4f49('0x39')]=qs[_0x4f49('0x39')](_0x526dd2[_0x4f49('0x32')][_0x4f49('0x39')]);_0x5bffb5[_0x4f49('0x27')]=qs[_0x4f49('0x27')](_0x526dd2[_0x4f49('0x32')][_0x4f49('0x27')]);}_0x5bffb5[_0x4f49('0x3a')]=qs[_0x4f49('0x3b')](_0x526dd2[_0x4f49('0x32')][_0x4f49('0x3b')]);_0x5bffb5[_0x4f49('0x3c')]=qs[_0x4f49('0x33')](_[_0x4f49('0x3d')](_0x526dd2[_0x4f49('0x32')],_0x4af050[_0x4f49('0x33')]));if(_0x526dd2[_0x4f49('0x32')][_0x4f49('0x3e')]){_0x5bffb5[_0x4f49('0x3c')]=_[_0x4f49('0x3f')](_0x5bffb5[_0x4f49('0x3c')],{'$or':_[_0x4f49('0x40')](_0x50af31,function(_0x37defe){if(_0x37defe[_0x4f49('0x41')][_0x4f49('0x42')]!==_0x4f49('0x43')){var _0x4f6808={};_0x4f6808[_0x37defe[_0x4f49('0x44')]]={'$like':'%'+_0x526dd2['query'][_0x4f49('0x3e')]+'%'};return _0x4f6808;}})});}_0x5bffb5=_[_0x4f49('0x3f')]({},_0x5bffb5,_0x526dd2[_0x4f49('0x45')]);var _0x2df790={'where':_0x5bffb5[_0x4f49('0x3c')]};return db[_0x4f49('0x2e')][_0x4f49('0x26')](_0x2df790)['then'](function(_0x1eec13){_0x399f99['count']=_0x1eec13;if(_0x526dd2['query'][_0x4f49('0x46')]){_0x5bffb5['include']=[{'all':!![]}];}return db['Dynamics365Account'][_0x4f49('0x47')](_0x5bffb5);})['then'](function(_0x435ab5){_0x399f99[_0x4f49('0x48')]=_0x435ab5;return _0x399f99;})[_0x4f49('0x1a')](respondWithFilteredResult(_0x492fe9,_0x5bffb5))[_0x4f49('0x49')](handleError(_0x492fe9,null));};exports[_0x4f49('0x4a')]=function(_0x2750e0,_0x4fda47){var _0x1d2f34={'raw':![],'where':{'id':_0x2750e0['params']['id']}},_0xc9e274={};_0xc9e274['model']=_[_0x4f49('0x31')](db[_0x4f49('0x2e')][_0x4f49('0x2f')]);_0xc9e274['query']=_[_0x4f49('0x31')](_0x2750e0[_0x4f49('0x32')]);_0xc9e274[_0x4f49('0x33')]=_[_0x4f49('0x34')](_0xc9e274[_0x4f49('0x30')],_0xc9e274['query']);_0x1d2f34[_0x4f49('0x35')]=_[_0x4f49('0x34')](_0xc9e274['model'],qs[_0x4f49('0x36')](_0x2750e0[_0x4f49('0x32')][_0x4f49('0x36')]));_0x1d2f34[_0x4f49('0x35')]=_0x1d2f34[_0x4f49('0x35')][_0x4f49('0x37')]?_0x1d2f34[_0x4f49('0x35')]:_0xc9e274[_0x4f49('0x30')];if(_0x2750e0[_0x4f49('0x32')]['includeAll']){_0x1d2f34[_0x4f49('0x4b')]=[{'all':!![]}];}_0x1d2f34=_[_0x4f49('0x3f')]({},_0x1d2f34,_0x2750e0[_0x4f49('0x45')]);return db[_0x4f49('0x2e')][_0x4f49('0x4c')](_0x1d2f34)[_0x4f49('0x1a')](handleEntityNotFound(_0x4fda47,null))[_0x4f49('0x1a')](respondWithResult(_0x4fda47,null))[_0x4f49('0x49')](handleError(_0x4fda47,null));};exports[_0x4f49('0x4d')]=function(_0x2b0133,_0x114afd){return db['Dynamics365Account']['create'](_0x2b0133[_0x4f49('0x4e')],{})[_0x4f49('0x1a')](respondWithResult(_0x114afd,0xc9))[_0x4f49('0x49')](handleError(_0x114afd,null));};exports[_0x4f49('0x2a')]=function(_0x16e272,_0x134b51){if(_0x16e272[_0x4f49('0x4e')]['id']){delete _0x16e272[_0x4f49('0x4e')]['id'];}return db[_0x4f49('0x2e')][_0x4f49('0x4c')]({'where':{'id':_0x16e272[_0x4f49('0x4f')]['id']}})['then'](handleEntityNotFound(_0x134b51,null))[_0x4f49('0x1a')](saveUpdates(_0x16e272['body'],null))[_0x4f49('0x1a')](respondWithResult(_0x134b51,null))['catch'](handleError(_0x134b51,null));};exports[_0x4f49('0x2b')]=function(_0x498301,_0x2873b6){return db[_0x4f49('0x2e')][_0x4f49('0x4c')]({'where':{'id':_0x498301[_0x4f49('0x4f')]['id']}})[_0x4f49('0x1a')](handleEntityNotFound(_0x2873b6,null))[_0x4f49('0x1a')](removeEntity(_0x2873b6,null))[_0x4f49('0x49')](handleError(_0x2873b6,null));};exports['getConfigurations']=function(_0x496643,_0x21b649,_0x4cc4d){var _0x3b0a4e={};var _0x42f441={};var _0x531cff;var _0x519471;return db['Dynamics365Account'][_0x4f49('0x50')]({'where':{'id':_0x496643[_0x4f49('0x4f')]['id']}})[_0x4f49('0x1a')](handleEntityNotFound(_0x21b649,null))[_0x4f49('0x1a')](function(_0x377391){if(_0x377391){_0x531cff=_0x377391;_0x42f441[_0x4f49('0x30')]=_[_0x4f49('0x31')](db['Dynamics365Configuration'][_0x4f49('0x2f')]);_0x42f441['query']=_[_0x4f49('0x31')](_0x496643[_0x4f49('0x32')]);_0x42f441['filters']=_[_0x4f49('0x34')](_0x42f441[_0x4f49('0x30')],_0x42f441[_0x4f49('0x32')]);_0x3b0a4e['attributes']=_[_0x4f49('0x34')](_0x42f441[_0x4f49('0x30')],qs['fields'](_0x496643[_0x4f49('0x32')][_0x4f49('0x36')]));_0x3b0a4e[_0x4f49('0x35')]=_0x3b0a4e[_0x4f49('0x35')]['length']?_0x3b0a4e[_0x4f49('0x35')]:_0x42f441['model'];_0x3b0a4e[_0x4f49('0x3a')]=qs[_0x4f49('0x3b')](_0x496643[_0x4f49('0x32')][_0x4f49('0x3b')]);_0x3b0a4e[_0x4f49('0x3c')]=qs[_0x4f49('0x33')](_['pick'](_0x496643[_0x4f49('0x32')],_0x42f441[_0x4f49('0x33')]));if(_0x496643['query']['filter']){_0x3b0a4e['where']=_['merge'](_0x3b0a4e['where'],{'$or':_[_0x4f49('0x40')](_0x3b0a4e[_0x4f49('0x35')],function(_0x5c98f7){var _0x2803da={};_0x2803da[_0x5c98f7]={'$like':'%'+_0x496643[_0x4f49('0x32')][_0x4f49('0x3e')]+'%'};return _0x2803da;})});}_0x3b0a4e=_[_0x4f49('0x3f')]({},_0x3b0a4e,_0x496643['options']);return _0x531cff['getConfigurations'](_0x3b0a4e);}})[_0x4f49('0x1a')](function(_0x59591c){if(_0x59591c){_0x519471=_0x59591c[_0x4f49('0x37')];if(!_0x496643[_0x4f49('0x32')][_0x4f49('0x38')]('nolimit')){_0x3b0a4e['limit']=qs['limit'](_0x496643[_0x4f49('0x32')][_0x4f49('0x39')]);_0x3b0a4e['offset']=qs[_0x4f49('0x27')](_0x496643[_0x4f49('0x32')][_0x4f49('0x27')]);}return _0x531cff[_0x4f49('0x51')](_0x3b0a4e);}})['then'](function(_0x593423){if(_0x593423){return _0x593423?{'count':_0x519471,'rows':_0x593423}:null;}})[_0x4f49('0x1a')](respondWithResult(_0x21b649,null))['catch'](handleError(_0x21b649,null));};exports[_0x4f49('0x52')]=function(_0x10e5a0,_0x26ded6,_0x3a7d82){if(_0x10e5a0[_0x4f49('0x4e')]['id']){delete _0x10e5a0[_0x4f49('0x4e')]['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x10e5a0['params']['id']}})[_0x4f49('0x1a')](handleEntityNotFound(_0x26ded6,null))[_0x4f49('0x1a')](function(_0xe36f8f){if(_0xe36f8f){_0x10e5a0[_0x4f49('0x4e')][_0x4f49('0x53')]=_0xe36f8f['id'];_0x10e5a0[_0x4f49('0x4e')][_0x4f49('0x54')]=integrations[_0x4f49('0x55')](_0x10e5a0[_0x4f49('0x4e')][_0x4f49('0x56')],_0x10e5a0[_0x4f49('0x4e')][_0x4f49('0x41')]);_0x10e5a0['body']['Descriptions']=integrations[_0x4f49('0x57')](_0x10e5a0[_0x4f49('0x4e')][_0x4f49('0x56')],_0x10e5a0['body'][_0x4f49('0x41')]);return db[_0x4f49('0x58')][_0x4f49('0x4d')](_0x10e5a0[_0x4f49('0x4e')],{'include':[{'model':db[_0x4f49('0x59')],'as':'Subjects'},{'model':db[_0x4f49('0x59')],'as':_0x4f49('0x5a')}]});}return null;})[_0x4f49('0x1a')](respondWithResult(_0x26ded6,null))[_0x4f49('0x49')](handleError(_0x26ded6,null));};exports[_0x4f49('0x5b')]=function(_0x38c5f8,_0x332702,_0x418de6){var _0x4bcb7f=_0x38c5f8[_0x4f49('0x32')][_0x4f49('0x5c')];var _0x43fb1b=_0x4bcb7f===_0x4f49('0x5d')?_0x4f49('0x5e'):_0x4f49('0x5f');var _0x1b14ee='';var _0x5ba90f='';var _0xb6d3b6='';var _0x3c56e7='';var _0x4feb88='';var _0x306c80='';var _0x38cdb0='';var _0x59957f='';var _0x1aa118=[_0x4f49('0x60'),_0x4f49('0x61'),_0x4f49('0x62'),_0x4f49('0x63'),'caseorigincode',_0x4f49('0x64'),_0x4f49('0x65'),_0x4f49('0x66'),'directioncode',_0x4f49('0x67')];var _0x3e80c8=[_0x4f49('0x68'),_0x4f49('0x69'),'actualserviceunits','billedserviceunits',_0x4f49('0x6a'),_0x4f49('0x6b'),_0x4f49('0x6c'),'contractidname','createdbyexternalpartyname',_0x4f49('0x6d'),'createdbyname',_0x4f49('0x6e'),_0x4f49('0x6f'),'createdonbehalfbyname','createdonbehalfbyyominame',_0x4f49('0x70'),_0x4f49('0x71'),_0x4f49('0x72'),'emailaddress','entitlementidname',_0x4f49('0x73'),_0x4f49('0x74'),_0x4f49('0x75'),'exchangerate','firstresponsebykpiidname',_0x4f49('0x76'),_0x4f49('0x77'),_0x4f49('0x78'),_0x4f49('0x79'),_0x4f49('0x7a'),'masteridname','modifiedbyexternalpartyname',_0x4f49('0x7b'),_0x4f49('0x7c'),_0x4f49('0x7d'),'modifiedon',_0x4f49('0x7e'),_0x4f49('0x7f'),'msdyn_incidenttypename',_0x4f49('0x80'),_0x4f49('0x81'),_0x4f49('0x82'),'overriddencreatedon',_0x4f49('0x83'),_0x4f49('0x84'),_0x4f49('0x85'),_0x4f49('0x86'),_0x4f49('0x87'),'primarycontactidyominame',_0x4f49('0x88'),'productidname',_0x4f49('0x89'),_0x4f49('0x8a'),_0x4f49('0x8b'),_0x4f49('0x8c'),'responsiblecontactidname',_0x4f49('0x8d'),'sentimentvalue',_0x4f49('0x8e'),_0x4f49('0x8f'),'socialprofileidname',_0x4f49('0x90'),_0x4f49('0x91'),'subjectidname',_0x4f49('0x92'),'timezoneruleversionnumber',_0x4f49('0x93'),_0x4f49('0x94'),_0x4f49('0x95'),'versionnumber'];var _0x376455=_0x1aa118[_0x4f49('0x96')](_0x3e80c8);return db[_0x4f49('0x2e')]['findOne']({'where':{'id':_0x38c5f8[_0x4f49('0x4f')]['id']},'attributes':['id',_0x4f49('0x97'),'password',_0x4f49('0x98'),_0x4f49('0x99'),_0x4f49('0x9a'),_0x4f49('0x9b')]})[_0x4f49('0x1a')](handleEntityNotFound(_0x332702,null))[_0x4f49('0x1a')](function(_0x5c0dab){if(_0x5c0dab){_0x59957f=_0x5c0dab[_0x4f49('0x98')];var _0x4307a8=_0x59957f[_0x4f49('0x9c')](-0x1);if(_0x4307a8==='/'){_0x59957f=_0x59957f[_0x4f49('0x9d')](0x0,_0x59957f['lastIndexOf'](_0x4307a8));}_0x38cdb0=util[_0x4f49('0x9e')](_0x4f49('0x9f'),_0x59957f);var _0x7e2e8={'method':_0x4f49('0xa0'),'uri':_0x4f49('0xa1')+_0x5c0dab['tenantId']+_0x4f49('0xa2'),'form':{'client_id':_0x5c0dab[_0x4f49('0x9a')],'resource':_0x59957f,'username':_0x5c0dab[_0x4f49('0x97')],'password':_0x5c0dab[_0x4f49('0xa3')],'grant_type':'password','client_secret':_0x5c0dab[_0x4f49('0x9b')]},'json':!![]};return rp(_0x7e2e8);}})[_0x4f49('0x1a')](function(_0x2b7d94){_0x306c80=_0x2b7d94[_0x4f49('0xa4')];var _0x5162c3={'method':_0x4f49('0xa5'),'uri':encodeURI(_0x38cdb0+_0x4f49('0xa6')+_0x43fb1b+'\x27'),'headers':{'Authorization':_0x4f49('0xa7')+_0x306c80,'If-None-Match':null,'OData-Version':_0x4f49('0xa8')},'json':!![]};return rp(_0x5162c3);})['then'](function(_0x422d0d){var _0x123546=_0x422d0d[_0x4f49('0xa9')][0x0];var _0x5e4bf0=_0x123546['MetadataId'];var _0x301e70={'method':_0x4f49('0xa5'),'uri':_0x38cdb0+_0x4f49('0xaa')+_0x5e4bf0+_0x4f49('0xab'),'headers':{'Authorization':'Bearer\x20'+_0x306c80,'If-None-Match':null,'OData-Version':_0x4f49('0xa8')},'json':!![]};return rp(_0x301e70);})[_0x4f49('0x1a')](function(_0x3476aa){_0x1b14ee=_0x3476aa;_0x5ba90f=_0x1b14ee['Attributes'];_0x5ba90f=_[_0x4f49('0xac')](_0x5ba90f,function(_0xb6a779){return!_0x376455[_0x4f49('0xad')](_0xb6a779[_0x4f49('0xae')]);});var _0x5c83b7=[];var _0x199066=[];_0x5ba90f[_0x4f49('0xaf')](function(_0x22f21e){if(_0x22f21e['@odata.type']){var _0x50ecdc=_0x22f21e[_0x4f49('0xb0')]['substring'](_0x22f21e['@odata.type'][_0x4f49('0xb1')]('.')+0x1);if(_0x50ecdc==='PicklistAttributeMetadata'){_0x5c83b7['push'](getSelectList(_0x38cdb0,_0x4bcb7f,_0x199066,_0x1b14ee[_0x4f49('0xb2')],_0x22f21e[_0x4f49('0xb2')],_0x306c80));}}});return Promise[_0x4f49('0xb3')](_0x5c83b7);})[_0x4f49('0x1a')](function(_0x1d55ab){_0xb6d3b6=_0x1d55ab[0x0];var _0x37ea71=[];var _0x57259f=[];_0x5ba90f[_0x4f49('0xaf')](function(_0x2d2d62){if(_0x2d2d62[_0x4f49('0xb0')]){var _0x2e8480=_0x2d2d62[_0x4f49('0xb0')][_0x4f49('0x9d')](_0x2d2d62[_0x4f49('0xb0')]['lastIndexOf']('.')+0x1);if(_0x2e8480===_0x4f49('0xb4')){_0x37ea71[_0x4f49('0xb5')](getBooleanList(_0x38cdb0,_0x4bcb7f,_0x57259f,_0x1b14ee[_0x4f49('0xb2')],_0x2d2d62[_0x4f49('0xb2')],_0x306c80));}}});return Promise[_0x4f49('0xb3')](_0x37ea71);})['then'](function(_0x326c82){_0x3c56e7=_0x326c82[0x0];var _0x3f4184=[];var _0x417187=[];_0x5ba90f[_0x4f49('0xaf')](function(_0xaebe58){if(_0xaebe58[_0x4f49('0xb0')]){var _0x2ffc91=_0xaebe58[_0x4f49('0xb0')][_0x4f49('0x9d')](_0xaebe58[_0x4f49('0xb0')][_0x4f49('0xb1')]('.')+0x1);if(_0x2ffc91===_0x4f49('0xb6')||_0x2ffc91==='DoubleAttributeMetadata'||_0x2ffc91===_0x4f49('0xb7')||_0x2ffc91===_0x4f49('0xb8')||_0x2ffc91==='MemoAttributeMetadata'||_0x2ffc91===_0x4f49('0xb9')||_0x2ffc91==='StatusAttributeMetadata'||_0x2ffc91===_0x4f49('0xba')||_0x2ffc91===_0x4f49('0xbb')||_0x2ffc91==='DecimalAttributeMetadata'){_0x3f4184[_0x4f49('0xb5')](getInputList(_0x38cdb0,_0x4bcb7f,_0x2ffc91,_0x417187,_0x1b14ee[_0x4f49('0xb2')],_0xaebe58[_0x4f49('0xb2')],_0x306c80));}}});return Promise['all'](_0x3f4184);})[_0x4f49('0x1a')](function(_0x171709){_0x4feb88=_0x171709[0x0];var _0x10f577=_0xb6d3b6[_0x4f49('0x96')](_0x3c56e7)['concat'](_0x4feb88);var _0x54cf6f={'count':_0x10f577[_0x4f49('0x37')],'rows':_0x10f577};return _0x54cf6f;})[_0x4f49('0x1a')](respondWithResult(_0x332702,null))[_0x4f49('0x49')](function(_0x2fb03c){console[_0x4f49('0xbc')](_0x4f49('0xbd')+_0x2fb03c);var _0x531696=_0x38c5f8['query'][_0x4f49('0xbe')]?0x1f4:_0x2fb03c[_0x4f49('0xbf')]||0x1f4;logger[_0x4f49('0x1f')](_0x2fb03c[_0x4f49('0xc0')]);delete _0x2fb03c[_0x4f49('0x2c')];if(_0x531696===0x191){_0x531696=0x190;}_0x332702[_0x4f49('0x24')](_0x531696)[_0x4f49('0xc1')](_0x38c5f8[_0x4f49('0x32')][_0x4f49('0xbe')]?{'message':_0x4f49('0xc2'),'statusCode':_0x2fb03c[_0x4f49('0xbf')]}:_0x2fb03c);});};function getSelectList(_0x51454f,_0x452fdb,_0x254ece,_0x2a1da9,_0x3dddc7,_0x53f41e){var _0x4945bb={'method':'GET','uri':_0x51454f+_0x4f49('0xaa')+_0x2a1da9+_0x4f49('0xc3')+_0x3dddc7+_0x4f49('0xc4')+_0x4f49('0xc5'),'headers':{'Authorization':_0x4f49('0xa7')+_0x53f41e,'If-None-Match':null,'OData-Version':_0x4f49('0xa8')},'json':!![]};return rp(_0x4945bb)[_0x4f49('0x1a')](function(_0x5d0be8){var _0x266f07=[];var _0x4d5f8c=_0x5d0be8[_0x4f49('0xc6')]['Options'];_0x4d5f8c[_0x4f49('0xaf')](function(_0x9743ad){_0x266f07[_0x4f49('0xb5')]({'name':_0x9743ad['Label'][_0x4f49('0xc7')]['Label'],'value':String(_0x9743ad[_0x4f49('0xc8')])});});var _0x727db8={'id':_0x452fdb+'_'+_0x5d0be8[_0x4f49('0xae')],'name':_0x5d0be8[_0x4f49('0xc9')][_0x4f49('0xc7')][_0x4f49('0xca')],'custom':![],'options':_0x266f07};_0x254ece[_0x4f49('0xb5')](_0x727db8);return _0x254ece;});}function getBooleanList(_0xf43277,_0x25fb0a,_0x3ad145,_0x30ebda,_0x4022dc,_0x2eb6c2){var _0x1d3623={'method':_0x4f49('0xa5'),'uri':_0xf43277+_0x4f49('0xaa')+_0x30ebda+_0x4f49('0xc3')+_0x4022dc+_0x4f49('0xcb'),'headers':{'Authorization':_0x4f49('0xa7')+_0x2eb6c2,'If-None-Match':null,'OData-Version':_0x4f49('0xa8')},'json':!![]};return rp(_0x1d3623)['then'](function(_0x4346d0){var _0x2eb385=[];_0x2eb385[_0x4f49('0xb5')]({'name':_0x4346d0['OptionSet']['TrueOption'][_0x4f49('0xca')][_0x4f49('0xc7')][_0x4f49('0xca')],'value':String(_0x4346d0['OptionSet'][_0x4f49('0xcc')][_0x4f49('0xc8')])},{'name':_0x4346d0[_0x4f49('0xc6')][_0x4f49('0xcd')][_0x4f49('0xca')]['UserLocalizedLabel'][_0x4f49('0xca')],'value':String(_0x4346d0[_0x4f49('0xc6')]['FalseOption'][_0x4f49('0xc8')])});var _0x56f43f={'id':_0x25fb0a+'_'+_0x4346d0[_0x4f49('0xae')],'name':_0x4346d0[_0x4f49('0xc9')]['UserLocalizedLabel'][_0x4f49('0xca')],'custom':![],'options':_0x2eb385};_0x3ad145[_0x4f49('0xb5')](_0x56f43f);return _0x3ad145;});}function getInputList(_0x4a2452,_0x1d47c9,_0x117075,_0x389ea7,_0x566830,_0x26bdae,_0x45b79e){var _0x3caec1={'method':_0x4f49('0xa5'),'uri':_0x4a2452+_0x4f49('0xaa')+_0x566830+_0x4f49('0xc3')+_0x26bdae+')/Microsoft.Dynamics.CRM.'+_0x117075+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x4f49('0xa7')+_0x45b79e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3caec1)['then'](function(_0x3df422){var _0x274e3f={'id':_0x1d47c9+'_'+_0x3df422['LogicalName'],'name':_0x3df422[_0x4f49('0xc9')][_0x4f49('0xc7')]?_0x3df422[_0x4f49('0xc9')][_0x4f49('0xc7')][_0x4f49('0xca')]:_0x3df422['LogicalName'],'custom':![],'options':[]};_0x389ea7['push'](_0x274e3f);return _0x389ea7;});} \ No newline at end of file +var _0x3f10=['createdbyname','createdon','createdonbehalfbyname','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','tenantId','remoteUri','slice','lastIndexOf','format','%s/api/data/v9.0/','POST','/oauth2/token','clientId','username','password','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','Attributes','remove','includes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','push','all','StringAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','log','Dynamics365\x20error:\x20','test','statusCode','send',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','UserLocalizedLabel','Label','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','FalseOption','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/utils','../../mysqldb','jayson/promise','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','Dynamics365Account','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','getConfigurations','Dynamics365Configuration','addConfiguration','channel','Descriptions','getDescriptions','Dynamics365Field','Subjects','getFields','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','directioncode','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame'];(function(_0x41ed13,_0x1044be){var _0x1bb4d5=function(_0x15d224){while(--_0x15d224){_0x41ed13['push'](_0x41ed13['shift']());}};_0x1bb4d5(++_0x1044be);}(_0x3f10,0x69));var _0x03f1=function(_0x4c5419,_0x2fdf47){_0x4c5419=_0x4c5419-0x0;var _0x5c88b6=_0x3f10[_0x4c5419];return _0x5c88b6;};'use strict';var pdf=require(_0x03f1('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x03f1('0x1'));var rp=require(_0x03f1('0x2'));var moment=require('moment');var BPromise=require(_0x03f1('0x3'));var Mustache=require('mustache');var util=require(_0x03f1('0x4'));var path=require('path');var sox=require(_0x03f1('0x5'));var csv=require(_0x03f1('0x6'));var ejs=require(_0x03f1('0x7'));var fs=require('fs');var _=require(_0x03f1('0x8'));var squel=require('squel');var crypto=require(_0x03f1('0x9'));var jsforce=require(_0x03f1('0xa'));var deskjs=require(_0x03f1('0xb'));var toCsv=require(_0x03f1('0x6'));var querystring=require('querystring');var Papa=require(_0x03f1('0xc'));var authService=require(_0x03f1('0xd'));var hardwareService=require(_0x03f1('0xe'));var Redis=require(_0x03f1('0xf'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x03f1('0x10'));var utils=require(_0x03f1('0x11'));var config=require('../../config/environment');var db=require(_0x03f1('0x12'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x03f1('0x13'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2eadd9,_0x53b134,_0xca328b,_0x3395f4){return new BPromise(function(_0x4275d7,_0x498a4b){var _0x1fc948=_0x3395f4||client;return _0x1fc948[_0x03f1('0x14')](_0x2eadd9,_0xca328b)[_0x03f1('0x15')](function(_0x4d4a06){logger[_0x03f1('0x16')](_0x03f1('0x17'),_0x53b134,_0x03f1('0x18'));logger[_0x03f1('0x19')](_0x03f1('0x1a'),_0x53b134,_0x03f1('0x18'),JSON['stringify'](_0x4d4a06));if(_0x4d4a06[_0x03f1('0x1b')]){if(_0x4d4a06[_0x03f1('0x1b')]['code']===0x1f4){logger[_0x03f1('0x1b')](_0x03f1('0x17'),_0x53b134,_0x4d4a06[_0x03f1('0x1b')][_0x03f1('0x1c')]);return _0x498a4b(_0x4d4a06[_0x03f1('0x1b')][_0x03f1('0x1c')]);}logger[_0x03f1('0x1b')](_0x03f1('0x17'),_0x53b134,_0x4d4a06[_0x03f1('0x1b')][_0x03f1('0x1c')]);return _0x4275d7(_0x4d4a06[_0x03f1('0x1b')][_0x03f1('0x1c')]);}else{logger[_0x03f1('0x16')]('Dynamics365Account,\x20%s,\x20%s',_0x53b134,_0x03f1('0x18'));_0x4275d7(_0x4d4a06[_0x03f1('0x1d')]['message']);}})['catch'](function(_0x8b5014){logger['error'](_0x03f1('0x17'),_0x53b134,_0x8b5014);_0x498a4b(_0x8b5014);});});}function respondWithStatusCode(_0x2eb32f,_0x4363dd){_0x4363dd=_0x4363dd||0xcc;return function(_0x1414f9){if(_0x1414f9){return _0x2eb32f[_0x03f1('0x1e')](_0x4363dd);}return _0x2eb32f[_0x03f1('0x1f')](_0x4363dd)[_0x03f1('0x20')]();};}function respondWithResult(_0x407213,_0x11bff2){_0x11bff2=_0x11bff2||0xc8;return function(_0x41f975){if(_0x41f975){return _0x407213[_0x03f1('0x1f')](_0x11bff2)[_0x03f1('0x21')](_0x41f975);}};}function respondWithFilteredResult(_0x7e8061,_0x32368e){return function(_0x208825){if(_0x208825){var _0x11dd35=_0x208825[_0x03f1('0x22')],_0x1d98df=_0x32368e['offset'],_0x80e09c=_0x32368e[_0x03f1('0x23')]+_0x32368e[_0x03f1('0x24')],_0x246fcd;if(_0x80e09c>=_0x11dd35){_0x80e09c=_0x11dd35;_0x246fcd=0xc8;}else{_0x246fcd=0xce;}_0x7e8061[_0x03f1('0x1f')](_0x246fcd);return _0x7e8061[_0x03f1('0x25')](_0x03f1('0x26'),_0x1d98df+'-'+_0x80e09c+'/'+_0x11dd35)['json'](_0x208825);}return null;};}function patchUpdates(_0x2d3c5d){return function(_0x55125c){try{jsonpatch[_0x03f1('0x27')](_0x55125c,_0x2d3c5d,!![]);}catch(_0x48a0ec){return BPromise[_0x03f1('0x28')](_0x48a0ec);}return _0x55125c[_0x03f1('0x29')]();};}function saveUpdates(_0x4f7a34,_0xb40750){return function(_0x41e871){if(_0x41e871){return _0x41e871[_0x03f1('0x2a')](_0x4f7a34)[_0x03f1('0x15')](function(_0x1309c9){return _0x1309c9;});}return null;};}function removeEntity(_0x1a8707,_0x4c1025){return function(_0x22ee09){if(_0x22ee09){return _0x22ee09[_0x03f1('0x2b')]()['then'](function(){_0x1a8707['status'](0xcc)[_0x03f1('0x20')]();});}};}function handleEntityNotFound(_0x5bc34a,_0x3bc103){return function(_0x1d6907){if(!_0x1d6907){_0x5bc34a[_0x03f1('0x1e')](0x194);}return _0x1d6907;};}function handleError(_0x4ab4ed,_0x2c3a8d){_0x2c3a8d=_0x2c3a8d||0x1f4;return function(_0x311941){logger[_0x03f1('0x1b')](_0x311941[_0x03f1('0x2c')]);if(_0x311941[_0x03f1('0x2d')]){delete _0x311941[_0x03f1('0x2d')];}_0x4ab4ed[_0x03f1('0x1f')](_0x2c3a8d)['send'](_0x311941);};}exports['index']=function(_0x45438d,_0xe670bb){var _0x3a510f={},_0x3e44ea={},_0x5ad99a={'count':0x0,'rows':[]};var _0x3982a0=db[_0x03f1('0x2e')]['rawAttributes'];_0x3e44ea[_0x03f1('0x2f')]=_['keys'](_0x3982a0);_0x3e44ea[_0x03f1('0x30')]=_[_0x03f1('0x31')](_0x45438d[_0x03f1('0x30')]);_0x3e44ea[_0x03f1('0x32')]=_[_0x03f1('0x33')](_0x3e44ea[_0x03f1('0x2f')],_0x3e44ea[_0x03f1('0x30')]);_0x3a510f[_0x03f1('0x34')]=_['intersection'](_0x3e44ea['model'],qs[_0x03f1('0x35')](_0x45438d[_0x03f1('0x30')]['fields']));_0x3a510f[_0x03f1('0x34')]=_0x3a510f[_0x03f1('0x34')][_0x03f1('0x36')]?_0x3a510f['attributes']:_0x3e44ea[_0x03f1('0x2f')];if(!_0x45438d[_0x03f1('0x30')][_0x03f1('0x37')](_0x03f1('0x38'))){_0x3a510f[_0x03f1('0x24')]=qs[_0x03f1('0x24')](_0x45438d[_0x03f1('0x30')][_0x03f1('0x24')]);_0x3a510f[_0x03f1('0x23')]=qs[_0x03f1('0x23')](_0x45438d['query'][_0x03f1('0x23')]);}_0x3a510f[_0x03f1('0x39')]=qs[_0x03f1('0x3a')](_0x45438d[_0x03f1('0x30')][_0x03f1('0x3a')]);_0x3a510f[_0x03f1('0x3b')]=qs['filters'](_[_0x03f1('0x3c')](_0x45438d[_0x03f1('0x30')],_0x3e44ea[_0x03f1('0x32')]));if(_0x45438d[_0x03f1('0x30')][_0x03f1('0x3d')]){_0x3a510f['where']=_[_0x03f1('0x3e')](_0x3a510f['where'],{'$or':_[_0x03f1('0x3f')](_0x3982a0,function(_0x269d77){if(_0x269d77[_0x03f1('0x40')][_0x03f1('0x41')]!==_0x03f1('0x42')){var _0x166e3f={};_0x166e3f[_0x269d77['field']]={'$like':'%'+_0x45438d[_0x03f1('0x30')][_0x03f1('0x3d')]+'%'};return _0x166e3f;}})});}_0x3a510f=_[_0x03f1('0x3e')]({},_0x3a510f,_0x45438d[_0x03f1('0x43')]);var _0x16acd4={'where':_0x3a510f[_0x03f1('0x3b')]};return db[_0x03f1('0x2e')][_0x03f1('0x22')](_0x16acd4)[_0x03f1('0x15')](function(_0x4e95db){_0x5ad99a[_0x03f1('0x22')]=_0x4e95db;if(_0x45438d['query'][_0x03f1('0x44')]){_0x3a510f[_0x03f1('0x45')]=[{'all':!![]}];}return db[_0x03f1('0x2e')][_0x03f1('0x46')](_0x3a510f);})[_0x03f1('0x15')](function(_0x1ff61b){_0x5ad99a[_0x03f1('0x47')]=_0x1ff61b;return _0x5ad99a;})[_0x03f1('0x15')](respondWithFilteredResult(_0xe670bb,_0x3a510f))[_0x03f1('0x48')](handleError(_0xe670bb,null));};exports[_0x03f1('0x49')]=function(_0x3dc446,_0x756448){var _0x413817={'raw':![],'where':{'id':_0x3dc446[_0x03f1('0x4a')]['id']}},_0x1f146a={};_0x1f146a[_0x03f1('0x2f')]=_['keys'](db[_0x03f1('0x2e')][_0x03f1('0x4b')]);_0x1f146a[_0x03f1('0x30')]=_['keys'](_0x3dc446[_0x03f1('0x30')]);_0x1f146a[_0x03f1('0x32')]=_[_0x03f1('0x33')](_0x1f146a['model'],_0x1f146a[_0x03f1('0x30')]);_0x413817[_0x03f1('0x34')]=_[_0x03f1('0x33')](_0x1f146a[_0x03f1('0x2f')],qs[_0x03f1('0x35')](_0x3dc446[_0x03f1('0x30')][_0x03f1('0x35')]));_0x413817[_0x03f1('0x34')]=_0x413817[_0x03f1('0x34')][_0x03f1('0x36')]?_0x413817[_0x03f1('0x34')]:_0x1f146a['model'];if(_0x3dc446[_0x03f1('0x30')][_0x03f1('0x44')]){_0x413817['include']=[{'all':!![]}];}_0x413817=_[_0x03f1('0x3e')]({},_0x413817,_0x3dc446[_0x03f1('0x43')]);return db[_0x03f1('0x2e')]['find'](_0x413817)[_0x03f1('0x15')](handleEntityNotFound(_0x756448,null))[_0x03f1('0x15')](respondWithResult(_0x756448,null))[_0x03f1('0x48')](handleError(_0x756448,null));};exports[_0x03f1('0x4c')]=function(_0x2f6af8,_0x2d9ac5){return db[_0x03f1('0x2e')][_0x03f1('0x4c')](_0x2f6af8[_0x03f1('0x4d')],{})['then'](respondWithResult(_0x2d9ac5,0xc9))[_0x03f1('0x48')](handleError(_0x2d9ac5,null));};exports[_0x03f1('0x2a')]=function(_0x127bc9,_0x1c057d){if(_0x127bc9['body']['id']){delete _0x127bc9[_0x03f1('0x4d')]['id'];}return db[_0x03f1('0x2e')][_0x03f1('0x4e')]({'where':{'id':_0x127bc9[_0x03f1('0x4a')]['id']}})[_0x03f1('0x15')](handleEntityNotFound(_0x1c057d,null))['then'](saveUpdates(_0x127bc9[_0x03f1('0x4d')],null))[_0x03f1('0x15')](respondWithResult(_0x1c057d,null))['catch'](handleError(_0x1c057d,null));};exports[_0x03f1('0x2b')]=function(_0x402c93,_0x4eff26){return db[_0x03f1('0x2e')]['find']({'where':{'id':_0x402c93[_0x03f1('0x4a')]['id']}})[_0x03f1('0x15')](handleEntityNotFound(_0x4eff26,null))[_0x03f1('0x15')](removeEntity(_0x4eff26,null))[_0x03f1('0x48')](handleError(_0x4eff26,null));};exports[_0x03f1('0x4f')]=function(_0x4d8fc2,_0x1f9380,_0x118027){var _0x431b8a={};var _0x8ef64b={};var _0x4e7127;var _0x1a0d82;return db[_0x03f1('0x2e')]['findOne']({'where':{'id':_0x4d8fc2[_0x03f1('0x4a')]['id']}})[_0x03f1('0x15')](handleEntityNotFound(_0x1f9380,null))[_0x03f1('0x15')](function(_0x2c2c1e){if(_0x2c2c1e){_0x4e7127=_0x2c2c1e;_0x8ef64b[_0x03f1('0x2f')]=_[_0x03f1('0x31')](db[_0x03f1('0x50')][_0x03f1('0x4b')]);_0x8ef64b[_0x03f1('0x30')]=_[_0x03f1('0x31')](_0x4d8fc2[_0x03f1('0x30')]);_0x8ef64b[_0x03f1('0x32')]=_[_0x03f1('0x33')](_0x8ef64b[_0x03f1('0x2f')],_0x8ef64b[_0x03f1('0x30')]);_0x431b8a[_0x03f1('0x34')]=_[_0x03f1('0x33')](_0x8ef64b[_0x03f1('0x2f')],qs['fields'](_0x4d8fc2[_0x03f1('0x30')][_0x03f1('0x35')]));_0x431b8a['attributes']=_0x431b8a['attributes'][_0x03f1('0x36')]?_0x431b8a[_0x03f1('0x34')]:_0x8ef64b[_0x03f1('0x2f')];_0x431b8a[_0x03f1('0x39')]=qs['sort'](_0x4d8fc2['query']['sort']);_0x431b8a['where']=qs[_0x03f1('0x32')](_[_0x03f1('0x3c')](_0x4d8fc2[_0x03f1('0x30')],_0x8ef64b[_0x03f1('0x32')]));if(_0x4d8fc2[_0x03f1('0x30')][_0x03f1('0x3d')]){_0x431b8a[_0x03f1('0x3b')]=_[_0x03f1('0x3e')](_0x431b8a[_0x03f1('0x3b')],{'$or':_[_0x03f1('0x3f')](_0x431b8a[_0x03f1('0x34')],function(_0x3f1dd7){var _0x17831f={};_0x17831f[_0x3f1dd7]={'$like':'%'+_0x4d8fc2[_0x03f1('0x30')][_0x03f1('0x3d')]+'%'};return _0x17831f;})});}_0x431b8a=_[_0x03f1('0x3e')]({},_0x431b8a,_0x4d8fc2[_0x03f1('0x43')]);return _0x4e7127[_0x03f1('0x4f')](_0x431b8a);}})['then'](function(_0x5ca814){if(_0x5ca814){_0x1a0d82=_0x5ca814[_0x03f1('0x36')];if(!_0x4d8fc2[_0x03f1('0x30')]['hasOwnProperty'](_0x03f1('0x38'))){_0x431b8a['limit']=qs[_0x03f1('0x24')](_0x4d8fc2[_0x03f1('0x30')][_0x03f1('0x24')]);_0x431b8a[_0x03f1('0x23')]=qs[_0x03f1('0x23')](_0x4d8fc2[_0x03f1('0x30')][_0x03f1('0x23')]);}return _0x4e7127['getConfigurations'](_0x431b8a);}})[_0x03f1('0x15')](function(_0xd3a9e5){if(_0xd3a9e5){return _0xd3a9e5?{'count':_0x1a0d82,'rows':_0xd3a9e5}:null;}})[_0x03f1('0x15')](respondWithResult(_0x1f9380,null))[_0x03f1('0x48')](handleError(_0x1f9380,null));};exports[_0x03f1('0x51')]=function(_0xe50aae,_0x218c70,_0x108927){if(_0xe50aae[_0x03f1('0x4d')]['id']){delete _0xe50aae[_0x03f1('0x4d')]['id'];}return db[_0x03f1('0x2e')]['findOne']({'where':{'id':_0xe50aae[_0x03f1('0x4a')]['id']}})[_0x03f1('0x15')](handleEntityNotFound(_0x218c70,null))[_0x03f1('0x15')](function(_0x50ccb9){if(_0x50ccb9){_0xe50aae[_0x03f1('0x4d')]['AccountId']=_0x50ccb9['id'];_0xe50aae[_0x03f1('0x4d')]['Subjects']=integrations['getSubjects'](_0xe50aae['body'][_0x03f1('0x52')],_0xe50aae[_0x03f1('0x4d')][_0x03f1('0x40')]);_0xe50aae[_0x03f1('0x4d')][_0x03f1('0x53')]=integrations[_0x03f1('0x54')](_0xe50aae[_0x03f1('0x4d')][_0x03f1('0x52')],_0xe50aae[_0x03f1('0x4d')][_0x03f1('0x40')]);return db[_0x03f1('0x50')]['create'](_0xe50aae['body'],{'include':[{'model':db[_0x03f1('0x55')],'as':_0x03f1('0x56')},{'model':db[_0x03f1('0x55')],'as':_0x03f1('0x53')}]});}return null;})[_0x03f1('0x15')](respondWithResult(_0x218c70,null))[_0x03f1('0x48')](handleError(_0x218c70,null));};exports[_0x03f1('0x57')]=function(_0x53d0aa,_0x354e25,_0xe8b63){var _0x4882a5=_0x53d0aa[_0x03f1('0x30')]['ticketType'];var _0x5a000c=_0x4882a5==='incident'?'Incident':_0x03f1('0x58');var _0xf44c1e='';var _0x2167dd='';var _0x21c6f1='';var _0x569f28='';var _0x102c46='';var _0x3a6bd7='';var _0x17f4e9='';var _0x52316e='';var _0x9464ca=[_0x03f1('0x59'),_0x03f1('0x5a'),_0x03f1('0x5b'),_0x03f1('0x5c'),_0x03f1('0x5d'),_0x03f1('0x5e'),_0x03f1('0x5f'),'regardingobjectid',_0x03f1('0x60'),'phonecall_activity_parties'];var _0xb2800f=[_0x03f1('0x61'),_0x03f1('0x62'),_0x03f1('0x63'),'billedserviceunits',_0x03f1('0x64'),_0x03f1('0x65'),_0x03f1('0x66'),_0x03f1('0x67'),'createdbyexternalpartyname',_0x03f1('0x68'),_0x03f1('0x69'),'createdbyyominame',_0x03f1('0x6a'),_0x03f1('0x6b'),'createdonbehalfbyyominame',_0x03f1('0x6c'),'customeridtype',_0x03f1('0x6d'),_0x03f1('0x6e'),_0x03f1('0x6f'),_0x03f1('0x70'),_0x03f1('0x71'),_0x03f1('0x72'),_0x03f1('0x73'),_0x03f1('0x74'),'followupby',_0x03f1('0x75'),_0x03f1('0x76'),_0x03f1('0x77'),_0x03f1('0x78'),_0x03f1('0x79'),'modifiedbyexternalpartyname',_0x03f1('0x7a'),_0x03f1('0x7b'),_0x03f1('0x7c'),'modifiedon',_0x03f1('0x7d'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0x03f1('0x7e'),_0x03f1('0x7f'),_0x03f1('0x80'),_0x03f1('0x81'),_0x03f1('0x82'),_0x03f1('0x83'),_0x03f1('0x84'),_0x03f1('0x85'),'primarycontactidname','primarycontactidyominame',_0x03f1('0x86'),_0x03f1('0x87'),_0x03f1('0x88'),_0x03f1('0x89'),_0x03f1('0x8a'),_0x03f1('0x8b'),_0x03f1('0x8c'),_0x03f1('0x8d'),_0x03f1('0x8e'),_0x03f1('0x8f'),_0x03f1('0x90'),_0x03f1('0x91'),_0x03f1('0x92'),_0x03f1('0x93'),_0x03f1('0x94'),_0x03f1('0x95'),_0x03f1('0x96'),'transactioncurrencyidname',_0x03f1('0x97'),_0x03f1('0x98'),_0x03f1('0x99')];var _0x267269=_0x9464ca['concat'](_0xb2800f);return db[_0x03f1('0x2e')]['findOne']({'where':{'id':_0x53d0aa[_0x03f1('0x4a')]['id']},'attributes':['id','username','password','remoteUri',_0x03f1('0x9a'),'clientId','clientSecret']})[_0x03f1('0x15')](handleEntityNotFound(_0x354e25,null))[_0x03f1('0x15')](function(_0x53bdbb){if(_0x53bdbb){_0x52316e=_0x53bdbb[_0x03f1('0x9b')];var _0x4e3809=_0x52316e[_0x03f1('0x9c')](-0x1);if(_0x4e3809==='/'){_0x52316e=_0x52316e['substring'](0x0,_0x52316e[_0x03f1('0x9d')](_0x4e3809));}_0x17f4e9=util[_0x03f1('0x9e')](_0x03f1('0x9f'),_0x52316e);var _0x2aadef={'method':_0x03f1('0xa0'),'uri':'https://login.microsoftonline.com/'+_0x53bdbb['tenantId']+_0x03f1('0xa1'),'form':{'client_id':_0x53bdbb[_0x03f1('0xa2')],'resource':_0x52316e,'username':_0x53bdbb[_0x03f1('0xa3')],'password':_0x53bdbb[_0x03f1('0xa4')],'grant_type':_0x03f1('0xa4'),'client_secret':_0x53bdbb[_0x03f1('0xa5')]},'json':!![]};return rp(_0x2aadef);}})[_0x03f1('0x15')](function(_0x4c9e28){_0x3a6bd7=_0x4c9e28['access_token'];var _0x43ae65={'method':_0x03f1('0xa6'),'uri':encodeURI(_0x17f4e9+_0x03f1('0xa7')+_0x5a000c+'\x27'),'headers':{'Authorization':_0x03f1('0xa8')+_0x3a6bd7,'If-None-Match':null,'OData-Version':_0x03f1('0xa9')},'json':!![]};return rp(_0x43ae65);})['then'](function(_0xd5f810){var _0x5730ff=_0xd5f810[_0x03f1('0xaa')][0x0];var _0x26c1ac=_0x5730ff[_0x03f1('0xab')];var _0x246d63={'method':_0x03f1('0xa6'),'uri':_0x17f4e9+_0x03f1('0xac')+_0x26c1ac+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x03f1('0xa8')+_0x3a6bd7,'If-None-Match':null,'OData-Version':_0x03f1('0xa9')},'json':!![]};return rp(_0x246d63);})['then'](function(_0x4354af){_0xf44c1e=_0x4354af;_0x2167dd=_0xf44c1e[_0x03f1('0xad')];_0x2167dd=_[_0x03f1('0xae')](_0x2167dd,function(_0x1ac12c){return!_0x267269[_0x03f1('0xaf')](_0x1ac12c[_0x03f1('0xb0')]);});var _0x5fc765=[];var _0x2a3d65=[];_0x2167dd[_0x03f1('0xb1')](function(_0x3fbe47){if(_0x3fbe47[_0x03f1('0xb2')]){var _0x515bab=_0x3fbe47[_0x03f1('0xb2')][_0x03f1('0xb3')](_0x3fbe47['@odata.type']['lastIndexOf']('.')+0x1);if(_0x515bab===_0x03f1('0xb4')){_0x5fc765[_0x03f1('0xb5')](getSelectList(_0x17f4e9,_0x4882a5,_0x2a3d65,_0xf44c1e[_0x03f1('0xab')],_0x3fbe47[_0x03f1('0xab')],_0x3a6bd7));}}});return Promise['all'](_0x5fc765);})[_0x03f1('0x15')](function(_0x28ac71){_0x21c6f1=_0x28ac71[0x0];var _0x31ce76=[];var _0x3a8048=[];_0x2167dd[_0x03f1('0xb1')](function(_0x4af09e){if(_0x4af09e[_0x03f1('0xb2')]){var _0xc945fe=_0x4af09e[_0x03f1('0xb2')][_0x03f1('0xb3')](_0x4af09e[_0x03f1('0xb2')]['lastIndexOf']('.')+0x1);if(_0xc945fe==='BooleanAttributeMetadata'){_0x31ce76[_0x03f1('0xb5')](getBooleanList(_0x17f4e9,_0x4882a5,_0x3a8048,_0xf44c1e[_0x03f1('0xab')],_0x4af09e[_0x03f1('0xab')],_0x3a6bd7));}}});return Promise[_0x03f1('0xb6')](_0x31ce76);})[_0x03f1('0x15')](function(_0x3560af){_0x569f28=_0x3560af[0x0];var _0xddd93a=[];var _0x47cfee=[];_0x2167dd[_0x03f1('0xb1')](function(_0x4c8db3){if(_0x4c8db3['@odata.type']){var _0x2f0a23=_0x4c8db3[_0x03f1('0xb2')]['substring'](_0x4c8db3['@odata.type'][_0x03f1('0x9d')]('.')+0x1);if(_0x2f0a23===_0x03f1('0xb7')||_0x2f0a23==='DoubleAttributeMetadata'||_0x2f0a23==='BigIntAttributeMetadata'||_0x2f0a23===_0x03f1('0xb8')||_0x2f0a23===_0x03f1('0xb9')||_0x2f0a23===_0x03f1('0xba')||_0x2f0a23==='StatusAttributeMetadata'||_0x2f0a23===_0x03f1('0xbb')||_0x2f0a23===_0x03f1('0xbc')||_0x2f0a23===_0x03f1('0xbd')){_0xddd93a['push'](getInputList(_0x17f4e9,_0x4882a5,_0x2f0a23,_0x47cfee,_0xf44c1e['MetadataId'],_0x4c8db3[_0x03f1('0xab')],_0x3a6bd7));}}});return Promise['all'](_0xddd93a);})[_0x03f1('0x15')](function(_0x2a5ba3){_0x102c46=_0x2a5ba3[0x0];var _0x3b5fd4=_0x21c6f1[_0x03f1('0xbe')](_0x569f28)['concat'](_0x102c46);var _0x14a145={'count':_0x3b5fd4[_0x03f1('0x36')],'rows':_0x3b5fd4};return _0x14a145;})[_0x03f1('0x15')](respondWithResult(_0x354e25,null))[_0x03f1('0x48')](function(_0x17a1d7){console[_0x03f1('0xbf')](_0x03f1('0xc0')+_0x17a1d7);var _0x52aecf=_0x53d0aa[_0x03f1('0x30')][_0x03f1('0xc1')]?0x1f4:_0x17a1d7[_0x03f1('0xc2')]||0x1f4;logger[_0x03f1('0x1b')](_0x17a1d7['stack']);delete _0x17a1d7['name'];if(_0x52aecf===0x191){_0x52aecf=0x190;}_0x354e25[_0x03f1('0x1f')](_0x52aecf)[_0x03f1('0xc3')](_0x53d0aa[_0x03f1('0x30')][_0x03f1('0xc1')]?{'message':'Wrong\x20credentials','statusCode':_0x17a1d7[_0x03f1('0xc2')]}:_0x17a1d7);});};function getSelectList(_0x47589c,_0x2f15a2,_0x4ef32e,_0x2313f6,_0x2d6a15,_0x349a19){var _0x57dab4={'method':_0x03f1('0xa6'),'uri':_0x47589c+_0x03f1('0xac')+_0x2313f6+_0x03f1('0xc4')+_0x2d6a15+_0x03f1('0xc5')+_0x03f1('0xc6'),'headers':{'Authorization':'Bearer\x20'+_0x349a19,'If-None-Match':null,'OData-Version':_0x03f1('0xa9')},'json':!![]};return rp(_0x57dab4)['then'](function(_0x9799e3){var _0x3a8dd6=[];var _0xa2ce0a=_0x9799e3['OptionSet'][_0x03f1('0xc7')];_0xa2ce0a['forEach'](function(_0xf97608){_0x3a8dd6[_0x03f1('0xb5')]({'name':_0xf97608['Label'][_0x03f1('0xc8')][_0x03f1('0xc9')],'value':String(_0xf97608[_0x03f1('0xca')])});});var _0x373e7a={'id':_0x2f15a2+'_'+_0x9799e3[_0x03f1('0xb0')],'name':_0x9799e3['DisplayName'][_0x03f1('0xc8')][_0x03f1('0xc9')],'custom':![],'options':_0x3a8dd6};_0x4ef32e[_0x03f1('0xb5')](_0x373e7a);return _0x4ef32e;});}function getBooleanList(_0x1fedb3,_0x29d25c,_0x280a81,_0x291b19,_0x122a60,_0x4ac656){var _0x573df3={'method':'GET','uri':_0x1fedb3+_0x03f1('0xac')+_0x291b19+_0x03f1('0xc4')+_0x122a60+_0x03f1('0xcb'),'headers':{'Authorization':'Bearer\x20'+_0x4ac656,'If-None-Match':null,'OData-Version':_0x03f1('0xa9')},'json':!![]};return rp(_0x573df3)['then'](function(_0x53cc1a){var _0x1f87df=[];_0x1f87df[_0x03f1('0xb5')]({'name':_0x53cc1a[_0x03f1('0xcc')][_0x03f1('0xcd')][_0x03f1('0xc9')][_0x03f1('0xc8')][_0x03f1('0xc9')],'value':String(_0x53cc1a[_0x03f1('0xcc')][_0x03f1('0xcd')]['Value'])},{'name':_0x53cc1a[_0x03f1('0xcc')]['FalseOption']['Label'][_0x03f1('0xc8')]['Label'],'value':String(_0x53cc1a[_0x03f1('0xcc')][_0x03f1('0xce')][_0x03f1('0xca')])});var _0x52c276={'id':_0x29d25c+'_'+_0x53cc1a[_0x03f1('0xb0')],'name':_0x53cc1a[_0x03f1('0xcf')][_0x03f1('0xc8')][_0x03f1('0xc9')],'custom':![],'options':_0x1f87df};_0x280a81[_0x03f1('0xb5')](_0x52c276);return _0x280a81;});}function getInputList(_0x3c59cb,_0x3bc955,_0x2df233,_0x755464,_0x529aa6,_0x2f942f,_0x46f34e){var _0x5daf6e={'method':_0x03f1('0xa6'),'uri':_0x3c59cb+_0x03f1('0xac')+_0x529aa6+_0x03f1('0xc4')+_0x2f942f+_0x03f1('0xd0')+_0x2df233+_0x03f1('0xd1'),'headers':{'Authorization':_0x03f1('0xa8')+_0x46f34e,'If-None-Match':null,'OData-Version':_0x03f1('0xa9')},'json':!![]};return rp(_0x5daf6e)[_0x03f1('0x15')](function(_0x1c1f22){var _0xfe543d={'id':_0x3bc955+'_'+_0x1c1f22['LogicalName'],'name':_0x1c1f22[_0x03f1('0xcf')][_0x03f1('0xc8')]?_0x1c1f22['DisplayName'][_0x03f1('0xc8')][_0x03f1('0xc9')]:_0x1c1f22['LogicalName'],'custom':![],'options':[]};_0x755464[_0x03f1('0xb5')](_0xfe543d);return _0x755464;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 362e9ba..d2efe1f 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbfa8=['util','../../config/logger','moment','request-promise','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','int_dynamics365_accounts','lodash'];(function(_0x475ad4,_0x5cf61d){var _0x2a7c70=function(_0x1c04ef){while(--_0x1c04ef){_0x475ad4['push'](_0x475ad4['shift']());}};_0x2a7c70(++_0x5cf61d);}(_0xbfa8,0xe5));var _0x8bfa=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xbfa8[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x8bfa('0x0'));var util=require(_0x8bfa('0x1'));var logger=require(_0x8bfa('0x2'))('api');var moment=require(_0x8bfa('0x3'));var BPromise=require('bluebird');var rp=require(_0x8bfa('0x4'));var attributes=require(_0x8bfa('0x5'));var integrations=require(_0x8bfa('0x6'));module[_0x8bfa('0x7')]=function(_0x35c0ea,_0x1d3a6b){return _0x35c0ea[_0x8bfa('0x8')]('Dynamics365Account',attributes,{'tableName':_0x8bfa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeffe=['./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util','api','bluebird','request-promise'];(function(_0x4cdbca,_0x3841bd){var _0x8b114f=function(_0x4e84f7){while(--_0x4e84f7){_0x4cdbca['push'](_0x4cdbca['shift']());}};_0x8b114f(++_0x3841bd);}(_0xeffe,0x17c));var _0xeeff=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xeffe[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0xeeff('0x0'));var util=require(_0xeeff('0x1'));var logger=require('../../config/logger')(_0xeeff('0x2'));var moment=require('moment');var BPromise=require(_0xeeff('0x3'));var rp=require(_0xeeff('0x4'));var attributes=require(_0xeeff('0x5'));var integrations=require(_0xeeff('0x6'));module[_0xeeff('0x7')]=function(_0xd7452,_0x5d739a){return _0xd7452[_0xeeff('0x8')](_0xeeff('0x9'),attributes,{'tableName':_0xeeff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index fb2a2de..f9f9e93 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.rpc.js +++ b/server/api/intDynamics365Account/intDynamics365Account.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x62fc=['attributes','limit','include','map','model','stringify','ShowDynamics365Account','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','where'];(function(_0x3f1774,_0x3c0cd2){var _0x39de7c=function(_0xc36593){while(--_0xc36593){_0x3f1774['push'](_0x3f1774['shift']());}};_0x39de7c(++_0x3c0cd2);}(_0x62fc,0x74));var _0xc62f=function(_0x3b516e,_0x49903d){_0x3b516e=_0x3b516e-0x0;var _0x44fb78=_0x62fc[_0x3b516e];return _0x44fb78;};'use strict';var _=require(_0xc62f('0x0'));var util=require(_0xc62f('0x1'));var moment=require(_0xc62f('0x2'));var BPromise=require('bluebird');var rs=require(_0xc62f('0x3'));var fs=require('fs');var Redis=require(_0xc62f('0x4'));var db=require(_0xc62f('0x5'))['db'];var utils=require(_0xc62f('0x6'));var logger=require(_0xc62f('0x7'))(_0xc62f('0x8'));var config=require('../../config/environment');var jayson=require(_0xc62f('0x9'));var client=jayson['client'][_0xc62f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17d43a,_0x1dbd69,_0xf6e6d7){return new BPromise(function(_0x3f80d2,_0x56e3c7){return client[_0xc62f('0xb')](_0x17d43a,_0xf6e6d7)[_0xc62f('0xc')](function(_0x55af92){logger[_0xc62f('0xd')](_0xc62f('0xe'),_0x1dbd69,_0xc62f('0xf'));logger[_0xc62f('0x10')](_0xc62f('0x11'),_0x1dbd69,_0xc62f('0xf'),JSON['stringify'](_0x55af92));if(_0x55af92['error']){if(_0x55af92[_0xc62f('0x12')][_0xc62f('0x13')]===0x1f4){logger[_0xc62f('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x1dbd69,_0x55af92[_0xc62f('0x12')][_0xc62f('0x14')]);return _0x56e3c7(_0x55af92['error'][_0xc62f('0x14')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x1dbd69,_0x55af92[_0xc62f('0x12')][_0xc62f('0x14')]);return _0x3f80d2(_0x55af92[_0xc62f('0x12')][_0xc62f('0x14')]);}else{logger[_0xc62f('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x1dbd69,_0xc62f('0xf'));_0x3f80d2(_0x55af92[_0xc62f('0x15')][_0xc62f('0x14')]);}})[_0xc62f('0x16')](function(_0x4034db){logger[_0xc62f('0x12')](_0xc62f('0xe'),_0x1dbd69,_0x4034db);_0x56e3c7(_0x4034db);});});}exports[_0xc62f('0x17')]=function(_0x50f28c){var _0x4a3c44=this;return new Promise(function(_0x59a5cb,_0x5ee841){return db[_0xc62f('0x18')][_0xc62f('0x19')]({'raw':_0x50f28c[_0xc62f('0x1a')]?_0x50f28c[_0xc62f('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x50f28c['options']?_0x50f28c['options'][_0xc62f('0x1b')]||null:null,'attributes':_0x50f28c[_0xc62f('0x1a')]?_0x50f28c['options'][_0xc62f('0x1c')]||null:null,'limit':_0x50f28c[_0xc62f('0x1a')]?_0x50f28c[_0xc62f('0x1a')][_0xc62f('0x1d')]||null:null,'include':_0x50f28c['options']?_0x50f28c[_0xc62f('0x1a')][_0xc62f('0x1e')]?_[_0xc62f('0x1f')](_0x50f28c[_0xc62f('0x1a')][_0xc62f('0x1e')],function(_0x54ce6e){return{'model':db[_0x54ce6e['model']],'as':_0x54ce6e['as'],'attributes':_0x54ce6e[_0xc62f('0x1c')],'include':_0x54ce6e[_0xc62f('0x1e')]?_[_0xc62f('0x1f')](_0x54ce6e[_0xc62f('0x1e')],function(_0x154b21){return{'model':db[_0x154b21['model']],'as':_0x154b21['as'],'attributes':_0x154b21[_0xc62f('0x1c')],'include':_0x154b21['include']?_[_0xc62f('0x1f')](_0x154b21['include'],function(_0x1ed9ad){return{'model':db[_0x1ed9ad[_0xc62f('0x20')]],'as':_0x1ed9ad['as'],'attributes':_0x1ed9ad[_0xc62f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc62f('0xc')](function(_0x24353a){logger[_0xc62f('0xd')](_0xc62f('0x17'),_0x50f28c);logger[_0xc62f('0x10')](_0xc62f('0x17'),_0x50f28c,JSON[_0xc62f('0x21')](_0x24353a));_0x59a5cb(_0x24353a);})['catch'](function(_0x826089){logger[_0xc62f('0x12')](_0xc62f('0x17'),_0x826089[_0xc62f('0x14')],_0x50f28c);_0x5ee841(_0x4a3c44[_0xc62f('0x12')](0x1f4,_0x826089[_0xc62f('0x14')]));});});};exports[_0xc62f('0x22')]=function(_0x39317c){var _0x15b78a=this;return new Promise(function(_0x260b78,_0x1d555a){return db[_0xc62f('0x18')][_0xc62f('0x23')]({'raw':_0x39317c[_0xc62f('0x1a')]?_0x39317c[_0xc62f('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x39317c[_0xc62f('0x1a')]?_0x39317c['options'][_0xc62f('0x1b')]||null:null,'attributes':_0x39317c['options']?_0x39317c[_0xc62f('0x1a')]['attributes']||null:null,'include':_0x39317c[_0xc62f('0x1a')]?_0x39317c[_0xc62f('0x1a')]['include']?_[_0xc62f('0x1f')](_0x39317c[_0xc62f('0x1a')]['include'],function(_0x3612e1){return{'model':db[_0x3612e1['model']],'as':_0x3612e1['as'],'attributes':_0x3612e1[_0xc62f('0x1c')],'include':_0x3612e1[_0xc62f('0x1e')]?_[_0xc62f('0x1f')](_0x3612e1['include'],function(_0xe62a11){return{'model':db[_0xe62a11['model']],'as':_0xe62a11['as'],'attributes':_0xe62a11[_0xc62f('0x1c')],'include':_0xe62a11[_0xc62f('0x1e')]?_[_0xc62f('0x1f')](_0xe62a11[_0xc62f('0x1e')],function(_0x15832a){return{'model':db[_0x15832a[_0xc62f('0x20')]],'as':_0x15832a['as'],'attributes':_0x15832a['attributes']};}):[]};}):[]};}):[]:[]})[_0xc62f('0xc')](function(_0x4b2e84){logger[_0xc62f('0xd')]('ShowDynamics365Account',_0x39317c);logger[_0xc62f('0x10')](_0xc62f('0x22'),_0x39317c,JSON[_0xc62f('0x21')](_0x4b2e84));_0x260b78(_0x4b2e84);})[_0xc62f('0x16')](function(_0x2da7e4){logger[_0xc62f('0x12')](_0xc62f('0x22'),_0x2da7e4[_0xc62f('0x14')],_0x39317c);_0x1d555a(_0x15b78a[_0xc62f('0x12')](0x1f4,_0x2da7e4[_0xc62f('0x14')]));});});}; \ No newline at end of file +var _0x500b=['info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','limit','map','include','model','attributes','ShowDynamics365Account','find','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x46901f,_0x740108){var _0x47a6bd=function(_0x1594f6){while(--_0x1594f6){_0x46901f['push'](_0x46901f['shift']());}};_0x47a6bd(++_0x740108);}(_0x500b,0xf0));var _0xb500=function(_0x5d3394,_0x5e5dce){_0x5d3394=_0x5d3394-0x0;var _0x102ca5=_0x500b[_0x5d3394];return _0x102ca5;};'use strict';var _=require(_0xb500('0x0'));var util=require('util');var moment=require(_0xb500('0x1'));var BPromise=require('bluebird');var rs=require(_0xb500('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb500('0x3'))['db'];var utils=require(_0xb500('0x4'));var logger=require(_0xb500('0x5'))(_0xb500('0x6'));var config=require(_0xb500('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb500('0x8')][_0xb500('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x104e37,_0x3d3beb,_0x40efab){return new BPromise(function(_0x50f685,_0x5a5b72){return client[_0xb500('0xa')](_0x104e37,_0x40efab)[_0xb500('0xb')](function(_0x2e0a0d){logger[_0xb500('0xc')](_0xb500('0xd'),_0x3d3beb,_0xb500('0xe'));logger[_0xb500('0xf')](_0xb500('0x10'),_0x3d3beb,'request\x20sent',JSON[_0xb500('0x11')](_0x2e0a0d));if(_0x2e0a0d[_0xb500('0x12')]){if(_0x2e0a0d[_0xb500('0x12')][_0xb500('0x13')]===0x1f4){logger[_0xb500('0x12')](_0xb500('0xd'),_0x3d3beb,_0x2e0a0d[_0xb500('0x12')][_0xb500('0x14')]);return _0x5a5b72(_0x2e0a0d[_0xb500('0x12')]['message']);}logger[_0xb500('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x3d3beb,_0x2e0a0d[_0xb500('0x12')][_0xb500('0x14')]);return _0x50f685(_0x2e0a0d[_0xb500('0x12')]['message']);}else{logger[_0xb500('0xc')](_0xb500('0xd'),_0x3d3beb,'request\x20sent');_0x50f685(_0x2e0a0d[_0xb500('0x15')][_0xb500('0x14')]);}})[_0xb500('0x16')](function(_0xd45102){logger[_0xb500('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x3d3beb,_0xd45102);_0x5a5b72(_0xd45102);});});}exports[_0xb500('0x17')]=function(_0x407f03){var _0x1548c8=this;return new Promise(function(_0x17572d,_0x320cb1){return db[_0xb500('0x18')][_0xb500('0x19')]({'raw':_0x407f03[_0xb500('0x1a')]?_0x407f03[_0xb500('0x1a')][_0xb500('0x1b')]===undefined?!![]:![]:!![],'where':_0x407f03['options']?_0x407f03[_0xb500('0x1a')][_0xb500('0x1c')]||null:null,'attributes':_0x407f03[_0xb500('0x1a')]?_0x407f03[_0xb500('0x1a')]['attributes']||null:null,'limit':_0x407f03[_0xb500('0x1a')]?_0x407f03[_0xb500('0x1a')][_0xb500('0x1d')]||null:null,'include':_0x407f03[_0xb500('0x1a')]?_0x407f03[_0xb500('0x1a')]['include']?_[_0xb500('0x1e')](_0x407f03[_0xb500('0x1a')][_0xb500('0x1f')],function(_0x1f31d3){return{'model':db[_0x1f31d3[_0xb500('0x20')]],'as':_0x1f31d3['as'],'attributes':_0x1f31d3[_0xb500('0x21')],'include':_0x1f31d3[_0xb500('0x1f')]?_[_0xb500('0x1e')](_0x1f31d3['include'],function(_0x1be2e2){return{'model':db[_0x1be2e2[_0xb500('0x20')]],'as':_0x1be2e2['as'],'attributes':_0x1be2e2['attributes'],'include':_0x1be2e2[_0xb500('0x1f')]?_[_0xb500('0x1e')](_0x1be2e2['include'],function(_0x2208fa){return{'model':db[_0x2208fa[_0xb500('0x20')]],'as':_0x2208fa['as'],'attributes':_0x2208fa[_0xb500('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb500('0xb')](function(_0x37fa7){logger[_0xb500('0xc')]('GetDynamics365Account',_0x407f03);logger[_0xb500('0xf')]('GetDynamics365Account',_0x407f03,JSON['stringify'](_0x37fa7));_0x17572d(_0x37fa7);})['catch'](function(_0x4557fe){logger[_0xb500('0x12')](_0xb500('0x17'),_0x4557fe[_0xb500('0x14')],_0x407f03);_0x320cb1(_0x1548c8[_0xb500('0x12')](0x1f4,_0x4557fe[_0xb500('0x14')]));});});};exports[_0xb500('0x22')]=function(_0x488247){var _0x263b71=this;return new Promise(function(_0x53f390,_0x26244a){return db['Dynamics365Account'][_0xb500('0x23')]({'raw':_0x488247[_0xb500('0x1a')]?_0x488247['options'][_0xb500('0x1b')]===undefined?!![]:![]:!![],'where':_0x488247[_0xb500('0x1a')]?_0x488247['options'][_0xb500('0x1c')]||null:null,'attributes':_0x488247[_0xb500('0x1a')]?_0x488247[_0xb500('0x1a')]['attributes']||null:null,'include':_0x488247[_0xb500('0x1a')]?_0x488247[_0xb500('0x1a')]['include']?_[_0xb500('0x1e')](_0x488247[_0xb500('0x1a')][_0xb500('0x1f')],function(_0x1b6474){return{'model':db[_0x1b6474[_0xb500('0x20')]],'as':_0x1b6474['as'],'attributes':_0x1b6474[_0xb500('0x21')],'include':_0x1b6474[_0xb500('0x1f')]?_[_0xb500('0x1e')](_0x1b6474[_0xb500('0x1f')],function(_0x337a1c){return{'model':db[_0x337a1c[_0xb500('0x20')]],'as':_0x337a1c['as'],'attributes':_0x337a1c[_0xb500('0x21')],'include':_0x337a1c[_0xb500('0x1f')]?_[_0xb500('0x1e')](_0x337a1c[_0xb500('0x1f')],function(_0x2de59f){return{'model':db[_0x2de59f['model']],'as':_0x2de59f['as'],'attributes':_0x2de59f[_0xb500('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb500('0xb')](function(_0xa3d566){logger[_0xb500('0xc')]('ShowDynamics365Account',_0x488247);logger[_0xb500('0xf')]('ShowDynamics365Account',_0x488247,JSON[_0xb500('0x11')](_0xa3d566));_0x53f390(_0xa3d566);})[_0xb500('0x16')](function(_0x2493e3){logger[_0xb500('0x12')]('ShowDynamics365Account',_0x2493e3[_0xb500('0x14')],_0x488247);_0x26244a(_0x263b71[_0xb500('0x12')](0x1f4,_0x2493e3[_0xb500('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 7d39d1b..78a8645 100644 --- a/server/api/intDynamics365Configuration/index.js +++ b/server/api/intDynamics365Configuration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x43ac=['delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x2bc57e,_0xd450d7){var _0x5561fb=function(_0x3b84d7){while(--_0x3b84d7){_0x2bc57e['push'](_0x2bc57e['shift']());}};_0x5561fb(++_0xd450d7);}(_0x43ac,0x6f));var _0xc43a=function(_0x48903c,_0x185c90){_0x48903c=_0x48903c-0x0;var _0x32c122=_0x43ac[_0x48903c];return _0x32c122;};'use strict';var multer=require(_0xc43a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc43a('0x1'));var express=require(_0xc43a('0x2'));var router=express['Router']();var auth=require(_0xc43a('0x3'));var interaction=require(_0xc43a('0x4'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0xc43a('0x5')]('/',auth['isAuthenticated'](),controller[_0xc43a('0x6')]);router[_0xc43a('0x5')](_0xc43a('0x7'),auth[_0xc43a('0x8')](),controller['show']);router['get']('/:id/fields',auth[_0xc43a('0x8')](),controller['getFields']);router['get'](_0xc43a('0x9'),auth[_0xc43a('0x8')](),controller['getSubjects']);router[_0xc43a('0x5')](_0xc43a('0xa'),auth[_0xc43a('0x8')](),controller[_0xc43a('0xb')]);router[_0xc43a('0xc')]('/',auth[_0xc43a('0x8')](),controller[_0xc43a('0xd')]);router[_0xc43a('0xe')](_0xc43a('0x7'),auth[_0xc43a('0x8')](),controller['update']);router[_0xc43a('0xf')](_0xc43a('0x7'),auth[_0xc43a('0x8')](),controller[_0xc43a('0x10')]);module[_0xc43a('0x11')]=router; \ No newline at end of file +var _0xf278=['getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/:id','/:id/fields','isAuthenticated','getFields','/:id/subjects'];(function(_0x2ce92d,_0x31aa5e){var _0x3feeaf=function(_0x5dc702){while(--_0x5dc702){_0x2ce92d['push'](_0x2ce92d['shift']());}};_0x3feeaf(++_0x31aa5e);}(_0xf278,0x106));var _0x8f27=function(_0x1ce7cf,_0x1706be){_0x1ce7cf=_0x1ce7cf-0x0;var _0x38fe5a=_0xf278[_0x1ce7cf];return _0x38fe5a;};'use strict';var multer=require(_0x8f27('0x0'));var util=require('util');var path=require(_0x8f27('0x1'));var timeout=require(_0x8f27('0x2'));var express=require(_0x8f27('0x3'));var router=express[_0x8f27('0x4')]();var auth=require(_0x8f27('0x5'));var interaction=require(_0x8f27('0x6'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0x8f27('0x7')]('/',auth['isAuthenticated'](),controller[_0x8f27('0x8')]);router[_0x8f27('0x7')](_0x8f27('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x8f27('0x7')](_0x8f27('0xa'),auth[_0x8f27('0xb')](),controller[_0x8f27('0xc')]);router[_0x8f27('0x7')](_0x8f27('0xd'),auth[_0x8f27('0xb')](),controller[_0x8f27('0xe')]);router['get'](_0x8f27('0xf'),auth[_0x8f27('0xb')](),controller[_0x8f27('0x10')]);router[_0x8f27('0x11')]('/',auth[_0x8f27('0xb')](),controller['create']);router[_0x8f27('0x12')](_0x8f27('0x9'),auth[_0x8f27('0xb')](),controller[_0x8f27('0x13')]);router[_0x8f27('0x14')](_0x8f27('0x9'),auth[_0x8f27('0xb')](),controller[_0x8f27('0x15')]);module[_0x8f27('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 08e4159..db7260a 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e16=['exports','STRING','ENUM','incident'];(function(_0x2e937e,_0x925b29){var _0xb9cb1b=function(_0x3fea3a){while(--_0x3fea3a){_0x2e937e['push'](_0x2e937e['shift']());}};_0xb9cb1b(++_0x925b29);}(_0x0e16,0x100));var _0x60e1=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x0e16[_0x3b5250];return _0xc844a1;};'use strict';var Sequelize=require('sequelize');module[_0x60e1('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x60e1('0x1')]},'ticketType':{'type':Sequelize[_0x60e1('0x2')](_0x60e1('0x3'),'phonecall'),'defaultValue':_0x60e1('0x3')}}; \ No newline at end of file +var _0x34f3=['phonecall','exports','STRING'];(function(_0x518296,_0x210e3f){var _0x47b3d0=function(_0x22d452){while(--_0x22d452){_0x518296['push'](_0x518296['shift']());}};_0x47b3d0(++_0x210e3f);}(_0x34f3,0x11b));var _0x334f=function(_0xdd6bd1,_0x3b8e01){_0xdd6bd1=_0xdd6bd1-0x0;var _0x4b81a9=_0x34f3[_0xdd6bd1];return _0x4b81a9;};'use strict';var Sequelize=require('sequelize');module[_0x334f('0x0')]={'name':{'type':Sequelize[_0x334f('0x1')]},'description':{'type':Sequelize[_0x334f('0x1')]},'ticketType':{'type':Sequelize['ENUM']('incident',_0x334f('0x2')),'defaultValue':'incident'}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 6941d1e..f0744b2 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0972=['params','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','result','catch','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','Dynamics365Configuration','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','key','VIRTUAL','field','filter','options','count','include','findAll','rows','includeAll','find','create','body'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x0972,0x64));var _0x2097=function(_0x3841dc,_0x53241b){_0x3841dc=_0x3841dc-0x0;var _0x3d5c7b=_0x0972[_0x3841dc];return _0x3d5c7b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2097('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2097('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2097('0x2'));var moment=require(_0x2097('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2097('0x4'));var util=require(_0x2097('0x5'));var path=require(_0x2097('0x6'));var sox=require(_0x2097('0x7'));var csv=require(_0x2097('0x8'));var ejs=require(_0x2097('0x9'));var fs=require('fs');var _=require(_0x2097('0xa'));var squel=require('squel');var crypto=require(_0x2097('0xb'));var jsforce=require(_0x2097('0xc'));var deskjs=require(_0x2097('0xd'));var toCsv=require(_0x2097('0x8'));var querystring=require(_0x2097('0xe'));var Papa=require('papaparse');var authService=require(_0x2097('0xf'));var hardwareService=require(_0x2097('0x10'));var Redis=require(_0x2097('0x11'));var qs=require(_0x2097('0x12'));var logger=require(_0x2097('0x13'))(_0x2097('0x14'));var utils=require(_0x2097('0x15'));var config=require(_0x2097('0x16'));var db=require(_0x2097('0x17'))['db'];var jayson=require(_0x2097('0x18'));var client=jayson[_0x2097('0x19')][_0x2097('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x170005,_0x16871b,_0x24ca42,_0x3e3fdc){return new BPromise(function(_0x185be8,_0x1c9ef9){var _0x2c3e41=_0x3e3fdc||client;return _0x2c3e41[_0x2097('0x1b')](_0x170005,_0x24ca42)['then'](function(_0x639c14){logger[_0x2097('0x1c')]('Dynamics365Configuration,\x20%s,\x20%s',_0x16871b,'request\x20sent');logger['debug'](_0x2097('0x1d'),_0x16871b,'request\x20sent',JSON[_0x2097('0x1e')](_0x639c14));if(_0x639c14[_0x2097('0x1f')]){if(_0x639c14[_0x2097('0x1f')][_0x2097('0x20')]===0x1f4){logger[_0x2097('0x1f')]('Dynamics365Configuration,\x20%s,\x20%s',_0x16871b,_0x639c14[_0x2097('0x1f')][_0x2097('0x21')]);return _0x1c9ef9(_0x639c14[_0x2097('0x1f')][_0x2097('0x21')]);}logger[_0x2097('0x1f')](_0x2097('0x22'),_0x16871b,_0x639c14[_0x2097('0x1f')][_0x2097('0x21')]);return _0x185be8(_0x639c14['error']['message']);}else{logger[_0x2097('0x1c')]('Dynamics365Configuration,\x20%s,\x20%s',_0x16871b,_0x2097('0x23'));_0x185be8(_0x639c14[_0x2097('0x24')]['message']);}})[_0x2097('0x25')](function(_0x5b0582){logger[_0x2097('0x1f')](_0x2097('0x22'),_0x16871b,_0x5b0582);_0x1c9ef9(_0x5b0582);});});}function respondWithStatusCode(_0x36189e,_0x20b93a){_0x20b93a=_0x20b93a||0xcc;return function(_0x36b15e){if(_0x36b15e){return _0x36189e[_0x2097('0x26')](_0x20b93a);}return _0x36189e['status'](_0x20b93a)[_0x2097('0x27')]();};}function respondWithResult(_0x500234,_0x3f9279){_0x3f9279=_0x3f9279||0xc8;return function(_0x32405b){if(_0x32405b){return _0x500234[_0x2097('0x28')](_0x3f9279)[_0x2097('0x29')](_0x32405b);}};}function respondWithFilteredResult(_0x499988,_0x2d683a){return function(_0x80c5ee){if(_0x80c5ee){var _0x56af3b=_0x80c5ee['count'],_0x1229fc=_0x2d683a[_0x2097('0x2a')],_0x5ed0fa=_0x2d683a[_0x2097('0x2a')]+_0x2d683a[_0x2097('0x2b')],_0x29b879;if(_0x5ed0fa>=_0x56af3b){_0x5ed0fa=_0x56af3b;_0x29b879=0xc8;}else{_0x29b879=0xce;}_0x499988[_0x2097('0x28')](_0x29b879);return _0x499988[_0x2097('0x2c')](_0x2097('0x2d'),_0x1229fc+'-'+_0x5ed0fa+'/'+_0x56af3b)[_0x2097('0x29')](_0x80c5ee);}return null;};}function patchUpdates(_0x4b443d){return function(_0x11242f){try{jsonpatch[_0x2097('0x2e')](_0x11242f,_0x4b443d,!![]);}catch(_0x5cce55){return BPromise[_0x2097('0x2f')](_0x5cce55);}return _0x11242f[_0x2097('0x30')]();};}function saveUpdates(_0x59fb84,_0x4d0916){return function(_0x312c77){if(_0x312c77){return _0x312c77[_0x2097('0x31')](_0x59fb84)[_0x2097('0x32')](function(_0x3589bb){return _0x3589bb;});}return null;};}function removeEntity(_0x74ccdc,_0x180654){return function(_0x56c538){if(_0x56c538){return _0x56c538[_0x2097('0x33')]()['then'](function(){_0x74ccdc[_0x2097('0x28')](0xcc)[_0x2097('0x27')]();});}};}function handleEntityNotFound(_0x2bc39c,_0x1e8af9){return function(_0x44e398){if(!_0x44e398){_0x2bc39c[_0x2097('0x26')](0x194);}return _0x44e398;};}function handleError(_0x9bc312,_0x455cf7){_0x455cf7=_0x455cf7||0x1f4;return function(_0x2701bc){logger['error'](_0x2701bc[_0x2097('0x34')]);if(_0x2701bc[_0x2097('0x35')]){delete _0x2701bc[_0x2097('0x35')];}_0x9bc312['status'](_0x455cf7)[_0x2097('0x36')](_0x2701bc);};}exports[_0x2097('0x37')]=function(_0x3c2fa6,_0x396162){var _0x542a52={},_0x50b101={},_0x5689f6={'count':0x0,'rows':[]};var _0x3484ff=db[_0x2097('0x38')][_0x2097('0x39')];_0x50b101[_0x2097('0x3a')]=_[_0x2097('0x3b')](_0x3484ff);_0x50b101[_0x2097('0x3c')]=_['keys'](_0x3c2fa6[_0x2097('0x3c')]);_0x50b101[_0x2097('0x3d')]=_[_0x2097('0x3e')](_0x50b101[_0x2097('0x3a')],_0x50b101[_0x2097('0x3c')]);_0x542a52[_0x2097('0x3f')]=_['intersection'](_0x50b101[_0x2097('0x3a')],qs[_0x2097('0x40')](_0x3c2fa6[_0x2097('0x3c')]['fields']));_0x542a52['attributes']=_0x542a52[_0x2097('0x3f')][_0x2097('0x41')]?_0x542a52[_0x2097('0x3f')]:_0x50b101[_0x2097('0x3a')];if(!_0x3c2fa6[_0x2097('0x3c')][_0x2097('0x42')](_0x2097('0x43'))){_0x542a52[_0x2097('0x2b')]=qs[_0x2097('0x2b')](_0x3c2fa6[_0x2097('0x3c')][_0x2097('0x2b')]);_0x542a52[_0x2097('0x2a')]=qs['offset'](_0x3c2fa6[_0x2097('0x3c')][_0x2097('0x2a')]);}_0x542a52[_0x2097('0x44')]=qs['sort'](_0x3c2fa6[_0x2097('0x3c')][_0x2097('0x45')]);_0x542a52[_0x2097('0x46')]=qs[_0x2097('0x3d')](_[_0x2097('0x47')](_0x3c2fa6[_0x2097('0x3c')],_0x50b101[_0x2097('0x3d')]));if(_0x3c2fa6[_0x2097('0x3c')]['filter']){_0x542a52[_0x2097('0x46')]=_[_0x2097('0x48')](_0x542a52[_0x2097('0x46')],{'$or':_[_0x2097('0x49')](_0x3484ff,function(_0x12e0e2){if(_0x12e0e2[_0x2097('0x4a')][_0x2097('0x4b')]!==_0x2097('0x4c')){var _0x5de317={};_0x5de317[_0x12e0e2[_0x2097('0x4d')]]={'$like':'%'+_0x3c2fa6['query'][_0x2097('0x4e')]+'%'};return _0x5de317;}})});}_0x542a52=_[_0x2097('0x48')]({},_0x542a52,_0x3c2fa6[_0x2097('0x4f')]);var _0x1e1499={'where':_0x542a52[_0x2097('0x46')]};return db['Dynamics365Configuration'][_0x2097('0x50')](_0x1e1499)[_0x2097('0x32')](function(_0x113c3b){_0x5689f6[_0x2097('0x50')]=_0x113c3b;if(_0x3c2fa6[_0x2097('0x3c')]['includeAll']){_0x542a52[_0x2097('0x51')]=[{'all':!![]}];}return db[_0x2097('0x38')][_0x2097('0x52')](_0x542a52);})[_0x2097('0x32')](function(_0xd90601){_0x5689f6[_0x2097('0x53')]=_0xd90601;return _0x5689f6;})[_0x2097('0x32')](respondWithFilteredResult(_0x396162,_0x542a52))[_0x2097('0x25')](handleError(_0x396162,null));};exports['show']=function(_0x6f9c8,_0x594804){var _0x305657={'raw':![],'where':{'id':_0x6f9c8['params']['id']}},_0xfe13c8={};_0xfe13c8['model']=_['keys'](db[_0x2097('0x38')][_0x2097('0x39')]);_0xfe13c8['query']=_[_0x2097('0x3b')](_0x6f9c8[_0x2097('0x3c')]);_0xfe13c8['filters']=_['intersection'](_0xfe13c8[_0x2097('0x3a')],_0xfe13c8[_0x2097('0x3c')]);_0x305657[_0x2097('0x3f')]=_['intersection'](_0xfe13c8[_0x2097('0x3a')],qs[_0x2097('0x40')](_0x6f9c8['query'][_0x2097('0x40')]));_0x305657[_0x2097('0x3f')]=_0x305657[_0x2097('0x3f')][_0x2097('0x41')]?_0x305657[_0x2097('0x3f')]:_0xfe13c8['model'];if(_0x6f9c8['query'][_0x2097('0x54')]){_0x305657[_0x2097('0x51')]=[{'all':!![]}];}_0x305657=_[_0x2097('0x48')]({},_0x305657,_0x6f9c8['options']);return db['Dynamics365Configuration'][_0x2097('0x55')](_0x305657)[_0x2097('0x32')](handleEntityNotFound(_0x594804,null))['then'](respondWithResult(_0x594804,null))[_0x2097('0x25')](handleError(_0x594804,null));};exports[_0x2097('0x56')]=function(_0x12bdbd,_0x33490e){return db[_0x2097('0x38')]['create'](_0x12bdbd[_0x2097('0x57')],{})[_0x2097('0x32')](respondWithResult(_0x33490e,0xc9))[_0x2097('0x25')](handleError(_0x33490e,null));};exports['update']=function(_0x4a25e2,_0xdf72c7){if(_0x4a25e2['body']['id']){delete _0x4a25e2[_0x2097('0x57')]['id'];}return db['Dynamics365Configuration'][_0x2097('0x55')]({'where':{'id':_0x4a25e2['params']['id']}})['then'](handleEntityNotFound(_0xdf72c7,null))['then'](saveUpdates(_0x4a25e2[_0x2097('0x57')],null))['then'](respondWithResult(_0xdf72c7,null))['catch'](handleError(_0xdf72c7,null));};exports[_0x2097('0x33')]=function(_0x52af14,_0x597322){return db[_0x2097('0x38')]['find']({'where':{'id':_0x52af14[_0x2097('0x58')]['id']}})[_0x2097('0x32')](handleEntityNotFound(_0x597322,null))[_0x2097('0x32')](removeEntity(_0x597322,null))[_0x2097('0x25')](handleError(_0x597322,null));};exports[_0x2097('0x59')]=function(_0x58d661,_0x2117e3,_0x49e315){var _0xe2a2af={};var _0x140e43={};var _0x24f166;var _0x55e3cd;return db[_0x2097('0x38')][_0x2097('0x5a')]({'where':{'id':_0x58d661[_0x2097('0x58')]['id']}})[_0x2097('0x32')](handleEntityNotFound(_0x2117e3,null))[_0x2097('0x32')](function(_0x56cfbf){if(_0x56cfbf){_0x24f166=_0x56cfbf;_0x140e43['model']=_[_0x2097('0x3b')](db[_0x2097('0x5b')]['rawAttributes']);_0x140e43['query']=_['keys'](_0x58d661['query']);_0x140e43[_0x2097('0x3d')]=_['intersection'](_0x140e43[_0x2097('0x3a')],_0x140e43[_0x2097('0x3c')]);_0xe2a2af['attributes']=_[_0x2097('0x3e')](_0x140e43[_0x2097('0x3a')],qs[_0x2097('0x40')](_0x58d661[_0x2097('0x3c')][_0x2097('0x40')]));_0xe2a2af[_0x2097('0x3f')]=_0xe2a2af[_0x2097('0x3f')][_0x2097('0x41')]?_0xe2a2af[_0x2097('0x3f')]:_0x140e43['model'];_0xe2a2af[_0x2097('0x44')]=qs[_0x2097('0x45')](_0x58d661[_0x2097('0x3c')][_0x2097('0x45')]);_0xe2a2af[_0x2097('0x46')]=qs[_0x2097('0x3d')](_['pick'](_0x58d661[_0x2097('0x3c')],_0x140e43[_0x2097('0x3d')]));if(_0x58d661[_0x2097('0x3c')][_0x2097('0x4e')]){_0xe2a2af[_0x2097('0x46')]=_['merge'](_0xe2a2af[_0x2097('0x46')],{'$or':_[_0x2097('0x49')](_0xe2a2af['attributes'],function(_0x4d053f){var _0x580c1e={};_0x580c1e[_0x4d053f]={'$like':'%'+_0x58d661[_0x2097('0x3c')][_0x2097('0x4e')]+'%'};return _0x580c1e;})});}_0xe2a2af=_[_0x2097('0x48')]({},_0xe2a2af,_0x58d661[_0x2097('0x4f')]);return _0x24f166[_0x2097('0x59')](_0xe2a2af);}})[_0x2097('0x32')](function(_0x2e287b){if(_0x2e287b){_0x55e3cd=_0x2e287b[_0x2097('0x41')];if(!_0x58d661[_0x2097('0x3c')]['hasOwnProperty']('nolimit')){_0xe2a2af[_0x2097('0x2b')]=qs[_0x2097('0x2b')](_0x58d661[_0x2097('0x3c')][_0x2097('0x2b')]);_0xe2a2af[_0x2097('0x2a')]=qs[_0x2097('0x2a')](_0x58d661['query'][_0x2097('0x2a')]);}return _0x24f166[_0x2097('0x59')](_0xe2a2af);}})[_0x2097('0x32')](function(_0x3255b6){if(_0x3255b6){return _0x3255b6?{'count':_0x55e3cd,'rows':_0x3255b6}:null;}})['then'](respondWithResult(_0x2117e3,null))['catch'](handleError(_0x2117e3,null));};exports[_0x2097('0x5c')]=function(_0x345a12,_0x487f1f,_0x3707da){var _0x426290={};var _0x17551b={};var _0x17fd21;var _0x1f824f;return db[_0x2097('0x38')][_0x2097('0x5a')]({'where':{'id':_0x345a12[_0x2097('0x58')]['id']}})['then'](handleEntityNotFound(_0x487f1f,null))[_0x2097('0x32')](function(_0x283e2b){if(_0x283e2b){_0x17fd21=_0x283e2b;_0x17551b['model']=_[_0x2097('0x3b')](db[_0x2097('0x5b')][_0x2097('0x39')]);_0x17551b[_0x2097('0x3c')]=_[_0x2097('0x3b')](_0x345a12[_0x2097('0x3c')]);_0x17551b[_0x2097('0x3d')]=_[_0x2097('0x3e')](_0x17551b[_0x2097('0x3a')],_0x17551b[_0x2097('0x3c')]);_0x426290[_0x2097('0x3f')]=_['intersection'](_0x17551b[_0x2097('0x3a')],qs[_0x2097('0x40')](_0x345a12[_0x2097('0x3c')][_0x2097('0x40')]));_0x426290[_0x2097('0x3f')]=_0x426290['attributes'][_0x2097('0x41')]?_0x426290[_0x2097('0x3f')]:_0x17551b[_0x2097('0x3a')];_0x426290['order']=qs[_0x2097('0x45')](_0x345a12['query'][_0x2097('0x45')]);_0x426290['where']=qs[_0x2097('0x3d')](_['pick'](_0x345a12[_0x2097('0x3c')],_0x17551b['filters']));if(_0x345a12[_0x2097('0x3c')][_0x2097('0x4e')]){_0x426290[_0x2097('0x46')]=_[_0x2097('0x48')](_0x426290[_0x2097('0x46')],{'$or':_['map'](_0x426290[_0x2097('0x3f')],function(_0x2ad797){var _0x933df2={};_0x933df2[_0x2ad797]={'$like':'%'+_0x345a12[_0x2097('0x3c')][_0x2097('0x4e')]+'%'};return _0x933df2;})});}_0x426290=_[_0x2097('0x48')]({},_0x426290,_0x345a12[_0x2097('0x4f')]);return _0x17fd21[_0x2097('0x5c')](_0x426290);}})[_0x2097('0x32')](function(_0x367e8f){if(_0x367e8f){_0x1f824f=_0x367e8f[_0x2097('0x41')];if(!_0x345a12[_0x2097('0x3c')][_0x2097('0x42')](_0x2097('0x43'))){_0x426290[_0x2097('0x2b')]=qs[_0x2097('0x2b')](_0x345a12['query'][_0x2097('0x2b')]);_0x426290['offset']=qs['offset'](_0x345a12[_0x2097('0x3c')][_0x2097('0x2a')]);}return _0x17fd21[_0x2097('0x5c')](_0x426290);}})['then'](function(_0x34b687){if(_0x34b687){return _0x34b687?{'count':_0x1f824f,'rows':_0x34b687}:null;}})[_0x2097('0x32')](respondWithResult(_0x487f1f,null))[_0x2097('0x25')](handleError(_0x487f1f,null));};exports[_0x2097('0x5d')]=function(_0x568a15,_0x370005,_0x5088a2){var _0x41caa9={};var _0x385551={};var _0x2619db;var _0x1e380e;return db['Dynamics365Configuration'][_0x2097('0x5a')]({'where':{'id':_0x568a15[_0x2097('0x58')]['id']}})[_0x2097('0x32')](handleEntityNotFound(_0x370005,null))['then'](function(_0x427b3c){if(_0x427b3c){_0x2619db=_0x427b3c;_0x385551[_0x2097('0x3a')]=_[_0x2097('0x3b')](db['Dynamics365Field'][_0x2097('0x39')]);_0x385551[_0x2097('0x3c')]=_[_0x2097('0x3b')](_0x568a15[_0x2097('0x3c')]);_0x385551[_0x2097('0x3d')]=_[_0x2097('0x3e')](_0x385551['model'],_0x385551['query']);_0x41caa9[_0x2097('0x3f')]=_[_0x2097('0x3e')](_0x385551[_0x2097('0x3a')],qs[_0x2097('0x40')](_0x568a15[_0x2097('0x3c')][_0x2097('0x40')]));_0x41caa9['attributes']=_0x41caa9[_0x2097('0x3f')][_0x2097('0x41')]?_0x41caa9[_0x2097('0x3f')]:_0x385551[_0x2097('0x3a')];_0x41caa9[_0x2097('0x44')]=qs[_0x2097('0x45')](_0x568a15[_0x2097('0x3c')]['sort']);_0x41caa9[_0x2097('0x46')]=qs[_0x2097('0x3d')](_[_0x2097('0x47')](_0x568a15[_0x2097('0x3c')],_0x385551[_0x2097('0x3d')]));if(_0x568a15[_0x2097('0x3c')]['filter']){_0x41caa9['where']=_[_0x2097('0x48')](_0x41caa9['where'],{'$or':_['map'](_0x41caa9[_0x2097('0x3f')],function(_0x146470){var _0x11dc74={};_0x11dc74[_0x146470]={'$like':'%'+_0x568a15[_0x2097('0x3c')][_0x2097('0x4e')]+'%'};return _0x11dc74;})});}_0x41caa9=_[_0x2097('0x48')]({},_0x41caa9,_0x568a15[_0x2097('0x4f')]);return _0x2619db[_0x2097('0x5d')](_0x41caa9);}})['then'](function(_0x38e5de){if(_0x38e5de){_0x1e380e=_0x38e5de[_0x2097('0x41')];if(!_0x568a15[_0x2097('0x3c')][_0x2097('0x42')](_0x2097('0x43'))){_0x41caa9['limit']=qs[_0x2097('0x2b')](_0x568a15[_0x2097('0x3c')][_0x2097('0x2b')]);_0x41caa9[_0x2097('0x2a')]=qs[_0x2097('0x2a')](_0x568a15[_0x2097('0x3c')]['offset']);}return _0x2619db[_0x2097('0x5d')](_0x41caa9);}})[_0x2097('0x32')](function(_0x4c0a41){if(_0x4c0a41){return _0x4c0a41?{'count':_0x1e380e,'rows':_0x4c0a41}:null;}})['then'](respondWithResult(_0x370005,null))['catch'](handleError(_0x370005,null));}; \ No newline at end of file +var _0x93e6=['model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','map','type','VIRTUAL','field','filter','options','Dynamics365Configuration','includeAll','include','findAll','rows','show','create','body','update','find','params','getFields','findOne','Dynamics365Field','nolimit','getSubjects','getDescriptions','html-pdf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','jsforce','querystring','papaparse','../../config/license/hardware','../../components/parsers/qs','api','../../mysqldb','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','json','count','offset','limit','set','Content-Range','save','then','destroy','sendStatus','stack','name','send','rawAttributes'];(function(_0xee7e65,_0x4fb2aa){var _0x3dfe75=function(_0x3a0d2c){while(--_0x3a0d2c){_0xee7e65['push'](_0xee7e65['shift']());}};_0x3dfe75(++_0x4fb2aa);}(_0x93e6,0x11e));var _0x693e=function(_0x57105b,_0xc60612){_0x57105b=_0x57105b-0x0;var _0x1f971f=_0x93e6[_0x57105b];return _0x1f971f;};'use strict';var pdf=require(_0x693e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x693e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x693e('0x2'));var moment=require('moment');var BPromise=require(_0x693e('0x3'));var Mustache=require(_0x693e('0x4'));var util=require(_0x693e('0x5'));var path=require('path');var sox=require(_0x693e('0x6'));var csv=require(_0x693e('0x7'));var ejs=require(_0x693e('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x693e('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x693e('0x7'));var querystring=require(_0x693e('0xa'));var Papa=require(_0x693e('0xb'));var authService=require('../../components/auth/service');var hardwareService=require(_0x693e('0xc'));var Redis=require('ioredis');var qs=require(_0x693e('0xd'));var logger=require('../../config/logger')(_0x693e('0xe'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x693e('0xf'))['db'];var jayson=require(_0x693e('0x10'));var client=jayson[_0x693e('0x11')][_0x693e('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x5bc8a3,_0x256143,_0x172b79,_0x25c4a7){return new BPromise(function(_0x43ac1a,_0x3f5b16){var _0x2d8e11=_0x25c4a7||client;return _0x2d8e11[_0x693e('0x13')](_0x5bc8a3,_0x172b79)['then'](function(_0x3a696c){logger[_0x693e('0x14')](_0x693e('0x15'),_0x256143,'request\x20sent');logger[_0x693e('0x16')](_0x693e('0x17'),_0x256143,_0x693e('0x18'),JSON[_0x693e('0x19')](_0x3a696c));if(_0x3a696c[_0x693e('0x1a')]){if(_0x3a696c[_0x693e('0x1a')][_0x693e('0x1b')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x256143,_0x3a696c['error'][_0x693e('0x1c')]);return _0x3f5b16(_0x3a696c[_0x693e('0x1a')]['message']);}logger['error'](_0x693e('0x15'),_0x256143,_0x3a696c[_0x693e('0x1a')][_0x693e('0x1c')]);return _0x43ac1a(_0x3a696c[_0x693e('0x1a')]['message']);}else{logger[_0x693e('0x14')](_0x693e('0x15'),_0x256143,_0x693e('0x18'));_0x43ac1a(_0x3a696c['result'][_0x693e('0x1c')]);}})[_0x693e('0x1d')](function(_0x569646){logger[_0x693e('0x1a')](_0x693e('0x15'),_0x256143,_0x569646);_0x3f5b16(_0x569646);});});}function respondWithStatusCode(_0x5850e8,_0x270bb5){_0x270bb5=_0x270bb5||0xcc;return function(_0x2c9340){if(_0x2c9340){return _0x5850e8['sendStatus'](_0x270bb5);}return _0x5850e8[_0x693e('0x1e')](_0x270bb5)[_0x693e('0x1f')]();};}function respondWithResult(_0x1fd85,_0x32b552){_0x32b552=_0x32b552||0xc8;return function(_0x36e00f){if(_0x36e00f){return _0x1fd85[_0x693e('0x1e')](_0x32b552)[_0x693e('0x20')](_0x36e00f);}};}function respondWithFilteredResult(_0x13fcb9,_0x2225f4){return function(_0xafd062){if(_0xafd062){var _0x761568=_0xafd062[_0x693e('0x21')],_0x17cbb6=_0x2225f4[_0x693e('0x22')],_0x232883=_0x2225f4[_0x693e('0x22')]+_0x2225f4[_0x693e('0x23')],_0x2dd4aa;if(_0x232883>=_0x761568){_0x232883=_0x761568;_0x2dd4aa=0xc8;}else{_0x2dd4aa=0xce;}_0x13fcb9['status'](_0x2dd4aa);return _0x13fcb9[_0x693e('0x24')](_0x693e('0x25'),_0x17cbb6+'-'+_0x232883+'/'+_0x761568)[_0x693e('0x20')](_0xafd062);}return null;};}function patchUpdates(_0x3d350b){return function(_0x26b9c4){try{jsonpatch['apply'](_0x26b9c4,_0x3d350b,!![]);}catch(_0x207fc4){return BPromise['reject'](_0x207fc4);}return _0x26b9c4[_0x693e('0x26')]();};}function saveUpdates(_0x588cd0,_0x279c2e){return function(_0x19e04f){if(_0x19e04f){return _0x19e04f['update'](_0x588cd0)[_0x693e('0x27')](function(_0x2b47e7){return _0x2b47e7;});}return null;};}function removeEntity(_0x4c3bc4,_0xd45e41){return function(_0x17b41e){if(_0x17b41e){return _0x17b41e[_0x693e('0x28')]()[_0x693e('0x27')](function(){_0x4c3bc4[_0x693e('0x1e')](0xcc)[_0x693e('0x1f')]();});}};}function handleEntityNotFound(_0x2f0b40,_0x31c8e9){return function(_0x2a4d59){if(!_0x2a4d59){_0x2f0b40[_0x693e('0x29')](0x194);}return _0x2a4d59;};}function handleError(_0x39d167,_0xa29158){_0xa29158=_0xa29158||0x1f4;return function(_0x46b3e7){logger[_0x693e('0x1a')](_0x46b3e7[_0x693e('0x2a')]);if(_0x46b3e7[_0x693e('0x2b')]){delete _0x46b3e7[_0x693e('0x2b')];}_0x39d167[_0x693e('0x1e')](_0xa29158)[_0x693e('0x2c')](_0x46b3e7);};}exports['index']=function(_0x2ee30a,_0x40b836){var _0x5b2844={},_0x2c9e4a={},_0x1c2693={'count':0x0,'rows':[]};var _0x4ac412=db['Dynamics365Configuration'][_0x693e('0x2d')];_0x2c9e4a[_0x693e('0x2e')]=_[_0x693e('0x2f')](_0x4ac412);_0x2c9e4a[_0x693e('0x30')]=_[_0x693e('0x2f')](_0x2ee30a[_0x693e('0x30')]);_0x2c9e4a[_0x693e('0x31')]=_[_0x693e('0x32')](_0x2c9e4a['model'],_0x2c9e4a[_0x693e('0x30')]);_0x5b2844[_0x693e('0x33')]=_['intersection'](_0x2c9e4a[_0x693e('0x2e')],qs[_0x693e('0x34')](_0x2ee30a[_0x693e('0x30')][_0x693e('0x34')]));_0x5b2844[_0x693e('0x33')]=_0x5b2844[_0x693e('0x33')][_0x693e('0x35')]?_0x5b2844['attributes']:_0x2c9e4a[_0x693e('0x2e')];if(!_0x2ee30a[_0x693e('0x30')][_0x693e('0x36')]('nolimit')){_0x5b2844[_0x693e('0x23')]=qs['limit'](_0x2ee30a[_0x693e('0x30')][_0x693e('0x23')]);_0x5b2844['offset']=qs['offset'](_0x2ee30a[_0x693e('0x30')][_0x693e('0x22')]);}_0x5b2844[_0x693e('0x37')]=qs[_0x693e('0x38')](_0x2ee30a[_0x693e('0x30')][_0x693e('0x38')]);_0x5b2844[_0x693e('0x39')]=qs[_0x693e('0x31')](_[_0x693e('0x3a')](_0x2ee30a[_0x693e('0x30')],_0x2c9e4a[_0x693e('0x31')]));if(_0x2ee30a[_0x693e('0x30')]['filter']){_0x5b2844['where']=_[_0x693e('0x3b')](_0x5b2844[_0x693e('0x39')],{'$or':_[_0x693e('0x3c')](_0x4ac412,function(_0x461047){if(_0x461047[_0x693e('0x3d')]['key']!==_0x693e('0x3e')){var _0x39c245={};_0x39c245[_0x461047[_0x693e('0x3f')]]={'$like':'%'+_0x2ee30a[_0x693e('0x30')][_0x693e('0x40')]+'%'};return _0x39c245;}})});}_0x5b2844=_[_0x693e('0x3b')]({},_0x5b2844,_0x2ee30a[_0x693e('0x41')]);var _0x261def={'where':_0x5b2844['where']};return db[_0x693e('0x42')]['count'](_0x261def)[_0x693e('0x27')](function(_0x1038a4){_0x1c2693['count']=_0x1038a4;if(_0x2ee30a[_0x693e('0x30')][_0x693e('0x43')]){_0x5b2844[_0x693e('0x44')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x693e('0x45')](_0x5b2844);})[_0x693e('0x27')](function(_0x83f7cd){_0x1c2693[_0x693e('0x46')]=_0x83f7cd;return _0x1c2693;})[_0x693e('0x27')](respondWithFilteredResult(_0x40b836,_0x5b2844))[_0x693e('0x1d')](handleError(_0x40b836,null));};exports[_0x693e('0x47')]=function(_0x30f603,_0x3b3394){var _0x1817eb={'raw':![],'where':{'id':_0x30f603['params']['id']}},_0x53cb87={};_0x53cb87[_0x693e('0x2e')]=_[_0x693e('0x2f')](db[_0x693e('0x42')][_0x693e('0x2d')]);_0x53cb87[_0x693e('0x30')]=_['keys'](_0x30f603[_0x693e('0x30')]);_0x53cb87[_0x693e('0x31')]=_[_0x693e('0x32')](_0x53cb87[_0x693e('0x2e')],_0x53cb87[_0x693e('0x30')]);_0x1817eb[_0x693e('0x33')]=_['intersection'](_0x53cb87[_0x693e('0x2e')],qs[_0x693e('0x34')](_0x30f603[_0x693e('0x30')][_0x693e('0x34')]));_0x1817eb['attributes']=_0x1817eb[_0x693e('0x33')]['length']?_0x1817eb[_0x693e('0x33')]:_0x53cb87[_0x693e('0x2e')];if(_0x30f603[_0x693e('0x30')][_0x693e('0x43')]){_0x1817eb[_0x693e('0x44')]=[{'all':!![]}];}_0x1817eb=_[_0x693e('0x3b')]({},_0x1817eb,_0x30f603[_0x693e('0x41')]);return db[_0x693e('0x42')]['find'](_0x1817eb)['then'](handleEntityNotFound(_0x3b3394,null))[_0x693e('0x27')](respondWithResult(_0x3b3394,null))[_0x693e('0x1d')](handleError(_0x3b3394,null));};exports[_0x693e('0x48')]=function(_0x1fc19f,_0x382781){return db['Dynamics365Configuration'][_0x693e('0x48')](_0x1fc19f[_0x693e('0x49')],{})['then'](respondWithResult(_0x382781,0xc9))[_0x693e('0x1d')](handleError(_0x382781,null));};exports[_0x693e('0x4a')]=function(_0x91028f,_0x40efdd){if(_0x91028f[_0x693e('0x49')]['id']){delete _0x91028f[_0x693e('0x49')]['id'];}return db[_0x693e('0x42')][_0x693e('0x4b')]({'where':{'id':_0x91028f[_0x693e('0x4c')]['id']}})[_0x693e('0x27')](handleEntityNotFound(_0x40efdd,null))[_0x693e('0x27')](saveUpdates(_0x91028f[_0x693e('0x49')],null))[_0x693e('0x27')](respondWithResult(_0x40efdd,null))['catch'](handleError(_0x40efdd,null));};exports['destroy']=function(_0x480702,_0x1fd8f5){return db[_0x693e('0x42')][_0x693e('0x4b')]({'where':{'id':_0x480702[_0x693e('0x4c')]['id']}})[_0x693e('0x27')](handleEntityNotFound(_0x1fd8f5,null))['then'](removeEntity(_0x1fd8f5,null))['catch'](handleError(_0x1fd8f5,null));};exports[_0x693e('0x4d')]=function(_0x1b0932,_0x247efb,_0x44b7e7){var _0x1c8e7e={};var _0x34b377={};var _0x58fe2e;var _0x34a17f;return db[_0x693e('0x42')][_0x693e('0x4e')]({'where':{'id':_0x1b0932[_0x693e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x247efb,null))['then'](function(_0x22c3c6){if(_0x22c3c6){_0x58fe2e=_0x22c3c6;_0x34b377[_0x693e('0x2e')]=_['keys'](db[_0x693e('0x4f')][_0x693e('0x2d')]);_0x34b377[_0x693e('0x30')]=_[_0x693e('0x2f')](_0x1b0932[_0x693e('0x30')]);_0x34b377[_0x693e('0x31')]=_['intersection'](_0x34b377['model'],_0x34b377[_0x693e('0x30')]);_0x1c8e7e[_0x693e('0x33')]=_['intersection'](_0x34b377['model'],qs[_0x693e('0x34')](_0x1b0932[_0x693e('0x30')][_0x693e('0x34')]));_0x1c8e7e[_0x693e('0x33')]=_0x1c8e7e[_0x693e('0x33')][_0x693e('0x35')]?_0x1c8e7e[_0x693e('0x33')]:_0x34b377['model'];_0x1c8e7e[_0x693e('0x37')]=qs[_0x693e('0x38')](_0x1b0932['query']['sort']);_0x1c8e7e[_0x693e('0x39')]=qs[_0x693e('0x31')](_['pick'](_0x1b0932[_0x693e('0x30')],_0x34b377[_0x693e('0x31')]));if(_0x1b0932['query'][_0x693e('0x40')]){_0x1c8e7e[_0x693e('0x39')]=_[_0x693e('0x3b')](_0x1c8e7e[_0x693e('0x39')],{'$or':_[_0x693e('0x3c')](_0x1c8e7e[_0x693e('0x33')],function(_0x2d411b){var _0x366d57={};_0x366d57[_0x2d411b]={'$like':'%'+_0x1b0932[_0x693e('0x30')][_0x693e('0x40')]+'%'};return _0x366d57;})});}_0x1c8e7e=_[_0x693e('0x3b')]({},_0x1c8e7e,_0x1b0932[_0x693e('0x41')]);return _0x58fe2e[_0x693e('0x4d')](_0x1c8e7e);}})[_0x693e('0x27')](function(_0xb7af4d){if(_0xb7af4d){_0x34a17f=_0xb7af4d[_0x693e('0x35')];if(!_0x1b0932[_0x693e('0x30')][_0x693e('0x36')](_0x693e('0x50'))){_0x1c8e7e[_0x693e('0x23')]=qs['limit'](_0x1b0932['query'][_0x693e('0x23')]);_0x1c8e7e[_0x693e('0x22')]=qs[_0x693e('0x22')](_0x1b0932[_0x693e('0x30')]['offset']);}return _0x58fe2e[_0x693e('0x4d')](_0x1c8e7e);}})[_0x693e('0x27')](function(_0x2dab57){if(_0x2dab57){return _0x2dab57?{'count':_0x34a17f,'rows':_0x2dab57}:null;}})[_0x693e('0x27')](respondWithResult(_0x247efb,null))[_0x693e('0x1d')](handleError(_0x247efb,null));};exports[_0x693e('0x51')]=function(_0x4405a3,_0x38674a,_0x338e93){var _0x4d91a8={};var _0x32b95f={};var _0x77feb4;var _0x2e7310;return db[_0x693e('0x42')][_0x693e('0x4e')]({'where':{'id':_0x4405a3[_0x693e('0x4c')]['id']}})[_0x693e('0x27')](handleEntityNotFound(_0x38674a,null))[_0x693e('0x27')](function(_0x56a50e){if(_0x56a50e){_0x77feb4=_0x56a50e;_0x32b95f[_0x693e('0x2e')]=_[_0x693e('0x2f')](db['Dynamics365Field'][_0x693e('0x2d')]);_0x32b95f[_0x693e('0x30')]=_['keys'](_0x4405a3['query']);_0x32b95f['filters']=_[_0x693e('0x32')](_0x32b95f['model'],_0x32b95f[_0x693e('0x30')]);_0x4d91a8[_0x693e('0x33')]=_['intersection'](_0x32b95f[_0x693e('0x2e')],qs[_0x693e('0x34')](_0x4405a3[_0x693e('0x30')][_0x693e('0x34')]));_0x4d91a8[_0x693e('0x33')]=_0x4d91a8[_0x693e('0x33')]['length']?_0x4d91a8[_0x693e('0x33')]:_0x32b95f[_0x693e('0x2e')];_0x4d91a8[_0x693e('0x37')]=qs[_0x693e('0x38')](_0x4405a3[_0x693e('0x30')][_0x693e('0x38')]);_0x4d91a8['where']=qs['filters'](_[_0x693e('0x3a')](_0x4405a3['query'],_0x32b95f[_0x693e('0x31')]));if(_0x4405a3[_0x693e('0x30')][_0x693e('0x40')]){_0x4d91a8['where']=_[_0x693e('0x3b')](_0x4d91a8['where'],{'$or':_[_0x693e('0x3c')](_0x4d91a8[_0x693e('0x33')],function(_0x4c5f8f){var _0xbc477d={};_0xbc477d[_0x4c5f8f]={'$like':'%'+_0x4405a3[_0x693e('0x30')][_0x693e('0x40')]+'%'};return _0xbc477d;})});}_0x4d91a8=_[_0x693e('0x3b')]({},_0x4d91a8,_0x4405a3[_0x693e('0x41')]);return _0x77feb4[_0x693e('0x51')](_0x4d91a8);}})[_0x693e('0x27')](function(_0x422139){if(_0x422139){_0x2e7310=_0x422139['length'];if(!_0x4405a3[_0x693e('0x30')]['hasOwnProperty'](_0x693e('0x50'))){_0x4d91a8[_0x693e('0x23')]=qs['limit'](_0x4405a3['query'][_0x693e('0x23')]);_0x4d91a8[_0x693e('0x22')]=qs[_0x693e('0x22')](_0x4405a3['query'][_0x693e('0x22')]);}return _0x77feb4[_0x693e('0x51')](_0x4d91a8);}})[_0x693e('0x27')](function(_0x904d3b){if(_0x904d3b){return _0x904d3b?{'count':_0x2e7310,'rows':_0x904d3b}:null;}})[_0x693e('0x27')](respondWithResult(_0x38674a,null))[_0x693e('0x1d')](handleError(_0x38674a,null));};exports[_0x693e('0x52')]=function(_0x1c536d,_0x2e1b9a,_0x290634){var _0x5cb253={};var _0x230640={};var _0x1d59f0;var _0x13b8c1;return db[_0x693e('0x42')][_0x693e('0x4e')]({'where':{'id':_0x1c536d[_0x693e('0x4c')]['id']}})[_0x693e('0x27')](handleEntityNotFound(_0x2e1b9a,null))[_0x693e('0x27')](function(_0x175001){if(_0x175001){_0x1d59f0=_0x175001;_0x230640[_0x693e('0x2e')]=_[_0x693e('0x2f')](db['Dynamics365Field'][_0x693e('0x2d')]);_0x230640[_0x693e('0x30')]=_[_0x693e('0x2f')](_0x1c536d[_0x693e('0x30')]);_0x230640[_0x693e('0x31')]=_[_0x693e('0x32')](_0x230640[_0x693e('0x2e')],_0x230640[_0x693e('0x30')]);_0x5cb253[_0x693e('0x33')]=_[_0x693e('0x32')](_0x230640[_0x693e('0x2e')],qs['fields'](_0x1c536d[_0x693e('0x30')][_0x693e('0x34')]));_0x5cb253[_0x693e('0x33')]=_0x5cb253[_0x693e('0x33')][_0x693e('0x35')]?_0x5cb253[_0x693e('0x33')]:_0x230640[_0x693e('0x2e')];_0x5cb253['order']=qs[_0x693e('0x38')](_0x1c536d[_0x693e('0x30')][_0x693e('0x38')]);_0x5cb253[_0x693e('0x39')]=qs[_0x693e('0x31')](_[_0x693e('0x3a')](_0x1c536d[_0x693e('0x30')],_0x230640[_0x693e('0x31')]));if(_0x1c536d[_0x693e('0x30')][_0x693e('0x40')]){_0x5cb253[_0x693e('0x39')]=_[_0x693e('0x3b')](_0x5cb253[_0x693e('0x39')],{'$or':_['map'](_0x5cb253[_0x693e('0x33')],function(_0x5eb267){var _0x4e1a55={};_0x4e1a55[_0x5eb267]={'$like':'%'+_0x1c536d[_0x693e('0x30')]['filter']+'%'};return _0x4e1a55;})});}_0x5cb253=_['merge']({},_0x5cb253,_0x1c536d['options']);return _0x1d59f0[_0x693e('0x52')](_0x5cb253);}})['then'](function(_0x59cb8a){if(_0x59cb8a){_0x13b8c1=_0x59cb8a['length'];if(!_0x1c536d['query']['hasOwnProperty'](_0x693e('0x50'))){_0x5cb253[_0x693e('0x23')]=qs[_0x693e('0x23')](_0x1c536d['query'][_0x693e('0x23')]);_0x5cb253[_0x693e('0x22')]=qs[_0x693e('0x22')](_0x1c536d[_0x693e('0x30')][_0x693e('0x22')]);}return _0x1d59f0[_0x693e('0x52')](_0x5cb253);}})[_0x693e('0x27')](function(_0x256290){if(_0x256290){return _0x256290?{'count':_0x13b8c1,'rows':_0x256290}:null;}})['then'](respondWithResult(_0x2e1b9a,null))[_0x693e('0x1d')](handleError(_0x2e1b9a,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 30402d3..a7cfd97 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x20a0=['define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','api','moment','bluebird','request-promise','./intDynamics365Configuration.attributes','exports'];(function(_0x578fbe,_0x56f789){var _0xe6d563=function(_0x595a9a){while(--_0x595a9a){_0x578fbe['push'](_0x578fbe['shift']());}};_0xe6d563(++_0x56f789);}(_0x20a0,0x100));var _0x020a=function(_0x445184,_0x7f3b3c){_0x445184=_0x445184-0x0;var _0x19f7f6=_0x20a0[_0x445184];return _0x19f7f6;};'use strict';var _=require('lodash');var util=require(_0x020a('0x0'));var logger=require(_0x020a('0x1'))(_0x020a('0x2'));var moment=require(_0x020a('0x3'));var BPromise=require(_0x020a('0x4'));var rp=require(_0x020a('0x5'));var attributes=require(_0x020a('0x6'));module[_0x020a('0x7')]=function(_0x555366,_0x3d5b5d){return _0x555366[_0x020a('0x8')](_0x020a('0x9'),attributes,{'tableName':_0x020a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdcf0=['api','moment','bluebird','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x35515f,_0x1930cc){var _0x2ebee0=function(_0x28f11b){while(--_0x28f11b){_0x35515f['push'](_0x35515f['shift']());}};_0x2ebee0(++_0x1930cc);}(_0xdcf0,0xb5));var _0x0dcf=function(_0x59e5e6,_0xbf2931){_0x59e5e6=_0x59e5e6-0x0;var _0x20e906=_0xdcf0[_0x59e5e6];return _0x20e906;};'use strict';var _=require(_0x0dcf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0dcf('0x1'));var moment=require(_0x0dcf('0x2'));var BPromise=require(_0x0dcf('0x3'));var rp=require('request-promise');var attributes=require(_0x0dcf('0x4'));module['exports']=function(_0x505fd9,_0x14ac2a){return _0x505fd9['define'](_0x0dcf('0x5'),attributes,{'tableName':_0x0dcf('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 62a14f3..dd69d30 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a31=['request\x20sent','debug','error','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info'];(function(_0x60526,_0x19d1ce){var _0x17b493=function(_0x5b9dd8){while(--_0x5b9dd8){_0x60526['push'](_0x60526['shift']());}};_0x17b493(++_0x19d1ce);}(_0x9a31,0x196));var _0x19a3=function(_0x25efdf,_0x521462){_0x25efdf=_0x25efdf-0x0;var _0x22c495=_0x9a31[_0x25efdf];return _0x22c495;};'use strict';var _=require(_0x19a3('0x0'));var util=require(_0x19a3('0x1'));var moment=require(_0x19a3('0x2'));var BPromise=require(_0x19a3('0x3'));var rs=require(_0x19a3('0x4'));var fs=require('fs');var Redis=require(_0x19a3('0x5'));var db=require(_0x19a3('0x6'))['db'];var utils=require(_0x19a3('0x7'));var logger=require('../../config/logger')(_0x19a3('0x8'));var config=require(_0x19a3('0x9'));var jayson=require(_0x19a3('0xa'));var client=jayson[_0x19a3('0xb')][_0x19a3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22d02b,_0x2510a9,_0x25d55d){return new BPromise(function(_0x46f84c,_0x3a3e2c){return client['request'](_0x22d02b,_0x25d55d)['then'](function(_0x35d641){logger[_0x19a3('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2510a9,_0x19a3('0xe'));logger[_0x19a3('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x2510a9,_0x19a3('0xe'),JSON['stringify'](_0x35d641));if(_0x35d641['error']){if(_0x35d641[_0x19a3('0x10')]['code']===0x1f4){logger[_0x19a3('0x10')](_0x19a3('0x11'),_0x2510a9,_0x35d641['error']['message']);return _0x3a3e2c(_0x35d641['error'][_0x19a3('0x12')]);}logger[_0x19a3('0x10')](_0x19a3('0x11'),_0x2510a9,_0x35d641[_0x19a3('0x10')][_0x19a3('0x12')]);return _0x46f84c(_0x35d641[_0x19a3('0x10')]['message']);}else{logger[_0x19a3('0xd')](_0x19a3('0x11'),_0x2510a9,_0x19a3('0xe'));_0x46f84c(_0x35d641[_0x19a3('0x13')][_0x19a3('0x12')]);}})[_0x19a3('0x14')](function(_0x27d002){logger[_0x19a3('0x10')](_0x19a3('0x11'),_0x2510a9,_0x27d002);_0x3a3e2c(_0x27d002);});});} \ No newline at end of file +var _0x183b=['Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','code','error','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug'];(function(_0x32c257,_0x3adabf){var _0x19294e=function(_0x20ead3){while(--_0x20ead3){_0x32c257['push'](_0x32c257['shift']());}};_0x19294e(++_0x3adabf);}(_0x183b,0x18f));var _0xb183=function(_0x3f134f,_0x2a999b){_0x3f134f=_0x3f134f-0x0;var _0x181f3f=_0x183b[_0x3f134f];return _0x181f3f;};'use strict';var _=require(_0xb183('0x0'));var util=require(_0xb183('0x1'));var moment=require(_0xb183('0x2'));var BPromise=require(_0xb183('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb183('0x4'));var db=require(_0xb183('0x5'))['db'];var utils=require(_0xb183('0x6'));var logger=require(_0xb183('0x7'))('rpc');var config=require(_0xb183('0x8'));var jayson=require(_0xb183('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39c01e,_0x45d9d7,_0x4fd3df){return new BPromise(function(_0x20e11a,_0x23835e){return client[_0xb183('0xa')](_0x39c01e,_0x4fd3df)[_0xb183('0xb')](function(_0x3fcb64){logger[_0xb183('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x45d9d7,_0xb183('0xd'));logger[_0xb183('0xe')](_0xb183('0xf'),_0x45d9d7,_0xb183('0xd'),JSON[_0xb183('0x10')](_0x3fcb64));if(_0x3fcb64['error']){if(_0x3fcb64['error'][_0xb183('0x11')]===0x1f4){logger[_0xb183('0x12')](_0xb183('0x13'),_0x45d9d7,_0x3fcb64[_0xb183('0x12')]['message']);return _0x23835e(_0x3fcb64['error'][_0xb183('0x14')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x45d9d7,_0x3fcb64[_0xb183('0x12')][_0xb183('0x14')]);return _0x20e11a(_0x3fcb64[_0xb183('0x12')][_0xb183('0x14')]);}else{logger[_0xb183('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x45d9d7,'request\x20sent');_0x20e11a(_0x3fcb64[_0xb183('0x15')][_0xb183('0x14')]);}})[_0xb183('0x16')](function(_0x1b068e){logger[_0xb183('0x12')](_0xb183('0x13'),_0x45d9d7,_0x1b068e);_0x23835e(_0x1b068e);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 2f6c2fa..8285bc9 100644 --- a/server/api/intDynamics365Field/index.js +++ b/server/api/intDynamics365Field/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x62eb=['create','put','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x55aedb,_0x4018fb){var _0x20dc7e=function(_0x1e3f69){while(--_0x1e3f69){_0x55aedb['push'](_0x55aedb['shift']());}};_0x20dc7e(++_0x4018fb);}(_0x62eb,0x70));var _0xb62e=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x62eb[_0x2261ce];return _0x524640;};'use strict';var multer=require('multer');var util=require(_0xb62e('0x0'));var path=require(_0xb62e('0x1'));var timeout=require(_0xb62e('0x2'));var express=require(_0xb62e('0x3'));var router=express[_0xb62e('0x4')]();var auth=require(_0xb62e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb62e('0x6'));var controller=require(_0xb62e('0x7'));router[_0xb62e('0x8')]('/',auth[_0xb62e('0x9')](),controller[_0xb62e('0xa')]);router[_0xb62e('0x8')](_0xb62e('0xb'),auth[_0xb62e('0x9')](),controller[_0xb62e('0xc')]);router[_0xb62e('0xd')]('/',auth[_0xb62e('0x9')](),controller[_0xb62e('0xe')]);router[_0xb62e('0xf')](_0xb62e('0xb'),auth['isAuthenticated'](),controller[_0xb62e('0x10')]);router[_0xb62e('0x11')](_0xb62e('0xb'),auth[_0xb62e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4c93=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','post','create','update'];(function(_0x4fd6de,_0x35bb52){var _0x58d6d5=function(_0x281c10){while(--_0x281c10){_0x4fd6de['push'](_0x4fd6de['shift']());}};_0x58d6d5(++_0x35bb52);}(_0x4c93,0x1cb));var _0x34c9=function(_0x3f5d33,_0x34038b){_0x3f5d33=_0x3f5d33-0x0;var _0x135911=_0x4c93[_0x3f5d33];return _0x135911;};'use strict';var multer=require(_0x34c9('0x0'));var util=require(_0x34c9('0x1'));var path=require(_0x34c9('0x2'));var timeout=require(_0x34c9('0x3'));var express=require(_0x34c9('0x4'));var router=express[_0x34c9('0x5')]();var auth=require(_0x34c9('0x6'));var interaction=require(_0x34c9('0x7'));var config=require(_0x34c9('0x8'));var controller=require(_0x34c9('0x9'));router[_0x34c9('0xa')]('/',auth[_0x34c9('0xb')](),controller['index']);router['get'](_0x34c9('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x34c9('0xd')]('/',auth[_0x34c9('0xb')](),controller[_0x34c9('0xe')]);router['put'](_0x34c9('0xc'),auth[_0x34c9('0xb')](),controller[_0x34c9('0xf')]);router[_0x34c9('0x10')](_0x34c9('0xc'),auth[_0x34c9('0xb')](),controller[_0x34c9('0x11')]);module[_0x34c9('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 66a3dff..3172e43 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.attributes.js +++ b/server/api/intDynamics365Field/intDynamics365Field.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91a7=['STRING','exports','ENUM','string','customVariable'];(function(_0x33399e,_0x487f3f){var _0x5ce7f0=function(_0x504de4){while(--_0x504de4){_0x33399e['push'](_0x33399e['shift']());}};_0x5ce7f0(++_0x487f3f);}(_0x91a7,0xe7));var _0x791a=function(_0x3a1cd9,_0x29cf8c){_0x3a1cd9=_0x3a1cd9-0x0;var _0xee7feb=_0x91a7[_0x3a1cd9];return _0xee7feb;};'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 +var _0x6c76=['customVariable','STRING','string','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x1d5400,_0x567e3c){var _0x21d9fe=function(_0x23fb75){while(--_0x23fb75){_0x1d5400['push'](_0x1d5400['shift']());}};_0x21d9fe(++_0x567e3c);}(_0x6c76,0x184));var _0x66c7=function(_0x1bec8d,_0x460334){_0x1bec8d=_0x1bec8d-0x0;var _0x49b199=_0x6c76[_0x1bec8d];return _0x49b199;};'use strict';var Sequelize=require(_0x66c7('0x0'));module[_0x66c7('0x1')]={'type':{'type':Sequelize[_0x66c7('0x2')]('string',_0x66c7('0x3'),_0x66c7('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0x66c7('0x5')]},'key':{'type':Sequelize[_0x66c7('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x66c7('0x6'),_0x66c7('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x66c7('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x66c7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x66c7('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 7fc85bc..9e4439e 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.controller.js +++ b/server/api/intDynamics365Field/intDynamics365Field.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x980f=['findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','Dynamics365Field','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','key','VIRTUAL','field','includeAll','include'];(function(_0x30f1d7,_0x5c21a5){var _0x2fe8f4=function(_0x4850d2){while(--_0x4850d2){_0x30f1d7['push'](_0x30f1d7['shift']());}};_0x2fe8f4(++_0x5c21a5);}(_0x980f,0xe6));var _0xf980=function(_0x1abb11,_0xd68915){_0x1abb11=_0x1abb11-0x0;var _0x149a9f=_0x980f[_0x1abb11];return _0x149a9f;};'use strict';var pdf=require(_0xf980('0x0'));var emlformat=require(_0xf980('0x1'));var rimraf=require(_0xf980('0x2'));var zipdir=require(_0xf980('0x3'));var jsonpatch=require(_0xf980('0x4'));var rp=require('request-promise');var moment=require(_0xf980('0x5'));var BPromise=require(_0xf980('0x6'));var Mustache=require('mustache');var util=require(_0xf980('0x7'));var path=require(_0xf980('0x8'));var sox=require(_0xf980('0x9'));var csv=require(_0xf980('0xa'));var ejs=require(_0xf980('0xb'));var fs=require('fs');var _=require(_0xf980('0xc'));var squel=require(_0xf980('0xd'));var crypto=require(_0xf980('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf980('0xf'));var toCsv=require(_0xf980('0xa'));var querystring=require(_0xf980('0x10'));var Papa=require(_0xf980('0x11'));var authService=require(_0xf980('0x12'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xf980('0x13'));var qs=require(_0xf980('0x14'));var logger=require(_0xf980('0x15'))(_0xf980('0x16'));var utils=require(_0xf980('0x17'));var config=require(_0xf980('0x18'));var db=require(_0xf980('0x19'))['db'];function respondWithStatusCode(_0x1259ec,_0xe25a32){_0xe25a32=_0xe25a32||0xcc;return function(_0x589d60){if(_0x589d60){return _0x1259ec[_0xf980('0x1a')](_0xe25a32);}return _0x1259ec['status'](_0xe25a32)[_0xf980('0x1b')]();};}function respondWithResult(_0x25717d,_0x23329d){_0x23329d=_0x23329d||0xc8;return function(_0x7544e1){if(_0x7544e1){return _0x25717d['status'](_0x23329d)[_0xf980('0x1c')](_0x7544e1);}};}function respondWithFilteredResult(_0x1da274,_0x23182a){return function(_0x20e279){if(_0x20e279){var _0x554f62=_0x20e279[_0xf980('0x1d')],_0x4f787e=_0x23182a[_0xf980('0x1e')],_0x4c2e72=_0x23182a[_0xf980('0x1e')]+_0x23182a[_0xf980('0x1f')],_0x39596c;if(_0x4c2e72>=_0x554f62){_0x4c2e72=_0x554f62;_0x39596c=0xc8;}else{_0x39596c=0xce;}_0x1da274[_0xf980('0x20')](_0x39596c);return _0x1da274['set'](_0xf980('0x21'),_0x4f787e+'-'+_0x4c2e72+'/'+_0x554f62)['json'](_0x20e279);}return null;};}function patchUpdates(_0x367886){return function(_0x56be35){try{jsonpatch[_0xf980('0x22')](_0x56be35,_0x367886,!![]);}catch(_0x17fe28){return BPromise[_0xf980('0x23')](_0x17fe28);}return _0x56be35[_0xf980('0x24')]();};}function saveUpdates(_0x4682d7,_0x2f2a9b){return function(_0x1d1e9d){if(_0x1d1e9d){return _0x1d1e9d[_0xf980('0x25')](_0x4682d7)[_0xf980('0x26')](function(_0x5b1c5c){return _0x5b1c5c;});}return null;};}function removeEntity(_0x2b61c2,_0x4b5fa2){return function(_0x270096){if(_0x270096){return _0x270096[_0xf980('0x27')]()[_0xf980('0x26')](function(){_0x2b61c2[_0xf980('0x20')](0xcc)[_0xf980('0x1b')]();});}};}function handleEntityNotFound(_0x4eb025,_0x321bae){return function(_0x9bedb0){if(!_0x9bedb0){_0x4eb025[_0xf980('0x1a')](0x194);}return _0x9bedb0;};}function handleError(_0x229015,_0x1f1676){_0x1f1676=_0x1f1676||0x1f4;return function(_0x572ae9){logger['error'](_0x572ae9[_0xf980('0x28')]);if(_0x572ae9[_0xf980('0x29')]){delete _0x572ae9[_0xf980('0x29')];}_0x229015['status'](_0x1f1676)[_0xf980('0x2a')](_0x572ae9);};}exports[_0xf980('0x2b')]=function(_0x3b4572,_0x5deaf0){var _0x2438fd={},_0x65cfe6={},_0x271dde={'count':0x0,'rows':[]};var _0x1c9e13=db[_0xf980('0x2c')]['rawAttributes'];_0x65cfe6[_0xf980('0x2d')]=_[_0xf980('0x2e')](_0x1c9e13);_0x65cfe6['query']=_[_0xf980('0x2e')](_0x3b4572['query']);_0x65cfe6[_0xf980('0x2f')]=_[_0xf980('0x30')](_0x65cfe6[_0xf980('0x2d')],_0x65cfe6[_0xf980('0x31')]);_0x2438fd[_0xf980('0x32')]=_[_0xf980('0x30')](_0x65cfe6['model'],qs[_0xf980('0x33')](_0x3b4572[_0xf980('0x31')]['fields']));_0x2438fd[_0xf980('0x32')]=_0x2438fd[_0xf980('0x32')][_0xf980('0x34')]?_0x2438fd[_0xf980('0x32')]:_0x65cfe6[_0xf980('0x2d')];if(!_0x3b4572[_0xf980('0x31')][_0xf980('0x35')](_0xf980('0x36'))){_0x2438fd[_0xf980('0x1f')]=qs[_0xf980('0x1f')](_0x3b4572['query'][_0xf980('0x1f')]);_0x2438fd['offset']=qs[_0xf980('0x1e')](_0x3b4572['query'][_0xf980('0x1e')]);}_0x2438fd[_0xf980('0x37')]=qs['sort'](_0x3b4572[_0xf980('0x31')][_0xf980('0x38')]);_0x2438fd[_0xf980('0x39')]=qs[_0xf980('0x2f')](_['pick'](_0x3b4572[_0xf980('0x31')],_0x65cfe6['filters']));if(_0x3b4572['query'][_0xf980('0x3a')]){_0x2438fd[_0xf980('0x39')]=_[_0xf980('0x3b')](_0x2438fd[_0xf980('0x39')],{'$or':_['map'](_0x1c9e13,function(_0x2673ae){if(_0x2673ae[_0xf980('0x3c')][_0xf980('0x3d')]!==_0xf980('0x3e')){var _0x248863={};_0x248863[_0x2673ae[_0xf980('0x3f')]]={'$like':'%'+_0x3b4572[_0xf980('0x31')]['filter']+'%'};return _0x248863;}})});}_0x2438fd=_[_0xf980('0x3b')]({},_0x2438fd,_0x3b4572['options']);var _0x2358ee={'where':_0x2438fd[_0xf980('0x39')]};return db[_0xf980('0x2c')][_0xf980('0x1d')](_0x2358ee)[_0xf980('0x26')](function(_0x537709){_0x271dde['count']=_0x537709;if(_0x3b4572[_0xf980('0x31')][_0xf980('0x40')]){_0x2438fd[_0xf980('0x41')]=[{'all':!![]}];}return db[_0xf980('0x2c')][_0xf980('0x42')](_0x2438fd);})[_0xf980('0x26')](function(_0x509358){_0x271dde[_0xf980('0x43')]=_0x509358;return _0x271dde;})[_0xf980('0x26')](respondWithFilteredResult(_0x5deaf0,_0x2438fd))[_0xf980('0x44')](handleError(_0x5deaf0,null));};exports[_0xf980('0x45')]=function(_0x543984,_0x3315d7){var _0x13ba98={'raw':!![],'where':{'id':_0x543984[_0xf980('0x46')]['id']}},_0x265d03={};_0x265d03['model']=_[_0xf980('0x2e')](db[_0xf980('0x2c')]['rawAttributes']);_0x265d03['query']=_[_0xf980('0x2e')](_0x543984[_0xf980('0x31')]);_0x265d03[_0xf980('0x2f')]=_[_0xf980('0x30')](_0x265d03[_0xf980('0x2d')],_0x265d03[_0xf980('0x31')]);_0x13ba98[_0xf980('0x32')]=_[_0xf980('0x30')](_0x265d03[_0xf980('0x2d')],qs[_0xf980('0x33')](_0x543984['query'][_0xf980('0x33')]));_0x13ba98[_0xf980('0x32')]=_0x13ba98[_0xf980('0x32')][_0xf980('0x34')]?_0x13ba98[_0xf980('0x32')]:_0x265d03[_0xf980('0x2d')];if(_0x543984['query']['includeAll']){_0x13ba98[_0xf980('0x41')]=[{'all':!![]}];}_0x13ba98=_[_0xf980('0x3b')]({},_0x13ba98,_0x543984['options']);return db[_0xf980('0x2c')][_0xf980('0x47')](_0x13ba98)[_0xf980('0x26')](handleEntityNotFound(_0x3315d7,null))[_0xf980('0x26')](respondWithResult(_0x3315d7,null))['catch'](handleError(_0x3315d7,null));};exports[_0xf980('0x48')]=function(_0x3c4070,_0x31a20e){return db[_0xf980('0x2c')][_0xf980('0x48')](_0x3c4070[_0xf980('0x49')],{})[_0xf980('0x26')](respondWithResult(_0x31a20e,0xc9))[_0xf980('0x44')](handleError(_0x31a20e,null));};exports[_0xf980('0x25')]=function(_0x5b5394,_0x3f4ed7){if(_0x5b5394['body']['id']){delete _0x5b5394[_0xf980('0x49')]['id'];}return db[_0xf980('0x2c')][_0xf980('0x47')]({'where':{'id':_0x5b5394['params']['id']}})[_0xf980('0x26')](handleEntityNotFound(_0x3f4ed7,null))['then'](saveUpdates(_0x5b5394[_0xf980('0x49')],null))[_0xf980('0x26')](respondWithResult(_0x3f4ed7,null))[_0xf980('0x44')](handleError(_0x3f4ed7,null));};exports[_0xf980('0x27')]=function(_0x523054,_0x403726){return db[_0xf980('0x2c')]['find']({'where':{'id':_0x523054['params']['id']}})[_0xf980('0x26')](handleEntityNotFound(_0x403726,null))[_0xf980('0x26')](removeEntity(_0x403726,null))[_0xf980('0x44')](handleError(_0x403726,null));}; \ No newline at end of file +var _0xe83e=['offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','Dynamics365Field','rawAttributes','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','includeAll','include','findAll','rows','catch','show','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xe83e,0x7a));var _0xee83=function(_0x48a1f7,_0x10acd7){_0x48a1f7=_0x48a1f7-0x0;var _0x4628b3=_0xe83e[_0x48a1f7];return _0x4628b3;};'use strict';var pdf=require(_0xee83('0x0'));var emlformat=require(_0xee83('0x1'));var rimraf=require(_0xee83('0x2'));var zipdir=require(_0xee83('0x3'));var jsonpatch=require(_0xee83('0x4'));var rp=require(_0xee83('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xee83('0x6'));var util=require(_0xee83('0x7'));var path=require(_0xee83('0x8'));var sox=require(_0xee83('0x9'));var csv=require(_0xee83('0xa'));var ejs=require(_0xee83('0xb'));var fs=require('fs');var _=require(_0xee83('0xc'));var squel=require('squel');var crypto=require(_0xee83('0xd'));var jsforce=require(_0xee83('0xe'));var deskjs=require(_0xee83('0xf'));var toCsv=require(_0xee83('0xa'));var querystring=require(_0xee83('0x10'));var Papa=require('papaparse');var authService=require(_0xee83('0x11'));var hardwareService=require(_0xee83('0x12'));var Redis=require(_0xee83('0x13'));var qs=require(_0xee83('0x14'));var logger=require(_0xee83('0x15'))(_0xee83('0x16'));var utils=require(_0xee83('0x17'));var config=require(_0xee83('0x18'));var db=require(_0xee83('0x19'))['db'];function respondWithStatusCode(_0x5b1418,_0x5db25f){_0x5db25f=_0x5db25f||0xcc;return function(_0x370cbe){if(_0x370cbe){return _0x5b1418[_0xee83('0x1a')](_0x5db25f);}return _0x5b1418[_0xee83('0x1b')](_0x5db25f)[_0xee83('0x1c')]();};}function respondWithResult(_0x1142fa,_0x241f6f){_0x241f6f=_0x241f6f||0xc8;return function(_0x15bc39){if(_0x15bc39){return _0x1142fa[_0xee83('0x1b')](_0x241f6f)['json'](_0x15bc39);}};}function respondWithFilteredResult(_0x53f5b2,_0x200a20){return function(_0x8ac5b5){if(_0x8ac5b5){var _0x66ee12=_0x8ac5b5[_0xee83('0x1d')],_0x1f3931=_0x200a20[_0xee83('0x1e')],_0xb09f5f=_0x200a20[_0xee83('0x1e')]+_0x200a20[_0xee83('0x1f')],_0x467681;if(_0xb09f5f>=_0x66ee12){_0xb09f5f=_0x66ee12;_0x467681=0xc8;}else{_0x467681=0xce;}_0x53f5b2[_0xee83('0x1b')](_0x467681);return _0x53f5b2[_0xee83('0x20')](_0xee83('0x21'),_0x1f3931+'-'+_0xb09f5f+'/'+_0x66ee12)['json'](_0x8ac5b5);}return null;};}function patchUpdates(_0x40f9b4){return function(_0x5c9bb1){try{jsonpatch[_0xee83('0x22')](_0x5c9bb1,_0x40f9b4,!![]);}catch(_0x4745d1){return BPromise[_0xee83('0x23')](_0x4745d1);}return _0x5c9bb1[_0xee83('0x24')]();};}function saveUpdates(_0x437e45,_0x154705){return function(_0x1fa40d){if(_0x1fa40d){return _0x1fa40d[_0xee83('0x25')](_0x437e45)[_0xee83('0x26')](function(_0x1b3e01){return _0x1b3e01;});}return null;};}function removeEntity(_0x3f98d7,_0x11724e){return function(_0x226746){if(_0x226746){return _0x226746[_0xee83('0x27')]()[_0xee83('0x26')](function(){_0x3f98d7[_0xee83('0x1b')](0xcc)[_0xee83('0x1c')]();});}};}function handleEntityNotFound(_0x402b99,_0x2fb57e){return function(_0x3b42e3){if(!_0x3b42e3){_0x402b99['sendStatus'](0x194);}return _0x3b42e3;};}function handleError(_0x577dc4,_0x2a46db){_0x2a46db=_0x2a46db||0x1f4;return function(_0x4dbc8e){logger[_0xee83('0x28')](_0x4dbc8e[_0xee83('0x29')]);if(_0x4dbc8e[_0xee83('0x2a')]){delete _0x4dbc8e[_0xee83('0x2a')];}_0x577dc4[_0xee83('0x1b')](_0x2a46db)[_0xee83('0x2b')](_0x4dbc8e);};}exports[_0xee83('0x2c')]=function(_0x3ff1e9,_0x12afcc){var _0x3e6ba8={},_0x503bdf={},_0x5de580={'count':0x0,'rows':[]};var _0x2a7ee8=db[_0xee83('0x2d')][_0xee83('0x2e')];_0x503bdf[_0xee83('0x2f')]=_['keys'](_0x2a7ee8);_0x503bdf[_0xee83('0x30')]=_[_0xee83('0x31')](_0x3ff1e9[_0xee83('0x30')]);_0x503bdf[_0xee83('0x32')]=_[_0xee83('0x33')](_0x503bdf[_0xee83('0x2f')],_0x503bdf[_0xee83('0x30')]);_0x3e6ba8[_0xee83('0x34')]=_[_0xee83('0x33')](_0x503bdf[_0xee83('0x2f')],qs['fields'](_0x3ff1e9[_0xee83('0x30')]['fields']));_0x3e6ba8[_0xee83('0x34')]=_0x3e6ba8[_0xee83('0x34')][_0xee83('0x35')]?_0x3e6ba8['attributes']:_0x503bdf[_0xee83('0x2f')];if(!_0x3ff1e9[_0xee83('0x30')][_0xee83('0x36')]('nolimit')){_0x3e6ba8[_0xee83('0x1f')]=qs[_0xee83('0x1f')](_0x3ff1e9[_0xee83('0x30')][_0xee83('0x1f')]);_0x3e6ba8[_0xee83('0x1e')]=qs[_0xee83('0x1e')](_0x3ff1e9[_0xee83('0x30')]['offset']);}_0x3e6ba8[_0xee83('0x37')]=qs['sort'](_0x3ff1e9[_0xee83('0x30')][_0xee83('0x38')]);_0x3e6ba8[_0xee83('0x39')]=qs['filters'](_[_0xee83('0x3a')](_0x3ff1e9[_0xee83('0x30')],_0x503bdf[_0xee83('0x32')]));if(_0x3ff1e9[_0xee83('0x30')][_0xee83('0x3b')]){_0x3e6ba8['where']=_[_0xee83('0x3c')](_0x3e6ba8[_0xee83('0x39')],{'$or':_[_0xee83('0x3d')](_0x2a7ee8,function(_0x10fc4c){if(_0x10fc4c[_0xee83('0x3e')][_0xee83('0x3f')]!==_0xee83('0x40')){var _0x17c73e={};_0x17c73e[_0x10fc4c[_0xee83('0x41')]]={'$like':'%'+_0x3ff1e9[_0xee83('0x30')][_0xee83('0x3b')]+'%'};return _0x17c73e;}})});}_0x3e6ba8=_['merge']({},_0x3e6ba8,_0x3ff1e9['options']);var _0x3fc261={'where':_0x3e6ba8[_0xee83('0x39')]};return db['Dynamics365Field'][_0xee83('0x1d')](_0x3fc261)[_0xee83('0x26')](function(_0x4f8fcd){_0x5de580[_0xee83('0x1d')]=_0x4f8fcd;if(_0x3ff1e9['query'][_0xee83('0x42')]){_0x3e6ba8[_0xee83('0x43')]=[{'all':!![]}];}return db['Dynamics365Field'][_0xee83('0x44')](_0x3e6ba8);})[_0xee83('0x26')](function(_0x4e051a){_0x5de580[_0xee83('0x45')]=_0x4e051a;return _0x5de580;})['then'](respondWithFilteredResult(_0x12afcc,_0x3e6ba8))[_0xee83('0x46')](handleError(_0x12afcc,null));};exports[_0xee83('0x47')]=function(_0x38bf3d,_0x1620d9){var _0x1f5c53={'raw':!![],'where':{'id':_0x38bf3d['params']['id']}},_0x466b4c={};_0x466b4c['model']=_[_0xee83('0x31')](db[_0xee83('0x2d')]['rawAttributes']);_0x466b4c[_0xee83('0x30')]=_[_0xee83('0x31')](_0x38bf3d[_0xee83('0x30')]);_0x466b4c[_0xee83('0x32')]=_['intersection'](_0x466b4c['model'],_0x466b4c['query']);_0x1f5c53[_0xee83('0x34')]=_[_0xee83('0x33')](_0x466b4c[_0xee83('0x2f')],qs['fields'](_0x38bf3d[_0xee83('0x30')]['fields']));_0x1f5c53['attributes']=_0x1f5c53[_0xee83('0x34')][_0xee83('0x35')]?_0x1f5c53['attributes']:_0x466b4c[_0xee83('0x2f')];if(_0x38bf3d[_0xee83('0x30')][_0xee83('0x42')]){_0x1f5c53['include']=[{'all':!![]}];}_0x1f5c53=_[_0xee83('0x3c')]({},_0x1f5c53,_0x38bf3d[_0xee83('0x48')]);return db[_0xee83('0x2d')][_0xee83('0x49')](_0x1f5c53)[_0xee83('0x26')](handleEntityNotFound(_0x1620d9,null))[_0xee83('0x26')](respondWithResult(_0x1620d9,null))[_0xee83('0x46')](handleError(_0x1620d9,null));};exports[_0xee83('0x4a')]=function(_0xcabb78,_0x54282c){return db['Dynamics365Field'][_0xee83('0x4a')](_0xcabb78[_0xee83('0x4b')],{})['then'](respondWithResult(_0x54282c,0xc9))[_0xee83('0x46')](handleError(_0x54282c,null));};exports['update']=function(_0x4cce78,_0x751bd1){if(_0x4cce78[_0xee83('0x4b')]['id']){delete _0x4cce78[_0xee83('0x4b')]['id'];}return db['Dynamics365Field'][_0xee83('0x49')]({'where':{'id':_0x4cce78['params']['id']}})[_0xee83('0x26')](handleEntityNotFound(_0x751bd1,null))[_0xee83('0x26')](saveUpdates(_0x4cce78['body'],null))[_0xee83('0x26')](respondWithResult(_0x751bd1,null))[_0xee83('0x46')](handleError(_0x751bd1,null));};exports[_0xee83('0x27')]=function(_0x59e140,_0x116206){return db[_0xee83('0x2d')][_0xee83('0x49')]({'where':{'id':_0x59e140['params']['id']}})[_0xee83('0x26')](handleEntityNotFound(_0x116206,null))['then'](removeEntity(_0x116206,null))[_0xee83('0x46')](handleError(_0x116206,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 7b4faf7..521c783 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.model.js +++ b/server/api/intDynamics365Field/intDynamics365Field.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf53d=['bluebird','./intDynamics365Field.attributes','exports','define','dynamics365_unique_index','idField','util','api'];(function(_0x3ca588,_0x26acdf){var _0x210129=function(_0x10f2cf){while(--_0x10f2cf){_0x3ca588['push'](_0x3ca588['shift']());}};_0x210129(++_0x26acdf);}(_0xf53d,0x1ee));var _0xdf53=function(_0x5c3810,_0x316733){_0x5c3810=_0x5c3810-0x0;var _0x2126d9=_0xf53d[_0x5c3810];return _0x2126d9;};'use strict';var _=require('lodash');var util=require(_0xdf53('0x0'));var logger=require('../../config/logger')(_0xdf53('0x1'));var moment=require('moment');var BPromise=require(_0xdf53('0x2'));var rp=require('request-promise');var attributes=require(_0xdf53('0x3'));module[_0xdf53('0x4')]=function(_0x1b1340,_0x3686f0){return _0x1b1340[_0xdf53('0x5')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xdf53('0x6'),'fields':[_0xdf53('0x7'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8eb2=['moment','bluebird','request-promise','exports','define','int_dynamics365_fields','dynamics365_unique_index','FieldId','util','../../config/logger'];(function(_0x349af2,_0x1043d2){var _0x2c4881=function(_0x5f04c9){while(--_0x5f04c9){_0x349af2['push'](_0x349af2['shift']());}};_0x2c4881(++_0x1043d2);}(_0x8eb2,0x166));var _0x28eb=function(_0x52c651,_0x4c1f4e){_0x52c651=_0x52c651-0x0;var _0x525ceb=_0x8eb2[_0x52c651];return _0x525ceb;};'use strict';var _=require('lodash');var util=require(_0x28eb('0x0'));var logger=require(_0x28eb('0x1'))('api');var moment=require(_0x28eb('0x2'));var BPromise=require(_0x28eb('0x3'));var rp=require(_0x28eb('0x4'));var attributes=require('./intDynamics365Field.attributes');module[_0x28eb('0x5')]=function(_0x3372c0,_0x446976){return _0x3372c0[_0x28eb('0x6')]('Dynamics365Field',attributes,{'tableName':_0x28eb('0x7'),'paranoid':![],'indexes':[{'name':_0x28eb('0x8'),'fields':['idField',_0x28eb('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index adb686c..0252639 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.rpc.js +++ b/server/api/intDynamics365Field/intDynamics365Field.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae8e=['http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5ed54b,_0x3a2827){var _0x4b58c7=function(_0x19d3b6){while(--_0x19d3b6){_0x5ed54b['push'](_0x5ed54b['shift']());}};_0x4b58c7(++_0x3a2827);}(_0xae8e,0xc3));var _0xeae8=function(_0x35e69c,_0x561b7e){_0x35e69c=_0x35e69c-0x0;var _0x27e28f=_0xae8e[_0x35e69c];return _0x27e28f;};'use strict';var _=require(_0xeae8('0x0'));var util=require(_0xeae8('0x1'));var moment=require(_0xeae8('0x2'));var BPromise=require(_0xeae8('0x3'));var rs=require(_0xeae8('0x4'));var fs=require('fs');var Redis=require(_0xeae8('0x5'));var db=require(_0xeae8('0x6'))['db'];var utils=require(_0xeae8('0x7'));var logger=require(_0xeae8('0x8'))(_0xeae8('0x9'));var config=require(_0xeae8('0xa'));var jayson=require(_0xeae8('0xb'));var client=jayson[_0xeae8('0xc')][_0xeae8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1a573d,_0x4f1e68,_0x164e04){return new BPromise(function(_0xb4a0eb,_0x16e287){return client[_0xeae8('0xe')](_0x1a573d,_0x164e04)[_0xeae8('0xf')](function(_0x25af4f){logger[_0xeae8('0x10')](_0xeae8('0x11'),_0x4f1e68,_0xeae8('0x12'));logger[_0xeae8('0x13')](_0xeae8('0x14'),_0x4f1e68,_0xeae8('0x12'),JSON[_0xeae8('0x15')](_0x25af4f));if(_0x25af4f[_0xeae8('0x16')]){if(_0x25af4f[_0xeae8('0x16')]['code']===0x1f4){logger[_0xeae8('0x16')](_0xeae8('0x11'),_0x4f1e68,_0x25af4f[_0xeae8('0x16')][_0xeae8('0x17')]);return _0x16e287(_0x25af4f[_0xeae8('0x16')][_0xeae8('0x17')]);}logger['error'](_0xeae8('0x11'),_0x4f1e68,_0x25af4f[_0xeae8('0x16')][_0xeae8('0x17')]);return _0xb4a0eb(_0x25af4f[_0xeae8('0x16')][_0xeae8('0x17')]);}else{logger[_0xeae8('0x10')](_0xeae8('0x11'),_0x4f1e68,'request\x20sent');_0xb4a0eb(_0x25af4f[_0xeae8('0x18')][_0xeae8('0x17')]);}})[_0xeae8('0x19')](function(_0x371a89){logger[_0xeae8('0x16')](_0xeae8('0x11'),_0x4f1e68,_0x371a89);_0x16e287(_0x371a89);});});} \ No newline at end of file +var _0xbdfb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xbdfb,0x1ef));var _0xbbdf=function(_0x3e3221,_0x392851){_0x3e3221=_0x3e3221-0x0;var _0x190da4=_0xbdfb[_0x3e3221];return _0x190da4;};'use strict';var _=require(_0xbbdf('0x0'));var util=require(_0xbbdf('0x1'));var moment=require(_0xbbdf('0x2'));var BPromise=require(_0xbbdf('0x3'));var rs=require(_0xbbdf('0x4'));var fs=require('fs');var Redis=require(_0xbbdf('0x5'));var db=require(_0xbbdf('0x6'))['db'];var utils=require(_0xbbdf('0x7'));var logger=require(_0xbbdf('0x8'))(_0xbbdf('0x9'));var config=require('../../config/environment');var jayson=require(_0xbbdf('0xa'));var client=jayson[_0xbbdf('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c930d,_0x17c835,_0x58a929){return new BPromise(function(_0x2f9954,_0x2ae0d8){return client[_0xbbdf('0xc')](_0x3c930d,_0x58a929)[_0xbbdf('0xd')](function(_0x4c1436){logger[_0xbbdf('0xe')](_0xbbdf('0xf'),_0x17c835,'request\x20sent');logger[_0xbbdf('0x10')](_0xbbdf('0x11'),_0x17c835,_0xbbdf('0x12'),JSON[_0xbbdf('0x13')](_0x4c1436));if(_0x4c1436['error']){if(_0x4c1436[_0xbbdf('0x14')][_0xbbdf('0x15')]===0x1f4){logger[_0xbbdf('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x17c835,_0x4c1436['error']['message']);return _0x2ae0d8(_0x4c1436['error'][_0xbbdf('0x16')]);}logger[_0xbbdf('0x14')](_0xbbdf('0xf'),_0x17c835,_0x4c1436['error'][_0xbbdf('0x16')]);return _0x2f9954(_0x4c1436[_0xbbdf('0x14')][_0xbbdf('0x16')]);}else{logger[_0xbbdf('0xe')](_0xbbdf('0xf'),_0x17c835,'request\x20sent');_0x2f9954(_0x4c1436[_0xbbdf('0x17')][_0xbbdf('0x16')]);}})[_0xbbdf('0x18')](function(_0x547b94){logger['error'](_0xbbdf('0xf'),_0x17c835,_0x547b94);_0x2ae0d8(_0x547b94);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index f0c82b4..5857bce 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 _0xe728=['put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x8b4fa9,_0xd0f53e){var _0x3f726a=function(_0x498c67){while(--_0x498c67){_0x8b4fa9['push'](_0x8b4fa9['shift']());}};_0x3f726a(++_0xd0f53e);}(_0xe728,0x19d));var _0x8e72=function(_0x428045,_0x28477f){_0x428045=_0x428045-0x0;var _0x3770e0=_0xe728[_0x428045];return _0x3770e0;};'use strict';var multer=require(_0x8e72('0x0'));var util=require(_0x8e72('0x1'));var path=require(_0x8e72('0x2'));var timeout=require('connect-timeout');var express=require(_0x8e72('0x3'));var router=express[_0x8e72('0x4')]();var auth=require(_0x8e72('0x5'));var interaction=require(_0x8e72('0x6'));var config=require(_0x8e72('0x7'));var controller=require(_0x8e72('0x8'));router[_0x8e72('0x9')]('/',auth[_0x8e72('0xa')](),controller[_0x8e72('0xb')]);router[_0x8e72('0x9')](_0x8e72('0xc'),auth[_0x8e72('0xa')](),controller['show']);router['get'](_0x8e72('0xd'),auth[_0x8e72('0xa')](),controller[_0x8e72('0xe')]);router[_0x8e72('0x9')](_0x8e72('0xf'),auth[_0x8e72('0xa')](),controller[_0x8e72('0x10')]);router[_0x8e72('0x11')]('/',auth[_0x8e72('0xa')](),controller[_0x8e72('0x12')]);router[_0x8e72('0x11')](_0x8e72('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x8e72('0x13')](_0x8e72('0xc'),auth[_0x8e72('0xa')](),controller[_0x8e72('0x14')]);router[_0x8e72('0x15')](_0x8e72('0xc'),auth[_0x8e72('0xa')](),controller[_0x8e72('0x16')]);module[_0x8e72('0x17')]=router; \ No newline at end of file +var _0x6135=['/:id/configurations','getFields','addConfiguration','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','/:id','show','get'];(function(_0x37d006,_0x27291a){var _0x5f19f2=function(_0x2cb473){while(--_0x2cb473){_0x37d006['push'](_0x37d006['shift']());}};_0x5f19f2(++_0x27291a);}(_0x6135,0x94));var _0x5613=function(_0x4ffa64,_0x271035){_0x4ffa64=_0x4ffa64-0x0;var _0x5da001=_0x6135[_0x4ffa64];return _0x5da001;};'use strict';var multer=require('multer');var util=require(_0x5613('0x0'));var path=require('path');var timeout=require(_0x5613('0x1'));var express=require(_0x5613('0x2'));var router=express[_0x5613('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5613('0x4'));var config=require(_0x5613('0x5'));var controller=require(_0x5613('0x6'));router['get']('/',auth[_0x5613('0x7')](),controller[_0x5613('0x8')]);router['get'](_0x5613('0x9'),auth['isAuthenticated'](),controller[_0x5613('0xa')]);router[_0x5613('0xb')](_0x5613('0xc'),auth[_0x5613('0x7')](),controller['getConfigurations']);router[_0x5613('0xb')]('/:id/fields',auth[_0x5613('0x7')](),controller[_0x5613('0xd')]);router['post']('/',auth[_0x5613('0x7')](),controller['create']);router['post'](_0x5613('0xc'),auth[_0x5613('0x7')](),controller[_0x5613('0xe')]);router[_0x5613('0xf')](_0x5613('0x9'),auth[_0x5613('0x7')](),controller[_0x5613('0x10')]);router[_0x5613('0x11')](_0x5613('0x9'),auth[_0x5613('0x7')](),controller[_0x5613('0x12')]);module[_0x5613('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 1573de9..fabb405 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 _0x9cb7=['remoteUri','exports','STRING','username'];(function(_0x488086,_0x5e4b44){var _0x191985=function(_0x273394){while(--_0x273394){_0x488086['push'](_0x488086['shift']());}};_0x191985(++_0x5e4b44);}(_0x9cb7,0x1e9));var _0x79cb=function(_0x15efb0,_0x2e531f){_0x15efb0=_0x15efb0-0x0;var _0x247fba=_0x9cb7[_0x15efb0];return _0x247fba;};'use strict';var Sequelize=require('sequelize');module[_0x79cb('0x0')]={'name':{'type':Sequelize[_0x79cb('0x1')]},'description':{'type':Sequelize[_0x79cb('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x79cb('0x2')},'apiKey':{'type':Sequelize[_0x79cb('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x79cb('0x3')},'serverUrl':{'type':Sequelize[_0x79cb('0x1')]}}; \ No newline at end of file +var _0xf1e9=['STRING','username','remoteUri','sequelize'];(function(_0x4d90ac,_0x2985ae){var _0x5a1d5a=function(_0x237240){while(--_0x237240){_0x4d90ac['push'](_0x4d90ac['shift']());}};_0x5a1d5a(++_0x2985ae);}(_0xf1e9,0xc3));var _0x9f1e=function(_0x3cb5de,_0x5aac05){_0x3cb5de=_0x3cb5de-0x0;var _0x51b3ba=_0xf1e9[_0x3cb5de];return _0x51b3ba;};'use strict';var Sequelize=require(_0x9f1e('0x0'));module['exports']={'name':{'type':Sequelize[_0x9f1e('0x1')]},'description':{'type':Sequelize[_0x9f1e('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x9f1e('0x2')},'apiKey':{'type':Sequelize[_0x9f1e('0x1')]},'remoteUri':{'type':Sequelize[_0x9f1e('0x1')],'unique':_0x9f1e('0x3')},'serverUrl':{'type':Sequelize[_0x9f1e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 39b6594..ee926bc 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 _0xee14=['key','VIRTUAL','filter','merge','includeAll','include','findAll','rows','show','params','find','create','body','findOne','FreshdeskConfiguration','options','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','Basic\x20%s','format','%s:X','apiKey','toString','base64','subject','agent','description','group','source','ticket_type','remove','includes','default','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','update','destroy','stack','name','send','index','FreshdeskAccount','rawAttributes','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','map','type'];(function(_0x4ceb13,_0x5e70f7){var _0x11f6e7=function(_0x1ffe46){while(--_0x1ffe46){_0x4ceb13['push'](_0x4ceb13['shift']());}};_0x11f6e7(++_0x5e70f7);}(_0xee14,0x13a));var _0x4ee1=function(_0xa1441f,_0x424e4e){_0xa1441f=_0xa1441f-0x0;var _0x5dab36=_0xee14[_0xa1441f];return _0x5dab36;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4ee1('0x0'));var zipdir=require(_0x4ee1('0x1'));var jsonpatch=require(_0x4ee1('0x2'));var rp=require(_0x4ee1('0x3'));var moment=require(_0x4ee1('0x4'));var BPromise=require(_0x4ee1('0x5'));var Mustache=require(_0x4ee1('0x6'));var util=require(_0x4ee1('0x7'));var path=require(_0x4ee1('0x8'));var sox=require('sox');var csv=require(_0x4ee1('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4ee1('0xa'));var squel=require(_0x4ee1('0xb'));var crypto=require(_0x4ee1('0xc'));var jsforce=require(_0x4ee1('0xd'));var deskjs=require(_0x4ee1('0xe'));var toCsv=require(_0x4ee1('0x9'));var querystring=require('querystring');var Papa=require(_0x4ee1('0xf'));var authService=require(_0x4ee1('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x4ee1('0x11'));var qs=require(_0x4ee1('0x12'));var logger=require(_0x4ee1('0x13'))(_0x4ee1('0x14'));var utils=require('../../config/utils');var config=require(_0x4ee1('0x15'));var db=require(_0x4ee1('0x16'))['db'];var integrations=require(_0x4ee1('0x17'));var jayson=require(_0x4ee1('0x18'));var client=jayson[_0x4ee1('0x19')][_0x4ee1('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5616d6,_0x390aab,_0x461f99,_0x1096a5){return new BPromise(function(_0x24a915,_0x46d2c2){var _0x1c342a=_0x1096a5||client;return _0x1c342a[_0x4ee1('0x1b')](_0x5616d6,_0x461f99)[_0x4ee1('0x1c')](function(_0xb7eafd){logger['info'](_0x4ee1('0x1d'),_0x390aab,_0x4ee1('0x1e'));logger[_0x4ee1('0x1f')](_0x4ee1('0x20'),_0x390aab,_0x4ee1('0x1e'),JSON[_0x4ee1('0x21')](_0xb7eafd));if(_0xb7eafd[_0x4ee1('0x22')]){if(_0xb7eafd[_0x4ee1('0x22')][_0x4ee1('0x23')]===0x1f4){logger[_0x4ee1('0x22')](_0x4ee1('0x1d'),_0x390aab,_0xb7eafd['error'][_0x4ee1('0x24')]);return _0x46d2c2(_0xb7eafd[_0x4ee1('0x22')][_0x4ee1('0x24')]);}logger[_0x4ee1('0x22')](_0x4ee1('0x1d'),_0x390aab,_0xb7eafd[_0x4ee1('0x22')]['message']);return _0x24a915(_0xb7eafd[_0x4ee1('0x22')][_0x4ee1('0x24')]);}else{logger[_0x4ee1('0x25')](_0x4ee1('0x1d'),_0x390aab,_0x4ee1('0x1e'));_0x24a915(_0xb7eafd[_0x4ee1('0x26')][_0x4ee1('0x24')]);}})[_0x4ee1('0x27')](function(_0x1dc1a8){logger[_0x4ee1('0x22')]('FreshdeskAccount,\x20%s,\x20%s',_0x390aab,_0x1dc1a8);_0x46d2c2(_0x1dc1a8);});});}function respondWithStatusCode(_0x53d43f,_0x14110c){_0x14110c=_0x14110c||0xcc;return function(_0x459e2e){if(_0x459e2e){return _0x53d43f[_0x4ee1('0x28')](_0x14110c);}return _0x53d43f[_0x4ee1('0x29')](_0x14110c)[_0x4ee1('0x2a')]();};}function respondWithResult(_0x28efdc,_0x57d45d){_0x57d45d=_0x57d45d||0xc8;return function(_0x5cc0b5){if(_0x5cc0b5){return _0x28efdc[_0x4ee1('0x29')](_0x57d45d)[_0x4ee1('0x2b')](_0x5cc0b5);}};}function respondWithFilteredResult(_0x4d39dd,_0x35900d){return function(_0x213db8){if(_0x213db8){var _0x36654c=_0x213db8[_0x4ee1('0x2c')],_0x215949=_0x35900d['offset'],_0x2d699c=_0x35900d[_0x4ee1('0x2d')]+_0x35900d['limit'],_0x3c7b2a;if(_0x2d699c>=_0x36654c){_0x2d699c=_0x36654c;_0x3c7b2a=0xc8;}else{_0x3c7b2a=0xce;}_0x4d39dd[_0x4ee1('0x29')](_0x3c7b2a);return _0x4d39dd['set'](_0x4ee1('0x2e'),_0x215949+'-'+_0x2d699c+'/'+_0x36654c)[_0x4ee1('0x2b')](_0x213db8);}return null;};}function patchUpdates(_0x59a34e){return function(_0x13944c){try{jsonpatch[_0x4ee1('0x2f')](_0x13944c,_0x59a34e,!![]);}catch(_0x4d5331){return BPromise[_0x4ee1('0x30')](_0x4d5331);}return _0x13944c['save']();};}function saveUpdates(_0x121301,_0x3d5e6c){return function(_0x33fd38){if(_0x33fd38){return _0x33fd38[_0x4ee1('0x31')](_0x121301)[_0x4ee1('0x1c')](function(_0x58b1a3){return _0x58b1a3;});}return null;};}function removeEntity(_0xf66ab2,_0x9fe2b8){return function(_0x422ba8){if(_0x422ba8){return _0x422ba8[_0x4ee1('0x32')]()[_0x4ee1('0x1c')](function(){_0xf66ab2[_0x4ee1('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aa2b8,_0x2260bd){return function(_0x54482b){if(!_0x54482b){_0x4aa2b8[_0x4ee1('0x28')](0x194);}return _0x54482b;};}function handleError(_0x5a2f6f,_0x963c2b){_0x963c2b=_0x963c2b||0x1f4;return function(_0x3a57bf){logger[_0x4ee1('0x22')](_0x3a57bf[_0x4ee1('0x33')]);if(_0x3a57bf[_0x4ee1('0x34')]){delete _0x3a57bf[_0x4ee1('0x34')];}_0x5a2f6f[_0x4ee1('0x29')](_0x963c2b)[_0x4ee1('0x35')](_0x3a57bf);};}exports[_0x4ee1('0x36')]=function(_0x3cc595,_0x4445d0){var _0x1f3371={},_0x218cbc={},_0x55ac4a={'count':0x0,'rows':[]};var _0x463d90=db[_0x4ee1('0x37')][_0x4ee1('0x38')];_0x218cbc['model']=_['keys'](_0x463d90);_0x218cbc[_0x4ee1('0x39')]=_[_0x4ee1('0x3a')](_0x3cc595[_0x4ee1('0x39')]);_0x218cbc[_0x4ee1('0x3b')]=_['intersection'](_0x218cbc[_0x4ee1('0x3c')],_0x218cbc[_0x4ee1('0x39')]);_0x1f3371[_0x4ee1('0x3d')]=_[_0x4ee1('0x3e')](_0x218cbc[_0x4ee1('0x3c')],qs[_0x4ee1('0x3f')](_0x3cc595[_0x4ee1('0x39')][_0x4ee1('0x3f')]));_0x1f3371['attributes']=_0x1f3371[_0x4ee1('0x3d')][_0x4ee1('0x40')]?_0x1f3371[_0x4ee1('0x3d')]:_0x218cbc[_0x4ee1('0x3c')];if(!_0x3cc595[_0x4ee1('0x39')][_0x4ee1('0x41')]('nolimit')){_0x1f3371[_0x4ee1('0x42')]=qs[_0x4ee1('0x42')](_0x3cc595[_0x4ee1('0x39')][_0x4ee1('0x42')]);_0x1f3371[_0x4ee1('0x2d')]=qs[_0x4ee1('0x2d')](_0x3cc595[_0x4ee1('0x39')][_0x4ee1('0x2d')]);}_0x1f3371[_0x4ee1('0x43')]=qs[_0x4ee1('0x44')](_0x3cc595[_0x4ee1('0x39')][_0x4ee1('0x44')]);_0x1f3371[_0x4ee1('0x45')]=qs['filters'](_[_0x4ee1('0x46')](_0x3cc595[_0x4ee1('0x39')],_0x218cbc['filters']));if(_0x3cc595[_0x4ee1('0x39')]['filter']){_0x1f3371[_0x4ee1('0x45')]=_['merge'](_0x1f3371[_0x4ee1('0x45')],{'$or':_[_0x4ee1('0x47')](_0x463d90,function(_0x557126){if(_0x557126[_0x4ee1('0x48')][_0x4ee1('0x49')]!==_0x4ee1('0x4a')){var _0x3dfd9c={};_0x3dfd9c[_0x557126['field']]={'$like':'%'+_0x3cc595[_0x4ee1('0x39')][_0x4ee1('0x4b')]+'%'};return _0x3dfd9c;}})});}_0x1f3371=_[_0x4ee1('0x4c')]({},_0x1f3371,_0x3cc595['options']);var _0x4fbe92={'where':_0x1f3371[_0x4ee1('0x45')]};return db[_0x4ee1('0x37')][_0x4ee1('0x2c')](_0x4fbe92)[_0x4ee1('0x1c')](function(_0x15a48a){_0x55ac4a['count']=_0x15a48a;if(_0x3cc595['query'][_0x4ee1('0x4d')]){_0x1f3371[_0x4ee1('0x4e')]=[{'all':!![]}];}return db[_0x4ee1('0x37')][_0x4ee1('0x4f')](_0x1f3371);})['then'](function(_0x3d6bf4){_0x55ac4a[_0x4ee1('0x50')]=_0x3d6bf4;return _0x55ac4a;})['then'](respondWithFilteredResult(_0x4445d0,_0x1f3371))[_0x4ee1('0x27')](handleError(_0x4445d0,null));};exports[_0x4ee1('0x51')]=function(_0x21edeb,_0x28e7b8){var _0x38db17={'raw':![],'where':{'id':_0x21edeb[_0x4ee1('0x52')]['id']}},_0x154ec0={};_0x154ec0[_0x4ee1('0x3c')]=_[_0x4ee1('0x3a')](db['FreshdeskAccount']['rawAttributes']);_0x154ec0[_0x4ee1('0x39')]=_[_0x4ee1('0x3a')](_0x21edeb[_0x4ee1('0x39')]);_0x154ec0[_0x4ee1('0x3b')]=_['intersection'](_0x154ec0[_0x4ee1('0x3c')],_0x154ec0[_0x4ee1('0x39')]);_0x38db17[_0x4ee1('0x3d')]=_[_0x4ee1('0x3e')](_0x154ec0[_0x4ee1('0x3c')],qs['fields'](_0x21edeb[_0x4ee1('0x39')][_0x4ee1('0x3f')]));_0x38db17[_0x4ee1('0x3d')]=_0x38db17['attributes'][_0x4ee1('0x40')]?_0x38db17['attributes']:_0x154ec0[_0x4ee1('0x3c')];if(_0x21edeb['query'][_0x4ee1('0x4d')]){_0x38db17['include']=[{'all':!![]}];}_0x38db17=_[_0x4ee1('0x4c')]({},_0x38db17,_0x21edeb['options']);return db[_0x4ee1('0x37')][_0x4ee1('0x53')](_0x38db17)[_0x4ee1('0x1c')](handleEntityNotFound(_0x28e7b8,null))['then'](respondWithResult(_0x28e7b8,null))[_0x4ee1('0x27')](handleError(_0x28e7b8,null));};exports[_0x4ee1('0x54')]=function(_0xcdb873,_0x38b619){return db[_0x4ee1('0x37')][_0x4ee1('0x54')](_0xcdb873[_0x4ee1('0x55')],{})['then'](respondWithResult(_0x38b619,0xc9))['catch'](handleError(_0x38b619,null));};exports[_0x4ee1('0x31')]=function(_0xcddc5d,_0xf58cd8){if(_0xcddc5d[_0x4ee1('0x55')]['id']){delete _0xcddc5d[_0x4ee1('0x55')]['id'];}return db[_0x4ee1('0x37')][_0x4ee1('0x53')]({'where':{'id':_0xcddc5d[_0x4ee1('0x52')]['id']}})[_0x4ee1('0x1c')](handleEntityNotFound(_0xf58cd8,null))[_0x4ee1('0x1c')](saveUpdates(_0xcddc5d[_0x4ee1('0x55')],null))[_0x4ee1('0x1c')](respondWithResult(_0xf58cd8,null))[_0x4ee1('0x27')](handleError(_0xf58cd8,null));};exports['destroy']=function(_0x1bafa8,_0x547c6c){return db[_0x4ee1('0x37')][_0x4ee1('0x53')]({'where':{'id':_0x1bafa8['params']['id']}})[_0x4ee1('0x1c')](handleEntityNotFound(_0x547c6c,null))[_0x4ee1('0x1c')](removeEntity(_0x547c6c,null))['catch'](handleError(_0x547c6c,null));};exports['getConfigurations']=function(_0x130166,_0x49df21,_0x1ce99e){var _0x2785b8={};var _0x59ba70={};var _0x43489c;var _0xa60512;return db[_0x4ee1('0x37')][_0x4ee1('0x56')]({'where':{'id':_0x130166[_0x4ee1('0x52')]['id']}})[_0x4ee1('0x1c')](handleEntityNotFound(_0x49df21,null))[_0x4ee1('0x1c')](function(_0x5f5694){if(_0x5f5694){_0x43489c=_0x5f5694;_0x59ba70['model']=_[_0x4ee1('0x3a')](db[_0x4ee1('0x57')]['rawAttributes']);_0x59ba70[_0x4ee1('0x39')]=_[_0x4ee1('0x3a')](_0x130166[_0x4ee1('0x39')]);_0x59ba70['filters']=_[_0x4ee1('0x3e')](_0x59ba70['model'],_0x59ba70[_0x4ee1('0x39')]);_0x2785b8['attributes']=_['intersection'](_0x59ba70[_0x4ee1('0x3c')],qs[_0x4ee1('0x3f')](_0x130166[_0x4ee1('0x39')][_0x4ee1('0x3f')]));_0x2785b8[_0x4ee1('0x3d')]=_0x2785b8['attributes'][_0x4ee1('0x40')]?_0x2785b8[_0x4ee1('0x3d')]:_0x59ba70[_0x4ee1('0x3c')];_0x2785b8['order']=qs[_0x4ee1('0x44')](_0x130166[_0x4ee1('0x39')][_0x4ee1('0x44')]);_0x2785b8[_0x4ee1('0x45')]=qs[_0x4ee1('0x3b')](_[_0x4ee1('0x46')](_0x130166[_0x4ee1('0x39')],_0x59ba70[_0x4ee1('0x3b')]));if(_0x130166[_0x4ee1('0x39')][_0x4ee1('0x4b')]){_0x2785b8[_0x4ee1('0x45')]=_[_0x4ee1('0x4c')](_0x2785b8['where'],{'$or':_[_0x4ee1('0x47')](_0x2785b8['attributes'],function(_0x25cfc3){var _0x4b9baa={};_0x4b9baa[_0x25cfc3]={'$like':'%'+_0x130166[_0x4ee1('0x39')][_0x4ee1('0x4b')]+'%'};return _0x4b9baa;})});}_0x2785b8=_[_0x4ee1('0x4c')]({},_0x2785b8,_0x130166[_0x4ee1('0x58')]);return _0x43489c[_0x4ee1('0x59')](_0x2785b8);}})[_0x4ee1('0x1c')](function(_0x342aa1){if(_0x342aa1){_0xa60512=_0x342aa1[_0x4ee1('0x40')];if(!_0x130166[_0x4ee1('0x39')][_0x4ee1('0x41')](_0x4ee1('0x5a'))){_0x2785b8[_0x4ee1('0x42')]=qs['limit'](_0x130166[_0x4ee1('0x39')][_0x4ee1('0x42')]);_0x2785b8[_0x4ee1('0x2d')]=qs['offset'](_0x130166['query'][_0x4ee1('0x2d')]);}return _0x43489c[_0x4ee1('0x59')](_0x2785b8);}})['then'](function(_0x318e43){if(_0x318e43){return _0x318e43?{'count':_0xa60512,'rows':_0x318e43}:null;}})[_0x4ee1('0x1c')](respondWithResult(_0x49df21,null))[_0x4ee1('0x27')](handleError(_0x49df21,null));};exports[_0x4ee1('0x5b')]=function(_0x42240f,_0x1e6d5d,_0x243856){if(_0x42240f[_0x4ee1('0x55')]['id']){delete _0x42240f[_0x4ee1('0x55')]['id'];}return db[_0x4ee1('0x37')]['findOne']({'where':{'id':_0x42240f[_0x4ee1('0x52')]['id']}})[_0x4ee1('0x1c')](handleEntityNotFound(_0x1e6d5d,null))['then'](function(_0x52bbda){if(_0x52bbda){_0x42240f[_0x4ee1('0x55')][_0x4ee1('0x5c')]=_0x52bbda['id'];_0x42240f[_0x4ee1('0x55')][_0x4ee1('0x5d')]=integrations[_0x4ee1('0x5e')](_0x42240f[_0x4ee1('0x55')][_0x4ee1('0x5f')],_0x42240f['body'][_0x4ee1('0x48')]);_0x42240f[_0x4ee1('0x55')][_0x4ee1('0x60')]=integrations[_0x4ee1('0x61')](_0x42240f[_0x4ee1('0x55')]['channel'],_0x42240f[_0x4ee1('0x55')]['type']);return db[_0x4ee1('0x57')][_0x4ee1('0x54')](_0x42240f['body'],{'include':[{'model':db['FreshdeskField'],'as':_0x4ee1('0x5d')},{'model':db[_0x4ee1('0x62')],'as':'Descriptions'}]});}return null;})[_0x4ee1('0x1c')](respondWithResult(_0x1e6d5d,null))['catch'](handleError(_0x1e6d5d,null));};exports['getFields']=function(_0x180c98,_0x1de06a,_0x371f9c){var _0x3bee28='';return db[_0x4ee1('0x37')][_0x4ee1('0x56')]({'where':{'id':_0x180c98['params']['id']},'attributes':['id',_0x4ee1('0x63'),'apiKey']})['then'](handleEntityNotFound(_0x1de06a,null))[_0x4ee1('0x1c')](function(_0x2c1c65){if(_0x2c1c65){_0x3bee28=_0x2c1c65[_0x4ee1('0x63')];var _0xa5c1a=_0x3bee28[_0x4ee1('0x64')](-0x1);if(_0xa5c1a==='/'){_0x3bee28=_0x3bee28[_0x4ee1('0x65')](0x0,_0x3bee28[_0x4ee1('0x66')](_0xa5c1a));}return rp({'method':_0x4ee1('0x67'),'uri':util['format'](_0x4ee1('0x68'),_0x3bee28,_0x4ee1('0x69')),'headers':{'Authorization':util['format'](_0x4ee1('0x6a'),new Buffer(util[_0x4ee1('0x6b')](_0x4ee1('0x6c'),_0x2c1c65[_0x4ee1('0x6d')]))[_0x4ee1('0x6e')](_0x4ee1('0x6f')))},'json':!![]});}})[_0x4ee1('0x1c')](function(_0x4dee3a){if(_0x4dee3a){var _0x155cde=['requester',_0x4ee1('0x70'),_0x4ee1('0x71'),_0x4ee1('0x72'),_0x4ee1('0x29'),'priority',_0x4ee1('0x73'),_0x4ee1('0x74'),_0x4ee1('0x75'),'group','company'];_[_0x4ee1('0x76')](_0x4dee3a,function(_0x4b4ad5){return _0x155cde[_0x4ee1('0x77')](_0x4b4ad5[_0x4ee1('0x34')])||!_0x4b4ad5[_0x4ee1('0x78')]&&_0x4b4ad5['type']!=='custom_text';});return{'count':_0x4dee3a[_0x4ee1('0x40')],'rows':_[_0x4ee1('0x47')](_0x4dee3a,function(_0x33af51){return{'id':_0x33af51[_0x4ee1('0x34')],'name':_0x33af51[_0x4ee1('0x79')],'custom':!_0x33af51[_0x4ee1('0x78')],'options':_0x33af51[_0x4ee1('0x7a')]?_['map'](_0x33af51['choices'],function(_0x50645b){return{'name':_[_0x4ee1('0x7b')](_0x50645b),'value':_0x50645b};}):[]};})};}})[_0x4ee1('0x1c')](respondWithResult(_0x1de06a,null))[_0x4ee1('0x27')](function(_0xd919bc){var _0x4db801=_0x180c98[_0x4ee1('0x39')]['test']?0x1f4:_0xd919bc[_0x4ee1('0x7c')]||0x1f4;logger[_0x4ee1('0x22')](_0x4ee1('0x7d'),_0x4ee1('0x7e'),_0x4db801,JSON[_0x4ee1('0x21')](_0xd919bc));delete _0xd919bc[_0x4ee1('0x34')];if(_0x4db801===0x191){_0x4db801=0x190;}_0x1de06a['status'](_0x4db801)[_0x4ee1('0x35')](_0x180c98[_0x4ee1('0x39')][_0x4ee1('0x7f')]?{'message':_0x4ee1('0x80'),'statusCode':_0xd919bc[_0x4ee1('0x7c')]}:_0xd919bc);});}; \ No newline at end of file +var _0x33d4=['update','destroy','name','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','type','key','field','merge','options','FreshdeskAccount','includeAll','include','rows','params','length','find','catch','create','body','getConfigurations','FreshdeskConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','FreshdeskField','getFields','findOne','apiKey','slice','GET','format','%s/%s','Basic\x20%s','%s:X','toString','requester','subject','agent','description','priority','group','ticket_type','company','includes','default','custom_text','label','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','offset','limit','set','Content-Range','json','reject','save'];(function(_0x36e312,_0x57623e){var _0x2a0bb4=function(_0x443e97){while(--_0x443e97){_0x36e312['push'](_0x36e312['shift']());}};_0x2a0bb4(++_0x57623e);}(_0x33d4,0x1a4));var _0x433d=function(_0x3671e1,_0x2332ef){_0x3671e1=_0x3671e1-0x0;var _0xd6b3e=_0x33d4[_0x3671e1];return _0xd6b3e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x433d('0x0'));var rimraf=require(_0x433d('0x1'));var zipdir=require(_0x433d('0x2'));var jsonpatch=require(_0x433d('0x3'));var rp=require(_0x433d('0x4'));var moment=require(_0x433d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x433d('0x6'));var util=require(_0x433d('0x7'));var path=require('path');var sox=require(_0x433d('0x8'));var csv=require(_0x433d('0x9'));var ejs=require(_0x433d('0xa'));var fs=require('fs');var _=require(_0x433d('0xb'));var squel=require(_0x433d('0xc'));var crypto=require('crypto');var jsforce=require(_0x433d('0xd'));var deskjs=require(_0x433d('0xe'));var toCsv=require(_0x433d('0x9'));var querystring=require('querystring');var Papa=require(_0x433d('0xf'));var authService=require('../../components/auth/service');var hardwareService=require(_0x433d('0x10'));var Redis=require(_0x433d('0x11'));var qs=require(_0x433d('0x12'));var logger=require('../../config/logger')(_0x433d('0x13'));var utils=require('../../config/utils');var config=require(_0x433d('0x14'));var db=require(_0x433d('0x15'))['db'];var integrations=require(_0x433d('0x16'));var jayson=require(_0x433d('0x17'));var client=jayson[_0x433d('0x18')][_0x433d('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x55e5ca,_0x35a198,_0xe09f63,_0x1069b1){return new BPromise(function(_0x56584b,_0x28bd82){var _0x505c6c=_0x1069b1||client;return _0x505c6c[_0x433d('0x1a')](_0x55e5ca,_0xe09f63)[_0x433d('0x1b')](function(_0x477db6){logger['info'](_0x433d('0x1c'),_0x35a198,_0x433d('0x1d'));logger[_0x433d('0x1e')](_0x433d('0x1f'),_0x35a198,'request\x20sent',JSON[_0x433d('0x20')](_0x477db6));if(_0x477db6[_0x433d('0x21')]){if(_0x477db6[_0x433d('0x21')][_0x433d('0x22')]===0x1f4){logger[_0x433d('0x21')](_0x433d('0x1c'),_0x35a198,_0x477db6['error'][_0x433d('0x23')]);return _0x28bd82(_0x477db6[_0x433d('0x21')]['message']);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x35a198,_0x477db6[_0x433d('0x21')]['message']);return _0x56584b(_0x477db6['error'][_0x433d('0x23')]);}else{logger[_0x433d('0x24')](_0x433d('0x1c'),_0x35a198,_0x433d('0x1d'));_0x56584b(_0x477db6[_0x433d('0x25')][_0x433d('0x23')]);}})['catch'](function(_0x16a402){logger['error'](_0x433d('0x1c'),_0x35a198,_0x16a402);_0x28bd82(_0x16a402);});});}function respondWithStatusCode(_0x41aebb,_0x465504){_0x465504=_0x465504||0xcc;return function(_0xc539ad){if(_0xc539ad){return _0x41aebb[_0x433d('0x26')](_0x465504);}return _0x41aebb[_0x433d('0x27')](_0x465504)[_0x433d('0x28')]();};}function respondWithResult(_0x2639e0,_0x354324){_0x354324=_0x354324||0xc8;return function(_0x1bdcdd){if(_0x1bdcdd){return _0x2639e0[_0x433d('0x27')](_0x354324)['json'](_0x1bdcdd);}};}function respondWithFilteredResult(_0x1ed449,_0x459073){return function(_0x2c3c5c){if(_0x2c3c5c){var _0x30a13b=_0x2c3c5c['count'],_0x42cb27=_0x459073[_0x433d('0x29')],_0x45105c=_0x459073[_0x433d('0x29')]+_0x459073[_0x433d('0x2a')],_0x43bcb5;if(_0x45105c>=_0x30a13b){_0x45105c=_0x30a13b;_0x43bcb5=0xc8;}else{_0x43bcb5=0xce;}_0x1ed449['status'](_0x43bcb5);return _0x1ed449[_0x433d('0x2b')](_0x433d('0x2c'),_0x42cb27+'-'+_0x45105c+'/'+_0x30a13b)[_0x433d('0x2d')](_0x2c3c5c);}return null;};}function patchUpdates(_0x28d1c9){return function(_0x4eff36){try{jsonpatch['apply'](_0x4eff36,_0x28d1c9,!![]);}catch(_0x1a6e1a){return BPromise[_0x433d('0x2e')](_0x1a6e1a);}return _0x4eff36[_0x433d('0x2f')]();};}function saveUpdates(_0x5737a9,_0x579d3a){return function(_0x42b1d2){if(_0x42b1d2){return _0x42b1d2[_0x433d('0x30')](_0x5737a9)[_0x433d('0x1b')](function(_0x4bb5c8){return _0x4bb5c8;});}return null;};}function removeEntity(_0x582a2a,_0x150ea8){return function(_0x106f6c){if(_0x106f6c){return _0x106f6c[_0x433d('0x31')]()[_0x433d('0x1b')](function(){_0x582a2a[_0x433d('0x27')](0xcc)[_0x433d('0x28')]();});}};}function handleEntityNotFound(_0x576cc4,_0x28f6d8){return function(_0x4d3509){if(!_0x4d3509){_0x576cc4[_0x433d('0x26')](0x194);}return _0x4d3509;};}function handleError(_0x1002f3,_0x327cd7){_0x327cd7=_0x327cd7||0x1f4;return function(_0xa953bd){logger[_0x433d('0x21')](_0xa953bd['stack']);if(_0xa953bd[_0x433d('0x32')]){delete _0xa953bd[_0x433d('0x32')];}_0x1002f3[_0x433d('0x27')](_0x327cd7)['send'](_0xa953bd);};}exports['index']=function(_0x6ade38,_0x653cb6){var _0x527b3b={},_0x4e4955={},_0x4a93f6={'count':0x0,'rows':[]};var _0x177375=db['FreshdeskAccount'][_0x433d('0x33')];_0x4e4955[_0x433d('0x34')]=_[_0x433d('0x35')](_0x177375);_0x4e4955[_0x433d('0x36')]=_[_0x433d('0x35')](_0x6ade38[_0x433d('0x36')]);_0x4e4955[_0x433d('0x37')]=_[_0x433d('0x38')](_0x4e4955[_0x433d('0x34')],_0x4e4955[_0x433d('0x36')]);_0x527b3b[_0x433d('0x39')]=_['intersection'](_0x4e4955[_0x433d('0x34')],qs['fields'](_0x6ade38[_0x433d('0x36')][_0x433d('0x3a')]));_0x527b3b[_0x433d('0x39')]=_0x527b3b[_0x433d('0x39')]['length']?_0x527b3b[_0x433d('0x39')]:_0x4e4955[_0x433d('0x34')];if(!_0x6ade38[_0x433d('0x36')][_0x433d('0x3b')](_0x433d('0x3c'))){_0x527b3b[_0x433d('0x2a')]=qs[_0x433d('0x2a')](_0x6ade38[_0x433d('0x36')][_0x433d('0x2a')]);_0x527b3b[_0x433d('0x29')]=qs[_0x433d('0x29')](_0x6ade38['query'][_0x433d('0x29')]);}_0x527b3b[_0x433d('0x3d')]=qs[_0x433d('0x3e')](_0x6ade38[_0x433d('0x36')][_0x433d('0x3e')]);_0x527b3b['where']=qs[_0x433d('0x37')](_[_0x433d('0x3f')](_0x6ade38[_0x433d('0x36')],_0x4e4955[_0x433d('0x37')]));if(_0x6ade38['query'][_0x433d('0x40')]){_0x527b3b[_0x433d('0x41')]=_['merge'](_0x527b3b[_0x433d('0x41')],{'$or':_[_0x433d('0x42')](_0x177375,function(_0x4cb61b){if(_0x4cb61b[_0x433d('0x43')][_0x433d('0x44')]!=='VIRTUAL'){var _0x3a1141={};_0x3a1141[_0x4cb61b[_0x433d('0x45')]]={'$like':'%'+_0x6ade38[_0x433d('0x36')][_0x433d('0x40')]+'%'};return _0x3a1141;}})});}_0x527b3b=_[_0x433d('0x46')]({},_0x527b3b,_0x6ade38[_0x433d('0x47')]);var _0x1e41f1={'where':_0x527b3b[_0x433d('0x41')]};return db[_0x433d('0x48')]['count'](_0x1e41f1)[_0x433d('0x1b')](function(_0x4df903){_0x4a93f6['count']=_0x4df903;if(_0x6ade38['query'][_0x433d('0x49')]){_0x527b3b[_0x433d('0x4a')]=[{'all':!![]}];}return db[_0x433d('0x48')]['findAll'](_0x527b3b);})[_0x433d('0x1b')](function(_0x1c362b){_0x4a93f6[_0x433d('0x4b')]=_0x1c362b;return _0x4a93f6;})['then'](respondWithFilteredResult(_0x653cb6,_0x527b3b))['catch'](handleError(_0x653cb6,null));};exports['show']=function(_0x57d038,_0x11266a){var _0x1f113f={'raw':![],'where':{'id':_0x57d038[_0x433d('0x4c')]['id']}},_0xd54daa={};_0xd54daa[_0x433d('0x34')]=_['keys'](db[_0x433d('0x48')][_0x433d('0x33')]);_0xd54daa[_0x433d('0x36')]=_[_0x433d('0x35')](_0x57d038[_0x433d('0x36')]);_0xd54daa[_0x433d('0x37')]=_[_0x433d('0x38')](_0xd54daa[_0x433d('0x34')],_0xd54daa[_0x433d('0x36')]);_0x1f113f['attributes']=_[_0x433d('0x38')](_0xd54daa['model'],qs[_0x433d('0x3a')](_0x57d038[_0x433d('0x36')][_0x433d('0x3a')]));_0x1f113f[_0x433d('0x39')]=_0x1f113f[_0x433d('0x39')][_0x433d('0x4d')]?_0x1f113f['attributes']:_0xd54daa[_0x433d('0x34')];if(_0x57d038[_0x433d('0x36')]['includeAll']){_0x1f113f['include']=[{'all':!![]}];}_0x1f113f=_[_0x433d('0x46')]({},_0x1f113f,_0x57d038['options']);return db[_0x433d('0x48')][_0x433d('0x4e')](_0x1f113f)['then'](handleEntityNotFound(_0x11266a,null))[_0x433d('0x1b')](respondWithResult(_0x11266a,null))[_0x433d('0x4f')](handleError(_0x11266a,null));};exports[_0x433d('0x50')]=function(_0x189b21,_0x3bf4a0){return db[_0x433d('0x48')][_0x433d('0x50')](_0x189b21[_0x433d('0x51')],{})[_0x433d('0x1b')](respondWithResult(_0x3bf4a0,0xc9))[_0x433d('0x4f')](handleError(_0x3bf4a0,null));};exports[_0x433d('0x30')]=function(_0x237327,_0x3129aa){if(_0x237327[_0x433d('0x51')]['id']){delete _0x237327[_0x433d('0x51')]['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x237327[_0x433d('0x4c')]['id']}})[_0x433d('0x1b')](handleEntityNotFound(_0x3129aa,null))[_0x433d('0x1b')](saveUpdates(_0x237327['body'],null))[_0x433d('0x1b')](respondWithResult(_0x3129aa,null))[_0x433d('0x4f')](handleError(_0x3129aa,null));};exports['destroy']=function(_0x2f051d,_0x3f9a5c){return db[_0x433d('0x48')]['find']({'where':{'id':_0x2f051d[_0x433d('0x4c')]['id']}})[_0x433d('0x1b')](handleEntityNotFound(_0x3f9a5c,null))[_0x433d('0x1b')](removeEntity(_0x3f9a5c,null))[_0x433d('0x4f')](handleError(_0x3f9a5c,null));};exports[_0x433d('0x52')]=function(_0x2b1cd2,_0x2d8126,_0x2ca0cb){var _0x11a24b={};var _0x1ff8ed={};var _0x251f44;var _0x2c64ac;return db[_0x433d('0x48')]['findOne']({'where':{'id':_0x2b1cd2['params']['id']}})[_0x433d('0x1b')](handleEntityNotFound(_0x2d8126,null))[_0x433d('0x1b')](function(_0x4ec7ad){if(_0x4ec7ad){_0x251f44=_0x4ec7ad;_0x1ff8ed[_0x433d('0x34')]=_['keys'](db[_0x433d('0x53')][_0x433d('0x33')]);_0x1ff8ed['query']=_[_0x433d('0x35')](_0x2b1cd2[_0x433d('0x36')]);_0x1ff8ed['filters']=_[_0x433d('0x38')](_0x1ff8ed[_0x433d('0x34')],_0x1ff8ed[_0x433d('0x36')]);_0x11a24b[_0x433d('0x39')]=_[_0x433d('0x38')](_0x1ff8ed[_0x433d('0x34')],qs[_0x433d('0x3a')](_0x2b1cd2[_0x433d('0x36')][_0x433d('0x3a')]));_0x11a24b['attributes']=_0x11a24b[_0x433d('0x39')]['length']?_0x11a24b[_0x433d('0x39')]:_0x1ff8ed[_0x433d('0x34')];_0x11a24b[_0x433d('0x3d')]=qs[_0x433d('0x3e')](_0x2b1cd2[_0x433d('0x36')][_0x433d('0x3e')]);_0x11a24b[_0x433d('0x41')]=qs[_0x433d('0x37')](_[_0x433d('0x3f')](_0x2b1cd2[_0x433d('0x36')],_0x1ff8ed['filters']));if(_0x2b1cd2[_0x433d('0x36')][_0x433d('0x40')]){_0x11a24b['where']=_['merge'](_0x11a24b[_0x433d('0x41')],{'$or':_[_0x433d('0x42')](_0x11a24b[_0x433d('0x39')],function(_0x590fb1){var _0x194b6f={};_0x194b6f[_0x590fb1]={'$like':'%'+_0x2b1cd2[_0x433d('0x36')][_0x433d('0x40')]+'%'};return _0x194b6f;})});}_0x11a24b=_[_0x433d('0x46')]({},_0x11a24b,_0x2b1cd2[_0x433d('0x47')]);return _0x251f44['getConfigurations'](_0x11a24b);}})['then'](function(_0x575690){if(_0x575690){_0x2c64ac=_0x575690[_0x433d('0x4d')];if(!_0x2b1cd2[_0x433d('0x36')][_0x433d('0x3b')](_0x433d('0x3c'))){_0x11a24b[_0x433d('0x2a')]=qs['limit'](_0x2b1cd2[_0x433d('0x36')][_0x433d('0x2a')]);_0x11a24b[_0x433d('0x29')]=qs[_0x433d('0x29')](_0x2b1cd2[_0x433d('0x36')][_0x433d('0x29')]);}return _0x251f44['getConfigurations'](_0x11a24b);}})[_0x433d('0x1b')](function(_0x356288){if(_0x356288){return _0x356288?{'count':_0x2c64ac,'rows':_0x356288}:null;}})[_0x433d('0x1b')](respondWithResult(_0x2d8126,null))[_0x433d('0x4f')](handleError(_0x2d8126,null));};exports[_0x433d('0x54')]=function(_0x30f8a5,_0x153060,_0x347f00){if(_0x30f8a5['body']['id']){delete _0x30f8a5[_0x433d('0x51')]['id'];}return db[_0x433d('0x48')]['findOne']({'where':{'id':_0x30f8a5[_0x433d('0x4c')]['id']}})[_0x433d('0x1b')](handleEntityNotFound(_0x153060,null))[_0x433d('0x1b')](function(_0x5aa10a){if(_0x5aa10a){_0x30f8a5[_0x433d('0x51')]['AccountId']=_0x5aa10a['id'];_0x30f8a5['body'][_0x433d('0x55')]=integrations[_0x433d('0x56')](_0x30f8a5[_0x433d('0x51')][_0x433d('0x57')],_0x30f8a5[_0x433d('0x51')][_0x433d('0x43')]);_0x30f8a5['body'][_0x433d('0x58')]=integrations['getDescriptions'](_0x30f8a5[_0x433d('0x51')][_0x433d('0x57')],_0x30f8a5[_0x433d('0x51')][_0x433d('0x43')]);return db[_0x433d('0x53')]['create'](_0x30f8a5[_0x433d('0x51')],{'include':[{'model':db[_0x433d('0x59')],'as':_0x433d('0x55')},{'model':db[_0x433d('0x59')],'as':_0x433d('0x58')}]});}return null;})['then'](respondWithResult(_0x153060,null))[_0x433d('0x4f')](handleError(_0x153060,null));};exports[_0x433d('0x5a')]=function(_0x34aef6,_0x20bed3,_0x849088){var _0x4a722c='';return db[_0x433d('0x48')][_0x433d('0x5b')]({'where':{'id':_0x34aef6['params']['id']},'attributes':['id','remoteUri',_0x433d('0x5c')]})['then'](handleEntityNotFound(_0x20bed3,null))[_0x433d('0x1b')](function(_0x4e2d34){if(_0x4e2d34){_0x4a722c=_0x4e2d34['remoteUri'];var _0x2d1c8e=_0x4a722c[_0x433d('0x5d')](-0x1);if(_0x2d1c8e==='/'){_0x4a722c=_0x4a722c['substring'](0x0,_0x4a722c['lastIndexOf'](_0x2d1c8e));}return rp({'method':_0x433d('0x5e'),'uri':util[_0x433d('0x5f')](_0x433d('0x60'),_0x4a722c,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x433d('0x5f')](_0x433d('0x61'),new Buffer(util['format'](_0x433d('0x62'),_0x4e2d34['apiKey']))[_0x433d('0x63')]('base64'))},'json':!![]});}})['then'](function(_0xb5f46d){if(_0xb5f46d){var _0x19cd2a=[_0x433d('0x64'),_0x433d('0x65'),_0x433d('0x66'),_0x433d('0x67'),_0x433d('0x27'),_0x433d('0x68'),_0x433d('0x69'),'source',_0x433d('0x6a'),_0x433d('0x69'),_0x433d('0x6b')];_['remove'](_0xb5f46d,function(_0x249626){return _0x19cd2a[_0x433d('0x6c')](_0x249626[_0x433d('0x32')])||!_0x249626[_0x433d('0x6d')]&&_0x249626[_0x433d('0x43')]!==_0x433d('0x6e');});return{'count':_0xb5f46d[_0x433d('0x4d')],'rows':_[_0x433d('0x42')](_0xb5f46d,function(_0x27c88c){return{'id':_0x27c88c[_0x433d('0x32')],'name':_0x27c88c[_0x433d('0x6f')],'custom':!_0x27c88c[_0x433d('0x6d')],'options':_0x27c88c[_0x433d('0x70')]?_[_0x433d('0x42')](_0x27c88c[_0x433d('0x70')],function(_0x6228dd){return{'name':_['capitalize'](_0x6228dd),'value':_0x6228dd};}):[]};})};}})[_0x433d('0x1b')](respondWithResult(_0x20bed3,null))[_0x433d('0x4f')](function(_0x1b63a4){var _0x18887b=_0x34aef6[_0x433d('0x36')][_0x433d('0x71')]?0x1f4:_0x1b63a4[_0x433d('0x72')]||0x1f4;logger[_0x433d('0x21')](_0x433d('0x73'),'getFields',_0x18887b,JSON[_0x433d('0x20')](_0x1b63a4));delete _0x1b63a4[_0x433d('0x32')];if(_0x18887b===0x191){_0x18887b=0x190;}_0x20bed3['status'](_0x18887b)[_0x433d('0x74')](_0x34aef6[_0x433d('0x36')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x1b63a4[_0x433d('0x72')]}:_0x1b63a4);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 3342b4c..00ae1a8 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 _0x5c9f=['../../components/integrations/configuration','exports','FreshdeskAccount','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x44ec93,_0x2db09e){var _0x3787b2=function(_0x50fa19){while(--_0x50fa19){_0x44ec93['push'](_0x44ec93['shift']());}};_0x3787b2(++_0x2db09e);}(_0x5c9f,0x173));var _0xf5c9=function(_0x5ca3d6,_0x5c7599){_0x5ca3d6=_0x5ca3d6-0x0;var _0x3a1032=_0x5c9f[_0x5ca3d6];return _0x3a1032;};'use strict';var _=require('lodash');var util=require(_0xf5c9('0x0'));var logger=require(_0xf5c9('0x1'))('api');var moment=require(_0xf5c9('0x2'));var BPromise=require(_0xf5c9('0x3'));var rp=require(_0xf5c9('0x4'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xf5c9('0x5'));module[_0xf5c9('0x6')]=function(_0x4cd9bd,_0x318dfa){return _0x4cd9bd['define'](_0xf5c9('0x7'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a3a=['moment','request-promise','../../components/integrations/configuration','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api'];(function(_0x442f5b,_0x39d79d){var _0x19fd96=function(_0x419b3f){while(--_0x419b3f){_0x442f5b['push'](_0x442f5b['shift']());}};_0x19fd96(++_0x39d79d);}(_0x4a3a,0x140));var _0xa4a3=function(_0x2a1769,_0xad47a4){_0x2a1769=_0x2a1769-0x0;var _0x214a8a=_0x4a3a[_0x2a1769];return _0x214a8a;};'use strict';var _=require(_0xa4a3('0x0'));var util=require(_0xa4a3('0x1'));var logger=require(_0xa4a3('0x2'))(_0xa4a3('0x3'));var moment=require(_0xa4a3('0x4'));var BPromise=require('bluebird');var rp=require(_0xa4a3('0x5'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xa4a3('0x6'));module['exports']=function(_0x1ce5bf,_0x169ab4){return _0x1ce5bf['define'](_0xa4a3('0x7'),attributes,{'tableName':_0xa4a3('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 e5f94be..c4f0dd9 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 _0x5ba8=['limit','include','model','map','attributes','where','ShowFreshdeskAccount','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options'];(function(_0x3c9690,_0xf0ac47){var _0x2cab97=function(_0x5d7940){while(--_0x5d7940){_0x3c9690['push'](_0x3c9690['shift']());}};_0x2cab97(++_0xf0ac47);}(_0x5ba8,0x1a0));var _0x85ba=function(_0x2e3d93,_0x359bf5){_0x2e3d93=_0x2e3d93-0x0;var _0x2b3709=_0x5ba8[_0x2e3d93];return _0x2b3709;};'use strict';var _=require(_0x85ba('0x0'));var util=require('util');var moment=require(_0x85ba('0x1'));var BPromise=require(_0x85ba('0x2'));var rs=require(_0x85ba('0x3'));var fs=require('fs');var Redis=require(_0x85ba('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x85ba('0x5'))(_0x85ba('0x6'));var config=require('../../config/environment');var jayson=require(_0x85ba('0x7'));var client=jayson[_0x85ba('0x8')][_0x85ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cb8c0,_0x28594a,_0x53c22c){return new BPromise(function(_0x491a41,_0x49602c){return client[_0x85ba('0xa')](_0x3cb8c0,_0x53c22c)[_0x85ba('0xb')](function(_0x19e8e7){logger[_0x85ba('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x28594a,_0x85ba('0xd'));logger[_0x85ba('0xe')](_0x85ba('0xf'),_0x28594a,'request\x20sent',JSON['stringify'](_0x19e8e7));if(_0x19e8e7[_0x85ba('0x10')]){if(_0x19e8e7[_0x85ba('0x10')][_0x85ba('0x11')]===0x1f4){logger['error'](_0x85ba('0x12'),_0x28594a,_0x19e8e7[_0x85ba('0x10')]['message']);return _0x49602c(_0x19e8e7[_0x85ba('0x10')][_0x85ba('0x13')]);}logger[_0x85ba('0x10')](_0x85ba('0x12'),_0x28594a,_0x19e8e7[_0x85ba('0x10')][_0x85ba('0x13')]);return _0x491a41(_0x19e8e7[_0x85ba('0x10')][_0x85ba('0x13')]);}else{logger[_0x85ba('0xc')](_0x85ba('0x12'),_0x28594a,'request\x20sent');_0x491a41(_0x19e8e7[_0x85ba('0x14')][_0x85ba('0x13')]);}})[_0x85ba('0x15')](function(_0xc5a82d){logger[_0x85ba('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x28594a,_0xc5a82d);_0x49602c(_0xc5a82d);});});}exports[_0x85ba('0x16')]=function(_0x40ecf7){var _0x29d05a=this;return new Promise(function(_0x333a73,_0x4dee57){return db[_0x85ba('0x17')][_0x85ba('0x18')]({'raw':_0x40ecf7[_0x85ba('0x19')]?_0x40ecf7[_0x85ba('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x40ecf7[_0x85ba('0x19')]?_0x40ecf7[_0x85ba('0x19')]['where']||null:null,'attributes':_0x40ecf7[_0x85ba('0x19')]?_0x40ecf7['options']['attributes']||null:null,'limit':_0x40ecf7['options']?_0x40ecf7[_0x85ba('0x19')][_0x85ba('0x1a')]||null:null,'include':_0x40ecf7[_0x85ba('0x19')]?_0x40ecf7[_0x85ba('0x19')]['include']?_['map'](_0x40ecf7[_0x85ba('0x19')][_0x85ba('0x1b')],function(_0x3c7191){return{'model':db[_0x3c7191[_0x85ba('0x1c')]],'as':_0x3c7191['as'],'attributes':_0x3c7191['attributes'],'include':_0x3c7191[_0x85ba('0x1b')]?_[_0x85ba('0x1d')](_0x3c7191['include'],function(_0x2aafe3){return{'model':db[_0x2aafe3[_0x85ba('0x1c')]],'as':_0x2aafe3['as'],'attributes':_0x2aafe3['attributes'],'include':_0x2aafe3[_0x85ba('0x1b')]?_[_0x85ba('0x1d')](_0x2aafe3[_0x85ba('0x1b')],function(_0x3608cb){return{'model':db[_0x3608cb['model']],'as':_0x3608cb['as'],'attributes':_0x3608cb[_0x85ba('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x85ba('0xb')](function(_0x442f10){logger['info'](_0x85ba('0x16'),_0x40ecf7);logger[_0x85ba('0xe')](_0x85ba('0x16'),_0x40ecf7,JSON['stringify'](_0x442f10));_0x333a73(_0x442f10);})['catch'](function(_0x36c095){logger[_0x85ba('0x10')](_0x85ba('0x16'),_0x36c095[_0x85ba('0x13')],_0x40ecf7);_0x4dee57(_0x29d05a['error'](0x1f4,_0x36c095[_0x85ba('0x13')]));});});};exports['ShowFreshdeskAccount']=function(_0x4315ca){var _0x33028b=this;return new Promise(function(_0x3f695c,_0x31fe99){return db[_0x85ba('0x17')]['find']({'raw':_0x4315ca[_0x85ba('0x19')]?_0x4315ca['options']['raw']===undefined?!![]:![]:!![],'where':_0x4315ca[_0x85ba('0x19')]?_0x4315ca[_0x85ba('0x19')][_0x85ba('0x1f')]||null:null,'attributes':_0x4315ca[_0x85ba('0x19')]?_0x4315ca[_0x85ba('0x19')][_0x85ba('0x1e')]||null:null,'include':_0x4315ca[_0x85ba('0x19')]?_0x4315ca[_0x85ba('0x19')][_0x85ba('0x1b')]?_[_0x85ba('0x1d')](_0x4315ca[_0x85ba('0x19')]['include'],function(_0x10936d){return{'model':db[_0x10936d[_0x85ba('0x1c')]],'as':_0x10936d['as'],'attributes':_0x10936d[_0x85ba('0x1e')],'include':_0x10936d[_0x85ba('0x1b')]?_[_0x85ba('0x1d')](_0x10936d[_0x85ba('0x1b')],function(_0x1570e7){return{'model':db[_0x1570e7[_0x85ba('0x1c')]],'as':_0x1570e7['as'],'attributes':_0x1570e7['attributes'],'include':_0x1570e7[_0x85ba('0x1b')]?_[_0x85ba('0x1d')](_0x1570e7[_0x85ba('0x1b')],function(_0x5d561e){return{'model':db[_0x5d561e[_0x85ba('0x1c')]],'as':_0x5d561e['as'],'attributes':_0x5d561e[_0x85ba('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x85ba('0xb')](function(_0x20715b){logger[_0x85ba('0xc')](_0x85ba('0x20'),_0x4315ca);logger[_0x85ba('0xe')](_0x85ba('0x20'),_0x4315ca,JSON[_0x85ba('0x21')](_0x20715b));_0x3f695c(_0x20715b);})['catch'](function(_0x5765df){logger[_0x85ba('0x10')](_0x85ba('0x20'),_0x5765df['message'],_0x4315ca);_0x31fe99(_0x33028b[_0x85ba('0x10')](0x1f4,_0x5765df[_0x85ba('0x13')]));});});}; \ No newline at end of file +var _0x6df2=['debug','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','info','FreshdeskAccount,\x20%s,\x20%s','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount'];(function(_0x3a265c,_0x49d0fd){var _0x163592=function(_0x5115a2){while(--_0x5115a2){_0x3a265c['push'](_0x3a265c['shift']());}};_0x163592(++_0x49d0fd);}(_0x6df2,0x101));var _0x26df=function(_0x8a0e94,_0x2077fd){_0x8a0e94=_0x8a0e94-0x0;var _0x34dbfa=_0x6df2[_0x8a0e94];return _0x34dbfa;};'use strict';var _=require(_0x26df('0x0'));var util=require(_0x26df('0x1'));var moment=require(_0x26df('0x2'));var BPromise=require(_0x26df('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x26df('0x4'))['db'];var utils=require(_0x26df('0x5'));var logger=require(_0x26df('0x6'))(_0x26df('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x558d0d,_0x44b6ed,_0x92dc40){return new BPromise(function(_0x43aec5,_0x2fccb9){return client[_0x26df('0x8')](_0x558d0d,_0x92dc40)[_0x26df('0x9')](function(_0x3d1550){logger[_0x26df('0xa')](_0x26df('0xb'),_0x44b6ed,'request\x20sent');logger['debug'](_0x26df('0xc'),_0x44b6ed,'request\x20sent',JSON[_0x26df('0xd')](_0x3d1550));if(_0x3d1550[_0x26df('0xe')]){if(_0x3d1550[_0x26df('0xe')]['code']===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x44b6ed,_0x3d1550[_0x26df('0xe')][_0x26df('0xf')]);return _0x2fccb9(_0x3d1550['error'][_0x26df('0xf')]);}logger[_0x26df('0xe')](_0x26df('0xb'),_0x44b6ed,_0x3d1550[_0x26df('0xe')]['message']);return _0x43aec5(_0x3d1550['error'][_0x26df('0xf')]);}else{logger[_0x26df('0xa')](_0x26df('0xb'),_0x44b6ed,_0x26df('0x10'));_0x43aec5(_0x3d1550[_0x26df('0x11')][_0x26df('0xf')]);}})[_0x26df('0x12')](function(_0x43dee5){logger[_0x26df('0xe')](_0x26df('0xb'),_0x44b6ed,_0x43dee5);_0x2fccb9(_0x43dee5);});});}exports[_0x26df('0x13')]=function(_0x5c37b8){var _0x40a666=this;return new Promise(function(_0x1a62f7,_0x187bac){return db[_0x26df('0x14')][_0x26df('0x15')]({'raw':_0x5c37b8[_0x26df('0x16')]?_0x5c37b8[_0x26df('0x16')][_0x26df('0x17')]===undefined?!![]:![]:!![],'where':_0x5c37b8['options']?_0x5c37b8[_0x26df('0x16')][_0x26df('0x18')]||null:null,'attributes':_0x5c37b8['options']?_0x5c37b8[_0x26df('0x16')][_0x26df('0x19')]||null:null,'limit':_0x5c37b8[_0x26df('0x16')]?_0x5c37b8[_0x26df('0x16')][_0x26df('0x1a')]||null:null,'include':_0x5c37b8[_0x26df('0x16')]?_0x5c37b8[_0x26df('0x16')][_0x26df('0x1b')]?_[_0x26df('0x1c')](_0x5c37b8[_0x26df('0x16')][_0x26df('0x1b')],function(_0x1c640b){return{'model':db[_0x1c640b[_0x26df('0x1d')]],'as':_0x1c640b['as'],'attributes':_0x1c640b[_0x26df('0x19')],'include':_0x1c640b[_0x26df('0x1b')]?_[_0x26df('0x1c')](_0x1c640b['include'],function(_0x36f2b6){return{'model':db[_0x36f2b6[_0x26df('0x1d')]],'as':_0x36f2b6['as'],'attributes':_0x36f2b6[_0x26df('0x19')],'include':_0x36f2b6[_0x26df('0x1b')]?_[_0x26df('0x1c')](_0x36f2b6[_0x26df('0x1b')],function(_0x2aa904){return{'model':db[_0x2aa904['model']],'as':_0x2aa904['as'],'attributes':_0x2aa904[_0x26df('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x207b77){logger[_0x26df('0xa')](_0x26df('0x13'),_0x5c37b8);logger['debug'](_0x26df('0x13'),_0x5c37b8,JSON[_0x26df('0xd')](_0x207b77));_0x1a62f7(_0x207b77);})['catch'](function(_0x7c78bd){logger['error'](_0x26df('0x13'),_0x7c78bd[_0x26df('0xf')],_0x5c37b8);_0x187bac(_0x40a666['error'](0x1f4,_0x7c78bd['message']));});});};exports[_0x26df('0x1e')]=function(_0x25c2d9){var _0x54fac3=this;return new Promise(function(_0x494ac3,_0x2a8e77){return db['FreshdeskAccount']['find']({'raw':_0x25c2d9[_0x26df('0x16')]?_0x25c2d9[_0x26df('0x16')][_0x26df('0x17')]===undefined?!![]:![]:!![],'where':_0x25c2d9[_0x26df('0x16')]?_0x25c2d9[_0x26df('0x16')][_0x26df('0x18')]||null:null,'attributes':_0x25c2d9['options']?_0x25c2d9[_0x26df('0x16')][_0x26df('0x19')]||null:null,'include':_0x25c2d9['options']?_0x25c2d9['options'][_0x26df('0x1b')]?_[_0x26df('0x1c')](_0x25c2d9[_0x26df('0x16')][_0x26df('0x1b')],function(_0x4ef070){return{'model':db[_0x4ef070[_0x26df('0x1d')]],'as':_0x4ef070['as'],'attributes':_0x4ef070[_0x26df('0x19')],'include':_0x4ef070[_0x26df('0x1b')]?_[_0x26df('0x1c')](_0x4ef070[_0x26df('0x1b')],function(_0x435fb8){return{'model':db[_0x435fb8[_0x26df('0x1d')]],'as':_0x435fb8['as'],'attributes':_0x435fb8[_0x26df('0x19')],'include':_0x435fb8['include']?_[_0x26df('0x1c')](_0x435fb8[_0x26df('0x1b')],function(_0x4b47a7){return{'model':db[_0x4b47a7['model']],'as':_0x4b47a7['as'],'attributes':_0x4b47a7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x23e045){logger[_0x26df('0xa')](_0x26df('0x1e'),_0x25c2d9);logger[_0x26df('0x1f')](_0x26df('0x1e'),_0x25c2d9,JSON[_0x26df('0xd')](_0x23e045));_0x494ac3(_0x23e045);})[_0x26df('0x12')](function(_0x406b18){logger['error'](_0x26df('0x1e'),_0x406b18[_0x26df('0xf')],_0x25c2d9);_0x2a8e77(_0x54fac3[_0x26df('0xe')](0x1f4,_0x406b18['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index e85d2ba..9a261ee 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 _0x31f0=['show','/:id/fields','isAuthenticated','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','/:id'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x31f0,0xb7));var _0x031f=function(_0x43ebb7,_0x28ada7){_0x43ebb7=_0x43ebb7-0x0;var _0x1f86ae=_0x31f0[_0x43ebb7];return _0x1f86ae;};'use strict';var multer=require(_0x031f('0x0'));var util=require('util');var path=require(_0x031f('0x1'));var timeout=require('connect-timeout');var express=require(_0x031f('0x2'));var router=express[_0x031f('0x3')]();var auth=require(_0x031f('0x4'));var interaction=require(_0x031f('0x5'));var config=require('../../config/environment');var controller=require(_0x031f('0x6'));router[_0x031f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x031f('0x8'),auth['isAuthenticated'](),controller[_0x031f('0x9')]);router[_0x031f('0x7')](_0x031f('0xa'),auth[_0x031f('0xb')](),controller['getFields']);router[_0x031f('0x7')](_0x031f('0xc'),auth[_0x031f('0xb')](),controller[_0x031f('0xd')]);router[_0x031f('0x7')](_0x031f('0xe'),auth[_0x031f('0xb')](),controller[_0x031f('0xf')]);router['get'](_0x031f('0x10'),auth[_0x031f('0xb')](),controller[_0x031f('0x11')]);router[_0x031f('0x12')]('/',auth[_0x031f('0xb')](),controller[_0x031f('0x13')]);router[_0x031f('0x12')]('/:id/tags',auth[_0x031f('0xb')](),controller[_0x031f('0x14')]);router[_0x031f('0x15')](_0x031f('0x8'),auth[_0x031f('0xb')](),controller['update']);router['delete'](_0x031f('0x8'),auth[_0x031f('0xb')](),controller[_0x031f('0x16')]);module[_0x031f('0x17')]=router; \ No newline at end of file +var _0x7bae=['setTags','update','delete','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x7bae,0x13b));var _0xe7ba=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x7bae[_0x288f5e];return _0x476cc9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7ba('0x0'));var timeout=require(_0xe7ba('0x1'));var express=require('express');var router=express[_0xe7ba('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe7ba('0x3'));var config=require(_0xe7ba('0x4'));var controller=require(_0xe7ba('0x5'));router[_0xe7ba('0x6')]('/',auth[_0xe7ba('0x7')](),controller[_0xe7ba('0x8')]);router[_0xe7ba('0x6')](_0xe7ba('0x9'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0xa')]);router[_0xe7ba('0x6')](_0xe7ba('0xb'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0xc')]);router['get'](_0xe7ba('0xd'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0xe')]);router[_0xe7ba('0x6')](_0xe7ba('0xf'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0x10')]);router[_0xe7ba('0x6')](_0xe7ba('0x11'),auth['isAuthenticated'](),controller[_0xe7ba('0x12')]);router['post']('/',auth[_0xe7ba('0x7')](),controller[_0xe7ba('0x13')]);router[_0xe7ba('0x14')](_0xe7ba('0x11'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0x15')]);router['put']('/:id',auth[_0xe7ba('0x7')](),controller[_0xe7ba('0x16')]);router[_0xe7ba('0x17')]('/:id',auth[_0xe7ba('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index a9ad397..d08c438 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 _0xfb7b=['exports','STRING'];(function(_0x48cdfd,_0x6475d1){var _0x9d55d2=function(_0x3b8252){while(--_0x3b8252){_0x48cdfd['push'](_0x48cdfd['shift']());}};_0x9d55d2(++_0x6475d1);}(_0xfb7b,0x1cc));var _0xbfb7=function(_0x5f33a6,_0x36dce3){_0x5f33a6=_0x5f33a6-0x0;var _0x1b692d=_0xfb7b[_0x5f33a6];return _0x1b692d;};'use strict';var Sequelize=require('sequelize');module[_0xbfb7('0x0')]={'name':{'type':Sequelize[_0xbfb7('0x1')]},'description':{'type':Sequelize[_0xbfb7('0x1')]}}; \ No newline at end of file +var _0x2a63=['exports','STRING'];(function(_0xade094,_0xa2d627){var _0x2d69d4=function(_0x4d8d4f){while(--_0x4d8d4f){_0xade094['push'](_0xade094['shift']());}};_0x2d69d4(++_0xa2d627);}(_0x2a63,0x114));var _0x32a6=function(_0x97c6ea,_0x4cffce){_0x97c6ea=_0x97c6ea-0x0;var _0x2d7f50=_0x2a63[_0x97c6ea];return _0x2d7f50;};'use strict';var Sequelize=require('sequelize');module[_0x32a6('0x0')]={'name':{'type':Sequelize[_0x32a6('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index a37354c..fc43084 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 _0x2a93=['sendStatus','status','end','count','offset','limit','Content-Range','json','reject','save','update','destroy','stack','name','index','FreshdeskConfiguration','rawAttributes','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','merge','type','key','options','include','findAll','show','params','length','includeAll','create','body','find','getFields','findOne','FreshdeskField','order','pick','filter','map','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x5d4635,_0x214ce5){var _0x4b8e4d=function(_0x1fb673){while(--_0x1fb673){_0x5d4635['push'](_0x5d4635['shift']());}};_0x4b8e4d(++_0x214ce5);}(_0x2a93,0x1ae));var _0x32a9=function(_0x4b2092,_0x458854){_0x4b2092=_0x4b2092-0x0;var _0x2337c1=_0x2a93[_0x4b2092];return _0x2337c1;};'use strict';var pdf=require(_0x32a9('0x0'));var emlformat=require(_0x32a9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x32a9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x32a9('0x3'));var moment=require(_0x32a9('0x4'));var BPromise=require(_0x32a9('0x5'));var Mustache=require(_0x32a9('0x6'));var util=require(_0x32a9('0x7'));var path=require(_0x32a9('0x8'));var sox=require(_0x32a9('0x9'));var csv=require(_0x32a9('0xa'));var ejs=require(_0x32a9('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x32a9('0xc'));var crypto=require(_0x32a9('0xd'));var jsforce=require(_0x32a9('0xe'));var deskjs=require(_0x32a9('0xf'));var toCsv=require(_0x32a9('0xa'));var querystring=require(_0x32a9('0x10'));var Papa=require(_0x32a9('0x11'));var authService=require(_0x32a9('0x12'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x32a9('0x13'));var qs=require(_0x32a9('0x14'));var logger=require(_0x32a9('0x15'))(_0x32a9('0x16'));var utils=require(_0x32a9('0x17'));var config=require(_0x32a9('0x18'));var db=require(_0x32a9('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x32a9('0x1a')][_0x32a9('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x14dd1e,_0x3b4868,_0x1329d6,_0x5a4a7c){return new BPromise(function(_0x483b78,_0x44e9a6){var _0x50b996=_0x5a4a7c||client;return _0x50b996[_0x32a9('0x1c')](_0x14dd1e,_0x1329d6)[_0x32a9('0x1d')](function(_0x5055bf){logger[_0x32a9('0x1e')](_0x32a9('0x1f'),_0x3b4868,_0x32a9('0x20'));logger['debug'](_0x32a9('0x21'),_0x3b4868,_0x32a9('0x20'),JSON[_0x32a9('0x22')](_0x5055bf));if(_0x5055bf['error']){if(_0x5055bf['error'][_0x32a9('0x23')]===0x1f4){logger[_0x32a9('0x24')](_0x32a9('0x1f'),_0x3b4868,_0x5055bf['error'][_0x32a9('0x25')]);return _0x44e9a6(_0x5055bf['error'][_0x32a9('0x25')]);}logger[_0x32a9('0x24')](_0x32a9('0x1f'),_0x3b4868,_0x5055bf[_0x32a9('0x24')][_0x32a9('0x25')]);return _0x483b78(_0x5055bf[_0x32a9('0x24')][_0x32a9('0x25')]);}else{logger[_0x32a9('0x1e')](_0x32a9('0x1f'),_0x3b4868,'request\x20sent');_0x483b78(_0x5055bf[_0x32a9('0x26')][_0x32a9('0x25')]);}})[_0x32a9('0x27')](function(_0x4edbbf){logger[_0x32a9('0x24')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3b4868,_0x4edbbf);_0x44e9a6(_0x4edbbf);});});}function respondWithStatusCode(_0x16f55a,_0x256240){_0x256240=_0x256240||0xcc;return function(_0x17eb9c){if(_0x17eb9c){return _0x16f55a[_0x32a9('0x28')](_0x256240);}return _0x16f55a[_0x32a9('0x29')](_0x256240)[_0x32a9('0x2a')]();};}function respondWithResult(_0x4cc12d,_0x23dc17){_0x23dc17=_0x23dc17||0xc8;return function(_0x1f9716){if(_0x1f9716){return _0x4cc12d[_0x32a9('0x29')](_0x23dc17)['json'](_0x1f9716);}};}function respondWithFilteredResult(_0xda4894,_0x4b986d){return function(_0x433b18){if(_0x433b18){var _0x4feb88=_0x433b18[_0x32a9('0x2b')],_0x55328f=_0x4b986d[_0x32a9('0x2c')],_0x3a7db0=_0x4b986d['offset']+_0x4b986d[_0x32a9('0x2d')],_0x45c14e;if(_0x3a7db0>=_0x4feb88){_0x3a7db0=_0x4feb88;_0x45c14e=0xc8;}else{_0x45c14e=0xce;}_0xda4894[_0x32a9('0x29')](_0x45c14e);return _0xda4894['set'](_0x32a9('0x2e'),_0x55328f+'-'+_0x3a7db0+'/'+_0x4feb88)[_0x32a9('0x2f')](_0x433b18);}return null;};}function patchUpdates(_0x268bd0){return function(_0x5cd7d2){try{jsonpatch['apply'](_0x5cd7d2,_0x268bd0,!![]);}catch(_0x557301){return BPromise[_0x32a9('0x30')](_0x557301);}return _0x5cd7d2[_0x32a9('0x31')]();};}function saveUpdates(_0x545dd2,_0x190009){return function(_0x10ab94){if(_0x10ab94){return _0x10ab94[_0x32a9('0x32')](_0x545dd2)[_0x32a9('0x1d')](function(_0x304640){return _0x304640;});}return null;};}function removeEntity(_0x278b49,_0x15f55d){return function(_0x31e5fe){if(_0x31e5fe){return _0x31e5fe[_0x32a9('0x33')]()[_0x32a9('0x1d')](function(){_0x278b49[_0x32a9('0x29')](0xcc)[_0x32a9('0x2a')]();});}};}function handleEntityNotFound(_0x14c84c,_0x13966c){return function(_0x2bc2e4){if(!_0x2bc2e4){_0x14c84c[_0x32a9('0x28')](0x194);}return _0x2bc2e4;};}function handleError(_0x495931,_0x25b7fd){_0x25b7fd=_0x25b7fd||0x1f4;return function(_0x33c577){logger[_0x32a9('0x24')](_0x33c577[_0x32a9('0x34')]);if(_0x33c577['name']){delete _0x33c577[_0x32a9('0x35')];}_0x495931[_0x32a9('0x29')](_0x25b7fd)['send'](_0x33c577);};}exports[_0x32a9('0x36')]=function(_0x445e0a,_0x482fe5){var _0x4291a2={},_0x59387f={},_0x569855={'count':0x0,'rows':[]};var _0x196486=db[_0x32a9('0x37')][_0x32a9('0x38')];_0x59387f[_0x32a9('0x39')]=_[_0x32a9('0x3a')](_0x196486);_0x59387f[_0x32a9('0x3b')]=_[_0x32a9('0x3a')](_0x445e0a['query']);_0x59387f['filters']=_['intersection'](_0x59387f[_0x32a9('0x39')],_0x59387f[_0x32a9('0x3b')]);_0x4291a2['attributes']=_[_0x32a9('0x3c')](_0x59387f[_0x32a9('0x39')],qs[_0x32a9('0x3d')](_0x445e0a[_0x32a9('0x3b')]['fields']));_0x4291a2[_0x32a9('0x3e')]=_0x4291a2[_0x32a9('0x3e')]['length']?_0x4291a2[_0x32a9('0x3e')]:_0x59387f[_0x32a9('0x39')];if(!_0x445e0a[_0x32a9('0x3b')][_0x32a9('0x3f')](_0x32a9('0x40'))){_0x4291a2[_0x32a9('0x2d')]=qs[_0x32a9('0x2d')](_0x445e0a[_0x32a9('0x3b')][_0x32a9('0x2d')]);_0x4291a2['offset']=qs[_0x32a9('0x2c')](_0x445e0a[_0x32a9('0x3b')][_0x32a9('0x2c')]);}_0x4291a2['order']=qs[_0x32a9('0x41')](_0x445e0a[_0x32a9('0x3b')]['sort']);_0x4291a2[_0x32a9('0x42')]=qs[_0x32a9('0x43')](_['pick'](_0x445e0a[_0x32a9('0x3b')],_0x59387f['filters']));if(_0x445e0a[_0x32a9('0x3b')]['filter']){_0x4291a2['where']=_[_0x32a9('0x44')](_0x4291a2[_0x32a9('0x42')],{'$or':_['map'](_0x196486,function(_0x57aaf6){if(_0x57aaf6[_0x32a9('0x45')][_0x32a9('0x46')]!=='VIRTUAL'){var _0x1f14a4={};_0x1f14a4[_0x57aaf6['field']]={'$like':'%'+_0x445e0a[_0x32a9('0x3b')]['filter']+'%'};return _0x1f14a4;}})});}_0x4291a2=_[_0x32a9('0x44')]({},_0x4291a2,_0x445e0a[_0x32a9('0x47')]);var _0x413f19={'where':_0x4291a2[_0x32a9('0x42')]};return db[_0x32a9('0x37')][_0x32a9('0x2b')](_0x413f19)[_0x32a9('0x1d')](function(_0x319a9d){_0x569855[_0x32a9('0x2b')]=_0x319a9d;if(_0x445e0a[_0x32a9('0x3b')]['includeAll']){_0x4291a2[_0x32a9('0x48')]=[{'all':!![]}];}return db[_0x32a9('0x37')][_0x32a9('0x49')](_0x4291a2);})['then'](function(_0x55684b){_0x569855['rows']=_0x55684b;return _0x569855;})[_0x32a9('0x1d')](respondWithFilteredResult(_0x482fe5,_0x4291a2))[_0x32a9('0x27')](handleError(_0x482fe5,null));};exports[_0x32a9('0x4a')]=function(_0x12cbba,_0x124454){var _0x4892e6={'raw':![],'where':{'id':_0x12cbba[_0x32a9('0x4b')]['id']}},_0x2912a7={};_0x2912a7['model']=_[_0x32a9('0x3a')](db['FreshdeskConfiguration'][_0x32a9('0x38')]);_0x2912a7['query']=_[_0x32a9('0x3a')](_0x12cbba[_0x32a9('0x3b')]);_0x2912a7[_0x32a9('0x43')]=_['intersection'](_0x2912a7[_0x32a9('0x39')],_0x2912a7['query']);_0x4892e6[_0x32a9('0x3e')]=_[_0x32a9('0x3c')](_0x2912a7[_0x32a9('0x39')],qs[_0x32a9('0x3d')](_0x12cbba['query']['fields']));_0x4892e6[_0x32a9('0x3e')]=_0x4892e6[_0x32a9('0x3e')][_0x32a9('0x4c')]?_0x4892e6[_0x32a9('0x3e')]:_0x2912a7[_0x32a9('0x39')];if(_0x12cbba[_0x32a9('0x3b')][_0x32a9('0x4d')]){_0x4892e6[_0x32a9('0x48')]=[{'all':!![]}];}_0x4892e6=_[_0x32a9('0x44')]({},_0x4892e6,_0x12cbba[_0x32a9('0x47')]);return db[_0x32a9('0x37')]['find'](_0x4892e6)['then'](handleEntityNotFound(_0x124454,null))[_0x32a9('0x1d')](respondWithResult(_0x124454,null))[_0x32a9('0x27')](handleError(_0x124454,null));};exports[_0x32a9('0x4e')]=function(_0x2f4394,_0x4d5efb){return db[_0x32a9('0x37')][_0x32a9('0x4e')](_0x2f4394[_0x32a9('0x4f')],{})['then'](respondWithResult(_0x4d5efb,0xc9))[_0x32a9('0x27')](handleError(_0x4d5efb,null));};exports['update']=function(_0x54d4d2,_0x4805f7){if(_0x54d4d2[_0x32a9('0x4f')]['id']){delete _0x54d4d2[_0x32a9('0x4f')]['id'];}return db['FreshdeskConfiguration'][_0x32a9('0x50')]({'where':{'id':_0x54d4d2[_0x32a9('0x4b')]['id']}})[_0x32a9('0x1d')](handleEntityNotFound(_0x4805f7,null))[_0x32a9('0x1d')](saveUpdates(_0x54d4d2[_0x32a9('0x4f')],null))[_0x32a9('0x1d')](respondWithResult(_0x4805f7,null))[_0x32a9('0x27')](handleError(_0x4805f7,null));};exports[_0x32a9('0x33')]=function(_0x21f48f,_0xfa62a1){return db[_0x32a9('0x37')]['find']({'where':{'id':_0x21f48f[_0x32a9('0x4b')]['id']}})[_0x32a9('0x1d')](handleEntityNotFound(_0xfa62a1,null))[_0x32a9('0x1d')](removeEntity(_0xfa62a1,null))[_0x32a9('0x27')](handleError(_0xfa62a1,null));};exports[_0x32a9('0x51')]=function(_0x4647db,_0x4513cf,_0x29a1fa){var _0x38afab={};var _0x3487fd={};var _0x3e91fd;var _0x3d2767;return db[_0x32a9('0x37')][_0x32a9('0x52')]({'where':{'id':_0x4647db[_0x32a9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4513cf,null))[_0x32a9('0x1d')](function(_0x4a98c4){if(_0x4a98c4){_0x3e91fd=_0x4a98c4;_0x3487fd[_0x32a9('0x39')]=_[_0x32a9('0x3a')](db[_0x32a9('0x53')]['rawAttributes']);_0x3487fd[_0x32a9('0x3b')]=_['keys'](_0x4647db['query']);_0x3487fd[_0x32a9('0x43')]=_[_0x32a9('0x3c')](_0x3487fd[_0x32a9('0x39')],_0x3487fd[_0x32a9('0x3b')]);_0x38afab['attributes']=_['intersection'](_0x3487fd[_0x32a9('0x39')],qs[_0x32a9('0x3d')](_0x4647db[_0x32a9('0x3b')][_0x32a9('0x3d')]));_0x38afab[_0x32a9('0x3e')]=_0x38afab[_0x32a9('0x3e')][_0x32a9('0x4c')]?_0x38afab[_0x32a9('0x3e')]:_0x3487fd[_0x32a9('0x39')];_0x38afab[_0x32a9('0x54')]=qs[_0x32a9('0x41')](_0x4647db[_0x32a9('0x3b')][_0x32a9('0x41')]);_0x38afab[_0x32a9('0x42')]=qs[_0x32a9('0x43')](_[_0x32a9('0x55')](_0x4647db[_0x32a9('0x3b')],_0x3487fd[_0x32a9('0x43')]));if(_0x4647db[_0x32a9('0x3b')][_0x32a9('0x56')]){_0x38afab[_0x32a9('0x42')]=_[_0x32a9('0x44')](_0x38afab[_0x32a9('0x42')],{'$or':_[_0x32a9('0x57')](_0x38afab[_0x32a9('0x3e')],function(_0x2f619b){var _0x16f684={};_0x16f684[_0x2f619b]={'$like':'%'+_0x4647db[_0x32a9('0x3b')][_0x32a9('0x56')]+'%'};return _0x16f684;})});}_0x38afab=_[_0x32a9('0x44')]({},_0x38afab,_0x4647db[_0x32a9('0x47')]);return _0x3e91fd[_0x32a9('0x51')](_0x38afab);}})['then'](function(_0x22e3bd){if(_0x22e3bd){_0x3d2767=_0x22e3bd[_0x32a9('0x4c')];if(!_0x4647db[_0x32a9('0x3b')][_0x32a9('0x3f')](_0x32a9('0x40'))){_0x38afab[_0x32a9('0x2d')]=qs['limit'](_0x4647db['query'][_0x32a9('0x2d')]);_0x38afab[_0x32a9('0x2c')]=qs['offset'](_0x4647db[_0x32a9('0x3b')][_0x32a9('0x2c')]);}return _0x3e91fd[_0x32a9('0x51')](_0x38afab);}})[_0x32a9('0x1d')](function(_0x3280d2){if(_0x3280d2){return _0x3280d2?{'count':_0x3d2767,'rows':_0x3280d2}:null;}})['then'](respondWithResult(_0x4513cf,null))[_0x32a9('0x27')](handleError(_0x4513cf,null));};exports[_0x32a9('0x58')]=function(_0x613c29,_0x5eac9a,_0x111102){var _0x30c9de={};var _0x13947a={};var _0x308634;var _0x4086f8;return db[_0x32a9('0x37')][_0x32a9('0x52')]({'where':{'id':_0x613c29[_0x32a9('0x4b')]['id']}})[_0x32a9('0x1d')](handleEntityNotFound(_0x5eac9a,null))[_0x32a9('0x1d')](function(_0x56bc38){if(_0x56bc38){_0x308634=_0x56bc38;_0x13947a[_0x32a9('0x39')]=_[_0x32a9('0x3a')](db['FreshdeskField'][_0x32a9('0x38')]);_0x13947a[_0x32a9('0x3b')]=_[_0x32a9('0x3a')](_0x613c29[_0x32a9('0x3b')]);_0x13947a[_0x32a9('0x43')]=_[_0x32a9('0x3c')](_0x13947a['model'],_0x13947a[_0x32a9('0x3b')]);_0x30c9de[_0x32a9('0x3e')]=_[_0x32a9('0x3c')](_0x13947a[_0x32a9('0x39')],qs[_0x32a9('0x3d')](_0x613c29['query'][_0x32a9('0x3d')]));_0x30c9de[_0x32a9('0x3e')]=_0x30c9de['attributes'][_0x32a9('0x4c')]?_0x30c9de[_0x32a9('0x3e')]:_0x13947a[_0x32a9('0x39')];_0x30c9de[_0x32a9('0x54')]=qs[_0x32a9('0x41')](_0x613c29[_0x32a9('0x3b')]['sort']);_0x30c9de[_0x32a9('0x42')]=qs[_0x32a9('0x43')](_[_0x32a9('0x55')](_0x613c29[_0x32a9('0x3b')],_0x13947a[_0x32a9('0x43')]));if(_0x613c29[_0x32a9('0x3b')][_0x32a9('0x56')]){_0x30c9de[_0x32a9('0x42')]=_['merge'](_0x30c9de['where'],{'$or':_[_0x32a9('0x57')](_0x30c9de[_0x32a9('0x3e')],function(_0x2316b2){var _0x579919={};_0x579919[_0x2316b2]={'$like':'%'+_0x613c29['query']['filter']+'%'};return _0x579919;})});}_0x30c9de=_[_0x32a9('0x44')]({},_0x30c9de,_0x613c29['options']);return _0x308634[_0x32a9('0x58')](_0x30c9de);}})[_0x32a9('0x1d')](function(_0x34af1a){if(_0x34af1a){_0x4086f8=_0x34af1a[_0x32a9('0x4c')];if(!_0x613c29[_0x32a9('0x3b')]['hasOwnProperty']('nolimit')){_0x30c9de[_0x32a9('0x2d')]=qs[_0x32a9('0x2d')](_0x613c29[_0x32a9('0x3b')][_0x32a9('0x2d')]);_0x30c9de[_0x32a9('0x2c')]=qs['offset'](_0x613c29['query']['offset']);}return _0x308634[_0x32a9('0x58')](_0x30c9de);}})[_0x32a9('0x1d')](function(_0x3ee1f7){if(_0x3ee1f7){return _0x3ee1f7?{'count':_0x4086f8,'rows':_0x3ee1f7}:null;}})[_0x32a9('0x1d')](respondWithResult(_0x5eac9a,null))[_0x32a9('0x27')](handleError(_0x5eac9a,null));};exports[_0x32a9('0x59')]=function(_0x26473a,_0x583f50,_0xf4c94d){var _0x2bba20={};var _0x5021f2={};var _0x36cfe6;var _0x13d946;return db[_0x32a9('0x37')][_0x32a9('0x52')]({'where':{'id':_0x26473a[_0x32a9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x583f50,null))['then'](function(_0x2162e1){if(_0x2162e1){_0x36cfe6=_0x2162e1;_0x5021f2['model']=_[_0x32a9('0x3a')](db[_0x32a9('0x53')][_0x32a9('0x38')]);_0x5021f2[_0x32a9('0x3b')]=_[_0x32a9('0x3a')](_0x26473a[_0x32a9('0x3b')]);_0x5021f2[_0x32a9('0x43')]=_[_0x32a9('0x3c')](_0x5021f2[_0x32a9('0x39')],_0x5021f2['query']);_0x2bba20['attributes']=_[_0x32a9('0x3c')](_0x5021f2[_0x32a9('0x39')],qs[_0x32a9('0x3d')](_0x26473a['query']['fields']));_0x2bba20['attributes']=_0x2bba20['attributes'][_0x32a9('0x4c')]?_0x2bba20[_0x32a9('0x3e')]:_0x5021f2[_0x32a9('0x39')];_0x2bba20[_0x32a9('0x54')]=qs['sort'](_0x26473a[_0x32a9('0x3b')][_0x32a9('0x41')]);_0x2bba20[_0x32a9('0x42')]=qs[_0x32a9('0x43')](_[_0x32a9('0x55')](_0x26473a[_0x32a9('0x3b')],_0x5021f2[_0x32a9('0x43')]));if(_0x26473a[_0x32a9('0x3b')][_0x32a9('0x56')]){_0x2bba20[_0x32a9('0x42')]=_[_0x32a9('0x44')](_0x2bba20[_0x32a9('0x42')],{'$or':_[_0x32a9('0x57')](_0x2bba20[_0x32a9('0x3e')],function(_0x56b497){var _0x3e2421={};_0x3e2421[_0x56b497]={'$like':'%'+_0x26473a[_0x32a9('0x3b')][_0x32a9('0x56')]+'%'};return _0x3e2421;})});}_0x2bba20=_['merge']({},_0x2bba20,_0x26473a['options']);return _0x36cfe6[_0x32a9('0x59')](_0x2bba20);}})[_0x32a9('0x1d')](function(_0x28f121){if(_0x28f121){_0x13d946=_0x28f121[_0x32a9('0x4c')];if(!_0x26473a[_0x32a9('0x3b')]['hasOwnProperty'](_0x32a9('0x40'))){_0x2bba20['limit']=qs[_0x32a9('0x2d')](_0x26473a['query']['limit']);_0x2bba20['offset']=qs['offset'](_0x26473a[_0x32a9('0x3b')][_0x32a9('0x2c')]);}return _0x36cfe6[_0x32a9('0x59')](_0x2bba20);}})['then'](function(_0x5e8870){if(_0x5e8870){return _0x5e8870?{'count':_0x13d946,'rows':_0x5e8870}:null;}})[_0x32a9('0x1d')](respondWithResult(_0x583f50,null))['catch'](handleError(_0x583f50,null));};exports[_0x32a9('0x5a')]=function(_0x21a8ae,_0x148ec0,_0x1147c9){var _0x5d8470={};var _0xad473={};var _0x4aa3bd;var _0x16857a;return db[_0x32a9('0x37')][_0x32a9('0x52')]({'where':{'id':_0x21a8ae[_0x32a9('0x4b')]['id']}})[_0x32a9('0x1d')](handleEntityNotFound(_0x148ec0,null))[_0x32a9('0x1d')](function(_0xe0331a){if(_0xe0331a){_0x4aa3bd=_0xe0331a;_0xad473[_0x32a9('0x39')]=_[_0x32a9('0x3a')](db[_0x32a9('0x5b')][_0x32a9('0x38')]);_0xad473[_0x32a9('0x3b')]=_[_0x32a9('0x3a')](_0x21a8ae[_0x32a9('0x3b')]);_0xad473[_0x32a9('0x43')]=_[_0x32a9('0x3c')](_0xad473[_0x32a9('0x39')],_0xad473[_0x32a9('0x3b')]);_0x5d8470[_0x32a9('0x3e')]=_[_0x32a9('0x3c')](_0xad473[_0x32a9('0x39')],qs[_0x32a9('0x3d')](_0x21a8ae[_0x32a9('0x3b')][_0x32a9('0x3d')]));_0x5d8470['attributes']=_0x5d8470['attributes'][_0x32a9('0x4c')]?_0x5d8470[_0x32a9('0x3e')]:_0xad473[_0x32a9('0x39')];_0x5d8470[_0x32a9('0x54')]=qs[_0x32a9('0x41')](_0x21a8ae[_0x32a9('0x3b')][_0x32a9('0x41')]);_0x5d8470[_0x32a9('0x42')]=qs[_0x32a9('0x43')](_['pick'](_0x21a8ae[_0x32a9('0x3b')],_0xad473[_0x32a9('0x43')]));if(_0x21a8ae['query'][_0x32a9('0x56')]){_0x5d8470[_0x32a9('0x42')]=_['merge'](_0x5d8470[_0x32a9('0x42')],{'$or':_['map'](_0x5d8470['attributes'],function(_0x10dae9){var _0x3ef210={};_0x3ef210[_0x10dae9]={'$like':'%'+_0x21a8ae['query'][_0x32a9('0x56')]+'%'};return _0x3ef210;})});}_0x5d8470=_[_0x32a9('0x44')]({},_0x5d8470,_0x21a8ae[_0x32a9('0x47')]);return _0x4aa3bd[_0x32a9('0x5a')](_0x5d8470);}})[_0x32a9('0x1d')](function(_0x555454){if(_0x555454){_0x16857a=_0x555454[_0x32a9('0x4c')];if(!_0x21a8ae[_0x32a9('0x3b')]['hasOwnProperty'](_0x32a9('0x40'))){_0x5d8470[_0x32a9('0x2d')]=qs[_0x32a9('0x2d')](_0x21a8ae[_0x32a9('0x3b')][_0x32a9('0x2d')]);_0x5d8470[_0x32a9('0x2c')]=qs[_0x32a9('0x2c')](_0x21a8ae[_0x32a9('0x3b')][_0x32a9('0x2c')]);}return _0x4aa3bd[_0x32a9('0x5a')](_0x5d8470);}})['then'](function(_0xbc379b){if(_0xbc379b){return _0xbc379b?{'count':_0x16857a,'rows':_0xbc379b}:null;}})['then'](respondWithResult(_0x148ec0,null))[_0x32a9('0x27')](handleError(_0x148ec0,null));};exports[_0x32a9('0x5c')]=function(_0x166c53,_0x1f2c39,_0x50302f){if(_0x166c53['body']['id']){delete _0x166c53['body']['id'];}return db[_0x32a9('0x37')][_0x32a9('0x52')]({'where':{'id':_0x166c53['params']['id']}})['then'](handleEntityNotFound(_0x1f2c39,null))[_0x32a9('0x1d')](function(_0x155e65){if(_0x155e65){return _0x155e65[_0x32a9('0x5c')](_0x166c53[_0x32a9('0x4f')][_0x32a9('0x5d')]||[]);}return null;})['then'](respondWithResult(_0x1f2c39,null))[_0x32a9('0x27')](handleError(_0x1f2c39,null));}; \ No newline at end of file +var _0x5723=['client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','count','offset','limit','set','json','apply','reject','save','then','destroy','end','stack','name','index','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','type','key','VIRTUAL','FreshdeskConfiguration','rows','show','params','keys','include','options','find','create','body','update','getFields','findOne','FreshdeskField','filter','map','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise'];(function(_0x485c9f,_0x399a20){var _0x2ba76e=function(_0x3598d4){while(--_0x3598d4){_0x485c9f['push'](_0x485c9f['shift']());}};_0x2ba76e(++_0x399a20);}(_0x5723,0x157));var _0x3572=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5723[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x3572('0x0'));var emlformat=require(_0x3572('0x1'));var rimraf=require(_0x3572('0x2'));var zipdir=require(_0x3572('0x3'));var jsonpatch=require(_0x3572('0x4'));var rp=require(_0x3572('0x5'));var moment=require(_0x3572('0x6'));var BPromise=require(_0x3572('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3572('0x8'));var sox=require(_0x3572('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3572('0xa'));var squel=require(_0x3572('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3572('0xc'));var toCsv=require(_0x3572('0xd'));var querystring=require(_0x3572('0xe'));var Papa=require(_0x3572('0xf'));var authService=require(_0x3572('0x10'));var hardwareService=require(_0x3572('0x11'));var Redis=require('ioredis');var qs=require(_0x3572('0x12'));var logger=require(_0x3572('0x13'))(_0x3572('0x14'));var utils=require(_0x3572('0x15'));var config=require(_0x3572('0x16'));var db=require(_0x3572('0x17'))['db'];var jayson=require(_0x3572('0x18'));var client=jayson[_0x3572('0x19')][_0x3572('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x155da5,_0x49d3db,_0x3a1616,_0x51fa16){return new BPromise(function(_0xb56812,_0xb03846){var _0x3e5e41=_0x51fa16||client;return _0x3e5e41[_0x3572('0x1b')](_0x155da5,_0x3a1616)['then'](function(_0x401319){logger[_0x3572('0x1c')](_0x3572('0x1d'),_0x49d3db,_0x3572('0x1e'));logger['debug'](_0x3572('0x1f'),_0x49d3db,_0x3572('0x1e'),JSON[_0x3572('0x20')](_0x401319));if(_0x401319[_0x3572('0x21')]){if(_0x401319[_0x3572('0x21')][_0x3572('0x22')]===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x49d3db,_0x401319['error'][_0x3572('0x23')]);return _0xb03846(_0x401319['error'][_0x3572('0x23')]);}logger[_0x3572('0x21')](_0x3572('0x1d'),_0x49d3db,_0x401319[_0x3572('0x21')][_0x3572('0x23')]);return _0xb56812(_0x401319[_0x3572('0x21')][_0x3572('0x23')]);}else{logger[_0x3572('0x1c')](_0x3572('0x1d'),_0x49d3db,_0x3572('0x1e'));_0xb56812(_0x401319['result'][_0x3572('0x23')]);}})[_0x3572('0x24')](function(_0x4480fd){logger[_0x3572('0x21')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x49d3db,_0x4480fd);_0xb03846(_0x4480fd);});});}function respondWithStatusCode(_0x1e9307,_0x4ecaa2){_0x4ecaa2=_0x4ecaa2||0xcc;return function(_0x1fa084){if(_0x1fa084){return _0x1e9307[_0x3572('0x25')](_0x4ecaa2);}return _0x1e9307[_0x3572('0x26')](_0x4ecaa2)['end']();};}function respondWithResult(_0x7a29d5,_0x5f32a3){_0x5f32a3=_0x5f32a3||0xc8;return function(_0x354b55){if(_0x354b55){return _0x7a29d5[_0x3572('0x26')](_0x5f32a3)['json'](_0x354b55);}};}function respondWithFilteredResult(_0x19f6e6,_0x5a9f0e){return function(_0x1fd34a){if(_0x1fd34a){var _0x50da37=_0x1fd34a[_0x3572('0x27')],_0x20f086=_0x5a9f0e[_0x3572('0x28')],_0x20f2e7=_0x5a9f0e[_0x3572('0x28')]+_0x5a9f0e[_0x3572('0x29')],_0x1c2da4;if(_0x20f2e7>=_0x50da37){_0x20f2e7=_0x50da37;_0x1c2da4=0xc8;}else{_0x1c2da4=0xce;}_0x19f6e6[_0x3572('0x26')](_0x1c2da4);return _0x19f6e6[_0x3572('0x2a')]('Content-Range',_0x20f086+'-'+_0x20f2e7+'/'+_0x50da37)[_0x3572('0x2b')](_0x1fd34a);}return null;};}function patchUpdates(_0x275970){return function(_0x1138d7){try{jsonpatch[_0x3572('0x2c')](_0x1138d7,_0x275970,!![]);}catch(_0x60527a){return BPromise[_0x3572('0x2d')](_0x60527a);}return _0x1138d7[_0x3572('0x2e')]();};}function saveUpdates(_0x5ef09c,_0x2b81cc){return function(_0x1b7ed6){if(_0x1b7ed6){return _0x1b7ed6['update'](_0x5ef09c)[_0x3572('0x2f')](function(_0x1a8bb9){return _0x1a8bb9;});}return null;};}function removeEntity(_0x522b05,_0x25116e){return function(_0x2c086f){if(_0x2c086f){return _0x2c086f[_0x3572('0x30')]()[_0x3572('0x2f')](function(){_0x522b05[_0x3572('0x26')](0xcc)[_0x3572('0x31')]();});}};}function handleEntityNotFound(_0x79d292,_0x577f6f){return function(_0x2b5da2){if(!_0x2b5da2){_0x79d292[_0x3572('0x25')](0x194);}return _0x2b5da2;};}function handleError(_0x4835f0,_0x47c738){_0x47c738=_0x47c738||0x1f4;return function(_0x3ed2c4){logger[_0x3572('0x21')](_0x3ed2c4[_0x3572('0x32')]);if(_0x3ed2c4['name']){delete _0x3ed2c4[_0x3572('0x33')];}_0x4835f0[_0x3572('0x26')](_0x47c738)['send'](_0x3ed2c4);};}exports[_0x3572('0x34')]=function(_0x5b2a5c,_0x56938e){var _0x51443a={},_0x3b3666={},_0x34cadf={'count':0x0,'rows':[]};var _0x1bbaa4=db['FreshdeskConfiguration'][_0x3572('0x35')];_0x3b3666[_0x3572('0x36')]=_['keys'](_0x1bbaa4);_0x3b3666[_0x3572('0x37')]=_['keys'](_0x5b2a5c[_0x3572('0x37')]);_0x3b3666[_0x3572('0x38')]=_[_0x3572('0x39')](_0x3b3666[_0x3572('0x36')],_0x3b3666[_0x3572('0x37')]);_0x51443a[_0x3572('0x3a')]=_[_0x3572('0x39')](_0x3b3666['model'],qs[_0x3572('0x3b')](_0x5b2a5c[_0x3572('0x37')][_0x3572('0x3b')]));_0x51443a['attributes']=_0x51443a[_0x3572('0x3a')][_0x3572('0x3c')]?_0x51443a['attributes']:_0x3b3666[_0x3572('0x36')];if(!_0x5b2a5c[_0x3572('0x37')][_0x3572('0x3d')]('nolimit')){_0x51443a[_0x3572('0x29')]=qs[_0x3572('0x29')](_0x5b2a5c[_0x3572('0x37')][_0x3572('0x29')]);_0x51443a[_0x3572('0x28')]=qs['offset'](_0x5b2a5c[_0x3572('0x37')][_0x3572('0x28')]);}_0x51443a[_0x3572('0x3e')]=qs[_0x3572('0x3f')](_0x5b2a5c['query'][_0x3572('0x3f')]);_0x51443a['where']=qs['filters'](_[_0x3572('0x40')](_0x5b2a5c[_0x3572('0x37')],_0x3b3666[_0x3572('0x38')]));if(_0x5b2a5c[_0x3572('0x37')]['filter']){_0x51443a[_0x3572('0x41')]=_[_0x3572('0x42')](_0x51443a[_0x3572('0x41')],{'$or':_['map'](_0x1bbaa4,function(_0x1cc5e9){if(_0x1cc5e9[_0x3572('0x43')][_0x3572('0x44')]!==_0x3572('0x45')){var _0x30af77={};_0x30af77[_0x1cc5e9['field']]={'$like':'%'+_0x5b2a5c[_0x3572('0x37')]['filter']+'%'};return _0x30af77;}})});}_0x51443a=_[_0x3572('0x42')]({},_0x51443a,_0x5b2a5c['options']);var _0x562762={'where':_0x51443a[_0x3572('0x41')]};return db[_0x3572('0x46')][_0x3572('0x27')](_0x562762)[_0x3572('0x2f')](function(_0x4927c2){_0x34cadf[_0x3572('0x27')]=_0x4927c2;if(_0x5b2a5c[_0x3572('0x37')]['includeAll']){_0x51443a['include']=[{'all':!![]}];}return db[_0x3572('0x46')]['findAll'](_0x51443a);})[_0x3572('0x2f')](function(_0x58f10){_0x34cadf[_0x3572('0x47')]=_0x58f10;return _0x34cadf;})[_0x3572('0x2f')](respondWithFilteredResult(_0x56938e,_0x51443a))[_0x3572('0x24')](handleError(_0x56938e,null));};exports[_0x3572('0x48')]=function(_0x2dfe3a,_0x3ef8bf){var _0x4f5aa4={'raw':![],'where':{'id':_0x2dfe3a[_0x3572('0x49')]['id']}},_0xabef27={};_0xabef27['model']=_[_0x3572('0x4a')](db[_0x3572('0x46')]['rawAttributes']);_0xabef27['query']=_['keys'](_0x2dfe3a[_0x3572('0x37')]);_0xabef27['filters']=_[_0x3572('0x39')](_0xabef27[_0x3572('0x36')],_0xabef27[_0x3572('0x37')]);_0x4f5aa4[_0x3572('0x3a')]=_['intersection'](_0xabef27[_0x3572('0x36')],qs[_0x3572('0x3b')](_0x2dfe3a[_0x3572('0x37')]['fields']));_0x4f5aa4[_0x3572('0x3a')]=_0x4f5aa4['attributes'][_0x3572('0x3c')]?_0x4f5aa4[_0x3572('0x3a')]:_0xabef27[_0x3572('0x36')];if(_0x2dfe3a[_0x3572('0x37')]['includeAll']){_0x4f5aa4[_0x3572('0x4b')]=[{'all':!![]}];}_0x4f5aa4=_[_0x3572('0x42')]({},_0x4f5aa4,_0x2dfe3a[_0x3572('0x4c')]);return db[_0x3572('0x46')][_0x3572('0x4d')](_0x4f5aa4)['then'](handleEntityNotFound(_0x3ef8bf,null))[_0x3572('0x2f')](respondWithResult(_0x3ef8bf,null))[_0x3572('0x24')](handleError(_0x3ef8bf,null));};exports[_0x3572('0x4e')]=function(_0x4973c1,_0x562e63){return db[_0x3572('0x46')][_0x3572('0x4e')](_0x4973c1[_0x3572('0x4f')],{})[_0x3572('0x2f')](respondWithResult(_0x562e63,0xc9))[_0x3572('0x24')](handleError(_0x562e63,null));};exports[_0x3572('0x50')]=function(_0x5a54e4,_0x150370){if(_0x5a54e4[_0x3572('0x4f')]['id']){delete _0x5a54e4[_0x3572('0x4f')]['id'];}return db[_0x3572('0x46')][_0x3572('0x4d')]({'where':{'id':_0x5a54e4[_0x3572('0x49')]['id']}})['then'](handleEntityNotFound(_0x150370,null))[_0x3572('0x2f')](saveUpdates(_0x5a54e4['body'],null))['then'](respondWithResult(_0x150370,null))[_0x3572('0x24')](handleError(_0x150370,null));};exports[_0x3572('0x30')]=function(_0x374364,_0x8e439c){return db[_0x3572('0x46')][_0x3572('0x4d')]({'where':{'id':_0x374364[_0x3572('0x49')]['id']}})[_0x3572('0x2f')](handleEntityNotFound(_0x8e439c,null))['then'](removeEntity(_0x8e439c,null))[_0x3572('0x24')](handleError(_0x8e439c,null));};exports[_0x3572('0x51')]=function(_0x2c807a,_0x50b98b,_0x5f5cd6){var _0x53e754={};var _0x2c8345={};var _0x3d233e;var _0x2e3bb4;return db[_0x3572('0x46')][_0x3572('0x52')]({'where':{'id':_0x2c807a[_0x3572('0x49')]['id']}})[_0x3572('0x2f')](handleEntityNotFound(_0x50b98b,null))[_0x3572('0x2f')](function(_0xd9c90c){if(_0xd9c90c){_0x3d233e=_0xd9c90c;_0x2c8345[_0x3572('0x36')]=_[_0x3572('0x4a')](db[_0x3572('0x53')][_0x3572('0x35')]);_0x2c8345['query']=_['keys'](_0x2c807a[_0x3572('0x37')]);_0x2c8345[_0x3572('0x38')]=_['intersection'](_0x2c8345[_0x3572('0x36')],_0x2c8345['query']);_0x53e754[_0x3572('0x3a')]=_[_0x3572('0x39')](_0x2c8345['model'],qs[_0x3572('0x3b')](_0x2c807a[_0x3572('0x37')]['fields']));_0x53e754[_0x3572('0x3a')]=_0x53e754[_0x3572('0x3a')]['length']?_0x53e754[_0x3572('0x3a')]:_0x2c8345[_0x3572('0x36')];_0x53e754[_0x3572('0x3e')]=qs[_0x3572('0x3f')](_0x2c807a[_0x3572('0x37')][_0x3572('0x3f')]);_0x53e754['where']=qs[_0x3572('0x38')](_[_0x3572('0x40')](_0x2c807a[_0x3572('0x37')],_0x2c8345[_0x3572('0x38')]));if(_0x2c807a[_0x3572('0x37')][_0x3572('0x54')]){_0x53e754['where']=_['merge'](_0x53e754[_0x3572('0x41')],{'$or':_[_0x3572('0x55')](_0x53e754['attributes'],function(_0x5f1d45){var _0x5d8de3={};_0x5d8de3[_0x5f1d45]={'$like':'%'+_0x2c807a[_0x3572('0x37')][_0x3572('0x54')]+'%'};return _0x5d8de3;})});}_0x53e754=_[_0x3572('0x42')]({},_0x53e754,_0x2c807a[_0x3572('0x4c')]);return _0x3d233e[_0x3572('0x51')](_0x53e754);}})[_0x3572('0x2f')](function(_0x2fd654){if(_0x2fd654){_0x2e3bb4=_0x2fd654['length'];if(!_0x2c807a['query'][_0x3572('0x3d')](_0x3572('0x56'))){_0x53e754[_0x3572('0x29')]=qs[_0x3572('0x29')](_0x2c807a[_0x3572('0x37')][_0x3572('0x29')]);_0x53e754[_0x3572('0x28')]=qs[_0x3572('0x28')](_0x2c807a[_0x3572('0x37')][_0x3572('0x28')]);}return _0x3d233e[_0x3572('0x51')](_0x53e754);}})[_0x3572('0x2f')](function(_0x438234){if(_0x438234){return _0x438234?{'count':_0x2e3bb4,'rows':_0x438234}:null;}})['then'](respondWithResult(_0x50b98b,null))[_0x3572('0x24')](handleError(_0x50b98b,null));};exports[_0x3572('0x57')]=function(_0x599744,_0x3efd1f,_0x5dc2e8){var _0x2a2e0a={};var _0x43bee9={};var _0x19cfe6;var _0x4a5fa3;return db[_0x3572('0x46')]['findOne']({'where':{'id':_0x599744['params']['id']}})[_0x3572('0x2f')](handleEntityNotFound(_0x3efd1f,null))[_0x3572('0x2f')](function(_0x34d047){if(_0x34d047){_0x19cfe6=_0x34d047;_0x43bee9['model']=_[_0x3572('0x4a')](db['FreshdeskField']['rawAttributes']);_0x43bee9[_0x3572('0x37')]=_[_0x3572('0x4a')](_0x599744[_0x3572('0x37')]);_0x43bee9[_0x3572('0x38')]=_[_0x3572('0x39')](_0x43bee9[_0x3572('0x36')],_0x43bee9[_0x3572('0x37')]);_0x2a2e0a[_0x3572('0x3a')]=_[_0x3572('0x39')](_0x43bee9['model'],qs[_0x3572('0x3b')](_0x599744[_0x3572('0x37')][_0x3572('0x3b')]));_0x2a2e0a[_0x3572('0x3a')]=_0x2a2e0a[_0x3572('0x3a')][_0x3572('0x3c')]?_0x2a2e0a[_0x3572('0x3a')]:_0x43bee9[_0x3572('0x36')];_0x2a2e0a[_0x3572('0x3e')]=qs[_0x3572('0x3f')](_0x599744[_0x3572('0x37')]['sort']);_0x2a2e0a[_0x3572('0x41')]=qs[_0x3572('0x38')](_[_0x3572('0x40')](_0x599744[_0x3572('0x37')],_0x43bee9[_0x3572('0x38')]));if(_0x599744[_0x3572('0x37')][_0x3572('0x54')]){_0x2a2e0a[_0x3572('0x41')]=_[_0x3572('0x42')](_0x2a2e0a['where'],{'$or':_[_0x3572('0x55')](_0x2a2e0a['attributes'],function(_0x369ad1){var _0x121c34={};_0x121c34[_0x369ad1]={'$like':'%'+_0x599744['query'][_0x3572('0x54')]+'%'};return _0x121c34;})});}_0x2a2e0a=_[_0x3572('0x42')]({},_0x2a2e0a,_0x599744[_0x3572('0x4c')]);return _0x19cfe6[_0x3572('0x57')](_0x2a2e0a);}})[_0x3572('0x2f')](function(_0x2af98f){if(_0x2af98f){_0x4a5fa3=_0x2af98f['length'];if(!_0x599744['query'][_0x3572('0x3d')](_0x3572('0x56'))){_0x2a2e0a[_0x3572('0x29')]=qs['limit'](_0x599744[_0x3572('0x37')][_0x3572('0x29')]);_0x2a2e0a[_0x3572('0x28')]=qs[_0x3572('0x28')](_0x599744[_0x3572('0x37')][_0x3572('0x28')]);}return _0x19cfe6[_0x3572('0x57')](_0x2a2e0a);}})[_0x3572('0x2f')](function(_0x41fe98){if(_0x41fe98){return _0x41fe98?{'count':_0x4a5fa3,'rows':_0x41fe98}:null;}})[_0x3572('0x2f')](respondWithResult(_0x3efd1f,null))[_0x3572('0x24')](handleError(_0x3efd1f,null));};exports[_0x3572('0x58')]=function(_0x5004cf,_0x388910,_0x1e2d2b){var _0x5696d0={};var _0x29824a={};var _0x3c5c66;var _0x5c7857;return db[_0x3572('0x46')][_0x3572('0x52')]({'where':{'id':_0x5004cf[_0x3572('0x49')]['id']}})['then'](handleEntityNotFound(_0x388910,null))[_0x3572('0x2f')](function(_0x5c3d5f){if(_0x5c3d5f){_0x3c5c66=_0x5c3d5f;_0x29824a['model']=_[_0x3572('0x4a')](db[_0x3572('0x53')][_0x3572('0x35')]);_0x29824a[_0x3572('0x37')]=_[_0x3572('0x4a')](_0x5004cf['query']);_0x29824a[_0x3572('0x38')]=_['intersection'](_0x29824a[_0x3572('0x36')],_0x29824a[_0x3572('0x37')]);_0x5696d0[_0x3572('0x3a')]=_[_0x3572('0x39')](_0x29824a[_0x3572('0x36')],qs[_0x3572('0x3b')](_0x5004cf['query'][_0x3572('0x3b')]));_0x5696d0[_0x3572('0x3a')]=_0x5696d0[_0x3572('0x3a')][_0x3572('0x3c')]?_0x5696d0['attributes']:_0x29824a[_0x3572('0x36')];_0x5696d0[_0x3572('0x3e')]=qs[_0x3572('0x3f')](_0x5004cf[_0x3572('0x37')][_0x3572('0x3f')]);_0x5696d0[_0x3572('0x41')]=qs[_0x3572('0x38')](_['pick'](_0x5004cf[_0x3572('0x37')],_0x29824a['filters']));if(_0x5004cf[_0x3572('0x37')][_0x3572('0x54')]){_0x5696d0[_0x3572('0x41')]=_[_0x3572('0x42')](_0x5696d0[_0x3572('0x41')],{'$or':_['map'](_0x5696d0[_0x3572('0x3a')],function(_0x2efecb){var _0x3dc0e9={};_0x3dc0e9[_0x2efecb]={'$like':'%'+_0x5004cf[_0x3572('0x37')][_0x3572('0x54')]+'%'};return _0x3dc0e9;})});}_0x5696d0=_[_0x3572('0x42')]({},_0x5696d0,_0x5004cf[_0x3572('0x4c')]);return _0x3c5c66[_0x3572('0x58')](_0x5696d0);}})[_0x3572('0x2f')](function(_0x298be5){if(_0x298be5){_0x5c7857=_0x298be5['length'];if(!_0x5004cf[_0x3572('0x37')]['hasOwnProperty']('nolimit')){_0x5696d0['limit']=qs[_0x3572('0x29')](_0x5004cf[_0x3572('0x37')][_0x3572('0x29')]);_0x5696d0[_0x3572('0x28')]=qs['offset'](_0x5004cf['query'][_0x3572('0x28')]);}return _0x3c5c66['getDescriptions'](_0x5696d0);}})['then'](function(_0x1574f4){if(_0x1574f4){return _0x1574f4?{'count':_0x5c7857,'rows':_0x1574f4}:null;}})[_0x3572('0x2f')](respondWithResult(_0x388910,null))[_0x3572('0x24')](handleError(_0x388910,null));};exports[_0x3572('0x59')]=function(_0x44df15,_0x510c82,_0x4ca379){var _0x21320f={};var _0x16f023={};var _0x1eba0f;var _0x49926f;return db[_0x3572('0x46')][_0x3572('0x52')]({'where':{'id':_0x44df15[_0x3572('0x49')]['id']}})[_0x3572('0x2f')](handleEntityNotFound(_0x510c82,null))[_0x3572('0x2f')](function(_0x4c7d8c){if(_0x4c7d8c){_0x1eba0f=_0x4c7d8c;_0x16f023[_0x3572('0x36')]=_[_0x3572('0x4a')](db['Tag'][_0x3572('0x35')]);_0x16f023['query']=_[_0x3572('0x4a')](_0x44df15[_0x3572('0x37')]);_0x16f023[_0x3572('0x38')]=_[_0x3572('0x39')](_0x16f023[_0x3572('0x36')],_0x16f023[_0x3572('0x37')]);_0x21320f[_0x3572('0x3a')]=_['intersection'](_0x16f023['model'],qs[_0x3572('0x3b')](_0x44df15['query']['fields']));_0x21320f['attributes']=_0x21320f[_0x3572('0x3a')]['length']?_0x21320f['attributes']:_0x16f023[_0x3572('0x36')];_0x21320f['order']=qs[_0x3572('0x3f')](_0x44df15[_0x3572('0x37')][_0x3572('0x3f')]);_0x21320f[_0x3572('0x41')]=qs[_0x3572('0x38')](_[_0x3572('0x40')](_0x44df15[_0x3572('0x37')],_0x16f023['filters']));if(_0x44df15[_0x3572('0x37')][_0x3572('0x54')]){_0x21320f[_0x3572('0x41')]=_[_0x3572('0x42')](_0x21320f[_0x3572('0x41')],{'$or':_['map'](_0x21320f[_0x3572('0x3a')],function(_0x3515d9){var _0x200758={};_0x200758[_0x3515d9]={'$like':'%'+_0x44df15[_0x3572('0x37')][_0x3572('0x54')]+'%'};return _0x200758;})});}_0x21320f=_[_0x3572('0x42')]({},_0x21320f,_0x44df15[_0x3572('0x4c')]);return _0x1eba0f[_0x3572('0x59')](_0x21320f);}})[_0x3572('0x2f')](function(_0x2008cf){if(_0x2008cf){_0x49926f=_0x2008cf[_0x3572('0x3c')];if(!_0x44df15[_0x3572('0x37')]['hasOwnProperty'](_0x3572('0x56'))){_0x21320f[_0x3572('0x29')]=qs[_0x3572('0x29')](_0x44df15[_0x3572('0x37')][_0x3572('0x29')]);_0x21320f[_0x3572('0x28')]=qs['offset'](_0x44df15[_0x3572('0x37')][_0x3572('0x28')]);}return _0x1eba0f['getTags'](_0x21320f);}})[_0x3572('0x2f')](function(_0x28322a){if(_0x28322a){return _0x28322a?{'count':_0x49926f,'rows':_0x28322a}:null;}})[_0x3572('0x2f')](respondWithResult(_0x510c82,null))[_0x3572('0x24')](handleError(_0x510c82,null));};exports[_0x3572('0x5a')]=function(_0x3249ff,_0x1e11af,_0x320662){if(_0x3249ff['body']['id']){delete _0x3249ff[_0x3572('0x4f')]['id'];}return db[_0x3572('0x46')][_0x3572('0x52')]({'where':{'id':_0x3249ff['params']['id']}})['then'](handleEntityNotFound(_0x1e11af,null))[_0x3572('0x2f')](function(_0x3e44ee){if(_0x3e44ee){return _0x3e44ee[_0x3572('0x5a')](_0x3249ff['body'][_0x3572('0x5b')]||[]);}return null;})[_0x3572('0x2f')](respondWithResult(_0x1e11af,null))[_0x3572('0x24')](handleError(_0x1e11af,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 4d7988f..29584bf 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 _0x535d=['lodash','util','api','moment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration'];(function(_0xc1c7d7,_0x1ba58c){var _0x2315ff=function(_0x36f8ab){while(--_0x36f8ab){_0xc1c7d7['push'](_0xc1c7d7['shift']());}};_0x2315ff(++_0x1ba58c);}(_0x535d,0xe8));var _0xd535=function(_0x14151d,_0x31f6ec){_0x14151d=_0x14151d-0x0;var _0x1cfa59=_0x535d[_0x14151d];return _0x1cfa59;};'use strict';var _=require(_0xd535('0x0'));var util=require(_0xd535('0x1'));var logger=require('../../config/logger')(_0xd535('0x2'));var moment=require(_0xd535('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xd535('0x4'));module[_0xd535('0x5')]=function(_0x108ed6,_0x3237ed){return _0x108ed6[_0xd535('0x6')](_0xd535('0x7'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a99=['api','moment','request-promise','exports','FreshdeskConfiguration','int_freshdesk_configurations','lodash'];(function(_0xae11a3,_0x93a629){var _0x481f5f=function(_0x46a4b3){while(--_0x46a4b3){_0xae11a3['push'](_0xae11a3['shift']());}};_0x481f5f(++_0x93a629);}(_0x4a99,0x1aa));var _0x94a9=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x4a99[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x94a9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x94a9('0x1'));var moment=require(_0x94a9('0x2'));var BPromise=require('bluebird');var rp=require(_0x94a9('0x3'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x94a9('0x4')]=function(_0x46dcc3,_0xa3185e){return _0x46dcc3['define'](_0x94a9('0x5'),attributes,{'tableName':_0x94a9('0x6'),'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 c865907..149bc9e 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 _0x912b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../config/utils'];(function(_0x5e6fca,_0x540568){var _0x505941=function(_0x4c1d36){while(--_0x4c1d36){_0x5e6fca['push'](_0x5e6fca['shift']());}};_0x505941(++_0x540568);}(_0x912b,0x10f));var _0xb912=function(_0x27d8bc,_0x19e010){_0x27d8bc=_0x27d8bc-0x0;var _0x4b04cb=_0x912b[_0x27d8bc];return _0x4b04cb;};'use strict';var _=require(_0xb912('0x0'));var util=require(_0xb912('0x1'));var moment=require(_0xb912('0x2'));var BPromise=require(_0xb912('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb912('0x4'));var logger=require(_0xb912('0x5'))(_0xb912('0x6'));var config=require(_0xb912('0x7'));var jayson=require(_0xb912('0x8'));var client=jayson[_0xb912('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48d65f,_0x141534,_0x5932ce){return new BPromise(function(_0x15fefc,_0x590b22){return client[_0xb912('0xa')](_0x48d65f,_0x5932ce)[_0xb912('0xb')](function(_0x10b221){logger[_0xb912('0xc')](_0xb912('0xd'),_0x141534,_0xb912('0xe'));logger[_0xb912('0xf')](_0xb912('0x10'),_0x141534,_0xb912('0xe'),JSON[_0xb912('0x11')](_0x10b221));if(_0x10b221['error']){if(_0x10b221[_0xb912('0x12')][_0xb912('0x13')]===0x1f4){logger[_0xb912('0x12')](_0xb912('0xd'),_0x141534,_0x10b221['error'][_0xb912('0x14')]);return _0x590b22(_0x10b221['error'][_0xb912('0x14')]);}logger[_0xb912('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x141534,_0x10b221[_0xb912('0x12')]['message']);return _0x15fefc(_0x10b221[_0xb912('0x12')][_0xb912('0x14')]);}else{logger[_0xb912('0xc')](_0xb912('0xd'),_0x141534,_0xb912('0xe'));_0x15fefc(_0x10b221[_0xb912('0x15')][_0xb912('0x14')]);}})[_0xb912('0x16')](function(_0x244503){logger[_0xb912('0x12')](_0xb912('0xd'),_0x141534,_0x244503);_0x590b22(_0x244503);});});} \ No newline at end of file +var _0xbd81=['../../config/logger','jayson/promise','http','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskConfiguration,\x20%s,\x20%s','message','info','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dc686,_0x12d9bb){var _0x45a816=function(_0x2a43c0){while(--_0x2a43c0){_0x3dc686['push'](_0x3dc686['shift']());}};_0x45a816(++_0x12d9bb);}(_0xbd81,0x1c6));var _0x1bd8=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xbd81[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x1bd8('0x0'));var util=require('util');var moment=require(_0x1bd8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1bd8('0x2'));var db=require(_0x1bd8('0x3'))['db'];var utils=require(_0x1bd8('0x4'));var logger=require(_0x1bd8('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1bd8('0x6'));var client=jayson['client'][_0x1bd8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3bdb17,_0x2e9a8f,_0xbff8fa){return new BPromise(function(_0x5a3832,_0x4157cd){return client['request'](_0x3bdb17,_0xbff8fa)['then'](function(_0x437a8b){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x2e9a8f,_0x1bd8('0x8'));logger[_0x1bd8('0x9')](_0x1bd8('0xa'),_0x2e9a8f,_0x1bd8('0x8'),JSON[_0x1bd8('0xb')](_0x437a8b));if(_0x437a8b[_0x1bd8('0xc')]){if(_0x437a8b[_0x1bd8('0xc')]['code']===0x1f4){logger['error'](_0x1bd8('0xd'),_0x2e9a8f,_0x437a8b['error'][_0x1bd8('0xe')]);return _0x4157cd(_0x437a8b['error']['message']);}logger[_0x1bd8('0xc')](_0x1bd8('0xd'),_0x2e9a8f,_0x437a8b[_0x1bd8('0xc')][_0x1bd8('0xe')]);return _0x5a3832(_0x437a8b['error'][_0x1bd8('0xe')]);}else{logger[_0x1bd8('0xf')](_0x1bd8('0xd'),_0x2e9a8f,_0x1bd8('0x8'));_0x5a3832(_0x437a8b['result']['message']);}})[_0x1bd8('0x10')](function(_0x3e6b20){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x2e9a8f,_0x3e6b20);_0x4157cd(_0x3e6b20);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 6831755..c7372ab 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 _0x9d8c=['path','connect-timeout','express','Router','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','create','destroy','exports','multer'];(function(_0x27a69e,_0x331cd8){var _0x108865=function(_0x68a13f){while(--_0x68a13f){_0x27a69e['push'](_0x27a69e['shift']());}};_0x108865(++_0x331cd8);}(_0x9d8c,0x158));var _0xc9d8=function(_0x19ea50,_0x298a17){_0x19ea50=_0x19ea50-0x0;var _0x82bf0e=_0x9d8c[_0x19ea50];return _0x82bf0e;};'use strict';var multer=require(_0xc9d8('0x0'));var util=require('util');var path=require(_0xc9d8('0x1'));var timeout=require(_0xc9d8('0x2'));var express=require(_0xc9d8('0x3'));var router=express[_0xc9d8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc9d8('0x5'));var config=require('../../config/environment');var controller=require(_0xc9d8('0x6'));router[_0xc9d8('0x7')]('/',auth[_0xc9d8('0x8')](),controller[_0xc9d8('0x9')]);router[_0xc9d8('0x7')](_0xc9d8('0xa'),auth['isAuthenticated'](),controller[_0xc9d8('0xb')]);router['post']('/',auth[_0xc9d8('0x8')](),controller[_0xc9d8('0xc')]);router['put'](_0xc9d8('0xa'),auth[_0xc9d8('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc9d8('0xd')]);module[_0xc9d8('0xe')]=router; \ No newline at end of file +var _0xf151=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','show','post','create','put','update','delete','/:id'];(function(_0x51a9d0,_0xbebd29){var _0x4db0ee=function(_0x1aa662){while(--_0x1aa662){_0x51a9d0['push'](_0x51a9d0['shift']());}};_0x4db0ee(++_0xbebd29);}(_0xf151,0xab));var _0x1f15=function(_0x3ace87,_0x32d7fb){_0x3ace87=_0x3ace87-0x0;var _0x53453b=_0xf151[_0x3ace87];return _0x53453b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1f15('0x0'));var timeout=require(_0x1f15('0x1'));var express=require(_0x1f15('0x2'));var router=express[_0x1f15('0x3')]();var auth=require(_0x1f15('0x4'));var interaction=require(_0x1f15('0x5'));var config=require(_0x1f15('0x6'));var controller=require(_0x1f15('0x7'));router['get']('/',auth[_0x1f15('0x8')](),controller['index']);router['get']('/:id',auth[_0x1f15('0x8')](),controller[_0x1f15('0x9')]);router[_0x1f15('0xa')]('/',auth['isAuthenticated'](),controller[_0x1f15('0xb')]);router[_0x1f15('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x1f15('0xd')]);router[_0x1f15('0xe')](_0x1f15('0xf'),auth[_0x1f15('0x8')](),controller['destroy']);module[_0x1f15('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index b0ecb6e..b252de6 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 _0x153f=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x153f,0x15b));var _0xf153=function(_0xf17b9d,_0x2e465a){_0xf17b9d=_0xf17b9d-0x0;var _0x7df78b=_0x153f[_0xf17b9d];return _0x7df78b;};'use strict';var Sequelize=require(_0xf153('0x0'));module[_0xf153('0x1')]={'type':{'type':Sequelize[_0xf153('0x2')](_0xf153('0x3'),_0xf153('0x4'),_0xf153('0x5'),_0xf153('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf153('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf153('0x2')](_0xf153('0x3'),_0xf153('0x4'),_0xf153('0x5'))},'keyContent':{'type':Sequelize[_0xf153('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf153('0x7')]},'customField':{'type':Sequelize[_0xf153('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf153('0x7')]}}; \ No newline at end of file +var _0x13f6=['variable','customVariable','keyValue','STRING','ENUM','sequelize','exports'];(function(_0x480c53,_0x178804){var _0x5cda6c=function(_0x470c18){while(--_0x470c18){_0x480c53['push'](_0x480c53['shift']());}};_0x5cda6c(++_0x178804);}(_0x13f6,0x124));var _0x613f=function(_0x5655e8,_0xe308e5){_0x5655e8=_0x5655e8-0x0;var _0x164934=_0x13f6[_0x5655e8];return _0x164934;};'use strict';var Sequelize=require(_0x613f('0x0'));module[_0x613f('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x613f('0x2'),_0x613f('0x3'),_0x613f('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x613f('0x5')]},'key':{'type':Sequelize[_0x613f('0x5')]},'keyType':{'type':Sequelize[_0x613f('0x6')]('string',_0x613f('0x2'),_0x613f('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x613f('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index aca3161..eeffed7 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 _0xcb62=['../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','save','then','destroy','error','stack','name','send','rawAttributes','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','filter','merge','map','type','key','VIRTUAL','field','options','include','FreshdeskField','rows','catch','show','params','keys','includeAll','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service'];(function(_0x4472d0,_0x4d999e){var _0x3fcd89=function(_0x31a024){while(--_0x31a024){_0x4472d0['push'](_0x4472d0['shift']());}};_0x3fcd89(++_0x4d999e);}(_0xcb62,0x7f));var _0x2cb6=function(_0xce1f49,_0x46e6f9){_0xce1f49=_0xce1f49-0x0;var _0x1d6101=_0xcb62[_0xce1f49];return _0x1d6101;};'use strict';var pdf=require(_0x2cb6('0x0'));var emlformat=require(_0x2cb6('0x1'));var rimraf=require(_0x2cb6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2cb6('0x3'));var rp=require(_0x2cb6('0x4'));var moment=require(_0x2cb6('0x5'));var BPromise=require(_0x2cb6('0x6'));var Mustache=require(_0x2cb6('0x7'));var util=require(_0x2cb6('0x8'));var path=require(_0x2cb6('0x9'));var sox=require(_0x2cb6('0xa'));var csv=require('to-csv');var ejs=require(_0x2cb6('0xb'));var fs=require('fs');var _=require(_0x2cb6('0xc'));var squel=require(_0x2cb6('0xd'));var crypto=require(_0x2cb6('0xe'));var jsforce=require(_0x2cb6('0xf'));var deskjs=require(_0x2cb6('0x10'));var toCsv=require(_0x2cb6('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x2cb6('0x12'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0x2cb6('0x13'));var logger=require(_0x2cb6('0x14'))(_0x2cb6('0x15'));var utils=require(_0x2cb6('0x16'));var config=require(_0x2cb6('0x17'));var db=require(_0x2cb6('0x18'))['db'];function respondWithStatusCode(_0x171937,_0x35c112){_0x35c112=_0x35c112||0xcc;return function(_0x52ea5c){if(_0x52ea5c){return _0x171937[_0x2cb6('0x19')](_0x35c112);}return _0x171937['status'](_0x35c112)[_0x2cb6('0x1a')]();};}function respondWithResult(_0x5df9d7,_0x1d1a8e){_0x1d1a8e=_0x1d1a8e||0xc8;return function(_0x50386){if(_0x50386){return _0x5df9d7[_0x2cb6('0x1b')](_0x1d1a8e)[_0x2cb6('0x1c')](_0x50386);}};}function respondWithFilteredResult(_0x33b617,_0x8eaf10){return function(_0x2ec6e8){if(_0x2ec6e8){var _0x2b9005=_0x2ec6e8[_0x2cb6('0x1d')],_0x342604=_0x8eaf10[_0x2cb6('0x1e')],_0x1aea71=_0x8eaf10[_0x2cb6('0x1e')]+_0x8eaf10['limit'],_0x37c4ed;if(_0x1aea71>=_0x2b9005){_0x1aea71=_0x2b9005;_0x37c4ed=0xc8;}else{_0x37c4ed=0xce;}_0x33b617[_0x2cb6('0x1b')](_0x37c4ed);return _0x33b617[_0x2cb6('0x1f')](_0x2cb6('0x20'),_0x342604+'-'+_0x1aea71+'/'+_0x2b9005)[_0x2cb6('0x1c')](_0x2ec6e8);}return null;};}function patchUpdates(_0x28a3d3){return function(_0x391805){try{jsonpatch[_0x2cb6('0x21')](_0x391805,_0x28a3d3,!![]);}catch(_0x349198){return BPromise['reject'](_0x349198);}return _0x391805[_0x2cb6('0x22')]();};}function saveUpdates(_0x385f1c,_0x5929be){return function(_0x5b70c0){if(_0x5b70c0){return _0x5b70c0['update'](_0x385f1c)[_0x2cb6('0x23')](function(_0x2c11ed){return _0x2c11ed;});}return null;};}function removeEntity(_0x434982,_0x15f394){return function(_0x47f1c6){if(_0x47f1c6){return _0x47f1c6[_0x2cb6('0x24')]()['then'](function(){_0x434982[_0x2cb6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x117037,_0x243108){return function(_0x417c36){if(!_0x417c36){_0x117037[_0x2cb6('0x19')](0x194);}return _0x417c36;};}function handleError(_0x2afbf2,_0x4faab7){_0x4faab7=_0x4faab7||0x1f4;return function(_0x2546fd){logger[_0x2cb6('0x25')](_0x2546fd[_0x2cb6('0x26')]);if(_0x2546fd[_0x2cb6('0x27')]){delete _0x2546fd[_0x2cb6('0x27')];}_0x2afbf2[_0x2cb6('0x1b')](_0x4faab7)[_0x2cb6('0x28')](_0x2546fd);};}exports['index']=function(_0x160239,_0x54ebbb){var _0x4e2883={},_0x907237={},_0xe13f1={'count':0x0,'rows':[]};var _0x94f5c5=db['FreshdeskField'][_0x2cb6('0x29')];_0x907237[_0x2cb6('0x2a')]=_['keys'](_0x94f5c5);_0x907237[_0x2cb6('0x2b')]=_['keys'](_0x160239[_0x2cb6('0x2b')]);_0x907237['filters']=_[_0x2cb6('0x2c')](_0x907237['model'],_0x907237[_0x2cb6('0x2b')]);_0x4e2883[_0x2cb6('0x2d')]=_[_0x2cb6('0x2c')](_0x907237[_0x2cb6('0x2a')],qs[_0x2cb6('0x2e')](_0x160239[_0x2cb6('0x2b')][_0x2cb6('0x2e')]));_0x4e2883[_0x2cb6('0x2d')]=_0x4e2883['attributes'][_0x2cb6('0x2f')]?_0x4e2883[_0x2cb6('0x2d')]:_0x907237['model'];if(!_0x160239[_0x2cb6('0x2b')][_0x2cb6('0x30')](_0x2cb6('0x31'))){_0x4e2883[_0x2cb6('0x32')]=qs['limit'](_0x160239[_0x2cb6('0x2b')][_0x2cb6('0x32')]);_0x4e2883[_0x2cb6('0x1e')]=qs[_0x2cb6('0x1e')](_0x160239[_0x2cb6('0x2b')][_0x2cb6('0x1e')]);}_0x4e2883['order']=qs[_0x2cb6('0x33')](_0x160239[_0x2cb6('0x2b')][_0x2cb6('0x33')]);_0x4e2883[_0x2cb6('0x34')]=qs['filters'](_['pick'](_0x160239[_0x2cb6('0x2b')],_0x907237[_0x2cb6('0x35')]));if(_0x160239[_0x2cb6('0x2b')][_0x2cb6('0x36')]){_0x4e2883['where']=_[_0x2cb6('0x37')](_0x4e2883[_0x2cb6('0x34')],{'$or':_[_0x2cb6('0x38')](_0x94f5c5,function(_0x45ef98){if(_0x45ef98[_0x2cb6('0x39')][_0x2cb6('0x3a')]!==_0x2cb6('0x3b')){var _0x5e33d3={};_0x5e33d3[_0x45ef98[_0x2cb6('0x3c')]]={'$like':'%'+_0x160239[_0x2cb6('0x2b')]['filter']+'%'};return _0x5e33d3;}})});}_0x4e2883=_['merge']({},_0x4e2883,_0x160239[_0x2cb6('0x3d')]);var _0x147114={'where':_0x4e2883[_0x2cb6('0x34')]};return db['FreshdeskField'][_0x2cb6('0x1d')](_0x147114)['then'](function(_0x488e89){_0xe13f1[_0x2cb6('0x1d')]=_0x488e89;if(_0x160239['query']['includeAll']){_0x4e2883[_0x2cb6('0x3e')]=[{'all':!![]}];}return db[_0x2cb6('0x3f')]['findAll'](_0x4e2883);})[_0x2cb6('0x23')](function(_0x17c38e){_0xe13f1[_0x2cb6('0x40')]=_0x17c38e;return _0xe13f1;})[_0x2cb6('0x23')](respondWithFilteredResult(_0x54ebbb,_0x4e2883))[_0x2cb6('0x41')](handleError(_0x54ebbb,null));};exports[_0x2cb6('0x42')]=function(_0x2bd828,_0x439d29){var _0x474017={'raw':!![],'where':{'id':_0x2bd828[_0x2cb6('0x43')]['id']}},_0x17f5bc={};_0x17f5bc[_0x2cb6('0x2a')]=_[_0x2cb6('0x44')](db[_0x2cb6('0x3f')][_0x2cb6('0x29')]);_0x17f5bc[_0x2cb6('0x2b')]=_[_0x2cb6('0x44')](_0x2bd828['query']);_0x17f5bc[_0x2cb6('0x35')]=_[_0x2cb6('0x2c')](_0x17f5bc['model'],_0x17f5bc['query']);_0x474017['attributes']=_[_0x2cb6('0x2c')](_0x17f5bc['model'],qs[_0x2cb6('0x2e')](_0x2bd828[_0x2cb6('0x2b')]['fields']));_0x474017['attributes']=_0x474017[_0x2cb6('0x2d')][_0x2cb6('0x2f')]?_0x474017[_0x2cb6('0x2d')]:_0x17f5bc[_0x2cb6('0x2a')];if(_0x2bd828[_0x2cb6('0x2b')][_0x2cb6('0x45')]){_0x474017[_0x2cb6('0x3e')]=[{'all':!![]}];}_0x474017=_[_0x2cb6('0x37')]({},_0x474017,_0x2bd828[_0x2cb6('0x3d')]);return db[_0x2cb6('0x3f')][_0x2cb6('0x46')](_0x474017)[_0x2cb6('0x23')](handleEntityNotFound(_0x439d29,null))[_0x2cb6('0x23')](respondWithResult(_0x439d29,null))[_0x2cb6('0x41')](handleError(_0x439d29,null));};exports[_0x2cb6('0x47')]=function(_0x19f759,_0x2a5374){return db[_0x2cb6('0x3f')][_0x2cb6('0x47')](_0x19f759['body'],{})['then'](respondWithResult(_0x2a5374,0xc9))['catch'](handleError(_0x2a5374,null));};exports['update']=function(_0x2ee2e4,_0x5e79ca){if(_0x2ee2e4[_0x2cb6('0x48')]['id']){delete _0x2ee2e4[_0x2cb6('0x48')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x2ee2e4[_0x2cb6('0x43')]['id']}})[_0x2cb6('0x23')](handleEntityNotFound(_0x5e79ca,null))['then'](saveUpdates(_0x2ee2e4[_0x2cb6('0x48')],null))[_0x2cb6('0x23')](respondWithResult(_0x5e79ca,null))[_0x2cb6('0x41')](handleError(_0x5e79ca,null));};exports['destroy']=function(_0x943440,_0x2f076a){return db[_0x2cb6('0x3f')]['find']({'where':{'id':_0x943440[_0x2cb6('0x43')]['id']}})[_0x2cb6('0x23')](handleEntityNotFound(_0x2f076a,null))[_0x2cb6('0x23')](removeEntity(_0x2f076a,null))[_0x2cb6('0x41')](handleError(_0x2f076a,null));}; \ No newline at end of file +var _0x1540=['fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','desk.js','papaparse','../../config/license/hardware','ioredis','../../config/environment','status','end','limit','set','Content-Range','apply','save','then','error','stack','name','send','index','FreshdeskField','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','map','VIRTUAL','field','filter','options','count','includeAll','include','findAll','rows','rawAttributes','catch','create','update','body','find','params','html-pdf','eml-format','rimraf'];(function(_0x58ca17,_0x11d97b){var _0x54ccf8=function(_0x4ce5c0){while(--_0x4ce5c0){_0x58ca17['push'](_0x58ca17['shift']());}};_0x54ccf8(++_0x11d97b);}(_0x1540,0x1c4));var _0x0154=function(_0x22201d,_0x1af30c){_0x22201d=_0x22201d-0x0;var _0xb12ed2=_0x1540[_0x22201d];return _0xb12ed2;};'use strict';var pdf=require(_0x0154('0x0'));var emlformat=require(_0x0154('0x1'));var rimraf=require(_0x0154('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0154('0x3'));var rp=require(_0x0154('0x4'));var moment=require(_0x0154('0x5'));var BPromise=require(_0x0154('0x6'));var Mustache=require(_0x0154('0x7'));var util=require('util');var path=require(_0x0154('0x8'));var sox=require('sox');var csv=require(_0x0154('0x9'));var ejs=require(_0x0154('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0154('0xb'));var crypto=require(_0x0154('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0154('0xd'));var toCsv=require(_0x0154('0x9'));var querystring=require('querystring');var Papa=require(_0x0154('0xe'));var authService=require('../../components/auth/service');var hardwareService=require(_0x0154('0xf'));var Redis=require(_0x0154('0x10'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0154('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4aa873,_0x2827c0){_0x2827c0=_0x2827c0||0xcc;return function(_0x48279d){if(_0x48279d){return _0x4aa873['sendStatus'](_0x2827c0);}return _0x4aa873[_0x0154('0x12')](_0x2827c0)[_0x0154('0x13')]();};}function respondWithResult(_0x1e19a5,_0x187e3e){_0x187e3e=_0x187e3e||0xc8;return function(_0x43fe76){if(_0x43fe76){return _0x1e19a5['status'](_0x187e3e)['json'](_0x43fe76);}};}function respondWithFilteredResult(_0x53a184,_0x3e768e){return function(_0xf9bc93){if(_0xf9bc93){var _0x400711=_0xf9bc93['count'],_0x244ed1=_0x3e768e['offset'],_0x1c7f52=_0x3e768e['offset']+_0x3e768e[_0x0154('0x14')],_0x40797f;if(_0x1c7f52>=_0x400711){_0x1c7f52=_0x400711;_0x40797f=0xc8;}else{_0x40797f=0xce;}_0x53a184[_0x0154('0x12')](_0x40797f);return _0x53a184[_0x0154('0x15')](_0x0154('0x16'),_0x244ed1+'-'+_0x1c7f52+'/'+_0x400711)['json'](_0xf9bc93);}return null;};}function patchUpdates(_0xe6e547){return function(_0x5cc000){try{jsonpatch[_0x0154('0x17')](_0x5cc000,_0xe6e547,!![]);}catch(_0x3ad0d4){return BPromise['reject'](_0x3ad0d4);}return _0x5cc000[_0x0154('0x18')]();};}function saveUpdates(_0xe468e1,_0x345853){return function(_0xb8a098){if(_0xb8a098){return _0xb8a098['update'](_0xe468e1)[_0x0154('0x19')](function(_0x3b3f6c){return _0x3b3f6c;});}return null;};}function removeEntity(_0x3bc637,_0x2fb078){return function(_0x57f759){if(_0x57f759){return _0x57f759['destroy']()[_0x0154('0x19')](function(){_0x3bc637[_0x0154('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f7b20,_0xa5514d){return function(_0x1fb05e){if(!_0x1fb05e){_0x1f7b20['sendStatus'](0x194);}return _0x1fb05e;};}function handleError(_0x1fe625,_0x4c7873){_0x4c7873=_0x4c7873||0x1f4;return function(_0xe3829f){logger[_0x0154('0x1a')](_0xe3829f[_0x0154('0x1b')]);if(_0xe3829f[_0x0154('0x1c')]){delete _0xe3829f[_0x0154('0x1c')];}_0x1fe625[_0x0154('0x12')](_0x4c7873)[_0x0154('0x1d')](_0xe3829f);};}exports[_0x0154('0x1e')]=function(_0x48ec5d,_0x444825){var _0x445e2c={},_0x3fc64c={},_0x2a8a79={'count':0x0,'rows':[]};var _0x122e2c=db[_0x0154('0x1f')]['rawAttributes'];_0x3fc64c[_0x0154('0x20')]=_[_0x0154('0x21')](_0x122e2c);_0x3fc64c[_0x0154('0x22')]=_[_0x0154('0x21')](_0x48ec5d[_0x0154('0x22')]);_0x3fc64c[_0x0154('0x23')]=_[_0x0154('0x24')](_0x3fc64c[_0x0154('0x20')],_0x3fc64c['query']);_0x445e2c[_0x0154('0x25')]=_['intersection'](_0x3fc64c[_0x0154('0x20')],qs[_0x0154('0x26')](_0x48ec5d[_0x0154('0x22')]['fields']));_0x445e2c[_0x0154('0x25')]=_0x445e2c[_0x0154('0x25')][_0x0154('0x27')]?_0x445e2c[_0x0154('0x25')]:_0x3fc64c[_0x0154('0x20')];if(!_0x48ec5d['query'][_0x0154('0x28')](_0x0154('0x29'))){_0x445e2c[_0x0154('0x14')]=qs[_0x0154('0x14')](_0x48ec5d[_0x0154('0x22')][_0x0154('0x14')]);_0x445e2c['offset']=qs[_0x0154('0x2a')](_0x48ec5d[_0x0154('0x22')][_0x0154('0x2a')]);}_0x445e2c[_0x0154('0x2b')]=qs[_0x0154('0x2c')](_0x48ec5d[_0x0154('0x22')][_0x0154('0x2c')]);_0x445e2c[_0x0154('0x2d')]=qs[_0x0154('0x23')](_[_0x0154('0x2e')](_0x48ec5d[_0x0154('0x22')],_0x3fc64c[_0x0154('0x23')]));if(_0x48ec5d['query']['filter']){_0x445e2c[_0x0154('0x2d')]=_[_0x0154('0x2f')](_0x445e2c[_0x0154('0x2d')],{'$or':_[_0x0154('0x30')](_0x122e2c,function(_0x32d070){if(_0x32d070['type']['key']!==_0x0154('0x31')){var _0x48b366={};_0x48b366[_0x32d070[_0x0154('0x32')]]={'$like':'%'+_0x48ec5d['query'][_0x0154('0x33')]+'%'};return _0x48b366;}})});}_0x445e2c=_['merge']({},_0x445e2c,_0x48ec5d[_0x0154('0x34')]);var _0x55e7ed={'where':_0x445e2c[_0x0154('0x2d')]};return db[_0x0154('0x1f')][_0x0154('0x35')](_0x55e7ed)[_0x0154('0x19')](function(_0xa466e){_0x2a8a79['count']=_0xa466e;if(_0x48ec5d[_0x0154('0x22')][_0x0154('0x36')]){_0x445e2c[_0x0154('0x37')]=[{'all':!![]}];}return db[_0x0154('0x1f')][_0x0154('0x38')](_0x445e2c);})[_0x0154('0x19')](function(_0x1dbcae){_0x2a8a79[_0x0154('0x39')]=_0x1dbcae;return _0x2a8a79;})['then'](respondWithFilteredResult(_0x444825,_0x445e2c))['catch'](handleError(_0x444825,null));};exports['show']=function(_0x4322a8,_0x32b7e3){var _0x3d1915={'raw':!![],'where':{'id':_0x4322a8['params']['id']}},_0x32d691={};_0x32d691[_0x0154('0x20')]=_[_0x0154('0x21')](db[_0x0154('0x1f')][_0x0154('0x3a')]);_0x32d691['query']=_[_0x0154('0x21')](_0x4322a8[_0x0154('0x22')]);_0x32d691['filters']=_[_0x0154('0x24')](_0x32d691['model'],_0x32d691[_0x0154('0x22')]);_0x3d1915[_0x0154('0x25')]=_['intersection'](_0x32d691[_0x0154('0x20')],qs['fields'](_0x4322a8[_0x0154('0x22')]['fields']));_0x3d1915['attributes']=_0x3d1915['attributes']['length']?_0x3d1915[_0x0154('0x25')]:_0x32d691[_0x0154('0x20')];if(_0x4322a8[_0x0154('0x22')][_0x0154('0x36')]){_0x3d1915['include']=[{'all':!![]}];}_0x3d1915=_[_0x0154('0x2f')]({},_0x3d1915,_0x4322a8[_0x0154('0x34')]);return db['FreshdeskField']['find'](_0x3d1915)[_0x0154('0x19')](handleEntityNotFound(_0x32b7e3,null))[_0x0154('0x19')](respondWithResult(_0x32b7e3,null))[_0x0154('0x3b')](handleError(_0x32b7e3,null));};exports[_0x0154('0x3c')]=function(_0x466d9f,_0x2ecbdf){return db['FreshdeskField'][_0x0154('0x3c')](_0x466d9f['body'],{})[_0x0154('0x19')](respondWithResult(_0x2ecbdf,0xc9))['catch'](handleError(_0x2ecbdf,null));};exports[_0x0154('0x3d')]=function(_0xf0a8c9,_0xb3b817){if(_0xf0a8c9[_0x0154('0x3e')]['id']){delete _0xf0a8c9['body']['id'];}return db[_0x0154('0x1f')][_0x0154('0x3f')]({'where':{'id':_0xf0a8c9[_0x0154('0x40')]['id']}})[_0x0154('0x19')](handleEntityNotFound(_0xb3b817,null))[_0x0154('0x19')](saveUpdates(_0xf0a8c9[_0x0154('0x3e')],null))[_0x0154('0x19')](respondWithResult(_0xb3b817,null))[_0x0154('0x3b')](handleError(_0xb3b817,null));};exports['destroy']=function(_0x4bf840,_0x43e01e){return db[_0x0154('0x1f')][_0x0154('0x3f')]({'where':{'id':_0x4bf840[_0x0154('0x40')]['id']}})[_0x0154('0x19')](handleEntityNotFound(_0x43e01e,null))[_0x0154('0x19')](removeEntity(_0x43e01e,null))[_0x0154('0x3b')](handleError(_0x43e01e,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 62799f9..fad427a 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 _0x7657=['freshdesk_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields'];(function(_0x31d6b0,_0x4830b0){var _0x14ea4d=function(_0x51d6c7){while(--_0x51d6c7){_0x31d6b0['push'](_0x31d6b0['shift']());}};_0x14ea4d(++_0x4830b0);}(_0x7657,0x92));var _0x7765=function(_0x2911be,_0x503185){_0x2911be=_0x2911be-0x0;var _0x55ff00=_0x7657[_0x2911be];return _0x55ff00;};'use strict';var _=require(_0x7765('0x0'));var util=require(_0x7765('0x1'));var logger=require('../../config/logger')(_0x7765('0x2'));var moment=require(_0x7765('0x3'));var BPromise=require(_0x7765('0x4'));var rp=require('request-promise');var attributes=require(_0x7765('0x5'));module[_0x7765('0x6')]=function(_0x3e8eda,_0x3a9534){return _0x3e8eda[_0x7765('0x7')](_0x7765('0x8'),attributes,{'tableName':_0x7765('0x9'),'paranoid':![],'indexes':[{'name':_0x7765('0xa'),'fields':[_0x7765('0xb'),_0x7765('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1e83=['FieldId','lodash','util','api','request-promise','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','freshdesk_unique_index','idField'];(function(_0x1fadff,_0x11ea0c){var _0x2477f5=function(_0x5ac160){while(--_0x5ac160){_0x1fadff['push'](_0x1fadff['shift']());}};_0x2477f5(++_0x11ea0c);}(_0x1e83,0xf3));var _0x31e8=function(_0x4e5338,_0x137228){_0x4e5338=_0x4e5338-0x0;var _0x241730=_0x1e83[_0x4e5338];return _0x241730;};'use strict';var _=require(_0x31e8('0x0'));var util=require(_0x31e8('0x1'));var logger=require('../../config/logger')(_0x31e8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x31e8('0x3'));var attributes=require(_0x31e8('0x4'));module[_0x31e8('0x5')]=function(_0x4d415b,_0x1c85ec){return _0x4d415b[_0x31e8('0x6')]('FreshdeskField',attributes,{'tableName':_0x31e8('0x7'),'paranoid':![],'indexes':[{'name':_0x31e8('0x8'),'fields':[_0x31e8('0x9'),_0x31e8('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 20d255d..7512e30 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 _0x9567=['info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','request','then'];(function(_0x187d80,_0x5b793f){var _0x498a77=function(_0x633dc9){while(--_0x633dc9){_0x187d80['push'](_0x187d80['shift']());}};_0x498a77(++_0x5b793f);}(_0x9567,0xdc));var _0x7956=function(_0x24e348,_0x2d9424){_0x24e348=_0x24e348-0x0;var _0xc83c1f=_0x9567[_0x24e348];return _0xc83c1f;};'use strict';var _=require(_0x7956('0x0'));var util=require(_0x7956('0x1'));var moment=require(_0x7956('0x2'));var BPromise=require(_0x7956('0x3'));var rs=require(_0x7956('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7956('0x5'));var logger=require(_0x7956('0x6'))('rpc');var config=require(_0x7956('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7956('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1819b6,_0x31b50d,_0x48b2b3){return new BPromise(function(_0x3c213a,_0x50038a){return client[_0x7956('0x9')](_0x1819b6,_0x48b2b3)[_0x7956('0xa')](function(_0x53310c){logger[_0x7956('0xb')](_0x7956('0xc'),_0x31b50d,'request\x20sent');logger[_0x7956('0xd')](_0x7956('0xe'),_0x31b50d,_0x7956('0xf'),JSON['stringify'](_0x53310c));if(_0x53310c[_0x7956('0x10')]){if(_0x53310c[_0x7956('0x10')][_0x7956('0x11')]===0x1f4){logger[_0x7956('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x31b50d,_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);return _0x50038a(_0x53310c[_0x7956('0x10')]['message']);}logger[_0x7956('0x10')](_0x7956('0xc'),_0x31b50d,_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);return _0x3c213a(_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);}else{logger[_0x7956('0xb')](_0x7956('0xc'),_0x31b50d,_0x7956('0xf'));_0x3c213a(_0x53310c[_0x7956('0x13')][_0x7956('0x12')]);}})[_0x7956('0x14')](function(_0x18ae51){logger[_0x7956('0x10')](_0x7956('0xc'),_0x31b50d,_0x18ae51);_0x50038a(_0x18ae51);});});} \ No newline at end of file +var _0xb2b3=['error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s'];(function(_0x1ee0a1,_0x51058e){var _0x1d2d5b=function(_0x35cfb5){while(--_0x35cfb5){_0x1ee0a1['push'](_0x1ee0a1['shift']());}};_0x1d2d5b(++_0x51058e);}(_0xb2b3,0x71));var _0x3b2b=function(_0x2ae1a9,_0x26ec9d){_0x2ae1a9=_0x2ae1a9-0x0;var _0xacf701=_0xb2b3[_0x2ae1a9];return _0xacf701;};'use strict';var _=require(_0x3b2b('0x0'));var util=require(_0x3b2b('0x1'));var moment=require(_0x3b2b('0x2'));var BPromise=require(_0x3b2b('0x3'));var rs=require(_0x3b2b('0x4'));var fs=require('fs');var Redis=require(_0x3b2b('0x5'));var db=require(_0x3b2b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b2b('0x7'))(_0x3b2b('0x8'));var config=require(_0x3b2b('0x9'));var jayson=require(_0x3b2b('0xa'));var client=jayson[_0x3b2b('0xb')][_0x3b2b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x83e7ef,_0x24b585,_0x1a9054){return new BPromise(function(_0x3ec416,_0x33b807){return client[_0x3b2b('0xd')](_0x83e7ef,_0x1a9054)['then'](function(_0x430be0){logger[_0x3b2b('0xe')](_0x3b2b('0xf'),_0x24b585,_0x3b2b('0x10'));logger[_0x3b2b('0x11')](_0x3b2b('0x12'),_0x24b585,'request\x20sent',JSON['stringify'](_0x430be0));if(_0x430be0[_0x3b2b('0x13')]){if(_0x430be0[_0x3b2b('0x13')][_0x3b2b('0x14')]===0x1f4){logger[_0x3b2b('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x24b585,_0x430be0[_0x3b2b('0x13')][_0x3b2b('0x15')]);return _0x33b807(_0x430be0[_0x3b2b('0x13')][_0x3b2b('0x15')]);}logger[_0x3b2b('0x13')](_0x3b2b('0xf'),_0x24b585,_0x430be0['error'][_0x3b2b('0x15')]);return _0x3ec416(_0x430be0[_0x3b2b('0x13')]['message']);}else{logger[_0x3b2b('0xe')](_0x3b2b('0xf'),_0x24b585,_0x3b2b('0x10'));_0x3ec416(_0x430be0['result'][_0x3b2b('0x15')]);}})['catch'](function(_0x21743d){logger[_0x3b2b('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x24b585,_0x21743d);_0x33b807(_0x21743d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 937296c..b1dc578 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 _0xf5b9=['/:id/fields','getFields','delete','exports','multer','path','connect-timeout','express','../../config/environment','./intSalesforceAccount.controller','isAuthenticated','/:id','show','get','/:id/configurations','getConfigurations'];(function(_0x1d159c,_0x1bbcc0){var _0x5e3081=function(_0x27791a){while(--_0x27791a){_0x1d159c['push'](_0x1d159c['shift']());}};_0x5e3081(++_0x1bbcc0);}(_0xf5b9,0xf4));var _0x9f5b=function(_0x383746,_0x307820){_0x383746=_0x383746-0x0;var _0x2e70a2=_0xf5b9[_0x383746];return _0x2e70a2;};'use strict';var multer=require(_0x9f5b('0x0'));var util=require('util');var path=require(_0x9f5b('0x1'));var timeout=require(_0x9f5b('0x2'));var express=require(_0x9f5b('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9f5b('0x4'));var controller=require(_0x9f5b('0x5'));router['get']('/',auth[_0x9f5b('0x6')](),controller['index']);router['get'](_0x9f5b('0x7'),auth[_0x9f5b('0x6')](),controller[_0x9f5b('0x8')]);router[_0x9f5b('0x9')](_0x9f5b('0xa'),auth[_0x9f5b('0x6')](),controller[_0x9f5b('0xb')]);router['get'](_0x9f5b('0xc'),auth[_0x9f5b('0x6')](),controller[_0x9f5b('0xd')]);router['post']('/',auth[_0x9f5b('0x6')](),controller['create']);router['post']('/:id/configurations',auth[_0x9f5b('0x6')](),controller['addConfiguration']);router['put']('/:id',auth[_0x9f5b('0x6')](),controller['update']);router[_0x9f5b('0xe')](_0x9f5b('0x7'),auth[_0x9f5b('0x6')](),controller['destroy']);module[_0x9f5b('0xf')]=router; \ No newline at end of file +var _0x0233=['show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x4316d5,_0x17ca8c){var _0x304ce7=function(_0x7b464a){while(--_0x7b464a){_0x4316d5['push'](_0x4316d5['shift']());}};_0x304ce7(++_0x17ca8c);}(_0x0233,0x1c0));var _0x3023=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x0233[_0x3e44fa];return _0x2a0aba;};'use strict';var multer=require('multer');var util=require(_0x3023('0x0'));var path=require(_0x3023('0x1'));var timeout=require(_0x3023('0x2'));var express=require(_0x3023('0x3'));var router=express['Router']();var auth=require(_0x3023('0x4'));var interaction=require(_0x3023('0x5'));var config=require(_0x3023('0x6'));var controller=require(_0x3023('0x7'));router[_0x3023('0x8')]('/',auth[_0x3023('0x9')](),controller[_0x3023('0xa')]);router[_0x3023('0x8')](_0x3023('0xb'),auth['isAuthenticated'](),controller[_0x3023('0xc')]);router[_0x3023('0x8')]('/:id/configurations',auth[_0x3023('0x9')](),controller[_0x3023('0xd')]);router[_0x3023('0x8')](_0x3023('0xe'),auth['isAuthenticated'](),controller[_0x3023('0xf')]);router[_0x3023('0x10')]('/',auth[_0x3023('0x9')](),controller[_0x3023('0x11')]);router[_0x3023('0x10')](_0x3023('0x12'),auth['isAuthenticated'](),controller[_0x3023('0x13')]);router[_0x3023('0x14')](_0x3023('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x3023('0x15')](_0x3023('0xb'),auth['isAuthenticated'](),controller[_0x3023('0x16')]);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 3521d40..d5d2bf2 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 _0x9667=['username','ENUM','integrationTab','sequelize','exports','STRING'];(function(_0x427d22,_0x358ab6){var _0x3217af=function(_0x14ae29){while(--_0x14ae29){_0x427d22['push'](_0x427d22['shift']());}};_0x3217af(++_0x358ab6);}(_0x9667,0x129));var _0x7966=function(_0x43f5a1,_0x4afec9){_0x43f5a1=_0x43f5a1-0x0;var _0x20ba89=_0x9667[_0x43f5a1];return _0x20ba89;};'use strict';var Sequelize=require(_0x7966('0x0'));module[_0x7966('0x1')]={'name':{'type':Sequelize[_0x7966('0x2')]},'description':{'type':Sequelize[_0x7966('0x2')]},'username':{'type':Sequelize[_0x7966('0x2')],'unique':_0x7966('0x3')},'remoteUri':{'type':Sequelize[_0x7966('0x2')]},'password':{'type':Sequelize[_0x7966('0x2')]},'clientId':{'type':Sequelize[_0x7966('0x2')]},'clientSecret':{'type':Sequelize[_0x7966('0x2')]},'securityToken':{'type':Sequelize[_0x7966('0x2')]},'serverUrl':{'type':Sequelize[_0x7966('0x2')]},'type':{'type':Sequelize[_0x7966('0x4')]('integrationTab','newTab'),'defaultValue':_0x7966('0x5')}}; \ No newline at end of file +var _0xce88=['exports','STRING','ENUM','newTab','integrationTab'];(function(_0x93b680,_0x50c963){var _0x2a4115=function(_0x1dc42d){while(--_0x1dc42d){_0x93b680['push'](_0x93b680['shift']());}};_0x2a4115(++_0x50c963);}(_0xce88,0x127));var _0x8ce8=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xce88[_0x32d457];return _0x338386;};'use strict';var Sequelize=require('sequelize');module[_0x8ce8('0x0')]={'name':{'type':Sequelize[_0x8ce8('0x1')]},'description':{'type':Sequelize[_0x8ce8('0x1')]},'username':{'type':Sequelize[_0x8ce8('0x1')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x8ce8('0x1')]},'password':{'type':Sequelize[_0x8ce8('0x1')]},'clientId':{'type':Sequelize[_0x8ce8('0x1')]},'clientSecret':{'type':Sequelize[_0x8ce8('0x1')]},'securityToken':{'type':Sequelize[_0x8ce8('0x1')]},'serverUrl':{'type':Sequelize[_0x8ce8('0x1')]},'type':{'type':Sequelize[_0x8ce8('0x2')]('integrationTab',_0x8ce8('0x3')),'defaultValue':_0x8ce8('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index df36e9e..c9ec597 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 _0xb10b=['include','findAll','rows','show','params','find','create','body','destroy','findOne','SalesforceConfiguration','rawAttributes','map','getConfigurations','addConfiguration','AccountId','getSubjects','channel','SalesforceField','getFields','remoteUri','clientId','username','password','securityToken','slice','substring','lastIndexOf','Connection','clientSecret','login','concat','describe','CallDisposition','CallDurationInSeconds','CallObject','CallType','IsArchived','Priority','Status','Type','custom','includes','label','picklistValues','value','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','statusCode','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','stack','name','send','index','SalesforceAccount','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll'];(function(_0x4cfc35,_0xb52690){var _0x43a384=function(_0x3d896f){while(--_0x3d896f){_0x4cfc35['push'](_0x4cfc35['shift']());}};_0x43a384(++_0xb52690);}(_0xb10b,0x12a));var _0xbb10=function(_0x3bbde7,_0x344127){_0x3bbde7=_0x3bbde7-0x0;var _0x117992=_0xb10b[_0x3bbde7];return _0x117992;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var hardwareService=require(_0xbb10('0x13'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require(_0xbb10('0x16'));var config=require('../../config/environment');var db=require(_0xbb10('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xbb10('0x18'));var client=jayson[_0xbb10('0x19')][_0xbb10('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x193a27,_0x442548,_0x147230,_0x58a612){return new BPromise(function(_0x26e021,_0x42d7e4){var _0x45b9d6=_0x58a612||client;return _0x45b9d6[_0xbb10('0x1b')](_0x193a27,_0x147230)[_0xbb10('0x1c')](function(_0x2f2ebf){logger[_0xbb10('0x1d')](_0xbb10('0x1e'),_0x442548,_0xbb10('0x1f'));logger[_0xbb10('0x20')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x442548,_0xbb10('0x1f'),JSON[_0xbb10('0x21')](_0x2f2ebf));if(_0x2f2ebf[_0xbb10('0x22')]){if(_0x2f2ebf[_0xbb10('0x22')][_0xbb10('0x23')]===0x1f4){logger[_0xbb10('0x22')](_0xbb10('0x1e'),_0x442548,_0x2f2ebf[_0xbb10('0x22')][_0xbb10('0x24')]);return _0x42d7e4(_0x2f2ebf[_0xbb10('0x22')]['message']);}logger[_0xbb10('0x22')](_0xbb10('0x1e'),_0x442548,_0x2f2ebf[_0xbb10('0x22')][_0xbb10('0x24')]);return _0x26e021(_0x2f2ebf[_0xbb10('0x22')][_0xbb10('0x24')]);}else{logger['info'](_0xbb10('0x1e'),_0x442548,_0xbb10('0x1f'));_0x26e021(_0x2f2ebf['result']['message']);}})[_0xbb10('0x25')](function(_0x311abe){logger[_0xbb10('0x22')](_0xbb10('0x1e'),_0x442548,_0x311abe);_0x42d7e4(_0x311abe);});});}function respondWithStatusCode(_0x445761,_0x1824b7){_0x1824b7=_0x1824b7||0xcc;return function(_0x407cb4){if(_0x407cb4){return _0x445761[_0xbb10('0x26')](_0x1824b7);}return _0x445761[_0xbb10('0x27')](_0x1824b7)[_0xbb10('0x28')]();};}function respondWithResult(_0x3ba6cd,_0x26ad93){_0x26ad93=_0x26ad93||0xc8;return function(_0x537898){if(_0x537898){return _0x3ba6cd['status'](_0x26ad93)['json'](_0x537898);}};}function respondWithFilteredResult(_0xc93a04,_0x3c5ae7){return function(_0x2c89b9){if(_0x2c89b9){var _0x4e25ff=_0x2c89b9[_0xbb10('0x29')],_0x2fdde9=_0x3c5ae7[_0xbb10('0x2a')],_0x24d586=_0x3c5ae7[_0xbb10('0x2a')]+_0x3c5ae7[_0xbb10('0x2b')],_0x6ed43b;if(_0x24d586>=_0x4e25ff){_0x24d586=_0x4e25ff;_0x6ed43b=0xc8;}else{_0x6ed43b=0xce;}_0xc93a04['status'](_0x6ed43b);return _0xc93a04[_0xbb10('0x2c')](_0xbb10('0x2d'),_0x2fdde9+'-'+_0x24d586+'/'+_0x4e25ff)[_0xbb10('0x2e')](_0x2c89b9);}return null;};}function patchUpdates(_0x2e0249){return function(_0x1d30aa){try{jsonpatch[_0xbb10('0x2f')](_0x1d30aa,_0x2e0249,!![]);}catch(_0x5d5c80){return BPromise[_0xbb10('0x30')](_0x5d5c80);}return _0x1d30aa['save']();};}function saveUpdates(_0x448d5c,_0x56f2da){return function(_0x16ad2a){if(_0x16ad2a){return _0x16ad2a[_0xbb10('0x31')](_0x448d5c)[_0xbb10('0x1c')](function(_0x491db4){return _0x491db4;});}return null;};}function removeEntity(_0x518d47,_0x4c3744){return function(_0x34f65e){if(_0x34f65e){return _0x34f65e['destroy']()[_0xbb10('0x1c')](function(){_0x518d47[_0xbb10('0x27')](0xcc)[_0xbb10('0x28')]();});}};}function handleEntityNotFound(_0x1c0b57,_0x37a83f){return function(_0x138bc6){if(!_0x138bc6){_0x1c0b57[_0xbb10('0x26')](0x194);}return _0x138bc6;};}function handleError(_0x4975f5,_0x25acb3){_0x25acb3=_0x25acb3||0x1f4;return function(_0x1da9c9){logger[_0xbb10('0x22')](_0x1da9c9[_0xbb10('0x32')]);if(_0x1da9c9[_0xbb10('0x33')]){delete _0x1da9c9[_0xbb10('0x33')];}_0x4975f5[_0xbb10('0x27')](_0x25acb3)[_0xbb10('0x34')](_0x1da9c9);};}exports[_0xbb10('0x35')]=function(_0x56943c,_0x2b5352){var _0x150107={},_0x1ddd9e={},_0x3c3c45={'count':0x0,'rows':[]};var _0x570f5a=db[_0xbb10('0x36')]['rawAttributes'];_0x1ddd9e['model']=_[_0xbb10('0x37')](_0x570f5a);_0x1ddd9e[_0xbb10('0x38')]=_[_0xbb10('0x37')](_0x56943c[_0xbb10('0x38')]);_0x1ddd9e[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x1ddd9e['model'],_0x1ddd9e[_0xbb10('0x38')]);_0x150107[_0xbb10('0x3b')]=_['intersection'](_0x1ddd9e['model'],qs['fields'](_0x56943c[_0xbb10('0x38')][_0xbb10('0x3c')]));_0x150107[_0xbb10('0x3b')]=_0x150107['attributes'][_0xbb10('0x3d')]?_0x150107[_0xbb10('0x3b')]:_0x1ddd9e[_0xbb10('0x3e')];if(!_0x56943c['query'][_0xbb10('0x3f')](_0xbb10('0x40'))){_0x150107[_0xbb10('0x2b')]=qs[_0xbb10('0x2b')](_0x56943c['query'][_0xbb10('0x2b')]);_0x150107[_0xbb10('0x2a')]=qs['offset'](_0x56943c[_0xbb10('0x38')][_0xbb10('0x2a')]);}_0x150107[_0xbb10('0x41')]=qs[_0xbb10('0x42')](_0x56943c[_0xbb10('0x38')][_0xbb10('0x42')]);_0x150107['where']=qs[_0xbb10('0x39')](_[_0xbb10('0x43')](_0x56943c[_0xbb10('0x38')],_0x1ddd9e[_0xbb10('0x39')]));if(_0x56943c['query'][_0xbb10('0x44')]){_0x150107[_0xbb10('0x45')]=_[_0xbb10('0x46')](_0x150107[_0xbb10('0x45')],{'$or':_['map'](_0x570f5a,function(_0x351484){if(_0x351484[_0xbb10('0x47')]['key']!=='VIRTUAL'){var _0x38d78f={};_0x38d78f[_0x351484['field']]={'$like':'%'+_0x56943c[_0xbb10('0x38')][_0xbb10('0x44')]+'%'};return _0x38d78f;}})});}_0x150107=_['merge']({},_0x150107,_0x56943c[_0xbb10('0x48')]);var _0x1d82bf={'where':_0x150107[_0xbb10('0x45')]};return db['SalesforceAccount'][_0xbb10('0x29')](_0x1d82bf)[_0xbb10('0x1c')](function(_0x3b9fdf){_0x3c3c45[_0xbb10('0x29')]=_0x3b9fdf;if(_0x56943c[_0xbb10('0x38')][_0xbb10('0x49')]){_0x150107[_0xbb10('0x4a')]=[{'all':!![]}];}return db[_0xbb10('0x36')][_0xbb10('0x4b')](_0x150107);})[_0xbb10('0x1c')](function(_0x197871){_0x3c3c45[_0xbb10('0x4c')]=_0x197871;return _0x3c3c45;})['then'](respondWithFilteredResult(_0x2b5352,_0x150107))[_0xbb10('0x25')](handleError(_0x2b5352,null));};exports[_0xbb10('0x4d')]=function(_0x4a1248,_0x14e1cb){var _0x2f5027={'raw':![],'where':{'id':_0x4a1248[_0xbb10('0x4e')]['id']}},_0x1a7df6={};_0x1a7df6[_0xbb10('0x3e')]=_[_0xbb10('0x37')](db[_0xbb10('0x36')]['rawAttributes']);_0x1a7df6['query']=_[_0xbb10('0x37')](_0x4a1248[_0xbb10('0x38')]);_0x1a7df6[_0xbb10('0x39')]=_['intersection'](_0x1a7df6['model'],_0x1a7df6[_0xbb10('0x38')]);_0x2f5027[_0xbb10('0x3b')]=_[_0xbb10('0x3a')](_0x1a7df6[_0xbb10('0x3e')],qs[_0xbb10('0x3c')](_0x4a1248[_0xbb10('0x38')][_0xbb10('0x3c')]));_0x2f5027[_0xbb10('0x3b')]=_0x2f5027[_0xbb10('0x3b')][_0xbb10('0x3d')]?_0x2f5027['attributes']:_0x1a7df6['model'];if(_0x4a1248[_0xbb10('0x38')][_0xbb10('0x49')]){_0x2f5027[_0xbb10('0x4a')]=[{'all':!![]}];}_0x2f5027=_[_0xbb10('0x46')]({},_0x2f5027,_0x4a1248[_0xbb10('0x48')]);return db[_0xbb10('0x36')][_0xbb10('0x4f')](_0x2f5027)[_0xbb10('0x1c')](handleEntityNotFound(_0x14e1cb,null))[_0xbb10('0x1c')](respondWithResult(_0x14e1cb,null))[_0xbb10('0x25')](handleError(_0x14e1cb,null));};exports[_0xbb10('0x50')]=function(_0x20e18a,_0x61e689){return db[_0xbb10('0x36')][_0xbb10('0x50')](_0x20e18a['body'],{})[_0xbb10('0x1c')](respondWithResult(_0x61e689,0xc9))['catch'](handleError(_0x61e689,null));};exports[_0xbb10('0x31')]=function(_0x2e21a0,_0x1ffe20){if(_0x2e21a0[_0xbb10('0x51')]['id']){delete _0x2e21a0[_0xbb10('0x51')]['id'];}return db[_0xbb10('0x36')][_0xbb10('0x4f')]({'where':{'id':_0x2e21a0[_0xbb10('0x4e')]['id']}})[_0xbb10('0x1c')](handleEntityNotFound(_0x1ffe20,null))[_0xbb10('0x1c')](saveUpdates(_0x2e21a0[_0xbb10('0x51')],null))[_0xbb10('0x1c')](respondWithResult(_0x1ffe20,null))[_0xbb10('0x25')](handleError(_0x1ffe20,null));};exports[_0xbb10('0x52')]=function(_0x4475e1,_0x5de0cc){return db[_0xbb10('0x36')][_0xbb10('0x4f')]({'where':{'id':_0x4475e1[_0xbb10('0x4e')]['id']}})[_0xbb10('0x1c')](handleEntityNotFound(_0x5de0cc,null))[_0xbb10('0x1c')](removeEntity(_0x5de0cc,null))[_0xbb10('0x25')](handleError(_0x5de0cc,null));};exports['getConfigurations']=function(_0x120bda,_0x4731ce,_0x2909a1){var _0x14fed3={};var _0x432728={};var _0x22de7f;var _0x175872;return db[_0xbb10('0x36')][_0xbb10('0x53')]({'where':{'id':_0x120bda[_0xbb10('0x4e')]['id']}})[_0xbb10('0x1c')](handleEntityNotFound(_0x4731ce,null))[_0xbb10('0x1c')](function(_0x16932f){if(_0x16932f){_0x22de7f=_0x16932f;_0x432728['model']=_['keys'](db[_0xbb10('0x54')][_0xbb10('0x55')]);_0x432728[_0xbb10('0x38')]=_[_0xbb10('0x37')](_0x120bda['query']);_0x432728['filters']=_[_0xbb10('0x3a')](_0x432728[_0xbb10('0x3e')],_0x432728[_0xbb10('0x38')]);_0x14fed3[_0xbb10('0x3b')]=_[_0xbb10('0x3a')](_0x432728[_0xbb10('0x3e')],qs[_0xbb10('0x3c')](_0x120bda['query'][_0xbb10('0x3c')]));_0x14fed3[_0xbb10('0x3b')]=_0x14fed3['attributes']['length']?_0x14fed3['attributes']:_0x432728[_0xbb10('0x3e')];_0x14fed3[_0xbb10('0x41')]=qs[_0xbb10('0x42')](_0x120bda['query']['sort']);_0x14fed3['where']=qs[_0xbb10('0x39')](_[_0xbb10('0x43')](_0x120bda[_0xbb10('0x38')],_0x432728['filters']));if(_0x120bda[_0xbb10('0x38')][_0xbb10('0x44')]){_0x14fed3['where']=_['merge'](_0x14fed3[_0xbb10('0x45')],{'$or':_[_0xbb10('0x56')](_0x14fed3[_0xbb10('0x3b')],function(_0x237246){var _0x54b7c5={};_0x54b7c5[_0x237246]={'$like':'%'+_0x120bda[_0xbb10('0x38')][_0xbb10('0x44')]+'%'};return _0x54b7c5;})});}_0x14fed3=_[_0xbb10('0x46')]({},_0x14fed3,_0x120bda['options']);return _0x22de7f[_0xbb10('0x57')](_0x14fed3);}})[_0xbb10('0x1c')](function(_0x3e3617){if(_0x3e3617){_0x175872=_0x3e3617['length'];if(!_0x120bda[_0xbb10('0x38')][_0xbb10('0x3f')](_0xbb10('0x40'))){_0x14fed3[_0xbb10('0x2b')]=qs['limit'](_0x120bda[_0xbb10('0x38')][_0xbb10('0x2b')]);_0x14fed3[_0xbb10('0x2a')]=qs[_0xbb10('0x2a')](_0x120bda['query'][_0xbb10('0x2a')]);}return _0x22de7f[_0xbb10('0x57')](_0x14fed3);}})[_0xbb10('0x1c')](function(_0x2ceb3e){if(_0x2ceb3e){return _0x2ceb3e?{'count':_0x175872,'rows':_0x2ceb3e}:null;}})[_0xbb10('0x1c')](respondWithResult(_0x4731ce,null))[_0xbb10('0x25')](handleError(_0x4731ce,null));};exports[_0xbb10('0x58')]=function(_0x4a30c5,_0x4a13d7,_0x5acd5e){if(_0x4a30c5[_0xbb10('0x51')]['id']){delete _0x4a30c5[_0xbb10('0x51')]['id'];}return db[_0xbb10('0x36')]['findOne']({'where':{'id':_0x4a30c5['params']['id']}})[_0xbb10('0x1c')](handleEntityNotFound(_0x4a13d7,null))[_0xbb10('0x1c')](function(_0xd9e743){if(_0xd9e743){_0x4a30c5[_0xbb10('0x51')][_0xbb10('0x59')]=_0xd9e743['id'];_0x4a30c5[_0xbb10('0x51')]['Subjects']=integrations[_0xbb10('0x5a')](_0x4a30c5[_0xbb10('0x51')][_0xbb10('0x5b')],_0x4a30c5[_0xbb10('0x51')][_0xbb10('0x47')]);_0x4a30c5['body']['Descriptions']=integrations['getDescriptions'](_0x4a30c5[_0xbb10('0x51')][_0xbb10('0x5b')],_0x4a30c5[_0xbb10('0x51')][_0xbb10('0x47')]);return db[_0xbb10('0x54')][_0xbb10('0x50')](_0x4a30c5['body'],{'include':[{'model':db[_0xbb10('0x5c')],'as':'Subjects'},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})[_0xbb10('0x1c')](respondWithResult(_0x4a13d7,null))[_0xbb10('0x25')](handleError(_0x4a13d7,null));};exports[_0xbb10('0x5d')]=function(_0x108f99,_0x5ce94f,_0x122d38){var _0x5c583b;var _0x576179='';return db[_0xbb10('0x36')][_0xbb10('0x53')]({'where':{'id':_0x108f99[_0xbb10('0x4e')]['id']},'attributes':['id',_0xbb10('0x5e'),_0xbb10('0x5f'),'clientSecret',_0xbb10('0x60'),_0xbb10('0x61'),_0xbb10('0x62')]})[_0xbb10('0x1c')](handleEntityNotFound(_0x5ce94f,null))[_0xbb10('0x1c')](function(_0x27f42f){if(_0x27f42f){_0x576179=_0x27f42f[_0xbb10('0x5e')];var _0x53fa98=_0x576179[_0xbb10('0x63')](-0x1);if(_0x53fa98==='/'){_0x576179=_0x576179[_0xbb10('0x64')](0x0,_0x576179[_0xbb10('0x65')](_0x53fa98));}_0x5c583b=new jsforce[(_0xbb10('0x66'))]({'oauth2':{'loginUrl':_0x576179,'clientId':_0x27f42f[_0xbb10('0x5f')],'clientSecret':_0x27f42f[_0xbb10('0x67')]}});return _0x5c583b[_0xbb10('0x68')](_0x27f42f[_0xbb10('0x60')],_0x27f42f['password'][_0xbb10('0x69')](_0x27f42f[_0xbb10('0x62')]));}})[_0xbb10('0x1c')](function(_0x56416a){if(_0x56416a){return _0x5c583b['sobject']('Task')[_0xbb10('0x6a')]();}})['then'](function(_0x4e3d6a){var _0x1701c5=[_0xbb10('0x6b'),_0xbb10('0x6c'),_0xbb10('0x6d'),_0xbb10('0x6e'),_0xbb10('0x6f'),_0xbb10('0x70'),_0xbb10('0x71'),_0xbb10('0x72')];if(_0x4e3d6a){_['remove'](_0x4e3d6a[_0xbb10('0x3c')],function(_0x1351eb){return _0x1351eb[_0xbb10('0x73')]===![]&&!_0x1701c5[_0xbb10('0x74')](_0x1351eb['name']);});return{'count':_0x4e3d6a['fields'][_0xbb10('0x3d')],'rows':_[_0xbb10('0x56')](_0x4e3d6a[_0xbb10('0x3c')],function(_0x32bb25){return{'id':_0x32bb25['name'],'name':_0x32bb25[_0xbb10('0x75')],'custom':_0x32bb25[_0xbb10('0x73')],'options':_0x32bb25[_0xbb10('0x76')]?_[_0xbb10('0x56')](_0x32bb25[_0xbb10('0x76')],function(_0x517185){return{'name':_0x517185['label'],'value':_0x517185[_0xbb10('0x77')]};}):[]};})};}})[_0xbb10('0x1c')](respondWithResult(_0x5ce94f,null))[_0xbb10('0x25')](function(_0x5239da){var _0x256b35=_0x108f99[_0xbb10('0x38')]['test']?0x1f4:_0x5239da['statusCode']||0x1f4;logger[_0xbb10('0x22')](_0xbb10('0x78'),_0xbb10('0x5d'),_0x256b35,JSON['stringify'](_0x5239da));delete _0x5239da[_0xbb10('0x33')];if(_0x256b35===0x191){_0x256b35=0x190;}_0x5ce94f[_0xbb10('0x27')](_0x256b35)[_0xbb10('0x34')](_0x108f99[_0xbb10('0x38')][_0xbb10('0x79')]?{'message':_0xbb10('0x7a'),'statusCode':_0x5239da[_0xbb10('0x7b')]}:_0x5239da);});}; \ No newline at end of file +var _0xda2d=['value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','destroy','stack','name','index','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','map','type','key','field','filter','options','SalesforceAccount','then','includeAll','include','findAll','params','rawAttributes','merge','find','create','body','findOne','SalesforceConfiguration','sort','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','Connection','login','concat','Task','describe','CallDisposition','CallDurationInSeconds','CallObject','CallType','IsArchived','Priority','Status','Type','remove','custom','includes','label','picklistValues'];(function(_0x155aa4,_0x5dc149){var _0x346d6e=function(_0x43207e){while(--_0x43207e){_0x155aa4['push'](_0x155aa4['shift']());}};_0x346d6e(++_0x5dc149);}(_0xda2d,0x102));var _0xdda2=function(_0x3b8188,_0x41d281){_0x3b8188=_0x3b8188-0x0;var _0x104e55=_0xda2d[_0x3b8188];return _0x104e55;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdda2('0x0'));var rimraf=require(_0xdda2('0x1'));var zipdir=require(_0xdda2('0x2'));var jsonpatch=require(_0xdda2('0x3'));var rp=require(_0xdda2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdda2('0x5'));var path=require(_0xdda2('0x6'));var sox=require(_0xdda2('0x7'));var csv=require(_0xdda2('0x8'));var ejs=require(_0xdda2('0x9'));var fs=require('fs');var _=require(_0xdda2('0xa'));var squel=require(_0xdda2('0xb'));var crypto=require(_0xdda2('0xc'));var jsforce=require(_0xdda2('0xd'));var deskjs=require(_0xdda2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdda2('0xf'));var Papa=require(_0xdda2('0x10'));var authService=require('../../components/auth/service');var hardwareService=require(_0xdda2('0x11'));var Redis=require(_0xdda2('0x12'));var qs=require(_0xdda2('0x13'));var logger=require(_0xdda2('0x14'))(_0xdda2('0x15'));var utils=require(_0xdda2('0x16'));var config=require(_0xdda2('0x17'));var db=require(_0xdda2('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson['client'][_0xdda2('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x320f73,_0x3518b9,_0x1503a7,_0x2e4132){return new BPromise(function(_0x475222,_0x3490f1){var _0x4df902=_0x2e4132||client;return _0x4df902[_0xdda2('0x1a')](_0x320f73,_0x1503a7)['then'](function(_0xbef148){logger[_0xdda2('0x1b')](_0xdda2('0x1c'),_0x3518b9,_0xdda2('0x1d'));logger[_0xdda2('0x1e')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x3518b9,'request\x20sent',JSON[_0xdda2('0x1f')](_0xbef148));if(_0xbef148['error']){if(_0xbef148[_0xdda2('0x20')][_0xdda2('0x21')]===0x1f4){logger[_0xdda2('0x20')](_0xdda2('0x1c'),_0x3518b9,_0xbef148[_0xdda2('0x20')][_0xdda2('0x22')]);return _0x3490f1(_0xbef148[_0xdda2('0x20')][_0xdda2('0x22')]);}logger[_0xdda2('0x20')](_0xdda2('0x1c'),_0x3518b9,_0xbef148[_0xdda2('0x20')][_0xdda2('0x22')]);return _0x475222(_0xbef148['error'][_0xdda2('0x22')]);}else{logger['info'](_0xdda2('0x1c'),_0x3518b9,_0xdda2('0x1d'));_0x475222(_0xbef148[_0xdda2('0x23')]['message']);}})[_0xdda2('0x24')](function(_0x5a9bb8){logger[_0xdda2('0x20')](_0xdda2('0x1c'),_0x3518b9,_0x5a9bb8);_0x3490f1(_0x5a9bb8);});});}function respondWithStatusCode(_0x4ac3eb,_0x144f1e){_0x144f1e=_0x144f1e||0xcc;return function(_0xfda248){if(_0xfda248){return _0x4ac3eb[_0xdda2('0x25')](_0x144f1e);}return _0x4ac3eb[_0xdda2('0x26')](_0x144f1e)[_0xdda2('0x27')]();};}function respondWithResult(_0x5739ad,_0x38cdf){_0x38cdf=_0x38cdf||0xc8;return function(_0x4be5ea){if(_0x4be5ea){return _0x5739ad[_0xdda2('0x26')](_0x38cdf)[_0xdda2('0x28')](_0x4be5ea);}};}function respondWithFilteredResult(_0x5436d1,_0x4e97dc){return function(_0x28da54){if(_0x28da54){var _0x4567e7=_0x28da54[_0xdda2('0x29')],_0x2e8591=_0x4e97dc[_0xdda2('0x2a')],_0x5e9e74=_0x4e97dc[_0xdda2('0x2a')]+_0x4e97dc[_0xdda2('0x2b')],_0x90d919;if(_0x5e9e74>=_0x4567e7){_0x5e9e74=_0x4567e7;_0x90d919=0xc8;}else{_0x90d919=0xce;}_0x5436d1[_0xdda2('0x26')](_0x90d919);return _0x5436d1['set'](_0xdda2('0x2c'),_0x2e8591+'-'+_0x5e9e74+'/'+_0x4567e7)[_0xdda2('0x28')](_0x28da54);}return null;};}function patchUpdates(_0x53acb5){return function(_0x45e800){try{jsonpatch[_0xdda2('0x2d')](_0x45e800,_0x53acb5,!![]);}catch(_0x3b18b8){return BPromise[_0xdda2('0x2e')](_0x3b18b8);}return _0x45e800['save']();};}function saveUpdates(_0x129eba,_0x5e107f){return function(_0x4b19b7){if(_0x4b19b7){return _0x4b19b7[_0xdda2('0x2f')](_0x129eba)['then'](function(_0x2b8cd6){return _0x2b8cd6;});}return null;};}function removeEntity(_0x55809a,_0x53ff76){return function(_0x510b7b){if(_0x510b7b){return _0x510b7b[_0xdda2('0x30')]()['then'](function(){_0x55809a[_0xdda2('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cba58,_0x52a509){return function(_0x4637c1){if(!_0x4637c1){_0x5cba58[_0xdda2('0x25')](0x194);}return _0x4637c1;};}function handleError(_0xca6046,_0x2fd592){_0x2fd592=_0x2fd592||0x1f4;return function(_0x12e96d){logger[_0xdda2('0x20')](_0x12e96d[_0xdda2('0x31')]);if(_0x12e96d[_0xdda2('0x32')]){delete _0x12e96d[_0xdda2('0x32')];}_0xca6046[_0xdda2('0x26')](_0x2fd592)['send'](_0x12e96d);};}exports[_0xdda2('0x33')]=function(_0x4212da,_0x2f8674){var _0x3d510c={},_0x392373={},_0x33c4b0={'count':0x0,'rows':[]};var _0x45d3ad=db['SalesforceAccount']['rawAttributes'];_0x392373[_0xdda2('0x34')]=_[_0xdda2('0x35')](_0x45d3ad);_0x392373[_0xdda2('0x36')]=_['keys'](_0x4212da['query']);_0x392373[_0xdda2('0x37')]=_[_0xdda2('0x38')](_0x392373[_0xdda2('0x34')],_0x392373[_0xdda2('0x36')]);_0x3d510c[_0xdda2('0x39')]=_['intersection'](_0x392373[_0xdda2('0x34')],qs[_0xdda2('0x3a')](_0x4212da['query']['fields']));_0x3d510c[_0xdda2('0x39')]=_0x3d510c[_0xdda2('0x39')][_0xdda2('0x3b')]?_0x3d510c[_0xdda2('0x39')]:_0x392373[_0xdda2('0x34')];if(!_0x4212da['query'][_0xdda2('0x3c')](_0xdda2('0x3d'))){_0x3d510c[_0xdda2('0x2b')]=qs[_0xdda2('0x2b')](_0x4212da['query']['limit']);_0x3d510c[_0xdda2('0x2a')]=qs[_0xdda2('0x2a')](_0x4212da[_0xdda2('0x36')]['offset']);}_0x3d510c[_0xdda2('0x3e')]=qs['sort'](_0x4212da[_0xdda2('0x36')]['sort']);_0x3d510c[_0xdda2('0x3f')]=qs[_0xdda2('0x37')](_[_0xdda2('0x40')](_0x4212da[_0xdda2('0x36')],_0x392373['filters']));if(_0x4212da[_0xdda2('0x36')]['filter']){_0x3d510c[_0xdda2('0x3f')]=_['merge'](_0x3d510c[_0xdda2('0x3f')],{'$or':_[_0xdda2('0x41')](_0x45d3ad,function(_0x153acf){if(_0x153acf[_0xdda2('0x42')][_0xdda2('0x43')]!=='VIRTUAL'){var _0x1e29dc={};_0x1e29dc[_0x153acf[_0xdda2('0x44')]]={'$like':'%'+_0x4212da['query'][_0xdda2('0x45')]+'%'};return _0x1e29dc;}})});}_0x3d510c=_['merge']({},_0x3d510c,_0x4212da[_0xdda2('0x46')]);var _0x45c802={'where':_0x3d510c[_0xdda2('0x3f')]};return db[_0xdda2('0x47')][_0xdda2('0x29')](_0x45c802)[_0xdda2('0x48')](function(_0x550351){_0x33c4b0[_0xdda2('0x29')]=_0x550351;if(_0x4212da[_0xdda2('0x36')][_0xdda2('0x49')]){_0x3d510c[_0xdda2('0x4a')]=[{'all':!![]}];}return db[_0xdda2('0x47')][_0xdda2('0x4b')](_0x3d510c);})['then'](function(_0x5cb8b5){_0x33c4b0['rows']=_0x5cb8b5;return _0x33c4b0;})[_0xdda2('0x48')](respondWithFilteredResult(_0x2f8674,_0x3d510c))[_0xdda2('0x24')](handleError(_0x2f8674,null));};exports['show']=function(_0x2c41dc,_0x18f229){var _0x22a99e={'raw':![],'where':{'id':_0x2c41dc[_0xdda2('0x4c')]['id']}},_0x5e56a8={};_0x5e56a8[_0xdda2('0x34')]=_['keys'](db['SalesforceAccount'][_0xdda2('0x4d')]);_0x5e56a8['query']=_[_0xdda2('0x35')](_0x2c41dc['query']);_0x5e56a8[_0xdda2('0x37')]=_[_0xdda2('0x38')](_0x5e56a8['model'],_0x5e56a8['query']);_0x22a99e[_0xdda2('0x39')]=_[_0xdda2('0x38')](_0x5e56a8[_0xdda2('0x34')],qs[_0xdda2('0x3a')](_0x2c41dc['query'][_0xdda2('0x3a')]));_0x22a99e[_0xdda2('0x39')]=_0x22a99e[_0xdda2('0x39')][_0xdda2('0x3b')]?_0x22a99e[_0xdda2('0x39')]:_0x5e56a8['model'];if(_0x2c41dc[_0xdda2('0x36')][_0xdda2('0x49')]){_0x22a99e['include']=[{'all':!![]}];}_0x22a99e=_[_0xdda2('0x4e')]({},_0x22a99e,_0x2c41dc[_0xdda2('0x46')]);return db[_0xdda2('0x47')][_0xdda2('0x4f')](_0x22a99e)[_0xdda2('0x48')](handleEntityNotFound(_0x18f229,null))[_0xdda2('0x48')](respondWithResult(_0x18f229,null))['catch'](handleError(_0x18f229,null));};exports[_0xdda2('0x50')]=function(_0x4a9814,_0x361038){return db['SalesforceAccount'][_0xdda2('0x50')](_0x4a9814['body'],{})[_0xdda2('0x48')](respondWithResult(_0x361038,0xc9))[_0xdda2('0x24')](handleError(_0x361038,null));};exports[_0xdda2('0x2f')]=function(_0x119f70,_0xfc7dd7){if(_0x119f70[_0xdda2('0x51')]['id']){delete _0x119f70[_0xdda2('0x51')]['id'];}return db[_0xdda2('0x47')]['find']({'where':{'id':_0x119f70[_0xdda2('0x4c')]['id']}})[_0xdda2('0x48')](handleEntityNotFound(_0xfc7dd7,null))[_0xdda2('0x48')](saveUpdates(_0x119f70['body'],null))[_0xdda2('0x48')](respondWithResult(_0xfc7dd7,null))[_0xdda2('0x24')](handleError(_0xfc7dd7,null));};exports['destroy']=function(_0x3868e7,_0x5d9437){return db[_0xdda2('0x47')][_0xdda2('0x4f')]({'where':{'id':_0x3868e7[_0xdda2('0x4c')]['id']}})[_0xdda2('0x48')](handleEntityNotFound(_0x5d9437,null))[_0xdda2('0x48')](removeEntity(_0x5d9437,null))['catch'](handleError(_0x5d9437,null));};exports['getConfigurations']=function(_0x5c2cb2,_0x1672ce,_0x1a940b){var _0x5984f2={};var _0x44637d={};var _0x126977;var _0x23e55b;return db['SalesforceAccount'][_0xdda2('0x52')]({'where':{'id':_0x5c2cb2[_0xdda2('0x4c')]['id']}})[_0xdda2('0x48')](handleEntityNotFound(_0x1672ce,null))['then'](function(_0x2b2c1d){if(_0x2b2c1d){_0x126977=_0x2b2c1d;_0x44637d[_0xdda2('0x34')]=_[_0xdda2('0x35')](db[_0xdda2('0x53')]['rawAttributes']);_0x44637d[_0xdda2('0x36')]=_['keys'](_0x5c2cb2['query']);_0x44637d['filters']=_[_0xdda2('0x38')](_0x44637d[_0xdda2('0x34')],_0x44637d[_0xdda2('0x36')]);_0x5984f2[_0xdda2('0x39')]=_[_0xdda2('0x38')](_0x44637d[_0xdda2('0x34')],qs[_0xdda2('0x3a')](_0x5c2cb2[_0xdda2('0x36')][_0xdda2('0x3a')]));_0x5984f2[_0xdda2('0x39')]=_0x5984f2[_0xdda2('0x39')]['length']?_0x5984f2[_0xdda2('0x39')]:_0x44637d[_0xdda2('0x34')];_0x5984f2[_0xdda2('0x3e')]=qs[_0xdda2('0x54')](_0x5c2cb2[_0xdda2('0x36')][_0xdda2('0x54')]);_0x5984f2[_0xdda2('0x3f')]=qs['filters'](_[_0xdda2('0x40')](_0x5c2cb2[_0xdda2('0x36')],_0x44637d[_0xdda2('0x37')]));if(_0x5c2cb2[_0xdda2('0x36')][_0xdda2('0x45')]){_0x5984f2['where']=_[_0xdda2('0x4e')](_0x5984f2[_0xdda2('0x3f')],{'$or':_[_0xdda2('0x41')](_0x5984f2[_0xdda2('0x39')],function(_0x21d0e4){var _0x4a6f28={};_0x4a6f28[_0x21d0e4]={'$like':'%'+_0x5c2cb2[_0xdda2('0x36')][_0xdda2('0x45')]+'%'};return _0x4a6f28;})});}_0x5984f2=_[_0xdda2('0x4e')]({},_0x5984f2,_0x5c2cb2[_0xdda2('0x46')]);return _0x126977[_0xdda2('0x55')](_0x5984f2);}})['then'](function(_0x29dd19){if(_0x29dd19){_0x23e55b=_0x29dd19[_0xdda2('0x3b')];if(!_0x5c2cb2[_0xdda2('0x36')]['hasOwnProperty'](_0xdda2('0x3d'))){_0x5984f2['limit']=qs[_0xdda2('0x2b')](_0x5c2cb2[_0xdda2('0x36')][_0xdda2('0x2b')]);_0x5984f2['offset']=qs[_0xdda2('0x2a')](_0x5c2cb2[_0xdda2('0x36')]['offset']);}return _0x126977[_0xdda2('0x55')](_0x5984f2);}})['then'](function(_0x3d645b){if(_0x3d645b){return _0x3d645b?{'count':_0x23e55b,'rows':_0x3d645b}:null;}})[_0xdda2('0x48')](respondWithResult(_0x1672ce,null))[_0xdda2('0x24')](handleError(_0x1672ce,null));};exports[_0xdda2('0x56')]=function(_0x10d1de,_0x4a061a,_0x586ca1){if(_0x10d1de[_0xdda2('0x51')]['id']){delete _0x10d1de[_0xdda2('0x51')]['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x10d1de[_0xdda2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4a061a,null))[_0xdda2('0x48')](function(_0x1a33ba){if(_0x1a33ba){_0x10d1de['body'][_0xdda2('0x57')]=_0x1a33ba['id'];_0x10d1de[_0xdda2('0x51')][_0xdda2('0x58')]=integrations[_0xdda2('0x59')](_0x10d1de[_0xdda2('0x51')][_0xdda2('0x5a')],_0x10d1de['body'][_0xdda2('0x42')]);_0x10d1de[_0xdda2('0x51')][_0xdda2('0x5b')]=integrations['getDescriptions'](_0x10d1de[_0xdda2('0x51')][_0xdda2('0x5a')],_0x10d1de['body']['type']);return db[_0xdda2('0x53')][_0xdda2('0x50')](_0x10d1de[_0xdda2('0x51')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0xdda2('0x5c')],'as':'Descriptions'}]});}return null;})[_0xdda2('0x48')](respondWithResult(_0x4a061a,null))[_0xdda2('0x24')](handleError(_0x4a061a,null));};exports[_0xdda2('0x5d')]=function(_0x12fd67,_0x597b09,_0x29006f){var _0x58d1ad;var _0x5170b7='';return db[_0xdda2('0x47')]['findOne']({'where':{'id':_0x12fd67[_0xdda2('0x4c')]['id']},'attributes':['id',_0xdda2('0x5e'),_0xdda2('0x5f'),_0xdda2('0x60'),_0xdda2('0x61'),_0xdda2('0x62'),_0xdda2('0x63')]})[_0xdda2('0x48')](handleEntityNotFound(_0x597b09,null))[_0xdda2('0x48')](function(_0x495a28){if(_0x495a28){_0x5170b7=_0x495a28[_0xdda2('0x5e')];var _0x40d931=_0x5170b7[_0xdda2('0x64')](-0x1);if(_0x40d931==='/'){_0x5170b7=_0x5170b7[_0xdda2('0x65')](0x0,_0x5170b7['lastIndexOf'](_0x40d931));}_0x58d1ad=new jsforce[(_0xdda2('0x66'))]({'oauth2':{'loginUrl':_0x5170b7,'clientId':_0x495a28[_0xdda2('0x5f')],'clientSecret':_0x495a28[_0xdda2('0x60')]}});return _0x58d1ad[_0xdda2('0x67')](_0x495a28['username'],_0x495a28['password'][_0xdda2('0x68')](_0x495a28[_0xdda2('0x63')]));}})[_0xdda2('0x48')](function(_0xe1c6e6){if(_0xe1c6e6){return _0x58d1ad['sobject'](_0xdda2('0x69'))[_0xdda2('0x6a')]();}})[_0xdda2('0x48')](function(_0x152ba3){var _0x2dda16=[_0xdda2('0x6b'),_0xdda2('0x6c'),_0xdda2('0x6d'),_0xdda2('0x6e'),_0xdda2('0x6f'),_0xdda2('0x70'),_0xdda2('0x71'),_0xdda2('0x72')];if(_0x152ba3){_[_0xdda2('0x73')](_0x152ba3[_0xdda2('0x3a')],function(_0x4b9481){return _0x4b9481[_0xdda2('0x74')]===![]&&!_0x2dda16[_0xdda2('0x75')](_0x4b9481['name']);});return{'count':_0x152ba3['fields'][_0xdda2('0x3b')],'rows':_[_0xdda2('0x41')](_0x152ba3[_0xdda2('0x3a')],function(_0xdc4cdc){return{'id':_0xdc4cdc[_0xdda2('0x32')],'name':_0xdc4cdc[_0xdda2('0x76')],'custom':_0xdc4cdc['custom'],'options':_0xdc4cdc[_0xdda2('0x77')]?_[_0xdda2('0x41')](_0xdc4cdc[_0xdda2('0x77')],function(_0x2bb4f3){return{'name':_0x2bb4f3['label'],'value':_0x2bb4f3[_0xdda2('0x78')]};}):[]};})};}})['then'](respondWithResult(_0x597b09,null))[_0xdda2('0x24')](function(_0x6b6dad){var _0x4c8739=_0x12fd67[_0xdda2('0x36')][_0xdda2('0x79')]?0x1f4:_0x6b6dad[_0xdda2('0x7a')]||0x1f4;logger[_0xdda2('0x20')](_0xdda2('0x7b'),_0xdda2('0x5d'),_0x4c8739,JSON[_0xdda2('0x1f')](_0x6b6dad));delete _0x6b6dad[_0xdda2('0x32')];if(_0x4c8739===0x191){_0x4c8739=0x190;}_0x597b09[_0xdda2('0x26')](_0x4c8739)[_0xdda2('0x7c')](_0x12fd67[_0xdda2('0x36')]['test']?{'message':_0xdda2('0x7d'),'statusCode':_0x6b6dad[_0xdda2('0x7a')]}:_0x6b6dad);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 7827a47..66c150c 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 _0xa1aa=['../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','moment','request-promise'];(function(_0x3ff495,_0x16ab2e){var _0x263f74=function(_0x1528c0){while(--_0x1528c0){_0x3ff495['push'](_0x3ff495['shift']());}};_0x263f74(++_0x16ab2e);}(_0xa1aa,0xdd));var _0xaa1a=function(_0x26d9ae,_0x3ea1b8){_0x26d9ae=_0x26d9ae-0x0;var _0x37bad7=_0xa1aa[_0x26d9ae];return _0x37bad7;};'use strict';var _=require('lodash');var util=require(_0xaa1a('0x0'));var logger=require(_0xaa1a('0x1'))('api');var moment=require(_0xaa1a('0x2'));var BPromise=require('bluebird');var rp=require(_0xaa1a('0x3'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xaa1a('0x4'));module[_0xaa1a('0x5')]=function(_0x530908,_0x5bc60d){return _0x530908[_0xaa1a('0x6')](_0xaa1a('0x7'),attributes,{'tableName':_0xaa1a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f0f=['request-promise','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts','lodash','util','api','moment','bluebird'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x5f0f,0x1df));var _0xf5f0=function(_0x557778,_0x40da95){_0x557778=_0x557778-0x0;var _0x356601=_0x5f0f[_0x557778];return _0x356601;};'use strict';var _=require(_0xf5f0('0x0'));var util=require(_0xf5f0('0x1'));var logger=require('../../config/logger')(_0xf5f0('0x2'));var moment=require(_0xf5f0('0x3'));var BPromise=require(_0xf5f0('0x4'));var rp=require(_0xf5f0('0x5'));var attributes=require(_0xf5f0('0x6'));var integrations=require(_0xf5f0('0x7'));module[_0xf5f0('0x8')]=function(_0x3b550f,_0x2bbdaa){return _0x3b550f['define'](_0xf5f0('0x9'),attributes,{'tableName':_0xf5f0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index c1722dc..4a6017d 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 _0x9dc9=['../../config/utils','rpc','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','GetSalesforceAccount','SalesforceAccount','options','raw','attributes','map','include','model','where','ShowSalesforceAccount','lodash','bluebird','randomstring','ioredis'];(function(_0x24ed35,_0x261709){var _0x296836=function(_0x416a3d){while(--_0x416a3d){_0x24ed35['push'](_0x24ed35['shift']());}};_0x296836(++_0x261709);}(_0x9dc9,0x1bc));var _0x99dc=function(_0x3e382b,_0x3f01f2){_0x3e382b=_0x3e382b-0x0;var _0x22b360=_0x9dc9[_0x3e382b];return _0x22b360;};'use strict';var _=require(_0x99dc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x99dc('0x1'));var rs=require(_0x99dc('0x2'));var fs=require('fs');var Redis=require(_0x99dc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x99dc('0x4'));var logger=require('../../config/logger')(_0x99dc('0x5'));var config=require('../../config/environment');var jayson=require(_0x99dc('0x6'));var client=jayson[_0x99dc('0x7')][_0x99dc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d5173,_0x23a3b2,_0x2f4b62){return new BPromise(function(_0x5f427d,_0x2ec28e){return client[_0x99dc('0x9')](_0x1d5173,_0x2f4b62)[_0x99dc('0xa')](function(_0x169398){logger[_0x99dc('0xb')](_0x99dc('0xc'),_0x23a3b2,_0x99dc('0xd'));logger[_0x99dc('0xe')](_0x99dc('0xf'),_0x23a3b2,_0x99dc('0xd'),JSON[_0x99dc('0x10')](_0x169398));if(_0x169398[_0x99dc('0x11')]){if(_0x169398[_0x99dc('0x11')][_0x99dc('0x12')]===0x1f4){logger[_0x99dc('0x11')](_0x99dc('0xc'),_0x23a3b2,_0x169398[_0x99dc('0x11')][_0x99dc('0x13')]);return _0x2ec28e(_0x169398['error'][_0x99dc('0x13')]);}logger[_0x99dc('0x11')](_0x99dc('0xc'),_0x23a3b2,_0x169398[_0x99dc('0x11')][_0x99dc('0x13')]);return _0x5f427d(_0x169398[_0x99dc('0x11')][_0x99dc('0x13')]);}else{logger[_0x99dc('0xb')]('SalesforceAccount,\x20%s,\x20%s',_0x23a3b2,'request\x20sent');_0x5f427d(_0x169398[_0x99dc('0x14')][_0x99dc('0x13')]);}})[_0x99dc('0x15')](function(_0x53a75e){logger['error'](_0x99dc('0xc'),_0x23a3b2,_0x53a75e);_0x2ec28e(_0x53a75e);});});}exports[_0x99dc('0x16')]=function(_0x5174b7){var _0x20dedc=this;return new Promise(function(_0x113c89,_0x2a633c){return db[_0x99dc('0x17')]['findAll']({'raw':_0x5174b7['options']?_0x5174b7[_0x99dc('0x18')][_0x99dc('0x19')]===undefined?!![]:![]:!![],'where':_0x5174b7[_0x99dc('0x18')]?_0x5174b7[_0x99dc('0x18')]['where']||null:null,'attributes':_0x5174b7[_0x99dc('0x18')]?_0x5174b7[_0x99dc('0x18')][_0x99dc('0x1a')]||null:null,'limit':_0x5174b7[_0x99dc('0x18')]?_0x5174b7['options']['limit']||null:null,'include':_0x5174b7[_0x99dc('0x18')]?_0x5174b7[_0x99dc('0x18')]['include']?_[_0x99dc('0x1b')](_0x5174b7['options'][_0x99dc('0x1c')],function(_0x43c7d0){return{'model':db[_0x43c7d0[_0x99dc('0x1d')]],'as':_0x43c7d0['as'],'attributes':_0x43c7d0[_0x99dc('0x1a')],'include':_0x43c7d0['include']?_[_0x99dc('0x1b')](_0x43c7d0[_0x99dc('0x1c')],function(_0x3cd510){return{'model':db[_0x3cd510[_0x99dc('0x1d')]],'as':_0x3cd510['as'],'attributes':_0x3cd510[_0x99dc('0x1a')],'include':_0x3cd510['include']?_[_0x99dc('0x1b')](_0x3cd510[_0x99dc('0x1c')],function(_0x52398a){return{'model':db[_0x52398a[_0x99dc('0x1d')]],'as':_0x52398a['as'],'attributes':_0x52398a[_0x99dc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x99dc('0xa')](function(_0x555953){logger[_0x99dc('0xb')]('GetSalesforceAccount',_0x5174b7);logger[_0x99dc('0xe')](_0x99dc('0x16'),_0x5174b7,JSON[_0x99dc('0x10')](_0x555953));_0x113c89(_0x555953);})[_0x99dc('0x15')](function(_0x1e2e3a){logger[_0x99dc('0x11')](_0x99dc('0x16'),_0x1e2e3a[_0x99dc('0x13')],_0x5174b7);_0x2a633c(_0x20dedc[_0x99dc('0x11')](0x1f4,_0x1e2e3a[_0x99dc('0x13')]));});});};exports['ShowSalesforceAccount']=function(_0x27e2a8){var _0x4a62cb=this;return new Promise(function(_0x1b0806,_0x86a877){return db[_0x99dc('0x17')]['find']({'raw':_0x27e2a8[_0x99dc('0x18')]?_0x27e2a8[_0x99dc('0x18')][_0x99dc('0x19')]===undefined?!![]:![]:!![],'where':_0x27e2a8[_0x99dc('0x18')]?_0x27e2a8[_0x99dc('0x18')][_0x99dc('0x1e')]||null:null,'attributes':_0x27e2a8[_0x99dc('0x18')]?_0x27e2a8[_0x99dc('0x18')]['attributes']||null:null,'include':_0x27e2a8[_0x99dc('0x18')]?_0x27e2a8[_0x99dc('0x18')][_0x99dc('0x1c')]?_[_0x99dc('0x1b')](_0x27e2a8[_0x99dc('0x18')]['include'],function(_0x1b764b){return{'model':db[_0x1b764b[_0x99dc('0x1d')]],'as':_0x1b764b['as'],'attributes':_0x1b764b[_0x99dc('0x1a')],'include':_0x1b764b[_0x99dc('0x1c')]?_[_0x99dc('0x1b')](_0x1b764b['include'],function(_0x12f179){return{'model':db[_0x12f179['model']],'as':_0x12f179['as'],'attributes':_0x12f179[_0x99dc('0x1a')],'include':_0x12f179[_0x99dc('0x1c')]?_[_0x99dc('0x1b')](_0x12f179[_0x99dc('0x1c')],function(_0x14f4ee){return{'model':db[_0x14f4ee[_0x99dc('0x1d')]],'as':_0x14f4ee['as'],'attributes':_0x14f4ee[_0x99dc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x99dc('0xa')](function(_0x1ba618){logger['info']('ShowSalesforceAccount',_0x27e2a8);logger[_0x99dc('0xe')]('ShowSalesforceAccount',_0x27e2a8,JSON['stringify'](_0x1ba618));_0x1b0806(_0x1ba618);})['catch'](function(_0x38a179){logger[_0x99dc('0x11')](_0x99dc('0x1f'),_0x38a179[_0x99dc('0x13')],_0x27e2a8);_0x86a877(_0x4a62cb[_0x99dc('0x11')](0x1f4,_0x38a179[_0x99dc('0x13')]));});});}; \ No newline at end of file +var _0xa960=['model','then','GetSalesforceAccount','ShowSalesforceAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceAccount,\x20%s,\x20%s','message','info','result','catch','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa960,0x67));var _0x0a96=function(_0x58b3a1,_0x3931ac){_0x58b3a1=_0x58b3a1-0x0;var _0x5e3214=_0xa960[_0x58b3a1];return _0x5e3214;};'use strict';var _=require(_0x0a96('0x0'));var util=require(_0x0a96('0x1'));var moment=require(_0x0a96('0x2'));var BPromise=require(_0x0a96('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a96('0x4'));var db=require(_0x0a96('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a96('0x6'))(_0x0a96('0x7'));var config=require(_0x0a96('0x8'));var jayson=require(_0x0a96('0x9'));var client=jayson[_0x0a96('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e6fb3,_0x193db7,_0x4aa15c){return new BPromise(function(_0x28ceb6,_0x4db0a4){return client['request'](_0x2e6fb3,_0x4aa15c)['then'](function(_0x3c12a3){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x193db7,_0x0a96('0xb'));logger[_0x0a96('0xc')](_0x0a96('0xd'),_0x193db7,_0x0a96('0xb'),JSON[_0x0a96('0xe')](_0x3c12a3));if(_0x3c12a3[_0x0a96('0xf')]){if(_0x3c12a3['error']['code']===0x1f4){logger[_0x0a96('0xf')](_0x0a96('0x10'),_0x193db7,_0x3c12a3[_0x0a96('0xf')]['message']);return _0x4db0a4(_0x3c12a3[_0x0a96('0xf')]['message']);}logger[_0x0a96('0xf')](_0x0a96('0x10'),_0x193db7,_0x3c12a3['error']['message']);return _0x28ceb6(_0x3c12a3[_0x0a96('0xf')][_0x0a96('0x11')]);}else{logger[_0x0a96('0x12')](_0x0a96('0x10'),_0x193db7,_0x0a96('0xb'));_0x28ceb6(_0x3c12a3[_0x0a96('0x13')][_0x0a96('0x11')]);}})[_0x0a96('0x14')](function(_0x4781f0){logger[_0x0a96('0xf')](_0x0a96('0x10'),_0x193db7,_0x4781f0);_0x4db0a4(_0x4781f0);});});}exports['GetSalesforceAccount']=function(_0x15bce6){var _0x24856b=this;return new Promise(function(_0x329df3,_0x3f5c9a){return db['SalesforceAccount'][_0x0a96('0x15')]({'raw':_0x15bce6[_0x0a96('0x16')]?_0x15bce6['options'][_0x0a96('0x17')]===undefined?!![]:![]:!![],'where':_0x15bce6[_0x0a96('0x16')]?_0x15bce6[_0x0a96('0x16')][_0x0a96('0x18')]||null:null,'attributes':_0x15bce6[_0x0a96('0x16')]?_0x15bce6[_0x0a96('0x16')][_0x0a96('0x19')]||null:null,'limit':_0x15bce6[_0x0a96('0x16')]?_0x15bce6['options'][_0x0a96('0x1a')]||null:null,'include':_0x15bce6[_0x0a96('0x16')]?_0x15bce6[_0x0a96('0x16')][_0x0a96('0x1b')]?_[_0x0a96('0x1c')](_0x15bce6[_0x0a96('0x16')][_0x0a96('0x1b')],function(_0x370dd3){return{'model':db[_0x370dd3['model']],'as':_0x370dd3['as'],'attributes':_0x370dd3['attributes'],'include':_0x370dd3['include']?_[_0x0a96('0x1c')](_0x370dd3[_0x0a96('0x1b')],function(_0x2b37fe){return{'model':db[_0x2b37fe[_0x0a96('0x1d')]],'as':_0x2b37fe['as'],'attributes':_0x2b37fe[_0x0a96('0x19')],'include':_0x2b37fe[_0x0a96('0x1b')]?_[_0x0a96('0x1c')](_0x2b37fe[_0x0a96('0x1b')],function(_0x21ed68){return{'model':db[_0x21ed68[_0x0a96('0x1d')]],'as':_0x21ed68['as'],'attributes':_0x21ed68[_0x0a96('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0a96('0x1e')](function(_0x5355aa){logger['info'](_0x0a96('0x1f'),_0x15bce6);logger[_0x0a96('0xc')](_0x0a96('0x1f'),_0x15bce6,JSON['stringify'](_0x5355aa));_0x329df3(_0x5355aa);})[_0x0a96('0x14')](function(_0x1d1b1c){logger[_0x0a96('0xf')](_0x0a96('0x1f'),_0x1d1b1c[_0x0a96('0x11')],_0x15bce6);_0x3f5c9a(_0x24856b[_0x0a96('0xf')](0x1f4,_0x1d1b1c[_0x0a96('0x11')]));});});};exports[_0x0a96('0x20')]=function(_0x422059){var _0x541efa=this;return new Promise(function(_0xc8bdfb,_0x196c7e){return db['SalesforceAccount']['find']({'raw':_0x422059['options']?_0x422059['options'][_0x0a96('0x17')]===undefined?!![]:![]:!![],'where':_0x422059[_0x0a96('0x16')]?_0x422059[_0x0a96('0x16')][_0x0a96('0x18')]||null:null,'attributes':_0x422059['options']?_0x422059[_0x0a96('0x16')][_0x0a96('0x19')]||null:null,'include':_0x422059[_0x0a96('0x16')]?_0x422059[_0x0a96('0x16')]['include']?_[_0x0a96('0x1c')](_0x422059[_0x0a96('0x16')][_0x0a96('0x1b')],function(_0x571a66){return{'model':db[_0x571a66[_0x0a96('0x1d')]],'as':_0x571a66['as'],'attributes':_0x571a66[_0x0a96('0x19')],'include':_0x571a66[_0x0a96('0x1b')]?_[_0x0a96('0x1c')](_0x571a66[_0x0a96('0x1b')],function(_0x4039ce){return{'model':db[_0x4039ce[_0x0a96('0x1d')]],'as':_0x4039ce['as'],'attributes':_0x4039ce['attributes'],'include':_0x4039ce[_0x0a96('0x1b')]?_['map'](_0x4039ce[_0x0a96('0x1b')],function(_0x298b6d){return{'model':db[_0x298b6d['model']],'as':_0x298b6d['as'],'attributes':_0x298b6d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x492e43){logger[_0x0a96('0x12')]('ShowSalesforceAccount',_0x422059);logger['debug']('ShowSalesforceAccount',_0x422059,JSON[_0x0a96('0xe')](_0x492e43));_0xc8bdfb(_0x492e43);})['catch'](function(_0x371f98){logger[_0x0a96('0xf')]('ShowSalesforceAccount',_0x371f98[_0x0a96('0x11')],_0x422059);_0x196c7e(_0x541efa[_0x0a96('0xf')](0x1f4,_0x371f98[_0x0a96('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 690f0d0..3fd1bd8 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 _0x0768=['../../config/environment','isAuthenticated','get','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x422ac3,_0x48bbd4){var _0x53c0d4=function(_0x4b50f6){while(--_0x4b50f6){_0x422ac3['push'](_0x422ac3['shift']());}};_0x53c0d4(++_0x48bbd4);}(_0x0768,0x1da));var _0x8076=function(_0x2e6aa2,_0xc4e6a9){_0x2e6aa2=_0x2e6aa2-0x0;var _0x3f6105=_0x0768[_0x2e6aa2];return _0x3f6105;};'use strict';var multer=require(_0x8076('0x0'));var util=require(_0x8076('0x1'));var path=require(_0x8076('0x2'));var timeout=require('connect-timeout');var express=require(_0x8076('0x3'));var router=express['Router']();var auth=require(_0x8076('0x4'));var interaction=require(_0x8076('0x5'));var config=require(_0x8076('0x6'));var controller=require('./intSalesforceConfiguration.controller');router['get']('/',auth[_0x8076('0x7')](),controller['index']);router[_0x8076('0x8')](_0x8076('0x9'),auth[_0x8076('0x7')](),controller[_0x8076('0xa')]);router[_0x8076('0x8')](_0x8076('0xb'),auth[_0x8076('0x7')](),controller['getFields']);router[_0x8076('0x8')](_0x8076('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x8076('0x8')](_0x8076('0xd'),auth[_0x8076('0x7')](),controller['getDescriptions']);router[_0x8076('0xe')]('/',auth[_0x8076('0x7')](),controller[_0x8076('0xf')]);router[_0x8076('0x10')]('/:id',auth[_0x8076('0x7')](),controller['update']);router[_0x8076('0x11')](_0x8076('0x9'),auth[_0x8076('0x7')](),controller[_0x8076('0x12')]);module[_0x8076('0x13')]=router; \ No newline at end of file +var _0xf64d=['getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','isAuthenticated','index','/:id','show','get','/:id/fields','getFields','/:id/subjects'];(function(_0x5f349a,_0x2ce504){var _0x1c42f4=function(_0x21cc72){while(--_0x21cc72){_0x5f349a['push'](_0x5f349a['shift']());}};_0x1c42f4(++_0x2ce504);}(_0xf64d,0xa0));var _0xdf64=function(_0x408e38,_0x23cda8){_0x408e38=_0x408e38-0x0;var _0x426b0e=_0xf64d[_0x408e38];return _0x426b0e;};'use strict';var multer=require(_0xdf64('0x0'));var util=require('util');var path=require(_0xdf64('0x1'));var timeout=require('connect-timeout');var express=require(_0xdf64('0x2'));var router=express[_0xdf64('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xdf64('0x4'));var config=require(_0xdf64('0x5'));var controller=require(_0xdf64('0x6'));router['get']('/',auth[_0xdf64('0x7')](),controller[_0xdf64('0x8')]);router['get'](_0xdf64('0x9'),auth[_0xdf64('0x7')](),controller[_0xdf64('0xa')]);router[_0xdf64('0xb')](_0xdf64('0xc'),auth[_0xdf64('0x7')](),controller[_0xdf64('0xd')]);router['get'](_0xdf64('0xe'),auth[_0xdf64('0x7')](),controller[_0xdf64('0xf')]);router[_0xdf64('0xb')](_0xdf64('0x10'),auth[_0xdf64('0x7')](),controller[_0xdf64('0x11')]);router[_0xdf64('0x12')]('/',auth[_0xdf64('0x7')](),controller[_0xdf64('0x13')]);router[_0xdf64('0x14')](_0xdf64('0x9'),auth[_0xdf64('0x7')](),controller[_0xdf64('0x15')]);router[_0xdf64('0x16')](_0xdf64('0x9'),auth['isAuthenticated'](),controller[_0xdf64('0x17')]);module[_0xdf64('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 19ed624..99f284f 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 _0x4688=['nothing','sequelize','exports','STRING','ENUM','contact','lead'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x4688,0xfd));var _0x8468=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0x4688[_0x1bc0ae];return _0x501104;};'use strict';var Sequelize=require(_0x8468('0x0'));module[_0x8468('0x1')]={'name':{'type':Sequelize[_0x8468('0x2')]},'description':{'type':Sequelize[_0x8468('0x2')]},'moduleSearch':{'type':Sequelize[_0x8468('0x3')]('contact_lead',_0x8468('0x4'),_0x8468('0x5')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x8468('0x3')](_0x8468('0x6'),'contact','lead'),'defaultValue':_0x8468('0x5')}}; \ No newline at end of file +var _0x2e0a=['lead','contact','sequelize','exports','STRING','ENUM','contact_lead'];(function(_0x549b5c,_0x195d8e){var _0x5a5ac5=function(_0xede6bb){while(--_0xede6bb){_0x549b5c['push'](_0x549b5c['shift']());}};_0x5a5ac5(++_0x195d8e);}(_0x2e0a,0xa3));var _0xa2e0=function(_0x1d0a3a,_0x586207){_0x1d0a3a=_0x1d0a3a-0x0;var _0x2e4ce7=_0x2e0a[_0x1d0a3a];return _0x2e4ce7;};'use strict';var Sequelize=require(_0xa2e0('0x0'));module[_0xa2e0('0x1')]={'name':{'type':Sequelize[_0xa2e0('0x2')]},'description':{'type':Sequelize[_0xa2e0('0x2')]},'moduleSearch':{'type':Sequelize[_0xa2e0('0x3')](_0xa2e0('0x4'),'contact',_0xa2e0('0x5')),'defaultValue':_0xa2e0('0x4')},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0xa2e0('0x6'),'lead'),'defaultValue':'lead'}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 7cce50a..25c4df8 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 _0x1261=['querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SalesforceConfiguration,\x20%s,\x20%s','status','json','offset','limit','set','Content-Range','apply','reject','destroy','end','name','send','index','rawAttributes','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','key','VIRTUAL','filter','merge','SalesforceConfiguration','count','includeAll','include','rows','params','options','create','body','find','getFields','findOne','SalesforceField','getSubjects','map','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv'];(function(_0xd15a7,_0x518992){var _0xf002d9=function(_0x24fdcb){while(--_0x24fdcb){_0xd15a7['push'](_0xd15a7['shift']());}};_0xf002d9(++_0x518992);}(_0x1261,0x144));var _0x1126=function(_0x39f375,_0x3aa8ec){_0x39f375=_0x39f375-0x0;var _0x463f93=_0x1261[_0x39f375];return _0x463f93;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1126('0x0'));var rimraf=require(_0x1126('0x1'));var zipdir=require(_0x1126('0x2'));var jsonpatch=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var moment=require(_0x1126('0x5'));var BPromise=require(_0x1126('0x6'));var Mustache=require(_0x1126('0x7'));var util=require(_0x1126('0x8'));var path=require(_0x1126('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1126('0xa'));var fs=require('fs');var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var authService=require(_0x1126('0x11'));var hardwareService=require(_0x1126('0x12'));var Redis=require(_0x1126('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0x1126('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x1126('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x1126('0x16'));var client=jayson[_0x1126('0x17')][_0x1126('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x273896,_0xca0355,_0x3f10e9,_0xd8ca42){return new BPromise(function(_0x2048ad,_0x43850b){var _0x53a8f0=_0xd8ca42||client;return _0x53a8f0['request'](_0x273896,_0x3f10e9)[_0x1126('0x19')](function(_0x154e20){logger[_0x1126('0x1a')]('SalesforceConfiguration,\x20%s,\x20%s',_0xca0355,_0x1126('0x1b'));logger['debug'](_0x1126('0x1c'),_0xca0355,_0x1126('0x1b'),JSON[_0x1126('0x1d')](_0x154e20));if(_0x154e20['error']){if(_0x154e20[_0x1126('0x1e')][_0x1126('0x1f')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0xca0355,_0x154e20[_0x1126('0x1e')][_0x1126('0x20')]);return _0x43850b(_0x154e20['error']['message']);}logger[_0x1126('0x1e')]('SalesforceConfiguration,\x20%s,\x20%s',_0xca0355,_0x154e20[_0x1126('0x1e')][_0x1126('0x20')]);return _0x2048ad(_0x154e20[_0x1126('0x1e')]['message']);}else{logger[_0x1126('0x1a')]('SalesforceConfiguration,\x20%s,\x20%s',_0xca0355,'request\x20sent');_0x2048ad(_0x154e20[_0x1126('0x21')][_0x1126('0x20')]);}})[_0x1126('0x22')](function(_0x36d254){logger['error'](_0x1126('0x23'),_0xca0355,_0x36d254);_0x43850b(_0x36d254);});});}function respondWithStatusCode(_0x477e6a,_0x48a08d){_0x48a08d=_0x48a08d||0xcc;return function(_0x2175fa){if(_0x2175fa){return _0x477e6a['sendStatus'](_0x48a08d);}return _0x477e6a['status'](_0x48a08d)['end']();};}function respondWithResult(_0x2199d9,_0x15bcc3){_0x15bcc3=_0x15bcc3||0xc8;return function(_0x329914){if(_0x329914){return _0x2199d9[_0x1126('0x24')](_0x15bcc3)[_0x1126('0x25')](_0x329914);}};}function respondWithFilteredResult(_0x1b07a7,_0xea0971){return function(_0x38119d){if(_0x38119d){var _0x589725=_0x38119d['count'],_0x35eec3=_0xea0971['offset'],_0x375e59=_0xea0971[_0x1126('0x26')]+_0xea0971[_0x1126('0x27')],_0xa293f4;if(_0x375e59>=_0x589725){_0x375e59=_0x589725;_0xa293f4=0xc8;}else{_0xa293f4=0xce;}_0x1b07a7['status'](_0xa293f4);return _0x1b07a7[_0x1126('0x28')](_0x1126('0x29'),_0x35eec3+'-'+_0x375e59+'/'+_0x589725)['json'](_0x38119d);}return null;};}function patchUpdates(_0x3fa694){return function(_0x4bf807){try{jsonpatch[_0x1126('0x2a')](_0x4bf807,_0x3fa694,!![]);}catch(_0x4bd50b){return BPromise[_0x1126('0x2b')](_0x4bd50b);}return _0x4bf807['save']();};}function saveUpdates(_0x378f4d,_0x5f2611){return function(_0x5252e0){if(_0x5252e0){return _0x5252e0['update'](_0x378f4d)[_0x1126('0x19')](function(_0xa8906d){return _0xa8906d;});}return null;};}function removeEntity(_0x1cef48,_0x5b8bea){return function(_0x2a3055){if(_0x2a3055){return _0x2a3055[_0x1126('0x2c')]()['then'](function(){_0x1cef48[_0x1126('0x24')](0xcc)[_0x1126('0x2d')]();});}};}function handleEntityNotFound(_0x2d8127,_0x29fbfa){return function(_0x5836a2){if(!_0x5836a2){_0x2d8127['sendStatus'](0x194);}return _0x5836a2;};}function handleError(_0x2a7edc,_0x19e6e4){_0x19e6e4=_0x19e6e4||0x1f4;return function(_0x2d9bd2){logger[_0x1126('0x1e')](_0x2d9bd2['stack']);if(_0x2d9bd2[_0x1126('0x2e')]){delete _0x2d9bd2[_0x1126('0x2e')];}_0x2a7edc[_0x1126('0x24')](_0x19e6e4)[_0x1126('0x2f')](_0x2d9bd2);};}exports[_0x1126('0x30')]=function(_0x5df232,_0x2a0dfe){var _0x457efd={},_0x1e8402={},_0x42e773={'count':0x0,'rows':[]};var _0x5c019d=db['SalesforceConfiguration'][_0x1126('0x31')];_0x1e8402[_0x1126('0x32')]=_['keys'](_0x5c019d);_0x1e8402[_0x1126('0x33')]=_[_0x1126('0x34')](_0x5df232[_0x1126('0x33')]);_0x1e8402['filters']=_['intersection'](_0x1e8402[_0x1126('0x32')],_0x1e8402[_0x1126('0x33')]);_0x457efd[_0x1126('0x35')]=_[_0x1126('0x36')](_0x1e8402['model'],qs[_0x1126('0x37')](_0x5df232['query'][_0x1126('0x37')]));_0x457efd[_0x1126('0x35')]=_0x457efd[_0x1126('0x35')][_0x1126('0x38')]?_0x457efd[_0x1126('0x35')]:_0x1e8402['model'];if(!_0x5df232[_0x1126('0x33')][_0x1126('0x39')](_0x1126('0x3a'))){_0x457efd[_0x1126('0x27')]=qs[_0x1126('0x27')](_0x5df232[_0x1126('0x33')][_0x1126('0x27')]);_0x457efd['offset']=qs[_0x1126('0x26')](_0x5df232[_0x1126('0x33')][_0x1126('0x26')]);}_0x457efd[_0x1126('0x3b')]=qs[_0x1126('0x3c')](_0x5df232['query']['sort']);_0x457efd[_0x1126('0x3d')]=qs[_0x1126('0x3e')](_[_0x1126('0x3f')](_0x5df232[_0x1126('0x33')],_0x1e8402[_0x1126('0x3e')]));if(_0x5df232[_0x1126('0x33')]['filter']){_0x457efd['where']=_['merge'](_0x457efd[_0x1126('0x3d')],{'$or':_['map'](_0x5c019d,function(_0xf84005){if(_0xf84005[_0x1126('0x40')][_0x1126('0x41')]!==_0x1126('0x42')){var _0x585fad={};_0x585fad[_0xf84005['field']]={'$like':'%'+_0x5df232[_0x1126('0x33')][_0x1126('0x43')]+'%'};return _0x585fad;}})});}_0x457efd=_[_0x1126('0x44')]({},_0x457efd,_0x5df232['options']);var _0x2f8551={'where':_0x457efd['where']};return db[_0x1126('0x45')]['count'](_0x2f8551)[_0x1126('0x19')](function(_0xe178b4){_0x42e773[_0x1126('0x46')]=_0xe178b4;if(_0x5df232['query'][_0x1126('0x47')]){_0x457efd[_0x1126('0x48')]=[{'all':!![]}];}return db[_0x1126('0x45')]['findAll'](_0x457efd);})['then'](function(_0x4dd7f5){_0x42e773[_0x1126('0x49')]=_0x4dd7f5;return _0x42e773;})['then'](respondWithFilteredResult(_0x2a0dfe,_0x457efd))[_0x1126('0x22')](handleError(_0x2a0dfe,null));};exports['show']=function(_0x2f45b9,_0x323499){var _0x146066={'raw':![],'where':{'id':_0x2f45b9[_0x1126('0x4a')]['id']}},_0x120de1={};_0x120de1['model']=_[_0x1126('0x34')](db[_0x1126('0x45')]['rawAttributes']);_0x120de1[_0x1126('0x33')]=_[_0x1126('0x34')](_0x2f45b9['query']);_0x120de1[_0x1126('0x3e')]=_[_0x1126('0x36')](_0x120de1['model'],_0x120de1[_0x1126('0x33')]);_0x146066[_0x1126('0x35')]=_[_0x1126('0x36')](_0x120de1['model'],qs[_0x1126('0x37')](_0x2f45b9[_0x1126('0x33')][_0x1126('0x37')]));_0x146066[_0x1126('0x35')]=_0x146066[_0x1126('0x35')][_0x1126('0x38')]?_0x146066[_0x1126('0x35')]:_0x120de1[_0x1126('0x32')];if(_0x2f45b9['query'][_0x1126('0x47')]){_0x146066['include']=[{'all':!![]}];}_0x146066=_[_0x1126('0x44')]({},_0x146066,_0x2f45b9[_0x1126('0x4b')]);return db['SalesforceConfiguration']['find'](_0x146066)[_0x1126('0x19')](handleEntityNotFound(_0x323499,null))[_0x1126('0x19')](respondWithResult(_0x323499,null))[_0x1126('0x22')](handleError(_0x323499,null));};exports['create']=function(_0x3cb44c,_0x3506d7){return db[_0x1126('0x45')][_0x1126('0x4c')](_0x3cb44c['body'],{})[_0x1126('0x19')](respondWithResult(_0x3506d7,0xc9))[_0x1126('0x22')](handleError(_0x3506d7,null));};exports['update']=function(_0x4bcc08,_0x4abb4d){if(_0x4bcc08['body']['id']){delete _0x4bcc08[_0x1126('0x4d')]['id'];}return db[_0x1126('0x45')]['find']({'where':{'id':_0x4bcc08[_0x1126('0x4a')]['id']}})[_0x1126('0x19')](handleEntityNotFound(_0x4abb4d,null))[_0x1126('0x19')](saveUpdates(_0x4bcc08[_0x1126('0x4d')],null))[_0x1126('0x19')](respondWithResult(_0x4abb4d,null))['catch'](handleError(_0x4abb4d,null));};exports[_0x1126('0x2c')]=function(_0x267592,_0x5d6414){return db[_0x1126('0x45')][_0x1126('0x4e')]({'where':{'id':_0x267592[_0x1126('0x4a')]['id']}})[_0x1126('0x19')](handleEntityNotFound(_0x5d6414,null))[_0x1126('0x19')](removeEntity(_0x5d6414,null))['catch'](handleError(_0x5d6414,null));};exports[_0x1126('0x4f')]=function(_0x49aeaa,_0x868b2c,_0x952d14){var _0x33c971={};var _0x590bc2={};var _0x427add;var _0x2340f8;return db['SalesforceConfiguration'][_0x1126('0x50')]({'where':{'id':_0x49aeaa[_0x1126('0x4a')]['id']}})[_0x1126('0x19')](handleEntityNotFound(_0x868b2c,null))['then'](function(_0x2fe6dc){if(_0x2fe6dc){_0x427add=_0x2fe6dc;_0x590bc2[_0x1126('0x32')]=_[_0x1126('0x34')](db[_0x1126('0x51')][_0x1126('0x31')]);_0x590bc2[_0x1126('0x33')]=_[_0x1126('0x34')](_0x49aeaa[_0x1126('0x33')]);_0x590bc2['filters']=_[_0x1126('0x36')](_0x590bc2[_0x1126('0x32')],_0x590bc2[_0x1126('0x33')]);_0x33c971[_0x1126('0x35')]=_[_0x1126('0x36')](_0x590bc2['model'],qs[_0x1126('0x37')](_0x49aeaa[_0x1126('0x33')]['fields']));_0x33c971[_0x1126('0x35')]=_0x33c971['attributes'][_0x1126('0x38')]?_0x33c971[_0x1126('0x35')]:_0x590bc2['model'];_0x33c971[_0x1126('0x3b')]=qs[_0x1126('0x3c')](_0x49aeaa[_0x1126('0x33')]['sort']);_0x33c971[_0x1126('0x3d')]=qs['filters'](_['pick'](_0x49aeaa[_0x1126('0x33')],_0x590bc2[_0x1126('0x3e')]));if(_0x49aeaa[_0x1126('0x33')][_0x1126('0x43')]){_0x33c971[_0x1126('0x3d')]=_[_0x1126('0x44')](_0x33c971[_0x1126('0x3d')],{'$or':_['map'](_0x33c971[_0x1126('0x35')],function(_0x43ec00){var _0x116867={};_0x116867[_0x43ec00]={'$like':'%'+_0x49aeaa[_0x1126('0x33')][_0x1126('0x43')]+'%'};return _0x116867;})});}_0x33c971=_[_0x1126('0x44')]({},_0x33c971,_0x49aeaa['options']);return _0x427add['getFields'](_0x33c971);}})[_0x1126('0x19')](function(_0x3921c2){if(_0x3921c2){_0x2340f8=_0x3921c2['length'];if(!_0x49aeaa['query']['hasOwnProperty']('nolimit')){_0x33c971[_0x1126('0x27')]=qs[_0x1126('0x27')](_0x49aeaa[_0x1126('0x33')]['limit']);_0x33c971[_0x1126('0x26')]=qs[_0x1126('0x26')](_0x49aeaa[_0x1126('0x33')][_0x1126('0x26')]);}return _0x427add[_0x1126('0x4f')](_0x33c971);}})[_0x1126('0x19')](function(_0x131056){if(_0x131056){return _0x131056?{'count':_0x2340f8,'rows':_0x131056}:null;}})['then'](respondWithResult(_0x868b2c,null))[_0x1126('0x22')](handleError(_0x868b2c,null));};exports[_0x1126('0x52')]=function(_0x43bd70,_0xd8171c,_0x288b9b){var _0x56c003={};var _0x5d758d={};var _0x15cf3d;var _0x2643d7;return db['SalesforceConfiguration'][_0x1126('0x50')]({'where':{'id':_0x43bd70[_0x1126('0x4a')]['id']}})[_0x1126('0x19')](handleEntityNotFound(_0xd8171c,null))[_0x1126('0x19')](function(_0x2828d4){if(_0x2828d4){_0x15cf3d=_0x2828d4;_0x5d758d[_0x1126('0x32')]=_[_0x1126('0x34')](db[_0x1126('0x51')][_0x1126('0x31')]);_0x5d758d[_0x1126('0x33')]=_[_0x1126('0x34')](_0x43bd70[_0x1126('0x33')]);_0x5d758d[_0x1126('0x3e')]=_['intersection'](_0x5d758d[_0x1126('0x32')],_0x5d758d[_0x1126('0x33')]);_0x56c003[_0x1126('0x35')]=_['intersection'](_0x5d758d['model'],qs[_0x1126('0x37')](_0x43bd70[_0x1126('0x33')][_0x1126('0x37')]));_0x56c003[_0x1126('0x35')]=_0x56c003['attributes']['length']?_0x56c003['attributes']:_0x5d758d[_0x1126('0x32')];_0x56c003[_0x1126('0x3b')]=qs[_0x1126('0x3c')](_0x43bd70[_0x1126('0x33')]['sort']);_0x56c003[_0x1126('0x3d')]=qs['filters'](_[_0x1126('0x3f')](_0x43bd70[_0x1126('0x33')],_0x5d758d[_0x1126('0x3e')]));if(_0x43bd70[_0x1126('0x33')][_0x1126('0x43')]){_0x56c003[_0x1126('0x3d')]=_[_0x1126('0x44')](_0x56c003['where'],{'$or':_[_0x1126('0x53')](_0x56c003['attributes'],function(_0x3c1dda){var _0x906531={};_0x906531[_0x3c1dda]={'$like':'%'+_0x43bd70['query'][_0x1126('0x43')]+'%'};return _0x906531;})});}_0x56c003=_[_0x1126('0x44')]({},_0x56c003,_0x43bd70['options']);return _0x15cf3d[_0x1126('0x52')](_0x56c003);}})[_0x1126('0x19')](function(_0x4b1d04){if(_0x4b1d04){_0x2643d7=_0x4b1d04['length'];if(!_0x43bd70[_0x1126('0x33')][_0x1126('0x39')](_0x1126('0x3a'))){_0x56c003['limit']=qs['limit'](_0x43bd70['query'][_0x1126('0x27')]);_0x56c003['offset']=qs['offset'](_0x43bd70[_0x1126('0x33')]['offset']);}return _0x15cf3d[_0x1126('0x52')](_0x56c003);}})[_0x1126('0x19')](function(_0x51ccdc){if(_0x51ccdc){return _0x51ccdc?{'count':_0x2643d7,'rows':_0x51ccdc}:null;}})[_0x1126('0x19')](respondWithResult(_0xd8171c,null))[_0x1126('0x22')](handleError(_0xd8171c,null));};exports[_0x1126('0x54')]=function(_0xc3bb7f,_0x1644fc,_0x5e9872){var _0xec8540={};var _0x426faa={};var _0x5679ec;var _0xd182b1;return db[_0x1126('0x45')][_0x1126('0x50')]({'where':{'id':_0xc3bb7f[_0x1126('0x4a')]['id']}})[_0x1126('0x19')](handleEntityNotFound(_0x1644fc,null))[_0x1126('0x19')](function(_0x59512b){if(_0x59512b){_0x5679ec=_0x59512b;_0x426faa[_0x1126('0x32')]=_[_0x1126('0x34')](db[_0x1126('0x51')][_0x1126('0x31')]);_0x426faa[_0x1126('0x33')]=_[_0x1126('0x34')](_0xc3bb7f[_0x1126('0x33')]);_0x426faa[_0x1126('0x3e')]=_[_0x1126('0x36')](_0x426faa['model'],_0x426faa[_0x1126('0x33')]);_0xec8540[_0x1126('0x35')]=_[_0x1126('0x36')](_0x426faa[_0x1126('0x32')],qs[_0x1126('0x37')](_0xc3bb7f['query'][_0x1126('0x37')]));_0xec8540['attributes']=_0xec8540['attributes'][_0x1126('0x38')]?_0xec8540[_0x1126('0x35')]:_0x426faa['model'];_0xec8540['order']=qs[_0x1126('0x3c')](_0xc3bb7f[_0x1126('0x33')][_0x1126('0x3c')]);_0xec8540[_0x1126('0x3d')]=qs[_0x1126('0x3e')](_[_0x1126('0x3f')](_0xc3bb7f[_0x1126('0x33')],_0x426faa[_0x1126('0x3e')]));if(_0xc3bb7f[_0x1126('0x33')]['filter']){_0xec8540[_0x1126('0x3d')]=_[_0x1126('0x44')](_0xec8540[_0x1126('0x3d')],{'$or':_[_0x1126('0x53')](_0xec8540[_0x1126('0x35')],function(_0x336b4b){var _0x482199={};_0x482199[_0x336b4b]={'$like':'%'+_0xc3bb7f[_0x1126('0x33')][_0x1126('0x43')]+'%'};return _0x482199;})});}_0xec8540=_[_0x1126('0x44')]({},_0xec8540,_0xc3bb7f[_0x1126('0x4b')]);return _0x5679ec[_0x1126('0x54')](_0xec8540);}})[_0x1126('0x19')](function(_0x2418ca){if(_0x2418ca){_0xd182b1=_0x2418ca[_0x1126('0x38')];if(!_0xc3bb7f[_0x1126('0x33')][_0x1126('0x39')]('nolimit')){_0xec8540['limit']=qs[_0x1126('0x27')](_0xc3bb7f['query'][_0x1126('0x27')]);_0xec8540['offset']=qs[_0x1126('0x26')](_0xc3bb7f['query'][_0x1126('0x26')]);}return _0x5679ec['getDescriptions'](_0xec8540);}})['then'](function(_0x48c461){if(_0x48c461){return _0x48c461?{'count':_0xd182b1,'rows':_0x48c461}:null;}})[_0x1126('0x19')](respondWithResult(_0x1644fc,null))[_0x1126('0x22')](handleError(_0x1644fc,null));}; \ No newline at end of file +var _0xc4aa=['util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','index','SalesforceConfiguration','rawAttributes','model','keys','query','intersection','fields','attributes','order','sort','filters','filter','where','merge','map','type','VIRTUAL','field','options','includeAll','include','findAll','rows','show','params','length','find','create','body','findOne','SalesforceField','pick','hasOwnProperty','getFields','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x2ac12d,_0x4a6769){var _0x3cd80c=function(_0x3a14ed){while(--_0x3a14ed){_0x2ac12d['push'](_0x2ac12d['shift']());}};_0x3cd80c(++_0x4a6769);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xc4aa[_0x2064e5];return _0x21a233;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var authService=require('../../components/auth/service');var hardwareService=require(_0xac4a('0x10'));var Redis=require(_0xac4a('0x11'));var qs=require(_0xac4a('0x12'));var logger=require('../../config/logger')(_0xac4a('0x13'));var utils=require('../../config/utils');var config=require(_0xac4a('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0xac4a('0x15'));var client=jayson[_0xac4a('0x16')][_0xac4a('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x5e16aa,_0x21a79,_0x68424a,_0x247b78){return new BPromise(function(_0x6e00d4,_0x1b4313){var _0x3b71c0=_0x247b78||client;return _0x3b71c0[_0xac4a('0x18')](_0x5e16aa,_0x68424a)[_0xac4a('0x19')](function(_0x190418){logger[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x21a79,_0xac4a('0x1c'));logger['debug'](_0xac4a('0x1d'),_0x21a79,_0xac4a('0x1c'),JSON[_0xac4a('0x1e')](_0x190418));if(_0x190418[_0xac4a('0x1f')]){if(_0x190418[_0xac4a('0x1f')][_0xac4a('0x20')]===0x1f4){logger[_0xac4a('0x1f')](_0xac4a('0x1b'),_0x21a79,_0x190418['error']['message']);return _0x1b4313(_0x190418[_0xac4a('0x1f')][_0xac4a('0x21')]);}logger[_0xac4a('0x1f')]('SalesforceConfiguration,\x20%s,\x20%s',_0x21a79,_0x190418[_0xac4a('0x1f')][_0xac4a('0x21')]);return _0x6e00d4(_0x190418[_0xac4a('0x1f')][_0xac4a('0x21')]);}else{logger[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x21a79,_0xac4a('0x1c'));_0x6e00d4(_0x190418[_0xac4a('0x22')]['message']);}})[_0xac4a('0x23')](function(_0x3204ad){logger['error'](_0xac4a('0x1b'),_0x21a79,_0x3204ad);_0x1b4313(_0x3204ad);});});}function respondWithStatusCode(_0x4169c0,_0x3eacd3){_0x3eacd3=_0x3eacd3||0xcc;return function(_0x947d8e){if(_0x947d8e){return _0x4169c0['sendStatus'](_0x3eacd3);}return _0x4169c0[_0xac4a('0x24')](_0x3eacd3)[_0xac4a('0x25')]();};}function respondWithResult(_0x15435c,_0x412494){_0x412494=_0x412494||0xc8;return function(_0x594f36){if(_0x594f36){return _0x15435c[_0xac4a('0x24')](_0x412494)[_0xac4a('0x26')](_0x594f36);}};}function respondWithFilteredResult(_0x36054a,_0x3e2c69){return function(_0x3bc318){if(_0x3bc318){var _0x1d0539=_0x3bc318[_0xac4a('0x27')],_0x215a31=_0x3e2c69[_0xac4a('0x28')],_0x14832b=_0x3e2c69['offset']+_0x3e2c69[_0xac4a('0x29')],_0x472c57;if(_0x14832b>=_0x1d0539){_0x14832b=_0x1d0539;_0x472c57=0xc8;}else{_0x472c57=0xce;}_0x36054a[_0xac4a('0x24')](_0x472c57);return _0x36054a[_0xac4a('0x2a')](_0xac4a('0x2b'),_0x215a31+'-'+_0x14832b+'/'+_0x1d0539)[_0xac4a('0x26')](_0x3bc318);}return null;};}function patchUpdates(_0x4a5a9e){return function(_0x47f49c){try{jsonpatch[_0xac4a('0x2c')](_0x47f49c,_0x4a5a9e,!![]);}catch(_0x7a948b){return BPromise[_0xac4a('0x2d')](_0x7a948b);}return _0x47f49c['save']();};}function saveUpdates(_0x4bda1f,_0x355755){return function(_0x2896bc){if(_0x2896bc){return _0x2896bc[_0xac4a('0x2e')](_0x4bda1f)[_0xac4a('0x19')](function(_0x17118e){return _0x17118e;});}return null;};}function removeEntity(_0x53d3a5,_0x6dcc7f){return function(_0x482afc){if(_0x482afc){return _0x482afc[_0xac4a('0x2f')]()['then'](function(){_0x53d3a5[_0xac4a('0x24')](0xcc)[_0xac4a('0x25')]();});}};}function handleEntityNotFound(_0x31501b,_0x228aa7){return function(_0x34577f){if(!_0x34577f){_0x31501b[_0xac4a('0x30')](0x194);}return _0x34577f;};}function handleError(_0xbd4591,_0x1f13f3){_0x1f13f3=_0x1f13f3||0x1f4;return function(_0x29fb3b){logger[_0xac4a('0x1f')](_0x29fb3b[_0xac4a('0x31')]);if(_0x29fb3b[_0xac4a('0x32')]){delete _0x29fb3b[_0xac4a('0x32')];}_0xbd4591[_0xac4a('0x24')](_0x1f13f3)['send'](_0x29fb3b);};}exports[_0xac4a('0x33')]=function(_0x1c41fb,_0x5a4e2b){var _0x2a5419={},_0x1af1c1={},_0x565164={'count':0x0,'rows':[]};var _0x58804b=db[_0xac4a('0x34')][_0xac4a('0x35')];_0x1af1c1[_0xac4a('0x36')]=_[_0xac4a('0x37')](_0x58804b);_0x1af1c1['query']=_[_0xac4a('0x37')](_0x1c41fb[_0xac4a('0x38')]);_0x1af1c1['filters']=_[_0xac4a('0x39')](_0x1af1c1[_0xac4a('0x36')],_0x1af1c1[_0xac4a('0x38')]);_0x2a5419['attributes']=_[_0xac4a('0x39')](_0x1af1c1[_0xac4a('0x36')],qs[_0xac4a('0x3a')](_0x1c41fb['query'][_0xac4a('0x3a')]));_0x2a5419[_0xac4a('0x3b')]=_0x2a5419['attributes']['length']?_0x2a5419[_0xac4a('0x3b')]:_0x1af1c1['model'];if(!_0x1c41fb['query']['hasOwnProperty']('nolimit')){_0x2a5419[_0xac4a('0x29')]=qs[_0xac4a('0x29')](_0x1c41fb[_0xac4a('0x38')][_0xac4a('0x29')]);_0x2a5419[_0xac4a('0x28')]=qs[_0xac4a('0x28')](_0x1c41fb[_0xac4a('0x38')][_0xac4a('0x28')]);}_0x2a5419[_0xac4a('0x3c')]=qs[_0xac4a('0x3d')](_0x1c41fb[_0xac4a('0x38')][_0xac4a('0x3d')]);_0x2a5419['where']=qs['filters'](_['pick'](_0x1c41fb[_0xac4a('0x38')],_0x1af1c1[_0xac4a('0x3e')]));if(_0x1c41fb[_0xac4a('0x38')][_0xac4a('0x3f')]){_0x2a5419[_0xac4a('0x40')]=_[_0xac4a('0x41')](_0x2a5419[_0xac4a('0x40')],{'$or':_[_0xac4a('0x42')](_0x58804b,function(_0x3e9973){if(_0x3e9973[_0xac4a('0x43')]['key']!==_0xac4a('0x44')){var _0x31bfaf={};_0x31bfaf[_0x3e9973[_0xac4a('0x45')]]={'$like':'%'+_0x1c41fb[_0xac4a('0x38')][_0xac4a('0x3f')]+'%'};return _0x31bfaf;}})});}_0x2a5419=_['merge']({},_0x2a5419,_0x1c41fb[_0xac4a('0x46')]);var _0x1b77bb={'where':_0x2a5419['where']};return db[_0xac4a('0x34')]['count'](_0x1b77bb)[_0xac4a('0x19')](function(_0x65494e){_0x565164[_0xac4a('0x27')]=_0x65494e;if(_0x1c41fb[_0xac4a('0x38')][_0xac4a('0x47')]){_0x2a5419[_0xac4a('0x48')]=[{'all':!![]}];}return db[_0xac4a('0x34')][_0xac4a('0x49')](_0x2a5419);})[_0xac4a('0x19')](function(_0xcb002b){_0x565164[_0xac4a('0x4a')]=_0xcb002b;return _0x565164;})[_0xac4a('0x19')](respondWithFilteredResult(_0x5a4e2b,_0x2a5419))['catch'](handleError(_0x5a4e2b,null));};exports[_0xac4a('0x4b')]=function(_0x41d11d,_0xeca4e9){var _0x58759a={'raw':![],'where':{'id':_0x41d11d[_0xac4a('0x4c')]['id']}},_0x1764bf={};_0x1764bf['model']=_[_0xac4a('0x37')](db['SalesforceConfiguration'][_0xac4a('0x35')]);_0x1764bf[_0xac4a('0x38')]=_[_0xac4a('0x37')](_0x41d11d['query']);_0x1764bf['filters']=_[_0xac4a('0x39')](_0x1764bf['model'],_0x1764bf[_0xac4a('0x38')]);_0x58759a['attributes']=_[_0xac4a('0x39')](_0x1764bf['model'],qs[_0xac4a('0x3a')](_0x41d11d[_0xac4a('0x38')][_0xac4a('0x3a')]));_0x58759a[_0xac4a('0x3b')]=_0x58759a['attributes'][_0xac4a('0x4d')]?_0x58759a[_0xac4a('0x3b')]:_0x1764bf[_0xac4a('0x36')];if(_0x41d11d[_0xac4a('0x38')][_0xac4a('0x47')]){_0x58759a[_0xac4a('0x48')]=[{'all':!![]}];}_0x58759a=_[_0xac4a('0x41')]({},_0x58759a,_0x41d11d['options']);return db[_0xac4a('0x34')][_0xac4a('0x4e')](_0x58759a)['then'](handleEntityNotFound(_0xeca4e9,null))[_0xac4a('0x19')](respondWithResult(_0xeca4e9,null))[_0xac4a('0x23')](handleError(_0xeca4e9,null));};exports[_0xac4a('0x4f')]=function(_0x3ac36e,_0x4bb2fb){return db[_0xac4a('0x34')][_0xac4a('0x4f')](_0x3ac36e[_0xac4a('0x50')],{})[_0xac4a('0x19')](respondWithResult(_0x4bb2fb,0xc9))[_0xac4a('0x23')](handleError(_0x4bb2fb,null));};exports['update']=function(_0x179373,_0x564b10){if(_0x179373[_0xac4a('0x50')]['id']){delete _0x179373[_0xac4a('0x50')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x179373[_0xac4a('0x4c')]['id']}})[_0xac4a('0x19')](handleEntityNotFound(_0x564b10,null))['then'](saveUpdates(_0x179373[_0xac4a('0x50')],null))[_0xac4a('0x19')](respondWithResult(_0x564b10,null))[_0xac4a('0x23')](handleError(_0x564b10,null));};exports[_0xac4a('0x2f')]=function(_0x48900f,_0x3057d6){return db[_0xac4a('0x34')][_0xac4a('0x4e')]({'where':{'id':_0x48900f[_0xac4a('0x4c')]['id']}})[_0xac4a('0x19')](handleEntityNotFound(_0x3057d6,null))[_0xac4a('0x19')](removeEntity(_0x3057d6,null))[_0xac4a('0x23')](handleError(_0x3057d6,null));};exports['getFields']=function(_0x39123d,_0xef51d0,_0xe870ba){var _0x156dd2={};var _0x1b7231={};var _0x2ac1e9;var _0x213df2;return db[_0xac4a('0x34')][_0xac4a('0x51')]({'where':{'id':_0x39123d[_0xac4a('0x4c')]['id']}})[_0xac4a('0x19')](handleEntityNotFound(_0xef51d0,null))[_0xac4a('0x19')](function(_0x400ac4){if(_0x400ac4){_0x2ac1e9=_0x400ac4;_0x1b7231[_0xac4a('0x36')]=_[_0xac4a('0x37')](db[_0xac4a('0x52')]['rawAttributes']);_0x1b7231[_0xac4a('0x38')]=_['keys'](_0x39123d[_0xac4a('0x38')]);_0x1b7231['filters']=_[_0xac4a('0x39')](_0x1b7231['model'],_0x1b7231[_0xac4a('0x38')]);_0x156dd2['attributes']=_['intersection'](_0x1b7231[_0xac4a('0x36')],qs[_0xac4a('0x3a')](_0x39123d[_0xac4a('0x38')][_0xac4a('0x3a')]));_0x156dd2[_0xac4a('0x3b')]=_0x156dd2[_0xac4a('0x3b')]['length']?_0x156dd2[_0xac4a('0x3b')]:_0x1b7231['model'];_0x156dd2[_0xac4a('0x3c')]=qs['sort'](_0x39123d[_0xac4a('0x38')][_0xac4a('0x3d')]);_0x156dd2[_0xac4a('0x40')]=qs[_0xac4a('0x3e')](_[_0xac4a('0x53')](_0x39123d[_0xac4a('0x38')],_0x1b7231[_0xac4a('0x3e')]));if(_0x39123d[_0xac4a('0x38')][_0xac4a('0x3f')]){_0x156dd2[_0xac4a('0x40')]=_[_0xac4a('0x41')](_0x156dd2[_0xac4a('0x40')],{'$or':_[_0xac4a('0x42')](_0x156dd2[_0xac4a('0x3b')],function(_0x17ae93){var _0xf07212={};_0xf07212[_0x17ae93]={'$like':'%'+_0x39123d[_0xac4a('0x38')]['filter']+'%'};return _0xf07212;})});}_0x156dd2=_[_0xac4a('0x41')]({},_0x156dd2,_0x39123d[_0xac4a('0x46')]);return _0x2ac1e9['getFields'](_0x156dd2);}})[_0xac4a('0x19')](function(_0x34bd1c){if(_0x34bd1c){_0x213df2=_0x34bd1c[_0xac4a('0x4d')];if(!_0x39123d[_0xac4a('0x38')][_0xac4a('0x54')]('nolimit')){_0x156dd2['limit']=qs[_0xac4a('0x29')](_0x39123d[_0xac4a('0x38')][_0xac4a('0x29')]);_0x156dd2[_0xac4a('0x28')]=qs[_0xac4a('0x28')](_0x39123d[_0xac4a('0x38')][_0xac4a('0x28')]);}return _0x2ac1e9[_0xac4a('0x55')](_0x156dd2);}})[_0xac4a('0x19')](function(_0x295f21){if(_0x295f21){return _0x295f21?{'count':_0x213df2,'rows':_0x295f21}:null;}})[_0xac4a('0x19')](respondWithResult(_0xef51d0,null))['catch'](handleError(_0xef51d0,null));};exports['getSubjects']=function(_0x1ee825,_0x1febff,_0x2954fc){var _0x423f70={};var _0x663a97={};var _0x283107;var _0x1d24bb;return db[_0xac4a('0x34')][_0xac4a('0x51')]({'where':{'id':_0x1ee825[_0xac4a('0x4c')]['id']}})[_0xac4a('0x19')](handleEntityNotFound(_0x1febff,null))[_0xac4a('0x19')](function(_0x5f0173){if(_0x5f0173){_0x283107=_0x5f0173;_0x663a97[_0xac4a('0x36')]=_[_0xac4a('0x37')](db[_0xac4a('0x52')][_0xac4a('0x35')]);_0x663a97['query']=_[_0xac4a('0x37')](_0x1ee825['query']);_0x663a97[_0xac4a('0x3e')]=_[_0xac4a('0x39')](_0x663a97['model'],_0x663a97['query']);_0x423f70[_0xac4a('0x3b')]=_[_0xac4a('0x39')](_0x663a97[_0xac4a('0x36')],qs['fields'](_0x1ee825[_0xac4a('0x38')]['fields']));_0x423f70[_0xac4a('0x3b')]=_0x423f70['attributes']['length']?_0x423f70[_0xac4a('0x3b')]:_0x663a97['model'];_0x423f70[_0xac4a('0x3c')]=qs['sort'](_0x1ee825[_0xac4a('0x38')][_0xac4a('0x3d')]);_0x423f70['where']=qs[_0xac4a('0x3e')](_['pick'](_0x1ee825[_0xac4a('0x38')],_0x663a97[_0xac4a('0x3e')]));if(_0x1ee825['query'][_0xac4a('0x3f')]){_0x423f70['where']=_['merge'](_0x423f70[_0xac4a('0x40')],{'$or':_['map'](_0x423f70[_0xac4a('0x3b')],function(_0x558c43){var _0x4ccd67={};_0x4ccd67[_0x558c43]={'$like':'%'+_0x1ee825[_0xac4a('0x38')][_0xac4a('0x3f')]+'%'};return _0x4ccd67;})});}_0x423f70=_[_0xac4a('0x41')]({},_0x423f70,_0x1ee825['options']);return _0x283107['getSubjects'](_0x423f70);}})[_0xac4a('0x19')](function(_0x9c0fa1){if(_0x9c0fa1){_0x1d24bb=_0x9c0fa1['length'];if(!_0x1ee825['query'][_0xac4a('0x54')](_0xac4a('0x56'))){_0x423f70[_0xac4a('0x29')]=qs[_0xac4a('0x29')](_0x1ee825[_0xac4a('0x38')][_0xac4a('0x29')]);_0x423f70[_0xac4a('0x28')]=qs[_0xac4a('0x28')](_0x1ee825[_0xac4a('0x38')]['offset']);}return _0x283107[_0xac4a('0x57')](_0x423f70);}})[_0xac4a('0x19')](function(_0x3ba61e){if(_0x3ba61e){return _0x3ba61e?{'count':_0x1d24bb,'rows':_0x3ba61e}:null;}})['then'](respondWithResult(_0x1febff,null))[_0xac4a('0x23')](handleError(_0x1febff,null));};exports[_0xac4a('0x58')]=function(_0x7c9bbe,_0x391c35,_0x3d2b5c){var _0x5daf44={};var _0x290a73={};var _0x19ce24;var _0xc9d040;return db[_0xac4a('0x34')][_0xac4a('0x51')]({'where':{'id':_0x7c9bbe[_0xac4a('0x4c')]['id']}})[_0xac4a('0x19')](handleEntityNotFound(_0x391c35,null))['then'](function(_0x2e3bb7){if(_0x2e3bb7){_0x19ce24=_0x2e3bb7;_0x290a73[_0xac4a('0x36')]=_[_0xac4a('0x37')](db[_0xac4a('0x52')][_0xac4a('0x35')]);_0x290a73[_0xac4a('0x38')]=_['keys'](_0x7c9bbe[_0xac4a('0x38')]);_0x290a73[_0xac4a('0x3e')]=_[_0xac4a('0x39')](_0x290a73[_0xac4a('0x36')],_0x290a73['query']);_0x5daf44[_0xac4a('0x3b')]=_['intersection'](_0x290a73[_0xac4a('0x36')],qs[_0xac4a('0x3a')](_0x7c9bbe['query']['fields']));_0x5daf44[_0xac4a('0x3b')]=_0x5daf44[_0xac4a('0x3b')][_0xac4a('0x4d')]?_0x5daf44['attributes']:_0x290a73[_0xac4a('0x36')];_0x5daf44['order']=qs[_0xac4a('0x3d')](_0x7c9bbe[_0xac4a('0x38')][_0xac4a('0x3d')]);_0x5daf44[_0xac4a('0x40')]=qs[_0xac4a('0x3e')](_['pick'](_0x7c9bbe['query'],_0x290a73[_0xac4a('0x3e')]));if(_0x7c9bbe[_0xac4a('0x38')][_0xac4a('0x3f')]){_0x5daf44[_0xac4a('0x40')]=_[_0xac4a('0x41')](_0x5daf44[_0xac4a('0x40')],{'$or':_[_0xac4a('0x42')](_0x5daf44[_0xac4a('0x3b')],function(_0x49ac09){var _0x52b3e6={};_0x52b3e6[_0x49ac09]={'$like':'%'+_0x7c9bbe[_0xac4a('0x38')][_0xac4a('0x3f')]+'%'};return _0x52b3e6;})});}_0x5daf44=_[_0xac4a('0x41')]({},_0x5daf44,_0x7c9bbe[_0xac4a('0x46')]);return _0x19ce24[_0xac4a('0x58')](_0x5daf44);}})[_0xac4a('0x19')](function(_0xdaa2ef){if(_0xdaa2ef){_0xc9d040=_0xdaa2ef[_0xac4a('0x4d')];if(!_0x7c9bbe['query']['hasOwnProperty'](_0xac4a('0x56'))){_0x5daf44[_0xac4a('0x29')]=qs[_0xac4a('0x29')](_0x7c9bbe[_0xac4a('0x38')][_0xac4a('0x29')]);_0x5daf44[_0xac4a('0x28')]=qs[_0xac4a('0x28')](_0x7c9bbe['query'][_0xac4a('0x28')]);}return _0x19ce24[_0xac4a('0x58')](_0x5daf44);}})[_0xac4a('0x19')](function(_0x5f323d){if(_0x5f323d){return _0x5f323d?{'count':_0xc9d040,'rows':_0x5f323d}:null;}})[_0xac4a('0x19')](respondWithResult(_0x391c35,null))[_0xac4a('0x23')](handleError(_0x391c35,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 77c3ac0..737906b 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 _0x61ac=['util','api','moment','bluebird','exports'];(function(_0x47e4b0,_0x4fba15){var _0x47685a=function(_0x3a5df3){while(--_0x3a5df3){_0x47e4b0['push'](_0x47e4b0['shift']());}};_0x47685a(++_0x4fba15);}(_0x61ac,0x82));var _0xc61a=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0x61ac[_0x1030ce];return _0x3367fd;};'use strict';var _=require('lodash');var util=require(_0xc61a('0x0'));var logger=require('../../config/logger')(_0xc61a('0x1'));var moment=require(_0xc61a('0x2'));var BPromise=require(_0xc61a('0x3'));var rp=require('request-promise');var attributes=require('./intSalesforceConfiguration.attributes');module[_0xc61a('0x4')]=function(_0x370e61,_0x23d0f9){return _0x370e61['define']('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b35=['lodash','util','../../config/logger','api','moment','request-promise','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration'];(function(_0x350258,_0x4e0a50){var _0x3714b3=function(_0x8918f7){while(--_0x8918f7){_0x350258['push'](_0x350258['shift']());}};_0x3714b3(++_0x4e0a50);}(_0x8b35,0x17a));var _0x58b3=function(_0x89a6e6,_0x5108c1){_0x89a6e6=_0x89a6e6-0x0;var _0x5a3576=_0x8b35[_0x89a6e6];return _0x5a3576;};'use strict';var _=require(_0x58b3('0x0'));var util=require(_0x58b3('0x1'));var logger=require(_0x58b3('0x2'))(_0x58b3('0x3'));var moment=require(_0x58b3('0x4'));var BPromise=require('bluebird');var rp=require(_0x58b3('0x5'));var attributes=require(_0x58b3('0x6'));module[_0x58b3('0x7')]=function(_0x21cba1,_0x34ea2c){return _0x21cba1['define'](_0x58b3('0x8'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 13f0762..95e0309 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 _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','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'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x7217,0x19e));var _0x7721=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x7217[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file +var _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','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'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x7217,0x19e));var _0x7721=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x7217[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 02e1477..a22b2da 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 _0xa1b3=['/:id','show','post','update','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x48eb4d,_0x1bcc55){var _0x239dbf=function(_0x41f591){while(--_0x41f591){_0x48eb4d['push'](_0x48eb4d['shift']());}};_0x239dbf(++_0x1bcc55);}(_0xa1b3,0x110));var _0x3a1b=function(_0x38b811,_0x28fbd3){_0x38b811=_0x38b811-0x0;var _0xa00bff=_0xa1b3[_0x38b811];return _0xa00bff;};'use strict';var multer=require(_0x3a1b('0x0'));var util=require(_0x3a1b('0x1'));var path=require(_0x3a1b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x3a1b('0x3'));var interaction=require(_0x3a1b('0x4'));var config=require(_0x3a1b('0x5'));var controller=require('./intSalesforceField.controller');router[_0x3a1b('0x6')]('/',auth[_0x3a1b('0x7')](),controller['index']);router['get'](_0x3a1b('0x8'),auth['isAuthenticated'](),controller[_0x3a1b('0x9')]);router[_0x3a1b('0xa')]('/',auth[_0x3a1b('0x7')](),controller['create']);router['put'](_0x3a1b('0x8'),auth[_0x3a1b('0x7')](),controller[_0x3a1b('0xb')]);router['delete'](_0x3a1b('0x8'),auth[_0x3a1b('0x7')](),controller[_0x3a1b('0xc')]);module[_0x3a1b('0xd')]=router; \ No newline at end of file +var _0xf09f=['post','create','put','update','/:id','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','show'];(function(_0x200749,_0x1e2c83){var _0x19467d=function(_0x1c3115){while(--_0x1c3115){_0x200749['push'](_0x200749['shift']());}};_0x19467d(++_0x1e2c83);}(_0xf09f,0x1b7));var _0xff09=function(_0x2e2161,_0x5ad35f){_0x2e2161=_0x2e2161-0x0;var _0x1bd857=_0xf09f[_0x2e2161];return _0x1bd857;};'use strict';var multer=require(_0xff09('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xff09('0x1'));var express=require(_0xff09('0x2'));var router=express[_0xff09('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xff09('0x4'));var config=require('../../config/environment');var controller=require(_0xff09('0x5'));router[_0xff09('0x6')]('/',auth[_0xff09('0x7')](),controller['index']);router[_0xff09('0x6')]('/:id',auth[_0xff09('0x7')](),controller[_0xff09('0x8')]);router[_0xff09('0x9')]('/',auth[_0xff09('0x7')](),controller[_0xff09('0xa')]);router[_0xff09('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xff09('0xc')]);router['delete'](_0xff09('0xd'),auth[_0xff09('0x7')](),controller[_0xff09('0xe')]);module[_0xff09('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index f7dab88..134a7b5 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 _0x01ff=['variable','customVariable','keyValue','string','STRING','sequelize','ENUM'];(function(_0x3b541f,_0x3e17ad){var _0x508723=function(_0x4ba2b2){while(--_0x4ba2b2){_0x3b541f['push'](_0x3b541f['shift']());}};_0x508723(++_0x3e17ad);}(_0x01ff,0x98));var _0xf01f=function(_0x4dd5f2,_0x458dd3){_0x4dd5f2=_0x4dd5f2-0x0;var _0x15281b=_0x01ff[_0x4dd5f2];return _0x15281b;};'use strict';var Sequelize=require(_0xf01f('0x0'));module['exports']={'type':{'type':Sequelize[_0xf01f('0x1')]('string',_0xf01f('0x2'),_0xf01f('0x3'),_0xf01f('0x4')),'defaultValue':_0xf01f('0x5')},'content':{'type':Sequelize[_0xf01f('0x6')]},'key':{'type':Sequelize[_0xf01f('0x6')]},'keyType':{'type':Sequelize[_0xf01f('0x1')](_0xf01f('0x5'),'variable',_0xf01f('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf01f('0x6')]},'variableName':{'type':Sequelize[_0xf01f('0x6')]}}; \ No newline at end of file +var _0xeecc=['variable','customVariable','keyValue','STRING','sequelize','exports','ENUM','string'];(function(_0x3cc449,_0x119f5d){var _0x3ae156=function(_0x536895){while(--_0x536895){_0x3cc449['push'](_0x3cc449['shift']());}};_0x3ae156(++_0x119f5d);}(_0xeecc,0xa4));var _0xceec=function(_0x4459fc,_0x5dfe8f){_0x4459fc=_0x4459fc-0x0;var _0x450b3f=_0xeecc[_0x4459fc];return _0x450b3f;};'use strict';var Sequelize=require(_0xceec('0x0'));module[_0xceec('0x1')]={'type':{'type':Sequelize[_0xceec('0x2')](_0xceec('0x3'),_0xceec('0x4'),_0xceec('0x5'),_0xceec('0x6')),'defaultValue':_0xceec('0x3')},'content':{'type':Sequelize[_0xceec('0x7')]},'key':{'type':Sequelize[_0xceec('0x7')]},'keyType':{'type':Sequelize[_0xceec('0x2')]('string',_0xceec('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xceec('0x7')]},'idField':{'type':Sequelize[_0xceec('0x7')]},'variableName':{'type':Sequelize[_0xceec('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index d8759ea..4ff37ae 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 _0x7fd2=['zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','update','then','destroy','stack','name','index','SalesforceField','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','map','type','VIRTUAL','field','merge','options','includeAll','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf'];(function(_0x13625f,_0x3bedc4){var _0x35a981=function(_0x59835b){while(--_0x59835b){_0x13625f['push'](_0x13625f['shift']());}};_0x35a981(++_0x3bedc4);}(_0x7fd2,0x161));var _0x27fd=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x7fd2[_0x1fc122];return _0xa2cb13;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x27fd('0x0'));var rimraf=require(_0x27fd('0x1'));var zipdir=require(_0x27fd('0x2'));var jsonpatch=require(_0x27fd('0x3'));var rp=require(_0x27fd('0x4'));var moment=require(_0x27fd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x27fd('0x6'));var util=require(_0x27fd('0x7'));var path=require('path');var sox=require(_0x27fd('0x8'));var csv=require(_0x27fd('0x9'));var ejs=require(_0x27fd('0xa'));var fs=require('fs');var _=require(_0x27fd('0xb'));var squel=require(_0x27fd('0xc'));var crypto=require(_0x27fd('0xd'));var jsforce=require(_0x27fd('0xe'));var deskjs=require(_0x27fd('0xf'));var toCsv=require(_0x27fd('0x9'));var querystring=require(_0x27fd('0x10'));var Papa=require(_0x27fd('0x11'));var authService=require('../../components/auth/service');var hardwareService=require(_0x27fd('0x12'));var Redis=require(_0x27fd('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0x27fd('0x14'))(_0x27fd('0x15'));var utils=require(_0x27fd('0x16'));var config=require('../../config/environment');var db=require(_0x27fd('0x17'))['db'];function respondWithStatusCode(_0x2c019c,_0x562da6){_0x562da6=_0x562da6||0xcc;return function(_0x45ffee){if(_0x45ffee){return _0x2c019c[_0x27fd('0x18')](_0x562da6);}return _0x2c019c[_0x27fd('0x19')](_0x562da6)[_0x27fd('0x1a')]();};}function respondWithResult(_0x54edee,_0x533a71){_0x533a71=_0x533a71||0xc8;return function(_0x5b4379){if(_0x5b4379){return _0x54edee[_0x27fd('0x19')](_0x533a71)['json'](_0x5b4379);}};}function respondWithFilteredResult(_0x44964f,_0x49c4ec){return function(_0x402ac6){if(_0x402ac6){var _0x25d064=_0x402ac6[_0x27fd('0x1b')],_0xc36f83=_0x49c4ec[_0x27fd('0x1c')],_0x4000cb=_0x49c4ec['offset']+_0x49c4ec['limit'],_0x39813e;if(_0x4000cb>=_0x25d064){_0x4000cb=_0x25d064;_0x39813e=0xc8;}else{_0x39813e=0xce;}_0x44964f[_0x27fd('0x19')](_0x39813e);return _0x44964f['set'](_0x27fd('0x1d'),_0xc36f83+'-'+_0x4000cb+'/'+_0x25d064)[_0x27fd('0x1e')](_0x402ac6);}return null;};}function patchUpdates(_0x411301){return function(_0x34d8c3){try{jsonpatch[_0x27fd('0x1f')](_0x34d8c3,_0x411301,!![]);}catch(_0x555617){return BPromise[_0x27fd('0x20')](_0x555617);}return _0x34d8c3['save']();};}function saveUpdates(_0x20dbaf,_0x5d92eb){return function(_0x5b0728){if(_0x5b0728){return _0x5b0728[_0x27fd('0x21')](_0x20dbaf)[_0x27fd('0x22')](function(_0x1b60bc){return _0x1b60bc;});}return null;};}function removeEntity(_0x472a20,_0x1a23b5){return function(_0x2b0159){if(_0x2b0159){return _0x2b0159[_0x27fd('0x23')]()['then'](function(){_0x472a20['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2eaa62,_0x441a1b){return function(_0x25121b){if(!_0x25121b){_0x2eaa62['sendStatus'](0x194);}return _0x25121b;};}function handleError(_0x379ad8,_0x5ecdc2){_0x5ecdc2=_0x5ecdc2||0x1f4;return function(_0x2372a0){logger['error'](_0x2372a0[_0x27fd('0x24')]);if(_0x2372a0[_0x27fd('0x25')]){delete _0x2372a0['name'];}_0x379ad8['status'](_0x5ecdc2)['send'](_0x2372a0);};}exports[_0x27fd('0x26')]=function(_0x5a6822,_0x16ee25){var _0x400a61={},_0x3a0656={},_0xbf893c={'count':0x0,'rows':[]};var _0x1860f0=db[_0x27fd('0x27')][_0x27fd('0x28')];_0x3a0656[_0x27fd('0x29')]=_[_0x27fd('0x2a')](_0x1860f0);_0x3a0656[_0x27fd('0x2b')]=_[_0x27fd('0x2a')](_0x5a6822[_0x27fd('0x2b')]);_0x3a0656[_0x27fd('0x2c')]=_[_0x27fd('0x2d')](_0x3a0656['model'],_0x3a0656[_0x27fd('0x2b')]);_0x400a61[_0x27fd('0x2e')]=_[_0x27fd('0x2d')](_0x3a0656['model'],qs['fields'](_0x5a6822[_0x27fd('0x2b')][_0x27fd('0x2f')]));_0x400a61[_0x27fd('0x2e')]=_0x400a61[_0x27fd('0x2e')][_0x27fd('0x30')]?_0x400a61[_0x27fd('0x2e')]:_0x3a0656['model'];if(!_0x5a6822[_0x27fd('0x2b')][_0x27fd('0x31')]('nolimit')){_0x400a61['limit']=qs[_0x27fd('0x32')](_0x5a6822[_0x27fd('0x2b')][_0x27fd('0x32')]);_0x400a61[_0x27fd('0x1c')]=qs[_0x27fd('0x1c')](_0x5a6822[_0x27fd('0x2b')][_0x27fd('0x1c')]);}_0x400a61[_0x27fd('0x33')]=qs[_0x27fd('0x34')](_0x5a6822[_0x27fd('0x2b')][_0x27fd('0x34')]);_0x400a61[_0x27fd('0x35')]=qs['filters'](_[_0x27fd('0x36')](_0x5a6822['query'],_0x3a0656[_0x27fd('0x2c')]));if(_0x5a6822['query'][_0x27fd('0x37')]){_0x400a61[_0x27fd('0x35')]=_['merge'](_0x400a61[_0x27fd('0x35')],{'$or':_[_0x27fd('0x38')](_0x1860f0,function(_0x44c381){if(_0x44c381[_0x27fd('0x39')]['key']!==_0x27fd('0x3a')){var _0x12cf5d={};_0x12cf5d[_0x44c381[_0x27fd('0x3b')]]={'$like':'%'+_0x5a6822[_0x27fd('0x2b')][_0x27fd('0x37')]+'%'};return _0x12cf5d;}})});}_0x400a61=_[_0x27fd('0x3c')]({},_0x400a61,_0x5a6822[_0x27fd('0x3d')]);var _0x1cd81a={'where':_0x400a61[_0x27fd('0x35')]};return db[_0x27fd('0x27')][_0x27fd('0x1b')](_0x1cd81a)[_0x27fd('0x22')](function(_0x2a6c0b){_0xbf893c[_0x27fd('0x1b')]=_0x2a6c0b;if(_0x5a6822[_0x27fd('0x2b')][_0x27fd('0x3e')]){_0x400a61['include']=[{'all':!![]}];}return db[_0x27fd('0x27')][_0x27fd('0x3f')](_0x400a61);})[_0x27fd('0x22')](function(_0x592a30){_0xbf893c[_0x27fd('0x40')]=_0x592a30;return _0xbf893c;})['then'](respondWithFilteredResult(_0x16ee25,_0x400a61))[_0x27fd('0x41')](handleError(_0x16ee25,null));};exports[_0x27fd('0x42')]=function(_0x147dcf,_0x55ebc2){var _0x1ce6aa={'raw':!![],'where':{'id':_0x147dcf[_0x27fd('0x43')]['id']}},_0x2ee6eb={};_0x2ee6eb[_0x27fd('0x29')]=_[_0x27fd('0x2a')](db['SalesforceField'][_0x27fd('0x28')]);_0x2ee6eb['query']=_[_0x27fd('0x2a')](_0x147dcf[_0x27fd('0x2b')]);_0x2ee6eb[_0x27fd('0x2c')]=_['intersection'](_0x2ee6eb[_0x27fd('0x29')],_0x2ee6eb[_0x27fd('0x2b')]);_0x1ce6aa['attributes']=_['intersection'](_0x2ee6eb['model'],qs[_0x27fd('0x2f')](_0x147dcf['query'][_0x27fd('0x2f')]));_0x1ce6aa[_0x27fd('0x2e')]=_0x1ce6aa[_0x27fd('0x2e')][_0x27fd('0x30')]?_0x1ce6aa[_0x27fd('0x2e')]:_0x2ee6eb[_0x27fd('0x29')];if(_0x147dcf['query']['includeAll']){_0x1ce6aa['include']=[{'all':!![]}];}_0x1ce6aa=_['merge']({},_0x1ce6aa,_0x147dcf[_0x27fd('0x3d')]);return db[_0x27fd('0x27')][_0x27fd('0x44')](_0x1ce6aa)[_0x27fd('0x22')](handleEntityNotFound(_0x55ebc2,null))[_0x27fd('0x22')](respondWithResult(_0x55ebc2,null))[_0x27fd('0x41')](handleError(_0x55ebc2,null));};exports[_0x27fd('0x45')]=function(_0x28ba60,_0x32cbb4){return db[_0x27fd('0x27')][_0x27fd('0x45')](_0x28ba60['body'],{})['then'](respondWithResult(_0x32cbb4,0xc9))[_0x27fd('0x41')](handleError(_0x32cbb4,null));};exports[_0x27fd('0x21')]=function(_0x260803,_0x9636ba){if(_0x260803[_0x27fd('0x46')]['id']){delete _0x260803[_0x27fd('0x46')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x260803[_0x27fd('0x43')]['id']}})[_0x27fd('0x22')](handleEntityNotFound(_0x9636ba,null))[_0x27fd('0x22')](saveUpdates(_0x260803[_0x27fd('0x46')],null))[_0x27fd('0x22')](respondWithResult(_0x9636ba,null))[_0x27fd('0x41')](handleError(_0x9636ba,null));};exports[_0x27fd('0x23')]=function(_0x545649,_0x4c111b){return db[_0x27fd('0x27')][_0x27fd('0x44')]({'where':{'id':_0x545649['params']['id']}})[_0x27fd('0x22')](handleEntityNotFound(_0x4c111b,null))[_0x27fd('0x22')](removeEntity(_0x4c111b,null))[_0x27fd('0x41')](handleError(_0x4c111b,null));}; \ No newline at end of file +var _0x1d53=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','squel','crypto','jsforce','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','count','offset','limit','status','Content-Range','json','reject','save','then','sendStatus','error','stack','name','send','index','SalesforceField','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','map','type','key','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','destroy'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x1d53,0x1a4));var _0x31d5=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x1d53[_0x138adb];return _0x1b27f2;};'use strict';var pdf=require(_0x31d5('0x0'));var emlformat=require(_0x31d5('0x1'));var rimraf=require(_0x31d5('0x2'));var zipdir=require(_0x31d5('0x3'));var jsonpatch=require(_0x31d5('0x4'));var rp=require(_0x31d5('0x5'));var moment=require(_0x31d5('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x31d5('0x7'));var util=require('util');var path=require('path');var sox=require(_0x31d5('0x8'));var csv=require(_0x31d5('0x9'));var ejs=require(_0x31d5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x31d5('0xb'));var crypto=require(_0x31d5('0xc'));var jsforce=require(_0x31d5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x31d5('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x31d5('0xe'));var hardwareService=require(_0x31d5('0xf'));var Redis=require(_0x31d5('0x10'));var qs=require(_0x31d5('0x11'));var logger=require(_0x31d5('0x12'))('api');var utils=require(_0x31d5('0x13'));var config=require(_0x31d5('0x14'));var db=require(_0x31d5('0x15'))['db'];function respondWithStatusCode(_0x30c74c,_0x12a6c4){_0x12a6c4=_0x12a6c4||0xcc;return function(_0xed65cd){if(_0xed65cd){return _0x30c74c['sendStatus'](_0x12a6c4);}return _0x30c74c['status'](_0x12a6c4)[_0x31d5('0x16')]();};}function respondWithResult(_0x5337f1,_0x31deb1){_0x31deb1=_0x31deb1||0xc8;return function(_0x205997){if(_0x205997){return _0x5337f1['status'](_0x31deb1)['json'](_0x205997);}};}function respondWithFilteredResult(_0x4873c4,_0x3aaef4){return function(_0x22e58e){if(_0x22e58e){var _0xfa06cf=_0x22e58e[_0x31d5('0x17')],_0x1cdccb=_0x3aaef4[_0x31d5('0x18')],_0x3183b5=_0x3aaef4[_0x31d5('0x18')]+_0x3aaef4[_0x31d5('0x19')],_0x4b4e97;if(_0x3183b5>=_0xfa06cf){_0x3183b5=_0xfa06cf;_0x4b4e97=0xc8;}else{_0x4b4e97=0xce;}_0x4873c4[_0x31d5('0x1a')](_0x4b4e97);return _0x4873c4['set'](_0x31d5('0x1b'),_0x1cdccb+'-'+_0x3183b5+'/'+_0xfa06cf)[_0x31d5('0x1c')](_0x22e58e);}return null;};}function patchUpdates(_0x257b1e){return function(_0x13a4a8){try{jsonpatch['apply'](_0x13a4a8,_0x257b1e,!![]);}catch(_0x5e124c){return BPromise[_0x31d5('0x1d')](_0x5e124c);}return _0x13a4a8[_0x31d5('0x1e')]();};}function saveUpdates(_0x326b77,_0xd0db75){return function(_0xa7cb7f){if(_0xa7cb7f){return _0xa7cb7f['update'](_0x326b77)[_0x31d5('0x1f')](function(_0x37c90a){return _0x37c90a;});}return null;};}function removeEntity(_0x4431c4,_0xce5ed9){return function(_0x522ad3){if(_0x522ad3){return _0x522ad3['destroy']()[_0x31d5('0x1f')](function(){_0x4431c4[_0x31d5('0x1a')](0xcc)[_0x31d5('0x16')]();});}};}function handleEntityNotFound(_0xbb1840,_0x2bdc0f){return function(_0x2c796d){if(!_0x2c796d){_0xbb1840[_0x31d5('0x20')](0x194);}return _0x2c796d;};}function handleError(_0x55dc7b,_0x34b80a){_0x34b80a=_0x34b80a||0x1f4;return function(_0x55c880){logger[_0x31d5('0x21')](_0x55c880[_0x31d5('0x22')]);if(_0x55c880['name']){delete _0x55c880[_0x31d5('0x23')];}_0x55dc7b['status'](_0x34b80a)[_0x31d5('0x24')](_0x55c880);};}exports[_0x31d5('0x25')]=function(_0x4fd3a7,_0x5aca7e){var _0x5dd1a3={},_0x18a8e9={},_0x47ba15={'count':0x0,'rows':[]};var _0x4ce9c2=db[_0x31d5('0x26')][_0x31d5('0x27')];_0x18a8e9[_0x31d5('0x28')]=_[_0x31d5('0x29')](_0x4ce9c2);_0x18a8e9[_0x31d5('0x2a')]=_[_0x31d5('0x29')](_0x4fd3a7[_0x31d5('0x2a')]);_0x18a8e9[_0x31d5('0x2b')]=_['intersection'](_0x18a8e9[_0x31d5('0x28')],_0x18a8e9[_0x31d5('0x2a')]);_0x5dd1a3[_0x31d5('0x2c')]=_[_0x31d5('0x2d')](_0x18a8e9['model'],qs[_0x31d5('0x2e')](_0x4fd3a7[_0x31d5('0x2a')][_0x31d5('0x2e')]));_0x5dd1a3[_0x31d5('0x2c')]=_0x5dd1a3[_0x31d5('0x2c')][_0x31d5('0x2f')]?_0x5dd1a3[_0x31d5('0x2c')]:_0x18a8e9[_0x31d5('0x28')];if(!_0x4fd3a7[_0x31d5('0x2a')]['hasOwnProperty'](_0x31d5('0x30'))){_0x5dd1a3[_0x31d5('0x19')]=qs[_0x31d5('0x19')](_0x4fd3a7[_0x31d5('0x2a')]['limit']);_0x5dd1a3[_0x31d5('0x18')]=qs[_0x31d5('0x18')](_0x4fd3a7[_0x31d5('0x2a')][_0x31d5('0x18')]);}_0x5dd1a3[_0x31d5('0x31')]=qs[_0x31d5('0x32')](_0x4fd3a7[_0x31d5('0x2a')][_0x31d5('0x32')]);_0x5dd1a3[_0x31d5('0x33')]=qs[_0x31d5('0x2b')](_[_0x31d5('0x34')](_0x4fd3a7[_0x31d5('0x2a')],_0x18a8e9[_0x31d5('0x2b')]));if(_0x4fd3a7[_0x31d5('0x2a')]['filter']){_0x5dd1a3[_0x31d5('0x33')]=_[_0x31d5('0x35')](_0x5dd1a3['where'],{'$or':_[_0x31d5('0x36')](_0x4ce9c2,function(_0xfbf2f8){if(_0xfbf2f8[_0x31d5('0x37')][_0x31d5('0x38')]!=='VIRTUAL'){var _0x1f1997={};_0x1f1997[_0xfbf2f8['field']]={'$like':'%'+_0x4fd3a7[_0x31d5('0x2a')]['filter']+'%'};return _0x1f1997;}})});}_0x5dd1a3=_[_0x31d5('0x35')]({},_0x5dd1a3,_0x4fd3a7[_0x31d5('0x39')]);var _0x3aa98b={'where':_0x5dd1a3['where']};return db[_0x31d5('0x26')][_0x31d5('0x17')](_0x3aa98b)[_0x31d5('0x1f')](function(_0xe83ba1){_0x47ba15[_0x31d5('0x17')]=_0xe83ba1;if(_0x4fd3a7[_0x31d5('0x2a')]['includeAll']){_0x5dd1a3[_0x31d5('0x3a')]=[{'all':!![]}];}return db[_0x31d5('0x26')][_0x31d5('0x3b')](_0x5dd1a3);})['then'](function(_0x321606){_0x47ba15[_0x31d5('0x3c')]=_0x321606;return _0x47ba15;})[_0x31d5('0x1f')](respondWithFilteredResult(_0x5aca7e,_0x5dd1a3))[_0x31d5('0x3d')](handleError(_0x5aca7e,null));};exports[_0x31d5('0x3e')]=function(_0xfaf42,_0x464d23){var _0x4c505c={'raw':!![],'where':{'id':_0xfaf42[_0x31d5('0x3f')]['id']}},_0x2363d2={};_0x2363d2[_0x31d5('0x28')]=_[_0x31d5('0x29')](db[_0x31d5('0x26')][_0x31d5('0x27')]);_0x2363d2[_0x31d5('0x2a')]=_[_0x31d5('0x29')](_0xfaf42[_0x31d5('0x2a')]);_0x2363d2[_0x31d5('0x2b')]=_[_0x31d5('0x2d')](_0x2363d2[_0x31d5('0x28')],_0x2363d2[_0x31d5('0x2a')]);_0x4c505c['attributes']=_[_0x31d5('0x2d')](_0x2363d2[_0x31d5('0x28')],qs[_0x31d5('0x2e')](_0xfaf42[_0x31d5('0x2a')][_0x31d5('0x2e')]));_0x4c505c[_0x31d5('0x2c')]=_0x4c505c[_0x31d5('0x2c')][_0x31d5('0x2f')]?_0x4c505c[_0x31d5('0x2c')]:_0x2363d2[_0x31d5('0x28')];if(_0xfaf42[_0x31d5('0x2a')][_0x31d5('0x40')]){_0x4c505c[_0x31d5('0x3a')]=[{'all':!![]}];}_0x4c505c=_[_0x31d5('0x35')]({},_0x4c505c,_0xfaf42['options']);return db[_0x31d5('0x26')][_0x31d5('0x41')](_0x4c505c)[_0x31d5('0x1f')](handleEntityNotFound(_0x464d23,null))[_0x31d5('0x1f')](respondWithResult(_0x464d23,null))[_0x31d5('0x3d')](handleError(_0x464d23,null));};exports[_0x31d5('0x42')]=function(_0x54086d,_0x5d6294){return db['SalesforceField'][_0x31d5('0x42')](_0x54086d[_0x31d5('0x43')],{})[_0x31d5('0x1f')](respondWithResult(_0x5d6294,0xc9))[_0x31d5('0x3d')](handleError(_0x5d6294,null));};exports[_0x31d5('0x44')]=function(_0x9c1459,_0x808dcb){if(_0x9c1459[_0x31d5('0x43')]['id']){delete _0x9c1459[_0x31d5('0x43')]['id'];}return db[_0x31d5('0x26')][_0x31d5('0x41')]({'where':{'id':_0x9c1459['params']['id']}})[_0x31d5('0x1f')](handleEntityNotFound(_0x808dcb,null))[_0x31d5('0x1f')](saveUpdates(_0x9c1459[_0x31d5('0x43')],null))[_0x31d5('0x1f')](respondWithResult(_0x808dcb,null))[_0x31d5('0x3d')](handleError(_0x808dcb,null));};exports[_0x31d5('0x45')]=function(_0x2e9d67,_0x343645){return db[_0x31d5('0x26')]['find']({'where':{'id':_0x2e9d67[_0x31d5('0x3f')]['id']}})[_0x31d5('0x1f')](handleEntityNotFound(_0x343645,null))[_0x31d5('0x1f')](removeEntity(_0x343645,null))['catch'](handleError(_0x343645,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index a63c029..cf675d6 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 _0x6d6f=['util','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','idField','lodash'];(function(_0x143c77,_0x187d61){var _0x2452b8=function(_0x1aa4b6){while(--_0x1aa4b6){_0x143c77['push'](_0x143c77['shift']());}};_0x2452b8(++_0x187d61);}(_0x6d6f,0x1cf));var _0xf6d6=function(_0x5774be,_0x2259d3){_0x5774be=_0x5774be-0x0;var _0x4914b4=_0x6d6f[_0x5774be];return _0x4914b4;};'use strict';var _=require(_0xf6d6('0x0'));var util=require(_0xf6d6('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xf6d6('0x2'));module[_0xf6d6('0x3')]=function(_0x51553b,_0x469134){return _0x51553b[_0xf6d6('0x4')](_0xf6d6('0x5'),attributes,{'tableName':_0xf6d6('0x6'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xf6d6('0x7'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1633=['exports','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','../../config/logger','moment','request-promise','./intSalesforceField.attributes'];(function(_0x34a259,_0x3987be){var _0x40b1de=function(_0x1fc045){while(--_0x1fc045){_0x34a259['push'](_0x34a259['shift']());}};_0x40b1de(++_0x3987be);}(_0x1633,0x19d));var _0x3163=function(_0x5e8c7f,_0x1769da){_0x5e8c7f=_0x5e8c7f-0x0;var _0x2eb7f5=_0x1633[_0x5e8c7f];return _0x2eb7f5;};'use strict';var _=require(_0x3163('0x0'));var util=require('util');var logger=require(_0x3163('0x1'))('api');var moment=require(_0x3163('0x2'));var BPromise=require('bluebird');var rp=require(_0x3163('0x3'));var attributes=require(_0x3163('0x4'));module[_0x3163('0x5')]=function(_0x2669cf,_0x93aaea){return _0x2669cf['define'](_0x3163('0x6'),attributes,{'tableName':_0x3163('0x7'),'paranoid':![],'indexes':[{'name':_0x3163('0x8'),'fields':[_0x3163('0x9'),_0x3163('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 5d06ae2..36f4fc8 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 _0x4cf7=['../../config/logger','../../config/environment','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x5a77fb,_0x2d2d59){var _0x6ca4fb=function(_0x428777){while(--_0x428777){_0x5a77fb['push'](_0x5a77fb['shift']());}};_0x6ca4fb(++_0x2d2d59);}(_0x4cf7,0xc7));var _0x74cf=function(_0x1f732a,_0x211ffc){_0x1f732a=_0x1f732a-0x0;var _0x41f7dd=_0x4cf7[_0x1f732a];return _0x41f7dd;};'use strict';var _=require(_0x74cf('0x0'));var util=require(_0x74cf('0x1'));var moment=require(_0x74cf('0x2'));var BPromise=require(_0x74cf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x74cf('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x74cf('0x5'))('rpc');var config=require(_0x74cf('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e2e65,_0x203c4e,_0x46dceb){return new BPromise(function(_0x1b6c5e,_0x1c5fe2){return client[_0x74cf('0x7')](_0x2e2e65,_0x46dceb)['then'](function(_0x2f0b8b){logger[_0x74cf('0x8')](_0x74cf('0x9'),_0x203c4e,_0x74cf('0xa'));logger[_0x74cf('0xb')](_0x74cf('0xc'),_0x203c4e,_0x74cf('0xa'),JSON[_0x74cf('0xd')](_0x2f0b8b));if(_0x2f0b8b[_0x74cf('0xe')]){if(_0x2f0b8b[_0x74cf('0xe')]['code']===0x1f4){logger[_0x74cf('0xe')](_0x74cf('0x9'),_0x203c4e,_0x2f0b8b[_0x74cf('0xe')]['message']);return _0x1c5fe2(_0x2f0b8b[_0x74cf('0xe')][_0x74cf('0xf')]);}logger[_0x74cf('0xe')]('SalesforceField,\x20%s,\x20%s',_0x203c4e,_0x2f0b8b[_0x74cf('0xe')][_0x74cf('0xf')]);return _0x1b6c5e(_0x2f0b8b['error'][_0x74cf('0xf')]);}else{logger[_0x74cf('0x8')](_0x74cf('0x9'),_0x203c4e,_0x74cf('0xa'));_0x1b6c5e(_0x2f0b8b['result'][_0x74cf('0xf')]);}})[_0x74cf('0x10')](function(_0x8b356b){logger['error'](_0x74cf('0x9'),_0x203c4e,_0x8b356b);_0x1c5fe2(_0x8b356b);});});} \ No newline at end of file +var _0x61f7=['client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5b0f80,_0x2d8635){var _0x58b997=function(_0xde054c){while(--_0xde054c){_0x5b0f80['push'](_0x5b0f80['shift']());}};_0x58b997(++_0x2d8635);}(_0x61f7,0x17b));var _0x761f=function(_0x16a852,_0x585d4b){_0x16a852=_0x16a852-0x0;var _0x16470e=_0x61f7[_0x16a852];return _0x16470e;};'use strict';var _=require(_0x761f('0x0'));var util=require(_0x761f('0x1'));var moment=require(_0x761f('0x2'));var BPromise=require(_0x761f('0x3'));var rs=require(_0x761f('0x4'));var fs=require('fs');var Redis=require(_0x761f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x761f('0x6'));var logger=require(_0x761f('0x7'))(_0x761f('0x8'));var config=require(_0x761f('0x9'));var jayson=require(_0x761f('0xa'));var client=jayson[_0x761f('0xb')][_0x761f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7d1d9a,_0x10168c,_0x3024f6){return new BPromise(function(_0xb1ea20,_0x2f2047){return client[_0x761f('0xd')](_0x7d1d9a,_0x3024f6)[_0x761f('0xe')](function(_0x536e9f){logger[_0x761f('0xf')](_0x761f('0x10'),_0x10168c,_0x761f('0x11'));logger[_0x761f('0x12')](_0x761f('0x13'),_0x10168c,'request\x20sent',JSON[_0x761f('0x14')](_0x536e9f));if(_0x536e9f[_0x761f('0x15')]){if(_0x536e9f[_0x761f('0x15')][_0x761f('0x16')]===0x1f4){logger[_0x761f('0x15')](_0x761f('0x10'),_0x10168c,_0x536e9f[_0x761f('0x15')][_0x761f('0x17')]);return _0x2f2047(_0x536e9f['error'][_0x761f('0x17')]);}logger[_0x761f('0x15')](_0x761f('0x10'),_0x10168c,_0x536e9f[_0x761f('0x15')][_0x761f('0x17')]);return _0xb1ea20(_0x536e9f[_0x761f('0x15')][_0x761f('0x17')]);}else{logger[_0x761f('0xf')](_0x761f('0x10'),_0x10168c,_0x761f('0x11'));_0xb1ea20(_0x536e9f[_0x761f('0x18')][_0x761f('0x17')]);}})[_0x761f('0x19')](function(_0x2bbc79){logger[_0x761f('0x15')](_0x761f('0x10'),_0x10168c,_0x2bbc79);_0x2f2047(_0x2bbc79);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 7613bad..aea0425 100644 --- a/server/api/intServicenowAccount/index.js +++ b/server/api/intServicenowAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e24=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','getConfigurations','getFields','post','create','addConfiguration','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x3bc47a,_0xeb4400){var _0x4b542f=function(_0x8e2d6a){while(--_0x8e2d6a){_0x3bc47a['push'](_0x3bc47a['shift']());}};_0x4b542f(++_0xeb4400);}(_0x5e24,0x151));var _0x45e2=function(_0x18f4da,_0xd4dbb2){_0x18f4da=_0x18f4da-0x0;var _0x2c5617=_0x5e24[_0x18f4da];return _0x2c5617;};'use strict';var multer=require(_0x45e2('0x0'));var util=require(_0x45e2('0x1'));var path=require(_0x45e2('0x2'));var timeout=require(_0x45e2('0x3'));var express=require(_0x45e2('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x45e2('0x5'));var config=require(_0x45e2('0x6'));var controller=require('./intServicenowAccount.controller');router['get']('/',auth[_0x45e2('0x7')](),controller[_0x45e2('0x8')]);router[_0x45e2('0x9')](_0x45e2('0xa'),auth['isAuthenticated'](),controller[_0x45e2('0xb')]);router[_0x45e2('0x9')]('/:id/configurations',auth[_0x45e2('0x7')](),controller[_0x45e2('0xc')]);router['get']('/:id/fields',auth[_0x45e2('0x7')](),controller[_0x45e2('0xd')]);router[_0x45e2('0xe')]('/',auth['isAuthenticated'](),controller[_0x45e2('0xf')]);router['post']('/:id/configurations',auth[_0x45e2('0x7')](),controller[_0x45e2('0x10')]);router['put'](_0x45e2('0xa'),auth[_0x45e2('0x7')](),controller['update']);router[_0x45e2('0x11')](_0x45e2('0xa'),auth['isAuthenticated'](),controller[_0x45e2('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa1fc=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','getConfigurations','create','/:id/configurations','addConfiguration','delete','util'];(function(_0x4e1530,_0x32cf93){var _0x10eb09=function(_0x5a0d07){while(--_0x5a0d07){_0x4e1530['push'](_0x4e1530['shift']());}};_0x10eb09(++_0x32cf93);}(_0xa1fc,0xdf));var _0xca1f=function(_0x5993de,_0x1e902f){_0x5993de=_0x5993de-0x0;var _0x481faf=_0xa1fc[_0x5993de];return _0x481faf;};'use strict';var multer=require('multer');var util=require(_0xca1f('0x0'));var path=require(_0xca1f('0x1'));var timeout=require('connect-timeout');var express=require(_0xca1f('0x2'));var router=express[_0xca1f('0x3')]();var auth=require(_0xca1f('0x4'));var interaction=require(_0xca1f('0x5'));var config=require(_0xca1f('0x6'));var controller=require('./intServicenowAccount.controller');router[_0xca1f('0x7')]('/',auth[_0xca1f('0x8')](),controller[_0xca1f('0x9')]);router[_0xca1f('0x7')](_0xca1f('0xa'),auth[_0xca1f('0x8')](),controller['show']);router['get']('/:id/configurations',auth[_0xca1f('0x8')](),controller[_0xca1f('0xb')]);router[_0xca1f('0x7')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0xca1f('0x8')](),controller[_0xca1f('0xc')]);router['post'](_0xca1f('0xd'),auth[_0xca1f('0x8')](),controller[_0xca1f('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xca1f('0xf')](_0xca1f('0xa'),auth[_0xca1f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 4a307e6..470c23b 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.attributes.js +++ b/server/api/intServicenowAccount/intServicenowAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb53=['exports','STRING','username','remoteUri','sequelize'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xbb53,0x121));var _0x3bb5=function(_0x4126fd,_0xc8d463){_0x4126fd=_0x4126fd-0x0;var _0x35b7f8=_0xbb53[_0x4126fd];return _0x35b7f8;};'use strict';var Sequelize=require(_0x3bb5('0x0'));module[_0x3bb5('0x1')]={'name':{'type':Sequelize[_0x3bb5('0x2')]},'description':{'type':Sequelize[_0x3bb5('0x2')]},'username':{'type':Sequelize[_0x3bb5('0x2')],'unique':_0x3bb5('0x3')},'password':{'type':Sequelize[_0x3bb5('0x2')]},'email':{'type':Sequelize[_0x3bb5('0x2')]},'remoteUri':{'type':Sequelize[_0x3bb5('0x2')],'unique':_0x3bb5('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6f7a=['sequelize','exports','STRING','username','remoteUri'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x16664c,_0xd0bbf0){_0x16664c=_0x16664c-0x0;var _0x54776e=_0x6f7a[_0x16664c];return _0x54776e;};'use strict';var Sequelize=require(_0xa6f7('0x0'));module[_0xa6f7('0x1')]={'name':{'type':Sequelize[_0xa6f7('0x2')]},'description':{'type':Sequelize[_0xa6f7('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xa6f7('0x3')},'password':{'type':Sequelize[_0xa6f7('0x2')]},'email':{'type':Sequelize[_0xa6f7('0x2')]},'remoteUri':{'type':Sequelize[_0xa6f7('0x2')],'unique':_0xa6f7('0x4')},'serverUrl':{'type':Sequelize[_0xa6f7('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index d982d6f..035c314 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.controller.js +++ b/server/api/intServicenowAccount/intServicenowAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4888=['remoteUri','serverUrl','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','remove','includes','internalType','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','all','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','count','offset','limit','status','set','Content-Range','json','save','update','destroy','end','stack','name','send','ServicenowAccount','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','type','key','VIRTUAL','field','filter','options','includeAll','include','findAll','show','params','find','create','body','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','getFields','made_sla','knowledge','subcategory','close_code','notify','incident_state','severity','category','upon_reject','sys_updated_on','child_incidents','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','delivery_plan','impact','active','business_service','priority','time_worked','expected_start','business_duration','group_list','resolved_at','approval_set','work_notes','short_description','correlation_display','work_start','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','problem_id','company','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','username','password','email'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4888,0x198));var _0x8488=function(_0xfd49ed,_0x1272e1){_0xfd49ed=_0xfd49ed-0x0;var _0x355f54=_0x4888[_0xfd49ed];return _0x355f54;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8488('0x0'));var rimraf=require(_0x8488('0x1'));var zipdir=require(_0x8488('0x2'));var jsonpatch=require(_0x8488('0x3'));var rp=require(_0x8488('0x4'));var moment=require(_0x8488('0x5'));var BPromise=require(_0x8488('0x6'));var Mustache=require('mustache');var util=require(_0x8488('0x7'));var path=require(_0x8488('0x8'));var sox=require(_0x8488('0x9'));var csv=require(_0x8488('0xa'));var ejs=require(_0x8488('0xb'));var fs=require('fs');var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0xa'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var authService=require(_0x8488('0xe'));var hardwareService=require(_0x8488('0xf'));var Redis=require(_0x8488('0x10'));var qs=require(_0x8488('0x11'));var logger=require('../../config/logger')(_0x8488('0x12'));var utils=require(_0x8488('0x13'));var config=require(_0x8488('0x14'));var db=require(_0x8488('0x15'))['db'];var integrations=require(_0x8488('0x16'));var jayson=require('jayson/promise');var client=jayson[_0x8488('0x17')][_0x8488('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x58f83d,_0x4a9ae2,_0x150b52,_0x496dd1){return new BPromise(function(_0x214083,_0x4e94fc){var _0x5161a3=_0x496dd1||client;return _0x5161a3[_0x8488('0x19')](_0x58f83d,_0x150b52)[_0x8488('0x1a')](function(_0x5700b){logger[_0x8488('0x1b')](_0x8488('0x1c'),_0x4a9ae2,_0x8488('0x1d'));logger[_0x8488('0x1e')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x4a9ae2,_0x8488('0x1d'),JSON[_0x8488('0x1f')](_0x5700b));if(_0x5700b[_0x8488('0x20')]){if(_0x5700b[_0x8488('0x20')][_0x8488('0x21')]===0x1f4){logger[_0x8488('0x20')](_0x8488('0x1c'),_0x4a9ae2,_0x5700b[_0x8488('0x20')][_0x8488('0x22')]);return _0x4e94fc(_0x5700b[_0x8488('0x20')][_0x8488('0x22')]);}logger[_0x8488('0x20')](_0x8488('0x1c'),_0x4a9ae2,_0x5700b['error']['message']);return _0x214083(_0x5700b[_0x8488('0x20')][_0x8488('0x22')]);}else{logger[_0x8488('0x1b')](_0x8488('0x1c'),_0x4a9ae2,_0x8488('0x1d'));_0x214083(_0x5700b[_0x8488('0x23')][_0x8488('0x22')]);}})[_0x8488('0x24')](function(_0x39dd43){logger['error'](_0x8488('0x1c'),_0x4a9ae2,_0x39dd43);_0x4e94fc(_0x39dd43);});});}function respondWithStatusCode(_0x4e07e1,_0x140b0b){_0x140b0b=_0x140b0b||0xcc;return function(_0x1361a6){if(_0x1361a6){return _0x4e07e1[_0x8488('0x25')](_0x140b0b);}return _0x4e07e1['status'](_0x140b0b)['end']();};}function respondWithResult(_0x5b8885,_0x59b5e2){_0x59b5e2=_0x59b5e2||0xc8;return function(_0x472624){if(_0x472624){return _0x5b8885['status'](_0x59b5e2)['json'](_0x472624);}};}function respondWithFilteredResult(_0x26bdbb,_0x2f350a){return function(_0x2b3c97){if(_0x2b3c97){var _0x6ebee0=_0x2b3c97[_0x8488('0x26')],_0x287662=_0x2f350a[_0x8488('0x27')],_0x503b83=_0x2f350a[_0x8488('0x27')]+_0x2f350a[_0x8488('0x28')],_0x1b0519;if(_0x503b83>=_0x6ebee0){_0x503b83=_0x6ebee0;_0x1b0519=0xc8;}else{_0x1b0519=0xce;}_0x26bdbb[_0x8488('0x29')](_0x1b0519);return _0x26bdbb[_0x8488('0x2a')](_0x8488('0x2b'),_0x287662+'-'+_0x503b83+'/'+_0x6ebee0)[_0x8488('0x2c')](_0x2b3c97);}return null;};}function patchUpdates(_0x1d9317){return function(_0x888b24){try{jsonpatch['apply'](_0x888b24,_0x1d9317,!![]);}catch(_0x57ce3c){return BPromise['reject'](_0x57ce3c);}return _0x888b24[_0x8488('0x2d')]();};}function saveUpdates(_0x408c36,_0x19cf42){return function(_0x121dcc){if(_0x121dcc){return _0x121dcc[_0x8488('0x2e')](_0x408c36)[_0x8488('0x1a')](function(_0x4d3a03){return _0x4d3a03;});}return null;};}function removeEntity(_0x2292e0,_0x14f378){return function(_0x208753){if(_0x208753){return _0x208753[_0x8488('0x2f')]()[_0x8488('0x1a')](function(){_0x2292e0['status'](0xcc)[_0x8488('0x30')]();});}};}function handleEntityNotFound(_0x23f67a,_0x579d50){return function(_0x1b0637){if(!_0x1b0637){_0x23f67a[_0x8488('0x25')](0x194);}return _0x1b0637;};}function handleError(_0x4d3ed2,_0x446f90){_0x446f90=_0x446f90||0x1f4;return function(_0x4555d0){logger['error'](_0x4555d0[_0x8488('0x31')]);if(_0x4555d0[_0x8488('0x32')]){delete _0x4555d0[_0x8488('0x32')];}_0x4d3ed2['status'](_0x446f90)[_0x8488('0x33')](_0x4555d0);};}exports['index']=function(_0x205ccc,_0x2ac9f9){var _0x3ce30b={},_0x16b0cd={},_0x4c3b59={'count':0x0,'rows':[]};var _0x1bb256=db[_0x8488('0x34')][_0x8488('0x35')];_0x16b0cd['model']=_[_0x8488('0x36')](_0x1bb256);_0x16b0cd[_0x8488('0x37')]=_[_0x8488('0x36')](_0x205ccc[_0x8488('0x37')]);_0x16b0cd[_0x8488('0x38')]=_[_0x8488('0x39')](_0x16b0cd[_0x8488('0x3a')],_0x16b0cd[_0x8488('0x37')]);_0x3ce30b[_0x8488('0x3b')]=_[_0x8488('0x39')](_0x16b0cd[_0x8488('0x3a')],qs['fields'](_0x205ccc['query'][_0x8488('0x3c')]));_0x3ce30b[_0x8488('0x3b')]=_0x3ce30b[_0x8488('0x3b')][_0x8488('0x3d')]?_0x3ce30b[_0x8488('0x3b')]:_0x16b0cd[_0x8488('0x3a')];if(!_0x205ccc[_0x8488('0x37')][_0x8488('0x3e')](_0x8488('0x3f'))){_0x3ce30b['limit']=qs[_0x8488('0x28')](_0x205ccc[_0x8488('0x37')][_0x8488('0x28')]);_0x3ce30b['offset']=qs[_0x8488('0x27')](_0x205ccc[_0x8488('0x37')][_0x8488('0x27')]);}_0x3ce30b[_0x8488('0x40')]=qs[_0x8488('0x41')](_0x205ccc[_0x8488('0x37')][_0x8488('0x41')]);_0x3ce30b['where']=qs[_0x8488('0x38')](_[_0x8488('0x42')](_0x205ccc[_0x8488('0x37')],_0x16b0cd['filters']));if(_0x205ccc[_0x8488('0x37')]['filter']){_0x3ce30b[_0x8488('0x43')]=_[_0x8488('0x44')](_0x3ce30b['where'],{'$or':_[_0x8488('0x45')](_0x1bb256,function(_0x4023ac){if(_0x4023ac[_0x8488('0x46')][_0x8488('0x47')]!==_0x8488('0x48')){var _0x4e5c83={};_0x4e5c83[_0x4023ac[_0x8488('0x49')]]={'$like':'%'+_0x205ccc['query'][_0x8488('0x4a')]+'%'};return _0x4e5c83;}})});}_0x3ce30b=_[_0x8488('0x44')]({},_0x3ce30b,_0x205ccc[_0x8488('0x4b')]);var _0x22e75d={'where':_0x3ce30b[_0x8488('0x43')]};return db[_0x8488('0x34')][_0x8488('0x26')](_0x22e75d)[_0x8488('0x1a')](function(_0xfe2e8f){_0x4c3b59[_0x8488('0x26')]=_0xfe2e8f;if(_0x205ccc[_0x8488('0x37')][_0x8488('0x4c')]){_0x3ce30b[_0x8488('0x4d')]=[{'all':!![]}];}return db[_0x8488('0x34')][_0x8488('0x4e')](_0x3ce30b);})[_0x8488('0x1a')](function(_0x2dd4c8){_0x4c3b59['rows']=_0x2dd4c8;return _0x4c3b59;})[_0x8488('0x1a')](respondWithFilteredResult(_0x2ac9f9,_0x3ce30b))[_0x8488('0x24')](handleError(_0x2ac9f9,null));};exports[_0x8488('0x4f')]=function(_0x206fd2,_0x5067fa){var _0x44e74f={'raw':![],'where':{'id':_0x206fd2[_0x8488('0x50')]['id']}},_0x1cd80d={};_0x1cd80d[_0x8488('0x3a')]=_['keys'](db[_0x8488('0x34')][_0x8488('0x35')]);_0x1cd80d[_0x8488('0x37')]=_[_0x8488('0x36')](_0x206fd2[_0x8488('0x37')]);_0x1cd80d[_0x8488('0x38')]=_[_0x8488('0x39')](_0x1cd80d[_0x8488('0x3a')],_0x1cd80d[_0x8488('0x37')]);_0x44e74f[_0x8488('0x3b')]=_[_0x8488('0x39')](_0x1cd80d[_0x8488('0x3a')],qs[_0x8488('0x3c')](_0x206fd2['query']['fields']));_0x44e74f[_0x8488('0x3b')]=_0x44e74f[_0x8488('0x3b')][_0x8488('0x3d')]?_0x44e74f[_0x8488('0x3b')]:_0x1cd80d[_0x8488('0x3a')];if(_0x206fd2[_0x8488('0x37')][_0x8488('0x4c')]){_0x44e74f[_0x8488('0x4d')]=[{'all':!![]}];}_0x44e74f=_[_0x8488('0x44')]({},_0x44e74f,_0x206fd2['options']);return db[_0x8488('0x34')][_0x8488('0x51')](_0x44e74f)['then'](handleEntityNotFound(_0x5067fa,null))[_0x8488('0x1a')](respondWithResult(_0x5067fa,null))[_0x8488('0x24')](handleError(_0x5067fa,null));};exports[_0x8488('0x52')]=function(_0x1ff9c5,_0x4f80fb){return db[_0x8488('0x34')][_0x8488('0x52')](_0x1ff9c5[_0x8488('0x53')],{})['then'](respondWithResult(_0x4f80fb,0xc9))[_0x8488('0x24')](handleError(_0x4f80fb,null));};exports[_0x8488('0x2e')]=function(_0x1bed0e,_0x3eb06e){if(_0x1bed0e['body']['id']){delete _0x1bed0e[_0x8488('0x53')]['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x1bed0e[_0x8488('0x50')]['id']}})['then'](handleEntityNotFound(_0x3eb06e,null))[_0x8488('0x1a')](saveUpdates(_0x1bed0e[_0x8488('0x53')],null))[_0x8488('0x1a')](respondWithResult(_0x3eb06e,null))[_0x8488('0x24')](handleError(_0x3eb06e,null));};exports[_0x8488('0x2f')]=function(_0x362b00,_0x4d0902){return db[_0x8488('0x34')][_0x8488('0x51')]({'where':{'id':_0x362b00[_0x8488('0x50')]['id']}})[_0x8488('0x1a')](handleEntityNotFound(_0x4d0902,null))[_0x8488('0x1a')](removeEntity(_0x4d0902,null))['catch'](handleError(_0x4d0902,null));};exports[_0x8488('0x54')]=function(_0x5a04d7,_0x137f50,_0x4f617c){var _0x5da71e={};var _0x342188={};var _0x4382ad;var _0x304ceb;return db[_0x8488('0x34')][_0x8488('0x55')]({'where':{'id':_0x5a04d7[_0x8488('0x50')]['id']}})['then'](handleEntityNotFound(_0x137f50,null))[_0x8488('0x1a')](function(_0x568da7){if(_0x568da7){_0x4382ad=_0x568da7;_0x342188[_0x8488('0x3a')]=_[_0x8488('0x36')](db[_0x8488('0x56')][_0x8488('0x35')]);_0x342188[_0x8488('0x37')]=_[_0x8488('0x36')](_0x5a04d7['query']);_0x342188[_0x8488('0x38')]=_['intersection'](_0x342188[_0x8488('0x3a')],_0x342188[_0x8488('0x37')]);_0x5da71e[_0x8488('0x3b')]=_[_0x8488('0x39')](_0x342188[_0x8488('0x3a')],qs[_0x8488('0x3c')](_0x5a04d7['query']['fields']));_0x5da71e['attributes']=_0x5da71e[_0x8488('0x3b')][_0x8488('0x3d')]?_0x5da71e[_0x8488('0x3b')]:_0x342188[_0x8488('0x3a')];_0x5da71e[_0x8488('0x40')]=qs[_0x8488('0x41')](_0x5a04d7[_0x8488('0x37')][_0x8488('0x41')]);_0x5da71e[_0x8488('0x43')]=qs[_0x8488('0x38')](_['pick'](_0x5a04d7[_0x8488('0x37')],_0x342188[_0x8488('0x38')]));if(_0x5a04d7[_0x8488('0x37')]['filter']){_0x5da71e['where']=_[_0x8488('0x44')](_0x5da71e[_0x8488('0x43')],{'$or':_[_0x8488('0x45')](_0x5da71e[_0x8488('0x3b')],function(_0x52bc90){var _0x4b7475={};_0x4b7475[_0x52bc90]={'$like':'%'+_0x5a04d7[_0x8488('0x37')][_0x8488('0x4a')]+'%'};return _0x4b7475;})});}_0x5da71e=_[_0x8488('0x44')]({},_0x5da71e,_0x5a04d7['options']);return _0x4382ad[_0x8488('0x54')](_0x5da71e);}})[_0x8488('0x1a')](function(_0x17149f){if(_0x17149f){_0x304ceb=_0x17149f[_0x8488('0x3d')];if(!_0x5a04d7[_0x8488('0x37')]['hasOwnProperty'](_0x8488('0x3f'))){_0x5da71e[_0x8488('0x28')]=qs['limit'](_0x5a04d7[_0x8488('0x37')][_0x8488('0x28')]);_0x5da71e['offset']=qs[_0x8488('0x27')](_0x5a04d7[_0x8488('0x37')][_0x8488('0x27')]);}return _0x4382ad[_0x8488('0x54')](_0x5da71e);}})[_0x8488('0x1a')](function(_0x105f23){if(_0x105f23){return _0x105f23?{'count':_0x304ceb,'rows':_0x105f23}:null;}})[_0x8488('0x1a')](respondWithResult(_0x137f50,null))['catch'](handleError(_0x137f50,null));};exports[_0x8488('0x57')]=function(_0x3b7aa8,_0x480666,_0x49ef10){if(_0x3b7aa8[_0x8488('0x53')]['id']){delete _0x3b7aa8[_0x8488('0x53')]['id'];}return db[_0x8488('0x34')]['findOne']({'where':{'id':_0x3b7aa8[_0x8488('0x50')]['id']}})[_0x8488('0x1a')](handleEntityNotFound(_0x480666,null))['then'](function(_0x42b5c5){if(_0x42b5c5){_0x3b7aa8['body'][_0x8488('0x58')]=_0x42b5c5['id'];_0x3b7aa8[_0x8488('0x53')][_0x8488('0x59')]=integrations['getSubjects'](_0x3b7aa8[_0x8488('0x53')][_0x8488('0x5a')],_0x3b7aa8['body']['type']);_0x3b7aa8[_0x8488('0x53')][_0x8488('0x5b')]=integrations[_0x8488('0x5c')](_0x3b7aa8[_0x8488('0x53')][_0x8488('0x5a')],_0x3b7aa8[_0x8488('0x53')][_0x8488('0x46')]);return db[_0x8488('0x56')][_0x8488('0x52')](_0x3b7aa8[_0x8488('0x53')],{'include':[{'model':db['ServicenowField'],'as':_0x8488('0x59')},{'model':db['ServicenowField'],'as':_0x8488('0x5b')}]});}return null;})[_0x8488('0x1a')](respondWithResult(_0x480666,null))[_0x8488('0x24')](handleError(_0x480666,null));};exports[_0x8488('0x5d')]=function(_0x54283a,_0x1b96c5,_0x15ee3a){var _0x5a48d4=[_0x8488('0x5e'),'hold_reason',_0x8488('0x5f'),_0x8488('0x60'),_0x8488('0x61'),_0x8488('0x62'),_0x8488('0x63'),_0x8488('0x64'),_0x8488('0x65')];var _0x452131=['parent',_0x8488('0x5e'),'caused_by','watch_list',_0x8488('0x66'),_0x8488('0x67'),_0x8488('0x68'),'hold_reason','approval_history',_0x8488('0x69'),_0x8488('0x6a'),'sys_updated_by',_0x8488('0x6b'),_0x8488('0x6c'),_0x8488('0x6d'),_0x8488('0x6e'),_0x8488('0x6f'),_0x8488('0x70'),'knowledge',_0x8488('0x40'),_0x8488('0x71'),_0x8488('0x72'),'cmdb_ci',_0x8488('0x73'),_0x8488('0x74'),_0x8488('0x75'),'work_notes_list',_0x8488('0x76'),_0x8488('0x77'),'sys_domain_path','rfc',_0x8488('0x78'),_0x8488('0x79'),'opened_at',_0x8488('0x7a'),_0x8488('0x7b'),'work_end','reopened_time',_0x8488('0x7c'),'caller_id',_0x8488('0x7d'),_0x8488('0x60'),_0x8488('0x7e'),_0x8488('0x7f'),'close_code',_0x8488('0x80'),'delivery_task',_0x8488('0x81'),'assignment_group',_0x8488('0x82'),_0x8488('0x83'),_0x8488('0x84'),_0x8488('0x85'),_0x8488('0x62'),_0x8488('0x86'),_0x8488('0x87'),_0x8488('0x88'),_0x8488('0x89'),_0x8488('0x8a'),_0x8488('0x8b'),_0x8488('0x8c'),_0x8488('0x8d'),_0x8488('0x63'),'urgency',_0x8488('0x8e'),_0x8488('0x8f'),'reassignment_count',_0x8488('0x90'),_0x8488('0x91'),_0x8488('0x64'),_0x8488('0x92'),_0x8488('0x93'),_0x8488('0x94'),_0x8488('0x95'),_0x8488('0x96'),_0x8488('0x97'),_0x8488('0x98'),_0x8488('0x99'),'escalation',_0x8488('0x9a'),_0x8488('0x9b'),'location',_0x8488('0x65')];var _0x7426b2='';var _0x76c3c='';var _0x1099ae=[];var _0x2df32b='';var _0x5b19b9='';var _0x57949a=[];var _0x31138c='';var _0x4686d8='';var _0x21246e={};var _0x244a2b='';return db[_0x8488('0x34')][_0x8488('0x55')]({'where':{'id':_0x54283a[_0x8488('0x50')]['id']},'attributes':['id',_0x8488('0x9c'),_0x8488('0x9d'),_0x8488('0x9e'),_0x8488('0x9f'),_0x8488('0xa0')]})[_0x8488('0x1a')](handleEntityNotFound(_0x1b96c5,null))[_0x8488('0x1a')](function(_0x315354){if(_0x315354){_0x244a2b=_0x315354['remoteUri'];var _0x8695e5=_0x244a2b['slice'](-0x1);if(_0x8695e5==='/'){_0x244a2b=_0x244a2b['substring'](0x0,_0x244a2b[_0x8488('0xa1')](_0x8695e5));}_0x4686d8=util[_0x8488('0xa2')](_0x8488('0xa3'),_0x244a2b);_0x31138c=util[_0x8488('0xa2')](_0x8488('0xa4'),_0x244a2b);_0x21246e={'user':_0x315354[_0x8488('0x9c')],'pass':_0x315354[_0x8488('0x9d')]};var _0x366eab={'method':_0x8488('0xa5'),'uri':_0x4686d8+_0x8488('0xa6'),'auth':_0x21246e,'json':!![]};return rp(_0x366eab);}})['then'](function(_0x450e3b){if(_0x450e3b[_0x8488('0x23')][_0x8488('0x3d')]>0x0){_0x7426b2=_0x450e3b[_0x8488('0x23')];}console[_0x8488('0xa7')](_0x8488('0xa8'),_0x7426b2);_0x57949a=[];_0x76c3c=Object['assign']([],_0x7426b2);_[_0x8488('0xa9')](_0x76c3c,function(_0x5b0d69){return!_0x5a48d4[_0x8488('0xaa')](_0x5b0d69[_0x8488('0x32')]);});_0x76c3c['forEach'](function(_0x57a4e7){var _0x375bd4=createFieldObject(_0x31138c,_0x21246e,_0x57a4e7[_0x8488('0xab')],_0x57a4e7[_0x8488('0x32')],_0x57a4e7[_0x8488('0xac')],![]);_0x57949a[_0x8488('0xad')](_0x375bd4);});return Promise['all'](_0x57949a);})[_0x8488('0x1a')](function(_0x19c5c6){_0x1099ae=_0x19c5c6;_0x2df32b=Object['assign']([],_0x7426b2);console['log'](_0x8488('0xae'),_0x7426b2);_[_0x8488('0xa9')](_0x2df32b,function(_0x11a7e3){return _0x452131['includes'](_0x11a7e3['name']);});console[_0x8488('0xa7')](_0x8488('0xaf'),_0x2df32b);_0x57949a=[];_0x2df32b[_0x8488('0xb0')](function(_0x57e71a){var _0x337d0f=createFieldObject(_0x31138c,_0x21246e,_0x57e71a[_0x8488('0xab')],_0x57e71a[_0x8488('0x32')],_0x57e71a[_0x8488('0xac')],!![]);_0x57949a[_0x8488('0xad')](_0x337d0f);});return Promise[_0x8488('0xb1')](_0x57949a);})[_0x8488('0x1a')](function(_0x1c8f5d){_0x5b19b9=_0x1c8f5d;var _0x17e07b=_0x1099ae[_0x8488('0xb2')](_0x5b19b9);return{'count':_0x17e07b[_0x8488('0x3d')],'rows':_0x17e07b};})[_0x8488('0x1a')](respondWithResult(_0x1b96c5,null))[_0x8488('0x24')](function(_0x591a58){console[_0x8488('0xa7')](_0x8488('0xb3')+_0x591a58);var _0x248175=_0x54283a['query'][_0x8488('0xb4')]?0x1f4:_0x591a58['statusCode']||0x1f4;logger[_0x8488('0x20')](_0x591a58['stack']);delete _0x591a58['name'];if(_0x248175===0x191){_0x248175=0x190;}_0x1b96c5[_0x8488('0x29')](_0x248175)['send'](_0x54283a[_0x8488('0x37')][_0x8488('0xb4')]?{'message':_0x8488('0xb5'),'statusCode':_0x591a58[_0x8488('0xb6')]}:_0x591a58);});};function createFieldObject(_0x512c90,_0x391e86,_0x450afa,_0x477a86,_0x37ca73,_0x5a22f9){return new Promise(function(_0x242b57,_0x432bce){var _0x279096={'id':_0x477a86,'name':_0x37ca73,'custom':_0x5a22f9};if(_0x450afa===_0x8488('0xb7')){_0x279096[_0x8488('0x4b')]=[{'name':'True','value':'true'},{'name':_0x8488('0xb8'),'value':_0x8488('0xb9')}];_0x242b57(_0x279096);}else{var _0x42e1c0={'method':_0x8488('0xa5'),'uri':_0x512c90+_0x8488('0xba')+_0x477a86,'auth':_0x391e86,'json':!![]};return rp(_0x42e1c0)['then'](function(_0x4806f8){var _0x5aedd6=[];if(_0x4806f8[_0x8488('0x23')][_0x8488('0x3d')]>0x0){_0x4806f8[_0x8488('0x23')]['forEach'](function(_0x30aab3){if(_0x30aab3[_0x8488('0xbb')]==='false'){var _0x392818={'name':_0x30aab3[_0x8488('0xac')],'value':_0x30aab3[_0x8488('0xbc')]};_0x5aedd6[_0x8488('0xad')](_0x392818);}});}_0x279096[_0x8488('0x4b')]=_0x5aedd6;if(_0x279096[_0x8488('0x4b')][_0x8488('0x3d')]>0x0){_0x242b57(_0x279096);}else{if(_0x5a22f9==![]){_0x242b57();}else{_0x242b57(_0x279096);}}});}});} \ No newline at end of file +var _0x32b6=['findOne','ServicenowConfiguration','order','addConfiguration','Subjects','Descriptions','getDescriptions','ServicenowField','subcategory','notify','incident_state','severity','category','parent','made_sla','caused_by','watch_list','upon_reject','hold_reason','number','resolved_by','sys_updated_by','opened_by','sys_created_on','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','group_list','work_end','caller_id','work_notes','close_code','delivery_task','assignment_group','business_stc','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','reopened_by','urgency','problem_id','company','reassignment_count','assigned_to','comments','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','escalation','correlation_id','location','username','password','email','remoteUri','slice','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','test','Wrong\x20credentials','True','true','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','ServicenowAccount','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','type','key','VIRTUAL','options','include','findAll','rows','params','find','create','body','getConfigurations'];(function(_0x39479f,_0x822ae4){var _0x4a6d96=function(_0x55bfba){while(--_0x55bfba){_0x39479f['push'](_0x39479f['shift']());}};_0x4a6d96(++_0x822ae4);}(_0x32b6,0x1d1));var _0x632b=function(_0x58c507,_0xd072ff){_0x58c507=_0x58c507-0x0;var _0x54d893=_0x32b6[_0x58c507];return _0x54d893;};'use strict';var pdf=require(_0x632b('0x0'));var emlformat=require(_0x632b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x632b('0x2'));var jsonpatch=require(_0x632b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x632b('0x4'));var Mustache=require(_0x632b('0x5'));var util=require(_0x632b('0x6'));var path=require(_0x632b('0x7'));var sox=require(_0x632b('0x8'));var csv=require(_0x632b('0x9'));var ejs=require(_0x632b('0xa'));var fs=require('fs');var _=require(_0x632b('0xb'));var squel=require(_0x632b('0xc'));var crypto=require(_0x632b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x632b('0xe'));var toCsv=require(_0x632b('0x9'));var querystring=require(_0x632b('0xf'));var Papa=require(_0x632b('0x10'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0x632b('0x11'));var logger=require('../../config/logger')(_0x632b('0x12'));var utils=require(_0x632b('0x13'));var config=require(_0x632b('0x14'));var db=require(_0x632b('0x15'))['db'];var integrations=require(_0x632b('0x16'));var jayson=require(_0x632b('0x17'));var client=jayson[_0x632b('0x18')][_0x632b('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x22c182,_0x536aa2,_0xb5416c,_0x286f75){return new BPromise(function(_0x9246a6,_0x5a97da){var _0x721883=_0x286f75||client;return _0x721883[_0x632b('0x1a')](_0x22c182,_0xb5416c)[_0x632b('0x1b')](function(_0x17ff9b){logger[_0x632b('0x1c')](_0x632b('0x1d'),_0x536aa2,'request\x20sent');logger[_0x632b('0x1e')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x536aa2,'request\x20sent',JSON[_0x632b('0x1f')](_0x17ff9b));if(_0x17ff9b['error']){if(_0x17ff9b[_0x632b('0x20')][_0x632b('0x21')]===0x1f4){logger[_0x632b('0x20')]('ServicenowAccount,\x20%s,\x20%s',_0x536aa2,_0x17ff9b[_0x632b('0x20')][_0x632b('0x22')]);return _0x5a97da(_0x17ff9b[_0x632b('0x20')][_0x632b('0x22')]);}logger['error'](_0x632b('0x1d'),_0x536aa2,_0x17ff9b[_0x632b('0x20')]['message']);return _0x9246a6(_0x17ff9b[_0x632b('0x20')]['message']);}else{logger['info'](_0x632b('0x1d'),_0x536aa2,'request\x20sent');_0x9246a6(_0x17ff9b[_0x632b('0x23')][_0x632b('0x22')]);}})[_0x632b('0x24')](function(_0x540bfb){logger[_0x632b('0x20')](_0x632b('0x1d'),_0x536aa2,_0x540bfb);_0x5a97da(_0x540bfb);});});}function respondWithStatusCode(_0x59d83a,_0x1db8f5){_0x1db8f5=_0x1db8f5||0xcc;return function(_0x379dc2){if(_0x379dc2){return _0x59d83a[_0x632b('0x25')](_0x1db8f5);}return _0x59d83a[_0x632b('0x26')](_0x1db8f5)[_0x632b('0x27')]();};}function respondWithResult(_0x183c5c,_0x5ec5ea){_0x5ec5ea=_0x5ec5ea||0xc8;return function(_0x5e7b20){if(_0x5e7b20){return _0x183c5c[_0x632b('0x26')](_0x5ec5ea)['json'](_0x5e7b20);}};}function respondWithFilteredResult(_0x4ebd26,_0x954fa0){return function(_0x5d6855){if(_0x5d6855){var _0x273e89=_0x5d6855[_0x632b('0x28')],_0x3f4eab=_0x954fa0[_0x632b('0x29')],_0x29d9aa=_0x954fa0[_0x632b('0x29')]+_0x954fa0[_0x632b('0x2a')],_0x18dc8c;if(_0x29d9aa>=_0x273e89){_0x29d9aa=_0x273e89;_0x18dc8c=0xc8;}else{_0x18dc8c=0xce;}_0x4ebd26[_0x632b('0x26')](_0x18dc8c);return _0x4ebd26['set'](_0x632b('0x2b'),_0x3f4eab+'-'+_0x29d9aa+'/'+_0x273e89)[_0x632b('0x2c')](_0x5d6855);}return null;};}function patchUpdates(_0x1819fa){return function(_0x3999aa){try{jsonpatch[_0x632b('0x2d')](_0x3999aa,_0x1819fa,!![]);}catch(_0x2a34fa){return BPromise[_0x632b('0x2e')](_0x2a34fa);}return _0x3999aa[_0x632b('0x2f')]();};}function saveUpdates(_0x1ace1b,_0x319df3){return function(_0x417793){if(_0x417793){return _0x417793[_0x632b('0x30')](_0x1ace1b)[_0x632b('0x1b')](function(_0x2e07e4){return _0x2e07e4;});}return null;};}function removeEntity(_0x227497,_0x3dff99){return function(_0x18efab){if(_0x18efab){return _0x18efab[_0x632b('0x31')]()[_0x632b('0x1b')](function(){_0x227497[_0x632b('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fc0f9,_0x4401dc){return function(_0x397f36){if(!_0x397f36){_0x1fc0f9[_0x632b('0x25')](0x194);}return _0x397f36;};}function handleError(_0x5857e4,_0x387677){_0x387677=_0x387677||0x1f4;return function(_0x4ebef2){logger[_0x632b('0x20')](_0x4ebef2[_0x632b('0x32')]);if(_0x4ebef2['name']){delete _0x4ebef2[_0x632b('0x33')];}_0x5857e4[_0x632b('0x26')](_0x387677)[_0x632b('0x34')](_0x4ebef2);};}exports[_0x632b('0x35')]=function(_0x27bbf5,_0x2a7998){var _0x1a7773={},_0x300b60={},_0x4d374f={'count':0x0,'rows':[]};var _0x5b2c41=db[_0x632b('0x36')][_0x632b('0x37')];_0x300b60[_0x632b('0x38')]=_[_0x632b('0x39')](_0x5b2c41);_0x300b60[_0x632b('0x3a')]=_[_0x632b('0x39')](_0x27bbf5[_0x632b('0x3a')]);_0x300b60[_0x632b('0x3b')]=_['intersection'](_0x300b60['model'],_0x300b60[_0x632b('0x3a')]);_0x1a7773['attributes']=_[_0x632b('0x3c')](_0x300b60[_0x632b('0x38')],qs[_0x632b('0x3d')](_0x27bbf5[_0x632b('0x3a')][_0x632b('0x3d')]));_0x1a7773[_0x632b('0x3e')]=_0x1a7773[_0x632b('0x3e')][_0x632b('0x3f')]?_0x1a7773[_0x632b('0x3e')]:_0x300b60[_0x632b('0x38')];if(!_0x27bbf5[_0x632b('0x3a')][_0x632b('0x40')](_0x632b('0x41'))){_0x1a7773[_0x632b('0x2a')]=qs[_0x632b('0x2a')](_0x27bbf5[_0x632b('0x3a')][_0x632b('0x2a')]);_0x1a7773['offset']=qs['offset'](_0x27bbf5['query']['offset']);}_0x1a7773['order']=qs[_0x632b('0x42')](_0x27bbf5['query']['sort']);_0x1a7773['where']=qs[_0x632b('0x3b')](_[_0x632b('0x43')](_0x27bbf5[_0x632b('0x3a')],_0x300b60[_0x632b('0x3b')]));if(_0x27bbf5['query'][_0x632b('0x44')]){_0x1a7773[_0x632b('0x45')]=_[_0x632b('0x46')](_0x1a7773['where'],{'$or':_[_0x632b('0x47')](_0x5b2c41,function(_0x32fcc8){if(_0x32fcc8[_0x632b('0x48')][_0x632b('0x49')]!==_0x632b('0x4a')){var _0xd006b4={};_0xd006b4[_0x32fcc8['field']]={'$like':'%'+_0x27bbf5[_0x632b('0x3a')][_0x632b('0x44')]+'%'};return _0xd006b4;}})});}_0x1a7773=_[_0x632b('0x46')]({},_0x1a7773,_0x27bbf5[_0x632b('0x4b')]);var _0x520e31={'where':_0x1a7773['where']};return db[_0x632b('0x36')][_0x632b('0x28')](_0x520e31)[_0x632b('0x1b')](function(_0x3566e7){_0x4d374f[_0x632b('0x28')]=_0x3566e7;if(_0x27bbf5[_0x632b('0x3a')]['includeAll']){_0x1a7773[_0x632b('0x4c')]=[{'all':!![]}];}return db[_0x632b('0x36')][_0x632b('0x4d')](_0x1a7773);})[_0x632b('0x1b')](function(_0x2306b1){_0x4d374f[_0x632b('0x4e')]=_0x2306b1;return _0x4d374f;})[_0x632b('0x1b')](respondWithFilteredResult(_0x2a7998,_0x1a7773))[_0x632b('0x24')](handleError(_0x2a7998,null));};exports['show']=function(_0x876a33,_0x56f254){var _0x2a1f09={'raw':![],'where':{'id':_0x876a33[_0x632b('0x4f')]['id']}},_0x55e1f6={};_0x55e1f6[_0x632b('0x38')]=_[_0x632b('0x39')](db[_0x632b('0x36')][_0x632b('0x37')]);_0x55e1f6['query']=_[_0x632b('0x39')](_0x876a33[_0x632b('0x3a')]);_0x55e1f6[_0x632b('0x3b')]=_['intersection'](_0x55e1f6[_0x632b('0x38')],_0x55e1f6[_0x632b('0x3a')]);_0x2a1f09[_0x632b('0x3e')]=_[_0x632b('0x3c')](_0x55e1f6[_0x632b('0x38')],qs['fields'](_0x876a33[_0x632b('0x3a')]['fields']));_0x2a1f09[_0x632b('0x3e')]=_0x2a1f09[_0x632b('0x3e')][_0x632b('0x3f')]?_0x2a1f09[_0x632b('0x3e')]:_0x55e1f6[_0x632b('0x38')];if(_0x876a33['query']['includeAll']){_0x2a1f09[_0x632b('0x4c')]=[{'all':!![]}];}_0x2a1f09=_[_0x632b('0x46')]({},_0x2a1f09,_0x876a33[_0x632b('0x4b')]);return db[_0x632b('0x36')][_0x632b('0x50')](_0x2a1f09)[_0x632b('0x1b')](handleEntityNotFound(_0x56f254,null))['then'](respondWithResult(_0x56f254,null))[_0x632b('0x24')](handleError(_0x56f254,null));};exports[_0x632b('0x51')]=function(_0x3ff81c,_0x4dc021){return db[_0x632b('0x36')][_0x632b('0x51')](_0x3ff81c[_0x632b('0x52')],{})[_0x632b('0x1b')](respondWithResult(_0x4dc021,0xc9))['catch'](handleError(_0x4dc021,null));};exports[_0x632b('0x30')]=function(_0x20890c,_0x1f4129){if(_0x20890c[_0x632b('0x52')]['id']){delete _0x20890c[_0x632b('0x52')]['id'];}return db['ServicenowAccount'][_0x632b('0x50')]({'where':{'id':_0x20890c[_0x632b('0x4f')]['id']}})[_0x632b('0x1b')](handleEntityNotFound(_0x1f4129,null))[_0x632b('0x1b')](saveUpdates(_0x20890c[_0x632b('0x52')],null))['then'](respondWithResult(_0x1f4129,null))[_0x632b('0x24')](handleError(_0x1f4129,null));};exports[_0x632b('0x31')]=function(_0xcc0a9b,_0x360516){return db[_0x632b('0x36')][_0x632b('0x50')]({'where':{'id':_0xcc0a9b[_0x632b('0x4f')]['id']}})[_0x632b('0x1b')](handleEntityNotFound(_0x360516,null))[_0x632b('0x1b')](removeEntity(_0x360516,null))[_0x632b('0x24')](handleError(_0x360516,null));};exports[_0x632b('0x53')]=function(_0x5ca000,_0x10f174,_0x1d2edc){var _0xe85c2f={};var _0x3532c7={};var _0x2b767a;var _0x5aa669;return db[_0x632b('0x36')][_0x632b('0x54')]({'where':{'id':_0x5ca000[_0x632b('0x4f')]['id']}})[_0x632b('0x1b')](handleEntityNotFound(_0x10f174,null))[_0x632b('0x1b')](function(_0xe7274a){if(_0xe7274a){_0x2b767a=_0xe7274a;_0x3532c7[_0x632b('0x38')]=_['keys'](db[_0x632b('0x55')]['rawAttributes']);_0x3532c7[_0x632b('0x3a')]=_['keys'](_0x5ca000[_0x632b('0x3a')]);_0x3532c7['filters']=_[_0x632b('0x3c')](_0x3532c7[_0x632b('0x38')],_0x3532c7['query']);_0xe85c2f['attributes']=_[_0x632b('0x3c')](_0x3532c7[_0x632b('0x38')],qs[_0x632b('0x3d')](_0x5ca000[_0x632b('0x3a')]['fields']));_0xe85c2f[_0x632b('0x3e')]=_0xe85c2f[_0x632b('0x3e')]['length']?_0xe85c2f[_0x632b('0x3e')]:_0x3532c7['model'];_0xe85c2f[_0x632b('0x56')]=qs[_0x632b('0x42')](_0x5ca000['query'][_0x632b('0x42')]);_0xe85c2f[_0x632b('0x45')]=qs[_0x632b('0x3b')](_[_0x632b('0x43')](_0x5ca000['query'],_0x3532c7[_0x632b('0x3b')]));if(_0x5ca000[_0x632b('0x3a')][_0x632b('0x44')]){_0xe85c2f[_0x632b('0x45')]=_['merge'](_0xe85c2f[_0x632b('0x45')],{'$or':_[_0x632b('0x47')](_0xe85c2f[_0x632b('0x3e')],function(_0x3fd888){var _0x35bbcd={};_0x35bbcd[_0x3fd888]={'$like':'%'+_0x5ca000[_0x632b('0x3a')]['filter']+'%'};return _0x35bbcd;})});}_0xe85c2f=_[_0x632b('0x46')]({},_0xe85c2f,_0x5ca000[_0x632b('0x4b')]);return _0x2b767a[_0x632b('0x53')](_0xe85c2f);}})['then'](function(_0x518fa7){if(_0x518fa7){_0x5aa669=_0x518fa7[_0x632b('0x3f')];if(!_0x5ca000[_0x632b('0x3a')][_0x632b('0x40')](_0x632b('0x41'))){_0xe85c2f[_0x632b('0x2a')]=qs[_0x632b('0x2a')](_0x5ca000[_0x632b('0x3a')]['limit']);_0xe85c2f[_0x632b('0x29')]=qs[_0x632b('0x29')](_0x5ca000[_0x632b('0x3a')][_0x632b('0x29')]);}return _0x2b767a[_0x632b('0x53')](_0xe85c2f);}})[_0x632b('0x1b')](function(_0x4ff12e){if(_0x4ff12e){return _0x4ff12e?{'count':_0x5aa669,'rows':_0x4ff12e}:null;}})[_0x632b('0x1b')](respondWithResult(_0x10f174,null))[_0x632b('0x24')](handleError(_0x10f174,null));};exports[_0x632b('0x57')]=function(_0x14b55f,_0x51cb45,_0x3a3f80){if(_0x14b55f[_0x632b('0x52')]['id']){delete _0x14b55f[_0x632b('0x52')]['id'];}return db['ServicenowAccount'][_0x632b('0x54')]({'where':{'id':_0x14b55f[_0x632b('0x4f')]['id']}})[_0x632b('0x1b')](handleEntityNotFound(_0x51cb45,null))[_0x632b('0x1b')](function(_0x225d81){if(_0x225d81){_0x14b55f[_0x632b('0x52')]['AccountId']=_0x225d81['id'];_0x14b55f[_0x632b('0x52')][_0x632b('0x58')]=integrations['getSubjects'](_0x14b55f['body']['channel'],_0x14b55f[_0x632b('0x52')][_0x632b('0x48')]);_0x14b55f[_0x632b('0x52')][_0x632b('0x59')]=integrations[_0x632b('0x5a')](_0x14b55f['body']['channel'],_0x14b55f[_0x632b('0x52')][_0x632b('0x48')]);return db['ServicenowConfiguration']['create'](_0x14b55f[_0x632b('0x52')],{'include':[{'model':db[_0x632b('0x5b')],'as':'Subjects'},{'model':db[_0x632b('0x5b')],'as':_0x632b('0x59')}]});}return null;})[_0x632b('0x1b')](respondWithResult(_0x51cb45,null))['catch'](handleError(_0x51cb45,null));};exports['getFields']=function(_0x563cfa,_0x2ff526,_0x1b30b7){var _0xec3044=['made_sla','hold_reason','knowledge',_0x632b('0x5c'),'close_code',_0x632b('0x5d'),_0x632b('0x5e'),_0x632b('0x5f'),_0x632b('0x60')];var _0x68e129=[_0x632b('0x61'),_0x632b('0x62'),_0x632b('0x63'),_0x632b('0x64'),_0x632b('0x65'),'sys_updated_on','child_incidents',_0x632b('0x66'),'approval_history',_0x632b('0x67'),_0x632b('0x68'),_0x632b('0x69'),_0x632b('0x6a'),'user_input',_0x632b('0x6b'),'sys_domain','state','sys_created_by',_0x632b('0x6c'),'order',_0x632b('0x6d'),_0x632b('0x6e'),_0x632b('0x6f'),_0x632b('0x70'),_0x632b('0x71'),'active','work_notes_list',_0x632b('0x72'),_0x632b('0x73'),_0x632b('0x74'),_0x632b('0x75'),_0x632b('0x76'),_0x632b('0x77'),_0x632b('0x78'),'business_duration',_0x632b('0x79'),_0x632b('0x7a'),'reopened_time','resolved_at',_0x632b('0x7b'),'approval_set','subcategory',_0x632b('0x7c'),'short_description',_0x632b('0x7d'),'correlation_display',_0x632b('0x7e'),'work_start',_0x632b('0x7f'),_0x632b('0x80'),'additional_assignee_list',_0x632b('0x81'),_0x632b('0x82'),_0x632b('0x5d'),_0x632b('0x83'),_0x632b('0x84'),_0x632b('0x85'),_0x632b('0x86'),_0x632b('0x87'),'sys_id','contact_type',_0x632b('0x88'),_0x632b('0x5e'),_0x632b('0x89'),_0x632b('0x8a'),_0x632b('0x8b'),_0x632b('0x8c'),'activity_due',_0x632b('0x8d'),'severity',_0x632b('0x8e'),'sla_due',_0x632b('0x8f'),_0x632b('0x90'),_0x632b('0x91'),_0x632b('0x92'),'reopen_count',_0x632b('0x93'),_0x632b('0x94'),'upon_approval',_0x632b('0x95'),_0x632b('0x96'),_0x632b('0x60')];var _0x2a8f82='';var _0x132eac='';var _0x5a541a=[];var _0x32db92='';var _0x988036='';var _0x4b3bfd=[];var _0x386674='';var _0x4cbb13='';var _0x302e75={};var _0x53dc8b='';return db[_0x632b('0x36')]['findOne']({'where':{'id':_0x563cfa[_0x632b('0x4f')]['id']},'attributes':['id',_0x632b('0x97'),_0x632b('0x98'),_0x632b('0x99'),_0x632b('0x9a'),'serverUrl']})[_0x632b('0x1b')](handleEntityNotFound(_0x2ff526,null))[_0x632b('0x1b')](function(_0x58a5fd){if(_0x58a5fd){_0x53dc8b=_0x58a5fd[_0x632b('0x9a')];var _0x525566=_0x53dc8b[_0x632b('0x9b')](-0x1);if(_0x525566==='/'){_0x53dc8b=_0x53dc8b['substring'](0x0,_0x53dc8b[_0x632b('0x9c')](_0x525566));}_0x4cbb13=util['format'](_0x632b('0x9d'),_0x53dc8b);_0x386674=util[_0x632b('0x9e')](_0x632b('0x9f'),_0x53dc8b);_0x302e75={'user':_0x58a5fd['username'],'pass':_0x58a5fd[_0x632b('0x98')]};var _0x4524fe={'method':_0x632b('0xa0'),'uri':_0x4cbb13+_0x632b('0xa1'),'auth':_0x302e75,'json':!![]};return rp(_0x4524fe);}})[_0x632b('0x1b')](function(_0x1838a5){if(_0x1838a5[_0x632b('0x23')][_0x632b('0x3f')]>0x0){_0x2a8f82=_0x1838a5[_0x632b('0x23')];}console[_0x632b('0xa2')](_0x632b('0xa3'),_0x2a8f82);_0x4b3bfd=[];_0x132eac=Object[_0x632b('0xa4')]([],_0x2a8f82);_[_0x632b('0xa5')](_0x132eac,function(_0x55c36d){return!_0xec3044[_0x632b('0xa6')](_0x55c36d[_0x632b('0x33')]);});_0x132eac[_0x632b('0xa7')](function(_0x3293be){var _0x209ed1=createFieldObject(_0x386674,_0x302e75,_0x3293be[_0x632b('0xa8')],_0x3293be[_0x632b('0x33')],_0x3293be[_0x632b('0xa9')],![]);_0x4b3bfd[_0x632b('0xaa')](_0x209ed1);});return Promise[_0x632b('0xab')](_0x4b3bfd);})[_0x632b('0x1b')](function(_0x1fd1a7){_0x5a541a=_0x1fd1a7;_0x32db92=Object['assign']([],_0x2a8f82);console[_0x632b('0xa2')](_0x632b('0xac'),_0x2a8f82);_[_0x632b('0xa5')](_0x32db92,function(_0x46620f){return _0x68e129[_0x632b('0xa6')](_0x46620f[_0x632b('0x33')]);});console[_0x632b('0xa2')](_0x632b('0xad'),_0x32db92);_0x4b3bfd=[];_0x32db92['forEach'](function(_0x33072f){var _0x41bc13=createFieldObject(_0x386674,_0x302e75,_0x33072f[_0x632b('0xa8')],_0x33072f[_0x632b('0x33')],_0x33072f[_0x632b('0xa9')],!![]);_0x4b3bfd[_0x632b('0xaa')](_0x41bc13);});return Promise[_0x632b('0xab')](_0x4b3bfd);})[_0x632b('0x1b')](function(_0x35e00e){_0x988036=_0x35e00e;var _0x5677bd=_0x5a541a[_0x632b('0xae')](_0x988036);return{'count':_0x5677bd[_0x632b('0x3f')],'rows':_0x5677bd};})[_0x632b('0x1b')](respondWithResult(_0x2ff526,null))[_0x632b('0x24')](function(_0x18bb94){console[_0x632b('0xa2')]('ServiceNow\x20error:\x20'+_0x18bb94);var _0x371450=_0x563cfa[_0x632b('0x3a')][_0x632b('0xaf')]?0x1f4:_0x18bb94['statusCode']||0x1f4;logger['error'](_0x18bb94[_0x632b('0x32')]);delete _0x18bb94[_0x632b('0x33')];if(_0x371450===0x191){_0x371450=0x190;}_0x2ff526[_0x632b('0x26')](_0x371450)[_0x632b('0x34')](_0x563cfa[_0x632b('0x3a')][_0x632b('0xaf')]?{'message':_0x632b('0xb0'),'statusCode':_0x18bb94['statusCode']}:_0x18bb94);});};function createFieldObject(_0xd702ae,_0x485515,_0x3bd4d1,_0x4837ae,_0x4d3bb7,_0x6bcc7a){return new Promise(function(_0x151f6a,_0x34e9ac){var _0x508073={'id':_0x4837ae,'name':_0x4d3bb7,'custom':_0x6bcc7a};if(_0x3bd4d1==='boolean'){_0x508073[_0x632b('0x4b')]=[{'name':_0x632b('0xb1'),'value':_0x632b('0xb2')},{'name':'False','value':'false'}];_0x151f6a(_0x508073);}else{var _0x37f06c={'method':_0x632b('0xa0'),'uri':_0xd702ae+_0x632b('0xb3')+_0x4837ae,'auth':_0x485515,'json':!![]};return rp(_0x37f06c)[_0x632b('0x1b')](function(_0x66cbf3){var _0x26a9b6=[];if(_0x66cbf3['result'][_0x632b('0x3f')]>0x0){_0x66cbf3[_0x632b('0x23')][_0x632b('0xa7')](function(_0x32facd){if(_0x32facd[_0x632b('0xb4')]===_0x632b('0xb5')){var _0x5811f4={'name':_0x32facd['label'],'value':_0x32facd[_0x632b('0xb6')]};_0x26a9b6[_0x632b('0xaa')](_0x5811f4);}});}_0x508073['options']=_0x26a9b6;if(_0x508073[_0x632b('0x4b')][_0x632b('0x3f')]>0x0){_0x151f6a(_0x508073);}else{if(_0x6bcc7a==![]){_0x151f6a();}else{_0x151f6a(_0x508073);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 59ff16b..1526b9e 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.model.js +++ b/server/api/intServicenowAccount/intServicenowAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x61a8=['moment','bluebird','request-promise','exports','int_servicenow_accounts','../../config/logger','api'];(function(_0x2132a3,_0x4639e9){var _0x21890c=function(_0x34b73d){while(--_0x34b73d){_0x2132a3['push'](_0x2132a3['shift']());}};_0x21890c(++_0x4639e9);}(_0x61a8,0x1d3));var _0x861a=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0x61a8[_0x4c6d6f];return _0x2d4478;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x861a('0x0'))(_0x861a('0x1'));var moment=require(_0x861a('0x2'));var BPromise=require(_0x861a('0x3'));var rp=require(_0x861a('0x4'));var attributes=require('./intServicenowAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x861a('0x5')]=function(_0x2f1a06,_0x5d117d){return _0x2f1a06['define']('ServicenowAccount',attributes,{'tableName':_0x861a('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44e0=['../../config/logger','api','moment','bluebird','request-promise','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','int_servicenow_accounts'];(function(_0x50f659,_0x506fc1){var _0x400389=function(_0x5199cf){while(--_0x5199cf){_0x50f659['push'](_0x50f659['shift']());}};_0x400389(++_0x506fc1);}(_0x44e0,0x1ae));var _0x044e=function(_0x3062a7,_0x4aebe9){_0x3062a7=_0x3062a7-0x0;var _0x4efa5d=_0x44e0[_0x3062a7];return _0x4efa5d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x044e('0x0'))(_0x044e('0x1'));var moment=require(_0x044e('0x2'));var BPromise=require(_0x044e('0x3'));var rp=require(_0x044e('0x4'));var attributes=require(_0x044e('0x5'));var integrations=require(_0x044e('0x6'));module['exports']=function(_0x35a785,_0x481299){return _0x35a785[_0x044e('0x7')](_0x044e('0x8'),attributes,{'tableName':_0x044e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index adaebcd..dc8e7f6 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.rpc.js +++ b/server/api/intServicenowAccount/intServicenowAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcd00=['findAll','options','where','attributes','limit','include','map','model','ShowServicenowAccount','find','raw','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetServicenowAccount','ServicenowAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd00,0x1af));var _0x0cd0=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xcd00[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0x0cd0('0x0'));var util=require(_0x0cd0('0x1'));var moment=require(_0x0cd0('0x2'));var BPromise=require('bluebird');var rs=require(_0x0cd0('0x3'));var fs=require('fs');var Redis=require(_0x0cd0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0cd0('0x5'));var logger=require(_0x0cd0('0x6'))(_0x0cd0('0x7'));var config=require(_0x0cd0('0x8'));var jayson=require(_0x0cd0('0x9'));var client=jayson[_0x0cd0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1efc39,_0xa85168,_0x45e656){return new BPromise(function(_0x53c3ef,_0x1de871){return client[_0x0cd0('0xb')](_0x1efc39,_0x45e656)[_0x0cd0('0xc')](function(_0x4d0e62){logger['info'](_0x0cd0('0xd'),_0xa85168,'request\x20sent');logger[_0x0cd0('0xe')](_0x0cd0('0xf'),_0xa85168,'request\x20sent',JSON[_0x0cd0('0x10')](_0x4d0e62));if(_0x4d0e62[_0x0cd0('0x11')]){if(_0x4d0e62['error']['code']===0x1f4){logger[_0x0cd0('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0xa85168,_0x4d0e62[_0x0cd0('0x11')][_0x0cd0('0x12')]);return _0x1de871(_0x4d0e62[_0x0cd0('0x11')]['message']);}logger[_0x0cd0('0x11')](_0x0cd0('0xd'),_0xa85168,_0x4d0e62['error']['message']);return _0x53c3ef(_0x4d0e62[_0x0cd0('0x11')]['message']);}else{logger[_0x0cd0('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0xa85168,'request\x20sent');_0x53c3ef(_0x4d0e62[_0x0cd0('0x14')][_0x0cd0('0x12')]);}})[_0x0cd0('0x15')](function(_0x517386){logger[_0x0cd0('0x11')](_0x0cd0('0xd'),_0xa85168,_0x517386);_0x1de871(_0x517386);});});}exports[_0x0cd0('0x16')]=function(_0x3255ab){var _0x4fd450=this;return new Promise(function(_0x30f494,_0x1537a8){return db[_0x0cd0('0x17')][_0x0cd0('0x18')]({'raw':_0x3255ab[_0x0cd0('0x19')]?_0x3255ab[_0x0cd0('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3255ab['options']?_0x3255ab[_0x0cd0('0x19')][_0x0cd0('0x1a')]||null:null,'attributes':_0x3255ab[_0x0cd0('0x19')]?_0x3255ab['options'][_0x0cd0('0x1b')]||null:null,'limit':_0x3255ab[_0x0cd0('0x19')]?_0x3255ab[_0x0cd0('0x19')][_0x0cd0('0x1c')]||null:null,'include':_0x3255ab[_0x0cd0('0x19')]?_0x3255ab[_0x0cd0('0x19')][_0x0cd0('0x1d')]?_[_0x0cd0('0x1e')](_0x3255ab[_0x0cd0('0x19')][_0x0cd0('0x1d')],function(_0x2b0ac9){return{'model':db[_0x2b0ac9[_0x0cd0('0x1f')]],'as':_0x2b0ac9['as'],'attributes':_0x2b0ac9[_0x0cd0('0x1b')],'include':_0x2b0ac9[_0x0cd0('0x1d')]?_[_0x0cd0('0x1e')](_0x2b0ac9[_0x0cd0('0x1d')],function(_0x3875cc){return{'model':db[_0x3875cc['model']],'as':_0x3875cc['as'],'attributes':_0x3875cc['attributes'],'include':_0x3875cc[_0x0cd0('0x1d')]?_[_0x0cd0('0x1e')](_0x3875cc[_0x0cd0('0x1d')],function(_0x43d33d){return{'model':db[_0x43d33d['model']],'as':_0x43d33d['as'],'attributes':_0x43d33d[_0x0cd0('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x53a03a){logger[_0x0cd0('0x13')](_0x0cd0('0x16'),_0x3255ab);logger[_0x0cd0('0xe')](_0x0cd0('0x16'),_0x3255ab,JSON[_0x0cd0('0x10')](_0x53a03a));_0x30f494(_0x53a03a);})[_0x0cd0('0x15')](function(_0x1dff35){logger[_0x0cd0('0x11')]('GetServicenowAccount',_0x1dff35['message'],_0x3255ab);_0x1537a8(_0x4fd450['error'](0x1f4,_0x1dff35[_0x0cd0('0x12')]));});});};exports[_0x0cd0('0x20')]=function(_0x1d91df){var _0x3abb01=this;return new Promise(function(_0x3b7194,_0x52d29a){return db['ServicenowAccount'][_0x0cd0('0x21')]({'raw':_0x1d91df[_0x0cd0('0x19')]?_0x1d91df[_0x0cd0('0x19')][_0x0cd0('0x22')]===undefined?!![]:![]:!![],'where':_0x1d91df[_0x0cd0('0x19')]?_0x1d91df[_0x0cd0('0x19')][_0x0cd0('0x1a')]||null:null,'attributes':_0x1d91df[_0x0cd0('0x19')]?_0x1d91df['options']['attributes']||null:null,'include':_0x1d91df[_0x0cd0('0x19')]?_0x1d91df[_0x0cd0('0x19')][_0x0cd0('0x1d')]?_[_0x0cd0('0x1e')](_0x1d91df[_0x0cd0('0x19')]['include'],function(_0x51c5df){return{'model':db[_0x51c5df['model']],'as':_0x51c5df['as'],'attributes':_0x51c5df[_0x0cd0('0x1b')],'include':_0x51c5df[_0x0cd0('0x1d')]?_[_0x0cd0('0x1e')](_0x51c5df[_0x0cd0('0x1d')],function(_0x120464){return{'model':db[_0x120464[_0x0cd0('0x1f')]],'as':_0x120464['as'],'attributes':_0x120464[_0x0cd0('0x1b')],'include':_0x120464[_0x0cd0('0x1d')]?_[_0x0cd0('0x1e')](_0x120464[_0x0cd0('0x1d')],function(_0xebb3b8){return{'model':db[_0xebb3b8[_0x0cd0('0x1f')]],'as':_0xebb3b8['as'],'attributes':_0xebb3b8['attributes']};}):[]};}):[]};}):[]:[]})[_0x0cd0('0xc')](function(_0x4e7884){logger[_0x0cd0('0x13')](_0x0cd0('0x20'),_0x1d91df);logger[_0x0cd0('0xe')](_0x0cd0('0x20'),_0x1d91df,JSON[_0x0cd0('0x10')](_0x4e7884));_0x3b7194(_0x4e7884);})['catch'](function(_0x17001b){logger[_0x0cd0('0x11')](_0x0cd0('0x20'),_0x17001b[_0x0cd0('0x12')],_0x1d91df);_0x52d29a(_0x3abb01[_0x0cd0('0x11')](0x1f4,_0x17001b[_0x0cd0('0x12')]));});});}; \ No newline at end of file +var _0xb382=['attributes','limit','map','include','model','ServicenowAccount','then','ShowServicenowAccount','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ServicenowAccount,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','GetServicenowAccount','findAll','options','raw','where'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb382,0xe1));var _0x2b38=function(_0x3d6fa2,_0x3dfe73){_0x3d6fa2=_0x3d6fa2-0x0;var _0x1b6bf7=_0xb382[_0x3d6fa2];return _0x1b6bf7;};'use strict';var _=require(_0x2b38('0x0'));var util=require('util');var moment=require(_0x2b38('0x1'));var BPromise=require(_0x2b38('0x2'));var rs=require(_0x2b38('0x3'));var fs=require('fs');var Redis=require(_0x2b38('0x4'));var db=require(_0x2b38('0x5'))['db'];var utils=require(_0x2b38('0x6'));var logger=require(_0x2b38('0x7'))(_0x2b38('0x8'));var config=require(_0x2b38('0x9'));var jayson=require(_0x2b38('0xa'));var client=jayson['client'][_0x2b38('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37729d,_0x5df3bb,_0x52deda){return new BPromise(function(_0x4d03aa,_0x1d32bb){return client[_0x2b38('0xc')](_0x37729d,_0x52deda)['then'](function(_0xb6678){logger[_0x2b38('0xd')](_0x2b38('0xe'),_0x5df3bb,'request\x20sent');logger[_0x2b38('0xf')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x5df3bb,'request\x20sent',JSON['stringify'](_0xb6678));if(_0xb6678[_0x2b38('0x10')]){if(_0xb6678[_0x2b38('0x10')][_0x2b38('0x11')]===0x1f4){logger[_0x2b38('0x10')](_0x2b38('0xe'),_0x5df3bb,_0xb6678[_0x2b38('0x10')][_0x2b38('0x12')]);return _0x1d32bb(_0xb6678[_0x2b38('0x10')][_0x2b38('0x12')]);}logger[_0x2b38('0x10')](_0x2b38('0xe'),_0x5df3bb,_0xb6678[_0x2b38('0x10')][_0x2b38('0x12')]);return _0x4d03aa(_0xb6678[_0x2b38('0x10')]['message']);}else{logger[_0x2b38('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x5df3bb,_0x2b38('0x13'));_0x4d03aa(_0xb6678[_0x2b38('0x14')][_0x2b38('0x12')]);}})[_0x2b38('0x15')](function(_0x364f2b){logger[_0x2b38('0x10')](_0x2b38('0xe'),_0x5df3bb,_0x364f2b);_0x1d32bb(_0x364f2b);});});}exports[_0x2b38('0x16')]=function(_0x362344){var _0xb596dd=this;return new Promise(function(_0x3236b8,_0x2d4555){return db['ServicenowAccount'][_0x2b38('0x17')]({'raw':_0x362344[_0x2b38('0x18')]?_0x362344['options'][_0x2b38('0x19')]===undefined?!![]:![]:!![],'where':_0x362344[_0x2b38('0x18')]?_0x362344[_0x2b38('0x18')][_0x2b38('0x1a')]||null:null,'attributes':_0x362344[_0x2b38('0x18')]?_0x362344['options'][_0x2b38('0x1b')]||null:null,'limit':_0x362344['options']?_0x362344['options'][_0x2b38('0x1c')]||null:null,'include':_0x362344['options']?_0x362344['options']['include']?_[_0x2b38('0x1d')](_0x362344['options'][_0x2b38('0x1e')],function(_0x228892){return{'model':db[_0x228892['model']],'as':_0x228892['as'],'attributes':_0x228892['attributes'],'include':_0x228892[_0x2b38('0x1e')]?_['map'](_0x228892[_0x2b38('0x1e')],function(_0x3b6343){return{'model':db[_0x3b6343[_0x2b38('0x1f')]],'as':_0x3b6343['as'],'attributes':_0x3b6343[_0x2b38('0x1b')],'include':_0x3b6343[_0x2b38('0x1e')]?_[_0x2b38('0x1d')](_0x3b6343[_0x2b38('0x1e')],function(_0x4eb8af){return{'model':db[_0x4eb8af[_0x2b38('0x1f')]],'as':_0x4eb8af['as'],'attributes':_0x4eb8af[_0x2b38('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ff5fe){logger[_0x2b38('0xd')](_0x2b38('0x16'),_0x362344);logger['debug'](_0x2b38('0x16'),_0x362344,JSON['stringify'](_0x3ff5fe));_0x3236b8(_0x3ff5fe);})[_0x2b38('0x15')](function(_0x24a41f){logger[_0x2b38('0x10')](_0x2b38('0x16'),_0x24a41f[_0x2b38('0x12')],_0x362344);_0x2d4555(_0xb596dd[_0x2b38('0x10')](0x1f4,_0x24a41f[_0x2b38('0x12')]));});});};exports['ShowServicenowAccount']=function(_0x11f80e){var _0x34be45=this;return new Promise(function(_0xc0d8b6,_0x2bc328){return db[_0x2b38('0x20')]['find']({'raw':_0x11f80e[_0x2b38('0x18')]?_0x11f80e['options'][_0x2b38('0x19')]===undefined?!![]:![]:!![],'where':_0x11f80e['options']?_0x11f80e[_0x2b38('0x18')][_0x2b38('0x1a')]||null:null,'attributes':_0x11f80e[_0x2b38('0x18')]?_0x11f80e['options'][_0x2b38('0x1b')]||null:null,'include':_0x11f80e[_0x2b38('0x18')]?_0x11f80e[_0x2b38('0x18')]['include']?_[_0x2b38('0x1d')](_0x11f80e[_0x2b38('0x18')][_0x2b38('0x1e')],function(_0x4ecf6b){return{'model':db[_0x4ecf6b[_0x2b38('0x1f')]],'as':_0x4ecf6b['as'],'attributes':_0x4ecf6b['attributes'],'include':_0x4ecf6b[_0x2b38('0x1e')]?_['map'](_0x4ecf6b[_0x2b38('0x1e')],function(_0xbbe81e){return{'model':db[_0xbbe81e[_0x2b38('0x1f')]],'as':_0xbbe81e['as'],'attributes':_0xbbe81e[_0x2b38('0x1b')],'include':_0xbbe81e[_0x2b38('0x1e')]?_[_0x2b38('0x1d')](_0xbbe81e['include'],function(_0x446f74){return{'model':db[_0x446f74[_0x2b38('0x1f')]],'as':_0x446f74['as'],'attributes':_0x446f74[_0x2b38('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2b38('0x21')](function(_0x29015e){logger[_0x2b38('0xd')](_0x2b38('0x22'),_0x11f80e);logger[_0x2b38('0xf')](_0x2b38('0x22'),_0x11f80e,JSON[_0x2b38('0x23')](_0x29015e));_0xc0d8b6(_0x29015e);})[_0x2b38('0x15')](function(_0x163abd){logger[_0x2b38('0x10')]('ShowServicenowAccount',_0x163abd[_0x2b38('0x12')],_0x11f80e);_0x2bc328(_0x34be45['error'](0x1f4,_0x163abd[_0x2b38('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index a5a0c2c..0d491f6 100644 --- a/server/api/intServicenowConfiguration/index.js +++ b/server/api/intServicenowConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6dcd=['getSubjects','create','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0xffd709,_0x3deaa7){var _0xf5ec9b=function(_0x31749c){while(--_0x31749c){_0xffd709['push'](_0xffd709['shift']());}};_0xf5ec9b(++_0x3deaa7);}(_0x6dcd,0x17f));var _0xd6dc=function(_0x2c5234,_0x1ed6e7){_0x2c5234=_0x2c5234-0x0;var _0x18aff0=_0x6dcd[_0x2c5234];return _0x18aff0;};'use strict';var multer=require(_0xd6dc('0x0'));var util=require(_0xd6dc('0x1'));var path=require(_0xd6dc('0x2'));var timeout=require(_0xd6dc('0x3'));var express=require('express');var router=express[_0xd6dc('0x4')]();var auth=require(_0xd6dc('0x5'));var interaction=require(_0xd6dc('0x6'));var config=require(_0xd6dc('0x7'));var controller=require('./intServicenowConfiguration.controller');router[_0xd6dc('0x8')]('/',auth[_0xd6dc('0x9')](),controller[_0xd6dc('0xa')]);router[_0xd6dc('0x8')](_0xd6dc('0xb'),auth[_0xd6dc('0x9')](),controller[_0xd6dc('0xc')]);router[_0xd6dc('0x8')](_0xd6dc('0xd'),auth[_0xd6dc('0x9')](),controller[_0xd6dc('0xe')]);router[_0xd6dc('0x8')](_0xd6dc('0xf'),auth[_0xd6dc('0x9')](),controller[_0xd6dc('0x10')]);router['get']('/:id/descriptions',auth[_0xd6dc('0x9')](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0xd6dc('0x11')]);router['put'](_0xd6dc('0xb'),auth[_0xd6dc('0x9')](),controller['update']);router[_0xd6dc('0x12')](_0xd6dc('0xb'),auth[_0xd6dc('0x9')](),controller[_0xd6dc('0x13')]);module[_0xd6dc('0x14')]=router; \ No newline at end of file +var _0xbf7f=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer'];(function(_0xf08154,_0x5eb8ae){var _0x9aede7=function(_0x781234){while(--_0x781234){_0xf08154['push'](_0xf08154['shift']());}};_0x9aede7(++_0x5eb8ae);}(_0xbf7f,0x19d));var _0xfbf7=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xbf7f[_0x422905];return _0x33dc6c;};'use strict';var multer=require(_0xfbf7('0x0'));var util=require(_0xfbf7('0x1'));var path=require(_0xfbf7('0x2'));var timeout=require('connect-timeout');var express=require(_0xfbf7('0x3'));var router=express[_0xfbf7('0x4')]();var auth=require(_0xfbf7('0x5'));var interaction=require(_0xfbf7('0x6'));var config=require(_0xfbf7('0x7'));var controller=require(_0xfbf7('0x8'));router[_0xfbf7('0x9')]('/',auth[_0xfbf7('0xa')](),controller[_0xfbf7('0xb')]);router[_0xfbf7('0x9')](_0xfbf7('0xc'),auth[_0xfbf7('0xa')](),controller[_0xfbf7('0xd')]);router['get']('/:id/fields',auth[_0xfbf7('0xa')](),controller[_0xfbf7('0xe')]);router[_0xfbf7('0x9')](_0xfbf7('0xf'),auth[_0xfbf7('0xa')](),controller['getSubjects']);router[_0xfbf7('0x9')](_0xfbf7('0x10'),auth[_0xfbf7('0xa')](),controller[_0xfbf7('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xfbf7('0x12')](_0xfbf7('0xc'),auth[_0xfbf7('0xa')](),controller[_0xfbf7('0x13')]);router[_0xfbf7('0x14')]('/:id',auth[_0xfbf7('0xa')](),controller[_0xfbf7('0x15')]);module[_0xfbf7('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 88dc0bc..aed5fe7 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6c4=['STRING','sequelize'];(function(_0x2aeca6,_0x565154){var _0x48c8c9=function(_0x739357){while(--_0x739357){_0x2aeca6['push'](_0x2aeca6['shift']());}};_0x48c8c9(++_0x565154);}(_0xd6c4,0x10f));var _0x4d6c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd6c4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4d6c('0x0'));module['exports']={'name':{'type':Sequelize[_0x4d6c('0x1')]},'description':{'type':Sequelize[_0x4d6c('0x1')]}}; \ No newline at end of file +var _0xf3a6=['STRING'];(function(_0x51a8ea,_0x3c6785){var _0x516fb1=function(_0x237192){while(--_0x237192){_0x51a8ea['push'](_0x51a8ea['shift']());}};_0x516fb1(++_0x3c6785);}(_0xf3a6,0xf3));var _0x6f3a=function(_0x5ecac1,_0x2d7338){_0x5ecac1=_0x5ecac1-0x0;var _0x1fe487=_0xf3a6[_0x5ecac1];return _0x1fe487;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6f3a('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 16a356b..2be738d 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x668b=['message','catch','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','destroy','stack','name','send','index','ServicenowConfiguration','rawAttributes','keys','query','filters','model','attributes','fields','length','order','sort','where','pick','filter','merge','type','options','count','includeAll','include','findAll','rows','show','intersection','find','body','update','params','getFields','findOne','ServicenowField','map','hasOwnProperty','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x668b,0x140));var _0xb668=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0x668b[_0x43b584];return _0x48f27b;};'use strict';var pdf=require(_0xb668('0x0'));var emlformat=require(_0xb668('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb668('0x2'));var jsonpatch=require(_0xb668('0x3'));var rp=require('request-promise');var moment=require(_0xb668('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb668('0x5'));var util=require(_0xb668('0x6'));var path=require(_0xb668('0x7'));var sox=require('sox');var csv=require(_0xb668('0x8'));var ejs=require(_0xb668('0x9'));var fs=require('fs');var _=require(_0xb668('0xa'));var squel=require(_0xb668('0xb'));var crypto=require(_0xb668('0xc'));var jsforce=require(_0xb668('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb668('0x8'));var querystring=require(_0xb668('0xe'));var Papa=require(_0xb668('0xf'));var authService=require(_0xb668('0x10'));var hardwareService=require(_0xb668('0x11'));var Redis=require(_0xb668('0x12'));var qs=require(_0xb668('0x13'));var logger=require(_0xb668('0x14'))('api');var utils=require(_0xb668('0x15'));var config=require(_0xb668('0x16'));var db=require(_0xb668('0x17'))['db'];var jayson=require(_0xb668('0x18'));var client=jayson[_0xb668('0x19')][_0xb668('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1d111a,_0x10ed24,_0x3e5be0,_0x25c5c5){return new BPromise(function(_0x1af935,_0x3b7556){var _0x3aed25=_0x25c5c5||client;return _0x3aed25[_0xb668('0x1b')](_0x1d111a,_0x3e5be0)[_0xb668('0x1c')](function(_0x3b0c84){logger[_0xb668('0x1d')](_0xb668('0x1e'),_0x10ed24,_0xb668('0x1f'));logger[_0xb668('0x20')](_0xb668('0x21'),_0x10ed24,_0xb668('0x1f'),JSON['stringify'](_0x3b0c84));if(_0x3b0c84[_0xb668('0x22')]){if(_0x3b0c84['error'][_0xb668('0x23')]===0x1f4){logger[_0xb668('0x22')]('ServicenowConfiguration,\x20%s,\x20%s',_0x10ed24,_0x3b0c84[_0xb668('0x22')][_0xb668('0x24')]);return _0x3b7556(_0x3b0c84['error'][_0xb668('0x24')]);}logger['error'](_0xb668('0x1e'),_0x10ed24,_0x3b0c84[_0xb668('0x22')][_0xb668('0x24')]);return _0x1af935(_0x3b0c84[_0xb668('0x22')]['message']);}else{logger[_0xb668('0x1d')](_0xb668('0x1e'),_0x10ed24,_0xb668('0x1f'));_0x1af935(_0x3b0c84['result']['message']);}})[_0xb668('0x25')](function(_0x1e5620){logger['error'](_0xb668('0x1e'),_0x10ed24,_0x1e5620);_0x3b7556(_0x1e5620);});});}function respondWithStatusCode(_0x4bf863,_0x2f1394){_0x2f1394=_0x2f1394||0xcc;return function(_0x4bd365){if(_0x4bd365){return _0x4bf863[_0xb668('0x26')](_0x2f1394);}return _0x4bf863[_0xb668('0x27')](_0x2f1394)[_0xb668('0x28')]();};}function respondWithResult(_0x3231b2,_0x2a5b3d){_0x2a5b3d=_0x2a5b3d||0xc8;return function(_0xabb342){if(_0xabb342){return _0x3231b2['status'](_0x2a5b3d)[_0xb668('0x29')](_0xabb342);}};}function respondWithFilteredResult(_0x10d767,_0x2ab8c2){return function(_0x49abfd){if(_0x49abfd){var _0x5e0cee=_0x49abfd['count'],_0xe62fce=_0x2ab8c2[_0xb668('0x2a')],_0x2a826d=_0x2ab8c2[_0xb668('0x2a')]+_0x2ab8c2[_0xb668('0x2b')],_0x30b965;if(_0x2a826d>=_0x5e0cee){_0x2a826d=_0x5e0cee;_0x30b965=0xc8;}else{_0x30b965=0xce;}_0x10d767['status'](_0x30b965);return _0x10d767['set'](_0xb668('0x2c'),_0xe62fce+'-'+_0x2a826d+'/'+_0x5e0cee)[_0xb668('0x29')](_0x49abfd);}return null;};}function patchUpdates(_0x589c58){return function(_0x2e5857){try{jsonpatch[_0xb668('0x2d')](_0x2e5857,_0x589c58,!![]);}catch(_0x26918a){return BPromise[_0xb668('0x2e')](_0x26918a);}return _0x2e5857[_0xb668('0x2f')]();};}function saveUpdates(_0x5f36b5,_0x138ee5){return function(_0x3bd27c){if(_0x3bd27c){return _0x3bd27c['update'](_0x5f36b5)[_0xb668('0x1c')](function(_0x52a946){return _0x52a946;});}return null;};}function removeEntity(_0x440236,_0x406cc5){return function(_0x467fea){if(_0x467fea){return _0x467fea[_0xb668('0x30')]()[_0xb668('0x1c')](function(){_0x440236[_0xb668('0x27')](0xcc)[_0xb668('0x28')]();});}};}function handleEntityNotFound(_0x3d4bd8,_0xadeb63){return function(_0x4ae272){if(!_0x4ae272){_0x3d4bd8[_0xb668('0x26')](0x194);}return _0x4ae272;};}function handleError(_0x13bc2b,_0x1483ba){_0x1483ba=_0x1483ba||0x1f4;return function(_0x4dd83e){logger[_0xb668('0x22')](_0x4dd83e[_0xb668('0x31')]);if(_0x4dd83e[_0xb668('0x32')]){delete _0x4dd83e[_0xb668('0x32')];}_0x13bc2b['status'](_0x1483ba)[_0xb668('0x33')](_0x4dd83e);};}exports[_0xb668('0x34')]=function(_0x3cb3a1,_0x2f6edb){var _0x34e0d6={},_0xe10c43={},_0x304311={'count':0x0,'rows':[]};var _0x5a9134=db[_0xb668('0x35')][_0xb668('0x36')];_0xe10c43['model']=_[_0xb668('0x37')](_0x5a9134);_0xe10c43['query']=_['keys'](_0x3cb3a1[_0xb668('0x38')]);_0xe10c43[_0xb668('0x39')]=_['intersection'](_0xe10c43[_0xb668('0x3a')],_0xe10c43['query']);_0x34e0d6[_0xb668('0x3b')]=_['intersection'](_0xe10c43['model'],qs[_0xb668('0x3c')](_0x3cb3a1[_0xb668('0x38')]['fields']));_0x34e0d6['attributes']=_0x34e0d6[_0xb668('0x3b')][_0xb668('0x3d')]?_0x34e0d6[_0xb668('0x3b')]:_0xe10c43[_0xb668('0x3a')];if(!_0x3cb3a1[_0xb668('0x38')]['hasOwnProperty']('nolimit')){_0x34e0d6[_0xb668('0x2b')]=qs[_0xb668('0x2b')](_0x3cb3a1[_0xb668('0x38')][_0xb668('0x2b')]);_0x34e0d6[_0xb668('0x2a')]=qs[_0xb668('0x2a')](_0x3cb3a1['query']['offset']);}_0x34e0d6[_0xb668('0x3e')]=qs[_0xb668('0x3f')](_0x3cb3a1[_0xb668('0x38')][_0xb668('0x3f')]);_0x34e0d6[_0xb668('0x40')]=qs['filters'](_[_0xb668('0x41')](_0x3cb3a1[_0xb668('0x38')],_0xe10c43['filters']));if(_0x3cb3a1[_0xb668('0x38')][_0xb668('0x42')]){_0x34e0d6[_0xb668('0x40')]=_[_0xb668('0x43')](_0x34e0d6['where'],{'$or':_['map'](_0x5a9134,function(_0x4b7192){if(_0x4b7192[_0xb668('0x44')]['key']!=='VIRTUAL'){var _0x5b4b4c={};_0x5b4b4c[_0x4b7192['field']]={'$like':'%'+_0x3cb3a1[_0xb668('0x38')]['filter']+'%'};return _0x5b4b4c;}})});}_0x34e0d6=_[_0xb668('0x43')]({},_0x34e0d6,_0x3cb3a1[_0xb668('0x45')]);var _0x30f4bb={'where':_0x34e0d6[_0xb668('0x40')]};return db[_0xb668('0x35')]['count'](_0x30f4bb)[_0xb668('0x1c')](function(_0x29b0ee){_0x304311[_0xb668('0x46')]=_0x29b0ee;if(_0x3cb3a1[_0xb668('0x38')][_0xb668('0x47')]){_0x34e0d6[_0xb668('0x48')]=[{'all':!![]}];}return db[_0xb668('0x35')][_0xb668('0x49')](_0x34e0d6);})[_0xb668('0x1c')](function(_0x3c8a3e){_0x304311[_0xb668('0x4a')]=_0x3c8a3e;return _0x304311;})['then'](respondWithFilteredResult(_0x2f6edb,_0x34e0d6))[_0xb668('0x25')](handleError(_0x2f6edb,null));};exports[_0xb668('0x4b')]=function(_0x374c76,_0x4e4a75){var _0x47a769={'raw':![],'where':{'id':_0x374c76['params']['id']}},_0x2f3c0a={};_0x2f3c0a[_0xb668('0x3a')]=_['keys'](db['ServicenowConfiguration']['rawAttributes']);_0x2f3c0a[_0xb668('0x38')]=_[_0xb668('0x37')](_0x374c76['query']);_0x2f3c0a[_0xb668('0x39')]=_[_0xb668('0x4c')](_0x2f3c0a[_0xb668('0x3a')],_0x2f3c0a[_0xb668('0x38')]);_0x47a769[_0xb668('0x3b')]=_[_0xb668('0x4c')](_0x2f3c0a[_0xb668('0x3a')],qs[_0xb668('0x3c')](_0x374c76[_0xb668('0x38')][_0xb668('0x3c')]));_0x47a769['attributes']=_0x47a769[_0xb668('0x3b')][_0xb668('0x3d')]?_0x47a769[_0xb668('0x3b')]:_0x2f3c0a[_0xb668('0x3a')];if(_0x374c76[_0xb668('0x38')][_0xb668('0x47')]){_0x47a769[_0xb668('0x48')]=[{'all':!![]}];}_0x47a769=_[_0xb668('0x43')]({},_0x47a769,_0x374c76[_0xb668('0x45')]);return db['ServicenowConfiguration'][_0xb668('0x4d')](_0x47a769)[_0xb668('0x1c')](handleEntityNotFound(_0x4e4a75,null))[_0xb668('0x1c')](respondWithResult(_0x4e4a75,null))['catch'](handleError(_0x4e4a75,null));};exports['create']=function(_0x25c2a0,_0x3bab67){return db[_0xb668('0x35')]['create'](_0x25c2a0[_0xb668('0x4e')],{})['then'](respondWithResult(_0x3bab67,0xc9))['catch'](handleError(_0x3bab67,null));};exports[_0xb668('0x4f')]=function(_0x100fcf,_0x41e9aa){if(_0x100fcf[_0xb668('0x4e')]['id']){delete _0x100fcf[_0xb668('0x4e')]['id'];}return db[_0xb668('0x35')][_0xb668('0x4d')]({'where':{'id':_0x100fcf[_0xb668('0x50')]['id']}})[_0xb668('0x1c')](handleEntityNotFound(_0x41e9aa,null))[_0xb668('0x1c')](saveUpdates(_0x100fcf[_0xb668('0x4e')],null))[_0xb668('0x1c')](respondWithResult(_0x41e9aa,null))[_0xb668('0x25')](handleError(_0x41e9aa,null));};exports[_0xb668('0x30')]=function(_0x2899ef,_0x278e80){return db[_0xb668('0x35')][_0xb668('0x4d')]({'where':{'id':_0x2899ef[_0xb668('0x50')]['id']}})[_0xb668('0x1c')](handleEntityNotFound(_0x278e80,null))[_0xb668('0x1c')](removeEntity(_0x278e80,null))[_0xb668('0x25')](handleError(_0x278e80,null));};exports[_0xb668('0x51')]=function(_0x397950,_0x1cd4b1,_0xa74ae7){var _0x44724d={};var _0x46abfb={};var _0x3368a6;var _0x262976;return db['ServicenowConfiguration'][_0xb668('0x52')]({'where':{'id':_0x397950[_0xb668('0x50')]['id']}})[_0xb668('0x1c')](handleEntityNotFound(_0x1cd4b1,null))[_0xb668('0x1c')](function(_0x416d73){if(_0x416d73){_0x3368a6=_0x416d73;_0x46abfb[_0xb668('0x3a')]=_[_0xb668('0x37')](db[_0xb668('0x53')][_0xb668('0x36')]);_0x46abfb[_0xb668('0x38')]=_[_0xb668('0x37')](_0x397950[_0xb668('0x38')]);_0x46abfb[_0xb668('0x39')]=_['intersection'](_0x46abfb[_0xb668('0x3a')],_0x46abfb[_0xb668('0x38')]);_0x44724d['attributes']=_[_0xb668('0x4c')](_0x46abfb[_0xb668('0x3a')],qs['fields'](_0x397950[_0xb668('0x38')][_0xb668('0x3c')]));_0x44724d['attributes']=_0x44724d[_0xb668('0x3b')]['length']?_0x44724d[_0xb668('0x3b')]:_0x46abfb[_0xb668('0x3a')];_0x44724d['order']=qs[_0xb668('0x3f')](_0x397950[_0xb668('0x38')][_0xb668('0x3f')]);_0x44724d[_0xb668('0x40')]=qs[_0xb668('0x39')](_[_0xb668('0x41')](_0x397950[_0xb668('0x38')],_0x46abfb[_0xb668('0x39')]));if(_0x397950[_0xb668('0x38')]['filter']){_0x44724d[_0xb668('0x40')]=_[_0xb668('0x43')](_0x44724d[_0xb668('0x40')],{'$or':_[_0xb668('0x54')](_0x44724d[_0xb668('0x3b')],function(_0x51fcc6){var _0x30d6d4={};_0x30d6d4[_0x51fcc6]={'$like':'%'+_0x397950[_0xb668('0x38')][_0xb668('0x42')]+'%'};return _0x30d6d4;})});}_0x44724d=_['merge']({},_0x44724d,_0x397950[_0xb668('0x45')]);return _0x3368a6[_0xb668('0x51')](_0x44724d);}})[_0xb668('0x1c')](function(_0x3c1659){if(_0x3c1659){_0x262976=_0x3c1659['length'];if(!_0x397950[_0xb668('0x38')][_0xb668('0x55')](_0xb668('0x56'))){_0x44724d['limit']=qs[_0xb668('0x2b')](_0x397950[_0xb668('0x38')][_0xb668('0x2b')]);_0x44724d[_0xb668('0x2a')]=qs[_0xb668('0x2a')](_0x397950[_0xb668('0x38')][_0xb668('0x2a')]);}return _0x3368a6[_0xb668('0x51')](_0x44724d);}})[_0xb668('0x1c')](function(_0x53937a){if(_0x53937a){return _0x53937a?{'count':_0x262976,'rows':_0x53937a}:null;}})[_0xb668('0x1c')](respondWithResult(_0x1cd4b1,null))['catch'](handleError(_0x1cd4b1,null));};exports[_0xb668('0x57')]=function(_0x5db6ac,_0x2d8fec,_0x212cd5){var _0x2738e7={};var _0x4aa115={};var _0x364356;var _0x3749fa;return db[_0xb668('0x35')][_0xb668('0x52')]({'where':{'id':_0x5db6ac[_0xb668('0x50')]['id']}})[_0xb668('0x1c')](handleEntityNotFound(_0x2d8fec,null))[_0xb668('0x1c')](function(_0x2d9dfd){if(_0x2d9dfd){_0x364356=_0x2d9dfd;_0x4aa115[_0xb668('0x3a')]=_[_0xb668('0x37')](db[_0xb668('0x53')][_0xb668('0x36')]);_0x4aa115[_0xb668('0x38')]=_[_0xb668('0x37')](_0x5db6ac[_0xb668('0x38')]);_0x4aa115[_0xb668('0x39')]=_[_0xb668('0x4c')](_0x4aa115[_0xb668('0x3a')],_0x4aa115[_0xb668('0x38')]);_0x2738e7[_0xb668('0x3b')]=_['intersection'](_0x4aa115[_0xb668('0x3a')],qs[_0xb668('0x3c')](_0x5db6ac['query'][_0xb668('0x3c')]));_0x2738e7['attributes']=_0x2738e7[_0xb668('0x3b')][_0xb668('0x3d')]?_0x2738e7['attributes']:_0x4aa115['model'];_0x2738e7[_0xb668('0x3e')]=qs[_0xb668('0x3f')](_0x5db6ac[_0xb668('0x38')]['sort']);_0x2738e7[_0xb668('0x40')]=qs[_0xb668('0x39')](_[_0xb668('0x41')](_0x5db6ac['query'],_0x4aa115[_0xb668('0x39')]));if(_0x5db6ac[_0xb668('0x38')][_0xb668('0x42')]){_0x2738e7[_0xb668('0x40')]=_[_0xb668('0x43')](_0x2738e7[_0xb668('0x40')],{'$or':_[_0xb668('0x54')](_0x2738e7[_0xb668('0x3b')],function(_0x23ad51){var _0x209184={};_0x209184[_0x23ad51]={'$like':'%'+_0x5db6ac[_0xb668('0x38')]['filter']+'%'};return _0x209184;})});}_0x2738e7=_[_0xb668('0x43')]({},_0x2738e7,_0x5db6ac['options']);return _0x364356['getSubjects'](_0x2738e7);}})[_0xb668('0x1c')](function(_0x72c926){if(_0x72c926){_0x3749fa=_0x72c926[_0xb668('0x3d')];if(!_0x5db6ac[_0xb668('0x38')]['hasOwnProperty'](_0xb668('0x56'))){_0x2738e7['limit']=qs[_0xb668('0x2b')](_0x5db6ac[_0xb668('0x38')][_0xb668('0x2b')]);_0x2738e7['offset']=qs[_0xb668('0x2a')](_0x5db6ac[_0xb668('0x38')][_0xb668('0x2a')]);}return _0x364356['getSubjects'](_0x2738e7);}})[_0xb668('0x1c')](function(_0x31d83f){if(_0x31d83f){return _0x31d83f?{'count':_0x3749fa,'rows':_0x31d83f}:null;}})[_0xb668('0x1c')](respondWithResult(_0x2d8fec,null))[_0xb668('0x25')](handleError(_0x2d8fec,null));};exports['getDescriptions']=function(_0x461f1e,_0x197710,_0x574b02){var _0x4433c6={};var _0x5cfaa0={};var _0xc4cea7;var _0x35648d;return db[_0xb668('0x35')][_0xb668('0x52')]({'where':{'id':_0x461f1e[_0xb668('0x50')]['id']}})['then'](handleEntityNotFound(_0x197710,null))['then'](function(_0x31e706){if(_0x31e706){_0xc4cea7=_0x31e706;_0x5cfaa0[_0xb668('0x3a')]=_[_0xb668('0x37')](db[_0xb668('0x53')][_0xb668('0x36')]);_0x5cfaa0[_0xb668('0x38')]=_[_0xb668('0x37')](_0x461f1e[_0xb668('0x38')]);_0x5cfaa0[_0xb668('0x39')]=_[_0xb668('0x4c')](_0x5cfaa0[_0xb668('0x3a')],_0x5cfaa0['query']);_0x4433c6[_0xb668('0x3b')]=_[_0xb668('0x4c')](_0x5cfaa0['model'],qs[_0xb668('0x3c')](_0x461f1e[_0xb668('0x38')][_0xb668('0x3c')]));_0x4433c6[_0xb668('0x3b')]=_0x4433c6[_0xb668('0x3b')][_0xb668('0x3d')]?_0x4433c6[_0xb668('0x3b')]:_0x5cfaa0['model'];_0x4433c6[_0xb668('0x3e')]=qs['sort'](_0x461f1e[_0xb668('0x38')][_0xb668('0x3f')]);_0x4433c6[_0xb668('0x40')]=qs[_0xb668('0x39')](_[_0xb668('0x41')](_0x461f1e['query'],_0x5cfaa0[_0xb668('0x39')]));if(_0x461f1e[_0xb668('0x38')][_0xb668('0x42')]){_0x4433c6[_0xb668('0x40')]=_[_0xb668('0x43')](_0x4433c6[_0xb668('0x40')],{'$or':_['map'](_0x4433c6[_0xb668('0x3b')],function(_0x16ce9d){var _0x2c3267={};_0x2c3267[_0x16ce9d]={'$like':'%'+_0x461f1e[_0xb668('0x38')][_0xb668('0x42')]+'%'};return _0x2c3267;})});}_0x4433c6=_[_0xb668('0x43')]({},_0x4433c6,_0x461f1e[_0xb668('0x45')]);return _0xc4cea7[_0xb668('0x58')](_0x4433c6);}})['then'](function(_0x2c11b1){if(_0x2c11b1){_0x35648d=_0x2c11b1[_0xb668('0x3d')];if(!_0x461f1e[_0xb668('0x38')]['hasOwnProperty'](_0xb668('0x56'))){_0x4433c6['limit']=qs[_0xb668('0x2b')](_0x461f1e[_0xb668('0x38')][_0xb668('0x2b')]);_0x4433c6[_0xb668('0x2a')]=qs[_0xb668('0x2a')](_0x461f1e[_0xb668('0x38')][_0xb668('0x2a')]);}return _0xc4cea7['getDescriptions'](_0x4433c6);}})['then'](function(_0x354d91){if(_0x354d91){return _0x354d91?{'count':_0x35648d,'rows':_0x354d91}:null;}})[_0xb668('0x1c')](respondWithResult(_0x197710,null))[_0xb668('0x25')](handleError(_0x197710,null));}; \ No newline at end of file +var _0xf109=['attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','map','type','key','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','update','body','destroy','params','ServicenowField','pick','getFields','findOne','getSubjects','nolimit','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','save','then','name','send','index','ServicenowConfiguration','rawAttributes','keys','query','filters','intersection','model'];(function(_0x4664db,_0x1de672){var _0x5615b4=function(_0x54fb5a){while(--_0x54fb5a){_0x4664db['push'](_0x4664db['shift']());}};_0x5615b4(++_0x1de672);}(_0xf109,0xce));var _0x9f10=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xf109[_0x12fc8d];return _0x3f9d04;};'use strict';var pdf=require(_0x9f10('0x0'));var emlformat=require(_0x9f10('0x1'));var rimraf=require(_0x9f10('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9f10('0x3'));var BPromise=require(_0x9f10('0x4'));var Mustache=require(_0x9f10('0x5'));var util=require(_0x9f10('0x6'));var path=require(_0x9f10('0x7'));var sox=require(_0x9f10('0x8'));var csv=require(_0x9f10('0x9'));var ejs=require(_0x9f10('0xa'));var fs=require('fs');var _=require(_0x9f10('0xb'));var squel=require(_0x9f10('0xc'));var crypto=require(_0x9f10('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9f10('0xe'));var toCsv=require(_0x9f10('0x9'));var querystring=require(_0x9f10('0xf'));var Papa=require(_0x9f10('0x10'));var authService=require(_0x9f10('0x11'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x9f10('0x12'));var qs=require(_0x9f10('0x13'));var logger=require(_0x9f10('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x9f10('0x15'));var db=require(_0x9f10('0x16'))['db'];var jayson=require(_0x9f10('0x17'));var client=jayson['client'][_0x9f10('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x260606,_0x35c529,_0x58067f,_0x9a3ae6){return new BPromise(function(_0x309f27,_0x5be443){var _0x40a48a=_0x9a3ae6||client;return _0x40a48a[_0x9f10('0x19')](_0x260606,_0x58067f)['then'](function(_0x59bcad){logger[_0x9f10('0x1a')](_0x9f10('0x1b'),_0x35c529,'request\x20sent');logger[_0x9f10('0x1c')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x35c529,_0x9f10('0x1d'),JSON[_0x9f10('0x1e')](_0x59bcad));if(_0x59bcad['error']){if(_0x59bcad[_0x9f10('0x1f')][_0x9f10('0x20')]===0x1f4){logger['error'](_0x9f10('0x1b'),_0x35c529,_0x59bcad['error'][_0x9f10('0x21')]);return _0x5be443(_0x59bcad['error'][_0x9f10('0x21')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x35c529,_0x59bcad[_0x9f10('0x1f')][_0x9f10('0x21')]);return _0x309f27(_0x59bcad[_0x9f10('0x1f')][_0x9f10('0x21')]);}else{logger[_0x9f10('0x1a')](_0x9f10('0x1b'),_0x35c529,_0x9f10('0x1d'));_0x309f27(_0x59bcad['result'][_0x9f10('0x21')]);}})['catch'](function(_0x293990){logger[_0x9f10('0x1f')](_0x9f10('0x1b'),_0x35c529,_0x293990);_0x5be443(_0x293990);});});}function respondWithStatusCode(_0x4adbda,_0x2f31fb){_0x2f31fb=_0x2f31fb||0xcc;return function(_0x3dde2e){if(_0x3dde2e){return _0x4adbda[_0x9f10('0x22')](_0x2f31fb);}return _0x4adbda['status'](_0x2f31fb)[_0x9f10('0x23')]();};}function respondWithResult(_0x37e9ac,_0x44b99d){_0x44b99d=_0x44b99d||0xc8;return function(_0x4c531e){if(_0x4c531e){return _0x37e9ac[_0x9f10('0x24')](_0x44b99d)[_0x9f10('0x25')](_0x4c531e);}};}function respondWithFilteredResult(_0x11cae7,_0x1647c0){return function(_0x5e80de){if(_0x5e80de){var _0x57539b=_0x5e80de[_0x9f10('0x26')],_0x5c1800=_0x1647c0[_0x9f10('0x27')],_0x385a39=_0x1647c0[_0x9f10('0x27')]+_0x1647c0[_0x9f10('0x28')],_0x4a0407;if(_0x385a39>=_0x57539b){_0x385a39=_0x57539b;_0x4a0407=0xc8;}else{_0x4a0407=0xce;}_0x11cae7[_0x9f10('0x24')](_0x4a0407);return _0x11cae7['set'](_0x9f10('0x29'),_0x5c1800+'-'+_0x385a39+'/'+_0x57539b)[_0x9f10('0x25')](_0x5e80de);}return null;};}function patchUpdates(_0x40f96b){return function(_0xfbb37f){try{jsonpatch[_0x9f10('0x2a')](_0xfbb37f,_0x40f96b,!![]);}catch(_0x2c4373){return BPromise['reject'](_0x2c4373);}return _0xfbb37f[_0x9f10('0x2b')]();};}function saveUpdates(_0x501ee,_0x44207f){return function(_0x1b03ee){if(_0x1b03ee){return _0x1b03ee['update'](_0x501ee)[_0x9f10('0x2c')](function(_0x44f389){return _0x44f389;});}return null;};}function removeEntity(_0x34d8f6,_0x5dd404){return function(_0x434128){if(_0x434128){return _0x434128['destroy']()[_0x9f10('0x2c')](function(){_0x34d8f6[_0x9f10('0x24')](0xcc)[_0x9f10('0x23')]();});}};}function handleEntityNotFound(_0x5944e5,_0x3ac139){return function(_0x451478){if(!_0x451478){_0x5944e5[_0x9f10('0x22')](0x194);}return _0x451478;};}function handleError(_0x11f128,_0x148a5b){_0x148a5b=_0x148a5b||0x1f4;return function(_0x47bb88){logger[_0x9f10('0x1f')](_0x47bb88['stack']);if(_0x47bb88[_0x9f10('0x2d')]){delete _0x47bb88[_0x9f10('0x2d')];}_0x11f128[_0x9f10('0x24')](_0x148a5b)[_0x9f10('0x2e')](_0x47bb88);};}exports[_0x9f10('0x2f')]=function(_0x12c486,_0x4b87b0){var _0x2dd250={},_0x3a1601={},_0x1b8018={'count':0x0,'rows':[]};var _0x5e63b1=db[_0x9f10('0x30')][_0x9f10('0x31')];_0x3a1601['model']=_[_0x9f10('0x32')](_0x5e63b1);_0x3a1601['query']=_[_0x9f10('0x32')](_0x12c486[_0x9f10('0x33')]);_0x3a1601[_0x9f10('0x34')]=_[_0x9f10('0x35')](_0x3a1601[_0x9f10('0x36')],_0x3a1601[_0x9f10('0x33')]);_0x2dd250[_0x9f10('0x37')]=_[_0x9f10('0x35')](_0x3a1601['model'],qs[_0x9f10('0x38')](_0x12c486[_0x9f10('0x33')][_0x9f10('0x38')]));_0x2dd250['attributes']=_0x2dd250[_0x9f10('0x37')][_0x9f10('0x39')]?_0x2dd250['attributes']:_0x3a1601[_0x9f10('0x36')];if(!_0x12c486[_0x9f10('0x33')][_0x9f10('0x3a')]('nolimit')){_0x2dd250['limit']=qs[_0x9f10('0x28')](_0x12c486[_0x9f10('0x33')][_0x9f10('0x28')]);_0x2dd250[_0x9f10('0x27')]=qs[_0x9f10('0x27')](_0x12c486[_0x9f10('0x33')][_0x9f10('0x27')]);}_0x2dd250[_0x9f10('0x3b')]=qs[_0x9f10('0x3c')](_0x12c486[_0x9f10('0x33')][_0x9f10('0x3c')]);_0x2dd250[_0x9f10('0x3d')]=qs['filters'](_['pick'](_0x12c486['query'],_0x3a1601[_0x9f10('0x34')]));if(_0x12c486['query'][_0x9f10('0x3e')]){_0x2dd250[_0x9f10('0x3d')]=_[_0x9f10('0x3f')](_0x2dd250['where'],{'$or':_[_0x9f10('0x40')](_0x5e63b1,function(_0xf1164){if(_0xf1164[_0x9f10('0x41')][_0x9f10('0x42')]!==_0x9f10('0x43')){var _0x4eb658={};_0x4eb658[_0xf1164['field']]={'$like':'%'+_0x12c486['query'][_0x9f10('0x3e')]+'%'};return _0x4eb658;}})});}_0x2dd250=_['merge']({},_0x2dd250,_0x12c486[_0x9f10('0x44')]);var _0x49f6cc={'where':_0x2dd250[_0x9f10('0x3d')]};return db[_0x9f10('0x30')][_0x9f10('0x26')](_0x49f6cc)[_0x9f10('0x2c')](function(_0x553fff){_0x1b8018[_0x9f10('0x26')]=_0x553fff;if(_0x12c486[_0x9f10('0x33')]['includeAll']){_0x2dd250[_0x9f10('0x45')]=[{'all':!![]}];}return db[_0x9f10('0x30')][_0x9f10('0x46')](_0x2dd250);})[_0x9f10('0x2c')](function(_0x1b3529){_0x1b8018[_0x9f10('0x47')]=_0x1b3529;return _0x1b8018;})[_0x9f10('0x2c')](respondWithFilteredResult(_0x4b87b0,_0x2dd250))[_0x9f10('0x48')](handleError(_0x4b87b0,null));};exports[_0x9f10('0x49')]=function(_0x2672a0,_0x552588){var _0x181eab={'raw':![],'where':{'id':_0x2672a0['params']['id']}},_0x102730={};_0x102730[_0x9f10('0x36')]=_[_0x9f10('0x32')](db[_0x9f10('0x30')][_0x9f10('0x31')]);_0x102730['query']=_[_0x9f10('0x32')](_0x2672a0[_0x9f10('0x33')]);_0x102730[_0x9f10('0x34')]=_[_0x9f10('0x35')](_0x102730[_0x9f10('0x36')],_0x102730[_0x9f10('0x33')]);_0x181eab['attributes']=_[_0x9f10('0x35')](_0x102730[_0x9f10('0x36')],qs[_0x9f10('0x38')](_0x2672a0[_0x9f10('0x33')][_0x9f10('0x38')]));_0x181eab[_0x9f10('0x37')]=_0x181eab['attributes'][_0x9f10('0x39')]?_0x181eab[_0x9f10('0x37')]:_0x102730[_0x9f10('0x36')];if(_0x2672a0[_0x9f10('0x33')][_0x9f10('0x4a')]){_0x181eab[_0x9f10('0x45')]=[{'all':!![]}];}_0x181eab=_[_0x9f10('0x3f')]({},_0x181eab,_0x2672a0[_0x9f10('0x44')]);return db['ServicenowConfiguration'][_0x9f10('0x4b')](_0x181eab)['then'](handleEntityNotFound(_0x552588,null))[_0x9f10('0x2c')](respondWithResult(_0x552588,null))['catch'](handleError(_0x552588,null));};exports[_0x9f10('0x4c')]=function(_0x2d06b2,_0x30fad9){return db[_0x9f10('0x30')][_0x9f10('0x4c')](_0x2d06b2['body'],{})[_0x9f10('0x2c')](respondWithResult(_0x30fad9,0xc9))[_0x9f10('0x48')](handleError(_0x30fad9,null));};exports[_0x9f10('0x4d')]=function(_0x3818dc,_0x500e51){if(_0x3818dc['body']['id']){delete _0x3818dc[_0x9f10('0x4e')]['id'];}return db[_0x9f10('0x30')]['find']({'where':{'id':_0x3818dc['params']['id']}})[_0x9f10('0x2c')](handleEntityNotFound(_0x500e51,null))[_0x9f10('0x2c')](saveUpdates(_0x3818dc[_0x9f10('0x4e')],null))['then'](respondWithResult(_0x500e51,null))[_0x9f10('0x48')](handleError(_0x500e51,null));};exports[_0x9f10('0x4f')]=function(_0x7611e8,_0x4c3d18){return db[_0x9f10('0x30')][_0x9f10('0x4b')]({'where':{'id':_0x7611e8[_0x9f10('0x50')]['id']}})['then'](handleEntityNotFound(_0x4c3d18,null))[_0x9f10('0x2c')](removeEntity(_0x4c3d18,null))[_0x9f10('0x48')](handleError(_0x4c3d18,null));};exports['getFields']=function(_0x2a99fa,_0x283a03,_0xcd8ae7){var _0x2c215d={};var _0x334ab4={};var _0x55cb99;var _0x3d6c26;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x2a99fa[_0x9f10('0x50')]['id']}})[_0x9f10('0x2c')](handleEntityNotFound(_0x283a03,null))[_0x9f10('0x2c')](function(_0x277a86){if(_0x277a86){_0x55cb99=_0x277a86;_0x334ab4[_0x9f10('0x36')]=_[_0x9f10('0x32')](db[_0x9f10('0x51')]['rawAttributes']);_0x334ab4['query']=_[_0x9f10('0x32')](_0x2a99fa[_0x9f10('0x33')]);_0x334ab4[_0x9f10('0x34')]=_[_0x9f10('0x35')](_0x334ab4[_0x9f10('0x36')],_0x334ab4[_0x9f10('0x33')]);_0x2c215d[_0x9f10('0x37')]=_['intersection'](_0x334ab4[_0x9f10('0x36')],qs[_0x9f10('0x38')](_0x2a99fa['query'][_0x9f10('0x38')]));_0x2c215d[_0x9f10('0x37')]=_0x2c215d['attributes'][_0x9f10('0x39')]?_0x2c215d[_0x9f10('0x37')]:_0x334ab4['model'];_0x2c215d[_0x9f10('0x3b')]=qs['sort'](_0x2a99fa[_0x9f10('0x33')][_0x9f10('0x3c')]);_0x2c215d[_0x9f10('0x3d')]=qs[_0x9f10('0x34')](_[_0x9f10('0x52')](_0x2a99fa['query'],_0x334ab4[_0x9f10('0x34')]));if(_0x2a99fa[_0x9f10('0x33')][_0x9f10('0x3e')]){_0x2c215d['where']=_['merge'](_0x2c215d[_0x9f10('0x3d')],{'$or':_[_0x9f10('0x40')](_0x2c215d[_0x9f10('0x37')],function(_0x20045f){var _0xd627a2={};_0xd627a2[_0x20045f]={'$like':'%'+_0x2a99fa[_0x9f10('0x33')][_0x9f10('0x3e')]+'%'};return _0xd627a2;})});}_0x2c215d=_['merge']({},_0x2c215d,_0x2a99fa[_0x9f10('0x44')]);return _0x55cb99[_0x9f10('0x53')](_0x2c215d);}})['then'](function(_0xb0f5e9){if(_0xb0f5e9){_0x3d6c26=_0xb0f5e9['length'];if(!_0x2a99fa[_0x9f10('0x33')][_0x9f10('0x3a')]('nolimit')){_0x2c215d[_0x9f10('0x28')]=qs['limit'](_0x2a99fa[_0x9f10('0x33')][_0x9f10('0x28')]);_0x2c215d[_0x9f10('0x27')]=qs['offset'](_0x2a99fa[_0x9f10('0x33')]['offset']);}return _0x55cb99[_0x9f10('0x53')](_0x2c215d);}})[_0x9f10('0x2c')](function(_0x3be022){if(_0x3be022){return _0x3be022?{'count':_0x3d6c26,'rows':_0x3be022}:null;}})['then'](respondWithResult(_0x283a03,null))[_0x9f10('0x48')](handleError(_0x283a03,null));};exports['getSubjects']=function(_0x5708c1,_0x3b1893,_0x34520c){var _0x6b3eb6={};var _0x50ea89={};var _0x3b2d92;var _0x5a64ae;return db['ServicenowConfiguration'][_0x9f10('0x54')]({'where':{'id':_0x5708c1['params']['id']}})['then'](handleEntityNotFound(_0x3b1893,null))[_0x9f10('0x2c')](function(_0x5302d3){if(_0x5302d3){_0x3b2d92=_0x5302d3;_0x50ea89[_0x9f10('0x36')]=_[_0x9f10('0x32')](db[_0x9f10('0x51')]['rawAttributes']);_0x50ea89[_0x9f10('0x33')]=_[_0x9f10('0x32')](_0x5708c1['query']);_0x50ea89[_0x9f10('0x34')]=_['intersection'](_0x50ea89['model'],_0x50ea89[_0x9f10('0x33')]);_0x6b3eb6[_0x9f10('0x37')]=_[_0x9f10('0x35')](_0x50ea89[_0x9f10('0x36')],qs[_0x9f10('0x38')](_0x5708c1[_0x9f10('0x33')][_0x9f10('0x38')]));_0x6b3eb6['attributes']=_0x6b3eb6[_0x9f10('0x37')][_0x9f10('0x39')]?_0x6b3eb6[_0x9f10('0x37')]:_0x50ea89[_0x9f10('0x36')];_0x6b3eb6[_0x9f10('0x3b')]=qs[_0x9f10('0x3c')](_0x5708c1[_0x9f10('0x33')][_0x9f10('0x3c')]);_0x6b3eb6[_0x9f10('0x3d')]=qs['filters'](_[_0x9f10('0x52')](_0x5708c1[_0x9f10('0x33')],_0x50ea89[_0x9f10('0x34')]));if(_0x5708c1[_0x9f10('0x33')]['filter']){_0x6b3eb6[_0x9f10('0x3d')]=_[_0x9f10('0x3f')](_0x6b3eb6[_0x9f10('0x3d')],{'$or':_[_0x9f10('0x40')](_0x6b3eb6['attributes'],function(_0x57ac53){var _0x7f13fa={};_0x7f13fa[_0x57ac53]={'$like':'%'+_0x5708c1[_0x9f10('0x33')][_0x9f10('0x3e')]+'%'};return _0x7f13fa;})});}_0x6b3eb6=_[_0x9f10('0x3f')]({},_0x6b3eb6,_0x5708c1[_0x9f10('0x44')]);return _0x3b2d92[_0x9f10('0x55')](_0x6b3eb6);}})[_0x9f10('0x2c')](function(_0x25a1d7){if(_0x25a1d7){_0x5a64ae=_0x25a1d7[_0x9f10('0x39')];if(!_0x5708c1[_0x9f10('0x33')][_0x9f10('0x3a')](_0x9f10('0x56'))){_0x6b3eb6[_0x9f10('0x28')]=qs[_0x9f10('0x28')](_0x5708c1[_0x9f10('0x33')]['limit']);_0x6b3eb6[_0x9f10('0x27')]=qs[_0x9f10('0x27')](_0x5708c1['query'][_0x9f10('0x27')]);}return _0x3b2d92[_0x9f10('0x55')](_0x6b3eb6);}})[_0x9f10('0x2c')](function(_0x24118b){if(_0x24118b){return _0x24118b?{'count':_0x5a64ae,'rows':_0x24118b}:null;}})['then'](respondWithResult(_0x3b1893,null))[_0x9f10('0x48')](handleError(_0x3b1893,null));};exports['getDescriptions']=function(_0x143c8b,_0x38667a,_0x35f461){var _0x59b527={};var _0x26edd6={};var _0x351766;var _0x4139c6;return db['ServicenowConfiguration'][_0x9f10('0x54')]({'where':{'id':_0x143c8b[_0x9f10('0x50')]['id']}})[_0x9f10('0x2c')](handleEntityNotFound(_0x38667a,null))['then'](function(_0x4f2430){if(_0x4f2430){_0x351766=_0x4f2430;_0x26edd6['model']=_['keys'](db['ServicenowField']['rawAttributes']);_0x26edd6['query']=_[_0x9f10('0x32')](_0x143c8b[_0x9f10('0x33')]);_0x26edd6['filters']=_[_0x9f10('0x35')](_0x26edd6[_0x9f10('0x36')],_0x26edd6[_0x9f10('0x33')]);_0x59b527[_0x9f10('0x37')]=_[_0x9f10('0x35')](_0x26edd6[_0x9f10('0x36')],qs[_0x9f10('0x38')](_0x143c8b[_0x9f10('0x33')][_0x9f10('0x38')]));_0x59b527[_0x9f10('0x37')]=_0x59b527['attributes'][_0x9f10('0x39')]?_0x59b527[_0x9f10('0x37')]:_0x26edd6['model'];_0x59b527[_0x9f10('0x3b')]=qs['sort'](_0x143c8b['query'][_0x9f10('0x3c')]);_0x59b527[_0x9f10('0x3d')]=qs['filters'](_[_0x9f10('0x52')](_0x143c8b[_0x9f10('0x33')],_0x26edd6['filters']));if(_0x143c8b[_0x9f10('0x33')][_0x9f10('0x3e')]){_0x59b527[_0x9f10('0x3d')]=_['merge'](_0x59b527[_0x9f10('0x3d')],{'$or':_[_0x9f10('0x40')](_0x59b527['attributes'],function(_0x48c017){var _0xfd6899={};_0xfd6899[_0x48c017]={'$like':'%'+_0x143c8b[_0x9f10('0x33')]['filter']+'%'};return _0xfd6899;})});}_0x59b527=_[_0x9f10('0x3f')]({},_0x59b527,_0x143c8b[_0x9f10('0x44')]);return _0x351766['getDescriptions'](_0x59b527);}})['then'](function(_0x36fe07){if(_0x36fe07){_0x4139c6=_0x36fe07[_0x9f10('0x39')];if(!_0x143c8b['query']['hasOwnProperty'](_0x9f10('0x56'))){_0x59b527[_0x9f10('0x28')]=qs['limit'](_0x143c8b[_0x9f10('0x33')][_0x9f10('0x28')]);_0x59b527[_0x9f10('0x27')]=qs[_0x9f10('0x27')](_0x143c8b[_0x9f10('0x33')]['offset']);}return _0x351766['getDescriptions'](_0x59b527);}})['then'](function(_0x5e1e9a){if(_0x5e1e9a){return _0x5e1e9a?{'count':_0x4139c6,'rows':_0x5e1e9a}:null;}})[_0x9f10('0x2c')](respondWithResult(_0x38667a,null))[_0x9f10('0x48')](handleError(_0x38667a,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 46f03d3..cd85a4b 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7a7=['define','ServicenowConfiguration','lodash','util','bluebird','./intServicenowConfiguration.attributes','exports'];(function(_0x14c58a,_0x24651e){var _0x32e605=function(_0xeda35){while(--_0xeda35){_0x14c58a['push'](_0x14c58a['shift']());}};_0x32e605(++_0x24651e);}(_0xb7a7,0xaa));var _0x7b7a=function(_0x45e884,_0x54c75b){_0x45e884=_0x45e884-0x0;var _0x6dbd04=_0xb7a7[_0x45e884];return _0x6dbd04;};'use strict';var _=require(_0x7b7a('0x0'));var util=require(_0x7b7a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7b7a('0x2'));var rp=require('request-promise');var attributes=require(_0x7b7a('0x3'));module[_0x7b7a('0x4')]=function(_0x586cd2,_0x500492){return _0x586cd2[_0x7b7a('0x5')](_0x7b7a('0x6'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ab2=['../../config/logger','api','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','lodash','util'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0x0ab2,0x1ae));var _0x20ab=function(_0x1f289f,_0x2f2384){_0x1f289f=_0x1f289f-0x0;var _0x42e783=_0x0ab2[_0x1f289f];return _0x42e783;};'use strict';var _=require(_0x20ab('0x0'));var util=require(_0x20ab('0x1'));var logger=require(_0x20ab('0x2'))(_0x20ab('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x20ab('0x4'));module[_0x20ab('0x5')]=function(_0x5aa5e9,_0x5efff6){return _0x5aa5e9['define'](_0x20ab('0x6'),attributes,{'tableName':_0x20ab('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 5b90495..d672634 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3992=['result','catch','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0xd42ff,_0x382cff){var _0x5247f9=function(_0x46134e){while(--_0x46134e){_0xd42ff['push'](_0xd42ff['shift']());}};_0x5247f9(++_0x382cff);}(_0x3992,0xca));var _0x2399=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x3992[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2399('0x0'));var BPromise=require(_0x2399('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2399('0x2'))['db'];var utils=require(_0x2399('0x3'));var logger=require(_0x2399('0x4'))(_0x2399('0x5'));var config=require(_0x2399('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2399('0x7')][_0x2399('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x581c83,_0x302d74,_0x5be37d){return new BPromise(function(_0x1c76c6,_0x765b13){return client[_0x2399('0x9')](_0x581c83,_0x5be37d)[_0x2399('0xa')](function(_0x1d93e9){logger[_0x2399('0xb')](_0x2399('0xc'),_0x302d74,_0x2399('0xd'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x302d74,_0x2399('0xd'),JSON[_0x2399('0xe')](_0x1d93e9));if(_0x1d93e9[_0x2399('0xf')]){if(_0x1d93e9['error'][_0x2399('0x10')]===0x1f4){logger['error'](_0x2399('0xc'),_0x302d74,_0x1d93e9[_0x2399('0xf')][_0x2399('0x11')]);return _0x765b13(_0x1d93e9['error'][_0x2399('0x11')]);}logger['error'](_0x2399('0xc'),_0x302d74,_0x1d93e9[_0x2399('0xf')][_0x2399('0x11')]);return _0x1c76c6(_0x1d93e9[_0x2399('0xf')][_0x2399('0x11')]);}else{logger[_0x2399('0xb')](_0x2399('0xc'),_0x302d74,'request\x20sent');_0x1c76c6(_0x1d93e9[_0x2399('0x12')][_0x2399('0x11')]);}})[_0x2399('0x13')](function(_0x179628){logger[_0x2399('0xf')](_0x2399('0xc'),_0x302d74,_0x179628);_0x765b13(_0x179628);});});} \ No newline at end of file +var _0x3653=['../../config/environment','jayson/promise','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0xa4524a,_0x1fbb80){var _0x1a401a=function(_0x2102bd){while(--_0x2102bd){_0xa4524a['push'](_0xa4524a['shift']());}};_0x1a401a(++_0x1fbb80);}(_0x3653,0xbf));var _0x3365=function(_0x247b3d,_0x274802){_0x247b3d=_0x247b3d-0x0;var _0x42ed47=_0x3653[_0x247b3d];return _0x42ed47;};'use strict';var _=require(_0x3365('0x0'));var util=require(_0x3365('0x1'));var moment=require(_0x3365('0x2'));var BPromise=require(_0x3365('0x3'));var rs=require(_0x3365('0x4'));var fs=require('fs');var Redis=require(_0x3365('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3365('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x3365('0x7'));var jayson=require(_0x3365('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x24f930,_0x4f56d9,_0x21b19f){return new BPromise(function(_0x3c28dd,_0x40bed8){return client[_0x3365('0x9')](_0x24f930,_0x21b19f)[_0x3365('0xa')](function(_0x2f20ab){logger[_0x3365('0xb')](_0x3365('0xc'),_0x4f56d9,_0x3365('0xd'));logger[_0x3365('0xe')](_0x3365('0xf'),_0x4f56d9,'request\x20sent',JSON[_0x3365('0x10')](_0x2f20ab));if(_0x2f20ab[_0x3365('0x11')]){if(_0x2f20ab['error'][_0x3365('0x12')]===0x1f4){logger[_0x3365('0x11')](_0x3365('0xc'),_0x4f56d9,_0x2f20ab[_0x3365('0x11')][_0x3365('0x13')]);return _0x40bed8(_0x2f20ab['error']['message']);}logger['error'](_0x3365('0xc'),_0x4f56d9,_0x2f20ab[_0x3365('0x11')][_0x3365('0x13')]);return _0x3c28dd(_0x2f20ab[_0x3365('0x11')][_0x3365('0x13')]);}else{logger[_0x3365('0xb')](_0x3365('0xc'),_0x4f56d9,_0x3365('0xd'));_0x3c28dd(_0x2f20ab[_0x3365('0x14')][_0x3365('0x13')]);}})[_0x3365('0x15')](function(_0xc37d73){logger[_0x3365('0x11')](_0x3365('0xc'),_0x4f56d9,_0xc37d73);_0x40bed8(_0xc37d73);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 8ed2d90..3e1256c 100644 --- a/server/api/intServicenowField/index.js +++ b/server/api/intServicenowField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ce0=['multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','create','put','update'];(function(_0x1c676d,_0x4a62ea){var _0x287e93=function(_0x53b1b0){while(--_0x53b1b0){_0x1c676d['push'](_0x1c676d['shift']());}};_0x287e93(++_0x4a62ea);}(_0x8ce0,0x7e));var _0x08ce=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x8ce0[_0x5627e1];return _0x2f013f;};'use strict';var multer=require(_0x08ce('0x0'));var util=require(_0x08ce('0x1'));var path=require(_0x08ce('0x2'));var timeout=require(_0x08ce('0x3'));var express=require(_0x08ce('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x08ce('0x5'));var config=require(_0x08ce('0x6'));var controller=require(_0x08ce('0x7'));router[_0x08ce('0x8')]('/',auth[_0x08ce('0x9')](),controller['index']);router['get'](_0x08ce('0xa'),auth[_0x08ce('0x9')](),controller['show']);router['post']('/',auth[_0x08ce('0x9')](),controller[_0x08ce('0xb')]);router[_0x08ce('0xc')](_0x08ce('0xa'),auth[_0x08ce('0x9')](),controller[_0x08ce('0xd')]);router['delete'](_0x08ce('0xa'),auth[_0x08ce('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x17c4=['isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','../../config/environment','./intServicenowField.controller'];(function(_0x1c38e0,_0x286a4f){var _0x13b065=function(_0x20e01f){while(--_0x20e01f){_0x1c38e0['push'](_0x1c38e0['shift']());}};_0x13b065(++_0x286a4f);}(_0x17c4,0x14f));var _0x417c=function(_0x383627,_0x5be16e){_0x383627=_0x383627-0x0;var _0x2c16a0=_0x17c4[_0x383627];return _0x2c16a0;};'use strict';var multer=require(_0x417c('0x0'));var util=require(_0x417c('0x1'));var path=require(_0x417c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x417c('0x3'));var controller=require(_0x417c('0x4'));router['get']('/',auth[_0x417c('0x5')](),controller[_0x417c('0x6')]);router[_0x417c('0x7')](_0x417c('0x8'),auth['isAuthenticated'](),controller[_0x417c('0x9')]);router[_0x417c('0xa')]('/',auth[_0x417c('0x5')](),controller[_0x417c('0xb')]);router[_0x417c('0xc')](_0x417c('0x8'),auth[_0x417c('0x5')](),controller[_0x417c('0xd')]);router[_0x417c('0xe')](_0x417c('0x8'),auth[_0x417c('0x5')](),controller[_0x417c('0xf')]);module[_0x417c('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index dae040f..c138157 100644 --- a/server/api/intServicenowField/intServicenowField.attributes.js +++ b/server/api/intServicenowField/intServicenowField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c00=['string','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue'];(function(_0x28e90d,_0x3d6244){var _0x103d54=function(_0x21bd66){while(--_0x21bd66){_0x28e90d['push'](_0x28e90d['shift']());}};_0x103d54(++_0x3d6244);}(_0x5c00,0x17e));var _0x05c0=function(_0x113e32,_0x5339f0){_0x113e32=_0x113e32-0x0;var _0x4ff939=_0x5c00[_0x113e32];return _0x4ff939;};'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 +var _0xb58b=['BOOLEAN','exports','ENUM','string','customVariable','keyValue','STRING','variable'];(function(_0x438550,_0x14e77b){var _0x270ad8=function(_0x20ff69){while(--_0x20ff69){_0x438550['push'](_0x438550['shift']());}};_0x270ad8(++_0x14e77b);}(_0xb58b,0x1f1));var _0xbb58=function(_0x35ae5f,_0x3d873b){_0x35ae5f=_0x35ae5f-0x0;var _0x1860f3=_0xb58b[_0x35ae5f];return _0x1860f3;};'use strict';var Sequelize=require('sequelize');module[_0xbb58('0x0')]={'type':{'type':Sequelize[_0xbb58('0x1')](_0xbb58('0x2'),'variable',_0xbb58('0x3'),_0xbb58('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xbb58('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xbb58('0x1')](_0xbb58('0x2'),_0xbb58('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xbb58('0x5')]},'idField':{'type':Sequelize[_0xbb58('0x5')]},'nameField':{'type':Sequelize[_0xbb58('0x5')]},'customField':{'type':Sequelize[_0xbb58('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbb58('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 3a596fe..2d3387d 100644 --- a/server/api/intServicenowField/intServicenowField.controller.js +++ b/server/api/intServicenowField/intServicenowField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6eea=['where','ServicenowField','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','update','destroy','then','end','error','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','sort','pick','filter','merge','map','type','key','VIRTUAL','field','options'];(function(_0x5bc024,_0x45ef7f){var _0x28f07d=function(_0x54fe86){while(--_0x54fe86){_0x5bc024['push'](_0x5bc024['shift']());}};_0x28f07d(++_0x45ef7f);}(_0x6eea,0xed));var _0xa6ee=function(_0x257e1f,_0x11a95a){_0x257e1f=_0x257e1f-0x0;var _0xa85736=_0x6eea[_0x257e1f];return _0xa85736;};'use strict';var pdf=require(_0xa6ee('0x0'));var emlformat=require(_0xa6ee('0x1'));var rimraf=require(_0xa6ee('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa6ee('0x3'));var rp=require(_0xa6ee('0x4'));var moment=require(_0xa6ee('0x5'));var BPromise=require(_0xa6ee('0x6'));var Mustache=require(_0xa6ee('0x7'));var util=require(_0xa6ee('0x8'));var path=require('path');var sox=require(_0xa6ee('0x9'));var csv=require(_0xa6ee('0xa'));var ejs=require(_0xa6ee('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa6ee('0xc'));var jsforce=require(_0xa6ee('0xd'));var deskjs=require(_0xa6ee('0xe'));var toCsv=require(_0xa6ee('0xa'));var querystring=require(_0xa6ee('0xf'));var Papa=require(_0xa6ee('0x10'));var authService=require(_0xa6ee('0x11'));var hardwareService=require(_0xa6ee('0x12'));var Redis=require(_0xa6ee('0x13'));var qs=require(_0xa6ee('0x14'));var logger=require(_0xa6ee('0x15'))(_0xa6ee('0x16'));var utils=require(_0xa6ee('0x17'));var config=require(_0xa6ee('0x18'));var db=require(_0xa6ee('0x19'))['db'];function respondWithStatusCode(_0x245588,_0x3d1c60){_0x3d1c60=_0x3d1c60||0xcc;return function(_0x1af35a){if(_0x1af35a){return _0x245588[_0xa6ee('0x1a')](_0x3d1c60);}return _0x245588[_0xa6ee('0x1b')](_0x3d1c60)['end']();};}function respondWithResult(_0x2c2d72,_0x77790e){_0x77790e=_0x77790e||0xc8;return function(_0x13a405){if(_0x13a405){return _0x2c2d72[_0xa6ee('0x1b')](_0x77790e)[_0xa6ee('0x1c')](_0x13a405);}};}function respondWithFilteredResult(_0x50e235,_0x2ee75a){return function(_0x47412d){if(_0x47412d){var _0x483ed8=_0x47412d[_0xa6ee('0x1d')],_0x321375=_0x2ee75a[_0xa6ee('0x1e')],_0x5f2daf=_0x2ee75a[_0xa6ee('0x1e')]+_0x2ee75a[_0xa6ee('0x1f')],_0x2e7bad;if(_0x5f2daf>=_0x483ed8){_0x5f2daf=_0x483ed8;_0x2e7bad=0xc8;}else{_0x2e7bad=0xce;}_0x50e235[_0xa6ee('0x1b')](_0x2e7bad);return _0x50e235['set'](_0xa6ee('0x20'),_0x321375+'-'+_0x5f2daf+'/'+_0x483ed8)[_0xa6ee('0x1c')](_0x47412d);}return null;};}function patchUpdates(_0x30912e){return function(_0x237606){try{jsonpatch[_0xa6ee('0x21')](_0x237606,_0x30912e,!![]);}catch(_0x540982){return BPromise['reject'](_0x540982);}return _0x237606[_0xa6ee('0x22')]();};}function saveUpdates(_0x4521fa,_0x4a9524){return function(_0x2b49db){if(_0x2b49db){return _0x2b49db[_0xa6ee('0x23')](_0x4521fa)['then'](function(_0x12fc07){return _0x12fc07;});}return null;};}function removeEntity(_0x478f9a,_0x9a4f7d){return function(_0x34e9c1){if(_0x34e9c1){return _0x34e9c1[_0xa6ee('0x24')]()[_0xa6ee('0x25')](function(){_0x478f9a[_0xa6ee('0x1b')](0xcc)[_0xa6ee('0x26')]();});}};}function handleEntityNotFound(_0x13251c,_0x2d3526){return function(_0x3c981b){if(!_0x3c981b){_0x13251c['sendStatus'](0x194);}return _0x3c981b;};}function handleError(_0x33bfc6,_0x3f14ee){_0x3f14ee=_0x3f14ee||0x1f4;return function(_0x470ab2){logger[_0xa6ee('0x27')](_0x470ab2[_0xa6ee('0x28')]);if(_0x470ab2[_0xa6ee('0x29')]){delete _0x470ab2[_0xa6ee('0x29')];}_0x33bfc6[_0xa6ee('0x1b')](_0x3f14ee)[_0xa6ee('0x2a')](_0x470ab2);};}exports[_0xa6ee('0x2b')]=function(_0x4422f5,_0x357257){var _0x635315={},_0x14b2c2={},_0x3abb86={'count':0x0,'rows':[]};var _0x55c7e3=db['ServicenowField'][_0xa6ee('0x2c')];_0x14b2c2[_0xa6ee('0x2d')]=_[_0xa6ee('0x2e')](_0x55c7e3);_0x14b2c2[_0xa6ee('0x2f')]=_['keys'](_0x4422f5['query']);_0x14b2c2[_0xa6ee('0x30')]=_['intersection'](_0x14b2c2[_0xa6ee('0x2d')],_0x14b2c2[_0xa6ee('0x2f')]);_0x635315['attributes']=_[_0xa6ee('0x31')](_0x14b2c2[_0xa6ee('0x2d')],qs[_0xa6ee('0x32')](_0x4422f5[_0xa6ee('0x2f')][_0xa6ee('0x32')]));_0x635315[_0xa6ee('0x33')]=_0x635315[_0xa6ee('0x33')][_0xa6ee('0x34')]?_0x635315[_0xa6ee('0x33')]:_0x14b2c2[_0xa6ee('0x2d')];if(!_0x4422f5[_0xa6ee('0x2f')]['hasOwnProperty']('nolimit')){_0x635315[_0xa6ee('0x1f')]=qs[_0xa6ee('0x1f')](_0x4422f5[_0xa6ee('0x2f')][_0xa6ee('0x1f')]);_0x635315[_0xa6ee('0x1e')]=qs['offset'](_0x4422f5[_0xa6ee('0x2f')][_0xa6ee('0x1e')]);}_0x635315['order']=qs[_0xa6ee('0x35')](_0x4422f5[_0xa6ee('0x2f')]['sort']);_0x635315['where']=qs['filters'](_[_0xa6ee('0x36')](_0x4422f5[_0xa6ee('0x2f')],_0x14b2c2[_0xa6ee('0x30')]));if(_0x4422f5['query'][_0xa6ee('0x37')]){_0x635315['where']=_[_0xa6ee('0x38')](_0x635315['where'],{'$or':_[_0xa6ee('0x39')](_0x55c7e3,function(_0x51a094){if(_0x51a094[_0xa6ee('0x3a')][_0xa6ee('0x3b')]!==_0xa6ee('0x3c')){var _0x142bce={};_0x142bce[_0x51a094[_0xa6ee('0x3d')]]={'$like':'%'+_0x4422f5[_0xa6ee('0x2f')][_0xa6ee('0x37')]+'%'};return _0x142bce;}})});}_0x635315=_[_0xa6ee('0x38')]({},_0x635315,_0x4422f5[_0xa6ee('0x3e')]);var _0x15146e={'where':_0x635315[_0xa6ee('0x3f')]};return db[_0xa6ee('0x40')][_0xa6ee('0x1d')](_0x15146e)[_0xa6ee('0x25')](function(_0x2c9379){_0x3abb86[_0xa6ee('0x1d')]=_0x2c9379;if(_0x4422f5[_0xa6ee('0x2f')][_0xa6ee('0x41')]){_0x635315[_0xa6ee('0x42')]=[{'all':!![]}];}return db[_0xa6ee('0x40')][_0xa6ee('0x43')](_0x635315);})[_0xa6ee('0x25')](function(_0x8bcabc){_0x3abb86[_0xa6ee('0x44')]=_0x8bcabc;return _0x3abb86;})[_0xa6ee('0x25')](respondWithFilteredResult(_0x357257,_0x635315))[_0xa6ee('0x45')](handleError(_0x357257,null));};exports[_0xa6ee('0x46')]=function(_0x2bcd46,_0x5b43cb){var _0x151988={'raw':!![],'where':{'id':_0x2bcd46[_0xa6ee('0x47')]['id']}},_0x3a0f61={};_0x3a0f61[_0xa6ee('0x2d')]=_['keys'](db[_0xa6ee('0x40')][_0xa6ee('0x2c')]);_0x3a0f61[_0xa6ee('0x2f')]=_[_0xa6ee('0x2e')](_0x2bcd46[_0xa6ee('0x2f')]);_0x3a0f61[_0xa6ee('0x30')]=_[_0xa6ee('0x31')](_0x3a0f61[_0xa6ee('0x2d')],_0x3a0f61['query']);_0x151988['attributes']=_[_0xa6ee('0x31')](_0x3a0f61['model'],qs[_0xa6ee('0x32')](_0x2bcd46[_0xa6ee('0x2f')][_0xa6ee('0x32')]));_0x151988[_0xa6ee('0x33')]=_0x151988['attributes'][_0xa6ee('0x34')]?_0x151988[_0xa6ee('0x33')]:_0x3a0f61[_0xa6ee('0x2d')];if(_0x2bcd46[_0xa6ee('0x2f')][_0xa6ee('0x41')]){_0x151988[_0xa6ee('0x42')]=[{'all':!![]}];}_0x151988=_[_0xa6ee('0x38')]({},_0x151988,_0x2bcd46['options']);return db[_0xa6ee('0x40')][_0xa6ee('0x48')](_0x151988)['then'](handleEntityNotFound(_0x5b43cb,null))[_0xa6ee('0x25')](respondWithResult(_0x5b43cb,null))[_0xa6ee('0x45')](handleError(_0x5b43cb,null));};exports[_0xa6ee('0x49')]=function(_0x28b0d7,_0x2f8ea1){return db[_0xa6ee('0x40')][_0xa6ee('0x49')](_0x28b0d7[_0xa6ee('0x4a')],{})[_0xa6ee('0x25')](respondWithResult(_0x2f8ea1,0xc9))[_0xa6ee('0x45')](handleError(_0x2f8ea1,null));};exports['update']=function(_0x1af41,_0x1eaa55){if(_0x1af41[_0xa6ee('0x4a')]['id']){delete _0x1af41[_0xa6ee('0x4a')]['id'];}return db[_0xa6ee('0x40')]['find']({'where':{'id':_0x1af41[_0xa6ee('0x47')]['id']}})[_0xa6ee('0x25')](handleEntityNotFound(_0x1eaa55,null))[_0xa6ee('0x25')](saveUpdates(_0x1af41[_0xa6ee('0x4a')],null))[_0xa6ee('0x25')](respondWithResult(_0x1eaa55,null))['catch'](handleError(_0x1eaa55,null));};exports[_0xa6ee('0x24')]=function(_0x3f6d6d,_0x539c84){return db[_0xa6ee('0x40')][_0xa6ee('0x48')]({'where':{'id':_0x3f6d6d[_0xa6ee('0x47')]['id']}})[_0xa6ee('0x25')](handleEntityNotFound(_0x539c84,null))['then'](removeEntity(_0x539c84,null))[_0xa6ee('0x45')](handleError(_0x539c84,null));}; \ No newline at end of file +var _0xf957=['sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','length','create','body','find','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../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','ServicenowField','rawAttributes','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order'];(function(_0xca01b4,_0xb3130d){var _0x23582e=function(_0x51e9b5){while(--_0x51e9b5){_0xca01b4['push'](_0xca01b4['shift']());}};_0x23582e(++_0xb3130d);}(_0xf957,0x146));var _0x7f95=function(_0xecfcf2,_0x5b7b5f){_0xecfcf2=_0xecfcf2-0x0;var _0x512a53=_0xf957[_0xecfcf2];return _0x512a53;};'use strict';var pdf=require(_0x7f95('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7f95('0x1'));var zipdir=require(_0x7f95('0x2'));var jsonpatch=require(_0x7f95('0x3'));var rp=require(_0x7f95('0x4'));var moment=require('moment');var BPromise=require(_0x7f95('0x5'));var Mustache=require(_0x7f95('0x6'));var util=require('util');var path=require(_0x7f95('0x7'));var sox=require(_0x7f95('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7f95('0x9'));var crypto=require(_0x7f95('0xa'));var jsforce=require(_0x7f95('0xb'));var deskjs=require(_0x7f95('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7f95('0xd'));var Papa=require(_0x7f95('0xe'));var authService=require(_0x7f95('0xf'));var hardwareService=require(_0x7f95('0x10'));var Redis=require(_0x7f95('0x11'));var qs=require(_0x7f95('0x12'));var logger=require(_0x7f95('0x13'))(_0x7f95('0x14'));var utils=require('../../config/utils');var config=require(_0x7f95('0x15'));var db=require(_0x7f95('0x16'))['db'];function respondWithStatusCode(_0x1f2b0c,_0x81a59c){_0x81a59c=_0x81a59c||0xcc;return function(_0x408461){if(_0x408461){return _0x1f2b0c[_0x7f95('0x17')](_0x81a59c);}return _0x1f2b0c[_0x7f95('0x18')](_0x81a59c)[_0x7f95('0x19')]();};}function respondWithResult(_0x3461b7,_0x445800){_0x445800=_0x445800||0xc8;return function(_0x3fcc28){if(_0x3fcc28){return _0x3461b7[_0x7f95('0x18')](_0x445800)[_0x7f95('0x1a')](_0x3fcc28);}};}function respondWithFilteredResult(_0x9c9c51,_0x184610){return function(_0x410a3e){if(_0x410a3e){var _0x1456da=_0x410a3e[_0x7f95('0x1b')],_0x29d896=_0x184610[_0x7f95('0x1c')],_0xe6ebc9=_0x184610[_0x7f95('0x1c')]+_0x184610[_0x7f95('0x1d')],_0x58be06;if(_0xe6ebc9>=_0x1456da){_0xe6ebc9=_0x1456da;_0x58be06=0xc8;}else{_0x58be06=0xce;}_0x9c9c51['status'](_0x58be06);return _0x9c9c51[_0x7f95('0x1e')](_0x7f95('0x1f'),_0x29d896+'-'+_0xe6ebc9+'/'+_0x1456da)['json'](_0x410a3e);}return null;};}function patchUpdates(_0x587d09){return function(_0x2d6db3){try{jsonpatch[_0x7f95('0x20')](_0x2d6db3,_0x587d09,!![]);}catch(_0x42d548){return BPromise[_0x7f95('0x21')](_0x42d548);}return _0x2d6db3[_0x7f95('0x22')]();};}function saveUpdates(_0x22002b,_0xbfd7c8){return function(_0x44c7e6){if(_0x44c7e6){return _0x44c7e6[_0x7f95('0x23')](_0x22002b)[_0x7f95('0x24')](function(_0x588fb4){return _0x588fb4;});}return null;};}function removeEntity(_0x211825,_0x4fc7f6){return function(_0x52fd93){if(_0x52fd93){return _0x52fd93[_0x7f95('0x25')]()[_0x7f95('0x24')](function(){_0x211825['status'](0xcc)[_0x7f95('0x19')]();});}};}function handleEntityNotFound(_0x35f90a,_0x42b441){return function(_0x5ef30b){if(!_0x5ef30b){_0x35f90a[_0x7f95('0x17')](0x194);}return _0x5ef30b;};}function handleError(_0x463aa9,_0x204a92){_0x204a92=_0x204a92||0x1f4;return function(_0x1ffa16){logger[_0x7f95('0x26')](_0x1ffa16[_0x7f95('0x27')]);if(_0x1ffa16['name']){delete _0x1ffa16[_0x7f95('0x28')];}_0x463aa9[_0x7f95('0x18')](_0x204a92)[_0x7f95('0x29')](_0x1ffa16);};}exports[_0x7f95('0x2a')]=function(_0x5332bb,_0x3bb2c2){var _0x47be2b={},_0x41f789={},_0x57f2ff={'count':0x0,'rows':[]};var _0x4ea1c1=db[_0x7f95('0x2b')][_0x7f95('0x2c')];_0x41f789[_0x7f95('0x2d')]=_[_0x7f95('0x2e')](_0x4ea1c1);_0x41f789[_0x7f95('0x2f')]=_['keys'](_0x5332bb[_0x7f95('0x2f')]);_0x41f789[_0x7f95('0x30')]=_[_0x7f95('0x31')](_0x41f789[_0x7f95('0x2d')],_0x41f789[_0x7f95('0x2f')]);_0x47be2b['attributes']=_[_0x7f95('0x31')](_0x41f789[_0x7f95('0x2d')],qs[_0x7f95('0x32')](_0x5332bb[_0x7f95('0x2f')][_0x7f95('0x32')]));_0x47be2b['attributes']=_0x47be2b[_0x7f95('0x33')]['length']?_0x47be2b[_0x7f95('0x33')]:_0x41f789[_0x7f95('0x2d')];if(!_0x5332bb[_0x7f95('0x2f')][_0x7f95('0x34')]('nolimit')){_0x47be2b[_0x7f95('0x1d')]=qs[_0x7f95('0x1d')](_0x5332bb['query']['limit']);_0x47be2b['offset']=qs[_0x7f95('0x1c')](_0x5332bb['query'][_0x7f95('0x1c')]);}_0x47be2b[_0x7f95('0x35')]=qs[_0x7f95('0x36')](_0x5332bb[_0x7f95('0x2f')]['sort']);_0x47be2b[_0x7f95('0x37')]=qs['filters'](_[_0x7f95('0x38')](_0x5332bb[_0x7f95('0x2f')],_0x41f789[_0x7f95('0x30')]));if(_0x5332bb[_0x7f95('0x2f')][_0x7f95('0x39')]){_0x47be2b[_0x7f95('0x37')]=_[_0x7f95('0x3a')](_0x47be2b['where'],{'$or':_[_0x7f95('0x3b')](_0x4ea1c1,function(_0x22dc6a){if(_0x22dc6a[_0x7f95('0x3c')][_0x7f95('0x3d')]!==_0x7f95('0x3e')){var _0x2666e6={};_0x2666e6[_0x22dc6a[_0x7f95('0x3f')]]={'$like':'%'+_0x5332bb[_0x7f95('0x2f')][_0x7f95('0x39')]+'%'};return _0x2666e6;}})});}_0x47be2b=_['merge']({},_0x47be2b,_0x5332bb[_0x7f95('0x40')]);var _0x350b75={'where':_0x47be2b[_0x7f95('0x37')]};return db[_0x7f95('0x2b')]['count'](_0x350b75)[_0x7f95('0x24')](function(_0x5669bc){_0x57f2ff['count']=_0x5669bc;if(_0x5332bb[_0x7f95('0x2f')][_0x7f95('0x41')]){_0x47be2b[_0x7f95('0x42')]=[{'all':!![]}];}return db[_0x7f95('0x2b')][_0x7f95('0x43')](_0x47be2b);})[_0x7f95('0x24')](function(_0x17775a){_0x57f2ff[_0x7f95('0x44')]=_0x17775a;return _0x57f2ff;})[_0x7f95('0x24')](respondWithFilteredResult(_0x3bb2c2,_0x47be2b))[_0x7f95('0x45')](handleError(_0x3bb2c2,null));};exports[_0x7f95('0x46')]=function(_0x17c56e,_0x35b352){var _0x23b941={'raw':!![],'where':{'id':_0x17c56e['params']['id']}},_0x3d2a06={};_0x3d2a06[_0x7f95('0x2d')]=_['keys'](db[_0x7f95('0x2b')]['rawAttributes']);_0x3d2a06['query']=_[_0x7f95('0x2e')](_0x17c56e['query']);_0x3d2a06['filters']=_[_0x7f95('0x31')](_0x3d2a06[_0x7f95('0x2d')],_0x3d2a06[_0x7f95('0x2f')]);_0x23b941['attributes']=_[_0x7f95('0x31')](_0x3d2a06['model'],qs[_0x7f95('0x32')](_0x17c56e[_0x7f95('0x2f')]['fields']));_0x23b941[_0x7f95('0x33')]=_0x23b941[_0x7f95('0x33')][_0x7f95('0x47')]?_0x23b941[_0x7f95('0x33')]:_0x3d2a06[_0x7f95('0x2d')];if(_0x17c56e['query'][_0x7f95('0x41')]){_0x23b941[_0x7f95('0x42')]=[{'all':!![]}];}_0x23b941=_[_0x7f95('0x3a')]({},_0x23b941,_0x17c56e['options']);return db[_0x7f95('0x2b')]['find'](_0x23b941)[_0x7f95('0x24')](handleEntityNotFound(_0x35b352,null))[_0x7f95('0x24')](respondWithResult(_0x35b352,null))['catch'](handleError(_0x35b352,null));};exports['create']=function(_0x59f1d4,_0x87f56e){return db[_0x7f95('0x2b')][_0x7f95('0x48')](_0x59f1d4[_0x7f95('0x49')],{})[_0x7f95('0x24')](respondWithResult(_0x87f56e,0xc9))['catch'](handleError(_0x87f56e,null));};exports[_0x7f95('0x23')]=function(_0x1ff8a5,_0x52ab7b){if(_0x1ff8a5[_0x7f95('0x49')]['id']){delete _0x1ff8a5[_0x7f95('0x49')]['id'];}return db[_0x7f95('0x2b')][_0x7f95('0x4a')]({'where':{'id':_0x1ff8a5[_0x7f95('0x4b')]['id']}})[_0x7f95('0x24')](handleEntityNotFound(_0x52ab7b,null))[_0x7f95('0x24')](saveUpdates(_0x1ff8a5['body'],null))[_0x7f95('0x24')](respondWithResult(_0x52ab7b,null))[_0x7f95('0x45')](handleError(_0x52ab7b,null));};exports[_0x7f95('0x25')]=function(_0x55f81e,_0x40dc1e){return db[_0x7f95('0x2b')][_0x7f95('0x4a')]({'where':{'id':_0x55f81e[_0x7f95('0x4b')]['id']}})['then'](handleEntityNotFound(_0x40dc1e,null))[_0x7f95('0x24')](removeEntity(_0x40dc1e,null))[_0x7f95('0x45')](handleError(_0x40dc1e,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 61a9e2f..6cf0141 100644 --- a/server/api/intServicenowField/intServicenowField.model.js +++ b/server/api/intServicenowField/intServicenowField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9948=['define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./intServicenowField.attributes','exports'];(function(_0x402439,_0x3a830d){var _0xe4e4f7=function(_0x296761){while(--_0x296761){_0x402439['push'](_0x402439['shift']());}};_0xe4e4f7(++_0x3a830d);}(_0x9948,0xf3));var _0x8994=function(_0x161c41,_0x64b686){_0x161c41=_0x161c41-0x0;var _0x3aaa80=_0x9948[_0x161c41];return _0x3aaa80;};'use strict';var _=require(_0x8994('0x0'));var util=require(_0x8994('0x1'));var logger=require(_0x8994('0x2'))(_0x8994('0x3'));var moment=require(_0x8994('0x4'));var BPromise=require(_0x8994('0x5'));var rp=require(_0x8994('0x6'));var attributes=require(_0x8994('0x7'));module[_0x8994('0x8')]=function(_0x30ab53,_0x2ff781){return _0x30ab53[_0x8994('0x9')](_0x8994('0xa'),attributes,{'tableName':_0x8994('0xb'),'paranoid':![],'indexes':[{'name':_0x8994('0xc'),'fields':[_0x8994('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2eed=['request-promise','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','api','moment','bluebird'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0x2eed,0xf2));var _0xd2ee=function(_0x3bef3d,_0x3456ca){_0x3bef3d=_0x3bef3d-0x0;var _0xb0cf77=_0x2eed[_0x3bef3d];return _0xb0cf77;};'use strict';var _=require(_0xd2ee('0x0'));var util=require(_0xd2ee('0x1'));var logger=require('../../config/logger')(_0xd2ee('0x2'));var moment=require(_0xd2ee('0x3'));var BPromise=require(_0xd2ee('0x4'));var rp=require(_0xd2ee('0x5'));var attributes=require(_0xd2ee('0x6'));module[_0xd2ee('0x7')]=function(_0x49b2b3,_0x2d1527){return _0x49b2b3['define'](_0xd2ee('0x8'),attributes,{'tableName':_0xd2ee('0x9'),'paranoid':![],'indexes':[{'name':_0xd2ee('0xa'),'fields':[_0xd2ee('0xb'),_0xd2ee('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index aa49e05..27cff63 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a95=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x312039,_0x679015){var _0x307af1=function(_0x5b945c){while(--_0x5b945c){_0x312039['push'](_0x312039['shift']());}};_0x307af1(++_0x679015);}(_0x6a95,0x1db));var _0x56a9=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x6a95[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var moment=require(_0x56a9('0x2'));var BPromise=require(_0x56a9('0x3'));var rs=require(_0x56a9('0x4'));var fs=require('fs');var Redis=require(_0x56a9('0x5'));var db=require(_0x56a9('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x56a9('0x7'));var config=require(_0x56a9('0x8'));var jayson=require(_0x56a9('0x9'));var client=jayson[_0x56a9('0xa')][_0x56a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x365093,_0xd8aa7c,_0x5d3e80){return new BPromise(function(_0x5f0dcb,_0x3ac626){return client[_0x56a9('0xc')](_0x365093,_0x5d3e80)['then'](function(_0xe4b98c){logger[_0x56a9('0xd')](_0x56a9('0xe'),_0xd8aa7c,_0x56a9('0xf'));logger[_0x56a9('0x10')](_0x56a9('0x11'),_0xd8aa7c,_0x56a9('0xf'),JSON[_0x56a9('0x12')](_0xe4b98c));if(_0xe4b98c[_0x56a9('0x13')]){if(_0xe4b98c['error'][_0x56a9('0x14')]===0x1f4){logger['error'](_0x56a9('0xe'),_0xd8aa7c,_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x3ac626(_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);}logger[_0x56a9('0x13')](_0x56a9('0xe'),_0xd8aa7c,_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x5f0dcb(_0xe4b98c['error']['message']);}else{logger[_0x56a9('0xd')](_0x56a9('0xe'),_0xd8aa7c,_0x56a9('0xf'));_0x5f0dcb(_0xe4b98c[_0x56a9('0x16')]['message']);}})[_0x56a9('0x17')](function(_0x4853a3){logger['error']('ServicenowField,\x20%s,\x20%s',_0xd8aa7c,_0x4853a3);_0x3ac626(_0x4853a3);});});} \ No newline at end of file +var _0x7708=['message','lodash','util','bluebird','../../config/logger','rpc','jayson/promise','http','request','info','ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x483004,_0x394f0f){var _0x56aee2=function(_0x22f957){while(--_0x22f957){_0x483004['push'](_0x483004['shift']());}};_0x56aee2(++_0x394f0f);}(_0x7708,0x188));var _0x8770=function(_0x1fa381,_0x758c2a){_0x1fa381=_0x1fa381-0x0;var _0x47eefe=_0x7708[_0x1fa381];return _0x47eefe;};'use strict';var _=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var moment=require('moment');var BPromise=require(_0x8770('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8770('0x3'))(_0x8770('0x4'));var config=require('../../config/environment');var jayson=require(_0x8770('0x5'));var client=jayson['client'][_0x8770('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x42d305,_0x2b0295,_0x20e293){return new BPromise(function(_0x212b12,_0x3e1113){return client[_0x8770('0x7')](_0x42d305,_0x20e293)['then'](function(_0x396322){logger[_0x8770('0x8')](_0x8770('0x9'),_0x2b0295,'request\x20sent');logger[_0x8770('0xa')](_0x8770('0xb'),_0x2b0295,_0x8770('0xc'),JSON[_0x8770('0xd')](_0x396322));if(_0x396322['error']){if(_0x396322[_0x8770('0xe')][_0x8770('0xf')]===0x1f4){logger[_0x8770('0xe')]('ServicenowField,\x20%s,\x20%s',_0x2b0295,_0x396322[_0x8770('0xe')][_0x8770('0x10')]);return _0x3e1113(_0x396322[_0x8770('0xe')][_0x8770('0x10')]);}logger[_0x8770('0xe')](_0x8770('0x9'),_0x2b0295,_0x396322[_0x8770('0xe')][_0x8770('0x10')]);return _0x212b12(_0x396322['error'][_0x8770('0x10')]);}else{logger[_0x8770('0x8')]('ServicenowField,\x20%s,\x20%s',_0x2b0295,_0x8770('0xc'));_0x212b12(_0x396322['result'][_0x8770('0x10')]);}})['catch'](function(_0x5b4716){logger['error'](_0x8770('0x9'),_0x2b0295,_0x5b4716);_0x3e1113(_0x5b4716);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 9935998..341a34a 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 _0x0e98=['util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id/configurations','post','addConfiguration','put','update','delete','destroy'];(function(_0x3de0b4,_0x28b922){var _0xa81066=function(_0x4b0adb){while(--_0x4b0adb){_0x3de0b4['push'](_0x3de0b4['shift']());}};_0xa81066(++_0x28b922);}(_0x0e98,0x1c0));var _0x80e9=function(_0x200419,_0x4a84b8){_0x200419=_0x200419-0x0;var _0x32e6be=_0x0e98[_0x200419];return _0x32e6be;};'use strict';var multer=require('multer');var util=require(_0x80e9('0x0'));var path=require(_0x80e9('0x1'));var timeout=require(_0x80e9('0x2'));var express=require('express');var router=express[_0x80e9('0x3')]();var auth=require(_0x80e9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x80e9('0x5'));var controller=require('./intSugarcrmAccount.controller');router[_0x80e9('0x6')]('/',auth[_0x80e9('0x7')](),controller[_0x80e9('0x8')]);router[_0x80e9('0x6')]('/:id',auth[_0x80e9('0x7')](),controller['show']);router[_0x80e9('0x6')](_0x80e9('0x9'),auth['isAuthenticated'](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x80e9('0x7')](),controller['getFields']);router[_0x80e9('0xa')]('/',auth[_0x80e9('0x7')](),controller['create']);router['post'](_0x80e9('0x9'),auth[_0x80e9('0x7')](),controller[_0x80e9('0xb')]);router[_0x80e9('0xc')]('/:id',auth[_0x80e9('0x7')](),controller[_0x80e9('0xd')]);router[_0x80e9('0xe')]('/:id',auth[_0x80e9('0x7')](),controller[_0x80e9('0xf')]);module['exports']=router; \ No newline at end of file +var _0xcc57=['getFields','create','post','/:id/configurations','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcc57,0x98));var _0x7cc5=function(_0x8d9444,_0x4803f4){_0x8d9444=_0x8d9444-0x0;var _0x334b98=_0xcc57[_0x8d9444];return _0x334b98;};'use strict';var multer=require('multer');var util=require(_0x7cc5('0x0'));var path=require(_0x7cc5('0x1'));var timeout=require(_0x7cc5('0x2'));var express=require(_0x7cc5('0x3'));var router=express[_0x7cc5('0x4')]();var auth=require(_0x7cc5('0x5'));var interaction=require(_0x7cc5('0x6'));var config=require(_0x7cc5('0x7'));var controller=require(_0x7cc5('0x8'));router[_0x7cc5('0x9')]('/',auth[_0x7cc5('0xa')](),controller[_0x7cc5('0xb')]);router[_0x7cc5('0x9')](_0x7cc5('0xc'),auth['isAuthenticated'](),controller[_0x7cc5('0xd')]);router['get']('/:id/configurations',auth[_0x7cc5('0xa')](),controller[_0x7cc5('0xe')]);router[_0x7cc5('0x9')](_0x7cc5('0xf'),auth[_0x7cc5('0xa')](),controller[_0x7cc5('0x10')]);router['post']('/',auth[_0x7cc5('0xa')](),controller[_0x7cc5('0x11')]);router[_0x7cc5('0x12')](_0x7cc5('0x13'),auth[_0x7cc5('0xa')](),controller['addConfiguration']);router[_0x7cc5('0x14')](_0x7cc5('0xc'),auth[_0x7cc5('0xa')](),controller[_0x7cc5('0x15')]);router[_0x7cc5('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7cc5('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 3e0b3e9..a406f72 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 _0xbdd4=['sequelize','exports','STRING','username','remoteUri'];(function(_0x14a0a0,_0x45d0cf){var _0x56b651=function(_0x1fae09){while(--_0x1fae09){_0x14a0a0['push'](_0x14a0a0['shift']());}};_0x56b651(++_0x45d0cf);}(_0xbdd4,0x1db));var _0x4bdd=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xbdd4[_0x481bf7];return _0x461787;};'use strict';var Sequelize=require(_0x4bdd('0x0'));module[_0x4bdd('0x1')]={'name':{'type':Sequelize[_0x4bdd('0x2')]},'description':{'type':Sequelize[_0x4bdd('0x2')]},'username':{'type':Sequelize[_0x4bdd('0x2')],'unique':_0x4bdd('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4bdd('0x2')],'unique':_0x4bdd('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3e0a=['remoteUri','exports','STRING','username'];(function(_0x6d76e8,_0x3a5b96){var _0x10a933=function(_0xcca43b){while(--_0xcca43b){_0x6d76e8['push'](_0x6d76e8['shift']());}};_0x10a933(++_0x3a5b96);}(_0x3e0a,0xb9));var _0xa3e0=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x3e0a[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');module[_0xa3e0('0x0')]={'name':{'type':Sequelize[_0xa3e0('0x1')]},'description':{'type':Sequelize[_0xa3e0('0x1')]},'username':{'type':Sequelize[_0xa3e0('0x1')],'unique':_0xa3e0('0x2')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xa3e0('0x3')},'serverUrl':{'type':Sequelize[_0xa3e0('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 3079474..de7ad5a 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 _0x2481=['catch','sendStatus','status','json','offset','limit','set','reject','save','update','destroy','end','stack','name','send','index','SugarcrmAccount','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','key','field','options','count','includeAll','findAll','show','params','include','find','create','body','getConfigurations','findOne','order','map','addConfiguration','AccountId','Subjects','getSubjects','channel','SugarcrmField','Descriptions','getFields','assigned_user_id','description','date_start','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','get_module_fields','Calls','values','remove','includes','endsWith','value','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result'];(function(_0x3e1d5b,_0x1eb8af){var _0xf0ec21=function(_0x262ee4){while(--_0x262ee4){_0x3e1d5b['push'](_0x3e1d5b['shift']());}};_0xf0ec21(++_0x1eb8af);}(_0x2481,0x1d5));var _0x1248=function(_0x8500cc,_0x16bd8e){_0x8500cc=_0x8500cc-0x0;var _0x45b179=_0x2481[_0x8500cc];return _0x45b179;};'use strict';var pdf=require(_0x1248('0x0'));var emlformat=require(_0x1248('0x1'));var rimraf=require(_0x1248('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1248('0x3'));var rp=require('request-promise');var moment=require(_0x1248('0x4'));var BPromise=require(_0x1248('0x5'));var Mustache=require(_0x1248('0x6'));var util=require(_0x1248('0x7'));var path=require(_0x1248('0x8'));var sox=require(_0x1248('0x9'));var csv=require(_0x1248('0xa'));var ejs=require(_0x1248('0xb'));var fs=require('fs');var _=require(_0x1248('0xc'));var squel=require(_0x1248('0xd'));var crypto=require('crypto');var jsforce=require(_0x1248('0xe'));var deskjs=require(_0x1248('0xf'));var toCsv=require(_0x1248('0xa'));var querystring=require('querystring');var Papa=require(_0x1248('0x10'));var authService=require(_0x1248('0x11'));var hardwareService=require(_0x1248('0x12'));var Redis=require(_0x1248('0x13'));var qs=require(_0x1248('0x14'));var logger=require(_0x1248('0x15'))(_0x1248('0x16'));var utils=require('../../config/utils');var config=require(_0x1248('0x17'));var db=require(_0x1248('0x18'))['db'];var integrations=require(_0x1248('0x19'));var jayson=require(_0x1248('0x1a'));var client=jayson[_0x1248('0x1b')][_0x1248('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4a10d2,_0x5ed054,_0x15d9fa,_0x526516){return new BPromise(function(_0x1541a7,_0x3bd240){var _0x2805d0=_0x526516||client;return _0x2805d0['request'](_0x4a10d2,_0x15d9fa)[_0x1248('0x1d')](function(_0x503854){logger[_0x1248('0x1e')]('SugarcrmAccount,\x20%s,\x20%s',_0x5ed054,_0x1248('0x1f'));logger[_0x1248('0x20')](_0x1248('0x21'),_0x5ed054,_0x1248('0x1f'),JSON['stringify'](_0x503854));if(_0x503854[_0x1248('0x22')]){if(_0x503854[_0x1248('0x22')][_0x1248('0x23')]===0x1f4){logger[_0x1248('0x22')](_0x1248('0x24'),_0x5ed054,_0x503854['error'][_0x1248('0x25')]);return _0x3bd240(_0x503854[_0x1248('0x22')]['message']);}logger[_0x1248('0x22')](_0x1248('0x24'),_0x5ed054,_0x503854[_0x1248('0x22')]['message']);return _0x1541a7(_0x503854[_0x1248('0x22')][_0x1248('0x25')]);}else{logger[_0x1248('0x1e')](_0x1248('0x24'),_0x5ed054,_0x1248('0x1f'));_0x1541a7(_0x503854[_0x1248('0x26')][_0x1248('0x25')]);}})[_0x1248('0x27')](function(_0x2deba6){logger[_0x1248('0x22')](_0x1248('0x24'),_0x5ed054,_0x2deba6);_0x3bd240(_0x2deba6);});});}function respondWithStatusCode(_0x4a276f,_0x1435a1){_0x1435a1=_0x1435a1||0xcc;return function(_0x33ab46){if(_0x33ab46){return _0x4a276f[_0x1248('0x28')](_0x1435a1);}return _0x4a276f[_0x1248('0x29')](_0x1435a1)['end']();};}function respondWithResult(_0xa53bfb,_0xf7e95a){_0xf7e95a=_0xf7e95a||0xc8;return function(_0x2f2923){if(_0x2f2923){return _0xa53bfb[_0x1248('0x29')](_0xf7e95a)[_0x1248('0x2a')](_0x2f2923);}};}function respondWithFilteredResult(_0x538c5f,_0x99f387){return function(_0x5ba62e){if(_0x5ba62e){var _0x2ff21f=_0x5ba62e['count'],_0x44b9eb=_0x99f387[_0x1248('0x2b')],_0xcd097a=_0x99f387[_0x1248('0x2b')]+_0x99f387[_0x1248('0x2c')],_0x4a35bc;if(_0xcd097a>=_0x2ff21f){_0xcd097a=_0x2ff21f;_0x4a35bc=0xc8;}else{_0x4a35bc=0xce;}_0x538c5f[_0x1248('0x29')](_0x4a35bc);return _0x538c5f[_0x1248('0x2d')]('Content-Range',_0x44b9eb+'-'+_0xcd097a+'/'+_0x2ff21f)['json'](_0x5ba62e);}return null;};}function patchUpdates(_0x2c0b7a){return function(_0x3e219b){try{jsonpatch['apply'](_0x3e219b,_0x2c0b7a,!![]);}catch(_0x79651d){return BPromise[_0x1248('0x2e')](_0x79651d);}return _0x3e219b[_0x1248('0x2f')]();};}function saveUpdates(_0x20c2e9,_0x1bb955){return function(_0x339820){if(_0x339820){return _0x339820[_0x1248('0x30')](_0x20c2e9)[_0x1248('0x1d')](function(_0x2d6d7c){return _0x2d6d7c;});}return null;};}function removeEntity(_0x375711,_0x24fb65){return function(_0x1c066b){if(_0x1c066b){return _0x1c066b[_0x1248('0x31')]()['then'](function(){_0x375711[_0x1248('0x29')](0xcc)[_0x1248('0x32')]();});}};}function handleEntityNotFound(_0x2d383d,_0x128a4d){return function(_0x1ec59e){if(!_0x1ec59e){_0x2d383d[_0x1248('0x28')](0x194);}return _0x1ec59e;};}function handleError(_0x5f14f6,_0x2653e3){_0x2653e3=_0x2653e3||0x1f4;return function(_0x50d60d){logger[_0x1248('0x22')](_0x50d60d[_0x1248('0x33')]);if(_0x50d60d[_0x1248('0x34')]){delete _0x50d60d[_0x1248('0x34')];}_0x5f14f6[_0x1248('0x29')](_0x2653e3)[_0x1248('0x35')](_0x50d60d);};}exports[_0x1248('0x36')]=function(_0x489bff,_0x18197b){var _0xdc27b5={},_0x39a795={},_0x45884c={'count':0x0,'rows':[]};var _0x4f6cb2=db[_0x1248('0x37')][_0x1248('0x38')];_0x39a795[_0x1248('0x39')]=_[_0x1248('0x3a')](_0x4f6cb2);_0x39a795[_0x1248('0x3b')]=_['keys'](_0x489bff[_0x1248('0x3b')]);_0x39a795[_0x1248('0x3c')]=_[_0x1248('0x3d')](_0x39a795[_0x1248('0x39')],_0x39a795[_0x1248('0x3b')]);_0xdc27b5[_0x1248('0x3e')]=_[_0x1248('0x3d')](_0x39a795[_0x1248('0x39')],qs[_0x1248('0x3f')](_0x489bff[_0x1248('0x3b')][_0x1248('0x3f')]));_0xdc27b5[_0x1248('0x3e')]=_0xdc27b5[_0x1248('0x3e')][_0x1248('0x40')]?_0xdc27b5[_0x1248('0x3e')]:_0x39a795['model'];if(!_0x489bff[_0x1248('0x3b')][_0x1248('0x41')](_0x1248('0x42'))){_0xdc27b5[_0x1248('0x2c')]=qs['limit'](_0x489bff[_0x1248('0x3b')][_0x1248('0x2c')]);_0xdc27b5['offset']=qs[_0x1248('0x2b')](_0x489bff['query'][_0x1248('0x2b')]);}_0xdc27b5['order']=qs[_0x1248('0x43')](_0x489bff[_0x1248('0x3b')][_0x1248('0x43')]);_0xdc27b5['where']=qs[_0x1248('0x3c')](_[_0x1248('0x44')](_0x489bff[_0x1248('0x3b')],_0x39a795[_0x1248('0x3c')]));if(_0x489bff['query'][_0x1248('0x45')]){_0xdc27b5[_0x1248('0x46')]=_[_0x1248('0x47')](_0xdc27b5[_0x1248('0x46')],{'$or':_['map'](_0x4f6cb2,function(_0x246102){if(_0x246102[_0x1248('0x48')][_0x1248('0x49')]!=='VIRTUAL'){var _0x33e71b={};_0x33e71b[_0x246102[_0x1248('0x4a')]]={'$like':'%'+_0x489bff['query']['filter']+'%'};return _0x33e71b;}})});}_0xdc27b5=_[_0x1248('0x47')]({},_0xdc27b5,_0x489bff[_0x1248('0x4b')]);var _0x2b1173={'where':_0xdc27b5[_0x1248('0x46')]};return db['SugarcrmAccount']['count'](_0x2b1173)['then'](function(_0x4eeb4b){_0x45884c[_0x1248('0x4c')]=_0x4eeb4b;if(_0x489bff[_0x1248('0x3b')][_0x1248('0x4d')]){_0xdc27b5['include']=[{'all':!![]}];}return db[_0x1248('0x37')][_0x1248('0x4e')](_0xdc27b5);})[_0x1248('0x1d')](function(_0x287744){_0x45884c['rows']=_0x287744;return _0x45884c;})[_0x1248('0x1d')](respondWithFilteredResult(_0x18197b,_0xdc27b5))[_0x1248('0x27')](handleError(_0x18197b,null));};exports[_0x1248('0x4f')]=function(_0x1dfe0e,_0x3e3c36){var _0x255563={'raw':![],'where':{'id':_0x1dfe0e[_0x1248('0x50')]['id']}},_0x4f52ec={};_0x4f52ec[_0x1248('0x39')]=_[_0x1248('0x3a')](db[_0x1248('0x37')]['rawAttributes']);_0x4f52ec[_0x1248('0x3b')]=_[_0x1248('0x3a')](_0x1dfe0e[_0x1248('0x3b')]);_0x4f52ec[_0x1248('0x3c')]=_['intersection'](_0x4f52ec[_0x1248('0x39')],_0x4f52ec[_0x1248('0x3b')]);_0x255563['attributes']=_[_0x1248('0x3d')](_0x4f52ec['model'],qs[_0x1248('0x3f')](_0x1dfe0e[_0x1248('0x3b')]['fields']));_0x255563[_0x1248('0x3e')]=_0x255563[_0x1248('0x3e')]['length']?_0x255563[_0x1248('0x3e')]:_0x4f52ec[_0x1248('0x39')];if(_0x1dfe0e[_0x1248('0x3b')][_0x1248('0x4d')]){_0x255563[_0x1248('0x51')]=[{'all':!![]}];}_0x255563=_[_0x1248('0x47')]({},_0x255563,_0x1dfe0e['options']);return db[_0x1248('0x37')][_0x1248('0x52')](_0x255563)[_0x1248('0x1d')](handleEntityNotFound(_0x3e3c36,null))[_0x1248('0x1d')](respondWithResult(_0x3e3c36,null))[_0x1248('0x27')](handleError(_0x3e3c36,null));};exports[_0x1248('0x53')]=function(_0x575d01,_0x2958d3){return db['SugarcrmAccount']['create'](_0x575d01[_0x1248('0x54')],{})[_0x1248('0x1d')](respondWithResult(_0x2958d3,0xc9))[_0x1248('0x27')](handleError(_0x2958d3,null));};exports[_0x1248('0x30')]=function(_0x2e3eec,_0x4880c9){if(_0x2e3eec[_0x1248('0x54')]['id']){delete _0x2e3eec[_0x1248('0x54')]['id'];}return db[_0x1248('0x37')][_0x1248('0x52')]({'where':{'id':_0x2e3eec[_0x1248('0x50')]['id']}})[_0x1248('0x1d')](handleEntityNotFound(_0x4880c9,null))[_0x1248('0x1d')](saveUpdates(_0x2e3eec['body'],null))[_0x1248('0x1d')](respondWithResult(_0x4880c9,null))[_0x1248('0x27')](handleError(_0x4880c9,null));};exports[_0x1248('0x31')]=function(_0x23b8b5,_0xdb5b4b){return db[_0x1248('0x37')]['find']({'where':{'id':_0x23b8b5['params']['id']}})['then'](handleEntityNotFound(_0xdb5b4b,null))[_0x1248('0x1d')](removeEntity(_0xdb5b4b,null))['catch'](handleError(_0xdb5b4b,null));};exports[_0x1248('0x55')]=function(_0x3c05ea,_0x18809c,_0x21061f){var _0x539d38={};var _0xab04e1={};var _0x3bd2c2;var _0x3cf560;return db['SugarcrmAccount'][_0x1248('0x56')]({'where':{'id':_0x3c05ea[_0x1248('0x50')]['id']}})[_0x1248('0x1d')](handleEntityNotFound(_0x18809c,null))[_0x1248('0x1d')](function(_0x1586d5){if(_0x1586d5){_0x3bd2c2=_0x1586d5;_0xab04e1['model']=_[_0x1248('0x3a')](db['SugarcrmConfiguration'][_0x1248('0x38')]);_0xab04e1[_0x1248('0x3b')]=_['keys'](_0x3c05ea['query']);_0xab04e1[_0x1248('0x3c')]=_[_0x1248('0x3d')](_0xab04e1[_0x1248('0x39')],_0xab04e1[_0x1248('0x3b')]);_0x539d38[_0x1248('0x3e')]=_[_0x1248('0x3d')](_0xab04e1[_0x1248('0x39')],qs[_0x1248('0x3f')](_0x3c05ea[_0x1248('0x3b')][_0x1248('0x3f')]));_0x539d38[_0x1248('0x3e')]=_0x539d38[_0x1248('0x3e')][_0x1248('0x40')]?_0x539d38[_0x1248('0x3e')]:_0xab04e1[_0x1248('0x39')];_0x539d38[_0x1248('0x57')]=qs[_0x1248('0x43')](_0x3c05ea[_0x1248('0x3b')][_0x1248('0x43')]);_0x539d38[_0x1248('0x46')]=qs[_0x1248('0x3c')](_['pick'](_0x3c05ea[_0x1248('0x3b')],_0xab04e1['filters']));if(_0x3c05ea[_0x1248('0x3b')][_0x1248('0x45')]){_0x539d38[_0x1248('0x46')]=_[_0x1248('0x47')](_0x539d38[_0x1248('0x46')],{'$or':_[_0x1248('0x58')](_0x539d38['attributes'],function(_0x37ae85){var _0x2b9422={};_0x2b9422[_0x37ae85]={'$like':'%'+_0x3c05ea['query'][_0x1248('0x45')]+'%'};return _0x2b9422;})});}_0x539d38=_[_0x1248('0x47')]({},_0x539d38,_0x3c05ea['options']);return _0x3bd2c2[_0x1248('0x55')](_0x539d38);}})['then'](function(_0x540862){if(_0x540862){_0x3cf560=_0x540862[_0x1248('0x40')];if(!_0x3c05ea[_0x1248('0x3b')][_0x1248('0x41')](_0x1248('0x42'))){_0x539d38[_0x1248('0x2c')]=qs[_0x1248('0x2c')](_0x3c05ea[_0x1248('0x3b')][_0x1248('0x2c')]);_0x539d38['offset']=qs[_0x1248('0x2b')](_0x3c05ea[_0x1248('0x3b')]['offset']);}return _0x3bd2c2[_0x1248('0x55')](_0x539d38);}})[_0x1248('0x1d')](function(_0x29eee9){if(_0x29eee9){return _0x29eee9?{'count':_0x3cf560,'rows':_0x29eee9}:null;}})[_0x1248('0x1d')](respondWithResult(_0x18809c,null))['catch'](handleError(_0x18809c,null));};exports[_0x1248('0x59')]=function(_0x3113cd,_0x1d3d4f,_0x5dcdcd){if(_0x3113cd[_0x1248('0x54')]['id']){delete _0x3113cd['body']['id'];}return db[_0x1248('0x37')][_0x1248('0x56')]({'where':{'id':_0x3113cd[_0x1248('0x50')]['id']}})[_0x1248('0x1d')](handleEntityNotFound(_0x1d3d4f,null))[_0x1248('0x1d')](function(_0x3d7f8f){if(_0x3d7f8f){_0x3113cd[_0x1248('0x54')][_0x1248('0x5a')]=_0x3d7f8f['id'];_0x3113cd[_0x1248('0x54')][_0x1248('0x5b')]=integrations[_0x1248('0x5c')](_0x3113cd[_0x1248('0x54')]['channel'],_0x3113cd[_0x1248('0x54')][_0x1248('0x48')]);_0x3113cd[_0x1248('0x54')]['Descriptions']=integrations['getDescriptions'](_0x3113cd[_0x1248('0x54')][_0x1248('0x5d')],_0x3113cd[_0x1248('0x54')]['type']);return db['SugarcrmConfiguration'][_0x1248('0x53')](_0x3113cd[_0x1248('0x54')],{'include':[{'model':db[_0x1248('0x5e')],'as':_0x1248('0x5b')},{'model':db[_0x1248('0x5e')],'as':_0x1248('0x5f')}]});}return null;})[_0x1248('0x1d')](respondWithResult(_0x1d3d4f,null))['catch'](handleError(_0x1d3d4f,null));};exports[_0x1248('0x60')]=function(_0x3ec501,_0x5774fb,_0x2754e1){var _0x50565b='';var _0x5bec67=['id','name',_0x1248('0x61'),'created_by',_0x1248('0x62'),_0x1248('0x63'),'duration_hours','duration_minutes','parent_id',_0x1248('0x64'),_0x1248('0x65'),_0x1248('0x66')];return db[_0x1248('0x37')][_0x1248('0x56')]({'where':{'id':_0x3ec501[_0x1248('0x50')]['id']},'attributes':['id',_0x1248('0x67'),_0x1248('0x68'),'remoteUri']})[_0x1248('0x1d')](handleEntityNotFound(_0x5774fb,null))['then'](function(_0x1fff74){if(_0x1fff74){_0x50565b=_0x1fff74[_0x1248('0x69')];var _0x2d1eb1=_0x50565b[_0x1248('0x6a')](-0x1);if(_0x2d1eb1==='/'){_0x50565b=_0x50565b[_0x1248('0x6b')](0x0,_0x50565b['lastIndexOf'](_0x2d1eb1));}return rp({'method':_0x1248('0x6c'),'uri':util[_0x1248('0x6d')](_0x1248('0x6e'),_0x50565b,_0x1248('0x6f')),'json':!![],'form':{'method':_0x1248('0x70'),'input_type':_0x1248('0x71'),'response_type':_0x1248('0x71'),'rest_data':JSON[_0x1248('0x72')]({'user_auth':{'user_name':_0x1fff74[_0x1248('0x67')],'password':_0x1fff74[_0x1248('0x68')],'encryption':_0x1248('0x73')},'application':_0x1248('0x74')})}});}})[_0x1248('0x1d')](function(_0x5e296c){if(_0x5e296c&&_0x5e296c[_0x1248('0x34')]!=='Invalid\x20Login'&&_0x5e296c[_0x1248('0x34')]!==_0x1248('0x75')){return rp({'method':'POST','uri':util[_0x1248('0x6d')](_0x1248('0x6e'),_0x50565b,_0x1248('0x6f')),'json':!![],'form':{'method':_0x1248('0x76'),'input_type':'JSON','response_type':_0x1248('0x71'),'rest_data':JSON[_0x1248('0x72')]({'session':_0x5e296c['id'],'module_name':_0x1248('0x77')})}})[_0x1248('0x1d')](function(_0x5a13b9){if(_0x5a13b9){var _0x526004=_[_0x1248('0x78')](_0x5a13b9['module_fields']);_[_0x1248('0x79')](_0x526004,function(_0x409de5){return _0x5bec67[_0x1248('0x7a')](_0x409de5[_0x1248('0x34')]);});return{'count':_0x526004[_0x1248('0x40')],'rows':_['map'](_0x526004,function(_0x4cfec1){return{'id':_0x4cfec1[_0x1248('0x34')],'name':_0x4cfec1['label'],'custom':_[_0x1248('0x7b')](_0x4cfec1['name'],'_c')?!![]:![],'options':_0x4cfec1['options']?_[_0x1248('0x58')](_['values'](_0x4cfec1[_0x1248('0x4b')]),function(_0x528f7a){return{'name':_0x528f7a[_0x1248('0x7c')],'value':_0x528f7a[_0x1248('0x34')]};}):[]};})};}})[_0x1248('0x1d')](respondWithResult(_0x5774fb,null))[_0x1248('0x27')](function(_0xd3def2){var _0xd0291e=_0x3ec501[_0x1248('0x3b')][_0x1248('0x7d')]?0x1f4:_0xd3def2['statusCode']||0x1f4;logger[_0x1248('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0x1248('0x60'),_0xd0291e,JSON[_0x1248('0x72')](_0xd3def2));delete _0xd3def2['name'];if(_0xd0291e===0x191){_0xd0291e=0x190;}_0x5774fb[_0x1248('0x29')](_0xd0291e)[_0x1248('0x35')](_0x3ec501[_0x1248('0x3b')]['test']?{'message':_0x1248('0x7e'),'statusCode':_0xd3def2['statusCode']}:_0xd3def2);});}else{var _0x1c26f2=0x1f4;_0x5774fb[_0x1248('0x29')](_0x1c26f2)[_0x1248('0x35')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x801b=['save','update','destroy','end','stack','name','send','index','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','offset','order','sort','filter','where','merge','map','type','key','field','SugarcrmAccount','findAll','rows','includeAll','find','catch','body','params','getConfigurations','findOne','SugarcrmConfiguration','options','nolimit','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','create','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','POST','format','login','JSON','stringify','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','%s%s','Calls','module_fields','remove','includes','endsWith','values','value','statusCode','test','Wrong\x20credentials','html-pdf','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','SugarcrmAccount,\x20%s,\x20%s','message','status','json','count','set','Content-Range','apply','reject'];(function(_0x279b1a,_0x2bb6df){var _0x316364=function(_0x67247f){while(--_0x67247f){_0x279b1a['push'](_0x279b1a['shift']());}};_0x316364(++_0x2bb6df);}(_0x801b,0x1cc));var _0xb801=function(_0x520a6b,_0x39dd67){_0x520a6b=_0x520a6b-0x0;var _0x75f12b=_0x801b[_0x520a6b];return _0x75f12b;};'use strict';var pdf=require(_0xb801('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb801('0x1'));var rp=require(_0xb801('0x2'));var moment=require(_0xb801('0x3'));var BPromise=require(_0xb801('0x4'));var Mustache=require('mustache');var util=require(_0xb801('0x5'));var path=require(_0xb801('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb801('0x7'));var fs=require('fs');var _=require(_0xb801('0x8'));var squel=require(_0xb801('0x9'));var crypto=require(_0xb801('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb801('0xb'));var toCsv=require('to-csv');var querystring=require(_0xb801('0xc'));var Papa=require(_0xb801('0xd'));var authService=require(_0xb801('0xe'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xb801('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0xb801('0x10'))(_0xb801('0x11'));var utils=require(_0xb801('0x12'));var config=require(_0xb801('0x13'));var db=require(_0xb801('0x14'))['db'];var integrations=require(_0xb801('0x15'));var jayson=require(_0xb801('0x16'));var client=jayson[_0xb801('0x17')][_0xb801('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4ae4ed,_0x50367b,_0x15baf0,_0x16c7f1){return new BPromise(function(_0x36e577,_0x1dc91c){var _0x56b930=_0x16c7f1||client;return _0x56b930['request'](_0x4ae4ed,_0x15baf0)[_0xb801('0x19')](function(_0x454658){logger[_0xb801('0x1a')]('SugarcrmAccount,\x20%s,\x20%s',_0x50367b,_0xb801('0x1b'));logger[_0xb801('0x1c')](_0xb801('0x1d'),_0x50367b,_0xb801('0x1b'),JSON['stringify'](_0x454658));if(_0x454658['error']){if(_0x454658[_0xb801('0x1e')]['code']===0x1f4){logger[_0xb801('0x1e')](_0xb801('0x1f'),_0x50367b,_0x454658['error'][_0xb801('0x20')]);return _0x1dc91c(_0x454658[_0xb801('0x1e')][_0xb801('0x20')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x50367b,_0x454658[_0xb801('0x1e')]['message']);return _0x36e577(_0x454658[_0xb801('0x1e')][_0xb801('0x20')]);}else{logger[_0xb801('0x1a')](_0xb801('0x1f'),_0x50367b,'request\x20sent');_0x36e577(_0x454658['result'][_0xb801('0x20')]);}})['catch'](function(_0x1ec3c2){logger[_0xb801('0x1e')](_0xb801('0x1f'),_0x50367b,_0x1ec3c2);_0x1dc91c(_0x1ec3c2);});});}function respondWithStatusCode(_0xb02ebc,_0x389c0e){_0x389c0e=_0x389c0e||0xcc;return function(_0xe86ee8){if(_0xe86ee8){return _0xb02ebc['sendStatus'](_0x389c0e);}return _0xb02ebc[_0xb801('0x21')](_0x389c0e)['end']();};}function respondWithResult(_0xa8769a,_0x37baa1){_0x37baa1=_0x37baa1||0xc8;return function(_0x399a72){if(_0x399a72){return _0xa8769a[_0xb801('0x21')](_0x37baa1)[_0xb801('0x22')](_0x399a72);}};}function respondWithFilteredResult(_0x4f8a33,_0x352e20){return function(_0x225016){if(_0x225016){var _0x1c9efc=_0x225016[_0xb801('0x23')],_0x56f757=_0x352e20['offset'],_0xffc287=_0x352e20['offset']+_0x352e20['limit'],_0x20e7ac;if(_0xffc287>=_0x1c9efc){_0xffc287=_0x1c9efc;_0x20e7ac=0xc8;}else{_0x20e7ac=0xce;}_0x4f8a33[_0xb801('0x21')](_0x20e7ac);return _0x4f8a33[_0xb801('0x24')](_0xb801('0x25'),_0x56f757+'-'+_0xffc287+'/'+_0x1c9efc)[_0xb801('0x22')](_0x225016);}return null;};}function patchUpdates(_0x580b66){return function(_0x4e173f){try{jsonpatch[_0xb801('0x26')](_0x4e173f,_0x580b66,!![]);}catch(_0x14a935){return BPromise[_0xb801('0x27')](_0x14a935);}return _0x4e173f[_0xb801('0x28')]();};}function saveUpdates(_0xd0eb48,_0x25af93){return function(_0x592237){if(_0x592237){return _0x592237[_0xb801('0x29')](_0xd0eb48)['then'](function(_0x597223){return _0x597223;});}return null;};}function removeEntity(_0x3cf30b,_0x35b830){return function(_0x1d2907){if(_0x1d2907){return _0x1d2907[_0xb801('0x2a')]()[_0xb801('0x19')](function(){_0x3cf30b[_0xb801('0x21')](0xcc)[_0xb801('0x2b')]();});}};}function handleEntityNotFound(_0x58a093,_0x2607d0){return function(_0x1fc43b){if(!_0x1fc43b){_0x58a093['sendStatus'](0x194);}return _0x1fc43b;};}function handleError(_0x206a10,_0x34ffdc){_0x34ffdc=_0x34ffdc||0x1f4;return function(_0x3cafec){logger[_0xb801('0x1e')](_0x3cafec[_0xb801('0x2c')]);if(_0x3cafec[_0xb801('0x2d')]){delete _0x3cafec['name'];}_0x206a10[_0xb801('0x21')](_0x34ffdc)[_0xb801('0x2e')](_0x3cafec);};}exports[_0xb801('0x2f')]=function(_0x32c9b6,_0x913e6){var _0x28f9d9={},_0x39cb05={},_0x20395c={'count':0x0,'rows':[]};var _0x31d85d=db['SugarcrmAccount'][_0xb801('0x30')];_0x39cb05[_0xb801('0x31')]=_['keys'](_0x31d85d);_0x39cb05[_0xb801('0x32')]=_[_0xb801('0x33')](_0x32c9b6['query']);_0x39cb05[_0xb801('0x34')]=_[_0xb801('0x35')](_0x39cb05[_0xb801('0x31')],_0x39cb05[_0xb801('0x32')]);_0x28f9d9[_0xb801('0x36')]=_[_0xb801('0x35')](_0x39cb05[_0xb801('0x31')],qs[_0xb801('0x37')](_0x32c9b6['query'][_0xb801('0x37')]));_0x28f9d9['attributes']=_0x28f9d9[_0xb801('0x36')][_0xb801('0x38')]?_0x28f9d9[_0xb801('0x36')]:_0x39cb05['model'];if(!_0x32c9b6[_0xb801('0x32')][_0xb801('0x39')]('nolimit')){_0x28f9d9['limit']=qs[_0xb801('0x3a')](_0x32c9b6['query'][_0xb801('0x3a')]);_0x28f9d9[_0xb801('0x3b')]=qs[_0xb801('0x3b')](_0x32c9b6[_0xb801('0x32')][_0xb801('0x3b')]);}_0x28f9d9[_0xb801('0x3c')]=qs[_0xb801('0x3d')](_0x32c9b6['query'][_0xb801('0x3d')]);_0x28f9d9['where']=qs[_0xb801('0x34')](_['pick'](_0x32c9b6[_0xb801('0x32')],_0x39cb05['filters']));if(_0x32c9b6[_0xb801('0x32')][_0xb801('0x3e')]){_0x28f9d9[_0xb801('0x3f')]=_[_0xb801('0x40')](_0x28f9d9['where'],{'$or':_[_0xb801('0x41')](_0x31d85d,function(_0x539c97){if(_0x539c97[_0xb801('0x42')][_0xb801('0x43')]!=='VIRTUAL'){var _0x388788={};_0x388788[_0x539c97[_0xb801('0x44')]]={'$like':'%'+_0x32c9b6[_0xb801('0x32')]['filter']+'%'};return _0x388788;}})});}_0x28f9d9=_[_0xb801('0x40')]({},_0x28f9d9,_0x32c9b6['options']);var _0x1271c2={'where':_0x28f9d9[_0xb801('0x3f')]};return db[_0xb801('0x45')][_0xb801('0x23')](_0x1271c2)[_0xb801('0x19')](function(_0x161615){_0x20395c[_0xb801('0x23')]=_0x161615;if(_0x32c9b6[_0xb801('0x32')]['includeAll']){_0x28f9d9['include']=[{'all':!![]}];}return db[_0xb801('0x45')][_0xb801('0x46')](_0x28f9d9);})[_0xb801('0x19')](function(_0x4f325c){_0x20395c[_0xb801('0x47')]=_0x4f325c;return _0x20395c;})['then'](respondWithFilteredResult(_0x913e6,_0x28f9d9))['catch'](handleError(_0x913e6,null));};exports['show']=function(_0xcccf05,_0x9a170e){var _0x1bd7b4={'raw':![],'where':{'id':_0xcccf05['params']['id']}},_0x2fdb9f={};_0x2fdb9f[_0xb801('0x31')]=_['keys'](db[_0xb801('0x45')][_0xb801('0x30')]);_0x2fdb9f[_0xb801('0x32')]=_[_0xb801('0x33')](_0xcccf05[_0xb801('0x32')]);_0x2fdb9f[_0xb801('0x34')]=_['intersection'](_0x2fdb9f[_0xb801('0x31')],_0x2fdb9f[_0xb801('0x32')]);_0x1bd7b4['attributes']=_[_0xb801('0x35')](_0x2fdb9f[_0xb801('0x31')],qs['fields'](_0xcccf05[_0xb801('0x32')][_0xb801('0x37')]));_0x1bd7b4[_0xb801('0x36')]=_0x1bd7b4['attributes']['length']?_0x1bd7b4[_0xb801('0x36')]:_0x2fdb9f[_0xb801('0x31')];if(_0xcccf05[_0xb801('0x32')][_0xb801('0x48')]){_0x1bd7b4['include']=[{'all':!![]}];}_0x1bd7b4=_[_0xb801('0x40')]({},_0x1bd7b4,_0xcccf05['options']);return db[_0xb801('0x45')][_0xb801('0x49')](_0x1bd7b4)[_0xb801('0x19')](handleEntityNotFound(_0x9a170e,null))[_0xb801('0x19')](respondWithResult(_0x9a170e,null))[_0xb801('0x4a')](handleError(_0x9a170e,null));};exports['create']=function(_0xad720,_0x43ee5c){return db[_0xb801('0x45')]['create'](_0xad720['body'],{})[_0xb801('0x19')](respondWithResult(_0x43ee5c,0xc9))[_0xb801('0x4a')](handleError(_0x43ee5c,null));};exports[_0xb801('0x29')]=function(_0x382a3a,_0x55a8aa){if(_0x382a3a['body']['id']){delete _0x382a3a[_0xb801('0x4b')]['id'];}return db[_0xb801('0x45')][_0xb801('0x49')]({'where':{'id':_0x382a3a[_0xb801('0x4c')]['id']}})[_0xb801('0x19')](handleEntityNotFound(_0x55a8aa,null))[_0xb801('0x19')](saveUpdates(_0x382a3a[_0xb801('0x4b')],null))[_0xb801('0x19')](respondWithResult(_0x55a8aa,null))[_0xb801('0x4a')](handleError(_0x55a8aa,null));};exports[_0xb801('0x2a')]=function(_0x2ac972,_0x268a05){return db[_0xb801('0x45')][_0xb801('0x49')]({'where':{'id':_0x2ac972[_0xb801('0x4c')]['id']}})[_0xb801('0x19')](handleEntityNotFound(_0x268a05,null))['then'](removeEntity(_0x268a05,null))[_0xb801('0x4a')](handleError(_0x268a05,null));};exports[_0xb801('0x4d')]=function(_0x12d619,_0x123da2,_0x5675dc){var _0x49e916={};var _0x4fb474={};var _0x58d980;var _0x1d0877;return db['SugarcrmAccount'][_0xb801('0x4e')]({'where':{'id':_0x12d619['params']['id']}})[_0xb801('0x19')](handleEntityNotFound(_0x123da2,null))['then'](function(_0x26bef9){if(_0x26bef9){_0x58d980=_0x26bef9;_0x4fb474[_0xb801('0x31')]=_[_0xb801('0x33')](db[_0xb801('0x4f')][_0xb801('0x30')]);_0x4fb474[_0xb801('0x32')]=_['keys'](_0x12d619[_0xb801('0x32')]);_0x4fb474[_0xb801('0x34')]=_[_0xb801('0x35')](_0x4fb474[_0xb801('0x31')],_0x4fb474[_0xb801('0x32')]);_0x49e916['attributes']=_[_0xb801('0x35')](_0x4fb474[_0xb801('0x31')],qs[_0xb801('0x37')](_0x12d619[_0xb801('0x32')][_0xb801('0x37')]));_0x49e916[_0xb801('0x36')]=_0x49e916[_0xb801('0x36')][_0xb801('0x38')]?_0x49e916['attributes']:_0x4fb474[_0xb801('0x31')];_0x49e916[_0xb801('0x3c')]=qs[_0xb801('0x3d')](_0x12d619[_0xb801('0x32')]['sort']);_0x49e916['where']=qs[_0xb801('0x34')](_['pick'](_0x12d619[_0xb801('0x32')],_0x4fb474['filters']));if(_0x12d619[_0xb801('0x32')]['filter']){_0x49e916[_0xb801('0x3f')]=_[_0xb801('0x40')](_0x49e916[_0xb801('0x3f')],{'$or':_['map'](_0x49e916[_0xb801('0x36')],function(_0x52ca13){var _0x2c1986={};_0x2c1986[_0x52ca13]={'$like':'%'+_0x12d619[_0xb801('0x32')][_0xb801('0x3e')]+'%'};return _0x2c1986;})});}_0x49e916=_[_0xb801('0x40')]({},_0x49e916,_0x12d619[_0xb801('0x50')]);return _0x58d980[_0xb801('0x4d')](_0x49e916);}})[_0xb801('0x19')](function(_0x1718dd){if(_0x1718dd){_0x1d0877=_0x1718dd[_0xb801('0x38')];if(!_0x12d619['query'][_0xb801('0x39')](_0xb801('0x51'))){_0x49e916[_0xb801('0x3a')]=qs[_0xb801('0x3a')](_0x12d619[_0xb801('0x32')][_0xb801('0x3a')]);_0x49e916[_0xb801('0x3b')]=qs[_0xb801('0x3b')](_0x12d619[_0xb801('0x32')]['offset']);}return _0x58d980['getConfigurations'](_0x49e916);}})[_0xb801('0x19')](function(_0xf2f79){if(_0xf2f79){return _0xf2f79?{'count':_0x1d0877,'rows':_0xf2f79}:null;}})[_0xb801('0x19')](respondWithResult(_0x123da2,null))['catch'](handleError(_0x123da2,null));};exports['addConfiguration']=function(_0x7ee7fa,_0xb017d0,_0x946635){if(_0x7ee7fa['body']['id']){delete _0x7ee7fa[_0xb801('0x4b')]['id'];}return db[_0xb801('0x45')][_0xb801('0x4e')]({'where':{'id':_0x7ee7fa[_0xb801('0x4c')]['id']}})['then'](handleEntityNotFound(_0xb017d0,null))[_0xb801('0x19')](function(_0x2df0cc){if(_0x2df0cc){_0x7ee7fa['body'][_0xb801('0x52')]=_0x2df0cc['id'];_0x7ee7fa[_0xb801('0x4b')][_0xb801('0x53')]=integrations[_0xb801('0x54')](_0x7ee7fa[_0xb801('0x4b')]['channel'],_0x7ee7fa[_0xb801('0x4b')][_0xb801('0x42')]);_0x7ee7fa[_0xb801('0x4b')][_0xb801('0x55')]=integrations[_0xb801('0x56')](_0x7ee7fa[_0xb801('0x4b')][_0xb801('0x57')],_0x7ee7fa['body']['type']);return db['SugarcrmConfiguration'][_0xb801('0x58')](_0x7ee7fa['body'],{'include':[{'model':db[_0xb801('0x59')],'as':_0xb801('0x53')},{'model':db[_0xb801('0x59')],'as':_0xb801('0x55')}]});}return null;})['then'](respondWithResult(_0xb017d0,null))[_0xb801('0x4a')](handleError(_0xb017d0,null));};exports[_0xb801('0x5a')]=function(_0x1c0fed,_0x4d23e6,_0x1d51fc){var _0x504dd2='';var _0xa77360=['id','name',_0xb801('0x5b'),'created_by',_0xb801('0x5c'),_0xb801('0x5d'),_0xb801('0x5e'),_0xb801('0x5f'),_0xb801('0x60'),_0xb801('0x61'),_0xb801('0x62'),_0xb801('0x63')];return db[_0xb801('0x45')][_0xb801('0x4e')]({'where':{'id':_0x1c0fed['params']['id']},'attributes':['id',_0xb801('0x64'),'password',_0xb801('0x65')]})['then'](handleEntityNotFound(_0x4d23e6,null))['then'](function(_0x55a6b7){if(_0x55a6b7){_0x504dd2=_0x55a6b7[_0xb801('0x65')];var _0x10902c=_0x504dd2[_0xb801('0x66')](-0x1);if(_0x10902c==='/'){_0x504dd2=_0x504dd2[_0xb801('0x67')](0x0,_0x504dd2[_0xb801('0x68')](_0x10902c));}return rp({'method':_0xb801('0x69'),'uri':util[_0xb801('0x6a')]('%s%s',_0x504dd2,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xb801('0x6b'),'input_type':_0xb801('0x6c'),'response_type':'JSON','rest_data':JSON[_0xb801('0x6d')]({'user_auth':{'user_name':_0x55a6b7['username'],'password':_0x55a6b7[_0xb801('0x6e')],'encryption':_0xb801('0x6f')},'application':_0xb801('0x70')})}});}})[_0xb801('0x19')](function(_0x564018){if(_0x564018&&_0x564018[_0xb801('0x2d')]!==_0xb801('0x71')&&_0x564018[_0xb801('0x2d')]!=='Password\x20Expired'){return rp({'method':_0xb801('0x69'),'uri':util[_0xb801('0x6a')](_0xb801('0x72'),_0x504dd2,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xb801('0x6d')]({'session':_0x564018['id'],'module_name':_0xb801('0x73')})}})['then'](function(_0x45fc9b){if(_0x45fc9b){var _0xc55534=_['values'](_0x45fc9b[_0xb801('0x74')]);_[_0xb801('0x75')](_0xc55534,function(_0xa137a5){return _0xa77360[_0xb801('0x76')](_0xa137a5[_0xb801('0x2d')]);});return{'count':_0xc55534[_0xb801('0x38')],'rows':_[_0xb801('0x41')](_0xc55534,function(_0x1d54e7){return{'id':_0x1d54e7[_0xb801('0x2d')],'name':_0x1d54e7['label'],'custom':_[_0xb801('0x77')](_0x1d54e7[_0xb801('0x2d')],'_c')?!![]:![],'options':_0x1d54e7['options']?_[_0xb801('0x41')](_[_0xb801('0x78')](_0x1d54e7['options']),function(_0x41655a){return{'name':_0x41655a[_0xb801('0x79')],'value':_0x41655a['name']};}):[]};})};}})['then'](respondWithResult(_0x4d23e6,null))[_0xb801('0x4a')](function(_0x2a28a2){var _0x5a93e5=_0x1c0fed[_0xb801('0x32')]['test']?0x1f4:_0x2a28a2[_0xb801('0x7a')]||0x1f4;logger[_0xb801('0x1e')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5a93e5,JSON[_0xb801('0x6d')](_0x2a28a2));delete _0x2a28a2[_0xb801('0x2d')];if(_0x5a93e5===0x191){_0x5a93e5=0x190;}_0x4d23e6[_0xb801('0x21')](_0x5a93e5)[_0xb801('0x2e')](_0x1c0fed['query'][_0xb801('0x7b')]?{'message':_0xb801('0x7c'),'statusCode':_0x2a28a2[_0xb801('0x7a')]}:_0x2a28a2);});}else{var _0x303ce9=0x1f4;_0x4d23e6['status'](_0x303ce9)[_0xb801('0x2e')]({'message':_0xb801('0x7c'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 5f62654..0e2591e 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 _0xccdb=['../../config/logger','api','moment','bluebird','request-promise','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util'];(function(_0x2a69d5,_0x2ece58){var _0x5d8aa4=function(_0x254abf){while(--_0x254abf){_0x2a69d5['push'](_0x2a69d5['shift']());}};_0x5d8aa4(++_0x2ece58);}(_0xccdb,0x12a));var _0xbccd=function(_0x399700,_0x6cbca7){_0x399700=_0x399700-0x0;var _0x4f5720=_0xccdb[_0x399700];return _0x4f5720;};'use strict';var _=require(_0xbccd('0x0'));var util=require(_0xbccd('0x1'));var logger=require(_0xbccd('0x2'))(_0xbccd('0x3'));var moment=require(_0xbccd('0x4'));var BPromise=require(_0xbccd('0x5'));var rp=require(_0xbccd('0x6'));var attributes=require(_0xbccd('0x7'));var integrations=require(_0xbccd('0x8'));module[_0xbccd('0x9')]=function(_0x2535d3,_0x354465){return _0x2535d3['define'](_0xbccd('0xa'),attributes,{'tableName':_0xbccd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6086=['exports','define','int_sugarcrm_accounts','util','../../config/logger','api','bluebird','request-promise','./intSugarcrmAccount.attributes','../../components/integrations/configuration'];(function(_0x1ea4ed,_0x131b2f){var _0x27dfc9=function(_0x38879b){while(--_0x38879b){_0x1ea4ed['push'](_0x1ea4ed['shift']());}};_0x27dfc9(++_0x131b2f);}(_0x6086,0x11b));var _0x6608=function(_0xdded07,_0x5c7b23){_0xdded07=_0xdded07-0x0;var _0x118468=_0x6086[_0xdded07];return _0x118468;};'use strict';var _=require('lodash');var util=require(_0x6608('0x0'));var logger=require(_0x6608('0x1'))(_0x6608('0x2'));var moment=require('moment');var BPromise=require(_0x6608('0x3'));var rp=require(_0x6608('0x4'));var attributes=require(_0x6608('0x5'));var integrations=require(_0x6608('0x6'));module[_0x6608('0x7')]=function(_0x122299,_0x54cd17){return _0x122299[_0x6608('0x8')]('SugarcrmAccount',attributes,{'tableName':_0x6608('0x9'),'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 360db3b..6e50cc3 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 _0xbd48=['../../config/logger','../../config/environment','jayson/promise','http','info','request\x20sent','debug','stringify','error','code','message','catch','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','GetSugarcrmAccount','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x2a271a,_0x2c1114){var _0x31ed79=function(_0x1dfe69){while(--_0x1dfe69){_0x2a271a['push'](_0x2a271a['shift']());}};_0x31ed79(++_0x2c1114);}(_0xbd48,0x191));var _0x8bd4=function(_0x5d0406,_0x5692cc){_0x5d0406=_0x5d0406-0x0;var _0x1be401=_0xbd48[_0x5d0406];return _0x1be401;};'use strict';var _=require(_0x8bd4('0x0'));var util=require(_0x8bd4('0x1'));var moment=require(_0x8bd4('0x2'));var BPromise=require(_0x8bd4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8bd4('0x4'));var db=require(_0x8bd4('0x5'))['db'];var utils=require(_0x8bd4('0x6'));var logger=require(_0x8bd4('0x7'))('rpc');var config=require(_0x8bd4('0x8'));var jayson=require(_0x8bd4('0x9'));var client=jayson['client'][_0x8bd4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54e954,_0x2a773f,_0x45a67a){return new BPromise(function(_0x105ffb,_0x4ddf13){return client['request'](_0x54e954,_0x45a67a)['then'](function(_0x48374e){logger[_0x8bd4('0xb')]('SugarcrmAccount,\x20%s,\x20%s',_0x2a773f,_0x8bd4('0xc'));logger[_0x8bd4('0xd')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x2a773f,_0x8bd4('0xc'),JSON[_0x8bd4('0xe')](_0x48374e));if(_0x48374e[_0x8bd4('0xf')]){if(_0x48374e[_0x8bd4('0xf')][_0x8bd4('0x10')]===0x1f4){logger[_0x8bd4('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x2a773f,_0x48374e[_0x8bd4('0xf')][_0x8bd4('0x11')]);return _0x4ddf13(_0x48374e[_0x8bd4('0xf')]['message']);}logger[_0x8bd4('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x2a773f,_0x48374e[_0x8bd4('0xf')][_0x8bd4('0x11')]);return _0x105ffb(_0x48374e['error'][_0x8bd4('0x11')]);}else{logger[_0x8bd4('0xb')]('SugarcrmAccount,\x20%s,\x20%s',_0x2a773f,'request\x20sent');_0x105ffb(_0x48374e['result'][_0x8bd4('0x11')]);}})[_0x8bd4('0x12')](function(_0x49d467){logger[_0x8bd4('0xf')](_0x8bd4('0x13'),_0x2a773f,_0x49d467);_0x4ddf13(_0x49d467);});});}exports['GetSugarcrmAccount']=function(_0x53d606){var _0x2c3112=this;return new Promise(function(_0x30cf28,_0x52c230){return db[_0x8bd4('0x14')][_0x8bd4('0x15')]({'raw':_0x53d606[_0x8bd4('0x16')]?_0x53d606[_0x8bd4('0x16')][_0x8bd4('0x17')]===undefined?!![]:![]:!![],'where':_0x53d606[_0x8bd4('0x16')]?_0x53d606[_0x8bd4('0x16')][_0x8bd4('0x18')]||null:null,'attributes':_0x53d606[_0x8bd4('0x16')]?_0x53d606[_0x8bd4('0x16')][_0x8bd4('0x19')]||null:null,'limit':_0x53d606[_0x8bd4('0x16')]?_0x53d606[_0x8bd4('0x16')][_0x8bd4('0x1a')]||null:null,'include':_0x53d606[_0x8bd4('0x16')]?_0x53d606['options']['include']?_[_0x8bd4('0x1b')](_0x53d606['options'][_0x8bd4('0x1c')],function(_0x15ce95){return{'model':db[_0x15ce95[_0x8bd4('0x1d')]],'as':_0x15ce95['as'],'attributes':_0x15ce95[_0x8bd4('0x19')],'include':_0x15ce95[_0x8bd4('0x1c')]?_[_0x8bd4('0x1b')](_0x15ce95[_0x8bd4('0x1c')],function(_0x72e423){return{'model':db[_0x72e423[_0x8bd4('0x1d')]],'as':_0x72e423['as'],'attributes':_0x72e423['attributes'],'include':_0x72e423[_0x8bd4('0x1c')]?_[_0x8bd4('0x1b')](_0x72e423[_0x8bd4('0x1c')],function(_0x27c11f){return{'model':db[_0x27c11f['model']],'as':_0x27c11f['as'],'attributes':_0x27c11f[_0x8bd4('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8bd4('0x1e')](function(_0x5021ce){logger['info'](_0x8bd4('0x1f'),_0x53d606);logger[_0x8bd4('0xd')](_0x8bd4('0x1f'),_0x53d606,JSON[_0x8bd4('0xe')](_0x5021ce));_0x30cf28(_0x5021ce);})[_0x8bd4('0x12')](function(_0x1f3fb6){logger[_0x8bd4('0xf')]('GetSugarcrmAccount',_0x1f3fb6[_0x8bd4('0x11')],_0x53d606);_0x52c230(_0x2c3112[_0x8bd4('0xf')](0x1f4,_0x1f3fb6[_0x8bd4('0x11')]));});});};exports[_0x8bd4('0x20')]=function(_0x1a9e0f){var _0x678b51=this;return new Promise(function(_0x702586,_0x338ba2){return db[_0x8bd4('0x14')][_0x8bd4('0x21')]({'raw':_0x1a9e0f['options']?_0x1a9e0f['options'][_0x8bd4('0x17')]===undefined?!![]:![]:!![],'where':_0x1a9e0f['options']?_0x1a9e0f[_0x8bd4('0x16')][_0x8bd4('0x18')]||null:null,'attributes':_0x1a9e0f[_0x8bd4('0x16')]?_0x1a9e0f[_0x8bd4('0x16')][_0x8bd4('0x19')]||null:null,'include':_0x1a9e0f[_0x8bd4('0x16')]?_0x1a9e0f[_0x8bd4('0x16')][_0x8bd4('0x1c')]?_[_0x8bd4('0x1b')](_0x1a9e0f[_0x8bd4('0x16')]['include'],function(_0x9dbd25){return{'model':db[_0x9dbd25[_0x8bd4('0x1d')]],'as':_0x9dbd25['as'],'attributes':_0x9dbd25[_0x8bd4('0x19')],'include':_0x9dbd25[_0x8bd4('0x1c')]?_[_0x8bd4('0x1b')](_0x9dbd25[_0x8bd4('0x1c')],function(_0x4c1720){return{'model':db[_0x4c1720['model']],'as':_0x4c1720['as'],'attributes':_0x4c1720[_0x8bd4('0x19')],'include':_0x4c1720[_0x8bd4('0x1c')]?_['map'](_0x4c1720['include'],function(_0x19d571){return{'model':db[_0x19d571[_0x8bd4('0x1d')]],'as':_0x19d571['as'],'attributes':_0x19d571[_0x8bd4('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x226a35){logger[_0x8bd4('0xb')](_0x8bd4('0x20'),_0x1a9e0f);logger[_0x8bd4('0xd')](_0x8bd4('0x20'),_0x1a9e0f,JSON[_0x8bd4('0xe')](_0x226a35));_0x702586(_0x226a35);})[_0x8bd4('0x12')](function(_0x2f4181){logger['error']('ShowSugarcrmAccount',_0x2f4181[_0x8bd4('0x11')],_0x1a9e0f);_0x338ba2(_0x678b51['error'](0x1f4,_0x2f4181[_0x8bd4('0x11')]));});});}; \ No newline at end of file +var _0xa829=['message','GetSugarcrmAccount','SugarcrmAccount','findAll','options','attributes','limit','include','model','map','catch','find','raw','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x472cd7,_0x1f7b1a){var _0x1037bf=function(_0x1df9fd){while(--_0x1df9fd){_0x472cd7['push'](_0x472cd7['shift']());}};_0x1037bf(++_0x1f7b1a);}(_0xa829,0x1a6));var _0x9a82=function(_0x37c25e,_0x2212dd){_0x37c25e=_0x37c25e-0x0;var _0x15c6d4=_0xa829[_0x37c25e];return _0x15c6d4;};'use strict';var _=require(_0x9a82('0x0'));var util=require(_0x9a82('0x1'));var moment=require(_0x9a82('0x2'));var BPromise=require(_0x9a82('0x3'));var rs=require(_0x9a82('0x4'));var fs=require('fs');var Redis=require(_0x9a82('0x5'));var db=require(_0x9a82('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9a82('0x7'));var config=require(_0x9a82('0x8'));var jayson=require(_0x9a82('0x9'));var client=jayson['client'][_0x9a82('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2716be,_0x458f1b,_0x3e3ecc){return new BPromise(function(_0x56b1f7,_0x1ce414){return client[_0x9a82('0xb')](_0x2716be,_0x3e3ecc)[_0x9a82('0xc')](function(_0x4438fd){logger[_0x9a82('0xd')](_0x9a82('0xe'),_0x458f1b,_0x9a82('0xf'));logger[_0x9a82('0x10')](_0x9a82('0x11'),_0x458f1b,_0x9a82('0xf'),JSON[_0x9a82('0x12')](_0x4438fd));if(_0x4438fd[_0x9a82('0x13')]){if(_0x4438fd[_0x9a82('0x13')]['code']===0x1f4){logger['error'](_0x9a82('0xe'),_0x458f1b,_0x4438fd['error'][_0x9a82('0x14')]);return _0x1ce414(_0x4438fd[_0x9a82('0x13')][_0x9a82('0x14')]);}logger[_0x9a82('0x13')](_0x9a82('0xe'),_0x458f1b,_0x4438fd['error'][_0x9a82('0x14')]);return _0x56b1f7(_0x4438fd[_0x9a82('0x13')][_0x9a82('0x14')]);}else{logger['info'](_0x9a82('0xe'),_0x458f1b,_0x9a82('0xf'));_0x56b1f7(_0x4438fd['result'][_0x9a82('0x14')]);}})['catch'](function(_0x23f73c){logger['error'](_0x9a82('0xe'),_0x458f1b,_0x23f73c);_0x1ce414(_0x23f73c);});});}exports[_0x9a82('0x15')]=function(_0x2d7433){var _0x4f26d6=this;return new Promise(function(_0x4d7f30,_0x295c04){return db[_0x9a82('0x16')][_0x9a82('0x17')]({'raw':_0x2d7433[_0x9a82('0x18')]?_0x2d7433['options']['raw']===undefined?!![]:![]:!![],'where':_0x2d7433[_0x9a82('0x18')]?_0x2d7433[_0x9a82('0x18')]['where']||null:null,'attributes':_0x2d7433[_0x9a82('0x18')]?_0x2d7433[_0x9a82('0x18')][_0x9a82('0x19')]||null:null,'limit':_0x2d7433[_0x9a82('0x18')]?_0x2d7433['options'][_0x9a82('0x1a')]||null:null,'include':_0x2d7433['options']?_0x2d7433[_0x9a82('0x18')][_0x9a82('0x1b')]?_['map'](_0x2d7433['options'][_0x9a82('0x1b')],function(_0x37acf9){return{'model':db[_0x37acf9[_0x9a82('0x1c')]],'as':_0x37acf9['as'],'attributes':_0x37acf9[_0x9a82('0x19')],'include':_0x37acf9[_0x9a82('0x1b')]?_[_0x9a82('0x1d')](_0x37acf9[_0x9a82('0x1b')],function(_0x5f20b9){return{'model':db[_0x5f20b9[_0x9a82('0x1c')]],'as':_0x5f20b9['as'],'attributes':_0x5f20b9[_0x9a82('0x19')],'include':_0x5f20b9[_0x9a82('0x1b')]?_[_0x9a82('0x1d')](_0x5f20b9['include'],function(_0x345a12){return{'model':db[_0x345a12['model']],'as':_0x345a12['as'],'attributes':_0x345a12['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1bf440){logger[_0x9a82('0xd')](_0x9a82('0x15'),_0x2d7433);logger[_0x9a82('0x10')](_0x9a82('0x15'),_0x2d7433,JSON[_0x9a82('0x12')](_0x1bf440));_0x4d7f30(_0x1bf440);})[_0x9a82('0x1e')](function(_0x3822bd){logger[_0x9a82('0x13')]('GetSugarcrmAccount',_0x3822bd['message'],_0x2d7433);_0x295c04(_0x4f26d6[_0x9a82('0x13')](0x1f4,_0x3822bd[_0x9a82('0x14')]));});});};exports['ShowSugarcrmAccount']=function(_0x2bd2bb){var _0x5f1c0b=this;return new Promise(function(_0x334ac1,_0x4363d1){return db[_0x9a82('0x16')][_0x9a82('0x1f')]({'raw':_0x2bd2bb[_0x9a82('0x18')]?_0x2bd2bb[_0x9a82('0x18')][_0x9a82('0x20')]===undefined?!![]:![]:!![],'where':_0x2bd2bb[_0x9a82('0x18')]?_0x2bd2bb['options']['where']||null:null,'attributes':_0x2bd2bb[_0x9a82('0x18')]?_0x2bd2bb['options'][_0x9a82('0x19')]||null:null,'include':_0x2bd2bb[_0x9a82('0x18')]?_0x2bd2bb[_0x9a82('0x18')][_0x9a82('0x1b')]?_[_0x9a82('0x1d')](_0x2bd2bb[_0x9a82('0x18')][_0x9a82('0x1b')],function(_0x24404b){return{'model':db[_0x24404b['model']],'as':_0x24404b['as'],'attributes':_0x24404b[_0x9a82('0x19')],'include':_0x24404b[_0x9a82('0x1b')]?_[_0x9a82('0x1d')](_0x24404b['include'],function(_0xdf7473){return{'model':db[_0xdf7473[_0x9a82('0x1c')]],'as':_0xdf7473['as'],'attributes':_0xdf7473[_0x9a82('0x19')],'include':_0xdf7473[_0x9a82('0x1b')]?_['map'](_0xdf7473['include'],function(_0x281f4b){return{'model':db[_0x281f4b[_0x9a82('0x1c')]],'as':_0x281f4b['as'],'attributes':_0x281f4b[_0x9a82('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x99ff99){logger[_0x9a82('0xd')](_0x9a82('0x21'),_0x2bd2bb);logger['debug'](_0x9a82('0x21'),_0x2bd2bb,JSON[_0x9a82('0x12')](_0x99ff99));_0x334ac1(_0x99ff99);})[_0x9a82('0x1e')](function(_0x35d28e){logger[_0x9a82('0x13')](_0x9a82('0x21'),_0x35d28e[_0x9a82('0x14')],_0x2bd2bb);_0x4363d1(_0x5f1c0b['error'](0x1f4,_0x35d28e['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 543c03f..8e755da 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 _0x9224=['getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','get','index','/:id','isAuthenticated','show','getFields','/:id/subjects'];(function(_0x4f507b,_0x1a0e8a){var _0x50de21=function(_0xbee153){while(--_0xbee153){_0x4f507b['push'](_0x4f507b['shift']());}};_0x50de21(++_0x1a0e8a);}(_0x9224,0xa3));var _0x4922=function(_0x234c6c,_0x347072){_0x234c6c=_0x234c6c-0x0;var _0x353790=_0x9224[_0x234c6c];return _0x353790;};'use strict';var multer=require('multer');var util=require(_0x4922('0x0'));var path=require(_0x4922('0x1'));var timeout=require(_0x4922('0x2'));var express=require(_0x4922('0x3'));var router=express[_0x4922('0x4')]();var auth=require(_0x4922('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0x4922('0x6')]('/',auth['isAuthenticated'](),controller[_0x4922('0x7')]);router[_0x4922('0x6')](_0x4922('0x8'),auth[_0x4922('0x9')](),controller[_0x4922('0xa')]);router[_0x4922('0x6')]('/:id/fields',auth[_0x4922('0x9')](),controller[_0x4922('0xb')]);router['get'](_0x4922('0xc'),auth[_0x4922('0x9')](),controller[_0x4922('0xd')]);router[_0x4922('0x6')](_0x4922('0xe'),auth[_0x4922('0x9')](),controller[_0x4922('0xf')]);router[_0x4922('0x10')]('/',auth['isAuthenticated'](),controller[_0x4922('0x11')]);router['put'](_0x4922('0x8'),auth[_0x4922('0x9')](),controller[_0x4922('0x12')]);router[_0x4922('0x13')](_0x4922('0x8'),auth['isAuthenticated'](),controller[_0x4922('0x14')]);module[_0x4922('0x15')]=router; \ No newline at end of file +var _0x0c5d=['./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x0c5d,0x6c));var _0xd0c5=function(_0x3386f7,_0x453cf6){_0x3386f7=_0x3386f7-0x0;var _0x3ddbed=_0x0c5d[_0x3386f7];return _0x3ddbed;};'use strict';var multer=require(_0xd0c5('0x0'));var util=require(_0xd0c5('0x1'));var path=require('path');var timeout=require(_0xd0c5('0x2'));var express=require('express');var router=express[_0xd0c5('0x3')]();var auth=require(_0xd0c5('0x4'));var interaction=require(_0xd0c5('0x5'));var config=require(_0xd0c5('0x6'));var controller=require(_0xd0c5('0x7'));router[_0xd0c5('0x8')]('/',auth[_0xd0c5('0x9')](),controller[_0xd0c5('0xa')]);router['get'](_0xd0c5('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xd0c5('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xd0c5('0xc')]);router[_0xd0c5('0x8')]('/:id/subjects',auth[_0xd0c5('0x9')](),controller[_0xd0c5('0xd')]);router['get'](_0xd0c5('0xe'),auth[_0xd0c5('0x9')](),controller[_0xd0c5('0xf')]);router[_0xd0c5('0x10')]('/',auth[_0xd0c5('0x9')](),controller[_0xd0c5('0x11')]);router[_0xd0c5('0x12')](_0xd0c5('0xb'),auth[_0xd0c5('0x9')](),controller[_0xd0c5('0x13')]);router[_0xd0c5('0x14')](_0xd0c5('0xb'),auth['isAuthenticated'](),controller[_0xd0c5('0x15')]);module[_0xd0c5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 49885a1..d802f57 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 _0xb45c=['exports','STRING','sequelize'];(function(_0x108623,_0x5f3c49){var _0x3104b3=function(_0x1915c3){while(--_0x1915c3){_0x108623['push'](_0x108623['shift']());}};_0x3104b3(++_0x5f3c49);}(_0xb45c,0x173));var _0xcb45=function(_0x5c9896,_0x47e4c7){_0x5c9896=_0x5c9896-0x0;var _0x4204e2=_0xb45c[_0x5c9896];return _0x4204e2;};'use strict';var Sequelize=require(_0xcb45('0x0'));module[_0xcb45('0x1')]={'name':{'type':Sequelize[_0xcb45('0x2')]},'description':{'type':Sequelize[_0xcb45('0x2')]}}; \ No newline at end of file +var _0x6bdf=['sequelize','exports','STRING'];(function(_0x534633,_0x1a9c70){var _0x176d6a=function(_0x4985cb){while(--_0x4985cb){_0x534633['push'](_0x534633['shift']());}};_0x176d6a(++_0x1a9c70);}(_0x6bdf,0xe7));var _0xf6bd=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x6bdf[_0x4baae2];return _0x1a2285;};'use strict';var Sequelize=require(_0xf6bd('0x0'));module[_0xf6bd('0x1')]={'name':{'type':Sequelize[_0xf6bd('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index b6d9902..cc4167f 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 _0x3532=['rows','show','find','create','body','params','getFields','SugarcrmField','order','getSubjects','findOne','getDescriptions','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','apply','reject','save','update','destroy','end','name','index','SugarcrmConfiguration','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3532,0x117));var _0x2353=function(_0x1ba974,_0x7cb7fb){_0x1ba974=_0x1ba974-0x0;var _0x6a502a=_0x3532[_0x1ba974];return _0x6a502a;};'use strict';var pdf=require(_0x2353('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2353('0x1'));var rp=require(_0x2353('0x2'));var moment=require(_0x2353('0x3'));var BPromise=require(_0x2353('0x4'));var Mustache=require(_0x2353('0x5'));var util=require(_0x2353('0x6'));var path=require('path');var sox=require(_0x2353('0x7'));var csv=require('to-csv');var ejs=require(_0x2353('0x8'));var fs=require('fs');var _=require(_0x2353('0x9'));var squel=require('squel');var crypto=require(_0x2353('0xa'));var jsforce=require(_0x2353('0xb'));var deskjs=require(_0x2353('0xc'));var toCsv=require(_0x2353('0xd'));var querystring=require(_0x2353('0xe'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0x2353('0xf'));var Redis=require(_0x2353('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0x2353('0x11'))(_0x2353('0x12'));var utils=require(_0x2353('0x13'));var config=require(_0x2353('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0x2353('0x15'));var client=jayson[_0x2353('0x16')][_0x2353('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x56e559,_0x2f7537,_0x5ad604,_0x5d6cf4){return new BPromise(function(_0x3d4124,_0x21d1e9){var _0x88524c=_0x5d6cf4||client;return _0x88524c[_0x2353('0x18')](_0x56e559,_0x5ad604)[_0x2353('0x19')](function(_0x74ea57){logger[_0x2353('0x1a')](_0x2353('0x1b'),_0x2f7537,_0x2353('0x1c'));logger[_0x2353('0x1d')](_0x2353('0x1e'),_0x2f7537,'request\x20sent',JSON[_0x2353('0x1f')](_0x74ea57));if(_0x74ea57[_0x2353('0x20')]){if(_0x74ea57['error'][_0x2353('0x21')]===0x1f4){logger[_0x2353('0x20')](_0x2353('0x1b'),_0x2f7537,_0x74ea57[_0x2353('0x20')][_0x2353('0x22')]);return _0x21d1e9(_0x74ea57['error'][_0x2353('0x22')]);}logger['error'](_0x2353('0x1b'),_0x2f7537,_0x74ea57[_0x2353('0x20')][_0x2353('0x22')]);return _0x3d4124(_0x74ea57[_0x2353('0x20')][_0x2353('0x22')]);}else{logger[_0x2353('0x1a')](_0x2353('0x1b'),_0x2f7537,_0x2353('0x1c'));_0x3d4124(_0x74ea57[_0x2353('0x23')][_0x2353('0x22')]);}})[_0x2353('0x24')](function(_0xd8d9cd){logger[_0x2353('0x20')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2f7537,_0xd8d9cd);_0x21d1e9(_0xd8d9cd);});});}function respondWithStatusCode(_0x36d5c1,_0x23bc0c){_0x23bc0c=_0x23bc0c||0xcc;return function(_0x188793){if(_0x188793){return _0x36d5c1[_0x2353('0x25')](_0x23bc0c);}return _0x36d5c1[_0x2353('0x26')](_0x23bc0c)['end']();};}function respondWithResult(_0x24d7c2,_0x3366d9){_0x3366d9=_0x3366d9||0xc8;return function(_0x3bc93c){if(_0x3bc93c){return _0x24d7c2['status'](_0x3366d9)[_0x2353('0x27')](_0x3bc93c);}};}function respondWithFilteredResult(_0x85e6a4,_0x57da98){return function(_0x590ad3){if(_0x590ad3){var _0x32aca1=_0x590ad3[_0x2353('0x28')],_0x1a0d7d=_0x57da98[_0x2353('0x29')],_0xa8b655=_0x57da98[_0x2353('0x29')]+_0x57da98[_0x2353('0x2a')],_0x189c26;if(_0xa8b655>=_0x32aca1){_0xa8b655=_0x32aca1;_0x189c26=0xc8;}else{_0x189c26=0xce;}_0x85e6a4[_0x2353('0x26')](_0x189c26);return _0x85e6a4['set']('Content-Range',_0x1a0d7d+'-'+_0xa8b655+'/'+_0x32aca1)[_0x2353('0x27')](_0x590ad3);}return null;};}function patchUpdates(_0x3b8272){return function(_0x399a80){try{jsonpatch[_0x2353('0x2b')](_0x399a80,_0x3b8272,!![]);}catch(_0x20683c){return BPromise[_0x2353('0x2c')](_0x20683c);}return _0x399a80[_0x2353('0x2d')]();};}function saveUpdates(_0x44060c,_0x3ef2d8){return function(_0x307b87){if(_0x307b87){return _0x307b87[_0x2353('0x2e')](_0x44060c)[_0x2353('0x19')](function(_0xfefa3d){return _0xfefa3d;});}return null;};}function removeEntity(_0x1075d4,_0x28a50f){return function(_0x4ba80e){if(_0x4ba80e){return _0x4ba80e[_0x2353('0x2f')]()[_0x2353('0x19')](function(){_0x1075d4[_0x2353('0x26')](0xcc)[_0x2353('0x30')]();});}};}function handleEntityNotFound(_0x17e998,_0x2481a0){return function(_0x4dcdba){if(!_0x4dcdba){_0x17e998[_0x2353('0x25')](0x194);}return _0x4dcdba;};}function handleError(_0x402514,_0x50cffc){_0x50cffc=_0x50cffc||0x1f4;return function(_0x1821ee){logger[_0x2353('0x20')](_0x1821ee['stack']);if(_0x1821ee[_0x2353('0x31')]){delete _0x1821ee[_0x2353('0x31')];}_0x402514[_0x2353('0x26')](_0x50cffc)['send'](_0x1821ee);};}exports[_0x2353('0x32')]=function(_0x172231,_0x35d802){var _0x27abe7={},_0xdf370a={},_0x42a82d={'count':0x0,'rows':[]};var _0x418001=db[_0x2353('0x33')][_0x2353('0x34')];_0xdf370a[_0x2353('0x35')]=_[_0x2353('0x36')](_0x418001);_0xdf370a[_0x2353('0x37')]=_[_0x2353('0x36')](_0x172231[_0x2353('0x37')]);_0xdf370a['filters']=_[_0x2353('0x38')](_0xdf370a[_0x2353('0x35')],_0xdf370a[_0x2353('0x37')]);_0x27abe7[_0x2353('0x39')]=_[_0x2353('0x38')](_0xdf370a[_0x2353('0x35')],qs[_0x2353('0x3a')](_0x172231[_0x2353('0x37')][_0x2353('0x3a')]));_0x27abe7['attributes']=_0x27abe7[_0x2353('0x39')][_0x2353('0x3b')]?_0x27abe7[_0x2353('0x39')]:_0xdf370a[_0x2353('0x35')];if(!_0x172231[_0x2353('0x37')][_0x2353('0x3c')](_0x2353('0x3d'))){_0x27abe7['limit']=qs['limit'](_0x172231[_0x2353('0x37')]['limit']);_0x27abe7[_0x2353('0x29')]=qs[_0x2353('0x29')](_0x172231['query']['offset']);}_0x27abe7['order']=qs[_0x2353('0x3e')](_0x172231[_0x2353('0x37')]['sort']);_0x27abe7[_0x2353('0x3f')]=qs[_0x2353('0x40')](_[_0x2353('0x41')](_0x172231[_0x2353('0x37')],_0xdf370a[_0x2353('0x40')]));if(_0x172231[_0x2353('0x37')][_0x2353('0x42')]){_0x27abe7[_0x2353('0x3f')]=_[_0x2353('0x43')](_0x27abe7[_0x2353('0x3f')],{'$or':_[_0x2353('0x44')](_0x418001,function(_0x22a2b5){if(_0x22a2b5[_0x2353('0x45')][_0x2353('0x46')]!==_0x2353('0x47')){var _0x4ab14b={};_0x4ab14b[_0x22a2b5[_0x2353('0x48')]]={'$like':'%'+_0x172231['query'][_0x2353('0x42')]+'%'};return _0x4ab14b;}})});}_0x27abe7=_[_0x2353('0x43')]({},_0x27abe7,_0x172231[_0x2353('0x49')]);var _0x2b7c46={'where':_0x27abe7[_0x2353('0x3f')]};return db[_0x2353('0x33')][_0x2353('0x28')](_0x2b7c46)[_0x2353('0x19')](function(_0x14a634){_0x42a82d[_0x2353('0x28')]=_0x14a634;if(_0x172231[_0x2353('0x37')][_0x2353('0x4a')]){_0x27abe7[_0x2353('0x4b')]=[{'all':!![]}];}return db[_0x2353('0x33')][_0x2353('0x4c')](_0x27abe7);})[_0x2353('0x19')](function(_0xe9e3ef){_0x42a82d[_0x2353('0x4d')]=_0xe9e3ef;return _0x42a82d;})['then'](respondWithFilteredResult(_0x35d802,_0x27abe7))[_0x2353('0x24')](handleError(_0x35d802,null));};exports[_0x2353('0x4e')]=function(_0x16d4e6,_0x32eb98){var _0x505f7d={'raw':![],'where':{'id':_0x16d4e6['params']['id']}},_0x40c1b8={};_0x40c1b8[_0x2353('0x35')]=_['keys'](db['SugarcrmConfiguration'][_0x2353('0x34')]);_0x40c1b8[_0x2353('0x37')]=_[_0x2353('0x36')](_0x16d4e6[_0x2353('0x37')]);_0x40c1b8['filters']=_[_0x2353('0x38')](_0x40c1b8[_0x2353('0x35')],_0x40c1b8[_0x2353('0x37')]);_0x505f7d[_0x2353('0x39')]=_[_0x2353('0x38')](_0x40c1b8['model'],qs[_0x2353('0x3a')](_0x16d4e6[_0x2353('0x37')][_0x2353('0x3a')]));_0x505f7d[_0x2353('0x39')]=_0x505f7d[_0x2353('0x39')]['length']?_0x505f7d[_0x2353('0x39')]:_0x40c1b8[_0x2353('0x35')];if(_0x16d4e6['query'][_0x2353('0x4a')]){_0x505f7d[_0x2353('0x4b')]=[{'all':!![]}];}_0x505f7d=_[_0x2353('0x43')]({},_0x505f7d,_0x16d4e6['options']);return db[_0x2353('0x33')][_0x2353('0x4f')](_0x505f7d)['then'](handleEntityNotFound(_0x32eb98,null))[_0x2353('0x19')](respondWithResult(_0x32eb98,null))[_0x2353('0x24')](handleError(_0x32eb98,null));};exports['create']=function(_0x333c85,_0x27025f){return db['SugarcrmConfiguration'][_0x2353('0x50')](_0x333c85[_0x2353('0x51')],{})[_0x2353('0x19')](respondWithResult(_0x27025f,0xc9))[_0x2353('0x24')](handleError(_0x27025f,null));};exports['update']=function(_0x314e9a,_0x371914){if(_0x314e9a[_0x2353('0x51')]['id']){delete _0x314e9a[_0x2353('0x51')]['id'];}return db['SugarcrmConfiguration'][_0x2353('0x4f')]({'where':{'id':_0x314e9a['params']['id']}})[_0x2353('0x19')](handleEntityNotFound(_0x371914,null))[_0x2353('0x19')](saveUpdates(_0x314e9a[_0x2353('0x51')],null))['then'](respondWithResult(_0x371914,null))[_0x2353('0x24')](handleError(_0x371914,null));};exports['destroy']=function(_0x13b4be,_0x447ef1){return db[_0x2353('0x33')][_0x2353('0x4f')]({'where':{'id':_0x13b4be[_0x2353('0x52')]['id']}})[_0x2353('0x19')](handleEntityNotFound(_0x447ef1,null))[_0x2353('0x19')](removeEntity(_0x447ef1,null))[_0x2353('0x24')](handleError(_0x447ef1,null));};exports[_0x2353('0x53')]=function(_0x2638b3,_0x5cac8d,_0x18daf6){var _0xf45d6f={};var _0x1e671e={};var _0x1fa34f;var _0x447709;return db[_0x2353('0x33')]['findOne']({'where':{'id':_0x2638b3[_0x2353('0x52')]['id']}})[_0x2353('0x19')](handleEntityNotFound(_0x5cac8d,null))[_0x2353('0x19')](function(_0x187c40){if(_0x187c40){_0x1fa34f=_0x187c40;_0x1e671e[_0x2353('0x35')]=_[_0x2353('0x36')](db[_0x2353('0x54')][_0x2353('0x34')]);_0x1e671e[_0x2353('0x37')]=_[_0x2353('0x36')](_0x2638b3[_0x2353('0x37')]);_0x1e671e['filters']=_[_0x2353('0x38')](_0x1e671e[_0x2353('0x35')],_0x1e671e['query']);_0xf45d6f['attributes']=_[_0x2353('0x38')](_0x1e671e['model'],qs['fields'](_0x2638b3[_0x2353('0x37')][_0x2353('0x3a')]));_0xf45d6f[_0x2353('0x39')]=_0xf45d6f[_0x2353('0x39')][_0x2353('0x3b')]?_0xf45d6f[_0x2353('0x39')]:_0x1e671e[_0x2353('0x35')];_0xf45d6f[_0x2353('0x55')]=qs[_0x2353('0x3e')](_0x2638b3[_0x2353('0x37')][_0x2353('0x3e')]);_0xf45d6f[_0x2353('0x3f')]=qs[_0x2353('0x40')](_[_0x2353('0x41')](_0x2638b3[_0x2353('0x37')],_0x1e671e[_0x2353('0x40')]));if(_0x2638b3[_0x2353('0x37')][_0x2353('0x42')]){_0xf45d6f['where']=_['merge'](_0xf45d6f[_0x2353('0x3f')],{'$or':_[_0x2353('0x44')](_0xf45d6f[_0x2353('0x39')],function(_0xcb39a5){var _0x28450a={};_0x28450a[_0xcb39a5]={'$like':'%'+_0x2638b3['query'][_0x2353('0x42')]+'%'};return _0x28450a;})});}_0xf45d6f=_[_0x2353('0x43')]({},_0xf45d6f,_0x2638b3['options']);return _0x1fa34f[_0x2353('0x53')](_0xf45d6f);}})[_0x2353('0x19')](function(_0x2f48dc){if(_0x2f48dc){_0x447709=_0x2f48dc[_0x2353('0x3b')];if(!_0x2638b3['query'][_0x2353('0x3c')](_0x2353('0x3d'))){_0xf45d6f[_0x2353('0x2a')]=qs[_0x2353('0x2a')](_0x2638b3['query']['limit']);_0xf45d6f[_0x2353('0x29')]=qs['offset'](_0x2638b3['query'][_0x2353('0x29')]);}return _0x1fa34f[_0x2353('0x53')](_0xf45d6f);}})[_0x2353('0x19')](function(_0x5c14bc){if(_0x5c14bc){return _0x5c14bc?{'count':_0x447709,'rows':_0x5c14bc}:null;}})[_0x2353('0x19')](respondWithResult(_0x5cac8d,null))[_0x2353('0x24')](handleError(_0x5cac8d,null));};exports[_0x2353('0x56')]=function(_0x3cc0a6,_0x14fdc6,_0x3fab60){var _0x5c54fb={};var _0x3e9eb5={};var _0x42e764;var _0x22f5f9;return db[_0x2353('0x33')][_0x2353('0x57')]({'where':{'id':_0x3cc0a6['params']['id']}})[_0x2353('0x19')](handleEntityNotFound(_0x14fdc6,null))['then'](function(_0x509690){if(_0x509690){_0x42e764=_0x509690;_0x3e9eb5[_0x2353('0x35')]=_['keys'](db[_0x2353('0x54')][_0x2353('0x34')]);_0x3e9eb5['query']=_[_0x2353('0x36')](_0x3cc0a6['query']);_0x3e9eb5[_0x2353('0x40')]=_[_0x2353('0x38')](_0x3e9eb5[_0x2353('0x35')],_0x3e9eb5[_0x2353('0x37')]);_0x5c54fb[_0x2353('0x39')]=_[_0x2353('0x38')](_0x3e9eb5[_0x2353('0x35')],qs[_0x2353('0x3a')](_0x3cc0a6['query'][_0x2353('0x3a')]));_0x5c54fb[_0x2353('0x39')]=_0x5c54fb[_0x2353('0x39')][_0x2353('0x3b')]?_0x5c54fb[_0x2353('0x39')]:_0x3e9eb5[_0x2353('0x35')];_0x5c54fb[_0x2353('0x55')]=qs[_0x2353('0x3e')](_0x3cc0a6[_0x2353('0x37')][_0x2353('0x3e')]);_0x5c54fb['where']=qs[_0x2353('0x40')](_[_0x2353('0x41')](_0x3cc0a6[_0x2353('0x37')],_0x3e9eb5[_0x2353('0x40')]));if(_0x3cc0a6[_0x2353('0x37')][_0x2353('0x42')]){_0x5c54fb[_0x2353('0x3f')]=_[_0x2353('0x43')](_0x5c54fb[_0x2353('0x3f')],{'$or':_[_0x2353('0x44')](_0x5c54fb[_0x2353('0x39')],function(_0x2f6d86){var _0x298a79={};_0x298a79[_0x2f6d86]={'$like':'%'+_0x3cc0a6[_0x2353('0x37')][_0x2353('0x42')]+'%'};return _0x298a79;})});}_0x5c54fb=_[_0x2353('0x43')]({},_0x5c54fb,_0x3cc0a6[_0x2353('0x49')]);return _0x42e764[_0x2353('0x56')](_0x5c54fb);}})[_0x2353('0x19')](function(_0x1ecba5){if(_0x1ecba5){_0x22f5f9=_0x1ecba5['length'];if(!_0x3cc0a6[_0x2353('0x37')][_0x2353('0x3c')]('nolimit')){_0x5c54fb[_0x2353('0x2a')]=qs[_0x2353('0x2a')](_0x3cc0a6[_0x2353('0x37')][_0x2353('0x2a')]);_0x5c54fb['offset']=qs[_0x2353('0x29')](_0x3cc0a6['query'][_0x2353('0x29')]);}return _0x42e764[_0x2353('0x56')](_0x5c54fb);}})[_0x2353('0x19')](function(_0x581f86){if(_0x581f86){return _0x581f86?{'count':_0x22f5f9,'rows':_0x581f86}:null;}})[_0x2353('0x19')](respondWithResult(_0x14fdc6,null))[_0x2353('0x24')](handleError(_0x14fdc6,null));};exports[_0x2353('0x58')]=function(_0x217980,_0x123adf,_0x28d900){var _0x1116b0={};var _0x39e724={};var _0x59232b;var _0x5bb574;return db[_0x2353('0x33')][_0x2353('0x57')]({'where':{'id':_0x217980[_0x2353('0x52')]['id']}})['then'](handleEntityNotFound(_0x123adf,null))[_0x2353('0x19')](function(_0x12b5b0){if(_0x12b5b0){_0x59232b=_0x12b5b0;_0x39e724[_0x2353('0x35')]=_[_0x2353('0x36')](db[_0x2353('0x54')][_0x2353('0x34')]);_0x39e724[_0x2353('0x37')]=_[_0x2353('0x36')](_0x217980[_0x2353('0x37')]);_0x39e724['filters']=_[_0x2353('0x38')](_0x39e724[_0x2353('0x35')],_0x39e724['query']);_0x1116b0[_0x2353('0x39')]=_[_0x2353('0x38')](_0x39e724[_0x2353('0x35')],qs[_0x2353('0x3a')](_0x217980[_0x2353('0x37')][_0x2353('0x3a')]));_0x1116b0[_0x2353('0x39')]=_0x1116b0[_0x2353('0x39')][_0x2353('0x3b')]?_0x1116b0[_0x2353('0x39')]:_0x39e724['model'];_0x1116b0[_0x2353('0x55')]=qs[_0x2353('0x3e')](_0x217980[_0x2353('0x37')][_0x2353('0x3e')]);_0x1116b0['where']=qs[_0x2353('0x40')](_[_0x2353('0x41')](_0x217980[_0x2353('0x37')],_0x39e724[_0x2353('0x40')]));if(_0x217980[_0x2353('0x37')][_0x2353('0x42')]){_0x1116b0[_0x2353('0x3f')]=_[_0x2353('0x43')](_0x1116b0['where'],{'$or':_['map'](_0x1116b0['attributes'],function(_0xcfd06c){var _0xbb52f4={};_0xbb52f4[_0xcfd06c]={'$like':'%'+_0x217980[_0x2353('0x37')]['filter']+'%'};return _0xbb52f4;})});}_0x1116b0=_[_0x2353('0x43')]({},_0x1116b0,_0x217980['options']);return _0x59232b[_0x2353('0x58')](_0x1116b0);}})[_0x2353('0x19')](function(_0x28eee2){if(_0x28eee2){_0x5bb574=_0x28eee2[_0x2353('0x3b')];if(!_0x217980['query'][_0x2353('0x3c')]('nolimit')){_0x1116b0[_0x2353('0x2a')]=qs[_0x2353('0x2a')](_0x217980[_0x2353('0x37')][_0x2353('0x2a')]);_0x1116b0['offset']=qs[_0x2353('0x29')](_0x217980[_0x2353('0x37')][_0x2353('0x29')]);}return _0x59232b[_0x2353('0x58')](_0x1116b0);}})[_0x2353('0x19')](function(_0x380588){if(_0x380588){return _0x380588?{'count':_0x5bb574,'rows':_0x380588}:null;}})[_0x2353('0x19')](respondWithResult(_0x123adf,null))[_0x2353('0x24')](handleError(_0x123adf,null));}; \ No newline at end of file +var _0xc456=['hasOwnProperty','nolimit','order','sort','where','pick','map','type','key','field','filter','merge','options','count','includeAll','include','rows','show','params','filters','find','create','body','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','apply','reject','save','update','destroy','end','name','send','index','SugarcrmConfiguration','rawAttributes','model','keys','query','intersection','attributes','fields','length'];(function(_0x47d4df,_0x437fa4){var _0x5e0ec7=function(_0x41e280){while(--_0x41e280){_0x47d4df['push'](_0x47d4df['shift']());}};_0x5e0ec7(++_0x437fa4);}(_0xc456,0x76));var _0x6c45=function(_0x2a0920,_0x4645cb){_0x2a0920=_0x2a0920-0x0;var _0x4f8cac=_0xc456[_0x2a0920];return _0x4f8cac;};'use strict';var pdf=require(_0x6c45('0x0'));var emlformat=require(_0x6c45('0x1'));var rimraf=require(_0x6c45('0x2'));var zipdir=require(_0x6c45('0x3'));var jsonpatch=require(_0x6c45('0x4'));var rp=require(_0x6c45('0x5'));var moment=require(_0x6c45('0x6'));var BPromise=require(_0x6c45('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x6c45('0x8'));var ejs=require(_0x6c45('0x9'));var fs=require('fs');var _=require(_0x6c45('0xa'));var squel=require(_0x6c45('0xb'));var crypto=require(_0x6c45('0xc'));var jsforce=require(_0x6c45('0xd'));var deskjs=require(_0x6c45('0xe'));var toCsv=require(_0x6c45('0x8'));var querystring=require(_0x6c45('0xf'));var Papa=require('papaparse');var authService=require(_0x6c45('0x10'));var hardwareService=require(_0x6c45('0x11'));var Redis=require(_0x6c45('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0x6c45('0x13'))(_0x6c45('0x14'));var utils=require(_0x6c45('0x15'));var config=require(_0x6c45('0x16'));var db=require(_0x6c45('0x17'))['db'];var jayson=require(_0x6c45('0x18'));var client=jayson['client'][_0x6c45('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x17293e,_0x222331,_0x6313f9,_0x59c75b){return new BPromise(function(_0x368be3,_0x2cb307){var _0x501e46=_0x59c75b||client;return _0x501e46[_0x6c45('0x1a')](_0x17293e,_0x6313f9)[_0x6c45('0x1b')](function(_0x8a956c){logger[_0x6c45('0x1c')](_0x6c45('0x1d'),_0x222331,_0x6c45('0x1e'));logger[_0x6c45('0x1f')](_0x6c45('0x20'),_0x222331,'request\x20sent',JSON[_0x6c45('0x21')](_0x8a956c));if(_0x8a956c[_0x6c45('0x22')]){if(_0x8a956c[_0x6c45('0x22')][_0x6c45('0x23')]===0x1f4){logger[_0x6c45('0x22')](_0x6c45('0x1d'),_0x222331,_0x8a956c['error'][_0x6c45('0x24')]);return _0x2cb307(_0x8a956c['error'][_0x6c45('0x24')]);}logger[_0x6c45('0x22')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x222331,_0x8a956c[_0x6c45('0x22')][_0x6c45('0x24')]);return _0x368be3(_0x8a956c[_0x6c45('0x22')][_0x6c45('0x24')]);}else{logger[_0x6c45('0x1c')](_0x6c45('0x1d'),_0x222331,'request\x20sent');_0x368be3(_0x8a956c[_0x6c45('0x25')][_0x6c45('0x24')]);}})[_0x6c45('0x26')](function(_0x21a752){logger[_0x6c45('0x22')](_0x6c45('0x1d'),_0x222331,_0x21a752);_0x2cb307(_0x21a752);});});}function respondWithStatusCode(_0x5f2911,_0x10e94f){_0x10e94f=_0x10e94f||0xcc;return function(_0x402aea){if(_0x402aea){return _0x5f2911[_0x6c45('0x27')](_0x10e94f);}return _0x5f2911[_0x6c45('0x28')](_0x10e94f)['end']();};}function respondWithResult(_0x29b045,_0x3f733a){_0x3f733a=_0x3f733a||0xc8;return function(_0x433eaf){if(_0x433eaf){return _0x29b045[_0x6c45('0x28')](_0x3f733a)[_0x6c45('0x29')](_0x433eaf);}};}function respondWithFilteredResult(_0x1b3395,_0x2177f5){return function(_0xb15b9c){if(_0xb15b9c){var _0x12423a=_0xb15b9c['count'],_0x1c887d=_0x2177f5[_0x6c45('0x2a')],_0x541b5e=_0x2177f5['offset']+_0x2177f5[_0x6c45('0x2b')],_0x291e3f;if(_0x541b5e>=_0x12423a){_0x541b5e=_0x12423a;_0x291e3f=0xc8;}else{_0x291e3f=0xce;}_0x1b3395[_0x6c45('0x28')](_0x291e3f);return _0x1b3395['set']('Content-Range',_0x1c887d+'-'+_0x541b5e+'/'+_0x12423a)[_0x6c45('0x29')](_0xb15b9c);}return null;};}function patchUpdates(_0x16fd11){return function(_0x304a25){try{jsonpatch[_0x6c45('0x2c')](_0x304a25,_0x16fd11,!![]);}catch(_0x50c39a){return BPromise[_0x6c45('0x2d')](_0x50c39a);}return _0x304a25[_0x6c45('0x2e')]();};}function saveUpdates(_0x4970da,_0x19f7cb){return function(_0x4ee504){if(_0x4ee504){return _0x4ee504[_0x6c45('0x2f')](_0x4970da)[_0x6c45('0x1b')](function(_0x47247a){return _0x47247a;});}return null;};}function removeEntity(_0x488df9,_0x27e471){return function(_0x3ec5e3){if(_0x3ec5e3){return _0x3ec5e3[_0x6c45('0x30')]()[_0x6c45('0x1b')](function(){_0x488df9['status'](0xcc)[_0x6c45('0x31')]();});}};}function handleEntityNotFound(_0x2659fb,_0x285c93){return function(_0xd023d2){if(!_0xd023d2){_0x2659fb[_0x6c45('0x27')](0x194);}return _0xd023d2;};}function handleError(_0x257f01,_0x5bdb3c){_0x5bdb3c=_0x5bdb3c||0x1f4;return function(_0x15ff9d){logger[_0x6c45('0x22')](_0x15ff9d['stack']);if(_0x15ff9d[_0x6c45('0x32')]){delete _0x15ff9d[_0x6c45('0x32')];}_0x257f01[_0x6c45('0x28')](_0x5bdb3c)[_0x6c45('0x33')](_0x15ff9d);};}exports[_0x6c45('0x34')]=function(_0x1c443a,_0x4f1956){var _0x5532fd={},_0x3c6bac={},_0x42abe6={'count':0x0,'rows':[]};var _0x167d9d=db[_0x6c45('0x35')][_0x6c45('0x36')];_0x3c6bac[_0x6c45('0x37')]=_[_0x6c45('0x38')](_0x167d9d);_0x3c6bac[_0x6c45('0x39')]=_[_0x6c45('0x38')](_0x1c443a['query']);_0x3c6bac['filters']=_[_0x6c45('0x3a')](_0x3c6bac['model'],_0x3c6bac[_0x6c45('0x39')]);_0x5532fd[_0x6c45('0x3b')]=_[_0x6c45('0x3a')](_0x3c6bac[_0x6c45('0x37')],qs[_0x6c45('0x3c')](_0x1c443a['query'][_0x6c45('0x3c')]));_0x5532fd[_0x6c45('0x3b')]=_0x5532fd[_0x6c45('0x3b')][_0x6c45('0x3d')]?_0x5532fd['attributes']:_0x3c6bac[_0x6c45('0x37')];if(!_0x1c443a[_0x6c45('0x39')][_0x6c45('0x3e')](_0x6c45('0x3f'))){_0x5532fd[_0x6c45('0x2b')]=qs[_0x6c45('0x2b')](_0x1c443a[_0x6c45('0x39')][_0x6c45('0x2b')]);_0x5532fd[_0x6c45('0x2a')]=qs[_0x6c45('0x2a')](_0x1c443a[_0x6c45('0x39')]['offset']);}_0x5532fd[_0x6c45('0x40')]=qs[_0x6c45('0x41')](_0x1c443a[_0x6c45('0x39')][_0x6c45('0x41')]);_0x5532fd[_0x6c45('0x42')]=qs['filters'](_[_0x6c45('0x43')](_0x1c443a[_0x6c45('0x39')],_0x3c6bac['filters']));if(_0x1c443a['query']['filter']){_0x5532fd['where']=_['merge'](_0x5532fd[_0x6c45('0x42')],{'$or':_[_0x6c45('0x44')](_0x167d9d,function(_0x526250){if(_0x526250[_0x6c45('0x45')][_0x6c45('0x46')]!=='VIRTUAL'){var _0x1e4823={};_0x1e4823[_0x526250[_0x6c45('0x47')]]={'$like':'%'+_0x1c443a[_0x6c45('0x39')][_0x6c45('0x48')]+'%'};return _0x1e4823;}})});}_0x5532fd=_[_0x6c45('0x49')]({},_0x5532fd,_0x1c443a[_0x6c45('0x4a')]);var _0x59dec7={'where':_0x5532fd[_0x6c45('0x42')]};return db['SugarcrmConfiguration'][_0x6c45('0x4b')](_0x59dec7)[_0x6c45('0x1b')](function(_0x288559){_0x42abe6['count']=_0x288559;if(_0x1c443a[_0x6c45('0x39')][_0x6c45('0x4c')]){_0x5532fd[_0x6c45('0x4d')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x5532fd);})[_0x6c45('0x1b')](function(_0x1a0929){_0x42abe6[_0x6c45('0x4e')]=_0x1a0929;return _0x42abe6;})[_0x6c45('0x1b')](respondWithFilteredResult(_0x4f1956,_0x5532fd))[_0x6c45('0x26')](handleError(_0x4f1956,null));};exports[_0x6c45('0x4f')]=function(_0x1f1684,_0x1e399b){var _0x1c692b={'raw':![],'where':{'id':_0x1f1684[_0x6c45('0x50')]['id']}},_0x356bfc={};_0x356bfc[_0x6c45('0x37')]=_['keys'](db['SugarcrmConfiguration'][_0x6c45('0x36')]);_0x356bfc['query']=_['keys'](_0x1f1684[_0x6c45('0x39')]);_0x356bfc[_0x6c45('0x51')]=_[_0x6c45('0x3a')](_0x356bfc[_0x6c45('0x37')],_0x356bfc['query']);_0x1c692b['attributes']=_['intersection'](_0x356bfc['model'],qs[_0x6c45('0x3c')](_0x1f1684[_0x6c45('0x39')][_0x6c45('0x3c')]));_0x1c692b['attributes']=_0x1c692b[_0x6c45('0x3b')][_0x6c45('0x3d')]?_0x1c692b[_0x6c45('0x3b')]:_0x356bfc['model'];if(_0x1f1684[_0x6c45('0x39')]['includeAll']){_0x1c692b[_0x6c45('0x4d')]=[{'all':!![]}];}_0x1c692b=_[_0x6c45('0x49')]({},_0x1c692b,_0x1f1684[_0x6c45('0x4a')]);return db[_0x6c45('0x35')][_0x6c45('0x52')](_0x1c692b)[_0x6c45('0x1b')](handleEntityNotFound(_0x1e399b,null))[_0x6c45('0x1b')](respondWithResult(_0x1e399b,null))[_0x6c45('0x26')](handleError(_0x1e399b,null));};exports[_0x6c45('0x53')]=function(_0x44be6e,_0x4fd99b){return db[_0x6c45('0x35')][_0x6c45('0x53')](_0x44be6e['body'],{})[_0x6c45('0x1b')](respondWithResult(_0x4fd99b,0xc9))[_0x6c45('0x26')](handleError(_0x4fd99b,null));};exports[_0x6c45('0x2f')]=function(_0x5ab78f,_0x44d910){if(_0x5ab78f[_0x6c45('0x54')]['id']){delete _0x5ab78f[_0x6c45('0x54')]['id'];}return db[_0x6c45('0x35')]['find']({'where':{'id':_0x5ab78f[_0x6c45('0x50')]['id']}})[_0x6c45('0x1b')](handleEntityNotFound(_0x44d910,null))[_0x6c45('0x1b')](saveUpdates(_0x5ab78f[_0x6c45('0x54')],null))[_0x6c45('0x1b')](respondWithResult(_0x44d910,null))[_0x6c45('0x26')](handleError(_0x44d910,null));};exports[_0x6c45('0x30')]=function(_0x6a8b5d,_0x4c4b0c){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x6a8b5d[_0x6c45('0x50')]['id']}})[_0x6c45('0x1b')](handleEntityNotFound(_0x4c4b0c,null))['then'](removeEntity(_0x4c4b0c,null))['catch'](handleError(_0x4c4b0c,null));};exports[_0x6c45('0x55')]=function(_0x2c1b60,_0x54815b,_0x182b2c){var _0x4d03fa={};var _0x19583e={};var _0x489fa4;var _0x2b66ef;return db[_0x6c45('0x35')][_0x6c45('0x56')]({'where':{'id':_0x2c1b60[_0x6c45('0x50')]['id']}})[_0x6c45('0x1b')](handleEntityNotFound(_0x54815b,null))[_0x6c45('0x1b')](function(_0x15ca89){if(_0x15ca89){_0x489fa4=_0x15ca89;_0x19583e['model']=_[_0x6c45('0x38')](db[_0x6c45('0x57')]['rawAttributes']);_0x19583e['query']=_[_0x6c45('0x38')](_0x2c1b60['query']);_0x19583e[_0x6c45('0x51')]=_[_0x6c45('0x3a')](_0x19583e[_0x6c45('0x37')],_0x19583e[_0x6c45('0x39')]);_0x4d03fa[_0x6c45('0x3b')]=_[_0x6c45('0x3a')](_0x19583e[_0x6c45('0x37')],qs['fields'](_0x2c1b60[_0x6c45('0x39')]['fields']));_0x4d03fa['attributes']=_0x4d03fa[_0x6c45('0x3b')]['length']?_0x4d03fa[_0x6c45('0x3b')]:_0x19583e[_0x6c45('0x37')];_0x4d03fa['order']=qs[_0x6c45('0x41')](_0x2c1b60[_0x6c45('0x39')][_0x6c45('0x41')]);_0x4d03fa['where']=qs[_0x6c45('0x51')](_['pick'](_0x2c1b60[_0x6c45('0x39')],_0x19583e[_0x6c45('0x51')]));if(_0x2c1b60['query'][_0x6c45('0x48')]){_0x4d03fa['where']=_[_0x6c45('0x49')](_0x4d03fa[_0x6c45('0x42')],{'$or':_[_0x6c45('0x44')](_0x4d03fa[_0x6c45('0x3b')],function(_0x35ff53){var _0x5a9785={};_0x5a9785[_0x35ff53]={'$like':'%'+_0x2c1b60[_0x6c45('0x39')]['filter']+'%'};return _0x5a9785;})});}_0x4d03fa=_[_0x6c45('0x49')]({},_0x4d03fa,_0x2c1b60[_0x6c45('0x4a')]);return _0x489fa4[_0x6c45('0x55')](_0x4d03fa);}})[_0x6c45('0x1b')](function(_0x4738f1){if(_0x4738f1){_0x2b66ef=_0x4738f1[_0x6c45('0x3d')];if(!_0x2c1b60[_0x6c45('0x39')][_0x6c45('0x3e')](_0x6c45('0x3f'))){_0x4d03fa['limit']=qs[_0x6c45('0x2b')](_0x2c1b60[_0x6c45('0x39')][_0x6c45('0x2b')]);_0x4d03fa[_0x6c45('0x2a')]=qs[_0x6c45('0x2a')](_0x2c1b60[_0x6c45('0x39')]['offset']);}return _0x489fa4[_0x6c45('0x55')](_0x4d03fa);}})[_0x6c45('0x1b')](function(_0x589eb1){if(_0x589eb1){return _0x589eb1?{'count':_0x2b66ef,'rows':_0x589eb1}:null;}})[_0x6c45('0x1b')](respondWithResult(_0x54815b,null))[_0x6c45('0x26')](handleError(_0x54815b,null));};exports[_0x6c45('0x58')]=function(_0xa4ee39,_0x2bff3a,_0x1a43d8){var _0x10e7ad={};var _0x22a935={};var _0x2d7e55;var _0x42ec4e;return db[_0x6c45('0x35')][_0x6c45('0x56')]({'where':{'id':_0xa4ee39['params']['id']}})[_0x6c45('0x1b')](handleEntityNotFound(_0x2bff3a,null))['then'](function(_0x2a5358){if(_0x2a5358){_0x2d7e55=_0x2a5358;_0x22a935[_0x6c45('0x37')]=_[_0x6c45('0x38')](db[_0x6c45('0x57')][_0x6c45('0x36')]);_0x22a935[_0x6c45('0x39')]=_[_0x6c45('0x38')](_0xa4ee39['query']);_0x22a935[_0x6c45('0x51')]=_[_0x6c45('0x3a')](_0x22a935[_0x6c45('0x37')],_0x22a935[_0x6c45('0x39')]);_0x10e7ad['attributes']=_['intersection'](_0x22a935[_0x6c45('0x37')],qs[_0x6c45('0x3c')](_0xa4ee39['query'][_0x6c45('0x3c')]));_0x10e7ad[_0x6c45('0x3b')]=_0x10e7ad[_0x6c45('0x3b')][_0x6c45('0x3d')]?_0x10e7ad['attributes']:_0x22a935[_0x6c45('0x37')];_0x10e7ad[_0x6c45('0x40')]=qs[_0x6c45('0x41')](_0xa4ee39[_0x6c45('0x39')][_0x6c45('0x41')]);_0x10e7ad['where']=qs['filters'](_[_0x6c45('0x43')](_0xa4ee39['query'],_0x22a935[_0x6c45('0x51')]));if(_0xa4ee39[_0x6c45('0x39')][_0x6c45('0x48')]){_0x10e7ad['where']=_[_0x6c45('0x49')](_0x10e7ad[_0x6c45('0x42')],{'$or':_['map'](_0x10e7ad[_0x6c45('0x3b')],function(_0x4133b0){var _0x8ec218={};_0x8ec218[_0x4133b0]={'$like':'%'+_0xa4ee39[_0x6c45('0x39')][_0x6c45('0x48')]+'%'};return _0x8ec218;})});}_0x10e7ad=_[_0x6c45('0x49')]({},_0x10e7ad,_0xa4ee39[_0x6c45('0x4a')]);return _0x2d7e55[_0x6c45('0x58')](_0x10e7ad);}})[_0x6c45('0x1b')](function(_0x1450d3){if(_0x1450d3){_0x42ec4e=_0x1450d3[_0x6c45('0x3d')];if(!_0xa4ee39[_0x6c45('0x39')][_0x6c45('0x3e')](_0x6c45('0x3f'))){_0x10e7ad[_0x6c45('0x2b')]=qs[_0x6c45('0x2b')](_0xa4ee39[_0x6c45('0x39')][_0x6c45('0x2b')]);_0x10e7ad['offset']=qs[_0x6c45('0x2a')](_0xa4ee39[_0x6c45('0x39')][_0x6c45('0x2a')]);}return _0x2d7e55[_0x6c45('0x58')](_0x10e7ad);}})[_0x6c45('0x1b')](function(_0x21fc1b){if(_0x21fc1b){return _0x21fc1b?{'count':_0x42ec4e,'rows':_0x21fc1b}:null;}})['then'](respondWithResult(_0x2bff3a,null))[_0x6c45('0x26')](handleError(_0x2bff3a,null));};exports[_0x6c45('0x59')]=function(_0x2a81c5,_0x56269c,_0x431e72){var _0x43c29b={};var _0x5e226d={};var _0x44ba13;var _0x4ce2d8;return db[_0x6c45('0x35')][_0x6c45('0x56')]({'where':{'id':_0x2a81c5[_0x6c45('0x50')]['id']}})[_0x6c45('0x1b')](handleEntityNotFound(_0x56269c,null))[_0x6c45('0x1b')](function(_0xbf2566){if(_0xbf2566){_0x44ba13=_0xbf2566;_0x5e226d['model']=_['keys'](db['SugarcrmField'][_0x6c45('0x36')]);_0x5e226d[_0x6c45('0x39')]=_[_0x6c45('0x38')](_0x2a81c5[_0x6c45('0x39')]);_0x5e226d[_0x6c45('0x51')]=_[_0x6c45('0x3a')](_0x5e226d[_0x6c45('0x37')],_0x5e226d[_0x6c45('0x39')]);_0x43c29b[_0x6c45('0x3b')]=_[_0x6c45('0x3a')](_0x5e226d[_0x6c45('0x37')],qs[_0x6c45('0x3c')](_0x2a81c5[_0x6c45('0x39')][_0x6c45('0x3c')]));_0x43c29b[_0x6c45('0x3b')]=_0x43c29b[_0x6c45('0x3b')]['length']?_0x43c29b[_0x6c45('0x3b')]:_0x5e226d[_0x6c45('0x37')];_0x43c29b[_0x6c45('0x40')]=qs[_0x6c45('0x41')](_0x2a81c5[_0x6c45('0x39')]['sort']);_0x43c29b[_0x6c45('0x42')]=qs['filters'](_[_0x6c45('0x43')](_0x2a81c5[_0x6c45('0x39')],_0x5e226d[_0x6c45('0x51')]));if(_0x2a81c5[_0x6c45('0x39')][_0x6c45('0x48')]){_0x43c29b['where']=_[_0x6c45('0x49')](_0x43c29b[_0x6c45('0x42')],{'$or':_[_0x6c45('0x44')](_0x43c29b[_0x6c45('0x3b')],function(_0x471ef8){var _0x552df4={};_0x552df4[_0x471ef8]={'$like':'%'+_0x2a81c5[_0x6c45('0x39')][_0x6c45('0x48')]+'%'};return _0x552df4;})});}_0x43c29b=_[_0x6c45('0x49')]({},_0x43c29b,_0x2a81c5[_0x6c45('0x4a')]);return _0x44ba13[_0x6c45('0x59')](_0x43c29b);}})[_0x6c45('0x1b')](function(_0x279b36){if(_0x279b36){_0x4ce2d8=_0x279b36['length'];if(!_0x2a81c5[_0x6c45('0x39')][_0x6c45('0x3e')](_0x6c45('0x3f'))){_0x43c29b[_0x6c45('0x2b')]=qs[_0x6c45('0x2b')](_0x2a81c5['query'][_0x6c45('0x2b')]);_0x43c29b['offset']=qs[_0x6c45('0x2a')](_0x2a81c5[_0x6c45('0x39')][_0x6c45('0x2a')]);}return _0x44ba13[_0x6c45('0x59')](_0x43c29b);}})[_0x6c45('0x1b')](function(_0x5dde04){if(_0x5dde04){return _0x5dde04?{'count':_0x4ce2d8,'rows':_0x5dde04}:null;}})[_0x6c45('0x1b')](respondWithResult(_0x56269c,null))[_0x6c45('0x26')](handleError(_0x56269c,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 8897fdb..c124e90 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 _0xd3e7=['int_sugarcrm_configurations','lodash','../../config/logger','bluebird','request-promise','./intSugarcrmConfiguration.attributes','exports','define'];(function(_0x1d7b7b,_0x51c6f6){var _0x15e3b7=function(_0xbeaeb1){while(--_0xbeaeb1){_0x1d7b7b['push'](_0x1d7b7b['shift']());}};_0x15e3b7(++_0x51c6f6);}(_0xd3e7,0xb9));var _0x7d3e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd3e7[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x7d3e('0x0'));var util=require('util');var logger=require(_0x7d3e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7d3e('0x2'));var rp=require(_0x7d3e('0x3'));var attributes=require(_0x7d3e('0x4'));module[_0x7d3e('0x5')]=function(_0x509814,_0xfd5b0b){return _0x509814[_0x7d3e('0x6')]('SugarcrmConfiguration',attributes,{'tableName':_0x7d3e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9790=['SugarcrmConfiguration','lodash','util','moment','bluebird','request-promise','exports','define'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0x9790,0xc1));var _0x0979=function(_0x2d4af7,_0xed215d){_0x2d4af7=_0x2d4af7-0x0;var _0x56cff9=_0x9790[_0x2d4af7];return _0x56cff9;};'use strict';var _=require(_0x0979('0x0'));var util=require(_0x0979('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0979('0x2'));var BPromise=require(_0x0979('0x3'));var rp=require(_0x0979('0x4'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x0979('0x5')]=function(_0x4f2e67,_0x16f7b8){return _0x4f2e67[_0x0979('0x6')](_0x0979('0x7'),attributes,{'tableName':'int_sugarcrm_configurations','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 6ff2cc8..cf4939e 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 _0xc2fa=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util'];(function(_0x73cb3c,_0x38c397){var _0x509312=function(_0x4e4e40){while(--_0x4e4e40){_0x73cb3c['push'](_0x73cb3c['shift']());}};_0x509312(++_0x38c397);}(_0xc2fa,0xbf));var _0xac2f=function(_0x2a8791,_0x52d8de){_0x2a8791=_0x2a8791-0x0;var _0x379777=_0xc2fa[_0x2a8791];return _0x379777;};'use strict';var _=require('lodash');var util=require(_0xac2f('0x0'));var moment=require(_0xac2f('0x1'));var BPromise=require(_0xac2f('0x2'));var rs=require(_0xac2f('0x3'));var fs=require('fs');var Redis=require(_0xac2f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xac2f('0x5'));var logger=require(_0xac2f('0x6'))(_0xac2f('0x7'));var config=require(_0xac2f('0x8'));var jayson=require(_0xac2f('0x9'));var client=jayson[_0xac2f('0xa')][_0xac2f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45d8b3,_0x47a3a8,_0x2e4d18){return new BPromise(function(_0x4626f6,_0x289b63){return client['request'](_0x45d8b3,_0x2e4d18)[_0xac2f('0xc')](function(_0x368acb){logger['info'](_0xac2f('0xd'),_0x47a3a8,_0xac2f('0xe'));logger[_0xac2f('0xf')](_0xac2f('0x10'),_0x47a3a8,_0xac2f('0xe'),JSON[_0xac2f('0x11')](_0x368acb));if(_0x368acb[_0xac2f('0x12')]){if(_0x368acb[_0xac2f('0x12')][_0xac2f('0x13')]===0x1f4){logger['error'](_0xac2f('0xd'),_0x47a3a8,_0x368acb[_0xac2f('0x12')][_0xac2f('0x14')]);return _0x289b63(_0x368acb['error']['message']);}logger[_0xac2f('0x12')](_0xac2f('0xd'),_0x47a3a8,_0x368acb['error'][_0xac2f('0x14')]);return _0x4626f6(_0x368acb[_0xac2f('0x12')][_0xac2f('0x14')]);}else{logger[_0xac2f('0x15')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x47a3a8,_0xac2f('0xe'));_0x4626f6(_0x368acb[_0xac2f('0x16')][_0xac2f('0x14')]);}})[_0xac2f('0x17')](function(_0x3e51fa){logger['error'](_0xac2f('0xd'),_0x47a3a8,_0x3e51fa);_0x289b63(_0x3e51fa);});});} \ No newline at end of file +var _0xd33f=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x365de6,_0x3f7e16){var _0xc448f4=function(_0x356078){while(--_0x356078){_0x365de6['push'](_0x365de6['shift']());}};_0xc448f4(++_0x3f7e16);}(_0xd33f,0x16d));var _0xfd33=function(_0x3a391c,_0x4fc0f3){_0x3a391c=_0x3a391c-0x0;var _0x28a628=_0xd33f[_0x3a391c];return _0x28a628;};'use strict';var _=require(_0xfd33('0x0'));var util=require(_0xfd33('0x1'));var moment=require(_0xfd33('0x2'));var BPromise=require(_0xfd33('0x3'));var rs=require(_0xfd33('0x4'));var fs=require('fs');var Redis=require(_0xfd33('0x5'));var db=require(_0xfd33('0x6'))['db'];var utils=require(_0xfd33('0x7'));var logger=require(_0xfd33('0x8'))(_0xfd33('0x9'));var config=require(_0xfd33('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xfd33('0xb')][_0xfd33('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x590018,_0x4b8122,_0x78dd63){return new BPromise(function(_0x3a53a5,_0x5e1233){return client[_0xfd33('0xd')](_0x590018,_0x78dd63)['then'](function(_0x414114){logger[_0xfd33('0xe')](_0xfd33('0xf'),_0x4b8122,'request\x20sent');logger[_0xfd33('0x10')](_0xfd33('0x11'),_0x4b8122,_0xfd33('0x12'),JSON['stringify'](_0x414114));if(_0x414114['error']){if(_0x414114[_0xfd33('0x13')][_0xfd33('0x14')]===0x1f4){logger[_0xfd33('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4b8122,_0x414114[_0xfd33('0x13')][_0xfd33('0x15')]);return _0x5e1233(_0x414114[_0xfd33('0x13')][_0xfd33('0x15')]);}logger[_0xfd33('0x13')](_0xfd33('0xf'),_0x4b8122,_0x414114[_0xfd33('0x13')][_0xfd33('0x15')]);return _0x3a53a5(_0x414114['error']['message']);}else{logger[_0xfd33('0xe')](_0xfd33('0xf'),_0x4b8122,'request\x20sent');_0x3a53a5(_0x414114[_0xfd33('0x16')]['message']);}})[_0xfd33('0x17')](function(_0x359207){logger[_0xfd33('0x13')](_0xfd33('0xf'),_0x4b8122,_0x359207);_0x5e1233(_0x359207);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index a00a979..baa3bb4 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 _0xc0b2=['put','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','/:id','post','create'];(function(_0x5e7303,_0x56e896){var _0x5ca7aa=function(_0x3bd8a2){while(--_0x3bd8a2){_0x5e7303['push'](_0x5e7303['shift']());}};_0x5ca7aa(++_0x56e896);}(_0xc0b2,0xbf));var _0x2c0b=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xc0b2[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x2c0b('0x0'));var util=require(_0x2c0b('0x1'));var path=require(_0x2c0b('0x2'));var timeout=require('connect-timeout');var express=require(_0x2c0b('0x3'));var router=express['Router']();var auth=require(_0x2c0b('0x4'));var interaction=require(_0x2c0b('0x5'));var config=require(_0x2c0b('0x6'));var controller=require(_0x2c0b('0x7'));router['get']('/',auth[_0x2c0b('0x8')](),controller[_0x2c0b('0x9')]);router['get'](_0x2c0b('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x2c0b('0xb')]('/',auth[_0x2c0b('0x8')](),controller[_0x2c0b('0xc')]);router[_0x2c0b('0xd')](_0x2c0b('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x2c0b('0xe')](_0x2c0b('0xa'),auth[_0x2c0b('0x8')](),controller[_0x2c0b('0xf')]);module[_0x2c0b('0x10')]=router; \ No newline at end of file +var _0xb072=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','post'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xb072,0x1a7));var _0x2b07=function(_0x3f67ee,_0x37fd14){_0x3f67ee=_0x3f67ee-0x0;var _0x319ee4=_0xb072[_0x3f67ee];return _0x319ee4;};'use strict';var multer=require(_0x2b07('0x0'));var util=require(_0x2b07('0x1'));var path=require('path');var timeout=require(_0x2b07('0x2'));var express=require(_0x2b07('0x3'));var router=express[_0x2b07('0x4')]();var auth=require(_0x2b07('0x5'));var interaction=require(_0x2b07('0x6'));var config=require(_0x2b07('0x7'));var controller=require(_0x2b07('0x8'));router[_0x2b07('0x9')]('/',auth[_0x2b07('0xa')](),controller[_0x2b07('0xb')]);router['get'](_0x2b07('0xc'),auth[_0x2b07('0xa')](),controller['show']);router[_0x2b07('0xd')]('/',auth[_0x2b07('0xa')](),controller['create']);router[_0x2b07('0xe')](_0x2b07('0xc'),auth[_0x2b07('0xa')](),controller[_0x2b07('0xf')]);router[_0x2b07('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x2b07('0x11')]);module[_0x2b07('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 9f49447..af2c627 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 _0x4483=['customVariable','keyValue','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x2d7dcd,_0x2dce76){var _0x2ee389=function(_0x2cbec2){while(--_0x2cbec2){_0x2d7dcd['push'](_0x2d7dcd['shift']());}};_0x2ee389(++_0x2dce76);}(_0x4483,0x1a3));var _0x3448=function(_0x3b4f05,_0x41ebc2){_0x3b4f05=_0x3b4f05-0x0;var _0x10ab50=_0x4483[_0x3b4f05];return _0x10ab50;};'use strict';var Sequelize=require(_0x3448('0x0'));module[_0x3448('0x1')]={'type':{'type':Sequelize[_0x3448('0x2')]('string',_0x3448('0x3'),_0x3448('0x4'),_0x3448('0x5')),'defaultValue':_0x3448('0x6')},'content':{'type':Sequelize[_0x3448('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3448('0x2')](_0x3448('0x6'),_0x3448('0x3'),_0x3448('0x4'))},'keyContent':{'type':Sequelize[_0x3448('0x7')]},'idField':{'type':Sequelize[_0x3448('0x7')]},'nameField':{'type':Sequelize[_0x3448('0x7')]},'customField':{'type':Sequelize[_0x3448('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf109=['ENUM','keyValue','string','STRING','variable','customVariable','sequelize','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf109,0xce));var _0x9f10=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xf109[_0x4ff09b];return _0x3f5c2e;};'use strict';var Sequelize=require(_0x9f10('0x0'));module[_0x9f10('0x1')]={'type':{'type':Sequelize[_0x9f10('0x2')]('string','variable','customVariable',_0x9f10('0x3')),'defaultValue':_0x9f10('0x4')},'content':{'type':Sequelize[_0x9f10('0x5')]},'key':{'type':Sequelize[_0x9f10('0x5')]},'keyType':{'type':Sequelize[_0x9f10('0x2')](_0x9f10('0x4'),_0x9f10('0x6'),_0x9f10('0x7'))},'keyContent':{'type':Sequelize[_0x9f10('0x5')]},'idField':{'type':Sequelize[_0x9f10('0x5')]},'nameField':{'type':Sequelize[_0x9f10('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9f10('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index bb8a188..7d41bef 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 _0x4845=['update','then','destroy','stack','name','index','SugarcrmField','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','key','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','include','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save'];(function(_0x3453fc,_0x28c492){var _0x53d63d=function(_0x5d9e03){while(--_0x5d9e03){_0x3453fc['push'](_0x3453fc['shift']());}};_0x53d63d(++_0x28c492);}(_0x4845,0xb2));var _0x5484=function(_0x122717,_0x52ca2f){_0x122717=_0x122717-0x0;var _0x59021b=_0x4845[_0x122717];return _0x59021b;};'use strict';var pdf=require(_0x5484('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5484('0x1'));var zipdir=require(_0x5484('0x2'));var jsonpatch=require(_0x5484('0x3'));var rp=require(_0x5484('0x4'));var moment=require(_0x5484('0x5'));var BPromise=require(_0x5484('0x6'));var Mustache=require(_0x5484('0x7'));var util=require(_0x5484('0x8'));var path=require(_0x5484('0x9'));var sox=require(_0x5484('0xa'));var csv=require(_0x5484('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5484('0xc'));var squel=require(_0x5484('0xd'));var crypto=require(_0x5484('0xe'));var jsforce=require(_0x5484('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5484('0xb'));var querystring=require(_0x5484('0x10'));var Papa=require('papaparse');var authService=require(_0x5484('0x11'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x5484('0x12'));var utils=require(_0x5484('0x13'));var config=require(_0x5484('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e59fc,_0x2b51f3){_0x2b51f3=_0x2b51f3||0xcc;return function(_0x33aeed){if(_0x33aeed){return _0x4e59fc[_0x5484('0x15')](_0x2b51f3);}return _0x4e59fc['status'](_0x2b51f3)[_0x5484('0x16')]();};}function respondWithResult(_0x477d46,_0x468844){_0x468844=_0x468844||0xc8;return function(_0x33a6c6){if(_0x33a6c6){return _0x477d46[_0x5484('0x17')](_0x468844)[_0x5484('0x18')](_0x33a6c6);}};}function respondWithFilteredResult(_0x46ce3e,_0x48712d){return function(_0x1c758e){if(_0x1c758e){var _0x9dd48=_0x1c758e[_0x5484('0x19')],_0x2224ba=_0x48712d[_0x5484('0x1a')],_0x586ce0=_0x48712d[_0x5484('0x1a')]+_0x48712d[_0x5484('0x1b')],_0x583028;if(_0x586ce0>=_0x9dd48){_0x586ce0=_0x9dd48;_0x583028=0xc8;}else{_0x583028=0xce;}_0x46ce3e[_0x5484('0x17')](_0x583028);return _0x46ce3e[_0x5484('0x1c')](_0x5484('0x1d'),_0x2224ba+'-'+_0x586ce0+'/'+_0x9dd48)[_0x5484('0x18')](_0x1c758e);}return null;};}function patchUpdates(_0x59ed08){return function(_0x2d1b2b){try{jsonpatch[_0x5484('0x1e')](_0x2d1b2b,_0x59ed08,!![]);}catch(_0x460d8c){return BPromise['reject'](_0x460d8c);}return _0x2d1b2b[_0x5484('0x1f')]();};}function saveUpdates(_0x2711b2,_0x23772f){return function(_0x1af65e){if(_0x1af65e){return _0x1af65e[_0x5484('0x20')](_0x2711b2)[_0x5484('0x21')](function(_0x4d5a20){return _0x4d5a20;});}return null;};}function removeEntity(_0x41572b,_0x206fc8){return function(_0x3ac104){if(_0x3ac104){return _0x3ac104[_0x5484('0x22')]()[_0x5484('0x21')](function(){_0x41572b[_0x5484('0x17')](0xcc)[_0x5484('0x16')]();});}};}function handleEntityNotFound(_0x1446b3,_0x50ee13){return function(_0x5cbfd5){if(!_0x5cbfd5){_0x1446b3['sendStatus'](0x194);}return _0x5cbfd5;};}function handleError(_0x3ba894,_0x1bc931){_0x1bc931=_0x1bc931||0x1f4;return function(_0x10e80c){logger['error'](_0x10e80c[_0x5484('0x23')]);if(_0x10e80c[_0x5484('0x24')]){delete _0x10e80c[_0x5484('0x24')];}_0x3ba894[_0x5484('0x17')](_0x1bc931)['send'](_0x10e80c);};}exports[_0x5484('0x25')]=function(_0x2250ac,_0x4382b2){var _0xe4768e={},_0x8a70ba={},_0x36ae8f={'count':0x0,'rows':[]};var _0x420613=db[_0x5484('0x26')][_0x5484('0x27')];_0x8a70ba[_0x5484('0x28')]=_[_0x5484('0x29')](_0x420613);_0x8a70ba[_0x5484('0x2a')]=_[_0x5484('0x29')](_0x2250ac[_0x5484('0x2a')]);_0x8a70ba[_0x5484('0x2b')]=_[_0x5484('0x2c')](_0x8a70ba[_0x5484('0x28')],_0x8a70ba['query']);_0xe4768e['attributes']=_[_0x5484('0x2c')](_0x8a70ba[_0x5484('0x28')],qs[_0x5484('0x2d')](_0x2250ac[_0x5484('0x2a')][_0x5484('0x2d')]));_0xe4768e[_0x5484('0x2e')]=_0xe4768e['attributes'][_0x5484('0x2f')]?_0xe4768e[_0x5484('0x2e')]:_0x8a70ba[_0x5484('0x28')];if(!_0x2250ac['query'][_0x5484('0x30')](_0x5484('0x31'))){_0xe4768e[_0x5484('0x1b')]=qs[_0x5484('0x1b')](_0x2250ac['query'][_0x5484('0x1b')]);_0xe4768e[_0x5484('0x1a')]=qs[_0x5484('0x1a')](_0x2250ac[_0x5484('0x2a')]['offset']);}_0xe4768e[_0x5484('0x32')]=qs[_0x5484('0x33')](_0x2250ac['query']['sort']);_0xe4768e[_0x5484('0x34')]=qs[_0x5484('0x2b')](_[_0x5484('0x35')](_0x2250ac[_0x5484('0x2a')],_0x8a70ba[_0x5484('0x2b')]));if(_0x2250ac[_0x5484('0x2a')][_0x5484('0x36')]){_0xe4768e[_0x5484('0x34')]=_['merge'](_0xe4768e[_0x5484('0x34')],{'$or':_[_0x5484('0x37')](_0x420613,function(_0x7e70fd){if(_0x7e70fd[_0x5484('0x38')][_0x5484('0x39')]!==_0x5484('0x3a')){var _0x42e542={};_0x42e542[_0x7e70fd['field']]={'$like':'%'+_0x2250ac[_0x5484('0x2a')][_0x5484('0x36')]+'%'};return _0x42e542;}})});}_0xe4768e=_[_0x5484('0x3b')]({},_0xe4768e,_0x2250ac[_0x5484('0x3c')]);var _0x27dc62={'where':_0xe4768e['where']};return db['SugarcrmField'][_0x5484('0x19')](_0x27dc62)[_0x5484('0x21')](function(_0x1c4a44){_0x36ae8f[_0x5484('0x19')]=_0x1c4a44;if(_0x2250ac[_0x5484('0x2a')][_0x5484('0x3d')]){_0xe4768e['include']=[{'all':!![]}];}return db['SugarcrmField'][_0x5484('0x3e')](_0xe4768e);})['then'](function(_0x5824a3){_0x36ae8f[_0x5484('0x3f')]=_0x5824a3;return _0x36ae8f;})[_0x5484('0x21')](respondWithFilteredResult(_0x4382b2,_0xe4768e))[_0x5484('0x40')](handleError(_0x4382b2,null));};exports['show']=function(_0xd6b88c,_0x28ccf0){var _0x22c08c={'raw':!![],'where':{'id':_0xd6b88c[_0x5484('0x41')]['id']}},_0x4b5b28={};_0x4b5b28[_0x5484('0x28')]=_[_0x5484('0x29')](db[_0x5484('0x26')][_0x5484('0x27')]);_0x4b5b28[_0x5484('0x2a')]=_[_0x5484('0x29')](_0xd6b88c[_0x5484('0x2a')]);_0x4b5b28['filters']=_[_0x5484('0x2c')](_0x4b5b28['model'],_0x4b5b28[_0x5484('0x2a')]);_0x22c08c[_0x5484('0x2e')]=_[_0x5484('0x2c')](_0x4b5b28['model'],qs[_0x5484('0x2d')](_0xd6b88c['query'][_0x5484('0x2d')]));_0x22c08c[_0x5484('0x2e')]=_0x22c08c[_0x5484('0x2e')][_0x5484('0x2f')]?_0x22c08c[_0x5484('0x2e')]:_0x4b5b28['model'];if(_0xd6b88c[_0x5484('0x2a')][_0x5484('0x3d')]){_0x22c08c[_0x5484('0x42')]=[{'all':!![]}];}_0x22c08c=_[_0x5484('0x3b')]({},_0x22c08c,_0xd6b88c[_0x5484('0x3c')]);return db[_0x5484('0x26')][_0x5484('0x43')](_0x22c08c)[_0x5484('0x21')](handleEntityNotFound(_0x28ccf0,null))[_0x5484('0x21')](respondWithResult(_0x28ccf0,null))[_0x5484('0x40')](handleError(_0x28ccf0,null));};exports[_0x5484('0x44')]=function(_0x5ecb18,_0x10f6a3){return db[_0x5484('0x26')][_0x5484('0x44')](_0x5ecb18[_0x5484('0x45')],{})[_0x5484('0x21')](respondWithResult(_0x10f6a3,0xc9))[_0x5484('0x40')](handleError(_0x10f6a3,null));};exports[_0x5484('0x20')]=function(_0x9684c5,_0xf465a2){if(_0x9684c5[_0x5484('0x45')]['id']){delete _0x9684c5[_0x5484('0x45')]['id'];}return db[_0x5484('0x26')][_0x5484('0x43')]({'where':{'id':_0x9684c5['params']['id']}})[_0x5484('0x21')](handleEntityNotFound(_0xf465a2,null))[_0x5484('0x21')](saveUpdates(_0x9684c5[_0x5484('0x45')],null))['then'](respondWithResult(_0xf465a2,null))['catch'](handleError(_0xf465a2,null));};exports[_0x5484('0x22')]=function(_0xc0ae03,_0xdef30b){return db[_0x5484('0x26')][_0x5484('0x43')]({'where':{'id':_0xc0ae03[_0x5484('0x41')]['id']}})[_0x5484('0x21')](handleEntityNotFound(_0xdef30b,null))[_0x5484('0x21')](removeEntity(_0xdef30b,null))[_0x5484('0x40')](handleError(_0xdef30b,null));}; \ No newline at end of file +var _0x4fde=['create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','map','type','VIRTUAL','field','options','SugarcrmField','includeAll','findAll','rows','catch','show','params','length','include','find'];(function(_0x2f1549,_0xf15226){var _0x2f0919=function(_0x1dc303){while(--_0x1dc303){_0x2f1549['push'](_0x2f1549['shift']());}};_0x2f0919(++_0xf15226);}(_0x4fde,0x16f));var _0xe4fd=function(_0x46451c,_0x88ddd){_0x46451c=_0x46451c-0x0;var _0x12dce4=_0x4fde[_0x46451c];return _0x12dce4;};'use strict';var pdf=require(_0xe4fd('0x0'));var emlformat=require(_0xe4fd('0x1'));var rimraf=require(_0xe4fd('0x2'));var zipdir=require(_0xe4fd('0x3'));var jsonpatch=require(_0xe4fd('0x4'));var rp=require(_0xe4fd('0x5'));var moment=require(_0xe4fd('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xe4fd('0x7'));var util=require('util');var path=require(_0xe4fd('0x8'));var sox=require(_0xe4fd('0x9'));var csv=require(_0xe4fd('0xa'));var ejs=require(_0xe4fd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe4fd('0xc'));var crypto=require('crypto');var jsforce=require(_0xe4fd('0xd'));var deskjs=require(_0xe4fd('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe4fd('0xf'));var Papa=require(_0xe4fd('0x10'));var authService=require(_0xe4fd('0x11'));var hardwareService=require(_0xe4fd('0x12'));var Redis=require(_0xe4fd('0x13'));var qs=require(_0xe4fd('0x14'));var logger=require(_0xe4fd('0x15'))(_0xe4fd('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a2666,_0x338b5f){_0x338b5f=_0x338b5f||0xcc;return function(_0x49e705){if(_0x49e705){return _0x4a2666['sendStatus'](_0x338b5f);}return _0x4a2666[_0xe4fd('0x17')](_0x338b5f)[_0xe4fd('0x18')]();};}function respondWithResult(_0x57f8c2,_0x1edb2e){_0x1edb2e=_0x1edb2e||0xc8;return function(_0x3e0a69){if(_0x3e0a69){return _0x57f8c2['status'](_0x1edb2e)[_0xe4fd('0x19')](_0x3e0a69);}};}function respondWithFilteredResult(_0x1faaa2,_0x30c1ff){return function(_0x1b40ef){if(_0x1b40ef){var _0x40beb6=_0x1b40ef[_0xe4fd('0x1a')],_0x135c4e=_0x30c1ff['offset'],_0x1bcf2f=_0x30c1ff[_0xe4fd('0x1b')]+_0x30c1ff[_0xe4fd('0x1c')],_0x5b99b7;if(_0x1bcf2f>=_0x40beb6){_0x1bcf2f=_0x40beb6;_0x5b99b7=0xc8;}else{_0x5b99b7=0xce;}_0x1faaa2[_0xe4fd('0x17')](_0x5b99b7);return _0x1faaa2[_0xe4fd('0x1d')](_0xe4fd('0x1e'),_0x135c4e+'-'+_0x1bcf2f+'/'+_0x40beb6)['json'](_0x1b40ef);}return null;};}function patchUpdates(_0x44e2f4){return function(_0x505b5e){try{jsonpatch[_0xe4fd('0x1f')](_0x505b5e,_0x44e2f4,!![]);}catch(_0x4348af){return BPromise[_0xe4fd('0x20')](_0x4348af);}return _0x505b5e['save']();};}function saveUpdates(_0x1561eb,_0x315c5c){return function(_0x4928ef){if(_0x4928ef){return _0x4928ef[_0xe4fd('0x21')](_0x1561eb)['then'](function(_0x4bd7a1){return _0x4bd7a1;});}return null;};}function removeEntity(_0x5ebcd0,_0x3c3005){return function(_0x1e80b7){if(_0x1e80b7){return _0x1e80b7[_0xe4fd('0x22')]()[_0xe4fd('0x23')](function(){_0x5ebcd0[_0xe4fd('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fa518,_0xcb401){return function(_0x247603){if(!_0x247603){_0x2fa518[_0xe4fd('0x24')](0x194);}return _0x247603;};}function handleError(_0x4f0626,_0x11e997){_0x11e997=_0x11e997||0x1f4;return function(_0xc88d28){logger[_0xe4fd('0x25')](_0xc88d28[_0xe4fd('0x26')]);if(_0xc88d28['name']){delete _0xc88d28[_0xe4fd('0x27')];}_0x4f0626[_0xe4fd('0x17')](_0x11e997)[_0xe4fd('0x28')](_0xc88d28);};}exports[_0xe4fd('0x29')]=function(_0x277da3,_0x1971d9){var _0x41558a={},_0x454791={},_0x4f23cb={'count':0x0,'rows':[]};var _0x42ddc1=db['SugarcrmField'][_0xe4fd('0x2a')];_0x454791[_0xe4fd('0x2b')]=_[_0xe4fd('0x2c')](_0x42ddc1);_0x454791[_0xe4fd('0x2d')]=_[_0xe4fd('0x2c')](_0x277da3[_0xe4fd('0x2d')]);_0x454791[_0xe4fd('0x2e')]=_[_0xe4fd('0x2f')](_0x454791['model'],_0x454791[_0xe4fd('0x2d')]);_0x41558a[_0xe4fd('0x30')]=_[_0xe4fd('0x2f')](_0x454791['model'],qs['fields'](_0x277da3[_0xe4fd('0x2d')][_0xe4fd('0x31')]));_0x41558a[_0xe4fd('0x30')]=_0x41558a['attributes']['length']?_0x41558a[_0xe4fd('0x30')]:_0x454791['model'];if(!_0x277da3[_0xe4fd('0x2d')]['hasOwnProperty'](_0xe4fd('0x32'))){_0x41558a[_0xe4fd('0x1c')]=qs[_0xe4fd('0x1c')](_0x277da3[_0xe4fd('0x2d')]['limit']);_0x41558a['offset']=qs[_0xe4fd('0x1b')](_0x277da3['query'][_0xe4fd('0x1b')]);}_0x41558a[_0xe4fd('0x33')]=qs[_0xe4fd('0x34')](_0x277da3[_0xe4fd('0x2d')][_0xe4fd('0x34')]);_0x41558a[_0xe4fd('0x35')]=qs['filters'](_['pick'](_0x277da3[_0xe4fd('0x2d')],_0x454791[_0xe4fd('0x2e')]));if(_0x277da3[_0xe4fd('0x2d')][_0xe4fd('0x36')]){_0x41558a[_0xe4fd('0x35')]=_[_0xe4fd('0x37')](_0x41558a['where'],{'$or':_[_0xe4fd('0x38')](_0x42ddc1,function(_0x70e91d){if(_0x70e91d[_0xe4fd('0x39')]['key']!==_0xe4fd('0x3a')){var _0x555eac={};_0x555eac[_0x70e91d[_0xe4fd('0x3b')]]={'$like':'%'+_0x277da3['query'][_0xe4fd('0x36')]+'%'};return _0x555eac;}})});}_0x41558a=_['merge']({},_0x41558a,_0x277da3[_0xe4fd('0x3c')]);var _0x557518={'where':_0x41558a[_0xe4fd('0x35')]};return db[_0xe4fd('0x3d')][_0xe4fd('0x1a')](_0x557518)[_0xe4fd('0x23')](function(_0xc49854){_0x4f23cb[_0xe4fd('0x1a')]=_0xc49854;if(_0x277da3[_0xe4fd('0x2d')][_0xe4fd('0x3e')]){_0x41558a['include']=[{'all':!![]}];}return db[_0xe4fd('0x3d')][_0xe4fd('0x3f')](_0x41558a);})[_0xe4fd('0x23')](function(_0x3ddfa2){_0x4f23cb[_0xe4fd('0x40')]=_0x3ddfa2;return _0x4f23cb;})[_0xe4fd('0x23')](respondWithFilteredResult(_0x1971d9,_0x41558a))[_0xe4fd('0x41')](handleError(_0x1971d9,null));};exports[_0xe4fd('0x42')]=function(_0x4921c9,_0xb26e61){var _0x2a3db1={'raw':!![],'where':{'id':_0x4921c9[_0xe4fd('0x43')]['id']}},_0x157135={};_0x157135[_0xe4fd('0x2b')]=_[_0xe4fd('0x2c')](db['SugarcrmField'][_0xe4fd('0x2a')]);_0x157135[_0xe4fd('0x2d')]=_[_0xe4fd('0x2c')](_0x4921c9[_0xe4fd('0x2d')]);_0x157135[_0xe4fd('0x2e')]=_[_0xe4fd('0x2f')](_0x157135[_0xe4fd('0x2b')],_0x157135[_0xe4fd('0x2d')]);_0x2a3db1[_0xe4fd('0x30')]=_['intersection'](_0x157135[_0xe4fd('0x2b')],qs[_0xe4fd('0x31')](_0x4921c9[_0xe4fd('0x2d')][_0xe4fd('0x31')]));_0x2a3db1[_0xe4fd('0x30')]=_0x2a3db1['attributes'][_0xe4fd('0x44')]?_0x2a3db1[_0xe4fd('0x30')]:_0x157135['model'];if(_0x4921c9[_0xe4fd('0x2d')][_0xe4fd('0x3e')]){_0x2a3db1[_0xe4fd('0x45')]=[{'all':!![]}];}_0x2a3db1=_['merge']({},_0x2a3db1,_0x4921c9[_0xe4fd('0x3c')]);return db[_0xe4fd('0x3d')][_0xe4fd('0x46')](_0x2a3db1)[_0xe4fd('0x23')](handleEntityNotFound(_0xb26e61,null))[_0xe4fd('0x23')](respondWithResult(_0xb26e61,null))[_0xe4fd('0x41')](handleError(_0xb26e61,null));};exports[_0xe4fd('0x47')]=function(_0x321423,_0x562007){return db[_0xe4fd('0x3d')][_0xe4fd('0x47')](_0x321423[_0xe4fd('0x48')],{})[_0xe4fd('0x23')](respondWithResult(_0x562007,0xc9))[_0xe4fd('0x41')](handleError(_0x562007,null));};exports['update']=function(_0x34b53a,_0x58cb33){if(_0x34b53a[_0xe4fd('0x48')]['id']){delete _0x34b53a[_0xe4fd('0x48')]['id'];}return db[_0xe4fd('0x3d')][_0xe4fd('0x46')]({'where':{'id':_0x34b53a[_0xe4fd('0x43')]['id']}})[_0xe4fd('0x23')](handleEntityNotFound(_0x58cb33,null))['then'](saveUpdates(_0x34b53a[_0xe4fd('0x48')],null))[_0xe4fd('0x23')](respondWithResult(_0x58cb33,null))[_0xe4fd('0x41')](handleError(_0x58cb33,null));};exports['destroy']=function(_0x1f72d4,_0x700274){return db[_0xe4fd('0x3d')][_0xe4fd('0x46')]({'where':{'id':_0x1f72d4[_0xe4fd('0x43')]['id']}})['then'](handleEntityNotFound(_0x700274,null))[_0xe4fd('0x23')](removeEntity(_0x700274,null))[_0xe4fd('0x41')](handleError(_0x700274,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index c752d6c..4e637d6 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 _0xd5d4=['lodash','util','../../config/logger','api','moment','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd5d4,0x134));var _0x4d5d=function(_0x1977f1,_0x19ef5c){_0x1977f1=_0x1977f1-0x0;var _0x5185ce=_0xd5d4[_0x1977f1];return _0x5185ce;};'use strict';var _=require(_0x4d5d('0x0'));var util=require(_0x4d5d('0x1'));var logger=require(_0x4d5d('0x2'))(_0x4d5d('0x3'));var moment=require(_0x4d5d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x17266a,_0x7c7200){return _0x17266a[_0x4d5d('0x5')](_0x4d5d('0x6'),attributes,{'tableName':_0x4d5d('0x7'),'paranoid':![],'indexes':[{'name':_0x4d5d('0x8'),'fields':[_0x4d5d('0x9'),_0x4d5d('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1755=['define','SugarcrmField','int_sugarcrm_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./intSugarcrmField.attributes','exports'];(function(_0x4dd2ec,_0x584121){var _0x52a357=function(_0x2d8737){while(--_0x2d8737){_0x4dd2ec['push'](_0x4dd2ec['shift']());}};_0x52a357(++_0x584121);}(_0x1755,0x11d));var _0x5175=function(_0x515027,_0x356304){_0x515027=_0x515027-0x0;var _0x2b639c=_0x1755[_0x515027];return _0x2b639c;};'use strict';var _=require(_0x5175('0x0'));var util=require(_0x5175('0x1'));var logger=require(_0x5175('0x2'))(_0x5175('0x3'));var moment=require(_0x5175('0x4'));var BPromise=require(_0x5175('0x5'));var rp=require(_0x5175('0x6'));var attributes=require(_0x5175('0x7'));module[_0x5175('0x8')]=function(_0x8559f2,_0x1c8630){return _0x8559f2[_0x5175('0x9')](_0x5175('0xa'),attributes,{'tableName':_0x5175('0xb'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x5175('0xc'),_0x5175('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 885f1f6..1f23b0e 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 _0xef1a=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x57bdac,_0x163f67){var _0x19bedb=function(_0x4ff52c){while(--_0x4ff52c){_0x57bdac['push'](_0x57bdac['shift']());}};_0x19bedb(++_0x163f67);}(_0xef1a,0x1c1));var _0xaef1=function(_0x4fe8a5,_0x413a72){_0x4fe8a5=_0x4fe8a5-0x0;var _0x2428a8=_0xef1a[_0x4fe8a5];return _0x2428a8;};'use strict';var _=require(_0xaef1('0x0'));var util=require(_0xaef1('0x1'));var moment=require(_0xaef1('0x2'));var BPromise=require(_0xaef1('0x3'));var rs=require(_0xaef1('0x4'));var fs=require('fs');var Redis=require(_0xaef1('0x5'));var db=require(_0xaef1('0x6'))['db'];var utils=require(_0xaef1('0x7'));var logger=require(_0xaef1('0x8'))(_0xaef1('0x9'));var config=require(_0xaef1('0xa'));var jayson=require(_0xaef1('0xb'));var client=jayson[_0xaef1('0xc')][_0xaef1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4142d0,_0x38093d,_0x3c4cee){return new BPromise(function(_0x1e1583,_0x5b5ecf){return client[_0xaef1('0xe')](_0x4142d0,_0x3c4cee)[_0xaef1('0xf')](function(_0x374c96){logger['info'](_0xaef1('0x10'),_0x38093d,_0xaef1('0x11'));logger[_0xaef1('0x12')](_0xaef1('0x13'),_0x38093d,_0xaef1('0x11'),JSON['stringify'](_0x374c96));if(_0x374c96[_0xaef1('0x14')]){if(_0x374c96['error'][_0xaef1('0x15')]===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x38093d,_0x374c96[_0xaef1('0x14')][_0xaef1('0x16')]);return _0x5b5ecf(_0x374c96[_0xaef1('0x14')][_0xaef1('0x16')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x38093d,_0x374c96[_0xaef1('0x14')]['message']);return _0x1e1583(_0x374c96[_0xaef1('0x14')][_0xaef1('0x16')]);}else{logger['info'](_0xaef1('0x10'),_0x38093d,_0xaef1('0x11'));_0x1e1583(_0x374c96[_0xaef1('0x17')][_0xaef1('0x16')]);}})[_0xaef1('0x18')](function(_0x41028e){logger[_0xaef1('0x14')](_0xaef1('0x10'),_0x38093d,_0x41028e);_0x5b5ecf(_0x41028e);});});} \ No newline at end of file +var _0x0143=['jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x21e849,_0x1c6e03){var _0x28585d=function(_0x303eaf){while(--_0x303eaf){_0x21e849['push'](_0x21e849['shift']());}};_0x28585d(++_0x1c6e03);}(_0x0143,0x1dd));var _0x3014=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x0143[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x3014('0x0'));var util=require(_0x3014('0x1'));var moment=require('moment');var BPromise=require(_0x3014('0x2'));var rs=require(_0x3014('0x3'));var fs=require('fs');var Redis=require(_0x3014('0x4'));var db=require(_0x3014('0x5'))['db'];var utils=require(_0x3014('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3014('0x7'));var client=jayson[_0x3014('0x8')][_0x3014('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x372d81,_0x358a8d,_0x1bf89c){return new BPromise(function(_0x545448,_0x13fd50){return client[_0x3014('0xa')](_0x372d81,_0x1bf89c)[_0x3014('0xb')](function(_0x1198af){logger[_0x3014('0xc')](_0x3014('0xd'),_0x358a8d,_0x3014('0xe'));logger[_0x3014('0xf')](_0x3014('0x10'),_0x358a8d,_0x3014('0xe'),JSON[_0x3014('0x11')](_0x1198af));if(_0x1198af['error']){if(_0x1198af[_0x3014('0x12')][_0x3014('0x13')]===0x1f4){logger[_0x3014('0x12')](_0x3014('0xd'),_0x358a8d,_0x1198af[_0x3014('0x12')][_0x3014('0x14')]);return _0x13fd50(_0x1198af['error'][_0x3014('0x14')]);}logger[_0x3014('0x12')](_0x3014('0xd'),_0x358a8d,_0x1198af['error'][_0x3014('0x14')]);return _0x545448(_0x1198af[_0x3014('0x12')]['message']);}else{logger[_0x3014('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x358a8d,_0x3014('0xe'));_0x545448(_0x1198af['result']['message']);}})[_0x3014('0x15')](function(_0x3b76ce){logger[_0x3014('0x12')](_0x3014('0xd'),_0x358a8d,_0x3b76ce);_0x13fd50(_0x3b76ce);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 492c8f9..d318f28 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 _0xcc53=['destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','delete'];(function(_0x84dd1c,_0x194c1b){var _0x3e3d3a=function(_0x29095e){while(--_0x29095e){_0x84dd1c['push'](_0x84dd1c['shift']());}};_0x3e3d3a(++_0x194c1b);}(_0xcc53,0x192));var _0x3cc5=function(_0x2c9bf6,_0x341ace){_0x2c9bf6=_0x2c9bf6-0x0;var _0x45a754=_0xcc53[_0x2c9bf6];return _0x45a754;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3cc5('0x0'));var timeout=require(_0x3cc5('0x1'));var express=require(_0x3cc5('0x2'));var router=express[_0x3cc5('0x3')]();var auth=require(_0x3cc5('0x4'));var interaction=require(_0x3cc5('0x5'));var config=require('../../config/environment');var controller=require('./intVtigerAccount.controller');router[_0x3cc5('0x6')]('/',auth[_0x3cc5('0x7')](),controller[_0x3cc5('0x8')]);router[_0x3cc5('0x6')](_0x3cc5('0x9'),auth[_0x3cc5('0x7')](),controller[_0x3cc5('0xa')]);router[_0x3cc5('0x6')](_0x3cc5('0xb'),auth[_0x3cc5('0x7')](),controller[_0x3cc5('0xc')]);router[_0x3cc5('0x6')](_0x3cc5('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x3cc5('0xe')]('/',auth[_0x3cc5('0x7')](),controller['create']);router['post'](_0x3cc5('0xb'),auth['isAuthenticated'](),controller[_0x3cc5('0xf')]);router[_0x3cc5('0x10')](_0x3cc5('0x9'),auth[_0x3cc5('0x7')](),controller['update']);router[_0x3cc5('0x11')]('/:id',auth[_0x3cc5('0x7')](),controller[_0x3cc5('0x12')]);module[_0x3cc5('0x13')]=router; \ No newline at end of file +var _0x4722=['./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put','update','destroy','exports','multer','util','path','express','../../components/interaction/service','../../config/environment'];(function(_0x2988a4,_0xf7e052){var _0x3d2d4b=function(_0x2498e8){while(--_0x2498e8){_0x2988a4['push'](_0x2988a4['shift']());}};_0x3d2d4b(++_0xf7e052);}(_0x4722,0x15a));var _0x2472=function(_0x3feaf4,_0x10470e){_0x3feaf4=_0x3feaf4-0x0;var _0x4e5961=_0x4722[_0x3feaf4];return _0x4e5961;};'use strict';var multer=require(_0x2472('0x0'));var util=require(_0x2472('0x1'));var path=require(_0x2472('0x2'));var timeout=require('connect-timeout');var express=require(_0x2472('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2472('0x4'));var config=require(_0x2472('0x5'));var controller=require(_0x2472('0x6'));router[_0x2472('0x7')]('/',auth[_0x2472('0x8')](),controller[_0x2472('0x9')]);router[_0x2472('0x7')](_0x2472('0xa'),auth['isAuthenticated'](),controller[_0x2472('0xb')]);router[_0x2472('0x7')](_0x2472('0xc'),auth[_0x2472('0x8')](),controller['getConfigurations']);router[_0x2472('0x7')](_0x2472('0xd'),auth[_0x2472('0x8')](),controller[_0x2472('0xe')]);router['post']('/',auth[_0x2472('0x8')](),controller[_0x2472('0xf')]);router[_0x2472('0x10')](_0x2472('0xc'),auth['isAuthenticated'](),controller[_0x2472('0x11')]);router[_0x2472('0x12')](_0x2472('0xa'),auth[_0x2472('0x8')](),controller[_0x2472('0x13')]);router['delete'](_0x2472('0xa'),auth['isAuthenticated'](),controller[_0x2472('0x14')]);module[_0x2472('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 13e51a5..71a6cf8 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 _0xb17c=['HelpDesk','sequelize','exports','STRING'];(function(_0x4fbff3,_0x484761){var _0x68b35a=function(_0x58c052){while(--_0x58c052){_0x4fbff3['push'](_0x4fbff3['shift']());}};_0x68b35a(++_0x484761);}(_0xb17c,0xe5));var _0xcb17=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xb17c[_0xac151d];return _0x111dba;};'use strict';var Sequelize=require(_0xcb17('0x0'));module[_0xcb17('0x1')]={'name':{'type':Sequelize[_0xcb17('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xcb17('0x2')]},'username':{'type':Sequelize[_0xcb17('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xcb17('0x2')],'allowNull':![],'defaultValue':_0xcb17('0x3')},'remoteUri':{'type':Sequelize[_0xcb17('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xcb17('0x2')]},'accessKey':{'type':Sequelize[_0xcb17('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6863=['HelpDesk','sequelize','exports','STRING'];(function(_0x5c30e6,_0x3718f4){var _0x419298=function(_0x159eee){while(--_0x159eee){_0x5c30e6['push'](_0x5c30e6['shift']());}};_0x419298(++_0x3718f4);}(_0x6863,0x7d));var _0x3686=function(_0x58b850,_0x3d194e){_0x58b850=_0x58b850-0x0;var _0x5b4773=_0x6863[_0x58b850];return _0x5b4773;};'use strict';var Sequelize=require(_0x3686('0x0'));module[_0x3686('0x1')]={'name':{'type':Sequelize[_0x3686('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3686('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3686('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x3686('0x2')]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 61f6dc4..6a762b0 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 _0x0427=['apply','save','update','destroy','sendStatus','name','send','index','VtigerAccount','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','type','key','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','VtigerField','getFields','username','description','moduleName','remoteUri','accessKey','substring','lastIndexOf','format','%s/webservice.php','success','POST','login','describe','sessionName','autogenerated','reference','owner','remove','false','label','startsWith','cf_','picklistValues','value','log','vTiger\x20error:\x20','statusCode','stringify','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','request','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','status','end','json','count','offset','limit','set','Content-Range'];(function(_0xbfe53a,_0xb0bf59){var _0x52a601=function(_0x12d426){while(--_0x12d426){_0xbfe53a['push'](_0xbfe53a['shift']());}};_0x52a601(++_0xb0bf59);}(_0x0427,0x137));var _0x7042=function(_0x4ef0ea,_0x1a4f2d){_0x4ef0ea=_0x4ef0ea-0x0;var _0x1c999d=_0x0427[_0x4ef0ea];return _0x1c999d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7042('0x0'));var zipdir=require(_0x7042('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7042('0x2'));var moment=require(_0x7042('0x3'));var BPromise=require(_0x7042('0x4'));var Mustache=require(_0x7042('0x5'));var util=require(_0x7042('0x6'));var path=require(_0x7042('0x7'));var sox=require(_0x7042('0x8'));var csv=require('to-csv');var ejs=require(_0x7042('0x9'));var fs=require('fs');var _=require(_0x7042('0xa'));var squel=require(_0x7042('0xb'));var crypto=require(_0x7042('0xc'));var jsforce=require(_0x7042('0xd'));var deskjs=require(_0x7042('0xe'));var toCsv=require(_0x7042('0xf'));var querystring=require(_0x7042('0x10'));var Papa=require(_0x7042('0x11'));var authService=require('../../components/auth/service');var hardwareService=require(_0x7042('0x12'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0x7042('0x13'));var config=require('../../config/environment');var db=require(_0x7042('0x14'))['db'];var integrations=require(_0x7042('0x15'));var jayson=require(_0x7042('0x16'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x292c4a,_0x3f92eb,_0x20af30,_0x275b32){return new BPromise(function(_0x25dfe5,_0xee4c2){var _0x5def25=_0x275b32||client;return _0x5def25[_0x7042('0x17')](_0x292c4a,_0x20af30)[_0x7042('0x18')](function(_0x6ed505){logger['info'](_0x7042('0x19'),_0x3f92eb,_0x7042('0x1a'));logger['debug'](_0x7042('0x1b'),_0x3f92eb,'request\x20sent',JSON['stringify'](_0x6ed505));if(_0x6ed505[_0x7042('0x1c')]){if(_0x6ed505[_0x7042('0x1c')][_0x7042('0x1d')]===0x1f4){logger[_0x7042('0x1c')](_0x7042('0x19'),_0x3f92eb,_0x6ed505['error'][_0x7042('0x1e')]);return _0xee4c2(_0x6ed505[_0x7042('0x1c')][_0x7042('0x1e')]);}logger[_0x7042('0x1c')](_0x7042('0x19'),_0x3f92eb,_0x6ed505['error'][_0x7042('0x1e')]);return _0x25dfe5(_0x6ed505['error'][_0x7042('0x1e')]);}else{logger['info'](_0x7042('0x19'),_0x3f92eb,_0x7042('0x1a'));_0x25dfe5(_0x6ed505[_0x7042('0x1f')][_0x7042('0x1e')]);}})['catch'](function(_0x5a224b){logger['error'](_0x7042('0x19'),_0x3f92eb,_0x5a224b);_0xee4c2(_0x5a224b);});});}function respondWithStatusCode(_0x30a722,_0x3af8bc){_0x3af8bc=_0x3af8bc||0xcc;return function(_0x1949fe){if(_0x1949fe){return _0x30a722['sendStatus'](_0x3af8bc);}return _0x30a722[_0x7042('0x20')](_0x3af8bc)[_0x7042('0x21')]();};}function respondWithResult(_0x4611f9,_0x20671b){_0x20671b=_0x20671b||0xc8;return function(_0x459ff6){if(_0x459ff6){return _0x4611f9['status'](_0x20671b)[_0x7042('0x22')](_0x459ff6);}};}function respondWithFilteredResult(_0x41dc11,_0xf3c3f9){return function(_0x1a05d1){if(_0x1a05d1){var _0x2e4dbe=_0x1a05d1[_0x7042('0x23')],_0x1cb194=_0xf3c3f9[_0x7042('0x24')],_0x162ac7=_0xf3c3f9[_0x7042('0x24')]+_0xf3c3f9[_0x7042('0x25')],_0x26543a;if(_0x162ac7>=_0x2e4dbe){_0x162ac7=_0x2e4dbe;_0x26543a=0xc8;}else{_0x26543a=0xce;}_0x41dc11[_0x7042('0x20')](_0x26543a);return _0x41dc11[_0x7042('0x26')](_0x7042('0x27'),_0x1cb194+'-'+_0x162ac7+'/'+_0x2e4dbe)[_0x7042('0x22')](_0x1a05d1);}return null;};}function patchUpdates(_0x477972){return function(_0xa7461d){try{jsonpatch[_0x7042('0x28')](_0xa7461d,_0x477972,!![]);}catch(_0x4cad2d){return BPromise['reject'](_0x4cad2d);}return _0xa7461d[_0x7042('0x29')]();};}function saveUpdates(_0x160af6,_0x300be2){return function(_0x253a8b){if(_0x253a8b){return _0x253a8b[_0x7042('0x2a')](_0x160af6)[_0x7042('0x18')](function(_0x46dcb3){return _0x46dcb3;});}return null;};}function removeEntity(_0x52362b,_0x4823c3){return function(_0x272579){if(_0x272579){return _0x272579[_0x7042('0x2b')]()['then'](function(){_0x52362b[_0x7042('0x20')](0xcc)[_0x7042('0x21')]();});}};}function handleEntityNotFound(_0x53f223,_0x10df2e){return function(_0x2d66e7){if(!_0x2d66e7){_0x53f223[_0x7042('0x2c')](0x194);}return _0x2d66e7;};}function handleError(_0x18f669,_0x1512d6){_0x1512d6=_0x1512d6||0x1f4;return function(_0x511a04){logger[_0x7042('0x1c')](_0x511a04['stack']);if(_0x511a04['name']){delete _0x511a04[_0x7042('0x2d')];}_0x18f669['status'](_0x1512d6)[_0x7042('0x2e')](_0x511a04);};}exports[_0x7042('0x2f')]=function(_0x5f1605,_0x220288){var _0x52c0ab={},_0x232c48={},_0x1ae147={'count':0x0,'rows':[]};var _0x93708e=db[_0x7042('0x30')][_0x7042('0x31')];_0x232c48[_0x7042('0x32')]=_[_0x7042('0x33')](_0x93708e);_0x232c48[_0x7042('0x34')]=_[_0x7042('0x33')](_0x5f1605['query']);_0x232c48[_0x7042('0x35')]=_[_0x7042('0x36')](_0x232c48[_0x7042('0x32')],_0x232c48['query']);_0x52c0ab['attributes']=_[_0x7042('0x36')](_0x232c48[_0x7042('0x32')],qs['fields'](_0x5f1605[_0x7042('0x34')][_0x7042('0x37')]));_0x52c0ab[_0x7042('0x38')]=_0x52c0ab[_0x7042('0x38')][_0x7042('0x39')]?_0x52c0ab[_0x7042('0x38')]:_0x232c48[_0x7042('0x32')];if(!_0x5f1605[_0x7042('0x34')][_0x7042('0x3a')](_0x7042('0x3b'))){_0x52c0ab[_0x7042('0x25')]=qs[_0x7042('0x25')](_0x5f1605[_0x7042('0x34')]['limit']);_0x52c0ab['offset']=qs[_0x7042('0x24')](_0x5f1605[_0x7042('0x34')][_0x7042('0x24')]);}_0x52c0ab[_0x7042('0x3c')]=qs['sort'](_0x5f1605[_0x7042('0x34')][_0x7042('0x3d')]);_0x52c0ab['where']=qs['filters'](_[_0x7042('0x3e')](_0x5f1605[_0x7042('0x34')],_0x232c48[_0x7042('0x35')]));if(_0x5f1605[_0x7042('0x34')][_0x7042('0x3f')]){_0x52c0ab['where']=_['merge'](_0x52c0ab[_0x7042('0x40')],{'$or':_[_0x7042('0x41')](_0x93708e,function(_0x4e92d5){if(_0x4e92d5[_0x7042('0x42')][_0x7042('0x43')]!==_0x7042('0x44')){var _0x59568d={};_0x59568d[_0x4e92d5['field']]={'$like':'%'+_0x5f1605[_0x7042('0x34')][_0x7042('0x3f')]+'%'};return _0x59568d;}})});}_0x52c0ab=_[_0x7042('0x45')]({},_0x52c0ab,_0x5f1605['options']);var _0x27b9db={'where':_0x52c0ab[_0x7042('0x40')]};return db['VtigerAccount'][_0x7042('0x23')](_0x27b9db)[_0x7042('0x18')](function(_0x15f086){_0x1ae147[_0x7042('0x23')]=_0x15f086;if(_0x5f1605[_0x7042('0x34')][_0x7042('0x46')]){_0x52c0ab[_0x7042('0x47')]=[{'all':!![]}];}return db['VtigerAccount'][_0x7042('0x48')](_0x52c0ab);})[_0x7042('0x18')](function(_0x4cd0a0){_0x1ae147[_0x7042('0x49')]=_0x4cd0a0;return _0x1ae147;})[_0x7042('0x18')](respondWithFilteredResult(_0x220288,_0x52c0ab))[_0x7042('0x4a')](handleError(_0x220288,null));};exports[_0x7042('0x4b')]=function(_0x9009e9,_0x3bd2cd){var _0x5f0150={'raw':![],'where':{'id':_0x9009e9['params']['id']}},_0x49060b={};_0x49060b[_0x7042('0x32')]=_['keys'](db['VtigerAccount'][_0x7042('0x31')]);_0x49060b['query']=_[_0x7042('0x33')](_0x9009e9[_0x7042('0x34')]);_0x49060b[_0x7042('0x35')]=_[_0x7042('0x36')](_0x49060b[_0x7042('0x32')],_0x49060b[_0x7042('0x34')]);_0x5f0150[_0x7042('0x38')]=_[_0x7042('0x36')](_0x49060b[_0x7042('0x32')],qs[_0x7042('0x37')](_0x9009e9[_0x7042('0x34')][_0x7042('0x37')]));_0x5f0150[_0x7042('0x38')]=_0x5f0150['attributes'][_0x7042('0x39')]?_0x5f0150[_0x7042('0x38')]:_0x49060b[_0x7042('0x32')];if(_0x9009e9[_0x7042('0x34')][_0x7042('0x46')]){_0x5f0150[_0x7042('0x47')]=[{'all':!![]}];}_0x5f0150=_[_0x7042('0x45')]({},_0x5f0150,_0x9009e9[_0x7042('0x4c')]);return db[_0x7042('0x30')][_0x7042('0x4d')](_0x5f0150)[_0x7042('0x18')](handleEntityNotFound(_0x3bd2cd,null))[_0x7042('0x18')](respondWithResult(_0x3bd2cd,null))[_0x7042('0x4a')](handleError(_0x3bd2cd,null));};exports['create']=function(_0x388c5d,_0x4b1bba){return db[_0x7042('0x30')][_0x7042('0x4e')](_0x388c5d[_0x7042('0x4f')],{})['then'](respondWithResult(_0x4b1bba,0xc9))['catch'](handleError(_0x4b1bba,null));};exports[_0x7042('0x2a')]=function(_0x435a92,_0x29fce4){if(_0x435a92[_0x7042('0x4f')]['id']){delete _0x435a92['body']['id'];}return db['VtigerAccount'][_0x7042('0x4d')]({'where':{'id':_0x435a92[_0x7042('0x50')]['id']}})['then'](handleEntityNotFound(_0x29fce4,null))[_0x7042('0x18')](saveUpdates(_0x435a92[_0x7042('0x4f')],null))['then'](respondWithResult(_0x29fce4,null))[_0x7042('0x4a')](handleError(_0x29fce4,null));};exports[_0x7042('0x2b')]=function(_0x578e90,_0x449de2){return db[_0x7042('0x30')][_0x7042('0x4d')]({'where':{'id':_0x578e90['params']['id']}})[_0x7042('0x18')](handleEntityNotFound(_0x449de2,null))[_0x7042('0x18')](removeEntity(_0x449de2,null))[_0x7042('0x4a')](handleError(_0x449de2,null));};exports[_0x7042('0x51')]=function(_0x31fb4f,_0x35af12,_0x3a2431){var _0x34995b={};var _0x1c6f25={};var _0x3a1e37;var _0x11f0a;return db[_0x7042('0x30')]['findOne']({'where':{'id':_0x31fb4f[_0x7042('0x50')]['id']}})[_0x7042('0x18')](handleEntityNotFound(_0x35af12,null))[_0x7042('0x18')](function(_0x355edf){if(_0x355edf){_0x3a1e37=_0x355edf;_0x1c6f25[_0x7042('0x32')]=_[_0x7042('0x33')](db['VtigerConfiguration'][_0x7042('0x31')]);_0x1c6f25[_0x7042('0x34')]=_[_0x7042('0x33')](_0x31fb4f['query']);_0x1c6f25[_0x7042('0x35')]=_[_0x7042('0x36')](_0x1c6f25[_0x7042('0x32')],_0x1c6f25[_0x7042('0x34')]);_0x34995b[_0x7042('0x38')]=_[_0x7042('0x36')](_0x1c6f25[_0x7042('0x32')],qs[_0x7042('0x37')](_0x31fb4f['query'][_0x7042('0x37')]));_0x34995b[_0x7042('0x38')]=_0x34995b[_0x7042('0x38')][_0x7042('0x39')]?_0x34995b[_0x7042('0x38')]:_0x1c6f25[_0x7042('0x32')];_0x34995b[_0x7042('0x3c')]=qs['sort'](_0x31fb4f[_0x7042('0x34')]['sort']);_0x34995b[_0x7042('0x40')]=qs[_0x7042('0x35')](_[_0x7042('0x3e')](_0x31fb4f[_0x7042('0x34')],_0x1c6f25['filters']));if(_0x31fb4f['query'][_0x7042('0x3f')]){_0x34995b[_0x7042('0x40')]=_['merge'](_0x34995b[_0x7042('0x40')],{'$or':_[_0x7042('0x41')](_0x34995b[_0x7042('0x38')],function(_0x195f08){var _0x336777={};_0x336777[_0x195f08]={'$like':'%'+_0x31fb4f[_0x7042('0x34')][_0x7042('0x3f')]+'%'};return _0x336777;})});}_0x34995b=_[_0x7042('0x45')]({},_0x34995b,_0x31fb4f[_0x7042('0x4c')]);return _0x3a1e37['getConfigurations'](_0x34995b);}})[_0x7042('0x18')](function(_0x34820d){if(_0x34820d){_0x11f0a=_0x34820d[_0x7042('0x39')];if(!_0x31fb4f[_0x7042('0x34')]['hasOwnProperty'](_0x7042('0x3b'))){_0x34995b['limit']=qs[_0x7042('0x25')](_0x31fb4f[_0x7042('0x34')]['limit']);_0x34995b['offset']=qs[_0x7042('0x24')](_0x31fb4f['query'][_0x7042('0x24')]);}return _0x3a1e37[_0x7042('0x51')](_0x34995b);}})[_0x7042('0x18')](function(_0x483c91){if(_0x483c91){return _0x483c91?{'count':_0x11f0a,'rows':_0x483c91}:null;}})['then'](respondWithResult(_0x35af12,null))['catch'](handleError(_0x35af12,null));};exports[_0x7042('0x52')]=function(_0x3ff03e,_0x5158b6,_0x2256d3){if(_0x3ff03e[_0x7042('0x4f')]['id']){delete _0x3ff03e[_0x7042('0x4f')]['id'];}return db['VtigerAccount'][_0x7042('0x53')]({'where':{'id':_0x3ff03e[_0x7042('0x50')]['id']}})['then'](handleEntityNotFound(_0x5158b6,null))['then'](function(_0x190ce7){if(_0x190ce7){_0x3ff03e['body']['AccountId']=_0x190ce7['id'];_0x3ff03e[_0x7042('0x4f')][_0x7042('0x54')]=integrations[_0x7042('0x55')](_0x3ff03e[_0x7042('0x4f')][_0x7042('0x56')],_0x3ff03e[_0x7042('0x4f')][_0x7042('0x42')]);_0x3ff03e[_0x7042('0x4f')]['Descriptions']=integrations['getDescriptions'](_0x3ff03e[_0x7042('0x4f')][_0x7042('0x56')],_0x3ff03e[_0x7042('0x4f')]['type']);return db['VtigerConfiguration'][_0x7042('0x4e')](_0x3ff03e['body'],{'include':[{'model':db[_0x7042('0x57')],'as':_0x7042('0x54')},{'model':db[_0x7042('0x57')],'as':'Descriptions'}]});}return null;})[_0x7042('0x18')](respondWithResult(_0x5158b6,null))[_0x7042('0x4a')](handleError(_0x5158b6,null));};var md5=require('md5');exports[_0x7042('0x58')]=function(_0x24c95b,_0x48dd58,_0x5d00f9){var _0x383379=null;var _0x33f827=null;var _0x4e1909=null;var _0x18e0e7=null;var _0x1baa3c='';return db[_0x7042('0x30')][_0x7042('0x53')]({'where':{'id':_0x24c95b[_0x7042('0x50')]['id']},'attributes':['id',_0x7042('0x2d'),_0x7042('0x59'),_0x7042('0x5a'),_0x7042('0x5b'),_0x7042('0x5c'),'serverUrl',_0x7042('0x5d')]})[_0x7042('0x18')](handleEntityNotFound(_0x48dd58,null))[_0x7042('0x18')](function(_0x26707e){if(_0x26707e){_0x383379=_0x26707e['username'];_0x33f827=_0x26707e[_0x7042('0x5d')];_0x4e1909=_0x26707e[_0x7042('0x5b')];_0x1baa3c=_0x26707e[_0x7042('0x5c')];var _0x1749fe=_0x1baa3c['slice'](-0x1);if(_0x1749fe==='/'){_0x1baa3c=_0x1baa3c[_0x7042('0x5e')](0x0,_0x1baa3c[_0x7042('0x5f')](_0x1749fe));}_0x18e0e7=util[_0x7042('0x60')](_0x7042('0x61'),_0x1baa3c);var _0x42312b={'method':'GET','uri':_0x18e0e7,'qs':{'operation':'getchallenge','username':_0x26707e[_0x7042('0x59')]},'json':!![]};return rp(_0x42312b);}})['then'](function(_0x29fa20){if(_0x29fa20[_0x7042('0x62')]){var _0x22a888={'method':_0x7042('0x63'),'uri':_0x18e0e7,'form':{'operation':_0x7042('0x64'),'username':_0x383379,'accessKey':md5(_0x29fa20[_0x7042('0x1f')]['token']+_0x33f827)},'json':!![]};return rp(_0x22a888);}})[_0x7042('0x18')](function(_0x5317c0){if(_0x5317c0[_0x7042('0x62')]){var _0x377f0a={'method':'GET','uri':_0x18e0e7,'qs':{'operation':_0x7042('0x65'),'username':_0x383379,'sessionName':_0x5317c0[_0x7042('0x1f')][_0x7042('0x66')],'elementType':_0x4e1909},'json':!![]};return rp(_0x377f0a);}})[_0x7042('0x18')](function(_0x54a65a){if(_0x54a65a[_0x7042('0x62')]){var _0x462bb5=[_0x7042('0x67'),_0x7042('0x68'),_0x7042('0x69')];_[_0x7042('0x6a')](_0x54a65a[_0x7042('0x1f')][_0x7042('0x37')],function(_0x1d7b93){return _0x462bb5['includes'](_0x1d7b93[_0x7042('0x42')][_0x7042('0x2d')]);});_[_0x7042('0x6a')](_0x54a65a['result'][_0x7042('0x37')],function(_0x4a86de){return _0x4a86de['editable']===_0x7042('0x6b');});return{'count':_0x54a65a[_0x7042('0x1f')][_0x7042('0x37')]['length'],'rows':_[_0x7042('0x41')](_0x54a65a[_0x7042('0x1f')][_0x7042('0x37')],function(_0x567967){return{'id':_0x567967[_0x7042('0x2d')],'name':_0x567967[_0x7042('0x6c')],'custom':_[_0x7042('0x6d')](_0x567967[_0x7042('0x2d')],_0x7042('0x6e'))?!![]:![],'options':_0x567967[_0x7042('0x42')][_0x7042('0x2d')]==='picklist'&&_0x567967['type'][_0x7042('0x6f')]['length']>0x0?_[_0x7042('0x41')](_0x567967[_0x7042('0x42')]['picklistValues'],function(_0x5827fa){return{'name':_0x5827fa[_0x7042('0x6c')],'value':_0x5827fa[_0x7042('0x70')]};}):[]};})};}})['then'](respondWithResult(_0x48dd58,null))[_0x7042('0x4a')](function(_0x236ba7){console[_0x7042('0x71')](_0x7042('0x72')+_0x236ba7);var _0x25bf7f=_0x24c95b[_0x7042('0x34')]['test']?0x1f4:_0x236ba7[_0x7042('0x73')]||0x1f4;logger[_0x7042('0x1c')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x25bf7f,JSON[_0x7042('0x74')](_0x236ba7));delete _0x236ba7['name'];if(_0x25bf7f===0x191){_0x25bf7f=0x190;}_0x48dd58[_0x7042('0x20')](_0x25bf7f)[_0x7042('0x2e')](_0x24c95b[_0x7042('0x34')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x236ba7['statusCode']}:_0x236ba7);});}; \ No newline at end of file +var _0xab40=['result','catch','sendStatus','end','json','count','offset','set','Content-Range','save','update','status','stack','name','index','VtigerAccount','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','map','type','key','VIRTUAL','includeAll','include','findAll','rows','params','find','create','body','destroy','getConfigurations','VtigerConfiguration','order','addConfiguration','findOne','getSubjects','channel','Descriptions','getDescriptions','VtigerField','username','description','moduleName','remoteUri','serverUrl','slice','substring','%s/webservice.php','success','POST','token','GET','describe','sessionName','autogenerated','owner','remove','editable','false','label','startsWith','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../components/integrations/configuration','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','code','error','message'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xab40,0xcd));var _0x0ab4=function(_0x137363,_0x4bc4c2){_0x137363=_0x137363-0x0;var _0x89f37a=_0xab40[_0x137363];return _0x89f37a;};'use strict';var pdf=require(_0x0ab4('0x0'));var emlformat=require(_0x0ab4('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0ab4('0x2'));var moment=require(_0x0ab4('0x3'));var BPromise=require(_0x0ab4('0x4'));var Mustache=require(_0x0ab4('0x5'));var util=require(_0x0ab4('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0ab4('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0ab4('0x8'));var squel=require(_0x0ab4('0x9'));var crypto=require(_0x0ab4('0xa'));var jsforce=require(_0x0ab4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0ab4('0xc'));var authService=require(_0x0ab4('0xd'));var hardwareService=require(_0x0ab4('0xe'));var Redis=require(_0x0ab4('0xf'));var qs=require(_0x0ab4('0x10'));var logger=require(_0x0ab4('0x11'))(_0x0ab4('0x12'));var utils=require(_0x0ab4('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x0ab4('0x14'));var jayson=require('jayson/promise');var client=jayson[_0x0ab4('0x15')][_0x0ab4('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x1e7555,_0x1e2b56,_0x26ce0d,_0x329104){return new BPromise(function(_0x112162,_0x2cc644){var _0x3cb1df=_0x329104||client;return _0x3cb1df[_0x0ab4('0x17')](_0x1e7555,_0x26ce0d)[_0x0ab4('0x18')](function(_0x36d246){logger[_0x0ab4('0x19')](_0x0ab4('0x1a'),_0x1e2b56,_0x0ab4('0x1b'));logger[_0x0ab4('0x1c')](_0x0ab4('0x1d'),_0x1e2b56,_0x0ab4('0x1b'),JSON['stringify'](_0x36d246));if(_0x36d246['error']){if(_0x36d246['error'][_0x0ab4('0x1e')]===0x1f4){logger[_0x0ab4('0x1f')](_0x0ab4('0x1a'),_0x1e2b56,_0x36d246['error'][_0x0ab4('0x20')]);return _0x2cc644(_0x36d246[_0x0ab4('0x1f')][_0x0ab4('0x20')]);}logger[_0x0ab4('0x1f')]('VtigerAccount,\x20%s,\x20%s',_0x1e2b56,_0x36d246['error'][_0x0ab4('0x20')]);return _0x112162(_0x36d246['error'][_0x0ab4('0x20')]);}else{logger[_0x0ab4('0x19')]('VtigerAccount,\x20%s,\x20%s',_0x1e2b56,_0x0ab4('0x1b'));_0x112162(_0x36d246[_0x0ab4('0x21')][_0x0ab4('0x20')]);}})[_0x0ab4('0x22')](function(_0x12d06d){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x1e2b56,_0x12d06d);_0x2cc644(_0x12d06d);});});}function respondWithStatusCode(_0x24b929,_0x14087f){_0x14087f=_0x14087f||0xcc;return function(_0x392afe){if(_0x392afe){return _0x24b929[_0x0ab4('0x23')](_0x14087f);}return _0x24b929['status'](_0x14087f)[_0x0ab4('0x24')]();};}function respondWithResult(_0x3caa9d,_0x32b14a){_0x32b14a=_0x32b14a||0xc8;return function(_0x4ea9aa){if(_0x4ea9aa){return _0x3caa9d['status'](_0x32b14a)[_0x0ab4('0x25')](_0x4ea9aa);}};}function respondWithFilteredResult(_0x1c132c,_0x1a17ce){return function(_0x4ae515){if(_0x4ae515){var _0x519b23=_0x4ae515[_0x0ab4('0x26')],_0x49c72d=_0x1a17ce[_0x0ab4('0x27')],_0x19ecc6=_0x1a17ce['offset']+_0x1a17ce['limit'],_0x5ba3a2;if(_0x19ecc6>=_0x519b23){_0x19ecc6=_0x519b23;_0x5ba3a2=0xc8;}else{_0x5ba3a2=0xce;}_0x1c132c['status'](_0x5ba3a2);return _0x1c132c[_0x0ab4('0x28')](_0x0ab4('0x29'),_0x49c72d+'-'+_0x19ecc6+'/'+_0x519b23)[_0x0ab4('0x25')](_0x4ae515);}return null;};}function patchUpdates(_0x3f61cb){return function(_0x25385e){try{jsonpatch['apply'](_0x25385e,_0x3f61cb,!![]);}catch(_0x5b55c1){return BPromise['reject'](_0x5b55c1);}return _0x25385e[_0x0ab4('0x2a')]();};}function saveUpdates(_0x2b66d5,_0x155d96){return function(_0x182bbe){if(_0x182bbe){return _0x182bbe[_0x0ab4('0x2b')](_0x2b66d5)['then'](function(_0x4b201c){return _0x4b201c;});}return null;};}function removeEntity(_0x285a29,_0xe6682){return function(_0x361f7c){if(_0x361f7c){return _0x361f7c['destroy']()['then'](function(){_0x285a29[_0x0ab4('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dec2a,_0x5b338a){return function(_0x263e5a){if(!_0x263e5a){_0x3dec2a[_0x0ab4('0x23')](0x194);}return _0x263e5a;};}function handleError(_0x36841e,_0x39225f){_0x39225f=_0x39225f||0x1f4;return function(_0x5bcf75){logger[_0x0ab4('0x1f')](_0x5bcf75[_0x0ab4('0x2d')]);if(_0x5bcf75[_0x0ab4('0x2e')]){delete _0x5bcf75[_0x0ab4('0x2e')];}_0x36841e['status'](_0x39225f)['send'](_0x5bcf75);};}exports[_0x0ab4('0x2f')]=function(_0x3e65a1,_0x30c490){var _0x4fca1b={},_0x507d77={},_0x4cd319={'count':0x0,'rows':[]};var _0x1c234e=db[_0x0ab4('0x30')][_0x0ab4('0x31')];_0x507d77['model']=_['keys'](_0x1c234e);_0x507d77['query']=_[_0x0ab4('0x32')](_0x3e65a1[_0x0ab4('0x33')]);_0x507d77[_0x0ab4('0x34')]=_[_0x0ab4('0x35')](_0x507d77[_0x0ab4('0x36')],_0x507d77[_0x0ab4('0x33')]);_0x4fca1b[_0x0ab4('0x37')]=_[_0x0ab4('0x35')](_0x507d77[_0x0ab4('0x36')],qs[_0x0ab4('0x38')](_0x3e65a1['query'][_0x0ab4('0x38')]));_0x4fca1b[_0x0ab4('0x37')]=_0x4fca1b[_0x0ab4('0x37')][_0x0ab4('0x39')]?_0x4fca1b[_0x0ab4('0x37')]:_0x507d77[_0x0ab4('0x36')];if(!_0x3e65a1[_0x0ab4('0x33')][_0x0ab4('0x3a')](_0x0ab4('0x3b'))){_0x4fca1b[_0x0ab4('0x3c')]=qs[_0x0ab4('0x3c')](_0x3e65a1[_0x0ab4('0x33')]['limit']);_0x4fca1b[_0x0ab4('0x27')]=qs[_0x0ab4('0x27')](_0x3e65a1[_0x0ab4('0x33')][_0x0ab4('0x27')]);}_0x4fca1b['order']=qs[_0x0ab4('0x3d')](_0x3e65a1['query'][_0x0ab4('0x3d')]);_0x4fca1b[_0x0ab4('0x3e')]=qs[_0x0ab4('0x34')](_[_0x0ab4('0x3f')](_0x3e65a1[_0x0ab4('0x33')],_0x507d77[_0x0ab4('0x34')]));if(_0x3e65a1['query'][_0x0ab4('0x40')]){_0x4fca1b[_0x0ab4('0x3e')]=_[_0x0ab4('0x41')](_0x4fca1b['where'],{'$or':_[_0x0ab4('0x42')](_0x1c234e,function(_0xeac8ad){if(_0xeac8ad[_0x0ab4('0x43')][_0x0ab4('0x44')]!==_0x0ab4('0x45')){var _0x5aa047={};_0x5aa047[_0xeac8ad['field']]={'$like':'%'+_0x3e65a1['query'][_0x0ab4('0x40')]+'%'};return _0x5aa047;}})});}_0x4fca1b=_[_0x0ab4('0x41')]({},_0x4fca1b,_0x3e65a1['options']);var _0xff1874={'where':_0x4fca1b['where']};return db[_0x0ab4('0x30')]['count'](_0xff1874)[_0x0ab4('0x18')](function(_0x300fd8){_0x4cd319[_0x0ab4('0x26')]=_0x300fd8;if(_0x3e65a1[_0x0ab4('0x33')][_0x0ab4('0x46')]){_0x4fca1b[_0x0ab4('0x47')]=[{'all':!![]}];}return db['VtigerAccount'][_0x0ab4('0x48')](_0x4fca1b);})[_0x0ab4('0x18')](function(_0x44fd3e){_0x4cd319[_0x0ab4('0x49')]=_0x44fd3e;return _0x4cd319;})[_0x0ab4('0x18')](respondWithFilteredResult(_0x30c490,_0x4fca1b))[_0x0ab4('0x22')](handleError(_0x30c490,null));};exports['show']=function(_0x9b2c74,_0x4f07d1){var _0x2103d7={'raw':![],'where':{'id':_0x9b2c74[_0x0ab4('0x4a')]['id']}},_0x1849f1={};_0x1849f1['model']=_[_0x0ab4('0x32')](db[_0x0ab4('0x30')][_0x0ab4('0x31')]);_0x1849f1[_0x0ab4('0x33')]=_[_0x0ab4('0x32')](_0x9b2c74[_0x0ab4('0x33')]);_0x1849f1['filters']=_[_0x0ab4('0x35')](_0x1849f1[_0x0ab4('0x36')],_0x1849f1[_0x0ab4('0x33')]);_0x2103d7[_0x0ab4('0x37')]=_[_0x0ab4('0x35')](_0x1849f1[_0x0ab4('0x36')],qs[_0x0ab4('0x38')](_0x9b2c74[_0x0ab4('0x33')][_0x0ab4('0x38')]));_0x2103d7[_0x0ab4('0x37')]=_0x2103d7[_0x0ab4('0x37')][_0x0ab4('0x39')]?_0x2103d7[_0x0ab4('0x37')]:_0x1849f1['model'];if(_0x9b2c74[_0x0ab4('0x33')][_0x0ab4('0x46')]){_0x2103d7['include']=[{'all':!![]}];}_0x2103d7=_[_0x0ab4('0x41')]({},_0x2103d7,_0x9b2c74['options']);return db['VtigerAccount'][_0x0ab4('0x4b')](_0x2103d7)[_0x0ab4('0x18')](handleEntityNotFound(_0x4f07d1,null))[_0x0ab4('0x18')](respondWithResult(_0x4f07d1,null))['catch'](handleError(_0x4f07d1,null));};exports[_0x0ab4('0x4c')]=function(_0xb3bd1e,_0xeddaa1){return db[_0x0ab4('0x30')][_0x0ab4('0x4c')](_0xb3bd1e[_0x0ab4('0x4d')],{})[_0x0ab4('0x18')](respondWithResult(_0xeddaa1,0xc9))['catch'](handleError(_0xeddaa1,null));};exports[_0x0ab4('0x2b')]=function(_0x59d3f1,_0x31bc52){if(_0x59d3f1['body']['id']){delete _0x59d3f1[_0x0ab4('0x4d')]['id'];}return db['VtigerAccount']['find']({'where':{'id':_0x59d3f1[_0x0ab4('0x4a')]['id']}})[_0x0ab4('0x18')](handleEntityNotFound(_0x31bc52,null))[_0x0ab4('0x18')](saveUpdates(_0x59d3f1[_0x0ab4('0x4d')],null))['then'](respondWithResult(_0x31bc52,null))[_0x0ab4('0x22')](handleError(_0x31bc52,null));};exports[_0x0ab4('0x4e')]=function(_0x40403d,_0x2a639c){return db[_0x0ab4('0x30')][_0x0ab4('0x4b')]({'where':{'id':_0x40403d[_0x0ab4('0x4a')]['id']}})[_0x0ab4('0x18')](handleEntityNotFound(_0x2a639c,null))[_0x0ab4('0x18')](removeEntity(_0x2a639c,null))[_0x0ab4('0x22')](handleError(_0x2a639c,null));};exports[_0x0ab4('0x4f')]=function(_0x355ba8,_0x370183,_0x1dc227){var _0x438f38={};var _0x1e5635={};var _0x340558;var _0xd55047;return db[_0x0ab4('0x30')]['findOne']({'where':{'id':_0x355ba8[_0x0ab4('0x4a')]['id']}})[_0x0ab4('0x18')](handleEntityNotFound(_0x370183,null))[_0x0ab4('0x18')](function(_0x308f7a){if(_0x308f7a){_0x340558=_0x308f7a;_0x1e5635[_0x0ab4('0x36')]=_[_0x0ab4('0x32')](db[_0x0ab4('0x50')][_0x0ab4('0x31')]);_0x1e5635['query']=_[_0x0ab4('0x32')](_0x355ba8[_0x0ab4('0x33')]);_0x1e5635['filters']=_['intersection'](_0x1e5635[_0x0ab4('0x36')],_0x1e5635[_0x0ab4('0x33')]);_0x438f38['attributes']=_['intersection'](_0x1e5635[_0x0ab4('0x36')],qs['fields'](_0x355ba8['query'][_0x0ab4('0x38')]));_0x438f38[_0x0ab4('0x37')]=_0x438f38[_0x0ab4('0x37')][_0x0ab4('0x39')]?_0x438f38[_0x0ab4('0x37')]:_0x1e5635[_0x0ab4('0x36')];_0x438f38[_0x0ab4('0x51')]=qs['sort'](_0x355ba8[_0x0ab4('0x33')][_0x0ab4('0x3d')]);_0x438f38[_0x0ab4('0x3e')]=qs[_0x0ab4('0x34')](_[_0x0ab4('0x3f')](_0x355ba8[_0x0ab4('0x33')],_0x1e5635['filters']));if(_0x355ba8[_0x0ab4('0x33')][_0x0ab4('0x40')]){_0x438f38['where']=_[_0x0ab4('0x41')](_0x438f38['where'],{'$or':_[_0x0ab4('0x42')](_0x438f38['attributes'],function(_0x268b23){var _0x4edebd={};_0x4edebd[_0x268b23]={'$like':'%'+_0x355ba8[_0x0ab4('0x33')][_0x0ab4('0x40')]+'%'};return _0x4edebd;})});}_0x438f38=_['merge']({},_0x438f38,_0x355ba8['options']);return _0x340558[_0x0ab4('0x4f')](_0x438f38);}})[_0x0ab4('0x18')](function(_0x559b1f){if(_0x559b1f){_0xd55047=_0x559b1f[_0x0ab4('0x39')];if(!_0x355ba8[_0x0ab4('0x33')][_0x0ab4('0x3a')]('nolimit')){_0x438f38[_0x0ab4('0x3c')]=qs[_0x0ab4('0x3c')](_0x355ba8[_0x0ab4('0x33')][_0x0ab4('0x3c')]);_0x438f38[_0x0ab4('0x27')]=qs[_0x0ab4('0x27')](_0x355ba8[_0x0ab4('0x33')][_0x0ab4('0x27')]);}return _0x340558['getConfigurations'](_0x438f38);}})['then'](function(_0x3fa81d){if(_0x3fa81d){return _0x3fa81d?{'count':_0xd55047,'rows':_0x3fa81d}:null;}})[_0x0ab4('0x18')](respondWithResult(_0x370183,null))[_0x0ab4('0x22')](handleError(_0x370183,null));};exports[_0x0ab4('0x52')]=function(_0x58c611,_0x417926,_0x5256d4){if(_0x58c611[_0x0ab4('0x4d')]['id']){delete _0x58c611[_0x0ab4('0x4d')]['id'];}return db[_0x0ab4('0x30')][_0x0ab4('0x53')]({'where':{'id':_0x58c611[_0x0ab4('0x4a')]['id']}})[_0x0ab4('0x18')](handleEntityNotFound(_0x417926,null))[_0x0ab4('0x18')](function(_0xf42b98){if(_0xf42b98){_0x58c611[_0x0ab4('0x4d')]['AccountId']=_0xf42b98['id'];_0x58c611[_0x0ab4('0x4d')]['Subjects']=integrations[_0x0ab4('0x54')](_0x58c611[_0x0ab4('0x4d')][_0x0ab4('0x55')],_0x58c611[_0x0ab4('0x4d')][_0x0ab4('0x43')]);_0x58c611[_0x0ab4('0x4d')][_0x0ab4('0x56')]=integrations[_0x0ab4('0x57')](_0x58c611[_0x0ab4('0x4d')]['channel'],_0x58c611[_0x0ab4('0x4d')][_0x0ab4('0x43')]);return db['VtigerConfiguration'][_0x0ab4('0x4c')](_0x58c611[_0x0ab4('0x4d')],{'include':[{'model':db[_0x0ab4('0x58')],'as':'Subjects'},{'model':db[_0x0ab4('0x58')],'as':_0x0ab4('0x56')}]});}return null;})[_0x0ab4('0x18')](respondWithResult(_0x417926,null))[_0x0ab4('0x22')](handleError(_0x417926,null));};var md5=require('md5');exports['getFields']=function(_0x398b3e,_0x17d76b,_0x1e5840){var _0x2ef3e0=null;var _0x4ef894=null;var _0xa55ec6=null;var _0xa0f095=null;var _0x5281da='';return db['VtigerAccount']['findOne']({'where':{'id':_0x398b3e[_0x0ab4('0x4a')]['id']},'attributes':['id',_0x0ab4('0x2e'),_0x0ab4('0x59'),_0x0ab4('0x5a'),_0x0ab4('0x5b'),_0x0ab4('0x5c'),_0x0ab4('0x5d'),'accessKey']})[_0x0ab4('0x18')](handleEntityNotFound(_0x17d76b,null))['then'](function(_0x50818f){if(_0x50818f){_0x2ef3e0=_0x50818f[_0x0ab4('0x59')];_0x4ef894=_0x50818f['accessKey'];_0xa55ec6=_0x50818f[_0x0ab4('0x5b')];_0x5281da=_0x50818f[_0x0ab4('0x5c')];var _0x2ba45b=_0x5281da[_0x0ab4('0x5e')](-0x1);if(_0x2ba45b==='/'){_0x5281da=_0x5281da[_0x0ab4('0x5f')](0x0,_0x5281da['lastIndexOf'](_0x2ba45b));}_0xa0f095=util['format'](_0x0ab4('0x60'),_0x5281da);var _0x412261={'method':'GET','uri':_0xa0f095,'qs':{'operation':'getchallenge','username':_0x50818f[_0x0ab4('0x59')]},'json':!![]};return rp(_0x412261);}})[_0x0ab4('0x18')](function(_0x51a3ea){if(_0x51a3ea[_0x0ab4('0x61')]){var _0x142fd9={'method':_0x0ab4('0x62'),'uri':_0xa0f095,'form':{'operation':'login','username':_0x2ef3e0,'accessKey':md5(_0x51a3ea[_0x0ab4('0x21')][_0x0ab4('0x63')]+_0x4ef894)},'json':!![]};return rp(_0x142fd9);}})[_0x0ab4('0x18')](function(_0x1be1b9){if(_0x1be1b9['success']){var _0x2936d0={'method':_0x0ab4('0x64'),'uri':_0xa0f095,'qs':{'operation':_0x0ab4('0x65'),'username':_0x2ef3e0,'sessionName':_0x1be1b9[_0x0ab4('0x21')][_0x0ab4('0x66')],'elementType':_0xa55ec6},'json':!![]};return rp(_0x2936d0);}})[_0x0ab4('0x18')](function(_0x1fac21){if(_0x1fac21[_0x0ab4('0x61')]){var _0x886cb0=[_0x0ab4('0x67'),'reference',_0x0ab4('0x68')];_[_0x0ab4('0x69')](_0x1fac21[_0x0ab4('0x21')][_0x0ab4('0x38')],function(_0xb803f2){return _0x886cb0['includes'](_0xb803f2[_0x0ab4('0x43')][_0x0ab4('0x2e')]);});_[_0x0ab4('0x69')](_0x1fac21[_0x0ab4('0x21')][_0x0ab4('0x38')],function(_0x7af9c6){return _0x7af9c6[_0x0ab4('0x6a')]===_0x0ab4('0x6b');});return{'count':_0x1fac21[_0x0ab4('0x21')][_0x0ab4('0x38')][_0x0ab4('0x39')],'rows':_[_0x0ab4('0x42')](_0x1fac21[_0x0ab4('0x21')][_0x0ab4('0x38')],function(_0x57bf78){return{'id':_0x57bf78[_0x0ab4('0x2e')],'name':_0x57bf78[_0x0ab4('0x6c')],'custom':_[_0x0ab4('0x6d')](_0x57bf78[_0x0ab4('0x2e')],'cf_')?!![]:![],'options':_0x57bf78['type'][_0x0ab4('0x2e')]===_0x0ab4('0x6e')&&_0x57bf78['type'][_0x0ab4('0x6f')][_0x0ab4('0x39')]>0x0?_[_0x0ab4('0x42')](_0x57bf78[_0x0ab4('0x43')][_0x0ab4('0x6f')],function(_0xc022dd){return{'name':_0xc022dd[_0x0ab4('0x6c')],'value':_0xc022dd['value']};}):[]};})};}})[_0x0ab4('0x18')](respondWithResult(_0x17d76b,null))[_0x0ab4('0x22')](function(_0x3ff850){console[_0x0ab4('0x70')](_0x0ab4('0x71')+_0x3ff850);var _0x351eea=_0x398b3e[_0x0ab4('0x33')][_0x0ab4('0x72')]?0x1f4:_0x3ff850[_0x0ab4('0x73')]||0x1f4;logger['error'](_0x0ab4('0x74'),'getFields',_0x351eea,JSON[_0x0ab4('0x75')](_0x3ff850));delete _0x3ff850[_0x0ab4('0x2e')];if(_0x351eea===0x191){_0x351eea=0x190;}_0x17d76b[_0x0ab4('0x2c')](_0x351eea)[_0x0ab4('0x76')](_0x398b3e[_0x0ab4('0x33')][_0x0ab4('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x3ff850['statusCode']}:_0x3ff850);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 8e87260..3016a37 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 _0x56c5=['../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','util','../../config/logger','api','bluebird','request-promise','./intVtigerAccount.attributes'];(function(_0x5c02fd,_0x410aa2){var _0x422c83=function(_0x1cf0cc){while(--_0x1cf0cc){_0x5c02fd['push'](_0x5c02fd['shift']());}};_0x422c83(++_0x410aa2);}(_0x56c5,0xf7));var _0x556c=function(_0x2c1069,_0x468158){_0x2c1069=_0x2c1069-0x0;var _0x105b41=_0x56c5[_0x2c1069];return _0x105b41;};'use strict';var _=require('lodash');var util=require(_0x556c('0x0'));var logger=require(_0x556c('0x1'))(_0x556c('0x2'));var moment=require('moment');var BPromise=require(_0x556c('0x3'));var rp=require(_0x556c('0x4'));var attributes=require(_0x556c('0x5'));var integrations=require(_0x556c('0x6'));module[_0x556c('0x7')]=function(_0x16b38c,_0x534da0){return _0x16b38c[_0x556c('0x8')](_0x556c('0x9'),attributes,{'tableName':_0x556c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5cc9=['VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','bluebird','./intVtigerAccount.attributes'];(function(_0x3fcb63,_0x3c7f03){var _0x4b7763=function(_0x2d5dfc){while(--_0x2d5dfc){_0x3fcb63['push'](_0x3fcb63['shift']());}};_0x4b7763(++_0x3c7f03);}(_0x5cc9,0x102));var _0x95cc=function(_0x368ffa,_0x255c1b){_0x368ffa=_0x368ffa-0x0;var _0x420e7c=_0x5cc9[_0x368ffa];return _0x420e7c;};'use strict';var _=require(_0x95cc('0x0'));var util=require(_0x95cc('0x1'));var logger=require(_0x95cc('0x2'))(_0x95cc('0x3'));var moment=require('moment');var BPromise=require(_0x95cc('0x4'));var rp=require('request-promise');var attributes=require(_0x95cc('0x5'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5d4a70,_0x194f84){return _0x5d4a70['define'](_0x95cc('0x6'),attributes,{'tableName':_0x95cc('0x7'),'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 abad2df..8c22b61 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 _0xc38f=['VtigerAccount','findAll','options','raw','attributes','limit','map','include','model','debug','ShowVtigerAccount','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVtigerAccount'];(function(_0x102526,_0x4cdaf9){var _0x1e1478=function(_0x1fe1b2){while(--_0x1fe1b2){_0x102526['push'](_0x102526['shift']());}};_0x1e1478(++_0x4cdaf9);}(_0xc38f,0xdf));var _0xfc38=function(_0x7eb5b5,_0x71af05){_0x7eb5b5=_0x7eb5b5-0x0;var _0x25bf47=_0xc38f[_0x7eb5b5];return _0x25bf47;};'use strict';var _=require(_0xfc38('0x0'));var util=require(_0xfc38('0x1'));var moment=require(_0xfc38('0x2'));var BPromise=require(_0xfc38('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc38('0x4'));var db=require(_0xfc38('0x5'))['db'];var utils=require(_0xfc38('0x6'));var logger=require('../../config/logger')(_0xfc38('0x7'));var config=require('../../config/environment');var jayson=require(_0xfc38('0x8'));var client=jayson[_0xfc38('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d1d43,_0x5f1dfe,_0x378540){return new BPromise(function(_0x41fb58,_0x4f108f){return client[_0xfc38('0xa')](_0x5d1d43,_0x378540)[_0xfc38('0xb')](function(_0x5e2aa7){logger[_0xfc38('0xc')](_0xfc38('0xd'),_0x5f1dfe,_0xfc38('0xe'));logger['debug'](_0xfc38('0xf'),_0x5f1dfe,_0xfc38('0xe'),JSON[_0xfc38('0x10')](_0x5e2aa7));if(_0x5e2aa7[_0xfc38('0x11')]){if(_0x5e2aa7['error']['code']===0x1f4){logger[_0xfc38('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x5f1dfe,_0x5e2aa7['error'][_0xfc38('0x12')]);return _0x4f108f(_0x5e2aa7['error'][_0xfc38('0x12')]);}logger['error'](_0xfc38('0xd'),_0x5f1dfe,_0x5e2aa7[_0xfc38('0x11')][_0xfc38('0x12')]);return _0x41fb58(_0x5e2aa7[_0xfc38('0x11')]['message']);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x5f1dfe,_0xfc38('0xe'));_0x41fb58(_0x5e2aa7[_0xfc38('0x13')]['message']);}})[_0xfc38('0x14')](function(_0x2b4562){logger[_0xfc38('0x11')](_0xfc38('0xd'),_0x5f1dfe,_0x2b4562);_0x4f108f(_0x2b4562);});});}exports[_0xfc38('0x15')]=function(_0x4152c4){var _0xaa3ef2=this;return new Promise(function(_0x3feaf2,_0x58f215){return db[_0xfc38('0x16')][_0xfc38('0x17')]({'raw':_0x4152c4[_0xfc38('0x18')]?_0x4152c4[_0xfc38('0x18')][_0xfc38('0x19')]===undefined?!![]:![]:!![],'where':_0x4152c4[_0xfc38('0x18')]?_0x4152c4['options']['where']||null:null,'attributes':_0x4152c4[_0xfc38('0x18')]?_0x4152c4['options'][_0xfc38('0x1a')]||null:null,'limit':_0x4152c4[_0xfc38('0x18')]?_0x4152c4[_0xfc38('0x18')][_0xfc38('0x1b')]||null:null,'include':_0x4152c4[_0xfc38('0x18')]?_0x4152c4[_0xfc38('0x18')]['include']?_[_0xfc38('0x1c')](_0x4152c4[_0xfc38('0x18')][_0xfc38('0x1d')],function(_0x10ab1b){return{'model':db[_0x10ab1b[_0xfc38('0x1e')]],'as':_0x10ab1b['as'],'attributes':_0x10ab1b['attributes'],'include':_0x10ab1b[_0xfc38('0x1d')]?_['map'](_0x10ab1b['include'],function(_0x3a393e){return{'model':db[_0x3a393e[_0xfc38('0x1e')]],'as':_0x3a393e['as'],'attributes':_0x3a393e[_0xfc38('0x1a')],'include':_0x3a393e['include']?_[_0xfc38('0x1c')](_0x3a393e[_0xfc38('0x1d')],function(_0x42dfff){return{'model':db[_0x42dfff[_0xfc38('0x1e')]],'as':_0x42dfff['as'],'attributes':_0x42dfff[_0xfc38('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xfc38('0xb')](function(_0x59db8b){logger[_0xfc38('0xc')](_0xfc38('0x15'),_0x4152c4);logger[_0xfc38('0x1f')](_0xfc38('0x15'),_0x4152c4,JSON[_0xfc38('0x10')](_0x59db8b));_0x3feaf2(_0x59db8b);})[_0xfc38('0x14')](function(_0xb08f43){logger['error'](_0xfc38('0x15'),_0xb08f43[_0xfc38('0x12')],_0x4152c4);_0x58f215(_0xaa3ef2[_0xfc38('0x11')](0x1f4,_0xb08f43['message']));});});};exports[_0xfc38('0x20')]=function(_0x59e6cb){var _0x214c45=this;return new Promise(function(_0x48146e,_0x147f1d){return db[_0xfc38('0x16')][_0xfc38('0x21')]({'raw':_0x59e6cb[_0xfc38('0x18')]?_0x59e6cb['options'][_0xfc38('0x19')]===undefined?!![]:![]:!![],'where':_0x59e6cb[_0xfc38('0x18')]?_0x59e6cb[_0xfc38('0x18')][_0xfc38('0x22')]||null:null,'attributes':_0x59e6cb[_0xfc38('0x18')]?_0x59e6cb['options'][_0xfc38('0x1a')]||null:null,'include':_0x59e6cb[_0xfc38('0x18')]?_0x59e6cb[_0xfc38('0x18')][_0xfc38('0x1d')]?_[_0xfc38('0x1c')](_0x59e6cb[_0xfc38('0x18')][_0xfc38('0x1d')],function(_0x5a140c){return{'model':db[_0x5a140c[_0xfc38('0x1e')]],'as':_0x5a140c['as'],'attributes':_0x5a140c['attributes'],'include':_0x5a140c[_0xfc38('0x1d')]?_[_0xfc38('0x1c')](_0x5a140c[_0xfc38('0x1d')],function(_0x3d8af4){return{'model':db[_0x3d8af4[_0xfc38('0x1e')]],'as':_0x3d8af4['as'],'attributes':_0x3d8af4[_0xfc38('0x1a')],'include':_0x3d8af4['include']?_['map'](_0x3d8af4['include'],function(_0x3b875e){return{'model':db[_0x3b875e['model']],'as':_0x3b875e['as'],'attributes':_0x3b875e[_0xfc38('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18e11b){logger[_0xfc38('0xc')](_0xfc38('0x20'),_0x59e6cb);logger[_0xfc38('0x1f')]('ShowVtigerAccount',_0x59e6cb,JSON['stringify'](_0x18e11b));_0x48146e(_0x18e11b);})[_0xfc38('0x14')](function(_0xf56de6){logger[_0xfc38('0x11')](_0xfc38('0x20'),_0xf56de6[_0xfc38('0x12')],_0x59e6cb);_0x147f1d(_0x214c45[_0xfc38('0x11')](0x1f4,_0xf56de6[_0xfc38('0x12')]));});});}; \ No newline at end of file +var _0xcfbf=['stringify','error','message','catch','VtigerAccount','findAll','options','raw','attributes','include','map','model','GetVtigerAccount','find','where','ShowVtigerAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s'];(function(_0x572bf1,_0x333c36){var _0x441ef9=function(_0x3f9910){while(--_0x3f9910){_0x572bf1['push'](_0x572bf1['shift']());}};_0x441ef9(++_0x333c36);}(_0xcfbf,0x73));var _0xfcfb=function(_0xd75bd7,_0x406473){_0xd75bd7=_0xd75bd7-0x0;var _0xa99c9a=_0xcfbf[_0xd75bd7];return _0xa99c9a;};'use strict';var _=require(_0xfcfb('0x0'));var util=require(_0xfcfb('0x1'));var moment=require(_0xfcfb('0x2'));var BPromise=require(_0xfcfb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcfb('0x4'));var db=require(_0xfcfb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfcfb('0x6'))(_0xfcfb('0x7'));var config=require('../../config/environment');var jayson=require(_0xfcfb('0x8'));var client=jayson[_0xfcfb('0x9')][_0xfcfb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f3852,_0x3699c7,_0x5e6247){return new BPromise(function(_0xdd0dd3,_0x2ecadd){return client[_0xfcfb('0xb')](_0x2f3852,_0x5e6247)[_0xfcfb('0xc')](function(_0x1cfe7b){logger[_0xfcfb('0xd')](_0xfcfb('0xe'),_0x3699c7,_0xfcfb('0xf'));logger['debug'](_0xfcfb('0x10'),_0x3699c7,_0xfcfb('0xf'),JSON[_0xfcfb('0x11')](_0x1cfe7b));if(_0x1cfe7b[_0xfcfb('0x12')]){if(_0x1cfe7b[_0xfcfb('0x12')]['code']===0x1f4){logger[_0xfcfb('0x12')](_0xfcfb('0xe'),_0x3699c7,_0x1cfe7b[_0xfcfb('0x12')][_0xfcfb('0x13')]);return _0x2ecadd(_0x1cfe7b[_0xfcfb('0x12')][_0xfcfb('0x13')]);}logger[_0xfcfb('0x12')](_0xfcfb('0xe'),_0x3699c7,_0x1cfe7b['error'][_0xfcfb('0x13')]);return _0xdd0dd3(_0x1cfe7b[_0xfcfb('0x12')]['message']);}else{logger[_0xfcfb('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x3699c7,'request\x20sent');_0xdd0dd3(_0x1cfe7b['result']['message']);}})[_0xfcfb('0x14')](function(_0x43b3e7){logger[_0xfcfb('0x12')](_0xfcfb('0xe'),_0x3699c7,_0x43b3e7);_0x2ecadd(_0x43b3e7);});});}exports['GetVtigerAccount']=function(_0x43f2f1){var _0x50c328=this;return new Promise(function(_0x218ade,_0x28cb24){return db[_0xfcfb('0x15')][_0xfcfb('0x16')]({'raw':_0x43f2f1['options']?_0x43f2f1[_0xfcfb('0x17')][_0xfcfb('0x18')]===undefined?!![]:![]:!![],'where':_0x43f2f1[_0xfcfb('0x17')]?_0x43f2f1[_0xfcfb('0x17')]['where']||null:null,'attributes':_0x43f2f1[_0xfcfb('0x17')]?_0x43f2f1['options'][_0xfcfb('0x19')]||null:null,'limit':_0x43f2f1[_0xfcfb('0x17')]?_0x43f2f1[_0xfcfb('0x17')]['limit']||null:null,'include':_0x43f2f1['options']?_0x43f2f1['options'][_0xfcfb('0x1a')]?_[_0xfcfb('0x1b')](_0x43f2f1['options'][_0xfcfb('0x1a')],function(_0x5de28f){return{'model':db[_0x5de28f['model']],'as':_0x5de28f['as'],'attributes':_0x5de28f[_0xfcfb('0x19')],'include':_0x5de28f[_0xfcfb('0x1a')]?_['map'](_0x5de28f[_0xfcfb('0x1a')],function(_0x1b1073){return{'model':db[_0x1b1073[_0xfcfb('0x1c')]],'as':_0x1b1073['as'],'attributes':_0x1b1073[_0xfcfb('0x19')],'include':_0x1b1073[_0xfcfb('0x1a')]?_[_0xfcfb('0x1b')](_0x1b1073[_0xfcfb('0x1a')],function(_0x56e03d){return{'model':db[_0x56e03d[_0xfcfb('0x1c')]],'as':_0x56e03d['as'],'attributes':_0x56e03d[_0xfcfb('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2275f2){logger[_0xfcfb('0xd')](_0xfcfb('0x1d'),_0x43f2f1);logger['debug'](_0xfcfb('0x1d'),_0x43f2f1,JSON['stringify'](_0x2275f2));_0x218ade(_0x2275f2);})[_0xfcfb('0x14')](function(_0x91c77b){logger['error'](_0xfcfb('0x1d'),_0x91c77b[_0xfcfb('0x13')],_0x43f2f1);_0x28cb24(_0x50c328[_0xfcfb('0x12')](0x1f4,_0x91c77b[_0xfcfb('0x13')]));});});};exports['ShowVtigerAccount']=function(_0x319601){var _0x51c92a=this;return new Promise(function(_0x30ba9f,_0x65a312){return db[_0xfcfb('0x15')][_0xfcfb('0x1e')]({'raw':_0x319601['options']?_0x319601[_0xfcfb('0x17')][_0xfcfb('0x18')]===undefined?!![]:![]:!![],'where':_0x319601['options']?_0x319601[_0xfcfb('0x17')][_0xfcfb('0x1f')]||null:null,'attributes':_0x319601[_0xfcfb('0x17')]?_0x319601[_0xfcfb('0x17')][_0xfcfb('0x19')]||null:null,'include':_0x319601['options']?_0x319601[_0xfcfb('0x17')][_0xfcfb('0x1a')]?_[_0xfcfb('0x1b')](_0x319601['options'][_0xfcfb('0x1a')],function(_0x269f6d){return{'model':db[_0x269f6d[_0xfcfb('0x1c')]],'as':_0x269f6d['as'],'attributes':_0x269f6d[_0xfcfb('0x19')],'include':_0x269f6d[_0xfcfb('0x1a')]?_[_0xfcfb('0x1b')](_0x269f6d['include'],function(_0x294066){return{'model':db[_0x294066[_0xfcfb('0x1c')]],'as':_0x294066['as'],'attributes':_0x294066[_0xfcfb('0x19')],'include':_0x294066[_0xfcfb('0x1a')]?_[_0xfcfb('0x1b')](_0x294066[_0xfcfb('0x1a')],function(_0x20e0a4){return{'model':db[_0x20e0a4[_0xfcfb('0x1c')]],'as':_0x20e0a4['as'],'attributes':_0x20e0a4[_0xfcfb('0x19')]};}):[]};}):[]};}):[]:[]})[_0xfcfb('0xc')](function(_0x4a969b){logger[_0xfcfb('0xd')]('ShowVtigerAccount',_0x319601);logger['debug'](_0xfcfb('0x20'),_0x319601,JSON[_0xfcfb('0x11')](_0x4a969b));_0x30ba9f(_0x4a969b);})[_0xfcfb('0x14')](function(_0x52cf81){logger['error'](_0xfcfb('0x20'),_0x52cf81[_0xfcfb('0x13')],_0x319601);_0x65a312(_0x51c92a[_0xfcfb('0x12')](0x1f4,_0x52cf81[_0xfcfb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 1f97eed..50ff389 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 _0xcb91=['/:id/descriptions','getDescriptions','post','create','put','delete','destroy','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/subjects','getSubjects'];(function(_0x21b95c,_0x35c39e){var _0x1ede2f=function(_0x40be0a){while(--_0x40be0a){_0x21b95c['push'](_0x21b95c['shift']());}};_0x1ede2f(++_0x35c39e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xcb91[_0x21549c];return _0x426cbd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./intVtigerConfiguration.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x6')]('/:id/fields',auth[_0x1cb9('0x7')](),controller['getFields']);router['get'](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0x6')](_0x1cb9('0xc'),auth['isAuthenticated'](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')]('/',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xf')]);router[_0x1cb9('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1cb9('0x11')](_0x1cb9('0x8'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe706=['update','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put'];(function(_0x5f002d,_0x1b9dc8){var _0x544598=function(_0x929264){while(--_0x929264){_0x5f002d['push'](_0x5f002d['shift']());}};_0x544598(++_0x1b9dc8);}(_0xe706,0xa3));var _0x6e70=function(_0x421d1f,_0x103891){_0x421d1f=_0x421d1f-0x0;var _0x4228bf=_0xe706[_0x421d1f];return _0x4228bf;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x9')](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x9')](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x9')](_0x6e70('0x12'),auth[_0x6e70('0xa')](),controller['getDescriptions']);router['post']('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);router[_0x6e70('0x14')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x15')]);router[_0x6e70('0x16')](_0x6e70('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 3f238a9..8c09df3 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 _0x0b5e=['exports','STRING','sequelize'];(function(_0x15b255,_0xa7ce4){var _0x257093=function(_0x5f20be){while(--_0x5f20be){_0x15b255['push'](_0x15b255['shift']());}};_0x257093(++_0xa7ce4);}(_0x0b5e,0x1dc));var _0xe0b5=function(_0x5c06b,_0x20564c){_0x5c06b=_0x5c06b-0x0;var _0x34c54c=_0x0b5e[_0x5c06b];return _0x34c54c;};'use strict';var Sequelize=require(_0xe0b5('0x0'));module[_0xe0b5('0x1')]={'name':{'type':Sequelize[_0xe0b5('0x2')]},'description':{'type':Sequelize[_0xe0b5('0x2')]}}; \ No newline at end of file +var _0x1e27=['exports','STRING','sequelize'];(function(_0x7dfd37,_0x6a8efc){var _0x4cf35b=function(_0x584ede){while(--_0x584ede){_0x7dfd37['push'](_0x7dfd37['shift']());}};_0x4cf35b(++_0x6a8efc);}(_0x1e27,0x18b));var _0x71e2=function(_0x55d58f,_0x2bea83){_0x55d58f=_0x55d58f-0x0;var _0x1ad6e6=_0x1e27[_0x55d58f];return _0x1ad6e6;};'use strict';var Sequelize=require(_0x71e2('0x0'));module[_0x71e2('0x1')]={'name':{'type':Sequelize[_0x71e2('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index bca3533..cdf1be1 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 _0xe2ab=['key','VIRTUAL','field','filter','options','includeAll','rows','show','params','rawAttributes','length','include','create','body','find','getFields','findOne','VtigerField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','name','index','VtigerConfiguration','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','map','type'];(function(_0x15da5b,_0x5de3d5){var _0x4676f6=function(_0x180982){while(--_0x180982){_0x15da5b['push'](_0x15da5b['shift']());}};_0x4676f6(++_0x5de3d5);}(_0xe2ab,0xc4));var _0xbe2a=function(_0x17218c,_0x3e8bf6){_0x17218c=_0x17218c-0x0;var _0x2fb49a=_0xe2ab[_0x17218c];return _0x2fb49a;};'use strict';var pdf=require(_0xbe2a('0x0'));var emlformat=require(_0xbe2a('0x1'));var rimraf=require(_0xbe2a('0x2'));var zipdir=require(_0xbe2a('0x3'));var jsonpatch=require(_0xbe2a('0x4'));var rp=require(_0xbe2a('0x5'));var moment=require('moment');var BPromise=require(_0xbe2a('0x6'));var Mustache=require(_0xbe2a('0x7'));var util=require(_0xbe2a('0x8'));var path=require(_0xbe2a('0x9'));var sox=require('sox');var csv=require(_0xbe2a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbe2a('0xb'));var squel=require('squel');var crypto=require(_0xbe2a('0xc'));var jsforce=require(_0xbe2a('0xd'));var deskjs=require(_0xbe2a('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbe2a('0xf'));var authService=require(_0xbe2a('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xbe2a('0x11'));var qs=require(_0xbe2a('0x12'));var logger=require(_0xbe2a('0x13'))(_0xbe2a('0x14'));var utils=require(_0xbe2a('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xbe2a('0x16')][_0xbe2a('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x3a1e4c,_0x34b449,_0xaef821,_0x5b1088){return new BPromise(function(_0x398cf6,_0x141803){var _0x119436=_0x5b1088||client;return _0x119436['request'](_0x3a1e4c,_0xaef821)[_0xbe2a('0x18')](function(_0x1ab20f){logger[_0xbe2a('0x19')](_0xbe2a('0x1a'),_0x34b449,_0xbe2a('0x1b'));logger[_0xbe2a('0x1c')](_0xbe2a('0x1d'),_0x34b449,_0xbe2a('0x1b'),JSON[_0xbe2a('0x1e')](_0x1ab20f));if(_0x1ab20f['error']){if(_0x1ab20f[_0xbe2a('0x1f')][_0xbe2a('0x20')]===0x1f4){logger[_0xbe2a('0x1f')](_0xbe2a('0x1a'),_0x34b449,_0x1ab20f['error'][_0xbe2a('0x21')]);return _0x141803(_0x1ab20f[_0xbe2a('0x1f')]['message']);}logger['error'](_0xbe2a('0x1a'),_0x34b449,_0x1ab20f['error'][_0xbe2a('0x21')]);return _0x398cf6(_0x1ab20f[_0xbe2a('0x1f')]['message']);}else{logger[_0xbe2a('0x19')]('VtigerConfiguration,\x20%s,\x20%s',_0x34b449,_0xbe2a('0x1b'));_0x398cf6(_0x1ab20f[_0xbe2a('0x22')][_0xbe2a('0x21')]);}})[_0xbe2a('0x23')](function(_0x5b3458){logger[_0xbe2a('0x1f')](_0xbe2a('0x1a'),_0x34b449,_0x5b3458);_0x141803(_0x5b3458);});});}function respondWithStatusCode(_0x28fdc7,_0x5e36f6){_0x5e36f6=_0x5e36f6||0xcc;return function(_0x42c358){if(_0x42c358){return _0x28fdc7[_0xbe2a('0x24')](_0x5e36f6);}return _0x28fdc7[_0xbe2a('0x25')](_0x5e36f6)[_0xbe2a('0x26')]();};}function respondWithResult(_0x1c8648,_0x570333){_0x570333=_0x570333||0xc8;return function(_0x4e61dd){if(_0x4e61dd){return _0x1c8648[_0xbe2a('0x25')](_0x570333)[_0xbe2a('0x27')](_0x4e61dd);}};}function respondWithFilteredResult(_0x353434,_0x291d3a){return function(_0x5cc045){if(_0x5cc045){var _0x396809=_0x5cc045[_0xbe2a('0x28')],_0x5a6442=_0x291d3a['offset'],_0x276849=_0x291d3a[_0xbe2a('0x29')]+_0x291d3a[_0xbe2a('0x2a')],_0x59392d;if(_0x276849>=_0x396809){_0x276849=_0x396809;_0x59392d=0xc8;}else{_0x59392d=0xce;}_0x353434[_0xbe2a('0x25')](_0x59392d);return _0x353434[_0xbe2a('0x2b')](_0xbe2a('0x2c'),_0x5a6442+'-'+_0x276849+'/'+_0x396809)[_0xbe2a('0x27')](_0x5cc045);}return null;};}function patchUpdates(_0x34b7df){return function(_0x193cfe){try{jsonpatch[_0xbe2a('0x2d')](_0x193cfe,_0x34b7df,!![]);}catch(_0x52b262){return BPromise[_0xbe2a('0x2e')](_0x52b262);}return _0x193cfe['save']();};}function saveUpdates(_0x82e8a7,_0xc15a2a){return function(_0x309bfc){if(_0x309bfc){return _0x309bfc[_0xbe2a('0x2f')](_0x82e8a7)['then'](function(_0x361a85){return _0x361a85;});}return null;};}function removeEntity(_0xcc6999,_0x1b9dc8){return function(_0x1c0c54){if(_0x1c0c54){return _0x1c0c54[_0xbe2a('0x30')]()[_0xbe2a('0x18')](function(){_0xcc6999['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d5f07,_0x533ec5){return function(_0x12c91c){if(!_0x12c91c){_0x4d5f07[_0xbe2a('0x24')](0x194);}return _0x12c91c;};}function handleError(_0x18f24a,_0x80fe28){_0x80fe28=_0x80fe28||0x1f4;return function(_0x498bca){logger['error'](_0x498bca['stack']);if(_0x498bca[_0xbe2a('0x31')]){delete _0x498bca[_0xbe2a('0x31')];}_0x18f24a[_0xbe2a('0x25')](_0x80fe28)['send'](_0x498bca);};}exports[_0xbe2a('0x32')]=function(_0xc8acf2,_0x41b302){var _0x11250b={},_0x366d62={},_0x465fcd={'count':0x0,'rows':[]};var _0x29d9e2=db[_0xbe2a('0x33')]['rawAttributes'];_0x366d62[_0xbe2a('0x34')]=_[_0xbe2a('0x35')](_0x29d9e2);_0x366d62[_0xbe2a('0x36')]=_['keys'](_0xc8acf2[_0xbe2a('0x36')]);_0x366d62['filters']=_[_0xbe2a('0x37')](_0x366d62[_0xbe2a('0x34')],_0x366d62[_0xbe2a('0x36')]);_0x11250b[_0xbe2a('0x38')]=_[_0xbe2a('0x37')](_0x366d62[_0xbe2a('0x34')],qs[_0xbe2a('0x39')](_0xc8acf2[_0xbe2a('0x36')]['fields']));_0x11250b[_0xbe2a('0x38')]=_0x11250b[_0xbe2a('0x38')]['length']?_0x11250b[_0xbe2a('0x38')]:_0x366d62[_0xbe2a('0x34')];if(!_0xc8acf2[_0xbe2a('0x36')][_0xbe2a('0x3a')](_0xbe2a('0x3b'))){_0x11250b['limit']=qs[_0xbe2a('0x2a')](_0xc8acf2[_0xbe2a('0x36')][_0xbe2a('0x2a')]);_0x11250b[_0xbe2a('0x29')]=qs[_0xbe2a('0x29')](_0xc8acf2[_0xbe2a('0x36')][_0xbe2a('0x29')]);}_0x11250b[_0xbe2a('0x3c')]=qs[_0xbe2a('0x3d')](_0xc8acf2[_0xbe2a('0x36')][_0xbe2a('0x3d')]);_0x11250b['where']=qs[_0xbe2a('0x3e')](_[_0xbe2a('0x3f')](_0xc8acf2[_0xbe2a('0x36')],_0x366d62[_0xbe2a('0x3e')]));if(_0xc8acf2['query']['filter']){_0x11250b[_0xbe2a('0x40')]=_[_0xbe2a('0x41')](_0x11250b[_0xbe2a('0x40')],{'$or':_[_0xbe2a('0x42')](_0x29d9e2,function(_0x19e960){if(_0x19e960[_0xbe2a('0x43')][_0xbe2a('0x44')]!==_0xbe2a('0x45')){var _0x3c3454={};_0x3c3454[_0x19e960[_0xbe2a('0x46')]]={'$like':'%'+_0xc8acf2[_0xbe2a('0x36')][_0xbe2a('0x47')]+'%'};return _0x3c3454;}})});}_0x11250b=_['merge']({},_0x11250b,_0xc8acf2[_0xbe2a('0x48')]);var _0x5b675b={'where':_0x11250b[_0xbe2a('0x40')]};return db[_0xbe2a('0x33')][_0xbe2a('0x28')](_0x5b675b)['then'](function(_0xca0c9d){_0x465fcd[_0xbe2a('0x28')]=_0xca0c9d;if(_0xc8acf2[_0xbe2a('0x36')][_0xbe2a('0x49')]){_0x11250b['include']=[{'all':!![]}];}return db[_0xbe2a('0x33')]['findAll'](_0x11250b);})[_0xbe2a('0x18')](function(_0xbfab83){_0x465fcd[_0xbe2a('0x4a')]=_0xbfab83;return _0x465fcd;})[_0xbe2a('0x18')](respondWithFilteredResult(_0x41b302,_0x11250b))['catch'](handleError(_0x41b302,null));};exports[_0xbe2a('0x4b')]=function(_0x17d274,_0x1c291e){var _0x125c36={'raw':![],'where':{'id':_0x17d274[_0xbe2a('0x4c')]['id']}},_0x5affd1={};_0x5affd1['model']=_[_0xbe2a('0x35')](db[_0xbe2a('0x33')][_0xbe2a('0x4d')]);_0x5affd1[_0xbe2a('0x36')]=_[_0xbe2a('0x35')](_0x17d274[_0xbe2a('0x36')]);_0x5affd1[_0xbe2a('0x3e')]=_[_0xbe2a('0x37')](_0x5affd1[_0xbe2a('0x34')],_0x5affd1['query']);_0x125c36[_0xbe2a('0x38')]=_[_0xbe2a('0x37')](_0x5affd1['model'],qs['fields'](_0x17d274['query'][_0xbe2a('0x39')]));_0x125c36[_0xbe2a('0x38')]=_0x125c36[_0xbe2a('0x38')][_0xbe2a('0x4e')]?_0x125c36['attributes']:_0x5affd1['model'];if(_0x17d274[_0xbe2a('0x36')][_0xbe2a('0x49')]){_0x125c36[_0xbe2a('0x4f')]=[{'all':!![]}];}_0x125c36=_['merge']({},_0x125c36,_0x17d274['options']);return db[_0xbe2a('0x33')]['find'](_0x125c36)[_0xbe2a('0x18')](handleEntityNotFound(_0x1c291e,null))['then'](respondWithResult(_0x1c291e,null))['catch'](handleError(_0x1c291e,null));};exports[_0xbe2a('0x50')]=function(_0x323ae9,_0x330237){return db[_0xbe2a('0x33')][_0xbe2a('0x50')](_0x323ae9['body'],{})[_0xbe2a('0x18')](respondWithResult(_0x330237,0xc9))[_0xbe2a('0x23')](handleError(_0x330237,null));};exports[_0xbe2a('0x2f')]=function(_0x2a8ac8,_0x112ede){if(_0x2a8ac8[_0xbe2a('0x51')]['id']){delete _0x2a8ac8[_0xbe2a('0x51')]['id'];}return db[_0xbe2a('0x33')][_0xbe2a('0x52')]({'where':{'id':_0x2a8ac8[_0xbe2a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x112ede,null))[_0xbe2a('0x18')](saveUpdates(_0x2a8ac8['body'],null))['then'](respondWithResult(_0x112ede,null))['catch'](handleError(_0x112ede,null));};exports['destroy']=function(_0x1b56f1,_0x27757f){return db[_0xbe2a('0x33')][_0xbe2a('0x52')]({'where':{'id':_0x1b56f1[_0xbe2a('0x4c')]['id']}})[_0xbe2a('0x18')](handleEntityNotFound(_0x27757f,null))[_0xbe2a('0x18')](removeEntity(_0x27757f,null))['catch'](handleError(_0x27757f,null));};exports[_0xbe2a('0x53')]=function(_0x3733d3,_0x265762,_0x9d5860){var _0x379a31={};var _0x3d960c={};var _0x511cf8;var _0xde5226;return db[_0xbe2a('0x33')][_0xbe2a('0x54')]({'where':{'id':_0x3733d3[_0xbe2a('0x4c')]['id']}})[_0xbe2a('0x18')](handleEntityNotFound(_0x265762,null))[_0xbe2a('0x18')](function(_0x2bbd15){if(_0x2bbd15){_0x511cf8=_0x2bbd15;_0x3d960c[_0xbe2a('0x34')]=_[_0xbe2a('0x35')](db[_0xbe2a('0x55')][_0xbe2a('0x4d')]);_0x3d960c[_0xbe2a('0x36')]=_['keys'](_0x3733d3[_0xbe2a('0x36')]);_0x3d960c[_0xbe2a('0x3e')]=_[_0xbe2a('0x37')](_0x3d960c[_0xbe2a('0x34')],_0x3d960c['query']);_0x379a31['attributes']=_[_0xbe2a('0x37')](_0x3d960c['model'],qs['fields'](_0x3733d3[_0xbe2a('0x36')][_0xbe2a('0x39')]));_0x379a31[_0xbe2a('0x38')]=_0x379a31[_0xbe2a('0x38')][_0xbe2a('0x4e')]?_0x379a31[_0xbe2a('0x38')]:_0x3d960c[_0xbe2a('0x34')];_0x379a31[_0xbe2a('0x3c')]=qs[_0xbe2a('0x3d')](_0x3733d3['query'][_0xbe2a('0x3d')]);_0x379a31[_0xbe2a('0x40')]=qs[_0xbe2a('0x3e')](_[_0xbe2a('0x3f')](_0x3733d3[_0xbe2a('0x36')],_0x3d960c[_0xbe2a('0x3e')]));if(_0x3733d3[_0xbe2a('0x36')][_0xbe2a('0x47')]){_0x379a31[_0xbe2a('0x40')]=_[_0xbe2a('0x41')](_0x379a31[_0xbe2a('0x40')],{'$or':_['map'](_0x379a31['attributes'],function(_0x4228b2){var _0x2e7aff={};_0x2e7aff[_0x4228b2]={'$like':'%'+_0x3733d3[_0xbe2a('0x36')]['filter']+'%'};return _0x2e7aff;})});}_0x379a31=_[_0xbe2a('0x41')]({},_0x379a31,_0x3733d3[_0xbe2a('0x48')]);return _0x511cf8[_0xbe2a('0x53')](_0x379a31);}})['then'](function(_0x40cc53){if(_0x40cc53){_0xde5226=_0x40cc53[_0xbe2a('0x4e')];if(!_0x3733d3[_0xbe2a('0x36')][_0xbe2a('0x3a')]('nolimit')){_0x379a31[_0xbe2a('0x2a')]=qs[_0xbe2a('0x2a')](_0x3733d3[_0xbe2a('0x36')][_0xbe2a('0x2a')]);_0x379a31[_0xbe2a('0x29')]=qs[_0xbe2a('0x29')](_0x3733d3[_0xbe2a('0x36')][_0xbe2a('0x29')]);}return _0x511cf8[_0xbe2a('0x53')](_0x379a31);}})[_0xbe2a('0x18')](function(_0x4c6691){if(_0x4c6691){return _0x4c6691?{'count':_0xde5226,'rows':_0x4c6691}:null;}})['then'](respondWithResult(_0x265762,null))[_0xbe2a('0x23')](handleError(_0x265762,null));};exports[_0xbe2a('0x56')]=function(_0x1ef5d5,_0x40fd87,_0x8a2c51){var _0x4109c1={};var _0x46a0d2={};var _0x32d6d9;var _0x251f2c;return db['VtigerConfiguration'][_0xbe2a('0x54')]({'where':{'id':_0x1ef5d5[_0xbe2a('0x4c')]['id']}})[_0xbe2a('0x18')](handleEntityNotFound(_0x40fd87,null))[_0xbe2a('0x18')](function(_0x49eb7a){if(_0x49eb7a){_0x32d6d9=_0x49eb7a;_0x46a0d2[_0xbe2a('0x34')]=_['keys'](db['VtigerField'][_0xbe2a('0x4d')]);_0x46a0d2[_0xbe2a('0x36')]=_['keys'](_0x1ef5d5[_0xbe2a('0x36')]);_0x46a0d2[_0xbe2a('0x3e')]=_['intersection'](_0x46a0d2[_0xbe2a('0x34')],_0x46a0d2[_0xbe2a('0x36')]);_0x4109c1[_0xbe2a('0x38')]=_['intersection'](_0x46a0d2[_0xbe2a('0x34')],qs[_0xbe2a('0x39')](_0x1ef5d5[_0xbe2a('0x36')]['fields']));_0x4109c1[_0xbe2a('0x38')]=_0x4109c1[_0xbe2a('0x38')]['length']?_0x4109c1[_0xbe2a('0x38')]:_0x46a0d2['model'];_0x4109c1[_0xbe2a('0x3c')]=qs[_0xbe2a('0x3d')](_0x1ef5d5[_0xbe2a('0x36')][_0xbe2a('0x3d')]);_0x4109c1[_0xbe2a('0x40')]=qs['filters'](_[_0xbe2a('0x3f')](_0x1ef5d5[_0xbe2a('0x36')],_0x46a0d2[_0xbe2a('0x3e')]));if(_0x1ef5d5[_0xbe2a('0x36')][_0xbe2a('0x47')]){_0x4109c1['where']=_['merge'](_0x4109c1[_0xbe2a('0x40')],{'$or':_[_0xbe2a('0x42')](_0x4109c1['attributes'],function(_0x2644a8){var _0x524ed6={};_0x524ed6[_0x2644a8]={'$like':'%'+_0x1ef5d5[_0xbe2a('0x36')][_0xbe2a('0x47')]+'%'};return _0x524ed6;})});}_0x4109c1=_[_0xbe2a('0x41')]({},_0x4109c1,_0x1ef5d5['options']);return _0x32d6d9[_0xbe2a('0x56')](_0x4109c1);}})['then'](function(_0xf8b9e4){if(_0xf8b9e4){_0x251f2c=_0xf8b9e4[_0xbe2a('0x4e')];if(!_0x1ef5d5['query'][_0xbe2a('0x3a')]('nolimit')){_0x4109c1[_0xbe2a('0x2a')]=qs[_0xbe2a('0x2a')](_0x1ef5d5[_0xbe2a('0x36')]['limit']);_0x4109c1[_0xbe2a('0x29')]=qs[_0xbe2a('0x29')](_0x1ef5d5['query']['offset']);}return _0x32d6d9[_0xbe2a('0x56')](_0x4109c1);}})['then'](function(_0x2c5db5){if(_0x2c5db5){return _0x2c5db5?{'count':_0x251f2c,'rows':_0x2c5db5}:null;}})[_0xbe2a('0x18')](respondWithResult(_0x40fd87,null))[_0xbe2a('0x23')](handleError(_0x40fd87,null));};exports[_0xbe2a('0x57')]=function(_0x144b06,_0x32582b,_0x2dea61){var _0x4b6d4a={};var _0x23e0b1={};var _0x4442a5;var _0x2cf3e3;return db[_0xbe2a('0x33')][_0xbe2a('0x54')]({'where':{'id':_0x144b06['params']['id']}})[_0xbe2a('0x18')](handleEntityNotFound(_0x32582b,null))[_0xbe2a('0x18')](function(_0x414add){if(_0x414add){_0x4442a5=_0x414add;_0x23e0b1[_0xbe2a('0x34')]=_['keys'](db['VtigerField'][_0xbe2a('0x4d')]);_0x23e0b1[_0xbe2a('0x36')]=_['keys'](_0x144b06[_0xbe2a('0x36')]);_0x23e0b1['filters']=_[_0xbe2a('0x37')](_0x23e0b1[_0xbe2a('0x34')],_0x23e0b1[_0xbe2a('0x36')]);_0x4b6d4a['attributes']=_['intersection'](_0x23e0b1[_0xbe2a('0x34')],qs['fields'](_0x144b06['query'][_0xbe2a('0x39')]));_0x4b6d4a['attributes']=_0x4b6d4a['attributes'][_0xbe2a('0x4e')]?_0x4b6d4a[_0xbe2a('0x38')]:_0x23e0b1[_0xbe2a('0x34')];_0x4b6d4a[_0xbe2a('0x3c')]=qs['sort'](_0x144b06['query'][_0xbe2a('0x3d')]);_0x4b6d4a[_0xbe2a('0x40')]=qs['filters'](_[_0xbe2a('0x3f')](_0x144b06[_0xbe2a('0x36')],_0x23e0b1[_0xbe2a('0x3e')]));if(_0x144b06[_0xbe2a('0x36')][_0xbe2a('0x47')]){_0x4b6d4a['where']=_[_0xbe2a('0x41')](_0x4b6d4a[_0xbe2a('0x40')],{'$or':_[_0xbe2a('0x42')](_0x4b6d4a[_0xbe2a('0x38')],function(_0x5c99e8){var _0x5672e6={};_0x5672e6[_0x5c99e8]={'$like':'%'+_0x144b06[_0xbe2a('0x36')][_0xbe2a('0x47')]+'%'};return _0x5672e6;})});}_0x4b6d4a=_['merge']({},_0x4b6d4a,_0x144b06[_0xbe2a('0x48')]);return _0x4442a5[_0xbe2a('0x57')](_0x4b6d4a);}})['then'](function(_0x4b3a2b){if(_0x4b3a2b){_0x2cf3e3=_0x4b3a2b[_0xbe2a('0x4e')];if(!_0x144b06[_0xbe2a('0x36')][_0xbe2a('0x3a')](_0xbe2a('0x3b'))){_0x4b6d4a[_0xbe2a('0x2a')]=qs[_0xbe2a('0x2a')](_0x144b06[_0xbe2a('0x36')][_0xbe2a('0x2a')]);_0x4b6d4a[_0xbe2a('0x29')]=qs[_0xbe2a('0x29')](_0x144b06['query']['offset']);}return _0x4442a5['getDescriptions'](_0x4b6d4a);}})[_0xbe2a('0x18')](function(_0x1b5054){if(_0x1b5054){return _0x1b5054?{'count':_0x2cf3e3,'rows':_0x1b5054}:null;}})[_0xbe2a('0x18')](respondWithResult(_0x32582b,null))[_0xbe2a('0x23')](handleError(_0x32582b,null));}; \ No newline at end of file +var _0x0598=['ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','end','json','count','status','set','Content-Range','reject','update','then','destroy','stack','name','index','VtigerConfiguration','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','map','type','key','VIRTUAL','field','merge','options','includeAll','include','show','params','rawAttributes','find','create','body','VtigerField','getFields','length','getSubjects','findOne','getDescriptions','html-pdf','eml-format','zip-dir','moment','bluebird','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware'];(function(_0x25fee6,_0x41923b){var _0x37c226=function(_0x11a040){while(--_0x11a040){_0x25fee6['push'](_0x25fee6['shift']());}};_0x37c226(++_0x41923b);}(_0x0598,0x92));var _0x8059=function(_0x1aa178,_0x13ff73){_0x1aa178=_0x1aa178-0x0;var _0x32a662=_0x0598[_0x1aa178];return _0x32a662;};'use strict';var pdf=require(_0x8059('0x0'));var emlformat=require(_0x8059('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8059('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8059('0x3'));var BPromise=require(_0x8059('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8059('0x5'));var csv=require(_0x8059('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8059('0x7'));var crypto=require(_0x8059('0x8'));var jsforce=require(_0x8059('0x9'));var deskjs=require(_0x8059('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8059('0xb'));var authService=require(_0x8059('0xc'));var hardwareService=require(_0x8059('0xd'));var Redis=require(_0x8059('0xe'));var qs=require(_0x8059('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x8059('0x10'));var config=require(_0x8059('0x11'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x8059('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x2d26e2,_0x306467,_0x12d6ce,_0x35c1f3){return new BPromise(function(_0x4eb4c5,_0x11218f){var _0x5480a5=_0x35c1f3||client;return _0x5480a5[_0x8059('0x13')](_0x2d26e2,_0x12d6ce)['then'](function(_0x3e4f08){logger[_0x8059('0x14')](_0x8059('0x15'),_0x306467,'request\x20sent');logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x306467,_0x8059('0x16'),JSON[_0x8059('0x17')](_0x3e4f08));if(_0x3e4f08[_0x8059('0x18')]){if(_0x3e4f08[_0x8059('0x18')][_0x8059('0x19')]===0x1f4){logger['error'](_0x8059('0x15'),_0x306467,_0x3e4f08[_0x8059('0x18')][_0x8059('0x1a')]);return _0x11218f(_0x3e4f08[_0x8059('0x18')]['message']);}logger[_0x8059('0x18')]('VtigerConfiguration,\x20%s,\x20%s',_0x306467,_0x3e4f08[_0x8059('0x18')]['message']);return _0x4eb4c5(_0x3e4f08[_0x8059('0x18')]['message']);}else{logger[_0x8059('0x14')](_0x8059('0x15'),_0x306467,_0x8059('0x16'));_0x4eb4c5(_0x3e4f08['result']['message']);}})[_0x8059('0x1b')](function(_0x232f1b){logger[_0x8059('0x18')](_0x8059('0x15'),_0x306467,_0x232f1b);_0x11218f(_0x232f1b);});});}function respondWithStatusCode(_0x4c6234,_0x3bc226){_0x3bc226=_0x3bc226||0xcc;return function(_0x21ac82){if(_0x21ac82){return _0x4c6234[_0x8059('0x1c')](_0x3bc226);}return _0x4c6234['status'](_0x3bc226)[_0x8059('0x1d')]();};}function respondWithResult(_0x2256b1,_0x3e1067){_0x3e1067=_0x3e1067||0xc8;return function(_0x2852d1){if(_0x2852d1){return _0x2256b1['status'](_0x3e1067)[_0x8059('0x1e')](_0x2852d1);}};}function respondWithFilteredResult(_0x2cd179,_0x4781e2){return function(_0x3e2d2b){if(_0x3e2d2b){var _0x202b30=_0x3e2d2b[_0x8059('0x1f')],_0x54b88b=_0x4781e2['offset'],_0x387350=_0x4781e2['offset']+_0x4781e2['limit'],_0x19b95a;if(_0x387350>=_0x202b30){_0x387350=_0x202b30;_0x19b95a=0xc8;}else{_0x19b95a=0xce;}_0x2cd179[_0x8059('0x20')](_0x19b95a);return _0x2cd179[_0x8059('0x21')](_0x8059('0x22'),_0x54b88b+'-'+_0x387350+'/'+_0x202b30)[_0x8059('0x1e')](_0x3e2d2b);}return null;};}function patchUpdates(_0x59abe9){return function(_0x1eb71b){try{jsonpatch['apply'](_0x1eb71b,_0x59abe9,!![]);}catch(_0x2f887c){return BPromise[_0x8059('0x23')](_0x2f887c);}return _0x1eb71b['save']();};}function saveUpdates(_0x3814f5,_0x1aead2){return function(_0x30aac2){if(_0x30aac2){return _0x30aac2[_0x8059('0x24')](_0x3814f5)[_0x8059('0x25')](function(_0x46b002){return _0x46b002;});}return null;};}function removeEntity(_0x46b6a1,_0x2016ea){return function(_0x505756){if(_0x505756){return _0x505756[_0x8059('0x26')]()[_0x8059('0x25')](function(){_0x46b6a1[_0x8059('0x20')](0xcc)[_0x8059('0x1d')]();});}};}function handleEntityNotFound(_0x289992,_0x53fb30){return function(_0x39f1c4){if(!_0x39f1c4){_0x289992[_0x8059('0x1c')](0x194);}return _0x39f1c4;};}function handleError(_0x27c947,_0x15160a){_0x15160a=_0x15160a||0x1f4;return function(_0x3ee515){logger[_0x8059('0x18')](_0x3ee515[_0x8059('0x27')]);if(_0x3ee515[_0x8059('0x28')]){delete _0x3ee515[_0x8059('0x28')];}_0x27c947[_0x8059('0x20')](_0x15160a)['send'](_0x3ee515);};}exports[_0x8059('0x29')]=function(_0x5b0070,_0x24194d){var _0x5dc3f7={},_0x49fb7e={},_0x2191a0={'count':0x0,'rows':[]};var _0x5bd1a6=db[_0x8059('0x2a')]['rawAttributes'];_0x49fb7e[_0x8059('0x2b')]=_['keys'](_0x5bd1a6);_0x49fb7e[_0x8059('0x2c')]=_[_0x8059('0x2d')](_0x5b0070['query']);_0x49fb7e[_0x8059('0x2e')]=_[_0x8059('0x2f')](_0x49fb7e[_0x8059('0x2b')],_0x49fb7e['query']);_0x5dc3f7[_0x8059('0x30')]=_['intersection'](_0x49fb7e[_0x8059('0x2b')],qs['fields'](_0x5b0070[_0x8059('0x2c')][_0x8059('0x31')]));_0x5dc3f7[_0x8059('0x30')]=_0x5dc3f7[_0x8059('0x30')]['length']?_0x5dc3f7[_0x8059('0x30')]:_0x49fb7e['model'];if(!_0x5b0070['query'][_0x8059('0x32')](_0x8059('0x33'))){_0x5dc3f7[_0x8059('0x34')]=qs[_0x8059('0x34')](_0x5b0070[_0x8059('0x2c')]['limit']);_0x5dc3f7['offset']=qs['offset'](_0x5b0070['query'][_0x8059('0x35')]);}_0x5dc3f7[_0x8059('0x36')]=qs[_0x8059('0x37')](_0x5b0070['query'][_0x8059('0x37')]);_0x5dc3f7[_0x8059('0x38')]=qs['filters'](_[_0x8059('0x39')](_0x5b0070[_0x8059('0x2c')],_0x49fb7e[_0x8059('0x2e')]));if(_0x5b0070['query'][_0x8059('0x3a')]){_0x5dc3f7[_0x8059('0x38')]=_['merge'](_0x5dc3f7[_0x8059('0x38')],{'$or':_[_0x8059('0x3b')](_0x5bd1a6,function(_0x3f00de){if(_0x3f00de[_0x8059('0x3c')][_0x8059('0x3d')]!==_0x8059('0x3e')){var _0x3039f9={};_0x3039f9[_0x3f00de[_0x8059('0x3f')]]={'$like':'%'+_0x5b0070[_0x8059('0x2c')][_0x8059('0x3a')]+'%'};return _0x3039f9;}})});}_0x5dc3f7=_[_0x8059('0x40')]({},_0x5dc3f7,_0x5b0070[_0x8059('0x41')]);var _0xc83a4e={'where':_0x5dc3f7[_0x8059('0x38')]};return db[_0x8059('0x2a')][_0x8059('0x1f')](_0xc83a4e)[_0x8059('0x25')](function(_0x25f542){_0x2191a0[_0x8059('0x1f')]=_0x25f542;if(_0x5b0070[_0x8059('0x2c')][_0x8059('0x42')]){_0x5dc3f7[_0x8059('0x43')]=[{'all':!![]}];}return db[_0x8059('0x2a')]['findAll'](_0x5dc3f7);})[_0x8059('0x25')](function(_0x5655d9){_0x2191a0['rows']=_0x5655d9;return _0x2191a0;})[_0x8059('0x25')](respondWithFilteredResult(_0x24194d,_0x5dc3f7))['catch'](handleError(_0x24194d,null));};exports[_0x8059('0x44')]=function(_0x5e5c2c,_0xf4bc19){var _0x37619a={'raw':![],'where':{'id':_0x5e5c2c[_0x8059('0x45')]['id']}},_0x37cfc9={};_0x37cfc9[_0x8059('0x2b')]=_[_0x8059('0x2d')](db['VtigerConfiguration'][_0x8059('0x46')]);_0x37cfc9['query']=_[_0x8059('0x2d')](_0x5e5c2c[_0x8059('0x2c')]);_0x37cfc9[_0x8059('0x2e')]=_['intersection'](_0x37cfc9[_0x8059('0x2b')],_0x37cfc9[_0x8059('0x2c')]);_0x37619a[_0x8059('0x30')]=_[_0x8059('0x2f')](_0x37cfc9['model'],qs[_0x8059('0x31')](_0x5e5c2c[_0x8059('0x2c')][_0x8059('0x31')]));_0x37619a['attributes']=_0x37619a[_0x8059('0x30')]['length']?_0x37619a['attributes']:_0x37cfc9[_0x8059('0x2b')];if(_0x5e5c2c['query'][_0x8059('0x42')]){_0x37619a['include']=[{'all':!![]}];}_0x37619a=_[_0x8059('0x40')]({},_0x37619a,_0x5e5c2c[_0x8059('0x41')]);return db['VtigerConfiguration'][_0x8059('0x47')](_0x37619a)['then'](handleEntityNotFound(_0xf4bc19,null))[_0x8059('0x25')](respondWithResult(_0xf4bc19,null))[_0x8059('0x1b')](handleError(_0xf4bc19,null));};exports[_0x8059('0x48')]=function(_0x5d5f16,_0x2dd991){return db['VtigerConfiguration'][_0x8059('0x48')](_0x5d5f16[_0x8059('0x49')],{})[_0x8059('0x25')](respondWithResult(_0x2dd991,0xc9))[_0x8059('0x1b')](handleError(_0x2dd991,null));};exports['update']=function(_0x3e957d,_0x110b2d){if(_0x3e957d['body']['id']){delete _0x3e957d[_0x8059('0x49')]['id'];}return db['VtigerConfiguration'][_0x8059('0x47')]({'where':{'id':_0x3e957d['params']['id']}})['then'](handleEntityNotFound(_0x110b2d,null))[_0x8059('0x25')](saveUpdates(_0x3e957d[_0x8059('0x49')],null))[_0x8059('0x25')](respondWithResult(_0x110b2d,null))[_0x8059('0x1b')](handleError(_0x110b2d,null));};exports[_0x8059('0x26')]=function(_0x153c4a,_0x27439d){return db['VtigerConfiguration']['find']({'where':{'id':_0x153c4a['params']['id']}})['then'](handleEntityNotFound(_0x27439d,null))[_0x8059('0x25')](removeEntity(_0x27439d,null))[_0x8059('0x1b')](handleError(_0x27439d,null));};exports['getFields']=function(_0x411fe1,_0x4b0078,_0x591444){var _0x1add7c={};var _0x55cb8d={};var _0x11b69a;var _0x27dfa5;return db[_0x8059('0x2a')]['findOne']({'where':{'id':_0x411fe1['params']['id']}})[_0x8059('0x25')](handleEntityNotFound(_0x4b0078,null))[_0x8059('0x25')](function(_0x182637){if(_0x182637){_0x11b69a=_0x182637;_0x55cb8d['model']=_['keys'](db[_0x8059('0x4a')]['rawAttributes']);_0x55cb8d['query']=_[_0x8059('0x2d')](_0x411fe1['query']);_0x55cb8d[_0x8059('0x2e')]=_[_0x8059('0x2f')](_0x55cb8d['model'],_0x55cb8d['query']);_0x1add7c[_0x8059('0x30')]=_[_0x8059('0x2f')](_0x55cb8d[_0x8059('0x2b')],qs['fields'](_0x411fe1[_0x8059('0x2c')][_0x8059('0x31')]));_0x1add7c[_0x8059('0x30')]=_0x1add7c[_0x8059('0x30')]['length']?_0x1add7c[_0x8059('0x30')]:_0x55cb8d['model'];_0x1add7c[_0x8059('0x36')]=qs[_0x8059('0x37')](_0x411fe1['query'][_0x8059('0x37')]);_0x1add7c['where']=qs[_0x8059('0x2e')](_[_0x8059('0x39')](_0x411fe1[_0x8059('0x2c')],_0x55cb8d[_0x8059('0x2e')]));if(_0x411fe1[_0x8059('0x2c')][_0x8059('0x3a')]){_0x1add7c[_0x8059('0x38')]=_[_0x8059('0x40')](_0x1add7c[_0x8059('0x38')],{'$or':_[_0x8059('0x3b')](_0x1add7c[_0x8059('0x30')],function(_0x20e9d7){var _0x325f9c={};_0x325f9c[_0x20e9d7]={'$like':'%'+_0x411fe1['query'][_0x8059('0x3a')]+'%'};return _0x325f9c;})});}_0x1add7c=_[_0x8059('0x40')]({},_0x1add7c,_0x411fe1[_0x8059('0x41')]);return _0x11b69a[_0x8059('0x4b')](_0x1add7c);}})[_0x8059('0x25')](function(_0x59a211){if(_0x59a211){_0x27dfa5=_0x59a211[_0x8059('0x4c')];if(!_0x411fe1[_0x8059('0x2c')][_0x8059('0x32')](_0x8059('0x33'))){_0x1add7c[_0x8059('0x34')]=qs[_0x8059('0x34')](_0x411fe1[_0x8059('0x2c')][_0x8059('0x34')]);_0x1add7c[_0x8059('0x35')]=qs['offset'](_0x411fe1[_0x8059('0x2c')][_0x8059('0x35')]);}return _0x11b69a[_0x8059('0x4b')](_0x1add7c);}})['then'](function(_0x591570){if(_0x591570){return _0x591570?{'count':_0x27dfa5,'rows':_0x591570}:null;}})[_0x8059('0x25')](respondWithResult(_0x4b0078,null))[_0x8059('0x1b')](handleError(_0x4b0078,null));};exports[_0x8059('0x4d')]=function(_0x36cb9d,_0x1878a6,_0x2a1833){var _0x18b3d8={};var _0x5735f4={};var _0x35ec63;var _0x39c5d9;return db[_0x8059('0x2a')]['findOne']({'where':{'id':_0x36cb9d[_0x8059('0x45')]['id']}})[_0x8059('0x25')](handleEntityNotFound(_0x1878a6,null))[_0x8059('0x25')](function(_0x2d4970){if(_0x2d4970){_0x35ec63=_0x2d4970;_0x5735f4['model']=_['keys'](db[_0x8059('0x4a')][_0x8059('0x46')]);_0x5735f4['query']=_[_0x8059('0x2d')](_0x36cb9d[_0x8059('0x2c')]);_0x5735f4[_0x8059('0x2e')]=_[_0x8059('0x2f')](_0x5735f4[_0x8059('0x2b')],_0x5735f4[_0x8059('0x2c')]);_0x18b3d8['attributes']=_[_0x8059('0x2f')](_0x5735f4[_0x8059('0x2b')],qs[_0x8059('0x31')](_0x36cb9d['query']['fields']));_0x18b3d8[_0x8059('0x30')]=_0x18b3d8[_0x8059('0x30')]['length']?_0x18b3d8[_0x8059('0x30')]:_0x5735f4[_0x8059('0x2b')];_0x18b3d8[_0x8059('0x36')]=qs[_0x8059('0x37')](_0x36cb9d[_0x8059('0x2c')][_0x8059('0x37')]);_0x18b3d8[_0x8059('0x38')]=qs[_0x8059('0x2e')](_[_0x8059('0x39')](_0x36cb9d[_0x8059('0x2c')],_0x5735f4[_0x8059('0x2e')]));if(_0x36cb9d[_0x8059('0x2c')]['filter']){_0x18b3d8[_0x8059('0x38')]=_[_0x8059('0x40')](_0x18b3d8[_0x8059('0x38')],{'$or':_['map'](_0x18b3d8['attributes'],function(_0x264f63){var _0x4cdfe3={};_0x4cdfe3[_0x264f63]={'$like':'%'+_0x36cb9d['query'][_0x8059('0x3a')]+'%'};return _0x4cdfe3;})});}_0x18b3d8=_[_0x8059('0x40')]({},_0x18b3d8,_0x36cb9d['options']);return _0x35ec63[_0x8059('0x4d')](_0x18b3d8);}})[_0x8059('0x25')](function(_0x56b712){if(_0x56b712){_0x39c5d9=_0x56b712['length'];if(!_0x36cb9d[_0x8059('0x2c')]['hasOwnProperty']('nolimit')){_0x18b3d8[_0x8059('0x34')]=qs[_0x8059('0x34')](_0x36cb9d[_0x8059('0x2c')][_0x8059('0x34')]);_0x18b3d8['offset']=qs['offset'](_0x36cb9d[_0x8059('0x2c')][_0x8059('0x35')]);}return _0x35ec63[_0x8059('0x4d')](_0x18b3d8);}})[_0x8059('0x25')](function(_0x1611d0){if(_0x1611d0){return _0x1611d0?{'count':_0x39c5d9,'rows':_0x1611d0}:null;}})[_0x8059('0x25')](respondWithResult(_0x1878a6,null))['catch'](handleError(_0x1878a6,null));};exports['getDescriptions']=function(_0x40f68a,_0xf8363f,_0x931508){var _0x515b0e={};var _0x25bae4={};var _0x1e44d6;var _0x4b346d;return db[_0x8059('0x2a')][_0x8059('0x4e')]({'where':{'id':_0x40f68a['params']['id']}})[_0x8059('0x25')](handleEntityNotFound(_0xf8363f,null))[_0x8059('0x25')](function(_0x226c47){if(_0x226c47){_0x1e44d6=_0x226c47;_0x25bae4[_0x8059('0x2b')]=_[_0x8059('0x2d')](db[_0x8059('0x4a')][_0x8059('0x46')]);_0x25bae4[_0x8059('0x2c')]=_[_0x8059('0x2d')](_0x40f68a['query']);_0x25bae4['filters']=_[_0x8059('0x2f')](_0x25bae4[_0x8059('0x2b')],_0x25bae4[_0x8059('0x2c')]);_0x515b0e[_0x8059('0x30')]=_[_0x8059('0x2f')](_0x25bae4[_0x8059('0x2b')],qs['fields'](_0x40f68a[_0x8059('0x2c')][_0x8059('0x31')]));_0x515b0e[_0x8059('0x30')]=_0x515b0e['attributes'][_0x8059('0x4c')]?_0x515b0e[_0x8059('0x30')]:_0x25bae4[_0x8059('0x2b')];_0x515b0e[_0x8059('0x36')]=qs[_0x8059('0x37')](_0x40f68a[_0x8059('0x2c')][_0x8059('0x37')]);_0x515b0e[_0x8059('0x38')]=qs[_0x8059('0x2e')](_[_0x8059('0x39')](_0x40f68a[_0x8059('0x2c')],_0x25bae4[_0x8059('0x2e')]));if(_0x40f68a[_0x8059('0x2c')][_0x8059('0x3a')]){_0x515b0e[_0x8059('0x38')]=_['merge'](_0x515b0e[_0x8059('0x38')],{'$or':_[_0x8059('0x3b')](_0x515b0e['attributes'],function(_0x3f6e7a){var _0x52f4d6={};_0x52f4d6[_0x3f6e7a]={'$like':'%'+_0x40f68a[_0x8059('0x2c')][_0x8059('0x3a')]+'%'};return _0x52f4d6;})});}_0x515b0e=_[_0x8059('0x40')]({},_0x515b0e,_0x40f68a[_0x8059('0x41')]);return _0x1e44d6[_0x8059('0x4f')](_0x515b0e);}})[_0x8059('0x25')](function(_0x1754db){if(_0x1754db){_0x4b346d=_0x1754db[_0x8059('0x4c')];if(!_0x40f68a[_0x8059('0x2c')][_0x8059('0x32')](_0x8059('0x33'))){_0x515b0e[_0x8059('0x34')]=qs['limit'](_0x40f68a['query'][_0x8059('0x34')]);_0x515b0e[_0x8059('0x35')]=qs['offset'](_0x40f68a[_0x8059('0x2c')]['offset']);}return _0x1e44d6[_0x8059('0x4f')](_0x515b0e);}})[_0x8059('0x25')](function(_0x2fd28e){if(_0x2fd28e){return _0x2fd28e?{'count':_0x4b346d,'rows':_0x2fd28e}:null;}})[_0x8059('0x25')](respondWithResult(_0xf8363f,null))[_0x8059('0x1b')](handleError(_0xf8363f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 6855db0..7e97d0f 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 _0x27c0=['../../config/logger','api','moment','exports','VtigerConfiguration','int_vtiger_configurations','lodash','util'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x27c0,0xae));var _0x027c=function(_0x214994,_0x5b7405){_0x214994=_0x214994-0x0;var _0x37b08c=_0x27c0[_0x214994];return _0x37b08c;};'use strict';var _=require(_0x027c('0x0'));var util=require(_0x027c('0x1'));var logger=require(_0x027c('0x2'))(_0x027c('0x3'));var moment=require(_0x027c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./intVtigerConfiguration.attributes');module[_0x027c('0x5')]=function(_0x192c0a,_0x17e440){return _0x192c0a['define'](_0x027c('0x6'),attributes,{'tableName':_0x027c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5291=['lodash','util','moment','bluebird','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations'];(function(_0x146eb4,_0x48b64b){var _0x1d53c3=function(_0x1c2d40){while(--_0x1c2d40){_0x146eb4['push'](_0x146eb4['shift']());}};_0x1d53c3(++_0x48b64b);}(_0x5291,0xa0));var _0x1529=function(_0x49fdec,_0xb00433){_0x49fdec=_0x49fdec-0x0;var _0x3b7c37=_0x5291[_0x49fdec];return _0x3b7c37;};'use strict';var _=require(_0x1529('0x0'));var util=require(_0x1529('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1529('0x2'));var BPromise=require(_0x1529('0x3'));var rp=require('request-promise');var attributes=require(_0x1529('0x4'));module[_0x1529('0x5')]=function(_0x1c22f3,_0x1a72c6){return _0x1c22f3['define'](_0x1529('0x6'),attributes,{'tableName':_0x1529('0x7'),'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 373c7b6..d5858c7 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 _0x42bb=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1d128e,_0x2c87de){var _0x3d5236=function(_0x2374ff){while(--_0x2374ff){_0x1d128e['push'](_0x1d128e['shift']());}};_0x3d5236(++_0x2c87de);}(_0x42bb,0x16f));var _0xb42b=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x42bb[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0xb42b('0x0'));var util=require(_0xb42b('0x1'));var moment=require('moment');var BPromise=require(_0xb42b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb42b('0x3'));var logger=require(_0xb42b('0x4'))(_0xb42b('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb42b('0x6')][_0xb42b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xca03a3,_0x1c8d4b,_0x84d499){return new BPromise(function(_0x3aafdc,_0x51240a){return client[_0xb42b('0x8')](_0xca03a3,_0x84d499)[_0xb42b('0x9')](function(_0x406a87){logger['info'](_0xb42b('0xa'),_0x1c8d4b,_0xb42b('0xb'));logger[_0xb42b('0xc')](_0xb42b('0xd'),_0x1c8d4b,_0xb42b('0xb'),JSON[_0xb42b('0xe')](_0x406a87));if(_0x406a87[_0xb42b('0xf')]){if(_0x406a87[_0xb42b('0xf')][_0xb42b('0x10')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x1c8d4b,_0x406a87[_0xb42b('0xf')][_0xb42b('0x11')]);return _0x51240a(_0x406a87['error']['message']);}logger[_0xb42b('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x1c8d4b,_0x406a87[_0xb42b('0xf')]['message']);return _0x3aafdc(_0x406a87[_0xb42b('0xf')][_0xb42b('0x11')]);}else{logger[_0xb42b('0x12')](_0xb42b('0xa'),_0x1c8d4b,'request\x20sent');_0x3aafdc(_0x406a87['result'][_0xb42b('0x11')]);}})[_0xb42b('0x13')](function(_0x59ba28){logger['error'](_0xb42b('0xa'),_0x1c8d4b,_0x59ba28);_0x51240a(_0x59ba28);});});} \ No newline at end of file +var _0xb416=['rpc','../../config/environment','jayson/promise','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1878a5,_0x5ebc67){var _0x5ce650=function(_0x36d0b0){while(--_0x36d0b0){_0x1878a5['push'](_0x1878a5['shift']());}};_0x5ce650(++_0x5ebc67);}(_0xb416,0x164));var _0x6b41=function(_0x532523,_0x10c982){_0x532523=_0x532523-0x0;var _0x1b7dd0=_0xb416[_0x532523];return _0x1b7dd0;};'use strict';var _=require(_0x6b41('0x0'));var util=require(_0x6b41('0x1'));var moment=require(_0x6b41('0x2'));var BPromise=require(_0x6b41('0x3'));var rs=require(_0x6b41('0x4'));var fs=require('fs');var Redis=require(_0x6b41('0x5'));var db=require(_0x6b41('0x6'))['db'];var utils=require(_0x6b41('0x7'));var logger=require('../../config/logger')(_0x6b41('0x8'));var config=require(_0x6b41('0x9'));var jayson=require(_0x6b41('0xa'));var client=jayson[_0x6b41('0xb')][_0x6b41('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32962a,_0x5ac85c,_0x2792cd){return new BPromise(function(_0x2ea80e,_0x396ae3){return client[_0x6b41('0xd')](_0x32962a,_0x2792cd)[_0x6b41('0xe')](function(_0x25e053){logger['info'](_0x6b41('0xf'),_0x5ac85c,_0x6b41('0x10'));logger[_0x6b41('0x11')](_0x6b41('0x12'),_0x5ac85c,'request\x20sent',JSON[_0x6b41('0x13')](_0x25e053));if(_0x25e053['error']){if(_0x25e053[_0x6b41('0x14')][_0x6b41('0x15')]===0x1f4){logger[_0x6b41('0x14')](_0x6b41('0xf'),_0x5ac85c,_0x25e053[_0x6b41('0x14')][_0x6b41('0x16')]);return _0x396ae3(_0x25e053[_0x6b41('0x14')][_0x6b41('0x16')]);}logger[_0x6b41('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0x5ac85c,_0x25e053[_0x6b41('0x14')][_0x6b41('0x16')]);return _0x2ea80e(_0x25e053['error'][_0x6b41('0x16')]);}else{logger[_0x6b41('0x17')]('VtigerConfiguration,\x20%s,\x20%s',_0x5ac85c,_0x6b41('0x10'));_0x2ea80e(_0x25e053[_0x6b41('0x18')][_0x6b41('0x16')]);}})[_0x6b41('0x19')](function(_0x1ac3b0){logger[_0x6b41('0x14')](_0x6b41('0xf'),_0x5ac85c,_0x1ac3b0);_0x396ae3(_0x1ac3b0);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index eec80c3..0fa165d 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 _0xc42f=['./intVtigerField.controller','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../config/environment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc42f,0x10b));var _0xfc42=function(_0x146f6d,_0x1a9970){_0x146f6d=_0x146f6d-0x0;var _0x2ab706=_0xc42f[_0x146f6d];return _0x2ab706;};'use strict';var multer=require(_0xfc42('0x0'));var util=require(_0xfc42('0x1'));var path=require(_0xfc42('0x2'));var timeout=require(_0xfc42('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfc42('0x4'));var controller=require(_0xfc42('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xfc42('0x6')]);router['get'](_0xfc42('0x7'),auth[_0xfc42('0x8')](),controller[_0xfc42('0x9')]);router['post']('/',auth[_0xfc42('0x8')](),controller[_0xfc42('0xa')]);router[_0xfc42('0xb')](_0xfc42('0x7'),auth['isAuthenticated'](),controller[_0xfc42('0xc')]);router[_0xfc42('0xd')](_0xfc42('0x7'),auth[_0xfc42('0x8')](),controller[_0xfc42('0xe')]);module[_0xfc42('0xf')]=router; \ No newline at end of file +var _0xf384=['show','post','create','put','update','destroy','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xf384,0x1b6));var _0x4f38=function(_0xaf352,_0x1c75dc){_0xaf352=_0xaf352-0x0;var _0x1fd2f8=_0xf384[_0xaf352];return _0x1fd2f8;};'use strict';var multer=require(_0x4f38('0x0'));var util=require(_0x4f38('0x1'));var path=require('path');var timeout=require(_0x4f38('0x2'));var express=require('express');var router=express[_0x4f38('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4f38('0x4'));var config=require(_0x4f38('0x5'));var controller=require('./intVtigerField.controller');router[_0x4f38('0x6')]('/',auth[_0x4f38('0x7')](),controller[_0x4f38('0x8')]);router[_0x4f38('0x6')](_0x4f38('0x9'),auth[_0x4f38('0x7')](),controller[_0x4f38('0xa')]);router[_0x4f38('0xb')]('/',auth['isAuthenticated'](),controller[_0x4f38('0xc')]);router[_0x4f38('0xd')]('/:id',auth[_0x4f38('0x7')](),controller[_0x4f38('0xe')]);router['delete'](_0x4f38('0x9'),auth[_0x4f38('0x7')](),controller[_0x4f38('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 20f45d6..4f30e07 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 _0x5b02=['BOOLEAN','sequelize','exports','ENUM','string','keyValue','STRING','variable'];(function(_0x3ba684,_0x5aeb0c){var _0x28095e=function(_0x5d3670){while(--_0x5d3670){_0x3ba684['push'](_0x3ba684['shift']());}};_0x28095e(++_0x5aeb0c);}(_0x5b02,0xe9));var _0x25b0=function(_0x465d88,_0x453f18){_0x465d88=_0x465d88-0x0;var _0x1cd04b=_0x5b02[_0x465d88];return _0x1cd04b;};'use strict';var Sequelize=require(_0x25b0('0x0'));module[_0x25b0('0x1')]={'type':{'type':Sequelize[_0x25b0('0x2')](_0x25b0('0x3'),'variable','customVariable',_0x25b0('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x25b0('0x5')]},'key':{'type':Sequelize[_0x25b0('0x5')]},'keyType':{'type':Sequelize[_0x25b0('0x2')](_0x25b0('0x3'),_0x25b0('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x25b0('0x5')]},'idField':{'type':Sequelize[_0x25b0('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x25b0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6c76=['customVariable','STRING','string','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x6c76,0x184));var _0x66c7=function(_0x454af1,_0x219a67){_0x454af1=_0x454af1-0x0;var _0x1cd4d4=_0x6c76[_0x454af1];return _0x1cd4d4;};'use strict';var Sequelize=require(_0x66c7('0x0'));module[_0x66c7('0x1')]={'type':{'type':Sequelize[_0x66c7('0x2')]('string',_0x66c7('0x3'),_0x66c7('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0x66c7('0x5')]},'key':{'type':Sequelize[_0x66c7('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x66c7('0x6'),_0x66c7('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x66c7('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x66c7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x66c7('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 331fb0e..b0c3612 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 _0x39b8=['merge','options','includeAll','include','findAll','rows','catch','params','body','find','html-pdf','zip-dir','moment','bluebird','util','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','limit','Content-Range','save','update','then','destroy','end','name','send','index','VtigerField','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick','map','type','key','VIRTUAL','field'];(function(_0x1a72b8,_0x1e4f4b){var _0x39f72d=function(_0x35aef1){while(--_0x35aef1){_0x1a72b8['push'](_0x1a72b8['shift']());}};_0x39f72d(++_0x1e4f4b);}(_0x39b8,0x190));var _0x839b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x39b8[_0x397e5f];return _0x5302b8;};'use strict';var pdf=require(_0x839b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x839b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x839b('0x2'));var BPromise=require(_0x839b('0x3'));var Mustache=require('mustache');var util=require(_0x839b('0x4'));var path=require('path');var sox=require(_0x839b('0x5'));var csv=require(_0x839b('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x839b('0x7'));var squel=require(_0x839b('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x839b('0x9'));var toCsv=require(_0x839b('0x6'));var querystring=require(_0x839b('0xa'));var Papa=require(_0x839b('0xb'));var authService=require(_0x839b('0xc'));var hardwareService=require(_0x839b('0xd'));var Redis=require(_0x839b('0xe'));var qs=require(_0x839b('0xf'));var logger=require('../../config/logger')(_0x839b('0x10'));var utils=require(_0x839b('0x11'));var config=require(_0x839b('0x12'));var db=require(_0x839b('0x13'))['db'];function respondWithStatusCode(_0xffb930,_0x3f13df){_0x3f13df=_0x3f13df||0xcc;return function(_0x5291a2){if(_0x5291a2){return _0xffb930[_0x839b('0x14')](_0x3f13df);}return _0xffb930['status'](_0x3f13df)['end']();};}function respondWithResult(_0x32d153,_0x15a563){_0x15a563=_0x15a563||0xc8;return function(_0x2a2ccd){if(_0x2a2ccd){return _0x32d153[_0x839b('0x15')](_0x15a563)[_0x839b('0x16')](_0x2a2ccd);}};}function respondWithFilteredResult(_0x195687,_0x135690){return function(_0x40b7fc){if(_0x40b7fc){var _0x20d149=_0x40b7fc[_0x839b('0x17')],_0x4a6af1=_0x135690['offset'],_0x36398b=_0x135690['offset']+_0x135690[_0x839b('0x18')],_0x3dbf4b;if(_0x36398b>=_0x20d149){_0x36398b=_0x20d149;_0x3dbf4b=0xc8;}else{_0x3dbf4b=0xce;}_0x195687[_0x839b('0x15')](_0x3dbf4b);return _0x195687['set'](_0x839b('0x19'),_0x4a6af1+'-'+_0x36398b+'/'+_0x20d149)[_0x839b('0x16')](_0x40b7fc);}return null;};}function patchUpdates(_0x401ab1){return function(_0x38136b){try{jsonpatch['apply'](_0x38136b,_0x401ab1,!![]);}catch(_0xdf42a4){return BPromise['reject'](_0xdf42a4);}return _0x38136b[_0x839b('0x1a')]();};}function saveUpdates(_0x37cfad,_0x5a2971){return function(_0x7474b7){if(_0x7474b7){return _0x7474b7[_0x839b('0x1b')](_0x37cfad)[_0x839b('0x1c')](function(_0x59b040){return _0x59b040;});}return null;};}function removeEntity(_0xc64a3a,_0x2fcd7b){return function(_0x35f140){if(_0x35f140){return _0x35f140[_0x839b('0x1d')]()[_0x839b('0x1c')](function(){_0xc64a3a[_0x839b('0x15')](0xcc)[_0x839b('0x1e')]();});}};}function handleEntityNotFound(_0x17ce31,_0x37f89b){return function(_0x3daadd){if(!_0x3daadd){_0x17ce31['sendStatus'](0x194);}return _0x3daadd;};}function handleError(_0xf496f8,_0x169879){_0x169879=_0x169879||0x1f4;return function(_0x191e01){logger['error'](_0x191e01['stack']);if(_0x191e01['name']){delete _0x191e01[_0x839b('0x1f')];}_0xf496f8[_0x839b('0x15')](_0x169879)[_0x839b('0x20')](_0x191e01);};}exports[_0x839b('0x21')]=function(_0x290f2c,_0x2f5270){var _0x194a66={},_0x781dd6={},_0x47686c={'count':0x0,'rows':[]};var _0x3d6658=db[_0x839b('0x22')][_0x839b('0x23')];_0x781dd6[_0x839b('0x24')]=_[_0x839b('0x25')](_0x3d6658);_0x781dd6[_0x839b('0x26')]=_[_0x839b('0x25')](_0x290f2c[_0x839b('0x26')]);_0x781dd6[_0x839b('0x27')]=_[_0x839b('0x28')](_0x781dd6['model'],_0x781dd6['query']);_0x194a66[_0x839b('0x29')]=_[_0x839b('0x28')](_0x781dd6[_0x839b('0x24')],qs['fields'](_0x290f2c[_0x839b('0x26')][_0x839b('0x2a')]));_0x194a66[_0x839b('0x29')]=_0x194a66[_0x839b('0x29')][_0x839b('0x2b')]?_0x194a66[_0x839b('0x29')]:_0x781dd6[_0x839b('0x24')];if(!_0x290f2c['query']['hasOwnProperty'](_0x839b('0x2c'))){_0x194a66[_0x839b('0x18')]=qs['limit'](_0x290f2c[_0x839b('0x26')][_0x839b('0x18')]);_0x194a66['offset']=qs[_0x839b('0x2d')](_0x290f2c['query']['offset']);}_0x194a66[_0x839b('0x2e')]=qs[_0x839b('0x2f')](_0x290f2c['query'][_0x839b('0x2f')]);_0x194a66[_0x839b('0x30')]=qs[_0x839b('0x27')](_[_0x839b('0x31')](_0x290f2c[_0x839b('0x26')],_0x781dd6[_0x839b('0x27')]));if(_0x290f2c[_0x839b('0x26')]['filter']){_0x194a66[_0x839b('0x30')]=_['merge'](_0x194a66[_0x839b('0x30')],{'$or':_[_0x839b('0x32')](_0x3d6658,function(_0x25a030){if(_0x25a030[_0x839b('0x33')][_0x839b('0x34')]!==_0x839b('0x35')){var _0x559485={};_0x559485[_0x25a030[_0x839b('0x36')]]={'$like':'%'+_0x290f2c[_0x839b('0x26')]['filter']+'%'};return _0x559485;}})});}_0x194a66=_[_0x839b('0x37')]({},_0x194a66,_0x290f2c[_0x839b('0x38')]);var _0x12c6ee={'where':_0x194a66[_0x839b('0x30')]};return db['VtigerField'][_0x839b('0x17')](_0x12c6ee)[_0x839b('0x1c')](function(_0xe1fa96){_0x47686c[_0x839b('0x17')]=_0xe1fa96;if(_0x290f2c[_0x839b('0x26')][_0x839b('0x39')]){_0x194a66[_0x839b('0x3a')]=[{'all':!![]}];}return db['VtigerField'][_0x839b('0x3b')](_0x194a66);})[_0x839b('0x1c')](function(_0xaef216){_0x47686c[_0x839b('0x3c')]=_0xaef216;return _0x47686c;})['then'](respondWithFilteredResult(_0x2f5270,_0x194a66))[_0x839b('0x3d')](handleError(_0x2f5270,null));};exports['show']=function(_0x536e22,_0x3ece6a){var _0x194053={'raw':!![],'where':{'id':_0x536e22[_0x839b('0x3e')]['id']}},_0xf2ba9b={};_0xf2ba9b[_0x839b('0x24')]=_[_0x839b('0x25')](db[_0x839b('0x22')][_0x839b('0x23')]);_0xf2ba9b[_0x839b('0x26')]=_[_0x839b('0x25')](_0x536e22[_0x839b('0x26')]);_0xf2ba9b[_0x839b('0x27')]=_['intersection'](_0xf2ba9b[_0x839b('0x24')],_0xf2ba9b[_0x839b('0x26')]);_0x194053[_0x839b('0x29')]=_[_0x839b('0x28')](_0xf2ba9b[_0x839b('0x24')],qs[_0x839b('0x2a')](_0x536e22[_0x839b('0x26')][_0x839b('0x2a')]));_0x194053['attributes']=_0x194053['attributes']['length']?_0x194053[_0x839b('0x29')]:_0xf2ba9b[_0x839b('0x24')];if(_0x536e22[_0x839b('0x26')][_0x839b('0x39')]){_0x194053['include']=[{'all':!![]}];}_0x194053=_[_0x839b('0x37')]({},_0x194053,_0x536e22[_0x839b('0x38')]);return db[_0x839b('0x22')]['find'](_0x194053)[_0x839b('0x1c')](handleEntityNotFound(_0x3ece6a,null))[_0x839b('0x1c')](respondWithResult(_0x3ece6a,null))[_0x839b('0x3d')](handleError(_0x3ece6a,null));};exports['create']=function(_0x15fa57,_0x4ae2b9){return db[_0x839b('0x22')]['create'](_0x15fa57[_0x839b('0x3f')],{})[_0x839b('0x1c')](respondWithResult(_0x4ae2b9,0xc9))[_0x839b('0x3d')](handleError(_0x4ae2b9,null));};exports[_0x839b('0x1b')]=function(_0x148059,_0x5c83f9){if(_0x148059[_0x839b('0x3f')]['id']){delete _0x148059[_0x839b('0x3f')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x148059[_0x839b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5c83f9,null))[_0x839b('0x1c')](saveUpdates(_0x148059[_0x839b('0x3f')],null))[_0x839b('0x1c')](respondWithResult(_0x5c83f9,null))[_0x839b('0x3d')](handleError(_0x5c83f9,null));};exports['destroy']=function(_0x2a5c42,_0x1dc2f7){return db[_0x839b('0x22')][_0x839b('0x40')]({'where':{'id':_0x2a5c42['params']['id']}})[_0x839b('0x1c')](handleEntityNotFound(_0x1dc2f7,null))[_0x839b('0x1c')](removeEntity(_0x1dc2f7,null))[_0x839b('0x3d')](handleError(_0x1dc2f7,null));}; \ No newline at end of file +var _0x717f=['Content-Range','apply','reject','save','update','then','destroy','name','send','VtigerField','rawAttributes','model','keys','query','filters','intersection','fields','attributes','nolimit','limit','order','sort','where','pick','merge','field','filter','options','include','findAll','show','includeAll','find','catch','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','../../config/environment','sendStatus','status','json','count','offset','set'];(function(_0x36faed,_0x225adb){var _0x3677b4=function(_0x35760a){while(--_0x35760a){_0x36faed['push'](_0x36faed['shift']());}};_0x3677b4(++_0x225adb);}(_0x717f,0x16a));var _0xf717=function(_0x309c9e,_0x26d084){_0x309c9e=_0x309c9e-0x0;var _0x2fbb3d=_0x717f[_0x309c9e];return _0x2fbb3d;};'use strict';var pdf=require(_0xf717('0x0'));var emlformat=require(_0xf717('0x1'));var rimraf=require(_0xf717('0x2'));var zipdir=require(_0xf717('0x3'));var jsonpatch=require(_0xf717('0x4'));var rp=require('request-promise');var moment=require(_0xf717('0x5'));var BPromise=require(_0xf717('0x6'));var Mustache=require(_0xf717('0x7'));var util=require(_0xf717('0x8'));var path=require(_0xf717('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf717('0xa'));var fs=require('fs');var _=require(_0xf717('0xb'));var squel=require(_0xf717('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf717('0xd'));var toCsv=require(_0xf717('0xe'));var querystring=require(_0xf717('0xf'));var Papa=require(_0xf717('0x10'));var authService=require(_0xf717('0x11'));var hardwareService=require(_0xf717('0x12'));var Redis=require(_0xf717('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0xf717('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xf717('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f4500,_0x636f76){_0x636f76=_0x636f76||0xcc;return function(_0x15c501){if(_0x15c501){return _0x2f4500[_0xf717('0x16')](_0x636f76);}return _0x2f4500[_0xf717('0x17')](_0x636f76)['end']();};}function respondWithResult(_0xc8ff81,_0x3b6130){_0x3b6130=_0x3b6130||0xc8;return function(_0x4854c7){if(_0x4854c7){return _0xc8ff81[_0xf717('0x17')](_0x3b6130)[_0xf717('0x18')](_0x4854c7);}};}function respondWithFilteredResult(_0x555af1,_0x5052d2){return function(_0x2eb044){if(_0x2eb044){var _0xd3fb66=_0x2eb044[_0xf717('0x19')],_0x8c71a1=_0x5052d2[_0xf717('0x1a')],_0x15fa0d=_0x5052d2[_0xf717('0x1a')]+_0x5052d2['limit'],_0x82db63;if(_0x15fa0d>=_0xd3fb66){_0x15fa0d=_0xd3fb66;_0x82db63=0xc8;}else{_0x82db63=0xce;}_0x555af1[_0xf717('0x17')](_0x82db63);return _0x555af1[_0xf717('0x1b')](_0xf717('0x1c'),_0x8c71a1+'-'+_0x15fa0d+'/'+_0xd3fb66)[_0xf717('0x18')](_0x2eb044);}return null;};}function patchUpdates(_0x40581b){return function(_0x5c4c81){try{jsonpatch[_0xf717('0x1d')](_0x5c4c81,_0x40581b,!![]);}catch(_0x60e657){return BPromise[_0xf717('0x1e')](_0x60e657);}return _0x5c4c81[_0xf717('0x1f')]();};}function saveUpdates(_0x7597cb,_0x212e61){return function(_0x4d698e){if(_0x4d698e){return _0x4d698e[_0xf717('0x20')](_0x7597cb)[_0xf717('0x21')](function(_0xbc383b){return _0xbc383b;});}return null;};}function removeEntity(_0x3d482f,_0x15d2a1){return function(_0x1f8603){if(_0x1f8603){return _0x1f8603[_0xf717('0x22')]()[_0xf717('0x21')](function(){_0x3d482f[_0xf717('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50684c,_0x5a0f60){return function(_0x53ee0f){if(!_0x53ee0f){_0x50684c['sendStatus'](0x194);}return _0x53ee0f;};}function handleError(_0x4b53e1,_0x5b7843){_0x5b7843=_0x5b7843||0x1f4;return function(_0x37b0f4){logger['error'](_0x37b0f4['stack']);if(_0x37b0f4[_0xf717('0x23')]){delete _0x37b0f4['name'];}_0x4b53e1[_0xf717('0x17')](_0x5b7843)[_0xf717('0x24')](_0x37b0f4);};}exports['index']=function(_0xe2c17a,_0x3c34a6){var _0x2ce282={},_0x478414={},_0x43b1e3={'count':0x0,'rows':[]};var _0xf3854f=db[_0xf717('0x25')][_0xf717('0x26')];_0x478414[_0xf717('0x27')]=_[_0xf717('0x28')](_0xf3854f);_0x478414['query']=_[_0xf717('0x28')](_0xe2c17a[_0xf717('0x29')]);_0x478414[_0xf717('0x2a')]=_[_0xf717('0x2b')](_0x478414[_0xf717('0x27')],_0x478414[_0xf717('0x29')]);_0x2ce282['attributes']=_['intersection'](_0x478414['model'],qs[_0xf717('0x2c')](_0xe2c17a[_0xf717('0x29')][_0xf717('0x2c')]));_0x2ce282[_0xf717('0x2d')]=_0x2ce282[_0xf717('0x2d')]['length']?_0x2ce282[_0xf717('0x2d')]:_0x478414[_0xf717('0x27')];if(!_0xe2c17a[_0xf717('0x29')]['hasOwnProperty'](_0xf717('0x2e'))){_0x2ce282[_0xf717('0x2f')]=qs[_0xf717('0x2f')](_0xe2c17a[_0xf717('0x29')]['limit']);_0x2ce282[_0xf717('0x1a')]=qs[_0xf717('0x1a')](_0xe2c17a[_0xf717('0x29')]['offset']);}_0x2ce282[_0xf717('0x30')]=qs[_0xf717('0x31')](_0xe2c17a[_0xf717('0x29')]['sort']);_0x2ce282[_0xf717('0x32')]=qs[_0xf717('0x2a')](_[_0xf717('0x33')](_0xe2c17a['query'],_0x478414[_0xf717('0x2a')]));if(_0xe2c17a[_0xf717('0x29')]['filter']){_0x2ce282['where']=_[_0xf717('0x34')](_0x2ce282[_0xf717('0x32')],{'$or':_['map'](_0xf3854f,function(_0x899a2f){if(_0x899a2f['type']['key']!=='VIRTUAL'){var _0x2ee68b={};_0x2ee68b[_0x899a2f[_0xf717('0x35')]]={'$like':'%'+_0xe2c17a[_0xf717('0x29')][_0xf717('0x36')]+'%'};return _0x2ee68b;}})});}_0x2ce282=_[_0xf717('0x34')]({},_0x2ce282,_0xe2c17a[_0xf717('0x37')]);var _0x48bbdc={'where':_0x2ce282[_0xf717('0x32')]};return db[_0xf717('0x25')][_0xf717('0x19')](_0x48bbdc)[_0xf717('0x21')](function(_0x501a39){_0x43b1e3['count']=_0x501a39;if(_0xe2c17a[_0xf717('0x29')]['includeAll']){_0x2ce282[_0xf717('0x38')]=[{'all':!![]}];}return db[_0xf717('0x25')][_0xf717('0x39')](_0x2ce282);})[_0xf717('0x21')](function(_0x4b5f00){_0x43b1e3['rows']=_0x4b5f00;return _0x43b1e3;})[_0xf717('0x21')](respondWithFilteredResult(_0x3c34a6,_0x2ce282))['catch'](handleError(_0x3c34a6,null));};exports[_0xf717('0x3a')]=function(_0x4d3f36,_0x2b8ffc){var _0x5e2dac={'raw':!![],'where':{'id':_0x4d3f36['params']['id']}},_0x521ca7={};_0x521ca7[_0xf717('0x27')]=_[_0xf717('0x28')](db[_0xf717('0x25')]['rawAttributes']);_0x521ca7[_0xf717('0x29')]=_[_0xf717('0x28')](_0x4d3f36['query']);_0x521ca7[_0xf717('0x2a')]=_[_0xf717('0x2b')](_0x521ca7[_0xf717('0x27')],_0x521ca7[_0xf717('0x29')]);_0x5e2dac[_0xf717('0x2d')]=_[_0xf717('0x2b')](_0x521ca7[_0xf717('0x27')],qs[_0xf717('0x2c')](_0x4d3f36[_0xf717('0x29')][_0xf717('0x2c')]));_0x5e2dac['attributes']=_0x5e2dac[_0xf717('0x2d')]['length']?_0x5e2dac[_0xf717('0x2d')]:_0x521ca7[_0xf717('0x27')];if(_0x4d3f36['query'][_0xf717('0x3b')]){_0x5e2dac[_0xf717('0x38')]=[{'all':!![]}];}_0x5e2dac=_[_0xf717('0x34')]({},_0x5e2dac,_0x4d3f36['options']);return db[_0xf717('0x25')][_0xf717('0x3c')](_0x5e2dac)[_0xf717('0x21')](handleEntityNotFound(_0x2b8ffc,null))[_0xf717('0x21')](respondWithResult(_0x2b8ffc,null))[_0xf717('0x3d')](handleError(_0x2b8ffc,null));};exports[_0xf717('0x3e')]=function(_0x5d0060,_0x278a10){return db[_0xf717('0x25')][_0xf717('0x3e')](_0x5d0060[_0xf717('0x3f')],{})[_0xf717('0x21')](respondWithResult(_0x278a10,0xc9))[_0xf717('0x3d')](handleError(_0x278a10,null));};exports[_0xf717('0x20')]=function(_0x41f52d,_0xa6751e){if(_0x41f52d[_0xf717('0x3f')]['id']){delete _0x41f52d[_0xf717('0x3f')]['id'];}return db[_0xf717('0x25')][_0xf717('0x3c')]({'where':{'id':_0x41f52d[_0xf717('0x40')]['id']}})[_0xf717('0x21')](handleEntityNotFound(_0xa6751e,null))[_0xf717('0x21')](saveUpdates(_0x41f52d['body'],null))[_0xf717('0x21')](respondWithResult(_0xa6751e,null))[_0xf717('0x3d')](handleError(_0xa6751e,null));};exports[_0xf717('0x22')]=function(_0x44331d,_0x1d31a7){return db[_0xf717('0x25')]['find']({'where':{'id':_0x44331d[_0xf717('0x40')]['id']}})[_0xf717('0x21')](handleEntityNotFound(_0x1d31a7,null))['then'](removeEntity(_0x1d31a7,null))[_0xf717('0x3d')](handleError(_0x1d31a7,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 327c155..65c192f 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 _0x58e2=['api','moment','bluebird','exports','idField','util','../../config/logger'];(function(_0x238c67,_0x4c409e){var _0x51d179=function(_0x24ab46){while(--_0x24ab46){_0x238c67['push'](_0x238c67['shift']());}};_0x51d179(++_0x4c409e);}(_0x58e2,0x178));var _0x258e=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x58e2[_0xb24a3e];return _0x4038d7;};'use strict';var _=require('lodash');var util=require(_0x258e('0x0'));var logger=require(_0x258e('0x1'))(_0x258e('0x2'));var moment=require(_0x258e('0x3'));var BPromise=require(_0x258e('0x4'));var rp=require('request-promise');var attributes=require('./intVtigerField.attributes');module[_0x258e('0x5')]=function(_0x216b61,_0x585904){return _0x216b61['define']('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x258e('0x6'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8791=['request-promise','define','VtigerField','int_vtiger_fields','idField','FieldId','lodash','../../config/logger','api','moment','bluebird'];(function(_0x6cfdba,_0xfc2b46){var _0x35fa0c=function(_0x453feb){while(--_0x453feb){_0x6cfdba['push'](_0x6cfdba['shift']());}};_0x35fa0c(++_0xfc2b46);}(_0x8791,0x1df));var _0x1879=function(_0x13c109,_0x4b601c){_0x13c109=_0x13c109-0x0;var _0x1699ed=_0x8791[_0x13c109];return _0x1699ed;};'use strict';var _=require(_0x1879('0x0'));var util=require('util');var logger=require(_0x1879('0x1'))(_0x1879('0x2'));var moment=require(_0x1879('0x3'));var BPromise=require(_0x1879('0x4'));var rp=require(_0x1879('0x5'));var attributes=require('./intVtigerField.attributes');module['exports']=function(_0x5d787c,_0x193050){return _0x5d787c[_0x1879('0x6')](_0x1879('0x7'),attributes,{'tableName':_0x1879('0x8'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x1879('0x9'),_0x1879('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index df54d68..624d788 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 _0xda8e=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x13eb6e,_0x26a297){var _0x2ef449=function(_0x5767a7){while(--_0x5767a7){_0x13eb6e['push'](_0x13eb6e['shift']());}};_0x2ef449(++_0x26a297);}(_0xda8e,0x174));var _0xeda8=function(_0x3d27a,_0x31311d){_0x3d27a=_0x3d27a-0x0;var _0x314fd7=_0xda8e[_0x3d27a];return _0x314fd7;};'use strict';var _=require(_0xeda8('0x0'));var util=require(_0xeda8('0x1'));var moment=require(_0xeda8('0x2'));var BPromise=require('bluebird');var rs=require(_0xeda8('0x3'));var fs=require('fs');var Redis=require(_0xeda8('0x4'));var db=require(_0xeda8('0x5'))['db'];var utils=require(_0xeda8('0x6'));var logger=require(_0xeda8('0x7'))(_0xeda8('0x8'));var config=require('../../config/environment');var jayson=require(_0xeda8('0x9'));var client=jayson[_0xeda8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c9a3e,_0x2c354,_0x148afc){return new BPromise(function(_0x910270,_0x24d7ae){return client[_0xeda8('0xb')](_0x2c9a3e,_0x148afc)['then'](function(_0x3ffa8a){logger[_0xeda8('0xc')](_0xeda8('0xd'),_0x2c354,_0xeda8('0xe'));logger['debug'](_0xeda8('0xf'),_0x2c354,_0xeda8('0xe'),JSON[_0xeda8('0x10')](_0x3ffa8a));if(_0x3ffa8a[_0xeda8('0x11')]){if(_0x3ffa8a['error'][_0xeda8('0x12')]===0x1f4){logger[_0xeda8('0x11')](_0xeda8('0xd'),_0x2c354,_0x3ffa8a['error']['message']);return _0x24d7ae(_0x3ffa8a[_0xeda8('0x11')]['message']);}logger['error'](_0xeda8('0xd'),_0x2c354,_0x3ffa8a['error']['message']);return _0x910270(_0x3ffa8a[_0xeda8('0x11')][_0xeda8('0x13')]);}else{logger['info'](_0xeda8('0xd'),_0x2c354,_0xeda8('0xe'));_0x910270(_0x3ffa8a[_0xeda8('0x14')][_0xeda8('0x13')]);}})[_0xeda8('0x15')](function(_0x5d6fc4){logger[_0xeda8('0x11')]('VtigerField,\x20%s,\x20%s',_0x2c354,_0x5d6fc4);_0x24d7ae(_0x5d6fc4);});});} \ No newline at end of file +var _0x9ce8=['rpc','../../config/environment','jayson/promise','client','http','info','VtigerField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x451344,_0x326a16){var _0x57aa17=function(_0x12f885){while(--_0x12f885){_0x451344['push'](_0x451344['shift']());}};_0x57aa17(++_0x326a16);}(_0x9ce8,0xf5));var _0x89ce=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0x9ce8[_0x581af1];return _0x54c22e;};'use strict';var _=require(_0x89ce('0x0'));var util=require(_0x89ce('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x89ce('0x2'));var fs=require('fs');var Redis=require(_0x89ce('0x3'));var db=require(_0x89ce('0x4'))['db'];var utils=require(_0x89ce('0x5'));var logger=require(_0x89ce('0x6'))(_0x89ce('0x7'));var config=require(_0x89ce('0x8'));var jayson=require(_0x89ce('0x9'));var client=jayson[_0x89ce('0xa')][_0x89ce('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4dff16,_0x964b2b,_0x5b62ef){return new BPromise(function(_0x3ebf11,_0x2a53c9){return client['request'](_0x4dff16,_0x5b62ef)['then'](function(_0x4dcdf2){logger[_0x89ce('0xc')](_0x89ce('0xd'),_0x964b2b,_0x89ce('0xe'));logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x964b2b,_0x89ce('0xe'),JSON[_0x89ce('0xf')](_0x4dcdf2));if(_0x4dcdf2[_0x89ce('0x10')]){if(_0x4dcdf2[_0x89ce('0x10')][_0x89ce('0x11')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x964b2b,_0x4dcdf2[_0x89ce('0x10')][_0x89ce('0x12')]);return _0x2a53c9(_0x4dcdf2['error'][_0x89ce('0x12')]);}logger[_0x89ce('0x10')](_0x89ce('0xd'),_0x964b2b,_0x4dcdf2[_0x89ce('0x10')]['message']);return _0x3ebf11(_0x4dcdf2[_0x89ce('0x10')][_0x89ce('0x12')]);}else{logger[_0x89ce('0xc')](_0x89ce('0xd'),_0x964b2b,_0x89ce('0xe'));_0x3ebf11(_0x4dcdf2[_0x89ce('0x13')]['message']);}})[_0x89ce('0x14')](function(_0x32266f){logger[_0x89ce('0x10')](_0x89ce('0xd'),_0x964b2b,_0x32266f);_0x2a53c9(_0x32266f);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 511b0f5..cf26207 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 _0xe52b=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0xe52b,0xca));var _0xbe52=function(_0x432ccd,_0x51dbdc){_0x432ccd=_0x432ccd-0x0;var _0x4c56c6=_0xe52b[_0x432ccd];return _0x4c56c6;};'use strict';var multer=require(_0xbe52('0x0'));var util=require('util');var path=require(_0xbe52('0x1'));var timeout=require(_0xbe52('0x2'));var express=require(_0xbe52('0x3'));var router=express[_0xbe52('0x4')]();var auth=require(_0xbe52('0x5'));var interaction=require(_0xbe52('0x6'));var config=require(_0xbe52('0x7'));var controller=require('./intZendeskAccount.controller');router[_0xbe52('0x8')]('/',auth[_0xbe52('0x9')](),controller[_0xbe52('0xa')]);router['get']('/:id',auth[_0xbe52('0x9')](),controller['show']);router[_0xbe52('0x8')](_0xbe52('0xb'),auth[_0xbe52('0x9')](),controller[_0xbe52('0xc')]);router[_0xbe52('0x8')]('/:id/fields',auth[_0xbe52('0x9')](),controller[_0xbe52('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbe52('0xe')]);router[_0xbe52('0xf')](_0xbe52('0xb'),auth[_0xbe52('0x9')](),controller[_0xbe52('0x10')]);router[_0xbe52('0x11')]('/:id',auth[_0xbe52('0x9')](),controller[_0xbe52('0x12')]);router[_0xbe52('0x13')](_0xbe52('0x14'),auth['isAuthenticated'](),controller[_0xbe52('0x15')]);module[_0xbe52('0x16')]=router; \ No newline at end of file +var _0x42d5=['./intZendeskAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','update','delete','exports','multer','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x50aaac,_0x22bc34){var _0x485fce=function(_0x2c5446){while(--_0x2c5446){_0x50aaac['push'](_0x50aaac['shift']());}};_0x485fce(++_0x22bc34);}(_0x42d5,0x151));var _0x542d=function(_0x597d73,_0x2c587e){_0x597d73=_0x597d73-0x0;var _0x83b542=_0x42d5[_0x597d73];return _0x83b542;};'use strict';var multer=require(_0x542d('0x0'));var util=require('util');var path=require(_0x542d('0x1'));var timeout=require(_0x542d('0x2'));var express=require('express');var router=express[_0x542d('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x542d('0x4'));var config=require('../../config/environment');var controller=require(_0x542d('0x5'));router[_0x542d('0x6')]('/',auth[_0x542d('0x7')](),controller[_0x542d('0x8')]);router[_0x542d('0x6')](_0x542d('0x9'),auth[_0x542d('0x7')](),controller['show']);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x542d('0xa')]);router['get'](_0x542d('0xb'),auth[_0x542d('0x7')](),controller[_0x542d('0xc')]);router[_0x542d('0xd')]('/',auth[_0x542d('0x7')](),controller['create']);router[_0x542d('0xd')](_0x542d('0xe'),auth[_0x542d('0x7')](),controller[_0x542d('0xf')]);router['put'](_0x542d('0x9'),auth[_0x542d('0x7')](),controller[_0x542d('0x10')]);router[_0x542d('0x11')](_0x542d('0x9'),auth[_0x542d('0x7')](),controller['destroy']);module[_0x542d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index f050a1b..0708cd0 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 _0x69e0=['integrationTab','sequelize','STRING','username','remoteUri','password','ENUM','newTab'];(function(_0x49a1a0,_0x48f776){var _0x518a4f=function(_0x313633){while(--_0x313633){_0x49a1a0['push'](_0x49a1a0['shift']());}};_0x518a4f(++_0x48f776);}(_0x69e0,0x71));var _0x069e=function(_0x16b0d1,_0x366513){_0x16b0d1=_0x16b0d1-0x0;var _0xcd67eb=_0x69e0[_0x16b0d1];return _0xcd67eb;};'use strict';var Sequelize=require(_0x069e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x069e('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x069e('0x2')},'password':{'type':Sequelize[_0x069e('0x1')]},'token':{'type':Sequelize[_0x069e('0x1')]},'remoteUri':{'type':Sequelize[_0x069e('0x1')],'unique':_0x069e('0x3')},'authType':{'type':Sequelize['ENUM'](_0x069e('0x4'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x069e('0x1')]},'type':{'type':Sequelize[_0x069e('0x5')]('integrationTab',_0x069e('0x6')),'defaultValue':_0x069e('0x7')}}; \ No newline at end of file +var _0xb95a=['sequelize','exports','STRING','username','remoteUri','ENUM','password','newTab','integrationTab'];(function(_0x4cee4b,_0x1dfff3){var _0x4d891d=function(_0x3722ba){while(--_0x3722ba){_0x4cee4b['push'](_0x4cee4b['shift']());}};_0x4d891d(++_0x1dfff3);}(_0xb95a,0x13b));var _0xab95=function(_0x30b12a,_0x210059){_0x30b12a=_0x30b12a-0x0;var _0x41ffec=_0xb95a[_0x30b12a];return _0x41ffec;};'use strict';var Sequelize=require(_0xab95('0x0'));module[_0xab95('0x1')]={'name':{'type':Sequelize[_0xab95('0x2')]},'description':{'type':Sequelize[_0xab95('0x2')]},'username':{'type':Sequelize[_0xab95('0x2')],'unique':_0xab95('0x3')},'password':{'type':Sequelize[_0xab95('0x2')]},'token':{'type':Sequelize[_0xab95('0x2')]},'remoteUri':{'type':Sequelize[_0xab95('0x2')],'unique':_0xab95('0x4')},'authType':{'type':Sequelize[_0xab95('0x5')](_0xab95('0x6'),'token'),'defaultValue':_0xab95('0x6')},'serverUrl':{'type':Sequelize[_0xab95('0x2')]},'type':{'type':Sequelize[_0xab95('0x5')]('integrationTab',_0xab95('0x7')),'defaultValue':_0xab95('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 777459b..a5af9d4 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 _0x76d0=['fields','hasOwnProperty','nolimit','sort','pick','filter','where','map','type','VIRTUAL','field','includeAll','rows','catch','params','length','include','options','find','create','body','update','getConfigurations','findOne','ZendeskConfiguration','order','merge','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','ZendeskField','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','base64','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','group','remove','includes','position','system_field_options','custom_field_options','test','getFields','statusCode','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','count','offset','limit','set','save','destroy','sendStatus','name','send','index','ZendeskAccount','rawAttributes','model','keys','query','filters','intersection','attributes'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x76d0,0x132));var _0x076d=function(_0x146de9,_0x2cd6ab){_0x146de9=_0x146de9-0x0;var _0x5f36fe=_0x76d0[_0x146de9];return _0x5f36fe;};'use strict';var pdf=require(_0x076d('0x0'));var emlformat=require(_0x076d('0x1'));var rimraf=require(_0x076d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x076d('0x3'));var moment=require(_0x076d('0x4'));var BPromise=require(_0x076d('0x5'));var Mustache=require(_0x076d('0x6'));var util=require(_0x076d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x076d('0x8'));var ejs=require(_0x076d('0x9'));var fs=require('fs');var _=require(_0x076d('0xa'));var squel=require(_0x076d('0xb'));var crypto=require(_0x076d('0xc'));var jsforce=require(_0x076d('0xd'));var deskjs=require(_0x076d('0xe'));var toCsv=require(_0x076d('0x8'));var querystring=require(_0x076d('0xf'));var Papa=require(_0x076d('0x10'));var authService=require(_0x076d('0x11'));var hardwareService=require(_0x076d('0x12'));var Redis=require(_0x076d('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0x076d('0x14'))(_0x076d('0x15'));var utils=require(_0x076d('0x16'));var config=require(_0x076d('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x076d('0x18'));var jayson=require(_0x076d('0x19'));var client=jayson[_0x076d('0x1a')][_0x076d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x560d46,_0x5a560c,_0x196187,_0x1ab514){return new BPromise(function(_0x31e6aa,_0x1f5bf6){var _0x13e812=_0x1ab514||client;return _0x13e812[_0x076d('0x1c')](_0x560d46,_0x196187)[_0x076d('0x1d')](function(_0x5e52c3){logger['info'](_0x076d('0x1e'),_0x5a560c,_0x076d('0x1f'));logger[_0x076d('0x20')](_0x076d('0x21'),_0x5a560c,_0x076d('0x1f'),JSON[_0x076d('0x22')](_0x5e52c3));if(_0x5e52c3[_0x076d('0x23')]){if(_0x5e52c3[_0x076d('0x23')][_0x076d('0x24')]===0x1f4){logger[_0x076d('0x23')]('ZendeskAccount,\x20%s,\x20%s',_0x5a560c,_0x5e52c3[_0x076d('0x23')][_0x076d('0x25')]);return _0x1f5bf6(_0x5e52c3[_0x076d('0x23')][_0x076d('0x25')]);}logger[_0x076d('0x23')]('ZendeskAccount,\x20%s,\x20%s',_0x5a560c,_0x5e52c3['error'][_0x076d('0x25')]);return _0x31e6aa(_0x5e52c3[_0x076d('0x23')][_0x076d('0x25')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x5a560c,_0x076d('0x1f'));_0x31e6aa(_0x5e52c3[_0x076d('0x26')][_0x076d('0x25')]);}})['catch'](function(_0x1d8c13){logger[_0x076d('0x23')](_0x076d('0x1e'),_0x5a560c,_0x1d8c13);_0x1f5bf6(_0x1d8c13);});});}function respondWithStatusCode(_0xe8d738,_0x43f5ca){_0x43f5ca=_0x43f5ca||0xcc;return function(_0x49f63f){if(_0x49f63f){return _0xe8d738['sendStatus'](_0x43f5ca);}return _0xe8d738[_0x076d('0x27')](_0x43f5ca)[_0x076d('0x28')]();};}function respondWithResult(_0x47f290,_0x22d1de){_0x22d1de=_0x22d1de||0xc8;return function(_0x2ba006){if(_0x2ba006){return _0x47f290['status'](_0x22d1de)[_0x076d('0x29')](_0x2ba006);}};}function respondWithFilteredResult(_0x2472fe,_0x3caa8e){return function(_0x12ce25){if(_0x12ce25){var _0x57179d=_0x12ce25[_0x076d('0x2a')],_0x29a216=_0x3caa8e[_0x076d('0x2b')],_0x3cc993=_0x3caa8e[_0x076d('0x2b')]+_0x3caa8e[_0x076d('0x2c')],_0x45b937;if(_0x3cc993>=_0x57179d){_0x3cc993=_0x57179d;_0x45b937=0xc8;}else{_0x45b937=0xce;}_0x2472fe['status'](_0x45b937);return _0x2472fe[_0x076d('0x2d')]('Content-Range',_0x29a216+'-'+_0x3cc993+'/'+_0x57179d)[_0x076d('0x29')](_0x12ce25);}return null;};}function patchUpdates(_0x1b0a3f){return function(_0x313073){try{jsonpatch['apply'](_0x313073,_0x1b0a3f,!![]);}catch(_0x469dce){return BPromise['reject'](_0x469dce);}return _0x313073[_0x076d('0x2e')]();};}function saveUpdates(_0x2e8a7c,_0x3cc2ff){return function(_0x2152eb){if(_0x2152eb){return _0x2152eb['update'](_0x2e8a7c)['then'](function(_0xee0f96){return _0xee0f96;});}return null;};}function removeEntity(_0x2d02bf,_0x1d14f6){return function(_0x5735b0){if(_0x5735b0){return _0x5735b0[_0x076d('0x2f')]()['then'](function(){_0x2d02bf['status'](0xcc)[_0x076d('0x28')]();});}};}function handleEntityNotFound(_0xe61531,_0x50839a){return function(_0xcbb9){if(!_0xcbb9){_0xe61531[_0x076d('0x30')](0x194);}return _0xcbb9;};}function handleError(_0x46fa89,_0x35b627){_0x35b627=_0x35b627||0x1f4;return function(_0x110b97){logger['error'](_0x110b97['stack']);if(_0x110b97[_0x076d('0x31')]){delete _0x110b97[_0x076d('0x31')];}_0x46fa89['status'](_0x35b627)[_0x076d('0x32')](_0x110b97);};}exports[_0x076d('0x33')]=function(_0x1cbf09,_0xff2b1d){var _0x5e1dc9={},_0x240a42={},_0x5207dc={'count':0x0,'rows':[]};var _0x365320=db[_0x076d('0x34')][_0x076d('0x35')];_0x240a42[_0x076d('0x36')]=_[_0x076d('0x37')](_0x365320);_0x240a42[_0x076d('0x38')]=_[_0x076d('0x37')](_0x1cbf09[_0x076d('0x38')]);_0x240a42[_0x076d('0x39')]=_[_0x076d('0x3a')](_0x240a42['model'],_0x240a42['query']);_0x5e1dc9[_0x076d('0x3b')]=_[_0x076d('0x3a')](_0x240a42[_0x076d('0x36')],qs[_0x076d('0x3c')](_0x1cbf09[_0x076d('0x38')][_0x076d('0x3c')]));_0x5e1dc9[_0x076d('0x3b')]=_0x5e1dc9[_0x076d('0x3b')]['length']?_0x5e1dc9[_0x076d('0x3b')]:_0x240a42['model'];if(!_0x1cbf09[_0x076d('0x38')][_0x076d('0x3d')](_0x076d('0x3e'))){_0x5e1dc9['limit']=qs[_0x076d('0x2c')](_0x1cbf09[_0x076d('0x38')][_0x076d('0x2c')]);_0x5e1dc9['offset']=qs[_0x076d('0x2b')](_0x1cbf09['query'][_0x076d('0x2b')]);}_0x5e1dc9['order']=qs[_0x076d('0x3f')](_0x1cbf09['query'][_0x076d('0x3f')]);_0x5e1dc9['where']=qs[_0x076d('0x39')](_[_0x076d('0x40')](_0x1cbf09['query'],_0x240a42['filters']));if(_0x1cbf09[_0x076d('0x38')][_0x076d('0x41')]){_0x5e1dc9[_0x076d('0x42')]=_['merge'](_0x5e1dc9[_0x076d('0x42')],{'$or':_[_0x076d('0x43')](_0x365320,function(_0x3d4828){if(_0x3d4828[_0x076d('0x44')]['key']!==_0x076d('0x45')){var _0x4f51fe={};_0x4f51fe[_0x3d4828[_0x076d('0x46')]]={'$like':'%'+_0x1cbf09[_0x076d('0x38')][_0x076d('0x41')]+'%'};return _0x4f51fe;}})});}_0x5e1dc9=_['merge']({},_0x5e1dc9,_0x1cbf09['options']);var _0x25525d={'where':_0x5e1dc9[_0x076d('0x42')]};return db['ZendeskAccount'][_0x076d('0x2a')](_0x25525d)['then'](function(_0xadc271){_0x5207dc[_0x076d('0x2a')]=_0xadc271;if(_0x1cbf09[_0x076d('0x38')][_0x076d('0x47')]){_0x5e1dc9['include']=[{'all':!![]}];}return db[_0x076d('0x34')]['findAll'](_0x5e1dc9);})[_0x076d('0x1d')](function(_0x310a5d){_0x5207dc[_0x076d('0x48')]=_0x310a5d;return _0x5207dc;})[_0x076d('0x1d')](respondWithFilteredResult(_0xff2b1d,_0x5e1dc9))[_0x076d('0x49')](handleError(_0xff2b1d,null));};exports['show']=function(_0x5910de,_0x58f955){var _0x4edd13={'raw':![],'where':{'id':_0x5910de[_0x076d('0x4a')]['id']}},_0x350554={};_0x350554[_0x076d('0x36')]=_['keys'](db[_0x076d('0x34')][_0x076d('0x35')]);_0x350554[_0x076d('0x38')]=_['keys'](_0x5910de[_0x076d('0x38')]);_0x350554['filters']=_[_0x076d('0x3a')](_0x350554[_0x076d('0x36')],_0x350554[_0x076d('0x38')]);_0x4edd13[_0x076d('0x3b')]=_['intersection'](_0x350554[_0x076d('0x36')],qs[_0x076d('0x3c')](_0x5910de[_0x076d('0x38')]['fields']));_0x4edd13[_0x076d('0x3b')]=_0x4edd13[_0x076d('0x3b')][_0x076d('0x4b')]?_0x4edd13[_0x076d('0x3b')]:_0x350554['model'];if(_0x5910de[_0x076d('0x38')][_0x076d('0x47')]){_0x4edd13[_0x076d('0x4c')]=[{'all':!![]}];}_0x4edd13=_['merge']({},_0x4edd13,_0x5910de[_0x076d('0x4d')]);return db[_0x076d('0x34')][_0x076d('0x4e')](_0x4edd13)[_0x076d('0x1d')](handleEntityNotFound(_0x58f955,null))[_0x076d('0x1d')](respondWithResult(_0x58f955,null))[_0x076d('0x49')](handleError(_0x58f955,null));};exports[_0x076d('0x4f')]=function(_0x484faf,_0x4e6f2d){return db[_0x076d('0x34')][_0x076d('0x4f')](_0x484faf[_0x076d('0x50')],{})[_0x076d('0x1d')](respondWithResult(_0x4e6f2d,0xc9))[_0x076d('0x49')](handleError(_0x4e6f2d,null));};exports[_0x076d('0x51')]=function(_0x33ecd3,_0x3b187d){if(_0x33ecd3[_0x076d('0x50')]['id']){delete _0x33ecd3[_0x076d('0x50')]['id'];}return db[_0x076d('0x34')]['find']({'where':{'id':_0x33ecd3[_0x076d('0x4a')]['id']}})[_0x076d('0x1d')](handleEntityNotFound(_0x3b187d,null))[_0x076d('0x1d')](saveUpdates(_0x33ecd3[_0x076d('0x50')],null))['then'](respondWithResult(_0x3b187d,null))[_0x076d('0x49')](handleError(_0x3b187d,null));};exports[_0x076d('0x2f')]=function(_0x50877a,_0x3b526e){return db[_0x076d('0x34')][_0x076d('0x4e')]({'where':{'id':_0x50877a[_0x076d('0x4a')]['id']}})[_0x076d('0x1d')](handleEntityNotFound(_0x3b526e,null))[_0x076d('0x1d')](removeEntity(_0x3b526e,null))['catch'](handleError(_0x3b526e,null));};exports[_0x076d('0x52')]=function(_0x5e3eac,_0x19b998,_0x44ca71){var _0x5ca2a8={};var _0x13e2e0={};var _0x4abe1f;var _0x58a7de;return db[_0x076d('0x34')][_0x076d('0x53')]({'where':{'id':_0x5e3eac[_0x076d('0x4a')]['id']}})[_0x076d('0x1d')](handleEntityNotFound(_0x19b998,null))[_0x076d('0x1d')](function(_0xd3414d){if(_0xd3414d){_0x4abe1f=_0xd3414d;_0x13e2e0[_0x076d('0x36')]=_['keys'](db[_0x076d('0x54')][_0x076d('0x35')]);_0x13e2e0[_0x076d('0x38')]=_[_0x076d('0x37')](_0x5e3eac[_0x076d('0x38')]);_0x13e2e0[_0x076d('0x39')]=_[_0x076d('0x3a')](_0x13e2e0[_0x076d('0x36')],_0x13e2e0[_0x076d('0x38')]);_0x5ca2a8[_0x076d('0x3b')]=_['intersection'](_0x13e2e0[_0x076d('0x36')],qs[_0x076d('0x3c')](_0x5e3eac[_0x076d('0x38')][_0x076d('0x3c')]));_0x5ca2a8['attributes']=_0x5ca2a8[_0x076d('0x3b')]['length']?_0x5ca2a8['attributes']:_0x13e2e0['model'];_0x5ca2a8[_0x076d('0x55')]=qs[_0x076d('0x3f')](_0x5e3eac[_0x076d('0x38')][_0x076d('0x3f')]);_0x5ca2a8['where']=qs[_0x076d('0x39')](_['pick'](_0x5e3eac[_0x076d('0x38')],_0x13e2e0[_0x076d('0x39')]));if(_0x5e3eac[_0x076d('0x38')][_0x076d('0x41')]){_0x5ca2a8[_0x076d('0x42')]=_['merge'](_0x5ca2a8[_0x076d('0x42')],{'$or':_[_0x076d('0x43')](_0x5ca2a8[_0x076d('0x3b')],function(_0x3a2bdf){var _0x4082cf={};_0x4082cf[_0x3a2bdf]={'$like':'%'+_0x5e3eac['query'][_0x076d('0x41')]+'%'};return _0x4082cf;})});}_0x5ca2a8=_[_0x076d('0x56')]({},_0x5ca2a8,_0x5e3eac[_0x076d('0x4d')]);return _0x4abe1f['getConfigurations'](_0x5ca2a8);}})['then'](function(_0x2280e3){if(_0x2280e3){_0x58a7de=_0x2280e3[_0x076d('0x4b')];if(!_0x5e3eac['query'][_0x076d('0x3d')](_0x076d('0x3e'))){_0x5ca2a8[_0x076d('0x2c')]=qs['limit'](_0x5e3eac[_0x076d('0x38')]['limit']);_0x5ca2a8[_0x076d('0x2b')]=qs['offset'](_0x5e3eac['query'][_0x076d('0x2b')]);}return _0x4abe1f[_0x076d('0x52')](_0x5ca2a8);}})['then'](function(_0x3df2e0){if(_0x3df2e0){return _0x3df2e0?{'count':_0x58a7de,'rows':_0x3df2e0}:null;}})[_0x076d('0x1d')](respondWithResult(_0x19b998,null))['catch'](handleError(_0x19b998,null));};exports[_0x076d('0x57')]=function(_0xc1ece0,_0x521089,_0x49f7f5){if(_0xc1ece0[_0x076d('0x50')]['id']){delete _0xc1ece0[_0x076d('0x50')]['id'];}return db[_0x076d('0x34')][_0x076d('0x53')]({'where':{'id':_0xc1ece0[_0x076d('0x4a')]['id']}})[_0x076d('0x1d')](handleEntityNotFound(_0x521089,null))[_0x076d('0x1d')](function(_0x3e39c8){if(_0x3e39c8){_0xc1ece0[_0x076d('0x50')][_0x076d('0x58')]=_0x3e39c8['id'];_0xc1ece0[_0x076d('0x50')][_0x076d('0x59')]=integrations[_0x076d('0x5a')](_0xc1ece0['body']['channel'],_0xc1ece0[_0x076d('0x50')][_0x076d('0x44')]);_0xc1ece0['body'][_0x076d('0x5b')]=integrations[_0x076d('0x5c')](_0xc1ece0[_0x076d('0x50')]['channel'],_0xc1ece0['body'][_0x076d('0x44')]);return db['ZendeskConfiguration'][_0x076d('0x4f')](_0xc1ece0[_0x076d('0x50')],{'include':[{'model':db[_0x076d('0x5d')],'as':'Subjects'},{'model':db[_0x076d('0x5d')],'as':_0x076d('0x5b')}]});}return null;})[_0x076d('0x1d')](respondWithResult(_0x521089,null))[_0x076d('0x49')](handleError(_0x521089,null));};exports['getFields']=function(_0x10a18a,_0x5af7de,_0x32f486){var _0x224c6c='';return db['ZendeskAccount'][_0x076d('0x53')]({'where':{'id':_0x10a18a[_0x076d('0x4a')]['id']},'attributes':['id',_0x076d('0x5e'),_0x076d('0x5f'),_0x076d('0x60'),_0x076d('0x61'),_0x076d('0x62')]})[_0x076d('0x1d')](handleEntityNotFound(_0x5af7de,null))['then'](function(_0x43bea3){if(_0x43bea3){_0x224c6c=_0x43bea3[_0x076d('0x62')];var _0x2a0421=_0x224c6c[_0x076d('0x63')](-0x1);if(_0x2a0421==='/'){_0x224c6c=_0x224c6c[_0x076d('0x64')](0x0,_0x224c6c[_0x076d('0x65')](_0x2a0421));}var _0x345af3={'method':_0x076d('0x66'),'uri':util[_0x076d('0x67')](_0x076d('0x68'),_0x224c6c,_0x076d('0x69')),'json':!![]};switch(_0x43bea3[_0x076d('0x61')]){case _0x076d('0x5f'):_0x345af3[_0x076d('0x6a')]={'Authorization':util[_0x076d('0x67')](_0x076d('0x6b'),new Buffer(util[_0x076d('0x67')]('%s:%s',_0x43bea3[_0x076d('0x5e')],_0x43bea3['password']))['toString'](_0x076d('0x6c')))};break;case'token':_0x345af3[_0x076d('0x6a')]={'Authorization':util[_0x076d('0x67')](_0x076d('0x6b'),new Buffer(util[_0x076d('0x67')]('%s/token:%s',_0x43bea3[_0x076d('0x5e')],_0x43bea3[_0x076d('0x60')]))[_0x076d('0x6d')]('base64'))};break;default:throw new db[(_0x076d('0x6e'))][(_0x076d('0x6f'))](_0x076d('0x70'));}return rp(_0x345af3);}})[_0x076d('0x1d')](function(_0x25e3d3){if(_0x25e3d3){var _0x27ed1f=['subject','description',_0x076d('0x71'),'assignee'];_[_0x076d('0x72')](_0x25e3d3[_0x076d('0x69')],function(_0x1d9af1){return _0x27ed1f[_0x076d('0x73')](_0x1d9af1[_0x076d('0x44')]);});return{'count':_0x25e3d3[_0x076d('0x69')][_0x076d('0x4b')],'rows':_[_0x076d('0x43')](_0x25e3d3[_0x076d('0x69')],function(_0x41c62a){return{'id':_0x41c62a['id'],'name':_0x41c62a[_0x076d('0x74')]>0x7?_0x41c62a['title']:_0x41c62a[_0x076d('0x44')],'custom':_0x41c62a[_0x076d('0x74')]>0x7?!![]:![],'options':_0x41c62a[_0x076d('0x75')]?_0x41c62a['system_field_options']:_0x41c62a[_0x076d('0x76')]?_0x41c62a[_0x076d('0x76')]:[]};})};}})[_0x076d('0x1d')](respondWithResult(_0x5af7de,null))[_0x076d('0x49')](function(_0x2b8613){var _0x2e5e18=_0x10a18a[_0x076d('0x38')][_0x076d('0x77')]?0x1f4:_0x2b8613['statusCode']||0x1f4;logger[_0x076d('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0x076d('0x78'),_0x2e5e18,JSON[_0x076d('0x22')](_0x2b8613));delete _0x2b8613['name'];if(_0x2e5e18===0x191){_0x2e5e18=0x190;}_0x5af7de[_0x076d('0x27')](_0x2e5e18)[_0x076d('0x32')](_0x10a18a['query'][_0x076d('0x77')]?{'message':'Wrong\x20credentials','statusCode':_0x2b8613[_0x076d('0x79')]}:_0x2b8613);});}; \ No newline at end of file +var _0x666b=['assignee','remove','position','title','system_field_options','custom_field_options','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','destroy','name','send','index','ZendeskAccount','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','pick','where','merge','type','key','field','include','findAll','rows','show','params','includeAll','options','find','create','body','getConfigurations','findOne','ZendeskConfiguration','sort','filter','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','authType','remoteUri','substring','lastIndexOf','GET','format','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','token','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','description','group'];(function(_0x10735a,_0x47f992){var _0x22bcfc=function(_0x4e25aa){while(--_0x4e25aa){_0x10735a['push'](_0x10735a['shift']());}};_0x22bcfc(++_0x47f992);}(_0x666b,0x107));var _0xb666=function(_0x5cdb17,_0x315b05){_0x5cdb17=_0x5cdb17-0x0;var _0x3cfe36=_0x666b[_0x5cdb17];return _0x3cfe36;};'use strict';var pdf=require(_0xb666('0x0'));var emlformat=require(_0xb666('0x1'));var rimraf=require(_0xb666('0x2'));var zipdir=require(_0xb666('0x3'));var jsonpatch=require(_0xb666('0x4'));var rp=require(_0xb666('0x5'));var moment=require(_0xb666('0x6'));var BPromise=require(_0xb666('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb666('0x8'));var sox=require(_0xb666('0x9'));var csv=require(_0xb666('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb666('0xb'));var squel=require(_0xb666('0xc'));var crypto=require(_0xb666('0xd'));var jsforce=require(_0xb666('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb666('0xa'));var querystring=require('querystring');var Papa=require(_0xb666('0xf'));var authService=require('../../components/auth/service');var hardwareService=require(_0xb666('0x10'));var Redis=require(_0xb666('0x11'));var qs=require(_0xb666('0x12'));var logger=require(_0xb666('0x13'))(_0xb666('0x14'));var utils=require(_0xb666('0x15'));var config=require(_0xb666('0x16'));var db=require(_0xb666('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xb666('0x18'));var client=jayson[_0xb666('0x19')][_0xb666('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x36e542,_0x35b1aa,_0x3968c3,_0x2529da){return new BPromise(function(_0x9a0a63,_0x3e9a5d){var _0x5607c6=_0x2529da||client;return _0x5607c6[_0xb666('0x1b')](_0x36e542,_0x3968c3)[_0xb666('0x1c')](function(_0x2c1d17){logger[_0xb666('0x1d')](_0xb666('0x1e'),_0x35b1aa,_0xb666('0x1f'));logger[_0xb666('0x20')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x35b1aa,_0xb666('0x1f'),JSON[_0xb666('0x21')](_0x2c1d17));if(_0x2c1d17['error']){if(_0x2c1d17['error'][_0xb666('0x22')]===0x1f4){logger[_0xb666('0x23')](_0xb666('0x1e'),_0x35b1aa,_0x2c1d17['error'][_0xb666('0x24')]);return _0x3e9a5d(_0x2c1d17[_0xb666('0x23')][_0xb666('0x24')]);}logger[_0xb666('0x23')](_0xb666('0x1e'),_0x35b1aa,_0x2c1d17[_0xb666('0x23')][_0xb666('0x24')]);return _0x9a0a63(_0x2c1d17['error'][_0xb666('0x24')]);}else{logger['info'](_0xb666('0x1e'),_0x35b1aa,_0xb666('0x1f'));_0x9a0a63(_0x2c1d17['result'][_0xb666('0x24')]);}})[_0xb666('0x25')](function(_0xbf41c4){logger[_0xb666('0x23')](_0xb666('0x1e'),_0x35b1aa,_0xbf41c4);_0x3e9a5d(_0xbf41c4);});});}function respondWithStatusCode(_0x495a8d,_0x209a52){_0x209a52=_0x209a52||0xcc;return function(_0x2b2a43){if(_0x2b2a43){return _0x495a8d[_0xb666('0x26')](_0x209a52);}return _0x495a8d[_0xb666('0x27')](_0x209a52)[_0xb666('0x28')]();};}function respondWithResult(_0x2df123,_0x1c9e63){_0x1c9e63=_0x1c9e63||0xc8;return function(_0x4a3156){if(_0x4a3156){return _0x2df123[_0xb666('0x27')](_0x1c9e63)[_0xb666('0x29')](_0x4a3156);}};}function respondWithFilteredResult(_0x151986,_0x1670b4){return function(_0x540a29){if(_0x540a29){var _0x38070b=_0x540a29[_0xb666('0x2a')],_0x214791=_0x1670b4[_0xb666('0x2b')],_0x28abfc=_0x1670b4[_0xb666('0x2b')]+_0x1670b4['limit'],_0x566cec;if(_0x28abfc>=_0x38070b){_0x28abfc=_0x38070b;_0x566cec=0xc8;}else{_0x566cec=0xce;}_0x151986[_0xb666('0x27')](_0x566cec);return _0x151986[_0xb666('0x2c')]('Content-Range',_0x214791+'-'+_0x28abfc+'/'+_0x38070b)[_0xb666('0x29')](_0x540a29);}return null;};}function patchUpdates(_0x966f69){return function(_0x13693a){try{jsonpatch[_0xb666('0x2d')](_0x13693a,_0x966f69,!![]);}catch(_0x249e9a){return BPromise[_0xb666('0x2e')](_0x249e9a);}return _0x13693a[_0xb666('0x2f')]();};}function saveUpdates(_0x30e48a,_0x3b476a){return function(_0x55a6e1){if(_0x55a6e1){return _0x55a6e1[_0xb666('0x30')](_0x30e48a)[_0xb666('0x1c')](function(_0x148965){return _0x148965;});}return null;};}function removeEntity(_0x30c885,_0x2f9fc4){return function(_0x7a5678){if(_0x7a5678){return _0x7a5678[_0xb666('0x31')]()[_0xb666('0x1c')](function(){_0x30c885[_0xb666('0x27')](0xcc)[_0xb666('0x28')]();});}};}function handleEntityNotFound(_0x406c2f,_0x1a88aa){return function(_0x23e019){if(!_0x23e019){_0x406c2f[_0xb666('0x26')](0x194);}return _0x23e019;};}function handleError(_0x3d0540,_0x4f1932){_0x4f1932=_0x4f1932||0x1f4;return function(_0xdbb121){logger[_0xb666('0x23')](_0xdbb121['stack']);if(_0xdbb121[_0xb666('0x32')]){delete _0xdbb121[_0xb666('0x32')];}_0x3d0540[_0xb666('0x27')](_0x4f1932)[_0xb666('0x33')](_0xdbb121);};}exports[_0xb666('0x34')]=function(_0x58a5df,_0x4ee21f){var _0x4edddb={},_0x31583d={},_0x218e42={'count':0x0,'rows':[]};var _0x270cc9=db[_0xb666('0x35')][_0xb666('0x36')];_0x31583d[_0xb666('0x37')]=_[_0xb666('0x38')](_0x270cc9);_0x31583d[_0xb666('0x39')]=_['keys'](_0x58a5df[_0xb666('0x39')]);_0x31583d[_0xb666('0x3a')]=_[_0xb666('0x3b')](_0x31583d['model'],_0x31583d[_0xb666('0x39')]);_0x4edddb[_0xb666('0x3c')]=_[_0xb666('0x3b')](_0x31583d[_0xb666('0x37')],qs[_0xb666('0x3d')](_0x58a5df['query'][_0xb666('0x3d')]));_0x4edddb[_0xb666('0x3c')]=_0x4edddb[_0xb666('0x3c')][_0xb666('0x3e')]?_0x4edddb[_0xb666('0x3c')]:_0x31583d[_0xb666('0x37')];if(!_0x58a5df[_0xb666('0x39')]['hasOwnProperty'](_0xb666('0x3f'))){_0x4edddb[_0xb666('0x40')]=qs[_0xb666('0x40')](_0x58a5df[_0xb666('0x39')][_0xb666('0x40')]);_0x4edddb[_0xb666('0x2b')]=qs[_0xb666('0x2b')](_0x58a5df[_0xb666('0x39')]['offset']);}_0x4edddb[_0xb666('0x41')]=qs['sort'](_0x58a5df[_0xb666('0x39')]['sort']);_0x4edddb['where']=qs[_0xb666('0x3a')](_[_0xb666('0x42')](_0x58a5df[_0xb666('0x39')],_0x31583d[_0xb666('0x3a')]));if(_0x58a5df['query']['filter']){_0x4edddb[_0xb666('0x43')]=_[_0xb666('0x44')](_0x4edddb[_0xb666('0x43')],{'$or':_['map'](_0x270cc9,function(_0x4d024d){if(_0x4d024d[_0xb666('0x45')][_0xb666('0x46')]!=='VIRTUAL'){var _0x17892c={};_0x17892c[_0x4d024d[_0xb666('0x47')]]={'$like':'%'+_0x58a5df[_0xb666('0x39')]['filter']+'%'};return _0x17892c;}})});}_0x4edddb=_[_0xb666('0x44')]({},_0x4edddb,_0x58a5df['options']);var _0x232d67={'where':_0x4edddb[_0xb666('0x43')]};return db[_0xb666('0x35')][_0xb666('0x2a')](_0x232d67)['then'](function(_0x4eb1d1){_0x218e42['count']=_0x4eb1d1;if(_0x58a5df['query']['includeAll']){_0x4edddb[_0xb666('0x48')]=[{'all':!![]}];}return db[_0xb666('0x35')][_0xb666('0x49')](_0x4edddb);})[_0xb666('0x1c')](function(_0x3518da){_0x218e42[_0xb666('0x4a')]=_0x3518da;return _0x218e42;})[_0xb666('0x1c')](respondWithFilteredResult(_0x4ee21f,_0x4edddb))[_0xb666('0x25')](handleError(_0x4ee21f,null));};exports[_0xb666('0x4b')]=function(_0x2ef867,_0x3c62a7){var _0x1dbb1d={'raw':![],'where':{'id':_0x2ef867[_0xb666('0x4c')]['id']}},_0x30ff7c={};_0x30ff7c['model']=_['keys'](db['ZendeskAccount'][_0xb666('0x36')]);_0x30ff7c[_0xb666('0x39')]=_[_0xb666('0x38')](_0x2ef867[_0xb666('0x39')]);_0x30ff7c[_0xb666('0x3a')]=_['intersection'](_0x30ff7c[_0xb666('0x37')],_0x30ff7c[_0xb666('0x39')]);_0x1dbb1d[_0xb666('0x3c')]=_[_0xb666('0x3b')](_0x30ff7c[_0xb666('0x37')],qs[_0xb666('0x3d')](_0x2ef867[_0xb666('0x39')]['fields']));_0x1dbb1d['attributes']=_0x1dbb1d[_0xb666('0x3c')]['length']?_0x1dbb1d[_0xb666('0x3c')]:_0x30ff7c[_0xb666('0x37')];if(_0x2ef867[_0xb666('0x39')][_0xb666('0x4d')]){_0x1dbb1d[_0xb666('0x48')]=[{'all':!![]}];}_0x1dbb1d=_[_0xb666('0x44')]({},_0x1dbb1d,_0x2ef867[_0xb666('0x4e')]);return db[_0xb666('0x35')][_0xb666('0x4f')](_0x1dbb1d)[_0xb666('0x1c')](handleEntityNotFound(_0x3c62a7,null))[_0xb666('0x1c')](respondWithResult(_0x3c62a7,null))[_0xb666('0x25')](handleError(_0x3c62a7,null));};exports['create']=function(_0x56e4d8,_0x194fc0){return db[_0xb666('0x35')][_0xb666('0x50')](_0x56e4d8[_0xb666('0x51')],{})[_0xb666('0x1c')](respondWithResult(_0x194fc0,0xc9))[_0xb666('0x25')](handleError(_0x194fc0,null));};exports[_0xb666('0x30')]=function(_0x289475,_0x1fd160){if(_0x289475[_0xb666('0x51')]['id']){delete _0x289475[_0xb666('0x51')]['id'];}return db[_0xb666('0x35')][_0xb666('0x4f')]({'where':{'id':_0x289475[_0xb666('0x4c')]['id']}})[_0xb666('0x1c')](handleEntityNotFound(_0x1fd160,null))['then'](saveUpdates(_0x289475[_0xb666('0x51')],null))['then'](respondWithResult(_0x1fd160,null))[_0xb666('0x25')](handleError(_0x1fd160,null));};exports[_0xb666('0x31')]=function(_0x4f9c39,_0x5ba6e7){return db[_0xb666('0x35')][_0xb666('0x4f')]({'where':{'id':_0x4f9c39[_0xb666('0x4c')]['id']}})[_0xb666('0x1c')](handleEntityNotFound(_0x5ba6e7,null))[_0xb666('0x1c')](removeEntity(_0x5ba6e7,null))['catch'](handleError(_0x5ba6e7,null));};exports[_0xb666('0x52')]=function(_0x401ba4,_0x401f05,_0x5177fb){var _0x1a052c={};var _0x5d6e4d={};var _0x2a5d6e;var _0x4b31e0;return db[_0xb666('0x35')][_0xb666('0x53')]({'where':{'id':_0x401ba4[_0xb666('0x4c')]['id']}})[_0xb666('0x1c')](handleEntityNotFound(_0x401f05,null))[_0xb666('0x1c')](function(_0x45a5ae){if(_0x45a5ae){_0x2a5d6e=_0x45a5ae;_0x5d6e4d['model']=_[_0xb666('0x38')](db[_0xb666('0x54')][_0xb666('0x36')]);_0x5d6e4d['query']=_['keys'](_0x401ba4[_0xb666('0x39')]);_0x5d6e4d[_0xb666('0x3a')]=_[_0xb666('0x3b')](_0x5d6e4d[_0xb666('0x37')],_0x5d6e4d[_0xb666('0x39')]);_0x1a052c['attributes']=_['intersection'](_0x5d6e4d[_0xb666('0x37')],qs[_0xb666('0x3d')](_0x401ba4[_0xb666('0x39')][_0xb666('0x3d')]));_0x1a052c[_0xb666('0x3c')]=_0x1a052c[_0xb666('0x3c')][_0xb666('0x3e')]?_0x1a052c[_0xb666('0x3c')]:_0x5d6e4d[_0xb666('0x37')];_0x1a052c[_0xb666('0x41')]=qs[_0xb666('0x55')](_0x401ba4['query'][_0xb666('0x55')]);_0x1a052c[_0xb666('0x43')]=qs[_0xb666('0x3a')](_[_0xb666('0x42')](_0x401ba4[_0xb666('0x39')],_0x5d6e4d['filters']));if(_0x401ba4['query']['filter']){_0x1a052c['where']=_['merge'](_0x1a052c['where'],{'$or':_['map'](_0x1a052c[_0xb666('0x3c')],function(_0x2a2ccb){var _0x4357ff={};_0x4357ff[_0x2a2ccb]={'$like':'%'+_0x401ba4[_0xb666('0x39')][_0xb666('0x56')]+'%'};return _0x4357ff;})});}_0x1a052c=_['merge']({},_0x1a052c,_0x401ba4['options']);return _0x2a5d6e[_0xb666('0x52')](_0x1a052c);}})['then'](function(_0xa00b03){if(_0xa00b03){_0x4b31e0=_0xa00b03['length'];if(!_0x401ba4[_0xb666('0x39')][_0xb666('0x57')]('nolimit')){_0x1a052c[_0xb666('0x40')]=qs[_0xb666('0x40')](_0x401ba4[_0xb666('0x39')]['limit']);_0x1a052c[_0xb666('0x2b')]=qs[_0xb666('0x2b')](_0x401ba4[_0xb666('0x39')]['offset']);}return _0x2a5d6e['getConfigurations'](_0x1a052c);}})['then'](function(_0xbc7000){if(_0xbc7000){return _0xbc7000?{'count':_0x4b31e0,'rows':_0xbc7000}:null;}})[_0xb666('0x1c')](respondWithResult(_0x401f05,null))[_0xb666('0x25')](handleError(_0x401f05,null));};exports[_0xb666('0x58')]=function(_0x4b7629,_0x3925a7,_0x2e5f33){if(_0x4b7629['body']['id']){delete _0x4b7629[_0xb666('0x51')]['id'];}return db['ZendeskAccount'][_0xb666('0x53')]({'where':{'id':_0x4b7629[_0xb666('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3925a7,null))[_0xb666('0x1c')](function(_0x2952a2){if(_0x2952a2){_0x4b7629[_0xb666('0x51')][_0xb666('0x59')]=_0x2952a2['id'];_0x4b7629[_0xb666('0x51')][_0xb666('0x5a')]=integrations[_0xb666('0x5b')](_0x4b7629[_0xb666('0x51')][_0xb666('0x5c')],_0x4b7629['body'][_0xb666('0x45')]);_0x4b7629['body'][_0xb666('0x5d')]=integrations[_0xb666('0x5e')](_0x4b7629['body']['channel'],_0x4b7629[_0xb666('0x51')][_0xb666('0x45')]);return db[_0xb666('0x54')][_0xb666('0x50')](_0x4b7629['body'],{'include':[{'model':db[_0xb666('0x5f')],'as':_0xb666('0x5a')},{'model':db[_0xb666('0x5f')],'as':_0xb666('0x5d')}]});}return null;})[_0xb666('0x1c')](respondWithResult(_0x3925a7,null))[_0xb666('0x25')](handleError(_0x3925a7,null));};exports[_0xb666('0x60')]=function(_0x47b090,_0x29e9fc,_0x1af96d){var _0x51cddd='';return db[_0xb666('0x35')][_0xb666('0x53')]({'where':{'id':_0x47b090[_0xb666('0x4c')]['id']},'attributes':['id',_0xb666('0x61'),_0xb666('0x62'),'token',_0xb666('0x63'),_0xb666('0x64')]})[_0xb666('0x1c')](handleEntityNotFound(_0x29e9fc,null))['then'](function(_0x12063c){if(_0x12063c){_0x51cddd=_0x12063c[_0xb666('0x64')];var _0x33928c=_0x51cddd['slice'](-0x1);if(_0x33928c==='/'){_0x51cddd=_0x51cddd[_0xb666('0x65')](0x0,_0x51cddd[_0xb666('0x66')](_0x33928c));}var _0x575c30={'method':_0xb666('0x67'),'uri':util[_0xb666('0x68')]('%s/%s',_0x51cddd,_0xb666('0x69')),'json':!![]};switch(_0x12063c[_0xb666('0x63')]){case _0xb666('0x62'):_0x575c30[_0xb666('0x6a')]={'Authorization':util[_0xb666('0x68')](_0xb666('0x6b'),new Buffer(util[_0xb666('0x68')](_0xb666('0x6c'),_0x12063c[_0xb666('0x61')],_0x12063c['password']))[_0xb666('0x6d')](_0xb666('0x6e')))};break;case _0xb666('0x6f'):_0x575c30['headers']={'Authorization':util[_0xb666('0x68')](_0xb666('0x6b'),new Buffer(util[_0xb666('0x68')](_0xb666('0x70'),_0x12063c[_0xb666('0x61')],_0x12063c['token']))[_0xb666('0x6d')](_0xb666('0x6e')))};break;default:throw new db['Sequelize'][(_0xb666('0x71'))](_0xb666('0x72'));}return rp(_0x575c30);}})[_0xb666('0x1c')](function(_0x166a92){if(_0x166a92){var _0x48e0bd=[_0xb666('0x73'),_0xb666('0x74'),_0xb666('0x75'),_0xb666('0x76')];_[_0xb666('0x77')](_0x166a92[_0xb666('0x69')],function(_0x421d19){return _0x48e0bd['includes'](_0x421d19[_0xb666('0x45')]);});return{'count':_0x166a92['ticket_fields']['length'],'rows':_['map'](_0x166a92['ticket_fields'],function(_0x1ac0c5){return{'id':_0x1ac0c5['id'],'name':_0x1ac0c5[_0xb666('0x78')]>0x7?_0x1ac0c5[_0xb666('0x79')]:_0x1ac0c5[_0xb666('0x45')],'custom':_0x1ac0c5['position']>0x7?!![]:![],'options':_0x1ac0c5[_0xb666('0x7a')]?_0x1ac0c5[_0xb666('0x7a')]:_0x1ac0c5['custom_field_options']?_0x1ac0c5[_0xb666('0x7b')]:[]};})};}})[_0xb666('0x1c')](respondWithResult(_0x29e9fc,null))[_0xb666('0x25')](function(_0x45408e){var _0x7fde07=_0x47b090[_0xb666('0x39')][_0xb666('0x7c')]?0x1f4:_0x45408e[_0xb666('0x7d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x7fde07,JSON[_0xb666('0x21')](_0x45408e));delete _0x45408e[_0xb666('0x32')];if(_0x7fde07===0x191){_0x7fde07=0x190;}_0x29e9fc['status'](_0x7fde07)[_0xb666('0x33')](_0x47b090[_0xb666('0x39')]['test']?{'message':_0xb666('0x7e'),'statusCode':_0x45408e[_0xb666('0x7d')]}:_0x45408e);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index d88fceb..b806558 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 _0x979a=['define','ZendeskAccount','lodash','util','../../config/logger','api','bluebird','request-promise','./intZendeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x979a,0x18e));var _0xa979=function(_0x195c2c,_0x157ee4){_0x195c2c=_0x195c2c-0x0;var _0x35dbee=_0x979a[_0x195c2c];return _0x35dbee;};'use strict';var _=require(_0xa979('0x0'));var util=require(_0xa979('0x1'));var logger=require(_0xa979('0x2'))(_0xa979('0x3'));var moment=require('moment');var BPromise=require(_0xa979('0x4'));var rp=require(_0xa979('0x5'));var attributes=require(_0xa979('0x6'));var integrations=require(_0xa979('0x7'));module[_0xa979('0x8')]=function(_0x3f7d5a,_0x3e4050){return _0x3f7d5a[_0xa979('0x9')](_0xa979('0xa'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a01=['api','moment','bluebird','request-promise','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','lodash','util','../../config/logger'];(function(_0x17d713,_0x436655){var _0x5e2e09=function(_0x42fbf0){while(--_0x42fbf0){_0x17d713['push'](_0x17d713['shift']());}};_0x5e2e09(++_0x436655);}(_0x1a01,0x8d));var _0x11a0=function(_0x433f99,_0x555e71){_0x433f99=_0x433f99-0x0;var _0xce5fca=_0x1a01[_0x433f99];return _0xce5fca;};'use strict';var _=require(_0x11a0('0x0'));var util=require(_0x11a0('0x1'));var logger=require(_0x11a0('0x2'))(_0x11a0('0x3'));var moment=require(_0x11a0('0x4'));var BPromise=require(_0x11a0('0x5'));var rp=require(_0x11a0('0x6'));var attributes=require(_0x11a0('0x7'));var integrations=require(_0x11a0('0x8'));module[_0x11a0('0x9')]=function(_0x378cc8,_0x3e0a2b){return _0x378cc8[_0x11a0('0xa')](_0x11a0('0xb'),attributes,{'tableName':'int_zendesk_accounts','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 29e0904..228c531 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 _0x46cb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','findAll','options','raw','where','include','map','model','attributes','GetZendeskAccount','ShowZendeskAccount','ZendeskAccount','find','debug','bluebird','randomstring'];(function(_0x59dd8f,_0x28fc38){var _0x29fac0=function(_0x55bd81){while(--_0x55bd81){_0x59dd8f['push'](_0x59dd8f['shift']());}};_0x29fac0(++_0x28fc38);}(_0x46cb,0xd6));var _0xb46c=function(_0x42f270,_0x452dec){_0x42f270=_0x42f270-0x0;var _0x57bc5b=_0x46cb[_0x42f270];return _0x57bc5b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb46c('0x0'));var rs=require(_0xb46c('0x1'));var fs=require('fs');var Redis=require(_0xb46c('0x2'));var db=require(_0xb46c('0x3'))['db'];var utils=require(_0xb46c('0x4'));var logger=require(_0xb46c('0x5'))(_0xb46c('0x6'));var config=require(_0xb46c('0x7'));var jayson=require(_0xb46c('0x8'));var client=jayson[_0xb46c('0x9')][_0xb46c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4603b8,_0x2e138d,_0x2771fe){return new BPromise(function(_0x5dfe97,_0x1c58e2){return client[_0xb46c('0xb')](_0x4603b8,_0x2771fe)[_0xb46c('0xc')](function(_0x19a47e){logger[_0xb46c('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x2e138d,'request\x20sent');logger['debug'](_0xb46c('0xe'),_0x2e138d,_0xb46c('0xf'),JSON[_0xb46c('0x10')](_0x19a47e));if(_0x19a47e[_0xb46c('0x11')]){if(_0x19a47e[_0xb46c('0x11')][_0xb46c('0x12')]===0x1f4){logger['error'](_0xb46c('0x13'),_0x2e138d,_0x19a47e['error'][_0xb46c('0x14')]);return _0x1c58e2(_0x19a47e[_0xb46c('0x11')]['message']);}logger[_0xb46c('0x11')](_0xb46c('0x13'),_0x2e138d,_0x19a47e[_0xb46c('0x11')]['message']);return _0x5dfe97(_0x19a47e[_0xb46c('0x11')][_0xb46c('0x14')]);}else{logger['info'](_0xb46c('0x13'),_0x2e138d,_0xb46c('0xf'));_0x5dfe97(_0x19a47e[_0xb46c('0x15')][_0xb46c('0x14')]);}})[_0xb46c('0x16')](function(_0x41f6b4){logger[_0xb46c('0x11')](_0xb46c('0x13'),_0x2e138d,_0x41f6b4);_0x1c58e2(_0x41f6b4);});});}exports['GetZendeskAccount']=function(_0x148f1e){var _0x2fa1f6=this;return new Promise(function(_0x25cbda,_0x236d7b){return db['ZendeskAccount'][_0xb46c('0x17')]({'raw':_0x148f1e['options']?_0x148f1e[_0xb46c('0x18')][_0xb46c('0x19')]===undefined?!![]:![]:!![],'where':_0x148f1e[_0xb46c('0x18')]?_0x148f1e['options'][_0xb46c('0x1a')]||null:null,'attributes':_0x148f1e[_0xb46c('0x18')]?_0x148f1e['options']['attributes']||null:null,'limit':_0x148f1e[_0xb46c('0x18')]?_0x148f1e['options']['limit']||null:null,'include':_0x148f1e[_0xb46c('0x18')]?_0x148f1e[_0xb46c('0x18')][_0xb46c('0x1b')]?_[_0xb46c('0x1c')](_0x148f1e['options']['include'],function(_0x368094){return{'model':db[_0x368094[_0xb46c('0x1d')]],'as':_0x368094['as'],'attributes':_0x368094[_0xb46c('0x1e')],'include':_0x368094[_0xb46c('0x1b')]?_[_0xb46c('0x1c')](_0x368094[_0xb46c('0x1b')],function(_0x204c10){return{'model':db[_0x204c10[_0xb46c('0x1d')]],'as':_0x204c10['as'],'attributes':_0x204c10['attributes'],'include':_0x204c10[_0xb46c('0x1b')]?_[_0xb46c('0x1c')](_0x204c10[_0xb46c('0x1b')],function(_0x11821a){return{'model':db[_0x11821a[_0xb46c('0x1d')]],'as':_0x11821a['as'],'attributes':_0x11821a[_0xb46c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb46c('0xc')](function(_0x217c4f){logger['info']('GetZendeskAccount',_0x148f1e);logger['debug'](_0xb46c('0x1f'),_0x148f1e,JSON[_0xb46c('0x10')](_0x217c4f));_0x25cbda(_0x217c4f);})['catch'](function(_0x4270d2){logger['error']('GetZendeskAccount',_0x4270d2[_0xb46c('0x14')],_0x148f1e);_0x236d7b(_0x2fa1f6[_0xb46c('0x11')](0x1f4,_0x4270d2['message']));});});};exports[_0xb46c('0x20')]=function(_0xec763f){var _0x5badf3=this;return new Promise(function(_0x414eea,_0x50ccc0){return db[_0xb46c('0x21')][_0xb46c('0x22')]({'raw':_0xec763f[_0xb46c('0x18')]?_0xec763f['options']['raw']===undefined?!![]:![]:!![],'where':_0xec763f[_0xb46c('0x18')]?_0xec763f[_0xb46c('0x18')][_0xb46c('0x1a')]||null:null,'attributes':_0xec763f['options']?_0xec763f[_0xb46c('0x18')][_0xb46c('0x1e')]||null:null,'include':_0xec763f[_0xb46c('0x18')]?_0xec763f[_0xb46c('0x18')][_0xb46c('0x1b')]?_[_0xb46c('0x1c')](_0xec763f[_0xb46c('0x18')][_0xb46c('0x1b')],function(_0x4d837d){return{'model':db[_0x4d837d[_0xb46c('0x1d')]],'as':_0x4d837d['as'],'attributes':_0x4d837d[_0xb46c('0x1e')],'include':_0x4d837d[_0xb46c('0x1b')]?_[_0xb46c('0x1c')](_0x4d837d[_0xb46c('0x1b')],function(_0xc514b3){return{'model':db[_0xc514b3[_0xb46c('0x1d')]],'as':_0xc514b3['as'],'attributes':_0xc514b3['attributes'],'include':_0xc514b3[_0xb46c('0x1b')]?_[_0xb46c('0x1c')](_0xc514b3[_0xb46c('0x1b')],function(_0x5aa8d9){return{'model':db[_0x5aa8d9[_0xb46c('0x1d')]],'as':_0x5aa8d9['as'],'attributes':_0x5aa8d9['attributes']};}):[]};}):[]};}):[]:[]})[_0xb46c('0xc')](function(_0x291712){logger[_0xb46c('0xd')](_0xb46c('0x20'),_0xec763f);logger[_0xb46c('0x23')](_0xb46c('0x20'),_0xec763f,JSON[_0xb46c('0x10')](_0x291712));_0x414eea(_0x291712);})[_0xb46c('0x16')](function(_0xd5a868){logger[_0xb46c('0x11')]('ShowZendeskAccount',_0xd5a868[_0xb46c('0x14')],_0xec763f);_0x50ccc0(_0x5badf3[_0xb46c('0x11')](0x1f4,_0xd5a868[_0xb46c('0x14')]));});});}; \ No newline at end of file +var _0x004a=['include','map','model','GetZendeskAccount','ShowZendeskAccount','ZendeskAccount','find','raw','info','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','where','attributes','limit'];(function(_0x2e177d,_0x123144){var _0x4d139c=function(_0x13dfee){while(--_0x13dfee){_0x2e177d['push'](_0x2e177d['shift']());}};_0x4d139c(++_0x123144);}(_0x004a,0x7b));var _0xa004=function(_0x4ab78f,_0x1cbc7f){_0x4ab78f=_0x4ab78f-0x0;var _0x5f1de1=_0x004a[_0x4ab78f];return _0x5f1de1;};'use strict';var _=require(_0xa004('0x0'));var util=require('util');var moment=require(_0xa004('0x1'));var BPromise=require(_0xa004('0x2'));var rs=require(_0xa004('0x3'));var fs=require('fs');var Redis=require(_0xa004('0x4'));var db=require(_0xa004('0x5'))['db'];var utils=require(_0xa004('0x6'));var logger=require(_0xa004('0x7'))(_0xa004('0x8'));var config=require(_0xa004('0x9'));var jayson=require(_0xa004('0xa'));var client=jayson['client'][_0xa004('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b9d09,_0x2f129c,_0x2d6dae){return new BPromise(function(_0x5e7a23,_0x530a25){return client[_0xa004('0xc')](_0x5b9d09,_0x2d6dae)[_0xa004('0xd')](function(_0x1fb4a0){logger['info'](_0xa004('0xe'),_0x2f129c,_0xa004('0xf'));logger[_0xa004('0x10')](_0xa004('0x11'),_0x2f129c,'request\x20sent',JSON[_0xa004('0x12')](_0x1fb4a0));if(_0x1fb4a0['error']){if(_0x1fb4a0[_0xa004('0x13')][_0xa004('0x14')]===0x1f4){logger[_0xa004('0x13')](_0xa004('0xe'),_0x2f129c,_0x1fb4a0[_0xa004('0x13')][_0xa004('0x15')]);return _0x530a25(_0x1fb4a0[_0xa004('0x13')][_0xa004('0x15')]);}logger['error'](_0xa004('0xe'),_0x2f129c,_0x1fb4a0[_0xa004('0x13')][_0xa004('0x15')]);return _0x5e7a23(_0x1fb4a0[_0xa004('0x13')][_0xa004('0x15')]);}else{logger['info'](_0xa004('0xe'),_0x2f129c,_0xa004('0xf'));_0x5e7a23(_0x1fb4a0[_0xa004('0x16')]['message']);}})[_0xa004('0x17')](function(_0x269689){logger[_0xa004('0x13')](_0xa004('0xe'),_0x2f129c,_0x269689);_0x530a25(_0x269689);});});}exports['GetZendeskAccount']=function(_0x3bf813){var _0x3fe3dc=this;return new Promise(function(_0x252afa,_0x21a020){return db['ZendeskAccount'][_0xa004('0x18')]({'raw':_0x3bf813[_0xa004('0x19')]?_0x3bf813['options']['raw']===undefined?!![]:![]:!![],'where':_0x3bf813['options']?_0x3bf813[_0xa004('0x19')][_0xa004('0x1a')]||null:null,'attributes':_0x3bf813[_0xa004('0x19')]?_0x3bf813[_0xa004('0x19')][_0xa004('0x1b')]||null:null,'limit':_0x3bf813['options']?_0x3bf813[_0xa004('0x19')][_0xa004('0x1c')]||null:null,'include':_0x3bf813['options']?_0x3bf813[_0xa004('0x19')][_0xa004('0x1d')]?_[_0xa004('0x1e')](_0x3bf813[_0xa004('0x19')][_0xa004('0x1d')],function(_0x24ca01){return{'model':db[_0x24ca01[_0xa004('0x1f')]],'as':_0x24ca01['as'],'attributes':_0x24ca01[_0xa004('0x1b')],'include':_0x24ca01['include']?_[_0xa004('0x1e')](_0x24ca01[_0xa004('0x1d')],function(_0xe08a6d){return{'model':db[_0xe08a6d[_0xa004('0x1f')]],'as':_0xe08a6d['as'],'attributes':_0xe08a6d[_0xa004('0x1b')],'include':_0xe08a6d[_0xa004('0x1d')]?_[_0xa004('0x1e')](_0xe08a6d[_0xa004('0x1d')],function(_0x2ec1cb){return{'model':db[_0x2ec1cb['model']],'as':_0x2ec1cb['as'],'attributes':_0x2ec1cb[_0xa004('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21154f){logger['info'](_0xa004('0x20'),_0x3bf813);logger[_0xa004('0x10')](_0xa004('0x20'),_0x3bf813,JSON['stringify'](_0x21154f));_0x252afa(_0x21154f);})[_0xa004('0x17')](function(_0x49a981){logger[_0xa004('0x13')](_0xa004('0x20'),_0x49a981['message'],_0x3bf813);_0x21a020(_0x3fe3dc['error'](0x1f4,_0x49a981[_0xa004('0x15')]));});});};exports[_0xa004('0x21')]=function(_0x264b3d){var _0x17958c=this;return new Promise(function(_0x369f56,_0x2712b7){return db[_0xa004('0x22')][_0xa004('0x23')]({'raw':_0x264b3d['options']?_0x264b3d[_0xa004('0x19')][_0xa004('0x24')]===undefined?!![]:![]:!![],'where':_0x264b3d[_0xa004('0x19')]?_0x264b3d[_0xa004('0x19')]['where']||null:null,'attributes':_0x264b3d[_0xa004('0x19')]?_0x264b3d[_0xa004('0x19')][_0xa004('0x1b')]||null:null,'include':_0x264b3d[_0xa004('0x19')]?_0x264b3d[_0xa004('0x19')][_0xa004('0x1d')]?_[_0xa004('0x1e')](_0x264b3d[_0xa004('0x19')][_0xa004('0x1d')],function(_0x450714){return{'model':db[_0x450714[_0xa004('0x1f')]],'as':_0x450714['as'],'attributes':_0x450714['attributes'],'include':_0x450714[_0xa004('0x1d')]?_[_0xa004('0x1e')](_0x450714[_0xa004('0x1d')],function(_0xa98b4a){return{'model':db[_0xa98b4a[_0xa004('0x1f')]],'as':_0xa98b4a['as'],'attributes':_0xa98b4a['attributes'],'include':_0xa98b4a['include']?_[_0xa004('0x1e')](_0xa98b4a[_0xa004('0x1d')],function(_0x4729b4){return{'model':db[_0x4729b4[_0xa004('0x1f')]],'as':_0x4729b4['as'],'attributes':_0x4729b4[_0xa004('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa004('0xd')](function(_0x4bc8d5){logger[_0xa004('0x25')](_0xa004('0x21'),_0x264b3d);logger[_0xa004('0x10')](_0xa004('0x21'),_0x264b3d,JSON['stringify'](_0x4bc8d5));_0x369f56(_0x4bc8d5);})[_0xa004('0x17')](function(_0x4f4e6e){logger['error'](_0xa004('0x21'),_0x4f4e6e[_0xa004('0x15')],_0x264b3d);_0x2712b7(_0x17958c[_0xa004('0x13')](0x1f4,_0x4f4e6e[_0xa004('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 8507048..55397b3 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 _0xaaed=['getDescriptions','/:id/tags','post','create','setTags','put','/:id','delete','destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','./intZendeskConfiguration.controller','isAuthenticated','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x2ff631,_0x35dee9){var _0x4aaad7=function(_0x5c0ef8){while(--_0x5c0ef8){_0x2ff631['push'](_0x2ff631['shift']());}};_0x4aaad7(++_0x35dee9);}(_0xaaed,0xab));var _0xdaae=function(_0x14a9f1,_0x467bd6){_0x14a9f1=_0x14a9f1-0x0;var _0x2284cb=_0xaaed[_0x14a9f1];return _0x2284cb;};'use strict';var multer=require('multer');var util=require(_0xdaae('0x0'));var path=require('path');var timeout=require(_0xdaae('0x1'));var express=require(_0xdaae('0x2'));var router=express[_0xdaae('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xdaae('0x4'));var config=require('../../config/environment');var controller=require(_0xdaae('0x5'));router['get']('/',auth[_0xdaae('0x6')](),controller['index']);router[_0xdaae('0x7')]('/:id',auth[_0xdaae('0x6')](),controller['show']);router[_0xdaae('0x7')](_0xdaae('0x8'),auth[_0xdaae('0x6')](),controller[_0xdaae('0x9')]);router[_0xdaae('0x7')](_0xdaae('0xa'),auth[_0xdaae('0x6')](),controller[_0xdaae('0xb')]);router['get'](_0xdaae('0xc'),auth[_0xdaae('0x6')](),controller[_0xdaae('0xd')]);router['get'](_0xdaae('0xe'),auth[_0xdaae('0x6')](),controller['getTags']);router[_0xdaae('0xf')]('/',auth['isAuthenticated'](),controller[_0xdaae('0x10')]);router['post'](_0xdaae('0xe'),auth[_0xdaae('0x6')](),controller[_0xdaae('0x11')]);router[_0xdaae('0x12')](_0xdaae('0x13'),auth[_0xdaae('0x6')](),controller['update']);router[_0xdaae('0x14')]('/:id',auth[_0xdaae('0x6')](),controller[_0xdaae('0x15')]);module[_0xdaae('0x16')]=router; \ No newline at end of file +var _0x23e4=['/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','create','post','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x2be0c2,_0x17068c){var _0x2ac466=function(_0x5ae020){while(--_0x5ae020){_0x2be0c2['push'](_0x2be0c2['shift']());}};_0x2ac466(++_0x17068c);}(_0x23e4,0x16a));var _0x423e=function(_0x2f3200,_0x588a74){_0x2f3200=_0x2f3200-0x0;var _0x24e9dc=_0x23e4[_0x2f3200];return _0x24e9dc;};'use strict';var multer=require('multer');var util=require(_0x423e('0x0'));var path=require(_0x423e('0x1'));var timeout=require(_0x423e('0x2'));var express=require(_0x423e('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x423e('0x4'));var controller=require(_0x423e('0x5'));router[_0x423e('0x6')]('/',auth[_0x423e('0x7')](),controller[_0x423e('0x8')]);router[_0x423e('0x6')](_0x423e('0x9'),auth[_0x423e('0x7')](),controller[_0x423e('0xa')]);router[_0x423e('0x6')](_0x423e('0xb'),auth[_0x423e('0x7')](),controller[_0x423e('0xc')]);router['get'](_0x423e('0xd'),auth[_0x423e('0x7')](),controller[_0x423e('0xe')]);router[_0x423e('0x6')](_0x423e('0xf'),auth[_0x423e('0x7')](),controller['getDescriptions']);router[_0x423e('0x6')](_0x423e('0x10'),auth[_0x423e('0x7')](),controller['getTags']);router['post']('/',auth['isAuthenticated'](),controller[_0x423e('0x11')]);router[_0x423e('0x12')](_0x423e('0x10'),auth['isAuthenticated'](),controller[_0x423e('0x13')]);router[_0x423e('0x14')](_0x423e('0x9'),auth[_0x423e('0x7')](),controller[_0x423e('0x15')]);router[_0x423e('0x16')](_0x423e('0x9'),auth['isAuthenticated'](),controller[_0x423e('0x17')]);module[_0x423e('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 042fc0b..c2ebe0c 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 _0xc7f7=['exports','sequelize'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc7f7,0x187));var _0x7c7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7f7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7c7f('0x0'));module[_0x7c7f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc315=['exports','STRING'];(function(_0x586319,_0xf3ac9a){var _0x2127d2=function(_0x543805){while(--_0x543805){_0x586319['push'](_0x586319['shift']());}};_0x2127d2(++_0xf3ac9a);}(_0xc315,0xa8));var _0x5c31=function(_0x4a0b21,_0x1c8532){_0x4a0b21=_0x4a0b21-0x0;var _0x55e15b=_0xc315[_0x4a0b21];return _0x55e15b;};'use strict';var Sequelize=require('sequelize');module[_0x5c31('0x0')]={'name':{'type':Sequelize[_0x5c31('0x1')]},'description':{'type':Sequelize[_0x5c31('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 0f39cae..9b46147 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 _0xa70f=['key','VIRTUAL','field','merge','options','count','includeAll','include','rows','catch','show','find','create','body','params','getFields','ZendeskField','nolimit','getSubjects','findOne','getDescriptions','order','getTags','Tag','setTags','ids','html-pdf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','end','status','json','offset','set','Content-Range','apply','update','sendStatus','stack','name','send','index','ZendeskConfiguration','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','map'];(function(_0x31ef51,_0x2e658d){var _0x1399c3=function(_0x40912c){while(--_0x40912c){_0x31ef51['push'](_0x31ef51['shift']());}};_0x1399c3(++_0x2e658d);}(_0xa70f,0xce));var _0xfa70=function(_0x25de22,_0xdddc9a){_0x25de22=_0x25de22-0x0;var _0x2fd9d1=_0xa70f[_0x25de22];return _0x2fd9d1;};'use strict';var pdf=require(_0xfa70('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfa70('0x1'));var jsonpatch=require(_0xfa70('0x2'));var rp=require(_0xfa70('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfa70('0x4'));var util=require(_0xfa70('0x5'));var path=require(_0xfa70('0x6'));var sox=require(_0xfa70('0x7'));var csv=require(_0xfa70('0x8'));var ejs=require(_0xfa70('0x9'));var fs=require('fs');var _=require(_0xfa70('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfa70('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfa70('0x8'));var querystring=require(_0xfa70('0xc'));var Papa=require('papaparse');var authService=require(_0xfa70('0xd'));var hardwareService=require(_0xfa70('0xe'));var Redis=require(_0xfa70('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0xfa70('0x10'))(_0xfa70('0x11'));var utils=require(_0xfa70('0x12'));var config=require(_0xfa70('0x13'));var db=require(_0xfa70('0x14'))['db'];var jayson=require(_0xfa70('0x15'));var client=jayson[_0xfa70('0x16')][_0xfa70('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x2c1eba,_0x2a2a50,_0x3932b0,_0x4c512f){return new BPromise(function(_0x4964dd,_0x2ba8f4){var _0x53215a=_0x4c512f||client;return _0x53215a[_0xfa70('0x18')](_0x2c1eba,_0x3932b0)[_0xfa70('0x19')](function(_0x41bbd0){logger[_0xfa70('0x1a')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2a2a50,_0xfa70('0x1b'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2a2a50,'request\x20sent',JSON[_0xfa70('0x1c')](_0x41bbd0));if(_0x41bbd0[_0xfa70('0x1d')]){if(_0x41bbd0[_0xfa70('0x1d')][_0xfa70('0x1e')]===0x1f4){logger[_0xfa70('0x1d')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2a2a50,_0x41bbd0[_0xfa70('0x1d')]['message']);return _0x2ba8f4(_0x41bbd0[_0xfa70('0x1d')]['message']);}logger['error'](_0xfa70('0x1f'),_0x2a2a50,_0x41bbd0['error'][_0xfa70('0x20')]);return _0x4964dd(_0x41bbd0[_0xfa70('0x1d')][_0xfa70('0x20')]);}else{logger[_0xfa70('0x1a')](_0xfa70('0x1f'),_0x2a2a50,_0xfa70('0x1b'));_0x4964dd(_0x41bbd0[_0xfa70('0x21')][_0xfa70('0x20')]);}})['catch'](function(_0x4b1aec){logger[_0xfa70('0x1d')](_0xfa70('0x1f'),_0x2a2a50,_0x4b1aec);_0x2ba8f4(_0x4b1aec);});});}function respondWithStatusCode(_0x4fa81c,_0x8187a1){_0x8187a1=_0x8187a1||0xcc;return function(_0x28fcb4){if(_0x28fcb4){return _0x4fa81c['sendStatus'](_0x8187a1);}return _0x4fa81c['status'](_0x8187a1)[_0xfa70('0x22')]();};}function respondWithResult(_0x302f5d,_0x21fede){_0x21fede=_0x21fede||0xc8;return function(_0x1a99df){if(_0x1a99df){return _0x302f5d[_0xfa70('0x23')](_0x21fede)[_0xfa70('0x24')](_0x1a99df);}};}function respondWithFilteredResult(_0x2e2155,_0x1ae0ae){return function(_0x221c84){if(_0x221c84){var _0x24a32a=_0x221c84['count'],_0x4a4e24=_0x1ae0ae[_0xfa70('0x25')],_0x33385a=_0x1ae0ae[_0xfa70('0x25')]+_0x1ae0ae['limit'],_0x50026c;if(_0x33385a>=_0x24a32a){_0x33385a=_0x24a32a;_0x50026c=0xc8;}else{_0x50026c=0xce;}_0x2e2155['status'](_0x50026c);return _0x2e2155[_0xfa70('0x26')](_0xfa70('0x27'),_0x4a4e24+'-'+_0x33385a+'/'+_0x24a32a)[_0xfa70('0x24')](_0x221c84);}return null;};}function patchUpdates(_0x272058){return function(_0x5e61d0){try{jsonpatch[_0xfa70('0x28')](_0x5e61d0,_0x272058,!![]);}catch(_0x2e9969){return BPromise['reject'](_0x2e9969);}return _0x5e61d0['save']();};}function saveUpdates(_0x47a7f9,_0x1fdcb6){return function(_0x589177){if(_0x589177){return _0x589177[_0xfa70('0x29')](_0x47a7f9)['then'](function(_0x3d61b1){return _0x3d61b1;});}return null;};}function removeEntity(_0x5a4c8c,_0x499799){return function(_0x446046){if(_0x446046){return _0x446046['destroy']()[_0xfa70('0x19')](function(){_0x5a4c8c[_0xfa70('0x23')](0xcc)[_0xfa70('0x22')]();});}};}function handleEntityNotFound(_0x521367,_0x34fc4d){return function(_0x20b383){if(!_0x20b383){_0x521367[_0xfa70('0x2a')](0x194);}return _0x20b383;};}function handleError(_0x3f4c00,_0x3eafad){_0x3eafad=_0x3eafad||0x1f4;return function(_0x4cc820){logger['error'](_0x4cc820[_0xfa70('0x2b')]);if(_0x4cc820[_0xfa70('0x2c')]){delete _0x4cc820[_0xfa70('0x2c')];}_0x3f4c00['status'](_0x3eafad)[_0xfa70('0x2d')](_0x4cc820);};}exports[_0xfa70('0x2e')]=function(_0x12930a,_0x305c69){var _0x2bf6c6={},_0x5e0d74={},_0xeeb07={'count':0x0,'rows':[]};var _0x5f2b87=db[_0xfa70('0x2f')][_0xfa70('0x30')];_0x5e0d74[_0xfa70('0x31')]=_['keys'](_0x5f2b87);_0x5e0d74[_0xfa70('0x32')]=_[_0xfa70('0x33')](_0x12930a[_0xfa70('0x32')]);_0x5e0d74[_0xfa70('0x34')]=_[_0xfa70('0x35')](_0x5e0d74[_0xfa70('0x31')],_0x5e0d74[_0xfa70('0x32')]);_0x2bf6c6[_0xfa70('0x36')]=_['intersection'](_0x5e0d74[_0xfa70('0x31')],qs[_0xfa70('0x37')](_0x12930a[_0xfa70('0x32')][_0xfa70('0x37')]));_0x2bf6c6[_0xfa70('0x36')]=_0x2bf6c6[_0xfa70('0x36')][_0xfa70('0x38')]?_0x2bf6c6['attributes']:_0x5e0d74[_0xfa70('0x31')];if(!_0x12930a[_0xfa70('0x32')][_0xfa70('0x39')]('nolimit')){_0x2bf6c6['limit']=qs['limit'](_0x12930a[_0xfa70('0x32')][_0xfa70('0x3a')]);_0x2bf6c6[_0xfa70('0x25')]=qs['offset'](_0x12930a[_0xfa70('0x32')]['offset']);}_0x2bf6c6['order']=qs[_0xfa70('0x3b')](_0x12930a[_0xfa70('0x32')][_0xfa70('0x3b')]);_0x2bf6c6[_0xfa70('0x3c')]=qs[_0xfa70('0x34')](_[_0xfa70('0x3d')](_0x12930a['query'],_0x5e0d74[_0xfa70('0x34')]));if(_0x12930a[_0xfa70('0x32')][_0xfa70('0x3e')]){_0x2bf6c6[_0xfa70('0x3c')]=_['merge'](_0x2bf6c6[_0xfa70('0x3c')],{'$or':_[_0xfa70('0x3f')](_0x5f2b87,function(_0x12bf85){if(_0x12bf85['type'][_0xfa70('0x40')]!==_0xfa70('0x41')){var _0x55231a={};_0x55231a[_0x12bf85[_0xfa70('0x42')]]={'$like':'%'+_0x12930a['query'][_0xfa70('0x3e')]+'%'};return _0x55231a;}})});}_0x2bf6c6=_[_0xfa70('0x43')]({},_0x2bf6c6,_0x12930a[_0xfa70('0x44')]);var _0x2f705b={'where':_0x2bf6c6[_0xfa70('0x3c')]};return db['ZendeskConfiguration'][_0xfa70('0x45')](_0x2f705b)[_0xfa70('0x19')](function(_0x3ba63f){_0xeeb07[_0xfa70('0x45')]=_0x3ba63f;if(_0x12930a[_0xfa70('0x32')][_0xfa70('0x46')]){_0x2bf6c6[_0xfa70('0x47')]=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x2bf6c6);})['then'](function(_0x46b049){_0xeeb07[_0xfa70('0x48')]=_0x46b049;return _0xeeb07;})[_0xfa70('0x19')](respondWithFilteredResult(_0x305c69,_0x2bf6c6))[_0xfa70('0x49')](handleError(_0x305c69,null));};exports[_0xfa70('0x4a')]=function(_0x13ee8c,_0x1d246c){var _0x333f2c={'raw':![],'where':{'id':_0x13ee8c['params']['id']}},_0x10d856={};_0x10d856[_0xfa70('0x31')]=_[_0xfa70('0x33')](db[_0xfa70('0x2f')][_0xfa70('0x30')]);_0x10d856[_0xfa70('0x32')]=_['keys'](_0x13ee8c[_0xfa70('0x32')]);_0x10d856['filters']=_[_0xfa70('0x35')](_0x10d856['model'],_0x10d856['query']);_0x333f2c[_0xfa70('0x36')]=_[_0xfa70('0x35')](_0x10d856['model'],qs[_0xfa70('0x37')](_0x13ee8c['query'][_0xfa70('0x37')]));_0x333f2c[_0xfa70('0x36')]=_0x333f2c['attributes'][_0xfa70('0x38')]?_0x333f2c[_0xfa70('0x36')]:_0x10d856[_0xfa70('0x31')];if(_0x13ee8c[_0xfa70('0x32')][_0xfa70('0x46')]){_0x333f2c[_0xfa70('0x47')]=[{'all':!![]}];}_0x333f2c=_[_0xfa70('0x43')]({},_0x333f2c,_0x13ee8c[_0xfa70('0x44')]);return db[_0xfa70('0x2f')][_0xfa70('0x4b')](_0x333f2c)[_0xfa70('0x19')](handleEntityNotFound(_0x1d246c,null))['then'](respondWithResult(_0x1d246c,null))[_0xfa70('0x49')](handleError(_0x1d246c,null));};exports[_0xfa70('0x4c')]=function(_0x2677ec,_0x4433b8){return db['ZendeskConfiguration']['create'](_0x2677ec['body'],{})[_0xfa70('0x19')](respondWithResult(_0x4433b8,0xc9))[_0xfa70('0x49')](handleError(_0x4433b8,null));};exports[_0xfa70('0x29')]=function(_0x2f60e9,_0x2df795){if(_0x2f60e9[_0xfa70('0x4d')]['id']){delete _0x2f60e9[_0xfa70('0x4d')]['id'];}return db['ZendeskConfiguration'][_0xfa70('0x4b')]({'where':{'id':_0x2f60e9[_0xfa70('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2df795,null))['then'](saveUpdates(_0x2f60e9['body'],null))['then'](respondWithResult(_0x2df795,null))[_0xfa70('0x49')](handleError(_0x2df795,null));};exports['destroy']=function(_0x4c9277,_0x479207){return db[_0xfa70('0x2f')][_0xfa70('0x4b')]({'where':{'id':_0x4c9277[_0xfa70('0x4e')]['id']}})[_0xfa70('0x19')](handleEntityNotFound(_0x479207,null))[_0xfa70('0x19')](removeEntity(_0x479207,null))[_0xfa70('0x49')](handleError(_0x479207,null));};exports[_0xfa70('0x4f')]=function(_0x3c61f8,_0x1b6769,_0x27b582){var _0x5c6b1a={};var _0x53b0eb={};var _0x3d8227;var _0xa26688;return db[_0xfa70('0x2f')]['findOne']({'where':{'id':_0x3c61f8[_0xfa70('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1b6769,null))[_0xfa70('0x19')](function(_0x27671a){if(_0x27671a){_0x3d8227=_0x27671a;_0x53b0eb[_0xfa70('0x31')]=_[_0xfa70('0x33')](db[_0xfa70('0x50')][_0xfa70('0x30')]);_0x53b0eb[_0xfa70('0x32')]=_['keys'](_0x3c61f8['query']);_0x53b0eb[_0xfa70('0x34')]=_[_0xfa70('0x35')](_0x53b0eb[_0xfa70('0x31')],_0x53b0eb[_0xfa70('0x32')]);_0x5c6b1a[_0xfa70('0x36')]=_[_0xfa70('0x35')](_0x53b0eb['model'],qs[_0xfa70('0x37')](_0x3c61f8[_0xfa70('0x32')][_0xfa70('0x37')]));_0x5c6b1a['attributes']=_0x5c6b1a[_0xfa70('0x36')]['length']?_0x5c6b1a['attributes']:_0x53b0eb[_0xfa70('0x31')];_0x5c6b1a['order']=qs[_0xfa70('0x3b')](_0x3c61f8[_0xfa70('0x32')][_0xfa70('0x3b')]);_0x5c6b1a[_0xfa70('0x3c')]=qs[_0xfa70('0x34')](_[_0xfa70('0x3d')](_0x3c61f8[_0xfa70('0x32')],_0x53b0eb['filters']));if(_0x3c61f8[_0xfa70('0x32')][_0xfa70('0x3e')]){_0x5c6b1a[_0xfa70('0x3c')]=_[_0xfa70('0x43')](_0x5c6b1a[_0xfa70('0x3c')],{'$or':_['map'](_0x5c6b1a[_0xfa70('0x36')],function(_0x2d35b9){var _0x1575c5={};_0x1575c5[_0x2d35b9]={'$like':'%'+_0x3c61f8['query'][_0xfa70('0x3e')]+'%'};return _0x1575c5;})});}_0x5c6b1a=_[_0xfa70('0x43')]({},_0x5c6b1a,_0x3c61f8[_0xfa70('0x44')]);return _0x3d8227['getFields'](_0x5c6b1a);}})['then'](function(_0x36223d){if(_0x36223d){_0xa26688=_0x36223d['length'];if(!_0x3c61f8[_0xfa70('0x32')]['hasOwnProperty'](_0xfa70('0x51'))){_0x5c6b1a[_0xfa70('0x3a')]=qs[_0xfa70('0x3a')](_0x3c61f8[_0xfa70('0x32')]['limit']);_0x5c6b1a['offset']=qs[_0xfa70('0x25')](_0x3c61f8[_0xfa70('0x32')][_0xfa70('0x25')]);}return _0x3d8227[_0xfa70('0x4f')](_0x5c6b1a);}})[_0xfa70('0x19')](function(_0x17f0d4){if(_0x17f0d4){return _0x17f0d4?{'count':_0xa26688,'rows':_0x17f0d4}:null;}})[_0xfa70('0x19')](respondWithResult(_0x1b6769,null))[_0xfa70('0x49')](handleError(_0x1b6769,null));};exports[_0xfa70('0x52')]=function(_0xb33ec4,_0x363c39,_0x58b4a8){var _0x31ef85={};var _0x178365={};var _0x10ddba;var _0x5ee09e;return db[_0xfa70('0x2f')][_0xfa70('0x53')]({'where':{'id':_0xb33ec4[_0xfa70('0x4e')]['id']}})[_0xfa70('0x19')](handleEntityNotFound(_0x363c39,null))['then'](function(_0x7af255){if(_0x7af255){_0x10ddba=_0x7af255;_0x178365[_0xfa70('0x31')]=_[_0xfa70('0x33')](db['ZendeskField'][_0xfa70('0x30')]);_0x178365['query']=_['keys'](_0xb33ec4[_0xfa70('0x32')]);_0x178365[_0xfa70('0x34')]=_['intersection'](_0x178365['model'],_0x178365[_0xfa70('0x32')]);_0x31ef85[_0xfa70('0x36')]=_['intersection'](_0x178365[_0xfa70('0x31')],qs[_0xfa70('0x37')](_0xb33ec4[_0xfa70('0x32')]['fields']));_0x31ef85[_0xfa70('0x36')]=_0x31ef85['attributes'][_0xfa70('0x38')]?_0x31ef85[_0xfa70('0x36')]:_0x178365[_0xfa70('0x31')];_0x31ef85['order']=qs[_0xfa70('0x3b')](_0xb33ec4[_0xfa70('0x32')][_0xfa70('0x3b')]);_0x31ef85[_0xfa70('0x3c')]=qs['filters'](_[_0xfa70('0x3d')](_0xb33ec4[_0xfa70('0x32')],_0x178365['filters']));if(_0xb33ec4[_0xfa70('0x32')][_0xfa70('0x3e')]){_0x31ef85['where']=_[_0xfa70('0x43')](_0x31ef85['where'],{'$or':_[_0xfa70('0x3f')](_0x31ef85[_0xfa70('0x36')],function(_0x40197a){var _0x5af89f={};_0x5af89f[_0x40197a]={'$like':'%'+_0xb33ec4[_0xfa70('0x32')][_0xfa70('0x3e')]+'%'};return _0x5af89f;})});}_0x31ef85=_[_0xfa70('0x43')]({},_0x31ef85,_0xb33ec4['options']);return _0x10ddba[_0xfa70('0x52')](_0x31ef85);}})[_0xfa70('0x19')](function(_0x87009b){if(_0x87009b){_0x5ee09e=_0x87009b[_0xfa70('0x38')];if(!_0xb33ec4['query'][_0xfa70('0x39')](_0xfa70('0x51'))){_0x31ef85[_0xfa70('0x3a')]=qs[_0xfa70('0x3a')](_0xb33ec4[_0xfa70('0x32')]['limit']);_0x31ef85[_0xfa70('0x25')]=qs[_0xfa70('0x25')](_0xb33ec4[_0xfa70('0x32')]['offset']);}return _0x10ddba['getSubjects'](_0x31ef85);}})[_0xfa70('0x19')](function(_0x311160){if(_0x311160){return _0x311160?{'count':_0x5ee09e,'rows':_0x311160}:null;}})[_0xfa70('0x19')](respondWithResult(_0x363c39,null))[_0xfa70('0x49')](handleError(_0x363c39,null));};exports[_0xfa70('0x54')]=function(_0x38c0d3,_0x89f8e2,_0x2cdeff){var _0x2fad1b={};var _0x434c7a={};var _0x26369b;var _0x2b6adb;return db[_0xfa70('0x2f')][_0xfa70('0x53')]({'where':{'id':_0x38c0d3['params']['id']}})[_0xfa70('0x19')](handleEntityNotFound(_0x89f8e2,null))['then'](function(_0x182611){if(_0x182611){_0x26369b=_0x182611;_0x434c7a[_0xfa70('0x31')]=_[_0xfa70('0x33')](db[_0xfa70('0x50')][_0xfa70('0x30')]);_0x434c7a['query']=_[_0xfa70('0x33')](_0x38c0d3[_0xfa70('0x32')]);_0x434c7a[_0xfa70('0x34')]=_[_0xfa70('0x35')](_0x434c7a[_0xfa70('0x31')],_0x434c7a[_0xfa70('0x32')]);_0x2fad1b[_0xfa70('0x36')]=_[_0xfa70('0x35')](_0x434c7a[_0xfa70('0x31')],qs['fields'](_0x38c0d3[_0xfa70('0x32')]['fields']));_0x2fad1b[_0xfa70('0x36')]=_0x2fad1b[_0xfa70('0x36')][_0xfa70('0x38')]?_0x2fad1b[_0xfa70('0x36')]:_0x434c7a[_0xfa70('0x31')];_0x2fad1b[_0xfa70('0x55')]=qs[_0xfa70('0x3b')](_0x38c0d3[_0xfa70('0x32')][_0xfa70('0x3b')]);_0x2fad1b[_0xfa70('0x3c')]=qs[_0xfa70('0x34')](_['pick'](_0x38c0d3[_0xfa70('0x32')],_0x434c7a[_0xfa70('0x34')]));if(_0x38c0d3['query']['filter']){_0x2fad1b[_0xfa70('0x3c')]=_[_0xfa70('0x43')](_0x2fad1b[_0xfa70('0x3c')],{'$or':_[_0xfa70('0x3f')](_0x2fad1b[_0xfa70('0x36')],function(_0x3dedee){var _0x22449b={};_0x22449b[_0x3dedee]={'$like':'%'+_0x38c0d3[_0xfa70('0x32')][_0xfa70('0x3e')]+'%'};return _0x22449b;})});}_0x2fad1b=_[_0xfa70('0x43')]({},_0x2fad1b,_0x38c0d3[_0xfa70('0x44')]);return _0x26369b['getDescriptions'](_0x2fad1b);}})[_0xfa70('0x19')](function(_0x199f34){if(_0x199f34){_0x2b6adb=_0x199f34[_0xfa70('0x38')];if(!_0x38c0d3[_0xfa70('0x32')][_0xfa70('0x39')](_0xfa70('0x51'))){_0x2fad1b[_0xfa70('0x3a')]=qs['limit'](_0x38c0d3[_0xfa70('0x32')][_0xfa70('0x3a')]);_0x2fad1b[_0xfa70('0x25')]=qs[_0xfa70('0x25')](_0x38c0d3['query']['offset']);}return _0x26369b[_0xfa70('0x54')](_0x2fad1b);}})[_0xfa70('0x19')](function(_0x59fda0){if(_0x59fda0){return _0x59fda0?{'count':_0x2b6adb,'rows':_0x59fda0}:null;}})[_0xfa70('0x19')](respondWithResult(_0x89f8e2,null))[_0xfa70('0x49')](handleError(_0x89f8e2,null));};exports[_0xfa70('0x56')]=function(_0x4c1790,_0x1118cc,_0x51e7ea){var _0x2a1ae6={};var _0xa57ab0={};var _0x55f674;var _0x16402f;return db['ZendeskConfiguration'][_0xfa70('0x53')]({'where':{'id':_0x4c1790[_0xfa70('0x4e')]['id']}})[_0xfa70('0x19')](handleEntityNotFound(_0x1118cc,null))[_0xfa70('0x19')](function(_0x578695){if(_0x578695){_0x55f674=_0x578695;_0xa57ab0[_0xfa70('0x31')]=_['keys'](db[_0xfa70('0x57')][_0xfa70('0x30')]);_0xa57ab0[_0xfa70('0x32')]=_[_0xfa70('0x33')](_0x4c1790[_0xfa70('0x32')]);_0xa57ab0[_0xfa70('0x34')]=_[_0xfa70('0x35')](_0xa57ab0['model'],_0xa57ab0[_0xfa70('0x32')]);_0x2a1ae6[_0xfa70('0x36')]=_['intersection'](_0xa57ab0[_0xfa70('0x31')],qs[_0xfa70('0x37')](_0x4c1790[_0xfa70('0x32')][_0xfa70('0x37')]));_0x2a1ae6[_0xfa70('0x36')]=_0x2a1ae6[_0xfa70('0x36')][_0xfa70('0x38')]?_0x2a1ae6['attributes']:_0xa57ab0[_0xfa70('0x31')];_0x2a1ae6[_0xfa70('0x55')]=qs['sort'](_0x4c1790['query'][_0xfa70('0x3b')]);_0x2a1ae6['where']=qs[_0xfa70('0x34')](_[_0xfa70('0x3d')](_0x4c1790[_0xfa70('0x32')],_0xa57ab0['filters']));if(_0x4c1790[_0xfa70('0x32')][_0xfa70('0x3e')]){_0x2a1ae6[_0xfa70('0x3c')]=_[_0xfa70('0x43')](_0x2a1ae6[_0xfa70('0x3c')],{'$or':_[_0xfa70('0x3f')](_0x2a1ae6['attributes'],function(_0x520c69){var _0x58270d={};_0x58270d[_0x520c69]={'$like':'%'+_0x4c1790[_0xfa70('0x32')]['filter']+'%'};return _0x58270d;})});}_0x2a1ae6=_[_0xfa70('0x43')]({},_0x2a1ae6,_0x4c1790[_0xfa70('0x44')]);return _0x55f674[_0xfa70('0x56')](_0x2a1ae6);}})[_0xfa70('0x19')](function(_0x11e646){if(_0x11e646){_0x16402f=_0x11e646[_0xfa70('0x38')];if(!_0x4c1790[_0xfa70('0x32')][_0xfa70('0x39')](_0xfa70('0x51'))){_0x2a1ae6[_0xfa70('0x3a')]=qs[_0xfa70('0x3a')](_0x4c1790[_0xfa70('0x32')]['limit']);_0x2a1ae6[_0xfa70('0x25')]=qs['offset'](_0x4c1790['query']['offset']);}return _0x55f674[_0xfa70('0x56')](_0x2a1ae6);}})[_0xfa70('0x19')](function(_0x5c8d37){if(_0x5c8d37){return _0x5c8d37?{'count':_0x16402f,'rows':_0x5c8d37}:null;}})['then'](respondWithResult(_0x1118cc,null))[_0xfa70('0x49')](handleError(_0x1118cc,null));};exports[_0xfa70('0x58')]=function(_0x4afc04,_0x310195,_0x30a41b){if(_0x4afc04[_0xfa70('0x4d')]['id']){delete _0x4afc04[_0xfa70('0x4d')]['id'];}return db[_0xfa70('0x2f')]['findOne']({'where':{'id':_0x4afc04[_0xfa70('0x4e')]['id']}})['then'](handleEntityNotFound(_0x310195,null))['then'](function(_0x4b7c5b){if(_0x4b7c5b){return _0x4b7c5b['setTags'](_0x4afc04[_0xfa70('0x4d')][_0xfa70('0x59')]||[]);}return null;})[_0xfa70('0x19')](respondWithResult(_0x310195,null))['catch'](handleError(_0x310195,null));}; \ No newline at end of file +var _0xd538=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','pick','where','merge','map','type','key','field','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','destroy','findOne','ZendeskField','sort','getFields','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','set','apply','reject','save','update','sendStatus','stack','name','send','index','ZendeskConfiguration','keys','query','filters'];(function(_0x591781,_0x8e0ed2){var _0x315bd9=function(_0x39166c){while(--_0x39166c){_0x591781['push'](_0x591781['shift']());}};_0x315bd9(++_0x8e0ed2);}(_0xd538,0x87));var _0x8d53=function(_0x5e709a,_0x1d7975){_0x5e709a=_0x5e709a-0x0;var _0x57401a=_0xd538[_0x5e709a];return _0x57401a;};'use strict';var pdf=require(_0x8d53('0x0'));var emlformat=require(_0x8d53('0x1'));var rimraf=require(_0x8d53('0x2'));var zipdir=require(_0x8d53('0x3'));var jsonpatch=require(_0x8d53('0x4'));var rp=require(_0x8d53('0x5'));var moment=require(_0x8d53('0x6'));var BPromise=require(_0x8d53('0x7'));var Mustache=require(_0x8d53('0x8'));var util=require(_0x8d53('0x9'));var path=require(_0x8d53('0xa'));var sox=require('sox');var csv=require(_0x8d53('0xb'));var ejs=require(_0x8d53('0xc'));var fs=require('fs');var _=require(_0x8d53('0xd'));var squel=require(_0x8d53('0xe'));var crypto=require(_0x8d53('0xf'));var jsforce=require(_0x8d53('0x10'));var deskjs=require(_0x8d53('0x11'));var toCsv=require(_0x8d53('0xb'));var querystring=require('querystring');var Papa=require(_0x8d53('0x12'));var authService=require(_0x8d53('0x13'));var hardwareService=require(_0x8d53('0x14'));var Redis=require('ioredis');var qs=require(_0x8d53('0x15'));var logger=require(_0x8d53('0x16'))('api');var utils=require(_0x8d53('0x17'));var config=require(_0x8d53('0x18'));var db=require(_0x8d53('0x19'))['db'];var jayson=require(_0x8d53('0x1a'));var client=jayson['client'][_0x8d53('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x41a9b1,_0x29deaa,_0x37555d,_0x67ba5e){return new BPromise(function(_0x39ca77,_0x12bc29){var _0x1cf35f=_0x67ba5e||client;return _0x1cf35f['request'](_0x41a9b1,_0x37555d)[_0x8d53('0x1c')](function(_0x412b76){logger[_0x8d53('0x1d')](_0x8d53('0x1e'),_0x29deaa,_0x8d53('0x1f'));logger[_0x8d53('0x20')](_0x8d53('0x21'),_0x29deaa,_0x8d53('0x1f'),JSON[_0x8d53('0x22')](_0x412b76));if(_0x412b76['error']){if(_0x412b76[_0x8d53('0x23')][_0x8d53('0x24')]===0x1f4){logger[_0x8d53('0x23')](_0x8d53('0x1e'),_0x29deaa,_0x412b76[_0x8d53('0x23')][_0x8d53('0x25')]);return _0x12bc29(_0x412b76['error'][_0x8d53('0x25')]);}logger[_0x8d53('0x23')](_0x8d53('0x1e'),_0x29deaa,_0x412b76[_0x8d53('0x23')][_0x8d53('0x25')]);return _0x39ca77(_0x412b76[_0x8d53('0x23')][_0x8d53('0x25')]);}else{logger[_0x8d53('0x1d')](_0x8d53('0x1e'),_0x29deaa,_0x8d53('0x1f'));_0x39ca77(_0x412b76[_0x8d53('0x26')]['message']);}})[_0x8d53('0x27')](function(_0x30a0c1){logger['error'](_0x8d53('0x1e'),_0x29deaa,_0x30a0c1);_0x12bc29(_0x30a0c1);});});}function respondWithStatusCode(_0xa5241e,_0xf38d30){_0xf38d30=_0xf38d30||0xcc;return function(_0x39aab0){if(_0x39aab0){return _0xa5241e['sendStatus'](_0xf38d30);}return _0xa5241e[_0x8d53('0x28')](_0xf38d30)[_0x8d53('0x29')]();};}function respondWithResult(_0x39a166,_0x36941e){_0x36941e=_0x36941e||0xc8;return function(_0x156796){if(_0x156796){return _0x39a166[_0x8d53('0x28')](_0x36941e)[_0x8d53('0x2a')](_0x156796);}};}function respondWithFilteredResult(_0x57c6cc,_0x5e50bb){return function(_0x4dcfaf){if(_0x4dcfaf){var _0xa8d9c5=_0x4dcfaf[_0x8d53('0x2b')],_0x3f4dcc=_0x5e50bb[_0x8d53('0x2c')],_0x249318=_0x5e50bb[_0x8d53('0x2c')]+_0x5e50bb['limit'],_0xb26c58;if(_0x249318>=_0xa8d9c5){_0x249318=_0xa8d9c5;_0xb26c58=0xc8;}else{_0xb26c58=0xce;}_0x57c6cc['status'](_0xb26c58);return _0x57c6cc[_0x8d53('0x2d')]('Content-Range',_0x3f4dcc+'-'+_0x249318+'/'+_0xa8d9c5)[_0x8d53('0x2a')](_0x4dcfaf);}return null;};}function patchUpdates(_0x999d0){return function(_0x28cb39){try{jsonpatch[_0x8d53('0x2e')](_0x28cb39,_0x999d0,!![]);}catch(_0x1fe35b){return BPromise[_0x8d53('0x2f')](_0x1fe35b);}return _0x28cb39[_0x8d53('0x30')]();};}function saveUpdates(_0x563c07,_0x50ccf5){return function(_0x3a31ae){if(_0x3a31ae){return _0x3a31ae[_0x8d53('0x31')](_0x563c07)[_0x8d53('0x1c')](function(_0x43e72d){return _0x43e72d;});}return null;};}function removeEntity(_0x7214c0,_0x9d7d7e){return function(_0xcd01d5){if(_0xcd01d5){return _0xcd01d5['destroy']()[_0x8d53('0x1c')](function(){_0x7214c0['status'](0xcc)[_0x8d53('0x29')]();});}};}function handleEntityNotFound(_0x5d760b,_0x17ce78){return function(_0x32f1ae){if(!_0x32f1ae){_0x5d760b[_0x8d53('0x32')](0x194);}return _0x32f1ae;};}function handleError(_0x57faee,_0x1b79d4){_0x1b79d4=_0x1b79d4||0x1f4;return function(_0x5c77ec){logger[_0x8d53('0x23')](_0x5c77ec[_0x8d53('0x33')]);if(_0x5c77ec[_0x8d53('0x34')]){delete _0x5c77ec[_0x8d53('0x34')];}_0x57faee[_0x8d53('0x28')](_0x1b79d4)[_0x8d53('0x35')](_0x5c77ec);};}exports[_0x8d53('0x36')]=function(_0x2f76b9,_0x4088ea){var _0x3e66d1={},_0x155631={},_0x4ac9e2={'count':0x0,'rows':[]};var _0xf464ac=db[_0x8d53('0x37')]['rawAttributes'];_0x155631['model']=_[_0x8d53('0x38')](_0xf464ac);_0x155631[_0x8d53('0x39')]=_['keys'](_0x2f76b9[_0x8d53('0x39')]);_0x155631[_0x8d53('0x3a')]=_[_0x8d53('0x3b')](_0x155631[_0x8d53('0x3c')],_0x155631[_0x8d53('0x39')]);_0x3e66d1[_0x8d53('0x3d')]=_['intersection'](_0x155631[_0x8d53('0x3c')],qs[_0x8d53('0x3e')](_0x2f76b9[_0x8d53('0x39')][_0x8d53('0x3e')]));_0x3e66d1[_0x8d53('0x3d')]=_0x3e66d1['attributes'][_0x8d53('0x3f')]?_0x3e66d1['attributes']:_0x155631[_0x8d53('0x3c')];if(!_0x2f76b9[_0x8d53('0x39')][_0x8d53('0x40')](_0x8d53('0x41'))){_0x3e66d1[_0x8d53('0x42')]=qs[_0x8d53('0x42')](_0x2f76b9['query'][_0x8d53('0x42')]);_0x3e66d1[_0x8d53('0x2c')]=qs[_0x8d53('0x2c')](_0x2f76b9[_0x8d53('0x39')][_0x8d53('0x2c')]);}_0x3e66d1[_0x8d53('0x43')]=qs['sort'](_0x2f76b9[_0x8d53('0x39')]['sort']);_0x3e66d1['where']=qs[_0x8d53('0x3a')](_[_0x8d53('0x44')](_0x2f76b9[_0x8d53('0x39')],_0x155631[_0x8d53('0x3a')]));if(_0x2f76b9['query']['filter']){_0x3e66d1[_0x8d53('0x45')]=_[_0x8d53('0x46')](_0x3e66d1[_0x8d53('0x45')],{'$or':_[_0x8d53('0x47')](_0xf464ac,function(_0x2e529c){if(_0x2e529c[_0x8d53('0x48')][_0x8d53('0x49')]!=='VIRTUAL'){var _0x57fdda={};_0x57fdda[_0x2e529c[_0x8d53('0x4a')]]={'$like':'%'+_0x2f76b9[_0x8d53('0x39')][_0x8d53('0x4b')]+'%'};return _0x57fdda;}})});}_0x3e66d1=_[_0x8d53('0x46')]({},_0x3e66d1,_0x2f76b9[_0x8d53('0x4c')]);var _0x5aed61={'where':_0x3e66d1[_0x8d53('0x45')]};return db[_0x8d53('0x37')][_0x8d53('0x2b')](_0x5aed61)[_0x8d53('0x1c')](function(_0x492073){_0x4ac9e2[_0x8d53('0x2b')]=_0x492073;if(_0x2f76b9[_0x8d53('0x39')][_0x8d53('0x4d')]){_0x3e66d1[_0x8d53('0x4e')]=[{'all':!![]}];}return db[_0x8d53('0x37')][_0x8d53('0x4f')](_0x3e66d1);})[_0x8d53('0x1c')](function(_0xf18e79){_0x4ac9e2[_0x8d53('0x50')]=_0xf18e79;return _0x4ac9e2;})[_0x8d53('0x1c')](respondWithFilteredResult(_0x4088ea,_0x3e66d1))[_0x8d53('0x27')](handleError(_0x4088ea,null));};exports[_0x8d53('0x51')]=function(_0x4be292,_0x4ea26d){var _0x31a624={'raw':![],'where':{'id':_0x4be292[_0x8d53('0x52')]['id']}},_0x22c749={};_0x22c749[_0x8d53('0x3c')]=_['keys'](db['ZendeskConfiguration'][_0x8d53('0x53')]);_0x22c749['query']=_[_0x8d53('0x38')](_0x4be292[_0x8d53('0x39')]);_0x22c749['filters']=_[_0x8d53('0x3b')](_0x22c749['model'],_0x22c749['query']);_0x31a624[_0x8d53('0x3d')]=_[_0x8d53('0x3b')](_0x22c749[_0x8d53('0x3c')],qs[_0x8d53('0x3e')](_0x4be292[_0x8d53('0x39')]['fields']));_0x31a624[_0x8d53('0x3d')]=_0x31a624['attributes']['length']?_0x31a624[_0x8d53('0x3d')]:_0x22c749['model'];if(_0x4be292[_0x8d53('0x39')][_0x8d53('0x4d')]){_0x31a624[_0x8d53('0x4e')]=[{'all':!![]}];}_0x31a624=_['merge']({},_0x31a624,_0x4be292['options']);return db[_0x8d53('0x37')][_0x8d53('0x54')](_0x31a624)[_0x8d53('0x1c')](handleEntityNotFound(_0x4ea26d,null))[_0x8d53('0x1c')](respondWithResult(_0x4ea26d,null))['catch'](handleError(_0x4ea26d,null));};exports[_0x8d53('0x55')]=function(_0x28df6c,_0x13d7ed){return db['ZendeskConfiguration']['create'](_0x28df6c[_0x8d53('0x56')],{})[_0x8d53('0x1c')](respondWithResult(_0x13d7ed,0xc9))['catch'](handleError(_0x13d7ed,null));};exports[_0x8d53('0x31')]=function(_0x33444f,_0x57ef18){if(_0x33444f[_0x8d53('0x56')]['id']){delete _0x33444f['body']['id'];}return db[_0x8d53('0x37')][_0x8d53('0x54')]({'where':{'id':_0x33444f['params']['id']}})[_0x8d53('0x1c')](handleEntityNotFound(_0x57ef18,null))['then'](saveUpdates(_0x33444f[_0x8d53('0x56')],null))['then'](respondWithResult(_0x57ef18,null))[_0x8d53('0x27')](handleError(_0x57ef18,null));};exports[_0x8d53('0x57')]=function(_0x5d6ec0,_0x583620){return db[_0x8d53('0x37')][_0x8d53('0x54')]({'where':{'id':_0x5d6ec0[_0x8d53('0x52')]['id']}})['then'](handleEntityNotFound(_0x583620,null))['then'](removeEntity(_0x583620,null))['catch'](handleError(_0x583620,null));};exports['getFields']=function(_0x1ab0cb,_0x527ede,_0x4c15a0){var _0xfa3a28={};var _0x4b2076={};var _0x4f9c0;var _0xaa2ed3;return db[_0x8d53('0x37')][_0x8d53('0x58')]({'where':{'id':_0x1ab0cb[_0x8d53('0x52')]['id']}})[_0x8d53('0x1c')](handleEntityNotFound(_0x527ede,null))['then'](function(_0x1ec7d6){if(_0x1ec7d6){_0x4f9c0=_0x1ec7d6;_0x4b2076[_0x8d53('0x3c')]=_[_0x8d53('0x38')](db[_0x8d53('0x59')]['rawAttributes']);_0x4b2076[_0x8d53('0x39')]=_['keys'](_0x1ab0cb[_0x8d53('0x39')]);_0x4b2076[_0x8d53('0x3a')]=_[_0x8d53('0x3b')](_0x4b2076['model'],_0x4b2076[_0x8d53('0x39')]);_0xfa3a28['attributes']=_[_0x8d53('0x3b')](_0x4b2076[_0x8d53('0x3c')],qs[_0x8d53('0x3e')](_0x1ab0cb[_0x8d53('0x39')]['fields']));_0xfa3a28[_0x8d53('0x3d')]=_0xfa3a28[_0x8d53('0x3d')][_0x8d53('0x3f')]?_0xfa3a28[_0x8d53('0x3d')]:_0x4b2076[_0x8d53('0x3c')];_0xfa3a28[_0x8d53('0x43')]=qs[_0x8d53('0x5a')](_0x1ab0cb['query'][_0x8d53('0x5a')]);_0xfa3a28[_0x8d53('0x45')]=qs[_0x8d53('0x3a')](_[_0x8d53('0x44')](_0x1ab0cb[_0x8d53('0x39')],_0x4b2076['filters']));if(_0x1ab0cb[_0x8d53('0x39')][_0x8d53('0x4b')]){_0xfa3a28[_0x8d53('0x45')]=_['merge'](_0xfa3a28['where'],{'$or':_[_0x8d53('0x47')](_0xfa3a28['attributes'],function(_0x1d9bf3){var _0x3e3032={};_0x3e3032[_0x1d9bf3]={'$like':'%'+_0x1ab0cb['query']['filter']+'%'};return _0x3e3032;})});}_0xfa3a28=_[_0x8d53('0x46')]({},_0xfa3a28,_0x1ab0cb['options']);return _0x4f9c0[_0x8d53('0x5b')](_0xfa3a28);}})['then'](function(_0x1542c0){if(_0x1542c0){_0xaa2ed3=_0x1542c0[_0x8d53('0x3f')];if(!_0x1ab0cb['query'][_0x8d53('0x40')](_0x8d53('0x41'))){_0xfa3a28['limit']=qs[_0x8d53('0x42')](_0x1ab0cb[_0x8d53('0x39')][_0x8d53('0x42')]);_0xfa3a28[_0x8d53('0x2c')]=qs[_0x8d53('0x2c')](_0x1ab0cb[_0x8d53('0x39')]['offset']);}return _0x4f9c0[_0x8d53('0x5b')](_0xfa3a28);}})[_0x8d53('0x1c')](function(_0x577ae4){if(_0x577ae4){return _0x577ae4?{'count':_0xaa2ed3,'rows':_0x577ae4}:null;}})[_0x8d53('0x1c')](respondWithResult(_0x527ede,null))[_0x8d53('0x27')](handleError(_0x527ede,null));};exports[_0x8d53('0x5c')]=function(_0x258bdf,_0x12c489,_0x3ff6c4){var _0x5d5b26={};var _0x37da78={};var _0x2c4e19;var _0x4817ad;return db[_0x8d53('0x37')][_0x8d53('0x58')]({'where':{'id':_0x258bdf['params']['id']}})[_0x8d53('0x1c')](handleEntityNotFound(_0x12c489,null))[_0x8d53('0x1c')](function(_0x1b4c0e){if(_0x1b4c0e){_0x2c4e19=_0x1b4c0e;_0x37da78[_0x8d53('0x3c')]=_[_0x8d53('0x38')](db[_0x8d53('0x59')][_0x8d53('0x53')]);_0x37da78[_0x8d53('0x39')]=_['keys'](_0x258bdf[_0x8d53('0x39')]);_0x37da78[_0x8d53('0x3a')]=_[_0x8d53('0x3b')](_0x37da78['model'],_0x37da78[_0x8d53('0x39')]);_0x5d5b26[_0x8d53('0x3d')]=_[_0x8d53('0x3b')](_0x37da78[_0x8d53('0x3c')],qs['fields'](_0x258bdf['query'][_0x8d53('0x3e')]));_0x5d5b26[_0x8d53('0x3d')]=_0x5d5b26['attributes'][_0x8d53('0x3f')]?_0x5d5b26[_0x8d53('0x3d')]:_0x37da78['model'];_0x5d5b26[_0x8d53('0x43')]=qs['sort'](_0x258bdf['query'][_0x8d53('0x5a')]);_0x5d5b26['where']=qs[_0x8d53('0x3a')](_[_0x8d53('0x44')](_0x258bdf['query'],_0x37da78['filters']));if(_0x258bdf[_0x8d53('0x39')]['filter']){_0x5d5b26[_0x8d53('0x45')]=_[_0x8d53('0x46')](_0x5d5b26['where'],{'$or':_[_0x8d53('0x47')](_0x5d5b26[_0x8d53('0x3d')],function(_0x316033){var _0x11a56e={};_0x11a56e[_0x316033]={'$like':'%'+_0x258bdf[_0x8d53('0x39')][_0x8d53('0x4b')]+'%'};return _0x11a56e;})});}_0x5d5b26=_[_0x8d53('0x46')]({},_0x5d5b26,_0x258bdf['options']);return _0x2c4e19[_0x8d53('0x5c')](_0x5d5b26);}})[_0x8d53('0x1c')](function(_0xfd509){if(_0xfd509){_0x4817ad=_0xfd509[_0x8d53('0x3f')];if(!_0x258bdf[_0x8d53('0x39')][_0x8d53('0x40')](_0x8d53('0x41'))){_0x5d5b26[_0x8d53('0x42')]=qs[_0x8d53('0x42')](_0x258bdf[_0x8d53('0x39')]['limit']);_0x5d5b26[_0x8d53('0x2c')]=qs[_0x8d53('0x2c')](_0x258bdf[_0x8d53('0x39')][_0x8d53('0x2c')]);}return _0x2c4e19['getSubjects'](_0x5d5b26);}})[_0x8d53('0x1c')](function(_0x523753){if(_0x523753){return _0x523753?{'count':_0x4817ad,'rows':_0x523753}:null;}})['then'](respondWithResult(_0x12c489,null))[_0x8d53('0x27')](handleError(_0x12c489,null));};exports[_0x8d53('0x5d')]=function(_0x38eaa8,_0x1b85fa,_0x51de43){var _0x573e3d={};var _0x3bb100={};var _0x471b61;var _0x426b8f;return db[_0x8d53('0x37')][_0x8d53('0x58')]({'where':{'id':_0x38eaa8[_0x8d53('0x52')]['id']}})[_0x8d53('0x1c')](handleEntityNotFound(_0x1b85fa,null))['then'](function(_0x53474f){if(_0x53474f){_0x471b61=_0x53474f;_0x3bb100['model']=_['keys'](db['ZendeskField'][_0x8d53('0x53')]);_0x3bb100[_0x8d53('0x39')]=_[_0x8d53('0x38')](_0x38eaa8[_0x8d53('0x39')]);_0x3bb100[_0x8d53('0x3a')]=_[_0x8d53('0x3b')](_0x3bb100[_0x8d53('0x3c')],_0x3bb100['query']);_0x573e3d[_0x8d53('0x3d')]=_[_0x8d53('0x3b')](_0x3bb100[_0x8d53('0x3c')],qs['fields'](_0x38eaa8[_0x8d53('0x39')][_0x8d53('0x3e')]));_0x573e3d[_0x8d53('0x3d')]=_0x573e3d[_0x8d53('0x3d')][_0x8d53('0x3f')]?_0x573e3d[_0x8d53('0x3d')]:_0x3bb100[_0x8d53('0x3c')];_0x573e3d['order']=qs[_0x8d53('0x5a')](_0x38eaa8[_0x8d53('0x39')][_0x8d53('0x5a')]);_0x573e3d[_0x8d53('0x45')]=qs[_0x8d53('0x3a')](_[_0x8d53('0x44')](_0x38eaa8[_0x8d53('0x39')],_0x3bb100['filters']));if(_0x38eaa8['query']['filter']){_0x573e3d['where']=_[_0x8d53('0x46')](_0x573e3d[_0x8d53('0x45')],{'$or':_[_0x8d53('0x47')](_0x573e3d[_0x8d53('0x3d')],function(_0x59f5ab){var _0x4b1dbc={};_0x4b1dbc[_0x59f5ab]={'$like':'%'+_0x38eaa8[_0x8d53('0x39')]['filter']+'%'};return _0x4b1dbc;})});}_0x573e3d=_[_0x8d53('0x46')]({},_0x573e3d,_0x38eaa8[_0x8d53('0x4c')]);return _0x471b61['getDescriptions'](_0x573e3d);}})[_0x8d53('0x1c')](function(_0x30877f){if(_0x30877f){_0x426b8f=_0x30877f[_0x8d53('0x3f')];if(!_0x38eaa8['query']['hasOwnProperty'](_0x8d53('0x41'))){_0x573e3d[_0x8d53('0x42')]=qs['limit'](_0x38eaa8[_0x8d53('0x39')][_0x8d53('0x42')]);_0x573e3d[_0x8d53('0x2c')]=qs[_0x8d53('0x2c')](_0x38eaa8[_0x8d53('0x39')][_0x8d53('0x2c')]);}return _0x471b61[_0x8d53('0x5d')](_0x573e3d);}})[_0x8d53('0x1c')](function(_0x3b17ac){if(_0x3b17ac){return _0x3b17ac?{'count':_0x426b8f,'rows':_0x3b17ac}:null;}})[_0x8d53('0x1c')](respondWithResult(_0x1b85fa,null))[_0x8d53('0x27')](handleError(_0x1b85fa,null));};exports['getTags']=function(_0x3f187e,_0x597a41,_0x4b0cb2){var _0x203528={};var _0x4b0c1={};var _0x47674c;var _0x343b98;return db[_0x8d53('0x37')]['findOne']({'where':{'id':_0x3f187e[_0x8d53('0x52')]['id']}})[_0x8d53('0x1c')](handleEntityNotFound(_0x597a41,null))[_0x8d53('0x1c')](function(_0x3ccdd3){if(_0x3ccdd3){_0x47674c=_0x3ccdd3;_0x4b0c1[_0x8d53('0x3c')]=_['keys'](db['Tag']['rawAttributes']);_0x4b0c1[_0x8d53('0x39')]=_[_0x8d53('0x38')](_0x3f187e[_0x8d53('0x39')]);_0x4b0c1[_0x8d53('0x3a')]=_['intersection'](_0x4b0c1[_0x8d53('0x3c')],_0x4b0c1[_0x8d53('0x39')]);_0x203528[_0x8d53('0x3d')]=_[_0x8d53('0x3b')](_0x4b0c1[_0x8d53('0x3c')],qs[_0x8d53('0x3e')](_0x3f187e[_0x8d53('0x39')][_0x8d53('0x3e')]));_0x203528[_0x8d53('0x3d')]=_0x203528[_0x8d53('0x3d')][_0x8d53('0x3f')]?_0x203528['attributes']:_0x4b0c1[_0x8d53('0x3c')];_0x203528[_0x8d53('0x43')]=qs['sort'](_0x3f187e[_0x8d53('0x39')]['sort']);_0x203528['where']=qs[_0x8d53('0x3a')](_[_0x8d53('0x44')](_0x3f187e[_0x8d53('0x39')],_0x4b0c1[_0x8d53('0x3a')]));if(_0x3f187e['query'][_0x8d53('0x4b')]){_0x203528['where']=_['merge'](_0x203528[_0x8d53('0x45')],{'$or':_[_0x8d53('0x47')](_0x203528[_0x8d53('0x3d')],function(_0x265505){var _0x6aba1e={};_0x6aba1e[_0x265505]={'$like':'%'+_0x3f187e['query'][_0x8d53('0x4b')]+'%'};return _0x6aba1e;})});}_0x203528=_[_0x8d53('0x46')]({},_0x203528,_0x3f187e[_0x8d53('0x4c')]);return _0x47674c[_0x8d53('0x5e')](_0x203528);}})['then'](function(_0x1663e5){if(_0x1663e5){_0x343b98=_0x1663e5['length'];if(!_0x3f187e[_0x8d53('0x39')][_0x8d53('0x40')]('nolimit')){_0x203528[_0x8d53('0x42')]=qs[_0x8d53('0x42')](_0x3f187e[_0x8d53('0x39')][_0x8d53('0x42')]);_0x203528['offset']=qs['offset'](_0x3f187e[_0x8d53('0x39')][_0x8d53('0x2c')]);}return _0x47674c[_0x8d53('0x5e')](_0x203528);}})[_0x8d53('0x1c')](function(_0x477b82){if(_0x477b82){return _0x477b82?{'count':_0x343b98,'rows':_0x477b82}:null;}})[_0x8d53('0x1c')](respondWithResult(_0x597a41,null))[_0x8d53('0x27')](handleError(_0x597a41,null));};exports[_0x8d53('0x5f')]=function(_0x55f1d1,_0x58852c,_0x43fd4f){if(_0x55f1d1['body']['id']){delete _0x55f1d1[_0x8d53('0x56')]['id'];}return db[_0x8d53('0x37')][_0x8d53('0x58')]({'where':{'id':_0x55f1d1['params']['id']}})[_0x8d53('0x1c')](handleEntityNotFound(_0x58852c,null))[_0x8d53('0x1c')](function(_0xeed274){if(_0xeed274){return _0xeed274[_0x8d53('0x5f')](_0x55f1d1['body'][_0x8d53('0x60')]||[]);}return null;})[_0x8d53('0x1c')](respondWithResult(_0x58852c,null))[_0x8d53('0x27')](handleError(_0x58852c,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index d2473ef..81bd68b 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 _0x2c73=['int_zendesk_configurations','lodash','api','moment','./intZendeskConfiguration.attributes','ZendeskConfiguration'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x2c73,0x6d));var _0x32c7=function(_0x2fd5c3,_0x2d98e5){_0x2fd5c3=_0x2fd5c3-0x0;var _0x2e8031=_0x2c73[_0x2fd5c3];return _0x2e8031;};'use strict';var _=require(_0x32c7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x32c7('0x1'));var moment=require(_0x32c7('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x32c7('0x3'));module['exports']=function(_0x1f2865,_0x10ff92){return _0x1f2865['define'](_0x32c7('0x4'),attributes,{'tableName':_0x32c7('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b54=['lodash','util','api','moment','bluebird','./intZendeskConfiguration.attributes','ZendeskConfiguration','int_zendesk_configurations'];(function(_0x19472e,_0x1801e0){var _0x453bf0=function(_0x1a92d4){while(--_0x1a92d4){_0x19472e['push'](_0x19472e['shift']());}};_0x453bf0(++_0x1801e0);}(_0x4b54,0xb0));var _0x44b5=function(_0x19d7e1,_0x4329dd){_0x19d7e1=_0x19d7e1-0x0;var _0x3e475a=_0x4b54[_0x19d7e1];return _0x3e475a;};'use strict';var _=require(_0x44b5('0x0'));var util=require(_0x44b5('0x1'));var logger=require('../../config/logger')(_0x44b5('0x2'));var moment=require(_0x44b5('0x3'));var BPromise=require(_0x44b5('0x4'));var rp=require('request-promise');var attributes=require(_0x44b5('0x5'));module['exports']=function(_0x3e7d33,_0x412c18){return _0x3e7d33['define'](_0x44b5('0x6'),attributes,{'tableName':_0x44b5('0x7'),'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 a45e929..d2f288d 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 _0xa3e9=['message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x21f8bb,_0x85299d){var _0x1f6033=function(_0x56ba57){while(--_0x56ba57){_0x21f8bb['push'](_0x21f8bb['shift']());}};_0x1f6033(++_0x85299d);}(_0xa3e9,0x106));var _0x9a3e=function(_0x434605,_0x2b2011){_0x434605=_0x434605-0x0;var _0x463d81=_0xa3e9[_0x434605];return _0x463d81;};'use strict';var _=require(_0x9a3e('0x0'));var util=require('util');var moment=require(_0x9a3e('0x1'));var BPromise=require(_0x9a3e('0x2'));var rs=require(_0x9a3e('0x3'));var fs=require('fs');var Redis=require(_0x9a3e('0x4'));var db=require(_0x9a3e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9a3e('0x6'));var jayson=require(_0x9a3e('0x7'));var client=jayson['client'][_0x9a3e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2767cf,_0x49dc23,_0x387329){return new BPromise(function(_0x176ed5,_0x173a5f){return client[_0x9a3e('0x9')](_0x2767cf,_0x387329)[_0x9a3e('0xa')](function(_0x2caecb){logger[_0x9a3e('0xb')](_0x9a3e('0xc'),_0x49dc23,_0x9a3e('0xd'));logger[_0x9a3e('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x49dc23,_0x9a3e('0xd'),JSON[_0x9a3e('0xf')](_0x2caecb));if(_0x2caecb['error']){if(_0x2caecb[_0x9a3e('0x10')][_0x9a3e('0x11')]===0x1f4){logger[_0x9a3e('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x49dc23,_0x2caecb[_0x9a3e('0x10')][_0x9a3e('0x12')]);return _0x173a5f(_0x2caecb[_0x9a3e('0x10')]['message']);}logger[_0x9a3e('0x10')](_0x9a3e('0xc'),_0x49dc23,_0x2caecb[_0x9a3e('0x10')]['message']);return _0x176ed5(_0x2caecb['error'][_0x9a3e('0x12')]);}else{logger[_0x9a3e('0xb')](_0x9a3e('0xc'),_0x49dc23,_0x9a3e('0xd'));_0x176ed5(_0x2caecb['result']['message']);}})[_0x9a3e('0x13')](function(_0x57a273){logger[_0x9a3e('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x49dc23,_0x57a273);_0x173a5f(_0x57a273);});});} \ No newline at end of file +var _0x9d9f=['code','ZendeskConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x1123fd,_0x587f36){var _0x4c2aa6=function(_0x4dd3be){while(--_0x4dd3be){_0x1123fd['push'](_0x1123fd['shift']());}};_0x4c2aa6(++_0x587f36);}(_0x9d9f,0x1e8));var _0xf9d9=function(_0x442533,_0xfcf689){_0x442533=_0x442533-0x0;var _0x2d9072=_0x9d9f[_0x442533];return _0x2d9072;};'use strict';var _=require(_0xf9d9('0x0'));var util=require(_0xf9d9('0x1'));var moment=require(_0xf9d9('0x2'));var BPromise=require('bluebird');var rs=require(_0xf9d9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf9d9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf9d9('0x5'))(_0xf9d9('0x6'));var config=require(_0xf9d9('0x7'));var jayson=require(_0xf9d9('0x8'));var client=jayson[_0xf9d9('0x9')][_0xf9d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5803bd,_0x102d9a,_0x2d2c3e){return new BPromise(function(_0x33abe2,_0x3ab9d8){return client[_0xf9d9('0xb')](_0x5803bd,_0x2d2c3e)[_0xf9d9('0xc')](function(_0x55bc32){logger[_0xf9d9('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x102d9a,'request\x20sent');logger[_0xf9d9('0xe')](_0xf9d9('0xf'),_0x102d9a,_0xf9d9('0x10'),JSON['stringify'](_0x55bc32));if(_0x55bc32[_0xf9d9('0x11')]){if(_0x55bc32[_0xf9d9('0x11')][_0xf9d9('0x12')]===0x1f4){logger['error'](_0xf9d9('0x13'),_0x102d9a,_0x55bc32[_0xf9d9('0x11')][_0xf9d9('0x14')]);return _0x3ab9d8(_0x55bc32[_0xf9d9('0x11')][_0xf9d9('0x14')]);}logger['error'](_0xf9d9('0x13'),_0x102d9a,_0x55bc32[_0xf9d9('0x11')][_0xf9d9('0x14')]);return _0x33abe2(_0x55bc32['error'][_0xf9d9('0x14')]);}else{logger['info'](_0xf9d9('0x13'),_0x102d9a,_0xf9d9('0x10'));_0x33abe2(_0x55bc32[_0xf9d9('0x15')]['message']);}})['catch'](function(_0x706117){logger[_0xf9d9('0x11')](_0xf9d9('0x13'),_0x102d9a,_0x706117);_0x3ab9d8(_0x706117);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 618e65c..f842165 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 _0xa9e0=['/:id','update','delete','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated'];(function(_0x14dbbd,_0x45af68){var _0x5d5973=function(_0x27dc9c){while(--_0x27dc9c){_0x14dbbd['push'](_0x14dbbd['shift']());}};_0x5d5973(++_0x45af68);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['post']('/',auth[_0x0a9e('0x8')](),controller['create']);router['put'](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xa')]);router[_0x0a9e('0xb')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa9e0=['/:id','update','delete','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated'];(function(_0x3db50c,_0x5174c0){var _0xc2309b=function(_0x82601){while(--_0x82601){_0x3db50c['push'](_0x3db50c['shift']());}};_0xc2309b(++_0x5174c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['post']('/',auth[_0x0a9e('0x8')](),controller['create']);router['put'](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xa')]);router[_0x0a9e('0xb')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index f8cf601..97790e2 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 _0xaa88=['exports','ENUM','string','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x5ed71a,_0x141254){var _0x2f3639=function(_0x246569){while(--_0x246569){_0x5ed71a['push'](_0x5ed71a['shift']());}};_0x2f3639(++_0x141254);}(_0xaa88,0x137));var _0x8aa8=function(_0x3d5351,_0x27bc80){_0x3d5351=_0x3d5351-0x0;var _0x1db4db=_0xaa88[_0x3d5351];return _0x1db4db;};'use strict';var Sequelize=require(_0x8aa8('0x0'));module[_0x8aa8('0x1')]={'type':{'type':Sequelize[_0x8aa8('0x2')](_0x8aa8('0x3'),'variable',_0x8aa8('0x4'),_0x8aa8('0x5')),'defaultValue':_0x8aa8('0x3')},'content':{'type':Sequelize[_0x8aa8('0x6')]},'key':{'type':Sequelize[_0x8aa8('0x6')]},'keyType':{'type':Sequelize[_0x8aa8('0x2')]('string','variable',_0x8aa8('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8aa8('0x6')]},'nameField':{'type':Sequelize[_0x8aa8('0x6')]},'customField':{'type':Sequelize[_0x8aa8('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8aa8('0x6')]}}; \ No newline at end of file +var _0x70e0=['BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','string','STRING','variable'];(function(_0x244690,_0x1d3388){var _0x33698b=function(_0xf93be8){while(--_0xf93be8){_0x244690['push'](_0x244690['shift']());}};_0x33698b(++_0x1d3388);}(_0x70e0,0x17b));var _0x070e=function(_0x23b15a,_0x5d8781){_0x23b15a=_0x23b15a-0x0;var _0x12ba9b=_0x70e0[_0x23b15a];return _0x12ba9b;};'use strict';var Sequelize=require(_0x070e('0x0'));module[_0x070e('0x1')]={'type':{'type':Sequelize[_0x070e('0x2')]('string','variable',_0x070e('0x3'),_0x070e('0x4')),'defaultValue':_0x070e('0x5')},'content':{'type':Sequelize[_0x070e('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x070e('0x2')]('string',_0x070e('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x070e('0x6')]},'customField':{'type':Sequelize[_0x070e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index eb5548b..b8f6d5f 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 _0x3f1d=['catch','show','params','length','options','find','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','Content-Range','apply','save','update','then','end','error','name','send','index','ZendeskField','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','field','includeAll','include','rows'];(function(_0x2bd1ec,_0x3fe65f){var _0x2f7577=function(_0x5234fb){while(--_0x5234fb){_0x2bd1ec['push'](_0x2bd1ec['shift']());}};_0x2f7577(++_0x3fe65f);}(_0x3f1d,0x9a));var _0xd3f1=function(_0x275600,_0x4675cc){_0x275600=_0x275600-0x0;var _0x558be9=_0x3f1d[_0x275600];return _0x558be9;};'use strict';var pdf=require(_0xd3f1('0x0'));var emlformat=require(_0xd3f1('0x1'));var rimraf=require(_0xd3f1('0x2'));var zipdir=require(_0xd3f1('0x3'));var jsonpatch=require(_0xd3f1('0x4'));var rp=require(_0xd3f1('0x5'));var moment=require('moment');var BPromise=require(_0xd3f1('0x6'));var Mustache=require(_0xd3f1('0x7'));var util=require(_0xd3f1('0x8'));var path=require(_0xd3f1('0x9'));var sox=require(_0xd3f1('0xa'));var csv=require(_0xd3f1('0xb'));var ejs=require(_0xd3f1('0xc'));var fs=require('fs');var _=require(_0xd3f1('0xd'));var squel=require(_0xd3f1('0xe'));var crypto=require(_0xd3f1('0xf'));var jsforce=require(_0xd3f1('0x10'));var deskjs=require(_0xd3f1('0x11'));var toCsv=require(_0xd3f1('0xb'));var querystring=require(_0xd3f1('0x12'));var Papa=require(_0xd3f1('0x13'));var authService=require(_0xd3f1('0x14'));var hardwareService=require(_0xd3f1('0x15'));var Redis=require(_0xd3f1('0x16'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xd3f1('0x17'));var utils=require(_0xd3f1('0x18'));var config=require('../../config/environment');var db=require(_0xd3f1('0x19'))['db'];function respondWithStatusCode(_0x59ac28,_0x6c1e87){_0x6c1e87=_0x6c1e87||0xcc;return function(_0x24aed8){if(_0x24aed8){return _0x59ac28[_0xd3f1('0x1a')](_0x6c1e87);}return _0x59ac28[_0xd3f1('0x1b')](_0x6c1e87)['end']();};}function respondWithResult(_0x551018,_0x57d95e){_0x57d95e=_0x57d95e||0xc8;return function(_0x2027f0){if(_0x2027f0){return _0x551018[_0xd3f1('0x1b')](_0x57d95e)['json'](_0x2027f0);}};}function respondWithFilteredResult(_0x3e00a6,_0x429ddf){return function(_0x158a7f){if(_0x158a7f){var _0x51d459=_0x158a7f[_0xd3f1('0x1c')],_0x4bfda6=_0x429ddf[_0xd3f1('0x1d')],_0x2c9122=_0x429ddf['offset']+_0x429ddf['limit'],_0x4d9053;if(_0x2c9122>=_0x51d459){_0x2c9122=_0x51d459;_0x4d9053=0xc8;}else{_0x4d9053=0xce;}_0x3e00a6[_0xd3f1('0x1b')](_0x4d9053);return _0x3e00a6['set'](_0xd3f1('0x1e'),_0x4bfda6+'-'+_0x2c9122+'/'+_0x51d459)['json'](_0x158a7f);}return null;};}function patchUpdates(_0x3c5066){return function(_0x568b16){try{jsonpatch[_0xd3f1('0x1f')](_0x568b16,_0x3c5066,!![]);}catch(_0x160718){return BPromise['reject'](_0x160718);}return _0x568b16[_0xd3f1('0x20')]();};}function saveUpdates(_0x53508f,_0x364f10){return function(_0x4d0845){if(_0x4d0845){return _0x4d0845[_0xd3f1('0x21')](_0x53508f)[_0xd3f1('0x22')](function(_0x1f2621){return _0x1f2621;});}return null;};}function removeEntity(_0x2a5550,_0x5867c4){return function(_0x1b0db9){if(_0x1b0db9){return _0x1b0db9['destroy']()['then'](function(){_0x2a5550[_0xd3f1('0x1b')](0xcc)[_0xd3f1('0x23')]();});}};}function handleEntityNotFound(_0x4bb161,_0x83f8a1){return function(_0x1947e1){if(!_0x1947e1){_0x4bb161['sendStatus'](0x194);}return _0x1947e1;};}function handleError(_0x361006,_0x3cc24f){_0x3cc24f=_0x3cc24f||0x1f4;return function(_0x951429){logger[_0xd3f1('0x24')](_0x951429['stack']);if(_0x951429[_0xd3f1('0x25')]){delete _0x951429[_0xd3f1('0x25')];}_0x361006[_0xd3f1('0x1b')](_0x3cc24f)[_0xd3f1('0x26')](_0x951429);};}exports[_0xd3f1('0x27')]=function(_0x295ce2,_0x1033f0){var _0x2cb9ab={},_0x1aac67={},_0x3a4743={'count':0x0,'rows':[]};var _0x47be80=db[_0xd3f1('0x28')][_0xd3f1('0x29')];_0x1aac67[_0xd3f1('0x2a')]=_[_0xd3f1('0x2b')](_0x47be80);_0x1aac67['query']=_[_0xd3f1('0x2b')](_0x295ce2[_0xd3f1('0x2c')]);_0x1aac67[_0xd3f1('0x2d')]=_[_0xd3f1('0x2e')](_0x1aac67[_0xd3f1('0x2a')],_0x1aac67[_0xd3f1('0x2c')]);_0x2cb9ab[_0xd3f1('0x2f')]=_[_0xd3f1('0x2e')](_0x1aac67[_0xd3f1('0x2a')],qs[_0xd3f1('0x30')](_0x295ce2[_0xd3f1('0x2c')][_0xd3f1('0x30')]));_0x2cb9ab['attributes']=_0x2cb9ab[_0xd3f1('0x2f')]['length']?_0x2cb9ab[_0xd3f1('0x2f')]:_0x1aac67[_0xd3f1('0x2a')];if(!_0x295ce2[_0xd3f1('0x2c')][_0xd3f1('0x31')](_0xd3f1('0x32'))){_0x2cb9ab[_0xd3f1('0x33')]=qs[_0xd3f1('0x33')](_0x295ce2['query'][_0xd3f1('0x33')]);_0x2cb9ab[_0xd3f1('0x1d')]=qs[_0xd3f1('0x1d')](_0x295ce2[_0xd3f1('0x2c')][_0xd3f1('0x1d')]);}_0x2cb9ab[_0xd3f1('0x34')]=qs[_0xd3f1('0x35')](_0x295ce2[_0xd3f1('0x2c')][_0xd3f1('0x35')]);_0x2cb9ab[_0xd3f1('0x36')]=qs['filters'](_[_0xd3f1('0x37')](_0x295ce2['query'],_0x1aac67[_0xd3f1('0x2d')]));if(_0x295ce2[_0xd3f1('0x2c')][_0xd3f1('0x38')]){_0x2cb9ab[_0xd3f1('0x36')]=_[_0xd3f1('0x39')](_0x2cb9ab['where'],{'$or':_[_0xd3f1('0x3a')](_0x47be80,function(_0xd1e410){if(_0xd1e410[_0xd3f1('0x3b')]['key']!==_0xd3f1('0x3c')){var _0x5675be={};_0x5675be[_0xd1e410[_0xd3f1('0x3d')]]={'$like':'%'+_0x295ce2[_0xd3f1('0x2c')][_0xd3f1('0x38')]+'%'};return _0x5675be;}})});}_0x2cb9ab=_['merge']({},_0x2cb9ab,_0x295ce2['options']);var _0x250182={'where':_0x2cb9ab[_0xd3f1('0x36')]};return db[_0xd3f1('0x28')]['count'](_0x250182)[_0xd3f1('0x22')](function(_0x3a8f47){_0x3a4743[_0xd3f1('0x1c')]=_0x3a8f47;if(_0x295ce2[_0xd3f1('0x2c')][_0xd3f1('0x3e')]){_0x2cb9ab[_0xd3f1('0x3f')]=[{'all':!![]}];}return db[_0xd3f1('0x28')]['findAll'](_0x2cb9ab);})['then'](function(_0x8640d4){_0x3a4743[_0xd3f1('0x40')]=_0x8640d4;return _0x3a4743;})[_0xd3f1('0x22')](respondWithFilteredResult(_0x1033f0,_0x2cb9ab))[_0xd3f1('0x41')](handleError(_0x1033f0,null));};exports[_0xd3f1('0x42')]=function(_0x1f3ba0,_0x356a94){var _0x4e3ca6={'raw':!![],'where':{'id':_0x1f3ba0[_0xd3f1('0x43')]['id']}},_0x8d4759={};_0x8d4759[_0xd3f1('0x2a')]=_[_0xd3f1('0x2b')](db['ZendeskField'][_0xd3f1('0x29')]);_0x8d4759[_0xd3f1('0x2c')]=_['keys'](_0x1f3ba0['query']);_0x8d4759[_0xd3f1('0x2d')]=_[_0xd3f1('0x2e')](_0x8d4759[_0xd3f1('0x2a')],_0x8d4759[_0xd3f1('0x2c')]);_0x4e3ca6[_0xd3f1('0x2f')]=_[_0xd3f1('0x2e')](_0x8d4759[_0xd3f1('0x2a')],qs[_0xd3f1('0x30')](_0x1f3ba0[_0xd3f1('0x2c')][_0xd3f1('0x30')]));_0x4e3ca6[_0xd3f1('0x2f')]=_0x4e3ca6[_0xd3f1('0x2f')][_0xd3f1('0x44')]?_0x4e3ca6[_0xd3f1('0x2f')]:_0x8d4759[_0xd3f1('0x2a')];if(_0x1f3ba0[_0xd3f1('0x2c')][_0xd3f1('0x3e')]){_0x4e3ca6[_0xd3f1('0x3f')]=[{'all':!![]}];}_0x4e3ca6=_[_0xd3f1('0x39')]({},_0x4e3ca6,_0x1f3ba0[_0xd3f1('0x45')]);return db[_0xd3f1('0x28')][_0xd3f1('0x46')](_0x4e3ca6)[_0xd3f1('0x22')](handleEntityNotFound(_0x356a94,null))[_0xd3f1('0x22')](respondWithResult(_0x356a94,null))['catch'](handleError(_0x356a94,null));};exports['create']=function(_0x5d548c,_0x117472){return db[_0xd3f1('0x28')]['create'](_0x5d548c[_0xd3f1('0x47')],{})['then'](respondWithResult(_0x117472,0xc9))[_0xd3f1('0x41')](handleError(_0x117472,null));};exports[_0xd3f1('0x21')]=function(_0x1a4825,_0x1f47b3){if(_0x1a4825['body']['id']){delete _0x1a4825['body']['id'];}return db['ZendeskField'][_0xd3f1('0x46')]({'where':{'id':_0x1a4825[_0xd3f1('0x43')]['id']}})[_0xd3f1('0x22')](handleEntityNotFound(_0x1f47b3,null))[_0xd3f1('0x22')](saveUpdates(_0x1a4825[_0xd3f1('0x47')],null))[_0xd3f1('0x22')](respondWithResult(_0x1f47b3,null))[_0xd3f1('0x41')](handleError(_0x1f47b3,null));};exports[_0xd3f1('0x48')]=function(_0x53c01b,_0x3f1fc8){return db[_0xd3f1('0x28')][_0xd3f1('0x46')]({'where':{'id':_0x53c01b[_0xd3f1('0x43')]['id']}})[_0xd3f1('0x22')](handleEntityNotFound(_0x3f1fc8,null))[_0xd3f1('0x22')](removeEntity(_0x3f1fc8,null))[_0xd3f1('0x41')](handleError(_0x3f1fc8,null));}; \ No newline at end of file +var _0xfec2=['status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','error','name','send','ZendeskField','rawAttributes','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','map','type','key','field','merge','options','count','includeAll','include','rows','show','params','catch','create','body','find','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus'];(function(_0x296b3c,_0x203828){var _0x53adfa=function(_0x50b597){while(--_0x50b597){_0x296b3c['push'](_0x296b3c['shift']());}};_0x53adfa(++_0x203828);}(_0xfec2,0x158));var _0x2fec=function(_0x22ec6a,_0xbce7de){_0x22ec6a=_0x22ec6a-0x0;var _0x667544=_0xfec2[_0x22ec6a];return _0x667544;};'use strict';var pdf=require(_0x2fec('0x0'));var emlformat=require(_0x2fec('0x1'));var rimraf=require(_0x2fec('0x2'));var zipdir=require(_0x2fec('0x3'));var jsonpatch=require(_0x2fec('0x4'));var rp=require(_0x2fec('0x5'));var moment=require(_0x2fec('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x2fec('0x7'));var util=require(_0x2fec('0x8'));var path=require(_0x2fec('0x9'));var sox=require(_0x2fec('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2fec('0xb'));var squel=require(_0x2fec('0xc'));var crypto=require(_0x2fec('0xd'));var jsforce=require(_0x2fec('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2fec('0xf'));var querystring=require(_0x2fec('0x10'));var Papa=require(_0x2fec('0x11'));var authService=require(_0x2fec('0x12'));var hardwareService=require(_0x2fec('0x13'));var Redis=require(_0x2fec('0x14'));var qs=require('../../components/parsers/qs');var logger=require(_0x2fec('0x15'))(_0x2fec('0x16'));var utils=require('../../config/utils');var config=require(_0x2fec('0x17'));var db=require(_0x2fec('0x18'))['db'];function respondWithStatusCode(_0x57ac2c,_0x51aedc){_0x51aedc=_0x51aedc||0xcc;return function(_0x1c36b6){if(_0x1c36b6){return _0x57ac2c[_0x2fec('0x19')](_0x51aedc);}return _0x57ac2c[_0x2fec('0x1a')](_0x51aedc)[_0x2fec('0x1b')]();};}function respondWithResult(_0x478a97,_0x26f138){_0x26f138=_0x26f138||0xc8;return function(_0x286237){if(_0x286237){return _0x478a97[_0x2fec('0x1a')](_0x26f138)['json'](_0x286237);}};}function respondWithFilteredResult(_0x40968b,_0x5c1522){return function(_0x1d6465){if(_0x1d6465){var _0x98f515=_0x1d6465['count'],_0x1a13d5=_0x5c1522[_0x2fec('0x1c')],_0x591ef9=_0x5c1522[_0x2fec('0x1c')]+_0x5c1522[_0x2fec('0x1d')],_0x2725c8;if(_0x591ef9>=_0x98f515){_0x591ef9=_0x98f515;_0x2725c8=0xc8;}else{_0x2725c8=0xce;}_0x40968b['status'](_0x2725c8);return _0x40968b[_0x2fec('0x1e')](_0x2fec('0x1f'),_0x1a13d5+'-'+_0x591ef9+'/'+_0x98f515)[_0x2fec('0x20')](_0x1d6465);}return null;};}function patchUpdates(_0x19b958){return function(_0x4402d8){try{jsonpatch[_0x2fec('0x21')](_0x4402d8,_0x19b958,!![]);}catch(_0x301b9c){return BPromise[_0x2fec('0x22')](_0x301b9c);}return _0x4402d8[_0x2fec('0x23')]();};}function saveUpdates(_0x29af58,_0x256506){return function(_0x1edb89){if(_0x1edb89){return _0x1edb89[_0x2fec('0x24')](_0x29af58)[_0x2fec('0x25')](function(_0x42ebd9){return _0x42ebd9;});}return null;};}function removeEntity(_0x15e611,_0x3f5634){return function(_0x175340){if(_0x175340){return _0x175340['destroy']()[_0x2fec('0x25')](function(){_0x15e611[_0x2fec('0x1a')](0xcc)[_0x2fec('0x1b')]();});}};}function handleEntityNotFound(_0x33bc9b,_0x2e3866){return function(_0x3f35b2){if(!_0x3f35b2){_0x33bc9b[_0x2fec('0x19')](0x194);}return _0x3f35b2;};}function handleError(_0x2110da,_0xdd60b9){_0xdd60b9=_0xdd60b9||0x1f4;return function(_0x3846de){logger[_0x2fec('0x26')](_0x3846de['stack']);if(_0x3846de[_0x2fec('0x27')]){delete _0x3846de[_0x2fec('0x27')];}_0x2110da[_0x2fec('0x1a')](_0xdd60b9)[_0x2fec('0x28')](_0x3846de);};}exports['index']=function(_0x572f17,_0x5861f2){var _0x29f278={},_0x90555d={},_0x4e5283={'count':0x0,'rows':[]};var _0x2e4c18=db[_0x2fec('0x29')][_0x2fec('0x2a')];_0x90555d[_0x2fec('0x2b')]=_[_0x2fec('0x2c')](_0x2e4c18);_0x90555d[_0x2fec('0x2d')]=_['keys'](_0x572f17[_0x2fec('0x2d')]);_0x90555d['filters']=_[_0x2fec('0x2e')](_0x90555d['model'],_0x90555d['query']);_0x29f278['attributes']=_[_0x2fec('0x2e')](_0x90555d['model'],qs[_0x2fec('0x2f')](_0x572f17[_0x2fec('0x2d')]['fields']));_0x29f278['attributes']=_0x29f278[_0x2fec('0x30')][_0x2fec('0x31')]?_0x29f278[_0x2fec('0x30')]:_0x90555d[_0x2fec('0x2b')];if(!_0x572f17['query'][_0x2fec('0x32')]('nolimit')){_0x29f278[_0x2fec('0x1d')]=qs['limit'](_0x572f17['query'][_0x2fec('0x1d')]);_0x29f278[_0x2fec('0x1c')]=qs[_0x2fec('0x1c')](_0x572f17[_0x2fec('0x2d')][_0x2fec('0x1c')]);}_0x29f278[_0x2fec('0x33')]=qs[_0x2fec('0x34')](_0x572f17['query'][_0x2fec('0x34')]);_0x29f278[_0x2fec('0x35')]=qs[_0x2fec('0x36')](_[_0x2fec('0x37')](_0x572f17[_0x2fec('0x2d')],_0x90555d[_0x2fec('0x36')]));if(_0x572f17[_0x2fec('0x2d')][_0x2fec('0x38')]){_0x29f278[_0x2fec('0x35')]=_['merge'](_0x29f278[_0x2fec('0x35')],{'$or':_[_0x2fec('0x39')](_0x2e4c18,function(_0x514948){if(_0x514948[_0x2fec('0x3a')][_0x2fec('0x3b')]!=='VIRTUAL'){var _0x3d79c={};_0x3d79c[_0x514948[_0x2fec('0x3c')]]={'$like':'%'+_0x572f17[_0x2fec('0x2d')][_0x2fec('0x38')]+'%'};return _0x3d79c;}})});}_0x29f278=_[_0x2fec('0x3d')]({},_0x29f278,_0x572f17[_0x2fec('0x3e')]);var _0xa8595f={'where':_0x29f278[_0x2fec('0x35')]};return db[_0x2fec('0x29')][_0x2fec('0x3f')](_0xa8595f)['then'](function(_0x28e811){_0x4e5283[_0x2fec('0x3f')]=_0x28e811;if(_0x572f17[_0x2fec('0x2d')][_0x2fec('0x40')]){_0x29f278[_0x2fec('0x41')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x29f278);})['then'](function(_0x12b660){_0x4e5283[_0x2fec('0x42')]=_0x12b660;return _0x4e5283;})[_0x2fec('0x25')](respondWithFilteredResult(_0x5861f2,_0x29f278))['catch'](handleError(_0x5861f2,null));};exports[_0x2fec('0x43')]=function(_0x23a219,_0x2b2491){var _0x4b978a={'raw':!![],'where':{'id':_0x23a219[_0x2fec('0x44')]['id']}},_0x511fa4={};_0x511fa4['model']=_[_0x2fec('0x2c')](db[_0x2fec('0x29')][_0x2fec('0x2a')]);_0x511fa4[_0x2fec('0x2d')]=_['keys'](_0x23a219[_0x2fec('0x2d')]);_0x511fa4[_0x2fec('0x36')]=_[_0x2fec('0x2e')](_0x511fa4[_0x2fec('0x2b')],_0x511fa4[_0x2fec('0x2d')]);_0x4b978a[_0x2fec('0x30')]=_[_0x2fec('0x2e')](_0x511fa4[_0x2fec('0x2b')],qs[_0x2fec('0x2f')](_0x23a219[_0x2fec('0x2d')][_0x2fec('0x2f')]));_0x4b978a[_0x2fec('0x30')]=_0x4b978a[_0x2fec('0x30')][_0x2fec('0x31')]?_0x4b978a[_0x2fec('0x30')]:_0x511fa4[_0x2fec('0x2b')];if(_0x23a219[_0x2fec('0x2d')]['includeAll']){_0x4b978a['include']=[{'all':!![]}];}_0x4b978a=_[_0x2fec('0x3d')]({},_0x4b978a,_0x23a219[_0x2fec('0x3e')]);return db[_0x2fec('0x29')]['find'](_0x4b978a)[_0x2fec('0x25')](handleEntityNotFound(_0x2b2491,null))[_0x2fec('0x25')](respondWithResult(_0x2b2491,null))[_0x2fec('0x45')](handleError(_0x2b2491,null));};exports[_0x2fec('0x46')]=function(_0x2e19d7,_0x5630a5){return db[_0x2fec('0x29')][_0x2fec('0x46')](_0x2e19d7[_0x2fec('0x47')],{})[_0x2fec('0x25')](respondWithResult(_0x5630a5,0xc9))['catch'](handleError(_0x5630a5,null));};exports['update']=function(_0x582ed6,_0x5cacca){if(_0x582ed6['body']['id']){delete _0x582ed6[_0x2fec('0x47')]['id'];}return db[_0x2fec('0x29')][_0x2fec('0x48')]({'where':{'id':_0x582ed6['params']['id']}})[_0x2fec('0x25')](handleEntityNotFound(_0x5cacca,null))[_0x2fec('0x25')](saveUpdates(_0x582ed6[_0x2fec('0x47')],null))[_0x2fec('0x25')](respondWithResult(_0x5cacca,null))['catch'](handleError(_0x5cacca,null));};exports[_0x2fec('0x49')]=function(_0x40d144,_0x4cb815){return db[_0x2fec('0x29')][_0x2fec('0x48')]({'where':{'id':_0x40d144[_0x2fec('0x44')]['id']}})[_0x2fec('0x25')](handleEntityNotFound(_0x4cb815,null))[_0x2fec('0x25')](removeEntity(_0x4cb815,null))[_0x2fec('0x45')](handleError(_0x4cb815,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 6676d64..ffe8534 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 _0x1eba=['zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields'];(function(_0x7b8137,_0x18570e){var _0x3cb3d0=function(_0x11253b){while(--_0x11253b){_0x7b8137['push'](_0x7b8137['shift']());}};_0x3cb3d0(++_0x18570e);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x1eba[_0x24237f];return _0x48298e;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var logger=require(_0xa1eb('0x2'))(_0xa1eb('0x3'));var moment=require(_0xa1eb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xa1eb('0x5'));module[_0xa1eb('0x6')]=function(_0x16a13a,_0xf9d704){return _0x16a13a[_0xa1eb('0x7')](_0xa1eb('0x8'),attributes,{'tableName':_0xa1eb('0x9'),'paranoid':![],'indexes':[{'name':_0xa1eb('0xa'),'fields':[_0xa1eb('0xb'),_0xa1eb('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3266=['zendesk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields'];(function(_0x333a3d,_0x9d96fc){var _0x583905=function(_0x43de96){while(--_0x43de96){_0x333a3d['push'](_0x333a3d['shift']());}};_0x583905(++_0x9d96fc);}(_0x3266,0x6a));var _0x6326=function(_0x2afbb0,_0x44f16d){_0x2afbb0=_0x2afbb0-0x0;var _0x411ff2=_0x3266[_0x2afbb0];return _0x411ff2;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var logger=require(_0x6326('0x2'))(_0x6326('0x3'));var moment=require(_0x6326('0x4'));var BPromise=require(_0x6326('0x5'));var rp=require(_0x6326('0x6'));var attributes=require(_0x6326('0x7'));module[_0x6326('0x8')]=function(_0x5a6b4d,_0x30b22e){return _0x5a6b4d['define'](_0x6326('0x9'),attributes,{'tableName':_0x6326('0xa'),'paranoid':![],'indexes':[{'name':_0x6326('0xb'),'fields':['idField',_0x6326('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 7653d73..300ac37 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 _0xd4f4=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x31abee,_0x11ff0c){var _0x3c1761=function(_0x2b5062){while(--_0x2b5062){_0x31abee['push'](_0x31abee['shift']());}};_0x3c1761(++_0x11ff0c);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x49fd8f,_0x1c0d49){_0x49fd8f=_0x49fd8f-0x0;var _0x40a4d5=_0xd4f4[_0x49fd8f];return _0x40a4d5;};'use strict';var _=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var moment=require(_0x4d4f('0x2'));var BPromise=require(_0x4d4f('0x3'));var rs=require(_0x4d4f('0x4'));var fs=require('fs');var Redis=require(_0x4d4f('0x5'));var db=require(_0x4d4f('0x6'))['db'];var utils=require(_0x4d4f('0x7'));var logger=require(_0x4d4f('0x8'))(_0x4d4f('0x9'));var config=require(_0x4d4f('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d7aa8,_0xecc103,_0x150bd6){return new BPromise(function(_0xea29b,_0x40be66){return client[_0x4d4f('0xb')](_0x1d7aa8,_0x150bd6)[_0x4d4f('0xc')](function(_0x226837){logger[_0x4d4f('0xd')](_0x4d4f('0xe'),_0xecc103,_0x4d4f('0xf'));logger[_0x4d4f('0x10')](_0x4d4f('0x11'),_0xecc103,_0x4d4f('0xf'),JSON[_0x4d4f('0x12')](_0x226837));if(_0x226837[_0x4d4f('0x13')]){if(_0x226837[_0x4d4f('0x13')][_0x4d4f('0x14')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0xecc103,_0x226837['error'][_0x4d4f('0x15')]);return _0x40be66(_0x226837[_0x4d4f('0x13')]['message']);}logger[_0x4d4f('0x13')](_0x4d4f('0xe'),_0xecc103,_0x226837[_0x4d4f('0x13')]['message']);return _0xea29b(_0x226837[_0x4d4f('0x13')][_0x4d4f('0x15')]);}else{logger[_0x4d4f('0xd')]('ZendeskField,\x20%s,\x20%s',_0xecc103,_0x4d4f('0xf'));_0xea29b(_0x226837['result'][_0x4d4f('0x15')]);}})[_0x4d4f('0x16')](function(_0x4170ca){logger['error'](_0x4d4f('0xe'),_0xecc103,_0x4170ca);_0x40be66(_0x4170ca);});});} \ No newline at end of file +var _0xcf66=['jayson/promise','client','http','request','then','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc'];(function(_0x4a325a,_0x2c154c){var _0x2597a1=function(_0x437af3){while(--_0x437af3){_0x4a325a['push'](_0x4a325a['shift']());}};_0x2597a1(++_0x2c154c);}(_0xcf66,0x71));var _0x6cf6=function(_0x23bf27,_0x4c09c8){_0x23bf27=_0x23bf27-0x0;var _0x3db7f7=_0xcf66[_0x23bf27];return _0x3db7f7;};'use strict';var _=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var moment=require(_0x6cf6('0x2'));var BPromise=require('bluebird');var rs=require(_0x6cf6('0x3'));var fs=require('fs');var Redis=require(_0x6cf6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6cf6('0x5'))(_0x6cf6('0x6'));var config=require('../../config/environment');var jayson=require(_0x6cf6('0x7'));var client=jayson[_0x6cf6('0x8')][_0x6cf6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5eb082,_0x94c6a9,_0x308d0d){return new BPromise(function(_0x36b892,_0x748c93){return client[_0x6cf6('0xa')](_0x5eb082,_0x308d0d)[_0x6cf6('0xb')](function(_0x5b3827){logger['info']('ZendeskField,\x20%s,\x20%s',_0x94c6a9,_0x6cf6('0xc'));logger['debug'](_0x6cf6('0xd'),_0x94c6a9,_0x6cf6('0xc'),JSON[_0x6cf6('0xe')](_0x5b3827));if(_0x5b3827[_0x6cf6('0xf')]){if(_0x5b3827['error']['code']===0x1f4){logger['error'](_0x6cf6('0x10'),_0x94c6a9,_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);return _0x748c93(_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);}logger[_0x6cf6('0xf')]('ZendeskField,\x20%s,\x20%s',_0x94c6a9,_0x5b3827[_0x6cf6('0xf')]['message']);return _0x36b892(_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);}else{logger['info'](_0x6cf6('0x10'),_0x94c6a9,_0x6cf6('0xc'));_0x36b892(_0x5b3827[_0x6cf6('0x12')][_0x6cf6('0x11')]);}})[_0x6cf6('0x13')](function(_0x2bdb12){logger[_0x6cf6('0xf')](_0x6cf6('0x10'),_0x94c6a9,_0x2bdb12);_0x748c93(_0x2bdb12);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 6e72c88..a9ff789 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 _0xd7d1=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','delete','exports','multer','util'];(function(_0x107267,_0x1bcc4f){var _0x261669=function(_0xbcee32){while(--_0xbcee32){_0x107267['push'](_0x107267['shift']());}};_0x261669(++_0x1bcc4f);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x44f824,_0xc126dd){_0x44f824=_0x44f824-0x0;var _0x1265fe=_0xd7d1[_0x44f824];return _0x1265fe;};'use strict';var multer=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var path=require(_0x1d7d('0x2'));var timeout=require(_0x1d7d('0x3'));var express=require(_0x1d7d('0x4'));var router=express[_0x1d7d('0x5')]();var auth=require(_0x1d7d('0x6'));var interaction=require(_0x1d7d('0x7'));var config=require(_0x1d7d('0x8'));var controller=require(_0x1d7d('0x9'));router[_0x1d7d('0xa')]('/',auth[_0x1d7d('0xb')](),controller[_0x1d7d('0xc')]);router['get'](_0x1d7d('0xd'),auth[_0x1d7d('0xb')](),controller[_0x1d7d('0xe')]);router[_0x1d7d('0xa')](_0x1d7d('0xf'),auth[_0x1d7d('0xb')](),controller[_0x1d7d('0x10')]);router[_0x1d7d('0xa')](_0x1d7d('0x11'),auth[_0x1d7d('0xb')](),controller[_0x1d7d('0x12')]);router['post']('/',auth[_0x1d7d('0xb')](),controller['create']);router[_0x1d7d('0x13')](_0x1d7d('0xf'),auth[_0x1d7d('0xb')](),controller[_0x1d7d('0x14')]);router['put'](_0x1d7d('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x1d7d('0x15')](_0x1d7d('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x1d7d('0x16')]=router; \ No newline at end of file +var _0x3266=['isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','/:id/configurations'];(function(_0x2204aa,_0x214531){var _0x2d977f=function(_0x32979b){while(--_0x32979b){_0x2204aa['push'](_0x2204aa['shift']());}};_0x2d977f(++_0x214531);}(_0x3266,0x6a));var _0x6326=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0x3266[_0xdd2bfa];return _0x55397e;};'use strict';var multer=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var path=require(_0x6326('0x2'));var timeout=require(_0x6326('0x3'));var express=require(_0x6326('0x4'));var router=express[_0x6326('0x5')]();var auth=require(_0x6326('0x6'));var interaction=require(_0x6326('0x7'));var config=require(_0x6326('0x8'));var controller=require('./intZohoAccount.controller');router[_0x6326('0x9')]('/',auth['isAuthenticated'](),controller[_0x6326('0xa')]);router[_0x6326('0x9')](_0x6326('0xb'),auth['isAuthenticated'](),controller[_0x6326('0xc')]);router['get'](_0x6326('0xd'),auth[_0x6326('0xe')](),controller[_0x6326('0xf')]);router[_0x6326('0x9')](_0x6326('0x10'),auth['isAuthenticated'](),controller[_0x6326('0x11')]);router[_0x6326('0x12')]('/',auth[_0x6326('0xe')](),controller[_0x6326('0x13')]);router[_0x6326('0x12')](_0x6326('0xd'),auth[_0x6326('0xe')](),controller[_0x6326('0x14')]);router[_0x6326('0x15')](_0x6326('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x6326('0x16')](_0x6326('0xb'),auth['isAuthenticated'](),controller[_0x6326('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 492d717..490738a 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 _0x92db=['STRING','exports'];(function(_0x2fdf82,_0x322e7c){var _0x2382f5=function(_0x4d6951){while(--_0x4d6951){_0x2fdf82['push'](_0x2fdf82['shift']());}};_0x2382f5(++_0x322e7c);}(_0x92db,0x7d));var _0xb92d=function(_0xb21845,_0x23d114){_0xb21845=_0xb21845-0x0;var _0x9dc925=_0x92db[_0xb21845];return _0x9dc925;};'use strict';var Sequelize=require('sequelize');module[_0xb92d('0x0')]={'name':{'type':Sequelize[_0xb92d('0x1')]},'description':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xb92d('0x1')]},'host':{'type':Sequelize[_0xb92d('0x1')]},'serverUrl':{'type':Sequelize[_0xb92d('0x1')]}}; \ No newline at end of file +var _0x2d2a=['STRING','exports'];(function(_0xcab64a,_0x3d8c75){var _0x36aa18=function(_0x1dde25){while(--_0x1dde25){_0xcab64a['push'](_0xcab64a['shift']());}};_0x36aa18(++_0x3d8c75);}(_0x2d2a,0xeb));var _0xa2d2=function(_0x86a77a,_0x8fbafc){_0x86a77a=_0x86a77a-0x0;var _0x1d16d4=_0x2d2a[_0x86a77a];return _0x1d16d4;};'use strict';var Sequelize=require('sequelize');module[_0xa2d2('0x0')]={'name':{'type':Sequelize[_0xa2d2('0x1')]},'description':{'type':Sequelize[_0xa2d2('0x1')]},'authToken':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xa2d2('0x1')]},'serverUrl':{'type':Sequelize[_0xa2d2('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index c2d1f2d..d1c2270 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 _0x5f10=['ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','apply','reject','update','destroy','stack','name','send','index','ZohoAccount','rawAttributes','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','map','type','VIRTUAL','field','options','findAll','show','params','includeAll','find','create','body','getConfigurations','findOne','order','addConfiguration','Subjects','getSubjects','getDescriptions','channel','ZohoConfiguration','ZohoField','Descriptions','getFields','host','slice','substring','lastIndexOf','GET','format','https://crm.%s/crm/private/json/Calls/getFields','authToken','crmapi','response','Calls','section','Call\x20Purpose','includes','push','customfield','true','val','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware'];(function(_0x13fcf3,_0x4d3dde){var _0x3a0e8d=function(_0xec17c3){while(--_0xec17c3){_0x13fcf3['push'](_0x13fcf3['shift']());}};_0x3a0e8d(++_0x4d3dde);}(_0x5f10,0xd5));var _0x05f1=function(_0x134de4,_0x49c839){_0x134de4=_0x134de4-0x0;var _0xe97f36=_0x5f10[_0x134de4];return _0xe97f36;};'use strict';var pdf=require(_0x05f1('0x0'));var emlformat=require(_0x05f1('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x05f1('0x2'));var moment=require(_0x05f1('0x3'));var BPromise=require(_0x05f1('0x4'));var Mustache=require(_0x05f1('0x5'));var util=require(_0x05f1('0x6'));var path=require(_0x05f1('0x7'));var sox=require('sox');var csv=require(_0x05f1('0x8'));var ejs=require(_0x05f1('0x9'));var fs=require('fs');var _=require(_0x05f1('0xa'));var squel=require('squel');var crypto=require(_0x05f1('0xb'));var jsforce=require(_0x05f1('0xc'));var deskjs=require(_0x05f1('0xd'));var toCsv=require(_0x05f1('0x8'));var querystring=require(_0x05f1('0xe'));var Papa=require(_0x05f1('0xf'));var authService=require('../../components/auth/service');var hardwareService=require(_0x05f1('0x10'));var Redis=require(_0x05f1('0x11'));var qs=require(_0x05f1('0x12'));var logger=require(_0x05f1('0x13'))(_0x05f1('0x14'));var utils=require(_0x05f1('0x15'));var config=require('../../config/environment');var db=require(_0x05f1('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x05f1('0x17'));var client=jayson[_0x05f1('0x18')][_0x05f1('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x150ba4,_0x7b194a,_0x3497ae,_0x1367de){return new BPromise(function(_0x1fae83,_0x407c6d){var _0x5b47c7=_0x1367de||client;return _0x5b47c7[_0x05f1('0x1a')](_0x150ba4,_0x3497ae)[_0x05f1('0x1b')](function(_0x12c403){logger[_0x05f1('0x1c')]('ZohoAccount,\x20%s,\x20%s',_0x7b194a,_0x05f1('0x1d'));logger[_0x05f1('0x1e')](_0x05f1('0x1f'),_0x7b194a,_0x05f1('0x1d'),JSON[_0x05f1('0x20')](_0x12c403));if(_0x12c403[_0x05f1('0x21')]){if(_0x12c403[_0x05f1('0x21')][_0x05f1('0x22')]===0x1f4){logger[_0x05f1('0x21')](_0x05f1('0x23'),_0x7b194a,_0x12c403[_0x05f1('0x21')][_0x05f1('0x24')]);return _0x407c6d(_0x12c403[_0x05f1('0x21')][_0x05f1('0x24')]);}logger['error'](_0x05f1('0x23'),_0x7b194a,_0x12c403[_0x05f1('0x21')][_0x05f1('0x24')]);return _0x1fae83(_0x12c403[_0x05f1('0x21')][_0x05f1('0x24')]);}else{logger['info'](_0x05f1('0x23'),_0x7b194a,_0x05f1('0x1d'));_0x1fae83(_0x12c403['result'][_0x05f1('0x24')]);}})[_0x05f1('0x25')](function(_0x15abec){logger[_0x05f1('0x21')]('ZohoAccount,\x20%s,\x20%s',_0x7b194a,_0x15abec);_0x407c6d(_0x15abec);});});}function respondWithStatusCode(_0x52ef80,_0x2ea7ba){_0x2ea7ba=_0x2ea7ba||0xcc;return function(_0x46eb59){if(_0x46eb59){return _0x52ef80[_0x05f1('0x26')](_0x2ea7ba);}return _0x52ef80[_0x05f1('0x27')](_0x2ea7ba)[_0x05f1('0x28')]();};}function respondWithResult(_0x594f10,_0x2722c9){_0x2722c9=_0x2722c9||0xc8;return function(_0x61148c){if(_0x61148c){return _0x594f10['status'](_0x2722c9)[_0x05f1('0x29')](_0x61148c);}};}function respondWithFilteredResult(_0x52bdca,_0x54e497){return function(_0x2ba26d){if(_0x2ba26d){var _0x3bce89=_0x2ba26d[_0x05f1('0x2a')],_0x472d00=_0x54e497['offset'],_0x2bdccf=_0x54e497[_0x05f1('0x2b')]+_0x54e497[_0x05f1('0x2c')],_0x6a37c5;if(_0x2bdccf>=_0x3bce89){_0x2bdccf=_0x3bce89;_0x6a37c5=0xc8;}else{_0x6a37c5=0xce;}_0x52bdca[_0x05f1('0x27')](_0x6a37c5);return _0x52bdca['set']('Content-Range',_0x472d00+'-'+_0x2bdccf+'/'+_0x3bce89)['json'](_0x2ba26d);}return null;};}function patchUpdates(_0xcda2b){return function(_0x1d0ac6){try{jsonpatch[_0x05f1('0x2d')](_0x1d0ac6,_0xcda2b,!![]);}catch(_0x143f0f){return BPromise[_0x05f1('0x2e')](_0x143f0f);}return _0x1d0ac6['save']();};}function saveUpdates(_0x4caffe,_0x5abc88){return function(_0x40ca01){if(_0x40ca01){return _0x40ca01[_0x05f1('0x2f')](_0x4caffe)[_0x05f1('0x1b')](function(_0x410ffb){return _0x410ffb;});}return null;};}function removeEntity(_0x31b3b7,_0xd88f8a){return function(_0x58c710){if(_0x58c710){return _0x58c710[_0x05f1('0x30')]()[_0x05f1('0x1b')](function(){_0x31b3b7['status'](0xcc)[_0x05f1('0x28')]();});}};}function handleEntityNotFound(_0x3057a5,_0x5f55bf){return function(_0x1099b2){if(!_0x1099b2){_0x3057a5[_0x05f1('0x26')](0x194);}return _0x1099b2;};}function handleError(_0x4f0585,_0x2b2951){_0x2b2951=_0x2b2951||0x1f4;return function(_0x5a0b40){logger['error'](_0x5a0b40[_0x05f1('0x31')]);if(_0x5a0b40[_0x05f1('0x32')]){delete _0x5a0b40[_0x05f1('0x32')];}_0x4f0585[_0x05f1('0x27')](_0x2b2951)[_0x05f1('0x33')](_0x5a0b40);};}exports[_0x05f1('0x34')]=function(_0xa95f44,_0xc61027){var _0x3e385f={},_0x398ebf={},_0x25fab6={'count':0x0,'rows':[]};var _0x574d88=db[_0x05f1('0x35')][_0x05f1('0x36')];_0x398ebf[_0x05f1('0x37')]=_[_0x05f1('0x38')](_0x574d88);_0x398ebf[_0x05f1('0x39')]=_[_0x05f1('0x38')](_0xa95f44[_0x05f1('0x39')]);_0x398ebf['filters']=_['intersection'](_0x398ebf['model'],_0x398ebf[_0x05f1('0x39')]);_0x3e385f[_0x05f1('0x3a')]=_[_0x05f1('0x3b')](_0x398ebf[_0x05f1('0x37')],qs[_0x05f1('0x3c')](_0xa95f44[_0x05f1('0x39')][_0x05f1('0x3c')]));_0x3e385f['attributes']=_0x3e385f[_0x05f1('0x3a')][_0x05f1('0x3d')]?_0x3e385f[_0x05f1('0x3a')]:_0x398ebf[_0x05f1('0x37')];if(!_0xa95f44['query'][_0x05f1('0x3e')](_0x05f1('0x3f'))){_0x3e385f[_0x05f1('0x2c')]=qs[_0x05f1('0x2c')](_0xa95f44[_0x05f1('0x39')][_0x05f1('0x2c')]);_0x3e385f[_0x05f1('0x2b')]=qs[_0x05f1('0x2b')](_0xa95f44[_0x05f1('0x39')][_0x05f1('0x2b')]);}_0x3e385f['order']=qs['sort'](_0xa95f44['query'][_0x05f1('0x40')]);_0x3e385f['where']=qs[_0x05f1('0x41')](_[_0x05f1('0x42')](_0xa95f44[_0x05f1('0x39')],_0x398ebf[_0x05f1('0x41')]));if(_0xa95f44[_0x05f1('0x39')][_0x05f1('0x43')]){_0x3e385f[_0x05f1('0x44')]=_[_0x05f1('0x45')](_0x3e385f[_0x05f1('0x44')],{'$or':_[_0x05f1('0x46')](_0x574d88,function(_0x12bb91){if(_0x12bb91[_0x05f1('0x47')]['key']!==_0x05f1('0x48')){var _0x2e77dd={};_0x2e77dd[_0x12bb91[_0x05f1('0x49')]]={'$like':'%'+_0xa95f44[_0x05f1('0x39')]['filter']+'%'};return _0x2e77dd;}})});}_0x3e385f=_['merge']({},_0x3e385f,_0xa95f44[_0x05f1('0x4a')]);var _0x51c1c0={'where':_0x3e385f['where']};return db[_0x05f1('0x35')][_0x05f1('0x2a')](_0x51c1c0)['then'](function(_0x34eb60){_0x25fab6[_0x05f1('0x2a')]=_0x34eb60;if(_0xa95f44[_0x05f1('0x39')]['includeAll']){_0x3e385f['include']=[{'all':!![]}];}return db[_0x05f1('0x35')][_0x05f1('0x4b')](_0x3e385f);})[_0x05f1('0x1b')](function(_0x5ac4c9){_0x25fab6['rows']=_0x5ac4c9;return _0x25fab6;})['then'](respondWithFilteredResult(_0xc61027,_0x3e385f))[_0x05f1('0x25')](handleError(_0xc61027,null));};exports[_0x05f1('0x4c')]=function(_0x294ff8,_0x4abde7){var _0x2a27dc={'raw':![],'where':{'id':_0x294ff8[_0x05f1('0x4d')]['id']}},_0x52d7aa={};_0x52d7aa[_0x05f1('0x37')]=_['keys'](db[_0x05f1('0x35')][_0x05f1('0x36')]);_0x52d7aa[_0x05f1('0x39')]=_[_0x05f1('0x38')](_0x294ff8['query']);_0x52d7aa[_0x05f1('0x41')]=_[_0x05f1('0x3b')](_0x52d7aa[_0x05f1('0x37')],_0x52d7aa[_0x05f1('0x39')]);_0x2a27dc[_0x05f1('0x3a')]=_[_0x05f1('0x3b')](_0x52d7aa['model'],qs['fields'](_0x294ff8[_0x05f1('0x39')][_0x05f1('0x3c')]));_0x2a27dc['attributes']=_0x2a27dc[_0x05f1('0x3a')]['length']?_0x2a27dc[_0x05f1('0x3a')]:_0x52d7aa[_0x05f1('0x37')];if(_0x294ff8['query'][_0x05f1('0x4e')]){_0x2a27dc['include']=[{'all':!![]}];}_0x2a27dc=_['merge']({},_0x2a27dc,_0x294ff8['options']);return db[_0x05f1('0x35')][_0x05f1('0x4f')](_0x2a27dc)['then'](handleEntityNotFound(_0x4abde7,null))[_0x05f1('0x1b')](respondWithResult(_0x4abde7,null))[_0x05f1('0x25')](handleError(_0x4abde7,null));};exports[_0x05f1('0x50')]=function(_0x337f9b,_0x2395ad){return db[_0x05f1('0x35')][_0x05f1('0x50')](_0x337f9b[_0x05f1('0x51')],{})[_0x05f1('0x1b')](respondWithResult(_0x2395ad,0xc9))[_0x05f1('0x25')](handleError(_0x2395ad,null));};exports['update']=function(_0x5d5af6,_0x4d1fbd){if(_0x5d5af6['body']['id']){delete _0x5d5af6[_0x05f1('0x51')]['id'];}return db[_0x05f1('0x35')][_0x05f1('0x4f')]({'where':{'id':_0x5d5af6[_0x05f1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4d1fbd,null))['then'](saveUpdates(_0x5d5af6[_0x05f1('0x51')],null))[_0x05f1('0x1b')](respondWithResult(_0x4d1fbd,null))[_0x05f1('0x25')](handleError(_0x4d1fbd,null));};exports[_0x05f1('0x30')]=function(_0x1de8e2,_0xb7571b){return db['ZohoAccount'][_0x05f1('0x4f')]({'where':{'id':_0x1de8e2[_0x05f1('0x4d')]['id']}})[_0x05f1('0x1b')](handleEntityNotFound(_0xb7571b,null))['then'](removeEntity(_0xb7571b,null))[_0x05f1('0x25')](handleError(_0xb7571b,null));};exports[_0x05f1('0x52')]=function(_0x56ee93,_0x43a8a9,_0x3154a2){var _0x9f49c8={};var _0x1fb3b1={};var _0x19a438;var _0x49a565;return db[_0x05f1('0x35')][_0x05f1('0x53')]({'where':{'id':_0x56ee93['params']['id']}})[_0x05f1('0x1b')](handleEntityNotFound(_0x43a8a9,null))['then'](function(_0x2c78db){if(_0x2c78db){_0x19a438=_0x2c78db;_0x1fb3b1[_0x05f1('0x37')]=_[_0x05f1('0x38')](db['ZohoConfiguration'][_0x05f1('0x36')]);_0x1fb3b1[_0x05f1('0x39')]=_['keys'](_0x56ee93[_0x05f1('0x39')]);_0x1fb3b1[_0x05f1('0x41')]=_[_0x05f1('0x3b')](_0x1fb3b1[_0x05f1('0x37')],_0x1fb3b1[_0x05f1('0x39')]);_0x9f49c8['attributes']=_[_0x05f1('0x3b')](_0x1fb3b1[_0x05f1('0x37')],qs[_0x05f1('0x3c')](_0x56ee93[_0x05f1('0x39')][_0x05f1('0x3c')]));_0x9f49c8['attributes']=_0x9f49c8[_0x05f1('0x3a')][_0x05f1('0x3d')]?_0x9f49c8['attributes']:_0x1fb3b1[_0x05f1('0x37')];_0x9f49c8[_0x05f1('0x54')]=qs['sort'](_0x56ee93['query'][_0x05f1('0x40')]);_0x9f49c8[_0x05f1('0x44')]=qs[_0x05f1('0x41')](_[_0x05f1('0x42')](_0x56ee93[_0x05f1('0x39')],_0x1fb3b1[_0x05f1('0x41')]));if(_0x56ee93[_0x05f1('0x39')][_0x05f1('0x43')]){_0x9f49c8[_0x05f1('0x44')]=_[_0x05f1('0x45')](_0x9f49c8[_0x05f1('0x44')],{'$or':_[_0x05f1('0x46')](_0x9f49c8['attributes'],function(_0x3eee41){var _0x2956c2={};_0x2956c2[_0x3eee41]={'$like':'%'+_0x56ee93[_0x05f1('0x39')][_0x05f1('0x43')]+'%'};return _0x2956c2;})});}_0x9f49c8=_['merge']({},_0x9f49c8,_0x56ee93[_0x05f1('0x4a')]);return _0x19a438[_0x05f1('0x52')](_0x9f49c8);}})[_0x05f1('0x1b')](function(_0x16e3d4){if(_0x16e3d4){_0x49a565=_0x16e3d4[_0x05f1('0x3d')];if(!_0x56ee93[_0x05f1('0x39')][_0x05f1('0x3e')]('nolimit')){_0x9f49c8['limit']=qs[_0x05f1('0x2c')](_0x56ee93['query'][_0x05f1('0x2c')]);_0x9f49c8['offset']=qs['offset'](_0x56ee93['query']['offset']);}return _0x19a438['getConfigurations'](_0x9f49c8);}})[_0x05f1('0x1b')](function(_0x174de8){if(_0x174de8){return _0x174de8?{'count':_0x49a565,'rows':_0x174de8}:null;}})[_0x05f1('0x1b')](respondWithResult(_0x43a8a9,null))['catch'](handleError(_0x43a8a9,null));};exports[_0x05f1('0x55')]=function(_0x3278cb,_0x1470e4,_0x265a1a){if(_0x3278cb[_0x05f1('0x51')]['id']){delete _0x3278cb[_0x05f1('0x51')]['id'];}return db['ZohoAccount'][_0x05f1('0x53')]({'where':{'id':_0x3278cb[_0x05f1('0x4d')]['id']}})[_0x05f1('0x1b')](handleEntityNotFound(_0x1470e4,null))[_0x05f1('0x1b')](function(_0x395bf5){if(_0x395bf5){_0x3278cb[_0x05f1('0x51')]['AccountId']=_0x395bf5['id'];_0x3278cb['body'][_0x05f1('0x56')]=integrations[_0x05f1('0x57')](_0x3278cb[_0x05f1('0x51')]['channel'],_0x3278cb[_0x05f1('0x51')][_0x05f1('0x47')]);_0x3278cb[_0x05f1('0x51')]['Descriptions']=integrations[_0x05f1('0x58')](_0x3278cb[_0x05f1('0x51')][_0x05f1('0x59')],_0x3278cb[_0x05f1('0x51')][_0x05f1('0x47')]);return db[_0x05f1('0x5a')][_0x05f1('0x50')](_0x3278cb['body'],{'include':[{'model':db[_0x05f1('0x5b')],'as':_0x05f1('0x56')},{'model':db[_0x05f1('0x5b')],'as':_0x05f1('0x5c')}]});}return null;})['then'](respondWithResult(_0x1470e4,null))[_0x05f1('0x25')](handleError(_0x1470e4,null));};exports[_0x05f1('0x5d')]=function(_0x4220ad,_0x208bc2,_0x46c006){var _0x2c5641='';return db[_0x05f1('0x35')][_0x05f1('0x53')]({'where':{'id':_0x4220ad[_0x05f1('0x4d')]['id']},'attributes':['id',_0x05f1('0x5e'),'authToken']})['then'](handleEntityNotFound(_0x208bc2,null))[_0x05f1('0x1b')](function(_0x13053d){if(_0x13053d){_0x2c5641=_0x13053d[_0x05f1('0x5e')];var _0x46bc31=_0x2c5641[_0x05f1('0x5f')](-0x1);if(_0x46bc31==='/'){_0x2c5641=_0x2c5641[_0x05f1('0x60')](0x0,_0x2c5641[_0x05f1('0x61')](_0x46bc31));}return rp({'method':_0x05f1('0x62'),'uri':util[_0x05f1('0x63')](_0x05f1('0x64'),_0x2c5641),'qs':{'authtoken':_0x13053d[_0x05f1('0x65')],'scope':_0x05f1('0x66')},'json':!![]});}})[_0x05f1('0x1b')](function(_0x48830b){if(_0x48830b){if(_0x48830b[_0x05f1('0x67')]&&_0x48830b['response'][_0x05f1('0x21')]){throw new Error(_0x48830b[_0x05f1('0x67')][_0x05f1('0x21')][_0x05f1('0x24')]);}var _0x321b20=[];if(_0x48830b[_0x05f1('0x68')]&&_0x48830b['Calls'][_0x05f1('0x69')]){if(_0x48830b[_0x05f1('0x68')][_0x05f1('0x69')]['FL']){var _0x272fba=[_0x05f1('0x6a')];for(var _0x5b8cd8=0x0,_0xf0eb0b=_0x48830b['Calls'][_0x05f1('0x69')]['FL'][_0x05f1('0x3d')];_0x5b8cd8<_0xf0eb0b;_0x5b8cd8++){if(_[_0x05f1('0x6b')](_0x272fba,_0x48830b[_0x05f1('0x68')][_0x05f1('0x69')]['FL'][_0x5b8cd8]['dv'])){_0x321b20[_0x05f1('0x6c')]({'id':_0x48830b['Calls'][_0x05f1('0x69')]['FL'][_0x5b8cd8]['dv'],'name':_0x48830b[_0x05f1('0x68')][_0x05f1('0x69')]['FL'][_0x5b8cd8]['label'],'custom':_0x48830b[_0x05f1('0x68')][_0x05f1('0x69')]['FL'][_0x5b8cd8][_0x05f1('0x6d')]===_0x05f1('0x6e')?!![]:![],'options':_0x48830b[_0x05f1('0x68')][_0x05f1('0x69')]['FL'][_0x5b8cd8][_0x05f1('0x47')]==='Pick\x20List'&&_0x48830b[_0x05f1('0x68')][_0x05f1('0x69')]['FL'][_0x5b8cd8][_0x05f1('0x6f')]?_[_0x05f1('0x46')](_0x48830b[_0x05f1('0x68')]['section']['FL'][_0x5b8cd8][_0x05f1('0x6f')],function(_0x362aaf){return{'name':_0x362aaf,'value':_0x362aaf};}):[]});}}}}return{'count':_0x321b20[_0x05f1('0x3d')],'rows':_0x321b20};}})['then'](respondWithResult(_0x208bc2,null))[_0x05f1('0x25')](function(_0x1addc3){var _0x4a9f95=_0x4220ad[_0x05f1('0x39')][_0x05f1('0x70')]?0x1f4:_0x1addc3[_0x05f1('0x71')]||0x1f4;logger[_0x05f1('0x21')](_0x05f1('0x72'),_0x05f1('0x5d'),_0x4a9f95,JSON[_0x05f1('0x20')](_0x1addc3));delete _0x1addc3[_0x05f1('0x32')];if(_0x4a9f95===0x191){_0x4a9f95=0x190;}_0x208bc2[_0x05f1('0x27')](_0x4a9f95)[_0x05f1('0x33')](_0x4220ad[_0x05f1('0x39')][_0x05f1('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x1addc3['statusCode']}:_0x1addc3);});}; \ No newline at end of file +var _0x971d=['../../mysqldb','../../components/integrations/configuration','client','request','then','info','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','reject','update','destroy','stack','name','send','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','type','key','VIRTUAL','merge','options','includeAll','include','ZohoAccount','findAll','rows','show','params','create','find','body','findOne','map','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','ZohoConfiguration','ZohoField','getFields','host','authToken','slice','substring','GET','https://crm.%s/crm/private/json/Calls/getFields','response','Calls','section','Call\x20Purpose','includes','push','true','Pick\x20List','val','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment'];(function(_0x62af84,_0x3c8214){var _0x583814=function(_0x3ecbb0){while(--_0x3ecbb0){_0x62af84['push'](_0x62af84['shift']());}};_0x583814(++_0x3c8214);}(_0x971d,0xc5));var _0xd971=function(_0x2033de,_0x296c41){_0x2033de=_0x2033de-0x0;var _0x451303=_0x971d[_0x2033de];return _0x451303;};'use strict';var pdf=require(_0xd971('0x0'));var emlformat=require(_0xd971('0x1'));var rimraf=require(_0xd971('0x2'));var zipdir=require(_0xd971('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd971('0x4'));var moment=require('moment');var BPromise=require(_0xd971('0x5'));var Mustache=require(_0xd971('0x6'));var util=require(_0xd971('0x7'));var path=require(_0xd971('0x8'));var sox=require(_0xd971('0x9'));var csv=require(_0xd971('0xa'));var ejs=require(_0xd971('0xb'));var fs=require('fs');var _=require(_0xd971('0xc'));var squel=require(_0xd971('0xd'));var crypto=require(_0xd971('0xe'));var jsforce=require(_0xd971('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd971('0xa'));var querystring=require(_0xd971('0x10'));var Papa=require('papaparse');var authService=require(_0xd971('0x11'));var hardwareService=require(_0xd971('0x12'));var Redis=require(_0xd971('0x13'));var qs=require(_0xd971('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd971('0x15'));var config=require(_0xd971('0x16'));var db=require(_0xd971('0x17'))['db'];var integrations=require(_0xd971('0x18'));var jayson=require('jayson/promise');var client=jayson[_0xd971('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20b260,_0xd6c6f3,_0x555903,_0x45fbcb){return new BPromise(function(_0x4d0f72,_0x384951){var _0x475905=_0x45fbcb||client;return _0x475905[_0xd971('0x1a')](_0x20b260,_0x555903)[_0xd971('0x1b')](function(_0x223ff0){logger[_0xd971('0x1c')]('ZohoAccount,\x20%s,\x20%s',_0xd6c6f3,_0xd971('0x1d'));logger['debug'](_0xd971('0x1e'),_0xd6c6f3,_0xd971('0x1d'),JSON[_0xd971('0x1f')](_0x223ff0));if(_0x223ff0['error']){if(_0x223ff0[_0xd971('0x20')][_0xd971('0x21')]===0x1f4){logger[_0xd971('0x20')](_0xd971('0x22'),_0xd6c6f3,_0x223ff0[_0xd971('0x20')]['message']);return _0x384951(_0x223ff0[_0xd971('0x20')]['message']);}logger['error'](_0xd971('0x22'),_0xd6c6f3,_0x223ff0['error'][_0xd971('0x23')]);return _0x4d0f72(_0x223ff0['error'][_0xd971('0x23')]);}else{logger[_0xd971('0x1c')](_0xd971('0x22'),_0xd6c6f3,_0xd971('0x1d'));_0x4d0f72(_0x223ff0[_0xd971('0x24')][_0xd971('0x23')]);}})[_0xd971('0x25')](function(_0x465a1b){logger[_0xd971('0x20')](_0xd971('0x22'),_0xd6c6f3,_0x465a1b);_0x384951(_0x465a1b);});});}function respondWithStatusCode(_0x61b160,_0x41b41f){_0x41b41f=_0x41b41f||0xcc;return function(_0x168474){if(_0x168474){return _0x61b160[_0xd971('0x26')](_0x41b41f);}return _0x61b160[_0xd971('0x27')](_0x41b41f)[_0xd971('0x28')]();};}function respondWithResult(_0x2df904,_0x17759e){_0x17759e=_0x17759e||0xc8;return function(_0x4d0c81){if(_0x4d0c81){return _0x2df904[_0xd971('0x27')](_0x17759e)[_0xd971('0x29')](_0x4d0c81);}};}function respondWithFilteredResult(_0x2b8c4d,_0x1ac8b6){return function(_0x26b353){if(_0x26b353){var _0x37c540=_0x26b353[_0xd971('0x2a')],_0x15e9d9=_0x1ac8b6[_0xd971('0x2b')],_0x257ffc=_0x1ac8b6[_0xd971('0x2b')]+_0x1ac8b6[_0xd971('0x2c')],_0x1c1986;if(_0x257ffc>=_0x37c540){_0x257ffc=_0x37c540;_0x1c1986=0xc8;}else{_0x1c1986=0xce;}_0x2b8c4d[_0xd971('0x27')](_0x1c1986);return _0x2b8c4d['set']('Content-Range',_0x15e9d9+'-'+_0x257ffc+'/'+_0x37c540)[_0xd971('0x29')](_0x26b353);}return null;};}function patchUpdates(_0x23d384){return function(_0x52973c){try{jsonpatch['apply'](_0x52973c,_0x23d384,!![]);}catch(_0x2ac98a){return BPromise[_0xd971('0x2d')](_0x2ac98a);}return _0x52973c['save']();};}function saveUpdates(_0x4b70cf,_0x2bee16){return function(_0xbfdf5a){if(_0xbfdf5a){return _0xbfdf5a[_0xd971('0x2e')](_0x4b70cf)[_0xd971('0x1b')](function(_0x24ee90){return _0x24ee90;});}return null;};}function removeEntity(_0x486930,_0x1695b9){return function(_0x25dbe5){if(_0x25dbe5){return _0x25dbe5[_0xd971('0x2f')]()[_0xd971('0x1b')](function(){_0x486930[_0xd971('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5062b0,_0x11c360){return function(_0x4c379b){if(!_0x4c379b){_0x5062b0[_0xd971('0x26')](0x194);}return _0x4c379b;};}function handleError(_0x29ae92,_0x5530e0){_0x5530e0=_0x5530e0||0x1f4;return function(_0xa7c418){logger[_0xd971('0x20')](_0xa7c418[_0xd971('0x30')]);if(_0xa7c418[_0xd971('0x31')]){delete _0xa7c418[_0xd971('0x31')];}_0x29ae92[_0xd971('0x27')](_0x5530e0)[_0xd971('0x32')](_0xa7c418);};}exports['index']=function(_0x382842,_0x22aa1d){var _0x5623b0={},_0x22edeb={},_0x21beff={'count':0x0,'rows':[]};var _0x2c6905=db['ZohoAccount'][_0xd971('0x33')];_0x22edeb[_0xd971('0x34')]=_[_0xd971('0x35')](_0x2c6905);_0x22edeb[_0xd971('0x36')]=_[_0xd971('0x35')](_0x382842[_0xd971('0x36')]);_0x22edeb[_0xd971('0x37')]=_[_0xd971('0x38')](_0x22edeb['model'],_0x22edeb[_0xd971('0x36')]);_0x5623b0[_0xd971('0x39')]=_[_0xd971('0x38')](_0x22edeb[_0xd971('0x34')],qs['fields'](_0x382842[_0xd971('0x36')][_0xd971('0x3a')]));_0x5623b0[_0xd971('0x39')]=_0x5623b0[_0xd971('0x39')][_0xd971('0x3b')]?_0x5623b0[_0xd971('0x39')]:_0x22edeb[_0xd971('0x34')];if(!_0x382842[_0xd971('0x36')][_0xd971('0x3c')]('nolimit')){_0x5623b0[_0xd971('0x2c')]=qs[_0xd971('0x2c')](_0x382842[_0xd971('0x36')][_0xd971('0x2c')]);_0x5623b0[_0xd971('0x2b')]=qs[_0xd971('0x2b')](_0x382842[_0xd971('0x36')][_0xd971('0x2b')]);}_0x5623b0[_0xd971('0x3d')]=qs[_0xd971('0x3e')](_0x382842[_0xd971('0x36')][_0xd971('0x3e')]);_0x5623b0['where']=qs[_0xd971('0x37')](_[_0xd971('0x3f')](_0x382842[_0xd971('0x36')],_0x22edeb[_0xd971('0x37')]));if(_0x382842['query'][_0xd971('0x40')]){_0x5623b0[_0xd971('0x41')]=_['merge'](_0x5623b0[_0xd971('0x41')],{'$or':_['map'](_0x2c6905,function(_0x4aea2c){if(_0x4aea2c[_0xd971('0x42')][_0xd971('0x43')]!==_0xd971('0x44')){var _0x57cf41={};_0x57cf41[_0x4aea2c['field']]={'$like':'%'+_0x382842['query']['filter']+'%'};return _0x57cf41;}})});}_0x5623b0=_[_0xd971('0x45')]({},_0x5623b0,_0x382842[_0xd971('0x46')]);var _0x52617c={'where':_0x5623b0[_0xd971('0x41')]};return db['ZohoAccount'][_0xd971('0x2a')](_0x52617c)['then'](function(_0x3b8b25){_0x21beff['count']=_0x3b8b25;if(_0x382842[_0xd971('0x36')][_0xd971('0x47')]){_0x5623b0[_0xd971('0x48')]=[{'all':!![]}];}return db[_0xd971('0x49')][_0xd971('0x4a')](_0x5623b0);})[_0xd971('0x1b')](function(_0x5e5cd2){_0x21beff[_0xd971('0x4b')]=_0x5e5cd2;return _0x21beff;})[_0xd971('0x1b')](respondWithFilteredResult(_0x22aa1d,_0x5623b0))[_0xd971('0x25')](handleError(_0x22aa1d,null));};exports[_0xd971('0x4c')]=function(_0x1d4a94,_0x2d4c30){var _0x17f0c8={'raw':![],'where':{'id':_0x1d4a94[_0xd971('0x4d')]['id']}},_0x530e9f={};_0x530e9f[_0xd971('0x34')]=_[_0xd971('0x35')](db[_0xd971('0x49')][_0xd971('0x33')]);_0x530e9f['query']=_[_0xd971('0x35')](_0x1d4a94[_0xd971('0x36')]);_0x530e9f[_0xd971('0x37')]=_['intersection'](_0x530e9f[_0xd971('0x34')],_0x530e9f[_0xd971('0x36')]);_0x17f0c8[_0xd971('0x39')]=_[_0xd971('0x38')](_0x530e9f[_0xd971('0x34')],qs[_0xd971('0x3a')](_0x1d4a94['query'][_0xd971('0x3a')]));_0x17f0c8[_0xd971('0x39')]=_0x17f0c8[_0xd971('0x39')]['length']?_0x17f0c8[_0xd971('0x39')]:_0x530e9f[_0xd971('0x34')];if(_0x1d4a94[_0xd971('0x36')][_0xd971('0x47')]){_0x17f0c8[_0xd971('0x48')]=[{'all':!![]}];}_0x17f0c8=_['merge']({},_0x17f0c8,_0x1d4a94[_0xd971('0x46')]);return db['ZohoAccount']['find'](_0x17f0c8)[_0xd971('0x1b')](handleEntityNotFound(_0x2d4c30,null))[_0xd971('0x1b')](respondWithResult(_0x2d4c30,null))[_0xd971('0x25')](handleError(_0x2d4c30,null));};exports[_0xd971('0x4e')]=function(_0x10faaf,_0x2c0d18){return db['ZohoAccount'][_0xd971('0x4e')](_0x10faaf['body'],{})['then'](respondWithResult(_0x2c0d18,0xc9))[_0xd971('0x25')](handleError(_0x2c0d18,null));};exports[_0xd971('0x2e')]=function(_0x44baa2,_0x4842cd){if(_0x44baa2['body']['id']){delete _0x44baa2['body']['id'];}return db[_0xd971('0x49')][_0xd971('0x4f')]({'where':{'id':_0x44baa2['params']['id']}})[_0xd971('0x1b')](handleEntityNotFound(_0x4842cd,null))[_0xd971('0x1b')](saveUpdates(_0x44baa2[_0xd971('0x50')],null))[_0xd971('0x1b')](respondWithResult(_0x4842cd,null))[_0xd971('0x25')](handleError(_0x4842cd,null));};exports[_0xd971('0x2f')]=function(_0x336f1d,_0x33f565){return db[_0xd971('0x49')][_0xd971('0x4f')]({'where':{'id':_0x336f1d[_0xd971('0x4d')]['id']}})[_0xd971('0x1b')](handleEntityNotFound(_0x33f565,null))[_0xd971('0x1b')](removeEntity(_0x33f565,null))[_0xd971('0x25')](handleError(_0x33f565,null));};exports['getConfigurations']=function(_0x5cf1bb,_0x55f23a,_0x5dafbf){var _0x189bd5={};var _0x499bb6={};var _0x1e9b0a;var _0x6a5100;return db[_0xd971('0x49')][_0xd971('0x51')]({'where':{'id':_0x5cf1bb[_0xd971('0x4d')]['id']}})[_0xd971('0x1b')](handleEntityNotFound(_0x55f23a,null))['then'](function(_0x427f71){if(_0x427f71){_0x1e9b0a=_0x427f71;_0x499bb6[_0xd971('0x34')]=_[_0xd971('0x35')](db['ZohoConfiguration'][_0xd971('0x33')]);_0x499bb6['query']=_[_0xd971('0x35')](_0x5cf1bb[_0xd971('0x36')]);_0x499bb6[_0xd971('0x37')]=_[_0xd971('0x38')](_0x499bb6['model'],_0x499bb6[_0xd971('0x36')]);_0x189bd5[_0xd971('0x39')]=_[_0xd971('0x38')](_0x499bb6[_0xd971('0x34')],qs['fields'](_0x5cf1bb['query'][_0xd971('0x3a')]));_0x189bd5[_0xd971('0x39')]=_0x189bd5[_0xd971('0x39')][_0xd971('0x3b')]?_0x189bd5[_0xd971('0x39')]:_0x499bb6[_0xd971('0x34')];_0x189bd5[_0xd971('0x3d')]=qs['sort'](_0x5cf1bb[_0xd971('0x36')][_0xd971('0x3e')]);_0x189bd5[_0xd971('0x41')]=qs[_0xd971('0x37')](_[_0xd971('0x3f')](_0x5cf1bb[_0xd971('0x36')],_0x499bb6[_0xd971('0x37')]));if(_0x5cf1bb[_0xd971('0x36')][_0xd971('0x40')]){_0x189bd5[_0xd971('0x41')]=_[_0xd971('0x45')](_0x189bd5[_0xd971('0x41')],{'$or':_[_0xd971('0x52')](_0x189bd5[_0xd971('0x39')],function(_0x35067a){var _0x1b5e4b={};_0x1b5e4b[_0x35067a]={'$like':'%'+_0x5cf1bb['query'][_0xd971('0x40')]+'%'};return _0x1b5e4b;})});}_0x189bd5=_['merge']({},_0x189bd5,_0x5cf1bb[_0xd971('0x46')]);return _0x1e9b0a[_0xd971('0x53')](_0x189bd5);}})[_0xd971('0x1b')](function(_0x700f69){if(_0x700f69){_0x6a5100=_0x700f69[_0xd971('0x3b')];if(!_0x5cf1bb[_0xd971('0x36')][_0xd971('0x3c')]('nolimit')){_0x189bd5[_0xd971('0x2c')]=qs[_0xd971('0x2c')](_0x5cf1bb['query'][_0xd971('0x2c')]);_0x189bd5[_0xd971('0x2b')]=qs['offset'](_0x5cf1bb[_0xd971('0x36')][_0xd971('0x2b')]);}return _0x1e9b0a[_0xd971('0x53')](_0x189bd5);}})[_0xd971('0x1b')](function(_0x39e15c){if(_0x39e15c){return _0x39e15c?{'count':_0x6a5100,'rows':_0x39e15c}:null;}})['then'](respondWithResult(_0x55f23a,null))['catch'](handleError(_0x55f23a,null));};exports[_0xd971('0x54')]=function(_0x5f5b76,_0x51982f,_0x317a56){if(_0x5f5b76[_0xd971('0x50')]['id']){delete _0x5f5b76[_0xd971('0x50')]['id'];}return db[_0xd971('0x49')][_0xd971('0x51')]({'where':{'id':_0x5f5b76[_0xd971('0x4d')]['id']}})[_0xd971('0x1b')](handleEntityNotFound(_0x51982f,null))[_0xd971('0x1b')](function(_0x162b0b){if(_0x162b0b){_0x5f5b76['body']['AccountId']=_0x162b0b['id'];_0x5f5b76[_0xd971('0x50')][_0xd971('0x55')]=integrations[_0xd971('0x56')](_0x5f5b76[_0xd971('0x50')][_0xd971('0x57')],_0x5f5b76[_0xd971('0x50')][_0xd971('0x42')]);_0x5f5b76[_0xd971('0x50')][_0xd971('0x58')]=integrations['getDescriptions'](_0x5f5b76['body'][_0xd971('0x57')],_0x5f5b76[_0xd971('0x50')]['type']);return db[_0xd971('0x59')]['create'](_0x5f5b76[_0xd971('0x50')],{'include':[{'model':db[_0xd971('0x5a')],'as':'Subjects'},{'model':db[_0xd971('0x5a')],'as':_0xd971('0x58')}]});}return null;})['then'](respondWithResult(_0x51982f,null))[_0xd971('0x25')](handleError(_0x51982f,null));};exports[_0xd971('0x5b')]=function(_0x323252,_0xe69665,_0x5363d1){var _0x593301='';return db['ZohoAccount'][_0xd971('0x51')]({'where':{'id':_0x323252['params']['id']},'attributes':['id',_0xd971('0x5c'),_0xd971('0x5d')]})[_0xd971('0x1b')](handleEntityNotFound(_0xe69665,null))[_0xd971('0x1b')](function(_0x3d0709){if(_0x3d0709){_0x593301=_0x3d0709[_0xd971('0x5c')];var _0x852fdd=_0x593301[_0xd971('0x5e')](-0x1);if(_0x852fdd==='/'){_0x593301=_0x593301[_0xd971('0x5f')](0x0,_0x593301['lastIndexOf'](_0x852fdd));}return rp({'method':_0xd971('0x60'),'uri':util['format'](_0xd971('0x61'),_0x593301),'qs':{'authtoken':_0x3d0709[_0xd971('0x5d')],'scope':'crmapi'},'json':!![]});}})[_0xd971('0x1b')](function(_0x5d945a){if(_0x5d945a){if(_0x5d945a[_0xd971('0x62')]&&_0x5d945a[_0xd971('0x62')][_0xd971('0x20')]){throw new Error(_0x5d945a[_0xd971('0x62')][_0xd971('0x20')][_0xd971('0x23')]);}var _0x1eac10=[];if(_0x5d945a[_0xd971('0x63')]&&_0x5d945a[_0xd971('0x63')][_0xd971('0x64')]){if(_0x5d945a['Calls']['section']['FL']){var _0xa0e2fe=[_0xd971('0x65')];for(var _0x4fda36=0x0,_0x5b390a=_0x5d945a[_0xd971('0x63')][_0xd971('0x64')]['FL']['length'];_0x4fda36<_0x5b390a;_0x4fda36++){if(_[_0xd971('0x66')](_0xa0e2fe,_0x5d945a[_0xd971('0x63')][_0xd971('0x64')]['FL'][_0x4fda36]['dv'])){_0x1eac10[_0xd971('0x67')]({'id':_0x5d945a[_0xd971('0x63')][_0xd971('0x64')]['FL'][_0x4fda36]['dv'],'name':_0x5d945a['Calls'][_0xd971('0x64')]['FL'][_0x4fda36]['label'],'custom':_0x5d945a[_0xd971('0x63')]['section']['FL'][_0x4fda36]['customfield']===_0xd971('0x68')?!![]:![],'options':_0x5d945a[_0xd971('0x63')][_0xd971('0x64')]['FL'][_0x4fda36][_0xd971('0x42')]===_0xd971('0x69')&&_0x5d945a[_0xd971('0x63')][_0xd971('0x64')]['FL'][_0x4fda36][_0xd971('0x6a')]?_[_0xd971('0x52')](_0x5d945a[_0xd971('0x63')][_0xd971('0x64')]['FL'][_0x4fda36][_0xd971('0x6a')],function(_0x3887a2){return{'name':_0x3887a2,'value':_0x3887a2};}):[]});}}}}return{'count':_0x1eac10['length'],'rows':_0x1eac10};}})[_0xd971('0x1b')](respondWithResult(_0xe69665,null))[_0xd971('0x25')](function(_0x21ba1){var _0x48a80c=_0x323252['query'][_0xd971('0x6b')]?0x1f4:_0x21ba1[_0xd971('0x6c')]||0x1f4;logger[_0xd971('0x20')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x48a80c,JSON[_0xd971('0x1f')](_0x21ba1));delete _0x21ba1[_0xd971('0x31')];if(_0x48a80c===0x191){_0x48a80c=0x190;}_0xe69665['status'](_0x48a80c)[_0xd971('0x32')](_0x323252['query']['test']?{'message':_0xd971('0x6d'),'statusCode':_0x21ba1[_0xd971('0x6c')]}:_0x21ba1);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 89cea5e..cc58fad 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 _0xe71c=['moment','request-promise','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','lodash','../../config/logger'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xe71c,0x17a));var _0xce71=function(_0x19ac6e,_0x435862){_0x19ac6e=_0x19ac6e-0x0;var _0x1cdcf3=_0xe71c[_0x19ac6e];return _0x1cdcf3;};'use strict';var _=require(_0xce71('0x0'));var util=require('util');var logger=require(_0xce71('0x1'))('api');var moment=require(_0xce71('0x2'));var BPromise=require('bluebird');var rp=require(_0xce71('0x3'));var attributes=require(_0xce71('0x4'));var integrations=require(_0xce71('0x5'));module[_0xce71('0x6')]=function(_0x36d909,_0xa93e1a){return _0x36d909[_0xce71('0x7')](_0xce71('0x8'),attributes,{'tableName':_0xce71('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1c4=['request-promise','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','lodash','util','api','moment','bluebird'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd1c4,0x7f));var _0x4d1c=function(_0x24ec3f,_0xc7be9){_0x24ec3f=_0x24ec3f-0x0;var _0x4521b3=_0xd1c4[_0x24ec3f];return _0x4521b3;};'use strict';var _=require(_0x4d1c('0x0'));var util=require(_0x4d1c('0x1'));var logger=require('../../config/logger')(_0x4d1c('0x2'));var moment=require(_0x4d1c('0x3'));var BPromise=require(_0x4d1c('0x4'));var rp=require(_0x4d1c('0x5'));var attributes=require(_0x4d1c('0x6'));var integrations=require(_0x4d1c('0x7'));module[_0x4d1c('0x8')]=function(_0x1b2fa0,_0xac55f){return _0x1b2fa0[_0x4d1c('0x9')](_0x4d1c('0xa'),attributes,{'tableName':_0x4d1c('0xb'),'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 5a4e8f5..ebce44c 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 _0x1631=['rpc','../../config/environment','jayson/promise','client','http','request','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','ZohoAccount','findAll','raw','options','where','attributes','map','include','model','then','GetZohoAccount','debug','ShowZohoAccount','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1631,0x19d));var _0x1163=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x1631[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0x1163('0x0'));var util=require(_0x1163('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1163('0x2'));var fs=require('fs');var Redis=require(_0x1163('0x3'));var db=require(_0x1163('0x4'))['db'];var utils=require(_0x1163('0x5'));var logger=require(_0x1163('0x6'))(_0x1163('0x7'));var config=require(_0x1163('0x8'));var jayson=require(_0x1163('0x9'));var client=jayson[_0x1163('0xa')][_0x1163('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a1e9e,_0x4777d7,_0x53522f){return new BPromise(function(_0xc522cc,_0x299b2c){return client[_0x1163('0xc')](_0x5a1e9e,_0x53522f)['then'](function(_0x2c3037){logger['info'](_0x1163('0xd'),_0x4777d7,_0x1163('0xe'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x4777d7,_0x1163('0xe'),JSON[_0x1163('0xf')](_0x2c3037));if(_0x2c3037[_0x1163('0x10')]){if(_0x2c3037['error'][_0x1163('0x11')]===0x1f4){logger['error'](_0x1163('0xd'),_0x4777d7,_0x2c3037[_0x1163('0x10')]['message']);return _0x299b2c(_0x2c3037[_0x1163('0x10')][_0x1163('0x12')]);}logger[_0x1163('0x10')](_0x1163('0xd'),_0x4777d7,_0x2c3037[_0x1163('0x10')][_0x1163('0x12')]);return _0xc522cc(_0x2c3037[_0x1163('0x10')]['message']);}else{logger[_0x1163('0x13')](_0x1163('0xd'),_0x4777d7,_0x1163('0xe'));_0xc522cc(_0x2c3037[_0x1163('0x14')][_0x1163('0x12')]);}})[_0x1163('0x15')](function(_0x54c9d3){logger[_0x1163('0x10')](_0x1163('0xd'),_0x4777d7,_0x54c9d3);_0x299b2c(_0x54c9d3);});});}exports['GetZohoAccount']=function(_0x36becf){var _0x162209=this;return new Promise(function(_0x3614e4,_0x236339){return db[_0x1163('0x16')][_0x1163('0x17')]({'raw':_0x36becf['options']?_0x36becf['options'][_0x1163('0x18')]===undefined?!![]:![]:!![],'where':_0x36becf[_0x1163('0x19')]?_0x36becf[_0x1163('0x19')][_0x1163('0x1a')]||null:null,'attributes':_0x36becf[_0x1163('0x19')]?_0x36becf['options'][_0x1163('0x1b')]||null:null,'limit':_0x36becf[_0x1163('0x19')]?_0x36becf[_0x1163('0x19')]['limit']||null:null,'include':_0x36becf['options']?_0x36becf[_0x1163('0x19')]['include']?_[_0x1163('0x1c')](_0x36becf[_0x1163('0x19')][_0x1163('0x1d')],function(_0x8dad65){return{'model':db[_0x8dad65['model']],'as':_0x8dad65['as'],'attributes':_0x8dad65[_0x1163('0x1b')],'include':_0x8dad65[_0x1163('0x1d')]?_['map'](_0x8dad65[_0x1163('0x1d')],function(_0x5db802){return{'model':db[_0x5db802[_0x1163('0x1e')]],'as':_0x5db802['as'],'attributes':_0x5db802[_0x1163('0x1b')],'include':_0x5db802[_0x1163('0x1d')]?_[_0x1163('0x1c')](_0x5db802[_0x1163('0x1d')],function(_0x2c60f5){return{'model':db[_0x2c60f5[_0x1163('0x1e')]],'as':_0x2c60f5['as'],'attributes':_0x2c60f5[_0x1163('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1163('0x1f')](function(_0x51ff30){logger[_0x1163('0x13')](_0x1163('0x20'),_0x36becf);logger[_0x1163('0x21')](_0x1163('0x20'),_0x36becf,JSON[_0x1163('0xf')](_0x51ff30));_0x3614e4(_0x51ff30);})[_0x1163('0x15')](function(_0x32fa68){logger[_0x1163('0x10')](_0x1163('0x20'),_0x32fa68[_0x1163('0x12')],_0x36becf);_0x236339(_0x162209[_0x1163('0x10')](0x1f4,_0x32fa68[_0x1163('0x12')]));});});};exports[_0x1163('0x22')]=function(_0x463563){var _0xf9e162=this;return new Promise(function(_0x1fc787,_0x51ad7e){return db[_0x1163('0x16')]['find']({'raw':_0x463563[_0x1163('0x19')]?_0x463563[_0x1163('0x19')][_0x1163('0x18')]===undefined?!![]:![]:!![],'where':_0x463563['options']?_0x463563[_0x1163('0x19')][_0x1163('0x1a')]||null:null,'attributes':_0x463563[_0x1163('0x19')]?_0x463563[_0x1163('0x19')][_0x1163('0x1b')]||null:null,'include':_0x463563[_0x1163('0x19')]?_0x463563[_0x1163('0x19')][_0x1163('0x1d')]?_[_0x1163('0x1c')](_0x463563[_0x1163('0x19')][_0x1163('0x1d')],function(_0x538f06){return{'model':db[_0x538f06['model']],'as':_0x538f06['as'],'attributes':_0x538f06[_0x1163('0x1b')],'include':_0x538f06['include']?_['map'](_0x538f06[_0x1163('0x1d')],function(_0x4976d0){return{'model':db[_0x4976d0[_0x1163('0x1e')]],'as':_0x4976d0['as'],'attributes':_0x4976d0[_0x1163('0x1b')],'include':_0x4976d0['include']?_['map'](_0x4976d0[_0x1163('0x1d')],function(_0x3d6878){return{'model':db[_0x3d6878[_0x1163('0x1e')]],'as':_0x3d6878['as'],'attributes':_0x3d6878[_0x1163('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1108b0){logger[_0x1163('0x13')](_0x1163('0x22'),_0x463563);logger[_0x1163('0x21')]('ShowZohoAccount',_0x463563,JSON['stringify'](_0x1108b0));_0x1fc787(_0x1108b0);})[_0x1163('0x15')](function(_0x1c6af5){logger[_0x1163('0x10')](_0x1163('0x22'),_0x1c6af5[_0x1163('0x12')],_0x463563);_0x51ad7e(_0xf9e162['error'](0x1f4,_0x1c6af5[_0x1163('0x12')]));});});}; \ No newline at end of file +var _0xb06c=['find','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','request','then','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetZohoAccount','ShowZohoAccount','ZohoAccount'];(function(_0x321cd1,_0xce595){var _0x2aed85=function(_0x20b72a){while(--_0x20b72a){_0x321cd1['push'](_0x321cd1['shift']());}};_0x2aed85(++_0xce595);}(_0xb06c,0x141));var _0xcb06=function(_0x2898f7,_0x167ca7){_0x2898f7=_0x2898f7-0x0;var _0x3a4e00=_0xb06c[_0x2898f7];return _0x3a4e00;};'use strict';var _=require('lodash');var util=require(_0xcb06('0x0'));var moment=require(_0xcb06('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb06('0x2'));var db=require(_0xcb06('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb06('0x4'))(_0xcb06('0x5'));var config=require('../../config/environment');var jayson=require(_0xcb06('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x16f9d8,_0x5784dd,_0xd971fe){return new BPromise(function(_0x3c1e38,_0x5ae135){return client[_0xcb06('0x7')](_0x16f9d8,_0xd971fe)[_0xcb06('0x8')](function(_0x3266fd){logger[_0xcb06('0x9')](_0xcb06('0xa'),_0x5784dd,'request\x20sent');logger[_0xcb06('0xb')](_0xcb06('0xc'),_0x5784dd,_0xcb06('0xd'),JSON[_0xcb06('0xe')](_0x3266fd));if(_0x3266fd['error']){if(_0x3266fd[_0xcb06('0xf')][_0xcb06('0x10')]===0x1f4){logger[_0xcb06('0xf')](_0xcb06('0xa'),_0x5784dd,_0x3266fd[_0xcb06('0xf')][_0xcb06('0x11')]);return _0x5ae135(_0x3266fd[_0xcb06('0xf')][_0xcb06('0x11')]);}logger[_0xcb06('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x5784dd,_0x3266fd[_0xcb06('0xf')]['message']);return _0x3c1e38(_0x3266fd[_0xcb06('0xf')][_0xcb06('0x11')]);}else{logger['info'](_0xcb06('0xa'),_0x5784dd,_0xcb06('0xd'));_0x3c1e38(_0x3266fd['result']['message']);}})[_0xcb06('0x12')](function(_0xb84c2c){logger[_0xcb06('0xf')](_0xcb06('0xa'),_0x5784dd,_0xb84c2c);_0x5ae135(_0xb84c2c);});});}exports['GetZohoAccount']=function(_0x139d4d){var _0x1018a1=this;return new Promise(function(_0x8d2636,_0x34720b){return db['ZohoAccount'][_0xcb06('0x13')]({'raw':_0x139d4d[_0xcb06('0x14')]?_0x139d4d[_0xcb06('0x14')][_0xcb06('0x15')]===undefined?!![]:![]:!![],'where':_0x139d4d[_0xcb06('0x14')]?_0x139d4d[_0xcb06('0x14')][_0xcb06('0x16')]||null:null,'attributes':_0x139d4d[_0xcb06('0x14')]?_0x139d4d[_0xcb06('0x14')][_0xcb06('0x17')]||null:null,'limit':_0x139d4d[_0xcb06('0x14')]?_0x139d4d[_0xcb06('0x14')][_0xcb06('0x18')]||null:null,'include':_0x139d4d[_0xcb06('0x14')]?_0x139d4d[_0xcb06('0x14')][_0xcb06('0x19')]?_[_0xcb06('0x1a')](_0x139d4d['options'][_0xcb06('0x19')],function(_0x63d60c){return{'model':db[_0x63d60c['model']],'as':_0x63d60c['as'],'attributes':_0x63d60c[_0xcb06('0x17')],'include':_0x63d60c['include']?_[_0xcb06('0x1a')](_0x63d60c[_0xcb06('0x19')],function(_0x5ef79c){return{'model':db[_0x5ef79c[_0xcb06('0x1b')]],'as':_0x5ef79c['as'],'attributes':_0x5ef79c[_0xcb06('0x17')],'include':_0x5ef79c[_0xcb06('0x19')]?_[_0xcb06('0x1a')](_0x5ef79c[_0xcb06('0x19')],function(_0x174cfe){return{'model':db[_0x174cfe[_0xcb06('0x1b')]],'as':_0x174cfe['as'],'attributes':_0x174cfe[_0xcb06('0x17')]};}):[]};}):[]};}):[]:[]})[_0xcb06('0x8')](function(_0x5c0916){logger[_0xcb06('0x9')](_0xcb06('0x1c'),_0x139d4d);logger[_0xcb06('0xb')](_0xcb06('0x1c'),_0x139d4d,JSON[_0xcb06('0xe')](_0x5c0916));_0x8d2636(_0x5c0916);})[_0xcb06('0x12')](function(_0x1b3499){logger[_0xcb06('0xf')](_0xcb06('0x1c'),_0x1b3499[_0xcb06('0x11')],_0x139d4d);_0x34720b(_0x1018a1[_0xcb06('0xf')](0x1f4,_0x1b3499[_0xcb06('0x11')]));});});};exports[_0xcb06('0x1d')]=function(_0x332124){var _0x3b19ab=this;return new Promise(function(_0x14a461,_0x262269){return db[_0xcb06('0x1e')][_0xcb06('0x1f')]({'raw':_0x332124[_0xcb06('0x14')]?_0x332124[_0xcb06('0x14')][_0xcb06('0x15')]===undefined?!![]:![]:!![],'where':_0x332124[_0xcb06('0x14')]?_0x332124['options'][_0xcb06('0x16')]||null:null,'attributes':_0x332124['options']?_0x332124[_0xcb06('0x14')][_0xcb06('0x17')]||null:null,'include':_0x332124['options']?_0x332124[_0xcb06('0x14')][_0xcb06('0x19')]?_['map'](_0x332124['options']['include'],function(_0x21ff02){return{'model':db[_0x21ff02['model']],'as':_0x21ff02['as'],'attributes':_0x21ff02[_0xcb06('0x17')],'include':_0x21ff02[_0xcb06('0x19')]?_[_0xcb06('0x1a')](_0x21ff02[_0xcb06('0x19')],function(_0x9ddb50){return{'model':db[_0x9ddb50['model']],'as':_0x9ddb50['as'],'attributes':_0x9ddb50[_0xcb06('0x17')],'include':_0x9ddb50['include']?_[_0xcb06('0x1a')](_0x9ddb50[_0xcb06('0x19')],function(_0x43051c){return{'model':db[_0x43051c['model']],'as':_0x43051c['as'],'attributes':_0x43051c['attributes']};}):[]};}):[]};}):[]:[]})[_0xcb06('0x8')](function(_0x5dcc36){logger['info']('ShowZohoAccount',_0x332124);logger[_0xcb06('0xb')]('ShowZohoAccount',_0x332124,JSON['stringify'](_0x5dcc36));_0x14a461(_0x5dcc36);})['catch'](function(_0x17007a){logger['error'](_0xcb06('0x1d'),_0x17007a[_0xcb06('0x11')],_0x332124);_0x262269(_0x3b19ab[_0xcb06('0xf')](0x1f4,_0x17007a[_0xcb06('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 33dd2a7..ceab306 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 _0xedd9=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','/:id','update','delete','destroy','exports','util'];(function(_0x1b1f87,_0x599eaa){var _0x432c57=function(_0x55225f){while(--_0x55225f){_0x1b1f87['push'](_0x1b1f87['shift']());}};_0x432c57(++_0x599eaa);}(_0xedd9,0xfc));var _0x9edd=function(_0x30bfe6,_0x49765e){_0x30bfe6=_0x30bfe6-0x0;var _0x78af3d=_0xedd9[_0x30bfe6];return _0x78af3d;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0x8')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router['get'](_0x9edd('0xd'),auth['isAuthenticated'](),controller[_0x9edd('0xe')]);router[_0x9edd('0x8')]('/:id/descriptions',auth[_0x9edd('0x9')](),controller[_0x9edd('0xf')]);router['post']('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')](_0x9edd('0x12'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x13')]);router[_0x9edd('0x14')](_0x9edd('0x12'),auth['isAuthenticated'](),controller[_0x9edd('0x15')]);module[_0x9edd('0x16')]=router; \ No newline at end of file +var _0xa5c0=['post','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x376cd8,_0x3b54a5){var _0x4e3560=function(_0x38fb69){while(--_0x38fb69){_0x376cd8['push'](_0x376cd8['shift']());}};_0x4e3560(++_0x3b54a5);}(_0xa5c0,0xbf));var _0x0a5c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5c0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0a5c('0x0'));var util=require(_0x0a5c('0x1'));var path=require(_0x0a5c('0x2'));var timeout=require('connect-timeout');var express=require(_0x0a5c('0x3'));var router=express[_0x0a5c('0x4')]();var auth=require(_0x0a5c('0x5'));var interaction=require(_0x0a5c('0x6'));var config=require(_0x0a5c('0x7'));var controller=require('./intZohoConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0a5c('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a5c('0x9')]);router[_0x0a5c('0x8')](_0x0a5c('0xa'),auth[_0x0a5c('0xb')](),controller[_0x0a5c('0xc')]);router[_0x0a5c('0x8')](_0x0a5c('0xd'),auth['isAuthenticated'](),controller[_0x0a5c('0xe')]);router[_0x0a5c('0x8')]('/:id/descriptions',auth[_0x0a5c('0xb')](),controller[_0x0a5c('0xf')]);router[_0x0a5c('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a5c('0x11')](_0x0a5c('0x12'),auth[_0x0a5c('0xb')](),controller[_0x0a5c('0x13')]);router[_0x0a5c('0x14')](_0x0a5c('0x12'),auth[_0x0a5c('0xb')](),controller[_0x0a5c('0x15')]);module[_0x0a5c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index ef9f02a..1bfd33b 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 _0xe0c1=['exports','STRING','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe0c1,0x101));var _0x1e0c=function(_0x4bd12b,_0x4d4c7e){_0x4bd12b=_0x4bd12b-0x0;var _0x3b9737=_0xe0c1[_0x4bd12b];return _0x3b9737;};'use strict';var Sequelize=require(_0x1e0c('0x0'));module[_0x1e0c('0x1')]={'name':{'type':Sequelize[_0x1e0c('0x2')]},'description':{'type':Sequelize[_0x1e0c('0x2')]}}; \ No newline at end of file +var _0x1367=['STRING','sequelize','exports'];(function(_0x345705,_0x2829c1){var _0x22c250=function(_0x4ae124){while(--_0x4ae124){_0x345705['push'](_0x345705['shift']());}};_0x22c250(++_0x2829c1);}(_0x1367,0x15d));var _0x7136=function(_0x3a60b8,_0x47caab){_0x3a60b8=_0x3a60b8-0x0;var _0x4eb583=_0x1367[_0x3a60b8];return _0x4eb583;};'use strict';var Sequelize=require(_0x7136('0x0'));module[_0x7136('0x1')]={'name':{'type':Sequelize[_0x7136('0x2')]},'description':{'type':Sequelize[_0x7136('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index e05ec8c..1d6043b 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 _0x87dc=['model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','sort','where','pick','filter','map','type','key','VIRTUAL','field','ZohoConfiguration','include','findAll','rows','show','params','includeAll','merge','options','find','create','body','catch','getFields','findOne','ZohoField','getSubjects','order','getDescriptions','hasOwnProperty','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../mysqldb','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','count','offset','Content-Range','apply','save','update','destroy','stack','name','send','rawAttributes'];(function(_0x8e329,_0x14a7ac){var _0x200f26=function(_0x573b4c){while(--_0x573b4c){_0x8e329['push'](_0x8e329['shift']());}};_0x200f26(++_0x14a7ac);}(_0x87dc,0x1ee));var _0xc87d=function(_0x557cce,_0x4e3a39){_0x557cce=_0x557cce-0x0;var _0x1660dc=_0x87dc[_0x557cce];return _0x1660dc;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc87d('0x0'));var zipdir=require(_0xc87d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc87d('0x2'));var moment=require(_0xc87d('0x3'));var BPromise=require(_0xc87d('0x4'));var Mustache=require(_0xc87d('0x5'));var util=require('util');var path=require(_0xc87d('0x6'));var sox=require('sox');var csv=require(_0xc87d('0x7'));var ejs=require(_0xc87d('0x8'));var fs=require('fs');var _=require(_0xc87d('0x9'));var squel=require(_0xc87d('0xa'));var crypto=require(_0xc87d('0xb'));var jsforce=require(_0xc87d('0xc'));var deskjs=require(_0xc87d('0xd'));var toCsv=require(_0xc87d('0x7'));var querystring=require(_0xc87d('0xe'));var Papa=require(_0xc87d('0xf'));var authService=require(_0xc87d('0x10'));var hardwareService=require(_0xc87d('0x11'));var Redis=require(_0xc87d('0x12'));var qs=require(_0xc87d('0x13'));var logger=require('../../config/logger')(_0xc87d('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xc87d('0x15'))['db'];var jayson=require(_0xc87d('0x16'));var client=jayson[_0xc87d('0x17')][_0xc87d('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5c76aa,_0x310d2d,_0xe48464,_0x1b6972){return new BPromise(function(_0x562568,_0x3648cf){var _0x3519d5=_0x1b6972||client;return _0x3519d5[_0xc87d('0x19')](_0x5c76aa,_0xe48464)[_0xc87d('0x1a')](function(_0x3ad500){logger[_0xc87d('0x1b')](_0xc87d('0x1c'),_0x310d2d,_0xc87d('0x1d'));logger[_0xc87d('0x1e')](_0xc87d('0x1f'),_0x310d2d,_0xc87d('0x1d'),JSON[_0xc87d('0x20')](_0x3ad500));if(_0x3ad500[_0xc87d('0x21')]){if(_0x3ad500[_0xc87d('0x21')][_0xc87d('0x22')]===0x1f4){logger['error'](_0xc87d('0x1c'),_0x310d2d,_0x3ad500[_0xc87d('0x21')]['message']);return _0x3648cf(_0x3ad500[_0xc87d('0x21')][_0xc87d('0x23')]);}logger[_0xc87d('0x21')](_0xc87d('0x1c'),_0x310d2d,_0x3ad500[_0xc87d('0x21')][_0xc87d('0x23')]);return _0x562568(_0x3ad500[_0xc87d('0x21')]['message']);}else{logger[_0xc87d('0x1b')](_0xc87d('0x1c'),_0x310d2d,_0xc87d('0x1d'));_0x562568(_0x3ad500[_0xc87d('0x24')][_0xc87d('0x23')]);}})['catch'](function(_0x2f0c18){logger[_0xc87d('0x21')]('ZohoConfiguration,\x20%s,\x20%s',_0x310d2d,_0x2f0c18);_0x3648cf(_0x2f0c18);});});}function respondWithStatusCode(_0x4be4df,_0xdfea3){_0xdfea3=_0xdfea3||0xcc;return function(_0x2609b0){if(_0x2609b0){return _0x4be4df[_0xc87d('0x25')](_0xdfea3);}return _0x4be4df['status'](_0xdfea3)[_0xc87d('0x26')]();};}function respondWithResult(_0x564102,_0x38b3ac){_0x38b3ac=_0x38b3ac||0xc8;return function(_0x405042){if(_0x405042){return _0x564102[_0xc87d('0x27')](_0x38b3ac)[_0xc87d('0x28')](_0x405042);}};}function respondWithFilteredResult(_0x2b0fff,_0x2f6ba1){return function(_0x2442ad){if(_0x2442ad){var _0x135880=_0x2442ad[_0xc87d('0x29')],_0x11c389=_0x2f6ba1[_0xc87d('0x2a')],_0x336061=_0x2f6ba1[_0xc87d('0x2a')]+_0x2f6ba1['limit'],_0x5d7b53;if(_0x336061>=_0x135880){_0x336061=_0x135880;_0x5d7b53=0xc8;}else{_0x5d7b53=0xce;}_0x2b0fff[_0xc87d('0x27')](_0x5d7b53);return _0x2b0fff['set'](_0xc87d('0x2b'),_0x11c389+'-'+_0x336061+'/'+_0x135880)[_0xc87d('0x28')](_0x2442ad);}return null;};}function patchUpdates(_0x34c9de){return function(_0x44fe9d){try{jsonpatch[_0xc87d('0x2c')](_0x44fe9d,_0x34c9de,!![]);}catch(_0x3f32c4){return BPromise['reject'](_0x3f32c4);}return _0x44fe9d[_0xc87d('0x2d')]();};}function saveUpdates(_0xf7a16e,_0x298eac){return function(_0x5a5758){if(_0x5a5758){return _0x5a5758[_0xc87d('0x2e')](_0xf7a16e)[_0xc87d('0x1a')](function(_0x9897fc){return _0x9897fc;});}return null;};}function removeEntity(_0x51fa9d,_0x230796){return function(_0x9fddaa){if(_0x9fddaa){return _0x9fddaa[_0xc87d('0x2f')]()['then'](function(){_0x51fa9d[_0xc87d('0x27')](0xcc)[_0xc87d('0x26')]();});}};}function handleEntityNotFound(_0x51d419,_0x27c67f){return function(_0x34833f){if(!_0x34833f){_0x51d419[_0xc87d('0x25')](0x194);}return _0x34833f;};}function handleError(_0x188e11,_0xbdb86c){_0xbdb86c=_0xbdb86c||0x1f4;return function(_0x1ee6a1){logger[_0xc87d('0x21')](_0x1ee6a1[_0xc87d('0x30')]);if(_0x1ee6a1[_0xc87d('0x31')]){delete _0x1ee6a1[_0xc87d('0x31')];}_0x188e11[_0xc87d('0x27')](_0xbdb86c)[_0xc87d('0x32')](_0x1ee6a1);};}exports['index']=function(_0x41ea00,_0xfd3833){var _0x275483={},_0x198082={},_0x50910a={'count':0x0,'rows':[]};var _0xdc5cd8=db['ZohoConfiguration'][_0xc87d('0x33')];_0x198082[_0xc87d('0x34')]=_['keys'](_0xdc5cd8);_0x198082[_0xc87d('0x35')]=_[_0xc87d('0x36')](_0x41ea00[_0xc87d('0x35')]);_0x198082[_0xc87d('0x37')]=_['intersection'](_0x198082['model'],_0x198082[_0xc87d('0x35')]);_0x275483[_0xc87d('0x38')]=_[_0xc87d('0x39')](_0x198082[_0xc87d('0x34')],qs['fields'](_0x41ea00[_0xc87d('0x35')][_0xc87d('0x3a')]));_0x275483['attributes']=_0x275483[_0xc87d('0x38')][_0xc87d('0x3b')]?_0x275483[_0xc87d('0x38')]:_0x198082[_0xc87d('0x34')];if(!_0x41ea00[_0xc87d('0x35')]['hasOwnProperty'](_0xc87d('0x3c'))){_0x275483['limit']=qs[_0xc87d('0x3d')](_0x41ea00[_0xc87d('0x35')]['limit']);_0x275483[_0xc87d('0x2a')]=qs[_0xc87d('0x2a')](_0x41ea00[_0xc87d('0x35')][_0xc87d('0x2a')]);}_0x275483['order']=qs[_0xc87d('0x3e')](_0x41ea00[_0xc87d('0x35')]['sort']);_0x275483[_0xc87d('0x3f')]=qs[_0xc87d('0x37')](_[_0xc87d('0x40')](_0x41ea00[_0xc87d('0x35')],_0x198082['filters']));if(_0x41ea00[_0xc87d('0x35')][_0xc87d('0x41')]){_0x275483[_0xc87d('0x3f')]=_['merge'](_0x275483[_0xc87d('0x3f')],{'$or':_[_0xc87d('0x42')](_0xdc5cd8,function(_0x1eb0c8){if(_0x1eb0c8[_0xc87d('0x43')][_0xc87d('0x44')]!==_0xc87d('0x45')){var _0x5977fa={};_0x5977fa[_0x1eb0c8[_0xc87d('0x46')]]={'$like':'%'+_0x41ea00[_0xc87d('0x35')][_0xc87d('0x41')]+'%'};return _0x5977fa;}})});}_0x275483=_['merge']({},_0x275483,_0x41ea00['options']);var _0x23c941={'where':_0x275483[_0xc87d('0x3f')]};return db[_0xc87d('0x47')][_0xc87d('0x29')](_0x23c941)[_0xc87d('0x1a')](function(_0x241ad0){_0x50910a[_0xc87d('0x29')]=_0x241ad0;if(_0x41ea00[_0xc87d('0x35')]['includeAll']){_0x275483[_0xc87d('0x48')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0xc87d('0x49')](_0x275483);})[_0xc87d('0x1a')](function(_0x3a93b4){_0x50910a[_0xc87d('0x4a')]=_0x3a93b4;return _0x50910a;})['then'](respondWithFilteredResult(_0xfd3833,_0x275483))['catch'](handleError(_0xfd3833,null));};exports[_0xc87d('0x4b')]=function(_0x1861ea,_0x2dec86){var _0x470e75={'raw':![],'where':{'id':_0x1861ea[_0xc87d('0x4c')]['id']}},_0x374e88={};_0x374e88['model']=_[_0xc87d('0x36')](db['ZohoConfiguration']['rawAttributes']);_0x374e88[_0xc87d('0x35')]=_[_0xc87d('0x36')](_0x1861ea[_0xc87d('0x35')]);_0x374e88['filters']=_[_0xc87d('0x39')](_0x374e88[_0xc87d('0x34')],_0x374e88[_0xc87d('0x35')]);_0x470e75[_0xc87d('0x38')]=_[_0xc87d('0x39')](_0x374e88[_0xc87d('0x34')],qs[_0xc87d('0x3a')](_0x1861ea['query'][_0xc87d('0x3a')]));_0x470e75[_0xc87d('0x38')]=_0x470e75['attributes'][_0xc87d('0x3b')]?_0x470e75[_0xc87d('0x38')]:_0x374e88[_0xc87d('0x34')];if(_0x1861ea[_0xc87d('0x35')][_0xc87d('0x4d')]){_0x470e75[_0xc87d('0x48')]=[{'all':!![]}];}_0x470e75=_[_0xc87d('0x4e')]({},_0x470e75,_0x1861ea[_0xc87d('0x4f')]);return db[_0xc87d('0x47')][_0xc87d('0x50')](_0x470e75)['then'](handleEntityNotFound(_0x2dec86,null))['then'](respondWithResult(_0x2dec86,null))['catch'](handleError(_0x2dec86,null));};exports[_0xc87d('0x51')]=function(_0x5d5cf9,_0xa95ce4){return db[_0xc87d('0x47')]['create'](_0x5d5cf9[_0xc87d('0x52')],{})[_0xc87d('0x1a')](respondWithResult(_0xa95ce4,0xc9))['catch'](handleError(_0xa95ce4,null));};exports[_0xc87d('0x2e')]=function(_0x7aa8a1,_0x4ee1a5){if(_0x7aa8a1['body']['id']){delete _0x7aa8a1['body']['id'];}return db[_0xc87d('0x47')][_0xc87d('0x50')]({'where':{'id':_0x7aa8a1[_0xc87d('0x4c')]['id']}})[_0xc87d('0x1a')](handleEntityNotFound(_0x4ee1a5,null))[_0xc87d('0x1a')](saveUpdates(_0x7aa8a1[_0xc87d('0x52')],null))['then'](respondWithResult(_0x4ee1a5,null))['catch'](handleError(_0x4ee1a5,null));};exports[_0xc87d('0x2f')]=function(_0x4e9cde,_0x30a093){return db[_0xc87d('0x47')][_0xc87d('0x50')]({'where':{'id':_0x4e9cde[_0xc87d('0x4c')]['id']}})[_0xc87d('0x1a')](handleEntityNotFound(_0x30a093,null))['then'](removeEntity(_0x30a093,null))[_0xc87d('0x53')](handleError(_0x30a093,null));};exports[_0xc87d('0x54')]=function(_0x489edf,_0x24ffae,_0x41115d){var _0x58522f={};var _0x408523={};var _0x2ca9ba;var _0x371c38;return db['ZohoConfiguration'][_0xc87d('0x55')]({'where':{'id':_0x489edf[_0xc87d('0x4c')]['id']}})[_0xc87d('0x1a')](handleEntityNotFound(_0x24ffae,null))[_0xc87d('0x1a')](function(_0x1f090d){if(_0x1f090d){_0x2ca9ba=_0x1f090d;_0x408523[_0xc87d('0x34')]=_[_0xc87d('0x36')](db[_0xc87d('0x56')][_0xc87d('0x33')]);_0x408523[_0xc87d('0x35')]=_[_0xc87d('0x36')](_0x489edf[_0xc87d('0x35')]);_0x408523[_0xc87d('0x37')]=_[_0xc87d('0x39')](_0x408523['model'],_0x408523[_0xc87d('0x35')]);_0x58522f['attributes']=_[_0xc87d('0x39')](_0x408523['model'],qs[_0xc87d('0x3a')](_0x489edf[_0xc87d('0x35')][_0xc87d('0x3a')]));_0x58522f['attributes']=_0x58522f[_0xc87d('0x38')]['length']?_0x58522f[_0xc87d('0x38')]:_0x408523['model'];_0x58522f['order']=qs[_0xc87d('0x3e')](_0x489edf[_0xc87d('0x35')][_0xc87d('0x3e')]);_0x58522f[_0xc87d('0x3f')]=qs[_0xc87d('0x37')](_[_0xc87d('0x40')](_0x489edf['query'],_0x408523[_0xc87d('0x37')]));if(_0x489edf[_0xc87d('0x35')][_0xc87d('0x41')]){_0x58522f[_0xc87d('0x3f')]=_['merge'](_0x58522f[_0xc87d('0x3f')],{'$or':_[_0xc87d('0x42')](_0x58522f[_0xc87d('0x38')],function(_0x358216){var _0x3bc9f4={};_0x3bc9f4[_0x358216]={'$like':'%'+_0x489edf['query'][_0xc87d('0x41')]+'%'};return _0x3bc9f4;})});}_0x58522f=_[_0xc87d('0x4e')]({},_0x58522f,_0x489edf[_0xc87d('0x4f')]);return _0x2ca9ba[_0xc87d('0x54')](_0x58522f);}})[_0xc87d('0x1a')](function(_0x5710be){if(_0x5710be){_0x371c38=_0x5710be[_0xc87d('0x3b')];if(!_0x489edf[_0xc87d('0x35')]['hasOwnProperty']('nolimit')){_0x58522f['limit']=qs[_0xc87d('0x3d')](_0x489edf['query'][_0xc87d('0x3d')]);_0x58522f[_0xc87d('0x2a')]=qs[_0xc87d('0x2a')](_0x489edf[_0xc87d('0x35')]['offset']);}return _0x2ca9ba[_0xc87d('0x54')](_0x58522f);}})[_0xc87d('0x1a')](function(_0x5b6b02){if(_0x5b6b02){return _0x5b6b02?{'count':_0x371c38,'rows':_0x5b6b02}:null;}})[_0xc87d('0x1a')](respondWithResult(_0x24ffae,null))[_0xc87d('0x53')](handleError(_0x24ffae,null));};exports[_0xc87d('0x57')]=function(_0x4e7882,_0x3cf668,_0x425ddd){var _0x5cbe66={};var _0x407a11={};var _0x46892a;var _0x3e3917;return db[_0xc87d('0x47')]['findOne']({'where':{'id':_0x4e7882[_0xc87d('0x4c')]['id']}})[_0xc87d('0x1a')](handleEntityNotFound(_0x3cf668,null))[_0xc87d('0x1a')](function(_0x4071f0){if(_0x4071f0){_0x46892a=_0x4071f0;_0x407a11[_0xc87d('0x34')]=_[_0xc87d('0x36')](db[_0xc87d('0x56')][_0xc87d('0x33')]);_0x407a11['query']=_[_0xc87d('0x36')](_0x4e7882[_0xc87d('0x35')]);_0x407a11['filters']=_[_0xc87d('0x39')](_0x407a11[_0xc87d('0x34')],_0x407a11[_0xc87d('0x35')]);_0x5cbe66[_0xc87d('0x38')]=_['intersection'](_0x407a11[_0xc87d('0x34')],qs['fields'](_0x4e7882[_0xc87d('0x35')][_0xc87d('0x3a')]));_0x5cbe66[_0xc87d('0x38')]=_0x5cbe66[_0xc87d('0x38')][_0xc87d('0x3b')]?_0x5cbe66[_0xc87d('0x38')]:_0x407a11[_0xc87d('0x34')];_0x5cbe66[_0xc87d('0x58')]=qs[_0xc87d('0x3e')](_0x4e7882[_0xc87d('0x35')][_0xc87d('0x3e')]);_0x5cbe66[_0xc87d('0x3f')]=qs[_0xc87d('0x37')](_[_0xc87d('0x40')](_0x4e7882[_0xc87d('0x35')],_0x407a11['filters']));if(_0x4e7882[_0xc87d('0x35')][_0xc87d('0x41')]){_0x5cbe66[_0xc87d('0x3f')]=_['merge'](_0x5cbe66[_0xc87d('0x3f')],{'$or':_[_0xc87d('0x42')](_0x5cbe66[_0xc87d('0x38')],function(_0x4eb1f1){var _0xce8bb={};_0xce8bb[_0x4eb1f1]={'$like':'%'+_0x4e7882[_0xc87d('0x35')]['filter']+'%'};return _0xce8bb;})});}_0x5cbe66=_['merge']({},_0x5cbe66,_0x4e7882[_0xc87d('0x4f')]);return _0x46892a[_0xc87d('0x57')](_0x5cbe66);}})[_0xc87d('0x1a')](function(_0x38f9e6){if(_0x38f9e6){_0x3e3917=_0x38f9e6[_0xc87d('0x3b')];if(!_0x4e7882['query']['hasOwnProperty'](_0xc87d('0x3c'))){_0x5cbe66[_0xc87d('0x3d')]=qs[_0xc87d('0x3d')](_0x4e7882['query'][_0xc87d('0x3d')]);_0x5cbe66[_0xc87d('0x2a')]=qs['offset'](_0x4e7882['query'][_0xc87d('0x2a')]);}return _0x46892a['getSubjects'](_0x5cbe66);}})[_0xc87d('0x1a')](function(_0x1ccac5){if(_0x1ccac5){return _0x1ccac5?{'count':_0x3e3917,'rows':_0x1ccac5}:null;}})[_0xc87d('0x1a')](respondWithResult(_0x3cf668,null))[_0xc87d('0x53')](handleError(_0x3cf668,null));};exports[_0xc87d('0x59')]=function(_0xbef21e,_0x3fe393,_0x2d3a5c){var _0x4307cd={};var _0x3642af={};var _0x4c5855;var _0x15b4f9;return db[_0xc87d('0x47')][_0xc87d('0x55')]({'where':{'id':_0xbef21e['params']['id']}})[_0xc87d('0x1a')](handleEntityNotFound(_0x3fe393,null))[_0xc87d('0x1a')](function(_0x5cf38f){if(_0x5cf38f){_0x4c5855=_0x5cf38f;_0x3642af['model']=_[_0xc87d('0x36')](db['ZohoField'][_0xc87d('0x33')]);_0x3642af[_0xc87d('0x35')]=_[_0xc87d('0x36')](_0xbef21e[_0xc87d('0x35')]);_0x3642af[_0xc87d('0x37')]=_['intersection'](_0x3642af[_0xc87d('0x34')],_0x3642af[_0xc87d('0x35')]);_0x4307cd[_0xc87d('0x38')]=_[_0xc87d('0x39')](_0x3642af['model'],qs[_0xc87d('0x3a')](_0xbef21e[_0xc87d('0x35')][_0xc87d('0x3a')]));_0x4307cd[_0xc87d('0x38')]=_0x4307cd['attributes']['length']?_0x4307cd[_0xc87d('0x38')]:_0x3642af[_0xc87d('0x34')];_0x4307cd[_0xc87d('0x58')]=qs[_0xc87d('0x3e')](_0xbef21e[_0xc87d('0x35')]['sort']);_0x4307cd[_0xc87d('0x3f')]=qs[_0xc87d('0x37')](_['pick'](_0xbef21e['query'],_0x3642af[_0xc87d('0x37')]));if(_0xbef21e[_0xc87d('0x35')][_0xc87d('0x41')]){_0x4307cd[_0xc87d('0x3f')]=_['merge'](_0x4307cd[_0xc87d('0x3f')],{'$or':_['map'](_0x4307cd[_0xc87d('0x38')],function(_0xb6f539){var _0x49fef6={};_0x49fef6[_0xb6f539]={'$like':'%'+_0xbef21e[_0xc87d('0x35')][_0xc87d('0x41')]+'%'};return _0x49fef6;})});}_0x4307cd=_['merge']({},_0x4307cd,_0xbef21e[_0xc87d('0x4f')]);return _0x4c5855[_0xc87d('0x59')](_0x4307cd);}})[_0xc87d('0x1a')](function(_0x4670ce){if(_0x4670ce){_0x15b4f9=_0x4670ce[_0xc87d('0x3b')];if(!_0xbef21e[_0xc87d('0x35')][_0xc87d('0x5a')]('nolimit')){_0x4307cd[_0xc87d('0x3d')]=qs[_0xc87d('0x3d')](_0xbef21e['query']['limit']);_0x4307cd['offset']=qs[_0xc87d('0x2a')](_0xbef21e['query']['offset']);}return _0x4c5855[_0xc87d('0x59')](_0x4307cd);}})['then'](function(_0x4ef17d){if(_0x4ef17d){return _0x4ef17d?{'count':_0x15b4f9,'rows':_0x4ef17d}:null;}})[_0xc87d('0x1a')](respondWithResult(_0x3fe393,null))[_0xc87d('0x53')](handleError(_0x3fe393,null));}; \ No newline at end of file +var _0x1d38=['where','pick','filter','merge','map','type','VIRTUAL','field','options','count','includeAll','include','findAll','rows','params','find','catch','create','body','update','getFields','ZohoField','getSubjects','getDescriptions','findOne','html-pdf','rimraf','zip-dir','fast-json-patch','moment','util','to-csv','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','sendStatus','status','json','offset','Content-Range','apply','reject','save','destroy','end','stack','name','send','index','ZohoConfiguration','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d38,0x11e));var _0x81d3=function(_0x3123d1,_0x367e5a){_0x3123d1=_0x3123d1-0x0;var _0x5cf1f3=_0x1d38[_0x3123d1];return _0x5cf1f3;};'use strict';var pdf=require(_0x81d3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x81d3('0x1'));var zipdir=require(_0x81d3('0x2'));var jsonpatch=require(_0x81d3('0x3'));var rp=require('request-promise');var moment=require(_0x81d3('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x81d3('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x81d3('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x81d3('0x7'));var squel=require('squel');var crypto=require(_0x81d3('0x8'));var jsforce=require(_0x81d3('0x9'));var deskjs=require(_0x81d3('0xa'));var toCsv=require(_0x81d3('0x6'));var querystring=require('querystring');var Papa=require(_0x81d3('0xb'));var authService=require(_0x81d3('0xc'));var hardwareService=require(_0x81d3('0xd'));var Redis=require(_0x81d3('0xe'));var qs=require(_0x81d3('0xf'));var logger=require(_0x81d3('0x10'))(_0x81d3('0x11'));var utils=require(_0x81d3('0x12'));var config=require(_0x81d3('0x13'));var db=require(_0x81d3('0x14'))['db'];var jayson=require(_0x81d3('0x15'));var client=jayson[_0x81d3('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b09ed,_0x1be871,_0x5903f0,_0x4008cd){return new BPromise(function(_0x50b640,_0x495bbe){var _0x1d2158=_0x4008cd||client;return _0x1d2158[_0x81d3('0x17')](_0x5b09ed,_0x5903f0)[_0x81d3('0x18')](function(_0xa242d2){logger[_0x81d3('0x19')](_0x81d3('0x1a'),_0x1be871,_0x81d3('0x1b'));logger[_0x81d3('0x1c')](_0x81d3('0x1d'),_0x1be871,_0x81d3('0x1b'),JSON[_0x81d3('0x1e')](_0xa242d2));if(_0xa242d2['error']){if(_0xa242d2[_0x81d3('0x1f')][_0x81d3('0x20')]===0x1f4){logger[_0x81d3('0x1f')](_0x81d3('0x1a'),_0x1be871,_0xa242d2['error']['message']);return _0x495bbe(_0xa242d2['error']['message']);}logger['error'](_0x81d3('0x1a'),_0x1be871,_0xa242d2[_0x81d3('0x1f')]['message']);return _0x50b640(_0xa242d2[_0x81d3('0x1f')]['message']);}else{logger[_0x81d3('0x19')](_0x81d3('0x1a'),_0x1be871,_0x81d3('0x1b'));_0x50b640(_0xa242d2['result']['message']);}})['catch'](function(_0x5b8770){logger[_0x81d3('0x1f')]('ZohoConfiguration,\x20%s,\x20%s',_0x1be871,_0x5b8770);_0x495bbe(_0x5b8770);});});}function respondWithStatusCode(_0x4d47b3,_0x68ae2a){_0x68ae2a=_0x68ae2a||0xcc;return function(_0x3d02fc){if(_0x3d02fc){return _0x4d47b3[_0x81d3('0x21')](_0x68ae2a);}return _0x4d47b3[_0x81d3('0x22')](_0x68ae2a)['end']();};}function respondWithResult(_0x4d7432,_0x422cdc){_0x422cdc=_0x422cdc||0xc8;return function(_0x5e9923){if(_0x5e9923){return _0x4d7432[_0x81d3('0x22')](_0x422cdc)[_0x81d3('0x23')](_0x5e9923);}};}function respondWithFilteredResult(_0x250ee7,_0xb7f4e2){return function(_0x349404){if(_0x349404){var _0x5ebd32=_0x349404['count'],_0x111625=_0xb7f4e2['offset'],_0x55dbf4=_0xb7f4e2[_0x81d3('0x24')]+_0xb7f4e2['limit'],_0x5831a1;if(_0x55dbf4>=_0x5ebd32){_0x55dbf4=_0x5ebd32;_0x5831a1=0xc8;}else{_0x5831a1=0xce;}_0x250ee7[_0x81d3('0x22')](_0x5831a1);return _0x250ee7['set'](_0x81d3('0x25'),_0x111625+'-'+_0x55dbf4+'/'+_0x5ebd32)[_0x81d3('0x23')](_0x349404);}return null;};}function patchUpdates(_0x293961){return function(_0x26ae94){try{jsonpatch[_0x81d3('0x26')](_0x26ae94,_0x293961,!![]);}catch(_0x3eec4b){return BPromise[_0x81d3('0x27')](_0x3eec4b);}return _0x26ae94[_0x81d3('0x28')]();};}function saveUpdates(_0x2c57bb,_0x29da28){return function(_0x59ffc7){if(_0x59ffc7){return _0x59ffc7['update'](_0x2c57bb)[_0x81d3('0x18')](function(_0x379333){return _0x379333;});}return null;};}function removeEntity(_0x50dc64,_0x3ebbec){return function(_0x3300){if(_0x3300){return _0x3300[_0x81d3('0x29')]()[_0x81d3('0x18')](function(){_0x50dc64[_0x81d3('0x22')](0xcc)[_0x81d3('0x2a')]();});}};}function handleEntityNotFound(_0x5c2d3b,_0x14946d){return function(_0x143aa7){if(!_0x143aa7){_0x5c2d3b[_0x81d3('0x21')](0x194);}return _0x143aa7;};}function handleError(_0x2a17b2,_0x5f123f){_0x5f123f=_0x5f123f||0x1f4;return function(_0x5b60cf){logger[_0x81d3('0x1f')](_0x5b60cf[_0x81d3('0x2b')]);if(_0x5b60cf[_0x81d3('0x2c')]){delete _0x5b60cf[_0x81d3('0x2c')];}_0x2a17b2[_0x81d3('0x22')](_0x5f123f)[_0x81d3('0x2d')](_0x5b60cf);};}exports[_0x81d3('0x2e')]=function(_0x5a565e,_0x1d8a63){var _0x5668b5={},_0x381529={},_0x563e88={'count':0x0,'rows':[]};var _0x106464=db[_0x81d3('0x2f')][_0x81d3('0x30')];_0x381529[_0x81d3('0x31')]=_[_0x81d3('0x32')](_0x106464);_0x381529[_0x81d3('0x33')]=_['keys'](_0x5a565e[_0x81d3('0x33')]);_0x381529[_0x81d3('0x34')]=_[_0x81d3('0x35')](_0x381529[_0x81d3('0x31')],_0x381529['query']);_0x5668b5[_0x81d3('0x36')]=_[_0x81d3('0x35')](_0x381529[_0x81d3('0x31')],qs[_0x81d3('0x37')](_0x5a565e['query'][_0x81d3('0x37')]));_0x5668b5[_0x81d3('0x36')]=_0x5668b5[_0x81d3('0x36')][_0x81d3('0x38')]?_0x5668b5[_0x81d3('0x36')]:_0x381529['model'];if(!_0x5a565e['query'][_0x81d3('0x39')](_0x81d3('0x3a'))){_0x5668b5[_0x81d3('0x3b')]=qs['limit'](_0x5a565e[_0x81d3('0x33')][_0x81d3('0x3b')]);_0x5668b5['offset']=qs[_0x81d3('0x24')](_0x5a565e['query']['offset']);}_0x5668b5[_0x81d3('0x3c')]=qs[_0x81d3('0x3d')](_0x5a565e[_0x81d3('0x33')][_0x81d3('0x3d')]);_0x5668b5[_0x81d3('0x3e')]=qs['filters'](_[_0x81d3('0x3f')](_0x5a565e[_0x81d3('0x33')],_0x381529['filters']));if(_0x5a565e['query'][_0x81d3('0x40')]){_0x5668b5['where']=_[_0x81d3('0x41')](_0x5668b5['where'],{'$or':_[_0x81d3('0x42')](_0x106464,function(_0x330ce8){if(_0x330ce8[_0x81d3('0x43')]['key']!==_0x81d3('0x44')){var _0x510453={};_0x510453[_0x330ce8[_0x81d3('0x45')]]={'$like':'%'+_0x5a565e[_0x81d3('0x33')][_0x81d3('0x40')]+'%'};return _0x510453;}})});}_0x5668b5=_[_0x81d3('0x41')]({},_0x5668b5,_0x5a565e[_0x81d3('0x46')]);var _0x409c20={'where':_0x5668b5[_0x81d3('0x3e')]};return db[_0x81d3('0x2f')][_0x81d3('0x47')](_0x409c20)['then'](function(_0x1be57a){_0x563e88[_0x81d3('0x47')]=_0x1be57a;if(_0x5a565e[_0x81d3('0x33')][_0x81d3('0x48')]){_0x5668b5[_0x81d3('0x49')]=[{'all':!![]}];}return db[_0x81d3('0x2f')][_0x81d3('0x4a')](_0x5668b5);})['then'](function(_0x17a446){_0x563e88[_0x81d3('0x4b')]=_0x17a446;return _0x563e88;})[_0x81d3('0x18')](respondWithFilteredResult(_0x1d8a63,_0x5668b5))['catch'](handleError(_0x1d8a63,null));};exports['show']=function(_0xf1bbff,_0x1fd43e){var _0x160dc7={'raw':![],'where':{'id':_0xf1bbff[_0x81d3('0x4c')]['id']}},_0x3f520b={};_0x3f520b[_0x81d3('0x31')]=_[_0x81d3('0x32')](db['ZohoConfiguration']['rawAttributes']);_0x3f520b[_0x81d3('0x33')]=_[_0x81d3('0x32')](_0xf1bbff[_0x81d3('0x33')]);_0x3f520b[_0x81d3('0x34')]=_['intersection'](_0x3f520b['model'],_0x3f520b['query']);_0x160dc7[_0x81d3('0x36')]=_['intersection'](_0x3f520b[_0x81d3('0x31')],qs['fields'](_0xf1bbff[_0x81d3('0x33')][_0x81d3('0x37')]));_0x160dc7[_0x81d3('0x36')]=_0x160dc7[_0x81d3('0x36')][_0x81d3('0x38')]?_0x160dc7[_0x81d3('0x36')]:_0x3f520b[_0x81d3('0x31')];if(_0xf1bbff[_0x81d3('0x33')]['includeAll']){_0x160dc7[_0x81d3('0x49')]=[{'all':!![]}];}_0x160dc7=_[_0x81d3('0x41')]({},_0x160dc7,_0xf1bbff[_0x81d3('0x46')]);return db['ZohoConfiguration'][_0x81d3('0x4d')](_0x160dc7)[_0x81d3('0x18')](handleEntityNotFound(_0x1fd43e,null))[_0x81d3('0x18')](respondWithResult(_0x1fd43e,null))[_0x81d3('0x4e')](handleError(_0x1fd43e,null));};exports[_0x81d3('0x4f')]=function(_0x2b1776,_0x15269b){return db[_0x81d3('0x2f')][_0x81d3('0x4f')](_0x2b1776[_0x81d3('0x50')],{})[_0x81d3('0x18')](respondWithResult(_0x15269b,0xc9))['catch'](handleError(_0x15269b,null));};exports[_0x81d3('0x51')]=function(_0x8ddf69,_0x60c3a4){if(_0x8ddf69[_0x81d3('0x50')]['id']){delete _0x8ddf69['body']['id'];}return db[_0x81d3('0x2f')][_0x81d3('0x4d')]({'where':{'id':_0x8ddf69[_0x81d3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x60c3a4,null))[_0x81d3('0x18')](saveUpdates(_0x8ddf69[_0x81d3('0x50')],null))[_0x81d3('0x18')](respondWithResult(_0x60c3a4,null))[_0x81d3('0x4e')](handleError(_0x60c3a4,null));};exports['destroy']=function(_0x4e0360,_0x2566b1){return db['ZohoConfiguration'][_0x81d3('0x4d')]({'where':{'id':_0x4e0360[_0x81d3('0x4c')]['id']}})[_0x81d3('0x18')](handleEntityNotFound(_0x2566b1,null))[_0x81d3('0x18')](removeEntity(_0x2566b1,null))['catch'](handleError(_0x2566b1,null));};exports[_0x81d3('0x52')]=function(_0x53207a,_0x1f66b8,_0x21c243){var _0x104fb8={};var _0x61883f={};var _0x1a8412;var _0x40f449;return db[_0x81d3('0x2f')]['findOne']({'where':{'id':_0x53207a[_0x81d3('0x4c')]['id']}})[_0x81d3('0x18')](handleEntityNotFound(_0x1f66b8,null))[_0x81d3('0x18')](function(_0x32aeb4){if(_0x32aeb4){_0x1a8412=_0x32aeb4;_0x61883f[_0x81d3('0x31')]=_[_0x81d3('0x32')](db[_0x81d3('0x53')][_0x81d3('0x30')]);_0x61883f['query']=_[_0x81d3('0x32')](_0x53207a[_0x81d3('0x33')]);_0x61883f['filters']=_[_0x81d3('0x35')](_0x61883f[_0x81d3('0x31')],_0x61883f[_0x81d3('0x33')]);_0x104fb8['attributes']=_[_0x81d3('0x35')](_0x61883f[_0x81d3('0x31')],qs[_0x81d3('0x37')](_0x53207a[_0x81d3('0x33')][_0x81d3('0x37')]));_0x104fb8[_0x81d3('0x36')]=_0x104fb8[_0x81d3('0x36')][_0x81d3('0x38')]?_0x104fb8[_0x81d3('0x36')]:_0x61883f[_0x81d3('0x31')];_0x104fb8['order']=qs[_0x81d3('0x3d')](_0x53207a[_0x81d3('0x33')][_0x81d3('0x3d')]);_0x104fb8['where']=qs[_0x81d3('0x34')](_['pick'](_0x53207a[_0x81d3('0x33')],_0x61883f['filters']));if(_0x53207a[_0x81d3('0x33')][_0x81d3('0x40')]){_0x104fb8['where']=_['merge'](_0x104fb8[_0x81d3('0x3e')],{'$or':_[_0x81d3('0x42')](_0x104fb8[_0x81d3('0x36')],function(_0x283a10){var _0x57bcd5={};_0x57bcd5[_0x283a10]={'$like':'%'+_0x53207a[_0x81d3('0x33')][_0x81d3('0x40')]+'%'};return _0x57bcd5;})});}_0x104fb8=_[_0x81d3('0x41')]({},_0x104fb8,_0x53207a[_0x81d3('0x46')]);return _0x1a8412[_0x81d3('0x52')](_0x104fb8);}})['then'](function(_0x25618d){if(_0x25618d){_0x40f449=_0x25618d[_0x81d3('0x38')];if(!_0x53207a[_0x81d3('0x33')]['hasOwnProperty']('nolimit')){_0x104fb8[_0x81d3('0x3b')]=qs[_0x81d3('0x3b')](_0x53207a['query'][_0x81d3('0x3b')]);_0x104fb8[_0x81d3('0x24')]=qs[_0x81d3('0x24')](_0x53207a['query'][_0x81d3('0x24')]);}return _0x1a8412[_0x81d3('0x52')](_0x104fb8);}})[_0x81d3('0x18')](function(_0x2313cf){if(_0x2313cf){return _0x2313cf?{'count':_0x40f449,'rows':_0x2313cf}:null;}})['then'](respondWithResult(_0x1f66b8,null))[_0x81d3('0x4e')](handleError(_0x1f66b8,null));};exports['getSubjects']=function(_0xe6511a,_0x60a2c6,_0x4a8991){var _0xec631b={};var _0x5c656e={};var _0x1164b7;var _0x59ecdb;return db[_0x81d3('0x2f')]['findOne']({'where':{'id':_0xe6511a[_0x81d3('0x4c')]['id']}})[_0x81d3('0x18')](handleEntityNotFound(_0x60a2c6,null))[_0x81d3('0x18')](function(_0x146097){if(_0x146097){_0x1164b7=_0x146097;_0x5c656e['model']=_[_0x81d3('0x32')](db[_0x81d3('0x53')][_0x81d3('0x30')]);_0x5c656e[_0x81d3('0x33')]=_[_0x81d3('0x32')](_0xe6511a[_0x81d3('0x33')]);_0x5c656e['filters']=_[_0x81d3('0x35')](_0x5c656e[_0x81d3('0x31')],_0x5c656e[_0x81d3('0x33')]);_0xec631b['attributes']=_[_0x81d3('0x35')](_0x5c656e[_0x81d3('0x31')],qs[_0x81d3('0x37')](_0xe6511a['query']['fields']));_0xec631b['attributes']=_0xec631b[_0x81d3('0x36')][_0x81d3('0x38')]?_0xec631b['attributes']:_0x5c656e[_0x81d3('0x31')];_0xec631b[_0x81d3('0x3c')]=qs[_0x81d3('0x3d')](_0xe6511a['query'][_0x81d3('0x3d')]);_0xec631b[_0x81d3('0x3e')]=qs[_0x81d3('0x34')](_[_0x81d3('0x3f')](_0xe6511a[_0x81d3('0x33')],_0x5c656e[_0x81d3('0x34')]));if(_0xe6511a[_0x81d3('0x33')][_0x81d3('0x40')]){_0xec631b[_0x81d3('0x3e')]=_[_0x81d3('0x41')](_0xec631b[_0x81d3('0x3e')],{'$or':_[_0x81d3('0x42')](_0xec631b[_0x81d3('0x36')],function(_0x57c125){var _0x3981df={};_0x3981df[_0x57c125]={'$like':'%'+_0xe6511a[_0x81d3('0x33')][_0x81d3('0x40')]+'%'};return _0x3981df;})});}_0xec631b=_[_0x81d3('0x41')]({},_0xec631b,_0xe6511a[_0x81d3('0x46')]);return _0x1164b7[_0x81d3('0x54')](_0xec631b);}})['then'](function(_0x236294){if(_0x236294){_0x59ecdb=_0x236294[_0x81d3('0x38')];if(!_0xe6511a[_0x81d3('0x33')]['hasOwnProperty'](_0x81d3('0x3a'))){_0xec631b[_0x81d3('0x3b')]=qs['limit'](_0xe6511a[_0x81d3('0x33')][_0x81d3('0x3b')]);_0xec631b[_0x81d3('0x24')]=qs[_0x81d3('0x24')](_0xe6511a[_0x81d3('0x33')]['offset']);}return _0x1164b7[_0x81d3('0x54')](_0xec631b);}})[_0x81d3('0x18')](function(_0x380d38){if(_0x380d38){return _0x380d38?{'count':_0x59ecdb,'rows':_0x380d38}:null;}})[_0x81d3('0x18')](respondWithResult(_0x60a2c6,null))['catch'](handleError(_0x60a2c6,null));};exports[_0x81d3('0x55')]=function(_0x47c7c9,_0x46606a,_0x368d51){var _0x482efd={};var _0x529e16={};var _0x23d8db;var _0x24ac16;return db[_0x81d3('0x2f')][_0x81d3('0x56')]({'where':{'id':_0x47c7c9[_0x81d3('0x4c')]['id']}})[_0x81d3('0x18')](handleEntityNotFound(_0x46606a,null))[_0x81d3('0x18')](function(_0x46e85b){if(_0x46e85b){_0x23d8db=_0x46e85b;_0x529e16[_0x81d3('0x31')]=_[_0x81d3('0x32')](db[_0x81d3('0x53')][_0x81d3('0x30')]);_0x529e16[_0x81d3('0x33')]=_[_0x81d3('0x32')](_0x47c7c9[_0x81d3('0x33')]);_0x529e16[_0x81d3('0x34')]=_[_0x81d3('0x35')](_0x529e16['model'],_0x529e16[_0x81d3('0x33')]);_0x482efd['attributes']=_[_0x81d3('0x35')](_0x529e16['model'],qs[_0x81d3('0x37')](_0x47c7c9[_0x81d3('0x33')][_0x81d3('0x37')]));_0x482efd[_0x81d3('0x36')]=_0x482efd[_0x81d3('0x36')][_0x81d3('0x38')]?_0x482efd['attributes']:_0x529e16[_0x81d3('0x31')];_0x482efd[_0x81d3('0x3c')]=qs[_0x81d3('0x3d')](_0x47c7c9[_0x81d3('0x33')][_0x81d3('0x3d')]);_0x482efd[_0x81d3('0x3e')]=qs['filters'](_[_0x81d3('0x3f')](_0x47c7c9['query'],_0x529e16[_0x81d3('0x34')]));if(_0x47c7c9['query'][_0x81d3('0x40')]){_0x482efd[_0x81d3('0x3e')]=_[_0x81d3('0x41')](_0x482efd[_0x81d3('0x3e')],{'$or':_[_0x81d3('0x42')](_0x482efd[_0x81d3('0x36')],function(_0x2d2dce){var _0xc407ec={};_0xc407ec[_0x2d2dce]={'$like':'%'+_0x47c7c9[_0x81d3('0x33')][_0x81d3('0x40')]+'%'};return _0xc407ec;})});}_0x482efd=_[_0x81d3('0x41')]({},_0x482efd,_0x47c7c9[_0x81d3('0x46')]);return _0x23d8db['getDescriptions'](_0x482efd);}})[_0x81d3('0x18')](function(_0x3e0a4c){if(_0x3e0a4c){_0x24ac16=_0x3e0a4c[_0x81d3('0x38')];if(!_0x47c7c9[_0x81d3('0x33')][_0x81d3('0x39')](_0x81d3('0x3a'))){_0x482efd[_0x81d3('0x3b')]=qs[_0x81d3('0x3b')](_0x47c7c9[_0x81d3('0x33')]['limit']);_0x482efd[_0x81d3('0x24')]=qs[_0x81d3('0x24')](_0x47c7c9[_0x81d3('0x33')][_0x81d3('0x24')]);}return _0x23d8db[_0x81d3('0x55')](_0x482efd);}})[_0x81d3('0x18')](function(_0xd695ff){if(_0xd695ff){return _0xd695ff?{'count':_0x24ac16,'rows':_0xd695ff}:null;}})[_0x81d3('0x18')](respondWithResult(_0x46606a,null))[_0x81d3('0x4e')](handleError(_0x46606a,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 752d314..f34996d 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 _0xa631=['api','bluebird','exports','util','../../config/logger'];(function(_0x3fbb22,_0x35eb1f){var _0x45802a=function(_0x4876f0){while(--_0x4876f0){_0x3fbb22['push'](_0x3fbb22['shift']());}};_0x45802a(++_0x35eb1f);}(_0xa631,0xe4));var _0x1a63=function(_0xaec602,_0xd1cdca){_0xaec602=_0xaec602-0x0;var _0x555e71=_0xa631[_0xaec602];return _0x555e71;};'use strict';var _=require('lodash');var util=require(_0x1a63('0x0'));var logger=require(_0x1a63('0x1'))(_0x1a63('0x2'));var moment=require('moment');var BPromise=require(_0x1a63('0x3'));var rp=require('request-promise');var attributes=require('./intZohoConfiguration.attributes');module[_0x1a63('0x4')]=function(_0x1def2e,_0x24bd2a){return _0x1def2e['define']('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc70b=['./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0xc70b,0x13b));var _0xbc70=function(_0x4459e7,_0x4eb1f1){_0x4459e7=_0x4459e7-0x0;var _0x20ea9f=_0xc70b[_0x4459e7];return _0x20ea9f;};'use strict';var _=require(_0xbc70('0x0'));var util=require('util');var logger=require(_0xbc70('0x1'))('api');var moment=require(_0xbc70('0x2'));var BPromise=require(_0xbc70('0x3'));var rp=require(_0xbc70('0x4'));var attributes=require(_0xbc70('0x5'));module[_0xbc70('0x6')]=function(_0x50b76d,_0x3e20ec){return _0x50b76d[_0xbc70('0x7')](_0xbc70('0x8'),attributes,{'tableName':_0xbc70('0x9'),'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 4595ae9..8cdb53c 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 _0x3385=['../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2c435f,_0x4ab330){var _0x37a934=function(_0x752c7d){while(--_0x752c7d){_0x2c435f['push'](_0x2c435f['shift']());}};_0x37a934(++_0x4ab330);}(_0x3385,0x168));var _0x5338=function(_0x3da144,_0x578cbd){_0x3da144=_0x3da144-0x0;var _0x13fdc7=_0x3385[_0x3da144];return _0x13fdc7;};'use strict';var _=require(_0x5338('0x0'));var util=require(_0x5338('0x1'));var moment=require(_0x5338('0x2'));var BPromise=require('bluebird');var rs=require(_0x5338('0x3'));var fs=require('fs');var Redis=require(_0x5338('0x4'));var db=require(_0x5338('0x5'))['db'];var utils=require(_0x5338('0x6'));var logger=require(_0x5338('0x7'))('rpc');var config=require(_0x5338('0x8'));var jayson=require(_0x5338('0x9'));var client=jayson[_0x5338('0xa')][_0x5338('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a3017,_0x55a663,_0x4f7573){return new BPromise(function(_0x1424f0,_0x50290f){return client[_0x5338('0xc')](_0x2a3017,_0x4f7573)[_0x5338('0xd')](function(_0x3813a5){logger[_0x5338('0xe')](_0x5338('0xf'),_0x55a663,_0x5338('0x10'));logger[_0x5338('0x11')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x55a663,_0x5338('0x10'),JSON['stringify'](_0x3813a5));if(_0x3813a5['error']){if(_0x3813a5[_0x5338('0x12')][_0x5338('0x13')]===0x1f4){logger['error'](_0x5338('0xf'),_0x55a663,_0x3813a5[_0x5338('0x12')][_0x5338('0x14')]);return _0x50290f(_0x3813a5[_0x5338('0x12')][_0x5338('0x14')]);}logger[_0x5338('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x55a663,_0x3813a5[_0x5338('0x12')]['message']);return _0x1424f0(_0x3813a5[_0x5338('0x12')][_0x5338('0x14')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x55a663,_0x5338('0x10'));_0x1424f0(_0x3813a5[_0x5338('0x15')]['message']);}})[_0x5338('0x16')](function(_0x54453a){logger[_0x5338('0x12')](_0x5338('0xf'),_0x55a663,_0x54453a);_0x50290f(_0x54453a);});});} \ No newline at end of file +var _0xeeeb=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4c063f,_0x492ad4){var _0x13a173=function(_0x2c55bb){while(--_0x2c55bb){_0x4c063f['push'](_0x4c063f['shift']());}};_0x13a173(++_0x492ad4);}(_0xeeeb,0x108));var _0xbeee=function(_0xf585fc,_0x4115b9){_0xf585fc=_0xf585fc-0x0;var _0x2657d4=_0xeeeb[_0xf585fc];return _0x2657d4;};'use strict';var _=require(_0xbeee('0x0'));var util=require(_0xbeee('0x1'));var moment=require(_0xbeee('0x2'));var BPromise=require(_0xbeee('0x3'));var rs=require(_0xbeee('0x4'));var fs=require('fs');var Redis=require(_0xbeee('0x5'));var db=require(_0xbeee('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbeee('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbeee('0x8')][_0xbeee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3179fb,_0x4cab5f,_0x4fb6a4){return new BPromise(function(_0x2cadb7,_0x499fbf){return client[_0xbeee('0xa')](_0x3179fb,_0x4fb6a4)['then'](function(_0x14f221){logger[_0xbeee('0xb')](_0xbeee('0xc'),_0x4cab5f,_0xbeee('0xd'));logger[_0xbeee('0xe')](_0xbeee('0xf'),_0x4cab5f,'request\x20sent',JSON[_0xbeee('0x10')](_0x14f221));if(_0x14f221[_0xbeee('0x11')]){if(_0x14f221['error'][_0xbeee('0x12')]===0x1f4){logger[_0xbeee('0x11')](_0xbeee('0xc'),_0x4cab5f,_0x14f221['error']['message']);return _0x499fbf(_0x14f221[_0xbeee('0x11')][_0xbeee('0x13')]);}logger[_0xbeee('0x11')](_0xbeee('0xc'),_0x4cab5f,_0x14f221[_0xbeee('0x11')][_0xbeee('0x13')]);return _0x2cadb7(_0x14f221['error'][_0xbeee('0x13')]);}else{logger[_0xbeee('0xb')](_0xbeee('0xc'),_0x4cab5f,'request\x20sent');_0x2cadb7(_0x14f221[_0xbeee('0x14')]['message']);}})[_0xbeee('0x15')](function(_0x5511dd){logger[_0xbeee('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x4cab5f,_0x5511dd);_0x499fbf(_0x5511dd);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index d42a7fe..ec122f6 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 _0x13f7=['update','delete','util','path','express','Router','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','show','post','put'];(function(_0x5baed9,_0x409757){var _0x43aad3=function(_0x4e6713){while(--_0x4e6713){_0x5baed9['push'](_0x5baed9['shift']());}};_0x43aad3(++_0x409757);}(_0x13f7,0x1c2));var _0x713f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x13f7[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x713f('0x0'));var path=require(_0x713f('0x1'));var timeout=require('connect-timeout');var express=require(_0x713f('0x2'));var router=express[_0x713f('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x713f('0x4'));var controller=require(_0x713f('0x5'));router[_0x713f('0x6')]('/',auth[_0x713f('0x7')](),controller['index']);router[_0x713f('0x6')](_0x713f('0x8'),auth[_0x713f('0x7')](),controller[_0x713f('0x9')]);router[_0x713f('0xa')]('/',auth[_0x713f('0x7')](),controller['create']);router[_0x713f('0xb')]('/:id',auth[_0x713f('0x7')](),controller[_0x713f('0xc')]);router[_0x713f('0xd')](_0x713f('0x8'),auth[_0x713f('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb4b7=['exports','multer','util','connect-timeout','express','../../components/auth/service','./intZohoField.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy'];(function(_0x2ba740,_0x62a305){var _0x358bda=function(_0x16cc07){while(--_0x16cc07){_0x2ba740['push'](_0x2ba740['shift']());}};_0x358bda(++_0x62a305);}(_0xb4b7,0x141));var _0x7b4b=function(_0x26159d,_0x303a96){_0x26159d=_0x26159d-0x0;var _0x533106=_0xb4b7[_0x26159d];return _0x533106;};'use strict';var multer=require(_0x7b4b('0x0'));var util=require(_0x7b4b('0x1'));var path=require('path');var timeout=require(_0x7b4b('0x2'));var express=require(_0x7b4b('0x3'));var router=express['Router']();var auth=require(_0x7b4b('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7b4b('0x5'));router[_0x7b4b('0x6')]('/',auth[_0x7b4b('0x7')](),controller['index']);router['get'](_0x7b4b('0x8'),auth[_0x7b4b('0x7')](),controller['show']);router[_0x7b4b('0x9')]('/',auth[_0x7b4b('0x7')](),controller[_0x7b4b('0xa')]);router[_0x7b4b('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7b4b('0xc')]);router[_0x7b4b('0xd')](_0x7b4b('0x8'),auth['isAuthenticated'](),controller[_0x7b4b('0xe')]);module[_0x7b4b('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 1b818f3..fba6c58 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 _0x5c00=['string','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue'];(function(_0x3f47c0,_0x174f25){var _0x4bd7bc=function(_0x3d6090){while(--_0x3d6090){_0x3f47c0['push'](_0x3f47c0['shift']());}};_0x4bd7bc(++_0x174f25);}(_0x5c00,0x17e));var _0x05c0=function(_0xf4f343,_0x41fe4a){_0xf4f343=_0xf4f343-0x0;var _0x4cda68=_0x5c00[_0xf4f343];return _0x4cda68;};'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 +var _0x153f=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x153f,0x15b));var _0xf153=function(_0x5c98b4,_0x594114){_0x5c98b4=_0x5c98b4-0x0;var _0x38d314=_0x153f[_0x5c98b4];return _0x38d314;};'use strict';var Sequelize=require(_0xf153('0x0'));module[_0xf153('0x1')]={'type':{'type':Sequelize[_0xf153('0x2')](_0xf153('0x3'),_0xf153('0x4'),_0xf153('0x5'),_0xf153('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf153('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf153('0x2')](_0xf153('0x3'),_0xf153('0x4'),_0xf153('0x5'))},'keyContent':{'type':Sequelize[_0xf153('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf153('0x7')]},'customField':{'type':Sequelize[_0xf153('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf153('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index beaf5a0..681edb4 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 _0xbcdc=['../../mysqldb','status','json','count','offset','limit','set','reject','save','update','then','destroy','end','sendStatus','stack','name','index','ZohoField','rawAttributes','keys','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','where','filters','pick','filter','map','key','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','length','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment'];(function(_0x1b03d0,_0x4c9239){var _0x1126a8=function(_0x144925){while(--_0x144925){_0x1b03d0['push'](_0x1b03d0['shift']());}};_0x1126a8(++_0x4c9239);}(_0xbcdc,0xb7));var _0xcbcd=function(_0x523eab,_0x44fbd3){_0x523eab=_0x523eab-0x0;var _0x386782=_0xbcdc[_0x523eab];return _0x386782;};'use strict';var pdf=require(_0xcbcd('0x0'));var emlformat=require(_0xcbcd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcbcd('0x2'));var jsonpatch=require(_0xcbcd('0x3'));var rp=require(_0xcbcd('0x4'));var moment=require(_0xcbcd('0x5'));var BPromise=require(_0xcbcd('0x6'));var Mustache=require('mustache');var util=require(_0xcbcd('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcbcd('0x8'));var fs=require('fs');var _=require(_0xcbcd('0x9'));var squel=require(_0xcbcd('0xa'));var crypto=require(_0xcbcd('0xb'));var jsforce=require(_0xcbcd('0xc'));var deskjs=require(_0xcbcd('0xd'));var toCsv=require(_0xcbcd('0xe'));var querystring=require(_0xcbcd('0xf'));var Papa=require(_0xcbcd('0x10'));var authService=require(_0xcbcd('0x11'));var hardwareService=require(_0xcbcd('0x12'));var Redis=require(_0xcbcd('0x13'));var qs=require(_0xcbcd('0x14'));var logger=require(_0xcbcd('0x15'))(_0xcbcd('0x16'));var utils=require('../../config/utils');var config=require(_0xcbcd('0x17'));var db=require(_0xcbcd('0x18'))['db'];function respondWithStatusCode(_0x348bc5,_0x368f3e){_0x368f3e=_0x368f3e||0xcc;return function(_0x1bc024){if(_0x1bc024){return _0x348bc5['sendStatus'](_0x368f3e);}return _0x348bc5[_0xcbcd('0x19')](_0x368f3e)['end']();};}function respondWithResult(_0x418a25,_0x4363a0){_0x4363a0=_0x4363a0||0xc8;return function(_0x3159a2){if(_0x3159a2){return _0x418a25['status'](_0x4363a0)[_0xcbcd('0x1a')](_0x3159a2);}};}function respondWithFilteredResult(_0xd061d,_0x15b6d4){return function(_0x215af1){if(_0x215af1){var _0x458f80=_0x215af1[_0xcbcd('0x1b')],_0x12db2a=_0x15b6d4[_0xcbcd('0x1c')],_0x5c03e2=_0x15b6d4[_0xcbcd('0x1c')]+_0x15b6d4[_0xcbcd('0x1d')],_0x619d4d;if(_0x5c03e2>=_0x458f80){_0x5c03e2=_0x458f80;_0x619d4d=0xc8;}else{_0x619d4d=0xce;}_0xd061d[_0xcbcd('0x19')](_0x619d4d);return _0xd061d[_0xcbcd('0x1e')]('Content-Range',_0x12db2a+'-'+_0x5c03e2+'/'+_0x458f80)[_0xcbcd('0x1a')](_0x215af1);}return null;};}function patchUpdates(_0xcbf70a){return function(_0x18f249){try{jsonpatch['apply'](_0x18f249,_0xcbf70a,!![]);}catch(_0xf643e5){return BPromise[_0xcbcd('0x1f')](_0xf643e5);}return _0x18f249[_0xcbcd('0x20')]();};}function saveUpdates(_0x401aaf,_0x2ac0da){return function(_0x32ffbe){if(_0x32ffbe){return _0x32ffbe[_0xcbcd('0x21')](_0x401aaf)[_0xcbcd('0x22')](function(_0x2dcb95){return _0x2dcb95;});}return null;};}function removeEntity(_0x4e5397,_0x10b2b2){return function(_0x180105){if(_0x180105){return _0x180105[_0xcbcd('0x23')]()[_0xcbcd('0x22')](function(){_0x4e5397[_0xcbcd('0x19')](0xcc)[_0xcbcd('0x24')]();});}};}function handleEntityNotFound(_0x4e4156,_0x32984e){return function(_0x25b941){if(!_0x25b941){_0x4e4156[_0xcbcd('0x25')](0x194);}return _0x25b941;};}function handleError(_0x9961b1,_0x4adc78){_0x4adc78=_0x4adc78||0x1f4;return function(_0x2ef4d3){logger['error'](_0x2ef4d3[_0xcbcd('0x26')]);if(_0x2ef4d3[_0xcbcd('0x27')]){delete _0x2ef4d3[_0xcbcd('0x27')];}_0x9961b1['status'](_0x4adc78)['send'](_0x2ef4d3);};}exports[_0xcbcd('0x28')]=function(_0x44b302,_0x2bdbed){var _0x334835={},_0x1ed889={},_0x4db9c9={'count':0x0,'rows':[]};var _0x93f244=db[_0xcbcd('0x29')][_0xcbcd('0x2a')];_0x1ed889['model']=_[_0xcbcd('0x2b')](_0x93f244);_0x1ed889[_0xcbcd('0x2c')]=_[_0xcbcd('0x2b')](_0x44b302[_0xcbcd('0x2c')]);_0x1ed889['filters']=_[_0xcbcd('0x2d')](_0x1ed889['model'],_0x1ed889[_0xcbcd('0x2c')]);_0x334835['attributes']=_[_0xcbcd('0x2d')](_0x1ed889[_0xcbcd('0x2e')],qs[_0xcbcd('0x2f')](_0x44b302[_0xcbcd('0x2c')][_0xcbcd('0x2f')]));_0x334835[_0xcbcd('0x30')]=_0x334835[_0xcbcd('0x30')]['length']?_0x334835[_0xcbcd('0x30')]:_0x1ed889[_0xcbcd('0x2e')];if(!_0x44b302['query'][_0xcbcd('0x31')](_0xcbcd('0x32'))){_0x334835[_0xcbcd('0x1d')]=qs[_0xcbcd('0x1d')](_0x44b302['query'][_0xcbcd('0x1d')]);_0x334835[_0xcbcd('0x1c')]=qs[_0xcbcd('0x1c')](_0x44b302[_0xcbcd('0x2c')]['offset']);}_0x334835['order']=qs['sort'](_0x44b302[_0xcbcd('0x2c')]['sort']);_0x334835[_0xcbcd('0x33')]=qs[_0xcbcd('0x34')](_[_0xcbcd('0x35')](_0x44b302['query'],_0x1ed889[_0xcbcd('0x34')]));if(_0x44b302[_0xcbcd('0x2c')][_0xcbcd('0x36')]){_0x334835[_0xcbcd('0x33')]=_['merge'](_0x334835[_0xcbcd('0x33')],{'$or':_[_0xcbcd('0x37')](_0x93f244,function(_0x518f09){if(_0x518f09['type'][_0xcbcd('0x38')]!==_0xcbcd('0x39')){var _0x27ac97={};_0x27ac97[_0x518f09['field']]={'$like':'%'+_0x44b302[_0xcbcd('0x2c')][_0xcbcd('0x36')]+'%'};return _0x27ac97;}})});}_0x334835=_[_0xcbcd('0x3a')]({},_0x334835,_0x44b302['options']);var _0x47a901={'where':_0x334835[_0xcbcd('0x33')]};return db[_0xcbcd('0x29')]['count'](_0x47a901)['then'](function(_0xddecd3){_0x4db9c9[_0xcbcd('0x1b')]=_0xddecd3;if(_0x44b302[_0xcbcd('0x2c')][_0xcbcd('0x3b')]){_0x334835['include']=[{'all':!![]}];}return db['ZohoField'][_0xcbcd('0x3c')](_0x334835);})['then'](function(_0x1ccb94){_0x4db9c9[_0xcbcd('0x3d')]=_0x1ccb94;return _0x4db9c9;})[_0xcbcd('0x22')](respondWithFilteredResult(_0x2bdbed,_0x334835))[_0xcbcd('0x3e')](handleError(_0x2bdbed,null));};exports[_0xcbcd('0x3f')]=function(_0x4c60c2,_0x4545eb){var _0x59e791={'raw':!![],'where':{'id':_0x4c60c2[_0xcbcd('0x40')]['id']}},_0x5715ea={};_0x5715ea[_0xcbcd('0x2e')]=_[_0xcbcd('0x2b')](db[_0xcbcd('0x29')]['rawAttributes']);_0x5715ea['query']=_[_0xcbcd('0x2b')](_0x4c60c2['query']);_0x5715ea[_0xcbcd('0x34')]=_[_0xcbcd('0x2d')](_0x5715ea[_0xcbcd('0x2e')],_0x5715ea[_0xcbcd('0x2c')]);_0x59e791[_0xcbcd('0x30')]=_['intersection'](_0x5715ea[_0xcbcd('0x2e')],qs['fields'](_0x4c60c2['query'][_0xcbcd('0x2f')]));_0x59e791[_0xcbcd('0x30')]=_0x59e791[_0xcbcd('0x30')][_0xcbcd('0x41')]?_0x59e791[_0xcbcd('0x30')]:_0x5715ea[_0xcbcd('0x2e')];if(_0x4c60c2[_0xcbcd('0x2c')][_0xcbcd('0x3b')]){_0x59e791['include']=[{'all':!![]}];}_0x59e791=_['merge']({},_0x59e791,_0x4c60c2['options']);return db['ZohoField'][_0xcbcd('0x42')](_0x59e791)[_0xcbcd('0x22')](handleEntityNotFound(_0x4545eb,null))['then'](respondWithResult(_0x4545eb,null))[_0xcbcd('0x3e')](handleError(_0x4545eb,null));};exports[_0xcbcd('0x43')]=function(_0x114ad8,_0x55ad4c){return db[_0xcbcd('0x29')][_0xcbcd('0x43')](_0x114ad8[_0xcbcd('0x44')],{})[_0xcbcd('0x22')](respondWithResult(_0x55ad4c,0xc9))[_0xcbcd('0x3e')](handleError(_0x55ad4c,null));};exports[_0xcbcd('0x21')]=function(_0x3bdfe0,_0x5e7adb){if(_0x3bdfe0['body']['id']){delete _0x3bdfe0['body']['id'];}return db[_0xcbcd('0x29')]['find']({'where':{'id':_0x3bdfe0[_0xcbcd('0x40')]['id']}})[_0xcbcd('0x22')](handleEntityNotFound(_0x5e7adb,null))[_0xcbcd('0x22')](saveUpdates(_0x3bdfe0[_0xcbcd('0x44')],null))[_0xcbcd('0x22')](respondWithResult(_0x5e7adb,null))[_0xcbcd('0x3e')](handleError(_0x5e7adb,null));};exports['destroy']=function(_0x2c50fb,_0x180029){return db[_0xcbcd('0x29')][_0xcbcd('0x42')]({'where':{'id':_0x2c50fb['params']['id']}})[_0xcbcd('0x22')](handleEntityNotFound(_0x180029,null))['then'](removeEntity(_0x180029,null))[_0xcbcd('0x3e')](handleError(_0x180029,null));}; \ No newline at end of file +var _0x9a79=['end','status','json','offset','limit','apply','update','destroy','then','sendStatus','stack','name','index','ZohoField','rawAttributes','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','key','field','options','count','includeAll','include','rows','show','params','keys','fields','length','catch','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x459d7d,_0x55db19){var _0x26abf1=function(_0x39e5d5){while(--_0x39e5d5){_0x459d7d['push'](_0x459d7d['shift']());}};_0x26abf1(++_0x55db19);}(_0x9a79,0xbc));var _0x99a7=function(_0x6ca352,_0x241636){_0x6ca352=_0x6ca352-0x0;var _0x20c3f3=_0x9a79[_0x6ca352];return _0x20c3f3;};'use strict';var pdf=require(_0x99a7('0x0'));var emlformat=require(_0x99a7('0x1'));var rimraf=require(_0x99a7('0x2'));var zipdir=require(_0x99a7('0x3'));var jsonpatch=require(_0x99a7('0x4'));var rp=require(_0x99a7('0x5'));var moment=require(_0x99a7('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x99a7('0x7'));var util=require('util');var path=require(_0x99a7('0x8'));var sox=require(_0x99a7('0x9'));var csv=require(_0x99a7('0xa'));var ejs=require(_0x99a7('0xb'));var fs=require('fs');var _=require(_0x99a7('0xc'));var squel=require(_0x99a7('0xd'));var crypto=require(_0x99a7('0xe'));var jsforce=require(_0x99a7('0xf'));var deskjs=require(_0x99a7('0x10'));var toCsv=require(_0x99a7('0xa'));var querystring=require(_0x99a7('0x11'));var Papa=require(_0x99a7('0x12'));var authService=require(_0x99a7('0x13'));var hardwareService=require(_0x99a7('0x14'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x99a7('0x15'))(_0x99a7('0x16'));var utils=require('../../config/utils');var config=require(_0x99a7('0x17'));var db=require(_0x99a7('0x18'))['db'];function respondWithStatusCode(_0x39e6df,_0x3f8f87){_0x3f8f87=_0x3f8f87||0xcc;return function(_0x24dfa0){if(_0x24dfa0){return _0x39e6df['sendStatus'](_0x3f8f87);}return _0x39e6df['status'](_0x3f8f87)[_0x99a7('0x19')]();};}function respondWithResult(_0x3c6690,_0x16c551){_0x16c551=_0x16c551||0xc8;return function(_0x62bce3){if(_0x62bce3){return _0x3c6690[_0x99a7('0x1a')](_0x16c551)[_0x99a7('0x1b')](_0x62bce3);}};}function respondWithFilteredResult(_0x5f5640,_0x445129){return function(_0x34d5b8){if(_0x34d5b8){var _0x2bf785=_0x34d5b8['count'],_0x28b37e=_0x445129['offset'],_0xedb344=_0x445129[_0x99a7('0x1c')]+_0x445129[_0x99a7('0x1d')],_0x5afb22;if(_0xedb344>=_0x2bf785){_0xedb344=_0x2bf785;_0x5afb22=0xc8;}else{_0x5afb22=0xce;}_0x5f5640[_0x99a7('0x1a')](_0x5afb22);return _0x5f5640['set']('Content-Range',_0x28b37e+'-'+_0xedb344+'/'+_0x2bf785)[_0x99a7('0x1b')](_0x34d5b8);}return null;};}function patchUpdates(_0x4233eb){return function(_0x23a58a){try{jsonpatch[_0x99a7('0x1e')](_0x23a58a,_0x4233eb,!![]);}catch(_0x4dbc21){return BPromise['reject'](_0x4dbc21);}return _0x23a58a['save']();};}function saveUpdates(_0x191e8d,_0x2883da){return function(_0x3697a6){if(_0x3697a6){return _0x3697a6[_0x99a7('0x1f')](_0x191e8d)['then'](function(_0x421cc4){return _0x421cc4;});}return null;};}function removeEntity(_0x507772,_0x582027){return function(_0x4d988c){if(_0x4d988c){return _0x4d988c[_0x99a7('0x20')]()[_0x99a7('0x21')](function(){_0x507772[_0x99a7('0x1a')](0xcc)[_0x99a7('0x19')]();});}};}function handleEntityNotFound(_0x42fdfe,_0x204450){return function(_0x13cfcb){if(!_0x13cfcb){_0x42fdfe[_0x99a7('0x22')](0x194);}return _0x13cfcb;};}function handleError(_0x123ca5,_0x3a0911){_0x3a0911=_0x3a0911||0x1f4;return function(_0x598cb6){logger['error'](_0x598cb6[_0x99a7('0x23')]);if(_0x598cb6[_0x99a7('0x24')]){delete _0x598cb6['name'];}_0x123ca5[_0x99a7('0x1a')](_0x3a0911)['send'](_0x598cb6);};}exports[_0x99a7('0x25')]=function(_0x3552a3,_0x444d01){var _0x30a741={},_0x2f180e={},_0x8bf27f={'count':0x0,'rows':[]};var _0x3d4d9d=db[_0x99a7('0x26')][_0x99a7('0x27')];_0x2f180e[_0x99a7('0x28')]=_['keys'](_0x3d4d9d);_0x2f180e[_0x99a7('0x29')]=_['keys'](_0x3552a3[_0x99a7('0x29')]);_0x2f180e[_0x99a7('0x2a')]=_[_0x99a7('0x2b')](_0x2f180e['model'],_0x2f180e[_0x99a7('0x29')]);_0x30a741['attributes']=_['intersection'](_0x2f180e[_0x99a7('0x28')],qs['fields'](_0x3552a3[_0x99a7('0x29')]['fields']));_0x30a741['attributes']=_0x30a741[_0x99a7('0x2c')]['length']?_0x30a741[_0x99a7('0x2c')]:_0x2f180e[_0x99a7('0x28')];if(!_0x3552a3[_0x99a7('0x29')][_0x99a7('0x2d')](_0x99a7('0x2e'))){_0x30a741[_0x99a7('0x1d')]=qs[_0x99a7('0x1d')](_0x3552a3[_0x99a7('0x29')][_0x99a7('0x1d')]);_0x30a741[_0x99a7('0x1c')]=qs['offset'](_0x3552a3[_0x99a7('0x29')]['offset']);}_0x30a741[_0x99a7('0x2f')]=qs[_0x99a7('0x30')](_0x3552a3['query'][_0x99a7('0x30')]);_0x30a741['where']=qs['filters'](_[_0x99a7('0x31')](_0x3552a3[_0x99a7('0x29')],_0x2f180e[_0x99a7('0x2a')]));if(_0x3552a3[_0x99a7('0x29')][_0x99a7('0x32')]){_0x30a741[_0x99a7('0x33')]=_[_0x99a7('0x34')](_0x30a741[_0x99a7('0x33')],{'$or':_[_0x99a7('0x35')](_0x3d4d9d,function(_0x26e2ab){if(_0x26e2ab[_0x99a7('0x36')][_0x99a7('0x37')]!=='VIRTUAL'){var _0x4af39b={};_0x4af39b[_0x26e2ab[_0x99a7('0x38')]]={'$like':'%'+_0x3552a3[_0x99a7('0x29')][_0x99a7('0x32')]+'%'};return _0x4af39b;}})});}_0x30a741=_['merge']({},_0x30a741,_0x3552a3[_0x99a7('0x39')]);var _0x3abbcc={'where':_0x30a741[_0x99a7('0x33')]};return db['ZohoField']['count'](_0x3abbcc)[_0x99a7('0x21')](function(_0x2ce8a6){_0x8bf27f[_0x99a7('0x3a')]=_0x2ce8a6;if(_0x3552a3[_0x99a7('0x29')][_0x99a7('0x3b')]){_0x30a741[_0x99a7('0x3c')]=[{'all':!![]}];}return db[_0x99a7('0x26')]['findAll'](_0x30a741);})['then'](function(_0xee71f4){_0x8bf27f[_0x99a7('0x3d')]=_0xee71f4;return _0x8bf27f;})[_0x99a7('0x21')](respondWithFilteredResult(_0x444d01,_0x30a741))['catch'](handleError(_0x444d01,null));};exports[_0x99a7('0x3e')]=function(_0x4cf546,_0x1edca3){var _0x137c67={'raw':!![],'where':{'id':_0x4cf546[_0x99a7('0x3f')]['id']}},_0x9b372b={};_0x9b372b['model']=_['keys'](db[_0x99a7('0x26')]['rawAttributes']);_0x9b372b['query']=_[_0x99a7('0x40')](_0x4cf546[_0x99a7('0x29')]);_0x9b372b[_0x99a7('0x2a')]=_[_0x99a7('0x2b')](_0x9b372b[_0x99a7('0x28')],_0x9b372b[_0x99a7('0x29')]);_0x137c67[_0x99a7('0x2c')]=_['intersection'](_0x9b372b['model'],qs[_0x99a7('0x41')](_0x4cf546[_0x99a7('0x29')][_0x99a7('0x41')]));_0x137c67[_0x99a7('0x2c')]=_0x137c67[_0x99a7('0x2c')][_0x99a7('0x42')]?_0x137c67['attributes']:_0x9b372b[_0x99a7('0x28')];if(_0x4cf546[_0x99a7('0x29')][_0x99a7('0x3b')]){_0x137c67['include']=[{'all':!![]}];}_0x137c67=_[_0x99a7('0x34')]({},_0x137c67,_0x4cf546[_0x99a7('0x39')]);return db[_0x99a7('0x26')]['find'](_0x137c67)[_0x99a7('0x21')](handleEntityNotFound(_0x1edca3,null))[_0x99a7('0x21')](respondWithResult(_0x1edca3,null))[_0x99a7('0x43')](handleError(_0x1edca3,null));};exports[_0x99a7('0x44')]=function(_0x1fc81c,_0x3d888a){return db[_0x99a7('0x26')][_0x99a7('0x44')](_0x1fc81c[_0x99a7('0x45')],{})[_0x99a7('0x21')](respondWithResult(_0x3d888a,0xc9))[_0x99a7('0x43')](handleError(_0x3d888a,null));};exports['update']=function(_0x3bcca7,_0x1bf549){if(_0x3bcca7['body']['id']){delete _0x3bcca7['body']['id'];}return db[_0x99a7('0x26')][_0x99a7('0x46')]({'where':{'id':_0x3bcca7['params']['id']}})['then'](handleEntityNotFound(_0x1bf549,null))[_0x99a7('0x21')](saveUpdates(_0x3bcca7[_0x99a7('0x45')],null))[_0x99a7('0x21')](respondWithResult(_0x1bf549,null))['catch'](handleError(_0x1bf549,null));};exports[_0x99a7('0x20')]=function(_0x362382,_0x526323){return db[_0x99a7('0x26')][_0x99a7('0x46')]({'where':{'id':_0x362382['params']['id']}})[_0x99a7('0x21')](handleEntityNotFound(_0x526323,null))[_0x99a7('0x21')](removeEntity(_0x526323,null))[_0x99a7('0x43')](handleError(_0x526323,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 684e709..ef0c7ab 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 _0x59f8=['request-promise','./intZohoField.attributes','exports','FieldId','lodash','util','api'];(function(_0x4c70c4,_0x963969){var _0x437865=function(_0x54e323){while(--_0x54e323){_0x4c70c4['push'](_0x4c70c4['shift']());}};_0x437865(++_0x963969);}(_0x59f8,0x1d2));var _0x859f=function(_0x2a2e62,_0x54ccc3){_0x2a2e62=_0x2a2e62-0x0;var _0x6ae6af=_0x59f8[_0x2a2e62];return _0x6ae6af;};'use strict';var _=require(_0x859f('0x0'));var util=require(_0x859f('0x1'));var logger=require('../../config/logger')(_0x859f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x859f('0x3'));var attributes=require(_0x859f('0x4'));module[_0x859f('0x5')]=function(_0x3e15a3,_0x2fdd28){return _0x3e15a3['define']('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x859f('0x6')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd7b0=['lodash','../../config/logger','api','moment','bluebird','./intZohoField.attributes','exports','define','int_zoho_fields','zoho_unique_index','idField','FieldId'];(function(_0x1d3ac1,_0x57fcd7){var _0x2024f2=function(_0x4d1029){while(--_0x4d1029){_0x1d3ac1['push'](_0x1d3ac1['shift']());}};_0x2024f2(++_0x57fcd7);}(_0xd7b0,0x12c));var _0x0d7b=function(_0x4e0202,_0x706d79){_0x4e0202=_0x4e0202-0x0;var _0x17f034=_0xd7b0[_0x4e0202];return _0x17f034;};'use strict';var _=require(_0x0d7b('0x0'));var util=require('util');var logger=require(_0x0d7b('0x1'))(_0x0d7b('0x2'));var moment=require(_0x0d7b('0x3'));var BPromise=require(_0x0d7b('0x4'));var rp=require('request-promise');var attributes=require(_0x0d7b('0x5'));module[_0x0d7b('0x6')]=function(_0x31017c,_0x3c5a85){return _0x31017c[_0x0d7b('0x7')]('ZohoField',attributes,{'tableName':_0x0d7b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d7b('0x9'),'fields':[_0x0d7b('0xa'),_0x0d7b('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 04213f5..55e873f 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 _0x98b3=['stringify','error','code','message','result','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x57d71f,_0x598a0e){var _0x2d1d26=function(_0x18f209){while(--_0x18f209){_0x57d71f['push'](_0x57d71f['shift']());}};_0x2d1d26(++_0x598a0e);}(_0x98b3,0x141));var _0x398b=function(_0x39ee3a,_0x2e8ebf){_0x39ee3a=_0x39ee3a-0x0;var _0x4cebea=_0x98b3[_0x39ee3a];return _0x4cebea;};'use strict';var _=require('lodash');var util=require(_0x398b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x398b('0x1'));var fs=require('fs');var Redis=require(_0x398b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x398b('0x3'));var logger=require(_0x398b('0x4'))(_0x398b('0x5'));var config=require(_0x398b('0x6'));var jayson=require(_0x398b('0x7'));var client=jayson['client'][_0x398b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x402f69,_0x54b062,_0x13e7b9){return new BPromise(function(_0x268ccc,_0x46d2cf){return client['request'](_0x402f69,_0x13e7b9)[_0x398b('0x9')](function(_0x42289b){logger[_0x398b('0xa')](_0x398b('0xb'),_0x54b062,'request\x20sent');logger[_0x398b('0xc')](_0x398b('0xd'),_0x54b062,_0x398b('0xe'),JSON[_0x398b('0xf')](_0x42289b));if(_0x42289b[_0x398b('0x10')]){if(_0x42289b[_0x398b('0x10')][_0x398b('0x11')]===0x1f4){logger[_0x398b('0x10')](_0x398b('0xb'),_0x54b062,_0x42289b['error'][_0x398b('0x12')]);return _0x46d2cf(_0x42289b[_0x398b('0x10')][_0x398b('0x12')]);}logger[_0x398b('0x10')]('ZohoField,\x20%s,\x20%s',_0x54b062,_0x42289b[_0x398b('0x10')][_0x398b('0x12')]);return _0x268ccc(_0x42289b[_0x398b('0x10')][_0x398b('0x12')]);}else{logger[_0x398b('0xa')](_0x398b('0xb'),_0x54b062,_0x398b('0xe'));_0x268ccc(_0x42289b[_0x398b('0x13')][_0x398b('0x12')]);}})[_0x398b('0x14')](function(_0x5dac3a){logger[_0x398b('0x10')](_0x398b('0xb'),_0x54b062,_0x5dac3a);_0x46d2cf(_0x5dac3a);});});} \ No newline at end of file +var _0x70f3=['jayson/promise','request','then','info','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ZohoField,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x409316,_0x16889b){var _0x206eb1=function(_0x3b49f1){while(--_0x3b49f1){_0x409316['push'](_0x409316['shift']());}};_0x206eb1(++_0x16889b);}(_0x70f3,0x92));var _0x370f=function(_0x21c493,_0x377ba2){_0x21c493=_0x21c493-0x0;var _0x3f04be=_0x70f3[_0x21c493];return _0x3f04be;};'use strict';var _=require('lodash');var util=require(_0x370f('0x0'));var moment=require(_0x370f('0x1'));var BPromise=require(_0x370f('0x2'));var rs=require(_0x370f('0x3'));var fs=require('fs');var Redis=require(_0x370f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x370f('0x5'));var logger=require('../../config/logger')(_0x370f('0x6'));var config=require(_0x370f('0x7'));var jayson=require(_0x370f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a0d50,_0x5052e5,_0x307a70){return new BPromise(function(_0x41bdc0,_0xb3681f){return client[_0x370f('0x9')](_0x3a0d50,_0x307a70)[_0x370f('0xa')](function(_0xf95ff8){logger[_0x370f('0xb')]('ZohoField,\x20%s,\x20%s',_0x5052e5,'request\x20sent');logger[_0x370f('0xc')](_0x370f('0xd'),_0x5052e5,_0x370f('0xe'),JSON[_0x370f('0xf')](_0xf95ff8));if(_0xf95ff8['error']){if(_0xf95ff8[_0x370f('0x10')][_0x370f('0x11')]===0x1f4){logger[_0x370f('0x10')]('ZohoField,\x20%s,\x20%s',_0x5052e5,_0xf95ff8['error'][_0x370f('0x12')]);return _0xb3681f(_0xf95ff8['error']['message']);}logger[_0x370f('0x10')](_0x370f('0x13'),_0x5052e5,_0xf95ff8[_0x370f('0x10')][_0x370f('0x12')]);return _0x41bdc0(_0xf95ff8[_0x370f('0x10')][_0x370f('0x12')]);}else{logger[_0x370f('0xb')](_0x370f('0x13'),_0x5052e5,_0x370f('0xe'));_0x41bdc0(_0xf95ff8[_0x370f('0x14')][_0x370f('0x12')]);}})[_0x370f('0x15')](function(_0x37b708){logger[_0x370f('0x10')](_0x370f('0x13'),_0x5052e5,_0x37b708);_0xb3681f(_0x37b708);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 58207e6..b49a88e 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 _0xae30=['../../components/interaction/service','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xae30,0x10a));var _0x0ae3=function(_0x485f53,_0x104081){_0x485f53=_0x485f53-0x0;var _0x480f1e=_0xae30[_0x485f53];return _0x480f1e;};'use strict';var multer=require(_0x0ae3('0x0'));var util=require(_0x0ae3('0x1'));var path=require(_0x0ae3('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ae3('0x3'));var router=express[_0x0ae3('0x4')]();var auth=require(_0x0ae3('0x5'));var interaction=require(_0x0ae3('0x6'));var config=require('../../config/environment');module[_0x0ae3('0x7')]=router; \ No newline at end of file +var _0x5334=['express','../../components/auth/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x212971,_0x56bc42){var _0x220c2c=function(_0x54921a){while(--_0x54921a){_0x212971['push'](_0x212971['shift']());}};_0x220c2c(++_0x56bc42);}(_0x5334,0x84));var _0x4533=function(_0x5ea3a4,_0x2544e1){_0x5ea3a4=_0x5ea3a4-0x0;var _0x40d0e5=_0x5334[_0x5ea3a4];return _0x40d0e5;};'use strict';var multer=require(_0x4533('0x0'));var util=require(_0x4533('0x1'));var path=require(_0x4533('0x2'));var timeout=require(_0x4533('0x3'));var express=require(_0x4533('0x4'));var router=express['Router']();var auth=require(_0x4533('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4533('0x6'));module[_0x4533('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 1f8a35d..ef9ff36 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 _0x74c0=['exports','STRING','unique_name_and_version','app.js','INTEGER','state','sequelize'];(function(_0x36fe46,_0x40010c){var _0x4d2e9c=function(_0x2dfa20){while(--_0x2dfa20){_0x36fe46['push'](_0x36fe46['shift']());}};_0x4d2e9c(++_0x40010c);}(_0x74c0,0x148));var _0x074c=function(_0x3318c3,_0x35066){_0x3318c3=_0x3318c3-0x0;var _0x15c002=_0x74c0[_0x3318c3];return _0x15c002;};'use strict';var Sequelize=require(_0x074c('0x0'));module[_0x074c('0x1')]={'name':{'type':Sequelize[_0x074c('0x2')],'allowNull':![],'unique':_0x074c('0x3')},'version':{'type':Sequelize[_0x074c('0x2')],'allowNull':![],'unique':_0x074c('0x3')},'main':{'type':Sequelize[_0x074c('0x2')],'defaultValue':_0x074c('0x4')},'filename':{'type':Sequelize[_0x074c('0x2')]},'path':{'type':Sequelize[_0x074c('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x074c('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x074c('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0x074c('0x6')},'description':{'type':Sequelize[_0x074c('0x2')]},'title':{'type':Sequelize[_0x074c('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x074c('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xdc1b=['unique_name_and_version','INTEGER','state','sequelize','exports','STRING'];(function(_0x29e2af,_0x15e2b1){var _0x1ea06a=function(_0x34d736){while(--_0x34d736){_0x29e2af['push'](_0x29e2af['shift']());}};_0x1ea06a(++_0x15e2b1);}(_0xdc1b,0xb7));var _0xbdc1=function(_0x50a004,_0x193d84){_0x50a004=_0x50a004-0x0;var _0x5e9992=_0xdc1b[_0x50a004];return _0x5e9992;};'use strict';var Sequelize=require(_0xbdc1('0x0'));module[_0xbdc1('0x1')]={'name':{'type':Sequelize[_0xbdc1('0x2')],'allowNull':![],'unique':_0xbdc1('0x3')},'version':{'type':Sequelize[_0xbdc1('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xbdc1('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xbdc1('0x2')]},'path':{'type':Sequelize[_0xbdc1('0x2')]},'type':{'type':Sequelize[_0xbdc1('0x2')]},'size':{'type':Sequelize[_0xbdc1('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xbdc1('0x2')]},'logo':{'type':Sequelize[_0xbdc1('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0xbdc1('0x5')},'description':{'type':Sequelize[_0xbdc1('0x2')]},'title':{'type':Sequelize[_0xbdc1('0x2')]},'remoteUri':{'type':Sequelize[_0xbdc1('0x2')]},'link':{'type':Sequelize[_0xbdc1('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 91b4e95..277e4f2 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 _0x1c52=['bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','end','offset','status','json','update','then','error','name','send','index','Integration','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','map','type','key','field','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x27911e,_0x25462e){var _0x34a39e=function(_0x40f3a6){while(--_0x40f3a6){_0x27911e['push'](_0x27911e['shift']());}};_0x34a39e(++_0x25462e);}(_0x1c52,0x7c));var _0x21c5=function(_0x567582,_0x5b355f){_0x567582=_0x567582-0x0;var _0x2c7781=_0x1c52[_0x567582];return _0x2c7781;};'use strict';var pdf=require(_0x21c5('0x0'));var emlformat=require(_0x21c5('0x1'));var rimraf=require(_0x21c5('0x2'));var zipdir=require(_0x21c5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x21c5('0x4'));var Mustache=require(_0x21c5('0x5'));var util=require('util');var path=require(_0x21c5('0x6'));var sox=require(_0x21c5('0x7'));var csv=require(_0x21c5('0x8'));var ejs=require(_0x21c5('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x21c5('0xa'));var crypto=require(_0x21c5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x21c5('0xc'));var toCsv=require(_0x21c5('0x8'));var querystring=require(_0x21c5('0xd'));var Papa=require(_0x21c5('0xe'));var authService=require('../../components/auth/service');var hardwareService=require(_0x21c5('0xf'));var Redis=require(_0x21c5('0x10'));var qs=require(_0x21c5('0x11'));var logger=require('../../config/logger')(_0x21c5('0x12'));var utils=require('../../config/utils');var config=require(_0x21c5('0x13'));var db=require(_0x21c5('0x14'))['db'];function respondWithStatusCode(_0x377983,_0x2dc212){_0x2dc212=_0x2dc212||0xcc;return function(_0x511e96){if(_0x511e96){return _0x377983[_0x21c5('0x15')](_0x2dc212);}return _0x377983['status'](_0x2dc212)[_0x21c5('0x16')]();};}function respondWithResult(_0x93e063,_0x5bb986){_0x5bb986=_0x5bb986||0xc8;return function(_0x17be3d){if(_0x17be3d){return _0x93e063['status'](_0x5bb986)['json'](_0x17be3d);}};}function respondWithFilteredResult(_0x3ba28b,_0x35d2fe){return function(_0x47030b){if(_0x47030b){var _0x20902a=_0x47030b['count'],_0x15de0c=_0x35d2fe[_0x21c5('0x17')],_0x102433=_0x35d2fe['offset']+_0x35d2fe['limit'],_0x41b810;if(_0x102433>=_0x20902a){_0x102433=_0x20902a;_0x41b810=0xc8;}else{_0x41b810=0xce;}_0x3ba28b[_0x21c5('0x18')](_0x41b810);return _0x3ba28b['set']('Content-Range',_0x15de0c+'-'+_0x102433+'/'+_0x20902a)[_0x21c5('0x19')](_0x47030b);}return null;};}function patchUpdates(_0x4e630f){return function(_0x196c68){try{jsonpatch['apply'](_0x196c68,_0x4e630f,!![]);}catch(_0x30fb8a){return BPromise['reject'](_0x30fb8a);}return _0x196c68['save']();};}function saveUpdates(_0x2d57fc,_0x141ae0){return function(_0x2840b7){if(_0x2840b7){return _0x2840b7[_0x21c5('0x1a')](_0x2d57fc)[_0x21c5('0x1b')](function(_0x1fb82d){return _0x1fb82d;});}return null;};}function removeEntity(_0x12c49d,_0x117e93){return function(_0x1905a9){if(_0x1905a9){return _0x1905a9['destroy']()[_0x21c5('0x1b')](function(){_0x12c49d[_0x21c5('0x18')](0xcc)[_0x21c5('0x16')]();});}};}function handleEntityNotFound(_0x1aa54e,_0x123a7a){return function(_0x4bf186){if(!_0x4bf186){_0x1aa54e[_0x21c5('0x15')](0x194);}return _0x4bf186;};}function handleError(_0x63f5fc,_0x45e770){_0x45e770=_0x45e770||0x1f4;return function(_0xa09223){logger[_0x21c5('0x1c')](_0xa09223['stack']);if(_0xa09223['name']){delete _0xa09223[_0x21c5('0x1d')];}_0x63f5fc[_0x21c5('0x18')](_0x45e770)[_0x21c5('0x1e')](_0xa09223);};}exports[_0x21c5('0x1f')]=function(_0x2ae029,_0x25aba4){var _0x531cf4={},_0x546286={},_0x5918df={'count':0x0,'rows':[]};var _0x12ca14=db[_0x21c5('0x20')][_0x21c5('0x21')];_0x546286[_0x21c5('0x22')]=_['keys'](_0x12ca14);_0x546286[_0x21c5('0x23')]=_[_0x21c5('0x24')](_0x2ae029[_0x21c5('0x23')]);_0x546286[_0x21c5('0x25')]=_[_0x21c5('0x26')](_0x546286['model'],_0x546286['query']);_0x531cf4[_0x21c5('0x27')]=_[_0x21c5('0x26')](_0x546286[_0x21c5('0x22')],qs[_0x21c5('0x28')](_0x2ae029[_0x21c5('0x23')][_0x21c5('0x28')]));_0x531cf4[_0x21c5('0x27')]=_0x531cf4[_0x21c5('0x27')][_0x21c5('0x29')]?_0x531cf4[_0x21c5('0x27')]:_0x546286['model'];if(!_0x2ae029['query'][_0x21c5('0x2a')]('nolimit')){_0x531cf4[_0x21c5('0x2b')]=qs[_0x21c5('0x2b')](_0x2ae029[_0x21c5('0x23')][_0x21c5('0x2b')]);_0x531cf4['offset']=qs[_0x21c5('0x17')](_0x2ae029['query'][_0x21c5('0x17')]);}_0x531cf4['order']=qs[_0x21c5('0x2c')](_0x2ae029[_0x21c5('0x23')][_0x21c5('0x2c')]);_0x531cf4['where']=qs[_0x21c5('0x25')](_['pick'](_0x2ae029[_0x21c5('0x23')],_0x546286[_0x21c5('0x25')]));if(_0x2ae029[_0x21c5('0x23')]['filter']){_0x531cf4[_0x21c5('0x2d')]=_['merge'](_0x531cf4['where'],{'$or':_[_0x21c5('0x2e')](_0x12ca14,function(_0x42ea7c){if(_0x42ea7c[_0x21c5('0x2f')][_0x21c5('0x30')]!=='VIRTUAL'){var _0x1f25b8={};_0x1f25b8[_0x42ea7c[_0x21c5('0x31')]]={'$like':'%'+_0x2ae029[_0x21c5('0x23')][_0x21c5('0x32')]+'%'};return _0x1f25b8;}})});}_0x531cf4=_[_0x21c5('0x33')]({},_0x531cf4,_0x2ae029[_0x21c5('0x34')]);var _0x1d0434={'where':_0x531cf4[_0x21c5('0x2d')]};return db['Integration'][_0x21c5('0x35')](_0x1d0434)[_0x21c5('0x1b')](function(_0x1092f9){_0x5918df['count']=_0x1092f9;if(_0x2ae029[_0x21c5('0x23')][_0x21c5('0x36')]){_0x531cf4[_0x21c5('0x37')]=[{'all':!![]}];}return db[_0x21c5('0x20')][_0x21c5('0x38')](_0x531cf4);})['then'](function(_0x5a08ad){_0x5918df[_0x21c5('0x39')]=_0x5a08ad;return _0x5918df;})[_0x21c5('0x1b')](respondWithFilteredResult(_0x25aba4,_0x531cf4))[_0x21c5('0x3a')](handleError(_0x25aba4,null));};exports[_0x21c5('0x3b')]=function(_0x59a2fb,_0x4414e1){var _0x169c0d={'raw':![],'where':{'id':_0x59a2fb[_0x21c5('0x3c')]['id']}},_0x301ea7={};_0x301ea7['model']=_[_0x21c5('0x24')](db[_0x21c5('0x20')]['rawAttributes']);_0x301ea7[_0x21c5('0x23')]=_[_0x21c5('0x24')](_0x59a2fb[_0x21c5('0x23')]);_0x301ea7['filters']=_[_0x21c5('0x26')](_0x301ea7[_0x21c5('0x22')],_0x301ea7[_0x21c5('0x23')]);_0x169c0d['attributes']=_[_0x21c5('0x26')](_0x301ea7['model'],qs[_0x21c5('0x28')](_0x59a2fb[_0x21c5('0x23')][_0x21c5('0x28')]));_0x169c0d[_0x21c5('0x27')]=_0x169c0d[_0x21c5('0x27')]['length']?_0x169c0d['attributes']:_0x301ea7['model'];if(_0x59a2fb[_0x21c5('0x23')]['includeAll']){_0x169c0d[_0x21c5('0x37')]=[{'all':!![]}];}_0x169c0d=_[_0x21c5('0x33')]({},_0x169c0d,_0x59a2fb[_0x21c5('0x34')]);return db[_0x21c5('0x20')]['find'](_0x169c0d)[_0x21c5('0x1b')](handleEntityNotFound(_0x4414e1,null))[_0x21c5('0x1b')](respondWithResult(_0x4414e1,null))[_0x21c5('0x3a')](handleError(_0x4414e1,null));};exports[_0x21c5('0x3d')]=function(_0x207117,_0x130ad5){return db[_0x21c5('0x20')][_0x21c5('0x3d')](_0x207117[_0x21c5('0x3e')],{})['then'](respondWithResult(_0x130ad5,0xc9))[_0x21c5('0x3a')](handleError(_0x130ad5,null));};exports['update']=function(_0x462537,_0x3393a6){if(_0x462537[_0x21c5('0x3e')]['id']){delete _0x462537[_0x21c5('0x3e')]['id'];}return db[_0x21c5('0x20')][_0x21c5('0x3f')]({'where':{'id':_0x462537[_0x21c5('0x3c')]['id']}})[_0x21c5('0x1b')](handleEntityNotFound(_0x3393a6,null))[_0x21c5('0x1b')](saveUpdates(_0x462537[_0x21c5('0x3e')],null))[_0x21c5('0x1b')](respondWithResult(_0x3393a6,null))[_0x21c5('0x3a')](handleError(_0x3393a6,null));};exports['destroy']=function(_0x5e4586,_0x5513c5){return db[_0x21c5('0x20')][_0x21c5('0x3f')]({'where':{'id':_0x5e4586[_0x21c5('0x3c')]['id']}})['then'](handleEntityNotFound(_0x5513c5,null))[_0x21c5('0x1b')](removeEntity(_0x5513c5,null))[_0x21c5('0x3a')](handleError(_0x5513c5,null));}; \ No newline at end of file +var _0x0c2b=['ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','index','Integration','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','VIRTUAL','field','options','count','includeAll','include','findAll','rows','catch','keys','find','create','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse'];(function(_0x32d23c,_0x143106){var _0x12b034=function(_0x3d01e5){while(--_0x3d01e5){_0x32d23c['push'](_0x32d23c['shift']());}};_0x12b034(++_0x143106);}(_0x0c2b,0x194));var _0xb0c2=function(_0x1b4c71,_0x4b04b0){_0x1b4c71=_0x1b4c71-0x0;var _0x42968f=_0x0c2b[_0x1b4c71];return _0x42968f;};'use strict';var pdf=require(_0xb0c2('0x0'));var emlformat=require(_0xb0c2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb0c2('0x2'));var jsonpatch=require(_0xb0c2('0x3'));var rp=require(_0xb0c2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb0c2('0x5'));var util=require(_0xb0c2('0x6'));var path=require(_0xb0c2('0x7'));var sox=require(_0xb0c2('0x8'));var csv=require(_0xb0c2('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb0c2('0xa'));var squel=require(_0xb0c2('0xb'));var crypto=require(_0xb0c2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb0c2('0xd'));var toCsv=require(_0xb0c2('0x9'));var querystring=require(_0xb0c2('0xe'));var Papa=require(_0xb0c2('0xf'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0xb0c2('0x10'));var qs=require(_0xb0c2('0x11'));var logger=require(_0xb0c2('0x12'))(_0xb0c2('0x13'));var utils=require('../../config/utils');var config=require(_0xb0c2('0x14'));var db=require(_0xb0c2('0x15'))['db'];function respondWithStatusCode(_0x25872d,_0x3c72de){_0x3c72de=_0x3c72de||0xcc;return function(_0x182277){if(_0x182277){return _0x25872d[_0xb0c2('0x16')](_0x3c72de);}return _0x25872d[_0xb0c2('0x17')](_0x3c72de)[_0xb0c2('0x18')]();};}function respondWithResult(_0x217c9a,_0x225375){_0x225375=_0x225375||0xc8;return function(_0x3dc3de){if(_0x3dc3de){return _0x217c9a[_0xb0c2('0x17')](_0x225375)[_0xb0c2('0x19')](_0x3dc3de);}};}function respondWithFilteredResult(_0x34b086,_0x6eb706){return function(_0x50e3fa){if(_0x50e3fa){var _0x31400e=_0x50e3fa['count'],_0xb35aad=_0x6eb706[_0xb0c2('0x1a')],_0x43f6ba=_0x6eb706[_0xb0c2('0x1a')]+_0x6eb706[_0xb0c2('0x1b')],_0x4ed594;if(_0x43f6ba>=_0x31400e){_0x43f6ba=_0x31400e;_0x4ed594=0xc8;}else{_0x4ed594=0xce;}_0x34b086['status'](_0x4ed594);return _0x34b086[_0xb0c2('0x1c')](_0xb0c2('0x1d'),_0xb35aad+'-'+_0x43f6ba+'/'+_0x31400e)['json'](_0x50e3fa);}return null;};}function patchUpdates(_0x2ac855){return function(_0x15366d){try{jsonpatch[_0xb0c2('0x1e')](_0x15366d,_0x2ac855,!![]);}catch(_0x47e28e){return BPromise[_0xb0c2('0x1f')](_0x47e28e);}return _0x15366d[_0xb0c2('0x20')]();};}function saveUpdates(_0x250bb4,_0x432e35){return function(_0x40b38d){if(_0x40b38d){return _0x40b38d[_0xb0c2('0x21')](_0x250bb4)[_0xb0c2('0x22')](function(_0x26d9c0){return _0x26d9c0;});}return null;};}function removeEntity(_0xf92a3b,_0x359f27){return function(_0x59066e){if(_0x59066e){return _0x59066e[_0xb0c2('0x23')]()[_0xb0c2('0x22')](function(){_0xf92a3b[_0xb0c2('0x17')](0xcc)[_0xb0c2('0x18')]();});}};}function handleEntityNotFound(_0x3b3049,_0x287157){return function(_0x2be851){if(!_0x2be851){_0x3b3049['sendStatus'](0x194);}return _0x2be851;};}function handleError(_0x457793,_0x5d36e0){_0x5d36e0=_0x5d36e0||0x1f4;return function(_0x49c199){logger['error'](_0x49c199['stack']);if(_0x49c199[_0xb0c2('0x24')]){delete _0x49c199[_0xb0c2('0x24')];}_0x457793[_0xb0c2('0x17')](_0x5d36e0)['send'](_0x49c199);};}exports[_0xb0c2('0x25')]=function(_0x28aaba,_0x11fe54){var _0x2633c6={},_0x153291={},_0xd2c19f={'count':0x0,'rows':[]};var _0x14b44d=db[_0xb0c2('0x26')][_0xb0c2('0x27')];_0x153291[_0xb0c2('0x28')]=_['keys'](_0x14b44d);_0x153291['query']=_['keys'](_0x28aaba[_0xb0c2('0x29')]);_0x153291[_0xb0c2('0x2a')]=_[_0xb0c2('0x2b')](_0x153291[_0xb0c2('0x28')],_0x153291[_0xb0c2('0x29')]);_0x2633c6[_0xb0c2('0x2c')]=_[_0xb0c2('0x2b')](_0x153291[_0xb0c2('0x28')],qs[_0xb0c2('0x2d')](_0x28aaba[_0xb0c2('0x29')][_0xb0c2('0x2d')]));_0x2633c6[_0xb0c2('0x2c')]=_0x2633c6[_0xb0c2('0x2c')][_0xb0c2('0x2e')]?_0x2633c6[_0xb0c2('0x2c')]:_0x153291[_0xb0c2('0x28')];if(!_0x28aaba[_0xb0c2('0x29')][_0xb0c2('0x2f')]('nolimit')){_0x2633c6[_0xb0c2('0x1b')]=qs[_0xb0c2('0x1b')](_0x28aaba[_0xb0c2('0x29')][_0xb0c2('0x1b')]);_0x2633c6[_0xb0c2('0x1a')]=qs[_0xb0c2('0x1a')](_0x28aaba['query']['offset']);}_0x2633c6[_0xb0c2('0x30')]=qs[_0xb0c2('0x31')](_0x28aaba[_0xb0c2('0x29')][_0xb0c2('0x31')]);_0x2633c6[_0xb0c2('0x32')]=qs[_0xb0c2('0x2a')](_[_0xb0c2('0x33')](_0x28aaba[_0xb0c2('0x29')],_0x153291[_0xb0c2('0x2a')]));if(_0x28aaba['query'][_0xb0c2('0x34')]){_0x2633c6['where']=_[_0xb0c2('0x35')](_0x2633c6['where'],{'$or':_[_0xb0c2('0x36')](_0x14b44d,function(_0x434f20){if(_0x434f20[_0xb0c2('0x37')]['key']!==_0xb0c2('0x38')){var _0x54c57c={};_0x54c57c[_0x434f20[_0xb0c2('0x39')]]={'$like':'%'+_0x28aaba['query']['filter']+'%'};return _0x54c57c;}})});}_0x2633c6=_['merge']({},_0x2633c6,_0x28aaba[_0xb0c2('0x3a')]);var _0xc18d6a={'where':_0x2633c6['where']};return db[_0xb0c2('0x26')]['count'](_0xc18d6a)[_0xb0c2('0x22')](function(_0xd755c5){_0xd2c19f[_0xb0c2('0x3b')]=_0xd755c5;if(_0x28aaba[_0xb0c2('0x29')][_0xb0c2('0x3c')]){_0x2633c6[_0xb0c2('0x3d')]=[{'all':!![]}];}return db['Integration'][_0xb0c2('0x3e')](_0x2633c6);})['then'](function(_0x42f9da){_0xd2c19f[_0xb0c2('0x3f')]=_0x42f9da;return _0xd2c19f;})[_0xb0c2('0x22')](respondWithFilteredResult(_0x11fe54,_0x2633c6))[_0xb0c2('0x40')](handleError(_0x11fe54,null));};exports['show']=function(_0x43e8bf,_0x1b7f5a){var _0x56608b={'raw':![],'where':{'id':_0x43e8bf['params']['id']}},_0x4e4ca7={};_0x4e4ca7[_0xb0c2('0x28')]=_[_0xb0c2('0x41')](db[_0xb0c2('0x26')][_0xb0c2('0x27')]);_0x4e4ca7['query']=_['keys'](_0x43e8bf[_0xb0c2('0x29')]);_0x4e4ca7[_0xb0c2('0x2a')]=_['intersection'](_0x4e4ca7[_0xb0c2('0x28')],_0x4e4ca7[_0xb0c2('0x29')]);_0x56608b[_0xb0c2('0x2c')]=_[_0xb0c2('0x2b')](_0x4e4ca7[_0xb0c2('0x28')],qs['fields'](_0x43e8bf[_0xb0c2('0x29')][_0xb0c2('0x2d')]));_0x56608b[_0xb0c2('0x2c')]=_0x56608b['attributes']['length']?_0x56608b[_0xb0c2('0x2c')]:_0x4e4ca7['model'];if(_0x43e8bf['query'][_0xb0c2('0x3c')]){_0x56608b[_0xb0c2('0x3d')]=[{'all':!![]}];}_0x56608b=_['merge']({},_0x56608b,_0x43e8bf[_0xb0c2('0x3a')]);return db[_0xb0c2('0x26')][_0xb0c2('0x42')](_0x56608b)[_0xb0c2('0x22')](handleEntityNotFound(_0x1b7f5a,null))[_0xb0c2('0x22')](respondWithResult(_0x1b7f5a,null))[_0xb0c2('0x40')](handleError(_0x1b7f5a,null));};exports[_0xb0c2('0x43')]=function(_0xcb9324,_0x2f6369){return db[_0xb0c2('0x26')][_0xb0c2('0x43')](_0xcb9324[_0xb0c2('0x44')],{})[_0xb0c2('0x22')](respondWithResult(_0x2f6369,0xc9))[_0xb0c2('0x40')](handleError(_0x2f6369,null));};exports[_0xb0c2('0x21')]=function(_0x3c5a38,_0x47a7f3){if(_0x3c5a38[_0xb0c2('0x44')]['id']){delete _0x3c5a38['body']['id'];}return db[_0xb0c2('0x26')][_0xb0c2('0x42')]({'where':{'id':_0x3c5a38[_0xb0c2('0x45')]['id']}})[_0xb0c2('0x22')](handleEntityNotFound(_0x47a7f3,null))[_0xb0c2('0x22')](saveUpdates(_0x3c5a38['body'],null))[_0xb0c2('0x22')](respondWithResult(_0x47a7f3,null))['catch'](handleError(_0x47a7f3,null));};exports[_0xb0c2('0x23')]=function(_0x3ca3bb,_0x1009c7){return db[_0xb0c2('0x26')][_0xb0c2('0x42')]({'where':{'id':_0x3ca3bb['params']['id']}})['then'](handleEntityNotFound(_0x1009c7,null))[_0xb0c2('0x22')](removeEntity(_0x1009c7,null))[_0xb0c2('0x40')](handleError(_0x1009c7,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 965774e..2ec5dda 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 _0x687b=['lodash','util','../../config/logger','api','request-promise','./integration.attributes','exports','define','Integration','integrations'];(function(_0x54b283,_0x5eb8a6){var _0x2462b3=function(_0x13fca7){while(--_0x13fca7){_0x54b283['push'](_0x54b283['shift']());}};_0x2462b3(++_0x5eb8a6);}(_0x687b,0x14a));var _0xb687=function(_0x8e7772,_0x9d77b0){_0x8e7772=_0x8e7772-0x0;var _0x408200=_0x687b[_0x8e7772];return _0x408200;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var attributes=require(_0xb687('0x5'));module[_0xb687('0x6')]=function(_0x31bd0d,_0x46e5b3){return _0x31bd0d[_0xb687('0x7')](_0xb687('0x8'),attributes,{'tableName':_0xb687('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6ac=['util','../../config/logger','api','moment','bluebird','request-promise','./integration.attributes','exports','define','Integration','integrations','lodash'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x586cf0,_0x324b83){_0x586cf0=_0x586cf0-0x0;var _0x5b0fce=_0xc6ac[_0x586cf0];return _0x5b0fce;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var logger=require(_0xcc6a('0x2'))(_0xcc6a('0x3'));var moment=require(_0xcc6a('0x4'));var BPromise=require(_0xcc6a('0x5'));var rp=require(_0xcc6a('0x6'));var attributes=require(_0xcc6a('0x7'));module[_0xcc6a('0x8')]=function(_0x22ee99,_0x2f26ab){return _0x22ee99[_0xcc6a('0x9')](_0xcc6a('0xa'),attributes,{'tableName':_0xcc6a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index a51c84c..236ab30 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 _0xcbef=['../../config/utils','../../config/logger','jayson/promise','http','request','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','Integration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x4ee524,_0x1c048c){var _0x4e72c1=function(_0x460f46){while(--_0x460f46){_0x4ee524['push'](_0x4ee524['shift']());}};_0x4e72c1(++_0x1c048c);}(_0xcbef,0x14a));var _0xfcbe=function(_0x382500,_0x43e04e){_0x382500=_0x382500-0x0;var _0x4aa842=_0xcbef[_0x382500];return _0x4aa842;};'use strict';var _=require(_0xfcbe('0x0'));var util=require(_0xfcbe('0x1'));var moment=require(_0xfcbe('0x2'));var BPromise=require(_0xfcbe('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcbe('0x4'));var db=require(_0xfcbe('0x5'))['db'];var utils=require(_0xfcbe('0x6'));var logger=require(_0xfcbe('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfcbe('0x8'));var client=jayson['client'][_0xfcbe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cbcc5,_0x5c49c2,_0x478966){return new BPromise(function(_0x29cffb,_0x192f53){return client[_0xfcbe('0xa')](_0x3cbcc5,_0x478966)['then'](function(_0x166ab0){logger['info']('Integration,\x20%s,\x20%s',_0x5c49c2,_0xfcbe('0xb'));logger[_0xfcbe('0xc')](_0xfcbe('0xd'),_0x5c49c2,'request\x20sent',JSON[_0xfcbe('0xe')](_0x166ab0));if(_0x166ab0[_0xfcbe('0xf')]){if(_0x166ab0[_0xfcbe('0xf')]['code']===0x1f4){logger['error'](_0xfcbe('0x10'),_0x5c49c2,_0x166ab0[_0xfcbe('0xf')][_0xfcbe('0x11')]);return _0x192f53(_0x166ab0[_0xfcbe('0xf')][_0xfcbe('0x11')]);}logger[_0xfcbe('0xf')](_0xfcbe('0x10'),_0x5c49c2,_0x166ab0['error'][_0xfcbe('0x11')]);return _0x29cffb(_0x166ab0[_0xfcbe('0xf')]['message']);}else{logger[_0xfcbe('0x12')](_0xfcbe('0x10'),_0x5c49c2,_0xfcbe('0xb'));_0x29cffb(_0x166ab0[_0xfcbe('0x13')][_0xfcbe('0x11')]);}})[_0xfcbe('0x14')](function(_0x12b1cb){logger[_0xfcbe('0xf')]('Integration,\x20%s,\x20%s',_0x5c49c2,_0x12b1cb);_0x192f53(_0x12b1cb);});});} \ No newline at end of file +var _0xf187=['request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Integration,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','then','info'];(function(_0x555f43,_0x55d1ce){var _0x113b69=function(_0x526974){while(--_0x526974){_0x555f43['push'](_0x555f43['shift']());}};_0x113b69(++_0x55d1ce);}(_0xf187,0x14b));var _0x7f18=function(_0x49a59f,_0x17f1f6){_0x49a59f=_0x49a59f-0x0;var _0x165d05=_0xf187[_0x49a59f];return _0x165d05;};'use strict';var _=require(_0x7f18('0x0'));var util=require(_0x7f18('0x1'));var moment=require(_0x7f18('0x2'));var BPromise=require(_0x7f18('0x3'));var rs=require(_0x7f18('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f18('0x5'))['db'];var utils=require(_0x7f18('0x6'));var logger=require('../../config/logger')(_0x7f18('0x7'));var config=require(_0x7f18('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x52613d,_0x1d72ef,_0x1315c2){return new BPromise(function(_0x4759a6,_0xc979f9){return client['request'](_0x52613d,_0x1315c2)[_0x7f18('0x9')](function(_0xce2507){logger[_0x7f18('0xa')]('Integration,\x20%s,\x20%s',_0x1d72ef,_0x7f18('0xb'));logger['debug'](_0x7f18('0xc'),_0x1d72ef,_0x7f18('0xb'),JSON[_0x7f18('0xd')](_0xce2507));if(_0xce2507[_0x7f18('0xe')]){if(_0xce2507['error'][_0x7f18('0xf')]===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x1d72ef,_0xce2507['error'][_0x7f18('0x10')]);return _0xc979f9(_0xce2507[_0x7f18('0xe')][_0x7f18('0x10')]);}logger['error'](_0x7f18('0x11'),_0x1d72ef,_0xce2507[_0x7f18('0xe')][_0x7f18('0x10')]);return _0x4759a6(_0xce2507[_0x7f18('0xe')][_0x7f18('0x10')]);}else{logger['info'](_0x7f18('0x11'),_0x1d72ef,_0x7f18('0xb'));_0x4759a6(_0xce2507[_0x7f18('0x12')][_0x7f18('0x10')]);}})['catch'](function(_0x35844e){logger['error'](_0x7f18('0x11'),_0x1d72ef,_0x35844e);_0xc979f9(_0x35844e);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 907018f..931c84f 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 _0x03e2=['exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete'];(function(_0xd9b49a,_0x346139){var _0x44b56f=function(_0xe2d3b1){while(--_0xe2d3b1){_0xd9b49a['push'](_0xd9b49a['shift']());}};_0x44b56f(++_0x346139);}(_0x03e2,0xcd));var _0x203e=function(_0x400951,_0x48927e){_0x400951=_0x400951-0x0;var _0x124d1c=_0x03e2[_0x400951];return _0x124d1c;};'use strict';var multer=require(_0x203e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x203e('0x1'));var express=require(_0x203e('0x2'));var router=express[_0x203e('0x3')]();var auth=require(_0x203e('0x4'));var interaction=require(_0x203e('0x5'));var config=require('../../config/environment');var controller=require(_0x203e('0x6'));router['get']('/',auth[_0x203e('0x7')](),controller[_0x203e('0x8')]);router['get']('/describe',auth[_0x203e('0x7')](),controller['describe']);router[_0x203e('0x9')](_0x203e('0xa'),auth[_0x203e('0x7')](),controller[_0x203e('0xb')]);router['post']('/',auth[_0x203e('0x7')](),controller[_0x203e('0xc')]);router[_0x203e('0xd')](_0x203e('0xa'),auth[_0x203e('0x7')](),controller[_0x203e('0xe')]);router[_0x203e('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x203e('0x10')]=router; \ No newline at end of file +var _0xcddd=['Router','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','connect-timeout'];(function(_0x24a654,_0x2ca441){var _0x458651=function(_0x1ecda1){while(--_0x1ecda1){_0x24a654['push'](_0x24a654['shift']());}};_0x458651(++_0x2ca441);}(_0xcddd,0x97));var _0xdcdd=function(_0x4628b2,_0x5474ed){_0x4628b2=_0x4628b2-0x0;var _0x43d1ea=_0xcddd[_0x4628b2];return _0x43d1ea;};'use strict';var multer=require(_0xdcdd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdcdd('0x1'));var express=require('express');var router=express[_0xdcdd('0x2')]();var auth=require(_0xdcdd('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./integrationReport.controller');router[_0xdcdd('0x4')]('/',auth[_0xdcdd('0x5')](),controller[_0xdcdd('0x6')]);router[_0xdcdd('0x4')](_0xdcdd('0x7'),auth[_0xdcdd('0x5')](),controller[_0xdcdd('0x8')]);router[_0xdcdd('0x4')](_0xdcdd('0x9'),auth[_0xdcdd('0x5')](),controller[_0xdcdd('0xa')]);router[_0xdcdd('0xb')]('/',auth[_0xdcdd('0x5')](),controller[_0xdcdd('0xc')]);router[_0xdcdd('0xd')](_0xdcdd('0x9'),auth[_0xdcdd('0x5')](),controller['update']);router[_0xdcdd('0xe')](_0xdcdd('0x9'),auth[_0xdcdd('0x5')](),controller[_0xdcdd('0xf')]);module[_0xdcdd('0x10')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index fcd923d..b4fdb20 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 _0x6222=['SENDING','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x4ceee5,_0x115e35){var _0x28ed93=function(_0x32fddf){while(--_0x32fddf){_0x4ceee5['push'](_0x4ceee5['shift']());}};_0x28ed93(++_0x115e35);}(_0x6222,0x145));var _0x2622=function(_0x300dff,_0x11a7e5){_0x300dff=_0x300dff-0x0;var _0x395221=_0x6222[_0x300dff];return _0x395221;};'use strict';var Sequelize=require(_0x2622('0x0'));module[_0x2622('0x1')]={'integration':{'type':Sequelize[_0x2622('0x2')]},'eventChannel':{'type':Sequelize[_0x2622('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x2622('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2622('0x2')]},'queue':{'type':Sequelize[_0x2622('0x2')]},'interface':{'type':Sequelize[_0x2622('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x2622('0x4')]},'holdtime':{'type':Sequelize[_0x2622('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x2622('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x2622('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x2622('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x2622('0x4')]},'agentdump':{'type':Sequelize[_0x2622('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x2622('0x4')]},'lastevent':{'type':Sequelize[_0x2622('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x2622('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x2622('0x2')]},'connectedlinename':{'type':Sequelize[_0x2622('0x2')]},'language':{'type':Sequelize[_0x2622('0x2')]},'accountcode':{'type':Sequelize[_0x2622('0x2')]},'context':{'type':Sequelize[_0x2622('0x2')]},'exten':{'type':Sequelize[_0x2622('0x2')]},'priority':{'type':Sequelize[_0x2622('0x2')]},'destchannel':{'type':Sequelize[_0x2622('0x2')]},'destchannelstate':{'type':Sequelize[_0x2622('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x2622('0x2')]},'destcalleridnum':{'type':Sequelize[_0x2622('0x2')]},'destcalleridname':{'type':Sequelize[_0x2622('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x2622('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x2622('0x2')]},'destcontext':{'type':Sequelize[_0x2622('0x2')]},'destexten':{'type':Sequelize[_0x2622('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x2622('0x2')]},'messageId':{'type':Sequelize[_0x2622('0x2')]},'inReplyTo':{'type':Sequelize[_0x2622('0x2')]},'subject':{'type':Sequelize[_0x2622('0x2')]},'from':{'type':Sequelize[_0x2622('0x2')]},'to':{'type':Sequelize[_0x2622('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x2622('0x6')]},'text':{'type':Sequelize[_0x2622('0x6')]},'status':{'type':Sequelize[_0x2622('0x7')]('SENT',_0x2622('0x8'),'RECEIVED','FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x2622('0x2')]},'projectId':{'type':Sequelize[_0x2622('0x3')]}}; \ No newline at end of file +var _0x8a57=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','FAILED','STRING'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x8a57,0x8f));var _0x78a5=function(_0x454d4f,_0x567605){_0x454d4f=_0x454d4f-0x0;var _0x278754=_0x8a57[_0x454d4f];return _0x278754;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize[_0x78a5('0x0')]},'eventChannel':{'type':Sequelize[_0x78a5('0x0')]},'exitStatus':{'type':Sequelize[_0x78a5('0x0')]},'ticketId':{'type':Sequelize[_0x78a5('0x0')]},'integrationId':{'type':Sequelize[_0x78a5('0x1')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x78a5('0x0')]},'calleridnum':{'type':Sequelize[_0x78a5('0x0')]},'calleridname':{'type':Sequelize[_0x78a5('0x0')]},'queue':{'type':Sequelize[_0x78a5('0x0')]},'interface':{'type':Sequelize[_0x78a5('0x0')]},'membername':{'type':Sequelize[_0x78a5('0x0')]},'agentcalledAt':{'type':Sequelize[_0x78a5('0x2')]},'agentconnectAt':{'type':Sequelize[_0x78a5('0x2')]},'holdtime':{'type':Sequelize[_0x78a5('0x1')]},'agentcomplete':{'type':Sequelize[_0x78a5('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x78a5('0x2')]},'talktime':{'type':Sequelize[_0x78a5('0x1')]},'agentacw':{'type':Sequelize[_0x78a5('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x78a5('0x0')]},'agentringnoanswer':{'type':Sequelize[_0x78a5('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x78a5('0x2')]},'agentdump':{'type':Sequelize[_0x78a5('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x78a5('0x2')]},'lastevent':{'type':Sequelize[_0x78a5('0x0')]},'channel':{'type':Sequelize[_0x78a5('0x0')]},'channelstate':{'type':Sequelize[_0x78a5('0x1')]},'channelstatedesc':{'type':Sequelize[_0x78a5('0x0')]},'connectedlinenum':{'type':Sequelize[_0x78a5('0x0')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x78a5('0x0')]},'accountcode':{'type':Sequelize[_0x78a5('0x0')]},'context':{'type':Sequelize[_0x78a5('0x0')]},'exten':{'type':Sequelize[_0x78a5('0x0')]},'priority':{'type':Sequelize[_0x78a5('0x0')]},'destchannel':{'type':Sequelize[_0x78a5('0x0')]},'destchannelstate':{'type':Sequelize[_0x78a5('0x1')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x78a5('0x0')]},'destcalleridname':{'type':Sequelize[_0x78a5('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x78a5('0x0')]},'destconnectedlinename':{'type':Sequelize[_0x78a5('0x0')]},'destlanguage':{'type':Sequelize[_0x78a5('0x0')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x78a5('0x0')]},'destexten':{'type':Sequelize[_0x78a5('0x0')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x78a5('0x0')]},'messageId':{'type':Sequelize[_0x78a5('0x0')]},'inReplyTo':{'type':Sequelize[_0x78a5('0x0')]},'subject':{'type':Sequelize[_0x78a5('0x0')]},'from':{'type':Sequelize[_0x78a5('0x0')]},'to':{'type':Sequelize[_0x78a5('0x0')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x78a5('0x4')]},'text':{'type':Sequelize[_0x78a5('0x4')]},'status':{'type':Sequelize[_0x78a5('0x5')](_0x78a5('0x6'),_0x78a5('0x7'),'RECEIVED',_0x78a5('0x8'))},'url':{'type':Sequelize[_0x78a5('0x0')]},'app':{'type':Sequelize[_0x78a5('0x0')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index e9357ab..c004555 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 _0x6192=['find','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','status','end','offset','limit','json','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','IntegrationReport','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','map','type','key','VIRTUAL','field','filter','options','count','includeAll','include','findAll','rows','catch','show','params'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6192,0x1bf));var _0x2619=function(_0x34af62,_0x65c249){_0x34af62=_0x34af62-0x0;var _0x30b8b3=_0x6192[_0x34af62];return _0x30b8b3;};'use strict';var pdf=require(_0x2619('0x0'));var emlformat=require(_0x2619('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2619('0x2'));var jsonpatch=require(_0x2619('0x3'));var rp=require(_0x2619('0x4'));var moment=require(_0x2619('0x5'));var BPromise=require(_0x2619('0x6'));var Mustache=require('mustache');var util=require(_0x2619('0x7'));var path=require('path');var sox=require(_0x2619('0x8'));var csv=require(_0x2619('0x9'));var ejs=require(_0x2619('0xa'));var fs=require('fs');var _=require(_0x2619('0xb'));var squel=require(_0x2619('0xc'));var crypto=require(_0x2619('0xd'));var jsforce=require(_0x2619('0xe'));var deskjs=require(_0x2619('0xf'));var toCsv=require(_0x2619('0x9'));var querystring=require(_0x2619('0x10'));var Papa=require('papaparse');var authService=require(_0x2619('0x11'));var hardwareService=require(_0x2619('0x12'));var Redis=require('ioredis');var qs=require(_0x2619('0x13'));var logger=require(_0x2619('0x14'))(_0x2619('0x15'));var utils=require(_0x2619('0x16'));var config=require('../../config/environment');var db=require(_0x2619('0x17'))['db'];function respondWithStatusCode(_0x54f226,_0x49511b){_0x49511b=_0x49511b||0xcc;return function(_0x58b26b){if(_0x58b26b){return _0x54f226['sendStatus'](_0x49511b);}return _0x54f226[_0x2619('0x18')](_0x49511b)[_0x2619('0x19')]();};}function respondWithResult(_0x264b95,_0x368a95){_0x368a95=_0x368a95||0xc8;return function(_0x574fc9){if(_0x574fc9){return _0x264b95[_0x2619('0x18')](_0x368a95)['json'](_0x574fc9);}};}function respondWithFilteredResult(_0x5b8638,_0x34659e){return function(_0x178b85){if(_0x178b85){var _0x5d80e6=_0x178b85['count'],_0x343ef6=_0x34659e[_0x2619('0x1a')],_0x49d60a=_0x34659e[_0x2619('0x1a')]+_0x34659e[_0x2619('0x1b')],_0x433815;if(_0x49d60a>=_0x5d80e6){_0x49d60a=_0x5d80e6;_0x433815=0xc8;}else{_0x433815=0xce;}_0x5b8638['status'](_0x433815);return _0x5b8638['set']('Content-Range',_0x343ef6+'-'+_0x49d60a+'/'+_0x5d80e6)[_0x2619('0x1c')](_0x178b85);}return null;};}function patchUpdates(_0x476966){return function(_0x4f823e){try{jsonpatch[_0x2619('0x1d')](_0x4f823e,_0x476966,!![]);}catch(_0x479eff){return BPromise[_0x2619('0x1e')](_0x479eff);}return _0x4f823e['save']();};}function saveUpdates(_0x384d8f,_0x372d24){return function(_0x45c430){if(_0x45c430){return _0x45c430[_0x2619('0x1f')](_0x384d8f)['then'](function(_0x5a7c98){return _0x5a7c98;});}return null;};}function removeEntity(_0x59a9f3,_0x4129bb){return function(_0x2f4cb6){if(_0x2f4cb6){return _0x2f4cb6[_0x2619('0x20')]()[_0x2619('0x21')](function(){_0x59a9f3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xdb7328,_0x93994){return function(_0x3f0bd0){if(!_0x3f0bd0){_0xdb7328[_0x2619('0x22')](0x194);}return _0x3f0bd0;};}function handleError(_0x4a06d8,_0x4b524c){_0x4b524c=_0x4b524c||0x1f4;return function(_0x5fd5e7){logger[_0x2619('0x23')](_0x5fd5e7[_0x2619('0x24')]);if(_0x5fd5e7['name']){delete _0x5fd5e7[_0x2619('0x25')];}_0x4a06d8[_0x2619('0x18')](_0x4b524c)[_0x2619('0x26')](_0x5fd5e7);};}exports[_0x2619('0x27')]=function(_0xa27e7a,_0x1a087b){var _0x35352a={},_0x2b48f0={},_0x2e1829={'count':0x0,'rows':[]};var _0x4ab01c=db[_0x2619('0x28')][_0x2619('0x29')];_0x2b48f0[_0x2619('0x2a')]=_[_0x2619('0x2b')](_0x4ab01c);_0x2b48f0[_0x2619('0x2c')]=_[_0x2619('0x2b')](_0xa27e7a['query']);_0x2b48f0[_0x2619('0x2d')]=_['intersection'](_0x2b48f0[_0x2619('0x2a')],_0x2b48f0[_0x2619('0x2c')]);_0x35352a['attributes']=_[_0x2619('0x2e')](_0x2b48f0[_0x2619('0x2a')],qs[_0x2619('0x2f')](_0xa27e7a[_0x2619('0x2c')][_0x2619('0x2f')]));_0x35352a[_0x2619('0x30')]=_0x35352a[_0x2619('0x30')][_0x2619('0x31')]?_0x35352a[_0x2619('0x30')]:_0x2b48f0['model'];if(!_0xa27e7a['query'][_0x2619('0x32')](_0x2619('0x33'))){_0x35352a[_0x2619('0x1b')]=qs[_0x2619('0x1b')](_0xa27e7a[_0x2619('0x2c')][_0x2619('0x1b')]);_0x35352a['offset']=qs['offset'](_0xa27e7a[_0x2619('0x2c')]['offset']);}_0x35352a['order']=qs['sort'](_0xa27e7a[_0x2619('0x2c')][_0x2619('0x34')]);_0x35352a[_0x2619('0x35')]=qs[_0x2619('0x2d')](_[_0x2619('0x36')](_0xa27e7a['query'],_0x2b48f0['filters']));if(_0xa27e7a[_0x2619('0x2c')]['filter']){_0x35352a[_0x2619('0x35')]=_[_0x2619('0x37')](_0x35352a['where'],{'$or':_[_0x2619('0x38')](_0x4ab01c,function(_0x12a637){if(_0x12a637[_0x2619('0x39')][_0x2619('0x3a')]!==_0x2619('0x3b')){var _0x50d0e4={};_0x50d0e4[_0x12a637[_0x2619('0x3c')]]={'$like':'%'+_0xa27e7a['query'][_0x2619('0x3d')]+'%'};return _0x50d0e4;}})});}_0x35352a=_[_0x2619('0x37')]({},_0x35352a,_0xa27e7a[_0x2619('0x3e')]);var _0x299f17={'where':_0x35352a[_0x2619('0x35')]};return db[_0x2619('0x28')][_0x2619('0x3f')](_0x299f17)['then'](function(_0x12234d){_0x2e1829[_0x2619('0x3f')]=_0x12234d;if(_0xa27e7a[_0x2619('0x2c')][_0x2619('0x40')]){_0x35352a[_0x2619('0x41')]=[{'all':!![]}];}return db['IntegrationReport'][_0x2619('0x42')](_0x35352a);})[_0x2619('0x21')](function(_0x32f1e0){_0x2e1829[_0x2619('0x43')]=_0x32f1e0;return _0x2e1829;})[_0x2619('0x21')](respondWithFilteredResult(_0x1a087b,_0x35352a))[_0x2619('0x44')](handleError(_0x1a087b,null));};exports[_0x2619('0x45')]=function(_0x32723a,_0x1f2624){var _0x2c8ea0={'raw':![],'where':{'id':_0x32723a[_0x2619('0x46')]['id']}},_0x3553fe={};_0x3553fe[_0x2619('0x2a')]=_[_0x2619('0x2b')](db[_0x2619('0x28')]['rawAttributes']);_0x3553fe[_0x2619('0x2c')]=_[_0x2619('0x2b')](_0x32723a[_0x2619('0x2c')]);_0x3553fe['filters']=_[_0x2619('0x2e')](_0x3553fe['model'],_0x3553fe['query']);_0x2c8ea0[_0x2619('0x30')]=_[_0x2619('0x2e')](_0x3553fe['model'],qs[_0x2619('0x2f')](_0x32723a[_0x2619('0x2c')][_0x2619('0x2f')]));_0x2c8ea0[_0x2619('0x30')]=_0x2c8ea0[_0x2619('0x30')][_0x2619('0x31')]?_0x2c8ea0[_0x2619('0x30')]:_0x3553fe[_0x2619('0x2a')];if(_0x32723a['query'][_0x2619('0x40')]){_0x2c8ea0[_0x2619('0x41')]=[{'all':!![]}];}_0x2c8ea0=_[_0x2619('0x37')]({},_0x2c8ea0,_0x32723a[_0x2619('0x3e')]);return db[_0x2619('0x28')][_0x2619('0x47')](_0x2c8ea0)['then'](handleEntityNotFound(_0x1f2624,null))[_0x2619('0x21')](respondWithResult(_0x1f2624,null))[_0x2619('0x44')](handleError(_0x1f2624,null));};exports['create']=function(_0x14a7a0,_0x192f91){return db[_0x2619('0x28')]['create'](_0x14a7a0[_0x2619('0x48')],{})[_0x2619('0x21')](respondWithResult(_0x192f91,0xc9))['catch'](handleError(_0x192f91,null));};exports[_0x2619('0x1f')]=function(_0x5ae2af,_0x22770b){if(_0x5ae2af[_0x2619('0x48')]['id']){delete _0x5ae2af['body']['id'];}return db['IntegrationReport'][_0x2619('0x47')]({'where':{'id':_0x5ae2af[_0x2619('0x46')]['id']}})[_0x2619('0x21')](handleEntityNotFound(_0x22770b,null))[_0x2619('0x21')](saveUpdates(_0x5ae2af['body'],null))['then'](respondWithResult(_0x22770b,null))['catch'](handleError(_0x22770b,null));};exports[_0x2619('0x20')]=function(_0x387bbb,_0x110873){return db[_0x2619('0x28')][_0x2619('0x47')]({'where':{'id':_0x387bbb[_0x2619('0x46')]['id']}})['then'](handleEntityNotFound(_0x110873,null))[_0x2619('0x21')](removeEntity(_0x110873,null))[_0x2619('0x44')](handleError(_0x110873,null));};exports['describe']=function(_0x2abe42,_0x561b4c){return db[_0x2619('0x28')][_0x2619('0x49')]()['then'](respondWithResult(_0x561b4c,null))['catch'](handleError(_0x561b4c,null));}; \ No newline at end of file +var _0x3330=['limit','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','rawAttributes','keys','query','intersection','model','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','map','field','options','IntegrationReport','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','end','status','offset'];(function(_0x576e35,_0x36fbe4){var _0x2c870c=function(_0x792cdb){while(--_0x792cdb){_0x576e35['push'](_0x576e35['shift']());}};_0x2c870c(++_0x36fbe4);}(_0x3330,0x1b5));var _0x0333=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x3330[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require(_0x0333('0x0'));var emlformat=require(_0x0333('0x1'));var rimraf=require(_0x0333('0x2'));var zipdir=require(_0x0333('0x3'));var jsonpatch=require(_0x0333('0x4'));var rp=require(_0x0333('0x5'));var moment=require(_0x0333('0x6'));var BPromise=require(_0x0333('0x7'));var Mustache=require(_0x0333('0x8'));var util=require(_0x0333('0x9'));var path=require(_0x0333('0xa'));var sox=require(_0x0333('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0333('0xc'));var squel=require(_0x0333('0xd'));var crypto=require(_0x0333('0xe'));var jsforce=require(_0x0333('0xf'));var deskjs=require(_0x0333('0x10'));var toCsv=require(_0x0333('0x11'));var querystring=require(_0x0333('0x12'));var Papa=require(_0x0333('0x13'));var authService=require(_0x0333('0x14'));var hardwareService=require(_0x0333('0x15'));var Redis=require(_0x0333('0x16'));var qs=require(_0x0333('0x17'));var logger=require(_0x0333('0x18'))(_0x0333('0x19'));var utils=require(_0x0333('0x1a'));var config=require('../../config/environment');var db=require(_0x0333('0x1b'))['db'];function respondWithStatusCode(_0x408ca3,_0x4aa942){_0x4aa942=_0x4aa942||0xcc;return function(_0xbc2899){if(_0xbc2899){return _0x408ca3['sendStatus'](_0x4aa942);}return _0x408ca3['status'](_0x4aa942)[_0x0333('0x1c')]();};}function respondWithResult(_0x22a814,_0x406813){_0x406813=_0x406813||0xc8;return function(_0xd9a50b){if(_0xd9a50b){return _0x22a814[_0x0333('0x1d')](_0x406813)['json'](_0xd9a50b);}};}function respondWithFilteredResult(_0x488d54,_0x147807){return function(_0x4c58bb){if(_0x4c58bb){var _0x573ee1=_0x4c58bb['count'],_0x41fd75=_0x147807[_0x0333('0x1e')],_0x41f53a=_0x147807[_0x0333('0x1e')]+_0x147807[_0x0333('0x1f')],_0x13f628;if(_0x41f53a>=_0x573ee1){_0x41f53a=_0x573ee1;_0x13f628=0xc8;}else{_0x13f628=0xce;}_0x488d54[_0x0333('0x1d')](_0x13f628);return _0x488d54[_0x0333('0x20')](_0x0333('0x21'),_0x41fd75+'-'+_0x41f53a+'/'+_0x573ee1)[_0x0333('0x22')](_0x4c58bb);}return null;};}function patchUpdates(_0x121405){return function(_0x223a86){try{jsonpatch[_0x0333('0x23')](_0x223a86,_0x121405,!![]);}catch(_0x4ec516){return BPromise[_0x0333('0x24')](_0x4ec516);}return _0x223a86[_0x0333('0x25')]();};}function saveUpdates(_0x1f0a5a,_0x52699e){return function(_0x1de113){if(_0x1de113){return _0x1de113[_0x0333('0x26')](_0x1f0a5a)['then'](function(_0x1118de){return _0x1118de;});}return null;};}function removeEntity(_0x47c602,_0x9a7fc0){return function(_0x1ae7f2){if(_0x1ae7f2){return _0x1ae7f2[_0x0333('0x27')]()[_0x0333('0x28')](function(){_0x47c602[_0x0333('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd90ea7,_0x56164e){return function(_0x471069){if(!_0x471069){_0xd90ea7[_0x0333('0x29')](0x194);}return _0x471069;};}function handleError(_0x588964,_0x45a05d){_0x45a05d=_0x45a05d||0x1f4;return function(_0x23c557){logger[_0x0333('0x2a')](_0x23c557[_0x0333('0x2b')]);if(_0x23c557[_0x0333('0x2c')]){delete _0x23c557[_0x0333('0x2c')];}_0x588964[_0x0333('0x1d')](_0x45a05d)[_0x0333('0x2d')](_0x23c557);};}exports[_0x0333('0x2e')]=function(_0x3eb769,_0x70dc27){var _0x322386={},_0x46e6bc={},_0x11a5e0={'count':0x0,'rows':[]};var _0x51b1ba=db['IntegrationReport'][_0x0333('0x2f')];_0x46e6bc['model']=_[_0x0333('0x30')](_0x51b1ba);_0x46e6bc[_0x0333('0x31')]=_[_0x0333('0x30')](_0x3eb769['query']);_0x46e6bc['filters']=_[_0x0333('0x32')](_0x46e6bc[_0x0333('0x33')],_0x46e6bc[_0x0333('0x31')]);_0x322386[_0x0333('0x34')]=_[_0x0333('0x32')](_0x46e6bc[_0x0333('0x33')],qs[_0x0333('0x35')](_0x3eb769[_0x0333('0x31')][_0x0333('0x35')]));_0x322386['attributes']=_0x322386[_0x0333('0x34')][_0x0333('0x36')]?_0x322386[_0x0333('0x34')]:_0x46e6bc['model'];if(!_0x3eb769['query']['hasOwnProperty'](_0x0333('0x37'))){_0x322386[_0x0333('0x1f')]=qs[_0x0333('0x1f')](_0x3eb769[_0x0333('0x31')][_0x0333('0x1f')]);_0x322386[_0x0333('0x1e')]=qs['offset'](_0x3eb769[_0x0333('0x31')][_0x0333('0x1e')]);}_0x322386['order']=qs[_0x0333('0x38')](_0x3eb769[_0x0333('0x31')][_0x0333('0x38')]);_0x322386[_0x0333('0x39')]=qs[_0x0333('0x3a')](_[_0x0333('0x3b')](_0x3eb769[_0x0333('0x31')],_0x46e6bc[_0x0333('0x3a')]));if(_0x3eb769[_0x0333('0x31')][_0x0333('0x3c')]){_0x322386[_0x0333('0x39')]=_[_0x0333('0x3d')](_0x322386[_0x0333('0x39')],{'$or':_[_0x0333('0x3e')](_0x51b1ba,function(_0x5a550e){if(_0x5a550e['type']['key']!=='VIRTUAL'){var _0x19131b={};_0x19131b[_0x5a550e[_0x0333('0x3f')]]={'$like':'%'+_0x3eb769[_0x0333('0x31')][_0x0333('0x3c')]+'%'};return _0x19131b;}})});}_0x322386=_[_0x0333('0x3d')]({},_0x322386,_0x3eb769[_0x0333('0x40')]);var _0x241633={'where':_0x322386[_0x0333('0x39')]};return db[_0x0333('0x41')][_0x0333('0x42')](_0x241633)['then'](function(_0x2c0143){_0x11a5e0[_0x0333('0x42')]=_0x2c0143;if(_0x3eb769[_0x0333('0x31')][_0x0333('0x43')]){_0x322386[_0x0333('0x44')]=[{'all':!![]}];}return db[_0x0333('0x41')][_0x0333('0x45')](_0x322386);})[_0x0333('0x28')](function(_0x590a16){_0x11a5e0[_0x0333('0x46')]=_0x590a16;return _0x11a5e0;})[_0x0333('0x28')](respondWithFilteredResult(_0x70dc27,_0x322386))['catch'](handleError(_0x70dc27,null));};exports[_0x0333('0x47')]=function(_0x32b99c,_0x5264f4){var _0xc8a580={'raw':![],'where':{'id':_0x32b99c[_0x0333('0x48')]['id']}},_0x270b4b={};_0x270b4b[_0x0333('0x33')]=_[_0x0333('0x30')](db[_0x0333('0x41')]['rawAttributes']);_0x270b4b[_0x0333('0x31')]=_[_0x0333('0x30')](_0x32b99c['query']);_0x270b4b[_0x0333('0x3a')]=_[_0x0333('0x32')](_0x270b4b['model'],_0x270b4b[_0x0333('0x31')]);_0xc8a580[_0x0333('0x34')]=_[_0x0333('0x32')](_0x270b4b[_0x0333('0x33')],qs[_0x0333('0x35')](_0x32b99c[_0x0333('0x31')]['fields']));_0xc8a580[_0x0333('0x34')]=_0xc8a580['attributes']['length']?_0xc8a580[_0x0333('0x34')]:_0x270b4b[_0x0333('0x33')];if(_0x32b99c['query'][_0x0333('0x43')]){_0xc8a580[_0x0333('0x44')]=[{'all':!![]}];}_0xc8a580=_[_0x0333('0x3d')]({},_0xc8a580,_0x32b99c['options']);return db[_0x0333('0x41')][_0x0333('0x49')](_0xc8a580)['then'](handleEntityNotFound(_0x5264f4,null))[_0x0333('0x28')](respondWithResult(_0x5264f4,null))[_0x0333('0x4a')](handleError(_0x5264f4,null));};exports[_0x0333('0x4b')]=function(_0x5616e8,_0x5e6f10){return db[_0x0333('0x41')][_0x0333('0x4b')](_0x5616e8['body'],{})[_0x0333('0x28')](respondWithResult(_0x5e6f10,0xc9))[_0x0333('0x4a')](handleError(_0x5e6f10,null));};exports[_0x0333('0x26')]=function(_0x416678,_0x4d9c33){if(_0x416678['body']['id']){delete _0x416678['body']['id'];}return db['IntegrationReport'][_0x0333('0x49')]({'where':{'id':_0x416678[_0x0333('0x48')]['id']}})[_0x0333('0x28')](handleEntityNotFound(_0x4d9c33,null))[_0x0333('0x28')](saveUpdates(_0x416678[_0x0333('0x4c')],null))[_0x0333('0x28')](respondWithResult(_0x4d9c33,null))[_0x0333('0x4a')](handleError(_0x4d9c33,null));};exports[_0x0333('0x27')]=function(_0x2741fd,_0x1c7bf0){return db[_0x0333('0x41')][_0x0333('0x49')]({'where':{'id':_0x2741fd['params']['id']}})[_0x0333('0x28')](handleEntityNotFound(_0x1c7bf0,null))['then'](removeEntity(_0x1c7bf0,null))['catch'](handleError(_0x1c7bf0,null));};exports[_0x0333('0x4d')]=function(_0x1409ec,_0xdc1805){return db[_0x0333('0x41')][_0x0333('0x4d')]()[_0x0333('0x28')](respondWithResult(_0xdc1805,null))[_0x0333('0x4a')](handleError(_0xdc1805,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 19aec56..09534e5 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 _0x6455=['report_integration','lodash','../../config/logger','api','moment','bluebird','request-promise','./integrationReport.attributes','define','IntegrationReport'];(function(_0x1c7bcd,_0x478875){var _0x554320=function(_0x1acb8d){while(--_0x1acb8d){_0x1c7bcd['push'](_0x1c7bcd['shift']());}};_0x554320(++_0x478875);}(_0x6455,0x97));var _0x5645=function(_0x4033a2,_0x2f3210){_0x4033a2=_0x4033a2-0x0;var _0x28f14b=_0x6455[_0x4033a2];return _0x28f14b;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var logger=require(_0x5645('0x1'))(_0x5645('0x2'));var moment=require(_0x5645('0x3'));var BPromise=require(_0x5645('0x4'));var rp=require(_0x5645('0x5'));var attributes=require(_0x5645('0x6'));module['exports']=function(_0x233875,_0x29cefe){return _0x233875[_0x5645('0x7')](_0x5645('0x8'),attributes,{'tableName':_0x5645('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11e5=['./integrationReport.attributes','IntegrationReport','report_integration','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x38d5f6,_0x3de356){var _0x416036=function(_0x343dcb){while(--_0x343dcb){_0x38d5f6['push'](_0x38d5f6['shift']());}};_0x416036(++_0x3de356);}(_0x11e5,0x8b));var _0x511e=function(_0x55a51e,_0x4eedbd){_0x55a51e=_0x55a51e-0x0;var _0x496d0e=_0x11e5[_0x55a51e];return _0x496d0e;};'use strict';var _=require(_0x511e('0x0'));var util=require('util');var logger=require(_0x511e('0x1'))(_0x511e('0x2'));var moment=require('moment');var BPromise=require(_0x511e('0x3'));var rp=require(_0x511e('0x4'));var attributes=require(_0x511e('0x5'));module['exports']=function(_0x249e4d,_0x4fbd4f){return _0x249e4d['define'](_0x511e('0x6'),attributes,{'tableName':_0x511e('0x7'),'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 693822a..0a0b6c7 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 _0x6d0c=['http','request','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0xcd02bf,_0x447b5a){var _0x3c8d3b=function(_0xaf1d92){while(--_0xaf1d92){_0xcd02bf['push'](_0xcd02bf['shift']());}};_0x3c8d3b(++_0x447b5a);}(_0x6d0c,0x12d));var _0xc6d0=function(_0x3e4934,_0xc08ac9){_0x3e4934=_0x3e4934-0x0;var _0x1be72b=_0x6d0c[_0x3e4934];return _0x1be72b;};'use strict';var _=require('lodash');var util=require(_0xc6d0('0x0'));var moment=require(_0xc6d0('0x1'));var BPromise=require(_0xc6d0('0x2'));var rs=require(_0xc6d0('0x3'));var fs=require('fs');var Redis=require(_0xc6d0('0x4'));var db=require(_0xc6d0('0x5'))['db'];var utils=require(_0xc6d0('0x6'));var logger=require(_0xc6d0('0x7'))(_0xc6d0('0x8'));var config=require('../../config/environment');var jayson=require(_0xc6d0('0x9'));var client=jayson[_0xc6d0('0xa')][_0xc6d0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x244e21,_0x599347,_0x2c39f3){return new BPromise(function(_0x2a2b1b,_0x7b8fa2){return client[_0xc6d0('0xc')](_0x244e21,_0x2c39f3)['then'](function(_0x4fdfeb){logger['info'](_0xc6d0('0xd'),_0x599347,_0xc6d0('0xe'));logger[_0xc6d0('0xf')](_0xc6d0('0x10'),_0x599347,_0xc6d0('0xe'),JSON[_0xc6d0('0x11')](_0x4fdfeb));if(_0x4fdfeb[_0xc6d0('0x12')]){if(_0x4fdfeb[_0xc6d0('0x12')][_0xc6d0('0x13')]===0x1f4){logger[_0xc6d0('0x12')](_0xc6d0('0xd'),_0x599347,_0x4fdfeb[_0xc6d0('0x12')][_0xc6d0('0x14')]);return _0x7b8fa2(_0x4fdfeb[_0xc6d0('0x12')][_0xc6d0('0x14')]);}logger[_0xc6d0('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x599347,_0x4fdfeb[_0xc6d0('0x12')][_0xc6d0('0x14')]);return _0x2a2b1b(_0x4fdfeb[_0xc6d0('0x12')][_0xc6d0('0x14')]);}else{logger[_0xc6d0('0x15')](_0xc6d0('0xd'),_0x599347,_0xc6d0('0xe'));_0x2a2b1b(_0x4fdfeb[_0xc6d0('0x16')][_0xc6d0('0x14')]);}})[_0xc6d0('0x17')](function(_0xf599ec){logger['error'](_0xc6d0('0xd'),_0x599347,_0xf599ec);_0x7b8fa2(_0xf599ec);});});} \ No newline at end of file +var _0xf9c9=['lodash','moment','randomstring','../../config/logger','../../config/environment','client','request','info','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x34b5a0,_0x326c52){var _0x32bccb=function(_0x32c7cd){while(--_0x32c7cd){_0x34b5a0['push'](_0x34b5a0['shift']());}};_0x32bccb(++_0x326c52);}(_0xf9c9,0xf0));var _0x9f9c=function(_0x45b1ba,_0x5a6a21){_0x45b1ba=_0x45b1ba-0x0;var _0x145ddb=_0xf9c9[_0x45b1ba];return _0x145ddb;};'use strict';var _=require(_0x9f9c('0x0'));var util=require('util');var moment=require(_0x9f9c('0x1'));var BPromise=require('bluebird');var rs=require(_0x9f9c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9f9c('0x3'))('rpc');var config=require(_0x9f9c('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x9f9c('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x563a43,_0x4e9f61,_0x41de08){return new BPromise(function(_0xb5b2b6,_0x2ae76c){return client[_0x9f9c('0x6')](_0x563a43,_0x41de08)['then'](function(_0x942c66){logger[_0x9f9c('0x7')](_0x9f9c('0x8'),_0x4e9f61,'request\x20sent');logger[_0x9f9c('0x9')](_0x9f9c('0xa'),_0x4e9f61,'request\x20sent',JSON[_0x9f9c('0xb')](_0x942c66));if(_0x942c66[_0x9f9c('0xc')]){if(_0x942c66['error']['code']===0x1f4){logger[_0x9f9c('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x4e9f61,_0x942c66[_0x9f9c('0xc')][_0x9f9c('0xd')]);return _0x2ae76c(_0x942c66[_0x9f9c('0xc')][_0x9f9c('0xd')]);}logger[_0x9f9c('0xc')](_0x9f9c('0x8'),_0x4e9f61,_0x942c66['error'][_0x9f9c('0xd')]);return _0xb5b2b6(_0x942c66['error'][_0x9f9c('0xd')]);}else{logger[_0x9f9c('0x7')](_0x9f9c('0x8'),_0x4e9f61,'request\x20sent');_0xb5b2b6(_0x942c66[_0x9f9c('0xe')]['message']);}})['catch'](function(_0xef86ea){logger[_0x9f9c('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x4e9f61,_0xef86ea);_0x2ae76c(_0xef86ea);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index d00f0a3..f3488d1 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 _0x6743=['create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x6743,0xd0));var _0x3674=function(_0x3e2e82,_0x369bbe){_0x3e2e82=_0x3e2e82-0x0;var _0xba15aa=_0x6743[_0x3e2e82];return _0xba15aa;};'use strict';var multer=require(_0x3674('0x0'));var util=require(_0x3674('0x1'));var path=require(_0x3674('0x2'));var timeout=require(_0x3674('0x3'));var express=require(_0x3674('0x4'));var router=express[_0x3674('0x5')]();var auth=require(_0x3674('0x6'));var interaction=require(_0x3674('0x7'));var config=require(_0x3674('0x8'));var controller=require('./interval.controller');router[_0x3674('0x9')]('/',auth[_0x3674('0xa')](),controller[_0x3674('0xb')]);router['get'](_0x3674('0xc'),auth[_0x3674('0xa')](),controller[_0x3674('0xd')]);router[_0x3674('0x9')](_0x3674('0xe'),auth[_0x3674('0xa')](),controller[_0x3674('0xf')]);router[_0x3674('0x10')]('/',auth['isAuthenticated'](),controller[_0x3674('0x11')]);router[_0x3674('0x10')](_0x3674('0xe'),auth[_0x3674('0xa')](),controller[_0x3674('0x12')]);router[_0x3674('0x10')](_0x3674('0x13'),auth[_0x3674('0xa')](),controller[_0x3674('0x14')]);router[_0x3674('0x15')](_0x3674('0xc'),auth[_0x3674('0xa')](),controller[_0x3674('0x16')]);router[_0x3674('0x17')](_0x3674('0xc'),auth[_0x3674('0xa')](),controller['destroy']);module[_0x3674('0x18')]=router; \ No newline at end of file +var _0x3ef1=['post','create','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','delete','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','./interval.controller','get','isAuthenticated'];(function(_0x5a8c86,_0x24e7e2){var _0x13adb6=function(_0x59b296){while(--_0x59b296){_0x5a8c86['push'](_0x5a8c86['shift']());}};_0x13adb6(++_0x24e7e2);}(_0x3ef1,0x187));var _0x13ef=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x3ef1[_0x13b02f];return _0x12e9a6;};'use strict';var multer=require(_0x13ef('0x0'));var util=require(_0x13ef('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x13ef('0x2'));var router=express['Router']();var auth=require(_0x13ef('0x3'));var interaction=require(_0x13ef('0x4'));var config=require('../../config/environment');var controller=require(_0x13ef('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x13ef('0x6')]('/:id',auth[_0x13ef('0x7')](),controller['show']);router[_0x13ef('0x6')]('/:id/sub_intervals',auth[_0x13ef('0x7')](),controller['getIntervals']);router[_0x13ef('0x8')]('/',auth[_0x13ef('0x7')](),controller[_0x13ef('0x9')]);router[_0x13ef('0x8')](_0x13ef('0xa'),auth[_0x13ef('0x7')](),controller[_0x13ef('0xb')]);router['post'](_0x13ef('0xc'),auth['isAuthenticated'](),controller[_0x13ef('0xd')]);router[_0x13ef('0xe')](_0x13ef('0xf'),auth['isAuthenticated'](),controller[_0x13ef('0x10')]);router[_0x13ef('0x11')](_0x13ef('0xf'),auth[_0x13ef('0x7')](),controller['destroy']);module[_0x13ef('0x12')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index e08d4a4..74989b0 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 _0x14f6=['exports','STRING','sequelize'];(function(_0x2abaae,_0x29fd8b){var _0x5b5745=function(_0x2f6218){while(--_0x2f6218){_0x2abaae['push'](_0x2abaae['shift']());}};_0x5b5745(++_0x29fd8b);}(_0x14f6,0x1c1));var _0x614f=function(_0x4e969c,_0x3be24e){_0x4e969c=_0x4e969c-0x0;var _0x21cf2e=_0x14f6[_0x4e969c];return _0x21cf2e;};'use strict';var Sequelize=require(_0x614f('0x0'));module[_0x614f('0x1')]={'name':{'type':Sequelize[_0x614f('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x614f('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xdcd8=['sequelize','exports','STRING'];(function(_0x1e1346,_0x4cbf50){var _0xf208da=function(_0x2d8030){while(--_0x2d8030){_0x1e1346['push'](_0x1e1346['shift']());}};_0xf208da(++_0x4cbf50);}(_0xdcd8,0x7b));var _0x8dcd=function(_0x147f22,_0x3fb477){_0x147f22=_0x147f22-0x0;var _0x480aec=_0xdcd8[_0x147f22];return _0x480aec;};'use strict';var Sequelize=require(_0x8dcd('0x0'));module[_0x8dcd('0x1')]={'name':{'type':Sequelize[_0x8dcd('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 12cf776..184c30e 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 _0xeb24=['user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','findOne','hasOwnProperty','addIntervals','sequelize','transaction','IntervalId','bulkCreate','html-pdf','eml-format','rimraf','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../components/extensions/rewrite','sendStatus','status','end','offset','limit','set','json','apply','reject','save','update','then','destroy','get','Intervals','error','name','send','index','Interval','rawAttributes','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','params','length','find','create','body'];(function(_0x509803,_0x28fb49){var _0x2c4dd=function(_0x54511f){while(--_0x54511f){_0x509803['push'](_0x509803['shift']());}};_0x2c4dd(++_0x28fb49);}(_0xeb24,0x11a));var _0x4eb2=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xeb24[_0xa148b7];return _0x51efd3;};'use strict';var pdf=require(_0x4eb2('0x0'));var emlformat=require(_0x4eb2('0x1'));var rimraf=require(_0x4eb2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4eb2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4eb2('0x4'));var util=require(_0x4eb2('0x5'));var path=require(_0x4eb2('0x6'));var sox=require(_0x4eb2('0x7'));var csv=require(_0x4eb2('0x8'));var ejs=require(_0x4eb2('0x9'));var fs=require('fs');var _=require(_0x4eb2('0xa'));var squel=require(_0x4eb2('0xb'));var crypto=require(_0x4eb2('0xc'));var jsforce=require(_0x4eb2('0xd'));var deskjs=require(_0x4eb2('0xe'));var toCsv=require(_0x4eb2('0x8'));var querystring=require(_0x4eb2('0xf'));var Papa=require(_0x4eb2('0x10'));var authService=require(_0x4eb2('0x11'));var hardwareService=require(_0x4eb2('0x12'));var Redis=require('ioredis');var qs=require(_0x4eb2('0x13'));var logger=require(_0x4eb2('0x14'))(_0x4eb2('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var extensions=require(_0x4eb2('0x16'));function respondWithStatusCode(_0x2bca01,_0x36cbac){_0x36cbac=_0x36cbac||0xcc;return function(_0x35d8ec){if(_0x35d8ec){return _0x2bca01[_0x4eb2('0x17')](_0x36cbac);}return _0x2bca01[_0x4eb2('0x18')](_0x36cbac)[_0x4eb2('0x19')]();};}function respondWithResult(_0x19112c,_0x20cae3){_0x20cae3=_0x20cae3||0xc8;return function(_0x5d8bfe){if(_0x5d8bfe){return _0x19112c[_0x4eb2('0x18')](_0x20cae3)['json'](_0x5d8bfe);}};}function respondWithFilteredResult(_0x501736,_0x3eb356){return function(_0x1657d1){if(_0x1657d1){var _0x2b565f=_0x1657d1['count'],_0x39168e=_0x3eb356['offset'],_0x10886d=_0x3eb356[_0x4eb2('0x1a')]+_0x3eb356[_0x4eb2('0x1b')],_0x1c4ef5;if(_0x10886d>=_0x2b565f){_0x10886d=_0x2b565f;_0x1c4ef5=0xc8;}else{_0x1c4ef5=0xce;}_0x501736[_0x4eb2('0x18')](_0x1c4ef5);return _0x501736[_0x4eb2('0x1c')]('Content-Range',_0x39168e+'-'+_0x10886d+'/'+_0x2b565f)[_0x4eb2('0x1d')](_0x1657d1);}return null;};}function patchUpdates(_0xb8a8ba){return function(_0x3bc217){try{jsonpatch[_0x4eb2('0x1e')](_0x3bc217,_0xb8a8ba,!![]);}catch(_0xc184b2){return BPromise[_0x4eb2('0x1f')](_0xc184b2);}return _0x3bc217[_0x4eb2('0x20')]();};}function saveUpdates(_0x484f2c,_0xd3626f){return function(_0x58bdad){if(_0x58bdad){return _0x58bdad[_0x4eb2('0x21')](_0x484f2c)[_0x4eb2('0x22')](function(_0x3a731d){return _0x3a731d;});}return null;};}function removeEntity(_0x34946f,_0x5503ea){return function(_0xfb84e4){if(_0xfb84e4){return _0xfb84e4[_0x4eb2('0x23')]()['then'](function(){var _0xa1d7d5=_0xfb84e4[_0x4eb2('0x24')]({'plain':!![]});var _0x5cbd92=_0x4eb2('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x5cbd92,'resourceId':_0xa1d7d5['id']}})[_0x4eb2('0x22')](function(){return _0xfb84e4;});})[_0x4eb2('0x22')](function(){_0x34946f[_0x4eb2('0x18')](0xcc)[_0x4eb2('0x19')]();});}};}function handleEntityNotFound(_0x7f2034,_0x47d45e){return function(_0x5d934c){if(!_0x5d934c){_0x7f2034[_0x4eb2('0x17')](0x194);}return _0x5d934c;};}function handleError(_0x4ce52d,_0x15790a){_0x15790a=_0x15790a||0x1f4;return function(_0x20bdd1){logger[_0x4eb2('0x26')](_0x20bdd1['stack']);if(_0x20bdd1[_0x4eb2('0x27')]){delete _0x20bdd1[_0x4eb2('0x27')];}_0x4ce52d[_0x4eb2('0x18')](_0x15790a)[_0x4eb2('0x28')](_0x20bdd1);};}exports[_0x4eb2('0x29')]=function(_0x117fc5,_0xd5eec){var _0x49ba7d={},_0x56889a={},_0x4eb722={'count':0x0,'rows':[]};var _0x100cf7=db[_0x4eb2('0x2a')][_0x4eb2('0x2b')];_0x56889a[_0x4eb2('0x2c')]=_['keys'](_0x100cf7);_0x56889a[_0x4eb2('0x2d')]=_[_0x4eb2('0x2e')](_0x117fc5[_0x4eb2('0x2d')]);_0x56889a[_0x4eb2('0x2f')]=_[_0x4eb2('0x30')](_0x56889a[_0x4eb2('0x2c')],_0x56889a[_0x4eb2('0x2d')]);_0x49ba7d[_0x4eb2('0x31')]=_[_0x4eb2('0x30')](_0x56889a['model'],qs[_0x4eb2('0x32')](_0x117fc5['query'][_0x4eb2('0x32')]));_0x49ba7d[_0x4eb2('0x31')]=_0x49ba7d['attributes']['length']?_0x49ba7d[_0x4eb2('0x31')]:_0x56889a[_0x4eb2('0x2c')];if(!_0x117fc5[_0x4eb2('0x2d')]['hasOwnProperty'](_0x4eb2('0x33'))){_0x49ba7d[_0x4eb2('0x1b')]=qs[_0x4eb2('0x1b')](_0x117fc5[_0x4eb2('0x2d')][_0x4eb2('0x1b')]);_0x49ba7d[_0x4eb2('0x1a')]=qs[_0x4eb2('0x1a')](_0x117fc5['query']['offset']);}_0x49ba7d[_0x4eb2('0x34')]=qs[_0x4eb2('0x35')](_0x117fc5[_0x4eb2('0x2d')][_0x4eb2('0x35')]);_0x49ba7d[_0x4eb2('0x36')]=qs[_0x4eb2('0x2f')](_[_0x4eb2('0x37')](_0x117fc5[_0x4eb2('0x2d')],_0x56889a[_0x4eb2('0x2f')]));if(_0x117fc5[_0x4eb2('0x2d')][_0x4eb2('0x38')]){_0x49ba7d[_0x4eb2('0x36')]=_[_0x4eb2('0x39')](_0x49ba7d['where'],{'$or':_[_0x4eb2('0x3a')](_0x100cf7,function(_0x2dc09e){if(_0x2dc09e[_0x4eb2('0x3b')][_0x4eb2('0x3c')]!==_0x4eb2('0x3d')){var _0x2f38ba={};_0x2f38ba[_0x2dc09e[_0x4eb2('0x3e')]]={'$like':'%'+_0x117fc5[_0x4eb2('0x2d')][_0x4eb2('0x38')]+'%'};return _0x2f38ba;}})});}_0x49ba7d=_[_0x4eb2('0x39')]({},_0x49ba7d,_0x117fc5[_0x4eb2('0x3f')]);var _0x307d02={'where':_0x49ba7d[_0x4eb2('0x36')]};return db[_0x4eb2('0x2a')]['count'](_0x307d02)[_0x4eb2('0x22')](function(_0x4c012c){_0x4eb722['count']=_0x4c012c;if(_0x117fc5[_0x4eb2('0x2d')][_0x4eb2('0x40')]){_0x49ba7d[_0x4eb2('0x41')]=[{'all':!![]}];}return db[_0x4eb2('0x2a')][_0x4eb2('0x42')](_0x49ba7d);})[_0x4eb2('0x22')](function(_0xe7dab8){_0x4eb722[_0x4eb2('0x43')]=_0xe7dab8;return _0x4eb722;})[_0x4eb2('0x22')](respondWithFilteredResult(_0xd5eec,_0x49ba7d))[_0x4eb2('0x44')](handleError(_0xd5eec,null));};exports['show']=function(_0x4062af,_0x37aa0f){var _0x51efc7={'raw':!![],'where':{'id':_0x4062af[_0x4eb2('0x45')]['id']}},_0x412ad2={};_0x412ad2[_0x4eb2('0x2c')]=_[_0x4eb2('0x2e')](db[_0x4eb2('0x2a')]['rawAttributes']);_0x412ad2[_0x4eb2('0x2d')]=_[_0x4eb2('0x2e')](_0x4062af[_0x4eb2('0x2d')]);_0x412ad2['filters']=_[_0x4eb2('0x30')](_0x412ad2[_0x4eb2('0x2c')],_0x412ad2['query']);_0x51efc7['attributes']=_[_0x4eb2('0x30')](_0x412ad2[_0x4eb2('0x2c')],qs[_0x4eb2('0x32')](_0x4062af[_0x4eb2('0x2d')][_0x4eb2('0x32')]));_0x51efc7[_0x4eb2('0x31')]=_0x51efc7[_0x4eb2('0x31')][_0x4eb2('0x46')]?_0x51efc7[_0x4eb2('0x31')]:_0x412ad2[_0x4eb2('0x2c')];if(_0x4062af[_0x4eb2('0x2d')][_0x4eb2('0x40')]){_0x51efc7[_0x4eb2('0x41')]=[{'all':!![]}];}_0x51efc7=_[_0x4eb2('0x39')]({},_0x51efc7,_0x4062af[_0x4eb2('0x3f')]);return db['Interval'][_0x4eb2('0x47')](_0x51efc7)[_0x4eb2('0x22')](handleEntityNotFound(_0x37aa0f,null))[_0x4eb2('0x22')](respondWithResult(_0x37aa0f,null))['catch'](handleError(_0x37aa0f,null));};exports['create']=function(_0x343a59,_0xfd849d){return db['Interval'][_0x4eb2('0x48')](_0x343a59[_0x4eb2('0x49')],{})[_0x4eb2('0x22')](function(_0xd73e6d){var _0x283198=_0x343a59[_0x4eb2('0x4a')]['get']({'plain':!![]});if(!_0x283198)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x283198[_0x4eb2('0x4b')]==='user'){var _0x6b8551=_0xd73e6d[_0x4eb2('0x24')]({'plain':!![]});var _0x4a53de=_0x4eb2('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x4a53de,'userProfileId':_0x283198[_0x4eb2('0x4c')]},'raw':!![]})[_0x4eb2('0x22')](function(_0x4acd52){if(_0x4acd52&&_0x4acd52[_0x4eb2('0x4d')]===0x0){return db[_0x4eb2('0x4e')][_0x4eb2('0x48')]({'name':_0x6b8551[_0x4eb2('0x27')],'resourceId':_0x6b8551['id'],'type':_0x4acd52[_0x4eb2('0x27')],'sectionId':_0x4acd52['id']},{})['then'](function(){return _0xd73e6d;});}else{return _0xd73e6d;}})[_0x4eb2('0x44')](function(_0x396fee){logger[_0x4eb2('0x26')](_0x4eb2('0x4f'),_0x396fee);throw _0x396fee;});}return _0xd73e6d;})[_0x4eb2('0x22')](respondWithResult(_0xfd849d,0xc9))[_0x4eb2('0x44')](handleError(_0xfd849d,null));};exports['update']=function(_0x5dba56,_0x146faf){if(_0x5dba56[_0x4eb2('0x49')]['id']){delete _0x5dba56['body']['id'];}return db['Interval'][_0x4eb2('0x47')]({'where':{'id':_0x5dba56[_0x4eb2('0x45')]['id']}})[_0x4eb2('0x22')](handleEntityNotFound(_0x146faf,null))[_0x4eb2('0x22')](saveUpdates(_0x5dba56[_0x4eb2('0x49')],null))['then'](respondWithResult(_0x146faf,null))[_0x4eb2('0x44')](handleError(_0x146faf,null));};exports[_0x4eb2('0x23')]=function(_0x467939,_0x734d7a){return db[_0x4eb2('0x2a')]['find']({'where':{'id':_0x467939[_0x4eb2('0x45')]['id']}})['then'](handleEntityNotFound(_0x734d7a,null))[_0x4eb2('0x22')](removeEntity(_0x734d7a,null))[_0x4eb2('0x44')](handleError(_0x734d7a,null));};exports[_0x4eb2('0x50')]=function(_0x5381a1,_0x5ab2a1,_0x34f668){if(_0x5381a1[_0x4eb2('0x49')]['id']){delete _0x5381a1[_0x4eb2('0x49')]['id'];}return db[_0x4eb2('0x2a')][_0x4eb2('0x47')]({'where':{'id':_0x5381a1['params']['id']}})[_0x4eb2('0x22')](handleEntityNotFound(_0x5ab2a1,null))['then'](function(_0x501c30){if(_0x501c30){_0x5381a1['body']['IntervalId']=_0x501c30['id'];return db[_0x4eb2('0x2a')]['create'](_0x5381a1[_0x4eb2('0x49')]);}})[_0x4eb2('0x22')](respondWithResult(_0x5ab2a1,null))['catch'](handleError(_0x5ab2a1,null));};exports[_0x4eb2('0x51')]=function(_0x273ab4,_0x2268b0,_0x1c2479){var _0x4ab62a={};var _0x5d04f8={};var _0x245dbe;var _0x2eb29a;return db[_0x4eb2('0x2a')][_0x4eb2('0x52')]({'where':{'id':_0x273ab4['params']['id']}})[_0x4eb2('0x22')](handleEntityNotFound(_0x2268b0,null))['then'](function(_0x34ba20){if(_0x34ba20){_0x245dbe=_0x34ba20;_0x5d04f8[_0x4eb2('0x2c')]=_[_0x4eb2('0x2e')](db[_0x4eb2('0x2a')]['rawAttributes']);_0x5d04f8[_0x4eb2('0x2d')]=_['keys'](_0x273ab4[_0x4eb2('0x2d')]);_0x5d04f8[_0x4eb2('0x2f')]=_[_0x4eb2('0x30')](_0x5d04f8['model'],_0x5d04f8['query']);_0x4ab62a['attributes']=_['intersection'](_0x5d04f8[_0x4eb2('0x2c')],qs[_0x4eb2('0x32')](_0x273ab4[_0x4eb2('0x2d')][_0x4eb2('0x32')]));_0x4ab62a['attributes']=_0x4ab62a['attributes'][_0x4eb2('0x46')]?_0x4ab62a[_0x4eb2('0x31')]:_0x5d04f8[_0x4eb2('0x2c')];_0x4ab62a[_0x4eb2('0x34')]=qs[_0x4eb2('0x35')](_0x273ab4['query'][_0x4eb2('0x35')]);_0x4ab62a[_0x4eb2('0x36')]=qs['filters'](_[_0x4eb2('0x37')](_0x273ab4['query'],_0x5d04f8[_0x4eb2('0x2f')]));if(_0x273ab4[_0x4eb2('0x2d')][_0x4eb2('0x38')]){_0x4ab62a[_0x4eb2('0x36')]=_[_0x4eb2('0x39')](_0x4ab62a[_0x4eb2('0x36')],{'$or':_[_0x4eb2('0x3a')](_0x4ab62a[_0x4eb2('0x31')],function(_0x2c9547){var _0x9c4d66={};_0x9c4d66[_0x2c9547]={'$like':'%'+_0x273ab4[_0x4eb2('0x2d')]['filter']+'%'};return _0x9c4d66;})});}_0x4ab62a=_[_0x4eb2('0x39')]({},_0x4ab62a,_0x273ab4['options']);return _0x245dbe[_0x4eb2('0x51')](_0x4ab62a);}})['then'](function(_0x3a8d39){if(_0x3a8d39){_0x2eb29a=_0x3a8d39[_0x4eb2('0x46')];if(!_0x273ab4[_0x4eb2('0x2d')][_0x4eb2('0x53')](_0x4eb2('0x33'))){_0x4ab62a[_0x4eb2('0x1b')]=qs[_0x4eb2('0x1b')](_0x273ab4['query'][_0x4eb2('0x1b')]);_0x4ab62a[_0x4eb2('0x1a')]=qs[_0x4eb2('0x1a')](_0x273ab4[_0x4eb2('0x2d')][_0x4eb2('0x1a')]);}return _0x245dbe[_0x4eb2('0x51')](_0x4ab62a);}})[_0x4eb2('0x22')](function(_0x32a7af){if(_0x32a7af){return _0x32a7af?{'count':_0x2eb29a,'rows':_0x32a7af}:null;}})['then'](respondWithResult(_0x2268b0,null))['catch'](handleError(_0x2268b0,null));};exports[_0x4eb2('0x54')]=function(_0x2e4c38,_0x23326b,_0x4c8128){return db['Interval'][_0x4eb2('0x52')]({'where':{'id':_0x2e4c38[_0x4eb2('0x45')]['id']}})[_0x4eb2('0x22')](handleEntityNotFound(_0x23326b,null))[_0x4eb2('0x22')](function(_0x18c3b9){if(_0x18c3b9){return db[_0x4eb2('0x55')][_0x4eb2('0x56')](function(_0x35e88f){return db[_0x4eb2('0x2a')][_0x4eb2('0x23')]({'where':{'IntervalId':_0x2e4c38[_0x4eb2('0x45')]['id']},'transaction':_0x35e88f})[_0x4eb2('0x22')](function(_0xfea197){var _0x2fee19=_[_0x4eb2('0x3a')](_0x2e4c38[_0x4eb2('0x49')],function(_0x1fd489){delete _0x1fd489['id'];_0x1fd489[_0x4eb2('0x57')]=_0x2e4c38[_0x4eb2('0x45')]['id'];return _0x1fd489;});return db[_0x4eb2('0x2a')][_0x4eb2('0x58')](_0x2fee19,{'transaction':_0x35e88f});});})['then'](function(){return db[_0x4eb2('0x2a')][_0x4eb2('0x42')]({'where':{'IntervalId':_0x2e4c38[_0x4eb2('0x45')]['id']}});});}})[_0x4eb2('0x22')](respondWithResult(_0x23326b,null))['catch'](handleError(_0x23326b,null));}; \ No newline at end of file +var _0xebda=['Intervals','UserProfileResource','stack','name','send','Interval','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','pick','filter','where','merge','map','key','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','sort','addIntervals','findOne','sequelize','transaction','bulkCreate','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','ioredis','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','status','end','json','count','limit','set','apply','reject','save','then','destroy','get'];(function(_0x527626,_0x2192a5){var _0x5655c5=function(_0x38cb0c){while(--_0x38cb0c){_0x527626['push'](_0x527626['shift']());}};_0x5655c5(++_0x2192a5);}(_0xebda,0x12f));var _0xaebd=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xebda[_0x5608a3];return _0x1ed50a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xaebd('0x0'));var zipdir=require(_0xaebd('0x1'));var jsonpatch=require(_0xaebd('0x2'));var rp=require(_0xaebd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaebd('0x4'));var util=require('util');var path=require(_0xaebd('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaebd('0x6'));var fs=require('fs');var _=require(_0xaebd('0x7'));var squel=require(_0xaebd('0x8'));var crypto=require(_0xaebd('0x9'));var jsforce=require(_0xaebd('0xa'));var deskjs=require(_0xaebd('0xb'));var toCsv=require(_0xaebd('0xc'));var querystring=require(_0xaebd('0xd'));var Papa=require(_0xaebd('0xe'));var authService=require(_0xaebd('0xf'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xaebd('0x10'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0xaebd('0x11'));var config=require(_0xaebd('0x12'));var db=require(_0xaebd('0x13'))['db'];var extensions=require(_0xaebd('0x14'));function respondWithStatusCode(_0x362b84,_0x41099e){_0x41099e=_0x41099e||0xcc;return function(_0x5ea02e){if(_0x5ea02e){return _0x362b84['sendStatus'](_0x41099e);}return _0x362b84[_0xaebd('0x15')](_0x41099e)[_0xaebd('0x16')]();};}function respondWithResult(_0x268350,_0x4a61b8){_0x4a61b8=_0x4a61b8||0xc8;return function(_0x55cb47){if(_0x55cb47){return _0x268350['status'](_0x4a61b8)[_0xaebd('0x17')](_0x55cb47);}};}function respondWithFilteredResult(_0x1f156f,_0x43778b){return function(_0x9813f0){if(_0x9813f0){var _0xfcb9f6=_0x9813f0[_0xaebd('0x18')],_0x3326e6=_0x43778b['offset'],_0x5e44da=_0x43778b['offset']+_0x43778b[_0xaebd('0x19')],_0xa35610;if(_0x5e44da>=_0xfcb9f6){_0x5e44da=_0xfcb9f6;_0xa35610=0xc8;}else{_0xa35610=0xce;}_0x1f156f['status'](_0xa35610);return _0x1f156f[_0xaebd('0x1a')]('Content-Range',_0x3326e6+'-'+_0x5e44da+'/'+_0xfcb9f6)[_0xaebd('0x17')](_0x9813f0);}return null;};}function patchUpdates(_0xac566d){return function(_0x1338dd){try{jsonpatch[_0xaebd('0x1b')](_0x1338dd,_0xac566d,!![]);}catch(_0x41dd93){return BPromise[_0xaebd('0x1c')](_0x41dd93);}return _0x1338dd[_0xaebd('0x1d')]();};}function saveUpdates(_0x38c6ad,_0x218a61){return function(_0x446ac3){if(_0x446ac3){return _0x446ac3['update'](_0x38c6ad)[_0xaebd('0x1e')](function(_0x1996fc){return _0x1996fc;});}return null;};}function removeEntity(_0x316bda,_0x2ee574){return function(_0x52be88){if(_0x52be88){return _0x52be88[_0xaebd('0x1f')]()[_0xaebd('0x1e')](function(){var _0x37717f=_0x52be88[_0xaebd('0x20')]({'plain':!![]});var _0x53812a=_0xaebd('0x21');return db[_0xaebd('0x22')][_0xaebd('0x1f')]({'where':{'type':_0x53812a,'resourceId':_0x37717f['id']}})[_0xaebd('0x1e')](function(){return _0x52be88;});})['then'](function(){_0x316bda[_0xaebd('0x15')](0xcc)[_0xaebd('0x16')]();});}};}function handleEntityNotFound(_0xc0a66d,_0x5adec6){return function(_0x40c77c){if(!_0x40c77c){_0xc0a66d['sendStatus'](0x194);}return _0x40c77c;};}function handleError(_0x11226a,_0x2c60e8){_0x2c60e8=_0x2c60e8||0x1f4;return function(_0xecdfed){logger['error'](_0xecdfed[_0xaebd('0x23')]);if(_0xecdfed[_0xaebd('0x24')]){delete _0xecdfed[_0xaebd('0x24')];}_0x11226a['status'](_0x2c60e8)[_0xaebd('0x25')](_0xecdfed);};}exports['index']=function(_0x39029a,_0x29d676){var _0x247205={},_0x59b68e={},_0x3560a5={'count':0x0,'rows':[]};var _0x31cc25=db[_0xaebd('0x26')][_0xaebd('0x27')];_0x59b68e[_0xaebd('0x28')]=_[_0xaebd('0x29')](_0x31cc25);_0x59b68e[_0xaebd('0x2a')]=_[_0xaebd('0x29')](_0x39029a[_0xaebd('0x2a')]);_0x59b68e[_0xaebd('0x2b')]=_['intersection'](_0x59b68e[_0xaebd('0x28')],_0x59b68e[_0xaebd('0x2a')]);_0x247205[_0xaebd('0x2c')]=_[_0xaebd('0x2d')](_0x59b68e[_0xaebd('0x28')],qs['fields'](_0x39029a['query'][_0xaebd('0x2e')]));_0x247205[_0xaebd('0x2c')]=_0x247205['attributes'][_0xaebd('0x2f')]?_0x247205[_0xaebd('0x2c')]:_0x59b68e['model'];if(!_0x39029a[_0xaebd('0x2a')][_0xaebd('0x30')](_0xaebd('0x31'))){_0x247205[_0xaebd('0x19')]=qs[_0xaebd('0x19')](_0x39029a[_0xaebd('0x2a')][_0xaebd('0x19')]);_0x247205[_0xaebd('0x32')]=qs[_0xaebd('0x32')](_0x39029a[_0xaebd('0x2a')]['offset']);}_0x247205[_0xaebd('0x33')]=qs['sort'](_0x39029a[_0xaebd('0x2a')]['sort']);_0x247205['where']=qs['filters'](_[_0xaebd('0x34')](_0x39029a[_0xaebd('0x2a')],_0x59b68e['filters']));if(_0x39029a[_0xaebd('0x2a')][_0xaebd('0x35')]){_0x247205[_0xaebd('0x36')]=_[_0xaebd('0x37')](_0x247205[_0xaebd('0x36')],{'$or':_[_0xaebd('0x38')](_0x31cc25,function(_0x11381b){if(_0x11381b['type'][_0xaebd('0x39')]!==_0xaebd('0x3a')){var _0x42f105={};_0x42f105[_0x11381b['field']]={'$like':'%'+_0x39029a[_0xaebd('0x2a')][_0xaebd('0x35')]+'%'};return _0x42f105;}})});}_0x247205=_[_0xaebd('0x37')]({},_0x247205,_0x39029a[_0xaebd('0x3b')]);var _0x12fe3a={'where':_0x247205[_0xaebd('0x36')]};return db[_0xaebd('0x26')][_0xaebd('0x18')](_0x12fe3a)['then'](function(_0x2d5f33){_0x3560a5['count']=_0x2d5f33;if(_0x39029a[_0xaebd('0x2a')][_0xaebd('0x3c')]){_0x247205['include']=[{'all':!![]}];}return db[_0xaebd('0x26')][_0xaebd('0x3d')](_0x247205);})[_0xaebd('0x1e')](function(_0x4ff975){_0x3560a5[_0xaebd('0x3e')]=_0x4ff975;return _0x3560a5;})[_0xaebd('0x1e')](respondWithFilteredResult(_0x29d676,_0x247205))[_0xaebd('0x3f')](handleError(_0x29d676,null));};exports[_0xaebd('0x40')]=function(_0x234a43,_0x1a70bc){var _0x1d94f0={'raw':!![],'where':{'id':_0x234a43[_0xaebd('0x41')]['id']}},_0x4fdb9d={};_0x4fdb9d[_0xaebd('0x28')]=_[_0xaebd('0x29')](db[_0xaebd('0x26')][_0xaebd('0x27')]);_0x4fdb9d['query']=_[_0xaebd('0x29')](_0x234a43[_0xaebd('0x2a')]);_0x4fdb9d[_0xaebd('0x2b')]=_['intersection'](_0x4fdb9d[_0xaebd('0x28')],_0x4fdb9d[_0xaebd('0x2a')]);_0x1d94f0[_0xaebd('0x2c')]=_[_0xaebd('0x2d')](_0x4fdb9d[_0xaebd('0x28')],qs[_0xaebd('0x2e')](_0x234a43[_0xaebd('0x2a')][_0xaebd('0x2e')]));_0x1d94f0[_0xaebd('0x2c')]=_0x1d94f0['attributes'][_0xaebd('0x2f')]?_0x1d94f0['attributes']:_0x4fdb9d[_0xaebd('0x28')];if(_0x234a43[_0xaebd('0x2a')]['includeAll']){_0x1d94f0[_0xaebd('0x42')]=[{'all':!![]}];}_0x1d94f0=_['merge']({},_0x1d94f0,_0x234a43[_0xaebd('0x3b')]);return db[_0xaebd('0x26')]['find'](_0x1d94f0)[_0xaebd('0x1e')](handleEntityNotFound(_0x1a70bc,null))['then'](respondWithResult(_0x1a70bc,null))[_0xaebd('0x3f')](handleError(_0x1a70bc,null));};exports['create']=function(_0x56d856,_0x45bc25){return db[_0xaebd('0x26')]['create'](_0x56d856[_0xaebd('0x43')],{})['then'](function(_0x52e648){var _0x1aeabe=_0x56d856['user'][_0xaebd('0x20')]({'plain':!![]});if(!_0x1aeabe)throw new Error(_0xaebd('0x44'));if(_0x1aeabe[_0xaebd('0x45')]===_0xaebd('0x46')){var _0x4d2afc=_0x52e648[_0xaebd('0x20')]({'plain':!![]});var _0x57d3c4='Intervals';return db['UserProfileSection'][_0xaebd('0x47')]({'where':{'name':_0x57d3c4,'userProfileId':_0x1aeabe['userProfileId']},'raw':!![]})[_0xaebd('0x1e')](function(_0x1d9508){if(_0x1d9508&&_0x1d9508[_0xaebd('0x48')]===0x0){return db[_0xaebd('0x22')][_0xaebd('0x49')]({'name':_0x4d2afc[_0xaebd('0x24')],'resourceId':_0x4d2afc['id'],'type':_0x1d9508['name'],'sectionId':_0x1d9508['id']},{})['then'](function(){return _0x52e648;});}else{return _0x52e648;}})[_0xaebd('0x3f')](function(_0x46281c){logger['error'](_0xaebd('0x4a'),_0x46281c);throw _0x46281c;});}return _0x52e648;})[_0xaebd('0x1e')](respondWithResult(_0x45bc25,0xc9))['catch'](handleError(_0x45bc25,null));};exports['update']=function(_0x2583a7,_0x2daffc){if(_0x2583a7[_0xaebd('0x43')]['id']){delete _0x2583a7[_0xaebd('0x43')]['id'];}return db[_0xaebd('0x26')][_0xaebd('0x47')]({'where':{'id':_0x2583a7['params']['id']}})['then'](handleEntityNotFound(_0x2daffc,null))['then'](saveUpdates(_0x2583a7['body'],null))['then'](respondWithResult(_0x2daffc,null))[_0xaebd('0x3f')](handleError(_0x2daffc,null));};exports[_0xaebd('0x1f')]=function(_0x5ce661,_0x23e888){return db[_0xaebd('0x26')][_0xaebd('0x47')]({'where':{'id':_0x5ce661[_0xaebd('0x41')]['id']}})['then'](handleEntityNotFound(_0x23e888,null))[_0xaebd('0x1e')](removeEntity(_0x23e888,null))[_0xaebd('0x3f')](handleError(_0x23e888,null));};exports[_0xaebd('0x4b')]=function(_0x8dd166,_0xe15a76,_0x592b8e){if(_0x8dd166['body']['id']){delete _0x8dd166[_0xaebd('0x43')]['id'];}return db[_0xaebd('0x26')][_0xaebd('0x47')]({'where':{'id':_0x8dd166[_0xaebd('0x41')]['id']}})[_0xaebd('0x1e')](handleEntityNotFound(_0xe15a76,null))[_0xaebd('0x1e')](function(_0x20dc2f){if(_0x20dc2f){_0x8dd166[_0xaebd('0x43')][_0xaebd('0x4c')]=_0x20dc2f['id'];return db[_0xaebd('0x26')][_0xaebd('0x49')](_0x8dd166[_0xaebd('0x43')]);}})[_0xaebd('0x1e')](respondWithResult(_0xe15a76,null))[_0xaebd('0x3f')](handleError(_0xe15a76,null));};exports[_0xaebd('0x4d')]=function(_0x57abd3,_0x230f1f,_0x5f0f9f){var _0x3ee4d5={};var _0x3e8bce={};var _0x16803c;var _0x53c2ec;return db[_0xaebd('0x26')]['findOne']({'where':{'id':_0x57abd3[_0xaebd('0x41')]['id']}})[_0xaebd('0x1e')](handleEntityNotFound(_0x230f1f,null))['then'](function(_0x5780cc){if(_0x5780cc){_0x16803c=_0x5780cc;_0x3e8bce[_0xaebd('0x28')]=_[_0xaebd('0x29')](db[_0xaebd('0x26')][_0xaebd('0x27')]);_0x3e8bce[_0xaebd('0x2a')]=_[_0xaebd('0x29')](_0x57abd3[_0xaebd('0x2a')]);_0x3e8bce['filters']=_['intersection'](_0x3e8bce[_0xaebd('0x28')],_0x3e8bce[_0xaebd('0x2a')]);_0x3ee4d5[_0xaebd('0x2c')]=_['intersection'](_0x3e8bce[_0xaebd('0x28')],qs[_0xaebd('0x2e')](_0x57abd3['query'][_0xaebd('0x2e')]));_0x3ee4d5[_0xaebd('0x2c')]=_0x3ee4d5[_0xaebd('0x2c')][_0xaebd('0x2f')]?_0x3ee4d5['attributes']:_0x3e8bce[_0xaebd('0x28')];_0x3ee4d5[_0xaebd('0x33')]=qs[_0xaebd('0x4e')](_0x57abd3[_0xaebd('0x2a')][_0xaebd('0x4e')]);_0x3ee4d5[_0xaebd('0x36')]=qs['filters'](_['pick'](_0x57abd3['query'],_0x3e8bce[_0xaebd('0x2b')]));if(_0x57abd3[_0xaebd('0x2a')][_0xaebd('0x35')]){_0x3ee4d5[_0xaebd('0x36')]=_[_0xaebd('0x37')](_0x3ee4d5[_0xaebd('0x36')],{'$or':_['map'](_0x3ee4d5[_0xaebd('0x2c')],function(_0x36e9d5){var _0x1a0e2a={};_0x1a0e2a[_0x36e9d5]={'$like':'%'+_0x57abd3[_0xaebd('0x2a')]['filter']+'%'};return _0x1a0e2a;})});}_0x3ee4d5=_[_0xaebd('0x37')]({},_0x3ee4d5,_0x57abd3['options']);return _0x16803c[_0xaebd('0x4d')](_0x3ee4d5);}})[_0xaebd('0x1e')](function(_0x196670){if(_0x196670){_0x53c2ec=_0x196670[_0xaebd('0x2f')];if(!_0x57abd3[_0xaebd('0x2a')][_0xaebd('0x30')](_0xaebd('0x31'))){_0x3ee4d5['limit']=qs[_0xaebd('0x19')](_0x57abd3[_0xaebd('0x2a')][_0xaebd('0x19')]);_0x3ee4d5['offset']=qs[_0xaebd('0x32')](_0x57abd3[_0xaebd('0x2a')][_0xaebd('0x32')]);}return _0x16803c[_0xaebd('0x4d')](_0x3ee4d5);}})[_0xaebd('0x1e')](function(_0x3b4403){if(_0x3b4403){return _0x3b4403?{'count':_0x53c2ec,'rows':_0x3b4403}:null;}})[_0xaebd('0x1e')](respondWithResult(_0x230f1f,null))[_0xaebd('0x3f')](handleError(_0x230f1f,null));};exports[_0xaebd('0x4f')]=function(_0x59fafc,_0x388559,_0x1a9225){return db[_0xaebd('0x26')][_0xaebd('0x50')]({'where':{'id':_0x59fafc[_0xaebd('0x41')]['id']}})[_0xaebd('0x1e')](handleEntityNotFound(_0x388559,null))[_0xaebd('0x1e')](function(_0x9d31f7){if(_0x9d31f7){return db[_0xaebd('0x51')][_0xaebd('0x52')](function(_0x4c1264){return db[_0xaebd('0x26')][_0xaebd('0x1f')]({'where':{'IntervalId':_0x59fafc[_0xaebd('0x41')]['id']},'transaction':_0x4c1264})['then'](function(_0x4cc696){var _0x548025=_[_0xaebd('0x38')](_0x59fafc['body'],function(_0x3c81ad){delete _0x3c81ad['id'];_0x3c81ad['IntervalId']=_0x59fafc[_0xaebd('0x41')]['id'];return _0x3c81ad;});return db['Interval'][_0xaebd('0x53')](_0x548025,{'transaction':_0x4c1264});});})[_0xaebd('0x1e')](function(){return db[_0xaebd('0x26')][_0xaebd('0x3d')]({'where':{'IntervalId':_0x59fafc['params']['id']}});});}})['then'](respondWithResult(_0x388559,null))[_0xaebd('0x3f')](handleError(_0x388559,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index c18b53a..5fe804b 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 _0x362b=['request-promise','./interval.attributes','../../components/extensions/rewrite','exports','define','tools_intervals','rewrite','lodash','util','api','moment','bluebird'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x362b,0x1c3));var _0xb362=function(_0x441731,_0x26ff7d){_0x441731=_0x441731-0x0;var _0x29a802=_0x362b[_0x441731];return _0x29a802;};'use strict';var _=require(_0xb362('0x0'));var util=require(_0xb362('0x1'));var logger=require('../../config/logger')(_0xb362('0x2'));var moment=require(_0xb362('0x3'));var BPromise=require(_0xb362('0x4'));var rp=require(_0xb362('0x5'));var attributes=require(_0xb362('0x6'));var extensions=require(_0xb362('0x7'));module[_0xb362('0x8')]=function(_0x568945,_0x4dcd0a){return _0x568945[_0xb362('0x9')]('Interval',attributes,{'tableName':_0xb362('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b5827,_0x39690d){extensions[_0xb362('0xb')](_0x568945,_0x2b5827);},'afterBulkCreate':function(_0x3c8ea3,_0x5f76d,_0x300bae){_0x300bae();extensions[_0xb362('0xb')](_0x568945,_0x3c8ea3[0x0]);},'afterUpdate':function(_0x4eb369,_0x28d61d){extensions[_0xb362('0xb')](_0x568945,_0x4eb369);},'afterDestroy':function(_0x5574de,_0x25d2e2){extensions[_0xb362('0xb')](_0x568945,_0x5574de);}}});}; \ No newline at end of file +var _0x0035=['tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval'];(function(_0x17c49e,_0xe13e37){var _0x40b293=function(_0x38266e){while(--_0x38266e){_0x17c49e['push'](_0x17c49e['shift']());}};_0x40b293(++_0xe13e37);}(_0x0035,0x18a));var _0x5003=function(_0x1428d9,_0xded63c){_0x1428d9=_0x1428d9-0x0;var _0x438019=_0x0035[_0x1428d9];return _0x438019;};'use strict';var _=require(_0x5003('0x0'));var util=require(_0x5003('0x1'));var logger=require(_0x5003('0x2'))(_0x5003('0x3'));var moment=require(_0x5003('0x4'));var BPromise=require(_0x5003('0x5'));var rp=require(_0x5003('0x6'));var attributes=require(_0x5003('0x7'));var extensions=require(_0x5003('0x8'));module[_0x5003('0x9')]=function(_0x235210,_0x5c27d4){return _0x235210[_0x5003('0xa')](_0x5003('0xb'),attributes,{'tableName':_0x5003('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x54fd99,_0x9e68e7){extensions[_0x5003('0xd')](_0x235210,_0x54fd99);},'afterBulkCreate':function(_0x10cc2d,_0x3861cb,_0x51a240){_0x51a240();extensions[_0x5003('0xd')](_0x235210,_0x10cc2d[0x0]);},'afterUpdate':function(_0x2ff1a4,_0x55cc14){extensions[_0x5003('0xd')](_0x235210,_0x2ff1a4);},'afterDestroy':function(_0x318204,_0x1c1d95){extensions[_0x5003('0xd')](_0x235210,_0x318204);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index c396c31..cf73568 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 _0xac9d=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Interval','findAll','options','where','attributes','limit','include','map','model','GetInterval','ShowInterval','find','raw'];(function(_0x17fc74,_0x16cb66){var _0x5d4b1b=function(_0x1dc2f0){while(--_0x1dc2f0){_0x17fc74['push'](_0x17fc74['shift']());}};_0x5d4b1b(++_0x16cb66);}(_0xac9d,0x14d));var _0xdac9=function(_0x224f65,_0x4750bf){_0x224f65=_0x224f65-0x0;var _0x3f921c=_0xac9d[_0x224f65];return _0x3f921c;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var rs=require(_0xdac9('0x4'));var fs=require('fs');var Redis=require(_0xdac9('0x5'));var db=require(_0xdac9('0x6'))['db'];var utils=require(_0xdac9('0x7'));var logger=require('../../config/logger')(_0xdac9('0x8'));var config=require('../../config/environment');var jayson=require(_0xdac9('0x9'));var client=jayson[_0xdac9('0xa')][_0xdac9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x776b6c,_0x1c78c5,_0x39f560){return new BPromise(function(_0x5531af,_0x2b1d6f){return client['request'](_0x776b6c,_0x39f560)[_0xdac9('0xc')](function(_0x3a013b){logger[_0xdac9('0xd')](_0xdac9('0xe'),_0x1c78c5,_0xdac9('0xf'));logger[_0xdac9('0x10')](_0xdac9('0x11'),_0x1c78c5,_0xdac9('0xf'),JSON[_0xdac9('0x12')](_0x3a013b));if(_0x3a013b['error']){if(_0x3a013b[_0xdac9('0x13')][_0xdac9('0x14')]===0x1f4){logger['error'](_0xdac9('0xe'),_0x1c78c5,_0x3a013b[_0xdac9('0x13')][_0xdac9('0x15')]);return _0x2b1d6f(_0x3a013b['error'][_0xdac9('0x15')]);}logger[_0xdac9('0x13')](_0xdac9('0xe'),_0x1c78c5,_0x3a013b['error']['message']);return _0x5531af(_0x3a013b[_0xdac9('0x13')][_0xdac9('0x15')]);}else{logger['info'](_0xdac9('0xe'),_0x1c78c5,_0xdac9('0xf'));_0x5531af(_0x3a013b[_0xdac9('0x16')][_0xdac9('0x15')]);}})[_0xdac9('0x17')](function(_0x393acc){logger[_0xdac9('0x13')](_0xdac9('0xe'),_0x1c78c5,_0x393acc);_0x2b1d6f(_0x393acc);});});}exports['GetInterval']=function(_0x283343){var _0x36b817=this;return new Promise(function(_0x571e07,_0x1cd239){return db[_0xdac9('0x18')][_0xdac9('0x19')]({'raw':_0x283343[_0xdac9('0x1a')]?_0x283343['options']['raw']===undefined?!![]:![]:!![],'where':_0x283343[_0xdac9('0x1a')]?_0x283343[_0xdac9('0x1a')][_0xdac9('0x1b')]||null:null,'attributes':_0x283343[_0xdac9('0x1a')]?_0x283343['options'][_0xdac9('0x1c')]||null:null,'limit':_0x283343[_0xdac9('0x1a')]?_0x283343[_0xdac9('0x1a')][_0xdac9('0x1d')]||null:null,'include':_0x283343[_0xdac9('0x1a')]?_0x283343[_0xdac9('0x1a')][_0xdac9('0x1e')]?_[_0xdac9('0x1f')](_0x283343[_0xdac9('0x1a')][_0xdac9('0x1e')],function(_0x5a0fa2){return{'model':db[_0x5a0fa2[_0xdac9('0x20')]],'as':_0x5a0fa2['as'],'attributes':_0x5a0fa2[_0xdac9('0x1c')],'include':_0x5a0fa2[_0xdac9('0x1e')]?_[_0xdac9('0x1f')](_0x5a0fa2['include'],function(_0x1e631a){return{'model':db[_0x1e631a['model']],'as':_0x1e631a['as'],'attributes':_0x1e631a[_0xdac9('0x1c')],'include':_0x1e631a[_0xdac9('0x1e')]?_['map'](_0x1e631a[_0xdac9('0x1e')],function(_0x5105f1){return{'model':db[_0x5105f1[_0xdac9('0x20')]],'as':_0x5105f1['as'],'attributes':_0x5105f1[_0xdac9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xdac9('0xc')](function(_0xfe4468){logger['info']('GetInterval',_0x283343);logger[_0xdac9('0x10')](_0xdac9('0x21'),_0x283343,JSON['stringify'](_0xfe4468));_0x571e07(_0xfe4468);})['catch'](function(_0x3eed7a){logger[_0xdac9('0x13')](_0xdac9('0x21'),_0x3eed7a[_0xdac9('0x15')],_0x283343);_0x1cd239(_0x36b817[_0xdac9('0x13')](0x1f4,_0x3eed7a[_0xdac9('0x15')]));});});};exports[_0xdac9('0x22')]=function(_0x2cda4d){var _0x406ed0=this;return new Promise(function(_0x2f36f4,_0xb49c21){return db[_0xdac9('0x18')][_0xdac9('0x23')]({'raw':_0x2cda4d[_0xdac9('0x1a')]?_0x2cda4d[_0xdac9('0x1a')][_0xdac9('0x24')]===undefined?!![]:![]:!![],'where':_0x2cda4d[_0xdac9('0x1a')]?_0x2cda4d[_0xdac9('0x1a')][_0xdac9('0x1b')]||null:null,'attributes':_0x2cda4d[_0xdac9('0x1a')]?_0x2cda4d[_0xdac9('0x1a')]['attributes']||null:null,'include':_0x2cda4d['options']?_0x2cda4d[_0xdac9('0x1a')][_0xdac9('0x1e')]?_[_0xdac9('0x1f')](_0x2cda4d[_0xdac9('0x1a')][_0xdac9('0x1e')],function(_0x49d59f){return{'model':db[_0x49d59f[_0xdac9('0x20')]],'as':_0x49d59f['as'],'attributes':_0x49d59f['attributes'],'include':_0x49d59f[_0xdac9('0x1e')]?_[_0xdac9('0x1f')](_0x49d59f['include'],function(_0x241674){return{'model':db[_0x241674['model']],'as':_0x241674['as'],'attributes':_0x241674['attributes'],'include':_0x241674[_0xdac9('0x1e')]?_[_0xdac9('0x1f')](_0x241674[_0xdac9('0x1e')],function(_0x2caa04){return{'model':db[_0x2caa04[_0xdac9('0x20')]],'as':_0x2caa04['as'],'attributes':_0x2caa04[_0xdac9('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x265975){logger[_0xdac9('0xd')]('ShowInterval',_0x2cda4d);logger[_0xdac9('0x10')](_0xdac9('0x22'),_0x2cda4d,JSON[_0xdac9('0x12')](_0x265975));_0x2f36f4(_0x265975);})[_0xdac9('0x17')](function(_0x35aa58){logger[_0xdac9('0x13')](_0xdac9('0x22'),_0x35aa58['message'],_0x2cda4d);_0xb49c21(_0x406ed0[_0xdac9('0x13')](0x1f4,_0x35aa58[_0xdac9('0x15')]));});});}; \ No newline at end of file +var _0xed1f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Interval,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','GetInterval','Interval','options','attributes','limit','include','map','model','ShowInterval','find','raw','where','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x48e484,_0x250b8f){var _0xa63f63=function(_0x396e61){while(--_0x396e61){_0x48e484['push'](_0x48e484['shift']());}};_0xa63f63(++_0x250b8f);}(_0xed1f,0x6a));var _0xfed1=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0xed1f[_0x2080a3];return _0x8d7d17;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x380e18,_0x612b38,_0x2a6082){return new BPromise(function(_0x2967ef,_0x568d48){return client[_0xfed1('0xe')](_0x380e18,_0x2a6082)[_0xfed1('0xf')](function(_0x48862d){logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,'request\x20sent');logger[_0xfed1('0x12')]('Interval,\x20%s,\x20%s,\x20%s',_0x612b38,_0xfed1('0x13'),JSON[_0xfed1('0x14')](_0x48862d));if(_0x48862d['error']){if(_0x48862d['error'][_0xfed1('0x15')]===0x1f4){logger[_0xfed1('0x16')]('Interval,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x568d48(_0x48862d['error'][_0xfed1('0x17')]);}logger[_0xfed1('0x16')]('Interval,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x2967ef(_0x48862d['error'][_0xfed1('0x17')]);}else{logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,_0xfed1('0x13'));_0x2967ef(_0x48862d['result'][_0xfed1('0x17')]);}})['catch'](function(_0x36ff34){logger[_0xfed1('0x16')]('Interval,\x20%s,\x20%s',_0x612b38,_0x36ff34);_0x568d48(_0x36ff34);});});}exports[_0xfed1('0x18')]=function(_0xa72a20){var _0x5c0d9f=this;return new Promise(function(_0x59509b,_0x586ea6){return db[_0xfed1('0x19')]['findAll']({'raw':_0xa72a20[_0xfed1('0x1a')]?_0xa72a20[_0xfed1('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xa72a20[_0xfed1('0x1a')]?_0xa72a20[_0xfed1('0x1a')]['where']||null:null,'attributes':_0xa72a20[_0xfed1('0x1a')]?_0xa72a20[_0xfed1('0x1a')][_0xfed1('0x1b')]||null:null,'limit':_0xa72a20[_0xfed1('0x1a')]?_0xa72a20['options'][_0xfed1('0x1c')]||null:null,'include':_0xa72a20['options']?_0xa72a20[_0xfed1('0x1a')][_0xfed1('0x1d')]?_[_0xfed1('0x1e')](_0xa72a20['options'][_0xfed1('0x1d')],function(_0x594917){return{'model':db[_0x594917[_0xfed1('0x1f')]],'as':_0x594917['as'],'attributes':_0x594917[_0xfed1('0x1b')],'include':_0x594917[_0xfed1('0x1d')]?_[_0xfed1('0x1e')](_0x594917[_0xfed1('0x1d')],function(_0x1199b7){return{'model':db[_0x1199b7['model']],'as':_0x1199b7['as'],'attributes':_0x1199b7[_0xfed1('0x1b')],'include':_0x1199b7[_0xfed1('0x1d')]?_['map'](_0x1199b7[_0xfed1('0x1d')],function(_0x2b9dd2){return{'model':db[_0x2b9dd2[_0xfed1('0x1f')]],'as':_0x2b9dd2['as'],'attributes':_0x2b9dd2[_0xfed1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfed1('0xf')](function(_0x1761d1){logger['info'](_0xfed1('0x18'),_0xa72a20);logger['debug'](_0xfed1('0x18'),_0xa72a20,JSON['stringify'](_0x1761d1));_0x59509b(_0x1761d1);})['catch'](function(_0x1cec64){logger[_0xfed1('0x16')](_0xfed1('0x18'),_0x1cec64['message'],_0xa72a20);_0x586ea6(_0x5c0d9f[_0xfed1('0x16')](0x1f4,_0x1cec64[_0xfed1('0x17')]));});});};exports[_0xfed1('0x20')]=function(_0x383955){var _0x12399f=this;return new Promise(function(_0x30272b,_0x5ccc3a){return db[_0xfed1('0x19')][_0xfed1('0x21')]({'raw':_0x383955['options']?_0x383955['options'][_0xfed1('0x22')]===undefined?!![]:![]:!![],'where':_0x383955[_0xfed1('0x1a')]?_0x383955[_0xfed1('0x1a')][_0xfed1('0x23')]||null:null,'attributes':_0x383955[_0xfed1('0x1a')]?_0x383955['options'][_0xfed1('0x1b')]||null:null,'include':_0x383955[_0xfed1('0x1a')]?_0x383955[_0xfed1('0x1a')][_0xfed1('0x1d')]?_[_0xfed1('0x1e')](_0x383955['options'][_0xfed1('0x1d')],function(_0x4a81be){return{'model':db[_0x4a81be[_0xfed1('0x1f')]],'as':_0x4a81be['as'],'attributes':_0x4a81be[_0xfed1('0x1b')],'include':_0x4a81be[_0xfed1('0x1d')]?_[_0xfed1('0x1e')](_0x4a81be[_0xfed1('0x1d')],function(_0x1f5dcf){return{'model':db[_0x1f5dcf[_0xfed1('0x1f')]],'as':_0x1f5dcf['as'],'attributes':_0x1f5dcf[_0xfed1('0x1b')],'include':_0x1f5dcf['include']?_[_0xfed1('0x1e')](_0x1f5dcf[_0xfed1('0x1d')],function(_0x45f106){return{'model':db[_0x45f106[_0xfed1('0x1f')]],'as':_0x45f106['as'],'attributes':_0x45f106['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x42d5df){logger[_0xfed1('0x10')](_0xfed1('0x20'),_0x383955);logger[_0xfed1('0x12')](_0xfed1('0x20'),_0x383955,JSON[_0xfed1('0x14')](_0x42d5df));_0x30272b(_0x42d5df);})[_0xfed1('0x24')](function(_0x2f183c){logger['error']('ShowInterval',_0x2f183c[_0xfed1('0x17')],_0x383955);_0x5ccc3a(_0x12399f[_0xfed1('0x16')](0x1f4,_0x2f183c['message']));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 6e3baa3..3e74e27 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 _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x4ca72d,_0x242840){var _0x3ec55a=function(_0x530a09){while(--_0x530a09){_0x4ca72d['push'](_0x4ca72d['shift']());}};_0x3ec55a(++_0x242840);}(_0xdb28,0x106));var _0x8db2=function(_0x29d35c,_0x5b9091){_0x29d35c=_0x29d35c-0x0;var _0x2d9569=_0xdb28[_0x29d35c];return _0x2d9569;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x17eef6,_0x54f9be){var _0x16837c=function(_0x37ad3f){while(--_0x37ad3f){_0x17eef6['push'](_0x17eef6['shift']());}};_0x16837c(++_0x54f9be);}(_0x2032,0xd9));var _0x2203=function(_0x4a5d84,_0x542f3c){_0x4a5d84=_0x4a5d84-0x0;var _0x4d3959=_0x2032[_0x4a5d84];return _0x4d3959;};'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 diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 5f3d52a..2fac293 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 _0xa9e0=['Basic\x20','toString','base64','utf8','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','send','body','connection','remoteAddress','socket','bluebird','https','../../config/logger','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','description','stringify','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json'];(function(_0x23c827,_0x37332a){var _0x3d7f1f=function(_0x3ff0f2){while(--_0x3ff0f2){_0x23c827['push'](_0x23c827['shift']());}};_0x3d7f1f(++_0x37332a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0x0a9e('0x0'));var https=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var USERNAME='support';var PASSWORD=_0x0a9e('0x3');function openIssue(_0x4ce2f1,_0x333808){var _0x432180={'fields':{'project':{'key':_0x4ce2f1[_0x0a9e('0x4')]||_0x0a9e('0x5')},'summary':(_0x4ce2f1[_0x0a9e('0x6')]||'Report')+_0x0a9e('0x7')+_0x4ce2f1['ip'],'description':_0x4ce2f1[_0x0a9e('0x8')]||JSON[_0x0a9e('0x9')](_0x4ce2f1),'issuetype':{'name':_0x4ce2f1['issuetype']||'Bug'}}};_0x432180[_0x0a9e('0xa')]['customfield_11500']=_0x4ce2f1['email'];_0x432180[_0x0a9e('0xa')][_0x0a9e('0xb')]=_0x4ce2f1[_0x0a9e('0xc')];_0x432180[_0x0a9e('0xa')][_0x0a9e('0xd')]=_0x4ce2f1[_0x0a9e('0xe')];_0x432180['fields']['customfield_11503']=_0x4ce2f1['name'];_0x432180['fields'][_0x0a9e('0xf')]=_0x4ce2f1[_0x0a9e('0x10')];_0x432180[_0x0a9e('0xa')][_0x0a9e('0x11')]=_0x4ce2f1['ip'];var _0x32d742={'host':_0x0a9e('0x12'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x0a9e('0x13'),'timeout':0x4e20,'headers':{'Content-Type':_0x0a9e('0x14'),'Authorization':_0x0a9e('0x15')+new Buffer(USERNAME+':'+PASSWORD)[_0x0a9e('0x16')](_0x0a9e('0x17'))}};var _0x4d5611=JSON['stringify'](_0x432180);var _0x22dccb=https['request'](_0x32d742,function(_0x1985b6){_0x1985b6['setEncoding'](_0x0a9e('0x18'));var _0x12066b='';_0x1985b6['on']('data',function(_0x225616){_0x12066b+=_0x225616;});_0x1985b6['on']('end',function(){if(_0x333808){return _0x333808[_0x0a9e('0x19')](_0x1985b6[_0x0a9e('0x1a')])[_0x0a9e('0x1b')](JSON[_0x0a9e('0x1c')](_0x12066b));}});});_0x22dccb['on'](_0x0a9e('0x1d'),function(_0x2eb11f){if(_0x333808){return _0x333808[_0x0a9e('0x19')](0x1f4)[_0x0a9e('0x1b')]({'errors':[{'message':_0x0a9e('0x1e'),'type':_0x0a9e('0x1f')}]});}});_0x22dccb[_0x0a9e('0x20')](_0x4d5611);_0x22dccb[_0x0a9e('0x21')]();}exports['openIssue']=openIssue;exports[_0x0a9e('0x22')]=function(_0x155cce,_0x53682f){_0x155cce[_0x0a9e('0x23')]['ip']=_0x155cce['headers']['x-forwarded-for']||_0x155cce[_0x0a9e('0x24')][_0x0a9e('0x25')]||_0x155cce[_0x0a9e('0x26')][_0x0a9e('0x25')]||_0x155cce['connection'][_0x0a9e('0x26')][_0x0a9e('0x25')];return openIssue(_0x155cce[_0x0a9e('0x23')],_0x53682f);}; \ No newline at end of file +var _0xb7e7=['reason','track.xcallymotion.com','POST','toString','base64','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','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','../../config/logger','support','key','MOTGUI','\x20from\x20','description','stringify','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xb7e7[_0x2f5ac5];return _0x37c9a8;};'use strict';var BPromise=require(_0x7b7e('0x0'));var https=require('https');var logger=require(_0x7b7e('0x1'))('api');var USERNAME=_0x7b7e('0x2');var PASSWORD='3eAmWpBVP0';function openIssue(_0x3f5804,_0x556d68){var _0x31d0ed={'fields':{'project':{'key':_0x3f5804[_0x7b7e('0x3')]||_0x7b7e('0x4')},'summary':(_0x3f5804['summary']||'Report')+_0x7b7e('0x5')+_0x3f5804['ip'],'description':_0x3f5804[_0x7b7e('0x6')]||JSON[_0x7b7e('0x7')](_0x3f5804),'issuetype':{'name':_0x3f5804['issuetype']||_0x7b7e('0x8')}}};_0x31d0ed[_0x7b7e('0x9')][_0x7b7e('0xa')]=_0x3f5804[_0x7b7e('0xb')];_0x31d0ed[_0x7b7e('0x9')][_0x7b7e('0xc')]=_0x3f5804[_0x7b7e('0xd')];_0x31d0ed['fields'][_0x7b7e('0xe')]=_0x3f5804[_0x7b7e('0xf')];_0x31d0ed[_0x7b7e('0x9')][_0x7b7e('0x10')]=_0x3f5804[_0x7b7e('0x11')];_0x31d0ed[_0x7b7e('0x9')][_0x7b7e('0x12')]=_0x3f5804[_0x7b7e('0x13')];_0x31d0ed[_0x7b7e('0x9')]['customfield_10102']=_0x3f5804['ip'];var _0x267446={'host':_0x7b7e('0x14'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x7b7e('0x15'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x7b7e('0x16')](_0x7b7e('0x17'))}};var _0xf067da=JSON[_0x7b7e('0x7')](_0x31d0ed);var _0x3d2fb2=https['request'](_0x267446,function(_0x51baf6){_0x51baf6[_0x7b7e('0x18')](_0x7b7e('0x19'));var _0x27f999='';_0x51baf6['on'](_0x7b7e('0x1a'),function(_0x2cc400){_0x27f999+=_0x2cc400;});_0x51baf6['on'](_0x7b7e('0x1b'),function(){if(_0x556d68){return _0x556d68[_0x7b7e('0x1c')](_0x51baf6[_0x7b7e('0x1d')])[_0x7b7e('0x1e')](JSON[_0x7b7e('0x1f')](_0x27f999));}});});_0x3d2fb2['on'](_0x7b7e('0x20'),function(_0x14f4fe){if(_0x556d68){return _0x556d68[_0x7b7e('0x1c')](0x1f4)[_0x7b7e('0x1e')]({'errors':[{'message':_0x7b7e('0x21'),'type':_0x7b7e('0x22')}]});}});_0x3d2fb2[_0x7b7e('0x23')](_0xf067da);_0x3d2fb2['end']();}exports[_0x7b7e('0x24')]=openIssue;exports[_0x7b7e('0x25')]=function(_0x24718c,_0x4c0647){_0x24718c[_0x7b7e('0x26')]['ip']=_0x24718c[_0x7b7e('0x27')][_0x7b7e('0x28')]||_0x24718c[_0x7b7e('0x29')][_0x7b7e('0x2a')]||_0x24718c[_0x7b7e('0x2b')][_0x7b7e('0x2a')]||_0x24718c[_0x7b7e('0x29')]['socket']['remoteAddress'];return openIssue(_0x24718c['body'],_0x4c0647);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index b8bd93b..e3156a0 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 _0x8de9=['update','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','./jscriptyAnswerReport.controller','get','/describe','describe','isAuthenticated','show','create','put'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8de9,0x153));var _0x98de=function(_0x2b48c1,_0x1e4952){_0x2b48c1=_0x2b48c1-0x0;var _0x4088c7=_0x8de9[_0x2b48c1];return _0x4088c7;};'use strict';var multer=require(_0x98de('0x0'));var util=require('util');var path=require(_0x98de('0x1'));var timeout=require(_0x98de('0x2'));var express=require(_0x98de('0x3'));var router=express['Router']();var auth=require(_0x98de('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x98de('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x98de('0x6')](_0x98de('0x7'),auth['isAuthenticated'](),controller[_0x98de('0x8')]);router[_0x98de('0x6')]('/:id',auth[_0x98de('0x9')](),controller[_0x98de('0xa')]);router['post']('/',auth[_0x98de('0x9')](),controller[_0x98de('0xb')]);router[_0x98de('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x98de('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x98de('0xe')]);module[_0x98de('0xf')]=router; \ No newline at end of file +var _0xb2c9=['update','delete','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x292903,_0x2ceba2){var _0x5aef6b=function(_0x169a54){while(--_0x169a54){_0x292903['push'](_0x292903['shift']());}};_0x5aef6b(++_0x2ceba2);}(_0xb2c9,0x9b));var _0x9b2c=function(_0x140b08,_0x499ded){_0x140b08=_0x140b08-0x0;var _0x37d020=_0xb2c9[_0x140b08];return _0x37d020;};'use strict';var multer=require(_0x9b2c('0x0'));var util=require(_0x9b2c('0x1'));var path=require('path');var timeout=require(_0x9b2c('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x9b2c('0x3'));var interaction=require(_0x9b2c('0x4'));var config=require(_0x9b2c('0x5'));var controller=require('./jscriptyAnswerReport.controller');router[_0x9b2c('0x6')]('/',auth[_0x9b2c('0x7')](),controller[_0x9b2c('0x8')]);router['get'](_0x9b2c('0x9'),auth[_0x9b2c('0x7')](),controller[_0x9b2c('0xa')]);router['get'](_0x9b2c('0xb'),auth['isAuthenticated'](),controller[_0x9b2c('0xc')]);router[_0x9b2c('0xd')]('/',auth['isAuthenticated'](),controller[_0x9b2c('0xe')]);router[_0x9b2c('0xf')]('/:id',auth[_0x9b2c('0x7')](),controller[_0x9b2c('0x10')]);router[_0x9b2c('0x11')](_0x9b2c('0xb'),auth[_0x9b2c('0x7')](),controller['destroy']);module[_0x9b2c('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 c3d3a18..738d41b 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 _0xfdb5=['exports','STRING','long','sequelize'];(function(_0x5a363d,_0x55e488){var _0x5a8c6d=function(_0x58ef74){while(--_0x58ef74){_0x5a363d['push'](_0x5a363d['shift']());}};_0x5a8c6d(++_0x55e488);}(_0xfdb5,0x12f));var _0x5fdb=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xfdb5[_0x411017];return _0x2adeea;};'use strict';var Sequelize=require(_0x5fdb('0x0'));module[_0x5fdb('0x1')]={'question':{'type':Sequelize[_0x5fdb('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x5fdb('0x3'))},'membername':{'type':Sequelize[_0x5fdb('0x2')]},'projectname':{'type':Sequelize[_0x5fdb('0x2')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5fdb('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x5fdb('0x2')]}}; \ No newline at end of file +var _0x90ae=['long','sequelize','exports','STRING'];(function(_0x592b51,_0x167cbc){var _0x10f8fe=function(_0xe2ec8e){while(--_0xe2ec8e){_0x592b51['push'](_0x592b51['shift']());}};_0x10f8fe(++_0x167cbc);}(_0x90ae,0x195));var _0xe90a=function(_0xb4fedc,_0x4b2389){_0xb4fedc=_0xb4fedc-0x0;var _0x59f250=_0x90ae[_0xb4fedc];return _0x59f250;};'use strict';var Sequelize=require(_0xe90a('0x0'));module[_0xe90a('0x1')]={'question':{'type':Sequelize[_0xe90a('0x2')]},'answer':{'type':Sequelize['TEXT'](_0xe90a('0x3'))},'membername':{'type':Sequelize[_0xe90a('0x2')]},'projectname':{'type':Sequelize[_0xe90a('0x2')]},'queue':{'type':Sequelize[_0xe90a('0x2')]},'uniqueid':{'type':Sequelize[_0xe90a('0x2')]},'calleridname':{'type':Sequelize[_0xe90a('0x2')]},'calleridnum':{'type':Sequelize[_0xe90a('0x2')]},'questionId':{'type':Sequelize[_0xe90a('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index d8fcfe2..aa169d3 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 _0x7a54=['mustache','util','path','sox','ejs','squel','crypto','desk.js','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','index','JscriptyAnswerReport','rawAttributes','model','keys','query','filters','attributes','intersection','fields','offset','sort','where','filter','merge','map','type','key','VIRTUAL','field','options','include','rows','catch','show','params','length','includeAll','create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird'];(function(_0x30a5e,_0x3b29d8){var _0x1fb0e5=function(_0x3f5171){while(--_0x3f5171){_0x30a5e['push'](_0x30a5e['shift']());}};_0x1fb0e5(++_0x3b29d8);}(_0x7a54,0x106));var _0x47a5=function(_0x47cb39,_0x5f0a96){_0x47cb39=_0x47cb39-0x0;var _0x7b7c12=_0x7a54[_0x47cb39];return _0x7b7c12;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x47a5('0xe'));var hardwareService=require(_0x47a5('0xf'));var Redis=require('ioredis');var qs=require(_0x47a5('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x47a5('0x11'));var config=require(_0x47a5('0x12'));var db=require(_0x47a5('0x13'))['db'];function respondWithStatusCode(_0x250fad,_0xd612dd){_0xd612dd=_0xd612dd||0xcc;return function(_0xd308b8){if(_0xd308b8){return _0x250fad[_0x47a5('0x14')](_0xd612dd);}return _0x250fad['status'](_0xd612dd)[_0x47a5('0x15')]();};}function respondWithResult(_0x221b54,_0x1cf309){_0x1cf309=_0x1cf309||0xc8;return function(_0x711793){if(_0x711793){return _0x221b54[_0x47a5('0x16')](_0x1cf309)[_0x47a5('0x17')](_0x711793);}};}function respondWithFilteredResult(_0x3c6c46,_0x190faa){return function(_0x4e99a8){if(_0x4e99a8){var _0x362359=_0x4e99a8[_0x47a5('0x18')],_0x11faf5=_0x190faa['offset'],_0x3b001e=_0x190faa['offset']+_0x190faa[_0x47a5('0x19')],_0x2a2cbb;if(_0x3b001e>=_0x362359){_0x3b001e=_0x362359;_0x2a2cbb=0xc8;}else{_0x2a2cbb=0xce;}_0x3c6c46['status'](_0x2a2cbb);return _0x3c6c46['set'](_0x47a5('0x1a'),_0x11faf5+'-'+_0x3b001e+'/'+_0x362359)[_0x47a5('0x17')](_0x4e99a8);}return null;};}function patchUpdates(_0x2ce454){return function(_0x1ef371){try{jsonpatch[_0x47a5('0x1b')](_0x1ef371,_0x2ce454,!![]);}catch(_0x12b98e){return BPromise[_0x47a5('0x1c')](_0x12b98e);}return _0x1ef371[_0x47a5('0x1d')]();};}function saveUpdates(_0x3aed38,_0x4a9fcb){return function(_0x1570bc){if(_0x1570bc){return _0x1570bc[_0x47a5('0x1e')](_0x3aed38)['then'](function(_0x2b0360){return _0x2b0360;});}return null;};}function removeEntity(_0x1f03f7,_0x36874d){return function(_0x4c5910){if(_0x4c5910){return _0x4c5910[_0x47a5('0x1f')]()[_0x47a5('0x20')](function(){_0x1f03f7[_0x47a5('0x16')](0xcc)[_0x47a5('0x15')]();});}};}function handleEntityNotFound(_0x5ef1b1,_0xe2dea9){return function(_0x385687){if(!_0x385687){_0x5ef1b1['sendStatus'](0x194);}return _0x385687;};}function handleError(_0x28747d,_0xc4cd63){_0xc4cd63=_0xc4cd63||0x1f4;return function(_0x4437f1){logger[_0x47a5('0x21')](_0x4437f1[_0x47a5('0x22')]);if(_0x4437f1['name']){delete _0x4437f1['name'];}_0x28747d[_0x47a5('0x16')](_0xc4cd63)['send'](_0x4437f1);};}exports[_0x47a5('0x23')]=function(_0x5b6c4e,_0x23cb77){var _0x378208={},_0x36ad34={},_0x1dac65={'count':0x0,'rows':[]};var _0x21f296=db[_0x47a5('0x24')][_0x47a5('0x25')];_0x36ad34[_0x47a5('0x26')]=_[_0x47a5('0x27')](_0x21f296);_0x36ad34[_0x47a5('0x28')]=_[_0x47a5('0x27')](_0x5b6c4e[_0x47a5('0x28')]);_0x36ad34[_0x47a5('0x29')]=_['intersection'](_0x36ad34[_0x47a5('0x26')],_0x36ad34['query']);_0x378208[_0x47a5('0x2a')]=_[_0x47a5('0x2b')](_0x36ad34[_0x47a5('0x26')],qs['fields'](_0x5b6c4e[_0x47a5('0x28')][_0x47a5('0x2c')]));_0x378208[_0x47a5('0x2a')]=_0x378208[_0x47a5('0x2a')]['length']?_0x378208['attributes']:_0x36ad34[_0x47a5('0x26')];if(!_0x5b6c4e[_0x47a5('0x28')]['hasOwnProperty']('nolimit')){_0x378208[_0x47a5('0x19')]=qs[_0x47a5('0x19')](_0x5b6c4e['query'][_0x47a5('0x19')]);_0x378208['offset']=qs[_0x47a5('0x2d')](_0x5b6c4e[_0x47a5('0x28')]['offset']);}_0x378208['order']=qs[_0x47a5('0x2e')](_0x5b6c4e['query'][_0x47a5('0x2e')]);_0x378208[_0x47a5('0x2f')]=qs[_0x47a5('0x29')](_['pick'](_0x5b6c4e[_0x47a5('0x28')],_0x36ad34['filters']));if(_0x5b6c4e['query'][_0x47a5('0x30')]){_0x378208['where']=_[_0x47a5('0x31')](_0x378208['where'],{'$or':_[_0x47a5('0x32')](_0x21f296,function(_0x3534cb){if(_0x3534cb[_0x47a5('0x33')][_0x47a5('0x34')]!==_0x47a5('0x35')){var _0xed6320={};_0xed6320[_0x3534cb[_0x47a5('0x36')]]={'$like':'%'+_0x5b6c4e[_0x47a5('0x28')][_0x47a5('0x30')]+'%'};return _0xed6320;}})});}_0x378208=_['merge']({},_0x378208,_0x5b6c4e[_0x47a5('0x37')]);var _0x10f136={'where':_0x378208['where']};return db[_0x47a5('0x24')][_0x47a5('0x18')](_0x10f136)[_0x47a5('0x20')](function(_0x49c4b5){_0x1dac65[_0x47a5('0x18')]=_0x49c4b5;if(_0x5b6c4e[_0x47a5('0x28')]['includeAll']){_0x378208[_0x47a5('0x38')]=[{'all':!![]}];}return db[_0x47a5('0x24')]['findAll'](_0x378208);})['then'](function(_0x5ebd8c){_0x1dac65[_0x47a5('0x39')]=_0x5ebd8c;return _0x1dac65;})['then'](respondWithFilteredResult(_0x23cb77,_0x378208))[_0x47a5('0x3a')](handleError(_0x23cb77,null));};exports[_0x47a5('0x3b')]=function(_0x301a85,_0x111f0d){var _0x1b2c80={'raw':!![],'where':{'id':_0x301a85[_0x47a5('0x3c')]['id']}},_0xcb5243={};_0xcb5243[_0x47a5('0x26')]=_[_0x47a5('0x27')](db[_0x47a5('0x24')][_0x47a5('0x25')]);_0xcb5243[_0x47a5('0x28')]=_[_0x47a5('0x27')](_0x301a85['query']);_0xcb5243[_0x47a5('0x29')]=_[_0x47a5('0x2b')](_0xcb5243[_0x47a5('0x26')],_0xcb5243[_0x47a5('0x28')]);_0x1b2c80['attributes']=_[_0x47a5('0x2b')](_0xcb5243['model'],qs['fields'](_0x301a85['query']['fields']));_0x1b2c80[_0x47a5('0x2a')]=_0x1b2c80['attributes'][_0x47a5('0x3d')]?_0x1b2c80[_0x47a5('0x2a')]:_0xcb5243[_0x47a5('0x26')];if(_0x301a85['query'][_0x47a5('0x3e')]){_0x1b2c80[_0x47a5('0x38')]=[{'all':!![]}];}_0x1b2c80=_['merge']({},_0x1b2c80,_0x301a85['options']);return db[_0x47a5('0x24')]['find'](_0x1b2c80)[_0x47a5('0x20')](handleEntityNotFound(_0x111f0d,null))[_0x47a5('0x20')](respondWithResult(_0x111f0d,null))[_0x47a5('0x3a')](handleError(_0x111f0d,null));};exports[_0x47a5('0x3f')]=function(_0x34a9ae,_0xf0edbb){return db[_0x47a5('0x24')][_0x47a5('0x3f')](_0x34a9ae[_0x47a5('0x40')],{})[_0x47a5('0x20')](respondWithResult(_0xf0edbb,0xc9))[_0x47a5('0x3a')](handleError(_0xf0edbb,null));};exports[_0x47a5('0x1e')]=function(_0xe28d76,_0x3574d4){if(_0xe28d76[_0x47a5('0x40')]['id']){delete _0xe28d76[_0x47a5('0x40')]['id'];}return db['JscriptyAnswerReport'][_0x47a5('0x41')]({'where':{'id':_0xe28d76[_0x47a5('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3574d4,null))['then'](saveUpdates(_0xe28d76[_0x47a5('0x40')],null))['then'](respondWithResult(_0x3574d4,null))[_0x47a5('0x3a')](handleError(_0x3574d4,null));};exports[_0x47a5('0x1f')]=function(_0x54c35f,_0x4f62d3){return db[_0x47a5('0x24')]['find']({'where':{'id':_0x54c35f[_0x47a5('0x3c')]['id']}})[_0x47a5('0x20')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x20')](removeEntity(_0x4f62d3,null))[_0x47a5('0x3a')](handleError(_0x4f62d3,null));};exports[_0x47a5('0x42')]=function(_0x26acd2,_0x238ebb){return db['JscriptyAnswerReport']['describe']()[_0x47a5('0x20')](respondWithResult(_0x238ebb,null))[_0x47a5('0x3a')](handleError(_0x238ebb,null));}; \ No newline at end of file +var _0x7a54=['mustache','util','path','sox','ejs','squel','crypto','desk.js','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','index','JscriptyAnswerReport','rawAttributes','model','keys','query','filters','attributes','intersection','fields','offset','sort','where','filter','merge','map','type','key','VIRTUAL','field','options','include','rows','catch','show','params','length','includeAll','create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird'];(function(_0x321810,_0x513629){var _0x312bc0=function(_0x48c6a9){while(--_0x48c6a9){_0x321810['push'](_0x321810['shift']());}};_0x312bc0(++_0x513629);}(_0x7a54,0x106));var _0x47a5=function(_0x3a4e22,_0x3c9e3f){_0x3a4e22=_0x3a4e22-0x0;var _0x2540d4=_0x7a54[_0x3a4e22];return _0x2540d4;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x47a5('0xe'));var hardwareService=require(_0x47a5('0xf'));var Redis=require('ioredis');var qs=require(_0x47a5('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x47a5('0x11'));var config=require(_0x47a5('0x12'));var db=require(_0x47a5('0x13'))['db'];function respondWithStatusCode(_0x250fad,_0xd612dd){_0xd612dd=_0xd612dd||0xcc;return function(_0xd308b8){if(_0xd308b8){return _0x250fad[_0x47a5('0x14')](_0xd612dd);}return _0x250fad['status'](_0xd612dd)[_0x47a5('0x15')]();};}function respondWithResult(_0x221b54,_0x1cf309){_0x1cf309=_0x1cf309||0xc8;return function(_0x711793){if(_0x711793){return _0x221b54[_0x47a5('0x16')](_0x1cf309)[_0x47a5('0x17')](_0x711793);}};}function respondWithFilteredResult(_0x3c6c46,_0x190faa){return function(_0x4e99a8){if(_0x4e99a8){var _0x362359=_0x4e99a8[_0x47a5('0x18')],_0x11faf5=_0x190faa['offset'],_0x3b001e=_0x190faa['offset']+_0x190faa[_0x47a5('0x19')],_0x2a2cbb;if(_0x3b001e>=_0x362359){_0x3b001e=_0x362359;_0x2a2cbb=0xc8;}else{_0x2a2cbb=0xce;}_0x3c6c46['status'](_0x2a2cbb);return _0x3c6c46['set'](_0x47a5('0x1a'),_0x11faf5+'-'+_0x3b001e+'/'+_0x362359)[_0x47a5('0x17')](_0x4e99a8);}return null;};}function patchUpdates(_0x2ce454){return function(_0x1ef371){try{jsonpatch[_0x47a5('0x1b')](_0x1ef371,_0x2ce454,!![]);}catch(_0x12b98e){return BPromise[_0x47a5('0x1c')](_0x12b98e);}return _0x1ef371[_0x47a5('0x1d')]();};}function saveUpdates(_0x3aed38,_0x4a9fcb){return function(_0x1570bc){if(_0x1570bc){return _0x1570bc[_0x47a5('0x1e')](_0x3aed38)['then'](function(_0x2b0360){return _0x2b0360;});}return null;};}function removeEntity(_0x1f03f7,_0x36874d){return function(_0x4c5910){if(_0x4c5910){return _0x4c5910[_0x47a5('0x1f')]()[_0x47a5('0x20')](function(){_0x1f03f7[_0x47a5('0x16')](0xcc)[_0x47a5('0x15')]();});}};}function handleEntityNotFound(_0x5ef1b1,_0xe2dea9){return function(_0x385687){if(!_0x385687){_0x5ef1b1['sendStatus'](0x194);}return _0x385687;};}function handleError(_0x28747d,_0xc4cd63){_0xc4cd63=_0xc4cd63||0x1f4;return function(_0x4437f1){logger[_0x47a5('0x21')](_0x4437f1[_0x47a5('0x22')]);if(_0x4437f1['name']){delete _0x4437f1['name'];}_0x28747d[_0x47a5('0x16')](_0xc4cd63)['send'](_0x4437f1);};}exports[_0x47a5('0x23')]=function(_0x5b6c4e,_0x23cb77){var _0x378208={},_0x36ad34={},_0x1dac65={'count':0x0,'rows':[]};var _0x21f296=db[_0x47a5('0x24')][_0x47a5('0x25')];_0x36ad34[_0x47a5('0x26')]=_[_0x47a5('0x27')](_0x21f296);_0x36ad34[_0x47a5('0x28')]=_[_0x47a5('0x27')](_0x5b6c4e[_0x47a5('0x28')]);_0x36ad34[_0x47a5('0x29')]=_['intersection'](_0x36ad34[_0x47a5('0x26')],_0x36ad34['query']);_0x378208[_0x47a5('0x2a')]=_[_0x47a5('0x2b')](_0x36ad34[_0x47a5('0x26')],qs['fields'](_0x5b6c4e[_0x47a5('0x28')][_0x47a5('0x2c')]));_0x378208[_0x47a5('0x2a')]=_0x378208[_0x47a5('0x2a')]['length']?_0x378208['attributes']:_0x36ad34[_0x47a5('0x26')];if(!_0x5b6c4e[_0x47a5('0x28')]['hasOwnProperty']('nolimit')){_0x378208[_0x47a5('0x19')]=qs[_0x47a5('0x19')](_0x5b6c4e['query'][_0x47a5('0x19')]);_0x378208['offset']=qs[_0x47a5('0x2d')](_0x5b6c4e[_0x47a5('0x28')]['offset']);}_0x378208['order']=qs[_0x47a5('0x2e')](_0x5b6c4e['query'][_0x47a5('0x2e')]);_0x378208[_0x47a5('0x2f')]=qs[_0x47a5('0x29')](_['pick'](_0x5b6c4e[_0x47a5('0x28')],_0x36ad34['filters']));if(_0x5b6c4e['query'][_0x47a5('0x30')]){_0x378208['where']=_[_0x47a5('0x31')](_0x378208['where'],{'$or':_[_0x47a5('0x32')](_0x21f296,function(_0x3534cb){if(_0x3534cb[_0x47a5('0x33')][_0x47a5('0x34')]!==_0x47a5('0x35')){var _0xed6320={};_0xed6320[_0x3534cb[_0x47a5('0x36')]]={'$like':'%'+_0x5b6c4e[_0x47a5('0x28')][_0x47a5('0x30')]+'%'};return _0xed6320;}})});}_0x378208=_['merge']({},_0x378208,_0x5b6c4e[_0x47a5('0x37')]);var _0x10f136={'where':_0x378208['where']};return db[_0x47a5('0x24')][_0x47a5('0x18')](_0x10f136)[_0x47a5('0x20')](function(_0x49c4b5){_0x1dac65[_0x47a5('0x18')]=_0x49c4b5;if(_0x5b6c4e[_0x47a5('0x28')]['includeAll']){_0x378208[_0x47a5('0x38')]=[{'all':!![]}];}return db[_0x47a5('0x24')]['findAll'](_0x378208);})['then'](function(_0x5ebd8c){_0x1dac65[_0x47a5('0x39')]=_0x5ebd8c;return _0x1dac65;})['then'](respondWithFilteredResult(_0x23cb77,_0x378208))[_0x47a5('0x3a')](handleError(_0x23cb77,null));};exports[_0x47a5('0x3b')]=function(_0x301a85,_0x111f0d){var _0x1b2c80={'raw':!![],'where':{'id':_0x301a85[_0x47a5('0x3c')]['id']}},_0xcb5243={};_0xcb5243[_0x47a5('0x26')]=_[_0x47a5('0x27')](db[_0x47a5('0x24')][_0x47a5('0x25')]);_0xcb5243[_0x47a5('0x28')]=_[_0x47a5('0x27')](_0x301a85['query']);_0xcb5243[_0x47a5('0x29')]=_[_0x47a5('0x2b')](_0xcb5243[_0x47a5('0x26')],_0xcb5243[_0x47a5('0x28')]);_0x1b2c80['attributes']=_[_0x47a5('0x2b')](_0xcb5243['model'],qs['fields'](_0x301a85['query']['fields']));_0x1b2c80[_0x47a5('0x2a')]=_0x1b2c80['attributes'][_0x47a5('0x3d')]?_0x1b2c80[_0x47a5('0x2a')]:_0xcb5243[_0x47a5('0x26')];if(_0x301a85['query'][_0x47a5('0x3e')]){_0x1b2c80[_0x47a5('0x38')]=[{'all':!![]}];}_0x1b2c80=_['merge']({},_0x1b2c80,_0x301a85['options']);return db[_0x47a5('0x24')]['find'](_0x1b2c80)[_0x47a5('0x20')](handleEntityNotFound(_0x111f0d,null))[_0x47a5('0x20')](respondWithResult(_0x111f0d,null))[_0x47a5('0x3a')](handleError(_0x111f0d,null));};exports[_0x47a5('0x3f')]=function(_0x34a9ae,_0xf0edbb){return db[_0x47a5('0x24')][_0x47a5('0x3f')](_0x34a9ae[_0x47a5('0x40')],{})[_0x47a5('0x20')](respondWithResult(_0xf0edbb,0xc9))[_0x47a5('0x3a')](handleError(_0xf0edbb,null));};exports[_0x47a5('0x1e')]=function(_0xe28d76,_0x3574d4){if(_0xe28d76[_0x47a5('0x40')]['id']){delete _0xe28d76[_0x47a5('0x40')]['id'];}return db['JscriptyAnswerReport'][_0x47a5('0x41')]({'where':{'id':_0xe28d76[_0x47a5('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3574d4,null))['then'](saveUpdates(_0xe28d76[_0x47a5('0x40')],null))['then'](respondWithResult(_0x3574d4,null))[_0x47a5('0x3a')](handleError(_0x3574d4,null));};exports[_0x47a5('0x1f')]=function(_0x54c35f,_0x4f62d3){return db[_0x47a5('0x24')]['find']({'where':{'id':_0x54c35f[_0x47a5('0x3c')]['id']}})[_0x47a5('0x20')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x20')](removeEntity(_0x4f62d3,null))[_0x47a5('0x3a')](handleError(_0x4f62d3,null));};exports[_0x47a5('0x42')]=function(_0x26acd2,_0x238ebb){return db['JscriptyAnswerReport']['describe']()[_0x47a5('0x20')](respondWithResult(_0x238ebb,null))[_0x47a5('0x3a')](handleError(_0x238ebb,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 01351fc..89495d4 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 _0x5e41=['util','../../config/logger','api','bluebird','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers'];(function(_0x424c60,_0x47c1f6){var _0x5e06d4=function(_0x206ecd){while(--_0x206ecd){_0x424c60['push'](_0x424c60['shift']());}};_0x5e06d4(++_0x47c1f6);}(_0x5e41,0x170));var _0x15e4=function(_0x380633,_0x1340ce){_0x380633=_0x380633-0x0;var _0x11f6fb=_0x5e41[_0x380633];return _0x11f6fb;};'use strict';var _=require('lodash');var util=require(_0x15e4('0x0'));var logger=require(_0x15e4('0x1'))(_0x15e4('0x2'));var moment=require('moment');var BPromise=require(_0x15e4('0x3'));var rp=require('request-promise');var attributes=require(_0x15e4('0x4'));module[_0x15e4('0x5')]=function(_0x56027c,_0xc5d7f8){return _0x56027c[_0x15e4('0x6')]('JscriptyAnswerReport',attributes,{'tableName':_0x15e4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26bd=['JscriptyAnswerReport','report_jscripty_answers','lodash','api','moment','bluebird','request-promise','./jscriptyAnswerReport.attributes','exports','define'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x26bd,0x1b0));var _0xd26b=function(_0x11997c,_0x3c140f){_0x11997c=_0x11997c-0x0;var _0x435226=_0x26bd[_0x11997c];return _0x435226;};'use strict';var _=require(_0xd26b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd26b('0x1'));var moment=require(_0xd26b('0x2'));var BPromise=require(_0xd26b('0x3'));var rp=require(_0xd26b('0x4'));var attributes=require(_0xd26b('0x5'));module[_0xd26b('0x6')]=function(_0xc64a26,_0x4e674d){return _0xc64a26[_0xd26b('0x7')](_0xd26b('0x8'),attributes,{'tableName':_0xd26b('0x9'),'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 af81fa6..c03c09c 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 _0x4487=['http','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x21789c,_0x34d85c){var _0x4c8b66=function(_0x5effa1){while(--_0x5effa1){_0x21789c['push'](_0x21789c['shift']());}};_0x4c8b66(++_0x34d85c);}(_0x4487,0xf2));var _0x7448=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x4487[_0x5627e1];return _0x2f013f;};'use strict';var _=require(_0x7448('0x0'));var util=require('util');var moment=require(_0x7448('0x1'));var BPromise=require(_0x7448('0x2'));var rs=require(_0x7448('0x3'));var fs=require('fs');var Redis=require(_0x7448('0x4'));var db=require(_0x7448('0x5'))['db'];var utils=require(_0x7448('0x6'));var logger=require(_0x7448('0x7'))(_0x7448('0x8'));var config=require(_0x7448('0x9'));var jayson=require(_0x7448('0xa'));var client=jayson['client'][_0x7448('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x414b4b,_0x139cec,_0x593bd1){return new BPromise(function(_0xd2e52b,_0x5f549f){return client['request'](_0x414b4b,_0x593bd1)[_0x7448('0xc')](function(_0x33247b){logger['info'](_0x7448('0xd'),_0x139cec,_0x7448('0xe'));logger[_0x7448('0xf')](_0x7448('0x10'),_0x139cec,'request\x20sent',JSON[_0x7448('0x11')](_0x33247b));if(_0x33247b['error']){if(_0x33247b[_0x7448('0x12')][_0x7448('0x13')]===0x1f4){logger[_0x7448('0x12')](_0x7448('0xd'),_0x139cec,_0x33247b[_0x7448('0x12')][_0x7448('0x14')]);return _0x5f549f(_0x33247b['error'][_0x7448('0x14')]);}logger['error'](_0x7448('0xd'),_0x139cec,_0x33247b[_0x7448('0x12')][_0x7448('0x14')]);return _0xd2e52b(_0x33247b[_0x7448('0x12')][_0x7448('0x14')]);}else{logger['info'](_0x7448('0xd'),_0x139cec,_0x7448('0xe'));_0xd2e52b(_0x33247b[_0x7448('0x15')][_0x7448('0x14')]);}})[_0x7448('0x16')](function(_0x37376f){logger['error'](_0x7448('0xd'),_0x139cec,_0x37376f);_0x5f549f(_0x37376f);});});} \ No newline at end of file +var _0x5965=['JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug'];(function(_0x2ddd50,_0x329696){var _0x4ad561=function(_0x253498){while(--_0x253498){_0x2ddd50['push'](_0x2ddd50['shift']());}};_0x4ad561(++_0x329696);}(_0x5965,0x1bf));var _0x5596=function(_0x2ac5cd,_0x319351){_0x2ac5cd=_0x2ac5cd-0x0;var _0x386998=_0x5965[_0x2ac5cd];return _0x386998;};'use strict';var _=require('lodash');var util=require(_0x5596('0x0'));var moment=require(_0x5596('0x1'));var BPromise=require(_0x5596('0x2'));var rs=require(_0x5596('0x3'));var fs=require('fs');var Redis=require(_0x5596('0x4'));var db=require(_0x5596('0x5'))['db'];var utils=require(_0x5596('0x6'));var logger=require(_0x5596('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5596('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ff6f9,_0x4ae4ef,_0x52dc7d){return new BPromise(function(_0x5572b9,_0x1eab05){return client['request'](_0x3ff6f9,_0x52dc7d)[_0x5596('0x9')](function(_0x364fed){logger[_0x5596('0xa')](_0x5596('0xb'),_0x4ae4ef,'request\x20sent');logger[_0x5596('0xc')](_0x5596('0xd'),_0x4ae4ef,_0x5596('0xe'),JSON[_0x5596('0xf')](_0x364fed));if(_0x364fed[_0x5596('0x10')]){if(_0x364fed[_0x5596('0x10')]['code']===0x1f4){logger[_0x5596('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4ae4ef,_0x364fed['error'][_0x5596('0x11')]);return _0x1eab05(_0x364fed[_0x5596('0x10')]['message']);}logger[_0x5596('0x10')](_0x5596('0xb'),_0x4ae4ef,_0x364fed[_0x5596('0x10')][_0x5596('0x11')]);return _0x5572b9(_0x364fed[_0x5596('0x10')][_0x5596('0x11')]);}else{logger[_0x5596('0xa')](_0x5596('0xb'),_0x4ae4ef,'request\x20sent');_0x5572b9(_0x364fed[_0x5596('0x12')][_0x5596('0x11')]);}})[_0x5596('0x13')](function(_0x490826){logger[_0x5596('0x10')](_0x5596('0xb'),_0x4ae4ef,_0x490826);_0x1eab05(_0x490826);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index cdbd4aa..21176eb 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 _0x041c=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','create','/:id/clone','put','/:id','delete','destroy','exports','multer'];(function(_0x44af7f,_0x3f0506){var _0x5b66b0=function(_0x1d426c){while(--_0x1d426c){_0x44af7f['push'](_0x44af7f['shift']());}};_0x5b66b0(++_0x3f0506);}(_0x041c,0xa1));var _0xc041=function(_0x1050d7,_0xcc427c){_0x1050d7=_0x1050d7-0x0;var _0x5c1db6=_0x041c[_0x1050d7];return _0x5c1db6;};'use strict';var multer=require(_0xc041('0x0'));var util=require(_0xc041('0x1'));var path=require(_0xc041('0x2'));var timeout=require(_0xc041('0x3'));var express=require(_0xc041('0x4'));var router=express[_0xc041('0x5')]();var auth=require(_0xc041('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc041('0x7'));var controller=require(_0xc041('0x8'));router[_0xc041('0x9')]('/',auth[_0xc041('0xa')](),controller[_0xc041('0xb')]);router[_0xc041('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc041('0xc')]);router[_0xc041('0x9')](_0xc041('0xd'),auth['isAuthenticated'](),controller[_0xc041('0xe')]);router[_0xc041('0x9')](_0xc041('0xf'),auth[_0xc041('0xa')](),controller[_0xc041('0x10')]);router['get'](_0xc041('0x11'),auth[_0xc041('0xa')](),timeout(_0xc041('0x12')),controller[_0xc041('0x13')]);router['post']('/',auth[_0xc041('0xa')](),controller[_0xc041('0x14')]);router['post'](_0xc041('0x15'),auth[_0xc041('0xa')](),controller['clone']);router[_0xc041('0x16')](_0xc041('0x17'),auth[_0xc041('0xa')](),controller['update']);router[_0xc041('0x18')](_0xc041('0x17'),auth['isAuthenticated'](),controller[_0xc041('0x19')]);module[_0xc041('0x1a')]=router; \ No newline at end of file +var _0x8322=['post','create','clone','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','index','get','/:id','isAuthenticated','show','/:id/sessions','getSessions','getAnswers'];(function(_0x3659b8,_0x3fdacc){var _0x3d520b=function(_0x615c8){while(--_0x615c8){_0x3659b8['push'](_0x3659b8['shift']());}};_0x3d520b(++_0x3fdacc);}(_0x8322,0x186));var _0x2832=function(_0x30b0d8,_0x57470c){_0x30b0d8=_0x30b0d8-0x0;var _0x459c09=_0x8322[_0x30b0d8];return _0x459c09;};'use strict';var multer=require(_0x2832('0x0'));var util=require(_0x2832('0x1'));var path=require(_0x2832('0x2'));var timeout=require(_0x2832('0x3'));var express=require(_0x2832('0x4'));var router=express[_0x2832('0x5')]();var auth=require(_0x2832('0x6'));var interaction=require(_0x2832('0x7'));var config=require(_0x2832('0x8'));var controller=require(_0x2832('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x2832('0xa')]);router[_0x2832('0xb')](_0x2832('0xc'),auth[_0x2832('0xd')](),controller[_0x2832('0xe')]);router['get'](_0x2832('0xf'),auth[_0x2832('0xd')](),controller[_0x2832('0x10')]);router[_0x2832('0xb')]('/:id/answers',auth[_0x2832('0xd')](),controller[_0x2832('0x11')]);router['get']('/:id/summary',auth[_0x2832('0xd')](),timeout('30s'),controller['getSummary']);router[_0x2832('0x12')]('/',auth[_0x2832('0xd')](),controller[_0x2832('0x13')]);router[_0x2832('0x12')]('/:id/clone',auth[_0x2832('0xd')](),controller[_0x2832('0x14')]);router['put'](_0x2832('0xc'),auth[_0x2832('0xd')](),controller[_0x2832('0x15')]);router[_0x2832('0x16')](_0x2832('0xc'),auth[_0x2832('0xd')](),controller[_0x2832('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 929f90b..c99e846 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 _0xeecc=['BOOLEAN','sequelize','lodash','exports','STRING','name','long','isObjectLike','setDataValue','stringify','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description'];(function(_0x4f90a3,_0x406b25){var _0x180d58=function(_0x2b2635){while(--_0x2b2635){_0x4f90a3['push'](_0x4f90a3['shift']());}};_0x180d58(++_0x406b25);}(_0xeecc,0x1c3));var _0xceec=function(_0x45f8ae,_0x341d6b){_0x45f8ae=_0x45f8ae-0x0;var _0x489129=_0xeecc[_0x45f8ae];return _0x489129;};'use strict';var Sequelize=require(_0xceec('0x0'));var _=require(_0xceec('0x1'));var util=require('util');module[_0xceec('0x2')]={'name':{'type':Sequelize[_0xceec('0x3')],'unique':_0xceec('0x4')},'description':{'type':Sequelize[_0xceec('0x3')]},'formData':{'type':Sequelize['TEXT'](_0xceec('0x5')),'set':function(_0x134f83){if(_[_0xceec('0x6')](_0x134f83)){this[_0xceec('0x7')]('formData',JSON[_0xceec('0x8')](_0x134f83));}else if(_['isString'](_0x134f83)){this[_0xceec('0x7')](_0xceec('0x9'),_0x134f83);}else{this[_0xceec('0x7')](_0xceec('0x9'),util[_0xceec('0xa')](_0xceec('0xb'),this['getDataValue']('name')||'',this[_0xceec('0xc')](_0xceec('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xceec('0xe')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4dac=['isString','setDataValue','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','stringify'];(function(_0x3d0247,_0x2e5a09){var _0x5d2f3a=function(_0x441e19){while(--_0x441e19){_0x3d0247['push'](_0x3d0247['shift']());}};_0x5d2f3a(++_0x2e5a09);}(_0x4dac,0x19b));var _0xc4da=function(_0x37dbf3,_0x4ad77d){_0x37dbf3=_0x37dbf3-0x0;var _0x1cda9b=_0x4dac[_0x37dbf3];return _0x1cda9b;};'use strict';var Sequelize=require(_0xc4da('0x0'));var _=require(_0xc4da('0x1'));var util=require(_0xc4da('0x2'));module[_0xc4da('0x3')]={'name':{'type':Sequelize[_0xc4da('0x4')],'unique':_0xc4da('0x5')},'description':{'type':Sequelize[_0xc4da('0x4')]},'formData':{'type':Sequelize[_0xc4da('0x6')](_0xc4da('0x7')),'set':function(_0x1339f5){if(_['isObjectLike'](_0x1339f5)){this['setDataValue']('formData',JSON[_0xc4da('0x8')](_0x1339f5));}else if(_[_0xc4da('0x9')](_0x1339f5)){this[_0xc4da('0xa')](_0xc4da('0xb'),_0x1339f5);}else{this[_0xc4da('0xa')](_0xc4da('0xb'),util['format'](_0xc4da('0xc'),this['getDataValue'](_0xc4da('0x5'))||'',this[_0xc4da('0xd')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xc4da('0xe')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index dd7b7d2..c7b0595 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 _0x533b=['pick','filter','merge','type','key','field','includeAll','include','findAll','show','params','options','catch','create','body','user','UserProfileSection','find','autoAssociation','error','clone','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','ProjectId','map','rows','getAnswers','JscriptyAnswerReport','number','apply','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','questionId','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','sendStatus','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','limit','set','Content-Range','reject','update','then','get','Projects','UserProfileResource','destroy','end','stack','name','send','JscriptyProject','rawAttributes','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where'];(function(_0xbdb26a,_0x4041bb){var _0x543b57=function(_0x5186d7){while(--_0x5186d7){_0xbdb26a['push'](_0xbdb26a['shift']());}};_0x543b57(++_0x4041bb);}(_0x533b,0x11a));var _0xb533=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x533b[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xb533('0x0'));var emlformat=require(_0xb533('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb533('0x2'));var jsonpatch=require(_0xb533('0x3'));var rp=require(_0xb533('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb533('0x5'));var sox=require(_0xb533('0x6'));var csv=require(_0xb533('0x7'));var ejs=require(_0xb533('0x8'));var fs=require('fs');var _=require(_0xb533('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb533('0xa'));var deskjs=require(_0xb533('0xb'));var toCsv=require(_0xb533('0x7'));var querystring=require(_0xb533('0xc'));var Papa=require(_0xb533('0xd'));var authService=require(_0xb533('0xe'));var hardwareService=require(_0xb533('0xf'));var Redis=require('ioredis');var qs=require(_0xb533('0x10'));var logger=require(_0xb533('0x11'))(_0xb533('0x12'));var utils=require(_0xb533('0x13'));var config=require(_0xb533('0x14'));var db=require(_0xb533('0x15'))['db'];function respondWithStatusCode(_0x37e3ba,_0x47f68a){_0x47f68a=_0x47f68a||0xcc;return function(_0x2b8a0a){if(_0x2b8a0a){return _0x37e3ba['sendStatus'](_0x47f68a);}return _0x37e3ba[_0xb533('0x16')](_0x47f68a)['end']();};}function respondWithResult(_0x88319b,_0x35d313){_0x35d313=_0x35d313||0xc8;return function(_0xd54f77){if(_0xd54f77){return _0x88319b[_0xb533('0x16')](_0x35d313)['json'](_0xd54f77);}};}function respondWithFilteredResult(_0x1d2c86,_0x531c28){return function(_0x50c3db){if(_0x50c3db){var _0xd913b9=_0x50c3db[_0xb533('0x17')],_0x38ad27=_0x531c28[_0xb533('0x18')],_0x2e0c1d=_0x531c28['offset']+_0x531c28[_0xb533('0x19')],_0x2683d2;if(_0x2e0c1d>=_0xd913b9){_0x2e0c1d=_0xd913b9;_0x2683d2=0xc8;}else{_0x2683d2=0xce;}_0x1d2c86['status'](_0x2683d2);return _0x1d2c86[_0xb533('0x1a')](_0xb533('0x1b'),_0x38ad27+'-'+_0x2e0c1d+'/'+_0xd913b9)['json'](_0x50c3db);}return null;};}function patchUpdates(_0x525b74){return function(_0x367155){try{jsonpatch['apply'](_0x367155,_0x525b74,!![]);}catch(_0x2e4e59){return BPromise[_0xb533('0x1c')](_0x2e4e59);}return _0x367155['save']();};}function saveUpdates(_0x29bdb8,_0x276309){return function(_0x3392d9){if(_0x3392d9){return _0x3392d9[_0xb533('0x1d')](_0x29bdb8)['then'](function(_0x5b6b9e){return _0x5b6b9e;});}return null;};}function removeEntity(_0x2b9ae0,_0xf241f){return function(_0x152fec){if(_0x152fec){return _0x152fec['destroy']()[_0xb533('0x1e')](function(){var _0x1367ce=_0x152fec[_0xb533('0x1f')]({'plain':!![]});var _0x1f067c=_0xb533('0x20');return db[_0xb533('0x21')][_0xb533('0x22')]({'where':{'type':_0x1f067c,'resourceId':_0x1367ce['id']}})[_0xb533('0x1e')](function(){return _0x152fec;});})[_0xb533('0x1e')](function(){_0x2b9ae0[_0xb533('0x16')](0xcc)[_0xb533('0x23')]();});}};}function handleEntityNotFound(_0x1e8e5a,_0x5770a4){return function(_0x5655f4){if(!_0x5655f4){_0x1e8e5a['sendStatus'](0x194);}return _0x5655f4;};}function handleError(_0x5eb00d,_0x3380a0){_0x3380a0=_0x3380a0||0x1f4;return function(_0xc0f8bf){logger['error'](_0xc0f8bf[_0xb533('0x24')]);if(_0xc0f8bf[_0xb533('0x25')]){delete _0xc0f8bf[_0xb533('0x25')];}_0x5eb00d['status'](_0x3380a0)[_0xb533('0x26')](_0xc0f8bf);};}exports['index']=function(_0x232b74,_0x52b7dd){var _0x282200={},_0x4179c1={},_0x35068b={'count':0x0,'rows':[]};var _0xa896b0=db[_0xb533('0x27')][_0xb533('0x28')];_0x4179c1[_0xb533('0x29')]=_['keys'](_0xa896b0);_0x4179c1[_0xb533('0x2a')]=_[_0xb533('0x2b')](_0x232b74[_0xb533('0x2a')]);_0x4179c1[_0xb533('0x2c')]=_['intersection'](_0x4179c1['model'],_0x4179c1[_0xb533('0x2a')]);_0x282200['attributes']=_[_0xb533('0x2d')](_0x4179c1['model'],qs[_0xb533('0x2e')](_0x232b74[_0xb533('0x2a')]['fields']));_0x282200['attributes']=_0x282200['attributes'][_0xb533('0x2f')]?_0x282200[_0xb533('0x30')]:_0x4179c1['model'];if(!_0x232b74['query'][_0xb533('0x31')](_0xb533('0x32'))){_0x282200[_0xb533('0x19')]=qs[_0xb533('0x19')](_0x232b74[_0xb533('0x2a')][_0xb533('0x19')]);_0x282200[_0xb533('0x18')]=qs[_0xb533('0x18')](_0x232b74[_0xb533('0x2a')][_0xb533('0x18')]);}_0x282200[_0xb533('0x33')]=qs[_0xb533('0x34')](_0x232b74[_0xb533('0x2a')][_0xb533('0x34')]);_0x282200[_0xb533('0x35')]=qs[_0xb533('0x2c')](_[_0xb533('0x36')](_0x232b74[_0xb533('0x2a')],_0x4179c1[_0xb533('0x2c')]));if(_0x232b74[_0xb533('0x2a')][_0xb533('0x37')]){_0x282200[_0xb533('0x35')]=_[_0xb533('0x38')](_0x282200['where'],{'$or':_['map'](_0xa896b0,function(_0x5b2cc4){if(_0x5b2cc4[_0xb533('0x39')][_0xb533('0x3a')]!=='VIRTUAL'){var _0x1cc1ac={};_0x1cc1ac[_0x5b2cc4[_0xb533('0x3b')]]={'$like':'%'+_0x232b74[_0xb533('0x2a')][_0xb533('0x37')]+'%'};return _0x1cc1ac;}})});}_0x282200=_[_0xb533('0x38')]({},_0x282200,_0x232b74['options']);var _0x1a631b={'where':_0x282200['where']};return db[_0xb533('0x27')][_0xb533('0x17')](_0x1a631b)['then'](function(_0xff4024){_0x35068b[_0xb533('0x17')]=_0xff4024;if(_0x232b74['query'][_0xb533('0x3c')]){_0x282200[_0xb533('0x3d')]=[{'all':!![]}];}return db['JscriptyProject'][_0xb533('0x3e')](_0x282200);})[_0xb533('0x1e')](function(_0x18aff0){_0x35068b['rows']=_0x18aff0;return _0x35068b;})['then'](respondWithFilteredResult(_0x52b7dd,_0x282200))['catch'](handleError(_0x52b7dd,null));};exports[_0xb533('0x3f')]=function(_0x293cf4,_0x1894cb){var _0x54263a={'raw':![],'where':{'id':_0x293cf4[_0xb533('0x40')]['id']}},_0x4afec7={};_0x4afec7[_0xb533('0x29')]=_[_0xb533('0x2b')](db['JscriptyProject']['rawAttributes']);_0x4afec7['query']=_[_0xb533('0x2b')](_0x293cf4['query']);_0x4afec7[_0xb533('0x2c')]=_[_0xb533('0x2d')](_0x4afec7[_0xb533('0x29')],_0x4afec7['query']);_0x54263a[_0xb533('0x30')]=_['intersection'](_0x4afec7[_0xb533('0x29')],qs[_0xb533('0x2e')](_0x293cf4[_0xb533('0x2a')][_0xb533('0x2e')]));_0x54263a[_0xb533('0x30')]=_0x54263a[_0xb533('0x30')][_0xb533('0x2f')]?_0x54263a[_0xb533('0x30')]:_0x4afec7[_0xb533('0x29')];if(_0x293cf4[_0xb533('0x2a')]['includeAll']){_0x54263a[_0xb533('0x3d')]=[{'all':!![]}];}_0x54263a=_['merge']({},_0x54263a,_0x293cf4[_0xb533('0x41')]);return db['JscriptyProject']['find'](_0x54263a)[_0xb533('0x1e')](handleEntityNotFound(_0x1894cb,null))[_0xb533('0x1e')](respondWithResult(_0x1894cb,null))[_0xb533('0x42')](handleError(_0x1894cb,null));};exports[_0xb533('0x43')]=function(_0x48c0ca,_0x20504f){return db['JscriptyProject']['create'](_0x48c0ca[_0xb533('0x44')],{})[_0xb533('0x1e')](function(_0x1901bd){var _0x3d5ec6=_0x48c0ca[_0xb533('0x45')][_0xb533('0x1f')]({'plain':!![]});if(!_0x3d5ec6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d5ec6['role']===_0xb533('0x45')){var _0x7d05d1=_0x1901bd[_0xb533('0x1f')]({'plain':!![]});var _0x1532d6=_0xb533('0x20');return db[_0xb533('0x46')][_0xb533('0x47')]({'where':{'name':_0x1532d6,'userProfileId':_0x3d5ec6['userProfileId']},'raw':!![]})[_0xb533('0x1e')](function(_0x11bfdf){if(_0x11bfdf&&_0x11bfdf[_0xb533('0x48')]===0x0){return db[_0xb533('0x21')][_0xb533('0x43')]({'name':_0x7d05d1[_0xb533('0x25')],'resourceId':_0x7d05d1['id'],'type':_0x11bfdf[_0xb533('0x25')],'sectionId':_0x11bfdf['id']},{})[_0xb533('0x1e')](function(){return _0x1901bd;});}else{return _0x1901bd;}})[_0xb533('0x42')](function(_0x1e4692){logger[_0xb533('0x49')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e4692);throw _0x1e4692;});}return _0x1901bd;})[_0xb533('0x1e')](respondWithResult(_0x20504f,0xc9))[_0xb533('0x42')](handleError(_0x20504f,null));};exports[_0xb533('0x4a')]=function(_0x105829,_0x3a018c){var _0x5cdd2d={'raw':![],'where':{'id':_0x105829[_0xb533('0x40')]['id']}},_0x3eb5fc={};_0x3eb5fc[_0xb533('0x29')]=_[_0xb533('0x2b')](db[_0xb533('0x27')][_0xb533('0x28')]);_0x5cdd2d[_0xb533('0x30')]=_[_0xb533('0x2d')](_0x3eb5fc[_0xb533('0x29')],qs[_0xb533('0x2e')](_0x105829[_0xb533('0x2a')]['fields']));_0x5cdd2d[_0xb533('0x30')]=_0x5cdd2d['attributes'][_0xb533('0x2f')]?_0x5cdd2d[_0xb533('0x30')]:_0x3eb5fc['model'];if(_0x105829['query'][_0xb533('0x3c')]){_0x5cdd2d[_0xb533('0x3d')]=[{'all':!![]}];}_0x5cdd2d=_[_0xb533('0x38')]({},_0x5cdd2d,_0x105829['options']);return db[_0xb533('0x27')][_0xb533('0x47')](_0x5cdd2d)[_0xb533('0x1e')](handleEntityNotFound(_0x3a018c,null))[_0xb533('0x1e')](function(_0x5a1a53){if(_0x5a1a53){var _0x210010=_0x5a1a53['get']({'plain':!![]});_0x210010=qs[_0xb533('0x4b')](_0x210010,['id',_0xb533('0x4c'),_0xb533('0x4d')]);_0x105829[_0xb533('0x44')]=_[_0xb533('0x4b')](_0x105829[_0xb533('0x44')],['id',_0xb533('0x4c'),_0xb533('0x4d')]);return db[_0xb533('0x27')][_0xb533('0x43')](_[_0xb533('0x38')](_0x210010,_0x105829['body']),{'include':_0x105829[_0xb533('0x2a')][_0xb533('0x3c')]?[{'all':!![]}]:undefined})[_0xb533('0x1e')](function(_0x8f176){var _0x332a4a=_0x105829['user'][_0xb533('0x1f')]({'plain':!![]});if(!_0x332a4a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x332a4a['role']===_0xb533('0x45')){var _0x99a070=_0x8f176[_0xb533('0x1f')]({'plain':!![]});var _0x483a86=_0xb533('0x20');return db[_0xb533('0x46')][_0xb533('0x47')]({'where':{'name':_0x483a86,'userProfileId':_0x332a4a['userProfileId']},'raw':!![]})[_0xb533('0x1e')](function(_0x5f3e1f){if(_0x5f3e1f&&_0x5f3e1f['autoAssociation']===0x0){return db['UserProfileResource'][_0xb533('0x43')]({'name':_0x99a070[_0xb533('0x25')],'resourceId':_0x99a070['id'],'type':_0x5f3e1f[_0xb533('0x25')],'sectionId':_0x5f3e1f['id']},{})['then'](function(){return _0x8f176;});}else{return _0x8f176;}})[_0xb533('0x42')](function(_0x205bf9){logger[_0xb533('0x49')](_0xb533('0x4e'),_0x205bf9);throw _0x205bf9;});}return _0x8f176;});}})[_0xb533('0x1e')](respondWithResult(_0x3a018c,0xc9))[_0xb533('0x42')](handleError(_0x3a018c,null));};exports['update']=function(_0xbaeff7,_0x2c7fc9){if(_0xbaeff7[_0xb533('0x44')]['id']){delete _0xbaeff7[_0xb533('0x44')]['id'];}return db['JscriptyProject'][_0xb533('0x47')]({'where':{'id':_0xbaeff7['params']['id']}})[_0xb533('0x1e')](handleEntityNotFound(_0x2c7fc9,null))[_0xb533('0x1e')](saveUpdates(_0xbaeff7[_0xb533('0x44')],null))[_0xb533('0x1e')](respondWithResult(_0x2c7fc9,null))[_0xb533('0x42')](handleError(_0x2c7fc9,null));};exports[_0xb533('0x22')]=function(_0x27a1a5,_0x31fc10){return db[_0xb533('0x27')][_0xb533('0x47')]({'where':{'id':_0x27a1a5[_0xb533('0x40')]['id']}})['then'](handleEntityNotFound(_0x31fc10,null))[_0xb533('0x1e')](removeEntity(_0x31fc10,null))[_0xb533('0x42')](handleError(_0x31fc10,null));};exports[_0xb533('0x4f')]=function(_0x324b05,_0x2f28e3,_0x36d998){var _0x498558={'raw':!![],'where':{}};var _0x2a71ac={};var _0x592254={'count':0x0,'rows':[]};return db[_0xb533('0x27')][_0xb533('0x50')]({'where':{'id':_0x324b05[_0xb533('0x40')]['id']}})[_0xb533('0x1e')](handleEntityNotFound(_0x2f28e3,null))['then'](function(_0x57d522){if(_0x57d522){_0x2a71ac[_0xb533('0x29')]=_['keys'](db[_0xb533('0x51')][_0xb533('0x28')]);_0x2a71ac[_0xb533('0x2a')]=_[_0xb533('0x2b')](_0x324b05['query']);_0x2a71ac[_0xb533('0x2c')]=_[_0xb533('0x2d')](_0x2a71ac[_0xb533('0x29')],_0x2a71ac[_0xb533('0x2a')]);_0x498558[_0xb533('0x30')]=_[_0xb533('0x2d')](_0x2a71ac['model'],qs[_0xb533('0x2e')](_0x324b05[_0xb533('0x2a')][_0xb533('0x2e')]));_0x498558[_0xb533('0x30')]=_0x498558['attributes'][_0xb533('0x2f')]?_0x498558[_0xb533('0x30')]:_0x2a71ac[_0xb533('0x29')];if(!_0x324b05[_0xb533('0x2a')]['hasOwnProperty'](_0xb533('0x32'))){_0x498558[_0xb533('0x19')]=qs[_0xb533('0x19')](_0x324b05['query']['limit']);_0x498558['offset']=qs['offset'](_0x324b05[_0xb533('0x2a')]['offset']);}_0x498558[_0xb533('0x33')]=qs['sort'](_0x324b05[_0xb533('0x2a')][_0xb533('0x34')]);_0x498558['where']=qs[_0xb533('0x2c')](_[_0xb533('0x36')](_0x324b05[_0xb533('0x2a')],_0x2a71ac[_0xb533('0x2c')]));_0x498558[_0xb533('0x35')][_0xb533('0x52')]=_0x57d522['id'];if(_0x324b05[_0xb533('0x2a')]['filter']){_0x498558[_0xb533('0x35')]=_[_0xb533('0x38')](_0x498558[_0xb533('0x35')],{'$or':_[_0xb533('0x53')](_0x498558[_0xb533('0x30')],function(_0x225632){var _0x362200={};_0x362200[_0x225632]={'$like':'%'+_0x324b05['query'][_0xb533('0x37')]+'%'};return _0x362200;})});}_0x498558=_[_0xb533('0x38')]({},_0x498558,_0x324b05[_0xb533('0x41')]);return db[_0xb533('0x51')][_0xb533('0x17')]({'where':_0x498558['where']})['then'](function(_0x13f451){_0x592254['count']=_0x13f451;if(_0x324b05['query'][_0xb533('0x3c')]){_0x498558['include']=[{'all':!![]}];}return db[_0xb533('0x51')][_0xb533('0x3e')](_0x498558);})[_0xb533('0x1e')](function(_0x9a805){_0x592254[_0xb533('0x54')]=_0x9a805;return _0x592254;});}})[_0xb533('0x1e')](respondWithFilteredResult(_0x2f28e3,_0x498558))[_0xb533('0x42')](handleError(_0x2f28e3,null));};exports[_0xb533('0x55')]=function(_0x1fb196,_0x4e2da6,_0x37b074){var _0x2a6837={'raw':!![],'where':{}};var _0x33d0f4={};var _0x34b0bb={'count':0x0,'rows':[]};return db[_0xb533('0x27')][_0xb533('0x50')]({'where':{'id':_0x1fb196[_0xb533('0x40')]['id']}})[_0xb533('0x1e')](handleEntityNotFound(_0x4e2da6,null))[_0xb533('0x1e')](function(_0x2fc1f9){if(_0x2fc1f9){_0x33d0f4[_0xb533('0x29')]=_[_0xb533('0x2b')](db[_0xb533('0x56')][_0xb533('0x28')]);_0x33d0f4[_0xb533('0x2a')]=_[_0xb533('0x2b')](_0x1fb196[_0xb533('0x2a')]);_0x33d0f4['filters']=_[_0xb533('0x2d')](_0x33d0f4[_0xb533('0x29')],_0x33d0f4['query']);_0x2a6837[_0xb533('0x30')]=_['intersection'](_0x33d0f4['model'],qs['fields'](_0x1fb196['query'][_0xb533('0x2e')]));_0x2a6837['attributes']=_0x2a6837['attributes'][_0xb533('0x2f')]?_0x2a6837[_0xb533('0x30')]:_0x33d0f4[_0xb533('0x29')];if(!_0x1fb196[_0xb533('0x2a')][_0xb533('0x31')](_0xb533('0x32'))){_0x2a6837[_0xb533('0x19')]=qs[_0xb533('0x19')](_0x1fb196[_0xb533('0x2a')][_0xb533('0x19')]);_0x2a6837[_0xb533('0x18')]=qs[_0xb533('0x18')](_0x1fb196[_0xb533('0x2a')][_0xb533('0x18')]);}_0x2a6837[_0xb533('0x33')]=qs[_0xb533('0x34')](_0x1fb196[_0xb533('0x2a')]['sort']);_0x2a6837['where']=qs[_0xb533('0x2c')](_[_0xb533('0x36')](_0x1fb196[_0xb533('0x2a')],_0x33d0f4[_0xb533('0x2c')]));_0x2a6837[_0xb533('0x35')][_0xb533('0x52')]=_0x2fc1f9['id'];if(_0x1fb196['query'][_0xb533('0x37')]){_0x2a6837[_0xb533('0x35')]=_[_0xb533('0x38')](_0x2a6837[_0xb533('0x35')],{'$or':_['map'](_0x2a6837[_0xb533('0x30')],function(_0x23b3a9){var _0x539602={};_0x539602[_0x23b3a9]={'$like':'%'+_0x1fb196[_0xb533('0x2a')][_0xb533('0x37')]+'%'};return _0x539602;})});}_0x2a6837=_['merge']({},_0x2a6837,_0x1fb196['options']);return db[_0xb533('0x56')][_0xb533('0x17')]({'where':_0x2a6837[_0xb533('0x35')]})['then'](function(_0x555fa5){_0x34b0bb[_0xb533('0x17')]=_0x555fa5;if(_0x1fb196['query'][_0xb533('0x3c')]){_0x2a6837[_0xb533('0x3d')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xb533('0x3e')](_0x2a6837);})[_0xb533('0x1e')](function(_0x59f41d){_0x34b0bb[_0xb533('0x54')]=_0x59f41d;return _0x34b0bb;});}})[_0xb533('0x1e')](respondWithFilteredResult(_0x4e2da6,_0x2a6837))[_0xb533('0x42')](handleError(_0x4e2da6,null));};function char(_0x2e321f){return _0xb533('0x57')===typeof _0x2e321f?String['fromCharCode'][_0xb533('0x58')](null,arguments):_0x2e321f;}function needsEncapsulation(_0x159bbf){return!!_0x159bbf&&(_0x159bbf[_0xb533('0x59')]()[_0xb533('0x5a')](char(0xd))>=0x0||_0x159bbf['toString']()['indexOf'](char(0xa))>=0x0||_0x159bbf['toString']()[_0xb533('0x5a')](char(0x2c))>=0x0||_0x159bbf[_0xb533('0x59')]()[_0xb533('0x5a')](char(0x22))>=0x0);}function encapsulate(_0x2c71e6){var _0x461cf1=char(0x22),_0x19d53f='\x5c'+char(0x22),_0x1af93e=_0x2c71e6[_0xb533('0x59')]()[_0xb533('0x5b')](new RegExp(_0x461cf1,'g'),_0x19d53f);return _0x461cf1+_0x1af93e+_0x461cf1;}exports[_0xb533('0x5c')]=function(_0xc15cb8,_0x491e0e,_0x386cba){var _0x13d909,_0xc11a78;var _0x51de9b={'where':{'ProjectId':_0xc15cb8[_0xb533('0x40')]['id']}};if(_0xc15cb8['query'][_0xb533('0x5d')]){_0x51de9b['where']['starttime']=JSON[_0xb533('0x5e')](_0xc15cb8[_0xb533('0x2a')][_0xb533('0x5d')]);}return db['JscriptySessionReport']['findAll'](_0x51de9b)[_0xb533('0x1e')](handleEntityNotFound(_0x491e0e,null))['then'](function(_0x10792c){if(_0x10792c){_0x13d909=_0x10792c;return db[_0xb533('0x5f')][_0xb533('0x3e')]({'where':{'SessionId':{'$in':_[_0xb533('0x53')](_0x13d909,'id')},'ProjectId':_0xc15cb8[_0xb533('0x40')]['id']},'order':'-createdAt'});}})[_0xb533('0x1e')](handleEntityNotFound(_0x491e0e,null))[_0xb533('0x1e')](function(_0x29aae0){if(_0x29aae0){_0xc11a78=_0x29aae0;var _0x2c3b14={};for(var _0x5ad202=0x0,_0x4bf511=_0xc11a78[_0xb533('0x2f')];_0x5ad202<_0x4bf511;_0x5ad202++){if(!_0x2c3b14[_0xb533('0x31')](_0xc11a78[_0x5ad202]['questionId'])){_0x2c3b14[_0xc11a78[_0x5ad202]['questionId']]=needsEncapsulation(_0xc11a78[_0x5ad202][_0xb533('0x60')])?encapsulate(_0xc11a78[_0x5ad202][_0xb533('0x60')]):_0xc11a78[_0x5ad202][_0xb533('0x60')];}}var _0x26416b=[],_0x79fc71={};for(var _0x8a841b=0x0,_0x6f0cc2=_0x13d909['length'];_0x8a841b<_0x6f0cc2;_0x8a841b++){_0x79fc71={'ProjectId':_0xc15cb8['params']['id'],'SessionId':_0x13d909[_0x8a841b]['id'],'StartTime':moment(_0x13d909[_0x8a841b][_0xb533('0x61')])[_0xb533('0x62')](_0xb533('0x63'))};for(var _0x44ebe7=0x0,_0x53dd5c=_0xc11a78[_0xb533('0x2f')];_0x44ebe7<_0x53dd5c;_0x44ebe7++){if(_0xc11a78[_0x44ebe7]['SessionId']==_0x13d909[_0x8a841b]['id']&&_0x2c3b14[_0xb533('0x31')](_0xc11a78[_0x44ebe7][_0xb533('0x64')])){_0x79fc71[_0x2c3b14[_0xc11a78[_0x44ebe7]['questionId']]]=_0xc11a78[_0x44ebe7]['answer'];}}for(var _0x1c2b9e in _0x2c3b14){if(!_0x79fc71[_0xb533('0x31')](_0x2c3b14[_0x1c2b9e])){_0x79fc71[_0x2c3b14[_0x1c2b9e]]=null;}}_0x26416b['push'](_0x79fc71);}return _0x26416b;}})[_0xb533('0x1e')](function(_0x2c49ea){if(!_[_0xb533('0x65')](_0x2c49ea)){var _0x159fc2=toCsv(_0x2c49ea);var _0x4520be=Date[_0xb533('0x66')]();fs[_0xb533('0x67')](util[_0xb533('0x62')](_0xb533('0x68'),_0xc15cb8[_0xb533('0x40')]['id'],_0x4520be),_0x159fc2);_0x491e0e['setHeader'](_0xb533('0x69'),_0xb533('0x6a')+util[_0xb533('0x62')](_0xb533('0x6b'),_0xc15cb8[_0xb533('0x40')]['id'],_0x4520be));_0x491e0e['setHeader'](_0xb533('0x6c'),_0xb533('0x6d'));return _0x491e0e[_0xb533('0x6e')](util[_0xb533('0x62')](_0xb533('0x68'),_0xc15cb8[_0xb533('0x40')]['id'],_0x4520be));}else{return _0x491e0e[_0xb533('0x6f')](0xcc);}})[_0xb533('0x42')](handleError(_0x491e0e,null));}; \ No newline at end of file +var _0x3345=['options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','Projects','getSessions','findOne','JscriptySessionReport','pick','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','questionId','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','map','VIRTUAL','field','JscriptyProject','count','includeAll','include','findAll','rows','catch','params','merge'];(function(_0x43433c,_0x2a80a8){var _0x297b8d=function(_0x53c002){while(--_0x53c002){_0x43433c['push'](_0x43433c['shift']());}};_0x297b8d(++_0x2a80a8);}(_0x3345,0xa1));var _0x5334=function(_0x167e16,_0x2b24bb){_0x167e16=_0x167e16-0x0;var _0x3a78a5=_0x3345[_0x167e16];return _0x3a78a5;};'use strict';var pdf=require(_0x5334('0x0'));var emlformat=require(_0x5334('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5334('0x2'));var moment=require(_0x5334('0x3'));var BPromise=require(_0x5334('0x4'));var Mustache=require(_0x5334('0x5'));var util=require(_0x5334('0x6'));var path=require(_0x5334('0x7'));var sox=require(_0x5334('0x8'));var csv=require(_0x5334('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5334('0xa'));var squel=require(_0x5334('0xb'));var crypto=require(_0x5334('0xc'));var jsforce=require(_0x5334('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5334('0xe'));var authService=require(_0x5334('0xf'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x5334('0x10'));var qs=require(_0x5334('0x11'));var logger=require(_0x5334('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c50ad,_0x45694c){_0x45694c=_0x45694c||0xcc;return function(_0x48d94d){if(_0x48d94d){return _0x1c50ad['sendStatus'](_0x45694c);}return _0x1c50ad[_0x5334('0x13')](_0x45694c)[_0x5334('0x14')]();};}function respondWithResult(_0x586550,_0x54b1a6){_0x54b1a6=_0x54b1a6||0xc8;return function(_0x135fa6){if(_0x135fa6){return _0x586550['status'](_0x54b1a6)[_0x5334('0x15')](_0x135fa6);}};}function respondWithFilteredResult(_0x97ee93,_0x38a448){return function(_0x7a9194){if(_0x7a9194){var _0xb98f9e=_0x7a9194['count'],_0x5bd6ce=_0x38a448[_0x5334('0x16')],_0x6eecb2=_0x38a448[_0x5334('0x16')]+_0x38a448[_0x5334('0x17')],_0x1f6d92;if(_0x6eecb2>=_0xb98f9e){_0x6eecb2=_0xb98f9e;_0x1f6d92=0xc8;}else{_0x1f6d92=0xce;}_0x97ee93[_0x5334('0x13')](_0x1f6d92);return _0x97ee93['set'](_0x5334('0x18'),_0x5bd6ce+'-'+_0x6eecb2+'/'+_0xb98f9e)['json'](_0x7a9194);}return null;};}function patchUpdates(_0x2825c7){return function(_0x8960cd){try{jsonpatch[_0x5334('0x19')](_0x8960cd,_0x2825c7,!![]);}catch(_0x4d2653){return BPromise[_0x5334('0x1a')](_0x4d2653);}return _0x8960cd[_0x5334('0x1b')]();};}function saveUpdates(_0x2daa70,_0x3657de){return function(_0x238bc4){if(_0x238bc4){return _0x238bc4[_0x5334('0x1c')](_0x2daa70)[_0x5334('0x1d')](function(_0x3aede5){return _0x3aede5;});}return null;};}function removeEntity(_0x42679c,_0x450061){return function(_0x3f586e){if(_0x3f586e){return _0x3f586e[_0x5334('0x1e')]()['then'](function(){var _0x4529e5=_0x3f586e[_0x5334('0x1f')]({'plain':!![]});var _0x3f2909='Projects';return db[_0x5334('0x20')]['destroy']({'where':{'type':_0x3f2909,'resourceId':_0x4529e5['id']}})['then'](function(){return _0x3f586e;});})[_0x5334('0x1d')](function(){_0x42679c['status'](0xcc)[_0x5334('0x14')]();});}};}function handleEntityNotFound(_0x16d746,_0x22f222){return function(_0x5cdb1b){if(!_0x5cdb1b){_0x16d746[_0x5334('0x21')](0x194);}return _0x5cdb1b;};}function handleError(_0x1bdd6d,_0x4e7a62){_0x4e7a62=_0x4e7a62||0x1f4;return function(_0x24c00f){logger[_0x5334('0x22')](_0x24c00f[_0x5334('0x23')]);if(_0x24c00f[_0x5334('0x24')]){delete _0x24c00f['name'];}_0x1bdd6d['status'](_0x4e7a62)[_0x5334('0x25')](_0x24c00f);};}exports['index']=function(_0x558368,_0x5bdd12){var _0x1efc7f={},_0x3d7bad={},_0x48015e={'count':0x0,'rows':[]};var _0x1883ed=db['JscriptyProject'][_0x5334('0x26')];_0x3d7bad[_0x5334('0x27')]=_[_0x5334('0x28')](_0x1883ed);_0x3d7bad[_0x5334('0x29')]=_[_0x5334('0x28')](_0x558368[_0x5334('0x29')]);_0x3d7bad[_0x5334('0x2a')]=_[_0x5334('0x2b')](_0x3d7bad[_0x5334('0x27')],_0x3d7bad[_0x5334('0x29')]);_0x1efc7f[_0x5334('0x2c')]=_[_0x5334('0x2b')](_0x3d7bad[_0x5334('0x27')],qs[_0x5334('0x2d')](_0x558368['query']['fields']));_0x1efc7f[_0x5334('0x2c')]=_0x1efc7f[_0x5334('0x2c')][_0x5334('0x2e')]?_0x1efc7f['attributes']:_0x3d7bad[_0x5334('0x27')];if(!_0x558368[_0x5334('0x29')][_0x5334('0x2f')](_0x5334('0x30'))){_0x1efc7f[_0x5334('0x17')]=qs[_0x5334('0x17')](_0x558368[_0x5334('0x29')][_0x5334('0x17')]);_0x1efc7f[_0x5334('0x16')]=qs['offset'](_0x558368[_0x5334('0x29')][_0x5334('0x16')]);}_0x1efc7f[_0x5334('0x31')]=qs[_0x5334('0x32')](_0x558368['query']['sort']);_0x1efc7f[_0x5334('0x33')]=qs[_0x5334('0x2a')](_['pick'](_0x558368['query'],_0x3d7bad[_0x5334('0x2a')]));if(_0x558368['query'][_0x5334('0x34')]){_0x1efc7f['where']=_['merge'](_0x1efc7f[_0x5334('0x33')],{'$or':_[_0x5334('0x35')](_0x1883ed,function(_0x2775ff){if(_0x2775ff['type']['key']!==_0x5334('0x36')){var _0x5dca87={};_0x5dca87[_0x2775ff[_0x5334('0x37')]]={'$like':'%'+_0x558368[_0x5334('0x29')][_0x5334('0x34')]+'%'};return _0x5dca87;}})});}_0x1efc7f=_['merge']({},_0x1efc7f,_0x558368['options']);var _0x2dc757={'where':_0x1efc7f[_0x5334('0x33')]};return db[_0x5334('0x38')][_0x5334('0x39')](_0x2dc757)[_0x5334('0x1d')](function(_0x19b827){_0x48015e[_0x5334('0x39')]=_0x19b827;if(_0x558368[_0x5334('0x29')][_0x5334('0x3a')]){_0x1efc7f[_0x5334('0x3b')]=[{'all':!![]}];}return db[_0x5334('0x38')][_0x5334('0x3c')](_0x1efc7f);})[_0x5334('0x1d')](function(_0x17eeb0){_0x48015e[_0x5334('0x3d')]=_0x17eeb0;return _0x48015e;})[_0x5334('0x1d')](respondWithFilteredResult(_0x5bdd12,_0x1efc7f))[_0x5334('0x3e')](handleError(_0x5bdd12,null));};exports['show']=function(_0x4d19b5,_0x31dd91){var _0x304cc5={'raw':![],'where':{'id':_0x4d19b5[_0x5334('0x3f')]['id']}},_0x48373f={};_0x48373f[_0x5334('0x27')]=_['keys'](db[_0x5334('0x38')]['rawAttributes']);_0x48373f[_0x5334('0x29')]=_['keys'](_0x4d19b5['query']);_0x48373f['filters']=_[_0x5334('0x2b')](_0x48373f[_0x5334('0x27')],_0x48373f['query']);_0x304cc5['attributes']=_['intersection'](_0x48373f[_0x5334('0x27')],qs[_0x5334('0x2d')](_0x4d19b5[_0x5334('0x29')][_0x5334('0x2d')]));_0x304cc5[_0x5334('0x2c')]=_0x304cc5[_0x5334('0x2c')][_0x5334('0x2e')]?_0x304cc5[_0x5334('0x2c')]:_0x48373f[_0x5334('0x27')];if(_0x4d19b5[_0x5334('0x29')][_0x5334('0x3a')]){_0x304cc5[_0x5334('0x3b')]=[{'all':!![]}];}_0x304cc5=_[_0x5334('0x40')]({},_0x304cc5,_0x4d19b5[_0x5334('0x41')]);return db['JscriptyProject'][_0x5334('0x42')](_0x304cc5)['then'](handleEntityNotFound(_0x31dd91,null))['then'](respondWithResult(_0x31dd91,null))[_0x5334('0x3e')](handleError(_0x31dd91,null));};exports[_0x5334('0x43')]=function(_0x1b88c8,_0x25bac9){return db['JscriptyProject']['create'](_0x1b88c8[_0x5334('0x44')],{})['then'](function(_0x379e51){var _0x286966=_0x1b88c8[_0x5334('0x45')][_0x5334('0x1f')]({'plain':!![]});if(!_0x286966)throw new Error(_0x5334('0x46'));if(_0x286966[_0x5334('0x47')]===_0x5334('0x45')){var _0x3431bd=_0x379e51[_0x5334('0x1f')]({'plain':!![]});var _0x53e83a='Projects';return db[_0x5334('0x48')][_0x5334('0x42')]({'where':{'name':_0x53e83a,'userProfileId':_0x286966[_0x5334('0x49')]},'raw':!![]})[_0x5334('0x1d')](function(_0xe23cc1){if(_0xe23cc1&&_0xe23cc1[_0x5334('0x4a')]===0x0){return db[_0x5334('0x20')][_0x5334('0x43')]({'name':_0x3431bd['name'],'resourceId':_0x3431bd['id'],'type':_0xe23cc1[_0x5334('0x24')],'sectionId':_0xe23cc1['id']},{})[_0x5334('0x1d')](function(){return _0x379e51;});}else{return _0x379e51;}})[_0x5334('0x3e')](function(_0x46855f){logger[_0x5334('0x22')](_0x5334('0x4b'),_0x46855f);throw _0x46855f;});}return _0x379e51;})[_0x5334('0x1d')](respondWithResult(_0x25bac9,0xc9))[_0x5334('0x3e')](handleError(_0x25bac9,null));};exports[_0x5334('0x4c')]=function(_0x58df9d,_0x293793){var _0x26d5ef={'raw':![],'where':{'id':_0x58df9d['params']['id']}},_0x32ce6e={};_0x32ce6e['model']=_[_0x5334('0x28')](db[_0x5334('0x38')][_0x5334('0x26')]);_0x26d5ef[_0x5334('0x2c')]=_[_0x5334('0x2b')](_0x32ce6e[_0x5334('0x27')],qs['fields'](_0x58df9d[_0x5334('0x29')][_0x5334('0x2d')]));_0x26d5ef[_0x5334('0x2c')]=_0x26d5ef[_0x5334('0x2c')]['length']?_0x26d5ef[_0x5334('0x2c')]:_0x32ce6e[_0x5334('0x27')];if(_0x58df9d['query'][_0x5334('0x3a')]){_0x26d5ef[_0x5334('0x3b')]=[{'all':!![]}];}_0x26d5ef=_[_0x5334('0x40')]({},_0x26d5ef,_0x58df9d[_0x5334('0x41')]);return db[_0x5334('0x38')][_0x5334('0x42')](_0x26d5ef)['then'](handleEntityNotFound(_0x293793,null))[_0x5334('0x1d')](function(_0x286c9b){if(_0x286c9b){var _0x26155b=_0x286c9b[_0x5334('0x1f')]({'plain':!![]});_0x26155b=qs[_0x5334('0x4d')](_0x26155b,['id',_0x5334('0x4e'),'updatedAt']);_0x58df9d[_0x5334('0x44')]=_['omit'](_0x58df9d[_0x5334('0x44')],['id',_0x5334('0x4e'),'updatedAt']);return db['JscriptyProject']['create'](_[_0x5334('0x40')](_0x26155b,_0x58df9d[_0x5334('0x44')]),{'include':_0x58df9d[_0x5334('0x29')][_0x5334('0x3a')]?[{'all':!![]}]:undefined})[_0x5334('0x1d')](function(_0x37d8bb){var _0x44687a=_0x58df9d[_0x5334('0x45')]['get']({'plain':!![]});if(!_0x44687a)throw new Error(_0x5334('0x46'));if(_0x44687a[_0x5334('0x47')]==='user'){var _0x123634=_0x37d8bb['get']({'plain':!![]});var _0xc4a79d=_0x5334('0x4f');return db[_0x5334('0x48')][_0x5334('0x42')]({'where':{'name':_0xc4a79d,'userProfileId':_0x44687a[_0x5334('0x49')]},'raw':!![]})[_0x5334('0x1d')](function(_0x176c82){if(_0x176c82&&_0x176c82[_0x5334('0x4a')]===0x0){return db[_0x5334('0x20')][_0x5334('0x43')]({'name':_0x123634['name'],'resourceId':_0x123634['id'],'type':_0x176c82[_0x5334('0x24')],'sectionId':_0x176c82['id']},{})['then'](function(){return _0x37d8bb;});}else{return _0x37d8bb;}})[_0x5334('0x3e')](function(_0x2d4034){logger[_0x5334('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d4034);throw _0x2d4034;});}return _0x37d8bb;});}})[_0x5334('0x1d')](respondWithResult(_0x293793,0xc9))[_0x5334('0x3e')](handleError(_0x293793,null));};exports['update']=function(_0x381d85,_0x406c3f){if(_0x381d85[_0x5334('0x44')]['id']){delete _0x381d85['body']['id'];}return db[_0x5334('0x38')][_0x5334('0x42')]({'where':{'id':_0x381d85[_0x5334('0x3f')]['id']}})[_0x5334('0x1d')](handleEntityNotFound(_0x406c3f,null))[_0x5334('0x1d')](saveUpdates(_0x381d85[_0x5334('0x44')],null))[_0x5334('0x1d')](respondWithResult(_0x406c3f,null))['catch'](handleError(_0x406c3f,null));};exports[_0x5334('0x1e')]=function(_0x48d988,_0x3e1c8e){return db[_0x5334('0x38')][_0x5334('0x42')]({'where':{'id':_0x48d988[_0x5334('0x3f')]['id']}})[_0x5334('0x1d')](handleEntityNotFound(_0x3e1c8e,null))[_0x5334('0x1d')](removeEntity(_0x3e1c8e,null))[_0x5334('0x3e')](handleError(_0x3e1c8e,null));};exports[_0x5334('0x50')]=function(_0x36f627,_0x3eac78,_0x497dfc){var _0x3fe19a={'raw':!![],'where':{}};var _0x415d7d={};var _0x474d5f={'count':0x0,'rows':[]};return db[_0x5334('0x38')][_0x5334('0x51')]({'where':{'id':_0x36f627[_0x5334('0x3f')]['id']}})[_0x5334('0x1d')](handleEntityNotFound(_0x3eac78,null))[_0x5334('0x1d')](function(_0x3fe289){if(_0x3fe289){_0x415d7d[_0x5334('0x27')]=_[_0x5334('0x28')](db[_0x5334('0x52')]['rawAttributes']);_0x415d7d[_0x5334('0x29')]=_[_0x5334('0x28')](_0x36f627['query']);_0x415d7d[_0x5334('0x2a')]=_[_0x5334('0x2b')](_0x415d7d[_0x5334('0x27')],_0x415d7d['query']);_0x3fe19a['attributes']=_[_0x5334('0x2b')](_0x415d7d['model'],qs['fields'](_0x36f627[_0x5334('0x29')][_0x5334('0x2d')]));_0x3fe19a[_0x5334('0x2c')]=_0x3fe19a[_0x5334('0x2c')][_0x5334('0x2e')]?_0x3fe19a[_0x5334('0x2c')]:_0x415d7d[_0x5334('0x27')];if(!_0x36f627[_0x5334('0x29')]['hasOwnProperty'](_0x5334('0x30'))){_0x3fe19a['limit']=qs['limit'](_0x36f627[_0x5334('0x29')][_0x5334('0x17')]);_0x3fe19a['offset']=qs[_0x5334('0x16')](_0x36f627[_0x5334('0x29')][_0x5334('0x16')]);}_0x3fe19a[_0x5334('0x31')]=qs[_0x5334('0x32')](_0x36f627[_0x5334('0x29')][_0x5334('0x32')]);_0x3fe19a['where']=qs['filters'](_[_0x5334('0x53')](_0x36f627[_0x5334('0x29')],_0x415d7d[_0x5334('0x2a')]));_0x3fe19a[_0x5334('0x33')][_0x5334('0x54')]=_0x3fe289['id'];if(_0x36f627[_0x5334('0x29')]['filter']){_0x3fe19a['where']=_[_0x5334('0x40')](_0x3fe19a[_0x5334('0x33')],{'$or':_[_0x5334('0x35')](_0x3fe19a[_0x5334('0x2c')],function(_0x3f7a28){var _0x3e3ea9={};_0x3e3ea9[_0x3f7a28]={'$like':'%'+_0x36f627['query']['filter']+'%'};return _0x3e3ea9;})});}_0x3fe19a=_[_0x5334('0x40')]({},_0x3fe19a,_0x36f627[_0x5334('0x41')]);return db[_0x5334('0x52')][_0x5334('0x39')]({'where':_0x3fe19a['where']})[_0x5334('0x1d')](function(_0x4fe1a7){_0x474d5f[_0x5334('0x39')]=_0x4fe1a7;if(_0x36f627['query'][_0x5334('0x3a')]){_0x3fe19a['include']=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x3fe19a);})[_0x5334('0x1d')](function(_0x5dbd15){_0x474d5f[_0x5334('0x3d')]=_0x5dbd15;return _0x474d5f;});}})[_0x5334('0x1d')](respondWithFilteredResult(_0x3eac78,_0x3fe19a))[_0x5334('0x3e')](handleError(_0x3eac78,null));};exports[_0x5334('0x55')]=function(_0x187f68,_0x1b2cc3,_0x9f0de0){var _0x511e99={'raw':!![],'where':{}};var _0x4c17eb={};var _0x21d739={'count':0x0,'rows':[]};return db[_0x5334('0x38')]['findOne']({'where':{'id':_0x187f68[_0x5334('0x3f')]['id']}})[_0x5334('0x1d')](handleEntityNotFound(_0x1b2cc3,null))[_0x5334('0x1d')](function(_0x1e3202){if(_0x1e3202){_0x4c17eb[_0x5334('0x27')]=_[_0x5334('0x28')](db[_0x5334('0x56')][_0x5334('0x26')]);_0x4c17eb[_0x5334('0x29')]=_[_0x5334('0x28')](_0x187f68['query']);_0x4c17eb[_0x5334('0x2a')]=_[_0x5334('0x2b')](_0x4c17eb[_0x5334('0x27')],_0x4c17eb[_0x5334('0x29')]);_0x511e99[_0x5334('0x2c')]=_[_0x5334('0x2b')](_0x4c17eb[_0x5334('0x27')],qs[_0x5334('0x2d')](_0x187f68[_0x5334('0x29')][_0x5334('0x2d')]));_0x511e99[_0x5334('0x2c')]=_0x511e99[_0x5334('0x2c')][_0x5334('0x2e')]?_0x511e99[_0x5334('0x2c')]:_0x4c17eb['model'];if(!_0x187f68[_0x5334('0x29')]['hasOwnProperty'](_0x5334('0x30'))){_0x511e99[_0x5334('0x17')]=qs[_0x5334('0x17')](_0x187f68['query'][_0x5334('0x17')]);_0x511e99[_0x5334('0x16')]=qs[_0x5334('0x16')](_0x187f68[_0x5334('0x29')][_0x5334('0x16')]);}_0x511e99[_0x5334('0x31')]=qs[_0x5334('0x32')](_0x187f68[_0x5334('0x29')][_0x5334('0x32')]);_0x511e99[_0x5334('0x33')]=qs[_0x5334('0x2a')](_['pick'](_0x187f68[_0x5334('0x29')],_0x4c17eb['filters']));_0x511e99[_0x5334('0x33')]['ProjectId']=_0x1e3202['id'];if(_0x187f68['query'][_0x5334('0x34')]){_0x511e99[_0x5334('0x33')]=_[_0x5334('0x40')](_0x511e99[_0x5334('0x33')],{'$or':_[_0x5334('0x35')](_0x511e99['attributes'],function(_0x216eae){var _0x41850b={};_0x41850b[_0x216eae]={'$like':'%'+_0x187f68[_0x5334('0x29')]['filter']+'%'};return _0x41850b;})});}_0x511e99=_['merge']({},_0x511e99,_0x187f68[_0x5334('0x41')]);return db[_0x5334('0x56')][_0x5334('0x39')]({'where':_0x511e99[_0x5334('0x33')]})['then'](function(_0x197ad3){_0x21d739['count']=_0x197ad3;if(_0x187f68[_0x5334('0x29')][_0x5334('0x3a')]){_0x511e99[_0x5334('0x3b')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x511e99);})[_0x5334('0x1d')](function(_0x55e642){_0x21d739[_0x5334('0x3d')]=_0x55e642;return _0x21d739;});}})[_0x5334('0x1d')](respondWithFilteredResult(_0x1b2cc3,_0x511e99))[_0x5334('0x3e')](handleError(_0x1b2cc3,null));};function char(_0x4dc6db){return _0x5334('0x57')===typeof _0x4dc6db?String[_0x5334('0x58')][_0x5334('0x19')](null,arguments):_0x4dc6db;}function needsEncapsulation(_0x4df7dd){return!!_0x4df7dd&&(_0x4df7dd[_0x5334('0x59')]()[_0x5334('0x5a')](char(0xd))>=0x0||_0x4df7dd[_0x5334('0x59')]()['indexOf'](char(0xa))>=0x0||_0x4df7dd['toString']()[_0x5334('0x5a')](char(0x2c))>=0x0||_0x4df7dd[_0x5334('0x59')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x379161){var _0x1655bb=char(0x22),_0x523a50='\x5c'+char(0x22),_0x3d8eab=_0x379161[_0x5334('0x59')]()[_0x5334('0x5b')](new RegExp(_0x1655bb,'g'),_0x523a50);return _0x1655bb+_0x3d8eab+_0x1655bb;}exports[_0x5334('0x5c')]=function(_0x1abdb3,_0x7b9646,_0x49c873){var _0x2c7fe9,_0x5d27f5;var _0x7e0c7a={'where':{'ProjectId':_0x1abdb3[_0x5334('0x3f')]['id']}};if(_0x1abdb3[_0x5334('0x29')][_0x5334('0x5d')]){_0x7e0c7a[_0x5334('0x33')]['starttime']=JSON[_0x5334('0x5e')](_0x1abdb3[_0x5334('0x29')][_0x5334('0x5d')]);}return db[_0x5334('0x52')][_0x5334('0x3c')](_0x7e0c7a)[_0x5334('0x1d')](handleEntityNotFound(_0x7b9646,null))['then'](function(_0x39bba1){if(_0x39bba1){_0x2c7fe9=_0x39bba1;return db[_0x5334('0x5f')][_0x5334('0x3c')]({'where':{'SessionId':{'$in':_[_0x5334('0x35')](_0x2c7fe9,'id')},'ProjectId':_0x1abdb3['params']['id']},'order':_0x5334('0x60')});}})[_0x5334('0x1d')](handleEntityNotFound(_0x7b9646,null))[_0x5334('0x1d')](function(_0x431664){if(_0x431664){_0x5d27f5=_0x431664;var _0x391a1f={};for(var _0x3c9be2=0x0,_0x37f6fb=_0x5d27f5[_0x5334('0x2e')];_0x3c9be2<_0x37f6fb;_0x3c9be2++){if(!_0x391a1f[_0x5334('0x2f')](_0x5d27f5[_0x3c9be2]['questionId'])){_0x391a1f[_0x5d27f5[_0x3c9be2]['questionId']]=needsEncapsulation(_0x5d27f5[_0x3c9be2][_0x5334('0x61')])?encapsulate(_0x5d27f5[_0x3c9be2][_0x5334('0x61')]):_0x5d27f5[_0x3c9be2][_0x5334('0x61')];}}var _0x566eb5=[],_0x40f636={};for(var _0xfd98=0x0,_0x48a147=_0x2c7fe9[_0x5334('0x2e')];_0xfd98<_0x48a147;_0xfd98++){_0x40f636={'ProjectId':_0x1abdb3['params']['id'],'SessionId':_0x2c7fe9[_0xfd98]['id'],'StartTime':moment(_0x2c7fe9[_0xfd98][_0x5334('0x62')])[_0x5334('0x63')](_0x5334('0x64'))};for(var _0xa37482=0x0,_0x4e65c4=_0x5d27f5['length'];_0xa37482<_0x4e65c4;_0xa37482++){if(_0x5d27f5[_0xa37482][_0x5334('0x65')]==_0x2c7fe9[_0xfd98]['id']&&_0x391a1f['hasOwnProperty'](_0x5d27f5[_0xa37482][_0x5334('0x66')])){_0x40f636[_0x391a1f[_0x5d27f5[_0xa37482][_0x5334('0x66')]]]=_0x5d27f5[_0xa37482]['answer'];}}for(var _0x509d06 in _0x391a1f){if(!_0x40f636['hasOwnProperty'](_0x391a1f[_0x509d06])){_0x40f636[_0x391a1f[_0x509d06]]=null;}}_0x566eb5[_0x5334('0x67')](_0x40f636);}return _0x566eb5;}})[_0x5334('0x1d')](function(_0x12062b){if(!_[_0x5334('0x68')](_0x12062b)){var _0x208045=toCsv(_0x12062b);var _0x4c1fad=Date[_0x5334('0x69')]();fs[_0x5334('0x6a')](util[_0x5334('0x63')](_0x5334('0x6b'),_0x1abdb3['params']['id'],_0x4c1fad),_0x208045);_0x7b9646[_0x5334('0x6c')](_0x5334('0x6d'),'attachment;\x20filename='+util[_0x5334('0x63')](_0x5334('0x6e'),_0x1abdb3[_0x5334('0x3f')]['id'],_0x4c1fad));_0x7b9646['setHeader'](_0x5334('0x6f'),'text/csv');return _0x7b9646[_0x5334('0x70')](util[_0x5334('0x63')](_0x5334('0x6b'),_0x1abdb3[_0x5334('0x3f')]['id'],_0x4c1fad));}else{return _0x7b9646[_0x5334('0x21')](0xcc);}})[_0x5334('0x3e')](handleError(_0x7b9646,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 717753b..070268e 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 _0x0b41=['api','bluebird','request-promise','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash','../../config/logger'];(function(_0x2fb52b,_0x513e3e){var _0xea81b6=function(_0x2b0ee8){while(--_0x2b0ee8){_0x2fb52b['push'](_0x2fb52b['shift']());}};_0xea81b6(++_0x513e3e);}(_0x0b41,0x6a));var _0x10b4=function(_0x192057,_0x5e1ce4){_0x192057=_0x192057-0x0;var _0x3a20a1=_0x0b41[_0x192057];return _0x3a20a1;};'use strict';var _=require(_0x10b4('0x0'));var util=require('util');var logger=require(_0x10b4('0x1'))(_0x10b4('0x2'));var moment=require('moment');var BPromise=require(_0x10b4('0x3'));var rp=require(_0x10b4('0x4'));var attributes=require(_0x10b4('0x5'));module['exports']=function(_0x27cf79,_0x2fce00){return _0x27cf79[_0x10b4('0x6')](_0x10b4('0x7'),attributes,{'tableName':_0x10b4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e65=['JscriptyProject','jscripty_projects','lodash','api','bluebird','./jscriptyProject.attributes','define'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5e65,0x152));var _0x55e6=function(_0xceda5a,_0xffe61b){_0xceda5a=_0xceda5a-0x0;var _0x651b94=_0x5e65[_0xceda5a];return _0x651b94;};'use strict';var _=require(_0x55e6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x55e6('0x1'));var moment=require('moment');var BPromise=require(_0x55e6('0x2'));var rp=require('request-promise');var attributes=require(_0x55e6('0x3'));module['exports']=function(_0x516e6f,_0x44da02){return _0x516e6f[_0x55e6('0x4')](_0x55e6('0x5'),attributes,{'tableName':_0x55e6('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index da379ea..110fa54 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 _0x8833=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','JscriptyProject,\x20%s,\x20%s','result','catch','lodash','util','moment'];(function(_0x1414ad,_0x56169b){var _0x5f520d=function(_0x2a7c8d){while(--_0x2a7c8d){_0x1414ad['push'](_0x1414ad['shift']());}};_0x5f520d(++_0x56169b);}(_0x8833,0xb5));var _0x3883=function(_0x12899c,_0x1bf180){_0x12899c=_0x12899c-0x0;var _0x3873e5=_0x8833[_0x12899c];return _0x3873e5;};'use strict';var _=require(_0x3883('0x0'));var util=require(_0x3883('0x1'));var moment=require(_0x3883('0x2'));var BPromise=require(_0x3883('0x3'));var rs=require(_0x3883('0x4'));var fs=require('fs');var Redis=require(_0x3883('0x5'));var db=require(_0x3883('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3883('0x7'))('rpc');var config=require(_0x3883('0x8'));var jayson=require(_0x3883('0x9'));var client=jayson[_0x3883('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3567b6,_0x2461d7,_0x1cab4c){return new BPromise(function(_0x300e13,_0x3c4bed){return client[_0x3883('0xb')](_0x3567b6,_0x1cab4c)[_0x3883('0xc')](function(_0x348b16){logger[_0x3883('0xd')]('JscriptyProject,\x20%s,\x20%s',_0x2461d7,_0x3883('0xe'));logger[_0x3883('0xf')](_0x3883('0x10'),_0x2461d7,_0x3883('0xe'),JSON[_0x3883('0x11')](_0x348b16));if(_0x348b16['error']){if(_0x348b16[_0x3883('0x12')]['code']===0x1f4){logger[_0x3883('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2461d7,_0x348b16[_0x3883('0x12')][_0x3883('0x13')]);return _0x3c4bed(_0x348b16[_0x3883('0x12')][_0x3883('0x13')]);}logger['error'](_0x3883('0x14'),_0x2461d7,_0x348b16[_0x3883('0x12')][_0x3883('0x13')]);return _0x300e13(_0x348b16['error'][_0x3883('0x13')]);}else{logger[_0x3883('0xd')](_0x3883('0x14'),_0x2461d7,_0x3883('0xe'));_0x300e13(_0x348b16[_0x3883('0x15')][_0x3883('0x13')]);}})[_0x3883('0x16')](function(_0x433e98){logger[_0x3883('0x12')](_0x3883('0x14'),_0x2461d7,_0x433e98);_0x3c4bed(_0x433e98);});});} \ No newline at end of file +var _0xf36d=['request\x20sent','debug','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','JscriptyProject,\x20%s,\x20%s'];(function(_0x23a51b,_0x49f2b0){var _0x9e31c=function(_0x573151){while(--_0x573151){_0x23a51b['push'](_0x23a51b['shift']());}};_0x9e31c(++_0x49f2b0);}(_0xf36d,0x1ba));var _0xdf36=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0xf36d[_0x4d1ee9];return _0x9a5456;};'use strict';var _=require(_0xdf36('0x0'));var util=require(_0xdf36('0x1'));var moment=require(_0xdf36('0x2'));var BPromise=require('bluebird');var rs=require(_0xdf36('0x3'));var fs=require('fs');var Redis=require(_0xdf36('0x4'));var db=require(_0xdf36('0x5'))['db'];var utils=require(_0xdf36('0x6'));var logger=require(_0xdf36('0x7'))(_0xdf36('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdf36('0x9')][_0xdf36('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x571cec,_0x1425ab,_0x5866b4){return new BPromise(function(_0x2ef756,_0x123fa0){return client[_0xdf36('0xb')](_0x571cec,_0x5866b4)['then'](function(_0x222e89){logger[_0xdf36('0xc')](_0xdf36('0xd'),_0x1425ab,_0xdf36('0xe'));logger[_0xdf36('0xf')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x1425ab,_0xdf36('0xe'),JSON['stringify'](_0x222e89));if(_0x222e89[_0xdf36('0x10')]){if(_0x222e89[_0xdf36('0x10')]['code']===0x1f4){logger[_0xdf36('0x10')](_0xdf36('0xd'),_0x1425ab,_0x222e89['error'][_0xdf36('0x11')]);return _0x123fa0(_0x222e89[_0xdf36('0x10')]['message']);}logger[_0xdf36('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x1425ab,_0x222e89[_0xdf36('0x10')][_0xdf36('0x11')]);return _0x2ef756(_0x222e89[_0xdf36('0x10')]['message']);}else{logger[_0xdf36('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x1425ab,_0xdf36('0xe'));_0x2ef756(_0x222e89[_0xdf36('0x12')][_0xdf36('0x11')]);}})['catch'](function(_0x3fa131){logger[_0xdf36('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x1425ab,_0x3fa131);_0x123fa0(_0x3fa131);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index f452fad..0a5a60f 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 _0x9dd2=['../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','/:id','post','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x14b80b,_0x4a2bdc){var _0x54fc37=function(_0x3da93c){while(--_0x3da93c){_0x14b80b['push'](_0x14b80b['shift']());}};_0x54fc37(++_0x4a2bdc);}(_0x9dd2,0xd1));var _0x29dd=function(_0xd3bcf8,_0x994fdb){_0xd3bcf8=_0xd3bcf8-0x0;var _0x296170=_0x9dd2[_0xd3bcf8];return _0x296170;};'use strict';var multer=require(_0x29dd('0x0'));var util=require(_0x29dd('0x1'));var path=require(_0x29dd('0x2'));var timeout=require(_0x29dd('0x3'));var express=require(_0x29dd('0x4'));var router=express[_0x29dd('0x5')]();var auth=require(_0x29dd('0x6'));var interaction=require(_0x29dd('0x7'));var config=require('../../config/environment');var controller=require(_0x29dd('0x8'));router[_0x29dd('0x9')]('/',auth[_0x29dd('0xa')](),controller[_0x29dd('0xb')]);router[_0x29dd('0x9')](_0x29dd('0xc'),auth[_0x29dd('0xa')](),controller['describe']);router[_0x29dd('0x9')](_0x29dd('0xd'),auth[_0x29dd('0xa')](),controller['show']);router[_0x29dd('0xe')]('/',auth[_0x29dd('0xa')](),controller['create']);router[_0x29dd('0xf')](_0x29dd('0xd'),auth[_0x29dd('0xa')](),controller[_0x29dd('0x10')]);router[_0x29dd('0x11')](_0x29dd('0xd'),auth[_0x29dd('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9e4c=['show','create','put','update','destroy','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','/:id'];(function(_0x3d2c46,_0x28cc2a){var _0x4b515c=function(_0x24d59c){while(--_0x24d59c){_0x3d2c46['push'](_0x3d2c46['shift']());}};_0x4b515c(++_0x28cc2a);}(_0x9e4c,0x1e1));var _0xc9e4=function(_0xd3395c,_0x54f9cb){_0xd3395c=_0xd3395c-0x0;var _0x5bc956=_0x9e4c[_0xd3395c];return _0x5bc956;};'use strict';var multer=require(_0xc9e4('0x0'));var util=require(_0xc9e4('0x1'));var path=require('path');var timeout=require(_0xc9e4('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xc9e4('0x3'));var interaction=require(_0xc9e4('0x4'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router[_0xc9e4('0x5')]('/',auth[_0xc9e4('0x6')](),controller['index']);router[_0xc9e4('0x5')]('/describe',auth[_0xc9e4('0x6')](),controller[_0xc9e4('0x7')]);router['get'](_0xc9e4('0x8'),auth['isAuthenticated'](),controller[_0xc9e4('0x9')]);router['post']('/',auth[_0xc9e4('0x6')](),controller[_0xc9e4('0xa')]);router[_0xc9e4('0xb')]('/:id',auth[_0xc9e4('0x6')](),controller[_0xc9e4('0xc')]);router['delete'](_0xc9e4('0x8'),auth[_0xc9e4('0x6')](),controller[_0xc9e4('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 41611ea..e132980 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 _0xda55=['STRING','sequelize','exports','long'];(function(_0x56e32e,_0x9eb2f6){var _0x2a757b=function(_0x50b7bc){while(--_0x50b7bc){_0x56e32e['push'](_0x56e32e['shift']());}};_0x2a757b(++_0x9eb2f6);}(_0xda55,0x6d));var _0x5da5=function(_0x5edef8,_0x7af9a9){_0x5edef8=_0x5edef8-0x0;var _0x5438f6=_0xda55[_0x5edef8];return _0x5438f6;};'use strict';var Sequelize=require(_0x5da5('0x0'));module[_0x5da5('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize['TEXT'](_0x5da5('0x2'))},'membername':{'type':Sequelize[_0x5da5('0x3')]},'projectname':{'type':Sequelize[_0x5da5('0x3')]},'queue':{'type':Sequelize[_0x5da5('0x3')]},'uniqueid':{'type':Sequelize[_0x5da5('0x3')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5da5('0x3')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xae7b=['STRING','sequelize','exports'];(function(_0xd39959,_0x302d09){var _0x1ff69c=function(_0x17c97f){while(--_0x17c97f){_0xd39959['push'](_0xd39959['shift']());}};_0x1ff69c(++_0x302d09);}(_0xae7b,0xbe));var _0xbae7=function(_0x237ead,_0x1869d8){_0x237ead=_0x237ead-0x0;var _0x3f78bf=_0xae7b[_0x237ead];return _0x3f78bf;};'use strict';var Sequelize=require(_0xbae7('0x0'));module[_0xbae7('0x1')]={'question':{'type':Sequelize[_0xbae7('0x2')]},'answer':{'type':Sequelize['TEXT']('long')},'membername':{'type':Sequelize[_0xbae7('0x2')]},'projectname':{'type':Sequelize[_0xbae7('0x2')]},'queue':{'type':Sequelize[_0xbae7('0x2')]},'uniqueid':{'type':Sequelize[_0xbae7('0x2')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0xbae7('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 954c831..ef3c402 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 _0x9f0e=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','JscriptyQuestionReport','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','map','type','VIRTUAL','field','options','includeAll','rows','catch','show','params','merge','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger'];(function(_0x52cc7b,_0x2ef451){var _0x42c902=function(_0xe4a379){while(--_0xe4a379){_0x52cc7b['push'](_0x52cc7b['shift']());}};_0x42c902(++_0x2ef451);}(_0x9f0e,0x116));var _0xe9f0=function(_0x1e782b,_0x3db669){_0x1e782b=_0x1e782b-0x0;var _0x23a174=_0x9f0e[_0x1e782b];return _0x23a174;};'use strict';var pdf=require(_0xe9f0('0x0'));var emlformat=require(_0xe9f0('0x1'));var rimraf=require(_0xe9f0('0x2'));var zipdir=require(_0xe9f0('0x3'));var jsonpatch=require(_0xe9f0('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe9f0('0x5'));var Mustache=require(_0xe9f0('0x6'));var util=require(_0xe9f0('0x7'));var path=require(_0xe9f0('0x8'));var sox=require(_0xe9f0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0xe'));var querystring=require(_0xe9f0('0xf'));var Papa=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var hardwareService=require(_0xe9f0('0x12'));var Redis=require(_0xe9f0('0x13'));var qs=require(_0xe9f0('0x14'));var logger=require(_0xe9f0('0x15'))('api');var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var db=require(_0xe9f0('0x18'))['db'];function respondWithStatusCode(_0x4a82aa,_0x207fac){_0x207fac=_0x207fac||0xcc;return function(_0x586763){if(_0x586763){return _0x4a82aa[_0xe9f0('0x19')](_0x207fac);}return _0x4a82aa[_0xe9f0('0x1a')](_0x207fac)[_0xe9f0('0x1b')]();};}function respondWithResult(_0x216601,_0x55a388){_0x55a388=_0x55a388||0xc8;return function(_0x2cf75d){if(_0x2cf75d){return _0x216601['status'](_0x55a388)[_0xe9f0('0x1c')](_0x2cf75d);}};}function respondWithFilteredResult(_0x23914b,_0x3800e8){return function(_0x59320d){if(_0x59320d){var _0x28bfac=_0x59320d[_0xe9f0('0x1d')],_0x33e9e4=_0x3800e8[_0xe9f0('0x1e')],_0x2e68ef=_0x3800e8[_0xe9f0('0x1e')]+_0x3800e8[_0xe9f0('0x1f')],_0x598eee;if(_0x2e68ef>=_0x28bfac){_0x2e68ef=_0x28bfac;_0x598eee=0xc8;}else{_0x598eee=0xce;}_0x23914b[_0xe9f0('0x1a')](_0x598eee);return _0x23914b[_0xe9f0('0x20')](_0xe9f0('0x21'),_0x33e9e4+'-'+_0x2e68ef+'/'+_0x28bfac)['json'](_0x59320d);}return null;};}function patchUpdates(_0x15a33b){return function(_0x19e090){try{jsonpatch[_0xe9f0('0x22')](_0x19e090,_0x15a33b,!![]);}catch(_0x5c4182){return BPromise[_0xe9f0('0x23')](_0x5c4182);}return _0x19e090[_0xe9f0('0x24')]();};}function saveUpdates(_0x1698cf,_0x43f399){return function(_0x5ba788){if(_0x5ba788){return _0x5ba788[_0xe9f0('0x25')](_0x1698cf)[_0xe9f0('0x26')](function(_0x583687){return _0x583687;});}return null;};}function removeEntity(_0x51e03f,_0x4cc403){return function(_0x12fe9f){if(_0x12fe9f){return _0x12fe9f[_0xe9f0('0x27')]()[_0xe9f0('0x26')](function(){_0x51e03f[_0xe9f0('0x1a')](0xcc)[_0xe9f0('0x1b')]();});}};}function handleEntityNotFound(_0x4a5c27,_0x229fe0){return function(_0x38b7ee){if(!_0x38b7ee){_0x4a5c27[_0xe9f0('0x19')](0x194);}return _0x38b7ee;};}function handleError(_0x10801b,_0x3ca991){_0x3ca991=_0x3ca991||0x1f4;return function(_0x372ffd){logger[_0xe9f0('0x28')](_0x372ffd[_0xe9f0('0x29')]);if(_0x372ffd[_0xe9f0('0x2a')]){delete _0x372ffd[_0xe9f0('0x2a')];}_0x10801b['status'](_0x3ca991)[_0xe9f0('0x2b')](_0x372ffd);};}exports[_0xe9f0('0x2c')]=function(_0x2ddfba,_0x1a8478){var _0x4cf1b1={},_0x212a38={},_0x2613fd={'count':0x0,'rows':[]};var _0x856ac8=db[_0xe9f0('0x2d')][_0xe9f0('0x2e')];_0x212a38['model']=_[_0xe9f0('0x2f')](_0x856ac8);_0x212a38[_0xe9f0('0x30')]=_[_0xe9f0('0x2f')](_0x2ddfba[_0xe9f0('0x30')]);_0x212a38[_0xe9f0('0x31')]=_[_0xe9f0('0x32')](_0x212a38[_0xe9f0('0x33')],_0x212a38[_0xe9f0('0x30')]);_0x4cf1b1[_0xe9f0('0x34')]=_[_0xe9f0('0x32')](_0x212a38[_0xe9f0('0x33')],qs[_0xe9f0('0x35')](_0x2ddfba[_0xe9f0('0x30')][_0xe9f0('0x35')]));_0x4cf1b1[_0xe9f0('0x34')]=_0x4cf1b1[_0xe9f0('0x34')][_0xe9f0('0x36')]?_0x4cf1b1[_0xe9f0('0x34')]:_0x212a38[_0xe9f0('0x33')];if(!_0x2ddfba[_0xe9f0('0x30')][_0xe9f0('0x37')](_0xe9f0('0x38'))){_0x4cf1b1[_0xe9f0('0x1f')]=qs[_0xe9f0('0x1f')](_0x2ddfba['query']['limit']);_0x4cf1b1['offset']=qs[_0xe9f0('0x1e')](_0x2ddfba['query'][_0xe9f0('0x1e')]);}_0x4cf1b1[_0xe9f0('0x39')]=qs['sort'](_0x2ddfba[_0xe9f0('0x30')]['sort']);_0x4cf1b1['where']=qs['filters'](_[_0xe9f0('0x3a')](_0x2ddfba[_0xe9f0('0x30')],_0x212a38['filters']));if(_0x2ddfba[_0xe9f0('0x30')][_0xe9f0('0x3b')]){_0x4cf1b1[_0xe9f0('0x3c')]=_['merge'](_0x4cf1b1['where'],{'$or':_[_0xe9f0('0x3d')](_0x856ac8,function(_0x3ff42d){if(_0x3ff42d[_0xe9f0('0x3e')]['key']!==_0xe9f0('0x3f')){var _0x2e7997={};_0x2e7997[_0x3ff42d[_0xe9f0('0x40')]]={'$like':'%'+_0x2ddfba[_0xe9f0('0x30')][_0xe9f0('0x3b')]+'%'};return _0x2e7997;}})});}_0x4cf1b1=_['merge']({},_0x4cf1b1,_0x2ddfba[_0xe9f0('0x41')]);var _0x3a2b23={'where':_0x4cf1b1[_0xe9f0('0x3c')]};return db['JscriptyQuestionReport'][_0xe9f0('0x1d')](_0x3a2b23)[_0xe9f0('0x26')](function(_0x4825f2){_0x2613fd[_0xe9f0('0x1d')]=_0x4825f2;if(_0x2ddfba['query'][_0xe9f0('0x42')]){_0x4cf1b1['include']=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x4cf1b1);})['then'](function(_0x5165f7){_0x2613fd[_0xe9f0('0x43')]=_0x5165f7;return _0x2613fd;})[_0xe9f0('0x26')](respondWithFilteredResult(_0x1a8478,_0x4cf1b1))[_0xe9f0('0x44')](handleError(_0x1a8478,null));};exports[_0xe9f0('0x45')]=function(_0x2560c6,_0xd9b61b){var _0x3d4eb7={'raw':!![],'where':{'id':_0x2560c6[_0xe9f0('0x46')]['id']}},_0x3e79c1={};_0x3e79c1['model']=_[_0xe9f0('0x2f')](db[_0xe9f0('0x2d')][_0xe9f0('0x2e')]);_0x3e79c1['query']=_['keys'](_0x2560c6[_0xe9f0('0x30')]);_0x3e79c1['filters']=_[_0xe9f0('0x32')](_0x3e79c1[_0xe9f0('0x33')],_0x3e79c1[_0xe9f0('0x30')]);_0x3d4eb7[_0xe9f0('0x34')]=_['intersection'](_0x3e79c1[_0xe9f0('0x33')],qs[_0xe9f0('0x35')](_0x2560c6[_0xe9f0('0x30')][_0xe9f0('0x35')]));_0x3d4eb7[_0xe9f0('0x34')]=_0x3d4eb7['attributes'][_0xe9f0('0x36')]?_0x3d4eb7[_0xe9f0('0x34')]:_0x3e79c1[_0xe9f0('0x33')];if(_0x2560c6[_0xe9f0('0x30')][_0xe9f0('0x42')]){_0x3d4eb7['include']=[{'all':!![]}];}_0x3d4eb7=_[_0xe9f0('0x47')]({},_0x3d4eb7,_0x2560c6['options']);return db['JscriptyQuestionReport'][_0xe9f0('0x48')](_0x3d4eb7)[_0xe9f0('0x26')](handleEntityNotFound(_0xd9b61b,null))['then'](respondWithResult(_0xd9b61b,null))[_0xe9f0('0x44')](handleError(_0xd9b61b,null));};exports[_0xe9f0('0x49')]=function(_0x42d859,_0x7b167b){return db[_0xe9f0('0x2d')][_0xe9f0('0x49')](_0x42d859[_0xe9f0('0x4a')],{})['then'](respondWithResult(_0x7b167b,0xc9))[_0xe9f0('0x44')](handleError(_0x7b167b,null));};exports['update']=function(_0x3b8712,_0x5a3488){if(_0x3b8712[_0xe9f0('0x4a')]['id']){delete _0x3b8712['body']['id'];}return db[_0xe9f0('0x2d')][_0xe9f0('0x48')]({'where':{'id':_0x3b8712[_0xe9f0('0x46')]['id']}})['then'](handleEntityNotFound(_0x5a3488,null))[_0xe9f0('0x26')](saveUpdates(_0x3b8712[_0xe9f0('0x4a')],null))[_0xe9f0('0x26')](respondWithResult(_0x5a3488,null))[_0xe9f0('0x44')](handleError(_0x5a3488,null));};exports[_0xe9f0('0x27')]=function(_0x135175,_0x6ece3f){return db[_0xe9f0('0x2d')][_0xe9f0('0x48')]({'where':{'id':_0x135175[_0xe9f0('0x46')]['id']}})[_0xe9f0('0x26')](handleEntityNotFound(_0x6ece3f,null))[_0xe9f0('0x26')](removeEntity(_0x6ece3f,null))['catch'](handleError(_0x6ece3f,null));};exports['describe']=function(_0x31aa19,_0x1f0c8b){return db[_0xe9f0('0x2d')]['describe']()[_0xe9f0('0x26')](respondWithResult(_0x1f0c8b,null))['catch'](handleError(_0x1f0c8b,null));}; \ No newline at end of file +var _0x32b6=['offset','set','Content-Range','apply','save','destroy','end','name','send','JscriptyQuestionReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','map','type','key','VIRTUAL','filter','options','count','then','includeAll','include','findAll','rows','find','catch','create','body','update','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json'];(function(_0xcfab97,_0x1a33f){var _0x32a47=function(_0x550f50){while(--_0x550f50){_0xcfab97['push'](_0xcfab97['shift']());}};_0x32a47(++_0x1a33f);}(_0x32b6,0x1d1));var _0x632b=function(_0x3b0401,_0x42496f){_0x3b0401=_0x3b0401-0x0;var _0x232003=_0x32b6[_0x3b0401];return _0x232003;};'use strict';var pdf=require(_0x632b('0x0'));var emlformat=require(_0x632b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x632b('0x2'));var jsonpatch=require(_0x632b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x632b('0x4'));var Mustache=require(_0x632b('0x5'));var util=require(_0x632b('0x6'));var path=require(_0x632b('0x7'));var sox=require(_0x632b('0x8'));var csv=require(_0x632b('0x9'));var ejs=require(_0x632b('0xa'));var fs=require('fs');var _=require(_0x632b('0xb'));var squel=require(_0x632b('0xc'));var crypto=require(_0x632b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x632b('0xe'));var toCsv=require(_0x632b('0x9'));var querystring=require(_0x632b('0xf'));var Papa=require(_0x632b('0x10'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0x632b('0x11'));var logger=require('../../config/logger')(_0x632b('0x12'));var utils=require(_0x632b('0x13'));var config=require(_0x632b('0x14'));var db=require(_0x632b('0x15'))['db'];function respondWithStatusCode(_0x249417,_0x2e1dbc){_0x2e1dbc=_0x2e1dbc||0xcc;return function(_0xe81378){if(_0xe81378){return _0x249417[_0x632b('0x16')](_0x2e1dbc);}return _0x249417[_0x632b('0x17')](_0x2e1dbc)['end']();};}function respondWithResult(_0xb5416c,_0x286f75){_0x286f75=_0x286f75||0xc8;return function(_0x9246a6){if(_0x9246a6){return _0xb5416c['status'](_0x286f75)[_0x632b('0x18')](_0x9246a6);}};}function respondWithFilteredResult(_0x1a3a60,_0x108249){return function(_0x17ff9b){if(_0x17ff9b){var _0x40d410=_0x17ff9b['count'],_0x21cdd3=_0x108249['offset'],_0x4efe39=_0x108249[_0x632b('0x19')]+_0x108249['limit'],_0x17ddc5;if(_0x4efe39>=_0x40d410){_0x4efe39=_0x40d410;_0x17ddc5=0xc8;}else{_0x17ddc5=0xce;}_0x1a3a60[_0x632b('0x17')](_0x17ddc5);return _0x1a3a60[_0x632b('0x1a')](_0x632b('0x1b'),_0x21cdd3+'-'+_0x4efe39+'/'+_0x40d410)['json'](_0x17ff9b);}return null;};}function patchUpdates(_0x2f3e88){return function(_0x32ca1){try{jsonpatch[_0x632b('0x1c')](_0x32ca1,_0x2f3e88,!![]);}catch(_0x3683e4){return BPromise['reject'](_0x3683e4);}return _0x32ca1[_0x632b('0x1d')]();};}function saveUpdates(_0xd9d29f,_0x4f377f){return function(_0x116f62){if(_0x116f62){return _0x116f62['update'](_0xd9d29f)['then'](function(_0x1b1092){return _0x1b1092;});}return null;};}function removeEntity(_0x5ce3fa,_0xc9d237){return function(_0x1c4530){if(_0x1c4530){return _0x1c4530[_0x632b('0x1e')]()['then'](function(){_0x5ce3fa[_0x632b('0x17')](0xcc)[_0x632b('0x1f')]();});}};}function handleEntityNotFound(_0x59d83a,_0x1db8f5){return function(_0x379dc2){if(!_0x379dc2){_0x59d83a[_0x632b('0x16')](0x194);}return _0x379dc2;};}function handleError(_0x1e448c,_0x45d017){_0x45d017=_0x45d017||0x1f4;return function(_0x183c5c){logger['error'](_0x183c5c['stack']);if(_0x183c5c[_0x632b('0x20')]){delete _0x183c5c['name'];}_0x1e448c[_0x632b('0x17')](_0x45d017)[_0x632b('0x21')](_0x183c5c);};}exports['index']=function(_0x273e89,_0x3f4eab){var _0x29d9aa={},_0x18dc8c={},_0x4728a8={'count':0x0,'rows':[]};var _0x515d74=db[_0x632b('0x22')][_0x632b('0x23')];_0x18dc8c[_0x632b('0x24')]=_['keys'](_0x515d74);_0x18dc8c[_0x632b('0x25')]=_[_0x632b('0x26')](_0x273e89[_0x632b('0x25')]);_0x18dc8c[_0x632b('0x27')]=_[_0x632b('0x28')](_0x18dc8c[_0x632b('0x24')],_0x18dc8c[_0x632b('0x25')]);_0x29d9aa[_0x632b('0x29')]=_[_0x632b('0x28')](_0x18dc8c[_0x632b('0x24')],qs[_0x632b('0x2a')](_0x273e89[_0x632b('0x25')][_0x632b('0x2a')]));_0x29d9aa[_0x632b('0x29')]=_0x29d9aa[_0x632b('0x29')][_0x632b('0x2b')]?_0x29d9aa[_0x632b('0x29')]:_0x18dc8c[_0x632b('0x24')];if(!_0x273e89[_0x632b('0x25')][_0x632b('0x2c')]('nolimit')){_0x29d9aa[_0x632b('0x2d')]=qs[_0x632b('0x2d')](_0x273e89[_0x632b('0x25')][_0x632b('0x2d')]);_0x29d9aa['offset']=qs[_0x632b('0x19')](_0x273e89['query'][_0x632b('0x19')]);}_0x29d9aa[_0x632b('0x2e')]=qs['sort'](_0x273e89[_0x632b('0x25')][_0x632b('0x2f')]);_0x29d9aa[_0x632b('0x30')]=qs[_0x632b('0x27')](_[_0x632b('0x31')](_0x273e89[_0x632b('0x25')],_0x18dc8c[_0x632b('0x27')]));if(_0x273e89[_0x632b('0x25')]['filter']){_0x29d9aa['where']=_[_0x632b('0x32')](_0x29d9aa[_0x632b('0x30')],{'$or':_[_0x632b('0x33')](_0x515d74,function(_0x2a723a){if(_0x2a723a[_0x632b('0x34')][_0x632b('0x35')]!==_0x632b('0x36')){var _0x16a2cb={};_0x16a2cb[_0x2a723a['field']]={'$like':'%'+_0x273e89['query'][_0x632b('0x37')]+'%'};return _0x16a2cb;}})});}_0x29d9aa=_['merge']({},_0x29d9aa,_0x273e89[_0x632b('0x38')]);var _0x31f7bb={'where':_0x29d9aa[_0x632b('0x30')]};return db[_0x632b('0x22')][_0x632b('0x39')](_0x31f7bb)[_0x632b('0x3a')](function(_0x30b493){_0x4728a8[_0x632b('0x39')]=_0x30b493;if(_0x273e89[_0x632b('0x25')][_0x632b('0x3b')]){_0x29d9aa[_0x632b('0x3c')]=[{'all':!![]}];}return db[_0x632b('0x22')][_0x632b('0x3d')](_0x29d9aa);})[_0x632b('0x3a')](function(_0x13beaa){_0x4728a8[_0x632b('0x3e')]=_0x13beaa;return _0x4728a8;})[_0x632b('0x3a')](respondWithFilteredResult(_0x3f4eab,_0x29d9aa))['catch'](handleError(_0x3f4eab,null));};exports['show']=function(_0x58e3cc,_0x588b90){var _0x57f099={'raw':!![],'where':{'id':_0x58e3cc['params']['id']}},_0x361cf6={};_0x361cf6['model']=_['keys'](db[_0x632b('0x22')][_0x632b('0x23')]);_0x361cf6[_0x632b('0x25')]=_[_0x632b('0x26')](_0x58e3cc['query']);_0x361cf6[_0x632b('0x27')]=_[_0x632b('0x28')](_0x361cf6[_0x632b('0x24')],_0x361cf6['query']);_0x57f099[_0x632b('0x29')]=_[_0x632b('0x28')](_0x361cf6[_0x632b('0x24')],qs[_0x632b('0x2a')](_0x58e3cc[_0x632b('0x25')][_0x632b('0x2a')]));_0x57f099['attributes']=_0x57f099[_0x632b('0x29')][_0x632b('0x2b')]?_0x57f099[_0x632b('0x29')]:_0x361cf6[_0x632b('0x24')];if(_0x58e3cc['query']['includeAll']){_0x57f099[_0x632b('0x3c')]=[{'all':!![]}];}_0x57f099=_[_0x632b('0x32')]({},_0x57f099,_0x58e3cc[_0x632b('0x38')]);return db[_0x632b('0x22')][_0x632b('0x3f')](_0x57f099)[_0x632b('0x3a')](handleEntityNotFound(_0x588b90,null))['then'](respondWithResult(_0x588b90,null))[_0x632b('0x40')](handleError(_0x588b90,null));};exports[_0x632b('0x41')]=function(_0x4140f8,_0x19ac35){return db[_0x632b('0x22')][_0x632b('0x41')](_0x4140f8[_0x632b('0x42')],{})[_0x632b('0x3a')](respondWithResult(_0x19ac35,0xc9))['catch'](handleError(_0x19ac35,null));};exports[_0x632b('0x43')]=function(_0x56f254,_0x2a1f09){if(_0x56f254['body']['id']){delete _0x56f254[_0x632b('0x42')]['id'];}return db[_0x632b('0x22')][_0x632b('0x3f')]({'where':{'id':_0x56f254[_0x632b('0x44')]['id']}})[_0x632b('0x3a')](handleEntityNotFound(_0x2a1f09,null))['then'](saveUpdates(_0x56f254[_0x632b('0x42')],null))[_0x632b('0x3a')](respondWithResult(_0x2a1f09,null))[_0x632b('0x40')](handleError(_0x2a1f09,null));};exports['destroy']=function(_0x253aec,_0x16eb80){return db[_0x632b('0x22')][_0x632b('0x3f')]({'where':{'id':_0x253aec[_0x632b('0x44')]['id']}})['then'](handleEntityNotFound(_0x16eb80,null))[_0x632b('0x3a')](removeEntity(_0x16eb80,null))['catch'](handleError(_0x16eb80,null));};exports[_0x632b('0x45')]=function(_0x369cdc,_0x3ccf17){return db[_0x632b('0x22')][_0x632b('0x45')]()['then'](respondWithResult(_0x3ccf17,null))['catch'](handleError(_0x3ccf17,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index ae04828..6940a5a 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 _0x7647=['report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport'];(function(_0x559569,_0x24bad6){var _0x55b792=function(_0x27ab4d){while(--_0x27ab4d){_0x559569['push'](_0x559569['shift']());}};_0x55b792(++_0x24bad6);}(_0x7647,0x12d));var _0x7764=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x7647[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x7764('0x0'));var util=require(_0x7764('0x1'));var logger=require(_0x7764('0x2'))(_0x7764('0x3'));var moment=require(_0x7764('0x4'));var BPromise=require(_0x7764('0x5'));var rp=require(_0x7764('0x6'));var attributes=require(_0x7764('0x7'));module[_0x7764('0x8')]=function(_0x1e1dbe,_0x3f738d){return _0x1e1dbe[_0x7764('0x9')](_0x7764('0xa'),attributes,{'tableName':_0x7764('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20b9=['define','report_jscripty_questions','lodash','api','moment','exports'];(function(_0x68b89e,_0x4ae40d){var _0x2e3a9d=function(_0x353b09){while(--_0x353b09){_0x68b89e['push'](_0x68b89e['shift']());}};_0x2e3a9d(++_0x4ae40d);}(_0x20b9,0xfe));var _0x920b=function(_0x202319,_0x1a4b16){_0x202319=_0x202319-0x0;var _0x5853c4=_0x20b9[_0x202319];return _0x5853c4;};'use strict';var _=require(_0x920b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x920b('0x1'));var moment=require(_0x920b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./jscriptyQuestionReport.attributes');module[_0x920b('0x3')]=function(_0x582cd9,_0x3a889c){return _0x582cd9[_0x920b('0x4')]('JscriptyQuestionReport',attributes,{'tableName':_0x920b('0x5'),'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 66d3574..6c1b5c4 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 _0x5864=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','JscriptyQuestionReport,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x175b97,_0xe658fd){var _0x1e0b43=function(_0x431115){while(--_0x431115){_0x175b97['push'](_0x175b97['shift']());}};_0x1e0b43(++_0xe658fd);}(_0x5864,0xb8));var _0x4586=function(_0x47e3e5,_0x1eb574){_0x47e3e5=_0x47e3e5-0x0;var _0x3d707c=_0x5864[_0x47e3e5];return _0x3d707c;};'use strict';var _=require(_0x4586('0x0'));var util=require(_0x4586('0x1'));var moment=require('moment');var BPromise=require(_0x4586('0x2'));var rs=require(_0x4586('0x3'));var fs=require('fs');var Redis=require(_0x4586('0x4'));var db=require(_0x4586('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4586('0x6'))(_0x4586('0x7'));var config=require(_0x4586('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4586('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c394d,_0x14e43b,_0x30625d){return new BPromise(function(_0x21857,_0xf6ad2f){return client[_0x4586('0xa')](_0x5c394d,_0x30625d)[_0x4586('0xb')](function(_0x2215b3){logger[_0x4586('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x14e43b,'request\x20sent');logger['debug'](_0x4586('0xd'),_0x14e43b,_0x4586('0xe'),JSON['stringify'](_0x2215b3));if(_0x2215b3[_0x4586('0xf')]){if(_0x2215b3[_0x4586('0xf')][_0x4586('0x10')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x14e43b,_0x2215b3[_0x4586('0xf')][_0x4586('0x11')]);return _0xf6ad2f(_0x2215b3[_0x4586('0xf')]['message']);}logger[_0x4586('0xf')](_0x4586('0x12'),_0x14e43b,_0x2215b3[_0x4586('0xf')][_0x4586('0x11')]);return _0x21857(_0x2215b3[_0x4586('0xf')][_0x4586('0x11')]);}else{logger[_0x4586('0xc')](_0x4586('0x12'),_0x14e43b,_0x4586('0xe'));_0x21857(_0x2215b3[_0x4586('0x13')][_0x4586('0x11')]);}})[_0x4586('0x14')](function(_0x5b53ad){logger[_0x4586('0xf')](_0x4586('0x12'),_0x14e43b,_0x5b53ad);_0xf6ad2f(_0x5b53ad);});});} \ No newline at end of file +var _0xddb9=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','stringify','error','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x7ad6cb,_0xffee6c){var _0x22a0ba=function(_0x47f291){while(--_0x47f291){_0x7ad6cb['push'](_0x7ad6cb['shift']());}};_0x22a0ba(++_0xffee6c);}(_0xddb9,0x1df));var _0x9ddb=function(_0x1bb17f,_0x2a5cf5){_0x1bb17f=_0x1bb17f-0x0;var _0x51341b=_0xddb9[_0x1bb17f];return _0x51341b;};'use strict';var _=require(_0x9ddb('0x0'));var util=require(_0x9ddb('0x1'));var moment=require('moment');var BPromise=require(_0x9ddb('0x2'));var rs=require(_0x9ddb('0x3'));var fs=require('fs');var Redis=require(_0x9ddb('0x4'));var db=require(_0x9ddb('0x5'))['db'];var utils=require(_0x9ddb('0x6'));var logger=require(_0x9ddb('0x7'))(_0x9ddb('0x8'));var config=require(_0x9ddb('0x9'));var jayson=require(_0x9ddb('0xa'));var client=jayson[_0x9ddb('0xb')][_0x9ddb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1c60cf,_0x4ab02e,_0x25af27){return new BPromise(function(_0x458ccc,_0x437f0d){return client[_0x9ddb('0xd')](_0x1c60cf,_0x25af27)[_0x9ddb('0xe')](function(_0x1c8be5){logger[_0x9ddb('0xf')](_0x9ddb('0x10'),_0x4ab02e,'request\x20sent');logger[_0x9ddb('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x4ab02e,'request\x20sent',JSON[_0x9ddb('0x12')](_0x1c8be5));if(_0x1c8be5[_0x9ddb('0x13')]){if(_0x1c8be5[_0x9ddb('0x13')]['code']===0x1f4){logger[_0x9ddb('0x13')](_0x9ddb('0x10'),_0x4ab02e,_0x1c8be5[_0x9ddb('0x13')][_0x9ddb('0x14')]);return _0x437f0d(_0x1c8be5[_0x9ddb('0x13')][_0x9ddb('0x14')]);}logger[_0x9ddb('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4ab02e,_0x1c8be5[_0x9ddb('0x13')]['message']);return _0x458ccc(_0x1c8be5['error'][_0x9ddb('0x14')]);}else{logger[_0x9ddb('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4ab02e,'request\x20sent');_0x458ccc(_0x1c8be5[_0x9ddb('0x15')][_0x9ddb('0x14')]);}})[_0x9ddb('0x16')](function(_0x5daad2){logger[_0x9ddb('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4ab02e,_0x5daad2);_0x437f0d(_0x5daad2);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 2cb2876..2421492 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 _0xca2a=['../../components/auth/service','isAuthenticated','index','get','describe','/:id','show','/:id/questions','post','create','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x4e81eb,_0x1a1e7c){var _0x4f52e3=function(_0x509e73){while(--_0x509e73){_0x4e81eb['push'](_0x4e81eb['shift']());}};_0x4f52e3(++_0x1a1e7c);}(_0xca2a,0x1f3));var _0xaca2=function(_0x1d9b7d,_0x1a12aa){_0x1d9b7d=_0x1d9b7d-0x0;var _0xac7f79=_0xca2a[_0x1d9b7d];return _0xac7f79;};'use strict';var multer=require(_0xaca2('0x0'));var util=require(_0xaca2('0x1'));var path=require(_0xaca2('0x2'));var timeout=require(_0xaca2('0x3'));var express=require('express');var router=express[_0xaca2('0x4')]();var auth=require(_0xaca2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0xaca2('0x6')](),controller[_0xaca2('0x7')]);router[_0xaca2('0x8')]('/describe',auth[_0xaca2('0x6')](),controller[_0xaca2('0x9')]);router[_0xaca2('0x8')](_0xaca2('0xa'),auth[_0xaca2('0x6')](),controller[_0xaca2('0xb')]);router[_0xaca2('0x8')](_0xaca2('0xc'),auth[_0xaca2('0x6')](),controller['getQuestions']);router[_0xaca2('0xd')]('/',auth[_0xaca2('0x6')](),controller[_0xaca2('0xe')]);router['put'](_0xaca2('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xaca2('0xf')](_0xaca2('0xa'),auth[_0xaca2('0x6')](),controller[_0xaca2('0x10')]);module[_0xaca2('0x11')]=router; \ No newline at end of file +var _0xd562=['express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','getQuestions','post','create','put','update','delete','exports','multer','util','connect-timeout'];(function(_0x2821a9,_0x54d53f){var _0x30bf24=function(_0x4ed1f5){while(--_0x4ed1f5){_0x2821a9['push'](_0x2821a9['shift']());}};_0x30bf24(++_0x54d53f);}(_0xd562,0xf9));var _0x2d56=function(_0x589bc1,_0x125c66){_0x589bc1=_0x589bc1-0x0;var _0x56587d=_0xd562[_0x589bc1];return _0x56587d;};'use strict';var multer=require(_0x2d56('0x0'));var util=require(_0x2d56('0x1'));var path=require('path');var timeout=require(_0x2d56('0x2'));var express=require(_0x2d56('0x3'));var router=express[_0x2d56('0x4')]();var auth=require(_0x2d56('0x5'));var interaction=require(_0x2d56('0x6'));var config=require('../../config/environment');var controller=require('./jscriptySessionReport.controller');router[_0x2d56('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2d56('0x7')]('/describe',auth[_0x2d56('0x8')](),controller['describe']);router['get'](_0x2d56('0x9'),auth[_0x2d56('0x8')](),controller[_0x2d56('0xa')]);router[_0x2d56('0x7')]('/:id/questions',auth[_0x2d56('0x8')](),controller[_0x2d56('0xb')]);router[_0x2d56('0xc')]('/',auth[_0x2d56('0x8')](),controller[_0x2d56('0xd')]);router[_0x2d56('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x2d56('0xf')]);router[_0x2d56('0x10')](_0x2d56('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x2d56('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index b90d0e6..e787b5d 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 _0x1d81=['BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0x11f264,_0x4bf271){var _0x119543=function(_0x56ef0c){while(--_0x56ef0c){_0x11f264['push'](_0x11f264['shift']());}};_0x119543(++_0x4bf271);}(_0x1d81,0x64));var _0x11d8=function(_0x2fa164,_0x489302){_0x2fa164=_0x2fa164-0x0;var _0x5e9ae5=_0x1d81[_0x2fa164];return _0x5e9ae5;};'use strict';var moment=require(_0x11d8('0x0'));var Sequelize=require(_0x11d8('0x1'));module[_0x11d8('0x2')]={'starttime':{'type':Sequelize[_0x11d8('0x3')],'set':function(_0x385e7c){this[_0x11d8('0x4')](_0x11d8('0x5'),_0x385e7c);this[_0x11d8('0x4')](_0x11d8('0x6'),moment()[_0x11d8('0x7')](_0x11d8('0x8')));}},'endtime':{'type':Sequelize[_0x11d8('0x3')]},'membername':{'type':Sequelize[_0x11d8('0x9')]},'projectname':{'type':Sequelize[_0x11d8('0x9')]},'queue':{'type':Sequelize[_0x11d8('0x9')]},'uniqueid':{'type':Sequelize[_0x11d8('0x9')]},'calleridname':{'type':Sequelize[_0x11d8('0x9')]},'calleridnum':{'type':Sequelize[_0x11d8('0x9')]},'completed':{'type':Sequelize[_0x11d8('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0xcbfa=['BOOLEAN','moment','sequelize','exports','setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING'];(function(_0x320085,_0x6d6933){var _0x2e197f=function(_0x2cc2b9){while(--_0x2cc2b9){_0x320085['push'](_0x320085['shift']());}};_0x2e197f(++_0x6d6933);}(_0xcbfa,0x1f0));var _0xacbf=function(_0x262736,_0x1c6067){_0x262736=_0x262736-0x0;var _0x5e018a=_0xcbfa[_0x262736];return _0x5e018a;};'use strict';var moment=require(_0xacbf('0x0'));var Sequelize=require(_0xacbf('0x1'));module[_0xacbf('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x3ea085){this[_0xacbf('0x3')]('starttime',_0x3ea085);this[_0xacbf('0x3')](_0xacbf('0x4'),moment()['format'](_0xacbf('0x5')));}},'endtime':{'type':Sequelize[_0xacbf('0x6')]},'membername':{'type':Sequelize[_0xacbf('0x7')]},'projectname':{'type':Sequelize[_0xacbf('0x7')]},'queue':{'type':Sequelize[_0xacbf('0x7')]},'uniqueid':{'type':Sequelize[_0xacbf('0x7')]},'calleridname':{'type':Sequelize[_0xacbf('0x7')]},'calleridnum':{'type':Sequelize[_0xacbf('0x7')]},'completed':{'type':Sequelize[_0xacbf('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 6cc54e2..668010a 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 _0x7632=['pick','filter','merge','map','type','key','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','SessionId','JscriptyQuestionReport','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','ioredis','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','error','stack','name','send','JscriptySessionReport','rawAttributes','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x208bc9,_0x4f36f6){var _0x2675a8=function(_0x452e72){while(--_0x452e72){_0x208bc9['push'](_0x208bc9['shift']());}};_0x2675a8(++_0x4f36f6);}(_0x7632,0x1c4));var _0x2763=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7632[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x2763('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2763('0x1'));var zipdir=require(_0x2763('0x2'));var jsonpatch=require(_0x2763('0x3'));var rp=require('request-promise');var moment=require(_0x2763('0x4'));var BPromise=require(_0x2763('0x5'));var Mustache=require(_0x2763('0x6'));var util=require(_0x2763('0x7'));var path=require(_0x2763('0x8'));var sox=require(_0x2763('0x9'));var csv=require(_0x2763('0xa'));var ejs=require(_0x2763('0xb'));var fs=require('fs');var _=require(_0x2763('0xc'));var squel=require(_0x2763('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2763('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2763('0xf'));var authService=require(_0x2763('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x2763('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0x2763('0x12'))('api');var utils=require(_0x2763('0x13'));var config=require(_0x2763('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f4744,_0x44ba89){_0x44ba89=_0x44ba89||0xcc;return function(_0xf84bc9){if(_0xf84bc9){return _0x3f4744[_0x2763('0x15')](_0x44ba89);}return _0x3f4744[_0x2763('0x16')](_0x44ba89)[_0x2763('0x17')]();};}function respondWithResult(_0xf82def,_0x5db730){_0x5db730=_0x5db730||0xc8;return function(_0x1da1a6){if(_0x1da1a6){return _0xf82def[_0x2763('0x16')](_0x5db730)[_0x2763('0x18')](_0x1da1a6);}};}function respondWithFilteredResult(_0x34a9cd,_0x25f7ea){return function(_0x5c75d6){if(_0x5c75d6){var _0x1cb117=_0x5c75d6[_0x2763('0x19')],_0x374c8f=_0x25f7ea[_0x2763('0x1a')],_0x4d4880=_0x25f7ea['offset']+_0x25f7ea[_0x2763('0x1b')],_0x4f3171;if(_0x4d4880>=_0x1cb117){_0x4d4880=_0x1cb117;_0x4f3171=0xc8;}else{_0x4f3171=0xce;}_0x34a9cd[_0x2763('0x16')](_0x4f3171);return _0x34a9cd[_0x2763('0x1c')]('Content-Range',_0x374c8f+'-'+_0x4d4880+'/'+_0x1cb117)[_0x2763('0x18')](_0x5c75d6);}return null;};}function patchUpdates(_0x340896){return function(_0x3302a1){try{jsonpatch[_0x2763('0x1d')](_0x3302a1,_0x340896,!![]);}catch(_0x24d1d8){return BPromise[_0x2763('0x1e')](_0x24d1d8);}return _0x3302a1['save']();};}function saveUpdates(_0x509db4,_0x5e5ca6){return function(_0x1c44fa){if(_0x1c44fa){return _0x1c44fa[_0x2763('0x1f')](_0x509db4)[_0x2763('0x20')](function(_0x3040e0){return _0x3040e0;});}return null;};}function removeEntity(_0x42a4c7,_0x55c43e){return function(_0x4c31bf){if(_0x4c31bf){return _0x4c31bf[_0x2763('0x21')]()[_0x2763('0x20')](function(){_0x42a4c7[_0x2763('0x16')](0xcc)[_0x2763('0x17')]();});}};}function handleEntityNotFound(_0x2b5830,_0x93cc9d){return function(_0x5c7b84){if(!_0x5c7b84){_0x2b5830[_0x2763('0x15')](0x194);}return _0x5c7b84;};}function handleError(_0x11c29c,_0x3b8b96){_0x3b8b96=_0x3b8b96||0x1f4;return function(_0x31e726){logger[_0x2763('0x22')](_0x31e726[_0x2763('0x23')]);if(_0x31e726[_0x2763('0x24')]){delete _0x31e726[_0x2763('0x24')];}_0x11c29c[_0x2763('0x16')](_0x3b8b96)[_0x2763('0x25')](_0x31e726);};}exports['index']=function(_0xd799,_0x3c0dbf){var _0x30afa6={},_0x3b2340={},_0x32ed6f={'count':0x0,'rows':[]};var _0x41ff6f=db[_0x2763('0x26')][_0x2763('0x27')];_0x3b2340[_0x2763('0x28')]=_[_0x2763('0x29')](_0x41ff6f);_0x3b2340[_0x2763('0x2a')]=_[_0x2763('0x29')](_0xd799[_0x2763('0x2a')]);_0x3b2340[_0x2763('0x2b')]=_[_0x2763('0x2c')](_0x3b2340['model'],_0x3b2340[_0x2763('0x2a')]);_0x30afa6[_0x2763('0x2d')]=_['intersection'](_0x3b2340['model'],qs['fields'](_0xd799[_0x2763('0x2a')]['fields']));_0x30afa6['attributes']=_0x30afa6[_0x2763('0x2d')][_0x2763('0x2e')]?_0x30afa6[_0x2763('0x2d')]:_0x3b2340[_0x2763('0x28')];if(!_0xd799['query'][_0x2763('0x2f')](_0x2763('0x30'))){_0x30afa6[_0x2763('0x1b')]=qs[_0x2763('0x1b')](_0xd799['query'][_0x2763('0x1b')]);_0x30afa6[_0x2763('0x1a')]=qs[_0x2763('0x1a')](_0xd799[_0x2763('0x2a')]['offset']);}_0x30afa6[_0x2763('0x31')]=qs[_0x2763('0x32')](_0xd799['query'][_0x2763('0x32')]);_0x30afa6[_0x2763('0x33')]=qs[_0x2763('0x2b')](_[_0x2763('0x34')](_0xd799[_0x2763('0x2a')],_0x3b2340['filters']));if(_0xd799['query'][_0x2763('0x35')]){_0x30afa6[_0x2763('0x33')]=_[_0x2763('0x36')](_0x30afa6[_0x2763('0x33')],{'$or':_[_0x2763('0x37')](_0x41ff6f,function(_0x18d178){if(_0x18d178[_0x2763('0x38')][_0x2763('0x39')]!==_0x2763('0x3a')){var _0x3a4c07={};_0x3a4c07[_0x18d178['field']]={'$like':'%'+_0xd799[_0x2763('0x2a')][_0x2763('0x35')]+'%'};return _0x3a4c07;}})});}_0x30afa6=_[_0x2763('0x36')]({},_0x30afa6,_0xd799[_0x2763('0x3b')]);var _0x4dd07c={'where':_0x30afa6[_0x2763('0x33')]};return db[_0x2763('0x26')][_0x2763('0x19')](_0x4dd07c)[_0x2763('0x20')](function(_0x5d4f80){_0x32ed6f[_0x2763('0x19')]=_0x5d4f80;if(_0xd799[_0x2763('0x2a')][_0x2763('0x3c')]){_0x30afa6[_0x2763('0x3d')]=[{'all':!![]}];}return db[_0x2763('0x26')][_0x2763('0x3e')](_0x30afa6);})[_0x2763('0x20')](function(_0x3d2a6a){_0x32ed6f[_0x2763('0x3f')]=_0x3d2a6a;return _0x32ed6f;})[_0x2763('0x20')](respondWithFilteredResult(_0x3c0dbf,_0x30afa6))[_0x2763('0x40')](handleError(_0x3c0dbf,null));};exports['show']=function(_0xe372da,_0x5f09c4){var _0x2921c3={'raw':!![],'where':{'id':_0xe372da[_0x2763('0x41')]['id']}},_0x2e5b9d={};_0x2e5b9d[_0x2763('0x28')]=_[_0x2763('0x29')](db[_0x2763('0x26')]['rawAttributes']);_0x2e5b9d[_0x2763('0x2a')]=_[_0x2763('0x29')](_0xe372da[_0x2763('0x2a')]);_0x2e5b9d[_0x2763('0x2b')]=_[_0x2763('0x2c')](_0x2e5b9d['model'],_0x2e5b9d[_0x2763('0x2a')]);_0x2921c3[_0x2763('0x2d')]=_[_0x2763('0x2c')](_0x2e5b9d['model'],qs[_0x2763('0x42')](_0xe372da[_0x2763('0x2a')][_0x2763('0x42')]));_0x2921c3[_0x2763('0x2d')]=_0x2921c3[_0x2763('0x2d')][_0x2763('0x2e')]?_0x2921c3[_0x2763('0x2d')]:_0x2e5b9d[_0x2763('0x28')];if(_0xe372da['query'][_0x2763('0x3c')]){_0x2921c3['include']=[{'all':!![]}];}_0x2921c3=_[_0x2763('0x36')]({},_0x2921c3,_0xe372da[_0x2763('0x3b')]);return db[_0x2763('0x26')][_0x2763('0x43')](_0x2921c3)[_0x2763('0x20')](handleEntityNotFound(_0x5f09c4,null))[_0x2763('0x20')](respondWithResult(_0x5f09c4,null))[_0x2763('0x40')](handleError(_0x5f09c4,null));};exports['create']=function(_0xd3950b,_0x443671){return db[_0x2763('0x26')][_0x2763('0x44')](_0xd3950b[_0x2763('0x45')],{})[_0x2763('0x20')](respondWithResult(_0x443671,0xc9))['catch'](handleError(_0x443671,null));};exports[_0x2763('0x1f')]=function(_0xac1481,_0x45c472){if(_0xac1481[_0x2763('0x45')]['id']){delete _0xac1481[_0x2763('0x45')]['id'];}return db[_0x2763('0x26')][_0x2763('0x43')]({'where':{'id':_0xac1481[_0x2763('0x41')]['id']}})[_0x2763('0x20')](handleEntityNotFound(_0x45c472,null))[_0x2763('0x20')](saveUpdates(_0xac1481[_0x2763('0x45')],null))[_0x2763('0x20')](respondWithResult(_0x45c472,null))[_0x2763('0x40')](handleError(_0x45c472,null));};exports[_0x2763('0x21')]=function(_0x9213c3,_0xb5411b){return db[_0x2763('0x26')]['find']({'where':{'id':_0x9213c3[_0x2763('0x41')]['id']}})[_0x2763('0x20')](handleEntityNotFound(_0xb5411b,null))[_0x2763('0x20')](removeEntity(_0xb5411b,null))[_0x2763('0x40')](handleError(_0xb5411b,null));};exports['describe']=function(_0x5a4a62,_0x4f8f5f){return db[_0x2763('0x26')]['describe']()['then'](respondWithResult(_0x4f8f5f,null))[_0x2763('0x40')](handleError(_0x4f8f5f,null));};exports['getQuestions']=function(_0x18043b,_0x2d6c34,_0xf65482){var _0x4b3ffe={'raw':!![],'where':{}};var _0x3f05e6={};var _0x3510fa={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x18043b['params']['id']}})[_0x2763('0x20')](handleEntityNotFound(_0x2d6c34,null))[_0x2763('0x20')](function(_0x332806){if(_0x332806){_0x3f05e6['model']=_['keys'](db['JscriptyQuestionReport'][_0x2763('0x27')]);_0x3f05e6[_0x2763('0x2a')]=_['keys'](_0x18043b[_0x2763('0x2a')]);_0x3f05e6[_0x2763('0x2b')]=_['intersection'](_0x3f05e6[_0x2763('0x28')],_0x3f05e6[_0x2763('0x2a')]);_0x4b3ffe['attributes']=_[_0x2763('0x2c')](_0x3f05e6['model'],qs[_0x2763('0x42')](_0x18043b['query'][_0x2763('0x42')]));_0x4b3ffe[_0x2763('0x2d')]=_0x4b3ffe[_0x2763('0x2d')][_0x2763('0x2e')]?_0x4b3ffe[_0x2763('0x2d')]:_0x3f05e6[_0x2763('0x28')];if(!_0x18043b[_0x2763('0x2a')]['hasOwnProperty'](_0x2763('0x30'))){_0x4b3ffe[_0x2763('0x1b')]=qs[_0x2763('0x1b')](_0x18043b[_0x2763('0x2a')]['limit']);_0x4b3ffe[_0x2763('0x1a')]=qs[_0x2763('0x1a')](_0x18043b['query'][_0x2763('0x1a')]);}_0x4b3ffe['order']=qs['sort'](_0x18043b[_0x2763('0x2a')]['sort']);_0x4b3ffe[_0x2763('0x33')]=qs[_0x2763('0x2b')](_['pick'](_0x18043b['query'],_0x3f05e6['filters']));_0x4b3ffe[_0x2763('0x33')][_0x2763('0x46')]=_0x332806['id'];if(_0x18043b[_0x2763('0x2a')][_0x2763('0x35')]){_0x4b3ffe['where']=_[_0x2763('0x36')](_0x4b3ffe[_0x2763('0x33')],{'$or':_[_0x2763('0x37')](_0x4b3ffe[_0x2763('0x2d')],function(_0x5854fa){var _0x1cd34f={};_0x1cd34f[_0x5854fa]={'$like':'%'+_0x18043b[_0x2763('0x2a')][_0x2763('0x35')]+'%'};return _0x1cd34f;})});}_0x4b3ffe=_[_0x2763('0x36')]({},_0x4b3ffe,_0x18043b['options']);return db['JscriptyQuestionReport'][_0x2763('0x19')]({'where':_0x4b3ffe['where']})[_0x2763('0x20')](function(_0x340c8e){_0x3510fa['count']=_0x340c8e;if(_0x18043b[_0x2763('0x2a')][_0x2763('0x3c')]){_0x4b3ffe[_0x2763('0x3d')]=[{'all':!![]}];}return db[_0x2763('0x47')][_0x2763('0x3e')](_0x4b3ffe);})[_0x2763('0x20')](function(_0x501d0b){_0x3510fa[_0x2763('0x3f')]=_0x501d0b;return _0x3510fa;});}})[_0x2763('0x20')](respondWithFilteredResult(_0x2d6c34,_0x4b3ffe))[_0x2763('0x40')](handleError(_0x2d6c34,null));}; \ No newline at end of file +var _0xcd46=['filter','merge','type','key','field','options','include','findAll','rows','catch','show','params','keys','rawAttributes','length','includeAll','find','create','body','describe','getQuestions','JscriptyQuestionReport','SessionId','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','update','destroy','then','error','name','send','index','JscriptySessionReport','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick'];(function(_0x322517,_0x4fb565){var _0x5f3b86=function(_0x536f6d){while(--_0x536f6d){_0x322517['push'](_0x322517['shift']());}};_0x5f3b86(++_0x4fb565);}(_0xcd46,0x65));var _0x6cd4=function(_0x5ee5d3,_0xd629d4){_0x5ee5d3=_0x5ee5d3-0x0;var _0x4db852=_0xcd46[_0x5ee5d3];return _0x4db852;};'use strict';var pdf=require(_0x6cd4('0x0'));var emlformat=require(_0x6cd4('0x1'));var rimraf=require(_0x6cd4('0x2'));var zipdir=require(_0x6cd4('0x3'));var jsonpatch=require(_0x6cd4('0x4'));var rp=require(_0x6cd4('0x5'));var moment=require(_0x6cd4('0x6'));var BPromise=require(_0x6cd4('0x7'));var Mustache=require(_0x6cd4('0x8'));var util=require(_0x6cd4('0x9'));var path=require(_0x6cd4('0xa'));var sox=require(_0x6cd4('0xb'));var csv=require(_0x6cd4('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x6cd4('0xd'));var crypto=require(_0x6cd4('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x6cd4('0xf'));var toCsv=require(_0x6cd4('0xc'));var querystring=require(_0x6cd4('0x10'));var Papa=require(_0x6cd4('0x11'));var authService=require('../../components/auth/service');var hardwareService=require(_0x6cd4('0x12'));var Redis=require(_0x6cd4('0x13'));var qs=require('../../components/parsers/qs');var logger=require(_0x6cd4('0x14'))(_0x6cd4('0x15'));var utils=require(_0x6cd4('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ec5e8,_0x3474a1){_0x3474a1=_0x3474a1||0xcc;return function(_0x461757){if(_0x461757){return _0x3ec5e8[_0x6cd4('0x17')](_0x3474a1);}return _0x3ec5e8['status'](_0x3474a1)['end']();};}function respondWithResult(_0x3ed094,_0x19c0f0){_0x19c0f0=_0x19c0f0||0xc8;return function(_0x4dd297){if(_0x4dd297){return _0x3ed094[_0x6cd4('0x18')](_0x19c0f0)['json'](_0x4dd297);}};}function respondWithFilteredResult(_0x316177,_0x5beb1f){return function(_0xff9479){if(_0xff9479){var _0x27de6e=_0xff9479[_0x6cd4('0x19')],_0x3a36ad=_0x5beb1f[_0x6cd4('0x1a')],_0x3d2ccd=_0x5beb1f[_0x6cd4('0x1a')]+_0x5beb1f['limit'],_0x41b485;if(_0x3d2ccd>=_0x27de6e){_0x3d2ccd=_0x27de6e;_0x41b485=0xc8;}else{_0x41b485=0xce;}_0x316177['status'](_0x41b485);return _0x316177[_0x6cd4('0x1b')](_0x6cd4('0x1c'),_0x3a36ad+'-'+_0x3d2ccd+'/'+_0x27de6e)[_0x6cd4('0x1d')](_0xff9479);}return null;};}function patchUpdates(_0x578524){return function(_0x5d6038){try{jsonpatch[_0x6cd4('0x1e')](_0x5d6038,_0x578524,!![]);}catch(_0x501afe){return BPromise[_0x6cd4('0x1f')](_0x501afe);}return _0x5d6038['save']();};}function saveUpdates(_0x31a42b,_0x488d05){return function(_0x5e5d2f){if(_0x5e5d2f){return _0x5e5d2f[_0x6cd4('0x20')](_0x31a42b)['then'](function(_0x210909){return _0x210909;});}return null;};}function removeEntity(_0x3fdbce,_0x9fabad){return function(_0x3f4f3b){if(_0x3f4f3b){return _0x3f4f3b[_0x6cd4('0x21')]()[_0x6cd4('0x22')](function(){_0x3fdbce['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ac7de,_0x214f81){return function(_0xbb9c47){if(!_0xbb9c47){_0x5ac7de[_0x6cd4('0x17')](0x194);}return _0xbb9c47;};}function handleError(_0x5b1f0e,_0x6e0e07){_0x6e0e07=_0x6e0e07||0x1f4;return function(_0x1e77eb){logger[_0x6cd4('0x23')](_0x1e77eb['stack']);if(_0x1e77eb[_0x6cd4('0x24')]){delete _0x1e77eb[_0x6cd4('0x24')];}_0x5b1f0e[_0x6cd4('0x18')](_0x6e0e07)[_0x6cd4('0x25')](_0x1e77eb);};}exports[_0x6cd4('0x26')]=function(_0x406c8f,_0x5c3705){var _0x5632e3={},_0x5e2058={},_0x91706={'count':0x0,'rows':[]};var _0x186a20=db[_0x6cd4('0x27')]['rawAttributes'];_0x5e2058[_0x6cd4('0x28')]=_['keys'](_0x186a20);_0x5e2058[_0x6cd4('0x29')]=_['keys'](_0x406c8f[_0x6cd4('0x29')]);_0x5e2058[_0x6cd4('0x2a')]=_[_0x6cd4('0x2b')](_0x5e2058[_0x6cd4('0x28')],_0x5e2058[_0x6cd4('0x29')]);_0x5632e3[_0x6cd4('0x2c')]=_[_0x6cd4('0x2b')](_0x5e2058[_0x6cd4('0x28')],qs[_0x6cd4('0x2d')](_0x406c8f['query']['fields']));_0x5632e3[_0x6cd4('0x2c')]=_0x5632e3[_0x6cd4('0x2c')]['length']?_0x5632e3[_0x6cd4('0x2c')]:_0x5e2058['model'];if(!_0x406c8f[_0x6cd4('0x29')][_0x6cd4('0x2e')](_0x6cd4('0x2f'))){_0x5632e3[_0x6cd4('0x30')]=qs[_0x6cd4('0x30')](_0x406c8f['query']['limit']);_0x5632e3[_0x6cd4('0x1a')]=qs['offset'](_0x406c8f['query'][_0x6cd4('0x1a')]);}_0x5632e3[_0x6cd4('0x31')]=qs[_0x6cd4('0x32')](_0x406c8f[_0x6cd4('0x29')][_0x6cd4('0x32')]);_0x5632e3[_0x6cd4('0x33')]=qs[_0x6cd4('0x2a')](_[_0x6cd4('0x34')](_0x406c8f[_0x6cd4('0x29')],_0x5e2058['filters']));if(_0x406c8f[_0x6cd4('0x29')][_0x6cd4('0x35')]){_0x5632e3[_0x6cd4('0x33')]=_[_0x6cd4('0x36')](_0x5632e3[_0x6cd4('0x33')],{'$or':_['map'](_0x186a20,function(_0x8d2472){if(_0x8d2472[_0x6cd4('0x37')][_0x6cd4('0x38')]!=='VIRTUAL'){var _0x484efc={};_0x484efc[_0x8d2472[_0x6cd4('0x39')]]={'$like':'%'+_0x406c8f[_0x6cd4('0x29')][_0x6cd4('0x35')]+'%'};return _0x484efc;}})});}_0x5632e3=_[_0x6cd4('0x36')]({},_0x5632e3,_0x406c8f[_0x6cd4('0x3a')]);var _0x21bef8={'where':_0x5632e3[_0x6cd4('0x33')]};return db[_0x6cd4('0x27')][_0x6cd4('0x19')](_0x21bef8)[_0x6cd4('0x22')](function(_0x4af39e){_0x91706[_0x6cd4('0x19')]=_0x4af39e;if(_0x406c8f['query']['includeAll']){_0x5632e3[_0x6cd4('0x3b')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x6cd4('0x3c')](_0x5632e3);})['then'](function(_0x520c64){_0x91706[_0x6cd4('0x3d')]=_0x520c64;return _0x91706;})['then'](respondWithFilteredResult(_0x5c3705,_0x5632e3))[_0x6cd4('0x3e')](handleError(_0x5c3705,null));};exports[_0x6cd4('0x3f')]=function(_0x430ed1,_0x54855b){var _0x2e4fb6={'raw':!![],'where':{'id':_0x430ed1[_0x6cd4('0x40')]['id']}},_0x5f4b08={};_0x5f4b08['model']=_[_0x6cd4('0x41')](db[_0x6cd4('0x27')][_0x6cd4('0x42')]);_0x5f4b08[_0x6cd4('0x29')]=_[_0x6cd4('0x41')](_0x430ed1[_0x6cd4('0x29')]);_0x5f4b08[_0x6cd4('0x2a')]=_[_0x6cd4('0x2b')](_0x5f4b08[_0x6cd4('0x28')],_0x5f4b08[_0x6cd4('0x29')]);_0x2e4fb6[_0x6cd4('0x2c')]=_[_0x6cd4('0x2b')](_0x5f4b08[_0x6cd4('0x28')],qs['fields'](_0x430ed1[_0x6cd4('0x29')]['fields']));_0x2e4fb6[_0x6cd4('0x2c')]=_0x2e4fb6[_0x6cd4('0x2c')][_0x6cd4('0x43')]?_0x2e4fb6[_0x6cd4('0x2c')]:_0x5f4b08['model'];if(_0x430ed1[_0x6cd4('0x29')][_0x6cd4('0x44')]){_0x2e4fb6[_0x6cd4('0x3b')]=[{'all':!![]}];}_0x2e4fb6=_['merge']({},_0x2e4fb6,_0x430ed1[_0x6cd4('0x3a')]);return db[_0x6cd4('0x27')][_0x6cd4('0x45')](_0x2e4fb6)[_0x6cd4('0x22')](handleEntityNotFound(_0x54855b,null))[_0x6cd4('0x22')](respondWithResult(_0x54855b,null))[_0x6cd4('0x3e')](handleError(_0x54855b,null));};exports[_0x6cd4('0x46')]=function(_0x5d060f,_0x3039d8){return db['JscriptySessionReport'][_0x6cd4('0x46')](_0x5d060f[_0x6cd4('0x47')],{})[_0x6cd4('0x22')](respondWithResult(_0x3039d8,0xc9))[_0x6cd4('0x3e')](handleError(_0x3039d8,null));};exports['update']=function(_0x4728be,_0x494551){if(_0x4728be[_0x6cd4('0x47')]['id']){delete _0x4728be[_0x6cd4('0x47')]['id'];}return db[_0x6cd4('0x27')][_0x6cd4('0x45')]({'where':{'id':_0x4728be[_0x6cd4('0x40')]['id']}})[_0x6cd4('0x22')](handleEntityNotFound(_0x494551,null))[_0x6cd4('0x22')](saveUpdates(_0x4728be[_0x6cd4('0x47')],null))[_0x6cd4('0x22')](respondWithResult(_0x494551,null))[_0x6cd4('0x3e')](handleError(_0x494551,null));};exports[_0x6cd4('0x21')]=function(_0x31326a,_0x253620){return db['JscriptySessionReport'][_0x6cd4('0x45')]({'where':{'id':_0x31326a[_0x6cd4('0x40')]['id']}})[_0x6cd4('0x22')](handleEntityNotFound(_0x253620,null))[_0x6cd4('0x22')](removeEntity(_0x253620,null))['catch'](handleError(_0x253620,null));};exports[_0x6cd4('0x48')]=function(_0xd49d51,_0x3038d3){return db[_0x6cd4('0x27')]['describe']()[_0x6cd4('0x22')](respondWithResult(_0x3038d3,null))['catch'](handleError(_0x3038d3,null));};exports[_0x6cd4('0x49')]=function(_0x5beb12,_0x3497c1,_0x147d58){var _0x242f31={'raw':!![],'where':{}};var _0x5cea86={};var _0x376a1b={'count':0x0,'rows':[]};return db[_0x6cd4('0x27')]['findOne']({'where':{'id':_0x5beb12['params']['id']}})['then'](handleEntityNotFound(_0x3497c1,null))[_0x6cd4('0x22')](function(_0x4d550c){if(_0x4d550c){_0x5cea86[_0x6cd4('0x28')]=_['keys'](db[_0x6cd4('0x4a')][_0x6cd4('0x42')]);_0x5cea86['query']=_['keys'](_0x5beb12[_0x6cd4('0x29')]);_0x5cea86[_0x6cd4('0x2a')]=_[_0x6cd4('0x2b')](_0x5cea86[_0x6cd4('0x28')],_0x5cea86[_0x6cd4('0x29')]);_0x242f31[_0x6cd4('0x2c')]=_[_0x6cd4('0x2b')](_0x5cea86[_0x6cd4('0x28')],qs['fields'](_0x5beb12[_0x6cd4('0x29')]['fields']));_0x242f31['attributes']=_0x242f31[_0x6cd4('0x2c')]['length']?_0x242f31['attributes']:_0x5cea86['model'];if(!_0x5beb12['query'][_0x6cd4('0x2e')](_0x6cd4('0x2f'))){_0x242f31[_0x6cd4('0x30')]=qs[_0x6cd4('0x30')](_0x5beb12[_0x6cd4('0x29')]['limit']);_0x242f31['offset']=qs[_0x6cd4('0x1a')](_0x5beb12['query']['offset']);}_0x242f31['order']=qs[_0x6cd4('0x32')](_0x5beb12['query'][_0x6cd4('0x32')]);_0x242f31['where']=qs[_0x6cd4('0x2a')](_[_0x6cd4('0x34')](_0x5beb12[_0x6cd4('0x29')],_0x5cea86[_0x6cd4('0x2a')]));_0x242f31[_0x6cd4('0x33')][_0x6cd4('0x4b')]=_0x4d550c['id'];if(_0x5beb12[_0x6cd4('0x29')][_0x6cd4('0x35')]){_0x242f31['where']=_[_0x6cd4('0x36')](_0x242f31['where'],{'$or':_[_0x6cd4('0x4c')](_0x242f31[_0x6cd4('0x2c')],function(_0x17928c){var _0x385c47={};_0x385c47[_0x17928c]={'$like':'%'+_0x5beb12[_0x6cd4('0x29')][_0x6cd4('0x35')]+'%'};return _0x385c47;})});}_0x242f31=_[_0x6cd4('0x36')]({},_0x242f31,_0x5beb12[_0x6cd4('0x3a')]);return db[_0x6cd4('0x4a')][_0x6cd4('0x19')]({'where':_0x242f31['where']})[_0x6cd4('0x22')](function(_0x258b2b){_0x376a1b[_0x6cd4('0x19')]=_0x258b2b;if(_0x5beb12[_0x6cd4('0x29')]['includeAll']){_0x242f31['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x6cd4('0x3c')](_0x242f31);})[_0x6cd4('0x22')](function(_0x5b56dd){_0x376a1b[_0x6cd4('0x3d')]=_0x5b56dd;return _0x376a1b;});}})[_0x6cd4('0x22')](respondWithFilteredResult(_0x3497c1,_0x242f31))[_0x6cd4('0x3e')](handleError(_0x3497c1,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index f123231..d888afa 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 _0x0a02=['lodash','util','../../config/logger','request-promise','./jscriptySessionReport.attributes','define','JscriptySessionReport','report_jscripty_sessions'];(function(_0x1c70b6,_0x466b7a){var _0x10d860=function(_0x290622){while(--_0x290622){_0x1c70b6['push'](_0x1c70b6['shift']());}};_0x10d860(++_0x466b7a);}(_0x0a02,0xc0));var _0x20a0=function(_0x554047,_0x46ec41){_0x554047=_0x554047-0x0;var _0x5d11e4=_0x0a02[_0x554047];return _0x5d11e4;};'use strict';var _=require(_0x20a0('0x0'));var util=require(_0x20a0('0x1'));var logger=require(_0x20a0('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x20a0('0x3'));var attributes=require(_0x20a0('0x4'));module['exports']=function(_0x4eb052,_0x1e4a15){return _0x4eb052[_0x20a0('0x5')](_0x20a0('0x6'),attributes,{'tableName':_0x20a0('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4596=['lodash','util','../../config/logger','api','bluebird','request-promise','exports','define','JscriptySessionReport'];(function(_0x4f5226,_0x3853a1){var _0x13201e=function(_0x47e6a7){while(--_0x47e6a7){_0x4f5226['push'](_0x4f5226['shift']());}};_0x13201e(++_0x3853a1);}(_0x4596,0x132));var _0x6459=function(_0x3bc0d2,_0x4d5d3d){_0x3bc0d2=_0x3bc0d2-0x0;var _0x564e19=_0x4596[_0x3bc0d2];return _0x564e19;};'use strict';var _=require(_0x6459('0x0'));var util=require(_0x6459('0x1'));var logger=require(_0x6459('0x2'))(_0x6459('0x3'));var moment=require('moment');var BPromise=require(_0x6459('0x4'));var rp=require(_0x6459('0x5'));var attributes=require('./jscriptySessionReport.attributes');module[_0x6459('0x6')]=function(_0x44d645,_0x2f0b90){return _0x44d645[_0x6459('0x7')](_0x6459('0x8'),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 4500027..b40c983 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 _0x3e0c=['JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4e6e09,_0x1b3e98){var _0x5846e9=function(_0xdc30df){while(--_0xdc30df){_0x4e6e09['push'](_0x4e6e09['shift']());}};_0x5846e9(++_0x1b3e98);}(_0x3e0c,0x16d));var _0xc3e0=function(_0x5b770d,_0x1adc88){_0x5b770d=_0x5b770d-0x0;var _0x4ee575=_0x3e0c[_0x5b770d];return _0x4ee575;};'use strict';var _=require(_0xc3e0('0x0'));var util=require(_0xc3e0('0x1'));var moment=require(_0xc3e0('0x2'));var BPromise=require('bluebird');var rs=require(_0xc3e0('0x3'));var fs=require('fs');var Redis=require(_0xc3e0('0x4'));var db=require(_0xc3e0('0x5'))['db'];var utils=require(_0xc3e0('0x6'));var logger=require(_0xc3e0('0x7'))('rpc');var config=require(_0xc3e0('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x553e6d,_0x6db846,_0x32976c){return new BPromise(function(_0x1cfcf5,_0x4ad1bd){return client['request'](_0x553e6d,_0x32976c)['then'](function(_0x5a2630){logger[_0xc3e0('0x9')](_0xc3e0('0xa'),_0x6db846,_0xc3e0('0xb'));logger[_0xc3e0('0xc')](_0xc3e0('0xd'),_0x6db846,_0xc3e0('0xb'),JSON[_0xc3e0('0xe')](_0x5a2630));if(_0x5a2630['error']){if(_0x5a2630[_0xc3e0('0xf')]['code']===0x1f4){logger[_0xc3e0('0xf')](_0xc3e0('0xa'),_0x6db846,_0x5a2630['error'][_0xc3e0('0x10')]);return _0x4ad1bd(_0x5a2630['error'][_0xc3e0('0x10')]);}logger[_0xc3e0('0xf')](_0xc3e0('0xa'),_0x6db846,_0x5a2630[_0xc3e0('0xf')][_0xc3e0('0x10')]);return _0x1cfcf5(_0x5a2630[_0xc3e0('0xf')][_0xc3e0('0x10')]);}else{logger['info'](_0xc3e0('0xa'),_0x6db846,_0xc3e0('0xb'));_0x1cfcf5(_0x5a2630['result'][_0xc3e0('0x10')]);}})[_0xc3e0('0x11')](function(_0x25891a){logger[_0xc3e0('0xf')](_0xc3e0('0xa'),_0x6db846,_0x25891a);_0x4ad1bd(_0x25891a);});});} \ No newline at end of file +var _0x28b1=['message','info','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','then','JscriptySessionReport,\x20%s,\x20%s','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xecd602,_0x4d434e){var _0x3139f=function(_0x570c9e){while(--_0x570c9e){_0xecd602['push'](_0xecd602['shift']());}};_0x3139f(++_0x4d434e);}(_0x28b1,0x1d6));var _0x128b=function(_0x413b02,_0x4a723c){_0x413b02=_0x413b02-0x0;var _0x19b035=_0x28b1[_0x413b02];return _0x19b035;};'use strict';var _=require(_0x128b('0x0'));var util=require(_0x128b('0x1'));var moment=require(_0x128b('0x2'));var BPromise=require('bluebird');var rs=require(_0x128b('0x3'));var fs=require('fs');var Redis=require(_0x128b('0x4'));var db=require(_0x128b('0x5'))['db'];var utils=require(_0x128b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x128b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x128b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59cd4f,_0xcd2ab0,_0x1af910){return new BPromise(function(_0x383c28,_0x2b7b08){return client[_0x128b('0x9')](_0x59cd4f,_0x1af910)[_0x128b('0xa')](function(_0x5b4709){logger['info'](_0x128b('0xb'),_0xcd2ab0,'request\x20sent');logger['debug'](_0x128b('0xc'),_0xcd2ab0,_0x128b('0xd'),JSON[_0x128b('0xe')](_0x5b4709));if(_0x5b4709[_0x128b('0xf')]){if(_0x5b4709[_0x128b('0xf')]['code']===0x1f4){logger[_0x128b('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0xcd2ab0,_0x5b4709[_0x128b('0xf')][_0x128b('0x10')]);return _0x2b7b08(_0x5b4709[_0x128b('0xf')][_0x128b('0x10')]);}logger[_0x128b('0xf')](_0x128b('0xb'),_0xcd2ab0,_0x5b4709[_0x128b('0xf')][_0x128b('0x10')]);return _0x383c28(_0x5b4709[_0x128b('0xf')][_0x128b('0x10')]);}else{logger[_0x128b('0x11')](_0x128b('0xb'),_0xcd2ab0,_0x128b('0xd'));_0x383c28(_0x5b4709['result']['message']);}})['catch'](function(_0x5de3f4){logger['error'](_0x128b('0xb'),_0xcd2ab0,_0x5de3f4);_0x2b7b08(_0x5de3f4);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index e7fa9e3..5e88d65 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 _0x3947=['isAuthenticated','update','util','path','express','../../components/interaction/service','../../config/environment','./license.controller','index','/:id'];(function(_0x5e2238,_0x2021df){var _0x561179=function(_0xe7b7ed){while(--_0xe7b7ed){_0x5e2238['push'](_0x5e2238['shift']());}};_0x561179(++_0x2021df);}(_0x3947,0xb6));var _0x7394=function(_0x2fb053,_0x217385){_0x2fb053=_0x2fb053-0x0;var _0x504641=_0x3947[_0x2fb053];return _0x504641;};'use strict';var multer=require('multer');var util=require(_0x7394('0x0'));var path=require(_0x7394('0x1'));var timeout=require('connect-timeout');var express=require(_0x7394('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7394('0x3'));var config=require(_0x7394('0x4'));var controller=require(_0x7394('0x5'));router['get']('/',controller[_0x7394('0x6')]);router['put'](_0x7394('0x7'),auth[_0x7394('0x8')](),controller[_0x7394('0x9')]);module['exports']=router; \ No newline at end of file +var _0xc9d8=['./license.controller','get','put','/:id','isAuthenticated','update','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x252805,_0x1d1e8e){var _0x3e74b9=function(_0x16d7a0){while(--_0x16d7a0){_0x252805['push'](_0x252805['shift']());}};_0x3e74b9(++_0x1d1e8e);}(_0xc9d8,0xaf));var _0x8c9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc9d8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8c9d('0x0'));var util=require('util');var path=require(_0x8c9d('0x1'));var timeout=require(_0x8c9d('0x2'));var express=require(_0x8c9d('0x3'));var router=express['Router']();var auth=require(_0x8c9d('0x4'));var interaction=require(_0x8c9d('0x5'));var config=require(_0x8c9d('0x6'));var controller=require(_0x8c9d('0x7'));router[_0x8c9d('0x8')]('/',controller['index']);router[_0x8c9d('0x9')](_0x8c9d('0xa'),auth[_0x8c9d('0xb')](),controller[_0x8c9d('0xc')]);module[_0x8c9d('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 2c403b0..7b38db8 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 _0xa03e=['STRING','INTEGER','sequelize','exports'];(function(_0x688559,_0x5c13b3){var _0x4afd1f=function(_0x2ff717){while(--_0x2ff717){_0x688559['push'](_0x688559['shift']());}};_0x4afd1f(++_0x5c13b3);}(_0xa03e,0x8a));var _0xea03=function(_0x452cd3,_0x346e03){_0x452cd3=_0x452cd3-0x0;var _0x257f8b=_0xa03e[_0x452cd3];return _0x257f8b;};'use strict';var Sequelize=require(_0xea03('0x0'));module[_0xea03('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xea03('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xea03('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe788=['exports','STRING','sequelize'];(function(_0x332134,_0x427aed){var _0x695320=function(_0x34fc45){while(--_0x34fc45){_0x332134['push'](_0x332134['shift']());}};_0x695320(++_0x427aed);}(_0xe788,0x143));var _0x8e78=function(_0x7c541b,_0x911b22){_0x7c541b=_0x7c541b-0x0;var _0x7249d5=_0xe788[_0x7c541b];return _0x7249d5;};'use strict';var Sequelize=require(_0x8e78('0x0'));module[_0x8e78('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x8e78('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index ab46db6..5dd3345 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 _0x6175=['apply','then','destroy','error','name','send','../../config/license/util','index','model','keys','query','filters','attributes','length','merge','getLicense','catch','update','body','License','find','params','get','checkLicense','key','demo','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','status','json','count','offset','set','Content-Range'];(function(_0x548ccb,_0x1fab15){var _0x2f7701=function(_0x92da09){while(--_0x92da09){_0x548ccb['push'](_0x548ccb['shift']());}};_0x2f7701(++_0x1fab15);}(_0x6175,0x82));var _0x5617=function(_0x201850,_0x5cd537){_0x201850=_0x201850-0x0;var _0x393ff4=_0x6175[_0x201850];return _0x393ff4;};'use strict';var pdf=require(_0x5617('0x0'));var emlformat=require(_0x5617('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5617('0x2'));var jsonpatch=require(_0x5617('0x3'));var rp=require(_0x5617('0x4'));var moment=require('moment');var BPromise=require(_0x5617('0x5'));var Mustache=require(_0x5617('0x6'));var util=require('util');var path=require('path');var sox=require(_0x5617('0x7'));var csv=require('to-csv');var ejs=require(_0x5617('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5617('0x9'));var crypto=require(_0x5617('0xa'));var jsforce=require(_0x5617('0xb'));var deskjs=require(_0x5617('0xc'));var toCsv=require(_0x5617('0xd'));var querystring=require(_0x5617('0xe'));var Papa=require(_0x5617('0xf'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0x5617('0x10'));var logger=require(_0x5617('0x11'))('api');var utils=require(_0x5617('0x12'));var config=require('../../config/environment');var db=require(_0x5617('0x13'))['db'];function respondWithStatusCode(_0x2779db,_0x2bd688){_0x2bd688=_0x2bd688||0xcc;return function(_0x391168){if(_0x391168){return _0x2779db['sendStatus'](_0x2bd688);}return _0x2779db[_0x5617('0x14')](_0x2bd688)['end']();};}function respondWithResult(_0x41bfd8,_0x3a657d){_0x3a657d=_0x3a657d||0xc8;return function(_0x25c68e){if(_0x25c68e){return _0x41bfd8[_0x5617('0x14')](_0x3a657d)[_0x5617('0x15')](_0x25c68e);}};}function respondWithFilteredResult(_0x1ec782,_0x594536){return function(_0x35e8e8){if(_0x35e8e8){var _0x3c1ada=_0x35e8e8[_0x5617('0x16')],_0x550535=_0x594536[_0x5617('0x17')],_0x3202a4=_0x594536[_0x5617('0x17')]+_0x594536['limit'],_0x45e532;if(_0x3202a4>=_0x3c1ada){_0x3202a4=_0x3c1ada;_0x45e532=0xc8;}else{_0x45e532=0xce;}_0x1ec782[_0x5617('0x14')](_0x45e532);return _0x1ec782[_0x5617('0x18')](_0x5617('0x19'),_0x550535+'-'+_0x3202a4+'/'+_0x3c1ada)[_0x5617('0x15')](_0x35e8e8);}return null;};}function patchUpdates(_0x78e563){return function(_0x3757ad){try{jsonpatch[_0x5617('0x1a')](_0x3757ad,_0x78e563,!![]);}catch(_0x48622e){return BPromise['reject'](_0x48622e);}return _0x3757ad['save']();};}function saveUpdates(_0x5ba9d3,_0x4ab582){return function(_0x51654f){if(_0x51654f){return _0x51654f['update'](_0x5ba9d3)[_0x5617('0x1b')](function(_0x3cb4e3){return _0x3cb4e3;});}return null;};}function removeEntity(_0xb4557d,_0x56e681){return function(_0xa0a860){if(_0xa0a860){return _0xa0a860[_0x5617('0x1c')]()[_0x5617('0x1b')](function(){_0xb4557d[_0x5617('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d8062,_0x47f926){return function(_0x34fce5){if(!_0x34fce5){_0x3d8062['sendStatus'](0x194);}return _0x34fce5;};}function handleError(_0x29f4f6,_0x16c63d){_0x16c63d=_0x16c63d||0x1f4;return function(_0x36b6b5){logger[_0x5617('0x1d')](_0x36b6b5['stack']);if(_0x36b6b5['name']){delete _0x36b6b5[_0x5617('0x1e')];}_0x29f4f6[_0x5617('0x14')](_0x16c63d)[_0x5617('0x1f')](_0x36b6b5);};}var utilLicense=require(_0x5617('0x20'));exports[_0x5617('0x21')]=function(_0x67227c,_0x498b00){var _0x2e247d={'raw':!![],'where':{'id':0x1}},_0x4ced73={};_0x4ced73[_0x5617('0x22')]=_[_0x5617('0x23')](db['License']['rawAttributes']);_0x4ced73[_0x5617('0x24')]=_[_0x5617('0x23')](_0x67227c[_0x5617('0x24')]);_0x4ced73[_0x5617('0x25')]=_['intersection'](_0x4ced73[_0x5617('0x22')],_0x4ced73['query']);_0x2e247d['attributes']=_['intersection'](_0x4ced73[_0x5617('0x22')],qs['fields'](_0x67227c[_0x5617('0x24')]['fields']));_0x2e247d['attributes']=_0x2e247d[_0x5617('0x26')][_0x5617('0x27')]?_0x2e247d[_0x5617('0x26')]:_0x4ced73[_0x5617('0x22')];_0x2e247d=_[_0x5617('0x28')]({},_0x2e247d,_0x67227c['options']);return utilLicense[_0x5617('0x29')](_0x2e247d)[_0x5617('0x1b')](respondWithResult(_0x498b00,null))[_0x5617('0x2a')](handleError(_0x498b00,null));};exports[_0x5617('0x2b')]=function(_0x2e5d8c,_0x36b8c7){if(_0x2e5d8c[_0x5617('0x2c')]['id']){delete _0x2e5d8c[_0x5617('0x2c')]['id'];}return db[_0x5617('0x2d')][_0x5617('0x2e')]({'where':{'id':_0x2e5d8c[_0x5617('0x2f')]['id']}})[_0x5617('0x1b')](handleEntityNotFound(_0x36b8c7,null))[_0x5617('0x1b')](function(_0x4003c1){var _0xcf1b71=_0x4003c1[_0x5617('0x30')]({'plain':!![]});return utilLicense[_0x5617('0x31')](_0xcf1b71,_0x2e5d8c['body'][_0x5617('0x32')]);})[_0x5617('0x1b')](function(_0x5da72c){if(!_0x5da72c[_0x5617('0x33')]){return saveUpdates(_0x2e5d8c[_0x5617('0x2c')],null);}return _0x5da72c;})[_0x5617('0x1b')](respondWithResult(_0x36b8c7,null))['catch'](handleError(_0x36b8c7,null));}; \ No newline at end of file +var _0xd189=['request-promise','moment','bluebird','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','json','reject','save','update','then','destroy','end','stack','send','../../config/license/util','index','keys','License','query','filters','intersection','model','attributes','fields','length','catch','body','find','get','checkLicense','key','demo','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x26f483,_0x24c32c){var _0x18f402=function(_0x19d8af){while(--_0x19d8af){_0x26f483['push'](_0x26f483['shift']());}};_0x18f402(++_0x24c32c);}(_0xd189,0x119));var _0x9d18=function(_0x5431f5,_0x4f91a0){_0x5431f5=_0x5431f5-0x0;var _0x5caac7=_0xd189[_0x5431f5];return _0x5caac7;};'use strict';var pdf=require(_0x9d18('0x0'));var emlformat=require(_0x9d18('0x1'));var rimraf=require(_0x9d18('0x2'));var zipdir=require(_0x9d18('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9d18('0x4'));var moment=require(_0x9d18('0x5'));var BPromise=require(_0x9d18('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9d18('0x7'));var sox=require(_0x9d18('0x8'));var csv=require('to-csv');var ejs=require(_0x9d18('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9d18('0xa'));var crypto=require(_0x9d18('0xb'));var jsforce=require(_0x9d18('0xc'));var deskjs=require(_0x9d18('0xd'));var toCsv=require(_0x9d18('0xe'));var querystring=require(_0x9d18('0xf'));var Papa=require(_0x9d18('0x10'));var authService=require(_0x9d18('0x11'));var hardwareService=require(_0x9d18('0x12'));var Redis=require('ioredis');var qs=require(_0x9d18('0x13'));var logger=require('../../config/logger')(_0x9d18('0x14'));var utils=require(_0x9d18('0x15'));var config=require(_0x9d18('0x16'));var db=require(_0x9d18('0x17'))['db'];function respondWithStatusCode(_0x21b6e3,_0x5bfdbf){_0x5bfdbf=_0x5bfdbf||0xcc;return function(_0xbdab94){if(_0xbdab94){return _0x21b6e3[_0x9d18('0x18')](_0x5bfdbf);}return _0x21b6e3[_0x9d18('0x19')](_0x5bfdbf)['end']();};}function respondWithResult(_0x5363e5,_0x11a7b0){_0x11a7b0=_0x11a7b0||0xc8;return function(_0x28607a){if(_0x28607a){return _0x5363e5['status'](_0x11a7b0)['json'](_0x28607a);}};}function respondWithFilteredResult(_0x31b73d,_0x123497){return function(_0x383ba1){if(_0x383ba1){var _0x524389=_0x383ba1[_0x9d18('0x1a')],_0x1b1e6d=_0x123497[_0x9d18('0x1b')],_0x28f908=_0x123497['offset']+_0x123497['limit'],_0x58fc96;if(_0x28f908>=_0x524389){_0x28f908=_0x524389;_0x58fc96=0xc8;}else{_0x58fc96=0xce;}_0x31b73d[_0x9d18('0x19')](_0x58fc96);return _0x31b73d[_0x9d18('0x1c')](_0x9d18('0x1d'),_0x1b1e6d+'-'+_0x28f908+'/'+_0x524389)[_0x9d18('0x1e')](_0x383ba1);}return null;};}function patchUpdates(_0x2d1cf7){return function(_0x222e4a){try{jsonpatch['apply'](_0x222e4a,_0x2d1cf7,!![]);}catch(_0x18eeb9){return BPromise[_0x9d18('0x1f')](_0x18eeb9);}return _0x222e4a[_0x9d18('0x20')]();};}function saveUpdates(_0x349ca9,_0x54cf2a){return function(_0x2d46e7){if(_0x2d46e7){return _0x2d46e7[_0x9d18('0x21')](_0x349ca9)[_0x9d18('0x22')](function(_0x285fb6){return _0x285fb6;});}return null;};}function removeEntity(_0x4897c7,_0x4534bc){return function(_0x258c2b){if(_0x258c2b){return _0x258c2b[_0x9d18('0x23')]()[_0x9d18('0x22')](function(){_0x4897c7[_0x9d18('0x19')](0xcc)[_0x9d18('0x24')]();});}};}function handleEntityNotFound(_0x144f46,_0x442c0f){return function(_0x530ba4){if(!_0x530ba4){_0x144f46[_0x9d18('0x18')](0x194);}return _0x530ba4;};}function handleError(_0x137474,_0x4b9f5e){_0x4b9f5e=_0x4b9f5e||0x1f4;return function(_0x377ae0){logger['error'](_0x377ae0[_0x9d18('0x25')]);if(_0x377ae0['name']){delete _0x377ae0['name'];}_0x137474[_0x9d18('0x19')](_0x4b9f5e)[_0x9d18('0x26')](_0x377ae0);};}var utilLicense=require(_0x9d18('0x27'));exports[_0x9d18('0x28')]=function(_0x4b8cfb,_0x148014){var _0x3e2787={'raw':!![],'where':{'id':0x1}},_0x199775={};_0x199775['model']=_[_0x9d18('0x29')](db[_0x9d18('0x2a')]['rawAttributes']);_0x199775[_0x9d18('0x2b')]=_[_0x9d18('0x29')](_0x4b8cfb[_0x9d18('0x2b')]);_0x199775[_0x9d18('0x2c')]=_[_0x9d18('0x2d')](_0x199775[_0x9d18('0x2e')],_0x199775['query']);_0x3e2787[_0x9d18('0x2f')]=_[_0x9d18('0x2d')](_0x199775[_0x9d18('0x2e')],qs['fields'](_0x4b8cfb['query'][_0x9d18('0x30')]));_0x3e2787[_0x9d18('0x2f')]=_0x3e2787[_0x9d18('0x2f')][_0x9d18('0x31')]?_0x3e2787[_0x9d18('0x2f')]:_0x199775['model'];_0x3e2787=_['merge']({},_0x3e2787,_0x4b8cfb['options']);return utilLicense['getLicense'](_0x3e2787)['then'](respondWithResult(_0x148014,null))[_0x9d18('0x32')](handleError(_0x148014,null));};exports[_0x9d18('0x21')]=function(_0x563c0e,_0x45044d){if(_0x563c0e[_0x9d18('0x33')]['id']){delete _0x563c0e[_0x9d18('0x33')]['id'];}return db[_0x9d18('0x2a')][_0x9d18('0x34')]({'where':{'id':_0x563c0e['params']['id']}})[_0x9d18('0x22')](handleEntityNotFound(_0x45044d,null))['then'](function(_0xe341be){var _0x184a54=_0xe341be[_0x9d18('0x35')]({'plain':!![]});return utilLicense[_0x9d18('0x36')](_0x184a54,_0x563c0e[_0x9d18('0x33')][_0x9d18('0x37')]);})['then'](function(_0x172098){if(!_0x172098[_0x9d18('0x38')]){return saveUpdates(_0x563c0e[_0x9d18('0x33')],null);}return _0x172098;})[_0x9d18('0x22')](respondWithResult(_0x45044d,null))[_0x9d18('0x32')](handleError(_0x45044d,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 3a70f44..f00307b 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 _0x5577=['./license.attributes','exports','License','license','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x8da9a1,_0x1bdbb7){var _0x429268=function(_0x562eee){while(--_0x562eee){_0x8da9a1['push'](_0x8da9a1['shift']());}};_0x429268(++_0x1bdbb7);}(_0x5577,0x1b4));var _0x7557=function(_0x219880,_0x395fac){_0x219880=_0x219880-0x0;var _0x2abc56=_0x5577[_0x219880];return _0x2abc56;};'use strict';var _=require(_0x7557('0x0'));var util=require('util');var logger=require(_0x7557('0x1'))(_0x7557('0x2'));var moment=require('moment');var BPromise=require(_0x7557('0x3'));var rp=require(_0x7557('0x4'));var attributes=require(_0x7557('0x5'));module[_0x7557('0x6')]=function(_0x1274d5,_0x2d3c40){return _0x1274d5['define'](_0x7557('0x7'),attributes,{'tableName':_0x7557('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde9d=['define','License','lodash','util','../../config/logger','api','moment','request-promise','./license.attributes','exports'];(function(_0x99ff94,_0x47a1b1){var _0x1b5bc0=function(_0x25821f){while(--_0x25821f){_0x99ff94['push'](_0x99ff94['shift']());}};_0x1b5bc0(++_0x47a1b1);}(_0xde9d,0x156));var _0xdde9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xde9d[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xdde9('0x0'));var util=require(_0xdde9('0x1'));var logger=require(_0xdde9('0x2'))(_0xdde9('0x3'));var moment=require(_0xdde9('0x4'));var BPromise=require('bluebird');var rp=require(_0xdde9('0x5'));var attributes=require(_0xdde9('0x6'));module[_0xdde9('0x7')]=function(_0x4a5ea5,_0x35a664){return _0x4a5ea5[_0xdde9('0x8')](_0xdde9('0x9'),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 885fa33..9c40d7c 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 _0xa1f5=['then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request'];(function(_0x446c79,_0x4bddd2){var _0x3fab73=function(_0xf3d07){while(--_0xf3d07){_0x446c79['push'](_0x446c79['shift']());}};_0x3fab73(++_0x4bddd2);}(_0xa1f5,0xc7));var _0x5a1f=function(_0x458c48,_0x17fdb1){_0x458c48=_0x458c48-0x0;var _0x31f9ac=_0xa1f5[_0x458c48];return _0x31f9ac;};'use strict';var _=require(_0x5a1f('0x0'));var util=require(_0x5a1f('0x1'));var moment=require('moment');var BPromise=require(_0x5a1f('0x2'));var rs=require(_0x5a1f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a1f('0x4'))['db'];var utils=require(_0x5a1f('0x5'));var logger=require(_0x5a1f('0x6'))(_0x5a1f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5a1f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4017ac,_0x168aee,_0x4748b5){return new BPromise(function(_0xa1a948,_0x4e29eb){return client[_0x5a1f('0x9')](_0x4017ac,_0x4748b5)[_0x5a1f('0xa')](function(_0x4b1fec){logger[_0x5a1f('0xb')](_0x5a1f('0xc'),_0x168aee,_0x5a1f('0xd'));logger['debug'](_0x5a1f('0xe'),_0x168aee,'request\x20sent',JSON['stringify'](_0x4b1fec));if(_0x4b1fec['error']){if(_0x4b1fec[_0x5a1f('0xf')][_0x5a1f('0x10')]===0x1f4){logger[_0x5a1f('0xf')](_0x5a1f('0xc'),_0x168aee,_0x4b1fec['error'][_0x5a1f('0x11')]);return _0x4e29eb(_0x4b1fec[_0x5a1f('0xf')][_0x5a1f('0x11')]);}logger[_0x5a1f('0xf')](_0x5a1f('0xc'),_0x168aee,_0x4b1fec['error']['message']);return _0xa1a948(_0x4b1fec[_0x5a1f('0xf')][_0x5a1f('0x11')]);}else{logger[_0x5a1f('0xb')]('License,\x20%s,\x20%s',_0x168aee,'request\x20sent');_0xa1a948(_0x4b1fec[_0x5a1f('0x12')]['message']);}})['catch'](function(_0x366dac){logger[_0x5a1f('0xf')](_0x5a1f('0xc'),_0x168aee,_0x366dac);_0x4e29eb(_0x366dac);});});} \ No newline at end of file +var _0x58db=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x58db,0xd4));var _0xb58d=function(_0xcb7608,_0x55916b){_0xcb7608=_0xcb7608-0x0;var _0x612d36=_0x58db[_0xcb7608];return _0x612d36;};'use strict';var _=require(_0xb58d('0x0'));var util=require('util');var moment=require(_0xb58d('0x1'));var BPromise=require(_0xb58d('0x2'));var rs=require(_0xb58d('0x3'));var fs=require('fs');var Redis=require(_0xb58d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb58d('0x5'));var logger=require(_0xb58d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb58d('0x7'));var client=jayson['client'][_0xb58d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c2aab,_0x3e5030,_0x2d1f07){return new BPromise(function(_0x5e54af,_0x6d9fdb){return client[_0xb58d('0x9')](_0x2c2aab,_0x2d1f07)[_0xb58d('0xa')](function(_0x53bb26){logger[_0xb58d('0xb')](_0xb58d('0xc'),_0x3e5030,_0xb58d('0xd'));logger[_0xb58d('0xe')]('License,\x20%s,\x20%s,\x20%s',_0x3e5030,_0xb58d('0xd'),JSON['stringify'](_0x53bb26));if(_0x53bb26[_0xb58d('0xf')]){if(_0x53bb26[_0xb58d('0xf')]['code']===0x1f4){logger[_0xb58d('0xf')](_0xb58d('0xc'),_0x3e5030,_0x53bb26[_0xb58d('0xf')][_0xb58d('0x10')]);return _0x6d9fdb(_0x53bb26[_0xb58d('0xf')][_0xb58d('0x10')]);}logger[_0xb58d('0xf')]('License,\x20%s,\x20%s',_0x3e5030,_0x53bb26['error'][_0xb58d('0x10')]);return _0x5e54af(_0x53bb26['error'][_0xb58d('0x10')]);}else{logger['info'](_0xb58d('0xc'),_0x3e5030,_0xb58d('0xd'));_0x5e54af(_0x53bb26[_0xb58d('0x11')][_0xb58d('0x10')]);}})[_0xb58d('0x12')](function(_0x334c60){logger['error']('License,\x20%s,\x20%s',_0x3e5030,_0x334c60);_0x6d9fdb(_0x334c60);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 50e551b..88ea448 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 _0xf09a=['update','delete','removeDispositions','removeSmtp','destroy','removeAgents','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','index','isAuthenticated','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','/:id/messages','/:id/verify','/:id/users','getAgents','post','addDisposition','addAnswer','create','/:id/in_servers','addSmtp','/:id/send','addAgents'];(function(_0x271571,_0x4737a8){var _0x30fde9=function(_0x185b6b){while(--_0x185b6b){_0x271571['push'](_0x271571['shift']());}};_0x30fde9(++_0x4737a8);}(_0xf09a,0x182));var _0xaf09=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0xf09a[_0x2d8d69];return _0x39ae22;};'use strict';var multer=require('multer');var util=require(_0xaf09('0x0'));var path=require(_0xaf09('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaf09('0x2')]();var auth=require(_0xaf09('0x3'));var interaction=require(_0xaf09('0x4'));var config=require(_0xaf09('0x5'));var controller=require(_0xaf09('0x6'));router[_0xaf09('0x7')]('/',auth['isAuthenticated'](),controller[_0xaf09('0x8')]);router[_0xaf09('0x7')]('/describe',auth[_0xaf09('0x9')](),controller['describe']);router[_0xaf09('0x7')](_0xaf09('0xa'),auth['isAuthenticated'](),controller[_0xaf09('0xb')]);router['get'](_0xaf09('0xc'),auth[_0xaf09('0x9')](),controller['getDispositions']);router[_0xaf09('0x7')](_0xaf09('0xd'),auth[_0xaf09('0x9')](),controller[_0xaf09('0xe')]);router[_0xaf09('0x7')]('/:id/in_servers',auth[_0xaf09('0x9')](),controller[_0xaf09('0xf')]);router['get'](_0xaf09('0x10'),auth[_0xaf09('0x9')](),controller[_0xaf09('0x11')]);router[_0xaf09('0x7')](_0xaf09('0x12'),auth[_0xaf09('0x9')](),controller['getInteractions']);router[_0xaf09('0x7')](_0xaf09('0x13'),auth[_0xaf09('0x9')](),controller['getApplications']);router['get'](_0xaf09('0x14'),auth['isAuthenticated'](),controller['getMessages']);router[_0xaf09('0x7')](_0xaf09('0x15'),auth[_0xaf09('0x9')](),controller['verifySmtp']);router[_0xaf09('0x7')](_0xaf09('0x16'),auth['isAuthenticated'](),controller[_0xaf09('0x17')]);router[_0xaf09('0x18')](_0xaf09('0xc'),auth[_0xaf09('0x9')](),controller[_0xaf09('0x19')]);router[_0xaf09('0x18')](_0xaf09('0xd'),auth[_0xaf09('0x9')](),controller[_0xaf09('0x1a')]);router['post']('/',auth[_0xaf09('0x9')](),controller[_0xaf09('0x1b')]);router['post'](_0xaf09('0x1c'),auth[_0xaf09('0x9')](),controller['addImap']);router[_0xaf09('0x18')](_0xaf09('0x10'),auth[_0xaf09('0x9')](),controller[_0xaf09('0x1d')]);router['post']('/:id/interactions',auth[_0xaf09('0x9')](),controller['addInteraction']);router[_0xaf09('0x18')](_0xaf09('0x13'),auth[_0xaf09('0x9')](),controller['addApplications']);router['post'](_0xaf09('0x1e'),auth[_0xaf09('0x9')](),controller['send']);router[_0xaf09('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0xaf09('0x1f')]);router['put'](_0xaf09('0xa'),auth[_0xaf09('0x9')](),controller[_0xaf09('0x20')]);router[_0xaf09('0x21')](_0xaf09('0xc'),auth[_0xaf09('0x9')](),controller[_0xaf09('0x22')]);router['delete'](_0xaf09('0xd'),auth[_0xaf09('0x9')](),controller['removeAnswers']);router[_0xaf09('0x21')](_0xaf09('0x1c'),auth[_0xaf09('0x9')](),controller['removeImap']);router[_0xaf09('0x21')](_0xaf09('0x10'),auth[_0xaf09('0x9')](),controller[_0xaf09('0x23')]);router[_0xaf09('0x21')](_0xaf09('0xa'),auth[_0xaf09('0x9')](),controller[_0xaf09('0x24')]);router[_0xaf09('0x21')](_0xaf09('0x16'),auth['isAuthenticated'](),controller[_0xaf09('0x25')]);module['exports']=router; \ No newline at end of file +var _0x19b1=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','addDisposition','post','addAnswer','addImap','addSmtp','addApplications','/:id/send','send','addAgents','update','delete','removeDispositions','removeImap','removeSmtp','removeAgents','exports','util','connect-timeout','Router'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x19b1,0x17d));var _0x119b=function(_0xd21fe7,_0x225a39){_0xd21fe7=_0xd21fe7-0x0;var _0x14d570=_0x19b1[_0xd21fe7];return _0x14d570;};'use strict';var multer=require('multer');var util=require(_0x119b('0x0'));var path=require('path');var timeout=require(_0x119b('0x1'));var express=require('express');var router=express[_0x119b('0x2')]();var auth=require(_0x119b('0x3'));var interaction=require(_0x119b('0x4'));var config=require(_0x119b('0x5'));var controller=require(_0x119b('0x6'));router[_0x119b('0x7')]('/',auth[_0x119b('0x8')](),controller[_0x119b('0x9')]);router['get'](_0x119b('0xa'),auth[_0x119b('0x8')](),controller[_0x119b('0xb')]);router[_0x119b('0x7')](_0x119b('0xc'),auth[_0x119b('0x8')](),controller[_0x119b('0xd')]);router['get'](_0x119b('0xe'),auth[_0x119b('0x8')](),controller[_0x119b('0xf')]);router[_0x119b('0x7')](_0x119b('0x10'),auth[_0x119b('0x8')](),controller[_0x119b('0x11')]);router[_0x119b('0x7')](_0x119b('0x12'),auth[_0x119b('0x8')](),controller[_0x119b('0x13')]);router[_0x119b('0x7')](_0x119b('0x14'),auth[_0x119b('0x8')](),controller[_0x119b('0x15')]);router[_0x119b('0x7')](_0x119b('0x16'),auth['isAuthenticated'](),controller[_0x119b('0x17')]);router['get'](_0x119b('0x18'),auth[_0x119b('0x8')](),controller[_0x119b('0x19')]);router['get'](_0x119b('0x1a'),auth[_0x119b('0x8')](),controller[_0x119b('0x1b')]);router[_0x119b('0x7')](_0x119b('0x1c'),auth[_0x119b('0x8')](),controller[_0x119b('0x1d')]);router[_0x119b('0x7')](_0x119b('0x1e'),auth['isAuthenticated'](),controller[_0x119b('0x1f')]);router['post']('/:id/dispositions',auth[_0x119b('0x8')](),controller[_0x119b('0x20')]);router[_0x119b('0x21')](_0x119b('0x10'),auth['isAuthenticated'](),controller[_0x119b('0x22')]);router[_0x119b('0x21')]('/',auth[_0x119b('0x8')](),controller['create']);router[_0x119b('0x21')]('/:id/in_servers',auth[_0x119b('0x8')](),controller[_0x119b('0x23')]);router['post'](_0x119b('0x14'),auth[_0x119b('0x8')](),controller[_0x119b('0x24')]);router[_0x119b('0x21')](_0x119b('0x16'),auth[_0x119b('0x8')](),controller['addInteraction']);router[_0x119b('0x21')](_0x119b('0x18'),auth[_0x119b('0x8')](),controller[_0x119b('0x25')]);router[_0x119b('0x21')](_0x119b('0x26'),auth['isAuthenticated'](),controller[_0x119b('0x27')]);router[_0x119b('0x21')]('/:id/users',auth[_0x119b('0x8')](),controller[_0x119b('0x28')]);router['put'](_0x119b('0xc'),auth[_0x119b('0x8')](),controller[_0x119b('0x29')]);router[_0x119b('0x2a')](_0x119b('0xe'),auth[_0x119b('0x8')](),controller[_0x119b('0x2b')]);router[_0x119b('0x2a')](_0x119b('0x10'),auth[_0x119b('0x8')](),controller['removeAnswers']);router['delete'](_0x119b('0x12'),auth['isAuthenticated'](),controller[_0x119b('0x2c')]);router[_0x119b('0x2a')](_0x119b('0x14'),auth[_0x119b('0x8')](),controller[_0x119b('0x2d')]);router['delete']('/:id',auth[_0x119b('0x8')](),controller['destroy']);router[_0x119b('0x2a')](_0x119b('0x1e'),auth[_0x119b('0x8')](),controller[_0x119b('0x2e')]);module[_0x119b('0x2f')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 8fd41bd..ec4611e 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 _0x8bd1=['STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x27ccc6,_0x59845e){var _0x1940dd=function(_0x53a907){while(--_0x53a907){_0x27ccc6['push'](_0x27ccc6['shift']());}};_0x1940dd(++_0x59845e);}(_0x8bd1,0xfb));var _0x18bd=function(_0x43c09d,_0x151dbe){_0x43c09d=_0x43c09d-0x0;var _0x5ace59=_0x8bd1[_0x43c09d];return _0x5ace59;};'use strict';var Sequelize=require(_0x18bd('0x0'));module['exports']={'description':{'type':Sequelize[_0x18bd('0x1')]},'name':{'type':Sequelize[_0x18bd('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x18bd('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x18bd('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x18bd('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x18bd('0x3')]},'markAsUnread':{'type':Sequelize[_0x18bd('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x18bd('0x1')],'allowNull':![],'defaultValue':_0x18bd('0x4')},'fontSize':{'type':Sequelize[_0x18bd('0x5')](0x2)[_0x18bd('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x18bd('0x3')],'defaultValue':function(){return _0x18bd('0x7');}},'notificationSound':{'type':Sequelize[_0x18bd('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x18bd('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x18bd('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x18bd('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x18bd('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x18bd('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x18bd('0x2')],'defaultValue':![],'comment':_0x18bd('0x8'),'set':function(_0x2de40d){if(!_0x2de40d)this[_0x18bd('0x9')](_0x18bd('0xa'),null);this['setDataValue'](_0x18bd('0xb'),_0x2de40d);}}}; \ No newline at end of file +var _0xedbe=['TEXT','BOOLEAN','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING'];(function(_0x4e6eac,_0x3f4365){var _0x79f963=function(_0x36fc3c){while(--_0x36fc3c){_0x4e6eac['push'](_0x4e6eac['shift']());}};_0x79f963(++_0x3f4365);}(_0xedbe,0x99));var _0xeedb=function(_0x5167b3,_0x50c684){_0x5167b3=_0x5167b3-0x0;var _0x17625e=_0xedbe[_0x5167b3];return _0x17625e;};'use strict';var Sequelize=require(_0xeedb('0x0'));module[_0xeedb('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xeedb('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xeedb('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xeedb('0x3')]},'markAsUnread':{'type':Sequelize[_0xeedb('0x4')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xeedb('0x2')],'allowNull':![],'defaultValue':_0xeedb('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xeedb('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xeedb('0x3')],'defaultValue':function(){return _0xeedb('0x7');}},'notificationSound':{'type':Sequelize[_0xeedb('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xeedb('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xeedb('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xeedb('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xeedb('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xeedb('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xeedb('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xeedb('0x4')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3d5659){if(!_0x3d5659)this['setDataValue'](_0xeedb('0xa'),null);this[_0xeedb('0xb')](_0xeedb('0xc'),_0x3d5659);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index a58ce7d..48bd628 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 _0x292e=['attach','messageId','Interaction','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','register','jayson/promise','client','http','request','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','MailAccounts','UserProfileResource','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','rawAttributes','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','type','key','field','filter','options','includeAll','include','findAll','rows','show','MailAccount','length','body','params','describe','find','Disposition','create','findOne','nolimit','MailAccountId','map','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','email','ListId','isNil','description','cservice','cauthentication','cuser','password','pass','cpassword','authentication','host','port','service','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','transaction','MailApplication','findAndCountAll','getApplications','getMessages','MailMessage','split','YYYY-MM-DD\x20HH:mm:ss','Contacts','updatedAt','DESC','from','format','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','List','subject'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x292e,0xcb));var _0xe292=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x292e[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require(_0xe292('0x0'));var emlformat=require(_0xe292('0x1'));var rimraf=require(_0xe292('0x2'));var zipdir=require(_0xe292('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe292('0x4'));var BPromise=require(_0xe292('0x5'));var Mustache=require(_0xe292('0x6'));var util=require(_0xe292('0x7'));var path=require('path');var sox=require(_0xe292('0x8'));var csv=require('to-csv');var ejs=require(_0xe292('0x9'));var fs=require('fs');var _=require(_0xe292('0xa'));var squel=require(_0xe292('0xb'));var crypto=require(_0xe292('0xc'));var jsforce=require(_0xe292('0xd'));var deskjs=require(_0xe292('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe292('0xf'));var authService=require(_0xe292('0x10'));var hardwareService=require(_0xe292('0x11'));var Redis=require(_0xe292('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0xe292('0x13'))(_0xe292('0x14'));var utils=require('../../config/utils');var config=require(_0xe292('0x15'));var db=require(_0xe292('0x16'))['db'];config[_0xe292('0x17')]=_[_0xe292('0x18')](config[_0xe292('0x17')],{'host':_0xe292('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe292('0x17')]));require(_0xe292('0x1a'))[_0xe292('0x1b')](socket);var jayson=require(_0xe292('0x1c'));var client=jayson[_0xe292('0x1d')][_0xe292('0x1e')]({'port':0x232b});function respondWithRpcPromise(_0x3a2a83,_0x5d5465,_0xd12cdd,_0x1de9ec){return new BPromise(function(_0x51fa78,_0x582549){var _0x46593f=_0x1de9ec||client;return _0x46593f[_0xe292('0x1f')](_0x3a2a83,_0xd12cdd)[_0xe292('0x20')](function(_0x400afc){logger['info'](_0xe292('0x21'),_0x5d5465,'request\x20sent');logger[_0xe292('0x22')](_0xe292('0x23'),_0x5d5465,'request\x20sent',JSON[_0xe292('0x24')](_0x400afc));if(_0x400afc[_0xe292('0x25')]){if(_0x400afc[_0xe292('0x25')]['code']===0x1f4){logger[_0xe292('0x25')](_0xe292('0x21'),_0x5d5465,_0x400afc['error'][_0xe292('0x26')]);return _0x582549(_0x400afc[_0xe292('0x25')][_0xe292('0x26')]);}logger[_0xe292('0x25')](_0xe292('0x21'),_0x5d5465,_0x400afc[_0xe292('0x25')]['message']);return _0x51fa78(_0x400afc[_0xe292('0x25')][_0xe292('0x26')]);}else{logger[_0xe292('0x27')](_0xe292('0x21'),_0x5d5465,_0xe292('0x28'));_0x51fa78(_0x400afc[_0xe292('0x29')][_0xe292('0x26')]);}})[_0xe292('0x2a')](function(_0x8370db){logger['error'](_0xe292('0x21'),_0x5d5465,_0x8370db);_0x582549(_0x8370db);});});}function respondWithStatusCode(_0x412c0a,_0x4c4510){_0x4c4510=_0x4c4510||0xcc;return function(_0x488c76){if(_0x488c76){return _0x412c0a[_0xe292('0x2b')](_0x4c4510);}return _0x412c0a[_0xe292('0x2c')](_0x4c4510)[_0xe292('0x2d')]();};}function respondWithResult(_0x24cfe5,_0x3c8b85){_0x3c8b85=_0x3c8b85||0xc8;return function(_0x25de38){if(_0x25de38){return _0x24cfe5['status'](_0x3c8b85)[_0xe292('0x2e')](_0x25de38);}};}function respondWithFilteredResult(_0xdbbf1a,_0x1a963d){return function(_0x469d37){if(_0x469d37){var _0x5dabfc=_0x469d37[_0xe292('0x2f')],_0x215705=_0x1a963d[_0xe292('0x30')],_0x56d1bb=_0x1a963d[_0xe292('0x30')]+_0x1a963d[_0xe292('0x31')],_0x358ed5;if(_0x56d1bb>=_0x5dabfc){_0x56d1bb=_0x5dabfc;_0x358ed5=0xc8;}else{_0x358ed5=0xce;}_0xdbbf1a[_0xe292('0x2c')](_0x358ed5);return _0xdbbf1a[_0xe292('0x32')]('Content-Range',_0x215705+'-'+_0x56d1bb+'/'+_0x5dabfc)[_0xe292('0x2e')](_0x469d37);}return null;};}function patchUpdates(_0x147821){return function(_0x2137da){try{jsonpatch[_0xe292('0x33')](_0x2137da,_0x147821,!![]);}catch(_0x4b115d){return BPromise[_0xe292('0x34')](_0x4b115d);}return _0x2137da[_0xe292('0x35')]();};}function saveUpdates(_0xdadd79,_0x556506){return function(_0x264608){if(_0x264608){return _0x264608[_0xe292('0x36')](_0xdadd79)['then'](function(_0x18c19f){return _0x18c19f;});}return null;};}function removeEntity(_0x764fce,_0x5403d5){return function(_0x4fc348){if(_0x4fc348){return _0x4fc348[_0xe292('0x37')]()[_0xe292('0x20')](function(){var _0x49f293=_0x4fc348['get']({'plain':!![]});var _0x3f3350=_0xe292('0x38');return db[_0xe292('0x39')][_0xe292('0x37')]({'where':{'type':_0x3f3350,'resourceId':_0x49f293['id']}})[_0xe292('0x20')](function(){return _0x4fc348;});})['then'](function(){_0x764fce[_0xe292('0x2c')](0xcc)[_0xe292('0x2d')]();});}};}function handleEntityNotFound(_0x557a06,_0x1b3a01){return function(_0x585664){if(!_0x585664){_0x557a06[_0xe292('0x2b')](0x194);}return _0x585664;};}function handleError(_0x14925a,_0x1945e5){_0x1945e5=_0x1945e5||0x1f4;return function(_0x5a6fa2){logger[_0xe292('0x25')](_0x5a6fa2['stack']);if(_0x5a6fa2[_0xe292('0x3a')]){delete _0x5a6fa2[_0xe292('0x3a')];}_0x14925a[_0xe292('0x2c')](_0x1945e5)[_0xe292('0x3b')](_0x5a6fa2);};}exports[_0xe292('0x3c')]=function(_0x163202,_0x1ac0ce){var _0x3fbc52={'include':[{'model':db[_0xe292('0x3d')],'as':_0xe292('0x3e')},{'model':db[_0xe292('0x3f')],'as':_0xe292('0x40')},{'model':db[_0xe292('0x41')],'as':_0xe292('0x42')}]},_0x3cd008={},_0xecfd75={'count':0x0,'rows':[]};var _0x2c2551=db['MailAccount'][_0xe292('0x43')];_0x3cd008[_0xe292('0x44')]=_[_0xe292('0x45')](_0x2c2551);_0x3cd008['query']=_['keys'](_0x163202[_0xe292('0x46')]);_0x3cd008[_0xe292('0x47')]=_[_0xe292('0x48')](_0x3cd008['model'],_0x3cd008['query']);_0x3fbc52[_0xe292('0x49')]=_[_0xe292('0x48')](_0x3cd008[_0xe292('0x44')],qs[_0xe292('0x4a')](_0x163202[_0xe292('0x46')][_0xe292('0x4a')]));_0x3fbc52['attributes']=_0x3fbc52[_0xe292('0x49')]['length']?_0x3fbc52[_0xe292('0x49')]:_0x3cd008[_0xe292('0x44')];if(!_0x163202['query'][_0xe292('0x4b')]('nolimit')){_0x3fbc52['limit']=qs[_0xe292('0x31')](_0x163202[_0xe292('0x46')][_0xe292('0x31')]);_0x3fbc52[_0xe292('0x30')]=qs[_0xe292('0x30')](_0x163202[_0xe292('0x46')][_0xe292('0x30')]);}_0x3fbc52[_0xe292('0x4c')]=qs['sort'](_0x163202['query'][_0xe292('0x4d')]);_0x3fbc52[_0xe292('0x4e')]=qs[_0xe292('0x47')](_[_0xe292('0x4f')](_0x163202[_0xe292('0x46')],_0x3cd008[_0xe292('0x47')]));if(_0x163202[_0xe292('0x46')]['filter']){_0x3fbc52[_0xe292('0x4e')]=_[_0xe292('0x50')](_0x3fbc52['where'],{'$or':_['map'](_0x2c2551,function(_0x1f1294){if(_0x1f1294[_0xe292('0x51')][_0xe292('0x52')]!=='VIRTUAL'){var _0x3c9e06={};_0x3c9e06[_0x1f1294[_0xe292('0x53')]]={'$like':'%'+_0x163202[_0xe292('0x46')][_0xe292('0x54')]+'%'};return _0x3c9e06;}})});}_0x3fbc52=_[_0xe292('0x50')]({},_0x3fbc52,_0x163202[_0xe292('0x55')]);var _0x1a1122={'where':_0x3fbc52[_0xe292('0x4e')]};return db['MailAccount'][_0xe292('0x2f')](_0x1a1122)[_0xe292('0x20')](function(_0x440018){_0xecfd75[_0xe292('0x2f')]=_0x440018;if(_0x163202[_0xe292('0x46')][_0xe292('0x56')]){_0x3fbc52[_0xe292('0x57')]=[{'all':!![]}];}return db['MailAccount'][_0xe292('0x58')](_0x3fbc52);})['then'](function(_0x4ede4e){_0xecfd75[_0xe292('0x59')]=_0x4ede4e;return _0xecfd75;})[_0xe292('0x20')](respondWithFilteredResult(_0x1ac0ce,_0x3fbc52))['catch'](handleError(_0x1ac0ce,null));};exports[_0xe292('0x5a')]=function(_0xec6352,_0x296b15){var _0x3862a3={'raw':![],'where':{'id':_0xec6352['params']['id']},'include':[{'model':db[_0xe292('0x3d')],'as':_0xe292('0x3e')},{'model':db['MailServerOut'],'as':_0xe292('0x40')},{'model':db[_0xe292('0x41')],'as':_0xe292('0x42')}]},_0x10ccf0={};_0x10ccf0['model']=_[_0xe292('0x45')](db[_0xe292('0x5b')]['rawAttributes']);_0x10ccf0[_0xe292('0x46')]=_[_0xe292('0x45')](_0xec6352[_0xe292('0x46')]);_0x10ccf0[_0xe292('0x47')]=_[_0xe292('0x48')](_0x10ccf0[_0xe292('0x44')],_0x10ccf0[_0xe292('0x46')]);_0x3862a3[_0xe292('0x49')]=_[_0xe292('0x48')](_0x10ccf0['model'],qs[_0xe292('0x4a')](_0xec6352[_0xe292('0x46')]['fields']));_0x3862a3[_0xe292('0x49')]=_0x3862a3[_0xe292('0x49')][_0xe292('0x5c')]?_0x3862a3[_0xe292('0x49')]:_0x10ccf0['model'];if(_0xec6352[_0xe292('0x46')][_0xe292('0x56')]){_0x3862a3[_0xe292('0x57')]=[{'all':!![]}];}_0x3862a3=_[_0xe292('0x50')]({},_0x3862a3,_0xec6352[_0xe292('0x55')]);return db[_0xe292('0x5b')]['find'](_0x3862a3)[_0xe292('0x20')](handleEntityNotFound(_0x296b15,null))[_0xe292('0x20')](respondWithResult(_0x296b15,null))['catch'](handleError(_0x296b15,null));};exports[_0xe292('0x36')]=function(_0x728328,_0x5c99c9){if(_0x728328[_0xe292('0x5d')]['id']){delete _0x728328[_0xe292('0x5d')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x728328[_0xe292('0x5e')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0xe292('0x3f')],'as':_0xe292('0x40')},{'model':db[_0xe292('0x41')],'as':_0xe292('0x42')}]})['then'](handleEntityNotFound(_0x5c99c9,null))[_0xe292('0x20')](saveUpdates(_0x728328['body'],null))['then'](function(_0x1d4cf8){if(_0x1d4cf8&&_0x728328[_0xe292('0x5d')][_0xe292('0x3e')]){return db[_0xe292('0x3d')]['update'](_0x728328['body'][_0xe292('0x3e')],{'where':{'MailAccountId':_0x1d4cf8['id']}})[_0xe292('0x20')](function(){return _0x1d4cf8;});}return _0x1d4cf8;})['then'](function(_0x1f83e2){if(_0x1f83e2&&_0x728328[_0xe292('0x5d')][_0xe292('0x40')]){return db[_0xe292('0x3f')]['update'](_0x728328['body'][_0xe292('0x40')],{'where':{'MailAccountId':_0x1f83e2['id']}})['then'](function(){return _0x1f83e2;});}return _0x1f83e2;})[_0xe292('0x20')](respondWithResult(_0x5c99c9,null))[_0xe292('0x2a')](handleError(_0x5c99c9,null));};exports[_0xe292('0x5f')]=function(_0x39de88,_0x2a97b4){return db['MailAccount'][_0xe292('0x5f')]()[_0xe292('0x20')](respondWithResult(_0x2a97b4,null))[_0xe292('0x2a')](handleError(_0x2a97b4,null));};exports['addDisposition']=function(_0x4252d1,_0x200e9a,_0x3b3afe){if(_0x4252d1['body']['id']){delete _0x4252d1[_0xe292('0x5d')]['id'];}return db[_0xe292('0x5b')][_0xe292('0x60')]({'where':{'id':_0x4252d1[_0xe292('0x5e')]['id']}})[_0xe292('0x20')](handleEntityNotFound(_0x200e9a,null))[_0xe292('0x20')](function(_0x17d85f){if(_0x17d85f){_0x4252d1[_0xe292('0x5d')]['MailAccountId']=_0x17d85f['id'];return db[_0xe292('0x61')][_0xe292('0x62')](_0x4252d1[_0xe292('0x5d')]);}})[_0xe292('0x20')](respondWithResult(_0x200e9a,null))['catch'](handleError(_0x200e9a,null));};exports['getDispositions']=function(_0x2a15ad,_0x43b74e,_0x29ed0c){var _0x4b6f63={'raw':![],'where':{}};var _0x27eaf5={};var _0x20c800={'count':0x0,'rows':[]};return db[_0xe292('0x5b')][_0xe292('0x63')]({'where':{'id':_0x2a15ad['params']['id']}})['then'](handleEntityNotFound(_0x43b74e,null))['then'](function(_0x4443b4){if(_0x4443b4){_0x27eaf5['model']=_['keys'](db['Disposition']['rawAttributes']);_0x27eaf5[_0xe292('0x46')]=_['keys'](_0x2a15ad[_0xe292('0x46')]);_0x27eaf5[_0xe292('0x47')]=_[_0xe292('0x48')](_0x27eaf5[_0xe292('0x44')],_0x27eaf5[_0xe292('0x46')]);_0x4b6f63[_0xe292('0x49')]=_[_0xe292('0x48')](_0x27eaf5[_0xe292('0x44')],qs[_0xe292('0x4a')](_0x2a15ad['query'][_0xe292('0x4a')]));_0x4b6f63[_0xe292('0x49')]=_0x4b6f63[_0xe292('0x49')][_0xe292('0x5c')]?_0x4b6f63[_0xe292('0x49')]:_0x27eaf5[_0xe292('0x44')];if(!_0x2a15ad[_0xe292('0x46')][_0xe292('0x4b')](_0xe292('0x64'))){_0x4b6f63['limit']=qs['limit'](_0x2a15ad[_0xe292('0x46')][_0xe292('0x31')]);_0x4b6f63[_0xe292('0x30')]=qs[_0xe292('0x30')](_0x2a15ad[_0xe292('0x46')]['offset']);}_0x4b6f63[_0xe292('0x4c')]=qs[_0xe292('0x4d')](_0x2a15ad[_0xe292('0x46')][_0xe292('0x4d')]);_0x4b6f63[_0xe292('0x4e')]=qs[_0xe292('0x47')](_['pick'](_0x2a15ad[_0xe292('0x46')],_0x27eaf5['filters']));_0x4b6f63[_0xe292('0x4e')][_0xe292('0x65')]=_0x4443b4['id'];if(_0x2a15ad['query'][_0xe292('0x54')]){_0x4b6f63[_0xe292('0x4e')]=_['merge'](_0x4b6f63['where'],{'$or':_[_0xe292('0x66')](_0x4b6f63[_0xe292('0x49')],function(_0x54c026){var _0x2be47f={};_0x2be47f[_0x54c026]={'$like':'%'+_0x2a15ad[_0xe292('0x46')][_0xe292('0x54')]+'%'};return _0x2be47f;})});}_0x4b6f63=_[_0xe292('0x50')]({},_0x4b6f63,_0x2a15ad[_0xe292('0x55')]);return db[_0xe292('0x61')]['count']({'where':_0x4b6f63[_0xe292('0x4e')]})['then'](function(_0x4431b6){_0x20c800[_0xe292('0x2f')]=_0x4431b6;if(_0x2a15ad[_0xe292('0x46')][_0xe292('0x56')]){_0x4b6f63['include']=[{'all':!![]}];}return db[_0xe292('0x61')]['findAll'](_0x4b6f63);})[_0xe292('0x20')](function(_0x5454d4){_0x20c800['rows']=_0x5454d4;return _0x20c800;});}})[_0xe292('0x20')](respondWithFilteredResult(_0x43b74e,_0x4b6f63))['catch'](handleError(_0x43b74e,null));};exports[_0xe292('0x67')]=function(_0xc95f96,_0x46e9e5,_0x469302){var _0x3eb27a;return db[_0xe292('0x5b')]['find']({'where':{'id':_0xc95f96[_0xe292('0x5e')]['id']}})[_0xe292('0x20')](handleEntityNotFound(_0x46e9e5,null))[_0xe292('0x20')](function(_0x57e037){if(_0x57e037){return _0x57e037[_0xe292('0x67')](_0xc95f96[_0xe292('0x46')][_0xe292('0x68')]);}})[_0xe292('0x20')](respondWithStatusCode(_0x46e9e5,null))[_0xe292('0x2a')](handleError(_0x46e9e5,null));};exports[_0xe292('0x69')]=function(_0x5772a0,_0xbbea68,_0x4e9b12){if(_0x5772a0[_0xe292('0x5d')]['id']){delete _0x5772a0['body']['id'];}return db[_0xe292('0x5b')][_0xe292('0x60')]({'where':{'id':_0x5772a0[_0xe292('0x5e')]['id']}})['then'](handleEntityNotFound(_0xbbea68,null))[_0xe292('0x20')](function(_0x5005fe){if(_0x5005fe){_0x5772a0[_0xe292('0x5d')][_0xe292('0x65')]=_0x5005fe['id'];return db['CannedAnswer']['create'](_0x5772a0[_0xe292('0x5d')]);}})[_0xe292('0x20')](respondWithResult(_0xbbea68,null))[_0xe292('0x2a')](handleError(_0xbbea68,null));};exports[_0xe292('0x6a')]=function(_0x591eb1,_0x5b614e,_0x220eed){var _0x455d76={'raw':![],'where':{}};var _0x2fe027={};var _0xab815b={'count':0x0,'rows':[]};return db[_0xe292('0x5b')]['findOne']({'where':{'id':_0x591eb1[_0xe292('0x5e')]['id']}})[_0xe292('0x20')](handleEntityNotFound(_0x5b614e,null))[_0xe292('0x20')](function(_0x283496){if(_0x283496){_0x2fe027[_0xe292('0x44')]=_[_0xe292('0x45')](db[_0xe292('0x6b')][_0xe292('0x43')]);_0x2fe027[_0xe292('0x46')]=_[_0xe292('0x45')](_0x591eb1['query']);_0x2fe027[_0xe292('0x47')]=_[_0xe292('0x48')](_0x2fe027['model'],_0x2fe027[_0xe292('0x46')]);_0x455d76[_0xe292('0x49')]=_['intersection'](_0x2fe027[_0xe292('0x44')],qs[_0xe292('0x4a')](_0x591eb1['query'][_0xe292('0x4a')]));_0x455d76[_0xe292('0x49')]=_0x455d76[_0xe292('0x49')]['length']?_0x455d76[_0xe292('0x49')]:_0x2fe027[_0xe292('0x44')];if(!_0x591eb1[_0xe292('0x46')]['hasOwnProperty']('nolimit')){_0x455d76[_0xe292('0x31')]=qs[_0xe292('0x31')](_0x591eb1['query'][_0xe292('0x31')]);_0x455d76[_0xe292('0x30')]=qs[_0xe292('0x30')](_0x591eb1[_0xe292('0x46')][_0xe292('0x30')]);}_0x455d76[_0xe292('0x4c')]=qs[_0xe292('0x4d')](_0x591eb1[_0xe292('0x46')][_0xe292('0x4d')]);_0x455d76[_0xe292('0x4e')]=qs[_0xe292('0x47')](_[_0xe292('0x4f')](_0x591eb1[_0xe292('0x46')],_0x2fe027[_0xe292('0x47')]));_0x455d76[_0xe292('0x4e')]['MailAccountId']=_0x283496['id'];if(_0x591eb1[_0xe292('0x46')][_0xe292('0x54')]){_0x455d76[_0xe292('0x4e')]=_[_0xe292('0x50')](_0x455d76['where'],{'$or':_[_0xe292('0x66')](_0x455d76[_0xe292('0x49')],function(_0xf63d42){var _0x2cc9={};_0x2cc9[_0xf63d42]={'$like':'%'+_0x591eb1['query'][_0xe292('0x54')]+'%'};return _0x2cc9;})});}_0x455d76=_[_0xe292('0x50')]({},_0x455d76,_0x591eb1[_0xe292('0x55')]);return db[_0xe292('0x6b')]['count']({'where':_0x455d76[_0xe292('0x4e')]})[_0xe292('0x20')](function(_0xee0cad){_0xab815b['count']=_0xee0cad;if(_0x591eb1[_0xe292('0x46')][_0xe292('0x56')]){_0x455d76[_0xe292('0x57')]=[{'all':!![]}];}return db[_0xe292('0x6b')]['findAll'](_0x455d76);})[_0xe292('0x20')](function(_0x2634c7){_0xab815b[_0xe292('0x59')]=_0x2634c7;return _0xab815b;});}})[_0xe292('0x20')](respondWithFilteredResult(_0x5b614e,_0x455d76))['catch'](handleError(_0x5b614e,null));};exports[_0xe292('0x6c')]=function(_0x449681,_0x5df983,_0x1061e7){var _0x6f9b03;return db['MailAccount']['find']({'where':{'id':_0x449681['params']['id']}})[_0xe292('0x20')](handleEntityNotFound(_0x5df983,null))[_0xe292('0x20')](function(_0xe1b3dc){if(_0xe1b3dc){return _0xe1b3dc[_0xe292('0x6c')](_0x449681[_0xe292('0x46')][_0xe292('0x68')]);}})['then'](respondWithStatusCode(_0x5df983,null))[_0xe292('0x2a')](handleError(_0x5df983,null));};exports[_0xe292('0x62')]=function(_0x2a74c7,_0x41f611){var _0x4524e4={'name':_0x2a74c7[_0xe292('0x5d')][_0xe292('0x3a')],'key':_0x2a74c7[_0xe292('0x5d')][_0xe292('0x52')],'email':_0x2a74c7[_0xe292('0x5d')][_0xe292('0x6d')],'ListId':_0x2a74c7[_0xe292('0x5d')][_0xe292('0x6e')],'active':!_[_0xe292('0x6f')](_0x2a74c7[_0xe292('0x5d')]['active'])?_0x2a74c7[_0xe292('0x5d')]['active']:!![],'description':_0x2a74c7[_0xe292('0x5d')][_0xe292('0x70')]||null,'Imap':{},'Smtp':{}};if(_[_0xe292('0x6f')](_0x2a74c7['body'][_0xe292('0x71')])){if(_0x2a74c7[_0xe292('0x5d')][_0xe292('0x72')]){_0x4524e4[_0xe292('0x3e')]['user']=_0x4524e4['Smtp']['user']=_0x2a74c7['body'][_0xe292('0x73')];_0x4524e4[_0xe292('0x3e')][_0xe292('0x74')]=_0x4524e4['Smtp'][_0xe292('0x75')]=_0x2a74c7[_0xe292('0x5d')][_0xe292('0x76')];}else{_0x4524e4[_0xe292('0x3e')][_0xe292('0x77')]=_0x4524e4[_0xe292('0x40')][_0xe292('0x77')]=![];}_0x4524e4[_0xe292('0x3e')][_0xe292('0x78')]=_0x2a74c7[_0xe292('0x5d')][_0xe292('0x3e')][_0xe292('0x78')];_0x4524e4[_0xe292('0x3e')]['port']=_0x2a74c7[_0xe292('0x5d')][_0xe292('0x3e')][_0xe292('0x79')];_0x4524e4['Smtp'][_0xe292('0x78')]=_0x2a74c7[_0xe292('0x5d')][_0xe292('0x40')][_0xe292('0x78')];_0x4524e4[_0xe292('0x40')][_0xe292('0x79')]=_0x2a74c7[_0xe292('0x5d')][_0xe292('0x40')]['port'];}else{_0x4524e4[_0xe292('0x3e')][_0xe292('0x7a')]=_0x4524e4[_0xe292('0x40')][_0xe292('0x7a')]=_0x2a74c7[_0xe292('0x5d')][_0xe292('0x71')];_0x4524e4['Imap']['user']=_0x4524e4[_0xe292('0x40')][_0xe292('0x7b')]=_0x2a74c7[_0xe292('0x5d')][_0xe292('0x73')];_0x4524e4['Imap'][_0xe292('0x74')]=_0x4524e4[_0xe292('0x40')]['pass']=_0x2a74c7[_0xe292('0x5d')][_0xe292('0x76')];}return db[_0xe292('0x5b')]['create'](_0x4524e4,{'include':[{'model':db[_0xe292('0x3f')],'as':_0xe292('0x40')},{'model':db[_0xe292('0x3d')],'as':_0xe292('0x3e')}]})['then'](function(_0xd08e01){var _0x117db8=_0x2a74c7['user'][_0xe292('0x7c')]({'plain':!![]});if(!_0x117db8)throw new Error(_0xe292('0x7d'));if(_0x117db8['role']===_0xe292('0x7b')){var _0x49173d=_0xd08e01[_0xe292('0x7c')]({'plain':!![]});return db[_0xe292('0x7e')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x117db8['userProfileId']},'raw':!![]})[_0xe292('0x20')](function(_0x372e56){if(_0x372e56&&_0x372e56[_0xe292('0x7f')]===0x0){return db[_0xe292('0x39')]['create']({'name':_0x49173d[_0xe292('0x3a')],'resourceId':_0x49173d['id'],'type':_0x372e56[_0xe292('0x3a')],'sectionId':_0x372e56['id']},{})[_0xe292('0x20')](function(){return _0xd08e01;});}else{return _0xd08e01;}})[_0xe292('0x2a')](function(_0x4106c7){logger[_0xe292('0x25')](_0xe292('0x80'),_0x4106c7);throw _0x4106c7;});}return _0xd08e01;})[_0xe292('0x20')](respondWithResult(_0x41f611,0xc9))[_0xe292('0x2a')](handleError(_0x41f611,null));};exports[_0xe292('0x81')]=function(_0xe4b682,_0x3aed2c,_0x29ec23){return db[_0xe292('0x5b')]['findOne']({'where':{'id':_0xe4b682[_0xe292('0x5e')]['id']}})[_0xe292('0x20')](handleEntityNotFound(_0x3aed2c,null))[_0xe292('0x20')](function(_0xb017b2){if(_0xb017b2){return _0xb017b2['getImap']();}return null;})[_0xe292('0x20')](respondWithResult(_0x3aed2c,null))['catch'](handleError(_0x3aed2c,null));};exports['addImap']=function(_0x742176,_0x47e417,_0x13ed5c){if(_0x742176['body']['id']){delete _0x742176[_0xe292('0x5d')]['id'];}return db[_0xe292('0x5b')][_0xe292('0x60')]({'where':{'id':_0x742176[_0xe292('0x5e')]['id']}})['then'](handleEntityNotFound(_0x47e417,null))[_0xe292('0x20')](function(_0x52410b){if(_0x52410b){_0x742176['body']['MailAccountId']=_0x52410b['id'];return db[_0xe292('0x3d')]['create'](_0x742176[_0xe292('0x5d')]);}})[_0xe292('0x20')](respondWithResult(_0x47e417,null))[_0xe292('0x2a')](handleError(_0x47e417,null));};exports['removeImap']=function(_0x19247d,_0x1d6980,_0x212602){return db[_0xe292('0x5b')][_0xe292('0x63')]({'where':{'id':_0x19247d[_0xe292('0x5e')]['id']}})[_0xe292('0x20')](handleEntityNotFound(_0x1d6980,null))[_0xe292('0x20')](function(_0x4327dc){if(_0x4327dc){return _0x4327dc[_0xe292('0x82')](null);}return null;})[_0xe292('0x20')](respondWithStatusCode(_0x1d6980,null))[_0xe292('0x2a')](handleError(_0x1d6980,null));};exports[_0xe292('0x83')]=function(_0x297edd,_0x1c5da4,_0x1b2e40){return db[_0xe292('0x5b')][_0xe292('0x63')]({'where':{'id':_0x297edd[_0xe292('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1c5da4,null))['then'](function(_0x2fd369){if(_0x2fd369){return _0x2fd369['getSmtp']();}return null;})[_0xe292('0x20')](respondWithResult(_0x1c5da4,null))[_0xe292('0x2a')](handleError(_0x1c5da4,null));};exports[_0xe292('0x84')]=function(_0x167314,_0x982b0b,_0xee3848){if(_0x167314[_0xe292('0x5d')]['id']){delete _0x167314[_0xe292('0x5d')]['id'];}return db[_0xe292('0x5b')][_0xe292('0x60')]({'where':{'id':_0x167314[_0xe292('0x5e')]['id']}})[_0xe292('0x20')](handleEntityNotFound(_0x982b0b,null))[_0xe292('0x20')](function(_0x6fb3be){if(_0x6fb3be){_0x167314[_0xe292('0x5d')][_0xe292('0x65')]=_0x6fb3be['id'];return db[_0xe292('0x3f')][_0xe292('0x62')](_0x167314[_0xe292('0x5d')]);}})[_0xe292('0x20')](respondWithResult(_0x982b0b,null))['catch'](handleError(_0x982b0b,null));};exports[_0xe292('0x85')]=function(_0x3fbe6a,_0x50fcb3,_0x517508){return db[_0xe292('0x5b')][_0xe292('0x63')]({'where':{'id':_0x3fbe6a[_0xe292('0x5e')]['id']}})[_0xe292('0x20')](handleEntityNotFound(_0x50fcb3,null))['then'](function(_0x422898){if(_0x422898){return _0x422898[_0xe292('0x86')](null);}return null;})[_0xe292('0x20')](respondWithStatusCode(_0x50fcb3,null))['catch'](handleError(_0x50fcb3,null));};exports[_0xe292('0x87')]=function(_0x5c07d0,_0x27e42a,_0x219c22){return db[_0xe292('0x88')][_0xe292('0x60')]({'where':{'id':_0x5c07d0[_0xe292('0x5e')]['id']}})[_0xe292('0x20')](handleEntityNotFound(_0x27e42a,null))['then'](function(_0x326516){if(_0x326516){return _0x326516['addInteraction'](_0x5c07d0[_0xe292('0x5d')][_0xe292('0x68')],_[_0xe292('0x89')](_0x5c07d0[_0xe292('0x5d')],[_0xe292('0x68'),'id'])||{});}})[_0xe292('0x20')](respondWithResult(_0x27e42a,null))[_0xe292('0x2a')](handleError(_0x27e42a,null));};exports['getInteractions']=function(_0x264568,_0x5db861,_0x3ec467){var _0x2956c5={'raw':![],'where':{}};var _0x58e534={};var _0xf4b3e9={'count':0x0,'rows':[]};return db[_0xe292('0x5b')][_0xe292('0x63')]({'where':{'id':_0x264568[_0xe292('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5db861,null))[_0xe292('0x20')](function(_0x4ab1cf){if(_0x4ab1cf){_0x58e534[_0xe292('0x44')]=_[_0xe292('0x45')](db[_0xe292('0x88')][_0xe292('0x43')]);_0x58e534[_0xe292('0x46')]=_[_0xe292('0x45')](_0x264568[_0xe292('0x46')]);_0x58e534['filters']=_['intersection'](_0x58e534[_0xe292('0x44')],_0x58e534['query']);_0x2956c5[_0xe292('0x49')]=_[_0xe292('0x48')](_0x58e534['model'],qs[_0xe292('0x4a')](_0x264568['query']['fields']));_0x2956c5[_0xe292('0x49')]=_0x2956c5[_0xe292('0x49')][_0xe292('0x5c')]?_0x2956c5[_0xe292('0x49')]:_0x58e534[_0xe292('0x44')];if(!_0x264568[_0xe292('0x46')][_0xe292('0x4b')](_0xe292('0x64'))){_0x2956c5[_0xe292('0x31')]=qs[_0xe292('0x31')](_0x264568[_0xe292('0x46')][_0xe292('0x31')]);_0x2956c5[_0xe292('0x30')]=qs['offset'](_0x264568[_0xe292('0x46')][_0xe292('0x30')]);}_0x2956c5['order']=qs[_0xe292('0x4d')](_0x264568[_0xe292('0x46')][_0xe292('0x4d')]);_0x2956c5['where']=qs[_0xe292('0x47')](_[_0xe292('0x4f')](_0x264568[_0xe292('0x46')],_0x58e534[_0xe292('0x47')]));_0x2956c5[_0xe292('0x4e')]['MailAccountId']=_0x4ab1cf['id'];if(_0x264568[_0xe292('0x46')][_0xe292('0x54')]){_0x2956c5['where']=_[_0xe292('0x50')](_0x2956c5[_0xe292('0x4e')],{'$or':_[_0xe292('0x66')](_0x2956c5[_0xe292('0x49')],function(_0x83cf33){var _0x14e381={};_0x14e381[_0x83cf33]={'$like':'%'+_0x264568[_0xe292('0x46')][_0xe292('0x54')]+'%'};return _0x14e381;})});}_0x2956c5=_[_0xe292('0x50')]({},_0x2956c5,_0x264568['options']);return db[_0xe292('0x88')][_0xe292('0x2f')]({'where':_0x2956c5[_0xe292('0x4e')]})[_0xe292('0x20')](function(_0x4804cf){_0xf4b3e9['count']=_0x4804cf;if(_0x264568['query'][_0xe292('0x56')]){_0x2956c5[_0xe292('0x57')]=[{'model':db[_0xe292('0x8a')],'as':_0xe292('0x8b'),'required':![]},{'model':db[_0xe292('0x8c')],'as':'Owner','attributes':['name',_0xe292('0x8d'),_0xe292('0x8e')],'required':![]},{'model':db[_0xe292('0x8f')],'as':_0xe292('0x90'),'attributes':['id',_0xe292('0x3a'),_0xe292('0x91')],'where':_0x264568[_0xe292('0x46')][_0xe292('0x92')]?{'id':_0x264568[_0xe292('0x46')][_0xe292('0x92')]}:undefined,'required':_0x264568[_0xe292('0x46')][_0xe292('0x92')]?!![]:![]}];}return db[_0xe292('0x88')][_0xe292('0x58')](_0x2956c5);})[_0xe292('0x20')](function(_0x53bc7a){_0xf4b3e9[_0xe292('0x59')]=_0x53bc7a;return _0xf4b3e9;});}})[_0xe292('0x20')](respondWithFilteredResult(_0x5db861,_0x2956c5))[_0xe292('0x2a')](handleError(_0x5db861,null));};exports['addApplications']=function(_0x33c162,_0x931f5b,_0x460aaf){return db[_0xe292('0x5b')][_0xe292('0x63')]({'where':{'id':_0x33c162[_0xe292('0x5e')]['id']}})['then'](handleEntityNotFound(_0x931f5b,null))[_0xe292('0x20')](function(_0x21cf01){if(_0x21cf01){return db['sequelize'][_0xe292('0x93')](function(_0x37ec95){return db['MailApplication'][_0xe292('0x37')]({'where':{'MailAccountId':_0x33c162[_0xe292('0x5e')]['id']},'transaction':_0x37ec95})[_0xe292('0x20')](function(_0x155c78){var _0x39f069=_[_0xe292('0x66')](_0x33c162[_0xe292('0x5d')],function(_0x5656ef){_0x5656ef[_0xe292('0x65')]=_0x33c162['params']['id'];return _0x5656ef;});return db[_0xe292('0x94')]['bulkCreate'](_0x39f069,{'transaction':_0x37ec95});});})[_0xe292('0x20')](function(){return db[_0xe292('0x94')][_0xe292('0x95')]({'where':{'MailAccountId':_0x33c162[_0xe292('0x5e')]['id']},'order':'priority'});});}})[_0xe292('0x20')](respondWithResult(_0x931f5b,null))[_0xe292('0x2a')](handleError(_0x931f5b,null));};exports[_0xe292('0x96')]=function(_0x38d7ee,_0x16067a,_0x1be757){var _0x2d5feb={};var _0x503846={};var _0x4c1b2b;var _0x1bb7f9;return db[_0xe292('0x5b')][_0xe292('0x63')]({'where':{'id':_0x38d7ee[_0xe292('0x5e')]['id']}})[_0xe292('0x20')](handleEntityNotFound(_0x16067a,null))[_0xe292('0x20')](function(_0x3b9d17){if(_0x3b9d17){_0x4c1b2b=_0x3b9d17;_0x503846['model']=_[_0xe292('0x45')](db[_0xe292('0x94')][_0xe292('0x43')]);_0x503846[_0xe292('0x46')]=_[_0xe292('0x45')](_0x38d7ee[_0xe292('0x46')]);_0x503846['filters']=_[_0xe292('0x48')](_0x503846[_0xe292('0x44')],_0x503846[_0xe292('0x46')]);_0x2d5feb[_0xe292('0x49')]=_[_0xe292('0x48')](_0x503846[_0xe292('0x44')],qs[_0xe292('0x4a')](_0x38d7ee['query']['fields']));_0x2d5feb[_0xe292('0x49')]=_0x2d5feb[_0xe292('0x49')][_0xe292('0x5c')]?_0x2d5feb[_0xe292('0x49')]:_0x503846['model'];_0x2d5feb[_0xe292('0x4c')]=qs[_0xe292('0x4d')](_0x38d7ee[_0xe292('0x46')][_0xe292('0x4d')]);_0x2d5feb[_0xe292('0x4e')]=qs['filters'](_[_0xe292('0x4f')](_0x38d7ee[_0xe292('0x46')],_0x503846[_0xe292('0x47')]));if(_0x38d7ee[_0xe292('0x46')]['filter']){_0x2d5feb['where']=_['merge'](_0x2d5feb['where'],{'$or':_['map'](_0x2d5feb[_0xe292('0x49')],function(_0x484949){var _0x1231dc={};_0x1231dc[_0x484949]={'$like':'%'+_0x38d7ee[_0xe292('0x46')][_0xe292('0x54')]+'%'};return _0x1231dc;})});}_0x2d5feb=_[_0xe292('0x50')]({},_0x2d5feb,_0x38d7ee['options']);return _0x4c1b2b[_0xe292('0x96')](_0x2d5feb);}})[_0xe292('0x20')](function(_0x232deb){if(_0x232deb){_0x1bb7f9=_0x232deb['length'];if(!_0x38d7ee[_0xe292('0x46')]['hasOwnProperty'](_0xe292('0x64'))){_0x2d5feb[_0xe292('0x31')]=qs[_0xe292('0x31')](_0x38d7ee[_0xe292('0x46')][_0xe292('0x31')]);_0x2d5feb['offset']=qs['offset'](_0x38d7ee['query'][_0xe292('0x30')]);}return _0x4c1b2b['getApplications'](_0x2d5feb);}})['then'](function(_0x32846e){if(_0x32846e){return _0x32846e?{'count':_0x1bb7f9,'rows':_0x32846e}:null;}})[_0xe292('0x20')](respondWithResult(_0x16067a,null))[_0xe292('0x2a')](handleError(_0x16067a,null));};exports[_0xe292('0x97')]=function(_0x183c43,_0x35c42f,_0x25b5a5){var _0x5ca0dd={'raw':!![],'where':{}};var _0x2f8126={};var _0x2fb83f={'count':0x0,'rows':[]};return db[_0xe292('0x5b')][_0xe292('0x63')]({'where':{'id':_0x183c43['params']['id']}})[_0xe292('0x20')](handleEntityNotFound(_0x35c42f,null))[_0xe292('0x20')](function(_0x5d8432){if(_0x5d8432){_0x2f8126[_0xe292('0x44')]=_[_0xe292('0x45')](db[_0xe292('0x98')][_0xe292('0x43')]);_0x2f8126[_0xe292('0x46')]=_['keys'](_0x183c43[_0xe292('0x46')]);_0x2f8126[_0xe292('0x47')]=_['intersection'](_0x2f8126[_0xe292('0x44')],_0x2f8126[_0xe292('0x46')]);_0x5ca0dd[_0xe292('0x49')]=_['intersection'](_0x2f8126[_0xe292('0x44')],qs['fields'](_0x183c43['query'][_0xe292('0x4a')]));_0x5ca0dd[_0xe292('0x49')]=_0x5ca0dd[_0xe292('0x49')]['length']?_0x5ca0dd[_0xe292('0x49')]:_0x2f8126[_0xe292('0x44')];if(!_0x183c43[_0xe292('0x46')][_0xe292('0x4b')](_0xe292('0x64'))){_0x5ca0dd[_0xe292('0x31')]=qs[_0xe292('0x31')](_0x183c43[_0xe292('0x46')][_0xe292('0x31')]);_0x5ca0dd['offset']=qs[_0xe292('0x30')](_0x183c43[_0xe292('0x46')][_0xe292('0x30')]);}_0x5ca0dd[_0xe292('0x4c')]=qs[_0xe292('0x4d')](_0x183c43['query']['sort']);_0x5ca0dd[_0xe292('0x4e')]=qs[_0xe292('0x47')](_['pick'](_0x183c43['query'],_0x2f8126[_0xe292('0x47')]));_0x5ca0dd[_0xe292('0x4e')][_0xe292('0x65')]=_0x5d8432['id'];if(_0x183c43['query'][_0xe292('0x54')]){_0x5ca0dd[_0xe292('0x4e')]=_[_0xe292('0x50')](_0x5ca0dd[_0xe292('0x4e')],{'$or':_['map'](_0x5ca0dd[_0xe292('0x49')],function(_0x1b9963){var _0x3c3810={};_0x3c3810[_0x1b9963]={'$like':'%'+_0x183c43[_0xe292('0x46')][_0xe292('0x54')]+'%'};return _0x3c3810;})});}if(_0x183c43[_0xe292('0x46')]['$gte']){var _0x1eaf7c=_0x183c43[_0xe292('0x46')]['$gte'][_0xe292('0x99')](',');var _0x512231={};_0x512231[_0x1eaf7c[0x0]]={'$gte':moment(_0x1eaf7c[0x1])['format'](_0xe292('0x9a'))};_0x5ca0dd[_0xe292('0x4e')]=_[_0xe292('0x50')](_0x5ca0dd[_0xe292('0x4e')],_0x512231);}_0x5ca0dd=_[_0xe292('0x50')]({},_0x5ca0dd,_0x183c43[_0xe292('0x55')]);return db[_0xe292('0x98')][_0xe292('0x2f')]({'where':_0x5ca0dd[_0xe292('0x4e')]})[_0xe292('0x20')](function(_0x54a2a2){_0x2fb83f[_0xe292('0x2f')]=_0x54a2a2;if(_0x183c43['query'][_0xe292('0x56')]){_0x5ca0dd[_0xe292('0x57')]=[{'all':!![]}];}return db[_0xe292('0x98')][_0xe292('0x58')](_0x5ca0dd);})[_0xe292('0x20')](function(_0x2a44f3){_0x2fb83f[_0xe292('0x59')]=_0x2a44f3;return _0x2fb83f;});}})[_0xe292('0x20')](respondWithFilteredResult(_0x35c42f,_0x5ca0dd))['catch'](handleError(_0x35c42f,null));};exports['send']=function(_0x2f4fd0,_0x11f73c,_0x18d637){var _0x38883d,_0x416014={},_0x1da48f;if(_0x2f4fd0['body']['to']){_0x1da48f=_0x2f4fd0[_0xe292('0x5d')]['to'][_0xe292('0x99')](',')[0x0];}return db[_0xe292('0x5b')][_0xe292('0x60')]({'where':{'id':_0x2f4fd0['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xe292('0x8a')],'as':_0xe292('0x9b'),'where':{'email':_0x1da48f},'limit':0x1,'order':[[_0xe292('0x9c'),_0xe292('0x9d')]]}]},{'model':db['MailServerOut'],'as':_0xe292('0x40'),'raw':!![]}]})[_0xe292('0x20')](handleEntityNotFound(_0x11f73c,null))[_0xe292('0x20')](function(_0xfac9c0){if(_0xfac9c0){_0x38883d=_0xfac9c0;if(_0xfac9c0[_0xe292('0x40')]){if(_['isNil'](_0x2f4fd0[_0xe292('0x5d')][_0xe292('0x9e')])){_0x2f4fd0['body'][_0xe292('0x9e')]=util[_0xe292('0x9f')](_0xe292('0xa0'),_0xfac9c0[_0xe292('0x3a')],_0xfac9c0[_0xe292('0x6d')]||_0xfac9c0[_0xe292('0x40')][_0xe292('0x7b')]);}if(_0x2f4fd0[_0xe292('0x5d')]['attachments']&&_0x2f4fd0['body'][_0xe292('0xa1')]['length']){for(var _0x21bc0f=0x0;_0x21bc0f<_0x2f4fd0[_0xe292('0x5d')]['attachments'][_0xe292('0x5c')];_0x21bc0f+=0x1){_0x2f4fd0[_0xe292('0x5d')]['attachments'][_0x21bc0f]={'filename':_0x2f4fd0[_0xe292('0x5d')]['attachments'][_0x21bc0f]['name'],'path':path[_0xe292('0xa2')](config[_0xe292('0xa3')],_0xe292('0xa4'),_0x2f4fd0['body'][_0xe292('0xa1')][_0x21bc0f][_0xe292('0xa5')])};}}var _0x5a81b3={'tls':{'rejectUnauthorized':![]}};if(_[_0xe292('0x6f')](_0xfac9c0[_0xe292('0x40')][_0xe292('0x7a')])){if(_0xfac9c0[_0xe292('0x40')][_0xe292('0x77')]){_0x5a81b3[_0xe292('0xa6')]={'user':_0xfac9c0[_0xe292('0x40')][_0xe292('0x7b')],'pass':_0xfac9c0[_0xe292('0x40')]['pass']};}_0x5a81b3[_0xe292('0x78')]=_0xfac9c0['Smtp'][_0xe292('0x78')];_0x5a81b3[_0xe292('0x79')]=_0xfac9c0[_0xe292('0x40')][_0xe292('0x79')];_0x5a81b3[_0xe292('0xa7')]=_0xfac9c0[_0xe292('0x40')][_0xe292('0xa7')];}else{_0x5a81b3[_0xe292('0x7a')]=_0xfac9c0[_0xe292('0x40')]['service'];_0x5a81b3['auth']={'user':_0xfac9c0['Smtp'][_0xe292('0x7b')],'pass':_0xfac9c0['Smtp']['pass']};}return respondWithRpcPromise(_0xe292('0xa8'),_0xe292('0xa9'),{'account':_0x5a81b3,'message':_0x2f4fd0[_0xe292('0x5d')]});}else{throw new Error(_0xe292('0xaa'));}}})[_0xe292('0x20')](function(_0x1825ce){if(_0x1825ce){_0x416014=_0x1825ce;if(_0x38883d[_0xe292('0xab')]){if(_0x38883d['List'][_0xe292('0x9b')][_0xe292('0x5c')]){return _0x38883d[_0xe292('0xab')][_0xe292('0x9b')][0x0];}else{return db[_0xe292('0x8a')][_0xe292('0x62')](_[_0xe292('0x18')](_0x2f4fd0['body'],{'firstName':_0x2f4fd0[_0xe292('0x5d')]['to'],'email':_0x2f4fd0[_0xe292('0x5d')]['to'],'phone':_0x2f4fd0['body']['to'],'ListId':_0x38883d[_0xe292('0x6e')]}));}}else{throw new Error(_0xe292('0xaa'));}}})[_0xe292('0x20')](function(_0x8f6dfd){if(_0x8f6dfd){var _0xefe88d={'UserId':_0x2f4fd0['user']['id'],'ContactId':_0x8f6dfd['id'],'MailAccountId':_0x38883d['id'],'inReplyTo':_0x416014['messageId'],'to':_0x2f4fd0['body'][_0xe292('0x9e')],'cc':_0x2f4fd0[_0xe292('0x5d')]['cc'],'subject':_0x2f4fd0[_0xe292('0x5d')][_0xe292('0xac')],'attach':_0x2f4fd0[_0xe292('0x5d')][_0xe292('0xad')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xe292('0x9f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','lastMsgBody':_0x2f4fd0[_0xe292('0x5d')][_0xe292('0x5d')],'Messages':[_[_0xe292('0x50')](_0x2f4fd0['body'],{'messageId':_0x416014[_0xe292('0xae')],'sentAt':moment()[_0xe292('0x9f')](_0xe292('0x9a')),'read':!![],'MailAccountId':_0x38883d['id'],'UserId':_0x2f4fd0[_0xe292('0x7b')]['id'],'ContactId':_0x8f6dfd['id']})]};if(_0x2f4fd0[_0xe292('0x5d')][_0xe292('0xaf')]){_0xefe88d=_['merge'](_0xefe88d,_0x2f4fd0[_0xe292('0x5d')][_0xe292('0xaf')]);}return db[_0xe292('0x88')][_0xe292('0x62')](_0xefe88d,{'include':[{'model':db[_0xe292('0x98')],'as':'Messages'}]});}})[_0xe292('0x20')](respondWithResult(_0x11f73c,null))['catch'](handleError(_0x11f73c,null));};exports[_0xe292('0xb0')]=function(_0x3ee2d1,_0x57ecef,_0x108d97){return db['MailAccount'][_0xe292('0x60')]({'where':{'id':_0x3ee2d1[_0xe292('0x5e')]['id']},'include':[{'model':db[_0xe292('0x3f')],'as':_0xe292('0x40'),'raw':!![]}]})[_0xe292('0x20')](handleEntityNotFound(_0x57ecef,null))[_0xe292('0x20')](function(_0x5bd9f3){if(_0x5bd9f3&&_0x5bd9f3['Smtp']){var _0x59fa61={'id':_0x5bd9f3['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5bd9f3[_0xe292('0x40')][_0xe292('0x7a')]){_0x59fa61[_0xe292('0x7a')]=_0x5bd9f3[_0xe292('0x40')][_0xe292('0x7a')];}else{_0x59fa61[_0xe292('0x78')]=_0x5bd9f3[_0xe292('0x40')][_0xe292('0x78')];_0x59fa61[_0xe292('0x79')]=_0x5bd9f3['Smtp']['port'];_0x59fa61[_0xe292('0xa7')]=_0x5bd9f3[_0xe292('0x40')][_0xe292('0xa7')];}if(_0x5bd9f3[_0xe292('0x40')]['authentication']){_0x59fa61[_0xe292('0xa6')]={'user':_0x5bd9f3[_0xe292('0x40')][_0xe292('0x7b')],'pass':_0x5bd9f3[_0xe292('0x40')][_0xe292('0x75')]};}return respondWithRpcPromise(_0xe292('0xb1'),_0xe292('0xb0'),{'account':_0x59fa61});}})[_0xe292('0x20')](respondWithResult(_0x57ecef,null))[_0xe292('0x2a')](handleError(_0x57ecef,null));};exports['destroy']=function(_0x3b916c,_0x157dde){return db[_0xe292('0x5b')]['find']({'where':{'id':_0x3b916c[_0xe292('0x5e')]['id']}})[_0xe292('0x20')](handleEntityNotFound(_0x157dde,null))['then'](function(_0x5203f7){if(_0x5203f7&&_0x5203f7['service']){throw new db['Sequelize'][(_0xe292('0xb2'))](_0xe292('0xb3'));}return _0x5203f7;})[_0xe292('0x20')](removeEntity(_0x157dde,null))[_0xe292('0x2a')](handleError(_0x157dde,null));};exports[_0xe292('0xb4')]=function(_0x5b51f4,_0x4b5657,_0x13a828){return db[_0xe292('0x5b')]['find']({'where':{'id':_0x5b51f4[_0xe292('0x5e')]['id']}})[_0xe292('0x20')](handleEntityNotFound(_0x4b5657,null))[_0xe292('0x20')](function(_0x44a7e9){if(_0x44a7e9){return _0x44a7e9[_0xe292('0xb4')](_0x5b51f4['body'][_0xe292('0x68')],_[_0xe292('0x89')](_0x5b51f4[_0xe292('0x5d')],['ids','id'])||{})[_0xe292('0xb5')](function(_0x17af2f){for(var _0x217e42=0x0;_0x217e42<_0x5b51f4['body'][_0xe292('0x68')]['length'];_0x217e42+=0x1){socket[_0xe292('0xb6')](_0xe292('0xb7'),{'UserId':_0x5b51f4[_0xe292('0x5d')][_0xe292('0x68')][_0x217e42],'MailAccountId':_0x5b51f4[_0xe292('0x5e')]['id']});}return _0x17af2f;});}})[_0xe292('0x20')](respondWithResult(_0x4b5657,null))[_0xe292('0x2a')](handleError(_0x4b5657,null));};exports[_0xe292('0xb8')]=function(_0x118d8d,_0x295b86,_0x427495){var _0x14804b;return db[_0xe292('0x5b')][_0xe292('0x60')]({'where':{'id':_0x118d8d[_0xe292('0x5e')]['id']}})['then'](handleEntityNotFound(_0x295b86,null))[_0xe292('0x20')](function(_0x4acb94){if(_0x4acb94){return _0x4acb94[_0xe292('0xb8')](_0x118d8d[_0xe292('0x46')][_0xe292('0x68')])[_0xe292('0x20')](function(_0x19ac87){if(_[_0xe292('0xb9')](_0x118d8d[_0xe292('0x46')][_0xe292('0x68')])){for(var _0x3c37e4=0x0;_0x3c37e4<_0x118d8d[_0xe292('0x46')][_0xe292('0x68')][_0xe292('0x5c')];_0x3c37e4+=0x1){socket[_0xe292('0xb6')]('userMailAccount:remove',{'UserId':_0x118d8d['query'][_0xe292('0x68')][_0x3c37e4],'MailAccountId':_0x118d8d[_0xe292('0x5e')]['id']});}}else{socket[_0xe292('0xb6')](_0xe292('0xba'),{'UserId':_0x118d8d[_0xe292('0x46')][_0xe292('0x68')],'MailAccountId':_0x118d8d[_0xe292('0x5e')]['id']});}});}})[_0xe292('0x20')](respondWithStatusCode(_0x295b86,null))[_0xe292('0x2a')](handleError(_0x295b86,null));};exports[_0xe292('0xbb')]=function(_0x5469af,_0x88f485,_0x474918){var _0x2d3e37={};var _0x4fc28b={};var _0x32ef2c;var _0x56fb03;return db[_0xe292('0x5b')][_0xe292('0x63')]({'where':{'id':_0x5469af['params']['id']}})['then'](handleEntityNotFound(_0x88f485,null))['then'](function(_0x5c1b67){if(_0x5c1b67){_0x32ef2c=_0x5c1b67;_0x4fc28b[_0xe292('0x44')]=_[_0xe292('0x45')](db[_0xe292('0x8c')]['rawAttributes']);_0x4fc28b[_0xe292('0x46')]=_['keys'](_0x5469af[_0xe292('0x46')]);_0x4fc28b['filters']=_[_0xe292('0x48')](_0x4fc28b[_0xe292('0x44')],_0x4fc28b[_0xe292('0x46')]);_0x2d3e37['attributes']=_[_0xe292('0x48')](_0x4fc28b[_0xe292('0x44')],qs[_0xe292('0x4a')](_0x5469af[_0xe292('0x46')]['fields']));_0x2d3e37['attributes']=_0x2d3e37['attributes']['length']?_0x2d3e37[_0xe292('0x49')]:_0x4fc28b[_0xe292('0x44')];_0x2d3e37['order']=qs[_0xe292('0x4d')](_0x5469af[_0xe292('0x46')][_0xe292('0x4d')]);_0x2d3e37[_0xe292('0x4e')]=qs[_0xe292('0x47')](_[_0xe292('0x4f')](_0x5469af['query'],_0x4fc28b[_0xe292('0x47')]));if(_0x5469af['query'][_0xe292('0x54')]){_0x2d3e37[_0xe292('0x4e')]=_[_0xe292('0x50')](_0x2d3e37[_0xe292('0x4e')],{'$or':_[_0xe292('0x66')](_0x2d3e37[_0xe292('0x49')],function(_0x21940e){var _0x456634={};_0x456634[_0x21940e]={'$like':'%'+_0x5469af[_0xe292('0x46')][_0xe292('0x54')]+'%'};return _0x456634;})});}_0x2d3e37=_['merge']({},_0x2d3e37,_0x5469af[_0xe292('0x55')]);return _0x32ef2c[_0xe292('0xbb')](_0x2d3e37);}})[_0xe292('0x20')](function(_0x441f45){if(_0x441f45){_0x56fb03=_0x441f45[_0xe292('0x5c')];if(!_0x5469af['query']['hasOwnProperty']('nolimit')){_0x2d3e37['limit']=qs[_0xe292('0x31')](_0x5469af[_0xe292('0x46')][_0xe292('0x31')]);_0x2d3e37[_0xe292('0x30')]=qs[_0xe292('0x30')](_0x5469af[_0xe292('0x46')][_0xe292('0x30')]);}return _0x32ef2c['getAgents'](_0x2d3e37);}})[_0xe292('0x20')](function(_0x267714){if(_0x267714){return _0x267714?{'count':_0x56fb03,'rows':_0x267714}:null;}})[_0xe292('0x20')](respondWithResult(_0x88f485,null))[_0xe292('0x2a')](handleError(_0x88f485,null));}; \ No newline at end of file +var _0x24cd=['Imap','MailServerOut','Smtp','mandatoryDispositionPause','MailAccount','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','map','type','field','options','includeAll','include','findAll','rows','params','Pause','keys','find','body','describe','addDisposition','MailAccountId','getDispositions','Disposition','rawAttributes','nolimit','merge','removeDispositions','ids','create','getAnswers','findOne','CannedAnswer','removeAnswers','key','email','ListId','isNil','active','description','cservice','user','cuser','pass','cpassword','authentication','host','port','service','password','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','MailAccounts','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','User','Owner','internal','Tags','tag','addApplications','sequelize','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','send','CmList','List','DESC','from','%s\x20<%s>','attachments','root','basename','auth','secure','Contacts','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','end','status','count','offset','limit','Content-Range','json','reject','save','update','then','destroy','sendStatus','stack','name','index','MailServerIn'];(function(_0x4acf20,_0x3f4636){var _0x50eabc=function(_0x20c518){while(--_0x20c518){_0x4acf20['push'](_0x4acf20['shift']());}};_0x50eabc(++_0x3f4636);}(_0x24cd,0x83));var _0xd24c=function(_0xecbea9,_0x379d2b){_0xecbea9=_0xecbea9-0x0;var _0x27b31b=_0x24cd[_0xecbea9];return _0x27b31b;};'use strict';var pdf=require(_0xd24c('0x0'));var emlformat=require(_0xd24c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd24c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd24c('0x3'));var moment=require(_0xd24c('0x4'));var BPromise=require(_0xd24c('0x5'));var Mustache=require('mustache');var util=require(_0xd24c('0x6'));var path=require(_0xd24c('0x7'));var sox=require('sox');var csv=require(_0xd24c('0x8'));var ejs=require(_0xd24c('0x9'));var fs=require('fs');var _=require(_0xd24c('0xa'));var squel=require(_0xd24c('0xb'));var crypto=require(_0xd24c('0xc'));var jsforce=require(_0xd24c('0xd'));var deskjs=require(_0xd24c('0xe'));var toCsv=require(_0xd24c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0xd24c('0xf'));var hardwareService=require(_0xd24c('0x10'));var Redis=require(_0xd24c('0x11'));var qs=require(_0xd24c('0x12'));var logger=require(_0xd24c('0x13'))(_0xd24c('0x14'));var utils=require(_0xd24c('0x15'));var config=require(_0xd24c('0x16'));var db=require('../../mysqldb')['db'];config[_0xd24c('0x17')]=_[_0xd24c('0x18')](config['redis'],{'host':_0xd24c('0x19'),'port':0x18eb});var socket=require(_0xd24c('0x1a'))(new Redis(config[_0xd24c('0x17')]));require(_0xd24c('0x1b'))[_0xd24c('0x1c')](socket);var jayson=require(_0xd24c('0x1d'));var client=jayson[_0xd24c('0x1e')][_0xd24c('0x1f')]({'port':0x232b});function respondWithRpcPromise(_0x4b57d8,_0x12814a,_0xe096c,_0x528489){return new BPromise(function(_0x34aa92,_0x3aa193){var _0x1a1111=_0x528489||client;return _0x1a1111[_0xd24c('0x20')](_0x4b57d8,_0xe096c)['then'](function(_0x5e14b8){logger[_0xd24c('0x21')](_0xd24c('0x22'),_0x12814a,_0xd24c('0x23'));logger['debug'](_0xd24c('0x24'),_0x12814a,_0xd24c('0x23'),JSON[_0xd24c('0x25')](_0x5e14b8));if(_0x5e14b8[_0xd24c('0x26')]){if(_0x5e14b8['error'][_0xd24c('0x27')]===0x1f4){logger['error'](_0xd24c('0x22'),_0x12814a,_0x5e14b8[_0xd24c('0x26')][_0xd24c('0x28')]);return _0x3aa193(_0x5e14b8[_0xd24c('0x26')][_0xd24c('0x28')]);}logger[_0xd24c('0x26')](_0xd24c('0x22'),_0x12814a,_0x5e14b8[_0xd24c('0x26')][_0xd24c('0x28')]);return _0x34aa92(_0x5e14b8[_0xd24c('0x26')]['message']);}else{logger[_0xd24c('0x21')](_0xd24c('0x22'),_0x12814a,_0xd24c('0x23'));_0x34aa92(_0x5e14b8['result'][_0xd24c('0x28')]);}})[_0xd24c('0x29')](function(_0x317eb0){logger['error'](_0xd24c('0x22'),_0x12814a,_0x317eb0);_0x3aa193(_0x317eb0);});});}function respondWithStatusCode(_0x391cd5,_0x848e0e){_0x848e0e=_0x848e0e||0xcc;return function(_0x40cdf7){if(_0x40cdf7){return _0x391cd5['sendStatus'](_0x848e0e);}return _0x391cd5['status'](_0x848e0e)[_0xd24c('0x2a')]();};}function respondWithResult(_0x4d56f4,_0x13a9a7){_0x13a9a7=_0x13a9a7||0xc8;return function(_0xaf8b16){if(_0xaf8b16){return _0x4d56f4[_0xd24c('0x2b')](_0x13a9a7)['json'](_0xaf8b16);}};}function respondWithFilteredResult(_0x4cb1b3,_0x26fd85){return function(_0x14d44a){if(_0x14d44a){var _0x1a18b7=_0x14d44a[_0xd24c('0x2c')],_0x160f03=_0x26fd85[_0xd24c('0x2d')],_0x111e13=_0x26fd85[_0xd24c('0x2d')]+_0x26fd85[_0xd24c('0x2e')],_0x2ecbaa;if(_0x111e13>=_0x1a18b7){_0x111e13=_0x1a18b7;_0x2ecbaa=0xc8;}else{_0x2ecbaa=0xce;}_0x4cb1b3[_0xd24c('0x2b')](_0x2ecbaa);return _0x4cb1b3['set'](_0xd24c('0x2f'),_0x160f03+'-'+_0x111e13+'/'+_0x1a18b7)[_0xd24c('0x30')](_0x14d44a);}return null;};}function patchUpdates(_0x445bc6){return function(_0x1dc70b){try{jsonpatch['apply'](_0x1dc70b,_0x445bc6,!![]);}catch(_0x5e3391){return BPromise[_0xd24c('0x31')](_0x5e3391);}return _0x1dc70b[_0xd24c('0x32')]();};}function saveUpdates(_0x34a64c,_0x13bfec){return function(_0x4ec0f5){if(_0x4ec0f5){return _0x4ec0f5[_0xd24c('0x33')](_0x34a64c)[_0xd24c('0x34')](function(_0xc63708){return _0xc63708;});}return null;};}function removeEntity(_0x27599a,_0x393574){return function(_0x307adb){if(_0x307adb){return _0x307adb[_0xd24c('0x35')]()[_0xd24c('0x34')](function(){var _0x13a33e=_0x307adb['get']({'plain':!![]});var _0x4be898='MailAccounts';return db['UserProfileResource'][_0xd24c('0x35')]({'where':{'type':_0x4be898,'resourceId':_0x13a33e['id']}})[_0xd24c('0x34')](function(){return _0x307adb;});})[_0xd24c('0x34')](function(){_0x27599a[_0xd24c('0x2b')](0xcc)[_0xd24c('0x2a')]();});}};}function handleEntityNotFound(_0x133b62,_0x4526e3){return function(_0x483e3f){if(!_0x483e3f){_0x133b62[_0xd24c('0x36')](0x194);}return _0x483e3f;};}function handleError(_0x2a9028,_0x2250e1){_0x2250e1=_0x2250e1||0x1f4;return function(_0x241102){logger[_0xd24c('0x26')](_0x241102[_0xd24c('0x37')]);if(_0x241102['name']){delete _0x241102[_0xd24c('0x38')];}_0x2a9028[_0xd24c('0x2b')](_0x2250e1)['send'](_0x241102);};}exports[_0xd24c('0x39')]=function(_0x3c7c7f,_0x4bf183){var _0x1e5718={'include':[{'model':db[_0xd24c('0x3a')],'as':_0xd24c('0x3b')},{'model':db[_0xd24c('0x3c')],'as':_0xd24c('0x3d')},{'model':db['Pause'],'as':_0xd24c('0x3e')}]},_0xa6831b={},_0x52d4a5={'count':0x0,'rows':[]};var _0x5c2a39=db[_0xd24c('0x3f')]['rawAttributes'];_0xa6831b['model']=_['keys'](_0x5c2a39);_0xa6831b[_0xd24c('0x40')]=_['keys'](_0x3c7c7f['query']);_0xa6831b[_0xd24c('0x41')]=_[_0xd24c('0x42')](_0xa6831b[_0xd24c('0x43')],_0xa6831b[_0xd24c('0x40')]);_0x1e5718['attributes']=_[_0xd24c('0x42')](_0xa6831b['model'],qs[_0xd24c('0x44')](_0x3c7c7f[_0xd24c('0x40')][_0xd24c('0x44')]));_0x1e5718[_0xd24c('0x45')]=_0x1e5718[_0xd24c('0x45')][_0xd24c('0x46')]?_0x1e5718[_0xd24c('0x45')]:_0xa6831b[_0xd24c('0x43')];if(!_0x3c7c7f[_0xd24c('0x40')][_0xd24c('0x47')]('nolimit')){_0x1e5718[_0xd24c('0x2e')]=qs[_0xd24c('0x2e')](_0x3c7c7f['query'][_0xd24c('0x2e')]);_0x1e5718[_0xd24c('0x2d')]=qs['offset'](_0x3c7c7f[_0xd24c('0x40')]['offset']);}_0x1e5718[_0xd24c('0x48')]=qs[_0xd24c('0x49')](_0x3c7c7f[_0xd24c('0x40')][_0xd24c('0x49')]);_0x1e5718[_0xd24c('0x4a')]=qs['filters'](_[_0xd24c('0x4b')](_0x3c7c7f['query'],_0xa6831b[_0xd24c('0x41')]));if(_0x3c7c7f['query'][_0xd24c('0x4c')]){_0x1e5718[_0xd24c('0x4a')]=_['merge'](_0x1e5718[_0xd24c('0x4a')],{'$or':_[_0xd24c('0x4d')](_0x5c2a39,function(_0x4f0fac){if(_0x4f0fac[_0xd24c('0x4e')]['key']!=='VIRTUAL'){var _0x5dd31a={};_0x5dd31a[_0x4f0fac[_0xd24c('0x4f')]]={'$like':'%'+_0x3c7c7f[_0xd24c('0x40')]['filter']+'%'};return _0x5dd31a;}})});}_0x1e5718=_['merge']({},_0x1e5718,_0x3c7c7f[_0xd24c('0x50')]);var _0x304c9b={'where':_0x1e5718[_0xd24c('0x4a')]};return db[_0xd24c('0x3f')]['count'](_0x304c9b)[_0xd24c('0x34')](function(_0x186348){_0x52d4a5['count']=_0x186348;if(_0x3c7c7f[_0xd24c('0x40')][_0xd24c('0x51')]){_0x1e5718[_0xd24c('0x52')]=[{'all':!![]}];}return db['MailAccount'][_0xd24c('0x53')](_0x1e5718);})['then'](function(_0x26c1d0){_0x52d4a5[_0xd24c('0x54')]=_0x26c1d0;return _0x52d4a5;})[_0xd24c('0x34')](respondWithFilteredResult(_0x4bf183,_0x1e5718))[_0xd24c('0x29')](handleError(_0x4bf183,null));};exports['show']=function(_0x14684c,_0x153dc4){var _0x2e2e0f={'raw':![],'where':{'id':_0x14684c[_0xd24c('0x55')]['id']},'include':[{'model':db[_0xd24c('0x3a')],'as':_0xd24c('0x3b')},{'model':db[_0xd24c('0x3c')],'as':_0xd24c('0x3d')},{'model':db[_0xd24c('0x56')],'as':_0xd24c('0x3e')}]},_0x1a4549={};_0x1a4549['model']=_[_0xd24c('0x57')](db[_0xd24c('0x3f')]['rawAttributes']);_0x1a4549['query']=_['keys'](_0x14684c[_0xd24c('0x40')]);_0x1a4549[_0xd24c('0x41')]=_[_0xd24c('0x42')](_0x1a4549[_0xd24c('0x43')],_0x1a4549[_0xd24c('0x40')]);_0x2e2e0f[_0xd24c('0x45')]=_[_0xd24c('0x42')](_0x1a4549[_0xd24c('0x43')],qs[_0xd24c('0x44')](_0x14684c[_0xd24c('0x40')][_0xd24c('0x44')]));_0x2e2e0f['attributes']=_0x2e2e0f[_0xd24c('0x45')][_0xd24c('0x46')]?_0x2e2e0f['attributes']:_0x1a4549[_0xd24c('0x43')];if(_0x14684c[_0xd24c('0x40')][_0xd24c('0x51')]){_0x2e2e0f['include']=[{'all':!![]}];}_0x2e2e0f=_['merge']({},_0x2e2e0f,_0x14684c[_0xd24c('0x50')]);return db[_0xd24c('0x3f')][_0xd24c('0x58')](_0x2e2e0f)[_0xd24c('0x34')](handleEntityNotFound(_0x153dc4,null))[_0xd24c('0x34')](respondWithResult(_0x153dc4,null))[_0xd24c('0x29')](handleError(_0x153dc4,null));};exports[_0xd24c('0x33')]=function(_0x1c0acd,_0x5ba7ab){if(_0x1c0acd[_0xd24c('0x59')]['id']){delete _0x1c0acd['body']['id'];}return db['MailAccount'][_0xd24c('0x58')]({'where':{'id':_0x1c0acd['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0xd24c('0x3b')},{'model':db[_0xd24c('0x3c')],'as':_0xd24c('0x3d')},{'model':db[_0xd24c('0x56')],'as':'mandatoryDispositionPause'}]})[_0xd24c('0x34')](handleEntityNotFound(_0x5ba7ab,null))[_0xd24c('0x34')](saveUpdates(_0x1c0acd[_0xd24c('0x59')],null))[_0xd24c('0x34')](function(_0xb75816){if(_0xb75816&&_0x1c0acd[_0xd24c('0x59')][_0xd24c('0x3b')]){return db['MailServerIn']['update'](_0x1c0acd['body'][_0xd24c('0x3b')],{'where':{'MailAccountId':_0xb75816['id']}})[_0xd24c('0x34')](function(){return _0xb75816;});}return _0xb75816;})[_0xd24c('0x34')](function(_0x186042){if(_0x186042&&_0x1c0acd[_0xd24c('0x59')][_0xd24c('0x3d')]){return db['MailServerOut'][_0xd24c('0x33')](_0x1c0acd[_0xd24c('0x59')]['Smtp'],{'where':{'MailAccountId':_0x186042['id']}})[_0xd24c('0x34')](function(){return _0x186042;});}return _0x186042;})[_0xd24c('0x34')](respondWithResult(_0x5ba7ab,null))[_0xd24c('0x29')](handleError(_0x5ba7ab,null));};exports[_0xd24c('0x5a')]=function(_0x1e3f3a,_0x50ef46){return db['MailAccount'][_0xd24c('0x5a')]()[_0xd24c('0x34')](respondWithResult(_0x50ef46,null))['catch'](handleError(_0x50ef46,null));};exports[_0xd24c('0x5b')]=function(_0x2521fe,_0x5de4f8,_0x1fb7e3){if(_0x2521fe[_0xd24c('0x59')]['id']){delete _0x2521fe[_0xd24c('0x59')]['id'];}return db[_0xd24c('0x3f')][_0xd24c('0x58')]({'where':{'id':_0x2521fe[_0xd24c('0x55')]['id']}})[_0xd24c('0x34')](handleEntityNotFound(_0x5de4f8,null))['then'](function(_0x522587){if(_0x522587){_0x2521fe['body'][_0xd24c('0x5c')]=_0x522587['id'];return db['Disposition']['create'](_0x2521fe['body']);}})[_0xd24c('0x34')](respondWithResult(_0x5de4f8,null))[_0xd24c('0x29')](handleError(_0x5de4f8,null));};exports[_0xd24c('0x5d')]=function(_0x52d9f1,_0x312c4c,_0xef4950){var _0x424680={'raw':![],'where':{}};var _0x2daf65={};var _0x21c0bf={'count':0x0,'rows':[]};return db[_0xd24c('0x3f')]['findOne']({'where':{'id':_0x52d9f1[_0xd24c('0x55')]['id']}})[_0xd24c('0x34')](handleEntityNotFound(_0x312c4c,null))['then'](function(_0x24ede8){if(_0x24ede8){_0x2daf65[_0xd24c('0x43')]=_[_0xd24c('0x57')](db[_0xd24c('0x5e')][_0xd24c('0x5f')]);_0x2daf65[_0xd24c('0x40')]=_[_0xd24c('0x57')](_0x52d9f1[_0xd24c('0x40')]);_0x2daf65[_0xd24c('0x41')]=_[_0xd24c('0x42')](_0x2daf65['model'],_0x2daf65[_0xd24c('0x40')]);_0x424680[_0xd24c('0x45')]=_['intersection'](_0x2daf65['model'],qs[_0xd24c('0x44')](_0x52d9f1['query'][_0xd24c('0x44')]));_0x424680[_0xd24c('0x45')]=_0x424680[_0xd24c('0x45')][_0xd24c('0x46')]?_0x424680[_0xd24c('0x45')]:_0x2daf65[_0xd24c('0x43')];if(!_0x52d9f1[_0xd24c('0x40')][_0xd24c('0x47')](_0xd24c('0x60'))){_0x424680[_0xd24c('0x2e')]=qs['limit'](_0x52d9f1[_0xd24c('0x40')]['limit']);_0x424680[_0xd24c('0x2d')]=qs[_0xd24c('0x2d')](_0x52d9f1[_0xd24c('0x40')][_0xd24c('0x2d')]);}_0x424680[_0xd24c('0x48')]=qs[_0xd24c('0x49')](_0x52d9f1[_0xd24c('0x40')]['sort']);_0x424680[_0xd24c('0x4a')]=qs[_0xd24c('0x41')](_[_0xd24c('0x4b')](_0x52d9f1[_0xd24c('0x40')],_0x2daf65[_0xd24c('0x41')]));_0x424680[_0xd24c('0x4a')][_0xd24c('0x5c')]=_0x24ede8['id'];if(_0x52d9f1[_0xd24c('0x40')][_0xd24c('0x4c')]){_0x424680['where']=_[_0xd24c('0x61')](_0x424680['where'],{'$or':_[_0xd24c('0x4d')](_0x424680[_0xd24c('0x45')],function(_0x287aea){var _0x375efc={};_0x375efc[_0x287aea]={'$like':'%'+_0x52d9f1[_0xd24c('0x40')][_0xd24c('0x4c')]+'%'};return _0x375efc;})});}_0x424680=_[_0xd24c('0x61')]({},_0x424680,_0x52d9f1['options']);return db[_0xd24c('0x5e')][_0xd24c('0x2c')]({'where':_0x424680[_0xd24c('0x4a')]})['then'](function(_0x6fa82a){_0x21c0bf[_0xd24c('0x2c')]=_0x6fa82a;if(_0x52d9f1[_0xd24c('0x40')][_0xd24c('0x51')]){_0x424680[_0xd24c('0x52')]=[{'all':!![]}];}return db[_0xd24c('0x5e')][_0xd24c('0x53')](_0x424680);})[_0xd24c('0x34')](function(_0xf6a7e4){_0x21c0bf[_0xd24c('0x54')]=_0xf6a7e4;return _0x21c0bf;});}})[_0xd24c('0x34')](respondWithFilteredResult(_0x312c4c,_0x424680))[_0xd24c('0x29')](handleError(_0x312c4c,null));};exports[_0xd24c('0x62')]=function(_0x3edfcd,_0x145112,_0x3aa52e){var _0x40adc5;return db[_0xd24c('0x3f')]['find']({'where':{'id':_0x3edfcd['params']['id']}})[_0xd24c('0x34')](handleEntityNotFound(_0x145112,null))[_0xd24c('0x34')](function(_0x4733ab){if(_0x4733ab){return _0x4733ab[_0xd24c('0x62')](_0x3edfcd[_0xd24c('0x40')][_0xd24c('0x63')]);}})[_0xd24c('0x34')](respondWithStatusCode(_0x145112,null))[_0xd24c('0x29')](handleError(_0x145112,null));};exports['addAnswer']=function(_0x32088b,_0x5bc8e9,_0x5507bf){if(_0x32088b['body']['id']){delete _0x32088b[_0xd24c('0x59')]['id'];}return db[_0xd24c('0x3f')]['find']({'where':{'id':_0x32088b['params']['id']}})[_0xd24c('0x34')](handleEntityNotFound(_0x5bc8e9,null))[_0xd24c('0x34')](function(_0x189bda){if(_0x189bda){_0x32088b[_0xd24c('0x59')]['MailAccountId']=_0x189bda['id'];return db['CannedAnswer'][_0xd24c('0x64')](_0x32088b['body']);}})[_0xd24c('0x34')](respondWithResult(_0x5bc8e9,null))[_0xd24c('0x29')](handleError(_0x5bc8e9,null));};exports[_0xd24c('0x65')]=function(_0x4474a7,_0x42dab4,_0x44a686){var _0xdee697={'raw':![],'where':{}};var _0x56d0a6={};var _0x5b7b2a={'count':0x0,'rows':[]};return db['MailAccount'][_0xd24c('0x66')]({'where':{'id':_0x4474a7[_0xd24c('0x55')]['id']}})[_0xd24c('0x34')](handleEntityNotFound(_0x42dab4,null))[_0xd24c('0x34')](function(_0x320a2b){if(_0x320a2b){_0x56d0a6[_0xd24c('0x43')]=_['keys'](db[_0xd24c('0x67')][_0xd24c('0x5f')]);_0x56d0a6[_0xd24c('0x40')]=_[_0xd24c('0x57')](_0x4474a7[_0xd24c('0x40')]);_0x56d0a6[_0xd24c('0x41')]=_[_0xd24c('0x42')](_0x56d0a6[_0xd24c('0x43')],_0x56d0a6[_0xd24c('0x40')]);_0xdee697[_0xd24c('0x45')]=_['intersection'](_0x56d0a6[_0xd24c('0x43')],qs['fields'](_0x4474a7[_0xd24c('0x40')][_0xd24c('0x44')]));_0xdee697[_0xd24c('0x45')]=_0xdee697[_0xd24c('0x45')]['length']?_0xdee697[_0xd24c('0x45')]:_0x56d0a6['model'];if(!_0x4474a7[_0xd24c('0x40')][_0xd24c('0x47')](_0xd24c('0x60'))){_0xdee697[_0xd24c('0x2e')]=qs[_0xd24c('0x2e')](_0x4474a7[_0xd24c('0x40')][_0xd24c('0x2e')]);_0xdee697['offset']=qs[_0xd24c('0x2d')](_0x4474a7[_0xd24c('0x40')][_0xd24c('0x2d')]);}_0xdee697[_0xd24c('0x48')]=qs[_0xd24c('0x49')](_0x4474a7[_0xd24c('0x40')]['sort']);_0xdee697[_0xd24c('0x4a')]=qs['filters'](_['pick'](_0x4474a7['query'],_0x56d0a6['filters']));_0xdee697[_0xd24c('0x4a')][_0xd24c('0x5c')]=_0x320a2b['id'];if(_0x4474a7[_0xd24c('0x40')][_0xd24c('0x4c')]){_0xdee697[_0xd24c('0x4a')]=_[_0xd24c('0x61')](_0xdee697[_0xd24c('0x4a')],{'$or':_[_0xd24c('0x4d')](_0xdee697[_0xd24c('0x45')],function(_0x21e870){var _0x2a2cac={};_0x2a2cac[_0x21e870]={'$like':'%'+_0x4474a7['query'][_0xd24c('0x4c')]+'%'};return _0x2a2cac;})});}_0xdee697=_[_0xd24c('0x61')]({},_0xdee697,_0x4474a7[_0xd24c('0x50')]);return db[_0xd24c('0x67')][_0xd24c('0x2c')]({'where':_0xdee697[_0xd24c('0x4a')]})[_0xd24c('0x34')](function(_0x39df74){_0x5b7b2a[_0xd24c('0x2c')]=_0x39df74;if(_0x4474a7['query'][_0xd24c('0x51')]){_0xdee697[_0xd24c('0x52')]=[{'all':!![]}];}return db[_0xd24c('0x67')][_0xd24c('0x53')](_0xdee697);})[_0xd24c('0x34')](function(_0x3384bb){_0x5b7b2a[_0xd24c('0x54')]=_0x3384bb;return _0x5b7b2a;});}})['then'](respondWithFilteredResult(_0x42dab4,_0xdee697))[_0xd24c('0x29')](handleError(_0x42dab4,null));};exports[_0xd24c('0x68')]=function(_0x573f68,_0x440511,_0x4b0e05){var _0x238960;return db[_0xd24c('0x3f')][_0xd24c('0x58')]({'where':{'id':_0x573f68['params']['id']}})['then'](handleEntityNotFound(_0x440511,null))['then'](function(_0x25728c){if(_0x25728c){return _0x25728c['removeAnswers'](_0x573f68[_0xd24c('0x40')][_0xd24c('0x63')]);}})['then'](respondWithStatusCode(_0x440511,null))[_0xd24c('0x29')](handleError(_0x440511,null));};exports[_0xd24c('0x64')]=function(_0x11301e,_0x250f05){var _0x383613={'name':_0x11301e[_0xd24c('0x59')][_0xd24c('0x38')],'key':_0x11301e[_0xd24c('0x59')][_0xd24c('0x69')],'email':_0x11301e[_0xd24c('0x59')][_0xd24c('0x6a')],'ListId':_0x11301e[_0xd24c('0x59')][_0xd24c('0x6b')],'active':!_[_0xd24c('0x6c')](_0x11301e[_0xd24c('0x59')][_0xd24c('0x6d')])?_0x11301e['body']['active']:!![],'description':_0x11301e[_0xd24c('0x59')][_0xd24c('0x6e')]||null,'Imap':{},'Smtp':{}};if(_[_0xd24c('0x6c')](_0x11301e[_0xd24c('0x59')][_0xd24c('0x6f')])){if(_0x11301e['body']['cauthentication']){_0x383613[_0xd24c('0x3b')][_0xd24c('0x70')]=_0x383613[_0xd24c('0x3d')][_0xd24c('0x70')]=_0x11301e[_0xd24c('0x59')][_0xd24c('0x71')];_0x383613['Imap']['password']=_0x383613['Smtp'][_0xd24c('0x72')]=_0x11301e[_0xd24c('0x59')][_0xd24c('0x73')];}else{_0x383613[_0xd24c('0x3b')][_0xd24c('0x74')]=_0x383613['Smtp'][_0xd24c('0x74')]=![];}_0x383613[_0xd24c('0x3b')]['host']=_0x11301e[_0xd24c('0x59')]['Imap'][_0xd24c('0x75')];_0x383613[_0xd24c('0x3b')][_0xd24c('0x76')]=_0x11301e[_0xd24c('0x59')][_0xd24c('0x3b')][_0xd24c('0x76')];_0x383613[_0xd24c('0x3d')][_0xd24c('0x75')]=_0x11301e[_0xd24c('0x59')][_0xd24c('0x3d')]['host'];_0x383613['Smtp'][_0xd24c('0x76')]=_0x11301e['body']['Smtp']['port'];}else{_0x383613[_0xd24c('0x3b')][_0xd24c('0x77')]=_0x383613[_0xd24c('0x3d')][_0xd24c('0x77')]=_0x11301e[_0xd24c('0x59')][_0xd24c('0x6f')];_0x383613[_0xd24c('0x3b')][_0xd24c('0x70')]=_0x383613[_0xd24c('0x3d')][_0xd24c('0x70')]=_0x11301e[_0xd24c('0x59')][_0xd24c('0x71')];_0x383613[_0xd24c('0x3b')][_0xd24c('0x78')]=_0x383613[_0xd24c('0x3d')]['pass']=_0x11301e[_0xd24c('0x59')][_0xd24c('0x73')];}return db['MailAccount'][_0xd24c('0x64')](_0x383613,{'include':[{'model':db['MailServerOut'],'as':_0xd24c('0x3d')},{'model':db[_0xd24c('0x3a')],'as':'Imap'}]})[_0xd24c('0x34')](function(_0x31fdc5){var _0x563dac=_0x11301e[_0xd24c('0x70')]['get']({'plain':!![]});if(!_0x563dac)throw new Error(_0xd24c('0x79'));if(_0x563dac[_0xd24c('0x7a')]===_0xd24c('0x70')){var _0xd2f03e=_0x31fdc5[_0xd24c('0x7b')]({'plain':!![]});return db[_0xd24c('0x7c')][_0xd24c('0x58')]({'where':{'name':_0xd24c('0x7d'),'userProfileId':_0x563dac['userProfileId']},'raw':!![]})[_0xd24c('0x34')](function(_0x3c65b4){if(_0x3c65b4&&_0x3c65b4[_0xd24c('0x7e')]===0x0){return db[_0xd24c('0x7f')][_0xd24c('0x64')]({'name':_0xd2f03e[_0xd24c('0x38')],'resourceId':_0xd2f03e['id'],'type':_0x3c65b4['name'],'sectionId':_0x3c65b4['id']},{})[_0xd24c('0x34')](function(){return _0x31fdc5;});}else{return _0x31fdc5;}})[_0xd24c('0x29')](function(_0x5066aa){logger[_0xd24c('0x26')](_0xd24c('0x80'),_0x5066aa);throw _0x5066aa;});}return _0x31fdc5;})[_0xd24c('0x34')](respondWithResult(_0x250f05,0xc9))[_0xd24c('0x29')](handleError(_0x250f05,null));};exports[_0xd24c('0x81')]=function(_0x44a90b,_0x13ba6c,_0xd16507){return db[_0xd24c('0x3f')][_0xd24c('0x66')]({'where':{'id':_0x44a90b[_0xd24c('0x55')]['id']}})[_0xd24c('0x34')](handleEntityNotFound(_0x13ba6c,null))['then'](function(_0x2bb021){if(_0x2bb021){return _0x2bb021[_0xd24c('0x81')]();}return null;})[_0xd24c('0x34')](respondWithResult(_0x13ba6c,null))[_0xd24c('0x29')](handleError(_0x13ba6c,null));};exports[_0xd24c('0x82')]=function(_0x2c52e8,_0x2747c5,_0x2131a4){if(_0x2c52e8[_0xd24c('0x59')]['id']){delete _0x2c52e8[_0xd24c('0x59')]['id'];}return db[_0xd24c('0x3f')][_0xd24c('0x58')]({'where':{'id':_0x2c52e8[_0xd24c('0x55')]['id']}})['then'](handleEntityNotFound(_0x2747c5,null))[_0xd24c('0x34')](function(_0x246029){if(_0x246029){_0x2c52e8[_0xd24c('0x59')]['MailAccountId']=_0x246029['id'];return db[_0xd24c('0x3a')][_0xd24c('0x64')](_0x2c52e8[_0xd24c('0x59')]);}})[_0xd24c('0x34')](respondWithResult(_0x2747c5,null))[_0xd24c('0x29')](handleError(_0x2747c5,null));};exports[_0xd24c('0x83')]=function(_0x30dc56,_0x830e8c,_0x3ba86e){return db[_0xd24c('0x3f')][_0xd24c('0x66')]({'where':{'id':_0x30dc56[_0xd24c('0x55')]['id']}})[_0xd24c('0x34')](handleEntityNotFound(_0x830e8c,null))[_0xd24c('0x34')](function(_0x19a4b1){if(_0x19a4b1){return _0x19a4b1[_0xd24c('0x84')](null);}return null;})[_0xd24c('0x34')](respondWithStatusCode(_0x830e8c,null))[_0xd24c('0x29')](handleError(_0x830e8c,null));};exports[_0xd24c('0x85')]=function(_0x3534e9,_0x40841d,_0x41766a){return db[_0xd24c('0x3f')][_0xd24c('0x66')]({'where':{'id':_0x3534e9[_0xd24c('0x55')]['id']}})['then'](handleEntityNotFound(_0x40841d,null))['then'](function(_0x4a291a){if(_0x4a291a){return _0x4a291a[_0xd24c('0x85')]();}return null;})[_0xd24c('0x34')](respondWithResult(_0x40841d,null))[_0xd24c('0x29')](handleError(_0x40841d,null));};exports[_0xd24c('0x86')]=function(_0x2c973a,_0x37ddb2,_0x596a05){if(_0x2c973a[_0xd24c('0x59')]['id']){delete _0x2c973a[_0xd24c('0x59')]['id'];}return db[_0xd24c('0x3f')]['find']({'where':{'id':_0x2c973a[_0xd24c('0x55')]['id']}})[_0xd24c('0x34')](handleEntityNotFound(_0x37ddb2,null))[_0xd24c('0x34')](function(_0x544c77){if(_0x544c77){_0x2c973a[_0xd24c('0x59')][_0xd24c('0x5c')]=_0x544c77['id'];return db[_0xd24c('0x3c')]['create'](_0x2c973a['body']);}})[_0xd24c('0x34')](respondWithResult(_0x37ddb2,null))[_0xd24c('0x29')](handleError(_0x37ddb2,null));};exports[_0xd24c('0x87')]=function(_0x1c8438,_0x320c71,_0x32f53c){return db[_0xd24c('0x3f')][_0xd24c('0x66')]({'where':{'id':_0x1c8438[_0xd24c('0x55')]['id']}})[_0xd24c('0x34')](handleEntityNotFound(_0x320c71,null))[_0xd24c('0x34')](function(_0x39741d){if(_0x39741d){return _0x39741d[_0xd24c('0x88')](null);}return null;})[_0xd24c('0x34')](respondWithStatusCode(_0x320c71,null))[_0xd24c('0x29')](handleError(_0x320c71,null));};exports[_0xd24c('0x89')]=function(_0x5afb87,_0x4d1a15,_0x3d76a7){return db['MailInteraction'][_0xd24c('0x58')]({'where':{'id':_0x5afb87[_0xd24c('0x55')]['id']}})[_0xd24c('0x34')](handleEntityNotFound(_0x4d1a15,null))['then'](function(_0x58e1a6){if(_0x58e1a6){return _0x58e1a6[_0xd24c('0x89')](_0x5afb87['body']['ids'],_[_0xd24c('0x8a')](_0x5afb87['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x4d1a15,null))[_0xd24c('0x29')](handleError(_0x4d1a15,null));};exports[_0xd24c('0x8b')]=function(_0x12655a,_0x3c6947,_0x220a57){var _0x113068={'raw':![],'where':{}};var _0x428f49={};var _0x3ab821={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x12655a[_0xd24c('0x55')]['id']}})['then'](handleEntityNotFound(_0x3c6947,null))[_0xd24c('0x34')](function(_0x1c0a32){if(_0x1c0a32){_0x428f49[_0xd24c('0x43')]=_['keys'](db[_0xd24c('0x8c')][_0xd24c('0x5f')]);_0x428f49[_0xd24c('0x40')]=_[_0xd24c('0x57')](_0x12655a[_0xd24c('0x40')]);_0x428f49['filters']=_[_0xd24c('0x42')](_0x428f49[_0xd24c('0x43')],_0x428f49[_0xd24c('0x40')]);_0x113068[_0xd24c('0x45')]=_['intersection'](_0x428f49[_0xd24c('0x43')],qs[_0xd24c('0x44')](_0x12655a['query'][_0xd24c('0x44')]));_0x113068[_0xd24c('0x45')]=_0x113068['attributes'][_0xd24c('0x46')]?_0x113068['attributes']:_0x428f49[_0xd24c('0x43')];if(!_0x12655a['query'][_0xd24c('0x47')](_0xd24c('0x60'))){_0x113068[_0xd24c('0x2e')]=qs[_0xd24c('0x2e')](_0x12655a['query'][_0xd24c('0x2e')]);_0x113068[_0xd24c('0x2d')]=qs[_0xd24c('0x2d')](_0x12655a[_0xd24c('0x40')][_0xd24c('0x2d')]);}_0x113068[_0xd24c('0x48')]=qs[_0xd24c('0x49')](_0x12655a[_0xd24c('0x40')][_0xd24c('0x49')]);_0x113068[_0xd24c('0x4a')]=qs[_0xd24c('0x41')](_[_0xd24c('0x4b')](_0x12655a[_0xd24c('0x40')],_0x428f49[_0xd24c('0x41')]));_0x113068[_0xd24c('0x4a')][_0xd24c('0x5c')]=_0x1c0a32['id'];if(_0x12655a[_0xd24c('0x40')][_0xd24c('0x4c')]){_0x113068[_0xd24c('0x4a')]=_[_0xd24c('0x61')](_0x113068['where'],{'$or':_[_0xd24c('0x4d')](_0x113068[_0xd24c('0x45')],function(_0x3cdf30){var _0x4d8223={};_0x4d8223[_0x3cdf30]={'$like':'%'+_0x12655a[_0xd24c('0x40')][_0xd24c('0x4c')]+'%'};return _0x4d8223;})});}_0x113068=_['merge']({},_0x113068,_0x12655a[_0xd24c('0x50')]);return db['MailInteraction'][_0xd24c('0x2c')]({'where':_0x113068['where']})['then'](function(_0x123805){_0x3ab821[_0xd24c('0x2c')]=_0x123805;if(_0x12655a[_0xd24c('0x40')][_0xd24c('0x51')]){_0x113068[_0xd24c('0x52')]=[{'model':db[_0xd24c('0x8d')],'as':_0xd24c('0x8e'),'required':![]},{'model':db[_0xd24c('0x8f')],'as':_0xd24c('0x90'),'attributes':[_0xd24c('0x38'),'fullname',_0xd24c('0x91')],'required':![]},{'model':db['Tag'],'as':_0xd24c('0x92'),'attributes':['id',_0xd24c('0x38'),'color'],'where':_0x12655a['query']['tag']?{'id':_0x12655a[_0xd24c('0x40')][_0xd24c('0x93')]}:undefined,'required':_0x12655a[_0xd24c('0x40')][_0xd24c('0x93')]?!![]:![]}];}return db[_0xd24c('0x8c')][_0xd24c('0x53')](_0x113068);})[_0xd24c('0x34')](function(_0x3b9e86){_0x3ab821[_0xd24c('0x54')]=_0x3b9e86;return _0x3ab821;});}})[_0xd24c('0x34')](respondWithFilteredResult(_0x3c6947,_0x113068))[_0xd24c('0x29')](handleError(_0x3c6947,null));};exports[_0xd24c('0x94')]=function(_0x30e0e6,_0x45b46a,_0x2b013d){return db[_0xd24c('0x3f')]['findOne']({'where':{'id':_0x30e0e6[_0xd24c('0x55')]['id']}})[_0xd24c('0x34')](handleEntityNotFound(_0x45b46a,null))[_0xd24c('0x34')](function(_0x518fee){if(_0x518fee){return db[_0xd24c('0x95')]['transaction'](function(_0x3e840c){return db[_0xd24c('0x96')][_0xd24c('0x35')]({'where':{'MailAccountId':_0x30e0e6['params']['id']},'transaction':_0x3e840c})[_0xd24c('0x34')](function(_0x3ea913){var _0x3dc08b=_[_0xd24c('0x4d')](_0x30e0e6['body'],function(_0x320452){_0x320452[_0xd24c('0x5c')]=_0x30e0e6[_0xd24c('0x55')]['id'];return _0x320452;});return db['MailApplication'][_0xd24c('0x97')](_0x3dc08b,{'transaction':_0x3e840c});});})['then'](function(){return db[_0xd24c('0x96')][_0xd24c('0x98')]({'where':{'MailAccountId':_0x30e0e6[_0xd24c('0x55')]['id']},'order':_0xd24c('0x99')});});}})['then'](respondWithResult(_0x45b46a,null))['catch'](handleError(_0x45b46a,null));};exports[_0xd24c('0x9a')]=function(_0xe93ef6,_0x52e24a,_0x7edeae){var _0x494b4e={};var _0x2a13e8={};var _0x178ff7;var _0xaf81aa;return db['MailAccount'][_0xd24c('0x66')]({'where':{'id':_0xe93ef6[_0xd24c('0x55')]['id']}})[_0xd24c('0x34')](handleEntityNotFound(_0x52e24a,null))[_0xd24c('0x34')](function(_0x251d4f){if(_0x251d4f){_0x178ff7=_0x251d4f;_0x2a13e8[_0xd24c('0x43')]=_[_0xd24c('0x57')](db[_0xd24c('0x96')][_0xd24c('0x5f')]);_0x2a13e8[_0xd24c('0x40')]=_[_0xd24c('0x57')](_0xe93ef6['query']);_0x2a13e8['filters']=_[_0xd24c('0x42')](_0x2a13e8[_0xd24c('0x43')],_0x2a13e8[_0xd24c('0x40')]);_0x494b4e[_0xd24c('0x45')]=_[_0xd24c('0x42')](_0x2a13e8['model'],qs[_0xd24c('0x44')](_0xe93ef6[_0xd24c('0x40')][_0xd24c('0x44')]));_0x494b4e[_0xd24c('0x45')]=_0x494b4e[_0xd24c('0x45')][_0xd24c('0x46')]?_0x494b4e[_0xd24c('0x45')]:_0x2a13e8[_0xd24c('0x43')];_0x494b4e[_0xd24c('0x48')]=qs[_0xd24c('0x49')](_0xe93ef6[_0xd24c('0x40')]['sort']);_0x494b4e['where']=qs['filters'](_[_0xd24c('0x4b')](_0xe93ef6[_0xd24c('0x40')],_0x2a13e8[_0xd24c('0x41')]));if(_0xe93ef6['query'][_0xd24c('0x4c')]){_0x494b4e[_0xd24c('0x4a')]=_[_0xd24c('0x61')](_0x494b4e[_0xd24c('0x4a')],{'$or':_[_0xd24c('0x4d')](_0x494b4e['attributes'],function(_0x5a259c){var _0x1685eb={};_0x1685eb[_0x5a259c]={'$like':'%'+_0xe93ef6[_0xd24c('0x40')][_0xd24c('0x4c')]+'%'};return _0x1685eb;})});}_0x494b4e=_['merge']({},_0x494b4e,_0xe93ef6[_0xd24c('0x50')]);return _0x178ff7['getApplications'](_0x494b4e);}})[_0xd24c('0x34')](function(_0x57dd9f){if(_0x57dd9f){_0xaf81aa=_0x57dd9f['length'];if(!_0xe93ef6[_0xd24c('0x40')][_0xd24c('0x47')](_0xd24c('0x60'))){_0x494b4e[_0xd24c('0x2e')]=qs[_0xd24c('0x2e')](_0xe93ef6['query'][_0xd24c('0x2e')]);_0x494b4e[_0xd24c('0x2d')]=qs[_0xd24c('0x2d')](_0xe93ef6['query'][_0xd24c('0x2d')]);}return _0x178ff7['getApplications'](_0x494b4e);}})[_0xd24c('0x34')](function(_0x742cc8){if(_0x742cc8){return _0x742cc8?{'count':_0xaf81aa,'rows':_0x742cc8}:null;}})[_0xd24c('0x34')](respondWithResult(_0x52e24a,null))[_0xd24c('0x29')](handleError(_0x52e24a,null));};exports[_0xd24c('0x9b')]=function(_0x39cce1,_0xb919cf,_0x3eaa99){var _0xe6a3a1={'raw':!![],'where':{}};var _0x161f16={};var _0x3d6596={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x39cce1[_0xd24c('0x55')]['id']}})[_0xd24c('0x34')](handleEntityNotFound(_0xb919cf,null))['then'](function(_0xbc3677){if(_0xbc3677){_0x161f16[_0xd24c('0x43')]=_[_0xd24c('0x57')](db[_0xd24c('0x9c')][_0xd24c('0x5f')]);_0x161f16[_0xd24c('0x40')]=_[_0xd24c('0x57')](_0x39cce1['query']);_0x161f16[_0xd24c('0x41')]=_[_0xd24c('0x42')](_0x161f16['model'],_0x161f16[_0xd24c('0x40')]);_0xe6a3a1[_0xd24c('0x45')]=_[_0xd24c('0x42')](_0x161f16[_0xd24c('0x43')],qs['fields'](_0x39cce1['query']['fields']));_0xe6a3a1[_0xd24c('0x45')]=_0xe6a3a1[_0xd24c('0x45')]['length']?_0xe6a3a1[_0xd24c('0x45')]:_0x161f16[_0xd24c('0x43')];if(!_0x39cce1[_0xd24c('0x40')][_0xd24c('0x47')](_0xd24c('0x60'))){_0xe6a3a1['limit']=qs[_0xd24c('0x2e')](_0x39cce1['query'][_0xd24c('0x2e')]);_0xe6a3a1[_0xd24c('0x2d')]=qs[_0xd24c('0x2d')](_0x39cce1[_0xd24c('0x40')][_0xd24c('0x2d')]);}_0xe6a3a1[_0xd24c('0x48')]=qs[_0xd24c('0x49')](_0x39cce1[_0xd24c('0x40')]['sort']);_0xe6a3a1[_0xd24c('0x4a')]=qs['filters'](_['pick'](_0x39cce1[_0xd24c('0x40')],_0x161f16[_0xd24c('0x41')]));_0xe6a3a1[_0xd24c('0x4a')][_0xd24c('0x5c')]=_0xbc3677['id'];if(_0x39cce1[_0xd24c('0x40')]['filter']){_0xe6a3a1[_0xd24c('0x4a')]=_['merge'](_0xe6a3a1['where'],{'$or':_[_0xd24c('0x4d')](_0xe6a3a1[_0xd24c('0x45')],function(_0x4f2294){var _0xfbbd93={};_0xfbbd93[_0x4f2294]={'$like':'%'+_0x39cce1[_0xd24c('0x40')][_0xd24c('0x4c')]+'%'};return _0xfbbd93;})});}if(_0x39cce1[_0xd24c('0x40')]['$gte']){var _0x41a156=_0x39cce1[_0xd24c('0x40')][_0xd24c('0x9d')][_0xd24c('0x9e')](',');var _0x30d1c6={};_0x30d1c6[_0x41a156[0x0]]={'$gte':moment(_0x41a156[0x1])[_0xd24c('0x9f')]('YYYY-MM-DD\x20HH:mm:ss')};_0xe6a3a1['where']=_[_0xd24c('0x61')](_0xe6a3a1[_0xd24c('0x4a')],_0x30d1c6);}_0xe6a3a1=_['merge']({},_0xe6a3a1,_0x39cce1[_0xd24c('0x50')]);return db['MailMessage']['count']({'where':_0xe6a3a1[_0xd24c('0x4a')]})[_0xd24c('0x34')](function(_0x5c6525){_0x3d6596[_0xd24c('0x2c')]=_0x5c6525;if(_0x39cce1[_0xd24c('0x40')][_0xd24c('0x51')]){_0xe6a3a1[_0xd24c('0x52')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0xe6a3a1);})[_0xd24c('0x34')](function(_0x1a5a8c){_0x3d6596['rows']=_0x1a5a8c;return _0x3d6596;});}})[_0xd24c('0x34')](respondWithFilteredResult(_0xb919cf,_0xe6a3a1))['catch'](handleError(_0xb919cf,null));};exports[_0xd24c('0xa0')]=function(_0x422190,_0x40c817,_0x307322){var _0x174488,_0xe220c8={},_0x5881ee;if(_0x422190[_0xd24c('0x59')]['to']){_0x5881ee=_0x422190[_0xd24c('0x59')]['to'][_0xd24c('0x9e')](',')[0x0];}return db[_0xd24c('0x3f')][_0xd24c('0x58')]({'where':{'id':_0x422190[_0xd24c('0x55')]['id']},'include':[{'model':db[_0xd24c('0xa1')],'as':_0xd24c('0xa2'),'include':[{'model':db[_0xd24c('0x8d')],'as':'Contacts','where':{'email':_0x5881ee},'limit':0x1,'order':[['updatedAt',_0xd24c('0xa3')]]}]},{'model':db[_0xd24c('0x3c')],'as':_0xd24c('0x3d'),'raw':!![]}]})[_0xd24c('0x34')](handleEntityNotFound(_0x40c817,null))[_0xd24c('0x34')](function(_0x187958){if(_0x187958){_0x174488=_0x187958;if(_0x187958[_0xd24c('0x3d')]){if(_[_0xd24c('0x6c')](_0x422190[_0xd24c('0x59')][_0xd24c('0xa4')])){_0x422190[_0xd24c('0x59')][_0xd24c('0xa4')]=util[_0xd24c('0x9f')](_0xd24c('0xa5'),_0x187958[_0xd24c('0x38')],_0x187958[_0xd24c('0x6a')]||_0x187958[_0xd24c('0x3d')][_0xd24c('0x70')]);}if(_0x422190[_0xd24c('0x59')]['attachments']&&_0x422190[_0xd24c('0x59')]['attachments'][_0xd24c('0x46')]){for(var _0x14c93f=0x0;_0x14c93f<_0x422190[_0xd24c('0x59')][_0xd24c('0xa6')][_0xd24c('0x46')];_0x14c93f+=0x1){_0x422190[_0xd24c('0x59')][_0xd24c('0xa6')][_0x14c93f]={'filename':_0x422190[_0xd24c('0x59')][_0xd24c('0xa6')][_0x14c93f][_0xd24c('0x38')],'path':path['join'](config[_0xd24c('0xa7')],'server/files/attachments',_0x422190['body'][_0xd24c('0xa6')][_0x14c93f][_0xd24c('0xa8')])};}}var _0xdede05={'tls':{'rejectUnauthorized':![]}};if(_[_0xd24c('0x6c')](_0x187958['Smtp'][_0xd24c('0x77')])){if(_0x187958[_0xd24c('0x3d')][_0xd24c('0x74')]){_0xdede05[_0xd24c('0xa9')]={'user':_0x187958[_0xd24c('0x3d')]['user'],'pass':_0x187958['Smtp'][_0xd24c('0x72')]};}_0xdede05[_0xd24c('0x75')]=_0x187958['Smtp'][_0xd24c('0x75')];_0xdede05[_0xd24c('0x76')]=_0x187958[_0xd24c('0x3d')][_0xd24c('0x76')];_0xdede05['secure']=_0x187958['Smtp'][_0xd24c('0xaa')];}else{_0xdede05[_0xd24c('0x77')]=_0x187958[_0xd24c('0x3d')][_0xd24c('0x77')];_0xdede05['auth']={'user':_0x187958[_0xd24c('0x3d')][_0xd24c('0x70')],'pass':_0x187958['Smtp'][_0xd24c('0x72')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0xdede05,'message':_0x422190[_0xd24c('0x59')]});}else{throw new Error('List\x20not\x20found');}}})[_0xd24c('0x34')](function(_0x3caf96){if(_0x3caf96){_0xe220c8=_0x3caf96;if(_0x174488[_0xd24c('0xa2')]){if(_0x174488[_0xd24c('0xa2')][_0xd24c('0xab')][_0xd24c('0x46')]){return _0x174488[_0xd24c('0xa2')][_0xd24c('0xab')][0x0];}else{return db[_0xd24c('0x8d')]['create'](_['defaults'](_0x422190[_0xd24c('0x59')],{'firstName':_0x422190[_0xd24c('0x59')]['to'],'email':_0x422190[_0xd24c('0x59')]['to'],'phone':_0x422190[_0xd24c('0x59')]['to'],'ListId':_0x174488[_0xd24c('0x6b')]}));}}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0x3ddaf0){if(_0x3ddaf0){var _0x1ef85e={'UserId':_0x422190[_0xd24c('0x70')]['id'],'ContactId':_0x3ddaf0['id'],'MailAccountId':_0x174488['id'],'inReplyTo':_0xe220c8[_0xd24c('0xac')],'to':_0x422190['body']['from'],'cc':_0x422190['body']['cc'],'subject':_0x422190[_0xd24c('0x59')][_0xd24c('0xad')],'attach':_0x422190[_0xd24c('0x59')][_0xd24c('0xae')],'firstMsgDirection':_0xd24c('0xaf'),'lastMsgAt':moment()[_0xd24c('0x9f')](_0xd24c('0xb0')),'lastMsgDirection':_0xd24c('0xaf'),'lastMsgBody':_0x422190[_0xd24c('0x59')][_0xd24c('0x59')],'Messages':[_[_0xd24c('0x61')](_0x422190[_0xd24c('0x59')],{'messageId':_0xe220c8['messageId'],'sentAt':moment()['format'](_0xd24c('0xb0')),'read':!![],'MailAccountId':_0x174488['id'],'UserId':_0x422190[_0xd24c('0x70')]['id'],'ContactId':_0x3ddaf0['id']})]};if(_0x422190[_0xd24c('0x59')]['Interaction']){_0x1ef85e=_[_0xd24c('0x61')](_0x1ef85e,_0x422190[_0xd24c('0x59')][_0xd24c('0xb1')]);}return db[_0xd24c('0x8c')][_0xd24c('0x64')](_0x1ef85e,{'include':[{'model':db['MailMessage'],'as':_0xd24c('0xb2')}]});}})[_0xd24c('0x34')](respondWithResult(_0x40c817,null))[_0xd24c('0x29')](handleError(_0x40c817,null));};exports[_0xd24c('0xb3')]=function(_0x1aac18,_0x44819e,_0x110f5c){return db[_0xd24c('0x3f')]['find']({'where':{'id':_0x1aac18[_0xd24c('0x55')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xd24c('0x3d'),'raw':!![]}]})[_0xd24c('0x34')](handleEntityNotFound(_0x44819e,null))[_0xd24c('0x34')](function(_0x317edf){if(_0x317edf&&_0x317edf[_0xd24c('0x3d')]){var _0x2888b2={'id':_0x317edf['id'],'tls':{'rejectUnauthorized':![]}};if(_0x317edf[_0xd24c('0x3d')]['service']){_0x2888b2[_0xd24c('0x77')]=_0x317edf['Smtp'][_0xd24c('0x77')];}else{_0x2888b2['host']=_0x317edf[_0xd24c('0x3d')][_0xd24c('0x75')];_0x2888b2['port']=_0x317edf[_0xd24c('0x3d')][_0xd24c('0x76')];_0x2888b2[_0xd24c('0xaa')]=_0x317edf[_0xd24c('0x3d')][_0xd24c('0xaa')];}if(_0x317edf[_0xd24c('0x3d')]['authentication']){_0x2888b2['auth']={'user':_0x317edf['Smtp'][_0xd24c('0x70')],'pass':_0x317edf[_0xd24c('0x3d')]['pass']};}return respondWithRpcPromise(_0xd24c('0xb4'),_0xd24c('0xb3'),{'account':_0x2888b2});}})['then'](respondWithResult(_0x44819e,null))[_0xd24c('0x29')](handleError(_0x44819e,null));};exports[_0xd24c('0x35')]=function(_0x1520b2,_0x55c0b6){return db['MailAccount']['find']({'where':{'id':_0x1520b2['params']['id']}})[_0xd24c('0x34')](handleEntityNotFound(_0x55c0b6,null))[_0xd24c('0x34')](function(_0x4ca5a7){if(_0x4ca5a7&&_0x4ca5a7[_0xd24c('0x77')]){throw new db[(_0xd24c('0xb5'))][(_0xd24c('0xb6'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x4ca5a7;})[_0xd24c('0x34')](removeEntity(_0x55c0b6,null))['catch'](handleError(_0x55c0b6,null));};exports[_0xd24c('0xb7')]=function(_0x208594,_0x4a54df,_0x43ef83){return db[_0xd24c('0x3f')]['find']({'where':{'id':_0x208594[_0xd24c('0x55')]['id']}})[_0xd24c('0x34')](handleEntityNotFound(_0x4a54df,null))[_0xd24c('0x34')](function(_0x5b4763){if(_0x5b4763){return _0x5b4763[_0xd24c('0xb7')](_0x208594[_0xd24c('0x59')][_0xd24c('0x63')],_[_0xd24c('0x8a')](_0x208594[_0xd24c('0x59')],[_0xd24c('0x63'),'id'])||{})['spread'](function(_0x29253e){for(var _0x3c35c1=0x0;_0x3c35c1<_0x208594[_0xd24c('0x59')][_0xd24c('0x63')]['length'];_0x3c35c1+=0x1){socket[_0xd24c('0xb8')](_0xd24c('0xb9'),{'UserId':_0x208594[_0xd24c('0x59')]['ids'][_0x3c35c1],'MailAccountId':_0x208594[_0xd24c('0x55')]['id']});}return _0x29253e;});}})[_0xd24c('0x34')](respondWithResult(_0x4a54df,null))[_0xd24c('0x29')](handleError(_0x4a54df,null));};exports[_0xd24c('0xba')]=function(_0x5101f3,_0x580285,_0x35b356){var _0x2d6288;return db['MailAccount'][_0xd24c('0x58')]({'where':{'id':_0x5101f3[_0xd24c('0x55')]['id']}})['then'](handleEntityNotFound(_0x580285,null))[_0xd24c('0x34')](function(_0xae5e37){if(_0xae5e37){return _0xae5e37[_0xd24c('0xba')](_0x5101f3[_0xd24c('0x40')][_0xd24c('0x63')])[_0xd24c('0x34')](function(_0x44f639){if(_[_0xd24c('0xbb')](_0x5101f3[_0xd24c('0x40')][_0xd24c('0x63')])){for(var _0x5575e8=0x0;_0x5575e8<_0x5101f3[_0xd24c('0x40')]['ids'][_0xd24c('0x46')];_0x5575e8+=0x1){socket[_0xd24c('0xb8')](_0xd24c('0xbc'),{'UserId':_0x5101f3[_0xd24c('0x40')][_0xd24c('0x63')][_0x5575e8],'MailAccountId':_0x5101f3[_0xd24c('0x55')]['id']});}}else{socket[_0xd24c('0xb8')](_0xd24c('0xbc'),{'UserId':_0x5101f3['query'][_0xd24c('0x63')],'MailAccountId':_0x5101f3[_0xd24c('0x55')]['id']});}});}})[_0xd24c('0x34')](respondWithStatusCode(_0x580285,null))[_0xd24c('0x29')](handleError(_0x580285,null));};exports[_0xd24c('0xbd')]=function(_0x4959f9,_0x30a5a5,_0x53f7df){var _0x5ba7a7={};var _0x4b2c75={};var _0x1617f3;var _0xd04e1;return db[_0xd24c('0x3f')]['findOne']({'where':{'id':_0x4959f9[_0xd24c('0x55')]['id']}})[_0xd24c('0x34')](handleEntityNotFound(_0x30a5a5,null))['then'](function(_0x2ee25c){if(_0x2ee25c){_0x1617f3=_0x2ee25c;_0x4b2c75['model']=_[_0xd24c('0x57')](db[_0xd24c('0x8f')][_0xd24c('0x5f')]);_0x4b2c75[_0xd24c('0x40')]=_['keys'](_0x4959f9[_0xd24c('0x40')]);_0x4b2c75['filters']=_[_0xd24c('0x42')](_0x4b2c75['model'],_0x4b2c75[_0xd24c('0x40')]);_0x5ba7a7['attributes']=_[_0xd24c('0x42')](_0x4b2c75[_0xd24c('0x43')],qs[_0xd24c('0x44')](_0x4959f9[_0xd24c('0x40')]['fields']));_0x5ba7a7[_0xd24c('0x45')]=_0x5ba7a7[_0xd24c('0x45')]['length']?_0x5ba7a7[_0xd24c('0x45')]:_0x4b2c75[_0xd24c('0x43')];_0x5ba7a7[_0xd24c('0x48')]=qs[_0xd24c('0x49')](_0x4959f9[_0xd24c('0x40')][_0xd24c('0x49')]);_0x5ba7a7['where']=qs[_0xd24c('0x41')](_[_0xd24c('0x4b')](_0x4959f9[_0xd24c('0x40')],_0x4b2c75[_0xd24c('0x41')]));if(_0x4959f9[_0xd24c('0x40')][_0xd24c('0x4c')]){_0x5ba7a7[_0xd24c('0x4a')]=_[_0xd24c('0x61')](_0x5ba7a7[_0xd24c('0x4a')],{'$or':_[_0xd24c('0x4d')](_0x5ba7a7[_0xd24c('0x45')],function(_0x174507){var _0x3b5e79={};_0x3b5e79[_0x174507]={'$like':'%'+_0x4959f9['query'][_0xd24c('0x4c')]+'%'};return _0x3b5e79;})});}_0x5ba7a7=_[_0xd24c('0x61')]({},_0x5ba7a7,_0x4959f9[_0xd24c('0x50')]);return _0x1617f3['getAgents'](_0x5ba7a7);}})[_0xd24c('0x34')](function(_0x3f1c19){if(_0x3f1c19){_0xd04e1=_0x3f1c19[_0xd24c('0x46')];if(!_0x4959f9[_0xd24c('0x40')][_0xd24c('0x47')](_0xd24c('0x60'))){_0x5ba7a7['limit']=qs['limit'](_0x4959f9[_0xd24c('0x40')][_0xd24c('0x2e')]);_0x5ba7a7[_0xd24c('0x2d')]=qs[_0xd24c('0x2d')](_0x4959f9[_0xd24c('0x40')][_0xd24c('0x2d')]);}return _0x1617f3[_0xd24c('0xbd')](_0x5ba7a7);}})[_0xd24c('0x34')](function(_0x530ddf){if(_0x530ddf){return _0x530ddf?{'count':_0xd04e1,'rows':_0x530ddf}:null;}})[_0xd24c('0x34')](respondWithResult(_0x30a5a5,null))[_0xd24c('0x29')](handleError(_0x30a5a5,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index c669e8e..c58cb70 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 _0x9fb5=['MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','events'];(function(_0x516743,_0x2d24a4){var _0x5698ff=function(_0x1ebd02){while(--_0x1ebd02){_0x516743['push'](_0x516743['shift']());}};_0x5698ff(++_0x2d24a4);}(_0x9fb5,0x167));var _0x59fb=function(_0x1d2f68,_0x16f0fb){_0x1d2f68=_0x1d2f68-0x0;var _0x17f71f=_0x9fb5[_0x1d2f68];return _0x17f71f;};'use strict';var EventEmitter=require(_0x59fb('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x59fb('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x59fb('0x2')](0x0);var events={'afterCreate':_0x59fb('0x3'),'afterUpdate':_0x59fb('0x4'),'afterDestroy':_0x59fb('0x5')};function emitEvent(_0x1f55a7){return function(_0x40e380,_0x2fb703,_0x43c858){MailAccountEvents[_0x59fb('0x6')](_0x1f55a7+':'+_0x40e380['id'],_0x40e380);MailAccountEvents[_0x59fb('0x6')](_0x1f55a7,_0x40e380);_0x43c858(null);};}for(var e in events){if(events[_0x59fb('0x7')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xacde=['hook','exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xacde,0xec));var _0xeacd=function(_0x1d2e5e,_0x145ae6){_0x1d2e5e=_0x1d2e5e-0x0;var _0x4a1d68=_0xacde[_0x1d2e5e];return _0x4a1d68;};'use strict';var EventEmitter=require(_0xeacd('0x0'));var MailAccount=require(_0xeacd('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xeacd('0x2'),'afterUpdate':_0xeacd('0x3'),'afterDestroy':_0xeacd('0x4')};function emitEvent(_0x52796e){return function(_0x165bb5,_0x4d8c98,_0x5a0fca){MailAccountEvents[_0xeacd('0x5')](_0x52796e+':'+_0x165bb5['id'],_0x165bb5);MailAccountEvents[_0xeacd('0x5')](_0x52796e,_0x165bb5);_0x5a0fca(null);};}for(var e in events){if(events[_0xeacd('0x6')](e)){var event=events[e];MailAccount[_0xeacd('0x7')](e,emitEvent(event));}}module[_0xeacd('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index f6f549e..eb26b6e 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 _0xa289=['define','MailAccount','mail_accounts','lodash','util','moment','bluebird','request-promise','./mailAccount.attributes','exports'];(function(_0x4403cb,_0x3ecce6){var _0x406240=function(_0x351272){while(--_0x351272){_0x4403cb['push'](_0x4403cb['shift']());}};_0x406240(++_0x3ecce6);}(_0xa289,0x1c5));var _0x9a28=function(_0x210c82,_0x2a3be0){_0x210c82=_0x210c82-0x0;var _0x2e2536=_0xa289[_0x210c82];return _0x2e2536;};'use strict';var _=require(_0x9a28('0x0'));var util=require(_0x9a28('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9a28('0x2'));var BPromise=require(_0x9a28('0x3'));var rp=require(_0x9a28('0x4'));var attributes=require(_0x9a28('0x5'));module[_0x9a28('0x6')]=function(_0x1674ac,_0x28de7a){return _0x1674ac[_0x9a28('0x7')](_0x9a28('0x8'),attributes,{'tableName':_0x9a28('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd5b=['exports','define','MailAccount','mail_accounts','lodash','../../config/logger','api','moment','bluebird'];(function(_0xdbb962,_0x523201){var _0xf4675b=function(_0x460eb7){while(--_0x460eb7){_0xdbb962['push'](_0xdbb962['shift']());}};_0xf4675b(++_0x523201);}(_0xcd5b,0x1ab));var _0xbcd5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcd5b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbcd5('0x0'));var util=require('util');var logger=require(_0xbcd5('0x1'))(_0xbcd5('0x2'));var moment=require(_0xbcd5('0x3'));var BPromise=require(_0xbcd5('0x4'));var rp=require('request-promise');var attributes=require('./mailAccount.attributes');module[_0xbcd5('0x5')]=function(_0x160e29,_0x3915d0){return _0x160e29[_0xbcd5('0x6')](_0xbcd5('0x7'),attributes,{'tableName':_0xbcd5('0x8'),'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 a7d3e46..6384f31 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 _0x5d27=['CmContact','updatedAt','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','get','omit','applications','list','priority','asc','push','length','close','defaults','create','contact','generate','messageId','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','inReplyTo','Contact\x20not\x20found','update','format','interaction','created','MailMessage','attachments','originTo','bcc','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./mailAccount.socket','request','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','then','GetMailAccount','ShowMailAccount','MailAccount','find','body','difference','keys'];(function(_0x17b2d2,_0x139939){var _0x8d3bd8=function(_0x57e2de){while(--_0x57e2de){_0x17b2d2['push'](_0x17b2d2['shift']());}};_0x8d3bd8(++_0x139939);}(_0x5d27,0x15f));var _0x75d2=function(_0x3f48e0,_0x453a44){_0x3f48e0=_0x3f48e0-0x0;var _0x2333e1=_0x5d27[_0x3f48e0];return _0x2333e1;};'use strict';var _=require(_0x75d2('0x0'));var util=require(_0x75d2('0x1'));var moment=require(_0x75d2('0x2'));var BPromise=require('bluebird');var rs=require(_0x75d2('0x3'));var fs=require('fs');var Redis=require(_0x75d2('0x4'));var db=require(_0x75d2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x75d2('0x6'))(_0x75d2('0x7'));var config=require(_0x75d2('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x75d2('0x9')]({'port':0x232c});config[_0x75d2('0xa')]=_['defaults'](config[_0x75d2('0xa')],{'host':_0x75d2('0xb'),'port':0x18eb});var socket=require(_0x75d2('0xc'))(new Redis(config['redis']));require(_0x75d2('0xd'))['register'](socket);function respondWithRpcPromise(_0x332bd6,_0x9d0ef8,_0x5bfd92){return new BPromise(function(_0x1e31df,_0xa1583e){return client[_0x75d2('0xe')](_0x332bd6,_0x5bfd92)['then'](function(_0x73760f){logger[_0x75d2('0xf')](_0x75d2('0x10'),_0x9d0ef8,'request\x20sent');logger[_0x75d2('0x11')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x9d0ef8,_0x75d2('0x12'),JSON[_0x75d2('0x13')](_0x73760f));if(_0x73760f[_0x75d2('0x14')]){if(_0x73760f[_0x75d2('0x14')]['code']===0x1f4){logger['error'](_0x75d2('0x10'),_0x9d0ef8,_0x73760f[_0x75d2('0x14')]['message']);return _0xa1583e(_0x73760f[_0x75d2('0x14')][_0x75d2('0x15')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x9d0ef8,_0x73760f[_0x75d2('0x14')]['message']);return _0x1e31df(_0x73760f['error'][_0x75d2('0x15')]);}else{logger[_0x75d2('0xf')]('MailAccount,\x20%s,\x20%s',_0x9d0ef8,_0x75d2('0x12'));_0x1e31df(_0x73760f[_0x75d2('0x16')][_0x75d2('0x15')]);}})[_0x75d2('0x17')](function(_0x145285){logger['error'](_0x75d2('0x10'),_0x9d0ef8,_0x145285);_0xa1583e(_0x145285);});});}exports['GetMailAccount']=function(_0x513b95){var _0x464e9f=this;return new Promise(function(_0x79ec34,_0x52cecf){return db['MailAccount'][_0x75d2('0x18')]({'raw':_0x513b95[_0x75d2('0x19')]?_0x513b95['options'][_0x75d2('0x1a')]===undefined?!![]:![]:!![],'where':_0x513b95['options']?_0x513b95[_0x75d2('0x19')][_0x75d2('0x1b')]||null:null,'attributes':_0x513b95[_0x75d2('0x19')]?_0x513b95[_0x75d2('0x19')][_0x75d2('0x1c')]||null:null,'limit':_0x513b95[_0x75d2('0x19')]?_0x513b95[_0x75d2('0x19')][_0x75d2('0x1d')]||null:null,'include':_0x513b95['options']?_0x513b95[_0x75d2('0x19')][_0x75d2('0x1e')]?_[_0x75d2('0x1f')](_0x513b95[_0x75d2('0x19')][_0x75d2('0x1e')],function(_0xc41b){return{'model':db[_0xc41b[_0x75d2('0x20')]],'as':_0xc41b['as'],'attributes':_0xc41b[_0x75d2('0x1c')],'include':_0xc41b['include']?_[_0x75d2('0x1f')](_0xc41b[_0x75d2('0x1e')],function(_0x1d566c){return{'model':db[_0x1d566c[_0x75d2('0x20')]],'as':_0x1d566c['as'],'attributes':_0x1d566c[_0x75d2('0x1c')],'include':_0x1d566c[_0x75d2('0x1e')]?_[_0x75d2('0x1f')](_0x1d566c[_0x75d2('0x1e')],function(_0x3bb4db){return{'model':db[_0x3bb4db[_0x75d2('0x20')]],'as':_0x3bb4db['as'],'attributes':_0x3bb4db[_0x75d2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x75d2('0x21')](function(_0x5aa7cb){logger['info']('GetMailAccount',_0x513b95);logger[_0x75d2('0x11')](_0x75d2('0x22'),_0x513b95,JSON[_0x75d2('0x13')](_0x5aa7cb));_0x79ec34(_0x5aa7cb);})[_0x75d2('0x17')](function(_0x15ba6c){logger[_0x75d2('0x14')](_0x75d2('0x22'),_0x15ba6c['message'],_0x513b95);_0x52cecf(_0x464e9f[_0x75d2('0x14')](0x1f4,_0x15ba6c[_0x75d2('0x15')]));});});};exports[_0x75d2('0x23')]=function(_0x22450f){var _0x5a4766=this;return new Promise(function(_0x35fe7b,_0x76aecf){return db[_0x75d2('0x24')][_0x75d2('0x25')]({'raw':_0x22450f[_0x75d2('0x19')]?_0x22450f['options'][_0x75d2('0x1a')]===undefined?!![]:![]:!![],'where':_0x22450f['options']?_0x22450f[_0x75d2('0x19')][_0x75d2('0x1b')]||null:null,'attributes':_0x22450f[_0x75d2('0x19')]?_0x22450f[_0x75d2('0x19')][_0x75d2('0x1c')]||null:null,'include':_0x22450f[_0x75d2('0x19')]?_0x22450f['options'][_0x75d2('0x1e')]?_['map'](_0x22450f[_0x75d2('0x19')][_0x75d2('0x1e')],function(_0x234759){return{'model':db[_0x234759[_0x75d2('0x20')]],'as':_0x234759['as'],'attributes':_0x234759[_0x75d2('0x1c')],'include':_0x234759[_0x75d2('0x1e')]?_[_0x75d2('0x1f')](_0x234759['include'],function(_0x278e45){return{'model':db[_0x278e45['model']],'as':_0x278e45['as'],'attributes':_0x278e45[_0x75d2('0x1c')],'include':_0x278e45[_0x75d2('0x1e')]?_[_0x75d2('0x1f')](_0x278e45[_0x75d2('0x1e')],function(_0x2bc333){return{'model':db[_0x2bc333[_0x75d2('0x20')]],'as':_0x2bc333['as'],'attributes':_0x2bc333[_0x75d2('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b5f32){logger['info'](_0x75d2('0x23'),_0x22450f);logger['debug'](_0x75d2('0x23'),_0x22450f,JSON['stringify'](_0x1b5f32));_0x35fe7b(_0x1b5f32);})['catch'](function(_0x1ce258){logger['error'](_0x75d2('0x23'),_0x1ce258[_0x75d2('0x15')],_0x22450f);_0x76aecf(_0x5a4766[_0x75d2('0x14')](0x1f4,_0x1ce258[_0x75d2('0x15')]));});});};exports['NotifyMailAccount']=function(_0x5babc3){var _0x50488c=this;return new Promise(function(_0x5c55eb,_0x5767c8){var _0x31e60d={'body':_0x5babc3[_0x75d2('0x26')],'channel':'mail'};var _0x33ed9f=_[_0x75d2('0x27')](_[_0x75d2('0x28')](db[_0x75d2('0x29')]['rawAttributes']),['createdAt',_0x75d2('0x2a'),'CompanyId','ListId']);var _0x5a0d4e=![];if(_0x5babc3[_0x75d2('0x26')]['id']){delete _0x5babc3[_0x75d2('0x26')]['id'];}if(_[_0x75d2('0x2b')](_0x5babc3[_0x75d2('0x26')][_0x75d2('0x2c')])){return _0x5767c8(_0x50488c[_0x75d2('0x14')](0x1f4,_0x75d2('0x2d')));}if(_[_0x75d2('0x2b')](_0x5babc3['body'][_0x75d2('0x26')])||_0x5babc3[_0x75d2('0x26')][_0x75d2('0x26')]===''){return _0x5767c8(_0x50488c[_0x75d2('0x14')](0x1f4,_0x75d2('0x2e')));}if(_[_0x75d2('0x2b')](_0x5babc3[_0x75d2('0x26')]['mapKey'])){return _0x5767c8(_0x50488c[_0x75d2('0x14')](0x1f4,_0x75d2('0x2f')+_0x33ed9f));}if(!_[_0x75d2('0x30')](_0x33ed9f,_0x5babc3['body'][_0x75d2('0x31')])){return _0x5767c8(_0x50488c[_0x75d2('0x14')](0x1f4,_0x75d2('0x32')+_0x33ed9f));}var _0x13f368={};_0x13f368[_0x5babc3['body']['mapKey']]=_0x5babc3[_0x75d2('0x26')][_0x75d2('0x2c')];return db['MailAccount'][_0x75d2('0x25')]({'where':{'id':_0x5babc3[_0x75d2('0x33')]['id']},'include':[{'model':db[_0x75d2('0x34')],'as':_0x75d2('0x35'),'include':[{'model':db['CmContact'],'as':_0x75d2('0x36'),'where':_0x13f368,'limit':0x1,'order':[['updatedAt',_0x75d2('0x37')]]}]},{'model':db[_0x75d2('0x38')],'as':_0x75d2('0x39')},{'model':db[_0x75d2('0x3a')],'as':'Smtp'}]})[_0x75d2('0x21')](function(_0x5af222){if(_0x5af222&&_0x5af222[_0x75d2('0x35')]){var _0x2c9f46=_0x5af222[_0x75d2('0x3b')]({'plain':!![]});_0x31e60d['account']=_[_0x75d2('0x3c')](_0x2c9f46,[_0x75d2('0x39'),'List']);_0x31e60d[_0x75d2('0x3d')]=_0x2c9f46['Applications'];_0x31e60d[_0x75d2('0x3e')]=_0x2c9f46[_0x75d2('0x35')];_0x31e60d[_0x75d2('0x3d')]=_['orderBy'](_0x31e60d[_0x75d2('0x3d')],[_0x75d2('0x3f')],[_0x75d2('0x40')]);if(_0x31e60d[_0x75d2('0x33')]&&_0x31e60d[_0x75d2('0x33')]['autoclose']){_0x31e60d[_0x75d2('0x3d')][_0x75d2('0x41')]({'id':0x0,'priority':_0x31e60d[_0x75d2('0x3d')][_0x75d2('0x42')]+0x1,'app':_0x75d2('0x43'),'appdata':'autoclose','interval':'*,*,*,*'});}if(_0x31e60d[_0x75d2('0x33')][_0x75d2('0x39')]){delete _0x31e60d['account'][_0x75d2('0x39')];}if(_0x31e60d[_0x75d2('0x33')][_0x75d2('0x35')]){delete _0x31e60d['account'][_0x75d2('0x35')];}if(_0x2c9f46[_0x75d2('0x35')][_0x75d2('0x36')]['length']){return _0x2c9f46[_0x75d2('0x35')]['Contacts'][0x0];}var _0x26ed18=_[_0x75d2('0x44')](_0x5babc3[_0x75d2('0x26')],{'firstName':_0x5babc3[_0x75d2('0x26')][_0x75d2('0x2c')],'ListId':_0x2c9f46['ListId']});_0x26ed18[_0x5babc3[_0x75d2('0x26')][_0x75d2('0x31')]]=_0x5babc3[_0x75d2('0x26')][_0x75d2('0x2c')];return db[_0x75d2('0x29')][_0x75d2('0x45')](_0x26ed18);}else{throw new Error('List\x20not\x20found');}})[_0x75d2('0x21')](function(_0x226c3c){_0x31e60d[_0x75d2('0x46')]=_0x226c3c;if(_0x226c3c){if(!_0x5babc3[_0x75d2('0x26')][_0x75d2('0x15')]['messageId']){_0x5babc3[_0x75d2('0x26')][_0x75d2('0x15')]['messageId']=rs[_0x75d2('0x47')]()+'\x20'+_0x5babc3['body'][_0x75d2('0x15')][_0x75d2('0x2c')];}var _0x2f2d76={'ContactId':_0x226c3c['id'],'MailAccountId':_0x5babc3['account']['id'],'inReplyTo':_0x5babc3[_0x75d2('0x26')]['message'][_0x75d2('0x48')],'to':_0x5babc3[_0x75d2('0x26')][_0x75d2('0x15')][_0x75d2('0x2c')],'cc':_0x5babc3[_0x75d2('0x26')][_0x75d2('0x15')]['cc'],'subject':_0x5babc3[_0x75d2('0x26')]['message'][_0x75d2('0x49')],'attach':_0x5babc3[_0x75d2('0x26')][_0x75d2('0x15')][_0x75d2('0x4a')],'lastMsgAt':moment()['format'](_0x75d2('0x4b')),'lastMsgDirection':'in','lastMsgBody':_0x5babc3[_0x75d2('0x26')][_0x75d2('0x26')]};return db[_0x75d2('0x4c')][_0x75d2('0x25')]({'where':{'closed':![],'MailAccountId':_0x5babc3['account']['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x75d2('0x48')],'where':{'messageId':_0x5babc3[_0x75d2('0x26')][_0x75d2('0x15')][_0x75d2('0x4d')]}}]})[_0x75d2('0x21')](function(_0x1db277){if(_0x1db277){return[_0x1db277,![]];}return db[_0x75d2('0x4c')][_0x75d2('0x45')](_0x2f2d76)[_0x75d2('0x21')](function(_0x588d3e){return[_0x588d3e,!![]];});});}else{throw new Error(_0x75d2('0x4e'));}})['spread'](function(_0x1c20e2,_0x102498){if(_0x1c20e2){_0x5a0d4e=_0x102498;if(!_0x102498){return _0x1c20e2[_0x75d2('0x4f')]({'inReplyTo':_0x5babc3['body']['message'][_0x75d2('0x48')],'to':_0x5babc3['body'][_0x75d2('0x15')][_0x75d2('0x2c')],'cc':_0x5babc3[_0x75d2('0x26')][_0x75d2('0x15')]['cc'],'subject':_0x5babc3[_0x75d2('0x26')][_0x75d2('0x15')][_0x75d2('0x49')],'attach':_0x1c20e2[_0x75d2('0x4a')]?_0x1c20e2['attach']:_0x5babc3[_0x75d2('0x26')][_0x75d2('0x15')]['attach'],'substatus':null,'substatusAt':moment()[_0x75d2('0x50')](_0x75d2('0x4b')),'lastMsgAt':moment()[_0x75d2('0x50')](_0x75d2('0x4b')),'lastMsgDirection':'in','lastMsgBody':_0x5babc3[_0x75d2('0x26')][_0x75d2('0x26')]});}else{return _0x1c20e2;}}})[_0x75d2('0x21')](function(_0x4d4545){_0x31e60d[_0x75d2('0x51')]=_0x4d4545['get']({'plain':!![]});_0x31e60d[_0x75d2('0x51')][_0x75d2('0x52')]=_0x5a0d4e;return db[_0x75d2('0x53')][_0x75d2('0x45')]({'body':_0x5babc3[_0x75d2('0x26')][_0x75d2('0x26')],'MailAccountId':_0x5babc3[_0x75d2('0x33')]['id'],'MailInteractionId':_0x4d4545['id'],'direction':'in','ContactId':_0x31e60d[_0x75d2('0x46')]['id'],'messageId':_0x5babc3[_0x75d2('0x26')][_0x75d2('0x15')][_0x75d2('0x48')],'from':_0x5babc3['body'][_0x75d2('0x15')][_0x75d2('0x2c')],'to':_0x5babc3['body'][_0x75d2('0x15')]['to'],'cc':_0x5babc3[_0x75d2('0x26')][_0x75d2('0x15')]['cc'],'subject':_0x5babc3[_0x75d2('0x26')][_0x75d2('0x15')]['subject'],'attach':_0x5babc3[_0x75d2('0x26')][_0x75d2('0x15')][_0x75d2('0x4a')],'Attachments':_0x5babc3[_0x75d2('0x26')]['message'][_0x75d2('0x54')],'originTo':_0x5babc3[_0x75d2('0x26')][_0x75d2('0x15')][_0x75d2('0x55')],'originCc':_0x5babc3[_0x75d2('0x26')]['message']['originCc'],'bcc':_0x5babc3[_0x75d2('0x26')][_0x75d2('0x15')][_0x75d2('0x56')]},{'include':[{'model':db[_0x75d2('0x57')],'as':_0x75d2('0x58')}]});})['then'](function(_0x3efcd5){_0x31e60d[_0x75d2('0x15')]=_0x3efcd5;if(_0x31e60d[_0x75d2('0x51')][_0x75d2('0x59')]){return db[_0x75d2('0x5a')]['find']({'attributes':['id',_0x75d2('0x5b')],'where':{'id':_0x31e60d['interaction'][_0x75d2('0x59')]}})[_0x75d2('0x21')](function(_0x39c01e){if(_0x39c01e){_0x31e60d[_0x75d2('0x3d')][_0x75d2('0x5c')]({'id':0x0,'priority':0x0,'app':_0x75d2('0x5d'),'appdata':_0x39c01e[_0x75d2('0x5b')]+','+(_0x31e60d[_0x75d2('0x33')][_0x75d2('0x5e')]||0xa),'interval':_0x75d2('0x5f')});}return respondWithRpcPromise(_0x75d2('0x60'),_0x75d2('0x61'),_0x31e60d);});}return respondWithRpcPromise(_0x75d2('0x60'),'startRouting',_0x31e60d);})['then'](function(_0x458a6b){_0x5c55eb(_0x458a6b);})[_0x75d2('0x17')](function(_0x53b722){_0x5767c8(_0x50488c[_0x75d2('0x14')](0x1f4,_0x53b722[_0x75d2('0x15')]));});});}; \ No newline at end of file +var _0xe349=['mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','find','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','get','omit','applications','list','orderBy','priority','asc','account','push','length','autoclose','*,*,*,*','create','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','update','format','interaction','created','attachments','originTo','originCc','bcc','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','startRouting','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey'];(function(_0x14341f,_0x18a9d1){var _0x4422c4=function(_0x524b61){while(--_0x524b61){_0x14341f['push'](_0x14341f['shift']());}};_0x4422c4(++_0x18a9d1);}(_0xe349,0x1db));var _0x9e34=function(_0x216799,_0x44b817){_0x216799=_0x216799-0x0;var _0x3661c3=_0xe349[_0x216799];return _0x3661c3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9e34('0x0'));var BPromise=require(_0x9e34('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e34('0x2'));var db=require(_0x9e34('0x3'))['db'];var utils=require(_0x9e34('0x4'));var logger=require(_0x9e34('0x5'))(_0x9e34('0x6'));var config=require(_0x9e34('0x7'));var jayson=require(_0x9e34('0x8'));var client=jayson[_0x9e34('0x9')][_0x9e34('0xa')]({'port':0x232c});config['redis']=_[_0x9e34('0xb')](config[_0x9e34('0xc')],{'host':_0x9e34('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9e34('0xc')]));require(_0x9e34('0xe'))[_0x9e34('0xf')](socket);function respondWithRpcPromise(_0x3f1c63,_0x42a54a,_0x87840d){return new BPromise(function(_0x2ec709,_0x24d113){return client[_0x9e34('0x10')](_0x3f1c63,_0x87840d)[_0x9e34('0x11')](function(_0x485945){logger[_0x9e34('0x12')](_0x9e34('0x13'),_0x42a54a,'request\x20sent');logger[_0x9e34('0x14')](_0x9e34('0x15'),_0x42a54a,_0x9e34('0x16'),JSON['stringify'](_0x485945));if(_0x485945[_0x9e34('0x17')]){if(_0x485945[_0x9e34('0x17')][_0x9e34('0x18')]===0x1f4){logger['error'](_0x9e34('0x13'),_0x42a54a,_0x485945[_0x9e34('0x17')][_0x9e34('0x19')]);return _0x24d113(_0x485945[_0x9e34('0x17')][_0x9e34('0x19')]);}logger['error'](_0x9e34('0x13'),_0x42a54a,_0x485945[_0x9e34('0x17')][_0x9e34('0x19')]);return _0x2ec709(_0x485945['error'][_0x9e34('0x19')]);}else{logger[_0x9e34('0x12')](_0x9e34('0x13'),_0x42a54a,_0x9e34('0x16'));_0x2ec709(_0x485945[_0x9e34('0x1a')]['message']);}})[_0x9e34('0x1b')](function(_0x1fc695){logger[_0x9e34('0x17')](_0x9e34('0x13'),_0x42a54a,_0x1fc695);_0x24d113(_0x1fc695);});});}exports[_0x9e34('0x1c')]=function(_0x5bc2f6){var _0xe7eaef=this;return new Promise(function(_0x59f95a,_0x1229da){return db[_0x9e34('0x1d')][_0x9e34('0x1e')]({'raw':_0x5bc2f6[_0x9e34('0x1f')]?_0x5bc2f6[_0x9e34('0x1f')][_0x9e34('0x20')]===undefined?!![]:![]:!![],'where':_0x5bc2f6[_0x9e34('0x1f')]?_0x5bc2f6['options'][_0x9e34('0x21')]||null:null,'attributes':_0x5bc2f6[_0x9e34('0x1f')]?_0x5bc2f6[_0x9e34('0x1f')][_0x9e34('0x22')]||null:null,'limit':_0x5bc2f6['options']?_0x5bc2f6[_0x9e34('0x1f')][_0x9e34('0x23')]||null:null,'include':_0x5bc2f6[_0x9e34('0x1f')]?_0x5bc2f6[_0x9e34('0x1f')][_0x9e34('0x24')]?_[_0x9e34('0x25')](_0x5bc2f6[_0x9e34('0x1f')][_0x9e34('0x24')],function(_0x16e146){return{'model':db[_0x16e146['model']],'as':_0x16e146['as'],'attributes':_0x16e146['attributes'],'include':_0x16e146[_0x9e34('0x24')]?_['map'](_0x16e146[_0x9e34('0x24')],function(_0x277e2c){return{'model':db[_0x277e2c[_0x9e34('0x26')]],'as':_0x277e2c['as'],'attributes':_0x277e2c[_0x9e34('0x22')],'include':_0x277e2c['include']?_['map'](_0x277e2c['include'],function(_0x6e7a92){return{'model':db[_0x6e7a92[_0x9e34('0x26')]],'as':_0x6e7a92['as'],'attributes':_0x6e7a92[_0x9e34('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9e34('0x11')](function(_0x86333b){logger[_0x9e34('0x12')](_0x9e34('0x1c'),_0x5bc2f6);logger[_0x9e34('0x14')](_0x9e34('0x1c'),_0x5bc2f6,JSON[_0x9e34('0x27')](_0x86333b));_0x59f95a(_0x86333b);})[_0x9e34('0x1b')](function(_0x588485){logger[_0x9e34('0x17')](_0x9e34('0x1c'),_0x588485[_0x9e34('0x19')],_0x5bc2f6);_0x1229da(_0xe7eaef['error'](0x1f4,_0x588485[_0x9e34('0x19')]));});});};exports[_0x9e34('0x28')]=function(_0x34bbe2){var _0x1d4120=this;return new Promise(function(_0x55ed83,_0x35ed30){return db[_0x9e34('0x1d')]['find']({'raw':_0x34bbe2[_0x9e34('0x1f')]?_0x34bbe2[_0x9e34('0x1f')][_0x9e34('0x20')]===undefined?!![]:![]:!![],'where':_0x34bbe2['options']?_0x34bbe2[_0x9e34('0x1f')]['where']||null:null,'attributes':_0x34bbe2[_0x9e34('0x1f')]?_0x34bbe2[_0x9e34('0x1f')][_0x9e34('0x22')]||null:null,'include':_0x34bbe2[_0x9e34('0x1f')]?_0x34bbe2[_0x9e34('0x1f')][_0x9e34('0x24')]?_['map'](_0x34bbe2[_0x9e34('0x1f')][_0x9e34('0x24')],function(_0x59a3f4){return{'model':db[_0x59a3f4[_0x9e34('0x26')]],'as':_0x59a3f4['as'],'attributes':_0x59a3f4[_0x9e34('0x22')],'include':_0x59a3f4[_0x9e34('0x24')]?_[_0x9e34('0x25')](_0x59a3f4[_0x9e34('0x24')],function(_0x2e191d){return{'model':db[_0x2e191d['model']],'as':_0x2e191d['as'],'attributes':_0x2e191d['attributes'],'include':_0x2e191d[_0x9e34('0x24')]?_[_0x9e34('0x25')](_0x2e191d['include'],function(_0x3aa304){return{'model':db[_0x3aa304[_0x9e34('0x26')]],'as':_0x3aa304['as'],'attributes':_0x3aa304[_0x9e34('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9e34('0x11')](function(_0x5d5273){logger['info']('ShowMailAccount',_0x34bbe2);logger['debug'](_0x9e34('0x28'),_0x34bbe2,JSON[_0x9e34('0x27')](_0x5d5273));_0x55ed83(_0x5d5273);})[_0x9e34('0x1b')](function(_0x319ff7){logger[_0x9e34('0x17')]('ShowMailAccount',_0x319ff7['message'],_0x34bbe2);_0x35ed30(_0x1d4120[_0x9e34('0x17')](0x1f4,_0x319ff7['message']));});});};exports['NotifyMailAccount']=function(_0x1c2115){var _0x88f947=this;return new Promise(function(_0x15b3ee,_0x3cf7da){var _0x2fbf63={'body':_0x1c2115[_0x9e34('0x29')],'channel':_0x9e34('0x2a')};var _0x4632d9=_[_0x9e34('0x2b')](_[_0x9e34('0x2c')](db[_0x9e34('0x2d')][_0x9e34('0x2e')]),[_0x9e34('0x2f'),_0x9e34('0x30'),_0x9e34('0x31'),_0x9e34('0x32')]);var _0x7ffc57=![];if(_0x1c2115[_0x9e34('0x29')]['id']){delete _0x1c2115[_0x9e34('0x29')]['id'];}if(_[_0x9e34('0x33')](_0x1c2115[_0x9e34('0x29')]['from'])){return _0x3cf7da(_0x88f947[_0x9e34('0x17')](0x1f4,_0x9e34('0x34')));}if(_[_0x9e34('0x33')](_0x1c2115[_0x9e34('0x29')][_0x9e34('0x29')])||_0x1c2115[_0x9e34('0x29')][_0x9e34('0x29')]===''){return _0x3cf7da(_0x88f947['error'](0x1f4,_0x9e34('0x35')));}if(_[_0x9e34('0x33')](_0x1c2115[_0x9e34('0x29')][_0x9e34('0x36')])){return _0x3cf7da(_0x88f947[_0x9e34('0x17')](0x1f4,_0x9e34('0x37')+_0x4632d9));}if(!_[_0x9e34('0x38')](_0x4632d9,_0x1c2115['body'][_0x9e34('0x36')])){return _0x3cf7da(_0x88f947['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4632d9));}var _0x592dd7={};_0x592dd7[_0x1c2115['body'][_0x9e34('0x36')]]=_0x1c2115['body'][_0x9e34('0x39')];return db[_0x9e34('0x1d')][_0x9e34('0x3a')]({'where':{'id':_0x1c2115['account']['id']},'include':[{'model':db['CmList'],'as':_0x9e34('0x3b'),'include':[{'model':db[_0x9e34('0x2d')],'as':_0x9e34('0x3c'),'where':_0x592dd7,'limit':0x1,'order':[[_0x9e34('0x30'),_0x9e34('0x3d')]]}]},{'model':db[_0x9e34('0x3e')],'as':_0x9e34('0x3f')},{'model':db[_0x9e34('0x40')],'as':_0x9e34('0x41')}]})[_0x9e34('0x11')](function(_0x3ab3f8){if(_0x3ab3f8&&_0x3ab3f8['List']){var _0x364b93=_0x3ab3f8[_0x9e34('0x42')]({'plain':!![]});_0x2fbf63['account']=_[_0x9e34('0x43')](_0x364b93,[_0x9e34('0x3f'),_0x9e34('0x3b')]);_0x2fbf63[_0x9e34('0x44')]=_0x364b93['Applications'];_0x2fbf63[_0x9e34('0x45')]=_0x364b93['List'];_0x2fbf63[_0x9e34('0x44')]=_[_0x9e34('0x46')](_0x2fbf63['applications'],[_0x9e34('0x47')],[_0x9e34('0x48')]);if(_0x2fbf63[_0x9e34('0x49')]&&_0x2fbf63[_0x9e34('0x49')]['autoclose']){_0x2fbf63[_0x9e34('0x44')][_0x9e34('0x4a')]({'id':0x0,'priority':_0x2fbf63[_0x9e34('0x44')][_0x9e34('0x4b')]+0x1,'app':'close','appdata':_0x9e34('0x4c'),'interval':_0x9e34('0x4d')});}if(_0x2fbf63[_0x9e34('0x49')][_0x9e34('0x3f')]){delete _0x2fbf63['account']['Applications'];}if(_0x2fbf63[_0x9e34('0x49')][_0x9e34('0x3b')]){delete _0x2fbf63[_0x9e34('0x49')][_0x9e34('0x3b')];}if(_0x364b93[_0x9e34('0x3b')][_0x9e34('0x3c')][_0x9e34('0x4b')]){return _0x364b93['List'][_0x9e34('0x3c')][0x0];}var _0x12b034=_[_0x9e34('0xb')](_0x1c2115['body'],{'firstName':_0x1c2115['body']['from'],'ListId':_0x364b93['ListId']});_0x12b034[_0x1c2115['body']['mapKey']]=_0x1c2115[_0x9e34('0x29')][_0x9e34('0x39')];return db[_0x9e34('0x2d')][_0x9e34('0x4e')](_0x12b034);}else{throw new Error('List\x20not\x20found');}})[_0x9e34('0x11')](function(_0x541c73){_0x2fbf63[_0x9e34('0x4f')]=_0x541c73;if(_0x541c73){if(!_0x1c2115['body'][_0x9e34('0x19')][_0x9e34('0x50')]){_0x1c2115[_0x9e34('0x29')][_0x9e34('0x19')][_0x9e34('0x50')]=rs[_0x9e34('0x51')]()+'\x20'+_0x1c2115[_0x9e34('0x29')][_0x9e34('0x19')][_0x9e34('0x39')];}var _0x26cb98={'ContactId':_0x541c73['id'],'MailAccountId':_0x1c2115[_0x9e34('0x49')]['id'],'inReplyTo':_0x1c2115[_0x9e34('0x29')][_0x9e34('0x19')][_0x9e34('0x50')],'to':_0x1c2115[_0x9e34('0x29')]['message']['from'],'cc':_0x1c2115[_0x9e34('0x29')][_0x9e34('0x19')]['cc'],'subject':_0x1c2115['body'][_0x9e34('0x19')][_0x9e34('0x52')],'attach':_0x1c2115[_0x9e34('0x29')][_0x9e34('0x19')][_0x9e34('0x53')],'lastMsgAt':moment()['format'](_0x9e34('0x54')),'lastMsgDirection':'in','lastMsgBody':_0x1c2115['body'][_0x9e34('0x29')]};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x1c2115[_0x9e34('0x49')]['id']},'include':[{'model':db[_0x9e34('0x55')],'as':'Messages','attributes':[_0x9e34('0x50')],'where':{'messageId':_0x1c2115[_0x9e34('0x29')][_0x9e34('0x19')][_0x9e34('0x56')]}}]})[_0x9e34('0x11')](function(_0x58947a){if(_0x58947a){return[_0x58947a,![]];}return db[_0x9e34('0x57')][_0x9e34('0x4e')](_0x26cb98)[_0x9e34('0x11')](function(_0x266c85){return[_0x266c85,!![]];});});}else{throw new Error(_0x9e34('0x58'));}})[_0x9e34('0x59')](function(_0x4ae9fd,_0x2608cd){if(_0x4ae9fd){_0x7ffc57=_0x2608cd;if(!_0x2608cd){return _0x4ae9fd[_0x9e34('0x5a')]({'inReplyTo':_0x1c2115[_0x9e34('0x29')][_0x9e34('0x19')][_0x9e34('0x50')],'to':_0x1c2115[_0x9e34('0x29')][_0x9e34('0x19')][_0x9e34('0x39')],'cc':_0x1c2115[_0x9e34('0x29')]['message']['cc'],'subject':_0x1c2115['body'][_0x9e34('0x19')][_0x9e34('0x52')],'attach':_0x4ae9fd[_0x9e34('0x53')]?_0x4ae9fd[_0x9e34('0x53')]:_0x1c2115['body'][_0x9e34('0x19')]['attach'],'substatus':null,'substatusAt':moment()[_0x9e34('0x5b')](_0x9e34('0x54')),'lastMsgAt':moment()[_0x9e34('0x5b')](_0x9e34('0x54')),'lastMsgDirection':'in','lastMsgBody':_0x1c2115[_0x9e34('0x29')][_0x9e34('0x29')]});}else{return _0x4ae9fd;}}})[_0x9e34('0x11')](function(_0x4a775f){_0x2fbf63[_0x9e34('0x5c')]=_0x4a775f[_0x9e34('0x42')]({'plain':!![]});_0x2fbf63[_0x9e34('0x5c')][_0x9e34('0x5d')]=_0x7ffc57;return db['MailMessage'][_0x9e34('0x4e')]({'body':_0x1c2115[_0x9e34('0x29')][_0x9e34('0x29')],'MailAccountId':_0x1c2115[_0x9e34('0x49')]['id'],'MailInteractionId':_0x4a775f['id'],'direction':'in','ContactId':_0x2fbf63['contact']['id'],'messageId':_0x1c2115[_0x9e34('0x29')][_0x9e34('0x19')][_0x9e34('0x50')],'from':_0x1c2115[_0x9e34('0x29')]['message']['from'],'to':_0x1c2115['body'][_0x9e34('0x19')]['to'],'cc':_0x1c2115[_0x9e34('0x29')][_0x9e34('0x19')]['cc'],'subject':_0x1c2115[_0x9e34('0x29')][_0x9e34('0x19')]['subject'],'attach':_0x1c2115[_0x9e34('0x29')][_0x9e34('0x19')][_0x9e34('0x53')],'Attachments':_0x1c2115[_0x9e34('0x29')][_0x9e34('0x19')][_0x9e34('0x5e')],'originTo':_0x1c2115[_0x9e34('0x29')][_0x9e34('0x19')][_0x9e34('0x5f')],'originCc':_0x1c2115[_0x9e34('0x29')]['message'][_0x9e34('0x60')],'bcc':_0x1c2115[_0x9e34('0x29')]['message'][_0x9e34('0x61')]},{'include':[{'model':db['Attachment'],'as':_0x9e34('0x62')}]});})['then'](function(_0x2918b1){_0x2fbf63[_0x9e34('0x19')]=_0x2918b1;if(_0x2fbf63[_0x9e34('0x5c')][_0x9e34('0x63')]){return db[_0x9e34('0x64')][_0x9e34('0x3a')]({'attributes':['id',_0x9e34('0x65')],'where':{'id':_0x2fbf63[_0x9e34('0x5c')]['UserId']}})[_0x9e34('0x11')](function(_0x4d757b){if(_0x4d757b){_0x2fbf63['applications'][_0x9e34('0x66')]({'id':0x0,'priority':0x0,'app':_0x9e34('0x67'),'appdata':_0x4d757b[_0x9e34('0x65')]+','+(_0x2fbf63[_0x9e34('0x49')][_0x9e34('0x68')]||0xa),'interval':_0x9e34('0x4d')});}return respondWithRpcPromise('Start',_0x9e34('0x69'),_0x2fbf63);});}return respondWithRpcPromise('Start',_0x9e34('0x69'),_0x2fbf63);})[_0x9e34('0x11')](function(_0xc54a0d){_0x15b3ee(_0xc54a0d);})['catch'](function(_0x4f1970){_0x3cf7da(_0x88f947[_0x9e34('0x17')](0x1f4,_0x4f1970[_0x9e34('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index e9b39ae..4af710d 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 _0x105f=['removeListener','register','length','mailAccount:','./mailAccount.events','save','emit'];(function(_0x1a6422,_0x18db7a){var _0x3a9818=function(_0x53985a){while(--_0x53985a){_0x1a6422['push'](_0x1a6422['shift']());}};_0x3a9818(++_0x18db7a);}(_0x105f,0x97));var _0xf105=function(_0x5c316c,_0x2722ca){_0x5c316c=_0x5c316c-0x0;var _0x4e03b3=_0x105f[_0x5c316c];return _0x4e03b3;};'use strict';var MailAccountEvents=require(_0xf105('0x0'));var events=[_0xf105('0x1'),'remove','update'];function createListener(_0x334cdd,_0x1ad07e){return function(_0x5193c3){_0x1ad07e[_0xf105('0x2')](_0x334cdd,_0x5193c3);};}function removeListener(_0x281d98,_0x350a6c){return function(){MailAccountEvents[_0xf105('0x3')](_0x281d98,_0x350a6c);};}exports[_0xf105('0x4')]=function(_0x5bffb1){for(var _0x5e3c02=0x0,_0x320d4e=events[_0xf105('0x5')];_0x5e3c02<_0x320d4e;_0x5e3c02++){var _0x5ad4a5=events[_0x5e3c02];var _0x3cbcb9=createListener(_0xf105('0x6')+_0x5ad4a5,_0x5bffb1);MailAccountEvents['on'](_0x5ad4a5,_0x3cbcb9);}}; \ No newline at end of file +var _0xed82=['length','mailAccount:','./mailAccount.events','remove','update','emit','removeListener','register'];(function(_0x3fc97b,_0x20ca29){var _0x3a0c82=function(_0x1c15ec){while(--_0x1c15ec){_0x3fc97b['push'](_0x3fc97b['shift']());}};_0x3a0c82(++_0x20ca29);}(_0xed82,0x82));var _0x2ed8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xed82[_0x2641f9];return _0x585741;};'use strict';var MailAccountEvents=require(_0x2ed8('0x0'));var events=['save',_0x2ed8('0x1'),_0x2ed8('0x2')];function createListener(_0x16660c,_0x15abc2){return function(_0x26583b){_0x15abc2[_0x2ed8('0x3')](_0x16660c,_0x26583b);};}function removeListener(_0x46d38e,_0x18bc03){return function(){MailAccountEvents[_0x2ed8('0x4')](_0x46d38e,_0x18bc03);};}exports[_0x2ed8('0x5')]=function(_0x3d7fa5){for(var _0xa40dc2=0x0,_0x2cf215=events[_0x2ed8('0x6')];_0xa40dc2<_0x2cf215;_0xa40dc2++){var _0x25cc75=events[_0xa40dc2];var _0x39999c=createListener(_0x2ed8('0x7')+_0x25cc75,_0x3d7fa5);MailAccountEvents['on'](_0x25cc75,_0x39999c);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 3efe4c5..b6a9d1d 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 _0x2504=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','show','isAuthenticated','update','delete','exports'];(function(_0x268ad0,_0x50c35b){var _0x4619ea=function(_0x51b35f){while(--_0x51b35f){_0x268ad0['push'](_0x268ad0['shift']());}};_0x4619ea(++_0x50c35b);}(_0x2504,0xee));var _0x4250=function(_0x394afa,_0x2c32b9){_0x394afa=_0x394afa-0x0;var _0x5c4033=_0x2504[_0x394afa];return _0x5c4033;};'use strict';var multer=require(_0x4250('0x0'));var util=require(_0x4250('0x1'));var path=require(_0x4250('0x2'));var timeout=require(_0x4250('0x3'));var express=require(_0x4250('0x4'));var router=express[_0x4250('0x5')]();var auth=require(_0x4250('0x6'));var interaction=require(_0x4250('0x7'));var config=require(_0x4250('0x8'));var controller=require(_0x4250('0x9'));router[_0x4250('0xa')](_0x4250('0xb'),auth['isAuthenticated'](),controller[_0x4250('0xc')]);router['put']('/:id',auth[_0x4250('0xd')](),controller[_0x4250('0xe')]);router[_0x4250('0xf')](_0x4250('0xb'),auth[_0x4250('0xd')](),controller['destroy']);module[_0x4250('0x10')]=router; \ No newline at end of file +var _0xa8a8=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','exports','multer','util'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0xa8a8,0xec));var _0x8a8a=function(_0x354022,_0x25e706){_0x354022=_0x354022-0x0;var _0x320713=_0xa8a8[_0x354022];return _0x320713;};'use strict';var multer=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var path=require(_0x8a8a('0x2'));var timeout=require(_0x8a8a('0x3'));var express=require('express');var router=express[_0x8a8a('0x4')]();var auth=require(_0x8a8a('0x5'));var interaction=require(_0x8a8a('0x6'));var config=require(_0x8a8a('0x7'));var controller=require(_0x8a8a('0x8'));router[_0x8a8a('0x9')](_0x8a8a('0xa'),auth[_0x8a8a('0xb')](),controller[_0x8a8a('0xc')]);router[_0x8a8a('0xd')](_0x8a8a('0xa'),auth[_0x8a8a('0xb')](),controller[_0x8a8a('0xe')]);router[_0x8a8a('0xf')](_0x8a8a('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x8a8a('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index ef06d5d..acee85c 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 _0x63a6=['INTEGER','noop','TEXT','STRING','*,*,*,*','exports'];(function(_0x110243,_0x7d052c){var _0x2fd841=function(_0x144345){while(--_0x144345){_0x110243['push'](_0x110243['shift']());}};_0x2fd841(++_0x7d052c);}(_0x63a6,0x1c7));var _0x663a=function(_0x350796,_0x1bf21f){_0x350796=_0x350796-0x0;var _0x126f19=_0x63a6[_0x350796];return _0x126f19;};'use strict';var Sequelize=require('sequelize');module[_0x663a('0x0')]={'priority':{'type':Sequelize[_0x663a('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x663a('0x2')},'appdata':{'type':Sequelize[_0x663a('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x663a('0x4')],'defaultValue':_0x663a('0x5')}}; \ No newline at end of file +var _0xf347=['*,*,*,*','sequelize','exports','STRING','TEXT'];(function(_0x49520e,_0x4ff3c1){var _0x3125a3=function(_0x14a903){while(--_0x14a903){_0x49520e['push'](_0x49520e['shift']());}};_0x3125a3(++_0x4ff3c1);}(_0xf347,0xa1));var _0x7f34=function(_0x1a2946,_0x247b0d){_0x1a2946=_0x1a2946-0x0;var _0x411b10=_0xf347[_0x1a2946];return _0x411b10;};'use strict';var Sequelize=require(_0x7f34('0x0'));module[_0x7f34('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x7f34('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7f34('0x3')]()},'description':{'type':Sequelize[_0x7f34('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7f34('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 0e148df..71f3fac 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Content-Range','apply','reject','save','then','error','stack','send','show','params','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','model','fields','length','includeAll','merge','find','catch','body','destroy','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x3c94a2,_0x435bd6){var _0x335592=function(_0x128341){while(--_0x128341){_0x3c94a2['push'](_0x3c94a2['shift']());}};_0x335592(++_0x435bd6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var authService=require(_0x0a9e('0xe'));var hardwareService=require(_0x0a9e('0xf'));var Redis=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xcc;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x13')](_0x36471c);}return _0x273d4d[_0x0a9e('0x14')](_0x36471c)[_0x0a9e('0x15')]();};}function respondWithResult(_0x5db4b0,_0x4283ce){_0x4283ce=_0x4283ce||0xc8;return function(_0x239b12){if(_0x239b12){return _0x5db4b0[_0x0a9e('0x14')](_0x4283ce)[_0x0a9e('0x16')](_0x239b12);}};}function respondWithFilteredResult(_0x44dcfd,_0x4d5611){return function(_0x52a03d){if(_0x52a03d){var _0x22dccb=_0x52a03d[_0x0a9e('0x17')],_0x5d0880=_0x4d5611[_0x0a9e('0x18')],_0x1985b6=_0x4d5611['offset']+_0x4d5611[_0x0a9e('0x19')],_0x519dfd;if(_0x1985b6>=_0x22dccb){_0x1985b6=_0x22dccb;_0x519dfd=0xc8;}else{_0x519dfd=0xce;}_0x44dcfd['status'](_0x519dfd);return _0x44dcfd[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5d0880+'-'+_0x1985b6+'/'+_0x22dccb)[_0x0a9e('0x16')](_0x52a03d);}return null;};}function patchUpdates(_0x205fd6){return function(_0x31b1ca){try{jsonpatch[_0x0a9e('0x1c')](_0x31b1ca,_0x205fd6,!![]);}catch(_0x530eb7){return BPromise[_0x0a9e('0x1d')](_0x530eb7);}return _0x31b1ca[_0x0a9e('0x1e')]();};}function saveUpdates(_0x112016,_0x1c696a){return function(_0x105080){if(_0x105080){return _0x105080['update'](_0x112016)[_0x0a9e('0x1f')](function(_0x155cce){return _0x155cce;});}return null;};}function removeEntity(_0x53682f,_0x20f109){return function(_0x5a09ef){if(_0x5a09ef){return _0x5a09ef['destroy']()[_0x0a9e('0x1f')](function(){_0x53682f[_0x0a9e('0x14')](0xcc)[_0x0a9e('0x15')]();});}};}function handleEntityNotFound(_0x30bae6,_0x4abc77){return function(_0xfb6e48){if(!_0xfb6e48){_0x30bae6[_0x0a9e('0x13')](0x194);}return _0xfb6e48;};}function handleError(_0x3b45bc,_0x4d00e6){_0x4d00e6=_0x4d00e6||0x1f4;return function(_0x370d86){logger[_0x0a9e('0x20')](_0x370d86[_0x0a9e('0x21')]);if(_0x370d86['name']){delete _0x370d86['name'];}_0x3b45bc[_0x0a9e('0x14')](_0x4d00e6)[_0x0a9e('0x22')](_0x370d86);};}exports[_0x0a9e('0x23')]=function(_0x33161b,_0x526cf3){var _0x384319={'raw':!![],'where':{'id':_0x33161b[_0x0a9e('0x24')]['id']}},_0x479bc4={};_0x479bc4['model']=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x479bc4[_0x0a9e('0x28')]=_[_0x0a9e('0x25')](_0x33161b[_0x0a9e('0x28')]);_0x479bc4[_0x0a9e('0x29')]=_[_0x0a9e('0x2a')](_0x479bc4['model'],_0x479bc4[_0x0a9e('0x28')]);_0x384319[_0x0a9e('0x2b')]=_[_0x0a9e('0x2a')](_0x479bc4[_0x0a9e('0x2c')],qs['fields'](_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x2d')]));_0x384319[_0x0a9e('0x2b')]=_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x2e')]?_0x384319[_0x0a9e('0x2b')]:_0x479bc4[_0x0a9e('0x2c')];if(_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x2f')]){_0x384319['include']=[{'all':!![]}];}_0x384319=_[_0x0a9e('0x30')]({},_0x384319,_0x33161b['options']);return db[_0x0a9e('0x26')][_0x0a9e('0x31')](_0x384319)[_0x0a9e('0x1f')](handleEntityNotFound(_0x526cf3,null))[_0x0a9e('0x1f')](respondWithResult(_0x526cf3,null))[_0x0a9e('0x32')](handleError(_0x526cf3,null));};exports['update']=function(_0x66c1d2,_0x46f0a5){if(_0x66c1d2[_0x0a9e('0x33')]['id']){delete _0x66c1d2[_0x0a9e('0x33')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x31')]({'where':{'id':_0x66c1d2[_0x0a9e('0x24')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x46f0a5,null))['then'](saveUpdates(_0x66c1d2[_0x0a9e('0x33')],null))['then'](respondWithResult(_0x46f0a5,null))[_0x0a9e('0x32')](handleError(_0x46f0a5,null));};exports[_0x0a9e('0x34')]=function(_0x2b7e7f,_0x3f3d41){return db['MailApplication'][_0x0a9e('0x31')]({'where':{'id':_0x2b7e7f[_0x0a9e('0x24')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x3f3d41,null))[_0x0a9e('0x1f')](removeEntity(_0x3f3d41,null))['catch'](handleError(_0x3f3d41,null));}; \ No newline at end of file +var _0xa9e0=['Content-Range','apply','reject','save','then','error','stack','send','show','params','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','model','fields','length','includeAll','merge','find','catch','body','destroy','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x36c337,_0x4a5fed){var _0x36a8f0=function(_0x3d61d3){while(--_0x3d61d3){_0x36c337['push'](_0x36c337['shift']());}};_0x36a8f0(++_0x4a5fed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var authService=require(_0x0a9e('0xe'));var hardwareService=require(_0x0a9e('0xf'));var Redis=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xcc;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x13')](_0x36471c);}return _0x273d4d[_0x0a9e('0x14')](_0x36471c)[_0x0a9e('0x15')]();};}function respondWithResult(_0x5db4b0,_0x4283ce){_0x4283ce=_0x4283ce||0xc8;return function(_0x239b12){if(_0x239b12){return _0x5db4b0[_0x0a9e('0x14')](_0x4283ce)[_0x0a9e('0x16')](_0x239b12);}};}function respondWithFilteredResult(_0x44dcfd,_0x4d5611){return function(_0x52a03d){if(_0x52a03d){var _0x22dccb=_0x52a03d[_0x0a9e('0x17')],_0x5d0880=_0x4d5611[_0x0a9e('0x18')],_0x1985b6=_0x4d5611['offset']+_0x4d5611[_0x0a9e('0x19')],_0x519dfd;if(_0x1985b6>=_0x22dccb){_0x1985b6=_0x22dccb;_0x519dfd=0xc8;}else{_0x519dfd=0xce;}_0x44dcfd['status'](_0x519dfd);return _0x44dcfd[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5d0880+'-'+_0x1985b6+'/'+_0x22dccb)[_0x0a9e('0x16')](_0x52a03d);}return null;};}function patchUpdates(_0x205fd6){return function(_0x31b1ca){try{jsonpatch[_0x0a9e('0x1c')](_0x31b1ca,_0x205fd6,!![]);}catch(_0x530eb7){return BPromise[_0x0a9e('0x1d')](_0x530eb7);}return _0x31b1ca[_0x0a9e('0x1e')]();};}function saveUpdates(_0x112016,_0x1c696a){return function(_0x105080){if(_0x105080){return _0x105080['update'](_0x112016)[_0x0a9e('0x1f')](function(_0x155cce){return _0x155cce;});}return null;};}function removeEntity(_0x53682f,_0x20f109){return function(_0x5a09ef){if(_0x5a09ef){return _0x5a09ef['destroy']()[_0x0a9e('0x1f')](function(){_0x53682f[_0x0a9e('0x14')](0xcc)[_0x0a9e('0x15')]();});}};}function handleEntityNotFound(_0x30bae6,_0x4abc77){return function(_0xfb6e48){if(!_0xfb6e48){_0x30bae6[_0x0a9e('0x13')](0x194);}return _0xfb6e48;};}function handleError(_0x3b45bc,_0x4d00e6){_0x4d00e6=_0x4d00e6||0x1f4;return function(_0x370d86){logger[_0x0a9e('0x20')](_0x370d86[_0x0a9e('0x21')]);if(_0x370d86['name']){delete _0x370d86['name'];}_0x3b45bc[_0x0a9e('0x14')](_0x4d00e6)[_0x0a9e('0x22')](_0x370d86);};}exports[_0x0a9e('0x23')]=function(_0x33161b,_0x526cf3){var _0x384319={'raw':!![],'where':{'id':_0x33161b[_0x0a9e('0x24')]['id']}},_0x479bc4={};_0x479bc4['model']=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x479bc4[_0x0a9e('0x28')]=_[_0x0a9e('0x25')](_0x33161b[_0x0a9e('0x28')]);_0x479bc4[_0x0a9e('0x29')]=_[_0x0a9e('0x2a')](_0x479bc4['model'],_0x479bc4[_0x0a9e('0x28')]);_0x384319[_0x0a9e('0x2b')]=_[_0x0a9e('0x2a')](_0x479bc4[_0x0a9e('0x2c')],qs['fields'](_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x2d')]));_0x384319[_0x0a9e('0x2b')]=_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x2e')]?_0x384319[_0x0a9e('0x2b')]:_0x479bc4[_0x0a9e('0x2c')];if(_0x33161b[_0x0a9e('0x28')][_0x0a9e('0x2f')]){_0x384319['include']=[{'all':!![]}];}_0x384319=_[_0x0a9e('0x30')]({},_0x384319,_0x33161b['options']);return db[_0x0a9e('0x26')][_0x0a9e('0x31')](_0x384319)[_0x0a9e('0x1f')](handleEntityNotFound(_0x526cf3,null))[_0x0a9e('0x1f')](respondWithResult(_0x526cf3,null))[_0x0a9e('0x32')](handleError(_0x526cf3,null));};exports['update']=function(_0x66c1d2,_0x46f0a5){if(_0x66c1d2[_0x0a9e('0x33')]['id']){delete _0x66c1d2[_0x0a9e('0x33')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x31')]({'where':{'id':_0x66c1d2[_0x0a9e('0x24')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x46f0a5,null))['then'](saveUpdates(_0x66c1d2[_0x0a9e('0x33')],null))['then'](respondWithResult(_0x46f0a5,null))[_0x0a9e('0x32')](handleError(_0x46f0a5,null));};exports[_0x0a9e('0x34')]=function(_0x2b7e7f,_0x3f3d41){return db['MailApplication'][_0x0a9e('0x31')]({'where':{'id':_0x2b7e7f[_0x0a9e('0x24')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x3f3d41,null))[_0x0a9e('0x1f')](removeEntity(_0x3f3d41,null))['catch'](handleError(_0x3f3d41,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index dc44acd..4f01a66 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 _0xe9b0=['./mailApplication.attributes','exports','define','MailApplication','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x52636a,_0x2998c9){var _0x4b15ae=function(_0xb9a48b){while(--_0xb9a48b){_0x52636a['push'](_0x52636a['shift']());}};_0x4b15ae(++_0x2998c9);}(_0xe9b0,0x1e4));var _0x0e9b=function(_0x151926,_0x1c66fb){_0x151926=_0x151926-0x0;var _0x3a2182=_0xe9b0[_0x151926];return _0x3a2182;};'use strict';var _=require(_0x0e9b('0x0'));var util=require(_0x0e9b('0x1'));var logger=require(_0x0e9b('0x2'))(_0x0e9b('0x3'));var moment=require(_0x0e9b('0x4'));var BPromise=require('bluebird');var rp=require(_0x0e9b('0x5'));var attributes=require(_0x0e9b('0x6'));module[_0x0e9b('0x7')]=function(_0xa1426e,_0xf2512b){return _0xa1426e[_0x0e9b('0x8')](_0x0e9b('0x9'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x044a=['util','../../config/logger','api','moment','bluebird','request-promise','./mailApplication.attributes','exports','define','MailApplication','mail_applications','lodash'];(function(_0x44a970,_0x2b9f20){var _0x71c8e0=function(_0xd7d3c5){while(--_0xd7d3c5){_0x44a970['push'](_0x44a970['shift']());}};_0x71c8e0(++_0x2b9f20);}(_0x044a,0x173));var _0xa044=function(_0xc622fe,_0x24368d){_0xc622fe=_0xc622fe-0x0;var _0x44c1d9=_0x044a[_0xc622fe];return _0x44c1d9;};'use strict';var _=require(_0xa044('0x0'));var util=require(_0xa044('0x1'));var logger=require(_0xa044('0x2'))(_0xa044('0x3'));var moment=require(_0xa044('0x4'));var BPromise=require(_0xa044('0x5'));var rp=require(_0xa044('0x6'));var attributes=require(_0xa044('0x7'));module[_0xa044('0x8')]=function(_0x116358,_0x566ddf){return _0x116358[_0xa044('0x9')](_0xa044('0xa'),attributes,{'tableName':_0xa044('0xb'),'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 5071060..34f6125 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 _0x9957=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','update','options','raw','attributes','limit','lodash','util','moment'];(function(_0x2fd947,_0x5da260){var _0x5228eb=function(_0x4c2d5c){while(--_0x4c2d5c){_0x2fd947['push'](_0x2fd947['shift']());}};_0x5228eb(++_0x5da260);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['MailApplication'][_0x7995('0x19')](_0x291317['body'],{'raw':_0x291317['options']?_0x291317[_0x7995('0x1a')][_0x7995('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x291317['options']?_0x291317[_0x7995('0x1a')]['where']||null:null,'attributes':_0x291317['options']?_0x291317[_0x7995('0x1a')][_0x7995('0x1c')]||null:null,'limit':_0x291317[_0x7995('0x1a')]?_0x291317[_0x7995('0x1a')][_0x7995('0x1d')]||null:null})[_0x7995('0xc')](function(_0x5d40ae){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x5d40ae));_0x37a7d4(_0x5d40ae);})[_0x7995('0x17')](function(_0x475351){logger[_0x7995('0x13')]('UpdateMailApplication',_0x475351[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x475351[_0x7995('0x15')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','MailApplication','update','body','options','raw','where','attributes','limit','then','UpdateMailApplication','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailApplication,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x2ed711,_0x5dcf7a){var _0x3ccadf=function(_0x1e4197){while(--_0x1e4197){_0x2ed711['push'](_0x2ed711['shift']());}};_0x3ccadf(++_0x5dcf7a);}(_0x7a54,0x106));var _0x47a5=function(_0x195962,_0x13f7cf){_0x195962=_0x195962-0x0;var _0x15d373=_0x7a54[_0x195962];return _0x15d373;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['UpdateMailApplication']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5247fd['options']?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x1a')]||null:null,'attributes':_0x5247fd['options']?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x1b')]||null:null,'limit':_0x5247fd[_0x47a5('0x18')]?_0x5247fd['options'][_0x47a5('0x1c')]||null:null})[_0x47a5('0x1d')](function(_0x23db32){logger[_0x47a5('0xb')]('UpdateMailApplication',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON['stringify'](_0x23db32));_0xaf70a6(_0x23db32);})[_0x47a5('0x14')](function(_0xc4cd63){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0xc4cd63[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xc4cd63['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 2bf01b8..5e700d9 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 _0x7241=['index','get','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','delete','mailinteraction:destroy','destroy','/:id/tags','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./mailInteraction.controller','isAuthenticated'];(function(_0x458c52,_0x5e3fb4){var _0x43f43b=function(_0x5cdfeb){while(--_0x5cdfeb){_0x458c52['push'](_0x458c52['shift']());}};_0x43f43b(++_0x5e3fb4);}(_0x7241,0x1aa));var _0x1724=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x7241[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x1724('0x0'));var util=require(_0x1724('0x1'));var path=require('path');var timeout=require(_0x1724('0x2'));var express=require('express');var router=express[_0x1724('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1724('0x4'));var config=require(_0x1724('0x5'));var controller=require(_0x1724('0x6'));router['get']('/',auth[_0x1724('0x7')](),controller[_0x1724('0x8')]);router[_0x1724('0x9')](_0x1724('0xa'),auth[_0x1724('0x7')](),controller[_0x1724('0xb')]);router[_0x1724('0x9')](_0x1724('0xc'),auth['isAuthenticated'](),controller[_0x1724('0xd')]);router['get'](_0x1724('0xe'),auth['isAuthenticated'](),controller[_0x1724('0xf')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x1724('0x10')]);router[_0x1724('0x11')]('/',auth[_0x1724('0x7')](),controller[_0x1724('0x12')]);router['post']('/:id/messages',auth[_0x1724('0x7')](),controller[_0x1724('0x13')]);router[_0x1724('0x11')]('/:id/tags',auth[_0x1724('0x7')](),interaction[_0x1724('0x14')](_0x1724('0x15'),_0x1724('0x16')),controller[_0x1724('0x17')]);router[_0x1724('0x18')]('/:id',auth['isAuthenticated'](),interaction[_0x1724('0x14')](_0x1724('0x15'),_0x1724('0x19')),controller['update']);router[_0x1724('0x1a')](_0x1724('0xc'),auth['isAuthenticated'](),interaction[_0x1724('0x14')](_0x1724('0x15'),_0x1724('0x1b')),controller[_0x1724('0x1c')]);router['delete'](_0x1724('0x1d'),auth[_0x1724('0x7')](),controller['removeTags']);module[_0x1724('0x1e')]=router; \ No newline at end of file +var _0xa1c5=['/:id/download','addMessage','post','/:id/tags','mailinteraction:addtags','addTags','put','tracked','mail','update','delete','/:id','mailinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages'];(function(_0x25a42a,_0x3d489b){var _0x1129b1=function(_0x4ae61b){while(--_0x4ae61b){_0x25a42a['push'](_0x25a42a['shift']());}};_0x1129b1(++_0x3d489b);}(_0xa1c5,0x1bd));var _0x5a1c=function(_0x38d5a6,_0x6069a9){_0x38d5a6=_0x38d5a6-0x0;var _0x3e4e56=_0xa1c5[_0x38d5a6];return _0x3e4e56;};'use strict';var multer=require(_0x5a1c('0x0'));var util=require('util');var path=require(_0x5a1c('0x1'));var timeout=require(_0x5a1c('0x2'));var express=require(_0x5a1c('0x3'));var router=express[_0x5a1c('0x4')]();var auth=require(_0x5a1c('0x5'));var interaction=require(_0x5a1c('0x6'));var config=require(_0x5a1c('0x7'));var controller=require(_0x5a1c('0x8'));router[_0x5a1c('0x9')]('/',auth[_0x5a1c('0xa')](),controller[_0x5a1c('0xb')]);router[_0x5a1c('0x9')](_0x5a1c('0xc'),auth['isAuthenticated'](),controller[_0x5a1c('0xd')]);router['get']('/:id',auth[_0x5a1c('0xa')](),controller[_0x5a1c('0xe')]);router[_0x5a1c('0x9')](_0x5a1c('0xf'),auth['isAuthenticated'](),controller[_0x5a1c('0x10')]);router[_0x5a1c('0x9')](_0x5a1c('0x11'),auth[_0x5a1c('0xa')](),controller['download']);router['post']('/',auth[_0x5a1c('0xa')](),controller['create']);router['post']('/:id/messages',auth[_0x5a1c('0xa')](),controller[_0x5a1c('0x12')]);router[_0x5a1c('0x13')](_0x5a1c('0x14'),auth[_0x5a1c('0xa')](),interaction['tracked']('mail',_0x5a1c('0x15')),controller[_0x5a1c('0x16')]);router[_0x5a1c('0x17')]('/:id',auth[_0x5a1c('0xa')](),interaction[_0x5a1c('0x18')](_0x5a1c('0x19'),'mailinteraction:update'),controller[_0x5a1c('0x1a')]);router[_0x5a1c('0x1b')](_0x5a1c('0x1c'),auth['isAuthenticated'](),interaction[_0x5a1c('0x18')](_0x5a1c('0x19'),_0x5a1c('0x1d')),controller[_0x5a1c('0x1e')]);router[_0x5a1c('0x1b')]('/:id/tags',auth[_0x5a1c('0xa')](),controller[_0x5a1c('0x1f')]);module[_0x5a1c('0x20')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index beebc2c..2241c49 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 _0x41f2=['split','slice','sequelize','html-to-text','iconv','exports','BOOLEAN','STRING','TEXT','long','DATE','out','ENUM','getDataValue','lastMsgBody','fromString'];(function(_0x2a9202,_0x5e68cb){var _0x316625=function(_0x4ae297){while(--_0x4ae297){_0x2a9202['push'](_0x2a9202['shift']());}};_0x316625(++_0x5e68cb);}(_0x41f2,0x132));var _0x241f=function(_0x28c0e0,_0x28bd3d){_0x28c0e0=_0x28c0e0-0x0;var _0x5c3bbb=_0x41f2[_0x28c0e0];return _0x5c3bbb;};'use strict';var Sequelize=require(_0x241f('0x0'));var htmlToText=require(_0x241f('0x1'));var iconv=require(_0x241f('0x2'));module[_0x241f('0x3')]={'closed':{'type':Sequelize[_0x241f('0x4')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x241f('0x5')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x241f('0x5')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x241f('0x6')](_0x241f('0x7'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x241f('0x4')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x241f('0x8')]},'substatus':{'type':Sequelize[_0x241f('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x241f('0x8')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x241f('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x241f('0xa')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT'](_0x241f('0x7')),'get':function(){try{return this[_0x241f('0xb')](_0x241f('0xc'))?htmlToText[_0x241f('0xd')](this[_0x241f('0xb')](_0x241f('0xc')),{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'ignoreImage':!![]})[_0x241f('0xe')]('\x0a')[_0x241f('0xf')](0x0,0x6)['join']('\x0a'):null;}catch(_0x30680b){return null;}}}}; \ No newline at end of file +var _0x3dcd=['out','getDataValue','lastMsgBody','fromString','split','slice','join','sequelize','html-to-text','iconv','BOOLEAN','DATE','STRING','TEXT','long','ENUM'];(function(_0x23b5ab,_0x1efa72){var _0x3f808f=function(_0x4d226a){while(--_0x4d226a){_0x23b5ab['push'](_0x23b5ab['shift']());}};_0x3f808f(++_0x1efa72);}(_0x3dcd,0x197));var _0xd3dc=function(_0x536c66,_0x570b6b){_0x536c66=_0x536c66-0x0;var _0x221d57=_0x3dcd[_0x536c66];return _0x221d57;};'use strict';var Sequelize=require(_0xd3dc('0x0'));var htmlToText=require(_0xd3dc('0x1'));var iconv=require(_0xd3dc('0x2'));module['exports']={'closed':{'type':Sequelize[_0xd3dc('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd3dc('0x4')]},'disposition':{'type':Sequelize[_0xd3dc('0x5')]},'note':{'type':Sequelize[_0xd3dc('0x5')]},'inReplyTo':{'type':Sequelize[_0xd3dc('0x5')](0x1fe)},'to':{'type':Sequelize[_0xd3dc('0x5')]},'cc':{'type':Sequelize[_0xd3dc('0x6')](_0xd3dc('0x7'))},'subject':{'type':Sequelize[_0xd3dc('0x6')]()},'attach':{'type':Sequelize[_0xd3dc('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xd3dc('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xd3dc('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xd3dc('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd3dc('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xd3dc('0x8')]('in',_0xd3dc('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xd3dc('0x6')]('long'),'get':function(){try{return this[_0xd3dc('0xa')](_0xd3dc('0xb'))?htmlToText[_0xd3dc('0xc')](this[_0xd3dc('0xa')](_0xd3dc('0xb')),{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'ignoreImage':!![]})[_0xd3dc('0xd')]('\x0a')[_0xd3dc('0xe')](0x0,0x6)[_0xd3dc('0xf')]('\x0a'):null;}catch(_0x75c732){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 972f87c..0611e9e 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 _0x0b0e=['unlinkSync','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','json','offset','set','apply','reject','save','then','destroy','status','error','stack','name','index','MailInteraction','rawAttributes','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','map','type','VIRTUAL','field','merge','options','include','tag','push','Tags','distinct','read','MailMessage','Messages','direction','createdAt','count','User','Users','fullname','Owner','internal','MailAccount','Account','key','color','Tag','catch','show','includeAll','find','create','body','update','params','describe','addMessage','ids','omit','getMessages','findOne','length','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','removeTags','download','unix','toString','join','root','server','files','tmp','from','subject','attachments','Attachment','Attachments','mkdirSync','format','basename','readFileSync','writeFileSync','message%d.eml','log','err'];(function(_0x45eee7,_0x2bb4e4){var _0x2c6631=function(_0x459c10){while(--_0x459c10){_0x45eee7['push'](_0x45eee7['shift']());}};_0x2c6631(++_0x2bb4e4);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4ee881,_0x10ddc8){_0x4ee881=_0x4ee881-0x0;var _0x305f48=_0x0b0e[_0x4ee881];return _0x305f48;};'use strict';var pdf=require(_0xe0b0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe0b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0b0('0x2'));var rp=require(_0xe0b0('0x3'));var moment=require(_0xe0b0('0x4'));var BPromise=require(_0xe0b0('0x5'));var Mustache=require(_0xe0b0('0x6'));var util=require(_0xe0b0('0x7'));var path=require(_0xe0b0('0x8'));var sox=require(_0xe0b0('0x9'));var csv=require(_0xe0b0('0xa'));var ejs=require(_0xe0b0('0xb'));var fs=require('fs');var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0xa'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var authService=require(_0xe0b0('0x10'));var hardwareService=require(_0xe0b0('0x11'));var Redis=require('ioredis');var qs=require(_0xe0b0('0x12'));var logger=require(_0xe0b0('0x13'))('api');var utils=require(_0xe0b0('0x14'));var config=require(_0xe0b0('0x15'));var db=require(_0xe0b0('0x16'))['db'];config['redis']=_[_0xe0b0('0x17')](config[_0xe0b0('0x18')],{'host':_0xe0b0('0x19'),'port':0x18eb});var socket=require(_0xe0b0('0x1a'))(new Redis(config[_0xe0b0('0x18')]));require('./mailInteraction.socket')[_0xe0b0('0x1b')](socket);function respondWithStatusCode(_0x154de6,_0x743318){_0x743318=_0x743318||0xcc;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1c')](_0x743318);}return _0x154de6['status'](_0x743318)[_0xe0b0('0x1d')]();};}function respondWithResult(_0x5adb01,_0x35cb40){_0x35cb40=_0x35cb40||0xc8;return function(_0xadee6e){if(_0xadee6e){return _0x5adb01['status'](_0x35cb40)[_0xe0b0('0x1e')](_0xadee6e);}};}function respondWithFilteredResult(_0x4a4cc0,_0x2d6fb6){return function(_0x100204){if(_0x100204){var _0x56bcc7=_0x100204['count'],_0x54a3eb=_0x2d6fb6['offset'],_0x46bb44=_0x2d6fb6[_0xe0b0('0x1f')]+_0x2d6fb6['limit'],_0x50a441;if(_0x46bb44>=_0x56bcc7){_0x46bb44=_0x56bcc7;_0x50a441=0xc8;}else{_0x50a441=0xce;}_0x4a4cc0['status'](_0x50a441);return _0x4a4cc0[_0xe0b0('0x20')]('Content-Range',_0x54a3eb+'-'+_0x46bb44+'/'+_0x56bcc7)[_0xe0b0('0x1e')](_0x100204);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x21')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x22')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x23')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x24')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x25')]()['then'](function(){_0x513e63[_0xe0b0('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x27')](_0x362aba[_0xe0b0('0x28')]);if(_0x362aba[_0xe0b0('0x29')]){delete _0x362aba[_0xe0b0('0x29')];}_0x3c221d[_0xe0b0('0x26')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x2a')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=db[_0xe0b0('0x2b')][_0xe0b0('0x2c')];_0x419b1f[_0xe0b0('0x2d')]=_['keys'](_0x1d5759);_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8['query']);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x2d')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x31')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x32')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x32')]));_0x15e13b[_0xe0b0('0x31')]=_0x15e13b[_0xe0b0('0x31')]['length']?_0x15e13b[_0xe0b0('0x31')]:_0x419b1f[_0xe0b0('0x2d')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')](_0xe0b0('0x34'))){_0x15e13b[_0xe0b0('0x35')]=qs[_0xe0b0('0x35')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')]);_0x15e13b[_0xe0b0('0x1f')]=qs[_0xe0b0('0x1f')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1f')]);}_0x15e13b[_0xe0b0('0x36')]=qs[_0xe0b0('0x37')](_0x1b8aa8['query'][_0xe0b0('0x37')]);_0x15e13b[_0xe0b0('0x38')]=qs[_0xe0b0('0x39')](_[_0xe0b0('0x3a')](_0x1b8aa8[_0xe0b0('0x2e')],_0x419b1f[_0xe0b0('0x39')]));if(_0x1b8aa8[_0xe0b0('0x2e')]['filter']){_0x15e13b['where']=_['merge'](_0x15e13b['where'],{'$or':_[_0xe0b0('0x3b')](_0x1d5759,function(_0xc3d967){if(_0xc3d967[_0xe0b0('0x3c')]['key']!==_0xe0b0('0x3d')){var _0x352c09={};_0x352c09[_0xc3d967[_0xe0b0('0x3e')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')]['filter']+'%'};return _0x352c09;}})});}_0x15e13b=_[_0xe0b0('0x3f')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x40')]);var _0x43d352={'where':_0x15e13b[_0xe0b0('0x38')]};_0x43d352[_0xe0b0('0x41')]=[];if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x42')]){_0x43d352[_0xe0b0('0x41')][_0xe0b0('0x43')]({'model':db['Tag'],'as':_0xe0b0('0x44'),'attributes':['id'],'where':{'id':_0x1b8aa8['query'][_0xe0b0('0x42')]},'required':!![]});_0x43d352[_0xe0b0('0x45')]=!![];}if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x46')]){_0x43d352['include'][_0xe0b0('0x43')]({'model':db[_0xe0b0('0x47')],'as':_0xe0b0('0x48'),'attributes':['id',_0xe0b0('0x49'),_0xe0b0('0x4a'),_0xe0b0('0x46')],'where':{'direction':'in','read':_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x46')]||![]},'required':!![]});_0x43d352['distinct']=!![];}return db[_0xe0b0('0x2b')][_0xe0b0('0x4b')](_0x43d352)['then'](function(_0x515bd2){_0x36d137[_0xe0b0('0x4b')]=_0x515bd2;if(_0x1b8aa8[_0xe0b0('0x2e')]['includeAll']){_0x15e13b[_0xe0b0('0x41')]=[{'model':db[_0xe0b0('0x4c')],'as':_0xe0b0('0x4d'),'required':![],'attributes':['id',_0xe0b0('0x29'),_0xe0b0('0x4e')]},{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0xe0b0('0x4f'),'attributes':[_0xe0b0('0x29'),'fullname',_0xe0b0('0x50')],'required':![]},{'model':db[_0xe0b0('0x51')],'as':_0xe0b0('0x52'),'attributes':[_0xe0b0('0x29'),_0xe0b0('0x53'),'email'],'required':![]},{'model':db['MailMessage'],'as':_0xe0b0('0x48'),'attributes':['id',_0xe0b0('0x49'),_0xe0b0('0x4a'),_0xe0b0('0x46')],'where':{'direction':'in','read':_0x1b8aa8[_0xe0b0('0x2e')]['read']||![]},'required':_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x46')]||![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0xe0b0('0x54')],'required':_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x42')]?!![]:![]},{'model':db[_0xe0b0('0x55')],'as':'ThroughTags','attributes':['id',_0xe0b0('0x29'),_0xe0b0('0x54')],'through':_0x1b8aa8['query']['tag']?{'attributes':[],'where':{'TagId':_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x42')]||undefined}}:{},'required':_0x1b8aa8['query'][_0xe0b0('0x42')]?!![]:![]}];}return db[_0xe0b0('0x2b')]['findAll'](_0x15e13b);})['then'](function(_0x123ad2){_0x36d137['rows']=_0x123ad2;return _0x36d137;})[_0xe0b0('0x24')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))[_0xe0b0('0x56')](handleError(_0x5b7a64,null));};exports[_0xe0b0('0x57')]=function(_0x45cc4e,_0x19ee71){var _0xf9e694={'raw':![],'where':{'id':_0x45cc4e['params']['id']}},_0x5f5486={};_0x5f5486[_0xe0b0('0x2d')]=_['keys'](db['MailInteraction'][_0xe0b0('0x2c')]);_0x5f5486[_0xe0b0('0x2e')]=_['keys'](_0x45cc4e['query']);_0x5f5486[_0xe0b0('0x39')]=_[_0xe0b0('0x30')](_0x5f5486[_0xe0b0('0x2d')],_0x5f5486[_0xe0b0('0x2e')]);_0xf9e694[_0xe0b0('0x31')]=_[_0xe0b0('0x30')](_0x5f5486[_0xe0b0('0x2d')],qs['fields'](_0x45cc4e[_0xe0b0('0x2e')]['fields']));_0xf9e694[_0xe0b0('0x31')]=_0xf9e694['attributes']['length']?_0xf9e694[_0xe0b0('0x31')]:_0x5f5486[_0xe0b0('0x2d')];if(_0x45cc4e[_0xe0b0('0x2e')][_0xe0b0('0x58')]){_0xf9e694[_0xe0b0('0x41')]=[{'all':!![]}];}_0xf9e694=_[_0xe0b0('0x3f')]({},_0xf9e694,_0x45cc4e[_0xe0b0('0x40')]);return db[_0xe0b0('0x2b')][_0xe0b0('0x59')](_0xf9e694)['then'](handleEntityNotFound(_0x19ee71,null))[_0xe0b0('0x24')](respondWithResult(_0x19ee71,null))['catch'](handleError(_0x19ee71,null));};exports[_0xe0b0('0x5a')]=function(_0x3ae36e,_0x30c4a9){return db[_0xe0b0('0x2b')][_0xe0b0('0x5a')](_0x3ae36e[_0xe0b0('0x5b')],{})['then'](respondWithResult(_0x30c4a9,0xc9))[_0xe0b0('0x56')](handleError(_0x30c4a9,null));};exports[_0xe0b0('0x5c')]=function(_0x437a15,_0x271445){if(_0x437a15[_0xe0b0('0x5b')]['id']){delete _0x437a15[_0xe0b0('0x5b')]['id'];}return db[_0xe0b0('0x2b')][_0xe0b0('0x59')]({'where':{'id':_0x437a15[_0xe0b0('0x5d')]['id']}})[_0xe0b0('0x24')](handleEntityNotFound(_0x271445,null))[_0xe0b0('0x24')](saveUpdates(_0x437a15[_0xe0b0('0x5b')],null))[_0xe0b0('0x24')](respondWithResult(_0x271445,null))[_0xe0b0('0x56')](handleError(_0x271445,null));};exports[_0xe0b0('0x25')]=function(_0x34c642,_0x4c7661){return db[_0xe0b0('0x2b')]['find']({'where':{'id':_0x34c642[_0xe0b0('0x5d')]['id']}})[_0xe0b0('0x24')](handleEntityNotFound(_0x4c7661,null))[_0xe0b0('0x24')](removeEntity(_0x4c7661,null))[_0xe0b0('0x56')](handleError(_0x4c7661,null));};exports[_0xe0b0('0x5e')]=function(_0x405d7e,_0x2bdb59){return db['MailInteraction']['describe']()[_0xe0b0('0x24')](respondWithResult(_0x2bdb59,null))[_0xe0b0('0x56')](handleError(_0x2bdb59,null));};exports[_0xe0b0('0x5f')]=function(_0x47ecc1,_0x117d20,_0x13fb4b){return db[_0xe0b0('0x47')][_0xe0b0('0x59')]({'where':{'id':_0x47ecc1[_0xe0b0('0x5d')]['id']}})['then'](handleEntityNotFound(_0x117d20,null))[_0xe0b0('0x24')](function(_0x242120){if(_0x242120){return _0x242120[_0xe0b0('0x5f')](_0x47ecc1['body'][_0xe0b0('0x60')],_[_0xe0b0('0x61')](_0x47ecc1['body'],[_0xe0b0('0x60'),'id'])||{});}})['then'](respondWithResult(_0x117d20,null))['catch'](handleError(_0x117d20,null));};exports[_0xe0b0('0x62')]=function(_0x57b51e,_0x4d75e4,_0x416e0c){var _0xd750b4={'raw':![],'where':{}};var _0x2d91f1={};var _0x1a4fad={'count':0x0,'rows':[]};return db['MailInteraction'][_0xe0b0('0x63')]({'where':{'id':_0x57b51e[_0xe0b0('0x5d')]['id']}})[_0xe0b0('0x24')](handleEntityNotFound(_0x4d75e4,null))[_0xe0b0('0x24')](function(_0x1b29c){if(_0x1b29c){_0x2d91f1[_0xe0b0('0x2d')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x47')]['rawAttributes']);_0x2d91f1['query']=_[_0xe0b0('0x2f')](_0x57b51e[_0xe0b0('0x2e')]);_0x2d91f1[_0xe0b0('0x39')]=_['intersection'](_0x2d91f1['model'],_0x2d91f1[_0xe0b0('0x2e')]);_0xd750b4[_0xe0b0('0x31')]=_['intersection'](_0x2d91f1['model'],qs[_0xe0b0('0x32')](_0x57b51e[_0xe0b0('0x2e')][_0xe0b0('0x32')]));_0xd750b4[_0xe0b0('0x31')]=_0xd750b4[_0xe0b0('0x31')][_0xe0b0('0x64')]?_0xd750b4[_0xe0b0('0x31')]:_0x2d91f1[_0xe0b0('0x2d')];if(!_0x57b51e['query'][_0xe0b0('0x33')](_0xe0b0('0x34'))){_0xd750b4[_0xe0b0('0x35')]=qs['limit'](_0x57b51e['query']['limit']);_0xd750b4['offset']=qs['offset'](_0x57b51e['query'][_0xe0b0('0x1f')]);}_0xd750b4['order']=qs['sort'](_0x57b51e[_0xe0b0('0x2e')][_0xe0b0('0x37')]);_0xd750b4[_0xe0b0('0x38')]=qs[_0xe0b0('0x39')](_[_0xe0b0('0x3a')](_0x57b51e[_0xe0b0('0x2e')],_0x2d91f1[_0xe0b0('0x39')]));_0xd750b4[_0xe0b0('0x38')]['MailInteractionId']=_0x1b29c['id'];if(_0x57b51e[_0xe0b0('0x2e')][_0xe0b0('0x65')]){_0xd750b4[_0xe0b0('0x38')]=_[_0xe0b0('0x3f')](_0xd750b4[_0xe0b0('0x38')],{'$or':_[_0xe0b0('0x3b')](_0xd750b4[_0xe0b0('0x31')],function(_0x5e3e28){var _0xaf2607={};_0xaf2607[_0x5e3e28]={'$like':'%'+_0x57b51e['query'][_0xe0b0('0x65')]+'%'};return _0xaf2607;})});}if(_0x57b51e[_0xe0b0('0x2e')][_0xe0b0('0x66')]){var _0x9c7221=_0x57b51e['query'][_0xe0b0('0x66')][_0xe0b0('0x67')](',');var _0x49deef={};_0x49deef[_0x9c7221[0x0]]={'$gte':moment(_0x9c7221[0x1])['format'](_0xe0b0('0x68'))};_0xd750b4[_0xe0b0('0x38')]=_[_0xe0b0('0x3f')](_0xd750b4[_0xe0b0('0x38')],_0x49deef);}_0xd750b4=_[_0xe0b0('0x3f')]({},_0xd750b4,_0x57b51e[_0xe0b0('0x40')]);return db[_0xe0b0('0x47')][_0xe0b0('0x4b')]({'where':_0xd750b4[_0xe0b0('0x38')]})[_0xe0b0('0x24')](function(_0x5a63e6){_0x1a4fad['count']=_0x5a63e6;if(_0x57b51e[_0xe0b0('0x2e')]['includeAll']){_0xd750b4['include']=[{'all':!![]}];}return db['MailMessage']['findAll'](_0xd750b4);})[_0xe0b0('0x24')](function(_0x584350){_0x1a4fad[_0xe0b0('0x69')]=_0x584350;return _0x1a4fad;});}})[_0xe0b0('0x24')](respondWithFilteredResult(_0x4d75e4,_0xd750b4))[_0xe0b0('0x56')](handleError(_0x4d75e4,null));};exports[_0xe0b0('0x6a')]=function(_0x5b1b6b,_0x31b218,_0x948708){return db['MailInteraction'][_0xe0b0('0x59')]({'where':{'id':_0x5b1b6b[_0xe0b0('0x5d')]['id']}})[_0xe0b0('0x24')](handleEntityNotFound(_0x31b218,null))[_0xe0b0('0x24')](function(_0x27af09){if(_0x27af09){return _0x27af09['setTags'](_0x5b1b6b['body']['ids'],_['omit'](_0x5b1b6b['body'],[_0xe0b0('0x60'),'id'])||{})['spread'](function(){return db[_0xe0b0('0x55')]['findAll']({'attributes':['id',_0xe0b0('0x29'),_0xe0b0('0x54')],'where':{'id':_0x5b1b6b[_0xe0b0('0x5b')][_0xe0b0('0x60')]}});})[_0xe0b0('0x24')](function(_0x31a5e1){socket['emit']('mailInteractionTags:save',{'id':Number(_0x5b1b6b['params']['id']),'tags':_0x31a5e1||[]});return{'id':Number(_0x5b1b6b['params']['id']),'tags':_0x31a5e1||[]};});}})[_0xe0b0('0x24')](respondWithResult(_0x31b218,null))[_0xe0b0('0x56')](handleError(_0x31b218,null));};exports[_0xe0b0('0x6b')]=function(_0x4377f7,_0x2c1149,_0x534881){var _0x234716;return db[_0xe0b0('0x2b')][_0xe0b0('0x59')]({'where':{'id':_0x4377f7[_0xe0b0('0x5d')]['id']}})[_0xe0b0('0x24')](handleEntityNotFound(_0x2c1149,null))[_0xe0b0('0x24')](function(_0x3ef24a){if(_0x3ef24a){return _0x3ef24a[_0xe0b0('0x6b')](_0x4377f7[_0xe0b0('0x2e')]['ids']);}})['then'](respondWithStatusCode(_0x2c1149,null))[_0xe0b0('0x56')](handleError(_0x2c1149,null));};exports[_0xe0b0('0x6c')]=function(_0x5a32b0,_0x7feff4){var _0x4593f1=moment()[_0xe0b0('0x6d')]()[_0xe0b0('0x6e')]();var _0x7358ce=path[_0xe0b0('0x6f')](config[_0xe0b0('0x70')],_0xe0b0('0x71'),'files','attachments');var _0x55e8c6=path[_0xe0b0('0x6f')](config[_0xe0b0('0x70')],'server',_0xe0b0('0x72'),_0xe0b0('0x73'));var _0x396eec=path[_0xe0b0('0x6f')](_0x55e8c6,_0x4593f1);var _0x5c45ae=util['format']('interaction-%s.zip',_0x4593f1);var _0x22029a=path[_0xe0b0('0x6f')](_0x55e8c6,_0x5c45ae);var _0x57535b=![];return db[_0xe0b0('0x2b')][_0xe0b0('0x59')]({'where':{'id':_0x5a32b0['params']['id']}})['then'](handleEntityNotFound(_0x7feff4,null))[_0xe0b0('0x24')](function(_0x554181){if(_0x554181){return _0x554181[_0xe0b0('0x62')]({'attributes':['id','body',_0xe0b0('0x74'),'to','cc',_0xe0b0('0x75'),_0xe0b0('0x4a')],'where':{'secret':![]},'include':_0x5a32b0[_0xe0b0('0x2e')][_0xe0b0('0x76')]?[{'model':db[_0xe0b0('0x77')],'as':_0xe0b0('0x78')}]:undefined,'order':qs[_0xe0b0('0x37')]('id')});}return[];})[_0xe0b0('0x24')](function(_0x48497e){_0x57535b=_0x48497e[_0xe0b0('0x64')];if(_0x48497e[_0xe0b0('0x64')]){fs[_0xe0b0('0x79')](_0x396eec);return BPromise['each'](_0x48497e,function(_0x1b7336,_0x4ad24f){var _0x328c96=_0x1b7336;var _0x350c40={'from':_0x328c96['from'],'to':_0x328c96['to'],'subject':_0x328c96[_0xe0b0('0x75')],'html':_0x328c96['body'],'headers':{'Date':moment(_0x328c96['createdAt'])[_0xe0b0('0x7a')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};return new BPromise(function(_0x5085b0,_0x4f027c){if(_0x1b7336[_0xe0b0('0x78')]){for(var _0x238979=0x0;_0x238979<_0x1b7336[_0xe0b0('0x78')][_0xe0b0('0x64')];_0x238979++){var _0x3da0ce=_0x1b7336['Attachments'][_0x238979];var _0x2af9d8=path[_0xe0b0('0x6f')](_0x7358ce,_0x3da0ce[_0xe0b0('0x7b')]);if(fs['existsSync'](_0x2af9d8)){_0x350c40[_0xe0b0('0x76')][_0xe0b0('0x43')]({'name':_0x3da0ce['name'],'contentType':_0x3da0ce['type'],'data':fs[_0xe0b0('0x7c')](_0x2af9d8)});}}}emlformat['build'](_0x350c40,function(_0x46ab89,_0xadc32){if(_0x46ab89)return _0x4f027c(_0x46ab89);fs[_0xe0b0('0x7d')](path[_0xe0b0('0x6f')](_0x396eec,util[_0xe0b0('0x7a')](_0xe0b0('0x7e'),_0x4ad24f)),_0xadc32);return _0x5085b0(_0xadc32);});});});}})[_0xe0b0('0x24')](function(){if(_0x57535b){return new BPromise(function(_0x504483,_0x355edf){zipdir(_0x396eec,{'saveTo':_0x22029a},function(_0x13d617,_0x135fec){if(_0x13d617)return _0x355edf(_0x13d617);return _0x504483(_0x135fec);});});}})[_0xe0b0('0x24')](function(){if(_0x57535b){return new BPromise(function(_0x2b087b,_0x545dfd){rimraf(_0x396eec,function(_0x5b91a2){if(_0x5b91a2)_0x545dfd(_0x5b91a2);return _0x2b087b();});});}})[_0xe0b0('0x24')](function(){if(_0x57535b){return _0x7feff4[_0xe0b0('0x6c')](_0x22029a,_0x5c45ae,function(_0xd4af91){if(_0xd4af91){console[_0xe0b0('0x7f')](_0xe0b0('0x80'),_0xd4af91);}else{fs[_0xe0b0('0x81')](_0x22029a);}});}else{return _0x7feff4[_0xe0b0('0x1c')](0xc8);}})[_0xe0b0('0x56')](handleError(_0x7feff4,null));}; \ No newline at end of file +var _0x2032=['attributes','length','nolimit','sort','filters','merge','map','type','VIRTUAL','field','filter','where','include','tag','push','Tag','distinct','Messages','direction','createdAt','read','count','includeAll','User','Users','fullname','CmContact','Contact','internal','MailAccount','key','MailMessage','Tags','color','findAll','rows','catch','show','params','options','body','update','find','describe','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','order','pick','MailInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','addTags','spread','emit','mailInteractionTags:save','removeTags','download','toString','join','root','server','files','attachments','interaction-%s.zip','from','subject','Attachment','Attachments','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','log','err','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','MailInteraction','rawAttributes','keys','query','intersection','model','fields'];(function(_0x334599,_0x4b1cfa){var _0x4cdff2=function(_0x297be7){while(--_0x297be7){_0x334599['push'](_0x334599['shift']());}};_0x4cdff2(++_0x4b1cfa);}(_0x2032,0xd9));var _0x2203=function(_0x46d9b5,_0x4ff4c1){_0x46d9b5=_0x46d9b5-0x0;var _0x32d6aa=_0x2032[_0x46d9b5];return _0x32d6aa;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2203('0x0'));var rimraf=require(_0x2203('0x1'));var zipdir=require(_0x2203('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2203('0x3'));var moment=require(_0x2203('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2203('0x5'));var util=require(_0x2203('0x6'));var path=require(_0x2203('0x7'));var sox=require(_0x2203('0x8'));var csv=require(_0x2203('0x9'));var ejs=require(_0x2203('0xa'));var fs=require('fs');var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var authService=require('../../components/auth/service');var hardwareService=require(_0x2203('0x11'));var Redis=require(_0x2203('0x12'));var qs=require(_0x2203('0x13'));var logger=require('../../config/logger')(_0x2203('0x14'));var utils=require('../../config/utils');var config=require(_0x2203('0x15'));var db=require('../../mysqldb')['db'];config[_0x2203('0x16')]=_[_0x2203('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailInteraction.socket')[_0x2203('0x18')](socket);function respondWithStatusCode(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xcc;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47);}return _0x538b30[_0x2203('0x1a')](_0x592e47)[_0x2203('0x1b')]();};}function respondWithResult(_0x226209,_0x3fe0a8){_0x3fe0a8=_0x3fe0a8||0xc8;return function(_0x2c36e6){if(_0x2c36e6){return _0x226209[_0x2203('0x1a')](_0x3fe0a8)[_0x2203('0x1c')](_0x2c36e6);}};}function respondWithFilteredResult(_0x3053f3,_0x5129fb){return function(_0x280eda){if(_0x280eda){var _0x2ee127=_0x280eda['count'],_0x4893ff=_0x5129fb[_0x2203('0x1d')],_0x3f9ef6=_0x5129fb['offset']+_0x5129fb[_0x2203('0x1e')],_0x8906e1;if(_0x3f9ef6>=_0x2ee127){_0x3f9ef6=_0x2ee127;_0x8906e1=0xc8;}else{_0x8906e1=0xce;}_0x3053f3[_0x2203('0x1a')](_0x8906e1);return _0x3053f3[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x3f9ef6+'/'+_0x2ee127)[_0x2203('0x1c')](_0x280eda);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x1a')](0xcc)[_0x2203('0x1b')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x19')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x25')](_0x5f11bf[_0x2203('0x26')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x27')];}_0x36b958[_0x2203('0x1a')](_0x39a11a)[_0x2203('0x28')](_0x5f11bf);};}exports[_0x2203('0x29')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=db[_0x2203('0x2a')][_0x2203('0x2b')];_0x5a95c1['model']=_[_0x2203('0x2c')](_0x616ed8);_0x5a95c1[_0x2203('0x2d')]=_[_0x2203('0x2c')](_0x28ae02[_0x2203('0x2d')]);_0x5a95c1['filters']=_[_0x2203('0x2e')](_0x5a95c1[_0x2203('0x2f')],_0x5a95c1['query']);_0x9c53f['attributes']=_[_0x2203('0x2e')](_0x5a95c1['model'],qs['fields'](_0x28ae02[_0x2203('0x2d')][_0x2203('0x30')]));_0x9c53f[_0x2203('0x31')]=_0x9c53f[_0x2203('0x31')][_0x2203('0x32')]?_0x9c53f['attributes']:_0x5a95c1[_0x2203('0x2f')];if(!_0x28ae02[_0x2203('0x2d')]['hasOwnProperty'](_0x2203('0x33'))){_0x9c53f[_0x2203('0x1e')]=qs[_0x2203('0x1e')](_0x28ae02[_0x2203('0x2d')][_0x2203('0x1e')]);_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02[_0x2203('0x2d')][_0x2203('0x1d')]);}_0x9c53f['order']=qs[_0x2203('0x34')](_0x28ae02[_0x2203('0x2d')]['sort']);_0x9c53f['where']=qs[_0x2203('0x35')](_['pick'](_0x28ae02[_0x2203('0x2d')],_0x5a95c1[_0x2203('0x35')]));if(_0x28ae02[_0x2203('0x2d')]['filter']){_0x9c53f['where']=_[_0x2203('0x36')](_0x9c53f['where'],{'$or':_[_0x2203('0x37')](_0x616ed8,function(_0x5cfe5e){if(_0x5cfe5e[_0x2203('0x38')]['key']!==_0x2203('0x39')){var _0x13ed9e={};_0x13ed9e[_0x5cfe5e[_0x2203('0x3a')]]={'$like':'%'+_0x28ae02[_0x2203('0x2d')][_0x2203('0x3b')]+'%'};return _0x13ed9e;}})});}_0x9c53f=_['merge']({},_0x9c53f,_0x28ae02['options']);var _0x4c0e9e={'where':_0x9c53f[_0x2203('0x3c')]};_0x4c0e9e[_0x2203('0x3d')]=[];if(_0x28ae02[_0x2203('0x2d')][_0x2203('0x3e')]){_0x4c0e9e[_0x2203('0x3d')][_0x2203('0x3f')]({'model':db[_0x2203('0x40')],'as':'Tags','attributes':['id'],'where':{'id':_0x28ae02[_0x2203('0x2d')][_0x2203('0x3e')]},'required':!![]});_0x4c0e9e[_0x2203('0x41')]=!![];}if(_0x28ae02[_0x2203('0x2d')]['read']){_0x4c0e9e['include'][_0x2203('0x3f')]({'model':db['MailMessage'],'as':_0x2203('0x42'),'attributes':['id',_0x2203('0x43'),_0x2203('0x44'),'read'],'where':{'direction':'in','read':_0x28ae02['query'][_0x2203('0x45')]||![]},'required':!![]});_0x4c0e9e[_0x2203('0x41')]=!![];}return db[_0x2203('0x2a')][_0x2203('0x46')](_0x4c0e9e)[_0x2203('0x23')](function(_0x1fa734){_0x34b8ba['count']=_0x1fa734;if(_0x28ae02[_0x2203('0x2d')][_0x2203('0x47')]){_0x9c53f[_0x2203('0x3d')]=[{'model':db[_0x2203('0x48')],'as':_0x2203('0x49'),'required':![],'attributes':['id',_0x2203('0x27'),_0x2203('0x4a')]},{'model':db[_0x2203('0x4b')],'as':_0x2203('0x4c'),'required':![]},{'model':db[_0x2203('0x48')],'as':'Owner','attributes':[_0x2203('0x27'),_0x2203('0x4a'),_0x2203('0x4d')],'required':![]},{'model':db[_0x2203('0x4e')],'as':'Account','attributes':['name',_0x2203('0x4f'),'email'],'required':![]},{'model':db[_0x2203('0x50')],'as':_0x2203('0x42'),'attributes':['id',_0x2203('0x43'),_0x2203('0x44'),'read'],'where':{'direction':'in','read':_0x28ae02[_0x2203('0x2d')][_0x2203('0x45')]||![]},'required':_0x28ae02['query'][_0x2203('0x45')]||![]},{'model':db[_0x2203('0x40')],'as':_0x2203('0x51'),'attributes':['id',_0x2203('0x27'),'color'],'required':_0x28ae02['query'][_0x2203('0x3e')]?!![]:![]},{'model':db['Tag'],'as':'ThroughTags','attributes':['id',_0x2203('0x27'),_0x2203('0x52')],'through':_0x28ae02[_0x2203('0x2d')]['tag']?{'attributes':[],'where':{'TagId':_0x28ae02['query'][_0x2203('0x3e')]||undefined}}:{},'required':_0x28ae02[_0x2203('0x2d')][_0x2203('0x3e')]?!![]:![]}];}return db[_0x2203('0x2a')][_0x2203('0x53')](_0x9c53f);})[_0x2203('0x23')](function(_0x4a7f4e){_0x34b8ba[_0x2203('0x54')]=_0x4a7f4e;return _0x34b8ba;})['then'](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x55')](handleError(_0x1df508,null));};exports[_0x2203('0x56')]=function(_0x246aff,_0x1e49dd){var _0x58b9bb={'raw':![],'where':{'id':_0x246aff[_0x2203('0x57')]['id']}},_0x506795={};_0x506795[_0x2203('0x2f')]=_[_0x2203('0x2c')](db[_0x2203('0x2a')]['rawAttributes']);_0x506795['query']=_['keys'](_0x246aff[_0x2203('0x2d')]);_0x506795[_0x2203('0x35')]=_['intersection'](_0x506795[_0x2203('0x2f')],_0x506795[_0x2203('0x2d')]);_0x58b9bb['attributes']=_[_0x2203('0x2e')](_0x506795[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x246aff[_0x2203('0x2d')]['fields']));_0x58b9bb[_0x2203('0x31')]=_0x58b9bb['attributes'][_0x2203('0x32')]?_0x58b9bb[_0x2203('0x31')]:_0x506795['model'];if(_0x246aff[_0x2203('0x2d')][_0x2203('0x47')]){_0x58b9bb[_0x2203('0x3d')]=[{'all':!![]}];}_0x58b9bb=_[_0x2203('0x36')]({},_0x58b9bb,_0x246aff[_0x2203('0x58')]);return db[_0x2203('0x2a')]['find'](_0x58b9bb)['then'](handleEntityNotFound(_0x1e49dd,null))[_0x2203('0x23')](respondWithResult(_0x1e49dd,null))['catch'](handleError(_0x1e49dd,null));};exports['create']=function(_0xfddc3b,_0x33e5eb){return db[_0x2203('0x2a')]['create'](_0xfddc3b[_0x2203('0x59')],{})['then'](respondWithResult(_0x33e5eb,0xc9))['catch'](handleError(_0x33e5eb,null));};exports[_0x2203('0x5a')]=function(_0x5be4b6,_0x54ec71){if(_0x5be4b6['body']['id']){delete _0x5be4b6[_0x2203('0x59')]['id'];}return db[_0x2203('0x2a')][_0x2203('0x5b')]({'where':{'id':_0x5be4b6[_0x2203('0x57')]['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x54ec71,null))[_0x2203('0x23')](saveUpdates(_0x5be4b6[_0x2203('0x59')],null))[_0x2203('0x23')](respondWithResult(_0x54ec71,null))[_0x2203('0x55')](handleError(_0x54ec71,null));};exports[_0x2203('0x24')]=function(_0x384a59,_0x10d88b){return db['MailInteraction']['find']({'where':{'id':_0x384a59[_0x2203('0x57')]['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x10d88b,null))[_0x2203('0x23')](removeEntity(_0x10d88b,null))[_0x2203('0x55')](handleError(_0x10d88b,null));};exports[_0x2203('0x5c')]=function(_0x147196,_0x4f8b8e){return db['MailInteraction'][_0x2203('0x5c')]()[_0x2203('0x23')](respondWithResult(_0x4f8b8e,null))[_0x2203('0x55')](handleError(_0x4f8b8e,null));};exports[_0x2203('0x5d')]=function(_0xcab922,_0x7b0b9c,_0x133d22){return db[_0x2203('0x50')][_0x2203('0x5b')]({'where':{'id':_0xcab922[_0x2203('0x57')]['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x7b0b9c,null))['then'](function(_0x1ea97a){if(_0x1ea97a){return _0x1ea97a[_0x2203('0x5d')](_0xcab922[_0x2203('0x59')][_0x2203('0x5e')],_[_0x2203('0x5f')](_0xcab922[_0x2203('0x59')],[_0x2203('0x5e'),'id'])||{});}})[_0x2203('0x23')](respondWithResult(_0x7b0b9c,null))[_0x2203('0x55')](handleError(_0x7b0b9c,null));};exports[_0x2203('0x60')]=function(_0x49e795,_0x6ea7e8,_0x3795e6){var _0x24179a={'raw':![],'where':{}};var _0xc193b7={};var _0x34e820={'count':0x0,'rows':[]};return db[_0x2203('0x2a')][_0x2203('0x61')]({'where':{'id':_0x49e795[_0x2203('0x57')]['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x6ea7e8,null))['then'](function(_0x468619){if(_0x468619){_0xc193b7[_0x2203('0x2f')]=_[_0x2203('0x2c')](db['MailMessage'][_0x2203('0x2b')]);_0xc193b7[_0x2203('0x2d')]=_[_0x2203('0x2c')](_0x49e795[_0x2203('0x2d')]);_0xc193b7[_0x2203('0x35')]=_['intersection'](_0xc193b7[_0x2203('0x2f')],_0xc193b7[_0x2203('0x2d')]);_0x24179a[_0x2203('0x31')]=_['intersection'](_0xc193b7['model'],qs['fields'](_0x49e795['query']['fields']));_0x24179a[_0x2203('0x31')]=_0x24179a[_0x2203('0x31')][_0x2203('0x32')]?_0x24179a[_0x2203('0x31')]:_0xc193b7[_0x2203('0x2f')];if(!_0x49e795[_0x2203('0x2d')][_0x2203('0x62')](_0x2203('0x33'))){_0x24179a['limit']=qs['limit'](_0x49e795[_0x2203('0x2d')][_0x2203('0x1e')]);_0x24179a[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x49e795[_0x2203('0x2d')][_0x2203('0x1d')]);}_0x24179a[_0x2203('0x63')]=qs[_0x2203('0x34')](_0x49e795[_0x2203('0x2d')][_0x2203('0x34')]);_0x24179a[_0x2203('0x3c')]=qs[_0x2203('0x35')](_[_0x2203('0x64')](_0x49e795[_0x2203('0x2d')],_0xc193b7[_0x2203('0x35')]));_0x24179a[_0x2203('0x3c')][_0x2203('0x65')]=_0x468619['id'];if(_0x49e795[_0x2203('0x2d')][_0x2203('0x3b')]){_0x24179a['where']=_[_0x2203('0x36')](_0x24179a['where'],{'$or':_[_0x2203('0x37')](_0x24179a['attributes'],function(_0x5ba500){var _0xf71e7e={};_0xf71e7e[_0x5ba500]={'$like':'%'+_0x49e795[_0x2203('0x2d')][_0x2203('0x3b')]+'%'};return _0xf71e7e;})});}if(_0x49e795[_0x2203('0x2d')][_0x2203('0x66')]){var _0x3e1583=_0x49e795[_0x2203('0x2d')]['$gte']['split'](',');var _0x38903b={};_0x38903b[_0x3e1583[0x0]]={'$gte':moment(_0x3e1583[0x1])[_0x2203('0x67')](_0x2203('0x68'))};_0x24179a['where']=_['merge'](_0x24179a['where'],_0x38903b);}_0x24179a=_[_0x2203('0x36')]({},_0x24179a,_0x49e795[_0x2203('0x58')]);return db[_0x2203('0x50')][_0x2203('0x46')]({'where':_0x24179a['where']})[_0x2203('0x23')](function(_0x47a2c7){_0x34e820[_0x2203('0x46')]=_0x47a2c7;if(_0x49e795[_0x2203('0x2d')][_0x2203('0x47')]){_0x24179a[_0x2203('0x3d')]=[{'all':!![]}];}return db[_0x2203('0x50')]['findAll'](_0x24179a);})[_0x2203('0x23')](function(_0x247f26){_0x34e820[_0x2203('0x54')]=_0x247f26;return _0x34e820;});}})['then'](respondWithFilteredResult(_0x6ea7e8,_0x24179a))[_0x2203('0x55')](handleError(_0x6ea7e8,null));};exports[_0x2203('0x69')]=function(_0x377419,_0xd76624,_0x1c65f9){return db[_0x2203('0x2a')][_0x2203('0x5b')]({'where':{'id':_0x377419[_0x2203('0x57')]['id']}})[_0x2203('0x23')](handleEntityNotFound(_0xd76624,null))[_0x2203('0x23')](function(_0x112385){if(_0x112385){return _0x112385['setTags'](_0x377419[_0x2203('0x59')][_0x2203('0x5e')],_[_0x2203('0x5f')](_0x377419[_0x2203('0x59')],[_0x2203('0x5e'),'id'])||{})[_0x2203('0x6a')](function(){return db[_0x2203('0x40')][_0x2203('0x53')]({'attributes':['id',_0x2203('0x27'),_0x2203('0x52')],'where':{'id':_0x377419[_0x2203('0x59')][_0x2203('0x5e')]}});})['then'](function(_0x568722){socket[_0x2203('0x6b')](_0x2203('0x6c'),{'id':Number(_0x377419[_0x2203('0x57')]['id']),'tags':_0x568722||[]});return{'id':Number(_0x377419[_0x2203('0x57')]['id']),'tags':_0x568722||[]};});}})[_0x2203('0x23')](respondWithResult(_0xd76624,null))['catch'](handleError(_0xd76624,null));};exports[_0x2203('0x6d')]=function(_0x3cb792,_0x4e539b,_0x511689){var _0x4edac6;return db['MailInteraction']['find']({'where':{'id':_0x3cb792[_0x2203('0x57')]['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x4e539b,null))[_0x2203('0x23')](function(_0x49fd02){if(_0x49fd02){return _0x49fd02['removeTags'](_0x3cb792['query'][_0x2203('0x5e')]);}})[_0x2203('0x23')](respondWithStatusCode(_0x4e539b,null))[_0x2203('0x55')](handleError(_0x4e539b,null));};exports[_0x2203('0x6e')]=function(_0x369728,_0x32ac75){var _0x3d1797=moment()['unix']()[_0x2203('0x6f')]();var _0x74843=path[_0x2203('0x70')](config[_0x2203('0x71')],_0x2203('0x72'),_0x2203('0x73'),_0x2203('0x74'));var _0x57c409=path[_0x2203('0x70')](config['root'],'server',_0x2203('0x73'),'tmp');var _0xb9588e=path[_0x2203('0x70')](_0x57c409,_0x3d1797);var _0x4c7ea2=util[_0x2203('0x67')](_0x2203('0x75'),_0x3d1797);var _0x1337a4=path[_0x2203('0x70')](_0x57c409,_0x4c7ea2);var _0x2cc712=![];return db[_0x2203('0x2a')]['find']({'where':{'id':_0x369728[_0x2203('0x57')]['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x32ac75,null))['then'](function(_0x5170c0){if(_0x5170c0){return _0x5170c0[_0x2203('0x60')]({'attributes':['id',_0x2203('0x59'),_0x2203('0x76'),'to','cc',_0x2203('0x77'),_0x2203('0x44')],'where':{'secret':![]},'include':_0x369728[_0x2203('0x2d')][_0x2203('0x74')]?[{'model':db[_0x2203('0x78')],'as':_0x2203('0x79')}]:undefined,'order':qs[_0x2203('0x34')]('id')});}return[];})[_0x2203('0x23')](function(_0x413729){_0x2cc712=_0x413729[_0x2203('0x32')];if(_0x413729[_0x2203('0x32')]){fs[_0x2203('0x7a')](_0xb9588e);return BPromise[_0x2203('0x7b')](_0x413729,function(_0x5f34f8,_0x4e2d30){var _0x2cb712=_0x5f34f8;var _0x1295a3={'from':_0x2cb712['from'],'to':_0x2cb712['to'],'subject':_0x2cb712[_0x2203('0x77')],'html':_0x2cb712[_0x2203('0x59')],'headers':{'Date':moment(_0x2cb712['createdAt'])[_0x2203('0x67')](_0x2203('0x7c'))},'attachments':[]};return new BPromise(function(_0x57ccf8,_0x21f357){if(_0x5f34f8[_0x2203('0x79')]){for(var _0x541639=0x0;_0x541639<_0x5f34f8[_0x2203('0x79')][_0x2203('0x32')];_0x541639++){var _0x3cfe3f=_0x5f34f8[_0x2203('0x79')][_0x541639];var _0x4c735c=path['join'](_0x74843,_0x3cfe3f[_0x2203('0x7d')]);if(fs[_0x2203('0x7e')](_0x4c735c)){_0x1295a3[_0x2203('0x74')]['push']({'name':_0x3cfe3f['name'],'contentType':_0x3cfe3f[_0x2203('0x38')],'data':fs[_0x2203('0x7f')](_0x4c735c)});}}}emlformat[_0x2203('0x80')](_0x1295a3,function(_0x586273,_0x54dd79){if(_0x586273)return _0x21f357(_0x586273);fs[_0x2203('0x81')](path[_0x2203('0x70')](_0xb9588e,util['format'](_0x2203('0x82'),_0x4e2d30)),_0x54dd79);return _0x57ccf8(_0x54dd79);});});});}})[_0x2203('0x23')](function(){if(_0x2cc712){return new BPromise(function(_0x5988ba,_0x10de30){zipdir(_0xb9588e,{'saveTo':_0x1337a4},function(_0x5c0dc8,_0x1feca9){if(_0x5c0dc8)return _0x10de30(_0x5c0dc8);return _0x5988ba(_0x1feca9);});});}})['then'](function(){if(_0x2cc712){return new BPromise(function(_0x48f529,_0x56a4b1){rimraf(_0xb9588e,function(_0x8efc68){if(_0x8efc68)_0x56a4b1(_0x8efc68);return _0x48f529();});});}})[_0x2203('0x23')](function(){if(_0x2cc712){return _0x32ac75['download'](_0x1337a4,_0x4c7ea2,function(_0x2afbfc){if(_0x2afbfc){console[_0x2203('0x83')](_0x2203('0x84'),_0x2afbfc);}else{fs['unlinkSync'](_0x1337a4);}});}else{return _0x32ac75[_0x2203('0x19')](0xc8);}})['catch'](handleError(_0x32ac75,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 0435fb1..c79f096 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 _0x4d88=['hook','exports','events','../../mysqldb','update','remove','emit'];(function(_0x557b14,_0x26f1b8){var _0x1cf9ac=function(_0xef8e6a){while(--_0xef8e6a){_0x557b14['push'](_0x557b14['shift']());}};_0x1cf9ac(++_0x26f1b8);}(_0x4d88,0x198));var _0x84d8=function(_0x3a0e2d,_0x1a9695){_0x3a0e2d=_0x3a0e2d-0x0;var _0x2980b8=_0x4d88[_0x3a0e2d];return _0x2980b8;};'use strict';var EventEmitter=require(_0x84d8('0x0'));var MailInteraction=require(_0x84d8('0x1'))['db']['MailInteraction'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x84d8('0x2'),'afterDestroy':_0x84d8('0x3')};function emitEvent(_0x4f26e2){return function(_0x1a9676,_0x593da2,_0x1a8705){MailInteractionEvents[_0x84d8('0x4')](_0x4f26e2+':'+_0x1a9676['id'],_0x1a9676);MailInteractionEvents[_0x84d8('0x4')](_0x4f26e2,_0x1a9676);_0x1a8705(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x84d8('0x5')](e,emitEvent(event));}}module[_0x84d8('0x6')]=MailInteractionEvents; \ No newline at end of file +var _0x0233=['MailInteraction','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x0233,0x6e));var _0x3023=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x0233[_0x59d89e];return _0x554e93;};'use strict';var EventEmitter=require(_0x3023('0x0'));var MailInteraction=require(_0x3023('0x1'))['db'][_0x3023('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3023('0x3'),'afterDestroy':_0x3023('0x4')};function emitEvent(_0x2ed5ea){return function(_0x46486d,_0x240a09,_0x2efd6e){MailInteractionEvents['emit'](_0x2ed5ea+':'+_0x46486d['id'],_0x46486d);MailInteractionEvents[_0x3023('0x5')](_0x2ed5ea,_0x46486d);_0x2efd6e(null);};}for(var e in events){if(events[_0x3023('0x6')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x3023('0x7')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 680bea1..287c92a 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 _0x8e41=['substatus','substatusAt','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','define','MailInteraction','mail_interactions'];(function(_0x4bfade,_0xb26c0e){var _0x272465=function(_0x3b38cb){while(--_0x3b38cb){_0x4bfade['push'](_0x4bfade['shift']());}};_0x272465(++_0xb26c0e);}(_0x8e41,0xb9));var _0x18e4=function(_0x186872,_0x50a406){_0x186872=_0x186872-0x0;var _0x2f440d=_0x8e41[_0x186872];return _0x2f440d;};'use strict';var _=require(_0x18e4('0x0'));var util=require(_0x18e4('0x1'));var logger=require(_0x18e4('0x2'))(_0x18e4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x1dd366,_0x270b0c){return _0x1dd366[_0x18e4('0x4')](_0x18e4('0x5'),attributes,{'tableName':_0x18e4('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1d870e,_0x4e5f36,_0x257c83){if(_0x1d870e[_0x18e4('0x7')]){_0x1d870e[_0x18e4('0x8')]=moment()[_0x18e4('0x9')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x1d870e[_0x18e4('0xa')]){_0x1d870e[_0x18e4('0xb')]=moment()['format'](_0x18e4('0xc'));}_0x257c83(null,_0x4e5f36);},'beforeUpdate':function(_0x505422,_0x1127f7,_0xf9150f){if(_0x505422['changed'](_0x18e4('0x7'))){_0x505422['substatusAt']=moment()[_0x18e4('0x9')](_0x18e4('0xc'));}if(_0x505422[_0x18e4('0xd')](_0x18e4('0xa'))){_0x505422[_0x18e4('0xb')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0xf9150f(null,_0x505422);}},'charset':_0x18e4('0xe'),'collate':_0x18e4('0xf')});}; \ No newline at end of file +var _0x8712=['bluebird','request-promise','exports','define','MailInteraction','mail_interactions','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','closedAt','utf8mb4','util','../../config/logger','api','moment'];(function(_0x509c83,_0x511882){var _0x534626=function(_0x9d21cf){while(--_0x9d21cf){_0x509c83['push'](_0x509c83['shift']());}};_0x534626(++_0x511882);}(_0x8712,0xc2));var _0x2871=function(_0x21b0e3,_0x444beb){_0x21b0e3=_0x21b0e3-0x0;var _0x4f95db=_0x8712[_0x21b0e3];return _0x4f95db;};'use strict';var _=require('lodash');var util=require(_0x2871('0x0'));var logger=require(_0x2871('0x1'))(_0x2871('0x2'));var moment=require(_0x2871('0x3'));var BPromise=require(_0x2871('0x4'));var rp=require(_0x2871('0x5'));var attributes=require('./mailInteraction.attributes');module[_0x2871('0x6')]=function(_0x5bd42c,_0x36bd85){return _0x5bd42c[_0x2871('0x7')](_0x2871('0x8'),attributes,{'tableName':_0x2871('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2084ca,_0x66c982,_0x13381d){if(_0x2084ca[_0x2871('0xa')]){_0x2084ca[_0x2871('0xb')]=moment()[_0x2871('0xc')](_0x2871('0xd'));}if(_0x2084ca[_0x2871('0xe')]){_0x2084ca['closedAt']=moment()[_0x2871('0xc')](_0x2871('0xd'));}_0x13381d(null,_0x66c982);},'beforeUpdate':function(_0x54117c,_0x11a86e,_0x514f23){if(_0x54117c[_0x2871('0xf')](_0x2871('0xa'))){_0x54117c[_0x2871('0xb')]=moment()[_0x2871('0xc')](_0x2871('0xd'));}if(_0x54117c[_0x2871('0xf')](_0x2871('0xe'))){_0x54117c[_0x2871('0x10')]=moment()[_0x2871('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x514f23(null,_0x54117c);}},'charset':_0x2871('0x11'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 002e0c1..477f66b 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 _0x7e02=['http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','attributes','limit','AddTagsToMailInteraction','find','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client'];(function(_0x53f906,_0x5288ff){var _0xb1b7da=function(_0x203681){while(--_0x203681){_0x53f906['push'](_0x53f906['shift']());}};_0xb1b7da(++_0x5288ff);}(_0x7e02,0x71));var _0x27e0=function(_0xe7bb1,_0x6e559e){_0xe7bb1=_0xe7bb1-0x0;var _0x994966=_0x7e02[_0xe7bb1];return _0x994966;};'use strict';var _=require(_0x27e0('0x0'));var util=require(_0x27e0('0x1'));var moment=require(_0x27e0('0x2'));var BPromise=require(_0x27e0('0x3'));var rs=require(_0x27e0('0x4'));var fs=require('fs');var Redis=require(_0x27e0('0x5'));var db=require(_0x27e0('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x27e0('0x7'));var config=require('../../config/environment');var jayson=require(_0x27e0('0x8'));var client=jayson[_0x27e0('0x9')][_0x27e0('0xa')]({'port':0x232a});config[_0x27e0('0xb')]=_[_0x27e0('0xc')](config[_0x27e0('0xb')],{'host':_0x27e0('0xd'),'port':0x18eb});var socket=require(_0x27e0('0xe'))(new Redis(config['redis']));require(_0x27e0('0xf'))['register'](socket);function respondWithRpcPromise(_0xa5a2fd,_0x1d7413,_0x480486){return new BPromise(function(_0x17f18d,_0xbf3ce5){return client[_0x27e0('0x10')](_0xa5a2fd,_0x480486)[_0x27e0('0x11')](function(_0x12db7d){logger[_0x27e0('0x12')](_0x27e0('0x13'),_0x1d7413,_0x27e0('0x14'));logger[_0x27e0('0x15')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x1d7413,_0x27e0('0x14'),JSON[_0x27e0('0x16')](_0x12db7d));if(_0x12db7d[_0x27e0('0x17')]){if(_0x12db7d['error'][_0x27e0('0x18')]===0x1f4){logger[_0x27e0('0x17')](_0x27e0('0x13'),_0x1d7413,_0x12db7d['error'][_0x27e0('0x19')]);return _0xbf3ce5(_0x12db7d[_0x27e0('0x17')][_0x27e0('0x19')]);}logger[_0x27e0('0x17')]('MailInteraction,\x20%s,\x20%s',_0x1d7413,_0x12db7d['error'][_0x27e0('0x19')]);return _0x17f18d(_0x12db7d[_0x27e0('0x17')][_0x27e0('0x19')]);}else{logger[_0x27e0('0x12')]('MailInteraction,\x20%s,\x20%s',_0x1d7413,_0x27e0('0x14'));_0x17f18d(_0x12db7d[_0x27e0('0x1a')][_0x27e0('0x19')]);}})[_0x27e0('0x1b')](function(_0x608e4f){logger[_0x27e0('0x17')]('MailInteraction,\x20%s,\x20%s',_0x1d7413,_0x608e4f);_0xbf3ce5(_0x608e4f);});});}exports[_0x27e0('0x1c')]=function(_0x445a53){var _0x58ede5=this;return new Promise(function(_0x1908d1,_0x23df66){return db[_0x27e0('0x1d')][_0x27e0('0x1e')](_0x445a53[_0x27e0('0x1f')],{'raw':_0x445a53['options']?_0x445a53['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x445a53[_0x27e0('0x20')]?_0x445a53[_0x27e0('0x20')]['where']||null:null,'attributes':_0x445a53[_0x27e0('0x20')]?_0x445a53[_0x27e0('0x20')][_0x27e0('0x21')]||null:null,'limit':_0x445a53[_0x27e0('0x20')]?_0x445a53[_0x27e0('0x20')][_0x27e0('0x22')]||null:null})[_0x27e0('0x11')](function(_0x371039){logger[_0x27e0('0x12')](_0x27e0('0x1c'),_0x445a53);logger[_0x27e0('0x15')](_0x27e0('0x1c'),_0x445a53,JSON[_0x27e0('0x16')](_0x371039));_0x1908d1(_0x371039);})[_0x27e0('0x1b')](function(_0xab503d){logger['error'](_0x27e0('0x1c'),_0xab503d[_0x27e0('0x19')],_0x445a53);_0x23df66(_0x58ede5[_0x27e0('0x17')](0x1f4,_0xab503d[_0x27e0('0x19')]));});});};exports[_0x27e0('0x23')]=function(_0x54bc21){return new Promise(function(_0x599404,_0x29114d){return db[_0x27e0('0x1d')][_0x27e0('0x24')]({'where':_0x54bc21[_0x27e0('0x20')]?_0x54bc21['options']['where']||null:null})[_0x27e0('0x11')](function(_0xfb4c48){if(_0xfb4c48){return _0xfb4c48['addTags'](_0x54bc21['body']['ids'],_[_0x27e0('0x25')](_0x54bc21[_0x27e0('0x1f')],[_0x27e0('0x26'),'id'])||{});}})[_0x27e0('0x27')](function(_0x573c68){logger[_0x27e0('0x12')](_0x27e0('0x28'),_0x54bc21);logger[_0x27e0('0x15')](_0x27e0('0x28'),_0x54bc21,JSON[_0x27e0('0x16')](_0x573c68));_0x599404(_0x573c68);})[_0x27e0('0x1b')](function(_0xbef88){logger[_0x27e0('0x17')](_0x27e0('0x28'),_0xbef88[_0x27e0('0x19')],_0x54bc21);_0x29114d(_this['error'](0x1f4,_0xbef88[_0x27e0('0x19')]));});});}; \ No newline at end of file +var _0x8506=['ids','omit','spread','AddTags','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./mailInteraction.socket','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','body','options','raw','where','attributes','limit','then','addTags'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8506,0xe8));var _0x6850=function(_0x7aa9c1,_0x39c497){_0x7aa9c1=_0x7aa9c1-0x0;var _0x5d158a=_0x8506[_0x7aa9c1];return _0x5d158a;};'use strict';var _=require('lodash');var util=require(_0x6850('0x0'));var moment=require('moment');var BPromise=require(_0x6850('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6850('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6850('0x3'));var logger=require(_0x6850('0x4'))(_0x6850('0x5'));var config=require('../../config/environment');var jayson=require(_0x6850('0x6'));var client=jayson[_0x6850('0x7')][_0x6850('0x8')]({'port':0x232a});config[_0x6850('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6850('0xa'))(new Redis(config[_0x6850('0x9')]));require(_0x6850('0xb'))['register'](socket);function respondWithRpcPromise(_0x5abd3b,_0x50e0e9,_0x209aa2){return new BPromise(function(_0x16ff28,_0x178197){return client[_0x6850('0xc')](_0x5abd3b,_0x209aa2)['then'](function(_0x16510e){logger[_0x6850('0xd')](_0x6850('0xe'),_0x50e0e9,_0x6850('0xf'));logger[_0x6850('0x10')](_0x6850('0x11'),_0x50e0e9,'request\x20sent',JSON[_0x6850('0x12')](_0x16510e));if(_0x16510e[_0x6850('0x13')]){if(_0x16510e[_0x6850('0x13')][_0x6850('0x14')]===0x1f4){logger[_0x6850('0x13')](_0x6850('0xe'),_0x50e0e9,_0x16510e['error'][_0x6850('0x15')]);return _0x178197(_0x16510e['error'][_0x6850('0x15')]);}logger[_0x6850('0x13')](_0x6850('0xe'),_0x50e0e9,_0x16510e[_0x6850('0x13')][_0x6850('0x15')]);return _0x16ff28(_0x16510e[_0x6850('0x13')][_0x6850('0x15')]);}else{logger[_0x6850('0xd')](_0x6850('0xe'),_0x50e0e9,_0x6850('0xf'));_0x16ff28(_0x16510e[_0x6850('0x16')][_0x6850('0x15')]);}})[_0x6850('0x17')](function(_0x1bd938){logger['error']('MailInteraction,\x20%s,\x20%s',_0x50e0e9,_0x1bd938);_0x178197(_0x1bd938);});});}exports[_0x6850('0x18')]=function(_0x18b994){var _0x28c1d2=this;return new Promise(function(_0x349b8a,_0x12a15d){return db[_0x6850('0x19')]['update'](_0x18b994[_0x6850('0x1a')],{'raw':_0x18b994[_0x6850('0x1b')]?_0x18b994[_0x6850('0x1b')][_0x6850('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18b994[_0x6850('0x1b')]?_0x18b994[_0x6850('0x1b')][_0x6850('0x1d')]||null:null,'attributes':_0x18b994[_0x6850('0x1b')]?_0x18b994[_0x6850('0x1b')][_0x6850('0x1e')]||null:null,'limit':_0x18b994[_0x6850('0x1b')]?_0x18b994[_0x6850('0x1b')][_0x6850('0x1f')]||null:null})[_0x6850('0x20')](function(_0x46a82d){logger[_0x6850('0xd')]('UpdateMailInteraction',_0x18b994);logger[_0x6850('0x10')]('UpdateMailInteraction',_0x18b994,JSON['stringify'](_0x46a82d));_0x349b8a(_0x46a82d);})[_0x6850('0x17')](function(_0xf7ce3d){logger[_0x6850('0x13')](_0x6850('0x18'),_0xf7ce3d['message'],_0x18b994);_0x12a15d(_0x28c1d2[_0x6850('0x13')](0x1f4,_0xf7ce3d[_0x6850('0x15')]));});});};exports['AddTagsToMailInteraction']=function(_0x3f14c1){return new Promise(function(_0x4866a,_0xb87a68){return db[_0x6850('0x19')]['find']({'where':_0x3f14c1[_0x6850('0x1b')]?_0x3f14c1[_0x6850('0x1b')]['where']||null:null})['then'](function(_0x2d0f95){if(_0x2d0f95){return _0x2d0f95[_0x6850('0x21')](_0x3f14c1['body'][_0x6850('0x22')],_[_0x6850('0x23')](_0x3f14c1[_0x6850('0x1a')],[_0x6850('0x22'),'id'])||{});}})[_0x6850('0x24')](function(_0x1d6c81){logger[_0x6850('0xd')](_0x6850('0x25'),_0x3f14c1);logger['debug']('AddTags',_0x3f14c1,JSON[_0x6850('0x12')](_0x1d6c81));_0x4866a(_0x1d6c81);})[_0x6850('0x17')](function(_0xb71b44){logger[_0x6850('0x13')](_0x6850('0x25'),_0xb71b44[_0x6850('0x15')],_0x3f14c1);_0xb87a68(_this[_0x6850('0x13')](0x1f4,_0xb71b44['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 70fd1b7..7bd5244 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 _0xb26f=['mailInteraction:','./mailInteraction.events','remove','emit','removeListener','register'];(function(_0x125375,_0x838b5d){var _0x5456cf=function(_0x50fd3d){while(--_0x50fd3d){_0x125375['push'](_0x125375['shift']());}};_0x5456cf(++_0x838b5d);}(_0xb26f,0x14b));var _0xfb26=function(_0xbc346f,_0x3db5c0){_0xbc346f=_0xbc346f-0x0;var _0x9f9260=_0xb26f[_0xbc346f];return _0x9f9260;};'use strict';var MailInteractionEvents=require(_0xfb26('0x0'));var events=['save',_0xfb26('0x1'),'update'];function createListener(_0x2d2339,_0x59fc19){return function(_0x32b750){_0x59fc19[_0xfb26('0x2')](_0x2d2339,_0x32b750);};}function removeListener(_0x1e5afd,_0x1acdb8){return function(){MailInteractionEvents[_0xfb26('0x3')](_0x1e5afd,_0x1acdb8);};}exports[_0xfb26('0x4')]=function(_0x21de51){for(var _0x4cb7e6=0x0,_0x5da9aa=events['length'];_0x4cb7e6<_0x5da9aa;_0x4cb7e6++){var _0x334cb2=events[_0x4cb7e6];var _0x45daa5=createListener(_0xfb26('0x5')+_0x334cb2,_0x21de51);MailInteractionEvents['on'](_0x334cb2,_0x45daa5);}}; \ No newline at end of file +var _0x0623=['emit','removeListener','register','length','./mailInteraction.events','remove','update'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0623,0x15b));var _0x3062=function(_0xbf8dc0,_0x2f21d8){_0xbf8dc0=_0xbf8dc0-0x0;var _0x1196a8=_0x0623[_0xbf8dc0];return _0x1196a8;};'use strict';var MailInteractionEvents=require(_0x3062('0x0'));var events=['save',_0x3062('0x1'),_0x3062('0x2')];function createListener(_0xd34ab8,_0x413864){return function(_0x3ad68b){_0x413864[_0x3062('0x3')](_0xd34ab8,_0x3ad68b);};}function removeListener(_0x1f805e,_0x8b207f){return function(){MailInteractionEvents[_0x3062('0x4')](_0x1f805e,_0x8b207f);};}exports[_0x3062('0x5')]=function(_0x5c531e){for(var _0x1ba235=0x0,_0x213a1a=events[_0x3062('0x6')];_0x1ba235<_0x213a1a;_0x1ba235++){var _0x41dbe1=events[_0x1ba235];var _0x2c6995=createListener('mailInteraction:'+_0x41dbe1,_0x5c531e);MailInteractionEvents['on'](_0x41dbe1,_0x2c6995);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index ea566cb..cfe61ec 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 _0x5d58=['index','get','/describe','describe','/:id/download','tracked','mail','mailmessage:create','create','put','/:id','accept','/:id/reject','reject','delete','destroy','exports','Router','../../components/auth/service','../../config/environment','./mailMessage.controller','isAuthenticated'];(function(_0x1aa902,_0x51d03e){var _0xfdc201=function(_0x38bc71){while(--_0x38bc71){_0x1aa902['push'](_0x1aa902['shift']());}};_0xfdc201(++_0x51d03e);}(_0x5d58,0x187));var _0x85d5=function(_0x2c6949,_0x56900a){_0x2c6949=_0x2c6949-0x0;var _0x13cc33=_0x5d58[_0x2c6949];return _0x13cc33;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85d5('0x0')]();var auth=require(_0x85d5('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0x85d5('0x2'));var controller=require(_0x85d5('0x3'));router['get']('/',auth[_0x85d5('0x4')](),controller[_0x85d5('0x5')]);router[_0x85d5('0x6')](_0x85d5('0x7'),auth['isAuthenticated'](),controller[_0x85d5('0x8')]);router[_0x85d5('0x6')]('/:id',auth[_0x85d5('0x4')](),controller['show']);router[_0x85d5('0x6')](_0x85d5('0x9'),auth[_0x85d5('0x4')](),controller['download']);router['post']('/',auth['isAuthenticated'](),interaction[_0x85d5('0xa')](_0x85d5('0xb'),_0x85d5('0xc')),controller[_0x85d5('0xd')]);router[_0x85d5('0xe')](_0x85d5('0xf'),auth[_0x85d5('0x4')](),controller['update']);router['put']('/:id/accept',auth[_0x85d5('0x4')](),controller[_0x85d5('0x10')]);router[_0x85d5('0xe')](_0x85d5('0x11'),auth[_0x85d5('0x4')](),controller[_0x85d5('0x12')]);router[_0x85d5('0x13')]('/:id',auth[_0x85d5('0x4')](),controller[_0x85d5('0x14')]);module[_0x85d5('0x15')]=router; \ No newline at end of file +var _0xee14=['../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/download','download','post','tracked','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x44c37d,_0x19119f){var _0x29e087=function(_0x327fca){while(--_0x327fca){_0x44c37d['push'](_0x44c37d['shift']());}};_0x29e087(++_0x19119f);}(_0xee14,0x13a));var _0x4ee1=function(_0x5371c4,_0x1a6457){_0x5371c4=_0x5371c4-0x0;var _0x44fb13=_0xee14[_0x5371c4];return _0x44fb13;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4ee1('0x0'));var timeout=require(_0x4ee1('0x1'));var express=require(_0x4ee1('0x2'));var router=express[_0x4ee1('0x3')]();var auth=require(_0x4ee1('0x4'));var interaction=require(_0x4ee1('0x5'));var config=require(_0x4ee1('0x6'));var controller=require(_0x4ee1('0x7'));router[_0x4ee1('0x8')]('/',auth['isAuthenticated'](),controller[_0x4ee1('0x9')]);router['get'](_0x4ee1('0xa'),auth[_0x4ee1('0xb')](),controller[_0x4ee1('0xc')]);router[_0x4ee1('0x8')](_0x4ee1('0xd'),auth[_0x4ee1('0xb')](),controller['show']);router[_0x4ee1('0x8')](_0x4ee1('0xe'),auth['isAuthenticated'](),controller[_0x4ee1('0xf')]);router[_0x4ee1('0x10')]('/',auth[_0x4ee1('0xb')](),interaction[_0x4ee1('0x11')]('mail',_0x4ee1('0x12')),controller[_0x4ee1('0x13')]);router[_0x4ee1('0x14')](_0x4ee1('0xd'),auth[_0x4ee1('0xb')](),controller[_0x4ee1('0x15')]);router['put'](_0x4ee1('0x16'),auth[_0x4ee1('0xb')](),controller[_0x4ee1('0x17')]);router[_0x4ee1('0x14')](_0x4ee1('0x18'),auth[_0x4ee1('0xb')](),controller[_0x4ee1('0x19')]);router[_0x4ee1('0x1a')](_0x4ee1('0xd'),auth['isAuthenticated'](),controller[_0x4ee1('0x1b')]);module[_0x4ee1('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index bfa9089..e8e2b0d 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 _0xec07=['BOOLEAN','ENUM','out','STRING','long','DATE','sequelize','lodash','exports','TEXT'];(function(_0x1b394d,_0x5659e7){var _0x30f22c=function(_0x43d088){while(--_0x43d088){_0x1b394d['push'](_0x1b394d['shift']());}};_0x30f22c(++_0x5659e7);}(_0xec07,0x92));var _0x7ec0=function(_0x1e5ad9,_0x314730){_0x1e5ad9=_0x1e5ad9-0x0;var _0x2c553b=_0xec07[_0x1e5ad9];return _0x2c553b;};'use strict';var Sequelize=require(_0x7ec0('0x0'));var _=require(_0x7ec0('0x1'));module[_0x7ec0('0x2')]={'body':{'type':Sequelize[_0x7ec0('0x3')]('long'),'allowNull':![]},'read':{'type':Sequelize[_0x7ec0('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7ec0('0x5')]('in',_0x7ec0('0x6')),'defaultValue':_0x7ec0('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x7ec0('0x7')]},'to':{'type':Sequelize[_0x7ec0('0x3')](_0x7ec0('0x8'))},'cc':{'type':Sequelize[_0x7ec0('0x3')](_0x7ec0('0x8'))},'bcc':{'type':Sequelize[_0x7ec0('0x3')](_0x7ec0('0x8'))},'subject':{'type':Sequelize[_0x7ec0('0x3')]},'sentAt':{'type':Sequelize[_0x7ec0('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x7ec0('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x7ec0('0x3')](_0x7ec0('0x8'))},'originCc':{'type':Sequelize[_0x7ec0('0x3')](_0x7ec0('0x8'))}}; \ No newline at end of file +var _0x92af=['out','STRING','TEXT','DATE','INTEGER','sequelize','lodash','exports','long','BOOLEAN','ENUM'];(function(_0x34354c,_0x11d5e2){var _0x3c17b1=function(_0x57b7fb){while(--_0x57b7fb){_0x34354c['push'](_0x34354c['shift']());}};_0x3c17b1(++_0x11d5e2);}(_0x92af,0x118));var _0xf92a=function(_0x4925c3,_0xb467c4){_0x4925c3=_0x4925c3-0x0;var _0x2cec31=_0x92af[_0x4925c3];return _0x2cec31;};'use strict';var Sequelize=require(_0xf92a('0x0'));var _=require(_0xf92a('0x1'));module[_0xf92a('0x2')]={'body':{'type':Sequelize['TEXT'](_0xf92a('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf92a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf92a('0x5')]('in',_0xf92a('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xf92a('0x7')]},'to':{'type':Sequelize[_0xf92a('0x8')](_0xf92a('0x3'))},'cc':{'type':Sequelize['TEXT'](_0xf92a('0x3'))},'bcc':{'type':Sequelize[_0xf92a('0x8')](_0xf92a('0x3'))},'subject':{'type':Sequelize[_0xf92a('0x8')]},'sentAt':{'type':Sequelize[_0xf92a('0x9')]},'attach':{'type':Sequelize[_0xf92a('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xf92a('0x9')]},'originTo':{'type':Sequelize[_0xf92a('0x8')]('long')},'originCc':{'type':Sequelize[_0xf92a('0x8')](_0xf92a('0x3'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index f759233..10f3988 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 _0xe14b=['lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','send','index','MailMessage','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','map','key','VIRTUAL','field','merge','options','includeAll','findAll','rows','include','find','body','params','destroy','describe','create','out','secret','MailAccount','findOne','MailAccountId','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','name','join','root','server/files/attachments','SendMail','sendMail','messageId','mail-interactions','accept','mail','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','channel','EventManager','acceptmessage','info','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SIP/%s','event','download','toString','server','tmp','files','message-%s.eml','subject','createdAt','Attachment','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Attachments','basename','push','readFileSync','log','err','unlinkSync','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs'];(function(_0x2f3369,_0x56e0bc){var _0x27fa5f=function(_0x4b2319){while(--_0x4b2319){_0x2f3369['push'](_0x2f3369['shift']());}};_0x27fa5f(++_0x56e0bc);}(_0xe14b,0x93));var _0xbe14=function(_0x55dc7c,_0x108898){_0x55dc7c=_0x55dc7c-0x0;var _0x27873f=_0xe14b[_0x55dc7c];return _0x27873f;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var authService=require(_0xbe14('0xe'));var hardwareService=require(_0xbe14('0xf'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xbe14('0x10'))(_0xbe14('0x11'));var utils=require('../../config/utils');var config=require(_0xbe14('0x12'));var db=require(_0xbe14('0x13'))['db'];config[_0xbe14('0x14')]=_[_0xbe14('0x15')](config[_0xbe14('0x14')],{'host':_0xbe14('0x16'),'port':0x18eb});var socket=require(_0xbe14('0x17'))(new Redis(config[_0xbe14('0x14')]));require(_0xbe14('0x18'))[_0xbe14('0x19')](socket);var jayson=require(_0xbe14('0x1a'));var client=jayson[_0xbe14('0x1b')][_0xbe14('0x1c')]({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson[_0xbe14('0x1b')][_0xbe14('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xf4ac9,_0x37ce4e,_0x4e8f34,_0x21c789){return new BPromise(function(_0xe9c3ec,_0xfd7b8f){var _0x123ede=_0x21c789||client;return _0x123ede[_0xbe14('0x1d')](_0xf4ac9,_0x4e8f34)[_0xbe14('0x1e')](function(_0x17ae86){logger['info'](_0xbe14('0x1f'),_0x37ce4e,_0xbe14('0x20'));logger[_0xbe14('0x21')](_0xbe14('0x22'),_0x37ce4e,_0xbe14('0x20'),JSON[_0xbe14('0x23')](_0x17ae86));if(_0x17ae86['error']){if(_0x17ae86[_0xbe14('0x24')][_0xbe14('0x25')]===0x1f4){logger[_0xbe14('0x24')](_0xbe14('0x1f'),_0x37ce4e,_0x17ae86[_0xbe14('0x24')]['message']);return _0xfd7b8f(_0x17ae86[_0xbe14('0x24')]['message']);}logger[_0xbe14('0x24')]('MailMessage,\x20%s,\x20%s',_0x37ce4e,_0x17ae86[_0xbe14('0x24')]['message']);return _0xe9c3ec(_0x17ae86[_0xbe14('0x24')][_0xbe14('0x26')]);}else{logger['info'](_0xbe14('0x1f'),_0x37ce4e,'request\x20sent');_0xe9c3ec(_0x17ae86[_0xbe14('0x27')]['message']);}})[_0xbe14('0x28')](function(_0x5fa043){logger[_0xbe14('0x24')](_0xbe14('0x1f'),_0x37ce4e,_0x5fa043);_0xfd7b8f(_0x5fa043);});});}function respondWithStatusCode(_0x15ef02,_0x2703f5){_0x2703f5=_0x2703f5||0xcc;return function(_0x55d001){if(_0x55d001){return _0x15ef02[_0xbe14('0x29')](_0x2703f5);}return _0x15ef02[_0xbe14('0x2a')](_0x2703f5)[_0xbe14('0x2b')]();};}function respondWithResult(_0x169369,_0x5dd475){_0x5dd475=_0x5dd475||0xc8;return function(_0x16f884){if(_0x16f884){return _0x169369[_0xbe14('0x2a')](_0x5dd475)['json'](_0x16f884);}};}function respondWithFilteredResult(_0x3c3613,_0x3b3e84){return function(_0x1c7cc7){if(_0x1c7cc7){var _0x19252f=_0x1c7cc7[_0xbe14('0x2c')],_0x34d648=_0x3b3e84[_0xbe14('0x2d')],_0x36d4b2=_0x3b3e84[_0xbe14('0x2d')]+_0x3b3e84[_0xbe14('0x2e')],_0x31a664;if(_0x36d4b2>=_0x19252f){_0x36d4b2=_0x19252f;_0x31a664=0xc8;}else{_0x31a664=0xce;}_0x3c3613[_0xbe14('0x2a')](_0x31a664);return _0x3c3613[_0xbe14('0x2f')](_0xbe14('0x30'),_0x34d648+'-'+_0x36d4b2+'/'+_0x19252f)[_0xbe14('0x31')](_0x1c7cc7);}return null;};}function patchUpdates(_0xe6feb2){return function(_0x6ba36c){try{jsonpatch[_0xbe14('0x32')](_0x6ba36c,_0xe6feb2,!![]);}catch(_0x29e76a){return BPromise[_0xbe14('0x33')](_0x29e76a);}return _0x6ba36c['save']();};}function saveUpdates(_0x2e33e1,_0x499793){return function(_0x58f8de){if(_0x58f8de){return _0x58f8de[_0xbe14('0x34')](_0x2e33e1)['then'](function(_0x243524){return _0x243524;});}return null;};}function removeEntity(_0x345b0,_0x52a25c){return function(_0x50cb09){if(_0x50cb09){return _0x50cb09['destroy']()[_0xbe14('0x1e')](function(){_0x345b0[_0xbe14('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46c570,_0x1faf3e){return function(_0x452635){if(!_0x452635){_0x46c570[_0xbe14('0x29')](0x194);}return _0x452635;};}function handleError(_0x29c23e,_0x5ef1e5){_0x5ef1e5=_0x5ef1e5||0x1f4;return function(_0x591a36){logger[_0xbe14('0x24')](_0x591a36['stack']);if(_0x591a36['name']){delete _0x591a36['name'];}_0x29c23e[_0xbe14('0x2a')](_0x5ef1e5)[_0xbe14('0x35')](_0x591a36);};}exports[_0xbe14('0x36')]=function(_0x3dbacb,_0x172e79){var _0x29356f={},_0xcdc50={},_0x10ec3c={'count':0x0,'rows':[]};var _0x2d9c12=db[_0xbe14('0x37')][_0xbe14('0x38')];_0xcdc50[_0xbe14('0x39')]=_['keys'](_0x2d9c12);_0xcdc50['query']=_[_0xbe14('0x3a')](_0x3dbacb[_0xbe14('0x3b')]);_0xcdc50[_0xbe14('0x3c')]=_['intersection'](_0xcdc50[_0xbe14('0x39')],_0xcdc50[_0xbe14('0x3b')]);_0x29356f[_0xbe14('0x3d')]=_[_0xbe14('0x3e')](_0xcdc50[_0xbe14('0x39')],qs[_0xbe14('0x3f')](_0x3dbacb[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0x29356f[_0xbe14('0x3d')]=_0x29356f['attributes'][_0xbe14('0x40')]?_0x29356f[_0xbe14('0x3d')]:_0xcdc50[_0xbe14('0x39')];if(!_0x3dbacb[_0xbe14('0x3b')][_0xbe14('0x41')](_0xbe14('0x42'))){_0x29356f['limit']=qs[_0xbe14('0x2e')](_0x3dbacb[_0xbe14('0x3b')][_0xbe14('0x2e')]);_0x29356f[_0xbe14('0x2d')]=qs['offset'](_0x3dbacb['query'][_0xbe14('0x2d')]);}_0x29356f[_0xbe14('0x43')]=qs[_0xbe14('0x44')](_0x3dbacb['query']['sort']);_0x29356f[_0xbe14('0x45')]=qs['filters'](_['pick'](_0x3dbacb[_0xbe14('0x3b')],_0xcdc50[_0xbe14('0x3c')]));if(_0x3dbacb[_0xbe14('0x3b')]['filter']){_0x29356f['where']=_['merge'](_0x29356f[_0xbe14('0x45')],{'$or':_[_0xbe14('0x46')](_0x2d9c12,function(_0x1085d2){if(_0x1085d2['type'][_0xbe14('0x47')]!==_0xbe14('0x48')){var _0x32f22e={};_0x32f22e[_0x1085d2[_0xbe14('0x49')]]={'$like':'%'+_0x3dbacb['query']['filter']+'%'};return _0x32f22e;}})});}_0x29356f=_[_0xbe14('0x4a')]({},_0x29356f,_0x3dbacb[_0xbe14('0x4b')]);var _0x24559b={'where':_0x29356f[_0xbe14('0x45')]};return db[_0xbe14('0x37')]['count'](_0x24559b)['then'](function(_0x46af81){_0x10ec3c[_0xbe14('0x2c')]=_0x46af81;if(_0x3dbacb[_0xbe14('0x3b')][_0xbe14('0x4c')]){_0x29356f['include']=[{'all':!![]}];}return db[_0xbe14('0x37')][_0xbe14('0x4d')](_0x29356f);})['then'](function(_0x396e40){_0x10ec3c[_0xbe14('0x4e')]=_0x396e40;return _0x10ec3c;})[_0xbe14('0x1e')](respondWithFilteredResult(_0x172e79,_0x29356f))[_0xbe14('0x28')](handleError(_0x172e79,null));};exports['show']=function(_0x594f65,_0x1b0a2e){var _0x29564b={'raw':!![],'where':{'id':_0x594f65['params']['id']}},_0x4a1a37={};_0x4a1a37[_0xbe14('0x39')]=_[_0xbe14('0x3a')](db[_0xbe14('0x37')][_0xbe14('0x38')]);_0x4a1a37[_0xbe14('0x3b')]=_[_0xbe14('0x3a')](_0x594f65[_0xbe14('0x3b')]);_0x4a1a37['filters']=_[_0xbe14('0x3e')](_0x4a1a37[_0xbe14('0x39')],_0x4a1a37[_0xbe14('0x3b')]);_0x29564b[_0xbe14('0x3d')]=_[_0xbe14('0x3e')](_0x4a1a37['model'],qs[_0xbe14('0x3f')](_0x594f65[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0x29564b[_0xbe14('0x3d')]=_0x29564b[_0xbe14('0x3d')][_0xbe14('0x40')]?_0x29564b['attributes']:_0x4a1a37['model'];if(_0x594f65[_0xbe14('0x3b')][_0xbe14('0x4c')]){_0x29564b[_0xbe14('0x4f')]=[{'all':!![]}];}_0x29564b=_['merge']({},_0x29564b,_0x594f65['options']);return db[_0xbe14('0x37')][_0xbe14('0x50')](_0x29564b)['then'](handleEntityNotFound(_0x1b0a2e,null))[_0xbe14('0x1e')](respondWithResult(_0x1b0a2e,null))[_0xbe14('0x28')](handleError(_0x1b0a2e,null));};exports['update']=function(_0x28f995,_0x4a40d2){if(_0x28f995[_0xbe14('0x51')]['id']){delete _0x28f995[_0xbe14('0x51')]['id'];}return db[_0xbe14('0x37')]['find']({'where':{'id':_0x28f995[_0xbe14('0x52')]['id']}})[_0xbe14('0x1e')](handleEntityNotFound(_0x4a40d2,null))['then'](saveUpdates(_0x28f995[_0xbe14('0x51')],null))[_0xbe14('0x1e')](respondWithResult(_0x4a40d2,null))[_0xbe14('0x28')](handleError(_0x4a40d2,null));};exports[_0xbe14('0x53')]=function(_0x49322f,_0x4f06a3){return db[_0xbe14('0x37')][_0xbe14('0x50')]({'where':{'id':_0x49322f[_0xbe14('0x52')]['id']}})[_0xbe14('0x1e')](handleEntityNotFound(_0x4f06a3,null))[_0xbe14('0x1e')](removeEntity(_0x4f06a3,null))[_0xbe14('0x28')](handleError(_0x4f06a3,null));};exports[_0xbe14('0x54')]=function(_0x56ab61,_0x72c875){return db[_0xbe14('0x37')][_0xbe14('0x54')]()[_0xbe14('0x1e')](respondWithResult(_0x72c875,null))[_0xbe14('0x28')](handleError(_0x72c875,null));};exports[_0xbe14('0x55')]=function(_0xd8f78f,_0x32df3c){return db[_0xbe14('0x37')][_0xbe14('0x55')](_0xd8f78f[_0xbe14('0x51')])['then'](function(_0x56bcd3){if(_0x56bcd3){if(_0x56bcd3['direction']===_0xbe14('0x56')&&!_0x56bcd3[_0xbe14('0x57')]){return db[_0xbe14('0x58')][_0xbe14('0x59')]({'where':{'id':_0x56bcd3[_0xbe14('0x5a')]},'include':[{'model':db[_0xbe14('0x5b')],'as':_0xbe14('0x5c'),'raw':!![]}]})[_0xbe14('0x1e')](function(_0x31d015){if(_0x31d015&&_0x31d015[_0xbe14('0x5c')]){var _0x603816={'tls':{'rejectUnauthorized':![]}};if(_[_0xbe14('0x5d')](_0x31d015[_0xbe14('0x5c')][_0xbe14('0x5e')])){_0x603816[_0xbe14('0x5f')]=_0x31d015[_0xbe14('0x5c')][_0xbe14('0x5f')];_0x603816[_0xbe14('0x60')]=_0x31d015[_0xbe14('0x5c')][_0xbe14('0x60')];_0x603816['secure']=_0x31d015[_0xbe14('0x5c')][_0xbe14('0x61')];if(_0x31d015[_0xbe14('0x5c')][_0xbe14('0x62')]){_0x603816[_0xbe14('0x63')]={'user':_0x31d015[_0xbe14('0x5c')][_0xbe14('0x64')],'pass':_0x31d015[_0xbe14('0x5c')][_0xbe14('0x65')]};}}else{_0x603816[_0xbe14('0x5e')]=_0x31d015['Smtp'][_0xbe14('0x5e')];_0x603816[_0xbe14('0x63')]={'user':_0x31d015[_0xbe14('0x5c')][_0xbe14('0x64')],'pass':_0x31d015[_0xbe14('0x5c')]['pass']};_0x603816[_0xbe14('0x61')]=_0x31d015[_0xbe14('0x5c')][_0xbe14('0x61')];}if(_0xd8f78f[_0xbe14('0x51')][_0xbe14('0x66')]&&_0xd8f78f['body'][_0xbe14('0x66')][_0xbe14('0x40')]){for(var _0x7ea146=0x0;_0x7ea146<_0xd8f78f[_0xbe14('0x51')][_0xbe14('0x66')][_0xbe14('0x40')];_0x7ea146+=0x1){_0xd8f78f[_0xbe14('0x51')][_0xbe14('0x66')][_0x7ea146]={'filename':_0xd8f78f['body'][_0xbe14('0x66')][_0x7ea146][_0xbe14('0x67')],'path':path[_0xbe14('0x68')](config[_0xbe14('0x69')],_0xbe14('0x6a'),_0xd8f78f[_0xbe14('0x51')][_0xbe14('0x66')][_0x7ea146]['basename'])};}}return{'account':_0x603816,'message':_0xd8f78f['body']};}})[_0xbe14('0x1e')](function(_0x3c2b58){if(_0x3c2b58){return respondWithRpcPromise(_0xbe14('0x6b'),_0xbe14('0x6c'),_0x3c2b58,client9003)[_0xbe14('0x1e')](function(_0x28cade){return _0x56bcd3[_0xbe14('0x34')]({'read':!![],'messageId':_0x28cade[_0xbe14('0x6d')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0xbe14('0x28')](function(_0x1c18b6){logger[_0xbe14('0x24')]('%s',JSON['stringify'](_0x1c18b6));return _0x56bcd3;});}return _0x56bcd3;});}return _0x56bcd3;}})[_0xbe14('0x1e')](respondWithResult(_0x32df3c,0xc9))[_0xbe14('0x28')](handleError(_0x32df3c,null));};var interaction_log=require(_0xbe14('0x10'))(_0xbe14('0x6e'));exports[_0xbe14('0x6f')]=function(_0x1ef09b,_0x12e23a,_0x5b5c37){var _0x43b817={'channel':_0xbe14('0x70')};if(_0x1ef09b[_0xbe14('0x51')]['id']){delete _0x1ef09b[_0xbe14('0x51')]['id'];}_0x1ef09b[_0xbe14('0x51')][_0xbe14('0x71')]=!![];_0x1ef09b[_0xbe14('0x51')]['readAt']=moment()[_0xbe14('0x72')](_0xbe14('0x73'));_0x1ef09b[_0xbe14('0x51')][_0xbe14('0x74')]=_0x1ef09b[_0xbe14('0x51')][_0xbe14('0x74')]||_0x1ef09b[_0xbe14('0x64')]['id'];return db[_0xbe14('0x37')]['find']({'where':{'id':_0x1ef09b[_0xbe14('0x52')]['id'],'UserId':null},'include':[{'model':db[_0xbe14('0x75')],'as':_0xbe14('0x76')}]})[_0xbe14('0x1e')](handleEntityNotFound(_0x12e23a,null))[_0xbe14('0x1e')](saveUpdates(_0x1ef09b[_0xbe14('0x51')],null))['then'](function(_0x176099){if(_0x176099){_0x43b817[_0xbe14('0x26')]=_0x176099[_0xbe14('0x77')]({'plain':!![]});return db[_0xbe14('0x78')]['find']({'where':{'id':_0x176099[_0xbe14('0x79')]}});}return null;})[_0xbe14('0x1e')](handleEntityNotFound(_0x12e23a,null))[_0xbe14('0x1e')](function(_0x1e7770){if(_0x1e7770){return _0x1e7770[_0xbe14('0x34')]({'UserId':_0x1ef09b[_0xbe14('0x51')][_0xbe14('0x74')],'read1stAt':_['isNil'](_0x1e7770[_0xbe14('0x7a')])?moment()['format'](_0xbe14('0x73')):undefined});}return null;})['then'](function(_0x389822){if(_0x389822){_0x43b817[_0xbe14('0x7b')]=_0x389822[_0xbe14('0x77')]({'plain':!![]});interaction_log['info'](_0xbe14('0x7c'),_0x1ef09b[_0xbe14('0x64')]['id'],_0x1ef09b[_0xbe14('0x64')]['name'],_0x1ef09b[_0xbe14('0x64')][_0xbe14('0x7d')],_0x43b817[_0xbe14('0x7b')]['id'],_0x1ef09b[_0xbe14('0x51')]?JSON['stringify'](_0x1ef09b[_0xbe14('0x51')]):_0xbe14('0x7e'));return respondWithRpcPromise(_0xbe14('0x7f'),_0xbe14('0x80'),_0x43b817);}return null;})[_0xbe14('0x1e')](function(_0x2b9732){if(_0x2b9732){if(_0x1ef09b[_0xbe14('0x51')]['manual']){_0x43b817[_0xbe14('0x26')][_0xbe14('0x81')]=util[_0xbe14('0x72')]('SIP/%s',_0x1ef09b[_0xbe14('0x64')][_0xbe14('0x67')]);_0x43b817[_0xbe14('0x26')]['channel']=_0x43b817[_0xbe14('0x82')];_0x43b817[_0xbe14('0x26')]['event']=_0xbe14('0x6f');return respondWithRpcPromise('EventManager',_0xbe14('0x83'),{'event':_0xbe14('0x84'),'message':_0x43b817['message']},client9002)['then'](function(){return _0x43b817;});}return _0x43b817;}return null;})[_0xbe14('0x1e')](respondWithResult(_0x12e23a,null))[_0xbe14('0x28')](handleError(_0x12e23a,null));};var interaction_log=require(_0xbe14('0x10'))('mail-interactions');exports[_0xbe14('0x33')]=function(_0x30c03b,_0x320e6c,_0x32c92c){var _0x5ee624={'agent':{},'channel':'mail'};if(_0x30c03b[_0xbe14('0x51')]['id']){delete _0x30c03b[_0xbe14('0x51')]['id'];}_0x30c03b[_0xbe14('0x51')][_0xbe14('0x74')]=_0x30c03b[_0xbe14('0x51')][_0xbe14('0x74')]||_0x30c03b[_0xbe14('0x64')]['id'];_0x5ee624['agent']['id']=_0x30c03b[_0xbe14('0x51')]['UserId'];return db[_0xbe14('0x37')][_0xbe14('0x50')]({'where':{'id':_0x30c03b[_0xbe14('0x52')]['id'],'UserId':null}})[_0xbe14('0x1e')](handleEntityNotFound(_0x320e6c,null))['then'](function(_0x1e160b){if(_0x1e160b){_0x5ee624[_0xbe14('0x26')]=_0x1e160b[_0xbe14('0x77')]({'plain':!![]});return db['MailInteraction'][_0xbe14('0x50')]({'where':{'id':_0x1e160b[_0xbe14('0x79')]}});}return null;})[_0xbe14('0x1e')](handleEntityNotFound(_0x320e6c,null))[_0xbe14('0x1e')](function(_0x26d3ae){if(_0x26d3ae){_0x5ee624[_0xbe14('0x7b')]=_0x26d3ae[_0xbe14('0x77')]({'plain':!![]});interaction_log[_0xbe14('0x85')](_0xbe14('0x86'),_0x30c03b[_0xbe14('0x64')]['id'],_0x30c03b[_0xbe14('0x64')][_0xbe14('0x67')],_0x30c03b[_0xbe14('0x64')][_0xbe14('0x7d')],_0x5ee624[_0xbe14('0x7b')]['id'],_0x30c03b[_0xbe14('0x51')]?JSON[_0xbe14('0x23')](_0x30c03b[_0xbe14('0x51')]):_0xbe14('0x7e'));return respondWithRpcPromise(_0xbe14('0x87'),'rejectMessage',_0x5ee624);}return null;})[_0xbe14('0x1e')](function(_0x5af913){if(_0x5af913){_0x5af913[_0xbe14('0x26')][_0xbe14('0x81')]=util[_0xbe14('0x72')](_0xbe14('0x88'),_0x30c03b[_0xbe14('0x64')]['name']);_0x5af913['message'][_0xbe14('0x82')]=_0x5ee624[_0xbe14('0x82')];_0x5af913[_0xbe14('0x26')][_0xbe14('0x89')]='reject';respondWithRpcPromise(_0xbe14('0x83'),_0xbe14('0x83'),{'event':'rejectmessage','message':_0x5af913[_0xbe14('0x26')]},client9002);return _0x5ee624;}return null;})[_0xbe14('0x1e')](respondWithResult(_0x320e6c,null))[_0xbe14('0x28')](handleError(_0x320e6c,null));};exports[_0xbe14('0x8a')]=function(_0x4f9936,_0x3c5241){var _0x562559=moment()['unix']()[_0xbe14('0x8b')]();var _0x8d506a=path[_0xbe14('0x68')](config[_0xbe14('0x69')],_0xbe14('0x8c'),'files',_0xbe14('0x8d'));var _0x1584f6=path['join'](config['root'],_0xbe14('0x8c'),_0xbe14('0x8e'),'attachments');var _0xddbc1c=util['format'](_0xbe14('0x8f'),_0x562559);return db['MailMessage'][_0xbe14('0x50')]({'where':{'id':_0x4f9936['params']['id']},'attributes':['id',_0xbe14('0x51'),'from','to','cc',_0xbe14('0x90'),_0xbe14('0x91')],'include':_0x4f9936['query']['attachments']?[{'model':db[_0xbe14('0x92')],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x3c5241,null))[_0xbe14('0x1e')](function(_0x2ca7c9){if(_0x2ca7c9){var _0x24c198=_0x2ca7c9;var _0x11c341={'from':_0x24c198[_0xbe14('0x93')],'to':_0x24c198['to'],'subject':_0x24c198[_0xbe14('0x90')],'html':_0x24c198[_0xbe14('0x51')],'headers':{'Date':moment(_0x24c198['createdAt'])[_0xbe14('0x72')](_0xbe14('0x94'))},'attachments':[]};return new BPromise(function(_0x4c2c49,_0x1445ce){if(_0x2ca7c9['Attachments']){for(var _0x26372a=0x0;_0x26372a<_0x2ca7c9[_0xbe14('0x95')][_0xbe14('0x40')];_0x26372a++){var _0x501a53=_0x2ca7c9[_0xbe14('0x95')][_0x26372a];var _0x38819a=path['join'](_0x1584f6,_0x501a53[_0xbe14('0x96')]);if(fs['existsSync'](_0x38819a)){_0x11c341[_0xbe14('0x66')][_0xbe14('0x97')]({'name':_0x501a53[_0xbe14('0x67')],'contentType':_0x501a53['type'],'data':fs[_0xbe14('0x98')](_0x38819a)});}}}emlformat['build'](_0x11c341,function(_0x39f896,_0x5774d2){if(_0x39f896)return _0x1445ce(_0x39f896);fs['writeFileSync'](path[_0xbe14('0x68')](_0x8d506a,_0xddbc1c),_0x5774d2);return _0x4c2c49(_0x5774d2);});});}})['then'](function(_0xab74eb){if(_0xab74eb){return _0x3c5241['download'](path[_0xbe14('0x68')](_0x8d506a,_0xddbc1c),_0xddbc1c,function(_0x20763b){if(_0x20763b){console[_0xbe14('0x99')](_0xbe14('0x9a'),_0x20763b);}else{fs[_0xbe14('0x9b')](path[_0xbe14('0x68')](_0x8d506a,_0xddbc1c));}});}})[_0xbe14('0x28')](handleError(_0x3c5241,null));}; \ No newline at end of file +var _0x34e8=['../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./mailMessage.socket','register','jayson/promise','http','client','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','destroy','stack','name','send','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','key','VIRTUAL','field','options','MailMessage','includeAll','include','rows','catch','show','params','find','body','describe','create','out','secret','MailAccount','findOne','MailAccountId','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','basename','SendMail','sendMail','mail-interactions','mail','readAt','format','UserId','CmContact','Contact','get','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','manual','interface','channel','event','accept','EventManager','agent','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','rejectmessage','unix','toString','server','files','tmp','subject','createdAt','Attachment','Attachments','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','existsSync','push','build','writeFileSync','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis'];(function(_0xbd5f4a,_0x5806eb){var _0x27cc55=function(_0x2e4a73){while(--_0x2e4a73){_0xbd5f4a['push'](_0xbd5f4a['shift']());}};_0x27cc55(++_0x5806eb);}(_0x34e8,0x12c));var _0x834e=function(_0x3a7517,_0x3a95f2){_0x3a7517=_0x3a7517-0x0;var _0x2f744f=_0x34e8[_0x3a7517];return _0x2f744f;};'use strict';var pdf=require(_0x834e('0x0'));var emlformat=require(_0x834e('0x1'));var rimraf=require(_0x834e('0x2'));var zipdir=require(_0x834e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x834e('0x4'));var moment=require(_0x834e('0x5'));var BPromise=require(_0x834e('0x6'));var Mustache=require(_0x834e('0x7'));var util=require(_0x834e('0x8'));var path=require(_0x834e('0x9'));var sox=require(_0x834e('0xa'));var csv=require('to-csv');var ejs=require(_0x834e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0x10'));var querystring=require(_0x834e('0x11'));var Papa=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var hardwareService=require(_0x834e('0x14'));var Redis=require(_0x834e('0x15'));var qs=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var db=require(_0x834e('0x1b'))['db'];config[_0x834e('0x1c')]=_['defaults'](config[_0x834e('0x1c')],{'host':_0x834e('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x834e('0x1c')]));require(_0x834e('0x1e'))[_0x834e('0x1f')](socket);var jayson=require(_0x834e('0x20'));var client=jayson['client'][_0x834e('0x21')]({'port':0x232c});var client9003=jayson[_0x834e('0x22')]['http']({'port':0x232b});var client9002=jayson[_0x834e('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38a8cd,_0x36d443,_0x478afe,_0x43ac41){return new BPromise(function(_0x22106e,_0x370fb5){var _0x50b3f6=_0x43ac41||client;return _0x50b3f6[_0x834e('0x23')](_0x38a8cd,_0x478afe)[_0x834e('0x24')](function(_0x34e41a){logger[_0x834e('0x25')](_0x834e('0x26'),_0x36d443,_0x834e('0x27'));logger[_0x834e('0x28')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x36d443,_0x834e('0x27'),JSON[_0x834e('0x29')](_0x34e41a));if(_0x34e41a[_0x834e('0x2a')]){if(_0x34e41a[_0x834e('0x2a')]['code']===0x1f4){logger[_0x834e('0x2a')](_0x834e('0x26'),_0x36d443,_0x34e41a['error'][_0x834e('0x2b')]);return _0x370fb5(_0x34e41a[_0x834e('0x2a')][_0x834e('0x2b')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x36d443,_0x34e41a[_0x834e('0x2a')][_0x834e('0x2b')]);return _0x22106e(_0x34e41a['error'][_0x834e('0x2b')]);}else{logger[_0x834e('0x25')]('MailMessage,\x20%s,\x20%s',_0x36d443,_0x834e('0x27'));_0x22106e(_0x34e41a[_0x834e('0x2c')][_0x834e('0x2b')]);}})['catch'](function(_0x24fcf7){logger[_0x834e('0x2a')]('MailMessage,\x20%s,\x20%s',_0x36d443,_0x24fcf7);_0x370fb5(_0x24fcf7);});});}function respondWithStatusCode(_0x5bef62,_0x1e713a){_0x1e713a=_0x1e713a||0xcc;return function(_0x508a1d){if(_0x508a1d){return _0x5bef62[_0x834e('0x2d')](_0x1e713a);}return _0x5bef62[_0x834e('0x2e')](_0x1e713a)[_0x834e('0x2f')]();};}function respondWithResult(_0x2cc2eb,_0x3cd928){_0x3cd928=_0x3cd928||0xc8;return function(_0x130cc5){if(_0x130cc5){return _0x2cc2eb['status'](_0x3cd928)['json'](_0x130cc5);}};}function respondWithFilteredResult(_0x4dc64a,_0x58c1d7){return function(_0x2c7a8d){if(_0x2c7a8d){var _0x567cea=_0x2c7a8d[_0x834e('0x30')],_0x106d6a=_0x58c1d7[_0x834e('0x31')],_0x5dacc1=_0x58c1d7[_0x834e('0x31')]+_0x58c1d7[_0x834e('0x32')],_0xb5bc06;if(_0x5dacc1>=_0x567cea){_0x5dacc1=_0x567cea;_0xb5bc06=0xc8;}else{_0xb5bc06=0xce;}_0x4dc64a[_0x834e('0x2e')](_0xb5bc06);return _0x4dc64a[_0x834e('0x33')](_0x834e('0x34'),_0x106d6a+'-'+_0x5dacc1+'/'+_0x567cea)[_0x834e('0x35')](_0x2c7a8d);}return null;};}function patchUpdates(_0x493289){return function(_0xef9ec2){try{jsonpatch['apply'](_0xef9ec2,_0x493289,!![]);}catch(_0x2c75c2){return BPromise[_0x834e('0x36')](_0x2c75c2);}return _0xef9ec2[_0x834e('0x37')]();};}function saveUpdates(_0x2b3418,_0x444366){return function(_0x4689c2){if(_0x4689c2){return _0x4689c2[_0x834e('0x38')](_0x2b3418)[_0x834e('0x24')](function(_0x358c31){return _0x358c31;});}return null;};}function removeEntity(_0x12b2bc,_0x5bd232){return function(_0x2a3c7f){if(_0x2a3c7f){return _0x2a3c7f[_0x834e('0x39')]()[_0x834e('0x24')](function(){_0x12b2bc[_0x834e('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f88ad,_0x379d60){return function(_0x4b12f5){if(!_0x4b12f5){_0x3f88ad['sendStatus'](0x194);}return _0x4b12f5;};}function handleError(_0x59385a,_0x3e58fa){_0x3e58fa=_0x3e58fa||0x1f4;return function(_0x41bf4d){logger[_0x834e('0x2a')](_0x41bf4d[_0x834e('0x3a')]);if(_0x41bf4d[_0x834e('0x3b')]){delete _0x41bf4d[_0x834e('0x3b')];}_0x59385a['status'](_0x3e58fa)[_0x834e('0x3c')](_0x41bf4d);};}exports['index']=function(_0xe103fe,_0x6a3ac){var _0x47abed={},_0x18ac3b={},_0x2f56c7={'count':0x0,'rows':[]};var _0x491c28=db['MailMessage'][_0x834e('0x3d')];_0x18ac3b[_0x834e('0x3e')]=_[_0x834e('0x3f')](_0x491c28);_0x18ac3b[_0x834e('0x40')]=_[_0x834e('0x3f')](_0xe103fe['query']);_0x18ac3b[_0x834e('0x41')]=_['intersection'](_0x18ac3b['model'],_0x18ac3b[_0x834e('0x40')]);_0x47abed['attributes']=_[_0x834e('0x42')](_0x18ac3b[_0x834e('0x3e')],qs[_0x834e('0x43')](_0xe103fe[_0x834e('0x40')][_0x834e('0x43')]));_0x47abed['attributes']=_0x47abed[_0x834e('0x44')][_0x834e('0x45')]?_0x47abed[_0x834e('0x44')]:_0x18ac3b['model'];if(!_0xe103fe[_0x834e('0x40')][_0x834e('0x46')]('nolimit')){_0x47abed[_0x834e('0x32')]=qs['limit'](_0xe103fe[_0x834e('0x40')][_0x834e('0x32')]);_0x47abed['offset']=qs['offset'](_0xe103fe[_0x834e('0x40')][_0x834e('0x31')]);}_0x47abed[_0x834e('0x47')]=qs[_0x834e('0x48')](_0xe103fe[_0x834e('0x40')][_0x834e('0x48')]);_0x47abed[_0x834e('0x49')]=qs['filters'](_[_0x834e('0x4a')](_0xe103fe['query'],_0x18ac3b[_0x834e('0x41')]));if(_0xe103fe['query'][_0x834e('0x4b')]){_0x47abed['where']=_[_0x834e('0x4c')](_0x47abed[_0x834e('0x49')],{'$or':_['map'](_0x491c28,function(_0x39e7b9){if(_0x39e7b9[_0x834e('0x4d')][_0x834e('0x4e')]!==_0x834e('0x4f')){var _0x252ea0={};_0x252ea0[_0x39e7b9[_0x834e('0x50')]]={'$like':'%'+_0xe103fe[_0x834e('0x40')][_0x834e('0x4b')]+'%'};return _0x252ea0;}})});}_0x47abed=_[_0x834e('0x4c')]({},_0x47abed,_0xe103fe[_0x834e('0x51')]);var _0x5f3943={'where':_0x47abed[_0x834e('0x49')]};return db[_0x834e('0x52')]['count'](_0x5f3943)[_0x834e('0x24')](function(_0x42fd90){_0x2f56c7[_0x834e('0x30')]=_0x42fd90;if(_0xe103fe[_0x834e('0x40')][_0x834e('0x53')]){_0x47abed[_0x834e('0x54')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x47abed);})[_0x834e('0x24')](function(_0x1a5444){_0x2f56c7[_0x834e('0x55')]=_0x1a5444;return _0x2f56c7;})[_0x834e('0x24')](respondWithFilteredResult(_0x6a3ac,_0x47abed))[_0x834e('0x56')](handleError(_0x6a3ac,null));};exports[_0x834e('0x57')]=function(_0x1c8e80,_0x43f599){var _0x1419eb={'raw':!![],'where':{'id':_0x1c8e80[_0x834e('0x58')]['id']}},_0x390c45={};_0x390c45[_0x834e('0x3e')]=_[_0x834e('0x3f')](db[_0x834e('0x52')][_0x834e('0x3d')]);_0x390c45[_0x834e('0x40')]=_[_0x834e('0x3f')](_0x1c8e80[_0x834e('0x40')]);_0x390c45[_0x834e('0x41')]=_[_0x834e('0x42')](_0x390c45['model'],_0x390c45[_0x834e('0x40')]);_0x1419eb[_0x834e('0x44')]=_['intersection'](_0x390c45[_0x834e('0x3e')],qs[_0x834e('0x43')](_0x1c8e80['query'][_0x834e('0x43')]));_0x1419eb[_0x834e('0x44')]=_0x1419eb[_0x834e('0x44')][_0x834e('0x45')]?_0x1419eb[_0x834e('0x44')]:_0x390c45[_0x834e('0x3e')];if(_0x1c8e80[_0x834e('0x40')]['includeAll']){_0x1419eb[_0x834e('0x54')]=[{'all':!![]}];}_0x1419eb=_[_0x834e('0x4c')]({},_0x1419eb,_0x1c8e80[_0x834e('0x51')]);return db[_0x834e('0x52')][_0x834e('0x59')](_0x1419eb)[_0x834e('0x24')](handleEntityNotFound(_0x43f599,null))[_0x834e('0x24')](respondWithResult(_0x43f599,null))[_0x834e('0x56')](handleError(_0x43f599,null));};exports['update']=function(_0x11778e,_0x4dc104){if(_0x11778e[_0x834e('0x5a')]['id']){delete _0x11778e['body']['id'];}return db[_0x834e('0x52')]['find']({'where':{'id':_0x11778e['params']['id']}})[_0x834e('0x24')](handleEntityNotFound(_0x4dc104,null))[_0x834e('0x24')](saveUpdates(_0x11778e['body'],null))['then'](respondWithResult(_0x4dc104,null))[_0x834e('0x56')](handleError(_0x4dc104,null));};exports[_0x834e('0x39')]=function(_0x138ed2,_0x387365){return db[_0x834e('0x52')][_0x834e('0x59')]({'where':{'id':_0x138ed2[_0x834e('0x58')]['id']}})[_0x834e('0x24')](handleEntityNotFound(_0x387365,null))['then'](removeEntity(_0x387365,null))[_0x834e('0x56')](handleError(_0x387365,null));};exports[_0x834e('0x5b')]=function(_0x5d5ac2,_0x281342){return db['MailMessage'][_0x834e('0x5b')]()[_0x834e('0x24')](respondWithResult(_0x281342,null))['catch'](handleError(_0x281342,null));};exports[_0x834e('0x5c')]=function(_0x37ee0e,_0x2de29a){return db[_0x834e('0x52')]['create'](_0x37ee0e[_0x834e('0x5a')])[_0x834e('0x24')](function(_0x1dfd5f){if(_0x1dfd5f){if(_0x1dfd5f['direction']===_0x834e('0x5d')&&!_0x1dfd5f[_0x834e('0x5e')]){return db[_0x834e('0x5f')][_0x834e('0x60')]({'where':{'id':_0x1dfd5f[_0x834e('0x61')]},'include':[{'model':db[_0x834e('0x62')],'as':_0x834e('0x63'),'raw':!![]}]})[_0x834e('0x24')](function(_0x208c21){if(_0x208c21&&_0x208c21[_0x834e('0x63')]){var _0x1e4310={'tls':{'rejectUnauthorized':![]}};if(_[_0x834e('0x64')](_0x208c21[_0x834e('0x63')][_0x834e('0x65')])){_0x1e4310[_0x834e('0x66')]=_0x208c21[_0x834e('0x63')][_0x834e('0x66')];_0x1e4310[_0x834e('0x67')]=_0x208c21[_0x834e('0x63')][_0x834e('0x67')];_0x1e4310[_0x834e('0x68')]=_0x208c21[_0x834e('0x63')]['secure'];if(_0x208c21[_0x834e('0x63')][_0x834e('0x69')]){_0x1e4310[_0x834e('0x6a')]={'user':_0x208c21[_0x834e('0x63')]['user'],'pass':_0x208c21[_0x834e('0x63')]['pass']};}}else{_0x1e4310['service']=_0x208c21[_0x834e('0x63')][_0x834e('0x65')];_0x1e4310[_0x834e('0x6a')]={'user':_0x208c21[_0x834e('0x63')][_0x834e('0x6b')],'pass':_0x208c21[_0x834e('0x63')][_0x834e('0x6c')]};_0x1e4310[_0x834e('0x68')]=_0x208c21['Smtp'][_0x834e('0x68')];}if(_0x37ee0e['body'][_0x834e('0x6d')]&&_0x37ee0e[_0x834e('0x5a')]['attachments']['length']){for(var _0x4a4def=0x0;_0x4a4def<_0x37ee0e[_0x834e('0x5a')][_0x834e('0x6d')][_0x834e('0x45')];_0x4a4def+=0x1){_0x37ee0e[_0x834e('0x5a')]['attachments'][_0x4a4def]={'filename':_0x37ee0e[_0x834e('0x5a')][_0x834e('0x6d')][_0x4a4def][_0x834e('0x3b')],'path':path[_0x834e('0x6e')](config[_0x834e('0x6f')],_0x834e('0x70'),_0x37ee0e[_0x834e('0x5a')][_0x834e('0x6d')][_0x4a4def][_0x834e('0x71')])};}}return{'account':_0x1e4310,'message':_0x37ee0e[_0x834e('0x5a')]};}})['then'](function(_0x1b158b){if(_0x1b158b){return respondWithRpcPromise(_0x834e('0x72'),_0x834e('0x73'),_0x1b158b,client9003)[_0x834e('0x24')](function(_0x51cfab){return _0x1dfd5f[_0x834e('0x38')]({'read':!![],'messageId':_0x51cfab['messageId'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x834e('0x56')](function(_0x332d8f){logger['error']('%s',JSON[_0x834e('0x29')](_0x332d8f));return _0x1dfd5f;});}return _0x1dfd5f;});}return _0x1dfd5f;}})[_0x834e('0x24')](respondWithResult(_0x2de29a,0xc9))['catch'](handleError(_0x2de29a,null));};var interaction_log=require(_0x834e('0x17'))(_0x834e('0x74'));exports['accept']=function(_0x5df169,_0x346be5,_0x2a42a3){var _0x8bc7d9={'channel':_0x834e('0x75')};if(_0x5df169[_0x834e('0x5a')]['id']){delete _0x5df169['body']['id'];}_0x5df169[_0x834e('0x5a')]['read']=!![];_0x5df169[_0x834e('0x5a')][_0x834e('0x76')]=moment()[_0x834e('0x77')]('YYYY-MM-DD\x20HH:mm:ss');_0x5df169[_0x834e('0x5a')][_0x834e('0x78')]=_0x5df169['body'][_0x834e('0x78')]||_0x5df169[_0x834e('0x6b')]['id'];return db[_0x834e('0x52')]['find']({'where':{'id':_0x5df169[_0x834e('0x58')]['id'],'UserId':null},'include':[{'model':db[_0x834e('0x79')],'as':_0x834e('0x7a')}]})[_0x834e('0x24')](handleEntityNotFound(_0x346be5,null))[_0x834e('0x24')](saveUpdates(_0x5df169[_0x834e('0x5a')],null))[_0x834e('0x24')](function(_0x23b5d9){if(_0x23b5d9){_0x8bc7d9[_0x834e('0x2b')]=_0x23b5d9[_0x834e('0x7b')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x23b5d9['MailInteractionId']}});}return null;})[_0x834e('0x24')](handleEntityNotFound(_0x346be5,null))[_0x834e('0x24')](function(_0x313c03){if(_0x313c03){return _0x313c03[_0x834e('0x38')]({'UserId':_0x5df169[_0x834e('0x5a')]['UserId'],'read1stAt':_['isNil'](_0x313c03[_0x834e('0x7c')])?moment()[_0x834e('0x77')](_0x834e('0x7d')):undefined});}return null;})[_0x834e('0x24')](function(_0x40a705){if(_0x40a705){_0x8bc7d9['interaction']=_0x40a705[_0x834e('0x7b')]({'plain':!![]});interaction_log[_0x834e('0x25')](_0x834e('0x7e'),_0x5df169['user']['id'],_0x5df169[_0x834e('0x6b')][_0x834e('0x3b')],_0x5df169[_0x834e('0x6b')][_0x834e('0x7f')],_0x8bc7d9[_0x834e('0x80')]['id'],_0x5df169['body']?JSON['stringify'](_0x5df169[_0x834e('0x5a')]):_0x834e('0x81'));return respondWithRpcPromise('AcceptMessage',_0x834e('0x82'),_0x8bc7d9);}return null;})['then'](function(_0x40c401){if(_0x40c401){if(_0x5df169[_0x834e('0x5a')][_0x834e('0x83')]){_0x8bc7d9['message'][_0x834e('0x84')]=util['format']('SIP/%s',_0x5df169['user'][_0x834e('0x3b')]);_0x8bc7d9[_0x834e('0x2b')][_0x834e('0x85')]=_0x8bc7d9[_0x834e('0x85')];_0x8bc7d9[_0x834e('0x2b')][_0x834e('0x86')]=_0x834e('0x87');return respondWithRpcPromise(_0x834e('0x88'),_0x834e('0x88'),{'event':'acceptmessage','message':_0x8bc7d9[_0x834e('0x2b')]},client9002)['then'](function(){return _0x8bc7d9;});}return _0x8bc7d9;}return null;})[_0x834e('0x24')](respondWithResult(_0x346be5,null))[_0x834e('0x56')](handleError(_0x346be5,null));};var interaction_log=require(_0x834e('0x17'))(_0x834e('0x74'));exports[_0x834e('0x36')]=function(_0x116830,_0x567992,_0x56d0f8){var _0xeb096d={'agent':{},'channel':_0x834e('0x75')};if(_0x116830['body']['id']){delete _0x116830[_0x834e('0x5a')]['id'];}_0x116830[_0x834e('0x5a')][_0x834e('0x78')]=_0x116830[_0x834e('0x5a')][_0x834e('0x78')]||_0x116830['user']['id'];_0xeb096d[_0x834e('0x89')]['id']=_0x116830[_0x834e('0x5a')]['UserId'];return db['MailMessage']['find']({'where':{'id':_0x116830[_0x834e('0x58')]['id'],'UserId':null}})[_0x834e('0x24')](handleEntityNotFound(_0x567992,null))['then'](function(_0x23ce49){if(_0x23ce49){_0xeb096d[_0x834e('0x2b')]=_0x23ce49['get']({'plain':!![]});return db[_0x834e('0x8a')]['find']({'where':{'id':_0x23ce49['MailInteractionId']}});}return null;})[_0x834e('0x24')](handleEntityNotFound(_0x567992,null))[_0x834e('0x24')](function(_0x2287fb){if(_0x2287fb){_0xeb096d[_0x834e('0x80')]=_0x2287fb['get']({'plain':!![]});interaction_log[_0x834e('0x25')](_0x834e('0x8b'),_0x116830[_0x834e('0x6b')]['id'],_0x116830[_0x834e('0x6b')][_0x834e('0x3b')],_0x116830[_0x834e('0x6b')][_0x834e('0x7f')],_0xeb096d[_0x834e('0x80')]['id'],_0x116830[_0x834e('0x5a')]?JSON[_0x834e('0x29')](_0x116830[_0x834e('0x5a')]):_0x834e('0x81'));return respondWithRpcPromise(_0x834e('0x8c'),_0x834e('0x8d'),_0xeb096d);}return null;})[_0x834e('0x24')](function(_0x35bb19){if(_0x35bb19){_0x35bb19[_0x834e('0x2b')][_0x834e('0x84')]=util[_0x834e('0x77')](_0x834e('0x8e'),_0x116830[_0x834e('0x6b')][_0x834e('0x3b')]);_0x35bb19['message'][_0x834e('0x85')]=_0xeb096d[_0x834e('0x85')];_0x35bb19[_0x834e('0x2b')][_0x834e('0x86')]=_0x834e('0x36');respondWithRpcPromise(_0x834e('0x88'),_0x834e('0x88'),{'event':_0x834e('0x8f'),'message':_0x35bb19[_0x834e('0x2b')]},client9002);return _0xeb096d;}return null;})['then'](respondWithResult(_0x567992,null))['catch'](handleError(_0x567992,null));};exports['download']=function(_0x150ed8,_0x493e1f){var _0x287a4c=moment()[_0x834e('0x90')]()[_0x834e('0x91')]();var _0x49021c=path[_0x834e('0x6e')](config[_0x834e('0x6f')],_0x834e('0x92'),_0x834e('0x93'),_0x834e('0x94'));var _0x473e89=path['join'](config[_0x834e('0x6f')],_0x834e('0x92'),_0x834e('0x93'),_0x834e('0x6d'));var _0x17d09c=util['format']('message-%s.eml',_0x287a4c);return db['MailMessage']['find']({'where':{'id':_0x150ed8[_0x834e('0x58')]['id']},'attributes':['id',_0x834e('0x5a'),'from','to','cc',_0x834e('0x95'),_0x834e('0x96')],'include':_0x150ed8['query'][_0x834e('0x6d')]?[{'model':db[_0x834e('0x97')],'as':_0x834e('0x98')}]:undefined})[_0x834e('0x24')](handleEntityNotFound(_0x493e1f,null))[_0x834e('0x24')](function(_0x404bab){if(_0x404bab){var _0x58a38d=_0x404bab;var _0x5a49fc={'from':_0x58a38d[_0x834e('0x99')],'to':_0x58a38d['to'],'subject':_0x58a38d[_0x834e('0x95')],'html':_0x58a38d[_0x834e('0x5a')],'headers':{'Date':moment(_0x58a38d['createdAt'])[_0x834e('0x77')](_0x834e('0x9a'))},'attachments':[]};return new BPromise(function(_0x582b24,_0x45dea6){if(_0x404bab[_0x834e('0x98')]){for(var _0x216d1f=0x0;_0x216d1f<_0x404bab[_0x834e('0x98')]['length'];_0x216d1f++){var _0x366a9f=_0x404bab['Attachments'][_0x216d1f];var _0x59d354=path[_0x834e('0x6e')](_0x473e89,_0x366a9f[_0x834e('0x71')]);if(fs[_0x834e('0x9b')](_0x59d354)){_0x5a49fc[_0x834e('0x6d')][_0x834e('0x9c')]({'name':_0x366a9f[_0x834e('0x3b')],'contentType':_0x366a9f['type'],'data':fs['readFileSync'](_0x59d354)});}}}emlformat[_0x834e('0x9d')](_0x5a49fc,function(_0x2e040e,_0x321c4f){if(_0x2e040e)return _0x45dea6(_0x2e040e);fs[_0x834e('0x9e')](path[_0x834e('0x6e')](_0x49021c,_0x17d09c),_0x321c4f);return _0x582b24(_0x321c4f);});});}})[_0x834e('0x24')](function(_0x3e4fe2){if(_0x3e4fe2){return _0x493e1f['download'](path[_0x834e('0x6e')](_0x49021c,_0x17d09c),_0x17d09c,function(_0xf25875){if(_0xf25875){console['log'](_0x834e('0x9f'),_0xf25875);}else{fs[_0x834e('0xa0')](path[_0x834e('0x6e')](_0x49021c,_0x17d09c));}});}})[_0x834e('0x56')](handleError(_0x493e1f,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 009da92..4102975 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 _0x6d19=['events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4ab2e3,_0x4769f4){var _0x18d897=function(_0x464dc7){while(--_0x464dc7){_0x4ab2e3['push'](_0x4ab2e3['shift']());}};_0x18d897(++_0x4769f4);}(_0x6d19,0x160));var _0x96d1=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x6d19[_0x16b9ed];return _0x66b1f8;};'use strict';var EventEmitter=require(_0x96d1('0x0'));var MailMessage=require(_0x96d1('0x1'))['db'][_0x96d1('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x96d1('0x3')](0x0);var events={'afterCreate':_0x96d1('0x4'),'afterUpdate':_0x96d1('0x5'),'afterDestroy':_0x96d1('0x6')};function emitEvent(_0x4d273d){return function(_0x186315,_0x394a34,_0x4c1097){MailMessageEvents[_0x96d1('0x7')](_0x4d273d+':'+_0x186315['id'],_0x186315);MailMessageEvents['emit'](_0x4d273d,_0x186315);_0x4c1097(null);};}for(var e in events){if(events[_0x96d1('0x8')](e)){var event=events[e];MailMessage[_0x96d1('0x9')](e,emitEvent(event));}}module[_0x96d1('0xa')]=MailMessageEvents; \ No newline at end of file +var _0x0734=['setMaxListeners','save','remove','emit','hook','exports','events','../../mysqldb','MailMessage'];(function(_0x104edc,_0x54e3af){var _0x274bbf=function(_0x32f24f){while(--_0x32f24f){_0x104edc['push'](_0x104edc['shift']());}};_0x274bbf(++_0x54e3af);}(_0x0734,0xba));var _0x4073=function(_0x38fe77,_0x33f0b4){_0x38fe77=_0x38fe77-0x0;var _0x1273d8=_0x0734[_0x38fe77];return _0x1273d8;};'use strict';var EventEmitter=require(_0x4073('0x0'));var MailMessage=require(_0x4073('0x1'))['db'][_0x4073('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x4073('0x3')](0x0);var events={'afterCreate':_0x4073('0x4'),'afterUpdate':'update','afterDestroy':_0x4073('0x5')};function emitEvent(_0x24cf23){return function(_0x1103ae,_0x415321,_0x4ede0a){MailMessageEvents['emit'](_0x24cf23+':'+_0x1103ae['id'],_0x1103ae);MailMessageEvents[_0x4073('0x6')](_0x24cf23,_0x1103ae);_0x4ede0a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x4073('0x7')](e,emitEvent(event));}}module[_0x4073('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index bf1a0e0..c927122 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 _0xa5e0=['MailMessage','mail_messages','messageId','models','get','direction','toLowerCase','secret','MailInteraction','findOne','MailInteractionId','then','update','body','catch','error','utf8mb4','lodash','util','../../config/logger','bluebird','request-promise','./mailMessage.attributes','exports','define'];(function(_0x539f5a,_0x56ce83){var _0x564773=function(_0x228ce){while(--_0x228ce){_0x539f5a['push'](_0x539f5a['shift']());}};_0x564773(++_0x56ce83);}(_0xa5e0,0x1a1));var _0x0a5e=function(_0x2f9e60,_0x39ecbb){_0x2f9e60=_0x2f9e60-0x0;var _0x19ff0d=_0xa5e0[_0x2f9e60];return _0x19ff0d;};'use strict';var _=require(_0x0a5e('0x0'));var util=require(_0x0a5e('0x1'));var logger=require(_0x0a5e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a5e('0x3'));var rp=require(_0x0a5e('0x4'));var attributes=require(_0x0a5e('0x5'));module[_0x0a5e('0x6')]=function(_0x29a787,_0xdc3ce){return _0x29a787[_0x0a5e('0x7')](_0x0a5e('0x8'),attributes,{'tableName':_0x0a5e('0x9'),'paranoid':![],'indexes':[{'name':_0x0a5e('0xa'),'fields':[_0x0a5e('0xa')]}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d8bb5,_0x430fe4,_0x2a5790){var _0x4a9010=_0x29a787[_0x0a5e('0xb')];var _0x1cfdc9=_0x3d8bb5[_0x0a5e('0xc')]({'plain':!![]});if(_0x1cfdc9[_0x0a5e('0xd')][_0x0a5e('0xe')]()==='in'||_0x1cfdc9[_0x0a5e('0xd')][_0x0a5e('0xe')]()==='out'&&!_0x1cfdc9[_0x0a5e('0xf')]&&!_['isNil'](_0x1cfdc9['UserId'])){_0x4a9010[_0x0a5e('0x10')][_0x0a5e('0x11')]({'where':{'id':_0x1cfdc9[_0x0a5e('0x12')]}})[_0x0a5e('0x13')](function(_0x1726d9){if(_0x1726d9){_0x1726d9[_0x0a5e('0x14')]({'lastMsgAt':_0x1cfdc9['createdAt'],'lastMsgDirection':_0x1cfdc9[_0x0a5e('0xd')][_0x0a5e('0xe')](),'lastMsgBody':_0x1cfdc9[_0x0a5e('0x15')]});}})[_0x0a5e('0x16')](function(_0xcecf8){console[_0x0a5e('0x17')](_0xcecf8);});}_0x2a5790();}},'charset':_0x0a5e('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0d65=['UserId','MailInteraction','MailInteractionId','update','createdAt','body','catch','error','utf8mb4','lodash','util','bluebird','request-promise','./mailMessage.attributes','exports','define','MailMessage','models','get','direction','toLowerCase','out','secret','isNil'];(function(_0x280a2e,_0x244c6f){var _0x286f67=function(_0xe4620b){while(--_0xe4620b){_0x280a2e['push'](_0x280a2e['shift']());}};_0x286f67(++_0x244c6f);}(_0x0d65,0x81));var _0x50d6=function(_0x88448e,_0x2359d5){_0x88448e=_0x88448e-0x0;var _0x31ad65=_0x0d65[_0x88448e];return _0x31ad65;};'use strict';var _=require(_0x50d6('0x0'));var util=require(_0x50d6('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x50d6('0x2'));var rp=require(_0x50d6('0x3'));var attributes=require(_0x50d6('0x4'));module[_0x50d6('0x5')]=function(_0x203042,_0x50b835){return _0x203042[_0x50d6('0x6')](_0x50d6('0x7'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']}],'timestamps':!![],'hooks':{'afterCreate':function(_0x16ce9f,_0x1db835,_0x4cb8ca){var _0x359d33=_0x203042[_0x50d6('0x8')];var _0x15d152=_0x16ce9f[_0x50d6('0x9')]({'plain':!![]});if(_0x15d152[_0x50d6('0xa')][_0x50d6('0xb')]()==='in'||_0x15d152['direction']['toLowerCase']()===_0x50d6('0xc')&&!_0x15d152[_0x50d6('0xd')]&&!_[_0x50d6('0xe')](_0x15d152[_0x50d6('0xf')])){_0x359d33[_0x50d6('0x10')]['findOne']({'where':{'id':_0x15d152[_0x50d6('0x11')]}})['then'](function(_0x37a6f7){if(_0x37a6f7){_0x37a6f7[_0x50d6('0x12')]({'lastMsgAt':_0x15d152[_0x50d6('0x13')],'lastMsgDirection':_0x15d152['direction'][_0x50d6('0xb')](),'lastMsgBody':_0x15d152[_0x50d6('0x14')]});}})[_0x50d6('0x15')](function(_0x5e5273){console[_0x50d6('0x16')](_0x5e5273);});}_0x4cb8ca();}},'charset':_0x50d6('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index c60812c..b748e58 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 _0x1a28=['then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','CreateMailMessage','create','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','request'];(function(_0xdbbdc2,_0x16a3be){var _0x20f387=function(_0x215f7d){while(--_0x215f7d){_0xdbbdc2['push'](_0xdbbdc2['shift']());}};_0x20f387(++_0x16a3be);}(_0x1a28,0x10e));var _0x81a2=function(_0xee3051,_0xbe4f18){_0xee3051=_0xee3051-0x0;var _0x139e81=_0x1a28[_0xee3051];return _0x139e81;};'use strict';var _=require(_0x81a2('0x0'));var util=require(_0x81a2('0x1'));var moment=require(_0x81a2('0x2'));var BPromise=require(_0x81a2('0x3'));var rs=require(_0x81a2('0x4'));var fs=require('fs');var Redis=require(_0x81a2('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x81a2('0x6'))(_0x81a2('0x7'));var config=require(_0x81a2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x81a2('0x9')][_0x81a2('0xa')]({'port':0x232a});config['redis']=_[_0x81a2('0xb')](config[_0x81a2('0xc')],{'host':_0x81a2('0xd'),'port':0x18eb});var socket=require(_0x81a2('0xe'))(new Redis(config[_0x81a2('0xc')]));require(_0x81a2('0xf'))[_0x81a2('0x10')](socket);function respondWithRpcPromise(_0x2eaa9f,_0x1f395f,_0x5b4a3d){return new BPromise(function(_0x19f67a,_0x33ca78){return client[_0x81a2('0x11')](_0x2eaa9f,_0x5b4a3d)[_0x81a2('0x12')](function(_0x3e980b){logger['info'](_0x81a2('0x13'),_0x1f395f,_0x81a2('0x14'));logger[_0x81a2('0x15')](_0x81a2('0x16'),_0x1f395f,_0x81a2('0x14'),JSON[_0x81a2('0x17')](_0x3e980b));if(_0x3e980b[_0x81a2('0x18')]){if(_0x3e980b[_0x81a2('0x18')]['code']===0x1f4){logger[_0x81a2('0x18')]('MailMessage,\x20%s,\x20%s',_0x1f395f,_0x3e980b[_0x81a2('0x18')][_0x81a2('0x19')]);return _0x33ca78(_0x3e980b['error'][_0x81a2('0x19')]);}logger['error'](_0x81a2('0x13'),_0x1f395f,_0x3e980b[_0x81a2('0x18')][_0x81a2('0x19')]);return _0x19f67a(_0x3e980b[_0x81a2('0x18')][_0x81a2('0x19')]);}else{logger[_0x81a2('0x1a')](_0x81a2('0x13'),_0x1f395f,_0x81a2('0x14'));_0x19f67a(_0x3e980b['result'][_0x81a2('0x19')]);}})[_0x81a2('0x1b')](function(_0x421355){logger[_0x81a2('0x18')](_0x81a2('0x13'),_0x1f395f,_0x421355);_0x33ca78(_0x421355);});});}exports[_0x81a2('0x1c')]=function(_0x2dde5f){var _0x3237ec=this;return new Promise(function(_0x58ee6d,_0x36c992){return db['MailMessage'][_0x81a2('0x1d')](_0x2dde5f['body'],{'raw':_0x2dde5f['options']?_0x2dde5f[_0x81a2('0x1e')][_0x81a2('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x251605){logger[_0x81a2('0x1a')](_0x81a2('0x1c'),_0x2dde5f);logger[_0x81a2('0x15')](_0x81a2('0x1c'),_0x2dde5f,JSON[_0x81a2('0x17')](_0x251605));_0x58ee6d(_0x251605);})[_0x81a2('0x1b')](function(_0x268e6c){logger[_0x81a2('0x18')](_0x81a2('0x1c'),_0x268e6c[_0x81a2('0x19')],_0x2dde5f);_0x36c992(_0x3237ec['error'](0x1f4,_0x268e6c[_0x81a2('0x19')]));});});}; \ No newline at end of file +var _0x102b=['request\x20sent','debug','error','message','result','catch','CreateMailMessage','MailMessage','create','body','options','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','then','info','MailMessage,\x20%s,\x20%s'];(function(_0x5d3da5,_0x1473ac){var _0x1903a0=function(_0xd1b326){while(--_0xd1b326){_0x5d3da5['push'](_0x5d3da5['shift']());}};_0x1903a0(++_0x1473ac);}(_0x102b,0x1be));var _0xb102=function(_0x496a23,_0x13d2d7){_0x496a23=_0x496a23-0x0;var _0x2ab827=_0x102b[_0x496a23];return _0x2ab827;};'use strict';var _=require('lodash');var util=require(_0xb102('0x0'));var moment=require('moment');var BPromise=require(_0xb102('0x1'));var rs=require(_0xb102('0x2'));var fs=require('fs');var Redis=require(_0xb102('0x3'));var db=require(_0xb102('0x4'))['db'];var utils=require(_0xb102('0x5'));var logger=require(_0xb102('0x6'))(_0xb102('0x7'));var config=require(_0xb102('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb102('0x9')][_0xb102('0xa')]({'port':0x232a});config[_0xb102('0xb')]=_[_0xb102('0xc')](config[_0xb102('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb102('0xd'))(new Redis(config['redis']));require('./mailMessage.socket')[_0xb102('0xe')](socket);function respondWithRpcPromise(_0x4af90a,_0x598bef,_0x1f8254){return new BPromise(function(_0x19f257,_0x482100){return client[_0xb102('0xf')](_0x4af90a,_0x1f8254)[_0xb102('0x10')](function(_0x3b1c08){logger[_0xb102('0x11')](_0xb102('0x12'),_0x598bef,_0xb102('0x13'));logger[_0xb102('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x598bef,_0xb102('0x13'),JSON['stringify'](_0x3b1c08));if(_0x3b1c08[_0xb102('0x15')]){if(_0x3b1c08[_0xb102('0x15')]['code']===0x1f4){logger[_0xb102('0x15')](_0xb102('0x12'),_0x598bef,_0x3b1c08['error'][_0xb102('0x16')]);return _0x482100(_0x3b1c08[_0xb102('0x15')][_0xb102('0x16')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x598bef,_0x3b1c08['error'][_0xb102('0x16')]);return _0x19f257(_0x3b1c08[_0xb102('0x15')][_0xb102('0x16')]);}else{logger[_0xb102('0x11')]('MailMessage,\x20%s,\x20%s',_0x598bef,'request\x20sent');_0x19f257(_0x3b1c08[_0xb102('0x17')][_0xb102('0x16')]);}})[_0xb102('0x18')](function(_0xf7406e){logger['error']('MailMessage,\x20%s,\x20%s',_0x598bef,_0xf7406e);_0x482100(_0xf7406e);});});}exports[_0xb102('0x19')]=function(_0x1eb480){var _0x43fa22=this;return new Promise(function(_0x2956c1,_0x503001){return db[_0xb102('0x1a')][_0xb102('0x1b')](_0x1eb480[_0xb102('0x1c')],{'raw':_0x1eb480[_0xb102('0x1d')]?_0x1eb480['options']['raw']===undefined?!![]:![]:!![]})[_0xb102('0x10')](function(_0x404373){logger['info'](_0xb102('0x19'),_0x1eb480);logger['debug'](_0xb102('0x19'),_0x1eb480,JSON[_0xb102('0x1e')](_0x404373));_0x2956c1(_0x404373);})[_0xb102('0x18')](function(_0x18742e){logger['error']('CreateMailMessage',_0x18742e[_0xb102('0x16')],_0x1eb480);_0x503001(_0x43fa22[_0xb102('0x15')](0x1f4,_0x18742e[_0xb102('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 6fa2a46..c2628b8 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 _0x4ad7=['./mailMessage.events','save','remove','update','emit','register','mailMessage:'];(function(_0x65f3a1,_0x208875){var _0x543050=function(_0x365af5){while(--_0x365af5){_0x65f3a1['push'](_0x65f3a1['shift']());}};_0x543050(++_0x208875);}(_0x4ad7,0x157));var _0x74ad=function(_0x571a98,_0x386d55){_0x571a98=_0x571a98-0x0;var _0x207c25=_0x4ad7[_0x571a98];return _0x207c25;};'use strict';var MailMessageEvents=require(_0x74ad('0x0'));var events=[_0x74ad('0x1'),_0x74ad('0x2'),_0x74ad('0x3')];function createListener(_0x2831bb,_0x5e7c3d){return function(_0x1436e6){_0x5e7c3d[_0x74ad('0x4')](_0x2831bb,_0x1436e6);};}function removeListener(_0xb800c1,_0x1f5955){return function(){MailMessageEvents['removeListener'](_0xb800c1,_0x1f5955);};}exports[_0x74ad('0x5')]=function(_0x4d9d27){for(var _0x27ac4c=0x0,_0x1e9046=events['length'];_0x27ac4c<_0x1e9046;_0x27ac4c++){var _0x412ebc=events[_0x27ac4c];var _0x5e3b4c=createListener(_0x74ad('0x6')+_0x412ebc,_0x4d9d27);MailMessageEvents['on'](_0x412ebc,_0x5e3b4c);}}; \ No newline at end of file +var _0xb19a=['length','save','update'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xb19a,0x19f));var _0xab19=function(_0xca962b,_0x359983){_0xca962b=_0xca962b-0x0;var _0x4d6e31=_0xb19a[_0xca962b];return _0x4d6e31;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xab19('0x0'),'remove',_0xab19('0x1')];function createListener(_0x32c2a9,_0x449dc9){return function(_0x306459){_0x449dc9['emit'](_0x32c2a9,_0x306459);};}function removeListener(_0x4ff646,_0x3189b5){return function(){MailMessageEvents['removeListener'](_0x4ff646,_0x3189b5);};}exports['register']=function(_0x8c2240){for(var _0x5637b2=0x0,_0x1d5b15=events[_0xab19('0x2')];_0x5637b2<_0x1d5b15;_0x5637b2++){var _0x57d4e7=events[_0x5637b2];var _0x491995=createListener('mailMessage:'+_0x57d4e7,_0x8c2240);MailMessageEvents['on'](_0x57d4e7,_0x491995);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 62cb356..ca88d72 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 _0x1e53=['show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x1ad772,_0x409b8f){var _0x52419f=function(_0xba03ab){while(--_0xba03ab){_0x1ad772['push'](_0x1ad772['shift']());}};_0x52419f(++_0x409b8f);}(_0x1e53,0x66));var _0x31e5=function(_0x5498c5,_0x27b38b){_0x5498c5=_0x5498c5-0x0;var _0x458c37=_0x1e53[_0x5498c5];return _0x458c37;};'use strict';var multer=require(_0x31e5('0x0'));var util=require(_0x31e5('0x1'));var path=require('path');var timeout=require(_0x31e5('0x2'));var express=require(_0x31e5('0x3'));var router=express[_0x31e5('0x4')]();var auth=require(_0x31e5('0x5'));var interaction=require(_0x31e5('0x6'));var config=require(_0x31e5('0x7'));var controller=require(_0x31e5('0x8'));router[_0x31e5('0x9')]('/',auth[_0x31e5('0xa')](),controller['index']);router[_0x31e5('0x9')](_0x31e5('0xb'),auth[_0x31e5('0xa')](),controller[_0x31e5('0xc')]);router[_0x31e5('0x9')](_0x31e5('0xd'),auth[_0x31e5('0xa')](),controller[_0x31e5('0xe')]);router[_0x31e5('0x9')](_0x31e5('0xf'),auth[_0x31e5('0xa')](),controller[_0x31e5('0x10')]);router[_0x31e5('0x9')]('/:id/teams',auth[_0x31e5('0xa')](),controller[_0x31e5('0x11')]);router['get'](_0x31e5('0x12'),auth[_0x31e5('0xa')](),controller[_0x31e5('0x13')]);router['post']('/',auth[_0x31e5('0xa')](),controller['create']);router[_0x31e5('0x14')](_0x31e5('0x15'),auth[_0x31e5('0xa')](),controller[_0x31e5('0x16')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x31e5('0x17')]);router[_0x31e5('0x18')](_0x31e5('0xd'),auth[_0x31e5('0xa')](),controller['update']);router[_0x31e5('0x19')](_0x31e5('0xd'),auth[_0x31e5('0xa')](),controller[_0x31e5('0x1a')]);router['delete'](_0x31e5('0x15'),auth['isAuthenticated'](),controller[_0x31e5('0x1b')]);router[_0x31e5('0x19')](_0x31e5('0x12'),auth[_0x31e5('0xa')](),controller[_0x31e5('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x71fb=['getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','describe','/:id','show','/:id/members'];(function(_0x375e57,_0x36c890){var _0x3c570a=function(_0x56afba){while(--_0x56afba){_0x375e57['push'](_0x375e57['shift']());}};_0x3c570a(++_0x36c890);}(_0x71fb,0x64));var _0xb71f=function(_0x18709a,_0x3a7ca3){_0x18709a=_0x18709a-0x0;var _0x17e36d=_0x71fb[_0x18709a];return _0x17e36d;};'use strict';var multer=require(_0xb71f('0x0'));var util=require(_0xb71f('0x1'));var path=require(_0xb71f('0x2'));var timeout=require(_0xb71f('0x3'));var express=require(_0xb71f('0x4'));var router=express[_0xb71f('0x5')]();var auth=require(_0xb71f('0x6'));var interaction=require(_0xb71f('0x7'));var config=require(_0xb71f('0x8'));var controller=require(_0xb71f('0x9'));router[_0xb71f('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb71f('0xa')]('/describe',auth[_0xb71f('0xb')](),controller[_0xb71f('0xc')]);router[_0xb71f('0xa')](_0xb71f('0xd'),auth[_0xb71f('0xb')](),controller[_0xb71f('0xe')]);router['get'](_0xb71f('0xf'),auth[_0xb71f('0xb')](),controller[_0xb71f('0x10')]);router[_0xb71f('0xa')](_0xb71f('0x11'),auth[_0xb71f('0xb')](),controller[_0xb71f('0x12')]);router[_0xb71f('0xa')](_0xb71f('0x13'),auth[_0xb71f('0xb')](),controller['getAgents']);router[_0xb71f('0x14')]('/',auth[_0xb71f('0xb')](),controller[_0xb71f('0x15')]);router[_0xb71f('0x14')]('/:id/teams',auth[_0xb71f('0xb')](),controller[_0xb71f('0x16')]);router[_0xb71f('0x14')](_0xb71f('0x13'),auth[_0xb71f('0xb')](),controller[_0xb71f('0x17')]);router[_0xb71f('0x18')]('/:id',auth[_0xb71f('0xb')](),controller['update']);router[_0xb71f('0x19')](_0xb71f('0xd'),auth[_0xb71f('0xb')](),controller['destroy']);router[_0xb71f('0x19')](_0xb71f('0x11'),auth[_0xb71f('0xb')](),controller[_0xb71f('0x1a')]);router[_0xb71f('0x19')](_0xb71f('0x13'),auth[_0xb71f('0xb')](),controller[_0xb71f('0x1b')]);module[_0xb71f('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 457afdd..fddfbd0 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 _0xb2df=['STRING','INTEGER','ENUM','rrmemory','beepall','exports'];(function(_0x396219,_0x5e9018){var _0x5f47ca=function(_0x4aedc6){while(--_0x4aedc6){_0x396219['push'](_0x396219['shift']());}};_0x5f47ca(++_0x5e9018);}(_0xb2df,0x16d));var _0xfb2d=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xb2df[_0x2aec52];return _0x3b8835;};'use strict';var Sequelize=require('sequelize');module[_0xfb2d('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfb2d('0x1')]},'timeout':{'type':Sequelize[_0xfb2d('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfb2d('0x3')](_0xfb2d('0x4'),_0xfb2d('0x5'),'roundrobin')}}; \ No newline at end of file +var _0xb4d3=['ENUM','rrmemory','sequelize','exports','STRING','INTEGER'];(function(_0x3ed5be,_0x4cd130){var _0xd735ac=function(_0x1d10dd){while(--_0x1d10dd){_0x3ed5be['push'](_0x3ed5be['shift']());}};_0xd735ac(++_0x4cd130);}(_0xb4d3,0x164));var _0x3b4d=function(_0x4fa438,_0x1f15a7){_0x4fa438=_0x4fa438-0x0;var _0x4e3958=_0xb4d3[_0x4fa438];return _0x4e3958;};'use strict';var Sequelize=require(_0x3b4d('0x0'));module[_0x3b4d('0x1')]={'name':{'type':Sequelize[_0x3b4d('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3b4d('0x2')]},'timeout':{'type':Sequelize[_0x3b4d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3b4d('0x4')](_0x3b4d('0x5'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 28f4a0a..ceb9664 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 _0xa9e0=['stack','name','index','MailQueue','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','map','type','key','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','MailQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserMailQueue','pick','MailQueueId','findAll','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','Team','Agents','union','addAgents','penalty','ids','removeTeams','omit','emit','removeAgents','isArray','userMailQueue:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','error'];(function(_0x236ad8,_0x1d4f32){var _0x36eb39=function(_0x46a5c6){while(--_0x46a5c6){_0x236ad8['push'](_0x236ad8['shift']());}};_0x36eb39(++_0x1d4f32);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var authService=require(_0x0a9e('0xe'));var hardwareService=require(_0x0a9e('0xf'));var Redis=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0a9e('0x13')]=_[_0x0a9e('0x14')](config[_0x0a9e('0x13')],{'host':_0x0a9e('0x15'),'port':0x18eb});var socket=require(_0x0a9e('0x16'))(new Redis(config[_0x0a9e('0x13')]));require('./mailQueue.socket')[_0x0a9e('0x17')](socket);function respondWithStatusCode(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xcc;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x18')](_0x2b4227);}return _0x239b12[_0x0a9e('0x19')](_0x2b4227)['end']();};}function respondWithResult(_0x22dccb,_0x5d0880){_0x5d0880=_0x5d0880||0xc8;return function(_0x1985b6){if(_0x1985b6){return _0x22dccb['status'](_0x5d0880)[_0x0a9e('0x1a')](_0x1985b6);}};}function respondWithFilteredResult(_0x12066b,_0x48f32d){return function(_0x225616){if(_0x225616){var _0x5a0a06=_0x225616[_0x0a9e('0x1b')],_0x459eb1=_0x48f32d[_0x0a9e('0x1c')],_0x478723=_0x48f32d[_0x0a9e('0x1c')]+_0x48f32d[_0x0a9e('0x1d')],_0x106033;if(_0x478723>=_0x5a0a06){_0x478723=_0x5a0a06;_0x106033=0xc8;}else{_0x106033=0xce;}_0x12066b[_0x0a9e('0x19')](_0x106033);return _0x12066b[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x459eb1+'-'+_0x478723+'/'+_0x5a0a06)[_0x0a9e('0x1a')](_0x225616);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x20')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x21')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x22')](_0x5a09ef)[_0x0a9e('0x23')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){var _0x370d86=_0x2fb0e4[_0x0a9e('0x25')]({'plain':!![]});var _0x16b1ca='MailQueues';return db['UserProfileResource'][_0x0a9e('0x24')]({'where':{'type':_0x16b1ca,'resourceId':_0x370d86['id']}})[_0x0a9e('0x23')](function(){return _0x2fb0e4;});})[_0x0a9e('0x23')](function(){_0x4abc77[_0x0a9e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x26')](_0x25fba9[_0x0a9e('0x27')]);if(_0x25fba9[_0x0a9e('0x28')]){delete _0x25fba9[_0x0a9e('0x28')];}_0x1dc186[_0x0a9e('0x19')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x29')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};var _0x40e7a3=db[_0x0a9e('0x2a')][_0x0a9e('0x2b')];_0x5c877d[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x40e7a3);_0x5c877d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x468813[_0x0a9e('0x2e')]);_0x5c877d['filters']=_[_0x0a9e('0x2f')](_0x5c877d['model'],_0x5c877d[_0x0a9e('0x2e')]);_0x2ec755[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5c877d[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x468813['query'][_0x0a9e('0x31')]));_0x2ec755[_0x0a9e('0x30')]=_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x2ec755[_0x0a9e('0x30')]:_0x5c877d[_0x0a9e('0x2c')];if(!_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x2ec755[_0x0a9e('0x1d')]=qs['limit'](_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x2ec755[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x468813['query'][_0x0a9e('0x1c')]);}_0x2ec755[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x468813[_0x0a9e('0x2e')]['sort']);_0x2ec755['where']=qs[_0x0a9e('0x36')](_['pick'](_0x468813[_0x0a9e('0x2e')],_0x5c877d[_0x0a9e('0x36')]));if(_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]){_0x2ec755['where']=_[_0x0a9e('0x38')](_0x2ec755[_0x0a9e('0x39')],{'$or':_[_0x0a9e('0x3a')](_0x40e7a3,function(_0x533942){if(_0x533942[_0x0a9e('0x3b')][_0x0a9e('0x3c')]!==_0x0a9e('0x3d')){var _0x4c1c0e={};_0x4c1c0e[_0x533942['field']]={'$like':'%'+_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x4c1c0e;}})});}_0x2ec755=_['merge']({},_0x2ec755,_0x468813[_0x0a9e('0x3e')]);var _0x419125={'where':_0x2ec755[_0x0a9e('0x39')]};return db[_0x0a9e('0x2a')]['count'](_0x419125)['then'](function(_0x15e37d){_0x15b200[_0x0a9e('0x1b')]=_0x15e37d;if(_0x468813['query'][_0x0a9e('0x3f')]){_0x2ec755[_0x0a9e('0x40')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')]['findAll'](_0x2ec755);})[_0x0a9e('0x23')](function(_0x2cfea9){_0x15b200[_0x0a9e('0x41')]=_0x2cfea9;return _0x15b200;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x2b1f27,_0x2ec755))[_0x0a9e('0x42')](handleError(_0x2b1f27,null));};exports[_0x0a9e('0x43')]=function(_0x2881b3,_0x45a9b8){var _0x23b089={'raw':!![],'where':{'id':_0x2881b3[_0x0a9e('0x44')]['id']}},_0x3da2cd={};_0x3da2cd[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x3da2cd['query']=_['keys'](_0x2881b3[_0x0a9e('0x2e')]);_0x3da2cd[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],_0x3da2cd[_0x0a9e('0x2e')]);_0x23b089[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x23b089[_0x0a9e('0x30')]=_0x23b089['attributes'][_0x0a9e('0x32')]?_0x23b089[_0x0a9e('0x30')]:_0x3da2cd[_0x0a9e('0x2c')];if(_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x3f')]){_0x23b089[_0x0a9e('0x40')]=[{'all':!![]}];}_0x23b089=_[_0x0a9e('0x38')]({},_0x23b089,_0x2881b3[_0x0a9e('0x3e')]);return db['MailQueue'][_0x0a9e('0x45')](_0x23b089)['then'](handleEntityNotFound(_0x45a9b8,null))[_0x0a9e('0x23')](respondWithResult(_0x45a9b8,null))[_0x0a9e('0x42')](handleError(_0x45a9b8,null));};exports[_0x0a9e('0x46')]=function(_0x562fb4,_0x14bec2){return db[_0x0a9e('0x2a')][_0x0a9e('0x46')](_0x562fb4[_0x0a9e('0x47')],{})[_0x0a9e('0x23')](function(_0x37be73){var _0x45bf7f=_0x562fb4['user'][_0x0a9e('0x25')]({'plain':!![]});if(!_0x45bf7f)throw new Error(_0x0a9e('0x48'));if(_0x45bf7f[_0x0a9e('0x49')]===_0x0a9e('0x4a')){var _0x409789=_0x37be73[_0x0a9e('0x25')]({'plain':!![]});var _0x6054ee=_0x0a9e('0x4b');return db[_0x0a9e('0x4c')]['find']({'where':{'name':_0x6054ee,'userProfileId':_0x45bf7f[_0x0a9e('0x4d')]},'raw':!![]})[_0x0a9e('0x23')](function(_0x4f7240){if(_0x4f7240&&_0x4f7240['autoAssociation']===0x0){return db['UserProfileResource'][_0x0a9e('0x46')]({'name':_0x409789[_0x0a9e('0x28')],'resourceId':_0x409789['id'],'type':_0x4f7240[_0x0a9e('0x28')],'sectionId':_0x4f7240['id']},{})[_0x0a9e('0x23')](function(){return _0x37be73;});}else{return _0x37be73;}})[_0x0a9e('0x42')](function(_0x30decb){logger[_0x0a9e('0x26')](_0x0a9e('0x4e'),_0x30decb);throw _0x30decb;});}return _0x37be73;})['then'](respondWithResult(_0x14bec2,0xc9))['catch'](handleError(_0x14bec2,null));};exports['update']=function(_0x39d77d,_0x204173){if(_0x39d77d[_0x0a9e('0x47')]['id']){delete _0x39d77d['body']['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x39d77d['params']['id']}})['then'](handleEntityNotFound(_0x204173,null))[_0x0a9e('0x23')](saveUpdates(_0x39d77d['body'],null))[_0x0a9e('0x23')](respondWithResult(_0x204173,null))['catch'](handleError(_0x204173,null));};exports[_0x0a9e('0x24')]=function(_0x3c20b2,_0x439340){return db['MailQueue'][_0x0a9e('0x45')]({'where':{'id':_0x3c20b2[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x439340,null))['then'](removeEntity(_0x439340,null))[_0x0a9e('0x42')](handleError(_0x439340,null));};exports[_0x0a9e('0x4f')]=function(_0x49c095,_0x145931){return db['MailQueue'][_0x0a9e('0x4f')]()['then'](respondWithResult(_0x145931,null))[_0x0a9e('0x42')](handleError(_0x145931,null));};exports['getMembers']=function(_0x5da27d,_0x5df0ad,_0x2da03c){var _0x47de4c={'raw':!![],'where':{}},_0x2f7092={},_0x65432;return db[_0x0a9e('0x2a')][_0x0a9e('0x50')]({'where':{'id':_0x5da27d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x5df0ad,null))[_0x0a9e('0x23')](function(_0x28d814){if(_0x28d814){_0x65432=_0x28d814['get']({'plain':!![]});_0x2f7092[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x51')][_0x0a9e('0x2b')]);_0x2f7092[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5da27d['query']);_0x2f7092[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x2f7092['model'],_0x2f7092[_0x0a9e('0x2e')]);_0x47de4c['attributes']=_[_0x0a9e('0x2f')](_0x2f7092['model'],qs['fields'](_0x5da27d['query'][_0x0a9e('0x31')]));_0x47de4c['attributes']=_0x47de4c[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x47de4c[_0x0a9e('0x30')]:_0x2f7092[_0x0a9e('0x2c')];if(!_0x5da27d[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x47de4c[_0x0a9e('0x1d')]=qs['limit'](_0x5da27d[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x47de4c[_0x0a9e('0x1c')]=qs['offset'](_0x5da27d[_0x0a9e('0x2e')][_0x0a9e('0x1c')]);}_0x47de4c[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x5da27d['query'][_0x0a9e('0x35')]);_0x47de4c[_0x0a9e('0x39')]=qs['filters'](_[_0x0a9e('0x52')](_0x5da27d[_0x0a9e('0x2e')],_0x2f7092[_0x0a9e('0x36')]));_0x47de4c[_0x0a9e('0x39')][_0x0a9e('0x53')]=_0x28d814['id'];if(_0x5da27d['query'][_0x0a9e('0x37')]){_0x47de4c[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x47de4c['where'],{'$or':_[_0x0a9e('0x3a')](_0x47de4c['attributes'],function(_0x5211e3){var _0x242745={};_0x242745[_0x5211e3]={'$like':'%'+_0x5da27d[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x242745;})});}_0x47de4c=_[_0x0a9e('0x38')]({},_0x47de4c,_0x5da27d[_0x0a9e('0x3e')]);return db[_0x0a9e('0x51')][_0x0a9e('0x54')](_0x47de4c);}})[_0x0a9e('0x23')](function(_0x2d7205){if(_0x2d7205){return db[_0x0a9e('0x55')][_0x0a9e('0x56')]({'where':{'id':_[_0x0a9e('0x3a')](_0x2d7205,_0x0a9e('0x57')),'role':_0x0a9e('0x58')},'attributes':['id',_0x0a9e('0x28'),_0x0a9e('0x59'),_0x0a9e('0x5a'),_0x0a9e('0x5b')]});}})['then'](function(_0x1b0b98){if(_0x1b0b98){return{'count':_0x1b0b98[_0x0a9e('0x1b')],'rows':_[_0x0a9e('0x3a')](_0x1b0b98['rows'],function(_0x1148a1){return{'membername':_0x1148a1[_0x0a9e('0x28')],'UserId':_0x1148a1['id'],'queue_name':_0x65432['name'],'MailQueueId':_0x65432['id'],'interface':util[_0x0a9e('0x5c')](_0x0a9e('0x5d'),_0x0a9e('0x5e'),_0x1148a1[_0x0a9e('0x28')]),'penalty':0x0,'paused':_0x1148a1[_0x0a9e('0x59')],'createdAt':_0x1148a1['createdAt'],'updatedAt':_0x1148a1['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5df0ad,_0x47de4c))[_0x0a9e('0x42')](handleError(_0x5df0ad,null));};exports[_0x0a9e('0x5f')]=function(_0x1104ad,_0x23a7d3,_0x6abd03){var _0x380ab3={};var _0xeef20={};var _0x1a0677;var _0x5512d1;return db[_0x0a9e('0x2a')][_0x0a9e('0x50')]({'where':{'id':_0x1104ad[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x23a7d3,null))[_0x0a9e('0x23')](function(_0x583b2e){if(_0x583b2e){_0x1a0677=_0x583b2e;_0xeef20[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db['Team'][_0x0a9e('0x2b')]);_0xeef20[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x1104ad[_0x0a9e('0x2e')]);_0xeef20['filters']=_[_0x0a9e('0x2f')](_0xeef20[_0x0a9e('0x2c')],_0xeef20[_0x0a9e('0x2e')]);_0x380ab3[_0x0a9e('0x30')]=_['intersection'](_0xeef20[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x1104ad[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x380ab3['attributes']=_0x380ab3[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x380ab3[_0x0a9e('0x30')]:_0xeef20[_0x0a9e('0x2c')];_0x380ab3[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x1104ad[_0x0a9e('0x2e')][_0x0a9e('0x35')]);_0x380ab3[_0x0a9e('0x39')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0x52')](_0x1104ad[_0x0a9e('0x2e')],_0xeef20[_0x0a9e('0x36')]));if(_0x1104ad[_0x0a9e('0x2e')]['filter']){_0x380ab3[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x380ab3[_0x0a9e('0x39')],{'$or':_['map'](_0x380ab3[_0x0a9e('0x30')],function(_0x33dda0){var _0x8cea96={};_0x8cea96[_0x33dda0]={'$like':'%'+_0x1104ad[_0x0a9e('0x2e')]['filter']+'%'};return _0x8cea96;})});}_0x380ab3=_['merge']({},_0x380ab3,_0x1104ad[_0x0a9e('0x3e')]);return _0x1a0677[_0x0a9e('0x5f')](_0x380ab3);}})['then'](function(_0x45108c){if(_0x45108c){_0x5512d1=_0x45108c['length'];if(!_0x1104ad[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x380ab3[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x1104ad[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x380ab3[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x1104ad[_0x0a9e('0x2e')]['offset']);}return _0x1a0677[_0x0a9e('0x5f')](_0x380ab3);}})[_0x0a9e('0x23')](function(_0x45c109){if(_0x45c109){return _0x45c109?{'count':_0x5512d1,'rows':_0x45c109}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x23a7d3,null))['catch'](handleError(_0x23a7d3,null));};exports[_0x0a9e('0x60')]=function(_0xf0db1,_0x4bf3a5,_0x1d6834){var _0x5b7940=[];var _0x163710;return db[_0x0a9e('0x61')][_0x0a9e('0x54')]({'where':{'id':_0xf0db1[_0x0a9e('0x47')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0a9e('0x62'),'attributes':['id'],'raw':!![]}]})[_0x0a9e('0x23')](function(_0x94dcf5){if(_0x94dcf5){for(var _0x5ac73d=0x0;_0x5ac73d<_0x94dcf5[_0x0a9e('0x32')];_0x5ac73d+=0x1){for(var _0x36e975=0x0;_0x36e975<_0x94dcf5[_0x5ac73d]['Agents']['length'];_0x36e975+=0x1){_0x5b7940=_[_0x0a9e('0x63')](_0x5b7940,[_0x94dcf5[_0x5ac73d]['Agents'][_0x36e975]['id']]);}}return _0x5b7940;}})['then'](function(_0x4dc6b3){if(_0x4dc6b3){return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0xf0db1[_0x0a9e('0x44')]['id']}});}})[_0x0a9e('0x23')](function(_0x3c6dd6){if(_0x3c6dd6){_0x163710=_0x3c6dd6;return _0x163710[_0x0a9e('0x64')](_0x5b7940,{'penalty':_0xf0db1['body'][_0x0a9e('0x65')]});}})['then'](function(_0x2871c1){if(_0x2871c1){return _0x163710[_0x0a9e('0x60')](_0xf0db1[_0x0a9e('0x47')][_0x0a9e('0x66')]);}})['then'](handleEntityNotFound(_0x4bf3a5,null))[_0x0a9e('0x23')](respondWithStatusCode(_0x4bf3a5,null))[_0x0a9e('0x42')](handleError(_0x4bf3a5,null));};exports[_0x0a9e('0x67')]=function(_0x5b74c3,_0xb6e411,_0x21e592){var _0x2a563d=[];var _0x22063c;return db[_0x0a9e('0x61')][_0x0a9e('0x54')]({'where':{'id':_0x5b74c3[_0x0a9e('0x2e')][_0x0a9e('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0a9e('0x62'),'attributes':['id'],'raw':!![]}]})[_0x0a9e('0x23')](function(_0x589ff3){if(_0x589ff3){for(var _0x40e0f0=0x0;_0x40e0f0<_0x589ff3[_0x0a9e('0x32')];_0x40e0f0+=0x1){for(var _0x3a1974=0x0;_0x3a1974<_0x589ff3[_0x40e0f0]['Agents'][_0x0a9e('0x32')];_0x3a1974+=0x1){_0x2a563d=_['union'](_0x2a563d,[_0x589ff3[_0x40e0f0][_0x0a9e('0x62')][_0x3a1974]['id']]);}}return _0x2a563d;}})[_0x0a9e('0x23')](function(_0x558a87){if(_0x558a87){return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x5b74c3[_0x0a9e('0x44')]['id']}});}})[_0x0a9e('0x23')](function(_0x3a9a85){if(_0x3a9a85){_0x22063c=_0x3a9a85;return _0x22063c['removeAgents'](_0x2a563d);}})[_0x0a9e('0x23')](function(_0x31d25a){if(_0x22063c){return _0x22063c[_0x0a9e('0x67')](_0x5b74c3[_0x0a9e('0x2e')][_0x0a9e('0x66')]);}})[_0x0a9e('0x23')](handleEntityNotFound(_0xb6e411,null))[_0x0a9e('0x23')](respondWithStatusCode(_0xb6e411,null))[_0x0a9e('0x42')](handleError(_0xb6e411,null));};exports[_0x0a9e('0x64')]=function(_0x31af8c,_0x151956,_0x3754e2){return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x31af8c[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x151956,null))[_0x0a9e('0x23')](function(_0x2ed526){if(_0x2ed526){return _0x2ed526[_0x0a9e('0x64')](_0x31af8c['body'][_0x0a9e('0x66')],_[_0x0a9e('0x68')](_0x31af8c['body'],[_0x0a9e('0x66'),'id'])||{})['spread'](function(_0x45d113){for(var _0x27041d=0x0;_0x27041d<_0x31af8c[_0x0a9e('0x47')][_0x0a9e('0x66')]['length'];_0x27041d+=0x1){socket[_0x0a9e('0x69')]('userMailQueue:save',{'UserId':_0x31af8c[_0x0a9e('0x47')][_0x0a9e('0x66')][_0x27041d],'MailQueueId':_0x31af8c['params']['id']});}return _0x45d113;});}})[_0x0a9e('0x23')](respondWithResult(_0x151956,null))[_0x0a9e('0x42')](handleError(_0x151956,null));};exports[_0x0a9e('0x6a')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be;return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x4ab276[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x4c788f,null))[_0x0a9e('0x23')](function(_0x3c75b9){if(_0x3c75b9){return _0x3c75b9[_0x0a9e('0x6a')](_0x4ab276['query'][_0x0a9e('0x66')])['then'](function(_0x287324){if(_[_0x0a9e('0x6b')](_0x4ab276[_0x0a9e('0x2e')][_0x0a9e('0x66')])){for(var _0x1b61d5=0x0;_0x1b61d5<_0x4ab276['query'][_0x0a9e('0x66')][_0x0a9e('0x32')];_0x1b61d5+=0x1){socket[_0x0a9e('0x69')](_0x0a9e('0x6c'),{'UserId':_0x4ab276[_0x0a9e('0x2e')]['ids'][_0x1b61d5],'MailQueueId':_0x4ab276['params']['id']});}}else{socket[_0x0a9e('0x69')]('userMailQueue:remove',{'UserId':_0x4ab276[_0x0a9e('0x2e')][_0x0a9e('0x66')],'MailQueueId':_0x4ab276[_0x0a9e('0x44')]['id']});}});}})[_0x0a9e('0x23')](respondWithStatusCode(_0x4c788f,null))[_0x0a9e('0x42')](handleError(_0x4c788f,null));};exports[_0x0a9e('0x6d')]=function(_0x596312,_0x4db918,_0x1889ed){var _0x5dfbe2={};var _0x2469d1={};var _0x5c689c;var _0x427ccc;return db['MailQueue']['findOne']({'where':{'id':_0x596312[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x4db918,null))['then'](function(_0x170af6){if(_0x170af6){_0x5c689c=_0x170af6;_0x2469d1[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x55')][_0x0a9e('0x2b')]);_0x2469d1['query']=_['keys'](_0x596312[_0x0a9e('0x2e')]);_0x2469d1[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x2469d1[_0x0a9e('0x2c')],_0x2469d1[_0x0a9e('0x2e')]);_0x5dfbe2['attributes']=_[_0x0a9e('0x2f')](_0x2469d1[_0x0a9e('0x2c')],qs['fields'](_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x5dfbe2[_0x0a9e('0x30')]=_0x5dfbe2[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x5dfbe2[_0x0a9e('0x30')]:_0x2469d1[_0x0a9e('0x2c')];_0x5dfbe2[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x596312[_0x0a9e('0x2e')]['sort']);_0x5dfbe2[_0x0a9e('0x39')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0x52')](_0x596312[_0x0a9e('0x2e')],_0x2469d1[_0x0a9e('0x36')]));if(_0x596312['query']['filter']){_0x5dfbe2[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x5dfbe2[_0x0a9e('0x39')],{'$or':_[_0x0a9e('0x3a')](_0x5dfbe2[_0x0a9e('0x30')],function(_0x59e46f){var _0x1339d0={};_0x1339d0[_0x59e46f]={'$like':'%'+_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x1339d0;})});}_0x5dfbe2=_['merge']({},_0x5dfbe2,_0x596312[_0x0a9e('0x3e')]);return _0x5c689c['getAgents'](_0x5dfbe2);}})[_0x0a9e('0x23')](function(_0x4799d4){if(_0x4799d4){_0x427ccc=_0x4799d4[_0x0a9e('0x32')];if(!_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x5dfbe2[_0x0a9e('0x1d')]=qs['limit'](_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x5dfbe2[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x1c')]);}return _0x5c689c[_0x0a9e('0x6d')](_0x5dfbe2);}})[_0x0a9e('0x23')](function(_0x2aaf07){if(_0x2aaf07){return _0x2aaf07?{'count':_0x427ccc,'rows':_0x2aaf07}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x4db918,null))[_0x0a9e('0x42')](handleError(_0x4db918,null));}; \ No newline at end of file +var _0xa9e0=['stack','name','index','MailQueue','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','map','type','key','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','MailQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserMailQueue','pick','MailQueueId','findAll','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','Team','Agents','union','addAgents','penalty','ids','removeTeams','omit','emit','removeAgents','isArray','userMailQueue:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','error'];(function(_0x522d90,_0x41aaaa){var _0x7b25b8=function(_0x4c828e){while(--_0x4c828e){_0x522d90['push'](_0x522d90['shift']());}};_0x7b25b8(++_0x41aaaa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var authService=require(_0x0a9e('0xe'));var hardwareService=require(_0x0a9e('0xf'));var Redis=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0a9e('0x13')]=_[_0x0a9e('0x14')](config[_0x0a9e('0x13')],{'host':_0x0a9e('0x15'),'port':0x18eb});var socket=require(_0x0a9e('0x16'))(new Redis(config[_0x0a9e('0x13')]));require('./mailQueue.socket')[_0x0a9e('0x17')](socket);function respondWithStatusCode(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xcc;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x18')](_0x2b4227);}return _0x239b12[_0x0a9e('0x19')](_0x2b4227)['end']();};}function respondWithResult(_0x22dccb,_0x5d0880){_0x5d0880=_0x5d0880||0xc8;return function(_0x1985b6){if(_0x1985b6){return _0x22dccb['status'](_0x5d0880)[_0x0a9e('0x1a')](_0x1985b6);}};}function respondWithFilteredResult(_0x12066b,_0x48f32d){return function(_0x225616){if(_0x225616){var _0x5a0a06=_0x225616[_0x0a9e('0x1b')],_0x459eb1=_0x48f32d[_0x0a9e('0x1c')],_0x478723=_0x48f32d[_0x0a9e('0x1c')]+_0x48f32d[_0x0a9e('0x1d')],_0x106033;if(_0x478723>=_0x5a0a06){_0x478723=_0x5a0a06;_0x106033=0xc8;}else{_0x106033=0xce;}_0x12066b[_0x0a9e('0x19')](_0x106033);return _0x12066b[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x459eb1+'-'+_0x478723+'/'+_0x5a0a06)[_0x0a9e('0x1a')](_0x225616);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x20')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x21')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x22')](_0x5a09ef)[_0x0a9e('0x23')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){var _0x370d86=_0x2fb0e4[_0x0a9e('0x25')]({'plain':!![]});var _0x16b1ca='MailQueues';return db['UserProfileResource'][_0x0a9e('0x24')]({'where':{'type':_0x16b1ca,'resourceId':_0x370d86['id']}})[_0x0a9e('0x23')](function(){return _0x2fb0e4;});})[_0x0a9e('0x23')](function(){_0x4abc77[_0x0a9e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x26')](_0x25fba9[_0x0a9e('0x27')]);if(_0x25fba9[_0x0a9e('0x28')]){delete _0x25fba9[_0x0a9e('0x28')];}_0x1dc186[_0x0a9e('0x19')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x29')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};var _0x40e7a3=db[_0x0a9e('0x2a')][_0x0a9e('0x2b')];_0x5c877d[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x40e7a3);_0x5c877d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x468813[_0x0a9e('0x2e')]);_0x5c877d['filters']=_[_0x0a9e('0x2f')](_0x5c877d['model'],_0x5c877d[_0x0a9e('0x2e')]);_0x2ec755[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5c877d[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x468813['query'][_0x0a9e('0x31')]));_0x2ec755[_0x0a9e('0x30')]=_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x2ec755[_0x0a9e('0x30')]:_0x5c877d[_0x0a9e('0x2c')];if(!_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x2ec755[_0x0a9e('0x1d')]=qs['limit'](_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x2ec755[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x468813['query'][_0x0a9e('0x1c')]);}_0x2ec755[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x468813[_0x0a9e('0x2e')]['sort']);_0x2ec755['where']=qs[_0x0a9e('0x36')](_['pick'](_0x468813[_0x0a9e('0x2e')],_0x5c877d[_0x0a9e('0x36')]));if(_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]){_0x2ec755['where']=_[_0x0a9e('0x38')](_0x2ec755[_0x0a9e('0x39')],{'$or':_[_0x0a9e('0x3a')](_0x40e7a3,function(_0x533942){if(_0x533942[_0x0a9e('0x3b')][_0x0a9e('0x3c')]!==_0x0a9e('0x3d')){var _0x4c1c0e={};_0x4c1c0e[_0x533942['field']]={'$like':'%'+_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x4c1c0e;}})});}_0x2ec755=_['merge']({},_0x2ec755,_0x468813[_0x0a9e('0x3e')]);var _0x419125={'where':_0x2ec755[_0x0a9e('0x39')]};return db[_0x0a9e('0x2a')]['count'](_0x419125)['then'](function(_0x15e37d){_0x15b200[_0x0a9e('0x1b')]=_0x15e37d;if(_0x468813['query'][_0x0a9e('0x3f')]){_0x2ec755[_0x0a9e('0x40')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')]['findAll'](_0x2ec755);})[_0x0a9e('0x23')](function(_0x2cfea9){_0x15b200[_0x0a9e('0x41')]=_0x2cfea9;return _0x15b200;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x2b1f27,_0x2ec755))[_0x0a9e('0x42')](handleError(_0x2b1f27,null));};exports[_0x0a9e('0x43')]=function(_0x2881b3,_0x45a9b8){var _0x23b089={'raw':!![],'where':{'id':_0x2881b3[_0x0a9e('0x44')]['id']}},_0x3da2cd={};_0x3da2cd[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x3da2cd['query']=_['keys'](_0x2881b3[_0x0a9e('0x2e')]);_0x3da2cd[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],_0x3da2cd[_0x0a9e('0x2e')]);_0x23b089[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x23b089[_0x0a9e('0x30')]=_0x23b089['attributes'][_0x0a9e('0x32')]?_0x23b089[_0x0a9e('0x30')]:_0x3da2cd[_0x0a9e('0x2c')];if(_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x3f')]){_0x23b089[_0x0a9e('0x40')]=[{'all':!![]}];}_0x23b089=_[_0x0a9e('0x38')]({},_0x23b089,_0x2881b3[_0x0a9e('0x3e')]);return db['MailQueue'][_0x0a9e('0x45')](_0x23b089)['then'](handleEntityNotFound(_0x45a9b8,null))[_0x0a9e('0x23')](respondWithResult(_0x45a9b8,null))[_0x0a9e('0x42')](handleError(_0x45a9b8,null));};exports[_0x0a9e('0x46')]=function(_0x562fb4,_0x14bec2){return db[_0x0a9e('0x2a')][_0x0a9e('0x46')](_0x562fb4[_0x0a9e('0x47')],{})[_0x0a9e('0x23')](function(_0x37be73){var _0x45bf7f=_0x562fb4['user'][_0x0a9e('0x25')]({'plain':!![]});if(!_0x45bf7f)throw new Error(_0x0a9e('0x48'));if(_0x45bf7f[_0x0a9e('0x49')]===_0x0a9e('0x4a')){var _0x409789=_0x37be73[_0x0a9e('0x25')]({'plain':!![]});var _0x6054ee=_0x0a9e('0x4b');return db[_0x0a9e('0x4c')]['find']({'where':{'name':_0x6054ee,'userProfileId':_0x45bf7f[_0x0a9e('0x4d')]},'raw':!![]})[_0x0a9e('0x23')](function(_0x4f7240){if(_0x4f7240&&_0x4f7240['autoAssociation']===0x0){return db['UserProfileResource'][_0x0a9e('0x46')]({'name':_0x409789[_0x0a9e('0x28')],'resourceId':_0x409789['id'],'type':_0x4f7240[_0x0a9e('0x28')],'sectionId':_0x4f7240['id']},{})[_0x0a9e('0x23')](function(){return _0x37be73;});}else{return _0x37be73;}})[_0x0a9e('0x42')](function(_0x30decb){logger[_0x0a9e('0x26')](_0x0a9e('0x4e'),_0x30decb);throw _0x30decb;});}return _0x37be73;})['then'](respondWithResult(_0x14bec2,0xc9))['catch'](handleError(_0x14bec2,null));};exports['update']=function(_0x39d77d,_0x204173){if(_0x39d77d[_0x0a9e('0x47')]['id']){delete _0x39d77d['body']['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x39d77d['params']['id']}})['then'](handleEntityNotFound(_0x204173,null))[_0x0a9e('0x23')](saveUpdates(_0x39d77d['body'],null))[_0x0a9e('0x23')](respondWithResult(_0x204173,null))['catch'](handleError(_0x204173,null));};exports[_0x0a9e('0x24')]=function(_0x3c20b2,_0x439340){return db['MailQueue'][_0x0a9e('0x45')]({'where':{'id':_0x3c20b2[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x439340,null))['then'](removeEntity(_0x439340,null))[_0x0a9e('0x42')](handleError(_0x439340,null));};exports[_0x0a9e('0x4f')]=function(_0x49c095,_0x145931){return db['MailQueue'][_0x0a9e('0x4f')]()['then'](respondWithResult(_0x145931,null))[_0x0a9e('0x42')](handleError(_0x145931,null));};exports['getMembers']=function(_0x5da27d,_0x5df0ad,_0x2da03c){var _0x47de4c={'raw':!![],'where':{}},_0x2f7092={},_0x65432;return db[_0x0a9e('0x2a')][_0x0a9e('0x50')]({'where':{'id':_0x5da27d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x5df0ad,null))[_0x0a9e('0x23')](function(_0x28d814){if(_0x28d814){_0x65432=_0x28d814['get']({'plain':!![]});_0x2f7092[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x51')][_0x0a9e('0x2b')]);_0x2f7092[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5da27d['query']);_0x2f7092[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x2f7092['model'],_0x2f7092[_0x0a9e('0x2e')]);_0x47de4c['attributes']=_[_0x0a9e('0x2f')](_0x2f7092['model'],qs['fields'](_0x5da27d['query'][_0x0a9e('0x31')]));_0x47de4c['attributes']=_0x47de4c[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x47de4c[_0x0a9e('0x30')]:_0x2f7092[_0x0a9e('0x2c')];if(!_0x5da27d[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x47de4c[_0x0a9e('0x1d')]=qs['limit'](_0x5da27d[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x47de4c[_0x0a9e('0x1c')]=qs['offset'](_0x5da27d[_0x0a9e('0x2e')][_0x0a9e('0x1c')]);}_0x47de4c[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x5da27d['query'][_0x0a9e('0x35')]);_0x47de4c[_0x0a9e('0x39')]=qs['filters'](_[_0x0a9e('0x52')](_0x5da27d[_0x0a9e('0x2e')],_0x2f7092[_0x0a9e('0x36')]));_0x47de4c[_0x0a9e('0x39')][_0x0a9e('0x53')]=_0x28d814['id'];if(_0x5da27d['query'][_0x0a9e('0x37')]){_0x47de4c[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x47de4c['where'],{'$or':_[_0x0a9e('0x3a')](_0x47de4c['attributes'],function(_0x5211e3){var _0x242745={};_0x242745[_0x5211e3]={'$like':'%'+_0x5da27d[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x242745;})});}_0x47de4c=_[_0x0a9e('0x38')]({},_0x47de4c,_0x5da27d[_0x0a9e('0x3e')]);return db[_0x0a9e('0x51')][_0x0a9e('0x54')](_0x47de4c);}})[_0x0a9e('0x23')](function(_0x2d7205){if(_0x2d7205){return db[_0x0a9e('0x55')][_0x0a9e('0x56')]({'where':{'id':_[_0x0a9e('0x3a')](_0x2d7205,_0x0a9e('0x57')),'role':_0x0a9e('0x58')},'attributes':['id',_0x0a9e('0x28'),_0x0a9e('0x59'),_0x0a9e('0x5a'),_0x0a9e('0x5b')]});}})['then'](function(_0x1b0b98){if(_0x1b0b98){return{'count':_0x1b0b98[_0x0a9e('0x1b')],'rows':_[_0x0a9e('0x3a')](_0x1b0b98['rows'],function(_0x1148a1){return{'membername':_0x1148a1[_0x0a9e('0x28')],'UserId':_0x1148a1['id'],'queue_name':_0x65432['name'],'MailQueueId':_0x65432['id'],'interface':util[_0x0a9e('0x5c')](_0x0a9e('0x5d'),_0x0a9e('0x5e'),_0x1148a1[_0x0a9e('0x28')]),'penalty':0x0,'paused':_0x1148a1[_0x0a9e('0x59')],'createdAt':_0x1148a1['createdAt'],'updatedAt':_0x1148a1['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5df0ad,_0x47de4c))[_0x0a9e('0x42')](handleError(_0x5df0ad,null));};exports[_0x0a9e('0x5f')]=function(_0x1104ad,_0x23a7d3,_0x6abd03){var _0x380ab3={};var _0xeef20={};var _0x1a0677;var _0x5512d1;return db[_0x0a9e('0x2a')][_0x0a9e('0x50')]({'where':{'id':_0x1104ad[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x23a7d3,null))[_0x0a9e('0x23')](function(_0x583b2e){if(_0x583b2e){_0x1a0677=_0x583b2e;_0xeef20[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db['Team'][_0x0a9e('0x2b')]);_0xeef20[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x1104ad[_0x0a9e('0x2e')]);_0xeef20['filters']=_[_0x0a9e('0x2f')](_0xeef20[_0x0a9e('0x2c')],_0xeef20[_0x0a9e('0x2e')]);_0x380ab3[_0x0a9e('0x30')]=_['intersection'](_0xeef20[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x1104ad[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x380ab3['attributes']=_0x380ab3[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x380ab3[_0x0a9e('0x30')]:_0xeef20[_0x0a9e('0x2c')];_0x380ab3[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x1104ad[_0x0a9e('0x2e')][_0x0a9e('0x35')]);_0x380ab3[_0x0a9e('0x39')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0x52')](_0x1104ad[_0x0a9e('0x2e')],_0xeef20[_0x0a9e('0x36')]));if(_0x1104ad[_0x0a9e('0x2e')]['filter']){_0x380ab3[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x380ab3[_0x0a9e('0x39')],{'$or':_['map'](_0x380ab3[_0x0a9e('0x30')],function(_0x33dda0){var _0x8cea96={};_0x8cea96[_0x33dda0]={'$like':'%'+_0x1104ad[_0x0a9e('0x2e')]['filter']+'%'};return _0x8cea96;})});}_0x380ab3=_['merge']({},_0x380ab3,_0x1104ad[_0x0a9e('0x3e')]);return _0x1a0677[_0x0a9e('0x5f')](_0x380ab3);}})['then'](function(_0x45108c){if(_0x45108c){_0x5512d1=_0x45108c['length'];if(!_0x1104ad[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x380ab3[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x1104ad[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x380ab3[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x1104ad[_0x0a9e('0x2e')]['offset']);}return _0x1a0677[_0x0a9e('0x5f')](_0x380ab3);}})[_0x0a9e('0x23')](function(_0x45c109){if(_0x45c109){return _0x45c109?{'count':_0x5512d1,'rows':_0x45c109}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x23a7d3,null))['catch'](handleError(_0x23a7d3,null));};exports[_0x0a9e('0x60')]=function(_0xf0db1,_0x4bf3a5,_0x1d6834){var _0x5b7940=[];var _0x163710;return db[_0x0a9e('0x61')][_0x0a9e('0x54')]({'where':{'id':_0xf0db1[_0x0a9e('0x47')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0a9e('0x62'),'attributes':['id'],'raw':!![]}]})[_0x0a9e('0x23')](function(_0x94dcf5){if(_0x94dcf5){for(var _0x5ac73d=0x0;_0x5ac73d<_0x94dcf5[_0x0a9e('0x32')];_0x5ac73d+=0x1){for(var _0x36e975=0x0;_0x36e975<_0x94dcf5[_0x5ac73d]['Agents']['length'];_0x36e975+=0x1){_0x5b7940=_[_0x0a9e('0x63')](_0x5b7940,[_0x94dcf5[_0x5ac73d]['Agents'][_0x36e975]['id']]);}}return _0x5b7940;}})['then'](function(_0x4dc6b3){if(_0x4dc6b3){return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0xf0db1[_0x0a9e('0x44')]['id']}});}})[_0x0a9e('0x23')](function(_0x3c6dd6){if(_0x3c6dd6){_0x163710=_0x3c6dd6;return _0x163710[_0x0a9e('0x64')](_0x5b7940,{'penalty':_0xf0db1['body'][_0x0a9e('0x65')]});}})['then'](function(_0x2871c1){if(_0x2871c1){return _0x163710[_0x0a9e('0x60')](_0xf0db1[_0x0a9e('0x47')][_0x0a9e('0x66')]);}})['then'](handleEntityNotFound(_0x4bf3a5,null))[_0x0a9e('0x23')](respondWithStatusCode(_0x4bf3a5,null))[_0x0a9e('0x42')](handleError(_0x4bf3a5,null));};exports[_0x0a9e('0x67')]=function(_0x5b74c3,_0xb6e411,_0x21e592){var _0x2a563d=[];var _0x22063c;return db[_0x0a9e('0x61')][_0x0a9e('0x54')]({'where':{'id':_0x5b74c3[_0x0a9e('0x2e')][_0x0a9e('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0a9e('0x62'),'attributes':['id'],'raw':!![]}]})[_0x0a9e('0x23')](function(_0x589ff3){if(_0x589ff3){for(var _0x40e0f0=0x0;_0x40e0f0<_0x589ff3[_0x0a9e('0x32')];_0x40e0f0+=0x1){for(var _0x3a1974=0x0;_0x3a1974<_0x589ff3[_0x40e0f0]['Agents'][_0x0a9e('0x32')];_0x3a1974+=0x1){_0x2a563d=_['union'](_0x2a563d,[_0x589ff3[_0x40e0f0][_0x0a9e('0x62')][_0x3a1974]['id']]);}}return _0x2a563d;}})[_0x0a9e('0x23')](function(_0x558a87){if(_0x558a87){return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x5b74c3[_0x0a9e('0x44')]['id']}});}})[_0x0a9e('0x23')](function(_0x3a9a85){if(_0x3a9a85){_0x22063c=_0x3a9a85;return _0x22063c['removeAgents'](_0x2a563d);}})[_0x0a9e('0x23')](function(_0x31d25a){if(_0x22063c){return _0x22063c[_0x0a9e('0x67')](_0x5b74c3[_0x0a9e('0x2e')][_0x0a9e('0x66')]);}})[_0x0a9e('0x23')](handleEntityNotFound(_0xb6e411,null))[_0x0a9e('0x23')](respondWithStatusCode(_0xb6e411,null))[_0x0a9e('0x42')](handleError(_0xb6e411,null));};exports[_0x0a9e('0x64')]=function(_0x31af8c,_0x151956,_0x3754e2){return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x31af8c[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x151956,null))[_0x0a9e('0x23')](function(_0x2ed526){if(_0x2ed526){return _0x2ed526[_0x0a9e('0x64')](_0x31af8c['body'][_0x0a9e('0x66')],_[_0x0a9e('0x68')](_0x31af8c['body'],[_0x0a9e('0x66'),'id'])||{})['spread'](function(_0x45d113){for(var _0x27041d=0x0;_0x27041d<_0x31af8c[_0x0a9e('0x47')][_0x0a9e('0x66')]['length'];_0x27041d+=0x1){socket[_0x0a9e('0x69')]('userMailQueue:save',{'UserId':_0x31af8c[_0x0a9e('0x47')][_0x0a9e('0x66')][_0x27041d],'MailQueueId':_0x31af8c['params']['id']});}return _0x45d113;});}})[_0x0a9e('0x23')](respondWithResult(_0x151956,null))[_0x0a9e('0x42')](handleError(_0x151956,null));};exports[_0x0a9e('0x6a')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be;return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x4ab276[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x4c788f,null))[_0x0a9e('0x23')](function(_0x3c75b9){if(_0x3c75b9){return _0x3c75b9[_0x0a9e('0x6a')](_0x4ab276['query'][_0x0a9e('0x66')])['then'](function(_0x287324){if(_[_0x0a9e('0x6b')](_0x4ab276[_0x0a9e('0x2e')][_0x0a9e('0x66')])){for(var _0x1b61d5=0x0;_0x1b61d5<_0x4ab276['query'][_0x0a9e('0x66')][_0x0a9e('0x32')];_0x1b61d5+=0x1){socket[_0x0a9e('0x69')](_0x0a9e('0x6c'),{'UserId':_0x4ab276[_0x0a9e('0x2e')]['ids'][_0x1b61d5],'MailQueueId':_0x4ab276['params']['id']});}}else{socket[_0x0a9e('0x69')]('userMailQueue:remove',{'UserId':_0x4ab276[_0x0a9e('0x2e')][_0x0a9e('0x66')],'MailQueueId':_0x4ab276[_0x0a9e('0x44')]['id']});}});}})[_0x0a9e('0x23')](respondWithStatusCode(_0x4c788f,null))[_0x0a9e('0x42')](handleError(_0x4c788f,null));};exports[_0x0a9e('0x6d')]=function(_0x596312,_0x4db918,_0x1889ed){var _0x5dfbe2={};var _0x2469d1={};var _0x5c689c;var _0x427ccc;return db['MailQueue']['findOne']({'where':{'id':_0x596312[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x4db918,null))['then'](function(_0x170af6){if(_0x170af6){_0x5c689c=_0x170af6;_0x2469d1[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x55')][_0x0a9e('0x2b')]);_0x2469d1['query']=_['keys'](_0x596312[_0x0a9e('0x2e')]);_0x2469d1[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x2469d1[_0x0a9e('0x2c')],_0x2469d1[_0x0a9e('0x2e')]);_0x5dfbe2['attributes']=_[_0x0a9e('0x2f')](_0x2469d1[_0x0a9e('0x2c')],qs['fields'](_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x5dfbe2[_0x0a9e('0x30')]=_0x5dfbe2[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x5dfbe2[_0x0a9e('0x30')]:_0x2469d1[_0x0a9e('0x2c')];_0x5dfbe2[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x596312[_0x0a9e('0x2e')]['sort']);_0x5dfbe2[_0x0a9e('0x39')]=qs[_0x0a9e('0x36')](_[_0x0a9e('0x52')](_0x596312[_0x0a9e('0x2e')],_0x2469d1[_0x0a9e('0x36')]));if(_0x596312['query']['filter']){_0x5dfbe2[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x5dfbe2[_0x0a9e('0x39')],{'$or':_[_0x0a9e('0x3a')](_0x5dfbe2[_0x0a9e('0x30')],function(_0x59e46f){var _0x1339d0={};_0x1339d0[_0x59e46f]={'$like':'%'+_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x1339d0;})});}_0x5dfbe2=_['merge']({},_0x5dfbe2,_0x596312[_0x0a9e('0x3e')]);return _0x5c689c['getAgents'](_0x5dfbe2);}})[_0x0a9e('0x23')](function(_0x4799d4){if(_0x4799d4){_0x427ccc=_0x4799d4[_0x0a9e('0x32')];if(!_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x5dfbe2[_0x0a9e('0x1d')]=qs['limit'](_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x5dfbe2[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x596312[_0x0a9e('0x2e')][_0x0a9e('0x1c')]);}return _0x5c689c[_0x0a9e('0x6d')](_0x5dfbe2);}})[_0x0a9e('0x23')](function(_0x2aaf07){if(_0x2aaf07){return _0x2aaf07?{'count':_0x427ccc,'rows':_0x2aaf07}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x4db918,null))[_0x0a9e('0x42')](handleError(_0x4db918,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 3286b83..1cbc261 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 _0xe555=['MailQueue','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x25b068,_0xb6ac60){var _0xb9f40f=function(_0x28880b){while(--_0x28880b){_0x25b068['push'](_0x25b068['shift']());}};_0xb9f40f(++_0xb6ac60);}(_0xe555,0x1ee));var _0x5e55=function(_0x576e2b,_0x328953){_0x576e2b=_0x576e2b-0x0;var _0x46461a=_0xe555[_0x576e2b];return _0x46461a;};'use strict';var EventEmitter=require(_0x5e55('0x0'));var MailQueue=require(_0x5e55('0x1'))['db'][_0x5e55('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5e55('0x3'),'afterUpdate':_0x5e55('0x4'),'afterDestroy':_0x5e55('0x5')};function emitEvent(_0x5c7b24){return function(_0x3e1728,_0x380f9b,_0x1b8846){MailQueueEvents['emit'](_0x5c7b24+':'+_0x3e1728['id'],_0x3e1728);MailQueueEvents[_0x5e55('0x6')](_0x5c7b24,_0x3e1728);_0x1b8846(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x5e55('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x9483=['remove','emit','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x9483,0xc8));var _0x3948=function(_0x34c6e9,_0x1c410d){_0x34c6e9=_0x34c6e9-0x0;var _0x12ea3d=_0x9483[_0x34c6e9];return _0x12ea3d;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x3948('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x3948('0x1')](0x0);var events={'afterCreate':_0x3948('0x2'),'afterUpdate':'update','afterDestroy':_0x3948('0x3')};function emitEvent(_0x125ee1){return function(_0xa7f3b8,_0x55a3ee,_0xb95bd6){MailQueueEvents[_0x3948('0x4')](_0x125ee1+':'+_0xa7f3b8['id'],_0xa7f3b8);MailQueueEvents['emit'](_0x125ee1,_0xa7f3b8);_0xb95bd6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x3948('0x5')](e,emitEvent(event));}}module[_0x3948('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 6d130c3..72b4750 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 _0x4512=['api','moment','bluebird','./mailQueue.attributes','exports','mail_queues','lodash','util','../../config/logger'];(function(_0x2489de,_0x1e1ad2){var _0x36c6a3=function(_0x3ccdc9){while(--_0x3ccdc9){_0x2489de['push'](_0x2489de['shift']());}};_0x36c6a3(++_0x1e1ad2);}(_0x4512,0x69));var _0x2451=function(_0x2d9e27,_0x5965b2){_0x2d9e27=_0x2d9e27-0x0;var _0xd35381=_0x4512[_0x2d9e27];return _0xd35381;};'use strict';var _=require(_0x2451('0x0'));var util=require(_0x2451('0x1'));var logger=require(_0x2451('0x2'))(_0x2451('0x3'));var moment=require(_0x2451('0x4'));var BPromise=require(_0x2451('0x5'));var rp=require('request-promise');var attributes=require(_0x2451('0x6'));module[_0x2451('0x7')]=function(_0x452cf9,_0x2d7ba7){return _0x452cf9['define']('MailQueue',attributes,{'tableName':_0x2451('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf874=['mail_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','./mailQueue.attributes','exports','MailQueue'];(function(_0x3f9777,_0x2ccb58){var _0x460b44=function(_0x5be71d){while(--_0x5be71d){_0x3f9777['push'](_0x3f9777['shift']());}};_0x460b44(++_0x2ccb58);}(_0xf874,0xbf));var _0x4f87=function(_0x594272,_0x2411f1){_0x594272=_0x594272-0x0;var _0x4f6d01=_0xf874[_0x594272];return _0x4f6d01;};'use strict';var _=require(_0x4f87('0x0'));var util=require('util');var logger=require(_0x4f87('0x1'))(_0x4f87('0x2'));var moment=require(_0x4f87('0x3'));var BPromise=require(_0x4f87('0x4'));var rp=require(_0x4f87('0x5'));var attributes=require(_0x4f87('0x6'));module[_0x4f87('0x7')]=function(_0x42a1bd,_0x38793d){return _0x42a1bd['define'](_0x4f87('0x8'),attributes,{'tableName':_0x4f87('0x9'),'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 41ba6c7..ae67b35 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 _0x3ad0=['GetMailQueue','debug','stringify','catch','ShowMailQueue','attributes','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','code','message','error','result','MailQueue','options','raw','where','limit','include','map','model'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3ad0,0x178));var _0x03ad=function(_0x4044cb,_0x340f06){_0x4044cb=_0x4044cb-0x0;var _0x59c771=_0x3ad0[_0x4044cb];return _0x59c771;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x03ad('0x0'));var BPromise=require(_0x03ad('0x1'));var rs=require(_0x03ad('0x2'));var fs=require('fs');var Redis=require(_0x03ad('0x3'));var db=require(_0x03ad('0x4'))['db'];var utils=require(_0x03ad('0x5'));var logger=require('../../config/logger')(_0x03ad('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x03ad('0x7')]=_[_0x03ad('0x8')](config[_0x03ad('0x7')],{'host':_0x03ad('0x9'),'port':0x18eb});var socket=require(_0x03ad('0xa'))(new Redis(config[_0x03ad('0x7')]));require(_0x03ad('0xb'))[_0x03ad('0xc')](socket);function respondWithRpcPromise(_0x173db9,_0x3b3507,_0x52c5f1){return new BPromise(function(_0x153945,_0x5f0dd6){return client[_0x03ad('0xd')](_0x173db9,_0x52c5f1)[_0x03ad('0xe')](function(_0x10963f){logger[_0x03ad('0xf')](_0x03ad('0x10'),_0x3b3507,'request\x20sent');logger['debug'](_0x03ad('0x11'),_0x3b3507,_0x03ad('0x12'),JSON['stringify'](_0x10963f));if(_0x10963f['error']){if(_0x10963f['error'][_0x03ad('0x13')]===0x1f4){logger['error'](_0x03ad('0x10'),_0x3b3507,_0x10963f['error'][_0x03ad('0x14')]);return _0x5f0dd6(_0x10963f['error']['message']);}logger[_0x03ad('0x15')](_0x03ad('0x10'),_0x3b3507,_0x10963f[_0x03ad('0x15')][_0x03ad('0x14')]);return _0x153945(_0x10963f['error']['message']);}else{logger[_0x03ad('0xf')](_0x03ad('0x10'),_0x3b3507,_0x03ad('0x12'));_0x153945(_0x10963f[_0x03ad('0x16')][_0x03ad('0x14')]);}})['catch'](function(_0x1627b4){logger[_0x03ad('0x15')](_0x03ad('0x10'),_0x3b3507,_0x1627b4);_0x5f0dd6(_0x1627b4);});});}exports['GetMailQueue']=function(_0xe4e897){var _0x4489f4=this;return new Promise(function(_0x30aa93,_0x8293c4){return db[_0x03ad('0x17')]['findAll']({'raw':_0xe4e897[_0x03ad('0x18')]?_0xe4e897[_0x03ad('0x18')][_0x03ad('0x19')]===undefined?!![]:![]:!![],'where':_0xe4e897[_0x03ad('0x18')]?_0xe4e897[_0x03ad('0x18')][_0x03ad('0x1a')]||null:null,'attributes':_0xe4e897['options']?_0xe4e897[_0x03ad('0x18')]['attributes']||null:null,'limit':_0xe4e897['options']?_0xe4e897[_0x03ad('0x18')][_0x03ad('0x1b')]||null:null,'include':_0xe4e897[_0x03ad('0x18')]?_0xe4e897[_0x03ad('0x18')][_0x03ad('0x1c')]?_[_0x03ad('0x1d')](_0xe4e897[_0x03ad('0x18')]['include'],function(_0x53e026){return{'model':db[_0x53e026['model']],'as':_0x53e026['as'],'attributes':_0x53e026['attributes'],'include':_0x53e026[_0x03ad('0x1c')]?_[_0x03ad('0x1d')](_0x53e026[_0x03ad('0x1c')],function(_0x2b9e5d){return{'model':db[_0x2b9e5d['model']],'as':_0x2b9e5d['as'],'attributes':_0x2b9e5d['attributes'],'include':_0x2b9e5d[_0x03ad('0x1c')]?_['map'](_0x2b9e5d[_0x03ad('0x1c')],function(_0x42d885){return{'model':db[_0x42d885[_0x03ad('0x1e')]],'as':_0x42d885['as'],'attributes':_0x42d885['attributes']};}):[]};}):[]};}):[]:[]})[_0x03ad('0xe')](function(_0x394eda){logger[_0x03ad('0xf')](_0x03ad('0x1f'),_0xe4e897);logger[_0x03ad('0x20')](_0x03ad('0x1f'),_0xe4e897,JSON[_0x03ad('0x21')](_0x394eda));_0x30aa93(_0x394eda);})[_0x03ad('0x22')](function(_0x3ce36d){logger['error']('GetMailQueue',_0x3ce36d[_0x03ad('0x14')],_0xe4e897);_0x8293c4(_0x4489f4['error'](0x1f4,_0x3ce36d['message']));});});};exports[_0x03ad('0x23')]=function(_0x5f2e5e){var _0x1bcf06=this;return new Promise(function(_0x3ffc16,_0x305db7){return db['MailQueue']['find']({'raw':_0x5f2e5e[_0x03ad('0x18')]?_0x5f2e5e[_0x03ad('0x18')][_0x03ad('0x19')]===undefined?!![]:![]:!![],'where':_0x5f2e5e[_0x03ad('0x18')]?_0x5f2e5e[_0x03ad('0x18')]['where']||null:null,'attributes':_0x5f2e5e[_0x03ad('0x18')]?_0x5f2e5e[_0x03ad('0x18')]['attributes']||null:null,'include':_0x5f2e5e[_0x03ad('0x18')]?_0x5f2e5e[_0x03ad('0x18')][_0x03ad('0x1c')]?_[_0x03ad('0x1d')](_0x5f2e5e[_0x03ad('0x18')]['include'],function(_0x2fd9cb){return{'model':db[_0x2fd9cb[_0x03ad('0x1e')]],'as':_0x2fd9cb['as'],'attributes':_0x2fd9cb[_0x03ad('0x24')],'include':_0x2fd9cb[_0x03ad('0x1c')]?_['map'](_0x2fd9cb[_0x03ad('0x1c')],function(_0x7e3cb7){return{'model':db[_0x7e3cb7['model']],'as':_0x7e3cb7['as'],'attributes':_0x7e3cb7[_0x03ad('0x24')],'include':_0x7e3cb7[_0x03ad('0x1c')]?_['map'](_0x7e3cb7[_0x03ad('0x1c')],function(_0x213e61){return{'model':db[_0x213e61[_0x03ad('0x1e')]],'as':_0x213e61['as'],'attributes':_0x213e61[_0x03ad('0x24')]};}):[]};}):[]};}):[]:[]})[_0x03ad('0xe')](function(_0xb61456){logger['info'](_0x03ad('0x23'),_0x5f2e5e);logger[_0x03ad('0x20')]('ShowMailQueue',_0x5f2e5e,JSON[_0x03ad('0x21')](_0xb61456));_0x3ffc16(_0xb61456);})[_0x03ad('0x22')](function(_0x570cdc){logger['error'](_0x03ad('0x23'),_0x570cdc[_0x03ad('0x14')],_0x5f2e5e);_0x305db7(_0x1bcf06[_0x03ad('0x15')](0x1f4,_0x570cdc[_0x03ad('0x14')]));});});}; \ No newline at end of file +var _0x5448=['ShowMailQueue','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','error','code','MailQueue,\x20%s,\x20%s','message','result','catch','GetMailQueue','findAll','options','raw','where','attributes','map','include','model','stringify','find','debug'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x5448,0x1b1));var _0x8544=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x5448[_0xd1d19a];return _0x52a79d;};'use strict';var _=require('lodash');var util=require(_0x8544('0x0'));var moment=require(_0x8544('0x1'));var BPromise=require(_0x8544('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8544('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8544('0x4'));var logger=require('../../config/logger')(_0x8544('0x5'));var config=require(_0x8544('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8544('0x7')][_0x8544('0x8')]({'port':0x232a});config[_0x8544('0x9')]=_['defaults'](config['redis'],{'host':_0x8544('0xa'),'port':0x18eb});var socket=require(_0x8544('0xb'))(new Redis(config[_0x8544('0x9')]));require('./mailQueue.socket')[_0x8544('0xc')](socket);function respondWithRpcPromise(_0xd30b22,_0x240d2e,_0x39a188){return new BPromise(function(_0x4a0444,_0x2d9d49){return client[_0x8544('0xd')](_0xd30b22,_0x39a188)[_0x8544('0xe')](function(_0x5cbf2c){logger[_0x8544('0xf')]('MailQueue,\x20%s,\x20%s',_0x240d2e,_0x8544('0x10'));logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x240d2e,'request\x20sent',JSON['stringify'](_0x5cbf2c));if(_0x5cbf2c[_0x8544('0x11')]){if(_0x5cbf2c['error'][_0x8544('0x12')]===0x1f4){logger[_0x8544('0x11')](_0x8544('0x13'),_0x240d2e,_0x5cbf2c[_0x8544('0x11')][_0x8544('0x14')]);return _0x2d9d49(_0x5cbf2c[_0x8544('0x11')][_0x8544('0x14')]);}logger[_0x8544('0x11')](_0x8544('0x13'),_0x240d2e,_0x5cbf2c[_0x8544('0x11')]['message']);return _0x4a0444(_0x5cbf2c[_0x8544('0x11')][_0x8544('0x14')]);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x240d2e,'request\x20sent');_0x4a0444(_0x5cbf2c[_0x8544('0x15')][_0x8544('0x14')]);}})[_0x8544('0x16')](function(_0xb04746){logger[_0x8544('0x11')]('MailQueue,\x20%s,\x20%s',_0x240d2e,_0xb04746);_0x2d9d49(_0xb04746);});});}exports[_0x8544('0x17')]=function(_0x1f86b9){var _0x466123=this;return new Promise(function(_0x1ad9c1,_0x219e9d){return db['MailQueue'][_0x8544('0x18')]({'raw':_0x1f86b9[_0x8544('0x19')]?_0x1f86b9[_0x8544('0x19')][_0x8544('0x1a')]===undefined?!![]:![]:!![],'where':_0x1f86b9['options']?_0x1f86b9[_0x8544('0x19')][_0x8544('0x1b')]||null:null,'attributes':_0x1f86b9[_0x8544('0x19')]?_0x1f86b9[_0x8544('0x19')][_0x8544('0x1c')]||null:null,'limit':_0x1f86b9[_0x8544('0x19')]?_0x1f86b9[_0x8544('0x19')]['limit']||null:null,'include':_0x1f86b9[_0x8544('0x19')]?_0x1f86b9[_0x8544('0x19')]['include']?_[_0x8544('0x1d')](_0x1f86b9[_0x8544('0x19')][_0x8544('0x1e')],function(_0x48c944){return{'model':db[_0x48c944[_0x8544('0x1f')]],'as':_0x48c944['as'],'attributes':_0x48c944[_0x8544('0x1c')],'include':_0x48c944[_0x8544('0x1e')]?_[_0x8544('0x1d')](_0x48c944['include'],function(_0x2e32d9){return{'model':db[_0x2e32d9['model']],'as':_0x2e32d9['as'],'attributes':_0x2e32d9[_0x8544('0x1c')],'include':_0x2e32d9[_0x8544('0x1e')]?_[_0x8544('0x1d')](_0x2e32d9[_0x8544('0x1e')],function(_0x3f0a9f){return{'model':db[_0x3f0a9f[_0x8544('0x1f')]],'as':_0x3f0a9f['as'],'attributes':_0x3f0a9f[_0x8544('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c1617){logger[_0x8544('0xf')](_0x8544('0x17'),_0x1f86b9);logger['debug'](_0x8544('0x17'),_0x1f86b9,JSON[_0x8544('0x20')](_0x5c1617));_0x1ad9c1(_0x5c1617);})[_0x8544('0x16')](function(_0x81e29d){logger[_0x8544('0x11')](_0x8544('0x17'),_0x81e29d[_0x8544('0x14')],_0x1f86b9);_0x219e9d(_0x466123['error'](0x1f4,_0x81e29d[_0x8544('0x14')]));});});};exports['ShowMailQueue']=function(_0x38d1cb){var _0x50098e=this;return new Promise(function(_0x5a1908,_0x41ee16){return db['MailQueue'][_0x8544('0x21')]({'raw':_0x38d1cb[_0x8544('0x19')]?_0x38d1cb[_0x8544('0x19')][_0x8544('0x1a')]===undefined?!![]:![]:!![],'where':_0x38d1cb[_0x8544('0x19')]?_0x38d1cb[_0x8544('0x19')]['where']||null:null,'attributes':_0x38d1cb[_0x8544('0x19')]?_0x38d1cb['options']['attributes']||null:null,'include':_0x38d1cb[_0x8544('0x19')]?_0x38d1cb[_0x8544('0x19')][_0x8544('0x1e')]?_['map'](_0x38d1cb[_0x8544('0x19')][_0x8544('0x1e')],function(_0xb3db4d){return{'model':db[_0xb3db4d['model']],'as':_0xb3db4d['as'],'attributes':_0xb3db4d[_0x8544('0x1c')],'include':_0xb3db4d[_0x8544('0x1e')]?_[_0x8544('0x1d')](_0xb3db4d[_0x8544('0x1e')],function(_0x3df4e0){return{'model':db[_0x3df4e0[_0x8544('0x1f')]],'as':_0x3df4e0['as'],'attributes':_0x3df4e0[_0x8544('0x1c')],'include':_0x3df4e0[_0x8544('0x1e')]?_[_0x8544('0x1d')](_0x3df4e0['include'],function(_0x239701){return{'model':db[_0x239701['model']],'as':_0x239701['as'],'attributes':_0x239701[_0x8544('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8544('0xe')](function(_0x5b377e){logger[_0x8544('0xf')]('ShowMailQueue',_0x38d1cb);logger[_0x8544('0x22')](_0x8544('0x23'),_0x38d1cb,JSON[_0x8544('0x20')](_0x5b377e));_0x5a1908(_0x5b377e);})[_0x8544('0x16')](function(_0x366a01){logger[_0x8544('0x11')](_0x8544('0x23'),_0x366a01['message'],_0x38d1cb);_0x41ee16(_0x50098e[_0x8544('0x11')](0x1f4,_0x366a01[_0x8544('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 5790252..4919e84 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 _0x4e25=['remove','update','length','mailQueue:','./mailQueue.events','save'];(function(_0x2565d5,_0xe6c944){var _0x1b546c=function(_0xe00d3a){while(--_0xe00d3a){_0x2565d5['push'](_0x2565d5['shift']());}};_0x1b546c(++_0xe6c944);}(_0x4e25,0x166));var _0x54e2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4e25[_0x321bb2];return _0x9c12ed;};'use strict';var MailQueueEvents=require(_0x54e2('0x0'));var events=[_0x54e2('0x1'),_0x54e2('0x2'),_0x54e2('0x3')];function createListener(_0x4d0462,_0x23a30c){return function(_0x4affa2){_0x23a30c['emit'](_0x4d0462,_0x4affa2);};}function removeListener(_0x139751,_0x3dfddb){return function(){MailQueueEvents['removeListener'](_0x139751,_0x3dfddb);};}exports['register']=function(_0x52433d){for(var _0x3f35af=0x0,_0x4b8924=events[_0x54e2('0x4')];_0x3f35af<_0x4b8924;_0x3f35af++){var _0x370a08=events[_0x3f35af];var _0x50503d=createListener(_0x54e2('0x5')+_0x370a08,_0x52433d);MailQueueEvents['on'](_0x370a08,_0x50503d);}}; \ No newline at end of file +var _0x250f=['./mailQueue.events','save','remove','update','emit','removeListener','mailQueue:'];(function(_0x4bc4f3,_0xb93bd2){var _0x478fab=function(_0x2404ea){while(--_0x2404ea){_0x4bc4f3['push'](_0x4bc4f3['shift']());}};_0x478fab(++_0xb93bd2);}(_0x250f,0x1c7));var _0xf250=function(_0x19c759,_0x1af748){_0x19c759=_0x19c759-0x0;var _0x5c0982=_0x250f[_0x19c759];return _0x5c0982;};'use strict';var MailQueueEvents=require(_0xf250('0x0'));var events=[_0xf250('0x1'),_0xf250('0x2'),_0xf250('0x3')];function createListener(_0x560674,_0x21b625){return function(_0x2d0e6b){_0x21b625[_0xf250('0x4')](_0x560674,_0x2d0e6b);};}function removeListener(_0x2cf4b2,_0x1157d2){return function(){MailQueueEvents[_0xf250('0x5')](_0x2cf4b2,_0x1157d2);};}exports['register']=function(_0x4d92d7){for(var _0x24f91a=0x0,_0x4382e3=events['length'];_0x24f91a<_0x4382e3;_0x24f91a++){var _0x4cf630=events[_0x24f91a];var _0x1bcf98=createListener(_0xf250('0x6')+_0x4cf630,_0x4d92d7);MailQueueEvents['on'](_0x4cf630,_0x1bcf98);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 9919d0b..c563c43 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 _0x340b=['show','put','update','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x539e85,_0x5281d2){var _0x34ccf1=function(_0x30527d){while(--_0x30527d){_0x539e85['push'](_0x539e85['shift']());}};_0x34ccf1(++_0x5281d2);}(_0x340b,0x71));var _0xb340=function(_0x112f89,_0x6bae12){_0x112f89=_0x112f89-0x0;var _0x326a9d=_0x340b[_0x112f89];return _0x326a9d;};'use strict';var multer=require('multer');var util=require(_0xb340('0x0'));var path=require(_0xb340('0x1'));var timeout=require(_0xb340('0x2'));var express=require('express');var router=express[_0xb340('0x3')]();var auth=require(_0xb340('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb340('0x5'));var controller=require(_0xb340('0x6'));router[_0xb340('0x7')]('/',auth[_0xb340('0x8')](),controller[_0xb340('0x9')]);router[_0xb340('0x7')](_0xb340('0xa'),auth[_0xb340('0x8')](),controller[_0xb340('0xb')]);router['get'](_0xb340('0xc'),auth[_0xb340('0x8')](),controller[_0xb340('0xd')]);router['post']('/',auth[_0xb340('0x8')](),controller['create']);router[_0xb340('0xe')](_0xb340('0xc'),auth[_0xb340('0x8')](),controller[_0xb340('0xf')]);router[_0xb340('0x10')](_0xb340('0xc'),auth[_0xb340('0x8')](),controller[_0xb340('0x11')]);module['exports']=router; \ No newline at end of file +var _0x7280=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','/describe','describe','post','create','put','/:id','update','destroy'];(function(_0x581cad,_0x355b2e){var _0x1a9f4b=function(_0x5c8461){while(--_0x5c8461){_0x581cad['push'](_0x581cad['shift']());}};_0x1a9f4b(++_0x355b2e);}(_0x7280,0xbf));var _0x0728=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x7280[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0x0728('0x0'));var util=require(_0x0728('0x1'));var path=require(_0x0728('0x2'));var timeout=require(_0x0728('0x3'));var express=require(_0x0728('0x4'));var router=express[_0x0728('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0728('0x6'));var config=require('../../config/environment');var controller=require(_0x0728('0x7'));router[_0x0728('0x8')]('/',auth[_0x0728('0x9')](),controller['index']);router[_0x0728('0x8')](_0x0728('0xa'),auth['isAuthenticated'](),controller[_0x0728('0xb')]);router[_0x0728('0x8')]('/:id',auth[_0x0728('0x9')](),controller['show']);router[_0x0728('0xc')]('/',auth['isAuthenticated'](),controller[_0x0728('0xd')]);router[_0x0728('0xe')](_0x0728('0xf'),auth['isAuthenticated'](),controller[_0x0728('0x10')]);router['delete']('/:id',auth[_0x0728('0x9')](),controller[_0x0728('0x11')]);module[_0x0728('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index f20a794..26c7940 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 _0x6498=['moment','STRING','DATE'];(function(_0x78b63c,_0x4df210){var _0x34448c=function(_0x298a88){while(--_0x298a88){_0x78b63c['push'](_0x78b63c['shift']());}};_0x34448c(++_0x4df210);}(_0x6498,0xba));var _0x8649=function(_0x5e3a67,_0x132b2c){_0x5e3a67=_0x5e3a67-0x0;var _0xa9604d=_0x6498[_0x5e3a67];return _0xa9604d;};'use strict';var moment=require(_0x8649('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x8649('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x8649('0x1')]},'joinAt':{'type':Sequelize[_0x8649('0x2')]},'leaveAt':{'type':Sequelize[_0x8649('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x8649('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x37d2=['DATE','moment','sequelize','exports','STRING'];(function(_0x4bd67a,_0x4f9725){var _0x2be5fb=function(_0x33e132){while(--_0x33e132){_0x4bd67a['push'](_0x4bd67a['shift']());}};_0x2be5fb(++_0x4f9725);}(_0x37d2,0xe7));var _0x237d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x37d2[_0x1facfa];return _0x9ec701;};'use strict';var moment=require(_0x237d('0x0'));var Sequelize=require(_0x237d('0x1'));module[_0x237d('0x2')]={'uniqueid':{'type':Sequelize[_0x237d('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x237d('0x4')]},'acceptAt':{'type':Sequelize[_0x237d('0x4')]},'exitAt':{'type':Sequelize[_0x237d('0x4')]},'reason':{'type':Sequelize[_0x237d('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 445f48a..2552875 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 _0xa3d6=['map','type','key','VIRTUAL','field','options','MailQueueReport','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','index','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x7e351f,_0x177cd2){var _0x4f8cdb=function(_0x5c3aad){while(--_0x5c3aad){_0x7e351f['push'](_0x7e351f['shift']());}};_0x4f8cdb(++_0x177cd2);}(_0xa3d6,0xf6));var _0x6a3d=function(_0x3ba201,_0x3ae418){_0x3ba201=_0x3ba201-0x0;var _0xbd848f=_0xa3d6[_0x3ba201];return _0xbd848f;};'use strict';var pdf=require(_0x6a3d('0x0'));var emlformat=require(_0x6a3d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6a3d('0x2'));var jsonpatch=require(_0x6a3d('0x3'));var rp=require(_0x6a3d('0x4'));var moment=require(_0x6a3d('0x5'));var BPromise=require(_0x6a3d('0x6'));var Mustache=require(_0x6a3d('0x7'));var util=require(_0x6a3d('0x8'));var path=require(_0x6a3d('0x9'));var sox=require(_0x6a3d('0xa'));var csv=require(_0x6a3d('0xb'));var ejs=require(_0x6a3d('0xc'));var fs=require('fs');var _=require(_0x6a3d('0xd'));var squel=require(_0x6a3d('0xe'));var crypto=require(_0x6a3d('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x6a3d('0x10'));var toCsv=require(_0x6a3d('0xb'));var querystring=require('querystring');var Papa=require(_0x6a3d('0x11'));var authService=require(_0x6a3d('0x12'));var hardwareService=require(_0x6a3d('0x13'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x6a3d('0x14'))(_0x6a3d('0x15'));var utils=require(_0x6a3d('0x16'));var config=require('../../config/environment');var db=require(_0x6a3d('0x17'))['db'];function respondWithStatusCode(_0x51d693,_0x583f18){_0x583f18=_0x583f18||0xcc;return function(_0x534915){if(_0x534915){return _0x51d693[_0x6a3d('0x18')](_0x583f18);}return _0x51d693[_0x6a3d('0x19')](_0x583f18)[_0x6a3d('0x1a')]();};}function respondWithResult(_0x45f612,_0xc694b4){_0xc694b4=_0xc694b4||0xc8;return function(_0x2b4d4a){if(_0x2b4d4a){return _0x45f612[_0x6a3d('0x19')](_0xc694b4)['json'](_0x2b4d4a);}};}function respondWithFilteredResult(_0x4bf0b9,_0x38a2b9){return function(_0x122269){if(_0x122269){var _0x43ce59=_0x122269[_0x6a3d('0x1b')],_0x3dd19e=_0x38a2b9[_0x6a3d('0x1c')],_0x2eea57=_0x38a2b9[_0x6a3d('0x1c')]+_0x38a2b9[_0x6a3d('0x1d')],_0x573735;if(_0x2eea57>=_0x43ce59){_0x2eea57=_0x43ce59;_0x573735=0xc8;}else{_0x573735=0xce;}_0x4bf0b9['status'](_0x573735);return _0x4bf0b9[_0x6a3d('0x1e')](_0x6a3d('0x1f'),_0x3dd19e+'-'+_0x2eea57+'/'+_0x43ce59)[_0x6a3d('0x20')](_0x122269);}return null;};}function patchUpdates(_0x549f8c){return function(_0x24d28e){try{jsonpatch[_0x6a3d('0x21')](_0x24d28e,_0x549f8c,!![]);}catch(_0xfcdce4){return BPromise[_0x6a3d('0x22')](_0xfcdce4);}return _0x24d28e['save']();};}function saveUpdates(_0x7940cc,_0x3b778c){return function(_0x2c16a8){if(_0x2c16a8){return _0x2c16a8[_0x6a3d('0x23')](_0x7940cc)[_0x6a3d('0x24')](function(_0x39c804){return _0x39c804;});}return null;};}function removeEntity(_0x1d905a,_0x1dac4b){return function(_0x62a357){if(_0x62a357){return _0x62a357[_0x6a3d('0x25')]()[_0x6a3d('0x24')](function(){_0x1d905a[_0x6a3d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x136e90,_0x5520eb){return function(_0x20cd2d){if(!_0x20cd2d){_0x136e90['sendStatus'](0x194);}return _0x20cd2d;};}function handleError(_0x3937dc,_0x5d958e){_0x5d958e=_0x5d958e||0x1f4;return function(_0x4f5435){logger[_0x6a3d('0x26')](_0x4f5435[_0x6a3d('0x27')]);if(_0x4f5435[_0x6a3d('0x28')]){delete _0x4f5435[_0x6a3d('0x28')];}_0x3937dc[_0x6a3d('0x19')](_0x5d958e)['send'](_0x4f5435);};}exports[_0x6a3d('0x29')]=function(_0xc2192,_0x22016c){var _0x13920d={},_0x7f93f2={},_0x40aa90={'count':0x0,'rows':[]};var _0x2a6bfb=db['MailQueueReport']['rawAttributes'];_0x7f93f2[_0x6a3d('0x2a')]=_[_0x6a3d('0x2b')](_0x2a6bfb);_0x7f93f2[_0x6a3d('0x2c')]=_[_0x6a3d('0x2b')](_0xc2192[_0x6a3d('0x2c')]);_0x7f93f2[_0x6a3d('0x2d')]=_[_0x6a3d('0x2e')](_0x7f93f2[_0x6a3d('0x2a')],_0x7f93f2[_0x6a3d('0x2c')]);_0x13920d[_0x6a3d('0x2f')]=_[_0x6a3d('0x2e')](_0x7f93f2[_0x6a3d('0x2a')],qs[_0x6a3d('0x30')](_0xc2192[_0x6a3d('0x2c')][_0x6a3d('0x30')]));_0x13920d[_0x6a3d('0x2f')]=_0x13920d['attributes'][_0x6a3d('0x31')]?_0x13920d[_0x6a3d('0x2f')]:_0x7f93f2[_0x6a3d('0x2a')];if(!_0xc2192[_0x6a3d('0x2c')][_0x6a3d('0x32')](_0x6a3d('0x33'))){_0x13920d['limit']=qs['limit'](_0xc2192[_0x6a3d('0x2c')][_0x6a3d('0x1d')]);_0x13920d[_0x6a3d('0x1c')]=qs[_0x6a3d('0x1c')](_0xc2192[_0x6a3d('0x2c')][_0x6a3d('0x1c')]);}_0x13920d[_0x6a3d('0x34')]=qs[_0x6a3d('0x35')](_0xc2192[_0x6a3d('0x2c')][_0x6a3d('0x35')]);_0x13920d[_0x6a3d('0x36')]=qs['filters'](_[_0x6a3d('0x37')](_0xc2192[_0x6a3d('0x2c')],_0x7f93f2[_0x6a3d('0x2d')]));if(_0xc2192[_0x6a3d('0x2c')][_0x6a3d('0x38')]){_0x13920d[_0x6a3d('0x36')]=_[_0x6a3d('0x39')](_0x13920d['where'],{'$or':_[_0x6a3d('0x3a')](_0x2a6bfb,function(_0x4c1a92){if(_0x4c1a92[_0x6a3d('0x3b')][_0x6a3d('0x3c')]!==_0x6a3d('0x3d')){var _0x1da6fe={};_0x1da6fe[_0x4c1a92[_0x6a3d('0x3e')]]={'$like':'%'+_0xc2192['query'][_0x6a3d('0x38')]+'%'};return _0x1da6fe;}})});}_0x13920d=_[_0x6a3d('0x39')]({},_0x13920d,_0xc2192[_0x6a3d('0x3f')]);var _0x1c1ef0={'where':_0x13920d[_0x6a3d('0x36')]};return db[_0x6a3d('0x40')]['count'](_0x1c1ef0)[_0x6a3d('0x24')](function(_0x56740a){_0x40aa90[_0x6a3d('0x1b')]=_0x56740a;if(_0xc2192[_0x6a3d('0x2c')][_0x6a3d('0x41')]){_0x13920d[_0x6a3d('0x42')]=[{'all':!![]}];}return db[_0x6a3d('0x40')][_0x6a3d('0x43')](_0x13920d);})['then'](function(_0x4672eb){_0x40aa90[_0x6a3d('0x44')]=_0x4672eb;return _0x40aa90;})['then'](respondWithFilteredResult(_0x22016c,_0x13920d))[_0x6a3d('0x45')](handleError(_0x22016c,null));};exports[_0x6a3d('0x46')]=function(_0x526e1c,_0x480aa6){var _0x1502bc={'raw':!![],'where':{'id':_0x526e1c['params']['id']}},_0x13ed85={};_0x13ed85['model']=_['keys'](db[_0x6a3d('0x40')]['rawAttributes']);_0x13ed85[_0x6a3d('0x2c')]=_[_0x6a3d('0x2b')](_0x526e1c[_0x6a3d('0x2c')]);_0x13ed85['filters']=_[_0x6a3d('0x2e')](_0x13ed85[_0x6a3d('0x2a')],_0x13ed85[_0x6a3d('0x2c')]);_0x1502bc['attributes']=_[_0x6a3d('0x2e')](_0x13ed85[_0x6a3d('0x2a')],qs['fields'](_0x526e1c[_0x6a3d('0x2c')][_0x6a3d('0x30')]));_0x1502bc[_0x6a3d('0x2f')]=_0x1502bc[_0x6a3d('0x2f')][_0x6a3d('0x31')]?_0x1502bc[_0x6a3d('0x2f')]:_0x13ed85['model'];if(_0x526e1c[_0x6a3d('0x2c')][_0x6a3d('0x41')]){_0x1502bc[_0x6a3d('0x42')]=[{'all':!![]}];}_0x1502bc=_[_0x6a3d('0x39')]({},_0x1502bc,_0x526e1c['options']);return db[_0x6a3d('0x40')][_0x6a3d('0x47')](_0x1502bc)[_0x6a3d('0x24')](handleEntityNotFound(_0x480aa6,null))['then'](respondWithResult(_0x480aa6,null))[_0x6a3d('0x45')](handleError(_0x480aa6,null));};exports[_0x6a3d('0x48')]=function(_0x4949a2,_0x35325a){return db[_0x6a3d('0x40')][_0x6a3d('0x48')](_0x4949a2[_0x6a3d('0x49')],{})[_0x6a3d('0x24')](respondWithResult(_0x35325a,0xc9))[_0x6a3d('0x45')](handleError(_0x35325a,null));};exports['update']=function(_0xf5ac13,_0x569490){if(_0xf5ac13[_0x6a3d('0x49')]['id']){delete _0xf5ac13[_0x6a3d('0x49')]['id'];}return db[_0x6a3d('0x40')][_0x6a3d('0x47')]({'where':{'id':_0xf5ac13[_0x6a3d('0x4a')]['id']}})[_0x6a3d('0x24')](handleEntityNotFound(_0x569490,null))['then'](saveUpdates(_0xf5ac13[_0x6a3d('0x49')],null))[_0x6a3d('0x24')](respondWithResult(_0x569490,null))[_0x6a3d('0x45')](handleError(_0x569490,null));};exports[_0x6a3d('0x25')]=function(_0x3a9502,_0xca15d7){return db[_0x6a3d('0x40')][_0x6a3d('0x47')]({'where':{'id':_0x3a9502['params']['id']}})[_0x6a3d('0x24')](handleEntityNotFound(_0xca15d7,null))[_0x6a3d('0x24')](removeEntity(_0xca15d7,null))[_0x6a3d('0x45')](handleError(_0xca15d7,null));};exports[_0x6a3d('0x4b')]=function(_0x52131c,_0x30c319){return db[_0x6a3d('0x40')][_0x6a3d('0x4b')]()[_0x6a3d('0x24')](respondWithResult(_0x30c319,null))[_0x6a3d('0x45')](handleError(_0x30c319,null));}; \ No newline at end of file +var _0x0087=['reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','where','merge','map','key','VIRTUAL','field','filter','options','MailQueueReport','include','findAll','catch','show','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','apply'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0087,0x149));var _0x7008=function(_0x14b61b,_0x8968d9){_0x14b61b=_0x14b61b-0x0;var _0x45e287=_0x0087[_0x14b61b];return _0x45e287;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7008('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7008('0x1'));var jsonpatch=require(_0x7008('0x2'));var rp=require(_0x7008('0x3'));var moment=require('moment');var BPromise=require(_0x7008('0x4'));var Mustache=require(_0x7008('0x5'));var util=require(_0x7008('0x6'));var path=require(_0x7008('0x7'));var sox=require(_0x7008('0x8'));var csv=require(_0x7008('0x9'));var ejs=require(_0x7008('0xa'));var fs=require('fs');var _=require(_0x7008('0xb'));var squel=require('squel');var crypto=require(_0x7008('0xc'));var jsforce=require(_0x7008('0xd'));var deskjs=require(_0x7008('0xe'));var toCsv=require(_0x7008('0x9'));var querystring=require(_0x7008('0xf'));var Papa=require(_0x7008('0x10'));var authService=require('../../components/auth/service');var hardwareService=require(_0x7008('0x11'));var Redis=require('ioredis');var qs=require(_0x7008('0x12'));var logger=require(_0x7008('0x13'))(_0x7008('0x14'));var utils=require(_0x7008('0x15'));var config=require(_0x7008('0x16'));var db=require(_0x7008('0x17'))['db'];function respondWithStatusCode(_0x10629a,_0x5d419c){_0x5d419c=_0x5d419c||0xcc;return function(_0x4de849){if(_0x4de849){return _0x10629a['sendStatus'](_0x5d419c);}return _0x10629a[_0x7008('0x18')](_0x5d419c)[_0x7008('0x19')]();};}function respondWithResult(_0x1a2c5a,_0x289490){_0x289490=_0x289490||0xc8;return function(_0x44394c){if(_0x44394c){return _0x1a2c5a[_0x7008('0x18')](_0x289490)['json'](_0x44394c);}};}function respondWithFilteredResult(_0x5f1056,_0x39ef31){return function(_0x103a15){if(_0x103a15){var _0x1030ad=_0x103a15[_0x7008('0x1a')],_0x366c36=_0x39ef31[_0x7008('0x1b')],_0x127d61=_0x39ef31[_0x7008('0x1b')]+_0x39ef31[_0x7008('0x1c')],_0x16c1d2;if(_0x127d61>=_0x1030ad){_0x127d61=_0x1030ad;_0x16c1d2=0xc8;}else{_0x16c1d2=0xce;}_0x5f1056[_0x7008('0x18')](_0x16c1d2);return _0x5f1056[_0x7008('0x1d')]('Content-Range',_0x366c36+'-'+_0x127d61+'/'+_0x1030ad)['json'](_0x103a15);}return null;};}function patchUpdates(_0x137cf1){return function(_0x49e3a3){try{jsonpatch[_0x7008('0x1e')](_0x49e3a3,_0x137cf1,!![]);}catch(_0x4d09e3){return BPromise[_0x7008('0x1f')](_0x4d09e3);}return _0x49e3a3[_0x7008('0x20')]();};}function saveUpdates(_0x2e6f0e,_0x10850c){return function(_0x33121b){if(_0x33121b){return _0x33121b[_0x7008('0x21')](_0x2e6f0e)[_0x7008('0x22')](function(_0x432e32){return _0x432e32;});}return null;};}function removeEntity(_0xe2b524,_0x31e8ff){return function(_0x44d0e8){if(_0x44d0e8){return _0x44d0e8[_0x7008('0x23')]()[_0x7008('0x22')](function(){_0xe2b524[_0x7008('0x18')](0xcc)[_0x7008('0x19')]();});}};}function handleEntityNotFound(_0x183c09,_0x315e80){return function(_0x4617ce){if(!_0x4617ce){_0x183c09['sendStatus'](0x194);}return _0x4617ce;};}function handleError(_0x20ce10,_0x292da6){_0x292da6=_0x292da6||0x1f4;return function(_0x1bda16){logger[_0x7008('0x24')](_0x1bda16[_0x7008('0x25')]);if(_0x1bda16[_0x7008('0x26')]){delete _0x1bda16[_0x7008('0x26')];}_0x20ce10['status'](_0x292da6)[_0x7008('0x27')](_0x1bda16);};}exports[_0x7008('0x28')]=function(_0x7966d2,_0x425f71){var _0x34093e={},_0x4ebde8={},_0x419764={'count':0x0,'rows':[]};var _0xaf2add=db['MailQueueReport'][_0x7008('0x29')];_0x4ebde8['model']=_[_0x7008('0x2a')](_0xaf2add);_0x4ebde8[_0x7008('0x2b')]=_[_0x7008('0x2a')](_0x7966d2['query']);_0x4ebde8['filters']=_[_0x7008('0x2c')](_0x4ebde8[_0x7008('0x2d')],_0x4ebde8[_0x7008('0x2b')]);_0x34093e[_0x7008('0x2e')]=_[_0x7008('0x2c')](_0x4ebde8['model'],qs[_0x7008('0x2f')](_0x7966d2[_0x7008('0x2b')][_0x7008('0x2f')]));_0x34093e['attributes']=_0x34093e[_0x7008('0x2e')][_0x7008('0x30')]?_0x34093e[_0x7008('0x2e')]:_0x4ebde8[_0x7008('0x2d')];if(!_0x7966d2[_0x7008('0x2b')][_0x7008('0x31')]('nolimit')){_0x34093e['limit']=qs[_0x7008('0x1c')](_0x7966d2[_0x7008('0x2b')][_0x7008('0x1c')]);_0x34093e[_0x7008('0x1b')]=qs[_0x7008('0x1b')](_0x7966d2[_0x7008('0x2b')]['offset']);}_0x34093e[_0x7008('0x32')]=qs[_0x7008('0x33')](_0x7966d2['query']['sort']);_0x34093e['where']=qs[_0x7008('0x34')](_[_0x7008('0x35')](_0x7966d2[_0x7008('0x2b')],_0x4ebde8[_0x7008('0x34')]));if(_0x7966d2[_0x7008('0x2b')]['filter']){_0x34093e[_0x7008('0x36')]=_[_0x7008('0x37')](_0x34093e[_0x7008('0x36')],{'$or':_[_0x7008('0x38')](_0xaf2add,function(_0x5d8d1c){if(_0x5d8d1c['type'][_0x7008('0x39')]!==_0x7008('0x3a')){var _0xf5b1dd={};_0xf5b1dd[_0x5d8d1c[_0x7008('0x3b')]]={'$like':'%'+_0x7966d2['query'][_0x7008('0x3c')]+'%'};return _0xf5b1dd;}})});}_0x34093e=_[_0x7008('0x37')]({},_0x34093e,_0x7966d2[_0x7008('0x3d')]);var _0x843933={'where':_0x34093e[_0x7008('0x36')]};return db[_0x7008('0x3e')][_0x7008('0x1a')](_0x843933)[_0x7008('0x22')](function(_0x54a009){_0x419764[_0x7008('0x1a')]=_0x54a009;if(_0x7966d2[_0x7008('0x2b')]['includeAll']){_0x34093e[_0x7008('0x3f')]=[{'all':!![]}];}return db[_0x7008('0x3e')][_0x7008('0x40')](_0x34093e);})[_0x7008('0x22')](function(_0x271826){_0x419764['rows']=_0x271826;return _0x419764;})[_0x7008('0x22')](respondWithFilteredResult(_0x425f71,_0x34093e))[_0x7008('0x41')](handleError(_0x425f71,null));};exports[_0x7008('0x42')]=function(_0x21e8e9,_0x14c7f9){var _0x38e145={'raw':!![],'where':{'id':_0x21e8e9['params']['id']}},_0x9a52e5={};_0x9a52e5[_0x7008('0x2d')]=_['keys'](db['MailQueueReport'][_0x7008('0x29')]);_0x9a52e5[_0x7008('0x2b')]=_[_0x7008('0x2a')](_0x21e8e9[_0x7008('0x2b')]);_0x9a52e5[_0x7008('0x34')]=_['intersection'](_0x9a52e5[_0x7008('0x2d')],_0x9a52e5[_0x7008('0x2b')]);_0x38e145[_0x7008('0x2e')]=_['intersection'](_0x9a52e5[_0x7008('0x2d')],qs[_0x7008('0x2f')](_0x21e8e9[_0x7008('0x2b')][_0x7008('0x2f')]));_0x38e145['attributes']=_0x38e145[_0x7008('0x2e')][_0x7008('0x30')]?_0x38e145['attributes']:_0x9a52e5[_0x7008('0x2d')];if(_0x21e8e9[_0x7008('0x2b')]['includeAll']){_0x38e145[_0x7008('0x3f')]=[{'all':!![]}];}_0x38e145=_[_0x7008('0x37')]({},_0x38e145,_0x21e8e9[_0x7008('0x3d')]);return db[_0x7008('0x3e')][_0x7008('0x43')](_0x38e145)['then'](handleEntityNotFound(_0x14c7f9,null))[_0x7008('0x22')](respondWithResult(_0x14c7f9,null))[_0x7008('0x41')](handleError(_0x14c7f9,null));};exports[_0x7008('0x44')]=function(_0x2846b8,_0x1ae039){return db[_0x7008('0x3e')]['create'](_0x2846b8[_0x7008('0x45')],{})[_0x7008('0x22')](respondWithResult(_0x1ae039,0xc9))['catch'](handleError(_0x1ae039,null));};exports[_0x7008('0x21')]=function(_0x16fba1,_0x2f14d7){if(_0x16fba1[_0x7008('0x45')]['id']){delete _0x16fba1['body']['id'];}return db['MailQueueReport'][_0x7008('0x43')]({'where':{'id':_0x16fba1[_0x7008('0x46')]['id']}})[_0x7008('0x22')](handleEntityNotFound(_0x2f14d7,null))[_0x7008('0x22')](saveUpdates(_0x16fba1[_0x7008('0x45')],null))[_0x7008('0x22')](respondWithResult(_0x2f14d7,null))['catch'](handleError(_0x2f14d7,null));};exports[_0x7008('0x23')]=function(_0x3b2364,_0xb8e132){return db[_0x7008('0x3e')][_0x7008('0x43')]({'where':{'id':_0x3b2364[_0x7008('0x46')]['id']}})['then'](handleEntityNotFound(_0xb8e132,null))[_0x7008('0x22')](removeEntity(_0xb8e132,null))['catch'](handleError(_0xb8e132,null));};exports['describe']=function(_0x1982b2,_0x59731b){return db[_0x7008('0x3e')][_0x7008('0x47')]()[_0x7008('0x22')](respondWithResult(_0x59731b,null))['catch'](handleError(_0x59731b,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index f72310c..ef63ab7 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 _0xb2c5=['exports','MailQueueReport','report_mail_queue','uniqueid','lodash','util','bluebird','request-promise','./mailQueueReport.attributes'];(function(_0x45595c,_0x35641d){var _0x37c5c3=function(_0x3948df){while(--_0x3948df){_0x45595c['push'](_0x45595c['shift']());}};_0x37c5c3(++_0x35641d);}(_0xb2c5,0x175));var _0x5b2c=function(_0x18a378,_0x46dc75){_0x18a378=_0x18a378-0x0;var _0x23760a=_0xb2c5[_0x18a378];return _0x23760a;};'use strict';var _=require(_0x5b2c('0x0'));var util=require(_0x5b2c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5b2c('0x2'));var rp=require(_0x5b2c('0x3'));var attributes=require(_0x5b2c('0x4'));module[_0x5b2c('0x5')]=function(_0x2814bf,_0x2b7922){return _0x2814bf['define'](_0x5b2c('0x6'),attributes,{'tableName':_0x5b2c('0x7'),'paranoid':![],'indexes':[{'name':_0x5b2c('0x8'),'fields':[_0x5b2c('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6d61=['report_mail_queue','uniqueid','lodash','util','api','moment','request-promise','./mailQueueReport.attributes','exports','define','MailQueueReport'];(function(_0x2784e0,_0x4af683){var _0x563be9=function(_0x1cf187){while(--_0x1cf187){_0x2784e0['push'](_0x2784e0['shift']());}};_0x563be9(++_0x4af683);}(_0x6d61,0xd3));var _0x16d6=function(_0x471669,_0x1198de){_0x471669=_0x471669-0x0;var _0x3ecc95=_0x6d61[_0x471669];return _0x3ecc95;};'use strict';var _=require(_0x16d6('0x0'));var util=require(_0x16d6('0x1'));var logger=require('../../config/logger')(_0x16d6('0x2'));var moment=require(_0x16d6('0x3'));var BPromise=require('bluebird');var rp=require(_0x16d6('0x4'));var attributes=require(_0x16d6('0x5'));module[_0x16d6('0x6')]=function(_0x1179ae,_0x292d58){return _0x1179ae[_0x16d6('0x7')](_0x16d6('0x8'),attributes,{'tableName':_0x16d6('0x9'),'paranoid':![],'indexes':[{'name':_0x16d6('0xa'),'fields':[_0x16d6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 184ee67..d994c41 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 _0x468d=['bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','MailQueueReport','create','body','options','then','CreateMailQueueReport','UpdateMailQueueReport','raw','where','attributes','limit','catch','lodash','util','moment'];(function(_0x3c08ea,_0x419b25){var _0x4b6e51=function(_0x4e53b3){while(--_0x4e53b3){_0x3c08ea['push'](_0x3c08ea['shift']());}};_0x4b6e51(++_0x419b25);}(_0x468d,0x190));var _0xd468=function(_0x38cd94,_0x1f898b){_0x38cd94=_0x38cd94-0x0;var _0x28385a=_0x468d[_0x38cd94];return _0x28385a;};'use strict';var _=require(_0xd468('0x0'));var util=require(_0xd468('0x1'));var moment=require(_0xd468('0x2'));var BPromise=require(_0xd468('0x3'));var rs=require(_0xd468('0x4'));var fs=require('fs');var Redis=require(_0xd468('0x5'));var db=require(_0xd468('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd468('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd468('0x8')][_0xd468('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x295e4d,_0x1fd54e,_0x23496f){return new BPromise(function(_0x214ca8,_0x573007){return client['request'](_0x295e4d,_0x23496f)['then'](function(_0x264338){logger['info'](_0xd468('0xa'),_0x1fd54e,_0xd468('0xb'));logger['debug'](_0xd468('0xc'),_0x1fd54e,_0xd468('0xb'),JSON[_0xd468('0xd')](_0x264338));if(_0x264338[_0xd468('0xe')]){if(_0x264338[_0xd468('0xe')][_0xd468('0xf')]===0x1f4){logger[_0xd468('0xe')](_0xd468('0xa'),_0x1fd54e,_0x264338[_0xd468('0xe')][_0xd468('0x10')]);return _0x573007(_0x264338[_0xd468('0xe')]['message']);}logger[_0xd468('0xe')](_0xd468('0xa'),_0x1fd54e,_0x264338[_0xd468('0xe')]['message']);return _0x214ca8(_0x264338[_0xd468('0xe')][_0xd468('0x10')]);}else{logger[_0xd468('0x11')]('MailQueueReport,\x20%s,\x20%s',_0x1fd54e,_0xd468('0xb'));_0x214ca8(_0x264338[_0xd468('0x12')]['message']);}})['catch'](function(_0x3231e4){logger[_0xd468('0xe')](_0xd468('0xa'),_0x1fd54e,_0x3231e4);_0x573007(_0x3231e4);});});}exports['CreateMailQueueReport']=function(_0x4a8021){var _0x408004=this;return new Promise(function(_0x1abd0a,_0x2b4b9a){return db[_0xd468('0x13')][_0xd468('0x14')](_0x4a8021[_0xd468('0x15')],{'raw':_0x4a8021[_0xd468('0x16')]?_0x4a8021[_0xd468('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xd468('0x17')](function(_0x199388){logger[_0xd468('0x11')](_0xd468('0x18'),_0x4a8021);logger['debug']('CreateMailQueueReport',_0x4a8021,JSON[_0xd468('0xd')](_0x199388));_0x1abd0a(_0x199388);})['catch'](function(_0x1ae3e5){logger[_0xd468('0xe')](_0xd468('0x18'),_0x1ae3e5[_0xd468('0x10')],_0x4a8021);_0x2b4b9a(_0x408004[_0xd468('0xe')](0x1f4,_0x1ae3e5[_0xd468('0x10')]));});});};exports[_0xd468('0x19')]=function(_0x5bc275){var _0x5d8a94=this;return new Promise(function(_0x44f6c2,_0x521c7a){return db[_0xd468('0x13')]['update'](_0x5bc275[_0xd468('0x15')],{'raw':_0x5bc275['options']?_0x5bc275[_0xd468('0x16')][_0xd468('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bc275['options']?_0x5bc275[_0xd468('0x16')][_0xd468('0x1b')]||null:null,'attributes':_0x5bc275['options']?_0x5bc275[_0xd468('0x16')][_0xd468('0x1c')]||null:null,'limit':_0x5bc275[_0xd468('0x16')]?_0x5bc275['options'][_0xd468('0x1d')]||null:null})[_0xd468('0x17')](function(_0x2b191e){logger[_0xd468('0x11')](_0xd468('0x19'),_0x5bc275);logger['debug']('UpdateMailQueueReport',_0x5bc275,JSON[_0xd468('0xd')](_0x2b191e));_0x44f6c2(_0x2b191e);})[_0xd468('0x1e')](function(_0x1eef75){logger[_0xd468('0xe')](_0xd468('0x19'),_0x1eef75['message'],_0x5bc275);_0x521c7a(_0x5d8a94[_0xd468('0xe')](0x1f4,_0x1eef75[_0xd468('0x10')]));});});}; \ No newline at end of file +var _0xfffe=['body','options','CreateMailQueueReport','UpdateMailQueueReport','where','attributes','limit','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','MailQueueReport,\x20%s,\x20%s','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','MailQueueReport'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xfffe,0x1c9));var _0xefff=function(_0x5c8ab4,_0x52530b){_0x5c8ab4=_0x5c8ab4-0x0;var _0x4fcd5b=_0xfffe[_0x5c8ab4];return _0x4fcd5b;};'use strict';var _=require('lodash');var util=require(_0xefff('0x0'));var moment=require(_0xefff('0x1'));var BPromise=require('bluebird');var rs=require(_0xefff('0x2'));var fs=require('fs');var Redis=require(_0xefff('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xefff('0x4'));var logger=require(_0xefff('0x5'))('rpc');var config=require(_0xefff('0x6'));var jayson=require(_0xefff('0x7'));var client=jayson['client'][_0xefff('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ce869,_0x208c78,_0x163a5e){return new BPromise(function(_0x4008ab,_0x32f9aa){return client[_0xefff('0x9')](_0x5ce869,_0x163a5e)[_0xefff('0xa')](function(_0xd5527f){logger[_0xefff('0xb')](_0xefff('0xc'),_0x208c78,'request\x20sent');logger[_0xefff('0xd')](_0xefff('0xe'),_0x208c78,_0xefff('0xf'),JSON[_0xefff('0x10')](_0xd5527f));if(_0xd5527f['error']){if(_0xd5527f['error'][_0xefff('0x11')]===0x1f4){logger[_0xefff('0x12')](_0xefff('0xc'),_0x208c78,_0xd5527f['error']['message']);return _0x32f9aa(_0xd5527f[_0xefff('0x12')][_0xefff('0x13')]);}logger['error'](_0xefff('0xc'),_0x208c78,_0xd5527f[_0xefff('0x12')][_0xefff('0x13')]);return _0x4008ab(_0xd5527f[_0xefff('0x12')][_0xefff('0x13')]);}else{logger[_0xefff('0xb')](_0xefff('0xc'),_0x208c78,_0xefff('0xf'));_0x4008ab(_0xd5527f[_0xefff('0x14')]['message']);}})[_0xefff('0x15')](function(_0x24d639){logger[_0xefff('0x12')](_0xefff('0xc'),_0x208c78,_0x24d639);_0x32f9aa(_0x24d639);});});}exports['CreateMailQueueReport']=function(_0x3669fe){var _0x315eec=this;return new Promise(function(_0x28d9e9,_0x4edf7b){return db[_0xefff('0x16')]['create'](_0x3669fe[_0xefff('0x17')],{'raw':_0x3669fe[_0xefff('0x18')]?_0x3669fe[_0xefff('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xefff('0xa')](function(_0x34ca41){logger['info']('CreateMailQueueReport',_0x3669fe);logger[_0xefff('0xd')](_0xefff('0x19'),_0x3669fe,JSON['stringify'](_0x34ca41));_0x28d9e9(_0x34ca41);})[_0xefff('0x15')](function(_0x2d954b){logger[_0xefff('0x12')]('CreateMailQueueReport',_0x2d954b['message'],_0x3669fe);_0x4edf7b(_0x315eec['error'](0x1f4,_0x2d954b[_0xefff('0x13')]));});});};exports[_0xefff('0x1a')]=function(_0x1333bd){var _0x381fa5=this;return new Promise(function(_0x32a41e,_0x2f6bf5){return db['MailQueueReport']['update'](_0x1333bd[_0xefff('0x17')],{'raw':_0x1333bd[_0xefff('0x18')]?_0x1333bd[_0xefff('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1333bd[_0xefff('0x18')]?_0x1333bd[_0xefff('0x18')][_0xefff('0x1b')]||null:null,'attributes':_0x1333bd[_0xefff('0x18')]?_0x1333bd[_0xefff('0x18')][_0xefff('0x1c')]||null:null,'limit':_0x1333bd[_0xefff('0x18')]?_0x1333bd[_0xefff('0x18')][_0xefff('0x1d')]||null:null})[_0xefff('0xa')](function(_0x542033){logger[_0xefff('0xb')](_0xefff('0x1a'),_0x1333bd);logger[_0xefff('0xd')](_0xefff('0x1a'),_0x1333bd,JSON[_0xefff('0x10')](_0x542033));_0x32a41e(_0x542033);})['catch'](function(_0x31bb0b){logger['error']('UpdateMailQueueReport',_0x31bb0b[_0xefff('0x13')],_0x1333bd);_0x2f6bf5(_0x381fa5[_0xefff('0x12')](0x1f4,_0x31bb0b['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index dfc2e43..617f712 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 _0xd663=['express','Router','../../components/auth/service','../../components/interaction/service','exports','multer','util','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd663,0x1ed));var _0x3d66=function(_0x5dec94,_0x41ec38){_0x5dec94=_0x5dec94-0x0;var _0xd38667=_0xd663[_0x5dec94];return _0xd38667;};'use strict';var multer=require(_0x3d66('0x0'));var util=require(_0x3d66('0x1'));var path=require('path');var timeout=require(_0x3d66('0x2'));var express=require(_0x3d66('0x3'));var router=express[_0x3d66('0x4')]();var auth=require(_0x3d66('0x5'));var interaction=require(_0x3d66('0x6'));var config=require('../../config/environment');module[_0x3d66('0x7')]=router; \ No newline at end of file +var _0x078a=['Router','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express'];(function(_0x3279ad,_0x3c387c){var _0x1d033b=function(_0x4451fb){while(--_0x4451fb){_0x3279ad['push'](_0x3279ad['shift']());}};_0x1d033b(++_0x3c387c);}(_0x078a,0x12d));var _0xa078=function(_0x33393c,_0xb88423){_0x33393c=_0x33393c-0x0;var _0x536e3d=_0x078a[_0x33393c];return _0x536e3d;};'use strict';var multer=require(_0xa078('0x0'));var util=require(_0xa078('0x1'));var path=require(_0xa078('0x2'));var timeout=require(_0xa078('0x3'));var express=require(_0xa078('0x4'));var router=express[_0xa078('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa078('0x6'));var config=require(_0xa078('0x7'));module[_0xa078('0x8')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 21b27d2..13d7f6b 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 _0x1ba2=['sequelize','STRING','BOOLEAN','username','INTEGER','INBOX'];(function(_0x335a62,_0xfafea4){var _0x249a9a=function(_0xb3a9a5){while(--_0xb3a9a5){_0x335a62['push'](_0x335a62['shift']());}};_0x249a9a(++_0xfafea4);}(_0x1ba2,0xb4));var _0x21ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1ba2[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x21ba('0x0'));module['exports']={'description':{'type':Sequelize[_0x21ba('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x21ba('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x21ba('0x1')],'unique':_0x21ba('0x3')},'password':{'type':Sequelize[_0x21ba('0x1')]},'port':{'type':Sequelize[_0x21ba('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x21ba('0x1')],'defaultValue':_0x21ba('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x21ba('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x96cc=['BOOLEAN','username','INTEGER','INBOX','sequelize','STRING'];(function(_0x51803b,_0x5769ad){var _0x590576=function(_0x553ab0){while(--_0x553ab0){_0x51803b['push'](_0x51803b['shift']());}};_0x590576(++_0x5769ad);}(_0x96cc,0x16c));var _0xc96c=function(_0x44e827,_0x145ed8){_0x44e827=_0x44e827-0x0;var _0xa19d97=_0x96cc[_0x44e827];return _0xa19d97;};'use strict';var Sequelize=require(_0xc96c('0x0'));module['exports']={'description':{'type':Sequelize[_0xc96c('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xc96c('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xc96c('0x1')],'unique':_0xc96c('0x3')},'password':{'type':Sequelize[_0xc96c('0x1')]},'port':{'type':Sequelize[_0xc96c('0x4')]},'tls':{'type':Sequelize[_0xc96c('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xc96c('0x1')],'defaultValue':_0xc96c('0x5')},'connTimeout':{'type':Sequelize[_0xc96c('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xc96c('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 8aa4ab4..07fcebe 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 _0xc584=['util','../../config/logger','bluebird','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc584,0xa8));var _0x4c58=function(_0x4ab99,_0x219ed2){_0x4ab99=_0x4ab99-0x0;var _0x29e39c=_0xc584[_0x4ab99];return _0x29e39c;};'use strict';var _=require('lodash');var util=require(_0x4c58('0x0'));var logger=require(_0x4c58('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4c58('0x2'));var rp=require('request-promise');var attributes=require(_0x4c58('0x3'));module[_0x4c58('0x4')]=function(_0x1bdc22,_0x4d84d7){return _0x1bdc22[_0x4c58('0x5')](_0x4c58('0x6'),attributes,{'tableName':_0x4c58('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9f9=['exports','define','mail_servers_in','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x553150,_0x589ff3){var _0x18193d=function(_0x3a5ae6){while(--_0x3a5ae6){_0x553150['push'](_0x553150['shift']());}};_0x18193d(++_0x589ff3);}(_0xe9f9,0x174));var _0x9e9f=function(_0x4da139,_0x27709b){_0x4da139=_0x4da139-0x0;var _0x55bd61=_0xe9f9[_0x4da139];return _0x55bd61;};'use strict';var _=require(_0x9e9f('0x0'));var util=require('util');var logger=require(_0x9e9f('0x1'))(_0x9e9f('0x2'));var moment=require(_0x9e9f('0x3'));var BPromise=require(_0x9e9f('0x4'));var rp=require(_0x9e9f('0x5'));var attributes=require('./mailServerIn.attributes');module[_0x9e9f('0x6')]=function(_0x47f4c7,_0x372526){return _0x47f4c7[_0x9e9f('0x7')]('MailServerIn',attributes,{'tableName':_0x9e9f('0x8'),'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 c30f7a0..bca7a1c 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 _0xf2c6=['jayson/promise','http','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetMailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf2c6,0x1e6));var _0x6f2c=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xf2c6[_0x5b561d];return _0x431060;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6f2c('0x0'));var BPromise=require(_0x6f2c('0x1'));var rs=require(_0x6f2c('0x2'));var fs=require('fs');var Redis=require(_0x6f2c('0x3'));var db=require(_0x6f2c('0x4'))['db'];var utils=require(_0x6f2c('0x5'));var logger=require(_0x6f2c('0x6'))(_0x6f2c('0x7'));var config=require(_0x6f2c('0x8'));var jayson=require(_0x6f2c('0x9'));var client=jayson['client'][_0x6f2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d994e,_0x27eb8a,_0x5674f8){return new BPromise(function(_0x4c43ca,_0xbeb40f){return client[_0x6f2c('0xb')](_0x5d994e,_0x5674f8)[_0x6f2c('0xc')](function(_0x22e617){logger['info'](_0x6f2c('0xd'),_0x27eb8a,_0x6f2c('0xe'));logger[_0x6f2c('0xf')](_0x6f2c('0x10'),_0x27eb8a,_0x6f2c('0xe'),JSON[_0x6f2c('0x11')](_0x22e617));if(_0x22e617[_0x6f2c('0x12')]){if(_0x22e617[_0x6f2c('0x12')][_0x6f2c('0x13')]===0x1f4){logger['error'](_0x6f2c('0xd'),_0x27eb8a,_0x22e617[_0x6f2c('0x12')][_0x6f2c('0x14')]);return _0xbeb40f(_0x22e617[_0x6f2c('0x12')]['message']);}logger[_0x6f2c('0x12')](_0x6f2c('0xd'),_0x27eb8a,_0x22e617[_0x6f2c('0x12')][_0x6f2c('0x14')]);return _0x4c43ca(_0x22e617[_0x6f2c('0x12')][_0x6f2c('0x14')]);}else{logger[_0x6f2c('0x15')]('MailServerIn,\x20%s,\x20%s',_0x27eb8a,'request\x20sent');_0x4c43ca(_0x22e617['result']['message']);}})[_0x6f2c('0x16')](function(_0x330239){logger[_0x6f2c('0x12')](_0x6f2c('0xd'),_0x27eb8a,_0x330239);_0xbeb40f(_0x330239);});});}exports[_0x6f2c('0x17')]=function(_0x36f731){var _0x27feff=this;return new Promise(function(_0x32b039,_0x4507fc){return db['MailServerIn'][_0x6f2c('0x18')]({'raw':_0x36f731[_0x6f2c('0x19')]?_0x36f731['options'][_0x6f2c('0x1a')]===undefined?!![]:![]:!![],'where':_0x36f731[_0x6f2c('0x19')]?_0x36f731['options'][_0x6f2c('0x1b')]||null:null,'attributes':_0x36f731[_0x6f2c('0x19')]?_0x36f731[_0x6f2c('0x19')][_0x6f2c('0x1c')]||null:null,'limit':_0x36f731[_0x6f2c('0x19')]?_0x36f731['options'][_0x6f2c('0x1d')]||null:null,'include':_0x36f731[_0x6f2c('0x19')]?_0x36f731['options'][_0x6f2c('0x1e')]?_[_0x6f2c('0x1f')](_0x36f731[_0x6f2c('0x19')][_0x6f2c('0x1e')],function(_0x51d881){return{'model':db[_0x51d881[_0x6f2c('0x20')]],'as':_0x51d881['as'],'attributes':_0x51d881[_0x6f2c('0x1c')],'include':_0x51d881[_0x6f2c('0x1e')]?_['map'](_0x51d881[_0x6f2c('0x1e')],function(_0x2b35e1){return{'model':db[_0x2b35e1[_0x6f2c('0x20')]],'as':_0x2b35e1['as'],'attributes':_0x2b35e1[_0x6f2c('0x1c')],'include':_0x2b35e1['include']?_[_0x6f2c('0x1f')](_0x2b35e1[_0x6f2c('0x1e')],function(_0x1dcda5){return{'model':db[_0x1dcda5[_0x6f2c('0x20')]],'as':_0x1dcda5['as'],'attributes':_0x1dcda5[_0x6f2c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6f2c('0xc')](function(_0x1b1efb){logger['info'](_0x6f2c('0x17'),_0x36f731);logger[_0x6f2c('0xf')](_0x6f2c('0x17'),_0x36f731,JSON[_0x6f2c('0x11')](_0x1b1efb));_0x32b039(_0x1b1efb);})['catch'](function(_0x15582b){logger[_0x6f2c('0x12')](_0x6f2c('0x17'),_0x15582b[_0x6f2c('0x14')],_0x36f731);_0x4507fc(_0x27feff['error'](0x1f4,_0x15582b[_0x6f2c('0x14')]));});});}; \ No newline at end of file +var _0xbe64=['info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','MailServerIn','options','raw','attributes','limit','include','model','map','GetMailServerIn','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x31cc2d,_0x40bce2){var _0x1bae49=function(_0x15c3fa){while(--_0x15c3fa){_0x31cc2d['push'](_0x31cc2d['shift']());}};_0x1bae49(++_0x40bce2);}(_0xbe64,0x173));var _0x4be6=function(_0x5db657,_0x2f40b3){_0x5db657=_0x5db657-0x0;var _0x2d6e70=_0xbe64[_0x5db657];return _0x2d6e70;};'use strict';var _=require(_0x4be6('0x0'));var util=require(_0x4be6('0x1'));var moment=require(_0x4be6('0x2'));var BPromise=require(_0x4be6('0x3'));var rs=require(_0x4be6('0x4'));var fs=require('fs');var Redis=require(_0x4be6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4be6('0x6'));var logger=require(_0x4be6('0x7'))(_0x4be6('0x8'));var config=require('../../config/environment');var jayson=require(_0x4be6('0x9'));var client=jayson['client'][_0x4be6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16a9d6,_0x154192,_0x481c34){return new BPromise(function(_0x50dfb2,_0x20f600){return client[_0x4be6('0xb')](_0x16a9d6,_0x481c34)[_0x4be6('0xc')](function(_0x15c2a4){logger[_0x4be6('0xd')](_0x4be6('0xe'),_0x154192,_0x4be6('0xf'));logger[_0x4be6('0x10')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x154192,_0x4be6('0xf'),JSON['stringify'](_0x15c2a4));if(_0x15c2a4['error']){if(_0x15c2a4[_0x4be6('0x11')][_0x4be6('0x12')]===0x1f4){logger[_0x4be6('0x11')]('MailServerIn,\x20%s,\x20%s',_0x154192,_0x15c2a4['error'][_0x4be6('0x13')]);return _0x20f600(_0x15c2a4['error'][_0x4be6('0x13')]);}logger[_0x4be6('0x11')]('MailServerIn,\x20%s,\x20%s',_0x154192,_0x15c2a4[_0x4be6('0x11')][_0x4be6('0x13')]);return _0x50dfb2(_0x15c2a4[_0x4be6('0x11')][_0x4be6('0x13')]);}else{logger[_0x4be6('0xd')](_0x4be6('0xe'),_0x154192,_0x4be6('0xf'));_0x50dfb2(_0x15c2a4[_0x4be6('0x14')][_0x4be6('0x13')]);}})[_0x4be6('0x15')](function(_0x3199a7){logger['error']('MailServerIn,\x20%s,\x20%s',_0x154192,_0x3199a7);_0x20f600(_0x3199a7);});});}exports['GetMailServerIn']=function(_0x4b87bc){var _0x1aea29=this;return new Promise(function(_0x292248,_0x304c64){return db[_0x4be6('0x16')]['findAll']({'raw':_0x4b87bc[_0x4be6('0x17')]?_0x4b87bc['options'][_0x4be6('0x18')]===undefined?!![]:![]:!![],'where':_0x4b87bc[_0x4be6('0x17')]?_0x4b87bc['options']['where']||null:null,'attributes':_0x4b87bc['options']?_0x4b87bc[_0x4be6('0x17')][_0x4be6('0x19')]||null:null,'limit':_0x4b87bc[_0x4be6('0x17')]?_0x4b87bc[_0x4be6('0x17')][_0x4be6('0x1a')]||null:null,'include':_0x4b87bc[_0x4be6('0x17')]?_0x4b87bc['options'][_0x4be6('0x1b')]?_['map'](_0x4b87bc[_0x4be6('0x17')]['include'],function(_0x47cf0e){return{'model':db[_0x47cf0e[_0x4be6('0x1c')]],'as':_0x47cf0e['as'],'attributes':_0x47cf0e['attributes'],'include':_0x47cf0e[_0x4be6('0x1b')]?_[_0x4be6('0x1d')](_0x47cf0e[_0x4be6('0x1b')],function(_0x63e5a3){return{'model':db[_0x63e5a3[_0x4be6('0x1c')]],'as':_0x63e5a3['as'],'attributes':_0x63e5a3[_0x4be6('0x19')],'include':_0x63e5a3[_0x4be6('0x1b')]?_[_0x4be6('0x1d')](_0x63e5a3[_0x4be6('0x1b')],function(_0x1697b4){return{'model':db[_0x1697b4[_0x4be6('0x1c')]],'as':_0x1697b4['as'],'attributes':_0x1697b4['attributes']};}):[]};}):[]};}):[]:[]})[_0x4be6('0xc')](function(_0x8c8201){logger[_0x4be6('0xd')](_0x4be6('0x1e'),_0x4b87bc);logger[_0x4be6('0x10')]('GetMailServerIn',_0x4b87bc,JSON[_0x4be6('0x1f')](_0x8c8201));_0x292248(_0x8c8201);})[_0x4be6('0x15')](function(_0x1f7315){logger[_0x4be6('0x11')](_0x4be6('0x1e'),_0x1f7315[_0x4be6('0x13')],_0x4b87bc);_0x304c64(_0x1aea29[_0x4be6('0x11')](0x1f4,_0x1f7315['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 05d5de0..c651254 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 _0x3999=['isAuthenticated','index','get','/:id','post','put','update','delete','util','path','express','../../components/interaction/service','../../config/environment','./mailServerOut.controller'];(function(_0x2bd326,_0x294ff3){var _0x466248=function(_0x269ff6){while(--_0x269ff6){_0x2bd326['push'](_0x2bd326['shift']());}};_0x466248(++_0x294ff3);}(_0x3999,0x14a));var _0x9399=function(_0x1434f6,_0x55c4f7){_0x1434f6=_0x1434f6-0x0;var _0x184732=_0x3999[_0x1434f6];return _0x184732;};'use strict';var multer=require('multer');var util=require(_0x9399('0x0'));var path=require(_0x9399('0x1'));var timeout=require('connect-timeout');var express=require(_0x9399('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x9399('0x3'));var config=require(_0x9399('0x4'));var controller=require(_0x9399('0x5'));router['get']('/',auth[_0x9399('0x6')](),controller[_0x9399('0x7')]);router[_0x9399('0x8')](_0x9399('0x9'),auth[_0x9399('0x6')](),controller['show']);router[_0x9399('0xa')]('/',auth[_0x9399('0x6')](),controller['create']);router[_0x9399('0xb')](_0x9399('0x9'),auth[_0x9399('0x6')](),controller[_0x9399('0xc')]);router[_0x9399('0xd')](_0x9399('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x388a=['destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x18b5e8,_0x51e875){var _0x25baed=function(_0x3fcdf9){while(--_0x3fcdf9){_0x18b5e8['push'](_0x18b5e8['shift']());}};_0x25baed(++_0x51e875);}(_0x388a,0x157));var _0xa388=function(_0x35aab9,_0x4aa53e){_0x35aab9=_0x35aab9-0x0;var _0x810181=_0x388a[_0x35aab9];return _0x810181;};'use strict';var multer=require(_0xa388('0x0'));var util=require(_0xa388('0x1'));var path=require(_0xa388('0x2'));var timeout=require(_0xa388('0x3'));var express=require(_0xa388('0x4'));var router=express[_0xa388('0x5')]();var auth=require(_0xa388('0x6'));var interaction=require(_0xa388('0x7'));var config=require('../../config/environment');var controller=require(_0xa388('0x8'));router[_0xa388('0x9')]('/',auth[_0xa388('0xa')](),controller[_0xa388('0xb')]);router[_0xa388('0x9')](_0xa388('0xc'),auth['isAuthenticated'](),controller[_0xa388('0xd')]);router[_0xa388('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa388('0xf')](_0xa388('0xc'),auth[_0xa388('0xa')](),controller[_0xa388('0x10')]);router[_0xa388('0x11')](_0xa388('0xc'),auth[_0xa388('0xa')](),controller[_0xa388('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index a29d670..a9cae9b 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 _0x1169=['sequelize','exports','STRING','BOOLEAN'];(function(_0xfc53fc,_0x4204d6){var _0x423828=function(_0x44e877){while(--_0x44e877){_0xfc53fc['push'](_0xfc53fc['shift']());}};_0x423828(++_0x4204d6);}(_0x1169,0x144));var _0x9116=function(_0x575f3a,_0x20ecf7){_0x575f3a=_0x575f3a-0x0;var _0x552ba7=_0x1169[_0x575f3a];return _0x552ba7;};'use strict';var Sequelize=require(_0x9116('0x0'));module[_0x9116('0x1')]={'description':{'type':Sequelize[_0x9116('0x2')]},'host':{'type':Sequelize[_0x9116('0x2')]},'user':{'type':Sequelize[_0x9116('0x2')]},'pass':{'type':Sequelize[_0x9116('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x9116('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x9116('0x2')]},'authentication':{'type':Sequelize[_0x9116('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4da4=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x2c5546,_0x540f67){var _0x2d9a40=function(_0x1834ba){while(--_0x1834ba){_0x2c5546['push'](_0x2c5546['shift']());}};_0x2d9a40(++_0x540f67);}(_0x4da4,0xfa));var _0x44da=function(_0x422ac3,_0x48bbd4){_0x422ac3=_0x422ac3-0x0;var _0x53c0d4=_0x4da4[_0x422ac3];return _0x53c0d4;};'use strict';var Sequelize=require(_0x44da('0x0'));module[_0x44da('0x1')]={'description':{'type':Sequelize[_0x44da('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x44da('0x2')]},'pass':{'type':Sequelize[_0x44da('0x2')]},'port':{'type':Sequelize[_0x44da('0x3')]},'secure':{'type':Sequelize[_0x44da('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x44da('0x2')]},'authentication':{'type':Sequelize[_0x44da('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 65cec7c..71aa9ce 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 _0x008c=['body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','apply','destroy','then','end','error','send','index','MailServerOut','rawAttributes','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','intersection','options','create'];(function(_0x5e4485,_0x43aa10){var _0x59b1b1=function(_0x9f8895){while(--_0x9f8895){_0x5e4485['push'](_0x5e4485['shift']());}};_0x59b1b1(++_0x43aa10);}(_0x008c,0x188));var _0xc008=function(_0x548eae,_0xad69de){_0x548eae=_0x548eae-0x0;var _0x5b1a01=_0x008c[_0x548eae];return _0x5b1a01;};'use strict';var pdf=require(_0xc008('0x0'));var emlformat=require(_0xc008('0x1'));var rimraf=require(_0xc008('0x2'));var zipdir=require(_0xc008('0x3'));var jsonpatch=require(_0xc008('0x4'));var rp=require('request-promise');var moment=require(_0xc008('0x5'));var BPromise=require(_0xc008('0x6'));var Mustache=require(_0xc008('0x7'));var util=require(_0xc008('0x8'));var path=require(_0xc008('0x9'));var sox=require(_0xc008('0xa'));var csv=require(_0xc008('0xb'));var ejs=require(_0xc008('0xc'));var fs=require('fs');var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var authService=require(_0xc008('0x11'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xc008('0x12'))(_0xc008('0x13'));var utils=require('../../config/utils');var config=require(_0xc008('0x14'));var db=require(_0xc008('0x15'))['db'];function respondWithStatusCode(_0x2ea200,_0x2a5b4e){_0x2a5b4e=_0x2a5b4e||0xcc;return function(_0x9ffa93){if(_0x9ffa93){return _0x2ea200[_0xc008('0x16')](_0x2a5b4e);}return _0x2ea200[_0xc008('0x17')](_0x2a5b4e)['end']();};}function respondWithResult(_0x560e28,_0x33f44c){_0x33f44c=_0x33f44c||0xc8;return function(_0x50c1ab){if(_0x50c1ab){return _0x560e28[_0xc008('0x17')](_0x33f44c)[_0xc008('0x18')](_0x50c1ab);}};}function respondWithFilteredResult(_0x2073ef,_0x339ffc){return function(_0x3f0ecf){if(_0x3f0ecf){var _0x5ee00b=_0x3f0ecf[_0xc008('0x19')],_0x5e894e=_0x339ffc[_0xc008('0x1a')],_0x4bd0f4=_0x339ffc[_0xc008('0x1a')]+_0x339ffc['limit'],_0x11ef38;if(_0x4bd0f4>=_0x5ee00b){_0x4bd0f4=_0x5ee00b;_0x11ef38=0xc8;}else{_0x11ef38=0xce;}_0x2073ef['status'](_0x11ef38);return _0x2073ef['set']('Content-Range',_0x5e894e+'-'+_0x4bd0f4+'/'+_0x5ee00b)[_0xc008('0x18')](_0x3f0ecf);}return null;};}function patchUpdates(_0x462af5){return function(_0x501137){try{jsonpatch[_0xc008('0x1b')](_0x501137,_0x462af5,!![]);}catch(_0x5906e6){return BPromise['reject'](_0x5906e6);}return _0x501137['save']();};}function saveUpdates(_0x50261c,_0x5754a0){return function(_0x4b9726){if(_0x4b9726){return _0x4b9726['update'](_0x50261c)['then'](function(_0x4a582d){return _0x4a582d;});}return null;};}function removeEntity(_0x5a58bd,_0x13a263){return function(_0x4777a6){if(_0x4777a6){return _0x4777a6[_0xc008('0x1c')]()[_0xc008('0x1d')](function(){_0x5a58bd[_0xc008('0x17')](0xcc)[_0xc008('0x1e')]();});}};}function handleEntityNotFound(_0x4f43e2,_0x459fd9){return function(_0x5c85f2){if(!_0x5c85f2){_0x4f43e2['sendStatus'](0x194);}return _0x5c85f2;};}function handleError(_0x218599,_0x36f358){_0x36f358=_0x36f358||0x1f4;return function(_0x2e3cfb){logger[_0xc008('0x1f')](_0x2e3cfb['stack']);if(_0x2e3cfb['name']){delete _0x2e3cfb['name'];}_0x218599[_0xc008('0x17')](_0x36f358)[_0xc008('0x20')](_0x2e3cfb);};}exports[_0xc008('0x21')]=function(_0x2e31c2,_0x5bebd9){var _0x5e2aca={},_0x4fce9c={},_0x4adbab={'count':0x0,'rows':[]};var _0x4caaf4=db[_0xc008('0x22')][_0xc008('0x23')];_0x4fce9c[_0xc008('0x24')]=_['keys'](_0x4caaf4);_0x4fce9c[_0xc008('0x25')]=_[_0xc008('0x26')](_0x2e31c2[_0xc008('0x25')]);_0x4fce9c[_0xc008('0x27')]=_['intersection'](_0x4fce9c[_0xc008('0x24')],_0x4fce9c[_0xc008('0x25')]);_0x5e2aca['attributes']=_['intersection'](_0x4fce9c['model'],qs[_0xc008('0x28')](_0x2e31c2[_0xc008('0x25')][_0xc008('0x28')]));_0x5e2aca[_0xc008('0x29')]=_0x5e2aca[_0xc008('0x29')][_0xc008('0x2a')]?_0x5e2aca[_0xc008('0x29')]:_0x4fce9c[_0xc008('0x24')];if(!_0x2e31c2[_0xc008('0x25')][_0xc008('0x2b')](_0xc008('0x2c'))){_0x5e2aca[_0xc008('0x2d')]=qs['limit'](_0x2e31c2[_0xc008('0x25')][_0xc008('0x2d')]);_0x5e2aca['offset']=qs[_0xc008('0x1a')](_0x2e31c2[_0xc008('0x25')][_0xc008('0x1a')]);}_0x5e2aca[_0xc008('0x2e')]=qs[_0xc008('0x2f')](_0x2e31c2[_0xc008('0x25')][_0xc008('0x2f')]);_0x5e2aca[_0xc008('0x30')]=qs[_0xc008('0x27')](_['pick'](_0x2e31c2[_0xc008('0x25')],_0x4fce9c[_0xc008('0x27')]));if(_0x2e31c2[_0xc008('0x25')][_0xc008('0x31')]){_0x5e2aca[_0xc008('0x30')]=_[_0xc008('0x32')](_0x5e2aca[_0xc008('0x30')],{'$or':_['map'](_0x4caaf4,function(_0x35f360){if(_0x35f360[_0xc008('0x33')]['key']!==_0xc008('0x34')){var _0x15453c={};_0x15453c[_0x35f360['field']]={'$like':'%'+_0x2e31c2[_0xc008('0x25')][_0xc008('0x31')]+'%'};return _0x15453c;}})});}_0x5e2aca=_[_0xc008('0x32')]({},_0x5e2aca,_0x2e31c2['options']);var _0x53b353={'where':_0x5e2aca['where']};return db[_0xc008('0x22')]['count'](_0x53b353)[_0xc008('0x1d')](function(_0x3884dd){_0x4adbab[_0xc008('0x19')]=_0x3884dd;if(_0x2e31c2[_0xc008('0x25')][_0xc008('0x35')]){_0x5e2aca[_0xc008('0x36')]=[{'all':!![]}];}return db[_0xc008('0x22')][_0xc008('0x37')](_0x5e2aca);})[_0xc008('0x1d')](function(_0x387dfd){_0x4adbab[_0xc008('0x38')]=_0x387dfd;return _0x4adbab;})[_0xc008('0x1d')](respondWithFilteredResult(_0x5bebd9,_0x5e2aca))[_0xc008('0x39')](handleError(_0x5bebd9,null));};exports[_0xc008('0x3a')]=function(_0x4cace5,_0x3238b4){var _0x23c4db={'raw':!![],'where':{'id':_0x4cace5[_0xc008('0x3b')]['id']}},_0x30b7df={};_0x30b7df['model']=_[_0xc008('0x26')](db[_0xc008('0x22')][_0xc008('0x23')]);_0x30b7df[_0xc008('0x25')]=_[_0xc008('0x26')](_0x4cace5['query']);_0x30b7df[_0xc008('0x27')]=_[_0xc008('0x3c')](_0x30b7df[_0xc008('0x24')],_0x30b7df[_0xc008('0x25')]);_0x23c4db[_0xc008('0x29')]=_['intersection'](_0x30b7df[_0xc008('0x24')],qs[_0xc008('0x28')](_0x4cace5[_0xc008('0x25')][_0xc008('0x28')]));_0x23c4db['attributes']=_0x23c4db[_0xc008('0x29')][_0xc008('0x2a')]?_0x23c4db[_0xc008('0x29')]:_0x30b7df['model'];if(_0x4cace5[_0xc008('0x25')]['includeAll']){_0x23c4db[_0xc008('0x36')]=[{'all':!![]}];}_0x23c4db=_['merge']({},_0x23c4db,_0x4cace5[_0xc008('0x3d')]);return db[_0xc008('0x22')]['find'](_0x23c4db)[_0xc008('0x1d')](handleEntityNotFound(_0x3238b4,null))[_0xc008('0x1d')](respondWithResult(_0x3238b4,null))[_0xc008('0x39')](handleError(_0x3238b4,null));};exports['create']=function(_0x1cec64,_0x2a9b5c){return db[_0xc008('0x22')][_0xc008('0x3e')](_0x1cec64[_0xc008('0x3f')],{})[_0xc008('0x1d')](respondWithResult(_0x2a9b5c,0xc9))['catch'](handleError(_0x2a9b5c,null));};exports['update']=function(_0x5283a8,_0x4552ed){if(_0x5283a8[_0xc008('0x3f')]['id']){delete _0x5283a8[_0xc008('0x3f')]['id'];}return db[_0xc008('0x22')][_0xc008('0x40')]({'where':{'id':_0x5283a8[_0xc008('0x3b')]['id']}})[_0xc008('0x1d')](handleEntityNotFound(_0x4552ed,null))[_0xc008('0x1d')](saveUpdates(_0x5283a8['body'],null))['then'](respondWithResult(_0x4552ed,null))['catch'](handleError(_0x4552ed,null));};exports[_0xc008('0x1c')]=function(_0x2651cf,_0x158eae){return db['MailServerOut'][_0xc008('0x40')]({'where':{'id':_0x2651cf[_0xc008('0x3b')]['id']}})[_0xc008('0x1d')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x1d')](removeEntity(_0x158eae,null))[_0xc008('0x39')](handleError(_0x158eae,null));}; \ No newline at end of file +var _0xe706=['includeAll','include','findAll','catch','show','find','create','body','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','MailServerOut','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options'];(function(_0x5b8a9d,_0x28e356){var _0x54edf6=function(_0x1d4dc5){while(--_0x1d4dc5){_0x5b8a9d['push'](_0x5b8a9d['shift']());}};_0x54edf6(++_0x28e356);}(_0xe706,0xa3));var _0x6e70=function(_0x5d0609,_0x127562){_0x5d0609=_0x5d0609-0x0;var _0xaa3fd1=_0xe706[_0x5d0609];return _0xaa3fd1;};'use strict';var pdf=require(_0x6e70('0x0'));var emlformat=require(_0x6e70('0x1'));var rimraf=require(_0x6e70('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e70('0x3'));var rp=require(_0x6e70('0x4'));var moment=require(_0x6e70('0x5'));var BPromise=require(_0x6e70('0x6'));var Mustache=require(_0x6e70('0x7'));var util=require(_0x6e70('0x8'));var path=require(_0x6e70('0x9'));var sox=require(_0x6e70('0xa'));var csv=require(_0x6e70('0xb'));var ejs=require(_0x6e70('0xc'));var fs=require('fs');var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xb'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var authService=require(_0x6e70('0x14'));var hardwareService=require(_0x6e70('0x15'));var Redis=require(_0x6e70('0x16'));var qs=require(_0x6e70('0x17'));var logger=require(_0x6e70('0x18'))(_0x6e70('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x6e70('0x1a'))['db'];function respondWithStatusCode(_0x15a1a5,_0x18cf27){_0x18cf27=_0x18cf27||0xcc;return function(_0x27dd9b){if(_0x27dd9b){return _0x15a1a5[_0x6e70('0x1b')](_0x18cf27);}return _0x15a1a5[_0x6e70('0x1c')](_0x18cf27)[_0x6e70('0x1d')]();};}function respondWithResult(_0x181005,_0x5dfbaa){_0x5dfbaa=_0x5dfbaa||0xc8;return function(_0x52737e){if(_0x52737e){return _0x181005['status'](_0x5dfbaa)[_0x6e70('0x1e')](_0x52737e);}};}function respondWithFilteredResult(_0x5a37a6,_0x53aed0){return function(_0x304716){if(_0x304716){var _0x22c50c=_0x304716[_0x6e70('0x1f')],_0x5d9263=_0x53aed0[_0x6e70('0x20')],_0x24f3ac=_0x53aed0['offset']+_0x53aed0['limit'],_0x5c3fe7;if(_0x24f3ac>=_0x22c50c){_0x24f3ac=_0x22c50c;_0x5c3fe7=0xc8;}else{_0x5c3fe7=0xce;}_0x5a37a6[_0x6e70('0x1c')](_0x5c3fe7);return _0x5a37a6['set'](_0x6e70('0x21'),_0x5d9263+'-'+_0x24f3ac+'/'+_0x22c50c)[_0x6e70('0x1e')](_0x304716);}return null;};}function patchUpdates(_0x53acdc){return function(_0x497d61){try{jsonpatch[_0x6e70('0x22')](_0x497d61,_0x53acdc,!![]);}catch(_0x208e21){return BPromise[_0x6e70('0x23')](_0x208e21);}return _0x497d61[_0x6e70('0x24')]();};}function saveUpdates(_0x3af484,_0xcdf9f2){return function(_0x1b2453){if(_0x1b2453){return _0x1b2453[_0x6e70('0x25')](_0x3af484)[_0x6e70('0x26')](function(_0xb29a2a){return _0xb29a2a;});}return null;};}function removeEntity(_0x4a0cfe,_0x228350){return function(_0x344b65){if(_0x344b65){return _0x344b65[_0x6e70('0x27')]()['then'](function(){_0x4a0cfe[_0x6e70('0x1c')](0xcc)[_0x6e70('0x1d')]();});}};}function handleEntityNotFound(_0x3337a6,_0x50da2c){return function(_0x10fc91){if(!_0x10fc91){_0x3337a6['sendStatus'](0x194);}return _0x10fc91;};}function handleError(_0x50aec2,_0x4e97c7){_0x4e97c7=_0x4e97c7||0x1f4;return function(_0x41e352){logger[_0x6e70('0x28')](_0x41e352['stack']);if(_0x41e352[_0x6e70('0x29')]){delete _0x41e352[_0x6e70('0x29')];}_0x50aec2['status'](_0x4e97c7)[_0x6e70('0x2a')](_0x41e352);};}exports[_0x6e70('0x2b')]=function(_0x2bb231,_0x4a67ac){var _0x54a5fe={},_0x2c4d37={},_0x3af17f={'count':0x0,'rows':[]};var _0x83c836=db[_0x6e70('0x2c')][_0x6e70('0x2d')];_0x2c4d37['model']=_[_0x6e70('0x2e')](_0x83c836);_0x2c4d37[_0x6e70('0x2f')]=_[_0x6e70('0x2e')](_0x2bb231[_0x6e70('0x2f')]);_0x2c4d37[_0x6e70('0x30')]=_[_0x6e70('0x31')](_0x2c4d37[_0x6e70('0x32')],_0x2c4d37[_0x6e70('0x2f')]);_0x54a5fe[_0x6e70('0x33')]=_[_0x6e70('0x31')](_0x2c4d37['model'],qs[_0x6e70('0x34')](_0x2bb231['query'][_0x6e70('0x34')]));_0x54a5fe['attributes']=_0x54a5fe[_0x6e70('0x33')][_0x6e70('0x35')]?_0x54a5fe[_0x6e70('0x33')]:_0x2c4d37['model'];if(!_0x2bb231[_0x6e70('0x2f')][_0x6e70('0x36')]('nolimit')){_0x54a5fe[_0x6e70('0x37')]=qs[_0x6e70('0x37')](_0x2bb231['query'][_0x6e70('0x37')]);_0x54a5fe[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x2bb231[_0x6e70('0x2f')][_0x6e70('0x20')]);}_0x54a5fe[_0x6e70('0x38')]=qs[_0x6e70('0x39')](_0x2bb231[_0x6e70('0x2f')][_0x6e70('0x39')]);_0x54a5fe[_0x6e70('0x3a')]=qs['filters'](_[_0x6e70('0x3b')](_0x2bb231['query'],_0x2c4d37[_0x6e70('0x30')]));if(_0x2bb231[_0x6e70('0x2f')][_0x6e70('0x3c')]){_0x54a5fe[_0x6e70('0x3a')]=_[_0x6e70('0x3d')](_0x54a5fe[_0x6e70('0x3a')],{'$or':_[_0x6e70('0x3e')](_0x83c836,function(_0xdd0bee){if(_0xdd0bee[_0x6e70('0x3f')][_0x6e70('0x40')]!==_0x6e70('0x41')){var _0x23d5e2={};_0x23d5e2[_0xdd0bee[_0x6e70('0x42')]]={'$like':'%'+_0x2bb231['query']['filter']+'%'};return _0x23d5e2;}})});}_0x54a5fe=_['merge']({},_0x54a5fe,_0x2bb231[_0x6e70('0x43')]);var _0x3841a0={'where':_0x54a5fe[_0x6e70('0x3a')]};return db[_0x6e70('0x2c')][_0x6e70('0x1f')](_0x3841a0)[_0x6e70('0x26')](function(_0x572a71){_0x3af17f[_0x6e70('0x1f')]=_0x572a71;if(_0x2bb231[_0x6e70('0x2f')][_0x6e70('0x44')]){_0x54a5fe[_0x6e70('0x45')]=[{'all':!![]}];}return db[_0x6e70('0x2c')][_0x6e70('0x46')](_0x54a5fe);})[_0x6e70('0x26')](function(_0x16fc7d){_0x3af17f['rows']=_0x16fc7d;return _0x3af17f;})[_0x6e70('0x26')](respondWithFilteredResult(_0x4a67ac,_0x54a5fe))[_0x6e70('0x47')](handleError(_0x4a67ac,null));};exports[_0x6e70('0x48')]=function(_0x31cad2,_0x201da9){var _0x1de947={'raw':!![],'where':{'id':_0x31cad2['params']['id']}},_0x21b0e7={};_0x21b0e7['model']=_['keys'](db[_0x6e70('0x2c')][_0x6e70('0x2d')]);_0x21b0e7[_0x6e70('0x2f')]=_[_0x6e70('0x2e')](_0x31cad2[_0x6e70('0x2f')]);_0x21b0e7['filters']=_[_0x6e70('0x31')](_0x21b0e7[_0x6e70('0x32')],_0x21b0e7[_0x6e70('0x2f')]);_0x1de947['attributes']=_['intersection'](_0x21b0e7['model'],qs[_0x6e70('0x34')](_0x31cad2['query'][_0x6e70('0x34')]));_0x1de947[_0x6e70('0x33')]=_0x1de947[_0x6e70('0x33')][_0x6e70('0x35')]?_0x1de947['attributes']:_0x21b0e7[_0x6e70('0x32')];if(_0x31cad2['query'][_0x6e70('0x44')]){_0x1de947[_0x6e70('0x45')]=[{'all':!![]}];}_0x1de947=_[_0x6e70('0x3d')]({},_0x1de947,_0x31cad2[_0x6e70('0x43')]);return db['MailServerOut'][_0x6e70('0x49')](_0x1de947)[_0x6e70('0x26')](handleEntityNotFound(_0x201da9,null))[_0x6e70('0x26')](respondWithResult(_0x201da9,null))[_0x6e70('0x47')](handleError(_0x201da9,null));};exports[_0x6e70('0x4a')]=function(_0x3fcb2d,_0x3d9c5){return db['MailServerOut'][_0x6e70('0x4a')](_0x3fcb2d[_0x6e70('0x4b')],{})[_0x6e70('0x26')](respondWithResult(_0x3d9c5,0xc9))[_0x6e70('0x47')](handleError(_0x3d9c5,null));};exports[_0x6e70('0x25')]=function(_0x172e8a,_0x1e2095){if(_0x172e8a['body']['id']){delete _0x172e8a[_0x6e70('0x4b')]['id'];}return db['MailServerOut'][_0x6e70('0x49')]({'where':{'id':_0x172e8a[_0x6e70('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1e2095,null))['then'](saveUpdates(_0x172e8a[_0x6e70('0x4b')],null))[_0x6e70('0x26')](respondWithResult(_0x1e2095,null))[_0x6e70('0x47')](handleError(_0x1e2095,null));};exports['destroy']=function(_0x4af9b1,_0x238ebb){return db[_0x6e70('0x2c')][_0x6e70('0x49')]({'where':{'id':_0x4af9b1[_0x6e70('0x4c')]['id']}})[_0x6e70('0x26')](handleEntityNotFound(_0x238ebb,null))[_0x6e70('0x26')](removeEntity(_0x238ebb,null))['catch'](handleError(_0x238ebb,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index e7989ec..5955d84 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 _0x292c=['MailServerOut','mail_servers_out','lodash','../../config/logger','api','moment','bluebird','request-promise','exports','define'];(function(_0x32ff3d,_0x3d3fd3){var _0x25d567=function(_0x1093a0){while(--_0x1093a0){_0x32ff3d['push'](_0x32ff3d['shift']());}};_0x25d567(++_0x3d3fd3);}(_0x292c,0x66));var _0xc292=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0x292c[_0x4394b6];return _0x360244;};'use strict';var _=require(_0xc292('0x0'));var util=require('util');var logger=require(_0xc292('0x1'))(_0xc292('0x2'));var moment=require(_0xc292('0x3'));var BPromise=require(_0xc292('0x4'));var rp=require(_0xc292('0x5'));var attributes=require('./mailServerOut.attributes');module[_0xc292('0x6')]=function(_0x536154,_0x516f54){return _0x536154[_0xc292('0x7')](_0xc292('0x8'),attributes,{'tableName':_0xc292('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b1=['api','moment','request-promise','./mailServerOut.attributes','mail_servers_out','lodash','util','../../config/logger'];(function(_0x5aee74,_0x262d64){var _0x85263a=function(_0x5883e0){while(--_0x5883e0){_0x5aee74['push'](_0x5aee74['shift']());}};_0x85263a(++_0x262d64);}(_0xd8b1,0x105));var _0x1d8b=function(_0x5bfc8f,_0x19fbe6){_0x5bfc8f=_0x5bfc8f-0x0;var _0x57cb61=_0xd8b1[_0x5bfc8f];return _0x57cb61;};'use strict';var _=require(_0x1d8b('0x0'));var util=require(_0x1d8b('0x1'));var logger=require(_0x1d8b('0x2'))(_0x1d8b('0x3'));var moment=require(_0x1d8b('0x4'));var BPromise=require('bluebird');var rp=require(_0x1d8b('0x5'));var attributes=require(_0x1d8b('0x6'));module['exports']=function(_0xad218,_0x551980){return _0xad218['define']('MailServerOut',attributes,{'tableName':_0x1d8b('0x7'),'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 c6785fc..cbd7243 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 _0xc906=['stringify','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc906,0xf6));var _0x6c90=function(_0x71d00d,_0x3c7fc3){_0x71d00d=_0x71d00d-0x0;var _0x578f51=_0xc906[_0x71d00d];return _0x578f51;};'use strict';var _=require(_0x6c90('0x0'));var util=require(_0x6c90('0x1'));var moment=require(_0x6c90('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c90('0x3'));var fs=require('fs');var Redis=require(_0x6c90('0x4'));var db=require(_0x6c90('0x5'))['db'];var utils=require(_0x6c90('0x6'));var logger=require(_0x6c90('0x7'))(_0x6c90('0x8'));var config=require(_0x6c90('0x9'));var jayson=require(_0x6c90('0xa'));var client=jayson['client'][_0x6c90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51e43a,_0x30d553,_0x2e9bda){return new BPromise(function(_0x48e188,_0x55540c){return client[_0x6c90('0xc')](_0x51e43a,_0x2e9bda)[_0x6c90('0xd')](function(_0x24f5b1){logger['info'](_0x6c90('0xe'),_0x30d553,_0x6c90('0xf'));logger[_0x6c90('0x10')](_0x6c90('0x11'),_0x30d553,_0x6c90('0xf'),JSON[_0x6c90('0x12')](_0x24f5b1));if(_0x24f5b1[_0x6c90('0x13')]){if(_0x24f5b1[_0x6c90('0x13')]['code']===0x1f4){logger[_0x6c90('0x13')](_0x6c90('0xe'),_0x30d553,_0x24f5b1['error'][_0x6c90('0x14')]);return _0x55540c(_0x24f5b1[_0x6c90('0x13')][_0x6c90('0x14')]);}logger['error'](_0x6c90('0xe'),_0x30d553,_0x24f5b1[_0x6c90('0x13')][_0x6c90('0x14')]);return _0x48e188(_0x24f5b1[_0x6c90('0x13')][_0x6c90('0x14')]);}else{logger[_0x6c90('0x15')](_0x6c90('0xe'),_0x30d553,_0x6c90('0xf'));_0x48e188(_0x24f5b1[_0x6c90('0x16')][_0x6c90('0x14')]);}})[_0x6c90('0x17')](function(_0x456cff){logger['error']('MailServerOut,\x20%s,\x20%s',_0x30d553,_0x456cff);_0x55540c(_0x456cff);});});} \ No newline at end of file +var _0x8c2c=['request','then','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailServerOut,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5a1fd7,_0x489404){var _0x292a38=function(_0x40fcd8){while(--_0x40fcd8){_0x5a1fd7['push'](_0x5a1fd7['shift']());}};_0x292a38(++_0x489404);}(_0x8c2c,0x1c2));var _0xc8c2=function(_0x113758,_0x3e2777){_0x113758=_0x113758-0x0;var _0x4178c0=_0x8c2c[_0x113758];return _0x4178c0;};'use strict';var _=require(_0xc8c2('0x0'));var util=require(_0xc8c2('0x1'));var moment=require(_0xc8c2('0x2'));var BPromise=require('bluebird');var rs=require(_0xc8c2('0x3'));var fs=require('fs');var Redis=require(_0xc8c2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8c2('0x5'));var logger=require(_0xc8c2('0x6'))(_0xc8c2('0x7'));var config=require(_0xc8c2('0x8'));var jayson=require(_0xc8c2('0x9'));var client=jayson[_0xc8c2('0xa')][_0xc8c2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd70606,_0x36cff7,_0x3c2323){return new BPromise(function(_0x39ac4d,_0x3a7af0){return client[_0xc8c2('0xc')](_0xd70606,_0x3c2323)[_0xc8c2('0xd')](function(_0x17806c){logger['info']('MailServerOut,\x20%s,\x20%s',_0x36cff7,'request\x20sent');logger['debug'](_0xc8c2('0xe'),_0x36cff7,_0xc8c2('0xf'),JSON[_0xc8c2('0x10')](_0x17806c));if(_0x17806c[_0xc8c2('0x11')]){if(_0x17806c['error'][_0xc8c2('0x12')]===0x1f4){logger[_0xc8c2('0x11')](_0xc8c2('0x13'),_0x36cff7,_0x17806c[_0xc8c2('0x11')]['message']);return _0x3a7af0(_0x17806c[_0xc8c2('0x11')][_0xc8c2('0x14')]);}logger[_0xc8c2('0x11')](_0xc8c2('0x13'),_0x36cff7,_0x17806c[_0xc8c2('0x11')][_0xc8c2('0x14')]);return _0x39ac4d(_0x17806c[_0xc8c2('0x11')]['message']);}else{logger['info'](_0xc8c2('0x13'),_0x36cff7,_0xc8c2('0xf'));_0x39ac4d(_0x17806c['result']['message']);}})[_0xc8c2('0x15')](function(_0x1b49c4){logger['error'](_0xc8c2('0x13'),_0x36cff7,_0x1b49c4);_0x3a7af0(_0x1b49c4);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index e9be102..a0ecef3 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 _0xfbd5=['put','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfbd5,0x159));var _0x5fbd=function(_0x51c7bf,_0x541411){_0x51c7bf=_0x51c7bf-0x0;var _0x2d0ef4=_0xfbd5[_0x51c7bf];return _0x2d0ef4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5fbd('0x0'));var timeout=require(_0x5fbd('0x1'));var express=require(_0x5fbd('0x2'));var router=express[_0x5fbd('0x3')]();var auth=require(_0x5fbd('0x4'));var interaction=require(_0x5fbd('0x5'));var config=require('../../config/environment');var controller=require(_0x5fbd('0x6'));router[_0x5fbd('0x7')]('/',auth[_0x5fbd('0x8')](),controller[_0x5fbd('0x9')]);router[_0x5fbd('0x7')](_0x5fbd('0xa'),auth[_0x5fbd('0x8')](),controller[_0x5fbd('0xb')]);router[_0x5fbd('0x7')](_0x5fbd('0xc'),auth[_0x5fbd('0x8')](),controller[_0x5fbd('0xd')]);router[_0x5fbd('0xe')]('/',auth['isAuthenticated'](),controller[_0x5fbd('0xf')]);router[_0x5fbd('0x10')]('/:id',auth[_0x5fbd('0x8')](),controller['update']);router[_0x5fbd('0x11')](_0x5fbd('0xc'),auth[_0x5fbd('0x8')](),controller[_0x5fbd('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd286=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','show','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x2932cf,_0x362fd9){var _0x1711dd=function(_0x2d8de6){while(--_0x2d8de6){_0x2932cf['push'](_0x2932cf['shift']());}};_0x1711dd(++_0x362fd9);}(_0xd286,0xe2));var _0x6d28=function(_0x41b954,_0x1b252e){_0x41b954=_0x41b954-0x0;var _0x1ccf5d=_0xd286[_0x41b954];return _0x1ccf5d;};'use strict';var multer=require(_0x6d28('0x0'));var util=require(_0x6d28('0x1'));var path=require(_0x6d28('0x2'));var timeout=require(_0x6d28('0x3'));var express=require('express');var router=express[_0x6d28('0x4')]();var auth=require(_0x6d28('0x5'));var interaction=require(_0x6d28('0x6'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router[_0x6d28('0x7')]('/',auth[_0x6d28('0x8')](),controller[_0x6d28('0x9')]);router[_0x6d28('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x6d28('0xa')]);router['get']('/:id',auth[_0x6d28('0x8')](),controller[_0x6d28('0xb')]);router['post']('/',auth[_0x6d28('0x8')](),controller[_0x6d28('0xc')]);router[_0x6d28('0xd')](_0x6d28('0xe'),auth[_0x6d28('0x8')](),controller[_0x6d28('0xf')]);router[_0x6d28('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6d28('0x11')]);module[_0x6d28('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index b3c2bb4..ff38321 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 _0xd139=['STRING','sequelize','exports'];(function(_0x48b5e0,_0xb3826){var _0x4287ea=function(_0x14519e){while(--_0x14519e){_0x48b5e0['push'](_0x48b5e0['shift']());}};_0x4287ea(++_0xb3826);}(_0xd139,0x14e));var _0x9d13=function(_0x9816e0,_0x5aed47){_0x9816e0=_0x9816e0-0x0;var _0x473da2=_0xd139[_0x9816e0];return _0x473da2;};'use strict';var Sequelize=require(_0x9d13('0x0'));module[_0x9d13('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9d13('0x2')]}}; \ No newline at end of file +var _0x9000=['name','STRING','sequelize','exports'];(function(_0xc86d70,_0x29477e){var _0x390c26=function(_0x5d3b49){while(--_0x5d3b49){_0xc86d70['push'](_0xc86d70['shift']());}};_0x390c26(++_0x29477e);}(_0x9000,0x19e));var _0x0900=function(_0x3e7804,_0x121853){_0x3e7804=_0x3e7804-0x0;var _0x56efda=_0x9000[_0x3e7804];return _0x56efda;};'use strict';var Sequelize=require(_0x0900('0x0'));module[_0x0900('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0900('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0900('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 3d813e5..ef42901 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 _0x9ca0=['model','keys','filters','intersection','fields','attributes','length','hasOwnProperty','query','order','sort','where','filter','merge','map','key','field','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','MailSubstatus','rawAttributes'];(function(_0x64beb8,_0x11c885){var _0x5860cc=function(_0x4b1207){while(--_0x4b1207){_0x64beb8['push'](_0x64beb8['shift']());}};_0x5860cc(++_0x11c885);}(_0x9ca0,0x65));var _0x09ca=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x9ca0[_0x2a6809];return _0x11c371;};'use strict';var pdf=require(_0x09ca('0x0'));var emlformat=require(_0x09ca('0x1'));var rimraf=require(_0x09ca('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x09ca('0x3'));var rp=require(_0x09ca('0x4'));var moment=require('moment');var BPromise=require(_0x09ca('0x5'));var Mustache=require(_0x09ca('0x6'));var util=require('util');var path=require(_0x09ca('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x09ca('0x8'));var fs=require('fs');var _=require(_0x09ca('0x9'));var squel=require(_0x09ca('0xa'));var crypto=require(_0x09ca('0xb'));var jsforce=require(_0x09ca('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x09ca('0xd'));var Papa=require(_0x09ca('0xe'));var authService=require('../../components/auth/service');var hardwareService=require(_0x09ca('0xf'));var Redis=require(_0x09ca('0x10'));var qs=require(_0x09ca('0x11'));var logger=require(_0x09ca('0x12'))(_0x09ca('0x13'));var utils=require(_0x09ca('0x14'));var config=require('../../config/environment');var db=require(_0x09ca('0x15'))['db'];function respondWithStatusCode(_0x2e7368,_0x4afa1b){_0x4afa1b=_0x4afa1b||0xcc;return function(_0x16e164){if(_0x16e164){return _0x2e7368['sendStatus'](_0x4afa1b);}return _0x2e7368[_0x09ca('0x16')](_0x4afa1b)[_0x09ca('0x17')]();};}function respondWithResult(_0x4183aa,_0x4e1bae){_0x4e1bae=_0x4e1bae||0xc8;return function(_0x57eda0){if(_0x57eda0){return _0x4183aa[_0x09ca('0x16')](_0x4e1bae)[_0x09ca('0x18')](_0x57eda0);}};}function respondWithFilteredResult(_0x51c520,_0x1250b5){return function(_0xdb0c26){if(_0xdb0c26){var _0x32eb55=_0xdb0c26[_0x09ca('0x19')],_0x29621d=_0x1250b5[_0x09ca('0x1a')],_0xb387a5=_0x1250b5[_0x09ca('0x1a')]+_0x1250b5[_0x09ca('0x1b')],_0x19dbc1;if(_0xb387a5>=_0x32eb55){_0xb387a5=_0x32eb55;_0x19dbc1=0xc8;}else{_0x19dbc1=0xce;}_0x51c520[_0x09ca('0x16')](_0x19dbc1);return _0x51c520[_0x09ca('0x1c')]('Content-Range',_0x29621d+'-'+_0xb387a5+'/'+_0x32eb55)[_0x09ca('0x18')](_0xdb0c26);}return null;};}function patchUpdates(_0x23c9ea){return function(_0xcf0bc0){try{jsonpatch[_0x09ca('0x1d')](_0xcf0bc0,_0x23c9ea,!![]);}catch(_0x206fdb){return BPromise[_0x09ca('0x1e')](_0x206fdb);}return _0xcf0bc0[_0x09ca('0x1f')]();};}function saveUpdates(_0x425396,_0x55077a){return function(_0x26c2c3){if(_0x26c2c3){return _0x26c2c3[_0x09ca('0x20')](_0x425396)[_0x09ca('0x21')](function(_0x53a36b){return _0x53a36b;});}return null;};}function removeEntity(_0x32179f,_0x12c609){return function(_0xacdffd){if(_0xacdffd){return _0xacdffd[_0x09ca('0x22')]()['then'](function(){_0x32179f[_0x09ca('0x16')](0xcc)[_0x09ca('0x17')]();});}};}function handleEntityNotFound(_0x3115d0,_0x37288a){return function(_0x44f036){if(!_0x44f036){_0x3115d0[_0x09ca('0x23')](0x194);}return _0x44f036;};}function handleError(_0x1bb677,_0x4f4a8b){_0x4f4a8b=_0x4f4a8b||0x1f4;return function(_0x2558a3){logger[_0x09ca('0x24')](_0x2558a3[_0x09ca('0x25')]);if(_0x2558a3[_0x09ca('0x26')]){delete _0x2558a3[_0x09ca('0x26')];}_0x1bb677[_0x09ca('0x16')](_0x4f4a8b)[_0x09ca('0x27')](_0x2558a3);};}exports[_0x09ca('0x28')]=function(_0x576466,_0x3338b6){var _0x2a26c4={},_0x864eda={},_0x4b3da5={'count':0x0,'rows':[]};var _0x545a7e=db[_0x09ca('0x29')][_0x09ca('0x2a')];_0x864eda[_0x09ca('0x2b')]=_[_0x09ca('0x2c')](_0x545a7e);_0x864eda['query']=_[_0x09ca('0x2c')](_0x576466['query']);_0x864eda[_0x09ca('0x2d')]=_[_0x09ca('0x2e')](_0x864eda[_0x09ca('0x2b')],_0x864eda['query']);_0x2a26c4['attributes']=_[_0x09ca('0x2e')](_0x864eda[_0x09ca('0x2b')],qs['fields'](_0x576466['query'][_0x09ca('0x2f')]));_0x2a26c4[_0x09ca('0x30')]=_0x2a26c4[_0x09ca('0x30')][_0x09ca('0x31')]?_0x2a26c4[_0x09ca('0x30')]:_0x864eda[_0x09ca('0x2b')];if(!_0x576466['query'][_0x09ca('0x32')]('nolimit')){_0x2a26c4[_0x09ca('0x1b')]=qs[_0x09ca('0x1b')](_0x576466[_0x09ca('0x33')]['limit']);_0x2a26c4[_0x09ca('0x1a')]=qs['offset'](_0x576466[_0x09ca('0x33')]['offset']);}_0x2a26c4[_0x09ca('0x34')]=qs[_0x09ca('0x35')](_0x576466['query'][_0x09ca('0x35')]);_0x2a26c4[_0x09ca('0x36')]=qs[_0x09ca('0x2d')](_['pick'](_0x576466[_0x09ca('0x33')],_0x864eda[_0x09ca('0x2d')]));if(_0x576466[_0x09ca('0x33')][_0x09ca('0x37')]){_0x2a26c4['where']=_[_0x09ca('0x38')](_0x2a26c4[_0x09ca('0x36')],{'$or':_[_0x09ca('0x39')](_0x545a7e,function(_0x45bc48){if(_0x45bc48['type'][_0x09ca('0x3a')]!=='VIRTUAL'){var _0x49af4d={};_0x49af4d[_0x45bc48[_0x09ca('0x3b')]]={'$like':'%'+_0x576466['query'][_0x09ca('0x37')]+'%'};return _0x49af4d;}})});}_0x2a26c4=_[_0x09ca('0x38')]({},_0x2a26c4,_0x576466[_0x09ca('0x3c')]);var _0x1d2118={'where':_0x2a26c4['where']};return db[_0x09ca('0x29')]['count'](_0x1d2118)['then'](function(_0x365637){_0x4b3da5[_0x09ca('0x19')]=_0x365637;if(_0x576466['query'][_0x09ca('0x3d')]){_0x2a26c4[_0x09ca('0x3e')]=[{'all':!![]}];}return db['MailSubstatus'][_0x09ca('0x3f')](_0x2a26c4);})[_0x09ca('0x21')](function(_0x5306df){_0x4b3da5[_0x09ca('0x40')]=_0x5306df;return _0x4b3da5;})[_0x09ca('0x21')](respondWithFilteredResult(_0x3338b6,_0x2a26c4))[_0x09ca('0x41')](handleError(_0x3338b6,null));};exports[_0x09ca('0x42')]=function(_0x63a49d,_0x2cc8b7){var _0x26f7c2={'raw':!![],'where':{'id':_0x63a49d['params']['id']}},_0x3777f4={};_0x3777f4[_0x09ca('0x2b')]=_[_0x09ca('0x2c')](db[_0x09ca('0x29')][_0x09ca('0x2a')]);_0x3777f4[_0x09ca('0x33')]=_[_0x09ca('0x2c')](_0x63a49d[_0x09ca('0x33')]);_0x3777f4['filters']=_[_0x09ca('0x2e')](_0x3777f4['model'],_0x3777f4[_0x09ca('0x33')]);_0x26f7c2['attributes']=_[_0x09ca('0x2e')](_0x3777f4[_0x09ca('0x2b')],qs[_0x09ca('0x2f')](_0x63a49d[_0x09ca('0x33')][_0x09ca('0x2f')]));_0x26f7c2[_0x09ca('0x30')]=_0x26f7c2['attributes'][_0x09ca('0x31')]?_0x26f7c2[_0x09ca('0x30')]:_0x3777f4[_0x09ca('0x2b')];if(_0x63a49d[_0x09ca('0x33')][_0x09ca('0x3d')]){_0x26f7c2[_0x09ca('0x3e')]=[{'all':!![]}];}_0x26f7c2=_[_0x09ca('0x38')]({},_0x26f7c2,_0x63a49d[_0x09ca('0x3c')]);return db['MailSubstatus'][_0x09ca('0x43')](_0x26f7c2)[_0x09ca('0x21')](handleEntityNotFound(_0x2cc8b7,null))[_0x09ca('0x21')](respondWithResult(_0x2cc8b7,null))[_0x09ca('0x41')](handleError(_0x2cc8b7,null));};exports[_0x09ca('0x44')]=function(_0x2a68d4,_0x582952){return db[_0x09ca('0x29')]['create'](_0x2a68d4[_0x09ca('0x45')],{})[_0x09ca('0x21')](respondWithResult(_0x582952,0xc9))[_0x09ca('0x41')](handleError(_0x582952,null));};exports[_0x09ca('0x20')]=function(_0x3dc483,_0xf741c0){if(_0x3dc483[_0x09ca('0x45')]['id']){delete _0x3dc483[_0x09ca('0x45')]['id'];}return db[_0x09ca('0x29')]['find']({'where':{'id':_0x3dc483[_0x09ca('0x46')]['id']}})[_0x09ca('0x21')](handleEntityNotFound(_0xf741c0,null))[_0x09ca('0x21')](saveUpdates(_0x3dc483[_0x09ca('0x45')],null))[_0x09ca('0x21')](respondWithResult(_0xf741c0,null))[_0x09ca('0x41')](handleError(_0xf741c0,null));};exports['destroy']=function(_0x2004ea,_0x3a2a3b){return db[_0x09ca('0x29')][_0x09ca('0x43')]({'where':{'id':_0x2004ea[_0x09ca('0x46')]['id']}})[_0x09ca('0x21')](handleEntityNotFound(_0x3a2a3b,null))[_0x09ca('0x21')](removeEntity(_0x3a2a3b,null))[_0x09ca('0x41')](handleError(_0x3a2a3b,null));};exports[_0x09ca('0x47')]=function(_0x1ca4c2,_0x311fc1){return db[_0x09ca('0x29')]['describe']()[_0x09ca('0x21')](respondWithResult(_0x311fc1,null))[_0x09ca('0x41')](handleError(_0x311fc1,null));}; \ No newline at end of file +var _0xb073=['count','set','reject','save','update','then','destroy','stack','name','send','index','MailSubstatus','rawAttributes','model','keys','intersection','query','attributes','fields','hasOwnProperty','limit','offset','order','sort','where','filters','merge','map','key','VIRTUAL','options','includeAll','rows','catch','show','params','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x6082e1,_0x273798){var _0xb6dec0=function(_0x4038f8){while(--_0x4038f8){_0x6082e1['push'](_0x6082e1['shift']());}};_0xb6dec0(++_0x273798);}(_0xb073,0x187));var _0x3b07=function(_0x27dbc9,_0x1baf9d){_0x27dbc9=_0x27dbc9-0x0;var _0x3ef3dd=_0xb073[_0x27dbc9];return _0x3ef3dd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3b07('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3b07('0x1'));var jsonpatch=require(_0x3b07('0x2'));var rp=require(_0x3b07('0x3'));var moment=require('moment');var BPromise=require(_0x3b07('0x4'));var Mustache=require(_0x3b07('0x5'));var util=require(_0x3b07('0x6'));var path=require('path');var sox=require(_0x3b07('0x7'));var csv=require(_0x3b07('0x8'));var ejs=require(_0x3b07('0x9'));var fs=require('fs');var _=require(_0x3b07('0xa'));var squel=require(_0x3b07('0xb'));var crypto=require(_0x3b07('0xc'));var jsforce=require(_0x3b07('0xd'));var deskjs=require(_0x3b07('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3b07('0xf'));var authService=require(_0x3b07('0x10'));var hardwareService=require(_0x3b07('0x11'));var Redis=require(_0x3b07('0x12'));var qs=require(_0x3b07('0x13'));var logger=require(_0x3b07('0x14'))(_0x3b07('0x15'));var utils=require(_0x3b07('0x16'));var config=require(_0x3b07('0x17'));var db=require(_0x3b07('0x18'))['db'];function respondWithStatusCode(_0x1eda50,_0x5deed4){_0x5deed4=_0x5deed4||0xcc;return function(_0x4ed704){if(_0x4ed704){return _0x1eda50[_0x3b07('0x19')](_0x5deed4);}return _0x1eda50[_0x3b07('0x1a')](_0x5deed4)[_0x3b07('0x1b')]();};}function respondWithResult(_0x4b1855,_0x2b307d){_0x2b307d=_0x2b307d||0xc8;return function(_0x480593){if(_0x480593){return _0x4b1855[_0x3b07('0x1a')](_0x2b307d)[_0x3b07('0x1c')](_0x480593);}};}function respondWithFilteredResult(_0x2d3151,_0xad5aaa){return function(_0x3da493){if(_0x3da493){var _0x33275d=_0x3da493[_0x3b07('0x1d')],_0x2e1f12=_0xad5aaa['offset'],_0x33d648=_0xad5aaa['offset']+_0xad5aaa['limit'],_0x4560db;if(_0x33d648>=_0x33275d){_0x33d648=_0x33275d;_0x4560db=0xc8;}else{_0x4560db=0xce;}_0x2d3151[_0x3b07('0x1a')](_0x4560db);return _0x2d3151[_0x3b07('0x1e')]('Content-Range',_0x2e1f12+'-'+_0x33d648+'/'+_0x33275d)['json'](_0x3da493);}return null;};}function patchUpdates(_0x47eb66){return function(_0x25bfa8){try{jsonpatch['apply'](_0x25bfa8,_0x47eb66,!![]);}catch(_0x5bd380){return BPromise[_0x3b07('0x1f')](_0x5bd380);}return _0x25bfa8[_0x3b07('0x20')]();};}function saveUpdates(_0x3efe1c,_0x46f659){return function(_0x21bef9){if(_0x21bef9){return _0x21bef9[_0x3b07('0x21')](_0x3efe1c)[_0x3b07('0x22')](function(_0x1e2713){return _0x1e2713;});}return null;};}function removeEntity(_0x158419,_0x89d8){return function(_0x4e4866){if(_0x4e4866){return _0x4e4866[_0x3b07('0x23')]()['then'](function(){_0x158419[_0x3b07('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20969e,_0x531417){return function(_0x39dd6d){if(!_0x39dd6d){_0x20969e[_0x3b07('0x19')](0x194);}return _0x39dd6d;};}function handleError(_0x42123f,_0x4bd5f9){_0x4bd5f9=_0x4bd5f9||0x1f4;return function(_0xb4912f){logger['error'](_0xb4912f[_0x3b07('0x24')]);if(_0xb4912f['name']){delete _0xb4912f[_0x3b07('0x25')];}_0x42123f[_0x3b07('0x1a')](_0x4bd5f9)[_0x3b07('0x26')](_0xb4912f);};}exports[_0x3b07('0x27')]=function(_0x10e691,_0x106557){var _0x43d50f={},_0x4a67c3={},_0x2b3c96={'count':0x0,'rows':[]};var _0x10e38a=db[_0x3b07('0x28')][_0x3b07('0x29')];_0x4a67c3[_0x3b07('0x2a')]=_[_0x3b07('0x2b')](_0x10e38a);_0x4a67c3['query']=_['keys'](_0x10e691['query']);_0x4a67c3['filters']=_[_0x3b07('0x2c')](_0x4a67c3[_0x3b07('0x2a')],_0x4a67c3[_0x3b07('0x2d')]);_0x43d50f[_0x3b07('0x2e')]=_[_0x3b07('0x2c')](_0x4a67c3[_0x3b07('0x2a')],qs['fields'](_0x10e691['query'][_0x3b07('0x2f')]));_0x43d50f[_0x3b07('0x2e')]=_0x43d50f[_0x3b07('0x2e')]['length']?_0x43d50f[_0x3b07('0x2e')]:_0x4a67c3[_0x3b07('0x2a')];if(!_0x10e691[_0x3b07('0x2d')][_0x3b07('0x30')]('nolimit')){_0x43d50f[_0x3b07('0x31')]=qs[_0x3b07('0x31')](_0x10e691[_0x3b07('0x2d')][_0x3b07('0x31')]);_0x43d50f['offset']=qs[_0x3b07('0x32')](_0x10e691[_0x3b07('0x2d')][_0x3b07('0x32')]);}_0x43d50f[_0x3b07('0x33')]=qs[_0x3b07('0x34')](_0x10e691[_0x3b07('0x2d')][_0x3b07('0x34')]);_0x43d50f[_0x3b07('0x35')]=qs[_0x3b07('0x36')](_['pick'](_0x10e691[_0x3b07('0x2d')],_0x4a67c3[_0x3b07('0x36')]));if(_0x10e691[_0x3b07('0x2d')]['filter']){_0x43d50f['where']=_[_0x3b07('0x37')](_0x43d50f[_0x3b07('0x35')],{'$or':_[_0x3b07('0x38')](_0x10e38a,function(_0x12df56){if(_0x12df56['type'][_0x3b07('0x39')]!==_0x3b07('0x3a')){var _0x261eb6={};_0x261eb6[_0x12df56['field']]={'$like':'%'+_0x10e691[_0x3b07('0x2d')]['filter']+'%'};return _0x261eb6;}})});}_0x43d50f=_[_0x3b07('0x37')]({},_0x43d50f,_0x10e691[_0x3b07('0x3b')]);var _0x39ff52={'where':_0x43d50f[_0x3b07('0x35')]};return db[_0x3b07('0x28')][_0x3b07('0x1d')](_0x39ff52)[_0x3b07('0x22')](function(_0x2bea34){_0x2b3c96['count']=_0x2bea34;if(_0x10e691[_0x3b07('0x2d')][_0x3b07('0x3c')]){_0x43d50f['include']=[{'all':!![]}];}return db[_0x3b07('0x28')]['findAll'](_0x43d50f);})['then'](function(_0x447ec7){_0x2b3c96[_0x3b07('0x3d')]=_0x447ec7;return _0x2b3c96;})['then'](respondWithFilteredResult(_0x106557,_0x43d50f))[_0x3b07('0x3e')](handleError(_0x106557,null));};exports[_0x3b07('0x3f')]=function(_0x1bea25,_0x1b0081){var _0x29dfdb={'raw':!![],'where':{'id':_0x1bea25[_0x3b07('0x40')]['id']}},_0x34414a={};_0x34414a[_0x3b07('0x2a')]=_[_0x3b07('0x2b')](db[_0x3b07('0x28')]['rawAttributes']);_0x34414a['query']=_[_0x3b07('0x2b')](_0x1bea25[_0x3b07('0x2d')]);_0x34414a[_0x3b07('0x36')]=_['intersection'](_0x34414a[_0x3b07('0x2a')],_0x34414a[_0x3b07('0x2d')]);_0x29dfdb[_0x3b07('0x2e')]=_['intersection'](_0x34414a['model'],qs['fields'](_0x1bea25[_0x3b07('0x2d')][_0x3b07('0x2f')]));_0x29dfdb[_0x3b07('0x2e')]=_0x29dfdb[_0x3b07('0x2e')][_0x3b07('0x41')]?_0x29dfdb[_0x3b07('0x2e')]:_0x34414a[_0x3b07('0x2a')];if(_0x1bea25[_0x3b07('0x2d')][_0x3b07('0x3c')]){_0x29dfdb['include']=[{'all':!![]}];}_0x29dfdb=_[_0x3b07('0x37')]({},_0x29dfdb,_0x1bea25[_0x3b07('0x3b')]);return db[_0x3b07('0x28')][_0x3b07('0x42')](_0x29dfdb)['then'](handleEntityNotFound(_0x1b0081,null))[_0x3b07('0x22')](respondWithResult(_0x1b0081,null))[_0x3b07('0x3e')](handleError(_0x1b0081,null));};exports[_0x3b07('0x43')]=function(_0x4fc65f,_0x466374){return db['MailSubstatus'][_0x3b07('0x43')](_0x4fc65f[_0x3b07('0x44')],{})['then'](respondWithResult(_0x466374,0xc9))[_0x3b07('0x3e')](handleError(_0x466374,null));};exports[_0x3b07('0x21')]=function(_0x5e143c,_0x2c4ba3){if(_0x5e143c[_0x3b07('0x44')]['id']){delete _0x5e143c[_0x3b07('0x44')]['id'];}return db[_0x3b07('0x28')][_0x3b07('0x42')]({'where':{'id':_0x5e143c['params']['id']}})[_0x3b07('0x22')](handleEntityNotFound(_0x2c4ba3,null))['then'](saveUpdates(_0x5e143c[_0x3b07('0x44')],null))[_0x3b07('0x22')](respondWithResult(_0x2c4ba3,null))[_0x3b07('0x3e')](handleError(_0x2c4ba3,null));};exports[_0x3b07('0x23')]=function(_0x4e5bac,_0x5c6254){return db[_0x3b07('0x28')]['find']({'where':{'id':_0x4e5bac[_0x3b07('0x40')]['id']}})['then'](handleEntityNotFound(_0x5c6254,null))[_0x3b07('0x22')](removeEntity(_0x5c6254,null))[_0x3b07('0x3e')](handleError(_0x5c6254,null));};exports[_0x3b07('0x45')]=function(_0x24375a,_0x581980){return db[_0x3b07('0x28')][_0x3b07('0x45')]()[_0x3b07('0x22')](respondWithResult(_0x581980,null))[_0x3b07('0x3e')](handleError(_0x581980,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index b7b0c3f..6e1b051 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 _0x6275=['bluebird','request-promise','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','../../config/logger','api','moment'];(function(_0x152616,_0xaed170){var _0x175655=function(_0x11892e){while(--_0x11892e){_0x152616['push'](_0x152616['shift']());}};_0x175655(++_0xaed170);}(_0x6275,0xcf));var _0x5627=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6275[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5627('0x0'))(_0x5627('0x1'));var moment=require(_0x5627('0x2'));var BPromise=require(_0x5627('0x3'));var rp=require(_0x5627('0x4'));var attributes=require(_0x5627('0x5'));module[_0x5627('0x6')]=function(_0x3649bc,_0x2e66c4){return _0x3649bc[_0x5627('0x7')](_0x5627('0x8'),attributes,{'tableName':_0x5627('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05c1=['exports','define','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','moment','bluebird','./mailSubstatus.attributes'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x05c1,0x19e));var _0x105c=function(_0x5c568e,_0xc5e4b0){_0x5c568e=_0x5c568e-0x0;var _0x5aff74=_0x05c1[_0x5c568e];return _0x5aff74;};'use strict';var _=require(_0x105c('0x0'));var util=require(_0x105c('0x1'));var logger=require(_0x105c('0x2'))('api');var moment=require(_0x105c('0x3'));var BPromise=require(_0x105c('0x4'));var rp=require('request-promise');var attributes=require(_0x105c('0x5'));module[_0x105c('0x6')]=function(_0x46b5fa,_0x2e6dfe){return _0x46b5fa[_0x105c('0x7')](_0x105c('0x8'),attributes,{'tableName':_0x105c('0x9'),'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 a789d27..184df46 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 _0x315c=['../../config/utils','../../config/logger','jayson/promise','client','request','then','info','MailSubstatus,\x20%s,\x20%s','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','bluebird','randomstring','../../mysqldb'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x315c,0xd4));var _0xc315=function(_0x544e7c,_0x14a71c){_0x544e7c=_0x544e7c-0x0;var _0x179f06=_0x315c[_0x544e7c];return _0x179f06;};'use strict';var _=require(_0xc315('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc315('0x1'));var rs=require(_0xc315('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc315('0x3'))['db'];var utils=require(_0xc315('0x4'));var logger=require(_0xc315('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc315('0x6'));var client=jayson[_0xc315('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15f0b2,_0x5230fd,_0x11cfed){return new BPromise(function(_0x22a803,_0x22f9b9){return client[_0xc315('0x8')](_0x15f0b2,_0x11cfed)[_0xc315('0x9')](function(_0x427554){logger[_0xc315('0xa')](_0xc315('0xb'),_0x5230fd,'request\x20sent');logger['debug'](_0xc315('0xc'),_0x5230fd,_0xc315('0xd'),JSON[_0xc315('0xe')](_0x427554));if(_0x427554[_0xc315('0xf')]){if(_0x427554[_0xc315('0xf')]['code']===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x5230fd,_0x427554['error']['message']);return _0x22f9b9(_0x427554[_0xc315('0xf')][_0xc315('0x10')]);}logger[_0xc315('0xf')](_0xc315('0xb'),_0x5230fd,_0x427554[_0xc315('0xf')][_0xc315('0x10')]);return _0x22a803(_0x427554[_0xc315('0xf')][_0xc315('0x10')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x5230fd,_0xc315('0xd'));_0x22a803(_0x427554[_0xc315('0x11')][_0xc315('0x10')]);}})['catch'](function(_0x2d1646){logger['error'](_0xc315('0xb'),_0x5230fd,_0x2d1646);_0x22f9b9(_0x2d1646);});});} \ No newline at end of file +var _0x5dc1=['stringify','error','message','result','catch','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x19b35f,_0x24c349){var _0x164970=function(_0x2194a4){while(--_0x2194a4){_0x19b35f['push'](_0x19b35f['shift']());}};_0x164970(++_0x24c349);}(_0x5dc1,0x135));var _0x15dc=function(_0x480272,_0x21e6cf){_0x480272=_0x480272-0x0;var _0x34d491=_0x5dc1[_0x480272];return _0x34d491;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15dc('0x0'));var db=require(_0x15dc('0x1'))['db'];var utils=require(_0x15dc('0x2'));var logger=require(_0x15dc('0x3'))('rpc');var config=require(_0x15dc('0x4'));var jayson=require(_0x15dc('0x5'));var client=jayson[_0x15dc('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a2db4,_0x1a5476,_0x347957){return new BPromise(function(_0x2b2abc,_0x1b6227){return client[_0x15dc('0x7')](_0x3a2db4,_0x347957)[_0x15dc('0x8')](function(_0x2a7ac2){logger[_0x15dc('0x9')](_0x15dc('0xa'),_0x1a5476,_0x15dc('0xb'));logger[_0x15dc('0xc')](_0x15dc('0xd'),_0x1a5476,_0x15dc('0xb'),JSON[_0x15dc('0xe')](_0x2a7ac2));if(_0x2a7ac2['error']){if(_0x2a7ac2[_0x15dc('0xf')]['code']===0x1f4){logger[_0x15dc('0xf')](_0x15dc('0xa'),_0x1a5476,_0x2a7ac2[_0x15dc('0xf')][_0x15dc('0x10')]);return _0x1b6227(_0x2a7ac2[_0x15dc('0xf')][_0x15dc('0x10')]);}logger[_0x15dc('0xf')](_0x15dc('0xa'),_0x1a5476,_0x2a7ac2['error'][_0x15dc('0x10')]);return _0x2b2abc(_0x2a7ac2[_0x15dc('0xf')][_0x15dc('0x10')]);}else{logger['info'](_0x15dc('0xa'),_0x1a5476,'request\x20sent');_0x2b2abc(_0x2a7ac2[_0x15dc('0x11')][_0x15dc('0x10')]);}})[_0x15dc('0x12')](function(_0x2379b3){logger[_0x15dc('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x1a5476,_0x2379b3);_0x1b6227(_0x2379b3);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index fa6322d..31e0e78 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 _0x2675=['create','put','delete','destroy','exports','multer','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x154ed1,_0x1843a3){var _0x22baff=function(_0x1316b5){while(--_0x1316b5){_0x154ed1['push'](_0x154ed1['shift']());}};_0x22baff(++_0x1843a3);}(_0x2675,0x75));var _0x5267=function(_0x33ae6f,_0x4d0c22){_0x33ae6f=_0x33ae6f-0x0;var _0x3793b5=_0x2675[_0x33ae6f];return _0x3793b5;};'use strict';var multer=require(_0x5267('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5267('0x1'));var router=express[_0x5267('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x5267('0x3'));var config=require(_0x5267('0x4'));var controller=require('./mailTransferReport.controller');router[_0x5267('0x5')]('/',auth[_0x5267('0x6')](),controller[_0x5267('0x7')]);router[_0x5267('0x5')](_0x5267('0x8'),auth[_0x5267('0x6')](),controller['describe']);router[_0x5267('0x5')](_0x5267('0x9'),auth['isAuthenticated'](),controller[_0x5267('0xa')]);router['post']('/',auth[_0x5267('0x6')](),controller[_0x5267('0xb')]);router[_0x5267('0xc')]('/:id',auth[_0x5267('0x6')](),controller['update']);router[_0x5267('0xd')]('/:id',auth[_0x5267('0x6')](),controller[_0x5267('0xe')]);module[_0x5267('0xf')]=router; \ No newline at end of file +var _0x199c=['isAuthenticated','index','describe','get','/:id','show','post','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller'];(function(_0x4e1dc9,_0x47e477){var _0x1b2557=function(_0x30a306){while(--_0x30a306){_0x4e1dc9['push'](_0x4e1dc9['shift']());}};_0x1b2557(++_0x47e477);}(_0x199c,0x1d8));var _0xc199=function(_0xd49a97,_0x26c653){_0xd49a97=_0xd49a97-0x0;var _0x5d8676=_0x199c[_0xd49a97];return _0x5d8676;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc199('0x0'));var timeout=require(_0xc199('0x1'));var express=require(_0xc199('0x2'));var router=express[_0xc199('0x3')]();var auth=require(_0xc199('0x4'));var interaction=require(_0xc199('0x5'));var config=require(_0xc199('0x6'));var controller=require(_0xc199('0x7'));router['get']('/',auth[_0xc199('0x8')](),controller[_0xc199('0x9')]);router['get']('/describe',auth[_0xc199('0x8')](),controller[_0xc199('0xa')]);router[_0xc199('0xb')](_0xc199('0xc'),auth[_0xc199('0x8')](),controller[_0xc199('0xd')]);router[_0xc199('0xe')]('/',auth[_0xc199('0x8')](),controller['create']);router[_0xc199('0xf')](_0xc199('0xc'),auth[_0xc199('0x8')](),controller[_0xc199('0x10')]);router[_0xc199('0x11')](_0xc199('0xc'),auth['isAuthenticated'](),controller[_0xc199('0x12')]);module[_0xc199('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index f5d716f..ec7377b 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 _0x4ad3=['exports','ENUM','account','queue','DATE','NOW','moment'];(function(_0xede0a8,_0x55e7b1){var _0x599fdf=function(_0x381dba){while(--_0x381dba){_0xede0a8['push'](_0xede0a8['shift']());}};_0x599fdf(++_0x55e7b1);}(_0x4ad3,0x187));var _0x34ad=function(_0x1273bb,_0x193a23){_0x1273bb=_0x1273bb-0x0;var _0x107662=_0x4ad3[_0x1273bb];return _0x107662;};'use strict';var moment=require(_0x34ad('0x0'));var Sequelize=require('sequelize');module[_0x34ad('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x34ad('0x2')](_0x34ad('0x3'),'agent','queue'),'allowNull':![],'defaultValue':_0x34ad('0x4')},'transferredAt':{'type':Sequelize[_0x34ad('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x34ad('0x6')]}}; \ No newline at end of file +var _0x0946=['queue','DATE','NOW','sequelize','exports','STRING','ENUM','account','agent'];(function(_0x468894,_0x405ab6){var _0x5d25a2=function(_0xda1f71){while(--_0xda1f71){_0x468894['push'](_0x468894['shift']());}};_0x5d25a2(++_0x405ab6);}(_0x0946,0x1e0));var _0x6094=function(_0x4d8789,_0x3fdff1){_0x4d8789=_0x4d8789-0x0;var _0x404e41=_0x0946[_0x4d8789];return _0x404e41;};'use strict';var moment=require('moment');var Sequelize=require(_0x6094('0x0'));module[_0x6094('0x1')]={'uniqueid':{'type':Sequelize[_0x6094('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6094('0x3')](_0x6094('0x4'),_0x6094('0x5'),_0x6094('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x6094('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6094('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 37247be..ca5d2e6 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 _0xbdb7=['model','keys','query','filters','intersection','attributes','fields','length','nolimit','where','filter','merge','map','type','key','VIRTUAL','field','include','findAll','rows','catch','show','includeAll','options','create','body','update','find','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','status','count','offset','limit','set','Content-Range','reject','save','then','destroy','sendStatus','name','send','index','MailTransferReport','rawAttributes'];(function(_0x4ad1f,_0x40d1b0){var _0x186a61=function(_0x530019){while(--_0x530019){_0x4ad1f['push'](_0x4ad1f['shift']());}};_0x186a61(++_0x40d1b0);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x5a4c93,_0x283aa8){_0x5a4c93=_0x5a4c93-0x0;var _0x421ff4=_0xbdb7[_0x5a4c93];return _0x421ff4;};'use strict';var pdf=require(_0x7bdb('0x0'));var emlformat=require(_0x7bdb('0x1'));var rimraf=require(_0x7bdb('0x2'));var zipdir=require(_0x7bdb('0x3'));var jsonpatch=require(_0x7bdb('0x4'));var rp=require(_0x7bdb('0x5'));var moment=require(_0x7bdb('0x6'));var BPromise=require(_0x7bdb('0x7'));var Mustache=require(_0x7bdb('0x8'));var util=require('util');var path=require(_0x7bdb('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7bdb('0xa'));var fs=require('fs');var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var authService=require(_0x7bdb('0xf'));var hardwareService=require(_0x7bdb('0x10'));var Redis=require(_0x7bdb('0x11'));var qs=require(_0x7bdb('0x12'));var logger=require(_0x7bdb('0x13'))(_0x7bdb('0x14'));var utils=require(_0x7bdb('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52b9b9,_0x3053d0){_0x3053d0=_0x3053d0||0xcc;return function(_0x25e3cb){if(_0x25e3cb){return _0x52b9b9['sendStatus'](_0x3053d0);}return _0x52b9b9[_0x7bdb('0x16')](_0x3053d0)['end']();};}function respondWithResult(_0x5898c1,_0x2abca6){_0x2abca6=_0x2abca6||0xc8;return function(_0x46dd4a){if(_0x46dd4a){return _0x5898c1['status'](_0x2abca6)['json'](_0x46dd4a);}};}function respondWithFilteredResult(_0x4e98f7,_0x4476ff){return function(_0x195b2e){if(_0x195b2e){var _0xe9919f=_0x195b2e[_0x7bdb('0x17')],_0x25d417=_0x4476ff[_0x7bdb('0x18')],_0x31c909=_0x4476ff['offset']+_0x4476ff[_0x7bdb('0x19')],_0xbde12a;if(_0x31c909>=_0xe9919f){_0x31c909=_0xe9919f;_0xbde12a=0xc8;}else{_0xbde12a=0xce;}_0x4e98f7[_0x7bdb('0x16')](_0xbde12a);return _0x4e98f7[_0x7bdb('0x1a')](_0x7bdb('0x1b'),_0x25d417+'-'+_0x31c909+'/'+_0xe9919f)['json'](_0x195b2e);}return null;};}function patchUpdates(_0x41f540){return function(_0x23e9eb){try{jsonpatch['apply'](_0x23e9eb,_0x41f540,!![]);}catch(_0x3e5f8e){return BPromise[_0x7bdb('0x1c')](_0x3e5f8e);}return _0x23e9eb[_0x7bdb('0x1d')]();};}function saveUpdates(_0x45d552,_0x112793){return function(_0x5bfc35){if(_0x5bfc35){return _0x5bfc35['update'](_0x45d552)[_0x7bdb('0x1e')](function(_0xcb25f2){return _0xcb25f2;});}return null;};}function removeEntity(_0x5daea4,_0x341fe4){return function(_0x118ea1){if(_0x118ea1){return _0x118ea1[_0x7bdb('0x1f')]()[_0x7bdb('0x1e')](function(){_0x5daea4[_0x7bdb('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d37ac,_0xdad53d){return function(_0x40c447){if(!_0x40c447){_0x1d37ac[_0x7bdb('0x20')](0x194);}return _0x40c447;};}function handleError(_0x481f4b,_0x4d6e44){_0x4d6e44=_0x4d6e44||0x1f4;return function(_0x3c423f){logger['error'](_0x3c423f['stack']);if(_0x3c423f['name']){delete _0x3c423f[_0x7bdb('0x21')];}_0x481f4b['status'](_0x4d6e44)[_0x7bdb('0x22')](_0x3c423f);};}exports[_0x7bdb('0x23')]=function(_0x3ec129,_0x7c09cf){var _0x2a494e={},_0x523869={},_0x10e818={'count':0x0,'rows':[]};var _0x32242d=db[_0x7bdb('0x24')][_0x7bdb('0x25')];_0x523869[_0x7bdb('0x26')]=_[_0x7bdb('0x27')](_0x32242d);_0x523869[_0x7bdb('0x28')]=_[_0x7bdb('0x27')](_0x3ec129[_0x7bdb('0x28')]);_0x523869[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](_0x523869[_0x7bdb('0x26')],_0x523869['query']);_0x2a494e[_0x7bdb('0x2b')]=_[_0x7bdb('0x2a')](_0x523869[_0x7bdb('0x26')],qs[_0x7bdb('0x2c')](_0x3ec129[_0x7bdb('0x28')]['fields']));_0x2a494e[_0x7bdb('0x2b')]=_0x2a494e[_0x7bdb('0x2b')][_0x7bdb('0x2d')]?_0x2a494e[_0x7bdb('0x2b')]:_0x523869['model'];if(!_0x3ec129['query']['hasOwnProperty'](_0x7bdb('0x2e'))){_0x2a494e['limit']=qs[_0x7bdb('0x19')](_0x3ec129['query'][_0x7bdb('0x19')]);_0x2a494e[_0x7bdb('0x18')]=qs[_0x7bdb('0x18')](_0x3ec129['query'][_0x7bdb('0x18')]);}_0x2a494e['order']=qs['sort'](_0x3ec129[_0x7bdb('0x28')]['sort']);_0x2a494e[_0x7bdb('0x2f')]=qs['filters'](_['pick'](_0x3ec129[_0x7bdb('0x28')],_0x523869[_0x7bdb('0x29')]));if(_0x3ec129[_0x7bdb('0x28')][_0x7bdb('0x30')]){_0x2a494e[_0x7bdb('0x2f')]=_[_0x7bdb('0x31')](_0x2a494e['where'],{'$or':_[_0x7bdb('0x32')](_0x32242d,function(_0x464fde){if(_0x464fde[_0x7bdb('0x33')][_0x7bdb('0x34')]!==_0x7bdb('0x35')){var _0x14c522={};_0x14c522[_0x464fde[_0x7bdb('0x36')]]={'$like':'%'+_0x3ec129[_0x7bdb('0x28')][_0x7bdb('0x30')]+'%'};return _0x14c522;}})});}_0x2a494e=_['merge']({},_0x2a494e,_0x3ec129['options']);var _0x19c237={'where':_0x2a494e[_0x7bdb('0x2f')]};return db[_0x7bdb('0x24')][_0x7bdb('0x17')](_0x19c237)[_0x7bdb('0x1e')](function(_0x509e90){_0x10e818['count']=_0x509e90;if(_0x3ec129[_0x7bdb('0x28')]['includeAll']){_0x2a494e[_0x7bdb('0x37')]=[{'all':!![]}];}return db['MailTransferReport'][_0x7bdb('0x38')](_0x2a494e);})['then'](function(_0x4cf3fa){_0x10e818[_0x7bdb('0x39')]=_0x4cf3fa;return _0x10e818;})[_0x7bdb('0x1e')](respondWithFilteredResult(_0x7c09cf,_0x2a494e))[_0x7bdb('0x3a')](handleError(_0x7c09cf,null));};exports[_0x7bdb('0x3b')]=function(_0x43c7d3,_0x2b4829){var _0x2e10f3={'raw':!![],'where':{'id':_0x43c7d3['params']['id']}},_0x501aff={};_0x501aff[_0x7bdb('0x26')]=_[_0x7bdb('0x27')](db[_0x7bdb('0x24')][_0x7bdb('0x25')]);_0x501aff[_0x7bdb('0x28')]=_[_0x7bdb('0x27')](_0x43c7d3[_0x7bdb('0x28')]);_0x501aff['filters']=_['intersection'](_0x501aff[_0x7bdb('0x26')],_0x501aff[_0x7bdb('0x28')]);_0x2e10f3[_0x7bdb('0x2b')]=_[_0x7bdb('0x2a')](_0x501aff['model'],qs[_0x7bdb('0x2c')](_0x43c7d3['query'][_0x7bdb('0x2c')]));_0x2e10f3[_0x7bdb('0x2b')]=_0x2e10f3[_0x7bdb('0x2b')][_0x7bdb('0x2d')]?_0x2e10f3[_0x7bdb('0x2b')]:_0x501aff[_0x7bdb('0x26')];if(_0x43c7d3[_0x7bdb('0x28')][_0x7bdb('0x3c')]){_0x2e10f3[_0x7bdb('0x37')]=[{'all':!![]}];}_0x2e10f3=_['merge']({},_0x2e10f3,_0x43c7d3[_0x7bdb('0x3d')]);return db[_0x7bdb('0x24')]['find'](_0x2e10f3)[_0x7bdb('0x1e')](handleEntityNotFound(_0x2b4829,null))['then'](respondWithResult(_0x2b4829,null))[_0x7bdb('0x3a')](handleError(_0x2b4829,null));};exports[_0x7bdb('0x3e')]=function(_0x122beb,_0x3a8415){return db[_0x7bdb('0x24')]['create'](_0x122beb[_0x7bdb('0x3f')],{})[_0x7bdb('0x1e')](respondWithResult(_0x3a8415,0xc9))[_0x7bdb('0x3a')](handleError(_0x3a8415,null));};exports[_0x7bdb('0x40')]=function(_0x31244f,_0x5021cd){if(_0x31244f[_0x7bdb('0x3f')]['id']){delete _0x31244f[_0x7bdb('0x3f')]['id'];}return db[_0x7bdb('0x24')][_0x7bdb('0x41')]({'where':{'id':_0x31244f[_0x7bdb('0x42')]['id']}})[_0x7bdb('0x1e')](handleEntityNotFound(_0x5021cd,null))[_0x7bdb('0x1e')](saveUpdates(_0x31244f[_0x7bdb('0x3f')],null))[_0x7bdb('0x1e')](respondWithResult(_0x5021cd,null))[_0x7bdb('0x3a')](handleError(_0x5021cd,null));};exports['destroy']=function(_0x189cf8,_0x58c4bc){return db['MailTransferReport'][_0x7bdb('0x41')]({'where':{'id':_0x189cf8[_0x7bdb('0x42')]['id']}})['then'](handleEntityNotFound(_0x58c4bc,null))[_0x7bdb('0x1e')](removeEntity(_0x58c4bc,null))[_0x7bdb('0x3a')](handleError(_0x58c4bc,null));};exports['describe']=function(_0x54ac12,_0x4edd0d){return db[_0x7bdb('0x24')][_0x7bdb('0x43')]()[_0x7bdb('0x1e')](respondWithResult(_0x4edd0d,null))[_0x7bdb('0x3a')](handleError(_0x4edd0d,null));}; \ No newline at end of file +var _0x0713=['jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','set','Content-Range','json','apply','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','MailTransferReport','rawAttributes','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','map','key','VIRTUAL','field','include','findAll','catch','show','params','length','includeAll','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x2ebbae,_0x3a6860){var _0x278584=function(_0x549456){while(--_0x549456){_0x2ebbae['push'](_0x2ebbae['shift']());}};_0x278584(++_0x3a6860);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var authService=require(_0x3071('0x11'));var hardwareService=require(_0x3071('0x12'));var Redis=require(_0x3071('0x13'));var qs=require(_0x3071('0x14'));var logger=require(_0x3071('0x15'))('api');var utils=require(_0x3071('0x16'));var config=require(_0x3071('0x17'));var db=require(_0x3071('0x18'))['db'];function respondWithStatusCode(_0x3ed4a0,_0xa0c1){_0xa0c1=_0xa0c1||0xcc;return function(_0x4a8cc7){if(_0x4a8cc7){return _0x3ed4a0['sendStatus'](_0xa0c1);}return _0x3ed4a0[_0x3071('0x19')](_0xa0c1)['end']();};}function respondWithResult(_0x31c220,_0x44fbae){_0x44fbae=_0x44fbae||0xc8;return function(_0x5d4883){if(_0x5d4883){return _0x31c220[_0x3071('0x19')](_0x44fbae)['json'](_0x5d4883);}};}function respondWithFilteredResult(_0x2fc15d,_0x45c93b){return function(_0x1271d0){if(_0x1271d0){var _0x1f14e1=_0x1271d0[_0x3071('0x1a')],_0x1caa5d=_0x45c93b[_0x3071('0x1b')],_0x2a6a4b=_0x45c93b[_0x3071('0x1b')]+_0x45c93b['limit'],_0x157a47;if(_0x2a6a4b>=_0x1f14e1){_0x2a6a4b=_0x1f14e1;_0x157a47=0xc8;}else{_0x157a47=0xce;}_0x2fc15d[_0x3071('0x19')](_0x157a47);return _0x2fc15d[_0x3071('0x1c')](_0x3071('0x1d'),_0x1caa5d+'-'+_0x2a6a4b+'/'+_0x1f14e1)[_0x3071('0x1e')](_0x1271d0);}return null;};}function patchUpdates(_0x3acf0e){return function(_0x17aee2){try{jsonpatch[_0x3071('0x1f')](_0x17aee2,_0x3acf0e,!![]);}catch(_0x26f113){return BPromise['reject'](_0x26f113);}return _0x17aee2[_0x3071('0x20')]();};}function saveUpdates(_0x2bfa33,_0xd3e23d){return function(_0x56c267){if(_0x56c267){return _0x56c267[_0x3071('0x21')](_0x2bfa33)['then'](function(_0x833074){return _0x833074;});}return null;};}function removeEntity(_0x43128c,_0x3762d8){return function(_0x457b57){if(_0x457b57){return _0x457b57[_0x3071('0x22')]()[_0x3071('0x23')](function(){_0x43128c[_0x3071('0x19')](0xcc)[_0x3071('0x24')]();});}};}function handleEntityNotFound(_0x542646,_0x481a51){return function(_0x2ce48a){if(!_0x2ce48a){_0x542646[_0x3071('0x25')](0x194);}return _0x2ce48a;};}function handleError(_0x412652,_0x13df9f){_0x13df9f=_0x13df9f||0x1f4;return function(_0x2793ef){logger[_0x3071('0x26')](_0x2793ef[_0x3071('0x27')]);if(_0x2793ef[_0x3071('0x28')]){delete _0x2793ef[_0x3071('0x28')];}_0x412652['status'](_0x13df9f)[_0x3071('0x29')](_0x2793ef);};}exports[_0x3071('0x2a')]=function(_0x177138,_0x4d5c4b){var _0x4fb1ca={},_0x28792d={},_0x163604={'count':0x0,'rows':[]};var _0x950fde=db[_0x3071('0x2b')][_0x3071('0x2c')];_0x28792d[_0x3071('0x2d')]=_[_0x3071('0x2e')](_0x950fde);_0x28792d[_0x3071('0x2f')]=_[_0x3071('0x2e')](_0x177138[_0x3071('0x2f')]);_0x28792d['filters']=_['intersection'](_0x28792d[_0x3071('0x2d')],_0x28792d[_0x3071('0x2f')]);_0x4fb1ca[_0x3071('0x30')]=_[_0x3071('0x31')](_0x28792d[_0x3071('0x2d')],qs[_0x3071('0x32')](_0x177138[_0x3071('0x2f')][_0x3071('0x32')]));_0x4fb1ca['attributes']=_0x4fb1ca['attributes']['length']?_0x4fb1ca[_0x3071('0x30')]:_0x28792d[_0x3071('0x2d')];if(!_0x177138['query'][_0x3071('0x33')](_0x3071('0x34'))){_0x4fb1ca[_0x3071('0x35')]=qs[_0x3071('0x35')](_0x177138['query'][_0x3071('0x35')]);_0x4fb1ca[_0x3071('0x1b')]=qs[_0x3071('0x1b')](_0x177138[_0x3071('0x2f')][_0x3071('0x1b')]);}_0x4fb1ca[_0x3071('0x36')]=qs[_0x3071('0x37')](_0x177138[_0x3071('0x2f')]['sort']);_0x4fb1ca[_0x3071('0x38')]=qs['filters'](_['pick'](_0x177138[_0x3071('0x2f')],_0x28792d[_0x3071('0x39')]));if(_0x177138['query'][_0x3071('0x3a')]){_0x4fb1ca[_0x3071('0x38')]=_[_0x3071('0x3b')](_0x4fb1ca[_0x3071('0x38')],{'$or':_[_0x3071('0x3c')](_0x950fde,function(_0x232235){if(_0x232235['type'][_0x3071('0x3d')]!==_0x3071('0x3e')){var _0x4ce6d4={};_0x4ce6d4[_0x232235[_0x3071('0x3f')]]={'$like':'%'+_0x177138['query'][_0x3071('0x3a')]+'%'};return _0x4ce6d4;}})});}_0x4fb1ca=_[_0x3071('0x3b')]({},_0x4fb1ca,_0x177138['options']);var _0x593c99={'where':_0x4fb1ca[_0x3071('0x38')]};return db[_0x3071('0x2b')][_0x3071('0x1a')](_0x593c99)['then'](function(_0x4dea69){_0x163604['count']=_0x4dea69;if(_0x177138[_0x3071('0x2f')]['includeAll']){_0x4fb1ca[_0x3071('0x40')]=[{'all':!![]}];}return db[_0x3071('0x2b')][_0x3071('0x41')](_0x4fb1ca);})[_0x3071('0x23')](function(_0x30ab68){_0x163604['rows']=_0x30ab68;return _0x163604;})['then'](respondWithFilteredResult(_0x4d5c4b,_0x4fb1ca))[_0x3071('0x42')](handleError(_0x4d5c4b,null));};exports[_0x3071('0x43')]=function(_0x1455be,_0x1f69a6){var _0x525389={'raw':!![],'where':{'id':_0x1455be[_0x3071('0x44')]['id']}},_0x3cfc05={};_0x3cfc05[_0x3071('0x2d')]=_[_0x3071('0x2e')](db[_0x3071('0x2b')][_0x3071('0x2c')]);_0x3cfc05['query']=_[_0x3071('0x2e')](_0x1455be['query']);_0x3cfc05['filters']=_['intersection'](_0x3cfc05['model'],_0x3cfc05[_0x3071('0x2f')]);_0x525389[_0x3071('0x30')]=_[_0x3071('0x31')](_0x3cfc05[_0x3071('0x2d')],qs[_0x3071('0x32')](_0x1455be[_0x3071('0x2f')][_0x3071('0x32')]));_0x525389[_0x3071('0x30')]=_0x525389['attributes'][_0x3071('0x45')]?_0x525389[_0x3071('0x30')]:_0x3cfc05[_0x3071('0x2d')];if(_0x1455be[_0x3071('0x2f')][_0x3071('0x46')]){_0x525389['include']=[{'all':!![]}];}_0x525389=_['merge']({},_0x525389,_0x1455be[_0x3071('0x47')]);return db[_0x3071('0x2b')][_0x3071('0x48')](_0x525389)[_0x3071('0x23')](handleEntityNotFound(_0x1f69a6,null))[_0x3071('0x23')](respondWithResult(_0x1f69a6,null))['catch'](handleError(_0x1f69a6,null));};exports[_0x3071('0x49')]=function(_0x4a1d29,_0x18a773){return db['MailTransferReport']['create'](_0x4a1d29[_0x3071('0x4a')],{})['then'](respondWithResult(_0x18a773,0xc9))[_0x3071('0x42')](handleError(_0x18a773,null));};exports['update']=function(_0x717c43,_0x1d75e5){if(_0x717c43[_0x3071('0x4a')]['id']){delete _0x717c43[_0x3071('0x4a')]['id'];}return db['MailTransferReport'][_0x3071('0x48')]({'where':{'id':_0x717c43['params']['id']}})[_0x3071('0x23')](handleEntityNotFound(_0x1d75e5,null))['then'](saveUpdates(_0x717c43[_0x3071('0x4a')],null))[_0x3071('0x23')](respondWithResult(_0x1d75e5,null))['catch'](handleError(_0x1d75e5,null));};exports[_0x3071('0x22')]=function(_0x117e73,_0x224a70){return db[_0x3071('0x2b')][_0x3071('0x48')]({'where':{'id':_0x117e73[_0x3071('0x44')]['id']}})[_0x3071('0x23')](handleEntityNotFound(_0x224a70,null))['then'](removeEntity(_0x224a70,null))[_0x3071('0x42')](handleError(_0x224a70,null));};exports[_0x3071('0x4b')]=function(_0x443b0e,_0xda07a4){return db['MailTransferReport'][_0x3071('0x4b')]()[_0x3071('0x23')](respondWithResult(_0xda07a4,null))[_0x3071('0x42')](handleError(_0xda07a4,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index ac3635a..9ec76f2 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 _0x489a=['report_mail_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','./mailTransferReport.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x489a,0x1c4));var _0xa489=function(_0x5d7e13,_0x3630e2){_0x5d7e13=_0x5d7e13-0x0;var _0x1beeaa=_0x489a[_0x5d7e13];return _0x1beeaa;};'use strict';var _=require(_0xa489('0x0'));var util=require(_0xa489('0x1'));var logger=require(_0xa489('0x2'))('api');var moment=require(_0xa489('0x3'));var BPromise=require(_0xa489('0x4'));var rp=require(_0xa489('0x5'));var attributes=require(_0xa489('0x6'));module[_0xa489('0x7')]=function(_0x4a5214,_0x12588a){return _0x4a5214['define']('MailTransferReport',attributes,{'tableName':_0xa489('0x8'),'paranoid':![],'indexes':[{'name':_0xa489('0x9'),'fields':[_0xa489('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0809=['util','../../config/logger','moment','./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid'];(function(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0x0809,0x1a8));var _0x9080=function(_0x3f10a6,_0x23fcf9){_0x3f10a6=_0x3f10a6-0x0;var _0x607d57=_0x0809[_0x3f10a6];return _0x607d57;};'use strict';var _=require('lodash');var util=require(_0x9080('0x0'));var logger=require(_0x9080('0x1'))('api');var moment=require(_0x9080('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x9080('0x3'));module[_0x9080('0x4')]=function(_0x5565fb,_0x2d9465){return _0x5565fb[_0x9080('0x5')](_0x9080('0x6'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x9080('0x7'),'fields':[_0x9080('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index e0fadaf..7b81134 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 _0x22c8=['info','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','MailTransferReport,\x20%s,\x20%s','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x56a91e,_0x4696c1){var _0x252715=function(_0x22b4da){while(--_0x22b4da){_0x56a91e['push'](_0x56a91e['shift']());}};_0x252715(++_0x4696c1);}(_0x22c8,0xe4));var _0x822c=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0x22c8[_0x3b5ad9];return _0x611ae9;};'use strict';var _=require('lodash');var util=require(_0x822c('0x0'));var moment=require(_0x822c('0x1'));var BPromise=require('bluebird');var rs=require(_0x822c('0x2'));var fs=require('fs');var Redis=require(_0x822c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x822c('0x4'));var logger=require('../../config/logger')(_0x822c('0x5'));var config=require(_0x822c('0x6'));var jayson=require(_0x822c('0x7'));var client=jayson[_0x822c('0x8')][_0x822c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ef8d6,_0x419b71,_0x2df746){return new BPromise(function(_0x576d81,_0xe33f5f){return client[_0x822c('0xa')](_0x5ef8d6,_0x2df746)[_0x822c('0xb')](function(_0x318d1a){logger[_0x822c('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x419b71,_0x822c('0xd'));logger['debug'](_0x822c('0xe'),_0x419b71,_0x822c('0xd'),JSON['stringify'](_0x318d1a));if(_0x318d1a[_0x822c('0xf')]){if(_0x318d1a['error'][_0x822c('0x10')]===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x419b71,_0x318d1a[_0x822c('0xf')]['message']);return _0xe33f5f(_0x318d1a['error'][_0x822c('0x11')]);}logger['error'](_0x822c('0x12'),_0x419b71,_0x318d1a['error'][_0x822c('0x11')]);return _0x576d81(_0x318d1a[_0x822c('0xf')][_0x822c('0x11')]);}else{logger['info'](_0x822c('0x12'),_0x419b71,_0x822c('0xd'));_0x576d81(_0x318d1a['result']['message']);}})[_0x822c('0x13')](function(_0x38a582){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x419b71,_0x38a582);_0xe33f5f(_0x38a582);});});} \ No newline at end of file +var _0x32fb=['../../config/utils','../../config/logger','rpc','http','request','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x22f85a,_0x195ed5){var _0xaa717=function(_0xe9828e){while(--_0xe9828e){_0x22f85a['push'](_0x22f85a['shift']());}};_0xaa717(++_0x195ed5);}(_0x32fb,0x1c9));var _0xb32f=function(_0xc8dadf,_0x1c984f){_0xc8dadf=_0xc8dadf-0x0;var _0x18e84e=_0x32fb[_0xc8dadf];return _0x18e84e;};'use strict';var _=require(_0xb32f('0x0'));var util=require('util');var moment=require(_0xb32f('0x1'));var BPromise=require('bluebird');var rs=require(_0xb32f('0x2'));var fs=require('fs');var Redis=require(_0xb32f('0x3'));var db=require(_0xb32f('0x4'))['db'];var utils=require(_0xb32f('0x5'));var logger=require(_0xb32f('0x6'))(_0xb32f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb32f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x275647,_0x2458a4,_0x4593cb){return new BPromise(function(_0x15c1ea,_0x1cc723){return client[_0xb32f('0x9')](_0x275647,_0x4593cb)['then'](function(_0x49e117){logger['info'](_0xb32f('0xa'),_0x2458a4,_0xb32f('0xb'));logger[_0xb32f('0xc')](_0xb32f('0xd'),_0x2458a4,_0xb32f('0xb'),JSON[_0xb32f('0xe')](_0x49e117));if(_0x49e117[_0xb32f('0xf')]){if(_0x49e117['error'][_0xb32f('0x10')]===0x1f4){logger[_0xb32f('0xf')](_0xb32f('0xa'),_0x2458a4,_0x49e117[_0xb32f('0xf')][_0xb32f('0x11')]);return _0x1cc723(_0x49e117[_0xb32f('0xf')][_0xb32f('0x11')]);}logger[_0xb32f('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x2458a4,_0x49e117[_0xb32f('0xf')]['message']);return _0x15c1ea(_0x49e117[_0xb32f('0xf')][_0xb32f('0x11')]);}else{logger[_0xb32f('0x12')](_0xb32f('0xa'),_0x2458a4,_0xb32f('0xb'));_0x15c1ea(_0x49e117[_0xb32f('0x13')][_0xb32f('0x11')]);}})[_0xb32f('0x14')](function(_0xdf2f90){logger[_0xb32f('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x2458a4,_0xdf2f90);_0x1cc723(_0xdf2f90);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 536189d..fee8232 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 _0x4080=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete'];(function(_0x561975,_0x1d64fc){var _0x15b7f5=function(_0x43bfc1){while(--_0x43bfc1){_0x561975['push'](_0x561975['shift']());}};_0x15b7f5(++_0x1d64fc);}(_0x4080,0x65));var _0x0408=function(_0x5ce34a,_0x57887e){_0x5ce34a=_0x5ce34a-0x0;var _0x309350=_0x4080[_0x5ce34a];return _0x309350;};'use strict';var multer=require(_0x0408('0x0'));var util=require(_0x0408('0x1'));var path=require(_0x0408('0x2'));var timeout=require(_0x0408('0x3'));var express=require(_0x0408('0x4'));var router=express['Router']();var auth=require(_0x0408('0x5'));var interaction=require(_0x0408('0x6'));var config=require(_0x0408('0x7'));var controller=require(_0x0408('0x8'));router[_0x0408('0x9')]('/',auth[_0x0408('0xa')](),controller[_0x0408('0xb')]);router[_0x0408('0x9')](_0x0408('0xc'),auth[_0x0408('0xa')](),controller[_0x0408('0xd')]);router[_0x0408('0x9')](_0x0408('0xe'),auth['isAuthenticated'](),controller[_0x0408('0xf')]);router['post']('/',auth[_0x0408('0xa')](),controller[_0x0408('0x10')]);router['put']('/:id',auth[_0x0408('0xa')](),controller[_0x0408('0x11')]);router[_0x0408('0x12')]('/:id',auth[_0x0408('0xa')](),controller['destroy']);module[_0x0408('0x13')]=router; \ No newline at end of file +var _0x1e93=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x12c3d1,_0x3c6ae7){var _0x282840=function(_0x4ae0d2){while(--_0x4ae0d2){_0x12c3d1['push'](_0x12c3d1['shift']());}};_0x282840(++_0x3c6ae7);}(_0x1e93,0x89));var _0x31e9=function(_0x61e2f9,_0x137eef){_0x61e2f9=_0x61e2f9-0x0;var _0x357b90=_0x1e93[_0x61e2f9];return _0x357b90;};'use strict';var multer=require(_0x31e9('0x0'));var util=require(_0x31e9('0x1'));var path=require(_0x31e9('0x2'));var timeout=require(_0x31e9('0x3'));var express=require(_0x31e9('0x4'));var router=express[_0x31e9('0x5')]();var auth=require(_0x31e9('0x6'));var interaction=require(_0x31e9('0x7'));var config=require('../../config/environment');var controller=require(_0x31e9('0x8'));router[_0x31e9('0x9')]('/',auth[_0x31e9('0xa')](),controller[_0x31e9('0xb')]);router[_0x31e9('0x9')]('/describe',auth[_0x31e9('0xa')](),controller['describe']);router[_0x31e9('0x9')](_0x31e9('0xc'),auth[_0x31e9('0xa')](),controller[_0x31e9('0xd')]);router['post']('/',auth[_0x31e9('0xa')](),controller[_0x31e9('0xe')]);router[_0x31e9('0xf')](_0x31e9('0xc'),auth['isAuthenticated'](),controller[_0x31e9('0x10')]);router[_0x31e9('0x11')](_0x31e9('0xc'),auth[_0x31e9('0xa')](),controller[_0x31e9('0x12')]);module[_0x31e9('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 81c25c7..1911c9a 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 _0x5288=['seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','enterAt','diff'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5288,0xca));var _0x8528=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x5288[_0x710815];return _0x5b3b89;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8528('0x0'));module[_0x8528('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8528('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8528('0x2')],'defaultValue':_0x8528('0x3'),'comment':_0x8528('0x4')},'duration':{'type':Sequelize[_0x8528('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x4ab36b){var _0x5a395b=moment(_0x4ab36b);var _0x33236b=moment(this['getDataValue'](_0x8528('0x6')));var _0x304219=_0x5a395b[_0x8528('0x7')](_0x33236b,_0x8528('0x8'));this[_0x8528('0x9')](_0x8528('0xa'),_0x4ab36b);this['setDataValue'](_0x8528('0xb'),_0x304219||null);}},'data1':{'type':Sequelize[_0x8528('0x2')],'comment':_0x8528('0xc')},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x8528('0x2')],'comment':_0x8528('0xd')},'data4':{'type':Sequelize[_0x8528('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x8528('0x2')],'comment':_0x8528('0xe')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x8528('0x2')]}}; \ No newline at end of file +var _0x82c6=['DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING'];(function(_0x5f1d06,_0xf87a33){var _0x1a2334=function(_0x2bcf21){while(--_0x2bcf21){_0x5f1d06['push'](_0x5f1d06['shift']());}};_0x1a2334(++_0xf87a33);}(_0x82c6,0x1d6));var _0x682c=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x82c6[_0x16d10f];return _0x50c823;};'use strict';var Sequelize=require(_0x682c('0x0'));var moment=require(_0x682c('0x1'));module[_0x682c('0x2')]={'channel':{'type':Sequelize[_0x682c('0x3')]},'membername':{'type':Sequelize[_0x682c('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':_0x682c('0x4'),'comment':_0x682c('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x682c('0x6')],'set':function(_0x1a13e9){var _0x320052=moment(_0x1a13e9);var _0x5cf8cf=moment(this[_0x682c('0x7')](_0x682c('0x8')));var _0x53509d=_0x320052[_0x682c('0x9')](_0x5cf8cf,_0x682c('0xa'));this[_0x682c('0xb')](_0x682c('0xc'),_0x1a13e9);this['setDataValue']('duration',_0x53509d||null);}},'data1':{'type':Sequelize[_0x682c('0x3')],'comment':_0x682c('0xd')},'data2':{'type':Sequelize[_0x682c('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x682c('0x3')],'comment':_0x682c('0xe')},'data4':{'type':Sequelize[_0x682c('0x3')],'comment':_0x682c('0xf')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x682c('0x3')]},'internal':{'type':Sequelize[_0x682c('0x10')]},'uniqueid':{'type':Sequelize[_0x682c('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 19c8c6a..3727f7e 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 _0xecf5=['../../config/logger','../../config/environment','../../mysqldb','end','status','json','count','offset','apply','reject','save','then','destroy','error','stack','name','send','index','MemberReport','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','map','key','VIRTUAL','field','includeAll','include','findAll','catch','show','keys','rawAttributes','create','update','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs'];(function(_0x4736fb,_0x31d2be){var _0x44d09b=function(_0x15aa3d){while(--_0x15aa3d){_0x4736fb['push'](_0x4736fb['shift']());}};_0x44d09b(++_0x31d2be);}(_0xecf5,0x1c5));var _0x5ecf=function(_0x159f6c,_0xca1201){_0x159f6c=_0x159f6c-0x0;var _0x24ffd3=_0xecf5[_0x159f6c];return _0x24ffd3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5ecf('0x0'));var rimraf=require(_0x5ecf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5ecf('0x2'));var rp=require(_0x5ecf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5ecf('0x4'));var path=require(_0x5ecf('0x5'));var sox=require(_0x5ecf('0x6'));var csv=require(_0x5ecf('0x7'));var ejs=require(_0x5ecf('0x8'));var fs=require('fs');var _=require(_0x5ecf('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5ecf('0xa'));var toCsv=require(_0x5ecf('0x7'));var querystring=require(_0x5ecf('0xb'));var Papa=require('papaparse');var authService=require(_0x5ecf('0xc'));var hardwareService=require(_0x5ecf('0xd'));var Redis=require(_0x5ecf('0xe'));var qs=require(_0x5ecf('0xf'));var logger=require(_0x5ecf('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x5ecf('0x11'));var db=require(_0x5ecf('0x12'))['db'];function respondWithStatusCode(_0x9b845c,_0x1ace5f){_0x1ace5f=_0x1ace5f||0xcc;return function(_0x3d061c){if(_0x3d061c){return _0x9b845c['sendStatus'](_0x1ace5f);}return _0x9b845c['status'](_0x1ace5f)[_0x5ecf('0x13')]();};}function respondWithResult(_0x456ea3,_0xadf8af){_0xadf8af=_0xadf8af||0xc8;return function(_0x5cb5db){if(_0x5cb5db){return _0x456ea3[_0x5ecf('0x14')](_0xadf8af)[_0x5ecf('0x15')](_0x5cb5db);}};}function respondWithFilteredResult(_0x4a5947,_0x515b53){return function(_0x2c2472){if(_0x2c2472){var _0x4bd1c3=_0x2c2472[_0x5ecf('0x16')],_0x13ddb6=_0x515b53[_0x5ecf('0x17')],_0x54c980=_0x515b53[_0x5ecf('0x17')]+_0x515b53['limit'],_0x306b6f;if(_0x54c980>=_0x4bd1c3){_0x54c980=_0x4bd1c3;_0x306b6f=0xc8;}else{_0x306b6f=0xce;}_0x4a5947[_0x5ecf('0x14')](_0x306b6f);return _0x4a5947['set']('Content-Range',_0x13ddb6+'-'+_0x54c980+'/'+_0x4bd1c3)[_0x5ecf('0x15')](_0x2c2472);}return null;};}function patchUpdates(_0x2e408e){return function(_0x2b5ad9){try{jsonpatch[_0x5ecf('0x18')](_0x2b5ad9,_0x2e408e,!![]);}catch(_0x2c0569){return BPromise[_0x5ecf('0x19')](_0x2c0569);}return _0x2b5ad9[_0x5ecf('0x1a')]();};}function saveUpdates(_0x56ddc9,_0x59fe12){return function(_0x35a74a){if(_0x35a74a){return _0x35a74a['update'](_0x56ddc9)[_0x5ecf('0x1b')](function(_0x22f032){return _0x22f032;});}return null;};}function removeEntity(_0x540bf6,_0x2361fb){return function(_0xd8d34f){if(_0xd8d34f){return _0xd8d34f[_0x5ecf('0x1c')]()[_0x5ecf('0x1b')](function(){_0x540bf6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3feb4d,_0x4524a8){return function(_0x16aa19){if(!_0x16aa19){_0x3feb4d['sendStatus'](0x194);}return _0x16aa19;};}function handleError(_0x227ad5,_0x19ca30){_0x19ca30=_0x19ca30||0x1f4;return function(_0x2b0c61){logger[_0x5ecf('0x1d')](_0x2b0c61[_0x5ecf('0x1e')]);if(_0x2b0c61[_0x5ecf('0x1f')]){delete _0x2b0c61[_0x5ecf('0x1f')];}_0x227ad5[_0x5ecf('0x14')](_0x19ca30)[_0x5ecf('0x20')](_0x2b0c61);};}exports[_0x5ecf('0x21')]=function(_0x1786c7,_0x1a4f14){var _0x133738={},_0x302562={},_0x1273ce={'count':0x0,'rows':[]};var _0x3401f0=db[_0x5ecf('0x22')]['rawAttributes'];_0x302562[_0x5ecf('0x23')]=_['keys'](_0x3401f0);_0x302562['query']=_['keys'](_0x1786c7[_0x5ecf('0x24')]);_0x302562[_0x5ecf('0x25')]=_[_0x5ecf('0x26')](_0x302562['model'],_0x302562[_0x5ecf('0x24')]);_0x133738[_0x5ecf('0x27')]=_[_0x5ecf('0x26')](_0x302562[_0x5ecf('0x23')],qs[_0x5ecf('0x28')](_0x1786c7[_0x5ecf('0x24')]['fields']));_0x133738[_0x5ecf('0x27')]=_0x133738[_0x5ecf('0x27')][_0x5ecf('0x29')]?_0x133738['attributes']:_0x302562[_0x5ecf('0x23')];if(!_0x1786c7['query']['hasOwnProperty'](_0x5ecf('0x2a'))){_0x133738[_0x5ecf('0x2b')]=qs[_0x5ecf('0x2b')](_0x1786c7['query'][_0x5ecf('0x2b')]);_0x133738[_0x5ecf('0x17')]=qs['offset'](_0x1786c7[_0x5ecf('0x24')][_0x5ecf('0x17')]);}_0x133738[_0x5ecf('0x2c')]=qs[_0x5ecf('0x2d')](_0x1786c7['query'][_0x5ecf('0x2d')]);_0x133738[_0x5ecf('0x2e')]=qs['filters'](_[_0x5ecf('0x2f')](_0x1786c7[_0x5ecf('0x24')],_0x302562['filters']));if(_0x1786c7[_0x5ecf('0x24')][_0x5ecf('0x30')]){_0x133738['where']=_[_0x5ecf('0x31')](_0x133738['where'],{'$or':_[_0x5ecf('0x32')](_0x3401f0,function(_0x2270b2){if(_0x2270b2['type'][_0x5ecf('0x33')]!==_0x5ecf('0x34')){var _0x31ad86={};_0x31ad86[_0x2270b2[_0x5ecf('0x35')]]={'$like':'%'+_0x1786c7[_0x5ecf('0x24')][_0x5ecf('0x30')]+'%'};return _0x31ad86;}})});}_0x133738=_[_0x5ecf('0x31')]({},_0x133738,_0x1786c7['options']);var _0x2cbe73={'where':_0x133738['where']};return db[_0x5ecf('0x22')][_0x5ecf('0x16')](_0x2cbe73)[_0x5ecf('0x1b')](function(_0xe98844){_0x1273ce[_0x5ecf('0x16')]=_0xe98844;if(_0x1786c7[_0x5ecf('0x24')][_0x5ecf('0x36')]){_0x133738[_0x5ecf('0x37')]=[{'all':!![]}];}return db[_0x5ecf('0x22')][_0x5ecf('0x38')](_0x133738);})['then'](function(_0x207f15){_0x1273ce['rows']=_0x207f15;return _0x1273ce;})[_0x5ecf('0x1b')](respondWithFilteredResult(_0x1a4f14,_0x133738))[_0x5ecf('0x39')](handleError(_0x1a4f14,null));};exports[_0x5ecf('0x3a')]=function(_0x5e25e8,_0xccc5d0){var _0xefcb05={'raw':!![],'where':{'id':_0x5e25e8['params']['id']}},_0x5c894c={};_0x5c894c['model']=_[_0x5ecf('0x3b')](db[_0x5ecf('0x22')][_0x5ecf('0x3c')]);_0x5c894c[_0x5ecf('0x24')]=_['keys'](_0x5e25e8[_0x5ecf('0x24')]);_0x5c894c[_0x5ecf('0x25')]=_[_0x5ecf('0x26')](_0x5c894c[_0x5ecf('0x23')],_0x5c894c[_0x5ecf('0x24')]);_0xefcb05[_0x5ecf('0x27')]=_['intersection'](_0x5c894c['model'],qs[_0x5ecf('0x28')](_0x5e25e8[_0x5ecf('0x24')][_0x5ecf('0x28')]));_0xefcb05[_0x5ecf('0x27')]=_0xefcb05[_0x5ecf('0x27')]['length']?_0xefcb05['attributes']:_0x5c894c[_0x5ecf('0x23')];if(_0x5e25e8[_0x5ecf('0x24')][_0x5ecf('0x36')]){_0xefcb05[_0x5ecf('0x37')]=[{'all':!![]}];}_0xefcb05=_[_0x5ecf('0x31')]({},_0xefcb05,_0x5e25e8['options']);return db['MemberReport']['find'](_0xefcb05)[_0x5ecf('0x1b')](handleEntityNotFound(_0xccc5d0,null))[_0x5ecf('0x1b')](respondWithResult(_0xccc5d0,null))[_0x5ecf('0x39')](handleError(_0xccc5d0,null));};exports['create']=function(_0x489fb1,_0x2d7ca3){return db['MemberReport'][_0x5ecf('0x3d')](_0x489fb1['body'],{})[_0x5ecf('0x1b')](respondWithResult(_0x2d7ca3,0xc9))[_0x5ecf('0x39')](handleError(_0x2d7ca3,null));};exports[_0x5ecf('0x3e')]=function(_0xfb048f,_0x19838b){if(_0xfb048f[_0x5ecf('0x3f')]['id']){delete _0xfb048f['body']['id'];}return db[_0x5ecf('0x22')][_0x5ecf('0x40')]({'where':{'id':_0xfb048f[_0x5ecf('0x41')]['id']}})[_0x5ecf('0x1b')](handleEntityNotFound(_0x19838b,null))[_0x5ecf('0x1b')](saveUpdates(_0xfb048f[_0x5ecf('0x3f')],null))[_0x5ecf('0x1b')](respondWithResult(_0x19838b,null))['catch'](handleError(_0x19838b,null));};exports[_0x5ecf('0x1c')]=function(_0xef4473,_0x392179){return db[_0x5ecf('0x22')][_0x5ecf('0x40')]({'where':{'id':_0xef4473[_0x5ecf('0x41')]['id']}})['then'](handleEntityNotFound(_0x392179,null))[_0x5ecf('0x1b')](removeEntity(_0x392179,null))['catch'](handleError(_0x392179,null));};exports[_0x5ecf('0x42')]=function(_0x217a77,_0x7beee9){return db['MemberReport'][_0x5ecf('0x42')]()['then'](respondWithResult(_0x7beee9,null))[_0x5ecf('0x39')](handleError(_0x7beee9,null));}; \ No newline at end of file +var _0x1f31=['options','includeAll','include','rows','catch','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','lodash','squel','crypto','querystring','../../components/auth/service','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','status','json','count','offset','limit','apply','reject','then','end','error','stack','name','send','MemberReport','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','map','type','key','VIRTUAL','field'];(function(_0x32d43b,_0x59a019){var _0xaae4ab=function(_0x56f648){while(--_0x56f648){_0x32d43b['push'](_0x32d43b['shift']());}};_0xaae4ab(++_0x59a019);}(_0x1f31,0x8b));var _0x11f3=function(_0x3b5e02,_0x535469){_0x3b5e02=_0x3b5e02-0x0;var _0x59464c=_0x1f31[_0x3b5e02];return _0x59464c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x11f3('0x0'));var rimraf=require(_0x11f3('0x1'));var zipdir=require(_0x11f3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x11f3('0x3'));var BPromise=require(_0x11f3('0x4'));var Mustache=require('mustache');var util=require(_0x11f3('0x5'));var path=require(_0x11f3('0x6'));var sox=require('sox');var csv=require(_0x11f3('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x11f3('0x8'));var squel=require(_0x11f3('0x9'));var crypto=require(_0x11f3('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x11f3('0x7'));var querystring=require(_0x11f3('0xb'));var Papa=require('papaparse');var authService=require(_0x11f3('0xc'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x11f3('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0x11f3('0xe'))(_0x11f3('0xf'));var utils=require('../../config/utils');var config=require(_0x11f3('0x10'));var db=require(_0x11f3('0x11'))['db'];function respondWithStatusCode(_0x4dffe3,_0x32f101){_0x32f101=_0x32f101||0xcc;return function(_0x1433b8){if(_0x1433b8){return _0x4dffe3['sendStatus'](_0x32f101);}return _0x4dffe3[_0x11f3('0x12')](_0x32f101)['end']();};}function respondWithResult(_0x3d5764,_0x886ebb){_0x886ebb=_0x886ebb||0xc8;return function(_0xc7d72f){if(_0xc7d72f){return _0x3d5764[_0x11f3('0x12')](_0x886ebb)[_0x11f3('0x13')](_0xc7d72f);}};}function respondWithFilteredResult(_0xb0fcba,_0x2e41d2){return function(_0x571ac3){if(_0x571ac3){var _0x4f7e6d=_0x571ac3[_0x11f3('0x14')],_0x5f363e=_0x2e41d2[_0x11f3('0x15')],_0x51340a=_0x2e41d2[_0x11f3('0x15')]+_0x2e41d2[_0x11f3('0x16')],_0x5e8f9b;if(_0x51340a>=_0x4f7e6d){_0x51340a=_0x4f7e6d;_0x5e8f9b=0xc8;}else{_0x5e8f9b=0xce;}_0xb0fcba['status'](_0x5e8f9b);return _0xb0fcba['set']('Content-Range',_0x5f363e+'-'+_0x51340a+'/'+_0x4f7e6d)[_0x11f3('0x13')](_0x571ac3);}return null;};}function patchUpdates(_0x46351b){return function(_0x36e515){try{jsonpatch[_0x11f3('0x17')](_0x36e515,_0x46351b,!![]);}catch(_0x3f04e4){return BPromise[_0x11f3('0x18')](_0x3f04e4);}return _0x36e515['save']();};}function saveUpdates(_0x420a49,_0x481bea){return function(_0x5948e1){if(_0x5948e1){return _0x5948e1['update'](_0x420a49)[_0x11f3('0x19')](function(_0x3645be){return _0x3645be;});}return null;};}function removeEntity(_0x1095f6,_0x541728){return function(_0x3369ed){if(_0x3369ed){return _0x3369ed['destroy']()[_0x11f3('0x19')](function(){_0x1095f6['status'](0xcc)[_0x11f3('0x1a')]();});}};}function handleEntityNotFound(_0x164a82,_0x1f2f76){return function(_0x26e3b6){if(!_0x26e3b6){_0x164a82['sendStatus'](0x194);}return _0x26e3b6;};}function handleError(_0x570674,_0x15fe80){_0x15fe80=_0x15fe80||0x1f4;return function(_0x40014b){logger[_0x11f3('0x1b')](_0x40014b[_0x11f3('0x1c')]);if(_0x40014b[_0x11f3('0x1d')]){delete _0x40014b['name'];}_0x570674[_0x11f3('0x12')](_0x15fe80)[_0x11f3('0x1e')](_0x40014b);};}exports['index']=function(_0x53311d,_0x390ed0){var _0xdcdaf3={},_0x460b04={},_0x1ad8d9={'count':0x0,'rows':[]};var _0x570d06=db[_0x11f3('0x1f')][_0x11f3('0x20')];_0x460b04['model']=_[_0x11f3('0x21')](_0x570d06);_0x460b04[_0x11f3('0x22')]=_[_0x11f3('0x21')](_0x53311d['query']);_0x460b04[_0x11f3('0x23')]=_[_0x11f3('0x24')](_0x460b04[_0x11f3('0x25')],_0x460b04['query']);_0xdcdaf3[_0x11f3('0x26')]=_[_0x11f3('0x24')](_0x460b04[_0x11f3('0x25')],qs[_0x11f3('0x27')](_0x53311d[_0x11f3('0x22')]['fields']));_0xdcdaf3[_0x11f3('0x26')]=_0xdcdaf3['attributes'][_0x11f3('0x28')]?_0xdcdaf3[_0x11f3('0x26')]:_0x460b04[_0x11f3('0x25')];if(!_0x53311d[_0x11f3('0x22')][_0x11f3('0x29')](_0x11f3('0x2a'))){_0xdcdaf3[_0x11f3('0x16')]=qs[_0x11f3('0x16')](_0x53311d[_0x11f3('0x22')][_0x11f3('0x16')]);_0xdcdaf3[_0x11f3('0x15')]=qs[_0x11f3('0x15')](_0x53311d[_0x11f3('0x22')]['offset']);}_0xdcdaf3[_0x11f3('0x2b')]=qs[_0x11f3('0x2c')](_0x53311d[_0x11f3('0x22')]['sort']);_0xdcdaf3['where']=qs[_0x11f3('0x23')](_[_0x11f3('0x2d')](_0x53311d[_0x11f3('0x22')],_0x460b04[_0x11f3('0x23')]));if(_0x53311d['query']['filter']){_0xdcdaf3['where']=_[_0x11f3('0x2e')](_0xdcdaf3[_0x11f3('0x2f')],{'$or':_[_0x11f3('0x30')](_0x570d06,function(_0x35239b){if(_0x35239b[_0x11f3('0x31')][_0x11f3('0x32')]!==_0x11f3('0x33')){var _0x5b9ccd={};_0x5b9ccd[_0x35239b[_0x11f3('0x34')]]={'$like':'%'+_0x53311d[_0x11f3('0x22')]['filter']+'%'};return _0x5b9ccd;}})});}_0xdcdaf3=_[_0x11f3('0x2e')]({},_0xdcdaf3,_0x53311d[_0x11f3('0x35')]);var _0x931d6d={'where':_0xdcdaf3['where']};return db[_0x11f3('0x1f')][_0x11f3('0x14')](_0x931d6d)['then'](function(_0x116f21){_0x1ad8d9[_0x11f3('0x14')]=_0x116f21;if(_0x53311d[_0x11f3('0x22')][_0x11f3('0x36')]){_0xdcdaf3[_0x11f3('0x37')]=[{'all':!![]}];}return db[_0x11f3('0x1f')]['findAll'](_0xdcdaf3);})[_0x11f3('0x19')](function(_0x799ff3){_0x1ad8d9[_0x11f3('0x38')]=_0x799ff3;return _0x1ad8d9;})[_0x11f3('0x19')](respondWithFilteredResult(_0x390ed0,_0xdcdaf3))[_0x11f3('0x39')](handleError(_0x390ed0,null));};exports['show']=function(_0x32905b,_0x36cf22){var _0x5749ee={'raw':!![],'where':{'id':_0x32905b[_0x11f3('0x3a')]['id']}},_0xe6c2e6={};_0xe6c2e6[_0x11f3('0x25')]=_['keys'](db['MemberReport'][_0x11f3('0x20')]);_0xe6c2e6[_0x11f3('0x22')]=_[_0x11f3('0x21')](_0x32905b[_0x11f3('0x22')]);_0xe6c2e6[_0x11f3('0x23')]=_['intersection'](_0xe6c2e6[_0x11f3('0x25')],_0xe6c2e6[_0x11f3('0x22')]);_0x5749ee[_0x11f3('0x26')]=_[_0x11f3('0x24')](_0xe6c2e6['model'],qs[_0x11f3('0x27')](_0x32905b[_0x11f3('0x22')][_0x11f3('0x27')]));_0x5749ee[_0x11f3('0x26')]=_0x5749ee['attributes'][_0x11f3('0x28')]?_0x5749ee['attributes']:_0xe6c2e6[_0x11f3('0x25')];if(_0x32905b[_0x11f3('0x22')][_0x11f3('0x36')]){_0x5749ee[_0x11f3('0x37')]=[{'all':!![]}];}_0x5749ee=_[_0x11f3('0x2e')]({},_0x5749ee,_0x32905b['options']);return db['MemberReport'][_0x11f3('0x3b')](_0x5749ee)[_0x11f3('0x19')](handleEntityNotFound(_0x36cf22,null))[_0x11f3('0x19')](respondWithResult(_0x36cf22,null))[_0x11f3('0x39')](handleError(_0x36cf22,null));};exports[_0x11f3('0x3c')]=function(_0xf9e872,_0x47b20a){return db[_0x11f3('0x1f')][_0x11f3('0x3c')](_0xf9e872[_0x11f3('0x3d')],{})[_0x11f3('0x19')](respondWithResult(_0x47b20a,0xc9))['catch'](handleError(_0x47b20a,null));};exports[_0x11f3('0x3e')]=function(_0x3f6f82,_0x223e84){if(_0x3f6f82['body']['id']){delete _0x3f6f82[_0x11f3('0x3d')]['id'];}return db[_0x11f3('0x1f')][_0x11f3('0x3b')]({'where':{'id':_0x3f6f82[_0x11f3('0x3a')]['id']}})[_0x11f3('0x19')](handleEntityNotFound(_0x223e84,null))['then'](saveUpdates(_0x3f6f82['body'],null))[_0x11f3('0x19')](respondWithResult(_0x223e84,null))[_0x11f3('0x39')](handleError(_0x223e84,null));};exports['destroy']=function(_0x2d5f03,_0x292c80){return db[_0x11f3('0x1f')]['find']({'where':{'id':_0x2d5f03['params']['id']}})[_0x11f3('0x19')](handleEntityNotFound(_0x292c80,null))[_0x11f3('0x19')](removeEntity(_0x292c80,null))['catch'](handleError(_0x292c80,null));};exports['describe']=function(_0x4228d9,_0x59dbc7){return db[_0x11f3('0x1f')][_0x11f3('0x3f')]()[_0x11f3('0x19')](respondWithResult(_0x59dbc7,null))[_0x11f3('0x39')](handleError(_0x59dbc7,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index a515515..a3b6187 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 _0xffc8=['membername_interface','membername','interface','util','../../config/logger','api','bluebird','./memberReport.attributes','define'];(function(_0x124c8f,_0xc3115e){var _0x24e52f=function(_0x1d42f7){while(--_0x1d42f7){_0x124c8f['push'](_0x124c8f['shift']());}};_0x24e52f(++_0xc3115e);}(_0xffc8,0x6f));var _0x8ffc=function(_0x3e20b0,_0x410821){_0x3e20b0=_0x3e20b0-0x0;var _0x5e9279=_0xffc8[_0x3e20b0];return _0x5e9279;};'use strict';var _=require('lodash');var util=require(_0x8ffc('0x0'));var logger=require(_0x8ffc('0x1'))(_0x8ffc('0x2'));var moment=require('moment');var BPromise=require(_0x8ffc('0x3'));var rp=require('request-promise');var attributes=require(_0x8ffc('0x4'));module['exports']=function(_0x397b8e,_0x28f13b){return _0x397b8e[_0x8ffc('0x5')]('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x8ffc('0x6'),'fields':[_0x8ffc('0x7'),_0x8ffc('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x96ff=['lodash','util','api','moment','request-promise','./memberReport.attributes','exports','define','report_member','membername_interface','membername','interface'];(function(_0x1cb45e,_0xc81a9c){var _0x2517bc=function(_0x4f9ca6){while(--_0x4f9ca6){_0x1cb45e['push'](_0x1cb45e['shift']());}};_0x2517bc(++_0xc81a9c);}(_0x96ff,0xc0));var _0xf96f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x96ff[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xf96f('0x0'));var util=require(_0xf96f('0x1'));var logger=require('../../config/logger')(_0xf96f('0x2'));var moment=require(_0xf96f('0x3'));var BPromise=require('bluebird');var rp=require(_0xf96f('0x4'));var attributes=require(_0xf96f('0x5'));module[_0xf96f('0x6')]=function(_0x56c045,_0x52af0b){return _0x56c045[_0xf96f('0x7')]('MemberReport',attributes,{'tableName':_0xf96f('0x8'),'paranoid':![],'indexes':[{'name':_0xf96f('0x9'),'fields':[_0xf96f('0xa'),_0xf96f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index b1e927a..272970d 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 _0x45f1=['update','body','UpdateMemberReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMemberReport','findAll','raw','options','where','attributes','limit','include','map','model','then','catch','CreateMemberReport','MemberReport','create'];(function(_0x251a7d,_0x93ecb6){var _0x19f7de=function(_0x2a136d){while(--_0x2a136d){_0x251a7d['push'](_0x251a7d['shift']());}};_0x19f7de(++_0x93ecb6);}(_0x45f1,0xe7));var _0x145f=function(_0x12d10c,_0xf310aa){_0x12d10c=_0x12d10c-0x0;var _0x26409e=_0x45f1[_0x12d10c];return _0x26409e;};'use strict';var _=require(_0x145f('0x0'));var util=require(_0x145f('0x1'));var moment=require('moment');var BPromise=require(_0x145f('0x2'));var rs=require(_0x145f('0x3'));var fs=require('fs');var Redis=require(_0x145f('0x4'));var db=require(_0x145f('0x5'))['db'];var utils=require(_0x145f('0x6'));var logger=require('../../config/logger')(_0x145f('0x7'));var config=require(_0x145f('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x45c350,_0x3a5c30,_0x4b8986){return new BPromise(function(_0x3f0abd,_0x262879){return client[_0x145f('0x9')](_0x45c350,_0x4b8986)['then'](function(_0x5a31ef){logger[_0x145f('0xa')](_0x145f('0xb'),_0x3a5c30,_0x145f('0xc'));logger[_0x145f('0xd')](_0x145f('0xe'),_0x3a5c30,_0x145f('0xc'),JSON[_0x145f('0xf')](_0x5a31ef));if(_0x5a31ef[_0x145f('0x10')]){if(_0x5a31ef[_0x145f('0x10')][_0x145f('0x11')]===0x1f4){logger['error'](_0x145f('0xb'),_0x3a5c30,_0x5a31ef[_0x145f('0x10')][_0x145f('0x12')]);return _0x262879(_0x5a31ef[_0x145f('0x10')][_0x145f('0x12')]);}logger['error'](_0x145f('0xb'),_0x3a5c30,_0x5a31ef[_0x145f('0x10')][_0x145f('0x12')]);return _0x3f0abd(_0x5a31ef[_0x145f('0x10')][_0x145f('0x12')]);}else{logger[_0x145f('0xa')](_0x145f('0xb'),_0x3a5c30,_0x145f('0xc'));_0x3f0abd(_0x5a31ef[_0x145f('0x13')][_0x145f('0x12')]);}})['catch'](function(_0x5c6b8b){logger[_0x145f('0x10')](_0x145f('0xb'),_0x3a5c30,_0x5c6b8b);_0x262879(_0x5c6b8b);});});}exports[_0x145f('0x14')]=function(_0x4eeeb1){var _0x56aaa4=this;return new Promise(function(_0x33010e,_0x31fcb6){return db['MemberReport'][_0x145f('0x15')]({'raw':_0x4eeeb1['options']?_0x4eeeb1['options'][_0x145f('0x16')]===undefined?!![]:![]:!![],'where':_0x4eeeb1[_0x145f('0x17')]?_0x4eeeb1[_0x145f('0x17')][_0x145f('0x18')]||null:null,'attributes':_0x4eeeb1['options']?_0x4eeeb1[_0x145f('0x17')][_0x145f('0x19')]||null:null,'limit':_0x4eeeb1['options']?_0x4eeeb1[_0x145f('0x17')][_0x145f('0x1a')]||null:null,'include':_0x4eeeb1[_0x145f('0x17')]?_0x4eeeb1['options'][_0x145f('0x1b')]?_[_0x145f('0x1c')](_0x4eeeb1['options'][_0x145f('0x1b')],function(_0x498ff8){return{'model':db[_0x498ff8[_0x145f('0x1d')]],'as':_0x498ff8['as'],'attributes':_0x498ff8[_0x145f('0x19')],'include':_0x498ff8[_0x145f('0x1b')]?_['map'](_0x498ff8[_0x145f('0x1b')],function(_0x243b25){return{'model':db[_0x243b25[_0x145f('0x1d')]],'as':_0x243b25['as'],'attributes':_0x243b25[_0x145f('0x19')],'include':_0x243b25['include']?_[_0x145f('0x1c')](_0x243b25[_0x145f('0x1b')],function(_0x42e61f){return{'model':db[_0x42e61f['model']],'as':_0x42e61f['as'],'attributes':_0x42e61f[_0x145f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x145f('0x1e')](function(_0x41922c){logger[_0x145f('0xa')](_0x145f('0x14'),_0x4eeeb1);logger[_0x145f('0xd')](_0x145f('0x14'),_0x4eeeb1,JSON['stringify'](_0x41922c));_0x33010e(_0x41922c);})[_0x145f('0x1f')](function(_0x2dee3b){logger[_0x145f('0x10')](_0x145f('0x14'),_0x2dee3b['message'],_0x4eeeb1);_0x31fcb6(_0x56aaa4[_0x145f('0x10')](0x1f4,_0x2dee3b[_0x145f('0x12')]));});});};exports[_0x145f('0x20')]=function(_0x34c739){var _0x543a26=this;return new Promise(function(_0x45728c,_0x4b8cc2){return db[_0x145f('0x21')][_0x145f('0x22')](_0x34c739['body'],{'raw':_0x34c739[_0x145f('0x17')]?_0x34c739[_0x145f('0x17')][_0x145f('0x16')]===undefined?!![]:![]:!![]})[_0x145f('0x1e')](function(_0x2a4d8a){logger['info']('CreateMemberReport',_0x34c739);logger[_0x145f('0xd')](_0x145f('0x20'),_0x34c739,JSON[_0x145f('0xf')](_0x2a4d8a));_0x45728c(_0x2a4d8a);})[_0x145f('0x1f')](function(_0x115da9){logger[_0x145f('0x10')](_0x145f('0x20'),_0x115da9['message'],_0x34c739);_0x4b8cc2(_0x543a26[_0x145f('0x10')](0x1f4,_0x115da9[_0x145f('0x12')]));});});};exports['UpdateMemberReport']=function(_0x1444fc){var _0x8ed122=this;return new Promise(function(_0x239bb0,_0x55f804){return db[_0x145f('0x21')][_0x145f('0x23')](_0x1444fc[_0x145f('0x24')],{'raw':_0x1444fc[_0x145f('0x17')]?_0x1444fc[_0x145f('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1444fc[_0x145f('0x17')]?_0x1444fc['options'][_0x145f('0x18')]||null:null,'attributes':_0x1444fc[_0x145f('0x17')]?_0x1444fc['options'][_0x145f('0x19')]||null:null,'limit':_0x1444fc[_0x145f('0x17')]?_0x1444fc['options'][_0x145f('0x1a')]||null:null})['then'](function(_0x52fa6c){logger[_0x145f('0xa')]('UpdateMemberReport',_0x1444fc);logger[_0x145f('0xd')](_0x145f('0x25'),_0x1444fc,JSON[_0x145f('0xf')](_0x52fa6c));_0x239bb0(_0x52fa6c);})[_0x145f('0x1f')](function(_0x2a126d){logger[_0x145f('0x10')](_0x145f('0x25'),_0x2a126d[_0x145f('0x12')],_0x1444fc);_0x55f804(_0x8ed122[_0x145f('0x10')](0x1f4,_0x2a126d[_0x145f('0x12')]));});});}; \ No newline at end of file +var _0x7446=['then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetMemberReport','MemberReport','findAll','raw','where','options','attributes','limit','include','map','model','CreateMemberReport','create','update','body','UpdateMemberReport','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request'];(function(_0x40b9bb,_0x2a7337){var _0x3aafe1=function(_0x38fd8b){while(--_0x38fd8b){_0x40b9bb['push'](_0x40b9bb['shift']());}};_0x3aafe1(++_0x2a7337);}(_0x7446,0xf8));var _0x6744=function(_0x1f063b,_0x321a3c){_0x1f063b=_0x1f063b-0x0;var _0x4d864b=_0x7446[_0x1f063b];return _0x4d864b;};'use strict';var _=require(_0x6744('0x0'));var util=require(_0x6744('0x1'));var moment=require(_0x6744('0x2'));var BPromise=require(_0x6744('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6744('0x4'))['db'];var utils=require(_0x6744('0x5'));var logger=require('../../config/logger')(_0x6744('0x6'));var config=require('../../config/environment');var jayson=require(_0x6744('0x7'));var client=jayson[_0x6744('0x8')][_0x6744('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4494b1,_0x4dd07f,_0x504dd4){return new BPromise(function(_0xa53fb2,_0x3c2a1b){return client[_0x6744('0xa')](_0x4494b1,_0x504dd4)[_0x6744('0xb')](function(_0x4e8dd7){logger[_0x6744('0xc')](_0x6744('0xd'),_0x4dd07f,_0x6744('0xe'));logger[_0x6744('0xf')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x4dd07f,_0x6744('0xe'),JSON[_0x6744('0x10')](_0x4e8dd7));if(_0x4e8dd7[_0x6744('0x11')]){if(_0x4e8dd7[_0x6744('0x11')][_0x6744('0x12')]===0x1f4){logger[_0x6744('0x11')](_0x6744('0xd'),_0x4dd07f,_0x4e8dd7['error'][_0x6744('0x13')]);return _0x3c2a1b(_0x4e8dd7[_0x6744('0x11')][_0x6744('0x13')]);}logger[_0x6744('0x11')]('MemberReport,\x20%s,\x20%s',_0x4dd07f,_0x4e8dd7['error']['message']);return _0xa53fb2(_0x4e8dd7[_0x6744('0x11')]['message']);}else{logger[_0x6744('0xc')]('MemberReport,\x20%s,\x20%s',_0x4dd07f,'request\x20sent');_0xa53fb2(_0x4e8dd7['result'][_0x6744('0x13')]);}})[_0x6744('0x14')](function(_0x33c52a){logger[_0x6744('0x11')]('MemberReport,\x20%s,\x20%s',_0x4dd07f,_0x33c52a);_0x3c2a1b(_0x33c52a);});});}exports[_0x6744('0x15')]=function(_0x527650){var _0x3bc094=this;return new Promise(function(_0x69bea,_0x210ef1){return db[_0x6744('0x16')][_0x6744('0x17')]({'raw':_0x527650['options']?_0x527650['options'][_0x6744('0x18')]===undefined?!![]:![]:!![],'where':_0x527650['options']?_0x527650['options'][_0x6744('0x19')]||null:null,'attributes':_0x527650['options']?_0x527650[_0x6744('0x1a')][_0x6744('0x1b')]||null:null,'limit':_0x527650['options']?_0x527650[_0x6744('0x1a')][_0x6744('0x1c')]||null:null,'include':_0x527650[_0x6744('0x1a')]?_0x527650[_0x6744('0x1a')][_0x6744('0x1d')]?_[_0x6744('0x1e')](_0x527650[_0x6744('0x1a')][_0x6744('0x1d')],function(_0x40d899){return{'model':db[_0x40d899[_0x6744('0x1f')]],'as':_0x40d899['as'],'attributes':_0x40d899[_0x6744('0x1b')],'include':_0x40d899[_0x6744('0x1d')]?_['map'](_0x40d899[_0x6744('0x1d')],function(_0x5f3f60){return{'model':db[_0x5f3f60['model']],'as':_0x5f3f60['as'],'attributes':_0x5f3f60['attributes'],'include':_0x5f3f60[_0x6744('0x1d')]?_['map'](_0x5f3f60[_0x6744('0x1d')],function(_0x15e027){return{'model':db[_0x15e027[_0x6744('0x1f')]],'as':_0x15e027['as'],'attributes':_0x15e027[_0x6744('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6744('0xb')](function(_0x4f7dfe){logger[_0x6744('0xc')](_0x6744('0x15'),_0x527650);logger[_0x6744('0xf')](_0x6744('0x15'),_0x527650,JSON[_0x6744('0x10')](_0x4f7dfe));_0x69bea(_0x4f7dfe);})[_0x6744('0x14')](function(_0x498a53){logger['error'](_0x6744('0x15'),_0x498a53['message'],_0x527650);_0x210ef1(_0x3bc094[_0x6744('0x11')](0x1f4,_0x498a53['message']));});});};exports[_0x6744('0x20')]=function(_0x19948a){var _0x2a2c33=this;return new Promise(function(_0x2c2f94,_0x2b54a2){return db[_0x6744('0x16')][_0x6744('0x21')](_0x19948a['body'],{'raw':_0x19948a[_0x6744('0x1a')]?_0x19948a[_0x6744('0x1a')][_0x6744('0x18')]===undefined?!![]:![]:!![]})[_0x6744('0xb')](function(_0x58ad3c){logger['info'](_0x6744('0x20'),_0x19948a);logger['debug'](_0x6744('0x20'),_0x19948a,JSON[_0x6744('0x10')](_0x58ad3c));_0x2c2f94(_0x58ad3c);})[_0x6744('0x14')](function(_0x19aec9){logger['error'](_0x6744('0x20'),_0x19aec9[_0x6744('0x13')],_0x19948a);_0x2b54a2(_0x2a2c33['error'](0x1f4,_0x19aec9[_0x6744('0x13')]));});});};exports['UpdateMemberReport']=function(_0x5819f6){var _0x1b8b72=this;return new Promise(function(_0x59e2ce,_0x3221a1){return db[_0x6744('0x16')][_0x6744('0x22')](_0x5819f6[_0x6744('0x23')],{'raw':_0x5819f6['options']?_0x5819f6[_0x6744('0x1a')][_0x6744('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5819f6[_0x6744('0x1a')]?_0x5819f6['options'][_0x6744('0x19')]||null:null,'attributes':_0x5819f6[_0x6744('0x1a')]?_0x5819f6[_0x6744('0x1a')]['attributes']||null:null,'limit':_0x5819f6['options']?_0x5819f6[_0x6744('0x1a')][_0x6744('0x1c')]||null:null})['then'](function(_0x5a8e17){logger[_0x6744('0xc')](_0x6744('0x24'),_0x5819f6);logger['debug'](_0x6744('0x24'),_0x5819f6,JSON[_0x6744('0x10')](_0x5a8e17));_0x59e2ce(_0x5a8e17);})['catch'](function(_0x29622c){logger[_0x6744('0x11')]('UpdateMemberReport',_0x29622c[_0x6744('0x13')],_0x5819f6);_0x3221a1(_0x1b8b72[_0x6744('0x11')](0x1f4,_0x29622c[_0x6744('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index b338ed6..2114131 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 _0x0f44=['index','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./migration.controller'];(function(_0x3d98dc,_0x3994bc){var _0x3b0cbb=function(_0x417b67){while(--_0x417b67){_0x3d98dc['push'](_0x3d98dc['shift']());}};_0x3b0cbb(++_0x3994bc);}(_0x0f44,0x174));var _0x40f4=function(_0x3b5524,_0xff6ab3){_0x3b5524=_0x3b5524-0x0;var _0x3b1331=_0x0f44[_0x3b5524];return _0x3b1331;};'use strict';var multer=require(_0x40f4('0x0'));var util=require(_0x40f4('0x1'));var path=require(_0x40f4('0x2'));var timeout=require(_0x40f4('0x3'));var express=require('express');var router=express[_0x40f4('0x4')]();var auth=require(_0x40f4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x40f4('0x6'));var controller=require(_0x40f4('0x7'));router['get']('/',controller[_0x40f4('0x8')]);module[_0x40f4('0x9')]=router; \ No newline at end of file +var _0xd1e5=['express','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path'];(function(_0x5ea1f3,_0x57fb4d){var _0x5868c6=function(_0x40dc24){while(--_0x40dc24){_0x5ea1f3['push'](_0x5ea1f3['shift']());}};_0x5868c6(++_0x57fb4d);}(_0xd1e5,0x15b));var _0x5d1e=function(_0x3e2de0,_0x462bc5){_0x3e2de0=_0x3e2de0-0x0;var _0x4e187e=_0xd1e5[_0x3e2de0];return _0x4e187e;};'use strict';var multer=require(_0x5d1e('0x0'));var util=require(_0x5d1e('0x1'));var path=require(_0x5d1e('0x2'));var timeout=require('connect-timeout');var express=require(_0x5d1e('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5d1e('0x4'));var config=require(_0x5d1e('0x5'));var controller=require(_0x5d1e('0x6'));router[_0x5d1e('0x7')]('/',controller[_0x5d1e('0x8')]);module[_0x5d1e('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 7b4a10f..19e16cb 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 _0x311a=['exports','sequelize'];(function(_0x521751,_0x4cddb8){var _0x1f0a0f=function(_0x42aec7){while(--_0x42aec7){_0x521751['push'](_0x521751['shift']());}};_0x1f0a0f(++_0x4cddb8);}(_0x311a,0xf9));var _0xa311=function(_0x308cd4,_0x1ef5de){_0x308cd4=_0x308cd4-0x0;var _0x43972b=_0x311a[_0x308cd4];return _0x43972b;};'use strict';var Sequelize=require(_0xa311('0x0'));module[_0xa311('0x1')]={'version':{'type':Sequelize['STRING'],'primaryKey':!![],'autoIncrement':![]}}; \ No newline at end of file +var _0x874c=['sequelize','STRING'];(function(_0x2802ef,_0x21c25f){var _0x101576=function(_0x5680e6){while(--_0x5680e6){_0x2802ef['push'](_0x2802ef['shift']());}};_0x101576(++_0x21c25f);}(_0x874c,0x15a));var _0xc874=function(_0x42e436,_0x1b7f3e){_0x42e436=_0x42e436-0x0;var _0x347fdc=_0x874c[_0x42e436];return _0x347fdc;};'use strict';var Sequelize=require(_0xc874('0x0'));module['exports']={'version':{'type':Sequelize[_0xc874('0x1')],'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 eb98611..04e76e3 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 _0x684c=['filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','field','options','findAll','rows','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','count','offset','limit','Content-Range','save','update','then','destroy','end','error','name','send','index','Migration','keys','query'];(function(_0x2fe689,_0x5794e5){var _0x35ea44=function(_0x51b9d6){while(--_0x51b9d6){_0x2fe689['push'](_0x2fe689['shift']());}};_0x35ea44(++_0x5794e5);}(_0x684c,0x1cd));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xc684('0x0'));var emlformat=require(_0xc684('0x1'));var rimraf=require(_0xc684('0x2'));var zipdir=require(_0xc684('0x3'));var jsonpatch=require(_0xc684('0x4'));var rp=require(_0xc684('0x5'));var moment=require(_0xc684('0x6'));var BPromise=require(_0xc684('0x7'));var Mustache=require(_0xc684('0x8'));var util=require(_0xc684('0x9'));var path=require('path');var sox=require(_0xc684('0xa'));var csv=require(_0xc684('0xb'));var ejs=require(_0xc684('0xc'));var fs=require('fs');var _=require(_0xc684('0xd'));var squel=require('squel');var crypto=require(_0xc684('0xe'));var jsforce=require(_0xc684('0xf'));var deskjs=require(_0xc684('0x10'));var toCsv=require(_0xc684('0xb'));var querystring=require(_0xc684('0x11'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0xc684('0x12'));var Redis=require(_0xc684('0x13'));var qs=require(_0xc684('0x14'));var logger=require(_0xc684('0x15'))(_0xc684('0x16'));var utils=require(_0xc684('0x17'));var config=require(_0xc684('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14e55a,_0x288d0d){_0x288d0d=_0x288d0d||0xcc;return function(_0x2fbe75){if(_0x2fbe75){return _0x14e55a[_0xc684('0x19')](_0x288d0d);}return _0x14e55a[_0xc684('0x1a')](_0x288d0d)['end']();};}function respondWithResult(_0x6906f,_0x610a04){_0x610a04=_0x610a04||0xc8;return function(_0x399dbf){if(_0x399dbf){return _0x6906f[_0xc684('0x1a')](_0x610a04)['json'](_0x399dbf);}};}function respondWithFilteredResult(_0x4087ce,_0x430131){return function(_0x1a3914){if(_0x1a3914){var _0x87f6f1=_0x1a3914[_0xc684('0x1b')],_0x1b955e=_0x430131[_0xc684('0x1c')],_0x1c8f2a=_0x430131[_0xc684('0x1c')]+_0x430131[_0xc684('0x1d')],_0x48ea65;if(_0x1c8f2a>=_0x87f6f1){_0x1c8f2a=_0x87f6f1;_0x48ea65=0xc8;}else{_0x48ea65=0xce;}_0x4087ce[_0xc684('0x1a')](_0x48ea65);return _0x4087ce['set'](_0xc684('0x1e'),_0x1b955e+'-'+_0x1c8f2a+'/'+_0x87f6f1)['json'](_0x1a3914);}return null;};}function patchUpdates(_0x32a94e){return function(_0x180817){try{jsonpatch['apply'](_0x180817,_0x32a94e,!![]);}catch(_0xe65ce3){return BPromise['reject'](_0xe65ce3);}return _0x180817[_0xc684('0x1f')]();};}function saveUpdates(_0x1abbf8,_0x1c4731){return function(_0x1a434b){if(_0x1a434b){return _0x1a434b[_0xc684('0x20')](_0x1abbf8)[_0xc684('0x21')](function(_0x2713ea){return _0x2713ea;});}return null;};}function removeEntity(_0x265468,_0x259ca2){return function(_0x255d4e){if(_0x255d4e){return _0x255d4e[_0xc684('0x22')]()[_0xc684('0x21')](function(){_0x265468['status'](0xcc)[_0xc684('0x23')]();});}};}function handleEntityNotFound(_0x4999ce,_0x138cad){return function(_0x5b56d6){if(!_0x5b56d6){_0x4999ce[_0xc684('0x19')](0x194);}return _0x5b56d6;};}function handleError(_0x48f78e,_0x133823){_0x133823=_0x133823||0x1f4;return function(_0xdb7d8a){logger[_0xc684('0x24')](_0xdb7d8a['stack']);if(_0xdb7d8a[_0xc684('0x25')]){delete _0xdb7d8a[_0xc684('0x25')];}_0x48f78e[_0xc684('0x1a')](_0x133823)[_0xc684('0x26')](_0xdb7d8a);};}exports[_0xc684('0x27')]=function(_0x2403d2,_0x22a603){var _0x597b85={},_0x350994={},_0x1888e7={'count':0x0,'rows':[]};var _0x4785f4=db[_0xc684('0x28')]['rawAttributes'];_0x350994['model']=_[_0xc684('0x29')](_0x4785f4);_0x350994[_0xc684('0x2a')]=_[_0xc684('0x29')](_0x2403d2[_0xc684('0x2a')]);_0x350994[_0xc684('0x2b')]=_[_0xc684('0x2c')](_0x350994['model'],_0x350994['query']);_0x597b85[_0xc684('0x2d')]=_['intersection'](_0x350994[_0xc684('0x2e')],qs[_0xc684('0x2f')](_0x2403d2[_0xc684('0x2a')]['fields']));_0x597b85[_0xc684('0x2d')]=_0x597b85[_0xc684('0x2d')]['length']?_0x597b85[_0xc684('0x2d')]:_0x350994[_0xc684('0x2e')];if(!_0x2403d2[_0xc684('0x2a')][_0xc684('0x30')](_0xc684('0x31'))){_0x597b85[_0xc684('0x1d')]=qs[_0xc684('0x1d')](_0x2403d2['query'][_0xc684('0x1d')]);_0x597b85['offset']=qs[_0xc684('0x1c')](_0x2403d2[_0xc684('0x2a')][_0xc684('0x1c')]);}_0x597b85[_0xc684('0x32')]=qs['sort'](_0x2403d2[_0xc684('0x2a')][_0xc684('0x33')]);_0x597b85[_0xc684('0x34')]=qs['filters'](_[_0xc684('0x35')](_0x2403d2[_0xc684('0x2a')],_0x350994[_0xc684('0x2b')]));if(_0x2403d2['query'][_0xc684('0x36')]){_0x597b85[_0xc684('0x34')]=_[_0xc684('0x37')](_0x597b85[_0xc684('0x34')],{'$or':_['map'](_0x4785f4,function(_0xe5581c){if(_0xe5581c[_0xc684('0x38')]['key']!==_0xc684('0x39')){var _0x1141ed={};_0x1141ed[_0xe5581c[_0xc684('0x3a')]]={'$like':'%'+_0x2403d2[_0xc684('0x2a')][_0xc684('0x36')]+'%'};return _0x1141ed;}})});}_0x597b85=_[_0xc684('0x37')]({},_0x597b85,_0x2403d2[_0xc684('0x3b')]);var _0x422d68={'where':_0x597b85[_0xc684('0x34')]};return db[_0xc684('0x28')][_0xc684('0x1b')](_0x422d68)['then'](function(_0xe5491c){_0x1888e7[_0xc684('0x1b')]=_0xe5491c;if(_0x2403d2[_0xc684('0x2a')]['includeAll']){_0x597b85['include']=[{'all':!![]}];}return db[_0xc684('0x28')][_0xc684('0x3c')](_0x597b85);})['then'](function(_0x589861){_0x1888e7[_0xc684('0x3d')]=_0x589861;return _0x1888e7;})[_0xc684('0x21')](respondWithFilteredResult(_0x22a603,_0x597b85))[_0xc684('0x3e')](handleError(_0x22a603,null));}; \ No newline at end of file +var _0x2ec8=['catch','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','json','reject','save','update','then','error','stack','name','send','Migration','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','field','filter','options','includeAll','findAll','rows'];(function(_0x18d283,_0x5eff7c){var _0x108647=function(_0x4c6396){while(--_0x4c6396){_0x18d283['push'](_0x18d283['shift']());}};_0x108647(++_0x5eff7c);}(_0x2ec8,0xfd));var _0x82ec=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x2ec8[_0x2f5ac5];return _0x37c9a8;};'use strict';var pdf=require(_0x82ec('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x82ec('0x1'));var zipdir=require(_0x82ec('0x2'));var jsonpatch=require(_0x82ec('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x82ec('0x4'));var Mustache=require(_0x82ec('0x5'));var util=require(_0x82ec('0x6'));var path=require('path');var sox=require(_0x82ec('0x7'));var csv=require('to-csv');var ejs=require(_0x82ec('0x8'));var fs=require('fs');var _=require(_0x82ec('0x9'));var squel=require('squel');var crypto=require(_0x82ec('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x82ec('0xb'));var toCsv=require('to-csv');var querystring=require(_0x82ec('0xc'));var Papa=require(_0x82ec('0xd'));var authService=require(_0x82ec('0xe'));var hardwareService=require(_0x82ec('0xf'));var Redis=require(_0x82ec('0x10'));var qs=require(_0x82ec('0x11'));var logger=require(_0x82ec('0x12'))(_0x82ec('0x13'));var utils=require('../../config/utils');var config=require(_0x82ec('0x14'));var db=require(_0x82ec('0x15'))['db'];function respondWithStatusCode(_0x592b99,_0x4c638b){_0x4c638b=_0x4c638b||0xcc;return function(_0x3f1d7e){if(_0x3f1d7e){return _0x592b99['sendStatus'](_0x4c638b);}return _0x592b99[_0x82ec('0x16')](_0x4c638b)[_0x82ec('0x17')]();};}function respondWithResult(_0x1269b8,_0x1a122c){_0x1a122c=_0x1a122c||0xc8;return function(_0x131c99){if(_0x131c99){return _0x1269b8['status'](_0x1a122c)['json'](_0x131c99);}};}function respondWithFilteredResult(_0x2dd57a,_0x208b49){return function(_0x4f5fdb){if(_0x4f5fdb){var _0x141ebe=_0x4f5fdb[_0x82ec('0x18')],_0x518ea3=_0x208b49['offset'],_0x25a749=_0x208b49[_0x82ec('0x19')]+_0x208b49[_0x82ec('0x1a')],_0x2a3007;if(_0x25a749>=_0x141ebe){_0x25a749=_0x141ebe;_0x2a3007=0xc8;}else{_0x2a3007=0xce;}_0x2dd57a[_0x82ec('0x16')](_0x2a3007);return _0x2dd57a[_0x82ec('0x1b')]('Content-Range',_0x518ea3+'-'+_0x25a749+'/'+_0x141ebe)[_0x82ec('0x1c')](_0x4f5fdb);}return null;};}function patchUpdates(_0x3cbb0f){return function(_0x223c21){try{jsonpatch['apply'](_0x223c21,_0x3cbb0f,!![]);}catch(_0xa9ce7e){return BPromise[_0x82ec('0x1d')](_0xa9ce7e);}return _0x223c21[_0x82ec('0x1e')]();};}function saveUpdates(_0x54594a,_0x3bce63){return function(_0x44bc5d){if(_0x44bc5d){return _0x44bc5d[_0x82ec('0x1f')](_0x54594a)['then'](function(_0x4ff767){return _0x4ff767;});}return null;};}function removeEntity(_0x16843b,_0x3654fa){return function(_0x43e56d){if(_0x43e56d){return _0x43e56d['destroy']()[_0x82ec('0x20')](function(){_0x16843b['status'](0xcc)[_0x82ec('0x17')]();});}};}function handleEntityNotFound(_0x48b59f,_0x3788ba){return function(_0x44b07b){if(!_0x44b07b){_0x48b59f['sendStatus'](0x194);}return _0x44b07b;};}function handleError(_0x3dd883,_0x2b052c){_0x2b052c=_0x2b052c||0x1f4;return function(_0x4ac150){logger[_0x82ec('0x21')](_0x4ac150[_0x82ec('0x22')]);if(_0x4ac150[_0x82ec('0x23')]){delete _0x4ac150[_0x82ec('0x23')];}_0x3dd883[_0x82ec('0x16')](_0x2b052c)[_0x82ec('0x24')](_0x4ac150);};}exports['index']=function(_0x262315,_0x58f72f){var _0x56cd49={},_0x3b943e={},_0x25b8b9={'count':0x0,'rows':[]};var _0x179eba=db[_0x82ec('0x25')][_0x82ec('0x26')];_0x3b943e[_0x82ec('0x27')]=_[_0x82ec('0x28')](_0x179eba);_0x3b943e[_0x82ec('0x29')]=_[_0x82ec('0x28')](_0x262315['query']);_0x3b943e[_0x82ec('0x2a')]=_['intersection'](_0x3b943e[_0x82ec('0x27')],_0x3b943e[_0x82ec('0x29')]);_0x56cd49[_0x82ec('0x2b')]=_[_0x82ec('0x2c')](_0x3b943e[_0x82ec('0x27')],qs[_0x82ec('0x2d')](_0x262315[_0x82ec('0x29')][_0x82ec('0x2d')]));_0x56cd49[_0x82ec('0x2b')]=_0x56cd49[_0x82ec('0x2b')][_0x82ec('0x2e')]?_0x56cd49[_0x82ec('0x2b')]:_0x3b943e[_0x82ec('0x27')];if(!_0x262315['query'][_0x82ec('0x2f')](_0x82ec('0x30'))){_0x56cd49[_0x82ec('0x1a')]=qs[_0x82ec('0x1a')](_0x262315['query']['limit']);_0x56cd49[_0x82ec('0x19')]=qs['offset'](_0x262315[_0x82ec('0x29')]['offset']);}_0x56cd49[_0x82ec('0x31')]=qs[_0x82ec('0x32')](_0x262315[_0x82ec('0x29')]['sort']);_0x56cd49[_0x82ec('0x33')]=qs[_0x82ec('0x2a')](_[_0x82ec('0x34')](_0x262315[_0x82ec('0x29')],_0x3b943e[_0x82ec('0x2a')]));if(_0x262315[_0x82ec('0x29')]['filter']){_0x56cd49['where']=_[_0x82ec('0x35')](_0x56cd49[_0x82ec('0x33')],{'$or':_['map'](_0x179eba,function(_0xd6088c){if(_0xd6088c[_0x82ec('0x36')]['key']!==_0x82ec('0x37')){var _0x1d3512={};_0x1d3512[_0xd6088c[_0x82ec('0x38')]]={'$like':'%'+_0x262315[_0x82ec('0x29')][_0x82ec('0x39')]+'%'};return _0x1d3512;}})});}_0x56cd49=_[_0x82ec('0x35')]({},_0x56cd49,_0x262315[_0x82ec('0x3a')]);var _0x12e39d={'where':_0x56cd49[_0x82ec('0x33')]};return db['Migration'][_0x82ec('0x18')](_0x12e39d)[_0x82ec('0x20')](function(_0x3557d8){_0x25b8b9[_0x82ec('0x18')]=_0x3557d8;if(_0x262315[_0x82ec('0x29')][_0x82ec('0x3b')]){_0x56cd49['include']=[{'all':!![]}];}return db['Migration'][_0x82ec('0x3c')](_0x56cd49);})[_0x82ec('0x20')](function(_0x2c6106){_0x25b8b9[_0x82ec('0x3d')]=_0x2c6106;return _0x25b8b9;})[_0x82ec('0x20')](respondWithFilteredResult(_0x58f72f,_0x56cd49))[_0x82ec('0x3e')](handleError(_0x58f72f,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 2d9114c..eba7092 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 _0x7958=['./migration.attributes','exports','Migration','migrations','lodash','util','api','moment','bluebird','request-promise'];(function(_0x2ad008,_0x45c253){var _0x4538cf=function(_0xe143e4){while(--_0xe143e4){_0x2ad008['push'](_0x2ad008['shift']());}};_0x4538cf(++_0x45c253);}(_0x7958,0x126));var _0x8795=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7958[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8795('0x0'));var util=require(_0x8795('0x1'));var logger=require('../../config/logger')(_0x8795('0x2'));var moment=require(_0x8795('0x3'));var BPromise=require(_0x8795('0x4'));var rp=require(_0x8795('0x5'));var attributes=require(_0x8795('0x6'));module[_0x8795('0x7')]=function(_0x347089,_0x2f2594){return _0x347089['define'](_0x8795('0x8'),attributes,{'tableName':_0x8795('0x9'),'paranoid':![],'indexes':[],'timestamps':![]});}; \ No newline at end of file +var _0xd26f=['request-promise','./migration.attributes','exports','define','Migration','lodash','util','moment','bluebird'];(function(_0x4fe5e3,_0x2940d6){var _0x422bd9=function(_0x35658d){while(--_0x35658d){_0x4fe5e3['push'](_0x4fe5e3['shift']());}};_0x422bd9(++_0x2940d6);}(_0xd26f,0x113));var _0xfd26=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xd26f[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0xfd26('0x0'));var util=require(_0xfd26('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfd26('0x2'));var BPromise=require(_0xfd26('0x3'));var rp=require(_0xfd26('0x4'));var attributes=require(_0xfd26('0x5'));module[_0xfd26('0x6')]=function(_0x29c235,_0x3983a2){return _0x29c235[_0xfd26('0x7')](_0xfd26('0x8'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 5dda9c2..52f2435 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 _0x0faf=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1f9c8b,_0x4be966){var _0x4b52d1=function(_0x3df13d){while(--_0x3df13d){_0x1f9c8b['push'](_0x1f9c8b['shift']());}};_0x4b52d1(++_0x4be966);}(_0x0faf,0x132));var _0xf0fa=function(_0x5cc556,_0x158710){_0x5cc556=_0x5cc556-0x0;var _0x12103b=_0x0faf[_0x5cc556];return _0x12103b;};'use strict';var _=require(_0xf0fa('0x0'));var util=require('util');var moment=require(_0xf0fa('0x1'));var BPromise=require(_0xf0fa('0x2'));var rs=require(_0xf0fa('0x3'));var fs=require('fs');var Redis=require(_0xf0fa('0x4'));var db=require(_0xf0fa('0x5'))['db'];var utils=require(_0xf0fa('0x6'));var logger=require(_0xf0fa('0x7'))(_0xf0fa('0x8'));var config=require(_0xf0fa('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf0fa('0xa')][_0xf0fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25b5c4,_0x3a703b,_0x2db1d9){return new BPromise(function(_0x587865,_0x42f7fd){return client[_0xf0fa('0xc')](_0x25b5c4,_0x2db1d9)['then'](function(_0x4df4d1){logger[_0xf0fa('0xd')](_0xf0fa('0xe'),_0x3a703b,_0xf0fa('0xf'));logger[_0xf0fa('0x10')](_0xf0fa('0x11'),_0x3a703b,_0xf0fa('0xf'),JSON[_0xf0fa('0x12')](_0x4df4d1));if(_0x4df4d1[_0xf0fa('0x13')]){if(_0x4df4d1['error'][_0xf0fa('0x14')]===0x1f4){logger['error'](_0xf0fa('0xe'),_0x3a703b,_0x4df4d1['error'][_0xf0fa('0x15')]);return _0x42f7fd(_0x4df4d1[_0xf0fa('0x13')][_0xf0fa('0x15')]);}logger['error']('Migration,\x20%s,\x20%s',_0x3a703b,_0x4df4d1[_0xf0fa('0x13')]['message']);return _0x587865(_0x4df4d1[_0xf0fa('0x13')][_0xf0fa('0x15')]);}else{logger[_0xf0fa('0xd')](_0xf0fa('0xe'),_0x3a703b,_0xf0fa('0xf'));_0x587865(_0x4df4d1[_0xf0fa('0x16')][_0xf0fa('0x15')]);}})[_0xf0fa('0x17')](function(_0x497542){logger[_0xf0fa('0x13')](_0xf0fa('0xe'),_0x3a703b,_0x497542);_0x42f7fd(_0x497542);});});} \ No newline at end of file +var _0x72b1=['stringify','error','Migration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s'];(function(_0xf74901,_0x4b9914){var _0x4b9a7a=function(_0x525095){while(--_0x525095){_0xf74901['push'](_0xf74901['shift']());}};_0x4b9a7a(++_0x4b9914);}(_0x72b1,0x16e));var _0x172b=function(_0x1e19d4,_0x318768){_0x1e19d4=_0x1e19d4-0x0;var _0x51cd2d=_0x72b1[_0x1e19d4];return _0x51cd2d;};'use strict';var _=require(_0x172b('0x0'));var util=require('util');var moment=require(_0x172b('0x1'));var BPromise=require(_0x172b('0x2'));var rs=require(_0x172b('0x3'));var fs=require('fs');var Redis=require(_0x172b('0x4'));var db=require(_0x172b('0x5'))['db'];var utils=require(_0x172b('0x6'));var logger=require(_0x172b('0x7'))('rpc');var config=require(_0x172b('0x8'));var jayson=require(_0x172b('0x9'));var client=jayson[_0x172b('0xa')][_0x172b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x571994,_0x345e5e,_0x517363){return new BPromise(function(_0x1f98e9,_0x531b10){return client[_0x172b('0xc')](_0x571994,_0x517363)[_0x172b('0xd')](function(_0x977f18){logger[_0x172b('0xe')]('Migration,\x20%s,\x20%s',_0x345e5e,_0x172b('0xf'));logger[_0x172b('0x10')](_0x172b('0x11'),_0x345e5e,_0x172b('0xf'),JSON[_0x172b('0x12')](_0x977f18));if(_0x977f18[_0x172b('0x13')]){if(_0x977f18[_0x172b('0x13')]['code']===0x1f4){logger[_0x172b('0x13')](_0x172b('0x14'),_0x345e5e,_0x977f18[_0x172b('0x13')]['message']);return _0x531b10(_0x977f18[_0x172b('0x13')]['message']);}logger[_0x172b('0x13')](_0x172b('0x14'),_0x345e5e,_0x977f18['error'][_0x172b('0x15')]);return _0x1f98e9(_0x977f18[_0x172b('0x13')][_0x172b('0x15')]);}else{logger[_0x172b('0xe')]('Migration,\x20%s,\x20%s',_0x345e5e,'request\x20sent');_0x1f98e9(_0x977f18[_0x172b('0x16')][_0x172b('0x15')]);}})[_0x172b('0x17')](function(_0x3c7fff){logger['error']('Migration,\x20%s,\x20%s',_0x345e5e,_0x3c7fff);_0x531b10(_0x3c7fff);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 1f3da3e..488a754 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 _0xb8ab=['../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','exports','multer','path','express'];(function(_0x14900c,_0x401f5d){var _0x5783fa=function(_0xf98a5c){while(--_0xf98a5c){_0x14900c['push'](_0x14900c['shift']());}};_0x5783fa(++_0x401f5d);}(_0xb8ab,0x1ea));var _0xbb8a=function(_0x535049,_0x478bf5){_0x535049=_0x535049-0x0;var _0x5651f0=_0xb8ab[_0x535049];return _0x5651f0;};'use strict';var multer=require(_0xbb8a('0x0'));var util=require('util');var path=require(_0xbb8a('0x1'));var timeout=require('connect-timeout');var express=require(_0xbb8a('0x2'));var router=express['Router']();var auth=require(_0xbb8a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xbb8a('0x4'));var controller=require(_0xbb8a('0x5'));router[_0xbb8a('0x6')]('/',auth[_0xbb8a('0x7')](),controller[_0xbb8a('0x8')]);router[_0xbb8a('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xbb8a('0x9')]);router[_0xbb8a('0xa')]('/',auth[_0xbb8a('0x7')](),controller[_0xbb8a('0xb')]);router[_0xbb8a('0xc')]('/:id',auth[_0xbb8a('0x7')](),controller[_0xbb8a('0xd')]);router[_0xbb8a('0xe')](_0xbb8a('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xbb8a('0x10')]=router; \ No newline at end of file +var _0xe015=['show','post','isAuthenticated','create','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./network.controller','get','index'];(function(_0x5e81d7,_0x330d7){var _0x2a1a28=function(_0x245c62){while(--_0x245c62){_0x5e81d7['push'](_0x5e81d7['shift']());}};_0x2a1a28(++_0x330d7);}(_0xe015,0x13b));var _0x5e01=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xe015[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var path=require(_0x5e01('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5e01('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5e01('0x4'));var config=require(_0x5e01('0x5'));var controller=require(_0x5e01('0x6'));router[_0x5e01('0x7')]('/',auth['isAuthenticated'](),controller[_0x5e01('0x8')]);router[_0x5e01('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x5e01('0x9')]);router[_0x5e01('0xa')]('/',auth[_0x5e01('0xb')](),controller[_0x5e01('0xc')]);router[_0x5e01('0xd')](_0x5e01('0xe'),auth['isAuthenticated'](),controller[_0x5e01('0xf')]);router['delete'](_0x5e01('0xe'),auth['isAuthenticated'](),controller[_0x5e01('0x10')]);module[_0x5e01('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 7bdbde0..43aa677 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 _0x64f9=['localnet','sequelize','exports'];(function(_0x78de30,_0x7b92b7){var _0x974f92=function(_0x32769f){while(--_0x32769f){_0x78de30['push'](_0x78de30['shift']());}};_0x974f92(++_0x7b92b7);}(_0x64f9,0xeb));var _0x964f=function(_0x135904,_0x1e252b){_0x135904=_0x135904-0x0;var _0x1ce7d5=_0x64f9[_0x135904];return _0x1ce7d5;};'use strict';var Sequelize=require(_0x964f('0x0'));module[_0x964f('0x1')]={'type':{'type':Sequelize['ENUM'](_0x964f('0x2'),'externip')},'value':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4286=['ENUM','localnet','STRING','sequelize','exports'];(function(_0x17d965,_0x250692){var _0x2b6c59=function(_0x49a99e){while(--_0x49a99e){_0x17d965['push'](_0x17d965['shift']());}};_0x2b6c59(++_0x250692);}(_0x4286,0x11b));var _0x6428=function(_0x2b3d69,_0x354006){_0x2b3d69=_0x2b3d69-0x0;var _0x34ffc7=_0x4286[_0x2b3d69];return _0x34ffc7;};'use strict';var Sequelize=require(_0x6428('0x0'));module[_0x6428('0x1')]={'type':{'type':Sequelize[_0x6428('0x2')](_0x6428('0x3'),'externip')},'value':{'type':Sequelize[_0x6428('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index c6d43fc..1f543fa 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 _0x9eff=['http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','end','stack','name','index','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','map','VIRTUAL','field','filter','count','includeAll','Network','findAll','rows','show','params','include','options','find','catch','create','sequelize','transaction','readFileSync','join','server/files/templates/network.ejs','utf8','render','format','/etc/asterisk/sip_xcally_%s.conf','body','type','Reload','chan_sip.so','root','writeFileSync','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','lodash','squel','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise'];(function(_0xf56b3c,_0x4361ab){var _0x5d20b1=function(_0x386a8b){while(--_0x386a8b){_0xf56b3c['push'](_0xf56b3c['shift']());}};_0x5d20b1(++_0x4361ab);}(_0x9eff,0x109));var _0xf9ef=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x9eff[_0x88cd7b];return _0x56fcc8;};'use strict';var pdf=require(_0xf9ef('0x0'));var emlformat=require(_0xf9ef('0x1'));var rimraf=require(_0xf9ef('0x2'));var zipdir=require(_0xf9ef('0x3'));var jsonpatch=require(_0xf9ef('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf9ef('0x5'));var Mustache=require(_0xf9ef('0x6'));var util=require(_0xf9ef('0x7'));var path=require(_0xf9ef('0x8'));var sox=require(_0xf9ef('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf9ef('0xa'));var squel=require(_0xf9ef('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf9ef('0xc'));var querystring=require(_0xf9ef('0xd'));var Papa=require(_0xf9ef('0xe'));var authService=require(_0xf9ef('0xf'));var hardwareService=require(_0xf9ef('0x10'));var Redis=require(_0xf9ef('0x11'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xf9ef('0x12'));var utils=require(_0xf9ef('0x13'));var config=require(_0xf9ef('0x14'));var db=require(_0xf9ef('0x15'))['db'];var jayson=require(_0xf9ef('0x16'));var client=jayson['client'][_0xf9ef('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x30b4e0,_0x4d3b59,_0xba3340,_0x1b3497){return new BPromise(function(_0x24472c,_0x231be6){var _0x5e7f4c=_0x1b3497||client;return _0x5e7f4c[_0xf9ef('0x18')](_0x30b4e0,_0xba3340)[_0xf9ef('0x19')](function(_0x18aaa5){logger[_0xf9ef('0x1a')](_0xf9ef('0x1b'),_0x4d3b59,_0xf9ef('0x1c'));logger[_0xf9ef('0x1d')](_0xf9ef('0x1e'),_0x4d3b59,_0xf9ef('0x1c'),JSON[_0xf9ef('0x1f')](_0x18aaa5));if(_0x18aaa5['error']){if(_0x18aaa5['error']['code']===0x1f4){logger[_0xf9ef('0x20')]('Network,\x20%s,\x20%s',_0x4d3b59,_0x18aaa5[_0xf9ef('0x20')][_0xf9ef('0x21')]);return _0x231be6(_0x18aaa5[_0xf9ef('0x20')]['message']);}logger[_0xf9ef('0x20')]('Network,\x20%s,\x20%s',_0x4d3b59,_0x18aaa5['error'][_0xf9ef('0x21')]);return _0x24472c(_0x18aaa5[_0xf9ef('0x20')][_0xf9ef('0x21')]);}else{logger[_0xf9ef('0x1a')]('Network,\x20%s,\x20%s',_0x4d3b59,_0xf9ef('0x1c'));_0x24472c(_0x18aaa5[_0xf9ef('0x22')][_0xf9ef('0x21')]);}})['catch'](function(_0xfbdb5){logger[_0xf9ef('0x20')](_0xf9ef('0x1b'),_0x4d3b59,_0xfbdb5);_0x231be6(_0xfbdb5);});});}function respondWithStatusCode(_0x5e68bd,_0x4bb3e2){_0x4bb3e2=_0x4bb3e2||0xcc;return function(_0x463fe2){if(_0x463fe2){return _0x5e68bd[_0xf9ef('0x23')](_0x4bb3e2);}return _0x5e68bd[_0xf9ef('0x24')](_0x4bb3e2)['end']();};}function respondWithResult(_0x4d616d,_0x141bf1){_0x141bf1=_0x141bf1||0xc8;return function(_0x8050d0){if(_0x8050d0){return _0x4d616d[_0xf9ef('0x24')](_0x141bf1)['json'](_0x8050d0);}};}function respondWithFilteredResult(_0x196387,_0x3eb4fa){return function(_0x41e13a){if(_0x41e13a){var _0x47ed6f=_0x41e13a['count'],_0x1519d9=_0x3eb4fa[_0xf9ef('0x25')],_0x36a3ac=_0x3eb4fa[_0xf9ef('0x25')]+_0x3eb4fa[_0xf9ef('0x26')],_0x10a42d;if(_0x36a3ac>=_0x47ed6f){_0x36a3ac=_0x47ed6f;_0x10a42d=0xc8;}else{_0x10a42d=0xce;}_0x196387['status'](_0x10a42d);return _0x196387[_0xf9ef('0x27')](_0xf9ef('0x28'),_0x1519d9+'-'+_0x36a3ac+'/'+_0x47ed6f)[_0xf9ef('0x29')](_0x41e13a);}return null;};}function patchUpdates(_0xed234c){return function(_0x4d6fa8){try{jsonpatch[_0xf9ef('0x2a')](_0x4d6fa8,_0xed234c,!![]);}catch(_0x1312b1){return BPromise[_0xf9ef('0x2b')](_0x1312b1);}return _0x4d6fa8[_0xf9ef('0x2c')]();};}function saveUpdates(_0x29be45,_0x16489a){return function(_0x12f7e3){if(_0x12f7e3){return _0x12f7e3[_0xf9ef('0x2d')](_0x29be45)[_0xf9ef('0x19')](function(_0x23d6e6){return _0x23d6e6;});}return null;};}function removeEntity(_0x204d1b,_0x2eb76d){return function(_0x5d7c0c){if(_0x5d7c0c){return _0x5d7c0c[_0xf9ef('0x2e')]()['then'](function(){_0x204d1b[_0xf9ef('0x24')](0xcc)[_0xf9ef('0x2f')]();});}};}function handleEntityNotFound(_0x4c51c1,_0x5a2269){return function(_0x34f7e4){if(!_0x34f7e4){_0x4c51c1[_0xf9ef('0x23')](0x194);}return _0x34f7e4;};}function handleError(_0x37b65b,_0x48e225){_0x48e225=_0x48e225||0x1f4;return function(_0x4895a6){logger[_0xf9ef('0x20')](_0x4895a6[_0xf9ef('0x30')]);if(_0x4895a6[_0xf9ef('0x31')]){delete _0x4895a6[_0xf9ef('0x31')];}_0x37b65b['status'](_0x48e225)['send'](_0x4895a6);};}exports[_0xf9ef('0x32')]=function(_0x147bb9,_0x30548b){var _0x3fc382={},_0x37cc7e={},_0x4be838={'count':0x0,'rows':[]};var _0x2516ec=db['Network']['rawAttributes'];_0x37cc7e[_0xf9ef('0x33')]=_[_0xf9ef('0x34')](_0x2516ec);_0x37cc7e[_0xf9ef('0x35')]=_['keys'](_0x147bb9['query']);_0x37cc7e[_0xf9ef('0x36')]=_[_0xf9ef('0x37')](_0x37cc7e['model'],_0x37cc7e[_0xf9ef('0x35')]);_0x3fc382[_0xf9ef('0x38')]=_[_0xf9ef('0x37')](_0x37cc7e['model'],qs['fields'](_0x147bb9[_0xf9ef('0x35')][_0xf9ef('0x39')]));_0x3fc382[_0xf9ef('0x38')]=_0x3fc382[_0xf9ef('0x38')][_0xf9ef('0x3a')]?_0x3fc382[_0xf9ef('0x38')]:_0x37cc7e[_0xf9ef('0x33')];if(!_0x147bb9[_0xf9ef('0x35')]['hasOwnProperty'](_0xf9ef('0x3b'))){_0x3fc382[_0xf9ef('0x26')]=qs[_0xf9ef('0x26')](_0x147bb9[_0xf9ef('0x35')]['limit']);_0x3fc382[_0xf9ef('0x25')]=qs[_0xf9ef('0x25')](_0x147bb9['query'][_0xf9ef('0x25')]);}_0x3fc382[_0xf9ef('0x3c')]=qs[_0xf9ef('0x3d')](_0x147bb9[_0xf9ef('0x35')][_0xf9ef('0x3d')]);_0x3fc382[_0xf9ef('0x3e')]=qs[_0xf9ef('0x36')](_['pick'](_0x147bb9[_0xf9ef('0x35')],_0x37cc7e[_0xf9ef('0x36')]));if(_0x147bb9[_0xf9ef('0x35')]['filter']){_0x3fc382['where']=_[_0xf9ef('0x3f')](_0x3fc382[_0xf9ef('0x3e')],{'$or':_[_0xf9ef('0x40')](_0x2516ec,function(_0x388795){if(_0x388795['type']['key']!==_0xf9ef('0x41')){var _0x41ce7f={};_0x41ce7f[_0x388795[_0xf9ef('0x42')]]={'$like':'%'+_0x147bb9[_0xf9ef('0x35')][_0xf9ef('0x43')]+'%'};return _0x41ce7f;}})});}_0x3fc382=_[_0xf9ef('0x3f')]({},_0x3fc382,_0x147bb9['options']);var _0x4164f8={'where':_0x3fc382[_0xf9ef('0x3e')]};return db['Network'][_0xf9ef('0x44')](_0x4164f8)[_0xf9ef('0x19')](function(_0xd270f0){_0x4be838[_0xf9ef('0x44')]=_0xd270f0;if(_0x147bb9[_0xf9ef('0x35')][_0xf9ef('0x45')]){_0x3fc382['include']=[{'all':!![]}];}return db[_0xf9ef('0x46')][_0xf9ef('0x47')](_0x3fc382);})[_0xf9ef('0x19')](function(_0x3433c6){_0x4be838[_0xf9ef('0x48')]=_0x3433c6;return _0x4be838;})[_0xf9ef('0x19')](respondWithFilteredResult(_0x30548b,_0x3fc382))['catch'](handleError(_0x30548b,null));};exports[_0xf9ef('0x49')]=function(_0x259624,_0x10ba7c){var _0x586556={'raw':!![],'where':{'id':_0x259624[_0xf9ef('0x4a')]['id']}},_0x19a574={};_0x19a574[_0xf9ef('0x33')]=_[_0xf9ef('0x34')](db[_0xf9ef('0x46')]['rawAttributes']);_0x19a574['query']=_['keys'](_0x259624[_0xf9ef('0x35')]);_0x19a574[_0xf9ef('0x36')]=_[_0xf9ef('0x37')](_0x19a574[_0xf9ef('0x33')],_0x19a574[_0xf9ef('0x35')]);_0x586556[_0xf9ef('0x38')]=_['intersection'](_0x19a574[_0xf9ef('0x33')],qs[_0xf9ef('0x39')](_0x259624[_0xf9ef('0x35')][_0xf9ef('0x39')]));_0x586556[_0xf9ef('0x38')]=_0x586556[_0xf9ef('0x38')][_0xf9ef('0x3a')]?_0x586556[_0xf9ef('0x38')]:_0x19a574['model'];if(_0x259624[_0xf9ef('0x35')][_0xf9ef('0x45')]){_0x586556[_0xf9ef('0x4b')]=[{'all':!![]}];}_0x586556=_[_0xf9ef('0x3f')]({},_0x586556,_0x259624[_0xf9ef('0x4c')]);return db[_0xf9ef('0x46')][_0xf9ef('0x4d')](_0x586556)[_0xf9ef('0x19')](handleEntityNotFound(_0x10ba7c,null))['then'](respondWithResult(_0x10ba7c,null))[_0xf9ef('0x4e')](handleError(_0x10ba7c,null));};exports[_0xf9ef('0x4f')]=function(_0x58740a,_0x1c5c56,_0x2746d0){var _0xb41def;return db[_0xf9ef('0x50')][_0xf9ef('0x51')](function(_0x4bd47b){return db[_0xf9ef('0x46')][_0xf9ef('0x4f')](_0x58740a['body'],{'raw':!![]})[_0xf9ef('0x19')](function(_0x58eceb){_0xb41def=_0x58eceb;return db[_0xf9ef('0x46')][_0xf9ef('0x47')]({'where':{'type':_0x58740a['body']['type']},'raw':!![]});})['then'](function(_0x1f18c8){var _0x41f309=fs[_0xf9ef('0x52')](path[_0xf9ef('0x53')](config['root'],_0xf9ef('0x54')),_0xf9ef('0x55'));var _0x35c768=ejs[_0xf9ef('0x56')](_0x41f309,{'networks':_0x1f18c8||[]});fs['writeFileSync'](util[_0xf9ef('0x57')](_0xf9ef('0x58'),_0x58740a[_0xf9ef('0x59')][_0xf9ef('0x5a')]['toLowerCase']()),_0x35c768);})[_0xf9ef('0x19')](function(){return respondWithRpcPromise(_0xf9ef('0x5b'),_0xf9ef('0x4f'),{'module':_0xf9ef('0x5c')});})[_0xf9ef('0x19')](function(){return _0xb41def;});})['then'](respondWithResult(_0x1c5c56,0xc9))[_0xf9ef('0x4e')](handleError(_0x1c5c56,null));};exports['update']=function(_0x3b3fc2,_0x33cb5e,_0x4b1e66){var _0x82fa80;return db[_0xf9ef('0x50')][_0xf9ef('0x51')](function(_0x32c4b6){return db[_0xf9ef('0x46')][_0xf9ef('0x4d')]({'where':{'id':_0x3b3fc2[_0xf9ef('0x4a')]['id']}})['then'](handleEntityNotFound(_0x33cb5e,null))[_0xf9ef('0x19')](saveUpdates(_0x3b3fc2[_0xf9ef('0x59')],null))['then'](function(_0x521e9d){if(_0x521e9d){_0x82fa80=_0x521e9d;return db[_0xf9ef('0x46')]['findAll']({'where':{'type':_0x82fa80[_0xf9ef('0x5a')]},'raw':!![]});}return null;})['then'](function(_0x1e8c4b){if(_0x1e8c4b){var _0x1c3f6c=fs[_0xf9ef('0x52')](path['join'](config[_0xf9ef('0x5d')],'server/files/templates/network.ejs'),'utf8');var _0x50bcea=ejs[_0xf9ef('0x56')](_0x1c3f6c,{'networks':_0x1e8c4b||[]});fs[_0xf9ef('0x5e')](util[_0xf9ef('0x57')](_0xf9ef('0x58'),_0x82fa80[_0xf9ef('0x5a')][_0xf9ef('0x5f')]()),_0x50bcea);return respondWithRpcPromise(_0xf9ef('0x5b'),_0xf9ef('0x2d'),{'module':_0xf9ef('0x5c')});}return null;})[_0xf9ef('0x19')](function(_0x54d3e4){if(_0x54d3e4){return _0x82fa80;}return null;});})['then'](respondWithResult(_0x33cb5e,null))[_0xf9ef('0x4e')](handleError(_0x33cb5e,null));};exports['destroy']=function(_0x58302b,_0x1c7903,_0x5f2fde){var _0x33f030;return db['Network'][_0xf9ef('0x4d')]({'where':{'id':_0x58302b[_0xf9ef('0x4a')]['id']}})[_0xf9ef('0x19')](function(_0x45b416){_0x33f030=_0x45b416;return _0x45b416;})['then'](handleEntityNotFound(_0x1c7903,null))[_0xf9ef('0x19')](removeEntity(_0x1c7903,null))[_0xf9ef('0x19')](function(){if(_0x33f030){return db['Network'][_0xf9ef('0x47')]({'where':{'type':_0x33f030['type']},'raw':!![]});}})['then'](function(_0x2c6fc4){if(_0x2c6fc4){var _0x40db76=fs['readFileSync'](path['join'](config[_0xf9ef('0x5d')],'server/files/templates/network.ejs'),'utf8');var _0x3e9788=ejs[_0xf9ef('0x56')](_0x40db76,{'networks':_0x2c6fc4||[]});fs[_0xf9ef('0x5e')](util['format'](_0xf9ef('0x58'),_0x33f030[_0xf9ef('0x5a')][_0xf9ef('0x5f')]()),_0x3e9788);return respondWithRpcPromise(_0xf9ef('0x5b'),'destroy',{'module':_0xf9ef('0x5c')});}})[_0xf9ef('0x4e')](handleError(_0x1c7903,null));}; \ No newline at end of file +var _0xae01=['util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','api','../../config/utils','../../mysqldb','jayson/promise','http','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','then','name','send','Network','rawAttributes','model','keys','query','attributes','intersection','fields','length','nolimit','limit','order','sort','filters','filter','merge','where','map','type','key','VIRTUAL','field','options','includeAll','include','params','find','create','sequelize','body','findAll','readFileSync','root','utf8','render','writeFileSync','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','Reload','update','transaction','join','chan_sip.so','destroy','server/files/templates/network.ejs','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x13918d,_0x52f528){var _0x5293e6=function(_0x94b205){while(--_0x94b205){_0x13918d['push'](_0x13918d['shift']());}};_0x5293e6(++_0x52f528);}(_0xae01,0x168));var _0x1ae0=function(_0x27b2f3,_0xdbd46a){_0x27b2f3=_0x27b2f3-0x0;var _0x197b2a=_0xae01[_0x27b2f3];return _0x197b2a;};'use strict';var pdf=require(_0x1ae0('0x0'));var emlformat=require(_0x1ae0('0x1'));var rimraf=require(_0x1ae0('0x2'));var zipdir=require(_0x1ae0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1ae0('0x4'));var moment=require(_0x1ae0('0x5'));var BPromise=require(_0x1ae0('0x6'));var Mustache=require(_0x1ae0('0x7'));var util=require(_0x1ae0('0x8'));var path=require(_0x1ae0('0x9'));var sox=require(_0x1ae0('0xa'));var csv=require(_0x1ae0('0xb'));var ejs=require(_0x1ae0('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1ae0('0xd'));var crypto=require(_0x1ae0('0xe'));var jsforce=require(_0x1ae0('0xf'));var deskjs=require(_0x1ae0('0x10'));var toCsv=require(_0x1ae0('0xb'));var querystring=require(_0x1ae0('0x11'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x1ae0('0x12'));var utils=require(_0x1ae0('0x13'));var config=require('../../config/environment');var db=require(_0x1ae0('0x14'))['db'];var jayson=require(_0x1ae0('0x15'));var client=jayson['client'][_0x1ae0('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x2be417,_0x1960e2,_0x4977e4,_0x36cf68){return new BPromise(function(_0x3229e3,_0x632374){var _0x245677=_0x36cf68||client;return _0x245677['request'](_0x2be417,_0x4977e4)['then'](function(_0x213c4f){logger[_0x1ae0('0x17')](_0x1ae0('0x18'),_0x1960e2,_0x1ae0('0x19'));logger[_0x1ae0('0x1a')](_0x1ae0('0x1b'),_0x1960e2,_0x1ae0('0x19'),JSON[_0x1ae0('0x1c')](_0x213c4f));if(_0x213c4f[_0x1ae0('0x1d')]){if(_0x213c4f[_0x1ae0('0x1d')][_0x1ae0('0x1e')]===0x1f4){logger[_0x1ae0('0x1d')](_0x1ae0('0x18'),_0x1960e2,_0x213c4f[_0x1ae0('0x1d')][_0x1ae0('0x1f')]);return _0x632374(_0x213c4f[_0x1ae0('0x1d')][_0x1ae0('0x1f')]);}logger[_0x1ae0('0x1d')](_0x1ae0('0x18'),_0x1960e2,_0x213c4f[_0x1ae0('0x1d')][_0x1ae0('0x1f')]);return _0x3229e3(_0x213c4f[_0x1ae0('0x1d')][_0x1ae0('0x1f')]);}else{logger[_0x1ae0('0x17')]('Network,\x20%s,\x20%s',_0x1960e2,_0x1ae0('0x19'));_0x3229e3(_0x213c4f[_0x1ae0('0x20')][_0x1ae0('0x1f')]);}})[_0x1ae0('0x21')](function(_0x3ac119){logger[_0x1ae0('0x1d')]('Network,\x20%s,\x20%s',_0x1960e2,_0x3ac119);_0x632374(_0x3ac119);});});}function respondWithStatusCode(_0x404c43,_0x2edea){_0x2edea=_0x2edea||0xcc;return function(_0x1c0a28){if(_0x1c0a28){return _0x404c43[_0x1ae0('0x22')](_0x2edea);}return _0x404c43[_0x1ae0('0x23')](_0x2edea)[_0x1ae0('0x24')]();};}function respondWithResult(_0x3257d1,_0x3c8856){_0x3c8856=_0x3c8856||0xc8;return function(_0x3a5b75){if(_0x3a5b75){return _0x3257d1[_0x1ae0('0x23')](_0x3c8856)[_0x1ae0('0x25')](_0x3a5b75);}};}function respondWithFilteredResult(_0x1488ab,_0x23549e){return function(_0x33a941){if(_0x33a941){var _0x19c7e2=_0x33a941[_0x1ae0('0x26')],_0x3d5824=_0x23549e[_0x1ae0('0x27')],_0xa37fcf=_0x23549e[_0x1ae0('0x27')]+_0x23549e['limit'],_0x19c395;if(_0xa37fcf>=_0x19c7e2){_0xa37fcf=_0x19c7e2;_0x19c395=0xc8;}else{_0x19c395=0xce;}_0x1488ab[_0x1ae0('0x23')](_0x19c395);return _0x1488ab['set'](_0x1ae0('0x28'),_0x3d5824+'-'+_0xa37fcf+'/'+_0x19c7e2)[_0x1ae0('0x25')](_0x33a941);}return null;};}function patchUpdates(_0xb0b714){return function(_0x16de33){try{jsonpatch[_0x1ae0('0x29')](_0x16de33,_0xb0b714,!![]);}catch(_0x273b74){return BPromise[_0x1ae0('0x2a')](_0x273b74);}return _0x16de33['save']();};}function saveUpdates(_0x52bf84,_0xe690f4){return function(_0x40a282){if(_0x40a282){return _0x40a282['update'](_0x52bf84)[_0x1ae0('0x2b')](function(_0x13fe53){return _0x13fe53;});}return null;};}function removeEntity(_0x57437f,_0x21e27e){return function(_0x5424d1){if(_0x5424d1){return _0x5424d1['destroy']()[_0x1ae0('0x2b')](function(){_0x57437f[_0x1ae0('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52c11d,_0x53e93b){return function(_0x14c3b6){if(!_0x14c3b6){_0x52c11d[_0x1ae0('0x22')](0x194);}return _0x14c3b6;};}function handleError(_0x1977fa,_0x500ba5){_0x500ba5=_0x500ba5||0x1f4;return function(_0x97b206){logger[_0x1ae0('0x1d')](_0x97b206['stack']);if(_0x97b206[_0x1ae0('0x2c')]){delete _0x97b206[_0x1ae0('0x2c')];}_0x1977fa[_0x1ae0('0x23')](_0x500ba5)[_0x1ae0('0x2d')](_0x97b206);};}exports['index']=function(_0x5c81fc,_0x7c42cb){var _0x755fe3={},_0x350763={},_0x409881={'count':0x0,'rows':[]};var _0x2be8fb=db[_0x1ae0('0x2e')][_0x1ae0('0x2f')];_0x350763[_0x1ae0('0x30')]=_[_0x1ae0('0x31')](_0x2be8fb);_0x350763[_0x1ae0('0x32')]=_['keys'](_0x5c81fc[_0x1ae0('0x32')]);_0x350763['filters']=_['intersection'](_0x350763['model'],_0x350763[_0x1ae0('0x32')]);_0x755fe3[_0x1ae0('0x33')]=_[_0x1ae0('0x34')](_0x350763['model'],qs[_0x1ae0('0x35')](_0x5c81fc[_0x1ae0('0x32')][_0x1ae0('0x35')]));_0x755fe3[_0x1ae0('0x33')]=_0x755fe3[_0x1ae0('0x33')][_0x1ae0('0x36')]?_0x755fe3[_0x1ae0('0x33')]:_0x350763['model'];if(!_0x5c81fc['query']['hasOwnProperty'](_0x1ae0('0x37'))){_0x755fe3[_0x1ae0('0x38')]=qs[_0x1ae0('0x38')](_0x5c81fc[_0x1ae0('0x32')][_0x1ae0('0x38')]);_0x755fe3[_0x1ae0('0x27')]=qs[_0x1ae0('0x27')](_0x5c81fc[_0x1ae0('0x32')][_0x1ae0('0x27')]);}_0x755fe3[_0x1ae0('0x39')]=qs[_0x1ae0('0x3a')](_0x5c81fc[_0x1ae0('0x32')][_0x1ae0('0x3a')]);_0x755fe3['where']=qs[_0x1ae0('0x3b')](_['pick'](_0x5c81fc['query'],_0x350763[_0x1ae0('0x3b')]));if(_0x5c81fc[_0x1ae0('0x32')][_0x1ae0('0x3c')]){_0x755fe3['where']=_[_0x1ae0('0x3d')](_0x755fe3[_0x1ae0('0x3e')],{'$or':_[_0x1ae0('0x3f')](_0x2be8fb,function(_0x1c2f2a){if(_0x1c2f2a[_0x1ae0('0x40')][_0x1ae0('0x41')]!==_0x1ae0('0x42')){var _0x5228d8={};_0x5228d8[_0x1c2f2a[_0x1ae0('0x43')]]={'$like':'%'+_0x5c81fc['query'][_0x1ae0('0x3c')]+'%'};return _0x5228d8;}})});}_0x755fe3=_['merge']({},_0x755fe3,_0x5c81fc[_0x1ae0('0x44')]);var _0x2339ff={'where':_0x755fe3['where']};return db[_0x1ae0('0x2e')]['count'](_0x2339ff)[_0x1ae0('0x2b')](function(_0x2b3fcb){_0x409881['count']=_0x2b3fcb;if(_0x5c81fc[_0x1ae0('0x32')][_0x1ae0('0x45')]){_0x755fe3[_0x1ae0('0x46')]=[{'all':!![]}];}return db[_0x1ae0('0x2e')]['findAll'](_0x755fe3);})[_0x1ae0('0x2b')](function(_0xdd7d95){_0x409881['rows']=_0xdd7d95;return _0x409881;})[_0x1ae0('0x2b')](respondWithFilteredResult(_0x7c42cb,_0x755fe3))['catch'](handleError(_0x7c42cb,null));};exports['show']=function(_0xcf4f5d,_0x1b1950){var _0x3263d9={'raw':!![],'where':{'id':_0xcf4f5d[_0x1ae0('0x47')]['id']}},_0x595d8d={};_0x595d8d[_0x1ae0('0x30')]=_['keys'](db[_0x1ae0('0x2e')][_0x1ae0('0x2f')]);_0x595d8d[_0x1ae0('0x32')]=_[_0x1ae0('0x31')](_0xcf4f5d[_0x1ae0('0x32')]);_0x595d8d['filters']=_[_0x1ae0('0x34')](_0x595d8d[_0x1ae0('0x30')],_0x595d8d['query']);_0x3263d9['attributes']=_[_0x1ae0('0x34')](_0x595d8d[_0x1ae0('0x30')],qs[_0x1ae0('0x35')](_0xcf4f5d[_0x1ae0('0x32')][_0x1ae0('0x35')]));_0x3263d9[_0x1ae0('0x33')]=_0x3263d9['attributes'][_0x1ae0('0x36')]?_0x3263d9[_0x1ae0('0x33')]:_0x595d8d[_0x1ae0('0x30')];if(_0xcf4f5d[_0x1ae0('0x32')][_0x1ae0('0x45')]){_0x3263d9[_0x1ae0('0x46')]=[{'all':!![]}];}_0x3263d9=_[_0x1ae0('0x3d')]({},_0x3263d9,_0xcf4f5d[_0x1ae0('0x44')]);return db[_0x1ae0('0x2e')][_0x1ae0('0x48')](_0x3263d9)['then'](handleEntityNotFound(_0x1b1950,null))['then'](respondWithResult(_0x1b1950,null))[_0x1ae0('0x21')](handleError(_0x1b1950,null));};exports[_0x1ae0('0x49')]=function(_0x525172,_0x1a57ed,_0x1a08b2){var _0x5beb67;return db[_0x1ae0('0x4a')]['transaction'](function(_0x387275){return db[_0x1ae0('0x2e')][_0x1ae0('0x49')](_0x525172[_0x1ae0('0x4b')],{'raw':!![]})[_0x1ae0('0x2b')](function(_0x152937){_0x5beb67=_0x152937;return db[_0x1ae0('0x2e')][_0x1ae0('0x4c')]({'where':{'type':_0x525172[_0x1ae0('0x4b')]['type']},'raw':!![]});})[_0x1ae0('0x2b')](function(_0xa5c0d5){var _0x303d69=fs[_0x1ae0('0x4d')](path['join'](config[_0x1ae0('0x4e')],'server/files/templates/network.ejs'),_0x1ae0('0x4f'));var _0x2b4fb4=ejs[_0x1ae0('0x50')](_0x303d69,{'networks':_0xa5c0d5||[]});fs[_0x1ae0('0x51')](util[_0x1ae0('0x52')](_0x1ae0('0x53'),_0x525172[_0x1ae0('0x4b')][_0x1ae0('0x40')][_0x1ae0('0x54')]()),_0x2b4fb4);})[_0x1ae0('0x2b')](function(){return respondWithRpcPromise(_0x1ae0('0x55'),_0x1ae0('0x49'),{'module':'chan_sip.so'});})[_0x1ae0('0x2b')](function(){return _0x5beb67;});})[_0x1ae0('0x2b')](respondWithResult(_0x1a57ed,0xc9))[_0x1ae0('0x21')](handleError(_0x1a57ed,null));};exports[_0x1ae0('0x56')]=function(_0x3b56d3,_0x400bbc,_0x4570a6){var _0x173266;return db[_0x1ae0('0x4a')][_0x1ae0('0x57')](function(_0x1a17c8){return db[_0x1ae0('0x2e')][_0x1ae0('0x48')]({'where':{'id':_0x3b56d3[_0x1ae0('0x47')]['id']}})[_0x1ae0('0x2b')](handleEntityNotFound(_0x400bbc,null))['then'](saveUpdates(_0x3b56d3['body'],null))[_0x1ae0('0x2b')](function(_0x10d451){if(_0x10d451){_0x173266=_0x10d451;return db['Network']['findAll']({'where':{'type':_0x173266[_0x1ae0('0x40')]},'raw':!![]});}return null;})['then'](function(_0x17f088){if(_0x17f088){var _0x1d8a54=fs[_0x1ae0('0x4d')](path[_0x1ae0('0x58')](config[_0x1ae0('0x4e')],'server/files/templates/network.ejs'),_0x1ae0('0x4f'));var _0x20293a=ejs[_0x1ae0('0x50')](_0x1d8a54,{'networks':_0x17f088||[]});fs['writeFileSync'](util['format'](_0x1ae0('0x53'),_0x173266[_0x1ae0('0x40')]['toLowerCase']()),_0x20293a);return respondWithRpcPromise(_0x1ae0('0x55'),_0x1ae0('0x56'),{'module':_0x1ae0('0x59')});}return null;})[_0x1ae0('0x2b')](function(_0x433421){if(_0x433421){return _0x173266;}return null;});})[_0x1ae0('0x2b')](respondWithResult(_0x400bbc,null))[_0x1ae0('0x21')](handleError(_0x400bbc,null));};exports[_0x1ae0('0x5a')]=function(_0x4ae63b,_0x38dd2d,_0x2e4cb8){var _0x536876;return db[_0x1ae0('0x2e')][_0x1ae0('0x48')]({'where':{'id':_0x4ae63b[_0x1ae0('0x47')]['id']}})[_0x1ae0('0x2b')](function(_0x1d457c){_0x536876=_0x1d457c;return _0x1d457c;})['then'](handleEntityNotFound(_0x38dd2d,null))[_0x1ae0('0x2b')](removeEntity(_0x38dd2d,null))['then'](function(){if(_0x536876){return db[_0x1ae0('0x2e')][_0x1ae0('0x4c')]({'where':{'type':_0x536876['type']},'raw':!![]});}})[_0x1ae0('0x2b')](function(_0x5ab3fd){if(_0x5ab3fd){var _0xc77f6b=fs[_0x1ae0('0x4d')](path[_0x1ae0('0x58')](config[_0x1ae0('0x4e')],_0x1ae0('0x5b')),_0x1ae0('0x4f'));var _0xc7a508=ejs[_0x1ae0('0x50')](_0xc77f6b,{'networks':_0x5ab3fd||[]});fs[_0x1ae0('0x51')](util[_0x1ae0('0x52')]('/etc/asterisk/sip_xcally_%s.conf',_0x536876['type']['toLowerCase']()),_0xc7a508);return respondWithRpcPromise(_0x1ae0('0x55'),_0x1ae0('0x5a'),{'module':_0x1ae0('0x59')});}})[_0x1ae0('0x21')](handleError(_0x38dd2d,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 7cb9920..d46e7ef 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 _0x4ff1=['exports','network','lodash','../../config/logger','request-promise'];(function(_0x4fe9e2,_0x12e909){var _0x3145cb=function(_0xdcec98){while(--_0xdcec98){_0x4fe9e2['push'](_0x4fe9e2['shift']());}};_0x3145cb(++_0x12e909);}(_0x4ff1,0xd4));var _0x14ff=function(_0x37ba84,_0x449c8c){_0x37ba84=_0x37ba84-0x0;var _0x43dc4f=_0x4ff1[_0x37ba84];return _0x43dc4f;};'use strict';var _=require(_0x14ff('0x0'));var util=require('util');var logger=require(_0x14ff('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x14ff('0x2'));var attributes=require('./network.attributes');module[_0x14ff('0x3')]=function(_0x335d65,_0x157c85){return _0x335d65['define']('Network',attributes,{'tableName':_0x14ff('0x4'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e11=['define','Network','network','lodash','../../config/logger','moment','bluebird','request-promise','./network.attributes','exports'];(function(_0x18cf09,_0x451975){var _0x4104eb=function(_0x478317){while(--_0x478317){_0x18cf09['push'](_0x18cf09['shift']());}};_0x4104eb(++_0x451975);}(_0x3e11,0x67));var _0x13e1=function(_0x5e1306,_0x348e3a){_0x5e1306=_0x5e1306-0x0;var _0x497ea7=_0x3e11[_0x5e1306];return _0x497ea7;};'use strict';var _=require(_0x13e1('0x0'));var util=require('util');var logger=require(_0x13e1('0x1'))('api');var moment=require(_0x13e1('0x2'));var BPromise=require(_0x13e1('0x3'));var rp=require(_0x13e1('0x4'));var attributes=require(_0x13e1('0x5'));module[_0x13e1('0x6')]=function(_0x4229d7,_0x4cf6ef){return _0x4229d7[_0x13e1('0x7')](_0x13e1('0x8'),attributes,{'tableName':_0x13e1('0x9'),'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 172f63f..eff9407 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 _0x1261=['then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x3686d3,_0x487d92){var _0x5175ff=function(_0x4e69b2){while(--_0x4e69b2){_0x3686d3['push'](_0x3686d3['shift']());}};_0x5175ff(++_0x487d92);}(_0x1261,0x144));var _0x1126=function(_0x2f00dd,_0xd659bd){_0x2f00dd=_0x2f00dd-0x0;var _0x1bfa6c=_0x1261[_0x2f00dd];return _0x1bfa6c;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('Network,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0xf006=['code','message','result','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x39763e,_0x405c34){var _0x54ba35=function(_0x9946a6){while(--_0x9946a6){_0x39763e['push'](_0x39763e['shift']());}};_0x54ba35(++_0x405c34);}(_0xf006,0x146));var _0x6f00=function(_0x44c9f3,_0x37eb68){_0x44c9f3=_0x44c9f3-0x0;var _0x29585d=_0xf006[_0x44c9f3];return _0x29585d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6f00('0x0'));var BPromise=require(_0x6f00('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f00('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f00('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x6f00('0x4'));var jayson=require(_0x6f00('0x5'));var client=jayson[_0x6f00('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c29ff,_0x4f918f,_0x3875fb){return new BPromise(function(_0x3001b1,_0x185728){return client[_0x6f00('0x7')](_0x3c29ff,_0x3875fb)[_0x6f00('0x8')](function(_0x3001c6){logger[_0x6f00('0x9')](_0x6f00('0xa'),_0x4f918f,_0x6f00('0xb'));logger[_0x6f00('0xc')](_0x6f00('0xd'),_0x4f918f,_0x6f00('0xb'),JSON[_0x6f00('0xe')](_0x3001c6));if(_0x3001c6['error']){if(_0x3001c6[_0x6f00('0xf')][_0x6f00('0x10')]===0x1f4){logger[_0x6f00('0xf')](_0x6f00('0xa'),_0x4f918f,_0x3001c6[_0x6f00('0xf')]['message']);return _0x185728(_0x3001c6[_0x6f00('0xf')]['message']);}logger[_0x6f00('0xf')]('Network,\x20%s,\x20%s',_0x4f918f,_0x3001c6[_0x6f00('0xf')][_0x6f00('0x11')]);return _0x3001b1(_0x3001c6[_0x6f00('0xf')][_0x6f00('0x11')]);}else{logger[_0x6f00('0x9')](_0x6f00('0xa'),_0x4f918f,_0x6f00('0xb'));_0x3001b1(_0x3001c6[_0x6f00('0x12')][_0x6f00('0x11')]);}})['catch'](function(_0x14b15d){logger['error']('Network,\x20%s,\x20%s',_0x4f918f,_0x14b15d);_0x185728(_0x14b15d);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index f1ab324..8d2c618 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 _0x488d=['getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','addDisposition','post','/:id/notify','notify','addAgents','send','update','delete','destroy','removeAnswers','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications'];(function(_0x1ea986,_0x582b8c){var _0x57cdab=function(_0x357af9){while(--_0x357af9){_0x1ea986['push'](_0x1ea986['shift']());}};_0x57cdab(++_0x582b8c);}(_0x488d,0x7d));var _0xd488=function(_0x3bfe0e,_0x19637a){_0x3bfe0e=_0x3bfe0e-0x0;var _0x4ae698=_0x488d[_0x3bfe0e];return _0x4ae698;};'use strict';var multer=require(_0xd488('0x0'));var util=require(_0xd488('0x1'));var path=require(_0xd488('0x2'));var timeout=require('connect-timeout');var express=require(_0xd488('0x3'));var router=express['Router']();var auth=require(_0xd488('0x4'));var interaction=require(_0xd488('0x5'));var config=require(_0xd488('0x6'));var controller=require(_0xd488('0x7'));router[_0xd488('0x8')]('/',auth['isAuthenticated'](),controller[_0xd488('0x9')]);router[_0xd488('0x8')](_0xd488('0xa'),auth[_0xd488('0xb')](),controller['describe']);router[_0xd488('0x8')](_0xd488('0xc'),auth[_0xd488('0xb')](),controller[_0xd488('0xd')]);router[_0xd488('0x8')](_0xd488('0xe'),auth['isAuthenticated'](),controller[_0xd488('0xf')]);router[_0xd488('0x8')](_0xd488('0x10'),auth[_0xd488('0xb')](),controller[_0xd488('0x11')]);router['get'](_0xd488('0x12'),auth[_0xd488('0xb')](),controller[_0xd488('0x13')]);router[_0xd488('0x8')](_0xd488('0x14'),auth[_0xd488('0xb')](),controller[_0xd488('0x15')]);router[_0xd488('0x8')](_0xd488('0x16'),auth['isAuthenticated'](),controller[_0xd488('0x17')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd488('0x18')]);router['post'](_0xd488('0xe'),auth[_0xd488('0xb')](),controller[_0xd488('0x19')]);router[_0xd488('0x1a')](_0xd488('0x10'),auth[_0xd488('0xb')](),controller['addAnswer']);router[_0xd488('0x1a')](_0xd488('0x1b'),controller[_0xd488('0x1c')]);router[_0xd488('0x1a')]('/:id/applications',auth[_0xd488('0xb')](),controller['addApplications']);router[_0xd488('0x1a')](_0xd488('0x16'),auth[_0xd488('0xb')](),controller[_0xd488('0x1d')]);router['post']('/:id/send',auth[_0xd488('0xb')](),controller[_0xd488('0x1e')]);router['put'](_0xd488('0xc'),auth[_0xd488('0xb')](),controller[_0xd488('0x1f')]);router[_0xd488('0x20')](_0xd488('0xc'),auth[_0xd488('0xb')](),controller[_0xd488('0x21')]);router[_0xd488('0x20')](_0xd488('0xe'),auth[_0xd488('0xb')](),controller['removeDispositions']);router[_0xd488('0x20')](_0xd488('0x10'),auth[_0xd488('0xb')](),controller[_0xd488('0x22')]);router[_0xd488('0x20')](_0xd488('0x16'),auth[_0xd488('0xb')](),controller['removeAgents']);module[_0xd488('0x23')]=router; \ No newline at end of file +var _0x2371=['/:id/dispositions','getDispositions','getAnswers','getApplications','getInteractions','/:id/users','post','/:id/canned_answers','addAnswer','/:id/notify','notify','/:id/applications','addApplications','/:id/send','delete','destroy','removeDispositions','removeAgents','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','/:id','show'];(function(_0x1a17ea,_0x72daae){var _0x5ea2d3=function(_0x57ffe6){while(--_0x57ffe6){_0x1a17ea['push'](_0x1a17ea['shift']());}};_0x5ea2d3(++_0x72daae);}(_0x2371,0x1b7));var _0x1237=function(_0x241424,_0x25eb5d){_0x241424=_0x241424-0x0;var _0x3da798=_0x2371[_0x241424];return _0x3da798;};'use strict';var multer=require('multer');var util=require(_0x1237('0x0'));var path=require(_0x1237('0x1'));var timeout=require(_0x1237('0x2'));var express=require(_0x1237('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1237('0x4'));var config=require(_0x1237('0x5'));var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0x1237('0x6')](),controller['index']);router[_0x1237('0x7')]('/describe',auth[_0x1237('0x6')](),controller[_0x1237('0x8')]);router[_0x1237('0x7')](_0x1237('0x9'),auth[_0x1237('0x6')](),controller[_0x1237('0xa')]);router[_0x1237('0x7')](_0x1237('0xb'),auth[_0x1237('0x6')](),controller[_0x1237('0xc')]);router[_0x1237('0x7')]('/:id/canned_answers',auth[_0x1237('0x6')](),controller[_0x1237('0xd')]);router[_0x1237('0x7')]('/:id/applications',auth[_0x1237('0x6')](),controller[_0x1237('0xe')]);router[_0x1237('0x7')]('/:id/interactions',auth[_0x1237('0x6')](),controller[_0x1237('0xf')]);router[_0x1237('0x7')](_0x1237('0x10'),auth[_0x1237('0x6')](),controller['getAgents']);router['post']('/',auth[_0x1237('0x6')](),controller['create']);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0x1237('0x11')](_0x1237('0x12'),auth['isAuthenticated'](),controller[_0x1237('0x13')]);router[_0x1237('0x11')](_0x1237('0x14'),controller[_0x1237('0x15')]);router['post'](_0x1237('0x16'),auth['isAuthenticated'](),controller[_0x1237('0x17')]);router[_0x1237('0x11')](_0x1237('0x10'),auth['isAuthenticated'](),controller['addAgents']);router[_0x1237('0x11')](_0x1237('0x18'),auth[_0x1237('0x6')](),controller['send']);router['put'](_0x1237('0x9'),auth[_0x1237('0x6')](),controller['update']);router[_0x1237('0x19')](_0x1237('0x9'),auth[_0x1237('0x6')](),controller[_0x1237('0x1a')]);router[_0x1237('0x19')](_0x1237('0xb'),auth[_0x1237('0x6')](),controller[_0x1237('0x1b')]);router[_0x1237('0x19')](_0x1237('0x12'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x1237('0x19')](_0x1237('0x10'),auth[_0x1237('0x6')](),controller[_0x1237('0x1c')]);module[_0x1237('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 862ece9..d4b4e62 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 _0x81ef=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','exports','STRING','name','generate','TEXT','BOOLEAN'];(function(_0x217737,_0x4d1d6c){var _0xab45ac=function(_0x2416ca){while(--_0x2416ca){_0x217737['push'](_0x217737['shift']());}};_0xab45ac(++_0x4d1d6c);}(_0x81ef,0xea));var _0xf81e=function(_0x31f8ea,_0x3d282f){_0x31f8ea=_0x31f8ea-0x0;var _0x519a4a=_0x81ef[_0x31f8ea];return _0x519a4a;};'use strict';var Sequelize=require(_0xf81e('0x0'));var rs=require(_0xf81e('0x1'));module[_0xf81e('0x2')]={'name':{'type':Sequelize[_0xf81e('0x3')],'unique':_0xf81e('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xf81e('0x3')]},'token':{'type':Sequelize[_0xf81e('0x3')],'defaultValue':function(){return rs[_0xf81e('0x5')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xf81e('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf81e('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xf81e('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf81e('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf81e('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xf81e('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf81e('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf81e('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf81e('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf81e('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xf81e('0x7')],'defaultValue':![],'comment':_0xf81e('0x9'),'set':function(_0x1babb3){if(!_0x1babb3)this[_0xf81e('0xa')]('mandatoryDispositionPauseId',null);this[_0xf81e('0xa')]('mandatoryDisposition',_0x1babb3);}}}; \ No newline at end of file +var _0x6c50=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c50,0x19a));var _0x06c5=function(_0x552a49,_0xe08e6e){_0x552a49=_0x552a49-0x0;var _0x5f0692=_0x6c50[_0x552a49];return _0x5f0692;};'use strict';var Sequelize=require(_0x06c5('0x0'));var rs=require(_0x06c5('0x1'));module[_0x06c5('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x06c5('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x06c5('0x4')],'defaultValue':function(){return rs[_0x06c5('0x5')]();}},'replyUri':{'type':Sequelize[_0x06c5('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x06c5('0x6')],'defaultValue':function(){return _0x06c5('0x7');}},'notificationSound':{'type':Sequelize[_0x06c5('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x06c5('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x06c5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x06c5('0x4')]},'queueTransfer':{'type':Sequelize[_0x06c5('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x06c5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x06c5('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x06c5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x06c5('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0x06c5('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x06c5('0x8')],'defaultValue':![],'comment':_0x06c5('0xb'),'set':function(_0x17ec3a){if(!_0x17ec3a)this[_0x06c5('0xc')](_0x06c5('0xd'),null);this['setDataValue'](_0x06c5('0xe'),_0x17ec3a);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 83474f3..3892c5d 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 _0x8b7c=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addDisposition','OpnechannelAccountId','Disposition','getDispositions','findOne','order','OpenchannelAccountId','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','notify','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','List','Contacts','DESC','OpenchannelApplication','account','applications','Applications','orderBy','asc','from','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','AttachmentId','UserId','User','unshift','agent','*,*,*,*','Start','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','OpenchannelMessage','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','./openchannelAccount.socket','register','jayson/promise','http','client','request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','show','merge','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','find'];(function(_0x506a86,_0x41e1c9){var _0x5e1960=function(_0xbc7559){while(--_0xbc7559){_0x506a86['push'](_0x506a86['shift']());}};_0x5e1960(++_0x41e1c9);}(_0x8b7c,0x119));var _0xc8b7=function(_0x33c797,_0x430c30){_0x33c797=_0x33c797-0x0;var _0x514ff7=_0x8b7c[_0x33c797];return _0x514ff7;};'use strict';var pdf=require(_0xc8b7('0x0'));var emlformat=require(_0xc8b7('0x1'));var rimraf=require(_0xc8b7('0x2'));var zipdir=require(_0xc8b7('0x3'));var jsonpatch=require(_0xc8b7('0x4'));var rp=require(_0xc8b7('0x5'));var moment=require(_0xc8b7('0x6'));var BPromise=require(_0xc8b7('0x7'));var Mustache=require('mustache');var util=require(_0xc8b7('0x8'));var path=require(_0xc8b7('0x9'));var sox=require(_0xc8b7('0xa'));var csv=require('to-csv');var ejs=require(_0xc8b7('0xb'));var fs=require('fs');var _=require(_0xc8b7('0xc'));var squel=require(_0xc8b7('0xd'));var crypto=require(_0xc8b7('0xe'));var jsforce=require(_0xc8b7('0xf'));var deskjs=require(_0xc8b7('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc8b7('0x11'));var Papa=require('papaparse');var authService=require(_0xc8b7('0x12'));var hardwareService=require(_0xc8b7('0x13'));var Redis=require(_0xc8b7('0x14'));var qs=require(_0xc8b7('0x15'));var logger=require(_0xc8b7('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xc8b7('0x17'))['db'];config[_0xc8b7('0x18')]=_[_0xc8b7('0x19')](config[_0xc8b7('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc8b7('0x1a'))[_0xc8b7('0x1b')](socket);var jayson=require(_0xc8b7('0x1c'));var client=jayson['client'][_0xc8b7('0x1d')]({'port':0x232c});var client9002=jayson[_0xc8b7('0x1e')][_0xc8b7('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1b7dc0,_0x3d189e,_0x5d412e,_0xb53183){return new BPromise(function(_0x26d70a,_0x2ee1b5){var _0x3323de=_0xb53183||client;return _0x3323de[_0xc8b7('0x1f')](_0x1b7dc0,_0x5d412e)[_0xc8b7('0x20')](function(_0x1b2b93){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x3d189e,_0xc8b7('0x21'));logger[_0xc8b7('0x22')](_0xc8b7('0x23'),_0x3d189e,'request\x20sent',JSON['stringify'](_0x1b2b93));if(_0x1b2b93[_0xc8b7('0x24')]){if(_0x1b2b93['error'][_0xc8b7('0x25')]===0x1f4){logger['error'](_0xc8b7('0x26'),_0x3d189e,_0x1b2b93[_0xc8b7('0x24')]['message']);return _0x2ee1b5(_0x1b2b93[_0xc8b7('0x24')]['message']);}logger[_0xc8b7('0x24')](_0xc8b7('0x26'),_0x3d189e,_0x1b2b93[_0xc8b7('0x24')]['message']);return _0x26d70a(_0x1b2b93[_0xc8b7('0x24')][_0xc8b7('0x27')]);}else{logger[_0xc8b7('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x3d189e,_0xc8b7('0x21'));_0x26d70a(_0x1b2b93[_0xc8b7('0x29')][_0xc8b7('0x27')]);}})[_0xc8b7('0x2a')](function(_0x2335cc){logger[_0xc8b7('0x24')](_0xc8b7('0x26'),_0x3d189e,_0x2335cc);_0x2ee1b5(_0x2335cc);});});}function respondWithStatusCode(_0x1c119f,_0x11f863){_0x11f863=_0x11f863||0xcc;return function(_0x5d5db8){if(_0x5d5db8){return _0x1c119f[_0xc8b7('0x2b')](_0x11f863);}return _0x1c119f['status'](_0x11f863)[_0xc8b7('0x2c')]();};}function respondWithResult(_0x387d44,_0x3a9ce2){_0x3a9ce2=_0x3a9ce2||0xc8;return function(_0x3f92bd){if(_0x3f92bd){return _0x387d44[_0xc8b7('0x2d')](_0x3a9ce2)[_0xc8b7('0x2e')](_0x3f92bd);}};}function respondWithFilteredResult(_0x5629ce,_0x48682b){return function(_0x16cc83){if(_0x16cc83){var _0x13ac30=_0x16cc83[_0xc8b7('0x2f')],_0x1eff90=_0x48682b[_0xc8b7('0x30')],_0x2a2b25=_0x48682b['offset']+_0x48682b[_0xc8b7('0x31')],_0x24b0b1;if(_0x2a2b25>=_0x13ac30){_0x2a2b25=_0x13ac30;_0x24b0b1=0xc8;}else{_0x24b0b1=0xce;}_0x5629ce[_0xc8b7('0x2d')](_0x24b0b1);return _0x5629ce[_0xc8b7('0x32')](_0xc8b7('0x33'),_0x1eff90+'-'+_0x2a2b25+'/'+_0x13ac30)[_0xc8b7('0x2e')](_0x16cc83);}return null;};}function patchUpdates(_0x340af1){return function(_0x36f421){try{jsonpatch[_0xc8b7('0x34')](_0x36f421,_0x340af1,!![]);}catch(_0x4fe3e4){return BPromise[_0xc8b7('0x35')](_0x4fe3e4);}return _0x36f421[_0xc8b7('0x36')]();};}function saveUpdates(_0x982b0b,_0x2971fc){return function(_0x2d6e6b){if(_0x2d6e6b){return _0x2d6e6b[_0xc8b7('0x37')](_0x982b0b)[_0xc8b7('0x20')](function(_0x34c7d6){return _0x34c7d6;});}return null;};}function removeEntity(_0x3f233e,_0x37b57f){return function(_0x3abd81){if(_0x3abd81){return _0x3abd81[_0xc8b7('0x38')]()[_0xc8b7('0x20')](function(){var _0x4a327d=_0x3abd81['get']({'plain':!![]});var _0x174c3a='OpenchannelAccounts';return db[_0xc8b7('0x39')][_0xc8b7('0x38')]({'where':{'type':_0x174c3a,'resourceId':_0x4a327d['id']}})[_0xc8b7('0x20')](function(){return _0x3abd81;});})[_0xc8b7('0x20')](function(){_0x3f233e[_0xc8b7('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf22f67,_0x5c45ca){return function(_0x334543){if(!_0x334543){_0xf22f67[_0xc8b7('0x2b')](0x194);}return _0x334543;};}function handleError(_0x8e18e3,_0x28b134){_0x28b134=_0x28b134||0x1f4;return function(_0x3706db){logger[_0xc8b7('0x24')](_0x3706db[_0xc8b7('0x3a')]);if(_0x3706db[_0xc8b7('0x3b')]){delete _0x3706db[_0xc8b7('0x3b')];}_0x8e18e3[_0xc8b7('0x2d')](_0x28b134)[_0xc8b7('0x3c')](_0x3706db);};}exports[_0xc8b7('0x3d')]=function(_0x1bc40e,_0x2c803f){var _0x176208={'include':[{'model':db[_0xc8b7('0x3e')],'as':_0xc8b7('0x3f')}]},_0x2e5ea1={},_0x5e2e3e={'count':0x0,'rows':[]};var _0xbdc679=db[_0xc8b7('0x40')][_0xc8b7('0x41')];_0x2e5ea1[_0xc8b7('0x42')]=_['keys'](_0xbdc679);_0x2e5ea1[_0xc8b7('0x43')]=_[_0xc8b7('0x44')](_0x1bc40e[_0xc8b7('0x43')]);_0x2e5ea1[_0xc8b7('0x45')]=_['intersection'](_0x2e5ea1['model'],_0x2e5ea1[_0xc8b7('0x43')]);_0x176208[_0xc8b7('0x46')]=_[_0xc8b7('0x47')](_0x2e5ea1['model'],qs['fields'](_0x1bc40e[_0xc8b7('0x43')][_0xc8b7('0x48')]));_0x176208[_0xc8b7('0x46')]=_0x176208[_0xc8b7('0x46')][_0xc8b7('0x49')]?_0x176208[_0xc8b7('0x46')]:_0x2e5ea1[_0xc8b7('0x42')];if(!_0x1bc40e[_0xc8b7('0x43')][_0xc8b7('0x4a')](_0xc8b7('0x4b'))){_0x176208[_0xc8b7('0x31')]=qs['limit'](_0x1bc40e[_0xc8b7('0x43')][_0xc8b7('0x31')]);_0x176208['offset']=qs['offset'](_0x1bc40e[_0xc8b7('0x43')][_0xc8b7('0x30')]);}_0x176208['order']=qs[_0xc8b7('0x4c')](_0x1bc40e[_0xc8b7('0x43')][_0xc8b7('0x4c')]);_0x176208[_0xc8b7('0x4d')]=qs[_0xc8b7('0x45')](_[_0xc8b7('0x4e')](_0x1bc40e[_0xc8b7('0x43')],_0x2e5ea1[_0xc8b7('0x45')]));if(_0x1bc40e[_0xc8b7('0x43')][_0xc8b7('0x4f')]){_0x176208[_0xc8b7('0x4d')]=_['merge'](_0x176208['where'],{'$or':_[_0xc8b7('0x50')](_0xbdc679,function(_0x58eace){if(_0x58eace[_0xc8b7('0x51')][_0xc8b7('0x52')]!==_0xc8b7('0x53')){var _0x3a15be={};_0x3a15be[_0x58eace[_0xc8b7('0x54')]]={'$like':'%'+_0x1bc40e[_0xc8b7('0x43')][_0xc8b7('0x4f')]+'%'};return _0x3a15be;}})});}_0x176208=_['merge']({},_0x176208,_0x1bc40e[_0xc8b7('0x55')]);var _0x228e8d={'where':_0x176208[_0xc8b7('0x4d')]};return db[_0xc8b7('0x40')][_0xc8b7('0x2f')](_0x228e8d)[_0xc8b7('0x20')](function(_0x32d826){_0x5e2e3e[_0xc8b7('0x2f')]=_0x32d826;if(_0x1bc40e[_0xc8b7('0x43')][_0xc8b7('0x56')]){_0x176208[_0xc8b7('0x57')]=[{'all':!![]}];}return db[_0xc8b7('0x40')][_0xc8b7('0x58')](_0x176208);})[_0xc8b7('0x20')](function(_0x493681){_0x5e2e3e[_0xc8b7('0x59')]=_0x493681;return _0x5e2e3e;})[_0xc8b7('0x20')](respondWithFilteredResult(_0x2c803f,_0x176208))[_0xc8b7('0x2a')](handleError(_0x2c803f,null));};exports[_0xc8b7('0x5a')]=function(_0x42e68a,_0x4aa959){var _0xe38e6={'raw':![],'where':{'id':_0x42e68a['params']['id']},'include':[{'model':db[_0xc8b7('0x3e')],'as':_0xc8b7('0x3f')}]},_0x13c29d={};_0x13c29d[_0xc8b7('0x42')]=_[_0xc8b7('0x44')](db[_0xc8b7('0x40')][_0xc8b7('0x41')]);_0x13c29d['query']=_[_0xc8b7('0x44')](_0x42e68a[_0xc8b7('0x43')]);_0x13c29d['filters']=_[_0xc8b7('0x47')](_0x13c29d[_0xc8b7('0x42')],_0x13c29d['query']);_0xe38e6['attributes']=_[_0xc8b7('0x47')](_0x13c29d['model'],qs['fields'](_0x42e68a[_0xc8b7('0x43')][_0xc8b7('0x48')]));_0xe38e6[_0xc8b7('0x46')]=_0xe38e6[_0xc8b7('0x46')]['length']?_0xe38e6[_0xc8b7('0x46')]:_0x13c29d[_0xc8b7('0x42')];if(_0x42e68a[_0xc8b7('0x43')][_0xc8b7('0x56')]){_0xe38e6['include']=[{'all':!![]}];}_0xe38e6=_[_0xc8b7('0x5b')]({},_0xe38e6,_0x42e68a[_0xc8b7('0x55')]);return db[_0xc8b7('0x40')]['find'](_0xe38e6)[_0xc8b7('0x20')](handleEntityNotFound(_0x4aa959,null))[_0xc8b7('0x20')](respondWithResult(_0x4aa959,null))['catch'](handleError(_0x4aa959,null));};exports[_0xc8b7('0x5c')]=function(_0xa708dc,_0x511f3f){return db[_0xc8b7('0x40')][_0xc8b7('0x5c')](_0xa708dc[_0xc8b7('0x5d')],{})[_0xc8b7('0x20')](function(_0x4d3ebd){var _0x5d844e=_0xa708dc[_0xc8b7('0x5e')][_0xc8b7('0x5f')]({'plain':!![]});if(!_0x5d844e)throw new Error(_0xc8b7('0x60'));if(_0x5d844e[_0xc8b7('0x61')]===_0xc8b7('0x5e')){var _0x21e655=_0x4d3ebd[_0xc8b7('0x5f')]({'plain':!![]});var _0x333cea=_0xc8b7('0x62');return db[_0xc8b7('0x63')][_0xc8b7('0x64')]({'where':{'name':_0x333cea,'userProfileId':_0x5d844e[_0xc8b7('0x65')]},'raw':!![]})['then'](function(_0x5e1a2d){if(_0x5e1a2d&&_0x5e1a2d[_0xc8b7('0x66')]===0x0){return db[_0xc8b7('0x39')][_0xc8b7('0x5c')]({'name':_0x21e655[_0xc8b7('0x3b')],'resourceId':_0x21e655['id'],'type':_0x5e1a2d['name'],'sectionId':_0x5e1a2d['id']},{})['then'](function(){return _0x4d3ebd;});}else{return _0x4d3ebd;}})[_0xc8b7('0x2a')](function(_0x34e24c){logger[_0xc8b7('0x24')](_0xc8b7('0x67'),_0x34e24c);throw _0x34e24c;});}return _0x4d3ebd;})[_0xc8b7('0x20')](respondWithResult(_0x511f3f,0xc9))['catch'](handleError(_0x511f3f,null));};exports[_0xc8b7('0x37')]=function(_0x2f1c5a,_0x23510c){if(_0x2f1c5a[_0xc8b7('0x5d')]['id']){delete _0x2f1c5a[_0xc8b7('0x5d')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x2f1c5a['params']['id']},'include':[{'model':db['Pause'],'as':_0xc8b7('0x3f')}]})['then'](handleEntityNotFound(_0x23510c,null))['then'](saveUpdates(_0x2f1c5a[_0xc8b7('0x5d')],null))['then'](respondWithResult(_0x23510c,null))['catch'](handleError(_0x23510c,null));};exports[_0xc8b7('0x38')]=function(_0x1b523c,_0x1db5c0){return db[_0xc8b7('0x40')][_0xc8b7('0x64')]({'where':{'id':_0x1b523c[_0xc8b7('0x68')]['id']}})['then'](handleEntityNotFound(_0x1db5c0,null))[_0xc8b7('0x20')](removeEntity(_0x1db5c0,null))['catch'](handleError(_0x1db5c0,null));};exports['describe']=function(_0x10813b,_0x21b28a){return db['OpenchannelAccount']['describe']()[_0xc8b7('0x20')](respondWithResult(_0x21b28a,null))['catch'](handleError(_0x21b28a,null));};exports[_0xc8b7('0x69')]=function(_0x348f50,_0x289a0b,_0x1808d9){if(_0x348f50['body']['id']){delete _0x348f50['body']['id'];}return db[_0xc8b7('0x40')]['find']({'where':{'id':_0x348f50[_0xc8b7('0x68')]['id']}})['then'](handleEntityNotFound(_0x289a0b,null))['then'](function(_0x10a3ff){if(_0x10a3ff){_0x348f50[_0xc8b7('0x5d')][_0xc8b7('0x6a')]=_0x10a3ff['id'];return db[_0xc8b7('0x6b')][_0xc8b7('0x5c')](_0x348f50[_0xc8b7('0x5d')]);}})[_0xc8b7('0x20')](respondWithResult(_0x289a0b,null))['catch'](handleError(_0x289a0b,null));};exports[_0xc8b7('0x6c')]=function(_0x400a29,_0x13aab4,_0xecfc3c){var _0x2cf21c={'raw':![],'where':{}};var _0x15539f={};var _0x49b7d5={'count':0x0,'rows':[]};return db[_0xc8b7('0x40')][_0xc8b7('0x6d')]({'where':{'id':_0x400a29[_0xc8b7('0x68')]['id']}})['then'](handleEntityNotFound(_0x13aab4,null))[_0xc8b7('0x20')](function(_0x31e61a){if(_0x31e61a){_0x15539f['model']=_[_0xc8b7('0x44')](db[_0xc8b7('0x6b')][_0xc8b7('0x41')]);_0x15539f[_0xc8b7('0x43')]=_['keys'](_0x400a29[_0xc8b7('0x43')]);_0x15539f[_0xc8b7('0x45')]=_[_0xc8b7('0x47')](_0x15539f[_0xc8b7('0x42')],_0x15539f[_0xc8b7('0x43')]);_0x2cf21c[_0xc8b7('0x46')]=_[_0xc8b7('0x47')](_0x15539f[_0xc8b7('0x42')],qs[_0xc8b7('0x48')](_0x400a29[_0xc8b7('0x43')][_0xc8b7('0x48')]));_0x2cf21c[_0xc8b7('0x46')]=_0x2cf21c[_0xc8b7('0x46')]['length']?_0x2cf21c[_0xc8b7('0x46')]:_0x15539f[_0xc8b7('0x42')];if(!_0x400a29[_0xc8b7('0x43')][_0xc8b7('0x4a')](_0xc8b7('0x4b'))){_0x2cf21c['limit']=qs['limit'](_0x400a29[_0xc8b7('0x43')][_0xc8b7('0x31')]);_0x2cf21c[_0xc8b7('0x30')]=qs['offset'](_0x400a29[_0xc8b7('0x43')]['offset']);}_0x2cf21c[_0xc8b7('0x6e')]=qs['sort'](_0x400a29[_0xc8b7('0x43')][_0xc8b7('0x4c')]);_0x2cf21c[_0xc8b7('0x4d')]=qs['filters'](_[_0xc8b7('0x4e')](_0x400a29[_0xc8b7('0x43')],_0x15539f[_0xc8b7('0x45')]));_0x2cf21c[_0xc8b7('0x4d')][_0xc8b7('0x6f')]=_0x31e61a['id'];if(_0x400a29[_0xc8b7('0x43')][_0xc8b7('0x4f')]){_0x2cf21c['where']=_[_0xc8b7('0x5b')](_0x2cf21c[_0xc8b7('0x4d')],{'$or':_[_0xc8b7('0x50')](_0x2cf21c['attributes'],function(_0x4acac3){var _0x4a61ac={};_0x4a61ac[_0x4acac3]={'$like':'%'+_0x400a29[_0xc8b7('0x43')][_0xc8b7('0x4f')]+'%'};return _0x4a61ac;})});}_0x2cf21c=_[_0xc8b7('0x5b')]({},_0x2cf21c,_0x400a29['options']);return db[_0xc8b7('0x6b')]['count']({'where':_0x2cf21c[_0xc8b7('0x4d')]})[_0xc8b7('0x20')](function(_0x53e5ea){_0x49b7d5[_0xc8b7('0x2f')]=_0x53e5ea;if(_0x400a29[_0xc8b7('0x43')][_0xc8b7('0x56')]){_0x2cf21c[_0xc8b7('0x57')]=[{'all':!![]}];}return db['Disposition'][_0xc8b7('0x58')](_0x2cf21c);})[_0xc8b7('0x20')](function(_0x13d34a){_0x49b7d5['rows']=_0x13d34a;return _0x49b7d5;});}})[_0xc8b7('0x20')](respondWithFilteredResult(_0x13aab4,_0x2cf21c))[_0xc8b7('0x2a')](handleError(_0x13aab4,null));};exports[_0xc8b7('0x70')]=function(_0x501b18,_0x2166e8,_0x23064b){var _0x541742;return db[_0xc8b7('0x40')]['find']({'where':{'id':_0x501b18[_0xc8b7('0x68')]['id']}})['then'](handleEntityNotFound(_0x2166e8,null))[_0xc8b7('0x20')](function(_0x5e2563){if(_0x5e2563){return _0x5e2563['removeDispositions'](_0x501b18[_0xc8b7('0x43')][_0xc8b7('0x71')]);}})[_0xc8b7('0x20')](respondWithStatusCode(_0x2166e8,null))[_0xc8b7('0x2a')](handleError(_0x2166e8,null));};exports['addAnswer']=function(_0x11dad2,_0x2415e2,_0x3e4abf){if(_0x11dad2[_0xc8b7('0x5d')]['id']){delete _0x11dad2[_0xc8b7('0x5d')]['id'];}return db['OpenchannelAccount'][_0xc8b7('0x64')]({'where':{'id':_0x11dad2[_0xc8b7('0x68')]['id']}})['then'](handleEntityNotFound(_0x2415e2,null))[_0xc8b7('0x20')](function(_0x55a6cd){if(_0x55a6cd){_0x11dad2[_0xc8b7('0x5d')][_0xc8b7('0x6f')]=_0x55a6cd['id'];return db['CannedAnswer'][_0xc8b7('0x5c')](_0x11dad2['body']);}})['then'](respondWithResult(_0x2415e2,null))[_0xc8b7('0x2a')](handleError(_0x2415e2,null));};exports[_0xc8b7('0x72')]=function(_0xf01024,_0x104874,_0x4a5627){var _0x229595={'raw':![],'where':{}};var _0x31789e={};var _0x167d93={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xc8b7('0x6d')]({'where':{'id':_0xf01024[_0xc8b7('0x68')]['id']}})['then'](handleEntityNotFound(_0x104874,null))[_0xc8b7('0x20')](function(_0x1ee2ed){if(_0x1ee2ed){_0x31789e[_0xc8b7('0x42')]=_['keys'](db['CannedAnswer'][_0xc8b7('0x41')]);_0x31789e[_0xc8b7('0x43')]=_[_0xc8b7('0x44')](_0xf01024[_0xc8b7('0x43')]);_0x31789e['filters']=_[_0xc8b7('0x47')](_0x31789e['model'],_0x31789e[_0xc8b7('0x43')]);_0x229595[_0xc8b7('0x46')]=_['intersection'](_0x31789e[_0xc8b7('0x42')],qs[_0xc8b7('0x48')](_0xf01024[_0xc8b7('0x43')][_0xc8b7('0x48')]));_0x229595[_0xc8b7('0x46')]=_0x229595[_0xc8b7('0x46')][_0xc8b7('0x49')]?_0x229595[_0xc8b7('0x46')]:_0x31789e[_0xc8b7('0x42')];if(!_0xf01024[_0xc8b7('0x43')][_0xc8b7('0x4a')](_0xc8b7('0x4b'))){_0x229595['limit']=qs[_0xc8b7('0x31')](_0xf01024[_0xc8b7('0x43')][_0xc8b7('0x31')]);_0x229595['offset']=qs[_0xc8b7('0x30')](_0xf01024['query']['offset']);}_0x229595[_0xc8b7('0x6e')]=qs[_0xc8b7('0x4c')](_0xf01024['query'][_0xc8b7('0x4c')]);_0x229595['where']=qs[_0xc8b7('0x45')](_['pick'](_0xf01024[_0xc8b7('0x43')],_0x31789e[_0xc8b7('0x45')]));_0x229595[_0xc8b7('0x4d')][_0xc8b7('0x6f')]=_0x1ee2ed['id'];if(_0xf01024['query'][_0xc8b7('0x4f')]){_0x229595[_0xc8b7('0x4d')]=_[_0xc8b7('0x5b')](_0x229595[_0xc8b7('0x4d')],{'$or':_[_0xc8b7('0x50')](_0x229595[_0xc8b7('0x46')],function(_0x54c887){var _0x3cf9d8={};_0x3cf9d8[_0x54c887]={'$like':'%'+_0xf01024[_0xc8b7('0x43')]['filter']+'%'};return _0x3cf9d8;})});}_0x229595=_['merge']({},_0x229595,_0xf01024[_0xc8b7('0x55')]);return db[_0xc8b7('0x73')][_0xc8b7('0x2f')]({'where':_0x229595[_0xc8b7('0x4d')]})['then'](function(_0x5d285a){_0x167d93[_0xc8b7('0x2f')]=_0x5d285a;if(_0xf01024[_0xc8b7('0x43')]['includeAll']){_0x229595[_0xc8b7('0x57')]=[{'all':!![]}];}return db[_0xc8b7('0x73')][_0xc8b7('0x58')](_0x229595);})[_0xc8b7('0x20')](function(_0x53e8ab){_0x167d93[_0xc8b7('0x59')]=_0x53e8ab;return _0x167d93;});}})[_0xc8b7('0x20')](respondWithFilteredResult(_0x104874,_0x229595))[_0xc8b7('0x2a')](handleError(_0x104874,null));};exports[_0xc8b7('0x74')]=function(_0x31c4cd,_0x7bde01,_0x2ec627){var _0xe66f0;return db[_0xc8b7('0x40')]['find']({'where':{'id':_0x31c4cd[_0xc8b7('0x68')]['id']}})[_0xc8b7('0x20')](handleEntityNotFound(_0x7bde01,null))[_0xc8b7('0x20')](function(_0x58df7d){if(_0x58df7d){return _0x58df7d[_0xc8b7('0x74')](_0x31c4cd['query']['ids']);}})[_0xc8b7('0x20')](respondWithStatusCode(_0x7bde01,null))['catch'](handleError(_0x7bde01,null));};exports[_0xc8b7('0x75')]=function(_0x298fe1,_0xf0fbfb,_0x3b9d10){var _0x2451d1={'body':_0x298fe1[_0xc8b7('0x5d')],'channel':'openchannel'};var _0x3fe187=[];var _0xf95833=[];var _0x33bcac={};var _0xa8964=![];return db[_0xc8b7('0x76')]['describe']()[_0xc8b7('0x20')](function(_0x8187d7){if(!_0x8187d7){throw new db[(_0xc8b7('0x77'))][(_0xc8b7('0x78'))]('no\x20available\x20attributes');}_0x3fe187=_[_0xc8b7('0x79')](_[_0xc8b7('0x44')](_0x8187d7),[_0xc8b7('0x7a'),_0xc8b7('0x7b')]);_0xf95833=_['difference'](_['keys'](_0x8187d7),[_0xc8b7('0x7a'),'updatedAt',_0xc8b7('0x7c'),_0xc8b7('0x7d')]);if(_0x298fe1['body']['id']){delete _0x298fe1[_0xc8b7('0x5d')]['id'];}if(_[_0xc8b7('0x7e')](_0x298fe1['body']['from'])){throw new db[(_0xc8b7('0x77'))]['ValidationError'](_0xc8b7('0x7f'));}if(_[_0xc8b7('0x7e')](_0x298fe1['body']['body'])||_0x298fe1[_0xc8b7('0x5d')][_0xc8b7('0x5d')]===''){throw new db['Sequelize'][(_0xc8b7('0x78'))](_0xc8b7('0x80'));}if(_[_0xc8b7('0x7e')](_0x298fe1['body'][_0xc8b7('0x81')])){throw new db[(_0xc8b7('0x77'))][(_0xc8b7('0x78'))](_0xc8b7('0x82')+_0xf95833);}if(!_[_0xc8b7('0x83')](_0xf95833,_0x298fe1[_0xc8b7('0x5d')][_0xc8b7('0x81')])){throw new db['Sequelize'][(_0xc8b7('0x78'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xf95833);}_0x33bcac[_0x298fe1[_0xc8b7('0x5d')][_0xc8b7('0x81')]]=_0x298fe1[_0xc8b7('0x5d')]['from'];})[_0xc8b7('0x20')](function(){return db[_0xc8b7('0x40')][_0xc8b7('0x64')]({'where':{'id':_0x298fe1[_0xc8b7('0x68')]['id']},'include':[{'model':db['CmList'],'as':_0xc8b7('0x84'),'include':[{'model':db[_0xc8b7('0x76')],'as':_0xc8b7('0x85'),'where':_0x33bcac,'limit':0x1,'order':[[_0xc8b7('0x7b'),_0xc8b7('0x86')]]}]},{'model':db[_0xc8b7('0x87')],'as':'Applications'}]});})[_0xc8b7('0x20')](handleEntityNotFound(_0xf0fbfb,null))['then'](function(_0x3a6491){if(_0x3a6491&&_0x3a6491['List']){_0x2451d1[_0xc8b7('0x88')]=_0x3a6491;_0x2451d1[_0xc8b7('0x89')]=_0x3a6491[_0xc8b7('0x8a')];_0x2451d1['list']=_0x3a6491[_0xc8b7('0x84')];_0x2451d1['applications']=_[_0xc8b7('0x8b')](_0x2451d1[_0xc8b7('0x89')],['priority'],[_0xc8b7('0x8c')]);if(_0x2451d1[_0xc8b7('0x88')][_0xc8b7('0x8a')]){delete _0x2451d1[_0xc8b7('0x88')][_0xc8b7('0x8a')];}if(_0x2451d1['account'][_0xc8b7('0x84')]&&_0x2451d1['account'][_0xc8b7('0x84')][_0xc8b7('0x85')][_0xc8b7('0x49')]){return _0x2451d1['account'][_0xc8b7('0x84')]['Contacts'][0x0];}var _0x436bd9=_[_0xc8b7('0x19')](_0x298fe1['body'],{'firstName':_0x298fe1[_0xc8b7('0x5d')][_0xc8b7('0x8d')],'ListId':_0x3a6491[_0xc8b7('0x7d')]});_0x436bd9[_0x298fe1[_0xc8b7('0x5d')][_0xc8b7('0x81')]]=_0x298fe1[_0xc8b7('0x5d')][_0xc8b7('0x8d')];return db['CmContact']['create'](_0x436bd9,{'fields':_0x3fe187,'raw':!![]});}})[_0xc8b7('0x20')](handleEntityNotFound(_0xf0fbfb,null))[_0xc8b7('0x20')](function(_0x36724d){_0x2451d1[_0xc8b7('0x8e')]=_0x36724d;if(_0x36724d){var _0x420199={'ContactId':_0x36724d['id'],'OpenchannelAccountId':_0x298fe1[_0xc8b7('0x68')]['id'],'from':(_0x36724d[_0xc8b7('0x8f')]||'')+'\x20'+(_0x36724d[_0xc8b7('0x90')]||'')};var _0x2843c8={'OpenchannelAccountId':_0x298fe1[_0xc8b7('0x68')]['id'],'closed':![]};if(_0x298fe1[_0xc8b7('0x5d')][_0xc8b7('0x91')]){_0x2843c8['threadId']=_0x298fe1[_0xc8b7('0x5d')][_0xc8b7('0x91')];return db[_0xc8b7('0x92')][_0xc8b7('0x64')]({'where':_0x2843c8})[_0xc8b7('0x20')](function(_0x4d3a5c){if(_0x4d3a5c){return[_0x4d3a5c,![]];}_0x420199[_0xc8b7('0x91')]=_0x298fe1[_0xc8b7('0x5d')][_0xc8b7('0x91')];_0x420199['externalUrl']=_0x298fe1[_0xc8b7('0x5d')][_0xc8b7('0x93')];return db['OpenchannelInteraction'][_0xc8b7('0x5c')](_0x420199)[_0xc8b7('0x20')](function(_0x2427d6){return[_0x2427d6,!![]];});});}else{_0x2843c8[_0xc8b7('0x91')]=null;}_0x2843c8[_0xc8b7('0x94')]=_0x36724d['id'];return db[_0xc8b7('0x92')][_0xc8b7('0x64')]({'where':_0x2843c8})[_0xc8b7('0x20')](function(_0x28f196){if(_0x28f196){return[_0x28f196,![]];}return db[_0xc8b7('0x92')][_0xc8b7('0x5c')](_0x420199)[_0xc8b7('0x20')](function(_0x310406){return[_0x310406,!![]];});});}})[_0xc8b7('0x95')](function(_0x5b022a,_0x36f686){if(_0x5b022a){_0xa8964=_0x36f686;if(!_0x36f686){var _0x4f0519={'from':(_0x2451d1['contact'][_0xc8b7('0x8f')]||'')+'\x20'+(_0x2451d1[_0xc8b7('0x8e')]['lastName']||'')};if(_0x298fe1[_0xc8b7('0x5d')][_0xc8b7('0x91')]&&_0x298fe1['body'][_0xc8b7('0x96')]&&_0x298fe1['body'][_0xc8b7('0x91')]!=_0x298fe1[_0xc8b7('0x5d')]['messageId']){_0x4f0519[_0xc8b7('0x91')]=_0x298fe1[_0xc8b7('0x5d')][_0xc8b7('0x96')];}return _0x5b022a[_0xc8b7('0x37')](_0x4f0519);}else{return _0x5b022a;}}})[_0xc8b7('0x20')](function(_0x5e82cc){_0x2451d1[_0xc8b7('0x97')]=_0x5e82cc[_0xc8b7('0x5f')]({'plain':!![]});_0x2451d1[_0xc8b7('0x97')][_0xc8b7('0x98')]=_0xa8964;if(_0x2451d1[_0xc8b7('0x97')][_0xc8b7('0x98')]){if(_0x2451d1['account'][_0xc8b7('0x99')]){_0x2451d1['applications'][_0xc8b7('0x9a')]({'id':0x0,'priority':_0x2451d1[_0xc8b7('0x89')][_0xc8b7('0x49')]+0x1,'app':_0xc8b7('0x9b'),'appdata':_0xc8b7('0x9c'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0xc8b7('0x5c')]({'body':_0x298fe1['body']['body'],'OpenchannelAccountId':_0x298fe1['params']['id'],'OpenchannelInteractionId':_0x5e82cc['id'],'direction':'in','ContactId':_0x2451d1['contact']['id'],'AttachmentId':_0x298fe1[_0xc8b7('0x5d')][_0xc8b7('0x9d')]});})['then'](function(_0x242d03){_0x2451d1[_0xc8b7('0x27')]=_0x242d03;if(_0x2451d1[_0xc8b7('0x97')][_0xc8b7('0x9e')]){return db[_0xc8b7('0x9f')]['find']({'attributes':['id',_0xc8b7('0x3b')],'where':{'id':_0x2451d1[_0xc8b7('0x97')]['UserId']}})[_0xc8b7('0x20')](function(_0x504690){if(_0x504690){_0x2451d1[_0xc8b7('0x89')][_0xc8b7('0xa0')]({'id':0x0,'priority':0x0,'app':_0xc8b7('0xa1'),'appdata':_0x504690[_0xc8b7('0x3b')]+','+(_0x2451d1[_0xc8b7('0x88')]['waitForTheAssignedAgent']||0xa),'interval':_0xc8b7('0xa2')});_0x2451d1['forcedOwnership']=![];}return respondWithRpcPromise(_0xc8b7('0xa3'),_0xc8b7('0xa4'),_0x2451d1);});}return respondWithRpcPromise('Start',_0xc8b7('0xa4'),_0x2451d1);})[_0xc8b7('0x20')](function(_0xee21d0){respondWithRpcPromise(_0xc8b7('0xa5'),_0xc8b7('0xa5'),{'event':_0xc8b7('0x75'),'message':_0xee21d0},client9002);return _0xee21d0;})[_0xc8b7('0x20')](respondWithResult(_0xf0fbfb,null))[_0xc8b7('0x2a')](handleError(_0xf0fbfb,null));};exports[_0xc8b7('0xa6')]=function(_0xc016d5,_0x5243bb,_0x8d2356){return db[_0xc8b7('0x40')]['findOne']({'where':{'id':_0xc016d5[_0xc8b7('0x68')]['id']}})[_0xc8b7('0x20')](handleEntityNotFound(_0x5243bb,null))[_0xc8b7('0x20')](function(_0x10d8f8){if(_0x10d8f8){return db[_0xc8b7('0xa7')][_0xc8b7('0xa8')](function(_0x36366b){return db['OpenchannelApplication'][_0xc8b7('0x38')]({'where':{'OpenchannelAccountId':_0xc016d5[_0xc8b7('0x68')]['id']},'transaction':_0x36366b})[_0xc8b7('0x20')](function(_0x4f81ec){var _0x4af8c9=_[_0xc8b7('0x50')](_0xc016d5[_0xc8b7('0x5d')],function(_0x22b8d0){_0x22b8d0['OpenchannelAccountId']=_0xc016d5[_0xc8b7('0x68')]['id'];return _0x22b8d0;});return db[_0xc8b7('0x87')][_0xc8b7('0xa9')](_0x4af8c9,{'transaction':_0x36366b});});})[_0xc8b7('0x20')](function(){return db[_0xc8b7('0x87')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0xc016d5[_0xc8b7('0x68')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x5243bb,null))['catch'](handleError(_0x5243bb,null));};exports[_0xc8b7('0xaa')]=function(_0x407c60,_0x1e848d,_0xf5bcfb){var _0x38984c={};var _0x4253da={};var _0x531c91;var _0xb63b30;return db[_0xc8b7('0x40')]['findOne']({'where':{'id':_0x407c60[_0xc8b7('0x68')]['id']}})[_0xc8b7('0x20')](handleEntityNotFound(_0x1e848d,null))[_0xc8b7('0x20')](function(_0x34071c){if(_0x34071c){_0x531c91=_0x34071c;_0x4253da[_0xc8b7('0x42')]=_[_0xc8b7('0x44')](db[_0xc8b7('0x87')][_0xc8b7('0x41')]);_0x4253da[_0xc8b7('0x43')]=_[_0xc8b7('0x44')](_0x407c60[_0xc8b7('0x43')]);_0x4253da[_0xc8b7('0x45')]=_[_0xc8b7('0x47')](_0x4253da[_0xc8b7('0x42')],_0x4253da[_0xc8b7('0x43')]);_0x38984c['attributes']=_['intersection'](_0x4253da[_0xc8b7('0x42')],qs[_0xc8b7('0x48')](_0x407c60['query'][_0xc8b7('0x48')]));_0x38984c[_0xc8b7('0x46')]=_0x38984c[_0xc8b7('0x46')][_0xc8b7('0x49')]?_0x38984c[_0xc8b7('0x46')]:_0x4253da[_0xc8b7('0x42')];_0x38984c['order']=qs[_0xc8b7('0x4c')](_0x407c60[_0xc8b7('0x43')][_0xc8b7('0x4c')]);_0x38984c[_0xc8b7('0x4d')]=qs[_0xc8b7('0x45')](_[_0xc8b7('0x4e')](_0x407c60[_0xc8b7('0x43')],_0x4253da[_0xc8b7('0x45')]));if(_0x407c60[_0xc8b7('0x43')]['filter']){_0x38984c[_0xc8b7('0x4d')]=_[_0xc8b7('0x5b')](_0x38984c[_0xc8b7('0x4d')],{'$or':_['map'](_0x38984c[_0xc8b7('0x46')],function(_0xc01de0){var _0x4080a5={};_0x4080a5[_0xc01de0]={'$like':'%'+_0x407c60[_0xc8b7('0x43')]['filter']+'%'};return _0x4080a5;})});}_0x38984c=_[_0xc8b7('0x5b')]({},_0x38984c,_0x407c60['options']);return _0x531c91['getApplications'](_0x38984c);}})[_0xc8b7('0x20')](function(_0x3f8e44){if(_0x3f8e44){_0xb63b30=_0x3f8e44['length'];if(!_0x407c60[_0xc8b7('0x43')][_0xc8b7('0x4a')]('nolimit')){_0x38984c['limit']=qs[_0xc8b7('0x31')](_0x407c60[_0xc8b7('0x43')][_0xc8b7('0x31')]);_0x38984c[_0xc8b7('0x30')]=qs[_0xc8b7('0x30')](_0x407c60[_0xc8b7('0x43')][_0xc8b7('0x30')]);}return _0x531c91['getApplications'](_0x38984c);}})['then'](function(_0x584ea7){if(_0x584ea7){return _0x584ea7?{'count':_0xb63b30,'rows':_0x584ea7}:null;}})[_0xc8b7('0x20')](respondWithResult(_0x1e848d,null))[_0xc8b7('0x2a')](handleError(_0x1e848d,null));};exports[_0xc8b7('0xab')]=function(_0x1bae32,_0x46b391,_0x502807){var _0x57525c={'raw':![],'where':{}};var _0x340f8a={};var _0x28e06e={'count':0x0,'rows':[]};return db[_0xc8b7('0x40')][_0xc8b7('0x6d')]({'where':{'id':_0x1bae32[_0xc8b7('0x68')]['id']}})['then'](handleEntityNotFound(_0x46b391,null))[_0xc8b7('0x20')](function(_0x572707){if(_0x572707){_0x340f8a[_0xc8b7('0x42')]=_['keys'](db['OpenchannelInteraction'][_0xc8b7('0x41')]);_0x340f8a[_0xc8b7('0x43')]=_[_0xc8b7('0x44')](_0x1bae32[_0xc8b7('0x43')]);_0x340f8a['filters']=_[_0xc8b7('0x47')](_0x340f8a[_0xc8b7('0x42')],_0x340f8a['query']);_0x57525c['attributes']=_[_0xc8b7('0x47')](_0x340f8a[_0xc8b7('0x42')],qs[_0xc8b7('0x48')](_0x1bae32['query'][_0xc8b7('0x48')]));_0x57525c['attributes']=_0x57525c[_0xc8b7('0x46')][_0xc8b7('0x49')]?_0x57525c[_0xc8b7('0x46')]:_0x340f8a['model'];if(!_0x1bae32[_0xc8b7('0x43')]['hasOwnProperty'](_0xc8b7('0x4b'))){_0x57525c['limit']=qs[_0xc8b7('0x31')](_0x1bae32[_0xc8b7('0x43')]['limit']);_0x57525c[_0xc8b7('0x30')]=qs['offset'](_0x1bae32['query'][_0xc8b7('0x30')]);}_0x57525c[_0xc8b7('0x6e')]=qs[_0xc8b7('0x4c')](_0x1bae32[_0xc8b7('0x43')][_0xc8b7('0x4c')]);_0x57525c[_0xc8b7('0x4d')]=qs[_0xc8b7('0x45')](_[_0xc8b7('0x4e')](_0x1bae32[_0xc8b7('0x43')],_0x340f8a[_0xc8b7('0x45')]));_0x57525c[_0xc8b7('0x4d')][_0xc8b7('0x6f')]=_0x572707['id'];if(_0x1bae32[_0xc8b7('0x43')]['filter']){_0x57525c[_0xc8b7('0x4d')]=_[_0xc8b7('0x5b')](_0x57525c[_0xc8b7('0x4d')],{'$or':_[_0xc8b7('0x50')](_0x57525c[_0xc8b7('0x46')],function(_0x4a1c47){var _0x9cf1d4={};_0x9cf1d4[_0x4a1c47]={'$like':'%'+_0x1bae32[_0xc8b7('0x43')]['filter']+'%'};return _0x9cf1d4;})});}_0x57525c=_[_0xc8b7('0x5b')]({},_0x57525c,_0x1bae32[_0xc8b7('0x55')]);return db[_0xc8b7('0x92')]['count']({'where':_0x57525c['where']})[_0xc8b7('0x20')](function(_0x1b742d){_0x28e06e[_0xc8b7('0x2f')]=_0x1b742d;if(_0x1bae32[_0xc8b7('0x43')]['includeAll']){_0x57525c[_0xc8b7('0x57')]=[{'model':db['CmContact'],'as':_0xc8b7('0xac'),'required':![]},{'model':db[_0xc8b7('0x9f')],'as':_0xc8b7('0xad'),'attributes':[_0xc8b7('0x3b'),_0xc8b7('0xae'),_0xc8b7('0xaf')],'required':![]},{'model':db[_0xc8b7('0xb0')],'as':_0xc8b7('0xb1'),'attributes':['id',_0xc8b7('0x3b'),_0xc8b7('0xb2')],'where':_0x1bae32[_0xc8b7('0x43')][_0xc8b7('0xb3')]?{'id':_0x1bae32[_0xc8b7('0x43')][_0xc8b7('0xb3')]}:undefined,'required':_0x1bae32[_0xc8b7('0x43')][_0xc8b7('0xb3')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xc8b7('0x58')](_0x57525c);})[_0xc8b7('0x20')](function(_0x3f7de8){_0x28e06e['rows']=_0x3f7de8;return _0x28e06e;});}})['then'](respondWithFilteredResult(_0x46b391,_0x57525c))[_0xc8b7('0x2a')](handleError(_0x46b391,null));};exports[_0xc8b7('0xb4')]=function(_0x3182b0,_0x43d41a,_0x107efe){return db['OpenchannelAccount']['find']({'where':{'id':_0x3182b0[_0xc8b7('0x68')]['id']}})['then'](handleEntityNotFound(_0x43d41a,null))[_0xc8b7('0x20')](function(_0x3bcfad){if(_0x3bcfad){return _0x3bcfad[_0xc8b7('0xb4')](_0x3182b0[_0xc8b7('0x5d')][_0xc8b7('0x71')],_[_0xc8b7('0xb5')](_0x3182b0['body'],[_0xc8b7('0x71'),'id'])||{})['spread'](function(_0x5a2ae8){for(var _0x36eb6e=0x0;_0x36eb6e<_0x3182b0[_0xc8b7('0x5d')][_0xc8b7('0x71')]['length'];_0x36eb6e+=0x1){socket[_0xc8b7('0xb6')]('userOpenchannelAccount:save',{'UserId':_0x3182b0[_0xc8b7('0x5d')][_0xc8b7('0x71')][_0x36eb6e],'OpenchannelAccountId':_0x3182b0[_0xc8b7('0x68')]['id']});}return _0x5a2ae8;});}})[_0xc8b7('0x20')](respondWithResult(_0x43d41a,null))[_0xc8b7('0x2a')](handleError(_0x43d41a,null));};exports[_0xc8b7('0xb7')]=function(_0x4cc6ed,_0x4dbda4,_0xce709c){var _0x1fb92c;return db[_0xc8b7('0x40')][_0xc8b7('0x64')]({'where':{'id':_0x4cc6ed[_0xc8b7('0x68')]['id']}})[_0xc8b7('0x20')](handleEntityNotFound(_0x4dbda4,null))[_0xc8b7('0x20')](function(_0x19f37b){if(_0x19f37b){return _0x19f37b['removeAgents'](_0x4cc6ed['query'][_0xc8b7('0x71')])[_0xc8b7('0x20')](function(_0x2a6484){if(_[_0xc8b7('0xb8')](_0x4cc6ed['query'][_0xc8b7('0x71')])){for(var _0x5504ba=0x0;_0x5504ba<_0x4cc6ed[_0xc8b7('0x43')][_0xc8b7('0x71')]['length'];_0x5504ba+=0x1){socket['emit'](_0xc8b7('0xb9'),{'UserId':_0x4cc6ed[_0xc8b7('0x43')][_0xc8b7('0x71')][_0x5504ba],'OpenchannelAccountId':_0x4cc6ed[_0xc8b7('0x68')]['id']});}}else{socket[_0xc8b7('0xb6')](_0xc8b7('0xb9'),{'UserId':_0x4cc6ed[_0xc8b7('0x43')][_0xc8b7('0x71')],'OpenchannelAccountId':_0x4cc6ed['params']['id']});}});}})[_0xc8b7('0x20')](respondWithStatusCode(_0x4dbda4,null))[_0xc8b7('0x2a')](handleError(_0x4dbda4,null));};exports[_0xc8b7('0xba')]=function(_0x3ae607,_0x3912c7,_0x5cc881){var _0x545691={};var _0x29bc60={};var _0x1327e6;var _0x4909fa;return db[_0xc8b7('0x40')]['findOne']({'where':{'id':_0x3ae607['params']['id']}})['then'](handleEntityNotFound(_0x3912c7,null))[_0xc8b7('0x20')](function(_0x5e16db){if(_0x5e16db){_0x1327e6=_0x5e16db;_0x29bc60['model']=_['keys'](db[_0xc8b7('0x9f')][_0xc8b7('0x41')]);_0x29bc60[_0xc8b7('0x43')]=_[_0xc8b7('0x44')](_0x3ae607[_0xc8b7('0x43')]);_0x29bc60[_0xc8b7('0x45')]=_[_0xc8b7('0x47')](_0x29bc60[_0xc8b7('0x42')],_0x29bc60[_0xc8b7('0x43')]);_0x545691['attributes']=_['intersection'](_0x29bc60[_0xc8b7('0x42')],qs[_0xc8b7('0x48')](_0x3ae607[_0xc8b7('0x43')]['fields']));_0x545691[_0xc8b7('0x46')]=_0x545691[_0xc8b7('0x46')][_0xc8b7('0x49')]?_0x545691[_0xc8b7('0x46')]:_0x29bc60[_0xc8b7('0x42')];_0x545691['order']=qs[_0xc8b7('0x4c')](_0x3ae607[_0xc8b7('0x43')][_0xc8b7('0x4c')]);_0x545691[_0xc8b7('0x4d')]=qs[_0xc8b7('0x45')](_[_0xc8b7('0x4e')](_0x3ae607[_0xc8b7('0x43')],_0x29bc60['filters']));if(_0x3ae607['query'][_0xc8b7('0x4f')]){_0x545691[_0xc8b7('0x4d')]=_[_0xc8b7('0x5b')](_0x545691[_0xc8b7('0x4d')],{'$or':_[_0xc8b7('0x50')](_0x545691[_0xc8b7('0x46')],function(_0x3f380b){var _0x23d35b={};_0x23d35b[_0x3f380b]={'$like':'%'+_0x3ae607[_0xc8b7('0x43')]['filter']+'%'};return _0x23d35b;})});}_0x545691=_[_0xc8b7('0x5b')]({},_0x545691,_0x3ae607[_0xc8b7('0x55')]);return _0x1327e6[_0xc8b7('0xba')](_0x545691);}})[_0xc8b7('0x20')](function(_0x191756){if(_0x191756){_0x4909fa=_0x191756[_0xc8b7('0x49')];if(!_0x3ae607[_0xc8b7('0x43')][_0xc8b7('0x4a')](_0xc8b7('0x4b'))){_0x545691[_0xc8b7('0x31')]=qs[_0xc8b7('0x31')](_0x3ae607[_0xc8b7('0x43')][_0xc8b7('0x31')]);_0x545691[_0xc8b7('0x30')]=qs[_0xc8b7('0x30')](_0x3ae607[_0xc8b7('0x43')][_0xc8b7('0x30')]);}return _0x1327e6['getAgents'](_0x545691);}})[_0xc8b7('0x20')](function(_0x4d8168){if(_0x4d8168){return _0x4d8168?{'count':_0x4909fa,'rows':_0x4d8168}:null;}})[_0xc8b7('0x20')](respondWithResult(_0x3912c7,null))[_0xc8b7('0x2a')](handleError(_0x3912c7,null));};exports[_0xc8b7('0x3c')]=function(_0x48e2d4,_0x4808c3,_0x481d26){var _0x110e04,_0x32c9f3,_0x2c3371;if(_[_0xc8b7('0x7e')](_0x48e2d4[_0xc8b7('0x5d')][_0xc8b7('0x5d')])||_0x48e2d4[_0xc8b7('0x5d')][_0xc8b7('0x5d')]===''){throw new db[(_0xc8b7('0x77'))][(_0xc8b7('0x78'))](_0xc8b7('0x80'));}if(_[_0xc8b7('0x7e')](_0x48e2d4[_0xc8b7('0x5d')]['to'])){}_0x110e04=_0x48e2d4['body']['to'];return db[_0xc8b7('0x40')][_0xc8b7('0x6d')]({'where':{'id':_0x48e2d4[_0xc8b7('0x68')]['id']}})[_0xc8b7('0x20')](handleEntityNotFound(_0x4808c3,null))[_0xc8b7('0x20')](function(_0x34487d){if(_0x34487d){return db[_0xc8b7('0x40')][_0xc8b7('0x64')]({'where':{'id':_0x34487d['id']},'include':[{'model':db[_0xc8b7('0xbb')],'as':_0xc8b7('0x84'),'include':[{'model':db['CmContact'],'as':_0xc8b7('0x85'),'where':{[_0x34487d[_0xc8b7('0x81')]]:_0x110e04},'limit':0x1,'order':[[_0xc8b7('0x7b'),_0xc8b7('0x86')]]}]}]})[_0xc8b7('0x20')](handleEntityNotFound(_0x4808c3,null))['then'](function(_0x5c2f54){if(_0x5c2f54&&_0x5c2f54[_0xc8b7('0x84')]){_0x32c9f3=_0x5c2f54[_0xc8b7('0x5f')]({'plain':!![]});if(_0x32c9f3[_0xc8b7('0x84')]&&_0x32c9f3[_0xc8b7('0x84')][_0xc8b7('0x85')][_0xc8b7('0x49')]){return _0x32c9f3['List'][_0xc8b7('0x85')][0x0];}return db[_0xc8b7('0x76')][_0xc8b7('0x5c')](_['defaults'](_0x48e2d4[_0xc8b7('0x5d')],{'firstName':_0x110e04,[_0x5c2f54[_0xc8b7('0x81')]]:_0x110e04,'phone':_0x110e04,'ListId':_0x32c9f3[_0xc8b7('0x7d')]}));}})['then'](handleEntityNotFound(_0x4808c3,null))[_0xc8b7('0x20')](function(_0x4d2a63){if(_0x4d2a63){_0x2c3371=_0x4d2a63;return db[_0xc8b7('0x92')]['find']({'where':{'ContactId':_0x2c3371['id'],'closed':![],'OpenchannelAccountId':_0x32c9f3['id']}})[_0xc8b7('0x20')](function(_0x390da4){if(_0x390da4){return[_0x390da4,![]];}return db[_0xc8b7('0x92')]['create']({'UserId':_0x48e2d4[_0xc8b7('0x5e')]['id'],'ContactId':_0x2c3371['id'],'OpenchannelAccountId':_0x32c9f3['id'],'lastMsgDirection':'out','Messages':[_[_0xc8b7('0x5b')](_0x48e2d4[_0xc8b7('0x5d')],{'read':![],'body':_0x48e2d4['body'][_0xc8b7('0x5d')],'OpenchannelAccountId':_0x32c9f3['id'],'UserId':_0x48e2d4['user']['id'],'ContactId':_0x2c3371['id']})]},{'include':[{'model':db[_0xc8b7('0xbc')],'as':_0xc8b7('0xbd')}]})[_0xc8b7('0x20')](function(_0x1921ac){return[_0x1921ac,!![]];});});}})['spread'](function(_0x14c0dd,_0xc06c0e){if(_0xc06c0e){return _0x14c0dd;}return db[_0xc8b7('0xbc')][_0xc8b7('0x5c')](_['merge'](_0x48e2d4['body'],{'read':![],'body':_0x48e2d4[_0xc8b7('0x5d')]['body'],'OpenchannelAccountId':_0x32c9f3['id'],'OpenchannelInteractionId':_0x14c0dd['id'],'UserId':_0x48e2d4['user']['id'],'ContactId':_0x2c3371['id']}))['then'](function(_0x1ae123){_0x14c0dd[_0xc8b7('0xbe')][_0xc8b7('0xbd')]=[];_0x14c0dd['dataValues']['Messages'][_0xc8b7('0x9a')](_0x1ae123['dataValues']);return _0x14c0dd;});});}})[_0xc8b7('0x20')](respondWithResult(_0x4808c3,null))[_0xc8b7('0x2a')](handleError(_0x4808c3,null));}; \ No newline at end of file +var _0x9de3=['firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','Start','EventManager','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','defaults','Messages','dataValues','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','error','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','get','OpenchannelAccounts','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','field','merge','includeAll','include','findAll','rows','show','length','options','find','create','body','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','findOne','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','ValidationError','no\x20available\x20attributes','updatedAt','createdAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','OpenchannelApplication','Applications','applications','list','orderBy','priority','account','contact'];(function(_0xb72e88,_0x23a64d){var _0x29e3ce=function(_0x55678f){while(--_0x55678f){_0xb72e88['push'](_0xb72e88['shift']());}};_0x29e3ce(++_0x23a64d);}(_0x9de3,0xea));var _0x39de=function(_0x51df70,_0x230ebb){_0x51df70=_0x51df70-0x0;var _0x2a2bc2=_0x9de3[_0x51df70];return _0x2a2bc2;};'use strict';var pdf=require(_0x39de('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x39de('0x1'));var zipdir=require(_0x39de('0x2'));var jsonpatch=require(_0x39de('0x3'));var rp=require('request-promise');var moment=require(_0x39de('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x39de('0x5'));var util=require(_0x39de('0x6'));var path=require(_0x39de('0x7'));var sox=require(_0x39de('0x8'));var csv=require('to-csv');var ejs=require(_0x39de('0x9'));var fs=require('fs');var _=require(_0x39de('0xa'));var squel=require(_0x39de('0xb'));var crypto=require(_0x39de('0xc'));var jsforce=require(_0x39de('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x39de('0xe'));var authService=require(_0x39de('0xf'));var hardwareService=require(_0x39de('0x10'));var Redis=require(_0x39de('0x11'));var qs=require(_0x39de('0x12'));var logger=require(_0x39de('0x13'))(_0x39de('0x14'));var utils=require(_0x39de('0x15'));var config=require('../../config/environment');var db=require(_0x39de('0x16'))['db'];config['redis']=_['defaults'](config[_0x39de('0x17')],{'host':_0x39de('0x18'),'port':0x18eb});var socket=require(_0x39de('0x19'))(new Redis(config['redis']));require(_0x39de('0x1a'))[_0x39de('0x1b')](socket);var jayson=require(_0x39de('0x1c'));var client=jayson[_0x39de('0x1d')][_0x39de('0x1e')]({'port':0x232c});var client9002=jayson[_0x39de('0x1d')][_0x39de('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x25ca17,_0xaff589,_0x316fdb,_0x4c56df){return new BPromise(function(_0x1f36e0,_0x1b5daa){var _0x20bd18=_0x4c56df||client;return _0x20bd18[_0x39de('0x1f')](_0x25ca17,_0x316fdb)['then'](function(_0x53c91b){logger[_0x39de('0x20')]('OpenchannelAccount,\x20%s,\x20%s',_0xaff589,_0x39de('0x21'));logger[_0x39de('0x22')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0xaff589,_0x39de('0x21'),JSON['stringify'](_0x53c91b));if(_0x53c91b[_0x39de('0x23')]){if(_0x53c91b[_0x39de('0x23')]['code']===0x1f4){logger['error'](_0x39de('0x24'),_0xaff589,_0x53c91b['error']['message']);return _0x1b5daa(_0x53c91b[_0x39de('0x23')][_0x39de('0x25')]);}logger[_0x39de('0x23')](_0x39de('0x24'),_0xaff589,_0x53c91b[_0x39de('0x23')][_0x39de('0x25')]);return _0x1f36e0(_0x53c91b['error'][_0x39de('0x25')]);}else{logger[_0x39de('0x20')](_0x39de('0x24'),_0xaff589,'request\x20sent');_0x1f36e0(_0x53c91b[_0x39de('0x26')]['message']);}})[_0x39de('0x27')](function(_0x102c5b){logger[_0x39de('0x23')](_0x39de('0x24'),_0xaff589,_0x102c5b);_0x1b5daa(_0x102c5b);});});}function respondWithStatusCode(_0x2a7cd5,_0x5ec435){_0x5ec435=_0x5ec435||0xcc;return function(_0x28285a){if(_0x28285a){return _0x2a7cd5[_0x39de('0x28')](_0x5ec435);}return _0x2a7cd5[_0x39de('0x29')](_0x5ec435)[_0x39de('0x2a')]();};}function respondWithResult(_0x4c7cab,_0x3fd91a){_0x3fd91a=_0x3fd91a||0xc8;return function(_0x59e64f){if(_0x59e64f){return _0x4c7cab['status'](_0x3fd91a)[_0x39de('0x2b')](_0x59e64f);}};}function respondWithFilteredResult(_0x1d3b79,_0xfd80c8){return function(_0x3ff4d8){if(_0x3ff4d8){var _0x184726=_0x3ff4d8[_0x39de('0x2c')],_0x4e9711=_0xfd80c8[_0x39de('0x2d')],_0x352060=_0xfd80c8[_0x39de('0x2d')]+_0xfd80c8[_0x39de('0x2e')],_0xe979d1;if(_0x352060>=_0x184726){_0x352060=_0x184726;_0xe979d1=0xc8;}else{_0xe979d1=0xce;}_0x1d3b79[_0x39de('0x29')](_0xe979d1);return _0x1d3b79['set'](_0x39de('0x2f'),_0x4e9711+'-'+_0x352060+'/'+_0x184726)[_0x39de('0x2b')](_0x3ff4d8);}return null;};}function patchUpdates(_0x3760c7){return function(_0x39d61c){try{jsonpatch['apply'](_0x39d61c,_0x3760c7,!![]);}catch(_0x44df77){return BPromise[_0x39de('0x30')](_0x44df77);}return _0x39d61c[_0x39de('0x31')]();};}function saveUpdates(_0x3e7fe8,_0x503f22){return function(_0x184ea6){if(_0x184ea6){return _0x184ea6[_0x39de('0x32')](_0x3e7fe8)[_0x39de('0x33')](function(_0x363eff){return _0x363eff;});}return null;};}function removeEntity(_0x3b6aac,_0x525b66){return function(_0x48ad0c){if(_0x48ad0c){return _0x48ad0c[_0x39de('0x34')]()[_0x39de('0x33')](function(){var _0x353489=_0x48ad0c[_0x39de('0x35')]({'plain':!![]});var _0x49441a=_0x39de('0x36');return db['UserProfileResource'][_0x39de('0x34')]({'where':{'type':_0x49441a,'resourceId':_0x353489['id']}})[_0x39de('0x33')](function(){return _0x48ad0c;});})[_0x39de('0x33')](function(){_0x3b6aac['status'](0xcc)[_0x39de('0x2a')]();});}};}function handleEntityNotFound(_0x232b96,_0x131bef){return function(_0x14d954){if(!_0x14d954){_0x232b96[_0x39de('0x28')](0x194);}return _0x14d954;};}function handleError(_0x200f0c,_0x274cdb){_0x274cdb=_0x274cdb||0x1f4;return function(_0x21b15e){logger[_0x39de('0x23')](_0x21b15e['stack']);if(_0x21b15e[_0x39de('0x37')]){delete _0x21b15e[_0x39de('0x37')];}_0x200f0c[_0x39de('0x29')](_0x274cdb)[_0x39de('0x38')](_0x21b15e);};}exports[_0x39de('0x39')]=function(_0x4ca613,_0x394426){var _0x543bc4={'include':[{'model':db[_0x39de('0x3a')],'as':_0x39de('0x3b')}]},_0x10c6c3={},_0x51f1a3={'count':0x0,'rows':[]};var _0x342c0f=db[_0x39de('0x3c')][_0x39de('0x3d')];_0x10c6c3[_0x39de('0x3e')]=_[_0x39de('0x3f')](_0x342c0f);_0x10c6c3['query']=_[_0x39de('0x3f')](_0x4ca613[_0x39de('0x40')]);_0x10c6c3[_0x39de('0x41')]=_['intersection'](_0x10c6c3[_0x39de('0x3e')],_0x10c6c3[_0x39de('0x40')]);_0x543bc4[_0x39de('0x42')]=_[_0x39de('0x43')](_0x10c6c3['model'],qs['fields'](_0x4ca613[_0x39de('0x40')][_0x39de('0x44')]));_0x543bc4[_0x39de('0x42')]=_0x543bc4[_0x39de('0x42')]['length']?_0x543bc4[_0x39de('0x42')]:_0x10c6c3[_0x39de('0x3e')];if(!_0x4ca613[_0x39de('0x40')][_0x39de('0x45')](_0x39de('0x46'))){_0x543bc4[_0x39de('0x2e')]=qs[_0x39de('0x2e')](_0x4ca613[_0x39de('0x40')]['limit']);_0x543bc4[_0x39de('0x2d')]=qs[_0x39de('0x2d')](_0x4ca613[_0x39de('0x40')]['offset']);}_0x543bc4[_0x39de('0x47')]=qs[_0x39de('0x48')](_0x4ca613[_0x39de('0x40')]['sort']);_0x543bc4[_0x39de('0x49')]=qs[_0x39de('0x41')](_[_0x39de('0x4a')](_0x4ca613['query'],_0x10c6c3[_0x39de('0x41')]));if(_0x4ca613[_0x39de('0x40')][_0x39de('0x4b')]){_0x543bc4[_0x39de('0x49')]=_['merge'](_0x543bc4[_0x39de('0x49')],{'$or':_[_0x39de('0x4c')](_0x342c0f,function(_0x494f19){if(_0x494f19['type']['key']!==_0x39de('0x4d')){var _0x285dff={};_0x285dff[_0x494f19[_0x39de('0x4e')]]={'$like':'%'+_0x4ca613[_0x39de('0x40')][_0x39de('0x4b')]+'%'};return _0x285dff;}})});}_0x543bc4=_[_0x39de('0x4f')]({},_0x543bc4,_0x4ca613['options']);var _0x278e68={'where':_0x543bc4[_0x39de('0x49')]};return db[_0x39de('0x3c')]['count'](_0x278e68)[_0x39de('0x33')](function(_0x3ef16b){_0x51f1a3['count']=_0x3ef16b;if(_0x4ca613['query'][_0x39de('0x50')]){_0x543bc4[_0x39de('0x51')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x39de('0x52')](_0x543bc4);})[_0x39de('0x33')](function(_0x49514c){_0x51f1a3[_0x39de('0x53')]=_0x49514c;return _0x51f1a3;})[_0x39de('0x33')](respondWithFilteredResult(_0x394426,_0x543bc4))[_0x39de('0x27')](handleError(_0x394426,null));};exports[_0x39de('0x54')]=function(_0x2d4be2,_0x4caace){var _0x18abca={'raw':![],'where':{'id':_0x2d4be2['params']['id']},'include':[{'model':db[_0x39de('0x3a')],'as':_0x39de('0x3b')}]},_0x3c9fd9={};_0x3c9fd9['model']=_['keys'](db[_0x39de('0x3c')]['rawAttributes']);_0x3c9fd9[_0x39de('0x40')]=_['keys'](_0x2d4be2[_0x39de('0x40')]);_0x3c9fd9[_0x39de('0x41')]=_[_0x39de('0x43')](_0x3c9fd9['model'],_0x3c9fd9[_0x39de('0x40')]);_0x18abca[_0x39de('0x42')]=_[_0x39de('0x43')](_0x3c9fd9['model'],qs[_0x39de('0x44')](_0x2d4be2[_0x39de('0x40')]['fields']));_0x18abca['attributes']=_0x18abca[_0x39de('0x42')][_0x39de('0x55')]?_0x18abca[_0x39de('0x42')]:_0x3c9fd9[_0x39de('0x3e')];if(_0x2d4be2[_0x39de('0x40')][_0x39de('0x50')]){_0x18abca[_0x39de('0x51')]=[{'all':!![]}];}_0x18abca=_[_0x39de('0x4f')]({},_0x18abca,_0x2d4be2[_0x39de('0x56')]);return db['OpenchannelAccount'][_0x39de('0x57')](_0x18abca)['then'](handleEntityNotFound(_0x4caace,null))[_0x39de('0x33')](respondWithResult(_0x4caace,null))[_0x39de('0x27')](handleError(_0x4caace,null));};exports[_0x39de('0x58')]=function(_0x324bb7,_0x52beb7){return db[_0x39de('0x3c')][_0x39de('0x58')](_0x324bb7[_0x39de('0x59')],{})[_0x39de('0x33')](function(_0x2855cd){var _0x47a775=_0x324bb7['user'][_0x39de('0x35')]({'plain':!![]});if(!_0x47a775)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47a775[_0x39de('0x5a')]===_0x39de('0x5b')){var _0x29db90=_0x2855cd[_0x39de('0x35')]({'plain':!![]});var _0x33c4ba=_0x39de('0x36');return db[_0x39de('0x5c')][_0x39de('0x57')]({'where':{'name':_0x33c4ba,'userProfileId':_0x47a775['userProfileId']},'raw':!![]})['then'](function(_0x1dd27f){if(_0x1dd27f&&_0x1dd27f[_0x39de('0x5d')]===0x0){return db[_0x39de('0x5e')][_0x39de('0x58')]({'name':_0x29db90['name'],'resourceId':_0x29db90['id'],'type':_0x1dd27f[_0x39de('0x37')],'sectionId':_0x1dd27f['id']},{})[_0x39de('0x33')](function(){return _0x2855cd;});}else{return _0x2855cd;}})[_0x39de('0x27')](function(_0x318ba4){logger[_0x39de('0x23')](_0x39de('0x5f'),_0x318ba4);throw _0x318ba4;});}return _0x2855cd;})['then'](respondWithResult(_0x52beb7,0xc9))[_0x39de('0x27')](handleError(_0x52beb7,null));};exports[_0x39de('0x32')]=function(_0x1cc38b,_0x2abe15){if(_0x1cc38b[_0x39de('0x59')]['id']){delete _0x1cc38b[_0x39de('0x59')]['id'];}return db[_0x39de('0x3c')][_0x39de('0x57')]({'where':{'id':_0x1cc38b['params']['id']},'include':[{'model':db['Pause'],'as':_0x39de('0x3b')}]})[_0x39de('0x33')](handleEntityNotFound(_0x2abe15,null))[_0x39de('0x33')](saveUpdates(_0x1cc38b[_0x39de('0x59')],null))[_0x39de('0x33')](respondWithResult(_0x2abe15,null))[_0x39de('0x27')](handleError(_0x2abe15,null));};exports['destroy']=function(_0x5b8ba1,_0x4baf4f){return db[_0x39de('0x3c')][_0x39de('0x57')]({'where':{'id':_0x5b8ba1[_0x39de('0x60')]['id']}})[_0x39de('0x33')](handleEntityNotFound(_0x4baf4f,null))[_0x39de('0x33')](removeEntity(_0x4baf4f,null))[_0x39de('0x27')](handleError(_0x4baf4f,null));};exports[_0x39de('0x61')]=function(_0x389b84,_0x18e072){return db[_0x39de('0x3c')][_0x39de('0x61')]()['then'](respondWithResult(_0x18e072,null))['catch'](handleError(_0x18e072,null));};exports[_0x39de('0x62')]=function(_0x105324,_0x3c761d,_0x1ab17e){if(_0x105324[_0x39de('0x59')]['id']){delete _0x105324[_0x39de('0x59')]['id'];}return db[_0x39de('0x3c')][_0x39de('0x57')]({'where':{'id':_0x105324[_0x39de('0x60')]['id']}})[_0x39de('0x33')](handleEntityNotFound(_0x3c761d,null))[_0x39de('0x33')](function(_0x44e161){if(_0x44e161){_0x105324[_0x39de('0x59')][_0x39de('0x63')]=_0x44e161['id'];return db[_0x39de('0x64')][_0x39de('0x58')](_0x105324[_0x39de('0x59')]);}})['then'](respondWithResult(_0x3c761d,null))[_0x39de('0x27')](handleError(_0x3c761d,null));};exports[_0x39de('0x65')]=function(_0x3b25ac,_0x56b43f,_0x3fcdc7){var _0x2a2932={'raw':![],'where':{}};var _0x45d08b={};var _0xd4c13={'count':0x0,'rows':[]};return db[_0x39de('0x3c')][_0x39de('0x66')]({'where':{'id':_0x3b25ac[_0x39de('0x60')]['id']}})['then'](handleEntityNotFound(_0x56b43f,null))[_0x39de('0x33')](function(_0x266985){if(_0x266985){_0x45d08b[_0x39de('0x3e')]=_[_0x39de('0x3f')](db[_0x39de('0x64')][_0x39de('0x3d')]);_0x45d08b[_0x39de('0x40')]=_[_0x39de('0x3f')](_0x3b25ac[_0x39de('0x40')]);_0x45d08b[_0x39de('0x41')]=_[_0x39de('0x43')](_0x45d08b[_0x39de('0x3e')],_0x45d08b[_0x39de('0x40')]);_0x2a2932[_0x39de('0x42')]=_[_0x39de('0x43')](_0x45d08b[_0x39de('0x3e')],qs['fields'](_0x3b25ac['query']['fields']));_0x2a2932[_0x39de('0x42')]=_0x2a2932[_0x39de('0x42')][_0x39de('0x55')]?_0x2a2932[_0x39de('0x42')]:_0x45d08b[_0x39de('0x3e')];if(!_0x3b25ac[_0x39de('0x40')][_0x39de('0x45')]('nolimit')){_0x2a2932[_0x39de('0x2e')]=qs[_0x39de('0x2e')](_0x3b25ac['query'][_0x39de('0x2e')]);_0x2a2932[_0x39de('0x2d')]=qs[_0x39de('0x2d')](_0x3b25ac['query'][_0x39de('0x2d')]);}_0x2a2932[_0x39de('0x47')]=qs[_0x39de('0x48')](_0x3b25ac[_0x39de('0x40')][_0x39de('0x48')]);_0x2a2932[_0x39de('0x49')]=qs[_0x39de('0x41')](_['pick'](_0x3b25ac[_0x39de('0x40')],_0x45d08b[_0x39de('0x41')]));_0x2a2932[_0x39de('0x49')][_0x39de('0x67')]=_0x266985['id'];if(_0x3b25ac[_0x39de('0x40')][_0x39de('0x4b')]){_0x2a2932[_0x39de('0x49')]=_[_0x39de('0x4f')](_0x2a2932['where'],{'$or':_['map'](_0x2a2932[_0x39de('0x42')],function(_0xf2e7c1){var _0x2bc101={};_0x2bc101[_0xf2e7c1]={'$like':'%'+_0x3b25ac['query'][_0x39de('0x4b')]+'%'};return _0x2bc101;})});}_0x2a2932=_[_0x39de('0x4f')]({},_0x2a2932,_0x3b25ac['options']);return db[_0x39de('0x64')][_0x39de('0x2c')]({'where':_0x2a2932['where']})[_0x39de('0x33')](function(_0x1deb1a){_0xd4c13[_0x39de('0x2c')]=_0x1deb1a;if(_0x3b25ac[_0x39de('0x40')]['includeAll']){_0x2a2932[_0x39de('0x51')]=[{'all':!![]}];}return db['Disposition'][_0x39de('0x52')](_0x2a2932);})['then'](function(_0x451025){_0xd4c13[_0x39de('0x53')]=_0x451025;return _0xd4c13;});}})['then'](respondWithFilteredResult(_0x56b43f,_0x2a2932))[_0x39de('0x27')](handleError(_0x56b43f,null));};exports[_0x39de('0x68')]=function(_0x1c0243,_0x5812e6,_0x11a5f4){var _0x451e5d;return db['OpenchannelAccount'][_0x39de('0x57')]({'where':{'id':_0x1c0243[_0x39de('0x60')]['id']}})[_0x39de('0x33')](handleEntityNotFound(_0x5812e6,null))[_0x39de('0x33')](function(_0x2ae063){if(_0x2ae063){return _0x2ae063[_0x39de('0x68')](_0x1c0243[_0x39de('0x40')][_0x39de('0x69')]);}})[_0x39de('0x33')](respondWithStatusCode(_0x5812e6,null))[_0x39de('0x27')](handleError(_0x5812e6,null));};exports[_0x39de('0x6a')]=function(_0x5a5ddf,_0x1fff35,_0x5e31f7){if(_0x5a5ddf[_0x39de('0x59')]['id']){delete _0x5a5ddf['body']['id'];}return db[_0x39de('0x3c')][_0x39de('0x57')]({'where':{'id':_0x5a5ddf['params']['id']}})[_0x39de('0x33')](handleEntityNotFound(_0x1fff35,null))[_0x39de('0x33')](function(_0x31bec6){if(_0x31bec6){_0x5a5ddf[_0x39de('0x59')]['OpenchannelAccountId']=_0x31bec6['id'];return db[_0x39de('0x6b')][_0x39de('0x58')](_0x5a5ddf[_0x39de('0x59')]);}})['then'](respondWithResult(_0x1fff35,null))[_0x39de('0x27')](handleError(_0x1fff35,null));};exports[_0x39de('0x6c')]=function(_0x21dffb,_0x2f595f,_0x159189){var _0x14cd4f={'raw':![],'where':{}};var _0x48b916={};var _0x57f085={'count':0x0,'rows':[]};return db[_0x39de('0x3c')][_0x39de('0x66')]({'where':{'id':_0x21dffb[_0x39de('0x60')]['id']}})[_0x39de('0x33')](handleEntityNotFound(_0x2f595f,null))[_0x39de('0x33')](function(_0x2c362c){if(_0x2c362c){_0x48b916[_0x39de('0x3e')]=_[_0x39de('0x3f')](db[_0x39de('0x6b')][_0x39de('0x3d')]);_0x48b916[_0x39de('0x40')]=_[_0x39de('0x3f')](_0x21dffb[_0x39de('0x40')]);_0x48b916[_0x39de('0x41')]=_[_0x39de('0x43')](_0x48b916[_0x39de('0x3e')],_0x48b916[_0x39de('0x40')]);_0x14cd4f[_0x39de('0x42')]=_[_0x39de('0x43')](_0x48b916[_0x39de('0x3e')],qs[_0x39de('0x44')](_0x21dffb[_0x39de('0x40')]['fields']));_0x14cd4f[_0x39de('0x42')]=_0x14cd4f['attributes'][_0x39de('0x55')]?_0x14cd4f[_0x39de('0x42')]:_0x48b916[_0x39de('0x3e')];if(!_0x21dffb['query'][_0x39de('0x45')]('nolimit')){_0x14cd4f[_0x39de('0x2e')]=qs[_0x39de('0x2e')](_0x21dffb[_0x39de('0x40')][_0x39de('0x2e')]);_0x14cd4f[_0x39de('0x2d')]=qs[_0x39de('0x2d')](_0x21dffb[_0x39de('0x40')][_0x39de('0x2d')]);}_0x14cd4f[_0x39de('0x47')]=qs[_0x39de('0x48')](_0x21dffb[_0x39de('0x40')]['sort']);_0x14cd4f[_0x39de('0x49')]=qs[_0x39de('0x41')](_[_0x39de('0x4a')](_0x21dffb[_0x39de('0x40')],_0x48b916[_0x39de('0x41')]));_0x14cd4f[_0x39de('0x49')]['OpenchannelAccountId']=_0x2c362c['id'];if(_0x21dffb[_0x39de('0x40')][_0x39de('0x4b')]){_0x14cd4f[_0x39de('0x49')]=_[_0x39de('0x4f')](_0x14cd4f[_0x39de('0x49')],{'$or':_[_0x39de('0x4c')](_0x14cd4f[_0x39de('0x42')],function(_0x3c4709){var _0x343ead={};_0x343ead[_0x3c4709]={'$like':'%'+_0x21dffb[_0x39de('0x40')][_0x39de('0x4b')]+'%'};return _0x343ead;})});}_0x14cd4f=_[_0x39de('0x4f')]({},_0x14cd4f,_0x21dffb['options']);return db[_0x39de('0x6b')]['count']({'where':_0x14cd4f[_0x39de('0x49')]})[_0x39de('0x33')](function(_0x428ecc){_0x57f085['count']=_0x428ecc;if(_0x21dffb[_0x39de('0x40')]['includeAll']){_0x14cd4f[_0x39de('0x51')]=[{'all':!![]}];}return db[_0x39de('0x6b')][_0x39de('0x52')](_0x14cd4f);})[_0x39de('0x33')](function(_0x596c62){_0x57f085['rows']=_0x596c62;return _0x57f085;});}})[_0x39de('0x33')](respondWithFilteredResult(_0x2f595f,_0x14cd4f))[_0x39de('0x27')](handleError(_0x2f595f,null));};exports[_0x39de('0x6d')]=function(_0x1d5ccb,_0x4caa7d,_0x1bb251){var _0x2781d7;return db[_0x39de('0x3c')][_0x39de('0x57')]({'where':{'id':_0x1d5ccb[_0x39de('0x60')]['id']}})['then'](handleEntityNotFound(_0x4caa7d,null))[_0x39de('0x33')](function(_0x58115e){if(_0x58115e){return _0x58115e['removeAnswers'](_0x1d5ccb[_0x39de('0x40')]['ids']);}})[_0x39de('0x33')](respondWithStatusCode(_0x4caa7d,null))['catch'](handleError(_0x4caa7d,null));};exports[_0x39de('0x6e')]=function(_0x5bd475,_0x41bfd8,_0x92c7f8){var _0x8b6526={'body':_0x5bd475[_0x39de('0x59')],'channel':_0x39de('0x6f')};var _0x33716f=[];var _0x555a2e=[];var _0x6d98ac={};var _0x158f5f=![];return db['CmContact'][_0x39de('0x61')]()[_0x39de('0x33')](function(_0x45ce2c){if(!_0x45ce2c){throw new db['Sequelize'][(_0x39de('0x70'))](_0x39de('0x71'));}_0x33716f=_['difference'](_[_0x39de('0x3f')](_0x45ce2c),['createdAt',_0x39de('0x72')]);_0x555a2e=_['difference'](_['keys'](_0x45ce2c),[_0x39de('0x73'),_0x39de('0x72'),_0x39de('0x74'),_0x39de('0x75')]);if(_0x5bd475[_0x39de('0x59')]['id']){delete _0x5bd475[_0x39de('0x59')]['id'];}if(_['isNil'](_0x5bd475[_0x39de('0x59')][_0x39de('0x76')])){throw new db[(_0x39de('0x77'))][(_0x39de('0x70'))](_0x39de('0x78'));}if(_[_0x39de('0x79')](_0x5bd475[_0x39de('0x59')][_0x39de('0x59')])||_0x5bd475['body'][_0x39de('0x59')]===''){throw new db['Sequelize'][(_0x39de('0x70'))](_0x39de('0x7a'));}if(_[_0x39de('0x79')](_0x5bd475[_0x39de('0x59')][_0x39de('0x7b')])){throw new db[(_0x39de('0x77'))]['ValidationError'](_0x39de('0x7c')+_0x555a2e);}if(!_[_0x39de('0x7d')](_0x555a2e,_0x5bd475[_0x39de('0x59')][_0x39de('0x7b')])){throw new db[(_0x39de('0x77'))]['ValidationError'](_0x39de('0x7e')+_0x555a2e);}_0x6d98ac[_0x5bd475[_0x39de('0x59')][_0x39de('0x7b')]]=_0x5bd475['body']['from'];})[_0x39de('0x33')](function(){return db['OpenchannelAccount'][_0x39de('0x57')]({'where':{'id':_0x5bd475['params']['id']},'include':[{'model':db[_0x39de('0x7f')],'as':_0x39de('0x80'),'include':[{'model':db[_0x39de('0x81')],'as':_0x39de('0x82'),'where':_0x6d98ac,'limit':0x1,'order':[[_0x39de('0x72'),_0x39de('0x83')]]}]},{'model':db[_0x39de('0x84')],'as':_0x39de('0x85')}]});})[_0x39de('0x33')](handleEntityNotFound(_0x41bfd8,null))[_0x39de('0x33')](function(_0x272b3c){if(_0x272b3c&&_0x272b3c[_0x39de('0x80')]){_0x8b6526['account']=_0x272b3c;_0x8b6526[_0x39de('0x86')]=_0x272b3c['Applications'];_0x8b6526[_0x39de('0x87')]=_0x272b3c[_0x39de('0x80')];_0x8b6526['applications']=_[_0x39de('0x88')](_0x8b6526[_0x39de('0x86')],[_0x39de('0x89')],['asc']);if(_0x8b6526[_0x39de('0x8a')][_0x39de('0x85')]){delete _0x8b6526[_0x39de('0x8a')][_0x39de('0x85')];}if(_0x8b6526['account']['List']&&_0x8b6526[_0x39de('0x8a')][_0x39de('0x80')][_0x39de('0x82')]['length']){return _0x8b6526[_0x39de('0x8a')][_0x39de('0x80')][_0x39de('0x82')][0x0];}var _0x5bc122=_['defaults'](_0x5bd475[_0x39de('0x59')],{'firstName':_0x5bd475[_0x39de('0x59')]['from'],'ListId':_0x272b3c['ListId']});_0x5bc122[_0x5bd475[_0x39de('0x59')][_0x39de('0x7b')]]=_0x5bd475[_0x39de('0x59')][_0x39de('0x76')];return db[_0x39de('0x81')][_0x39de('0x58')](_0x5bc122,{'fields':_0x33716f,'raw':!![]});}})[_0x39de('0x33')](handleEntityNotFound(_0x41bfd8,null))[_0x39de('0x33')](function(_0x39131d){_0x8b6526[_0x39de('0x8b')]=_0x39131d;if(_0x39131d){var _0x5620b8={'ContactId':_0x39131d['id'],'OpenchannelAccountId':_0x5bd475['params']['id'],'from':(_0x39131d[_0x39de('0x8c')]||'')+'\x20'+(_0x39131d[_0x39de('0x8d')]||'')};var _0x3348b8={'OpenchannelAccountId':_0x5bd475[_0x39de('0x60')]['id'],'closed':![]};if(_0x5bd475[_0x39de('0x59')][_0x39de('0x8e')]){_0x3348b8['threadId']=_0x5bd475[_0x39de('0x59')]['threadId'];return db[_0x39de('0x8f')][_0x39de('0x57')]({'where':_0x3348b8})[_0x39de('0x33')](function(_0x38760e){if(_0x38760e){return[_0x38760e,![]];}_0x5620b8['threadId']=_0x5bd475[_0x39de('0x59')][_0x39de('0x8e')];_0x5620b8[_0x39de('0x90')]=_0x5bd475['body'][_0x39de('0x90')];return db[_0x39de('0x8f')]['create'](_0x5620b8)[_0x39de('0x33')](function(_0x403dbf){return[_0x403dbf,!![]];});});}else{_0x3348b8[_0x39de('0x8e')]=null;}_0x3348b8[_0x39de('0x91')]=_0x39131d['id'];return db[_0x39de('0x8f')][_0x39de('0x57')]({'where':_0x3348b8})[_0x39de('0x33')](function(_0x353e5a){if(_0x353e5a){return[_0x353e5a,![]];}return db[_0x39de('0x8f')]['create'](_0x5620b8)[_0x39de('0x33')](function(_0x7162d3){return[_0x7162d3,!![]];});});}})[_0x39de('0x92')](function(_0x5caf28,_0x1ef77e){if(_0x5caf28){_0x158f5f=_0x1ef77e;if(!_0x1ef77e){var _0x444f5e={'from':(_0x8b6526[_0x39de('0x8b')][_0x39de('0x8c')]||'')+'\x20'+(_0x8b6526[_0x39de('0x8b')]['lastName']||'')};if(_0x5bd475[_0x39de('0x59')][_0x39de('0x8e')]&&_0x5bd475[_0x39de('0x59')][_0x39de('0x93')]&&_0x5bd475[_0x39de('0x59')][_0x39de('0x8e')]!=_0x5bd475[_0x39de('0x59')]['messageId']){_0x444f5e[_0x39de('0x8e')]=_0x5bd475[_0x39de('0x59')]['messageId'];}return _0x5caf28[_0x39de('0x32')](_0x444f5e);}else{return _0x5caf28;}}})[_0x39de('0x33')](function(_0x544dc6){_0x8b6526[_0x39de('0x94')]=_0x544dc6[_0x39de('0x35')]({'plain':!![]});_0x8b6526[_0x39de('0x94')][_0x39de('0x95')]=_0x158f5f;if(_0x8b6526[_0x39de('0x94')][_0x39de('0x95')]){if(_0x8b6526[_0x39de('0x8a')][_0x39de('0x96')]){_0x8b6526[_0x39de('0x86')]['push']({'id':0x0,'priority':_0x8b6526[_0x39de('0x86')][_0x39de('0x55')]+0x1,'app':_0x39de('0x97'),'appdata':_0x39de('0x98'),'interval':_0x39de('0x99')});}}return db[_0x39de('0x9a')]['create']({'body':_0x5bd475[_0x39de('0x59')]['body'],'OpenchannelAccountId':_0x5bd475[_0x39de('0x60')]['id'],'OpenchannelInteractionId':_0x544dc6['id'],'direction':'in','ContactId':_0x8b6526['contact']['id'],'AttachmentId':_0x5bd475['body'][_0x39de('0x9b')]});})[_0x39de('0x33')](function(_0x3e494d){_0x8b6526[_0x39de('0x25')]=_0x3e494d;if(_0x8b6526['interaction'][_0x39de('0x9c')]){return db[_0x39de('0x9d')][_0x39de('0x57')]({'attributes':['id',_0x39de('0x37')],'where':{'id':_0x8b6526[_0x39de('0x94')][_0x39de('0x9c')]}})['then'](function(_0xc30859){if(_0xc30859){_0x8b6526[_0x39de('0x86')][_0x39de('0x9e')]({'id':0x0,'priority':0x0,'app':_0x39de('0x9f'),'appdata':_0xc30859['name']+','+(_0x8b6526[_0x39de('0x8a')]['waitForTheAssignedAgent']||0xa),'interval':_0x39de('0x99')});_0x8b6526[_0x39de('0xa0')]=![];}return respondWithRpcPromise('Start','startRouting',_0x8b6526);});}return respondWithRpcPromise(_0x39de('0xa1'),'startRouting',_0x8b6526);})[_0x39de('0x33')](function(_0x4cd462){respondWithRpcPromise(_0x39de('0xa2'),_0x39de('0xa2'),{'event':_0x39de('0x6e'),'message':_0x4cd462},client9002);return _0x4cd462;})['then'](respondWithResult(_0x41bfd8,null))[_0x39de('0x27')](handleError(_0x41bfd8,null));};exports[_0x39de('0xa3')]=function(_0x59752a,_0x1b1cb9,_0xfa86c){return db['OpenchannelAccount'][_0x39de('0x66')]({'where':{'id':_0x59752a[_0x39de('0x60')]['id']}})['then'](handleEntityNotFound(_0x1b1cb9,null))['then'](function(_0x111402){if(_0x111402){return db['sequelize'][_0x39de('0xa4')](function(_0x4ece32){return db['OpenchannelApplication'][_0x39de('0x34')]({'where':{'OpenchannelAccountId':_0x59752a[_0x39de('0x60')]['id']},'transaction':_0x4ece32})[_0x39de('0x33')](function(_0x214f50){var _0x9fa176=_['map'](_0x59752a[_0x39de('0x59')],function(_0x3763de){_0x3763de[_0x39de('0x67')]=_0x59752a[_0x39de('0x60')]['id'];return _0x3763de;});return db['OpenchannelApplication'][_0x39de('0xa5')](_0x9fa176,{'transaction':_0x4ece32});});})[_0x39de('0x33')](function(){return db[_0x39de('0x84')][_0x39de('0xa6')]({'where':{'OpenchannelAccountId':_0x59752a[_0x39de('0x60')]['id']},'order':'priority'});});}})[_0x39de('0x33')](respondWithResult(_0x1b1cb9,null))[_0x39de('0x27')](handleError(_0x1b1cb9,null));};exports[_0x39de('0xa7')]=function(_0x1cb2f3,_0x5179d9,_0x443809){var _0x279368={};var _0x170ae8={};var _0x775777;var _0x25005;return db[_0x39de('0x3c')][_0x39de('0x66')]({'where':{'id':_0x1cb2f3[_0x39de('0x60')]['id']}})[_0x39de('0x33')](handleEntityNotFound(_0x5179d9,null))[_0x39de('0x33')](function(_0x57513d){if(_0x57513d){_0x775777=_0x57513d;_0x170ae8[_0x39de('0x3e')]=_['keys'](db[_0x39de('0x84')]['rawAttributes']);_0x170ae8[_0x39de('0x40')]=_[_0x39de('0x3f')](_0x1cb2f3['query']);_0x170ae8['filters']=_[_0x39de('0x43')](_0x170ae8[_0x39de('0x3e')],_0x170ae8[_0x39de('0x40')]);_0x279368[_0x39de('0x42')]=_['intersection'](_0x170ae8[_0x39de('0x3e')],qs[_0x39de('0x44')](_0x1cb2f3['query'][_0x39de('0x44')]));_0x279368[_0x39de('0x42')]=_0x279368['attributes']['length']?_0x279368['attributes']:_0x170ae8[_0x39de('0x3e')];_0x279368[_0x39de('0x47')]=qs[_0x39de('0x48')](_0x1cb2f3[_0x39de('0x40')]['sort']);_0x279368['where']=qs['filters'](_[_0x39de('0x4a')](_0x1cb2f3[_0x39de('0x40')],_0x170ae8['filters']));if(_0x1cb2f3[_0x39de('0x40')][_0x39de('0x4b')]){_0x279368[_0x39de('0x49')]=_[_0x39de('0x4f')](_0x279368[_0x39de('0x49')],{'$or':_[_0x39de('0x4c')](_0x279368[_0x39de('0x42')],function(_0x3fded6){var _0x1a28da={};_0x1a28da[_0x3fded6]={'$like':'%'+_0x1cb2f3[_0x39de('0x40')][_0x39de('0x4b')]+'%'};return _0x1a28da;})});}_0x279368=_[_0x39de('0x4f')]({},_0x279368,_0x1cb2f3[_0x39de('0x56')]);return _0x775777[_0x39de('0xa7')](_0x279368);}})[_0x39de('0x33')](function(_0x32e04c){if(_0x32e04c){_0x25005=_0x32e04c['length'];if(!_0x1cb2f3[_0x39de('0x40')][_0x39de('0x45')](_0x39de('0x46'))){_0x279368['limit']=qs[_0x39de('0x2e')](_0x1cb2f3[_0x39de('0x40')]['limit']);_0x279368[_0x39de('0x2d')]=qs[_0x39de('0x2d')](_0x1cb2f3[_0x39de('0x40')][_0x39de('0x2d')]);}return _0x775777[_0x39de('0xa7')](_0x279368);}})[_0x39de('0x33')](function(_0x3243b4){if(_0x3243b4){return _0x3243b4?{'count':_0x25005,'rows':_0x3243b4}:null;}})[_0x39de('0x33')](respondWithResult(_0x5179d9,null))['catch'](handleError(_0x5179d9,null));};exports[_0x39de('0xa8')]=function(_0x5b012b,_0x597684,_0x43753f){var _0x4091e4={'raw':![],'where':{}};var _0x41b540={};var _0x249dec={'count':0x0,'rows':[]};return db[_0x39de('0x3c')][_0x39de('0x66')]({'where':{'id':_0x5b012b['params']['id']}})['then'](handleEntityNotFound(_0x597684,null))[_0x39de('0x33')](function(_0xc3bf0d){if(_0xc3bf0d){_0x41b540[_0x39de('0x3e')]=_[_0x39de('0x3f')](db['OpenchannelInteraction'][_0x39de('0x3d')]);_0x41b540['query']=_['keys'](_0x5b012b['query']);_0x41b540['filters']=_[_0x39de('0x43')](_0x41b540[_0x39de('0x3e')],_0x41b540[_0x39de('0x40')]);_0x4091e4['attributes']=_[_0x39de('0x43')](_0x41b540[_0x39de('0x3e')],qs[_0x39de('0x44')](_0x5b012b[_0x39de('0x40')][_0x39de('0x44')]));_0x4091e4[_0x39de('0x42')]=_0x4091e4[_0x39de('0x42')][_0x39de('0x55')]?_0x4091e4[_0x39de('0x42')]:_0x41b540[_0x39de('0x3e')];if(!_0x5b012b[_0x39de('0x40')][_0x39de('0x45')](_0x39de('0x46'))){_0x4091e4[_0x39de('0x2e')]=qs[_0x39de('0x2e')](_0x5b012b[_0x39de('0x40')][_0x39de('0x2e')]);_0x4091e4['offset']=qs[_0x39de('0x2d')](_0x5b012b[_0x39de('0x40')][_0x39de('0x2d')]);}_0x4091e4[_0x39de('0x47')]=qs[_0x39de('0x48')](_0x5b012b['query']['sort']);_0x4091e4[_0x39de('0x49')]=qs[_0x39de('0x41')](_[_0x39de('0x4a')](_0x5b012b[_0x39de('0x40')],_0x41b540[_0x39de('0x41')]));_0x4091e4[_0x39de('0x49')][_0x39de('0x67')]=_0xc3bf0d['id'];if(_0x5b012b[_0x39de('0x40')]['filter']){_0x4091e4[_0x39de('0x49')]=_[_0x39de('0x4f')](_0x4091e4[_0x39de('0x49')],{'$or':_[_0x39de('0x4c')](_0x4091e4[_0x39de('0x42')],function(_0xaaf26b){var _0x2871a0={};_0x2871a0[_0xaaf26b]={'$like':'%'+_0x5b012b['query'][_0x39de('0x4b')]+'%'};return _0x2871a0;})});}_0x4091e4=_['merge']({},_0x4091e4,_0x5b012b[_0x39de('0x56')]);return db['OpenchannelInteraction'][_0x39de('0x2c')]({'where':_0x4091e4[_0x39de('0x49')]})['then'](function(_0x33008b){_0x249dec[_0x39de('0x2c')]=_0x33008b;if(_0x5b012b[_0x39de('0x40')][_0x39de('0x50')]){_0x4091e4[_0x39de('0x51')]=[{'model':db[_0x39de('0x81')],'as':_0x39de('0xa9'),'required':![]},{'model':db[_0x39de('0x9d')],'as':_0x39de('0xaa'),'attributes':[_0x39de('0x37'),_0x39de('0xab'),_0x39de('0xac')],'required':![]},{'model':db['Tag'],'as':_0x39de('0xad'),'attributes':['id','name',_0x39de('0xae')],'where':_0x5b012b[_0x39de('0x40')]['tag']?{'id':_0x5b012b['query']['tag']}:undefined,'required':_0x5b012b[_0x39de('0x40')][_0x39de('0xaf')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x39de('0x52')](_0x4091e4);})['then'](function(_0x420375){_0x249dec[_0x39de('0x53')]=_0x420375;return _0x249dec;});}})[_0x39de('0x33')](respondWithFilteredResult(_0x597684,_0x4091e4))['catch'](handleError(_0x597684,null));};exports[_0x39de('0xb0')]=function(_0x9c58d2,_0x42a652,_0x2a86c8){return db[_0x39de('0x3c')]['find']({'where':{'id':_0x9c58d2[_0x39de('0x60')]['id']}})[_0x39de('0x33')](handleEntityNotFound(_0x42a652,null))[_0x39de('0x33')](function(_0x18123d){if(_0x18123d){return _0x18123d[_0x39de('0xb0')](_0x9c58d2['body'][_0x39de('0x69')],_[_0x39de('0xb1')](_0x9c58d2[_0x39de('0x59')],[_0x39de('0x69'),'id'])||{})['spread'](function(_0x10b295){for(var _0x23043b=0x0;_0x23043b<_0x9c58d2[_0x39de('0x59')]['ids'][_0x39de('0x55')];_0x23043b+=0x1){socket['emit'](_0x39de('0xb2'),{'UserId':_0x9c58d2[_0x39de('0x59')][_0x39de('0x69')][_0x23043b],'OpenchannelAccountId':_0x9c58d2['params']['id']});}return _0x10b295;});}})[_0x39de('0x33')](respondWithResult(_0x42a652,null))[_0x39de('0x27')](handleError(_0x42a652,null));};exports[_0x39de('0xb3')]=function(_0x2415f2,_0x9d8688,_0x1d6855){var _0x2506af;return db[_0x39de('0x3c')][_0x39de('0x57')]({'where':{'id':_0x2415f2['params']['id']}})[_0x39de('0x33')](handleEntityNotFound(_0x9d8688,null))[_0x39de('0x33')](function(_0x2cfcac){if(_0x2cfcac){return _0x2cfcac[_0x39de('0xb3')](_0x2415f2[_0x39de('0x40')][_0x39de('0x69')])[_0x39de('0x33')](function(_0x159e1a){if(_[_0x39de('0xb4')](_0x2415f2[_0x39de('0x40')]['ids'])){for(var _0x238e70=0x0;_0x238e70<_0x2415f2['query']['ids'][_0x39de('0x55')];_0x238e70+=0x1){socket[_0x39de('0xb5')](_0x39de('0xb6'),{'UserId':_0x2415f2[_0x39de('0x40')][_0x39de('0x69')][_0x238e70],'OpenchannelAccountId':_0x2415f2[_0x39de('0x60')]['id']});}}else{socket['emit'](_0x39de('0xb6'),{'UserId':_0x2415f2[_0x39de('0x40')]['ids'],'OpenchannelAccountId':_0x2415f2[_0x39de('0x60')]['id']});}});}})[_0x39de('0x33')](respondWithStatusCode(_0x9d8688,null))[_0x39de('0x27')](handleError(_0x9d8688,null));};exports[_0x39de('0xb7')]=function(_0xeb85f9,_0x469d46,_0x2b955b){var _0x48f649={};var _0x39b005={};var _0x3f977a;var _0x21f83f;return db['OpenchannelAccount'][_0x39de('0x66')]({'where':{'id':_0xeb85f9[_0x39de('0x60')]['id']}})[_0x39de('0x33')](handleEntityNotFound(_0x469d46,null))['then'](function(_0x4183a3){if(_0x4183a3){_0x3f977a=_0x4183a3;_0x39b005[_0x39de('0x3e')]=_[_0x39de('0x3f')](db[_0x39de('0x9d')]['rawAttributes']);_0x39b005[_0x39de('0x40')]=_[_0x39de('0x3f')](_0xeb85f9['query']);_0x39b005['filters']=_[_0x39de('0x43')](_0x39b005['model'],_0x39b005['query']);_0x48f649['attributes']=_['intersection'](_0x39b005[_0x39de('0x3e')],qs['fields'](_0xeb85f9[_0x39de('0x40')][_0x39de('0x44')]));_0x48f649['attributes']=_0x48f649[_0x39de('0x42')]['length']?_0x48f649[_0x39de('0x42')]:_0x39b005['model'];_0x48f649[_0x39de('0x47')]=qs['sort'](_0xeb85f9[_0x39de('0x40')][_0x39de('0x48')]);_0x48f649[_0x39de('0x49')]=qs['filters'](_['pick'](_0xeb85f9[_0x39de('0x40')],_0x39b005[_0x39de('0x41')]));if(_0xeb85f9['query']['filter']){_0x48f649['where']=_[_0x39de('0x4f')](_0x48f649[_0x39de('0x49')],{'$or':_[_0x39de('0x4c')](_0x48f649[_0x39de('0x42')],function(_0x4832e0){var _0x3df1d0={};_0x3df1d0[_0x4832e0]={'$like':'%'+_0xeb85f9['query'][_0x39de('0x4b')]+'%'};return _0x3df1d0;})});}_0x48f649=_['merge']({},_0x48f649,_0xeb85f9[_0x39de('0x56')]);return _0x3f977a[_0x39de('0xb7')](_0x48f649);}})[_0x39de('0x33')](function(_0x3919a5){if(_0x3919a5){_0x21f83f=_0x3919a5['length'];if(!_0xeb85f9['query'][_0x39de('0x45')]('nolimit')){_0x48f649['limit']=qs[_0x39de('0x2e')](_0xeb85f9['query']['limit']);_0x48f649[_0x39de('0x2d')]=qs[_0x39de('0x2d')](_0xeb85f9['query']['offset']);}return _0x3f977a[_0x39de('0xb7')](_0x48f649);}})[_0x39de('0x33')](function(_0x5ae46f){if(_0x5ae46f){return _0x5ae46f?{'count':_0x21f83f,'rows':_0x5ae46f}:null;}})[_0x39de('0x33')](respondWithResult(_0x469d46,null))[_0x39de('0x27')](handleError(_0x469d46,null));};exports[_0x39de('0x38')]=function(_0x579052,_0x24fd12,_0x5cf4fa){var _0x204d7d,_0x32a8c9,_0x52424b;if(_[_0x39de('0x79')](_0x579052[_0x39de('0x59')][_0x39de('0x59')])||_0x579052[_0x39de('0x59')][_0x39de('0x59')]===''){throw new db['Sequelize'][(_0x39de('0x70'))](_0x39de('0x7a'));}if(_['isNil'](_0x579052[_0x39de('0x59')]['to'])){}_0x204d7d=_0x579052[_0x39de('0x59')]['to'];return db[_0x39de('0x3c')][_0x39de('0x66')]({'where':{'id':_0x579052[_0x39de('0x60')]['id']}})['then'](handleEntityNotFound(_0x24fd12,null))[_0x39de('0x33')](function(_0x370f69){if(_0x370f69){return db[_0x39de('0x3c')][_0x39de('0x57')]({'where':{'id':_0x370f69['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x39de('0x81')],'as':'Contacts','where':{[_0x370f69[_0x39de('0x7b')]]:_0x204d7d},'limit':0x1,'order':[[_0x39de('0x72'),_0x39de('0x83')]]}]}]})[_0x39de('0x33')](handleEntityNotFound(_0x24fd12,null))[_0x39de('0x33')](function(_0xe097d4){if(_0xe097d4&&_0xe097d4['List']){_0x32a8c9=_0xe097d4['get']({'plain':!![]});if(_0x32a8c9[_0x39de('0x80')]&&_0x32a8c9[_0x39de('0x80')][_0x39de('0x82')][_0x39de('0x55')]){return _0x32a8c9['List']['Contacts'][0x0];}return db[_0x39de('0x81')]['create'](_[_0x39de('0xb8')](_0x579052[_0x39de('0x59')],{'firstName':_0x204d7d,[_0xe097d4[_0x39de('0x7b')]]:_0x204d7d,'phone':_0x204d7d,'ListId':_0x32a8c9[_0x39de('0x75')]}));}})['then'](handleEntityNotFound(_0x24fd12,null))[_0x39de('0x33')](function(_0x4776dd){if(_0x4776dd){_0x52424b=_0x4776dd;return db['OpenchannelInteraction'][_0x39de('0x57')]({'where':{'ContactId':_0x52424b['id'],'closed':![],'OpenchannelAccountId':_0x32a8c9['id']}})[_0x39de('0x33')](function(_0x49c57e){if(_0x49c57e){return[_0x49c57e,![]];}return db[_0x39de('0x8f')][_0x39de('0x58')]({'UserId':_0x579052[_0x39de('0x5b')]['id'],'ContactId':_0x52424b['id'],'OpenchannelAccountId':_0x32a8c9['id'],'lastMsgDirection':'out','Messages':[_['merge'](_0x579052['body'],{'read':![],'body':_0x579052[_0x39de('0x59')][_0x39de('0x59')],'OpenchannelAccountId':_0x32a8c9['id'],'UserId':_0x579052['user']['id'],'ContactId':_0x52424b['id']})]},{'include':[{'model':db[_0x39de('0x9a')],'as':_0x39de('0xb9')}]})[_0x39de('0x33')](function(_0x1abbef){return[_0x1abbef,!![]];});});}})['spread'](function(_0x1ff5de,_0x5e7981){if(_0x5e7981){return _0x1ff5de;}return db['OpenchannelMessage'][_0x39de('0x58')](_[_0x39de('0x4f')](_0x579052[_0x39de('0x59')],{'read':![],'body':_0x579052[_0x39de('0x59')][_0x39de('0x59')],'OpenchannelAccountId':_0x32a8c9['id'],'OpenchannelInteractionId':_0x1ff5de['id'],'UserId':_0x579052[_0x39de('0x5b')]['id'],'ContactId':_0x52424b['id']}))[_0x39de('0x33')](function(_0x1f5f84){_0x1ff5de[_0x39de('0xba')]['Messages']=[];_0x1ff5de[_0x39de('0xba')][_0x39de('0xb9')]['push'](_0x1f5f84['dataValues']);return _0x1ff5de;});});}})[_0x39de('0x33')](respondWithResult(_0x24fd12,null))[_0x39de('0x27')](handleError(_0x24fd12,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 4484bc1..ae40887 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 _0xd8d0=['OpenchannelAccount','setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xd8d0,0x80));var _0x0d8d=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xd8d0[_0x1d1779];return _0x2377e9;};'use strict';var EventEmitter=require(_0x0d8d('0x0'));var OpenchannelAccount=require(_0x0d8d('0x1'))['db'][_0x0d8d('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x0d8d('0x3')](0x0);var events={'afterCreate':_0x0d8d('0x4'),'afterUpdate':_0x0d8d('0x5'),'afterDestroy':_0x0d8d('0x6')};function emitEvent(_0x909c71){return function(_0x6ba64c,_0x435d38,_0x5f1946){OpenchannelAccountEvents['emit'](_0x909c71+':'+_0x6ba64c['id'],_0x6ba64c);OpenchannelAccountEvents[_0x0d8d('0x7')](_0x909c71,_0x6ba64c);_0x5f1946(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x0d8d('0x8')](e,emitEvent(event));}}module[_0x0d8d('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x94ca=['hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit'];(function(_0x1bfb48,_0x2de37a){var _0x1f432a=function(_0x5d4b71){while(--_0x5d4b71){_0x1bfb48['push'](_0x1bfb48['shift']());}};_0x1f432a(++_0x2de37a);}(_0x94ca,0xde));var _0xa94c=function(_0x21a586,_0x1f0eed){_0x21a586=_0x21a586-0x0;var _0x173b57=_0x94ca[_0x21a586];return _0x173b57;};'use strict';var EventEmitter=require(_0xa94c('0x0'));var OpenchannelAccount=require(_0xa94c('0x1'))['db'][_0xa94c('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xa94c('0x3')](0x0);var events={'afterCreate':_0xa94c('0x4'),'afterUpdate':_0xa94c('0x5'),'afterDestroy':_0xa94c('0x6')};function emitEvent(_0x3464c4){return function(_0x332183,_0x2242f3,_0x4010bb){OpenchannelAccountEvents[_0xa94c('0x7')](_0x3464c4+':'+_0x332183['id'],_0x332183);OpenchannelAccountEvents[_0xa94c('0x7')](_0x3464c4,_0x332183);_0x4010bb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xa94c('0x8')](e,emitEvent(event));}}module[_0xa94c('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index f11c98d..89305c5 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 _0x8603=['util','../../config/logger','api','request-promise','./openchannelAccount.attributes','exports','OpenchannelAccount','openchannel_accounts'];(function(_0x4b893f,_0x12084b){var _0x4dbe80=function(_0x31dbd2){while(--_0x31dbd2){_0x4b893f['push'](_0x4b893f['shift']());}};_0x4dbe80(++_0x12084b);}(_0x8603,0x190));var _0x3860=function(_0x1cef67,_0x7311d5){_0x1cef67=_0x1cef67-0x0;var _0x1fa5bd=_0x8603[_0x1cef67];return _0x1fa5bd;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var logger=require(_0x3860('0x1'))(_0x3860('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3860('0x3'));var attributes=require(_0x3860('0x4'));module[_0x3860('0x5')]=function(_0x490262,_0x2fc97a){return _0x490262['define'](_0x3860('0x6'),attributes,{'tableName':_0x3860('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fc2=['./openchannelAccount.attributes','OpenchannelAccount','openchannel_accounts','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x374f26,_0x473bdf){var _0x288607=function(_0x4c6948){while(--_0x4c6948){_0x374f26['push'](_0x374f26['shift']());}};_0x288607(++_0x473bdf);}(_0x4fc2,0x111));var _0x24fc=function(_0x54ed8f,_0x53cdec){_0x54ed8f=_0x54ed8f-0x0;var _0x2557f0=_0x4fc2[_0x54ed8f];return _0x2557f0;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var logger=require(_0x24fc('0x2'))(_0x24fc('0x3'));var moment=require('moment');var BPromise=require(_0x24fc('0x4'));var rp=require(_0x24fc('0x5'));var attributes=require(_0x24fc('0x6'));module['exports']=function(_0x126d90,_0x3772eb){return _0x126d90['define'](_0x24fc('0x7'),attributes,{'tableName':_0x24fc('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 d9360cd..6febbe1 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 _0x1261=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util'];(function(_0x4b4e5f,_0x48c16){var _0x30617e=function(_0x2ac72f){while(--_0x2ac72f){_0x4b4e5f['push'](_0x4b4e5f['shift']());}};_0x30617e(++_0x48c16);}(_0x1261,0x144));var _0x1126=function(_0x280a2e,_0x244c6f){_0x280a2e=_0x280a2e-0x0;var _0x286f67=_0x1261[_0x280a2e];return _0x286f67;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});} \ No newline at end of file +var _0x7a54=['result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x39d3b0,_0x171354){_0x39d3b0=_0x39d3b0-0x0;var _0x3299ff=_0x7a54[_0x39d3b0];return _0x3299ff;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelAccount,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 96c6954..87d50d6 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 _0x840b=['save','update','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x147497,_0x43e433){var _0x35f45=function(_0x584421){while(--_0x584421){_0x147497['push'](_0x147497['shift']());}};_0x35f45(++_0x43e433);}(_0x840b,0x1cf));var _0xb840=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x840b[_0x15c421];return _0x5e5ed5;};'use strict';var OpenchannelAccountEvents=require(_0xb840('0x0'));var events=[_0xb840('0x1'),'remove',_0xb840('0x2')];function createListener(_0x32bd4c,_0x22c4ab){return function(_0x4cedf2){_0x22c4ab[_0xb840('0x3')](_0x32bd4c,_0x4cedf2);};}function removeListener(_0x1b5672,_0xdd20c2){return function(){OpenchannelAccountEvents[_0xb840('0x4')](_0x1b5672,_0xdd20c2);};}exports[_0xb840('0x5')]=function(_0x181840){for(var _0x5d6534=0x0,_0x51d075=events[_0xb840('0x6')];_0x5d6534<_0x51d075;_0x5d6534++){var _0x2d19fa=events[_0x5d6534];var _0x149b53=createListener(_0xb840('0x7')+_0x2d19fa,_0x181840);OpenchannelAccountEvents['on'](_0x2d19fa,_0x149b53);}}; \ No newline at end of file +var _0xe1e9=['./openchannelAccount.events','save','remove','emit','removeListener','register','length','openchannelAccount:'];(function(_0x500753,_0x1a74b7){var _0x5b9d96=function(_0x2083ae){while(--_0x2083ae){_0x500753['push'](_0x500753['shift']());}};_0x5b9d96(++_0x1a74b7);}(_0xe1e9,0xc8));var _0x9e1e=function(_0x3fd884,_0xc5883a){_0x3fd884=_0x3fd884-0x0;var _0x48893c=_0xe1e9[_0x3fd884];return _0x48893c;};'use strict';var OpenchannelAccountEvents=require(_0x9e1e('0x0'));var events=[_0x9e1e('0x1'),_0x9e1e('0x2'),'update'];function createListener(_0x109ff0,_0x263ee2){return function(_0x23bffb){_0x263ee2[_0x9e1e('0x3')](_0x109ff0,_0x23bffb);};}function removeListener(_0x4140c1,_0x331c7c){return function(){OpenchannelAccountEvents[_0x9e1e('0x4')](_0x4140c1,_0x331c7c);};}exports[_0x9e1e('0x5')]=function(_0x40d9ed){for(var _0x22df63=0x0,_0x236f64=events[_0x9e1e('0x6')];_0x22df63<_0x236f64;_0x22df63++){var _0x5cb740=events[_0x22df63];var _0xde6058=createListener(_0x9e1e('0x7')+_0x5cb740,_0x40d9ed);OpenchannelAccountEvents['on'](_0x5cb740,_0xde6058);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 9c1de7b..1ee8d2b 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 _0xef44=['get','/:id','isAuthenticated','post','create','put','update','delete','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','index'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xef44,0xe1));var _0x4ef4=function(_0x245f86,_0x1f9b4a){_0x245f86=_0x245f86-0x0;var _0x2b07b2=_0xef44[_0x245f86];return _0x2b07b2;};'use strict';var multer=require(_0x4ef4('0x0'));var util=require(_0x4ef4('0x1'));var path=require(_0x4ef4('0x2'));var timeout=require('connect-timeout');var express=require(_0x4ef4('0x3'));var router=express[_0x4ef4('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4ef4('0x5'));var config=require(_0x4ef4('0x6'));var controller=require(_0x4ef4('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4ef4('0x8')]);router[_0x4ef4('0x9')](_0x4ef4('0xa'),auth[_0x4ef4('0xb')](),controller['show']);router[_0x4ef4('0xc')]('/',auth[_0x4ef4('0xb')](),controller[_0x4ef4('0xd')]);router[_0x4ef4('0xe')](_0x4ef4('0xa'),auth[_0x4ef4('0xb')](),controller[_0x4ef4('0xf')]);router[_0x4ef4('0x10')](_0x4ef4('0xa'),auth[_0x4ef4('0xb')](),controller['destroy']);module[_0x4ef4('0x11')]=router; \ No newline at end of file +var _0x500e=['index','/:id','isAuthenticated','post','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get'];(function(_0x2b4895,_0x20c70a){var _0x569215=function(_0x26ddf4){while(--_0x26ddf4){_0x2b4895['push'](_0x2b4895['shift']());}};_0x569215(++_0x20c70a);}(_0x500e,0x1c0));var _0xe500=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x500e[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xe500('0x0'));var util=require(_0xe500('0x1'));var path=require(_0xe500('0x2'));var timeout=require(_0xe500('0x3'));var express=require(_0xe500('0x4'));var router=express[_0xe500('0x5')]();var auth=require(_0xe500('0x6'));var interaction=require(_0xe500('0x7'));var config=require(_0xe500('0x8'));var controller=require(_0xe500('0x9'));router[_0xe500('0xa')]('/',auth['isAuthenticated'](),controller[_0xe500('0xb')]);router[_0xe500('0xa')](_0xe500('0xc'),auth[_0xe500('0xd')](),controller['show']);router[_0xe500('0xe')]('/',auth[_0xe500('0xd')](),controller['create']);router['put'](_0xe500('0xc'),auth[_0xe500('0xd')](),controller['update']);router['delete']('/:id',auth[_0xe500('0xd')](),controller[_0xe500('0xf')]);module[_0xe500('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 0bb1fa3..b99762e 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 _0x3974=['STRING','*,*,*,*','sequelize','exports','INTEGER','TEXT'];(function(_0x537070,_0xe93bf2){var _0x249d38=function(_0x239d9b){while(--_0x239d9b){_0x537070['push'](_0x537070['shift']());}};_0x249d38(++_0xe93bf2);}(_0x3974,0xbc));var _0x4397=function(_0x983ed0,_0x15a5c8){_0x983ed0=_0x983ed0-0x0;var _0x29ec35=_0x3974[_0x983ed0];return _0x29ec35;};'use strict';var Sequelize=require(_0x4397('0x0'));module[_0x4397('0x1')]={'priority':{'type':Sequelize[_0x4397('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x4397('0x3')]()},'description':{'type':Sequelize[_0x4397('0x4')]},'interval':{'type':Sequelize[_0x4397('0x4')],'defaultValue':_0x4397('0x5')}}; \ No newline at end of file +var _0xe75a=['noop','*,*,*,*','exports','INTEGER','STRING'];(function(_0x5b4aff,_0x3426d0){var _0xd7ccff=function(_0x595f16){while(--_0x595f16){_0x5b4aff['push'](_0x5b4aff['shift']());}};_0xd7ccff(++_0x3426d0);}(_0xe75a,0x115));var _0xae75=function(_0x334599,_0x4b1cfa){_0x334599=_0x334599-0x0;var _0x4cdff2=_0xe75a[_0x334599];return _0x4cdff2;};'use strict';var Sequelize=require('sequelize');module[_0xae75('0x0')]={'priority':{'type':Sequelize[_0xae75('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xae75('0x2')],'allowNull':![],'defaultValue':_0xae75('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xae75('0x2')]},'interval':{'type':Sequelize[_0xae75('0x2')],'defaultValue':_0xae75('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 287cea7..a33e4c8 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 _0x53ff=['ioredis','api','../../config/utils','../../mysqldb','sendStatus','status','count','limit','Content-Range','json','reject','save','update','then','end','error','stack','name','send','index','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','key','VIRTUAL','OpenchannelApplication','include','findAll','catch','show','params','rawAttributes','includeAll','options','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x214d9a,_0x45f5f1){var _0x1d2fe3=function(_0x28a24a){while(--_0x28a24a){_0x214d9a['push'](_0x214d9a['shift']());}};_0x1d2fe3(++_0x45f5f1);}(_0x53ff,0x105));var _0xf53f=function(_0x29b8e3,_0x508f07){_0x29b8e3=_0x29b8e3-0x0;var _0x4039f0=_0x53ff[_0x29b8e3];return _0x4039f0;};'use strict';var pdf=require(_0xf53f('0x0'));var emlformat=require(_0xf53f('0x1'));var rimraf=require(_0xf53f('0x2'));var zipdir=require(_0xf53f('0x3'));var jsonpatch=require(_0xf53f('0x4'));var rp=require('request-promise');var moment=require(_0xf53f('0x5'));var BPromise=require(_0xf53f('0x6'));var Mustache=require('mustache');var util=require(_0xf53f('0x7'));var path=require(_0xf53f('0x8'));var sox=require(_0xf53f('0x9'));var csv=require(_0xf53f('0xa'));var ejs=require(_0xf53f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf53f('0xc'));var crypto=require(_0xf53f('0xd'));var jsforce=require(_0xf53f('0xe'));var deskjs=require(_0xf53f('0xf'));var toCsv=require(_0xf53f('0xa'));var querystring=require(_0xf53f('0x10'));var Papa=require(_0xf53f('0x11'));var authService=require(_0xf53f('0x12'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xf53f('0x13'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xf53f('0x14'));var utils=require(_0xf53f('0x15'));var config=require('../../config/environment');var db=require(_0xf53f('0x16'))['db'];function respondWithStatusCode(_0x2c8892,_0x55af24){_0x55af24=_0x55af24||0xcc;return function(_0xef8f18){if(_0xef8f18){return _0x2c8892[_0xf53f('0x17')](_0x55af24);}return _0x2c8892[_0xf53f('0x18')](_0x55af24)['end']();};}function respondWithResult(_0xce4c89,_0x2d6663){_0x2d6663=_0x2d6663||0xc8;return function(_0x44fec2){if(_0x44fec2){return _0xce4c89['status'](_0x2d6663)['json'](_0x44fec2);}};}function respondWithFilteredResult(_0x21a5a5,_0x341829){return function(_0x58e81c){if(_0x58e81c){var _0x2e8390=_0x58e81c[_0xf53f('0x19')],_0x2b0b8d=_0x341829['offset'],_0x47a230=_0x341829['offset']+_0x341829[_0xf53f('0x1a')],_0x4f0e12;if(_0x47a230>=_0x2e8390){_0x47a230=_0x2e8390;_0x4f0e12=0xc8;}else{_0x4f0e12=0xce;}_0x21a5a5[_0xf53f('0x18')](_0x4f0e12);return _0x21a5a5['set'](_0xf53f('0x1b'),_0x2b0b8d+'-'+_0x47a230+'/'+_0x2e8390)[_0xf53f('0x1c')](_0x58e81c);}return null;};}function patchUpdates(_0x2f88ff){return function(_0x2a6021){try{jsonpatch['apply'](_0x2a6021,_0x2f88ff,!![]);}catch(_0x307896){return BPromise[_0xf53f('0x1d')](_0x307896);}return _0x2a6021[_0xf53f('0x1e')]();};}function saveUpdates(_0x49a741,_0x534c76){return function(_0xd4d392){if(_0xd4d392){return _0xd4d392[_0xf53f('0x1f')](_0x49a741)[_0xf53f('0x20')](function(_0x1fab96){return _0x1fab96;});}return null;};}function removeEntity(_0x445cae,_0x17ddfc){return function(_0x4c0787){if(_0x4c0787){return _0x4c0787['destroy']()[_0xf53f('0x20')](function(){_0x445cae[_0xf53f('0x18')](0xcc)[_0xf53f('0x21')]();});}};}function handleEntityNotFound(_0x29315a,_0x231fbb){return function(_0x4be780){if(!_0x4be780){_0x29315a['sendStatus'](0x194);}return _0x4be780;};}function handleError(_0x34bdc7,_0x404b09){_0x404b09=_0x404b09||0x1f4;return function(_0x55a265){logger[_0xf53f('0x22')](_0x55a265[_0xf53f('0x23')]);if(_0x55a265[_0xf53f('0x24')]){delete _0x55a265[_0xf53f('0x24')];}_0x34bdc7[_0xf53f('0x18')](_0x404b09)[_0xf53f('0x25')](_0x55a265);};}exports[_0xf53f('0x26')]=function(_0x38f8de,_0x4cab59){var _0x38ae73={},_0x1546ff={},_0x1b6938={'count':0x0,'rows':[]};var _0x42fd06=db['OpenchannelApplication']['rawAttributes'];_0x1546ff[_0xf53f('0x27')]=_[_0xf53f('0x28')](_0x42fd06);_0x1546ff['query']=_[_0xf53f('0x28')](_0x38f8de[_0xf53f('0x29')]);_0x1546ff[_0xf53f('0x2a')]=_['intersection'](_0x1546ff[_0xf53f('0x27')],_0x1546ff[_0xf53f('0x29')]);_0x38ae73[_0xf53f('0x2b')]=_[_0xf53f('0x2c')](_0x1546ff['model'],qs[_0xf53f('0x2d')](_0x38f8de[_0xf53f('0x29')]['fields']));_0x38ae73[_0xf53f('0x2b')]=_0x38ae73[_0xf53f('0x2b')]['length']?_0x38ae73['attributes']:_0x1546ff[_0xf53f('0x27')];if(!_0x38f8de[_0xf53f('0x29')][_0xf53f('0x2e')](_0xf53f('0x2f'))){_0x38ae73['limit']=qs['limit'](_0x38f8de[_0xf53f('0x29')][_0xf53f('0x1a')]);_0x38ae73[_0xf53f('0x30')]=qs[_0xf53f('0x30')](_0x38f8de[_0xf53f('0x29')][_0xf53f('0x30')]);}_0x38ae73[_0xf53f('0x31')]=qs[_0xf53f('0x32')](_0x38f8de[_0xf53f('0x29')][_0xf53f('0x32')]);_0x38ae73[_0xf53f('0x33')]=qs[_0xf53f('0x2a')](_[_0xf53f('0x34')](_0x38f8de['query'],_0x1546ff[_0xf53f('0x2a')]));if(_0x38f8de[_0xf53f('0x29')][_0xf53f('0x35')]){_0x38ae73['where']=_[_0xf53f('0x36')](_0x38ae73[_0xf53f('0x33')],{'$or':_['map'](_0x42fd06,function(_0x264334){if(_0x264334['type'][_0xf53f('0x37')]!==_0xf53f('0x38')){var _0x961941={};_0x961941[_0x264334['field']]={'$like':'%'+_0x38f8de[_0xf53f('0x29')]['filter']+'%'};return _0x961941;}})});}_0x38ae73=_[_0xf53f('0x36')]({},_0x38ae73,_0x38f8de['options']);var _0x1b6f70={'where':_0x38ae73['where']};return db[_0xf53f('0x39')]['count'](_0x1b6f70)['then'](function(_0x214028){_0x1b6938[_0xf53f('0x19')]=_0x214028;if(_0x38f8de['query']['includeAll']){_0x38ae73[_0xf53f('0x3a')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0xf53f('0x3b')](_0x38ae73);})[_0xf53f('0x20')](function(_0x1480c){_0x1b6938['rows']=_0x1480c;return _0x1b6938;})[_0xf53f('0x20')](respondWithFilteredResult(_0x4cab59,_0x38ae73))[_0xf53f('0x3c')](handleError(_0x4cab59,null));};exports[_0xf53f('0x3d')]=function(_0x54a186,_0x562cf8){var _0x32ab6d={'raw':!![],'where':{'id':_0x54a186[_0xf53f('0x3e')]['id']}},_0x50e1c7={};_0x50e1c7[_0xf53f('0x27')]=_[_0xf53f('0x28')](db[_0xf53f('0x39')][_0xf53f('0x3f')]);_0x50e1c7[_0xf53f('0x29')]=_[_0xf53f('0x28')](_0x54a186[_0xf53f('0x29')]);_0x50e1c7['filters']=_['intersection'](_0x50e1c7[_0xf53f('0x27')],_0x50e1c7[_0xf53f('0x29')]);_0x32ab6d[_0xf53f('0x2b')]=_[_0xf53f('0x2c')](_0x50e1c7[_0xf53f('0x27')],qs['fields'](_0x54a186[_0xf53f('0x29')][_0xf53f('0x2d')]));_0x32ab6d[_0xf53f('0x2b')]=_0x32ab6d[_0xf53f('0x2b')]['length']?_0x32ab6d[_0xf53f('0x2b')]:_0x50e1c7[_0xf53f('0x27')];if(_0x54a186[_0xf53f('0x29')][_0xf53f('0x40')]){_0x32ab6d[_0xf53f('0x3a')]=[{'all':!![]}];}_0x32ab6d=_[_0xf53f('0x36')]({},_0x32ab6d,_0x54a186[_0xf53f('0x41')]);return db[_0xf53f('0x39')][_0xf53f('0x42')](_0x32ab6d)[_0xf53f('0x20')](handleEntityNotFound(_0x562cf8,null))[_0xf53f('0x20')](respondWithResult(_0x562cf8,null))[_0xf53f('0x3c')](handleError(_0x562cf8,null));};exports['create']=function(_0x5417d0,_0x208994){return db[_0xf53f('0x39')][_0xf53f('0x43')](_0x5417d0[_0xf53f('0x44')],{})[_0xf53f('0x20')](respondWithResult(_0x208994,0xc9))[_0xf53f('0x3c')](handleError(_0x208994,null));};exports[_0xf53f('0x1f')]=function(_0x19c4f3,_0x457cfb){if(_0x19c4f3[_0xf53f('0x44')]['id']){delete _0x19c4f3['body']['id'];}return db[_0xf53f('0x39')][_0xf53f('0x42')]({'where':{'id':_0x19c4f3[_0xf53f('0x3e')]['id']}})[_0xf53f('0x20')](handleEntityNotFound(_0x457cfb,null))[_0xf53f('0x20')](saveUpdates(_0x19c4f3['body'],null))[_0xf53f('0x20')](respondWithResult(_0x457cfb,null))[_0xf53f('0x3c')](handleError(_0x457cfb,null));};exports[_0xf53f('0x45')]=function(_0x115bed,_0x43496b){return db[_0xf53f('0x39')][_0xf53f('0x42')]({'where':{'id':_0x115bed[_0xf53f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x43496b,null))['then'](removeEntity(_0x43496b,null))[_0xf53f('0x3c')](handleError(_0x43496b,null));}; \ No newline at end of file +var _0x26c2=['json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','index','OpenchannelApplication','keys','query','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','map','type','key','VIRTUAL','field','includeAll','findAll','rows','show','params','include','options','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x26c2,0x181));var _0x226c=function(_0x5d8b1,_0x267ac){_0x5d8b1=_0x5d8b1-0x0;var _0x427caf=_0x26c2[_0x5d8b1];return _0x427caf;};'use strict';var pdf=require(_0x226c('0x0'));var emlformat=require(_0x226c('0x1'));var rimraf=require(_0x226c('0x2'));var zipdir=require(_0x226c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x226c('0x4'));var moment=require(_0x226c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x226c('0x6'));var util=require('util');var path=require(_0x226c('0x7'));var sox=require('sox');var csv=require(_0x226c('0x8'));var ejs=require(_0x226c('0x9'));var fs=require('fs');var _=require(_0x226c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x226c('0xb'));var deskjs=require(_0x226c('0xc'));var toCsv=require(_0x226c('0x8'));var querystring=require(_0x226c('0xd'));var Papa=require(_0x226c('0xe'));var authService=require(_0x226c('0xf'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x226c('0x10'));var qs=require(_0x226c('0x11'));var logger=require(_0x226c('0x12'))('api');var utils=require(_0x226c('0x13'));var config=require(_0x226c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d9e82,_0x18aa3c){_0x18aa3c=_0x18aa3c||0xcc;return function(_0x537b55){if(_0x537b55){return _0x1d9e82[_0x226c('0x15')](_0x18aa3c);}return _0x1d9e82[_0x226c('0x16')](_0x18aa3c)['end']();};}function respondWithResult(_0x56c4d1,_0x3c2e76){_0x3c2e76=_0x3c2e76||0xc8;return function(_0x5f4517){if(_0x5f4517){return _0x56c4d1['status'](_0x3c2e76)[_0x226c('0x17')](_0x5f4517);}};}function respondWithFilteredResult(_0x9b64de,_0x1f27ed){return function(_0x72165b){if(_0x72165b){var _0x2c54c4=_0x72165b[_0x226c('0x18')],_0x5842fe=_0x1f27ed['offset'],_0x4468dd=_0x1f27ed[_0x226c('0x19')]+_0x1f27ed[_0x226c('0x1a')],_0xe18e5d;if(_0x4468dd>=_0x2c54c4){_0x4468dd=_0x2c54c4;_0xe18e5d=0xc8;}else{_0xe18e5d=0xce;}_0x9b64de['status'](_0xe18e5d);return _0x9b64de['set'](_0x226c('0x1b'),_0x5842fe+'-'+_0x4468dd+'/'+_0x2c54c4)['json'](_0x72165b);}return null;};}function patchUpdates(_0x5df9b0){return function(_0x523479){try{jsonpatch['apply'](_0x523479,_0x5df9b0,!![]);}catch(_0x51c5f5){return BPromise[_0x226c('0x1c')](_0x51c5f5);}return _0x523479[_0x226c('0x1d')]();};}function saveUpdates(_0x44e759,_0x26bb2f){return function(_0x436537){if(_0x436537){return _0x436537[_0x226c('0x1e')](_0x44e759)[_0x226c('0x1f')](function(_0x2f224c){return _0x2f224c;});}return null;};}function removeEntity(_0x186712,_0x14e344){return function(_0xf82495){if(_0xf82495){return _0xf82495[_0x226c('0x20')]()['then'](function(){_0x186712[_0x226c('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c9faf,_0x3a2b0f){return function(_0x54d13a){if(!_0x54d13a){_0x1c9faf[_0x226c('0x15')](0x194);}return _0x54d13a;};}function handleError(_0x55b6c2,_0x3988f0){_0x3988f0=_0x3988f0||0x1f4;return function(_0x185ae7){logger[_0x226c('0x21')](_0x185ae7[_0x226c('0x22')]);if(_0x185ae7[_0x226c('0x23')]){delete _0x185ae7[_0x226c('0x23')];}_0x55b6c2[_0x226c('0x16')](_0x3988f0)['send'](_0x185ae7);};}exports[_0x226c('0x24')]=function(_0xa5f162,_0x3628e8){var _0x5189a6={},_0x53f207={},_0x562f0d={'count':0x0,'rows':[]};var _0x55baf7=db[_0x226c('0x25')]['rawAttributes'];_0x53f207['model']=_[_0x226c('0x26')](_0x55baf7);_0x53f207[_0x226c('0x27')]=_[_0x226c('0x26')](_0xa5f162[_0x226c('0x27')]);_0x53f207['filters']=_[_0x226c('0x28')](_0x53f207[_0x226c('0x29')],_0x53f207[_0x226c('0x27')]);_0x5189a6['attributes']=_[_0x226c('0x28')](_0x53f207[_0x226c('0x29')],qs[_0x226c('0x2a')](_0xa5f162[_0x226c('0x27')]['fields']));_0x5189a6[_0x226c('0x2b')]=_0x5189a6[_0x226c('0x2b')][_0x226c('0x2c')]?_0x5189a6['attributes']:_0x53f207['model'];if(!_0xa5f162['query']['hasOwnProperty'](_0x226c('0x2d'))){_0x5189a6[_0x226c('0x1a')]=qs[_0x226c('0x1a')](_0xa5f162[_0x226c('0x27')][_0x226c('0x1a')]);_0x5189a6[_0x226c('0x19')]=qs[_0x226c('0x19')](_0xa5f162['query'][_0x226c('0x19')]);}_0x5189a6[_0x226c('0x2e')]=qs[_0x226c('0x2f')](_0xa5f162[_0x226c('0x27')][_0x226c('0x2f')]);_0x5189a6[_0x226c('0x30')]=qs[_0x226c('0x31')](_['pick'](_0xa5f162[_0x226c('0x27')],_0x53f207[_0x226c('0x31')]));if(_0xa5f162['query'][_0x226c('0x32')]){_0x5189a6[_0x226c('0x30')]=_[_0x226c('0x33')](_0x5189a6[_0x226c('0x30')],{'$or':_[_0x226c('0x34')](_0x55baf7,function(_0x31a3f0){if(_0x31a3f0[_0x226c('0x35')][_0x226c('0x36')]!==_0x226c('0x37')){var _0x3bdb02={};_0x3bdb02[_0x31a3f0[_0x226c('0x38')]]={'$like':'%'+_0xa5f162['query']['filter']+'%'};return _0x3bdb02;}})});}_0x5189a6=_[_0x226c('0x33')]({},_0x5189a6,_0xa5f162['options']);var _0x99bf0d={'where':_0x5189a6[_0x226c('0x30')]};return db[_0x226c('0x25')]['count'](_0x99bf0d)['then'](function(_0x53a9f3){_0x562f0d[_0x226c('0x18')]=_0x53a9f3;if(_0xa5f162[_0x226c('0x27')][_0x226c('0x39')]){_0x5189a6['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x226c('0x3a')](_0x5189a6);})[_0x226c('0x1f')](function(_0x28be3b){_0x562f0d[_0x226c('0x3b')]=_0x28be3b;return _0x562f0d;})[_0x226c('0x1f')](respondWithFilteredResult(_0x3628e8,_0x5189a6))['catch'](handleError(_0x3628e8,null));};exports[_0x226c('0x3c')]=function(_0x5b8103,_0x4ce72d){var _0x4cbd1f={'raw':!![],'where':{'id':_0x5b8103[_0x226c('0x3d')]['id']}},_0x2debd2={};_0x2debd2[_0x226c('0x29')]=_['keys'](db[_0x226c('0x25')]['rawAttributes']);_0x2debd2[_0x226c('0x27')]=_[_0x226c('0x26')](_0x5b8103['query']);_0x2debd2[_0x226c('0x31')]=_['intersection'](_0x2debd2[_0x226c('0x29')],_0x2debd2[_0x226c('0x27')]);_0x4cbd1f[_0x226c('0x2b')]=_[_0x226c('0x28')](_0x2debd2['model'],qs['fields'](_0x5b8103[_0x226c('0x27')][_0x226c('0x2a')]));_0x4cbd1f[_0x226c('0x2b')]=_0x4cbd1f[_0x226c('0x2b')]['length']?_0x4cbd1f['attributes']:_0x2debd2[_0x226c('0x29')];if(_0x5b8103[_0x226c('0x27')]['includeAll']){_0x4cbd1f[_0x226c('0x3e')]=[{'all':!![]}];}_0x4cbd1f=_[_0x226c('0x33')]({},_0x4cbd1f,_0x5b8103[_0x226c('0x3f')]);return db[_0x226c('0x25')][_0x226c('0x40')](_0x4cbd1f)['then'](handleEntityNotFound(_0x4ce72d,null))[_0x226c('0x1f')](respondWithResult(_0x4ce72d,null))[_0x226c('0x41')](handleError(_0x4ce72d,null));};exports['create']=function(_0xee4edd,_0x4826ca){return db[_0x226c('0x25')][_0x226c('0x42')](_0xee4edd[_0x226c('0x43')],{})['then'](respondWithResult(_0x4826ca,0xc9))['catch'](handleError(_0x4826ca,null));};exports[_0x226c('0x1e')]=function(_0x56c880,_0x3be4c8){if(_0x56c880[_0x226c('0x43')]['id']){delete _0x56c880['body']['id'];}return db[_0x226c('0x25')][_0x226c('0x40')]({'where':{'id':_0x56c880['params']['id']}})[_0x226c('0x1f')](handleEntityNotFound(_0x3be4c8,null))[_0x226c('0x1f')](saveUpdates(_0x56c880[_0x226c('0x43')],null))['then'](respondWithResult(_0x3be4c8,null))['catch'](handleError(_0x3be4c8,null));};exports[_0x226c('0x20')]=function(_0x5dcf9a,_0x59bb48){return db[_0x226c('0x25')][_0x226c('0x40')]({'where':{'id':_0x5dcf9a[_0x226c('0x3d')]['id']}})[_0x226c('0x1f')](handleEntityNotFound(_0x59bb48,null))[_0x226c('0x1f')](removeEntity(_0x59bb48,null))[_0x226c('0x41')](handleError(_0x59bb48,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 66a1e1c..d3df426 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 _0x7b91=['api','moment','bluebird','request-promise','./openchannelApplication.attributes','exports','define','lodash','../../config/logger'];(function(_0x2ef99b,_0x34ff8a){var _0x79faf8=function(_0x2bc684){while(--_0x2bc684){_0x2ef99b['push'](_0x2ef99b['shift']());}};_0x79faf8(++_0x34ff8a);}(_0x7b91,0xbb));var _0x17b9=function(_0x545020,_0x536c99){_0x545020=_0x545020-0x0;var _0x45499a=_0x7b91[_0x545020];return _0x45499a;};'use strict';var _=require(_0x17b9('0x0'));var util=require('util');var logger=require(_0x17b9('0x1'))(_0x17b9('0x2'));var moment=require(_0x17b9('0x3'));var BPromise=require(_0x17b9('0x4'));var rp=require(_0x17b9('0x5'));var attributes=require(_0x17b9('0x6'));module[_0x17b9('0x7')]=function(_0x402625,_0x2ac9d7){return _0x402625[_0x17b9('0x8')]('OpenchannelApplication',attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1274=['api','moment','bluebird','exports','define','OpenchannelApplication','openchannel_applications','lodash'];(function(_0x22f0d2,_0xd53ed1){var _0x3a85ee=function(_0x3abef9){while(--_0x3abef9){_0x22f0d2['push'](_0x22f0d2['shift']());}};_0x3a85ee(++_0xd53ed1);}(_0x1274,0x1cf));var _0x4127=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1274[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4127('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4127('0x1'));var moment=require(_0x4127('0x2'));var BPromise=require(_0x4127('0x3'));var rp=require('request-promise');var attributes=require('./openchannelApplication.attributes');module[_0x4127('0x4')]=function(_0xd211fb,_0x41313b){return _0xd211fb[_0x4127('0x5')](_0x4127('0x6'),attributes,{'tableName':_0x4127('0x7'),'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 a6533c4..cf4b3a6 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 _0x1186=['stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','where','attributes','debug'];(function(_0x59739f,_0x510b45){var _0x12416d=function(_0x58ef63){while(--_0x58ef63){_0x59739f['push'](_0x59739f['shift']());}};_0x12416d(++_0x510b45);}(_0x1186,0x75));var _0x6118=function(_0x3c6d0f,_0x4d9888){_0x3c6d0f=_0x3c6d0f-0x0;var _0x3743aa=_0x1186[_0x3c6d0f];return _0x3743aa;};'use strict';var _=require(_0x6118('0x0'));var util=require(_0x6118('0x1'));var moment=require('moment');var BPromise=require(_0x6118('0x2'));var rs=require(_0x6118('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6118('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6118('0x5'))('rpc');var config=require(_0x6118('0x6'));var jayson=require(_0x6118('0x7'));var client=jayson[_0x6118('0x8')][_0x6118('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5023d1,_0x27767f,_0xa75641){return new BPromise(function(_0xb312b,_0x4a0f0a){return client['request'](_0x5023d1,_0xa75641)[_0x6118('0xa')](function(_0x82e51a){logger[_0x6118('0xb')](_0x6118('0xc'),_0x27767f,_0x6118('0xd'));logger['debug'](_0x6118('0xe'),_0x27767f,'request\x20sent',JSON['stringify'](_0x82e51a));if(_0x82e51a['error']){if(_0x82e51a[_0x6118('0xf')][_0x6118('0x10')]===0x1f4){logger[_0x6118('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x27767f,_0x82e51a['error']['message']);return _0x4a0f0a(_0x82e51a['error'][_0x6118('0x11')]);}logger['error'](_0x6118('0xc'),_0x27767f,_0x82e51a['error'][_0x6118('0x11')]);return _0xb312b(_0x82e51a['error'][_0x6118('0x11')]);}else{logger[_0x6118('0xb')](_0x6118('0xc'),_0x27767f,_0x6118('0xd'));_0xb312b(_0x82e51a[_0x6118('0x12')][_0x6118('0x11')]);}})[_0x6118('0x13')](function(_0x1f8044){logger[_0x6118('0xf')](_0x6118('0xc'),_0x27767f,_0x1f8044);_0x4a0f0a(_0x1f8044);});});}exports[_0x6118('0x14')]=function(_0x5afe90){var _0x52b071=this;return new Promise(function(_0x137455,_0x571def){return db[_0x6118('0x15')]['update'](_0x5afe90[_0x6118('0x16')],{'raw':_0x5afe90[_0x6118('0x17')]?_0x5afe90[_0x6118('0x17')][_0x6118('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5afe90[_0x6118('0x17')]?_0x5afe90[_0x6118('0x17')][_0x6118('0x19')]||null:null,'attributes':_0x5afe90[_0x6118('0x17')]?_0x5afe90[_0x6118('0x17')][_0x6118('0x1a')]||null:null,'limit':_0x5afe90[_0x6118('0x17')]?_0x5afe90['options']['limit']||null:null})[_0x6118('0xa')](function(_0x5aeef0){logger['info']('UpdateOpenchannelApplication',_0x5afe90);logger[_0x6118('0x1b')]('UpdateOpenchannelApplication',_0x5afe90,JSON[_0x6118('0x1c')](_0x5aeef0));_0x137455(_0x5aeef0);})[_0x6118('0x13')](function(_0xfbadc9){logger[_0x6118('0xf')]('UpdateOpenchannelApplication',_0xfbadc9[_0x6118('0x11')],_0x5afe90);_0x571def(_0x52b071[_0x6118('0xf')](0x1f4,_0xfbadc9['message']));});});}; \ No newline at end of file +var _0x9a37=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1d9bc1,_0x52f0a6){var _0x540128=function(_0x2e35ff){while(--_0x2e35ff){_0x1d9bc1['push'](_0x1d9bc1['shift']());}};_0x540128(++_0x52f0a6);}(_0x9a37,0x7e));var _0x79a3=function(_0x1ea053,_0x22aecc){_0x1ea053=_0x1ea053-0x0;var _0x444b08=_0x9a37[_0x1ea053];return _0x444b08;};'use strict';var _=require(_0x79a3('0x0'));var util=require(_0x79a3('0x1'));var moment=require(_0x79a3('0x2'));var BPromise=require(_0x79a3('0x3'));var rs=require(_0x79a3('0x4'));var fs=require('fs');var Redis=require(_0x79a3('0x5'));var db=require(_0x79a3('0x6'))['db'];var utils=require(_0x79a3('0x7'));var logger=require('../../config/logger')(_0x79a3('0x8'));var config=require(_0x79a3('0x9'));var jayson=require(_0x79a3('0xa'));var client=jayson[_0x79a3('0xb')][_0x79a3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x49d753,_0xb58ffb,_0xfd1997){return new BPromise(function(_0x2abdce,_0x570f48){return client[_0x79a3('0xd')](_0x49d753,_0xfd1997)['then'](function(_0x1c50e1){logger[_0x79a3('0xe')](_0x79a3('0xf'),_0xb58ffb,_0x79a3('0x10'));logger[_0x79a3('0x11')](_0x79a3('0x12'),_0xb58ffb,_0x79a3('0x10'),JSON[_0x79a3('0x13')](_0x1c50e1));if(_0x1c50e1[_0x79a3('0x14')]){if(_0x1c50e1['error']['code']===0x1f4){logger[_0x79a3('0x14')](_0x79a3('0xf'),_0xb58ffb,_0x1c50e1['error']['message']);return _0x570f48(_0x1c50e1[_0x79a3('0x14')][_0x79a3('0x15')]);}logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0xb58ffb,_0x1c50e1['error'][_0x79a3('0x15')]);return _0x2abdce(_0x1c50e1[_0x79a3('0x14')][_0x79a3('0x15')]);}else{logger[_0x79a3('0xe')](_0x79a3('0xf'),_0xb58ffb,_0x79a3('0x10'));_0x2abdce(_0x1c50e1[_0x79a3('0x16')][_0x79a3('0x15')]);}})[_0x79a3('0x17')](function(_0x3da322){logger[_0x79a3('0x14')]('OpenchannelApplication,\x20%s,\x20%s',_0xb58ffb,_0x3da322);_0x570f48(_0x3da322);});});}exports[_0x79a3('0x18')]=function(_0x2cbf05){var _0x37fed7=this;return new Promise(function(_0x3b1dbb,_0x545939){return db[_0x79a3('0x19')][_0x79a3('0x1a')](_0x2cbf05[_0x79a3('0x1b')],{'raw':_0x2cbf05[_0x79a3('0x1c')]?_0x2cbf05[_0x79a3('0x1c')][_0x79a3('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cbf05[_0x79a3('0x1c')]?_0x2cbf05['options'][_0x79a3('0x1e')]||null:null,'attributes':_0x2cbf05['options']?_0x2cbf05[_0x79a3('0x1c')][_0x79a3('0x1f')]||null:null,'limit':_0x2cbf05[_0x79a3('0x1c')]?_0x2cbf05[_0x79a3('0x1c')][_0x79a3('0x20')]||null:null})['then'](function(_0x4f90b5){logger[_0x79a3('0xe')](_0x79a3('0x18'),_0x2cbf05);logger[_0x79a3('0x11')]('UpdateOpenchannelApplication',_0x2cbf05,JSON[_0x79a3('0x13')](_0x4f90b5));_0x3b1dbb(_0x4f90b5);})[_0x79a3('0x17')](function(_0x59a70){logger['error'](_0x79a3('0x18'),_0x59a70[_0x79a3('0x15')],_0x2cbf05);_0x545939(_0x37fed7[_0x79a3('0x14')](0x1f4,_0x59a70[_0x79a3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 336d86f..6850b50 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 _0x5338=['update','delete','openchannelinteraction:destroy','destroy','removeTags','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','/describe','/:id','get','getMessages','download','post','create','addMessage','/:id/tags','tracked','openchannel','put'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x5338,0xef));var _0x8533=function(_0x1ac720,_0x177062){_0x1ac720=_0x1ac720-0x0;var _0x36ac7f=_0x5338[_0x1ac720];return _0x36ac7f;};'use strict';var multer=require('multer');var util=require(_0x8533('0x0'));var path=require(_0x8533('0x1'));var timeout=require(_0x8533('0x2'));var express=require(_0x8533('0x3'));var router=express['Router']();var auth=require(_0x8533('0x4'));var interaction=require(_0x8533('0x5'));var config=require(_0x8533('0x6'));var controller=require(_0x8533('0x7'));router['get']('/',auth[_0x8533('0x8')](),controller['index']);router['get'](_0x8533('0x9'),auth[_0x8533('0x8')](),controller['describe']);router['get'](_0x8533('0xa'),auth[_0x8533('0x8')](),controller['show']);router[_0x8533('0xb')]('/:id/messages',auth[_0x8533('0x8')](),controller[_0x8533('0xc')]);router[_0x8533('0xb')]('/:id/download',auth[_0x8533('0x8')](),controller[_0x8533('0xd')]);router[_0x8533('0xe')]('/',auth[_0x8533('0x8')](),controller[_0x8533('0xf')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0x8533('0x10')]);router[_0x8533('0xe')](_0x8533('0x11'),auth['isAuthenticated'](),interaction[_0x8533('0x12')](_0x8533('0x13'),'openchannelinteraction:addtags'),controller['addTags']);router[_0x8533('0x14')](_0x8533('0xa'),auth['isAuthenticated'](),interaction[_0x8533('0x12')](_0x8533('0x13'),'openchannelinteraction:update'),controller[_0x8533('0x15')]);router[_0x8533('0x16')](_0x8533('0xa'),auth[_0x8533('0x8')](),interaction[_0x8533('0x12')](_0x8533('0x13'),_0x8533('0x17')),controller[_0x8533('0x18')]);router[_0x8533('0x16')](_0x8533('0x11'),auth[_0x8533('0x8')](),controller[_0x8533('0x19')]);module['exports']=router; \ No newline at end of file +var _0xce2a=['openchannelinteraction:addtags','openchannelinteraction:update','delete','tracked','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','index','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','openchannel'];(function(_0x44c5c1,_0x4d9d55){var _0x467172=function(_0x584e24){while(--_0x584e24){_0x44c5c1['push'](_0x44c5c1['shift']());}};_0x467172(++_0x4d9d55);}(_0xce2a,0x15d));var _0xace2=function(_0x5c9f02,_0x4bf631){_0x5c9f02=_0x5c9f02-0x0;var _0x573007=_0xce2a[_0x5c9f02];return _0x573007;};'use strict';var multer=require(_0xace2('0x0'));var util=require(_0xace2('0x1'));var path=require(_0xace2('0x2'));var timeout=require(_0xace2('0x3'));var express=require(_0xace2('0x4'));var router=express[_0xace2('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xace2('0x6'));var config=require(_0xace2('0x7'));var controller=require(_0xace2('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xace2('0x9')]);router[_0xace2('0xa')]('/describe',auth[_0xace2('0xb')](),controller[_0xace2('0xc')]);router[_0xace2('0xa')](_0xace2('0xd'),auth[_0xace2('0xb')](),controller[_0xace2('0xe')]);router[_0xace2('0xa')](_0xace2('0xf'),auth[_0xace2('0xb')](),controller[_0xace2('0x10')]);router[_0xace2('0xa')](_0xace2('0x11'),auth[_0xace2('0xb')](),controller[_0xace2('0x12')]);router[_0xace2('0x13')]('/',auth[_0xace2('0xb')](),controller[_0xace2('0x14')]);router['post'](_0xace2('0xf'),auth[_0xace2('0xb')](),controller[_0xace2('0x15')]);router[_0xace2('0x13')]('/:id/tags',auth[_0xace2('0xb')](),interaction['tracked'](_0xace2('0x16'),_0xace2('0x17')),controller['addTags']);router['put'](_0xace2('0xd'),auth[_0xace2('0xb')](),interaction['tracked']('openchannel',_0xace2('0x18')),controller['update']);router[_0xace2('0x19')](_0xace2('0xd'),auth[_0xace2('0xb')](),interaction[_0xace2('0x1a')](_0xace2('0x16'),'openchannelinteraction:destroy'),controller[_0xace2('0x1b')]);router[_0xace2('0x19')](_0xace2('0x1c'),auth['isAuthenticated'](),controller[_0xace2('0x1d')]);module[_0xace2('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index bf37cdc..e60ebfa 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 _0x24ca=['sequelize','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x24ca,0x1bc));var _0xa24c=function(_0x903228,_0x42c429){_0x903228=_0x903228-0x0;var _0xcec81d=_0x24ca[_0x903228];return _0xcec81d;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'closed':{'type':Sequelize[_0xa24c('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa24c('0x2')]},'disposition':{'type':Sequelize[_0xa24c('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xa24c('0x2')]},'threadId':{'type':Sequelize[_0xa24c('0x3')]},'externalUrl':{'type':Sequelize[_0xa24c('0x3')]},'lastMsgAt':{'type':Sequelize[_0xa24c('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xa24c('0x4')]('in',_0xa24c('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xa24c('0x3')]}}; \ No newline at end of file +var _0x4c4e=['DATE','STRING','ENUM','sequelize','BOOLEAN'];(function(_0x5c2bb2,_0x558245){var _0x1d9c4f=function(_0x1af879){while(--_0x1af879){_0x5c2bb2['push'](_0x5c2bb2['shift']());}};_0x1d9c4f(++_0x558245);}(_0x4c4e,0x152));var _0xe4c4=function(_0x20109f,_0x26b760){_0x20109f=_0x20109f-0x0;var _0x353b47=_0x4c4e[_0x20109f];return _0x353b47;};'use strict';var Sequelize=require(_0xe4c4('0x0'));module['exports']={'closed':{'type':Sequelize[_0xe4c4('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe4c4('0x2')]},'disposition':{'type':Sequelize[_0xe4c4('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xe4c4('0x2')]},'threadId':{'type':Sequelize[_0xe4c4('0x3')]},'externalUrl':{'type':Sequelize[_0xe4c4('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xe4c4('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xe4c4('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index ab74926..032508a 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 _0x0207=['nolimit','sort','pick','filter','merge','type','key','VIRTUAL','field','options','where','include','push','Tag','tag','read','OpenchannelMessage','Messages','createdAt','distinct','User','Users','CmContact','internal','OpenchannelAccount','Account','direction','Tags','color','ThroughTags','rows','catch','show','params','find','create','body','describe','addMessage','ids','omit','findOne','order','map','$gte','split','format','includeAll','setTags','spread','findAll','emit','openchannelInteractionTags:save','download','toString','join','root','server','files','tmp','attachments','fullname','Contact','firstName','Attachment','Letter','1cm','mkdirSync','

Openchannel\x20Interaction:\x20#%d

','

Date:\x20%s

','MMMM\x20Do\x20YYYY,\x20HH:mm:ss','','','createReadStream','pipe','createWriteStream','basename','interaction-','.pdf','log','err','unlinkSync','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','save','update','then','destroy','stack','name','send','index','OpenchannelInteraction','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x350182,_0x2a9feb){var _0x4a0892=function(_0x2c994d){while(--_0x2c994d){_0x350182['push'](_0x350182['shift']());}};_0x4a0892(++_0x2a9feb);}(_0x0207,0x162));var _0x7020=function(_0x2369aa,_0x49de68){_0x2369aa=_0x2369aa-0x0;var _0x17ecf3=_0x0207[_0x2369aa];return _0x17ecf3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7020('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7020('0x1'));var rp=require(_0x7020('0x2'));var moment=require(_0x7020('0x3'));var BPromise=require(_0x7020('0x4'));var Mustache=require(_0x7020('0x5'));var util=require(_0x7020('0x6'));var path=require(_0x7020('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7020('0x8'));var fs=require('fs');var _=require(_0x7020('0x9'));var squel=require(_0x7020('0xa'));var crypto=require(_0x7020('0xb'));var jsforce=require(_0x7020('0xc'));var deskjs=require(_0x7020('0xd'));var toCsv=require(_0x7020('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x7020('0xf'));var hardwareService=require(_0x7020('0x10'));var Redis=require(_0x7020('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0x7020('0x12'))(_0x7020('0x13'));var utils=require('../../config/utils');var config=require(_0x7020('0x14'));var db=require(_0x7020('0x15'))['db'];config[_0x7020('0x16')]=_['defaults'](config[_0x7020('0x16')],{'host':_0x7020('0x17'),'port':0x18eb});var socket=require(_0x7020('0x18'))(new Redis(config[_0x7020('0x16')]));require(_0x7020('0x19'))['register'](socket);function respondWithStatusCode(_0x9403e5,_0x5f5872){_0x5f5872=_0x5f5872||0xcc;return function(_0x3b8d60){if(_0x3b8d60){return _0x9403e5[_0x7020('0x1a')](_0x5f5872);}return _0x9403e5[_0x7020('0x1b')](_0x5f5872)[_0x7020('0x1c')]();};}function respondWithResult(_0x17260e,_0x308324){_0x308324=_0x308324||0xc8;return function(_0x55c8b9){if(_0x55c8b9){return _0x17260e[_0x7020('0x1b')](_0x308324)['json'](_0x55c8b9);}};}function respondWithFilteredResult(_0x2f4db5,_0x280ac0){return function(_0x1a3569){if(_0x1a3569){var _0x1e3a06=_0x1a3569[_0x7020('0x1d')],_0x4fe6f1=_0x280ac0[_0x7020('0x1e')],_0x3d5d25=_0x280ac0[_0x7020('0x1e')]+_0x280ac0[_0x7020('0x1f')],_0x3ac2f6;if(_0x3d5d25>=_0x1e3a06){_0x3d5d25=_0x1e3a06;_0x3ac2f6=0xc8;}else{_0x3ac2f6=0xce;}_0x2f4db5['status'](_0x3ac2f6);return _0x2f4db5['set'](_0x7020('0x20'),_0x4fe6f1+'-'+_0x3d5d25+'/'+_0x1e3a06)[_0x7020('0x21')](_0x1a3569);}return null;};}function patchUpdates(_0x1d1986){return function(_0xb96d30){try{jsonpatch['apply'](_0xb96d30,_0x1d1986,!![]);}catch(_0x382e06){return BPromise[_0x7020('0x22')](_0x382e06);}return _0xb96d30[_0x7020('0x23')]();};}function saveUpdates(_0x860099,_0x493cc7){return function(_0xcc48f){if(_0xcc48f){return _0xcc48f[_0x7020('0x24')](_0x860099)[_0x7020('0x25')](function(_0x362705){return _0x362705;});}return null;};}function removeEntity(_0x384fe9,_0xe3f4d2){return function(_0x147986){if(_0x147986){return _0x147986[_0x7020('0x26')]()['then'](function(){_0x384fe9[_0x7020('0x1b')](0xcc)[_0x7020('0x1c')]();});}};}function handleEntityNotFound(_0x35b539,_0x5586f8){return function(_0x28f9f0){if(!_0x28f9f0){_0x35b539['sendStatus'](0x194);}return _0x28f9f0;};}function handleError(_0x496471,_0x50aecb){_0x50aecb=_0x50aecb||0x1f4;return function(_0x178cbd){logger['error'](_0x178cbd[_0x7020('0x27')]);if(_0x178cbd['name']){delete _0x178cbd[_0x7020('0x28')];}_0x496471[_0x7020('0x1b')](_0x50aecb)[_0x7020('0x29')](_0x178cbd);};}exports[_0x7020('0x2a')]=function(_0xb03bd6,_0x1dff20){var _0x2ba734={},_0x15a1cc={},_0xc51979={'count':0x0,'rows':[]};var _0x2c9c86=db[_0x7020('0x2b')][_0x7020('0x2c')];_0x15a1cc[_0x7020('0x2d')]=_['keys'](_0x2c9c86);_0x15a1cc[_0x7020('0x2e')]=_[_0x7020('0x2f')](_0xb03bd6[_0x7020('0x2e')]);_0x15a1cc[_0x7020('0x30')]=_[_0x7020('0x31')](_0x15a1cc[_0x7020('0x2d')],_0x15a1cc[_0x7020('0x2e')]);_0x2ba734[_0x7020('0x32')]=_[_0x7020('0x31')](_0x15a1cc[_0x7020('0x2d')],qs[_0x7020('0x33')](_0xb03bd6[_0x7020('0x2e')][_0x7020('0x33')]));_0x2ba734[_0x7020('0x32')]=_0x2ba734['attributes'][_0x7020('0x34')]?_0x2ba734[_0x7020('0x32')]:_0x15a1cc[_0x7020('0x2d')];if(!_0xb03bd6[_0x7020('0x2e')][_0x7020('0x35')](_0x7020('0x36'))){_0x2ba734[_0x7020('0x1f')]=qs[_0x7020('0x1f')](_0xb03bd6[_0x7020('0x2e')][_0x7020('0x1f')]);_0x2ba734[_0x7020('0x1e')]=qs[_0x7020('0x1e')](_0xb03bd6[_0x7020('0x2e')][_0x7020('0x1e')]);}_0x2ba734['order']=qs[_0x7020('0x37')](_0xb03bd6[_0x7020('0x2e')][_0x7020('0x37')]);_0x2ba734['where']=qs[_0x7020('0x30')](_[_0x7020('0x38')](_0xb03bd6[_0x7020('0x2e')],_0x15a1cc[_0x7020('0x30')]));if(_0xb03bd6[_0x7020('0x2e')][_0x7020('0x39')]){_0x2ba734['where']=_[_0x7020('0x3a')](_0x2ba734['where'],{'$or':_['map'](_0x2c9c86,function(_0x47a147){if(_0x47a147[_0x7020('0x3b')][_0x7020('0x3c')]!==_0x7020('0x3d')){var _0x122f27={};_0x122f27[_0x47a147[_0x7020('0x3e')]]={'$like':'%'+_0xb03bd6['query']['filter']+'%'};return _0x122f27;}})});}_0x2ba734=_[_0x7020('0x3a')]({},_0x2ba734,_0xb03bd6[_0x7020('0x3f')]);var _0x3bc14e={'where':_0x2ba734[_0x7020('0x40')]};_0x3bc14e['include']=[];if(_0xb03bd6[_0x7020('0x2e')]['tag']){_0x3bc14e[_0x7020('0x41')][_0x7020('0x42')]({'model':db[_0x7020('0x43')],'as':'Tags','attributes':['id'],'where':{'id':_0xb03bd6['query'][_0x7020('0x44')]},'required':!![]});_0x3bc14e['distinct']=!![];}if(_0xb03bd6[_0x7020('0x2e')][_0x7020('0x45')]){_0x3bc14e['include'][_0x7020('0x42')]({'model':db[_0x7020('0x46')],'as':_0x7020('0x47'),'attributes':['id','direction',_0x7020('0x48'),'read'],'where':{'direction':'in','read':_0xb03bd6[_0x7020('0x2e')][_0x7020('0x45')]||![]},'required':!![]});_0x3bc14e[_0x7020('0x49')]=!![];}return db['OpenchannelInteraction'][_0x7020('0x1d')](_0x3bc14e)[_0x7020('0x25')](function(_0x3a6636){_0xc51979[_0x7020('0x1d')]=_0x3a6636;if(_0xb03bd6[_0x7020('0x2e')]['includeAll']){_0x2ba734[_0x7020('0x41')]=[{'model':db[_0x7020('0x4a')],'as':_0x7020('0x4b'),'required':![],'attributes':['id',_0x7020('0x28'),'fullname']},{'model':db[_0x7020('0x4c')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x7020('0x28'),'fullname',_0x7020('0x4d')],'required':![]},{'model':db[_0x7020('0x4e')],'as':_0x7020('0x4f'),'attributes':['name',_0x7020('0x3c')],'required':![]},{'model':db['OpenchannelMessage'],'as':_0x7020('0x47'),'attributes':['id',_0x7020('0x50'),_0x7020('0x48'),_0x7020('0x45')],'where':{'direction':'in','read':_0xb03bd6[_0x7020('0x2e')][_0x7020('0x45')]||![]},'required':_0xb03bd6[_0x7020('0x2e')][_0x7020('0x45')]||![]},{'model':db[_0x7020('0x43')],'as':_0x7020('0x51'),'attributes':['id',_0x7020('0x28'),_0x7020('0x52')],'required':_0xb03bd6[_0x7020('0x2e')][_0x7020('0x44')]?!![]:![]},{'model':db[_0x7020('0x43')],'as':_0x7020('0x53'),'attributes':['id',_0x7020('0x28'),_0x7020('0x52')],'through':_0xb03bd6['query'][_0x7020('0x44')]?{'attributes':[],'where':{'TagId':_0xb03bd6[_0x7020('0x2e')][_0x7020('0x44')]||undefined}}:{},'required':_0xb03bd6[_0x7020('0x2e')][_0x7020('0x44')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x2ba734);})[_0x7020('0x25')](function(_0x53502c){_0xc51979[_0x7020('0x54')]=_0x53502c;return _0xc51979;})[_0x7020('0x25')](respondWithFilteredResult(_0x1dff20,_0x2ba734))[_0x7020('0x55')](handleError(_0x1dff20,null));};exports[_0x7020('0x56')]=function(_0x5c0262,_0x5bc070){var _0xfbd73a={'raw':![],'where':{'id':_0x5c0262[_0x7020('0x57')]['id']}},_0x2a4656={};_0x2a4656[_0x7020('0x2d')]=_[_0x7020('0x2f')](db[_0x7020('0x2b')][_0x7020('0x2c')]);_0x2a4656[_0x7020('0x2e')]=_[_0x7020('0x2f')](_0x5c0262[_0x7020('0x2e')]);_0x2a4656[_0x7020('0x30')]=_[_0x7020('0x31')](_0x2a4656['model'],_0x2a4656['query']);_0xfbd73a['attributes']=_[_0x7020('0x31')](_0x2a4656['model'],qs[_0x7020('0x33')](_0x5c0262[_0x7020('0x2e')][_0x7020('0x33')]));_0xfbd73a[_0x7020('0x32')]=_0xfbd73a[_0x7020('0x32')][_0x7020('0x34')]?_0xfbd73a[_0x7020('0x32')]:_0x2a4656['model'];if(_0x5c0262[_0x7020('0x2e')]['includeAll']){_0xfbd73a[_0x7020('0x41')]=[{'all':!![]}];}_0xfbd73a=_[_0x7020('0x3a')]({},_0xfbd73a,_0x5c0262[_0x7020('0x3f')]);return db[_0x7020('0x2b')][_0x7020('0x58')](_0xfbd73a)[_0x7020('0x25')](handleEntityNotFound(_0x5bc070,null))[_0x7020('0x25')](respondWithResult(_0x5bc070,null))['catch'](handleError(_0x5bc070,null));};exports[_0x7020('0x59')]=function(_0x844bb3,_0x18b5df){return db[_0x7020('0x2b')]['create'](_0x844bb3['body'],{})['then'](respondWithResult(_0x18b5df,0xc9))[_0x7020('0x55')](handleError(_0x18b5df,null));};exports[_0x7020('0x24')]=function(_0x1fb4d6,_0x40b31c){if(_0x1fb4d6[_0x7020('0x5a')]['id']){delete _0x1fb4d6[_0x7020('0x5a')]['id'];}return db['OpenchannelInteraction'][_0x7020('0x58')]({'where':{'id':_0x1fb4d6[_0x7020('0x57')]['id']}})[_0x7020('0x25')](handleEntityNotFound(_0x40b31c,null))[_0x7020('0x25')](saveUpdates(_0x1fb4d6[_0x7020('0x5a')],null))[_0x7020('0x25')](respondWithResult(_0x40b31c,null))[_0x7020('0x55')](handleError(_0x40b31c,null));};exports[_0x7020('0x26')]=function(_0x3644d5,_0x5b7a18){return db[_0x7020('0x2b')]['find']({'where':{'id':_0x3644d5[_0x7020('0x57')]['id']}})['then'](handleEntityNotFound(_0x5b7a18,null))['then'](removeEntity(_0x5b7a18,null))[_0x7020('0x55')](handleError(_0x5b7a18,null));};exports[_0x7020('0x5b')]=function(_0xf4a3e4,_0x481a0f){return db[_0x7020('0x2b')][_0x7020('0x5b')]()[_0x7020('0x25')](respondWithResult(_0x481a0f,null))[_0x7020('0x55')](handleError(_0x481a0f,null));};exports[_0x7020('0x5c')]=function(_0x39e8b1,_0x1f2eab,_0x251243){return db[_0x7020('0x46')]['find']({'where':{'id':_0x39e8b1[_0x7020('0x57')]['id']}})[_0x7020('0x25')](handleEntityNotFound(_0x1f2eab,null))[_0x7020('0x25')](function(_0x19d04f){if(_0x19d04f){return _0x19d04f[_0x7020('0x5c')](_0x39e8b1['body'][_0x7020('0x5d')],_[_0x7020('0x5e')](_0x39e8b1['body'],[_0x7020('0x5d'),'id'])||{});}})[_0x7020('0x25')](respondWithResult(_0x1f2eab,null))[_0x7020('0x55')](handleError(_0x1f2eab,null));};exports['getMessages']=function(_0x554b4a,_0x35b2c2,_0x452a67){var _0x145ca3={'raw':![],'where':{}};var _0x3535ae={};var _0x159429={'count':0x0,'rows':[]};return db[_0x7020('0x2b')][_0x7020('0x5f')]({'where':{'id':_0x554b4a[_0x7020('0x57')]['id']}})[_0x7020('0x25')](handleEntityNotFound(_0x35b2c2,null))[_0x7020('0x25')](function(_0x4a8754){if(_0x4a8754){_0x3535ae['model']=_['keys'](db[_0x7020('0x46')][_0x7020('0x2c')]);_0x3535ae[_0x7020('0x2e')]=_['keys'](_0x554b4a[_0x7020('0x2e')]);_0x3535ae[_0x7020('0x30')]=_[_0x7020('0x31')](_0x3535ae[_0x7020('0x2d')],_0x3535ae[_0x7020('0x2e')]);_0x145ca3[_0x7020('0x32')]=_[_0x7020('0x31')](_0x3535ae[_0x7020('0x2d')],qs[_0x7020('0x33')](_0x554b4a['query']['fields']));_0x145ca3[_0x7020('0x32')]=_0x145ca3['attributes']['length']?_0x145ca3[_0x7020('0x32')]:_0x3535ae['model'];if(!_0x554b4a['query'][_0x7020('0x35')](_0x7020('0x36'))){_0x145ca3[_0x7020('0x1f')]=qs[_0x7020('0x1f')](_0x554b4a[_0x7020('0x2e')]['limit']);_0x145ca3['offset']=qs['offset'](_0x554b4a[_0x7020('0x2e')][_0x7020('0x1e')]);}_0x145ca3[_0x7020('0x60')]=qs[_0x7020('0x37')](_0x554b4a[_0x7020('0x2e')]['sort']);_0x145ca3['where']=qs[_0x7020('0x30')](_['pick'](_0x554b4a[_0x7020('0x2e')],_0x3535ae[_0x7020('0x30')]));_0x145ca3[_0x7020('0x40')]['OpenchannelInteractionId']=_0x4a8754['id'];if(_0x554b4a[_0x7020('0x2e')]['filter']){_0x145ca3[_0x7020('0x40')]=_['merge'](_0x145ca3['where'],{'$or':_[_0x7020('0x61')](_0x145ca3[_0x7020('0x32')],function(_0x2c4734){var _0x1ae815={};_0x1ae815[_0x2c4734]={'$like':'%'+_0x554b4a[_0x7020('0x2e')][_0x7020('0x39')]+'%'};return _0x1ae815;})});}if(_0x554b4a[_0x7020('0x2e')][_0x7020('0x62')]){var _0x2a2d52=_0x554b4a['query']['$gte'][_0x7020('0x63')](',');var _0x488949={};_0x488949[_0x2a2d52[0x0]]={'$gte':moment(_0x2a2d52[0x1])[_0x7020('0x64')]('YYYY-MM-DD\x20HH:mm:ss')};_0x145ca3[_0x7020('0x40')]=_[_0x7020('0x3a')](_0x145ca3[_0x7020('0x40')],_0x488949);}_0x145ca3=_[_0x7020('0x3a')]({},_0x145ca3,_0x554b4a[_0x7020('0x3f')]);return db[_0x7020('0x46')][_0x7020('0x1d')]({'where':_0x145ca3[_0x7020('0x40')]})['then'](function(_0x285e0f){_0x159429[_0x7020('0x1d')]=_0x285e0f;if(_0x554b4a[_0x7020('0x2e')][_0x7020('0x65')]){_0x145ca3[_0x7020('0x41')]=[{'all':!![]}];}return db[_0x7020('0x46')]['findAll'](_0x145ca3);})[_0x7020('0x25')](function(_0x2f5851){_0x159429[_0x7020('0x54')]=_0x2f5851;return _0x159429;});}})[_0x7020('0x25')](respondWithFilteredResult(_0x35b2c2,_0x145ca3))[_0x7020('0x55')](handleError(_0x35b2c2,null));};exports['addTags']=function(_0x183e98,_0x3b0761,_0x4488a6){return db[_0x7020('0x2b')]['find']({'where':{'id':_0x183e98[_0x7020('0x57')]['id']}})[_0x7020('0x25')](handleEntityNotFound(_0x3b0761,null))['then'](function(_0xb44bd9){if(_0xb44bd9){return _0xb44bd9[_0x7020('0x66')](_0x183e98['body']['ids'],_['omit'](_0x183e98[_0x7020('0x5a')],[_0x7020('0x5d'),'id'])||{})[_0x7020('0x67')](function(){return db[_0x7020('0x43')][_0x7020('0x68')]({'attributes':['id',_0x7020('0x28'),_0x7020('0x52')],'where':{'id':_0x183e98[_0x7020('0x5a')][_0x7020('0x5d')]}});})['then'](function(_0x4a9048){socket[_0x7020('0x69')](_0x7020('0x6a'),{'id':Number(_0x183e98[_0x7020('0x57')]['id']),'tags':_0x4a9048||[]});return{'id':Number(_0x183e98['params']['id']),'tags':_0x4a9048||[]};});}})[_0x7020('0x25')](respondWithResult(_0x3b0761,null))[_0x7020('0x55')](handleError(_0x3b0761,null));};exports['removeTags']=function(_0x5beafb,_0x4e40bc,_0x476547){var _0x2d5943;return db['OpenchannelInteraction']['find']({'where':{'id':_0x5beafb[_0x7020('0x57')]['id']}})['then'](handleEntityNotFound(_0x4e40bc,null))[_0x7020('0x25')](function(_0x4c064b){if(_0x4c064b){return _0x4c064b['removeTags'](_0x5beafb[_0x7020('0x2e')][_0x7020('0x5d')]);}})[_0x7020('0x25')](respondWithStatusCode(_0x4e40bc,null))[_0x7020('0x55')](handleError(_0x4e40bc,null));};exports[_0x7020('0x6b')]=function(_0x1a519c,_0x52adb6){var _0x1ea9b2=moment()['unix']()[_0x7020('0x6c')]();var _0x2071b3=path[_0x7020('0x6d')](config[_0x7020('0x6e')],_0x7020('0x6f'),_0x7020('0x70'),_0x7020('0x71'));var _0x427d6d=path['join'](config[_0x7020('0x6e')],_0x7020('0x6f'),_0x7020('0x70'),_0x7020('0x72'));var _0x2a69a1=path[_0x7020('0x6d')](_0x2071b3,_0x1ea9b2);var _0x14224e=util[_0x7020('0x64')]('interaction-%s.zip',_0x1ea9b2);var _0x4fc0d4=path[_0x7020('0x6d')](_0x2071b3,_0x14224e);var _0x22aa98=![];return db[_0x7020('0x2b')][_0x7020('0x58')]({'where':{'id':_0x1a519c[_0x7020('0x57')]['id']},'include':[{'model':db['OpenchannelMessage'],'as':_0x7020('0x47'),'attributes':['id','body'],'include':[{'model':db['User'],'as':_0x7020('0x4a'),'attributes':['id',_0x7020('0x73')],'raw':!![]},{'model':db['CmContact'],'as':_0x7020('0x74'),'attributes':['id',_0x7020('0x75')],'raw':!![]},{'model':db['Attachment'],'as':_0x7020('0x76'),'raw':!![]}]}]})[_0x7020('0x25')](handleEntityNotFound(_0x52adb6,null))[_0x7020('0x25')](function(_0x79cb4a){if(_0x79cb4a){_0x22aa98=!![];var _0x1a8185='';var _0x130ff5={'format':_0x7020('0x77'),'border':_0x7020('0x78')};fs[_0x7020('0x79')](_0x2a69a1);_0x1a8185+=util[_0x7020('0x64')](_0x7020('0x7a'),_0x79cb4a['id']);_0x1a8185+=util[_0x7020('0x64')](_0x7020('0x7b'),moment()[_0x7020('0x64')](_0x7020('0x7c'))[_0x7020('0x6c')]());_0x1a8185+='
';for(var _0x1decb3=0x0;_0x1decb3<_0x79cb4a[_0x7020('0x47')][_0x7020('0x34')];_0x1decb3++){var _0xf9be9f=_0x79cb4a[_0x7020('0x47')][_0x1decb3];_0x1a8185+=_0x7020('0x7d');_0x1a8185+=util[_0x7020('0x64')]('%s:\x20%s

',_0xf9be9f['User']?_0xf9be9f[_0x7020('0x4a')]['fullname']:_0xf9be9f[_0x7020('0x74')][_0x7020('0x75')],_0xf9be9f[_0x7020('0x5a')]);_0x1a8185+=_0x7020('0x7e');if(_0xf9be9f['Attachment']){var _0x540fb4=_0xf9be9f[_0x7020('0x76')];var _0x289d1c=path[_0x7020('0x6d')](_0x427d6d,_0x540fb4['basename']);if(fs['existsSync'](_0x289d1c)){fs[_0x7020('0x7f')](_0x289d1c)[_0x7020('0x80')](fs[_0x7020('0x81')](path[_0x7020('0x6d')](_0x2a69a1,_0x540fb4[_0x7020('0x82')])));}}}return new BPromise(function(_0x46ab2d,_0xaafa28){pdf['create'](_0x1a8185,_0x130ff5)['toFile'](path['join'](_0x2a69a1,_0x7020('0x83')+_0x1ea9b2+_0x7020('0x84')),function(_0x3b5ad6,_0x33b90d){if(_0x3b5ad6)return _0xaafa28(_0x3b5ad6);_0x46ab2d(_0x33b90d);});});}})['then'](function(){if(_0x22aa98){return new BPromise(function(_0x161d4d,_0xdea813){zipdir(_0x2a69a1,{'saveTo':_0x4fc0d4},function(_0x591a05,_0x3991fc){if(_0x591a05)return _0xdea813(_0x591a05);return _0x161d4d(_0x3991fc);});});}})[_0x7020('0x25')](function(){if(_0x22aa98){return new BPromise(function(_0x2a0560,_0x1457a1){rimraf(_0x2a69a1,function(_0x18da40){if(_0x18da40)_0x1457a1(_0x18da40);return _0x2a0560();});});}})['then'](function(){if(_0x22aa98){return _0x52adb6[_0x7020('0x6b')](_0x4fc0d4,_0x14224e,function(_0x5373a3){if(_0x5373a3){console[_0x7020('0x85')](_0x7020('0x86'),_0x5373a3);}else{fs[_0x7020('0x87')](_0x4fc0d4);}});}else{return _0x52adb6['sendStatus'](0xc8);}})[_0x7020('0x55')](handleError(_0x52adb6,null));}; \ No newline at end of file +var _0xc298=['findOne','OpenchannelInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','count','omit','spread','emit','openchannelInteractionTags:save','download','unix','join','root','server','files','attachments','interaction-%s.zip','Contact','Attachment','Letter','1cm','mkdirSync','

Date:\x20%s

','MMMM\x20Do\x20YYYY,\x20HH:mm:ss','
','','%s:\x20%s

','firstName','','basename','existsSync','createReadStream','pipe','createWriteStream','toFile','interaction-','log','unlinkSync','sendStatus','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','end','status','json','offset','limit','set','Content-Range','reject','save','update','then','error','name','send','index','OpenchannelInteraction','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','type','key','VIRTUAL','options','tag','push','Tag','Tags','read','include','OpenchannelMessage','Messages','direction','distinct','includeAll','User','Users','fullname','Owner','OpenchannelAccount','Account','color','ThroughTags','findAll','rows','catch','show','rawAttributes','create','body','find','destroy','describe','addMessage','params','ids','getMessages'];(function(_0x1ea716,_0x5dba3b){var _0x22716e=function(_0x2467e3){while(--_0x2467e3){_0x1ea716['push'](_0x1ea716['shift']());}};_0x22716e(++_0x5dba3b);}(_0xc298,0x143));var _0x8c29=function(_0x3ff751,_0x2cdebf){_0x3ff751=_0x3ff751-0x0;var _0x43de15=_0xc298[_0x3ff751];return _0x43de15;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8c29('0x0'));var rimraf=require(_0x8c29('0x1'));var zipdir=require(_0x8c29('0x2'));var jsonpatch=require(_0x8c29('0x3'));var rp=require(_0x8c29('0x4'));var moment=require(_0x8c29('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8c29('0x6'));var util=require(_0x8c29('0x7'));var path=require(_0x8c29('0x8'));var sox=require(_0x8c29('0x9'));var csv=require(_0x8c29('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8c29('0xb'));var squel=require(_0x8c29('0xc'));var crypto=require(_0x8c29('0xd'));var jsforce=require(_0x8c29('0xe'));var deskjs=require(_0x8c29('0xf'));var toCsv=require(_0x8c29('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0x8c29('0x10'));var Redis=require(_0x8c29('0x11'));var qs=require(_0x8c29('0x12'));var logger=require(_0x8c29('0x13'))(_0x8c29('0x14'));var utils=require(_0x8c29('0x15'));var config=require(_0x8c29('0x16'));var db=require(_0x8c29('0x17'))['db'];config[_0x8c29('0x18')]=_[_0x8c29('0x19')](config[_0x8c29('0x18')],{'host':_0x8c29('0x1a'),'port':0x18eb});var socket=require(_0x8c29('0x1b'))(new Redis(config[_0x8c29('0x18')]));require(_0x8c29('0x1c'))[_0x8c29('0x1d')](socket);function respondWithStatusCode(_0x5a9eb8,_0x3dc480){_0x3dc480=_0x3dc480||0xcc;return function(_0xcdae4d){if(_0xcdae4d){return _0x5a9eb8['sendStatus'](_0x3dc480);}return _0x5a9eb8['status'](_0x3dc480)[_0x8c29('0x1e')]();};}function respondWithResult(_0xe87c50,_0x4929b9){_0x4929b9=_0x4929b9||0xc8;return function(_0x24add4){if(_0x24add4){return _0xe87c50[_0x8c29('0x1f')](_0x4929b9)[_0x8c29('0x20')](_0x24add4);}};}function respondWithFilteredResult(_0x5588a8,_0x14f6cd){return function(_0x37fc8e){if(_0x37fc8e){var _0x10bec5=_0x37fc8e['count'],_0x6324b8=_0x14f6cd[_0x8c29('0x21')],_0x3c3e83=_0x14f6cd[_0x8c29('0x21')]+_0x14f6cd[_0x8c29('0x22')],_0x21ada9;if(_0x3c3e83>=_0x10bec5){_0x3c3e83=_0x10bec5;_0x21ada9=0xc8;}else{_0x21ada9=0xce;}_0x5588a8[_0x8c29('0x1f')](_0x21ada9);return _0x5588a8[_0x8c29('0x23')](_0x8c29('0x24'),_0x6324b8+'-'+_0x3c3e83+'/'+_0x10bec5)[_0x8c29('0x20')](_0x37fc8e);}return null;};}function patchUpdates(_0x10810c){return function(_0x5c62a0){try{jsonpatch['apply'](_0x5c62a0,_0x10810c,!![]);}catch(_0x2702a1){return BPromise[_0x8c29('0x25')](_0x2702a1);}return _0x5c62a0[_0x8c29('0x26')]();};}function saveUpdates(_0x513efd,_0x5a61f3){return function(_0x3fb320){if(_0x3fb320){return _0x3fb320[_0x8c29('0x27')](_0x513efd)[_0x8c29('0x28')](function(_0x157e61){return _0x157e61;});}return null;};}function removeEntity(_0x34cf21,_0x507124){return function(_0x40431d){if(_0x40431d){return _0x40431d['destroy']()[_0x8c29('0x28')](function(){_0x34cf21['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c7979,_0x376297){return function(_0x3a967d){if(!_0x3a967d){_0x2c7979['sendStatus'](0x194);}return _0x3a967d;};}function handleError(_0x38a45c,_0x4e0066){_0x4e0066=_0x4e0066||0x1f4;return function(_0x5cd1e7){logger[_0x8c29('0x29')](_0x5cd1e7['stack']);if(_0x5cd1e7[_0x8c29('0x2a')]){delete _0x5cd1e7[_0x8c29('0x2a')];}_0x38a45c['status'](_0x4e0066)[_0x8c29('0x2b')](_0x5cd1e7);};}exports[_0x8c29('0x2c')]=function(_0x4eee54,_0x2c6ae1){var _0x5dd93a={},_0x48996c={},_0x25f26a={'count':0x0,'rows':[]};var _0x20e42f=db[_0x8c29('0x2d')]['rawAttributes'];_0x48996c[_0x8c29('0x2e')]=_[_0x8c29('0x2f')](_0x20e42f);_0x48996c['query']=_[_0x8c29('0x2f')](_0x4eee54[_0x8c29('0x30')]);_0x48996c['filters']=_[_0x8c29('0x31')](_0x48996c[_0x8c29('0x2e')],_0x48996c[_0x8c29('0x30')]);_0x5dd93a[_0x8c29('0x32')]=_[_0x8c29('0x31')](_0x48996c['model'],qs[_0x8c29('0x33')](_0x4eee54[_0x8c29('0x30')][_0x8c29('0x33')]));_0x5dd93a[_0x8c29('0x32')]=_0x5dd93a[_0x8c29('0x32')][_0x8c29('0x34')]?_0x5dd93a[_0x8c29('0x32')]:_0x48996c['model'];if(!_0x4eee54[_0x8c29('0x30')][_0x8c29('0x35')](_0x8c29('0x36'))){_0x5dd93a['limit']=qs[_0x8c29('0x22')](_0x4eee54[_0x8c29('0x30')]['limit']);_0x5dd93a[_0x8c29('0x21')]=qs[_0x8c29('0x21')](_0x4eee54['query'][_0x8c29('0x21')]);}_0x5dd93a[_0x8c29('0x37')]=qs[_0x8c29('0x38')](_0x4eee54[_0x8c29('0x30')]['sort']);_0x5dd93a[_0x8c29('0x39')]=qs[_0x8c29('0x3a')](_[_0x8c29('0x3b')](_0x4eee54[_0x8c29('0x30')],_0x48996c[_0x8c29('0x3a')]));if(_0x4eee54['query'][_0x8c29('0x3c')]){_0x5dd93a[_0x8c29('0x39')]=_[_0x8c29('0x3d')](_0x5dd93a[_0x8c29('0x39')],{'$or':_[_0x8c29('0x3e')](_0x20e42f,function(_0x280fd8){if(_0x280fd8[_0x8c29('0x3f')][_0x8c29('0x40')]!==_0x8c29('0x41')){var _0x2430b2={};_0x2430b2[_0x280fd8['field']]={'$like':'%'+_0x4eee54[_0x8c29('0x30')][_0x8c29('0x3c')]+'%'};return _0x2430b2;}})});}_0x5dd93a=_['merge']({},_0x5dd93a,_0x4eee54[_0x8c29('0x42')]);var _0x3b277b={'where':_0x5dd93a[_0x8c29('0x39')]};_0x3b277b['include']=[];if(_0x4eee54[_0x8c29('0x30')][_0x8c29('0x43')]){_0x3b277b['include'][_0x8c29('0x44')]({'model':db[_0x8c29('0x45')],'as':_0x8c29('0x46'),'attributes':['id'],'where':{'id':_0x4eee54[_0x8c29('0x30')][_0x8c29('0x43')]},'required':!![]});_0x3b277b['distinct']=!![];}if(_0x4eee54[_0x8c29('0x30')][_0x8c29('0x47')]){_0x3b277b[_0x8c29('0x48')][_0x8c29('0x44')]({'model':db[_0x8c29('0x49')],'as':_0x8c29('0x4a'),'attributes':['id',_0x8c29('0x4b'),'createdAt',_0x8c29('0x47')],'where':{'direction':'in','read':_0x4eee54[_0x8c29('0x30')][_0x8c29('0x47')]||![]},'required':!![]});_0x3b277b[_0x8c29('0x4c')]=!![];}return db['OpenchannelInteraction']['count'](_0x3b277b)[_0x8c29('0x28')](function(_0x778bcf){_0x25f26a['count']=_0x778bcf;if(_0x4eee54[_0x8c29('0x30')][_0x8c29('0x4d')]){_0x5dd93a[_0x8c29('0x48')]=[{'model':db[_0x8c29('0x4e')],'as':_0x8c29('0x4f'),'required':![],'attributes':['id','name',_0x8c29('0x50')]},{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0x8c29('0x51'),'attributes':[_0x8c29('0x2a'),_0x8c29('0x50'),'internal'],'required':![]},{'model':db[_0x8c29('0x52')],'as':_0x8c29('0x53'),'attributes':['name',_0x8c29('0x40')],'required':![]},{'model':db[_0x8c29('0x49')],'as':_0x8c29('0x4a'),'attributes':['id',_0x8c29('0x4b'),'createdAt','read'],'where':{'direction':'in','read':_0x4eee54['query'][_0x8c29('0x47')]||![]},'required':_0x4eee54[_0x8c29('0x30')]['read']||![]},{'model':db['Tag'],'as':_0x8c29('0x46'),'attributes':['id',_0x8c29('0x2a'),_0x8c29('0x54')],'required':_0x4eee54[_0x8c29('0x30')][_0x8c29('0x43')]?!![]:![]},{'model':db[_0x8c29('0x45')],'as':_0x8c29('0x55'),'attributes':['id','name',_0x8c29('0x54')],'through':_0x4eee54[_0x8c29('0x30')][_0x8c29('0x43')]?{'attributes':[],'where':{'TagId':_0x4eee54[_0x8c29('0x30')][_0x8c29('0x43')]||undefined}}:{},'required':_0x4eee54['query'][_0x8c29('0x43')]?!![]:![]}];}return db[_0x8c29('0x2d')][_0x8c29('0x56')](_0x5dd93a);})['then'](function(_0x3b0a04){_0x25f26a[_0x8c29('0x57')]=_0x3b0a04;return _0x25f26a;})[_0x8c29('0x28')](respondWithFilteredResult(_0x2c6ae1,_0x5dd93a))[_0x8c29('0x58')](handleError(_0x2c6ae1,null));};exports[_0x8c29('0x59')]=function(_0x5efe58,_0x23e7c6){var _0x11b351={'raw':![],'where':{'id':_0x5efe58['params']['id']}},_0x4762c1={};_0x4762c1['model']=_[_0x8c29('0x2f')](db[_0x8c29('0x2d')][_0x8c29('0x5a')]);_0x4762c1[_0x8c29('0x30')]=_['keys'](_0x5efe58[_0x8c29('0x30')]);_0x4762c1[_0x8c29('0x3a')]=_[_0x8c29('0x31')](_0x4762c1[_0x8c29('0x2e')],_0x4762c1[_0x8c29('0x30')]);_0x11b351[_0x8c29('0x32')]=_[_0x8c29('0x31')](_0x4762c1['model'],qs[_0x8c29('0x33')](_0x5efe58[_0x8c29('0x30')][_0x8c29('0x33')]));_0x11b351[_0x8c29('0x32')]=_0x11b351[_0x8c29('0x32')][_0x8c29('0x34')]?_0x11b351[_0x8c29('0x32')]:_0x4762c1[_0x8c29('0x2e')];if(_0x5efe58[_0x8c29('0x30')]['includeAll']){_0x11b351[_0x8c29('0x48')]=[{'all':!![]}];}_0x11b351=_[_0x8c29('0x3d')]({},_0x11b351,_0x5efe58[_0x8c29('0x42')]);return db[_0x8c29('0x2d')]['find'](_0x11b351)['then'](handleEntityNotFound(_0x23e7c6,null))[_0x8c29('0x28')](respondWithResult(_0x23e7c6,null))[_0x8c29('0x58')](handleError(_0x23e7c6,null));};exports['create']=function(_0x4d58de,_0x598008){return db[_0x8c29('0x2d')][_0x8c29('0x5b')](_0x4d58de['body'],{})[_0x8c29('0x28')](respondWithResult(_0x598008,0xc9))[_0x8c29('0x58')](handleError(_0x598008,null));};exports[_0x8c29('0x27')]=function(_0x4cd3f7,_0x47f224){if(_0x4cd3f7[_0x8c29('0x5c')]['id']){delete _0x4cd3f7[_0x8c29('0x5c')]['id'];}return db[_0x8c29('0x2d')][_0x8c29('0x5d')]({'where':{'id':_0x4cd3f7['params']['id']}})['then'](handleEntityNotFound(_0x47f224,null))[_0x8c29('0x28')](saveUpdates(_0x4cd3f7[_0x8c29('0x5c')],null))[_0x8c29('0x28')](respondWithResult(_0x47f224,null))[_0x8c29('0x58')](handleError(_0x47f224,null));};exports[_0x8c29('0x5e')]=function(_0x198f48,_0x3d8ebd){return db[_0x8c29('0x2d')][_0x8c29('0x5d')]({'where':{'id':_0x198f48['params']['id']}})[_0x8c29('0x28')](handleEntityNotFound(_0x3d8ebd,null))[_0x8c29('0x28')](removeEntity(_0x3d8ebd,null))['catch'](handleError(_0x3d8ebd,null));};exports[_0x8c29('0x5f')]=function(_0x164d9b,_0xe44912){return db[_0x8c29('0x2d')][_0x8c29('0x5f')]()[_0x8c29('0x28')](respondWithResult(_0xe44912,null))['catch'](handleError(_0xe44912,null));};exports[_0x8c29('0x60')]=function(_0x308979,_0x56b630,_0x3876c8){return db[_0x8c29('0x49')][_0x8c29('0x5d')]({'where':{'id':_0x308979[_0x8c29('0x61')]['id']}})[_0x8c29('0x28')](handleEntityNotFound(_0x56b630,null))['then'](function(_0x3dd79f){if(_0x3dd79f){return _0x3dd79f[_0x8c29('0x60')](_0x308979[_0x8c29('0x5c')][_0x8c29('0x62')],_['omit'](_0x308979[_0x8c29('0x5c')],[_0x8c29('0x62'),'id'])||{});}})[_0x8c29('0x28')](respondWithResult(_0x56b630,null))[_0x8c29('0x58')](handleError(_0x56b630,null));};exports[_0x8c29('0x63')]=function(_0x5b9313,_0x5e258d,_0x3b4e81){var _0xcd576b={'raw':![],'where':{}};var _0x4430ad={};var _0x58cc82={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x8c29('0x64')]({'where':{'id':_0x5b9313[_0x8c29('0x61')]['id']}})[_0x8c29('0x28')](handleEntityNotFound(_0x5e258d,null))[_0x8c29('0x28')](function(_0x18e675){if(_0x18e675){_0x4430ad['model']=_[_0x8c29('0x2f')](db[_0x8c29('0x49')][_0x8c29('0x5a')]);_0x4430ad[_0x8c29('0x30')]=_['keys'](_0x5b9313[_0x8c29('0x30')]);_0x4430ad['filters']=_['intersection'](_0x4430ad[_0x8c29('0x2e')],_0x4430ad[_0x8c29('0x30')]);_0xcd576b[_0x8c29('0x32')]=_['intersection'](_0x4430ad[_0x8c29('0x2e')],qs[_0x8c29('0x33')](_0x5b9313['query'][_0x8c29('0x33')]));_0xcd576b[_0x8c29('0x32')]=_0xcd576b['attributes'][_0x8c29('0x34')]?_0xcd576b[_0x8c29('0x32')]:_0x4430ad[_0x8c29('0x2e')];if(!_0x5b9313[_0x8c29('0x30')]['hasOwnProperty'](_0x8c29('0x36'))){_0xcd576b[_0x8c29('0x22')]=qs['limit'](_0x5b9313[_0x8c29('0x30')][_0x8c29('0x22')]);_0xcd576b['offset']=qs[_0x8c29('0x21')](_0x5b9313['query']['offset']);}_0xcd576b[_0x8c29('0x37')]=qs[_0x8c29('0x38')](_0x5b9313[_0x8c29('0x30')][_0x8c29('0x38')]);_0xcd576b[_0x8c29('0x39')]=qs[_0x8c29('0x3a')](_['pick'](_0x5b9313[_0x8c29('0x30')],_0x4430ad[_0x8c29('0x3a')]));_0xcd576b['where'][_0x8c29('0x65')]=_0x18e675['id'];if(_0x5b9313[_0x8c29('0x30')][_0x8c29('0x3c')]){_0xcd576b['where']=_['merge'](_0xcd576b[_0x8c29('0x39')],{'$or':_[_0x8c29('0x3e')](_0xcd576b['attributes'],function(_0x34c260){var _0x1fc58d={};_0x1fc58d[_0x34c260]={'$like':'%'+_0x5b9313['query']['filter']+'%'};return _0x1fc58d;})});}if(_0x5b9313[_0x8c29('0x30')]['$gte']){var _0x19f933=_0x5b9313['query'][_0x8c29('0x66')][_0x8c29('0x67')](',');var _0x300249={};_0x300249[_0x19f933[0x0]]={'$gte':moment(_0x19f933[0x1])[_0x8c29('0x68')](_0x8c29('0x69'))};_0xcd576b[_0x8c29('0x39')]=_[_0x8c29('0x3d')](_0xcd576b[_0x8c29('0x39')],_0x300249);}_0xcd576b=_['merge']({},_0xcd576b,_0x5b9313[_0x8c29('0x42')]);return db[_0x8c29('0x49')][_0x8c29('0x6a')]({'where':_0xcd576b['where']})[_0x8c29('0x28')](function(_0x3489d4){_0x58cc82[_0x8c29('0x6a')]=_0x3489d4;if(_0x5b9313[_0x8c29('0x30')][_0x8c29('0x4d')]){_0xcd576b[_0x8c29('0x48')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0xcd576b);})[_0x8c29('0x28')](function(_0x100010){_0x58cc82[_0x8c29('0x57')]=_0x100010;return _0x58cc82;});}})[_0x8c29('0x28')](respondWithFilteredResult(_0x5e258d,_0xcd576b))[_0x8c29('0x58')](handleError(_0x5e258d,null));};exports['addTags']=function(_0x574934,_0x3b1e54,_0x474b25){return db[_0x8c29('0x2d')][_0x8c29('0x5d')]({'where':{'id':_0x574934['params']['id']}})['then'](handleEntityNotFound(_0x3b1e54,null))[_0x8c29('0x28')](function(_0x586504){if(_0x586504){return _0x586504['setTags'](_0x574934[_0x8c29('0x5c')][_0x8c29('0x62')],_[_0x8c29('0x6b')](_0x574934['body'],[_0x8c29('0x62'),'id'])||{})[_0x8c29('0x6c')](function(){return db[_0x8c29('0x45')][_0x8c29('0x56')]({'attributes':['id',_0x8c29('0x2a'),'color'],'where':{'id':_0x574934[_0x8c29('0x5c')]['ids']}});})[_0x8c29('0x28')](function(_0x848805){socket[_0x8c29('0x6d')](_0x8c29('0x6e'),{'id':Number(_0x574934[_0x8c29('0x61')]['id']),'tags':_0x848805||[]});return{'id':Number(_0x574934[_0x8c29('0x61')]['id']),'tags':_0x848805||[]};});}})[_0x8c29('0x28')](respondWithResult(_0x3b1e54,null))[_0x8c29('0x58')](handleError(_0x3b1e54,null));};exports['removeTags']=function(_0x35cb73,_0x2258ff,_0x230022){var _0x5833b0;return db[_0x8c29('0x2d')][_0x8c29('0x5d')]({'where':{'id':_0x35cb73['params']['id']}})[_0x8c29('0x28')](handleEntityNotFound(_0x2258ff,null))[_0x8c29('0x28')](function(_0xeb9e22){if(_0xeb9e22){return _0xeb9e22['removeTags'](_0x35cb73[_0x8c29('0x30')][_0x8c29('0x62')]);}})[_0x8c29('0x28')](respondWithStatusCode(_0x2258ff,null))['catch'](handleError(_0x2258ff,null));};exports[_0x8c29('0x6f')]=function(_0x2084be,_0x1d073c){var _0x399ffb=moment()[_0x8c29('0x70')]()['toString']();var _0x1665fa=path[_0x8c29('0x71')](config[_0x8c29('0x72')],'server','files','tmp');var _0x4cc9a7=path[_0x8c29('0x71')](config[_0x8c29('0x72')],_0x8c29('0x73'),_0x8c29('0x74'),_0x8c29('0x75'));var _0x278b25=path[_0x8c29('0x71')](_0x1665fa,_0x399ffb);var _0x1399a2=util[_0x8c29('0x68')](_0x8c29('0x76'),_0x399ffb);var _0x18c5f7=path['join'](_0x1665fa,_0x1399a2);var _0x94b75=![];return db[_0x8c29('0x2d')]['find']({'where':{'id':_0x2084be[_0x8c29('0x61')]['id']},'include':[{'model':db['OpenchannelMessage'],'as':_0x8c29('0x4a'),'attributes':['id','body'],'include':[{'model':db['User'],'as':_0x8c29('0x4e'),'attributes':['id',_0x8c29('0x50')],'raw':!![]},{'model':db['CmContact'],'as':_0x8c29('0x77'),'attributes':['id','firstName'],'raw':!![]},{'model':db[_0x8c29('0x78')],'as':_0x8c29('0x78'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x1d073c,null))[_0x8c29('0x28')](function(_0x1517d5){if(_0x1517d5){_0x94b75=!![];var _0x4121a4='';var _0x1a216e={'format':_0x8c29('0x79'),'border':_0x8c29('0x7a')};fs[_0x8c29('0x7b')](_0x278b25);_0x4121a4+=util[_0x8c29('0x68')]('

Openchannel\x20Interaction:\x20#%d

',_0x1517d5['id']);_0x4121a4+=util['format'](_0x8c29('0x7c'),moment()[_0x8c29('0x68')](_0x8c29('0x7d'))['toString']());_0x4121a4+=_0x8c29('0x7e');for(var _0x3afee4=0x0;_0x3afee4<_0x1517d5[_0x8c29('0x4a')][_0x8c29('0x34')];_0x3afee4++){var _0x1749ef=_0x1517d5['Messages'][_0x3afee4];_0x4121a4+=_0x8c29('0x7f');_0x4121a4+=util['format'](_0x8c29('0x80'),_0x1749ef[_0x8c29('0x4e')]?_0x1749ef[_0x8c29('0x4e')]['fullname']:_0x1749ef[_0x8c29('0x77')][_0x8c29('0x81')],_0x1749ef[_0x8c29('0x5c')]);_0x4121a4+=_0x8c29('0x82');if(_0x1749ef[_0x8c29('0x78')]){var _0x5eaaca=_0x1749ef[_0x8c29('0x78')];var _0x2027f5=path[_0x8c29('0x71')](_0x4cc9a7,_0x5eaaca[_0x8c29('0x83')]);if(fs[_0x8c29('0x84')](_0x2027f5)){fs[_0x8c29('0x85')](_0x2027f5)[_0x8c29('0x86')](fs[_0x8c29('0x87')](path[_0x8c29('0x71')](_0x278b25,_0x5eaaca[_0x8c29('0x83')])));}}}return new BPromise(function(_0x253b6a,_0x1e204a){pdf[_0x8c29('0x5b')](_0x4121a4,_0x1a216e)[_0x8c29('0x88')](path[_0x8c29('0x71')](_0x278b25,_0x8c29('0x89')+_0x399ffb+'.pdf'),function(_0x19da16,_0x1801da){if(_0x19da16)return _0x1e204a(_0x19da16);_0x253b6a(_0x1801da);});});}})['then'](function(){if(_0x94b75){return new BPromise(function(_0x3b911e,_0x49020c){zipdir(_0x278b25,{'saveTo':_0x18c5f7},function(_0x45d9cb,_0x4f4850){if(_0x45d9cb)return _0x49020c(_0x45d9cb);return _0x3b911e(_0x4f4850);});});}})['then'](function(){if(_0x94b75){return new BPromise(function(_0xff91ce,_0x2b5994){rimraf(_0x278b25,function(_0x27dd50){if(_0x27dd50)_0x2b5994(_0x27dd50);return _0xff91ce();});});}})['then'](function(){if(_0x94b75){return _0x1d073c[_0x8c29('0x6f')](_0x18c5f7,_0x1399a2,function(_0x4b931a){if(_0x4b931a){console[_0x8c29('0x8a')]('err',_0x4b931a);}else{fs[_0x8c29('0x8b')](_0x18c5f7);}});}else{return _0x1d073c[_0x8c29('0x8c')](0xc8);}})[_0x8c29('0x58')](handleError(_0x1d073c,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 805626f..c85ac0a 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 _0x8b17=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b17,0x1bd));var _0x78b1=function(_0x217199,_0x3fdf8d){_0x217199=_0x217199-0x0;var _0x9442bd=_0x8b17[_0x217199];return _0x9442bd;};'use strict';var EventEmitter=require(_0x78b1('0x0'));var OpenchannelInteraction=require(_0x78b1('0x1'))['db'][_0x78b1('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x78b1('0x3')](0x0);var events={'afterCreate':_0x78b1('0x4'),'afterUpdate':'update','afterDestroy':_0x78b1('0x5')};function emitEvent(_0x3ef8dc){return function(_0x20bcad,_0x5e5495,_0x474e6f){OpenchannelInteractionEvents[_0x78b1('0x6')](_0x3ef8dc+':'+_0x20bcad['id'],_0x20bcad);OpenchannelInteractionEvents[_0x78b1('0x6')](_0x3ef8dc,_0x20bcad);_0x474e6f(null);};}for(var e in events){if(events[_0x78b1('0x7')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x78b1('0x8')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xeedc=['remove','emit','hook','exports','events','../../mysqldb','OpenchannelInteraction','update'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0xeedc,0x16c));var _0xceed=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xeedc[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xceed('0x0'));var OpenchannelInteraction=require(_0xceed('0x1'))['db'][_0xceed('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xceed('0x3'),'afterDestroy':_0xceed('0x4')};function emitEvent(_0x3d4519){return function(_0x346cd3,_0x3f0005,_0x9f6b17){OpenchannelInteractionEvents[_0xceed('0x5')](_0x3d4519+':'+_0x346cd3['id'],_0x346cd3);OpenchannelInteractionEvents[_0xceed('0x5')](_0x3d4519,_0x346cd3);_0x9f6b17(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xceed('0x6')](e,emitEvent(event));}}module[_0xceed('0x7')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 8039fee..0f2bad5 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 _0x25ff=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','changed','closed','closedAt','format'];(function(_0x2c4101,_0x4cf4cd){var _0x4665cc=function(_0x249b06){while(--_0x249b06){_0x2c4101['push'](_0x2c4101['shift']());}};_0x4665cc(++_0x4cf4cd);}(_0x25ff,0x16d));var _0xf25f=function(_0x449f15,_0x292b88){_0x449f15=_0x449f15-0x0;var _0x1f93fe=_0x25ff[_0x449f15];return _0x1f93fe;};'use strict';var _=require(_0xf25f('0x0'));var util=require(_0xf25f('0x1'));var logger=require(_0xf25f('0x2'))(_0xf25f('0x3'));var moment=require('moment');var BPromise=require(_0xf25f('0x4'));var rp=require('request-promise');var attributes=require(_0xf25f('0x5'));module[_0xf25f('0x6')]=function(_0x21343e,_0x5b4362){return _0x21343e[_0xf25f('0x7')](_0xf25f('0x8'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x398f89,_0x33b06a,_0x1f0de3){if(_0x398f89[_0xf25f('0x9')](_0xf25f('0xa'))){_0x398f89[_0xf25f('0xb')]=moment()[_0xf25f('0xc')](_0xf25f('0xd'));}_0x1f0de3(null,_0x398f89);}}});}; \ No newline at end of file +var _0xa3b8=['bluebird','request-promise','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt','format','../../config/logger','api','moment'];(function(_0x45cc41,_0x1b4281){var _0x14f2b0=function(_0x251a5c){while(--_0x251a5c){_0x45cc41['push'](_0x45cc41['shift']());}};_0x14f2b0(++_0x1b4281);}(_0xa3b8,0x169));var _0x8a3b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa3b8[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8a3b('0x0'))(_0x8a3b('0x1'));var moment=require(_0x8a3b('0x2'));var BPromise=require(_0x8a3b('0x3'));var rp=require(_0x8a3b('0x4'));var attributes=require(_0x8a3b('0x5'));module[_0x8a3b('0x6')]=function(_0x2062d8,_0x1a5129){return _0x2062d8['define'](_0x8a3b('0x7'),attributes,{'tableName':_0x8a3b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3350e5,_0x46360a,_0x568258){if(_0x3350e5[_0x8a3b('0x9')](_0x8a3b('0xa'))){_0x3350e5[_0x8a3b('0xb')]=moment()[_0x8a3b('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x568258(null,_0x3350e5);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index e47bebf..5cd70dd 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 _0x0309=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','socket.io-emitter','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','body','options','raw','where','limit','debug','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','randomstring'];(function(_0x4c9f70,_0x53990b){var _0x3b1dd9=function(_0x1548fa){while(--_0x1548fa){_0x4c9f70['push'](_0x4c9f70['shift']());}};_0x3b1dd9(++_0x53990b);}(_0x0309,0x165));var _0x9030=function(_0x508c81,_0x2c2c9e){_0x508c81=_0x508c81-0x0;var _0x3924a3=_0x0309[_0x508c81];return _0x3924a3;};'use strict';var _=require(_0x9030('0x0'));var util=require('util');var moment=require(_0x9030('0x1'));var BPromise=require('bluebird');var rs=require(_0x9030('0x2'));var fs=require('fs');var Redis=require(_0x9030('0x3'));var db=require(_0x9030('0x4'))['db'];var utils=require(_0x9030('0x5'));var logger=require(_0x9030('0x6'))(_0x9030('0x7'));var config=require(_0x9030('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9030('0x9')]({'port':0x232a});config[_0x9030('0xa')]=_['defaults'](config[_0x9030('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x9030('0xb'))(new Redis(config[_0x9030('0xa')]));require(_0x9030('0xc'))['register'](socket);function respondWithRpcPromise(_0xe2c28b,_0x1da9ec,_0x337b86){return new BPromise(function(_0x53ef39,_0x37d6e0){return client[_0x9030('0xd')](_0xe2c28b,_0x337b86)[_0x9030('0xe')](function(_0x11a539){logger[_0x9030('0xf')](_0x9030('0x10'),_0x1da9ec,_0x9030('0x11'));logger['debug'](_0x9030('0x12'),_0x1da9ec,_0x9030('0x11'),JSON[_0x9030('0x13')](_0x11a539));if(_0x11a539[_0x9030('0x14')]){if(_0x11a539['error'][_0x9030('0x15')]===0x1f4){logger[_0x9030('0x14')](_0x9030('0x10'),_0x1da9ec,_0x11a539[_0x9030('0x14')][_0x9030('0x16')]);return _0x37d6e0(_0x11a539[_0x9030('0x14')][_0x9030('0x16')]);}logger[_0x9030('0x14')](_0x9030('0x10'),_0x1da9ec,_0x11a539['error'][_0x9030('0x16')]);return _0x53ef39(_0x11a539[_0x9030('0x14')][_0x9030('0x16')]);}else{logger[_0x9030('0xf')](_0x9030('0x10'),_0x1da9ec,_0x9030('0x11'));_0x53ef39(_0x11a539[_0x9030('0x17')][_0x9030('0x16')]);}})[_0x9030('0x18')](function(_0x31e196){logger[_0x9030('0x14')](_0x9030('0x10'),_0x1da9ec,_0x31e196);_0x37d6e0(_0x31e196);});});}exports[_0x9030('0x19')]=function(_0x243e7d){var _0x1e5988=this;return new Promise(function(_0x285d93,_0x4105ec){return db['OpenchannelInteraction']['update'](_0x243e7d[_0x9030('0x1a')],{'raw':_0x243e7d[_0x9030('0x1b')]?_0x243e7d['options'][_0x9030('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x243e7d[_0x9030('0x1b')]?_0x243e7d[_0x9030('0x1b')][_0x9030('0x1d')]||null:null,'attributes':_0x243e7d['options']?_0x243e7d[_0x9030('0x1b')]['attributes']||null:null,'limit':_0x243e7d['options']?_0x243e7d[_0x9030('0x1b')][_0x9030('0x1e')]||null:null})[_0x9030('0xe')](function(_0x539bb7){logger[_0x9030('0xf')](_0x9030('0x19'),_0x243e7d);logger[_0x9030('0x1f')](_0x9030('0x19'),_0x243e7d,JSON[_0x9030('0x13')](_0x539bb7));_0x285d93(_0x539bb7);})['catch'](function(_0x5ca691){logger[_0x9030('0x14')](_0x9030('0x19'),_0x5ca691[_0x9030('0x16')],_0x243e7d);_0x4105ec(_0x1e5988[_0x9030('0x14')](0x1f4,_0x5ca691[_0x9030('0x16')]));});});};exports[_0x9030('0x20')]=function(_0x2112cf){return new Promise(function(_0x26a803,_0x11c47d){return db[_0x9030('0x21')][_0x9030('0x22')]({'where':_0x2112cf[_0x9030('0x1b')]?_0x2112cf[_0x9030('0x1b')]['where']||null:null})[_0x9030('0xe')](function(_0x4b042c){if(_0x4b042c){return _0x4b042c[_0x9030('0x23')](_0x2112cf['body'][_0x9030('0x24')],_[_0x9030('0x25')](_0x2112cf[_0x9030('0x1a')],['ids','id'])||{});}})[_0x9030('0x26')](function(_0x1b1fb7){logger[_0x9030('0xf')](_0x9030('0x27'),_0x2112cf);logger[_0x9030('0x1f')](_0x9030('0x27'),_0x2112cf,JSON[_0x9030('0x13')](_0x1b1fb7));_0x26a803(_0x1b1fb7);})[_0x9030('0x18')](function(_0x134260){logger[_0x9030('0x14')](_0x9030('0x27'),_0x134260[_0x9030('0x16')],_0x2112cf);_0x11c47d(_this[_0x9030('0x14')](0x1f4,_0x134260[_0x9030('0x16')]));});});}; \ No newline at end of file +var _0x11e5=['message','OpenchannelInteraction,\x20%s,\x20%s','info','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','catch','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xf30f69,_0xa28724){var _0x3ccaa9=function(_0x2dbf29){while(--_0x2dbf29){_0xf30f69['push'](_0xf30f69['shift']());}};_0x3ccaa9(++_0xa28724);}(_0x11e5,0x8b));var _0x511e=function(_0x13ac6f,_0x3a8e38){_0x13ac6f=_0x13ac6f-0x0;var _0x346459=_0x11e5[_0x13ac6f];return _0x346459;};'use strict';var _=require(_0x511e('0x0'));var util=require('util');var moment=require(_0x511e('0x1'));var BPromise=require(_0x511e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x511e('0x3'));var db=require(_0x511e('0x4'))['db'];var utils=require(_0x511e('0x5'));var logger=require('../../config/logger')(_0x511e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x511e('0x7')][_0x511e('0x8')]({'port':0x232a});config[_0x511e('0x9')]=_['defaults'](config['redis'],{'host':_0x511e('0xa'),'port':0x18eb});var socket=require(_0x511e('0xb'))(new Redis(config[_0x511e('0x9')]));require(_0x511e('0xc'))[_0x511e('0xd')](socket);function respondWithRpcPromise(_0x30269e,_0x1596b3,_0x50564b){return new BPromise(function(_0x2f547a,_0x1c6def){return client[_0x511e('0xe')](_0x30269e,_0x50564b)['then'](function(_0x7e50db){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x1596b3,_0x511e('0xf'));logger[_0x511e('0x10')](_0x511e('0x11'),_0x1596b3,_0x511e('0xf'),JSON[_0x511e('0x12')](_0x7e50db));if(_0x7e50db[_0x511e('0x13')]){if(_0x7e50db['error'][_0x511e('0x14')]===0x1f4){logger[_0x511e('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1596b3,_0x7e50db[_0x511e('0x13')][_0x511e('0x15')]);return _0x1c6def(_0x7e50db['error'][_0x511e('0x15')]);}logger[_0x511e('0x13')](_0x511e('0x16'),_0x1596b3,_0x7e50db[_0x511e('0x13')]['message']);return _0x2f547a(_0x7e50db[_0x511e('0x13')][_0x511e('0x15')]);}else{logger[_0x511e('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1596b3,_0x511e('0xf'));_0x2f547a(_0x7e50db['result'][_0x511e('0x15')]);}})['catch'](function(_0x5821ee){logger[_0x511e('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1596b3,_0x5821ee);_0x1c6def(_0x5821ee);});});}exports[_0x511e('0x18')]=function(_0x325278){var _0x211855=this;return new Promise(function(_0x3cbc5a,_0xd4df6f){return db[_0x511e('0x19')][_0x511e('0x1a')](_0x325278[_0x511e('0x1b')],{'raw':_0x325278['options']?_0x325278[_0x511e('0x1c')][_0x511e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x325278[_0x511e('0x1c')]?_0x325278[_0x511e('0x1c')][_0x511e('0x1e')]||null:null,'attributes':_0x325278[_0x511e('0x1c')]?_0x325278[_0x511e('0x1c')][_0x511e('0x1f')]||null:null,'limit':_0x325278[_0x511e('0x1c')]?_0x325278[_0x511e('0x1c')]['limit']||null:null})['then'](function(_0x3e1711){logger['info'](_0x511e('0x18'),_0x325278);logger['debug'](_0x511e('0x18'),_0x325278,JSON[_0x511e('0x12')](_0x3e1711));_0x3cbc5a(_0x3e1711);})[_0x511e('0x20')](function(_0x1f8040){logger[_0x511e('0x13')](_0x511e('0x18'),_0x1f8040[_0x511e('0x15')],_0x325278);_0xd4df6f(_0x211855[_0x511e('0x13')](0x1f4,_0x1f8040[_0x511e('0x15')]));});});};exports[_0x511e('0x21')]=function(_0x5b72fe){return new Promise(function(_0x2930b2,_0x1d754d){return db[_0x511e('0x19')][_0x511e('0x22')]({'where':_0x5b72fe[_0x511e('0x1c')]?_0x5b72fe['options'][_0x511e('0x1e')]||null:null})['then'](function(_0x4f6844){if(_0x4f6844){return _0x4f6844[_0x511e('0x23')](_0x5b72fe[_0x511e('0x1b')][_0x511e('0x24')],_[_0x511e('0x25')](_0x5b72fe[_0x511e('0x1b')],['ids','id'])||{});}})[_0x511e('0x26')](function(_0x2e6529){logger[_0x511e('0x17')](_0x511e('0x27'),_0x5b72fe);logger[_0x511e('0x10')]('AddTags',_0x5b72fe,JSON[_0x511e('0x12')](_0x2e6529));_0x2930b2(_0x2e6529);})[_0x511e('0x20')](function(_0x1641e3){logger[_0x511e('0x13')](_0x511e('0x27'),_0x1641e3[_0x511e('0x15')],_0x5b72fe);_0x1d754d(_this[_0x511e('0x13')](0x1f4,_0x1641e3[_0x511e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 9713ce8..5cae7db 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 _0x2fbf=['register','length','save','remove','update','emit','removeListener'];(function(_0x5505d8,_0x22066c){var _0x4a273b=function(_0x3b8a64){while(--_0x3b8a64){_0x5505d8['push'](_0x5505d8['shift']());}};_0x4a273b(++_0x22066c);}(_0x2fbf,0xaa));var _0xf2fb=function(_0xed29c8,_0x2227f3){_0xed29c8=_0xed29c8-0x0;var _0x226812=_0x2fbf[_0xed29c8];return _0x226812;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xf2fb('0x0'),_0xf2fb('0x1'),_0xf2fb('0x2')];function createListener(_0x44ef4b,_0x1d9196){return function(_0x5dc659){_0x1d9196[_0xf2fb('0x3')](_0x44ef4b,_0x5dc659);};}function removeListener(_0x31f9aa,_0x34270b){return function(){OpenchannelInteractionEvents[_0xf2fb('0x4')](_0x31f9aa,_0x34270b);};}exports[_0xf2fb('0x5')]=function(_0xa63f00){for(var _0xcf17b=0x0,_0x4232e5=events[_0xf2fb('0x6')];_0xcf17b<_0x4232e5;_0xcf17b++){var _0x32fa43=events[_0xcf17b];var _0x59ba6a=createListener('openchannelInteraction:'+_0x32fa43,_0xa63f00);OpenchannelInteractionEvents['on'](_0x32fa43,_0x59ba6a);}}; \ No newline at end of file +var _0xb094=['register','length','openchannelInteraction:','./openchannelInteraction.events','remove','update','emit','removeListener'];(function(_0x59bc72,_0xb4ddea){var _0x56c1b4=function(_0x45aab2){while(--_0x45aab2){_0x59bc72['push'](_0x59bc72['shift']());}};_0x56c1b4(++_0xb4ddea);}(_0xb094,0x10b));var _0x4b09=function(_0x2d7c6a,_0x3ffd46){_0x2d7c6a=_0x2d7c6a-0x0;var _0x3ca318=_0xb094[_0x2d7c6a];return _0x3ca318;};'use strict';var OpenchannelInteractionEvents=require(_0x4b09('0x0'));var events=['save',_0x4b09('0x1'),_0x4b09('0x2')];function createListener(_0x2e50de,_0x56d970){return function(_0x1764f2){_0x56d970[_0x4b09('0x3')](_0x2e50de,_0x1764f2);};}function removeListener(_0x15e6e0,_0x11359c){return function(){OpenchannelInteractionEvents[_0x4b09('0x4')](_0x15e6e0,_0x11359c);};}exports[_0x4b09('0x5')]=function(_0x2d1c5b){for(var _0x16b888=0x0,_0x40e6cd=events[_0x4b09('0x6')];_0x16b888<_0x40e6cd;_0x16b888++){var _0x232cac=events[_0x16b888];var _0x518b95=createListener(_0x4b09('0x7')+_0x232cac,_0x2d1c5b);OpenchannelInteractionEvents['on'](_0x232cac,_0x518b95);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index a04e5e9..31da501 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 _0xafab=['destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','post','tracked','openchannel','create','update','put','/:id/accept','/:id/reject','reject'];(function(_0x150397,_0x258581){var _0x5cadab=function(_0x3052d6){while(--_0x3052d6){_0x150397['push'](_0x150397['shift']());}};_0x5cadab(++_0x258581);}(_0xafab,0x122));var _0xbafa=function(_0x3c9a82,_0x36670d){_0x3c9a82=_0x3c9a82-0x0;var _0x4f47dc=_0xafab[_0x3c9a82];return _0x4f47dc;};'use strict';var multer=require(_0xbafa('0x0'));var util=require(_0xbafa('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbafa('0x2'));var router=express['Router']();var auth=require(_0xbafa('0x3'));var interaction=require(_0xbafa('0x4'));var config=require(_0xbafa('0x5'));var controller=require(_0xbafa('0x6'));router['get']('/',auth[_0xbafa('0x7')](),controller[_0xbafa('0x8')]);router[_0xbafa('0x9')](_0xbafa('0xa'),auth[_0xbafa('0x7')](),controller[_0xbafa('0xb')]);router[_0xbafa('0x9')](_0xbafa('0xc'),auth[_0xbafa('0x7')](),controller['show']);router[_0xbafa('0xd')]('/',auth['isAuthenticated'](),interaction[_0xbafa('0xe')](_0xbafa('0xf'),'openchannelmessage:create'),controller[_0xbafa('0x10')]);router['put'](_0xbafa('0xc'),auth[_0xbafa('0x7')](),controller[_0xbafa('0x11')]);router[_0xbafa('0x12')](_0xbafa('0x13'),auth[_0xbafa('0x7')](),controller['accept']);router[_0xbafa('0x12')](_0xbafa('0x14'),auth[_0xbafa('0x7')](),controller[_0xbafa('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xbafa('0x16')]);module[_0xbafa('0x17')]=router; \ No newline at end of file +var _0xf5c8=['./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannelmessage:create','create','put','update','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','../../components/interaction/service'];(function(_0x56a134,_0x54cd11){var _0x3ff314=function(_0x35d97a){while(--_0x35d97a){_0x56a134['push'](_0x56a134['shift']());}};_0x3ff314(++_0x54cd11);}(_0xf5c8,0x155));var _0x8f5c=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0xf5c8[_0x31a371];return _0x2a5bd6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8f5c('0x0'));var timeout=require(_0x8f5c('0x1'));var express=require(_0x8f5c('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8f5c('0x3'));var config=require('../../config/environment');var controller=require(_0x8f5c('0x4'));router[_0x8f5c('0x5')]('/',auth[_0x8f5c('0x6')](),controller[_0x8f5c('0x7')]);router[_0x8f5c('0x5')](_0x8f5c('0x8'),auth[_0x8f5c('0x6')](),controller[_0x8f5c('0x9')]);router[_0x8f5c('0x5')](_0x8f5c('0xa'),auth[_0x8f5c('0x6')](),controller[_0x8f5c('0xb')]);router[_0x8f5c('0xc')]('/',auth['isAuthenticated'](),interaction[_0x8f5c('0xd')]('openchannel',_0x8f5c('0xe')),controller[_0x8f5c('0xf')]);router[_0x8f5c('0x10')](_0x8f5c('0xa'),auth[_0x8f5c('0x6')](),controller[_0x8f5c('0x11')]);router[_0x8f5c('0x10')]('/:id/accept',auth[_0x8f5c('0x6')](),controller['accept']);router[_0x8f5c('0x10')](_0x8f5c('0x12'),auth['isAuthenticated'](),controller[_0x8f5c('0x13')]);router[_0x8f5c('0x14')](_0x8f5c('0xa'),auth[_0x8f5c('0x6')](),controller[_0x8f5c('0x15')]);module[_0x8f5c('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index d661c93..6b6e0e1 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 _0x4214=['exports','TEXT','medium','BOOLEAN','ENUM','out','sequelize'];(function(_0x26ad12,_0x311c4b){var _0x544d01=function(_0x5315bd){while(--_0x5315bd){_0x26ad12['push'](_0x26ad12['shift']());}};_0x544d01(++_0x311c4b);}(_0x4214,0xbc));var _0x4421=function(_0x5b48a9,_0x577cee){_0x5b48a9=_0x5b48a9-0x0;var _0x1f07a9=_0x4214[_0x5b48a9];return _0x1f07a9;};'use strict';var Sequelize=require(_0x4421('0x0'));module[_0x4421('0x1')]={'body':{'type':Sequelize[_0x4421('0x2')](_0x4421('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4421('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4421('0x5')]('in',_0x4421('0x6')),'defaultValue':_0x4421('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x53d0=['out','DATE','sequelize','exports','BOOLEAN','ENUM'];(function(_0x15a88e,_0x2acfeb){var _0xe94ba0=function(_0x58c081){while(--_0x58c081){_0x15a88e['push'](_0x15a88e['shift']());}};_0xe94ba0(++_0x2acfeb);}(_0x53d0,0x1c4));var _0x053d=function(_0x237ee6,_0x5782be){_0x237ee6=_0x237ee6-0x0;var _0x1410cc=_0x53d0[_0x237ee6];return _0x1410cc;};'use strict';var Sequelize=require(_0x053d('0x0'));module[_0x053d('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x053d('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x053d('0x3')]('in',_0x053d('0x4')),'defaultValue':_0x053d('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x053d('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index e380026..18ab27b 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 _0x8832=['OpenchannelMessage','include','show','params','includeAll','find','create','body','describe','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','reject','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','./openchannelMessage.socket','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','OpenchannelMessage,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','type','key','options'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x8832,0x11a));var _0x2883=function(_0x1ca236,_0x302fae){_0x1ca236=_0x1ca236-0x0;var _0x45ee50=_0x8832[_0x1ca236];return _0x45ee50;};'use strict';var pdf=require(_0x2883('0x0'));var emlformat=require(_0x2883('0x1'));var rimraf=require(_0x2883('0x2'));var zipdir=require(_0x2883('0x3'));var jsonpatch=require(_0x2883('0x4'));var rp=require(_0x2883('0x5'));var moment=require(_0x2883('0x6'));var BPromise=require(_0x2883('0x7'));var Mustache=require('mustache');var util=require(_0x2883('0x8'));var path=require(_0x2883('0x9'));var sox=require(_0x2883('0xa'));var csv=require('to-csv');var ejs=require(_0x2883('0xb'));var fs=require('fs');var _=require(_0x2883('0xc'));var squel=require('squel');var crypto=require(_0x2883('0xd'));var jsforce=require(_0x2883('0xe'));var deskjs=require(_0x2883('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2883('0x10'));var Papa=require(_0x2883('0x11'));var authService=require(_0x2883('0x12'));var hardwareService=require(_0x2883('0x13'));var Redis=require('ioredis');var qs=require(_0x2883('0x14'));var logger=require(_0x2883('0x15'))(_0x2883('0x16'));var utils=require(_0x2883('0x17'));var config=require('../../config/environment');var db=require(_0x2883('0x18'))['db'];config['redis']=_[_0x2883('0x19')](config[_0x2883('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2883('0x1b'))['register'](socket);var jayson=require(_0x2883('0x1c'));var client=jayson[_0x2883('0x1d')][_0x2883('0x1e')]({'port':0x232c});var client9002=jayson[_0x2883('0x1d')][_0x2883('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3cdc76,_0x252ab7,_0x287192,_0x284450){return new BPromise(function(_0x2bbb9c,_0x3efddb){var _0x503f8d=_0x284450||client;return _0x503f8d[_0x2883('0x1f')](_0x3cdc76,_0x287192)[_0x2883('0x20')](function(_0x2c5e62){logger[_0x2883('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x252ab7,_0x2883('0x22'));logger[_0x2883('0x23')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x252ab7,_0x2883('0x22'),JSON[_0x2883('0x24')](_0x2c5e62));if(_0x2c5e62[_0x2883('0x25')]){if(_0x2c5e62[_0x2883('0x25')]['code']===0x1f4){logger['error'](_0x2883('0x26'),_0x252ab7,_0x2c5e62[_0x2883('0x25')]['message']);return _0x3efddb(_0x2c5e62['error'][_0x2883('0x27')]);}logger[_0x2883('0x25')](_0x2883('0x26'),_0x252ab7,_0x2c5e62[_0x2883('0x25')][_0x2883('0x27')]);return _0x2bbb9c(_0x2c5e62['error'][_0x2883('0x27')]);}else{logger[_0x2883('0x21')](_0x2883('0x26'),_0x252ab7,_0x2883('0x22'));_0x2bbb9c(_0x2c5e62['result']['message']);}})[_0x2883('0x28')](function(_0x3c037d){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x252ab7,_0x3c037d);_0x3efddb(_0x3c037d);});});}function respondWithStatusCode(_0x46568a,_0x5b39dc){_0x5b39dc=_0x5b39dc||0xcc;return function(_0x42981a){if(_0x42981a){return _0x46568a[_0x2883('0x29')](_0x5b39dc);}return _0x46568a[_0x2883('0x2a')](_0x5b39dc)[_0x2883('0x2b')]();};}function respondWithResult(_0x49dad7,_0x1ed481){_0x1ed481=_0x1ed481||0xc8;return function(_0x34416f){if(_0x34416f){return _0x49dad7[_0x2883('0x2a')](_0x1ed481)[_0x2883('0x2c')](_0x34416f);}};}function respondWithFilteredResult(_0xda4643,_0x4af7cf){return function(_0x3beb9d){if(_0x3beb9d){var _0x8b0b0e=_0x3beb9d[_0x2883('0x2d')],_0xe03bc=_0x4af7cf[_0x2883('0x2e')],_0x37880b=_0x4af7cf[_0x2883('0x2e')]+_0x4af7cf[_0x2883('0x2f')],_0x509cf1;if(_0x37880b>=_0x8b0b0e){_0x37880b=_0x8b0b0e;_0x509cf1=0xc8;}else{_0x509cf1=0xce;}_0xda4643['status'](_0x509cf1);return _0xda4643[_0x2883('0x30')](_0x2883('0x31'),_0xe03bc+'-'+_0x37880b+'/'+_0x8b0b0e)[_0x2883('0x2c')](_0x3beb9d);}return null;};}function patchUpdates(_0x39da8f){return function(_0x3a82b5){try{jsonpatch[_0x2883('0x32')](_0x3a82b5,_0x39da8f,!![]);}catch(_0x28dedf){return BPromise['reject'](_0x28dedf);}return _0x3a82b5[_0x2883('0x33')]();};}function saveUpdates(_0x2f8a1b,_0x5ca493){return function(_0x5e3036){if(_0x5e3036){return _0x5e3036[_0x2883('0x34')](_0x2f8a1b)[_0x2883('0x20')](function(_0x50be32){return _0x50be32;});}return null;};}function removeEntity(_0x13f91b,_0x5902d4){return function(_0x540c11){if(_0x540c11){return _0x540c11[_0x2883('0x35')]()[_0x2883('0x20')](function(){_0x13f91b[_0x2883('0x2a')](0xcc)[_0x2883('0x2b')]();});}};}function handleEntityNotFound(_0x7dfbab,_0xfff112){return function(_0x5589f0){if(!_0x5589f0){_0x7dfbab['sendStatus'](0x194);}return _0x5589f0;};}function handleError(_0x123b5d,_0x185e77){_0x185e77=_0x185e77||0x1f4;return function(_0x4b32c4){logger[_0x2883('0x25')](_0x4b32c4[_0x2883('0x36')]);if(_0x4b32c4[_0x2883('0x37')]){delete _0x4b32c4['name'];}_0x123b5d['status'](_0x185e77)[_0x2883('0x38')](_0x4b32c4);};}exports[_0x2883('0x39')]=function(_0x21a584,_0x5e3ced){var _0x3e0696={},_0x52eb87={},_0x13ab31={'count':0x0,'rows':[]};var _0x5e3d36=db['OpenchannelMessage'][_0x2883('0x3a')];_0x52eb87[_0x2883('0x3b')]=_[_0x2883('0x3c')](_0x5e3d36);_0x52eb87[_0x2883('0x3d')]=_[_0x2883('0x3c')](_0x21a584['query']);_0x52eb87[_0x2883('0x3e')]=_[_0x2883('0x3f')](_0x52eb87[_0x2883('0x3b')],_0x52eb87[_0x2883('0x3d')]);_0x3e0696[_0x2883('0x40')]=_['intersection'](_0x52eb87['model'],qs[_0x2883('0x41')](_0x21a584[_0x2883('0x3d')][_0x2883('0x41')]));_0x3e0696[_0x2883('0x40')]=_0x3e0696[_0x2883('0x40')][_0x2883('0x42')]?_0x3e0696[_0x2883('0x40')]:_0x52eb87[_0x2883('0x3b')];if(!_0x21a584[_0x2883('0x3d')][_0x2883('0x43')](_0x2883('0x44'))){_0x3e0696[_0x2883('0x2f')]=qs['limit'](_0x21a584['query']['limit']);_0x3e0696[_0x2883('0x2e')]=qs[_0x2883('0x2e')](_0x21a584[_0x2883('0x3d')]['offset']);}_0x3e0696['order']=qs[_0x2883('0x45')](_0x21a584['query'][_0x2883('0x45')]);_0x3e0696[_0x2883('0x46')]=qs['filters'](_[_0x2883('0x47')](_0x21a584['query'],_0x52eb87[_0x2883('0x3e')]));if(_0x21a584[_0x2883('0x3d')][_0x2883('0x48')]){_0x3e0696['where']=_[_0x2883('0x49')](_0x3e0696[_0x2883('0x46')],{'$or':_[_0x2883('0x4a')](_0x5e3d36,function(_0x131baf){if(_0x131baf[_0x2883('0x4b')][_0x2883('0x4c')]!=='VIRTUAL'){var _0x11f6bd={};_0x11f6bd[_0x131baf['field']]={'$like':'%'+_0x21a584['query'][_0x2883('0x48')]+'%'};return _0x11f6bd;}})});}_0x3e0696=_[_0x2883('0x49')]({},_0x3e0696,_0x21a584[_0x2883('0x4d')]);var _0x4e18d7={'where':_0x3e0696[_0x2883('0x46')]};return db[_0x2883('0x4e')][_0x2883('0x2d')](_0x4e18d7)[_0x2883('0x20')](function(_0x5d5d60){_0x13ab31['count']=_0x5d5d60;if(_0x21a584[_0x2883('0x3d')]['includeAll']){_0x3e0696[_0x2883('0x4f')]=[{'all':!![]}];}return db[_0x2883('0x4e')]['findAll'](_0x3e0696);})[_0x2883('0x20')](function(_0x1d5874){_0x13ab31['rows']=_0x1d5874;return _0x13ab31;})[_0x2883('0x20')](respondWithFilteredResult(_0x5e3ced,_0x3e0696))[_0x2883('0x28')](handleError(_0x5e3ced,null));};exports[_0x2883('0x50')]=function(_0x3bf5ab,_0x4b17df){var _0x5223b0={'raw':!![],'where':{'id':_0x3bf5ab[_0x2883('0x51')]['id']}},_0xfba3e8={};_0xfba3e8['model']=_[_0x2883('0x3c')](db['OpenchannelMessage'][_0x2883('0x3a')]);_0xfba3e8[_0x2883('0x3d')]=_[_0x2883('0x3c')](_0x3bf5ab['query']);_0xfba3e8[_0x2883('0x3e')]=_[_0x2883('0x3f')](_0xfba3e8[_0x2883('0x3b')],_0xfba3e8['query']);_0x5223b0[_0x2883('0x40')]=_[_0x2883('0x3f')](_0xfba3e8[_0x2883('0x3b')],qs[_0x2883('0x41')](_0x3bf5ab[_0x2883('0x3d')][_0x2883('0x41')]));_0x5223b0[_0x2883('0x40')]=_0x5223b0['attributes'][_0x2883('0x42')]?_0x5223b0[_0x2883('0x40')]:_0xfba3e8['model'];if(_0x3bf5ab[_0x2883('0x3d')][_0x2883('0x52')]){_0x5223b0[_0x2883('0x4f')]=[{'all':!![]}];}_0x5223b0=_[_0x2883('0x49')]({},_0x5223b0,_0x3bf5ab[_0x2883('0x4d')]);return db[_0x2883('0x4e')][_0x2883('0x53')](_0x5223b0)[_0x2883('0x20')](handleEntityNotFound(_0x4b17df,null))[_0x2883('0x20')](respondWithResult(_0x4b17df,null))[_0x2883('0x28')](handleError(_0x4b17df,null));};exports['create']=function(_0x3ead81,_0x78f887){return db[_0x2883('0x4e')][_0x2883('0x54')](_0x3ead81[_0x2883('0x55')],{})[_0x2883('0x20')](respondWithResult(_0x78f887,0xc9))[_0x2883('0x28')](handleError(_0x78f887,null));};exports[_0x2883('0x34')]=function(_0x5460d6,_0x47bc52){if(_0x5460d6[_0x2883('0x55')]['id']){delete _0x5460d6[_0x2883('0x55')]['id'];}return db[_0x2883('0x4e')]['find']({'where':{'id':_0x5460d6['params']['id']}})[_0x2883('0x20')](handleEntityNotFound(_0x47bc52,null))['then'](saveUpdates(_0x5460d6['body'],null))[_0x2883('0x20')](respondWithResult(_0x47bc52,null))[_0x2883('0x28')](handleError(_0x47bc52,null));};exports[_0x2883('0x35')]=function(_0x483a9d,_0x5f58b2){return db['OpenchannelMessage'][_0x2883('0x53')]({'where':{'id':_0x483a9d[_0x2883('0x51')]['id']}})[_0x2883('0x20')](handleEntityNotFound(_0x5f58b2,null))['then'](removeEntity(_0x5f58b2,null))[_0x2883('0x28')](handleError(_0x5f58b2,null));};exports[_0x2883('0x56')]=function(_0x569ef0,_0x5f4193){return db[_0x2883('0x4e')][_0x2883('0x56')]()[_0x2883('0x20')](respondWithResult(_0x5f4193,null))[_0x2883('0x28')](handleError(_0x5f4193,null));};var interaction_log=require(_0x2883('0x15'))('openchannel-interactions');exports[_0x2883('0x57')]=function(_0x336b50,_0x28147f,_0x128d2b){var _0x2dd0be={'channel':_0x2883('0x58')};if(_0x336b50[_0x2883('0x55')]['id']){delete _0x336b50[_0x2883('0x55')]['id'];}_0x336b50[_0x2883('0x55')][_0x2883('0x59')]=!![];_0x336b50['body'][_0x2883('0x5a')]=moment()[_0x2883('0x5b')](_0x2883('0x5c'));_0x336b50['body'][_0x2883('0x5d')]=_0x336b50['body'][_0x2883('0x5d')]||_0x336b50[_0x2883('0x5e')]['id'];return db[_0x2883('0x4e')]['find']({'where':{'id':_0x336b50['params']['id'],'UserId':null},'include':[{'model':db[_0x2883('0x5f')],'as':_0x2883('0x60')}]})[_0x2883('0x20')](handleEntityNotFound(_0x28147f,null))[_0x2883('0x20')](saveUpdates(_0x336b50[_0x2883('0x55')],null))[_0x2883('0x20')](function(_0x1606f3){if(_0x1606f3){_0x2dd0be[_0x2883('0x27')]=_0x1606f3[_0x2883('0x61')]({'plain':!![]});return db[_0x2883('0x62')]['find']({'where':{'id':_0x1606f3[_0x2883('0x63')]}});}return null;})[_0x2883('0x20')](handleEntityNotFound(_0x28147f,null))[_0x2883('0x20')](function(_0x4149a2){if(_0x4149a2){return _0x4149a2[_0x2883('0x34')]({'UserId':_0x336b50[_0x2883('0x55')][_0x2883('0x5d')],'read1stAt':_[_0x2883('0x64')](_0x4149a2[_0x2883('0x65')])?moment()[_0x2883('0x5b')](_0x2883('0x5c')):undefined});}return null;})[_0x2883('0x20')](function(_0x51a83b){if(_0x51a83b){_0x2dd0be[_0x2883('0x66')]=_0x51a83b[_0x2883('0x61')]({'plain':!![]});interaction_log[_0x2883('0x21')](_0x2883('0x67'),_0x336b50[_0x2883('0x5e')]['id'],_0x336b50['user']['name'],_0x336b50[_0x2883('0x5e')][_0x2883('0x68')],_0x2dd0be[_0x2883('0x66')]['id'],_0x336b50[_0x2883('0x55')]?JSON['stringify'](_0x336b50['body']):_0x2883('0x69'));return respondWithRpcPromise(_0x2883('0x6a'),_0x2883('0x6b'),_0x2dd0be);}return null;})[_0x2883('0x20')](function(_0x1eba20){if(_0x1eba20){if(_0x336b50[_0x2883('0x55')][_0x2883('0x6c')]){_0x2dd0be['message'][_0x2883('0x6d')]=util[_0x2883('0x5b')]('SIP/%s',_0x336b50[_0x2883('0x5e')][_0x2883('0x37')]);_0x2dd0be['message'][_0x2883('0x6e')]=_0x2dd0be['channel'];_0x2dd0be[_0x2883('0x27')][_0x2883('0x6f')]=_0x2883('0x57');return respondWithRpcPromise(_0x2883('0x70'),_0x2883('0x70'),{'event':_0x2883('0x71'),'message':_0x2dd0be[_0x2883('0x27')]},client9002)[_0x2883('0x20')](function(){return _0x2dd0be;});}return _0x2dd0be;}return null;})['then'](respondWithResult(_0x28147f,null))[_0x2883('0x28')](handleError(_0x28147f,null));};var interaction_log=require(_0x2883('0x15'))('openchannel-interactions');exports['reject']=function(_0x47a934,_0x21c7ee,_0x430d36){var _0x372ba3={'agent':{},'channel':_0x2883('0x58')};if(_0x47a934[_0x2883('0x55')]['id']){delete _0x47a934[_0x2883('0x55')]['id'];}_0x47a934[_0x2883('0x55')]['UserId']=_0x47a934[_0x2883('0x55')][_0x2883('0x5d')]||_0x47a934['user']['id'];_0x372ba3[_0x2883('0x72')]['id']=_0x47a934['body'][_0x2883('0x5d')];return db[_0x2883('0x4e')][_0x2883('0x53')]({'where':{'id':_0x47a934[_0x2883('0x51')]['id'],'UserId':null}})[_0x2883('0x20')](handleEntityNotFound(_0x21c7ee,null))[_0x2883('0x20')](function(_0x3b710b){if(_0x3b710b){_0x372ba3[_0x2883('0x27')]=_0x3b710b[_0x2883('0x61')]({'plain':!![]});return db[_0x2883('0x62')]['find']({'where':{'id':_0x3b710b[_0x2883('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x21c7ee,null))[_0x2883('0x20')](function(_0x5e1014){if(_0x5e1014){_0x372ba3[_0x2883('0x66')]=_0x5e1014[_0x2883('0x61')]({'plain':!![]});interaction_log[_0x2883('0x21')](_0x2883('0x73'),_0x47a934[_0x2883('0x5e')]['id'],_0x47a934['user'][_0x2883('0x37')],_0x47a934[_0x2883('0x5e')]['role'],_0x372ba3['interaction']['id'],_0x47a934[_0x2883('0x55')]?JSON[_0x2883('0x24')](_0x47a934[_0x2883('0x55')]):_0x2883('0x69'));return respondWithRpcPromise(_0x2883('0x74'),_0x2883('0x75'),_0x372ba3);}return null;})[_0x2883('0x20')](function(_0x491d4a){if(_0x491d4a){_0x491d4a['message'][_0x2883('0x6d')]=util[_0x2883('0x5b')](_0x2883('0x76'),_0x47a934[_0x2883('0x5e')]['name']);_0x491d4a[_0x2883('0x27')][_0x2883('0x6e')]=_0x372ba3['channel'];_0x491d4a['message'][_0x2883('0x6f')]=_0x2883('0x77');respondWithRpcPromise(_0x2883('0x70'),_0x2883('0x70'),{'event':'rejectmessage','message':_0x491d4a[_0x2883('0x27')]},client9002);return _0x372ba3;}return null;})['then'](respondWithResult(_0x21c7ee,null))['catch'](handleError(_0x21c7ee,null));}; \ No newline at end of file +var _0xe1da=['sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','register','jayson/promise','http','client','request','then','info','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','sendStatus','end','status','json','count','offset','limit','apply','reject','save','update','stack','name','send','index','OpenchannelMessage','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','key','field','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','options','find','create','body','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','OpenchannelInteraction','read1stAt','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','agent','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','rimraf','zip-dir','moment','bluebird','mustache','util','path'];(function(_0xaf8f29,_0x5754cf){var _0x391fed=function(_0x322809){while(--_0x322809){_0xaf8f29['push'](_0xaf8f29['shift']());}};_0x391fed(++_0x5754cf);}(_0xe1da,0x1bd));var _0xae1d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe1da[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xae1d('0x0'));var zipdir=require(_0xae1d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xae1d('0x2'));var BPromise=require(_0xae1d('0x3'));var Mustache=require(_0xae1d('0x4'));var util=require(_0xae1d('0x5'));var path=require(_0xae1d('0x6'));var sox=require(_0xae1d('0x7'));var csv=require(_0xae1d('0x8'));var ejs=require(_0xae1d('0x9'));var fs=require('fs');var _=require(_0xae1d('0xa'));var squel=require(_0xae1d('0xb'));var crypto=require(_0xae1d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xae1d('0xd'));var toCsv=require(_0xae1d('0x8'));var querystring=require('querystring');var Papa=require(_0xae1d('0xe'));var authService=require(_0xae1d('0xf'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xae1d('0x10'));var qs=require(_0xae1d('0x11'));var logger=require(_0xae1d('0x12'))(_0xae1d('0x13'));var utils=require('../../config/utils');var config=require(_0xae1d('0x14'));var db=require('../../mysqldb')['db'];config[_0xae1d('0x15')]=_[_0xae1d('0x16')](config[_0xae1d('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xae1d('0x17'))(new Redis(config[_0xae1d('0x15')]));require('./openchannelMessage.socket')[_0xae1d('0x18')](socket);var jayson=require(_0xae1d('0x19'));var client=jayson['client'][_0xae1d('0x1a')]({'port':0x232c});var client9002=jayson[_0xae1d('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48107f,_0x41ad82,_0x3cc05a,_0x30283b){return new BPromise(function(_0x144f88,_0x5f168c){var _0x452afa=_0x30283b||client;return _0x452afa[_0xae1d('0x1c')](_0x48107f,_0x3cc05a)[_0xae1d('0x1d')](function(_0x19c8ad){logger[_0xae1d('0x1e')]('OpenchannelMessage,\x20%s,\x20%s',_0x41ad82,_0xae1d('0x1f'));logger['debug'](_0xae1d('0x20'),_0x41ad82,_0xae1d('0x1f'),JSON[_0xae1d('0x21')](_0x19c8ad));if(_0x19c8ad['error']){if(_0x19c8ad[_0xae1d('0x22')][_0xae1d('0x23')]===0x1f4){logger[_0xae1d('0x22')](_0xae1d('0x24'),_0x41ad82,_0x19c8ad['error']['message']);return _0x5f168c(_0x19c8ad[_0xae1d('0x22')][_0xae1d('0x25')]);}logger['error'](_0xae1d('0x24'),_0x41ad82,_0x19c8ad[_0xae1d('0x22')][_0xae1d('0x25')]);return _0x144f88(_0x19c8ad['error'][_0xae1d('0x25')]);}else{logger[_0xae1d('0x1e')]('OpenchannelMessage,\x20%s,\x20%s',_0x41ad82,_0xae1d('0x1f'));_0x144f88(_0x19c8ad['result'][_0xae1d('0x25')]);}})['catch'](function(_0x5a414c){logger['error'](_0xae1d('0x24'),_0x41ad82,_0x5a414c);_0x5f168c(_0x5a414c);});});}function respondWithStatusCode(_0xb62965,_0x64b8a9){_0x64b8a9=_0x64b8a9||0xcc;return function(_0xb1f336){if(_0xb1f336){return _0xb62965[_0xae1d('0x26')](_0x64b8a9);}return _0xb62965['status'](_0x64b8a9)[_0xae1d('0x27')]();};}function respondWithResult(_0xaeffdc,_0x335333){_0x335333=_0x335333||0xc8;return function(_0x33ad7f){if(_0x33ad7f){return _0xaeffdc[_0xae1d('0x28')](_0x335333)[_0xae1d('0x29')](_0x33ad7f);}};}function respondWithFilteredResult(_0x470fde,_0xc1aee){return function(_0xe8db72){if(_0xe8db72){var _0x34300f=_0xe8db72[_0xae1d('0x2a')],_0x465ff1=_0xc1aee[_0xae1d('0x2b')],_0x3ef279=_0xc1aee[_0xae1d('0x2b')]+_0xc1aee[_0xae1d('0x2c')],_0x2f4d80;if(_0x3ef279>=_0x34300f){_0x3ef279=_0x34300f;_0x2f4d80=0xc8;}else{_0x2f4d80=0xce;}_0x470fde[_0xae1d('0x28')](_0x2f4d80);return _0x470fde['set']('Content-Range',_0x465ff1+'-'+_0x3ef279+'/'+_0x34300f)['json'](_0xe8db72);}return null;};}function patchUpdates(_0x1a7381){return function(_0x40fc9a){try{jsonpatch[_0xae1d('0x2d')](_0x40fc9a,_0x1a7381,!![]);}catch(_0x3c92f5){return BPromise[_0xae1d('0x2e')](_0x3c92f5);}return _0x40fc9a[_0xae1d('0x2f')]();};}function saveUpdates(_0x3bdb45,_0x181669){return function(_0x53fcc2){if(_0x53fcc2){return _0x53fcc2[_0xae1d('0x30')](_0x3bdb45)[_0xae1d('0x1d')](function(_0x28722e){return _0x28722e;});}return null;};}function removeEntity(_0x46ce88,_0xbf6cd1){return function(_0x679784){if(_0x679784){return _0x679784['destroy']()[_0xae1d('0x1d')](function(){_0x46ce88[_0xae1d('0x28')](0xcc)[_0xae1d('0x27')]();});}};}function handleEntityNotFound(_0x406fd2,_0x22e838){return function(_0x5c3f94){if(!_0x5c3f94){_0x406fd2[_0xae1d('0x26')](0x194);}return _0x5c3f94;};}function handleError(_0x30f417,_0x538c5c){_0x538c5c=_0x538c5c||0x1f4;return function(_0x57f93e){logger['error'](_0x57f93e[_0xae1d('0x31')]);if(_0x57f93e[_0xae1d('0x32')]){delete _0x57f93e[_0xae1d('0x32')];}_0x30f417[_0xae1d('0x28')](_0x538c5c)[_0xae1d('0x33')](_0x57f93e);};}exports[_0xae1d('0x34')]=function(_0x157e3f,_0x532ebe){var _0x1cdab8={},_0x8af95f={},_0x64058c={'count':0x0,'rows':[]};var _0x27e8c1=db[_0xae1d('0x35')]['rawAttributes'];_0x8af95f[_0xae1d('0x36')]=_[_0xae1d('0x37')](_0x27e8c1);_0x8af95f[_0xae1d('0x38')]=_[_0xae1d('0x37')](_0x157e3f[_0xae1d('0x38')]);_0x8af95f[_0xae1d('0x39')]=_[_0xae1d('0x3a')](_0x8af95f[_0xae1d('0x36')],_0x8af95f[_0xae1d('0x38')]);_0x1cdab8[_0xae1d('0x3b')]=_[_0xae1d('0x3a')](_0x8af95f['model'],qs[_0xae1d('0x3c')](_0x157e3f[_0xae1d('0x38')][_0xae1d('0x3c')]));_0x1cdab8[_0xae1d('0x3b')]=_0x1cdab8['attributes']['length']?_0x1cdab8[_0xae1d('0x3b')]:_0x8af95f[_0xae1d('0x36')];if(!_0x157e3f[_0xae1d('0x38')][_0xae1d('0x3d')](_0xae1d('0x3e'))){_0x1cdab8[_0xae1d('0x2c')]=qs[_0xae1d('0x2c')](_0x157e3f[_0xae1d('0x38')][_0xae1d('0x2c')]);_0x1cdab8[_0xae1d('0x2b')]=qs[_0xae1d('0x2b')](_0x157e3f[_0xae1d('0x38')]['offset']);}_0x1cdab8[_0xae1d('0x3f')]=qs[_0xae1d('0x40')](_0x157e3f[_0xae1d('0x38')][_0xae1d('0x40')]);_0x1cdab8[_0xae1d('0x41')]=qs[_0xae1d('0x39')](_[_0xae1d('0x42')](_0x157e3f[_0xae1d('0x38')],_0x8af95f[_0xae1d('0x39')]));if(_0x157e3f[_0xae1d('0x38')][_0xae1d('0x43')]){_0x1cdab8[_0xae1d('0x41')]=_[_0xae1d('0x44')](_0x1cdab8[_0xae1d('0x41')],{'$or':_['map'](_0x27e8c1,function(_0x45915e){if(_0x45915e[_0xae1d('0x45')][_0xae1d('0x46')]!=='VIRTUAL'){var _0x22c984={};_0x22c984[_0x45915e[_0xae1d('0x47')]]={'$like':'%'+_0x157e3f[_0xae1d('0x38')][_0xae1d('0x43')]+'%'};return _0x22c984;}})});}_0x1cdab8=_[_0xae1d('0x44')]({},_0x1cdab8,_0x157e3f['options']);var _0x4bc8dc={'where':_0x1cdab8['where']};return db['OpenchannelMessage']['count'](_0x4bc8dc)[_0xae1d('0x1d')](function(_0x1c27e3){_0x64058c['count']=_0x1c27e3;if(_0x157e3f[_0xae1d('0x38')][_0xae1d('0x48')]){_0x1cdab8[_0xae1d('0x49')]=[{'all':!![]}];}return db[_0xae1d('0x35')][_0xae1d('0x4a')](_0x1cdab8);})[_0xae1d('0x1d')](function(_0xf5f9eb){_0x64058c[_0xae1d('0x4b')]=_0xf5f9eb;return _0x64058c;})[_0xae1d('0x1d')](respondWithFilteredResult(_0x532ebe,_0x1cdab8))[_0xae1d('0x4c')](handleError(_0x532ebe,null));};exports[_0xae1d('0x4d')]=function(_0x1161c0,_0x139526){var _0x45df6d={'raw':!![],'where':{'id':_0x1161c0[_0xae1d('0x4e')]['id']}},_0x24d3be={};_0x24d3be['model']=_['keys'](db[_0xae1d('0x35')][_0xae1d('0x4f')]);_0x24d3be[_0xae1d('0x38')]=_[_0xae1d('0x37')](_0x1161c0[_0xae1d('0x38')]);_0x24d3be[_0xae1d('0x39')]=_[_0xae1d('0x3a')](_0x24d3be['model'],_0x24d3be[_0xae1d('0x38')]);_0x45df6d[_0xae1d('0x3b')]=_[_0xae1d('0x3a')](_0x24d3be[_0xae1d('0x36')],qs[_0xae1d('0x3c')](_0x1161c0['query'][_0xae1d('0x3c')]));_0x45df6d[_0xae1d('0x3b')]=_0x45df6d[_0xae1d('0x3b')][_0xae1d('0x50')]?_0x45df6d[_0xae1d('0x3b')]:_0x24d3be[_0xae1d('0x36')];if(_0x1161c0[_0xae1d('0x38')]['includeAll']){_0x45df6d[_0xae1d('0x49')]=[{'all':!![]}];}_0x45df6d=_[_0xae1d('0x44')]({},_0x45df6d,_0x1161c0[_0xae1d('0x51')]);return db[_0xae1d('0x35')][_0xae1d('0x52')](_0x45df6d)['then'](handleEntityNotFound(_0x139526,null))['then'](respondWithResult(_0x139526,null))['catch'](handleError(_0x139526,null));};exports[_0xae1d('0x53')]=function(_0x5d5675,_0x5444ec){return db[_0xae1d('0x35')][_0xae1d('0x53')](_0x5d5675[_0xae1d('0x54')],{})[_0xae1d('0x1d')](respondWithResult(_0x5444ec,0xc9))['catch'](handleError(_0x5444ec,null));};exports[_0xae1d('0x30')]=function(_0x2296ce,_0x2c96e9){if(_0x2296ce['body']['id']){delete _0x2296ce[_0xae1d('0x54')]['id'];}return db[_0xae1d('0x35')][_0xae1d('0x52')]({'where':{'id':_0x2296ce[_0xae1d('0x4e')]['id']}})[_0xae1d('0x1d')](handleEntityNotFound(_0x2c96e9,null))[_0xae1d('0x1d')](saveUpdates(_0x2296ce[_0xae1d('0x54')],null))[_0xae1d('0x1d')](respondWithResult(_0x2c96e9,null))['catch'](handleError(_0x2c96e9,null));};exports['destroy']=function(_0x3496cb,_0x1fe61b){return db[_0xae1d('0x35')][_0xae1d('0x52')]({'where':{'id':_0x3496cb[_0xae1d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1fe61b,null))[_0xae1d('0x1d')](removeEntity(_0x1fe61b,null))['catch'](handleError(_0x1fe61b,null));};exports['describe']=function(_0x25fea0,_0x440415){return db[_0xae1d('0x35')]['describe']()[_0xae1d('0x1d')](respondWithResult(_0x440415,null))[_0xae1d('0x4c')](handleError(_0x440415,null));};var interaction_log=require('../../config/logger')(_0xae1d('0x55'));exports[_0xae1d('0x56')]=function(_0x2989d2,_0xb40c61,_0x5aa7c7){var _0x5df6f5={'channel':_0xae1d('0x57')};if(_0x2989d2[_0xae1d('0x54')]['id']){delete _0x2989d2[_0xae1d('0x54')]['id'];}_0x2989d2[_0xae1d('0x54')][_0xae1d('0x58')]=!![];_0x2989d2[_0xae1d('0x54')][_0xae1d('0x59')]=moment()[_0xae1d('0x5a')](_0xae1d('0x5b'));_0x2989d2[_0xae1d('0x54')]['UserId']=_0x2989d2[_0xae1d('0x54')][_0xae1d('0x5c')]||_0x2989d2[_0xae1d('0x5d')]['id'];return db[_0xae1d('0x35')][_0xae1d('0x52')]({'where':{'id':_0x2989d2[_0xae1d('0x4e')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xae1d('0x1d')](handleEntityNotFound(_0xb40c61,null))[_0xae1d('0x1d')](saveUpdates(_0x2989d2['body'],null))[_0xae1d('0x1d')](function(_0x179c7c){if(_0x179c7c){_0x5df6f5[_0xae1d('0x25')]=_0x179c7c['get']({'plain':!![]});return db[_0xae1d('0x5e')][_0xae1d('0x52')]({'where':{'id':_0x179c7c['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0xb40c61,null))['then'](function(_0x55c551){if(_0x55c551){return _0x55c551[_0xae1d('0x30')]({'UserId':_0x2989d2['body'][_0xae1d('0x5c')],'read1stAt':_['isNil'](_0x55c551[_0xae1d('0x5f')])?moment()[_0xae1d('0x5a')](_0xae1d('0x5b')):undefined});}return null;})[_0xae1d('0x1d')](function(_0x2451d8){if(_0x2451d8){_0x5df6f5[_0xae1d('0x60')]=_0x2451d8[_0xae1d('0x61')]({'plain':!![]});interaction_log[_0xae1d('0x1e')](_0xae1d('0x62'),_0x2989d2[_0xae1d('0x5d')]['id'],_0x2989d2[_0xae1d('0x5d')][_0xae1d('0x32')],_0x2989d2[_0xae1d('0x5d')][_0xae1d('0x63')],_0x5df6f5[_0xae1d('0x60')]['id'],_0x2989d2['body']?JSON[_0xae1d('0x21')](_0x2989d2[_0xae1d('0x54')]):_0xae1d('0x64'));return respondWithRpcPromise('AcceptMessage',_0xae1d('0x65'),_0x5df6f5);}return null;})['then'](function(_0x4b1369){if(_0x4b1369){if(_0x2989d2[_0xae1d('0x54')][_0xae1d('0x66')]){_0x5df6f5[_0xae1d('0x25')][_0xae1d('0x67')]=util[_0xae1d('0x5a')](_0xae1d('0x68'),_0x2989d2[_0xae1d('0x5d')]['name']);_0x5df6f5[_0xae1d('0x25')][_0xae1d('0x69')]=_0x5df6f5[_0xae1d('0x69')];_0x5df6f5['message']['event']='accept';return respondWithRpcPromise(_0xae1d('0x6a'),'EventManager',{'event':_0xae1d('0x6b'),'message':_0x5df6f5[_0xae1d('0x25')]},client9002)[_0xae1d('0x1d')](function(){return _0x5df6f5;});}return _0x5df6f5;}return null;})[_0xae1d('0x1d')](respondWithResult(_0xb40c61,null))[_0xae1d('0x4c')](handleError(_0xb40c61,null));};var interaction_log=require(_0xae1d('0x12'))(_0xae1d('0x55'));exports['reject']=function(_0x4a8adb,_0x32024d,_0x31d539){var _0x3b7d01={'agent':{},'channel':_0xae1d('0x57')};if(_0x4a8adb[_0xae1d('0x54')]['id']){delete _0x4a8adb[_0xae1d('0x54')]['id'];}_0x4a8adb[_0xae1d('0x54')][_0xae1d('0x5c')]=_0x4a8adb[_0xae1d('0x54')][_0xae1d('0x5c')]||_0x4a8adb['user']['id'];_0x3b7d01[_0xae1d('0x6c')]['id']=_0x4a8adb['body'][_0xae1d('0x5c')];return db[_0xae1d('0x35')][_0xae1d('0x52')]({'where':{'id':_0x4a8adb[_0xae1d('0x4e')]['id'],'UserId':null}})[_0xae1d('0x1d')](handleEntityNotFound(_0x32024d,null))[_0xae1d('0x1d')](function(_0x4b1917){if(_0x4b1917){_0x3b7d01[_0xae1d('0x25')]=_0x4b1917['get']({'plain':!![]});return db[_0xae1d('0x5e')][_0xae1d('0x52')]({'where':{'id':_0x4b1917[_0xae1d('0x6d')]}});}return null;})[_0xae1d('0x1d')](handleEntityNotFound(_0x32024d,null))[_0xae1d('0x1d')](function(_0x2f8c1d){if(_0x2f8c1d){_0x3b7d01[_0xae1d('0x60')]=_0x2f8c1d['get']({'plain':!![]});interaction_log[_0xae1d('0x1e')](_0xae1d('0x6e'),_0x4a8adb[_0xae1d('0x5d')]['id'],_0x4a8adb['user'][_0xae1d('0x32')],_0x4a8adb[_0xae1d('0x5d')]['role'],_0x3b7d01[_0xae1d('0x60')]['id'],_0x4a8adb[_0xae1d('0x54')]?JSON[_0xae1d('0x21')](_0x4a8adb[_0xae1d('0x54')]):_0xae1d('0x64'));return respondWithRpcPromise('RejectMessage',_0xae1d('0x6f'),_0x3b7d01);}return null;})[_0xae1d('0x1d')](function(_0x3fb2e9){if(_0x3fb2e9){_0x3fb2e9[_0xae1d('0x25')]['interface']=util['format'](_0xae1d('0x68'),_0x4a8adb['user']['name']);_0x3fb2e9['message'][_0xae1d('0x69')]=_0x3b7d01[_0xae1d('0x69')];_0x3fb2e9[_0xae1d('0x25')]['event']='reject';respondWithRpcPromise('EventManager',_0xae1d('0x6a'),{'event':_0xae1d('0x70'),'message':_0x3fb2e9['message']},client9002);return _0x3b7d01;}return null;})[_0xae1d('0x1d')](respondWithResult(_0x32024d,null))[_0xae1d('0x4c')](handleError(_0x32024d,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 55d1f1c..a712c69 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 _0x3146=['update','remove','emit','hasOwnProperty','hook','events','OpenchannelMessage','setMaxListeners','save'];(function(_0x4c262b,_0x2bcda4){var _0x17e6fa=function(_0x427d6d){while(--_0x427d6d){_0x4c262b['push'](_0x4c262b['shift']());}};_0x17e6fa(++_0x2bcda4);}(_0x3146,0x16d));var _0x6314=function(_0x5eabcf,_0x59d7cf){_0x5eabcf=_0x5eabcf-0x0;var _0x1d6df9=_0x3146[_0x5eabcf];return _0x1d6df9;};'use strict';var EventEmitter=require(_0x6314('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x6314('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x6314('0x2')](0x0);var events={'afterCreate':_0x6314('0x3'),'afterUpdate':_0x6314('0x4'),'afterDestroy':_0x6314('0x5')};function emitEvent(_0x530a3d){return function(_0x1f8517,_0x47333a,_0x2235cd){OpenchannelMessageEvents['emit'](_0x530a3d+':'+_0x1f8517['id'],_0x1f8517);OpenchannelMessageEvents[_0x6314('0x6')](_0x530a3d,_0x1f8517);_0x2235cd(null);};}for(var e in events){if(events[_0x6314('0x7')](e)){var event=events[e];OpenchannelMessage[_0x6314('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x8d44=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x153810,_0x4b3117){var _0x3df31a=function(_0x239357){while(--_0x239357){_0x153810['push'](_0x153810['shift']());}};_0x3df31a(++_0x4b3117);}(_0x8d44,0x161));var _0x48d4=function(_0x490f7a,_0x5d6ae0){_0x490f7a=_0x490f7a-0x0;var _0x3caeac=_0x8d44[_0x490f7a];return _0x3caeac;};'use strict';var EventEmitter=require(_0x48d4('0x0'));var OpenchannelMessage=require(_0x48d4('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x48d4('0x2')](0x0);var events={'afterCreate':_0x48d4('0x3'),'afterUpdate':_0x48d4('0x4'),'afterDestroy':_0x48d4('0x5')};function emitEvent(_0x596e5c){return function(_0x3fa84d,_0x5e5d76,_0x481144){OpenchannelMessageEvents[_0x48d4('0x6')](_0x596e5c+':'+_0x3fa84d['id'],_0x3fa84d);OpenchannelMessageEvents['emit'](_0x596e5c,_0x3fa84d);_0x481144(null);};}for(var e in events){if(events[_0x48d4('0x7')](e)){var event=events[e];OpenchannelMessage[_0x48d4('0x8')](e,emitEvent(event));}}module[_0x48d4('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 7bd69f0..216dbfb 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 _0x0b11=['Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','finally','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','exports','define','OpenchannelMessage','openchannel_messages','models','get','direction','toLowerCase','secret','isNil','OpenchannelInteraction','update','createdAt','body','catch','error','out','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','POST','method','GET','format'];(function(_0x3750ef,_0x5b08d2){var _0x209732=function(_0x2847c8){while(--_0x2847c8){_0x3750ef['push'](_0x3750ef['shift']());}};_0x209732(++_0x5b08d2);}(_0x0b11,0xf6));var _0x10b1=function(_0x154705,_0x121c55){_0x154705=_0x154705-0x0;var _0x529dbe=_0x0b11[_0x154705];return _0x529dbe;};'use strict';var _=require(_0x10b1('0x0'));var util=require('util');var logger=require(_0x10b1('0x1'))(_0x10b1('0x2'));var moment=require('moment');var BPromise=require(_0x10b1('0x3'));var rp=require(_0x10b1('0x4'));var attributes=require('./openchannelMessage.attributes');module[_0x10b1('0x5')]=function(_0x458954,_0xe93c52){return _0x458954[_0x10b1('0x6')](_0x10b1('0x7'),attributes,{'tableName':_0x10b1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x417d62,_0x1891c6,_0x2f3393){var _0x1b3e7b=_0x458954[_0x10b1('0x9')];var _0x54caa3=_0x417d62[_0x10b1('0xa')]({'plain':!![]});if(_0x54caa3[_0x10b1('0xb')][_0x10b1('0xc')]()==='in'||_0x54caa3['direction']['toLowerCase']()==='out'&&!_0x54caa3[_0x10b1('0xd')]&&!_[_0x10b1('0xe')](_0x54caa3['UserId'])){_0x1b3e7b[_0x10b1('0xf')]['findOne']({'where':{'id':_0x54caa3['OpenchannelInteractionId']}})['then'](function(_0x5074ba){if(_0x5074ba){_0x5074ba[_0x10b1('0x10')]({'lastMsgAt':_0x54caa3[_0x10b1('0x11')],'lastMsgDirection':_0x54caa3[_0x10b1('0xb')][_0x10b1('0xc')](),'lastMsgBody':_0x54caa3[_0x10b1('0x12')]});}})[_0x10b1('0x13')](function(_0x4f9c29){console[_0x10b1('0x14')](_0x4f9c29);});}if(_0x54caa3[_0x10b1('0xb')]===_0x10b1('0x15')&&!_0x54caa3[_0x10b1('0xd')]){var _0x3d7753;_0x1b3e7b[_0x10b1('0x16')][_0x10b1('0x17')]()[_0x10b1('0x18')](function(_0x3ac2e2){return _0x1b3e7b[_0x10b1('0x19')][_0x10b1('0x1a')]({'where':{'id':_0x54caa3[_0x10b1('0x1b')]},'include':[{'model':_0x1b3e7b['OpenchannelInteraction'],'as':_0x10b1('0x1c'),'where':{'id':_0x54caa3[_0x10b1('0x1d')]},'limit':0x1,'include':[{'model':_0x1b3e7b[_0x10b1('0x16')],'as':_0x10b1('0x1e'),'attributes':_[_0x10b1('0x1f')](_0x3ac2e2)}]}]});})[_0x10b1('0x18')](function(_0x502690){_0x3d7753=_0x502690[_0x10b1('0xa')]({'plain':!![]});if(_0x3d7753&&_0x3d7753[_0x10b1('0x20')]){logger[_0x10b1('0x21')](_0x10b1('0x22'),'afterCreate',util['format'](_0x10b1('0x23'),_0x54caa3['id'],_0x3d7753[_0x10b1('0x20')]));if(_0x3d7753[_0x10b1('0x1c')]&&_0x3d7753[_0x10b1('0x1c')][_0x10b1('0x24')]){_0x54caa3['Interaction']=_[_0x10b1('0x25')](_0x3d7753[_0x10b1('0x1c')][0x0],_0x10b1('0x1e'));_0x54caa3[_0x10b1('0x1e')]=_0x3d7753[_0x10b1('0x1c')][0x0][_0x10b1('0x1e')];}var _0x1891c6={'method':_0x10b1('0x26'),'uri':encodeURI(_0x3d7753[_0x10b1('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1891c6[_0x10b1('0x27')]){case _0x10b1('0x28'):_0x1891c6['qs']=_0x54caa3;break;case'POST':_0x1891c6[_0x10b1('0x12')]=_0x54caa3;break;}return rp(_0x1891c6)['then'](function(_0x21eca5){logger[_0x10b1('0x21')](_0x10b1('0x22'),'afterCreate',util[_0x10b1('0x29')](_0x10b1('0x2a'),_0x54caa3['id'],_0x3d7753[_0x10b1('0x20')]));if(_0x21eca5['body'][_0x10b1('0x2b')]&&_0x21eca5[_0x10b1('0x12')][_0x10b1('0x2b')]!=_0x54caa3[_0x10b1('0x2c')]['threadId']){return _0x1b3e7b[_0x10b1('0xf')][_0x10b1('0x10')]({'threadId':_0x21eca5['body'][_0x10b1('0x2b')]},{'logging':!![],'where':{'id':_0x54caa3[_0x10b1('0x2c')]['id']}});}else{return;}})[_0x10b1('0x18')](function(){return _0x417d62[_0x10b1('0x10')]({'read':!![]});})['catch'](function(_0x2c8a75){logger['error'](_0x10b1('0x22'),'afterCreate',util[_0x10b1('0x2d')](_0x2c8a75,{'showHidden':![],'depth':null}));_0x2f3393();});}else{_0x2f3393();}})[_0x10b1('0x2e')](function(){_0x2f3393();});}else{_0x2f3393();}}},'charset':'utf8mb4','collate':_0x10b1('0x2f')});}; \ No newline at end of file +var _0x2b70=['find','OpenchannelAccountId','Interactions','Contact','keys','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','method','GET','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','exports','define','openchannel_messages','models','direction','out','isNil','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','toLowerCase','body','catch','secret','CmContact','describe'];(function(_0xd4896e,_0x394994){var _0x3e95af=function(_0x1d2d77){while(--_0x1d2d77){_0xd4896e['push'](_0xd4896e['shift']());}};_0x3e95af(++_0x394994);}(_0x2b70,0x1e3));var _0x02b7=function(_0x5dfd65,_0x1ad889){_0x5dfd65=_0x5dfd65-0x0;var _0x47f853=_0x2b70[_0x5dfd65];return _0x47f853;};'use strict';var _=require(_0x02b7('0x0'));var util=require('util');var logger=require(_0x02b7('0x1'))(_0x02b7('0x2'));var moment=require('moment');var BPromise=require(_0x02b7('0x3'));var rp=require(_0x02b7('0x4'));var attributes=require('./openchannelMessage.attributes');module[_0x02b7('0x5')]=function(_0xe374a3,_0x2def54){return _0xe374a3[_0x02b7('0x6')]('OpenchannelMessage',attributes,{'tableName':_0x02b7('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f9d63,_0x750e1,_0x36f1b5){var _0x427263=_0xe374a3[_0x02b7('0x8')];var _0x293295=_0x4f9d63['get']({'plain':!![]});if(_0x293295[_0x02b7('0x9')]['toLowerCase']()==='in'||_0x293295[_0x02b7('0x9')]['toLowerCase']()===_0x02b7('0xa')&&!_0x293295['secret']&&!_[_0x02b7('0xb')](_0x293295['UserId'])){_0x427263[_0x02b7('0xc')]['findOne']({'where':{'id':_0x293295[_0x02b7('0xd')]}})[_0x02b7('0xe')](function(_0x174680){if(_0x174680){_0x174680[_0x02b7('0xf')]({'lastMsgAt':_0x293295[_0x02b7('0x10')],'lastMsgDirection':_0x293295[_0x02b7('0x9')][_0x02b7('0x11')](),'lastMsgBody':_0x293295[_0x02b7('0x12')]});}})[_0x02b7('0x13')](function(_0x470333){console['error'](_0x470333);});}if(_0x293295[_0x02b7('0x9')]===_0x02b7('0xa')&&!_0x293295[_0x02b7('0x14')]){var _0x43522e;_0x427263[_0x02b7('0x15')][_0x02b7('0x16')]()[_0x02b7('0xe')](function(_0x2aebde){return _0x427263['OpenchannelAccount'][_0x02b7('0x17')]({'where':{'id':_0x293295[_0x02b7('0x18')]},'include':[{'model':_0x427263[_0x02b7('0xc')],'as':_0x02b7('0x19'),'where':{'id':_0x293295['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x427263[_0x02b7('0x15')],'as':_0x02b7('0x1a'),'attributes':_[_0x02b7('0x1b')](_0x2aebde)}]}]});})[_0x02b7('0xe')](function(_0x596170){_0x43522e=_0x596170[_0x02b7('0x1c')]({'plain':!![]});if(_0x43522e&&_0x43522e[_0x02b7('0x1d')]){logger[_0x02b7('0x1e')](_0x02b7('0x1f'),'afterCreate',util['format'](_0x02b7('0x20'),_0x293295['id'],_0x43522e['replyUri']));if(_0x43522e['Interactions']&&_0x43522e['Interactions'][_0x02b7('0x21')]){_0x293295[_0x02b7('0x22')]=_[_0x02b7('0x23')](_0x43522e[_0x02b7('0x19')][0x0],_0x02b7('0x1a'));_0x293295[_0x02b7('0x1a')]=_0x43522e[_0x02b7('0x19')][0x0][_0x02b7('0x1a')];}var _0x750e1={'method':'POST','uri':encodeURI(_0x43522e[_0x02b7('0x1d')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x750e1[_0x02b7('0x24')]){case _0x02b7('0x25'):_0x750e1['qs']=_0x293295;break;case'POST':_0x750e1[_0x02b7('0x12')]=_0x293295;break;}return rp(_0x750e1)['then'](function(_0x347c75){logger[_0x02b7('0x1e')](_0x02b7('0x1f'),_0x02b7('0x26'),util['format'](_0x02b7('0x27'),_0x293295['id'],_0x43522e[_0x02b7('0x1d')]));if(_0x347c75[_0x02b7('0x12')][_0x02b7('0x28')]&&_0x347c75['body'][_0x02b7('0x28')]!=_0x293295[_0x02b7('0x22')][_0x02b7('0x28')]){return _0x427263[_0x02b7('0xc')]['update']({'threadId':_0x347c75['body'][_0x02b7('0x28')]},{'logging':!![],'where':{'id':_0x293295['Interaction']['id']}});}else{return;}})['then'](function(){return _0x4f9d63[_0x02b7('0xf')]({'read':!![]});})[_0x02b7('0x13')](function(_0x482b97){logger[_0x02b7('0x29')](_0x02b7('0x1f'),_0x02b7('0x26'),util[_0x02b7('0x2a')](_0x482b97,{'showHidden':![],'depth':null}));_0x36f1b5();});}else{_0x36f1b5();}})[_0x02b7('0x2b')](function(){_0x36f1b5();});}else{_0x36f1b5();}}},'charset':_0x02b7('0x2c'),'collate':_0x02b7('0x2d')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 1fddb28..fa47130 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 _0xf5b8=['../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','./openchannelMessage.socket','register','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','options','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4f4d19,_0x574245){var _0x27a258=function(_0x38da3e){while(--_0x38da3e){_0x4f4d19['push'](_0x4f4d19['shift']());}};_0x27a258(++_0x574245);}(_0xf5b8,0xae));var _0x8f5b=function(_0x38f47e,_0x72b41c){_0x38f47e=_0x38f47e-0x0;var _0x3c1c13=_0xf5b8[_0x38f47e];return _0x3c1c13;};'use strict';var _=require('lodash');var util=require(_0x8f5b('0x0'));var moment=require(_0x8f5b('0x1'));var BPromise=require(_0x8f5b('0x2'));var rs=require(_0x8f5b('0x3'));var fs=require('fs');var Redis=require(_0x8f5b('0x4'));var db=require(_0x8f5b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f5b('0x6'))(_0x8f5b('0x7'));var config=require('../../config/environment');var jayson=require(_0x8f5b('0x8'));var client=jayson[_0x8f5b('0x9')][_0x8f5b('0xa')]({'port':0x232a});config['redis']=_[_0x8f5b('0xb')](config[_0x8f5b('0xc')],{'host':_0x8f5b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8f5b('0xc')]));require(_0x8f5b('0xe'))[_0x8f5b('0xf')](socket);function respondWithRpcPromise(_0x1afa6b,_0x1d1be0,_0x5448f9){return new BPromise(function(_0x4e46c4,_0x5c38d6){return client['request'](_0x1afa6b,_0x5448f9)[_0x8f5b('0x10')](function(_0x11fee9){logger[_0x8f5b('0x11')](_0x8f5b('0x12'),_0x1d1be0,_0x8f5b('0x13'));logger[_0x8f5b('0x14')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x1d1be0,_0x8f5b('0x13'),JSON[_0x8f5b('0x15')](_0x11fee9));if(_0x11fee9['error']){if(_0x11fee9[_0x8f5b('0x16')][_0x8f5b('0x17')]===0x1f4){logger[_0x8f5b('0x16')](_0x8f5b('0x12'),_0x1d1be0,_0x11fee9[_0x8f5b('0x16')]['message']);return _0x5c38d6(_0x11fee9['error'][_0x8f5b('0x18')]);}logger[_0x8f5b('0x16')](_0x8f5b('0x12'),_0x1d1be0,_0x11fee9[_0x8f5b('0x16')][_0x8f5b('0x18')]);return _0x4e46c4(_0x11fee9[_0x8f5b('0x16')]['message']);}else{logger['info'](_0x8f5b('0x12'),_0x1d1be0,_0x8f5b('0x13'));_0x4e46c4(_0x11fee9[_0x8f5b('0x19')][_0x8f5b('0x18')]);}})['catch'](function(_0x6128d0){logger['error'](_0x8f5b('0x12'),_0x1d1be0,_0x6128d0);_0x5c38d6(_0x6128d0);});});}exports[_0x8f5b('0x1a')]=function(_0x4b185b){var _0x5db619=this;return new Promise(function(_0x301293,_0x3f0d32){return db[_0x8f5b('0x1b')]['create'](_0x4b185b['body'],{'raw':_0x4b185b[_0x8f5b('0x1c')]?_0x4b185b[_0x8f5b('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x8f5b('0x10')](function(_0x4293ee){logger['info'](_0x8f5b('0x1a'),_0x4b185b);logger[_0x8f5b('0x14')](_0x8f5b('0x1a'),_0x4b185b,JSON[_0x8f5b('0x15')](_0x4293ee));_0x301293(_0x4293ee);})[_0x8f5b('0x1d')](function(_0x705988){logger[_0x8f5b('0x16')]('CreateOpenchannelMessage',_0x705988[_0x8f5b('0x18')],_0x4b185b);_0x3f0d32(_0x5db619[_0x8f5b('0x16')](0x1f4,_0x705988[_0x8f5b('0x18')]));});});}; \ No newline at end of file +var _0xe9f2=['error','code','OpenchannelMessage,\x20%s,\x20%s','message','info','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','raw','then','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x375a43,_0x406719){var _0x5c1c8=function(_0x27651e){while(--_0x27651e){_0x375a43['push'](_0x375a43['shift']());}};_0x5c1c8(++_0x406719);}(_0xe9f2,0xfb));var _0x2e9f=function(_0x117113,_0x340e72){_0x117113=_0x117113-0x0;var _0x3d82e2=_0xe9f2[_0x117113];return _0x3d82e2;};'use strict';var _=require('lodash');var util=require(_0x2e9f('0x0'));var moment=require(_0x2e9f('0x1'));var BPromise=require(_0x2e9f('0x2'));var rs=require(_0x2e9f('0x3'));var fs=require('fs');var Redis=require(_0x2e9f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e9f('0x5'));var logger=require(_0x2e9f('0x6'))(_0x2e9f('0x7'));var config=require(_0x2e9f('0x8'));var jayson=require(_0x2e9f('0x9'));var client=jayson[_0x2e9f('0xa')][_0x2e9f('0xb')]({'port':0x232a});config[_0x2e9f('0xc')]=_[_0x2e9f('0xd')](config[_0x2e9f('0xc')],{'host':_0x2e9f('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2e9f('0xc')]));require('./openchannelMessage.socket')[_0x2e9f('0xf')](socket);function respondWithRpcPromise(_0x491a37,_0x5a40bb,_0x6a01b3){return new BPromise(function(_0x39a2dc,_0x33f220){return client[_0x2e9f('0x10')](_0x491a37,_0x6a01b3)['then'](function(_0x470265){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x5a40bb,_0x2e9f('0x11'));logger[_0x2e9f('0x12')](_0x2e9f('0x13'),_0x5a40bb,_0x2e9f('0x11'),JSON[_0x2e9f('0x14')](_0x470265));if(_0x470265[_0x2e9f('0x15')]){if(_0x470265['error'][_0x2e9f('0x16')]===0x1f4){logger[_0x2e9f('0x15')](_0x2e9f('0x17'),_0x5a40bb,_0x470265['error']['message']);return _0x33f220(_0x470265[_0x2e9f('0x15')][_0x2e9f('0x18')]);}logger[_0x2e9f('0x15')]('OpenchannelMessage,\x20%s,\x20%s',_0x5a40bb,_0x470265[_0x2e9f('0x15')][_0x2e9f('0x18')]);return _0x39a2dc(_0x470265['error'][_0x2e9f('0x18')]);}else{logger[_0x2e9f('0x19')]('OpenchannelMessage,\x20%s,\x20%s',_0x5a40bb,'request\x20sent');_0x39a2dc(_0x470265[_0x2e9f('0x1a')][_0x2e9f('0x18')]);}})[_0x2e9f('0x1b')](function(_0x23a9aa){logger[_0x2e9f('0x15')](_0x2e9f('0x17'),_0x5a40bb,_0x23a9aa);_0x33f220(_0x23a9aa);});});}exports[_0x2e9f('0x1c')]=function(_0x28fd34){var _0x5bdd57=this;return new Promise(function(_0xd26f74,_0x29787d){return db[_0x2e9f('0x1d')]['create'](_0x28fd34[_0x2e9f('0x1e')],{'raw':_0x28fd34[_0x2e9f('0x1f')]?_0x28fd34['options'][_0x2e9f('0x20')]===undefined?!![]:![]:!![]})[_0x2e9f('0x21')](function(_0x4b0150){logger[_0x2e9f('0x19')](_0x2e9f('0x1c'),_0x28fd34);logger['debug'](_0x2e9f('0x1c'),_0x28fd34,JSON[_0x2e9f('0x14')](_0x4b0150));_0xd26f74(_0x4b0150);})[_0x2e9f('0x1b')](function(_0x23c595){logger[_0x2e9f('0x15')](_0x2e9f('0x1c'),_0x23c595[_0x2e9f('0x18')],_0x28fd34);_0x29787d(_0x5bdd57[_0x2e9f('0x15')](0x1f4,_0x23c595[_0x2e9f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 9e1e610..81c1d03 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 _0xeec6=['length','openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener'];(function(_0x40e854,_0x42f1f6){var _0x1463b3=function(_0x17b100){while(--_0x17b100){_0x40e854['push'](_0x40e854['shift']());}};_0x1463b3(++_0x42f1f6);}(_0xeec6,0x1c2));var _0x6eec=function(_0x3ba2a3,_0x34d0ba){_0x3ba2a3=_0x3ba2a3-0x0;var _0x2d0e38=_0xeec6[_0x3ba2a3];return _0x2d0e38;};'use strict';var OpenchannelMessageEvents=require(_0x6eec('0x0'));var events=[_0x6eec('0x1'),_0x6eec('0x2'),_0x6eec('0x3')];function createListener(_0x535568,_0x471d43){return function(_0x3e4f10){_0x471d43[_0x6eec('0x4')](_0x535568,_0x3e4f10);};}function removeListener(_0x2d7a15,_0x3e7b6b){return function(){OpenchannelMessageEvents[_0x6eec('0x5')](_0x2d7a15,_0x3e7b6b);};}exports['register']=function(_0x185f31){for(var _0x3c6eda=0x0,_0x48064a=events[_0x6eec('0x6')];_0x3c6eda<_0x48064a;_0x3c6eda++){var _0x1c810e=events[_0x3c6eda];var _0x3443c2=createListener(_0x6eec('0x7')+_0x1c810e,_0x185f31);OpenchannelMessageEvents['on'](_0x1c810e,_0x3443c2);}}; \ No newline at end of file +var _0xec39=['length','openchannelMessage:','./openchannelMessage.events','save','remove','update','removeListener'];(function(_0x2851f2,_0x3d6113){var _0x4984db=function(_0x5c354f){while(--_0x5c354f){_0x2851f2['push'](_0x2851f2['shift']());}};_0x4984db(++_0x3d6113);}(_0xec39,0x19f));var _0x9ec3=function(_0x4a88b5,_0x5cd99c){_0x4a88b5=_0x4a88b5-0x0;var _0xc55b9b=_0xec39[_0x4a88b5];return _0xc55b9b;};'use strict';var OpenchannelMessageEvents=require(_0x9ec3('0x0'));var events=[_0x9ec3('0x1'),_0x9ec3('0x2'),_0x9ec3('0x3')];function createListener(_0x1fc7a7,_0xb3d117){return function(_0x3d481c){_0xb3d117['emit'](_0x1fc7a7,_0x3d481c);};}function removeListener(_0x1f43fb,_0x1c944d){return function(){OpenchannelMessageEvents[_0x9ec3('0x4')](_0x1f43fb,_0x1c944d);};}exports['register']=function(_0x49ddff){for(var _0x55adba=0x0,_0x3742c5=events[_0x9ec3('0x5')];_0x55adba<_0x3742c5;_0x55adba++){var _0x29a6a2=events[_0x55adba];var _0x595e3a=createListener(_0x9ec3('0x6')+_0x29a6a2,_0x49ddff);OpenchannelMessageEvents['on'](_0x29a6a2,_0x595e3a);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 6f3a0be..d2ab4da 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 _0x51f6=['express','Router','./openchannelQueue.controller','get','/describe','/:id','isAuthenticated','/:id/members','getMembers','getTeams','/:id/users','create','post','/:id/teams','addTeams','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0xe2feb1,_0x198e4c){var _0x475dca=function(_0x397ca7){while(--_0x397ca7){_0xe2feb1['push'](_0xe2feb1['shift']());}};_0x475dca(++_0x198e4c);}(_0x51f6,0x168));var _0x651f=function(_0x53f60e,_0x560129){_0x53f60e=_0x53f60e-0x0;var _0x3c34a9=_0x51f6[_0x53f60e];return _0x3c34a9;};'use strict';var multer=require(_0x651f('0x0'));var util=require(_0x651f('0x1'));var path=require(_0x651f('0x2'));var timeout=require(_0x651f('0x3'));var express=require(_0x651f('0x4'));var router=express[_0x651f('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x651f('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x651f('0x7')](_0x651f('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x651f('0x7')](_0x651f('0x9'),auth[_0x651f('0xa')](),controller['show']);router['get'](_0x651f('0xb'),auth['isAuthenticated'](),controller[_0x651f('0xc')]);router[_0x651f('0x7')]('/:id/teams',auth[_0x651f('0xa')](),controller[_0x651f('0xd')]);router[_0x651f('0x7')](_0x651f('0xe'),auth[_0x651f('0xa')](),controller['getAgents']);router['post']('/',auth[_0x651f('0xa')](),controller[_0x651f('0xf')]);router[_0x651f('0x10')](_0x651f('0x11'),auth['isAuthenticated'](),controller[_0x651f('0x12')]);router['post']('/:id/users',auth[_0x651f('0xa')](),controller['addAgents']);router[_0x651f('0x13')](_0x651f('0x9'),auth['isAuthenticated'](),controller[_0x651f('0x14')]);router[_0x651f('0x15')](_0x651f('0x9'),auth['isAuthenticated'](),controller[_0x651f('0x16')]);router['delete'](_0x651f('0x11'),auth[_0x651f('0xa')](),controller[_0x651f('0x17')]);router[_0x651f('0x15')](_0x651f('0xe'),auth[_0x651f('0xa')](),controller[_0x651f('0x18')]);module[_0x651f('0x19')]=router; \ No newline at end of file +var _0x55fb=['Router','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','isAuthenticated','index','get','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x55fb,0x170));var _0xb55f=function(_0xfb675c,_0x2cfb12){_0xfb675c=_0xfb675c-0x0;var _0x56179a=_0x55fb[_0xfb675c];return _0x56179a;};'use strict';var multer=require(_0xb55f('0x0'));var util=require(_0xb55f('0x1'));var path=require('path');var timeout=require(_0xb55f('0x2'));var express=require(_0xb55f('0x3'));var router=express[_0xb55f('0x4')]();var auth=require(_0xb55f('0x5'));var interaction=require(_0xb55f('0x6'));var config=require('../../config/environment');var controller=require(_0xb55f('0x7'));router['get']('/',auth[_0xb55f('0x8')](),controller[_0xb55f('0x9')]);router[_0xb55f('0xa')](_0xb55f('0xb'),auth[_0xb55f('0x8')](),controller[_0xb55f('0xc')]);router[_0xb55f('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb55f('0xd')]);router[_0xb55f('0xa')](_0xb55f('0xe'),auth[_0xb55f('0x8')](),controller[_0xb55f('0xf')]);router['get'](_0xb55f('0x10'),auth[_0xb55f('0x8')](),controller[_0xb55f('0x11')]);router[_0xb55f('0xa')](_0xb55f('0x12'),auth[_0xb55f('0x8')](),controller[_0xb55f('0x13')]);router[_0xb55f('0x14')]('/',auth['isAuthenticated'](),controller[_0xb55f('0x15')]);router[_0xb55f('0x14')](_0xb55f('0x10'),auth[_0xb55f('0x8')](),controller[_0xb55f('0x16')]);router['post'](_0xb55f('0x12'),auth[_0xb55f('0x8')](),controller[_0xb55f('0x17')]);router[_0xb55f('0x18')](_0xb55f('0x19'),auth[_0xb55f('0x8')](),controller['update']);router[_0xb55f('0x1a')](_0xb55f('0x19'),auth['isAuthenticated'](),controller[_0xb55f('0x1b')]);router[_0xb55f('0x1a')](_0xb55f('0x10'),auth[_0xb55f('0x8')](),controller[_0xb55f('0x1c')]);router['delete']('/:id/users',auth[_0xb55f('0x8')](),controller[_0xb55f('0x1d')]);module[_0xb55f('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 5505cc9..b190bb6 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 _0xbbbb=['STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x475c5b,_0x412c71){var _0x501290=function(_0x47071f){while(--_0x47071f){_0x475c5b['push'](_0x475c5b['shift']());}};_0x501290(++_0x412c71);}(_0xbbbb,0x75));var _0xbbbb=function(_0x43c232,_0xe09a68){_0x43c232=_0x43c232-0x0;var _0x489c17=_0xbbbb[_0x43c232];return _0x489c17;};'use strict';var Sequelize=require(_0xbbbb('0x0'));module[_0xbbbb('0x1')]={'name':{'type':Sequelize[_0xbbbb('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xbbbb('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbbbb('0x4')](_0xbbbb('0x5'),'beepall',_0xbbbb('0x6'))}}; \ No newline at end of file +var _0xd794=['STRING','name','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x517f59,_0x40a8f9){var _0x386bc0=function(_0x537bed){while(--_0x537bed){_0x517f59['push'](_0x517f59['shift']());}};_0x386bc0(++_0x40a8f9);}(_0xd794,0x1e1));var _0x4d79=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd794[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x4d79('0x0'));module[_0x4d79('0x1')]={'name':{'type':Sequelize[_0x4d79('0x2')],'unique':_0x4d79('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4d79('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4d79('0x4')](_0x4d79('0x5'),'beepall',_0x4d79('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index a12e254..5fc131f 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 _0xd8b0=['length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','key','VIRTUAL','field','options','includeAll','include','OpenchannelQueue','findAll','rows','params','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','describe','getMembers','UserOpenchannelQueue','pick','OpenchannelQueueId','map','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','findOne','Team','addTeams','ids','Agents','union','addAgents','removeTeams','omit','spread','emit','userOpenchannelQueue:save','removeAgents','isArray','userOpenchannelQueue:remove','getAgents','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','OpenchannelQueues','end','error','name','index','rawAttributes','keys','query','filters','intersection','model','attributes','fields'];(function(_0x3d7670,_0xd5dc58){var _0x3ae54f=function(_0x280bc5){while(--_0x280bc5){_0x3d7670['push'](_0x3d7670['shift']());}};_0x3ae54f(++_0xd5dc58);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var authService=require(_0x0d8b('0xe'));var hardwareService=require(_0x0d8b('0xf'));var Redis=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var logger=require(_0x0d8b('0x12'))('api');var utils=require(_0x0d8b('0x13'));var config=require('../../config/environment');var db=require(_0x0d8b('0x14'))['db'];config[_0x0d8b('0x15')]=_[_0x0d8b('0x16')](config[_0x0d8b('0x15')],{'host':_0x0d8b('0x17'),'port':0x18eb});var socket=require(_0x0d8b('0x18'))(new Redis(config[_0x0d8b('0x15')]));require(_0x0d8b('0x19'))[_0x0d8b('0x1a')](socket);function respondWithStatusCode(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xcc;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x1b')](_0x5ad086);}return _0x2ce75e[_0x0d8b('0x1c')](_0x5ad086)['end']();};}function respondWithResult(_0x23eb7b,_0xa86349){_0xa86349=_0xa86349||0xc8;return function(_0x17f7df){if(_0x17f7df){return _0x23eb7b[_0x0d8b('0x1c')](_0xa86349)[_0x0d8b('0x1d')](_0x17f7df);}};}function respondWithFilteredResult(_0x5cd485,_0x106a01){return function(_0x4586c2){if(_0x4586c2){var _0x2fd0fc=_0x4586c2[_0x0d8b('0x1e')],_0x5fecbd=_0x106a01[_0x0d8b('0x1f')],_0x333674=_0x106a01['offset']+_0x106a01[_0x0d8b('0x20')],_0x18dd2d;if(_0x333674>=_0x2fd0fc){_0x333674=_0x2fd0fc;_0x18dd2d=0xc8;}else{_0x18dd2d=0xce;}_0x5cd485[_0x0d8b('0x1c')](_0x18dd2d);return _0x5cd485[_0x0d8b('0x21')](_0x0d8b('0x22'),_0x5fecbd+'-'+_0x333674+'/'+_0x2fd0fc)[_0x0d8b('0x1d')](_0x4586c2);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x23')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x24')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x25')](_0x54a9a7)[_0x0d8b('0x26')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x27')]()[_0x0d8b('0x26')](function(){var _0x27b695=_0x2c64e2['get']({'plain':!![]});var _0xe8bbee=_0x0d8b('0x28');return db['UserProfileResource'][_0x0d8b('0x27')]({'where':{'type':_0xe8bbee,'resourceId':_0x27b695['id']}})['then'](function(){return _0x2c64e2;});})[_0x0d8b('0x26')](function(){_0x38efc8[_0x0d8b('0x1c')](0xcc)[_0x0d8b('0x29')]();});}};}function handleEntityNotFound(_0x4fe6f9,_0x59a905){return function(_0x28f639){if(!_0x28f639){_0x4fe6f9[_0x0d8b('0x1b')](0x194);}return _0x28f639;};}function handleError(_0x4c05ee,_0xcbc4ac){_0xcbc4ac=_0xcbc4ac||0x1f4;return function(_0x59aa83){logger[_0x0d8b('0x2a')](_0x59aa83['stack']);if(_0x59aa83[_0x0d8b('0x2b')]){delete _0x59aa83['name'];}_0x4c05ee[_0x0d8b('0x1c')](_0xcbc4ac)['send'](_0x59aa83);};}exports[_0x0d8b('0x2c')]=function(_0x544735,_0x3c8887){var _0x106e4c={},_0x2c058d={},_0x56120a={'count':0x0,'rows':[]};var _0x4c80a2=db['OpenchannelQueue'][_0x0d8b('0x2d')];_0x2c058d['model']=_[_0x0d8b('0x2e')](_0x4c80a2);_0x2c058d['query']=_['keys'](_0x544735[_0x0d8b('0x2f')]);_0x2c058d[_0x0d8b('0x30')]=_[_0x0d8b('0x31')](_0x2c058d[_0x0d8b('0x32')],_0x2c058d[_0x0d8b('0x2f')]);_0x106e4c[_0x0d8b('0x33')]=_[_0x0d8b('0x31')](_0x2c058d[_0x0d8b('0x32')],qs['fields'](_0x544735[_0x0d8b('0x2f')][_0x0d8b('0x34')]));_0x106e4c['attributes']=_0x106e4c[_0x0d8b('0x33')][_0x0d8b('0x35')]?_0x106e4c[_0x0d8b('0x33')]:_0x2c058d['model'];if(!_0x544735[_0x0d8b('0x2f')][_0x0d8b('0x36')](_0x0d8b('0x37'))){_0x106e4c[_0x0d8b('0x20')]=qs[_0x0d8b('0x20')](_0x544735['query'][_0x0d8b('0x20')]);_0x106e4c[_0x0d8b('0x1f')]=qs['offset'](_0x544735[_0x0d8b('0x2f')][_0x0d8b('0x1f')]);}_0x106e4c[_0x0d8b('0x38')]=qs[_0x0d8b('0x39')](_0x544735[_0x0d8b('0x2f')]['sort']);_0x106e4c['where']=qs[_0x0d8b('0x30')](_['pick'](_0x544735['query'],_0x2c058d[_0x0d8b('0x30')]));if(_0x544735[_0x0d8b('0x2f')][_0x0d8b('0x3a')]){_0x106e4c[_0x0d8b('0x3b')]=_[_0x0d8b('0x3c')](_0x106e4c[_0x0d8b('0x3b')],{'$or':_['map'](_0x4c80a2,function(_0x6e5bab){if(_0x6e5bab[_0x0d8b('0x3d')][_0x0d8b('0x3e')]!==_0x0d8b('0x3f')){var _0x338ed3={};_0x338ed3[_0x6e5bab[_0x0d8b('0x40')]]={'$like':'%'+_0x544735[_0x0d8b('0x2f')]['filter']+'%'};return _0x338ed3;}})});}_0x106e4c=_[_0x0d8b('0x3c')]({},_0x106e4c,_0x544735[_0x0d8b('0x41')]);var _0x3fa955={'where':_0x106e4c[_0x0d8b('0x3b')]};return db['OpenchannelQueue'][_0x0d8b('0x1e')](_0x3fa955)['then'](function(_0x37b26c){_0x56120a[_0x0d8b('0x1e')]=_0x37b26c;if(_0x544735[_0x0d8b('0x2f')][_0x0d8b('0x42')]){_0x106e4c[_0x0d8b('0x43')]=[{'all':!![]}];}return db[_0x0d8b('0x44')][_0x0d8b('0x45')](_0x106e4c);})[_0x0d8b('0x26')](function(_0x89ab0d){_0x56120a[_0x0d8b('0x46')]=_0x89ab0d;return _0x56120a;})['then'](respondWithFilteredResult(_0x3c8887,_0x106e4c))['catch'](handleError(_0x3c8887,null));};exports['show']=function(_0x4d0811,_0x524d79){var _0x1a46f6={'raw':!![],'where':{'id':_0x4d0811[_0x0d8b('0x47')]['id']}},_0x402fe0={};_0x402fe0['model']=_['keys'](db[_0x0d8b('0x44')][_0x0d8b('0x2d')]);_0x402fe0[_0x0d8b('0x2f')]=_['keys'](_0x4d0811[_0x0d8b('0x2f')]);_0x402fe0[_0x0d8b('0x30')]=_['intersection'](_0x402fe0['model'],_0x402fe0[_0x0d8b('0x2f')]);_0x1a46f6['attributes']=_[_0x0d8b('0x31')](_0x402fe0['model'],qs['fields'](_0x4d0811[_0x0d8b('0x2f')][_0x0d8b('0x34')]));_0x1a46f6['attributes']=_0x1a46f6['attributes']['length']?_0x1a46f6['attributes']:_0x402fe0[_0x0d8b('0x32')];if(_0x4d0811[_0x0d8b('0x2f')][_0x0d8b('0x42')]){_0x1a46f6['include']=[{'all':!![]}];}_0x1a46f6=_[_0x0d8b('0x3c')]({},_0x1a46f6,_0x4d0811[_0x0d8b('0x41')]);return db[_0x0d8b('0x44')][_0x0d8b('0x48')](_0x1a46f6)[_0x0d8b('0x26')](handleEntityNotFound(_0x524d79,null))[_0x0d8b('0x26')](respondWithResult(_0x524d79,null))[_0x0d8b('0x49')](handleError(_0x524d79,null));};exports[_0x0d8b('0x4a')]=function(_0x384a5e,_0x1f2077){return db[_0x0d8b('0x44')][_0x0d8b('0x4a')](_0x384a5e[_0x0d8b('0x4b')],{})[_0x0d8b('0x26')](function(_0x570af8){var _0xdfcf32=_0x384a5e[_0x0d8b('0x4c')][_0x0d8b('0x4d')]({'plain':!![]});if(!_0xdfcf32)throw new Error(_0x0d8b('0x4e'));if(_0xdfcf32['role']===_0x0d8b('0x4c')){var _0x4d8850=_0x570af8['get']({'plain':!![]});var _0x39a31d=_0x0d8b('0x28');return db[_0x0d8b('0x4f')][_0x0d8b('0x48')]({'where':{'name':_0x39a31d,'userProfileId':_0xdfcf32['userProfileId']},'raw':!![]})[_0x0d8b('0x26')](function(_0x1106d6){if(_0x1106d6&&_0x1106d6[_0x0d8b('0x50')]===0x0){return db[_0x0d8b('0x51')][_0x0d8b('0x4a')]({'name':_0x4d8850['name'],'resourceId':_0x4d8850['id'],'type':_0x1106d6['name'],'sectionId':_0x1106d6['id']},{})['then'](function(){return _0x570af8;});}else{return _0x570af8;}})['catch'](function(_0x368ede){logger[_0x0d8b('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x368ede);throw _0x368ede;});}return _0x570af8;})['then'](respondWithResult(_0x1f2077,0xc9))[_0x0d8b('0x49')](handleError(_0x1f2077,null));};exports[_0x0d8b('0x25')]=function(_0x5c5bd7,_0x5ef6c3){if(_0x5c5bd7[_0x0d8b('0x4b')]['id']){delete _0x5c5bd7[_0x0d8b('0x4b')]['id'];}return db[_0x0d8b('0x44')][_0x0d8b('0x48')]({'where':{'id':_0x5c5bd7[_0x0d8b('0x47')]['id']}})['then'](handleEntityNotFound(_0x5ef6c3,null))[_0x0d8b('0x26')](saveUpdates(_0x5c5bd7[_0x0d8b('0x4b')],null))['then'](respondWithResult(_0x5ef6c3,null))['catch'](handleError(_0x5ef6c3,null));};exports[_0x0d8b('0x27')]=function(_0x3f2d95,_0x546fef){return db['OpenchannelQueue'][_0x0d8b('0x48')]({'where':{'id':_0x3f2d95[_0x0d8b('0x47')]['id']}})[_0x0d8b('0x26')](handleEntityNotFound(_0x546fef,null))[_0x0d8b('0x26')](removeEntity(_0x546fef,null))['catch'](handleError(_0x546fef,null));};exports[_0x0d8b('0x52')]=function(_0x598e03,_0x5c271c){return db[_0x0d8b('0x44')][_0x0d8b('0x52')]()['then'](respondWithResult(_0x5c271c,null))['catch'](handleError(_0x5c271c,null));};exports[_0x0d8b('0x53')]=function(_0x3d7161,_0xccc2a9,_0x2c1eb0){var _0x3afc3a={'raw':!![],'where':{}},_0xb66e76={},_0x3978e5;return db[_0x0d8b('0x44')]['findOne']({'where':{'id':_0x3d7161[_0x0d8b('0x47')]['id']}})[_0x0d8b('0x26')](handleEntityNotFound(_0xccc2a9,null))[_0x0d8b('0x26')](function(_0x3c7efb){if(_0x3c7efb){_0x3978e5=_0x3c7efb[_0x0d8b('0x4d')]({'plain':!![]});_0xb66e76[_0x0d8b('0x32')]=_[_0x0d8b('0x2e')](db[_0x0d8b('0x54')][_0x0d8b('0x2d')]);_0xb66e76['query']=_[_0x0d8b('0x2e')](_0x3d7161[_0x0d8b('0x2f')]);_0xb66e76[_0x0d8b('0x30')]=_[_0x0d8b('0x31')](_0xb66e76[_0x0d8b('0x32')],_0xb66e76['query']);_0x3afc3a[_0x0d8b('0x33')]=_[_0x0d8b('0x31')](_0xb66e76[_0x0d8b('0x32')],qs[_0x0d8b('0x34')](_0x3d7161[_0x0d8b('0x2f')]['fields']));_0x3afc3a['attributes']=_0x3afc3a[_0x0d8b('0x33')][_0x0d8b('0x35')]?_0x3afc3a[_0x0d8b('0x33')]:_0xb66e76[_0x0d8b('0x32')];if(!_0x3d7161['query'][_0x0d8b('0x36')](_0x0d8b('0x37'))){_0x3afc3a[_0x0d8b('0x20')]=qs['limit'](_0x3d7161[_0x0d8b('0x2f')]['limit']);_0x3afc3a[_0x0d8b('0x1f')]=qs[_0x0d8b('0x1f')](_0x3d7161[_0x0d8b('0x2f')][_0x0d8b('0x1f')]);}_0x3afc3a[_0x0d8b('0x38')]=qs[_0x0d8b('0x39')](_0x3d7161['query'][_0x0d8b('0x39')]);_0x3afc3a['where']=qs[_0x0d8b('0x30')](_[_0x0d8b('0x55')](_0x3d7161[_0x0d8b('0x2f')],_0xb66e76[_0x0d8b('0x30')]));_0x3afc3a['where'][_0x0d8b('0x56')]=_0x3c7efb['id'];if(_0x3d7161[_0x0d8b('0x2f')][_0x0d8b('0x3a')]){_0x3afc3a[_0x0d8b('0x3b')]=_[_0x0d8b('0x3c')](_0x3afc3a[_0x0d8b('0x3b')],{'$or':_[_0x0d8b('0x57')](_0x3afc3a[_0x0d8b('0x33')],function(_0x2ce282){var _0x34affb={};_0x34affb[_0x2ce282]={'$like':'%'+_0x3d7161['query']['filter']+'%'};return _0x34affb;})});}_0x3afc3a=_[_0x0d8b('0x3c')]({},_0x3afc3a,_0x3d7161[_0x0d8b('0x41')]);return db['UserOpenchannelQueue'][_0x0d8b('0x45')](_0x3afc3a);}})['then'](function(_0x5cc960){if(_0x5cc960){return db[_0x0d8b('0x58')][_0x0d8b('0x59')]({'where':{'id':_['map'](_0x5cc960,'UserId'),'role':_0x0d8b('0x5a')},'attributes':['id',_0x0d8b('0x2b'),_0x0d8b('0x5b'),_0x0d8b('0x5c'),_0x0d8b('0x5d')]});}})[_0x0d8b('0x26')](function(_0x40d265){if(_0x40d265){return{'count':_0x40d265['count'],'rows':_[_0x0d8b('0x57')](_0x40d265['rows'],function(_0x1a203e){return{'membername':_0x1a203e[_0x0d8b('0x2b')],'UserId':_0x1a203e['id'],'queue_name':_0x3978e5[_0x0d8b('0x2b')],'OpenchannelQueueId':_0x3978e5['id'],'interface':util[_0x0d8b('0x5e')]('%s/%s',_0x0d8b('0x5f'),_0x1a203e['name']),'penalty':0x0,'paused':_0x1a203e[_0x0d8b('0x5b')],'createdAt':_0x1a203e[_0x0d8b('0x5d')],'updatedAt':_0x1a203e[_0x0d8b('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0d8b('0x26')](respondWithFilteredResult(_0xccc2a9,_0x3afc3a))[_0x0d8b('0x49')](handleError(_0xccc2a9,null));};exports[_0x0d8b('0x60')]=function(_0x3e927c,_0x91aa89,_0x266a69){var _0x44aa74={};var _0x4eb07e={};var _0x1436b3;var _0x54c28b;return db[_0x0d8b('0x44')][_0x0d8b('0x61')]({'where':{'id':_0x3e927c['params']['id']}})[_0x0d8b('0x26')](handleEntityNotFound(_0x91aa89,null))['then'](function(_0x10c318){if(_0x10c318){_0x1436b3=_0x10c318;_0x4eb07e[_0x0d8b('0x32')]=_[_0x0d8b('0x2e')](db[_0x0d8b('0x62')][_0x0d8b('0x2d')]);_0x4eb07e[_0x0d8b('0x2f')]=_[_0x0d8b('0x2e')](_0x3e927c[_0x0d8b('0x2f')]);_0x4eb07e['filters']=_[_0x0d8b('0x31')](_0x4eb07e[_0x0d8b('0x32')],_0x4eb07e['query']);_0x44aa74[_0x0d8b('0x33')]=_[_0x0d8b('0x31')](_0x4eb07e[_0x0d8b('0x32')],qs[_0x0d8b('0x34')](_0x3e927c[_0x0d8b('0x2f')][_0x0d8b('0x34')]));_0x44aa74[_0x0d8b('0x33')]=_0x44aa74[_0x0d8b('0x33')][_0x0d8b('0x35')]?_0x44aa74[_0x0d8b('0x33')]:_0x4eb07e[_0x0d8b('0x32')];_0x44aa74[_0x0d8b('0x38')]=qs['sort'](_0x3e927c[_0x0d8b('0x2f')][_0x0d8b('0x39')]);_0x44aa74[_0x0d8b('0x3b')]=qs['filters'](_['pick'](_0x3e927c[_0x0d8b('0x2f')],_0x4eb07e[_0x0d8b('0x30')]));if(_0x3e927c[_0x0d8b('0x2f')]['filter']){_0x44aa74['where']=_[_0x0d8b('0x3c')](_0x44aa74[_0x0d8b('0x3b')],{'$or':_[_0x0d8b('0x57')](_0x44aa74[_0x0d8b('0x33')],function(_0x2a2b58){var _0x3f7895={};_0x3f7895[_0x2a2b58]={'$like':'%'+_0x3e927c[_0x0d8b('0x2f')][_0x0d8b('0x3a')]+'%'};return _0x3f7895;})});}_0x44aa74=_[_0x0d8b('0x3c')]({},_0x44aa74,_0x3e927c[_0x0d8b('0x41')]);return _0x1436b3[_0x0d8b('0x60')](_0x44aa74);}})[_0x0d8b('0x26')](function(_0x3b060e){if(_0x3b060e){_0x54c28b=_0x3b060e['length'];if(!_0x3e927c[_0x0d8b('0x2f')][_0x0d8b('0x36')]('nolimit')){_0x44aa74['limit']=qs[_0x0d8b('0x20')](_0x3e927c[_0x0d8b('0x2f')][_0x0d8b('0x20')]);_0x44aa74[_0x0d8b('0x1f')]=qs[_0x0d8b('0x1f')](_0x3e927c[_0x0d8b('0x2f')]['offset']);}return _0x1436b3['getTeams'](_0x44aa74);}})['then'](function(_0x1f1eae){if(_0x1f1eae){return _0x1f1eae?{'count':_0x54c28b,'rows':_0x1f1eae}:null;}})[_0x0d8b('0x26')](respondWithResult(_0x91aa89,null))[_0x0d8b('0x49')](handleError(_0x91aa89,null));};exports[_0x0d8b('0x63')]=function(_0x3f1eee,_0x21d620,_0x5ef461){var _0x302426=[];var _0x1d173f;return db['Team'][_0x0d8b('0x45')]({'where':{'id':_0x3f1eee['body'][_0x0d8b('0x64')]},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x58')],'as':_0x0d8b('0x65'),'attributes':['id'],'raw':!![]}]})[_0x0d8b('0x26')](function(_0x10c7ab){if(_0x10c7ab){for(var _0x8fae7f=0x0;_0x8fae7f<_0x10c7ab[_0x0d8b('0x35')];_0x8fae7f+=0x1){for(var _0xb73e32=0x0;_0xb73e32<_0x10c7ab[_0x8fae7f][_0x0d8b('0x65')][_0x0d8b('0x35')];_0xb73e32+=0x1){_0x302426=_[_0x0d8b('0x66')](_0x302426,[_0x10c7ab[_0x8fae7f][_0x0d8b('0x65')][_0xb73e32]['id']]);}}return _0x302426;}})['then'](function(_0x4dd64b){if(_0x4dd64b){return db[_0x0d8b('0x44')][_0x0d8b('0x48')]({'where':{'id':_0x3f1eee[_0x0d8b('0x47')]['id']}});}})[_0x0d8b('0x26')](function(_0xf91ecd){if(_0xf91ecd){_0x1d173f=_0xf91ecd;return _0x1d173f[_0x0d8b('0x67')](_0x302426,{'penalty':_0x3f1eee[_0x0d8b('0x4b')]['penalty']});}})[_0x0d8b('0x26')](function(_0x4c3948){if(_0x4c3948){return _0x1d173f[_0x0d8b('0x63')](_0x3f1eee['body']['ids']);}})[_0x0d8b('0x26')](handleEntityNotFound(_0x21d620,null))[_0x0d8b('0x26')](respondWithStatusCode(_0x21d620,null))[_0x0d8b('0x49')](handleError(_0x21d620,null));};exports[_0x0d8b('0x68')]=function(_0x2cf02c,_0x2eece2,_0x3c7b9b){var _0x180eda=[];var _0x35267a;return db[_0x0d8b('0x62')][_0x0d8b('0x45')]({'where':{'id':_0x2cf02c[_0x0d8b('0x2f')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x58')],'as':_0x0d8b('0x65'),'attributes':['id'],'raw':!![]}]})[_0x0d8b('0x26')](function(_0x5eba19){if(_0x5eba19){for(var _0x4ce443=0x0;_0x4ce443<_0x5eba19[_0x0d8b('0x35')];_0x4ce443+=0x1){for(var _0x671705=0x0;_0x671705<_0x5eba19[_0x4ce443][_0x0d8b('0x65')][_0x0d8b('0x35')];_0x671705+=0x1){_0x180eda=_[_0x0d8b('0x66')](_0x180eda,[_0x5eba19[_0x4ce443][_0x0d8b('0x65')][_0x671705]['id']]);}}return _0x180eda;}})['then'](function(_0x1a96ce){if(_0x1a96ce){return db[_0x0d8b('0x44')][_0x0d8b('0x48')]({'where':{'id':_0x2cf02c[_0x0d8b('0x47')]['id']}});}})[_0x0d8b('0x26')](function(_0x55ea97){if(_0x55ea97){_0x35267a=_0x55ea97;return _0x35267a['removeAgents'](_0x180eda);}})[_0x0d8b('0x26')](function(_0x41ea29){if(_0x35267a){return _0x35267a[_0x0d8b('0x68')](_0x2cf02c['query'][_0x0d8b('0x64')]);}})[_0x0d8b('0x26')](handleEntityNotFound(_0x2eece2,null))[_0x0d8b('0x26')](respondWithStatusCode(_0x2eece2,null))['catch'](handleError(_0x2eece2,null));};exports[_0x0d8b('0x67')]=function(_0x3bc6d5,_0xeca283,_0x9ec9bc){return db[_0x0d8b('0x44')][_0x0d8b('0x48')]({'where':{'id':_0x3bc6d5[_0x0d8b('0x47')]['id']}})[_0x0d8b('0x26')](handleEntityNotFound(_0xeca283,null))[_0x0d8b('0x26')](function(_0x4bb4c7){if(_0x4bb4c7){return _0x4bb4c7[_0x0d8b('0x67')](_0x3bc6d5[_0x0d8b('0x4b')][_0x0d8b('0x64')],_[_0x0d8b('0x69')](_0x3bc6d5[_0x0d8b('0x4b')],[_0x0d8b('0x64'),'id'])||{})[_0x0d8b('0x6a')](function(_0x673201){for(var _0x35ebba=0x0;_0x35ebba<_0x3bc6d5['body']['ids'][_0x0d8b('0x35')];_0x35ebba+=0x1){socket[_0x0d8b('0x6b')](_0x0d8b('0x6c'),{'UserId':_0x3bc6d5[_0x0d8b('0x4b')]['ids'][_0x35ebba],'OpenchannelQueueId':_0x3bc6d5[_0x0d8b('0x47')]['id']});}return _0x673201;});}})[_0x0d8b('0x26')](respondWithResult(_0xeca283,null))['catch'](handleError(_0xeca283,null));};exports[_0x0d8b('0x6d')]=function(_0x4e1b5b,_0x4fb226,_0x2e5f7a){var _0x33965a;return db[_0x0d8b('0x44')][_0x0d8b('0x48')]({'where':{'id':_0x4e1b5b[_0x0d8b('0x47')]['id']}})[_0x0d8b('0x26')](handleEntityNotFound(_0x4fb226,null))[_0x0d8b('0x26')](function(_0x4ceb3a){if(_0x4ceb3a){return _0x4ceb3a[_0x0d8b('0x6d')](_0x4e1b5b['query']['ids'])[_0x0d8b('0x26')](function(_0x5c50f2){if(_[_0x0d8b('0x6e')](_0x4e1b5b[_0x0d8b('0x2f')]['ids'])){for(var _0x12f2bb=0x0;_0x12f2bb<_0x4e1b5b['query']['ids'][_0x0d8b('0x35')];_0x12f2bb+=0x1){socket[_0x0d8b('0x6b')](_0x0d8b('0x6f'),{'UserId':_0x4e1b5b[_0x0d8b('0x2f')][_0x0d8b('0x64')][_0x12f2bb],'OpenchannelQueueId':_0x4e1b5b['params']['id']});}}else{socket['emit'](_0x0d8b('0x6f'),{'UserId':_0x4e1b5b[_0x0d8b('0x2f')][_0x0d8b('0x64')],'OpenchannelQueueId':_0x4e1b5b[_0x0d8b('0x47')]['id']});}});}})[_0x0d8b('0x26')](respondWithStatusCode(_0x4fb226,null))[_0x0d8b('0x49')](handleError(_0x4fb226,null));};exports[_0x0d8b('0x70')]=function(_0x21bfd1,_0x4e3dd1,_0x5ab046){var _0x3582d3={};var _0x2640a6={};var _0x4a453b;var _0x551995;return db['OpenchannelQueue'][_0x0d8b('0x61')]({'where':{'id':_0x21bfd1[_0x0d8b('0x47')]['id']}})[_0x0d8b('0x26')](handleEntityNotFound(_0x4e3dd1,null))['then'](function(_0x21643d){if(_0x21643d){_0x4a453b=_0x21643d;_0x2640a6[_0x0d8b('0x32')]=_[_0x0d8b('0x2e')](db['User'][_0x0d8b('0x2d')]);_0x2640a6['query']=_[_0x0d8b('0x2e')](_0x21bfd1['query']);_0x2640a6[_0x0d8b('0x30')]=_[_0x0d8b('0x31')](_0x2640a6[_0x0d8b('0x32')],_0x2640a6[_0x0d8b('0x2f')]);_0x3582d3[_0x0d8b('0x33')]=_['intersection'](_0x2640a6[_0x0d8b('0x32')],qs['fields'](_0x21bfd1[_0x0d8b('0x2f')]['fields']));_0x3582d3[_0x0d8b('0x33')]=_0x3582d3['attributes']['length']?_0x3582d3[_0x0d8b('0x33')]:_0x2640a6[_0x0d8b('0x32')];_0x3582d3['order']=qs[_0x0d8b('0x39')](_0x21bfd1[_0x0d8b('0x2f')][_0x0d8b('0x39')]);_0x3582d3['where']=qs['filters'](_['pick'](_0x21bfd1[_0x0d8b('0x2f')],_0x2640a6[_0x0d8b('0x30')]));if(_0x21bfd1[_0x0d8b('0x2f')][_0x0d8b('0x3a')]){_0x3582d3[_0x0d8b('0x3b')]=_[_0x0d8b('0x3c')](_0x3582d3[_0x0d8b('0x3b')],{'$or':_[_0x0d8b('0x57')](_0x3582d3[_0x0d8b('0x33')],function(_0xba602f){var _0x4dc5bd={};_0x4dc5bd[_0xba602f]={'$like':'%'+_0x21bfd1[_0x0d8b('0x2f')][_0x0d8b('0x3a')]+'%'};return _0x4dc5bd;})});}_0x3582d3=_[_0x0d8b('0x3c')]({},_0x3582d3,_0x21bfd1['options']);return _0x4a453b[_0x0d8b('0x70')](_0x3582d3);}})[_0x0d8b('0x26')](function(_0x13bce2){if(_0x13bce2){_0x551995=_0x13bce2[_0x0d8b('0x35')];if(!_0x21bfd1[_0x0d8b('0x2f')][_0x0d8b('0x36')](_0x0d8b('0x37'))){_0x3582d3[_0x0d8b('0x20')]=qs[_0x0d8b('0x20')](_0x21bfd1[_0x0d8b('0x2f')][_0x0d8b('0x20')]);_0x3582d3[_0x0d8b('0x1f')]=qs['offset'](_0x21bfd1[_0x0d8b('0x2f')][_0x0d8b('0x1f')]);}return _0x4a453b[_0x0d8b('0x70')](_0x3582d3);}})[_0x0d8b('0x26')](function(_0x590889){if(_0x590889){return _0x590889?{'count':_0x551995,'rows':_0x590889}:null;}})['then'](respondWithResult(_0x4e3dd1,null))[_0x0d8b('0x49')](handleError(_0x4e3dd1,null));}; \ No newline at end of file +var _0xb10b=['name','send','OpenchannelQueue','keys','query','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','type','key','field','filter','options','include','findAll','rows','catch','show','rawAttributes','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','hasOwnProperty','OpenchannelQueueId','map','UserOpenchannelQueue','UserId','agent','updatedAt','createdAt','format','%s/%s','getTeams','Team','ids','User','Agents','union','addAgents','penalty','addTeams','removeTeams','removeAgents','spread','emit','userOpenchannelQueue:save','userOpenchannelQueue:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','count','offset','set','Content-Range','json','reject','update','then','destroy','get','error','stack'];(function(_0x583a73,_0x310779){var _0x25b31a=function(_0x42117b){while(--_0x42117b){_0x583a73['push'](_0x583a73['shift']());}};_0x25b31a(++_0x310779);}(_0xb10b,0x12a));var _0xbb10=function(_0x5f3de3,_0x40f0f5){_0x5f3de3=_0x5f3de3-0x0;var _0x287e0d=_0xb10b[_0x5f3de3];return _0x287e0d;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var hardwareService=require(_0xbb10('0x13'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require(_0xbb10('0x16'));var config=require('../../config/environment');var db=require(_0xbb10('0x17'))['db'];config['redis']=_[_0xbb10('0x18')](config[_0xbb10('0x19')],{'host':_0xbb10('0x1a'),'port':0x18eb});var socket=require(_0xbb10('0x1b'))(new Redis(config[_0xbb10('0x19')]));require(_0xbb10('0x1c'))['register'](socket);function respondWithStatusCode(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xcc;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x1d')](_0x42d7e4);}return _0x26e021[_0xbb10('0x1e')](_0x42d7e4)[_0xbb10('0x1f')]();};}function respondWithResult(_0x24a57b,_0x36b5e8){_0x36b5e8=_0x36b5e8||0xc8;return function(_0x3e26f4){if(_0x3e26f4){return _0x24a57b[_0xbb10('0x1e')](_0x36b5e8)['json'](_0x3e26f4);}};}function respondWithFilteredResult(_0x2eca0f,_0x1145f1){return function(_0x133ac2){if(_0x133ac2){var _0x42db98=_0x133ac2[_0xbb10('0x20')],_0x378da8=_0x1145f1[_0xbb10('0x21')],_0x1682a4=_0x1145f1[_0xbb10('0x21')]+_0x1145f1['limit'],_0x575cca;if(_0x1682a4>=_0x42db98){_0x1682a4=_0x42db98;_0x575cca=0xc8;}else{_0x575cca=0xce;}_0x2eca0f[_0xbb10('0x1e')](_0x575cca);return _0x2eca0f[_0xbb10('0x22')](_0xbb10('0x23'),_0x378da8+'-'+_0x1682a4+'/'+_0x42db98)[_0xbb10('0x24')](_0x133ac2);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x25')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x26')](_0x4c4b0d)[_0xbb10('0x27')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x28')]()[_0xbb10('0x27')](function(){var _0x3ba6cd=_0x436104[_0xbb10('0x29')]({'plain':!![]});var _0x537898='OpenchannelQueues';return db['UserProfileResource'][_0xbb10('0x28')]({'where':{'type':_0x537898,'resourceId':_0x3ba6cd['id']}})[_0xbb10('0x27')](function(){return _0x436104;});})[_0xbb10('0x27')](function(){_0x1824b7['status'](0xcc)[_0xbb10('0x1f')]();});}};}function handleEntityNotFound(_0x24d586,_0x6ed43b){return function(_0x1d5e95){if(!_0x1d5e95){_0x24d586[_0xbb10('0x1d')](0x194);}return _0x1d5e95;};}function handleError(_0x20d946,_0x2a0e8b){_0x2a0e8b=_0x2a0e8b||0x1f4;return function(_0x4aabb9){logger[_0xbb10('0x2a')](_0x4aabb9[_0xbb10('0x2b')]);if(_0x4aabb9[_0xbb10('0x2c')]){delete _0x4aabb9[_0xbb10('0x2c')];}_0x20d946[_0xbb10('0x1e')](_0x2a0e8b)[_0xbb10('0x2d')](_0x4aabb9);};}exports['index']=function(_0x221624,_0x4ee02e){var _0x448d5c={},_0x56f2da={},_0x16ad2a={'count':0x0,'rows':[]};var _0x1dcc9c=db[_0xbb10('0x2e')]['rawAttributes'];_0x56f2da['model']=_[_0xbb10('0x2f')](_0x1dcc9c);_0x56f2da[_0xbb10('0x30')]=_['keys'](_0x221624[_0xbb10('0x30')]);_0x56f2da[_0xbb10('0x31')]=_[_0xbb10('0x32')](_0x56f2da[_0xbb10('0x33')],_0x56f2da[_0xbb10('0x30')]);_0x448d5c[_0xbb10('0x34')]=_[_0xbb10('0x32')](_0x56f2da['model'],qs[_0xbb10('0x35')](_0x221624[_0xbb10('0x30')][_0xbb10('0x35')]));_0x448d5c[_0xbb10('0x34')]=_0x448d5c[_0xbb10('0x34')][_0xbb10('0x36')]?_0x448d5c[_0xbb10('0x34')]:_0x56f2da[_0xbb10('0x33')];if(!_0x221624[_0xbb10('0x30')]['hasOwnProperty'](_0xbb10('0x37'))){_0x448d5c[_0xbb10('0x38')]=qs[_0xbb10('0x38')](_0x221624[_0xbb10('0x30')]['limit']);_0x448d5c[_0xbb10('0x21')]=qs['offset'](_0x221624['query'][_0xbb10('0x21')]);}_0x448d5c[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_0x221624[_0xbb10('0x30')][_0xbb10('0x3a')]);_0x448d5c[_0xbb10('0x3b')]=qs['filters'](_[_0xbb10('0x3c')](_0x221624[_0xbb10('0x30')],_0x56f2da['filters']));if(_0x221624['query']['filter']){_0x448d5c[_0xbb10('0x3b')]=_[_0xbb10('0x3d')](_0x448d5c[_0xbb10('0x3b')],{'$or':_['map'](_0x1dcc9c,function(_0x3c0cd7){if(_0x3c0cd7[_0xbb10('0x3e')][_0xbb10('0x3f')]!=='VIRTUAL'){var _0x17b6c5={};_0x17b6c5[_0x3c0cd7[_0xbb10('0x40')]]={'$like':'%'+_0x221624[_0xbb10('0x30')][_0xbb10('0x41')]+'%'};return _0x17b6c5;}})});}_0x448d5c=_['merge']({},_0x448d5c,_0x221624[_0xbb10('0x42')]);var _0x110eb5={'where':_0x448d5c['where']};return db[_0xbb10('0x2e')][_0xbb10('0x20')](_0x110eb5)[_0xbb10('0x27')](function(_0x3a9934){_0x16ad2a[_0xbb10('0x20')]=_0x3a9934;if(_0x221624[_0xbb10('0x30')]['includeAll']){_0x448d5c[_0xbb10('0x43')]=[{'all':!![]}];}return db[_0xbb10('0x2e')][_0xbb10('0x44')](_0x448d5c);})[_0xbb10('0x27')](function(_0x4943d9){_0x16ad2a[_0xbb10('0x45')]=_0x4943d9;return _0x16ad2a;})[_0xbb10('0x27')](respondWithFilteredResult(_0x4ee02e,_0x448d5c))[_0xbb10('0x46')](handleError(_0x4ee02e,null));};exports[_0xbb10('0x47')]=function(_0x5e2cfa,_0x351484){var _0x202c60={'raw':!![],'where':{'id':_0x5e2cfa['params']['id']}},_0x54ac18={};_0x54ac18[_0xbb10('0x33')]=_['keys'](db[_0xbb10('0x2e')][_0xbb10('0x48')]);_0x54ac18['query']=_[_0xbb10('0x2f')](_0x5e2cfa[_0xbb10('0x30')]);_0x54ac18[_0xbb10('0x31')]=_['intersection'](_0x54ac18[_0xbb10('0x33')],_0x54ac18[_0xbb10('0x30')]);_0x202c60[_0xbb10('0x34')]=_[_0xbb10('0x32')](_0x54ac18[_0xbb10('0x33')],qs[_0xbb10('0x35')](_0x5e2cfa[_0xbb10('0x30')][_0xbb10('0x35')]));_0x202c60[_0xbb10('0x34')]=_0x202c60[_0xbb10('0x34')][_0xbb10('0x36')]?_0x202c60[_0xbb10('0x34')]:_0x54ac18['model'];if(_0x5e2cfa[_0xbb10('0x30')][_0xbb10('0x49')]){_0x202c60['include']=[{'all':!![]}];}_0x202c60=_[_0xbb10('0x3d')]({},_0x202c60,_0x5e2cfa[_0xbb10('0x42')]);return db[_0xbb10('0x2e')][_0xbb10('0x4a')](_0x202c60)[_0xbb10('0x27')](handleEntityNotFound(_0x351484,null))[_0xbb10('0x27')](respondWithResult(_0x351484,null))[_0xbb10('0x46')](handleError(_0x351484,null));};exports['create']=function(_0x4a9793,_0xcb3354){return db[_0xbb10('0x2e')][_0xbb10('0x4b')](_0x4a9793['body'],{})['then'](function(_0x3cd6f3){var _0x34cf4e=_0x4a9793[_0xbb10('0x4c')][_0xbb10('0x29')]({'plain':!![]});if(!_0x34cf4e)throw new Error(_0xbb10('0x4d'));if(_0x34cf4e[_0xbb10('0x4e')]===_0xbb10('0x4c')){var _0x460788=_0x3cd6f3[_0xbb10('0x29')]({'plain':!![]});var _0x3d7e7e='OpenchannelQueues';return db['UserProfileSection'][_0xbb10('0x4a')]({'where':{'name':_0x3d7e7e,'userProfileId':_0x34cf4e[_0xbb10('0x4f')]},'raw':!![]})[_0xbb10('0x27')](function(_0xb014b0){if(_0xb014b0&&_0xb014b0[_0xbb10('0x50')]===0x0){return db[_0xbb10('0x51')][_0xbb10('0x4b')]({'name':_0x460788[_0xbb10('0x2c')],'resourceId':_0x460788['id'],'type':_0xb014b0[_0xbb10('0x2c')],'sectionId':_0xb014b0['id']},{})[_0xbb10('0x27')](function(){return _0x3cd6f3;});}else{return _0x3cd6f3;}})[_0xbb10('0x46')](function(_0x20e18a){logger[_0xbb10('0x2a')](_0xbb10('0x52'),_0x20e18a);throw _0x20e18a;});}return _0x3cd6f3;})[_0xbb10('0x27')](respondWithResult(_0xcb3354,0xc9))['catch'](handleError(_0xcb3354,null));};exports[_0xbb10('0x26')]=function(_0x5bd44d,_0x33d60a){if(_0x5bd44d[_0xbb10('0x53')]['id']){delete _0x5bd44d[_0xbb10('0x53')]['id'];}return db[_0xbb10('0x2e')][_0xbb10('0x4a')]({'where':{'id':_0x5bd44d[_0xbb10('0x54')]['id']}})[_0xbb10('0x27')](handleEntityNotFound(_0x33d60a,null))[_0xbb10('0x27')](saveUpdates(_0x5bd44d[_0xbb10('0x53')],null))[_0xbb10('0x27')](respondWithResult(_0x33d60a,null))[_0xbb10('0x46')](handleError(_0x33d60a,null));};exports[_0xbb10('0x28')]=function(_0x1d49e1,_0x3d7e17){return db[_0xbb10('0x2e')]['find']({'where':{'id':_0x1d49e1[_0xbb10('0x54')]['id']}})[_0xbb10('0x27')](handleEntityNotFound(_0x3d7e17,null))[_0xbb10('0x27')](removeEntity(_0x3d7e17,null))[_0xbb10('0x46')](handleError(_0x3d7e17,null));};exports[_0xbb10('0x55')]=function(_0x379d8c,_0x4bedd0){return db[_0xbb10('0x2e')][_0xbb10('0x55')]()[_0xbb10('0x27')](respondWithResult(_0x4bedd0,null))[_0xbb10('0x46')](handleError(_0x4bedd0,null));};exports[_0xbb10('0x56')]=function(_0x22de7f,_0x175872,_0x12ec18){var _0x205e01={'raw':!![],'where':{}},_0x40c4fb={},_0x2eb05a;return db[_0xbb10('0x2e')][_0xbb10('0x57')]({'where':{'id':_0x22de7f['params']['id']}})['then'](handleEntityNotFound(_0x175872,null))[_0xbb10('0x27')](function(_0x3e6338){if(_0x3e6338){_0x2eb05a=_0x3e6338[_0xbb10('0x29')]({'plain':!![]});_0x40c4fb[_0xbb10('0x33')]=_['keys'](db['UserOpenchannelQueue'][_0xbb10('0x48')]);_0x40c4fb[_0xbb10('0x30')]=_[_0xbb10('0x2f')](_0x22de7f[_0xbb10('0x30')]);_0x40c4fb[_0xbb10('0x31')]=_[_0xbb10('0x32')](_0x40c4fb[_0xbb10('0x33')],_0x40c4fb['query']);_0x205e01[_0xbb10('0x34')]=_[_0xbb10('0x32')](_0x40c4fb['model'],qs['fields'](_0x22de7f['query'][_0xbb10('0x35')]));_0x205e01[_0xbb10('0x34')]=_0x205e01[_0xbb10('0x34')]['length']?_0x205e01['attributes']:_0x40c4fb['model'];if(!_0x22de7f[_0xbb10('0x30')][_0xbb10('0x58')](_0xbb10('0x37'))){_0x205e01['limit']=qs[_0xbb10('0x38')](_0x22de7f[_0xbb10('0x30')]['limit']);_0x205e01['offset']=qs[_0xbb10('0x21')](_0x22de7f[_0xbb10('0x30')][_0xbb10('0x21')]);}_0x205e01[_0xbb10('0x39')]=qs['sort'](_0x22de7f[_0xbb10('0x30')][_0xbb10('0x3a')]);_0x205e01[_0xbb10('0x3b')]=qs['filters'](_[_0xbb10('0x3c')](_0x22de7f[_0xbb10('0x30')],_0x40c4fb[_0xbb10('0x31')]));_0x205e01['where'][_0xbb10('0x59')]=_0x3e6338['id'];if(_0x22de7f[_0xbb10('0x30')][_0xbb10('0x41')]){_0x205e01[_0xbb10('0x3b')]=_['merge'](_0x205e01[_0xbb10('0x3b')],{'$or':_[_0xbb10('0x5a')](_0x205e01[_0xbb10('0x34')],function(_0x2d0f4b){var _0x56b3a3={};_0x56b3a3[_0x2d0f4b]={'$like':'%'+_0x22de7f[_0xbb10('0x30')][_0xbb10('0x41')]+'%'};return _0x56b3a3;})});}_0x205e01=_[_0xbb10('0x3d')]({},_0x205e01,_0x22de7f[_0xbb10('0x42')]);return db[_0xbb10('0x5b')][_0xbb10('0x44')](_0x205e01);}})[_0xbb10('0x27')](function(_0x4a30c5){if(_0x4a30c5){return db['User']['findAndCountAll']({'where':{'id':_[_0xbb10('0x5a')](_0x4a30c5,_0xbb10('0x5c')),'role':_0xbb10('0x5d')},'attributes':['id','name','openchannelPause',_0xbb10('0x5e'),_0xbb10('0x5f')]});}})[_0xbb10('0x27')](function(_0x3a9677){if(_0x3a9677){return{'count':_0x3a9677[_0xbb10('0x20')],'rows':_[_0xbb10('0x5a')](_0x3a9677['rows'],function(_0x1a5ca5){return{'membername':_0x1a5ca5[_0xbb10('0x2c')],'UserId':_0x1a5ca5['id'],'queue_name':_0x2eb05a[_0xbb10('0x2c')],'OpenchannelQueueId':_0x2eb05a['id'],'interface':util[_0xbb10('0x60')](_0xbb10('0x61'),'SIP',_0x1a5ca5['name']),'penalty':0x0,'paused':_0x1a5ca5['openchannelPause'],'createdAt':_0x1a5ca5[_0xbb10('0x5f')],'updatedAt':_0x1a5ca5[_0xbb10('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbb10('0x27')](respondWithFilteredResult(_0x175872,_0x205e01))[_0xbb10('0x46')](handleError(_0x175872,null));};exports[_0xbb10('0x62')]=function(_0x1d40b8,_0x5d942d,_0x93f3c4){var _0x4bc316={};var _0x4fe3b5={};var _0x519a54;var _0xdf634f;return db[_0xbb10('0x2e')][_0xbb10('0x57')]({'where':{'id':_0x1d40b8[_0xbb10('0x54')]['id']}})['then'](handleEntityNotFound(_0x5d942d,null))[_0xbb10('0x27')](function(_0x5c583b){if(_0x5c583b){_0x519a54=_0x5c583b;_0x4fe3b5['model']=_[_0xbb10('0x2f')](db[_0xbb10('0x63')][_0xbb10('0x48')]);_0x4fe3b5[_0xbb10('0x30')]=_[_0xbb10('0x2f')](_0x1d40b8['query']);_0x4fe3b5[_0xbb10('0x31')]=_[_0xbb10('0x32')](_0x4fe3b5[_0xbb10('0x33')],_0x4fe3b5[_0xbb10('0x30')]);_0x4bc316[_0xbb10('0x34')]=_[_0xbb10('0x32')](_0x4fe3b5[_0xbb10('0x33')],qs['fields'](_0x1d40b8[_0xbb10('0x30')][_0xbb10('0x35')]));_0x4bc316[_0xbb10('0x34')]=_0x4bc316[_0xbb10('0x34')][_0xbb10('0x36')]?_0x4bc316[_0xbb10('0x34')]:_0x4fe3b5[_0xbb10('0x33')];_0x4bc316[_0xbb10('0x39')]=qs['sort'](_0x1d40b8[_0xbb10('0x30')][_0xbb10('0x3a')]);_0x4bc316[_0xbb10('0x3b')]=qs['filters'](_['pick'](_0x1d40b8['query'],_0x4fe3b5[_0xbb10('0x31')]));if(_0x1d40b8['query']['filter']){_0x4bc316[_0xbb10('0x3b')]=_[_0xbb10('0x3d')](_0x4bc316[_0xbb10('0x3b')],{'$or':_[_0xbb10('0x5a')](_0x4bc316[_0xbb10('0x34')],function(_0x24dca6){var _0x33116={};_0x33116[_0x24dca6]={'$like':'%'+_0x1d40b8[_0xbb10('0x30')][_0xbb10('0x41')]+'%'};return _0x33116;})});}_0x4bc316=_['merge']({},_0x4bc316,_0x1d40b8[_0xbb10('0x42')]);return _0x519a54[_0xbb10('0x62')](_0x4bc316);}})[_0xbb10('0x27')](function(_0x35b811){if(_0x35b811){_0xdf634f=_0x35b811['length'];if(!_0x1d40b8['query'][_0xbb10('0x58')](_0xbb10('0x37'))){_0x4bc316[_0xbb10('0x38')]=qs[_0xbb10('0x38')](_0x1d40b8['query'][_0xbb10('0x38')]);_0x4bc316[_0xbb10('0x21')]=qs[_0xbb10('0x21')](_0x1d40b8[_0xbb10('0x30')][_0xbb10('0x21')]);}return _0x519a54['getTeams'](_0x4bc316);}})['then'](function(_0x372636){if(_0x372636){return _0x372636?{'count':_0xdf634f,'rows':_0x372636}:null;}})[_0xbb10('0x27')](respondWithResult(_0x5d942d,null))[_0xbb10('0x46')](handleError(_0x5d942d,null));};exports['addTeams']=function(_0x256b35,_0x13e2ab,_0x50bcc9){var _0x5caa06=[];var _0x2f667f;return db[_0xbb10('0x63')][_0xbb10('0x44')]({'where':{'id':_0x256b35['body'][_0xbb10('0x64')]},'attributes':['id'],'include':[{'model':db[_0xbb10('0x65')],'as':_0xbb10('0x66'),'attributes':['id'],'raw':!![]}]})[_0xbb10('0x27')](function(_0x2ef96f){if(_0x2ef96f){for(var _0x5de006=0x0;_0x5de006<_0x2ef96f[_0xbb10('0x36')];_0x5de006+=0x1){for(var _0x226363=0x0;_0x226363<_0x2ef96f[_0x5de006][_0xbb10('0x66')]['length'];_0x226363+=0x1){_0x5caa06=_[_0xbb10('0x67')](_0x5caa06,[_0x2ef96f[_0x5de006][_0xbb10('0x66')][_0x226363]['id']]);}}return _0x5caa06;}})[_0xbb10('0x27')](function(_0xdb7d3e){if(_0xdb7d3e){return db[_0xbb10('0x2e')][_0xbb10('0x4a')]({'where':{'id':_0x256b35[_0xbb10('0x54')]['id']}});}})[_0xbb10('0x27')](function(_0x17ed20){if(_0x17ed20){_0x2f667f=_0x17ed20;return _0x2f667f[_0xbb10('0x68')](_0x5caa06,{'penalty':_0x256b35[_0xbb10('0x53')][_0xbb10('0x69')]});}})['then'](function(_0x51f106){if(_0x51f106){return _0x2f667f[_0xbb10('0x6a')](_0x256b35[_0xbb10('0x53')][_0xbb10('0x64')]);}})[_0xbb10('0x27')](handleEntityNotFound(_0x13e2ab,null))[_0xbb10('0x27')](respondWithStatusCode(_0x13e2ab,null))['catch'](handleError(_0x13e2ab,null));};exports[_0xbb10('0x6b')]=function(_0x332fbe,_0x3b4d0b,_0x1a51d3){var _0x19694d=[];var _0x379d49;return db['Team'][_0xbb10('0x44')]({'where':{'id':_0x332fbe[_0xbb10('0x30')]['ids']},'attributes':['id'],'include':[{'model':db[_0xbb10('0x65')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbb10('0x27')](function(_0x28bd76){if(_0x28bd76){for(var _0x2b473c=0x0;_0x2b473c<_0x28bd76[_0xbb10('0x36')];_0x2b473c+=0x1){for(var _0x3a4a6e=0x0;_0x3a4a6e<_0x28bd76[_0x2b473c]['Agents'][_0xbb10('0x36')];_0x3a4a6e+=0x1){_0x19694d=_['union'](_0x19694d,[_0x28bd76[_0x2b473c][_0xbb10('0x66')][_0x3a4a6e]['id']]);}}return _0x19694d;}})[_0xbb10('0x27')](function(_0x5d767f){if(_0x5d767f){return db['OpenchannelQueue'][_0xbb10('0x4a')]({'where':{'id':_0x332fbe[_0xbb10('0x54')]['id']}});}})[_0xbb10('0x27')](function(_0x283bab){if(_0x283bab){_0x379d49=_0x283bab;return _0x379d49[_0xbb10('0x6c')](_0x19694d);}})[_0xbb10('0x27')](function(_0x1b6ebc){if(_0x379d49){return _0x379d49[_0xbb10('0x6b')](_0x332fbe[_0xbb10('0x30')][_0xbb10('0x64')]);}})[_0xbb10('0x27')](handleEntityNotFound(_0x3b4d0b,null))['then'](respondWithStatusCode(_0x3b4d0b,null))[_0xbb10('0x46')](handleError(_0x3b4d0b,null));};exports[_0xbb10('0x68')]=function(_0x1b0a6c,_0xcd5d35,_0xfe02f5){return db[_0xbb10('0x2e')][_0xbb10('0x4a')]({'where':{'id':_0x1b0a6c[_0xbb10('0x54')]['id']}})[_0xbb10('0x27')](handleEntityNotFound(_0xcd5d35,null))[_0xbb10('0x27')](function(_0x1c4235){if(_0x1c4235){return _0x1c4235[_0xbb10('0x68')](_0x1b0a6c['body'][_0xbb10('0x64')],_['omit'](_0x1b0a6c[_0xbb10('0x53')],[_0xbb10('0x64'),'id'])||{})[_0xbb10('0x6d')](function(_0x40236c){for(var _0x38d369=0x0;_0x38d369<_0x1b0a6c['body'][_0xbb10('0x64')][_0xbb10('0x36')];_0x38d369+=0x1){socket[_0xbb10('0x6e')](_0xbb10('0x6f'),{'UserId':_0x1b0a6c[_0xbb10('0x53')][_0xbb10('0x64')][_0x38d369],'OpenchannelQueueId':_0x1b0a6c['params']['id']});}return _0x40236c;});}})['then'](respondWithResult(_0xcd5d35,null))[_0xbb10('0x46')](handleError(_0xcd5d35,null));};exports[_0xbb10('0x6c')]=function(_0x41d4d0,_0x57d5a1,_0x124b32){var _0x3d6a91;return db['OpenchannelQueue'][_0xbb10('0x4a')]({'where':{'id':_0x41d4d0[_0xbb10('0x54')]['id']}})['then'](handleEntityNotFound(_0x57d5a1,null))[_0xbb10('0x27')](function(_0x4d7bca){if(_0x4d7bca){return _0x4d7bca[_0xbb10('0x6c')](_0x41d4d0[_0xbb10('0x30')]['ids'])[_0xbb10('0x27')](function(_0x28cc74){if(_['isArray'](_0x41d4d0['query'][_0xbb10('0x64')])){for(var _0x13ae83=0x0;_0x13ae83<_0x41d4d0[_0xbb10('0x30')][_0xbb10('0x64')][_0xbb10('0x36')];_0x13ae83+=0x1){socket['emit'](_0xbb10('0x70'),{'UserId':_0x41d4d0[_0xbb10('0x30')][_0xbb10('0x64')][_0x13ae83],'OpenchannelQueueId':_0x41d4d0['params']['id']});}}else{socket[_0xbb10('0x6e')](_0xbb10('0x70'),{'UserId':_0x41d4d0[_0xbb10('0x30')][_0xbb10('0x64')],'OpenchannelQueueId':_0x41d4d0[_0xbb10('0x54')]['id']});}});}})[_0xbb10('0x27')](respondWithStatusCode(_0x57d5a1,null))[_0xbb10('0x46')](handleError(_0x57d5a1,null));};exports[_0xbb10('0x71')]=function(_0x2010d4,_0x5f1fcd,_0x4fc544){var _0x37e40c={};var _0xe7238b={};var _0x293f3f;var _0x44f097;return db[_0xbb10('0x2e')][_0xbb10('0x57')]({'where':{'id':_0x2010d4[_0xbb10('0x54')]['id']}})[_0xbb10('0x27')](handleEntityNotFound(_0x5f1fcd,null))[_0xbb10('0x27')](function(_0x471827){if(_0x471827){_0x293f3f=_0x471827;_0xe7238b[_0xbb10('0x33')]=_[_0xbb10('0x2f')](db[_0xbb10('0x65')]['rawAttributes']);_0xe7238b[_0xbb10('0x30')]=_[_0xbb10('0x2f')](_0x2010d4[_0xbb10('0x30')]);_0xe7238b[_0xbb10('0x31')]=_[_0xbb10('0x32')](_0xe7238b[_0xbb10('0x33')],_0xe7238b[_0xbb10('0x30')]);_0x37e40c[_0xbb10('0x34')]=_[_0xbb10('0x32')](_0xe7238b[_0xbb10('0x33')],qs[_0xbb10('0x35')](_0x2010d4['query'][_0xbb10('0x35')]));_0x37e40c['attributes']=_0x37e40c[_0xbb10('0x34')][_0xbb10('0x36')]?_0x37e40c[_0xbb10('0x34')]:_0xe7238b[_0xbb10('0x33')];_0x37e40c[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_0x2010d4['query'][_0xbb10('0x3a')]);_0x37e40c['where']=qs[_0xbb10('0x31')](_[_0xbb10('0x3c')](_0x2010d4[_0xbb10('0x30')],_0xe7238b[_0xbb10('0x31')]));if(_0x2010d4[_0xbb10('0x30')][_0xbb10('0x41')]){_0x37e40c[_0xbb10('0x3b')]=_[_0xbb10('0x3d')](_0x37e40c[_0xbb10('0x3b')],{'$or':_[_0xbb10('0x5a')](_0x37e40c[_0xbb10('0x34')],function(_0xa09041){var _0x589565={};_0x589565[_0xa09041]={'$like':'%'+_0x2010d4[_0xbb10('0x30')]['filter']+'%'};return _0x589565;})});}_0x37e40c=_[_0xbb10('0x3d')]({},_0x37e40c,_0x2010d4[_0xbb10('0x42')]);return _0x293f3f[_0xbb10('0x71')](_0x37e40c);}})[_0xbb10('0x27')](function(_0x44c229){if(_0x44c229){_0x44f097=_0x44c229[_0xbb10('0x36')];if(!_0x2010d4[_0xbb10('0x30')]['hasOwnProperty'](_0xbb10('0x37'))){_0x37e40c['limit']=qs['limit'](_0x2010d4[_0xbb10('0x30')][_0xbb10('0x38')]);_0x37e40c[_0xbb10('0x21')]=qs[_0xbb10('0x21')](_0x2010d4[_0xbb10('0x30')][_0xbb10('0x21')]);}return _0x293f3f['getAgents'](_0x37e40c);}})[_0xbb10('0x27')](function(_0x2c25ab){if(_0x2c25ab){return _0x2c25ab?{'count':_0x44f097,'rows':_0x2c25ab}:null;}})[_0xbb10('0x27')](respondWithResult(_0x5f1fcd,null))[_0xbb10('0x46')](handleError(_0x5f1fcd,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index e6e7fdd..f58ece2 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 _0x8054=['exports','events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x205577,_0x380d20){var _0x89933=function(_0x3ceaf6){while(--_0x3ceaf6){_0x205577['push'](_0x205577['shift']());}};_0x89933(++_0x380d20);}(_0x8054,0x174));var _0x4805=function(_0x428211,_0x19ad16){_0x428211=_0x428211-0x0;var _0x256367=_0x8054[_0x428211];return _0x256367;};'use strict';var EventEmitter=require(_0x4805('0x0'));var OpenchannelQueue=require(_0x4805('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x4805('0x2')](0x0);var events={'afterCreate':_0x4805('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x25f253){return function(_0x2a2a28,_0x5f1e10,_0x5cbc8a){OpenchannelQueueEvents[_0x4805('0x4')](_0x25f253+':'+_0x2a2a28['id'],_0x2a2a28);OpenchannelQueueEvents[_0x4805('0x4')](_0x25f253,_0x2a2a28);_0x5cbc8a(null);};}for(var e in events){if(events[_0x4805('0x5')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x4805('0x6')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x6ae6=['exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x1ebfe8,_0x195971){var _0x14bbbf=function(_0x4fe2cf){while(--_0x4fe2cf){_0x1ebfe8['push'](_0x1ebfe8['shift']());}};_0x14bbbf(++_0x195971);}(_0x6ae6,0xe9));var _0x66ae=function(_0x1db481,_0x1627b2){_0x1db481=_0x1db481-0x0;var _0x3db95b=_0x6ae6[_0x1db481];return _0x3db95b;};'use strict';var EventEmitter=require(_0x66ae('0x0'));var OpenchannelQueue=require(_0x66ae('0x1'))['db'][_0x66ae('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x66ae('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x66ae('0x4'),'afterDestroy':'remove'};function emitEvent(_0x31b89b){return function(_0x5d473c,_0x257601,_0x36964e){OpenchannelQueueEvents[_0x66ae('0x5')](_0x31b89b+':'+_0x5d473c['id'],_0x5d473c);OpenchannelQueueEvents['emit'](_0x31b89b,_0x5d473c);_0x36964e(null);};}for(var e in events){if(events[_0x66ae('0x6')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x66ae('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 5fbea97..c86fae1 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 _0xbb53=['exports','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./openchannelQueue.attributes'];(function(_0x2c5255,_0x4340c3){var _0x30d0ea=function(_0x131ba1){while(--_0x131ba1){_0x2c5255['push'](_0x2c5255['shift']());}};_0x30d0ea(++_0x4340c3);}(_0xbb53,0x121));var _0x3bb5=function(_0x58bb86,_0x3f6017){_0x58bb86=_0x58bb86-0x0;var _0x35f5c4=_0xbb53[_0x58bb86];return _0x35f5c4;};'use strict';var _=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var logger=require(_0x3bb5('0x2'))(_0x3bb5('0x3'));var moment=require(_0x3bb5('0x4'));var BPromise=require(_0x3bb5('0x5'));var rp=require(_0x3bb5('0x6'));var attributes=require(_0x3bb5('0x7'));module[_0x3bb5('0x8')]=function(_0x450d9e,_0x55fdaf){return _0x450d9e['define'](_0x3bb5('0x9'),attributes,{'tableName':_0x3bb5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2dae=['moment','bluebird','request-promise','exports','define','openchannel_queues','lodash','../../config/logger','api'];(function(_0x9efba0,_0x5ee329){var _0x515466=function(_0x477e0f){while(--_0x477e0f){_0x9efba0['push'](_0x9efba0['shift']());}};_0x515466(++_0x5ee329);}(_0x2dae,0xc3));var _0xe2da=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x2dae[_0x3de8a4];return _0x4635cf;};'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('./openchannelQueue.attributes');module[_0xe2da('0x6')]=function(_0x439b5d,_0x77e45e){return _0x439b5d[_0xe2da('0x7')]('OpenchannelQueue',attributes,{'tableName':_0xe2da('0x8'),'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 f65f99f..21712b9 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 _0xcab6=['then','OpenchannelQueue,\x20%s,\x20%s','debug','error','code','message','info','result','catch','GetOpenchannelQueue','options','raw','where','attributes','limit','include','map','model','stringify','OpenchannelQueue','find','ShowOpenchannelQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0xcab6,0xd4));var _0x6cab=function(_0x440141,_0x2a6fcc){_0x440141=_0x440141-0x0;var _0x2158ef=_0xcab6[_0x440141];return _0x2158ef;};'use strict';var _=require(_0x6cab('0x0'));var util=require('util');var moment=require(_0x6cab('0x1'));var BPromise=require(_0x6cab('0x2'));var rs=require(_0x6cab('0x3'));var fs=require('fs');var Redis=require(_0x6cab('0x4'));var db=require(_0x6cab('0x5'))['db'];var utils=require(_0x6cab('0x6'));var logger=require('../../config/logger')(_0x6cab('0x7'));var config=require('../../config/environment');var jayson=require(_0x6cab('0x8'));var client=jayson[_0x6cab('0x9')][_0x6cab('0xa')]({'port':0x232a});config['redis']=_[_0x6cab('0xb')](config[_0x6cab('0xc')],{'host':_0x6cab('0xd'),'port':0x18eb});var socket=require(_0x6cab('0xe'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x6cab('0xf')](socket);function respondWithRpcPromise(_0x37f00d,_0x2aa304,_0x3ff1c6){return new BPromise(function(_0x161b9c,_0xe1e146){return client['request'](_0x37f00d,_0x3ff1c6)[_0x6cab('0x10')](function(_0x52acfe){logger['info'](_0x6cab('0x11'),_0x2aa304,'request\x20sent');logger[_0x6cab('0x12')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x2aa304,'request\x20sent',JSON['stringify'](_0x52acfe));if(_0x52acfe['error']){if(_0x52acfe[_0x6cab('0x13')][_0x6cab('0x14')]===0x1f4){logger[_0x6cab('0x13')](_0x6cab('0x11'),_0x2aa304,_0x52acfe[_0x6cab('0x13')][_0x6cab('0x15')]);return _0xe1e146(_0x52acfe[_0x6cab('0x13')][_0x6cab('0x15')]);}logger[_0x6cab('0x13')](_0x6cab('0x11'),_0x2aa304,_0x52acfe[_0x6cab('0x13')][_0x6cab('0x15')]);return _0x161b9c(_0x52acfe[_0x6cab('0x13')]['message']);}else{logger[_0x6cab('0x16')](_0x6cab('0x11'),_0x2aa304,'request\x20sent');_0x161b9c(_0x52acfe[_0x6cab('0x17')][_0x6cab('0x15')]);}})[_0x6cab('0x18')](function(_0x12f120){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x2aa304,_0x12f120);_0xe1e146(_0x12f120);});});}exports[_0x6cab('0x19')]=function(_0x1320c3){var _0x1b5565=this;return new Promise(function(_0x2986e6,_0xa36dad){return db['OpenchannelQueue']['findAll']({'raw':_0x1320c3[_0x6cab('0x1a')]?_0x1320c3['options'][_0x6cab('0x1b')]===undefined?!![]:![]:!![],'where':_0x1320c3[_0x6cab('0x1a')]?_0x1320c3[_0x6cab('0x1a')][_0x6cab('0x1c')]||null:null,'attributes':_0x1320c3[_0x6cab('0x1a')]?_0x1320c3[_0x6cab('0x1a')][_0x6cab('0x1d')]||null:null,'limit':_0x1320c3[_0x6cab('0x1a')]?_0x1320c3[_0x6cab('0x1a')][_0x6cab('0x1e')]||null:null,'include':_0x1320c3[_0x6cab('0x1a')]?_0x1320c3[_0x6cab('0x1a')][_0x6cab('0x1f')]?_['map'](_0x1320c3['options']['include'],function(_0x4b0194){return{'model':db[_0x4b0194['model']],'as':_0x4b0194['as'],'attributes':_0x4b0194[_0x6cab('0x1d')],'include':_0x4b0194[_0x6cab('0x1f')]?_[_0x6cab('0x20')](_0x4b0194['include'],function(_0x2ae4e7){return{'model':db[_0x2ae4e7[_0x6cab('0x21')]],'as':_0x2ae4e7['as'],'attributes':_0x2ae4e7[_0x6cab('0x1d')],'include':_0x2ae4e7[_0x6cab('0x1f')]?_['map'](_0x2ae4e7[_0x6cab('0x1f')],function(_0x3c5de1){return{'model':db[_0x3c5de1['model']],'as':_0x3c5de1['as'],'attributes':_0x3c5de1[_0x6cab('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14e1de){logger['info']('GetOpenchannelQueue',_0x1320c3);logger[_0x6cab('0x12')]('GetOpenchannelQueue',_0x1320c3,JSON[_0x6cab('0x22')](_0x14e1de));_0x2986e6(_0x14e1de);})[_0x6cab('0x18')](function(_0x5c48cd){logger['error'](_0x6cab('0x19'),_0x5c48cd[_0x6cab('0x15')],_0x1320c3);_0xa36dad(_0x1b5565[_0x6cab('0x13')](0x1f4,_0x5c48cd['message']));});});};exports['ShowOpenchannelQueue']=function(_0x489a96){var _0x33a814=this;return new Promise(function(_0x679931,_0x35cd2e){return db[_0x6cab('0x23')][_0x6cab('0x24')]({'raw':_0x489a96[_0x6cab('0x1a')]?_0x489a96[_0x6cab('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x489a96['options']?_0x489a96['options'][_0x6cab('0x1c')]||null:null,'attributes':_0x489a96[_0x6cab('0x1a')]?_0x489a96[_0x6cab('0x1a')]['attributes']||null:null,'include':_0x489a96[_0x6cab('0x1a')]?_0x489a96[_0x6cab('0x1a')][_0x6cab('0x1f')]?_['map'](_0x489a96[_0x6cab('0x1a')][_0x6cab('0x1f')],function(_0x48b4ed){return{'model':db[_0x48b4ed['model']],'as':_0x48b4ed['as'],'attributes':_0x48b4ed[_0x6cab('0x1d')],'include':_0x48b4ed['include']?_['map'](_0x48b4ed['include'],function(_0x65e7b4){return{'model':db[_0x65e7b4[_0x6cab('0x21')]],'as':_0x65e7b4['as'],'attributes':_0x65e7b4['attributes'],'include':_0x65e7b4[_0x6cab('0x1f')]?_[_0x6cab('0x20')](_0x65e7b4[_0x6cab('0x1f')],function(_0x2cf925){return{'model':db[_0x2cf925[_0x6cab('0x21')]],'as':_0x2cf925['as'],'attributes':_0x2cf925[_0x6cab('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6cab('0x10')](function(_0x252ff9){logger[_0x6cab('0x16')](_0x6cab('0x25'),_0x489a96);logger['debug'](_0x6cab('0x25'),_0x489a96,JSON['stringify'](_0x252ff9));_0x679931(_0x252ff9);})[_0x6cab('0x18')](function(_0x5715ea){logger[_0x6cab('0x13')](_0x6cab('0x25'),_0x5715ea[_0x6cab('0x15')],_0x489a96);_0x35cd2e(_0x33a814['error'](0x1f4,_0x5715ea[_0x6cab('0x15')]));});});}; \ No newline at end of file +var _0xa631=['error','code','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','limit','include','attributes','map','model','stringify','ShowOpenchannelQueue','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','defaults','redis','localhost','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x333728,_0x18f80b){var _0x2dcb72=function(_0x1d95e4){while(--_0x1d95e4){_0x333728['push'](_0x333728['shift']());}};_0x2dcb72(++_0x18f80b);}(_0xa631,0xe4));var _0x1a63=function(_0x524d75,_0x133603){_0x524d75=_0x524d75-0x0;var _0xaf8e9c=_0xa631[_0x524d75];return _0xaf8e9c;};'use strict';var _=require('lodash');var util=require(_0x1a63('0x0'));var moment=require(_0x1a63('0x1'));var BPromise=require(_0x1a63('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a63('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1a63('0x4'))(_0x1a63('0x5'));var config=require(_0x1a63('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x1a63('0x7')](config[_0x1a63('0x8')],{'host':_0x1a63('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1a63('0xa'))[_0x1a63('0xb')](socket);function respondWithRpcPromise(_0x1e9e87,_0x334902,_0x38b2be){return new BPromise(function(_0x58dd88,_0x430c4f){return client[_0x1a63('0xc')](_0x1e9e87,_0x38b2be)[_0x1a63('0xd')](function(_0x121a94){logger['info'](_0x1a63('0xe'),_0x334902,_0x1a63('0xf'));logger[_0x1a63('0x10')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x334902,_0x1a63('0xf'),JSON['stringify'](_0x121a94));if(_0x121a94[_0x1a63('0x11')]){if(_0x121a94[_0x1a63('0x11')][_0x1a63('0x12')]===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x334902,_0x121a94[_0x1a63('0x11')][_0x1a63('0x13')]);return _0x430c4f(_0x121a94[_0x1a63('0x11')][_0x1a63('0x13')]);}logger[_0x1a63('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x334902,_0x121a94[_0x1a63('0x11')]['message']);return _0x58dd88(_0x121a94[_0x1a63('0x11')][_0x1a63('0x13')]);}else{logger[_0x1a63('0x14')](_0x1a63('0xe'),_0x334902,_0x1a63('0xf'));_0x58dd88(_0x121a94[_0x1a63('0x15')][_0x1a63('0x13')]);}})[_0x1a63('0x16')](function(_0x3feaa5){logger[_0x1a63('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x334902,_0x3feaa5);_0x430c4f(_0x3feaa5);});});}exports[_0x1a63('0x17')]=function(_0x27d502){var _0x5d9c00=this;return new Promise(function(_0x3d6668,_0x444406){return db[_0x1a63('0x18')][_0x1a63('0x19')]({'raw':_0x27d502[_0x1a63('0x1a')]?_0x27d502[_0x1a63('0x1a')][_0x1a63('0x1b')]===undefined?!![]:![]:!![],'where':_0x27d502['options']?_0x27d502[_0x1a63('0x1a')]['where']||null:null,'attributes':_0x27d502[_0x1a63('0x1a')]?_0x27d502[_0x1a63('0x1a')]['attributes']||null:null,'limit':_0x27d502['options']?_0x27d502[_0x1a63('0x1a')][_0x1a63('0x1c')]||null:null,'include':_0x27d502[_0x1a63('0x1a')]?_0x27d502[_0x1a63('0x1a')][_0x1a63('0x1d')]?_['map'](_0x27d502[_0x1a63('0x1a')][_0x1a63('0x1d')],function(_0x3b551f){return{'model':db[_0x3b551f['model']],'as':_0x3b551f['as'],'attributes':_0x3b551f[_0x1a63('0x1e')],'include':_0x3b551f[_0x1a63('0x1d')]?_[_0x1a63('0x1f')](_0x3b551f[_0x1a63('0x1d')],function(_0x53867d){return{'model':db[_0x53867d['model']],'as':_0x53867d['as'],'attributes':_0x53867d[_0x1a63('0x1e')],'include':_0x53867d[_0x1a63('0x1d')]?_[_0x1a63('0x1f')](_0x53867d[_0x1a63('0x1d')],function(_0xa125b3){return{'model':db[_0xa125b3[_0x1a63('0x20')]],'as':_0xa125b3['as'],'attributes':_0xa125b3['attributes']};}):[]};}):[]};}):[]:[]})[_0x1a63('0xd')](function(_0x4a52f4){logger[_0x1a63('0x14')](_0x1a63('0x17'),_0x27d502);logger['debug'](_0x1a63('0x17'),_0x27d502,JSON[_0x1a63('0x21')](_0x4a52f4));_0x3d6668(_0x4a52f4);})[_0x1a63('0x16')](function(_0x46cd45){logger['error']('GetOpenchannelQueue',_0x46cd45[_0x1a63('0x13')],_0x27d502);_0x444406(_0x5d9c00[_0x1a63('0x11')](0x1f4,_0x46cd45['message']));});});};exports[_0x1a63('0x22')]=function(_0x214e62){var _0x3e7d46=this;return new Promise(function(_0x216def,_0x15bbbf){return db[_0x1a63('0x18')]['find']({'raw':_0x214e62[_0x1a63('0x1a')]?_0x214e62[_0x1a63('0x1a')][_0x1a63('0x1b')]===undefined?!![]:![]:!![],'where':_0x214e62[_0x1a63('0x1a')]?_0x214e62['options']['where']||null:null,'attributes':_0x214e62[_0x1a63('0x1a')]?_0x214e62['options'][_0x1a63('0x1e')]||null:null,'include':_0x214e62['options']?_0x214e62[_0x1a63('0x1a')][_0x1a63('0x1d')]?_['map'](_0x214e62[_0x1a63('0x1a')][_0x1a63('0x1d')],function(_0x20b129){return{'model':db[_0x20b129[_0x1a63('0x20')]],'as':_0x20b129['as'],'attributes':_0x20b129['attributes'],'include':_0x20b129[_0x1a63('0x1d')]?_[_0x1a63('0x1f')](_0x20b129[_0x1a63('0x1d')],function(_0x2476df){return{'model':db[_0x2476df[_0x1a63('0x20')]],'as':_0x2476df['as'],'attributes':_0x2476df[_0x1a63('0x1e')],'include':_0x2476df['include']?_['map'](_0x2476df[_0x1a63('0x1d')],function(_0x1bde2d){return{'model':db[_0x1bde2d[_0x1a63('0x20')]],'as':_0x1bde2d['as'],'attributes':_0x1bde2d[_0x1a63('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1a63('0xd')](function(_0x434bbb){logger['info'](_0x1a63('0x22'),_0x214e62);logger['debug']('ShowOpenchannelQueue',_0x214e62,JSON['stringify'](_0x434bbb));_0x216def(_0x434bbb);})['catch'](function(_0x35c5ed){logger['error'](_0x1a63('0x22'),_0x35c5ed['message'],_0x214e62);_0x15bbbf(_0x3e7d46[_0x1a63('0x11')](0x1f4,_0x35c5ed['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index d67c042..81d202b 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 6889104..feb71d3 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 _0xb10b=['../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x1dcf37,_0x150062){var _0x4323ea=function(_0x1743e3){while(--_0x1743e3){_0x1dcf37['push'](_0x1dcf37['shift']());}};_0x4323ea(++_0x150062);}(_0xb10b,0x12a));var _0xbb10=function(_0x3a27fd,_0x5357ea){_0x3a27fd=_0x3a27fd-0x0;var _0x2e519=_0xb10b[_0x3a27fd];return _0x2e519;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0xe')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0xf')]);router['put']('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router[_0xbb10('0x11')]('/:id',auth[_0xbb10('0x9')](),controller['destroy']);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 7296210..5ead254 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 _0x56c8=['sequelize','exports','STRING','DATE','moment'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x56c8,0x121));var _0x856c=function(_0x52240a,_0x5195c2){_0x52240a=_0x52240a-0x0;var _0x201676=_0x56c8[_0x52240a];return _0x201676;};'use strict';var moment=require(_0x856c('0x0'));var Sequelize=require(_0x856c('0x1'));module[_0x856c('0x2')]={'uniqueid':{'type':Sequelize[_0x856c('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x856c('0x3')]},'joinAt':{'type':Sequelize[_0x856c('0x4')]},'leaveAt':{'type':Sequelize[_0x856c('0x4')]},'acceptAt':{'type':Sequelize[_0x856c('0x4')]},'exitAt':{'type':Sequelize[_0x856c('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa68f=['exports','STRING','DATE','moment','sequelize'];(function(_0x5a3347,_0xca7ae6){var _0x5610d7=function(_0x42d554){while(--_0x42d554){_0x5a3347['push'](_0x5a3347['shift']());}};_0x5610d7(++_0xca7ae6);}(_0xa68f,0x1ed));var _0xfa68=function(_0xb74e88,_0x249423){_0xb74e88=_0xb74e88-0x0;var _0x26b0f8=_0xa68f[_0xb74e88];return _0x26b0f8;};'use strict';var moment=require(_0xfa68('0x0'));var Sequelize=require(_0xfa68('0x1'));module[_0xfa68('0x2')]={'uniqueid':{'type':Sequelize[_0xfa68('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xfa68('0x4')]},'leaveAt':{'type':Sequelize[_0xfa68('0x4')]},'acceptAt':{'type':Sequelize[_0xfa68('0x4')]},'exitAt':{'type':Sequelize[_0xfa68('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 96ec6e4..648cc63 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 _0x6bee=['catch','show','params','options','create','body','update','find','describe','html-pdf','rimraf','moment','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','name','send','index','OpenchannelQueueReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','map','type','VIRTUAL','field','merge','includeAll','findAll','rows'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6bee,0x167));var _0xe6be=function(_0x12b2a7,_0x1883e6){_0x12b2a7=_0x12b2a7-0x0;var _0x2e0f92=_0x6bee[_0x12b2a7];return _0x2e0f92;};'use strict';var pdf=require(_0xe6be('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe6be('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe6be('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe6be('0x3'));var util=require(_0xe6be('0x4'));var path=require(_0xe6be('0x5'));var sox=require('sox');var csv=require(_0xe6be('0x6'));var ejs=require(_0xe6be('0x7'));var fs=require('fs');var _=require(_0xe6be('0x8'));var squel=require(_0xe6be('0x9'));var crypto=require('crypto');var jsforce=require(_0xe6be('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xe6be('0x6'));var querystring=require(_0xe6be('0xb'));var Papa=require('papaparse');var authService=require(_0xe6be('0xc'));var hardwareService=require(_0xe6be('0xd'));var Redis=require(_0xe6be('0xe'));var qs=require(_0xe6be('0xf'));var logger=require('../../config/logger')(_0xe6be('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xe6be('0x11'))['db'];function respondWithStatusCode(_0x55ae67,_0x1b2c8f){_0x1b2c8f=_0x1b2c8f||0xcc;return function(_0x204be6){if(_0x204be6){return _0x55ae67[_0xe6be('0x12')](_0x1b2c8f);}return _0x55ae67[_0xe6be('0x13')](_0x1b2c8f)[_0xe6be('0x14')]();};}function respondWithResult(_0xb6de77,_0x3a1733){_0x3a1733=_0x3a1733||0xc8;return function(_0x4c63db){if(_0x4c63db){return _0xb6de77[_0xe6be('0x13')](_0x3a1733)[_0xe6be('0x15')](_0x4c63db);}};}function respondWithFilteredResult(_0x38d9f0,_0x2f41d2){return function(_0xef035d){if(_0xef035d){var _0x23811d=_0xef035d[_0xe6be('0x16')],_0x82469a=_0x2f41d2[_0xe6be('0x17')],_0x47f17a=_0x2f41d2[_0xe6be('0x17')]+_0x2f41d2['limit'],_0x31dd71;if(_0x47f17a>=_0x23811d){_0x47f17a=_0x23811d;_0x31dd71=0xc8;}else{_0x31dd71=0xce;}_0x38d9f0[_0xe6be('0x13')](_0x31dd71);return _0x38d9f0[_0xe6be('0x18')](_0xe6be('0x19'),_0x82469a+'-'+_0x47f17a+'/'+_0x23811d)[_0xe6be('0x15')](_0xef035d);}return null;};}function patchUpdates(_0x20a512){return function(_0x33c8a9){try{jsonpatch[_0xe6be('0x1a')](_0x33c8a9,_0x20a512,!![]);}catch(_0x5c8a72){return BPromise[_0xe6be('0x1b')](_0x5c8a72);}return _0x33c8a9[_0xe6be('0x1c')]();};}function saveUpdates(_0x3af6d9,_0xda72f9){return function(_0x39e9b4){if(_0x39e9b4){return _0x39e9b4['update'](_0x3af6d9)['then'](function(_0x1c1ed8){return _0x1c1ed8;});}return null;};}function removeEntity(_0x2c29d5,_0x3cc527){return function(_0x3419fd){if(_0x3419fd){return _0x3419fd[_0xe6be('0x1d')]()[_0xe6be('0x1e')](function(){_0x2c29d5[_0xe6be('0x13')](0xcc)[_0xe6be('0x14')]();});}};}function handleEntityNotFound(_0x1554eb,_0x79981a){return function(_0x25057a){if(!_0x25057a){_0x1554eb[_0xe6be('0x12')](0x194);}return _0x25057a;};}function handleError(_0x85314e,_0x8b99d6){_0x8b99d6=_0x8b99d6||0x1f4;return function(_0x13de68){logger[_0xe6be('0x1f')](_0x13de68['stack']);if(_0x13de68['name']){delete _0x13de68[_0xe6be('0x20')];}_0x85314e[_0xe6be('0x13')](_0x8b99d6)[_0xe6be('0x21')](_0x13de68);};}exports[_0xe6be('0x22')]=function(_0x55c305,_0x2ef285){var _0x5551b2={},_0x2d8d88={},_0x38f38e={'count':0x0,'rows':[]};var _0x46fbe5=db[_0xe6be('0x23')][_0xe6be('0x24')];_0x2d8d88[_0xe6be('0x25')]=_[_0xe6be('0x26')](_0x46fbe5);_0x2d8d88[_0xe6be('0x27')]=_[_0xe6be('0x26')](_0x55c305[_0xe6be('0x27')]);_0x2d8d88[_0xe6be('0x28')]=_[_0xe6be('0x29')](_0x2d8d88['model'],_0x2d8d88[_0xe6be('0x27')]);_0x5551b2[_0xe6be('0x2a')]=_[_0xe6be('0x29')](_0x2d8d88[_0xe6be('0x25')],qs[_0xe6be('0x2b')](_0x55c305[_0xe6be('0x27')]['fields']));_0x5551b2[_0xe6be('0x2a')]=_0x5551b2[_0xe6be('0x2a')][_0xe6be('0x2c')]?_0x5551b2['attributes']:_0x2d8d88[_0xe6be('0x25')];if(!_0x55c305[_0xe6be('0x27')][_0xe6be('0x2d')](_0xe6be('0x2e'))){_0x5551b2[_0xe6be('0x2f')]=qs[_0xe6be('0x2f')](_0x55c305[_0xe6be('0x27')]['limit']);_0x5551b2[_0xe6be('0x17')]=qs[_0xe6be('0x17')](_0x55c305['query'][_0xe6be('0x17')]);}_0x5551b2[_0xe6be('0x30')]=qs[_0xe6be('0x31')](_0x55c305['query']['sort']);_0x5551b2['where']=qs[_0xe6be('0x28')](_[_0xe6be('0x32')](_0x55c305[_0xe6be('0x27')],_0x2d8d88[_0xe6be('0x28')]));if(_0x55c305[_0xe6be('0x27')][_0xe6be('0x33')]){_0x5551b2[_0xe6be('0x34')]=_['merge'](_0x5551b2['where'],{'$or':_[_0xe6be('0x35')](_0x46fbe5,function(_0x30f67b){if(_0x30f67b[_0xe6be('0x36')]['key']!==_0xe6be('0x37')){var _0x2ede28={};_0x2ede28[_0x30f67b[_0xe6be('0x38')]]={'$like':'%'+_0x55c305['query']['filter']+'%'};return _0x2ede28;}})});}_0x5551b2=_[_0xe6be('0x39')]({},_0x5551b2,_0x55c305['options']);var _0x38c8e8={'where':_0x5551b2[_0xe6be('0x34')]};return db[_0xe6be('0x23')][_0xe6be('0x16')](_0x38c8e8)[_0xe6be('0x1e')](function(_0xce8045){_0x38f38e[_0xe6be('0x16')]=_0xce8045;if(_0x55c305['query'][_0xe6be('0x3a')]){_0x5551b2['include']=[{'all':!![]}];}return db[_0xe6be('0x23')][_0xe6be('0x3b')](_0x5551b2);})['then'](function(_0x24c23b){_0x38f38e[_0xe6be('0x3c')]=_0x24c23b;return _0x38f38e;})['then'](respondWithFilteredResult(_0x2ef285,_0x5551b2))[_0xe6be('0x3d')](handleError(_0x2ef285,null));};exports[_0xe6be('0x3e')]=function(_0x114e32,_0x2ea265){var _0x3c59dd={'raw':!![],'where':{'id':_0x114e32[_0xe6be('0x3f')]['id']}},_0x484b07={};_0x484b07['model']=_['keys'](db['OpenchannelQueueReport'][_0xe6be('0x24')]);_0x484b07[_0xe6be('0x27')]=_[_0xe6be('0x26')](_0x114e32[_0xe6be('0x27')]);_0x484b07['filters']=_[_0xe6be('0x29')](_0x484b07[_0xe6be('0x25')],_0x484b07[_0xe6be('0x27')]);_0x3c59dd[_0xe6be('0x2a')]=_['intersection'](_0x484b07[_0xe6be('0x25')],qs[_0xe6be('0x2b')](_0x114e32[_0xe6be('0x27')][_0xe6be('0x2b')]));_0x3c59dd[_0xe6be('0x2a')]=_0x3c59dd[_0xe6be('0x2a')]['length']?_0x3c59dd[_0xe6be('0x2a')]:_0x484b07[_0xe6be('0x25')];if(_0x114e32[_0xe6be('0x27')][_0xe6be('0x3a')]){_0x3c59dd['include']=[{'all':!![]}];}_0x3c59dd=_['merge']({},_0x3c59dd,_0x114e32[_0xe6be('0x40')]);return db[_0xe6be('0x23')]['find'](_0x3c59dd)[_0xe6be('0x1e')](handleEntityNotFound(_0x2ea265,null))['then'](respondWithResult(_0x2ea265,null))[_0xe6be('0x3d')](handleError(_0x2ea265,null));};exports[_0xe6be('0x41')]=function(_0x4ce5a8,_0x39f71d){return db['OpenchannelQueueReport'][_0xe6be('0x41')](_0x4ce5a8[_0xe6be('0x42')],{})[_0xe6be('0x1e')](respondWithResult(_0x39f71d,0xc9))[_0xe6be('0x3d')](handleError(_0x39f71d,null));};exports[_0xe6be('0x43')]=function(_0x1c7b76,_0x1ee7c4){if(_0x1c7b76[_0xe6be('0x42')]['id']){delete _0x1c7b76['body']['id'];}return db[_0xe6be('0x23')]['find']({'where':{'id':_0x1c7b76[_0xe6be('0x3f')]['id']}})[_0xe6be('0x1e')](handleEntityNotFound(_0x1ee7c4,null))[_0xe6be('0x1e')](saveUpdates(_0x1c7b76[_0xe6be('0x42')],null))[_0xe6be('0x1e')](respondWithResult(_0x1ee7c4,null))[_0xe6be('0x3d')](handleError(_0x1ee7c4,null));};exports['destroy']=function(_0x54bd84,_0x107f52){return db[_0xe6be('0x23')][_0xe6be('0x44')]({'where':{'id':_0x54bd84['params']['id']}})['then'](handleEntityNotFound(_0x107f52,null))[_0xe6be('0x1e')](removeEntity(_0x107f52,null))[_0xe6be('0x3d')](handleError(_0x107f52,null));};exports[_0xe6be('0x45')]=function(_0x2c6940,_0x9c1eb3){return db[_0xe6be('0x23')]['describe']()[_0xe6be('0x1e')](respondWithResult(_0x9c1eb3,null))[_0xe6be('0x3d')](handleError(_0x9c1eb3,null));}; \ No newline at end of file +var _0x5717=['../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','Content-Range','apply','save','then','error','stack','send','index','OpenchannelQueueReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','sort','pick','filter','where','merge','map','type','VIRTUAL','field','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','squel','crypto','querystring','papaparse'];(function(_0x1f6552,_0x25187d){var _0x177d09=function(_0x56bb1c){while(--_0x56bb1c){_0x1f6552['push'](_0x1f6552['shift']());}};_0x177d09(++_0x25187d);}(_0x5717,0x150));var _0x7571=function(_0x2d855d,_0x55df28){_0x2d855d=_0x2d855d-0x0;var _0x11f968=_0x5717[_0x2d855d];return _0x11f968;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7571('0x0'));var rimraf=require(_0x7571('0x1'));var zipdir=require(_0x7571('0x2'));var jsonpatch=require(_0x7571('0x3'));var rp=require(_0x7571('0x4'));var moment=require(_0x7571('0x5'));var BPromise=require(_0x7571('0x6'));var Mustache=require(_0x7571('0x7'));var util=require(_0x7571('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7571('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7571('0xa'));var crypto=require(_0x7571('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7571('0xc'));var Papa=require(_0x7571('0xd'));var authService=require(_0x7571('0xe'));var hardwareService=require(_0x7571('0xf'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x7571('0x10'))(_0x7571('0x11'));var utils=require(_0x7571('0x12'));var config=require(_0x7571('0x13'));var db=require(_0x7571('0x14'))['db'];function respondWithStatusCode(_0xb3d01a,_0x2f621f){_0x2f621f=_0x2f621f||0xcc;return function(_0x2f22b7){if(_0x2f22b7){return _0xb3d01a[_0x7571('0x15')](_0x2f621f);}return _0xb3d01a[_0x7571('0x16')](_0x2f621f)[_0x7571('0x17')]();};}function respondWithResult(_0x32156a,_0x4d6be8){_0x4d6be8=_0x4d6be8||0xc8;return function(_0x55c4e7){if(_0x55c4e7){return _0x32156a[_0x7571('0x16')](_0x4d6be8)[_0x7571('0x18')](_0x55c4e7);}};}function respondWithFilteredResult(_0x2042a9,_0x346b){return function(_0x530806){if(_0x530806){var _0x220bd8=_0x530806['count'],_0x1229e2=_0x346b[_0x7571('0x19')],_0x242350=_0x346b[_0x7571('0x19')]+_0x346b['limit'],_0x10f941;if(_0x242350>=_0x220bd8){_0x242350=_0x220bd8;_0x10f941=0xc8;}else{_0x10f941=0xce;}_0x2042a9['status'](_0x10f941);return _0x2042a9['set'](_0x7571('0x1a'),_0x1229e2+'-'+_0x242350+'/'+_0x220bd8)[_0x7571('0x18')](_0x530806);}return null;};}function patchUpdates(_0x150123){return function(_0x37579a){try{jsonpatch[_0x7571('0x1b')](_0x37579a,_0x150123,!![]);}catch(_0x4ea3fb){return BPromise['reject'](_0x4ea3fb);}return _0x37579a[_0x7571('0x1c')]();};}function saveUpdates(_0x18ae28,_0x5b11f1){return function(_0x59a11d){if(_0x59a11d){return _0x59a11d['update'](_0x18ae28)['then'](function(_0x392e65){return _0x392e65;});}return null;};}function removeEntity(_0x5d623f,_0x1b626f){return function(_0x3db5f2){if(_0x3db5f2){return _0x3db5f2['destroy']()[_0x7571('0x1d')](function(){_0x5d623f[_0x7571('0x16')](0xcc)[_0x7571('0x17')]();});}};}function handleEntityNotFound(_0x5670a1,_0x307f42){return function(_0x298c01){if(!_0x298c01){_0x5670a1[_0x7571('0x15')](0x194);}return _0x298c01;};}function handleError(_0xc5991,_0x546d99){_0x546d99=_0x546d99||0x1f4;return function(_0x50e1b){logger[_0x7571('0x1e')](_0x50e1b[_0x7571('0x1f')]);if(_0x50e1b['name']){delete _0x50e1b['name'];}_0xc5991['status'](_0x546d99)[_0x7571('0x20')](_0x50e1b);};}exports[_0x7571('0x21')]=function(_0x2412dd,_0x3dbff9){var _0x1f8123={},_0x55a2ad={},_0x5880ad={'count':0x0,'rows':[]};var _0x9b48b5=db[_0x7571('0x22')][_0x7571('0x23')];_0x55a2ad[_0x7571('0x24')]=_[_0x7571('0x25')](_0x9b48b5);_0x55a2ad[_0x7571('0x26')]=_[_0x7571('0x25')](_0x2412dd[_0x7571('0x26')]);_0x55a2ad[_0x7571('0x27')]=_[_0x7571('0x28')](_0x55a2ad['model'],_0x55a2ad['query']);_0x1f8123[_0x7571('0x29')]=_[_0x7571('0x28')](_0x55a2ad[_0x7571('0x24')],qs[_0x7571('0x2a')](_0x2412dd[_0x7571('0x26')][_0x7571('0x2a')]));_0x1f8123[_0x7571('0x29')]=_0x1f8123[_0x7571('0x29')][_0x7571('0x2b')]?_0x1f8123['attributes']:_0x55a2ad['model'];if(!_0x2412dd[_0x7571('0x26')]['hasOwnProperty'](_0x7571('0x2c'))){_0x1f8123['limit']=qs[_0x7571('0x2d')](_0x2412dd['query'][_0x7571('0x2d')]);_0x1f8123[_0x7571('0x19')]=qs['offset'](_0x2412dd[_0x7571('0x26')][_0x7571('0x19')]);}_0x1f8123['order']=qs[_0x7571('0x2e')](_0x2412dd[_0x7571('0x26')][_0x7571('0x2e')]);_0x1f8123['where']=qs[_0x7571('0x27')](_[_0x7571('0x2f')](_0x2412dd['query'],_0x55a2ad[_0x7571('0x27')]));if(_0x2412dd[_0x7571('0x26')][_0x7571('0x30')]){_0x1f8123[_0x7571('0x31')]=_[_0x7571('0x32')](_0x1f8123[_0x7571('0x31')],{'$or':_[_0x7571('0x33')](_0x9b48b5,function(_0x3b4306){if(_0x3b4306[_0x7571('0x34')]['key']!==_0x7571('0x35')){var _0x150b95={};_0x150b95[_0x3b4306[_0x7571('0x36')]]={'$like':'%'+_0x2412dd['query'][_0x7571('0x30')]+'%'};return _0x150b95;}})});}_0x1f8123=_[_0x7571('0x32')]({},_0x1f8123,_0x2412dd[_0x7571('0x37')]);var _0xae7122={'where':_0x1f8123[_0x7571('0x31')]};return db['OpenchannelQueueReport'][_0x7571('0x38')](_0xae7122)['then'](function(_0x1a2ba2){_0x5880ad['count']=_0x1a2ba2;if(_0x2412dd[_0x7571('0x26')][_0x7571('0x39')]){_0x1f8123[_0x7571('0x3a')]=[{'all':!![]}];}return db[_0x7571('0x22')][_0x7571('0x3b')](_0x1f8123);})['then'](function(_0x5d36b0){_0x5880ad[_0x7571('0x3c')]=_0x5d36b0;return _0x5880ad;})[_0x7571('0x1d')](respondWithFilteredResult(_0x3dbff9,_0x1f8123))[_0x7571('0x3d')](handleError(_0x3dbff9,null));};exports[_0x7571('0x3e')]=function(_0x298717,_0x265cde){var _0x375d6d={'raw':!![],'where':{'id':_0x298717[_0x7571('0x3f')]['id']}},_0x39fa96={};_0x39fa96[_0x7571('0x24')]=_[_0x7571('0x25')](db[_0x7571('0x22')][_0x7571('0x23')]);_0x39fa96['query']=_[_0x7571('0x25')](_0x298717[_0x7571('0x26')]);_0x39fa96[_0x7571('0x27')]=_[_0x7571('0x28')](_0x39fa96['model'],_0x39fa96[_0x7571('0x26')]);_0x375d6d[_0x7571('0x29')]=_[_0x7571('0x28')](_0x39fa96['model'],qs[_0x7571('0x2a')](_0x298717['query'][_0x7571('0x2a')]));_0x375d6d[_0x7571('0x29')]=_0x375d6d[_0x7571('0x29')][_0x7571('0x2b')]?_0x375d6d[_0x7571('0x29')]:_0x39fa96[_0x7571('0x24')];if(_0x298717[_0x7571('0x26')][_0x7571('0x39')]){_0x375d6d[_0x7571('0x3a')]=[{'all':!![]}];}_0x375d6d=_[_0x7571('0x32')]({},_0x375d6d,_0x298717[_0x7571('0x37')]);return db[_0x7571('0x22')][_0x7571('0x40')](_0x375d6d)[_0x7571('0x1d')](handleEntityNotFound(_0x265cde,null))['then'](respondWithResult(_0x265cde,null))[_0x7571('0x3d')](handleError(_0x265cde,null));};exports[_0x7571('0x41')]=function(_0x22566e,_0x2d543c){return db[_0x7571('0x22')][_0x7571('0x41')](_0x22566e['body'],{})['then'](respondWithResult(_0x2d543c,0xc9))[_0x7571('0x3d')](handleError(_0x2d543c,null));};exports[_0x7571('0x42')]=function(_0x17588f,_0x2ea7fe){if(_0x17588f[_0x7571('0x43')]['id']){delete _0x17588f[_0x7571('0x43')]['id'];}return db[_0x7571('0x22')][_0x7571('0x40')]({'where':{'id':_0x17588f[_0x7571('0x3f')]['id']}})[_0x7571('0x1d')](handleEntityNotFound(_0x2ea7fe,null))[_0x7571('0x1d')](saveUpdates(_0x17588f[_0x7571('0x43')],null))[_0x7571('0x1d')](respondWithResult(_0x2ea7fe,null))[_0x7571('0x3d')](handleError(_0x2ea7fe,null));};exports[_0x7571('0x44')]=function(_0x32a78f,_0x985c28){return db['OpenchannelQueueReport'][_0x7571('0x40')]({'where':{'id':_0x32a78f[_0x7571('0x3f')]['id']}})['then'](handleEntityNotFound(_0x985c28,null))[_0x7571('0x1d')](removeEntity(_0x985c28,null))[_0x7571('0x3d')](handleError(_0x985c28,null));};exports[_0x7571('0x45')]=function(_0x225a40,_0x5c728c){return db[_0x7571('0x22')][_0x7571('0x45')]()[_0x7571('0x1d')](respondWithResult(_0x5c728c,null))[_0x7571('0x3d')](handleError(_0x5c728c,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index f104164..9bf0a31 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 _0xf50b=['report_openchannel_queue','uniqueid','lodash','util','api','moment','bluebird','request-promise','exports','define','OpenchannelQueueReport'];(function(_0x177fdc,_0x408b6d){var _0x50d8ee=function(_0x20705d){while(--_0x20705d){_0x177fdc['push'](_0x177fdc['shift']());}};_0x50d8ee(++_0x408b6d);}(_0xf50b,0xc8));var _0xbf50=function(_0x33ca7b,_0x3a8a94){_0x33ca7b=_0x33ca7b-0x0;var _0x49983d=_0xf50b[_0x33ca7b];return _0x49983d;};'use strict';var _=require(_0xbf50('0x0'));var util=require(_0xbf50('0x1'));var logger=require('../../config/logger')(_0xbf50('0x2'));var moment=require(_0xbf50('0x3'));var BPromise=require(_0xbf50('0x4'));var rp=require(_0xbf50('0x5'));var attributes=require('./openchannelQueueReport.attributes');module[_0xbf50('0x6')]=function(_0x4f5ba8,_0x36e4d6){return _0x4f5ba8[_0xbf50('0x7')](_0xbf50('0x8'),attributes,{'tableName':_0xbf50('0x9'),'paranoid':![],'indexes':[{'name':_0xbf50('0xa'),'fields':[_0xbf50('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaa7c=['OpenchannelQueueReport','uniqueid','lodash','bluebird','request-promise','exports','define'];(function(_0x1b0307,_0x4336b1){var _0x5c8d34=function(_0x5b1b61){while(--_0x5b1b61){_0x1b0307['push'](_0x1b0307['shift']());}};_0x5c8d34(++_0x4336b1);}(_0xaa7c,0x1ec));var _0xcaa7=function(_0x283ca0,_0x750a05){_0x283ca0=_0x283ca0-0x0;var _0x4cdf9b=_0xaa7c[_0x283ca0];return _0x4cdf9b;};'use strict';var _=require(_0xcaa7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xcaa7('0x1'));var rp=require(_0xcaa7('0x2'));var attributes=require('./openchannelQueueReport.attributes');module[_0xcaa7('0x3')]=function(_0xc85ba0,_0x3e1543){return _0xc85ba0[_0xcaa7('0x4')](_0xcaa7('0x5'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xcaa7('0x6'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index d69dd82..76d3ab8 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 _0x0a56=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','body','options','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','raw','where','attributes','lodash','moment'];(function(_0x34e4a0,_0x1fd446){var _0x3ead3e=function(_0x47adec){while(--_0x47adec){_0x34e4a0['push'](_0x34e4a0['shift']());}};_0x3ead3e(++_0x1fd446);}(_0x0a56,0x15e));var _0x60a5=function(_0xfb058a,_0x3b57d3){_0xfb058a=_0xfb058a-0x0;var _0x2baf4e=_0x0a56[_0xfb058a];return _0x2baf4e;};'use strict';var _=require(_0x60a5('0x0'));var util=require('util');var moment=require(_0x60a5('0x1'));var BPromise=require('bluebird');var rs=require(_0x60a5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60a5('0x3'))['db'];var utils=require(_0x60a5('0x4'));var logger=require(_0x60a5('0x5'))(_0x60a5('0x6'));var config=require('../../config/environment');var jayson=require(_0x60a5('0x7'));var client=jayson[_0x60a5('0x8')][_0x60a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c1363,_0x38951c,_0x4c6ef4){return new BPromise(function(_0xf95077,_0x4f869a){return client[_0x60a5('0xa')](_0x5c1363,_0x4c6ef4)[_0x60a5('0xb')](function(_0x25bbbf){logger[_0x60a5('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x38951c,_0x60a5('0xd'));logger[_0x60a5('0xe')](_0x60a5('0xf'),_0x38951c,_0x60a5('0xd'),JSON[_0x60a5('0x10')](_0x25bbbf));if(_0x25bbbf[_0x60a5('0x11')]){if(_0x25bbbf[_0x60a5('0x11')][_0x60a5('0x12')]===0x1f4){logger['error'](_0x60a5('0x13'),_0x38951c,_0x25bbbf[_0x60a5('0x11')][_0x60a5('0x14')]);return _0x4f869a(_0x25bbbf[_0x60a5('0x11')][_0x60a5('0x14')]);}logger[_0x60a5('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x38951c,_0x25bbbf['error']['message']);return _0xf95077(_0x25bbbf[_0x60a5('0x11')][_0x60a5('0x14')]);}else{logger[_0x60a5('0xc')](_0x60a5('0x13'),_0x38951c,'request\x20sent');_0xf95077(_0x25bbbf[_0x60a5('0x15')]['message']);}})[_0x60a5('0x16')](function(_0x3df8f4){logger[_0x60a5('0x11')](_0x60a5('0x13'),_0x38951c,_0x3df8f4);_0x4f869a(_0x3df8f4);});});}exports[_0x60a5('0x17')]=function(_0x483f02){var _0x405a63=this;return new Promise(function(_0x401f96,_0x278df5){return db['OpenchannelQueueReport']['create'](_0x483f02[_0x60a5('0x18')],{'raw':_0x483f02[_0x60a5('0x19')]?_0x483f02[_0x60a5('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x298d2b){logger[_0x60a5('0xc')](_0x60a5('0x17'),_0x483f02);logger[_0x60a5('0xe')](_0x60a5('0x17'),_0x483f02,JSON['stringify'](_0x298d2b));_0x401f96(_0x298d2b);})[_0x60a5('0x16')](function(_0x4d8dd7){logger[_0x60a5('0x11')](_0x60a5('0x17'),_0x4d8dd7[_0x60a5('0x14')],_0x483f02);_0x278df5(_0x405a63['error'](0x1f4,_0x4d8dd7[_0x60a5('0x14')]));});});};exports[_0x60a5('0x1a')]=function(_0x3ebc67){var _0x2d7202=this;return new Promise(function(_0x174d5d,_0x27e427){return db[_0x60a5('0x1b')][_0x60a5('0x1c')](_0x3ebc67[_0x60a5('0x18')],{'raw':_0x3ebc67[_0x60a5('0x19')]?_0x3ebc67['options'][_0x60a5('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ebc67[_0x60a5('0x19')]?_0x3ebc67[_0x60a5('0x19')][_0x60a5('0x1e')]||null:null,'attributes':_0x3ebc67[_0x60a5('0x19')]?_0x3ebc67[_0x60a5('0x19')][_0x60a5('0x1f')]||null:null,'limit':_0x3ebc67['options']?_0x3ebc67[_0x60a5('0x19')]['limit']||null:null})[_0x60a5('0xb')](function(_0x440e90){logger['info'](_0x60a5('0x1a'),_0x3ebc67);logger[_0x60a5('0xe')](_0x60a5('0x1a'),_0x3ebc67,JSON[_0x60a5('0x10')](_0x440e90));_0x174d5d(_0x440e90);})[_0x60a5('0x16')](function(_0x4b91e3){logger[_0x60a5('0x11')](_0x60a5('0x1a'),_0x4b91e3[_0x60a5('0x14')],_0x3ebc67);_0x27e427(_0x2d7202['error'](0x1f4,_0x4b91e3['message']));});});}; \ No newline at end of file +var _0x9a5c=['result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','UpdateOpenchannelQueueReport','update','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x2de8bf,_0x2c1d61){var _0xaba10c=function(_0x368e4f){while(--_0x368e4f){_0x2de8bf['push'](_0x2de8bf['shift']());}};_0xaba10c(++_0x2c1d61);}(_0x9a5c,0xab));var _0xc9a5=function(_0x2d1ac5,_0xaaa9c0){_0x2d1ac5=_0x2d1ac5-0x0;var _0x2f3e8c=_0x9a5c[_0x2d1ac5];return _0x2f3e8c;};'use strict';var _=require(_0xc9a5('0x0'));var util=require('util');var moment=require(_0xc9a5('0x1'));var BPromise=require('bluebird');var rs=require(_0xc9a5('0x2'));var fs=require('fs');var Redis=require(_0xc9a5('0x3'));var db=require(_0xc9a5('0x4'))['db'];var utils=require(_0xc9a5('0x5'));var logger=require(_0xc9a5('0x6'))('rpc');var config=require(_0xc9a5('0x7'));var jayson=require(_0xc9a5('0x8'));var client=jayson[_0xc9a5('0x9')][_0xc9a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c27c2,_0x47b44f,_0x1eb326){return new BPromise(function(_0x1a899a,_0x4e3971){return client[_0xc9a5('0xb')](_0x5c27c2,_0x1eb326)[_0xc9a5('0xc')](function(_0xa9b15b){logger[_0xc9a5('0xd')](_0xc9a5('0xe'),_0x47b44f,_0xc9a5('0xf'));logger[_0xc9a5('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x47b44f,_0xc9a5('0xf'),JSON[_0xc9a5('0x11')](_0xa9b15b));if(_0xa9b15b[_0xc9a5('0x12')]){if(_0xa9b15b[_0xc9a5('0x12')][_0xc9a5('0x13')]===0x1f4){logger[_0xc9a5('0x12')](_0xc9a5('0xe'),_0x47b44f,_0xa9b15b[_0xc9a5('0x12')][_0xc9a5('0x14')]);return _0x4e3971(_0xa9b15b['error'][_0xc9a5('0x14')]);}logger[_0xc9a5('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x47b44f,_0xa9b15b[_0xc9a5('0x12')]['message']);return _0x1a899a(_0xa9b15b['error']['message']);}else{logger[_0xc9a5('0xd')](_0xc9a5('0xe'),_0x47b44f,_0xc9a5('0xf'));_0x1a899a(_0xa9b15b[_0xc9a5('0x15')][_0xc9a5('0x14')]);}})[_0xc9a5('0x16')](function(_0x179685){logger[_0xc9a5('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x47b44f,_0x179685);_0x4e3971(_0x179685);});});}exports[_0xc9a5('0x17')]=function(_0x39628e){var _0x1de7e2=this;return new Promise(function(_0x597c66,_0xac411b){return db[_0xc9a5('0x18')][_0xc9a5('0x19')](_0x39628e['body'],{'raw':_0x39628e[_0xc9a5('0x1a')]?_0x39628e[_0xc9a5('0x1a')][_0xc9a5('0x1b')]===undefined?!![]:![]:!![]})[_0xc9a5('0xc')](function(_0x12c84b){logger[_0xc9a5('0xd')]('CreateOpenchannelQueueReport',_0x39628e);logger[_0xc9a5('0x10')]('CreateOpenchannelQueueReport',_0x39628e,JSON[_0xc9a5('0x11')](_0x12c84b));_0x597c66(_0x12c84b);})['catch'](function(_0x337b77){logger['error'](_0xc9a5('0x17'),_0x337b77['message'],_0x39628e);_0xac411b(_0x1de7e2[_0xc9a5('0x12')](0x1f4,_0x337b77[_0xc9a5('0x14')]));});});};exports[_0xc9a5('0x1c')]=function(_0x25220c){var _0x2ea66d=this;return new Promise(function(_0x5a43c4,_0x5ced26){return db['OpenchannelQueueReport'][_0xc9a5('0x1d')](_0x25220c['body'],{'raw':_0x25220c['options']?_0x25220c[_0xc9a5('0x1a')][_0xc9a5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25220c['options']?_0x25220c[_0xc9a5('0x1a')]['where']||null:null,'attributes':_0x25220c[_0xc9a5('0x1a')]?_0x25220c[_0xc9a5('0x1a')][_0xc9a5('0x1e')]||null:null,'limit':_0x25220c[_0xc9a5('0x1a')]?_0x25220c[_0xc9a5('0x1a')][_0xc9a5('0x1f')]||null:null})[_0xc9a5('0xc')](function(_0x3e3ac6){logger[_0xc9a5('0xd')](_0xc9a5('0x1c'),_0x25220c);logger[_0xc9a5('0x10')]('UpdateOpenchannelQueueReport',_0x25220c,JSON[_0xc9a5('0x11')](_0x3e3ac6));_0x5a43c4(_0x3e3ac6);})['catch'](function(_0x589540){logger['error'](_0xc9a5('0x1c'),_0x589540[_0xc9a5('0x14')],_0x25220c);_0x5ced26(_0x2ea66d[_0xc9a5('0x12')](0x1f4,_0x589540[_0xc9a5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 43f00ee..0caa212 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 _0xa0fb=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x17c565,_0x3f7ff0){var _0x48bb52=function(_0x4f66d3){while(--_0x4f66d3){_0x17c565['push'](_0x17c565['shift']());}};_0x48bb52(++_0x3f7ff0);}(_0xa0fb,0x1e3));var _0xba0f=function(_0xabb80d,_0x1998c0){_0xabb80d=_0xabb80d-0x0;var _0x2cb7ba=_0xa0fb[_0xabb80d];return _0x2cb7ba;};'use strict';var multer=require(_0xba0f('0x0'));var util=require(_0xba0f('0x1'));var path=require(_0xba0f('0x2'));var timeout=require(_0xba0f('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xba0f('0x4'));var interaction=require(_0xba0f('0x5'));var config=require(_0xba0f('0x6'));var controller=require(_0xba0f('0x7'));router['get']('/',auth[_0xba0f('0x8')](),controller[_0xba0f('0x9')]);router[_0xba0f('0xa')]('/describe',auth[_0xba0f('0x8')](),controller[_0xba0f('0xb')]);router[_0xba0f('0xa')](_0xba0f('0xc'),auth[_0xba0f('0x8')](),controller[_0xba0f('0xd')]);router[_0xba0f('0xe')]('/',auth[_0xba0f('0x8')](),controller[_0xba0f('0xf')]);router[_0xba0f('0x10')]('/:id',auth[_0xba0f('0x8')](),controller[_0xba0f('0x11')]);router[_0xba0f('0x12')]('/:id',auth[_0xba0f('0x8')](),controller[_0xba0f('0x13')]);module[_0xba0f('0x14')]=router; \ No newline at end of file +var _0xa120=['put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./openchannelTransferReport.controller','get','isAuthenticated','index','show','post','create'];(function(_0x18931c,_0x27b7fb){var _0x1f3d49=function(_0x3b9c93){while(--_0x3b9c93){_0x18931c['push'](_0x18931c['shift']());}};_0x1f3d49(++_0x27b7fb);}(_0xa120,0x64));var _0x0a12=function(_0x4f59ee,_0x340175){_0x4f59ee=_0x4f59ee-0x0;var _0x3a2ef0=_0xa120[_0x4f59ee];return _0x3a2ef0;};'use strict';var multer=require(_0x0a12('0x0'));var util=require(_0x0a12('0x1'));var path=require(_0x0a12('0x2'));var timeout=require(_0x0a12('0x3'));var express=require(_0x0a12('0x4'));var router=express[_0x0a12('0x5')]();var auth=require(_0x0a12('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0a12('0x7'));router[_0x0a12('0x8')]('/',auth[_0x0a12('0x9')](),controller[_0x0a12('0xa')]);router[_0x0a12('0x8')]('/describe',auth[_0x0a12('0x9')](),controller['describe']);router[_0x0a12('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a12('0xb')]);router[_0x0a12('0xc')]('/',auth[_0x0a12('0x9')](),controller[_0x0a12('0xd')]);router[_0x0a12('0xe')](_0x0a12('0xf'),auth[_0x0a12('0x9')](),controller[_0x0a12('0x10')]);router[_0x0a12('0x11')](_0x0a12('0xf'),auth[_0x0a12('0x9')](),controller[_0x0a12('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 7444a51..03c71dd 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 _0x9819=['moment','sequelize','exports','STRING','ENUM','account','agent','queue','DATE','NOW'];(function(_0x359955,_0x5089e8){var _0xe5175f=function(_0xab88ec){while(--_0xab88ec){_0x359955['push'](_0x359955['shift']());}};_0xe5175f(++_0x5089e8);}(_0x9819,0x154));var _0x9981=function(_0x2cd753,_0x1cec45){_0x2cd753=_0x2cd753-0x0;var _0x3f80ab=_0x9819[_0x2cd753];return _0x3f80ab;};'use strict';var moment=require(_0x9981('0x0'));var Sequelize=require(_0x9981('0x1'));module[_0x9981('0x2')]={'uniqueid':{'type':Sequelize[_0x9981('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x9981('0x4')](_0x9981('0x5'),_0x9981('0x6'),_0x9981('0x7')),'allowNull':![],'defaultValue':_0x9981('0x7')},'transferredAt':{'type':Sequelize[_0x9981('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x9981('0x9')]}}; \ No newline at end of file +var _0xb75d=['sequelize','exports','STRING','ENUM','queue','DATE','NOW','moment'];(function(_0x34951b,_0x3bb9c1){var _0x5c48d1=function(_0x2969de){while(--_0x2969de){_0x34951b['push'](_0x34951b['shift']());}};_0x5c48d1(++_0x3bb9c1);}(_0xb75d,0x167));var _0xdb75=function(_0x143a91,_0x235332){_0x143a91=_0x143a91-0x0;var _0x1906f5=_0xb75d[_0x143a91];return _0x1906f5;};'use strict';var moment=require(_0xdb75('0x0'));var Sequelize=require(_0xdb75('0x1'));module[_0xdb75('0x2')]={'uniqueid':{'type':Sequelize[_0xdb75('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdb75('0x4')]('account','agent','queue'),'allowNull':![],'defaultValue':_0xdb75('0x5')},'transferredAt':{'type':Sequelize[_0xdb75('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xdb75('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 1d26765..6f1a208 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 _0xd6d6=['Content-Range','save','update','then','destroy','error','stack','name','send','index','OpenchannelTransferReport','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','field','options','include','findAll','rows','catch','show','params','rawAttributes','length','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x1dc56e,_0x4f3462){_0x1dc56e=_0x1dc56e-0x0;var _0x382c8c=_0xd6d6[_0x1dc56e];return _0x382c8c;};'use strict';var pdf=require(_0x6d6d('0x0'));var emlformat=require(_0x6d6d('0x1'));var rimraf=require(_0x6d6d('0x2'));var zipdir=require(_0x6d6d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6d6d('0x4'));var moment=require(_0x6d6d('0x5'));var BPromise=require(_0x6d6d('0x6'));var Mustache=require(_0x6d6d('0x7'));var util=require(_0x6d6d('0x8'));var path=require(_0x6d6d('0x9'));var sox=require(_0x6d6d('0xa'));var csv=require('to-csv');var ejs=require(_0x6d6d('0xb'));var fs=require('fs');var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x6d6d('0x12'));var hardwareService=require(_0x6d6d('0x13'));var Redis=require(_0x6d6d('0x14'));var qs=require(_0x6d6d('0x15'));var logger=require(_0x6d6d('0x16'))('api');var utils=require(_0x6d6d('0x17'));var config=require(_0x6d6d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fbe9c,_0x176618){_0x176618=_0x176618||0xcc;return function(_0x32146d){if(_0x32146d){return _0x4fbe9c[_0x6d6d('0x19')](_0x176618);}return _0x4fbe9c[_0x6d6d('0x1a')](_0x176618)[_0x6d6d('0x1b')]();};}function respondWithResult(_0x41fbdf,_0x19cf50){_0x19cf50=_0x19cf50||0xc8;return function(_0x2cb2dd){if(_0x2cb2dd){return _0x41fbdf['status'](_0x19cf50)[_0x6d6d('0x1c')](_0x2cb2dd);}};}function respondWithFilteredResult(_0x3dd4b3,_0x1f2aac){return function(_0xa3b05d){if(_0xa3b05d){var _0x29cbd8=_0xa3b05d[_0x6d6d('0x1d')],_0x5d80c0=_0x1f2aac[_0x6d6d('0x1e')],_0x2e6fdb=_0x1f2aac[_0x6d6d('0x1e')]+_0x1f2aac['limit'],_0x587338;if(_0x2e6fdb>=_0x29cbd8){_0x2e6fdb=_0x29cbd8;_0x587338=0xc8;}else{_0x587338=0xce;}_0x3dd4b3['status'](_0x587338);return _0x3dd4b3[_0x6d6d('0x1f')](_0x6d6d('0x20'),_0x5d80c0+'-'+_0x2e6fdb+'/'+_0x29cbd8)[_0x6d6d('0x1c')](_0xa3b05d);}return null;};}function patchUpdates(_0x2c5314){return function(_0x51fff6){try{jsonpatch['apply'](_0x51fff6,_0x2c5314,!![]);}catch(_0x474873){return BPromise['reject'](_0x474873);}return _0x51fff6[_0x6d6d('0x21')]();};}function saveUpdates(_0xb8590d,_0x30d87d){return function(_0x450352){if(_0x450352){return _0x450352[_0x6d6d('0x22')](_0xb8590d)[_0x6d6d('0x23')](function(_0x164c67){return _0x164c67;});}return null;};}function removeEntity(_0x230ad7,_0x115a3c){return function(_0x6f64e3){if(_0x6f64e3){return _0x6f64e3[_0x6d6d('0x24')]()[_0x6d6d('0x23')](function(){_0x230ad7[_0x6d6d('0x1a')](0xcc)[_0x6d6d('0x1b')]();});}};}function handleEntityNotFound(_0x1f7f88,_0x25a02e){return function(_0xced622){if(!_0xced622){_0x1f7f88['sendStatus'](0x194);}return _0xced622;};}function handleError(_0x3b73e5,_0x2dcb9c){_0x2dcb9c=_0x2dcb9c||0x1f4;return function(_0x99f7d6){logger[_0x6d6d('0x25')](_0x99f7d6[_0x6d6d('0x26')]);if(_0x99f7d6[_0x6d6d('0x27')]){delete _0x99f7d6['name'];}_0x3b73e5[_0x6d6d('0x1a')](_0x2dcb9c)[_0x6d6d('0x28')](_0x99f7d6);};}exports[_0x6d6d('0x29')]=function(_0x126ac8,_0x25c121){var _0x408f98={},_0x3641fc={},_0x4a57a1={'count':0x0,'rows':[]};var _0x298408=db[_0x6d6d('0x2a')]['rawAttributes'];_0x3641fc['model']=_[_0x6d6d('0x2b')](_0x298408);_0x3641fc[_0x6d6d('0x2c')]=_[_0x6d6d('0x2b')](_0x126ac8['query']);_0x3641fc[_0x6d6d('0x2d')]=_[_0x6d6d('0x2e')](_0x3641fc[_0x6d6d('0x2f')],_0x3641fc[_0x6d6d('0x2c')]);_0x408f98[_0x6d6d('0x30')]=_[_0x6d6d('0x2e')](_0x3641fc[_0x6d6d('0x2f')],qs[_0x6d6d('0x31')](_0x126ac8[_0x6d6d('0x2c')][_0x6d6d('0x31')]));_0x408f98['attributes']=_0x408f98[_0x6d6d('0x30')]['length']?_0x408f98[_0x6d6d('0x30')]:_0x3641fc[_0x6d6d('0x2f')];if(!_0x126ac8[_0x6d6d('0x2c')][_0x6d6d('0x32')]('nolimit')){_0x408f98[_0x6d6d('0x33')]=qs['limit'](_0x126ac8[_0x6d6d('0x2c')][_0x6d6d('0x33')]);_0x408f98['offset']=qs[_0x6d6d('0x1e')](_0x126ac8[_0x6d6d('0x2c')][_0x6d6d('0x1e')]);}_0x408f98[_0x6d6d('0x34')]=qs[_0x6d6d('0x35')](_0x126ac8[_0x6d6d('0x2c')][_0x6d6d('0x35')]);_0x408f98[_0x6d6d('0x36')]=qs[_0x6d6d('0x2d')](_[_0x6d6d('0x37')](_0x126ac8[_0x6d6d('0x2c')],_0x3641fc[_0x6d6d('0x2d')]));if(_0x126ac8[_0x6d6d('0x2c')][_0x6d6d('0x38')]){_0x408f98['where']=_[_0x6d6d('0x39')](_0x408f98[_0x6d6d('0x36')],{'$or':_[_0x6d6d('0x3a')](_0x298408,function(_0x5e4f38){if(_0x5e4f38['type']['key']!==_0x6d6d('0x3b')){var _0x26b2de={};_0x26b2de[_0x5e4f38[_0x6d6d('0x3c')]]={'$like':'%'+_0x126ac8['query'][_0x6d6d('0x38')]+'%'};return _0x26b2de;}})});}_0x408f98=_[_0x6d6d('0x39')]({},_0x408f98,_0x126ac8[_0x6d6d('0x3d')]);var _0x125d79={'where':_0x408f98['where']};return db['OpenchannelTransferReport']['count'](_0x125d79)[_0x6d6d('0x23')](function(_0x4196f0){_0x4a57a1[_0x6d6d('0x1d')]=_0x4196f0;if(_0x126ac8[_0x6d6d('0x2c')]['includeAll']){_0x408f98[_0x6d6d('0x3e')]=[{'all':!![]}];}return db[_0x6d6d('0x2a')][_0x6d6d('0x3f')](_0x408f98);})[_0x6d6d('0x23')](function(_0x3d632c){_0x4a57a1[_0x6d6d('0x40')]=_0x3d632c;return _0x4a57a1;})['then'](respondWithFilteredResult(_0x25c121,_0x408f98))[_0x6d6d('0x41')](handleError(_0x25c121,null));};exports[_0x6d6d('0x42')]=function(_0x42aff0,_0x1f4160){var _0x32275b={'raw':!![],'where':{'id':_0x42aff0[_0x6d6d('0x43')]['id']}},_0x3e27b7={};_0x3e27b7['model']=_[_0x6d6d('0x2b')](db[_0x6d6d('0x2a')][_0x6d6d('0x44')]);_0x3e27b7[_0x6d6d('0x2c')]=_[_0x6d6d('0x2b')](_0x42aff0['query']);_0x3e27b7[_0x6d6d('0x2d')]=_[_0x6d6d('0x2e')](_0x3e27b7['model'],_0x3e27b7[_0x6d6d('0x2c')]);_0x32275b['attributes']=_[_0x6d6d('0x2e')](_0x3e27b7[_0x6d6d('0x2f')],qs['fields'](_0x42aff0[_0x6d6d('0x2c')][_0x6d6d('0x31')]));_0x32275b[_0x6d6d('0x30')]=_0x32275b[_0x6d6d('0x30')][_0x6d6d('0x45')]?_0x32275b['attributes']:_0x3e27b7['model'];if(_0x42aff0[_0x6d6d('0x2c')]['includeAll']){_0x32275b['include']=[{'all':!![]}];}_0x32275b=_[_0x6d6d('0x39')]({},_0x32275b,_0x42aff0[_0x6d6d('0x3d')]);return db[_0x6d6d('0x2a')]['find'](_0x32275b)[_0x6d6d('0x23')](handleEntityNotFound(_0x1f4160,null))['then'](respondWithResult(_0x1f4160,null))[_0x6d6d('0x41')](handleError(_0x1f4160,null));};exports[_0x6d6d('0x46')]=function(_0x1d3826,_0x4606eb){return db[_0x6d6d('0x2a')][_0x6d6d('0x46')](_0x1d3826[_0x6d6d('0x47')],{})['then'](respondWithResult(_0x4606eb,0xc9))[_0x6d6d('0x41')](handleError(_0x4606eb,null));};exports[_0x6d6d('0x22')]=function(_0x19fa41,_0x389e51){if(_0x19fa41[_0x6d6d('0x47')]['id']){delete _0x19fa41[_0x6d6d('0x47')]['id'];}return db[_0x6d6d('0x2a')][_0x6d6d('0x48')]({'where':{'id':_0x19fa41[_0x6d6d('0x43')]['id']}})['then'](handleEntityNotFound(_0x389e51,null))['then'](saveUpdates(_0x19fa41[_0x6d6d('0x47')],null))[_0x6d6d('0x23')](respondWithResult(_0x389e51,null))[_0x6d6d('0x41')](handleError(_0x389e51,null));};exports[_0x6d6d('0x24')]=function(_0xe2a20e,_0x492834){return db[_0x6d6d('0x2a')][_0x6d6d('0x48')]({'where':{'id':_0xe2a20e[_0x6d6d('0x43')]['id']}})[_0x6d6d('0x23')](handleEntityNotFound(_0x492834,null))[_0x6d6d('0x23')](removeEntity(_0x492834,null))[_0x6d6d('0x41')](handleError(_0x492834,null));};exports[_0x6d6d('0x49')]=function(_0x39ec2a,_0x442be8){return db[_0x6d6d('0x2a')][_0x6d6d('0x49')]()[_0x6d6d('0x23')](respondWithResult(_0x442be8,null))['catch'](handleError(_0x442be8,null));}; \ No newline at end of file +var _0xe5b3=['sort','where','map','type','VIRTUAL','field','options','OpenchannelTransferReport','rows','catch','show','params','includeAll','include','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order'];(function(_0x4cb5a9,_0x45c8d8){var _0x3fb7ed=function(_0xc7c422){while(--_0xc7c422){_0x4cb5a9['push'](_0x4cb5a9['shift']());}};_0x3fb7ed(++_0x45c8d8);}(_0xe5b3,0x133));var _0x3e5b=function(_0x3a8beb,_0x14ee64){_0x3a8beb=_0x3a8beb-0x0;var _0x135b3b=_0xe5b3[_0x3a8beb];return _0x135b3b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3e5b('0x0'));var rimraf=require(_0x3e5b('0x1'));var zipdir=require(_0x3e5b('0x2'));var jsonpatch=require(_0x3e5b('0x3'));var rp=require(_0x3e5b('0x4'));var moment=require(_0x3e5b('0x5'));var BPromise=require(_0x3e5b('0x6'));var Mustache=require(_0x3e5b('0x7'));var util=require(_0x3e5b('0x8'));var path=require(_0x3e5b('0x9'));var sox=require(_0x3e5b('0xa'));var csv=require('to-csv');var ejs=require(_0x3e5b('0xb'));var fs=require('fs');var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x3e5b('0x11'));var hardwareService=require(_0x3e5b('0x12'));var Redis=require(_0x3e5b('0x13'));var qs=require(_0x3e5b('0x14'));var logger=require(_0x3e5b('0x15'))('api');var utils=require(_0x3e5b('0x16'));var config=require('../../config/environment');var db=require(_0x3e5b('0x17'))['db'];function respondWithStatusCode(_0x382273,_0x4d69dd){_0x4d69dd=_0x4d69dd||0xcc;return function(_0x374068){if(_0x374068){return _0x382273[_0x3e5b('0x18')](_0x4d69dd);}return _0x382273[_0x3e5b('0x19')](_0x4d69dd)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x560010,_0x39a2a1){_0x39a2a1=_0x39a2a1||0xc8;return function(_0x5f2f9c){if(_0x5f2f9c){return _0x560010['status'](_0x39a2a1)['json'](_0x5f2f9c);}};}function respondWithFilteredResult(_0x3754e3,_0x3f5368){return function(_0x17aaa3){if(_0x17aaa3){var _0x4fb471=_0x17aaa3[_0x3e5b('0x1b')],_0x1f81a7=_0x3f5368[_0x3e5b('0x1c')],_0x59ddc0=_0x3f5368['offset']+_0x3f5368[_0x3e5b('0x1d')],_0x56a453;if(_0x59ddc0>=_0x4fb471){_0x59ddc0=_0x4fb471;_0x56a453=0xc8;}else{_0x56a453=0xce;}_0x3754e3[_0x3e5b('0x19')](_0x56a453);return _0x3754e3['set'](_0x3e5b('0x1e'),_0x1f81a7+'-'+_0x59ddc0+'/'+_0x4fb471)[_0x3e5b('0x1f')](_0x17aaa3);}return null;};}function patchUpdates(_0x52696c){return function(_0x4b189d){try{jsonpatch[_0x3e5b('0x20')](_0x4b189d,_0x52696c,!![]);}catch(_0x20806a){return BPromise[_0x3e5b('0x21')](_0x20806a);}return _0x4b189d[_0x3e5b('0x22')]();};}function saveUpdates(_0x24de5b,_0x1564b5){return function(_0x447d36){if(_0x447d36){return _0x447d36[_0x3e5b('0x23')](_0x24de5b)[_0x3e5b('0x24')](function(_0x3d95f3){return _0x3d95f3;});}return null;};}function removeEntity(_0x2b977c,_0x11e5cf){return function(_0x2d77cc){if(_0x2d77cc){return _0x2d77cc[_0x3e5b('0x25')]()['then'](function(){_0x2b977c[_0x3e5b('0x19')](0xcc)[_0x3e5b('0x1a')]();});}};}function handleEntityNotFound(_0x2146d4,_0x150674){return function(_0x50039b){if(!_0x50039b){_0x2146d4[_0x3e5b('0x18')](0x194);}return _0x50039b;};}function handleError(_0x5b33bb,_0x2f9e42){_0x2f9e42=_0x2f9e42||0x1f4;return function(_0x36d960){logger['error'](_0x36d960[_0x3e5b('0x26')]);if(_0x36d960[_0x3e5b('0x27')]){delete _0x36d960[_0x3e5b('0x27')];}_0x5b33bb[_0x3e5b('0x19')](_0x2f9e42)[_0x3e5b('0x28')](_0x36d960);};}exports[_0x3e5b('0x29')]=function(_0x160e87,_0x2ddf57){var _0x4c4b89={},_0x1c7278={},_0x505f40={'count':0x0,'rows':[]};var _0xb70ab4=db['OpenchannelTransferReport'][_0x3e5b('0x2a')];_0x1c7278[_0x3e5b('0x2b')]=_[_0x3e5b('0x2c')](_0xb70ab4);_0x1c7278[_0x3e5b('0x2d')]=_[_0x3e5b('0x2c')](_0x160e87[_0x3e5b('0x2d')]);_0x1c7278[_0x3e5b('0x2e')]=_[_0x3e5b('0x2f')](_0x1c7278[_0x3e5b('0x2b')],_0x1c7278[_0x3e5b('0x2d')]);_0x4c4b89[_0x3e5b('0x30')]=_['intersection'](_0x1c7278[_0x3e5b('0x2b')],qs[_0x3e5b('0x31')](_0x160e87[_0x3e5b('0x2d')][_0x3e5b('0x31')]));_0x4c4b89[_0x3e5b('0x30')]=_0x4c4b89[_0x3e5b('0x30')][_0x3e5b('0x32')]?_0x4c4b89['attributes']:_0x1c7278[_0x3e5b('0x2b')];if(!_0x160e87['query']['hasOwnProperty'](_0x3e5b('0x33'))){_0x4c4b89[_0x3e5b('0x1d')]=qs['limit'](_0x160e87[_0x3e5b('0x2d')][_0x3e5b('0x1d')]);_0x4c4b89[_0x3e5b('0x1c')]=qs[_0x3e5b('0x1c')](_0x160e87[_0x3e5b('0x2d')][_0x3e5b('0x1c')]);}_0x4c4b89[_0x3e5b('0x34')]=qs[_0x3e5b('0x35')](_0x160e87[_0x3e5b('0x2d')][_0x3e5b('0x35')]);_0x4c4b89[_0x3e5b('0x36')]=qs[_0x3e5b('0x2e')](_['pick'](_0x160e87[_0x3e5b('0x2d')],_0x1c7278[_0x3e5b('0x2e')]));if(_0x160e87['query']['filter']){_0x4c4b89[_0x3e5b('0x36')]=_['merge'](_0x4c4b89[_0x3e5b('0x36')],{'$or':_[_0x3e5b('0x37')](_0xb70ab4,function(_0xb2349c){if(_0xb2349c[_0x3e5b('0x38')]['key']!==_0x3e5b('0x39')){var _0x4cdcb1={};_0x4cdcb1[_0xb2349c[_0x3e5b('0x3a')]]={'$like':'%'+_0x160e87['query']['filter']+'%'};return _0x4cdcb1;}})});}_0x4c4b89=_['merge']({},_0x4c4b89,_0x160e87[_0x3e5b('0x3b')]);var _0x174ebf={'where':_0x4c4b89[_0x3e5b('0x36')]};return db[_0x3e5b('0x3c')][_0x3e5b('0x1b')](_0x174ebf)[_0x3e5b('0x24')](function(_0x5466ac){_0x505f40['count']=_0x5466ac;if(_0x160e87['query']['includeAll']){_0x4c4b89['include']=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x4c4b89);})[_0x3e5b('0x24')](function(_0x349de0){_0x505f40[_0x3e5b('0x3d')]=_0x349de0;return _0x505f40;})[_0x3e5b('0x24')](respondWithFilteredResult(_0x2ddf57,_0x4c4b89))[_0x3e5b('0x3e')](handleError(_0x2ddf57,null));};exports[_0x3e5b('0x3f')]=function(_0x2c56bc,_0x423be2){var _0x222d0f={'raw':!![],'where':{'id':_0x2c56bc[_0x3e5b('0x40')]['id']}},_0xbbc6b={};_0xbbc6b['model']=_[_0x3e5b('0x2c')](db[_0x3e5b('0x3c')][_0x3e5b('0x2a')]);_0xbbc6b[_0x3e5b('0x2d')]=_[_0x3e5b('0x2c')](_0x2c56bc[_0x3e5b('0x2d')]);_0xbbc6b[_0x3e5b('0x2e')]=_[_0x3e5b('0x2f')](_0xbbc6b[_0x3e5b('0x2b')],_0xbbc6b[_0x3e5b('0x2d')]);_0x222d0f[_0x3e5b('0x30')]=_['intersection'](_0xbbc6b['model'],qs['fields'](_0x2c56bc['query'][_0x3e5b('0x31')]));_0x222d0f[_0x3e5b('0x30')]=_0x222d0f[_0x3e5b('0x30')][_0x3e5b('0x32')]?_0x222d0f[_0x3e5b('0x30')]:_0xbbc6b[_0x3e5b('0x2b')];if(_0x2c56bc[_0x3e5b('0x2d')][_0x3e5b('0x41')]){_0x222d0f[_0x3e5b('0x42')]=[{'all':!![]}];}_0x222d0f=_[_0x3e5b('0x43')]({},_0x222d0f,_0x2c56bc['options']);return db[_0x3e5b('0x3c')][_0x3e5b('0x44')](_0x222d0f)[_0x3e5b('0x24')](handleEntityNotFound(_0x423be2,null))[_0x3e5b('0x24')](respondWithResult(_0x423be2,null))[_0x3e5b('0x3e')](handleError(_0x423be2,null));};exports['create']=function(_0x588ee7,_0x495217){return db[_0x3e5b('0x3c')][_0x3e5b('0x45')](_0x588ee7[_0x3e5b('0x46')],{})['then'](respondWithResult(_0x495217,0xc9))['catch'](handleError(_0x495217,null));};exports[_0x3e5b('0x23')]=function(_0x313c51,_0x123947){if(_0x313c51['body']['id']){delete _0x313c51['body']['id'];}return db[_0x3e5b('0x3c')]['find']({'where':{'id':_0x313c51[_0x3e5b('0x40')]['id']}})[_0x3e5b('0x24')](handleEntityNotFound(_0x123947,null))[_0x3e5b('0x24')](saveUpdates(_0x313c51[_0x3e5b('0x46')],null))[_0x3e5b('0x24')](respondWithResult(_0x123947,null))[_0x3e5b('0x3e')](handleError(_0x123947,null));};exports[_0x3e5b('0x25')]=function(_0x3ea5aa,_0x339852){return db['OpenchannelTransferReport'][_0x3e5b('0x44')]({'where':{'id':_0x3ea5aa['params']['id']}})[_0x3e5b('0x24')](handleEntityNotFound(_0x339852,null))[_0x3e5b('0x24')](removeEntity(_0x339852,null))[_0x3e5b('0x3e')](handleError(_0x339852,null));};exports[_0x3e5b('0x47')]=function(_0x291e4d,_0x3a4f26){return db[_0x3e5b('0x3c')][_0x3e5b('0x47')]()[_0x3e5b('0x24')](respondWithResult(_0x3a4f26,null))[_0x3e5b('0x3e')](handleError(_0x3a4f26,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index dd49c1a..a6c48dc 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 _0x7a54=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','./openchannelTransferReport.attributes','exports','define'];(function(_0x5d18f0,_0x37c124){var _0xaea719=function(_0xa980ff){while(--_0xa980ff){_0x5d18f0['push'](_0x5d18f0['shift']());}};_0xaea719(++_0x37c124);}(_0x7a54,0x106));var _0x47a5=function(_0x56bbb7,_0x3cff48){_0x56bbb7=_0x56bbb7-0x0;var _0x522a42=_0x7a54[_0x56bbb7];return _0x522a42;};'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 +var _0x7a54=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','./openchannelTransferReport.attributes','exports','define'];(function(_0x5c900d,_0xb418b){var _0x264806=function(_0x157496){while(--_0x157496){_0x5c900d['push'](_0x5c900d['shift']());}};_0x264806(++_0xb418b);}(_0x7a54,0x106));var _0x47a5=function(_0x2dc772,_0x16ebc6){_0x2dc772=_0x2dc772-0x0;var _0x53deed=_0x7a54[_0x2dc772];return _0x53deed;};'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 d4723ff..4cbb086 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 _0x8f2e=['stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8f2e,0xb0));var _0xe8f2=function(_0x302cda,_0x2b4529){_0x302cda=_0x302cda-0x0;var _0x58c41f=_0x8f2e[_0x302cda];return _0x58c41f;};'use strict';var _=require(_0xe8f2('0x0'));var util=require('util');var moment=require(_0xe8f2('0x1'));var BPromise=require('bluebird');var rs=require(_0xe8f2('0x2'));var fs=require('fs');var Redis=require(_0xe8f2('0x3'));var db=require(_0xe8f2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe8f2('0x5'))(_0xe8f2('0x6'));var config=require(_0xe8f2('0x7'));var jayson=require(_0xe8f2('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b232f,_0xa8ffc1,_0x1bb974){return new BPromise(function(_0x1748aa,_0xac25e1){return client[_0xe8f2('0x9')](_0x4b232f,_0x1bb974)['then'](function(_0x113381){logger[_0xe8f2('0xa')](_0xe8f2('0xb'),_0xa8ffc1,'request\x20sent');logger[_0xe8f2('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0xa8ffc1,_0xe8f2('0xd'),JSON[_0xe8f2('0xe')](_0x113381));if(_0x113381[_0xe8f2('0xf')]){if(_0x113381['error'][_0xe8f2('0x10')]===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0xa8ffc1,_0x113381[_0xe8f2('0xf')][_0xe8f2('0x11')]);return _0xac25e1(_0x113381[_0xe8f2('0xf')][_0xe8f2('0x11')]);}logger[_0xe8f2('0xf')](_0xe8f2('0xb'),_0xa8ffc1,_0x113381[_0xe8f2('0xf')][_0xe8f2('0x11')]);return _0x1748aa(_0x113381[_0xe8f2('0xf')]['message']);}else{logger[_0xe8f2('0xa')](_0xe8f2('0xb'),_0xa8ffc1,_0xe8f2('0xd'));_0x1748aa(_0x113381[_0xe8f2('0x12')][_0xe8f2('0x11')]);}})['catch'](function(_0x53e32e){logger[_0xe8f2('0xf')](_0xe8f2('0xb'),_0xa8ffc1,_0x53e32e);_0xac25e1(_0x53e32e);});});} \ No newline at end of file +var _0x8cb5=['message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x36657e,_0x415af9){var _0x2b2f77=function(_0x2a2f5b){while(--_0x2a2f5b){_0x36657e['push'](_0x36657e['shift']());}};_0x2b2f77(++_0x415af9);}(_0x8cb5,0x19f));var _0x58cb=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x8cb5[_0x432682];return _0x463d05;};'use strict';var _=require(_0x58cb('0x0'));var util=require(_0x58cb('0x1'));var moment=require(_0x58cb('0x2'));var BPromise=require(_0x58cb('0x3'));var rs=require(_0x58cb('0x4'));var fs=require('fs');var Redis=require(_0x58cb('0x5'));var db=require(_0x58cb('0x6'))['db'];var utils=require(_0x58cb('0x7'));var logger=require('../../config/logger')(_0x58cb('0x8'));var config=require(_0x58cb('0x9'));var jayson=require(_0x58cb('0xa'));var client=jayson[_0x58cb('0xb')][_0x58cb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x395817,_0x25f834,_0x5bf342){return new BPromise(function(_0x5f1000,_0x2cda8f){return client[_0x58cb('0xd')](_0x395817,_0x5bf342)['then'](function(_0x160a19){logger[_0x58cb('0xe')](_0x58cb('0xf'),_0x25f834,_0x58cb('0x10'));logger[_0x58cb('0x11')](_0x58cb('0x12'),_0x25f834,'request\x20sent',JSON[_0x58cb('0x13')](_0x160a19));if(_0x160a19[_0x58cb('0x14')]){if(_0x160a19['error'][_0x58cb('0x15')]===0x1f4){logger[_0x58cb('0x14')](_0x58cb('0xf'),_0x25f834,_0x160a19[_0x58cb('0x14')][_0x58cb('0x16')]);return _0x2cda8f(_0x160a19[_0x58cb('0x14')][_0x58cb('0x16')]);}logger[_0x58cb('0x14')](_0x58cb('0xf'),_0x25f834,_0x160a19[_0x58cb('0x14')]['message']);return _0x5f1000(_0x160a19[_0x58cb('0x14')]['message']);}else{logger[_0x58cb('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x25f834,_0x58cb('0x10'));_0x5f1000(_0x160a19['result']['message']);}})['catch'](function(_0x2bbb0f){logger[_0x58cb('0x14')](_0x58cb('0xf'),_0x25f834,_0x2bbb0f);_0x2cda8f(_0x2bbb0f);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 3aabf6a..a9016f6 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 _0x34ab=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','delete'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0x34ab,0x169));var _0xb34a=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0x34ab[_0x2aecb2];return _0x3ebb80;};'use strict';var multer=require(_0xb34a('0x0'));var util=require(_0xb34a('0x1'));var path=require(_0xb34a('0x2'));var timeout=require(_0xb34a('0x3'));var express=require(_0xb34a('0x4'));var router=express[_0xb34a('0x5')]();var auth=require(_0xb34a('0x6'));var interaction=require(_0xb34a('0x7'));var config=require('../../config/environment');var controller=require('./pause.controller');router[_0xb34a('0x8')]('/',auth[_0xb34a('0x9')](),controller[_0xb34a('0xa')]);router['get'](_0xb34a('0xb'),auth[_0xb34a('0x9')](),controller[_0xb34a('0xc')]);router[_0xb34a('0xd')]('/',auth[_0xb34a('0x9')](),controller[_0xb34a('0xe')]);router[_0xb34a('0xf')](_0xb34a('0xb'),auth[_0xb34a('0x9')](),controller['update']);router[_0xb34a('0x10')](_0xb34a('0xb'),auth[_0xb34a('0x9')](),controller['destroy']);module[_0xb34a('0x11')]=router; \ No newline at end of file +var _0x4b6c=['show','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id'];(function(_0x13e921,_0x10bef1){var _0x172c89=function(_0x13033f){while(--_0x13033f){_0x13e921['push'](_0x13e921['shift']());}};_0x172c89(++_0x10bef1);}(_0x4b6c,0x14a));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc4b6('0x0'));var util=require(_0xc4b6('0x1'));var path=require('path');var timeout=require(_0xc4b6('0x2'));var express=require(_0xc4b6('0x3'));var router=express[_0xc4b6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc4b6('0x5'));var config=require(_0xc4b6('0x6'));var controller=require(_0xc4b6('0x7'));router['get']('/',auth[_0xc4b6('0x8')](),controller[_0xc4b6('0x9')]);router[_0xc4b6('0xa')](_0xc4b6('0xb'),auth['isAuthenticated'](),controller[_0xc4b6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc4b6('0xd')]);router[_0xc4b6('0xe')](_0xc4b6('0xb'),auth[_0xc4b6('0x8')](),controller[_0xc4b6('0xf')]);router[_0xc4b6('0x10')]('/:id',auth[_0xc4b6('0x8')](),controller[_0xc4b6('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 42dca4c..00d072c 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 _0x61d6=['STRING','sequelize'];(function(_0x173336,_0x3f98c4){var _0x12dc79=function(_0xae7bf5){while(--_0xae7bf5){_0x173336['push'](_0x173336['shift']());}};_0x12dc79(++_0x3f98c4);}(_0x61d6,0x103));var _0x661d=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x61d6[_0x263a74];return _0x2aa86c;};'use strict';var Sequelize=require(_0x661d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x661d('0x1')]}}; \ No newline at end of file +var _0x99b0=['exports','STRING','name','sequelize'];(function(_0x12a3ad,_0x4a7b33){var _0x3e2642=function(_0x1ab335){while(--_0x1ab335){_0x12a3ad['push'](_0x12a3ad['shift']());}};_0x3e2642(++_0x4a7b33);}(_0x99b0,0x93));var _0x099b=function(_0x32792d,_0x2f0aae){_0x32792d=_0x32792d-0x0;var _0x4e09aa=_0x99b0[_0x32792d];return _0x4e09aa;};'use strict';var Sequelize=require(_0x099b('0x0'));module[_0x099b('0x1')]={'name':{'type':Sequelize[_0x099b('0x2')],'unique':_0x099b('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x099b('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 7260516..b2bc7e1 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 _0x793e=['includeAll','findAll','rows','catch','show','params','include','find','create','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','end','error','stack','name','send','Pause','rawAttributes','model','keys','query','filters','intersection','attributes','fields','nolimit','sort','pick','filter','map','type','field','merge','options','where'];(function(_0x319b05,_0xf3e345){var _0x5cc987=function(_0x36d634){while(--_0x36d634){_0x319b05['push'](_0x319b05['shift']());}};_0x5cc987(++_0xf3e345);}(_0x793e,0x194));var _0xe793=function(_0x4cdbc8,_0x4d8e1d){_0x4cdbc8=_0x4cdbc8-0x0;var _0x311448=_0x793e[_0x4cdbc8];return _0x311448;};'use strict';var pdf=require(_0xe793('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe793('0x1'));var zipdir=require(_0xe793('0x2'));var jsonpatch=require(_0xe793('0x3'));var rp=require(_0xe793('0x4'));var moment=require('moment');var BPromise=require(_0xe793('0x5'));var Mustache=require(_0xe793('0x6'));var util=require(_0xe793('0x7'));var path=require(_0xe793('0x8'));var sox=require(_0xe793('0x9'));var csv=require(_0xe793('0xa'));var ejs=require(_0xe793('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe793('0xc'));var crypto=require(_0xe793('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe793('0xe'));var Papa=require('papaparse');var authService=require(_0xe793('0xf'));var hardwareService=require(_0xe793('0x10'));var Redis=require(_0xe793('0x11'));var qs=require(_0xe793('0x12'));var logger=require(_0xe793('0x13'))(_0xe793('0x14'));var utils=require(_0xe793('0x15'));var config=require(_0xe793('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c8e9b,_0x4e1bd3){_0x4e1bd3=_0x4e1bd3||0xcc;return function(_0x4ef5ca){if(_0x4ef5ca){return _0x3c8e9b[_0xe793('0x17')](_0x4e1bd3);}return _0x3c8e9b[_0xe793('0x18')](_0x4e1bd3)['end']();};}function respondWithResult(_0x383d53,_0x21ba97){_0x21ba97=_0x21ba97||0xc8;return function(_0x1152d2){if(_0x1152d2){return _0x383d53[_0xe793('0x18')](_0x21ba97)[_0xe793('0x19')](_0x1152d2);}};}function respondWithFilteredResult(_0x576394,_0x3694fb){return function(_0x14f01c){if(_0x14f01c){var _0x595612=_0x14f01c[_0xe793('0x1a')],_0x3685f2=_0x3694fb[_0xe793('0x1b')],_0x1876e1=_0x3694fb[_0xe793('0x1b')]+_0x3694fb[_0xe793('0x1c')],_0x52eea5;if(_0x1876e1>=_0x595612){_0x1876e1=_0x595612;_0x52eea5=0xc8;}else{_0x52eea5=0xce;}_0x576394[_0xe793('0x18')](_0x52eea5);return _0x576394[_0xe793('0x1d')](_0xe793('0x1e'),_0x3685f2+'-'+_0x1876e1+'/'+_0x595612)[_0xe793('0x19')](_0x14f01c);}return null;};}function patchUpdates(_0x2fc3e8){return function(_0x7058b3){try{jsonpatch[_0xe793('0x1f')](_0x7058b3,_0x2fc3e8,!![]);}catch(_0x3ac55a){return BPromise[_0xe793('0x20')](_0x3ac55a);}return _0x7058b3[_0xe793('0x21')]();};}function saveUpdates(_0xb2361f,_0x4f0be3){return function(_0xdf853a){if(_0xdf853a){return _0xdf853a[_0xe793('0x22')](_0xb2361f)[_0xe793('0x23')](function(_0x20bfea){return _0x20bfea;});}return null;};}function removeEntity(_0x3bb2ad,_0x471cf1){return function(_0x1fcf64){if(_0x1fcf64){return _0x1fcf64[_0xe793('0x24')]()[_0xe793('0x23')](function(){var _0x40eb24=_0x1fcf64[_0xe793('0x25')]({'plain':!![]});var _0x5cde28=_0xe793('0x26');return db[_0xe793('0x27')]['destroy']({'where':{'type':_0x5cde28,'resourceId':_0x40eb24['id']}})[_0xe793('0x23')](function(){return _0x1fcf64;});})[_0xe793('0x23')](function(){_0x3bb2ad[_0xe793('0x18')](0xcc)[_0xe793('0x28')]();});}};}function handleEntityNotFound(_0x3c72fb,_0x8c924e){return function(_0x3a6da8){if(!_0x3a6da8){_0x3c72fb['sendStatus'](0x194);}return _0x3a6da8;};}function handleError(_0x1c2862,_0x13e991){_0x13e991=_0x13e991||0x1f4;return function(_0x1de585){logger[_0xe793('0x29')](_0x1de585[_0xe793('0x2a')]);if(_0x1de585[_0xe793('0x2b')]){delete _0x1de585['name'];}_0x1c2862[_0xe793('0x18')](_0x13e991)[_0xe793('0x2c')](_0x1de585);};}exports['index']=function(_0x2958ed,_0x195823){var _0x557329={},_0x26ad04={},_0x4e4d60={'count':0x0,'rows':[]};var _0x41dfcb=db[_0xe793('0x2d')][_0xe793('0x2e')];_0x26ad04[_0xe793('0x2f')]=_[_0xe793('0x30')](_0x41dfcb);_0x26ad04[_0xe793('0x31')]=_[_0xe793('0x30')](_0x2958ed[_0xe793('0x31')]);_0x26ad04[_0xe793('0x32')]=_[_0xe793('0x33')](_0x26ad04[_0xe793('0x2f')],_0x26ad04[_0xe793('0x31')]);_0x557329[_0xe793('0x34')]=_[_0xe793('0x33')](_0x26ad04[_0xe793('0x2f')],qs[_0xe793('0x35')](_0x2958ed[_0xe793('0x31')][_0xe793('0x35')]));_0x557329[_0xe793('0x34')]=_0x557329[_0xe793('0x34')]['length']?_0x557329[_0xe793('0x34')]:_0x26ad04[_0xe793('0x2f')];if(!_0x2958ed[_0xe793('0x31')]['hasOwnProperty'](_0xe793('0x36'))){_0x557329[_0xe793('0x1c')]=qs[_0xe793('0x1c')](_0x2958ed[_0xe793('0x31')][_0xe793('0x1c')]);_0x557329['offset']=qs['offset'](_0x2958ed[_0xe793('0x31')][_0xe793('0x1b')]);}_0x557329['order']=qs[_0xe793('0x37')](_0x2958ed[_0xe793('0x31')][_0xe793('0x37')]);_0x557329['where']=qs[_0xe793('0x32')](_[_0xe793('0x38')](_0x2958ed['query'],_0x26ad04[_0xe793('0x32')]));if(_0x2958ed['query'][_0xe793('0x39')]){_0x557329['where']=_['merge'](_0x557329['where'],{'$or':_[_0xe793('0x3a')](_0x41dfcb,function(_0x2819c6){if(_0x2819c6[_0xe793('0x3b')]['key']!=='VIRTUAL'){var _0x72dab4={};_0x72dab4[_0x2819c6[_0xe793('0x3c')]]={'$like':'%'+_0x2958ed[_0xe793('0x31')][_0xe793('0x39')]+'%'};return _0x72dab4;}})});}_0x557329=_[_0xe793('0x3d')]({},_0x557329,_0x2958ed[_0xe793('0x3e')]);var _0x3859e3={'where':_0x557329[_0xe793('0x3f')]};return db[_0xe793('0x2d')][_0xe793('0x1a')](_0x3859e3)[_0xe793('0x23')](function(_0x1c5cf2){_0x4e4d60[_0xe793('0x1a')]=_0x1c5cf2;if(_0x2958ed[_0xe793('0x31')][_0xe793('0x40')]){_0x557329['include']=[{'all':!![]}];}return db[_0xe793('0x2d')][_0xe793('0x41')](_0x557329);})['then'](function(_0x418c88){_0x4e4d60[_0xe793('0x42')]=_0x418c88;return _0x4e4d60;})['then'](respondWithFilteredResult(_0x195823,_0x557329))[_0xe793('0x43')](handleError(_0x195823,null));};exports[_0xe793('0x44')]=function(_0x1049cf,_0x1e348b){var _0x32bd91={'raw':!![],'where':{'id':_0x1049cf[_0xe793('0x45')]['id']}},_0x130fb1={};_0x130fb1[_0xe793('0x2f')]=_['keys'](db[_0xe793('0x2d')][_0xe793('0x2e')]);_0x130fb1[_0xe793('0x31')]=_[_0xe793('0x30')](_0x1049cf[_0xe793('0x31')]);_0x130fb1[_0xe793('0x32')]=_[_0xe793('0x33')](_0x130fb1[_0xe793('0x2f')],_0x130fb1[_0xe793('0x31')]);_0x32bd91[_0xe793('0x34')]=_[_0xe793('0x33')](_0x130fb1[_0xe793('0x2f')],qs[_0xe793('0x35')](_0x1049cf[_0xe793('0x31')][_0xe793('0x35')]));_0x32bd91[_0xe793('0x34')]=_0x32bd91[_0xe793('0x34')]['length']?_0x32bd91[_0xe793('0x34')]:_0x130fb1[_0xe793('0x2f')];if(_0x1049cf[_0xe793('0x31')][_0xe793('0x40')]){_0x32bd91[_0xe793('0x46')]=[{'all':!![]}];}_0x32bd91=_['merge']({},_0x32bd91,_0x1049cf[_0xe793('0x3e')]);return db[_0xe793('0x2d')][_0xe793('0x47')](_0x32bd91)['then'](handleEntityNotFound(_0x1e348b,null))[_0xe793('0x23')](respondWithResult(_0x1e348b,null))[_0xe793('0x43')](handleError(_0x1e348b,null));};exports[_0xe793('0x48')]=function(_0x553a9f,_0x102138){return db[_0xe793('0x2d')][_0xe793('0x48')](_0x553a9f['body'],{})[_0xe793('0x23')](function(_0x19df11){var _0x1be624=_0x553a9f['user']['get']({'plain':!![]});if(!_0x1be624)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1be624[_0xe793('0x49')]==='user'){var _0x235b98=_0x19df11['get']({'plain':!![]});var _0x56eefe='Pauses';return db['UserProfileSection'][_0xe793('0x47')]({'where':{'name':_0x56eefe,'userProfileId':_0x1be624[_0xe793('0x4a')]},'raw':!![]})['then'](function(_0x6248cb){if(_0x6248cb&&_0x6248cb[_0xe793('0x4b')]===0x0){return db['UserProfileResource'][_0xe793('0x48')]({'name':_0x235b98[_0xe793('0x2b')],'resourceId':_0x235b98['id'],'type':_0x6248cb[_0xe793('0x2b')],'sectionId':_0x6248cb['id']},{})[_0xe793('0x23')](function(){return _0x19df11;});}else{return _0x19df11;}})['catch'](function(_0x1c5a28){logger[_0xe793('0x29')](_0xe793('0x4c'),_0x1c5a28);throw _0x1c5a28;});}return _0x19df11;})['then'](respondWithResult(_0x102138,0xc9))[_0xe793('0x43')](handleError(_0x102138,null));};exports['update']=function(_0x56f6bb,_0x20f85c){if(_0x56f6bb[_0xe793('0x4d')]['id']){delete _0x56f6bb[_0xe793('0x4d')]['id'];}return db['Pause'][_0xe793('0x47')]({'where':{'id':_0x56f6bb[_0xe793('0x45')]['id']}})[_0xe793('0x23')](handleEntityNotFound(_0x20f85c,null))[_0xe793('0x23')](saveUpdates(_0x56f6bb[_0xe793('0x4d')],null))[_0xe793('0x23')](respondWithResult(_0x20f85c,null))['catch'](handleError(_0x20f85c,null));};exports[_0xe793('0x24')]=function(_0x3cca9b,_0x3fe119){return db[_0xe793('0x2d')]['find']({'where':{'id':_0x3cca9b[_0xe793('0x45')]['id']}})[_0xe793('0x23')](handleEntityNotFound(_0x3fe119,null))[_0xe793('0x23')](removeEntity(_0x3fe119,null))[_0xe793('0x43')](handleError(_0x3fe119,null));}; \ No newline at end of file +var _0xb55c=['key','field','includeAll','include','rows','catch','show','params','fields','length','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','../../components/auth/service','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','Pauses','UserProfileResource','end','sendStatus','error','stack','name','send','index','Pause','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type'];(function(_0x16a09b,_0x26ae70){var _0x27e08d=function(_0x4845b7){while(--_0x4845b7){_0x16a09b['push'](_0x16a09b['shift']());}};_0x27e08d(++_0x26ae70);}(_0xb55c,0x19a));var _0xcb55=function(_0x56d7a8,_0x2937bf){_0x56d7a8=_0x56d7a8-0x0;var _0x16e1a3=_0xb55c[_0x56d7a8];return _0x16e1a3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcb55('0x0'));var rimraf=require(_0xcb55('0x1'));var zipdir=require(_0xcb55('0x2'));var jsonpatch=require(_0xcb55('0x3'));var rp=require('request-promise');var moment=require(_0xcb55('0x4'));var BPromise=require(_0xcb55('0x5'));var Mustache=require(_0xcb55('0x6'));var util=require(_0xcb55('0x7'));var path=require(_0xcb55('0x8'));var sox=require('sox');var csv=require(_0xcb55('0x9'));var ejs=require(_0xcb55('0xa'));var fs=require('fs');var _=require(_0xcb55('0xb'));var squel=require('squel');var crypto=require(_0xcb55('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcb55('0xd'));var toCsv=require(_0xcb55('0x9'));var querystring=require(_0xcb55('0xe'));var Papa=require('papaparse');var authService=require(_0xcb55('0xf'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xcb55('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0xcb55('0x11'))(_0xcb55('0x12'));var utils=require(_0xcb55('0x13'));var config=require(_0xcb55('0x14'));var db=require(_0xcb55('0x15'))['db'];function respondWithStatusCode(_0x4104b9,_0x359824){_0x359824=_0x359824||0xcc;return function(_0x19b81b){if(_0x19b81b){return _0x4104b9['sendStatus'](_0x359824);}return _0x4104b9[_0xcb55('0x16')](_0x359824)['end']();};}function respondWithResult(_0x463202,_0x4f68fd){_0x4f68fd=_0x4f68fd||0xc8;return function(_0x209754){if(_0x209754){return _0x463202['status'](_0x4f68fd)[_0xcb55('0x17')](_0x209754);}};}function respondWithFilteredResult(_0x1fb95c,_0xe0063){return function(_0x119ee1){if(_0x119ee1){var _0x522fee=_0x119ee1[_0xcb55('0x18')],_0x3eb30a=_0xe0063[_0xcb55('0x19')],_0x120d58=_0xe0063[_0xcb55('0x19')]+_0xe0063[_0xcb55('0x1a')],_0x52f5f3;if(_0x120d58>=_0x522fee){_0x120d58=_0x522fee;_0x52f5f3=0xc8;}else{_0x52f5f3=0xce;}_0x1fb95c[_0xcb55('0x16')](_0x52f5f3);return _0x1fb95c[_0xcb55('0x1b')](_0xcb55('0x1c'),_0x3eb30a+'-'+_0x120d58+'/'+_0x522fee)[_0xcb55('0x17')](_0x119ee1);}return null;};}function patchUpdates(_0x87ec87){return function(_0x3b1657){try{jsonpatch['apply'](_0x3b1657,_0x87ec87,!![]);}catch(_0x370d47){return BPromise[_0xcb55('0x1d')](_0x370d47);}return _0x3b1657['save']();};}function saveUpdates(_0x2001ab,_0x185ee4){return function(_0xc027c8){if(_0xc027c8){return _0xc027c8[_0xcb55('0x1e')](_0x2001ab)[_0xcb55('0x1f')](function(_0x4bfa7e){return _0x4bfa7e;});}return null;};}function removeEntity(_0x307b11,_0x58d7cc){return function(_0x2eec43){if(_0x2eec43){return _0x2eec43[_0xcb55('0x20')]()[_0xcb55('0x1f')](function(){var _0x4e35a9=_0x2eec43['get']({'plain':!![]});var _0x5addca=_0xcb55('0x21');return db[_0xcb55('0x22')][_0xcb55('0x20')]({'where':{'type':_0x5addca,'resourceId':_0x4e35a9['id']}})[_0xcb55('0x1f')](function(){return _0x2eec43;});})[_0xcb55('0x1f')](function(){_0x307b11[_0xcb55('0x16')](0xcc)[_0xcb55('0x23')]();});}};}function handleEntityNotFound(_0x5aaf28,_0x497ced){return function(_0x54d89d){if(!_0x54d89d){_0x5aaf28[_0xcb55('0x24')](0x194);}return _0x54d89d;};}function handleError(_0x58e561,_0x44b789){_0x44b789=_0x44b789||0x1f4;return function(_0x1c4435){logger[_0xcb55('0x25')](_0x1c4435[_0xcb55('0x26')]);if(_0x1c4435[_0xcb55('0x27')]){delete _0x1c4435[_0xcb55('0x27')];}_0x58e561[_0xcb55('0x16')](_0x44b789)[_0xcb55('0x28')](_0x1c4435);};}exports[_0xcb55('0x29')]=function(_0x4de5c8,_0x20a8db){var _0x586d19={},_0x411fcd={},_0x401dbf={'count':0x0,'rows':[]};var _0xbb3e0f=db[_0xcb55('0x2a')]['rawAttributes'];_0x411fcd[_0xcb55('0x2b')]=_[_0xcb55('0x2c')](_0xbb3e0f);_0x411fcd[_0xcb55('0x2d')]=_['keys'](_0x4de5c8[_0xcb55('0x2d')]);_0x411fcd[_0xcb55('0x2e')]=_[_0xcb55('0x2f')](_0x411fcd[_0xcb55('0x2b')],_0x411fcd[_0xcb55('0x2d')]);_0x586d19[_0xcb55('0x30')]=_['intersection'](_0x411fcd[_0xcb55('0x2b')],qs['fields'](_0x4de5c8[_0xcb55('0x2d')]['fields']));_0x586d19[_0xcb55('0x30')]=_0x586d19[_0xcb55('0x30')]['length']?_0x586d19['attributes']:_0x411fcd[_0xcb55('0x2b')];if(!_0x4de5c8[_0xcb55('0x2d')][_0xcb55('0x31')](_0xcb55('0x32'))){_0x586d19[_0xcb55('0x1a')]=qs[_0xcb55('0x1a')](_0x4de5c8[_0xcb55('0x2d')][_0xcb55('0x1a')]);_0x586d19['offset']=qs[_0xcb55('0x19')](_0x4de5c8[_0xcb55('0x2d')][_0xcb55('0x19')]);}_0x586d19[_0xcb55('0x33')]=qs[_0xcb55('0x34')](_0x4de5c8[_0xcb55('0x2d')][_0xcb55('0x34')]);_0x586d19[_0xcb55('0x35')]=qs[_0xcb55('0x2e')](_[_0xcb55('0x36')](_0x4de5c8[_0xcb55('0x2d')],_0x411fcd[_0xcb55('0x2e')]));if(_0x4de5c8['query'][_0xcb55('0x37')]){_0x586d19[_0xcb55('0x35')]=_[_0xcb55('0x38')](_0x586d19[_0xcb55('0x35')],{'$or':_['map'](_0xbb3e0f,function(_0x50ee0a){if(_0x50ee0a[_0xcb55('0x39')][_0xcb55('0x3a')]!=='VIRTUAL'){var _0x2e2e5b={};_0x2e2e5b[_0x50ee0a[_0xcb55('0x3b')]]={'$like':'%'+_0x4de5c8['query'][_0xcb55('0x37')]+'%'};return _0x2e2e5b;}})});}_0x586d19=_['merge']({},_0x586d19,_0x4de5c8['options']);var _0x5e1389={'where':_0x586d19[_0xcb55('0x35')]};return db['Pause'][_0xcb55('0x18')](_0x5e1389)[_0xcb55('0x1f')](function(_0x3fbe20){_0x401dbf['count']=_0x3fbe20;if(_0x4de5c8[_0xcb55('0x2d')][_0xcb55('0x3c')]){_0x586d19[_0xcb55('0x3d')]=[{'all':!![]}];}return db[_0xcb55('0x2a')]['findAll'](_0x586d19);})[_0xcb55('0x1f')](function(_0x42731f){_0x401dbf[_0xcb55('0x3e')]=_0x42731f;return _0x401dbf;})[_0xcb55('0x1f')](respondWithFilteredResult(_0x20a8db,_0x586d19))[_0xcb55('0x3f')](handleError(_0x20a8db,null));};exports[_0xcb55('0x40')]=function(_0x275006,_0x2aaa60){var _0x43fd85={'raw':!![],'where':{'id':_0x275006[_0xcb55('0x41')]['id']}},_0x10c844={};_0x10c844['model']=_[_0xcb55('0x2c')](db['Pause']['rawAttributes']);_0x10c844[_0xcb55('0x2d')]=_[_0xcb55('0x2c')](_0x275006[_0xcb55('0x2d')]);_0x10c844[_0xcb55('0x2e')]=_[_0xcb55('0x2f')](_0x10c844['model'],_0x10c844[_0xcb55('0x2d')]);_0x43fd85[_0xcb55('0x30')]=_[_0xcb55('0x2f')](_0x10c844[_0xcb55('0x2b')],qs[_0xcb55('0x42')](_0x275006['query'][_0xcb55('0x42')]));_0x43fd85[_0xcb55('0x30')]=_0x43fd85[_0xcb55('0x30')][_0xcb55('0x43')]?_0x43fd85[_0xcb55('0x30')]:_0x10c844[_0xcb55('0x2b')];if(_0x275006[_0xcb55('0x2d')][_0xcb55('0x3c')]){_0x43fd85['include']=[{'all':!![]}];}_0x43fd85=_[_0xcb55('0x38')]({},_0x43fd85,_0x275006[_0xcb55('0x44')]);return db[_0xcb55('0x2a')][_0xcb55('0x45')](_0x43fd85)[_0xcb55('0x1f')](handleEntityNotFound(_0x2aaa60,null))['then'](respondWithResult(_0x2aaa60,null))[_0xcb55('0x3f')](handleError(_0x2aaa60,null));};exports[_0xcb55('0x46')]=function(_0x530ed3,_0xd17a98){return db[_0xcb55('0x2a')]['create'](_0x530ed3['body'],{})[_0xcb55('0x1f')](function(_0xa6948c){var _0x262f1d=_0x530ed3[_0xcb55('0x47')][_0xcb55('0x48')]({'plain':!![]});if(!_0x262f1d)throw new Error(_0xcb55('0x49'));if(_0x262f1d['role']===_0xcb55('0x47')){var _0x1dd983=_0xa6948c[_0xcb55('0x48')]({'plain':!![]});var _0x31d253=_0xcb55('0x21');return db[_0xcb55('0x4a')][_0xcb55('0x45')]({'where':{'name':_0x31d253,'userProfileId':_0x262f1d['userProfileId']},'raw':!![]})[_0xcb55('0x1f')](function(_0x49a996){if(_0x49a996&&_0x49a996[_0xcb55('0x4b')]===0x0){return db[_0xcb55('0x22')][_0xcb55('0x46')]({'name':_0x1dd983[_0xcb55('0x27')],'resourceId':_0x1dd983['id'],'type':_0x49a996['name'],'sectionId':_0x49a996['id']},{})[_0xcb55('0x1f')](function(){return _0xa6948c;});}else{return _0xa6948c;}})[_0xcb55('0x3f')](function(_0x2e6eda){logger[_0xcb55('0x25')](_0xcb55('0x4c'),_0x2e6eda);throw _0x2e6eda;});}return _0xa6948c;})[_0xcb55('0x1f')](respondWithResult(_0xd17a98,0xc9))[_0xcb55('0x3f')](handleError(_0xd17a98,null));};exports['update']=function(_0x1f0e01,_0x3a5595){if(_0x1f0e01[_0xcb55('0x4d')]['id']){delete _0x1f0e01[_0xcb55('0x4d')]['id'];}return db[_0xcb55('0x2a')][_0xcb55('0x45')]({'where':{'id':_0x1f0e01[_0xcb55('0x41')]['id']}})[_0xcb55('0x1f')](handleEntityNotFound(_0x3a5595,null))[_0xcb55('0x1f')](saveUpdates(_0x1f0e01['body'],null))[_0xcb55('0x1f')](respondWithResult(_0x3a5595,null))['catch'](handleError(_0x3a5595,null));};exports[_0xcb55('0x20')]=function(_0x38fd62,_0x4ee9c9){return db[_0xcb55('0x2a')][_0xcb55('0x45')]({'where':{'id':_0x38fd62[_0xcb55('0x41')]['id']}})[_0xcb55('0x1f')](handleEntityNotFound(_0x4ee9c9,null))['then'](removeEntity(_0x4ee9c9,null))['catch'](handleError(_0x4ee9c9,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index cee865d..5514355 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 _0xda01=['tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports','define'];(function(_0x29dbe9,_0x4e9351){var _0x24ce13=function(_0x310d65){while(--_0x310d65){_0x29dbe9['push'](_0x29dbe9['shift']());}};_0x24ce13(++_0x4e9351);}(_0xda01,0x17d));var _0x1da0=function(_0x4880f0,_0x38b3d3){_0x4880f0=_0x4880f0-0x0;var _0x47a088=_0xda01[_0x4880f0];return _0x47a088;};'use strict';var _=require(_0x1da0('0x0'));var util=require(_0x1da0('0x1'));var logger=require(_0x1da0('0x2'))(_0x1da0('0x3'));var moment=require(_0x1da0('0x4'));var BPromise=require(_0x1da0('0x5'));var rp=require(_0x1da0('0x6'));var attributes=require('./pause.attributes');module[_0x1da0('0x7')]=function(_0x33b1d4,_0x10b1e8){return _0x33b1d4[_0x1da0('0x8')]('Pause',attributes,{'tableName':_0x1da0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59cf=['../../config/logger','moment','bluebird','./pause.attributes','exports','define','Pause','tools_pauses','util'];(function(_0x5031ac,_0x38c7ed){var _0x4767f1=function(_0x3417a2){while(--_0x3417a2){_0x5031ac['push'](_0x5031ac['shift']());}};_0x4767f1(++_0x38c7ed);}(_0x59cf,0x167));var _0xf59c=function(_0x1a8bbc,_0x17a086){_0x1a8bbc=_0x1a8bbc-0x0;var _0x212fc2=_0x59cf[_0x1a8bbc];return _0x212fc2;};'use strict';var _=require('lodash');var util=require(_0xf59c('0x0'));var logger=require(_0xf59c('0x1'))('api');var moment=require(_0xf59c('0x2'));var BPromise=require(_0xf59c('0x3'));var rp=require('request-promise');var attributes=require(_0xf59c('0x4'));module[_0xf59c('0x5')]=function(_0x33efbb,_0x4844fd){return _0x33efbb[_0xf59c('0x6')](_0xf59c('0x7'),attributes,{'tableName':_0xf59c('0x8'),'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 0ae83be..b7d8252 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 _0x6ede=['../../config/environment','jayson/promise','http','request','info','Pause,\x20%s,\x20%s','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','ShowPause','Pause','options','raw','where','include','map','attributes','model','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x18fd4b,_0x475e2e){var _0xe5d6b4=function(_0x591c9b){while(--_0x591c9b){_0x18fd4b['push'](_0x18fd4b['shift']());}};_0xe5d6b4(++_0x475e2e);}(_0x6ede,0x83));var _0xe6ed=function(_0x1cd577,_0x180f2a){_0x1cd577=_0x1cd577-0x0;var _0x790837=_0x6ede[_0x1cd577];return _0x790837;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe6ed('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe6ed('0x1'));var db=require(_0xe6ed('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xe6ed('0x3'))('rpc');var config=require(_0xe6ed('0x4'));var jayson=require(_0xe6ed('0x5'));var client=jayson['client'][_0xe6ed('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x389397,_0x2b58cd,_0x2d4657){return new BPromise(function(_0xdcff96,_0x3e3b6f){return client[_0xe6ed('0x7')](_0x389397,_0x2d4657)['then'](function(_0x58e859){logger[_0xe6ed('0x8')](_0xe6ed('0x9'),_0x2b58cd,'request\x20sent');logger[_0xe6ed('0xa')](_0xe6ed('0xb'),_0x2b58cd,'request\x20sent',JSON[_0xe6ed('0xc')](_0x58e859));if(_0x58e859[_0xe6ed('0xd')]){if(_0x58e859[_0xe6ed('0xd')][_0xe6ed('0xe')]===0x1f4){logger['error'](_0xe6ed('0x9'),_0x2b58cd,_0x58e859['error']['message']);return _0x3e3b6f(_0x58e859[_0xe6ed('0xd')][_0xe6ed('0xf')]);}logger[_0xe6ed('0xd')](_0xe6ed('0x9'),_0x2b58cd,_0x58e859[_0xe6ed('0xd')][_0xe6ed('0xf')]);return _0xdcff96(_0x58e859[_0xe6ed('0xd')][_0xe6ed('0xf')]);}else{logger[_0xe6ed('0x8')](_0xe6ed('0x9'),_0x2b58cd,_0xe6ed('0x10'));_0xdcff96(_0x58e859['result'][_0xe6ed('0xf')]);}})[_0xe6ed('0x11')](function(_0x49dadb){logger[_0xe6ed('0xd')](_0xe6ed('0x9'),_0x2b58cd,_0x49dadb);_0x3e3b6f(_0x49dadb);});});}exports[_0xe6ed('0x12')]=function(_0xfc7078){var _0x2dd04c=this;return new Promise(function(_0x147a8c,_0x2ebf01){return db[_0xe6ed('0x13')]['find']({'raw':_0xfc7078['options']?_0xfc7078[_0xe6ed('0x14')][_0xe6ed('0x15')]===undefined?!![]:![]:!![],'where':_0xfc7078[_0xe6ed('0x14')]?_0xfc7078['options'][_0xe6ed('0x16')]||null:null,'attributes':_0xfc7078['options']?_0xfc7078[_0xe6ed('0x14')]['attributes']||null:null,'include':_0xfc7078[_0xe6ed('0x14')]?_0xfc7078['options'][_0xe6ed('0x17')]?_[_0xe6ed('0x18')](_0xfc7078['options'][_0xe6ed('0x17')],function(_0xf1886d){return{'model':db[_0xf1886d['model']],'as':_0xf1886d['as'],'attributes':_0xf1886d[_0xe6ed('0x19')],'include':_0xf1886d[_0xe6ed('0x17')]?_[_0xe6ed('0x18')](_0xf1886d['include'],function(_0x468e56){return{'model':db[_0x468e56[_0xe6ed('0x1a')]],'as':_0x468e56['as'],'attributes':_0x468e56[_0xe6ed('0x19')],'include':_0x468e56[_0xe6ed('0x17')]?_['map'](_0x468e56[_0xe6ed('0x17')],function(_0x4438f9){return{'model':db[_0x4438f9[_0xe6ed('0x1a')]],'as':_0x4438f9['as'],'attributes':_0x4438f9[_0xe6ed('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5724eb){logger['info'](_0xe6ed('0x12'),_0xfc7078);logger['debug'](_0xe6ed('0x12'),_0xfc7078,JSON[_0xe6ed('0xc')](_0x5724eb));_0x147a8c(_0x5724eb);})[_0xe6ed('0x11')](function(_0x5ecf2f){logger['error']('ShowPause',_0x5ecf2f[_0xe6ed('0xf')],_0xfc7078);_0x2ebf01(_0x2dd04c[_0xe6ed('0xd')](0x1f4,_0x5ecf2f[_0xe6ed('0xf')]));});});}; \ No newline at end of file +var _0x9926=['then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Pause','find','options','raw','attributes','include','map','ShowPause','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0xe6f4ef,_0x4e34cc){var _0x4f3447=function(_0x1538ff){while(--_0x1538ff){_0xe6f4ef['push'](_0xe6f4ef['shift']());}};_0x4f3447(++_0x4e34cc);}(_0x9926,0x104));var _0x6992=function(_0x277536,_0x6eb914){_0x277536=_0x277536-0x0;var _0x599753=_0x9926[_0x277536];return _0x599753;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6992('0x0'));var BPromise=require(_0x6992('0x1'));var rs=require(_0x6992('0x2'));var fs=require('fs');var Redis=require(_0x6992('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6992('0x4'))('rpc');var config=require(_0x6992('0x5'));var jayson=require(_0x6992('0x6'));var client=jayson[_0x6992('0x7')][_0x6992('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3367ba,_0x498654,_0x143717){return new BPromise(function(_0x45d70b,_0xb30ada){return client[_0x6992('0x9')](_0x3367ba,_0x143717)[_0x6992('0xa')](function(_0x3d3e33){logger[_0x6992('0xb')](_0x6992('0xc'),_0x498654,_0x6992('0xd'));logger[_0x6992('0xe')](_0x6992('0xf'),_0x498654,_0x6992('0xd'),JSON[_0x6992('0x10')](_0x3d3e33));if(_0x3d3e33[_0x6992('0x11')]){if(_0x3d3e33[_0x6992('0x11')][_0x6992('0x12')]===0x1f4){logger['error'](_0x6992('0xc'),_0x498654,_0x3d3e33[_0x6992('0x11')][_0x6992('0x13')]);return _0xb30ada(_0x3d3e33[_0x6992('0x11')][_0x6992('0x13')]);}logger['error'](_0x6992('0xc'),_0x498654,_0x3d3e33[_0x6992('0x11')][_0x6992('0x13')]);return _0x45d70b(_0x3d3e33['error'][_0x6992('0x13')]);}else{logger[_0x6992('0xb')](_0x6992('0xc'),_0x498654,_0x6992('0xd'));_0x45d70b(_0x3d3e33[_0x6992('0x14')]['message']);}})[_0x6992('0x15')](function(_0x1281ee){logger['error']('Pause,\x20%s,\x20%s',_0x498654,_0x1281ee);_0xb30ada(_0x1281ee);});});}exports['ShowPause']=function(_0x5ba968){var _0x533e5c=this;return new Promise(function(_0x3a51e4,_0x4023c7){return db[_0x6992('0x16')][_0x6992('0x17')]({'raw':_0x5ba968[_0x6992('0x18')]?_0x5ba968[_0x6992('0x18')][_0x6992('0x19')]===undefined?!![]:![]:!![],'where':_0x5ba968[_0x6992('0x18')]?_0x5ba968[_0x6992('0x18')]['where']||null:null,'attributes':_0x5ba968[_0x6992('0x18')]?_0x5ba968[_0x6992('0x18')][_0x6992('0x1a')]||null:null,'include':_0x5ba968[_0x6992('0x18')]?_0x5ba968['options'][_0x6992('0x1b')]?_[_0x6992('0x1c')](_0x5ba968['options'][_0x6992('0x1b')],function(_0xb20479){return{'model':db[_0xb20479['model']],'as':_0xb20479['as'],'attributes':_0xb20479[_0x6992('0x1a')],'include':_0xb20479[_0x6992('0x1b')]?_[_0x6992('0x1c')](_0xb20479['include'],function(_0x35e3ac){return{'model':db[_0x35e3ac['model']],'as':_0x35e3ac['as'],'attributes':_0x35e3ac[_0x6992('0x1a')],'include':_0x35e3ac[_0x6992('0x1b')]?_[_0x6992('0x1c')](_0x35e3ac[_0x6992('0x1b')],function(_0x2d912e){return{'model':db[_0x2d912e['model']],'as':_0x2d912e['as'],'attributes':_0x2d912e[_0x6992('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x302afd){logger[_0x6992('0xb')](_0x6992('0x1d'),_0x5ba968);logger[_0x6992('0xe')](_0x6992('0x1d'),_0x5ba968,JSON[_0x6992('0x10')](_0x302afd));_0x3a51e4(_0x302afd);})[_0x6992('0x15')](function(_0x17116b){logger[_0x6992('0x11')](_0x6992('0x1d'),_0x17116b[_0x6992('0x13')],_0x5ba968);_0x4023c7(_0x533e5c[_0x6992('0x11')](0x1f4,_0x17116b[_0x6992('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index d2dbf0e..83d77ef 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 _0x243a=['join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','post','file','upload','webhookPost','put','/:id','update','delete','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','/webhook','webhookGet','isAuthenticated','show','download','diskStorage'];(function(_0x47b0d9,_0x41b561){var _0x599df3=function(_0x4c0c30){while(--_0x4c0c30){_0x47b0d9['push'](_0x47b0d9['shift']());}};_0x599df3(++_0x41b561);}(_0x243a,0x147));var _0xa243=function(_0x596c8f,_0x21ce52){_0x596c8f=_0x596c8f-0x0;var _0x1c9ef4=_0x243a[_0x596c8f];return _0x1c9ef4;};'use strict';var multer=require('multer');var util=require(_0xa243('0x0'));var path=require('path');var timeout=require(_0xa243('0x1'));var express=require(_0xa243('0x2'));var router=express['Router']();var auth=require(_0xa243('0x3'));var interaction=require(_0xa243('0x4'));var config=require(_0xa243('0x5'));var controller=require(_0xa243('0x6'));router[_0xa243('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa243('0x8'),controller[_0xa243('0x9')]);router[_0xa243('0x7')]('/:id',auth[_0xa243('0xa')](),controller[_0xa243('0xb')]);router[_0xa243('0x7')]('/:id/download',auth[_0xa243('0xa')](),controller[_0xa243('0xc')]);var upload=multer({'storage':multer[_0xa243('0xd')]({'destination':function(_0x50e7d8,_0x55bdd8,_0x5da29a){_0x5da29a(null,path[_0xa243('0xe')](config['root'],_0xa243('0xf')));},'filename':function(_0x30d7c0,_0x1adfe7,_0x65e736){_0x1adfe7[_0xa243('0x10')]=_0x1adfe7[_0xa243('0x10')][_0xa243('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x65e736(null,util[_0xa243('0x12')](_0xa243('0x13'),path[_0xa243('0x14')](_0x1adfe7[_0xa243('0x10')],path['extname'](_0x1adfe7[_0xa243('0x10')])),Date['now'](),path[_0xa243('0x15')](_0x1adfe7['originalname'])));}})});router[_0xa243('0x16')]('/',upload['single'](_0xa243('0x17')),controller[_0xa243('0x18')]);router[_0xa243('0x16')](_0xa243('0x8'),controller[_0xa243('0x19')]);router[_0xa243('0x1a')](_0xa243('0x1b'),auth[_0xa243('0xa')](),controller[_0xa243('0x1c')]);router[_0xa243('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0xa243('0x1d')]);module[_0xa243('0x1e')]=router; \ No newline at end of file +var _0x612f=['get','isAuthenticated','index','webhookGet','show','/:id/download','download','join','root','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','upload','/webhook','webhookPost','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./plugin.controller'];(function(_0x15a8fa,_0x4652b2){var _0x1355c2=function(_0x203292){while(--_0x203292){_0x15a8fa['push'](_0x15a8fa['shift']());}};_0x1355c2(++_0x4652b2);}(_0x612f,0xa1));var _0xf612=function(_0x7785,_0x4c65e2){_0x7785=_0x7785-0x0;var _0x598959=_0x612f[_0x7785];return _0x598959;};'use strict';var multer=require(_0xf612('0x0'));var util=require(_0xf612('0x1'));var path=require(_0xf612('0x2'));var timeout=require(_0xf612('0x3'));var express=require(_0xf612('0x4'));var router=express[_0xf612('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf612('0x6'));var config=require(_0xf612('0x7'));var controller=require(_0xf612('0x8'));router[_0xf612('0x9')]('/',auth[_0xf612('0xa')](),controller[_0xf612('0xb')]);router[_0xf612('0x9')]('/webhook',controller[_0xf612('0xc')]);router[_0xf612('0x9')]('/:id',auth[_0xf612('0xa')](),controller[_0xf612('0xd')]);router['get'](_0xf612('0xe'),auth['isAuthenticated'](),controller[_0xf612('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x382cda,_0x1e1e89,_0x545647){_0x545647(null,path[_0xf612('0x10')](config[_0xf612('0x11')],'server/files/plugins'));},'filename':function(_0x25950b,_0x185e39,_0x43e15d){_0x185e39[_0xf612('0x12')]=_0x185e39['originalname'][_0xf612('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x43e15d(null,util[_0xf612('0x14')](_0xf612('0x15'),path[_0xf612('0x16')](_0x185e39[_0xf612('0x12')],path[_0xf612('0x17')](_0x185e39[_0xf612('0x12')])),Date[_0xf612('0x18')](),path[_0xf612('0x17')](_0x185e39[_0xf612('0x12')])));}})});router[_0xf612('0x19')]('/',upload[_0xf612('0x1a')]('file'),controller[_0xf612('0x1b')]);router[_0xf612('0x19')](_0xf612('0x1c'),controller[_0xf612('0x1d')]);router['put'](_0xf612('0x1e'),auth[_0xf612('0xa')](),controller[_0xf612('0x1f')]);router[_0xf612('0x20')](_0xf612('0x1e'),auth['isAuthenticated'](),controller[_0xf612('0x20')]);module[_0xf612('0x21')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 60c969f..ad2e942 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 _0x424c=['never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','ENUM','html','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly'];(function(_0x47ae1f,_0x328d68){var _0x2a0233=function(_0x53dd41){while(--_0x53dd41){_0x47ae1f['push'](_0x47ae1f['shift']());}};_0x2a0233(++_0x328d68);}(_0x424c,0x14d));var _0xc424=function(_0x4101ab,_0x1777e6){_0x4101ab=_0x4101ab-0x0;var _0x4eaf40=_0x424c[_0x4101ab];return _0x4eaf40;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc424('0x0')](_0xc424('0x1'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xc424('0x2')]},'path':{'type':Sequelize[_0xc424('0x3')],'comment':_0xc424('0x4')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xc424('0x5')},'sidebar':{'type':Sequelize[_0xc424('0x0')]('adminOnly',_0xc424('0x6'),'always',_0xc424('0x7')),'defaultValue':_0xc424('0x8'),'comment':_0xc424('0x9')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xc424('0x3')]},'agentUrl':{'type':Sequelize[_0xc424('0x3')]},'scriptName':{'type':Sequelize[_0xc424('0x3')]},'scriptPath':{'type':Sequelize[_0xc424('0x3')]}}; \ No newline at end of file +var _0xf3f8=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','html','script','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','adminOnly','always','never'];(function(_0xd81c62,_0x3d2a84){var _0x556aa2=function(_0x3e90c5){while(--_0x3e90c5){_0xd81c62['push'](_0xd81c62['shift']());}};_0x556aa2(++_0x3d2a84);}(_0xf3f8,0x109));var _0x8f3f=function(_0x589ca9,_0x5563f3){_0x589ca9=_0x589ca9-0x0;var _0x4d9574=_0xf3f8[_0x589ca9];return _0x4d9574;};'use strict';var Sequelize=require(_0x8f3f('0x0'));module[_0x8f3f('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8f3f('0x2')](_0x8f3f('0x3'),_0x8f3f('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x8f3f('0x5')],'comment':_0x8f3f('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x8f3f('0x2')](_0x8f3f('0x7'),'agentOnly',_0x8f3f('0x8'),_0x8f3f('0x9')),'defaultValue':'always','comment':_0x8f3f('0xa')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x8f3f('0x5')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x8f3f('0x5')]},'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 49eb240..9b815a0 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 _0x7c84=['api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','then','get','Plugins','destroy','stack','name','send','index','rawAttributes','model','query','keys','filters','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','map','type','key','field','filter','options','Plugin','include','findAll','rows','catch','show','params','attributes','includeAll','find','root','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','code','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','dirname','join','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','undefined','Invalid\x20manifest:\x20type\x20missing','parameters','html','Invalid\x20manifest:\x20views\x20missing','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','scriptPath','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','endsWith','statusCode','webhookPost','port','method','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../config/license/hardware','extract-zip','archiver'];(function(_0x7e9f1a,_0x3d422b){var _0x546cba=function(_0x599316){while(--_0x599316){_0x7e9f1a['push'](_0x7e9f1a['shift']());}};_0x546cba(++_0x3d422b);}(_0x7c84,0x1db));var _0x47c8=function(_0x5cc227,_0x3eb84f){_0x5cc227=_0x5cc227-0x0;var _0x3f0ff2=_0x7c84[_0x5cc227];return _0x3f0ff2;};'use strict';var pdf=require(_0x47c8('0x0'));var emlformat=require(_0x47c8('0x1'));var rimraf=require(_0x47c8('0x2'));var zipdir=require(_0x47c8('0x3'));var jsonpatch=require(_0x47c8('0x4'));var rp=require(_0x47c8('0x5'));var moment=require(_0x47c8('0x6'));var BPromise=require(_0x47c8('0x7'));var Mustache=require(_0x47c8('0x8'));var util=require(_0x47c8('0x9'));var path=require(_0x47c8('0xa'));var sox=require(_0x47c8('0xb'));var csv=require(_0x47c8('0xc'));var ejs=require(_0x47c8('0xd'));var fs=require('fs');var _=require(_0x47c8('0xe'));var squel=require(_0x47c8('0xf'));var crypto=require(_0x47c8('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x47c8('0x11'));var toCsv=require(_0x47c8('0xc'));var querystring=require(_0x47c8('0x12'));var Papa=require(_0x47c8('0x13'));var authService=require('../../components/auth/service');var hardwareService=require(_0x47c8('0x14'));var Redis=require('ioredis');var extract=require(_0x47c8('0x15'));var rimraf=require('rimraf');var archiver=require(_0x47c8('0x16'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x47c8('0x17'));var utils=require(_0x47c8('0x18'));var config=require(_0x47c8('0x19'));var db=require(_0x47c8('0x1a'))['db'];config[_0x47c8('0x1b')]=_[_0x47c8('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x47c8('0x1d'))(new Redis(config[_0x47c8('0x1b')]));require(_0x47c8('0x1e'))[_0x47c8('0x1f')](socket);function respondWithStatusCode(_0x6fe2f7,_0x950cf7){_0x950cf7=_0x950cf7||0xcc;return function(_0x325ed6){if(_0x325ed6){return _0x6fe2f7[_0x47c8('0x20')](_0x950cf7);}return _0x6fe2f7[_0x47c8('0x21')](_0x950cf7)[_0x47c8('0x22')]();};}function respondWithResult(_0x4969c2,_0x151c0e){_0x151c0e=_0x151c0e||0xc8;return function(_0x326374){if(_0x326374){return _0x4969c2['status'](_0x151c0e)[_0x47c8('0x23')](_0x326374);}};}function respondWithFilteredResult(_0x5d1407,_0x51de51){return function(_0x3f76fb){if(_0x3f76fb){var _0x52fc4e=_0x3f76fb[_0x47c8('0x24')],_0x54815c=_0x51de51['offset'],_0x59ab71=_0x51de51[_0x47c8('0x25')]+_0x51de51[_0x47c8('0x26')],_0x4d3b50;if(_0x59ab71>=_0x52fc4e){_0x59ab71=_0x52fc4e;_0x4d3b50=0xc8;}else{_0x4d3b50=0xce;}_0x5d1407[_0x47c8('0x21')](_0x4d3b50);return _0x5d1407[_0x47c8('0x27')](_0x47c8('0x28'),_0x54815c+'-'+_0x59ab71+'/'+_0x52fc4e)[_0x47c8('0x23')](_0x3f76fb);}return null;};}function patchUpdates(_0x490661){return function(_0x3e2ead){try{jsonpatch['apply'](_0x3e2ead,_0x490661,!![]);}catch(_0x206299){return BPromise['reject'](_0x206299);}return _0x3e2ead['save']();};}function saveUpdates(_0xa16524,_0x36e07c){return function(_0xa9e581){if(_0xa9e581){return _0xa9e581['update'](_0xa16524)[_0x47c8('0x29')](function(_0x54e06f){return _0x54e06f;});}return null;};}function removeEntity(_0x1d0bde,_0x14efd8){return function(_0x1cafc7){if(_0x1cafc7){return _0x1cafc7['destroy']()[_0x47c8('0x29')](function(){var _0x400498=_0x1cafc7[_0x47c8('0x2a')]({'plain':!![]});var _0x57f053=_0x47c8('0x2b');return db['UserProfileResource'][_0x47c8('0x2c')]({'where':{'type':_0x57f053,'resourceId':_0x400498['id']}})['then'](function(){return _0x1cafc7;});})['then'](function(){_0x1d0bde[_0x47c8('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x305035,_0x1294a7){return function(_0x202044){if(!_0x202044){_0x305035[_0x47c8('0x20')](0x194);}return _0x202044;};}function handleError(_0x4140b1,_0x2e6c99){_0x2e6c99=_0x2e6c99||0x1f4;return function(_0x21f8bb){logger['error'](_0x21f8bb[_0x47c8('0x2d')]);if(_0x21f8bb[_0x47c8('0x2e')]){delete _0x21f8bb[_0x47c8('0x2e')];}_0x4140b1[_0x47c8('0x21')](_0x2e6c99)[_0x47c8('0x2f')](_0x21f8bb);};}exports[_0x47c8('0x30')]=function(_0x514969,_0x3dc908){var _0x2512c2={},_0x5a4817={},_0x2bceb5={'count':0x0,'rows':[]};var _0x4149bd=db['Plugin'][_0x47c8('0x31')];_0x5a4817[_0x47c8('0x32')]=_['keys'](_0x4149bd);_0x5a4817[_0x47c8('0x33')]=_[_0x47c8('0x34')](_0x514969[_0x47c8('0x33')]);_0x5a4817[_0x47c8('0x35')]=_[_0x47c8('0x36')](_0x5a4817[_0x47c8('0x32')],_0x5a4817[_0x47c8('0x33')]);_0x2512c2['attributes']=_[_0x47c8('0x36')](_0x5a4817[_0x47c8('0x32')],qs['fields'](_0x514969[_0x47c8('0x33')][_0x47c8('0x37')]));_0x2512c2['attributes']=_0x2512c2['attributes'][_0x47c8('0x38')]?_0x2512c2['attributes']:_0x5a4817[_0x47c8('0x32')];if(!_0x514969[_0x47c8('0x33')][_0x47c8('0x39')]('nolimit')){_0x2512c2['limit']=qs[_0x47c8('0x26')](_0x514969[_0x47c8('0x33')][_0x47c8('0x26')]);_0x2512c2['offset']=qs['offset'](_0x514969[_0x47c8('0x33')][_0x47c8('0x25')]);}_0x2512c2[_0x47c8('0x3a')]=qs['sort'](_0x514969[_0x47c8('0x33')][_0x47c8('0x3b')]);_0x2512c2[_0x47c8('0x3c')]=qs[_0x47c8('0x35')](_[_0x47c8('0x3d')](_0x514969['query'],_0x5a4817[_0x47c8('0x35')]));if(_0x514969[_0x47c8('0x33')]['filter']){_0x2512c2[_0x47c8('0x3c')]=_[_0x47c8('0x3e')](_0x2512c2['where'],{'$or':_[_0x47c8('0x3f')](_0x4149bd,function(_0x540ce8){if(_0x540ce8[_0x47c8('0x40')][_0x47c8('0x41')]!=='VIRTUAL'){var _0x25a6b2={};_0x25a6b2[_0x540ce8[_0x47c8('0x42')]]={'$like':'%'+_0x514969[_0x47c8('0x33')][_0x47c8('0x43')]+'%'};return _0x25a6b2;}})});}_0x2512c2=_[_0x47c8('0x3e')]({},_0x2512c2,_0x514969[_0x47c8('0x44')]);var _0x521d93={'where':_0x2512c2['where']};return db[_0x47c8('0x45')][_0x47c8('0x24')](_0x521d93)[_0x47c8('0x29')](function(_0x37d636){_0x2bceb5[_0x47c8('0x24')]=_0x37d636;if(_0x514969[_0x47c8('0x33')]['includeAll']){_0x2512c2[_0x47c8('0x46')]=[{'all':!![]}];}return db['Plugin'][_0x47c8('0x47')](_0x2512c2);})[_0x47c8('0x29')](function(_0x1f218e){_0x2bceb5[_0x47c8('0x48')]=_0x1f218e;return _0x2bceb5;})['then'](respondWithFilteredResult(_0x3dc908,_0x2512c2))[_0x47c8('0x49')](handleError(_0x3dc908,null));};exports[_0x47c8('0x4a')]=function(_0x36b24a,_0x109931){var _0x33a698={'raw':!![],'where':{'id':_0x36b24a[_0x47c8('0x4b')]['id']}},_0x25fba1={};_0x25fba1['model']=_[_0x47c8('0x34')](db[_0x47c8('0x45')][_0x47c8('0x31')]);_0x25fba1[_0x47c8('0x33')]=_[_0x47c8('0x34')](_0x36b24a[_0x47c8('0x33')]);_0x25fba1[_0x47c8('0x35')]=_[_0x47c8('0x36')](_0x25fba1[_0x47c8('0x32')],_0x25fba1[_0x47c8('0x33')]);_0x33a698[_0x47c8('0x4c')]=_[_0x47c8('0x36')](_0x25fba1[_0x47c8('0x32')],qs['fields'](_0x36b24a[_0x47c8('0x33')][_0x47c8('0x37')]));_0x33a698[_0x47c8('0x4c')]=_0x33a698[_0x47c8('0x4c')][_0x47c8('0x38')]?_0x33a698[_0x47c8('0x4c')]:_0x25fba1[_0x47c8('0x32')];if(_0x36b24a[_0x47c8('0x33')][_0x47c8('0x4d')]){_0x33a698[_0x47c8('0x46')]=[{'all':!![]}];}_0x33a698=_[_0x47c8('0x3e')]({},_0x33a698,_0x36b24a[_0x47c8('0x44')]);return db[_0x47c8('0x45')][_0x47c8('0x4e')](_0x33a698)[_0x47c8('0x29')](handleEntityNotFound(_0x109931,null))[_0x47c8('0x29')](respondWithResult(_0x109931,null))[_0x47c8('0x49')](handleError(_0x109931,null));};exports['download']=function(_0x28d2ea,_0x325d54,_0x510faa){return db[_0x47c8('0x45')][_0x47c8('0x4e')]({'where':{'id':_0x28d2ea['params']['id']},'attributes':['name',_0x47c8('0xa')],'raw':!![]})['then'](handleEntityNotFound(_0x325d54,null))[_0x47c8('0x29')](function(_0x298aa0){if(_0x298aa0){var _0x1a19ce=path['join'](config[_0x47c8('0x4f')],_0x47c8('0x50'),util[_0x47c8('0x51')](_0x47c8('0x52'),path['basename'](_0x298aa0['path'])));var _0x25a697=fs[_0x47c8('0x53')](_0x1a19ce);var _0x3207c7=archiver(_0x47c8('0x54'),{'zlib':{'level':0x9}});_0x3207c7['on'](_0x47c8('0x55'),function(_0x219a3c){if(_0x219a3c[_0x47c8('0x56')]===_0x47c8('0x57')){logger[_0x47c8('0x58')](_0x219a3c);}else{throw new db[(_0x47c8('0x59'))][(_0x47c8('0x5a'))](_0x47c8('0x5b'));}});_0x3207c7['on'](_0x47c8('0x58'),function(_0x1bfd76){throw new db[(_0x47c8('0x59'))][(_0x47c8('0x5a'))](_0x47c8('0x5b'));});_0x3207c7[_0x47c8('0x5c')](_0x25a697);_0x3207c7[_0x47c8('0x5d')]('**/*',{'cwd':path['join'](config[_0x47c8('0x4f')],'server/files/plugins',path[_0x47c8('0x5e')](_0x298aa0[_0x47c8('0xa')])),'ignore':[path[_0x47c8('0x5f')](path[_0x47c8('0x60')](_0x298aa0[_0x47c8('0xa')]),_0x47c8('0x61')),path[_0x47c8('0x5f')](path[_0x47c8('0x60')](_0x298aa0['path']),_0x47c8('0x62'))],'nodir':!![]})[_0x47c8('0x63')]();_0x25a697['on'](_0x47c8('0x64'),function(){if(!fs[_0x47c8('0x65')](_0x1a19ce)){throw new db[(_0x47c8('0x59'))][(_0x47c8('0x5a'))](_0x47c8('0x66'));}return _0x325d54[_0x47c8('0x67')](_0x1a19ce,util['format'](_0x47c8('0x52'),path[_0x47c8('0x60')](_0x298aa0[_0x47c8('0xa')])),function(_0xea55bd){if(_0xea55bd){throw new db['Sequelize']['Error'](_0x47c8('0x68'));}fs['unlinkSync'](_0x1a19ce);logger[_0x47c8('0x69')](_0x47c8('0x6a'));logger['info']('Temporary\x20file\x20removed');});});}return null;})[_0x47c8('0x49')](handleError(_0x325d54,null));};exports[_0x47c8('0x6b')]=function(_0xb6b8fd,_0x3da4ac,_0x4f83a7){var _0x3b81c1=path[_0x47c8('0x60')](_0xb6b8fd[_0x47c8('0x6c')][_0x47c8('0x6d')],path[_0x47c8('0x6e')](_0xb6b8fd[_0x47c8('0x6c')][_0x47c8('0x6d')]));var _0x383e0e=path[_0x47c8('0x5f')](config['root'],_0x47c8('0x50'),_0xb6b8fd[_0x47c8('0x6c')][_0x47c8('0x6d')]);var _0x1411fe=path[_0x47c8('0x5f')](config[_0x47c8('0x4f')],_0x47c8('0x50'),_0x3b81c1);logger[_0x47c8('0x69')]('Plugin\x20upload\x20filepath:\x20%s',_0x383e0e);logger['info'](_0x47c8('0x6f'),_0x1411fe);try{fs[_0x47c8('0x70')](_0x383e0e,parseInt(_0x47c8('0x71'),0x8));extract(_0x383e0e,{'dir':_0x1411fe},function(_0x572d77){if(_0x572d77){logger['error'](_0x572d77);handleError(_0x572d77,!![]);};var _0x110304=fs[_0x47c8('0x72')](_0x1411fe);if(_0x110304[_0x47c8('0x38')]>0x1){removeReferences(_0x383e0e,_0x1411fe);logger[_0x47c8('0x58')](_0x47c8('0x73'));return _0x4f83a7(new Error(_0x47c8('0x73')));}var _0x131e6c=fs['lstatSync'](path['join'](_0x1411fe,_0x110304[0x0]));if(_0x131e6c[_0x47c8('0x74')]()){removeReferences(_0x383e0e,_0x1411fe);logger[_0x47c8('0x58')](_0x47c8('0x73'));return _0x4f83a7(new Error(_0x47c8('0x73')));}if(_0x131e6c['isDirectory']()){var _0x3992e9=fs[_0x47c8('0x72')](path[_0x47c8('0x5f')](_0x1411fe,_0x110304[0x0]));if(_0x3992e9[_0x47c8('0x38')]===0x0){removeReferences(_0x383e0e,_0x1411fe);logger[_0x47c8('0x58')](_0x47c8('0x73'));return _0x4f83a7(new Error(_0x47c8('0x73')));}var _0x2cea5a=_0x3992e9[_0x47c8('0x75')](function(_0xbd71ab){return _0xbd71ab==='manifest.json';});if(!_0x2cea5a){return _0x4f83a7(new Error(_0x47c8('0x76')));}var _0x41e14c=fs[_0x47c8('0x77')](path[_0x47c8('0x5f')](_0x1411fe,_0x110304[0x0],_0x47c8('0x78')));var _0x194ef1=JSON[_0x47c8('0x79')](_0x41e14c);if(_0x47c8('0x7a')==typeof _0x194ef1[_0x47c8('0x2e')]){return _0x4f83a7(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x194ef1[_0x47c8('0x40')]){return _0x4f83a7(new Error(_0x47c8('0x7b')));}if(_0x47c8('0x7a')==typeof _0x194ef1['version']){return _0x4f83a7(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x47c8('0x7a')==typeof _0x194ef1[_0x47c8('0x7c')]){return _0x4f83a7(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x194ef1['type']===_0x47c8('0x7d')){if(_0x47c8('0x7a')==typeof _0x194ef1['parameters']['views']){return _0x4f83a7(new Error(_0x47c8('0x7e')));}if(_0x47c8('0x7a')==typeof _0x194ef1[_0x47c8('0x7c')][_0x47c8('0x7f')][_0x47c8('0x80')]&&_0x47c8('0x7a')==typeof _0x194ef1[_0x47c8('0x7c')][_0x47c8('0x7f')]['agent']){return _0x4f83a7(new Error(_0x47c8('0x81')));}}else if(_0x194ef1['type']===_0x47c8('0x82')){if(_0x47c8('0x7a')==typeof _0x194ef1[_0x47c8('0x7c')][_0x47c8('0x83')]){return _0x4f83a7(new Error(_0x47c8('0x84')));}if(_0x47c8('0x7a')==typeof _0x194ef1[_0x47c8('0x7c')]['scriptPath']){return _0x4f83a7(new Error(_0x47c8('0x85')));}}else{return _0x4f83a7(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x2492c5=_0x194ef1[_0x47c8('0x2e')];var _0x475a23=_0x194ef1['description'];var _0x317922=_0x194ef1[_0x47c8('0x40')];var _0x2bf6b5=_0x194ef1[_0x47c8('0x86')]?_0x194ef1[_0x47c8('0x86')]:'always';var _0x2536d7=_0x194ef1[_0x47c8('0x87')]?_0x194ef1[_0x47c8('0x87')]:_0x47c8('0x88');var _0x45c3f8='';var _0x29f875='';var _0x35e91f='';var _0xf2ed7='';var _0x4e5a14=_0x194ef1['version'];if(_0x317922===_0x47c8('0x7d')){if(_0x47c8('0x7a')!=typeof _0x194ef1[_0x47c8('0x7c')][_0x47c8('0x7f')][_0x47c8('0x80')]){var _0xaae7bb=_0x194ef1[_0x47c8('0x7c')][_0x47c8('0x7f')][_0x47c8('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x47c8('0x89')](_0xaae7bb)){_0x45c3f8=path[_0x47c8('0x5f')](_0x47c8('0x8a'),_0x3b81c1,_0x110304[0x0],_0xaae7bb);}else{_0x45c3f8=_0xaae7bb;}}else{logger[_0x47c8('0x69')](_0x47c8('0x8b'));}if(_0x47c8('0x7a')!=typeof _0x194ef1[_0x47c8('0x7c')]['views'][_0x47c8('0x8c')]){var _0x56f6ea=_0x194ef1[_0x47c8('0x7c')]['views'][_0x47c8('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0x47c8('0x89')](_0x56f6ea)){_0x29f875=path[_0x47c8('0x5f')](_0x47c8('0x8a'),_0x3b81c1,_0x110304[0x0],_0x56f6ea);}else{_0x29f875=_0x56f6ea;}}else{logger[_0x47c8('0x69')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x317922==='script'){_0x35e91f=_0x194ef1['parameters'][_0x47c8('0x83')];_0xf2ed7=_0x194ef1['parameters'][_0x47c8('0x8d')];if(_0x47c8('0x7a')!=typeof _0x194ef1[_0x47c8('0x7c')]['views']){if('undefined'!=typeof _0x194ef1['parameters']['views'][_0x47c8('0x80')]){var _0xaae7bb=_0x194ef1[_0x47c8('0x7c')][_0x47c8('0x7f')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x47c8('0x89')](_0xaae7bb)){_0x45c3f8=path[_0x47c8('0x5f')](_0x47c8('0x8a'),_0x3b81c1,_0x110304[0x0],_0xaae7bb);}else{_0x45c3f8=_0xaae7bb;}}if('undefined'!=typeof _0x194ef1[_0x47c8('0x7c')][_0x47c8('0x7f')][_0x47c8('0x8c')]){var _0x56f6ea=_0x194ef1[_0x47c8('0x7c')]['views'][_0x47c8('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0x47c8('0x89')](_0x56f6ea)){_0x29f875=path[_0x47c8('0x5f')](_0x47c8('0x8a'),_0x3b81c1,_0x110304[0x0],_0x56f6ea);}else{_0x29f875=_0x56f6ea;}}}}var _0x1733b8={'name':_0x2492c5,'description':_0x475a23,'path':path[_0x47c8('0x5f')](_0x3b81c1,_0x110304[0x0]),'type':_0x317922,'sidebar':_0x2bf6b5,'icon':_0x2536d7,'adminUrl':_0x45c3f8,'agentUrl':_0x29f875,'scriptName':_0x35e91f,'scriptPath':_0xf2ed7,'version':_0x4e5a14};removeReferences(_0x383e0e,null);return db[_0x47c8('0x45')][_0x47c8('0x8e')](_0x1733b8)[_0x47c8('0x29')](function(_0x578d60){var _0x343194={'role':_0xb6b8fd[_0x47c8('0x8f')][_0x47c8('0x90')],'userProfileId':_0xb6b8fd[_0x47c8('0x8f')][_0x47c8('0x91')]};if(!_0x343194)throw new Error(_0x47c8('0x92'));if(_0x343194[_0x47c8('0x90')]==='user'){var _0x16a39d=_0x578d60[_0x47c8('0x2a')]({'plain':!![]});return db[_0x47c8('0x93')][_0x47c8('0x4e')]({'where':{'name':_0x47c8('0x2b'),'userProfileId':_0x343194['userProfileId']},'raw':!![]})[_0x47c8('0x29')](function(_0x34588c){if(_0x34588c&&_0x34588c['autoAssociation']===0x0){return db['UserProfileResource'][_0x47c8('0x8e')]({'name':_0x16a39d[_0x47c8('0x2e')],'resourceId':_0x16a39d['id'],'type':_0x34588c[_0x47c8('0x2e')],'sectionId':_0x34588c['id']},{})['then'](function(){return _0x578d60;});}else{return _0x578d60;}})['catch'](function(_0x3ede17){logger[_0x47c8('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ede17);throw _0x3ede17;});}return _0x578d60;})['then'](respondWithResult(_0x3da4ac,null))[_0x47c8('0x49')](handleError(_0x3da4ac,null));}});}catch(_0x463755){_0x3da4ac[_0x47c8('0x21')](0x1f4)[_0x47c8('0x2f')](_0x463755);}};function removeReferences(_0x5a072b,_0x5d82bf){try{if(_0x5a072b){fs['unlinkSync'](_0x5a072b);logger[_0x47c8('0x69')](_0x47c8('0x94'));}if(_0x5d82bf){rimraf(_0x5d82bf,function(){});logger[_0x47c8('0x69')](_0x47c8('0x95'));}}catch(_0x156d10){logger[_0x47c8('0x58')](_0x156d10);}}exports['update']=function(_0xfa6b83,_0x1cb7ff,_0x1da462){return db['Plugin'][_0x47c8('0x4e')]({'where':{'id':_0xfa6b83[_0x47c8('0x4b')]['id']}})[_0x47c8('0x29')](handleEntityNotFound(_0x1cb7ff,null))[_0x47c8('0x29')](saveUpdates(_0xfa6b83['body'],null))[_0x47c8('0x29')](respondWithResult(_0x1cb7ff,null))[_0x47c8('0x49')](handleError(_0x1cb7ff,null));};exports[_0x47c8('0x96')]=function(_0x461fa9,_0x21f203,_0xa64635){return db[_0x47c8('0x45')][_0x47c8('0x4e')]({'where':{'id':_0x461fa9[_0x47c8('0x4b')]['id']}})['then'](function(_0x44e2db){if(_0x44e2db){return _0x44e2db[_0x47c8('0x2c')]();}})[_0x47c8('0x29')](function(_0x29c1c6){rimraf(path[_0x47c8('0x5f')](config[_0x47c8('0x4f')],_0x47c8('0x50'),path[_0x47c8('0x5e')](_0x29c1c6[_0x47c8('0xa')])),function(){});return _0x29c1c6;})['then'](handleEntityNotFound(_0x21f203,null))[_0x47c8('0x29')](respondWithStatusCode(_0x21f203,null))[_0x47c8('0x49')](handleError(_0x21f203,null));};exports[_0x47c8('0x97')]=function(_0x484a6d,_0x4f1c01,_0x22b040){return BPromise[_0x47c8('0x98')]()['then'](function(){if(!_0x484a6d['query'][_0x47c8('0xa')]){throw new Error(_0x47c8('0x99'));}if(!_0x484a6d[_0x47c8('0x33')]['port']){throw new Error(_0x47c8('0x9a'));}var _0x56f049=_0x484a6d[_0x47c8('0x33')][_0x47c8('0x9b')]?_0x484a6d[_0x47c8('0x33')][_0x47c8('0x9b')]+':'+_0x484a6d['query']['port']:_0x47c8('0x9c')+_0x484a6d[_0x47c8('0x33')]['port'];var _0x1c0b1a=_0x484a6d[_0x47c8('0x33')][_0x47c8('0x23')]?_0x484a6d[_0x47c8('0x33')][_0x47c8('0x23')]:!![];var _0x4b1119=_0x484a6d[_0x47c8('0x33')][_0x47c8('0x9d')]?_0x484a6d['query']['encoding']:null;var _0x597bc7={'method':_0x484a6d['method'],'uri':util[_0x47c8('0x51')](_0x47c8('0x9e'),_0x56f049,_0x484a6d[_0x47c8('0x33')][_0x47c8('0xa')]),'json':_0x1c0b1a,'resolveWithFullResponse':!![],'encoding':_0x4b1119,'qs':_0x484a6d[_0x47c8('0x33')]};if(_0x484a6d[_0x47c8('0x9f')]){_0x597bc7[_0x47c8('0x9f')]=_0x484a6d[_0x47c8('0x9f')];if(_0x597bc7[_0x47c8('0x9f')][_0x47c8('0xa0')]){delete _0x597bc7['headers'][_0x47c8('0xa0')];}}return rp(_0x597bc7);})[_0x47c8('0x29')](function(_0x4d9811){if(_0x4d9811){_0x4f1c01['set'](_0x4d9811['headers']);logger['info'](_0x4d9811[_0x47c8('0x8f')]);if(_[_0x47c8('0xa1')](_0x484a6d[_0x47c8('0x33')][_0x47c8('0xa')],_0x47c8('0x67'))&&_0x4d9811[_0x47c8('0xa2')]==0x1f4){return _0x4f1c01[_0x47c8('0x20')](_0x4d9811[_0x47c8('0xa2')]);}else{return _0x4f1c01['status'](_0x4d9811[_0x47c8('0xa2')])[_0x47c8('0x2f')](_0x4d9811[_0x47c8('0x8f')]);}}else{return _0x4f1c01[_0x47c8('0x20')](0xc8);}})['catch'](handleError(_0x4f1c01,null));};exports[_0x47c8('0xa3')]=function(_0x4e1bbf,_0x3c8813,_0x13949f){return BPromise['resolve']()[_0x47c8('0x29')](function(){if(!_0x4e1bbf[_0x47c8('0x33')][_0x47c8('0xa')]){throw new Error(_0x47c8('0x99'));}if(!_0x4e1bbf[_0x47c8('0x33')][_0x47c8('0xa4')]){throw new Error(_0x47c8('0x9a'));}var _0x4ed4b2=_0x4e1bbf[_0x47c8('0x33')][_0x47c8('0x9b')]?_0x4e1bbf[_0x47c8('0x33')][_0x47c8('0x9b')]+':'+_0x4e1bbf[_0x47c8('0x33')][_0x47c8('0xa4')]:_0x47c8('0x9c')+_0x4e1bbf['query'][_0x47c8('0xa4')];var _0x13d763=_0x4e1bbf[_0x47c8('0x33')][_0x47c8('0x23')]?_0x4e1bbf[_0x47c8('0x33')][_0x47c8('0x23')]:!![];var _0x1762c2=_0x4e1bbf[_0x47c8('0x33')][_0x47c8('0x9d')]?_0x4e1bbf[_0x47c8('0x33')][_0x47c8('0x9d')]:null;var _0xc6f51c={'method':_0x4e1bbf[_0x47c8('0xa5')],'uri':util['format'](_0x47c8('0x9e'),_0x4ed4b2,_0x4e1bbf[_0x47c8('0x33')]['path']),'json':_0x13d763,'resolveWithFullResponse':!![],'encoding':_0x1762c2,'body':_0x4e1bbf[_0x47c8('0x8f')]};if(_0x4e1bbf[_0x47c8('0x9f')]){_0xc6f51c[_0x47c8('0x9f')]=_0x4e1bbf[_0x47c8('0x9f')];if(_0xc6f51c['headers'][_0x47c8('0xa0')]){delete _0xc6f51c['headers'][_0x47c8('0xa0')];}}return rp(_0xc6f51c);})[_0x47c8('0x29')](function(_0x2aa875){if(_0x2aa875){_0x3c8813[_0x47c8('0x27')](_0x2aa875['headers']);logger[_0x47c8('0x69')](_0x2aa875[_0x47c8('0x8f')]);return _0x3c8813[_0x47c8('0x21')](_0x2aa875[_0x47c8('0xa2')])['send'](_0x2aa875['body']);}else{return _0x3c8813[_0x47c8('0x20')](0xc8);}})['catch'](handleError(_0x3c8813,null));}; \ No newline at end of file +var _0x1002=['where','merge','map','key','field','filter','options','Plugin','include','rows','catch','show','params','rawAttributes','includeAll','find','download','join','root','format','%s.zip','createWriteStream','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','dirname','basename','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','server/files/plugins','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','undefined','type','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','icon','html','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','role','body','UserProfileSection','Plugins','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','endsWith','statusCode','webhookPost','http://localhost:','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','ioredis','rimraf','archiver','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./plugin.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','get','UserProfileResource','error','name','send','index','model','keys','query','filters','intersection','fields','attributes','length','order','sort','pick'];(function(_0x4eb2f1,_0x30a0fe){var _0xdedbdb=function(_0x118419){while(--_0x118419){_0x4eb2f1['push'](_0x4eb2f1['shift']());}};_0xdedbdb(++_0x30a0fe);}(_0x1002,0x106));var _0x2100=function(_0x3442f3,_0x30a8cc){_0x3442f3=_0x3442f3-0x0;var _0x22ae9e=_0x1002[_0x3442f3];return _0x22ae9e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2100('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2100('0x1'));var jsonpatch=require(_0x2100('0x2'));var rp=require(_0x2100('0x3'));var moment=require(_0x2100('0x4'));var BPromise=require(_0x2100('0x5'));var Mustache=require(_0x2100('0x6'));var util=require(_0x2100('0x7'));var path=require(_0x2100('0x8'));var sox=require(_0x2100('0x9'));var csv=require(_0x2100('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2100('0xb'));var squel=require(_0x2100('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2100('0xd'));var toCsv=require(_0x2100('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x2100('0xe'));var extract=require('extract-zip');var rimraf=require(_0x2100('0xf'));var archiver=require(_0x2100('0x10'));var qs=require(_0x2100('0x11'));var logger=require(_0x2100('0x12'))(_0x2100('0x13'));var utils=require(_0x2100('0x14'));var config=require(_0x2100('0x15'));var db=require(_0x2100('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x2100('0x17'),'port':0x18eb});var socket=require(_0x2100('0x18'))(new Redis(config[_0x2100('0x19')]));require(_0x2100('0x1a'))[_0x2100('0x1b')](socket);function respondWithStatusCode(_0x35a791,_0x221f58){_0x221f58=_0x221f58||0xcc;return function(_0x4c82f7){if(_0x4c82f7){return _0x35a791[_0x2100('0x1c')](_0x221f58);}return _0x35a791[_0x2100('0x1d')](_0x221f58)[_0x2100('0x1e')]();};}function respondWithResult(_0xaaa703,_0x5d79c9){_0x5d79c9=_0x5d79c9||0xc8;return function(_0x14311b){if(_0x14311b){return _0xaaa703[_0x2100('0x1d')](_0x5d79c9)[_0x2100('0x1f')](_0x14311b);}};}function respondWithFilteredResult(_0xc24ad1,_0x4c8b33){return function(_0x5ebe2f){if(_0x5ebe2f){var _0x1da1fd=_0x5ebe2f[_0x2100('0x20')],_0x2f5f09=_0x4c8b33['offset'],_0xdec3c7=_0x4c8b33[_0x2100('0x21')]+_0x4c8b33[_0x2100('0x22')],_0x1b08b2;if(_0xdec3c7>=_0x1da1fd){_0xdec3c7=_0x1da1fd;_0x1b08b2=0xc8;}else{_0x1b08b2=0xce;}_0xc24ad1['status'](_0x1b08b2);return _0xc24ad1[_0x2100('0x23')](_0x2100('0x24'),_0x2f5f09+'-'+_0xdec3c7+'/'+_0x1da1fd)['json'](_0x5ebe2f);}return null;};}function patchUpdates(_0x64952d){return function(_0x3a46dc){try{jsonpatch[_0x2100('0x25')](_0x3a46dc,_0x64952d,!![]);}catch(_0x213c50){return BPromise[_0x2100('0x26')](_0x213c50);}return _0x3a46dc['save']();};}function saveUpdates(_0x22118b,_0x225be0){return function(_0x4df092){if(_0x4df092){return _0x4df092['update'](_0x22118b)[_0x2100('0x27')](function(_0x5ce451){return _0x5ce451;});}return null;};}function removeEntity(_0x4dcdd3,_0x3bc354){return function(_0x1b9aec){if(_0x1b9aec){return _0x1b9aec[_0x2100('0x28')]()['then'](function(){var _0x189901=_0x1b9aec[_0x2100('0x29')]({'plain':!![]});var _0x295bc6='Plugins';return db[_0x2100('0x2a')]['destroy']({'where':{'type':_0x295bc6,'resourceId':_0x189901['id']}})[_0x2100('0x27')](function(){return _0x1b9aec;});})[_0x2100('0x27')](function(){_0x4dcdd3['status'](0xcc)[_0x2100('0x1e')]();});}};}function handleEntityNotFound(_0x17f896,_0x48714e){return function(_0x1bf4cb){if(!_0x1bf4cb){_0x17f896[_0x2100('0x1c')](0x194);}return _0x1bf4cb;};}function handleError(_0x26319b,_0x3740de){_0x3740de=_0x3740de||0x1f4;return function(_0x5ddfda){logger[_0x2100('0x2b')](_0x5ddfda['stack']);if(_0x5ddfda[_0x2100('0x2c')]){delete _0x5ddfda[_0x2100('0x2c')];}_0x26319b[_0x2100('0x1d')](_0x3740de)[_0x2100('0x2d')](_0x5ddfda);};}exports[_0x2100('0x2e')]=function(_0x511252,_0x4fc8ef){var _0x4711b8={},_0x2d7f7d={},_0x48b905={'count':0x0,'rows':[]};var _0x3408b8=db['Plugin']['rawAttributes'];_0x2d7f7d[_0x2100('0x2f')]=_[_0x2100('0x30')](_0x3408b8);_0x2d7f7d[_0x2100('0x31')]=_[_0x2100('0x30')](_0x511252['query']);_0x2d7f7d[_0x2100('0x32')]=_[_0x2100('0x33')](_0x2d7f7d[_0x2100('0x2f')],_0x2d7f7d[_0x2100('0x31')]);_0x4711b8['attributes']=_[_0x2100('0x33')](_0x2d7f7d[_0x2100('0x2f')],qs[_0x2100('0x34')](_0x511252[_0x2100('0x31')][_0x2100('0x34')]));_0x4711b8['attributes']=_0x4711b8[_0x2100('0x35')][_0x2100('0x36')]?_0x4711b8[_0x2100('0x35')]:_0x2d7f7d[_0x2100('0x2f')];if(!_0x511252['query']['hasOwnProperty']('nolimit')){_0x4711b8['limit']=qs[_0x2100('0x22')](_0x511252['query']['limit']);_0x4711b8[_0x2100('0x21')]=qs['offset'](_0x511252[_0x2100('0x31')]['offset']);}_0x4711b8[_0x2100('0x37')]=qs[_0x2100('0x38')](_0x511252['query'][_0x2100('0x38')]);_0x4711b8['where']=qs[_0x2100('0x32')](_[_0x2100('0x39')](_0x511252['query'],_0x2d7f7d[_0x2100('0x32')]));if(_0x511252[_0x2100('0x31')]['filter']){_0x4711b8[_0x2100('0x3a')]=_[_0x2100('0x3b')](_0x4711b8[_0x2100('0x3a')],{'$or':_[_0x2100('0x3c')](_0x3408b8,function(_0xa4a94d){if(_0xa4a94d['type'][_0x2100('0x3d')]!=='VIRTUAL'){var _0xbcb174={};_0xbcb174[_0xa4a94d[_0x2100('0x3e')]]={'$like':'%'+_0x511252[_0x2100('0x31')][_0x2100('0x3f')]+'%'};return _0xbcb174;}})});}_0x4711b8=_[_0x2100('0x3b')]({},_0x4711b8,_0x511252[_0x2100('0x40')]);var _0x18eb9c={'where':_0x4711b8[_0x2100('0x3a')]};return db[_0x2100('0x41')][_0x2100('0x20')](_0x18eb9c)[_0x2100('0x27')](function(_0x1be7d8){_0x48b905[_0x2100('0x20')]=_0x1be7d8;if(_0x511252[_0x2100('0x31')]['includeAll']){_0x4711b8[_0x2100('0x42')]=[{'all':!![]}];}return db[_0x2100('0x41')]['findAll'](_0x4711b8);})[_0x2100('0x27')](function(_0x29efd4){_0x48b905[_0x2100('0x43')]=_0x29efd4;return _0x48b905;})['then'](respondWithFilteredResult(_0x4fc8ef,_0x4711b8))[_0x2100('0x44')](handleError(_0x4fc8ef,null));};exports[_0x2100('0x45')]=function(_0x4eba4f,_0x10c54e){var _0x15468a={'raw':!![],'where':{'id':_0x4eba4f[_0x2100('0x46')]['id']}},_0x454268={};_0x454268[_0x2100('0x2f')]=_['keys'](db[_0x2100('0x41')][_0x2100('0x47')]);_0x454268[_0x2100('0x31')]=_['keys'](_0x4eba4f[_0x2100('0x31')]);_0x454268[_0x2100('0x32')]=_['intersection'](_0x454268[_0x2100('0x2f')],_0x454268[_0x2100('0x31')]);_0x15468a[_0x2100('0x35')]=_[_0x2100('0x33')](_0x454268['model'],qs[_0x2100('0x34')](_0x4eba4f[_0x2100('0x31')][_0x2100('0x34')]));_0x15468a['attributes']=_0x15468a[_0x2100('0x35')]['length']?_0x15468a[_0x2100('0x35')]:_0x454268[_0x2100('0x2f')];if(_0x4eba4f[_0x2100('0x31')][_0x2100('0x48')]){_0x15468a[_0x2100('0x42')]=[{'all':!![]}];}_0x15468a=_['merge']({},_0x15468a,_0x4eba4f[_0x2100('0x40')]);return db['Plugin'][_0x2100('0x49')](_0x15468a)[_0x2100('0x27')](handleEntityNotFound(_0x10c54e,null))[_0x2100('0x27')](respondWithResult(_0x10c54e,null))[_0x2100('0x44')](handleError(_0x10c54e,null));};exports[_0x2100('0x4a')]=function(_0x2a9a0c,_0x394e17,_0x416ebe){return db[_0x2100('0x41')][_0x2100('0x49')]({'where':{'id':_0x2a9a0c['params']['id']},'attributes':[_0x2100('0x2c'),_0x2100('0x8')],'raw':!![]})[_0x2100('0x27')](handleEntityNotFound(_0x394e17,null))['then'](function(_0x551d6){if(_0x551d6){var _0x2c3509=path[_0x2100('0x4b')](config[_0x2100('0x4c')],'server/files/plugins',util[_0x2100('0x4d')](_0x2100('0x4e'),path['basename'](_0x551d6[_0x2100('0x8')])));var _0x1e64e0=fs[_0x2100('0x4f')](_0x2c3509);var _0x5f19a9=archiver(_0x2100('0x50'),{'zlib':{'level':0x9}});_0x5f19a9['on']('warning',function(_0x4614f2){if(_0x4614f2[_0x2100('0x51')]===_0x2100('0x52')){logger[_0x2100('0x2b')](_0x4614f2);}else{throw new db[(_0x2100('0x53'))][(_0x2100('0x54'))](_0x2100('0x55'));}});_0x5f19a9['on'](_0x2100('0x2b'),function(_0x20df74){throw new db[(_0x2100('0x53'))][(_0x2100('0x54'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x5f19a9[_0x2100('0x56')](_0x1e64e0);_0x5f19a9['glob'](_0x2100('0x57'),{'cwd':path[_0x2100('0x4b')](config[_0x2100('0x4c')],'server/files/plugins',path[_0x2100('0x58')](_0x551d6[_0x2100('0x8')])),'ignore':[path[_0x2100('0x4b')](path[_0x2100('0x59')](_0x551d6[_0x2100('0x8')]),'node_modules/**/*'),path[_0x2100('0x4b')](path[_0x2100('0x59')](_0x551d6[_0x2100('0x8')]),'attachments/**/*')],'nodir':!![]})[_0x2100('0x5a')]();_0x1e64e0['on'](_0x2100('0x5b'),function(){if(!fs[_0x2100('0x5c')](_0x2c3509)){throw new db[(_0x2100('0x53'))][(_0x2100('0x54'))](_0x2100('0x5d'));}return _0x394e17[_0x2100('0x4a')](_0x2c3509,util[_0x2100('0x4d')](_0x2100('0x4e'),path[_0x2100('0x59')](_0x551d6[_0x2100('0x8')])),function(_0x575a26){if(_0x575a26){throw new db[(_0x2100('0x53'))][(_0x2100('0x54'))](_0x2100('0x5e'));}fs[_0x2100('0x5f')](_0x2c3509);logger['info'](_0x2100('0x60'));logger[_0x2100('0x61')](_0x2100('0x62'));});});}return null;})['catch'](handleError(_0x394e17,null));};exports[_0x2100('0x63')]=function(_0x3ce99e,_0x180c31,_0x45ffae){var _0x37138b=path[_0x2100('0x59')](_0x3ce99e[_0x2100('0x64')][_0x2100('0x65')],path['extname'](_0x3ce99e['file']['filename']));var _0x2edfc3=path[_0x2100('0x4b')](config[_0x2100('0x4c')],_0x2100('0x66'),_0x3ce99e[_0x2100('0x64')]['filename']);var _0x1d3cf4=path[_0x2100('0x4b')](config['root'],_0x2100('0x66'),_0x37138b);logger[_0x2100('0x61')](_0x2100('0x67'),_0x2edfc3);logger[_0x2100('0x61')](_0x2100('0x68'),_0x1d3cf4);try{fs[_0x2100('0x69')](_0x2edfc3,parseInt(_0x2100('0x6a'),0x8));extract(_0x2edfc3,{'dir':_0x1d3cf4},function(_0x33fb74){if(_0x33fb74){logger['error'](_0x33fb74);handleError(_0x33fb74,!![]);};var _0x360c32=fs[_0x2100('0x6b')](_0x1d3cf4);if(_0x360c32[_0x2100('0x36')]>0x1){removeReferences(_0x2edfc3,_0x1d3cf4);logger[_0x2100('0x2b')](_0x2100('0x6c'));return _0x45ffae(new Error(_0x2100('0x6c')));}var _0x44178c=fs[_0x2100('0x6d')](path[_0x2100('0x4b')](_0x1d3cf4,_0x360c32[0x0]));if(_0x44178c[_0x2100('0x6e')]()){removeReferences(_0x2edfc3,_0x1d3cf4);logger['error'](_0x2100('0x6c'));return _0x45ffae(new Error('Invalid\x20plugin\x20structure'));}if(_0x44178c['isDirectory']()){var _0x3a610f=fs[_0x2100('0x6b')](path[_0x2100('0x4b')](_0x1d3cf4,_0x360c32[0x0]));if(_0x3a610f[_0x2100('0x36')]===0x0){removeReferences(_0x2edfc3,_0x1d3cf4);logger[_0x2100('0x2b')](_0x2100('0x6c'));return _0x45ffae(new Error(_0x2100('0x6c')));}var _0x4e81cb=_0x3a610f[_0x2100('0x6f')](function(_0x3ab57f){return _0x3ab57f===_0x2100('0x70');});if(!_0x4e81cb){return _0x45ffae(new Error(_0x2100('0x71')));}var _0x3be602=fs['readFileSync'](path[_0x2100('0x4b')](_0x1d3cf4,_0x360c32[0x0],_0x2100('0x70')));var _0x15ed3f=JSON[_0x2100('0x72')](_0x3be602);if('undefined'==typeof _0x15ed3f[_0x2100('0x2c')]){return _0x45ffae(new Error(_0x2100('0x73')));}if(_0x2100('0x74')==typeof _0x15ed3f[_0x2100('0x75')]){return _0x45ffae(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x2100('0x74')==typeof _0x15ed3f[_0x2100('0x76')]){return _0x45ffae(new Error(_0x2100('0x77')));}if(_0x2100('0x74')==typeof _0x15ed3f[_0x2100('0x78')]){return _0x45ffae(new Error(_0x2100('0x79')));}if(_0x15ed3f[_0x2100('0x75')]==='html'){if(_0x2100('0x74')==typeof _0x15ed3f['parameters'][_0x2100('0x7a')]){return _0x45ffae(new Error(_0x2100('0x7b')));}if(_0x2100('0x74')==typeof _0x15ed3f[_0x2100('0x78')][_0x2100('0x7a')][_0x2100('0x7c')]&&_0x2100('0x74')==typeof _0x15ed3f[_0x2100('0x78')][_0x2100('0x7a')][_0x2100('0x7d')]){return _0x45ffae(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x15ed3f['type']===_0x2100('0x7e')){if('undefined'==typeof _0x15ed3f[_0x2100('0x78')][_0x2100('0x7f')]){return _0x45ffae(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x2100('0x74')==typeof _0x15ed3f[_0x2100('0x78')][_0x2100('0x80')]){return _0x45ffae(new Error(_0x2100('0x81')));}}else{return _0x45ffae(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x1f8d3f=_0x15ed3f[_0x2100('0x2c')];var _0x342fb8=_0x15ed3f['description'];var _0x3a79a3=_0x15ed3f[_0x2100('0x75')];var _0x31123c=_0x15ed3f[_0x2100('0x82')]?_0x15ed3f['sidebar']:'always';var _0x33866c=_0x15ed3f[_0x2100('0x83')]?_0x15ed3f[_0x2100('0x83')]:'icon-apps';var _0x20b868='';var _0x4cf99c='';var _0x5b5ac0='';var _0x183a3c='';var _0x1e3bde=_0x15ed3f[_0x2100('0x76')];if(_0x3a79a3===_0x2100('0x84')){if(_0x2100('0x74')!=typeof _0x15ed3f[_0x2100('0x78')][_0x2100('0x7a')][_0x2100('0x7c')]){var _0x3ba98d=_0x15ed3f['parameters'][_0x2100('0x7a')][_0x2100('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x2100('0x85')](_0x3ba98d)){_0x20b868=path[_0x2100('0x4b')](_0x2100('0x86'),_0x37138b,_0x360c32[0x0],_0x3ba98d);}else{_0x20b868=_0x3ba98d;}}else{logger[_0x2100('0x61')](_0x2100('0x87'));}if(_0x2100('0x74')!=typeof _0x15ed3f[_0x2100('0x78')][_0x2100('0x7a')][_0x2100('0x7d')]){var _0x29ad00=_0x15ed3f[_0x2100('0x78')][_0x2100('0x7a')][_0x2100('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x2100('0x85')](_0x29ad00)){_0x4cf99c=path[_0x2100('0x4b')](_0x2100('0x86'),_0x37138b,_0x360c32[0x0],_0x29ad00);}else{_0x4cf99c=_0x29ad00;}}else{logger[_0x2100('0x61')](_0x2100('0x88'));}}else if(_0x3a79a3===_0x2100('0x7e')){_0x5b5ac0=_0x15ed3f[_0x2100('0x78')][_0x2100('0x7f')];_0x183a3c=_0x15ed3f['parameters']['scriptPath'];if(_0x2100('0x74')!=typeof _0x15ed3f['parameters']['views']){if(_0x2100('0x74')!=typeof _0x15ed3f[_0x2100('0x78')][_0x2100('0x7a')][_0x2100('0x7c')]){var _0x3ba98d=_0x15ed3f[_0x2100('0x78')][_0x2100('0x7a')][_0x2100('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x2100('0x85')](_0x3ba98d)){_0x20b868=path[_0x2100('0x4b')](_0x2100('0x86'),_0x37138b,_0x360c32[0x0],_0x3ba98d);}else{_0x20b868=_0x3ba98d;}}if(_0x2100('0x74')!=typeof _0x15ed3f[_0x2100('0x78')][_0x2100('0x7a')][_0x2100('0x7d')]){var _0x29ad00=_0x15ed3f[_0x2100('0x78')]['views'][_0x2100('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x2100('0x85')](_0x29ad00)){_0x4cf99c=path[_0x2100('0x4b')](_0x2100('0x86'),_0x37138b,_0x360c32[0x0],_0x29ad00);}else{_0x4cf99c=_0x29ad00;}}}}var _0x18c868={'name':_0x1f8d3f,'description':_0x342fb8,'path':path[_0x2100('0x4b')](_0x37138b,_0x360c32[0x0]),'type':_0x3a79a3,'sidebar':_0x31123c,'icon':_0x33866c,'adminUrl':_0x20b868,'agentUrl':_0x4cf99c,'scriptName':_0x5b5ac0,'scriptPath':_0x183a3c,'version':_0x1e3bde};removeReferences(_0x2edfc3,null);return db[_0x2100('0x41')][_0x2100('0x89')](_0x18c868)['then'](function(_0x40950e){var _0x340675={'role':_0x3ce99e['body'][_0x2100('0x8a')],'userProfileId':_0x3ce99e[_0x2100('0x8b')]['userProfileId']};if(!_0x340675)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x340675[_0x2100('0x8a')]==='user'){var _0x250e2d=_0x40950e[_0x2100('0x29')]({'plain':!![]});return db[_0x2100('0x8c')][_0x2100('0x49')]({'where':{'name':_0x2100('0x8d'),'userProfileId':_0x340675[_0x2100('0x8e')]},'raw':!![]})['then'](function(_0x1304af){if(_0x1304af&&_0x1304af[_0x2100('0x8f')]===0x0){return db[_0x2100('0x2a')][_0x2100('0x89')]({'name':_0x250e2d['name'],'resourceId':_0x250e2d['id'],'type':_0x1304af['name'],'sectionId':_0x1304af['id']},{})[_0x2100('0x27')](function(){return _0x40950e;});}else{return _0x40950e;}})[_0x2100('0x44')](function(_0xb10b8a){logger[_0x2100('0x2b')](_0x2100('0x90'),_0xb10b8a);throw _0xb10b8a;});}return _0x40950e;})[_0x2100('0x27')](respondWithResult(_0x180c31,null))[_0x2100('0x44')](handleError(_0x180c31,null));}});}catch(_0x27e7ea){_0x180c31['status'](0x1f4)[_0x2100('0x2d')](_0x27e7ea);}};function removeReferences(_0x50ae19,_0x2d6988){try{if(_0x50ae19){fs[_0x2100('0x5f')](_0x50ae19);logger['info']('Zip\x20archive\x20removed');}if(_0x2d6988){rimraf(_0x2d6988,function(){});logger[_0x2100('0x61')](_0x2100('0x91'));}}catch(_0xa7e859){logger[_0x2100('0x2b')](_0xa7e859);}}exports['update']=function(_0x4ee710,_0x557a24,_0x106bb8){return db[_0x2100('0x41')]['find']({'where':{'id':_0x4ee710[_0x2100('0x46')]['id']}})[_0x2100('0x27')](handleEntityNotFound(_0x557a24,null))[_0x2100('0x27')](saveUpdates(_0x4ee710[_0x2100('0x8b')],null))[_0x2100('0x27')](respondWithResult(_0x557a24,null))['catch'](handleError(_0x557a24,null));};exports['delete']=function(_0x1f25c8,_0x5008d0,_0x6c414b){return db[_0x2100('0x41')][_0x2100('0x49')]({'where':{'id':_0x1f25c8[_0x2100('0x46')]['id']}})['then'](function(_0x3ede14){if(_0x3ede14){return _0x3ede14['destroy']();}})[_0x2100('0x27')](function(_0x27d031){rimraf(path[_0x2100('0x4b')](config[_0x2100('0x4c')],'server/files/plugins',path['dirname'](_0x27d031[_0x2100('0x8')])),function(){});return _0x27d031;})[_0x2100('0x27')](handleEntityNotFound(_0x5008d0,null))['then'](respondWithStatusCode(_0x5008d0,null))[_0x2100('0x44')](handleError(_0x5008d0,null));};exports['webhookGet']=function(_0x536072,_0x1f9088,_0x499295){return BPromise[_0x2100('0x92')]()['then'](function(){if(!_0x536072[_0x2100('0x31')][_0x2100('0x8')]){throw new Error(_0x2100('0x93'));}if(!_0x536072[_0x2100('0x31')][_0x2100('0x94')]){throw new Error(_0x2100('0x95'));}var _0x54691c=_0x536072[_0x2100('0x31')][_0x2100('0x96')]?_0x536072[_0x2100('0x31')][_0x2100('0x96')]+':'+_0x536072['query'][_0x2100('0x94')]:'http://localhost:'+_0x536072[_0x2100('0x31')][_0x2100('0x94')];var _0x2ecfbc=_0x536072['query'][_0x2100('0x1f')]?_0x536072[_0x2100('0x31')][_0x2100('0x1f')]:!![];var _0x12da42=_0x536072['query'][_0x2100('0x97')]?_0x536072[_0x2100('0x31')][_0x2100('0x97')]:null;var _0x4f27d0={'method':_0x536072[_0x2100('0x98')],'uri':util['format'](_0x2100('0x99'),_0x54691c,_0x536072[_0x2100('0x31')][_0x2100('0x8')]),'json':_0x2ecfbc,'resolveWithFullResponse':!![],'encoding':_0x12da42,'qs':_0x536072[_0x2100('0x31')]};if(_0x536072[_0x2100('0x9a')]){_0x4f27d0[_0x2100('0x9a')]=_0x536072[_0x2100('0x9a')];if(_0x4f27d0[_0x2100('0x9a')][_0x2100('0x9b')]){delete _0x4f27d0[_0x2100('0x9a')]['content-length'];}}return rp(_0x4f27d0);})[_0x2100('0x27')](function(_0x54df45){if(_0x54df45){_0x1f9088['set'](_0x54df45[_0x2100('0x9a')]);logger[_0x2100('0x61')](_0x54df45[_0x2100('0x8b')]);if(_[_0x2100('0x9c')](_0x536072[_0x2100('0x31')][_0x2100('0x8')],_0x2100('0x4a'))&&_0x54df45[_0x2100('0x9d')]==0x1f4){return _0x1f9088['sendStatus'](_0x54df45[_0x2100('0x9d')]);}else{return _0x1f9088[_0x2100('0x1d')](_0x54df45[_0x2100('0x9d')])[_0x2100('0x2d')](_0x54df45[_0x2100('0x8b')]);}}else{return _0x1f9088[_0x2100('0x1c')](0xc8);}})['catch'](handleError(_0x1f9088,null));};exports[_0x2100('0x9e')]=function(_0x30eaf8,_0x3a7c9b,_0x369d99){return BPromise[_0x2100('0x92')]()[_0x2100('0x27')](function(){if(!_0x30eaf8[_0x2100('0x31')][_0x2100('0x8')]){throw new Error(_0x2100('0x93'));}if(!_0x30eaf8[_0x2100('0x31')][_0x2100('0x94')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3af863=_0x30eaf8[_0x2100('0x31')][_0x2100('0x96')]?_0x30eaf8[_0x2100('0x31')][_0x2100('0x96')]+':'+_0x30eaf8[_0x2100('0x31')][_0x2100('0x94')]:_0x2100('0x9f')+_0x30eaf8[_0x2100('0x31')][_0x2100('0x94')];var _0xc70b30=_0x30eaf8[_0x2100('0x31')][_0x2100('0x1f')]?_0x30eaf8['query'][_0x2100('0x1f')]:!![];var _0x23af5a=_0x30eaf8[_0x2100('0x31')]['encoding']?_0x30eaf8[_0x2100('0x31')][_0x2100('0x97')]:null;var _0x2886ea={'method':_0x30eaf8[_0x2100('0x98')],'uri':util[_0x2100('0x4d')]('%s%s',_0x3af863,_0x30eaf8[_0x2100('0x31')][_0x2100('0x8')]),'json':_0xc70b30,'resolveWithFullResponse':!![],'encoding':_0x23af5a,'body':_0x30eaf8['body']};if(_0x30eaf8['headers']){_0x2886ea[_0x2100('0x9a')]=_0x30eaf8['headers'];if(_0x2886ea[_0x2100('0x9a')][_0x2100('0x9b')]){delete _0x2886ea['headers'][_0x2100('0x9b')];}}return rp(_0x2886ea);})[_0x2100('0x27')](function(_0x34b50a){if(_0x34b50a){_0x3a7c9b[_0x2100('0x23')](_0x34b50a[_0x2100('0x9a')]);logger[_0x2100('0x61')](_0x34b50a[_0x2100('0x8b')]);return _0x3a7c9b[_0x2100('0x1d')](_0x34b50a[_0x2100('0x9d')])['send'](_0x34b50a[_0x2100('0x8b')]);}else{return _0x3a7c9b[_0x2100('0x1c')](0xc8);}})[_0x2100('0x44')](handleError(_0x3a7c9b,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 54663bc..ef71246 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(_0x3cba70,_0x3edb26){var _0x34ff87=function(_0x5b8ca0){while(--_0x5b8ca0){_0x3cba70['push'](_0x3cba70['shift']());}};_0x34ff87(++_0x3edb26);}(_0x7a54,0x106));var _0x47a5=function(_0x671684,_0x2eca2f){_0x671684=_0x671684-0x0;var _0x349627=_0x7a54[_0x671684];return _0x349627;};'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(_0x27552b,_0x3c661b){var _0x7b2ceb=function(_0x335b83){while(--_0x335b83){_0x27552b['push'](_0x27552b['shift']());}};_0x7b2ceb(++_0x3c661b);}(_0x7a54,0x106));var _0x47a5=function(_0x56e72f,_0x36c34e){_0x56e72f=_0x56e72f-0x0;var _0x58cf5e=_0x7a54[_0x56e72f];return _0x58cf5e;};'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 0bf008e..3cf2e99 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 _0x8e38=['lodash','../../config/logger','api','moment','./plugin.attributes','exports','define','plugins'];(function(_0x49d62d,_0x5ef848){var _0x5d0af8=function(_0x18f2b6){while(--_0x18f2b6){_0x49d62d['push'](_0x49d62d['shift']());}};_0x5d0af8(++_0x5ef848);}(_0x8e38,0x80));var _0x88e3=function(_0x236abc,_0x4e56c0){_0x236abc=_0x236abc-0x0;var _0x10643f=_0x8e38[_0x236abc];return _0x10643f;};'use strict';var _=require(_0x88e3('0x0'));var util=require('util');var logger=require(_0x88e3('0x1'))(_0x88e3('0x2'));var moment=require(_0x88e3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x88e3('0x4'));module[_0x88e3('0x5')]=function(_0x5629b3,_0x4b9d4a){return _0x5629b3[_0x88e3('0x6')]('Plugin',attributes,{'tableName':_0x88e3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0c4=['plugins','lodash','../../config/logger','api','moment','bluebird','request-promise','./plugin.attributes','exports','define','Plugin'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa0c4,0x1b9));var _0x4a0c=function(_0x3ffc8e,_0x1172a7){_0x3ffc8e=_0x3ffc8e-0x0;var _0x1e60d2=_0xa0c4[_0x3ffc8e];return _0x1e60d2;};'use strict';var _=require(_0x4a0c('0x0'));var util=require('util');var logger=require(_0x4a0c('0x1'))(_0x4a0c('0x2'));var moment=require(_0x4a0c('0x3'));var BPromise=require(_0x4a0c('0x4'));var rp=require(_0x4a0c('0x5'));var attributes=require(_0x4a0c('0x6'));module[_0x4a0c('0x7')]=function(_0xd45f06,_0x1d15a7){return _0xd45f06[_0x4a0c('0x8')](_0x4a0c('0x9'),attributes,{'tableName':_0x4a0c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 9fe395c..c630f6c 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 _0x3dff=['options','raw','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./plugin.socket','register','request','then','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','result','catch','CreatePlugin','Plugin','create'];(function(_0x260e76,_0x578971){var _0x31f635=function(_0x3c5da9){while(--_0x3c5da9){_0x260e76['push'](_0x260e76['shift']());}};_0x31f635(++_0x578971);}(_0x3dff,0x1e2));var _0xf3df=function(_0x2cfe2d,_0x22d708){_0x2cfe2d=_0x2cfe2d-0x0;var _0x4843ef=_0x3dff[_0x2cfe2d];return _0x4843ef;};'use strict';var _=require(_0xf3df('0x0'));var util=require('util');var moment=require(_0xf3df('0x1'));var BPromise=require('bluebird');var rs=require(_0xf3df('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf3df('0x3'));var logger=require(_0xf3df('0x4'))(_0xf3df('0x5'));var config=require('../../config/environment');var jayson=require(_0xf3df('0x6'));var client=jayson[_0xf3df('0x7')][_0xf3df('0x8')]({'port':0x232a});config[_0xf3df('0x9')]=_[_0xf3df('0xa')](config['redis'],{'host':_0xf3df('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf3df('0x9')]));require(_0xf3df('0xc'))[_0xf3df('0xd')](socket);function respondWithRpcPromise(_0x3fac6e,_0x1fd91c,_0x2adddc){return new BPromise(function(_0x546bdf,_0x33995e){return client[_0xf3df('0xe')](_0x3fac6e,_0x2adddc)[_0xf3df('0xf')](function(_0x4cc02a){logger[_0xf3df('0x10')]('Plugin,\x20%s,\x20%s',_0x1fd91c,_0xf3df('0x11'));logger[_0xf3df('0x12')](_0xf3df('0x13'),_0x1fd91c,_0xf3df('0x11'),JSON[_0xf3df('0x14')](_0x4cc02a));if(_0x4cc02a[_0xf3df('0x15')]){if(_0x4cc02a['error'][_0xf3df('0x16')]===0x1f4){logger[_0xf3df('0x15')](_0xf3df('0x17'),_0x1fd91c,_0x4cc02a[_0xf3df('0x15')][_0xf3df('0x18')]);return _0x33995e(_0x4cc02a['error'][_0xf3df('0x18')]);}logger[_0xf3df('0x15')](_0xf3df('0x17'),_0x1fd91c,_0x4cc02a['error']['message']);return _0x546bdf(_0x4cc02a['error'][_0xf3df('0x18')]);}else{logger[_0xf3df('0x10')](_0xf3df('0x17'),_0x1fd91c,_0xf3df('0x11'));_0x546bdf(_0x4cc02a[_0xf3df('0x19')][_0xf3df('0x18')]);}})[_0xf3df('0x1a')](function(_0x380eea){logger[_0xf3df('0x15')](_0xf3df('0x17'),_0x1fd91c,_0x380eea);_0x33995e(_0x380eea);});});}exports[_0xf3df('0x1b')]=function(_0x341a22){var _0x4fa8ab=this;return new Promise(function(_0x394612,_0x4ed6de){return db[_0xf3df('0x1c')][_0xf3df('0x1d')](_0x341a22['body'],{'raw':_0x341a22[_0xf3df('0x1e')]?_0x341a22[_0xf3df('0x1e')][_0xf3df('0x1f')]===undefined?!![]:![]:!![]})[_0xf3df('0xf')](function(_0xa9aee3){logger[_0xf3df('0x10')](_0xf3df('0x1b'),_0x341a22);logger[_0xf3df('0x12')](_0xf3df('0x1b'),_0x341a22,JSON[_0xf3df('0x14')](_0xa9aee3));_0x394612(_0xa9aee3);})[_0xf3df('0x1a')](function(_0x4c59c5){logger['error']('CreatePlugin',_0x4c59c5[_0xf3df('0x18')],_0x341a22);_0x4ed6de(_0x4fa8ab[_0xf3df('0x15')](0x1f4,_0x4c59c5[_0xf3df('0x18')]));});});}; \ No newline at end of file +var _0x0a94=['info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./plugin.socket','register','request','then'];(function(_0x4b0c32,_0x353b92){var _0x206e03=function(_0x5b6a3d){while(--_0x5b6a3d){_0x4b0c32['push'](_0x4b0c32['shift']());}};_0x206e03(++_0x353b92);}(_0x0a94,0x130));var _0x40a9=function(_0x4a1a2,_0x473c82){_0x4a1a2=_0x4a1a2-0x0;var _0x1a61c1=_0x0a94[_0x4a1a2];return _0x1a61c1;};'use strict';var _=require(_0x40a9('0x0'));var util=require(_0x40a9('0x1'));var moment=require(_0x40a9('0x2'));var BPromise=require(_0x40a9('0x3'));var rs=require(_0x40a9('0x4'));var fs=require('fs');var Redis=require(_0x40a9('0x5'));var db=require(_0x40a9('0x6'))['db'];var utils=require(_0x40a9('0x7'));var logger=require(_0x40a9('0x8'))(_0x40a9('0x9'));var config=require(_0x40a9('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x40a9('0xb')][_0x40a9('0xc')]({'port':0x232a});config[_0x40a9('0xd')]=_[_0x40a9('0xe')](config[_0x40a9('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x40a9('0xf'))(new Redis(config['redis']));require(_0x40a9('0x10'))[_0x40a9('0x11')](socket);function respondWithRpcPromise(_0x471a14,_0x3626cc,_0x51d8d1){return new BPromise(function(_0x17247a,_0x20b9dc){return client[_0x40a9('0x12')](_0x471a14,_0x51d8d1)[_0x40a9('0x13')](function(_0xbf77b1){logger[_0x40a9('0x14')](_0x40a9('0x15'),_0x3626cc,'request\x20sent');logger[_0x40a9('0x16')](_0x40a9('0x17'),_0x3626cc,_0x40a9('0x18'),JSON[_0x40a9('0x19')](_0xbf77b1));if(_0xbf77b1[_0x40a9('0x1a')]){if(_0xbf77b1['error'][_0x40a9('0x1b')]===0x1f4){logger[_0x40a9('0x1a')](_0x40a9('0x15'),_0x3626cc,_0xbf77b1[_0x40a9('0x1a')][_0x40a9('0x1c')]);return _0x20b9dc(_0xbf77b1[_0x40a9('0x1a')][_0x40a9('0x1c')]);}logger[_0x40a9('0x1a')](_0x40a9('0x15'),_0x3626cc,_0xbf77b1[_0x40a9('0x1a')]['message']);return _0x17247a(_0xbf77b1[_0x40a9('0x1a')][_0x40a9('0x1c')]);}else{logger['info'](_0x40a9('0x15'),_0x3626cc,'request\x20sent');_0x17247a(_0xbf77b1[_0x40a9('0x1d')][_0x40a9('0x1c')]);}})[_0x40a9('0x1e')](function(_0x3b6f40){logger[_0x40a9('0x1a')](_0x40a9('0x15'),_0x3626cc,_0x3b6f40);_0x20b9dc(_0x3b6f40);});});}exports[_0x40a9('0x1f')]=function(_0x5cfd0f){var _0x4f5c2a=this;return new Promise(function(_0x19cdab,_0x2b707d){return db[_0x40a9('0x20')][_0x40a9('0x21')](_0x5cfd0f[_0x40a9('0x22')],{'raw':_0x5cfd0f['options']?_0x5cfd0f[_0x40a9('0x23')]['raw']===undefined?!![]:![]:!![]})[_0x40a9('0x13')](function(_0x3071c2){logger['info']('CreatePlugin',_0x5cfd0f);logger['debug'](_0x40a9('0x1f'),_0x5cfd0f,JSON['stringify'](_0x3071c2));_0x19cdab(_0x3071c2);})[_0x40a9('0x1e')](function(_0x297a72){logger[_0x40a9('0x1a')](_0x40a9('0x1f'),_0x297a72[_0x40a9('0x1c')],_0x5cfd0f);_0x2b707d(_0x4f5c2a[_0x40a9('0x1a')](0x1f4,_0x297a72[_0x40a9('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 859c10a..ae0fcd8 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 _0x1955=['plugin:','./plugin.events','save','emit','register','length'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x1955,0xd9));var _0x5195=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x1955[_0x5d6456];return _0x4d66c1;};'use strict';var PluginEvents=require(_0x5195('0x0'));var events=[_0x5195('0x1'),'remove','update'];function createListener(_0x3e9ccc,_0x1b0733){return function(_0x4bc38d){_0x1b0733[_0x5195('0x2')](_0x3e9ccc,_0x4bc38d);};}function removeListener(_0x5557db,_0x4e4117){return function(){PluginEvents['removeListener'](_0x5557db,_0x4e4117);};}exports[_0x5195('0x3')]=function(_0x29577b){for(var _0x28d495=0x0,_0x1182cb=events[_0x5195('0x4')];_0x28d495<_0x1182cb;_0x28d495++){var _0x51ef0d=events[_0x28d495];var _0xb608c5=createListener(_0x5195('0x5')+_0x51ef0d,_0x29577b);PluginEvents['on'](_0x51ef0d,_0xb608c5);}}; \ No newline at end of file +var _0xbe41=['length','./plugin.events','remove'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xbe41,0x1f0));var _0x1be4=function(_0x278123,_0x275490){_0x278123=_0x278123-0x0;var _0x7edb7f=_0xbe41[_0x278123];return _0x7edb7f;};'use strict';var PluginEvents=require(_0x1be4('0x0'));var events=['save',_0x1be4('0x1'),'update'];function createListener(_0x187e7c,_0x4d6e50){return function(_0x4d9e3a){_0x4d6e50['emit'](_0x187e7c,_0x4d9e3a);};}function removeListener(_0x5f1b7c,_0xc0dfc4){return function(){PluginEvents['removeListener'](_0x5f1b7c,_0xc0dfc4);};}exports['register']=function(_0x28596f){for(var _0x87f5d9=0x0,_0x16d075=events[_0x1be4('0x2')];_0x87f5d9<_0x16d075;_0x87f5d9++){var _0x32fce8=events[_0x87f5d9];var _0xe283ff=createListener('plugin:'+_0x32fce8,_0x28596f);PluginEvents['on'](_0x32fce8,_0xe283ff);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 8471921..95c8660 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(_0x191b32,_0x5292ad){var _0x1c89ff=function(_0x101b9e){while(--_0x101b9e){_0x191b32['push'](_0x191b32['shift']());}};_0x1c89ff(++_0x5292ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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(_0x3ea80d,_0x3d76b1){var _0x1f2f0f=function(_0x5e2514){while(--_0x5e2514){_0x3ea80d['push'](_0x3ea80d['shift']());}};_0x1f2f0f(++_0x3d76b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 8eba91a..ea690d3 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 _0x7a75=['update','restart','stop','lodash','../../config/pm2','api','path','exec','sendStatus','status','json','error','stack','name','send','info','list','then','reject','express','motion2','length','catch','show','params','create','body','script','join','chdir','start','dump','Missing\x20name\x20and/or\x20path'];(function(_0x28abf4,_0x1863ee){var _0x5ee597=function(_0x15a4ac){while(--_0x15a4ac){_0x28abf4['push'](_0x28abf4['shift']());}};_0x5ee597(++_0x1863ee);}(_0x7a75,0x18f));var _0x57a7=function(_0x2ce311,_0x22a10e){_0x2ce311=_0x2ce311-0x0;var _0x4af42d=_0x7a75[_0x2ce311];return _0x4af42d;};'use strict';var _=require(_0x57a7('0x0'));var pm2=require(_0x57a7('0x1'));var logger=require('../../config/logger')(_0x57a7('0x2'));var path=require(_0x57a7('0x3'));var exec=require('child_process')[_0x57a7('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x360600,_0x5e2d41){return function(_0x2864ba){if(!_0x2864ba){_0x360600[_0x57a7('0x5')](0x194);;}return _0x2864ba;};}function respondWithResult(_0x37a98a,_0x385a32){_0x385a32=_0x385a32||0xc8;return function(_0x1796b6){if(_0x1796b6){return _0x37a98a[_0x57a7('0x6')](_0x385a32)[_0x57a7('0x7')](_0x1796b6);}return null;};}function handleError(_0x3c63a9,_0x47c23d){_0x47c23d=_0x47c23d||0x1f4;return function(_0x137427){logger[_0x57a7('0x8')](_0x137427[_0x57a7('0x9')]);if(_0x137427[_0x57a7('0xa')]){delete _0x137427['name'];}_0x3c63a9[_0x57a7('0x6')](_0x47c23d)[_0x57a7('0xb')](_0x137427);};}function execChildProcess(){return new BPromise(function(_0x46e6b7,_0x5abc18){exec('npm\x20install',function(_0x5bd853,_0x191dec,_0x4ba2b7){logger[_0x57a7('0xc')](_0x191dec);logger[_0x57a7('0xc')](_0x4ba2b7);if(_0x5bd853){logger[_0x57a7('0x8')](_0x5bd853);return _0x5abc18(_0x5bd853);}return _0x46e6b7(_0x191dec);});});}exports['index']=function(_0x5e2c47,_0x4524a4){return pm2[_0x57a7('0xd')]()[_0x57a7('0xe')](function(_0x7fb95e){if(_0x7fb95e){var _0x53a557=_[_0x57a7('0xf')](_0x7fb95e,function(_0x4156b1){return _0x4156b1[_0x57a7('0xa')]===_0x57a7('0x10')||_0x4156b1[_0x57a7('0xa')]===_0x57a7('0x11');});return{'rows':_0x53a557,'count':_0x53a557[_0x57a7('0x12')]};}return null;})['then'](respondWithResult(_0x4524a4,null))[_0x57a7('0x13')](handleError(_0x4524a4,null));};exports[_0x57a7('0x14')]=function(_0x2e37c9,_0x5c0763){return pm2['describe'](_0x2e37c9[_0x57a7('0x15')]['id'])['then'](respondWithResult(_0x5c0763,null))[_0x57a7('0xe')](handleEntityNotFound(_0x5c0763,null))[_0x57a7('0x13')](handleError(_0x5c0763,null));};exports[_0x57a7('0x16')]=function(_0x3f85ca,_0x245941){if(_0x3f85ca[_0x57a7('0x17')][_0x57a7('0xa')]&&_0x3f85ca[_0x57a7('0x17')][_0x57a7('0x18')]){var _0x3b1adc=path[_0x57a7('0x19')](__dirname,'../../files/plugins',_0x3f85ca[_0x57a7('0x17')][_0x57a7('0x18')]);var _0x44c1ba=process['cwd']();process[_0x57a7('0x1a')](path['dirname'](_0x3b1adc));return execChildProcess()[_0x57a7('0xe')](function(_0x1b4269){process['chdir'](_0x44c1ba);return pm2[_0x57a7('0x1b')]({'name':_0x3f85ca['body']['name'],'script':_0x3b1adc});})['then'](function(_0x367b53){pm2[_0x57a7('0x1c')]();return _0x367b53[0x0];})[_0x57a7('0xe')](respondWithResult(_0x245941,0xc9))['catch'](handleError(_0x245941,null));}else{return _0x245941[_0x57a7('0x6')](0x1f4)[_0x57a7('0xb')]({'message':_0x57a7('0x1d')});}};exports[_0x57a7('0x1e')]=function(_0x26c198,_0x1672e8){if(_0x26c198[_0x57a7('0x17')]['id']){delete _0x26c198[_0x57a7('0x17')]['id'];}var _0x3d6267={'online':_0x57a7('0x1f'),'stopped':_0x57a7('0x20')};if(_0x3d6267['hasOwnProperty'](_0x26c198[_0x57a7('0x17')]['status'])){return pm2[_0x3d6267[_0x26c198['body']['status']]](_0x26c198[_0x57a7('0x15')]['id'])[_0x57a7('0xe')](respondWithResult(_0x1672e8,0xc8))[_0x57a7('0x13')](handleError(_0x1672e8,null));}else{return _0x1672e8[_0x57a7('0x6')](0x1f4)[_0x57a7('0xb')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x406336,_0x1de033){if(_0x406336[_0x57a7('0x17')]['id']){delete _0x406336['body']['id'];}if(_0x406336[_0x57a7('0x15')]['id']){return pm2['delete'](_0x406336['params']['id'])[_0x57a7('0xe')](function(_0xa8046){pm2['dump']();return _0xa8046[0x0];})[_0x57a7('0xe')](respondWithResult(_0x1de033,null))['catch'](handleError(_0x1de033,null));}else{return _0x1de033[_0x57a7('0x6')](0x1f4)[_0x57a7('0xb')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x3d7b=['name','send','info','error','then','reject','express','motion2','length','params','catch','create','body','script','join','../../files/plugins','cwd','dirname','start','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','Unknown\x20status','destroy','delete','dump','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','sendStatus','status','json','stack'];(function(_0x13e8ac,_0x25c0c0){var _0xc77ea6=function(_0x757bd0){while(--_0x757bd0){_0x13e8ac['push'](_0x13e8ac['shift']());}};_0xc77ea6(++_0x25c0c0);}(_0x3d7b,0x1a2));var _0xb3d7=function(_0x27f672,_0x4cad4d){_0x27f672=_0x27f672-0x0;var _0x1be11e=_0x3d7b[_0x27f672];return _0x1be11e;};'use strict';var _=require(_0xb3d7('0x0'));var pm2=require(_0xb3d7('0x1'));var logger=require(_0xb3d7('0x2'))(_0xb3d7('0x3'));var path=require(_0xb3d7('0x4'));var exec=require(_0xb3d7('0x5'))[_0xb3d7('0x6')];var BPromise=require('bluebird');function handleEntityNotFound(_0x5f4ebb,_0x31de5e){return function(_0x34702f){if(!_0x34702f){_0x5f4ebb[_0xb3d7('0x7')](0x194);;}return _0x34702f;};}function respondWithResult(_0x261bba,_0x8bce3e){_0x8bce3e=_0x8bce3e||0xc8;return function(_0x54faf8){if(_0x54faf8){return _0x261bba[_0xb3d7('0x8')](_0x8bce3e)[_0xb3d7('0x9')](_0x54faf8);}return null;};}function handleError(_0x5911eb,_0x2208c0){_0x2208c0=_0x2208c0||0x1f4;return function(_0x5e252a){logger['error'](_0x5e252a[_0xb3d7('0xa')]);if(_0x5e252a['name']){delete _0x5e252a[_0xb3d7('0xb')];}_0x5911eb[_0xb3d7('0x8')](_0x2208c0)[_0xb3d7('0xc')](_0x5e252a);};}function execChildProcess(){return new BPromise(function(_0x2c10d3,_0x49158e){exec('npm\x20install',function(_0x2ef492,_0x4ad672,_0x527c05){logger[_0xb3d7('0xd')](_0x4ad672);logger[_0xb3d7('0xd')](_0x527c05);if(_0x2ef492){logger[_0xb3d7('0xe')](_0x2ef492);return _0x49158e(_0x2ef492);}return _0x2c10d3(_0x4ad672);});});}exports['index']=function(_0x5261a6,_0xcd5606){return pm2['list']()[_0xb3d7('0xf')](function(_0x158c27){if(_0x158c27){var _0x677b9=_[_0xb3d7('0x10')](_0x158c27,function(_0x1ab841){return _0x1ab841[_0xb3d7('0xb')]===_0xb3d7('0x11')||_0x1ab841['name']===_0xb3d7('0x12');});return{'rows':_0x677b9,'count':_0x677b9[_0xb3d7('0x13')]};}return null;})[_0xb3d7('0xf')](respondWithResult(_0xcd5606,null))['catch'](handleError(_0xcd5606,null));};exports['show']=function(_0x2a832f,_0x46cd30){return pm2['describe'](_0x2a832f[_0xb3d7('0x14')]['id'])['then'](respondWithResult(_0x46cd30,null))[_0xb3d7('0xf')](handleEntityNotFound(_0x46cd30,null))[_0xb3d7('0x15')](handleError(_0x46cd30,null));};exports[_0xb3d7('0x16')]=function(_0x48fa2d,_0x223bc4){if(_0x48fa2d['body'][_0xb3d7('0xb')]&&_0x48fa2d[_0xb3d7('0x17')][_0xb3d7('0x18')]){var _0x5a5384=path[_0xb3d7('0x19')](__dirname,_0xb3d7('0x1a'),_0x48fa2d['body'][_0xb3d7('0x18')]);var _0x2f894e=process[_0xb3d7('0x1b')]();process['chdir'](path[_0xb3d7('0x1c')](_0x5a5384));return execChildProcess()[_0xb3d7('0xf')](function(_0x12dc12){process['chdir'](_0x2f894e);return pm2[_0xb3d7('0x1d')]({'name':_0x48fa2d[_0xb3d7('0x17')][_0xb3d7('0xb')],'script':_0x5a5384});})[_0xb3d7('0xf')](function(_0xf7380a){pm2['dump']();return _0xf7380a[0x0];})[_0xb3d7('0xf')](respondWithResult(_0x223bc4,0xc9))[_0xb3d7('0x15')](handleError(_0x223bc4,null));}else{return _0x223bc4[_0xb3d7('0x8')](0x1f4)[_0xb3d7('0xc')]({'message':_0xb3d7('0x1e')});}};exports[_0xb3d7('0x1f')]=function(_0x3aac1e,_0x329443){if(_0x3aac1e[_0xb3d7('0x17')]['id']){delete _0x3aac1e[_0xb3d7('0x17')]['id'];}var _0x552f9b={'online':'restart','stopped':_0xb3d7('0x20')};if(_0x552f9b[_0xb3d7('0x21')](_0x3aac1e[_0xb3d7('0x17')][_0xb3d7('0x8')])){return pm2[_0x552f9b[_0x3aac1e[_0xb3d7('0x17')][_0xb3d7('0x8')]]](_0x3aac1e[_0xb3d7('0x14')]['id'])['then'](respondWithResult(_0x329443,0xc8))[_0xb3d7('0x15')](handleError(_0x329443,null));}else{return _0x329443[_0xb3d7('0x8')](0x1f4)[_0xb3d7('0xc')]({'message':_0xb3d7('0x22')});}};exports[_0xb3d7('0x23')]=function(_0x425e2c,_0x549c34){if(_0x425e2c['body']['id']){delete _0x425e2c[_0xb3d7('0x17')]['id'];}if(_0x425e2c['params']['id']){return pm2[_0xb3d7('0x24')](_0x425e2c['params']['id'])[_0xb3d7('0xf')](function(_0x2c1939){pm2[_0xb3d7('0x25')]();return _0x2c1939[0x0];})[_0xb3d7('0xf')](respondWithResult(_0x549c34,null))['catch'](handleError(_0x549c34,null));}else{return _0x549c34['status'](0x1f4)[_0xb3d7('0xc')]({'message':_0xb3d7('0x26')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 0aa966a..e8b2cf5 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 _0xce22=['../../config/environment','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x2b6f92,_0x2acd72){var _0x209f17=function(_0x270b8a){while(--_0x270b8a){_0x2b6f92['push'](_0x2b6f92['shift']());}};_0x209f17(++_0x2acd72);}(_0xce22,0xea));var _0x2ce2=function(_0x46be9b,_0x43f9a1){_0x46be9b=_0x46be9b-0x0;var _0x3c18ee=_0xce22[_0x46be9b];return _0x3c18ee;};'use strict';var multer=require(_0x2ce2('0x0'));var util=require(_0x2ce2('0x1'));var path=require(_0x2ce2('0x2'));var timeout=require(_0x2ce2('0x3'));var express=require(_0x2ce2('0x4'));var router=express['Router']();var auth=require(_0x2ce2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2ce2('0x6'));module[_0x2ce2('0x7')]=router; \ No newline at end of file +var _0x398a=['Router','exports','multer','util','path','connect-timeout','express'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x398a,0x11a));var _0xa398=function(_0x1c08bd,_0x47c759){_0x1c08bd=_0x1c08bd-0x0;var _0x33c85f=_0x398a[_0x1c08bd];return _0x33c85f;};'use strict';var multer=require(_0xa398('0x0'));var util=require(_0xa398('0x1'));var path=require(_0xa398('0x2'));var timeout=require(_0xa398('0x3'));var express=require(_0xa398('0x4'));var router=express[_0xa398('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xa398('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 38f5cda..cc6b48a 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 _0x18c5=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x18c5,0x64));var _0x518c=function(_0x3e85a4,_0x18c3a9){_0x3e85a4=_0x3e85a4-0x0;var _0x21e7d1=_0x18c5[_0x3e85a4];return _0x21e7d1;};'use strict';var Sequelize=require(_0x518c('0x0'));module[_0x518c('0x1')]={'state':{'type':Sequelize[_0x518c('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x518c('0x3')]},'scheduledat':{'type':Sequelize[_0x518c('0x4')]},'uniqueid':{'type':Sequelize[_0x518c('0x3')]},'starttime':{'type':Sequelize[_0x518c('0x4')]},'responsetime':{'type':Sequelize[_0x518c('0x4')]},'ringtime':{'type':Sequelize[_0x518c('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb7b8=['STRING','DATE','exports','INTEGER'];(function(_0x18cdd7,_0x18b5ca){var _0x5bd0ac=function(_0x328b81){while(--_0x328b81){_0x18cdd7['push'](_0x18cdd7['shift']());}};_0x5bd0ac(++_0x18b5ca);}(_0xb7b8,0x7e));var _0x8b7b=function(_0x3aab2d,_0x162457){_0x3aab2d=_0x3aab2d-0x0;var _0x43559b=_0xb7b8[_0x3aab2d];return _0x43559b;};'use strict';var Sequelize=require('sequelize');module[_0x8b7b('0x0')]={'state':{'type':Sequelize[_0x8b7b('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x8b7b('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x8b7b('0x2')]},'starttime':{'type':Sequelize[_0x8b7b('0x3')]},'responsetime':{'type':Sequelize[_0x8b7b('0x3')]},'ringtime':{'type':Sequelize[_0x8b7b('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x8b7b('0x2')]},'campaigntype':{'type':Sequelize[_0x8b7b('0x2')]},'membername':{'type':Sequelize[_0x8b7b('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 8b02b8d..f203c51 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 _0x64c6=['../../config/logger','api','moment','bluebird','request-promise','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','lodash','util'];(function(_0x1b1e76,_0x31695b){var _0x3d743a=function(_0x4ae27b){while(--_0x4ae27b){_0x1b1e76['push'](_0x1b1e76['shift']());}};_0x3d743a(++_0x31695b);}(_0x64c6,0x148));var _0x664c=function(_0x5400b,_0x55943a){_0x5400b=_0x5400b-0x0;var _0x36a39b=_0x64c6[_0x5400b];return _0x36a39b;};'use strict';var _=require(_0x664c('0x0'));var util=require(_0x664c('0x1'));var logger=require(_0x664c('0x2'))(_0x664c('0x3'));var moment=require(_0x664c('0x4'));var BPromise=require(_0x664c('0x5'));var rp=require(_0x664c('0x6'));var attributes=require(_0x664c('0x7'));module[_0x664c('0x8')]=function(_0x549918,_0x1fcbdb){return _0x549918['define'](_0x664c('0x9'),attributes,{'tableName':_0x664c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9835=['util','../../config/logger','api','moment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x9835,0x1b7));var _0x5983=function(_0x5e858,_0x580600){_0x5e858=_0x5e858-0x0;var _0x1d23f1=_0x9835[_0x5e858];return _0x1d23f1;};'use strict';var _=require(_0x5983('0x0'));var util=require(_0x5983('0x1'));var logger=require(_0x5983('0x2'))(_0x5983('0x3'));var moment=require(_0x5983('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x5983('0x5'));module[_0x5983('0x6')]=function(_0x2e2c48,_0x408acc){return _0x2e2c48[_0x5983('0x7')](_0x5983('0x8'),attributes,{'tableName':_0x5983('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 6cbbbe2..d684c39 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 _0xd2a2=['request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','raw','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x52cf3f,_0x157db6){var _0x429cad=function(_0x43fcaf){while(--_0x43fcaf){_0x52cf3f['push'](_0x52cf3f['shift']());}};_0x429cad(++_0x157db6);}(_0xd2a2,0x13b));var _0x2d2a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd2a2[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x2d2a('0x0'));var util=require(_0x2d2a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2d2a('0x2'));var fs=require('fs');var Redis=require(_0x2d2a('0x3'));var db=require(_0x2d2a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2d2a('0x5'))(_0x2d2a('0x6'));var config=require('../../config/environment');var jayson=require(_0x2d2a('0x7'));var client=jayson[_0x2d2a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51cb8a,_0x178975,_0x3e9cf1){return new BPromise(function(_0x5afe9b,_0x5260f6){return client[_0x2d2a('0x9')](_0x51cb8a,_0x3e9cf1)[_0x2d2a('0xa')](function(_0x3c649a){logger[_0x2d2a('0xb')](_0x2d2a('0xc'),_0x178975,_0x2d2a('0xd'));logger[_0x2d2a('0xe')](_0x2d2a('0xf'),_0x178975,'request\x20sent',JSON['stringify'](_0x3c649a));if(_0x3c649a[_0x2d2a('0x10')]){if(_0x3c649a[_0x2d2a('0x10')][_0x2d2a('0x11')]===0x1f4){logger[_0x2d2a('0x10')](_0x2d2a('0xc'),_0x178975,_0x3c649a[_0x2d2a('0x10')]['message']);return _0x5260f6(_0x3c649a[_0x2d2a('0x10')][_0x2d2a('0x12')]);}logger[_0x2d2a('0x10')](_0x2d2a('0xc'),_0x178975,_0x3c649a['error'][_0x2d2a('0x12')]);return _0x5afe9b(_0x3c649a[_0x2d2a('0x10')][_0x2d2a('0x12')]);}else{logger['info'](_0x2d2a('0xc'),_0x178975,_0x2d2a('0xd'));_0x5afe9b(_0x3c649a[_0x2d2a('0x13')][_0x2d2a('0x12')]);}})[_0x2d2a('0x14')](function(_0x57e18e){logger[_0x2d2a('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x178975,_0x57e18e);_0x5260f6(_0x57e18e);});});}exports[_0x2d2a('0x15')]=function(_0x276400){var _0x4d4504=this;return new Promise(function(_0x3a5551,_0x5cea57){return db[_0x2d2a('0x16')][_0x2d2a('0x17')](_0x276400[_0x2d2a('0x18')],{'raw':_0x276400['options']?_0x276400['options'][_0x2d2a('0x19')]===undefined?!![]:![]:!![]})[_0x2d2a('0xa')](function(_0x17bdf0){logger[_0x2d2a('0xb')](_0x2d2a('0x15'),_0x276400);logger[_0x2d2a('0xe')]('CreateReportAgentPreview',_0x276400,JSON[_0x2d2a('0x1a')](_0x17bdf0));_0x3a5551(_0x17bdf0);})[_0x2d2a('0x14')](function(_0xd75557){logger[_0x2d2a('0x10')](_0x2d2a('0x15'),_0xd75557['message'],_0x276400);_0x5cea57(_0x4d4504[_0x2d2a('0x10')](0x1f4,_0xd75557[_0x2d2a('0x12')]));});});}; \ No newline at end of file +var _0xfc85=['jayson/promise','http','then','request\x20sent','debug','stringify','error','ReportAgentPreview,\x20%s,\x20%s','message','info','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x11479f,_0x2c4e75){var _0x54b3f7=function(_0xba2ffc){while(--_0xba2ffc){_0x11479f['push'](_0x11479f['shift']());}};_0x54b3f7(++_0x2c4e75);}(_0xfc85,0x8e));var _0x5fc8=function(_0x4ab90f,_0x5cc969){_0x4ab90f=_0x4ab90f-0x0;var _0x4598fe=_0xfc85[_0x4ab90f];return _0x4598fe;};'use strict';var _=require(_0x5fc8('0x0'));var util=require(_0x5fc8('0x1'));var moment=require('moment');var BPromise=require(_0x5fc8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5fc8('0x3'));var db=require(_0x5fc8('0x4'))['db'];var utils=require(_0x5fc8('0x5'));var logger=require(_0x5fc8('0x6'))(_0x5fc8('0x7'));var config=require('../../config/environment');var jayson=require(_0x5fc8('0x8'));var client=jayson['client'][_0x5fc8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5accbf,_0x159403,_0x4bfa81){return new BPromise(function(_0x5c0fe2,_0x38b713){return client['request'](_0x5accbf,_0x4bfa81)[_0x5fc8('0xa')](function(_0x4d5bc2){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x159403,_0x5fc8('0xb'));logger[_0x5fc8('0xc')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x159403,_0x5fc8('0xb'),JSON[_0x5fc8('0xd')](_0x4d5bc2));if(_0x4d5bc2[_0x5fc8('0xe')]){if(_0x4d5bc2['error']['code']===0x1f4){logger[_0x5fc8('0xe')](_0x5fc8('0xf'),_0x159403,_0x4d5bc2[_0x5fc8('0xe')]['message']);return _0x38b713(_0x4d5bc2[_0x5fc8('0xe')][_0x5fc8('0x10')]);}logger[_0x5fc8('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x159403,_0x4d5bc2[_0x5fc8('0xe')][_0x5fc8('0x10')]);return _0x5c0fe2(_0x4d5bc2['error'][_0x5fc8('0x10')]);}else{logger[_0x5fc8('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x159403,_0x5fc8('0xb'));_0x5c0fe2(_0x4d5bc2['result'][_0x5fc8('0x10')]);}})[_0x5fc8('0x12')](function(_0x2002dd){logger['error'](_0x5fc8('0xf'),_0x159403,_0x2002dd);_0x38b713(_0x2002dd);});});}exports[_0x5fc8('0x13')]=function(_0x27474a){var _0x278c63=this;return new Promise(function(_0x48c4a4,_0x2ae267){return db[_0x5fc8('0x14')][_0x5fc8('0x15')](_0x27474a[_0x5fc8('0x16')],{'raw':_0x27474a['options']?_0x27474a[_0x5fc8('0x17')][_0x5fc8('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x284c4f){logger[_0x5fc8('0x11')](_0x5fc8('0x13'),_0x27474a);logger[_0x5fc8('0xc')](_0x5fc8('0x13'),_0x27474a,JSON[_0x5fc8('0xd')](_0x284c4f));_0x48c4a4(_0x284c4f);})[_0x5fc8('0x12')](function(_0x40af56){logger['error'](_0x5fc8('0x13'),_0x40af56[_0x5fc8('0x10')],_0x27474a);_0x2ae267(_0x278c63[_0x5fc8('0xe')](0x1f4,_0x40af56[_0x5fc8('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index a85ac39..a97128e 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 _0xa000=['telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','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','Router','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','agents','put','/agents/:id/capacity','agentCapacity','/telephones'];(function(_0x206ccb,_0x3ba266){var _0x18f131=function(_0x354920){while(--_0x354920){_0x206ccb['push'](_0x206ccb['shift']());}};_0x18f131(++_0x3ba266);}(_0xa000,0x18f));var _0x0a00=function(_0x526497,_0x172750){_0x526497=_0x526497-0x0;var _0x40fb88=_0xa000[_0x526497];return _0x40fb88;};'use strict';var multer=require('multer');var util=require(_0x0a00('0x0'));var path=require(_0x0a00('0x1'));var express=require('express');var router=express[_0x0a00('0x2')]();var auth=require('../../components/auth/service');var controller=require(_0x0a00('0x3'));router[_0x0a00('0x4')](_0x0a00('0x5'),auth['isAuthenticated'](),controller[_0x0a00('0x6')]);router['get'](_0x0a00('0x7'),auth[_0x0a00('0x8')](),controller[_0x0a00('0x9')]);router[_0x0a00('0x4')](_0x0a00('0xa'),auth[_0x0a00('0x8')](),controller[_0x0a00('0xb')]);router[_0x0a00('0x4')]('/voice/queues',auth[_0x0a00('0x8')](),controller[_0x0a00('0xc')]);router[_0x0a00('0x4')](_0x0a00('0xd'),auth[_0x0a00('0x8')](),controller['chatQueues']);router[_0x0a00('0x4')](_0x0a00('0xe'),auth['isAuthenticated'](),controller['mailQueues']);router['get'](_0x0a00('0xf'),auth[_0x0a00('0x8')](),controller[_0x0a00('0x10')]);router[_0x0a00('0x4')](_0x0a00('0x11'),auth[_0x0a00('0x8')](),controller['openchannelQueues']);router[_0x0a00('0x4')](_0x0a00('0x12'),auth[_0x0a00('0x8')](),controller[_0x0a00('0x13')]);router[_0x0a00('0x4')](_0x0a00('0x14'),auth[_0x0a00('0x8')](),controller[_0x0a00('0x15')]);router[_0x0a00('0x4')]('/voice/queues/preview/:id',auth[_0x0a00('0x8')](),controller[_0x0a00('0x16')]);router[_0x0a00('0x4')](_0x0a00('0x17'),auth['isAuthenticated'](),controller[_0x0a00('0x18')]);router[_0x0a00('0x4')]('/voice/queues/channels/:uniqueid',auth[_0x0a00('0x8')](),controller[_0x0a00('0x19')]);router['get'](_0x0a00('0x1a'),auth[_0x0a00('0x8')](),controller[_0x0a00('0x1b')]);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router[_0x0a00('0x4')](_0x0a00('0x1c'),auth[_0x0a00('0x8')](),controller[_0x0a00('0x1d')]);router[_0x0a00('0x4')](_0x0a00('0x1e'),auth['isAuthenticated'](),controller[_0x0a00('0x1f')]);router[_0x0a00('0x4')](_0x0a00('0x20'),auth[_0x0a00('0x8')](),controller[_0x0a00('0x21')]);router['get']('/agents',auth['isAuthenticated'](),controller[_0x0a00('0x22')]);router[_0x0a00('0x23')](_0x0a00('0x24'),auth[_0x0a00('0x8')](),controller[_0x0a00('0x25')]);router[_0x0a00('0x4')](_0x0a00('0x26'),auth['isAuthenticated'](),controller[_0x0a00('0x27')]);router['get'](_0x0a00('0x28'),auth[_0x0a00('0x8')](),controller[_0x0a00('0x29')]);router[_0x0a00('0x4')]('/campaigns',auth[_0x0a00('0x8')](),controller[_0x0a00('0x2a')]);router['get'](_0x0a00('0x2b'),auth[_0x0a00('0x8')](),controller[_0x0a00('0x2c')]);router['get']('/chat/queues/waitinginteractions',auth[_0x0a00('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0x0a00('0x4')]('/mail/queues/waitinginteractions',auth[_0x0a00('0x8')](),controller[_0x0a00('0x2d')]);router[_0x0a00('0x4')](_0x0a00('0x2e'),auth[_0x0a00('0x8')](),controller[_0x0a00('0x2f')]);router['get'](_0x0a00('0x30'),auth['isAuthenticated'](),controller[_0x0a00('0x31')]);router[_0x0a00('0x4')](_0x0a00('0x32'),auth[_0x0a00('0x8')](),controller[_0x0a00('0x33')]);router[_0x0a00('0x34')](_0x0a00('0x35'),auth[_0x0a00('0x8')](),controller[_0x0a00('0x36')]('mail'));router[_0x0a00('0x4')](_0x0a00('0x37'),auth[_0x0a00('0x8')](),controller[_0x0a00('0x38')]);router[_0x0a00('0x34')]('/chat/queues/:id/notify',auth[_0x0a00('0x8')](),controller[_0x0a00('0x36')]('chat'));router[_0x0a00('0x4')](_0x0a00('0x39'),auth[_0x0a00('0x8')](),controller[_0x0a00('0x3a')]);router[_0x0a00('0x34')](_0x0a00('0x3b'),auth[_0x0a00('0x8')](),controller[_0x0a00('0x36')]('fax'));router[_0x0a00('0x4')](_0x0a00('0x3c'),auth['isAuthenticated'](),controller[_0x0a00('0x3d')]);router[_0x0a00('0x34')](_0x0a00('0x3e'),auth['isAuthenticated'](),controller[_0x0a00('0x36')](_0x0a00('0x3f')));router[_0x0a00('0x4')](_0x0a00('0x40'),auth[_0x0a00('0x8')](),controller[_0x0a00('0x41')]);router[_0x0a00('0x34')](_0x0a00('0x42'),auth[_0x0a00('0x8')](),controller[_0x0a00('0x36')](_0x0a00('0x43')));router[_0x0a00('0x4')](_0x0a00('0x44'),auth[_0x0a00('0x8')](),controller[_0x0a00('0x45')]);router['post'](_0x0a00('0x46'),auth[_0x0a00('0x8')](),controller[_0x0a00('0x47')]);module[_0x0a00('0x48')]=router; \ No newline at end of file +var _0xc42c=['/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','outbound','/outbound/channels','/agents','agents','put','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/sms/queues/:id','/agents/:id/notify','agentNotify','exports','util','path','express','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/chat/queues','chatQueues','mailQueues','/mail/accounts','smsQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid'];(function(_0x3c9864,_0x488a3c){var _0x416dcd=function(_0x3f03d6){while(--_0x3f03d6){_0x3c9864['push'](_0x3c9864['shift']());}};_0x416dcd(++_0x488a3c);}(_0xc42c,0x13e));var _0xcc42=function(_0x2fa219,_0x3bdbfc){_0x2fa219=_0x2fa219-0x0;var _0x1e07ec=_0xc42c[_0x2fa219];return _0x1e07ec;};'use strict';var multer=require('multer');var util=require(_0xcc42('0x0'));var path=require(_0xcc42('0x1'));var express=require(_0xcc42('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router[_0xcc42('0x3')](_0xcc42('0x4'),auth[_0xcc42('0x5')](),controller[_0xcc42('0x6')]);router[_0xcc42('0x3')](_0xcc42('0x7'),auth[_0xcc42('0x5')](),controller[_0xcc42('0x8')]);router[_0xcc42('0x3')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0xcc42('0x9')]);router[_0xcc42('0x3')]('/voice/queues',auth[_0xcc42('0x5')](),controller['voiceQueues']);router['get'](_0xcc42('0xa'),auth[_0xcc42('0x5')](),controller[_0xcc42('0xb')]);router['get']('/mail/queues',auth[_0xcc42('0x5')](),controller[_0xcc42('0xc')]);router[_0xcc42('0x3')](_0xcc42('0xd'),auth[_0xcc42('0x5')](),controller['mailAccounts']);router[_0xcc42('0x3')]('/openchannel/queues',auth[_0xcc42('0x5')](),controller['openchannelQueues']);router[_0xcc42('0x3')]('/sms/queues',auth[_0xcc42('0x5')](),controller[_0xcc42('0xe')]);router[_0xcc42('0x3')](_0xcc42('0xf'),auth[_0xcc42('0x5')](),controller[_0xcc42('0x10')]);router[_0xcc42('0x3')](_0xcc42('0x11'),auth[_0xcc42('0x5')](),controller[_0xcc42('0x12')]);router[_0xcc42('0x3')](_0xcc42('0x13'),auth[_0xcc42('0x5')](),controller[_0xcc42('0x14')]);router[_0xcc42('0x3')](_0xcc42('0x15'),auth[_0xcc42('0x5')](),controller['voiceQueuesChannel']);router[_0xcc42('0x3')](_0xcc42('0x16'),auth[_0xcc42('0x5')](),controller[_0xcc42('0x17')]);router['get'](_0xcc42('0x18'),auth[_0xcc42('0x5')](),controller[_0xcc42('0x19')]);router[_0xcc42('0x3')](_0xcc42('0x1a'),auth[_0xcc42('0x5')](),controller[_0xcc42('0x1b')]);router[_0xcc42('0x3')]('/outbound',auth[_0xcc42('0x5')](),controller[_0xcc42('0x1c')]);router['get'](_0xcc42('0x1d'),auth['isAuthenticated'](),controller['outboundChannels']);router['get'](_0xcc42('0x1e'),auth[_0xcc42('0x5')](),controller[_0xcc42('0x1f')]);router[_0xcc42('0x20')]('/agents/:id/capacity',auth[_0xcc42('0x5')](),controller[_0xcc42('0x21')]);router['get'](_0xcc42('0x22'),auth[_0xcc42('0x5')](),controller[_0xcc42('0x23')]);router[_0xcc42('0x3')](_0xcc42('0x24'),auth[_0xcc42('0x5')](),controller[_0xcc42('0x25')]);router['get']('/campaigns',auth[_0xcc42('0x5')](),controller[_0xcc42('0x26')]);router[_0xcc42('0x3')](_0xcc42('0x27'),auth[_0xcc42('0x5')](),controller[_0xcc42('0x28')]);router[_0xcc42('0x3')](_0xcc42('0x29'),auth[_0xcc42('0x5')](),controller[_0xcc42('0x2a')]);router[_0xcc42('0x3')](_0xcc42('0x2b'),auth[_0xcc42('0x5')](),controller[_0xcc42('0x2c')]);router[_0xcc42('0x3')]('/openchannel/queues/waitinginteractions',auth[_0xcc42('0x5')](),controller[_0xcc42('0x2d')]);router[_0xcc42('0x3')](_0xcc42('0x2e'),auth[_0xcc42('0x5')](),controller[_0xcc42('0x2f')]);router[_0xcc42('0x3')](_0xcc42('0x30'),auth[_0xcc42('0x5')](),controller['faxQueuesWaitingInteractions']);router[_0xcc42('0x31')](_0xcc42('0x32'),auth['isAuthenticated'](),controller['queueNotify'](_0xcc42('0x33')));router[_0xcc42('0x3')](_0xcc42('0x34'),auth[_0xcc42('0x5')](),controller[_0xcc42('0x35')]);router[_0xcc42('0x31')](_0xcc42('0x36'),auth['isAuthenticated'](),controller[_0xcc42('0x37')](_0xcc42('0x38')));router[_0xcc42('0x3')](_0xcc42('0x39'),auth[_0xcc42('0x5')](),controller[_0xcc42('0x3a')]);router[_0xcc42('0x31')]('/fax/queues/:id/notify',auth[_0xcc42('0x5')](),controller[_0xcc42('0x37')]('fax'));router[_0xcc42('0x3')]('/fax/queues/:id',auth[_0xcc42('0x5')](),controller[_0xcc42('0x3b')]);router[_0xcc42('0x31')](_0xcc42('0x3c'),auth[_0xcc42('0x5')](),controller[_0xcc42('0x37')]('openchannel'));router[_0xcc42('0x3')](_0xcc42('0x3d'),auth[_0xcc42('0x5')](),controller[_0xcc42('0x3e')]);router['post'](_0xcc42('0x3f'),auth[_0xcc42('0x5')](),controller[_0xcc42('0x37')]('sms'));router['get'](_0xcc42('0x40'),auth['isAuthenticated'](),controller['showSmsQueues']);router[_0xcc42('0x31')](_0xcc42('0x41'),auth[_0xcc42('0x5')](),controller[_0xcc42('0x42')]);module[_0xcc42('0x43')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 1240dfb..47a01eb 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 _0xd80f=['agentTransferTimeout','*,*,*,*','bluebird','moment','util','../../mysqldb','api','jayson/promise','client','http','then','error','code','message','result','catch','status','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','query','voiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','OutboundChannels','agents','Agents','body','interaction','user','hasOwnProperty','MemberReport','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','interface','agent','AgentCapacity','capacity','telephones','trunks','Trunks','campaigns','Campaigns','showChatQueues','ChatQueues','mailQueues','showMailQueues','MailQueues','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','capitalize','chat','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','channel','Website','User','MessageId'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xd80f,0x70));var _0xfd80=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd80f[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xfd80('0x0'));var moment=require(_0xfd80('0x1'));var _=require('lodash');var util=require(_0xfd80('0x2'));var db=require(_0xfd80('0x3'))['db'];var logger=require('../../config/logger')(_0xfd80('0x4'));var jayson=require(_0xfd80('0x5'));var amiClient=jayson[_0xfd80('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0xfd80('0x6')][_0xfd80('0x7')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x3a15ce,_0x58ca64,_0x2236eb){return new BPromise(function(_0x16ec66,_0x4e3189){var _0x1ed6a4=_0x2236eb?_0x2236eb:amiClient;return _0x1ed6a4['request'](_0x3a15ce,_0x58ca64)[_0xfd80('0x8')](function(_0x440597){if(_0x440597[_0xfd80('0x9')]){if(_0x440597[_0xfd80('0x9')][_0xfd80('0xa')]===0x1f4){return _0x4e3189(_0x440597[_0xfd80('0x9')][_0xfd80('0xb')]);}return _0x16ec66(_0x440597['error'][_0xfd80('0xb')]);}else{_0x16ec66(_0x440597[_0xfd80('0xc')]);}})[_0xfd80('0xd')](function(_0x1e79f6){_0x4e3189(_0x1e79f6);});});}function respondWithResult(_0x598178,_0x1bd0bc){_0x1bd0bc=_0x1bd0bc||0xc8;return function(_0x3c1fc9){if(_0x3c1fc9){return _0x598178[_0xfd80('0xe')](_0x1bd0bc)['json'](_0x3c1fc9);}return _0x598178[_0xfd80('0xf')](0x194);};}function handleError(_0x2940bc,_0x292719){_0x292719=_0x292719||0x1f4;return function(_0x126a83){logger[_0xfd80('0x9')](_0x126a83[_0xfd80('0x10')]);if(_0x126a83[_0xfd80('0x11')]){delete _0x126a83['name'];}_0x2940bc[_0xfd80('0xe')](_0x292719)[_0xfd80('0x12')](_0x126a83);};}function findById(_0x152436){return function(_0x119f0c){if(!_[_0xfd80('0x13')](_0x152436)&&!_[_0xfd80('0x13')](_0x119f0c)&&!_[_0xfd80('0x13')](_0x119f0c['rows'])){return _[_0xfd80('0x14')](_0x119f0c[_0xfd80('0x15')],function(_0x5e0c2d){return _0x5e0c2d['id']==_0x152436;});}return null;};}exports[_0xfd80('0x16')]=function(_0x526aa5,_0x438581){return respondWithRpcPromise('VoiceChannels',_0x526aa5[_0xfd80('0x17')])[_0xfd80('0x8')](respondWithResult(_0x438581,null))[_0xfd80('0xd')](handleError(_0x438581,null));};exports[_0xfd80('0x18')]=function(_0x1da125,_0xa7c34d){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xfd80('0x19')](_0x1da125[_0xfd80('0x17')],_0x1da125[_0xfd80('0x1a')]))['then'](respondWithResult(_0xa7c34d,null))[_0xfd80('0xd')](handleError(_0xa7c34d,null));};exports[_0xfd80('0x1b')]=function(_0xd49bc9,_0x3c4bd6){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0xd49bc9[_0xfd80('0x17')],_0xd49bc9['params']))[_0xfd80('0x8')](respondWithResult(_0x3c4bd6,null))[_0xfd80('0xd')](handleError(_0x3c4bd6,null));};exports[_0xfd80('0x1c')]=function(_0x40c259,_0xce6d53){return respondWithRpcPromise('VoiceQueues',_0x40c259['query'])['then'](respondWithResult(_0xce6d53,null))[_0xfd80('0xd')](handleError(_0xce6d53,null));};exports['showVoiceQueues']=function(_0x4b1ca1,_0x11b852){return respondWithRpcPromise(_0xfd80('0x1d'),_0x4b1ca1[_0xfd80('0x17')])['then'](findById(_0x4b1ca1[_0xfd80('0x1a')]['id']))['then'](respondWithResult(_0x11b852,null))[_0xfd80('0xd')](handleError(_0x11b852,null));};exports['voiceQueuesPreview']=function(_0x1062ad,_0x3dce67){return respondWithRpcPromise(_0xfd80('0x1e'),_[_0xfd80('0x19')](_0x1062ad[_0xfd80('0x17')],_0x1062ad[_0xfd80('0x1a')]))[_0xfd80('0x8')](respondWithResult(_0x3dce67,null))[_0xfd80('0xd')](handleError(_0x3dce67,null));};exports[_0xfd80('0x1f')]=function(_0x4ccd1c,_0x8400c3){return respondWithRpcPromise('VoiceQueuesChannels',_0x4ccd1c[_0xfd80('0x17')])['then'](respondWithResult(_0x8400c3,null))['catch'](handleError(_0x8400c3,null));};exports[_0xfd80('0x20')]=function(_0x12abfa,_0x4d64be){return respondWithRpcPromise(_0xfd80('0x21'),_[_0xfd80('0x19')](_0x12abfa[_0xfd80('0x17')],_0x12abfa[_0xfd80('0x1a')]))[_0xfd80('0x8')](respondWithResult(_0x4d64be,null))[_0xfd80('0xd')](handleError(_0x4d64be,null));};exports[_0xfd80('0x22')]=function(_0x20d19a,_0x31e379){return respondWithRpcPromise(_0xfd80('0x23'),_[_0xfd80('0x19')](_0x20d19a[_0xfd80('0x17')],_0x20d19a[_0xfd80('0x1a')]))[_0xfd80('0x8')](respondWithResult(_0x31e379,null))[_0xfd80('0xd')](handleError(_0x31e379,null));};exports[_0xfd80('0x24')]=function(_0x14b66e,_0x3aec8f){return respondWithRpcPromise(_0xfd80('0x25'),_['merge'](_0x14b66e[_0xfd80('0x17')],_0x14b66e[_0xfd80('0x1a')]))[_0xfd80('0x8')](respondWithResult(_0x3aec8f,null))[_0xfd80('0xd')](handleError(_0x3aec8f,null));};exports[_0xfd80('0x26')]=function(_0x587df1,_0x522ee7){return respondWithRpcPromise('Outbound',_0x587df1['query'])[_0xfd80('0x8')](respondWithResult(_0x522ee7,null))['catch'](handleError(_0x522ee7,null));};exports['outboundChannels']=function(_0x54fc4a,_0x4dabd8){return respondWithRpcPromise(_0xfd80('0x27'),_0x54fc4a[_0xfd80('0x17')])[_0xfd80('0x8')](respondWithResult(_0x4dabd8,null))[_0xfd80('0xd')](handleError(_0x4dabd8,null));};exports[_0xfd80('0x28')]=function(_0x532348,_0x192280){var _0x8a0c23;return respondWithRpcPromise(_0xfd80('0x29'),_0x532348[_0xfd80('0x17')])[_0xfd80('0x8')](function(_0x191924){_0x8a0c23=_0x191924;return respondWithRpcPromise('Agents',_0x532348['query'],routingClient);})[_0xfd80('0x8')](function(_0x4feb42){return _['merge']({},_0x4feb42,_0x8a0c23);})['then'](respondWithResult(_0x192280,null))[_0xfd80('0xd')](handleError(_0x192280,null));};exports['agentCapacity']=function(_0x167c4e,_0x334084){if(_0x167c4e[_0xfd80('0x2a')]&&_0x167c4e['body'][_0xfd80('0x2b')]&&_0x167c4e[_0xfd80('0x2c')]&&_0x167c4e[_0xfd80('0x2c')]['name']){for(var _0x29498e in _0x167c4e[_0xfd80('0x2a')]['interaction']){if(_0x167c4e[_0xfd80('0x2a')][_0xfd80('0x2b')][_0xfd80('0x2d')](_0x29498e)){db[_0xfd80('0x2e')]['findAll']({'where':{'channel':_0x29498e,'membername':_0x167c4e[_0xfd80('0x2c')][_0xfd80('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x167c4e[_0xfd80('0x2a')][_0xfd80('0x2b')][_0x29498e]&&_0x167c4e[_0xfd80('0x2a')][_0xfd80('0x2b')][_0x29498e][_0xfd80('0x2f')]?{'$notIn':_0x167c4e['body'][_0xfd80('0x2b')][_0x29498e]}:{'$ne':null}}})[_0xfd80('0x8')](function(_0x2d4139){var _0x2680d2=moment()['format'](_0xfd80('0x30'));for(var _0x8c1fe7=0x0,_0x3ca68a=_0x2d4139[_0xfd80('0x2f')];_0x8c1fe7<_0x3ca68a;_0x8c1fe7+=0x1){_0x2d4139[_0x8c1fe7][_0xfd80('0x31')]({'exitAt':_0x2680d2});}});for(var _0x30b418=0x0;_0x30b418<_0x167c4e['body'][_0xfd80('0x2b')][_0x29498e][_0xfd80('0x2f')];_0x30b418+=0x1){db['MemberReport'][_0xfd80('0x32')]({'where':{'channel':_0x29498e,'membername':_0x167c4e[_0xfd80('0x2c')][_0xfd80('0x11')],'type':_0xfd80('0x33'),'uniqueid':_0x167c4e[_0xfd80('0x2a')][_0xfd80('0x2b')][_0x29498e][_0x30b418],'exitAt':null},'defaults':{'channel':_0x29498e,'membername':_0x167c4e[_0xfd80('0x2c')][_0xfd80('0x11')],'interface':_[_0xfd80('0x13')](_0x167c4e[_0xfd80('0x2c')][_0xfd80('0x34')])?util['format']('SIP/%s',_0x167c4e[_0xfd80('0x2c')][_0xfd80('0x11')]):_0x167c4e['user'][_0xfd80('0x34')],'type':'INTERACTION','enterAt':moment()['format'](_0xfd80('0x30')),'role':_0xfd80('0x35'),'internal':_0x167c4e['user']['internal'],'uniqueid':_0x167c4e[_0xfd80('0x2a')]['interaction'][_0x29498e][_0x30b418]}});}}}}return respondWithRpcPromise(_0xfd80('0x36'),{'id':_0x167c4e[_0xfd80('0x1a')]['id'],'capacity':_0x167c4e[_0xfd80('0x2a')][_0xfd80('0x37')]},routingClient)['then'](respondWithResult(_0x334084,null))[_0xfd80('0xd')](handleError(_0x334084,null));};exports[_0xfd80('0x38')]=function(_0x1df515,_0x5b93c4){return respondWithRpcPromise('Telephones',_0x1df515['query'])[_0xfd80('0x8')](respondWithResult(_0x5b93c4,null))['catch'](handleError(_0x5b93c4,null));};exports[_0xfd80('0x39')]=function(_0x103a2d,_0x489a2f){return respondWithRpcPromise(_0xfd80('0x3a'),_0x103a2d[_0xfd80('0x17')])[_0xfd80('0x8')](respondWithResult(_0x489a2f,null))['catch'](handleError(_0x489a2f,null));};exports[_0xfd80('0x3b')]=function(_0x32677e,_0x767c35){return respondWithRpcPromise(_0xfd80('0x3c'),_0x32677e['query'])[_0xfd80('0x8')](respondWithResult(_0x767c35,null))[_0xfd80('0xd')](handleError(_0x767c35,null));};exports['chatQueues']=function(_0x29b58e,_0x4fa931){return respondWithRpcPromise('ChatQueues',_0x29b58e[_0xfd80('0x17')],routingClient)[_0xfd80('0x8')](respondWithResult(_0x4fa931,null))[_0xfd80('0xd')](handleError(_0x4fa931,null));};exports[_0xfd80('0x3d')]=function(_0x3129d8,_0x22dc6b){return respondWithRpcPromise(_0xfd80('0x3e'),_0x3129d8[_0xfd80('0x17')],routingClient)[_0xfd80('0x8')](findById(_0x3129d8['params']['id']))['then'](respondWithResult(_0x22dc6b,null))[_0xfd80('0xd')](handleError(_0x22dc6b,null));};exports[_0xfd80('0x3f')]=function(_0x3821c4,_0x15cf5a){return respondWithRpcPromise('MailQueues',_0x3821c4[_0xfd80('0x17')],routingClient)[_0xfd80('0x8')](respondWithResult(_0x15cf5a,null))['catch'](handleError(_0x15cf5a,null));};exports[_0xfd80('0x40')]=function(_0x1cca46,_0x57a00f){return respondWithRpcPromise(_0xfd80('0x41'),_0x1cca46[_0xfd80('0x17')],routingClient)[_0xfd80('0x8')](findById(_0x1cca46['params']['id']))[_0xfd80('0x8')](respondWithResult(_0x57a00f,null))[_0xfd80('0xd')](handleError(_0x57a00f,null));};exports['mailAccounts']=function(_0x4c37d3,_0x2e01e9){return respondWithRpcPromise(_0xfd80('0x42'),_0x4c37d3['query'],mailClient)[_0xfd80('0x8')](respondWithResult(_0x2e01e9,null))[_0xfd80('0xd')](handleError(_0x2e01e9,null));};exports['openchannelQueues']=function(_0x409745,_0x591c42){return respondWithRpcPromise(_0xfd80('0x43'),_0x409745[_0xfd80('0x17')],routingClient)[_0xfd80('0x8')](respondWithResult(_0x591c42,null))[_0xfd80('0xd')](handleError(_0x591c42,null));};exports[_0xfd80('0x44')]=function(_0x4067d1,_0xab0e01){return respondWithRpcPromise(_0xfd80('0x43'),_0x4067d1[_0xfd80('0x17')],routingClient)['then'](findById(_0x4067d1[_0xfd80('0x1a')]['id']))[_0xfd80('0x8')](respondWithResult(_0xab0e01,null))[_0xfd80('0xd')](handleError(_0xab0e01,null));};exports[_0xfd80('0x45')]=function(_0xe090ac,_0x2d213c){return respondWithRpcPromise(_0xfd80('0x46'),_0xe090ac[_0xfd80('0x17')],routingClient)[_0xfd80('0x8')](respondWithResult(_0x2d213c,null))[_0xfd80('0xd')](handleError(_0x2d213c,null));};exports[_0xfd80('0x47')]=function(_0x814893,_0x1e7cde){return respondWithRpcPromise(_0xfd80('0x46'),_0x814893[_0xfd80('0x17')],routingClient)['then'](findById(_0x814893[_0xfd80('0x1a')]['id']))[_0xfd80('0x8')](respondWithResult(_0x1e7cde,null))[_0xfd80('0xd')](handleError(_0x1e7cde,null));};exports[_0xfd80('0x48')]=function(_0x3aa881,_0x5a661e){return respondWithRpcPromise(_0xfd80('0x49'),_0x3aa881[_0xfd80('0x17')],routingClient)[_0xfd80('0x8')](respondWithResult(_0x5a661e,null))[_0xfd80('0xd')](handleError(_0x5a661e,null));};exports[_0xfd80('0x4a')]=function(_0xe99c4d,_0x3bbffb){return respondWithRpcPromise('FaxQueues',_0xe99c4d[_0xfd80('0x17')],routingClient)[_0xfd80('0x8')](findById(_0xe99c4d[_0xfd80('0x1a')]['id']))['then'](respondWithResult(_0x3bbffb,null))['catch'](handleError(_0x3bbffb,null));};exports[_0xfd80('0x4b')]=function(_0x3f86e6,_0x597e92){return respondWithRpcPromise(_0xfd80('0x4c'),_0x3f86e6[_0xfd80('0x17')])['then'](respondWithResult(_0x597e92,null))[_0xfd80('0xd')](handleError(_0x597e92,null));};exports[_0xfd80('0x4d')]=function(_0x29d540,_0x4b250b){return respondWithRpcPromise(_0xfd80('0x4e'),_0x29d540[_0xfd80('0x17')],routingClient)[_0xfd80('0x8')](respondWithResult(_0x4b250b,null))[_0xfd80('0xd')](handleError(_0x4b250b,null));};exports[_0xfd80('0x4f')]=function(_0x41125e,_0x4cfde9){return respondWithRpcPromise(_0xfd80('0x50'),_0x41125e[_0xfd80('0x17')],routingClient)[_0xfd80('0x8')](respondWithResult(_0x4cfde9,null))[_0xfd80('0xd')](handleError(_0x4cfde9,null));};exports[_0xfd80('0x51')]=function(_0x5cf82e,_0x202d64){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x5cf82e[_0xfd80('0x17')],routingClient)[_0xfd80('0x8')](respondWithResult(_0x202d64,null))[_0xfd80('0xd')](handleError(_0x202d64,null));};exports[_0xfd80('0x52')]=function(_0x5ac529,_0x2b4a9a){return respondWithRpcPromise(_0xfd80('0x53'),_0x5ac529[_0xfd80('0x17')],routingClient)[_0xfd80('0x8')](respondWithResult(_0x2b4a9a,null))[_0xfd80('0xd')](handleError(_0x2b4a9a,null));};exports[_0xfd80('0x54')]=function(_0x36c270,_0x15b315){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x36c270[_0xfd80('0x17')],routingClient)[_0xfd80('0x8')](respondWithResult(_0x15b315,null))[_0xfd80('0xd')](handleError(_0x15b315,null));};exports['queueNotify']=function(_0x444e1f){return function(_0x40900c,_0x84c528){var _0x3da5b7,_0x570785;var _0x4526af=_[_0xfd80('0x55')](_0x444e1f);var _0x222f76=_0x444e1f===_0xfd80('0x56')?'Website':_0xfd80('0x57');return db[_0x4526af+_0xfd80('0x58')][_0xfd80('0x59')]({'raw':!![],'where':{'id':_0x40900c[_0xfd80('0x1a')]['id']}})['then'](function(_0x587c66){if(_[_0xfd80('0x13')](_0x587c66)){throw new Error(_0x4526af+_0xfd80('0x5a'));}_0x3da5b7=_0x587c66;return db[_0x4526af+_0xfd80('0x5b')][_0xfd80('0x59')]({'where':{'id':_0x40900c[_0xfd80('0x2a')][_0xfd80('0x5c')]},'include':[{'model':db[_0x4526af+_0xfd80('0x5d')],'as':_0xfd80('0x5d')},{'model':db[_0x4526af+_0x222f76],'as':_0xfd80('0x57')}]});})[_0xfd80('0x8')](function(_0x467e07){if(_['isNil'](_0x467e07)){throw new Error(_0x4526af+_0xfd80('0x5e'));}_0x570785=_0x467e07;return _0x467e07[_0xfd80('0x5f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x197f79={'uniqueid':_0x444e1f+'.'+_0x570785['id']+'.'+_0x570785['Interaction']['id'],'FromUserId':_0x40900c[_0xfd80('0x2c')]['id'],'type':_0xfd80('0x60')};_0x197f79[_0x4526af+'MessageId']=_0x570785['id'];_0x197f79[_0x4526af+_0xfd80('0x61')]=_0x570785[_0xfd80('0x5d')]['id'];_0x197f79[_0xfd80('0x62')+_0x4526af+_0x222f76+'Id']=_0x570785['Account']['id'];_0x197f79['To'+_0x4526af+_0xfd80('0x63')]=_0x3da5b7['id'];return db[_0x4526af+_0xfd80('0x64')][_0xfd80('0x65')](_0x197f79);})[_0xfd80('0x8')](function(){return respondWithRpcPromise(_0xfd80('0x66'),{'channel':_0x444e1f,'interaction':_0x570785[_0xfd80('0x5d')],'message':_0x570785,'account':_0x570785[_0xfd80('0x57')],'applications':[{'id':0x0,'priority':0x1,'app':_0xfd80('0x60'),'appdata':_0x3da5b7[_0xfd80('0x11')]+','+(_0x570785[_0xfd80('0x57')][_0xfd80('0x67')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xfd80('0x8')](respondWithResult(_0x84c528,null))['catch'](handleError(_0x84c528,null));};};exports['agentNotify']=function(_0x325016,_0x6f3c5b){var _0x8dbf22,_0x3728ee;if(_['isNil'](_0x325016[_0xfd80('0x2a')][_0xfd80('0x68')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x50dd80=_0x325016[_0xfd80('0x2a')][_0xfd80('0x68')];var _0x22e326=_[_0xfd80('0x55')](_0x50dd80);var _0x11c61d=_0x50dd80===_0xfd80('0x56')?_0xfd80('0x69'):_0xfd80('0x57');return db[_0xfd80('0x6a')][_0xfd80('0x59')]({'raw':!![],'where':{'id':_0x325016[_0xfd80('0x1a')]['id'],'role':'agent'}})[_0xfd80('0x8')](function(_0x5f6182){if(_[_0xfd80('0x13')](_0x5f6182)){throw new Error('Agent\x20not\x20found');}_0x8dbf22=_0x5f6182;return db[_0x22e326+_0xfd80('0x5b')][_0xfd80('0x59')]({'where':{'id':_0x325016[_0xfd80('0x2a')][_0xfd80('0x5c')]},'include':[{'model':db[_0x22e326+_0xfd80('0x5d')],'as':_0xfd80('0x5d')},{'model':db[_0x22e326+_0x11c61d],'as':_0xfd80('0x57')}]});})[_0xfd80('0x8')](function(_0xbadff5){if(_['isNil'](_0xbadff5)){throw new Error(_0x22e326+'\x20Message\x20not\x20found');}_0x3728ee=_0xbadff5;return _0xbadff5['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xfd80('0x8')](function(){var _0x398b69={'uniqueid':_0x50dd80+'.'+_0x3728ee['id']+'.'+_0x3728ee[_0xfd80('0x5d')]['id'],'FromUserId':_0x325016[_0xfd80('0x2c')]['id'],'type':_0xfd80('0x60'),'ToUserId':_0x8dbf22['id']};_0x398b69[_0x22e326+_0xfd80('0x6b')]=_0x3728ee['id'];_0x398b69[_0x22e326+_0xfd80('0x61')]=_0x3728ee['Interaction']['id'];_0x398b69[_0xfd80('0x62')+_0x22e326+_0x11c61d+'Id']=_0x3728ee[_0xfd80('0x57')]['id'];return db[_0x22e326+_0xfd80('0x64')][_0xfd80('0x65')](_0x398b69);})[_0xfd80('0x8')](function(){return respondWithRpcPromise(_0xfd80('0x66'),{'channel':_0x50dd80,'interaction':_0x3728ee[_0xfd80('0x5d')],'message':_0x3728ee,'account':_0x3728ee[_0xfd80('0x57')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x8dbf22['name']+','+(_0x3728ee['Account'][_0xfd80('0x6c')]||0x12c),'interval':_0xfd80('0x6d')}]},routingClient);})[_0xfd80('0x8')](respondWithResult(_0x6f3c5b,null))[_0xfd80('0xd')](handleError(_0x6f3c5b,null));}; \ No newline at end of file +var _0x877d=['queue','From','Start','agent','moment','lodash','util','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','outbound','outboundChannels','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','MemberReport','INTERACTION','length','format','findOrCreate','interface','SIP/%s','internal','AgentCapacity','capacity','telephones','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','Account','Queue','findOne','Message','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','TransferReport','create','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found'];(function(_0x4dfb1b,_0x26850a){var _0x4dc88=function(_0x367884){while(--_0x367884){_0x4dfb1b['push'](_0x4dfb1b['shift']());}};_0x4dc88(++_0x26850a);}(_0x877d,0x1c8));var _0xd877=function(_0x3d0016,_0x4a37e0){_0x3d0016=_0x3d0016-0x0;var _0x1dcb28=_0x877d[_0x3d0016];return _0x1dcb28;};'use strict';var BPromise=require('bluebird');var moment=require(_0xd877('0x0'));var _=require(_0xd877('0x1'));var util=require(_0xd877('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xd877('0x3'))(_0xd877('0x4'));var jayson=require(_0xd877('0x5'));var amiClient=jayson[_0xd877('0x6')][_0xd877('0x7')]({'port':0x232a});var mailClient=jayson[_0xd877('0x6')][_0xd877('0x7')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x23f025,_0x53e40e,_0x1a7f06){return new BPromise(function(_0x1c9a55,_0x3e2026){var _0x1bb4f5=_0x1a7f06?_0x1a7f06:amiClient;return _0x1bb4f5[_0xd877('0x8')](_0x23f025,_0x53e40e)[_0xd877('0x9')](function(_0x548ffc){if(_0x548ffc[_0xd877('0xa')]){if(_0x548ffc[_0xd877('0xa')][_0xd877('0xb')]===0x1f4){return _0x3e2026(_0x548ffc[_0xd877('0xa')]['message']);}return _0x1c9a55(_0x548ffc[_0xd877('0xa')][_0xd877('0xc')]);}else{_0x1c9a55(_0x548ffc[_0xd877('0xd')]);}})[_0xd877('0xe')](function(_0x2d9fd9){_0x3e2026(_0x2d9fd9);});});}function respondWithResult(_0x5c8069,_0x5b63b2){_0x5b63b2=_0x5b63b2||0xc8;return function(_0x45a005){if(_0x45a005){return _0x5c8069[_0xd877('0xf')](_0x5b63b2)[_0xd877('0x10')](_0x45a005);}return _0x5c8069[_0xd877('0x11')](0x194);};}function handleError(_0x56fd4a,_0x30aa15){_0x30aa15=_0x30aa15||0x1f4;return function(_0x56703b){logger['error'](_0x56703b[_0xd877('0x12')]);if(_0x56703b[_0xd877('0x13')]){delete _0x56703b[_0xd877('0x13')];}_0x56fd4a[_0xd877('0xf')](_0x30aa15)[_0xd877('0x14')](_0x56703b);};}function findById(_0x414c68){return function(_0x24a7c6){if(!_[_0xd877('0x15')](_0x414c68)&&!_[_0xd877('0x15')](_0x24a7c6)&&!_[_0xd877('0x15')](_0x24a7c6[_0xd877('0x16')])){return _[_0xd877('0x17')](_0x24a7c6[_0xd877('0x16')],function(_0x803b18){return _0x803b18['id']==_0x414c68;});}return null;};}exports['voiceChannels']=function(_0x4e4f6a,_0x2589b7){return respondWithRpcPromise(_0xd877('0x18'),_0x4e4f6a[_0xd877('0x19')])[_0xd877('0x9')](respondWithResult(_0x2589b7,null))['catch'](handleError(_0x2589b7,null));};exports[_0xd877('0x1a')]=function(_0x52967a,_0x3bde17){return respondWithRpcPromise(_0xd877('0x1b'),_[_0xd877('0x1c')](_0x52967a[_0xd877('0x19')],_0x52967a[_0xd877('0x1d')]))['then'](respondWithResult(_0x3bde17,null))[_0xd877('0xe')](handleError(_0x3bde17,null));};exports[_0xd877('0x1e')]=function(_0x1bdf30,_0x380111){return respondWithRpcPromise(_0xd877('0x1f'),_[_0xd877('0x1c')](_0x1bdf30[_0xd877('0x19')],_0x1bdf30[_0xd877('0x1d')]))[_0xd877('0x9')](respondWithResult(_0x380111,null))[_0xd877('0xe')](handleError(_0x380111,null));};exports[_0xd877('0x20')]=function(_0xc1f1af,_0x24e114){return respondWithRpcPromise(_0xd877('0x21'),_0xc1f1af['query'])['then'](respondWithResult(_0x24e114,null))['catch'](handleError(_0x24e114,null));};exports[_0xd877('0x22')]=function(_0x16b222,_0x3a469a){return respondWithRpcPromise('VoiceQueues',_0x16b222[_0xd877('0x19')])['then'](findById(_0x16b222[_0xd877('0x1d')]['id']))[_0xd877('0x9')](respondWithResult(_0x3a469a,null))['catch'](handleError(_0x3a469a,null));};exports[_0xd877('0x23')]=function(_0xa1dbdc,_0x4975b1){return respondWithRpcPromise(_0xd877('0x24'),_['merge'](_0xa1dbdc[_0xd877('0x19')],_0xa1dbdc[_0xd877('0x1d')]))['then'](respondWithResult(_0x4975b1,null))[_0xd877('0xe')](handleError(_0x4975b1,null));};exports['voiceQueuesChannels']=function(_0x5068b2,_0x36b692){return respondWithRpcPromise('VoiceQueuesChannels',_0x5068b2[_0xd877('0x19')])[_0xd877('0x9')](respondWithResult(_0x36b692,null))[_0xd877('0xe')](handleError(_0x36b692,null));};exports[_0xd877('0x25')]=function(_0x19577a,_0x3da90e){return respondWithRpcPromise(_0xd877('0x26'),_['merge'](_0x19577a[_0xd877('0x19')],_0x19577a[_0xd877('0x1d')]))[_0xd877('0x9')](respondWithResult(_0x3da90e,null))['catch'](handleError(_0x3da90e,null));};exports[_0xd877('0x27')]=function(_0x10e7ee,_0x449940){return respondWithRpcPromise(_0xd877('0x28'),_[_0xd877('0x1c')](_0x10e7ee['query'],_0x10e7ee[_0xd877('0x1d')]))[_0xd877('0x9')](respondWithResult(_0x449940,null))[_0xd877('0xe')](handleError(_0x449940,null));};exports['voiceQueuesChannelRedirect']=function(_0x30830f,_0x3d6be1){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xd877('0x1c')](_0x30830f[_0xd877('0x19')],_0x30830f[_0xd877('0x1d')]))['then'](respondWithResult(_0x3d6be1,null))[_0xd877('0xe')](handleError(_0x3d6be1,null));};exports[_0xd877('0x29')]=function(_0x4df9b3,_0x2585f5){return respondWithRpcPromise('Outbound',_0x4df9b3[_0xd877('0x19')])[_0xd877('0x9')](respondWithResult(_0x2585f5,null))[_0xd877('0xe')](handleError(_0x2585f5,null));};exports[_0xd877('0x2a')]=function(_0x2dfbc2,_0x1b40d5){return respondWithRpcPromise('OutboundChannels',_0x2dfbc2[_0xd877('0x19')])['then'](respondWithResult(_0x1b40d5,null))[_0xd877('0xe')](handleError(_0x1b40d5,null));};exports[_0xd877('0x2b')]=function(_0x4fa664,_0x1f02db){var _0x3cc66c;return respondWithRpcPromise(_0xd877('0x2c'),_0x4fa664[_0xd877('0x19')])['then'](function(_0x161dc0){_0x3cc66c=_0x161dc0;return respondWithRpcPromise(_0xd877('0x2c'),_0x4fa664[_0xd877('0x19')],routingClient);})['then'](function(_0x18a013){return _[_0xd877('0x1c')]({},_0x18a013,_0x3cc66c);})[_0xd877('0x9')](respondWithResult(_0x1f02db,null))[_0xd877('0xe')](handleError(_0x1f02db,null));};exports[_0xd877('0x2d')]=function(_0x280bcb,_0x477ee1){if(_0x280bcb[_0xd877('0x2e')]&&_0x280bcb['body']['interaction']&&_0x280bcb[_0xd877('0x2f')]&&_0x280bcb[_0xd877('0x2f')]['name']){for(var _0x216350 in _0x280bcb[_0xd877('0x2e')][_0xd877('0x30')]){if(_0x280bcb[_0xd877('0x2e')][_0xd877('0x30')][_0xd877('0x31')](_0x216350)){db[_0xd877('0x32')]['findAll']({'where':{'channel':_0x216350,'membername':_0x280bcb['user'][_0xd877('0x13')],'type':_0xd877('0x33'),'exitAt':null,'uniqueid':_0x280bcb['body'][_0xd877('0x30')][_0x216350]&&_0x280bcb[_0xd877('0x2e')][_0xd877('0x30')][_0x216350][_0xd877('0x34')]?{'$notIn':_0x280bcb[_0xd877('0x2e')]['interaction'][_0x216350]}:{'$ne':null}}})[_0xd877('0x9')](function(_0xb7b699){var _0x570d9d=moment()[_0xd877('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x3321ca=0x0,_0x2aeb45=_0xb7b699[_0xd877('0x34')];_0x3321ca<_0x2aeb45;_0x3321ca+=0x1){_0xb7b699[_0x3321ca]['updateAttributes']({'exitAt':_0x570d9d});}});for(var _0x1980e0=0x0;_0x1980e0<_0x280bcb[_0xd877('0x2e')][_0xd877('0x30')][_0x216350][_0xd877('0x34')];_0x1980e0+=0x1){db[_0xd877('0x32')][_0xd877('0x36')]({'where':{'channel':_0x216350,'membername':_0x280bcb[_0xd877('0x2f')]['name'],'type':_0xd877('0x33'),'uniqueid':_0x280bcb['body'][_0xd877('0x30')][_0x216350][_0x1980e0],'exitAt':null},'defaults':{'channel':_0x216350,'membername':_0x280bcb['user'][_0xd877('0x13')],'interface':_[_0xd877('0x15')](_0x280bcb['user'][_0xd877('0x37')])?util[_0xd877('0x35')](_0xd877('0x38'),_0x280bcb[_0xd877('0x2f')]['name']):_0x280bcb[_0xd877('0x2f')][_0xd877('0x37')],'type':'INTERACTION','enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x280bcb['user'][_0xd877('0x39')],'uniqueid':_0x280bcb[_0xd877('0x2e')][_0xd877('0x30')][_0x216350][_0x1980e0]}});}}}}return respondWithRpcPromise(_0xd877('0x3a'),{'id':_0x280bcb[_0xd877('0x1d')]['id'],'capacity':_0x280bcb['body'][_0xd877('0x3b')]},routingClient)[_0xd877('0x9')](respondWithResult(_0x477ee1,null))[_0xd877('0xe')](handleError(_0x477ee1,null));};exports[_0xd877('0x3c')]=function(_0xbaf165,_0x4dab1b){return respondWithRpcPromise('Telephones',_0xbaf165[_0xd877('0x19')])['then'](respondWithResult(_0x4dab1b,null))[_0xd877('0xe')](handleError(_0x4dab1b,null));};exports['trunks']=function(_0x22c8e2,_0x59c92b){return respondWithRpcPromise(_0xd877('0x3d'),_0x22c8e2['query'])[_0xd877('0x9')](respondWithResult(_0x59c92b,null))[_0xd877('0xe')](handleError(_0x59c92b,null));};exports[_0xd877('0x3e')]=function(_0x394dc6,_0x322a9a){return respondWithRpcPromise(_0xd877('0x3f'),_0x394dc6['query'])[_0xd877('0x9')](respondWithResult(_0x322a9a,null))[_0xd877('0xe')](handleError(_0x322a9a,null));};exports[_0xd877('0x40')]=function(_0x1bd34a,_0x240e17){return respondWithRpcPromise(_0xd877('0x41'),_0x1bd34a[_0xd877('0x19')],routingClient)['then'](respondWithResult(_0x240e17,null))[_0xd877('0xe')](handleError(_0x240e17,null));};exports[_0xd877('0x42')]=function(_0x2b9eaa,_0x573d82){return respondWithRpcPromise('ChatQueues',_0x2b9eaa['query'],routingClient)[_0xd877('0x9')](findById(_0x2b9eaa[_0xd877('0x1d')]['id']))[_0xd877('0x9')](respondWithResult(_0x573d82,null))[_0xd877('0xe')](handleError(_0x573d82,null));};exports[_0xd877('0x43')]=function(_0x55189b,_0x54a3fb){return respondWithRpcPromise('MailQueues',_0x55189b[_0xd877('0x19')],routingClient)[_0xd877('0x9')](respondWithResult(_0x54a3fb,null))[_0xd877('0xe')](handleError(_0x54a3fb,null));};exports['showMailQueues']=function(_0x54efde,_0x51e651){return respondWithRpcPromise(_0xd877('0x44'),_0x54efde[_0xd877('0x19')],routingClient)[_0xd877('0x9')](findById(_0x54efde[_0xd877('0x1d')]['id']))[_0xd877('0x9')](respondWithResult(_0x51e651,null))[_0xd877('0xe')](handleError(_0x51e651,null));};exports[_0xd877('0x45')]=function(_0x36e6e3,_0x5b6db6){return respondWithRpcPromise(_0xd877('0x46'),_0x36e6e3['query'],mailClient)[_0xd877('0x9')](respondWithResult(_0x5b6db6,null))[_0xd877('0xe')](handleError(_0x5b6db6,null));};exports[_0xd877('0x47')]=function(_0x506275,_0x16d169){return respondWithRpcPromise(_0xd877('0x48'),_0x506275['query'],routingClient)[_0xd877('0x9')](respondWithResult(_0x16d169,null))['catch'](handleError(_0x16d169,null));};exports[_0xd877('0x49')]=function(_0x59b91c,_0x2d9c89){return respondWithRpcPromise(_0xd877('0x48'),_0x59b91c[_0xd877('0x19')],routingClient)[_0xd877('0x9')](findById(_0x59b91c[_0xd877('0x1d')]['id']))[_0xd877('0x9')](respondWithResult(_0x2d9c89,null))[_0xd877('0xe')](handleError(_0x2d9c89,null));};exports[_0xd877('0x4a')]=function(_0x2e7175,_0xa1c4aa){return respondWithRpcPromise('SmsQueues',_0x2e7175[_0xd877('0x19')],routingClient)[_0xd877('0x9')](respondWithResult(_0xa1c4aa,null))[_0xd877('0xe')](handleError(_0xa1c4aa,null));};exports[_0xd877('0x4b')]=function(_0x101eba,_0x4924cc){return respondWithRpcPromise(_0xd877('0x4c'),_0x101eba[_0xd877('0x19')],routingClient)['then'](findById(_0x101eba[_0xd877('0x1d')]['id']))['then'](respondWithResult(_0x4924cc,null))[_0xd877('0xe')](handleError(_0x4924cc,null));};exports[_0xd877('0x4d')]=function(_0x4eed2b,_0x1d53f9){return respondWithRpcPromise(_0xd877('0x4e'),_0x4eed2b[_0xd877('0x19')],routingClient)['then'](respondWithResult(_0x1d53f9,null))[_0xd877('0xe')](handleError(_0x1d53f9,null));};exports['showFaxQueues']=function(_0x53686a,_0x408893){return respondWithRpcPromise('FaxQueues',_0x53686a['query'],routingClient)[_0xd877('0x9')](findById(_0x53686a[_0xd877('0x1d')]['id']))['then'](respondWithResult(_0x408893,null))[_0xd877('0xe')](handleError(_0x408893,null));};exports[_0xd877('0x4f')]=function(_0x53cebc,_0x3392df){return respondWithRpcPromise(_0xd877('0x50'),_0x53cebc[_0xd877('0x19')])[_0xd877('0x9')](respondWithResult(_0x3392df,null))['catch'](handleError(_0x3392df,null));};exports[_0xd877('0x51')]=function(_0x5d217a,_0x3228d4){return respondWithRpcPromise(_0xd877('0x52'),_0x5d217a[_0xd877('0x19')],routingClient)['then'](respondWithResult(_0x3228d4,null))[_0xd877('0xe')](handleError(_0x3228d4,null));};exports[_0xd877('0x53')]=function(_0x57d8c8,_0x85ea77){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x57d8c8['query'],routingClient)[_0xd877('0x9')](respondWithResult(_0x85ea77,null))[_0xd877('0xe')](handleError(_0x85ea77,null));};exports[_0xd877('0x54')]=function(_0x255253,_0x47c606){return respondWithRpcPromise(_0xd877('0x55'),_0x255253[_0xd877('0x19')],routingClient)[_0xd877('0x9')](respondWithResult(_0x47c606,null))[_0xd877('0xe')](handleError(_0x47c606,null));};exports[_0xd877('0x56')]=function(_0x1b8050,_0x412cb9){return respondWithRpcPromise(_0xd877('0x57'),_0x1b8050[_0xd877('0x19')],routingClient)[_0xd877('0x9')](respondWithResult(_0x412cb9,null))[_0xd877('0xe')](handleError(_0x412cb9,null));};exports[_0xd877('0x58')]=function(_0x7a2a10,_0xec6761){return respondWithRpcPromise(_0xd877('0x59'),_0x7a2a10['query'],routingClient)[_0xd877('0x9')](respondWithResult(_0xec6761,null))[_0xd877('0xe')](handleError(_0xec6761,null));};exports[_0xd877('0x5a')]=function(_0x297435){return function(_0x4164ac,_0x522984){var _0x39b501,_0x303e0a;var _0x57c869=_['capitalize'](_0x297435);var _0x167976=_0x297435===_0xd877('0x5b')?_0xd877('0x5c'):_0xd877('0x5d');return db[_0x57c869+_0xd877('0x5e')][_0xd877('0x5f')]({'raw':!![],'where':{'id':_0x4164ac[_0xd877('0x1d')]['id']}})[_0xd877('0x9')](function(_0x3a1a31){if(_[_0xd877('0x15')](_0x3a1a31)){throw new Error(_0x57c869+'\x20Queue\x20not\x20found');}_0x39b501=_0x3a1a31;return db[_0x57c869+_0xd877('0x60')][_0xd877('0x5f')]({'where':{'id':_0x4164ac[_0xd877('0x2e')]['messageId']},'include':[{'model':db[_0x57c869+_0xd877('0x61')],'as':_0xd877('0x61')},{'model':db[_0x57c869+_0x167976],'as':_0xd877('0x5d')}]});})['then'](function(_0x4715be){if(_['isNil'](_0x4715be)){throw new Error(_0x57c869+_0xd877('0x62'));}_0x303e0a=_0x4715be;return _0x4715be[_0xd877('0x63')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd877('0x9')](function(){var _0xcb26ac={'uniqueid':_0x297435+'.'+_0x303e0a['id']+'.'+_0x303e0a[_0xd877('0x61')]['id'],'FromUserId':_0x4164ac[_0xd877('0x2f')]['id'],'type':'queue'};_0xcb26ac[_0x57c869+_0xd877('0x64')]=_0x303e0a['id'];_0xcb26ac[_0x57c869+_0xd877('0x65')]=_0x303e0a[_0xd877('0x61')]['id'];_0xcb26ac['From'+_0x57c869+_0x167976+'Id']=_0x303e0a[_0xd877('0x5d')]['id'];_0xcb26ac['To'+_0x57c869+'QueueId']=_0x39b501['id'];return db[_0x57c869+_0xd877('0x66')][_0xd877('0x67')](_0xcb26ac);})[_0xd877('0x9')](function(){return respondWithRpcPromise('Start',{'channel':_0x297435,'interaction':_0x303e0a['Interaction'],'message':_0x303e0a,'account':_0x303e0a[_0xd877('0x5d')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x39b501[_0xd877('0x13')]+','+(_0x303e0a['Account']['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xd877('0x9')](respondWithResult(_0x522984,null))[_0xd877('0xe')](handleError(_0x522984,null));};};exports[_0xd877('0x68')]=function(_0x3f3cc0,_0x3fae5c){var _0x4c82a5,_0x4e9fe5;if(_[_0xd877('0x15')](_0x3f3cc0['body']['channel'])){throw new Error(_0xd877('0x69'));}var _0x5deb91=_0x3f3cc0[_0xd877('0x2e')][_0xd877('0x6a')];var _0x234809=_['capitalize'](_0x5deb91);var _0x2ff983=_0x5deb91===_0xd877('0x5b')?_0xd877('0x5c'):_0xd877('0x5d');return db[_0xd877('0x6b')][_0xd877('0x5f')]({'raw':!![],'where':{'id':_0x3f3cc0[_0xd877('0x1d')]['id'],'role':'agent'}})[_0xd877('0x9')](function(_0x47dfda){if(_['isNil'](_0x47dfda)){throw new Error(_0xd877('0x6c'));}_0x4c82a5=_0x47dfda;return db[_0x234809+_0xd877('0x60')]['findOne']({'where':{'id':_0x3f3cc0['body']['messageId']},'include':[{'model':db[_0x234809+_0xd877('0x61')],'as':_0xd877('0x61')},{'model':db[_0x234809+_0x2ff983],'as':_0xd877('0x5d')}]});})[_0xd877('0x9')](function(_0x335cbc){if(_[_0xd877('0x15')](_0x335cbc)){throw new Error(_0x234809+'\x20Message\x20not\x20found');}_0x4e9fe5=_0x335cbc;return _0x335cbc[_0xd877('0x63')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd877('0x9')](function(){var _0x20a66a={'uniqueid':_0x5deb91+'.'+_0x4e9fe5['id']+'.'+_0x4e9fe5['Interaction']['id'],'FromUserId':_0x3f3cc0[_0xd877('0x2f')]['id'],'type':_0xd877('0x6d'),'ToUserId':_0x4c82a5['id']};_0x20a66a[_0x234809+_0xd877('0x64')]=_0x4e9fe5['id'];_0x20a66a[_0x234809+'InteractionId']=_0x4e9fe5[_0xd877('0x61')]['id'];_0x20a66a[_0xd877('0x6e')+_0x234809+_0x2ff983+'Id']=_0x4e9fe5[_0xd877('0x5d')]['id'];return db[_0x234809+'TransferReport']['create'](_0x20a66a);})[_0xd877('0x9')](function(){return respondWithRpcPromise(_0xd877('0x6f'),{'channel':_0x5deb91,'interaction':_0x4e9fe5[_0xd877('0x61')],'message':_0x4e9fe5,'account':_0x4e9fe5[_0xd877('0x5d')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd877('0x70'),'appdata':_0x4c82a5[_0xd877('0x13')]+','+(_0x4e9fe5[_0xd877('0x5d')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xd877('0x9')](respondWithResult(_0x3fae5c,null))[_0xd877('0xe')](handleError(_0x3fae5c,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 5b080b2..c2b482f 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 _0x4ea6=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/run','run','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1d2c83,_0x56192b){var _0x2db161=function(_0x831219){while(--_0x831219){_0x1d2c83['push'](_0x1d2c83['shift']());}};_0x2db161(++_0x56192b);}(_0x4ea6,0x1dd));var _0x64ea=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0x4ea6[_0x37ffea];return _0x2e2615;};'use strict';var multer=require(_0x64ea('0x0'));var util=require(_0x64ea('0x1'));var path=require(_0x64ea('0x2'));var timeout=require(_0x64ea('0x3'));var express=require(_0x64ea('0x4'));var router=express[_0x64ea('0x5')]();var auth=require(_0x64ea('0x6'));var interaction=require(_0x64ea('0x7'));var config=require(_0x64ea('0x8'));var controller=require('./schedule.controller');router[_0x64ea('0x9')]('/',auth[_0x64ea('0xa')](),controller[_0x64ea('0xb')]);router[_0x64ea('0x9')](_0x64ea('0xc'),auth[_0x64ea('0xa')](),controller[_0x64ea('0xd')]);router[_0x64ea('0x9')](_0x64ea('0xe'),auth[_0x64ea('0xa')](),controller[_0x64ea('0xf')]);router[_0x64ea('0x10')]('/',auth[_0x64ea('0xa')](),controller[_0x64ea('0x11')]);router[_0x64ea('0x12')](_0x64ea('0xc'),auth[_0x64ea('0xa')](),controller[_0x64ea('0x13')]);router[_0x64ea('0x14')](_0x64ea('0xc'),auth[_0x64ea('0xa')](),controller[_0x64ea('0x15')]);module[_0x64ea('0x16')]=router; \ No newline at end of file +var _0x0572=['/:id','show','/:id/run','run','post','create','put','update','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index'];(function(_0x4f259b,_0x14a5f0){var _0x587983=function(_0x32e288){while(--_0x32e288){_0x4f259b['push'](_0x4f259b['shift']());}};_0x587983(++_0x14a5f0);}(_0x0572,0xb2));var _0x2057=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x0572[_0x2c7618];return _0x5ce3f0;};'use strict';var multer=require(_0x2057('0x0'));var util=require(_0x2057('0x1'));var path=require('path');var timeout=require(_0x2057('0x2'));var express=require('express');var router=express[_0x2057('0x3')]();var auth=require(_0x2057('0x4'));var interaction=require(_0x2057('0x5'));var config=require(_0x2057('0x6'));var controller=require(_0x2057('0x7'));router[_0x2057('0x8')]('/',auth[_0x2057('0x9')](),controller[_0x2057('0xa')]);router[_0x2057('0x8')](_0x2057('0xb'),auth[_0x2057('0x9')](),controller[_0x2057('0xc')]);router['get'](_0x2057('0xd'),auth['isAuthenticated'](),controller[_0x2057('0xe')]);router[_0x2057('0xf')]('/',auth['isAuthenticated'](),controller[_0x2057('0x10')]);router[_0x2057('0x11')](_0x2057('0xb'),auth['isAuthenticated'](),controller[_0x2057('0x12')]);router['delete'](_0x2057('0xb'),auth['isAuthenticated'](),controller[_0x2057('0x13')]);module[_0x2057('0x14')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index f6ece92..3199215 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 _0x807d=['STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','years','months','weeks','days','minutes','ENUM','csv','xlsx','custom','default','TEXT','sequelize','exports'];(function(_0x3ab353,_0x5d5283){var _0x1e2285=function(_0x55804f){while(--_0x55804f){_0x3ab353['push'](_0x3ab353['shift']());}};_0x1e2285(++_0x5d5283);}(_0x807d,0xa8));var _0xd807=function(_0x2e8205,_0x1b8494){_0x2e8205=_0x2e8205-0x0;var _0xf8e24f=_0x807d[_0x2e8205];return _0xf8e24f;};'use strict';var Sequelize=require(_0xd807('0x0'));module[_0xd807('0x1')]={'name':{'type':Sequelize[_0xd807('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd807('0x2')]},'active':{'type':Sequelize[_0xd807('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xd807('0x2')],'allowNull':![],'defaultValue':_0xd807('0x4')},'startAt':{'type':Sequelize[_0xd807('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xd807('0x6'),'quarters',_0xd807('0x7'),_0xd807('0x8'),_0xd807('0x9'),'hours',_0xd807('0xa')),'allowNull':![],'defaultValue':_0xd807('0x9')},'output':{'type':Sequelize[_0xd807('0xb')](_0xd807('0xc'),'pdf',_0xd807('0xd')),'allowNull':![],'defaultValue':_0xd807('0xc')},'type':{'type':Sequelize[_0xd807('0xb')](_0xd807('0xe'),_0xd807('0xf')),'allowNull':![],'defaultValue':_0xd807('0xe')},'sendMail':{'type':Sequelize[_0xd807('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xd807('0x10')]},'bcc':{'type':Sequelize[_0xd807('0x10')]},'sendIfEmpty':{'type':Sequelize[_0xd807('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa5dd=['exports','STRING','0\x200\x20*\x20*\x20*','INTEGER','ENUM','years','months','weeks','days','minutes','pdf','csv','custom','default','TEXT','sequelize'];(function(_0x448e29,_0x17f97e){var _0x31eff4=function(_0x58399b){while(--_0x58399b){_0x448e29['push'](_0x448e29['shift']());}};_0x31eff4(++_0x17f97e);}(_0xa5dd,0x10f));var _0xda5d=function(_0x8d489e,_0x5b9406){_0x8d489e=_0x8d489e-0x0;var _0x57a5a4=_0xa5dd[_0x8d489e];return _0x57a5a4;};'use strict';var Sequelize=require(_0xda5d('0x0'));module[_0xda5d('0x1')]={'name':{'type':Sequelize[_0xda5d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xda5d('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xda5d('0x2')],'allowNull':![],'defaultValue':_0xda5d('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xda5d('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xda5d('0x5')](_0xda5d('0x6'),'quarters',_0xda5d('0x7'),_0xda5d('0x8'),_0xda5d('0x9'),'hours',_0xda5d('0xa')),'allowNull':![],'defaultValue':_0xda5d('0x9')},'output':{'type':Sequelize[_0xda5d('0x5')]('csv',_0xda5d('0xb'),'xlsx'),'allowNull':![],'defaultValue':_0xda5d('0xc')},'type':{'type':Sequelize[_0xda5d('0x5')](_0xda5d('0xd'),_0xda5d('0xe')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xda5d('0xf')]},'bcc':{'type':Sequelize[_0xda5d('0xf')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 28d83e3..cb0f13b 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 _0x1710=['rawAttributes','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filters','filter','merge','map','type','key','VIRTUAL','field','options','count','includeAll','findAll','rows','show','params','length','include','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','error','stack','name','index','Schedule'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x1710,0x80));var _0x0171=function(_0x1cdc7d,_0x91195e){_0x1cdc7d=_0x1cdc7d-0x0;var _0x558817=_0x1710[_0x1cdc7d];return _0x558817;};'use strict';var pdf=require(_0x0171('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0171('0x1'));var zipdir=require(_0x0171('0x2'));var jsonpatch=require(_0x0171('0x3'));var rp=require('request-promise');var moment=require(_0x0171('0x4'));var BPromise=require(_0x0171('0x5'));var Mustache=require('mustache');var util=require(_0x0171('0x6'));var path=require(_0x0171('0x7'));var sox=require(_0x0171('0x8'));var csv=require('to-csv');var ejs=require(_0x0171('0x9'));var fs=require('fs');var _=require(_0x0171('0xa'));var squel=require(_0x0171('0xb'));var crypto=require(_0x0171('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0171('0xd'));var toCsv=require(_0x0171('0xe'));var querystring=require(_0x0171('0xf'));var Papa=require(_0x0171('0x10'));var authService=require(_0x0171('0x11'));var hardwareService=require(_0x0171('0x12'));var Redis=require(_0x0171('0x13'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x0171('0x14'));var utils=require(_0x0171('0x15'));var config=require(_0x0171('0x16'));var db=require(_0x0171('0x17'))['db'];function respondWithStatusCode(_0x24ec05,_0xb67140){_0xb67140=_0xb67140||0xcc;return function(_0x4f103f){if(_0x4f103f){return _0x24ec05[_0x0171('0x18')](_0xb67140);}return _0x24ec05[_0x0171('0x19')](_0xb67140)[_0x0171('0x1a')]();};}function respondWithResult(_0x5358e6,_0x2b1e20){_0x2b1e20=_0x2b1e20||0xc8;return function(_0x416f53){if(_0x416f53){return _0x5358e6['status'](_0x2b1e20)['json'](_0x416f53);}};}function respondWithFilteredResult(_0x4bff4b,_0x188d06){return function(_0x1e13cc){if(_0x1e13cc){var _0x3e8c69=_0x1e13cc['count'],_0xc15993=_0x188d06[_0x0171('0x1b')],_0x38e00f=_0x188d06[_0x0171('0x1b')]+_0x188d06[_0x0171('0x1c')],_0x1dc273;if(_0x38e00f>=_0x3e8c69){_0x38e00f=_0x3e8c69;_0x1dc273=0xc8;}else{_0x1dc273=0xce;}_0x4bff4b[_0x0171('0x19')](_0x1dc273);return _0x4bff4b[_0x0171('0x1d')](_0x0171('0x1e'),_0xc15993+'-'+_0x38e00f+'/'+_0x3e8c69)['json'](_0x1e13cc);}return null;};}function patchUpdates(_0x2a9dd4){return function(_0x512c1c){try{jsonpatch[_0x0171('0x1f')](_0x512c1c,_0x2a9dd4,!![]);}catch(_0x4a44f3){return BPromise[_0x0171('0x20')](_0x4a44f3);}return _0x512c1c[_0x0171('0x21')]();};}function saveUpdates(_0x1f15ae,_0x4a1c5a){return function(_0x518d81){if(_0x518d81){return _0x518d81[_0x0171('0x22')](_0x1f15ae)[_0x0171('0x23')](function(_0x238c22){return _0x238c22;});}return null;};}function removeEntity(_0x2e5205,_0x35bb66){return function(_0x47163d){if(_0x47163d){return _0x47163d[_0x0171('0x24')]()[_0x0171('0x23')](function(){var _0x6cd8cc=_0x47163d[_0x0171('0x25')]({'plain':!![]});var _0x41f5f7=_0x0171('0x26');return db['UserProfileResource'][_0x0171('0x24')]({'where':{'type':_0x41f5f7,'resourceId':_0x6cd8cc['id']}})[_0x0171('0x23')](function(){return _0x47163d;});})[_0x0171('0x23')](function(){_0x2e5205[_0x0171('0x19')](0xcc)[_0x0171('0x1a')]();});}};}function handleEntityNotFound(_0x205462,_0x18767d){return function(_0x4d3d33){if(!_0x4d3d33){_0x205462['sendStatus'](0x194);}return _0x4d3d33;};}function handleError(_0x455d16,_0x2f5c95){_0x2f5c95=_0x2f5c95||0x1f4;return function(_0x21ceff){logger[_0x0171('0x27')](_0x21ceff[_0x0171('0x28')]);if(_0x21ceff[_0x0171('0x29')]){delete _0x21ceff[_0x0171('0x29')];}_0x455d16['status'](_0x2f5c95)['send'](_0x21ceff);};}exports[_0x0171('0x2a')]=function(_0x5de5d0,_0x45c127){var _0x188bef={},_0x123f60={},_0x223122={'count':0x0,'rows':[]};var _0xb922db=db[_0x0171('0x2b')][_0x0171('0x2c')];_0x123f60[_0x0171('0x2d')]=_['keys'](_0xb922db);_0x123f60[_0x0171('0x2e')]=_[_0x0171('0x2f')](_0x5de5d0[_0x0171('0x2e')]);_0x123f60['filters']=_[_0x0171('0x30')](_0x123f60['model'],_0x123f60[_0x0171('0x2e')]);_0x188bef[_0x0171('0x31')]=_['intersection'](_0x123f60['model'],qs[_0x0171('0x32')](_0x5de5d0[_0x0171('0x2e')][_0x0171('0x32')]));_0x188bef['attributes']=_0x188bef[_0x0171('0x31')]['length']?_0x188bef[_0x0171('0x31')]:_0x123f60[_0x0171('0x2d')];if(!_0x5de5d0[_0x0171('0x2e')][_0x0171('0x33')]('nolimit')){_0x188bef[_0x0171('0x1c')]=qs[_0x0171('0x1c')](_0x5de5d0['query']['limit']);_0x188bef[_0x0171('0x1b')]=qs['offset'](_0x5de5d0[_0x0171('0x2e')]['offset']);}_0x188bef[_0x0171('0x34')]=qs[_0x0171('0x35')](_0x5de5d0['query'][_0x0171('0x35')]);_0x188bef[_0x0171('0x36')]=qs['filters'](_[_0x0171('0x37')](_0x5de5d0[_0x0171('0x2e')],_0x123f60[_0x0171('0x38')]));if(_0x5de5d0[_0x0171('0x2e')][_0x0171('0x39')]){_0x188bef[_0x0171('0x36')]=_[_0x0171('0x3a')](_0x188bef[_0x0171('0x36')],{'$or':_[_0x0171('0x3b')](_0xb922db,function(_0x1c2f7f){if(_0x1c2f7f[_0x0171('0x3c')][_0x0171('0x3d')]!==_0x0171('0x3e')){var _0x3c88bd={};_0x3c88bd[_0x1c2f7f[_0x0171('0x3f')]]={'$like':'%'+_0x5de5d0[_0x0171('0x2e')]['filter']+'%'};return _0x3c88bd;}})});}_0x188bef=_[_0x0171('0x3a')]({},_0x188bef,_0x5de5d0[_0x0171('0x40')]);var _0x30374a={'where':_0x188bef['where']};return db[_0x0171('0x2b')]['count'](_0x30374a)[_0x0171('0x23')](function(_0x3f138e){_0x223122[_0x0171('0x41')]=_0x3f138e;if(_0x5de5d0[_0x0171('0x2e')][_0x0171('0x42')]){_0x188bef['include']=[{'all':!![]}];}return db['Schedule'][_0x0171('0x43')](_0x188bef);})[_0x0171('0x23')](function(_0x681de6){_0x223122[_0x0171('0x44')]=_0x681de6;return _0x223122;})[_0x0171('0x23')](respondWithFilteredResult(_0x45c127,_0x188bef))['catch'](handleError(_0x45c127,null));};exports[_0x0171('0x45')]=function(_0x2cddef,_0x396312){var _0x4e60aa={'raw':![],'where':{'id':_0x2cddef[_0x0171('0x46')]['id']}},_0x14e2fd={};_0x14e2fd[_0x0171('0x2d')]=_['keys'](db[_0x0171('0x2b')][_0x0171('0x2c')]);_0x14e2fd['query']=_[_0x0171('0x2f')](_0x2cddef['query']);_0x14e2fd[_0x0171('0x38')]=_[_0x0171('0x30')](_0x14e2fd[_0x0171('0x2d')],_0x14e2fd[_0x0171('0x2e')]);_0x4e60aa[_0x0171('0x31')]=_[_0x0171('0x30')](_0x14e2fd[_0x0171('0x2d')],qs[_0x0171('0x32')](_0x2cddef[_0x0171('0x2e')][_0x0171('0x32')]));_0x4e60aa[_0x0171('0x31')]=_0x4e60aa['attributes'][_0x0171('0x47')]?_0x4e60aa[_0x0171('0x31')]:_0x14e2fd[_0x0171('0x2d')];if(_0x2cddef[_0x0171('0x2e')][_0x0171('0x42')]){_0x4e60aa[_0x0171('0x48')]=[{'all':!![]}];}_0x4e60aa=_[_0x0171('0x3a')]({},_0x4e60aa,_0x2cddef[_0x0171('0x40')]);return db[_0x0171('0x2b')][_0x0171('0x49')](_0x4e60aa)[_0x0171('0x23')](handleEntityNotFound(_0x396312,null))['then'](respondWithResult(_0x396312,null))[_0x0171('0x4a')](handleError(_0x396312,null));};exports[_0x0171('0x4b')]=function(_0x25cce8,_0x43dcf3){return db[_0x0171('0x2b')]['create'](_0x25cce8['body'],{})[_0x0171('0x23')](function(_0x2d8275){var _0x84262d=_0x25cce8[_0x0171('0x4c')]['get']({'plain':!![]});if(!_0x84262d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x84262d[_0x0171('0x4d')]===_0x0171('0x4c')){var _0x11a384=_0x2d8275[_0x0171('0x25')]({'plain':!![]});var _0x18b466=_0x0171('0x26');return db[_0x0171('0x4e')][_0x0171('0x49')]({'where':{'name':_0x18b466,'userProfileId':_0x84262d[_0x0171('0x4f')]},'raw':!![]})['then'](function(_0x342099){if(_0x342099&&_0x342099[_0x0171('0x50')]===0x0){return db[_0x0171('0x51')][_0x0171('0x4b')]({'name':_0x11a384[_0x0171('0x29')],'resourceId':_0x11a384['id'],'type':_0x342099['name'],'sectionId':_0x342099['id']},{})[_0x0171('0x23')](function(){return _0x2d8275;});}else{return _0x2d8275;}})[_0x0171('0x4a')](function(_0x539b40){logger[_0x0171('0x27')](_0x0171('0x52'),_0x539b40);throw _0x539b40;});}return _0x2d8275;})['then'](respondWithResult(_0x43dcf3,0xc9))[_0x0171('0x4a')](handleError(_0x43dcf3,null));};exports['update']=function(_0x34be09,_0x3815f2){if(_0x34be09['body']['id']){delete _0x34be09[_0x0171('0x53')]['id'];}return db[_0x0171('0x2b')][_0x0171('0x49')]({'where':{'id':_0x34be09[_0x0171('0x46')]['id']}})['then'](handleEntityNotFound(_0x3815f2,null))[_0x0171('0x23')](saveUpdates(_0x34be09[_0x0171('0x53')],null))[_0x0171('0x23')](respondWithResult(_0x3815f2,null))[_0x0171('0x4a')](handleError(_0x3815f2,null));};exports['destroy']=function(_0x4a2451,_0x5530df){return db[_0x0171('0x2b')]['find']({'where':{'id':_0x4a2451[_0x0171('0x46')]['id']}})[_0x0171('0x23')](handleEntityNotFound(_0x5530df,null))[_0x0171('0x23')](removeEntity(_0x5530df,null))[_0x0171('0x4a')](handleError(_0x5530df,null));};exports[_0x0171('0x54')]=function(_0x148fdc,_0x43b424,_0x3734d7){var _0x1142f3=require(_0x0171('0x55'));return db['Schedule'][_0x0171('0x49')]({'where':{'id':_0x148fdc['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x43b424,null))[_0x0171('0x23')](function(){_0x1142f3['run'](_0x148fdc[_0x0171('0x46')]['id']);})[_0x0171('0x23')](respondWithStatusCode(_0x43b424,null))[_0x0171('0x4a')](handleError(_0x43b424,null));}; \ No newline at end of file +var _0x46e2=['../../mysqldb','sendStatus','end','status','json','offset','set','apply','reject','save','update','Scheduler','UserProfileResource','destroy','then','name','send','Schedule','rawAttributes','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','map','key','VIRTUAL','options','count','include','findAll','rows','catch','show','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','error','body','run','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','lodash','crypto','desk.js','ioredis','api'];(function(_0x4b2979,_0x24c63b){var _0x8a6c68=function(_0x3a566b){while(--_0x3a566b){_0x4b2979['push'](_0x4b2979['shift']());}};_0x8a6c68(++_0x24c63b);}(_0x46e2,0x196));var _0x246e=function(_0x2191fd,_0x6f81aa){_0x2191fd=_0x2191fd-0x0;var _0x58596b=_0x46e2[_0x2191fd];return _0x58596b;};'use strict';var pdf=require(_0x246e('0x0'));var emlformat=require(_0x246e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x246e('0x2'));var jsonpatch=require(_0x246e('0x3'));var rp=require(_0x246e('0x4'));var moment=require(_0x246e('0x5'));var BPromise=require(_0x246e('0x6'));var Mustache=require(_0x246e('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x246e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x246e('0x9'));var squel=require('squel');var crypto=require(_0x246e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x246e('0xb'));var toCsv=require(_0x246e('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x246e('0xc'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x246e('0xd'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x246e('0xe'))['db'];function respondWithStatusCode(_0x23f7ab,_0x35c971){_0x35c971=_0x35c971||0xcc;return function(_0x5be747){if(_0x5be747){return _0x23f7ab[_0x246e('0xf')](_0x35c971);}return _0x23f7ab['status'](_0x35c971)[_0x246e('0x10')]();};}function respondWithResult(_0x3ab0ed,_0x1ac43e){_0x1ac43e=_0x1ac43e||0xc8;return function(_0x4dbb8e){if(_0x4dbb8e){return _0x3ab0ed[_0x246e('0x11')](_0x1ac43e)[_0x246e('0x12')](_0x4dbb8e);}};}function respondWithFilteredResult(_0x62f4b0,_0x17b4e1){return function(_0x10d1b7){if(_0x10d1b7){var _0x3a7b07=_0x10d1b7['count'],_0x4d2616=_0x17b4e1[_0x246e('0x13')],_0x299c51=_0x17b4e1[_0x246e('0x13')]+_0x17b4e1['limit'],_0x26db1b;if(_0x299c51>=_0x3a7b07){_0x299c51=_0x3a7b07;_0x26db1b=0xc8;}else{_0x26db1b=0xce;}_0x62f4b0['status'](_0x26db1b);return _0x62f4b0[_0x246e('0x14')]('Content-Range',_0x4d2616+'-'+_0x299c51+'/'+_0x3a7b07)[_0x246e('0x12')](_0x10d1b7);}return null;};}function patchUpdates(_0x24c28e){return function(_0x4c9873){try{jsonpatch[_0x246e('0x15')](_0x4c9873,_0x24c28e,!![]);}catch(_0x3ab844){return BPromise[_0x246e('0x16')](_0x3ab844);}return _0x4c9873[_0x246e('0x17')]();};}function saveUpdates(_0x447b85,_0x5bd219){return function(_0x112e69){if(_0x112e69){return _0x112e69[_0x246e('0x18')](_0x447b85)['then'](function(_0x4c10ec){return _0x4c10ec;});}return null;};}function removeEntity(_0x228e43,_0x20c243){return function(_0x611d1c){if(_0x611d1c){return _0x611d1c['destroy']()['then'](function(){var _0x32f0a2=_0x611d1c['get']({'plain':!![]});var _0x1e2d53=_0x246e('0x19');return db[_0x246e('0x1a')][_0x246e('0x1b')]({'where':{'type':_0x1e2d53,'resourceId':_0x32f0a2['id']}})['then'](function(){return _0x611d1c;});})[_0x246e('0x1c')](function(){_0x228e43[_0x246e('0x11')](0xcc)[_0x246e('0x10')]();});}};}function handleEntityNotFound(_0x4a23aa,_0x55a2a6){return function(_0x3eafa2){if(!_0x3eafa2){_0x4a23aa[_0x246e('0xf')](0x194);}return _0x3eafa2;};}function handleError(_0x3c9247,_0x8aecb3){_0x8aecb3=_0x8aecb3||0x1f4;return function(_0x50d8d8){logger['error'](_0x50d8d8['stack']);if(_0x50d8d8[_0x246e('0x1d')]){delete _0x50d8d8['name'];}_0x3c9247[_0x246e('0x11')](_0x8aecb3)[_0x246e('0x1e')](_0x50d8d8);};}exports['index']=function(_0x55a922,_0x18f349){var _0x28916b={},_0x4a34ba={},_0x3cbba8={'count':0x0,'rows':[]};var _0x1d49ea=db[_0x246e('0x1f')][_0x246e('0x20')];_0x4a34ba[_0x246e('0x21')]=_[_0x246e('0x22')](_0x1d49ea);_0x4a34ba['query']=_[_0x246e('0x22')](_0x55a922['query']);_0x4a34ba[_0x246e('0x23')]=_[_0x246e('0x24')](_0x4a34ba['model'],_0x4a34ba[_0x246e('0x25')]);_0x28916b[_0x246e('0x26')]=_[_0x246e('0x24')](_0x4a34ba['model'],qs[_0x246e('0x27')](_0x55a922[_0x246e('0x25')][_0x246e('0x27')]));_0x28916b[_0x246e('0x26')]=_0x28916b[_0x246e('0x26')][_0x246e('0x28')]?_0x28916b['attributes']:_0x4a34ba[_0x246e('0x21')];if(!_0x55a922[_0x246e('0x25')][_0x246e('0x29')]('nolimit')){_0x28916b[_0x246e('0x2a')]=qs['limit'](_0x55a922['query']['limit']);_0x28916b[_0x246e('0x13')]=qs['offset'](_0x55a922[_0x246e('0x25')]['offset']);}_0x28916b[_0x246e('0x2b')]=qs[_0x246e('0x2c')](_0x55a922['query']['sort']);_0x28916b[_0x246e('0x2d')]=qs[_0x246e('0x23')](_[_0x246e('0x2e')](_0x55a922['query'],_0x4a34ba[_0x246e('0x23')]));if(_0x55a922[_0x246e('0x25')][_0x246e('0x2f')]){_0x28916b[_0x246e('0x2d')]=_[_0x246e('0x30')](_0x28916b['where'],{'$or':_[_0x246e('0x31')](_0x1d49ea,function(_0x34b091){if(_0x34b091['type'][_0x246e('0x32')]!==_0x246e('0x33')){var _0x523384={};_0x523384[_0x34b091['field']]={'$like':'%'+_0x55a922[_0x246e('0x25')][_0x246e('0x2f')]+'%'};return _0x523384;}})});}_0x28916b=_[_0x246e('0x30')]({},_0x28916b,_0x55a922[_0x246e('0x34')]);var _0x119b22={'where':_0x28916b[_0x246e('0x2d')]};return db['Schedule']['count'](_0x119b22)[_0x246e('0x1c')](function(_0x17b137){_0x3cbba8[_0x246e('0x35')]=_0x17b137;if(_0x55a922[_0x246e('0x25')]['includeAll']){_0x28916b[_0x246e('0x36')]=[{'all':!![]}];}return db['Schedule'][_0x246e('0x37')](_0x28916b);})['then'](function(_0x29c46b){_0x3cbba8[_0x246e('0x38')]=_0x29c46b;return _0x3cbba8;})[_0x246e('0x1c')](respondWithFilteredResult(_0x18f349,_0x28916b))[_0x246e('0x39')](handleError(_0x18f349,null));};exports[_0x246e('0x3a')]=function(_0x4b6b58,_0x35a580){var _0x1677d4={'raw':![],'where':{'id':_0x4b6b58[_0x246e('0x3b')]['id']}},_0x40c33b={};_0x40c33b[_0x246e('0x21')]=_['keys'](db['Schedule'][_0x246e('0x20')]);_0x40c33b[_0x246e('0x25')]=_[_0x246e('0x22')](_0x4b6b58[_0x246e('0x25')]);_0x40c33b[_0x246e('0x23')]=_[_0x246e('0x24')](_0x40c33b[_0x246e('0x21')],_0x40c33b[_0x246e('0x25')]);_0x1677d4[_0x246e('0x26')]=_[_0x246e('0x24')](_0x40c33b['model'],qs[_0x246e('0x27')](_0x4b6b58[_0x246e('0x25')][_0x246e('0x27')]));_0x1677d4[_0x246e('0x26')]=_0x1677d4[_0x246e('0x26')][_0x246e('0x28')]?_0x1677d4[_0x246e('0x26')]:_0x40c33b[_0x246e('0x21')];if(_0x4b6b58['query']['includeAll']){_0x1677d4[_0x246e('0x36')]=[{'all':!![]}];}_0x1677d4=_[_0x246e('0x30')]({},_0x1677d4,_0x4b6b58[_0x246e('0x34')]);return db['Schedule'][_0x246e('0x3c')](_0x1677d4)[_0x246e('0x1c')](handleEntityNotFound(_0x35a580,null))[_0x246e('0x1c')](respondWithResult(_0x35a580,null))[_0x246e('0x39')](handleError(_0x35a580,null));};exports[_0x246e('0x3d')]=function(_0x5e544a,_0x53db89){return db[_0x246e('0x1f')][_0x246e('0x3d')](_0x5e544a['body'],{})[_0x246e('0x1c')](function(_0x2045de){var _0x5d2c7e=_0x5e544a[_0x246e('0x3e')][_0x246e('0x3f')]({'plain':!![]});if(!_0x5d2c7e)throw new Error(_0x246e('0x40'));if(_0x5d2c7e[_0x246e('0x41')]==='user'){var _0x2211f5=_0x2045de[_0x246e('0x3f')]({'plain':!![]});var _0x123809=_0x246e('0x19');return db[_0x246e('0x42')]['find']({'where':{'name':_0x123809,'userProfileId':_0x5d2c7e['userProfileId']},'raw':!![]})['then'](function(_0x154d56){if(_0x154d56&&_0x154d56['autoAssociation']===0x0){return db[_0x246e('0x1a')]['create']({'name':_0x2211f5[_0x246e('0x1d')],'resourceId':_0x2211f5['id'],'type':_0x154d56[_0x246e('0x1d')],'sectionId':_0x154d56['id']},{})[_0x246e('0x1c')](function(){return _0x2045de;});}else{return _0x2045de;}})[_0x246e('0x39')](function(_0x142bc7){logger[_0x246e('0x43')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x142bc7);throw _0x142bc7;});}return _0x2045de;})['then'](respondWithResult(_0x53db89,0xc9))[_0x246e('0x39')](handleError(_0x53db89,null));};exports['update']=function(_0x47b5c3,_0x565d64){if(_0x47b5c3[_0x246e('0x44')]['id']){delete _0x47b5c3[_0x246e('0x44')]['id'];}return db[_0x246e('0x1f')][_0x246e('0x3c')]({'where':{'id':_0x47b5c3[_0x246e('0x3b')]['id']}})['then'](handleEntityNotFound(_0x565d64,null))[_0x246e('0x1c')](saveUpdates(_0x47b5c3[_0x246e('0x44')],null))['then'](respondWithResult(_0x565d64,null))[_0x246e('0x39')](handleError(_0x565d64,null));};exports[_0x246e('0x1b')]=function(_0x50ea03,_0x266da0){return db['Schedule'][_0x246e('0x3c')]({'where':{'id':_0x50ea03[_0x246e('0x3b')]['id']}})[_0x246e('0x1c')](handleEntityNotFound(_0x266da0,null))[_0x246e('0x1c')](removeEntity(_0x266da0,null))[_0x246e('0x39')](handleError(_0x266da0,null));};exports[_0x246e('0x45')]=function(_0x6e47be,_0x2dce1c,_0x22212d){var _0x25227c=require('../../config/schedule');return db['Schedule']['find']({'where':{'id':_0x6e47be['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2dce1c,null))[_0x246e('0x1c')](function(){_0x25227c[_0x246e('0x45')](_0x6e47be['params']['id']);})['then'](respondWithStatusCode(_0x2dce1c,null))['catch'](handleError(_0x2dce1c,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 8d3631b..de63818 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 _0x0878=['Schedule','tools_schedules','util','../../config/logger','moment','bluebird','request-promise','exports','define'];(function(_0x3e8478,_0x52e78d){var _0x5e4feb=function(_0x208b75){while(--_0x208b75){_0x3e8478['push'](_0x3e8478['shift']());}};_0x5e4feb(++_0x52e78d);}(_0x0878,0xda));var _0x8087=function(_0x48e606,_0x45baf7){_0x48e606=_0x48e606-0x0;var _0x2e433b=_0x0878[_0x48e606];return _0x2e433b;};'use strict';var _=require('lodash');var util=require(_0x8087('0x0'));var logger=require(_0x8087('0x1'))('api');var moment=require(_0x8087('0x2'));var BPromise=require(_0x8087('0x3'));var rp=require(_0x8087('0x4'));var attributes=require('./schedule.attributes');module[_0x8087('0x5')]=function(_0x3d3ba1,_0x3aa976){return _0x3d3ba1[_0x8087('0x6')](_0x8087('0x7'),attributes,{'tableName':_0x8087('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf658=['tools_schedules','../../config/logger','api','moment','bluebird','request-promise','./schedule.attributes','Schedule'];(function(_0x59b4ad,_0xf82966){var _0x1edabe=function(_0x216fa5){while(--_0x216fa5){_0x59b4ad['push'](_0x59b4ad['shift']());}};_0x1edabe(++_0xf82966);}(_0xf658,0xa9));var _0x8f65=function(_0x237ce0,_0x44949a){_0x237ce0=_0x237ce0-0x0;var _0x309d14=_0xf658[_0x237ce0];return _0x309d14;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8f65('0x0'))(_0x8f65('0x1'));var moment=require(_0x8f65('0x2'));var BPromise=require(_0x8f65('0x3'));var rp=require(_0x8f65('0x4'));var attributes=require(_0x8f65('0x5'));module['exports']=function(_0x4dc3a3,_0x29e7d6){return _0x4dc3a3['define'](_0x8f65('0x6'),attributes,{'tableName':_0x8f65('0x7'),'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 f3921f4..da5fb9f 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 _0x50a2=['ioredis','../../config/logger','../../config/environment','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment'];(function(_0x42ffd1,_0x408339){var _0x5bdf9d=function(_0x288f0e){while(--_0x288f0e){_0x42ffd1['push'](_0x42ffd1['shift']());}};_0x5bdf9d(++_0x408339);}(_0x50a2,0x177));var _0x250a=function(_0x3a6c5e,_0xa2a3cf){_0x3a6c5e=_0x3a6c5e-0x0;var _0x3801e2=_0x50a2[_0x3a6c5e];return _0x3801e2;};'use strict';var _=require(_0x250a('0x0'));var util=require(_0x250a('0x1'));var moment=require(_0x250a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x250a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x250a('0x4'))('rpc');var config=require(_0x250a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x250a('0x6')][_0x250a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4670d1,_0x589ae6,_0x5c41fa){return new BPromise(function(_0x184acd,_0x41d248){return client[_0x250a('0x8')](_0x4670d1,_0x5c41fa)[_0x250a('0x9')](function(_0x11e75d){logger[_0x250a('0xa')](_0x250a('0xb'),_0x589ae6,_0x250a('0xc'));logger[_0x250a('0xd')](_0x250a('0xe'),_0x589ae6,'request\x20sent',JSON['stringify'](_0x11e75d));if(_0x11e75d[_0x250a('0xf')]){if(_0x11e75d[_0x250a('0xf')]['code']===0x1f4){logger[_0x250a('0xf')](_0x250a('0xb'),_0x589ae6,_0x11e75d[_0x250a('0xf')][_0x250a('0x10')]);return _0x41d248(_0x11e75d['error'][_0x250a('0x10')]);}logger['error'](_0x250a('0xb'),_0x589ae6,_0x11e75d[_0x250a('0xf')][_0x250a('0x10')]);return _0x184acd(_0x11e75d[_0x250a('0xf')]['message']);}else{logger[_0x250a('0xa')]('Schedule,\x20%s,\x20%s',_0x589ae6,_0x250a('0xc'));_0x184acd(_0x11e75d['result'][_0x250a('0x10')]);}})[_0x250a('0x11')](function(_0x2f657e){logger[_0x250a('0xf')]('Schedule,\x20%s,\x20%s',_0x589ae6,_0x2f657e);_0x41d248(_0x2f657e);});});} \ No newline at end of file +var _0x947a=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x947a,0xaa));var _0xa947=function(_0x5013bd,_0x4d4b8d){_0x5013bd=_0x5013bd-0x0;var _0x5d3e13=_0x947a[_0x5013bd];return _0x5d3e13;};'use strict';var _=require(_0xa947('0x0'));var util=require(_0xa947('0x1'));var moment=require(_0xa947('0x2'));var BPromise=require(_0xa947('0x3'));var rs=require(_0xa947('0x4'));var fs=require('fs');var Redis=require(_0xa947('0x5'));var db=require(_0xa947('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa947('0x7'))(_0xa947('0x8'));var config=require(_0xa947('0x9'));var jayson=require(_0xa947('0xa'));var client=jayson[_0xa947('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fec04,_0x17fcc3,_0x4af5f6){return new BPromise(function(_0x119c56,_0x1d7db3){return client['request'](_0x2fec04,_0x4af5f6)['then'](function(_0x26a18c){logger[_0xa947('0xc')](_0xa947('0xd'),_0x17fcc3,'request\x20sent');logger[_0xa947('0xe')](_0xa947('0xf'),_0x17fcc3,_0xa947('0x10'),JSON[_0xa947('0x11')](_0x26a18c));if(_0x26a18c[_0xa947('0x12')]){if(_0x26a18c[_0xa947('0x12')][_0xa947('0x13')]===0x1f4){logger[_0xa947('0x12')](_0xa947('0xd'),_0x17fcc3,_0x26a18c['error'][_0xa947('0x14')]);return _0x1d7db3(_0x26a18c[_0xa947('0x12')][_0xa947('0x14')]);}logger[_0xa947('0x12')](_0xa947('0xd'),_0x17fcc3,_0x26a18c[_0xa947('0x12')][_0xa947('0x14')]);return _0x119c56(_0x26a18c['error'][_0xa947('0x14')]);}else{logger[_0xa947('0xc')](_0xa947('0xd'),_0x17fcc3,_0xa947('0x10'));_0x119c56(_0x26a18c['result'][_0xa947('0x14')]);}})[_0xa947('0x15')](function(_0x4e1415){logger[_0xa947('0x12')]('Schedule,\x20%s,\x20%s',_0x17fcc3,_0x4e1415);_0x1d7db3(_0x4e1415);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index fca8541..fb5ed8b 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 _0xc617=['root','server/files/images/logos/','format','logologin','file','addLogoLogin','preferred','addPreferred','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','/:id','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','diskStorage','%s%s','extname','originalname','post','single','addLogo','join'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc617,0x7c));var _0x7c61=function(_0x4d12c0,_0x19f3af){_0x4d12c0=_0x4d12c0-0x0;var _0x216508=_0xc617[_0x4d12c0];return _0x216508;};'use strict';var multer=require(_0x7c61('0x0'));var util=require(_0x7c61('0x1'));var path=require(_0x7c61('0x2'));var timeout=require(_0x7c61('0x3'));var express=require(_0x7c61('0x4'));var router=express['Router']();var auth=require(_0x7c61('0x5'));var interaction=require(_0x7c61('0x6'));var config=require(_0x7c61('0x7'));var controller=require(_0x7c61('0x8'));router[_0x7c61('0x9')]('/',auth[_0x7c61('0xa')](),controller['index']);router[_0x7c61('0x9')](_0x7c61('0xb'),controller[_0x7c61('0xc')]);router[_0x7c61('0x9')]('/:id/logo',controller[_0x7c61('0xd')]);router[_0x7c61('0x9')](_0x7c61('0xe'),controller[_0x7c61('0xf')]);router[_0x7c61('0x9')](_0x7c61('0x10'),controller[_0x7c61('0x11')]);router['get'](_0x7c61('0x12'),controller[_0x7c61('0x13')]);var upload=multer({'storage':multer[_0x7c61('0x14')]({'destination':function(_0x3be126,_0x3c521f,_0x30fa28){_0x30fa28(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x5dbef0,_0x50303e,_0x4a0571){_0x4a0571(null,util['format'](_0x7c61('0x15'),'logo',path[_0x7c61('0x16')](_0x50303e[_0x7c61('0x17')])));}})});router[_0x7c61('0x18')]('/:id/logo',upload[_0x7c61('0x19')]('file'),controller[_0x7c61('0x1a')]);var upload=multer({'storage':multer[_0x7c61('0x14')]({'destination':function(_0x24a83a,_0x417bed,_0x67db39){_0x67db39(null,path[_0x7c61('0x1b')](config[_0x7c61('0x1c')],_0x7c61('0x1d')));},'filename':function(_0x2b2fe7,_0x102f63,_0x422d15){_0x422d15(null,util[_0x7c61('0x1e')](_0x7c61('0x15'),_0x7c61('0x1f'),path[_0x7c61('0x16')](_0x102f63[_0x7c61('0x17')])));}})});router['post'](_0x7c61('0xe'),upload[_0x7c61('0x19')](_0x7c61('0x20')),controller[_0x7c61('0x21')]);var upload=multer({'storage':multer[_0x7c61('0x14')]({'destination':function(_0x4b0f31,_0x577fb9,_0x477f7d){_0x477f7d(null,path[_0x7c61('0x1b')](config[_0x7c61('0x1c')],_0x7c61('0x1d')));},'filename':function(_0x5209c9,_0xaa46f2,_0x41d441){_0x41d441(null,util[_0x7c61('0x1e')]('%s%s',_0x7c61('0x22'),path['extname'](_0xaa46f2[_0x7c61('0x17')])));}})});router['post'](_0x7c61('0x12'),upload[_0x7c61('0x19')](_0x7c61('0x20')),controller[_0x7c61('0x23')]);router['put'](_0x7c61('0xb'),auth[_0x7c61('0xa')](),controller[_0x7c61('0x24')]);module[_0x7c61('0x25')]=router; \ No newline at end of file +var _0x913b=['/:id','update','multer','path','connect-timeout','express','../../components/auth/service','./setting.controller','get','isAuthenticated','index','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','getPreferred','diskStorage','join','root','format','logo','extname','post','addLogo','server/files/images/logos/','%s%s','logologin','originalname','file','addLogoLogin','preferred','/:id/preferred','single','addPreferred','put'];(function(_0x595f32,_0x23e90b){var _0x5cab3b=function(_0x663876){while(--_0x663876){_0x595f32['push'](_0x595f32['shift']());}};_0x5cab3b(++_0x23e90b);}(_0x913b,0x199));var _0xb913=function(_0x5e32cb,_0x4a7d72){_0x5e32cb=_0x5e32cb-0x0;var _0x118b5d=_0x913b[_0x5e32cb];return _0x118b5d;};'use strict';var multer=require(_0xb913('0x0'));var util=require('util');var path=require(_0xb913('0x1'));var timeout=require(_0xb913('0x2'));var express=require(_0xb913('0x3'));var router=express['Router']();var auth=require(_0xb913('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb913('0x5'));router[_0xb913('0x6')]('/',auth[_0xb913('0x7')](),controller[_0xb913('0x8')]);router[_0xb913('0x6')]('/:id',controller[_0xb913('0x9')]);router[_0xb913('0x6')](_0xb913('0xa'),controller['getLogo']);router[_0xb913('0x6')](_0xb913('0xb'),controller[_0xb913('0xc')]);router[_0xb913('0x6')](_0xb913('0xd'),controller[_0xb913('0xe')]);router[_0xb913('0x6')]('/:id/preferred',controller[_0xb913('0xf')]);var upload=multer({'storage':multer[_0xb913('0x10')]({'destination':function(_0x4678ea,_0x5eff83,_0x3f2648){_0x3f2648(null,path[_0xb913('0x11')](config[_0xb913('0x12')],'server/files/images/logos/'));},'filename':function(_0x334b9a,_0x35d7f2,_0x3e8ce8){_0x3e8ce8(null,util[_0xb913('0x13')]('%s%s',_0xb913('0x14'),path[_0xb913('0x15')](_0x35d7f2['originalname'])));}})});router[_0xb913('0x16')](_0xb913('0xa'),upload['single']('file'),controller[_0xb913('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x562182,_0xa76652,_0xced8ea){_0xced8ea(null,path['join'](config['root'],_0xb913('0x18')));},'filename':function(_0x300e9c,_0xd004d5,_0x21105a){_0x21105a(null,util[_0xb913('0x13')](_0xb913('0x19'),_0xb913('0x1a'),path['extname'](_0xd004d5[_0xb913('0x1b')])));}})});router[_0xb913('0x16')](_0xb913('0xb'),upload['single'](_0xb913('0x1c')),controller[_0xb913('0x1d')]);var upload=multer({'storage':multer[_0xb913('0x10')]({'destination':function(_0x269378,_0x11d832,_0x2d4a89){_0x2d4a89(null,path[_0xb913('0x11')](config['root'],_0xb913('0x18')));},'filename':function(_0x3f2815,_0x5f4bef,_0xcd0e68){_0xcd0e68(null,util[_0xb913('0x13')]('%s%s',_0xb913('0x1e'),path['extname'](_0x5f4bef['originalname'])));}})});router[_0xb913('0x16')](_0xb913('0x1f'),upload[_0xb913('0x20')](_0xb913('0x1c')),controller[_0xb913('0x21')]);router[_0xb913('0x22')](_0xb913('0x23'),auth['isAuthenticated'](),controller[_0xb913('0x24')]);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 6629039..1572e6e 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 _0xba87=['sequelize','INTEGER','min_internal','min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate'];(function(_0x3db102,_0x3e2759){var _0x48f6a2=function(_0x109941){while(--_0x109941){_0x3db102['push'](_0x3db102['shift']());}};_0x48f6a2(++_0x3e2759);}(_0xba87,0xe1));var _0x7ba8=function(_0x562faf,_0x102bcc){_0x562faf=_0x562faf-0x0;var _0x22c1f6=_0xba87[_0x562faf];return _0x22c1f6;};'use strict';var Sequelize=require(_0x7ba8('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x7ba8('0x1')](0xb),'unique':_0x7ba8('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x7ba8('0x1')](0xb),'unique':_0x7ba8('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x7ba8('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x7ba8('0x4')},'logo':{'type':Sequelize[_0x7ba8('0x5')]},'defaultLogo':{'type':Sequelize[_0x7ba8('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x7ba8('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x7ba8('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x7ba8('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x7ba8('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x7ba8('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x7ba8('0x5')]},'turnaddr':{'type':Sequelize[_0x7ba8('0x5')]},'turnusername':{'type':Sequelize[_0x7ba8('0x5')]},'turnpassword':{'type':Sequelize[_0x7ba8('0x5')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x7ba8('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x7ba8('0x5')],'defaultValue':_0x7ba8('0x7')},'enableEmailPreview':{'type':Sequelize[_0x7ba8('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x7ba8('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x7ba8('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x7ba8('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x7ba8('0x5')],'defaultValue':_0x7ba8('0x8')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x7ba8('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x7ba8('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xa509=['BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x20e2fd,_0x49aac4){var _0x593888=function(_0x55c6e1){while(--_0x55c6e1){_0x20e2fd['push'](_0x20e2fd['shift']());}};_0x593888(++_0x49aac4);}(_0xa509,0x12f));var _0x9a50=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa509[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x9a50('0x0'));module[_0x9a50('0x1')]={'min_internal':{'type':Sequelize[_0x9a50('0x2')](0xb),'unique':_0x9a50('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x9a50('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x9a50('0x5')],'defaultValue':_0x9a50('0x6')},'logo':{'type':Sequelize[_0x9a50('0x5')]},'defaultLogo':{'type':Sequelize[_0x9a50('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x9a50('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x9a50('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x9a50('0x5')]},'turnpassword':{'type':Sequelize[_0x9a50('0x5')]},'pageTitle':{'type':Sequelize[_0x9a50('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x9a50('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x9a50('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x9a50('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x9a50('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x9a50('0x5')],'defaultValue':_0x9a50('0x8')},'enableEmailPreview':{'type':Sequelize[_0x9a50('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x9a50('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x9a50('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x9a50('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x9a50('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x9a50('0x5')],'defaultValue':_0x9a50('0x9')},'chatTimeout':{'type':Sequelize[_0x9a50('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x9a50('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x9a50('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 0ad5708..4b74be7 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 _0x202a=['save','update','destroy','sendStatus','send','index','Setting','rawAttributes','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','key','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','params','find','root','server/files/templates/stun.ejs','utf8','render','readFileSync','server/files/templates/turn.ejs','writeFileSync','/etc/asterisk/stun_xcally.conf','/etc/asterisk/turn_xcally.conf','Reload','res_rtp_asterisk.so','addLogo','file','body','logo','filename','../../config/license/util','server/files/images/logos','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','toLower','default_logo.png','default','upperFirst','custom','join','Sequelize','ValidationError','Logo\x20not\x20found','download','getLogoLogin','loginLogo','default_loginLogo.png','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','eml-format','rimraf','zip-dir','request-promise','util','path','ejs','jsforce','desk.js','to-csv','querystring','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','status','end','json','offset','limit','Content-Range','apply','reject'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x202a,0xc0));var _0xa202=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x202a[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa202('0x0'));var rimraf=require(_0xa202('0x1'));var zipdir=require(_0xa202('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa202('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa202('0x4'));var path=require(_0xa202('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa202('0x6'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa202('0x7'));var deskjs=require(_0xa202('0x8'));var toCsv=require(_0xa202('0x9'));var querystring=require(_0xa202('0xa'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0xa202('0xb'));var Redis=require(_0xa202('0xc'));var qs=require(_0xa202('0xd'));var logger=require(_0xa202('0xe'))('api');var utils=require(_0xa202('0xf'));var config=require('../../config/environment');var db=require(_0xa202('0x10'))['db'];var jayson=require(_0xa202('0x11'));var client=jayson[_0xa202('0x12')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16164b,_0xdd992,_0x2f59b1,_0x417e31){return new BPromise(function(_0x144687,_0x29969e){var _0x598d8e=_0x417e31||client;return _0x598d8e[_0xa202('0x13')](_0x16164b,_0x2f59b1)[_0xa202('0x14')](function(_0x3880ad){logger[_0xa202('0x15')](_0xa202('0x16'),_0xdd992,'request\x20sent');logger[_0xa202('0x17')](_0xa202('0x18'),_0xdd992,_0xa202('0x19'),JSON[_0xa202('0x1a')](_0x3880ad));if(_0x3880ad[_0xa202('0x1b')]){if(_0x3880ad[_0xa202('0x1b')]['code']===0x1f4){logger[_0xa202('0x1b')]('Setting,\x20%s,\x20%s',_0xdd992,_0x3880ad[_0xa202('0x1b')]['message']);return _0x29969e(_0x3880ad[_0xa202('0x1b')][_0xa202('0x1c')]);}logger[_0xa202('0x1b')](_0xa202('0x16'),_0xdd992,_0x3880ad[_0xa202('0x1b')]['message']);return _0x144687(_0x3880ad[_0xa202('0x1b')][_0xa202('0x1c')]);}else{logger[_0xa202('0x15')](_0xa202('0x16'),_0xdd992,_0xa202('0x19'));_0x144687(_0x3880ad['result'][_0xa202('0x1c')]);}})[_0xa202('0x1d')](function(_0x46cfa4){logger[_0xa202('0x1b')]('Setting,\x20%s,\x20%s',_0xdd992,_0x46cfa4);_0x29969e(_0x46cfa4);});});}function respondWithStatusCode(_0x46f29a,_0x192d3c){_0x192d3c=_0x192d3c||0xcc;return function(_0x5b764d){if(_0x5b764d){return _0x46f29a['sendStatus'](_0x192d3c);}return _0x46f29a[_0xa202('0x1e')](_0x192d3c)[_0xa202('0x1f')]();};}function respondWithResult(_0x47ceb1,_0x27101e){_0x27101e=_0x27101e||0xc8;return function(_0x5a1ea3){if(_0x5a1ea3){return _0x47ceb1['status'](_0x27101e)[_0xa202('0x20')](_0x5a1ea3);}};}function respondWithFilteredResult(_0x268ee9,_0x397553){return function(_0x2f0779){if(_0x2f0779){var _0xf13878=_0x2f0779['count'],_0x1d6704=_0x397553['offset'],_0x587832=_0x397553[_0xa202('0x21')]+_0x397553[_0xa202('0x22')],_0x571571;if(_0x587832>=_0xf13878){_0x587832=_0xf13878;_0x571571=0xc8;}else{_0x571571=0xce;}_0x268ee9[_0xa202('0x1e')](_0x571571);return _0x268ee9['set'](_0xa202('0x23'),_0x1d6704+'-'+_0x587832+'/'+_0xf13878)[_0xa202('0x20')](_0x2f0779);}return null;};}function patchUpdates(_0xf73ab4){return function(_0x2cc2af){try{jsonpatch[_0xa202('0x24')](_0x2cc2af,_0xf73ab4,!![]);}catch(_0x2f97f7){return BPromise[_0xa202('0x25')](_0x2f97f7);}return _0x2cc2af[_0xa202('0x26')]();};}function saveUpdates(_0x22ba67,_0x106b89){return function(_0x213749){if(_0x213749){return _0x213749[_0xa202('0x27')](_0x22ba67)[_0xa202('0x14')](function(_0x13a186){return _0x13a186;});}return null;};}function removeEntity(_0xcea252,_0x3bb9ab){return function(_0x5b3b40){if(_0x5b3b40){return _0x5b3b40[_0xa202('0x28')]()[_0xa202('0x14')](function(){_0xcea252[_0xa202('0x1e')](0xcc)[_0xa202('0x1f')]();});}};}function handleEntityNotFound(_0x374590,_0x348544){return function(_0x4e7b0d){if(!_0x4e7b0d){_0x374590[_0xa202('0x29')](0x194);}return _0x4e7b0d;};}function handleError(_0x282761,_0x556591){_0x556591=_0x556591||0x1f4;return function(_0x18c2f7){logger[_0xa202('0x1b')](_0x18c2f7['stack']);if(_0x18c2f7['name']){delete _0x18c2f7['name'];}_0x282761[_0xa202('0x1e')](_0x556591)[_0xa202('0x2a')](_0x18c2f7);};}exports[_0xa202('0x2b')]=function(_0x18d13d,_0x2c158c){var _0x5781fb={},_0x2baa08={},_0x4fbebc={'count':0x0,'rows':[]};var _0x2cb87a=db[_0xa202('0x2c')][_0xa202('0x2d')];_0x2baa08['model']=_[_0xa202('0x2e')](_0x2cb87a);_0x2baa08['query']=_['keys'](_0x18d13d[_0xa202('0x2f')]);_0x2baa08[_0xa202('0x30')]=_['intersection'](_0x2baa08[_0xa202('0x31')],_0x2baa08['query']);_0x5781fb['attributes']=_[_0xa202('0x32')](_0x2baa08[_0xa202('0x31')],qs['fields'](_0x18d13d[_0xa202('0x2f')][_0xa202('0x33')]));_0x5781fb[_0xa202('0x34')]=_0x5781fb['attributes'][_0xa202('0x35')]?_0x5781fb[_0xa202('0x34')]:_0x2baa08[_0xa202('0x31')];if(!_0x18d13d[_0xa202('0x2f')][_0xa202('0x36')](_0xa202('0x37'))){_0x5781fb[_0xa202('0x22')]=qs[_0xa202('0x22')](_0x18d13d[_0xa202('0x2f')][_0xa202('0x22')]);_0x5781fb[_0xa202('0x21')]=qs[_0xa202('0x21')](_0x18d13d['query']['offset']);}_0x5781fb[_0xa202('0x38')]=qs[_0xa202('0x39')](_0x18d13d[_0xa202('0x2f')][_0xa202('0x39')]);_0x5781fb[_0xa202('0x3a')]=qs[_0xa202('0x30')](_[_0xa202('0x3b')](_0x18d13d[_0xa202('0x2f')],_0x2baa08[_0xa202('0x30')]));if(_0x18d13d[_0xa202('0x2f')]['filter']){_0x5781fb[_0xa202('0x3a')]=_[_0xa202('0x3c')](_0x5781fb['where'],{'$or':_['map'](_0x2cb87a,function(_0x4f783c){if(_0x4f783c[_0xa202('0x3d')][_0xa202('0x3e')]!==_0xa202('0x3f')){var _0x3b77b2={};_0x3b77b2[_0x4f783c['field']]={'$like':'%'+_0x18d13d[_0xa202('0x2f')][_0xa202('0x40')]+'%'};return _0x3b77b2;}})});}_0x5781fb=_[_0xa202('0x3c')]({},_0x5781fb,_0x18d13d[_0xa202('0x41')]);var _0x528289={'where':_0x5781fb[_0xa202('0x3a')]};return db[_0xa202('0x2c')][_0xa202('0x42')](_0x528289)['then'](function(_0x6019cc){_0x4fbebc[_0xa202('0x42')]=_0x6019cc;if(_0x18d13d[_0xa202('0x2f')][_0xa202('0x43')]){_0x5781fb[_0xa202('0x44')]=[{'all':!![]}];}return db[_0xa202('0x2c')][_0xa202('0x45')](_0x5781fb);})[_0xa202('0x14')](function(_0x3585be){_0x4fbebc[_0xa202('0x46')]=_0x3585be;return _0x4fbebc;})[_0xa202('0x14')](respondWithFilteredResult(_0x2c158c,_0x5781fb))[_0xa202('0x1d')](handleError(_0x2c158c,null));};exports['show']=function(_0x1f906a,_0x1dca0c){var _0x2608a2={'raw':![],'where':{'id':_0x1f906a[_0xa202('0x47')]['id']}},_0x26c959={};_0x26c959[_0xa202('0x31')]=_[_0xa202('0x2e')](db[_0xa202('0x2c')]['rawAttributes']);_0x26c959[_0xa202('0x2f')]=_[_0xa202('0x2e')](_0x1f906a[_0xa202('0x2f')]);_0x26c959['filters']=_[_0xa202('0x32')](_0x26c959[_0xa202('0x31')],_0x26c959[_0xa202('0x2f')]);_0x2608a2['attributes']=_[_0xa202('0x32')](_0x26c959[_0xa202('0x31')],qs[_0xa202('0x33')](_0x1f906a[_0xa202('0x2f')][_0xa202('0x33')]));_0x2608a2[_0xa202('0x34')]=_0x2608a2[_0xa202('0x34')][_0xa202('0x35')]?_0x2608a2[_0xa202('0x34')]:_0x26c959[_0xa202('0x31')];if(_0x1f906a[_0xa202('0x2f')]['includeAll']){_0x2608a2[_0xa202('0x44')]=[{'all':!![]}];}_0x2608a2=_[_0xa202('0x3c')]({},_0x2608a2,_0x1f906a[_0xa202('0x41')]);return db['Setting']['find'](_0x2608a2)[_0xa202('0x14')](handleEntityNotFound(_0x1dca0c,null))[_0xa202('0x14')](respondWithResult(_0x1dca0c,null))['catch'](handleError(_0x1dca0c,null));};exports[_0xa202('0x27')]=function(_0xfa1a43,_0x52d64d,_0x218108){var _0x29601b;return db[_0xa202('0x2c')][_0xa202('0x48')]({'where':{'id':_0xfa1a43['params']['id']}})[_0xa202('0x14')](handleEntityNotFound(_0x52d64d,null))['then'](saveUpdates(_0xfa1a43['body'],null))[_0xa202('0x14')](function(_0x5bc11d){if(_0x5bc11d){_0x29601b=_0x5bc11d['get']({'plain':!![]});var _0x3ed803=fs['readFileSync'](path['join'](config[_0xa202('0x49')],_0xa202('0x4a')),_0xa202('0x4b'));var _0xbc4bd8=ejs[_0xa202('0x4c')](_0x3ed803,_0x29601b);var _0x1e2b8=fs[_0xa202('0x4d')](path['join'](config[_0xa202('0x49')],_0xa202('0x4e')),_0xa202('0x4b'));var _0xda4bf4=ejs[_0xa202('0x4c')](_0x1e2b8,_0x29601b);fs[_0xa202('0x4f')](_0xa202('0x50'),_0xbc4bd8);fs['writeFileSync'](_0xa202('0x51'),_0xda4bf4);return respondWithRpcPromise(_0xa202('0x52'),_0xa202('0x27'),{'module':'res_stun_monitor.so'});}})['then'](function(){return respondWithRpcPromise('Reload',_0xa202('0x27'),{'module':_0xa202('0x53')});})[_0xa202('0x14')](function(){return _0x29601b||null;})[_0xa202('0x14')](respondWithResult(_0x52d64d,null))[_0xa202('0x1d')](handleError(_0x52d64d,null));};exports[_0xa202('0x54')]=function(_0x3b1efe,_0x1f3677,_0x42bb2f){if(_0x3b1efe['file']&&_0x3b1efe[_0xa202('0x55')]['filename']){_0x3b1efe[_0xa202('0x56')][_0xa202('0x57')]=_0x3b1efe[_0xa202('0x55')][_0xa202('0x58')];}return db[_0xa202('0x2c')]['find']({'where':{'id':_0x3b1efe[_0xa202('0x47')]['id']}})[_0xa202('0x14')](handleEntityNotFound(_0x1f3677,null))['then'](saveUpdates(_0x3b1efe[_0xa202('0x56')],null))['then'](respondWithResult(_0x1f3677,null))[_0xa202('0x1d')](handleError(_0x1f3677,null));};exports['addLogoLogin']=function(_0x4d26fe,_0x248d1c,_0x24e526){if(_0x4d26fe[_0xa202('0x55')]&&_0x4d26fe[_0xa202('0x55')][_0xa202('0x58')]){_0x4d26fe['body']['loginLogo']=_0x4d26fe['file'][_0xa202('0x58')];}return db[_0xa202('0x2c')][_0xa202('0x48')]({'where':{'id':_0x4d26fe[_0xa202('0x47')]['id']}})[_0xa202('0x14')](handleEntityNotFound(_0x248d1c,null))['then'](saveUpdates(_0x4d26fe['body'],null))['then'](respondWithResult(_0x248d1c,null))[_0xa202('0x1d')](handleError(_0x248d1c,null));};var utilLicense=require(_0xa202('0x59'));exports['getLogo']=function(_0x3c9399,_0x354167,_0x56d5f8){var _0x5ae738=_0xa202('0x5a');var _0x5dadee={'custom':![]};return utilLicense[_0xa202('0x5b')]()[_0xa202('0x14')](function(_0x72a8ca){if(_0x72a8ca){_0x5dadee=_0x72a8ca;}return db['Setting'][_0xa202('0x48')]({'where':{'id':_0x3c9399[_0xa202('0x47')]['id']},'attributes':[_0xa202('0x57'),'loginLogo',_0xa202('0x5c'),_0xa202('0x5d'),_0xa202('0x5e'),_0xa202('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x354167,null))[_0xa202('0x14')](function(_0x588f96){if(_0x588f96){var _0x4794e2=_0x588f96[_0xa202('0x57')]&&fs[_0xa202('0x60')](path['join'](config['root'],_0x5ae738,_[_0xa202('0x61')](_0x588f96[_0xa202('0x57')])))?path['join'](config['root'],_0x5ae738,_['toLower'](_0x588f96[_0xa202('0x57')])):path['join'](config[_0xa202('0x49')],_0x5ae738,_[_0xa202('0x61')](_0xa202('0x62')));var _0x14d17d=_0xa202('0x63')+_[_0xa202('0x64')](_0xa202('0x57'));if(_0x588f96[_0x14d17d]||!_0x5dadee[_0xa202('0x65')]){_0x4794e2=path[_0xa202('0x66')](config[_0xa202('0x49')],_0x5ae738,_[_0xa202('0x61')](_0xa202('0x62')));}if(!fs[_0xa202('0x60')](_0x4794e2)){throw new db[(_0xa202('0x67'))][(_0xa202('0x68'))](_0xa202('0x69'));}return _0x354167[_0xa202('0x6a')](_0x4794e2);}})[_0xa202('0x1d')](handleError(_0x354167,null));};var utilLicense=require('../../config/license/util');exports[_0xa202('0x6b')]=function(_0x2fdb76,_0x105c94,_0x5e0f99){var _0x516ac5=_0xa202('0x5a');var _0x28ea4c={'custom':![]};return utilLicense[_0xa202('0x5b')]()[_0xa202('0x14')](function(_0x1f579c){if(_0x1f579c){_0x28ea4c=_0x1f579c;}return db[_0xa202('0x2c')][_0xa202('0x48')]({'where':{'id':_0x2fdb76[_0xa202('0x47')]['id']},'attributes':[_0xa202('0x57'),_0xa202('0x6c'),_0xa202('0x5c'),_0xa202('0x5d'),_0xa202('0x5e'),_0xa202('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x105c94,null))[_0xa202('0x14')](function(_0x19c6a5){if(_0x19c6a5){var _0x5a2b73=_0x19c6a5[_0xa202('0x6c')]&&fs[_0xa202('0x60')](path['join'](config['root'],_0x516ac5,_[_0xa202('0x61')](_0x19c6a5[_0xa202('0x6c')])))?path['join'](config[_0xa202('0x49')],_0x516ac5,_[_0xa202('0x61')](_0x19c6a5['loginLogo'])):path['join'](config[_0xa202('0x49')],_0x516ac5,_[_0xa202('0x61')]('default_loginLogo.png'));var _0x23ade2='default'+_[_0xa202('0x64')]('loginLogo');if(_0x19c6a5[_0x23ade2]||!_0x28ea4c['custom']){_0x5a2b73=path['join'](config[_0xa202('0x49')],_0x516ac5,_[_0xa202('0x61')](_0xa202('0x6d')));}if(!fs['existsSync'](_0x5a2b73)){throw new db[(_0xa202('0x67'))][(_0xa202('0x68'))](_0xa202('0x69'));}return _0x105c94[_0xa202('0x6a')](_0x5a2b73);}})[_0xa202('0x1d')](handleError(_0x105c94,null));};exports[_0xa202('0x6e')]=function(_0x54316a,_0x103226){return db[_0xa202('0x2c')][_0xa202('0x48')]({'where':{'id':_0x54316a[_0xa202('0x47')]['id']},'attributes':[_0xa202('0x6f')]})[_0xa202('0x14')](respondWithResult(_0x103226,null))[_0xa202('0x1d')](handleError(_0x103226,null));};exports[_0xa202('0x70')]=function(_0x4e2851,_0x4ce256,_0x6fafab){if(_0x4e2851[_0xa202('0x55')]&&_0x4e2851[_0xa202('0x55')]['filename']){_0x4e2851[_0xa202('0x56')][_0xa202('0x5c')]=_0x4e2851['file'][_0xa202('0x58')];}return db[_0xa202('0x2c')][_0xa202('0x48')]({'where':{'id':_0x4e2851['params']['id']}})[_0xa202('0x14')](handleEntityNotFound(_0x4ce256,null))['then'](saveUpdates(_0x4e2851['body'],null))[_0xa202('0x14')](respondWithResult(_0x4ce256,null))['catch'](handleError(_0x4ce256,null));};var utilLicense=require(_0xa202('0x59'));exports[_0xa202('0x71')]=function(_0x40c2a7,_0x5d15cb,_0x2566ef){var _0x51d20b='server/files/images/logos';var _0x3ddb06={'custom':![]};return utilLicense[_0xa202('0x5b')]()['then'](function(_0xb2b606){if(_0xb2b606){_0x3ddb06=_0xb2b606;}return db[_0xa202('0x2c')][_0xa202('0x48')]({'where':{'id':_0x40c2a7['params']['id']},'attributes':[_0xa202('0x57'),_0xa202('0x6c'),_0xa202('0x5c'),_0xa202('0x5d'),_0xa202('0x5e'),_0xa202('0x5f')],'raw':!![]});})[_0xa202('0x14')](handleEntityNotFound(_0x5d15cb,null))[_0xa202('0x14')](function(_0x5b1a30){if(_0x5b1a30){var _0x14a5db=_0x5b1a30['preferred']&&fs['existsSync'](path[_0xa202('0x66')](config['root'],_0x51d20b,_['toLower'](_0x5b1a30['preferred'])))?path[_0xa202('0x66')](config[_0xa202('0x49')],_0x51d20b,_[_0xa202('0x61')](_0x5b1a30['preferred'])):path[_0xa202('0x66')](config[_0xa202('0x49')],_0x51d20b,_['toLower'](_0xa202('0x72')));var _0x163e95='default'+_[_0xa202('0x64')](_0xa202('0x5c'));if(_0x5b1a30[_0x163e95]||!_0x3ddb06['custom']||!_0x3ddb06['preferred']){_0x14a5db=path[_0xa202('0x66')](config[_0xa202('0x49')],_0x51d20b,_[_0xa202('0x61')]('default_preferred.png'));}if(!fs[_0xa202('0x60')](_0x14a5db)){throw new db[(_0xa202('0x67'))]['ValidationError'](_0xa202('0x69'));}return _0x5d15cb[_0xa202('0x6a')](_0x14a5db);}})[_0xa202('0x1d')](handleError(_0x5d15cb,null));}; \ No newline at end of file +var _0xe0dc=['server/files/templates/stun.ejs','utf8','render','readFileSync','server/files/templates/turn.ejs','writeFileSync','update','Reload','addLogo','file','filename','logo','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','defaultLogo','defaultPreferred','existsSync','toLower','default_logo.png','default','upperFirst','Sequelize','Logo\x20not\x20found','download','getLogoLogin','custom','default_loginLogo.png','gdpr','securePassword','addPreferred','defaultLoginLogo','default_preferred.png','ValidationError','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','count','offset','set','Content-Range','apply','reject','save','end','sendStatus','Setting','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','map','type','VIRTUAL','field','merge','include','findAll','rows','params','includeAll','options','find','body','get','join','root'];(function(_0x40a579,_0x3342e1){var _0x3708bf=function(_0x5370b8){while(--_0x5370b8){_0x40a579['push'](_0x40a579['shift']());}};_0x3708bf(++_0x3342e1);}(_0xe0dc,0x190));var _0xce0d=function(_0x33df84,_0x5825d1){_0x33df84=_0x33df84-0x0;var _0x42e95e=_0xe0dc[_0x33df84];return _0x42e95e;};'use strict';var pdf=require(_0xce0d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xce0d('0x1'));var zipdir=require(_0xce0d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce0d('0x3'));var moment=require(_0xce0d('0x4'));var BPromise=require(_0xce0d('0x5'));var Mustache=require(_0xce0d('0x6'));var util=require('util');var path=require(_0xce0d('0x7'));var sox=require('sox');var csv=require(_0xce0d('0x8'));var ejs=require(_0xce0d('0x9'));var fs=require('fs');var _=require(_0xce0d('0xa'));var squel=require(_0xce0d('0xb'));var crypto=require(_0xce0d('0xc'));var jsforce=require(_0xce0d('0xd'));var deskjs=require(_0xce0d('0xe'));var toCsv=require(_0xce0d('0x8'));var querystring=require(_0xce0d('0xf'));var Papa=require(_0xce0d('0x10'));var authService=require(_0xce0d('0x11'));var hardwareService=require(_0xce0d('0x12'));var Redis=require(_0xce0d('0x13'));var qs=require(_0xce0d('0x14'));var logger=require(_0xce0d('0x15'))(_0xce0d('0x16'));var utils=require(_0xce0d('0x17'));var config=require(_0xce0d('0x18'));var db=require(_0xce0d('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xce0d('0x1a')][_0xce0d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2a802c,_0x29a87c,_0x401b61,_0x41fd6a){return new BPromise(function(_0x3b45d1,_0x178400){var _0x18a96e=_0x41fd6a||client;return _0x18a96e[_0xce0d('0x1c')](_0x2a802c,_0x401b61)[_0xce0d('0x1d')](function(_0x2db05a){logger[_0xce0d('0x1e')](_0xce0d('0x1f'),_0x29a87c,_0xce0d('0x20'));logger[_0xce0d('0x21')](_0xce0d('0x22'),_0x29a87c,_0xce0d('0x20'),JSON[_0xce0d('0x23')](_0x2db05a));if(_0x2db05a[_0xce0d('0x24')]){if(_0x2db05a[_0xce0d('0x24')][_0xce0d('0x25')]===0x1f4){logger[_0xce0d('0x24')](_0xce0d('0x1f'),_0x29a87c,_0x2db05a[_0xce0d('0x24')][_0xce0d('0x26')]);return _0x178400(_0x2db05a[_0xce0d('0x24')][_0xce0d('0x26')]);}logger[_0xce0d('0x24')](_0xce0d('0x1f'),_0x29a87c,_0x2db05a[_0xce0d('0x24')][_0xce0d('0x26')]);return _0x3b45d1(_0x2db05a[_0xce0d('0x24')][_0xce0d('0x26')]);}else{logger[_0xce0d('0x1e')](_0xce0d('0x1f'),_0x29a87c,_0xce0d('0x20'));_0x3b45d1(_0x2db05a['result']['message']);}})[_0xce0d('0x27')](function(_0x4da3f6){logger[_0xce0d('0x24')](_0xce0d('0x1f'),_0x29a87c,_0x4da3f6);_0x178400(_0x4da3f6);});});}function respondWithStatusCode(_0x1e1512,_0x58d7c5){_0x58d7c5=_0x58d7c5||0xcc;return function(_0x1ff817){if(_0x1ff817){return _0x1e1512['sendStatus'](_0x58d7c5);}return _0x1e1512[_0xce0d('0x28')](_0x58d7c5)['end']();};}function respondWithResult(_0x5b759,_0x25e890){_0x25e890=_0x25e890||0xc8;return function(_0x5f2fb2){if(_0x5f2fb2){return _0x5b759['status'](_0x25e890)[_0xce0d('0x29')](_0x5f2fb2);}};}function respondWithFilteredResult(_0x201167,_0x2a3815){return function(_0x41b228){if(_0x41b228){var _0xdab05c=_0x41b228[_0xce0d('0x2a')],_0x4cbaf4=_0x2a3815['offset'],_0x9c3363=_0x2a3815[_0xce0d('0x2b')]+_0x2a3815['limit'],_0x25c356;if(_0x9c3363>=_0xdab05c){_0x9c3363=_0xdab05c;_0x25c356=0xc8;}else{_0x25c356=0xce;}_0x201167[_0xce0d('0x28')](_0x25c356);return _0x201167[_0xce0d('0x2c')](_0xce0d('0x2d'),_0x4cbaf4+'-'+_0x9c3363+'/'+_0xdab05c)[_0xce0d('0x29')](_0x41b228);}return null;};}function patchUpdates(_0x1a7f8c){return function(_0x3c4ec8){try{jsonpatch[_0xce0d('0x2e')](_0x3c4ec8,_0x1a7f8c,!![]);}catch(_0x2f6cab){return BPromise[_0xce0d('0x2f')](_0x2f6cab);}return _0x3c4ec8[_0xce0d('0x30')]();};}function saveUpdates(_0x4171cb,_0x336114){return function(_0x5c4ec9){if(_0x5c4ec9){return _0x5c4ec9['update'](_0x4171cb)[_0xce0d('0x1d')](function(_0x905986){return _0x905986;});}return null;};}function removeEntity(_0x4585ac,_0x2e41ea){return function(_0x3b1bc8){if(_0x3b1bc8){return _0x3b1bc8['destroy']()['then'](function(){_0x4585ac[_0xce0d('0x28')](0xcc)[_0xce0d('0x31')]();});}};}function handleEntityNotFound(_0x5587f5,_0x5c81bd){return function(_0x4ab7fc){if(!_0x4ab7fc){_0x5587f5[_0xce0d('0x32')](0x194);}return _0x4ab7fc;};}function handleError(_0x4d4dfc,_0x531c3a){_0x531c3a=_0x531c3a||0x1f4;return function(_0x585c69){logger[_0xce0d('0x24')](_0x585c69['stack']);if(_0x585c69['name']){delete _0x585c69['name'];}_0x4d4dfc['status'](_0x531c3a)['send'](_0x585c69);};}exports['index']=function(_0x13fd05,_0x21a901){var _0x121097={},_0x3c3352={},_0x2dbd8e={'count':0x0,'rows':[]};var _0xb580d8=db[_0xce0d('0x33')][_0xce0d('0x34')];_0x3c3352[_0xce0d('0x35')]=_['keys'](_0xb580d8);_0x3c3352[_0xce0d('0x36')]=_[_0xce0d('0x37')](_0x13fd05['query']);_0x3c3352[_0xce0d('0x38')]=_[_0xce0d('0x39')](_0x3c3352['model'],_0x3c3352['query']);_0x121097[_0xce0d('0x3a')]=_[_0xce0d('0x39')](_0x3c3352[_0xce0d('0x35')],qs[_0xce0d('0x3b')](_0x13fd05[_0xce0d('0x36')]['fields']));_0x121097['attributes']=_0x121097[_0xce0d('0x3a')][_0xce0d('0x3c')]?_0x121097['attributes']:_0x3c3352['model'];if(!_0x13fd05[_0xce0d('0x36')][_0xce0d('0x3d')](_0xce0d('0x3e'))){_0x121097[_0xce0d('0x3f')]=qs[_0xce0d('0x3f')](_0x13fd05[_0xce0d('0x36')]['limit']);_0x121097[_0xce0d('0x2b')]=qs[_0xce0d('0x2b')](_0x13fd05[_0xce0d('0x36')][_0xce0d('0x2b')]);}_0x121097[_0xce0d('0x40')]=qs[_0xce0d('0x41')](_0x13fd05[_0xce0d('0x36')][_0xce0d('0x41')]);_0x121097['where']=qs[_0xce0d('0x38')](_['pick'](_0x13fd05[_0xce0d('0x36')],_0x3c3352[_0xce0d('0x38')]));if(_0x13fd05[_0xce0d('0x36')][_0xce0d('0x42')]){_0x121097[_0xce0d('0x43')]=_['merge'](_0x121097[_0xce0d('0x43')],{'$or':_[_0xce0d('0x44')](_0xb580d8,function(_0x5457d8){if(_0x5457d8[_0xce0d('0x45')]['key']!==_0xce0d('0x46')){var _0x2e7346={};_0x2e7346[_0x5457d8[_0xce0d('0x47')]]={'$like':'%'+_0x13fd05['query'][_0xce0d('0x42')]+'%'};return _0x2e7346;}})});}_0x121097=_[_0xce0d('0x48')]({},_0x121097,_0x13fd05['options']);var _0x4e5a85={'where':_0x121097[_0xce0d('0x43')]};return db[_0xce0d('0x33')][_0xce0d('0x2a')](_0x4e5a85)[_0xce0d('0x1d')](function(_0x4779b4){_0x2dbd8e['count']=_0x4779b4;if(_0x13fd05['query']['includeAll']){_0x121097[_0xce0d('0x49')]=[{'all':!![]}];}return db[_0xce0d('0x33')][_0xce0d('0x4a')](_0x121097);})[_0xce0d('0x1d')](function(_0x11ff8e){_0x2dbd8e[_0xce0d('0x4b')]=_0x11ff8e;return _0x2dbd8e;})[_0xce0d('0x1d')](respondWithFilteredResult(_0x21a901,_0x121097))['catch'](handleError(_0x21a901,null));};exports['show']=function(_0x91132f,_0x2e0a1e){var _0x2dbe17={'raw':![],'where':{'id':_0x91132f[_0xce0d('0x4c')]['id']}},_0x29d02c={};_0x29d02c[_0xce0d('0x35')]=_[_0xce0d('0x37')](db['Setting'][_0xce0d('0x34')]);_0x29d02c['query']=_['keys'](_0x91132f[_0xce0d('0x36')]);_0x29d02c[_0xce0d('0x38')]=_[_0xce0d('0x39')](_0x29d02c['model'],_0x29d02c[_0xce0d('0x36')]);_0x2dbe17[_0xce0d('0x3a')]=_['intersection'](_0x29d02c[_0xce0d('0x35')],qs[_0xce0d('0x3b')](_0x91132f[_0xce0d('0x36')][_0xce0d('0x3b')]));_0x2dbe17[_0xce0d('0x3a')]=_0x2dbe17[_0xce0d('0x3a')][_0xce0d('0x3c')]?_0x2dbe17[_0xce0d('0x3a')]:_0x29d02c[_0xce0d('0x35')];if(_0x91132f['query'][_0xce0d('0x4d')]){_0x2dbe17[_0xce0d('0x49')]=[{'all':!![]}];}_0x2dbe17=_[_0xce0d('0x48')]({},_0x2dbe17,_0x91132f[_0xce0d('0x4e')]);return db['Setting'][_0xce0d('0x4f')](_0x2dbe17)[_0xce0d('0x1d')](handleEntityNotFound(_0x2e0a1e,null))['then'](respondWithResult(_0x2e0a1e,null))[_0xce0d('0x27')](handleError(_0x2e0a1e,null));};exports['update']=function(_0x15a49b,_0x5dbdd7,_0x5a2653){var _0x37c636;return db[_0xce0d('0x33')][_0xce0d('0x4f')]({'where':{'id':_0x15a49b[_0xce0d('0x4c')]['id']}})[_0xce0d('0x1d')](handleEntityNotFound(_0x5dbdd7,null))[_0xce0d('0x1d')](saveUpdates(_0x15a49b[_0xce0d('0x50')],null))[_0xce0d('0x1d')](function(_0x18fb01){if(_0x18fb01){_0x37c636=_0x18fb01[_0xce0d('0x51')]({'plain':!![]});var _0x489933=fs['readFileSync'](path[_0xce0d('0x52')](config[_0xce0d('0x53')],_0xce0d('0x54')),_0xce0d('0x55'));var _0x450ef6=ejs[_0xce0d('0x56')](_0x489933,_0x37c636);var _0x468bdb=fs[_0xce0d('0x57')](path['join'](config[_0xce0d('0x53')],_0xce0d('0x58')),_0xce0d('0x55'));var _0x8422d9=ejs[_0xce0d('0x56')](_0x468bdb,_0x37c636);fs[_0xce0d('0x59')]('/etc/asterisk/stun_xcally.conf',_0x450ef6);fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x8422d9);return respondWithRpcPromise('Reload',_0xce0d('0x5a'),{'module':'res_stun_monitor.so'});}})[_0xce0d('0x1d')](function(){return respondWithRpcPromise(_0xce0d('0x5b'),_0xce0d('0x5a'),{'module':'res_rtp_asterisk.so'});})['then'](function(){return _0x37c636||null;})[_0xce0d('0x1d')](respondWithResult(_0x5dbdd7,null))[_0xce0d('0x27')](handleError(_0x5dbdd7,null));};exports[_0xce0d('0x5c')]=function(_0x4e8fbe,_0x1c9702,_0x4de7e3){if(_0x4e8fbe[_0xce0d('0x5d')]&&_0x4e8fbe['file'][_0xce0d('0x5e')]){_0x4e8fbe[_0xce0d('0x50')][_0xce0d('0x5f')]=_0x4e8fbe[_0xce0d('0x5d')]['filename'];}return db[_0xce0d('0x33')][_0xce0d('0x4f')]({'where':{'id':_0x4e8fbe[_0xce0d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1c9702,null))[_0xce0d('0x1d')](saveUpdates(_0x4e8fbe[_0xce0d('0x50')],null))[_0xce0d('0x1d')](respondWithResult(_0x1c9702,null))[_0xce0d('0x27')](handleError(_0x1c9702,null));};exports['addLogoLogin']=function(_0x5ef88a,_0x5d09e0,_0x76d67a){if(_0x5ef88a[_0xce0d('0x5d')]&&_0x5ef88a[_0xce0d('0x5d')]['filename']){_0x5ef88a[_0xce0d('0x50')][_0xce0d('0x60')]=_0x5ef88a['file'][_0xce0d('0x5e')];}return db[_0xce0d('0x33')][_0xce0d('0x4f')]({'where':{'id':_0x5ef88a[_0xce0d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5d09e0,null))[_0xce0d('0x1d')](saveUpdates(_0x5ef88a['body'],null))['then'](respondWithResult(_0x5d09e0,null))[_0xce0d('0x27')](handleError(_0x5d09e0,null));};var utilLicense=require(_0xce0d('0x61'));exports[_0xce0d('0x62')]=function(_0x3b6624,_0x4925dc,_0x1f24d){var _0x1d0161=_0xce0d('0x63');var _0x3064fb={'custom':![]};return utilLicense[_0xce0d('0x64')]()['then'](function(_0x3fcb29){if(_0x3fcb29){_0x3064fb=_0x3fcb29;}return db['Setting'][_0xce0d('0x4f')]({'where':{'id':_0x3b6624['params']['id']},'attributes':[_0xce0d('0x5f'),_0xce0d('0x60'),_0xce0d('0x65'),_0xce0d('0x66'),'defaultLoginLogo',_0xce0d('0x67')],'raw':!![]});})[_0xce0d('0x1d')](handleEntityNotFound(_0x4925dc,null))[_0xce0d('0x1d')](function(_0x1646cc){if(_0x1646cc){var _0x1b4ffe=_0x1646cc[_0xce0d('0x5f')]&&fs[_0xce0d('0x68')](path['join'](config['root'],_0x1d0161,_['toLower'](_0x1646cc['logo'])))?path[_0xce0d('0x52')](config[_0xce0d('0x53')],_0x1d0161,_[_0xce0d('0x69')](_0x1646cc[_0xce0d('0x5f')])):path[_0xce0d('0x52')](config[_0xce0d('0x53')],_0x1d0161,_['toLower'](_0xce0d('0x6a')));var _0x47307d=_0xce0d('0x6b')+_[_0xce0d('0x6c')](_0xce0d('0x5f'));if(_0x1646cc[_0x47307d]||!_0x3064fb['custom']){_0x1b4ffe=path[_0xce0d('0x52')](config[_0xce0d('0x53')],_0x1d0161,_[_0xce0d('0x69')](_0xce0d('0x6a')));}if(!fs[_0xce0d('0x68')](_0x1b4ffe)){throw new db[(_0xce0d('0x6d'))]['ValidationError'](_0xce0d('0x6e'));}return _0x4925dc[_0xce0d('0x6f')](_0x1b4ffe);}})['catch'](handleError(_0x4925dc,null));};var utilLicense=require('../../config/license/util');exports[_0xce0d('0x70')]=function(_0x507f74,_0x1df5c8,_0x533004){var _0x43135c=_0xce0d('0x63');var _0x5906e7={'custom':![]};return utilLicense[_0xce0d('0x64')]()['then'](function(_0x26ffe2){if(_0x26ffe2){_0x5906e7=_0x26ffe2;}return db['Setting'][_0xce0d('0x4f')]({'where':{'id':_0x507f74[_0xce0d('0x4c')]['id']},'attributes':['logo',_0xce0d('0x60'),_0xce0d('0x65'),_0xce0d('0x66'),'defaultLoginLogo',_0xce0d('0x67')],'raw':!![]});})[_0xce0d('0x1d')](handleEntityNotFound(_0x1df5c8,null))[_0xce0d('0x1d')](function(_0x42fe3b){if(_0x42fe3b){var _0xc4278=_0x42fe3b[_0xce0d('0x60')]&&fs[_0xce0d('0x68')](path[_0xce0d('0x52')](config[_0xce0d('0x53')],_0x43135c,_[_0xce0d('0x69')](_0x42fe3b[_0xce0d('0x60')])))?path[_0xce0d('0x52')](config[_0xce0d('0x53')],_0x43135c,_[_0xce0d('0x69')](_0x42fe3b[_0xce0d('0x60')])):path[_0xce0d('0x52')](config[_0xce0d('0x53')],_0x43135c,_[_0xce0d('0x69')]('default_loginLogo.png'));var _0x380375=_0xce0d('0x6b')+_[_0xce0d('0x6c')](_0xce0d('0x60'));if(_0x42fe3b[_0x380375]||!_0x5906e7[_0xce0d('0x71')]){_0xc4278=path[_0xce0d('0x52')](config[_0xce0d('0x53')],_0x43135c,_['toLower'](_0xce0d('0x72')));}if(!fs[_0xce0d('0x68')](_0xc4278)){throw new db[(_0xce0d('0x6d'))]['ValidationError'](_0xce0d('0x6e'));}return _0x1df5c8[_0xce0d('0x6f')](_0xc4278);}})[_0xce0d('0x27')](handleError(_0x1df5c8,null));};exports[_0xce0d('0x73')]=function(_0x100a3c,_0x2d954b){return db[_0xce0d('0x33')][_0xce0d('0x4f')]({'where':{'id':_0x100a3c[_0xce0d('0x4c')]['id']},'attributes':[_0xce0d('0x74')]})[_0xce0d('0x1d')](respondWithResult(_0x2d954b,null))[_0xce0d('0x27')](handleError(_0x2d954b,null));};exports[_0xce0d('0x75')]=function(_0x3a7e5c,_0x368274,_0x23197){if(_0x3a7e5c[_0xce0d('0x5d')]&&_0x3a7e5c[_0xce0d('0x5d')][_0xce0d('0x5e')]){_0x3a7e5c[_0xce0d('0x50')][_0xce0d('0x65')]=_0x3a7e5c[_0xce0d('0x5d')][_0xce0d('0x5e')];}return db[_0xce0d('0x33')][_0xce0d('0x4f')]({'where':{'id':_0x3a7e5c['params']['id']}})[_0xce0d('0x1d')](handleEntityNotFound(_0x368274,null))[_0xce0d('0x1d')](saveUpdates(_0x3a7e5c['body'],null))[_0xce0d('0x1d')](respondWithResult(_0x368274,null))['catch'](handleError(_0x368274,null));};var utilLicense=require(_0xce0d('0x61'));exports['getPreferred']=function(_0x1e1807,_0x199403,_0x53e315){var _0x505068=_0xce0d('0x63');var _0x501c76={'custom':![]};return utilLicense[_0xce0d('0x64')]()['then'](function(_0x3e5471){if(_0x3e5471){_0x501c76=_0x3e5471;}return db['Setting'][_0xce0d('0x4f')]({'where':{'id':_0x1e1807['params']['id']},'attributes':[_0xce0d('0x5f'),_0xce0d('0x60'),_0xce0d('0x65'),_0xce0d('0x66'),_0xce0d('0x76'),_0xce0d('0x67')],'raw':!![]});})['then'](handleEntityNotFound(_0x199403,null))[_0xce0d('0x1d')](function(_0x55ea8d){if(_0x55ea8d){var _0xbd36af=_0x55ea8d['preferred']&&fs['existsSync'](path[_0xce0d('0x52')](config[_0xce0d('0x53')],_0x505068,_[_0xce0d('0x69')](_0x55ea8d[_0xce0d('0x65')])))?path[_0xce0d('0x52')](config[_0xce0d('0x53')],_0x505068,_['toLower'](_0x55ea8d[_0xce0d('0x65')])):path[_0xce0d('0x52')](config[_0xce0d('0x53')],_0x505068,_[_0xce0d('0x69')](_0xce0d('0x77')));var _0xd409d3=_0xce0d('0x6b')+_[_0xce0d('0x6c')](_0xce0d('0x65'));if(_0x55ea8d[_0xd409d3]||!_0x501c76[_0xce0d('0x71')]||!_0x501c76['preferred']){_0xbd36af=path[_0xce0d('0x52')](config[_0xce0d('0x53')],_0x505068,_['toLower'](_0xce0d('0x77')));}if(!fs[_0xce0d('0x68')](_0xbd36af)){throw new db[(_0xce0d('0x6d'))][(_0xce0d('0x78'))](_0xce0d('0x6e'));}return _0x199403[_0xce0d('0x6f')](_0xbd36af);}})[_0xce0d('0x27')](handleError(_0x199403,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index e6a28a9..3656d4b 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 _0x4de0=['settings','lodash','api','moment','request-promise','exports','define'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x4de0,0x1e4));var _0x04de=function(_0x2cd6ac,_0x21a852){_0x2cd6ac=_0x2cd6ac-0x0;var _0x25f516=_0x4de0[_0x2cd6ac];return _0x25f516;};'use strict';var _=require(_0x04de('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x04de('0x1'));var moment=require(_0x04de('0x2'));var BPromise=require('bluebird');var rp=require(_0x04de('0x3'));var attributes=require('./setting.attributes');module[_0x04de('0x4')]=function(_0x585e7b,_0x10a577){return _0x585e7b[_0x04de('0x5')]('Setting',attributes,{'tableName':_0x04de('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f38=['settings','lodash','util','../../config/logger','moment','bluebird','request-promise','./setting.attributes','exports','define'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9f38,0xe7));var _0x89f3=function(_0x32afad,_0x120d5e){_0x32afad=_0x32afad-0x0;var _0x36f113=_0x9f38[_0x32afad];return _0x36f113;};'use strict';var _=require(_0x89f3('0x0'));var util=require(_0x89f3('0x1'));var logger=require(_0x89f3('0x2'))('api');var moment=require(_0x89f3('0x3'));var BPromise=require(_0x89f3('0x4'));var rp=require(_0x89f3('0x5'));var attributes=require(_0x89f3('0x6'));module[_0x89f3('0x7')]=function(_0x31135b,_0x232ccc){return _0x31135b[_0x89f3('0x8')]('Setting',attributes,{'tableName':_0x89f3('0x9'),'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 fb38524..0485cbc 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 _0x6b93=['stringify','error','code','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0x6b93,0x146));var _0x36b9=function(_0x15b270,_0x226a5b){_0x15b270=_0x15b270-0x0;var _0x410017=_0x6b93[_0x15b270];return _0x410017;};'use strict';var _=require(_0x36b9('0x0'));var util=require(_0x36b9('0x1'));var moment=require(_0x36b9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x36b9('0x3'))['db'];var utils=require(_0x36b9('0x4'));var logger=require(_0x36b9('0x5'))('rpc');var config=require(_0x36b9('0x6'));var jayson=require(_0x36b9('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x115717,_0xfc8164,_0x324883){return new BPromise(function(_0x28d632,_0x1f88e3){return client['request'](_0x115717,_0x324883)[_0x36b9('0x8')](function(_0x504a23){logger[_0x36b9('0x9')](_0x36b9('0xa'),_0xfc8164,_0x36b9('0xb'));logger[_0x36b9('0xc')](_0x36b9('0xd'),_0xfc8164,_0x36b9('0xb'),JSON[_0x36b9('0xe')](_0x504a23));if(_0x504a23[_0x36b9('0xf')]){if(_0x504a23['error'][_0x36b9('0x10')]===0x1f4){logger[_0x36b9('0xf')](_0x36b9('0xa'),_0xfc8164,_0x504a23[_0x36b9('0xf')][_0x36b9('0x11')]);return _0x1f88e3(_0x504a23[_0x36b9('0xf')][_0x36b9('0x11')]);}logger['error'](_0x36b9('0xa'),_0xfc8164,_0x504a23['error'][_0x36b9('0x11')]);return _0x28d632(_0x504a23[_0x36b9('0xf')][_0x36b9('0x11')]);}else{logger['info'](_0x36b9('0xa'),_0xfc8164,_0x36b9('0xb'));_0x28d632(_0x504a23[_0x36b9('0x12')][_0x36b9('0x11')]);}})[_0x36b9('0x13')](function(_0x5e7b8e){logger['error'](_0x36b9('0xa'),_0xfc8164,_0x5e7b8e);_0x1f88e3(_0x5e7b8e);});});} \ No newline at end of file +var _0x096a=['error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x538406,_0x25c40b){var _0x18f8fd=function(_0x52ff7f){while(--_0x52ff7f){_0x538406['push'](_0x538406['shift']());}};_0x18f8fd(++_0x25c40b);}(_0x096a,0x1cc));var _0xa096=function(_0x1bfedd,_0x1e378d){_0x1bfedd=_0x1bfedd-0x0;var _0x321174=_0x096a[_0x1bfedd];return _0x321174;};'use strict';var _=require(_0xa096('0x0'));var util=require(_0xa096('0x1'));var moment=require(_0xa096('0x2'));var BPromise=require(_0xa096('0x3'));var rs=require(_0xa096('0x4'));var fs=require('fs');var Redis=require(_0xa096('0x5'));var db=require(_0xa096('0x6'))['db'];var utils=require(_0xa096('0x7'));var logger=require('../../config/logger')(_0xa096('0x8'));var config=require(_0xa096('0x9'));var jayson=require(_0xa096('0xa'));var client=jayson['client'][_0xa096('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x337c5c,_0x46738d,_0x116fc7){return new BPromise(function(_0x2a6db3,_0x2d23a7){return client[_0xa096('0xc')](_0x337c5c,_0x116fc7)[_0xa096('0xd')](function(_0x4cb5f7){logger[_0xa096('0xe')](_0xa096('0xf'),_0x46738d,_0xa096('0x10'));logger[_0xa096('0x11')]('Setting,\x20%s,\x20%s,\x20%s',_0x46738d,'request\x20sent',JSON[_0xa096('0x12')](_0x4cb5f7));if(_0x4cb5f7['error']){if(_0x4cb5f7['error'][_0xa096('0x13')]===0x1f4){logger[_0xa096('0x14')](_0xa096('0xf'),_0x46738d,_0x4cb5f7[_0xa096('0x14')][_0xa096('0x15')]);return _0x2d23a7(_0x4cb5f7[_0xa096('0x14')]['message']);}logger[_0xa096('0x14')](_0xa096('0xf'),_0x46738d,_0x4cb5f7['error'][_0xa096('0x15')]);return _0x2a6db3(_0x4cb5f7[_0xa096('0x14')]['message']);}else{logger['info'](_0xa096('0xf'),_0x46738d,_0xa096('0x10'));_0x2a6db3(_0x4cb5f7[_0xa096('0x16')][_0xa096('0x15')]);}})[_0xa096('0x17')](function(_0x27df91){logger[_0xa096('0x14')](_0xa096('0xf'),_0x46738d,_0x27df91);_0x2d23a7(_0x27df91);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 50c8498..f780e3d 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 _0x2369=['../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/status','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','addAgents','put','update','delete','destroy','removeAnswers','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x287eaf,_0x41d318){var _0x321683=function(_0x4bda72){while(--_0x4bda72){_0x287eaf['push'](_0x287eaf['shift']());}};_0x321683(++_0x41d318);}(_0x2369,0x16a));var _0x9236=function(_0x44fe92,_0x510b3a){_0x44fe92=_0x44fe92-0x0;var _0x554f77=_0x2369[_0x44fe92];return _0x554f77;};'use strict';var multer=require(_0x9236('0x0'));var util=require(_0x9236('0x1'));var path=require(_0x9236('0x2'));var timeout=require(_0x9236('0x3'));var express=require(_0x9236('0x4'));var router=express['Router']();var auth=require(_0x9236('0x5'));var interaction=require(_0x9236('0x6'));var config=require(_0x9236('0x7'));var controller=require(_0x9236('0x8'));router[_0x9236('0x9')]('/',auth['isAuthenticated'](),controller[_0x9236('0xa')]);router[_0x9236('0x9')](_0x9236('0xb'),auth[_0x9236('0xc')](),controller[_0x9236('0xd')]);router[_0x9236('0x9')](_0x9236('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x9236('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x9236('0xf')]);router['get'](_0x9236('0x10'),auth[_0x9236('0xc')](),controller[_0x9236('0x11')]);router['get'](_0x9236('0x12'),auth[_0x9236('0xc')](),controller[_0x9236('0x13')]);router[_0x9236('0x9')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x9236('0x14')]);router[_0x9236('0x9')](_0x9236('0x15'),controller['statusGet']);router[_0x9236('0x9')]('/:id/users',auth[_0x9236('0xc')](),controller[_0x9236('0x16')]);router[_0x9236('0x17')]('/',auth[_0x9236('0xc')](),controller[_0x9236('0x18')]);router[_0x9236('0x17')](_0x9236('0x19'),auth['isAuthenticated'](),controller[_0x9236('0x1a')]);router[_0x9236('0x17')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x9236('0x1b')]);router['post'](_0x9236('0x1c'),controller[_0x9236('0x1d')]);router[_0x9236('0x17')](_0x9236('0x12'),auth[_0x9236('0xc')](),controller[_0x9236('0x1e')]);router[_0x9236('0x17')](_0x9236('0x1f'),auth[_0x9236('0xc')](),controller['send']);router[_0x9236('0x17')](_0x9236('0x15'),controller['status']);router[_0x9236('0x17')]('/:id/users',auth[_0x9236('0xc')](),controller[_0x9236('0x20')]);router[_0x9236('0x21')]('/:id',auth[_0x9236('0xc')](),controller[_0x9236('0x22')]);router[_0x9236('0x23')](_0x9236('0xe'),auth[_0x9236('0xc')](),controller[_0x9236('0x24')]);router['delete'](_0x9236('0x19'),auth[_0x9236('0xc')](),controller['removeDispositions']);router[_0x9236('0x23')](_0x9236('0x10'),auth[_0x9236('0xc')](),controller[_0x9236('0x25')]);router[_0x9236('0x23')](_0x9236('0x26'),auth[_0x9236('0xc')](),controller[_0x9236('0x27')]);module[_0x9236('0x28')]=router; \ No newline at end of file +var _0x6b5a=['getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','/:id/status','status','addAgents','put','delete','destroy','removeAnswers','removeAgents','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications'];(function(_0xc10b55,_0x45b949){var _0x51c773=function(_0xc5bfa1){while(--_0xc5bfa1){_0xc10b55['push'](_0xc10b55['shift']());}};_0x51c773(++_0x45b949);}(_0x6b5a,0xd2));var _0xa6b5=function(_0x5cd5c9,_0x3d2e0b){_0x5cd5c9=_0x5cd5c9-0x0;var _0x40dcf4=_0x6b5a[_0x5cd5c9];return _0x40dcf4;};'use strict';var multer=require('multer');var util=require(_0xa6b5('0x0'));var path=require(_0xa6b5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa6b5('0x2')]();var auth=require(_0xa6b5('0x3'));var interaction=require(_0xa6b5('0x4'));var config=require(_0xa6b5('0x5'));var controller=require('./smsAccount.controller');router[_0xa6b5('0x6')]('/',auth[_0xa6b5('0x7')](),controller[_0xa6b5('0x8')]);router['get'](_0xa6b5('0x9'),auth[_0xa6b5('0x7')](),controller[_0xa6b5('0xa')]);router[_0xa6b5('0x6')](_0xa6b5('0xb'),auth[_0xa6b5('0x7')](),controller[_0xa6b5('0xc')]);router[_0xa6b5('0x6')](_0xa6b5('0xd'),auth[_0xa6b5('0x7')](),controller[_0xa6b5('0xe')]);router['get'](_0xa6b5('0xf'),auth[_0xa6b5('0x7')](),controller['getAnswers']);router[_0xa6b5('0x6')](_0xa6b5('0x10'),auth[_0xa6b5('0x7')](),controller[_0xa6b5('0x11')]);router[_0xa6b5('0x6')]('/:id/interactions',auth[_0xa6b5('0x7')](),controller[_0xa6b5('0x12')]);router['get']('/:id/status',controller['statusGet']);router[_0xa6b5('0x6')](_0xa6b5('0x13'),auth[_0xa6b5('0x7')](),controller[_0xa6b5('0x14')]);router[_0xa6b5('0x15')]('/',auth[_0xa6b5('0x7')](),controller[_0xa6b5('0x16')]);router[_0xa6b5('0x15')](_0xa6b5('0xd'),auth['isAuthenticated'](),controller[_0xa6b5('0x17')]);router[_0xa6b5('0x15')](_0xa6b5('0xf'),auth[_0xa6b5('0x7')](),controller[_0xa6b5('0x18')]);router[_0xa6b5('0x15')](_0xa6b5('0x19'),controller[_0xa6b5('0x1a')]);router[_0xa6b5('0x15')](_0xa6b5('0x10'),auth[_0xa6b5('0x7')](),controller[_0xa6b5('0x1b')]);router[_0xa6b5('0x15')](_0xa6b5('0x1c'),auth[_0xa6b5('0x7')](),controller['send']);router[_0xa6b5('0x15')](_0xa6b5('0x1d'),controller[_0xa6b5('0x1e')]);router['post']('/:id/users',auth[_0xa6b5('0x7')](),controller[_0xa6b5('0x1f')]);router[_0xa6b5('0x20')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xa6b5('0x21')]('/:id',auth['isAuthenticated'](),controller[_0xa6b5('0x22')]);router['delete'](_0xa6b5('0xd'),auth[_0xa6b5('0x7')](),controller['removeDispositions']);router['delete'](_0xa6b5('0xf'),auth[_0xa6b5('0x7')](),controller[_0xa6b5('0x23')]);router['delete'](_0xa6b5('0x13'),auth[_0xa6b5('0x7')](),controller[_0xa6b5('0x24')]);module[_0xa6b5('0x25')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 046a0df..74a5776 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 _0xa3db=['name','STRING','ENUM','twilio','skebby','connectel','clicksend','plivo','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports'];(function(_0x27601f,_0x1f660e){var _0x2d560a=function(_0xb55dbe){while(--_0xb55dbe){_0x27601f['push'](_0x27601f['shift']());}};_0x2d560a(++_0x1f660e);}(_0xa3db,0xbc));var _0xba3d=function(_0x11847c,_0x2e006d){_0x11847c=_0x11847c-0x0;var _0xff7277=_0xa3db[_0x11847c];return _0xff7277;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xba3d('0x0'));module[_0xba3d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xba3d('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xba3d('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xba3d('0x3')]},'type':{'type':Sequelize[_0xba3d('0x4')](_0xba3d('0x5'),_0xba3d('0x6'),_0xba3d('0x7'),_0xba3d('0x8'),_0xba3d('0x9'),'clickatell','csc',_0xba3d('0xa'),'intelepeer')},'accountSid':{'type':Sequelize[_0xba3d('0x3')]},'authId':{'type':Sequelize[_0xba3d('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xba3d('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xba3d('0x3')]},'password':{'type':Sequelize[_0xba3d('0x3')]},'apiKey':{'type':Sequelize[_0xba3d('0x3')]},'senderString':{'type':Sequelize[_0xba3d('0x3')]},'deliveryReport':{'type':Sequelize[_0xba3d('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0xba3d('0x3')]},'notificationTemplate':{'type':Sequelize[_0xba3d('0xc')],'defaultValue':function(){return _0xba3d('0xd');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xba3d('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xba3d('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xba3d('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xba3d('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xba3d('0xe')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xba3d('0xb')],'defaultValue':![],'comment':_0xba3d('0xf'),'set':function(_0x1e3772){if(!_0x1e3772)this[_0xba3d('0x10')](_0xba3d('0x11'),null);this[_0xba3d('0x10')](_0xba3d('0x12'),_0x1e3772);}}}; \ No newline at end of file +var _0xebee=['ENUM','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','skebby','connectel','clicksend','plivo','clickatell','infobip','intelepeer'];(function(_0x27dda8,_0x5c55dd){var _0x383df2=function(_0x55cc87){while(--_0x55cc87){_0x27dda8['push'](_0x27dda8['shift']());}};_0x383df2(++_0x5c55dd);}(_0xebee,0x15d));var _0xeebe=function(_0x1f258b,_0x3b2766){_0x1f258b=_0x1f258b-0x0;var _0x4cc3a9=_0xebee[_0x1f258b];return _0x4cc3a9;};'use strict';var Sequelize=require(_0xeebe('0x0'));var rs=require(_0xeebe('0x1'));module[_0xeebe('0x2')]={'name':{'type':Sequelize[_0xeebe('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xeebe('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xeebe('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xeebe('0x3')],'defaultValue':function(){return rs[_0xeebe('0x4')]();}},'phone':{'type':Sequelize[_0xeebe('0x3')]},'type':{'type':Sequelize['ENUM']('twilio',_0xeebe('0x5'),_0xeebe('0x6'),_0xeebe('0x7'),_0xeebe('0x8'),_0xeebe('0x9'),'csc',_0xeebe('0xa'),_0xeebe('0xb'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xeebe('0x3')]},'authToken':{'type':Sequelize[_0xeebe('0x3')]},'smsMethod':{'type':Sequelize[_0xeebe('0xc')]('SI','TI','GP')},'username':{'type':Sequelize[_0xeebe('0x3')]},'password':{'type':Sequelize[_0xeebe('0x3')]},'apiKey':{'type':Sequelize[_0xeebe('0x3')]},'senderString':{'type':Sequelize[_0xeebe('0x3')]},'deliveryReport':{'type':Sequelize[_0xeebe('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0xeebe('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xeebe('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xeebe('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xeebe('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xeebe('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xeebe('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xeebe('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xeebe('0xe')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xeebe('0xd')],'defaultValue':![],'comment':_0xeebe('0xf'),'set':function(_0x45a03d){if(!_0x45a03d)this[_0xeebe('0x10')](_0xeebe('0x11'),null);this[_0xeebe('0x10')](_0xeebe('0x12'),_0x45a03d);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index da36ccb..cce2a8a 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 _0x6b68=['rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsAccount.socket','jayson/promise','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','SmsAccounts','UserProfileResource','stack','send','index','SmsAccount','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','map','type','VIRTUAL','field','merge','options','includeAll','include','findAll','rows','show','Pause','mandatoryDispositionPause','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','hasOwnProperty','ids','addAnswer','getAnswers','findOne','order','CannedAnswer','removeAnswers','notify','SmsApplication','Applications','account','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','Body','messageId','MessageSid','sender','clicksend','message_id','Text','MessageUUID','infobip','results','text','csc','segmentedMessage','clickatell','fromNumber','refid','from\x20is\x20mandatory','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','omit','Contacts','contact','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','priority','getApplications','SmsInteraction','Contact','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','List','out','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','DELIVERED','intelepeer','redif','error_code','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format'];(function(_0xfbe746,_0x587da9){var _0x3ef55b=function(_0x35e491){while(--_0x35e491){_0xfbe746['push'](_0xfbe746['shift']());}};_0x3ef55b(++_0x587da9);}(_0x6b68,0x1be));var _0x86b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b68[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x86b6('0x0'));var emlformat=require(_0x86b6('0x1'));var rimraf=require(_0x86b6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x86b6('0x3'));var rp=require('request-promise');var moment=require(_0x86b6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x86b6('0x5'));var util=require(_0x86b6('0x6'));var path=require('path');var sox=require(_0x86b6('0x7'));var csv=require(_0x86b6('0x8'));var ejs=require(_0x86b6('0x9'));var fs=require('fs');var _=require(_0x86b6('0xa'));var squel=require('squel');var crypto=require(_0x86b6('0xb'));var jsforce=require(_0x86b6('0xc'));var deskjs=require(_0x86b6('0xd'));var toCsv=require(_0x86b6('0x8'));var querystring=require(_0x86b6('0xe'));var Papa=require(_0x86b6('0xf'));var authService=require(_0x86b6('0x10'));var hardwareService=require(_0x86b6('0x11'));var Redis=require(_0x86b6('0x12'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x86b6('0x13'));var utils=require(_0x86b6('0x14'));var config=require(_0x86b6('0x15'));var db=require(_0x86b6('0x16'))['db'];config[_0x86b6('0x17')]=_[_0x86b6('0x18')](config[_0x86b6('0x17')],{'host':_0x86b6('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x86b6('0x17')]));require(_0x86b6('0x1a'))['register'](socket);var jayson=require(_0x86b6('0x1b'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x44f093,_0x117e25,_0x2c9dca,_0x53a7cf){return new BPromise(function(_0x38e12e,_0x47492d){var _0x41b8ef=_0x53a7cf||client;return _0x41b8ef[_0x86b6('0x1c')](_0x44f093,_0x2c9dca)['then'](function(_0x2778){logger[_0x86b6('0x1d')](_0x86b6('0x1e'),_0x117e25,_0x86b6('0x1f'));logger['debug'](_0x86b6('0x20'),_0x117e25,_0x86b6('0x1f'),JSON['stringify'](_0x2778));if(_0x2778[_0x86b6('0x21')]){if(_0x2778[_0x86b6('0x21')][_0x86b6('0x22')]===0x1f4){logger[_0x86b6('0x21')](_0x86b6('0x1e'),_0x117e25,_0x2778[_0x86b6('0x21')]['message']);return _0x47492d(_0x2778['error']['message']);}logger[_0x86b6('0x21')](_0x86b6('0x1e'),_0x117e25,_0x2778['error']['message']);return _0x38e12e(_0x2778[_0x86b6('0x21')][_0x86b6('0x23')]);}else{logger['info'](_0x86b6('0x1e'),_0x117e25,_0x86b6('0x1f'));_0x38e12e(_0x2778[_0x86b6('0x24')][_0x86b6('0x23')]);}})[_0x86b6('0x25')](function(_0x466708){logger[_0x86b6('0x21')](_0x86b6('0x1e'),_0x117e25,_0x466708);_0x47492d(_0x466708);});});}function respondWithStatusCode(_0x655971,_0x5d98e2){_0x5d98e2=_0x5d98e2||0xcc;return function(_0x95390f){if(_0x95390f){return _0x655971[_0x86b6('0x26')](_0x5d98e2);}return _0x655971[_0x86b6('0x27')](_0x5d98e2)[_0x86b6('0x28')]();};}function respondWithResult(_0x45c2fa,_0x2cf2dc){_0x2cf2dc=_0x2cf2dc||0xc8;return function(_0x1ebab6){if(_0x1ebab6){return _0x45c2fa[_0x86b6('0x27')](_0x2cf2dc)[_0x86b6('0x29')](_0x1ebab6);}};}function respondWithFilteredResult(_0x28f77c,_0x2f87d4){return function(_0xc04b62){if(_0xc04b62){var _0x2ecb13=_0xc04b62[_0x86b6('0x2a')],_0x5b13b7=_0x2f87d4[_0x86b6('0x2b')],_0x1e0c36=_0x2f87d4[_0x86b6('0x2b')]+_0x2f87d4[_0x86b6('0x2c')],_0x26b95c;if(_0x1e0c36>=_0x2ecb13){_0x1e0c36=_0x2ecb13;_0x26b95c=0xc8;}else{_0x26b95c=0xce;}_0x28f77c['status'](_0x26b95c);return _0x28f77c[_0x86b6('0x2d')](_0x86b6('0x2e'),_0x5b13b7+'-'+_0x1e0c36+'/'+_0x2ecb13)['json'](_0xc04b62);}return null;};}function patchUpdates(_0x45f180){return function(_0x2ad811){try{jsonpatch[_0x86b6('0x2f')](_0x2ad811,_0x45f180,!![]);}catch(_0x2ef8e0){return BPromise[_0x86b6('0x30')](_0x2ef8e0);}return _0x2ad811[_0x86b6('0x31')]();};}function saveUpdates(_0x1f7f22,_0x4f528d){return function(_0x11f857){if(_0x11f857){return _0x11f857[_0x86b6('0x32')](_0x1f7f22)[_0x86b6('0x33')](function(_0xc5e8d3){return _0xc5e8d3;});}return null;};}function removeEntity(_0x3b7ab2,_0x29744d){return function(_0x4d478e){if(_0x4d478e){return _0x4d478e[_0x86b6('0x34')]()[_0x86b6('0x33')](function(){var _0x44d97c=_0x4d478e[_0x86b6('0x35')]({'plain':!![]});var _0x494a09=_0x86b6('0x36');return db[_0x86b6('0x37')][_0x86b6('0x34')]({'where':{'type':_0x494a09,'resourceId':_0x44d97c['id']}})['then'](function(){return _0x4d478e;});})[_0x86b6('0x33')](function(){_0x3b7ab2[_0x86b6('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ca269,_0x5df632){return function(_0x5785b7){if(!_0x5785b7){_0x3ca269[_0x86b6('0x26')](0x194);}return _0x5785b7;};}function handleError(_0x3dfb9e,_0x1b179a){_0x1b179a=_0x1b179a||0x1f4;return function(_0x51c53b){logger['error'](_0x51c53b[_0x86b6('0x38')]);if(_0x51c53b['name']){delete _0x51c53b['name'];}_0x3dfb9e[_0x86b6('0x27')](_0x1b179a)[_0x86b6('0x39')](_0x51c53b);};}exports[_0x86b6('0x3a')]=function(_0x5103fb,_0x4a5c22){var _0x5b1c20={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x198872={},_0x339fbf={'count':0x0,'rows':[]};var _0x4d2a79=db[_0x86b6('0x3b')]['rawAttributes'];_0x198872[_0x86b6('0x3c')]=_[_0x86b6('0x3d')](_0x4d2a79);_0x198872[_0x86b6('0x3e')]=_['keys'](_0x5103fb[_0x86b6('0x3e')]);_0x198872[_0x86b6('0x3f')]=_[_0x86b6('0x40')](_0x198872[_0x86b6('0x3c')],_0x198872[_0x86b6('0x3e')]);_0x5b1c20[_0x86b6('0x41')]=_[_0x86b6('0x40')](_0x198872[_0x86b6('0x3c')],qs[_0x86b6('0x42')](_0x5103fb[_0x86b6('0x3e')]['fields']));_0x5b1c20[_0x86b6('0x41')]=_0x5b1c20[_0x86b6('0x41')][_0x86b6('0x43')]?_0x5b1c20[_0x86b6('0x41')]:_0x198872[_0x86b6('0x3c')];if(!_0x5103fb[_0x86b6('0x3e')]['hasOwnProperty'](_0x86b6('0x44'))){_0x5b1c20[_0x86b6('0x2c')]=qs[_0x86b6('0x2c')](_0x5103fb[_0x86b6('0x3e')][_0x86b6('0x2c')]);_0x5b1c20['offset']=qs[_0x86b6('0x2b')](_0x5103fb[_0x86b6('0x3e')][_0x86b6('0x2b')]);}_0x5b1c20['order']=qs[_0x86b6('0x45')](_0x5103fb[_0x86b6('0x3e')][_0x86b6('0x45')]);_0x5b1c20[_0x86b6('0x46')]=qs[_0x86b6('0x3f')](_[_0x86b6('0x47')](_0x5103fb[_0x86b6('0x3e')],_0x198872[_0x86b6('0x3f')]));if(_0x5103fb[_0x86b6('0x3e')][_0x86b6('0x48')]){_0x5b1c20['where']=_['merge'](_0x5b1c20[_0x86b6('0x46')],{'$or':_[_0x86b6('0x49')](_0x4d2a79,function(_0x48a4c8){if(_0x48a4c8[_0x86b6('0x4a')]['key']!==_0x86b6('0x4b')){var _0x3ea5c6={};_0x3ea5c6[_0x48a4c8[_0x86b6('0x4c')]]={'$like':'%'+_0x5103fb[_0x86b6('0x3e')][_0x86b6('0x48')]+'%'};return _0x3ea5c6;}})});}_0x5b1c20=_[_0x86b6('0x4d')]({},_0x5b1c20,_0x5103fb[_0x86b6('0x4e')]);var _0x519dbd={'where':_0x5b1c20[_0x86b6('0x46')]};return db[_0x86b6('0x3b')]['count'](_0x519dbd)[_0x86b6('0x33')](function(_0x485b4f){_0x339fbf['count']=_0x485b4f;if(_0x5103fb[_0x86b6('0x3e')][_0x86b6('0x4f')]){_0x5b1c20[_0x86b6('0x50')]=[{'all':!![]}];}return db[_0x86b6('0x3b')][_0x86b6('0x51')](_0x5b1c20);})['then'](function(_0x18cc57){_0x339fbf[_0x86b6('0x52')]=_0x18cc57;return _0x339fbf;})[_0x86b6('0x33')](respondWithFilteredResult(_0x4a5c22,_0x5b1c20))[_0x86b6('0x25')](handleError(_0x4a5c22,null));};exports[_0x86b6('0x53')]=function(_0x117a2b,_0x34be24){var _0x213e8f={'raw':![],'where':{'id':_0x117a2b['params']['id']},'include':[{'model':db[_0x86b6('0x54')],'as':_0x86b6('0x55')}]},_0x5082df={};_0x5082df[_0x86b6('0x3c')]=_[_0x86b6('0x3d')](db[_0x86b6('0x3b')][_0x86b6('0x56')]);_0x5082df[_0x86b6('0x3e')]=_[_0x86b6('0x3d')](_0x117a2b['query']);_0x5082df[_0x86b6('0x3f')]=_[_0x86b6('0x40')](_0x5082df[_0x86b6('0x3c')],_0x5082df[_0x86b6('0x3e')]);_0x213e8f[_0x86b6('0x41')]=_[_0x86b6('0x40')](_0x5082df[_0x86b6('0x3c')],qs[_0x86b6('0x42')](_0x117a2b[_0x86b6('0x3e')][_0x86b6('0x42')]));_0x213e8f['attributes']=_0x213e8f[_0x86b6('0x41')][_0x86b6('0x43')]?_0x213e8f['attributes']:_0x5082df['model'];if(_0x117a2b[_0x86b6('0x3e')][_0x86b6('0x4f')]){_0x213e8f[_0x86b6('0x50')]=[{'all':!![]}];}_0x213e8f=_[_0x86b6('0x4d')]({},_0x213e8f,_0x117a2b[_0x86b6('0x4e')]);return db[_0x86b6('0x3b')][_0x86b6('0x57')](_0x213e8f)[_0x86b6('0x33')](handleEntityNotFound(_0x34be24,null))['then'](respondWithResult(_0x34be24,null))['catch'](handleError(_0x34be24,null));};exports[_0x86b6('0x58')]=function(_0x426699,_0x3a5b84){return db[_0x86b6('0x3b')][_0x86b6('0x58')](_0x426699[_0x86b6('0x59')],{})[_0x86b6('0x33')](function(_0x4a137c){var _0x3a96e9=_0x426699[_0x86b6('0x5a')][_0x86b6('0x35')]({'plain':!![]});if(!_0x3a96e9)throw new Error(_0x86b6('0x5b'));if(_0x3a96e9[_0x86b6('0x5c')]==='user'){var _0x1b47ac=_0x4a137c[_0x86b6('0x35')]({'plain':!![]});var _0x165ee6=_0x86b6('0x36');return db[_0x86b6('0x5d')][_0x86b6('0x57')]({'where':{'name':_0x165ee6,'userProfileId':_0x3a96e9[_0x86b6('0x5e')]},'raw':!![]})[_0x86b6('0x33')](function(_0x5877a3){if(_0x5877a3&&_0x5877a3[_0x86b6('0x5f')]===0x0){return db[_0x86b6('0x37')][_0x86b6('0x58')]({'name':_0x1b47ac[_0x86b6('0x60')],'resourceId':_0x1b47ac['id'],'type':_0x5877a3[_0x86b6('0x60')],'sectionId':_0x5877a3['id']},{})[_0x86b6('0x33')](function(){return _0x4a137c;});}else{return _0x4a137c;}})[_0x86b6('0x25')](function(_0x4fe850){logger[_0x86b6('0x21')](_0x86b6('0x61'),_0x4fe850);throw _0x4fe850;});}return _0x4a137c;})[_0x86b6('0x33')](respondWithResult(_0x3a5b84,0xc9))[_0x86b6('0x25')](handleError(_0x3a5b84,null));};exports[_0x86b6('0x32')]=function(_0x2ced45,_0x2646eb){if(_0x2ced45[_0x86b6('0x59')]['id']){delete _0x2ced45[_0x86b6('0x59')]['id'];}return db[_0x86b6('0x3b')][_0x86b6('0x57')]({'where':{'id':_0x2ced45[_0x86b6('0x62')]['id']},'include':[{'model':db[_0x86b6('0x54')],'as':_0x86b6('0x55')}]})[_0x86b6('0x33')](handleEntityNotFound(_0x2646eb,null))[_0x86b6('0x33')](saveUpdates(_0x2ced45[_0x86b6('0x59')],null))['then'](respondWithResult(_0x2646eb,null))[_0x86b6('0x25')](handleError(_0x2646eb,null));};exports[_0x86b6('0x34')]=function(_0x5be47c,_0x7c1fd2){return db[_0x86b6('0x3b')]['find']({'where':{'id':_0x5be47c[_0x86b6('0x62')]['id']}})[_0x86b6('0x33')](handleEntityNotFound(_0x7c1fd2,null))[_0x86b6('0x33')](removeEntity(_0x7c1fd2,null))[_0x86b6('0x25')](handleError(_0x7c1fd2,null));};exports[_0x86b6('0x63')]=function(_0x1580ab,_0x4bc9fb){return db[_0x86b6('0x3b')][_0x86b6('0x63')]()['then'](respondWithResult(_0x4bc9fb,null))['catch'](handleError(_0x4bc9fb,null));};exports[_0x86b6('0x64')]=function(_0x5a81de,_0xe8432b,_0x7362c3){if(_0x5a81de[_0x86b6('0x59')]['id']){delete _0x5a81de[_0x86b6('0x59')]['id'];}return db[_0x86b6('0x3b')][_0x86b6('0x57')]({'where':{'id':_0x5a81de[_0x86b6('0x62')]['id']}})[_0x86b6('0x33')](handleEntityNotFound(_0xe8432b,null))[_0x86b6('0x33')](function(_0x34aa07){if(_0x34aa07){_0x5a81de[_0x86b6('0x59')][_0x86b6('0x65')]=_0x34aa07['id'];return db[_0x86b6('0x66')][_0x86b6('0x58')](_0x5a81de['body']);}})[_0x86b6('0x33')](respondWithResult(_0xe8432b,null))['catch'](handleError(_0xe8432b,null));};exports[_0x86b6('0x67')]=function(_0x4c4ac4,_0x881272,_0x252390){var _0x553145={'raw':![],'where':{}};var _0x274e67={};var _0x4bfb4c={'count':0x0,'rows':[]};return db[_0x86b6('0x3b')]['findOne']({'where':{'id':_0x4c4ac4[_0x86b6('0x62')]['id']}})[_0x86b6('0x33')](handleEntityNotFound(_0x881272,null))[_0x86b6('0x33')](function(_0x385b5f){if(_0x385b5f){_0x274e67[_0x86b6('0x3c')]=_['keys'](db['Disposition'][_0x86b6('0x56')]);_0x274e67[_0x86b6('0x3e')]=_[_0x86b6('0x3d')](_0x4c4ac4[_0x86b6('0x3e')]);_0x274e67['filters']=_['intersection'](_0x274e67['model'],_0x274e67['query']);_0x553145[_0x86b6('0x41')]=_[_0x86b6('0x40')](_0x274e67[_0x86b6('0x3c')],qs[_0x86b6('0x42')](_0x4c4ac4[_0x86b6('0x3e')]['fields']));_0x553145[_0x86b6('0x41')]=_0x553145['attributes']['length']?_0x553145[_0x86b6('0x41')]:_0x274e67[_0x86b6('0x3c')];if(!_0x4c4ac4[_0x86b6('0x3e')][_0x86b6('0x68')]('nolimit')){_0x553145[_0x86b6('0x2c')]=qs[_0x86b6('0x2c')](_0x4c4ac4[_0x86b6('0x3e')][_0x86b6('0x2c')]);_0x553145[_0x86b6('0x2b')]=qs[_0x86b6('0x2b')](_0x4c4ac4[_0x86b6('0x3e')][_0x86b6('0x2b')]);}_0x553145['order']=qs[_0x86b6('0x45')](_0x4c4ac4[_0x86b6('0x3e')][_0x86b6('0x45')]);_0x553145[_0x86b6('0x46')]=qs['filters'](_[_0x86b6('0x47')](_0x4c4ac4[_0x86b6('0x3e')],_0x274e67[_0x86b6('0x3f')]));_0x553145[_0x86b6('0x46')]['SmsAccountId']=_0x385b5f['id'];if(_0x4c4ac4[_0x86b6('0x3e')][_0x86b6('0x48')]){_0x553145[_0x86b6('0x46')]=_[_0x86b6('0x4d')](_0x553145[_0x86b6('0x46')],{'$or':_[_0x86b6('0x49')](_0x553145[_0x86b6('0x41')],function(_0x19124b){var _0x4eacb4={};_0x4eacb4[_0x19124b]={'$like':'%'+_0x4c4ac4['query'][_0x86b6('0x48')]+'%'};return _0x4eacb4;})});}_0x553145=_[_0x86b6('0x4d')]({},_0x553145,_0x4c4ac4[_0x86b6('0x4e')]);return db['Disposition'][_0x86b6('0x2a')]({'where':_0x553145[_0x86b6('0x46')]})['then'](function(_0x4c1864){_0x4bfb4c[_0x86b6('0x2a')]=_0x4c1864;if(_0x4c4ac4[_0x86b6('0x3e')][_0x86b6('0x4f')]){_0x553145[_0x86b6('0x50')]=[{'all':!![]}];}return db[_0x86b6('0x66')]['findAll'](_0x553145);})['then'](function(_0x524e39){_0x4bfb4c[_0x86b6('0x52')]=_0x524e39;return _0x4bfb4c;});}})[_0x86b6('0x33')](respondWithFilteredResult(_0x881272,_0x553145))[_0x86b6('0x25')](handleError(_0x881272,null));};exports['removeDispositions']=function(_0x5b6018,_0x345e58,_0x5582ca){var _0x58f46e;return db[_0x86b6('0x3b')][_0x86b6('0x57')]({'where':{'id':_0x5b6018['params']['id']}})['then'](handleEntityNotFound(_0x345e58,null))[_0x86b6('0x33')](function(_0x53af83){if(_0x53af83){return _0x53af83['removeDispositions'](_0x5b6018['query'][_0x86b6('0x69')]);}})[_0x86b6('0x33')](respondWithStatusCode(_0x345e58,null))[_0x86b6('0x25')](handleError(_0x345e58,null));};exports[_0x86b6('0x6a')]=function(_0x29b9cb,_0x19a6e9,_0x20e6bc){if(_0x29b9cb['body']['id']){delete _0x29b9cb[_0x86b6('0x59')]['id'];}return db[_0x86b6('0x3b')][_0x86b6('0x57')]({'where':{'id':_0x29b9cb[_0x86b6('0x62')]['id']}})[_0x86b6('0x33')](handleEntityNotFound(_0x19a6e9,null))['then'](function(_0x4b098b){if(_0x4b098b){_0x29b9cb[_0x86b6('0x59')][_0x86b6('0x65')]=_0x4b098b['id'];return db['CannedAnswer'][_0x86b6('0x58')](_0x29b9cb['body']);}})['then'](respondWithResult(_0x19a6e9,null))[_0x86b6('0x25')](handleError(_0x19a6e9,null));};exports[_0x86b6('0x6b')]=function(_0x4b0644,_0x30d12d,_0x339609){var _0x5aa5ba={'raw':![],'where':{}};var _0x1a81a1={};var _0x26e70a={'count':0x0,'rows':[]};return db[_0x86b6('0x3b')][_0x86b6('0x6c')]({'where':{'id':_0x4b0644[_0x86b6('0x62')]['id']}})['then'](handleEntityNotFound(_0x30d12d,null))[_0x86b6('0x33')](function(_0x1574a2){if(_0x1574a2){_0x1a81a1[_0x86b6('0x3c')]=_[_0x86b6('0x3d')](db['CannedAnswer']['rawAttributes']);_0x1a81a1[_0x86b6('0x3e')]=_[_0x86b6('0x3d')](_0x4b0644[_0x86b6('0x3e')]);_0x1a81a1[_0x86b6('0x3f')]=_['intersection'](_0x1a81a1[_0x86b6('0x3c')],_0x1a81a1[_0x86b6('0x3e')]);_0x5aa5ba[_0x86b6('0x41')]=_[_0x86b6('0x40')](_0x1a81a1['model'],qs['fields'](_0x4b0644[_0x86b6('0x3e')][_0x86b6('0x42')]));_0x5aa5ba[_0x86b6('0x41')]=_0x5aa5ba['attributes'][_0x86b6('0x43')]?_0x5aa5ba[_0x86b6('0x41')]:_0x1a81a1[_0x86b6('0x3c')];if(!_0x4b0644[_0x86b6('0x3e')][_0x86b6('0x68')](_0x86b6('0x44'))){_0x5aa5ba['limit']=qs['limit'](_0x4b0644[_0x86b6('0x3e')][_0x86b6('0x2c')]);_0x5aa5ba[_0x86b6('0x2b')]=qs['offset'](_0x4b0644[_0x86b6('0x3e')][_0x86b6('0x2b')]);}_0x5aa5ba[_0x86b6('0x6d')]=qs['sort'](_0x4b0644[_0x86b6('0x3e')][_0x86b6('0x45')]);_0x5aa5ba[_0x86b6('0x46')]=qs[_0x86b6('0x3f')](_[_0x86b6('0x47')](_0x4b0644[_0x86b6('0x3e')],_0x1a81a1['filters']));_0x5aa5ba[_0x86b6('0x46')][_0x86b6('0x65')]=_0x1574a2['id'];if(_0x4b0644['query'][_0x86b6('0x48')]){_0x5aa5ba[_0x86b6('0x46')]=_[_0x86b6('0x4d')](_0x5aa5ba[_0x86b6('0x46')],{'$or':_[_0x86b6('0x49')](_0x5aa5ba[_0x86b6('0x41')],function(_0x4d4ab1){var _0x1f9702={};_0x1f9702[_0x4d4ab1]={'$like':'%'+_0x4b0644['query'][_0x86b6('0x48')]+'%'};return _0x1f9702;})});}_0x5aa5ba=_[_0x86b6('0x4d')]({},_0x5aa5ba,_0x4b0644[_0x86b6('0x4e')]);return db[_0x86b6('0x6e')][_0x86b6('0x2a')]({'where':_0x5aa5ba[_0x86b6('0x46')]})[_0x86b6('0x33')](function(_0x27c139){_0x26e70a[_0x86b6('0x2a')]=_0x27c139;if(_0x4b0644[_0x86b6('0x3e')][_0x86b6('0x4f')]){_0x5aa5ba['include']=[{'all':!![]}];}return db[_0x86b6('0x6e')][_0x86b6('0x51')](_0x5aa5ba);})[_0x86b6('0x33')](function(_0x54da52){_0x26e70a[_0x86b6('0x52')]=_0x54da52;return _0x26e70a;});}})[_0x86b6('0x33')](respondWithFilteredResult(_0x30d12d,_0x5aa5ba))['catch'](handleError(_0x30d12d,null));};exports[_0x86b6('0x6f')]=function(_0xa4f535,_0x4a2571,_0x1e9b97){var _0x12d25a;return db['SmsAccount'][_0x86b6('0x57')]({'where':{'id':_0xa4f535[_0x86b6('0x62')]['id']}})[_0x86b6('0x33')](handleEntityNotFound(_0x4a2571,null))[_0x86b6('0x33')](function(_0x5dda3b){if(_0x5dda3b){return _0x5dda3b[_0x86b6('0x6f')](_0xa4f535[_0x86b6('0x3e')][_0x86b6('0x69')]);}})['then'](respondWithStatusCode(_0x4a2571,null))['catch'](handleError(_0x4a2571,null));};exports[_0x86b6('0x70')]=function(_0x56f082,_0x627af5,_0x21e20c){var _0x9b8a45={'channel':'sms'};var _0x14f37a=[];var _0x5860b1=[];var _0x15ed16={};return db['SmsAccount'][_0x86b6('0x57')]({'where':{'id':_0x56f082[_0x86b6('0x62')]['id']},'include':[{'model':db[_0x86b6('0x71')],'as':_0x86b6('0x72')}]})[_0x86b6('0x33')](handleEntityNotFound(_0x627af5,null))['then'](function(_0x402209){_0x9b8a45[_0x86b6('0x73')]=_0x402209;_0x9b8a45[_0x86b6('0x74')]=_[_0x86b6('0x75')](_0x402209[_0x86b6('0x72')],['priority'],[_0x86b6('0x76')]);if(_0x9b8a45['account']['Applications']){delete _0x9b8a45[_0x86b6('0x73')][_0x86b6('0x72')];}return db[_0x86b6('0x77')][_0x86b6('0x63')]();})[_0x86b6('0x33')](function(_0x341844){if(!_0x341844){throw new db[(_0x86b6('0x78'))][(_0x86b6('0x79'))](_0x86b6('0x7a'));}_0x14f37a=_['difference'](_['keys'](_0x341844),[_0x86b6('0x7b'),_0x86b6('0x7c')]);_0x5860b1=_['difference'](_[_0x86b6('0x3d')](_0x341844),[_0x86b6('0x7b'),_0x86b6('0x7c'),_0x86b6('0x7d'),_0x86b6('0x7e')]);_0x9b8a45['body']={'mapKey':_0x86b6('0x7f')};if(_0x9b8a45[_0x86b6('0x73')][_0x86b6('0x4a')]){switch(_0x9b8a45[_0x86b6('0x73')][_0x86b6('0x4a')]){case'twilio':_0x9b8a45[_0x86b6('0x59')][_0x86b6('0x80')]=_0x56f082[_0x86b6('0x59')][_0x86b6('0x81')];_0x9b8a45[_0x86b6('0x59')]['body']=_0x56f082[_0x86b6('0x59')][_0x86b6('0x82')];_0x9b8a45[_0x86b6('0x59')][_0x86b6('0x83')]=_0x56f082[_0x86b6('0x59')][_0x86b6('0x84')];break;case'skebby':_0x9b8a45[_0x86b6('0x59')][_0x86b6('0x80')]='+'+_0x56f082[_0x86b6('0x59')][_0x86b6('0x85')];_0x9b8a45['body'][_0x86b6('0x59')]=_0x56f082[_0x86b6('0x59')]['text'];break;case'connectel':_0x9b8a45[_0x86b6('0x59')][_0x86b6('0x80')]=_0x56f082[_0x86b6('0x59')][_0x86b6('0x80')];_0x9b8a45[_0x86b6('0x59')][_0x86b6('0x59')]=_0x56f082[_0x86b6('0x59')]['message'];break;case _0x86b6('0x86'):_0x9b8a45['body']['from']=_0x56f082[_0x86b6('0x59')]['from'];_0x9b8a45[_0x86b6('0x59')][_0x86b6('0x59')]=_0x56f082[_0x86b6('0x59')][_0x86b6('0x59')];_0x9b8a45['body'][_0x86b6('0x83')]=_0x56f082[_0x86b6('0x59')][_0x86b6('0x87')];break;case'plivo':_0x9b8a45[_0x86b6('0x59')][_0x86b6('0x80')]=_0x56f082['body']['From'];_0x9b8a45[_0x86b6('0x59')]['body']=_0x56f082[_0x86b6('0x59')][_0x86b6('0x88')];_0x9b8a45[_0x86b6('0x59')][_0x86b6('0x83')]=_0x56f082[_0x86b6('0x59')][_0x86b6('0x89')];break;case _0x86b6('0x8a'):_0x9b8a45[_0x86b6('0x59')][_0x86b6('0x80')]='+'+_0x56f082[_0x86b6('0x59')]['results'][0x0][_0x86b6('0x80')];_0x9b8a45['body'][_0x86b6('0x59')]=_0x56f082['body'][_0x86b6('0x8b')][0x0][_0x86b6('0x8c')];_0x9b8a45[_0x86b6('0x59')][_0x86b6('0x83')]=_0x56f082['body'][_0x86b6('0x8b')][0x0]['messageId'];break;case _0x86b6('0x8d'):_0x9b8a45['body'][_0x86b6('0x80')]=_0x56f082['body']['originatingAddress'];_0x9b8a45['body']['body']=_0x56f082[_0x86b6('0x59')][_0x86b6('0x8e')][_0x86b6('0x23')];break;case _0x86b6('0x8f'):_0x9b8a45[_0x86b6('0x59')][_0x86b6('0x80')]=_0x56f082[_0x86b6('0x59')][_0x86b6('0x90')];_0x9b8a45[_0x86b6('0x59')][_0x86b6('0x59')]=_0x56f082[_0x86b6('0x59')]['text'];_0x9b8a45[_0x86b6('0x59')][_0x86b6('0x83')]=_0x56f082[_0x86b6('0x59')]['replyMessageId'];break;case'intelepeer':_0x9b8a45[_0x86b6('0x59')][_0x86b6('0x80')]=_0x56f082[_0x86b6('0x59')][_0x86b6('0x80')];_0x9b8a45[_0x86b6('0x59')]['body']=_0x56f082['body'][_0x86b6('0x23')];_0x9b8a45['body'][_0x86b6('0x83')]=_0x56f082[_0x86b6('0x59')][_0x86b6('0x91')];break;}}if(_0x9b8a45[_0x86b6('0x59')]['id']){delete _0x9b8a45['body']['id'];}if(_['isNil'](_0x9b8a45[_0x86b6('0x59')][_0x86b6('0x80')])){throw new db[(_0x86b6('0x78'))]['ValidationError'](_0x86b6('0x92'));}if(_[_0x86b6('0x93')](_0x9b8a45[_0x86b6('0x59')][_0x86b6('0x59')])||_0x9b8a45[_0x86b6('0x59')]['body']===''){throw new db[(_0x86b6('0x78'))][(_0x86b6('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x86b6('0x93')](_0x9b8a45[_0x86b6('0x59')][_0x86b6('0x94')])){throw new db['Sequelize'][(_0x86b6('0x79'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5860b1);}if(!_[_0x86b6('0x95')](_0x5860b1,_0x9b8a45[_0x86b6('0x59')][_0x86b6('0x94')])){throw new db[(_0x86b6('0x78'))]['ValidationError'](_0x86b6('0x96')+_0x5860b1);}_0x15ed16[_0x9b8a45[_0x86b6('0x59')]['mapKey']]=_0x9b8a45[_0x86b6('0x59')][_0x86b6('0x80')];return db[_0x86b6('0x97')][_0x86b6('0x57')]({'where':{'id':_0x9b8a45[_0x86b6('0x73')][_0x86b6('0x7e')]},'include':[{'model':db[_0x86b6('0x77')],'as':'Contacts','where':_0x15ed16,'limit':0x1,'order':[[_0x86b6('0x7c'),'DESC']]}]});})['then'](handleEntityNotFound(_0x627af5,null))['then'](function(_0x201c51){if(_0x201c51){_0x9b8a45['list']=_[_0x86b6('0x98')](_0x201c51,[_0x86b6('0x99')]);if(_0x201c51[_0x86b6('0x99')][_0x86b6('0x43')]){return _0x201c51[_0x86b6('0x99')][0x0];}var _0x62c88=_[_0x86b6('0x18')](_0x9b8a45[_0x86b6('0x59')],{'firstName':_0x9b8a45[_0x86b6('0x59')][_0x86b6('0x80')],'ListId':_0x201c51['id']});_0x62c88[_0x9b8a45['body'][_0x86b6('0x94')]]=_0x9b8a45[_0x86b6('0x59')]['from'];return db[_0x86b6('0x77')][_0x86b6('0x58')](_0x62c88,{'fields':_0x14f37a,'raw':!![]});}})[_0x86b6('0x33')](handleEntityNotFound(_0x627af5,null))[_0x86b6('0x33')](function(_0x538162){if(_0x538162){_0x9b8a45[_0x86b6('0x9a')]=_0x538162;var _0x2e7b00={'ContactId':_0x538162['id'],'phone':_0x9b8a45[_0x86b6('0x59')][_0x86b6('0x80')],'SmsAccountId':_0x56f082[_0x86b6('0x62')]['id']};var _0x128c54={'ContactId':_0x538162['id'],'SmsAccountId':_0x56f082['params']['id'],'closed':![]};return db['SmsInteraction'][_0x86b6('0x57')]({'where':_0x128c54})[_0x86b6('0x33')](function(_0x1625ea){if(_0x1625ea){return[_0x1625ea,![]];}return db['SmsInteraction']['create'](_0x2e7b00)['then'](function(_0x3d38d0){return[_0x3d38d0,!![]];});});}})[_0x86b6('0x9b')](function(_0x12ac42,_0x19b606){_0x9b8a45[_0x86b6('0x9c')]=_0x12ac42[_0x86b6('0x35')]({'plain':!![]});_0x9b8a45[_0x86b6('0x9c')][_0x86b6('0x9d')]=![];if(_0x19b606){if(_0x9b8a45[_0x86b6('0x73')][_0x86b6('0x9e')]){_0x9b8a45[_0x86b6('0x74')][_0x86b6('0x9f')]({'id':0x0,'priority':_0x9b8a45[_0x86b6('0x74')][_0x86b6('0x43')]+0x1,'app':_0x86b6('0xa0'),'appdata':_0x86b6('0xa1'),'interval':_0x86b6('0xa2')});}_0x9b8a45[_0x86b6('0x9c')][_0x86b6('0x9d')]=!![];}return db[_0x86b6('0xa3')]['create']({'phone':_0x9b8a45[_0x86b6('0x59')][_0x86b6('0x80')],'messageId':_0x9b8a45[_0x86b6('0x59')]['messageId'],'body':_0x9b8a45[_0x86b6('0x59')][_0x86b6('0x59')],'SmsAccountId':_0x56f082[_0x86b6('0x62')]['id'],'SmsInteractionId':_0x12ac42['id'],'direction':'in','ContactId':_0x12ac42[_0x86b6('0xa4')],'AttachmentId':_0x9b8a45[_0x86b6('0x59')][_0x86b6('0xa5')]});})['then'](function(_0x176f77){_0x9b8a45[_0x86b6('0x23')]=_0x176f77;if(_0x9b8a45[_0x86b6('0x9c')][_0x86b6('0xa6')]){return db[_0x86b6('0xa7')][_0x86b6('0x57')]({'attributes':['id','name'],'where':{'id':_0x9b8a45[_0x86b6('0x9c')][_0x86b6('0xa6')]}})[_0x86b6('0x33')](function(_0x2fd475){if(_0x2fd475){_0x9b8a45[_0x86b6('0x74')][_0x86b6('0xa8')]({'id':0x0,'priority':0x0,'app':_0x86b6('0xa9'),'appdata':_0x2fd475[_0x86b6('0x60')]+','+(_0x9b8a45[_0x86b6('0x73')][_0x86b6('0xaa')]||0xa),'interval':_0x86b6('0xa2')});}return respondWithRpcPromise(_0x86b6('0xab'),_0x86b6('0xac'),_0x9b8a45);});}return respondWithRpcPromise(_0x86b6('0xab'),'startRouting',_0x9b8a45);})[_0x86b6('0x33')](function(_0x15b3f0){if(_0x15b3f0){var _0x19eb3b=0xc8;var _0x4844e4=_0x86b6('0xad');logger[_0x86b6('0x1d')](_0x86b6('0x20'),_0x4844e4,_0x19eb3b,_0x86b6('0xae'));logger[_0x86b6('0xaf')](_0x86b6('0xb0'),_0x4844e4,_0x19eb3b,_0x86b6('0xae'),JSON['stringify'](_0x15b3f0));if(_0x9b8a45[_0x86b6('0x73')][_0x86b6('0x4a')]==='twilio'){return _0x627af5[_0x86b6('0x27')](_0x19eb3b)[_0x86b6('0x2d')](_0x86b6('0xb1'),_0x86b6('0xb2'))[_0x86b6('0x39')](_0x86b6('0xb3'));}else{return _0x627af5[_0x86b6('0x27')](_0x19eb3b)[_0x86b6('0x29')](_0x15b3f0);}}})[_0x86b6('0x25')](handleError(_0x627af5,null));};exports[_0x86b6('0xb4')]=function(_0x2d3175,_0x52e743,_0xda1dd1){return db[_0x86b6('0x3b')]['findOne']({'where':{'id':_0x2d3175[_0x86b6('0x62')]['id']}})[_0x86b6('0x33')](handleEntityNotFound(_0x52e743,null))[_0x86b6('0x33')](function(_0xb97daf){if(_0xb97daf){return db[_0x86b6('0xb5')][_0x86b6('0xb6')](function(_0x1d0a05){return db[_0x86b6('0x71')]['destroy']({'where':{'SmsAccountId':_0x2d3175['params']['id']},'transaction':_0x1d0a05})['then'](function(_0x29df62){var _0x3053f3=_[_0x86b6('0x49')](_0x2d3175[_0x86b6('0x59')],function(_0x552a45){_0x552a45[_0x86b6('0x65')]=_0x2d3175['params']['id'];return _0x552a45;});return db['SmsApplication'][_0x86b6('0xb7')](_0x3053f3,{'transaction':_0x1d0a05});});})[_0x86b6('0x33')](function(){return db[_0x86b6('0x71')][_0x86b6('0xb8')]({'where':{'SmsAccountId':_0x2d3175[_0x86b6('0x62')]['id']},'order':_0x86b6('0xb9')});});}})[_0x86b6('0x33')](respondWithResult(_0x52e743,null))[_0x86b6('0x25')](handleError(_0x52e743,null));};exports[_0x86b6('0xba')]=function(_0x2700fb,_0x5a3439,_0x29e601){var _0x309c4a={};var _0x302e09={};var _0x59a0f9;var _0x4c0e43;return db[_0x86b6('0x3b')]['findOne']({'where':{'id':_0x2700fb[_0x86b6('0x62')]['id']}})[_0x86b6('0x33')](handleEntityNotFound(_0x5a3439,null))['then'](function(_0x51782d){if(_0x51782d){_0x59a0f9=_0x51782d;_0x302e09['model']=_[_0x86b6('0x3d')](db[_0x86b6('0x71')][_0x86b6('0x56')]);_0x302e09[_0x86b6('0x3e')]=_[_0x86b6('0x3d')](_0x2700fb[_0x86b6('0x3e')]);_0x302e09[_0x86b6('0x3f')]=_[_0x86b6('0x40')](_0x302e09['model'],_0x302e09[_0x86b6('0x3e')]);_0x309c4a[_0x86b6('0x41')]=_[_0x86b6('0x40')](_0x302e09[_0x86b6('0x3c')],qs[_0x86b6('0x42')](_0x2700fb[_0x86b6('0x3e')][_0x86b6('0x42')]));_0x309c4a[_0x86b6('0x41')]=_0x309c4a[_0x86b6('0x41')][_0x86b6('0x43')]?_0x309c4a[_0x86b6('0x41')]:_0x302e09[_0x86b6('0x3c')];_0x309c4a[_0x86b6('0x6d')]=qs[_0x86b6('0x45')](_0x2700fb[_0x86b6('0x3e')][_0x86b6('0x45')]);_0x309c4a['where']=qs[_0x86b6('0x3f')](_[_0x86b6('0x47')](_0x2700fb[_0x86b6('0x3e')],_0x302e09['filters']));if(_0x2700fb[_0x86b6('0x3e')]['filter']){_0x309c4a[_0x86b6('0x46')]=_['merge'](_0x309c4a[_0x86b6('0x46')],{'$or':_[_0x86b6('0x49')](_0x309c4a[_0x86b6('0x41')],function(_0x334fab){var _0x5aa47c={};_0x5aa47c[_0x334fab]={'$like':'%'+_0x2700fb[_0x86b6('0x3e')][_0x86b6('0x48')]+'%'};return _0x5aa47c;})});}_0x309c4a=_['merge']({},_0x309c4a,_0x2700fb[_0x86b6('0x4e')]);return _0x59a0f9['getApplications'](_0x309c4a);}})[_0x86b6('0x33')](function(_0xd8fb7d){if(_0xd8fb7d){_0x4c0e43=_0xd8fb7d[_0x86b6('0x43')];if(!_0x2700fb[_0x86b6('0x3e')]['hasOwnProperty'](_0x86b6('0x44'))){_0x309c4a[_0x86b6('0x2c')]=qs[_0x86b6('0x2c')](_0x2700fb[_0x86b6('0x3e')][_0x86b6('0x2c')]);_0x309c4a[_0x86b6('0x2b')]=qs[_0x86b6('0x2b')](_0x2700fb[_0x86b6('0x3e')][_0x86b6('0x2b')]);}return _0x59a0f9[_0x86b6('0xba')](_0x309c4a);}})[_0x86b6('0x33')](function(_0x36caf0){if(_0x36caf0){return _0x36caf0?{'count':_0x4c0e43,'rows':_0x36caf0}:null;}})['then'](respondWithResult(_0x5a3439,null))['catch'](handleError(_0x5a3439,null));};exports['getInteractions']=function(_0x3babbe,_0x2f80a4,_0x41dc27){var _0x53d382={'raw':![],'where':{}};var _0x2594d7={};var _0x52d09c={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x3babbe[_0x86b6('0x62')]['id']}})[_0x86b6('0x33')](handleEntityNotFound(_0x2f80a4,null))[_0x86b6('0x33')](function(_0x3ce844){if(_0x3ce844){_0x2594d7[_0x86b6('0x3c')]=_[_0x86b6('0x3d')](db[_0x86b6('0xbb')]['rawAttributes']);_0x2594d7['query']=_[_0x86b6('0x3d')](_0x3babbe['query']);_0x2594d7[_0x86b6('0x3f')]=_[_0x86b6('0x40')](_0x2594d7[_0x86b6('0x3c')],_0x2594d7[_0x86b6('0x3e')]);_0x53d382[_0x86b6('0x41')]=_[_0x86b6('0x40')](_0x2594d7[_0x86b6('0x3c')],qs[_0x86b6('0x42')](_0x3babbe[_0x86b6('0x3e')][_0x86b6('0x42')]));_0x53d382['attributes']=_0x53d382[_0x86b6('0x41')][_0x86b6('0x43')]?_0x53d382[_0x86b6('0x41')]:_0x2594d7[_0x86b6('0x3c')];if(!_0x3babbe[_0x86b6('0x3e')][_0x86b6('0x68')]('nolimit')){_0x53d382[_0x86b6('0x2c')]=qs['limit'](_0x3babbe[_0x86b6('0x3e')][_0x86b6('0x2c')]);_0x53d382[_0x86b6('0x2b')]=qs[_0x86b6('0x2b')](_0x3babbe[_0x86b6('0x3e')]['offset']);}_0x53d382['order']=qs['sort'](_0x3babbe['query'][_0x86b6('0x45')]);_0x53d382[_0x86b6('0x46')]=qs['filters'](_[_0x86b6('0x47')](_0x3babbe[_0x86b6('0x3e')],_0x2594d7[_0x86b6('0x3f')]));_0x53d382[_0x86b6('0x46')][_0x86b6('0x65')]=_0x3ce844['id'];if(_0x3babbe[_0x86b6('0x3e')]['filter']){_0x53d382['where']=_[_0x86b6('0x4d')](_0x53d382[_0x86b6('0x46')],{'$or':_['map'](_0x53d382[_0x86b6('0x41')],function(_0x407d45){var _0xc37a59={};_0xc37a59[_0x407d45]={'$like':'%'+_0x3babbe[_0x86b6('0x3e')]['filter']+'%'};return _0xc37a59;})});}_0x53d382=_[_0x86b6('0x4d')]({},_0x53d382,_0x3babbe[_0x86b6('0x4e')]);return db[_0x86b6('0xbb')][_0x86b6('0x2a')]({'where':_0x53d382['where']})[_0x86b6('0x33')](function(_0x48dfae){_0x52d09c[_0x86b6('0x2a')]=_0x48dfae;if(_0x3babbe['query'][_0x86b6('0x4f')]){_0x53d382['include']=[{'model':db['CmContact'],'as':_0x86b6('0xbc'),'required':![]},{'model':db[_0x86b6('0xa7')],'as':'Owner','attributes':[_0x86b6('0x60'),_0x86b6('0xbd'),_0x86b6('0xbe')],'required':![]},{'model':db[_0x86b6('0xbf')],'as':_0x86b6('0xc0'),'attributes':['id','name',_0x86b6('0xc1')],'where':_0x3babbe[_0x86b6('0x3e')][_0x86b6('0xc2')]?{'id':_0x3babbe['query'][_0x86b6('0xc2')]}:undefined,'required':_0x3babbe[_0x86b6('0x3e')]['tag']?!![]:![]}];}return db[_0x86b6('0xbb')][_0x86b6('0x51')](_0x53d382);})[_0x86b6('0x33')](function(_0x107a8f){_0x52d09c[_0x86b6('0x52')]=_0x107a8f;return _0x52d09c;});}})['then'](respondWithFilteredResult(_0x2f80a4,_0x53d382))['catch'](handleError(_0x2f80a4,null));};exports['send']=function(_0x13bbe9,_0x41bad8,_0xe18d15){var _0x2462e6,_0x1d0b01,_0x2de22a;if(_[_0x86b6('0x93')](_0x13bbe9['body'][_0x86b6('0x59')])||_0x13bbe9['body'][_0x86b6('0x59')]===''){throw new db[(_0x86b6('0x78'))][(_0x86b6('0x79'))](_0x86b6('0xc3'));}if(_[_0x86b6('0x93')](_0x13bbe9['body']['to'])){throw new db[(_0x86b6('0x78'))][(_0x86b6('0x79'))]('to\x20is\x20mandatory');}_0x2462e6=_0x13bbe9[_0x86b6('0x59')]['to'];return db[_0x86b6('0x3b')][_0x86b6('0x57')]({'where':{'id':_0x13bbe9[_0x86b6('0x62')]['id']},'include':[{'model':db[_0x86b6('0x97')],'as':_0x86b6('0xc4'),'include':[{'model':db[_0x86b6('0x77')],'as':'Contacts','where':{'mobile':_0x2462e6},'limit':0x1,'order':[[_0x86b6('0x7c'),'DESC']]}]}]})[_0x86b6('0x33')](handleEntityNotFound(_0x41bad8,null))[_0x86b6('0x33')](function(_0x6272c0){if(_0x6272c0&&_0x6272c0[_0x86b6('0xc4')]){_0x1d0b01=_0x6272c0[_0x86b6('0x35')]({'plain':!![]});if(_0x1d0b01['List']&&_0x1d0b01['List'][_0x86b6('0x99')]['length']){return _0x1d0b01[_0x86b6('0xc4')][_0x86b6('0x99')][0x0];}return db[_0x86b6('0x77')][_0x86b6('0x58')](_[_0x86b6('0x18')](_0x13bbe9['body'],{'firstName':_0x2462e6,'mobile':_0x2462e6,'phone':_0x2462e6,'ListId':_0x1d0b01[_0x86b6('0x7e')]}));}})[_0x86b6('0x33')](handleEntityNotFound(_0x41bad8,null))[_0x86b6('0x33')](function(_0x34678f){if(_0x34678f){_0x2de22a=_0x34678f;return db[_0x86b6('0xbb')][_0x86b6('0x57')]({'where':{'ContactId':_0x2de22a['id'],'closed':![],'SmsAccountId':_0x1d0b01['id']}})['then'](function(_0x5bc52f){if(_0x5bc52f){return[_0x5bc52f,![]];}return db['SmsInteraction'][_0x86b6('0x58')]({'UserId':_0x13bbe9['user']['id'],'ContactId':_0x2de22a['id'],'SmsAccountId':_0x1d0b01['id'],'phone':_0x2462e6,'firstMsgDirection':_0x86b6('0xc5'),'Messages':[_['merge'](_0x13bbe9[_0x86b6('0x59')],{'read':![],'body':_0x13bbe9[_0x86b6('0x59')]['body'],'phone':_0x2462e6,'SmsAccountId':_0x1d0b01['id'],'UserId':_0x13bbe9['user']['id'],'ContactId':_0x2de22a['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x86b6('0x33')](function(_0x33697a){return[_0x33697a,!![]];});});}})[_0x86b6('0x9b')](function(_0x460d7f,_0x4180d3){if(_0x4180d3){return _0x460d7f;}return db['SmsMessage']['create'](_[_0x86b6('0x4d')](_0x13bbe9[_0x86b6('0x59')],{'read':![],'body':_0x13bbe9['body'][_0x86b6('0x59')],'phone':_0x2462e6,'SmsAccountId':_0x1d0b01['id'],'SmsInteractionId':_0x460d7f['id'],'UserId':_0x13bbe9['user']['id'],'ContactId':_0x2de22a['id']}))[_0x86b6('0x33')](function(_0x153478){_0x460d7f[_0x86b6('0xc6')][_0x86b6('0xc7')]=[];_0x460d7f[_0x86b6('0xc6')]['Messages'][_0x86b6('0x9f')](_0x153478[_0x86b6('0xc6')]);return _0x460d7f;});})[_0x86b6('0x33')](respondWithResult(_0x41bad8,null))[_0x86b6('0x25')](handleError(_0x41bad8,null));};exports[_0x86b6('0x27')]=function(_0x139d37,_0x2449a8,_0x506e28){if(_0x139d37[_0x86b6('0x59')]['id']){delete _0x139d37['body']['id'];}console[_0x86b6('0xc8')](_0x86b6('0xc9'),_0x139d37[_0x86b6('0x59')]);var _0x3d8b3e,_0x16e946,_0x4dafb2;return db[_0x86b6('0x3b')][_0x86b6('0x57')]({'where':{'id':_0x139d37['params']['id']}})[_0x86b6('0x33')](handleEntityNotFound(_0x2449a8,null))[_0x86b6('0x33')](function(_0x44288a){if(_0x44288a){_0x4dafb2=_0x44288a;logger[_0x86b6('0xaf')](_0x86b6('0x20'),_0x86b6('0x27'),_0x86b6('0xca'),_0x44288a['type'],util[_0x86b6('0xcb')](_0x139d37[_0x86b6('0x59')],{'showHidden':![],'depth':null}));switch(_0x44288a[_0x86b6('0x4a')]){case _0x86b6('0xcc'):if(_0x139d37[_0x86b6('0x59')][_0x86b6('0xcd')]&&_0x139d37[_0x86b6('0x59')][_0x86b6('0x27')]){_0x16e946=_0x139d37['body'][_0x86b6('0x27')];return db[_0x86b6('0xa3')][_0x86b6('0x57')]({'where':{'messageId':_0x139d37['body'][_0x86b6('0xcd')]}});}break;case _0x86b6('0xce'):if(_0x139d37[_0x86b6('0x59')][_0x86b6('0xcf')]&&_0x139d37[_0x86b6('0x59')]['statusInt']){_0x16e946=_0x139d37['body'][_0x86b6('0xd0')];return db[_0x86b6('0xa3')][_0x86b6('0x57')]({'where':{'messageId':_0x139d37[_0x86b6('0x59')]['requestid']}});}break;case'clicksend':if(_0x139d37[_0x86b6('0x59')]['message_id']&&_0x139d37['body']['status_code']){_0x16e946=_0x139d37[_0x86b6('0x59')][_0x86b6('0xd1')];return db[_0x86b6('0xa3')][_0x86b6('0x57')]({'where':{'messageId':_0x139d37[_0x86b6('0x59')]['message_id']}});}break;case'infobip':var _0x13a3f4=_0x139d37[_0x86b6('0x59')][_0x86b6('0x8b')][0x0];if(_0x13a3f4[_0x86b6('0x83')]&&_0x13a3f4[_0x86b6('0x27')][_0x86b6('0xd2')]===_0x86b6('0xd3')){_0x16e946=_0x13a3f4[_0x86b6('0x27')]['groupName'];return db['SmsMessage'][_0x86b6('0x57')]({'where':{'messageId':_0x13a3f4[_0x86b6('0x83')]}});}break;case _0x86b6('0x8f'):if(_0x139d37[_0x86b6('0x59')][_0x86b6('0x83')]&&_0x139d37['body'][_0x86b6('0x27')]){_0x16e946=_0x139d37[_0x86b6('0x59')][_0x86b6('0x27')];return db[_0x86b6('0xa3')][_0x86b6('0x57')]({'where':{'messageId':_0x139d37[_0x86b6('0x59')][_0x86b6('0x83')]}});}break;case _0x86b6('0xd4'):if(_0x139d37[_0x86b6('0x59')][_0x86b6('0xd5')]&&_0x139d37[_0x86b6('0x59')][_0x86b6('0x27')]){_0x16e946=_0x139d37[_0x86b6('0x59')]['status'];return db[_0x86b6('0xa3')][_0x86b6('0x57')]({'where':{'messageId':_0x139d37[_0x86b6('0x59')][_0x86b6('0xd5')]}});}break;}}})['then'](handleEntityNotFound(_0x2449a8,null))[_0x86b6('0x33')](function(_0x17e085){if(_0x17e085){_0x3d8b3e=_0x17e085;switch(_0x4dafb2['type']){case _0x86b6('0xcc'):if(_0x16e946===_0x86b6('0xd3')){return _0x3d8b3e[_0x86b6('0x32')]({'read':!![]});}else{logger[_0x86b6('0x21')](_0x86b6('0x20'),_0x86b6('0x27'),_0x86b6('0xcc'),util[_0x86b6('0xcb')](_0x139d37[_0x86b6('0x59')],{'showHidden':![],'depth':null}));}break;case _0x86b6('0xce'):if(_0x16e946==='1'){return _0x3d8b3e[_0x86b6('0x32')]({'read':!![]});}else{logger[_0x86b6('0x21')](_0x86b6('0x20'),_0x86b6('0x27'),_0x86b6('0xcc'),util[_0x86b6('0xcb')](_0x139d37[_0x86b6('0x59')],{'showHidden':![],'depth':null}));}break;case _0x86b6('0x86'):if(!_0x139d37[_0x86b6('0x59')][_0x86b6('0xd6')]&&_0x16e946>=0xc8&&_0x16e946<=0xce){return _0x3d8b3e['update']({'read':!![]});}else{logger[_0x86b6('0x21')](_0x86b6('0x20'),_0x86b6('0x27'),'clicksend',util[_0x86b6('0xcb')](_0x139d37[_0x86b6('0x59')],{'showHidden':![],'depth':null}));}break;case _0x86b6('0x8a'):var _0x5d5796=_0x139d37[_0x86b6('0x59')][_0x86b6('0x8b')][0x0];if(_0x5d5796['status'][_0x86b6('0xd2')]===_0x86b6('0xd3')){return _0x3d8b3e[_0x86b6('0x32')]({'read':!![]});}else{logger[_0x86b6('0x21')](_0x86b6('0x20'),_0x86b6('0x27'),_0x86b6('0x8a'),util[_0x86b6('0xcb')](_0x139d37[_0x86b6('0x59')],{'showHidden':![],'depth':null}));}break;case _0x86b6('0x8f'):if(_0x16e946=='DELIVERED_TO_GATEWAY'||_0x16e946==_0x86b6('0xd7')){return _0x3d8b3e['update']({'read':!![]});}else{logger[_0x86b6('0x21')](_0x86b6('0x20'),_0x86b6('0x27'),_0x86b6('0x8f'),util[_0x86b6('0xcb')](_0x139d37[_0x86b6('0x59')],{'showHidden':![],'depth':null}));}break;case _0x86b6('0xd4'):if(_0x16e946===_0x86b6('0xd8')||_0x16e946===_0x86b6('0xd9')){return _0x3d8b3e[_0x86b6('0x32')]({'read':!![]});}else{logger[_0x86b6('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x86b6('0xd4'),util[_0x86b6('0xcb')](_0x139d37[_0x86b6('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x3d8b3e;}})[_0x86b6('0x33')](respondWithResult(_0x2449a8,null))[_0x86b6('0x25')](handleError(_0x2449a8,null));};exports['statusGet']=function(_0x57b676,_0x2d6417,_0x4b0b3f){var _0x2830bf,_0xe4ae4,_0xb4f533;return db['SmsAccount'][_0x86b6('0x57')]({'where':{'id':_0x57b676[_0x86b6('0x62')]['id']}})['then'](handleEntityNotFound(_0x2d6417,null))['then'](function(_0x17b36f){if(_0x17b36f){_0xb4f533=_0x17b36f;logger[_0x86b6('0xaf')](_0x86b6('0x20'),_0x86b6('0x27'),'received\x20delivery\x20report\x20from',_0x17b36f[_0x86b6('0x4a')],util[_0x86b6('0xcb')](_0x57b676[_0x86b6('0x3e')],{'showHidden':![],'depth':null}));switch(_0x17b36f[_0x86b6('0x4a')]){case _0x86b6('0x8d'):if(_0x57b676[_0x86b6('0x3e')]['message-id']&&_0x57b676[_0x86b6('0x3e')]['state']){_0xe4ae4=_0x57b676['query']['state'];return db[_0x86b6('0xa3')][_0x86b6('0x57')]({'where':{'messageId':_0x57b676[_0x86b6('0x3e')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x2d6417,null))[_0x86b6('0x33')](function(_0x5d2ebe){if(_0x5d2ebe){_0x2830bf=_0x5d2ebe;switch(_0xb4f533[_0x86b6('0x4a')]){case _0x86b6('0x8d'):if(_0xe4ae4==='2'||_0xe4ae4==='6'){return _0x2830bf[_0x86b6('0x32')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x86b6('0x27'),_0x86b6('0x8d'),util['inspect'](_0x57b676[_0x86b6('0x3e')],{'showHidden':![],'depth':null}));};break;}return _0x2830bf;}})['then'](respondWithResult(_0x2d6417,null))[_0x86b6('0x25')](handleError(_0x2d6417,null));};exports[_0x86b6('0xda')]=function(_0x5e2057,_0xb9930a,_0x3e4a1e){return db[_0x86b6('0x3b')][_0x86b6('0x57')]({'where':{'id':_0x5e2057[_0x86b6('0x62')]['id']}})[_0x86b6('0x33')](handleEntityNotFound(_0xb9930a,null))[_0x86b6('0x33')](function(_0x191c9e){if(_0x191c9e){return _0x191c9e[_0x86b6('0xda')](_0x5e2057[_0x86b6('0x59')]['ids'],_['omit'](_0x5e2057['body'],[_0x86b6('0x69'),'id'])||{})[_0x86b6('0x9b')](function(_0x1d07c8){for(var _0x31404b=0x0;_0x31404b<_0x5e2057[_0x86b6('0x59')][_0x86b6('0x69')][_0x86b6('0x43')];_0x31404b+=0x1){socket[_0x86b6('0xdb')]('userSmsAccount:save',{'UserId':_0x5e2057[_0x86b6('0x59')][_0x86b6('0x69')][_0x31404b],'SmsAccountId':_0x5e2057[_0x86b6('0x62')]['id']});}return _0x1d07c8;});}})[_0x86b6('0x33')](respondWithResult(_0xb9930a,null))[_0x86b6('0x25')](handleError(_0xb9930a,null));};exports['removeAgents']=function(_0xeebd0d,_0x5f3dde,_0x57dd64){var _0x59f9d6;return db[_0x86b6('0x3b')][_0x86b6('0x57')]({'where':{'id':_0xeebd0d['params']['id']}})['then'](handleEntityNotFound(_0x5f3dde,null))['then'](function(_0x1be87a){if(_0x1be87a){return _0x1be87a[_0x86b6('0xdc')](_0xeebd0d[_0x86b6('0x3e')][_0x86b6('0x69')])[_0x86b6('0x33')](function(_0x56ce2e){if(_[_0x86b6('0xdd')](_0xeebd0d[_0x86b6('0x3e')][_0x86b6('0x69')])){for(var _0x47fad4=0x0;_0x47fad4<_0xeebd0d[_0x86b6('0x3e')][_0x86b6('0x69')]['length'];_0x47fad4+=0x1){socket[_0x86b6('0xdb')](_0x86b6('0xde'),{'UserId':_0xeebd0d[_0x86b6('0x3e')][_0x86b6('0x69')][_0x47fad4],'SmsAccountId':_0xeebd0d[_0x86b6('0x62')]['id']});}}else{socket['emit'](_0x86b6('0xde'),{'UserId':_0xeebd0d[_0x86b6('0x3e')][_0x86b6('0x69')],'SmsAccountId':_0xeebd0d[_0x86b6('0x62')]['id']});}});}})[_0x86b6('0x33')](respondWithStatusCode(_0x5f3dde,null))[_0x86b6('0x25')](handleError(_0x5f3dde,null));};exports[_0x86b6('0xdf')]=function(_0x4c0f30,_0x5bb266,_0x20497e){var _0x324f2d={};var _0x2e83ed={};var _0x55619c;var _0x28c3fd;return db[_0x86b6('0x3b')]['findOne']({'where':{'id':_0x4c0f30[_0x86b6('0x62')]['id']}})['then'](handleEntityNotFound(_0x5bb266,null))[_0x86b6('0x33')](function(_0x3d85db){if(_0x3d85db){_0x55619c=_0x3d85db;_0x2e83ed[_0x86b6('0x3c')]=_[_0x86b6('0x3d')](db[_0x86b6('0xa7')][_0x86b6('0x56')]);_0x2e83ed[_0x86b6('0x3e')]=_[_0x86b6('0x3d')](_0x4c0f30[_0x86b6('0x3e')]);_0x2e83ed[_0x86b6('0x3f')]=_[_0x86b6('0x40')](_0x2e83ed[_0x86b6('0x3c')],_0x2e83ed['query']);_0x324f2d[_0x86b6('0x41')]=_['intersection'](_0x2e83ed[_0x86b6('0x3c')],qs['fields'](_0x4c0f30[_0x86b6('0x3e')][_0x86b6('0x42')]));_0x324f2d[_0x86b6('0x41')]=_0x324f2d[_0x86b6('0x41')][_0x86b6('0x43')]?_0x324f2d[_0x86b6('0x41')]:_0x2e83ed[_0x86b6('0x3c')];_0x324f2d['order']=qs['sort'](_0x4c0f30[_0x86b6('0x3e')][_0x86b6('0x45')]);_0x324f2d[_0x86b6('0x46')]=qs[_0x86b6('0x3f')](_[_0x86b6('0x47')](_0x4c0f30[_0x86b6('0x3e')],_0x2e83ed[_0x86b6('0x3f')]));if(_0x4c0f30[_0x86b6('0x3e')][_0x86b6('0x48')]){_0x324f2d['where']=_['merge'](_0x324f2d[_0x86b6('0x46')],{'$or':_[_0x86b6('0x49')](_0x324f2d[_0x86b6('0x41')],function(_0x186d8b){var _0x3b4a1a={};_0x3b4a1a[_0x186d8b]={'$like':'%'+_0x4c0f30['query'][_0x86b6('0x48')]+'%'};return _0x3b4a1a;})});}_0x324f2d=_[_0x86b6('0x4d')]({},_0x324f2d,_0x4c0f30[_0x86b6('0x4e')]);return _0x55619c[_0x86b6('0xdf')](_0x324f2d);}})[_0x86b6('0x33')](function(_0x22143f){if(_0x22143f){_0x28c3fd=_0x22143f[_0x86b6('0x43')];if(!_0x4c0f30[_0x86b6('0x3e')][_0x86b6('0x68')](_0x86b6('0x44'))){_0x324f2d[_0x86b6('0x2c')]=qs[_0x86b6('0x2c')](_0x4c0f30[_0x86b6('0x3e')][_0x86b6('0x2c')]);_0x324f2d[_0x86b6('0x2b')]=qs[_0x86b6('0x2b')](_0x4c0f30[_0x86b6('0x3e')]['offset']);}return _0x55619c[_0x86b6('0xdf')](_0x324f2d);}})[_0x86b6('0x33')](function(_0x4e5815){if(_0x4e5815){return _0x4e5815?{'count':_0x28c3fd,'rows':_0x4e5815}:null;}})[_0x86b6('0x33')](respondWithResult(_0x5bb266,null))[_0x86b6('0x25')](handleError(_0x5bb266,null));}; \ No newline at end of file +var _0x2906=['message-id','state','addAgents','userSmsAccount:save','removeAgents','emit','userSmsAccount:remove','getAgents','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','status','count','offset','limit','set','apply','destroy','get','SmsAccounts','UserProfileResource','end','sendStatus','name','send','Pause','mandatoryDispositionPause','SmsAccount','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','length','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','describe','addDisposition','SmsAccountId','Disposition','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','SmsApplication','account','applications','Applications','priority','asc','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','Body','messageId','skebby','sender','text','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmContact','Contacts','defaults','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','SmsMessage','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','stringify','twilio','text/xml','json','sequelize','transaction','getApplications','Contact','Owner','fullname','internal','Tags','color','tag','to\x20is\x20mandatory','List','DESC','user','Messages','dataValues','log','endpoint\x20/status\x20POST\x20/','SmsAccount,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','statusInt','requestid','clicksend','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD'];(function(_0x2ee790,_0x5a8661){var _0x5a54a5=function(_0x2713a4){while(--_0x2713a4){_0x2ee790['push'](_0x2ee790['shift']());}};_0x5a54a5(++_0x5a8661);}(_0x2906,0xe0));var _0x6290=function(_0xb24b6d,_0x49f15e){_0xb24b6d=_0xb24b6d-0x0;var _0xc88ebd=_0x2906[_0xb24b6d];return _0xc88ebd;};'use strict';var pdf=require(_0x6290('0x0'));var emlformat=require(_0x6290('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6290('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6290('0x3'));var moment=require(_0x6290('0x4'));var BPromise=require(_0x6290('0x5'));var Mustache=require(_0x6290('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x6290('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6290('0x8'));var squel=require('squel');var crypto=require(_0x6290('0x9'));var jsforce=require(_0x6290('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6290('0x7'));var querystring=require(_0x6290('0xb'));var Papa=require(_0x6290('0xc'));var authService=require(_0x6290('0xd'));var hardwareService=require(_0x6290('0xe'));var Redis=require(_0x6290('0xf'));var qs=require(_0x6290('0x10'));var logger=require(_0x6290('0x11'))(_0x6290('0x12'));var utils=require(_0x6290('0x13'));var config=require(_0x6290('0x14'));var db=require(_0x6290('0x15'))['db'];config[_0x6290('0x16')]=_['defaults'](config[_0x6290('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x6290('0x17'))(new Redis(config['redis']));require(_0x6290('0x18'))[_0x6290('0x19')](socket);var jayson=require(_0x6290('0x1a'));var client=jayson[_0x6290('0x1b')][_0x6290('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x5037c2,_0x31bec8,_0x50d7b5,_0x226453){return new BPromise(function(_0x5ba781,_0x204336){var _0x5cf917=_0x226453||client;return _0x5cf917[_0x6290('0x1d')](_0x5037c2,_0x50d7b5)[_0x6290('0x1e')](function(_0x3490d6){logger[_0x6290('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x31bec8,_0x6290('0x20'));logger[_0x6290('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x31bec8,_0x6290('0x20'),JSON['stringify'](_0x3490d6));if(_0x3490d6[_0x6290('0x22')]){if(_0x3490d6[_0x6290('0x22')][_0x6290('0x23')]===0x1f4){logger['error'](_0x6290('0x24'),_0x31bec8,_0x3490d6[_0x6290('0x22')]['message']);return _0x204336(_0x3490d6[_0x6290('0x22')][_0x6290('0x25')]);}logger[_0x6290('0x22')]('SmsAccount,\x20%s,\x20%s',_0x31bec8,_0x3490d6['error'][_0x6290('0x25')]);return _0x5ba781(_0x3490d6[_0x6290('0x22')]['message']);}else{logger[_0x6290('0x1f')](_0x6290('0x24'),_0x31bec8,_0x6290('0x20'));_0x5ba781(_0x3490d6[_0x6290('0x26')][_0x6290('0x25')]);}})[_0x6290('0x27')](function(_0x4d83b8){logger['error']('SmsAccount,\x20%s,\x20%s',_0x31bec8,_0x4d83b8);_0x204336(_0x4d83b8);});});}function respondWithStatusCode(_0x2fef63,_0x321ac4){_0x321ac4=_0x321ac4||0xcc;return function(_0x2fecc4){if(_0x2fecc4){return _0x2fef63['sendStatus'](_0x321ac4);}return _0x2fef63['status'](_0x321ac4)['end']();};}function respondWithResult(_0x198e1f,_0x1be6ad){_0x1be6ad=_0x1be6ad||0xc8;return function(_0x4664d3){if(_0x4664d3){return _0x198e1f[_0x6290('0x28')](_0x1be6ad)['json'](_0x4664d3);}};}function respondWithFilteredResult(_0x360d9e,_0x4112db){return function(_0xdbe366){if(_0xdbe366){var _0x94c561=_0xdbe366[_0x6290('0x29')],_0x5452f7=_0x4112db[_0x6290('0x2a')],_0x3f1570=_0x4112db[_0x6290('0x2a')]+_0x4112db[_0x6290('0x2b')],_0x26bdf0;if(_0x3f1570>=_0x94c561){_0x3f1570=_0x94c561;_0x26bdf0=0xc8;}else{_0x26bdf0=0xce;}_0x360d9e['status'](_0x26bdf0);return _0x360d9e[_0x6290('0x2c')]('Content-Range',_0x5452f7+'-'+_0x3f1570+'/'+_0x94c561)['json'](_0xdbe366);}return null;};}function patchUpdates(_0x7ae460){return function(_0x2eefa0){try{jsonpatch[_0x6290('0x2d')](_0x2eefa0,_0x7ae460,!![]);}catch(_0x47b8d5){return BPromise['reject'](_0x47b8d5);}return _0x2eefa0['save']();};}function saveUpdates(_0x388e5e,_0x485560){return function(_0x1e60b7){if(_0x1e60b7){return _0x1e60b7['update'](_0x388e5e)[_0x6290('0x1e')](function(_0x52f0ee){return _0x52f0ee;});}return null;};}function removeEntity(_0x1e3d6b,_0x7290e3){return function(_0x5857bd){if(_0x5857bd){return _0x5857bd[_0x6290('0x2e')]()[_0x6290('0x1e')](function(){var _0x885af5=_0x5857bd[_0x6290('0x2f')]({'plain':!![]});var _0x45f272=_0x6290('0x30');return db[_0x6290('0x31')][_0x6290('0x2e')]({'where':{'type':_0x45f272,'resourceId':_0x885af5['id']}})[_0x6290('0x1e')](function(){return _0x5857bd;});})['then'](function(){_0x1e3d6b[_0x6290('0x28')](0xcc)[_0x6290('0x32')]();});}};}function handleEntityNotFound(_0x4d5561,_0x22077f){return function(_0x30d045){if(!_0x30d045){_0x4d5561[_0x6290('0x33')](0x194);}return _0x30d045;};}function handleError(_0x4ea561,_0x5cbc50){_0x5cbc50=_0x5cbc50||0x1f4;return function(_0xc42763){logger[_0x6290('0x22')](_0xc42763['stack']);if(_0xc42763[_0x6290('0x34')]){delete _0xc42763[_0x6290('0x34')];}_0x4ea561[_0x6290('0x28')](_0x5cbc50)[_0x6290('0x35')](_0xc42763);};}exports['index']=function(_0x45f247,_0x355213){var _0x3449ea={'include':[{'model':db[_0x6290('0x36')],'as':_0x6290('0x37')}]},_0x3b25ec={},_0x1b03ca={'count':0x0,'rows':[]};var _0x566ff1=db[_0x6290('0x38')]['rawAttributes'];_0x3b25ec['model']=_[_0x6290('0x39')](_0x566ff1);_0x3b25ec[_0x6290('0x3a')]=_[_0x6290('0x39')](_0x45f247[_0x6290('0x3a')]);_0x3b25ec['filters']=_[_0x6290('0x3b')](_0x3b25ec[_0x6290('0x3c')],_0x3b25ec[_0x6290('0x3a')]);_0x3449ea[_0x6290('0x3d')]=_[_0x6290('0x3b')](_0x3b25ec[_0x6290('0x3c')],qs[_0x6290('0x3e')](_0x45f247[_0x6290('0x3a')][_0x6290('0x3e')]));_0x3449ea['attributes']=_0x3449ea[_0x6290('0x3d')]['length']?_0x3449ea['attributes']:_0x3b25ec[_0x6290('0x3c')];if(!_0x45f247[_0x6290('0x3a')][_0x6290('0x3f')](_0x6290('0x40'))){_0x3449ea[_0x6290('0x2b')]=qs['limit'](_0x45f247['query'][_0x6290('0x2b')]);_0x3449ea[_0x6290('0x2a')]=qs[_0x6290('0x2a')](_0x45f247[_0x6290('0x3a')][_0x6290('0x2a')]);}_0x3449ea[_0x6290('0x41')]=qs[_0x6290('0x42')](_0x45f247['query'][_0x6290('0x42')]);_0x3449ea[_0x6290('0x43')]=qs[_0x6290('0x44')](_[_0x6290('0x45')](_0x45f247[_0x6290('0x3a')],_0x3b25ec[_0x6290('0x44')]));if(_0x45f247[_0x6290('0x3a')][_0x6290('0x46')]){_0x3449ea[_0x6290('0x43')]=_[_0x6290('0x47')](_0x3449ea['where'],{'$or':_[_0x6290('0x48')](_0x566ff1,function(_0x475b06){if(_0x475b06[_0x6290('0x49')]['key']!==_0x6290('0x4a')){var _0x58fdef={};_0x58fdef[_0x475b06['field']]={'$like':'%'+_0x45f247[_0x6290('0x3a')][_0x6290('0x46')]+'%'};return _0x58fdef;}})});}_0x3449ea=_['merge']({},_0x3449ea,_0x45f247[_0x6290('0x4b')]);var _0x4c2695={'where':_0x3449ea[_0x6290('0x43')]};return db['SmsAccount'][_0x6290('0x29')](_0x4c2695)['then'](function(_0x3a2d17){_0x1b03ca[_0x6290('0x29')]=_0x3a2d17;if(_0x45f247[_0x6290('0x3a')][_0x6290('0x4c')]){_0x3449ea[_0x6290('0x4d')]=[{'all':!![]}];}return db[_0x6290('0x38')]['findAll'](_0x3449ea);})[_0x6290('0x1e')](function(_0x298571){_0x1b03ca[_0x6290('0x4e')]=_0x298571;return _0x1b03ca;})['then'](respondWithFilteredResult(_0x355213,_0x3449ea))[_0x6290('0x27')](handleError(_0x355213,null));};exports[_0x6290('0x4f')]=function(_0x18eb35,_0x514408){var _0x553137={'raw':![],'where':{'id':_0x18eb35[_0x6290('0x50')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x369edc={};_0x369edc[_0x6290('0x3c')]=_[_0x6290('0x39')](db[_0x6290('0x38')][_0x6290('0x51')]);_0x369edc[_0x6290('0x3a')]=_[_0x6290('0x39')](_0x18eb35['query']);_0x369edc[_0x6290('0x44')]=_[_0x6290('0x3b')](_0x369edc[_0x6290('0x3c')],_0x369edc[_0x6290('0x3a')]);_0x553137[_0x6290('0x3d')]=_[_0x6290('0x3b')](_0x369edc[_0x6290('0x3c')],qs['fields'](_0x18eb35[_0x6290('0x3a')][_0x6290('0x3e')]));_0x553137[_0x6290('0x3d')]=_0x553137['attributes'][_0x6290('0x52')]?_0x553137[_0x6290('0x3d')]:_0x369edc[_0x6290('0x3c')];if(_0x18eb35[_0x6290('0x3a')][_0x6290('0x4c')]){_0x553137[_0x6290('0x4d')]=[{'all':!![]}];}_0x553137=_[_0x6290('0x47')]({},_0x553137,_0x18eb35[_0x6290('0x4b')]);return db['SmsAccount']['find'](_0x553137)[_0x6290('0x1e')](handleEntityNotFound(_0x514408,null))[_0x6290('0x1e')](respondWithResult(_0x514408,null))[_0x6290('0x27')](handleError(_0x514408,null));};exports[_0x6290('0x53')]=function(_0x3b6560,_0x22c03f){return db['SmsAccount'][_0x6290('0x53')](_0x3b6560['body'],{})[_0x6290('0x1e')](function(_0x9a7785){var _0x4a4da4=_0x3b6560['user'][_0x6290('0x2f')]({'plain':!![]});if(!_0x4a4da4)throw new Error(_0x6290('0x54'));if(_0x4a4da4[_0x6290('0x55')]==='user'){var _0x51ff71=_0x9a7785[_0x6290('0x2f')]({'plain':!![]});var _0xc16934=_0x6290('0x30');return db[_0x6290('0x56')]['find']({'where':{'name':_0xc16934,'userProfileId':_0x4a4da4[_0x6290('0x57')]},'raw':!![]})[_0x6290('0x1e')](function(_0x84a65b){if(_0x84a65b&&_0x84a65b[_0x6290('0x58')]===0x0){return db[_0x6290('0x31')][_0x6290('0x53')]({'name':_0x51ff71[_0x6290('0x34')],'resourceId':_0x51ff71['id'],'type':_0x84a65b[_0x6290('0x34')],'sectionId':_0x84a65b['id']},{})['then'](function(){return _0x9a7785;});}else{return _0x9a7785;}})[_0x6290('0x27')](function(_0x3c986f){logger[_0x6290('0x22')](_0x6290('0x59'),_0x3c986f);throw _0x3c986f;});}return _0x9a7785;})['then'](respondWithResult(_0x22c03f,0xc9))[_0x6290('0x27')](handleError(_0x22c03f,null));};exports[_0x6290('0x5a')]=function(_0x5ae9e2,_0x310678){if(_0x5ae9e2[_0x6290('0x5b')]['id']){delete _0x5ae9e2[_0x6290('0x5b')]['id'];}return db[_0x6290('0x38')]['find']({'where':{'id':_0x5ae9e2[_0x6290('0x50')]['id']},'include':[{'model':db['Pause'],'as':_0x6290('0x37')}]})[_0x6290('0x1e')](handleEntityNotFound(_0x310678,null))[_0x6290('0x1e')](saveUpdates(_0x5ae9e2['body'],null))[_0x6290('0x1e')](respondWithResult(_0x310678,null))['catch'](handleError(_0x310678,null));};exports[_0x6290('0x2e')]=function(_0x5f587f,_0x59c966){return db[_0x6290('0x38')][_0x6290('0x5c')]({'where':{'id':_0x5f587f[_0x6290('0x50')]['id']}})[_0x6290('0x1e')](handleEntityNotFound(_0x59c966,null))['then'](removeEntity(_0x59c966,null))[_0x6290('0x27')](handleError(_0x59c966,null));};exports['describe']=function(_0x3de687,_0x580742){return db[_0x6290('0x38')][_0x6290('0x5d')]()[_0x6290('0x1e')](respondWithResult(_0x580742,null))[_0x6290('0x27')](handleError(_0x580742,null));};exports[_0x6290('0x5e')]=function(_0x34881,_0xc2d12b,_0x480cc1){if(_0x34881[_0x6290('0x5b')]['id']){delete _0x34881[_0x6290('0x5b')]['id'];}return db['SmsAccount'][_0x6290('0x5c')]({'where':{'id':_0x34881['params']['id']}})[_0x6290('0x1e')](handleEntityNotFound(_0xc2d12b,null))[_0x6290('0x1e')](function(_0x359f48){if(_0x359f48){_0x34881['body'][_0x6290('0x5f')]=_0x359f48['id'];return db[_0x6290('0x60')][_0x6290('0x53')](_0x34881[_0x6290('0x5b')]);}})['then'](respondWithResult(_0xc2d12b,null))[_0x6290('0x27')](handleError(_0xc2d12b,null));};exports['getDispositions']=function(_0x380e05,_0x389f87,_0x27698e){var _0x52256a={'raw':![],'where':{}};var _0x27449d={};var _0x21d482={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x380e05[_0x6290('0x50')]['id']}})[_0x6290('0x1e')](handleEntityNotFound(_0x389f87,null))[_0x6290('0x1e')](function(_0xb108f0){if(_0xb108f0){_0x27449d[_0x6290('0x3c')]=_['keys'](db[_0x6290('0x60')][_0x6290('0x51')]);_0x27449d['query']=_['keys'](_0x380e05[_0x6290('0x3a')]);_0x27449d[_0x6290('0x44')]=_[_0x6290('0x3b')](_0x27449d[_0x6290('0x3c')],_0x27449d[_0x6290('0x3a')]);_0x52256a[_0x6290('0x3d')]=_['intersection'](_0x27449d[_0x6290('0x3c')],qs[_0x6290('0x3e')](_0x380e05[_0x6290('0x3a')][_0x6290('0x3e')]));_0x52256a['attributes']=_0x52256a[_0x6290('0x3d')][_0x6290('0x52')]?_0x52256a[_0x6290('0x3d')]:_0x27449d['model'];if(!_0x380e05[_0x6290('0x3a')][_0x6290('0x3f')](_0x6290('0x40'))){_0x52256a[_0x6290('0x2b')]=qs[_0x6290('0x2b')](_0x380e05[_0x6290('0x3a')][_0x6290('0x2b')]);_0x52256a['offset']=qs[_0x6290('0x2a')](_0x380e05[_0x6290('0x3a')][_0x6290('0x2a')]);}_0x52256a[_0x6290('0x41')]=qs[_0x6290('0x42')](_0x380e05[_0x6290('0x3a')]['sort']);_0x52256a[_0x6290('0x43')]=qs[_0x6290('0x44')](_[_0x6290('0x45')](_0x380e05[_0x6290('0x3a')],_0x27449d['filters']));_0x52256a[_0x6290('0x43')][_0x6290('0x5f')]=_0xb108f0['id'];if(_0x380e05[_0x6290('0x3a')][_0x6290('0x46')]){_0x52256a['where']=_[_0x6290('0x47')](_0x52256a[_0x6290('0x43')],{'$or':_['map'](_0x52256a['attributes'],function(_0x2a5e8e){var _0x15608a={};_0x15608a[_0x2a5e8e]={'$like':'%'+_0x380e05[_0x6290('0x3a')][_0x6290('0x46')]+'%'};return _0x15608a;})});}_0x52256a=_[_0x6290('0x47')]({},_0x52256a,_0x380e05[_0x6290('0x4b')]);return db[_0x6290('0x60')][_0x6290('0x29')]({'where':_0x52256a[_0x6290('0x43')]})[_0x6290('0x1e')](function(_0x156c47){_0x21d482[_0x6290('0x29')]=_0x156c47;if(_0x380e05[_0x6290('0x3a')][_0x6290('0x4c')]){_0x52256a[_0x6290('0x4d')]=[{'all':!![]}];}return db[_0x6290('0x60')][_0x6290('0x61')](_0x52256a);})['then'](function(_0x1ce880){_0x21d482['rows']=_0x1ce880;return _0x21d482;});}})[_0x6290('0x1e')](respondWithFilteredResult(_0x389f87,_0x52256a))[_0x6290('0x27')](handleError(_0x389f87,null));};exports[_0x6290('0x62')]=function(_0x348470,_0x53f84b,_0x52c7dc){var _0x4eb05f;return db[_0x6290('0x38')][_0x6290('0x5c')]({'where':{'id':_0x348470[_0x6290('0x50')]['id']}})[_0x6290('0x1e')](handleEntityNotFound(_0x53f84b,null))[_0x6290('0x1e')](function(_0x393d1b){if(_0x393d1b){return _0x393d1b[_0x6290('0x62')](_0x348470[_0x6290('0x3a')][_0x6290('0x63')]);}})[_0x6290('0x1e')](respondWithStatusCode(_0x53f84b,null))[_0x6290('0x27')](handleError(_0x53f84b,null));};exports[_0x6290('0x64')]=function(_0x5a4b99,_0x45dd13,_0x285f1d){if(_0x5a4b99[_0x6290('0x5b')]['id']){delete _0x5a4b99[_0x6290('0x5b')]['id'];}return db[_0x6290('0x38')]['find']({'where':{'id':_0x5a4b99['params']['id']}})[_0x6290('0x1e')](handleEntityNotFound(_0x45dd13,null))[_0x6290('0x1e')](function(_0xab92b4){if(_0xab92b4){_0x5a4b99[_0x6290('0x5b')]['SmsAccountId']=_0xab92b4['id'];return db[_0x6290('0x65')][_0x6290('0x53')](_0x5a4b99[_0x6290('0x5b')]);}})[_0x6290('0x1e')](respondWithResult(_0x45dd13,null))[_0x6290('0x27')](handleError(_0x45dd13,null));};exports[_0x6290('0x66')]=function(_0x3690d0,_0x508b4c,_0x13a47f){var _0x2aef46={'raw':![],'where':{}};var _0x5277c8={};var _0x262430={'count':0x0,'rows':[]};return db[_0x6290('0x38')][_0x6290('0x67')]({'where':{'id':_0x3690d0[_0x6290('0x50')]['id']}})[_0x6290('0x1e')](handleEntityNotFound(_0x508b4c,null))[_0x6290('0x1e')](function(_0x2f3a84){if(_0x2f3a84){_0x5277c8[_0x6290('0x3c')]=_['keys'](db[_0x6290('0x65')][_0x6290('0x51')]);_0x5277c8[_0x6290('0x3a')]=_[_0x6290('0x39')](_0x3690d0[_0x6290('0x3a')]);_0x5277c8['filters']=_[_0x6290('0x3b')](_0x5277c8[_0x6290('0x3c')],_0x5277c8[_0x6290('0x3a')]);_0x2aef46[_0x6290('0x3d')]=_[_0x6290('0x3b')](_0x5277c8[_0x6290('0x3c')],qs['fields'](_0x3690d0['query'][_0x6290('0x3e')]));_0x2aef46[_0x6290('0x3d')]=_0x2aef46[_0x6290('0x3d')][_0x6290('0x52')]?_0x2aef46[_0x6290('0x3d')]:_0x5277c8[_0x6290('0x3c')];if(!_0x3690d0['query']['hasOwnProperty'](_0x6290('0x40'))){_0x2aef46[_0x6290('0x2b')]=qs['limit'](_0x3690d0[_0x6290('0x3a')][_0x6290('0x2b')]);_0x2aef46[_0x6290('0x2a')]=qs[_0x6290('0x2a')](_0x3690d0['query'][_0x6290('0x2a')]);}_0x2aef46[_0x6290('0x41')]=qs[_0x6290('0x42')](_0x3690d0[_0x6290('0x3a')]['sort']);_0x2aef46[_0x6290('0x43')]=qs[_0x6290('0x44')](_[_0x6290('0x45')](_0x3690d0[_0x6290('0x3a')],_0x5277c8['filters']));_0x2aef46[_0x6290('0x43')][_0x6290('0x5f')]=_0x2f3a84['id'];if(_0x3690d0[_0x6290('0x3a')]['filter']){_0x2aef46[_0x6290('0x43')]=_[_0x6290('0x47')](_0x2aef46['where'],{'$or':_[_0x6290('0x48')](_0x2aef46[_0x6290('0x3d')],function(_0x3d6427){var _0x14df84={};_0x14df84[_0x3d6427]={'$like':'%'+_0x3690d0[_0x6290('0x3a')]['filter']+'%'};return _0x14df84;})});}_0x2aef46=_['merge']({},_0x2aef46,_0x3690d0[_0x6290('0x4b')]);return db['CannedAnswer'][_0x6290('0x29')]({'where':_0x2aef46[_0x6290('0x43')]})[_0x6290('0x1e')](function(_0x1d21e3){_0x262430[_0x6290('0x29')]=_0x1d21e3;if(_0x3690d0[_0x6290('0x3a')][_0x6290('0x4c')]){_0x2aef46[_0x6290('0x4d')]=[{'all':!![]}];}return db[_0x6290('0x65')]['findAll'](_0x2aef46);})['then'](function(_0x498752){_0x262430[_0x6290('0x4e')]=_0x498752;return _0x262430;});}})[_0x6290('0x1e')](respondWithFilteredResult(_0x508b4c,_0x2aef46))[_0x6290('0x27')](handleError(_0x508b4c,null));};exports[_0x6290('0x68')]=function(_0x274333,_0x4a1a63,_0x13318d){var _0x4aaf3c;return db[_0x6290('0x38')][_0x6290('0x5c')]({'where':{'id':_0x274333['params']['id']}})[_0x6290('0x1e')](handleEntityNotFound(_0x4a1a63,null))[_0x6290('0x1e')](function(_0x2f4480){if(_0x2f4480){return _0x2f4480['removeAnswers'](_0x274333['query'][_0x6290('0x63')]);}})[_0x6290('0x1e')](respondWithStatusCode(_0x4a1a63,null))[_0x6290('0x27')](handleError(_0x4a1a63,null));};exports['notify']=function(_0xaa05fa,_0x5a43e8,_0xfc1d26){var _0x57ea8c={'channel':'sms'};var _0x337561=[];var _0x23bc5f=[];var _0x444cd4={};return db[_0x6290('0x38')]['find']({'where':{'id':_0xaa05fa[_0x6290('0x50')]['id']},'include':[{'model':db[_0x6290('0x69')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x5a43e8,null))[_0x6290('0x1e')](function(_0x5e361f){_0x57ea8c[_0x6290('0x6a')]=_0x5e361f;_0x57ea8c[_0x6290('0x6b')]=_['orderBy'](_0x5e361f[_0x6290('0x6c')],[_0x6290('0x6d')],[_0x6290('0x6e')]);if(_0x57ea8c[_0x6290('0x6a')][_0x6290('0x6c')]){delete _0x57ea8c[_0x6290('0x6a')][_0x6290('0x6c')];}return db['CmContact'][_0x6290('0x5d')]();})[_0x6290('0x1e')](function(_0x43c126){if(!_0x43c126){throw new db[(_0x6290('0x6f'))][(_0x6290('0x70'))](_0x6290('0x71'));}_0x337561=_['difference'](_[_0x6290('0x39')](_0x43c126),['createdAt','updatedAt']);_0x23bc5f=_['difference'](_[_0x6290('0x39')](_0x43c126),[_0x6290('0x72'),_0x6290('0x73'),_0x6290('0x74'),_0x6290('0x75')]);_0x57ea8c['body']={'mapKey':_0x6290('0x76')};if(_0x57ea8c[_0x6290('0x6a')][_0x6290('0x49')]){switch(_0x57ea8c[_0x6290('0x6a')][_0x6290('0x49')]){case'twilio':_0x57ea8c[_0x6290('0x5b')][_0x6290('0x77')]=_0xaa05fa[_0x6290('0x5b')][_0x6290('0x78')];_0x57ea8c[_0x6290('0x5b')][_0x6290('0x5b')]=_0xaa05fa[_0x6290('0x5b')][_0x6290('0x79')];_0x57ea8c[_0x6290('0x5b')][_0x6290('0x7a')]=_0xaa05fa[_0x6290('0x5b')]['MessageSid'];break;case _0x6290('0x7b'):_0x57ea8c[_0x6290('0x5b')]['from']='+'+_0xaa05fa[_0x6290('0x5b')][_0x6290('0x7c')];_0x57ea8c[_0x6290('0x5b')]['body']=_0xaa05fa[_0x6290('0x5b')][_0x6290('0x7d')];break;case'connectel':_0x57ea8c[_0x6290('0x5b')]['from']=_0xaa05fa[_0x6290('0x5b')][_0x6290('0x77')];_0x57ea8c[_0x6290('0x5b')][_0x6290('0x5b')]=_0xaa05fa[_0x6290('0x5b')][_0x6290('0x25')];break;case'clicksend':_0x57ea8c[_0x6290('0x5b')]['from']=_0xaa05fa['body']['from'];_0x57ea8c['body'][_0x6290('0x5b')]=_0xaa05fa[_0x6290('0x5b')]['body'];_0x57ea8c[_0x6290('0x5b')]['messageId']=_0xaa05fa[_0x6290('0x5b')][_0x6290('0x7e')];break;case _0x6290('0x7f'):_0x57ea8c[_0x6290('0x5b')][_0x6290('0x77')]=_0xaa05fa[_0x6290('0x5b')]['From'];_0x57ea8c['body'][_0x6290('0x5b')]=_0xaa05fa[_0x6290('0x5b')][_0x6290('0x80')];_0x57ea8c['body']['messageId']=_0xaa05fa[_0x6290('0x5b')][_0x6290('0x81')];break;case _0x6290('0x82'):_0x57ea8c[_0x6290('0x5b')][_0x6290('0x77')]='+'+_0xaa05fa[_0x6290('0x5b')]['results'][0x0][_0x6290('0x77')];_0x57ea8c[_0x6290('0x5b')][_0x6290('0x5b')]=_0xaa05fa['body'][_0x6290('0x83')][0x0][_0x6290('0x7d')];_0x57ea8c[_0x6290('0x5b')][_0x6290('0x7a')]=_0xaa05fa[_0x6290('0x5b')]['results'][0x0][_0x6290('0x7a')];break;case _0x6290('0x84'):_0x57ea8c['body'][_0x6290('0x77')]=_0xaa05fa[_0x6290('0x5b')][_0x6290('0x85')];_0x57ea8c[_0x6290('0x5b')][_0x6290('0x5b')]=_0xaa05fa[_0x6290('0x5b')]['segmentedMessage'][_0x6290('0x25')];break;case _0x6290('0x86'):_0x57ea8c[_0x6290('0x5b')][_0x6290('0x77')]=_0xaa05fa[_0x6290('0x5b')][_0x6290('0x87')];_0x57ea8c[_0x6290('0x5b')][_0x6290('0x5b')]=_0xaa05fa[_0x6290('0x5b')]['text'];_0x57ea8c[_0x6290('0x5b')][_0x6290('0x7a')]=_0xaa05fa[_0x6290('0x5b')][_0x6290('0x88')];break;case _0x6290('0x89'):_0x57ea8c[_0x6290('0x5b')][_0x6290('0x77')]=_0xaa05fa[_0x6290('0x5b')][_0x6290('0x77')];_0x57ea8c[_0x6290('0x5b')][_0x6290('0x5b')]=_0xaa05fa[_0x6290('0x5b')][_0x6290('0x25')];_0x57ea8c[_0x6290('0x5b')][_0x6290('0x7a')]=_0xaa05fa[_0x6290('0x5b')][_0x6290('0x8a')];break;}}if(_0x57ea8c['body']['id']){delete _0x57ea8c[_0x6290('0x5b')]['id'];}if(_[_0x6290('0x8b')](_0x57ea8c[_0x6290('0x5b')]['from'])){throw new db['Sequelize'][(_0x6290('0x70'))](_0x6290('0x8c'));}if(_[_0x6290('0x8b')](_0x57ea8c[_0x6290('0x5b')][_0x6290('0x5b')])||_0x57ea8c[_0x6290('0x5b')]['body']===''){throw new db[(_0x6290('0x6f'))]['ValidationError'](_0x6290('0x8d'));}if(_[_0x6290('0x8b')](_0x57ea8c['body']['mapKey'])){throw new db[(_0x6290('0x6f'))][(_0x6290('0x70'))](_0x6290('0x8e')+_0x23bc5f);}if(!_[_0x6290('0x8f')](_0x23bc5f,_0x57ea8c['body']['mapKey'])){throw new db[(_0x6290('0x6f'))][(_0x6290('0x70'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x23bc5f);}_0x444cd4[_0x57ea8c[_0x6290('0x5b')][_0x6290('0x90')]]=_0x57ea8c['body'][_0x6290('0x77')];return db['CmList'][_0x6290('0x5c')]({'where':{'id':_0x57ea8c[_0x6290('0x6a')][_0x6290('0x75')]},'include':[{'model':db[_0x6290('0x91')],'as':_0x6290('0x92'),'where':_0x444cd4,'limit':0x1,'order':[[_0x6290('0x73'),'DESC']]}]});})[_0x6290('0x1e')](handleEntityNotFound(_0x5a43e8,null))[_0x6290('0x1e')](function(_0x377352){if(_0x377352){_0x57ea8c['list']=_['omit'](_0x377352,[_0x6290('0x92')]);if(_0x377352[_0x6290('0x92')]['length']){return _0x377352[_0x6290('0x92')][0x0];}var _0x394341=_[_0x6290('0x93')](_0x57ea8c['body'],{'firstName':_0x57ea8c[_0x6290('0x5b')][_0x6290('0x77')],'ListId':_0x377352['id']});_0x394341[_0x57ea8c[_0x6290('0x5b')][_0x6290('0x90')]]=_0x57ea8c[_0x6290('0x5b')][_0x6290('0x77')];return db[_0x6290('0x91')][_0x6290('0x53')](_0x394341,{'fields':_0x337561,'raw':!![]});}})['then'](handleEntityNotFound(_0x5a43e8,null))['then'](function(_0xf30759){if(_0xf30759){_0x57ea8c[_0x6290('0x94')]=_0xf30759;var _0xe4f4f0={'ContactId':_0xf30759['id'],'phone':_0x57ea8c[_0x6290('0x5b')][_0x6290('0x77')],'SmsAccountId':_0xaa05fa[_0x6290('0x50')]['id']};var _0x552df7={'ContactId':_0xf30759['id'],'SmsAccountId':_0xaa05fa[_0x6290('0x50')]['id'],'closed':![]};return db['SmsInteraction'][_0x6290('0x5c')]({'where':_0x552df7})['then'](function(_0x1ec8da){if(_0x1ec8da){return[_0x1ec8da,![]];}return db[_0x6290('0x95')][_0x6290('0x53')](_0xe4f4f0)[_0x6290('0x1e')](function(_0x12d6a9){return[_0x12d6a9,!![]];});});}})[_0x6290('0x96')](function(_0x4a4096,_0x2d5f88){_0x57ea8c['interaction']=_0x4a4096[_0x6290('0x2f')]({'plain':!![]});_0x57ea8c[_0x6290('0x97')][_0x6290('0x98')]=![];if(_0x2d5f88){if(_0x57ea8c[_0x6290('0x6a')][_0x6290('0x99')]){_0x57ea8c[_0x6290('0x6b')][_0x6290('0x9a')]({'id':0x0,'priority':_0x57ea8c[_0x6290('0x6b')][_0x6290('0x52')]+0x1,'app':_0x6290('0x9b'),'appdata':_0x6290('0x9c'),'interval':'*,*,*,*'});}_0x57ea8c['interaction'][_0x6290('0x98')]=!![];}return db[_0x6290('0x9d')]['create']({'phone':_0x57ea8c[_0x6290('0x5b')]['from'],'messageId':_0x57ea8c[_0x6290('0x5b')][_0x6290('0x7a')],'body':_0x57ea8c['body']['body'],'SmsAccountId':_0xaa05fa[_0x6290('0x50')]['id'],'SmsInteractionId':_0x4a4096['id'],'direction':'in','ContactId':_0x4a4096[_0x6290('0x9e')],'AttachmentId':_0x57ea8c['body'][_0x6290('0x9f')]});})[_0x6290('0x1e')](function(_0x6a72c2){_0x57ea8c[_0x6290('0x25')]=_0x6a72c2;if(_0x57ea8c['interaction']['UserId']){return db[_0x6290('0xa0')][_0x6290('0x5c')]({'attributes':['id',_0x6290('0x34')],'where':{'id':_0x57ea8c[_0x6290('0x97')][_0x6290('0xa1')]}})[_0x6290('0x1e')](function(_0x540150){if(_0x540150){_0x57ea8c[_0x6290('0x6b')][_0x6290('0xa2')]({'id':0x0,'priority':0x0,'app':_0x6290('0xa3'),'appdata':_0x540150[_0x6290('0x34')]+','+(_0x57ea8c[_0x6290('0x6a')][_0x6290('0xa4')]||0xa),'interval':_0x6290('0xa5')});}return respondWithRpcPromise(_0x6290('0xa6'),_0x6290('0xa7'),_0x57ea8c);});}return respondWithRpcPromise(_0x6290('0xa6'),_0x6290('0xa7'),_0x57ea8c);})['then'](function(_0x2c63aa){if(_0x2c63aa){var _0x1917a0=0xc8;var _0xb5fb89=_0x6290('0xa8');logger[_0x6290('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb5fb89,_0x1917a0,_0x6290('0xa9'));logger[_0x6290('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0xb5fb89,_0x1917a0,'entity\x20found',JSON[_0x6290('0xaa')](_0x2c63aa));if(_0x57ea8c[_0x6290('0x6a')][_0x6290('0x49')]===_0x6290('0xab')){return _0x5a43e8[_0x6290('0x28')](_0x1917a0)[_0x6290('0x2c')]('Content-Type',_0x6290('0xac'))[_0x6290('0x35')]('\x0a');}else{return _0x5a43e8[_0x6290('0x28')](_0x1917a0)[_0x6290('0xad')](_0x2c63aa);}}})['catch'](handleError(_0x5a43e8,null));};exports['addApplications']=function(_0x29151c,_0x1dba29,_0x5d8f15){return db[_0x6290('0x38')][_0x6290('0x67')]({'where':{'id':_0x29151c[_0x6290('0x50')]['id']}})['then'](handleEntityNotFound(_0x1dba29,null))[_0x6290('0x1e')](function(_0x51647e){if(_0x51647e){return db[_0x6290('0xae')][_0x6290('0xaf')](function(_0x105408){return db[_0x6290('0x69')][_0x6290('0x2e')]({'where':{'SmsAccountId':_0x29151c[_0x6290('0x50')]['id']},'transaction':_0x105408})[_0x6290('0x1e')](function(_0x6bbc6d){var _0x7b6227=_[_0x6290('0x48')](_0x29151c[_0x6290('0x5b')],function(_0x3d50f4){_0x3d50f4[_0x6290('0x5f')]=_0x29151c[_0x6290('0x50')]['id'];return _0x3d50f4;});return db[_0x6290('0x69')]['bulkCreate'](_0x7b6227,{'transaction':_0x105408});});})[_0x6290('0x1e')](function(){return db[_0x6290('0x69')]['findAndCountAll']({'where':{'SmsAccountId':_0x29151c[_0x6290('0x50')]['id']},'order':_0x6290('0x6d')});});}})[_0x6290('0x1e')](respondWithResult(_0x1dba29,null))[_0x6290('0x27')](handleError(_0x1dba29,null));};exports[_0x6290('0xb0')]=function(_0x378dbb,_0xeba39,_0x2cf5da){var _0x13d4af={};var _0x37df6d={};var _0x4d4ff1;var _0x3884c6;return db['SmsAccount']['findOne']({'where':{'id':_0x378dbb[_0x6290('0x50')]['id']}})['then'](handleEntityNotFound(_0xeba39,null))[_0x6290('0x1e')](function(_0x18b259){if(_0x18b259){_0x4d4ff1=_0x18b259;_0x37df6d['model']=_[_0x6290('0x39')](db['SmsApplication'][_0x6290('0x51')]);_0x37df6d[_0x6290('0x3a')]=_['keys'](_0x378dbb[_0x6290('0x3a')]);_0x37df6d['filters']=_['intersection'](_0x37df6d[_0x6290('0x3c')],_0x37df6d['query']);_0x13d4af[_0x6290('0x3d')]=_['intersection'](_0x37df6d['model'],qs[_0x6290('0x3e')](_0x378dbb['query'][_0x6290('0x3e')]));_0x13d4af[_0x6290('0x3d')]=_0x13d4af[_0x6290('0x3d')][_0x6290('0x52')]?_0x13d4af['attributes']:_0x37df6d[_0x6290('0x3c')];_0x13d4af[_0x6290('0x41')]=qs[_0x6290('0x42')](_0x378dbb['query']['sort']);_0x13d4af[_0x6290('0x43')]=qs[_0x6290('0x44')](_[_0x6290('0x45')](_0x378dbb[_0x6290('0x3a')],_0x37df6d[_0x6290('0x44')]));if(_0x378dbb[_0x6290('0x3a')][_0x6290('0x46')]){_0x13d4af[_0x6290('0x43')]=_[_0x6290('0x47')](_0x13d4af[_0x6290('0x43')],{'$or':_['map'](_0x13d4af[_0x6290('0x3d')],function(_0x271563){var _0x27be4f={};_0x27be4f[_0x271563]={'$like':'%'+_0x378dbb[_0x6290('0x3a')][_0x6290('0x46')]+'%'};return _0x27be4f;})});}_0x13d4af=_[_0x6290('0x47')]({},_0x13d4af,_0x378dbb[_0x6290('0x4b')]);return _0x4d4ff1[_0x6290('0xb0')](_0x13d4af);}})[_0x6290('0x1e')](function(_0x270ed6){if(_0x270ed6){_0x3884c6=_0x270ed6[_0x6290('0x52')];if(!_0x378dbb[_0x6290('0x3a')][_0x6290('0x3f')](_0x6290('0x40'))){_0x13d4af['limit']=qs[_0x6290('0x2b')](_0x378dbb[_0x6290('0x3a')]['limit']);_0x13d4af[_0x6290('0x2a')]=qs[_0x6290('0x2a')](_0x378dbb[_0x6290('0x3a')][_0x6290('0x2a')]);}return _0x4d4ff1[_0x6290('0xb0')](_0x13d4af);}})[_0x6290('0x1e')](function(_0x3aaef4){if(_0x3aaef4){return _0x3aaef4?{'count':_0x3884c6,'rows':_0x3aaef4}:null;}})[_0x6290('0x1e')](respondWithResult(_0xeba39,null))['catch'](handleError(_0xeba39,null));};exports['getInteractions']=function(_0x57eb0c,_0x11c656,_0x534e37){var _0x4bd24a={'raw':![],'where':{}};var _0x16d5e1={};var _0x9c3c85={'count':0x0,'rows':[]};return db[_0x6290('0x38')]['findOne']({'where':{'id':_0x57eb0c[_0x6290('0x50')]['id']}})[_0x6290('0x1e')](handleEntityNotFound(_0x11c656,null))[_0x6290('0x1e')](function(_0xb3d584){if(_0xb3d584){_0x16d5e1[_0x6290('0x3c')]=_['keys'](db[_0x6290('0x95')][_0x6290('0x51')]);_0x16d5e1[_0x6290('0x3a')]=_[_0x6290('0x39')](_0x57eb0c[_0x6290('0x3a')]);_0x16d5e1[_0x6290('0x44')]=_['intersection'](_0x16d5e1[_0x6290('0x3c')],_0x16d5e1[_0x6290('0x3a')]);_0x4bd24a[_0x6290('0x3d')]=_[_0x6290('0x3b')](_0x16d5e1['model'],qs[_0x6290('0x3e')](_0x57eb0c[_0x6290('0x3a')]['fields']));_0x4bd24a[_0x6290('0x3d')]=_0x4bd24a[_0x6290('0x3d')][_0x6290('0x52')]?_0x4bd24a[_0x6290('0x3d')]:_0x16d5e1['model'];if(!_0x57eb0c['query']['hasOwnProperty']('nolimit')){_0x4bd24a[_0x6290('0x2b')]=qs['limit'](_0x57eb0c['query']['limit']);_0x4bd24a[_0x6290('0x2a')]=qs[_0x6290('0x2a')](_0x57eb0c[_0x6290('0x3a')][_0x6290('0x2a')]);}_0x4bd24a['order']=qs['sort'](_0x57eb0c[_0x6290('0x3a')]['sort']);_0x4bd24a[_0x6290('0x43')]=qs[_0x6290('0x44')](_[_0x6290('0x45')](_0x57eb0c[_0x6290('0x3a')],_0x16d5e1['filters']));_0x4bd24a[_0x6290('0x43')]['SmsAccountId']=_0xb3d584['id'];if(_0x57eb0c[_0x6290('0x3a')][_0x6290('0x46')]){_0x4bd24a['where']=_[_0x6290('0x47')](_0x4bd24a['where'],{'$or':_['map'](_0x4bd24a[_0x6290('0x3d')],function(_0xb1a061){var _0x53afbb={};_0x53afbb[_0xb1a061]={'$like':'%'+_0x57eb0c['query'][_0x6290('0x46')]+'%'};return _0x53afbb;})});}_0x4bd24a=_[_0x6290('0x47')]({},_0x4bd24a,_0x57eb0c['options']);return db[_0x6290('0x95')][_0x6290('0x29')]({'where':_0x4bd24a[_0x6290('0x43')]})[_0x6290('0x1e')](function(_0x2f2db4){_0x9c3c85['count']=_0x2f2db4;if(_0x57eb0c[_0x6290('0x3a')]['includeAll']){_0x4bd24a[_0x6290('0x4d')]=[{'model':db[_0x6290('0x91')],'as':_0x6290('0xb1'),'required':![]},{'model':db[_0x6290('0xa0')],'as':_0x6290('0xb2'),'attributes':[_0x6290('0x34'),_0x6290('0xb3'),_0x6290('0xb4')],'required':![]},{'model':db['Tag'],'as':_0x6290('0xb5'),'attributes':['id','name',_0x6290('0xb6')],'where':_0x57eb0c[_0x6290('0x3a')][_0x6290('0xb7')]?{'id':_0x57eb0c['query'][_0x6290('0xb7')]}:undefined,'required':_0x57eb0c['query']['tag']?!![]:![]}];}return db[_0x6290('0x95')][_0x6290('0x61')](_0x4bd24a);})[_0x6290('0x1e')](function(_0x2c5494){_0x9c3c85[_0x6290('0x4e')]=_0x2c5494;return _0x9c3c85;});}})[_0x6290('0x1e')](respondWithFilteredResult(_0x11c656,_0x4bd24a))[_0x6290('0x27')](handleError(_0x11c656,null));};exports[_0x6290('0x35')]=function(_0x18f859,_0x37c42c,_0x1e885c){var _0x22ad75,_0x25c8e8,_0x1fdca8;if(_[_0x6290('0x8b')](_0x18f859[_0x6290('0x5b')][_0x6290('0x5b')])||_0x18f859[_0x6290('0x5b')]['body']===''){throw new db[(_0x6290('0x6f'))]['ValidationError'](_0x6290('0x8d'));}if(_[_0x6290('0x8b')](_0x18f859['body']['to'])){throw new db[(_0x6290('0x6f'))][(_0x6290('0x70'))](_0x6290('0xb8'));}_0x22ad75=_0x18f859['body']['to'];return db[_0x6290('0x38')][_0x6290('0x5c')]({'where':{'id':_0x18f859['params']['id']},'include':[{'model':db['CmList'],'as':_0x6290('0xb9'),'include':[{'model':db[_0x6290('0x91')],'as':_0x6290('0x92'),'where':{'mobile':_0x22ad75},'limit':0x1,'order':[[_0x6290('0x73'),_0x6290('0xba')]]}]}]})[_0x6290('0x1e')](handleEntityNotFound(_0x37c42c,null))[_0x6290('0x1e')](function(_0x19b626){if(_0x19b626&&_0x19b626['List']){_0x25c8e8=_0x19b626[_0x6290('0x2f')]({'plain':!![]});if(_0x25c8e8['List']&&_0x25c8e8[_0x6290('0xb9')]['Contacts'][_0x6290('0x52')]){return _0x25c8e8[_0x6290('0xb9')][_0x6290('0x92')][0x0];}return db['CmContact'][_0x6290('0x53')](_[_0x6290('0x93')](_0x18f859[_0x6290('0x5b')],{'firstName':_0x22ad75,'mobile':_0x22ad75,'phone':_0x22ad75,'ListId':_0x25c8e8['ListId']}));}})[_0x6290('0x1e')](handleEntityNotFound(_0x37c42c,null))[_0x6290('0x1e')](function(_0x5852be){if(_0x5852be){_0x1fdca8=_0x5852be;return db[_0x6290('0x95')][_0x6290('0x5c')]({'where':{'ContactId':_0x1fdca8['id'],'closed':![],'SmsAccountId':_0x25c8e8['id']}})[_0x6290('0x1e')](function(_0x5e4883){if(_0x5e4883){return[_0x5e4883,![]];}return db[_0x6290('0x95')]['create']({'UserId':_0x18f859[_0x6290('0xbb')]['id'],'ContactId':_0x1fdca8['id'],'SmsAccountId':_0x25c8e8['id'],'phone':_0x22ad75,'firstMsgDirection':'out','Messages':[_[_0x6290('0x47')](_0x18f859[_0x6290('0x5b')],{'read':![],'body':_0x18f859[_0x6290('0x5b')][_0x6290('0x5b')],'phone':_0x22ad75,'SmsAccountId':_0x25c8e8['id'],'UserId':_0x18f859['user']['id'],'ContactId':_0x1fdca8['id']})]},{'include':[{'model':db[_0x6290('0x9d')],'as':'Messages'}]})[_0x6290('0x1e')](function(_0x1afd50){return[_0x1afd50,!![]];});});}})['spread'](function(_0x4cd051,_0xd809b3){if(_0xd809b3){return _0x4cd051;}return db['SmsMessage'][_0x6290('0x53')](_[_0x6290('0x47')](_0x18f859[_0x6290('0x5b')],{'read':![],'body':_0x18f859[_0x6290('0x5b')][_0x6290('0x5b')],'phone':_0x22ad75,'SmsAccountId':_0x25c8e8['id'],'SmsInteractionId':_0x4cd051['id'],'UserId':_0x18f859[_0x6290('0xbb')]['id'],'ContactId':_0x1fdca8['id']}))[_0x6290('0x1e')](function(_0x2a5047){_0x4cd051['dataValues'][_0x6290('0xbc')]=[];_0x4cd051[_0x6290('0xbd')][_0x6290('0xbc')][_0x6290('0x9a')](_0x2a5047[_0x6290('0xbd')]);return _0x4cd051;});})['then'](respondWithResult(_0x37c42c,null))[_0x6290('0x27')](handleError(_0x37c42c,null));};exports[_0x6290('0x28')]=function(_0x59b952,_0x28f0f2,_0x1c2c18){if(_0x59b952['body']['id']){delete _0x59b952[_0x6290('0x5b')]['id'];}console[_0x6290('0xbe')](_0x6290('0xbf'),_0x59b952['body']);var _0x5cdae6,_0x5c447f,_0x330d09;return db[_0x6290('0x38')][_0x6290('0x5c')]({'where':{'id':_0x59b952[_0x6290('0x50')]['id']}})[_0x6290('0x1e')](handleEntityNotFound(_0x28f0f2,null))[_0x6290('0x1e')](function(_0x1a4dba){if(_0x1a4dba){_0x330d09=_0x1a4dba;logger[_0x6290('0x21')](_0x6290('0xc0'),_0x6290('0x28'),_0x6290('0xc1'),_0x1a4dba[_0x6290('0x49')],util[_0x6290('0xc2')](_0x59b952['body'],{'showHidden':![],'depth':null}));switch(_0x1a4dba[_0x6290('0x49')]){case'skebby':if(_0x59b952[_0x6290('0x5b')][_0x6290('0xc3')]&&_0x59b952[_0x6290('0x5b')][_0x6290('0x28')]){_0x5c447f=_0x59b952[_0x6290('0x5b')][_0x6290('0x28')];return db['SmsMessage']['find']({'where':{'messageId':_0x59b952['body'][_0x6290('0xc3')]}});}break;case _0x6290('0xc4'):if(_0x59b952['body']['requestid']&&_0x59b952[_0x6290('0x5b')][_0x6290('0xc5')]){_0x5c447f=_0x59b952[_0x6290('0x5b')][_0x6290('0xc5')];return db[_0x6290('0x9d')][_0x6290('0x5c')]({'where':{'messageId':_0x59b952['body'][_0x6290('0xc6')]}});}break;case _0x6290('0xc7'):if(_0x59b952[_0x6290('0x5b')]['message_id']&&_0x59b952[_0x6290('0x5b')][_0x6290('0xc8')]){_0x5c447f=_0x59b952['body']['status_code'];return db['SmsMessage'][_0x6290('0x5c')]({'where':{'messageId':_0x59b952[_0x6290('0x5b')][_0x6290('0x7e')]}});}break;case'infobip':var _0x4bb2bb=_0x59b952[_0x6290('0x5b')][_0x6290('0x83')][0x0];if(_0x4bb2bb[_0x6290('0x7a')]&&_0x4bb2bb['status'][_0x6290('0xc9')]===_0x6290('0xca')){_0x5c447f=_0x4bb2bb[_0x6290('0x28')][_0x6290('0xc9')];return db[_0x6290('0x9d')][_0x6290('0x5c')]({'where':{'messageId':_0x4bb2bb[_0x6290('0x7a')]}});}break;case _0x6290('0x86'):if(_0x59b952[_0x6290('0x5b')][_0x6290('0x7a')]&&_0x59b952['body']['status']){_0x5c447f=_0x59b952[_0x6290('0x5b')][_0x6290('0x28')];return db['SmsMessage']['find']({'where':{'messageId':_0x59b952[_0x6290('0x5b')]['messageId']}});}break;case _0x6290('0x89'):if(_0x59b952['body'][_0x6290('0xcb')]&&_0x59b952[_0x6290('0x5b')][_0x6290('0x28')]){_0x5c447f=_0x59b952[_0x6290('0x5b')]['status'];return db[_0x6290('0x9d')][_0x6290('0x5c')]({'where':{'messageId':_0x59b952['body']['redif']}});}break;}}})[_0x6290('0x1e')](handleEntityNotFound(_0x28f0f2,null))[_0x6290('0x1e')](function(_0x120193){if(_0x120193){_0x5cdae6=_0x120193;switch(_0x330d09['type']){case'skebby':if(_0x5c447f==='DELIVERED'){return _0x5cdae6['update']({'read':!![]});}else{logger[_0x6290('0x22')](_0x6290('0xc0'),'status',_0x6290('0x7b'),util[_0x6290('0xc2')](_0x59b952[_0x6290('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x6290('0xc4'):if(_0x5c447f==='1'){return _0x5cdae6['update']({'read':!![]});}else{logger[_0x6290('0x22')](_0x6290('0xc0'),_0x6290('0x28'),'skebby',util[_0x6290('0xc2')](_0x59b952[_0x6290('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x6290('0xc7'):if(!_0x59b952[_0x6290('0x5b')][_0x6290('0xcc')]&&_0x5c447f>=0xc8&&_0x5c447f<=0xce){return _0x5cdae6['update']({'read':!![]});}else{logger['error'](_0x6290('0xc0'),'status',_0x6290('0xc7'),util[_0x6290('0xc2')](_0x59b952['body'],{'showHidden':![],'depth':null}));}break;case _0x6290('0x82'):var _0x24dd19=_0x59b952[_0x6290('0x5b')][_0x6290('0x83')][0x0];if(_0x24dd19[_0x6290('0x28')][_0x6290('0xc9')]===_0x6290('0xca')){return _0x5cdae6[_0x6290('0x5a')]({'read':!![]});}else{logger[_0x6290('0x22')](_0x6290('0xc0'),_0x6290('0x28'),'infobip',util['inspect'](_0x59b952[_0x6290('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x6290('0x86'):if(_0x5c447f==_0x6290('0xcd')||_0x5c447f==_0x6290('0xce')){return _0x5cdae6['update']({'read':!![]});}else{logger[_0x6290('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','clickatell',util[_0x6290('0xc2')](_0x59b952[_0x6290('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x6290('0x89'):if(_0x5c447f===_0x6290('0xcf')||_0x5c447f==='ACCEPTD'){return _0x5cdae6['update']({'read':!![]});}else{logger['error'](_0x6290('0xc0'),_0x6290('0x28'),_0x6290('0x89'),util[_0x6290('0xc2')](_0x59b952[_0x6290('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x5cdae6;}})[_0x6290('0x1e')](respondWithResult(_0x28f0f2,null))[_0x6290('0x27')](handleError(_0x28f0f2,null));};exports['statusGet']=function(_0x406e36,_0x6af9a4,_0x1ad213){var _0x450fbf,_0x40a58b,_0x57692c;return db[_0x6290('0x38')][_0x6290('0x5c')]({'where':{'id':_0x406e36[_0x6290('0x50')]['id']}})['then'](handleEntityNotFound(_0x6af9a4,null))[_0x6290('0x1e')](function(_0xf4fb8b){if(_0xf4fb8b){_0x57692c=_0xf4fb8b;logger[_0x6290('0x21')](_0x6290('0xc0'),_0x6290('0x28'),'received\x20delivery\x20report\x20from',_0xf4fb8b[_0x6290('0x49')],util['inspect'](_0x406e36[_0x6290('0x3a')],{'showHidden':![],'depth':null}));switch(_0xf4fb8b[_0x6290('0x49')]){case _0x6290('0x84'):if(_0x406e36[_0x6290('0x3a')][_0x6290('0xd0')]&&_0x406e36[_0x6290('0x3a')][_0x6290('0xd1')]){_0x40a58b=_0x406e36[_0x6290('0x3a')]['state'];return db[_0x6290('0x9d')][_0x6290('0x5c')]({'where':{'messageId':_0x406e36[_0x6290('0x3a')][_0x6290('0xd0')]}});}break;}}})[_0x6290('0x1e')](handleEntityNotFound(_0x6af9a4,null))[_0x6290('0x1e')](function(_0x44307d){if(_0x44307d){_0x450fbf=_0x44307d;switch(_0x57692c[_0x6290('0x49')]){case _0x6290('0x84'):if(_0x40a58b==='2'||_0x40a58b==='6'){return _0x450fbf['update']({'read':!![]});}else{logger['error'](_0x6290('0xc0'),_0x6290('0x28'),'csc',util[_0x6290('0xc2')](_0x406e36[_0x6290('0x3a')],{'showHidden':![],'depth':null}));};break;}return _0x450fbf;}})['then'](respondWithResult(_0x6af9a4,null))[_0x6290('0x27')](handleError(_0x6af9a4,null));};exports[_0x6290('0xd2')]=function(_0x5281ae,_0x4ea6f5,_0x4848a9){return db['SmsAccount']['find']({'where':{'id':_0x5281ae[_0x6290('0x50')]['id']}})[_0x6290('0x1e')](handleEntityNotFound(_0x4ea6f5,null))[_0x6290('0x1e')](function(_0x15f7ac){if(_0x15f7ac){return _0x15f7ac['addAgents'](_0x5281ae[_0x6290('0x5b')]['ids'],_['omit'](_0x5281ae[_0x6290('0x5b')],[_0x6290('0x63'),'id'])||{})['spread'](function(_0x292c49){for(var _0x2d8ec8=0x0;_0x2d8ec8<_0x5281ae['body'][_0x6290('0x63')]['length'];_0x2d8ec8+=0x1){socket['emit'](_0x6290('0xd3'),{'UserId':_0x5281ae[_0x6290('0x5b')]['ids'][_0x2d8ec8],'SmsAccountId':_0x5281ae[_0x6290('0x50')]['id']});}return _0x292c49;});}})[_0x6290('0x1e')](respondWithResult(_0x4ea6f5,null))[_0x6290('0x27')](handleError(_0x4ea6f5,null));};exports[_0x6290('0xd4')]=function(_0x204564,_0xb0d0d6,_0x4cd038){var _0x4597c9;return db[_0x6290('0x38')][_0x6290('0x5c')]({'where':{'id':_0x204564[_0x6290('0x50')]['id']}})[_0x6290('0x1e')](handleEntityNotFound(_0xb0d0d6,null))[_0x6290('0x1e')](function(_0x2f974b){if(_0x2f974b){return _0x2f974b[_0x6290('0xd4')](_0x204564['query']['ids'])[_0x6290('0x1e')](function(_0x3248c9){if(_['isArray'](_0x204564[_0x6290('0x3a')][_0x6290('0x63')])){for(var _0x23b3d4=0x0;_0x23b3d4<_0x204564[_0x6290('0x3a')]['ids'][_0x6290('0x52')];_0x23b3d4+=0x1){socket[_0x6290('0xd5')](_0x6290('0xd6'),{'UserId':_0x204564[_0x6290('0x3a')]['ids'][_0x23b3d4],'SmsAccountId':_0x204564[_0x6290('0x50')]['id']});}}else{socket[_0x6290('0xd5')](_0x6290('0xd6'),{'UserId':_0x204564[_0x6290('0x3a')]['ids'],'SmsAccountId':_0x204564[_0x6290('0x50')]['id']});}});}})[_0x6290('0x1e')](respondWithStatusCode(_0xb0d0d6,null))['catch'](handleError(_0xb0d0d6,null));};exports[_0x6290('0xd7')]=function(_0x7507cf,_0x4cab7a,_0x48f585){var _0x141a48={};var _0x4c5766={};var _0x5ae38f;var _0x32e3ad;return db[_0x6290('0x38')][_0x6290('0x67')]({'where':{'id':_0x7507cf[_0x6290('0x50')]['id']}})[_0x6290('0x1e')](handleEntityNotFound(_0x4cab7a,null))['then'](function(_0x47ff53){if(_0x47ff53){_0x5ae38f=_0x47ff53;_0x4c5766[_0x6290('0x3c')]=_['keys'](db['User'][_0x6290('0x51')]);_0x4c5766[_0x6290('0x3a')]=_['keys'](_0x7507cf[_0x6290('0x3a')]);_0x4c5766[_0x6290('0x44')]=_[_0x6290('0x3b')](_0x4c5766[_0x6290('0x3c')],_0x4c5766[_0x6290('0x3a')]);_0x141a48['attributes']=_[_0x6290('0x3b')](_0x4c5766['model'],qs['fields'](_0x7507cf[_0x6290('0x3a')][_0x6290('0x3e')]));_0x141a48[_0x6290('0x3d')]=_0x141a48[_0x6290('0x3d')]['length']?_0x141a48[_0x6290('0x3d')]:_0x4c5766[_0x6290('0x3c')];_0x141a48[_0x6290('0x41')]=qs[_0x6290('0x42')](_0x7507cf['query'][_0x6290('0x42')]);_0x141a48[_0x6290('0x43')]=qs['filters'](_[_0x6290('0x45')](_0x7507cf[_0x6290('0x3a')],_0x4c5766['filters']));if(_0x7507cf[_0x6290('0x3a')]['filter']){_0x141a48['where']=_['merge'](_0x141a48[_0x6290('0x43')],{'$or':_[_0x6290('0x48')](_0x141a48['attributes'],function(_0x3d0040){var _0x2c4616={};_0x2c4616[_0x3d0040]={'$like':'%'+_0x7507cf[_0x6290('0x3a')][_0x6290('0x46')]+'%'};return _0x2c4616;})});}_0x141a48=_[_0x6290('0x47')]({},_0x141a48,_0x7507cf[_0x6290('0x4b')]);return _0x5ae38f['getAgents'](_0x141a48);}})[_0x6290('0x1e')](function(_0x201b1f){if(_0x201b1f){_0x32e3ad=_0x201b1f[_0x6290('0x52')];if(!_0x7507cf[_0x6290('0x3a')][_0x6290('0x3f')](_0x6290('0x40'))){_0x141a48['limit']=qs[_0x6290('0x2b')](_0x7507cf[_0x6290('0x3a')][_0x6290('0x2b')]);_0x141a48[_0x6290('0x2a')]=qs[_0x6290('0x2a')](_0x7507cf[_0x6290('0x3a')][_0x6290('0x2a')]);}return _0x5ae38f['getAgents'](_0x141a48);}})[_0x6290('0x1e')](function(_0x15e9b9){if(_0x15e9b9){return _0x15e9b9?{'count':_0x32e3ad,'rows':_0x15e9b9}:null;}})[_0x6290('0x1e')](respondWithResult(_0x4cab7a,null))[_0x6290('0x27')](handleError(_0x4cab7a,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 78dbf30..a9fe329 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 _0xb1aa=['exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x1d0dd6,_0x1dd867){var _0x1673bd=function(_0x320b30){while(--_0x320b30){_0x1d0dd6['push'](_0x1d0dd6['shift']());}};_0x1673bd(++_0x1dd867);}(_0xb1aa,0x1af));var _0xab1a=function(_0x23dcec,_0x9e07c3){_0x23dcec=_0x23dcec-0x0;var _0x55b90d=_0xb1aa[_0x23dcec];return _0x55b90d;};'use strict';var EventEmitter=require(_0xab1a('0x0'));var SmsAccount=require(_0xab1a('0x1'))['db'][_0xab1a('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xab1a('0x3')](0x0);var events={'afterCreate':_0xab1a('0x4'),'afterUpdate':'update','afterDestroy':_0xab1a('0x5')};function emitEvent(_0x22d21c){return function(_0x7be06d,_0x36eb35,_0xf79a5c){SmsAccountEvents[_0xab1a('0x6')](_0x22d21c+':'+_0x7be06d['id'],_0x7be06d);SmsAccountEvents[_0xab1a('0x6')](_0x22d21c,_0x7be06d);_0xf79a5c(null);};}for(var e in events){if(events[_0xab1a('0x7')](e)){var event=events[e];SmsAccount[_0xab1a('0x8')](e,emitEvent(event));}}module[_0xab1a('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0xdf6c=['exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x382c75,_0x441740){var _0x4ae6cf=function(_0x5328d2){while(--_0x5328d2){_0x382c75['push'](_0x382c75['shift']());}};_0x4ae6cf(++_0x441740);}(_0xdf6c,0x1c3));var _0xcdf6=function(_0x15d31f,_0x3aa2f3){_0x15d31f=_0x15d31f-0x0;var _0x24ae88=_0xdf6c[_0x15d31f];return _0x24ae88;};'use strict';var EventEmitter=require(_0xcdf6('0x0'));var SmsAccount=require(_0xcdf6('0x1'))['db'][_0xcdf6('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xcdf6('0x3')](0x0);var events={'afterCreate':_0xcdf6('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x130c1d){return function(_0x571a87,_0x15ba22,_0x52224e){SmsAccountEvents[_0xcdf6('0x5')](_0x130c1d+':'+_0x571a87['id'],_0x571a87);SmsAccountEvents[_0xcdf6('0x5')](_0x130c1d,_0x571a87);_0x52224e(null);};}for(var e in events){if(events[_0xcdf6('0x6')](e)){var event=events[e];SmsAccount[_0xcdf6('0x7')](e,emitEvent(event));}}module[_0xcdf6('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index ceb42db..c46b3a7 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 _0xca4a=['./smsAccount.attributes','SmsAccount','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x1e7fee,_0x3dce9d){var _0x43e55b=function(_0x49b73b){while(--_0x49b73b){_0x1e7fee['push'](_0x1e7fee['shift']());}};_0x43e55b(++_0x3dce9d);}(_0xca4a,0xaa));var _0xaca4=function(_0x323f1c,_0x5e381a){_0x323f1c=_0x323f1c-0x0;var _0x2496c9=_0xca4a[_0x323f1c];return _0x2496c9;};'use strict';var _=require(_0xaca4('0x0'));var util=require(_0xaca4('0x1'));var logger=require(_0xaca4('0x2'))('api');var moment=require(_0xaca4('0x3'));var BPromise=require(_0xaca4('0x4'));var rp=require(_0xaca4('0x5'));var attributes=require(_0xaca4('0x6'));module['exports']=function(_0x4ff0ae,_0x230993){return _0x4ff0ae['define'](_0xaca4('0x7'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb226=['exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','moment','request-promise','./smsAccount.attributes'];(function(_0x1cfb3d,_0x4a92cc){var _0xde6ff6=function(_0x173dc5){while(--_0x173dc5){_0x1cfb3d['push'](_0x1cfb3d['shift']());}};_0xde6ff6(++_0x4a92cc);}(_0xb226,0x11c));var _0x6b22=function(_0x5aa7dc,_0xac2340){_0x5aa7dc=_0x5aa7dc-0x0;var _0x5c8cfa=_0xb226[_0x5aa7dc];return _0x5c8cfa;};'use strict';var _=require(_0x6b22('0x0'));var util=require(_0x6b22('0x1'));var logger=require(_0x6b22('0x2'))('api');var moment=require(_0x6b22('0x3'));var BPromise=require('bluebird');var rp=require(_0x6b22('0x4'));var attributes=require(_0x6b22('0x5'));module[_0x6b22('0x6')]=function(_0xe7e626,_0x501ed5){return _0xe7e626[_0x6b22('0x7')](_0x6b22('0x8'),attributes,{'tableName':_0x6b22('0x9'),'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 89caf96..bb95657 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 _0x0a1e=['http','defaults','socket.io-emitter','redis','register','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','ShowSmsAccount','SmsAccount','find','options','where','attributes','include','map','model','lodash','util','randomstring','ioredis','../../config/logger','rpc','jayson/promise'];(function(_0x2382b5,_0x447dcf){var _0x4d5019=function(_0x4fd421){while(--_0x4fd421){_0x2382b5['push'](_0x2382b5['shift']());}};_0x4d5019(++_0x447dcf);}(_0x0a1e,0x107));var _0xe0a1=function(_0x61c562,_0x42701d){_0x61c562=_0x61c562-0x0;var _0x110550=_0x0a1e[_0x61c562];return _0x110550;};'use strict';var _=require(_0xe0a1('0x0'));var util=require(_0xe0a1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe0a1('0x2'));var fs=require('fs');var Redis=require(_0xe0a1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe0a1('0x4'))(_0xe0a1('0x5'));var config=require('../../config/environment');var jayson=require(_0xe0a1('0x6'));var client=jayson['client'][_0xe0a1('0x7')]({'port':0x232a});config['redis']=_[_0xe0a1('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe0a1('0x9'))(new Redis(config[_0xe0a1('0xa')]));require('./smsAccount.socket')[_0xe0a1('0xb')](socket);function respondWithRpcPromise(_0x3019e6,_0x3e4c19,_0x5af921){return new BPromise(function(_0x5280cf,_0x1dc7e3){return client['request'](_0x3019e6,_0x5af921)[_0xe0a1('0xc')](function(_0x14e756){logger[_0xe0a1('0xd')](_0xe0a1('0xe'),_0x3e4c19,'request\x20sent');logger[_0xe0a1('0xf')](_0xe0a1('0x10'),_0x3e4c19,'request\x20sent',JSON[_0xe0a1('0x11')](_0x14e756));if(_0x14e756[_0xe0a1('0x12')]){if(_0x14e756[_0xe0a1('0x12')]['code']===0x1f4){logger['error'](_0xe0a1('0xe'),_0x3e4c19,_0x14e756[_0xe0a1('0x12')]['message']);return _0x1dc7e3(_0x14e756[_0xe0a1('0x12')][_0xe0a1('0x13')]);}logger['error'](_0xe0a1('0xe'),_0x3e4c19,_0x14e756['error'][_0xe0a1('0x13')]);return _0x5280cf(_0x14e756[_0xe0a1('0x12')]['message']);}else{logger[_0xe0a1('0xd')](_0xe0a1('0xe'),_0x3e4c19,_0xe0a1('0x14'));_0x5280cf(_0x14e756['result'][_0xe0a1('0x13')]);}})['catch'](function(_0x5c00e4){logger[_0xe0a1('0x12')](_0xe0a1('0xe'),_0x3e4c19,_0x5c00e4);_0x1dc7e3(_0x5c00e4);});});}exports[_0xe0a1('0x15')]=function(_0x15e0b7){var _0x351773=this;return new Promise(function(_0x12c93b,_0x8059b5){return db[_0xe0a1('0x16')][_0xe0a1('0x17')]({'raw':_0x15e0b7['options']?_0x15e0b7[_0xe0a1('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x15e0b7[_0xe0a1('0x18')]?_0x15e0b7['options'][_0xe0a1('0x19')]||null:null,'attributes':_0x15e0b7[_0xe0a1('0x18')]?_0x15e0b7[_0xe0a1('0x18')][_0xe0a1('0x1a')]||null:null,'include':_0x15e0b7[_0xe0a1('0x18')]?_0x15e0b7[_0xe0a1('0x18')][_0xe0a1('0x1b')]?_[_0xe0a1('0x1c')](_0x15e0b7[_0xe0a1('0x18')][_0xe0a1('0x1b')],function(_0x32239b){return{'model':db[_0x32239b[_0xe0a1('0x1d')]],'as':_0x32239b['as'],'attributes':_0x32239b[_0xe0a1('0x1a')],'include':_0x32239b['include']?_[_0xe0a1('0x1c')](_0x32239b[_0xe0a1('0x1b')],function(_0x5d3d35){return{'model':db[_0x5d3d35[_0xe0a1('0x1d')]],'as':_0x5d3d35['as'],'attributes':_0x5d3d35[_0xe0a1('0x1a')],'include':_0x5d3d35[_0xe0a1('0x1b')]?_[_0xe0a1('0x1c')](_0x5d3d35[_0xe0a1('0x1b')],function(_0x4bd393){return{'model':db[_0x4bd393[_0xe0a1('0x1d')]],'as':_0x4bd393['as'],'attributes':_0x4bd393[_0xe0a1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe0a1('0xc')](function(_0x97b30c){logger[_0xe0a1('0xd')](_0xe0a1('0x15'),_0x15e0b7);logger['debug'](_0xe0a1('0x15'),_0x15e0b7,JSON['stringify'](_0x97b30c));_0x12c93b(_0x97b30c);})['catch'](function(_0x5cc61c){logger[_0xe0a1('0x12')](_0xe0a1('0x15'),_0x5cc61c[_0xe0a1('0x13')],_0x15e0b7);_0x8059b5(_0x351773[_0xe0a1('0x12')](0x1f4,_0x5cc61c['message']));});});}; \ No newline at end of file +var _0xa41a=['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','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','./smsAccount.socket','register','then','info'];(function(_0xa73177,_0x300f04){var _0x57167b=function(_0x94ca68){while(--_0x94ca68){_0xa73177['push'](_0xa73177['shift']());}};_0x57167b(++_0x300f04);}(_0xa41a,0x13b));var _0xaa41=function(_0x99a64b,_0x2ed680){_0x99a64b=_0x99a64b-0x0;var _0x41e11f=_0xa41a[_0x99a64b];return _0x41e11f;};'use strict';var _=require('lodash');var util=require(_0xaa41('0x0'));var moment=require(_0xaa41('0x1'));var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require('../../config/environment');var jayson=require(_0xaa41('0x9'));var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});config[_0xaa41('0xc')]=_[_0xaa41('0xd')](config[_0xaa41('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa41('0xc')]));require(_0xaa41('0xe'))[_0xaa41('0xf')](socket);function respondWithRpcPromise(_0x199ee1,_0x4e9da8,_0x52e096){return new BPromise(function(_0x3b59ec,_0x4a8a3c){return client['request'](_0x199ee1,_0x52e096)[_0xaa41('0x10')](function(_0x2f6101){logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x4e9da8,_0xaa41('0x13'));logger['debug'](_0xaa41('0x14'),_0x4e9da8,_0xaa41('0x13'),JSON[_0xaa41('0x15')](_0x2f6101));if(_0x2f6101[_0xaa41('0x16')]){if(_0x2f6101['error'][_0xaa41('0x17')]===0x1f4){logger[_0xaa41('0x16')]('SmsAccount,\x20%s,\x20%s',_0x4e9da8,_0x2f6101[_0xaa41('0x16')][_0xaa41('0x18')]);return _0x4a8a3c(_0x2f6101[_0xaa41('0x16')][_0xaa41('0x18')]);}logger['error'](_0xaa41('0x12'),_0x4e9da8,_0x2f6101[_0xaa41('0x16')][_0xaa41('0x18')]);return _0x3b59ec(_0x2f6101['error'][_0xaa41('0x18')]);}else{logger['info'](_0xaa41('0x12'),_0x4e9da8,'request\x20sent');_0x3b59ec(_0x2f6101[_0xaa41('0x19')][_0xaa41('0x18')]);}})[_0xaa41('0x1a')](function(_0x708d48){logger[_0xaa41('0x16')]('SmsAccount,\x20%s,\x20%s',_0x4e9da8,_0x708d48);_0x4a8a3c(_0x708d48);});});}exports[_0xaa41('0x1b')]=function(_0x4cbaba){var _0x20308=this;return new Promise(function(_0x212f7c,_0x5369d5){return db[_0xaa41('0x1c')][_0xaa41('0x1d')]({'raw':_0x4cbaba[_0xaa41('0x1e')]?_0x4cbaba[_0xaa41('0x1e')][_0xaa41('0x1f')]===undefined?!![]:![]:!![],'where':_0x4cbaba['options']?_0x4cbaba['options'][_0xaa41('0x20')]||null:null,'attributes':_0x4cbaba[_0xaa41('0x1e')]?_0x4cbaba[_0xaa41('0x1e')][_0xaa41('0x21')]||null:null,'include':_0x4cbaba[_0xaa41('0x1e')]?_0x4cbaba[_0xaa41('0x1e')]['include']?_[_0xaa41('0x22')](_0x4cbaba[_0xaa41('0x1e')][_0xaa41('0x23')],function(_0x52388a){return{'model':db[_0x52388a[_0xaa41('0x24')]],'as':_0x52388a['as'],'attributes':_0x52388a['attributes'],'include':_0x52388a['include']?_[_0xaa41('0x22')](_0x52388a['include'],function(_0x2d8a1f){return{'model':db[_0x2d8a1f[_0xaa41('0x24')]],'as':_0x2d8a1f['as'],'attributes':_0x2d8a1f[_0xaa41('0x21')],'include':_0x2d8a1f[_0xaa41('0x23')]?_['map'](_0x2d8a1f[_0xaa41('0x23')],function(_0x503670){return{'model':db[_0x503670[_0xaa41('0x24')]],'as':_0x503670['as'],'attributes':_0x503670[_0xaa41('0x21')]};}):[]};}):[]};}):[]:[]})[_0xaa41('0x10')](function(_0x312dc2){logger[_0xaa41('0x11')]('ShowSmsAccount',_0x4cbaba);logger['debug']('ShowSmsAccount',_0x4cbaba,JSON['stringify'](_0x312dc2));_0x212f7c(_0x312dc2);})['catch'](function(_0x2dc97c){logger[_0xaa41('0x16')](_0xaa41('0x1b'),_0x2dc97c['message'],_0x4cbaba);_0x5369d5(_0x20308['error'](0x1f4,_0x2dc97c[_0xaa41('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 0eda470..ab45171 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 _0x5131=['register','./smsAccount.events','save'];(function(_0x12c32c,_0x13af3b){var _0x39b809=function(_0x278d4e){while(--_0x278d4e){_0x12c32c['push'](_0x12c32c['shift']());}};_0x39b809(++_0x13af3b);}(_0x5131,0x6a));var _0x1513=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x5131[_0xbca1b1];return _0x4e1686;};'use strict';var SmsAccountEvents=require(_0x1513('0x0'));var events=[_0x1513('0x1'),'remove','update'];function createListener(_0x5379c9,_0x164d33){return function(_0x250194){_0x164d33['emit'](_0x5379c9,_0x250194);};}function removeListener(_0x1e56df,_0xb9f59c){return function(){SmsAccountEvents['removeListener'](_0x1e56df,_0xb9f59c);};}exports[_0x1513('0x2')]=function(_0xa10c92){for(var _0x2de42e=0x0,_0x576aab=events['length'];_0x2de42e<_0x576aab;_0x2de42e++){var _0x110ce=events[_0x2de42e];var _0x524443=createListener('smsAccount:'+_0x110ce,_0xa10c92);SmsAccountEvents['on'](_0x110ce,_0x524443);}}; \ No newline at end of file +var _0x7460=['register','length','smsAccount:','./smsAccount.events','save','remove','update','removeListener'];(function(_0x5adb92,_0x4b5ca5){var _0x26a5c0=function(_0xbcc5fc){while(--_0xbcc5fc){_0x5adb92['push'](_0x5adb92['shift']());}};_0x26a5c0(++_0x4b5ca5);}(_0x7460,0x11b));var _0x0746=function(_0x187790,_0x2a083b){_0x187790=_0x187790-0x0;var _0x472705=_0x7460[_0x187790];return _0x472705;};'use strict';var SmsAccountEvents=require(_0x0746('0x0'));var events=[_0x0746('0x1'),_0x0746('0x2'),_0x0746('0x3')];function createListener(_0x3a3e20,_0x432059){return function(_0x36c374){_0x432059['emit'](_0x3a3e20,_0x36c374);};}function removeListener(_0x9508d6,_0x1a0610){return function(){SmsAccountEvents[_0x0746('0x4')](_0x9508d6,_0x1a0610);};}exports[_0x0746('0x5')]=function(_0x44d561){for(var _0x3b1e92=0x0,_0x289ade=events[_0x0746('0x6')];_0x3b1e92<_0x289ade;_0x3b1e92++){var _0x500c4f=events[_0x3b1e92];var _0xcac887=createListener(_0x0746('0x7')+_0x500c4f,_0x44d561);SmsAccountEvents['on'](_0x500c4f,_0xcac887);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 71e52a2..eb557d2 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 _0x6233=['post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./smsApplication.controller','isAuthenticated','index','show'];(function(_0x5e0f04,_0x505e55){var _0x2b16f6=function(_0x4c2133){while(--_0x4c2133){_0x5e0f04['push'](_0x5e0f04['shift']());}};_0x2b16f6(++_0x505e55);}(_0x6233,0x104));var _0x3623=function(_0x3d2f89,_0x2d7c6b){_0x3d2f89=_0x3d2f89-0x0;var _0x3d38af=_0x6233[_0x3d2f89];return _0x3d38af;};'use strict';var multer=require('multer');var util=require(_0x3623('0x0'));var path=require(_0x3623('0x1'));var timeout=require(_0x3623('0x2'));var express=require(_0x3623('0x3'));var router=express[_0x3623('0x4')]();var auth=require(_0x3623('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3623('0x6'));router['get']('/',auth[_0x3623('0x7')](),controller[_0x3623('0x8')]);router['get']('/:id',auth[_0x3623('0x7')](),controller[_0x3623('0x9')]);router[_0x3623('0xa')]('/',auth['isAuthenticated'](),controller[_0x3623('0xb')]);router[_0x3623('0xc')](_0x3623('0xd'),auth[_0x3623('0x7')](),controller[_0x3623('0xe')]);router[_0x3623('0xf')]('/:id',auth[_0x3623('0x7')](),controller[_0x3623('0x10')]);module[_0x3623('0x11')]=router; \ No newline at end of file +var _0xf4a0=['get','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','isAuthenticated','index'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xf4a0,0x1d1));var _0x0f4a=function(_0x46e0fa,_0x194515){_0x46e0fa=_0x46e0fa-0x0;var _0x283de6=_0xf4a0[_0x46e0fa];return _0x283de6;};'use strict';var multer=require(_0x0f4a('0x0'));var util=require(_0x0f4a('0x1'));var path=require('path');var timeout=require(_0x0f4a('0x2'));var express=require(_0x0f4a('0x3'));var router=express[_0x0f4a('0x4')]();var auth=require(_0x0f4a('0x5'));var interaction=require(_0x0f4a('0x6'));var config=require('../../config/environment');var controller=require(_0x0f4a('0x7'));router['get']('/',auth[_0x0f4a('0x8')](),controller[_0x0f4a('0x9')]);router[_0x0f4a('0xa')](_0x0f4a('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x0f4a('0xc')]('/',auth['isAuthenticated'](),controller[_0x0f4a('0xd')]);router[_0x0f4a('0xe')](_0x0f4a('0xb'),auth['isAuthenticated'](),controller[_0x0f4a('0xf')]);router[_0x0f4a('0x10')](_0x0f4a('0xb'),auth[_0x0f4a('0x8')](),controller[_0x0f4a('0x11')]);module[_0x0f4a('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index f9cf926..13ba8d5 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 _0xc137=['STRING','noop','TEXT','sequelize','exports','INTEGER'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc137,0xff));var _0x7c13=function(_0x2ddfd9,_0x5877d0){_0x2ddfd9=_0x2ddfd9-0x0;var _0x2668f0=_0xc137[_0x2ddfd9];return _0x2668f0;};'use strict';var Sequelize=require(_0x7c13('0x0'));module[_0x7c13('0x1')]={'priority':{'type':Sequelize[_0x7c13('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7c13('0x3')],'allowNull':![],'defaultValue':_0x7c13('0x4')},'appdata':{'type':Sequelize[_0x7c13('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x3189=['TEXT','*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x3d3b05,_0x334c57){var _0x2c6ca3=function(_0x3fd1cc){while(--_0x3fd1cc){_0x3d3b05['push'](_0x3d3b05['shift']());}};_0x2c6ca3(++_0x334c57);}(_0x3189,0x19a));var _0x9318=function(_0x41f4c0,_0x351f53){_0x41f4c0=_0x41f4c0-0x0;var _0x189418=_0x3189[_0x41f4c0];return _0x189418;};'use strict';var Sequelize=require(_0x9318('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9318('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9318('0x2')],'allowNull':![],'defaultValue':_0x9318('0x3')},'appdata':{'type':Sequelize[_0x9318('0x4')]()},'description':{'type':Sequelize[_0x9318('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9318('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 7184f8f..1164159 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 _0x990e=['length','nolimit','order','sort','where','filters','pick','filter','merge','map','type','key','VIRTUAL','field','SmsApplication','count','includeAll','include','catch','show','params','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','rawAttributes','model','keys','query','intersection','attributes','fields'];(function(_0x2ab8e4,_0x1ca361){var _0x1f4eed=function(_0x5d2d42){while(--_0x5d2d42){_0x2ab8e4['push'](_0x2ab8e4['shift']());}};_0x1f4eed(++_0x1ca361);}(_0x990e,0x190));var _0xe990=function(_0x4baa27,_0x41e054){_0x4baa27=_0x4baa27-0x0;var _0x506306=_0x990e[_0x4baa27];return _0x506306;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe990('0x0'));var rimraf=require(_0xe990('0x1'));var zipdir=require(_0xe990('0x2'));var jsonpatch=require(_0xe990('0x3'));var rp=require(_0xe990('0x4'));var moment=require(_0xe990('0x5'));var BPromise=require(_0xe990('0x6'));var Mustache=require(_0xe990('0x7'));var util=require(_0xe990('0x8'));var path=require(_0xe990('0x9'));var sox=require(_0xe990('0xa'));var csv=require(_0xe990('0xb'));var ejs=require(_0xe990('0xc'));var fs=require('fs');var _=require(_0xe990('0xd'));var squel=require(_0xe990('0xe'));var crypto=require(_0xe990('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe990('0xb'));var querystring=require(_0xe990('0x10'));var Papa=require(_0xe990('0x11'));var authService=require(_0xe990('0x12'));var hardwareService=require(_0xe990('0x13'));var Redis=require(_0xe990('0x14'));var qs=require('../../components/parsers/qs');var logger=require(_0xe990('0x15'))(_0xe990('0x16'));var utils=require(_0xe990('0x17'));var config=require(_0xe990('0x18'));var db=require(_0xe990('0x19'))['db'];function respondWithStatusCode(_0x433bbd,_0x50a357){_0x50a357=_0x50a357||0xcc;return function(_0x10f556){if(_0x10f556){return _0x433bbd['sendStatus'](_0x50a357);}return _0x433bbd['status'](_0x50a357)[_0xe990('0x1a')]();};}function respondWithResult(_0x5c1600,_0x52d1eb){_0x52d1eb=_0x52d1eb||0xc8;return function(_0x2e8938){if(_0x2e8938){return _0x5c1600[_0xe990('0x1b')](_0x52d1eb)['json'](_0x2e8938);}};}function respondWithFilteredResult(_0x339804,_0x142dde){return function(_0x11882c){if(_0x11882c){var _0x1314f6=_0x11882c['count'],_0x2d4fc8=_0x142dde['offset'],_0x1418c9=_0x142dde[_0xe990('0x1c')]+_0x142dde[_0xe990('0x1d')],_0x4e553c;if(_0x1418c9>=_0x1314f6){_0x1418c9=_0x1314f6;_0x4e553c=0xc8;}else{_0x4e553c=0xce;}_0x339804[_0xe990('0x1b')](_0x4e553c);return _0x339804[_0xe990('0x1e')](_0xe990('0x1f'),_0x2d4fc8+'-'+_0x1418c9+'/'+_0x1314f6)['json'](_0x11882c);}return null;};}function patchUpdates(_0x597dda){return function(_0x4a43c0){try{jsonpatch[_0xe990('0x20')](_0x4a43c0,_0x597dda,!![]);}catch(_0x47f151){return BPromise[_0xe990('0x21')](_0x47f151);}return _0x4a43c0[_0xe990('0x22')]();};}function saveUpdates(_0x1a5331,_0x1e12bf){return function(_0x5894b9){if(_0x5894b9){return _0x5894b9[_0xe990('0x23')](_0x1a5331)[_0xe990('0x24')](function(_0x294663){return _0x294663;});}return null;};}function removeEntity(_0x478729,_0x268f63){return function(_0xfd1a64){if(_0xfd1a64){return _0xfd1a64[_0xe990('0x25')]()[_0xe990('0x24')](function(){_0x478729[_0xe990('0x1b')](0xcc)[_0xe990('0x1a')]();});}};}function handleEntityNotFound(_0xe8ccb9,_0xa3fccb){return function(_0x39bcfa){if(!_0x39bcfa){_0xe8ccb9[_0xe990('0x26')](0x194);}return _0x39bcfa;};}function handleError(_0x21614a,_0x75f067){_0x75f067=_0x75f067||0x1f4;return function(_0x59bbb1){logger['error'](_0x59bbb1[_0xe990('0x27')]);if(_0x59bbb1[_0xe990('0x28')]){delete _0x59bbb1['name'];}_0x21614a['status'](_0x75f067)[_0xe990('0x29')](_0x59bbb1);};}exports[_0xe990('0x2a')]=function(_0x278d47,_0x3424f6){var _0x5b9bf5={},_0x3397ed={},_0x2c866d={'count':0x0,'rows':[]};var _0x2f9937=db['SmsApplication'][_0xe990('0x2b')];_0x3397ed[_0xe990('0x2c')]=_[_0xe990('0x2d')](_0x2f9937);_0x3397ed[_0xe990('0x2e')]=_[_0xe990('0x2d')](_0x278d47[_0xe990('0x2e')]);_0x3397ed['filters']=_[_0xe990('0x2f')](_0x3397ed[_0xe990('0x2c')],_0x3397ed[_0xe990('0x2e')]);_0x5b9bf5[_0xe990('0x30')]=_[_0xe990('0x2f')](_0x3397ed[_0xe990('0x2c')],qs[_0xe990('0x31')](_0x278d47[_0xe990('0x2e')][_0xe990('0x31')]));_0x5b9bf5[_0xe990('0x30')]=_0x5b9bf5[_0xe990('0x30')][_0xe990('0x32')]?_0x5b9bf5['attributes']:_0x3397ed[_0xe990('0x2c')];if(!_0x278d47[_0xe990('0x2e')]['hasOwnProperty'](_0xe990('0x33'))){_0x5b9bf5[_0xe990('0x1d')]=qs[_0xe990('0x1d')](_0x278d47[_0xe990('0x2e')][_0xe990('0x1d')]);_0x5b9bf5[_0xe990('0x1c')]=qs[_0xe990('0x1c')](_0x278d47[_0xe990('0x2e')][_0xe990('0x1c')]);}_0x5b9bf5[_0xe990('0x34')]=qs[_0xe990('0x35')](_0x278d47[_0xe990('0x2e')]['sort']);_0x5b9bf5[_0xe990('0x36')]=qs[_0xe990('0x37')](_[_0xe990('0x38')](_0x278d47[_0xe990('0x2e')],_0x3397ed['filters']));if(_0x278d47[_0xe990('0x2e')][_0xe990('0x39')]){_0x5b9bf5[_0xe990('0x36')]=_[_0xe990('0x3a')](_0x5b9bf5[_0xe990('0x36')],{'$or':_[_0xe990('0x3b')](_0x2f9937,function(_0x485058){if(_0x485058[_0xe990('0x3c')][_0xe990('0x3d')]!==_0xe990('0x3e')){var _0x163b42={};_0x163b42[_0x485058[_0xe990('0x3f')]]={'$like':'%'+_0x278d47[_0xe990('0x2e')][_0xe990('0x39')]+'%'};return _0x163b42;}})});}_0x5b9bf5=_['merge']({},_0x5b9bf5,_0x278d47['options']);var _0x3f7857={'where':_0x5b9bf5['where']};return db[_0xe990('0x40')][_0xe990('0x41')](_0x3f7857)[_0xe990('0x24')](function(_0xcacf73){_0x2c866d[_0xe990('0x41')]=_0xcacf73;if(_0x278d47['query'][_0xe990('0x42')]){_0x5b9bf5[_0xe990('0x43')]=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x5b9bf5);})[_0xe990('0x24')](function(_0xb801c0){_0x2c866d['rows']=_0xb801c0;return _0x2c866d;})[_0xe990('0x24')](respondWithFilteredResult(_0x3424f6,_0x5b9bf5))[_0xe990('0x44')](handleError(_0x3424f6,null));};exports[_0xe990('0x45')]=function(_0x1c8c58,_0x56ec38){var _0x166b30={'raw':!![],'where':{'id':_0x1c8c58[_0xe990('0x46')]['id']}},_0x533914={};_0x533914[_0xe990('0x2c')]=_[_0xe990('0x2d')](db['SmsApplication']['rawAttributes']);_0x533914[_0xe990('0x2e')]=_[_0xe990('0x2d')](_0x1c8c58['query']);_0x533914[_0xe990('0x37')]=_[_0xe990('0x2f')](_0x533914['model'],_0x533914['query']);_0x166b30['attributes']=_[_0xe990('0x2f')](_0x533914[_0xe990('0x2c')],qs[_0xe990('0x31')](_0x1c8c58['query'][_0xe990('0x31')]));_0x166b30[_0xe990('0x30')]=_0x166b30[_0xe990('0x30')]['length']?_0x166b30['attributes']:_0x533914[_0xe990('0x2c')];if(_0x1c8c58[_0xe990('0x2e')][_0xe990('0x42')]){_0x166b30[_0xe990('0x43')]=[{'all':!![]}];}_0x166b30=_['merge']({},_0x166b30,_0x1c8c58[_0xe990('0x47')]);return db[_0xe990('0x40')][_0xe990('0x48')](_0x166b30)['then'](handleEntityNotFound(_0x56ec38,null))['then'](respondWithResult(_0x56ec38,null))[_0xe990('0x44')](handleError(_0x56ec38,null));};exports[_0xe990('0x49')]=function(_0x3bfcbe,_0x595f8d){return db[_0xe990('0x40')][_0xe990('0x49')](_0x3bfcbe[_0xe990('0x4a')],{})[_0xe990('0x24')](respondWithResult(_0x595f8d,0xc9))['catch'](handleError(_0x595f8d,null));};exports[_0xe990('0x23')]=function(_0x3fb3b1,_0x55b453){if(_0x3fb3b1[_0xe990('0x4a')]['id']){delete _0x3fb3b1['body']['id'];}return db[_0xe990('0x40')]['find']({'where':{'id':_0x3fb3b1[_0xe990('0x46')]['id']}})[_0xe990('0x24')](handleEntityNotFound(_0x55b453,null))[_0xe990('0x24')](saveUpdates(_0x3fb3b1[_0xe990('0x4a')],null))[_0xe990('0x24')](respondWithResult(_0x55b453,null))[_0xe990('0x44')](handleError(_0x55b453,null));};exports[_0xe990('0x25')]=function(_0x43c8a6,_0x26f638){return db[_0xe990('0x40')]['find']({'where':{'id':_0x43c8a6[_0xe990('0x46')]['id']}})['then'](handleEntityNotFound(_0x26f638,null))[_0xe990('0x24')](removeEntity(_0x26f638,null))['catch'](handleError(_0x26f638,null));}; \ No newline at end of file +var _0x1f0e=['count','offset','limit','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','SmsApplication','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','filters','pick','filter','merge','map','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','update','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end','json'];(function(_0x3c962e,_0x47fda7){var _0x4faabb=function(_0x1fa027){while(--_0x1fa027){_0x3c962e['push'](_0x3c962e['shift']());}};_0x4faabb(++_0x47fda7);}(_0x1f0e,0x15a));var _0xe1f0=function(_0x4e574f,_0x427025){_0x4e574f=_0x4e574f-0x0;var _0x3f05fa=_0x1f0e[_0x4e574f];return _0x3f05fa;};'use strict';var pdf=require(_0xe1f0('0x0'));var emlformat=require(_0xe1f0('0x1'));var rimraf=require(_0xe1f0('0x2'));var zipdir=require(_0xe1f0('0x3'));var jsonpatch=require(_0xe1f0('0x4'));var rp=require(_0xe1f0('0x5'));var moment=require(_0xe1f0('0x6'));var BPromise=require(_0xe1f0('0x7'));var Mustache=require('mustache');var util=require(_0xe1f0('0x8'));var path=require(_0xe1f0('0x9'));var sox=require(_0xe1f0('0xa'));var csv=require(_0xe1f0('0xb'));var ejs=require(_0xe1f0('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe1f0('0xd'));var crypto=require('crypto');var jsforce=require(_0xe1f0('0xe'));var deskjs=require(_0xe1f0('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe1f0('0x10'));var Papa=require(_0xe1f0('0x11'));var authService=require(_0xe1f0('0x12'));var hardwareService=require(_0xe1f0('0x13'));var Redis=require(_0xe1f0('0x14'));var qs=require(_0xe1f0('0x15'));var logger=require(_0xe1f0('0x16'))(_0xe1f0('0x17'));var utils=require(_0xe1f0('0x18'));var config=require(_0xe1f0('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ea634,_0x261162){_0x261162=_0x261162||0xcc;return function(_0x473de3){if(_0x473de3){return _0x4ea634['sendStatus'](_0x261162);}return _0x4ea634[_0xe1f0('0x1a')](_0x261162)[_0xe1f0('0x1b')]();};}function respondWithResult(_0x3709a2,_0x6ee534){_0x6ee534=_0x6ee534||0xc8;return function(_0xb298df){if(_0xb298df){return _0x3709a2[_0xe1f0('0x1a')](_0x6ee534)[_0xe1f0('0x1c')](_0xb298df);}};}function respondWithFilteredResult(_0x5e0f6a,_0x2cf709){return function(_0x1ffd70){if(_0x1ffd70){var _0x51c072=_0x1ffd70[_0xe1f0('0x1d')],_0x34e99b=_0x2cf709[_0xe1f0('0x1e')],_0x18177e=_0x2cf709[_0xe1f0('0x1e')]+_0x2cf709[_0xe1f0('0x1f')],_0x3c23af;if(_0x18177e>=_0x51c072){_0x18177e=_0x51c072;_0x3c23af=0xc8;}else{_0x3c23af=0xce;}_0x5e0f6a['status'](_0x3c23af);return _0x5e0f6a['set'](_0xe1f0('0x20'),_0x34e99b+'-'+_0x18177e+'/'+_0x51c072)[_0xe1f0('0x1c')](_0x1ffd70);}return null;};}function patchUpdates(_0x1479d8){return function(_0x2e3084){try{jsonpatch[_0xe1f0('0x21')](_0x2e3084,_0x1479d8,!![]);}catch(_0x241a44){return BPromise[_0xe1f0('0x22')](_0x241a44);}return _0x2e3084[_0xe1f0('0x23')]();};}function saveUpdates(_0x12f72b,_0xa1cb46){return function(_0x1ba379){if(_0x1ba379){return _0x1ba379['update'](_0x12f72b)[_0xe1f0('0x24')](function(_0x1a0c16){return _0x1a0c16;});}return null;};}function removeEntity(_0x1d62b7,_0x1647bc){return function(_0x3132a6){if(_0x3132a6){return _0x3132a6[_0xe1f0('0x25')]()[_0xe1f0('0x24')](function(){_0x1d62b7[_0xe1f0('0x1a')](0xcc)[_0xe1f0('0x1b')]();});}};}function handleEntityNotFound(_0x1ef848,_0x16e68a){return function(_0x598107){if(!_0x598107){_0x1ef848[_0xe1f0('0x26')](0x194);}return _0x598107;};}function handleError(_0x405f38,_0x12dc56){_0x12dc56=_0x12dc56||0x1f4;return function(_0x67c19){logger[_0xe1f0('0x27')](_0x67c19[_0xe1f0('0x28')]);if(_0x67c19[_0xe1f0('0x29')]){delete _0x67c19['name'];}_0x405f38[_0xe1f0('0x1a')](_0x12dc56)[_0xe1f0('0x2a')](_0x67c19);};}exports[_0xe1f0('0x2b')]=function(_0x7d9189,_0x1df728){var _0x3dfa22={},_0x3408b1={},_0x123edf={'count':0x0,'rows':[]};var _0x18a048=db[_0xe1f0('0x2c')]['rawAttributes'];_0x3408b1['model']=_[_0xe1f0('0x2d')](_0x18a048);_0x3408b1[_0xe1f0('0x2e')]=_[_0xe1f0('0x2d')](_0x7d9189['query']);_0x3408b1['filters']=_[_0xe1f0('0x2f')](_0x3408b1[_0xe1f0('0x30')],_0x3408b1[_0xe1f0('0x2e')]);_0x3dfa22[_0xe1f0('0x31')]=_[_0xe1f0('0x2f')](_0x3408b1['model'],qs[_0xe1f0('0x32')](_0x7d9189['query'][_0xe1f0('0x32')]));_0x3dfa22[_0xe1f0('0x31')]=_0x3dfa22['attributes'][_0xe1f0('0x33')]?_0x3dfa22[_0xe1f0('0x31')]:_0x3408b1[_0xe1f0('0x30')];if(!_0x7d9189[_0xe1f0('0x2e')][_0xe1f0('0x34')](_0xe1f0('0x35'))){_0x3dfa22[_0xe1f0('0x1f')]=qs[_0xe1f0('0x1f')](_0x7d9189[_0xe1f0('0x2e')][_0xe1f0('0x1f')]);_0x3dfa22[_0xe1f0('0x1e')]=qs[_0xe1f0('0x1e')](_0x7d9189[_0xe1f0('0x2e')][_0xe1f0('0x1e')]);}_0x3dfa22['order']=qs['sort'](_0x7d9189[_0xe1f0('0x2e')]['sort']);_0x3dfa22[_0xe1f0('0x36')]=qs[_0xe1f0('0x37')](_[_0xe1f0('0x38')](_0x7d9189[_0xe1f0('0x2e')],_0x3408b1[_0xe1f0('0x37')]));if(_0x7d9189['query'][_0xe1f0('0x39')]){_0x3dfa22[_0xe1f0('0x36')]=_[_0xe1f0('0x3a')](_0x3dfa22[_0xe1f0('0x36')],{'$or':_[_0xe1f0('0x3b')](_0x18a048,function(_0x435a27){if(_0x435a27['type'][_0xe1f0('0x3c')]!==_0xe1f0('0x3d')){var _0x49c989={};_0x49c989[_0x435a27[_0xe1f0('0x3e')]]={'$like':'%'+_0x7d9189[_0xe1f0('0x2e')]['filter']+'%'};return _0x49c989;}})});}_0x3dfa22=_[_0xe1f0('0x3a')]({},_0x3dfa22,_0x7d9189[_0xe1f0('0x3f')]);var _0x808114={'where':_0x3dfa22[_0xe1f0('0x36')]};return db[_0xe1f0('0x2c')][_0xe1f0('0x1d')](_0x808114)[_0xe1f0('0x24')](function(_0xd29ddd){_0x123edf[_0xe1f0('0x1d')]=_0xd29ddd;if(_0x7d9189[_0xe1f0('0x2e')][_0xe1f0('0x40')]){_0x3dfa22[_0xe1f0('0x41')]=[{'all':!![]}];}return db[_0xe1f0('0x2c')][_0xe1f0('0x42')](_0x3dfa22);})[_0xe1f0('0x24')](function(_0xf96955){_0x123edf[_0xe1f0('0x43')]=_0xf96955;return _0x123edf;})['then'](respondWithFilteredResult(_0x1df728,_0x3dfa22))[_0xe1f0('0x44')](handleError(_0x1df728,null));};exports[_0xe1f0('0x45')]=function(_0x13896b,_0x44937b){var _0x37690e={'raw':!![],'where':{'id':_0x13896b['params']['id']}},_0x4393f8={};_0x4393f8[_0xe1f0('0x30')]=_[_0xe1f0('0x2d')](db[_0xe1f0('0x2c')][_0xe1f0('0x46')]);_0x4393f8['query']=_[_0xe1f0('0x2d')](_0x13896b[_0xe1f0('0x2e')]);_0x4393f8[_0xe1f0('0x37')]=_['intersection'](_0x4393f8[_0xe1f0('0x30')],_0x4393f8['query']);_0x37690e[_0xe1f0('0x31')]=_[_0xe1f0('0x2f')](_0x4393f8[_0xe1f0('0x30')],qs[_0xe1f0('0x32')](_0x13896b[_0xe1f0('0x2e')]['fields']));_0x37690e['attributes']=_0x37690e[_0xe1f0('0x31')][_0xe1f0('0x33')]?_0x37690e[_0xe1f0('0x31')]:_0x4393f8[_0xe1f0('0x30')];if(_0x13896b['query'][_0xe1f0('0x40')]){_0x37690e[_0xe1f0('0x41')]=[{'all':!![]}];}_0x37690e=_['merge']({},_0x37690e,_0x13896b[_0xe1f0('0x3f')]);return db[_0xe1f0('0x2c')][_0xe1f0('0x47')](_0x37690e)[_0xe1f0('0x24')](handleEntityNotFound(_0x44937b,null))['then'](respondWithResult(_0x44937b,null))[_0xe1f0('0x44')](handleError(_0x44937b,null));};exports['create']=function(_0x539d99,_0x59c3db){return db[_0xe1f0('0x2c')]['create'](_0x539d99['body'],{})[_0xe1f0('0x24')](respondWithResult(_0x59c3db,0xc9))['catch'](handleError(_0x59c3db,null));};exports[_0xe1f0('0x48')]=function(_0xc95100,_0xd92b24){if(_0xc95100[_0xe1f0('0x49')]['id']){delete _0xc95100[_0xe1f0('0x49')]['id'];}return db['SmsApplication']['find']({'where':{'id':_0xc95100[_0xe1f0('0x4a')]['id']}})[_0xe1f0('0x24')](handleEntityNotFound(_0xd92b24,null))[_0xe1f0('0x24')](saveUpdates(_0xc95100[_0xe1f0('0x49')],null))[_0xe1f0('0x24')](respondWithResult(_0xd92b24,null))[_0xe1f0('0x44')](handleError(_0xd92b24,null));};exports['destroy']=function(_0x830e01,_0x2e7669){return db['SmsApplication'][_0xe1f0('0x47')]({'where':{'id':_0x830e01[_0xe1f0('0x4a')]['id']}})[_0xe1f0('0x24')](handleEntityNotFound(_0x2e7669,null))['then'](removeEntity(_0x2e7669,null))[_0xe1f0('0x44')](handleError(_0x2e7669,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index c86c3c2..ea36c3a 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 _0xafbb=['request-promise','exports','define','SmsApplication','sms_applications','lodash','../../config/logger','api','moment','bluebird'];(function(_0x430459,_0x58519c){var _0x3a2439=function(_0x27a0b3){while(--_0x27a0b3){_0x430459['push'](_0x430459['shift']());}};_0x3a2439(++_0x58519c);}(_0xafbb,0x1e5));var _0xbafb=function(_0x576307,_0x278c73){_0x576307=_0x576307-0x0;var _0x10f5ce=_0xafbb[_0x576307];return _0x10f5ce;};'use strict';var _=require(_0xbafb('0x0'));var util=require('util');var logger=require(_0xbafb('0x1'))(_0xbafb('0x2'));var moment=require(_0xbafb('0x3'));var BPromise=require(_0xbafb('0x4'));var rp=require(_0xbafb('0x5'));var attributes=require('./smsApplication.attributes');module[_0xbafb('0x6')]=function(_0x327f59,_0x4994aa){return _0x327f59[_0xbafb('0x7')](_0xbafb('0x8'),attributes,{'tableName':_0xbafb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x595b=['./smsApplication.attributes','exports','define','SmsApplication','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x454c65,_0xedb6f9){var _0x16e62e=function(_0x28f055){while(--_0x28f055){_0x454c65['push'](_0x454c65['shift']());}};_0x16e62e(++_0xedb6f9);}(_0x595b,0x1c6));var _0xb595=function(_0x2dbee2,_0x120681){_0x2dbee2=_0x2dbee2-0x0;var _0x4b6c6b=_0x595b[_0x2dbee2];return _0x4b6c6b;};'use strict';var _=require(_0xb595('0x0'));var util=require(_0xb595('0x1'));var logger=require(_0xb595('0x2'))(_0xb595('0x3'));var moment=require(_0xb595('0x4'));var BPromise=require(_0xb595('0x5'));var rp=require('request-promise');var attributes=require(_0xb595('0x6'));module[_0xb595('0x7')]=function(_0x1159e2,_0x272d12){return _0x1159e2[_0xb595('0x8')](_0xb595('0x9'),attributes,{'tableName':'sms_applications','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 563ed84..b863423 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 _0x8fbe=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','randomstring'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x8fbe,0x1d0));var _0xe8fb=function(_0xfb5856,_0x19a61b){_0xfb5856=_0xfb5856-0x0;var _0x4ea037=_0x8fbe[_0xfb5856];return _0x4ea037;};'use strict';var _=require(_0xe8fb('0x0'));var util=require(_0xe8fb('0x1'));var moment=require(_0xe8fb('0x2'));var BPromise=require('bluebird');var rs=require(_0xe8fb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe8fb('0x4'))['db'];var utils=require(_0xe8fb('0x5'));var logger=require(_0xe8fb('0x6'))('rpc');var config=require(_0xe8fb('0x7'));var jayson=require(_0xe8fb('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4aa631,_0x440815,_0x320c32){return new BPromise(function(_0x478750,_0x29fe55){return client['request'](_0x4aa631,_0x320c32)[_0xe8fb('0x9')](function(_0x55e019){logger['info'](_0xe8fb('0xa'),_0x440815,_0xe8fb('0xb'));logger[_0xe8fb('0xc')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x440815,_0xe8fb('0xb'),JSON[_0xe8fb('0xd')](_0x55e019));if(_0x55e019[_0xe8fb('0xe')]){if(_0x55e019[_0xe8fb('0xe')]['code']===0x1f4){logger['error'](_0xe8fb('0xa'),_0x440815,_0x55e019[_0xe8fb('0xe')][_0xe8fb('0xf')]);return _0x29fe55(_0x55e019[_0xe8fb('0xe')]['message']);}logger[_0xe8fb('0xe')](_0xe8fb('0xa'),_0x440815,_0x55e019[_0xe8fb('0xe')][_0xe8fb('0xf')]);return _0x478750(_0x55e019[_0xe8fb('0xe')][_0xe8fb('0xf')]);}else{logger['info'](_0xe8fb('0xa'),_0x440815,_0xe8fb('0xb'));_0x478750(_0x55e019[_0xe8fb('0x10')][_0xe8fb('0xf')]);}})[_0xe8fb('0x11')](function(_0x19873){logger[_0xe8fb('0xe')]('SmsApplication,\x20%s,\x20%s',_0x440815,_0x19873);_0x29fe55(_0x19873);});});} \ No newline at end of file +var _0xd59e=['info','result','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x460cdf,_0x26fa7c){var _0x522a88=function(_0x2712cd){while(--_0x2712cd){_0x460cdf['push'](_0x460cdf['shift']());}};_0x522a88(++_0x26fa7c);}(_0xd59e,0xaa));var _0xed59=function(_0x5ee37f,_0x264514){_0x5ee37f=_0x5ee37f-0x0;var _0x1d1de3=_0xd59e[_0x5ee37f];return _0x1d1de3;};'use strict';var _=require('lodash');var util=require(_0xed59('0x0'));var moment=require(_0xed59('0x1'));var BPromise=require(_0xed59('0x2'));var rs=require(_0xed59('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed59('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xed59('0x5'));var config=require(_0xed59('0x6'));var jayson=require(_0xed59('0x7'));var client=jayson[_0xed59('0x8')][_0xed59('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd05b27,_0x55204c,_0x3fd488){return new BPromise(function(_0x1733fb,_0x38125){return client['request'](_0xd05b27,_0x3fd488)[_0xed59('0xa')](function(_0x4fa087){logger['info'](_0xed59('0xb'),_0x55204c,_0xed59('0xc'));logger[_0xed59('0xd')](_0xed59('0xe'),_0x55204c,'request\x20sent',JSON[_0xed59('0xf')](_0x4fa087));if(_0x4fa087['error']){if(_0x4fa087[_0xed59('0x10')][_0xed59('0x11')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x55204c,_0x4fa087['error'][_0xed59('0x12')]);return _0x38125(_0x4fa087[_0xed59('0x10')][_0xed59('0x12')]);}logger[_0xed59('0x10')]('SmsApplication,\x20%s,\x20%s',_0x55204c,_0x4fa087[_0xed59('0x10')][_0xed59('0x12')]);return _0x1733fb(_0x4fa087[_0xed59('0x10')]['message']);}else{logger[_0xed59('0x13')](_0xed59('0xb'),_0x55204c,_0xed59('0xc'));_0x1733fb(_0x4fa087[_0xed59('0x14')][_0xed59('0x12')]);}})['catch'](function(_0x41fab7){logger[_0xed59('0x10')](_0xed59('0xb'),_0x55204c,_0x41fab7);_0x38125(_0x41fab7);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 923a9ed..7826e5c 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 _0xb9f1=['get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','addMessage','/:id/tags','tracked','smsinteraction:addtags','addTags','put','sms','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','./smsInteraction.controller'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xb9f1,0x126));var _0x1b9f=function(_0x2fc5cb,_0x24a453){_0x2fc5cb=_0x2fc5cb-0x0;var _0x3c0b24=_0xb9f1[_0x2fc5cb];return _0x3c0b24;};'use strict';var multer=require(_0x1b9f('0x0'));var util=require('util');var path=require(_0x1b9f('0x1'));var timeout=require(_0x1b9f('0x2'));var express=require(_0x1b9f('0x3'));var router=express[_0x1b9f('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1b9f('0x5'));router[_0x1b9f('0x6')]('/',auth['isAuthenticated'](),controller[_0x1b9f('0x7')]);router[_0x1b9f('0x6')](_0x1b9f('0x8'),auth[_0x1b9f('0x9')](),controller[_0x1b9f('0xa')]);router['get'](_0x1b9f('0xb'),auth[_0x1b9f('0x9')](),controller[_0x1b9f('0xc')]);router[_0x1b9f('0x6')](_0x1b9f('0xd'),auth[_0x1b9f('0x9')](),controller[_0x1b9f('0xe')]);router[_0x1b9f('0x6')](_0x1b9f('0xf'),auth[_0x1b9f('0x9')](),controller[_0x1b9f('0x10')]);router['post']('/',auth[_0x1b9f('0x9')](),controller['create']);router['post'](_0x1b9f('0xd'),auth[_0x1b9f('0x9')](),controller[_0x1b9f('0x11')]);router['post'](_0x1b9f('0x12'),auth[_0x1b9f('0x9')](),interaction[_0x1b9f('0x13')]('sms',_0x1b9f('0x14')),controller[_0x1b9f('0x15')]);router[_0x1b9f('0x16')]('/:id',auth[_0x1b9f('0x9')](),interaction[_0x1b9f('0x13')](_0x1b9f('0x17'),'smsinteraction:update'),controller[_0x1b9f('0x18')]);router[_0x1b9f('0x19')](_0x1b9f('0xb'),auth['isAuthenticated'](),interaction[_0x1b9f('0x13')](_0x1b9f('0x17'),_0x1b9f('0x1a')),controller[_0x1b9f('0x1b')]);router[_0x1b9f('0x19')](_0x1b9f('0x12'),auth[_0x1b9f('0x9')](),controller[_0x1b9f('0x1c')]);module[_0x1b9f('0x1d')]=router; \ No newline at end of file +var _0xefa4=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/messages','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','smsinteraction:destroy','destroy','removeTags'];(function(_0x231d64,_0x4107b5){var _0x50ba03=function(_0x43a547){while(--_0x43a547){_0x231d64['push'](_0x231d64['shift']());}};_0x50ba03(++_0x4107b5);}(_0xefa4,0xb4));var _0x4efa=function(_0x54356f,_0x529ada){_0x54356f=_0x54356f-0x0;var _0xde684d=_0xefa4[_0x54356f];return _0xde684d;};'use strict';var multer=require(_0x4efa('0x0'));var util=require(_0x4efa('0x1'));var path=require(_0x4efa('0x2'));var timeout=require(_0x4efa('0x3'));var express=require(_0x4efa('0x4'));var router=express[_0x4efa('0x5')]();var auth=require(_0x4efa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4efa('0x7'));var controller=require(_0x4efa('0x8'));router['get']('/',auth[_0x4efa('0x9')](),controller['index']);router[_0x4efa('0xa')](_0x4efa('0xb'),auth[_0x4efa('0x9')](),controller[_0x4efa('0xc')]);router[_0x4efa('0xa')](_0x4efa('0xd'),auth['isAuthenticated'](),controller[_0x4efa('0xe')]);router['get'](_0x4efa('0xf'),auth[_0x4efa('0x9')](),controller['getMessages']);router[_0x4efa('0xa')]('/:id/download',auth[_0x4efa('0x9')](),controller['download']);router[_0x4efa('0x10')]('/',auth[_0x4efa('0x9')](),controller[_0x4efa('0x11')]);router['post'](_0x4efa('0xf'),auth[_0x4efa('0x9')](),controller[_0x4efa('0x12')]);router[_0x4efa('0x10')](_0x4efa('0x13'),auth['isAuthenticated'](),interaction[_0x4efa('0x14')](_0x4efa('0x15'),_0x4efa('0x16')),controller[_0x4efa('0x17')]);router[_0x4efa('0x18')]('/:id',auth[_0x4efa('0x9')](),interaction['tracked'](_0x4efa('0x15'),_0x4efa('0x19')),controller['update']);router[_0x4efa('0x1a')]('/:id',auth[_0x4efa('0x9')](),interaction[_0x4efa('0x14')](_0x4efa('0x15'),_0x4efa('0x1b')),controller[_0x4efa('0x1c')]);router[_0x4efa('0x1a')](_0x4efa('0x13'),auth[_0x4efa('0x9')](),controller[_0x4efa('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index e0c3229..48f8ef9 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 _0xd3ce=['STRING','ENUM','out','sequelize','DATE'];(function(_0x380d90,_0x4f711d){var _0x1ff262=function(_0x4c2b9b){while(--_0x4c2b9b){_0x380d90['push'](_0x380d90['shift']());}};_0x1ff262(++_0x4f711d);}(_0xd3ce,0xb2));var _0xed3c=function(_0x1df9ff,_0x18339d){_0x1df9ff=_0x1df9ff-0x0;var _0x2cfb8b=_0xd3ce[_0x1df9ff];return _0x2cfb8b;};'use strict';var Sequelize=require(_0xed3c('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xed3c('0x1')]},'disposition':{'type':Sequelize[_0xed3c('0x2')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xed3c('0x2')]},'read1stAt':{'type':Sequelize[_0xed3c('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xed3c('0x3')]('in',_0xed3c('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xed3c('0x3')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x41be=['ENUM','out','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x54e902,_0x35d122){var _0x1f75f6=function(_0x2f2ed4){while(--_0x2f2ed4){_0x54e902['push'](_0x54e902['shift']());}};_0x1f75f6(++_0x35d122);}(_0x41be,0xe9));var _0xe41b=function(_0x2df2d0,_0x1d6ea8){_0x2df2d0=_0x2df2d0-0x0;var _0x3c4438=_0x41be[_0x2df2d0];return _0x3c4438;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe41b('0x0'));module[_0xe41b('0x1')]={'closed':{'type':Sequelize[_0xe41b('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe41b('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe41b('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xe41b('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe41b('0x5')]('in',_0xe41b('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe41b('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xe41b('0x5')]('in',_0xe41b('0x6')),'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 fd38b90..da85585 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 _0xd882=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','map','type','VIRTUAL','filter','options','include','tag','Tag','distinct','read','push','Messages','direction','createdAt','includeAll','User','Users','fullname','CmContact','Contact','internal','Account','SmsMessage','color','ThroughTags','findAll','catch','show','params','find','create','body','destroy','describe','addMessage','ids','findOne','order','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','smsInteractionTags:save','removeTags','download','unix','toString','join','server','root','attachments','format','interaction-%s.zip','Letter','1cm','mkdirSync','

Date:\x20%s

','MMMM\x20Do\x20YYYY,\x20HH:mm:ss','
','','%s:\x20%s

','firstName','','toFile','interaction-','.pdf','log','err','html-pdf','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','count','offset','limit','set','Content-Range','json','save','update','then','sendStatus','error','name','send','index','SmsInteraction','model','keys','query','filters','intersection'];(function(_0x2c46e0,_0x5e177b){var _0x4cb6b8=function(_0x2d7f9b){while(--_0x2d7f9b){_0x2c46e0['push'](_0x2c46e0['shift']());}};_0x4cb6b8(++_0x5e177b);}(_0xd882,0xd1));var _0x2d88=function(_0x10e870,_0x4c4324){_0x10e870=_0x10e870-0x0;var _0x29b93d=_0xd882[_0x10e870];return _0x29b93d;};'use strict';var pdf=require(_0x2d88('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2d88('0x1'));var zipdir=require(_0x2d88('0x2'));var jsonpatch=require(_0x2d88('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2d88('0x4'));var path=require(_0x2d88('0x5'));var sox=require(_0x2d88('0x6'));var csv=require(_0x2d88('0x7'));var ejs=require(_0x2d88('0x8'));var fs=require('fs');var _=require(_0x2d88('0x9'));var squel=require(_0x2d88('0xa'));var crypto=require(_0x2d88('0xb'));var jsforce=require(_0x2d88('0xc'));var deskjs=require(_0x2d88('0xd'));var toCsv=require(_0x2d88('0x7'));var querystring=require(_0x2d88('0xe'));var Papa=require(_0x2d88('0xf'));var authService=require(_0x2d88('0x10'));var hardwareService=require(_0x2d88('0x11'));var Redis=require(_0x2d88('0x12'));var qs=require(_0x2d88('0x13'));var logger=require(_0x2d88('0x14'))(_0x2d88('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2d88('0x16'))['db'];config[_0x2d88('0x17')]=_[_0x2d88('0x18')](config[_0x2d88('0x17')],{'host':_0x2d88('0x19'),'port':0x18eb});var socket=require(_0x2d88('0x1a'))(new Redis(config[_0x2d88('0x17')]));require(_0x2d88('0x1b'))[_0x2d88('0x1c')](socket);function respondWithStatusCode(_0x54f3b3,_0xf41ec){_0xf41ec=_0xf41ec||0xcc;return function(_0x466b75){if(_0x466b75){return _0x54f3b3['sendStatus'](_0xf41ec);}return _0x54f3b3[_0x2d88('0x1d')](_0xf41ec)[_0x2d88('0x1e')]();};}function respondWithResult(_0x1c27c6,_0x2b5e18){_0x2b5e18=_0x2b5e18||0xc8;return function(_0x396ddd){if(_0x396ddd){return _0x1c27c6[_0x2d88('0x1d')](_0x2b5e18)['json'](_0x396ddd);}};}function respondWithFilteredResult(_0x50061f,_0x551ef8){return function(_0x55131f){if(_0x55131f){var _0x4c370c=_0x55131f[_0x2d88('0x1f')],_0x3e5db=_0x551ef8[_0x2d88('0x20')],_0x359edb=_0x551ef8[_0x2d88('0x20')]+_0x551ef8[_0x2d88('0x21')],_0x1896db;if(_0x359edb>=_0x4c370c){_0x359edb=_0x4c370c;_0x1896db=0xc8;}else{_0x1896db=0xce;}_0x50061f[_0x2d88('0x1d')](_0x1896db);return _0x50061f[_0x2d88('0x22')](_0x2d88('0x23'),_0x3e5db+'-'+_0x359edb+'/'+_0x4c370c)[_0x2d88('0x24')](_0x55131f);}return null;};}function patchUpdates(_0x196ea5){return function(_0x148b1d){try{jsonpatch['apply'](_0x148b1d,_0x196ea5,!![]);}catch(_0x2f521d){return BPromise['reject'](_0x2f521d);}return _0x148b1d[_0x2d88('0x25')]();};}function saveUpdates(_0x30e73b,_0x1e57f7){return function(_0x6f9339){if(_0x6f9339){return _0x6f9339[_0x2d88('0x26')](_0x30e73b)[_0x2d88('0x27')](function(_0x52f52f){return _0x52f52f;});}return null;};}function removeEntity(_0xb7adea,_0x5110f6){return function(_0x23e137){if(_0x23e137){return _0x23e137['destroy']()['then'](function(){_0xb7adea[_0x2d88('0x1d')](0xcc)[_0x2d88('0x1e')]();});}};}function handleEntityNotFound(_0x12689c,_0x114585){return function(_0x5de4c6){if(!_0x5de4c6){_0x12689c[_0x2d88('0x28')](0x194);}return _0x5de4c6;};}function handleError(_0x5e96a8,_0x1e2ed2){_0x1e2ed2=_0x1e2ed2||0x1f4;return function(_0x4681ab){logger[_0x2d88('0x29')](_0x4681ab['stack']);if(_0x4681ab['name']){delete _0x4681ab[_0x2d88('0x2a')];}_0x5e96a8[_0x2d88('0x1d')](_0x1e2ed2)[_0x2d88('0x2b')](_0x4681ab);};}exports[_0x2d88('0x2c')]=function(_0x1ef089,_0x2466ea){var _0x36828e={},_0x52d183={},_0x2419db={'count':0x0,'rows':[]};var _0x36f93c=db[_0x2d88('0x2d')]['rawAttributes'];_0x52d183[_0x2d88('0x2e')]=_[_0x2d88('0x2f')](_0x36f93c);_0x52d183[_0x2d88('0x30')]=_[_0x2d88('0x2f')](_0x1ef089[_0x2d88('0x30')]);_0x52d183[_0x2d88('0x31')]=_[_0x2d88('0x32')](_0x52d183[_0x2d88('0x2e')],_0x52d183[_0x2d88('0x30')]);_0x36828e[_0x2d88('0x33')]=_[_0x2d88('0x32')](_0x52d183[_0x2d88('0x2e')],qs[_0x2d88('0x34')](_0x1ef089[_0x2d88('0x30')][_0x2d88('0x34')]));_0x36828e['attributes']=_0x36828e[_0x2d88('0x33')][_0x2d88('0x35')]?_0x36828e[_0x2d88('0x33')]:_0x52d183[_0x2d88('0x2e')];if(!_0x1ef089[_0x2d88('0x30')][_0x2d88('0x36')](_0x2d88('0x37'))){_0x36828e['limit']=qs[_0x2d88('0x21')](_0x1ef089[_0x2d88('0x30')][_0x2d88('0x21')]);_0x36828e['offset']=qs[_0x2d88('0x20')](_0x1ef089[_0x2d88('0x30')][_0x2d88('0x20')]);}_0x36828e['order']=qs[_0x2d88('0x38')](_0x1ef089[_0x2d88('0x30')][_0x2d88('0x38')]);_0x36828e[_0x2d88('0x39')]=qs[_0x2d88('0x31')](_[_0x2d88('0x3a')](_0x1ef089['query'],_0x52d183[_0x2d88('0x31')]));if(_0x1ef089[_0x2d88('0x30')]['filter']){_0x36828e[_0x2d88('0x39')]=_[_0x2d88('0x3b')](_0x36828e[_0x2d88('0x39')],{'$or':_[_0x2d88('0x3c')](_0x36f93c,function(_0x1147b9){if(_0x1147b9[_0x2d88('0x3d')]['key']!==_0x2d88('0x3e')){var _0x21c7fd={};_0x21c7fd[_0x1147b9['field']]={'$like':'%'+_0x1ef089['query'][_0x2d88('0x3f')]+'%'};return _0x21c7fd;}})});}_0x36828e=_['merge']({},_0x36828e,_0x1ef089[_0x2d88('0x40')]);var _0x342026={'where':_0x36828e[_0x2d88('0x39')]};_0x342026[_0x2d88('0x41')]=[];if(_0x1ef089[_0x2d88('0x30')][_0x2d88('0x42')]){_0x342026['include']['push']({'model':db[_0x2d88('0x43')],'as':'Tags','attributes':['id'],'where':{'id':_0x1ef089[_0x2d88('0x30')][_0x2d88('0x42')]},'required':!![]});_0x342026[_0x2d88('0x44')]=!![];}if(_0x1ef089[_0x2d88('0x30')][_0x2d88('0x45')]){_0x342026[_0x2d88('0x41')][_0x2d88('0x46')]({'model':db['SmsMessage'],'as':_0x2d88('0x47'),'attributes':['id',_0x2d88('0x48'),_0x2d88('0x49'),_0x2d88('0x45')],'where':{'direction':'in','read':_0x1ef089['query'][_0x2d88('0x45')]||![]},'required':!![]});_0x342026['distinct']=!![];}return db[_0x2d88('0x2d')]['count'](_0x342026)['then'](function(_0x40c8ed){_0x2419db[_0x2d88('0x1f')]=_0x40c8ed;if(_0x1ef089[_0x2d88('0x30')][_0x2d88('0x4a')]){_0x36828e['include']=[{'model':db[_0x2d88('0x4b')],'as':_0x2d88('0x4c'),'required':![],'attributes':['id',_0x2d88('0x2a'),_0x2d88('0x4d')]},{'model':db[_0x2d88('0x4e')],'as':_0x2d88('0x4f'),'required':![]},{'model':db[_0x2d88('0x4b')],'as':'Owner','attributes':[_0x2d88('0x2a'),_0x2d88('0x4d'),_0x2d88('0x50')],'required':![]},{'model':db['SmsAccount'],'as':_0x2d88('0x51'),'attributes':[_0x2d88('0x2a'),'key'],'required':![]},{'model':db[_0x2d88('0x52')],'as':_0x2d88('0x47'),'attributes':['id',_0x2d88('0x48'),_0x2d88('0x49'),_0x2d88('0x45')],'where':{'direction':'in','read':_0x1ef089[_0x2d88('0x30')][_0x2d88('0x45')]||![]},'required':_0x1ef089[_0x2d88('0x30')]['read']||![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x2d88('0x2a'),_0x2d88('0x53')],'required':_0x1ef089['query'][_0x2d88('0x42')]?!![]:![]},{'model':db[_0x2d88('0x43')],'as':_0x2d88('0x54'),'attributes':['id',_0x2d88('0x2a'),_0x2d88('0x53')],'through':_0x1ef089[_0x2d88('0x30')][_0x2d88('0x42')]?{'attributes':[],'where':{'TagId':_0x1ef089[_0x2d88('0x30')]['tag']||undefined}}:{},'required':_0x1ef089[_0x2d88('0x30')][_0x2d88('0x42')]?!![]:![]}];}return db[_0x2d88('0x2d')][_0x2d88('0x55')](_0x36828e);})[_0x2d88('0x27')](function(_0x594c59){_0x2419db['rows']=_0x594c59;return _0x2419db;})[_0x2d88('0x27')](respondWithFilteredResult(_0x2466ea,_0x36828e))[_0x2d88('0x56')](handleError(_0x2466ea,null));};exports[_0x2d88('0x57')]=function(_0x2ee8b1,_0x5c7ae8){var _0x7f8897={'raw':![],'where':{'id':_0x2ee8b1[_0x2d88('0x58')]['id']}},_0x517249={};_0x517249['model']=_[_0x2d88('0x2f')](db[_0x2d88('0x2d')]['rawAttributes']);_0x517249['query']=_[_0x2d88('0x2f')](_0x2ee8b1['query']);_0x517249['filters']=_[_0x2d88('0x32')](_0x517249[_0x2d88('0x2e')],_0x517249['query']);_0x7f8897[_0x2d88('0x33')]=_[_0x2d88('0x32')](_0x517249[_0x2d88('0x2e')],qs['fields'](_0x2ee8b1[_0x2d88('0x30')][_0x2d88('0x34')]));_0x7f8897['attributes']=_0x7f8897[_0x2d88('0x33')][_0x2d88('0x35')]?_0x7f8897['attributes']:_0x517249['model'];if(_0x2ee8b1[_0x2d88('0x30')][_0x2d88('0x4a')]){_0x7f8897['include']=[{'all':!![]}];}_0x7f8897=_[_0x2d88('0x3b')]({},_0x7f8897,_0x2ee8b1[_0x2d88('0x40')]);return db[_0x2d88('0x2d')][_0x2d88('0x59')](_0x7f8897)['then'](handleEntityNotFound(_0x5c7ae8,null))[_0x2d88('0x27')](respondWithResult(_0x5c7ae8,null))['catch'](handleError(_0x5c7ae8,null));};exports[_0x2d88('0x5a')]=function(_0x2e14b7,_0x466b7d){return db[_0x2d88('0x2d')][_0x2d88('0x5a')](_0x2e14b7[_0x2d88('0x5b')],{})[_0x2d88('0x27')](respondWithResult(_0x466b7d,0xc9))[_0x2d88('0x56')](handleError(_0x466b7d,null));};exports[_0x2d88('0x26')]=function(_0x505b2e,_0x350bfd){if(_0x505b2e[_0x2d88('0x5b')]['id']){delete _0x505b2e[_0x2d88('0x5b')]['id'];}return db[_0x2d88('0x2d')]['find']({'where':{'id':_0x505b2e[_0x2d88('0x58')]['id']}})['then'](handleEntityNotFound(_0x350bfd,null))[_0x2d88('0x27')](saveUpdates(_0x505b2e['body'],null))[_0x2d88('0x27')](respondWithResult(_0x350bfd,null))[_0x2d88('0x56')](handleError(_0x350bfd,null));};exports[_0x2d88('0x5c')]=function(_0x319cf3,_0x534d70){return db['SmsInteraction'][_0x2d88('0x59')]({'where':{'id':_0x319cf3[_0x2d88('0x58')]['id']}})[_0x2d88('0x27')](handleEntityNotFound(_0x534d70,null))['then'](removeEntity(_0x534d70,null))[_0x2d88('0x56')](handleError(_0x534d70,null));};exports[_0x2d88('0x5d')]=function(_0x414d18,_0x15ee91){return db[_0x2d88('0x2d')][_0x2d88('0x5d')]()['then'](respondWithResult(_0x15ee91,null))[_0x2d88('0x56')](handleError(_0x15ee91,null));};exports[_0x2d88('0x5e')]=function(_0x1b2a2c,_0x57469a,_0x2ea1cc){return db[_0x2d88('0x52')][_0x2d88('0x59')]({'where':{'id':_0x1b2a2c[_0x2d88('0x58')]['id']}})[_0x2d88('0x27')](handleEntityNotFound(_0x57469a,null))[_0x2d88('0x27')](function(_0x1af160){if(_0x1af160){return _0x1af160['addMessage'](_0x1b2a2c['body'][_0x2d88('0x5f')],_['omit'](_0x1b2a2c['body'],[_0x2d88('0x5f'),'id'])||{});}})[_0x2d88('0x27')](respondWithResult(_0x57469a,null))[_0x2d88('0x56')](handleError(_0x57469a,null));};exports['getMessages']=function(_0x4dc303,_0x4c2443,_0x252353){var _0x766f6d={'raw':![],'where':{}};var _0x55e86c={};var _0x409159={'count':0x0,'rows':[]};return db[_0x2d88('0x2d')][_0x2d88('0x60')]({'where':{'id':_0x4dc303['params']['id']}})[_0x2d88('0x27')](handleEntityNotFound(_0x4c2443,null))[_0x2d88('0x27')](function(_0xbfd384){if(_0xbfd384){_0x55e86c['model']=_[_0x2d88('0x2f')](db[_0x2d88('0x52')]['rawAttributes']);_0x55e86c[_0x2d88('0x30')]=_['keys'](_0x4dc303[_0x2d88('0x30')]);_0x55e86c[_0x2d88('0x31')]=_[_0x2d88('0x32')](_0x55e86c['model'],_0x55e86c[_0x2d88('0x30')]);_0x766f6d['attributes']=_[_0x2d88('0x32')](_0x55e86c['model'],qs[_0x2d88('0x34')](_0x4dc303[_0x2d88('0x30')][_0x2d88('0x34')]));_0x766f6d[_0x2d88('0x33')]=_0x766f6d[_0x2d88('0x33')][_0x2d88('0x35')]?_0x766f6d[_0x2d88('0x33')]:_0x55e86c[_0x2d88('0x2e')];if(!_0x4dc303[_0x2d88('0x30')][_0x2d88('0x36')]('nolimit')){_0x766f6d[_0x2d88('0x21')]=qs[_0x2d88('0x21')](_0x4dc303['query'][_0x2d88('0x21')]);_0x766f6d[_0x2d88('0x20')]=qs['offset'](_0x4dc303[_0x2d88('0x30')][_0x2d88('0x20')]);}_0x766f6d[_0x2d88('0x61')]=qs[_0x2d88('0x38')](_0x4dc303['query'][_0x2d88('0x38')]);_0x766f6d[_0x2d88('0x39')]=qs[_0x2d88('0x31')](_[_0x2d88('0x3a')](_0x4dc303[_0x2d88('0x30')],_0x55e86c['filters']));_0x766f6d[_0x2d88('0x39')]['SmsInteractionId']=_0xbfd384['id'];if(_0x4dc303[_0x2d88('0x30')][_0x2d88('0x3f')]){_0x766f6d['where']=_[_0x2d88('0x3b')](_0x766f6d[_0x2d88('0x39')],{'$or':_[_0x2d88('0x3c')](_0x766f6d[_0x2d88('0x33')],function(_0x3d3419){var _0x50d99c={};_0x50d99c[_0x3d3419]={'$like':'%'+_0x4dc303[_0x2d88('0x30')]['filter']+'%'};return _0x50d99c;})});}if(_0x4dc303[_0x2d88('0x30')][_0x2d88('0x62')]){var _0x56375b=_0x4dc303[_0x2d88('0x30')]['$gte']['split'](',');var _0x564541={};_0x564541[_0x56375b[0x0]]={'$gte':moment(_0x56375b[0x1])['format'](_0x2d88('0x63'))};_0x766f6d[_0x2d88('0x39')]=_[_0x2d88('0x3b')](_0x766f6d[_0x2d88('0x39')],_0x564541);}_0x766f6d=_[_0x2d88('0x3b')]({},_0x766f6d,_0x4dc303[_0x2d88('0x40')]);return db[_0x2d88('0x52')][_0x2d88('0x1f')]({'where':_0x766f6d[_0x2d88('0x39')]})['then'](function(_0x16f7c2){_0x409159[_0x2d88('0x1f')]=_0x16f7c2;if(_0x4dc303['query'][_0x2d88('0x4a')]){_0x766f6d['include']=[{'all':!![]}];}return db[_0x2d88('0x52')]['findAll'](_0x766f6d);})[_0x2d88('0x27')](function(_0x4f7f92){_0x409159[_0x2d88('0x64')]=_0x4f7f92;return _0x409159;});}})['then'](respondWithFilteredResult(_0x4c2443,_0x766f6d))[_0x2d88('0x56')](handleError(_0x4c2443,null));};exports[_0x2d88('0x65')]=function(_0x1b3656,_0x29ee6c,_0x55fa39){return db['SmsInteraction'][_0x2d88('0x59')]({'where':{'id':_0x1b3656[_0x2d88('0x58')]['id']}})[_0x2d88('0x27')](handleEntityNotFound(_0x29ee6c,null))[_0x2d88('0x27')](function(_0x331ba1){if(_0x331ba1){return _0x331ba1[_0x2d88('0x66')](_0x1b3656['body'][_0x2d88('0x5f')],_[_0x2d88('0x67')](_0x1b3656[_0x2d88('0x5b')],[_0x2d88('0x5f'),'id'])||{})['spread'](function(){return db[_0x2d88('0x43')][_0x2d88('0x55')]({'attributes':['id',_0x2d88('0x2a'),_0x2d88('0x53')],'where':{'id':_0x1b3656[_0x2d88('0x5b')][_0x2d88('0x5f')]}});})[_0x2d88('0x27')](function(_0x18f401){socket['emit'](_0x2d88('0x68'),{'id':Number(_0x1b3656[_0x2d88('0x58')]['id']),'tags':_0x18f401||[]});return{'id':Number(_0x1b3656[_0x2d88('0x58')]['id']),'tags':_0x18f401||[]};});}})['then'](respondWithResult(_0x29ee6c,null))['catch'](handleError(_0x29ee6c,null));};exports['removeTags']=function(_0x1b402f,_0x35e76c,_0x368bce){var _0x37e514;return db[_0x2d88('0x2d')][_0x2d88('0x59')]({'where':{'id':_0x1b402f['params']['id']}})[_0x2d88('0x27')](handleEntityNotFound(_0x35e76c,null))[_0x2d88('0x27')](function(_0x106e1a){if(_0x106e1a){return _0x106e1a[_0x2d88('0x69')](_0x1b402f[_0x2d88('0x30')][_0x2d88('0x5f')]);}})[_0x2d88('0x27')](respondWithStatusCode(_0x35e76c,null))[_0x2d88('0x56')](handleError(_0x35e76c,null));};exports[_0x2d88('0x6a')]=function(_0x564bad,_0x9c07e3){var _0xe27588=moment()[_0x2d88('0x6b')]()[_0x2d88('0x6c')]();var _0x3e2b27=path[_0x2d88('0x6d')](config['root'],_0x2d88('0x6e'),'files','tmp');var _0x367e86=path[_0x2d88('0x6d')](config[_0x2d88('0x6f')],'server','files',_0x2d88('0x70'));var _0x2bbb3f=path[_0x2d88('0x6d')](_0x3e2b27,_0xe27588);var _0x2b2466=util[_0x2d88('0x71')](_0x2d88('0x72'),_0xe27588);var _0x5ee953=path[_0x2d88('0x6d')](_0x3e2b27,_0x2b2466);var _0x94a473=![];return db[_0x2d88('0x2d')]['find']({'where':{'id':_0x564bad[_0x2d88('0x58')]['id']},'include':[{'model':db['SmsMessage'],'as':_0x2d88('0x47'),'attributes':['id',_0x2d88('0x5b')],'include':[{'model':db[_0x2d88('0x4b')],'as':_0x2d88('0x4b'),'attributes':['id',_0x2d88('0x4d')],'raw':!![]},{'model':db[_0x2d88('0x4e')],'as':_0x2d88('0x4f'),'attributes':['id','firstName'],'raw':!![]}]}]})[_0x2d88('0x27')](handleEntityNotFound(_0x9c07e3,null))['then'](function(_0x30fb9e){if(_0x30fb9e){_0x94a473=!![];var _0x1c405e='';var _0x1a927b={'format':_0x2d88('0x73'),'border':_0x2d88('0x74')};fs[_0x2d88('0x75')](_0x2bbb3f);_0x1c405e+=util['format']('

Sms\x20Interaction:\x20#%d

',_0x30fb9e['id']);_0x1c405e+=util['format'](_0x2d88('0x76'),moment()[_0x2d88('0x71')](_0x2d88('0x77'))[_0x2d88('0x6c')]());_0x1c405e+=_0x2d88('0x78');for(var _0x3a11e7=0x0;_0x3a11e7<_0x30fb9e[_0x2d88('0x47')]['length'];_0x3a11e7++){var _0x1ad43a=_0x30fb9e[_0x2d88('0x47')][_0x3a11e7];_0x1c405e+=_0x2d88('0x79');_0x1c405e+=util[_0x2d88('0x71')](_0x2d88('0x7a'),_0x1ad43a[_0x2d88('0x4b')]?_0x1ad43a[_0x2d88('0x4b')][_0x2d88('0x4d')]:_0x1ad43a[_0x2d88('0x4f')][_0x2d88('0x7b')],_0x1ad43a[_0x2d88('0x5b')]);_0x1c405e+=_0x2d88('0x7c');}return new BPromise(function(_0x3f8682,_0x5ac171){pdf['create'](_0x1c405e,_0x1a927b)[_0x2d88('0x7d')](path[_0x2d88('0x6d')](_0x2bbb3f,_0x2d88('0x7e')+_0xe27588+_0x2d88('0x7f')),function(_0x1d71b6,_0x403271){if(_0x1d71b6)return _0x5ac171(_0x1d71b6);_0x3f8682(_0x403271);});});}})[_0x2d88('0x27')](function(){if(_0x94a473){return new BPromise(function(_0x123217,_0x537105){zipdir(_0x2bbb3f,{'saveTo':_0x5ee953},function(_0x427c9e,_0x27cf49){if(_0x427c9e)return _0x537105(_0x427c9e);return _0x123217(_0x27cf49);});});}})[_0x2d88('0x27')](function(){if(_0x94a473){return new BPromise(function(_0x175fa6,_0x58e6b3){rimraf(_0x2bbb3f,function(_0x46f70d){if(_0x46f70d)_0x58e6b3(_0x46f70d);return _0x175fa6();});});}})['then'](function(){if(_0x94a473){return _0x9c07e3[_0x2d88('0x6a')](_0x5ee953,_0x2b2466,function(_0xbf3835){if(_0xbf3835){console[_0x2d88('0x80')](_0x2d88('0x81'),_0xbf3835);}else{fs['unlinkSync'](_0x5ee953);}});}else{return _0x9c07e3[_0x2d88('0x28')](0xc8);}})[_0x2d88('0x56')](handleError(_0x9c07e3,null));}; \ No newline at end of file +var _0xe64a=['filter','options','include','tag','push','Tags','read','SmsMessage','Messages','direction','createdAt','distinct','User','Users','fullname','Contact','Owner','internal','SmsAccount','Tag','color','ThroughTags','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','SmsInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','addTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','tmp','files','interaction-%s.zip','CmContact','1cm','

Sms\x20Interaction:\x20#%d

','

Date:\x20%s

','MMMM\x20Do\x20YYYY,\x20HH:mm:ss','','%s:\x20%s

','firstName','','toFile','interaction-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','ioredis','api','../../config/utils','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','./smsInteraction.socket','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','SmsInteraction','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','map','key','VIRTUAL','field'];(function(_0x3c2c8c,_0x544a88){var _0xe53cdc=function(_0x4791a6){while(--_0x4791a6){_0x3c2c8c['push'](_0x3c2c8c['shift']());}};_0xe53cdc(++_0x544a88);}(_0xe64a,0x1e0));var _0xae64=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe64a[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xae64('0x0'));var emlformat=require(_0xae64('0x1'));var rimraf=require(_0xae64('0x2'));var zipdir=require(_0xae64('0x3'));var jsonpatch=require(_0xae64('0x4'));var rp=require(_0xae64('0x5'));var moment=require(_0xae64('0x6'));var BPromise=require(_0xae64('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xae64('0x8'));var ejs=require(_0xae64('0x9'));var fs=require('fs');var _=require(_0xae64('0xa'));var squel=require(_0xae64('0xb'));var crypto=require(_0xae64('0xc'));var jsforce=require(_0xae64('0xd'));var deskjs=require(_0xae64('0xe'));var toCsv=require(_0xae64('0x8'));var querystring=require(_0xae64('0xf'));var Papa=require(_0xae64('0x10'));var authService=require(_0xae64('0x11'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xae64('0x12'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xae64('0x13'));var utils=require(_0xae64('0x14'));var config=require(_0xae64('0x15'));var db=require(_0xae64('0x16'))['db'];config['redis']=_[_0xae64('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xae64('0x18'))(new Redis(config[_0xae64('0x19')]));require(_0xae64('0x1a'))['register'](socket);function respondWithStatusCode(_0x1247b0,_0x760b31){_0x760b31=_0x760b31||0xcc;return function(_0x306804){if(_0x306804){return _0x1247b0[_0xae64('0x1b')](_0x760b31);}return _0x1247b0[_0xae64('0x1c')](_0x760b31)['end']();};}function respondWithResult(_0x2950c5,_0x37bc58){_0x37bc58=_0x37bc58||0xc8;return function(_0x717724){if(_0x717724){return _0x2950c5[_0xae64('0x1c')](_0x37bc58)[_0xae64('0x1d')](_0x717724);}};}function respondWithFilteredResult(_0x561408,_0xa149b3){return function(_0x21c285){if(_0x21c285){var _0x9d2460=_0x21c285[_0xae64('0x1e')],_0x4613d9=_0xa149b3[_0xae64('0x1f')],_0x2500f1=_0xa149b3['offset']+_0xa149b3[_0xae64('0x20')],_0x227223;if(_0x2500f1>=_0x9d2460){_0x2500f1=_0x9d2460;_0x227223=0xc8;}else{_0x227223=0xce;}_0x561408[_0xae64('0x1c')](_0x227223);return _0x561408[_0xae64('0x21')](_0xae64('0x22'),_0x4613d9+'-'+_0x2500f1+'/'+_0x9d2460)[_0xae64('0x1d')](_0x21c285);}return null;};}function patchUpdates(_0x20ca7f){return function(_0x49bab9){try{jsonpatch[_0xae64('0x23')](_0x49bab9,_0x20ca7f,!![]);}catch(_0x4a4c4e){return BPromise[_0xae64('0x24')](_0x4a4c4e);}return _0x49bab9[_0xae64('0x25')]();};}function saveUpdates(_0x12d94d,_0x394afa){return function(_0x4406dc){if(_0x4406dc){return _0x4406dc[_0xae64('0x26')](_0x12d94d)[_0xae64('0x27')](function(_0x127ae2){return _0x127ae2;});}return null;};}function removeEntity(_0x24a35f,_0x2e6852){return function(_0x131225){if(_0x131225){return _0x131225[_0xae64('0x28')]()[_0xae64('0x27')](function(){_0x24a35f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6eb56,_0xd5ecaf){return function(_0x22d91a){if(!_0x22d91a){_0x6eb56[_0xae64('0x1b')](0x194);}return _0x22d91a;};}function handleError(_0x4d987f,_0x518969){_0x518969=_0x518969||0x1f4;return function(_0x562c2d){logger[_0xae64('0x29')](_0x562c2d[_0xae64('0x2a')]);if(_0x562c2d['name']){delete _0x562c2d[_0xae64('0x2b')];}_0x4d987f[_0xae64('0x1c')](_0x518969)[_0xae64('0x2c')](_0x562c2d);};}exports['index']=function(_0x3b946c,_0x562eb4){var _0x55f53d={},_0x5e4b2c={},_0x21777e={'count':0x0,'rows':[]};var _0x4ea1b3=db[_0xae64('0x2d')]['rawAttributes'];_0x5e4b2c['model']=_['keys'](_0x4ea1b3);_0x5e4b2c[_0xae64('0x2e')]=_[_0xae64('0x2f')](_0x3b946c[_0xae64('0x2e')]);_0x5e4b2c[_0xae64('0x30')]=_[_0xae64('0x31')](_0x5e4b2c[_0xae64('0x32')],_0x5e4b2c[_0xae64('0x2e')]);_0x55f53d[_0xae64('0x33')]=_[_0xae64('0x31')](_0x5e4b2c['model'],qs[_0xae64('0x34')](_0x3b946c[_0xae64('0x2e')][_0xae64('0x34')]));_0x55f53d[_0xae64('0x33')]=_0x55f53d[_0xae64('0x33')][_0xae64('0x35')]?_0x55f53d['attributes']:_0x5e4b2c[_0xae64('0x32')];if(!_0x3b946c['query']['hasOwnProperty'](_0xae64('0x36'))){_0x55f53d[_0xae64('0x20')]=qs[_0xae64('0x20')](_0x3b946c[_0xae64('0x2e')][_0xae64('0x20')]);_0x55f53d[_0xae64('0x1f')]=qs[_0xae64('0x1f')](_0x3b946c['query'][_0xae64('0x1f')]);}_0x55f53d[_0xae64('0x37')]=qs[_0xae64('0x38')](_0x3b946c[_0xae64('0x2e')][_0xae64('0x38')]);_0x55f53d[_0xae64('0x39')]=qs['filters'](_[_0xae64('0x3a')](_0x3b946c[_0xae64('0x2e')],_0x5e4b2c[_0xae64('0x30')]));if(_0x3b946c[_0xae64('0x2e')]['filter']){_0x55f53d[_0xae64('0x39')]=_[_0xae64('0x3b')](_0x55f53d['where'],{'$or':_[_0xae64('0x3c')](_0x4ea1b3,function(_0x13246f){if(_0x13246f['type'][_0xae64('0x3d')]!==_0xae64('0x3e')){var _0x4597b7={};_0x4597b7[_0x13246f[_0xae64('0x3f')]]={'$like':'%'+_0x3b946c['query'][_0xae64('0x40')]+'%'};return _0x4597b7;}})});}_0x55f53d=_[_0xae64('0x3b')]({},_0x55f53d,_0x3b946c[_0xae64('0x41')]);var _0x3d9db1={'where':_0x55f53d[_0xae64('0x39')]};_0x3d9db1[_0xae64('0x42')]=[];if(_0x3b946c['query'][_0xae64('0x43')]){_0x3d9db1[_0xae64('0x42')][_0xae64('0x44')]({'model':db['Tag'],'as':_0xae64('0x45'),'attributes':['id'],'where':{'id':_0x3b946c[_0xae64('0x2e')][_0xae64('0x43')]},'required':!![]});_0x3d9db1['distinct']=!![];}if(_0x3b946c['query'][_0xae64('0x46')]){_0x3d9db1[_0xae64('0x42')]['push']({'model':db[_0xae64('0x47')],'as':_0xae64('0x48'),'attributes':['id',_0xae64('0x49'),_0xae64('0x4a'),_0xae64('0x46')],'where':{'direction':'in','read':_0x3b946c[_0xae64('0x2e')]['read']||![]},'required':!![]});_0x3d9db1[_0xae64('0x4b')]=!![];}return db[_0xae64('0x2d')][_0xae64('0x1e')](_0x3d9db1)[_0xae64('0x27')](function(_0x4ea18e){_0x21777e[_0xae64('0x1e')]=_0x4ea18e;if(_0x3b946c['query']['includeAll']){_0x55f53d['include']=[{'model':db[_0xae64('0x4c')],'as':_0xae64('0x4d'),'required':![],'attributes':['id',_0xae64('0x2b'),_0xae64('0x4e')]},{'model':db['CmContact'],'as':_0xae64('0x4f'),'required':![]},{'model':db[_0xae64('0x4c')],'as':_0xae64('0x50'),'attributes':[_0xae64('0x2b'),'fullname',_0xae64('0x51')],'required':![]},{'model':db[_0xae64('0x52')],'as':'Account','attributes':[_0xae64('0x2b'),_0xae64('0x3d')],'required':![]},{'model':db[_0xae64('0x47')],'as':'Messages','attributes':['id',_0xae64('0x49'),_0xae64('0x4a'),_0xae64('0x46')],'where':{'direction':'in','read':_0x3b946c['query'][_0xae64('0x46')]||![]},'required':_0x3b946c[_0xae64('0x2e')]['read']||![]},{'model':db[_0xae64('0x53')],'as':_0xae64('0x45'),'attributes':['id',_0xae64('0x2b'),_0xae64('0x54')],'required':_0x3b946c[_0xae64('0x2e')][_0xae64('0x43')]?!![]:![]},{'model':db['Tag'],'as':_0xae64('0x55'),'attributes':['id','name',_0xae64('0x54')],'through':_0x3b946c[_0xae64('0x2e')]['tag']?{'attributes':[],'where':{'TagId':_0x3b946c[_0xae64('0x2e')][_0xae64('0x43')]||undefined}}:{},'required':_0x3b946c[_0xae64('0x2e')][_0xae64('0x43')]?!![]:![]}];}return db[_0xae64('0x2d')][_0xae64('0x56')](_0x55f53d);})[_0xae64('0x27')](function(_0x38f014){_0x21777e[_0xae64('0x57')]=_0x38f014;return _0x21777e;})[_0xae64('0x27')](respondWithFilteredResult(_0x562eb4,_0x55f53d))[_0xae64('0x58')](handleError(_0x562eb4,null));};exports[_0xae64('0x59')]=function(_0x3adf63,_0x4b3b4a){var _0x50ec0b={'raw':![],'where':{'id':_0x3adf63[_0xae64('0x5a')]['id']}},_0xe00b71={};_0xe00b71[_0xae64('0x32')]=_['keys'](db['SmsInteraction'][_0xae64('0x5b')]);_0xe00b71[_0xae64('0x2e')]=_[_0xae64('0x2f')](_0x3adf63[_0xae64('0x2e')]);_0xe00b71[_0xae64('0x30')]=_[_0xae64('0x31')](_0xe00b71[_0xae64('0x32')],_0xe00b71[_0xae64('0x2e')]);_0x50ec0b[_0xae64('0x33')]=_[_0xae64('0x31')](_0xe00b71['model'],qs[_0xae64('0x34')](_0x3adf63[_0xae64('0x2e')][_0xae64('0x34')]));_0x50ec0b['attributes']=_0x50ec0b[_0xae64('0x33')]['length']?_0x50ec0b[_0xae64('0x33')]:_0xe00b71['model'];if(_0x3adf63[_0xae64('0x2e')]['includeAll']){_0x50ec0b[_0xae64('0x42')]=[{'all':!![]}];}_0x50ec0b=_[_0xae64('0x3b')]({},_0x50ec0b,_0x3adf63[_0xae64('0x41')]);return db['SmsInteraction'][_0xae64('0x5c')](_0x50ec0b)['then'](handleEntityNotFound(_0x4b3b4a,null))[_0xae64('0x27')](respondWithResult(_0x4b3b4a,null))[_0xae64('0x58')](handleError(_0x4b3b4a,null));};exports[_0xae64('0x5d')]=function(_0x36ca59,_0x98af83){return db[_0xae64('0x2d')][_0xae64('0x5d')](_0x36ca59[_0xae64('0x5e')],{})['then'](respondWithResult(_0x98af83,0xc9))[_0xae64('0x58')](handleError(_0x98af83,null));};exports['update']=function(_0x1bb41c,_0x50066e){if(_0x1bb41c[_0xae64('0x5e')]['id']){delete _0x1bb41c['body']['id'];}return db[_0xae64('0x2d')][_0xae64('0x5c')]({'where':{'id':_0x1bb41c[_0xae64('0x5a')]['id']}})[_0xae64('0x27')](handleEntityNotFound(_0x50066e,null))[_0xae64('0x27')](saveUpdates(_0x1bb41c['body'],null))['then'](respondWithResult(_0x50066e,null))[_0xae64('0x58')](handleError(_0x50066e,null));};exports['destroy']=function(_0x4e45f8,_0x135507){return db[_0xae64('0x2d')][_0xae64('0x5c')]({'where':{'id':_0x4e45f8[_0xae64('0x5a')]['id']}})['then'](handleEntityNotFound(_0x135507,null))[_0xae64('0x27')](removeEntity(_0x135507,null))[_0xae64('0x58')](handleError(_0x135507,null));};exports[_0xae64('0x5f')]=function(_0x2ed959,_0x58ec5c){return db[_0xae64('0x2d')]['describe']()[_0xae64('0x27')](respondWithResult(_0x58ec5c,null))[_0xae64('0x58')](handleError(_0x58ec5c,null));};exports[_0xae64('0x60')]=function(_0x4ef883,_0x2aec7b,_0x469406){return db[_0xae64('0x47')][_0xae64('0x5c')]({'where':{'id':_0x4ef883[_0xae64('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2aec7b,null))[_0xae64('0x27')](function(_0x3c1c12){if(_0x3c1c12){return _0x3c1c12[_0xae64('0x60')](_0x4ef883['body'][_0xae64('0x61')],_[_0xae64('0x62')](_0x4ef883[_0xae64('0x5e')],[_0xae64('0x61'),'id'])||{});}})[_0xae64('0x27')](respondWithResult(_0x2aec7b,null))[_0xae64('0x58')](handleError(_0x2aec7b,null));};exports[_0xae64('0x63')]=function(_0x5209e7,_0x152064,_0x451705){var _0x1eccb0={'raw':![],'where':{}};var _0x55983c={};var _0x2a2658={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xae64('0x64')]({'where':{'id':_0x5209e7['params']['id']}})[_0xae64('0x27')](handleEntityNotFound(_0x152064,null))[_0xae64('0x27')](function(_0x19012b){if(_0x19012b){_0x55983c[_0xae64('0x32')]=_['keys'](db[_0xae64('0x47')][_0xae64('0x5b')]);_0x55983c[_0xae64('0x2e')]=_[_0xae64('0x2f')](_0x5209e7[_0xae64('0x2e')]);_0x55983c[_0xae64('0x30')]=_[_0xae64('0x31')](_0x55983c['model'],_0x55983c['query']);_0x1eccb0[_0xae64('0x33')]=_[_0xae64('0x31')](_0x55983c[_0xae64('0x32')],qs[_0xae64('0x34')](_0x5209e7[_0xae64('0x2e')][_0xae64('0x34')]));_0x1eccb0[_0xae64('0x33')]=_0x1eccb0['attributes'][_0xae64('0x35')]?_0x1eccb0[_0xae64('0x33')]:_0x55983c[_0xae64('0x32')];if(!_0x5209e7[_0xae64('0x2e')]['hasOwnProperty']('nolimit')){_0x1eccb0[_0xae64('0x20')]=qs[_0xae64('0x20')](_0x5209e7['query'][_0xae64('0x20')]);_0x1eccb0[_0xae64('0x1f')]=qs[_0xae64('0x1f')](_0x5209e7['query']['offset']);}_0x1eccb0[_0xae64('0x37')]=qs['sort'](_0x5209e7[_0xae64('0x2e')][_0xae64('0x38')]);_0x1eccb0[_0xae64('0x39')]=qs[_0xae64('0x30')](_[_0xae64('0x3a')](_0x5209e7[_0xae64('0x2e')],_0x55983c['filters']));_0x1eccb0[_0xae64('0x39')][_0xae64('0x65')]=_0x19012b['id'];if(_0x5209e7['query'][_0xae64('0x40')]){_0x1eccb0['where']=_[_0xae64('0x3b')](_0x1eccb0[_0xae64('0x39')],{'$or':_[_0xae64('0x3c')](_0x1eccb0[_0xae64('0x33')],function(_0x125e3b){var _0x2e13aa={};_0x2e13aa[_0x125e3b]={'$like':'%'+_0x5209e7['query'][_0xae64('0x40')]+'%'};return _0x2e13aa;})});}if(_0x5209e7[_0xae64('0x2e')][_0xae64('0x66')]){var _0x126f33=_0x5209e7[_0xae64('0x2e')][_0xae64('0x66')][_0xae64('0x67')](',');var _0x2ae623={};_0x2ae623[_0x126f33[0x0]]={'$gte':moment(_0x126f33[0x1])[_0xae64('0x68')](_0xae64('0x69'))};_0x1eccb0['where']=_[_0xae64('0x3b')](_0x1eccb0[_0xae64('0x39')],_0x2ae623);}_0x1eccb0=_[_0xae64('0x3b')]({},_0x1eccb0,_0x5209e7['options']);return db[_0xae64('0x47')][_0xae64('0x1e')]({'where':_0x1eccb0[_0xae64('0x39')]})[_0xae64('0x27')](function(_0x34002d){_0x2a2658[_0xae64('0x1e')]=_0x34002d;if(_0x5209e7[_0xae64('0x2e')][_0xae64('0x6a')]){_0x1eccb0[_0xae64('0x42')]=[{'all':!![]}];}return db[_0xae64('0x47')][_0xae64('0x56')](_0x1eccb0);})['then'](function(_0x26dcc8){_0x2a2658[_0xae64('0x57')]=_0x26dcc8;return _0x2a2658;});}})[_0xae64('0x27')](respondWithFilteredResult(_0x152064,_0x1eccb0))['catch'](handleError(_0x152064,null));};exports[_0xae64('0x6b')]=function(_0x980dbe,_0x49a601,_0x2e87db){return db['SmsInteraction']['find']({'where':{'id':_0x980dbe[_0xae64('0x5a')]['id']}})[_0xae64('0x27')](handleEntityNotFound(_0x49a601,null))[_0xae64('0x27')](function(_0x4e9858){if(_0x4e9858){return _0x4e9858['setTags'](_0x980dbe[_0xae64('0x5e')][_0xae64('0x61')],_[_0xae64('0x62')](_0x980dbe['body'],[_0xae64('0x61'),'id'])||{})[_0xae64('0x6c')](function(){return db['Tag'][_0xae64('0x56')]({'attributes':['id',_0xae64('0x2b'),'color'],'where':{'id':_0x980dbe['body'][_0xae64('0x61')]}});})[_0xae64('0x27')](function(_0x439845){socket[_0xae64('0x6d')](_0xae64('0x6e'),{'id':Number(_0x980dbe[_0xae64('0x5a')]['id']),'tags':_0x439845||[]});return{'id':Number(_0x980dbe[_0xae64('0x5a')]['id']),'tags':_0x439845||[]};});}})['then'](respondWithResult(_0x49a601,null))[_0xae64('0x58')](handleError(_0x49a601,null));};exports[_0xae64('0x6f')]=function(_0x71cb01,_0x1b9b27,_0x362b34){var _0x2c8a4d;return db[_0xae64('0x2d')][_0xae64('0x5c')]({'where':{'id':_0x71cb01[_0xae64('0x5a')]['id']}})[_0xae64('0x27')](handleEntityNotFound(_0x1b9b27,null))[_0xae64('0x27')](function(_0x44cca2){if(_0x44cca2){return _0x44cca2['removeTags'](_0x71cb01[_0xae64('0x2e')][_0xae64('0x61')]);}})['then'](respondWithStatusCode(_0x1b9b27,null))[_0xae64('0x58')](handleError(_0x1b9b27,null));};exports[_0xae64('0x70')]=function(_0x379dc2,_0x52fcad){var _0x45ccc2=moment()[_0xae64('0x71')]()[_0xae64('0x72')]();var _0x235ebd=path[_0xae64('0x73')](config[_0xae64('0x74')],_0xae64('0x75'),'files',_0xae64('0x76'));var _0x324e9a=path[_0xae64('0x73')](config['root'],_0xae64('0x75'),_0xae64('0x77'),'attachments');var _0x50b27d=path[_0xae64('0x73')](_0x235ebd,_0x45ccc2);var _0x5d417c=util[_0xae64('0x68')](_0xae64('0x78'),_0x45ccc2);var _0x3a5d73=path[_0xae64('0x73')](_0x235ebd,_0x5d417c);var _0x4bec47=![];return db[_0xae64('0x2d')]['find']({'where':{'id':_0x379dc2[_0xae64('0x5a')]['id']},'include':[{'model':db[_0xae64('0x47')],'as':_0xae64('0x48'),'attributes':['id',_0xae64('0x5e')],'include':[{'model':db[_0xae64('0x4c')],'as':_0xae64('0x4c'),'attributes':['id',_0xae64('0x4e')],'raw':!![]},{'model':db[_0xae64('0x79')],'as':'Contact','attributes':['id','firstName'],'raw':!![]}]}]})[_0xae64('0x27')](handleEntityNotFound(_0x52fcad,null))['then'](function(_0xc88d9f){if(_0xc88d9f){_0x4bec47=!![];var _0x8a9189='';var _0x173a0b={'format':'Letter','border':_0xae64('0x7a')};fs['mkdirSync'](_0x50b27d);_0x8a9189+=util[_0xae64('0x68')](_0xae64('0x7b'),_0xc88d9f['id']);_0x8a9189+=util[_0xae64('0x68')](_0xae64('0x7c'),moment()[_0xae64('0x68')](_0xae64('0x7d'))[_0xae64('0x72')]());_0x8a9189+='
';for(var _0x210971=0x0;_0x210971<_0xc88d9f[_0xae64('0x48')]['length'];_0x210971++){var _0x508183=_0xc88d9f['Messages'][_0x210971];_0x8a9189+=_0xae64('0x7e');_0x8a9189+=util[_0xae64('0x68')](_0xae64('0x7f'),_0x508183[_0xae64('0x4c')]?_0x508183[_0xae64('0x4c')][_0xae64('0x4e')]:_0x508183[_0xae64('0x4f')][_0xae64('0x80')],_0x508183[_0xae64('0x5e')]);_0x8a9189+=_0xae64('0x81');}return new BPromise(function(_0x2605b7,_0x22c59f){pdf[_0xae64('0x5d')](_0x8a9189,_0x173a0b)[_0xae64('0x82')](path[_0xae64('0x73')](_0x50b27d,_0xae64('0x83')+_0x45ccc2+_0xae64('0x84')),function(_0x708052,_0x33fc3a){if(_0x708052)return _0x22c59f(_0x708052);_0x2605b7(_0x33fc3a);});});}})['then'](function(){if(_0x4bec47){return new BPromise(function(_0x3b33c9,_0x15e576){zipdir(_0x50b27d,{'saveTo':_0x3a5d73},function(_0x3e75f,_0x3424de){if(_0x3e75f)return _0x15e576(_0x3e75f);return _0x3b33c9(_0x3424de);});});}})[_0xae64('0x27')](function(){if(_0x4bec47){return new BPromise(function(_0x57d869,_0x391b32){rimraf(_0x50b27d,function(_0x2c95c0){if(_0x2c95c0)_0x391b32(_0x2c95c0);return _0x57d869();});});}})[_0xae64('0x27')](function(){if(_0x4bec47){return _0x52fcad[_0xae64('0x70')](_0x3a5d73,_0x5d417c,function(_0x31b92b){if(_0x31b92b){console[_0xae64('0x85')](_0xae64('0x86'),_0x31b92b);}else{fs[_0xae64('0x87')](_0x3a5d73);}});}else{return _0x52fcad[_0xae64('0x1b')](0xc8);}})[_0xae64('0x58')](handleError(_0x52fcad,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 5c01722..ffaedfe 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 _0xe492=['hook','exports','events','save','update','remove','emit','hasOwnProperty'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0xe492,0x1c2));var _0x2e49=function(_0x57b0de,_0x2ab36d){_0x57b0de=_0x57b0de-0x0;var _0x7e5914=_0xe492[_0x57b0de];return _0x7e5914;};'use strict';var EventEmitter=require(_0x2e49('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2e49('0x1'),'afterUpdate':_0x2e49('0x2'),'afterDestroy':_0x2e49('0x3')};function emitEvent(_0x374de6){return function(_0x3a3c92,_0x41ffa6,_0xef3aaf){SmsInteractionEvents['emit'](_0x374de6+':'+_0x3a3c92['id'],_0x3a3c92);SmsInteractionEvents[_0x2e49('0x4')](_0x374de6,_0x3a3c92);_0xef3aaf(null);};}for(var e in events){if(events[_0x2e49('0x5')](e)){var event=events[e];SmsInteraction[_0x2e49('0x6')](e,emitEvent(event));}}module[_0x2e49('0x7')]=SmsInteractionEvents; \ No newline at end of file +var _0x4504=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4504,0xd4));var _0x4450=function(_0x4b7203,_0x127d52){_0x4b7203=_0x4b7203-0x0;var _0x103e2b=_0x4504[_0x4b7203];return _0x103e2b;};'use strict';var EventEmitter=require(_0x4450('0x0'));var SmsInteraction=require(_0x4450('0x1'))['db']['SmsInteraction'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x4450('0x2')](0x0);var events={'afterCreate':_0x4450('0x3'),'afterUpdate':_0x4450('0x4'),'afterDestroy':_0x4450('0x5')};function emitEvent(_0x40764f){return function(_0x576ac2,_0x558f50,_0x55285a){SmsInteractionEvents[_0x4450('0x6')](_0x40764f+':'+_0x576ac2['id'],_0x576ac2);SmsInteractionEvents[_0x4450('0x6')](_0x40764f,_0x576ac2);_0x55285a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x4450('0x7')](e,emitEvent(event));}}module[_0x4450('0x8')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 8961ca9..a17325e 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 _0xfddb=['moment','bluebird','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfddb,0x174));var _0xbfdd=function(_0x5b7f59,_0x1148aa){_0x5b7f59=_0x5b7f59-0x0;var _0x1de0bc=_0xfddb[_0x5b7f59];return _0x1de0bc;};'use strict';var _=require(_0xbfdd('0x0'));var util=require(_0xbfdd('0x1'));var logger=require('../../config/logger')(_0xbfdd('0x2'));var moment=require(_0xbfdd('0x3'));var BPromise=require(_0xbfdd('0x4'));var rp=require('request-promise');var attributes=require(_0xbfdd('0x5'));module[_0xbfdd('0x6')]=function(_0x3586ba,_0x3d275f){return _0x3586ba[_0xbfdd('0x7')](_0xbfdd('0x8'),attributes,{'tableName':_0xbfdd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x21223f,_0x605792,_0x67e40){if(_0x21223f[_0xbfdd('0xa')](_0xbfdd('0xb'))){_0x21223f[_0xbfdd('0xc')]=moment()[_0xbfdd('0xd')](_0xbfdd('0xe'));}_0x67e40(null,_0x21223f);}}});}; \ No newline at end of file +var _0xc060=['YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','exports','SmsInteraction','sms_interactions','changed','closed','closedAt'];(function(_0x499f9f,_0x15b2ac){var _0x3e6f8c=function(_0x18717d){while(--_0x18717d){_0x499f9f['push'](_0x499f9f['shift']());}};_0x3e6f8c(++_0x15b2ac);}(_0xc060,0x1bb));var _0x0c06=function(_0x30f91d,_0x578b86){_0x30f91d=_0x30f91d-0x0;var _0x219427=_0xc060[_0x30f91d];return _0x219427;};'use strict';var _=require(_0x0c06('0x0'));var util=require('util');var logger=require(_0x0c06('0x1'))(_0x0c06('0x2'));var moment=require(_0x0c06('0x3'));var BPromise=require(_0x0c06('0x4'));var rp=require(_0x0c06('0x5'));var attributes=require('./smsInteraction.attributes');module[_0x0c06('0x6')]=function(_0x2ca26f,_0x5aaa75){return _0x2ca26f['define'](_0x0c06('0x7'),attributes,{'tableName':_0x0c06('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x287011,_0x375374,_0xd12507){if(_0x287011[_0x0c06('0x9')](_0x0c06('0xa'))){_0x287011[_0x0c06('0xb')]=moment()['format'](_0x0c06('0xc'));}_0xd12507(null,_0x287011);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 8863d55..228e693 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 _0x2ce4=['addTags','ids','omit','spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','./smsInteraction.socket','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','limit','AddTagsToSmsInteraction','find'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x2ce4,0xc3));var _0x42ce=function(_0x2e5f09,_0xe10bc2){_0x2e5f09=_0x2e5f09-0x0;var _0x34492a=_0x2ce4[_0x2e5f09];return _0x34492a;};'use strict';var _=require(_0x42ce('0x0'));var util=require(_0x42ce('0x1'));var moment=require('moment');var BPromise=require(_0x42ce('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x42ce('0x3'));var db=require(_0x42ce('0x4'))['db'];var utils=require(_0x42ce('0x5'));var logger=require(_0x42ce('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x42ce('0x7'));var client=jayson[_0x42ce('0x8')]['http']({'port':0x232a});config[_0x42ce('0x9')]=_[_0x42ce('0xa')](config[_0x42ce('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x42ce('0x9')]));require(_0x42ce('0xb'))['register'](socket);function respondWithRpcPromise(_0x4f07a0,_0x2a605e,_0x2c6e78){return new BPromise(function(_0x549137,_0x389729){return client['request'](_0x4f07a0,_0x2c6e78)[_0x42ce('0xc')](function(_0x3bfbe9){logger[_0x42ce('0xd')](_0x42ce('0xe'),_0x2a605e,'request\x20sent');logger[_0x42ce('0xf')](_0x42ce('0x10'),_0x2a605e,'request\x20sent',JSON[_0x42ce('0x11')](_0x3bfbe9));if(_0x3bfbe9['error']){if(_0x3bfbe9[_0x42ce('0x12')][_0x42ce('0x13')]===0x1f4){logger[_0x42ce('0x12')](_0x42ce('0xe'),_0x2a605e,_0x3bfbe9[_0x42ce('0x12')]['message']);return _0x389729(_0x3bfbe9[_0x42ce('0x12')][_0x42ce('0x14')]);}logger[_0x42ce('0x12')](_0x42ce('0xe'),_0x2a605e,_0x3bfbe9[_0x42ce('0x12')]['message']);return _0x549137(_0x3bfbe9[_0x42ce('0x12')][_0x42ce('0x14')]);}else{logger[_0x42ce('0xd')](_0x42ce('0xe'),_0x2a605e,_0x42ce('0x15'));_0x549137(_0x3bfbe9[_0x42ce('0x16')][_0x42ce('0x14')]);}})['catch'](function(_0x340b9a){logger[_0x42ce('0x12')](_0x42ce('0xe'),_0x2a605e,_0x340b9a);_0x389729(_0x340b9a);});});}exports[_0x42ce('0x17')]=function(_0x339c76){var _0x2251fb=this;return new Promise(function(_0x367ccb,_0x15232c){return db[_0x42ce('0x18')][_0x42ce('0x19')](_0x339c76[_0x42ce('0x1a')],{'raw':_0x339c76[_0x42ce('0x1b')]?_0x339c76['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x339c76['options']?_0x339c76[_0x42ce('0x1b')][_0x42ce('0x1c')]||null:null,'attributes':_0x339c76['options']?_0x339c76[_0x42ce('0x1b')][_0x42ce('0x1d')]||null:null,'limit':_0x339c76[_0x42ce('0x1b')]?_0x339c76[_0x42ce('0x1b')][_0x42ce('0x1e')]||null:null})['then'](function(_0x6fb516){logger[_0x42ce('0xd')](_0x42ce('0x17'),_0x339c76);logger['debug'](_0x42ce('0x17'),_0x339c76,JSON[_0x42ce('0x11')](_0x6fb516));_0x367ccb(_0x6fb516);})['catch'](function(_0x3a5fbb){logger[_0x42ce('0x12')](_0x42ce('0x17'),_0x3a5fbb[_0x42ce('0x14')],_0x339c76);_0x15232c(_0x2251fb[_0x42ce('0x12')](0x1f4,_0x3a5fbb[_0x42ce('0x14')]));});});};exports[_0x42ce('0x1f')]=function(_0x3077e2){return new Promise(function(_0x16fa18,_0xd592f0){return db[_0x42ce('0x18')][_0x42ce('0x20')]({'where':_0x3077e2[_0x42ce('0x1b')]?_0x3077e2[_0x42ce('0x1b')][_0x42ce('0x1c')]||null:null})[_0x42ce('0xc')](function(_0x18957b){if(_0x18957b){return _0x18957b[_0x42ce('0x21')](_0x3077e2[_0x42ce('0x1a')][_0x42ce('0x22')],_[_0x42ce('0x23')](_0x3077e2[_0x42ce('0x1a')],['ids','id'])||{});}})[_0x42ce('0x24')](function(_0x239fe2){logger[_0x42ce('0xd')]('AddTags',_0x3077e2);logger[_0x42ce('0xf')](_0x42ce('0x25'),_0x3077e2,JSON[_0x42ce('0x11')](_0x239fe2));_0x16fa18(_0x239fe2);})['catch'](function(_0x418b86){logger[_0x42ce('0x12')](_0x42ce('0x25'),_0x418b86[_0x42ce('0x14')],_0x3077e2);_0xd592f0(_this[_0x42ce('0x12')](0x1f4,_0x418b86[_0x42ce('0x14')]));});});}; \ No newline at end of file +var _0xcc04=['update','body','options','raw','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','where','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','SmsInteraction'];(function(_0x4da5a1,_0x3074df){var _0x3ce1a1=function(_0x1e9fb6){while(--_0x1e9fb6){_0x4da5a1['push'](_0x4da5a1['shift']());}};_0x3ce1a1(++_0x3074df);}(_0xcc04,0x189));var _0x4cc0=function(_0x3129d6,_0x9f0b8d){_0x3129d6=_0x3129d6-0x0;var _0x639b31=_0xcc04[_0x3129d6];return _0x639b31;};'use strict';var _=require(_0x4cc0('0x0'));var util=require(_0x4cc0('0x1'));var moment=require(_0x4cc0('0x2'));var BPromise=require(_0x4cc0('0x3'));var rs=require(_0x4cc0('0x4'));var fs=require('fs');var Redis=require(_0x4cc0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4cc0('0x6'));var logger=require(_0x4cc0('0x7'))(_0x4cc0('0x8'));var config=require(_0x4cc0('0x9'));var jayson=require(_0x4cc0('0xa'));var client=jayson[_0x4cc0('0xb')][_0x4cc0('0xc')]({'port':0x232a});config['redis']=_[_0x4cc0('0xd')](config['redis'],{'host':_0x4cc0('0xe'),'port':0x18eb});var socket=require(_0x4cc0('0xf'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0x4cc0('0x10')](socket);function respondWithRpcPromise(_0x2e3f49,_0x61fc82,_0xcfe7a3){return new BPromise(function(_0x1a88c7,_0x53f8a7){return client['request'](_0x2e3f49,_0xcfe7a3)[_0x4cc0('0x11')](function(_0x2bed51){logger[_0x4cc0('0x12')](_0x4cc0('0x13'),_0x61fc82,_0x4cc0('0x14'));logger[_0x4cc0('0x15')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x61fc82,_0x4cc0('0x14'),JSON[_0x4cc0('0x16')](_0x2bed51));if(_0x2bed51[_0x4cc0('0x17')]){if(_0x2bed51[_0x4cc0('0x17')][_0x4cc0('0x18')]===0x1f4){logger[_0x4cc0('0x17')](_0x4cc0('0x13'),_0x61fc82,_0x2bed51[_0x4cc0('0x17')][_0x4cc0('0x19')]);return _0x53f8a7(_0x2bed51[_0x4cc0('0x17')][_0x4cc0('0x19')]);}logger[_0x4cc0('0x17')](_0x4cc0('0x13'),_0x61fc82,_0x2bed51[_0x4cc0('0x17')][_0x4cc0('0x19')]);return _0x1a88c7(_0x2bed51[_0x4cc0('0x17')][_0x4cc0('0x19')]);}else{logger[_0x4cc0('0x12')](_0x4cc0('0x13'),_0x61fc82,'request\x20sent');_0x1a88c7(_0x2bed51['result'][_0x4cc0('0x19')]);}})['catch'](function(_0x371659){logger[_0x4cc0('0x17')](_0x4cc0('0x13'),_0x61fc82,_0x371659);_0x53f8a7(_0x371659);});});}exports['UpdateSmsInteraction']=function(_0x19a141){var _0x1a0d6d=this;return new Promise(function(_0x3d3e4f,_0x54df39){return db[_0x4cc0('0x1a')][_0x4cc0('0x1b')](_0x19a141[_0x4cc0('0x1c')],{'raw':_0x19a141[_0x4cc0('0x1d')]?_0x19a141[_0x4cc0('0x1d')][_0x4cc0('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19a141[_0x4cc0('0x1d')]?_0x19a141['options']['where']||null:null,'attributes':_0x19a141[_0x4cc0('0x1d')]?_0x19a141['options'][_0x4cc0('0x1f')]||null:null,'limit':_0x19a141[_0x4cc0('0x1d')]?_0x19a141[_0x4cc0('0x1d')][_0x4cc0('0x20')]||null:null})['then'](function(_0x4e78c7){logger['info']('UpdateSmsInteraction',_0x19a141);logger[_0x4cc0('0x15')](_0x4cc0('0x21'),_0x19a141,JSON[_0x4cc0('0x16')](_0x4e78c7));_0x3d3e4f(_0x4e78c7);})['catch'](function(_0x50ef10){logger[_0x4cc0('0x17')](_0x4cc0('0x21'),_0x50ef10['message'],_0x19a141);_0x54df39(_0x1a0d6d[_0x4cc0('0x17')](0x1f4,_0x50ef10[_0x4cc0('0x19')]));});});};exports[_0x4cc0('0x22')]=function(_0x2e8a05){return new Promise(function(_0x5194c4,_0x321b20){return db[_0x4cc0('0x1a')][_0x4cc0('0x23')]({'where':_0x2e8a05[_0x4cc0('0x1d')]?_0x2e8a05[_0x4cc0('0x1d')][_0x4cc0('0x24')]||null:null})[_0x4cc0('0x11')](function(_0xf1043a){if(_0xf1043a){return _0xf1043a[_0x4cc0('0x25')](_0x2e8a05['body']['ids'],_[_0x4cc0('0x26')](_0x2e8a05['body'],[_0x4cc0('0x27'),'id'])||{});}})[_0x4cc0('0x28')](function(_0x5b01f3){logger['info'](_0x4cc0('0x29'),_0x2e8a05);logger[_0x4cc0('0x15')](_0x4cc0('0x29'),_0x2e8a05,JSON[_0x4cc0('0x16')](_0x5b01f3));_0x5194c4(_0x5b01f3);})['catch'](function(_0x3b398d){logger['error']('AddTags',_0x3b398d[_0x4cc0('0x19')],_0x2e8a05);_0x321b20(_this[_0x4cc0('0x17')](0x1f4,_0x3b398d[_0x4cc0('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 2c24aba..213a353 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 _0x72ee=['smsInteraction:','./smsInteraction.events','save','update','emit','removeListener','length'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x72ee,0xa9));var _0xe72e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x72ee[_0x59ee6f];return _0x4c0979;};'use strict';var SmsInteractionEvents=require(_0xe72e('0x0'));var events=[_0xe72e('0x1'),'remove',_0xe72e('0x2')];function createListener(_0x4b62ce,_0x2f5894){return function(_0x5e1de1){_0x2f5894[_0xe72e('0x3')](_0x4b62ce,_0x5e1de1);};}function removeListener(_0x23bc5c,_0x2d584f){return function(){SmsInteractionEvents[_0xe72e('0x4')](_0x23bc5c,_0x2d584f);};}exports['register']=function(_0x3775c3){for(var _0x34e460=0x0,_0x2292a1=events[_0xe72e('0x5')];_0x34e460<_0x2292a1;_0x34e460++){var _0x3dff6a=events[_0x34e460];var _0x515d4f=createListener(_0xe72e('0x6')+_0x3dff6a,_0x3775c3);SmsInteractionEvents['on'](_0x3dff6a,_0x515d4f);}}; \ No newline at end of file +var _0xc005=['register','./smsInteraction.events','save','remove','update','emit','removeListener'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xc005,0x1f2));var _0x5c00=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0xc005[_0x1b51ea];return _0x18bbdc;};'use strict';var SmsInteractionEvents=require(_0x5c00('0x0'));var events=[_0x5c00('0x1'),_0x5c00('0x2'),_0x5c00('0x3')];function createListener(_0xa07ffb,_0x15f655){return function(_0x1e24f2){_0x15f655[_0x5c00('0x4')](_0xa07ffb,_0x1e24f2);};}function removeListener(_0x48bdcd,_0x1ed4eb){return function(){SmsInteractionEvents[_0x5c00('0x5')](_0x48bdcd,_0x1ed4eb);};}exports[_0x5c00('0x6')]=function(_0x48aead){for(var _0x2ccb59=0x0,_0x2134a5=events['length'];_0x2ccb59<_0x2134a5;_0x2ccb59++){var _0x42095e=events[_0x2ccb59];var _0x4a59fa=createListener('smsInteraction:'+_0x42095e,_0x48aead);SmsInteractionEvents['on'](_0x42095e,_0x4a59fa);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index f247f78..577ec18 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 _0xb7f1=['/:id/reject','reject','delete','exports','path','connect-timeout','express','../../components/auth/service','./smsMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','tracked','sms','create','status','put','update','accept'];(function(_0x5edfd1,_0x370260){var _0x38898e=function(_0x5657eb){while(--_0x5657eb){_0x5edfd1['push'](_0x5edfd1['shift']());}};_0x38898e(++_0x370260);}(_0xb7f1,0xdc));var _0x1b7f=function(_0x49bcfa,_0x5094e4){_0x49bcfa=_0x49bcfa-0x0;var _0x119740=_0xb7f1[_0x49bcfa];return _0x119740;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1b7f('0x0'));var timeout=require(_0x1b7f('0x1'));var express=require(_0x1b7f('0x2'));var router=express['Router']();var auth=require(_0x1b7f('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1b7f('0x4'));router[_0x1b7f('0x5')]('/',auth['isAuthenticated'](),controller[_0x1b7f('0x6')]);router[_0x1b7f('0x5')](_0x1b7f('0x7'),auth[_0x1b7f('0x8')](),controller[_0x1b7f('0x9')]);router['get'](_0x1b7f('0xa'),auth[_0x1b7f('0x8')](),controller[_0x1b7f('0xb')]);router[_0x1b7f('0xc')]('/',auth[_0x1b7f('0x8')](),interaction[_0x1b7f('0xd')](_0x1b7f('0xe'),'smsmessage:create'),controller[_0x1b7f('0xf')]);router['post']('/:id/status',controller[_0x1b7f('0x10')]);router[_0x1b7f('0x11')](_0x1b7f('0xa'),auth[_0x1b7f('0x8')](),controller[_0x1b7f('0x12')]);router[_0x1b7f('0x11')]('/:id/accept',auth[_0x1b7f('0x8')](),controller[_0x1b7f('0x13')]);router[_0x1b7f('0x11')](_0x1b7f('0x14'),auth[_0x1b7f('0x8')](),controller[_0x1b7f('0x15')]);router[_0x1b7f('0x16')](_0x1b7f('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1b7f('0x17')]=router; \ No newline at end of file +var _0xe19e=['/:id/status','update','put','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','path','../../components/auth/service','../../config/environment','./smsMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','tracked','smsmessage:create','create'];(function(_0x596b3b,_0xb73c24){var _0xe259f1=function(_0x458fb6){while(--_0x458fb6){_0x596b3b['push'](_0x596b3b['shift']());}};_0xe259f1(++_0xb73c24);}(_0xe19e,0x180));var _0xee19=function(_0x4142ae,_0x1d41c5){_0x4142ae=_0x4142ae-0x0;var _0x11d07a=_0xe19e[_0x4142ae];return _0x11d07a;};'use strict';var multer=require(_0xee19('0x0'));var util=require('util');var path=require(_0xee19('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xee19('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xee19('0x3'));var controller=require(_0xee19('0x4'));router[_0xee19('0x5')]('/',auth['isAuthenticated'](),controller[_0xee19('0x6')]);router['get'](_0xee19('0x7'),auth[_0xee19('0x8')](),controller[_0xee19('0x9')]);router[_0xee19('0x5')](_0xee19('0xa'),auth[_0xee19('0x8')](),controller[_0xee19('0xb')]);router[_0xee19('0xc')]('/',auth[_0xee19('0x8')](),interaction[_0xee19('0xd')]('sms',_0xee19('0xe')),controller[_0xee19('0xf')]);router[_0xee19('0xc')](_0xee19('0x10'),controller['status']);router['put'](_0xee19('0xa'),auth[_0xee19('0x8')](),controller[_0xee19('0x11')]);router[_0xee19('0x12')](_0xee19('0x13'),auth['isAuthenticated'](),controller['accept']);router['put'](_0xee19('0x14'),auth['isAuthenticated'](),controller[_0xee19('0x15')]);router[_0xee19('0x16')]('/:id',auth[_0xee19('0x8')](),controller[_0xee19('0x17')]);module[_0xee19('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 98f1db1..d82934f 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 _0x66da=['exports','TEXT','medium','out','STRING','DATE','BOOLEAN','sequelize'];(function(_0x122b96,_0x278963){var _0x10386d=function(_0xefc6d3){while(--_0xefc6d3){_0x122b96['push'](_0x122b96['shift']());}};_0x10386d(++_0x278963);}(_0x66da,0x16f));var _0xa66d=function(_0x28f32c,_0x4cc342){_0x28f32c=_0x28f32c-0x0;var _0x355402=_0x66da[_0x28f32c];return _0x355402;};'use strict';var Sequelize=require(_0xa66d('0x0'));module[_0xa66d('0x1')]={'body':{'type':Sequelize[_0xa66d('0x2')](_0xa66d('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xa66d('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa66d('0x5')](0xbe)},'phone':{'type':Sequelize[_0xa66d('0x5')]},'readAt':{'type':Sequelize[_0xa66d('0x6')]},'secret':{'type':Sequelize[_0xa66d('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x4300=['STRING','BOOLEAN','sequelize','ENUM','out'];(function(_0x4c7850,_0x47acbc){var _0xceee93=function(_0x24f8ba){while(--_0x24f8ba){_0x4c7850['push'](_0x4c7850['shift']());}};_0xceee93(++_0x47acbc);}(_0x4300,0x1a6));var _0x0430=function(_0x3d3dd4,_0x1a12fc){_0x3d3dd4=_0x3d3dd4-0x0;var _0x359324=_0x4300[_0x3d3dd4];return _0x359324;};'use strict';var Sequelize=require(_0x0430('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x0430('0x1')]('in',_0x0430('0x2')),'defaultValue':_0x0430('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0430('0x3')](0xbe)},'phone':{'type':Sequelize[_0x0430('0x3')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x0430('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index d5e6fd9..97199d2 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 _0x7880=['Content-Range','apply','save','update','stack','name','index','rawAttributes','keys','filters','query','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','key','field','options','count','includeAll','include','SmsMessage','findAll','show','params','find','create','body','destroy','describe','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','SmsInteraction','isNil','read1stAt','interaction','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','sms-interactions','reject','agent','SmsInteractionId','role','RejectMessage','rejectMessage','interface','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','sendStatus','status','json','offset','limit','set'];(function(_0x209c3e,_0x56c2d0){var _0xf54294=function(_0x46e52f){while(--_0x46e52f){_0x209c3e['push'](_0x209c3e['shift']());}};_0xf54294(++_0x56c2d0);}(_0x7880,0x1f4));var _0x0788=function(_0x196e16,_0x168729){_0x196e16=_0x196e16-0x0;var _0x37531f=_0x7880[_0x196e16];return _0x37531f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0788('0x0'));var rimraf=require(_0x0788('0x1'));var zipdir=require(_0x0788('0x2'));var jsonpatch=require(_0x0788('0x3'));var rp=require(_0x0788('0x4'));var moment=require(_0x0788('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0788('0x6'));var util=require(_0x0788('0x7'));var path=require(_0x0788('0x8'));var sox=require(_0x0788('0x9'));var csv=require(_0x0788('0xa'));var ejs=require(_0x0788('0xb'));var fs=require('fs');var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0xa'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var authService=require('../../components/auth/service');var hardwareService=require(_0x0788('0x11'));var Redis=require(_0x0788('0x12'));var qs=require(_0x0788('0x13'));var logger=require(_0x0788('0x14'))(_0x0788('0x15'));var utils=require('../../config/utils');var config=require(_0x0788('0x16'));var db=require(_0x0788('0x17'))['db'];config[_0x0788('0x18')]=_[_0x0788('0x19')](config[_0x0788('0x18')],{'host':_0x0788('0x1a'),'port':0x18eb});var socket=require(_0x0788('0x1b'))(new Redis(config['redis']));require(_0x0788('0x1c'))[_0x0788('0x1d')](socket);var jayson=require(_0x0788('0x1e'));var client=jayson[_0x0788('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x0788('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x195f14,_0x170d56,_0x3fd1e4,_0xb406fb){return new BPromise(function(_0x2ddd1a,_0x430e34){var _0x5e1a29=_0xb406fb||client;return _0x5e1a29['request'](_0x195f14,_0x3fd1e4)[_0x0788('0x20')](function(_0x461d9d){logger['info'](_0x0788('0x21'),_0x170d56,_0x0788('0x22'));logger[_0x0788('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x170d56,_0x0788('0x22'),JSON[_0x0788('0x24')](_0x461d9d));if(_0x461d9d['error']){if(_0x461d9d[_0x0788('0x25')]['code']===0x1f4){logger[_0x0788('0x25')]('SmsMessage,\x20%s,\x20%s',_0x170d56,_0x461d9d[_0x0788('0x25')][_0x0788('0x26')]);return _0x430e34(_0x461d9d[_0x0788('0x25')][_0x0788('0x26')]);}logger[_0x0788('0x25')]('SmsMessage,\x20%s,\x20%s',_0x170d56,_0x461d9d['error'][_0x0788('0x26')]);return _0x2ddd1a(_0x461d9d[_0x0788('0x25')][_0x0788('0x26')]);}else{logger[_0x0788('0x27')]('SmsMessage,\x20%s,\x20%s',_0x170d56,'request\x20sent');_0x2ddd1a(_0x461d9d[_0x0788('0x28')][_0x0788('0x26')]);}})[_0x0788('0x29')](function(_0x50b65c){logger['error'](_0x0788('0x21'),_0x170d56,_0x50b65c);_0x430e34(_0x50b65c);});});}function respondWithStatusCode(_0xa1f7dc,_0x5f2dda){_0x5f2dda=_0x5f2dda||0xcc;return function(_0x48816a){if(_0x48816a){return _0xa1f7dc[_0x0788('0x2a')](_0x5f2dda);}return _0xa1f7dc[_0x0788('0x2b')](_0x5f2dda)['end']();};}function respondWithResult(_0x286730,_0x40e7a6){_0x40e7a6=_0x40e7a6||0xc8;return function(_0x467d52){if(_0x467d52){return _0x286730[_0x0788('0x2b')](_0x40e7a6)[_0x0788('0x2c')](_0x467d52);}};}function respondWithFilteredResult(_0xb2f4a5,_0x6bf651){return function(_0x3ffe4f){if(_0x3ffe4f){var _0x5b7594=_0x3ffe4f['count'],_0x5a5178=_0x6bf651['offset'],_0x3c5246=_0x6bf651[_0x0788('0x2d')]+_0x6bf651[_0x0788('0x2e')],_0x40d345;if(_0x3c5246>=_0x5b7594){_0x3c5246=_0x5b7594;_0x40d345=0xc8;}else{_0x40d345=0xce;}_0xb2f4a5[_0x0788('0x2b')](_0x40d345);return _0xb2f4a5[_0x0788('0x2f')](_0x0788('0x30'),_0x5a5178+'-'+_0x3c5246+'/'+_0x5b7594)[_0x0788('0x2c')](_0x3ffe4f);}return null;};}function patchUpdates(_0x327d67){return function(_0x36e077){try{jsonpatch[_0x0788('0x31')](_0x36e077,_0x327d67,!![]);}catch(_0x85e579){return BPromise['reject'](_0x85e579);}return _0x36e077[_0x0788('0x32')]();};}function saveUpdates(_0x1aab6a,_0x2db509){return function(_0x2a64e4){if(_0x2a64e4){return _0x2a64e4[_0x0788('0x33')](_0x1aab6a)[_0x0788('0x20')](function(_0x26f584){return _0x26f584;});}return null;};}function removeEntity(_0x15d67a,_0x1cb6c0){return function(_0xaed27e){if(_0xaed27e){return _0xaed27e['destroy']()['then'](function(){_0x15d67a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x516cce,_0x586a06){return function(_0x208a89){if(!_0x208a89){_0x516cce[_0x0788('0x2a')](0x194);}return _0x208a89;};}function handleError(_0x2130e3,_0x574576){_0x574576=_0x574576||0x1f4;return function(_0xe80dba){logger[_0x0788('0x25')](_0xe80dba[_0x0788('0x34')]);if(_0xe80dba[_0x0788('0x35')]){delete _0xe80dba['name'];}_0x2130e3[_0x0788('0x2b')](_0x574576)['send'](_0xe80dba);};}exports[_0x0788('0x36')]=function(_0x4fcde3,_0x9d1edb){var _0x1beb1f={},_0x498e16={},_0x16f053={'count':0x0,'rows':[]};var _0x151c96=db['SmsMessage'][_0x0788('0x37')];_0x498e16['model']=_[_0x0788('0x38')](_0x151c96);_0x498e16['query']=_[_0x0788('0x38')](_0x4fcde3['query']);_0x498e16[_0x0788('0x39')]=_['intersection'](_0x498e16['model'],_0x498e16[_0x0788('0x3a')]);_0x1beb1f[_0x0788('0x3b')]=_[_0x0788('0x3c')](_0x498e16[_0x0788('0x3d')],qs[_0x0788('0x3e')](_0x4fcde3['query']['fields']));_0x1beb1f['attributes']=_0x1beb1f['attributes'][_0x0788('0x3f')]?_0x1beb1f[_0x0788('0x3b')]:_0x498e16[_0x0788('0x3d')];if(!_0x4fcde3[_0x0788('0x3a')][_0x0788('0x40')]('nolimit')){_0x1beb1f['limit']=qs[_0x0788('0x2e')](_0x4fcde3[_0x0788('0x3a')][_0x0788('0x2e')]);_0x1beb1f[_0x0788('0x2d')]=qs[_0x0788('0x2d')](_0x4fcde3[_0x0788('0x3a')][_0x0788('0x2d')]);}_0x1beb1f[_0x0788('0x41')]=qs[_0x0788('0x42')](_0x4fcde3['query']['sort']);_0x1beb1f[_0x0788('0x43')]=qs[_0x0788('0x39')](_[_0x0788('0x44')](_0x4fcde3['query'],_0x498e16['filters']));if(_0x4fcde3['query'][_0x0788('0x45')]){_0x1beb1f[_0x0788('0x43')]=_[_0x0788('0x46')](_0x1beb1f[_0x0788('0x43')],{'$or':_[_0x0788('0x47')](_0x151c96,function(_0x1928f3){if(_0x1928f3[_0x0788('0x48')][_0x0788('0x49')]!=='VIRTUAL'){var _0x15c618={};_0x15c618[_0x1928f3[_0x0788('0x4a')]]={'$like':'%'+_0x4fcde3[_0x0788('0x3a')][_0x0788('0x45')]+'%'};return _0x15c618;}})});}_0x1beb1f=_['merge']({},_0x1beb1f,_0x4fcde3[_0x0788('0x4b')]);var _0x2e97ee={'where':_0x1beb1f['where']};return db['SmsMessage']['count'](_0x2e97ee)[_0x0788('0x20')](function(_0x5e010a){_0x16f053[_0x0788('0x4c')]=_0x5e010a;if(_0x4fcde3[_0x0788('0x3a')][_0x0788('0x4d')]){_0x1beb1f[_0x0788('0x4e')]=[{'all':!![]}];}return db[_0x0788('0x4f')][_0x0788('0x50')](_0x1beb1f);})[_0x0788('0x20')](function(_0x45b3d2){_0x16f053['rows']=_0x45b3d2;return _0x16f053;})['then'](respondWithFilteredResult(_0x9d1edb,_0x1beb1f))[_0x0788('0x29')](handleError(_0x9d1edb,null));};exports[_0x0788('0x51')]=function(_0x2f232c,_0x5af6dd){var _0x166d79={'raw':!![],'where':{'id':_0x2f232c[_0x0788('0x52')]['id']}},_0x330ab7={};_0x330ab7[_0x0788('0x3d')]=_[_0x0788('0x38')](db['SmsMessage']['rawAttributes']);_0x330ab7[_0x0788('0x3a')]=_[_0x0788('0x38')](_0x2f232c['query']);_0x330ab7[_0x0788('0x39')]=_['intersection'](_0x330ab7[_0x0788('0x3d')],_0x330ab7[_0x0788('0x3a')]);_0x166d79[_0x0788('0x3b')]=_[_0x0788('0x3c')](_0x330ab7[_0x0788('0x3d')],qs[_0x0788('0x3e')](_0x2f232c[_0x0788('0x3a')][_0x0788('0x3e')]));_0x166d79['attributes']=_0x166d79[_0x0788('0x3b')][_0x0788('0x3f')]?_0x166d79[_0x0788('0x3b')]:_0x330ab7['model'];if(_0x2f232c[_0x0788('0x3a')][_0x0788('0x4d')]){_0x166d79['include']=[{'all':!![]}];}_0x166d79=_[_0x0788('0x46')]({},_0x166d79,_0x2f232c[_0x0788('0x4b')]);return db[_0x0788('0x4f')][_0x0788('0x53')](_0x166d79)[_0x0788('0x20')](handleEntityNotFound(_0x5af6dd,null))[_0x0788('0x20')](respondWithResult(_0x5af6dd,null))['catch'](handleError(_0x5af6dd,null));};exports['create']=function(_0x469d5c,_0x36304b){return db['SmsMessage'][_0x0788('0x54')](_0x469d5c[_0x0788('0x55')],{})[_0x0788('0x20')](respondWithResult(_0x36304b,0xc9))[_0x0788('0x29')](handleError(_0x36304b,null));};exports[_0x0788('0x33')]=function(_0x226517,_0x112870){if(_0x226517[_0x0788('0x55')]['id']){delete _0x226517[_0x0788('0x55')]['id'];}return db[_0x0788('0x4f')][_0x0788('0x53')]({'where':{'id':_0x226517[_0x0788('0x52')]['id']}})['then'](handleEntityNotFound(_0x112870,null))[_0x0788('0x20')](saveUpdates(_0x226517[_0x0788('0x55')],null))[_0x0788('0x20')](respondWithResult(_0x112870,null))['catch'](handleError(_0x112870,null));};exports[_0x0788('0x56')]=function(_0x329d44,_0x531ccf){return db['SmsMessage'][_0x0788('0x53')]({'where':{'id':_0x329d44[_0x0788('0x52')]['id']}})[_0x0788('0x20')](handleEntityNotFound(_0x531ccf,null))[_0x0788('0x20')](removeEntity(_0x531ccf,null))[_0x0788('0x29')](handleError(_0x531ccf,null));};exports[_0x0788('0x57')]=function(_0x535648,_0x336d30){return db[_0x0788('0x4f')][_0x0788('0x57')]()['then'](respondWithResult(_0x336d30,null))['catch'](handleError(_0x336d30,null));};var interaction_log=require(_0x0788('0x14'))('sms-interactions');exports[_0x0788('0x58')]=function(_0x2ab921,_0x223767,_0x13a021){var _0x101e8b={'channel':_0x0788('0x59')};if(_0x2ab921[_0x0788('0x55')]['id']){delete _0x2ab921[_0x0788('0x55')]['id'];}_0x2ab921[_0x0788('0x55')][_0x0788('0x5a')]=!![];_0x2ab921['body'][_0x0788('0x5b')]=moment()[_0x0788('0x5c')](_0x0788('0x5d'));_0x2ab921[_0x0788('0x55')]['UserId']=_0x2ab921[_0x0788('0x55')][_0x0788('0x5e')]||_0x2ab921[_0x0788('0x5f')]['id'];return db[_0x0788('0x4f')][_0x0788('0x53')]({'where':{'id':_0x2ab921['params']['id'],'UserId':null},'include':[{'model':db[_0x0788('0x60')],'as':'Contact'}]})[_0x0788('0x20')](handleEntityNotFound(_0x223767,null))[_0x0788('0x20')](saveUpdates(_0x2ab921[_0x0788('0x55')],null))[_0x0788('0x20')](function(_0x3baf23){if(_0x3baf23){_0x101e8b[_0x0788('0x26')]=_0x3baf23[_0x0788('0x61')]({'plain':!![]});return db[_0x0788('0x62')][_0x0788('0x53')]({'where':{'id':_0x3baf23['SmsInteractionId']}});}return null;})[_0x0788('0x20')](handleEntityNotFound(_0x223767,null))[_0x0788('0x20')](function(_0x60e880){if(_0x60e880){return _0x60e880['update']({'UserId':_0x2ab921['body'][_0x0788('0x5e')],'read1stAt':_[_0x0788('0x63')](_0x60e880[_0x0788('0x64')])?moment()['format'](_0x0788('0x5d')):undefined});}return null;})[_0x0788('0x20')](function(_0x1eb4c9){if(_0x1eb4c9){_0x101e8b[_0x0788('0x65')]=_0x1eb4c9['get']({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2ab921[_0x0788('0x5f')]['id'],_0x2ab921[_0x0788('0x5f')][_0x0788('0x35')],_0x2ab921['user']['role'],_0x101e8b[_0x0788('0x65')]['id'],_0x2ab921['body']?JSON[_0x0788('0x24')](_0x2ab921[_0x0788('0x55')]):_0x0788('0x66'));return respondWithRpcPromise(_0x0788('0x67'),_0x0788('0x68'),_0x101e8b);}return null;})[_0x0788('0x20')](function(_0x20b01a){if(_0x20b01a){if(_0x2ab921[_0x0788('0x55')][_0x0788('0x69')]){_0x101e8b[_0x0788('0x26')]['interface']=util[_0x0788('0x5c')](_0x0788('0x6a'),_0x2ab921['user']['name']);_0x101e8b[_0x0788('0x26')][_0x0788('0x6b')]=_0x101e8b[_0x0788('0x6b')];_0x101e8b[_0x0788('0x26')][_0x0788('0x6c')]=_0x0788('0x58');return respondWithRpcPromise('EventManager',_0x0788('0x6d'),{'event':_0x0788('0x6e'),'message':_0x101e8b[_0x0788('0x26')]},client9002)[_0x0788('0x20')](function(){return _0x101e8b;});}return _0x101e8b;}return null;})['then'](respondWithResult(_0x223767,null))[_0x0788('0x29')](handleError(_0x223767,null));};var interaction_log=require(_0x0788('0x14'))(_0x0788('0x6f'));exports[_0x0788('0x70')]=function(_0x4d3a0b,_0x4af886,_0x7e11f){var _0x2db370={'agent':{},'channel':_0x0788('0x59')};if(_0x4d3a0b[_0x0788('0x55')]['id']){delete _0x4d3a0b[_0x0788('0x55')]['id'];}_0x4d3a0b[_0x0788('0x55')][_0x0788('0x5e')]=_0x4d3a0b[_0x0788('0x55')][_0x0788('0x5e')]||_0x4d3a0b['user']['id'];_0x2db370[_0x0788('0x71')]['id']=_0x4d3a0b[_0x0788('0x55')][_0x0788('0x5e')];return db['SmsMessage']['find']({'where':{'id':_0x4d3a0b[_0x0788('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4af886,null))[_0x0788('0x20')](function(_0x182210){if(_0x182210){_0x2db370[_0x0788('0x26')]=_0x182210[_0x0788('0x61')]({'plain':!![]});return db[_0x0788('0x62')][_0x0788('0x53')]({'where':{'id':_0x182210[_0x0788('0x72')]}});}return null;})[_0x0788('0x20')](handleEntityNotFound(_0x4af886,null))[_0x0788('0x20')](function(_0x566fb5){if(_0x566fb5){_0x2db370[_0x0788('0x65')]=_0x566fb5[_0x0788('0x61')]({'plain':!![]});interaction_log[_0x0788('0x27')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4d3a0b[_0x0788('0x5f')]['id'],_0x4d3a0b[_0x0788('0x5f')][_0x0788('0x35')],_0x4d3a0b['user'][_0x0788('0x73')],_0x2db370[_0x0788('0x65')]['id'],_0x4d3a0b[_0x0788('0x55')]?JSON[_0x0788('0x24')](_0x4d3a0b[_0x0788('0x55')]):_0x0788('0x66'));return respondWithRpcPromise(_0x0788('0x74'),_0x0788('0x75'),_0x2db370);}return null;})[_0x0788('0x20')](function(_0x5d8ddb){if(_0x5d8ddb){_0x5d8ddb[_0x0788('0x26')][_0x0788('0x76')]=util[_0x0788('0x5c')](_0x0788('0x6a'),_0x4d3a0b[_0x0788('0x5f')]['name']);_0x5d8ddb[_0x0788('0x26')][_0x0788('0x6b')]=_0x2db370[_0x0788('0x6b')];_0x5d8ddb['message'][_0x0788('0x6c')]=_0x0788('0x70');respondWithRpcPromise(_0x0788('0x6d'),_0x0788('0x6d'),{'event':_0x0788('0x77'),'message':_0x5d8ddb['message']},client9002);return _0x2db370;}return null;})[_0x0788('0x20')](respondWithResult(_0x4af886,null))[_0x0788('0x29')](handleError(_0x4af886,null));};exports['status']=function(_0xc54a67,_0x1c8f74,_0x537a69){if(_0xc54a67[_0x0788('0x55')]['id']){delete _0xc54a67[_0x0788('0x55')]['id'];}var _0x9a0ef;return db['SmsMessage'][_0x0788('0x53')]({'where':{'id':_0xc54a67[_0x0788('0x52')]['id']}})[_0x0788('0x20')](handleEntityNotFound(_0x1c8f74,null))['then'](function(_0xddfb97){if(_0xddfb97){_0x9a0ef=_0xddfb97;return db[_0x0788('0x78')][_0x0788('0x53')]({'where':{'id':_0xddfb97[_0x0788('0x79')]}});}})[_0x0788('0x20')](handleEntityNotFound(_0x1c8f74,null))[_0x0788('0x20')](function(_0x2545a7){if(_0x2545a7){logger[_0x0788('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0788('0x2b'),_0x0788('0x7a'),_0x2545a7[_0x0788('0x48')],util[_0x0788('0x7b')](_0xc54a67['body'],{'showHidden':![],'depth':null}));switch(_0x2545a7['type']){case _0x0788('0x7c'):if(_0xc54a67[_0x0788('0x55')]['MessageSid']&&_0xc54a67[_0x0788('0x55')][_0x0788('0x7d')]===_0x9a0ef[_0x0788('0x7e')]){return _0x9a0ef['update']({'read':!![]});}else{logger['error'](_0x0788('0x7f'),_0x0788('0x2b'),'twilio',util['inspect'](_0xc54a67['body'],{'showHidden':![],'depth':null}));}break;case _0x0788('0x80'):if(_0xc54a67[_0x0788('0x55')]['MessageUUID']&&_0xc54a67[_0x0788('0x55')][_0x0788('0x81')]===_0x9a0ef[_0x0788('0x7e')]&&_[_0x0788('0x82')]([_0x0788('0x83'),'delivered'],_0xc54a67[_0x0788('0x55')]['Status'])>=0x0){return _0x9a0ef[_0x0788('0x33')]({'read':!![]});}else{logger['error'](_0x0788('0x7f'),_0x0788('0x2b'),_0x0788('0x84'),util[_0x0788('0x7b')](_0xc54a67[_0x0788('0x55')],{'showHidden':![],'depth':null}));}break;case _0x0788('0x85'):var _0x10fd8d=_0xc54a67[_0x0788('0x55')][_0x0788('0x86')][0x0];if(_0x10fd8d[_0x0788('0x2b')][_0x0788('0x87')]===_0x0788('0x88')){return _0x9a0ef[_0x0788('0x33')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x0788('0x85'),util[_0x0788('0x7b')](_0xc54a67[_0x0788('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x9a0ef;}})[_0x0788('0x20')](respondWithResult(_0x1c8f74,null))[_0x0788('0x29')](handleError(_0x1c8f74,null));}; \ No newline at end of file +var _0x57ca=['messageId','indexOf','sent','results','groupName','DELIVERED','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','ioredis','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','SmsMessage','rawAttributes','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','pick','where','merge','map','type','VIRTUAL','field','filter','includeAll','include','findAll','rows','show','keys','options','find','create','body','params','sms-interactions','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','interaction','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','event','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID'];(function(_0x49177f,_0x4bcdf2){var _0x2466c1=function(_0x14f30d){while(--_0x14f30d){_0x49177f['push'](_0x49177f['shift']());}};_0x2466c1(++_0x4bcdf2);}(_0x57ca,0x108));var _0xa57c=function(_0x26305c,_0x1acdb0){_0x26305c=_0x26305c-0x0;var _0x202a11=_0x57ca[_0x26305c];return _0x202a11;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa57c('0x0'));var rimraf=require(_0xa57c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa57c('0x2'));var rp=require(_0xa57c('0x3'));var moment=require(_0xa57c('0x4'));var BPromise=require(_0xa57c('0x5'));var Mustache=require(_0xa57c('0x6'));var util=require('util');var path=require(_0xa57c('0x7'));var sox=require(_0xa57c('0x8'));var csv=require(_0xa57c('0x9'));var ejs=require(_0xa57c('0xa'));var fs=require('fs');var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x9'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var authService=require(_0xa57c('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xa57c('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0xa57c('0x12'))(_0xa57c('0x13'));var utils=require('../../config/utils');var config=require(_0xa57c('0x14'));var db=require('../../mysqldb')['db'];config[_0xa57c('0x15')]=_[_0xa57c('0x16')](config[_0xa57c('0x15')],{'host':_0xa57c('0x17'),'port':0x18eb});var socket=require(_0xa57c('0x18'))(new Redis(config['redis']));require(_0xa57c('0x19'))['register'](socket);var jayson=require(_0xa57c('0x1a'));var client=jayson[_0xa57c('0x1b')][_0xa57c('0x1c')]({'port':0x232c});var client9002=jayson[_0xa57c('0x1b')][_0xa57c('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x37a323,_0x3f900a,_0x4b4bdb,_0x26607a){return new BPromise(function(_0xdf7ff6,_0x261725){var _0x5a6024=_0x26607a||client;return _0x5a6024[_0xa57c('0x1d')](_0x37a323,_0x4b4bdb)['then'](function(_0x3e7afa){logger[_0xa57c('0x1e')](_0xa57c('0x1f'),_0x3f900a,_0xa57c('0x20'));logger[_0xa57c('0x21')](_0xa57c('0x22'),_0x3f900a,_0xa57c('0x20'),JSON[_0xa57c('0x23')](_0x3e7afa));if(_0x3e7afa['error']){if(_0x3e7afa[_0xa57c('0x24')]['code']===0x1f4){logger['error'](_0xa57c('0x1f'),_0x3f900a,_0x3e7afa[_0xa57c('0x24')][_0xa57c('0x25')]);return _0x261725(_0x3e7afa[_0xa57c('0x24')]['message']);}logger[_0xa57c('0x24')](_0xa57c('0x1f'),_0x3f900a,_0x3e7afa[_0xa57c('0x24')][_0xa57c('0x25')]);return _0xdf7ff6(_0x3e7afa[_0xa57c('0x24')][_0xa57c('0x25')]);}else{logger[_0xa57c('0x1e')](_0xa57c('0x1f'),_0x3f900a,_0xa57c('0x20'));_0xdf7ff6(_0x3e7afa[_0xa57c('0x26')][_0xa57c('0x25')]);}})[_0xa57c('0x27')](function(_0x241dcc){logger[_0xa57c('0x24')](_0xa57c('0x1f'),_0x3f900a,_0x241dcc);_0x261725(_0x241dcc);});});}function respondWithStatusCode(_0x511a26,_0x2db443){_0x2db443=_0x2db443||0xcc;return function(_0x5226d0){if(_0x5226d0){return _0x511a26[_0xa57c('0x28')](_0x2db443);}return _0x511a26[_0xa57c('0x29')](_0x2db443)[_0xa57c('0x2a')]();};}function respondWithResult(_0x1e8e45,_0x8ee1c0){_0x8ee1c0=_0x8ee1c0||0xc8;return function(_0xe50fb8){if(_0xe50fb8){return _0x1e8e45[_0xa57c('0x29')](_0x8ee1c0)[_0xa57c('0x2b')](_0xe50fb8);}};}function respondWithFilteredResult(_0x57ebe0,_0x3b7364){return function(_0x4c1478){if(_0x4c1478){var _0x54a18b=_0x4c1478[_0xa57c('0x2c')],_0x257661=_0x3b7364[_0xa57c('0x2d')],_0x7d10ec=_0x3b7364[_0xa57c('0x2d')]+_0x3b7364['limit'],_0x5a3e03;if(_0x7d10ec>=_0x54a18b){_0x7d10ec=_0x54a18b;_0x5a3e03=0xc8;}else{_0x5a3e03=0xce;}_0x57ebe0[_0xa57c('0x29')](_0x5a3e03);return _0x57ebe0['set'](_0xa57c('0x2e'),_0x257661+'-'+_0x7d10ec+'/'+_0x54a18b)['json'](_0x4c1478);}return null;};}function patchUpdates(_0x2a3bbe){return function(_0x51ad09){try{jsonpatch[_0xa57c('0x2f')](_0x51ad09,_0x2a3bbe,!![]);}catch(_0x532164){return BPromise[_0xa57c('0x30')](_0x532164);}return _0x51ad09[_0xa57c('0x31')]();};}function saveUpdates(_0x43c8f3,_0x304f56){return function(_0xfd0f66){if(_0xfd0f66){return _0xfd0f66[_0xa57c('0x32')](_0x43c8f3)[_0xa57c('0x33')](function(_0x5aa91e){return _0x5aa91e;});}return null;};}function removeEntity(_0x10cc39,_0x4b409f){return function(_0xbece0a){if(_0xbece0a){return _0xbece0a[_0xa57c('0x34')]()[_0xa57c('0x33')](function(){_0x10cc39['status'](0xcc)[_0xa57c('0x2a')]();});}};}function handleEntityNotFound(_0x4901a8,_0x24a087){return function(_0x501a4c){if(!_0x501a4c){_0x4901a8[_0xa57c('0x28')](0x194);}return _0x501a4c;};}function handleError(_0x494b8a,_0x433116){_0x433116=_0x433116||0x1f4;return function(_0x46f03d){logger['error'](_0x46f03d[_0xa57c('0x35')]);if(_0x46f03d['name']){delete _0x46f03d[_0xa57c('0x36')];}_0x494b8a['status'](_0x433116)[_0xa57c('0x37')](_0x46f03d);};}exports[_0xa57c('0x38')]=function(_0x205ee5,_0x62f697){var _0x2c224c={},_0x44350f={},_0x59b8af={'count':0x0,'rows':[]};var _0x53eead=db[_0xa57c('0x39')][_0xa57c('0x3a')];_0x44350f[_0xa57c('0x3b')]=_['keys'](_0x53eead);_0x44350f[_0xa57c('0x3c')]=_['keys'](_0x205ee5[_0xa57c('0x3c')]);_0x44350f[_0xa57c('0x3d')]=_['intersection'](_0x44350f['model'],_0x44350f['query']);_0x2c224c[_0xa57c('0x3e')]=_[_0xa57c('0x3f')](_0x44350f[_0xa57c('0x3b')],qs[_0xa57c('0x40')](_0x205ee5[_0xa57c('0x3c')][_0xa57c('0x40')]));_0x2c224c['attributes']=_0x2c224c[_0xa57c('0x3e')][_0xa57c('0x41')]?_0x2c224c['attributes']:_0x44350f['model'];if(!_0x205ee5[_0xa57c('0x3c')][_0xa57c('0x42')]('nolimit')){_0x2c224c[_0xa57c('0x43')]=qs[_0xa57c('0x43')](_0x205ee5[_0xa57c('0x3c')][_0xa57c('0x43')]);_0x2c224c[_0xa57c('0x2d')]=qs[_0xa57c('0x2d')](_0x205ee5['query'][_0xa57c('0x2d')]);}_0x2c224c['order']=qs['sort'](_0x205ee5['query']['sort']);_0x2c224c['where']=qs[_0xa57c('0x3d')](_[_0xa57c('0x44')](_0x205ee5[_0xa57c('0x3c')],_0x44350f['filters']));if(_0x205ee5['query']['filter']){_0x2c224c[_0xa57c('0x45')]=_[_0xa57c('0x46')](_0x2c224c[_0xa57c('0x45')],{'$or':_[_0xa57c('0x47')](_0x53eead,function(_0x6b7879){if(_0x6b7879[_0xa57c('0x48')]['key']!==_0xa57c('0x49')){var _0x22ea97={};_0x22ea97[_0x6b7879[_0xa57c('0x4a')]]={'$like':'%'+_0x205ee5[_0xa57c('0x3c')][_0xa57c('0x4b')]+'%'};return _0x22ea97;}})});}_0x2c224c=_[_0xa57c('0x46')]({},_0x2c224c,_0x205ee5['options']);var _0x246f84={'where':_0x2c224c[_0xa57c('0x45')]};return db[_0xa57c('0x39')][_0xa57c('0x2c')](_0x246f84)[_0xa57c('0x33')](function(_0x4eb51e){_0x59b8af[_0xa57c('0x2c')]=_0x4eb51e;if(_0x205ee5[_0xa57c('0x3c')][_0xa57c('0x4c')]){_0x2c224c[_0xa57c('0x4d')]=[{'all':!![]}];}return db[_0xa57c('0x39')][_0xa57c('0x4e')](_0x2c224c);})['then'](function(_0xedd288){_0x59b8af[_0xa57c('0x4f')]=_0xedd288;return _0x59b8af;})[_0xa57c('0x33')](respondWithFilteredResult(_0x62f697,_0x2c224c))[_0xa57c('0x27')](handleError(_0x62f697,null));};exports[_0xa57c('0x50')]=function(_0x4705e1,_0x57533e){var _0x516461={'raw':!![],'where':{'id':_0x4705e1['params']['id']}},_0x578436={};_0x578436[_0xa57c('0x3b')]=_['keys'](db[_0xa57c('0x39')][_0xa57c('0x3a')]);_0x578436['query']=_[_0xa57c('0x51')](_0x4705e1[_0xa57c('0x3c')]);_0x578436[_0xa57c('0x3d')]=_[_0xa57c('0x3f')](_0x578436[_0xa57c('0x3b')],_0x578436['query']);_0x516461[_0xa57c('0x3e')]=_[_0xa57c('0x3f')](_0x578436[_0xa57c('0x3b')],qs[_0xa57c('0x40')](_0x4705e1[_0xa57c('0x3c')]['fields']));_0x516461[_0xa57c('0x3e')]=_0x516461['attributes']['length']?_0x516461[_0xa57c('0x3e')]:_0x578436[_0xa57c('0x3b')];if(_0x4705e1[_0xa57c('0x3c')]['includeAll']){_0x516461['include']=[{'all':!![]}];}_0x516461=_[_0xa57c('0x46')]({},_0x516461,_0x4705e1[_0xa57c('0x52')]);return db[_0xa57c('0x39')][_0xa57c('0x53')](_0x516461)['then'](handleEntityNotFound(_0x57533e,null))[_0xa57c('0x33')](respondWithResult(_0x57533e,null))[_0xa57c('0x27')](handleError(_0x57533e,null));};exports[_0xa57c('0x54')]=function(_0x59eadc,_0x5d0655){return db[_0xa57c('0x39')][_0xa57c('0x54')](_0x59eadc['body'],{})[_0xa57c('0x33')](respondWithResult(_0x5d0655,0xc9))[_0xa57c('0x27')](handleError(_0x5d0655,null));};exports[_0xa57c('0x32')]=function(_0x43484e,_0x369514){if(_0x43484e[_0xa57c('0x55')]['id']){delete _0x43484e[_0xa57c('0x55')]['id'];}return db['SmsMessage']['find']({'where':{'id':_0x43484e[_0xa57c('0x56')]['id']}})[_0xa57c('0x33')](handleEntityNotFound(_0x369514,null))[_0xa57c('0x33')](saveUpdates(_0x43484e[_0xa57c('0x55')],null))[_0xa57c('0x33')](respondWithResult(_0x369514,null))[_0xa57c('0x27')](handleError(_0x369514,null));};exports[_0xa57c('0x34')]=function(_0x4519a0,_0x522d0e){return db['SmsMessage'][_0xa57c('0x53')]({'where':{'id':_0x4519a0['params']['id']}})[_0xa57c('0x33')](handleEntityNotFound(_0x522d0e,null))[_0xa57c('0x33')](removeEntity(_0x522d0e,null))[_0xa57c('0x27')](handleError(_0x522d0e,null));};exports['describe']=function(_0xea62f0,_0x5b3bf0){return db[_0xa57c('0x39')]['describe']()[_0xa57c('0x33')](respondWithResult(_0x5b3bf0,null))[_0xa57c('0x27')](handleError(_0x5b3bf0,null));};var interaction_log=require(_0xa57c('0x12'))(_0xa57c('0x57'));exports['accept']=function(_0x3abb69,_0x2f8d23,_0x3bd25a){var _0x2b6535={'channel':_0xa57c('0x58')};if(_0x3abb69['body']['id']){delete _0x3abb69[_0xa57c('0x55')]['id'];}_0x3abb69[_0xa57c('0x55')][_0xa57c('0x59')]=!![];_0x3abb69[_0xa57c('0x55')][_0xa57c('0x5a')]=moment()[_0xa57c('0x5b')](_0xa57c('0x5c'));_0x3abb69[_0xa57c('0x55')][_0xa57c('0x5d')]=_0x3abb69[_0xa57c('0x55')]['UserId']||_0x3abb69[_0xa57c('0x5e')]['id'];return db[_0xa57c('0x39')][_0xa57c('0x53')]({'where':{'id':_0x3abb69[_0xa57c('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xa57c('0x5f')],'as':_0xa57c('0x60')}]})['then'](handleEntityNotFound(_0x2f8d23,null))[_0xa57c('0x33')](saveUpdates(_0x3abb69[_0xa57c('0x55')],null))['then'](function(_0xb164af){if(_0xb164af){_0x2b6535[_0xa57c('0x25')]=_0xb164af[_0xa57c('0x61')]({'plain':!![]});return db[_0xa57c('0x62')][_0xa57c('0x53')]({'where':{'id':_0xb164af[_0xa57c('0x63')]}});}return null;})[_0xa57c('0x33')](handleEntityNotFound(_0x2f8d23,null))['then'](function(_0xaa82e1){if(_0xaa82e1){return _0xaa82e1['update']({'UserId':_0x3abb69[_0xa57c('0x55')]['UserId'],'read1stAt':_[_0xa57c('0x64')](_0xaa82e1['read1stAt'])?moment()[_0xa57c('0x5b')](_0xa57c('0x5c')):undefined});}return null;})['then'](function(_0x165f04){if(_0x165f04){_0x2b6535[_0xa57c('0x65')]=_0x165f04[_0xa57c('0x61')]({'plain':!![]});interaction_log[_0xa57c('0x1e')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3abb69[_0xa57c('0x5e')]['id'],_0x3abb69[_0xa57c('0x5e')][_0xa57c('0x36')],_0x3abb69[_0xa57c('0x5e')][_0xa57c('0x66')],_0x2b6535[_0xa57c('0x65')]['id'],_0x3abb69[_0xa57c('0x55')]?JSON[_0xa57c('0x23')](_0x3abb69[_0xa57c('0x55')]):_0xa57c('0x67'));return respondWithRpcPromise(_0xa57c('0x68'),_0xa57c('0x69'),_0x2b6535);}return null;})[_0xa57c('0x33')](function(_0x83e9c7){if(_0x83e9c7){if(_0x3abb69[_0xa57c('0x55')][_0xa57c('0x6a')]){_0x2b6535['message'][_0xa57c('0x6b')]=util['format'](_0xa57c('0x6c'),_0x3abb69[_0xa57c('0x5e')][_0xa57c('0x36')]);_0x2b6535['message'][_0xa57c('0x6d')]=_0x2b6535[_0xa57c('0x6d')];_0x2b6535[_0xa57c('0x25')]['event']='accept';return respondWithRpcPromise(_0xa57c('0x6e'),_0xa57c('0x6e'),{'event':_0xa57c('0x6f'),'message':_0x2b6535[_0xa57c('0x25')]},client9002)[_0xa57c('0x33')](function(){return _0x2b6535;});}return _0x2b6535;}return null;})[_0xa57c('0x33')](respondWithResult(_0x2f8d23,null))[_0xa57c('0x27')](handleError(_0x2f8d23,null));};var interaction_log=require(_0xa57c('0x12'))(_0xa57c('0x57'));exports['reject']=function(_0x25f5f0,_0x29951e,_0x55f526){var _0x2e37d7={'agent':{},'channel':_0xa57c('0x58')};if(_0x25f5f0[_0xa57c('0x55')]['id']){delete _0x25f5f0[_0xa57c('0x55')]['id'];}_0x25f5f0[_0xa57c('0x55')][_0xa57c('0x5d')]=_0x25f5f0[_0xa57c('0x55')][_0xa57c('0x5d')]||_0x25f5f0['user']['id'];_0x2e37d7[_0xa57c('0x70')]['id']=_0x25f5f0[_0xa57c('0x55')]['UserId'];return db[_0xa57c('0x39')][_0xa57c('0x53')]({'where':{'id':_0x25f5f0['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x29951e,null))[_0xa57c('0x33')](function(_0x3a5e2d){if(_0x3a5e2d){_0x2e37d7[_0xa57c('0x25')]=_0x3a5e2d[_0xa57c('0x61')]({'plain':!![]});return db[_0xa57c('0x62')]['find']({'where':{'id':_0x3a5e2d[_0xa57c('0x63')]}});}return null;})[_0xa57c('0x33')](handleEntityNotFound(_0x29951e,null))[_0xa57c('0x33')](function(_0x4cbcd1){if(_0x4cbcd1){_0x2e37d7[_0xa57c('0x65')]=_0x4cbcd1['get']({'plain':!![]});interaction_log[_0xa57c('0x1e')](_0xa57c('0x71'),_0x25f5f0[_0xa57c('0x5e')]['id'],_0x25f5f0[_0xa57c('0x5e')]['name'],_0x25f5f0[_0xa57c('0x5e')][_0xa57c('0x66')],_0x2e37d7[_0xa57c('0x65')]['id'],_0x25f5f0[_0xa57c('0x55')]?JSON['stringify'](_0x25f5f0[_0xa57c('0x55')]):_0xa57c('0x67'));return respondWithRpcPromise(_0xa57c('0x72'),'rejectMessage',_0x2e37d7);}return null;})[_0xa57c('0x33')](function(_0x448afd){if(_0x448afd){_0x448afd[_0xa57c('0x25')]['interface']=util[_0xa57c('0x5b')](_0xa57c('0x6c'),_0x25f5f0[_0xa57c('0x5e')][_0xa57c('0x36')]);_0x448afd['message'][_0xa57c('0x6d')]=_0x2e37d7[_0xa57c('0x6d')];_0x448afd['message'][_0xa57c('0x73')]=_0xa57c('0x30');respondWithRpcPromise('EventManager',_0xa57c('0x6e'),{'event':'rejectmessage','message':_0x448afd[_0xa57c('0x25')]},client9002);return _0x2e37d7;}return null;})[_0xa57c('0x33')](respondWithResult(_0x29951e,null))[_0xa57c('0x27')](handleError(_0x29951e,null));};exports[_0xa57c('0x29')]=function(_0x599408,_0x40a8db,_0x2288c2){if(_0x599408[_0xa57c('0x55')]['id']){delete _0x599408[_0xa57c('0x55')]['id'];}var _0xef15c7;return db[_0xa57c('0x39')][_0xa57c('0x53')]({'where':{'id':_0x599408[_0xa57c('0x56')]['id']}})[_0xa57c('0x33')](handleEntityNotFound(_0x40a8db,null))[_0xa57c('0x33')](function(_0x46dbb1){if(_0x46dbb1){_0xef15c7=_0x46dbb1;return db['SmsAccount']['find']({'where':{'id':_0x46dbb1['SmsAccountId']}});}})[_0xa57c('0x33')](handleEntityNotFound(_0x40a8db,null))['then'](function(_0x43c430){if(_0x43c430){logger[_0xa57c('0x21')](_0xa57c('0x22'),'status',_0xa57c('0x74'),_0x43c430[_0xa57c('0x48')],util[_0xa57c('0x75')](_0x599408[_0xa57c('0x55')],{'showHidden':![],'depth':null}));switch(_0x43c430[_0xa57c('0x48')]){case _0xa57c('0x76'):if(_0x599408[_0xa57c('0x55')]['MessageSid']&&_0x599408[_0xa57c('0x55')][_0xa57c('0x77')]===_0xef15c7['messageId']){return _0xef15c7['update']({'read':!![]});}else{logger[_0xa57c('0x24')](_0xa57c('0x78'),'status','twilio',util[_0xa57c('0x75')](_0x599408['body'],{'showHidden':![],'depth':null}));}break;case _0xa57c('0x79'):if(_0x599408[_0xa57c('0x55')]['MessageUUID']&&_0x599408[_0xa57c('0x55')][_0xa57c('0x7a')]===_0xef15c7[_0xa57c('0x7b')]&&_[_0xa57c('0x7c')]([_0xa57c('0x7d'),'delivered'],_0x599408[_0xa57c('0x55')]['Status'])>=0x0){return _0xef15c7[_0xa57c('0x32')]({'read':!![]});}else{logger[_0xa57c('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','plivio',util[_0xa57c('0x75')](_0x599408['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x175253=_0x599408[_0xa57c('0x55')][_0xa57c('0x7e')][0x0];if(_0x175253['status'][_0xa57c('0x7f')]===_0xa57c('0x80')){return _0xef15c7[_0xa57c('0x32')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa57c('0x29'),'infobip',util[_0xa57c('0x75')](_0x599408[_0xa57c('0x55')],{'showHidden':![],'depth':null}));}break;}return _0xef15c7;}})['then'](respondWithResult(_0x40a8db,null))[_0xa57c('0x27')](handleError(_0x40a8db,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 73afd69..866932e 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 _0x9960=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','SmsMessage'];(function(_0x369534,_0x5557c4){var _0x524bf9=function(_0x24c6fb){while(--_0x24c6fb){_0x369534['push'](_0x369534['shift']());}};_0x524bf9(++_0x5557c4);}(_0x9960,0x8e));var _0x0996=function(_0x4a0308,_0x5929c3){_0x4a0308=_0x4a0308-0x0;var _0x335917=_0x9960[_0x4a0308];return _0x335917;};'use strict';var EventEmitter=require(_0x0996('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x0996('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x0996('0x2')](0x0);var events={'afterCreate':_0x0996('0x3'),'afterUpdate':_0x0996('0x4'),'afterDestroy':_0x0996('0x5')};function emitEvent(_0x51c673){return function(_0x1e39f9,_0x2fa47b,_0x25d9cc){SmsMessageEvents[_0x0996('0x6')](_0x51c673+':'+_0x1e39f9['id'],_0x1e39f9);SmsMessageEvents[_0x0996('0x6')](_0x51c673,_0x1e39f9);_0x25d9cc(null);};}for(var e in events){if(events[_0x0996('0x7')](e)){var event=events[e];SmsMessage[_0x0996('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x2201=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsMessage'];(function(_0x55e1d1,_0x3c9376){var _0x1165db=function(_0x5b0120){while(--_0x5b0120){_0x55e1d1['push'](_0x55e1d1['shift']());}};_0x1165db(++_0x3c9376);}(_0x2201,0x85));var _0x1220=function(_0xe7961d,_0x15510a){_0xe7961d=_0xe7961d-0x0;var _0x19f83b=_0x2201[_0xe7961d];return _0x19f83b;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x1220('0x0'))['db'][_0x1220('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x1220('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1220('0x3'),'afterDestroy':_0x1220('0x4')};function emitEvent(_0x46ce01){return function(_0x3650c7,_0x46a2f6,_0x24811e){SmsMessageEvents[_0x1220('0x5')](_0x46ce01+':'+_0x3650c7['id'],_0x3650c7);SmsMessageEvents[_0x1220('0x5')](_0x46ce01,_0x3650c7);_0x24811e(null);};}for(var e in events){if(events[_0x1220('0x6')](e)){var event=events[e];SmsMessage[_0x1220('0x7')](e,emitEvent(event));}}module[_0x1220('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index bd1906c..bb1022f 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 _0xd534=['infobip','Missing\x20parameters:\x20base_url','csc','crypto','login','sender','text','timestamp','keys','sort','length','apiKey','createHash','digest','hex','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','intelepeer','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./smsMessage.attributes','define','SmsMessage','messageId','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','SmsInteractionId','then','update','createdAt','body','error','SmsAccount','find','SmsAccountId','type','twilio','authToken','phone','accountSid','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','&password=','split','POST','user_key','total_sent','internal_order_id','deliveryReport','read','catch','connectel','senderString','https://smsapi.connectel.se/api/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','toString','base64','http_code','data','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json'];(function(_0x5d0a01,_0x2bd718){var _0x46b831=function(_0x202171){while(--_0x202171){_0x5d0a01['push'](_0x5d0a01['shift']());}};_0x46b831(++_0x2bd718);}(_0xd534,0x106));var _0x4d53=function(_0x3da832,_0x2133f1){_0x3da832=_0x3da832-0x0;var _0xe602f2=_0xd534[_0x3da832];return _0xe602f2;};'use strict';var _=require(_0x4d53('0x0'));var util=require(_0x4d53('0x1'));var logger=require(_0x4d53('0x2'))(_0x4d53('0x3'));var moment=require(_0x4d53('0x4'));var BPromise=require(_0x4d53('0x5'));var rp=require(_0x4d53('0x6'));var attributes=require(_0x4d53('0x7'));module['exports']=function(_0x38c8ec,_0x50d493){return _0x38c8ec[_0x4d53('0x8')](_0x4d53('0x9'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x4d53('0xa'),'fields':[_0x4d53('0xa')]}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f4f5f,_0x277054,_0x339cb0){var _0x54381b=_0x38c8ec[_0x4d53('0xb')];var _0x4d9596=_0x4f4f5f[_0x4d53('0xc')]({'plain':!![]});if(_0x4d9596[_0x4d53('0xd')][_0x4d53('0xe')]()==='in'||_0x4d9596['direction'][_0x4d53('0xe')]()===_0x4d53('0xf')&&!_0x4d9596[_0x4d53('0x10')]&&!_[_0x4d53('0x11')](_0x4d9596[_0x4d53('0x12')])){_0x54381b[_0x4d53('0x13')]['findOne']({'where':{'id':_0x4d9596[_0x4d53('0x14')]}})[_0x4d53('0x15')](function(_0x2d1bc3){if(_0x2d1bc3){_0x2d1bc3[_0x4d53('0x16')]({'lastMsgAt':_0x4d9596[_0x4d53('0x17')],'lastMsgDirection':_0x4d9596['direction'][_0x4d53('0xe')](),'lastMsgBody':_0x4d9596[_0x4d53('0x18')]});}})['catch'](function(_0x112548){console[_0x4d53('0x19')](_0x112548);});}if(_0x4d9596[_0x4d53('0xd')]===_0x4d53('0xf')&&!_0x4d9596[_0x4d53('0x10')]){var _0x260444;_0x54381b[_0x4d53('0x1a')][_0x4d53('0x1b')]({'where':{'id':_0x4d9596[_0x4d53('0x1c')]},'raw':!![]})[_0x4d53('0x15')](function(_0xb27211){_0x260444=_0xb27211;if(_0x260444&&_0x260444[_0x4d53('0x1d')]){switch(_0x260444[_0x4d53('0x1d')]){case'twilio':var _0x3bf75e=require(_0x4d53('0x1e'));if(_0x260444['accountSid']&&_0x260444[_0x4d53('0x1f')]&&_0x260444[_0x4d53('0x20')]){var _0x15bc22=new _0x3bf75e(_0x260444[_0x4d53('0x21')],_0x260444[_0x4d53('0x1f')]);_0x15bc22[_0x4d53('0x22')][_0x4d53('0x23')]({'body':_0x4d9596[_0x4d53('0x18')],'to':_0x4d9596[_0x4d53('0x20')],'from':_0x260444['phone'],'statusCallback':_0x260444[_0x4d53('0x24')]+_0x4d53('0x25')+_0x4d9596['id']+_0x4d53('0x26')+_0x260444[_0x4d53('0x27')]})[_0x4d53('0x15')](function(_0x13b950){if(_0x13b950[_0x4d53('0x28')]){return _0x4f4f5f['update']({'messageId':_0x13b950[_0x4d53('0x28')]});}})['catch'](function(_0x3f00d1){logger[_0x4d53('0x19')](_0x4d53('0x29'),_0x4d53('0x2a'),_0x4d53('0x1e'),util[_0x4d53('0x2b')](_0x3f00d1,{'showHidden':![],'depth':null}));});}else{logger[_0x4d53('0x19')](_0x4d53('0x29'),_0x4d53('0x2a'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x4d53('0x2c'):var _0x33ca11=_0x4d53('0x2d');if(_0x260444[_0x4d53('0x2e')]&&_0x260444[_0x4d53('0x2f')]){var _0xde70b8={'recipient':[_0x4d9596[_0x4d53('0x20')]],'message':_0x4d9596[_0x4d53('0x18')],'message_type':_0x260444[_0x4d53('0x30')]};var _0x558fb7={'url':_0x33ca11+'login?username='+_0x260444[_0x4d53('0x2e')]+_0x4d53('0x31')+_0x260444[_0x4d53('0x2f')],'method':'GET'};rp(_0x558fb7)[_0x4d53('0x15')](function(_0x4b7ccf){var _0x1121cb=_0x4b7ccf[_0x4d53('0x32')](';');var _0x3e52c7={'user_key':_0x1121cb[0x0],'session_key':_0x1121cb[0x1]};_0x558fb7={'url':_0x33ca11+'sms','method':_0x4d53('0x33'),'headers':{'user_key':_0x3e52c7[_0x4d53('0x34')],'Session_key':_0x3e52c7['session_key']},'json':!![],'body':_0xde70b8};return rp(_0x558fb7);})[_0x4d53('0x15')](function(_0x206d0a){if(_0x206d0a[_0x4d53('0x35')]>=0x1){var _0x490aa6={'messageId':_0x206d0a[_0x4d53('0x36')]};if(_0x260444['smsMethod']!=='GP'||!_0x260444[_0x4d53('0x37')]){_0x490aa6[_0x4d53('0x38')]=!![];}return _0x4f4f5f[_0x4d53('0x16')](_0x490aa6);}else{return logger[_0x4d53('0x19')](_0x4d53('0x29'),_0x4d53('0x2a'),_0x4d53('0x2c'),util['inspect'](_0x206d0a,{'showHidden':![],'depth':null}));}})[_0x4d53('0x39')](function(_0x4186a5){return logger[_0x4d53('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x4d53('0x2c'),util[_0x4d53('0x2b')](_0x4186a5,{'showHidden':![],'depth':null}));});}else{logger[_0x4d53('0x19')](_0x4d53('0x29'),_0x4d53('0x2a'),_0x4d53('0x2c'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x4d53('0x3a'):if(_0x260444['authToken']){var _0x202551={'recipient':_0x4d9596['phone'],'message':_0x4d9596[_0x4d53('0x18')],'sender':_0x260444[_0x4d53('0x3b')]||_0x260444[_0x4d53('0x20')],'authorization':_0x260444[_0x4d53('0x1f')]};var _0x277054={'method':_0x4d53('0x33'),'uri':_0x4d53('0x3c'),'body':_0x202551,'json':!![]};rp(_0x277054)[_0x4d53('0x15')](function(_0x3d9ba2){var _0x157efe={'messageId':_0x3d9ba2[_0x4d53('0x3d')]};if(!_0x260444[_0x4d53('0x37')]){_0x157efe[_0x4d53('0x38')]=!![];}return _0x4f4f5f['update'](_0x157efe);})[_0x4d53('0x39')](function(_0x34bf60){logger['error'](_0x4d53('0x29'),'afterCreate',_0x4d53('0x3a'),util[_0x4d53('0x2b')](_0x34bf60,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4d53('0x2a'),'connectel',_0x4d53('0x3e'));}break;case _0x4d53('0x3f'):if(_0x260444[_0x4d53('0x2e')]&&_0x260444[_0x4d53('0x2f')]){var _0x202551={'messages':[{'source':_0x4d53('0x40'),'to':_0x4d9596[_0x4d53('0x20')],'body':_0x4d9596[_0x4d53('0x18')],'from':_0x260444[_0x4d53('0x3b')]||_0x260444[_0x4d53('0x20')]}]};var _0x270f80=util['format'](_0x4d53('0x41'),_0x260444[_0x4d53('0x2e')],_0x260444[_0x4d53('0x2f')]);var _0x277054={'method':_0x4d53('0x33'),'uri':_0x4d53('0x42'),'body':_0x202551,'headers':{'Authorization':util[_0x4d53('0x43')]('Basic\x20%s',new Buffer(_0x270f80)[_0x4d53('0x44')](_0x4d53('0x45')))},'json':!![]};rp(_0x277054)[_0x4d53('0x15')](function(_0x436430){if(_0x436430[_0x4d53('0x46')]>=0xc8&&_0x436430['http_code']<=0xce){if(_0x436430['data']&&_0x436430[_0x4d53('0x47')]['queued_count']>0x0){var _0xc8fe43=_[_0x4d53('0x48')](_0x436430['data'][_0x4d53('0x22')]);var _0x15e932={'messageId':_0xc8fe43[_0x4d53('0x49')]};if(!_0x260444['deliveryReport']){_0x15e932[_0x4d53('0x38')]=!![];}return _0x4f4f5f[_0x4d53('0x16')](_0x15e932);}else{logger[_0x4d53('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',util[_0x4d53('0x2b')](_0x436430,{'showHidden':![],'depth':null}));}}else{logger[_0x4d53('0x19')](_0x4d53('0x29'),_0x4d53('0x2a'),_0x4d53('0x4a'),util[_0x4d53('0x2b')](_0x436430,{'showHidden':![],'depth':null}));}})[_0x4d53('0x39')](function(_0x17ca5d){logger[_0x4d53('0x19')](_0x4d53('0x29'),_0x4d53('0x2a'),'clickSend',util['inspect'](_0x17ca5d,{'showHidden':![],'depth':null}));});}else{logger[_0x4d53('0x19')](_0x4d53('0x29'),_0x4d53('0x2a'),'clickSend',_0x4d53('0x4b'));}break;case _0x4d53('0x4c'):if(_0x260444[_0x4d53('0x4d')]&&_0x260444[_0x4d53('0x1f')]){var _0x202551={'dst':_0x4d9596['phone'],'text':_0x4d9596[_0x4d53('0x18')],'src':_0x260444[_0x4d53('0x3b')]||_0x260444['phone'],'url':_0x260444[_0x4d53('0x24')]+_0x4d53('0x25')+_0x4d9596['id']+_0x4d53('0x26')+_0x260444['token']};var _0x270f80=util[_0x4d53('0x43')](_0x4d53('0x41'),_0x260444['authId'],_0x260444[_0x4d53('0x1f')]);var _0x277054={'method':_0x4d53('0x33'),'uri':util[_0x4d53('0x43')](_0x4d53('0x4e'),_0x260444[_0x4d53('0x4d')]),'body':_0x202551,'headers':{'Authorization':util[_0x4d53('0x43')](_0x4d53('0x4f'),new Buffer(_0x270f80)['toString'](_0x4d53('0x45')))},'json':!![]};rp(_0x277054)['then'](function(_0x1163b4){var _0x54ae6e={'messageId':_0x1163b4[_0x4d53('0x50')][0x0]};return _0x4f4f5f['update'](_0x54ae6e);})[_0x4d53('0x39')](function(_0x25ef15){logger[_0x4d53('0x19')](_0x4d53('0x29'),_0x4d53('0x2a'),_0x4d53('0x4c'),util[_0x4d53('0x2b')](_0x25ef15,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4d53('0x29'),_0x4d53('0x2a'),_0x4d53('0x4c'),_0x4d53('0x51'));}break;case'infobip':if(_0x260444[_0x4d53('0x2e')]&&_0x260444[_0x4d53('0x2f')]){if(_0x260444[_0x4d53('0x52')]){var _0x364011={'method':_0x4d53('0x33'),'uri':_0x260444[_0x4d53('0x52')]+_0x4d53('0x53'),'body':{'username':_0x260444[_0x4d53('0x2e')],'password':_0x260444[_0x4d53('0x2f')]},'json':!![]};return rp(_0x364011)['then'](function(_0x28e0ee){var _0x3b1775={'method':_0x4d53('0x33'),'uri':_0x260444['baseUrl']+_0x4d53('0x54'),'body':{'messages':[{'from':_0x260444[_0x4d53('0x20')],'destinations':[{'to':_0x4d9596['phone']}],'text':_0x4d9596[_0x4d53('0x18')],'notifyUrl':_0x260444[_0x4d53('0x24')]+_0x4d53('0x25')+_0x4d9596['id']+_0x4d53('0x26')+_0x260444[_0x4d53('0x27')],'notifyContentType':_0x4d53('0x55'),'callbackData':_0x260444[_0x4d53('0x20')]+';'+_0x4d9596[_0x4d53('0x18')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x28e0ee[_0x4d53('0x27')]},'json':!![]};return rp(_0x3b1775)[_0x4d53('0x15')](function(_0x53c7ba){if(_0x53c7ba[_0x4d53('0x22')]){var _0x58393d={'messageId':_0x53c7ba[_0x4d53('0x22')][0x0][_0x4d53('0xa')]};if(!_0x260444[_0x4d53('0x37')]){_0x58393d[_0x4d53('0x38')]=!![];}return _0x4f4f5f[_0x4d53('0x16')](_0x58393d);}else{return logger[_0x4d53('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4d53('0x2a'),_0x4d53('0x56'),util['inspect'](_0x53c7ba,{'showHidden':![],'depth':null}));}});})[_0x4d53('0x39')](function(_0x401ac4){return logger['error'](_0x4d53('0x29'),_0x4d53('0x2a'),_0x4d53('0x56'),util[_0x4d53('0x2b')](_0x401ac4,{'showHidden':![],'depth':null}));});}else{logger[_0x4d53('0x19')](_0x4d53('0x29'),'afterCreate',_0x4d53('0x56'),_0x4d53('0x57'));}}else{logger['error'](_0x4d53('0x29'),'afterCreate','infobip','Missing\x20parameters:\x20username,\x20password');}case _0x4d53('0x58'):var _0x539a45=require(_0x4d53('0x59'));if(_0x260444['apiKey']){var _0x170613={};_0x170613[_0x4d53('0x5a')]=_0x260444[_0x4d53('0x2e')];_0x170613[_0x4d53('0x20')]=_0x4d9596['phone'];_0x170613[_0x4d53('0x5b')]=_0x260444['phone'];_0x170613[_0x4d53('0x5c')]=_0x4d9596[_0x4d53('0x18')];_0x170613[_0x4d53('0x5d')]=+new Date();var _0x43ac1d='';var _0x194b9d='';var _0x549398=Object[_0x4d53('0x5e')](_0x170613);_0x549398[_0x4d53('0x5f')]();for(var _0x2e9e42=0x0;_0x2e9e42<_0x549398[_0x4d53('0x60')];_0x2e9e42++){if(_0x43ac1d!=''){_0x43ac1d+='&';}_0x43ac1d+=_0x549398[_0x2e9e42]+'='+encodeURIComponent(_0x170613[_0x549398[_0x2e9e42]]);_0x194b9d+=_0x170613[_0x549398[_0x2e9e42]];}_0x194b9d+=_0x260444[_0x4d53('0x61')];_0x194b9d=_0x539a45[_0x4d53('0x62')]('md5')[_0x4d53('0x16')](_0x194b9d)[_0x4d53('0x63')](_0x4d53('0x64'));if(_0x43ac1d!==''){_0x43ac1d+='&';}_0x43ac1d+='signature='+_0x194b9d;var _0x558fb7={'method':'GET','uri':'https://sms.csc.lv/external/get/send.php?'+_0x43ac1d,'json':!![]};return rp(_0x558fb7)[_0x4d53('0x15')](function(_0x2e1717){var _0x502373=Object['keys'](_0x2e1717);if(_0x2e1717[_0x502373[0x0]][_0x4d53('0x19')]&&parseInt(_0x2e1717[_0x502373[0x0]]['error'])===0x0){var _0x54736c={'messageId':_0x2e1717[_0x502373[0x0]][_0x4d53('0x65')]};if(!_0x260444[_0x4d53('0x37')]){_0x54736c['read']=!![];}return _0x4f4f5f[_0x4d53('0x16')](_0x54736c);}else{return logger[_0x4d53('0x19')](_0x4d53('0x29'),'afterCreate',_0x4d53('0x58'),util[_0x4d53('0x2b')](_0x2e1717[_0x4d53('0x19')],{'showHidden':![],'depth':null}));}})[_0x4d53('0x39')](function(_0x36df70){return logger[_0x4d53('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','csc',util['inspect'](_0x36df70,{'showHidden':![],'depth':null}));});}else{logger[_0x4d53('0x19')](_0x4d53('0x29'),'afterCreate',_0x4d53('0x58'),_0x4d53('0x66'));}case _0x4d53('0x67'):if(_0x260444[_0x4d53('0x61')]){var _0x29a580={'method':_0x4d53('0x33'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x260444[_0x4d53('0x61')]},'body':{'content':_0x4d9596[_0x4d53('0x18')],'to':[_0x4d9596['phone']],'from':_0x260444[_0x4d53('0x20')],'binary':![],'clientMessageId':_0x4d53('0x68'),'charset':_0x4d53('0x69')},'json':!![]};rp(_0x29a580)[_0x4d53('0x15')](function(_0x13b39a){if(!_0x13b39a[_0x4d53('0x19')]){var _0x2a61f9={'messageId':_0x13b39a[_0x4d53('0x22')][0x0][_0x4d53('0x6a')]};if(!_0x260444['deliveryReport']){_0x2a61f9[_0x4d53('0x38')]=!![];}return _0x4f4f5f[_0x4d53('0x16')](_0x2a61f9);}else{return logger[_0x4d53('0x19')](_0x4d53('0x29'),_0x4d53('0x2a'),_0x4d53('0x67'),util[_0x4d53('0x2b')](_0x13b39a[_0x4d53('0x19')],{'showHidden':![],'depth':null}));}})[_0x4d53('0x39')](function(_0x2d4b14){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4d53('0x2a'),_0x4d53('0x67'),util[_0x4d53('0x2b')](_0x2d4b14,{'showHidden':![],'depth':null}));});}else{logger[_0x4d53('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x4d53('0x67'),'Missing\x20parameters:\x20apiKey');}break;case'intelepeer':if(_0x260444['apiKey']){var _0x2f8741={};var _0x558fb7={'method':_0x4d53('0x33'),'uri':_0x4d53('0x6b'),'headers':{'Authorization':_0x4d53('0x6c')+_0x260444['apiKey'],'Content-Type':_0x4d53('0x55')},'body':{'from':_0x260444[_0x4d53('0x20')],'to':_0x4d9596[_0x4d53('0x20')],'text':_0x4d9596[_0x4d53('0x18')]},'json':!![]};return rp(_0x558fb7)['then'](function(_0x5339b7){if(_0x5339b7[_0x4d53('0x6d')]==0xca){_0x2f8741['message']=_0x5339b7;var _0x2e95de={'method':_0x4d53('0x33'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x4d53('0x6c')+_0x260444['apiKey'],'Content-Type':_0x4d53('0x55')},'body':{'refid':_0x2f8741[_0x4d53('0x6e')][_0x4d53('0x6f')]},'json':!![]};return rp(_0x2e95de)[_0x4d53('0x15')](function(_0x3640af){_0x2f8741['status']=_0x3640af;var _0x19aa1b={'messageId':_0x2f8741['message'][_0x4d53('0x6f')],'read':!![]};return _0x4f4f5f[_0x4d53('0x16')](_0x19aa1b);});}else{return logger[_0x4d53('0x19')](_0x4d53('0x29'),_0x4d53('0x2a'),_0x4d53('0x70'),util['inspect'](_0x5339b7,{'showHidden':![],'depth':null}));}})[_0x4d53('0x39')](function(_0x2d9671){return logger[_0x4d53('0x19')](_0x4d53('0x29'),'afterCreate','intelepeer',util[_0x4d53('0x2b')](_0x2d9671,{'showHidden':![],'depth':null}));});}else{return logger[_0x4d53('0x19')](_0x4d53('0x29'),_0x4d53('0x2a'),_0x4d53('0x70'),_0x4d53('0x71'));}break;}}})['finally'](function(){_0x339cb0();});}else{_0x339cb0();}}},'charset':_0x4d53('0x72'),'collate':_0x4d53('0x73')});}; \ No newline at end of file +var _0x8a06=['toLowerCase','out','secret','isNil','UserId','SmsInteraction','SmsInteractionId','then','update','body','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','messages','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','password','phone','smsMethod','&password=','GET','split','sms','POST','user_key','total_sent','internal_order_id','read','skebby','Missing\x20parameters:\x20username,\x20password','https://smsapi.connectel.se/api/send/','requestid','deliveryReport','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','message_id','clickSend','authId','senderString','remote','/status?token=','plivo','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','crypto','login','sender','text','timestamp','sort','length','createHash','md5','digest','hex','signature=','https://sms.csc.lv/external/get/send.php?','keys','id_sms','csc','clickatell','apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','finally','utf8mb4','lodash','../../config/logger','api','moment','request-promise','./smsMessage.attributes','exports','define','sms_messages','messageId','get','direction'];(function(_0x130a69,_0x5b6502){var _0x5bb275=function(_0x390d13){while(--_0x390d13){_0x130a69['push'](_0x130a69['shift']());}};_0x5bb275(++_0x5b6502);}(_0x8a06,0x65));var _0x68a0=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x8a06[_0x1b7368];return _0x25d54c;};'use strict';var _=require(_0x68a0('0x0'));var util=require('util');var logger=require(_0x68a0('0x1'))(_0x68a0('0x2'));var moment=require(_0x68a0('0x3'));var BPromise=require('bluebird');var rp=require(_0x68a0('0x4'));var attributes=require(_0x68a0('0x5'));module[_0x68a0('0x6')]=function(_0x514fdc,_0x5d8533){return _0x514fdc[_0x68a0('0x7')]('SmsMessage',attributes,{'tableName':_0x68a0('0x8'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x68a0('0x9')]}],'timestamps':!![],'hooks':{'afterCreate':function(_0xd01740,_0x54af71,_0x354d2b){var _0x2c5198=_0x514fdc['models'];var _0x1e3623=_0xd01740[_0x68a0('0xa')]({'plain':!![]});if(_0x1e3623[_0x68a0('0xb')]['toLowerCase']()==='in'||_0x1e3623['direction'][_0x68a0('0xc')]()===_0x68a0('0xd')&&!_0x1e3623[_0x68a0('0xe')]&&!_[_0x68a0('0xf')](_0x1e3623[_0x68a0('0x10')])){_0x2c5198[_0x68a0('0x11')]['findOne']({'where':{'id':_0x1e3623[_0x68a0('0x12')]}})[_0x68a0('0x13')](function(_0x320d2f){if(_0x320d2f){_0x320d2f[_0x68a0('0x14')]({'lastMsgAt':_0x1e3623['createdAt'],'lastMsgDirection':_0x1e3623[_0x68a0('0xb')][_0x68a0('0xc')](),'lastMsgBody':_0x1e3623[_0x68a0('0x15')]});}})[_0x68a0('0x16')](function(_0x8a60c1){console[_0x68a0('0x17')](_0x8a60c1);});}if(_0x1e3623[_0x68a0('0xb')]===_0x68a0('0xd')&&!_0x1e3623['secret']){var _0x465ea5;_0x2c5198[_0x68a0('0x18')][_0x68a0('0x19')]({'where':{'id':_0x1e3623[_0x68a0('0x1a')]},'raw':!![]})[_0x68a0('0x13')](function(_0x18d5f7){_0x465ea5=_0x18d5f7;if(_0x465ea5&&_0x465ea5[_0x68a0('0x1b')]){switch(_0x465ea5[_0x68a0('0x1b')]){case'twilio':var _0x15a51e=require(_0x68a0('0x1c'));if(_0x465ea5[_0x68a0('0x1d')]&&_0x465ea5['authToken']&&_0x465ea5['phone']){var _0x136096=new _0x15a51e(_0x465ea5['accountSid'],_0x465ea5[_0x68a0('0x1e')]);_0x136096[_0x68a0('0x1f')]['create']({'body':_0x1e3623[_0x68a0('0x15')],'to':_0x1e3623['phone'],'from':_0x465ea5['phone'],'statusCallback':_0x465ea5['remote']+_0x68a0('0x20')+_0x1e3623['id']+'/status?token='+_0x465ea5[_0x68a0('0x21')]})[_0x68a0('0x13')](function(_0x443cdf){if(_0x443cdf[_0x68a0('0x22')]){return _0xd01740['update']({'messageId':_0x443cdf['sid']});}})['catch'](function(_0x1b7243){logger['error'](_0x68a0('0x23'),_0x68a0('0x24'),'twilio',util[_0x68a0('0x25')](_0x1b7243,{'showHidden':![],'depth':null}));});}else{logger[_0x68a0('0x17')](_0x68a0('0x23'),'afterCreate',_0x68a0('0x1c'),_0x68a0('0x26'));}break;case'skebby':var _0x14433a='https://api.skebby.it/API/v1.0/REST/';if(_0x465ea5[_0x68a0('0x27')]&&_0x465ea5[_0x68a0('0x28')]){var _0x3f086e={'recipient':[_0x1e3623[_0x68a0('0x29')]],'message':_0x1e3623[_0x68a0('0x15')],'message_type':_0x465ea5[_0x68a0('0x2a')]};var _0x466499={'url':_0x14433a+'login?username='+_0x465ea5[_0x68a0('0x27')]+_0x68a0('0x2b')+_0x465ea5[_0x68a0('0x28')],'method':_0x68a0('0x2c')};rp(_0x466499)['then'](function(_0x188ca3){var _0x39d614=_0x188ca3[_0x68a0('0x2d')](';');var _0x3f28c1={'user_key':_0x39d614[0x0],'session_key':_0x39d614[0x1]};_0x466499={'url':_0x14433a+_0x68a0('0x2e'),'method':_0x68a0('0x2f'),'headers':{'user_key':_0x3f28c1[_0x68a0('0x30')],'Session_key':_0x3f28c1['session_key']},'json':!![],'body':_0x3f086e};return rp(_0x466499);})[_0x68a0('0x13')](function(_0x78629f){if(_0x78629f[_0x68a0('0x31')]>=0x1){var _0x4fb848={'messageId':_0x78629f[_0x68a0('0x32')]};if(_0x465ea5[_0x68a0('0x2a')]!=='GP'||!_0x465ea5['deliveryReport']){_0x4fb848[_0x68a0('0x33')]=!![];}return _0xd01740[_0x68a0('0x14')](_0x4fb848);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x68a0('0x24'),_0x68a0('0x34'),util['inspect'](_0x78629f,{'showHidden':![],'depth':null}));}})[_0x68a0('0x16')](function(_0x2ef457){return logger[_0x68a0('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x68a0('0x24'),_0x68a0('0x34'),util[_0x68a0('0x25')](_0x2ef457,{'showHidden':![],'depth':null}));});}else{logger[_0x68a0('0x17')](_0x68a0('0x23'),_0x68a0('0x24'),_0x68a0('0x34'),_0x68a0('0x35'));}break;case'connectel':if(_0x465ea5[_0x68a0('0x1e')]){var _0x3c2c05={'recipient':_0x1e3623[_0x68a0('0x29')],'message':_0x1e3623['body'],'sender':_0x465ea5['senderString']||_0x465ea5[_0x68a0('0x29')],'authorization':_0x465ea5[_0x68a0('0x1e')]};var _0x54af71={'method':_0x68a0('0x2f'),'uri':_0x68a0('0x36'),'body':_0x3c2c05,'json':!![]};rp(_0x54af71)[_0x68a0('0x13')](function(_0x4b9887){var _0x17a0cb={'messageId':_0x4b9887[_0x68a0('0x37')]};if(!_0x465ea5[_0x68a0('0x38')]){_0x17a0cb[_0x68a0('0x33')]=!![];}return _0xd01740['update'](_0x17a0cb);})[_0x68a0('0x16')](function(_0x476112){logger['error'](_0x68a0('0x23'),'afterCreate',_0x68a0('0x39'),util[_0x68a0('0x25')](_0x476112,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x68a0('0x24'),_0x68a0('0x39'),_0x68a0('0x3a'));}break;case _0x68a0('0x3b'):if(_0x465ea5[_0x68a0('0x27')]&&_0x465ea5[_0x68a0('0x28')]){var _0x3c2c05={'messages':[{'source':_0x68a0('0x3c'),'to':_0x1e3623[_0x68a0('0x29')],'body':_0x1e3623[_0x68a0('0x15')],'from':_0x465ea5['senderString']||_0x465ea5['phone']}]};var _0xc7d761=util[_0x68a0('0x3d')](_0x68a0('0x3e'),_0x465ea5[_0x68a0('0x27')],_0x465ea5[_0x68a0('0x28')]);var _0x54af71={'method':'POST','uri':_0x68a0('0x3f'),'body':_0x3c2c05,'headers':{'Authorization':util[_0x68a0('0x3d')](_0x68a0('0x40'),new Buffer(_0xc7d761)[_0x68a0('0x41')]('base64'))},'json':!![]};rp(_0x54af71)[_0x68a0('0x13')](function(_0x151548){if(_0x151548['http_code']>=0xc8&&_0x151548[_0x68a0('0x42')]<=0xce){if(_0x151548[_0x68a0('0x43')]&&_0x151548['data'][_0x68a0('0x44')]>0x0){var _0x31eb3b=_['head'](_0x151548[_0x68a0('0x43')]['messages']);var _0x26c8ba={'messageId':_0x31eb3b[_0x68a0('0x45')]};if(!_0x465ea5[_0x68a0('0x38')]){_0x26c8ba[_0x68a0('0x33')]=!![];}return _0xd01740['update'](_0x26c8ba);}else{logger[_0x68a0('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x68a0('0x24'),'clickSend',util['inspect'](_0x151548,{'showHidden':![],'depth':null}));}}else{logger[_0x68a0('0x17')](_0x68a0('0x23'),_0x68a0('0x24'),_0x68a0('0x46'),util[_0x68a0('0x25')](_0x151548,{'showHidden':![],'depth':null}));}})[_0x68a0('0x16')](function(_0x118505){logger[_0x68a0('0x17')](_0x68a0('0x23'),'afterCreate','clickSend',util[_0x68a0('0x25')](_0x118505,{'showHidden':![],'depth':null}));});}else{logger[_0x68a0('0x17')](_0x68a0('0x23'),_0x68a0('0x24'),_0x68a0('0x46'),_0x68a0('0x35'));}break;case'plivo':if(_0x465ea5[_0x68a0('0x47')]&&_0x465ea5[_0x68a0('0x1e')]){var _0x3c2c05={'dst':_0x1e3623['phone'],'text':_0x1e3623[_0x68a0('0x15')],'src':_0x465ea5[_0x68a0('0x48')]||_0x465ea5[_0x68a0('0x29')],'url':_0x465ea5[_0x68a0('0x49')]+_0x68a0('0x20')+_0x1e3623['id']+_0x68a0('0x4a')+_0x465ea5['token']};var _0xc7d761=util[_0x68a0('0x3d')]('%s:%s',_0x465ea5[_0x68a0('0x47')],_0x465ea5[_0x68a0('0x1e')]);var _0x54af71={'method':'POST','uri':util[_0x68a0('0x3d')]('https://api.plivo.com/v1/Account/%s/Message/',_0x465ea5[_0x68a0('0x47')]),'body':_0x3c2c05,'headers':{'Authorization':util['format'](_0x68a0('0x40'),new Buffer(_0xc7d761)['toString']('base64'))},'json':!![]};rp(_0x54af71)[_0x68a0('0x13')](function(_0xb6a035){var _0x4f3df9={'messageId':_0xb6a035['message_uuid'][0x0]};return _0xd01740[_0x68a0('0x14')](_0x4f3df9);})['catch'](function(_0x122c6f){logger[_0x68a0('0x17')](_0x68a0('0x23'),_0x68a0('0x24'),_0x68a0('0x4b'),util['inspect'](_0x122c6f,{'showHidden':![],'depth':null}));});}else{logger[_0x68a0('0x17')](_0x68a0('0x23'),_0x68a0('0x24'),_0x68a0('0x4b'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x465ea5['username']&&_0x465ea5[_0x68a0('0x28')]){if(_0x465ea5[_0x68a0('0x4c')]){var _0x19dddd={'method':_0x68a0('0x2f'),'uri':_0x465ea5['baseUrl']+_0x68a0('0x4d'),'body':{'username':_0x465ea5['username'],'password':_0x465ea5['password']},'json':!![]};return rp(_0x19dddd)[_0x68a0('0x13')](function(_0x2bac0f){var _0x5a2fee={'method':_0x68a0('0x2f'),'uri':_0x465ea5['baseUrl']+_0x68a0('0x4e'),'body':{'messages':[{'from':_0x465ea5['phone'],'destinations':[{'to':_0x1e3623[_0x68a0('0x29')]}],'text':_0x1e3623[_0x68a0('0x15')],'notifyUrl':_0x465ea5[_0x68a0('0x49')]+'/api/sms/messages/'+_0x1e3623['id']+_0x68a0('0x4a')+_0x465ea5[_0x68a0('0x21')],'notifyContentType':_0x68a0('0x4f'),'callbackData':_0x465ea5[_0x68a0('0x29')]+';'+_0x1e3623[_0x68a0('0x15')]}]},'headers':{'Authorization':_0x68a0('0x50')+_0x2bac0f['token']},'json':!![]};return rp(_0x5a2fee)['then'](function(_0x25613e){if(_0x25613e[_0x68a0('0x1f')]){var _0x29801c={'messageId':_0x25613e[_0x68a0('0x1f')][0x0][_0x68a0('0x9')]};if(!_0x465ea5[_0x68a0('0x38')]){_0x29801c['read']=!![];}return _0xd01740[_0x68a0('0x14')](_0x29801c);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x68a0('0x24'),_0x68a0('0x51'),util[_0x68a0('0x25')](_0x25613e,{'showHidden':![],'depth':null}));}});})[_0x68a0('0x16')](function(_0x41be6b){return logger[_0x68a0('0x17')](_0x68a0('0x23'),_0x68a0('0x24'),'infobip',util[_0x68a0('0x25')](_0x41be6b,{'showHidden':![],'depth':null}));});}else{logger[_0x68a0('0x17')](_0x68a0('0x23'),_0x68a0('0x24'),'infobip',_0x68a0('0x52'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x68a0('0x24'),_0x68a0('0x51'),_0x68a0('0x35'));}case'csc':var _0x348792=require(_0x68a0('0x53'));if(_0x465ea5['apiKey']){var _0x32578f={};_0x32578f[_0x68a0('0x54')]=_0x465ea5['username'];_0x32578f[_0x68a0('0x29')]=_0x1e3623[_0x68a0('0x29')];_0x32578f[_0x68a0('0x55')]=_0x465ea5[_0x68a0('0x29')];_0x32578f[_0x68a0('0x56')]=_0x1e3623[_0x68a0('0x15')];_0x32578f[_0x68a0('0x57')]=+new Date();var _0x55d541='';var _0x148483='';var _0x1672c5=Object['keys'](_0x32578f);_0x1672c5[_0x68a0('0x58')]();for(var _0x5ab0be=0x0;_0x5ab0be<_0x1672c5[_0x68a0('0x59')];_0x5ab0be++){if(_0x55d541!=''){_0x55d541+='&';}_0x55d541+=_0x1672c5[_0x5ab0be]+'='+encodeURIComponent(_0x32578f[_0x1672c5[_0x5ab0be]]);_0x148483+=_0x32578f[_0x1672c5[_0x5ab0be]];}_0x148483+=_0x465ea5['apiKey'];_0x148483=_0x348792[_0x68a0('0x5a')](_0x68a0('0x5b'))['update'](_0x148483)[_0x68a0('0x5c')](_0x68a0('0x5d'));if(_0x55d541!==''){_0x55d541+='&';}_0x55d541+=_0x68a0('0x5e')+_0x148483;var _0x466499={'method':_0x68a0('0x2c'),'uri':_0x68a0('0x5f')+_0x55d541,'json':!![]};return rp(_0x466499)[_0x68a0('0x13')](function(_0x1c27cd){var _0x30df8c=Object[_0x68a0('0x60')](_0x1c27cd);if(_0x1c27cd[_0x30df8c[0x0]][_0x68a0('0x17')]&&parseInt(_0x1c27cd[_0x30df8c[0x0]]['error'])===0x0){var _0x3cd9a0={'messageId':_0x1c27cd[_0x30df8c[0x0]][_0x68a0('0x61')]};if(!_0x465ea5[_0x68a0('0x38')]){_0x3cd9a0[_0x68a0('0x33')]=!![];}return _0xd01740[_0x68a0('0x14')](_0x3cd9a0);}else{return logger[_0x68a0('0x17')](_0x68a0('0x23'),_0x68a0('0x24'),_0x68a0('0x62'),util['inspect'](_0x1c27cd[_0x68a0('0x17')],{'showHidden':![],'depth':null}));}})[_0x68a0('0x16')](function(_0xdaf53c){return logger[_0x68a0('0x17')](_0x68a0('0x23'),_0x68a0('0x24'),_0x68a0('0x62'),util[_0x68a0('0x25')](_0xdaf53c,{'showHidden':![],'depth':null}));});}else{logger[_0x68a0('0x17')](_0x68a0('0x23'),'afterCreate','csc','Missing\x20parameters:\x20apiKey');}case _0x68a0('0x63'):if(_0x465ea5[_0x68a0('0x64')]){var _0x5d3308={'method':_0x68a0('0x2f'),'uri':_0x68a0('0x65'),'headers':{'Authorization':_0x465ea5[_0x68a0('0x64')]},'body':{'content':_0x1e3623['body'],'to':[_0x1e3623[_0x68a0('0x29')]],'from':_0x465ea5[_0x68a0('0x29')],'binary':![],'clientMessageId':_0x68a0('0x66'),'charset':_0x68a0('0x67')},'json':!![]};rp(_0x5d3308)[_0x68a0('0x13')](function(_0x5ee8d0){if(!_0x5ee8d0['error']){var _0x563953={'messageId':_0x5ee8d0[_0x68a0('0x1f')][0x0]['apiMessageId']};if(!_0x465ea5['deliveryReport']){_0x563953[_0x68a0('0x33')]=!![];}return _0xd01740[_0x68a0('0x14')](_0x563953);}else{return logger[_0x68a0('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x68a0('0x63'),util[_0x68a0('0x25')](_0x5ee8d0[_0x68a0('0x17')],{'showHidden':![],'depth':null}));}})[_0x68a0('0x16')](function(_0x55aaf7){return logger[_0x68a0('0x17')](_0x68a0('0x23'),_0x68a0('0x24'),'clickatell',util[_0x68a0('0x25')](_0x55aaf7,{'showHidden':![],'depth':null}));});}else{logger[_0x68a0('0x17')](_0x68a0('0x23'),_0x68a0('0x24'),'clickatell','Missing\x20parameters:\x20apiKey');}break;case _0x68a0('0x68'):if(_0x465ea5[_0x68a0('0x64')]){var _0x3e282c={};var _0x466499={'method':_0x68a0('0x2f'),'uri':_0x68a0('0x69'),'headers':{'Authorization':_0x68a0('0x6a')+_0x465ea5[_0x68a0('0x64')],'Content-Type':_0x68a0('0x4f')},'body':{'from':_0x465ea5[_0x68a0('0x29')],'to':_0x1e3623[_0x68a0('0x29')],'text':_0x1e3623['body']},'json':!![]};return rp(_0x466499)[_0x68a0('0x13')](function(_0x179906){if(_0x179906[_0x68a0('0x6b')]==0xca){_0x3e282c[_0x68a0('0x6c')]=_0x179906;var _0x35c155={'method':'POST','uri':_0x68a0('0x6d'),'headers':{'Authorization':_0x68a0('0x6a')+_0x465ea5[_0x68a0('0x64')],'Content-Type':_0x68a0('0x4f')},'body':{'refid':_0x3e282c[_0x68a0('0x6c')][_0x68a0('0x6e')]},'json':!![]};return rp(_0x35c155)[_0x68a0('0x13')](function(_0x29eb95){_0x3e282c['status']=_0x29eb95;var _0x2d835c={'messageId':_0x3e282c[_0x68a0('0x6c')][_0x68a0('0x6e')],'read':!![]};return _0xd01740[_0x68a0('0x14')](_0x2d835c);});}else{return logger[_0x68a0('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x68a0('0x24'),_0x68a0('0x68'),util[_0x68a0('0x25')](_0x179906,{'showHidden':![],'depth':null}));}})[_0x68a0('0x16')](function(_0x3aa2db){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x68a0('0x24'),_0x68a0('0x68'),util[_0x68a0('0x25')](_0x3aa2db,{'showHidden':![],'depth':null}));});}else{return logger[_0x68a0('0x17')](_0x68a0('0x23'),_0x68a0('0x24'),_0x68a0('0x68'),'Token\x20not\x20received');}break;}}})[_0x68a0('0x6f')](function(){_0x354d2b();});}else{_0x354d2b();}}},'charset':_0x68a0('0x70'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 1af6a3a..71c409a 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 _0xeda5=['CreateSmsMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','localhost','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','SmsMessage','create','body','options','raw'];(function(_0x17fd65,_0x556d01){var _0x27d033=function(_0x466323){while(--_0x466323){_0x17fd65['push'](_0x17fd65['shift']());}};_0x27d033(++_0x556d01);}(_0xeda5,0x1c1));var _0x5eda=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeda5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5eda('0x0'));var util=require(_0x5eda('0x1'));var moment=require(_0x5eda('0x2'));var BPromise=require(_0x5eda('0x3'));var rs=require(_0x5eda('0x4'));var fs=require('fs');var Redis=require(_0x5eda('0x5'));var db=require(_0x5eda('0x6'))['db'];var utils=require(_0x5eda('0x7'));var logger=require(_0x5eda('0x8'))('rpc');var config=require(_0x5eda('0x9'));var jayson=require(_0x5eda('0xa'));var client=jayson['client'][_0x5eda('0xb')]({'port':0x232a});config['redis']=_[_0x5eda('0xc')](config['redis'],{'host':_0x5eda('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0x397497,_0x1caafa,_0x2c1f8a){return new BPromise(function(_0x125b97,_0x209a5a){return client[_0x5eda('0xe')](_0x397497,_0x2c1f8a)[_0x5eda('0xf')](function(_0x32878f){logger[_0x5eda('0x10')](_0x5eda('0x11'),_0x1caafa,_0x5eda('0x12'));logger[_0x5eda('0x13')](_0x5eda('0x14'),_0x1caafa,_0x5eda('0x12'),JSON[_0x5eda('0x15')](_0x32878f));if(_0x32878f['error']){if(_0x32878f[_0x5eda('0x16')][_0x5eda('0x17')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x1caafa,_0x32878f['error'][_0x5eda('0x18')]);return _0x209a5a(_0x32878f['error'][_0x5eda('0x18')]);}logger[_0x5eda('0x16')](_0x5eda('0x11'),_0x1caafa,_0x32878f[_0x5eda('0x16')]['message']);return _0x125b97(_0x32878f[_0x5eda('0x16')][_0x5eda('0x18')]);}else{logger[_0x5eda('0x10')]('SmsMessage,\x20%s,\x20%s',_0x1caafa,_0x5eda('0x12'));_0x125b97(_0x32878f['result'][_0x5eda('0x18')]);}})[_0x5eda('0x19')](function(_0x3b6295){logger[_0x5eda('0x16')]('SmsMessage,\x20%s,\x20%s',_0x1caafa,_0x3b6295);_0x209a5a(_0x3b6295);});});}exports['CreateSmsMessage']=function(_0x28bd02){var _0x279460=this;return new Promise(function(_0x84ccee,_0x4cceb3){return db[_0x5eda('0x1a')][_0x5eda('0x1b')](_0x28bd02[_0x5eda('0x1c')],{'raw':_0x28bd02[_0x5eda('0x1d')]?_0x28bd02[_0x5eda('0x1d')][_0x5eda('0x1e')]===undefined?!![]:![]:!![]})[_0x5eda('0xf')](function(_0x277847){logger[_0x5eda('0x10')]('CreateSmsMessage',_0x28bd02);logger[_0x5eda('0x13')](_0x5eda('0x1f'),_0x28bd02,JSON['stringify'](_0x277847));_0x84ccee(_0x277847);})['catch'](function(_0x344306){logger[_0x5eda('0x16')](_0x5eda('0x1f'),_0x344306[_0x5eda('0x18')],_0x28bd02);_0x4cceb3(_0x279460['error'](0x1f4,_0x344306['message']));});});}; \ No newline at end of file +var _0xd16a=['defaults','localhost','socket.io-emitter','register','request','then','SmsMessage,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','catch','SmsMessage','create','body','options','CreateSmsMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x355e1f,_0x4d983b){var _0x16dfd0=function(_0x127522){while(--_0x127522){_0x355e1f['push'](_0x355e1f['shift']());}};_0x16dfd0(++_0x4d983b);}(_0xd16a,0x18a));var _0xad16=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd16a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xad16('0x0'));var util=require(_0xad16('0x1'));var moment=require(_0xad16('0x2'));var BPromise=require(_0xad16('0x3'));var rs=require(_0xad16('0x4'));var fs=require('fs');var Redis=require(_0xad16('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xad16('0x6'));var logger=require(_0xad16('0x7'))(_0xad16('0x8'));var config=require(_0xad16('0x9'));var jayson=require(_0xad16('0xa'));var client=jayson[_0xad16('0xb')][_0xad16('0xc')]({'port':0x232a});config[_0xad16('0xd')]=_[_0xad16('0xe')](config[_0xad16('0xd')],{'host':_0xad16('0xf'),'port':0x18eb});var socket=require(_0xad16('0x10'))(new Redis(config[_0xad16('0xd')]));require('./smsMessage.socket')[_0xad16('0x11')](socket);function respondWithRpcPromise(_0x513b75,_0x4ca94b,_0x537e59){return new BPromise(function(_0x25f7e8,_0x92fa5d){return client[_0xad16('0x12')](_0x513b75,_0x537e59)[_0xad16('0x13')](function(_0xf9b6ac){logger['info'](_0xad16('0x14'),_0x4ca94b,'request\x20sent');logger[_0xad16('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4ca94b,'request\x20sent',JSON[_0xad16('0x16')](_0xf9b6ac));if(_0xf9b6ac[_0xad16('0x17')]){if(_0xf9b6ac['error'][_0xad16('0x18')]===0x1f4){logger[_0xad16('0x17')](_0xad16('0x14'),_0x4ca94b,_0xf9b6ac[_0xad16('0x17')][_0xad16('0x19')]);return _0x92fa5d(_0xf9b6ac[_0xad16('0x17')][_0xad16('0x19')]);}logger[_0xad16('0x17')](_0xad16('0x14'),_0x4ca94b,_0xf9b6ac[_0xad16('0x17')][_0xad16('0x19')]);return _0x25f7e8(_0xf9b6ac['error'][_0xad16('0x19')]);}else{logger[_0xad16('0x1a')](_0xad16('0x14'),_0x4ca94b,_0xad16('0x1b'));_0x25f7e8(_0xf9b6ac['result'][_0xad16('0x19')]);}})[_0xad16('0x1c')](function(_0x347c51){logger['error']('SmsMessage,\x20%s,\x20%s',_0x4ca94b,_0x347c51);_0x92fa5d(_0x347c51);});});}exports['CreateSmsMessage']=function(_0x196ae4){var _0xe8606f=this;return new Promise(function(_0x206ccd,_0x34a376){return db[_0xad16('0x1d')][_0xad16('0x1e')](_0x196ae4[_0xad16('0x1f')],{'raw':_0x196ae4[_0xad16('0x20')]?_0x196ae4['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x893279){logger[_0xad16('0x1a')](_0xad16('0x21'),_0x196ae4);logger[_0xad16('0x15')](_0xad16('0x21'),_0x196ae4,JSON['stringify'](_0x893279));_0x206ccd(_0x893279);})[_0xad16('0x1c')](function(_0x479745){logger[_0xad16('0x17')](_0xad16('0x21'),_0x479745[_0xad16('0x19')],_0x196ae4);_0x34a376(_0xe8606f[_0xad16('0x17')](0x1f4,_0x479745['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 023740d..535ace1 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 _0x09b5=['save','remove','update','emit','length','smsMessage:'];(function(_0x5885a1,_0x1e3c5b){var _0x574cae=function(_0x49f318){while(--_0x49f318){_0x5885a1['push'](_0x5885a1['shift']());}};_0x574cae(++_0x1e3c5b);}(_0x09b5,0x10e));var _0x509b=function(_0x48164f,_0xc6da79){_0x48164f=_0x48164f-0x0;var _0x5616ac=_0x09b5[_0x48164f];return _0x5616ac;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x509b('0x0'),_0x509b('0x1'),_0x509b('0x2')];function createListener(_0x5714d1,_0x3833f2){return function(_0x4df34e){_0x3833f2[_0x509b('0x3')](_0x5714d1,_0x4df34e);};}function removeListener(_0x5c997a,_0x3907d4){return function(){SmsMessageEvents['removeListener'](_0x5c997a,_0x3907d4);};}exports['register']=function(_0x271606){for(var _0x114027=0x0,_0x3b8f93=events[_0x509b('0x4')];_0x114027<_0x3b8f93;_0x114027++){var _0x429143=events[_0x114027];var _0x116ba5=createListener(_0x509b('0x5')+_0x429143,_0x271606);SmsMessageEvents['on'](_0x429143,_0x116ba5);}}; \ No newline at end of file +var _0x511a=['emit','removeListener','register','length','smsMessage:','./smsMessage.events','update'];(function(_0x21a225,_0x38fb9c){var _0x3b2918=function(_0x33a527){while(--_0x33a527){_0x21a225['push'](_0x21a225['shift']());}};_0x3b2918(++_0x38fb9c);}(_0x511a,0x75));var _0xa511=function(_0xdc60f2,_0x1751f3){_0xdc60f2=_0xdc60f2-0x0;var _0x1e3b4f=_0x511a[_0xdc60f2];return _0x1e3b4f;};'use strict';var SmsMessageEvents=require(_0xa511('0x0'));var events=['save','remove',_0xa511('0x1')];function createListener(_0x259617,_0x4abdb7){return function(_0x2eb054){_0x4abdb7[_0xa511('0x2')](_0x259617,_0x2eb054);};}function removeListener(_0x5b3c79,_0x31f94e){return function(){SmsMessageEvents[_0xa511('0x3')](_0x5b3c79,_0x31f94e);};}exports[_0xa511('0x4')]=function(_0x44b4d5){for(var _0x586e1a=0x0,_0x59a668=events[_0xa511('0x5')];_0x586e1a<_0x59a668;_0x586e1a++){var _0x47bb92=events[_0x586e1a];var _0x52944e=createListener(_0xa511('0x6')+_0x47bb92,_0x44b4d5);SmsMessageEvents['on'](_0x47bb92,_0x52944e);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 66bfee9..912ce0f 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 _0x1ecb=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','describe','get','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','put','update','delete','destroy','removeTeams','/:id/users','removeAgents','multer','path','connect-timeout'];(function(_0x16eb19,_0x58cea4){var _0x312a25=function(_0x343702){while(--_0x343702){_0x16eb19['push'](_0x16eb19['shift']());}};_0x312a25(++_0x58cea4);}(_0x1ecb,0x14d));var _0xb1ec=function(_0x50bc21,_0x5372c8){_0x50bc21=_0x50bc21-0x0;var _0x58a1e7=_0x1ecb[_0x50bc21];return _0x58a1e7;};'use strict';var multer=require(_0xb1ec('0x0'));var util=require('util');var path=require(_0xb1ec('0x1'));var timeout=require(_0xb1ec('0x2'));var express=require(_0xb1ec('0x3'));var router=express[_0xb1ec('0x4')]();var auth=require(_0xb1ec('0x5'));var interaction=require(_0xb1ec('0x6'));var config=require(_0xb1ec('0x7'));var controller=require(_0xb1ec('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xb1ec('0x9')](),controller[_0xb1ec('0xa')]);router[_0xb1ec('0xb')](_0xb1ec('0xc'),auth[_0xb1ec('0x9')](),controller[_0xb1ec('0xd')]);router[_0xb1ec('0xb')](_0xb1ec('0xe'),auth[_0xb1ec('0x9')](),controller[_0xb1ec('0xf')]);router[_0xb1ec('0xb')](_0xb1ec('0x10'),auth[_0xb1ec('0x9')](),controller[_0xb1ec('0x11')]);router[_0xb1ec('0xb')]('/:id/users',auth[_0xb1ec('0x9')](),controller[_0xb1ec('0x12')]);router[_0xb1ec('0x13')]('/',auth[_0xb1ec('0x9')](),controller[_0xb1ec('0x14')]);router[_0xb1ec('0x13')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0xb1ec('0x13')]('/:id/users',auth[_0xb1ec('0x9')](),controller['addAgents']);router[_0xb1ec('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xb1ec('0x16')]);router[_0xb1ec('0x17')](_0xb1ec('0xc'),auth[_0xb1ec('0x9')](),controller[_0xb1ec('0x18')]);router['delete'](_0xb1ec('0x10'),auth[_0xb1ec('0x9')](),controller[_0xb1ec('0x19')]);router[_0xb1ec('0x17')](_0xb1ec('0x1a'),auth[_0xb1ec('0x9')](),controller[_0xb1ec('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x8e05=['get','isAuthenticated','index','/describe','describe','/:id','getMembers','/:id/teams','getTeams','getAgents','create','addTeams','post','/:id/users','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsQueue.controller'];(function(_0x3d8b2e,_0x49b72a){var _0x28e29f=function(_0x14dbb2){while(--_0x14dbb2){_0x3d8b2e['push'](_0x3d8b2e['shift']());}};_0x28e29f(++_0x49b72a);}(_0x8e05,0xd7));var _0x58e0=function(_0x1d0499,_0x23e22f){_0x1d0499=_0x1d0499-0x0;var _0x153fb3=_0x8e05[_0x1d0499];return _0x153fb3;};'use strict';var multer=require(_0x58e0('0x0'));var util=require(_0x58e0('0x1'));var path=require(_0x58e0('0x2'));var timeout=require(_0x58e0('0x3'));var express=require(_0x58e0('0x4'));var router=express[_0x58e0('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x58e0('0x6'));var config=require(_0x58e0('0x7'));var controller=require(_0x58e0('0x8'));router[_0x58e0('0x9')]('/',auth[_0x58e0('0xa')](),controller[_0x58e0('0xb')]);router[_0x58e0('0x9')](_0x58e0('0xc'),auth[_0x58e0('0xa')](),controller[_0x58e0('0xd')]);router[_0x58e0('0x9')](_0x58e0('0xe'),auth[_0x58e0('0xa')](),controller['show']);router['get']('/:id/members',auth[_0x58e0('0xa')](),controller[_0x58e0('0xf')]);router['get'](_0x58e0('0x10'),auth[_0x58e0('0xa')](),controller[_0x58e0('0x11')]);router[_0x58e0('0x9')]('/:id/users',auth[_0x58e0('0xa')](),controller[_0x58e0('0x12')]);router['post']('/',auth[_0x58e0('0xa')](),controller[_0x58e0('0x13')]);router['post'](_0x58e0('0x10'),auth[_0x58e0('0xa')](),controller[_0x58e0('0x14')]);router[_0x58e0('0x15')](_0x58e0('0x16'),auth[_0x58e0('0xa')](),controller['addAgents']);router[_0x58e0('0x17')](_0x58e0('0xe'),auth[_0x58e0('0xa')](),controller[_0x58e0('0x18')]);router[_0x58e0('0x19')](_0x58e0('0xe'),auth['isAuthenticated'](),controller[_0x58e0('0x1a')]);router[_0x58e0('0x19')](_0x58e0('0x10'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x58e0('0x19')](_0x58e0('0x16'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x58e0('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 5cf34d8..aed7496 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 _0xb81a=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x4f4917,_0x470dd7){var _0x92e042=function(_0x302032){while(--_0x302032){_0x4f4917['push'](_0x4f4917['shift']());}};_0x92e042(++_0x470dd7);}(_0xb81a,0x15a));var _0xab81=function(_0x23a160,_0x1ac8cc){_0x23a160=_0x23a160-0x0;var _0x64b75f=_0xb81a[_0x23a160];return _0x64b75f;};'use strict';var Sequelize=require(_0xab81('0x0'));module[_0xab81('0x1')]={'name':{'type':Sequelize[_0xab81('0x2')],'unique':_0xab81('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xab81('0x2')]},'timeout':{'type':Sequelize[_0xab81('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xab81('0x5')](_0xab81('0x6'),_0xab81('0x7'),_0xab81('0x8'))}}; \ No newline at end of file +var _0x1c35=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x14aa49,_0x370b03){var _0x57e427=function(_0x14ffc9){while(--_0x14ffc9){_0x14aa49['push'](_0x14aa49['shift']());}};_0x57e427(++_0x370b03);}(_0x1c35,0x1ac));var _0x51c3=function(_0x37bd45,_0x2e92d1){_0x37bd45=_0x37bd45-0x0;var _0x44e2af=_0x1c35[_0x37bd45];return _0x44e2af;};'use strict';var Sequelize=require(_0x51c3('0x0'));module[_0x51c3('0x1')]={'name':{'type':Sequelize[_0x51c3('0x2')],'unique':_0x51c3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x51c3('0x2')]},'timeout':{'type':Sequelize[_0x51c3('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x51c3('0x5')](_0x51c3('0x6'),_0x51c3('0x7'),_0x51c3('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 6b8def4..3f385e8 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 _0x6350=['type','key','includeAll','include','rows','catch','params','rawAttributes','options','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','order','SmsQueueId','filter','findAll','User','UserId','agent','smsPause','updatedAt','createdAt','format','getTeams','ids','Agents','union','addAgents','penalty','removeTeams','spread','emit','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','ioredis','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','SmsQueue','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','map'];(function(_0x5224ba,_0x3fb4e1){var _0x459bd2=function(_0x61be43){while(--_0x61be43){_0x5224ba['push'](_0x5224ba['shift']());}};_0x459bd2(++_0x3fb4e1);}(_0x6350,0x1ea));var _0x0635=function(_0x142aad,_0x489d2f){_0x142aad=_0x142aad-0x0;var _0x51fb5a=_0x6350[_0x142aad];return _0x51fb5a;};'use strict';var pdf=require(_0x0635('0x0'));var emlformat=require(_0x0635('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0635('0x2'));var rp=require('request-promise');var moment=require(_0x0635('0x3'));var BPromise=require(_0x0635('0x4'));var Mustache=require(_0x0635('0x5'));var util=require(_0x0635('0x6'));var path=require('path');var sox=require(_0x0635('0x7'));var csv=require('to-csv');var ejs=require(_0x0635('0x8'));var fs=require('fs');var _=require(_0x0635('0x9'));var squel=require(_0x0635('0xa'));var crypto=require(_0x0635('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0635('0xc'));var toCsv=require(_0x0635('0xd'));var querystring=require(_0x0635('0xe'));var Papa=require(_0x0635('0xf'));var authService=require('../../components/auth/service');var hardwareService=require(_0x0635('0x10'));var Redis=require(_0x0635('0x11'));var qs=require('../../components/parsers/qs');var logger=require(_0x0635('0x12'))('api');var utils=require(_0x0635('0x13'));var config=require(_0x0635('0x14'));var db=require(_0x0635('0x15'))['db'];config[_0x0635('0x16')]=_[_0x0635('0x17')](config[_0x0635('0x16')],{'host':_0x0635('0x18'),'port':0x18eb});var socket=require(_0x0635('0x19'))(new Redis(config[_0x0635('0x16')]));require(_0x0635('0x1a'))['register'](socket);function respondWithStatusCode(_0x3b27ef,_0x8cd054){_0x8cd054=_0x8cd054||0xcc;return function(_0x361091){if(_0x361091){return _0x3b27ef[_0x0635('0x1b')](_0x8cd054);}return _0x3b27ef[_0x0635('0x1c')](_0x8cd054)[_0x0635('0x1d')]();};}function respondWithResult(_0xa6bf73,_0x40cd9a){_0x40cd9a=_0x40cd9a||0xc8;return function(_0x5bd895){if(_0x5bd895){return _0xa6bf73[_0x0635('0x1c')](_0x40cd9a)[_0x0635('0x1e')](_0x5bd895);}};}function respondWithFilteredResult(_0x289e60,_0x50c78a){return function(_0x5141c4){if(_0x5141c4){var _0x417c5b=_0x5141c4[_0x0635('0x1f')],_0x5ea6fa=_0x50c78a[_0x0635('0x20')],_0x165c6a=_0x50c78a[_0x0635('0x20')]+_0x50c78a[_0x0635('0x21')],_0x3d60bf;if(_0x165c6a>=_0x417c5b){_0x165c6a=_0x417c5b;_0x3d60bf=0xc8;}else{_0x3d60bf=0xce;}_0x289e60[_0x0635('0x1c')](_0x3d60bf);return _0x289e60[_0x0635('0x22')](_0x0635('0x23'),_0x5ea6fa+'-'+_0x165c6a+'/'+_0x417c5b)[_0x0635('0x1e')](_0x5141c4);}return null;};}function patchUpdates(_0x438eb3){return function(_0x2db60c){try{jsonpatch[_0x0635('0x24')](_0x2db60c,_0x438eb3,!![]);}catch(_0x11469c){return BPromise[_0x0635('0x25')](_0x11469c);}return _0x2db60c[_0x0635('0x26')]();};}function saveUpdates(_0x483330,_0xb89024){return function(_0x2b4f8b){if(_0x2b4f8b){return _0x2b4f8b[_0x0635('0x27')](_0x483330)[_0x0635('0x28')](function(_0x294867){return _0x294867;});}return null;};}function removeEntity(_0x547bd0,_0x411fd6){return function(_0x4c4b80){if(_0x4c4b80){return _0x4c4b80[_0x0635('0x29')]()[_0x0635('0x28')](function(){var _0x1b373f=_0x4c4b80[_0x0635('0x2a')]({'plain':!![]});var _0x5d6cd0='SmsQueues';return db[_0x0635('0x2b')][_0x0635('0x29')]({'where':{'type':_0x5d6cd0,'resourceId':_0x1b373f['id']}})[_0x0635('0x28')](function(){return _0x4c4b80;});})[_0x0635('0x28')](function(){_0x547bd0[_0x0635('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31e3cf,_0x5810a5){return function(_0x4c32bc){if(!_0x4c32bc){_0x31e3cf['sendStatus'](0x194);}return _0x4c32bc;};}function handleError(_0x33bd81,_0x6248e0){_0x6248e0=_0x6248e0||0x1f4;return function(_0x2ceb5a){logger[_0x0635('0x2c')](_0x2ceb5a[_0x0635('0x2d')]);if(_0x2ceb5a[_0x0635('0x2e')]){delete _0x2ceb5a[_0x0635('0x2e')];}_0x33bd81[_0x0635('0x1c')](_0x6248e0)[_0x0635('0x2f')](_0x2ceb5a);};}exports[_0x0635('0x30')]=function(_0xc889ae,_0x4f7480){var _0xfe699c={},_0x5af5e4={},_0x2f760f={'count':0x0,'rows':[]};var _0x32293a=db[_0x0635('0x31')]['rawAttributes'];_0x5af5e4[_0x0635('0x32')]=_[_0x0635('0x33')](_0x32293a);_0x5af5e4['query']=_[_0x0635('0x33')](_0xc889ae[_0x0635('0x34')]);_0x5af5e4[_0x0635('0x35')]=_[_0x0635('0x36')](_0x5af5e4['model'],_0x5af5e4[_0x0635('0x34')]);_0xfe699c[_0x0635('0x37')]=_['intersection'](_0x5af5e4[_0x0635('0x32')],qs[_0x0635('0x38')](_0xc889ae['query'][_0x0635('0x38')]));_0xfe699c[_0x0635('0x37')]=_0xfe699c[_0x0635('0x37')][_0x0635('0x39')]?_0xfe699c[_0x0635('0x37')]:_0x5af5e4[_0x0635('0x32')];if(!_0xc889ae[_0x0635('0x34')][_0x0635('0x3a')](_0x0635('0x3b'))){_0xfe699c[_0x0635('0x21')]=qs[_0x0635('0x21')](_0xc889ae[_0x0635('0x34')]['limit']);_0xfe699c[_0x0635('0x20')]=qs[_0x0635('0x20')](_0xc889ae[_0x0635('0x34')][_0x0635('0x20')]);}_0xfe699c['order']=qs[_0x0635('0x3c')](_0xc889ae[_0x0635('0x34')][_0x0635('0x3c')]);_0xfe699c[_0x0635('0x3d')]=qs['filters'](_[_0x0635('0x3e')](_0xc889ae[_0x0635('0x34')],_0x5af5e4[_0x0635('0x35')]));if(_0xc889ae[_0x0635('0x34')]['filter']){_0xfe699c[_0x0635('0x3d')]=_[_0x0635('0x3f')](_0xfe699c[_0x0635('0x3d')],{'$or':_[_0x0635('0x40')](_0x32293a,function(_0x1053ca){if(_0x1053ca[_0x0635('0x41')][_0x0635('0x42')]!=='VIRTUAL'){var _0x3abe0a={};_0x3abe0a[_0x1053ca['field']]={'$like':'%'+_0xc889ae[_0x0635('0x34')]['filter']+'%'};return _0x3abe0a;}})});}_0xfe699c=_[_0x0635('0x3f')]({},_0xfe699c,_0xc889ae['options']);var _0x43d577={'where':_0xfe699c[_0x0635('0x3d')]};return db[_0x0635('0x31')][_0x0635('0x1f')](_0x43d577)[_0x0635('0x28')](function(_0x4175a7){_0x2f760f[_0x0635('0x1f')]=_0x4175a7;if(_0xc889ae[_0x0635('0x34')][_0x0635('0x43')]){_0xfe699c[_0x0635('0x44')]=[{'all':!![]}];}return db[_0x0635('0x31')]['findAll'](_0xfe699c);})[_0x0635('0x28')](function(_0x2891e8){_0x2f760f[_0x0635('0x45')]=_0x2891e8;return _0x2f760f;})[_0x0635('0x28')](respondWithFilteredResult(_0x4f7480,_0xfe699c))[_0x0635('0x46')](handleError(_0x4f7480,null));};exports['show']=function(_0x3f0499,_0x3b7773){var _0x5199af={'raw':!![],'where':{'id':_0x3f0499[_0x0635('0x47')]['id']}},_0x22be9d={};_0x22be9d[_0x0635('0x32')]=_['keys'](db[_0x0635('0x31')][_0x0635('0x48')]);_0x22be9d[_0x0635('0x34')]=_[_0x0635('0x33')](_0x3f0499['query']);_0x22be9d['filters']=_['intersection'](_0x22be9d[_0x0635('0x32')],_0x22be9d[_0x0635('0x34')]);_0x5199af[_0x0635('0x37')]=_[_0x0635('0x36')](_0x22be9d[_0x0635('0x32')],qs['fields'](_0x3f0499['query'][_0x0635('0x38')]));_0x5199af[_0x0635('0x37')]=_0x5199af[_0x0635('0x37')][_0x0635('0x39')]?_0x5199af[_0x0635('0x37')]:_0x22be9d['model'];if(_0x3f0499[_0x0635('0x34')][_0x0635('0x43')]){_0x5199af[_0x0635('0x44')]=[{'all':!![]}];}_0x5199af=_[_0x0635('0x3f')]({},_0x5199af,_0x3f0499[_0x0635('0x49')]);return db[_0x0635('0x31')][_0x0635('0x4a')](_0x5199af)[_0x0635('0x28')](handleEntityNotFound(_0x3b7773,null))[_0x0635('0x28')](respondWithResult(_0x3b7773,null))[_0x0635('0x46')](handleError(_0x3b7773,null));};exports['create']=function(_0x14b57d,_0x12e627){return db[_0x0635('0x31')][_0x0635('0x4b')](_0x14b57d[_0x0635('0x4c')],{})[_0x0635('0x28')](function(_0x452dee){var _0xf70b4b=_0x14b57d[_0x0635('0x4d')][_0x0635('0x2a')]({'plain':!![]});if(!_0xf70b4b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf70b4b[_0x0635('0x4e')]===_0x0635('0x4d')){var _0x208e8c=_0x452dee['get']({'plain':!![]});var _0x4277da='SmsQueues';return db[_0x0635('0x4f')][_0x0635('0x4a')]({'where':{'name':_0x4277da,'userProfileId':_0xf70b4b[_0x0635('0x50')]},'raw':!![]})[_0x0635('0x28')](function(_0x3a7ec3){if(_0x3a7ec3&&_0x3a7ec3['autoAssociation']===0x0){return db[_0x0635('0x2b')]['create']({'name':_0x208e8c['name'],'resourceId':_0x208e8c['id'],'type':_0x3a7ec3[_0x0635('0x2e')],'sectionId':_0x3a7ec3['id']},{})[_0x0635('0x28')](function(){return _0x452dee;});}else{return _0x452dee;}})[_0x0635('0x46')](function(_0x1c3981){logger[_0x0635('0x2c')](_0x0635('0x51'),_0x1c3981);throw _0x1c3981;});}return _0x452dee;})[_0x0635('0x28')](respondWithResult(_0x12e627,0xc9))['catch'](handleError(_0x12e627,null));};exports[_0x0635('0x27')]=function(_0x867da0,_0x30ed26){if(_0x867da0[_0x0635('0x4c')]['id']){delete _0x867da0['body']['id'];}return db['SmsQueue'][_0x0635('0x4a')]({'where':{'id':_0x867da0[_0x0635('0x47')]['id']}})[_0x0635('0x28')](handleEntityNotFound(_0x30ed26,null))[_0x0635('0x28')](saveUpdates(_0x867da0['body'],null))[_0x0635('0x28')](respondWithResult(_0x30ed26,null))[_0x0635('0x46')](handleError(_0x30ed26,null));};exports[_0x0635('0x29')]=function(_0x2a6deb,_0x229cfc){return db['SmsQueue'][_0x0635('0x4a')]({'where':{'id':_0x2a6deb[_0x0635('0x47')]['id']}})[_0x0635('0x28')](handleEntityNotFound(_0x229cfc,null))[_0x0635('0x28')](removeEntity(_0x229cfc,null))[_0x0635('0x46')](handleError(_0x229cfc,null));};exports[_0x0635('0x52')]=function(_0x1f1984,_0x23869d){return db[_0x0635('0x31')]['describe']()[_0x0635('0x28')](respondWithResult(_0x23869d,null))['catch'](handleError(_0x23869d,null));};exports[_0x0635('0x53')]=function(_0x1c0418,_0x29b8e7,_0x1d80ec){var _0x10df58={'raw':!![],'where':{}},_0x53bfe1={},_0x10a6f7;return db[_0x0635('0x31')][_0x0635('0x54')]({'where':{'id':_0x1c0418[_0x0635('0x47')]['id']}})['then'](handleEntityNotFound(_0x29b8e7,null))[_0x0635('0x28')](function(_0x3f9fc1){if(_0x3f9fc1){_0x10a6f7=_0x3f9fc1[_0x0635('0x2a')]({'plain':!![]});_0x53bfe1[_0x0635('0x32')]=_[_0x0635('0x33')](db[_0x0635('0x55')][_0x0635('0x48')]);_0x53bfe1['query']=_[_0x0635('0x33')](_0x1c0418[_0x0635('0x34')]);_0x53bfe1[_0x0635('0x35')]=_['intersection'](_0x53bfe1[_0x0635('0x32')],_0x53bfe1['query']);_0x10df58[_0x0635('0x37')]=_[_0x0635('0x36')](_0x53bfe1[_0x0635('0x32')],qs[_0x0635('0x38')](_0x1c0418['query']['fields']));_0x10df58['attributes']=_0x10df58[_0x0635('0x37')]['length']?_0x10df58['attributes']:_0x53bfe1[_0x0635('0x32')];if(!_0x1c0418[_0x0635('0x34')][_0x0635('0x3a')]('nolimit')){_0x10df58[_0x0635('0x21')]=qs[_0x0635('0x21')](_0x1c0418[_0x0635('0x34')][_0x0635('0x21')]);_0x10df58[_0x0635('0x20')]=qs[_0x0635('0x20')](_0x1c0418[_0x0635('0x34')]['offset']);}_0x10df58[_0x0635('0x56')]=qs[_0x0635('0x3c')](_0x1c0418[_0x0635('0x34')][_0x0635('0x3c')]);_0x10df58[_0x0635('0x3d')]=qs[_0x0635('0x35')](_[_0x0635('0x3e')](_0x1c0418['query'],_0x53bfe1[_0x0635('0x35')]));_0x10df58[_0x0635('0x3d')][_0x0635('0x57')]=_0x3f9fc1['id'];if(_0x1c0418[_0x0635('0x34')][_0x0635('0x58')]){_0x10df58['where']=_[_0x0635('0x3f')](_0x10df58['where'],{'$or':_[_0x0635('0x40')](_0x10df58[_0x0635('0x37')],function(_0x3a3b39){var _0x1282ad={};_0x1282ad[_0x3a3b39]={'$like':'%'+_0x1c0418['query'][_0x0635('0x58')]+'%'};return _0x1282ad;})});}_0x10df58=_[_0x0635('0x3f')]({},_0x10df58,_0x1c0418['options']);return db[_0x0635('0x55')][_0x0635('0x59')](_0x10df58);}})[_0x0635('0x28')](function(_0x17c208){if(_0x17c208){return db[_0x0635('0x5a')]['findAndCountAll']({'where':{'id':_[_0x0635('0x40')](_0x17c208,_0x0635('0x5b')),'role':_0x0635('0x5c')},'attributes':['id',_0x0635('0x2e'),_0x0635('0x5d'),_0x0635('0x5e'),_0x0635('0x5f')]});}})[_0x0635('0x28')](function(_0x548a98){if(_0x548a98){return{'count':_0x548a98[_0x0635('0x1f')],'rows':_['map'](_0x548a98[_0x0635('0x45')],function(_0x42f9c8){return{'membername':_0x42f9c8[_0x0635('0x2e')],'UserId':_0x42f9c8['id'],'queue_name':_0x10a6f7[_0x0635('0x2e')],'SmsQueueId':_0x10a6f7['id'],'interface':util[_0x0635('0x60')]('%s/%s','SIP',_0x42f9c8[_0x0635('0x2e')]),'penalty':0x0,'paused':_0x42f9c8[_0x0635('0x5d')],'createdAt':_0x42f9c8[_0x0635('0x5f')],'updatedAt':_0x42f9c8[_0x0635('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0635('0x28')](respondWithFilteredResult(_0x29b8e7,_0x10df58))[_0x0635('0x46')](handleError(_0x29b8e7,null));};exports['getTeams']=function(_0x264d02,_0x362be5,_0x607c60){var _0x24d93a={};var _0x3e87d2={};var _0x385ecf;var _0x56d318;return db['SmsQueue'][_0x0635('0x54')]({'where':{'id':_0x264d02[_0x0635('0x47')]['id']}})[_0x0635('0x28')](handleEntityNotFound(_0x362be5,null))[_0x0635('0x28')](function(_0x489591){if(_0x489591){_0x385ecf=_0x489591;_0x3e87d2[_0x0635('0x32')]=_['keys'](db['Team'][_0x0635('0x48')]);_0x3e87d2['query']=_['keys'](_0x264d02[_0x0635('0x34')]);_0x3e87d2[_0x0635('0x35')]=_[_0x0635('0x36')](_0x3e87d2[_0x0635('0x32')],_0x3e87d2[_0x0635('0x34')]);_0x24d93a['attributes']=_[_0x0635('0x36')](_0x3e87d2['model'],qs[_0x0635('0x38')](_0x264d02[_0x0635('0x34')]['fields']));_0x24d93a[_0x0635('0x37')]=_0x24d93a[_0x0635('0x37')][_0x0635('0x39')]?_0x24d93a['attributes']:_0x3e87d2[_0x0635('0x32')];_0x24d93a[_0x0635('0x56')]=qs['sort'](_0x264d02[_0x0635('0x34')]['sort']);_0x24d93a[_0x0635('0x3d')]=qs[_0x0635('0x35')](_[_0x0635('0x3e')](_0x264d02['query'],_0x3e87d2['filters']));if(_0x264d02[_0x0635('0x34')][_0x0635('0x58')]){_0x24d93a[_0x0635('0x3d')]=_['merge'](_0x24d93a[_0x0635('0x3d')],{'$or':_[_0x0635('0x40')](_0x24d93a[_0x0635('0x37')],function(_0x39b791){var _0x426b0a={};_0x426b0a[_0x39b791]={'$like':'%'+_0x264d02[_0x0635('0x34')]['filter']+'%'};return _0x426b0a;})});}_0x24d93a=_[_0x0635('0x3f')]({},_0x24d93a,_0x264d02[_0x0635('0x49')]);return _0x385ecf[_0x0635('0x61')](_0x24d93a);}})['then'](function(_0x468cd1){if(_0x468cd1){_0x56d318=_0x468cd1[_0x0635('0x39')];if(!_0x264d02['query'][_0x0635('0x3a')]('nolimit')){_0x24d93a['limit']=qs['limit'](_0x264d02[_0x0635('0x34')][_0x0635('0x21')]);_0x24d93a[_0x0635('0x20')]=qs[_0x0635('0x20')](_0x264d02['query'][_0x0635('0x20')]);}return _0x385ecf[_0x0635('0x61')](_0x24d93a);}})['then'](function(_0x399cf2){if(_0x399cf2){return _0x399cf2?{'count':_0x56d318,'rows':_0x399cf2}:null;}})['then'](respondWithResult(_0x362be5,null))['catch'](handleError(_0x362be5,null));};exports['addTeams']=function(_0x12f8fb,_0x17e26f,_0x515b57){var _0x579233=[];var _0x48e7fc;return db['Team'][_0x0635('0x59')]({'where':{'id':_0x12f8fb[_0x0635('0x4c')][_0x0635('0x62')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0635('0x63'),'attributes':['id'],'raw':!![]}]})[_0x0635('0x28')](function(_0x432f95){if(_0x432f95){for(var _0x2808a1=0x0;_0x2808a1<_0x432f95[_0x0635('0x39')];_0x2808a1+=0x1){for(var _0x2bc852=0x0;_0x2bc852<_0x432f95[_0x2808a1][_0x0635('0x63')][_0x0635('0x39')];_0x2bc852+=0x1){_0x579233=_[_0x0635('0x64')](_0x579233,[_0x432f95[_0x2808a1][_0x0635('0x63')][_0x2bc852]['id']]);}}return _0x579233;}})[_0x0635('0x28')](function(_0x8c8449){if(_0x8c8449){return db['SmsQueue']['find']({'where':{'id':_0x12f8fb[_0x0635('0x47')]['id']}});}})['then'](function(_0x4f608d){if(_0x4f608d){_0x48e7fc=_0x4f608d;return _0x48e7fc[_0x0635('0x65')](_0x579233,{'penalty':_0x12f8fb[_0x0635('0x4c')][_0x0635('0x66')]});}})[_0x0635('0x28')](function(_0x292b99){if(_0x292b99){return _0x48e7fc['addTeams'](_0x12f8fb[_0x0635('0x4c')][_0x0635('0x62')]);}})[_0x0635('0x28')](handleEntityNotFound(_0x17e26f,null))['then'](respondWithStatusCode(_0x17e26f,null))[_0x0635('0x46')](handleError(_0x17e26f,null));};exports[_0x0635('0x67')]=function(_0x235f9d,_0x375684,_0x4c4d1e){var _0x4fdff6=[];var _0x1e482c;return db['Team'][_0x0635('0x59')]({'where':{'id':_0x235f9d[_0x0635('0x34')][_0x0635('0x62')]},'attributes':['id'],'include':[{'model':db[_0x0635('0x5a')],'as':_0x0635('0x63'),'attributes':['id'],'raw':!![]}]})[_0x0635('0x28')](function(_0x3087fa){if(_0x3087fa){for(var _0x4f9fe7=0x0;_0x4f9fe7<_0x3087fa[_0x0635('0x39')];_0x4f9fe7+=0x1){for(var _0x301855=0x0;_0x301855<_0x3087fa[_0x4f9fe7][_0x0635('0x63')][_0x0635('0x39')];_0x301855+=0x1){_0x4fdff6=_['union'](_0x4fdff6,[_0x3087fa[_0x4f9fe7][_0x0635('0x63')][_0x301855]['id']]);}}return _0x4fdff6;}})[_0x0635('0x28')](function(_0x310b43){if(_0x310b43){return db['SmsQueue'][_0x0635('0x4a')]({'where':{'id':_0x235f9d['params']['id']}});}})['then'](function(_0xfa5fed){if(_0xfa5fed){_0x1e482c=_0xfa5fed;return _0x1e482c['removeAgents'](_0x4fdff6);}})[_0x0635('0x28')](function(_0x3dd94d){if(_0x1e482c){return _0x1e482c[_0x0635('0x67')](_0x235f9d['query'][_0x0635('0x62')]);}})['then'](handleEntityNotFound(_0x375684,null))[_0x0635('0x28')](respondWithStatusCode(_0x375684,null))[_0x0635('0x46')](handleError(_0x375684,null));};exports[_0x0635('0x65')]=function(_0xd3d99d,_0x21a06d,_0xe3a018){return db['SmsQueue'][_0x0635('0x4a')]({'where':{'id':_0xd3d99d[_0x0635('0x47')]['id']}})[_0x0635('0x28')](handleEntityNotFound(_0x21a06d,null))['then'](function(_0x4ec4c0){if(_0x4ec4c0){return _0x4ec4c0[_0x0635('0x65')](_0xd3d99d[_0x0635('0x4c')][_0x0635('0x62')],_['omit'](_0xd3d99d[_0x0635('0x4c')],[_0x0635('0x62'),'id'])||{})[_0x0635('0x68')](function(_0x4ea7a6){for(var _0x38425d=0x0;_0x38425d<_0xd3d99d[_0x0635('0x4c')][_0x0635('0x62')][_0x0635('0x39')];_0x38425d+=0x1){socket[_0x0635('0x69')](_0x0635('0x6a'),{'UserId':_0xd3d99d[_0x0635('0x4c')][_0x0635('0x62')][_0x38425d],'SmsQueueId':_0xd3d99d[_0x0635('0x47')]['id']});}return _0x4ea7a6;});}})[_0x0635('0x28')](respondWithResult(_0x21a06d,null))[_0x0635('0x46')](handleError(_0x21a06d,null));};exports[_0x0635('0x6b')]=function(_0x1ec3c5,_0x39c07f,_0x418382){var _0x374458;return db[_0x0635('0x31')]['find']({'where':{'id':_0x1ec3c5[_0x0635('0x47')]['id']}})[_0x0635('0x28')](handleEntityNotFound(_0x39c07f,null))[_0x0635('0x28')](function(_0x2b3aef){if(_0x2b3aef){return _0x2b3aef[_0x0635('0x6b')](_0x1ec3c5[_0x0635('0x34')][_0x0635('0x62')])[_0x0635('0x28')](function(_0x5222a2){if(_[_0x0635('0x6c')](_0x1ec3c5['query'][_0x0635('0x62')])){for(var _0x1b761f=0x0;_0x1b761f<_0x1ec3c5[_0x0635('0x34')][_0x0635('0x62')][_0x0635('0x39')];_0x1b761f+=0x1){socket[_0x0635('0x69')]('userSmsQueue:remove',{'UserId':_0x1ec3c5[_0x0635('0x34')][_0x0635('0x62')][_0x1b761f],'SmsQueueId':_0x1ec3c5[_0x0635('0x47')]['id']});}}else{socket[_0x0635('0x69')](_0x0635('0x6d'),{'UserId':_0x1ec3c5[_0x0635('0x34')][_0x0635('0x62')],'SmsQueueId':_0x1ec3c5['params']['id']});}});}})[_0x0635('0x28')](respondWithStatusCode(_0x39c07f,null))[_0x0635('0x46')](handleError(_0x39c07f,null));};exports[_0x0635('0x6e')]=function(_0x170faa,_0x561cb1,_0x520188){var _0x556b7f={};var _0x396b5c={};var _0x11f529;var _0x358316;return db[_0x0635('0x31')][_0x0635('0x54')]({'where':{'id':_0x170faa['params']['id']}})[_0x0635('0x28')](handleEntityNotFound(_0x561cb1,null))[_0x0635('0x28')](function(_0x2c5efb){if(_0x2c5efb){_0x11f529=_0x2c5efb;_0x396b5c['model']=_[_0x0635('0x33')](db[_0x0635('0x5a')][_0x0635('0x48')]);_0x396b5c[_0x0635('0x34')]=_[_0x0635('0x33')](_0x170faa['query']);_0x396b5c[_0x0635('0x35')]=_['intersection'](_0x396b5c[_0x0635('0x32')],_0x396b5c['query']);_0x556b7f[_0x0635('0x37')]=_[_0x0635('0x36')](_0x396b5c[_0x0635('0x32')],qs['fields'](_0x170faa['query'][_0x0635('0x38')]));_0x556b7f[_0x0635('0x37')]=_0x556b7f[_0x0635('0x37')][_0x0635('0x39')]?_0x556b7f[_0x0635('0x37')]:_0x396b5c[_0x0635('0x32')];_0x556b7f[_0x0635('0x56')]=qs[_0x0635('0x3c')](_0x170faa[_0x0635('0x34')][_0x0635('0x3c')]);_0x556b7f['where']=qs[_0x0635('0x35')](_['pick'](_0x170faa[_0x0635('0x34')],_0x396b5c[_0x0635('0x35')]));if(_0x170faa[_0x0635('0x34')]['filter']){_0x556b7f['where']=_[_0x0635('0x3f')](_0x556b7f[_0x0635('0x3d')],{'$or':_['map'](_0x556b7f['attributes'],function(_0xb7d498){var _0x3c312f={};_0x3c312f[_0xb7d498]={'$like':'%'+_0x170faa[_0x0635('0x34')][_0x0635('0x58')]+'%'};return _0x3c312f;})});}_0x556b7f=_[_0x0635('0x3f')]({},_0x556b7f,_0x170faa[_0x0635('0x49')]);return _0x11f529['getAgents'](_0x556b7f);}})['then'](function(_0x23aba7){if(_0x23aba7){_0x358316=_0x23aba7['length'];if(!_0x170faa[_0x0635('0x34')][_0x0635('0x3a')](_0x0635('0x3b'))){_0x556b7f[_0x0635('0x21')]=qs[_0x0635('0x21')](_0x170faa['query']['limit']);_0x556b7f[_0x0635('0x20')]=qs[_0x0635('0x20')](_0x170faa['query'][_0x0635('0x20')]);}return _0x11f529[_0x0635('0x6e')](_0x556b7f);}})[_0x0635('0x28')](function(_0x521e56){if(_0x521e56){return _0x521e56?{'count':_0x358316,'rows':_0x521e56}:null;}})[_0x0635('0x28')](respondWithResult(_0x561cb1,null))[_0x0635('0x46')](handleError(_0x561cb1,null));}; \ No newline at end of file +var _0xb61f=['createdAt','format','SIP','getTeams','addTeams','User','Agents','union','addAgents','penalty','removeTeams','Team','ids','omit','emit','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','findOne','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsQueue.socket','register','status','end','json','count','offset','limit','reject','save','update','then','get','UserProfileResource','sendStatus','error','name','index','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','includeAll','include','SmsQueue','findAll','rows','catch','show','params','keys','rawAttributes','create','body','user','SmsQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','UserSmsQueue','nolimit','findAndCountAll','UserId','agent','smsPause','updatedAt'];(function(_0x467c46,_0x12cff8){var _0x336317=function(_0x1d3949){while(--_0x1d3949){_0x467c46['push'](_0x467c46['shift']());}};_0x336317(++_0x12cff8);}(_0xb61f,0xfb));var _0xfb61=function(_0x3b5d06,_0xa1c86b){_0x3b5d06=_0x3b5d06-0x0;var _0x154c6d=_0xb61f[_0x3b5d06];return _0x154c6d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xfb61('0x0'));var zipdir=require(_0xfb61('0x1'));var jsonpatch=require(_0xfb61('0x2'));var rp=require(_0xfb61('0x3'));var moment=require('moment');var BPromise=require(_0xfb61('0x4'));var Mustache=require(_0xfb61('0x5'));var util=require('util');var path=require(_0xfb61('0x6'));var sox=require(_0xfb61('0x7'));var csv=require(_0xfb61('0x8'));var ejs=require(_0xfb61('0x9'));var fs=require('fs');var _=require(_0xfb61('0xa'));var squel=require('squel');var crypto=require(_0xfb61('0xb'));var jsforce=require(_0xfb61('0xc'));var deskjs=require(_0xfb61('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfb61('0xe'));var Papa=require(_0xfb61('0xf'));var authService=require(_0xfb61('0x10'));var hardwareService=require(_0xfb61('0x11'));var Redis=require(_0xfb61('0x12'));var qs=require(_0xfb61('0x13'));var logger=require(_0xfb61('0x14'))(_0xfb61('0x15'));var utils=require(_0xfb61('0x16'));var config=require(_0xfb61('0x17'));var db=require(_0xfb61('0x18'))['db'];config[_0xfb61('0x19')]=_[_0xfb61('0x1a')](config[_0xfb61('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xfb61('0x1b'))(new Redis(config[_0xfb61('0x19')]));require(_0xfb61('0x1c'))[_0xfb61('0x1d')](socket);function respondWithStatusCode(_0x290f90,_0x4b4a7f){_0x4b4a7f=_0x4b4a7f||0xcc;return function(_0x1054c8){if(_0x1054c8){return _0x290f90['sendStatus'](_0x4b4a7f);}return _0x290f90[_0xfb61('0x1e')](_0x4b4a7f)[_0xfb61('0x1f')]();};}function respondWithResult(_0x395277,_0x43b1ca){_0x43b1ca=_0x43b1ca||0xc8;return function(_0x2f4376){if(_0x2f4376){return _0x395277[_0xfb61('0x1e')](_0x43b1ca)[_0xfb61('0x20')](_0x2f4376);}};}function respondWithFilteredResult(_0x53453c,_0x1a1737){return function(_0x5d65d6){if(_0x5d65d6){var _0x266447=_0x5d65d6[_0xfb61('0x21')],_0xd9a1dd=_0x1a1737['offset'],_0x16e1a3=_0x1a1737[_0xfb61('0x22')]+_0x1a1737[_0xfb61('0x23')],_0x28fc11;if(_0x16e1a3>=_0x266447){_0x16e1a3=_0x266447;_0x28fc11=0xc8;}else{_0x28fc11=0xce;}_0x53453c['status'](_0x28fc11);return _0x53453c['set']('Content-Range',_0xd9a1dd+'-'+_0x16e1a3+'/'+_0x266447)[_0xfb61('0x20')](_0x5d65d6);}return null;};}function patchUpdates(_0x512e38){return function(_0x437343){try{jsonpatch['apply'](_0x437343,_0x512e38,!![]);}catch(_0x52a431){return BPromise[_0xfb61('0x24')](_0x52a431);}return _0x437343[_0xfb61('0x25')]();};}function saveUpdates(_0x5ac6cf,_0x2cd679){return function(_0xeb044e){if(_0xeb044e){return _0xeb044e[_0xfb61('0x26')](_0x5ac6cf)[_0xfb61('0x27')](function(_0x329719){return _0x329719;});}return null;};}function removeEntity(_0x492fc0,_0x13066a){return function(_0x263b72){if(_0x263b72){return _0x263b72['destroy']()[_0xfb61('0x27')](function(){var _0x10b803=_0x263b72[_0xfb61('0x28')]({'plain':!![]});var _0x8b68b='SmsQueues';return db[_0xfb61('0x29')]['destroy']({'where':{'type':_0x8b68b,'resourceId':_0x10b803['id']}})[_0xfb61('0x27')](function(){return _0x263b72;});})[_0xfb61('0x27')](function(){_0x492fc0[_0xfb61('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e8052,_0x440e06){return function(_0x1fca3f){if(!_0x1fca3f){_0x2e8052[_0xfb61('0x2a')](0x194);}return _0x1fca3f;};}function handleError(_0x1a1123,_0x16fffe){_0x16fffe=_0x16fffe||0x1f4;return function(_0x382c54){logger[_0xfb61('0x2b')](_0x382c54['stack']);if(_0x382c54[_0xfb61('0x2c')]){delete _0x382c54['name'];}_0x1a1123[_0xfb61('0x1e')](_0x16fffe)['send'](_0x382c54);};}exports[_0xfb61('0x2d')]=function(_0x4d233a,_0x40b52c){var _0x17272e={},_0x2d601a={},_0x45e74e={'count':0x0,'rows':[]};var _0x3ed5bc=db['SmsQueue']['rawAttributes'];_0x2d601a[_0xfb61('0x2e')]=_['keys'](_0x3ed5bc);_0x2d601a[_0xfb61('0x2f')]=_['keys'](_0x4d233a[_0xfb61('0x2f')]);_0x2d601a[_0xfb61('0x30')]=_[_0xfb61('0x31')](_0x2d601a[_0xfb61('0x2e')],_0x2d601a[_0xfb61('0x2f')]);_0x17272e[_0xfb61('0x32')]=_[_0xfb61('0x31')](_0x2d601a[_0xfb61('0x2e')],qs[_0xfb61('0x33')](_0x4d233a[_0xfb61('0x2f')][_0xfb61('0x33')]));_0x17272e[_0xfb61('0x32')]=_0x17272e[_0xfb61('0x32')][_0xfb61('0x34')]?_0x17272e[_0xfb61('0x32')]:_0x2d601a[_0xfb61('0x2e')];if(!_0x4d233a[_0xfb61('0x2f')][_0xfb61('0x35')]('nolimit')){_0x17272e[_0xfb61('0x23')]=qs['limit'](_0x4d233a[_0xfb61('0x2f')]['limit']);_0x17272e[_0xfb61('0x22')]=qs[_0xfb61('0x22')](_0x4d233a['query'][_0xfb61('0x22')]);}_0x17272e[_0xfb61('0x36')]=qs[_0xfb61('0x37')](_0x4d233a['query'][_0xfb61('0x37')]);_0x17272e[_0xfb61('0x38')]=qs[_0xfb61('0x30')](_[_0xfb61('0x39')](_0x4d233a[_0xfb61('0x2f')],_0x2d601a[_0xfb61('0x30')]));if(_0x4d233a[_0xfb61('0x2f')][_0xfb61('0x3a')]){_0x17272e[_0xfb61('0x38')]=_[_0xfb61('0x3b')](_0x17272e['where'],{'$or':_[_0xfb61('0x3c')](_0x3ed5bc,function(_0x32f56b){if(_0x32f56b[_0xfb61('0x3d')][_0xfb61('0x3e')]!==_0xfb61('0x3f')){var _0x46a14f={};_0x46a14f[_0x32f56b[_0xfb61('0x40')]]={'$like':'%'+_0x4d233a[_0xfb61('0x2f')]['filter']+'%'};return _0x46a14f;}})});}_0x17272e=_['merge']({},_0x17272e,_0x4d233a[_0xfb61('0x41')]);var _0x5bed03={'where':_0x17272e['where']};return db['SmsQueue'][_0xfb61('0x21')](_0x5bed03)[_0xfb61('0x27')](function(_0x11db41){_0x45e74e[_0xfb61('0x21')]=_0x11db41;if(_0x4d233a[_0xfb61('0x2f')][_0xfb61('0x42')]){_0x17272e[_0xfb61('0x43')]=[{'all':!![]}];}return db[_0xfb61('0x44')][_0xfb61('0x45')](_0x17272e);})[_0xfb61('0x27')](function(_0xa291a5){_0x45e74e[_0xfb61('0x46')]=_0xa291a5;return _0x45e74e;})[_0xfb61('0x27')](respondWithFilteredResult(_0x40b52c,_0x17272e))[_0xfb61('0x47')](handleError(_0x40b52c,null));};exports[_0xfb61('0x48')]=function(_0x277a45,_0x26a5e0){var _0x55e556={'raw':!![],'where':{'id':_0x277a45[_0xfb61('0x49')]['id']}},_0x4625b8={};_0x4625b8[_0xfb61('0x2e')]=_[_0xfb61('0x4a')](db[_0xfb61('0x44')][_0xfb61('0x4b')]);_0x4625b8[_0xfb61('0x2f')]=_[_0xfb61('0x4a')](_0x277a45['query']);_0x4625b8[_0xfb61('0x30')]=_[_0xfb61('0x31')](_0x4625b8['model'],_0x4625b8[_0xfb61('0x2f')]);_0x55e556[_0xfb61('0x32')]=_['intersection'](_0x4625b8['model'],qs[_0xfb61('0x33')](_0x277a45[_0xfb61('0x2f')][_0xfb61('0x33')]));_0x55e556[_0xfb61('0x32')]=_0x55e556[_0xfb61('0x32')][_0xfb61('0x34')]?_0x55e556['attributes']:_0x4625b8[_0xfb61('0x2e')];if(_0x277a45[_0xfb61('0x2f')]['includeAll']){_0x55e556[_0xfb61('0x43')]=[{'all':!![]}];}_0x55e556=_[_0xfb61('0x3b')]({},_0x55e556,_0x277a45['options']);return db[_0xfb61('0x44')]['find'](_0x55e556)['then'](handleEntityNotFound(_0x26a5e0,null))[_0xfb61('0x27')](respondWithResult(_0x26a5e0,null))[_0xfb61('0x47')](handleError(_0x26a5e0,null));};exports[_0xfb61('0x4c')]=function(_0x473834,_0x544473){return db['SmsQueue'][_0xfb61('0x4c')](_0x473834[_0xfb61('0x4d')],{})[_0xfb61('0x27')](function(_0xd23377){var _0x29329e=_0x473834['user']['get']({'plain':!![]});if(!_0x29329e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29329e['role']===_0xfb61('0x4e')){var _0x522bd1=_0xd23377[_0xfb61('0x28')]({'plain':!![]});var _0x1fb14d=_0xfb61('0x4f');return db[_0xfb61('0x50')]['find']({'where':{'name':_0x1fb14d,'userProfileId':_0x29329e[_0xfb61('0x51')]},'raw':!![]})[_0xfb61('0x27')](function(_0x159724){if(_0x159724&&_0x159724[_0xfb61('0x52')]===0x0){return db[_0xfb61('0x29')][_0xfb61('0x4c')]({'name':_0x522bd1['name'],'resourceId':_0x522bd1['id'],'type':_0x159724[_0xfb61('0x2c')],'sectionId':_0x159724['id']},{})[_0xfb61('0x27')](function(){return _0xd23377;});}else{return _0xd23377;}})[_0xfb61('0x47')](function(_0x355790){logger[_0xfb61('0x2b')](_0xfb61('0x53'),_0x355790);throw _0x355790;});}return _0xd23377;})['then'](respondWithResult(_0x544473,0xc9))[_0xfb61('0x47')](handleError(_0x544473,null));};exports[_0xfb61('0x26')]=function(_0x32f554,_0x4b19ce){if(_0x32f554[_0xfb61('0x4d')]['id']){delete _0x32f554[_0xfb61('0x4d')]['id'];}return db['SmsQueue'][_0xfb61('0x54')]({'where':{'id':_0x32f554[_0xfb61('0x49')]['id']}})[_0xfb61('0x27')](handleEntityNotFound(_0x4b19ce,null))['then'](saveUpdates(_0x32f554[_0xfb61('0x4d')],null))['then'](respondWithResult(_0x4b19ce,null))[_0xfb61('0x47')](handleError(_0x4b19ce,null));};exports['destroy']=function(_0x2aa6e5,_0x28d86d){return db['SmsQueue']['find']({'where':{'id':_0x2aa6e5['params']['id']}})[_0xfb61('0x27')](handleEntityNotFound(_0x28d86d,null))[_0xfb61('0x27')](removeEntity(_0x28d86d,null))[_0xfb61('0x47')](handleError(_0x28d86d,null));};exports[_0xfb61('0x55')]=function(_0x5cc7a7,_0x10f377){return db[_0xfb61('0x44')]['describe']()[_0xfb61('0x27')](respondWithResult(_0x10f377,null))[_0xfb61('0x47')](handleError(_0x10f377,null));};exports[_0xfb61('0x56')]=function(_0xd2d99e,_0x2737ea,_0x29e256){var _0x4ff7f8={'raw':!![],'where':{}},_0x4921ee={},_0x57e1b4;return db[_0xfb61('0x44')]['findOne']({'where':{'id':_0xd2d99e[_0xfb61('0x49')]['id']}})['then'](handleEntityNotFound(_0x2737ea,null))[_0xfb61('0x27')](function(_0x280d60){if(_0x280d60){_0x57e1b4=_0x280d60['get']({'plain':!![]});_0x4921ee[_0xfb61('0x2e')]=_[_0xfb61('0x4a')](db[_0xfb61('0x57')][_0xfb61('0x4b')]);_0x4921ee[_0xfb61('0x2f')]=_['keys'](_0xd2d99e[_0xfb61('0x2f')]);_0x4921ee[_0xfb61('0x30')]=_[_0xfb61('0x31')](_0x4921ee['model'],_0x4921ee[_0xfb61('0x2f')]);_0x4ff7f8[_0xfb61('0x32')]=_['intersection'](_0x4921ee[_0xfb61('0x2e')],qs[_0xfb61('0x33')](_0xd2d99e[_0xfb61('0x2f')]['fields']));_0x4ff7f8[_0xfb61('0x32')]=_0x4ff7f8[_0xfb61('0x32')][_0xfb61('0x34')]?_0x4ff7f8[_0xfb61('0x32')]:_0x4921ee['model'];if(!_0xd2d99e[_0xfb61('0x2f')][_0xfb61('0x35')](_0xfb61('0x58'))){_0x4ff7f8[_0xfb61('0x23')]=qs[_0xfb61('0x23')](_0xd2d99e[_0xfb61('0x2f')][_0xfb61('0x23')]);_0x4ff7f8[_0xfb61('0x22')]=qs[_0xfb61('0x22')](_0xd2d99e[_0xfb61('0x2f')][_0xfb61('0x22')]);}_0x4ff7f8[_0xfb61('0x36')]=qs[_0xfb61('0x37')](_0xd2d99e[_0xfb61('0x2f')][_0xfb61('0x37')]);_0x4ff7f8[_0xfb61('0x38')]=qs[_0xfb61('0x30')](_[_0xfb61('0x39')](_0xd2d99e['query'],_0x4921ee[_0xfb61('0x30')]));_0x4ff7f8[_0xfb61('0x38')]['SmsQueueId']=_0x280d60['id'];if(_0xd2d99e['query']['filter']){_0x4ff7f8[_0xfb61('0x38')]=_[_0xfb61('0x3b')](_0x4ff7f8['where'],{'$or':_['map'](_0x4ff7f8['attributes'],function(_0x32ee09){var _0x49533f={};_0x49533f[_0x32ee09]={'$like':'%'+_0xd2d99e[_0xfb61('0x2f')][_0xfb61('0x3a')]+'%'};return _0x49533f;})});}_0x4ff7f8=_[_0xfb61('0x3b')]({},_0x4ff7f8,_0xd2d99e[_0xfb61('0x41')]);return db['UserSmsQueue'][_0xfb61('0x45')](_0x4ff7f8);}})[_0xfb61('0x27')](function(_0x3d23d7){if(_0x3d23d7){return db['User'][_0xfb61('0x59')]({'where':{'id':_[_0xfb61('0x3c')](_0x3d23d7,_0xfb61('0x5a')),'role':_0xfb61('0x5b')},'attributes':['id','name',_0xfb61('0x5c'),_0xfb61('0x5d'),_0xfb61('0x5e')]});}})['then'](function(_0x35f34e){if(_0x35f34e){return{'count':_0x35f34e[_0xfb61('0x21')],'rows':_[_0xfb61('0x3c')](_0x35f34e[_0xfb61('0x46')],function(_0x3f651a){return{'membername':_0x3f651a[_0xfb61('0x2c')],'UserId':_0x3f651a['id'],'queue_name':_0x57e1b4[_0xfb61('0x2c')],'SmsQueueId':_0x57e1b4['id'],'interface':util[_0xfb61('0x5f')]('%s/%s',_0xfb61('0x60'),_0x3f651a[_0xfb61('0x2c')]),'penalty':0x0,'paused':_0x3f651a[_0xfb61('0x5c')],'createdAt':_0x3f651a[_0xfb61('0x5e')],'updatedAt':_0x3f651a[_0xfb61('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfb61('0x27')](respondWithFilteredResult(_0x2737ea,_0x4ff7f8))[_0xfb61('0x47')](handleError(_0x2737ea,null));};exports['getTeams']=function(_0x5a80b0,_0x443a98,_0x9ab71d){var _0x134ab9={};var _0xbda108={};var _0x45bf43;var _0xffa61;return db['SmsQueue']['findOne']({'where':{'id':_0x5a80b0['params']['id']}})[_0xfb61('0x27')](handleEntityNotFound(_0x443a98,null))[_0xfb61('0x27')](function(_0x2c178f){if(_0x2c178f){_0x45bf43=_0x2c178f;_0xbda108[_0xfb61('0x2e')]=_[_0xfb61('0x4a')](db['Team'][_0xfb61('0x4b')]);_0xbda108[_0xfb61('0x2f')]=_[_0xfb61('0x4a')](_0x5a80b0['query']);_0xbda108['filters']=_['intersection'](_0xbda108[_0xfb61('0x2e')],_0xbda108[_0xfb61('0x2f')]);_0x134ab9['attributes']=_[_0xfb61('0x31')](_0xbda108['model'],qs[_0xfb61('0x33')](_0x5a80b0[_0xfb61('0x2f')][_0xfb61('0x33')]));_0x134ab9[_0xfb61('0x32')]=_0x134ab9['attributes'][_0xfb61('0x34')]?_0x134ab9[_0xfb61('0x32')]:_0xbda108['model'];_0x134ab9[_0xfb61('0x36')]=qs[_0xfb61('0x37')](_0x5a80b0[_0xfb61('0x2f')][_0xfb61('0x37')]);_0x134ab9[_0xfb61('0x38')]=qs[_0xfb61('0x30')](_[_0xfb61('0x39')](_0x5a80b0[_0xfb61('0x2f')],_0xbda108['filters']));if(_0x5a80b0[_0xfb61('0x2f')][_0xfb61('0x3a')]){_0x134ab9[_0xfb61('0x38')]=_[_0xfb61('0x3b')](_0x134ab9['where'],{'$or':_[_0xfb61('0x3c')](_0x134ab9[_0xfb61('0x32')],function(_0x5bbe71){var _0x578053={};_0x578053[_0x5bbe71]={'$like':'%'+_0x5a80b0[_0xfb61('0x2f')][_0xfb61('0x3a')]+'%'};return _0x578053;})});}_0x134ab9=_[_0xfb61('0x3b')]({},_0x134ab9,_0x5a80b0[_0xfb61('0x41')]);return _0x45bf43[_0xfb61('0x61')](_0x134ab9);}})['then'](function(_0x23b6f4){if(_0x23b6f4){_0xffa61=_0x23b6f4[_0xfb61('0x34')];if(!_0x5a80b0[_0xfb61('0x2f')][_0xfb61('0x35')](_0xfb61('0x58'))){_0x134ab9[_0xfb61('0x23')]=qs['limit'](_0x5a80b0[_0xfb61('0x2f')]['limit']);_0x134ab9['offset']=qs[_0xfb61('0x22')](_0x5a80b0['query']['offset']);}return _0x45bf43[_0xfb61('0x61')](_0x134ab9);}})[_0xfb61('0x27')](function(_0x47e0fe){if(_0x47e0fe){return _0x47e0fe?{'count':_0xffa61,'rows':_0x47e0fe}:null;}})['then'](respondWithResult(_0x443a98,null))[_0xfb61('0x47')](handleError(_0x443a98,null));};exports[_0xfb61('0x62')]=function(_0x518b8b,_0x1e7519,_0x13ade9){var _0x3c3c11=[];var _0x255208;return db['Team'][_0xfb61('0x45')]({'where':{'id':_0x518b8b[_0xfb61('0x4d')]['ids']},'attributes':['id'],'include':[{'model':db[_0xfb61('0x63')],'as':_0xfb61('0x64'),'attributes':['id'],'raw':!![]}]})[_0xfb61('0x27')](function(_0x224676){if(_0x224676){for(var _0x2b8ae2=0x0;_0x2b8ae2<_0x224676[_0xfb61('0x34')];_0x2b8ae2+=0x1){for(var _0x35a3ae=0x0;_0x35a3ae<_0x224676[_0x2b8ae2]['Agents'][_0xfb61('0x34')];_0x35a3ae+=0x1){_0x3c3c11=_[_0xfb61('0x65')](_0x3c3c11,[_0x224676[_0x2b8ae2][_0xfb61('0x64')][_0x35a3ae]['id']]);}}return _0x3c3c11;}})[_0xfb61('0x27')](function(_0x1d8bec){if(_0x1d8bec){return db['SmsQueue'][_0xfb61('0x54')]({'where':{'id':_0x518b8b['params']['id']}});}})[_0xfb61('0x27')](function(_0x78bee0){if(_0x78bee0){_0x255208=_0x78bee0;return _0x255208[_0xfb61('0x66')](_0x3c3c11,{'penalty':_0x518b8b[_0xfb61('0x4d')][_0xfb61('0x67')]});}})[_0xfb61('0x27')](function(_0xeecf79){if(_0xeecf79){return _0x255208[_0xfb61('0x62')](_0x518b8b[_0xfb61('0x4d')]['ids']);}})[_0xfb61('0x27')](handleEntityNotFound(_0x1e7519,null))[_0xfb61('0x27')](respondWithStatusCode(_0x1e7519,null))[_0xfb61('0x47')](handleError(_0x1e7519,null));};exports[_0xfb61('0x68')]=function(_0x539914,_0x213ca9,_0x4e5b0d){var _0x2db10f=[];var _0x6f2a35;return db[_0xfb61('0x69')][_0xfb61('0x45')]({'where':{'id':_0x539914[_0xfb61('0x2f')][_0xfb61('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xfb61('0x63')],'as':_0xfb61('0x64'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x4c60d1){if(_0x4c60d1){for(var _0x6436cf=0x0;_0x6436cf<_0x4c60d1['length'];_0x6436cf+=0x1){for(var _0x65f7d0=0x0;_0x65f7d0<_0x4c60d1[_0x6436cf][_0xfb61('0x64')][_0xfb61('0x34')];_0x65f7d0+=0x1){_0x2db10f=_[_0xfb61('0x65')](_0x2db10f,[_0x4c60d1[_0x6436cf][_0xfb61('0x64')][_0x65f7d0]['id']]);}}return _0x2db10f;}})[_0xfb61('0x27')](function(_0xf0aa32){if(_0xf0aa32){return db['SmsQueue']['find']({'where':{'id':_0x539914['params']['id']}});}})[_0xfb61('0x27')](function(_0x1f84bd){if(_0x1f84bd){_0x6f2a35=_0x1f84bd;return _0x6f2a35['removeAgents'](_0x2db10f);}})[_0xfb61('0x27')](function(_0x5ada8f){if(_0x6f2a35){return _0x6f2a35[_0xfb61('0x68')](_0x539914[_0xfb61('0x2f')][_0xfb61('0x6a')]);}})[_0xfb61('0x27')](handleEntityNotFound(_0x213ca9,null))['then'](respondWithStatusCode(_0x213ca9,null))[_0xfb61('0x47')](handleError(_0x213ca9,null));};exports[_0xfb61('0x66')]=function(_0x267d39,_0x49d7fa,_0x41b64a){return db[_0xfb61('0x44')][_0xfb61('0x54')]({'where':{'id':_0x267d39[_0xfb61('0x49')]['id']}})[_0xfb61('0x27')](handleEntityNotFound(_0x49d7fa,null))[_0xfb61('0x27')](function(_0x47eeae){if(_0x47eeae){return _0x47eeae[_0xfb61('0x66')](_0x267d39[_0xfb61('0x4d')][_0xfb61('0x6a')],_[_0xfb61('0x6b')](_0x267d39[_0xfb61('0x4d')],['ids','id'])||{})['spread'](function(_0x3bf1b9){for(var _0x1106df=0x0;_0x1106df<_0x267d39[_0xfb61('0x4d')][_0xfb61('0x6a')][_0xfb61('0x34')];_0x1106df+=0x1){socket[_0xfb61('0x6c')](_0xfb61('0x6d'),{'UserId':_0x267d39[_0xfb61('0x4d')][_0xfb61('0x6a')][_0x1106df],'SmsQueueId':_0x267d39['params']['id']});}return _0x3bf1b9;});}})[_0xfb61('0x27')](respondWithResult(_0x49d7fa,null))[_0xfb61('0x47')](handleError(_0x49d7fa,null));};exports['removeAgents']=function(_0x5a91b1,_0x68753a,_0x3c3913){var _0x106d81;return db[_0xfb61('0x44')][_0xfb61('0x54')]({'where':{'id':_0x5a91b1[_0xfb61('0x49')]['id']}})[_0xfb61('0x27')](handleEntityNotFound(_0x68753a,null))[_0xfb61('0x27')](function(_0x27d4c2){if(_0x27d4c2){return _0x27d4c2[_0xfb61('0x6e')](_0x5a91b1[_0xfb61('0x2f')][_0xfb61('0x6a')])['then'](function(_0xbf1032){if(_[_0xfb61('0x6f')](_0x5a91b1[_0xfb61('0x2f')][_0xfb61('0x6a')])){for(var _0x8a9733=0x0;_0x8a9733<_0x5a91b1[_0xfb61('0x2f')][_0xfb61('0x6a')]['length'];_0x8a9733+=0x1){socket[_0xfb61('0x6c')](_0xfb61('0x70'),{'UserId':_0x5a91b1[_0xfb61('0x2f')][_0xfb61('0x6a')][_0x8a9733],'SmsQueueId':_0x5a91b1[_0xfb61('0x49')]['id']});}}else{socket['emit'](_0xfb61('0x70'),{'UserId':_0x5a91b1['query'][_0xfb61('0x6a')],'SmsQueueId':_0x5a91b1[_0xfb61('0x49')]['id']});}});}})[_0xfb61('0x27')](respondWithStatusCode(_0x68753a,null))[_0xfb61('0x47')](handleError(_0x68753a,null));};exports[_0xfb61('0x71')]=function(_0x2570b6,_0x27a374,_0x1f1307){var _0x297575={};var _0x12a0d5={};var _0x18cb3f;var _0x57f03d;return db['SmsQueue'][_0xfb61('0x72')]({'where':{'id':_0x2570b6[_0xfb61('0x49')]['id']}})[_0xfb61('0x27')](handleEntityNotFound(_0x27a374,null))[_0xfb61('0x27')](function(_0x58eac7){if(_0x58eac7){_0x18cb3f=_0x58eac7;_0x12a0d5[_0xfb61('0x2e')]=_[_0xfb61('0x4a')](db['User'][_0xfb61('0x4b')]);_0x12a0d5[_0xfb61('0x2f')]=_[_0xfb61('0x4a')](_0x2570b6[_0xfb61('0x2f')]);_0x12a0d5['filters']=_[_0xfb61('0x31')](_0x12a0d5['model'],_0x12a0d5[_0xfb61('0x2f')]);_0x297575[_0xfb61('0x32')]=_['intersection'](_0x12a0d5[_0xfb61('0x2e')],qs[_0xfb61('0x33')](_0x2570b6['query'][_0xfb61('0x33')]));_0x297575[_0xfb61('0x32')]=_0x297575['attributes'][_0xfb61('0x34')]?_0x297575[_0xfb61('0x32')]:_0x12a0d5['model'];_0x297575['order']=qs[_0xfb61('0x37')](_0x2570b6[_0xfb61('0x2f')][_0xfb61('0x37')]);_0x297575['where']=qs[_0xfb61('0x30')](_[_0xfb61('0x39')](_0x2570b6[_0xfb61('0x2f')],_0x12a0d5[_0xfb61('0x30')]));if(_0x2570b6[_0xfb61('0x2f')][_0xfb61('0x3a')]){_0x297575[_0xfb61('0x38')]=_['merge'](_0x297575[_0xfb61('0x38')],{'$or':_[_0xfb61('0x3c')](_0x297575[_0xfb61('0x32')],function(_0x5c3890){var _0x58ea14={};_0x58ea14[_0x5c3890]={'$like':'%'+_0x2570b6[_0xfb61('0x2f')][_0xfb61('0x3a')]+'%'};return _0x58ea14;})});}_0x297575=_['merge']({},_0x297575,_0x2570b6[_0xfb61('0x41')]);return _0x18cb3f[_0xfb61('0x71')](_0x297575);}})[_0xfb61('0x27')](function(_0x4ad633){if(_0x4ad633){_0x57f03d=_0x4ad633[_0xfb61('0x34')];if(!_0x2570b6['query'][_0xfb61('0x35')](_0xfb61('0x58'))){_0x297575['limit']=qs[_0xfb61('0x23')](_0x2570b6[_0xfb61('0x2f')][_0xfb61('0x23')]);_0x297575['offset']=qs[_0xfb61('0x22')](_0x2570b6[_0xfb61('0x2f')]['offset']);}return _0x18cb3f[_0xfb61('0x71')](_0x297575);}})['then'](function(_0x4d3113){if(_0x4d3113){return _0x4d3113?{'count':_0x57f03d,'rows':_0x4d3113}:null;}})[_0xfb61('0x27')](respondWithResult(_0x27a374,null))[_0xfb61('0x47')](handleError(_0x27a374,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 07b0dd7..3391c9c 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 _0x7b00=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsQueue','setMaxListeners','save'];(function(_0x43524a,_0x28939a){var _0x15c496=function(_0x3e7f2d){while(--_0x3e7f2d){_0x43524a['push'](_0x43524a['shift']());}};_0x15c496(++_0x28939a);}(_0x7b00,0xba));var _0x07b0=function(_0x27acb5,_0x1c8176){_0x27acb5=_0x27acb5-0x0;var _0x569522=_0x7b00[_0x27acb5];return _0x569522;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x07b0('0x0'))['db'][_0x07b0('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x07b0('0x2')](0x0);var events={'afterCreate':_0x07b0('0x3'),'afterUpdate':_0x07b0('0x4'),'afterDestroy':_0x07b0('0x5')};function emitEvent(_0x267815){return function(_0x115da1,_0x348d25,_0x45d1ee){SmsQueueEvents[_0x07b0('0x6')](_0x267815+':'+_0x115da1['id'],_0x115da1);SmsQueueEvents[_0x07b0('0x6')](_0x267815,_0x115da1);_0x45d1ee(null);};}for(var e in events){if(events[_0x07b0('0x7')](e)){var event=events[e];SmsQueue[_0x07b0('0x8')](e,emitEvent(event));}}module[_0x07b0('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x032d=['events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x10bf5d,_0x10a3a9){var _0x27f511=function(_0x209cf3){while(--_0x209cf3){_0x10bf5d['push'](_0x10bf5d['shift']());}};_0x27f511(++_0x10a3a9);}(_0x032d,0x99));var _0xd032=function(_0x39acb8,_0x3d4b6a){_0x39acb8=_0x39acb8-0x0;var _0x2b778f=_0x032d[_0x39acb8];return _0x2b778f;};'use strict';var EventEmitter=require(_0xd032('0x0'));var SmsQueue=require(_0xd032('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xd032('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd032('0x3'),'afterDestroy':_0xd032('0x4')};function emitEvent(_0x34cfee){return function(_0x4b023d,_0x29cd7b,_0x236306){SmsQueueEvents[_0xd032('0x5')](_0x34cfee+':'+_0x4b023d['id'],_0x4b023d);SmsQueueEvents[_0xd032('0x5')](_0x34cfee,_0x4b023d);_0x236306(null);};}for(var e in events){if(events[_0xd032('0x6')](e)){var event=events[e];SmsQueue[_0xd032('0x7')](e,emitEvent(event));}}module[_0xd032('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 8e561b4..63ac4e2 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 _0x5b5f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports','SmsQueue'];(function(_0x351c70,_0x45602c){var _0x2c312a=function(_0x556d43){while(--_0x556d43){_0x351c70['push'](_0x351c70['shift']());}};_0x2c312a(++_0x45602c);}(_0x5b5f,0x117));var _0xf5b5=function(_0x3cd4df,_0x756389){_0x3cd4df=_0x3cd4df-0x0;var _0x54a719=_0x5b5f[_0x3cd4df];return _0x54a719;};'use strict';var _=require(_0xf5b5('0x0'));var util=require(_0xf5b5('0x1'));var logger=require(_0xf5b5('0x2'))(_0xf5b5('0x3'));var moment=require(_0xf5b5('0x4'));var BPromise=require(_0xf5b5('0x5'));var rp=require(_0xf5b5('0x6'));var attributes=require('./smsQueue.attributes');module[_0xf5b5('0x7')]=function(_0x112300,_0x4d1ec2){return _0x112300['define'](_0xf5b5('0x8'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6b6=['api','bluebird','./smsQueue.attributes','define','sms_queues','util','../../config/logger'];(function(_0x3b0358,_0x33128f){var _0x4361fa=function(_0x36cadf){while(--_0x36cadf){_0x3b0358['push'](_0x3b0358['shift']());}};_0x4361fa(++_0x33128f);}(_0xb6b6,0x194));var _0x6b6b=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xb6b6[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0x6b6b('0x0'));var logger=require(_0x6b6b('0x1'))(_0x6b6b('0x2'));var moment=require('moment');var BPromise=require(_0x6b6b('0x3'));var rp=require('request-promise');var attributes=require(_0x6b6b('0x4'));module['exports']=function(_0x107257,_0x3fc77d){return _0x107257[_0x6b6b('0x5')]('SmsQueue',attributes,{'tableName':_0x6b6b('0x6'),'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 3b905eb..99efe84 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 _0xa5df=['SmsQueue,\x20%s,\x20%s','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','where','attributes','limit','include','model','map','debug','ShowSmsQueue','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./smsQueue.socket','register','request','then','info'];(function(_0x2698b0,_0x22c9ad){var _0x208423=function(_0x100302){while(--_0x100302){_0x2698b0['push'](_0x2698b0['shift']());}};_0x208423(++_0x22c9ad);}(_0xa5df,0x190));var _0xfa5d=function(_0x4bd213,_0x3eadbf){_0x4bd213=_0x4bd213-0x0;var _0x13acc2=_0xa5df[_0x4bd213];return _0x13acc2;};'use strict';var _=require(_0xfa5d('0x0'));var util=require(_0xfa5d('0x1'));var moment=require(_0xfa5d('0x2'));var BPromise=require(_0xfa5d('0x3'));var rs=require(_0xfa5d('0x4'));var fs=require('fs');var Redis=require(_0xfa5d('0x5'));var db=require(_0xfa5d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfa5d('0x7'))(_0xfa5d('0x8'));var config=require(_0xfa5d('0x9'));var jayson=require(_0xfa5d('0xa'));var client=jayson[_0xfa5d('0xb')][_0xfa5d('0xc')]({'port':0x232a});config[_0xfa5d('0xd')]=_['defaults'](config['redis'],{'host':_0xfa5d('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfa5d('0xd')]));require(_0xfa5d('0xf'))[_0xfa5d('0x10')](socket);function respondWithRpcPromise(_0x39d9bd,_0x3d5313,_0x3fe4a0){return new BPromise(function(_0x317b93,_0x4f2f7e){return client[_0xfa5d('0x11')](_0x39d9bd,_0x3fe4a0)[_0xfa5d('0x12')](function(_0x57e2b9){logger[_0xfa5d('0x13')](_0xfa5d('0x14'),_0x3d5313,'request\x20sent');logger['debug'](_0xfa5d('0x15'),_0x3d5313,_0xfa5d('0x16'),JSON[_0xfa5d('0x17')](_0x57e2b9));if(_0x57e2b9[_0xfa5d('0x18')]){if(_0x57e2b9['error'][_0xfa5d('0x19')]===0x1f4){logger['error'](_0xfa5d('0x14'),_0x3d5313,_0x57e2b9[_0xfa5d('0x18')]['message']);return _0x4f2f7e(_0x57e2b9[_0xfa5d('0x18')][_0xfa5d('0x1a')]);}logger[_0xfa5d('0x18')](_0xfa5d('0x14'),_0x3d5313,_0x57e2b9['error'][_0xfa5d('0x1a')]);return _0x317b93(_0x57e2b9[_0xfa5d('0x18')]['message']);}else{logger[_0xfa5d('0x13')](_0xfa5d('0x14'),_0x3d5313,_0xfa5d('0x16'));_0x317b93(_0x57e2b9[_0xfa5d('0x1b')][_0xfa5d('0x1a')]);}})[_0xfa5d('0x1c')](function(_0x172a87){logger[_0xfa5d('0x18')]('SmsQueue,\x20%s,\x20%s',_0x3d5313,_0x172a87);_0x4f2f7e(_0x172a87);});});}exports[_0xfa5d('0x1d')]=function(_0x47daad){var _0x46fc00=this;return new Promise(function(_0x298c85,_0x44eb42){return db[_0xfa5d('0x1e')][_0xfa5d('0x1f')]({'raw':_0x47daad[_0xfa5d('0x20')]?_0x47daad[_0xfa5d('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x47daad[_0xfa5d('0x20')]?_0x47daad[_0xfa5d('0x20')][_0xfa5d('0x21')]||null:null,'attributes':_0x47daad[_0xfa5d('0x20')]?_0x47daad['options'][_0xfa5d('0x22')]||null:null,'limit':_0x47daad[_0xfa5d('0x20')]?_0x47daad[_0xfa5d('0x20')][_0xfa5d('0x23')]||null:null,'include':_0x47daad['options']?_0x47daad[_0xfa5d('0x20')][_0xfa5d('0x24')]?_['map'](_0x47daad[_0xfa5d('0x20')][_0xfa5d('0x24')],function(_0xd0c72a){return{'model':db[_0xd0c72a[_0xfa5d('0x25')]],'as':_0xd0c72a['as'],'attributes':_0xd0c72a['attributes'],'include':_0xd0c72a['include']?_[_0xfa5d('0x26')](_0xd0c72a[_0xfa5d('0x24')],function(_0x1ff657){return{'model':db[_0x1ff657[_0xfa5d('0x25')]],'as':_0x1ff657['as'],'attributes':_0x1ff657[_0xfa5d('0x22')],'include':_0x1ff657[_0xfa5d('0x24')]?_['map'](_0x1ff657[_0xfa5d('0x24')],function(_0x20dd85){return{'model':db[_0x20dd85['model']],'as':_0x20dd85['as'],'attributes':_0x20dd85[_0xfa5d('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e9bde){logger[_0xfa5d('0x13')](_0xfa5d('0x1d'),_0x47daad);logger[_0xfa5d('0x27')](_0xfa5d('0x1d'),_0x47daad,JSON[_0xfa5d('0x17')](_0x5e9bde));_0x298c85(_0x5e9bde);})['catch'](function(_0x3b0ff5){logger[_0xfa5d('0x18')](_0xfa5d('0x1d'),_0x3b0ff5['message'],_0x47daad);_0x44eb42(_0x46fc00[_0xfa5d('0x18')](0x1f4,_0x3b0ff5[_0xfa5d('0x1a')]));});});};exports[_0xfa5d('0x28')]=function(_0x56521a){var _0x376691=this;return new Promise(function(_0x1dfc93,_0x299eb6){return db[_0xfa5d('0x1e')]['find']({'raw':_0x56521a[_0xfa5d('0x20')]?_0x56521a[_0xfa5d('0x20')][_0xfa5d('0x29')]===undefined?!![]:![]:!![],'where':_0x56521a[_0xfa5d('0x20')]?_0x56521a[_0xfa5d('0x20')][_0xfa5d('0x21')]||null:null,'attributes':_0x56521a[_0xfa5d('0x20')]?_0x56521a['options']['attributes']||null:null,'include':_0x56521a[_0xfa5d('0x20')]?_0x56521a[_0xfa5d('0x20')]['include']?_[_0xfa5d('0x26')](_0x56521a[_0xfa5d('0x20')][_0xfa5d('0x24')],function(_0x5d0d5e){return{'model':db[_0x5d0d5e[_0xfa5d('0x25')]],'as':_0x5d0d5e['as'],'attributes':_0x5d0d5e[_0xfa5d('0x22')],'include':_0x5d0d5e[_0xfa5d('0x24')]?_[_0xfa5d('0x26')](_0x5d0d5e[_0xfa5d('0x24')],function(_0x188795){return{'model':db[_0x188795[_0xfa5d('0x25')]],'as':_0x188795['as'],'attributes':_0x188795[_0xfa5d('0x22')],'include':_0x188795['include']?_['map'](_0x188795[_0xfa5d('0x24')],function(_0x9d126e){return{'model':db[_0x9d126e[_0xfa5d('0x25')]],'as':_0x9d126e['as'],'attributes':_0x9d126e['attributes']};}):[]};}):[]};}):[]:[]})[_0xfa5d('0x12')](function(_0x51d0c8){logger[_0xfa5d('0x13')](_0xfa5d('0x28'),_0x56521a);logger[_0xfa5d('0x27')]('ShowSmsQueue',_0x56521a,JSON[_0xfa5d('0x17')](_0x51d0c8));_0x1dfc93(_0x51d0c8);})[_0xfa5d('0x1c')](function(_0x416fbe){logger[_0xfa5d('0x18')]('ShowSmsQueue',_0x416fbe[_0xfa5d('0x1a')],_0x56521a);_0x299eb6(_0x376691[_0xfa5d('0x18')](0x1f4,_0x416fbe['message']));});});}; \ No newline at end of file +var _0x1ff9=['error','message','result','GetSmsQueue','SmsQueue','options','raw','where','attributes','limit','map','include','model','catch','ShowSmsQueue','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x1ff9,0x15c));var _0x91ff=function(_0x5a8c89,_0x210289){_0x5a8c89=_0x5a8c89-0x0;var _0x1b8a9f=_0x1ff9[_0x5a8c89];return _0x1b8a9f;};'use strict';var _=require(_0x91ff('0x0'));var util=require(_0x91ff('0x1'));var moment=require(_0x91ff('0x2'));var BPromise=require('bluebird');var rs=require(_0x91ff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91ff('0x4'))['db'];var utils=require(_0x91ff('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x91ff('0x6'));var jayson=require(_0x91ff('0x7'));var client=jayson[_0x91ff('0x8')]['http']({'port':0x232a});config[_0x91ff('0x9')]=_['defaults'](config[_0x91ff('0x9')],{'host':_0x91ff('0xa'),'port':0x18eb});var socket=require(_0x91ff('0xb'))(new Redis(config[_0x91ff('0x9')]));require(_0x91ff('0xc'))[_0x91ff('0xd')](socket);function respondWithRpcPromise(_0x5c32f9,_0xe3e1bb,_0x1529ba){return new BPromise(function(_0x3b9db7,_0x26707e){return client[_0x91ff('0xe')](_0x5c32f9,_0x1529ba)[_0x91ff('0xf')](function(_0x355665){logger[_0x91ff('0x10')](_0x91ff('0x11'),_0xe3e1bb,'request\x20sent');logger[_0x91ff('0x12')](_0x91ff('0x13'),_0xe3e1bb,_0x91ff('0x14'),JSON[_0x91ff('0x15')](_0x355665));if(_0x355665[_0x91ff('0x16')]){if(_0x355665[_0x91ff('0x16')]['code']===0x1f4){logger[_0x91ff('0x16')](_0x91ff('0x11'),_0xe3e1bb,_0x355665['error'][_0x91ff('0x17')]);return _0x26707e(_0x355665['error'][_0x91ff('0x17')]);}logger['error'](_0x91ff('0x11'),_0xe3e1bb,_0x355665[_0x91ff('0x16')][_0x91ff('0x17')]);return _0x3b9db7(_0x355665[_0x91ff('0x16')]['message']);}else{logger[_0x91ff('0x10')](_0x91ff('0x11'),_0xe3e1bb,_0x91ff('0x14'));_0x3b9db7(_0x355665[_0x91ff('0x18')][_0x91ff('0x17')]);}})['catch'](function(_0x35bd0c){logger['error']('SmsQueue,\x20%s,\x20%s',_0xe3e1bb,_0x35bd0c);_0x26707e(_0x35bd0c);});});}exports[_0x91ff('0x19')]=function(_0x373e20){var _0x5c291b=this;return new Promise(function(_0x162200,_0x3d587f){return db[_0x91ff('0x1a')]['findAll']({'raw':_0x373e20['options']?_0x373e20[_0x91ff('0x1b')][_0x91ff('0x1c')]===undefined?!![]:![]:!![],'where':_0x373e20['options']?_0x373e20[_0x91ff('0x1b')][_0x91ff('0x1d')]||null:null,'attributes':_0x373e20[_0x91ff('0x1b')]?_0x373e20['options'][_0x91ff('0x1e')]||null:null,'limit':_0x373e20[_0x91ff('0x1b')]?_0x373e20[_0x91ff('0x1b')][_0x91ff('0x1f')]||null:null,'include':_0x373e20[_0x91ff('0x1b')]?_0x373e20[_0x91ff('0x1b')]['include']?_[_0x91ff('0x20')](_0x373e20[_0x91ff('0x1b')][_0x91ff('0x21')],function(_0x1e34dd){return{'model':db[_0x1e34dd[_0x91ff('0x22')]],'as':_0x1e34dd['as'],'attributes':_0x1e34dd[_0x91ff('0x1e')],'include':_0x1e34dd[_0x91ff('0x21')]?_[_0x91ff('0x20')](_0x1e34dd[_0x91ff('0x21')],function(_0x5aa934){return{'model':db[_0x5aa934[_0x91ff('0x22')]],'as':_0x5aa934['as'],'attributes':_0x5aa934[_0x91ff('0x1e')],'include':_0x5aa934[_0x91ff('0x21')]?_[_0x91ff('0x20')](_0x5aa934['include'],function(_0x5a0e4a){return{'model':db[_0x5a0e4a['model']],'as':_0x5a0e4a['as'],'attributes':_0x5a0e4a[_0x91ff('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a9bf7){logger[_0x91ff('0x10')](_0x91ff('0x19'),_0x373e20);logger[_0x91ff('0x12')](_0x91ff('0x19'),_0x373e20,JSON[_0x91ff('0x15')](_0x2a9bf7));_0x162200(_0x2a9bf7);})[_0x91ff('0x23')](function(_0x3bc326){logger[_0x91ff('0x16')](_0x91ff('0x19'),_0x3bc326[_0x91ff('0x17')],_0x373e20);_0x3d587f(_0x5c291b['error'](0x1f4,_0x3bc326[_0x91ff('0x17')]));});});};exports[_0x91ff('0x24')]=function(_0x3e0d90){var _0x1461f6=this;return new Promise(function(_0x33c59f,_0x193264){return db[_0x91ff('0x1a')]['find']({'raw':_0x3e0d90[_0x91ff('0x1b')]?_0x3e0d90[_0x91ff('0x1b')][_0x91ff('0x1c')]===undefined?!![]:![]:!![],'where':_0x3e0d90[_0x91ff('0x1b')]?_0x3e0d90[_0x91ff('0x1b')]['where']||null:null,'attributes':_0x3e0d90[_0x91ff('0x1b')]?_0x3e0d90[_0x91ff('0x1b')]['attributes']||null:null,'include':_0x3e0d90[_0x91ff('0x1b')]?_0x3e0d90[_0x91ff('0x1b')][_0x91ff('0x21')]?_[_0x91ff('0x20')](_0x3e0d90[_0x91ff('0x1b')][_0x91ff('0x21')],function(_0x7808d6){return{'model':db[_0x7808d6[_0x91ff('0x22')]],'as':_0x7808d6['as'],'attributes':_0x7808d6[_0x91ff('0x1e')],'include':_0x7808d6['include']?_[_0x91ff('0x20')](_0x7808d6[_0x91ff('0x21')],function(_0x530b7a){return{'model':db[_0x530b7a[_0x91ff('0x22')]],'as':_0x530b7a['as'],'attributes':_0x530b7a['attributes'],'include':_0x530b7a[_0x91ff('0x21')]?_['map'](_0x530b7a[_0x91ff('0x21')],function(_0x46f24f){return{'model':db[_0x46f24f['model']],'as':_0x46f24f['as'],'attributes':_0x46f24f[_0x91ff('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x91ff('0xf')](function(_0x39e0d9){logger['info'](_0x91ff('0x24'),_0x3e0d90);logger[_0x91ff('0x12')](_0x91ff('0x24'),_0x3e0d90,JSON[_0x91ff('0x15')](_0x39e0d9));_0x33c59f(_0x39e0d9);})['catch'](function(_0x4a2912){logger[_0x91ff('0x16')]('ShowSmsQueue',_0x4a2912[_0x91ff('0x17')],_0x3e0d90);_0x193264(_0x1461f6[_0x91ff('0x16')](0x1f4,_0x4a2912['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index fe6660d..14fb2e0 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 _0xbd0e=['smsQueue:','save','update','emit','register','length'];(function(_0x2650e9,_0xb91cc){var _0x3511c8=function(_0x5069cf){while(--_0x5069cf){_0x2650e9['push'](_0x2650e9['shift']());}};_0x3511c8(++_0xb91cc);}(_0xbd0e,0x187));var _0xebd0=function(_0x29a5f4,_0x19fa25){_0x29a5f4=_0x29a5f4-0x0;var _0x307190=_0xbd0e[_0x29a5f4];return _0x307190;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xebd0('0x0'),'remove',_0xebd0('0x1')];function createListener(_0x2acfc5,_0xa363c8){return function(_0x21dc43){_0xa363c8[_0xebd0('0x2')](_0x2acfc5,_0x21dc43);};}function removeListener(_0x811ddd,_0x4df56d){return function(){SmsQueueEvents['removeListener'](_0x811ddd,_0x4df56d);};}exports[_0xebd0('0x3')]=function(_0x3ce784){for(var _0x2f0192=0x0,_0x3f385c=events[_0xebd0('0x4')];_0x2f0192<_0x3f385c;_0x2f0192++){var _0x171d16=events[_0x2f0192];var _0x3b81b5=createListener(_0xebd0('0x5')+_0x171d16,_0x3ce784);SmsQueueEvents['on'](_0x171d16,_0x3b81b5);}}; \ No newline at end of file +var _0x10ab=['update','register','length','smsQueue:','./smsQueue.events','save'];(function(_0x30c200,_0xa2de6e){var _0x203650=function(_0x1e79fd){while(--_0x1e79fd){_0x30c200['push'](_0x30c200['shift']());}};_0x203650(++_0xa2de6e);}(_0x10ab,0x178));var _0xb10a=function(_0x156a77,_0x522c13){_0x156a77=_0x156a77-0x0;var _0x32398a=_0x10ab[_0x156a77];return _0x32398a;};'use strict';var SmsQueueEvents=require(_0xb10a('0x0'));var events=[_0xb10a('0x1'),'remove',_0xb10a('0x2')];function createListener(_0x556b92,_0x365c2b){return function(_0xfa824d){_0x365c2b['emit'](_0x556b92,_0xfa824d);};}function removeListener(_0x1f9062,_0x456133){return function(){SmsQueueEvents['removeListener'](_0x1f9062,_0x456133);};}exports[_0xb10a('0x3')]=function(_0x23f0ab){for(var _0x42d94c=0x0,_0x955f5f=events[_0xb10a('0x4')];_0x42d94c<_0x955f5f;_0x42d94c++){var _0x244911=events[_0x42d94c];var _0x37d89f=createListener(_0xb10a('0x5')+_0x244911,_0x23f0ab);SmsQueueEvents['on'](_0x244911,_0x37d89f);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index aa6f4c2..95647dc 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 _0xe599=['get','isAuthenticated','describe','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xe599,0x1e5));var _0x9e59=function(_0x2f19a1,_0x312ebe){_0x2f19a1=_0x2f19a1-0x0;var _0x35f8f8=_0xe599[_0x2f19a1];return _0x35f8f8;};'use strict';var multer=require(_0x9e59('0x0'));var util=require(_0x9e59('0x1'));var path=require(_0x9e59('0x2'));var timeout=require(_0x9e59('0x3'));var express=require(_0x9e59('0x4'));var router=express[_0x9e59('0x5')]();var auth=require(_0x9e59('0x6'));var interaction=require(_0x9e59('0x7'));var config=require(_0x9e59('0x8'));var controller=require('./smsQueueReport.controller');router[_0x9e59('0x9')]('/',auth[_0x9e59('0xa')](),controller['index']);router[_0x9e59('0x9')]('/describe',auth[_0x9e59('0xa')](),controller[_0x9e59('0xb')]);router['get'](_0x9e59('0xc'),auth[_0x9e59('0xa')](),controller[_0x9e59('0xd')]);router[_0x9e59('0xe')]('/',auth[_0x9e59('0xa')](),controller[_0x9e59('0xf')]);router['put'](_0x9e59('0xc'),auth['isAuthenticated'](),controller[_0x9e59('0x10')]);router[_0x9e59('0x11')](_0x9e59('0xc'),auth[_0x9e59('0xa')](),controller['destroy']);module[_0x9e59('0x12')]=router; \ No newline at end of file +var _0xf69d=['get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xf69d,0xd3));var _0xdf69=function(_0x40d763,_0x4821ef){_0x40d763=_0x40d763-0x0;var _0x1e2b70=_0xf69d[_0x40d763];return _0x1e2b70;};'use strict';var multer=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var path=require(_0xdf69('0x2'));var timeout=require(_0xdf69('0x3'));var express=require(_0xdf69('0x4'));var router=express['Router']();var auth=require(_0xdf69('0x5'));var interaction=require(_0xdf69('0x6'));var config=require(_0xdf69('0x7'));var controller=require(_0xdf69('0x8'));router[_0xdf69('0x9')]('/',auth[_0xdf69('0xa')](),controller[_0xdf69('0xb')]);router[_0xdf69('0x9')](_0xdf69('0xc'),auth[_0xdf69('0xa')](),controller[_0xdf69('0xd')]);router[_0xdf69('0x9')](_0xdf69('0xe'),auth[_0xdf69('0xa')](),controller[_0xdf69('0xf')]);router[_0xdf69('0x10')]('/',auth[_0xdf69('0xa')](),controller['create']);router[_0xdf69('0x11')](_0xdf69('0xe'),auth[_0xdf69('0xa')](),controller[_0xdf69('0x12')]);router[_0xdf69('0x13')](_0xdf69('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 47b1d49..6cd08c1 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 _0xaf5e=['exports','STRING','DATE','moment','sequelize'];(function(_0xff5df6,_0x514e73){var _0x2634bb=function(_0x1bb600){while(--_0x1bb600){_0xff5df6['push'](_0xff5df6['shift']());}};_0x2634bb(++_0x514e73);}(_0xaf5e,0xe9));var _0xeaf5=function(_0x3b1bf1,_0x4dfad9){_0x3b1bf1=_0x3b1bf1-0x0;var _0x548a52=_0xaf5e[_0x3b1bf1];return _0x548a52;};'use strict';var moment=require(_0xeaf5('0x0'));var Sequelize=require(_0xeaf5('0x1'));module[_0xeaf5('0x2')]={'uniqueid':{'type':Sequelize[_0xeaf5('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xeaf5('0x3')]},'joinAt':{'type':Sequelize[_0xeaf5('0x4')]},'leaveAt':{'type':Sequelize[_0xeaf5('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xeaf5('0x3')]}}; \ No newline at end of file +var _0x3b8d=['moment','sequelize','exports','STRING','DATE'];(function(_0x20acab,_0x578a23){var _0x5be9d4=function(_0x5f4bc1){while(--_0x5f4bc1){_0x20acab['push'](_0x20acab['shift']());}};_0x5be9d4(++_0x578a23);}(_0x3b8d,0x163));var _0xd3b8=function(_0x5d55dc,_0x20cd20){_0x5d55dc=_0x5d55dc-0x0;var _0x16c9d4=_0x3b8d[_0x5d55dc];return _0x16c9d4;};'use strict';var moment=require(_0xd3b8('0x0'));var Sequelize=require(_0xd3b8('0x1'));module[_0xd3b8('0x2')]={'uniqueid':{'type':Sequelize[_0xd3b8('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd3b8('0x3')]},'joinAt':{'type':Sequelize[_0xd3b8('0x4')]},'leaveAt':{'type':Sequelize[_0xd3b8('0x4')]},'acceptAt':{'type':Sequelize[_0xd3b8('0x4')]},'exitAt':{'type':Sequelize[_0xd3b8('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 122cc68..7a70535 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 _0x1ad9=['error','name','send','index','SmsQueueReport','model','keys','query','attributes','intersection','length','hasOwnProperty','nolimit','limit','sort','filters','pick','filter','merge','where','map','type','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','set','Content-Range','reject','update','destroy','then','sendStatus'];(function(_0x3710a4,_0x411b57){var _0x470675=function(_0x27892d){while(--_0x27892d){_0x3710a4['push'](_0x3710a4['shift']());}};_0x470675(++_0x411b57);}(_0x1ad9,0xba));var _0x91ad=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x1ad9[_0x92c450];return _0x2a9599;};'use strict';var pdf=require(_0x91ad('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x91ad('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x91ad('0x2'));var rp=require(_0x91ad('0x3'));var moment=require(_0x91ad('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91ad('0x5'));var util=require('util');var path=require(_0x91ad('0x6'));var sox=require(_0x91ad('0x7'));var csv=require(_0x91ad('0x8'));var ejs=require(_0x91ad('0x9'));var fs=require('fs');var _=require(_0x91ad('0xa'));var squel=require(_0x91ad('0xb'));var crypto=require(_0x91ad('0xc'));var jsforce=require(_0x91ad('0xd'));var deskjs=require(_0x91ad('0xe'));var toCsv=require('to-csv');var querystring=require(_0x91ad('0xf'));var Papa=require(_0x91ad('0x10'));var authService=require(_0x91ad('0x11'));var hardwareService=require(_0x91ad('0x12'));var Redis=require('ioredis');var qs=require(_0x91ad('0x13'));var logger=require(_0x91ad('0x14'))(_0x91ad('0x15'));var utils=require(_0x91ad('0x16'));var config=require('../../config/environment');var db=require(_0x91ad('0x17'))['db'];function respondWithStatusCode(_0x23906d,_0x324d7a){_0x324d7a=_0x324d7a||0xcc;return function(_0x2d9038){if(_0x2d9038){return _0x23906d['sendStatus'](_0x324d7a);}return _0x23906d[_0x91ad('0x18')](_0x324d7a)[_0x91ad('0x19')]();};}function respondWithResult(_0x581e81,_0x31a47a){_0x31a47a=_0x31a47a||0xc8;return function(_0xd2e4f6){if(_0xd2e4f6){return _0x581e81[_0x91ad('0x18')](_0x31a47a)[_0x91ad('0x1a')](_0xd2e4f6);}};}function respondWithFilteredResult(_0x101214,_0x68e446){return function(_0x40822e){if(_0x40822e){var _0x2f8789=_0x40822e[_0x91ad('0x1b')],_0x5b0205=_0x68e446[_0x91ad('0x1c')],_0x463e4a=_0x68e446[_0x91ad('0x1c')]+_0x68e446['limit'],_0x537197;if(_0x463e4a>=_0x2f8789){_0x463e4a=_0x2f8789;_0x537197=0xc8;}else{_0x537197=0xce;}_0x101214[_0x91ad('0x18')](_0x537197);return _0x101214[_0x91ad('0x1d')](_0x91ad('0x1e'),_0x5b0205+'-'+_0x463e4a+'/'+_0x2f8789)['json'](_0x40822e);}return null;};}function patchUpdates(_0x10605e){return function(_0x94d99e){try{jsonpatch['apply'](_0x94d99e,_0x10605e,!![]);}catch(_0x5ea9d9){return BPromise[_0x91ad('0x1f')](_0x5ea9d9);}return _0x94d99e['save']();};}function saveUpdates(_0x105e8e,_0x5dc9f4){return function(_0x4fa906){if(_0x4fa906){return _0x4fa906[_0x91ad('0x20')](_0x105e8e)['then'](function(_0xc269cb){return _0xc269cb;});}return null;};}function removeEntity(_0x297833,_0x1b1c5f){return function(_0x5b2a0e){if(_0x5b2a0e){return _0x5b2a0e[_0x91ad('0x21')]()[_0x91ad('0x22')](function(){_0x297833[_0x91ad('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x844338,_0x3d8fe6){return function(_0x160d06){if(!_0x160d06){_0x844338[_0x91ad('0x23')](0x194);}return _0x160d06;};}function handleError(_0x9e85dc,_0x1ab871){_0x1ab871=_0x1ab871||0x1f4;return function(_0x5ee7d6){logger[_0x91ad('0x24')](_0x5ee7d6['stack']);if(_0x5ee7d6[_0x91ad('0x25')]){delete _0x5ee7d6['name'];}_0x9e85dc[_0x91ad('0x18')](_0x1ab871)[_0x91ad('0x26')](_0x5ee7d6);};}exports[_0x91ad('0x27')]=function(_0x1de0cb,_0x4bbe5a){var _0x38a4ed={},_0x30e51f={},_0x1fb9d9={'count':0x0,'rows':[]};var _0x301c60=db[_0x91ad('0x28')]['rawAttributes'];_0x30e51f[_0x91ad('0x29')]=_[_0x91ad('0x2a')](_0x301c60);_0x30e51f[_0x91ad('0x2b')]=_[_0x91ad('0x2a')](_0x1de0cb[_0x91ad('0x2b')]);_0x30e51f['filters']=_['intersection'](_0x30e51f['model'],_0x30e51f[_0x91ad('0x2b')]);_0x38a4ed[_0x91ad('0x2c')]=_[_0x91ad('0x2d')](_0x30e51f[_0x91ad('0x29')],qs['fields'](_0x1de0cb[_0x91ad('0x2b')]['fields']));_0x38a4ed[_0x91ad('0x2c')]=_0x38a4ed[_0x91ad('0x2c')][_0x91ad('0x2e')]?_0x38a4ed[_0x91ad('0x2c')]:_0x30e51f['model'];if(!_0x1de0cb[_0x91ad('0x2b')][_0x91ad('0x2f')](_0x91ad('0x30'))){_0x38a4ed[_0x91ad('0x31')]=qs['limit'](_0x1de0cb[_0x91ad('0x2b')][_0x91ad('0x31')]);_0x38a4ed['offset']=qs[_0x91ad('0x1c')](_0x1de0cb[_0x91ad('0x2b')][_0x91ad('0x1c')]);}_0x38a4ed['order']=qs['sort'](_0x1de0cb[_0x91ad('0x2b')][_0x91ad('0x32')]);_0x38a4ed['where']=qs[_0x91ad('0x33')](_[_0x91ad('0x34')](_0x1de0cb['query'],_0x30e51f[_0x91ad('0x33')]));if(_0x1de0cb['query'][_0x91ad('0x35')]){_0x38a4ed['where']=_[_0x91ad('0x36')](_0x38a4ed[_0x91ad('0x37')],{'$or':_[_0x91ad('0x38')](_0x301c60,function(_0x1e36bc){if(_0x1e36bc[_0x91ad('0x39')][_0x91ad('0x3a')]!==_0x91ad('0x3b')){var _0x3a52a7={};_0x3a52a7[_0x1e36bc[_0x91ad('0x3c')]]={'$like':'%'+_0x1de0cb[_0x91ad('0x2b')][_0x91ad('0x35')]+'%'};return _0x3a52a7;}})});}_0x38a4ed=_['merge']({},_0x38a4ed,_0x1de0cb[_0x91ad('0x3d')]);var _0x5040c3={'where':_0x38a4ed[_0x91ad('0x37')]};return db['SmsQueueReport']['count'](_0x5040c3)[_0x91ad('0x22')](function(_0x1cf749){_0x1fb9d9['count']=_0x1cf749;if(_0x1de0cb[_0x91ad('0x2b')][_0x91ad('0x3e')]){_0x38a4ed[_0x91ad('0x3f')]=[{'all':!![]}];}return db[_0x91ad('0x28')][_0x91ad('0x40')](_0x38a4ed);})['then'](function(_0x4f48e0){_0x1fb9d9[_0x91ad('0x41')]=_0x4f48e0;return _0x1fb9d9;})[_0x91ad('0x22')](respondWithFilteredResult(_0x4bbe5a,_0x38a4ed))[_0x91ad('0x42')](handleError(_0x4bbe5a,null));};exports[_0x91ad('0x43')]=function(_0x4f43aa,_0x4599e5){var _0x362518={'raw':!![],'where':{'id':_0x4f43aa[_0x91ad('0x44')]['id']}},_0x379e33={};_0x379e33[_0x91ad('0x29')]=_[_0x91ad('0x2a')](db['SmsQueueReport']['rawAttributes']);_0x379e33[_0x91ad('0x2b')]=_[_0x91ad('0x2a')](_0x4f43aa[_0x91ad('0x2b')]);_0x379e33[_0x91ad('0x33')]=_[_0x91ad('0x2d')](_0x379e33[_0x91ad('0x29')],_0x379e33[_0x91ad('0x2b')]);_0x362518[_0x91ad('0x2c')]=_[_0x91ad('0x2d')](_0x379e33[_0x91ad('0x29')],qs[_0x91ad('0x45')](_0x4f43aa[_0x91ad('0x2b')][_0x91ad('0x45')]));_0x362518['attributes']=_0x362518[_0x91ad('0x2c')][_0x91ad('0x2e')]?_0x362518['attributes']:_0x379e33[_0x91ad('0x29')];if(_0x4f43aa[_0x91ad('0x2b')][_0x91ad('0x3e')]){_0x362518['include']=[{'all':!![]}];}_0x362518=_['merge']({},_0x362518,_0x4f43aa[_0x91ad('0x3d')]);return db[_0x91ad('0x28')][_0x91ad('0x46')](_0x362518)['then'](handleEntityNotFound(_0x4599e5,null))[_0x91ad('0x22')](respondWithResult(_0x4599e5,null))[_0x91ad('0x42')](handleError(_0x4599e5,null));};exports[_0x91ad('0x47')]=function(_0x2866da,_0x14a33f){return db[_0x91ad('0x28')]['create'](_0x2866da[_0x91ad('0x48')],{})[_0x91ad('0x22')](respondWithResult(_0x14a33f,0xc9))[_0x91ad('0x42')](handleError(_0x14a33f,null));};exports[_0x91ad('0x20')]=function(_0xba6d01,_0x17f85a){if(_0xba6d01[_0x91ad('0x48')]['id']){delete _0xba6d01[_0x91ad('0x48')]['id'];}return db[_0x91ad('0x28')]['find']({'where':{'id':_0xba6d01[_0x91ad('0x44')]['id']}})['then'](handleEntityNotFound(_0x17f85a,null))[_0x91ad('0x22')](saveUpdates(_0xba6d01[_0x91ad('0x48')],null))[_0x91ad('0x22')](respondWithResult(_0x17f85a,null))['catch'](handleError(_0x17f85a,null));};exports[_0x91ad('0x21')]=function(_0x225c2e,_0x5b2b7c){return db[_0x91ad('0x28')][_0x91ad('0x46')]({'where':{'id':_0x225c2e[_0x91ad('0x44')]['id']}})[_0x91ad('0x22')](handleEntityNotFound(_0x5b2b7c,null))[_0x91ad('0x22')](removeEntity(_0x5b2b7c,null))[_0x91ad('0x42')](handleError(_0x5b2b7c,null));};exports['describe']=function(_0x397905,_0x28869a){return db[_0x91ad('0x28')][_0x91ad('0x49')]()[_0x91ad('0x22')](respondWithResult(_0x28869a,null))[_0x91ad('0x42')](handleError(_0x28869a,null));}; \ No newline at end of file +var _0xb108=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','destroy','then','error','name','send','rawAttributes','model','keys','query','intersection','fields','attributes','limit','order','sort','where','filters','pick','map','type','key','VIRTUAL','field','filter','merge','options','SmsQueueReport','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','describe','html-pdf','eml-format'];(function(_0x3ecbe2,_0x297d97){var _0x264319=function(_0x503165){while(--_0x503165){_0x3ecbe2['push'](_0x3ecbe2['shift']());}};_0x264319(++_0x297d97);}(_0xb108,0x11e));var _0x8b10=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb108[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x8b10('0x0'));var emlformat=require(_0x8b10('0x1'));var rimraf=require(_0x8b10('0x2'));var zipdir=require(_0x8b10('0x3'));var jsonpatch=require(_0x8b10('0x4'));var rp=require(_0x8b10('0x5'));var moment=require('moment');var BPromise=require(_0x8b10('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8b10('0x7'));var csv=require('to-csv');var ejs=require(_0x8b10('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8b10('0x9'));var jsforce=require(_0x8b10('0xa'));var deskjs=require(_0x8b10('0xb'));var toCsv=require(_0x8b10('0xc'));var querystring=require(_0x8b10('0xd'));var Papa=require(_0x8b10('0xe'));var authService=require(_0x8b10('0xf'));var hardwareService=require(_0x8b10('0x10'));var Redis=require(_0x8b10('0x11'));var qs=require(_0x8b10('0x12'));var logger=require(_0x8b10('0x13'))('api');var utils=require(_0x8b10('0x14'));var config=require('../../config/environment');var db=require(_0x8b10('0x15'))['db'];function respondWithStatusCode(_0x5abe9d,_0x146dc9){_0x146dc9=_0x146dc9||0xcc;return function(_0x299b4c){if(_0x299b4c){return _0x5abe9d[_0x8b10('0x16')](_0x146dc9);}return _0x5abe9d[_0x8b10('0x17')](_0x146dc9)[_0x8b10('0x18')]();};}function respondWithResult(_0x213584,_0x456408){_0x456408=_0x456408||0xc8;return function(_0x34de3d){if(_0x34de3d){return _0x213584[_0x8b10('0x17')](_0x456408)[_0x8b10('0x19')](_0x34de3d);}};}function respondWithFilteredResult(_0x21297b,_0x417b6a){return function(_0x389a45){if(_0x389a45){var _0x502b56=_0x389a45[_0x8b10('0x1a')],_0x3cacec=_0x417b6a[_0x8b10('0x1b')],_0xbb59ca=_0x417b6a['offset']+_0x417b6a['limit'],_0x2334e1;if(_0xbb59ca>=_0x502b56){_0xbb59ca=_0x502b56;_0x2334e1=0xc8;}else{_0x2334e1=0xce;}_0x21297b[_0x8b10('0x17')](_0x2334e1);return _0x21297b[_0x8b10('0x1c')](_0x8b10('0x1d'),_0x3cacec+'-'+_0xbb59ca+'/'+_0x502b56)[_0x8b10('0x19')](_0x389a45);}return null;};}function patchUpdates(_0x42cb98){return function(_0x3625b0){try{jsonpatch[_0x8b10('0x1e')](_0x3625b0,_0x42cb98,!![]);}catch(_0x12bffc){return BPromise[_0x8b10('0x1f')](_0x12bffc);}return _0x3625b0['save']();};}function saveUpdates(_0x3ec18c,_0x2ed39f){return function(_0x291ae9){if(_0x291ae9){return _0x291ae9[_0x8b10('0x20')](_0x3ec18c)['then'](function(_0x36e1d7){return _0x36e1d7;});}return null;};}function removeEntity(_0x403000,_0x1b6a3a){return function(_0x58acec){if(_0x58acec){return _0x58acec[_0x8b10('0x21')]()[_0x8b10('0x22')](function(){_0x403000[_0x8b10('0x17')](0xcc)[_0x8b10('0x18')]();});}};}function handleEntityNotFound(_0xd2d74b,_0x535174){return function(_0x581ac6){if(!_0x581ac6){_0xd2d74b['sendStatus'](0x194);}return _0x581ac6;};}function handleError(_0x1f31a3,_0x1eaa6b){_0x1eaa6b=_0x1eaa6b||0x1f4;return function(_0x4d32c9){logger[_0x8b10('0x23')](_0x4d32c9['stack']);if(_0x4d32c9[_0x8b10('0x24')]){delete _0x4d32c9[_0x8b10('0x24')];}_0x1f31a3['status'](_0x1eaa6b)[_0x8b10('0x25')](_0x4d32c9);};}exports['index']=function(_0x343c06,_0x396764){var _0x2cacd1={},_0x4b2e91={},_0x184922={'count':0x0,'rows':[]};var _0x354a13=db['SmsQueueReport'][_0x8b10('0x26')];_0x4b2e91[_0x8b10('0x27')]=_[_0x8b10('0x28')](_0x354a13);_0x4b2e91[_0x8b10('0x29')]=_[_0x8b10('0x28')](_0x343c06[_0x8b10('0x29')]);_0x4b2e91['filters']=_[_0x8b10('0x2a')](_0x4b2e91[_0x8b10('0x27')],_0x4b2e91['query']);_0x2cacd1['attributes']=_[_0x8b10('0x2a')](_0x4b2e91[_0x8b10('0x27')],qs[_0x8b10('0x2b')](_0x343c06[_0x8b10('0x29')][_0x8b10('0x2b')]));_0x2cacd1[_0x8b10('0x2c')]=_0x2cacd1[_0x8b10('0x2c')]['length']?_0x2cacd1['attributes']:_0x4b2e91[_0x8b10('0x27')];if(!_0x343c06['query']['hasOwnProperty']('nolimit')){_0x2cacd1[_0x8b10('0x2d')]=qs[_0x8b10('0x2d')](_0x343c06[_0x8b10('0x29')][_0x8b10('0x2d')]);_0x2cacd1[_0x8b10('0x1b')]=qs['offset'](_0x343c06[_0x8b10('0x29')][_0x8b10('0x1b')]);}_0x2cacd1[_0x8b10('0x2e')]=qs[_0x8b10('0x2f')](_0x343c06[_0x8b10('0x29')][_0x8b10('0x2f')]);_0x2cacd1[_0x8b10('0x30')]=qs[_0x8b10('0x31')](_[_0x8b10('0x32')](_0x343c06[_0x8b10('0x29')],_0x4b2e91[_0x8b10('0x31')]));if(_0x343c06[_0x8b10('0x29')]['filter']){_0x2cacd1[_0x8b10('0x30')]=_['merge'](_0x2cacd1[_0x8b10('0x30')],{'$or':_[_0x8b10('0x33')](_0x354a13,function(_0x1899c2){if(_0x1899c2[_0x8b10('0x34')][_0x8b10('0x35')]!==_0x8b10('0x36')){var _0x4486e3={};_0x4486e3[_0x1899c2[_0x8b10('0x37')]]={'$like':'%'+_0x343c06[_0x8b10('0x29')][_0x8b10('0x38')]+'%'};return _0x4486e3;}})});}_0x2cacd1=_[_0x8b10('0x39')]({},_0x2cacd1,_0x343c06[_0x8b10('0x3a')]);var _0x2158bd={'where':_0x2cacd1['where']};return db[_0x8b10('0x3b')]['count'](_0x2158bd)[_0x8b10('0x22')](function(_0x3b994){_0x184922['count']=_0x3b994;if(_0x343c06[_0x8b10('0x29')][_0x8b10('0x3c')]){_0x2cacd1[_0x8b10('0x3d')]=[{'all':!![]}];}return db[_0x8b10('0x3b')][_0x8b10('0x3e')](_0x2cacd1);})[_0x8b10('0x22')](function(_0x28b86e){_0x184922[_0x8b10('0x3f')]=_0x28b86e;return _0x184922;})[_0x8b10('0x22')](respondWithFilteredResult(_0x396764,_0x2cacd1))['catch'](handleError(_0x396764,null));};exports[_0x8b10('0x40')]=function(_0x14fca4,_0x5a3111){var _0x5e46ec={'raw':!![],'where':{'id':_0x14fca4[_0x8b10('0x41')]['id']}},_0x49b4b7={};_0x49b4b7[_0x8b10('0x27')]=_['keys'](db[_0x8b10('0x3b')][_0x8b10('0x26')]);_0x49b4b7[_0x8b10('0x29')]=_[_0x8b10('0x28')](_0x14fca4[_0x8b10('0x29')]);_0x49b4b7[_0x8b10('0x31')]=_[_0x8b10('0x2a')](_0x49b4b7[_0x8b10('0x27')],_0x49b4b7[_0x8b10('0x29')]);_0x5e46ec['attributes']=_['intersection'](_0x49b4b7[_0x8b10('0x27')],qs['fields'](_0x14fca4['query']['fields']));_0x5e46ec[_0x8b10('0x2c')]=_0x5e46ec[_0x8b10('0x2c')][_0x8b10('0x42')]?_0x5e46ec['attributes']:_0x49b4b7[_0x8b10('0x27')];if(_0x14fca4[_0x8b10('0x29')]['includeAll']){_0x5e46ec[_0x8b10('0x3d')]=[{'all':!![]}];}_0x5e46ec=_['merge']({},_0x5e46ec,_0x14fca4[_0x8b10('0x3a')]);return db[_0x8b10('0x3b')][_0x8b10('0x43')](_0x5e46ec)[_0x8b10('0x22')](handleEntityNotFound(_0x5a3111,null))[_0x8b10('0x22')](respondWithResult(_0x5a3111,null))[_0x8b10('0x44')](handleError(_0x5a3111,null));};exports[_0x8b10('0x45')]=function(_0x70a03e,_0x40568e){return db[_0x8b10('0x3b')]['create'](_0x70a03e['body'],{})[_0x8b10('0x22')](respondWithResult(_0x40568e,0xc9))[_0x8b10('0x44')](handleError(_0x40568e,null));};exports[_0x8b10('0x20')]=function(_0x2e1a9a,_0x3e2fd9){if(_0x2e1a9a[_0x8b10('0x46')]['id']){delete _0x2e1a9a['body']['id'];}return db[_0x8b10('0x3b')][_0x8b10('0x43')]({'where':{'id':_0x2e1a9a[_0x8b10('0x41')]['id']}})[_0x8b10('0x22')](handleEntityNotFound(_0x3e2fd9,null))[_0x8b10('0x22')](saveUpdates(_0x2e1a9a[_0x8b10('0x46')],null))[_0x8b10('0x22')](respondWithResult(_0x3e2fd9,null))['catch'](handleError(_0x3e2fd9,null));};exports[_0x8b10('0x21')]=function(_0xef6c33,_0x153c9f){return db[_0x8b10('0x3b')]['find']({'where':{'id':_0xef6c33[_0x8b10('0x41')]['id']}})[_0x8b10('0x22')](handleEntityNotFound(_0x153c9f,null))['then'](removeEntity(_0x153c9f,null))[_0x8b10('0x44')](handleError(_0x153c9f,null));};exports[_0x8b10('0x47')]=function(_0x27cc42,_0x4b2182){return db[_0x8b10('0x3b')][_0x8b10('0x47')]()['then'](respondWithResult(_0x4b2182,null))['catch'](handleError(_0x4b2182,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 308bf39..c95ad09 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 _0xc8e5=['request-promise','exports','define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','bluebird'];(function(_0x402fb1,_0x35b49f){var _0x80d8cc=function(_0x1acb25){while(--_0x1acb25){_0x402fb1['push'](_0x402fb1['shift']());}};_0x80d8cc(++_0x35b49f);}(_0xc8e5,0xf6));var _0x5c8e=function(_0x4a88d0,_0x2c784a){_0x4a88d0=_0x4a88d0-0x0;var _0x718392=_0xc8e5[_0x4a88d0];return _0x718392;};'use strict';var _=require('lodash');var util=require(_0x5c8e('0x0'));var logger=require(_0x5c8e('0x1'))(_0x5c8e('0x2'));var moment=require('moment');var BPromise=require(_0x5c8e('0x3'));var rp=require(_0x5c8e('0x4'));var attributes=require('./smsQueueReport.attributes');module[_0x5c8e('0x5')]=function(_0x1f225a,_0x168f11){return _0x1f225a[_0x5c8e('0x6')](_0x5c8e('0x7'),attributes,{'tableName':_0x5c8e('0x8'),'paranoid':![],'indexes':[{'name':_0x5c8e('0x9'),'fields':[_0x5c8e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xab30=['define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util','moment','bluebird','request-promise'];(function(_0x21ecd5,_0x21285b){var _0x218daf=function(_0x142bd8){while(--_0x142bd8){_0x21ecd5['push'](_0x21ecd5['shift']());}};_0x218daf(++_0x21285b);}(_0xab30,0x15a));var _0x0ab3=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xab30[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0x0ab3('0x0'));var util=require(_0x0ab3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0ab3('0x2'));var BPromise=require(_0x0ab3('0x3'));var rp=require(_0x0ab3('0x4'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x120225,_0x37ec2e){return _0x120225[_0x0ab3('0x5')](_0x0ab3('0x6'),attributes,{'tableName':_0x0ab3('0x7'),'paranoid':![],'indexes':[{'name':_0x0ab3('0x8'),'fields':[_0x0ab3('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index b06d5c5..abebb5d 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 _0x040a=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','create','body','options','UpdateSmsQueueReport','update','raw','where','info','lodash'];(function(_0x582138,_0x1e84f6){var _0x159fdf=function(_0x1c6a38){while(--_0x1c6a38){_0x582138['push'](_0x582138['shift']());}};_0x159fdf(++_0x1e84f6);}(_0x040a,0x95));var _0xa040=function(_0x513f27,_0x1cbc87){_0x513f27=_0x513f27-0x0;var _0xa316b7=_0x040a[_0x513f27];return _0xa316b7;};'use strict';var _=require(_0xa040('0x0'));var util=require(_0xa040('0x1'));var moment=require('moment');var BPromise=require(_0xa040('0x2'));var rs=require(_0xa040('0x3'));var fs=require('fs');var Redis=require(_0xa040('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa040('0x5'));var logger=require(_0xa040('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa040('0x7'));var client=jayson[_0xa040('0x8')][_0xa040('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x127592,_0x432545,_0x232662){return new BPromise(function(_0x5b29f1,_0x4278eb){return client[_0xa040('0xa')](_0x127592,_0x232662)[_0xa040('0xb')](function(_0x385da8){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x432545,_0xa040('0xc'));logger[_0xa040('0xd')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x432545,_0xa040('0xc'),JSON[_0xa040('0xe')](_0x385da8));if(_0x385da8[_0xa040('0xf')]){if(_0x385da8[_0xa040('0xf')][_0xa040('0x10')]===0x1f4){logger[_0xa040('0xf')](_0xa040('0x11'),_0x432545,_0x385da8[_0xa040('0xf')][_0xa040('0x12')]);return _0x4278eb(_0x385da8[_0xa040('0xf')][_0xa040('0x12')]);}logger[_0xa040('0xf')](_0xa040('0x11'),_0x432545,_0x385da8['error'][_0xa040('0x12')]);return _0x5b29f1(_0x385da8[_0xa040('0xf')][_0xa040('0x12')]);}else{logger['info'](_0xa040('0x11'),_0x432545,_0xa040('0xc'));_0x5b29f1(_0x385da8[_0xa040('0x13')]['message']);}})[_0xa040('0x14')](function(_0x5cbcab){logger[_0xa040('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x432545,_0x5cbcab);_0x4278eb(_0x5cbcab);});});}exports[_0xa040('0x15')]=function(_0x7b313f){var _0x4151c9=this;return new Promise(function(_0x25e845,_0x5e7f66){return db['SmsQueueReport'][_0xa040('0x16')](_0x7b313f[_0xa040('0x17')],{'raw':_0x7b313f['options']?_0x7b313f[_0xa040('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xa040('0xb')](function(_0x40d7e9){logger['info'](_0xa040('0x15'),_0x7b313f);logger['debug']('CreateSmsQueueReport',_0x7b313f,JSON[_0xa040('0xe')](_0x40d7e9));_0x25e845(_0x40d7e9);})[_0xa040('0x14')](function(_0x2c14a0){logger['error'](_0xa040('0x15'),_0x2c14a0[_0xa040('0x12')],_0x7b313f);_0x5e7f66(_0x4151c9[_0xa040('0xf')](0x1f4,_0x2c14a0[_0xa040('0x12')]));});});};exports[_0xa040('0x19')]=function(_0x5f16df){var _0x1aa8a5=this;return new Promise(function(_0x1eeffa,_0x3950d7){return db['SmsQueueReport'][_0xa040('0x1a')](_0x5f16df[_0xa040('0x17')],{'raw':_0x5f16df[_0xa040('0x18')]?_0x5f16df[_0xa040('0x18')][_0xa040('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f16df[_0xa040('0x18')]?_0x5f16df[_0xa040('0x18')][_0xa040('0x1c')]||null:null,'attributes':_0x5f16df[_0xa040('0x18')]?_0x5f16df['options']['attributes']||null:null,'limit':_0x5f16df[_0xa040('0x18')]?_0x5f16df[_0xa040('0x18')]['limit']||null:null})[_0xa040('0xb')](function(_0x184cba){logger[_0xa040('0x1d')]('UpdateSmsQueueReport',_0x5f16df);logger[_0xa040('0xd')](_0xa040('0x19'),_0x5f16df,JSON[_0xa040('0xe')](_0x184cba));_0x1eeffa(_0x184cba);})[_0xa040('0x14')](function(_0x281bf3){logger[_0xa040('0xf')]('UpdateSmsQueueReport',_0x281bf3['message'],_0x5f16df);_0x3950d7(_0x1aa8a5[_0xa040('0xf')](0x1f4,_0x281bf3[_0xa040('0x12')]));});});}; \ No newline at end of file +var _0x73be=['error','code','message','result','catch','SmsQueueReport','create','body','options','raw','then','CreateSmsQueueReport','UpdateSmsQueueReport','update','attributes','limit','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1920a4,_0x1a2bd3){var _0x1e15fb=function(_0x154757){while(--_0x154757){_0x1920a4['push'](_0x1920a4['shift']());}};_0x1e15fb(++_0x1a2bd3);}(_0x73be,0x170));var _0xe73b=function(_0x3b233f,_0x4d6504){_0x3b233f=_0x3b233f-0x0;var _0xb2fa6=_0x73be[_0x3b233f];return _0xb2fa6;};'use strict';var _=require(_0xe73b('0x0'));var util=require(_0xe73b('0x1'));var moment=require('moment');var BPromise=require(_0xe73b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe73b('0x3'))['db'];var utils=require(_0xe73b('0x4'));var logger=require('../../config/logger')(_0xe73b('0x5'));var config=require(_0xe73b('0x6'));var jayson=require(_0xe73b('0x7'));var client=jayson[_0xe73b('0x8')][_0xe73b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2593d6,_0x17f81a,_0x2fb111){return new BPromise(function(_0x5454b2,_0x471c11){return client['request'](_0x2593d6,_0x2fb111)['then'](function(_0x35fc46){logger[_0xe73b('0xa')](_0xe73b('0xb'),_0x17f81a,_0xe73b('0xc'));logger[_0xe73b('0xd')](_0xe73b('0xe'),_0x17f81a,_0xe73b('0xc'),JSON[_0xe73b('0xf')](_0x35fc46));if(_0x35fc46['error']){if(_0x35fc46[_0xe73b('0x10')][_0xe73b('0x11')]===0x1f4){logger[_0xe73b('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x17f81a,_0x35fc46['error'][_0xe73b('0x12')]);return _0x471c11(_0x35fc46['error'][_0xe73b('0x12')]);}logger[_0xe73b('0x10')](_0xe73b('0xb'),_0x17f81a,_0x35fc46[_0xe73b('0x10')]['message']);return _0x5454b2(_0x35fc46[_0xe73b('0x10')][_0xe73b('0x12')]);}else{logger[_0xe73b('0xa')](_0xe73b('0xb'),_0x17f81a,_0xe73b('0xc'));_0x5454b2(_0x35fc46[_0xe73b('0x13')][_0xe73b('0x12')]);}})[_0xe73b('0x14')](function(_0x3707d5){logger[_0xe73b('0x10')](_0xe73b('0xb'),_0x17f81a,_0x3707d5);_0x471c11(_0x3707d5);});});}exports['CreateSmsQueueReport']=function(_0x2b8e95){var _0x472f33=this;return new Promise(function(_0x538f98,_0x19865f){return db[_0xe73b('0x15')][_0xe73b('0x16')](_0x2b8e95[_0xe73b('0x17')],{'raw':_0x2b8e95[_0xe73b('0x18')]?_0x2b8e95['options'][_0xe73b('0x19')]===undefined?!![]:![]:!![]})[_0xe73b('0x1a')](function(_0x20b076){logger[_0xe73b('0xa')](_0xe73b('0x1b'),_0x2b8e95);logger[_0xe73b('0xd')](_0xe73b('0x1b'),_0x2b8e95,JSON['stringify'](_0x20b076));_0x538f98(_0x20b076);})[_0xe73b('0x14')](function(_0x31ebeb){logger[_0xe73b('0x10')](_0xe73b('0x1b'),_0x31ebeb[_0xe73b('0x12')],_0x2b8e95);_0x19865f(_0x472f33[_0xe73b('0x10')](0x1f4,_0x31ebeb['message']));});});};exports[_0xe73b('0x1c')]=function(_0x3bddd9){var _0x5931b4=this;return new Promise(function(_0x4ff8a9,_0x3ee72d){return db[_0xe73b('0x15')][_0xe73b('0x1d')](_0x3bddd9[_0xe73b('0x17')],{'raw':_0x3bddd9[_0xe73b('0x18')]?_0x3bddd9[_0xe73b('0x18')][_0xe73b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bddd9[_0xe73b('0x18')]?_0x3bddd9[_0xe73b('0x18')]['where']||null:null,'attributes':_0x3bddd9[_0xe73b('0x18')]?_0x3bddd9[_0xe73b('0x18')][_0xe73b('0x1e')]||null:null,'limit':_0x3bddd9[_0xe73b('0x18')]?_0x3bddd9['options'][_0xe73b('0x1f')]||null:null})[_0xe73b('0x1a')](function(_0x1cc896){logger[_0xe73b('0xa')]('UpdateSmsQueueReport',_0x3bddd9);logger['debug'](_0xe73b('0x1c'),_0x3bddd9,JSON['stringify'](_0x1cc896));_0x4ff8a9(_0x1cc896);})['catch'](function(_0x53f0d5){logger[_0xe73b('0x10')](_0xe73b('0x1c'),_0x53f0d5['message'],_0x3bddd9);_0x3ee72d(_0x5931b4[_0xe73b('0x10')](0x1f4,_0x53f0d5[_0xe73b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index b4b4f98..1b7d31a 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 _0xac14=['show','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x5002b1,_0x21f0bd){var _0x1dceb0=function(_0x3cf655){while(--_0x3cf655){_0x5002b1['push'](_0x5002b1['shift']());}};_0x1dceb0(++_0x21f0bd);}(_0xac14,0x15a));var _0x4ac1=function(_0xc8cbc4,_0x59ff82){_0xc8cbc4=_0xc8cbc4-0x0;var _0x422b17=_0xac14[_0xc8cbc4];return _0x422b17;};'use strict';var multer=require(_0x4ac1('0x0'));var util=require(_0x4ac1('0x1'));var path=require(_0x4ac1('0x2'));var timeout=require(_0x4ac1('0x3'));var express=require(_0x4ac1('0x4'));var router=express[_0x4ac1('0x5')]();var auth=require(_0x4ac1('0x6'));var interaction=require(_0x4ac1('0x7'));var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router[_0x4ac1('0x8')]('/',auth[_0x4ac1('0x9')](),controller[_0x4ac1('0xa')]);router['get'](_0x4ac1('0xb'),auth[_0x4ac1('0x9')](),controller[_0x4ac1('0xc')]);router[_0x4ac1('0x8')](_0x4ac1('0xd'),auth['isAuthenticated'](),controller[_0x4ac1('0xe')]);router['post']('/',auth[_0x4ac1('0x9')](),controller['create']);router['put'](_0x4ac1('0xd'),auth['isAuthenticated'](),controller[_0x4ac1('0xf')]);router['delete'](_0x4ac1('0xd'),auth[_0x4ac1('0x9')](),controller[_0x4ac1('0x10')]);module[_0x4ac1('0x11')]=router; \ No newline at end of file +var _0xf798=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','create','exports','multer','util','connect-timeout','express'];(function(_0x237da8,_0x37b77a){var _0x558825=function(_0x45d7f1){while(--_0x45d7f1){_0x237da8['push'](_0x237da8['shift']());}};_0x558825(++_0x37b77a);}(_0xf798,0xd9));var _0x8f79=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xf798[_0x5ddaac];return _0x2a9c58;};'use strict';var multer=require(_0x8f79('0x0'));var util=require(_0x8f79('0x1'));var path=require('path');var timeout=require(_0x8f79('0x2'));var express=require(_0x8f79('0x3'));var router=express[_0x8f79('0x4')]();var auth=require(_0x8f79('0x5'));var interaction=require(_0x8f79('0x6'));var config=require(_0x8f79('0x7'));var controller=require(_0x8f79('0x8'));router['get']('/',auth[_0x8f79('0x9')](),controller[_0x8f79('0xa')]);router[_0x8f79('0xb')](_0x8f79('0xc'),auth[_0x8f79('0x9')](),controller[_0x8f79('0xd')]);router['get'](_0x8f79('0xe'),auth[_0x8f79('0x9')](),controller['show']);router['post']('/',auth[_0x8f79('0x9')](),controller[_0x8f79('0xf')]);router['put'](_0x8f79('0xe'),auth[_0x8f79('0x9')](),controller['update']);router['delete'](_0x8f79('0xe'),auth[_0x8f79('0x9')](),controller['destroy']);module[_0x8f79('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 f0d4777..a095aa9 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 _0x5dea=['exports','STRING','account','agent','queue','DATE','NOW','moment','sequelize'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5dea,0x73));var _0xa5de=function(_0x282a70,_0x38c07f){_0x282a70=_0x282a70-0x0;var _0x5139eb=_0x5dea[_0x282a70];return _0x5139eb;};'use strict';var moment=require(_0xa5de('0x0'));var Sequelize=require(_0xa5de('0x1'));module[_0xa5de('0x2')]={'uniqueid':{'type':Sequelize[_0xa5de('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa5de('0x4'),_0xa5de('0x5'),_0xa5de('0x6')),'allowNull':![],'defaultValue':_0xa5de('0x6')},'transferredAt':{'type':Sequelize[_0xa5de('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xa5de('0x8')]}}; \ No newline at end of file +var _0xc7cf=['agent','queue','DATE','NOW','moment','sequelize','STRING','account'];(function(_0x6b595b,_0x415006){var _0x39d43e=function(_0xe387b){while(--_0xe387b){_0x6b595b['push'](_0x6b595b['shift']());}};_0x39d43e(++_0x415006);}(_0xc7cf,0x17c));var _0xfc7c=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xc7cf[_0x4e1d03];return _0x362d4b;};'use strict';var moment=require(_0xfc7c('0x0'));var Sequelize=require(_0xfc7c('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xfc7c('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xfc7c('0x3'),_0xfc7c('0x4'),_0xfc7c('0x5')),'allowNull':![],'defaultValue':_0xfc7c('0x5')},'transferredAt':{'type':Sequelize[_0xfc7c('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xfc7c('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 5acf0ec..7dc76e2 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 _0x3078=['to-csv','ejs','lodash','jsforce','desk.js','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','api','../../config/utils','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','end','sendStatus','error','name','send','index','SmsTransferReport','rawAttributes','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','type','key','field','options','includeAll','include','findAll','rows','show','params','find','create','catch','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0xea7813,_0x371dc2){var _0x5cff8e=function(_0x30d2cd){while(--_0x30d2cd){_0xea7813['push'](_0xea7813['shift']());}};_0x5cff8e(++_0x371dc2);}(_0x3078,0x124));var _0x8307=function(_0x3c504b,_0x437693){_0x3c504b=_0x3c504b-0x0;var _0x2e5354=_0x3078[_0x3c504b];return _0x2e5354;};'use strict';var pdf=require(_0x8307('0x0'));var emlformat=require(_0x8307('0x1'));var rimraf=require(_0x8307('0x2'));var zipdir=require(_0x8307('0x3'));var jsonpatch=require(_0x8307('0x4'));var rp=require(_0x8307('0x5'));var moment=require(_0x8307('0x6'));var BPromise=require(_0x8307('0x7'));var Mustache=require(_0x8307('0x8'));var util=require(_0x8307('0x9'));var path=require(_0x8307('0xa'));var sox=require(_0x8307('0xb'));var csv=require(_0x8307('0xc'));var ejs=require(_0x8307('0xd'));var fs=require('fs');var _=require(_0x8307('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8307('0xf'));var deskjs=require(_0x8307('0x10'));var toCsv=require(_0x8307('0xc'));var querystring=require('querystring');var Papa=require(_0x8307('0x11'));var authService=require(_0x8307('0x12'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x8307('0x13'));var qs=require(_0x8307('0x14'));var logger=require('../../config/logger')(_0x8307('0x15'));var utils=require(_0x8307('0x16'));var config=require('../../config/environment');var db=require(_0x8307('0x17'))['db'];function respondWithStatusCode(_0x277bad,_0x2ac909){_0x2ac909=_0x2ac909||0xcc;return function(_0x478713){if(_0x478713){return _0x277bad['sendStatus'](_0x2ac909);}return _0x277bad['status'](_0x2ac909)['end']();};}function respondWithResult(_0x57c201,_0x39269e){_0x39269e=_0x39269e||0xc8;return function(_0x33e513){if(_0x33e513){return _0x57c201[_0x8307('0x18')](_0x39269e)[_0x8307('0x19')](_0x33e513);}};}function respondWithFilteredResult(_0x462022,_0x9e0318){return function(_0x5762b2){if(_0x5762b2){var _0x21b7cc=_0x5762b2[_0x8307('0x1a')],_0x1e2aa8=_0x9e0318[_0x8307('0x1b')],_0x31811a=_0x9e0318[_0x8307('0x1b')]+_0x9e0318[_0x8307('0x1c')],_0x32e233;if(_0x31811a>=_0x21b7cc){_0x31811a=_0x21b7cc;_0x32e233=0xc8;}else{_0x32e233=0xce;}_0x462022[_0x8307('0x18')](_0x32e233);return _0x462022[_0x8307('0x1d')](_0x8307('0x1e'),_0x1e2aa8+'-'+_0x31811a+'/'+_0x21b7cc)[_0x8307('0x19')](_0x5762b2);}return null;};}function patchUpdates(_0x3a971f){return function(_0x32e636){try{jsonpatch[_0x8307('0x1f')](_0x32e636,_0x3a971f,!![]);}catch(_0x2df550){return BPromise['reject'](_0x2df550);}return _0x32e636[_0x8307('0x20')]();};}function saveUpdates(_0x1619a9,_0x3f0900){return function(_0x2d38f8){if(_0x2d38f8){return _0x2d38f8[_0x8307('0x21')](_0x1619a9)['then'](function(_0x3571d1){return _0x3571d1;});}return null;};}function removeEntity(_0x59b8e8,_0x2f503a){return function(_0x5d81c6){if(_0x5d81c6){return _0x5d81c6[_0x8307('0x22')]()[_0x8307('0x23')](function(){_0x59b8e8[_0x8307('0x18')](0xcc)[_0x8307('0x24')]();});}};}function handleEntityNotFound(_0x5e3b47,_0x4fe2b8){return function(_0xc009b3){if(!_0xc009b3){_0x5e3b47[_0x8307('0x25')](0x194);}return _0xc009b3;};}function handleError(_0x18afdc,_0xba01c8){_0xba01c8=_0xba01c8||0x1f4;return function(_0xdc95ef){logger[_0x8307('0x26')](_0xdc95ef['stack']);if(_0xdc95ef[_0x8307('0x27')]){delete _0xdc95ef[_0x8307('0x27')];}_0x18afdc[_0x8307('0x18')](_0xba01c8)[_0x8307('0x28')](_0xdc95ef);};}exports[_0x8307('0x29')]=function(_0x2b569f,_0x5ab752){var _0x14e2ef={},_0x46bd48={},_0x5922fb={'count':0x0,'rows':[]};var _0x1f5afc=db[_0x8307('0x2a')][_0x8307('0x2b')];_0x46bd48['model']=_[_0x8307('0x2c')](_0x1f5afc);_0x46bd48[_0x8307('0x2d')]=_['keys'](_0x2b569f[_0x8307('0x2d')]);_0x46bd48['filters']=_['intersection'](_0x46bd48[_0x8307('0x2e')],_0x46bd48[_0x8307('0x2d')]);_0x14e2ef[_0x8307('0x2f')]=_[_0x8307('0x30')](_0x46bd48[_0x8307('0x2e')],qs[_0x8307('0x31')](_0x2b569f[_0x8307('0x2d')][_0x8307('0x31')]));_0x14e2ef[_0x8307('0x2f')]=_0x14e2ef[_0x8307('0x2f')][_0x8307('0x32')]?_0x14e2ef[_0x8307('0x2f')]:_0x46bd48[_0x8307('0x2e')];if(!_0x2b569f['query'][_0x8307('0x33')](_0x8307('0x34'))){_0x14e2ef[_0x8307('0x1c')]=qs[_0x8307('0x1c')](_0x2b569f[_0x8307('0x2d')]['limit']);_0x14e2ef[_0x8307('0x1b')]=qs[_0x8307('0x1b')](_0x2b569f[_0x8307('0x2d')][_0x8307('0x1b')]);}_0x14e2ef[_0x8307('0x35')]=qs[_0x8307('0x36')](_0x2b569f[_0x8307('0x2d')][_0x8307('0x36')]);_0x14e2ef[_0x8307('0x37')]=qs[_0x8307('0x38')](_[_0x8307('0x39')](_0x2b569f[_0x8307('0x2d')],_0x46bd48['filters']));if(_0x2b569f[_0x8307('0x2d')][_0x8307('0x3a')]){_0x14e2ef[_0x8307('0x37')]=_[_0x8307('0x3b')](_0x14e2ef[_0x8307('0x37')],{'$or':_[_0x8307('0x3c')](_0x1f5afc,function(_0x2be19b){if(_0x2be19b[_0x8307('0x3d')][_0x8307('0x3e')]!=='VIRTUAL'){var _0x2aa0e3={};_0x2aa0e3[_0x2be19b[_0x8307('0x3f')]]={'$like':'%'+_0x2b569f[_0x8307('0x2d')][_0x8307('0x3a')]+'%'};return _0x2aa0e3;}})});}_0x14e2ef=_[_0x8307('0x3b')]({},_0x14e2ef,_0x2b569f[_0x8307('0x40')]);var _0x4233e6={'where':_0x14e2ef[_0x8307('0x37')]};return db[_0x8307('0x2a')][_0x8307('0x1a')](_0x4233e6)[_0x8307('0x23')](function(_0x18274d){_0x5922fb[_0x8307('0x1a')]=_0x18274d;if(_0x2b569f['query'][_0x8307('0x41')]){_0x14e2ef[_0x8307('0x42')]=[{'all':!![]}];}return db[_0x8307('0x2a')][_0x8307('0x43')](_0x14e2ef);})[_0x8307('0x23')](function(_0x1b9dba){_0x5922fb[_0x8307('0x44')]=_0x1b9dba;return _0x5922fb;})[_0x8307('0x23')](respondWithFilteredResult(_0x5ab752,_0x14e2ef))['catch'](handleError(_0x5ab752,null));};exports[_0x8307('0x45')]=function(_0x629400,_0x428c2a){var _0x12574c={'raw':!![],'where':{'id':_0x629400[_0x8307('0x46')]['id']}},_0x8c678d={};_0x8c678d[_0x8307('0x2e')]=_[_0x8307('0x2c')](db['SmsTransferReport'][_0x8307('0x2b')]);_0x8c678d['query']=_[_0x8307('0x2c')](_0x629400[_0x8307('0x2d')]);_0x8c678d[_0x8307('0x38')]=_[_0x8307('0x30')](_0x8c678d[_0x8307('0x2e')],_0x8c678d[_0x8307('0x2d')]);_0x12574c[_0x8307('0x2f')]=_[_0x8307('0x30')](_0x8c678d[_0x8307('0x2e')],qs[_0x8307('0x31')](_0x629400[_0x8307('0x2d')][_0x8307('0x31')]));_0x12574c[_0x8307('0x2f')]=_0x12574c[_0x8307('0x2f')][_0x8307('0x32')]?_0x12574c[_0x8307('0x2f')]:_0x8c678d[_0x8307('0x2e')];if(_0x629400[_0x8307('0x2d')][_0x8307('0x41')]){_0x12574c['include']=[{'all':!![]}];}_0x12574c=_[_0x8307('0x3b')]({},_0x12574c,_0x629400['options']);return db[_0x8307('0x2a')][_0x8307('0x47')](_0x12574c)[_0x8307('0x23')](handleEntityNotFound(_0x428c2a,null))['then'](respondWithResult(_0x428c2a,null))['catch'](handleError(_0x428c2a,null));};exports[_0x8307('0x48')]=function(_0x287bf9,_0x30a6e8){return db['SmsTransferReport']['create'](_0x287bf9['body'],{})[_0x8307('0x23')](respondWithResult(_0x30a6e8,0xc9))[_0x8307('0x49')](handleError(_0x30a6e8,null));};exports[_0x8307('0x21')]=function(_0x3beaf3,_0x5e1e4f){if(_0x3beaf3['body']['id']){delete _0x3beaf3[_0x8307('0x4a')]['id'];}return db[_0x8307('0x2a')][_0x8307('0x47')]({'where':{'id':_0x3beaf3['params']['id']}})['then'](handleEntityNotFound(_0x5e1e4f,null))['then'](saveUpdates(_0x3beaf3[_0x8307('0x4a')],null))[_0x8307('0x23')](respondWithResult(_0x5e1e4f,null))[_0x8307('0x49')](handleError(_0x5e1e4f,null));};exports[_0x8307('0x22')]=function(_0x1c04f7,_0x41ed2d){return db['SmsTransferReport'][_0x8307('0x47')]({'where':{'id':_0x1c04f7['params']['id']}})[_0x8307('0x23')](handleEntityNotFound(_0x41ed2d,null))[_0x8307('0x23')](removeEntity(_0x41ed2d,null))[_0x8307('0x49')](handleError(_0x41ed2d,null));};exports[_0x8307('0x4b')]=function(_0x283ad8,_0x511206){return db['SmsTransferReport']['describe']()[_0x8307('0x23')](respondWithResult(_0x511206,null))[_0x8307('0x49')](handleError(_0x511206,null));}; \ No newline at end of file +var _0x9b15=['catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','send','index','SmsTransferReport','rawAttributes','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','merge','map','type','key','VIRTUAL','field','filter','includeAll','include'];(function(_0x1d2f1d,_0x449946){var _0xc52508=function(_0x3cc368){while(--_0x3cc368){_0x1d2f1d['push'](_0x1d2f1d['shift']());}};_0xc52508(++_0x449946);}(_0x9b15,0x92));var _0x59b1=function(_0x51891a,_0x45b9fe){_0x51891a=_0x51891a-0x0;var _0x45cd28=_0x9b15[_0x51891a];return _0x45cd28;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x59b1('0x0'));var rimraf=require(_0x59b1('0x1'));var zipdir=require(_0x59b1('0x2'));var jsonpatch=require(_0x59b1('0x3'));var rp=require(_0x59b1('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x59b1('0x5'));var util=require(_0x59b1('0x6'));var path=require(_0x59b1('0x7'));var sox=require(_0x59b1('0x8'));var csv=require(_0x59b1('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x59b1('0xa'));var squel=require(_0x59b1('0xb'));var crypto=require(_0x59b1('0xc'));var jsforce=require(_0x59b1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x59b1('0x9'));var querystring=require(_0x59b1('0xe'));var Papa=require(_0x59b1('0xf'));var authService=require(_0x59b1('0x10'));var hardwareService=require(_0x59b1('0x11'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x59b1('0x12'))(_0x59b1('0x13'));var utils=require(_0x59b1('0x14'));var config=require(_0x59b1('0x15'));var db=require(_0x59b1('0x16'))['db'];function respondWithStatusCode(_0x2ba7ff,_0x519395){_0x519395=_0x519395||0xcc;return function(_0x4d85db){if(_0x4d85db){return _0x2ba7ff[_0x59b1('0x17')](_0x519395);}return _0x2ba7ff[_0x59b1('0x18')](_0x519395)[_0x59b1('0x19')]();};}function respondWithResult(_0x427786,_0x19534f){_0x19534f=_0x19534f||0xc8;return function(_0x589c9d){if(_0x589c9d){return _0x427786[_0x59b1('0x18')](_0x19534f)[_0x59b1('0x1a')](_0x589c9d);}};}function respondWithFilteredResult(_0x511f99,_0x4898d3){return function(_0x4101e2){if(_0x4101e2){var _0x4f18a6=_0x4101e2[_0x59b1('0x1b')],_0x3d11a3=_0x4898d3[_0x59b1('0x1c')],_0x487c69=_0x4898d3[_0x59b1('0x1c')]+_0x4898d3[_0x59b1('0x1d')],_0x1ed5cf;if(_0x487c69>=_0x4f18a6){_0x487c69=_0x4f18a6;_0x1ed5cf=0xc8;}else{_0x1ed5cf=0xce;}_0x511f99[_0x59b1('0x18')](_0x1ed5cf);return _0x511f99[_0x59b1('0x1e')](_0x59b1('0x1f'),_0x3d11a3+'-'+_0x487c69+'/'+_0x4f18a6)[_0x59b1('0x1a')](_0x4101e2);}return null;};}function patchUpdates(_0x5b14aa){return function(_0x33cd00){try{jsonpatch[_0x59b1('0x20')](_0x33cd00,_0x5b14aa,!![]);}catch(_0x128df8){return BPromise[_0x59b1('0x21')](_0x128df8);}return _0x33cd00[_0x59b1('0x22')]();};}function saveUpdates(_0x17181c,_0xd180a5){return function(_0x238aca){if(_0x238aca){return _0x238aca[_0x59b1('0x23')](_0x17181c)['then'](function(_0x1fb0a8){return _0x1fb0a8;});}return null;};}function removeEntity(_0x2d0ec3,_0x17bea9){return function(_0x1ea7ae){if(_0x1ea7ae){return _0x1ea7ae[_0x59b1('0x24')]()[_0x59b1('0x25')](function(){_0x2d0ec3[_0x59b1('0x18')](0xcc)[_0x59b1('0x19')]();});}};}function handleEntityNotFound(_0x45e665,_0x380b51){return function(_0x49f99c){if(!_0x49f99c){_0x45e665[_0x59b1('0x17')](0x194);}return _0x49f99c;};}function handleError(_0x49507a,_0xb4dee0){_0xb4dee0=_0xb4dee0||0x1f4;return function(_0x116b3b){logger[_0x59b1('0x26')](_0x116b3b[_0x59b1('0x27')]);if(_0x116b3b['name']){delete _0x116b3b['name'];}_0x49507a[_0x59b1('0x18')](_0xb4dee0)[_0x59b1('0x28')](_0x116b3b);};}exports[_0x59b1('0x29')]=function(_0x25a9f1,_0xcd73d1){var _0x1efb91={},_0x226c35={},_0x28300e={'count':0x0,'rows':[]};var _0x3fde91=db[_0x59b1('0x2a')][_0x59b1('0x2b')];_0x226c35[_0x59b1('0x2c')]=_[_0x59b1('0x2d')](_0x3fde91);_0x226c35[_0x59b1('0x2e')]=_[_0x59b1('0x2d')](_0x25a9f1['query']);_0x226c35[_0x59b1('0x2f')]=_[_0x59b1('0x30')](_0x226c35['model'],_0x226c35[_0x59b1('0x2e')]);_0x1efb91['attributes']=_['intersection'](_0x226c35['model'],qs['fields'](_0x25a9f1[_0x59b1('0x2e')]['fields']));_0x1efb91[_0x59b1('0x31')]=_0x1efb91[_0x59b1('0x31')][_0x59b1('0x32')]?_0x1efb91['attributes']:_0x226c35[_0x59b1('0x2c')];if(!_0x25a9f1[_0x59b1('0x2e')][_0x59b1('0x33')]('nolimit')){_0x1efb91['limit']=qs['limit'](_0x25a9f1[_0x59b1('0x2e')][_0x59b1('0x1d')]);_0x1efb91['offset']=qs[_0x59b1('0x1c')](_0x25a9f1['query'][_0x59b1('0x1c')]);}_0x1efb91[_0x59b1('0x34')]=qs['sort'](_0x25a9f1[_0x59b1('0x2e')][_0x59b1('0x35')]);_0x1efb91[_0x59b1('0x36')]=qs['filters'](_['pick'](_0x25a9f1[_0x59b1('0x2e')],_0x226c35[_0x59b1('0x2f')]));if(_0x25a9f1['query']['filter']){_0x1efb91[_0x59b1('0x36')]=_[_0x59b1('0x37')](_0x1efb91[_0x59b1('0x36')],{'$or':_[_0x59b1('0x38')](_0x3fde91,function(_0x20cceb){if(_0x20cceb[_0x59b1('0x39')][_0x59b1('0x3a')]!==_0x59b1('0x3b')){var _0x5e8dd1={};_0x5e8dd1[_0x20cceb[_0x59b1('0x3c')]]={'$like':'%'+_0x25a9f1[_0x59b1('0x2e')][_0x59b1('0x3d')]+'%'};return _0x5e8dd1;}})});}_0x1efb91=_[_0x59b1('0x37')]({},_0x1efb91,_0x25a9f1['options']);var _0x32872a={'where':_0x1efb91['where']};return db['SmsTransferReport']['count'](_0x32872a)[_0x59b1('0x25')](function(_0x54a84a){_0x28300e[_0x59b1('0x1b')]=_0x54a84a;if(_0x25a9f1[_0x59b1('0x2e')][_0x59b1('0x3e')]){_0x1efb91[_0x59b1('0x3f')]=[{'all':!![]}];}return db['SmsTransferReport']['findAll'](_0x1efb91);})[_0x59b1('0x25')](function(_0x46ef4a){_0x28300e['rows']=_0x46ef4a;return _0x28300e;})[_0x59b1('0x25')](respondWithFilteredResult(_0xcd73d1,_0x1efb91))[_0x59b1('0x40')](handleError(_0xcd73d1,null));};exports[_0x59b1('0x41')]=function(_0x53e78f,_0x30aebe){var _0x163931={'raw':!![],'where':{'id':_0x53e78f[_0x59b1('0x42')]['id']}},_0x1e4991={};_0x1e4991[_0x59b1('0x2c')]=_[_0x59b1('0x2d')](db[_0x59b1('0x2a')][_0x59b1('0x2b')]);_0x1e4991['query']=_['keys'](_0x53e78f[_0x59b1('0x2e')]);_0x1e4991[_0x59b1('0x2f')]=_[_0x59b1('0x30')](_0x1e4991['model'],_0x1e4991['query']);_0x163931[_0x59b1('0x31')]=_[_0x59b1('0x30')](_0x1e4991['model'],qs['fields'](_0x53e78f[_0x59b1('0x2e')]['fields']));_0x163931[_0x59b1('0x31')]=_0x163931[_0x59b1('0x31')][_0x59b1('0x32')]?_0x163931[_0x59b1('0x31')]:_0x1e4991[_0x59b1('0x2c')];if(_0x53e78f[_0x59b1('0x2e')][_0x59b1('0x3e')]){_0x163931[_0x59b1('0x3f')]=[{'all':!![]}];}_0x163931=_['merge']({},_0x163931,_0x53e78f['options']);return db['SmsTransferReport'][_0x59b1('0x43')](_0x163931)[_0x59b1('0x25')](handleEntityNotFound(_0x30aebe,null))[_0x59b1('0x25')](respondWithResult(_0x30aebe,null))[_0x59b1('0x40')](handleError(_0x30aebe,null));};exports['create']=function(_0x3ddc9a,_0x181261){return db[_0x59b1('0x2a')]['create'](_0x3ddc9a[_0x59b1('0x44')],{})[_0x59b1('0x25')](respondWithResult(_0x181261,0xc9))[_0x59b1('0x40')](handleError(_0x181261,null));};exports['update']=function(_0x1f54fe,_0x1d49ba){if(_0x1f54fe[_0x59b1('0x44')]['id']){delete _0x1f54fe[_0x59b1('0x44')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x1f54fe['params']['id']}})['then'](handleEntityNotFound(_0x1d49ba,null))['then'](saveUpdates(_0x1f54fe[_0x59b1('0x44')],null))[_0x59b1('0x25')](respondWithResult(_0x1d49ba,null))[_0x59b1('0x40')](handleError(_0x1d49ba,null));};exports['destroy']=function(_0x512112,_0x2afab6){return db[_0x59b1('0x2a')][_0x59b1('0x43')]({'where':{'id':_0x512112[_0x59b1('0x42')]['id']}})[_0x59b1('0x25')](handleEntityNotFound(_0x2afab6,null))[_0x59b1('0x25')](removeEntity(_0x2afab6,null))['catch'](handleError(_0x2afab6,null));};exports['describe']=function(_0x31d101,_0x35e2ae){return db[_0x59b1('0x2a')][_0x59b1('0x45')]()[_0x59b1('0x25')](respondWithResult(_0x35e2ae,null))['catch'](handleError(_0x35e2ae,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index f195f82..5db00fe 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 _0x008c=['moment','request-promise','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x286b7e,_0x2a05e0){var _0xd6ee40=function(_0x2deb2f){while(--_0x2deb2f){_0x286b7e['push'](_0x286b7e['shift']());}};_0xd6ee40(++_0x2a05e0);}(_0x008c,0x188));var _0xc008=function(_0x3bd53e,_0x456399){_0x3bd53e=_0x3bd53e-0x0;var _0x42797c=_0x008c[_0x3bd53e];return _0x42797c;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var attributes=require(_0xc008('0x6'));module[_0xc008('0x7')]=function(_0x163bd9,_0x1cbe76){return _0x163bd9[_0xc008('0x8')](_0xc008('0x9'),attributes,{'tableName':_0xc008('0xa'),'paranoid':![],'indexes':[{'name':_0xc008('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x54ef=['./smsTransferReport.attributes','exports','report_sms_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x474923,_0x33823c){var _0x8af48d=function(_0x3bb27c){while(--_0x3bb27c){_0x474923['push'](_0x474923['shift']());}};_0x8af48d(++_0x33823c);}(_0x54ef,0x112));var _0xf54e=function(_0x1dc0ae,_0x64ae7c){_0x1dc0ae=_0x1dc0ae-0x0;var _0x506979=_0x54ef[_0x1dc0ae];return _0x506979;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var attributes=require(_0xf54e('0x6'));module[_0xf54e('0x7')]=function(_0x431e36,_0x12d43f){return _0x431e36['define']('SmsTransferReport',attributes,{'tableName':_0xf54e('0x8'),'paranoid':![],'indexes':[{'name':_0xf54e('0x9'),'fields':[_0xf54e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 4ba8025..d5b58ad 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 _0x44c2=['SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x5418ad,_0x40742f){var _0x2cae56=function(_0x36d317){while(--_0x36d317){_0x5418ad['push'](_0x5418ad['shift']());}};_0x2cae56(++_0x40742f);}(_0x44c2,0x100));var _0x244c=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0x44c2[_0x4394b6];return _0x360244;};'use strict';var _=require(_0x244c('0x0'));var util=require(_0x244c('0x1'));var moment=require(_0x244c('0x2'));var BPromise=require(_0x244c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x244c('0x4'));var db=require(_0x244c('0x5'))['db'];var utils=require(_0x244c('0x6'));var logger=require(_0x244c('0x7'))(_0x244c('0x8'));var config=require(_0x244c('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x244c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c758e,_0x18491b,_0x5b49a1){return new BPromise(function(_0x54b673,_0x1a0f7d){return client[_0x244c('0xb')](_0x4c758e,_0x5b49a1)['then'](function(_0xf5430e){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x18491b,_0x244c('0xc'));logger['debug'](_0x244c('0xd'),_0x18491b,'request\x20sent',JSON[_0x244c('0xe')](_0xf5430e));if(_0xf5430e['error']){if(_0xf5430e['error'][_0x244c('0xf')]===0x1f4){logger[_0x244c('0x10')](_0x244c('0x11'),_0x18491b,_0xf5430e['error'][_0x244c('0x12')]);return _0x1a0f7d(_0xf5430e[_0x244c('0x10')][_0x244c('0x12')]);}logger[_0x244c('0x10')](_0x244c('0x11'),_0x18491b,_0xf5430e[_0x244c('0x10')][_0x244c('0x12')]);return _0x54b673(_0xf5430e['error'][_0x244c('0x12')]);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x18491b,_0x244c('0xc'));_0x54b673(_0xf5430e[_0x244c('0x13')][_0x244c('0x12')]);}})[_0x244c('0x14')](function(_0x5f2a11){logger[_0x244c('0x10')](_0x244c('0x11'),_0x18491b,_0x5f2a11);_0x1a0f7d(_0x5f2a11);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','SmsTransferReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x219c19,_0x39a4a5){var _0x26d51f=function(_0x4ce0bd){while(--_0x4ce0bd){_0x219c19['push'](_0x219c19['shift']());}};_0x26d51f(++_0x39a4a5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x18c2dc,_0xb9441d){_0x18c2dc=_0x18c2dc-0x0;var _0x48fb3d=_0x5f2f[_0x18c2dc];return _0x48fb3d;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index f62484a..20ea69d 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 _0xb9c5=['/:id','show','/:id/download','download','diskStorage','root','server/files/sounds/original/','replace','format','basename','now','extname','originalname','file','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated'];(function(_0x2ae96b,_0x459021){var _0x529e10=function(_0x38c0b3){while(--_0x38c0b3){_0x2ae96b['push'](_0x2ae96b['shift']());}};_0x529e10(++_0x459021);}(_0xb9c5,0x6d));var _0x5b9c=function(_0x391791,_0x4e3f11){_0x391791=_0x391791-0x0;var _0x5a4d7d=_0xb9c5[_0x391791];return _0x5a4d7d;};'use strict';var multer=require(_0x5b9c('0x0'));var util=require(_0x5b9c('0x1'));var path=require(_0x5b9c('0x2'));var timeout=require(_0x5b9c('0x3'));var express=require(_0x5b9c('0x4'));var router=express[_0x5b9c('0x5')]();var auth=require(_0x5b9c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5b9c('0x7'));var controller=require(_0x5b9c('0x8'));router[_0x5b9c('0x9')]('/',auth[_0x5b9c('0xa')](),controller['index']);router[_0x5b9c('0x9')](_0x5b9c('0xb'),auth['isAuthenticated'](),controller[_0x5b9c('0xc')]);router[_0x5b9c('0x9')](_0x5b9c('0xd'),auth[_0x5b9c('0xa')](),controller[_0x5b9c('0xe')]);var upload=multer({'storage':multer[_0x5b9c('0xf')]({'destination':function(_0x312b3a,_0x20f703,_0x2f71dc){_0x2f71dc(null,path['join'](config[_0x5b9c('0x10')],_0x5b9c('0x11')));},'filename':function(_0x353037,_0x3d9e28,_0x3a1b9d){_0x3d9e28['originalname']=_0x3d9e28['originalname'][_0x5b9c('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3a1b9d(null,util[_0x5b9c('0x13')]('%s-%s%s',path[_0x5b9c('0x14')](_0x3d9e28['originalname'],path['extname'](_0x3d9e28['originalname'])),Date[_0x5b9c('0x15')](),path[_0x5b9c('0x16')](_0x3d9e28[_0x5b9c('0x17')])));}})});router['post']('/',upload['single'](_0x5b9c('0x18')),controller[_0x5b9c('0x19')]);router[_0x5b9c('0x1a')](_0x5b9c('0xb'),auth[_0x5b9c('0xa')](),controller[_0x5b9c('0x1b')]);router[_0x5b9c('0x1c')](_0x5b9c('0xb'),auth[_0x5b9c('0xa')](),controller['delete']);module[_0x5b9c('0x1d')]=router; \ No newline at end of file +var _0x0aaf=['show','/:id/download','diskStorage','join','server/files/sounds/original/','originalname','replace','%s-%s%s','extname','now','post','file','create','put','update','delete','exports','multer','util','path','express','Router','../../config/environment','./sound.controller','isAuthenticated','index','get','/:id'];(function(_0x236d58,_0x183c2e){var _0x279794=function(_0x479527){while(--_0x479527){_0x236d58['push'](_0x236d58['shift']());}};_0x279794(++_0x183c2e);}(_0x0aaf,0x65));var _0xf0aa=function(_0x545e64,_0x356844){_0x545e64=_0x545e64-0x0;var _0x13dbef=_0x0aaf[_0x545e64];return _0x13dbef;};'use strict';var multer=require(_0xf0aa('0x0'));var util=require(_0xf0aa('0x1'));var path=require(_0xf0aa('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0aa('0x3'));var router=express[_0xf0aa('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf0aa('0x5'));var controller=require(_0xf0aa('0x6'));router['get']('/',auth[_0xf0aa('0x7')](),controller[_0xf0aa('0x8')]);router[_0xf0aa('0x9')](_0xf0aa('0xa'),auth[_0xf0aa('0x7')](),controller[_0xf0aa('0xb')]);router[_0xf0aa('0x9')](_0xf0aa('0xc'),auth[_0xf0aa('0x7')](),controller['download']);var upload=multer({'storage':multer[_0xf0aa('0xd')]({'destination':function(_0x27318a,_0x51763a,_0x5a6530){_0x5a6530(null,path[_0xf0aa('0xe')](config['root'],_0xf0aa('0xf')));},'filename':function(_0x22ec20,_0x35002d,_0x596b6e){_0x35002d[_0xf0aa('0x10')]=_0x35002d['originalname'][_0xf0aa('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x596b6e(null,util['format'](_0xf0aa('0x12'),path['basename'](_0x35002d[_0xf0aa('0x10')],path[_0xf0aa('0x13')](_0x35002d[_0xf0aa('0x10')])),Date[_0xf0aa('0x14')](),path[_0xf0aa('0x13')](_0x35002d['originalname'])));}})});router[_0xf0aa('0x15')]('/',upload['single'](_0xf0aa('0x16')),controller[_0xf0aa('0x17')]);router[_0xf0aa('0x18')](_0xf0aa('0xa'),auth['isAuthenticated'](),controller[_0xf0aa('0x19')]);router[_0xf0aa('0x1a')](_0xf0aa('0xa'),auth[_0xf0aa('0x7')](),controller[_0xf0aa('0x1a')]);module[_0xf0aa('0x1b')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 2ec17c9..b3c14ba 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 _0x6594=['FLOAT','BIGINT','INTEGER','sequelize','exports','name','STRING'];(function(_0x556bda,_0x838814){var _0x5e5e94=function(_0x536078){while(--_0x536078){_0x556bda['push'](_0x556bda['shift']());}};_0x5e5e94(++_0x838814);}(_0x6594,0x161));var _0x4659=function(_0x3a2e8c,_0x4001d3){_0x3a2e8c=_0x3a2e8c-0x0;var _0x588177=_0x6594[_0x3a2e8c];return _0x588177;};'use strict';var Sequelize=require(_0x4659('0x0'));module[_0x4659('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4659('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x4659('0x3')]},'display_name':{'type':Sequelize[_0x4659('0x3')],'defaultValue':''},'description':{'type':Sequelize[_0x4659('0x3')]},'original_format':{'type':Sequelize[_0x4659('0x3')]},'original_duration':{'type':Sequelize[_0x4659('0x4')]},'original_sampleCount':{'type':Sequelize[_0x4659('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x4659('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x4659('0x3')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x4659('0x6')]},'converted_bitRate':{'type':Sequelize[_0x4659('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x4659('0x6')]}}; \ No newline at end of file +var _0xbce4=['STRING','BIGINT','INTEGER','FLOAT','sequelize','exports'];(function(_0x50d691,_0x3135b9){var _0xa7d63b=function(_0x78a535){while(--_0x78a535){_0x50d691['push'](_0x50d691['shift']());}};_0xa7d63b(++_0x3135b9);}(_0xbce4,0x184));var _0x4bce=function(_0x127a5a,_0x4eba2c){_0x127a5a=_0x127a5a-0x0;var _0x5e87e9=_0xbce4[_0x127a5a];return _0x5e87e9;};'use strict';var Sequelize=require(_0x4bce('0x0'));module[_0x4bce('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x4bce('0x2')]},'display_name':{'type':Sequelize[_0x4bce('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x4bce('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x4bce('0x3')]},'original_channelCount':{'type':Sequelize[_0x4bce('0x4')]},'original_bitRate':{'type':Sequelize[_0x4bce('0x3')]},'original_sampleRate':{'type':Sequelize[_0x4bce('0x4')]},'converted_format':{'type':Sequelize[_0x4bce('0x2')]},'converted_duration':{'type':Sequelize[_0x4bce('0x5')]},'converted_sampleCount':{'type':Sequelize[_0x4bce('0x3')]},'converted_channelCount':{'type':Sequelize[_0x4bce('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x4bce('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 25d7a0a..91f94db 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 _0x90b1=['get','Sounds','UserProfileResource','error','name','send','index','Sound','model','query','intersection','attributes','fields','nolimit','limit','order','sort','where','filters','pick','merge','map','type','VIRTUAL','filter','options','include','findAll','show','rawAttributes','keys','includeAll','find','download','params','save_name','root','server/files/sounds/converted','converted_format','Sequelize','ValidationError','join','format','%s.%s','catch','create','basename','originalname','file','filename','extname','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then'];(function(_0x19738d,_0x18e5a0){var _0x56c67e=function(_0x5f4437){while(--_0x5f4437){_0x19738d['push'](_0x19738d['shift']());}};_0x56c67e(++_0x18e5a0);}(_0x90b1,0x1bb));var _0x190b=function(_0x4ac00b,_0x486aa9){_0x4ac00b=_0x4ac00b-0x0;var _0x3ed73f=_0x90b1[_0x4ac00b];return _0x3ed73f;};'use strict';var pdf=require(_0x190b('0x0'));var emlformat=require(_0x190b('0x1'));var rimraf=require(_0x190b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x190b('0x3'));var moment=require(_0x190b('0x4'));var BPromise=require(_0x190b('0x5'));var Mustache=require(_0x190b('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x190b('0x7'));var fs=require('fs');var _=require(_0x190b('0x8'));var squel=require(_0x190b('0x9'));var crypto=require(_0x190b('0xa'));var jsforce=require(_0x190b('0xb'));var deskjs=require(_0x190b('0xc'));var toCsv=require(_0x190b('0xd'));var querystring=require('querystring');var Papa=require(_0x190b('0xe'));var authService=require(_0x190b('0xf'));var hardwareService=require(_0x190b('0x10'));var Redis=require(_0x190b('0x11'));var qs=require(_0x190b('0x12'));var logger=require(_0x190b('0x13'))(_0x190b('0x14'));var utils=require(_0x190b('0x15'));var config=require('../../config/environment');var db=require(_0x190b('0x16'))['db'];function respondWithStatusCode(_0x5cf995,_0x5701ad){_0x5701ad=_0x5701ad||0xcc;return function(_0x4d63ac){if(_0x4d63ac){return _0x5cf995[_0x190b('0x17')](_0x5701ad);}return _0x5cf995[_0x190b('0x18')](_0x5701ad)[_0x190b('0x19')]();};}function respondWithResult(_0x3cd4cd,_0x1e1fd5){_0x1e1fd5=_0x1e1fd5||0xc8;return function(_0x2e12d4){if(_0x2e12d4){return _0x3cd4cd[_0x190b('0x18')](_0x1e1fd5)[_0x190b('0x1a')](_0x2e12d4);}};}function respondWithFilteredResult(_0x441e58,_0x186941){return function(_0x1a046f){if(_0x1a046f){var _0xab346=_0x1a046f[_0x190b('0x1b')],_0x3e8781=_0x186941['offset'],_0x3fbfc3=_0x186941[_0x190b('0x1c')]+_0x186941['limit'],_0x121867;if(_0x3fbfc3>=_0xab346){_0x3fbfc3=_0xab346;_0x121867=0xc8;}else{_0x121867=0xce;}_0x441e58[_0x190b('0x18')](_0x121867);return _0x441e58[_0x190b('0x1d')](_0x190b('0x1e'),_0x3e8781+'-'+_0x3fbfc3+'/'+_0xab346)[_0x190b('0x1a')](_0x1a046f);}return null;};}function patchUpdates(_0x50a3c4){return function(_0x298343){try{jsonpatch[_0x190b('0x1f')](_0x298343,_0x50a3c4,!![]);}catch(_0x441a2b){return BPromise[_0x190b('0x20')](_0x441a2b);}return _0x298343[_0x190b('0x21')]();};}function saveUpdates(_0x177170,_0x47d704){return function(_0x3ed24c){if(_0x3ed24c){return _0x3ed24c[_0x190b('0x22')](_0x177170)['then'](function(_0xb4c32b){return _0xb4c32b;});}return null;};}function removeEntity(_0x5740af,_0x55de01){return function(_0xcd15e5){if(_0xcd15e5){return _0xcd15e5[_0x190b('0x23')]()[_0x190b('0x24')](function(){var _0x4c0b6e=_0xcd15e5[_0x190b('0x25')]({'plain':!![]});var _0x2e633e=_0x190b('0x26');return db[_0x190b('0x27')][_0x190b('0x23')]({'where':{'type':_0x2e633e,'resourceId':_0x4c0b6e['id']}})[_0x190b('0x24')](function(){return _0xcd15e5;});})[_0x190b('0x24')](function(){_0x5740af['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x262a63,_0x1a5f86){return function(_0x50605b){if(!_0x50605b){_0x262a63['sendStatus'](0x194);}return _0x50605b;};}function handleError(_0x3260d5,_0x4e2a93){_0x4e2a93=_0x4e2a93||0x1f4;return function(_0x328e5e){logger[_0x190b('0x28')](_0x328e5e['stack']);if(_0x328e5e[_0x190b('0x29')]){delete _0x328e5e[_0x190b('0x29')];}_0x3260d5['status'](_0x4e2a93)[_0x190b('0x2a')](_0x328e5e);};}exports[_0x190b('0x2b')]=function(_0x359b4a,_0x494f3f){var _0x536d7b={},_0x3730cc={},_0x4d5f3f={'count':0x0,'rows':[]};var _0x14be2c=db[_0x190b('0x2c')]['rawAttributes'];_0x3730cc[_0x190b('0x2d')]=_['keys'](_0x14be2c);_0x3730cc[_0x190b('0x2e')]=_['keys'](_0x359b4a[_0x190b('0x2e')]);_0x3730cc['filters']=_[_0x190b('0x2f')](_0x3730cc[_0x190b('0x2d')],_0x3730cc['query']);_0x536d7b[_0x190b('0x30')]=_[_0x190b('0x2f')](_0x3730cc[_0x190b('0x2d')],qs[_0x190b('0x31')](_0x359b4a[_0x190b('0x2e')][_0x190b('0x31')]));_0x536d7b[_0x190b('0x30')]=_0x536d7b[_0x190b('0x30')]['length']?_0x536d7b['attributes']:_0x3730cc[_0x190b('0x2d')];if(!_0x359b4a[_0x190b('0x2e')]['hasOwnProperty'](_0x190b('0x32'))){_0x536d7b[_0x190b('0x33')]=qs[_0x190b('0x33')](_0x359b4a[_0x190b('0x2e')][_0x190b('0x33')]);_0x536d7b[_0x190b('0x1c')]=qs[_0x190b('0x1c')](_0x359b4a['query']['offset']);}_0x536d7b[_0x190b('0x34')]=qs[_0x190b('0x35')](_0x359b4a[_0x190b('0x2e')]['sort']);_0x536d7b[_0x190b('0x36')]=qs[_0x190b('0x37')](_[_0x190b('0x38')](_0x359b4a['query'],_0x3730cc[_0x190b('0x37')]));if(_0x359b4a['query']['filter']){_0x536d7b[_0x190b('0x36')]=_[_0x190b('0x39')](_0x536d7b['where'],{'$or':_[_0x190b('0x3a')](_0x14be2c,function(_0xfd0d62){if(_0xfd0d62[_0x190b('0x3b')]['key']!==_0x190b('0x3c')){var _0x39036d={};_0x39036d[_0xfd0d62['field']]={'$like':'%'+_0x359b4a['query'][_0x190b('0x3d')]+'%'};return _0x39036d;}})});}_0x536d7b=_['merge']({},_0x536d7b,_0x359b4a[_0x190b('0x3e')]);var _0x741e94={'where':_0x536d7b[_0x190b('0x36')]};return db[_0x190b('0x2c')]['count'](_0x741e94)[_0x190b('0x24')](function(_0x5f118c){_0x4d5f3f[_0x190b('0x1b')]=_0x5f118c;if(_0x359b4a[_0x190b('0x2e')]['includeAll']){_0x536d7b[_0x190b('0x3f')]=[{'all':!![]}];}return db[_0x190b('0x2c')][_0x190b('0x40')](_0x536d7b);})['then'](function(_0x2c7c0e){_0x4d5f3f['rows']=_0x2c7c0e;return _0x4d5f3f;})['then'](respondWithFilteredResult(_0x494f3f,_0x536d7b))['catch'](handleError(_0x494f3f,null));};exports[_0x190b('0x41')]=function(_0x3aef1d,_0x411cb5){var _0x2b4e34={'raw':!![],'where':{'id':_0x3aef1d['params']['id']}},_0x48b2fa={};_0x48b2fa[_0x190b('0x2d')]=_['keys'](db[_0x190b('0x2c')][_0x190b('0x42')]);_0x48b2fa['query']=_[_0x190b('0x43')](_0x3aef1d[_0x190b('0x2e')]);_0x48b2fa[_0x190b('0x37')]=_['intersection'](_0x48b2fa[_0x190b('0x2d')],_0x48b2fa[_0x190b('0x2e')]);_0x2b4e34['attributes']=_[_0x190b('0x2f')](_0x48b2fa['model'],qs[_0x190b('0x31')](_0x3aef1d[_0x190b('0x2e')][_0x190b('0x31')]));_0x2b4e34['attributes']=_0x2b4e34[_0x190b('0x30')]['length']?_0x2b4e34[_0x190b('0x30')]:_0x48b2fa[_0x190b('0x2d')];if(_0x3aef1d[_0x190b('0x2e')][_0x190b('0x44')]){_0x2b4e34[_0x190b('0x3f')]=[{'all':!![]}];}_0x2b4e34=_[_0x190b('0x39')]({},_0x2b4e34,_0x3aef1d[_0x190b('0x3e')]);return db['Sound'][_0x190b('0x45')](_0x2b4e34)[_0x190b('0x24')](handleEntityNotFound(_0x411cb5,null))[_0x190b('0x24')](respondWithResult(_0x411cb5,null))['catch'](handleError(_0x411cb5,null));};exports[_0x190b('0x46')]=function(_0x27314f,_0x51af04,_0x576660){return db[_0x190b('0x2c')]['find']({'where':{'id':_0x27314f[_0x190b('0x47')]['id']},'attributes':[_0x190b('0x29'),_0x190b('0x48'),'converted_format'],'raw':!![]})[_0x190b('0x24')](handleEntityNotFound(_0x51af04,null))[_0x190b('0x24')](function(_0x2b0a3a){if(_0x2b0a3a){if(!fs['existsSync'](path['join'](config[_0x190b('0x49')],_0x190b('0x4a'),_0x2b0a3a[_0x190b('0x48')]+'.'+_0x2b0a3a[_0x190b('0x4b')]))){throw new db[(_0x190b('0x4c'))][(_0x190b('0x4d'))]('Sound\x20not\x20found');}return _0x51af04[_0x190b('0x46')](path[_0x190b('0x4e')](config[_0x190b('0x49')],'server/files/sounds/converted',util[_0x190b('0x4f')](_0x190b('0x50'),_0x2b0a3a[_0x190b('0x48')],_0x2b0a3a['converted_format'])),util[_0x190b('0x4f')](_0x190b('0x50'),_0x2b0a3a[_0x190b('0x29')],_0x2b0a3a[_0x190b('0x4b')]));}return null;})[_0x190b('0x51')](handleError(_0x51af04,null));};exports[_0x190b('0x52')]=function(_0x33cc78,_0x2ea1c8,_0x3a9087){var _0x1f7ec2={'name':path[_0x190b('0x53')](_0x33cc78['file'][_0x190b('0x54')],path['extname'](_0x33cc78[_0x190b('0x55')][_0x190b('0x54')])),'save_name':path['basename'](_0x33cc78[_0x190b('0x55')][_0x190b('0x56')],path[_0x190b('0x57')](_0x33cc78[_0x190b('0x55')][_0x190b('0x56')])),'original_format':path[_0x190b('0x57')](_0x33cc78[_0x190b('0x55')][_0x190b('0x54')])['substring'](0x1),'converted_format':_0x190b('0x58')};var _0x260adb=path[_0x190b('0x4e')](config['root'],_0x190b('0x59'),_0x33cc78['file']['filename']);var _0x41b16=path[_0x190b('0x4e')](config[_0x190b('0x49')],_0x190b('0x4a'),util[_0x190b('0x4f')](_0x190b('0x50'),path[_0x190b('0x53')](_0x33cc78[_0x190b('0x55')][_0x190b('0x56')],path[_0x190b('0x57')](_0x33cc78[_0x190b('0x55')][_0x190b('0x56')])),_0x1f7ec2[_0x190b('0x4b')]));logger[_0x190b('0x5a')]('Sound\x20upload\x20filepath:\x20%s',_0x260adb);logger[_0x190b('0x5a')](_0x190b('0x5b'),_0x41b16);try{fs[_0x190b('0x5c')](_0x260adb,parseInt(_0x190b('0x5d'),0x8));var _0x53d740=sox['transcode'](_0x260adb,_0x41b16,{'sampleRate':0x1f40,'format':_0x190b('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x53d740['on'](_0x190b('0x28'),function(_0x49fa17){fs[_0x190b('0x5e')](_0x260adb);_0x2ea1c8['status'](0x1f4)[_0x190b('0x2a')](_0x49fa17);});_0x53d740['on'](_0x190b('0x5f'),function(_0xf7b6b9){_0x1f7ec2['original_duration']=isNaN(_0xf7b6b9[_0x190b('0x60')])?null:_0xf7b6b9[_0x190b('0x60')]*0x3e8;_0x1f7ec2[_0x190b('0x61')]=isNaN(_0xf7b6b9[_0x190b('0x62')])?null:_0xf7b6b9[_0x190b('0x62')];_0x1f7ec2[_0x190b('0x63')]=isNaN(_0xf7b6b9[_0x190b('0x64')])?null:_0xf7b6b9[_0x190b('0x64')];_0x1f7ec2[_0x190b('0x65')]=isNaN(_0xf7b6b9['bitRate'])?null:_0xf7b6b9['bitRate'];_0x1f7ec2[_0x190b('0x66')]=isNaN(_0xf7b6b9[_0x190b('0x67')])?null:_0xf7b6b9[_0x190b('0x67')];});_0x53d740['on'](_0x190b('0x68'),function(_0x4af037){_0x1f7ec2[_0x190b('0x69')]=isNaN(_0x4af037[_0x190b('0x60')])?null:_0x4af037['duration']*0x3e8;_0x1f7ec2[_0x190b('0x6a')]=isNaN(_0x4af037[_0x190b('0x62')])?null:_0x4af037[_0x190b('0x62')];_0x1f7ec2[_0x190b('0x6b')]=isNaN(_0x4af037[_0x190b('0x64')])?null:_0x4af037[_0x190b('0x64')];_0x1f7ec2[_0x190b('0x6c')]=isNaN(_0x4af037[_0x190b('0x6d')])?null:_0x4af037['bitRate'];_0x1f7ec2[_0x190b('0x6e')]=isNaN(_0x4af037['sampleRate'])?null:_0x4af037['sampleRate'];});_0x53d740['on'](_0x190b('0x19'),function(){fs[_0x190b('0x5c')](_0x41b16,parseInt(_0x190b('0x5d'),0x8));return db['Sound']['create'](_0x1f7ec2)[_0x190b('0x24')](function(_0xdc7579){var _0x24c00d={'role':_0x33cc78[_0x190b('0x6f')][_0x190b('0x70')],'userProfileId':_0x33cc78[_0x190b('0x6f')][_0x190b('0x71')]};if(!_0x24c00d)throw new Error(_0x190b('0x72'));if(_0x24c00d['role']===_0x190b('0x73')){var _0x419547=_0xdc7579[_0x190b('0x25')]({'plain':!![]});return db[_0x190b('0x74')][_0x190b('0x45')]({'where':{'name':'Sounds','userProfileId':_0x24c00d[_0x190b('0x71')]},'raw':!![]})[_0x190b('0x24')](function(_0x6fe403){if(_0x6fe403&&_0x6fe403['autoAssociation']===0x0){return db[_0x190b('0x27')][_0x190b('0x52')]({'name':_0x419547[_0x190b('0x29')],'resourceId':_0x419547['id'],'type':_0x6fe403[_0x190b('0x29')],'sectionId':_0x6fe403['id']},{})['then'](function(){return _0xdc7579;});}else{return _0xdc7579;}})[_0x190b('0x51')](function(_0xea5876){logger[_0x190b('0x28')](_0x190b('0x75'),_0xea5876);throw _0xea5876;});}return _0xdc7579;})['then'](respondWithResult(_0x2ea1c8,null))[_0x190b('0x51')](handleError(_0x2ea1c8,null));});_0x53d740['start']();}catch(_0x2495c9){_0x2ea1c8[_0x190b('0x18')](0x1f4)[_0x190b('0x2a')](_0x2495c9);}};exports[_0x190b('0x22')]=function(_0x52ba56,_0x2a36b3,_0x52fa63){return db[_0x190b('0x2c')]['find']({'where':{'id':_0x52ba56['params']['id']}})[_0x190b('0x24')](handleEntityNotFound(_0x2a36b3,null))['then'](saveUpdates(_[_0x190b('0x38')](_0x52ba56[_0x190b('0x6f')],[_0x190b('0x29'),_0x190b('0x76')]),null))[_0x190b('0x24')](respondWithResult(_0x2a36b3,null))['catch'](handleError(_0x2a36b3,null));};exports[_0x190b('0x77')]=function(_0xa26f18,_0xdafef7,_0x519a92){return db[_0x190b('0x2c')][_0x190b('0x45')]({'where':{'id':_0xa26f18['params']['id']}})[_0x190b('0x24')](function(_0x164820){if(_0x164820){return _0x164820[_0x190b('0x23')]();}})['then'](function(_0x1446a4){var _0x26be58=path[_0x190b('0x4e')](config[_0x190b('0x49')],'server/files/sounds/original',util[_0x190b('0x4f')](_0x190b('0x50'),_0x1446a4[_0x190b('0x48')],_0x1446a4['original_format']));var _0x1bc4f0=path[_0x190b('0x4e')](config[_0x190b('0x49')],'server/files/sounds/converted',util[_0x190b('0x4f')](_0x190b('0x50'),_0x1446a4[_0x190b('0x48')],_0x1446a4[_0x190b('0x4b')]));fs[_0x190b('0x5e')](_0x26be58);fs['unlinkSync'](_0x1bc4f0);return _0x1446a4;})['then'](function(_0x10b7ae){if(_0x10b7ae){return _0xdafef7[_0x190b('0x18')](0xcc)['end']();}})[_0x190b('0x24')](handleEntityNotFound(_0xdafef7,null))[_0x190b('0x51')](handleError(_0xdafef7,null));}; \ No newline at end of file +var _0x0295=['unlinkSync','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','end','0777','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','server/files/sounds/original','original_format','html-pdf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','Sounds','UserProfileResource','stack','name','send','index','Sound','model','keys','query','filters','intersection','attributes','nolimit','sort','where','pick','merge','type','key','VIRTUAL','field','filter','options','includeAll','findAll','show','params','fields','length','include','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','catch','basename','originalname','file','filename','extname','substring','wav','%s.%s','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode'];(function(_0x189305,_0x46c43f){var _0xea3406=function(_0x2aa435){while(--_0x2aa435){_0x189305['push'](_0x189305['shift']());}};_0xea3406(++_0x46c43f);}(_0x0295,0x1f0));var _0x5029=function(_0x1e2f72,_0x4ecd3d){_0x1e2f72=_0x1e2f72-0x0;var _0x2f00a8=_0x0295[_0x1e2f72];return _0x2f00a8;};'use strict';var pdf=require(_0x5029('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5029('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5029('0x2'));var BPromise=require(_0x5029('0x3'));var Mustache=require(_0x5029('0x4'));var util=require(_0x5029('0x5'));var path=require(_0x5029('0x6'));var sox=require(_0x5029('0x7'));var csv=require(_0x5029('0x8'));var ejs=require(_0x5029('0x9'));var fs=require('fs');var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var authService=require(_0x5029('0xd'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x5029('0xe'));var qs=require(_0x5029('0xf'));var logger=require(_0x5029('0x10'))('api');var utils=require(_0x5029('0x11'));var config=require(_0x5029('0x12'));var db=require(_0x5029('0x13'))['db'];function respondWithStatusCode(_0x4f295e,_0x3bc005){_0x3bc005=_0x3bc005||0xcc;return function(_0x2442b2){if(_0x2442b2){return _0x4f295e['sendStatus'](_0x3bc005);}return _0x4f295e['status'](_0x3bc005)['end']();};}function respondWithResult(_0x4aebb6,_0x2484ac){_0x2484ac=_0x2484ac||0xc8;return function(_0x2e0369){if(_0x2e0369){return _0x4aebb6[_0x5029('0x14')](_0x2484ac)[_0x5029('0x15')](_0x2e0369);}};}function respondWithFilteredResult(_0x2c0b33,_0x11c24b){return function(_0xe278b7){if(_0xe278b7){var _0x317c20=_0xe278b7[_0x5029('0x16')],_0x10bf55=_0x11c24b[_0x5029('0x17')],_0x326923=_0x11c24b[_0x5029('0x17')]+_0x11c24b[_0x5029('0x18')],_0x457c73;if(_0x326923>=_0x317c20){_0x326923=_0x317c20;_0x457c73=0xc8;}else{_0x457c73=0xce;}_0x2c0b33['status'](_0x457c73);return _0x2c0b33[_0x5029('0x19')](_0x5029('0x1a'),_0x10bf55+'-'+_0x326923+'/'+_0x317c20)[_0x5029('0x15')](_0xe278b7);}return null;};}function patchUpdates(_0x4902f3){return function(_0x8cea01){try{jsonpatch[_0x5029('0x1b')](_0x8cea01,_0x4902f3,!![]);}catch(_0xaba461){return BPromise['reject'](_0xaba461);}return _0x8cea01[_0x5029('0x1c')]();};}function saveUpdates(_0x5696b1,_0x16485c){return function(_0x8a414c){if(_0x8a414c){return _0x8a414c[_0x5029('0x1d')](_0x5696b1)[_0x5029('0x1e')](function(_0x4b5854){return _0x4b5854;});}return null;};}function removeEntity(_0x47ecca,_0x4c9184){return function(_0x4a49b6){if(_0x4a49b6){return _0x4a49b6[_0x5029('0x1f')]()[_0x5029('0x1e')](function(){var _0x1eb228=_0x4a49b6[_0x5029('0x20')]({'plain':!![]});var _0x16bd22=_0x5029('0x21');return db[_0x5029('0x22')][_0x5029('0x1f')]({'where':{'type':_0x16bd22,'resourceId':_0x1eb228['id']}})[_0x5029('0x1e')](function(){return _0x4a49b6;});})['then'](function(){_0x47ecca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x23')]);if(_0x36d810[_0x5029('0x24')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x14')](_0x1e7e61)[_0x5029('0x25')](_0x36d810);};}exports[_0x5029('0x26')]=function(_0x4a24b9,_0x32da06){var _0x251f99={},_0xe5313e={},_0x4b6f92={'count':0x0,'rows':[]};var _0x2cedf6=db[_0x5029('0x27')]['rawAttributes'];_0xe5313e[_0x5029('0x28')]=_[_0x5029('0x29')](_0x2cedf6);_0xe5313e[_0x5029('0x2a')]=_[_0x5029('0x29')](_0x4a24b9[_0x5029('0x2a')]);_0xe5313e[_0x5029('0x2b')]=_[_0x5029('0x2c')](_0xe5313e[_0x5029('0x28')],_0xe5313e[_0x5029('0x2a')]);_0x251f99[_0x5029('0x2d')]=_[_0x5029('0x2c')](_0xe5313e[_0x5029('0x28')],qs['fields'](_0x4a24b9[_0x5029('0x2a')]['fields']));_0x251f99[_0x5029('0x2d')]=_0x251f99['attributes']['length']?_0x251f99[_0x5029('0x2d')]:_0xe5313e[_0x5029('0x28')];if(!_0x4a24b9[_0x5029('0x2a')]['hasOwnProperty'](_0x5029('0x2e'))){_0x251f99[_0x5029('0x18')]=qs[_0x5029('0x18')](_0x4a24b9[_0x5029('0x2a')][_0x5029('0x18')]);_0x251f99[_0x5029('0x17')]=qs[_0x5029('0x17')](_0x4a24b9[_0x5029('0x2a')][_0x5029('0x17')]);}_0x251f99['order']=qs[_0x5029('0x2f')](_0x4a24b9[_0x5029('0x2a')][_0x5029('0x2f')]);_0x251f99[_0x5029('0x30')]=qs['filters'](_[_0x5029('0x31')](_0x4a24b9[_0x5029('0x2a')],_0xe5313e[_0x5029('0x2b')]));if(_0x4a24b9['query']['filter']){_0x251f99[_0x5029('0x30')]=_[_0x5029('0x32')](_0x251f99['where'],{'$or':_['map'](_0x2cedf6,function(_0x9656f2){if(_0x9656f2[_0x5029('0x33')][_0x5029('0x34')]!==_0x5029('0x35')){var _0x33c8c3={};_0x33c8c3[_0x9656f2[_0x5029('0x36')]]={'$like':'%'+_0x4a24b9[_0x5029('0x2a')][_0x5029('0x37')]+'%'};return _0x33c8c3;}})});}_0x251f99=_[_0x5029('0x32')]({},_0x251f99,_0x4a24b9[_0x5029('0x38')]);var _0x3e5b67={'where':_0x251f99[_0x5029('0x30')]};return db[_0x5029('0x27')][_0x5029('0x16')](_0x3e5b67)['then'](function(_0x57c2b5){_0x4b6f92[_0x5029('0x16')]=_0x57c2b5;if(_0x4a24b9[_0x5029('0x2a')][_0x5029('0x39')]){_0x251f99['include']=[{'all':!![]}];}return db[_0x5029('0x27')][_0x5029('0x3a')](_0x251f99);})['then'](function(_0x247789){_0x4b6f92['rows']=_0x247789;return _0x4b6f92;})[_0x5029('0x1e')](respondWithFilteredResult(_0x32da06,_0x251f99))['catch'](handleError(_0x32da06,null));};exports[_0x5029('0x3b')]=function(_0x359838,_0x24a18d){var _0x78768={'raw':!![],'where':{'id':_0x359838[_0x5029('0x3c')]['id']}},_0x346fd9={};_0x346fd9[_0x5029('0x28')]=_[_0x5029('0x29')](db[_0x5029('0x27')]['rawAttributes']);_0x346fd9[_0x5029('0x2a')]=_[_0x5029('0x29')](_0x359838[_0x5029('0x2a')]);_0x346fd9[_0x5029('0x2b')]=_[_0x5029('0x2c')](_0x346fd9[_0x5029('0x28')],_0x346fd9['query']);_0x78768[_0x5029('0x2d')]=_[_0x5029('0x2c')](_0x346fd9[_0x5029('0x28')],qs[_0x5029('0x3d')](_0x359838[_0x5029('0x2a')]['fields']));_0x78768[_0x5029('0x2d')]=_0x78768[_0x5029('0x2d')][_0x5029('0x3e')]?_0x78768[_0x5029('0x2d')]:_0x346fd9[_0x5029('0x28')];if(_0x359838[_0x5029('0x2a')][_0x5029('0x39')]){_0x78768[_0x5029('0x3f')]=[{'all':!![]}];}_0x78768=_[_0x5029('0x32')]({},_0x78768,_0x359838['options']);return db[_0x5029('0x27')][_0x5029('0x40')](_0x78768)[_0x5029('0x1e')](handleEntityNotFound(_0x24a18d,null))[_0x5029('0x1e')](respondWithResult(_0x24a18d,null))['catch'](handleError(_0x24a18d,null));};exports['download']=function(_0x17a515,_0x6185aa,_0x2a07d4){return db[_0x5029('0x27')][_0x5029('0x40')]({'where':{'id':_0x17a515[_0x5029('0x3c')]['id']},'attributes':[_0x5029('0x24'),_0x5029('0x41'),_0x5029('0x42')],'raw':!![]})[_0x5029('0x1e')](handleEntityNotFound(_0x6185aa,null))[_0x5029('0x1e')](function(_0x39370b){if(_0x39370b){if(!fs[_0x5029('0x43')](path[_0x5029('0x44')](config[_0x5029('0x45')],_0x5029('0x46'),_0x39370b[_0x5029('0x41')]+'.'+_0x39370b[_0x5029('0x42')]))){throw new db[(_0x5029('0x47'))][(_0x5029('0x48'))](_0x5029('0x49'));}return _0x6185aa['download'](path[_0x5029('0x44')](config['root'],_0x5029('0x46'),util[_0x5029('0x4a')]('%s.%s',_0x39370b['save_name'],_0x39370b[_0x5029('0x42')])),util['format']('%s.%s',_0x39370b[_0x5029('0x24')],_0x39370b[_0x5029('0x42')]));}return null;})[_0x5029('0x4b')](handleError(_0x6185aa,null));};exports['create']=function(_0x544fb3,_0x1510bb,_0x3d4e9a){var _0x4ddbb7={'name':path[_0x5029('0x4c')](_0x544fb3['file'][_0x5029('0x4d')],path['extname'](_0x544fb3[_0x5029('0x4e')][_0x5029('0x4d')])),'save_name':path[_0x5029('0x4c')](_0x544fb3[_0x5029('0x4e')][_0x5029('0x4f')],path[_0x5029('0x50')](_0x544fb3[_0x5029('0x4e')][_0x5029('0x4f')])),'original_format':path['extname'](_0x544fb3[_0x5029('0x4e')]['originalname'])[_0x5029('0x51')](0x1),'converted_format':_0x5029('0x52')};var _0x57e82e=path[_0x5029('0x44')](config['root'],'server/files/sounds/original',_0x544fb3['file'][_0x5029('0x4f')]);var _0x4b0c5f=path[_0x5029('0x44')](config[_0x5029('0x45')],_0x5029('0x46'),util['format'](_0x5029('0x53'),path['basename'](_0x544fb3['file'][_0x5029('0x4f')],path[_0x5029('0x50')](_0x544fb3[_0x5029('0x4e')][_0x5029('0x4f')])),_0x4ddbb7[_0x5029('0x42')]));logger['info'](_0x5029('0x54'),_0x57e82e);logger[_0x5029('0x55')](_0x5029('0x56'),_0x4b0c5f);try{fs[_0x5029('0x57')](_0x57e82e,parseInt('0777',0x8));var _0x33812b=sox[_0x5029('0x58')](_0x57e82e,_0x4b0c5f,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x33812b['on']('error',function(_0x2afd44){fs[_0x5029('0x59')](_0x57e82e);_0x1510bb[_0x5029('0x14')](0x1f4)[_0x5029('0x25')](_0x2afd44);});_0x33812b['on']('src',function(_0x4208ab){_0x4ddbb7[_0x5029('0x5a')]=isNaN(_0x4208ab[_0x5029('0x5b')])?null:_0x4208ab[_0x5029('0x5b')]*0x3e8;_0x4ddbb7[_0x5029('0x5c')]=isNaN(_0x4208ab[_0x5029('0x5d')])?null:_0x4208ab['sampleCount'];_0x4ddbb7['original_channelCount']=isNaN(_0x4208ab[_0x5029('0x5e')])?null:_0x4208ab[_0x5029('0x5e')];_0x4ddbb7[_0x5029('0x5f')]=isNaN(_0x4208ab['bitRate'])?null:_0x4208ab[_0x5029('0x60')];_0x4ddbb7[_0x5029('0x61')]=isNaN(_0x4208ab[_0x5029('0x62')])?null:_0x4208ab[_0x5029('0x62')];});_0x33812b['on'](_0x5029('0x63'),function(_0x5264c6){_0x4ddbb7[_0x5029('0x64')]=isNaN(_0x5264c6[_0x5029('0x5b')])?null:_0x5264c6[_0x5029('0x5b')]*0x3e8;_0x4ddbb7['converted_sampleCount']=isNaN(_0x5264c6[_0x5029('0x5d')])?null:_0x5264c6['sampleCount'];_0x4ddbb7[_0x5029('0x65')]=isNaN(_0x5264c6['channelCount'])?null:_0x5264c6[_0x5029('0x5e')];_0x4ddbb7[_0x5029('0x66')]=isNaN(_0x5264c6[_0x5029('0x60')])?null:_0x5264c6[_0x5029('0x60')];_0x4ddbb7[_0x5029('0x67')]=isNaN(_0x5264c6[_0x5029('0x62')])?null:_0x5264c6['sampleRate'];});_0x33812b['on'](_0x5029('0x68'),function(){fs[_0x5029('0x57')](_0x4b0c5f,parseInt(_0x5029('0x69'),0x8));return db[_0x5029('0x27')][_0x5029('0x6a')](_0x4ddbb7)['then'](function(_0x13ca47){var _0x4a1fe0={'role':_0x544fb3[_0x5029('0x6b')]['role'],'userProfileId':_0x544fb3[_0x5029('0x6b')]['userProfileId']};if(!_0x4a1fe0)throw new Error(_0x5029('0x6c'));if(_0x4a1fe0['role']==='user'){var _0x440658=_0x13ca47['get']({'plain':!![]});return db[_0x5029('0x6d')][_0x5029('0x40')]({'where':{'name':_0x5029('0x21'),'userProfileId':_0x4a1fe0['userProfileId']},'raw':!![]})[_0x5029('0x1e')](function(_0x490821){if(_0x490821&&_0x490821[_0x5029('0x6e')]===0x0){return db[_0x5029('0x22')][_0x5029('0x6a')]({'name':_0x440658[_0x5029('0x24')],'resourceId':_0x440658['id'],'type':_0x490821[_0x5029('0x24')],'sectionId':_0x490821['id']},{})['then'](function(){return _0x13ca47;});}else{return _0x13ca47;}})[_0x5029('0x4b')](function(_0x364f91){logger['error'](_0x5029('0x6f'),_0x364f91);throw _0x364f91;});}return _0x13ca47;})[_0x5029('0x1e')](respondWithResult(_0x1510bb,null))[_0x5029('0x4b')](handleError(_0x1510bb,null));});_0x33812b[_0x5029('0x70')]();}catch(_0x9b1c13){_0x1510bb[_0x5029('0x14')](0x1f4)['send'](_0x9b1c13);}};exports['update']=function(_0xea7fb4,_0x4c0d6f,_0x3a73d5){return db[_0x5029('0x27')]['find']({'where':{'id':_0xea7fb4[_0x5029('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4c0d6f,null))['then'](saveUpdates(_[_0x5029('0x31')](_0xea7fb4[_0x5029('0x6b')],[_0x5029('0x24'),_0x5029('0x71')]),null))['then'](respondWithResult(_0x4c0d6f,null))[_0x5029('0x4b')](handleError(_0x4c0d6f,null));};exports[_0x5029('0x72')]=function(_0x4a2ce8,_0x269406,_0x73c036){return db['Sound']['find']({'where':{'id':_0x4a2ce8['params']['id']}})[_0x5029('0x1e')](function(_0x60440f){if(_0x60440f){return _0x60440f[_0x5029('0x1f')]();}})[_0x5029('0x1e')](function(_0x46be5a){var _0x2ee3bb=path[_0x5029('0x44')](config[_0x5029('0x45')],_0x5029('0x73'),util['format']('%s.%s',_0x46be5a[_0x5029('0x41')],_0x46be5a[_0x5029('0x74')]));var _0xf51086=path[_0x5029('0x44')](config[_0x5029('0x45')],_0x5029('0x46'),util[_0x5029('0x4a')]('%s.%s',_0x46be5a[_0x5029('0x41')],_0x46be5a[_0x5029('0x42')]));fs[_0x5029('0x59')](_0x2ee3bb);fs['unlinkSync'](_0xf51086);return _0x46be5a;})[_0x5029('0x1e')](function(_0x3d3525){if(_0x3d3525){return _0x269406[_0x5029('0x14')](0xcc)['end']();}})[_0x5029('0x1e')](handleEntityNotFound(_0x269406,null))[_0x5029('0x4b')](handleError(_0x269406,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 36cad3c..6a2bfde 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 _0xfffa=['bluebird','request-promise','exports','define','Sound','lodash','util','../../config/logger','api','moment'];(function(_0x53d646,_0x84d78b){var _0x25e395=function(_0xf31d88){while(--_0xf31d88){_0x53d646['push'](_0x53d646['shift']());}};_0x25e395(++_0x84d78b);}(_0xfffa,0x73));var _0xafff=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xfffa[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xafff('0x0'));var util=require(_0xafff('0x1'));var logger=require(_0xafff('0x2'))(_0xafff('0x3'));var moment=require(_0xafff('0x4'));var BPromise=require(_0xafff('0x5'));var rp=require(_0xafff('0x6'));var attributes=require('./sound.attributes');module[_0xafff('0x7')]=function(_0x524b3b,_0x4d5735){return _0x524b3b[_0xafff('0x8')](_0xafff('0x9'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7388=['moment','request-promise','./sound.attributes','exports','define','Sound','tools_sounds','lodash','../../config/logger','api'];(function(_0x430f14,_0x559ef5){var _0x4b7680=function(_0x1445f7){while(--_0x1445f7){_0x430f14['push'](_0x430f14['shift']());}};_0x4b7680(++_0x559ef5);}(_0x7388,0xe3));var _0x8738=function(_0x3bbfce,_0x5e2cc4){_0x3bbfce=_0x3bbfce-0x0;var _0x1de7f4=_0x7388[_0x3bbfce];return _0x1de7f4;};'use strict';var _=require(_0x8738('0x0'));var util=require('util');var logger=require(_0x8738('0x1'))(_0x8738('0x2'));var moment=require(_0x8738('0x3'));var BPromise=require('bluebird');var rp=require(_0x8738('0x4'));var attributes=require(_0x8738('0x5'));module[_0x8738('0x6')]=function(_0x521aba,_0x4cece0){return _0x521aba[_0x8738('0x7')](_0x8738('0x8'),attributes,{'tableName':_0x8738('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 2ecd361..8fec538 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 _0xa9e0=['then','stringify','ShowSound','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','Sound','find','options','raw','where','attributes','include','model','map'];(function(_0x22093a,_0xa7acf1){var _0x2f4989=function(_0x5bf12b){while(--_0x5bf12b){_0x22093a['push'](_0x22093a['shift']());}};_0x2f4989(++_0xa7acf1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['ShowSound']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['include']?_['map'](_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')],function(_0x38e7c4){return{'model':db[_0x38e7c4[_0x0a9e('0x1b')]],'as':_0x38e7c4['as'],'attributes':_0x38e7c4['attributes'],'include':_0x38e7c4[_0x0a9e('0x1a')]?_[_0x0a9e('0x1c')](_0x38e7c4[_0x0a9e('0x1a')],function(_0x4d00e6){return{'model':db[_0x4d00e6[_0x0a9e('0x1b')]],'as':_0x4d00e6['as'],'attributes':_0x4d00e6[_0x0a9e('0x19')],'include':_0x4d00e6[_0x0a9e('0x1a')]?_['map'](_0x4d00e6['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x1b')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x1d')](function(_0x526cf3){logger[_0x0a9e('0xa')]('ShowSound',_0x459eb1);logger[_0x0a9e('0xd')]('ShowSound',_0x459eb1,JSON[_0x0a9e('0x1e')](_0x526cf3));_0x106033(_0x526cf3);})[_0x0a9e('0x13')](function(_0x25fba9){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x25fba9[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x25fba9[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xd8b0=['request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','Sound','options','raw','where','include','model','attributes','map','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Sound,\x20%s,\x20%s'];(function(_0x393708,_0x2090d8){var _0x32c8f9=function(_0x45429c){while(--_0x45429c){_0x393708['push'](_0x393708['shift']());}};_0x32c8f9(++_0x2090d8);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['find']({'raw':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x19')]===undefined?!![]:![]:!![],'where':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')]['attributes']||null:null,'include':_0x5fecbd['options']?_0x5fecbd[_0x0d8b('0x18')]['include']?_['map'](_0x5fecbd['options'][_0x0d8b('0x1b')],function(_0x2b924f){return{'model':db[_0x2b924f[_0x0d8b('0x1c')]],'as':_0x2b924f['as'],'attributes':_0x2b924f[_0x0d8b('0x1d')],'include':_0x2b924f[_0x0d8b('0x1b')]?_[_0x0d8b('0x1e')](_0x2b924f[_0x0d8b('0x1b')],function(_0x4562cb){return{'model':db[_0x4562cb[_0x0d8b('0x1c')]],'as':_0x4562cb['as'],'attributes':_0x4562cb['attributes'],'include':_0x4562cb[_0x0d8b('0x1b')]?_[_0x0d8b('0x1e')](_0x4562cb['include'],function(_0xe1ef20){return{'model':db[_0xe1ef20['model']],'as':_0xe1ef20['as'],'attributes':_0xe1ef20[_0x0d8b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0d8b('0xa')](function(_0xa2af02){logger['info']('ShowSound',_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON['stringify'](_0xa2af02));_0x18dd2d(_0xa2af02);})[_0x0d8b('0x15')](function(_0x59aa83){logger[_0x0d8b('0x11')]('ShowSound',_0x59aa83[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674['error'](0x1f4,_0x59aa83[_0x0d8b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index e36ce6b..d74d1c4 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb43=['util','path','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer'];(function(_0x4b6515,_0x35f66d){var _0x4bc37e=function(_0x45b109){while(--_0x45b109){_0x4b6515['push'](_0x4b6515['shift']());}};_0x4bc37e(++_0x35f66d);}(_0xeb43,0x149));var _0x3eb4=function(_0x16bb0e,_0x343132){_0x16bb0e=_0x16bb0e-0x0;var _0x102b8b=_0xeb43[_0x16bb0e];return _0x102b8b;};'use strict';var multer=require(_0x3eb4('0x0'));var util=require(_0x3eb4('0x1'));var path=require(_0x3eb4('0x2'));var timeout=require('connect-timeout');var express=require(_0x3eb4('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3eb4('0x4'));var config=require(_0x3eb4('0x5'));var controller=require('./squareMessage.controller');router['get']('/',auth[_0x3eb4('0x6')](),controller[_0x3eb4('0x7')]);router['get'](_0x3eb4('0x8'),auth['isAuthenticated'](),controller[_0x3eb4('0x9')]);router['post']('/',auth[_0x3eb4('0x6')](),controller[_0x3eb4('0xa')]);router[_0x3eb4('0xb')](_0x3eb4('0x8'),auth[_0x3eb4('0x6')](),controller['update']);router[_0x3eb4('0xc')]('/:id',auth[_0x3eb4('0x6')](),controller[_0x3eb4('0xd')]);module[_0x3eb4('0xe')]=router; \ No newline at end of file +var _0x8d57=['post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','index','/:id','isAuthenticated','show'];(function(_0x26f7ef,_0x4d8d60){var _0x1f24bf=function(_0x31da25){while(--_0x31da25){_0x26f7ef['push'](_0x26f7ef['shift']());}};_0x1f24bf(++_0x4d8d60);}(_0x8d57,0xaf));var _0x78d5=function(_0x2053ea,_0x1ab2d4){_0x2053ea=_0x2053ea-0x0;var _0x2232c4=_0x8d57[_0x2053ea];return _0x2232c4;};'use strict';var multer=require('multer');var util=require(_0x78d5('0x0'));var path=require(_0x78d5('0x1'));var timeout=require(_0x78d5('0x2'));var express=require(_0x78d5('0x3'));var router=express[_0x78d5('0x4')]();var auth=require(_0x78d5('0x5'));var interaction=require(_0x78d5('0x6'));var config=require(_0x78d5('0x7'));var controller=require(_0x78d5('0x8'));router[_0x78d5('0x9')]('/',auth['isAuthenticated'](),controller[_0x78d5('0xa')]);router[_0x78d5('0x9')](_0x78d5('0xb'),auth[_0x78d5('0xc')](),controller[_0x78d5('0xd')]);router[_0x78d5('0xe')]('/',auth[_0x78d5('0xc')](),controller[_0x78d5('0xf')]);router[_0x78d5('0x10')]('/:id',auth[_0x78d5('0xc')](),controller[_0x78d5('0x11')]);router[_0x78d5('0x12')](_0x78d5('0xb'),auth['isAuthenticated'](),controller[_0x78d5('0x13')]);module[_0x78d5('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index e60c6c2..592c2f1 100644 --- a/server/api/squareMessage/squareMessage.attributes.js +++ b/server/api/squareMessage/squareMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad95=['out','sequelize','exports','TEXT','medium','ENUM'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xad95,0x1f3));var _0x5ad9=function(_0x4788c7,_0x32c7e7){_0x4788c7=_0x4788c7-0x0;var _0x81fd6b=_0xad95[_0x4788c7];return _0x81fd6b;};'use strict';var Sequelize=require(_0x5ad9('0x0'));module[_0x5ad9('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x5ad9('0x2')](_0x5ad9('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x5ad9('0x4')]('in',_0x5ad9('0x5')),'defaultValue':_0x5ad9('0x5'),'allowNull':![]}}; \ No newline at end of file +var _0x6092=['TEXT','medium','ENUM','out','exports','STRING'];(function(_0x3fa838,_0x5acc2e){var _0x1201ef=function(_0x255532){while(--_0x255532){_0x3fa838['push'](_0x3fa838['shift']());}};_0x1201ef(++_0x5acc2e);}(_0x6092,0xb2));var _0x2609=function(_0x4e3740,_0x4cc8c0){_0x4e3740=_0x4e3740-0x0;var _0x13968d=_0x6092[_0x4e3740];return _0x13968d;};'use strict';var Sequelize=require('sequelize');module[_0x2609('0x0')]={'uniqueid':{'type':Sequelize[_0x2609('0x1')]},'body':{'type':Sequelize[_0x2609('0x2')](_0x2609('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x2609('0x4')]('in',_0x2609('0x5')),'defaultValue':_0x2609('0x5'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index d8679a8..27edc55 100644 --- a/server/api/squareMessage/squareMessage.controller.js +++ b/server/api/squareMessage/squareMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a63=['json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','index','SquareMessage','rawAttributes','model','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','map','type','key','options','include','findAll','rows','catch','show','params','create','body','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end'];(function(_0x52534c,_0xf3a3f4){var _0x3d2cfe=function(_0xef139d){while(--_0xef139d){_0x52534c['push'](_0x52534c['shift']());}};_0x3d2cfe(++_0xf3a3f4);}(_0x9a63,0x70));var _0x39a6=function(_0x503741,_0x4ead4e){_0x503741=_0x503741-0x0;var _0x1f9fc3=_0x9a63[_0x503741];return _0x1f9fc3;};'use strict';var pdf=require(_0x39a6('0x0'));var emlformat=require(_0x39a6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x39a6('0x2'));var jsonpatch=require(_0x39a6('0x3'));var rp=require(_0x39a6('0x4'));var moment=require('moment');var BPromise=require(_0x39a6('0x5'));var Mustache=require(_0x39a6('0x6'));var util=require(_0x39a6('0x7'));var path=require('path');var sox=require(_0x39a6('0x8'));var csv=require(_0x39a6('0x9'));var ejs=require(_0x39a6('0xa'));var fs=require('fs');var _=require(_0x39a6('0xb'));var squel=require(_0x39a6('0xc'));var crypto=require('crypto');var jsforce=require(_0x39a6('0xd'));var deskjs=require(_0x39a6('0xe'));var toCsv=require(_0x39a6('0x9'));var querystring=require(_0x39a6('0xf'));var Papa=require(_0x39a6('0x10'));var authService=require('../../components/auth/service');var hardwareService=require(_0x39a6('0x11'));var Redis=require(_0x39a6('0x12'));var qs=require(_0x39a6('0x13'));var logger=require(_0x39a6('0x14'))(_0x39a6('0x15'));var utils=require(_0x39a6('0x16'));var config=require(_0x39a6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x93b86c,_0x3fd07f){_0x3fd07f=_0x3fd07f||0xcc;return function(_0x1ecf26){if(_0x1ecf26){return _0x93b86c['sendStatus'](_0x3fd07f);}return _0x93b86c[_0x39a6('0x18')](_0x3fd07f)[_0x39a6('0x19')]();};}function respondWithResult(_0x4bc06e,_0x13fec4){_0x13fec4=_0x13fec4||0xc8;return function(_0x2804fb){if(_0x2804fb){return _0x4bc06e[_0x39a6('0x18')](_0x13fec4)[_0x39a6('0x1a')](_0x2804fb);}};}function respondWithFilteredResult(_0x386b02,_0x303979){return function(_0x17dfa6){if(_0x17dfa6){var _0x544d1a=_0x17dfa6[_0x39a6('0x1b')],_0x3c5e09=_0x303979[_0x39a6('0x1c')],_0x7a88f3=_0x303979[_0x39a6('0x1c')]+_0x303979[_0x39a6('0x1d')],_0x38aec8;if(_0x7a88f3>=_0x544d1a){_0x7a88f3=_0x544d1a;_0x38aec8=0xc8;}else{_0x38aec8=0xce;}_0x386b02[_0x39a6('0x18')](_0x38aec8);return _0x386b02[_0x39a6('0x1e')](_0x39a6('0x1f'),_0x3c5e09+'-'+_0x7a88f3+'/'+_0x544d1a)['json'](_0x17dfa6);}return null;};}function patchUpdates(_0x1e8e8c){return function(_0x29f86c){try{jsonpatch[_0x39a6('0x20')](_0x29f86c,_0x1e8e8c,!![]);}catch(_0x46fe37){return BPromise['reject'](_0x46fe37);}return _0x29f86c[_0x39a6('0x21')]();};}function saveUpdates(_0x5bf2e1,_0x3fc51d){return function(_0x1e0d4a){if(_0x1e0d4a){return _0x1e0d4a[_0x39a6('0x22')](_0x5bf2e1)[_0x39a6('0x23')](function(_0x30d506){return _0x30d506;});}return null;};}function removeEntity(_0x51dc59,_0x316a46){return function(_0x50cdad){if(_0x50cdad){return _0x50cdad[_0x39a6('0x24')]()[_0x39a6('0x23')](function(){_0x51dc59['status'](0xcc)[_0x39a6('0x19')]();});}};}function handleEntityNotFound(_0x393f89,_0x26dcd4){return function(_0x362972){if(!_0x362972){_0x393f89[_0x39a6('0x25')](0x194);}return _0x362972;};}function handleError(_0x1c8f12,_0x443f2c){_0x443f2c=_0x443f2c||0x1f4;return function(_0x245fe9){logger['error'](_0x245fe9['stack']);if(_0x245fe9['name']){delete _0x245fe9[_0x39a6('0x26')];}_0x1c8f12[_0x39a6('0x18')](_0x443f2c)['send'](_0x245fe9);};}exports[_0x39a6('0x27')]=function(_0x26e9b5,_0x3b79c8){var _0x24ee83={},_0x1e977b={},_0x24f999={'count':0x0,'rows':[]};var _0x49e351=db[_0x39a6('0x28')][_0x39a6('0x29')];_0x1e977b[_0x39a6('0x2a')]=_[_0x39a6('0x2b')](_0x49e351);_0x1e977b['query']=_[_0x39a6('0x2b')](_0x26e9b5[_0x39a6('0x2c')]);_0x1e977b[_0x39a6('0x2d')]=_[_0x39a6('0x2e')](_0x1e977b[_0x39a6('0x2a')],_0x1e977b[_0x39a6('0x2c')]);_0x24ee83['attributes']=_[_0x39a6('0x2e')](_0x1e977b[_0x39a6('0x2a')],qs[_0x39a6('0x2f')](_0x26e9b5['query'][_0x39a6('0x2f')]));_0x24ee83['attributes']=_0x24ee83[_0x39a6('0x30')]['length']?_0x24ee83['attributes']:_0x1e977b[_0x39a6('0x2a')];if(!_0x26e9b5['query']['hasOwnProperty'](_0x39a6('0x31'))){_0x24ee83[_0x39a6('0x1d')]=qs['limit'](_0x26e9b5[_0x39a6('0x2c')][_0x39a6('0x1d')]);_0x24ee83[_0x39a6('0x1c')]=qs[_0x39a6('0x1c')](_0x26e9b5[_0x39a6('0x2c')]['offset']);}_0x24ee83[_0x39a6('0x32')]=qs[_0x39a6('0x33')](_0x26e9b5['query'][_0x39a6('0x33')]);_0x24ee83[_0x39a6('0x34')]=qs[_0x39a6('0x2d')](_[_0x39a6('0x35')](_0x26e9b5[_0x39a6('0x2c')],_0x1e977b[_0x39a6('0x2d')]));if(_0x26e9b5[_0x39a6('0x2c')][_0x39a6('0x36')]){_0x24ee83[_0x39a6('0x34')]=_[_0x39a6('0x37')](_0x24ee83[_0x39a6('0x34')],{'$or':_[_0x39a6('0x38')](_0x49e351,function(_0x4ba943){if(_0x4ba943[_0x39a6('0x39')][_0x39a6('0x3a')]!=='VIRTUAL'){var _0x1e0853={};_0x1e0853[_0x4ba943['field']]={'$like':'%'+_0x26e9b5[_0x39a6('0x2c')]['filter']+'%'};return _0x1e0853;}})});}_0x24ee83=_[_0x39a6('0x37')]({},_0x24ee83,_0x26e9b5[_0x39a6('0x3b')]);var _0x2c7626={'where':_0x24ee83[_0x39a6('0x34')]};return db['SquareMessage'][_0x39a6('0x1b')](_0x2c7626)[_0x39a6('0x23')](function(_0x324a1d){_0x24f999[_0x39a6('0x1b')]=_0x324a1d;if(_0x26e9b5[_0x39a6('0x2c')]['includeAll']){_0x24ee83[_0x39a6('0x3c')]=[{'all':!![]}];}return db[_0x39a6('0x28')][_0x39a6('0x3d')](_0x24ee83);})[_0x39a6('0x23')](function(_0x558ccc){_0x24f999[_0x39a6('0x3e')]=_0x558ccc;return _0x24f999;})[_0x39a6('0x23')](respondWithFilteredResult(_0x3b79c8,_0x24ee83))[_0x39a6('0x3f')](handleError(_0x3b79c8,null));};exports[_0x39a6('0x40')]=function(_0x1c2269,_0x39dad0){var _0x445ca1={'raw':!![],'where':{'id':_0x1c2269[_0x39a6('0x41')]['id']}},_0x121fc2={};_0x121fc2[_0x39a6('0x2a')]=_[_0x39a6('0x2b')](db[_0x39a6('0x28')][_0x39a6('0x29')]);_0x121fc2[_0x39a6('0x2c')]=_['keys'](_0x1c2269['query']);_0x121fc2['filters']=_['intersection'](_0x121fc2[_0x39a6('0x2a')],_0x121fc2['query']);_0x445ca1[_0x39a6('0x30')]=_['intersection'](_0x121fc2[_0x39a6('0x2a')],qs['fields'](_0x1c2269[_0x39a6('0x2c')][_0x39a6('0x2f')]));_0x445ca1[_0x39a6('0x30')]=_0x445ca1[_0x39a6('0x30')]['length']?_0x445ca1[_0x39a6('0x30')]:_0x121fc2[_0x39a6('0x2a')];if(_0x1c2269['query']['includeAll']){_0x445ca1[_0x39a6('0x3c')]=[{'all':!![]}];}_0x445ca1=_[_0x39a6('0x37')]({},_0x445ca1,_0x1c2269[_0x39a6('0x3b')]);return db[_0x39a6('0x28')]['find'](_0x445ca1)['then'](handleEntityNotFound(_0x39dad0,null))[_0x39a6('0x23')](respondWithResult(_0x39dad0,null))[_0x39a6('0x3f')](handleError(_0x39dad0,null));};exports['create']=function(_0x58618d,_0x29e420){return db[_0x39a6('0x28')][_0x39a6('0x42')](_0x58618d['body'],{})[_0x39a6('0x23')](respondWithResult(_0x29e420,0xc9))[_0x39a6('0x3f')](handleError(_0x29e420,null));};exports['update']=function(_0x345a1d,_0xb92071){if(_0x345a1d[_0x39a6('0x43')]['id']){delete _0x345a1d['body']['id'];}return db[_0x39a6('0x28')][_0x39a6('0x44')]({'where':{'id':_0x345a1d[_0x39a6('0x41')]['id']}})[_0x39a6('0x23')](handleEntityNotFound(_0xb92071,null))[_0x39a6('0x23')](saveUpdates(_0x345a1d['body'],null))[_0x39a6('0x23')](respondWithResult(_0xb92071,null))[_0x39a6('0x3f')](handleError(_0xb92071,null));};exports[_0x39a6('0x24')]=function(_0x51e1e2,_0x3c02ee){return db[_0x39a6('0x28')][_0x39a6('0x44')]({'where':{'id':_0x51e1e2[_0x39a6('0x41')]['id']}})[_0x39a6('0x23')](handleEntityNotFound(_0x3c02ee,null))[_0x39a6('0x23')](removeEntity(_0x3c02ee,null))[_0x39a6('0x3f')](handleError(_0x3c02ee,null));}; \ No newline at end of file +var _0x2664=['ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','SquareMessage','rawAttributes','keys','filters','intersection','model','query','attributes','fields','length','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','field','includeAll','include','findAll','rows','catch','options','find','create','body','params','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware'];(function(_0x4f0c2b,_0x2c9d14){var _0x526436=function(_0x2e13b6){while(--_0x2e13b6){_0x4f0c2b['push'](_0x4f0c2b['shift']());}};_0x526436(++_0x2c9d14);}(_0x2664,0x197));var _0x4266=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x2664[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require(_0x4266('0x0'));var emlformat=require(_0x4266('0x1'));var rimraf=require(_0x4266('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4266('0x3'));var moment=require(_0x4266('0x4'));var BPromise=require(_0x4266('0x5'));var Mustache=require(_0x4266('0x6'));var util=require(_0x4266('0x7'));var path=require('path');var sox=require(_0x4266('0x8'));var csv=require(_0x4266('0x9'));var ejs=require(_0x4266('0xa'));var fs=require('fs');var _=require(_0x4266('0xb'));var squel=require(_0x4266('0xc'));var crypto=require(_0x4266('0xd'));var jsforce=require(_0x4266('0xe'));var deskjs=require(_0x4266('0xf'));var toCsv=require(_0x4266('0x9'));var querystring=require(_0x4266('0x10'));var Papa=require('papaparse');var authService=require(_0x4266('0x11'));var hardwareService=require(_0x4266('0x12'));var Redis=require(_0x4266('0x13'));var qs=require(_0x4266('0x14'));var logger=require(_0x4266('0x15'))('api');var utils=require(_0x4266('0x16'));var config=require(_0x4266('0x17'));var db=require(_0x4266('0x18'))['db'];function respondWithStatusCode(_0x3b5f28,_0x3c828c){_0x3c828c=_0x3c828c||0xcc;return function(_0x2e7cd0){if(_0x2e7cd0){return _0x3b5f28[_0x4266('0x19')](_0x3c828c);}return _0x3b5f28[_0x4266('0x1a')](_0x3c828c)[_0x4266('0x1b')]();};}function respondWithResult(_0x594708,_0x3d3cda){_0x3d3cda=_0x3d3cda||0xc8;return function(_0x439783){if(_0x439783){return _0x594708['status'](_0x3d3cda)[_0x4266('0x1c')](_0x439783);}};}function respondWithFilteredResult(_0x4eb56f,_0x2f5833){return function(_0x281b2d){if(_0x281b2d){var _0x3042ee=_0x281b2d[_0x4266('0x1d')],_0x4ff998=_0x2f5833[_0x4266('0x1e')],_0x4f6f69=_0x2f5833[_0x4266('0x1e')]+_0x2f5833['limit'],_0x186079;if(_0x4f6f69>=_0x3042ee){_0x4f6f69=_0x3042ee;_0x186079=0xc8;}else{_0x186079=0xce;}_0x4eb56f[_0x4266('0x1a')](_0x186079);return _0x4eb56f[_0x4266('0x1f')](_0x4266('0x20'),_0x4ff998+'-'+_0x4f6f69+'/'+_0x3042ee)[_0x4266('0x1c')](_0x281b2d);}return null;};}function patchUpdates(_0x54d635){return function(_0x178240){try{jsonpatch[_0x4266('0x21')](_0x178240,_0x54d635,!![]);}catch(_0x11d665){return BPromise[_0x4266('0x22')](_0x11d665);}return _0x178240[_0x4266('0x23')]();};}function saveUpdates(_0x487139,_0x29465f){return function(_0x323455){if(_0x323455){return _0x323455[_0x4266('0x24')](_0x487139)[_0x4266('0x25')](function(_0x40677e){return _0x40677e;});}return null;};}function removeEntity(_0x199248,_0x4f68a0){return function(_0x2be3cb){if(_0x2be3cb){return _0x2be3cb[_0x4266('0x26')]()[_0x4266('0x25')](function(){_0x199248['status'](0xcc)[_0x4266('0x1b')]();});}};}function handleEntityNotFound(_0x5a54a0,_0x3e3fae){return function(_0x10cf03){if(!_0x10cf03){_0x5a54a0['sendStatus'](0x194);}return _0x10cf03;};}function handleError(_0x51e970,_0x26b9fd){_0x26b9fd=_0x26b9fd||0x1f4;return function(_0x159a04){logger[_0x4266('0x27')](_0x159a04['stack']);if(_0x159a04[_0x4266('0x28')]){delete _0x159a04[_0x4266('0x28')];}_0x51e970[_0x4266('0x1a')](_0x26b9fd)['send'](_0x159a04);};}exports['index']=function(_0x307e5c,_0xd225d1){var _0x524630={},_0x3748b9={},_0x10a506={'count':0x0,'rows':[]};var _0x3feaf0=db[_0x4266('0x29')][_0x4266('0x2a')];_0x3748b9['model']=_['keys'](_0x3feaf0);_0x3748b9['query']=_[_0x4266('0x2b')](_0x307e5c['query']);_0x3748b9[_0x4266('0x2c')]=_[_0x4266('0x2d')](_0x3748b9[_0x4266('0x2e')],_0x3748b9[_0x4266('0x2f')]);_0x524630[_0x4266('0x30')]=_[_0x4266('0x2d')](_0x3748b9[_0x4266('0x2e')],qs[_0x4266('0x31')](_0x307e5c[_0x4266('0x2f')]['fields']));_0x524630[_0x4266('0x30')]=_0x524630[_0x4266('0x30')][_0x4266('0x32')]?_0x524630[_0x4266('0x30')]:_0x3748b9[_0x4266('0x2e')];if(!_0x307e5c['query']['hasOwnProperty'](_0x4266('0x33'))){_0x524630[_0x4266('0x34')]=qs['limit'](_0x307e5c[_0x4266('0x2f')][_0x4266('0x34')]);_0x524630[_0x4266('0x1e')]=qs[_0x4266('0x1e')](_0x307e5c[_0x4266('0x2f')]['offset']);}_0x524630[_0x4266('0x35')]=qs[_0x4266('0x36')](_0x307e5c['query'][_0x4266('0x36')]);_0x524630[_0x4266('0x37')]=qs[_0x4266('0x2c')](_['pick'](_0x307e5c[_0x4266('0x2f')],_0x3748b9[_0x4266('0x2c')]));if(_0x307e5c[_0x4266('0x2f')][_0x4266('0x38')]){_0x524630['where']=_[_0x4266('0x39')](_0x524630[_0x4266('0x37')],{'$or':_['map'](_0x3feaf0,function(_0x98fdae){if(_0x98fdae[_0x4266('0x3a')]['key']!==_0x4266('0x3b')){var _0x53a1d8={};_0x53a1d8[_0x98fdae[_0x4266('0x3c')]]={'$like':'%'+_0x307e5c[_0x4266('0x2f')][_0x4266('0x38')]+'%'};return _0x53a1d8;}})});}_0x524630=_['merge']({},_0x524630,_0x307e5c['options']);var _0x2e6971={'where':_0x524630[_0x4266('0x37')]};return db['SquareMessage']['count'](_0x2e6971)['then'](function(_0x36767a){_0x10a506[_0x4266('0x1d')]=_0x36767a;if(_0x307e5c[_0x4266('0x2f')][_0x4266('0x3d')]){_0x524630[_0x4266('0x3e')]=[{'all':!![]}];}return db[_0x4266('0x29')][_0x4266('0x3f')](_0x524630);})[_0x4266('0x25')](function(_0x38888){_0x10a506[_0x4266('0x40')]=_0x38888;return _0x10a506;})[_0x4266('0x25')](respondWithFilteredResult(_0xd225d1,_0x524630))[_0x4266('0x41')](handleError(_0xd225d1,null));};exports['show']=function(_0x2e3617,_0x3c5f13){var _0x2fe803={'raw':!![],'where':{'id':_0x2e3617['params']['id']}},_0x21f31a={};_0x21f31a['model']=_[_0x4266('0x2b')](db[_0x4266('0x29')][_0x4266('0x2a')]);_0x21f31a[_0x4266('0x2f')]=_[_0x4266('0x2b')](_0x2e3617['query']);_0x21f31a[_0x4266('0x2c')]=_[_0x4266('0x2d')](_0x21f31a[_0x4266('0x2e')],_0x21f31a[_0x4266('0x2f')]);_0x2fe803[_0x4266('0x30')]=_[_0x4266('0x2d')](_0x21f31a[_0x4266('0x2e')],qs['fields'](_0x2e3617[_0x4266('0x2f')][_0x4266('0x31')]));_0x2fe803[_0x4266('0x30')]=_0x2fe803['attributes'][_0x4266('0x32')]?_0x2fe803[_0x4266('0x30')]:_0x21f31a[_0x4266('0x2e')];if(_0x2e3617[_0x4266('0x2f')]['includeAll']){_0x2fe803[_0x4266('0x3e')]=[{'all':!![]}];}_0x2fe803=_[_0x4266('0x39')]({},_0x2fe803,_0x2e3617[_0x4266('0x42')]);return db[_0x4266('0x29')][_0x4266('0x43')](_0x2fe803)[_0x4266('0x25')](handleEntityNotFound(_0x3c5f13,null))[_0x4266('0x25')](respondWithResult(_0x3c5f13,null))[_0x4266('0x41')](handleError(_0x3c5f13,null));};exports[_0x4266('0x44')]=function(_0x54b13a,_0x237f8b){return db[_0x4266('0x29')][_0x4266('0x44')](_0x54b13a[_0x4266('0x45')],{})['then'](respondWithResult(_0x237f8b,0xc9))[_0x4266('0x41')](handleError(_0x237f8b,null));};exports[_0x4266('0x24')]=function(_0x35530a,_0x5b9107){if(_0x35530a[_0x4266('0x45')]['id']){delete _0x35530a[_0x4266('0x45')]['id'];}return db[_0x4266('0x29')][_0x4266('0x43')]({'where':{'id':_0x35530a['params']['id']}})[_0x4266('0x25')](handleEntityNotFound(_0x5b9107,null))[_0x4266('0x25')](saveUpdates(_0x35530a['body'],null))['then'](respondWithResult(_0x5b9107,null))[_0x4266('0x41')](handleError(_0x5b9107,null));};exports['destroy']=function(_0x286d10,_0x5c057e){return db[_0x4266('0x29')][_0x4266('0x43')]({'where':{'id':_0x286d10[_0x4266('0x46')]['id']}})['then'](handleEntityNotFound(_0x5c057e,null))[_0x4266('0x25')](removeEntity(_0x5c057e,null))[_0x4266('0x41')](handleError(_0x5c057e,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 2b220a9..07cc05f 100644 --- a/server/api/squareMessage/squareMessage.model.js +++ b/server/api/squareMessage/squareMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9d1=['util','../../config/logger','api','moment','bluebird','request-promise','./squareMessage.attributes','exports','define','square_messages','lodash'];(function(_0x473e5d,_0x334ca4){var _0x5e3b5b=function(_0x3e1f4b){while(--_0x3e1f4b){_0x473e5d['push'](_0x473e5d['shift']());}};_0x5e3b5b(++_0x334ca4);}(_0xa9d1,0x1a1));var _0x1a9d=function(_0x20bd43,_0x11d830){_0x20bd43=_0x20bd43-0x0;var _0x543c8c=_0xa9d1[_0x20bd43];return _0x543c8c;};'use strict';var _=require(_0x1a9d('0x0'));var util=require(_0x1a9d('0x1'));var logger=require(_0x1a9d('0x2'))(_0x1a9d('0x3'));var moment=require(_0x1a9d('0x4'));var BPromise=require(_0x1a9d('0x5'));var rp=require(_0x1a9d('0x6'));var attributes=require(_0x1a9d('0x7'));module[_0x1a9d('0x8')]=function(_0xccfbd0,_0x2c576a){return _0xccfbd0[_0x1a9d('0x9')]('SquareMessage',attributes,{'tableName':_0x1a9d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x921c=['../../config/logger','moment','bluebird','request-promise','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util'];(function(_0x4d8bcd,_0x32df96){var _0x18206f=function(_0x393527){while(--_0x393527){_0x4d8bcd['push'](_0x4d8bcd['shift']());}};_0x18206f(++_0x32df96);}(_0x921c,0x77));var _0xc921=function(_0x32ae89,_0x5eb9e4){_0x32ae89=_0x32ae89-0x0;var _0x2a1292=_0x921c[_0x32ae89];return _0x2a1292;};'use strict';var _=require(_0xc921('0x0'));var util=require(_0xc921('0x1'));var logger=require(_0xc921('0x2'))('api');var moment=require(_0xc921('0x3'));var BPromise=require(_0xc921('0x4'));var rp=require(_0xc921('0x5'));var attributes=require(_0xc921('0x6'));module[_0xc921('0x7')]=function(_0x3f754,_0x4c1d37){return _0x3f754[_0xc921('0x8')](_0xc921('0x9'),attributes,{'tableName':_0xc921('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 464ae3f..e8cf784 100644 --- a/server/api/squareMessage/squareMessage.rpc.js +++ b/server/api/squareMessage/squareMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5226=['then','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','SquareMessage','body','options','raw','CreateSquareMessage','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','request'];(function(_0x30689e,_0x304b51){var _0xb107b5=function(_0x2b43ae){while(--_0x2b43ae){_0x30689e['push'](_0x30689e['shift']());}};_0xb107b5(++_0x304b51);}(_0x5226,0x199));var _0x6522=function(_0x5d47d7,_0x18c86b){_0x5d47d7=_0x5d47d7-0x0;var _0x5b82b0=_0x5226[_0x5d47d7];return _0x5b82b0;};'use strict';var _=require(_0x6522('0x0'));var util=require(_0x6522('0x1'));var moment=require(_0x6522('0x2'));var BPromise=require(_0x6522('0x3'));var rs=require(_0x6522('0x4'));var fs=require('fs');var Redis=require(_0x6522('0x5'));var db=require(_0x6522('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6522('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6522('0x8'));var client=jayson[_0x6522('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x317cde,_0x5c60db,_0x2e8d5e){return new BPromise(function(_0x55a36d,_0x5176f8){return client[_0x6522('0xa')](_0x317cde,_0x2e8d5e)[_0x6522('0xb')](function(_0x58ea85){logger['info'](_0x6522('0xc'),_0x5c60db,_0x6522('0xd'));logger['debug'](_0x6522('0xe'),_0x5c60db,_0x6522('0xd'),JSON[_0x6522('0xf')](_0x58ea85));if(_0x58ea85['error']){if(_0x58ea85['error'][_0x6522('0x10')]===0x1f4){logger[_0x6522('0x11')]('SquareMessage,\x20%s,\x20%s',_0x5c60db,_0x58ea85[_0x6522('0x11')]['message']);return _0x5176f8(_0x58ea85['error'][_0x6522('0x12')]);}logger[_0x6522('0x11')](_0x6522('0xc'),_0x5c60db,_0x58ea85[_0x6522('0x11')][_0x6522('0x12')]);return _0x55a36d(_0x58ea85[_0x6522('0x11')][_0x6522('0x12')]);}else{logger[_0x6522('0x13')](_0x6522('0xc'),_0x5c60db,_0x6522('0xd'));_0x55a36d(_0x58ea85[_0x6522('0x14')][_0x6522('0x12')]);}})[_0x6522('0x15')](function(_0x295cac){logger[_0x6522('0x11')]('SquareMessage,\x20%s,\x20%s',_0x5c60db,_0x295cac);_0x5176f8(_0x295cac);});});}exports['CreateSquareMessage']=function(_0x491247){var _0x240520=this;return new Promise(function(_0x4e1485,_0x43427b){return db[_0x6522('0x16')]['create'](_0x491247[_0x6522('0x17')],{'raw':_0x491247['options']?_0x491247[_0x6522('0x18')][_0x6522('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1618a3){logger[_0x6522('0x13')](_0x6522('0x1a'),_0x491247);logger[_0x6522('0x1b')](_0x6522('0x1a'),_0x491247,JSON[_0x6522('0xf')](_0x1618a3));_0x4e1485(_0x1618a3);})[_0x6522('0x15')](function(_0x49df6a){logger[_0x6522('0x11')](_0x6522('0x1a'),_0x49df6a[_0x6522('0x12')],_0x491247);_0x43427b(_0x240520[_0x6522('0x11')](0x1f4,_0x49df6a[_0x6522('0x12')]));});});}; \ No newline at end of file +var _0xa562=['jayson/promise','client','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateSquareMessage','SquareMessage','create','body','options','raw','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x9de7ee,_0x2cd261){var _0x235ec3=function(_0x2cbab0){while(--_0x2cbab0){_0x9de7ee['push'](_0x9de7ee['shift']());}};_0x235ec3(++_0x2cd261);}(_0xa562,0xfd));var _0x2a56=function(_0x5c2c72,_0x22cf09){_0x5c2c72=_0x5c2c72-0x0;var _0x11c44c=_0xa562[_0x5c2c72];return _0x11c44c;};'use strict';var _=require('lodash');var util=require(_0x2a56('0x0'));var moment=require(_0x2a56('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a56('0x2'));var db=require(_0x2a56('0x3'))['db'];var utils=require(_0x2a56('0x4'));var logger=require(_0x2a56('0x5'))(_0x2a56('0x6'));var config=require('../../config/environment');var jayson=require(_0x2a56('0x7'));var client=jayson[_0x2a56('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12a901,_0x3485a3,_0x3fd22f){return new BPromise(function(_0x29f63b,_0xd011fd){return client['request'](_0x12a901,_0x3fd22f)[_0x2a56('0x9')](function(_0x591f7e){logger[_0x2a56('0xa')](_0x2a56('0xb'),_0x3485a3,_0x2a56('0xc'));logger[_0x2a56('0xd')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x3485a3,_0x2a56('0xc'),JSON[_0x2a56('0xe')](_0x591f7e));if(_0x591f7e[_0x2a56('0xf')]){if(_0x591f7e['error'][_0x2a56('0x10')]===0x1f4){logger[_0x2a56('0xf')]('SquareMessage,\x20%s,\x20%s',_0x3485a3,_0x591f7e[_0x2a56('0xf')][_0x2a56('0x11')]);return _0xd011fd(_0x591f7e[_0x2a56('0xf')]['message']);}logger[_0x2a56('0xf')](_0x2a56('0xb'),_0x3485a3,_0x591f7e[_0x2a56('0xf')][_0x2a56('0x11')]);return _0x29f63b(_0x591f7e['error'][_0x2a56('0x11')]);}else{logger[_0x2a56('0xa')](_0x2a56('0xb'),_0x3485a3,'request\x20sent');_0x29f63b(_0x591f7e[_0x2a56('0x12')][_0x2a56('0x11')]);}})['catch'](function(_0x28ffd3){logger[_0x2a56('0xf')](_0x2a56('0xb'),_0x3485a3,_0x28ffd3);_0xd011fd(_0x28ffd3);});});}exports[_0x2a56('0x13')]=function(_0x262720){var _0x3c83b0=this;return new Promise(function(_0xdaddbb,_0x51f336){return db[_0x2a56('0x14')][_0x2a56('0x15')](_0x262720[_0x2a56('0x16')],{'raw':_0x262720[_0x2a56('0x17')]?_0x262720[_0x2a56('0x17')][_0x2a56('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0xeec026){logger[_0x2a56('0xa')](_0x2a56('0x13'),_0x262720);logger[_0x2a56('0xd')](_0x2a56('0x13'),_0x262720,JSON[_0x2a56('0xe')](_0xeec026));_0xdaddbb(_0xeec026);})[_0x2a56('0x19')](function(_0x410d4c){logger['error'](_0x2a56('0x13'),_0x410d4c[_0x2a56('0x11')],_0x262720);_0x51f336(_0x3c83b0['error'](0x1f4,_0x410d4c['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 9a3c3a1..3d71978 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 _0x25a3=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/test','test','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service'];(function(_0x196fb1,_0x124396){var _0x149dd4=function(_0x2801ce){while(--_0x2801ce){_0x196fb1['push'](_0x196fb1['shift']());}};_0x149dd4(++_0x124396);}(_0x25a3,0x121));var _0x325a=function(_0x26cc70,_0x56a67a){_0x26cc70=_0x26cc70-0x0;var _0x1fa220=_0x25a3[_0x26cc70];return _0x1fa220;};'use strict';var multer=require(_0x325a('0x0'));var util=require(_0x325a('0x1'));var path=require(_0x325a('0x2'));var timeout=require('connect-timeout');var express=require(_0x325a('0x3'));var router=express['Router']();var auth=require(_0x325a('0x4'));var interaction=require(_0x325a('0x5'));var config=require(_0x325a('0x6'));var controller=require('./squareOdbc.controller');router[_0x325a('0x7')]('/',auth[_0x325a('0x8')](),controller[_0x325a('0x9')]);router['get']('/:id',auth[_0x325a('0x8')](),controller[_0x325a('0xa')]);router[_0x325a('0x7')](_0x325a('0xb'),auth['isAuthenticated'](),timeout('15s'),controller[_0x325a('0xc')]);router[_0x325a('0xd')]('/',auth[_0x325a('0x8')](),controller[_0x325a('0xe')]);router[_0x325a('0xf')](_0x325a('0x10'),auth['isAuthenticated'](),controller[_0x325a('0x11')]);router[_0x325a('0x12')]('/:id',auth[_0x325a('0x8')](),controller[_0x325a('0x13')]);module[_0x325a('0x14')]=router; \ No newline at end of file +var _0x834d=['multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','/:id','show','/:id/test','15s','post','put','update','delete','destroy','exports'];(function(_0x13acab,_0x51dbf7){var _0x533378=function(_0x5621bd){while(--_0x5621bd){_0x13acab['push'](_0x13acab['shift']());}};_0x533378(++_0x51dbf7);}(_0x834d,0x140));var _0xd834=function(_0x1cc99b,_0x58485a){_0x1cc99b=_0x1cc99b-0x0;var _0x17a61f=_0x834d[_0x1cc99b];return _0x17a61f;};'use strict';var multer=require(_0xd834('0x0'));var util=require(_0xd834('0x1'));var path=require('path');var timeout=require(_0xd834('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xd834('0x3'));var interaction=require(_0xd834('0x4'));var config=require(_0xd834('0x5'));var controller=require(_0xd834('0x6'));router['get']('/',auth[_0xd834('0x7')](),controller[_0xd834('0x8')]);router[_0xd834('0x9')](_0xd834('0xa'),auth[_0xd834('0x7')](),controller[_0xd834('0xb')]);router[_0xd834('0x9')](_0xd834('0xc'),auth[_0xd834('0x7')](),timeout(_0xd834('0xd')),controller['test']);router[_0xd834('0xe')]('/',auth[_0xd834('0x7')](),controller['create']);router[_0xd834('0xf')](_0xd834('0xa'),auth['isAuthenticated'](),controller[_0xd834('0x10')]);router[_0xd834('0x11')](_0xd834('0xa'),auth[_0xd834('0x7')](),controller[_0xd834('0x12')]);module[_0xd834('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 8a2cb87..ba18b3a 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 _0xca28=['STRING','sequelize','exports'];(function(_0x1331fc,_0x3fe8c4){var _0x1f6711=function(_0x4fabea){while(--_0x4fabea){_0x1331fc['push'](_0x1331fc['shift']());}};_0x1f6711(++_0x3fe8c4);}(_0xca28,0x12d));var _0x8ca2=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xca28[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require(_0x8ca2('0x0'));module[_0x8ca2('0x1')]={'name':{'type':Sequelize[_0x8ca2('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8ca2('0x2')]}}; \ No newline at end of file +var _0x7f8e=['sequelize','exports','STRING','name'];(function(_0x5fb11e,_0x30e41c){var _0x1b60d3=function(_0x578ada){while(--_0x578ada){_0x5fb11e['push'](_0x5fb11e['shift']());}};_0x1b60d3(++_0x30e41c);}(_0x7f8e,0x1ac));var _0xe7f8=function(_0x3f2e49,_0x4d4c1c){_0x3f2e49=_0x3f2e49-0x0;var _0x1ba11f=_0x7f8e[_0x3f2e49];return _0x1ba11f;};'use strict';var Sequelize=require(_0xe7f8('0x0'));module[_0xe7f8('0x1')]={'name':{'type':Sequelize[_0xe7f8('0x2')],'unique':_0xe7f8('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xe7f8('0x2')]},'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 3e921bb..45c117f 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 _0x4e5c=['nolimit','sort','where','pick','filter','merge','map','type','key','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection','length','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','ODBC','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','test','dsn','odbc','openSync','closeSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','json','reject','save','update','then','UserProfileResource','destroy','error','name','send','index','SquareOdbc','rawAttributes','model','keys','query','filters','attributes','fields'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4e5c,0x175));var _0xc4e5=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x4e5c[_0x2fc012];return _0x2891f9;};'use strict';var pdf=require(_0xc4e5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc4e5('0x1'));var zipdir=require(_0xc4e5('0x2'));var jsonpatch=require(_0xc4e5('0x3'));var rp=require(_0xc4e5('0x4'));var moment=require(_0xc4e5('0x5'));var BPromise=require(_0xc4e5('0x6'));var Mustache=require(_0xc4e5('0x7'));var util=require(_0xc4e5('0x8'));var path=require(_0xc4e5('0x9'));var sox=require(_0xc4e5('0xa'));var csv=require(_0xc4e5('0xb'));var ejs=require(_0xc4e5('0xc'));var fs=require('fs');var _=require(_0xc4e5('0xd'));var squel=require(_0xc4e5('0xe'));var crypto=require(_0xc4e5('0xf'));var jsforce=require(_0xc4e5('0x10'));var deskjs=require(_0xc4e5('0x11'));var toCsv=require(_0xc4e5('0xb'));var querystring=require(_0xc4e5('0x12'));var Papa=require('papaparse');var authService=require(_0xc4e5('0x13'));var hardwareService=require(_0xc4e5('0x14'));var Redis=require(_0xc4e5('0x15'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xc4e5('0x16'));var utils=require(_0xc4e5('0x17'));var config=require(_0xc4e5('0x18'));var db=require(_0xc4e5('0x19'))['db'];function respondWithStatusCode(_0x480a80,_0x259e00){_0x259e00=_0x259e00||0xcc;return function(_0x9f2d02){if(_0x9f2d02){return _0x480a80[_0xc4e5('0x1a')](_0x259e00);}return _0x480a80['status'](_0x259e00)[_0xc4e5('0x1b')]();};}function respondWithResult(_0x3979d4,_0x192a3d){_0x192a3d=_0x192a3d||0xc8;return function(_0x30afe0){if(_0x30afe0){return _0x3979d4[_0xc4e5('0x1c')](_0x192a3d)['json'](_0x30afe0);}};}function respondWithFilteredResult(_0x1e2783,_0x21dcbb){return function(_0xf3ab82){if(_0xf3ab82){var _0x2a4179=_0xf3ab82[_0xc4e5('0x1d')],_0x220eea=_0x21dcbb[_0xc4e5('0x1e')],_0xa6ca6c=_0x21dcbb[_0xc4e5('0x1e')]+_0x21dcbb[_0xc4e5('0x1f')],_0x50d31a;if(_0xa6ca6c>=_0x2a4179){_0xa6ca6c=_0x2a4179;_0x50d31a=0xc8;}else{_0x50d31a=0xce;}_0x1e2783['status'](_0x50d31a);return _0x1e2783[_0xc4e5('0x20')]('Content-Range',_0x220eea+'-'+_0xa6ca6c+'/'+_0x2a4179)[_0xc4e5('0x21')](_0xf3ab82);}return null;};}function patchUpdates(_0x33eb44){return function(_0x5e9444){try{jsonpatch['apply'](_0x5e9444,_0x33eb44,!![]);}catch(_0x364b25){return BPromise[_0xc4e5('0x22')](_0x364b25);}return _0x5e9444[_0xc4e5('0x23')]();};}function saveUpdates(_0xae948c,_0xc5b6f8){return function(_0x122ed1){if(_0x122ed1){return _0x122ed1[_0xc4e5('0x24')](_0xae948c)['then'](function(_0x4c013f){return _0x4c013f;});}return null;};}function removeEntity(_0x201ad4,_0x54ce75){return function(_0xfb5117){if(_0xfb5117){return _0xfb5117['destroy']()[_0xc4e5('0x25')](function(){var _0x2c4dcf=_0xfb5117['get']({'plain':!![]});var _0x5e4ef9='ODBC';return db[_0xc4e5('0x26')][_0xc4e5('0x27')]({'where':{'type':_0x5e4ef9,'resourceId':_0x2c4dcf['id']}})['then'](function(){return _0xfb5117;});})['then'](function(){_0x201ad4[_0xc4e5('0x1c')](0xcc)[_0xc4e5('0x1b')]();});}};}function handleEntityNotFound(_0x3d6fa8,_0x2da17a){return function(_0x2eac98){if(!_0x2eac98){_0x3d6fa8[_0xc4e5('0x1a')](0x194);}return _0x2eac98;};}function handleError(_0x161f1e,_0x5e3ea2){_0x5e3ea2=_0x5e3ea2||0x1f4;return function(_0x257313){logger[_0xc4e5('0x28')](_0x257313['stack']);if(_0x257313[_0xc4e5('0x29')]){delete _0x257313[_0xc4e5('0x29')];}_0x161f1e[_0xc4e5('0x1c')](_0x5e3ea2)[_0xc4e5('0x2a')](_0x257313);};}exports[_0xc4e5('0x2b')]=function(_0x242ea8,_0x5415c7){var _0x2ce0c7={},_0x123bbd={},_0x378564={'count':0x0,'rows':[]};var _0xc0e4a7=db[_0xc4e5('0x2c')][_0xc4e5('0x2d')];_0x123bbd[_0xc4e5('0x2e')]=_[_0xc4e5('0x2f')](_0xc0e4a7);_0x123bbd[_0xc4e5('0x30')]=_[_0xc4e5('0x2f')](_0x242ea8['query']);_0x123bbd[_0xc4e5('0x31')]=_['intersection'](_0x123bbd[_0xc4e5('0x2e')],_0x123bbd['query']);_0x2ce0c7[_0xc4e5('0x32')]=_['intersection'](_0x123bbd[_0xc4e5('0x2e')],qs[_0xc4e5('0x33')](_0x242ea8[_0xc4e5('0x30')][_0xc4e5('0x33')]));_0x2ce0c7[_0xc4e5('0x32')]=_0x2ce0c7[_0xc4e5('0x32')]['length']?_0x2ce0c7[_0xc4e5('0x32')]:_0x123bbd[_0xc4e5('0x2e')];if(!_0x242ea8['query']['hasOwnProperty'](_0xc4e5('0x34'))){_0x2ce0c7[_0xc4e5('0x1f')]=qs[_0xc4e5('0x1f')](_0x242ea8[_0xc4e5('0x30')][_0xc4e5('0x1f')]);_0x2ce0c7[_0xc4e5('0x1e')]=qs[_0xc4e5('0x1e')](_0x242ea8[_0xc4e5('0x30')][_0xc4e5('0x1e')]);}_0x2ce0c7['order']=qs[_0xc4e5('0x35')](_0x242ea8[_0xc4e5('0x30')]['sort']);_0x2ce0c7[_0xc4e5('0x36')]=qs[_0xc4e5('0x31')](_[_0xc4e5('0x37')](_0x242ea8[_0xc4e5('0x30')],_0x123bbd[_0xc4e5('0x31')]));if(_0x242ea8[_0xc4e5('0x30')][_0xc4e5('0x38')]){_0x2ce0c7['where']=_[_0xc4e5('0x39')](_0x2ce0c7[_0xc4e5('0x36')],{'$or':_[_0xc4e5('0x3a')](_0xc0e4a7,function(_0x370d19){if(_0x370d19[_0xc4e5('0x3b')][_0xc4e5('0x3c')]!==_0xc4e5('0x3d')){var _0x1a2801={};_0x1a2801[_0x370d19['field']]={'$like':'%'+_0x242ea8['query'][_0xc4e5('0x38')]+'%'};return _0x1a2801;}})});}_0x2ce0c7=_[_0xc4e5('0x39')]({},_0x2ce0c7,_0x242ea8[_0xc4e5('0x3e')]);var _0x1e7149={'where':_0x2ce0c7['where']};return db[_0xc4e5('0x2c')][_0xc4e5('0x1d')](_0x1e7149)[_0xc4e5('0x25')](function(_0x1df8cf){_0x378564[_0xc4e5('0x1d')]=_0x1df8cf;if(_0x242ea8[_0xc4e5('0x30')][_0xc4e5('0x3f')]){_0x2ce0c7[_0xc4e5('0x40')]=[{'all':!![]}];}return db[_0xc4e5('0x2c')][_0xc4e5('0x41')](_0x2ce0c7);})['then'](function(_0x53fca0){_0x378564[_0xc4e5('0x42')]=_0x53fca0;return _0x378564;})[_0xc4e5('0x25')](respondWithFilteredResult(_0x5415c7,_0x2ce0c7))['catch'](handleError(_0x5415c7,null));};exports[_0xc4e5('0x43')]=function(_0x38d3a4,_0x449b97){var _0x140958={'raw':!![],'where':{'id':_0x38d3a4[_0xc4e5('0x44')]['id']}},_0x251669={};_0x251669['model']=_[_0xc4e5('0x2f')](db['SquareOdbc']['rawAttributes']);_0x251669[_0xc4e5('0x30')]=_[_0xc4e5('0x2f')](_0x38d3a4[_0xc4e5('0x30')]);_0x251669[_0xc4e5('0x31')]=_[_0xc4e5('0x45')](_0x251669[_0xc4e5('0x2e')],_0x251669[_0xc4e5('0x30')]);_0x140958['attributes']=_['intersection'](_0x251669[_0xc4e5('0x2e')],qs[_0xc4e5('0x33')](_0x38d3a4[_0xc4e5('0x30')][_0xc4e5('0x33')]));_0x140958[_0xc4e5('0x32')]=_0x140958[_0xc4e5('0x32')][_0xc4e5('0x46')]?_0x140958[_0xc4e5('0x32')]:_0x251669[_0xc4e5('0x2e')];if(_0x38d3a4[_0xc4e5('0x30')][_0xc4e5('0x3f')]){_0x140958[_0xc4e5('0x40')]=[{'all':!![]}];}_0x140958=_[_0xc4e5('0x39')]({},_0x140958,_0x38d3a4[_0xc4e5('0x3e')]);return db[_0xc4e5('0x2c')]['find'](_0x140958)[_0xc4e5('0x25')](handleEntityNotFound(_0x449b97,null))[_0xc4e5('0x25')](respondWithResult(_0x449b97,null))[_0xc4e5('0x47')](handleError(_0x449b97,null));};exports[_0xc4e5('0x48')]=function(_0x5cdde7,_0x1e5f26){return db[_0xc4e5('0x2c')][_0xc4e5('0x48')](_0x5cdde7[_0xc4e5('0x49')],{})[_0xc4e5('0x25')](function(_0x27fc1e){var _0x3c9f4b=_0x5cdde7['user'][_0xc4e5('0x4a')]({'plain':!![]});if(!_0x3c9f4b)throw new Error(_0xc4e5('0x4b'));if(_0x3c9f4b['role']==='user'){var _0x2d8347=_0x27fc1e['get']({'plain':!![]});var _0x37c0de=_0xc4e5('0x4c');return db['UserProfileSection']['find']({'where':{'name':_0x37c0de,'userProfileId':_0x3c9f4b['userProfileId']},'raw':!![]})[_0xc4e5('0x25')](function(_0x541899){if(_0x541899&&_0x541899[_0xc4e5('0x4d')]===0x0){return db[_0xc4e5('0x26')][_0xc4e5('0x48')]({'name':_0x2d8347[_0xc4e5('0x29')],'resourceId':_0x2d8347['id'],'type':_0x541899[_0xc4e5('0x29')],'sectionId':_0x541899['id']},{})[_0xc4e5('0x25')](function(){return _0x27fc1e;});}else{return _0x27fc1e;}})[_0xc4e5('0x47')](function(_0x482b09){logger['error'](_0xc4e5('0x4e'),_0x482b09);throw _0x482b09;});}return _0x27fc1e;})[_0xc4e5('0x25')](respondWithResult(_0x1e5f26,0xc9))[_0xc4e5('0x47')](handleError(_0x1e5f26,null));};exports['update']=function(_0x5da6bc,_0x11e08e){if(_0x5da6bc['body']['id']){delete _0x5da6bc[_0xc4e5('0x49')]['id'];}return db[_0xc4e5('0x2c')][_0xc4e5('0x4f')]({'where':{'id':_0x5da6bc[_0xc4e5('0x44')]['id']}})[_0xc4e5('0x25')](handleEntityNotFound(_0x11e08e,null))[_0xc4e5('0x25')](saveUpdates(_0x5da6bc[_0xc4e5('0x49')],null))[_0xc4e5('0x25')](respondWithResult(_0x11e08e,null))[_0xc4e5('0x47')](handleError(_0x11e08e,null));};exports[_0xc4e5('0x27')]=function(_0x1769f7,_0x13edb6){return db['SquareOdbc'][_0xc4e5('0x4f')]({'where':{'id':_0x1769f7[_0xc4e5('0x44')]['id']}})[_0xc4e5('0x25')](handleEntityNotFound(_0x13edb6,null))[_0xc4e5('0x25')](removeEntity(_0x13edb6,null))['catch'](handleError(_0x13edb6,null));};exports[_0xc4e5('0x50')]=function(_0x540935,_0x3ecc02,_0x107c65){var _0x1a867c;return db[_0xc4e5('0x2c')]['find']({'where':{'id':_0x540935['params']['id']},'attributes':['id',_0xc4e5('0x51')]})[_0xc4e5('0x25')](handleEntityNotFound(_0x3ecc02,null))[_0xc4e5('0x25')](function(_0x48220e){if(_0x48220e){var _0x597f0f=require(_0xc4e5('0x52'))();_0x597f0f[_0xc4e5('0x53')](_0x48220e[_0xc4e5('0x51')]);_0x597f0f[_0xc4e5('0x54')]();return _0x48220e;}})[_0xc4e5('0x25')](respondWithResult(_0x3ecc02,null))[_0xc4e5('0x47')](handleError(_0x3ecc02,null));}; \ No newline at end of file +var _0xa9c1=['attributes','fields','length','nolimit','order','sort','where','merge','map','VIRTUAL','field','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','dsn','odbc','closeSync','html-pdf','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','error','stack','name','send','index','SquareOdbc','rawAttributes','model','keys','query','filters','intersection'];(function(_0xf08243,_0x4945b7){var _0x43ffe5=function(_0x4081a2){while(--_0x4081a2){_0xf08243['push'](_0xf08243['shift']());}};_0x43ffe5(++_0x4945b7);}(_0xa9c1,0x70));var _0x1a9c=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0xa9c1[_0x1992f1];return _0x413dfe;};'use strict';var pdf=require(_0x1a9c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1a9c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1a9c('0x2'));var rp=require(_0x1a9c('0x3'));var moment=require(_0x1a9c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1a9c('0x5'));var path=require('path');var sox=require(_0x1a9c('0x6'));var csv=require(_0x1a9c('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1a9c('0x8'));var squel=require(_0x1a9c('0x9'));var crypto=require(_0x1a9c('0xa'));var jsforce=require(_0x1a9c('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1a9c('0xc'));var Papa=require(_0x1a9c('0xd'));var authService=require(_0x1a9c('0xe'));var hardwareService=require(_0x1a9c('0xf'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x1a9c('0x10'))(_0x1a9c('0x11'));var utils=require(_0x1a9c('0x12'));var config=require(_0x1a9c('0x13'));var db=require(_0x1a9c('0x14'))['db'];function respondWithStatusCode(_0x5a0308,_0x138bf5){_0x138bf5=_0x138bf5||0xcc;return function(_0x22f305){if(_0x22f305){return _0x5a0308[_0x1a9c('0x15')](_0x138bf5);}return _0x5a0308[_0x1a9c('0x16')](_0x138bf5)[_0x1a9c('0x17')]();};}function respondWithResult(_0x367e0e,_0x46b68f){_0x46b68f=_0x46b68f||0xc8;return function(_0x2cdd16){if(_0x2cdd16){return _0x367e0e['status'](_0x46b68f)['json'](_0x2cdd16);}};}function respondWithFilteredResult(_0x2d057f,_0x20a39a){return function(_0x34de83){if(_0x34de83){var _0x2576dc=_0x34de83[_0x1a9c('0x18')],_0x37d975=_0x20a39a[_0x1a9c('0x19')],_0x43e711=_0x20a39a[_0x1a9c('0x19')]+_0x20a39a[_0x1a9c('0x1a')],_0x235950;if(_0x43e711>=_0x2576dc){_0x43e711=_0x2576dc;_0x235950=0xc8;}else{_0x235950=0xce;}_0x2d057f['status'](_0x235950);return _0x2d057f['set'](_0x1a9c('0x1b'),_0x37d975+'-'+_0x43e711+'/'+_0x2576dc)[_0x1a9c('0x1c')](_0x34de83);}return null;};}function patchUpdates(_0x300b16){return function(_0x193ee3){try{jsonpatch[_0x1a9c('0x1d')](_0x193ee3,_0x300b16,!![]);}catch(_0x2658c3){return BPromise[_0x1a9c('0x1e')](_0x2658c3);}return _0x193ee3[_0x1a9c('0x1f')]();};}function saveUpdates(_0x39dfb7,_0x58f330){return function(_0x24ead1){if(_0x24ead1){return _0x24ead1[_0x1a9c('0x20')](_0x39dfb7)[_0x1a9c('0x21')](function(_0x5cf8a5){return _0x5cf8a5;});}return null;};}function removeEntity(_0xd047e7,_0x2f04af){return function(_0x1a5e9f){if(_0x1a5e9f){return _0x1a5e9f[_0x1a9c('0x22')]()['then'](function(){var _0x172581=_0x1a5e9f[_0x1a9c('0x23')]({'plain':!![]});var _0x15162e=_0x1a9c('0x24');return db[_0x1a9c('0x25')][_0x1a9c('0x22')]({'where':{'type':_0x15162e,'resourceId':_0x172581['id']}})['then'](function(){return _0x1a5e9f;});})[_0x1a9c('0x21')](function(){_0xd047e7['status'](0xcc)[_0x1a9c('0x17')]();});}};}function handleEntityNotFound(_0x29926f,_0xccac03){return function(_0x2ad818){if(!_0x2ad818){_0x29926f[_0x1a9c('0x15')](0x194);}return _0x2ad818;};}function handleError(_0x217c91,_0x4e048b){_0x4e048b=_0x4e048b||0x1f4;return function(_0x11257a){logger[_0x1a9c('0x26')](_0x11257a[_0x1a9c('0x27')]);if(_0x11257a[_0x1a9c('0x28')]){delete _0x11257a[_0x1a9c('0x28')];}_0x217c91[_0x1a9c('0x16')](_0x4e048b)[_0x1a9c('0x29')](_0x11257a);};}exports[_0x1a9c('0x2a')]=function(_0x403457,_0x1437ef){var _0x1fcc14={},_0x20b7f9={},_0xead1c1={'count':0x0,'rows':[]};var _0x403bac=db[_0x1a9c('0x2b')][_0x1a9c('0x2c')];_0x20b7f9[_0x1a9c('0x2d')]=_[_0x1a9c('0x2e')](_0x403bac);_0x20b7f9[_0x1a9c('0x2f')]=_[_0x1a9c('0x2e')](_0x403457[_0x1a9c('0x2f')]);_0x20b7f9[_0x1a9c('0x30')]=_[_0x1a9c('0x31')](_0x20b7f9[_0x1a9c('0x2d')],_0x20b7f9['query']);_0x1fcc14[_0x1a9c('0x32')]=_[_0x1a9c('0x31')](_0x20b7f9[_0x1a9c('0x2d')],qs[_0x1a9c('0x33')](_0x403457[_0x1a9c('0x2f')][_0x1a9c('0x33')]));_0x1fcc14[_0x1a9c('0x32')]=_0x1fcc14['attributes'][_0x1a9c('0x34')]?_0x1fcc14[_0x1a9c('0x32')]:_0x20b7f9[_0x1a9c('0x2d')];if(!_0x403457[_0x1a9c('0x2f')]['hasOwnProperty'](_0x1a9c('0x35'))){_0x1fcc14[_0x1a9c('0x1a')]=qs['limit'](_0x403457[_0x1a9c('0x2f')][_0x1a9c('0x1a')]);_0x1fcc14[_0x1a9c('0x19')]=qs[_0x1a9c('0x19')](_0x403457[_0x1a9c('0x2f')][_0x1a9c('0x19')]);}_0x1fcc14[_0x1a9c('0x36')]=qs[_0x1a9c('0x37')](_0x403457[_0x1a9c('0x2f')][_0x1a9c('0x37')]);_0x1fcc14['where']=qs[_0x1a9c('0x30')](_['pick'](_0x403457['query'],_0x20b7f9['filters']));if(_0x403457[_0x1a9c('0x2f')]['filter']){_0x1fcc14[_0x1a9c('0x38')]=_[_0x1a9c('0x39')](_0x1fcc14[_0x1a9c('0x38')],{'$or':_[_0x1a9c('0x3a')](_0x403bac,function(_0x178f77){if(_0x178f77['type']['key']!==_0x1a9c('0x3b')){var _0x7c1d03={};_0x7c1d03[_0x178f77[_0x1a9c('0x3c')]]={'$like':'%'+_0x403457[_0x1a9c('0x2f')][_0x1a9c('0x3d')]+'%'};return _0x7c1d03;}})});}_0x1fcc14=_[_0x1a9c('0x39')]({},_0x1fcc14,_0x403457['options']);var _0x5e55da={'where':_0x1fcc14[_0x1a9c('0x38')]};return db[_0x1a9c('0x2b')][_0x1a9c('0x18')](_0x5e55da)[_0x1a9c('0x21')](function(_0x38f658){_0xead1c1[_0x1a9c('0x18')]=_0x38f658;if(_0x403457['query'][_0x1a9c('0x3e')]){_0x1fcc14[_0x1a9c('0x3f')]=[{'all':!![]}];}return db[_0x1a9c('0x2b')][_0x1a9c('0x40')](_0x1fcc14);})[_0x1a9c('0x21')](function(_0x6ac511){_0xead1c1[_0x1a9c('0x41')]=_0x6ac511;return _0xead1c1;})[_0x1a9c('0x21')](respondWithFilteredResult(_0x1437ef,_0x1fcc14))[_0x1a9c('0x42')](handleError(_0x1437ef,null));};exports[_0x1a9c('0x43')]=function(_0x4e6833,_0x214322){var _0x3f7197={'raw':!![],'where':{'id':_0x4e6833[_0x1a9c('0x44')]['id']}},_0x4f7c91={};_0x4f7c91[_0x1a9c('0x2d')]=_['keys'](db[_0x1a9c('0x2b')]['rawAttributes']);_0x4f7c91[_0x1a9c('0x2f')]=_[_0x1a9c('0x2e')](_0x4e6833[_0x1a9c('0x2f')]);_0x4f7c91['filters']=_[_0x1a9c('0x31')](_0x4f7c91['model'],_0x4f7c91[_0x1a9c('0x2f')]);_0x3f7197[_0x1a9c('0x32')]=_['intersection'](_0x4f7c91[_0x1a9c('0x2d')],qs[_0x1a9c('0x33')](_0x4e6833[_0x1a9c('0x2f')][_0x1a9c('0x33')]));_0x3f7197[_0x1a9c('0x32')]=_0x3f7197['attributes'][_0x1a9c('0x34')]?_0x3f7197[_0x1a9c('0x32')]:_0x4f7c91['model'];if(_0x4e6833[_0x1a9c('0x2f')][_0x1a9c('0x3e')]){_0x3f7197['include']=[{'all':!![]}];}_0x3f7197=_[_0x1a9c('0x39')]({},_0x3f7197,_0x4e6833[_0x1a9c('0x45')]);return db[_0x1a9c('0x2b')][_0x1a9c('0x46')](_0x3f7197)[_0x1a9c('0x21')](handleEntityNotFound(_0x214322,null))[_0x1a9c('0x21')](respondWithResult(_0x214322,null))[_0x1a9c('0x42')](handleError(_0x214322,null));};exports[_0x1a9c('0x47')]=function(_0x21d48e,_0x2e9dcf){return db[_0x1a9c('0x2b')]['create'](_0x21d48e[_0x1a9c('0x48')],{})[_0x1a9c('0x21')](function(_0x12b4a4){var _0xc08757=_0x21d48e[_0x1a9c('0x49')][_0x1a9c('0x23')]({'plain':!![]});if(!_0xc08757)throw new Error(_0x1a9c('0x4a'));if(_0xc08757[_0x1a9c('0x4b')]===_0x1a9c('0x49')){var _0x5ec062=_0x12b4a4[_0x1a9c('0x23')]({'plain':!![]});var _0x40bf95=_0x1a9c('0x24');return db[_0x1a9c('0x4c')]['find']({'where':{'name':_0x40bf95,'userProfileId':_0xc08757['userProfileId']},'raw':!![]})[_0x1a9c('0x21')](function(_0x5b5c08){if(_0x5b5c08&&_0x5b5c08[_0x1a9c('0x4d')]===0x0){return db[_0x1a9c('0x25')][_0x1a9c('0x47')]({'name':_0x5ec062[_0x1a9c('0x28')],'resourceId':_0x5ec062['id'],'type':_0x5b5c08[_0x1a9c('0x28')],'sectionId':_0x5b5c08['id']},{})['then'](function(){return _0x12b4a4;});}else{return _0x12b4a4;}})[_0x1a9c('0x42')](function(_0x3bf2f6){logger[_0x1a9c('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3bf2f6);throw _0x3bf2f6;});}return _0x12b4a4;})[_0x1a9c('0x21')](respondWithResult(_0x2e9dcf,0xc9))['catch'](handleError(_0x2e9dcf,null));};exports[_0x1a9c('0x20')]=function(_0x3f11ac,_0x21711d){if(_0x3f11ac[_0x1a9c('0x48')]['id']){delete _0x3f11ac['body']['id'];}return db[_0x1a9c('0x2b')]['find']({'where':{'id':_0x3f11ac['params']['id']}})[_0x1a9c('0x21')](handleEntityNotFound(_0x21711d,null))[_0x1a9c('0x21')](saveUpdates(_0x3f11ac[_0x1a9c('0x48')],null))[_0x1a9c('0x21')](respondWithResult(_0x21711d,null))['catch'](handleError(_0x21711d,null));};exports[_0x1a9c('0x22')]=function(_0x161a4f,_0x3db5e7){return db[_0x1a9c('0x2b')][_0x1a9c('0x46')]({'where':{'id':_0x161a4f['params']['id']}})[_0x1a9c('0x21')](handleEntityNotFound(_0x3db5e7,null))[_0x1a9c('0x21')](removeEntity(_0x3db5e7,null))[_0x1a9c('0x42')](handleError(_0x3db5e7,null));};exports['test']=function(_0x28b2d0,_0x35f3ec,_0x2887b1){var _0x7afafe;return db[_0x1a9c('0x2b')][_0x1a9c('0x46')]({'where':{'id':_0x28b2d0[_0x1a9c('0x44')]['id']},'attributes':['id',_0x1a9c('0x4e')]})[_0x1a9c('0x21')](handleEntityNotFound(_0x35f3ec,null))[_0x1a9c('0x21')](function(_0x129b06){if(_0x129b06){var _0x52544f=require(_0x1a9c('0x4f'))();_0x52544f['openSync'](_0x129b06[_0x1a9c('0x4e')]);_0x52544f[_0x1a9c('0x50')]();return _0x129b06;}})[_0x1a9c('0x21')](respondWithResult(_0x35f3ec,null))['catch'](handleError(_0x35f3ec,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 7e4a572..024d636 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 _0xb43b=['exports','square_odbc','lodash','util','api','moment','bluebird','./squareOdbc.attributes'];(function(_0x14e328,_0x4ceaa6){var _0xdfe730=function(_0x2a9f10){while(--_0x2a9f10){_0x14e328['push'](_0x14e328['shift']());}};_0xdfe730(++_0x4ceaa6);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2a1aa8,_0x5d757f){_0x2a1aa8=_0x2a1aa8-0x0;var _0x3846c8=_0xb43b[_0x2a1aa8];return _0x3846c8;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var attributes=require(_0xbb43('0x5'));module[_0xbb43('0x6')]=function(_0x351254,_0x16432a){return _0x351254['define']('SquareOdbc',attributes,{'tableName':_0xbb43('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91a7=['util','../../config/logger','api','bluebird','./squareOdbc.attributes','define','square_odbc'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x91a7,0xe7));var _0x791a=function(_0x8c9c7f,_0xa32fc0){_0x8c9c7f=_0x8c9c7f-0x0;var _0x346ff0=_0x91a7[_0x8c9c7f];return _0x346ff0;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var logger=require(_0x791a('0x1'))(_0x791a('0x2'));var moment=require('moment');var BPromise=require(_0x791a('0x3'));var rp=require('request-promise');var attributes=require(_0x791a('0x4'));module['exports']=function(_0x50ab29,_0x32fe2b){return _0x50ab29[_0x791a('0x5')]('SquareOdbc',attributes,{'tableName':_0x791a('0x6'),'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 269acde..3d17973 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 _0xa8fa=['SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SquareOdbc','find','options','where','attributes','map','include','model','then','ShowSquareOdbc','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info'];(function(_0x189e51,_0x16d2fc){var _0x57f2fa=function(_0x1acf93){while(--_0x1acf93){_0x189e51['push'](_0x189e51['shift']());}};_0x57f2fa(++_0x16d2fc);}(_0xa8fa,0x15e));var _0xaa8f=function(_0x39ac53,_0x4791eb){_0x39ac53=_0x39ac53-0x0;var _0x1988f5=_0xa8fa[_0x39ac53];return _0x1988f5;};'use strict';var _=require(_0xaa8f('0x0'));var util=require('util');var moment=require(_0xaa8f('0x1'));var BPromise=require(_0xaa8f('0x2'));var rs=require(_0xaa8f('0x3'));var fs=require('fs');var Redis=require(_0xaa8f('0x4'));var db=require(_0xaa8f('0x5'))['db'];var utils=require(_0xaa8f('0x6'));var logger=require(_0xaa8f('0x7'))('rpc');var config=require(_0xaa8f('0x8'));var jayson=require(_0xaa8f('0x9'));var client=jayson[_0xaa8f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x453427,_0x536bcb,_0x59fe61){return new BPromise(function(_0x319dfe,_0x322e40){return client[_0xaa8f('0xb')](_0x453427,_0x59fe61)['then'](function(_0x7172ee){logger[_0xaa8f('0xc')](_0xaa8f('0xd'),_0x536bcb,_0xaa8f('0xe'));logger[_0xaa8f('0xf')](_0xaa8f('0x10'),_0x536bcb,'request\x20sent',JSON[_0xaa8f('0x11')](_0x7172ee));if(_0x7172ee[_0xaa8f('0x12')]){if(_0x7172ee[_0xaa8f('0x12')][_0xaa8f('0x13')]===0x1f4){logger[_0xaa8f('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x536bcb,_0x7172ee[_0xaa8f('0x12')]['message']);return _0x322e40(_0x7172ee[_0xaa8f('0x12')][_0xaa8f('0x14')]);}logger[_0xaa8f('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x536bcb,_0x7172ee[_0xaa8f('0x12')][_0xaa8f('0x14')]);return _0x319dfe(_0x7172ee[_0xaa8f('0x12')][_0xaa8f('0x14')]);}else{logger[_0xaa8f('0xc')](_0xaa8f('0xd'),_0x536bcb,_0xaa8f('0xe'));_0x319dfe(_0x7172ee[_0xaa8f('0x15')][_0xaa8f('0x14')]);}})['catch'](function(_0x5c7850){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x536bcb,_0x5c7850);_0x322e40(_0x5c7850);});});}exports['ShowSquareOdbc']=function(_0x36971d){var _0x4992ba=this;return new Promise(function(_0xa9769d,_0x50fd8d){return db[_0xaa8f('0x16')][_0xaa8f('0x17')]({'raw':_0x36971d[_0xaa8f('0x18')]?_0x36971d[_0xaa8f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x36971d[_0xaa8f('0x18')]?_0x36971d[_0xaa8f('0x18')][_0xaa8f('0x19')]||null:null,'attributes':_0x36971d[_0xaa8f('0x18')]?_0x36971d[_0xaa8f('0x18')][_0xaa8f('0x1a')]||null:null,'include':_0x36971d[_0xaa8f('0x18')]?_0x36971d[_0xaa8f('0x18')]['include']?_[_0xaa8f('0x1b')](_0x36971d[_0xaa8f('0x18')][_0xaa8f('0x1c')],function(_0x47f11a){return{'model':db[_0x47f11a[_0xaa8f('0x1d')]],'as':_0x47f11a['as'],'attributes':_0x47f11a[_0xaa8f('0x1a')],'include':_0x47f11a['include']?_['map'](_0x47f11a[_0xaa8f('0x1c')],function(_0x24010d){return{'model':db[_0x24010d[_0xaa8f('0x1d')]],'as':_0x24010d['as'],'attributes':_0x24010d[_0xaa8f('0x1a')],'include':_0x24010d['include']?_[_0xaa8f('0x1b')](_0x24010d[_0xaa8f('0x1c')],function(_0x5d6865){return{'model':db[_0x5d6865[_0xaa8f('0x1d')]],'as':_0x5d6865['as'],'attributes':_0x5d6865[_0xaa8f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xaa8f('0x1e')](function(_0x2d33f1){logger[_0xaa8f('0xc')](_0xaa8f('0x1f'),_0x36971d);logger[_0xaa8f('0xf')]('ShowSquareOdbc',_0x36971d,JSON[_0xaa8f('0x11')](_0x2d33f1));_0xa9769d(_0x2d33f1);})[_0xaa8f('0x20')](function(_0x47b694){logger[_0xaa8f('0x12')]('ShowSquareOdbc',_0x47b694['message'],_0x36971d);_0x50fd8d(_0x4992ba[_0xaa8f('0x12')](0x1f4,_0x47b694['message']));});});}; \ No newline at end of file +var _0xa53a=['debug','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','request','then','info','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','ShowSquareOdbc','SquareOdbc','find','options','where','attributes','map','include','model'];(function(_0x205886,_0x13c45d){var _0x5a7d57=function(_0x5e2a71){while(--_0x5e2a71){_0x205886['push'](_0x205886['shift']());}};_0x5a7d57(++_0x13c45d);}(_0xa53a,0x17a));var _0xaa53=function(_0x578871,_0x3b080c){_0x578871=_0x578871-0x0;var _0x43c957=_0xa53a[_0x578871];return _0x43c957;};'use strict';var _=require(_0xaa53('0x0'));var util=require(_0xaa53('0x1'));var moment=require('moment');var BPromise=require(_0xaa53('0x2'));var rs=require(_0xaa53('0x3'));var fs=require('fs');var Redis=require(_0xaa53('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaa53('0x5'))(_0xaa53('0x6'));var config=require('../../config/environment');var jayson=require(_0xaa53('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e955c,_0x485419,_0x253d00){return new BPromise(function(_0x5f5394,_0x2bb5f4){return client[_0xaa53('0x8')](_0x2e955c,_0x253d00)[_0xaa53('0x9')](function(_0x588e51){logger[_0xaa53('0xa')]('SquareOdbc,\x20%s,\x20%s',_0x485419,_0xaa53('0xb'));logger['debug'](_0xaa53('0xc'),_0x485419,'request\x20sent',JSON[_0xaa53('0xd')](_0x588e51));if(_0x588e51['error']){if(_0x588e51[_0xaa53('0xe')][_0xaa53('0xf')]===0x1f4){logger[_0xaa53('0xe')](_0xaa53('0x10'),_0x485419,_0x588e51[_0xaa53('0xe')][_0xaa53('0x11')]);return _0x2bb5f4(_0x588e51[_0xaa53('0xe')][_0xaa53('0x11')]);}logger[_0xaa53('0xe')](_0xaa53('0x10'),_0x485419,_0x588e51['error'][_0xaa53('0x11')]);return _0x5f5394(_0x588e51[_0xaa53('0xe')][_0xaa53('0x11')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x485419,'request\x20sent');_0x5f5394(_0x588e51['result']['message']);}})[_0xaa53('0x12')](function(_0x3e3191){logger[_0xaa53('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x485419,_0x3e3191);_0x2bb5f4(_0x3e3191);});});}exports[_0xaa53('0x13')]=function(_0x26e2d4){var _0x25a79e=this;return new Promise(function(_0x556f74,_0x5e8f7e){return db[_0xaa53('0x14')][_0xaa53('0x15')]({'raw':_0x26e2d4['options']?_0x26e2d4['options']['raw']===undefined?!![]:![]:!![],'where':_0x26e2d4[_0xaa53('0x16')]?_0x26e2d4[_0xaa53('0x16')][_0xaa53('0x17')]||null:null,'attributes':_0x26e2d4[_0xaa53('0x16')]?_0x26e2d4[_0xaa53('0x16')][_0xaa53('0x18')]||null:null,'include':_0x26e2d4[_0xaa53('0x16')]?_0x26e2d4['options']['include']?_[_0xaa53('0x19')](_0x26e2d4['options'][_0xaa53('0x1a')],function(_0x596562){return{'model':db[_0x596562['model']],'as':_0x596562['as'],'attributes':_0x596562[_0xaa53('0x18')],'include':_0x596562[_0xaa53('0x1a')]?_[_0xaa53('0x19')](_0x596562[_0xaa53('0x1a')],function(_0x27bb40){return{'model':db[_0x27bb40[_0xaa53('0x1b')]],'as':_0x27bb40['as'],'attributes':_0x27bb40[_0xaa53('0x18')],'include':_0x27bb40['include']?_[_0xaa53('0x19')](_0x27bb40['include'],function(_0x1f0349){return{'model':db[_0x1f0349[_0xaa53('0x1b')]],'as':_0x1f0349['as'],'attributes':_0x1f0349[_0xaa53('0x18')]};}):[]};}):[]};}):[]:[]})[_0xaa53('0x9')](function(_0x54e974){logger[_0xaa53('0xa')](_0xaa53('0x13'),_0x26e2d4);logger[_0xaa53('0x1c')](_0xaa53('0x13'),_0x26e2d4,JSON[_0xaa53('0xd')](_0x54e974));_0x556f74(_0x54e974);})['catch'](function(_0x5a0810){logger[_0xaa53('0xe')](_0xaa53('0x13'),_0x5a0810['message'],_0x26e2d4);_0x5e8f7e(_0x25a79e[_0xaa53('0xe')](0x1f4,_0x5a0810[_0xaa53('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 903988a..ed4f735 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 _0xb3e2=['index','/:id','/:id/users','getUsers','post','create','addUsers','put','update','destroy','removeUsers','exports','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x2f1c3d,_0x550d3d){var _0x2dd77f=function(_0x184e8e){while(--_0x184e8e){_0x2f1c3d['push'](_0x2f1c3d['shift']());}};_0x2dd77f(++_0x550d3d);}(_0xb3e2,0x1c1));var _0x2b3e=function(_0x4f251f,_0x2b7b73){_0x4f251f=_0x4f251f-0x0;var _0x27ec5a=_0xb3e2[_0x4f251f];return _0x27ec5a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2b3e('0x0'));var timeout=require(_0x2b3e('0x1'));var express=require('express');var router=express[_0x2b3e('0x2')]();var auth=require(_0x2b3e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2b3e('0x4'));var controller=require('./squareProject.controller');router[_0x2b3e('0x5')]('/',auth[_0x2b3e('0x6')](),controller[_0x2b3e('0x7')]);router[_0x2b3e('0x5')](_0x2b3e('0x8'),auth['isAuthenticated'](),controller['show']);router['get'](_0x2b3e('0x9'),auth[_0x2b3e('0x6')](),controller[_0x2b3e('0xa')]);router[_0x2b3e('0xb')]('/',auth[_0x2b3e('0x6')](),controller[_0x2b3e('0xc')]);router[_0x2b3e('0xb')](_0x2b3e('0x9'),auth[_0x2b3e('0x6')](),controller[_0x2b3e('0xd')]);router[_0x2b3e('0xe')](_0x2b3e('0x8'),auth[_0x2b3e('0x6')](),controller[_0x2b3e('0xf')]);router['delete'](_0x2b3e('0x8'),auth['isAuthenticated'](),controller[_0x2b3e('0x10')]);router['delete'](_0x2b3e('0x9'),auth[_0x2b3e('0x6')](),controller[_0x2b3e('0x11')]);module[_0x2b3e('0x12')]=router; \ No newline at end of file +var _0x810b=['multer','util','path','Router','../../components/auth/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','/:id/users','post','create','addUsers','put','update','delete','removeUsers','exports'];(function(_0x5bb52c,_0x4a3c9b){var _0xc1f539=function(_0x322b5d){while(--_0x322b5d){_0x5bb52c['push'](_0x5bb52c['shift']());}};_0xc1f539(++_0x4a3c9b);}(_0x810b,0x17c));var _0xb810=function(_0x46cd7b,_0x30c268){_0x46cd7b=_0x46cd7b-0x0;var _0xa211be=_0x810b[_0x46cd7b];return _0xa211be;};'use strict';var multer=require(_0xb810('0x0'));var util=require(_0xb810('0x1'));var path=require(_0xb810('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb810('0x3')]();var auth=require(_0xb810('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb810('0x5'));var controller=require(_0xb810('0x6'));router['get']('/',auth[_0xb810('0x7')](),controller[_0xb810('0x8')]);router['get']('/:id',auth[_0xb810('0x7')](),controller['show']);router[_0xb810('0x9')](_0xb810('0xa'),auth[_0xb810('0x7')](),controller['getUsers']);router[_0xb810('0xb')]('/',auth[_0xb810('0x7')](),controller[_0xb810('0xc')]);router[_0xb810('0xb')](_0xb810('0xa'),auth[_0xb810('0x7')](),controller[_0xb810('0xd')]);router[_0xb810('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xb810('0xf')]);router[_0xb810('0x10')]('/:id',auth[_0xb810('0x7')](),controller['destroy']);router['delete'](_0xb810('0xa'),auth[_0xb810('0x7')](),controller[_0xb810('0x11')]);module[_0xb810('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index a9fc323..1d40b7d 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 _0x6132=['BLOB','long','getDataValue','utf8','production','toString','sequelize','exports','STRING','name','TEXT'];(function(_0x2fd01c,_0x5e4d8f){var _0x2be8b1=function(_0x385c6e){while(--_0x385c6e){_0x2fd01c['push'](_0x2fd01c['shift']());}};_0x2be8b1(++_0x5e4d8f);}(_0x6132,0x13a));var _0x2613=function(_0xd8654d,_0x55c9dc){_0xd8654d=_0xd8654d-0x0;var _0x4fec36=_0x6132[_0xd8654d];return _0x4fec36;};'use strict';var Sequelize=require(_0x2613('0x0'));module[_0x2613('0x1')]={'name':{'type':Sequelize[_0x2613('0x2')],'unique':_0x2613('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x2613('0x4')]},'preproduction':{'type':Sequelize[_0x2613('0x5')](_0x2613('0x6')),'get':function(){if(this[_0x2613('0x7')]('preproduction')){return this[_0x2613('0x7')]('preproduction')['toString'](_0x2613('0x8'));}}},'production':{'type':Sequelize[_0x2613('0x5')](_0x2613('0x6')),'get':function(){if(this[_0x2613('0x7')](_0x2613('0x9'))){return this['getDataValue'](_0x2613('0x9'))[_0x2613('0xa')](_0x2613('0x8'));}}}}; \ No newline at end of file +var _0xf8bb=['preproduction','toString','utf8','sequelize','exports','STRING','TEXT','BLOB','long','getDataValue'];(function(_0x2e1207,_0x2620c8){var _0x164111=function(_0x7e761b){while(--_0x7e761b){_0x2e1207['push'](_0x2e1207['shift']());}};_0x164111(++_0x2620c8);}(_0xf8bb,0x111));var _0xbf8b=function(_0xde03c4,_0x240e78){_0xde03c4=_0xde03c4-0x0;var _0x399abe=_0xf8bb[_0xde03c4];return _0x399abe;};'use strict';var Sequelize=require(_0xbf8b('0x0'));module[_0xbf8b('0x1')]={'name':{'type':Sequelize[_0xbf8b('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xbf8b('0x2')]},'notes':{'type':Sequelize[_0xbf8b('0x3')]},'preproduction':{'type':Sequelize[_0xbf8b('0x4')](_0xbf8b('0x5')),'get':function(){if(this[_0xbf8b('0x6')](_0xbf8b('0x7'))){return this[_0xbf8b('0x6')](_0xbf8b('0x7'))[_0xbf8b('0x8')](_0xbf8b('0x9'));}}},'production':{'type':Sequelize[_0xbf8b('0x4')](_0xbf8b('0x5')),'get':function(){if(this[_0xbf8b('0x6')]('production')){return this[_0xbf8b('0x6')]('production')['toString'](_0xbf8b('0x9'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 236f585..d2a880b 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 _0xadb5=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/utils','../../config/environment','redis','socket.io-emitter','./squareProject.socket','status','json','count','offset','set','Content-Range','update','then','destroy','get','SquareProjects','UserProfileResource','sendStatus','name','send','index','SquareProject','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','filters','map','key','VIRTUAL','field','includeAll','findAll','rows','catch','show','params','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','error','body','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','findOne','sort','filter','merge','getUsers','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x5b8723,_0x171c83){var _0x44d58e=function(_0x5a9f35){while(--_0x5a9f35){_0x5b8723['push'](_0x5b8723['shift']());}};_0x44d58e(++_0x171c83);}(_0xadb5,0xad));var _0x5adb=function(_0x1ad1b0,_0x432eb2){_0x1ad1b0=_0x1ad1b0-0x0;var _0x5bb044=_0xadb5[_0x1ad1b0];return _0x5bb044;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5adb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5adb('0x1'));var jsonpatch=require(_0x5adb('0x2'));var rp=require(_0x5adb('0x3'));var moment=require('moment');var BPromise=require(_0x5adb('0x4'));var Mustache=require(_0x5adb('0x5'));var util=require(_0x5adb('0x6'));var path=require('path');var sox=require(_0x5adb('0x7'));var csv=require(_0x5adb('0x8'));var ejs=require(_0x5adb('0x9'));var fs=require('fs');var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x8'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var authService=require(_0x5adb('0x11'));var hardwareService=require(_0x5adb('0x12'));var Redis=require(_0x5adb('0x13'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x5adb('0x14'));var utils=require(_0x5adb('0x15'));var config=require(_0x5adb('0x16'));var db=require('../../mysqldb')['db'];config[_0x5adb('0x17')]=_['defaults'](config[_0x5adb('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x5adb('0x18'))(new Redis(config[_0x5adb('0x17')]));require(_0x5adb('0x19'))['register'](socket);function respondWithStatusCode(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xcc;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['sendStatus'](_0x34af2c);}return _0x2a545b[_0x5adb('0x1a')](_0x34af2c)['end']();};}function respondWithResult(_0x367d82,_0x42a482){_0x42a482=_0x42a482||0xc8;return function(_0x30614e){if(_0x30614e){return _0x367d82[_0x5adb('0x1a')](_0x42a482)[_0x5adb('0x1b')](_0x30614e);}};}function respondWithFilteredResult(_0x39d24d,_0xa29dc){return function(_0x42f4c6){if(_0x42f4c6){var _0xb953a6=_0x42f4c6[_0x5adb('0x1c')],_0x529b65=_0xa29dc['offset'],_0x3fff62=_0xa29dc[_0x5adb('0x1d')]+_0xa29dc['limit'],_0x5de028;if(_0x3fff62>=_0xb953a6){_0x3fff62=_0xb953a6;_0x5de028=0xc8;}else{_0x5de028=0xce;}_0x39d24d['status'](_0x5de028);return _0x39d24d[_0x5adb('0x1e')](_0x5adb('0x1f'),_0x529b65+'-'+_0x3fff62+'/'+_0xb953a6)[_0x5adb('0x1b')](_0x42f4c6);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x20')](_0x3754cc)[_0x5adb('0x21')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x22')]()[_0x5adb('0x21')](function(){var _0x3839fb=_0x4b1957[_0x5adb('0x23')]({'plain':!![]});var _0x49f203=_0x5adb('0x24');return db[_0x5adb('0x25')]['destroy']({'where':{'type':_0x49f203,'resourceId':_0x3839fb['id']}})[_0x5adb('0x21')](function(){return _0x4b1957;});})[_0x5adb('0x21')](function(){_0xfd9bb9[_0x5adb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13ad1d,_0xbe21b1){return function(_0x3a4fca){if(!_0x3a4fca){_0x13ad1d[_0x5adb('0x26')](0x194);}return _0x3a4fca;};}function handleError(_0x36459b,_0x1c06c4){_0x1c06c4=_0x1c06c4||0x1f4;return function(_0x4a5d46){logger['error'](_0x4a5d46['stack']);if(_0x4a5d46[_0x5adb('0x27')]){delete _0x4a5d46[_0x5adb('0x27')];}_0x36459b[_0x5adb('0x1a')](_0x1c06c4)[_0x5adb('0x28')](_0x4a5d46);};}exports[_0x5adb('0x29')]=function(_0x4de310,_0x11ec2a){var _0x34b793={},_0x372da1={},_0x3b1fed={'count':0x0,'rows':[]};var _0x450169=db[_0x5adb('0x2a')][_0x5adb('0x2b')];_0x372da1[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](_0x450169);_0x372da1[_0x5adb('0x2e')]=_['keys'](_0x4de310[_0x5adb('0x2e')]);_0x372da1['filters']=_[_0x5adb('0x2f')](_0x372da1[_0x5adb('0x2c')],_0x372da1['query']);_0x34b793[_0x5adb('0x30')]=_[_0x5adb('0x2f')](_0x372da1[_0x5adb('0x2c')],qs['fields'](_0x4de310[_0x5adb('0x2e')][_0x5adb('0x31')]));_0x34b793['attributes']=_0x34b793['attributes'][_0x5adb('0x32')]?_0x34b793['attributes']:_0x372da1[_0x5adb('0x2c')];if(!_0x4de310[_0x5adb('0x2e')][_0x5adb('0x33')](_0x5adb('0x34'))){_0x34b793[_0x5adb('0x35')]=qs['limit'](_0x4de310[_0x5adb('0x2e')][_0x5adb('0x35')]);_0x34b793[_0x5adb('0x1d')]=qs['offset'](_0x4de310['query'][_0x5adb('0x1d')]);}_0x34b793[_0x5adb('0x36')]=qs['sort'](_0x4de310[_0x5adb('0x2e')]['sort']);_0x34b793[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4de310['query'],_0x372da1[_0x5adb('0x39')]));if(_0x4de310[_0x5adb('0x2e')]['filter']){_0x34b793[_0x5adb('0x37')]=_['merge'](_0x34b793[_0x5adb('0x37')],{'$or':_[_0x5adb('0x3a')](_0x450169,function(_0xd5660c){if(_0xd5660c['type'][_0x5adb('0x3b')]!==_0x5adb('0x3c')){var _0xcdaf8e={};_0xcdaf8e[_0xd5660c[_0x5adb('0x3d')]]={'$like':'%'+_0x4de310[_0x5adb('0x2e')]['filter']+'%'};return _0xcdaf8e;}})});}_0x34b793=_['merge']({},_0x34b793,_0x4de310['options']);var _0x599999={'where':_0x34b793[_0x5adb('0x37')]};return db[_0x5adb('0x2a')][_0x5adb('0x1c')](_0x599999)[_0x5adb('0x21')](function(_0x130e18){_0x3b1fed[_0x5adb('0x1c')]=_0x130e18;if(_0x4de310[_0x5adb('0x2e')][_0x5adb('0x3e')]){_0x34b793['include']=[{'all':!![]}];}return db['SquareProject'][_0x5adb('0x3f')](_0x34b793);})['then'](function(_0xa9f72d){_0x3b1fed[_0x5adb('0x40')]=_0xa9f72d;return _0x3b1fed;})[_0x5adb('0x21')](respondWithFilteredResult(_0x11ec2a,_0x34b793))[_0x5adb('0x41')](handleError(_0x11ec2a,null));};exports[_0x5adb('0x42')]=function(_0x522ee5,_0x43d320){var _0x565b03={'raw':![],'where':{'id':_0x522ee5[_0x5adb('0x43')]['id']}},_0x508690={};_0x508690[_0x5adb('0x2c')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x2b')]);_0x508690[_0x5adb('0x2e')]=_[_0x5adb('0x2d')](_0x522ee5[_0x5adb('0x2e')]);_0x508690[_0x5adb('0x39')]=_[_0x5adb('0x2f')](_0x508690['model'],_0x508690['query']);_0x565b03[_0x5adb('0x30')]=_[_0x5adb('0x2f')](_0x508690[_0x5adb('0x2c')],qs[_0x5adb('0x31')](_0x522ee5['query']['fields']));_0x565b03[_0x5adb('0x30')]=_0x565b03[_0x5adb('0x30')][_0x5adb('0x32')]?_0x565b03[_0x5adb('0x30')]:_0x508690[_0x5adb('0x2c')];if(_0x522ee5['query'][_0x5adb('0x3e')]){_0x565b03[_0x5adb('0x44')]=[{'all':!![]}];}_0x565b03=_['merge']({},_0x565b03,_0x522ee5[_0x5adb('0x45')]);return db[_0x5adb('0x2a')][_0x5adb('0x46')](_0x565b03)[_0x5adb('0x21')](handleEntityNotFound(_0x43d320,null))[_0x5adb('0x21')](respondWithResult(_0x43d320,null))[_0x5adb('0x41')](handleError(_0x43d320,null));};exports[_0x5adb('0x47')]=function(_0x54252,_0x49e1a1){return db[_0x5adb('0x2a')]['create'](_0x54252['body'],{})['then'](function(_0x3cd211){var _0x3fbac8=_0x54252[_0x5adb('0x48')]['get']({'plain':!![]});if(!_0x3fbac8)throw new Error(_0x5adb('0x49'));if(_0x3fbac8['role']===_0x5adb('0x48')){var _0x2c3f21=_0x3cd211[_0x5adb('0x23')]({'plain':!![]});var _0x541537=_0x5adb('0x24');return db['UserProfileSection'][_0x5adb('0x46')]({'where':{'name':_0x541537,'userProfileId':_0x3fbac8[_0x5adb('0x4a')]},'raw':!![]})['then'](function(_0x2402a3){if(_0x2402a3&&_0x2402a3[_0x5adb('0x4b')]===0x0){return db[_0x5adb('0x25')][_0x5adb('0x47')]({'name':_0x2c3f21[_0x5adb('0x27')],'resourceId':_0x2c3f21['id'],'type':_0x2402a3['name'],'sectionId':_0x2402a3['id']},{})[_0x5adb('0x21')](function(){return _0x3cd211;});}else{return _0x3cd211;}})[_0x5adb('0x41')](function(_0x3bcf6f){logger[_0x5adb('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3bcf6f);throw _0x3bcf6f;});}return _0x3cd211;})[_0x5adb('0x21')](respondWithResult(_0x49e1a1,0xc9))[_0x5adb('0x41')](handleError(_0x49e1a1,null));};exports[_0x5adb('0x20')]=function(_0x4d98d0,_0x2b34a8){if(_0x4d98d0[_0x5adb('0x4d')]['id']){delete _0x4d98d0[_0x5adb('0x4d')]['id'];}return db[_0x5adb('0x2a')]['find']({'where':{'id':_0x4d98d0[_0x5adb('0x43')]['id']}})[_0x5adb('0x21')](handleEntityNotFound(_0x2b34a8,null))[_0x5adb('0x21')](saveUpdates(_0x4d98d0[_0x5adb('0x4d')],null))[_0x5adb('0x21')](respondWithResult(_0x2b34a8,null))['catch'](handleError(_0x2b34a8,null));};exports[_0x5adb('0x22')]=function(_0x4b8d28,_0x2b790d){return db['SquareProject'][_0x5adb('0x46')]({'where':{'id':_0x4b8d28[_0x5adb('0x43')]['id']}})[_0x5adb('0x21')](handleEntityNotFound(_0x2b790d,null))[_0x5adb('0x21')](removeEntity(_0x2b790d,null))['catch'](handleError(_0x2b790d,null));};exports[_0x5adb('0x4e')]=function(_0x229ae2,_0x24b1f1,_0x53d262){return db['SquareProject']['find']({'where':{'id':_0x229ae2[_0x5adb('0x43')]['id']}})[_0x5adb('0x21')](handleEntityNotFound(_0x24b1f1,null))[_0x5adb('0x21')](function(_0x12a146){if(_0x12a146){return _0x12a146[_0x5adb('0x4e')](_0x229ae2[_0x5adb('0x4d')][_0x5adb('0x4f')],_[_0x5adb('0x50')](_0x229ae2[_0x5adb('0x4d')],[_0x5adb('0x4f'),'id'])||{});}})[_0x5adb('0x21')](respondWithResult(_0x24b1f1,null))[_0x5adb('0x41')](handleError(_0x24b1f1,null));};exports[_0x5adb('0x51')]=function(_0x511746,_0x49f4c8,_0x3d55c2){var _0x27a8e4;return db[_0x5adb('0x2a')][_0x5adb('0x46')]({'where':{'id':_0x511746['params']['id']}})[_0x5adb('0x21')](handleEntityNotFound(_0x49f4c8,null))[_0x5adb('0x21')](function(_0x5d2d2f){if(_0x5d2d2f){return _0x5d2d2f[_0x5adb('0x51')](_0x511746[_0x5adb('0x2e')][_0x5adb('0x4f')])['then'](function(_0x30d185){if(_[_0x5adb('0x52')](_0x511746[_0x5adb('0x2e')][_0x5adb('0x4f')])){for(var _0x330290=0x0;_0x330290<_0x511746[_0x5adb('0x2e')]['ids'][_0x5adb('0x32')];_0x330290+=0x1){socket[_0x5adb('0x53')](_0x5adb('0x54'),{'UserId':_0x511746['query'][_0x5adb('0x4f')][_0x330290],'SquareProjectId':_0x511746[_0x5adb('0x43')]['id']});}}else{socket[_0x5adb('0x53')]('userSquareProject:remove',{'UserId':_0x511746[_0x5adb('0x2e')]['ids'],'SquareProjectId':_0x511746[_0x5adb('0x43')]['id']});}});}})[_0x5adb('0x21')](respondWithStatusCode(_0x49f4c8,null))[_0x5adb('0x41')](handleError(_0x49f4c8,null));};exports['getUsers']=function(_0x192b1f,_0x3627d1,_0x539814){var _0x12711e={};var _0x432a3e={};var _0x248739;var _0x3fcad5;return db['SquareProject'][_0x5adb('0x55')]({'where':{'id':_0x192b1f[_0x5adb('0x43')]['id']}})[_0x5adb('0x21')](handleEntityNotFound(_0x3627d1,null))[_0x5adb('0x21')](function(_0x5b7556){if(_0x5b7556){_0x248739=_0x5b7556;_0x432a3e['model']=_[_0x5adb('0x2d')](db['User']['rawAttributes']);_0x432a3e['query']=_[_0x5adb('0x2d')](_0x192b1f[_0x5adb('0x2e')]);_0x432a3e['filters']=_[_0x5adb('0x2f')](_0x432a3e[_0x5adb('0x2c')],_0x432a3e[_0x5adb('0x2e')]);_0x12711e[_0x5adb('0x30')]=_[_0x5adb('0x2f')](_0x432a3e[_0x5adb('0x2c')],qs[_0x5adb('0x31')](_0x192b1f[_0x5adb('0x2e')]['fields']));_0x12711e['attributes']=_0x12711e['attributes'][_0x5adb('0x32')]?_0x12711e[_0x5adb('0x30')]:_0x432a3e[_0x5adb('0x2c')];_0x12711e[_0x5adb('0x36')]=qs[_0x5adb('0x56')](_0x192b1f[_0x5adb('0x2e')][_0x5adb('0x56')]);_0x12711e[_0x5adb('0x37')]=qs['filters'](_['pick'](_0x192b1f[_0x5adb('0x2e')],_0x432a3e[_0x5adb('0x39')]));if(_0x192b1f[_0x5adb('0x2e')][_0x5adb('0x57')]){_0x12711e[_0x5adb('0x37')]=_[_0x5adb('0x58')](_0x12711e[_0x5adb('0x37')],{'$or':_[_0x5adb('0x3a')](_0x12711e[_0x5adb('0x30')],function(_0x3b5ecf){var _0x484f3d={};_0x484f3d[_0x3b5ecf]={'$like':'%'+_0x192b1f[_0x5adb('0x2e')][_0x5adb('0x57')]+'%'};return _0x484f3d;})});}_0x12711e=_[_0x5adb('0x58')]({},_0x12711e,_0x192b1f['options']);return _0x248739[_0x5adb('0x59')](_0x12711e);}})[_0x5adb('0x21')](function(_0x4f7bd0){if(_0x4f7bd0){_0x3fcad5=_0x4f7bd0[_0x5adb('0x32')];if(!_0x192b1f['query'][_0x5adb('0x33')](_0x5adb('0x34'))){_0x12711e['limit']=qs[_0x5adb('0x35')](_0x192b1f[_0x5adb('0x2e')][_0x5adb('0x35')]);_0x12711e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x192b1f[_0x5adb('0x2e')][_0x5adb('0x1d')]);}return _0x248739[_0x5adb('0x59')](_0x12711e);}})['then'](function(_0x3786b4){if(_0x3786b4){return _0x3786b4?{'count':_0x3fcad5,'rows':_0x3786b4}:null;}})[_0x5adb('0x21')](respondWithResult(_0x3627d1,null))[_0x5adb('0x41')](handleError(_0x3627d1,null));}; \ No newline at end of file +var _0xdb28=['status','end','json','offset','limit','set','apply','save','update','then','get','SquareProjects','UserProfileResource','destroy','error','stack','name','index','SquareProject','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','map','type','VIRTUAL','field','filter','options','count','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','nolimit','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','sendStatus'];(function(_0x3a3758,_0x4dd8cf){var _0x1a9234=function(_0x3dda22){while(--_0x3dda22){_0x3a3758['push'](_0x3a3758['shift']());}};_0x1a9234(++_0x4dd8cf);}(_0xdb28,0x106));var _0x8db2=function(_0x22f5df,_0x34733c){_0x22f5df=_0x22f5df-0x0;var _0x5746bd=_0xdb28[_0x22f5df];return _0x5746bd;};'use strict';var pdf=require(_0x8db2('0x0'));var emlformat=require(_0x8db2('0x1'));var rimraf=require(_0x8db2('0x2'));var zipdir=require(_0x8db2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8db2('0x4'));var moment=require(_0x8db2('0x5'));var BPromise=require(_0x8db2('0x6'));var Mustache=require(_0x8db2('0x7'));var util=require(_0x8db2('0x8'));var path=require('path');var sox=require(_0x8db2('0x9'));var csv=require(_0x8db2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0xa'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var authService=require('../../components/auth/service');var hardwareService=require(_0x8db2('0x11'));var Redis=require(_0x8db2('0x12'));var qs=require(_0x8db2('0x13'));var logger=require('../../config/logger')(_0x8db2('0x14'));var utils=require(_0x8db2('0x15'));var config=require('../../config/environment');var db=require(_0x8db2('0x16'))['db'];config[_0x8db2('0x17')]=_[_0x8db2('0x18')](config[_0x8db2('0x17')],{'host':_0x8db2('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8db2('0x1a'))[_0x8db2('0x1b')](socket);function respondWithStatusCode(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xcc;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x1c')](_0x1d6a15);}return _0x350d61[_0x8db2('0x1d')](_0x1d6a15)[_0x8db2('0x1e')]();};}function respondWithResult(_0x131252,_0x16c8c2){_0x16c8c2=_0x16c8c2||0xc8;return function(_0x5489a9){if(_0x5489a9){return _0x131252[_0x8db2('0x1d')](_0x16c8c2)[_0x8db2('0x1f')](_0x5489a9);}};}function respondWithFilteredResult(_0x48101e,_0x2b3f73){return function(_0x44957d){if(_0x44957d){var _0x21db8c=_0x44957d['count'],_0x3fddc2=_0x2b3f73['offset'],_0x2efd06=_0x2b3f73[_0x8db2('0x20')]+_0x2b3f73[_0x8db2('0x21')],_0x46ce14;if(_0x2efd06>=_0x21db8c){_0x2efd06=_0x21db8c;_0x46ce14=0xc8;}else{_0x46ce14=0xce;}_0x48101e[_0x8db2('0x1d')](_0x46ce14);return _0x48101e[_0x8db2('0x22')]('Content-Range',_0x3fddc2+'-'+_0x2efd06+'/'+_0x21db8c)[_0x8db2('0x1f')](_0x44957d);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x23')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x24')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x25')](_0x3e30e6)[_0x8db2('0x26')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){var _0x4d923c=_0x4f6516[_0x8db2('0x27')]({'plain':!![]});var _0x29b5cd=_0x8db2('0x28');return db[_0x8db2('0x29')][_0x8db2('0x2a')]({'where':{'type':_0x29b5cd,'resourceId':_0x4d923c['id']}})[_0x8db2('0x26')](function(){return _0x4f6516;});})['then'](function(){_0x5c6614[_0x8db2('0x1d')](0xcc)[_0x8db2('0x1e')]();});}};}function handleEntityNotFound(_0x430dd5,_0x8b7cec){return function(_0x483aee){if(!_0x483aee){_0x430dd5[_0x8db2('0x1c')](0x194);}return _0x483aee;};}function handleError(_0x11f398,_0x241baf){_0x241baf=_0x241baf||0x1f4;return function(_0x1687ed){logger[_0x8db2('0x2b')](_0x1687ed[_0x8db2('0x2c')]);if(_0x1687ed[_0x8db2('0x2d')]){delete _0x1687ed[_0x8db2('0x2d')];}_0x11f398[_0x8db2('0x1d')](_0x241baf)['send'](_0x1687ed);};}exports[_0x8db2('0x2e')]=function(_0x50b28d,_0x59cb77){var _0x302188={},_0x25ed2c={},_0xcc8a66={'count':0x0,'rows':[]};var _0x49b2b3=db[_0x8db2('0x2f')]['rawAttributes'];_0x25ed2c[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x49b2b3);_0x25ed2c[_0x8db2('0x32')]=_['keys'](_0x50b28d['query']);_0x25ed2c[_0x8db2('0x33')]=_[_0x8db2('0x34')](_0x25ed2c['model'],_0x25ed2c['query']);_0x302188[_0x8db2('0x35')]=_[_0x8db2('0x34')](_0x25ed2c[_0x8db2('0x30')],qs[_0x8db2('0x36')](_0x50b28d[_0x8db2('0x32')][_0x8db2('0x36')]));_0x302188[_0x8db2('0x35')]=_0x302188[_0x8db2('0x35')][_0x8db2('0x37')]?_0x302188[_0x8db2('0x35')]:_0x25ed2c['model'];if(!_0x50b28d[_0x8db2('0x32')][_0x8db2('0x38')]('nolimit')){_0x302188[_0x8db2('0x21')]=qs[_0x8db2('0x21')](_0x50b28d['query']['limit']);_0x302188[_0x8db2('0x20')]=qs['offset'](_0x50b28d[_0x8db2('0x32')][_0x8db2('0x20')]);}_0x302188[_0x8db2('0x39')]=qs[_0x8db2('0x3a')](_0x50b28d['query'][_0x8db2('0x3a')]);_0x302188['where']=qs[_0x8db2('0x33')](_[_0x8db2('0x3b')](_0x50b28d[_0x8db2('0x32')],_0x25ed2c[_0x8db2('0x33')]));if(_0x50b28d['query']['filter']){_0x302188[_0x8db2('0x3c')]=_[_0x8db2('0x3d')](_0x302188['where'],{'$or':_[_0x8db2('0x3e')](_0x49b2b3,function(_0x24bcfe){if(_0x24bcfe[_0x8db2('0x3f')]['key']!==_0x8db2('0x40')){var _0x149186={};_0x149186[_0x24bcfe[_0x8db2('0x41')]]={'$like':'%'+_0x50b28d[_0x8db2('0x32')][_0x8db2('0x42')]+'%'};return _0x149186;}})});}_0x302188=_[_0x8db2('0x3d')]({},_0x302188,_0x50b28d[_0x8db2('0x43')]);var _0x1575ea={'where':_0x302188[_0x8db2('0x3c')]};return db[_0x8db2('0x2f')][_0x8db2('0x44')](_0x1575ea)[_0x8db2('0x26')](function(_0x1d9025){_0xcc8a66['count']=_0x1d9025;if(_0x50b28d[_0x8db2('0x32')][_0x8db2('0x45')]){_0x302188['include']=[{'all':!![]}];}return db['SquareProject'][_0x8db2('0x46')](_0x302188);})['then'](function(_0x130eb9){_0xcc8a66[_0x8db2('0x47')]=_0x130eb9;return _0xcc8a66;})[_0x8db2('0x26')](respondWithFilteredResult(_0x59cb77,_0x302188))[_0x8db2('0x48')](handleError(_0x59cb77,null));};exports[_0x8db2('0x49')]=function(_0x30d606,_0xa53fba){var _0x5c97ef={'raw':![],'where':{'id':_0x30d606[_0x8db2('0x4a')]['id']}},_0x2f86b1={};_0x2f86b1[_0x8db2('0x30')]=_[_0x8db2('0x31')](db['SquareProject'][_0x8db2('0x4b')]);_0x2f86b1[_0x8db2('0x32')]=_[_0x8db2('0x31')](_0x30d606[_0x8db2('0x32')]);_0x2f86b1['filters']=_[_0x8db2('0x34')](_0x2f86b1['model'],_0x2f86b1[_0x8db2('0x32')]);_0x5c97ef[_0x8db2('0x35')]=_[_0x8db2('0x34')](_0x2f86b1['model'],qs['fields'](_0x30d606[_0x8db2('0x32')]['fields']));_0x5c97ef[_0x8db2('0x35')]=_0x5c97ef[_0x8db2('0x35')][_0x8db2('0x37')]?_0x5c97ef[_0x8db2('0x35')]:_0x2f86b1[_0x8db2('0x30')];if(_0x30d606[_0x8db2('0x32')][_0x8db2('0x45')]){_0x5c97ef[_0x8db2('0x4c')]=[{'all':!![]}];}_0x5c97ef=_[_0x8db2('0x3d')]({},_0x5c97ef,_0x30d606[_0x8db2('0x43')]);return db[_0x8db2('0x2f')][_0x8db2('0x4d')](_0x5c97ef)['then'](handleEntityNotFound(_0xa53fba,null))[_0x8db2('0x26')](respondWithResult(_0xa53fba,null))[_0x8db2('0x48')](handleError(_0xa53fba,null));};exports[_0x8db2('0x4e')]=function(_0x3244db,_0x4f5018){return db['SquareProject'][_0x8db2('0x4e')](_0x3244db[_0x8db2('0x4f')],{})[_0x8db2('0x26')](function(_0x4c66e5){var _0x540d90=_0x3244db['user'][_0x8db2('0x27')]({'plain':!![]});if(!_0x540d90)throw new Error(_0x8db2('0x50'));if(_0x540d90[_0x8db2('0x51')]===_0x8db2('0x52')){var _0xaab731=_0x4c66e5[_0x8db2('0x27')]({'plain':!![]});var _0x2fa118='SquareProjects';return db['UserProfileSection'][_0x8db2('0x4d')]({'where':{'name':_0x2fa118,'userProfileId':_0x540d90[_0x8db2('0x53')]},'raw':!![]})[_0x8db2('0x26')](function(_0x2f0bd0){if(_0x2f0bd0&&_0x2f0bd0[_0x8db2('0x54')]===0x0){return db[_0x8db2('0x29')][_0x8db2('0x4e')]({'name':_0xaab731[_0x8db2('0x2d')],'resourceId':_0xaab731['id'],'type':_0x2f0bd0[_0x8db2('0x2d')],'sectionId':_0x2f0bd0['id']},{})[_0x8db2('0x26')](function(){return _0x4c66e5;});}else{return _0x4c66e5;}})[_0x8db2('0x48')](function(_0x319273){logger[_0x8db2('0x2b')](_0x8db2('0x55'),_0x319273);throw _0x319273;});}return _0x4c66e5;})[_0x8db2('0x26')](respondWithResult(_0x4f5018,0xc9))['catch'](handleError(_0x4f5018,null));};exports[_0x8db2('0x25')]=function(_0xb4b0a,_0x579317){if(_0xb4b0a[_0x8db2('0x4f')]['id']){delete _0xb4b0a[_0x8db2('0x4f')]['id'];}return db[_0x8db2('0x2f')]['find']({'where':{'id':_0xb4b0a[_0x8db2('0x4a')]['id']}})[_0x8db2('0x26')](handleEntityNotFound(_0x579317,null))[_0x8db2('0x26')](saveUpdates(_0xb4b0a[_0x8db2('0x4f')],null))[_0x8db2('0x26')](respondWithResult(_0x579317,null))['catch'](handleError(_0x579317,null));};exports[_0x8db2('0x2a')]=function(_0x159dcb,_0x469bc2){return db['SquareProject'][_0x8db2('0x4d')]({'where':{'id':_0x159dcb[_0x8db2('0x4a')]['id']}})[_0x8db2('0x26')](handleEntityNotFound(_0x469bc2,null))[_0x8db2('0x26')](removeEntity(_0x469bc2,null))[_0x8db2('0x48')](handleError(_0x469bc2,null));};exports[_0x8db2('0x56')]=function(_0x12a81a,_0x5ca295,_0x39ff90){return db[_0x8db2('0x2f')]['find']({'where':{'id':_0x12a81a[_0x8db2('0x4a')]['id']}})[_0x8db2('0x26')](handleEntityNotFound(_0x5ca295,null))['then'](function(_0x107bbe){if(_0x107bbe){return _0x107bbe[_0x8db2('0x56')](_0x12a81a[_0x8db2('0x4f')][_0x8db2('0x57')],_[_0x8db2('0x58')](_0x12a81a[_0x8db2('0x4f')],[_0x8db2('0x57'),'id'])||{});}})[_0x8db2('0x26')](respondWithResult(_0x5ca295,null))[_0x8db2('0x48')](handleError(_0x5ca295,null));};exports[_0x8db2('0x59')]=function(_0x12fd12,_0x447a47,_0x3272c6){var _0x1ce89f;return db[_0x8db2('0x2f')][_0x8db2('0x4d')]({'where':{'id':_0x12fd12['params']['id']}})[_0x8db2('0x26')](handleEntityNotFound(_0x447a47,null))[_0x8db2('0x26')](function(_0x44118a){if(_0x44118a){return _0x44118a[_0x8db2('0x59')](_0x12fd12[_0x8db2('0x32')]['ids'])[_0x8db2('0x26')](function(_0x2c3087){if(_[_0x8db2('0x5a')](_0x12fd12[_0x8db2('0x32')][_0x8db2('0x57')])){for(var _0x348da8=0x0;_0x348da8<_0x12fd12[_0x8db2('0x32')][_0x8db2('0x57')][_0x8db2('0x37')];_0x348da8+=0x1){socket[_0x8db2('0x5b')](_0x8db2('0x5c'),{'UserId':_0x12fd12[_0x8db2('0x32')][_0x8db2('0x57')][_0x348da8],'SquareProjectId':_0x12fd12[_0x8db2('0x4a')]['id']});}}else{socket[_0x8db2('0x5b')](_0x8db2('0x5c'),{'UserId':_0x12fd12[_0x8db2('0x32')][_0x8db2('0x57')],'SquareProjectId':_0x12fd12['params']['id']});}});}})[_0x8db2('0x26')](respondWithStatusCode(_0x447a47,null))['catch'](handleError(_0x447a47,null));};exports[_0x8db2('0x5d')]=function(_0x570c53,_0x3de11e,_0x39330c){var _0xe4fd6a={};var _0x1e2ccd={};var _0x1e812e;var _0x59a32e;return db['SquareProject'][_0x8db2('0x5e')]({'where':{'id':_0x570c53[_0x8db2('0x4a')]['id']}})[_0x8db2('0x26')](handleEntityNotFound(_0x3de11e,null))[_0x8db2('0x26')](function(_0x20b49c){if(_0x20b49c){_0x1e812e=_0x20b49c;_0x1e2ccd[_0x8db2('0x30')]=_[_0x8db2('0x31')](db[_0x8db2('0x5f')]['rawAttributes']);_0x1e2ccd[_0x8db2('0x32')]=_[_0x8db2('0x31')](_0x570c53[_0x8db2('0x32')]);_0x1e2ccd[_0x8db2('0x33')]=_[_0x8db2('0x34')](_0x1e2ccd[_0x8db2('0x30')],_0x1e2ccd[_0x8db2('0x32')]);_0xe4fd6a[_0x8db2('0x35')]=_['intersection'](_0x1e2ccd['model'],qs[_0x8db2('0x36')](_0x570c53[_0x8db2('0x32')][_0x8db2('0x36')]));_0xe4fd6a[_0x8db2('0x35')]=_0xe4fd6a[_0x8db2('0x35')]['length']?_0xe4fd6a['attributes']:_0x1e2ccd[_0x8db2('0x30')];_0xe4fd6a[_0x8db2('0x39')]=qs['sort'](_0x570c53[_0x8db2('0x32')][_0x8db2('0x3a')]);_0xe4fd6a[_0x8db2('0x3c')]=qs['filters'](_[_0x8db2('0x3b')](_0x570c53[_0x8db2('0x32')],_0x1e2ccd[_0x8db2('0x33')]));if(_0x570c53['query'][_0x8db2('0x42')]){_0xe4fd6a[_0x8db2('0x3c')]=_[_0x8db2('0x3d')](_0xe4fd6a[_0x8db2('0x3c')],{'$or':_[_0x8db2('0x3e')](_0xe4fd6a['attributes'],function(_0x3c9af4){var _0x3023fe={};_0x3023fe[_0x3c9af4]={'$like':'%'+_0x570c53[_0x8db2('0x32')]['filter']+'%'};return _0x3023fe;})});}_0xe4fd6a=_['merge']({},_0xe4fd6a,_0x570c53[_0x8db2('0x43')]);return _0x1e812e[_0x8db2('0x5d')](_0xe4fd6a);}})['then'](function(_0x1eecf1){if(_0x1eecf1){_0x59a32e=_0x1eecf1[_0x8db2('0x37')];if(!_0x570c53[_0x8db2('0x32')][_0x8db2('0x38')](_0x8db2('0x60'))){_0xe4fd6a[_0x8db2('0x21')]=qs[_0x8db2('0x21')](_0x570c53[_0x8db2('0x32')][_0x8db2('0x21')]);_0xe4fd6a[_0x8db2('0x20')]=qs[_0x8db2('0x20')](_0x570c53[_0x8db2('0x32')][_0x8db2('0x20')]);}return _0x1e812e['getUsers'](_0xe4fd6a);}})[_0x8db2('0x26')](function(_0x4f29f1){if(_0x4f29f1){return _0x4f29f1?{'count':_0x59a32e,'rows':_0x4f29f1}:null;}})[_0x8db2('0x26')](respondWithResult(_0x3de11e,null))[_0x8db2('0x48')](handleError(_0x3de11e,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 7fdc345..483a412 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 _0x2dd1=['events','../../mysqldb','SquareProject','setMaxListeners','save','update','emit','hook','exports'];(function(_0x25e905,_0x42f080){var _0x4d1f16=function(_0x575f79){while(--_0x575f79){_0x25e905['push'](_0x25e905['shift']());}};_0x4d1f16(++_0x42f080);}(_0x2dd1,0x18c));var _0x12dd=function(_0x43ab39,_0x257da5){_0x43ab39=_0x43ab39-0x0;var _0x497e62=_0x2dd1[_0x43ab39];return _0x497e62;};'use strict';var EventEmitter=require(_0x12dd('0x0'));var SquareProject=require(_0x12dd('0x1'))['db'][_0x12dd('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x12dd('0x3')](0x0);var events={'afterCreate':_0x12dd('0x4'),'afterUpdate':_0x12dd('0x5'),'afterDestroy':'remove'};function emitEvent(_0x422442){return function(_0x11a645,_0x342c98,_0x35f79a){SquareProjectEvents[_0x12dd('0x6')](_0x422442+':'+_0x11a645['id'],_0x11a645);SquareProjectEvents[_0x12dd('0x6')](_0x422442,_0x11a645);_0x35f79a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x12dd('0x7')](e,emitEvent(event));}}module[_0x12dd('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x17f8=['emit','hook','exports','../../mysqldb','SquareProject','setMaxListeners','save','remove'];(function(_0x405d5b,_0x367d49){var _0x26b41c=function(_0x4c539a){while(--_0x4c539a){_0x405d5b['push'](_0x405d5b['shift']());}};_0x26b41c(++_0x367d49);}(_0x17f8,0x11b));var _0x817f=function(_0x20ebb9,_0x3535bb){_0x20ebb9=_0x20ebb9-0x0;var _0x1ec31d=_0x17f8[_0x20ebb9];return _0x1ec31d;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x817f('0x0'))['db'][_0x817f('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x817f('0x2')](0x0);var events={'afterCreate':_0x817f('0x3'),'afterUpdate':'update','afterDestroy':_0x817f('0x4')};function emitEvent(_0x53b964){return function(_0x38d95f,_0x2e4711,_0x5d6a01){SquareProjectEvents[_0x817f('0x5')](_0x53b964+':'+_0x38d95f['id'],_0x38d95f);SquareProjectEvents['emit'](_0x53b964,_0x38d95f);_0x5d6a01(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x817f('0x6')](e,emitEvent(event));}}module[_0x817f('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 721d39f..063fab0 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 _0x1963=['util','../../config/logger','api','bluebird','./squareProject.attributes','exports','lodash'];(function(_0x2212c5,_0xaacd7a){var _0x4d50d8=function(_0x3fee3b){while(--_0x3fee3b){_0x2212c5['push'](_0x2212c5['shift']());}};_0x4d50d8(++_0xaacd7a);}(_0x1963,0xa0));var _0x3196=function(_0x1129f4,_0x33b6c7){_0x1129f4=_0x1129f4-0x0;var _0x1942ab=_0x1963[_0x1129f4];return _0x1942ab;};'use strict';var _=require(_0x3196('0x0'));var util=require(_0x3196('0x1'));var logger=require(_0x3196('0x2'))(_0x3196('0x3'));var moment=require('moment');var BPromise=require(_0x3196('0x4'));var rp=require('request-promise');var attributes=require(_0x3196('0x5'));module[_0x3196('0x6')]=function(_0x583ad2,_0x5beb13){return _0x583ad2['define']('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4613=['SquareProject','square_projects','lodash','util','../../config/logger','api','moment','exports','define'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x4613,0x18e));var _0x3461=function(_0x3e790a,_0x14f1e8){_0x3e790a=_0x3e790a-0x0;var _0xdefc=_0x4613[_0x3e790a];return _0xdefc;};'use strict';var _=require(_0x3461('0x0'));var util=require(_0x3461('0x1'));var logger=require(_0x3461('0x2'))(_0x3461('0x3'));var moment=require(_0x3461('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./squareProject.attributes');module[_0x3461('0x5')]=function(_0x2235db,_0x350b4a){return _0x2235db[_0x3461('0x6')](_0x3461('0x7'),attributes,{'tableName':_0x3461('0x8'),'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 8db0bc4..3d2080a 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 _0xa9e0=['catch','ShowSquareProject','find','options','raw','where','attributes','include','map','model','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x1ba2cf,_0x57b0f2){var _0x4ef5b5=function(_0x4c5dcc){while(--_0x4c5dcc){_0x1ba2cf['push'](_0x1ba2cf['shift']());}};_0x4ef5b5(++_0x57b0f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});config[_0x0a9e('0xa')]=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xc'))(new Redis(config['redis']));require('./squareProject.socket')[_0x0a9e('0xd')](socket);function respondWithRpcPromise(_0xf81284,_0x307b3e,_0x3ab53f){return new BPromise(function(_0xfeb75b,_0xbd1168){return client['request'](_0xf81284,_0x3ab53f)['then'](function(_0x527cdd){logger['info'](_0x0a9e('0xe'),_0x307b3e,_0x0a9e('0xf'));logger[_0x0a9e('0x10')](_0x0a9e('0x11'),_0x307b3e,_0x0a9e('0xf'),JSON[_0x0a9e('0x12')](_0x527cdd));if(_0x527cdd['error']){if(_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x14')]===0x1f4){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x15')]);return _0xbd1168(_0x527cdd['error'][_0x0a9e('0x15')]);}logger['error'](_0x0a9e('0xe'),_0x307b3e,_0x527cdd['error'][_0x0a9e('0x15')]);return _0xfeb75b(_0x527cdd[_0x0a9e('0x13')]['message']);}else{logger[_0x0a9e('0x16')]('SquareProject,\x20%s,\x20%s',_0x307b3e,_0x0a9e('0xf'));_0xfeb75b(_0x527cdd[_0x0a9e('0x17')][_0x0a9e('0x15')]);}})[_0x0a9e('0x18')](function(_0x31b1ca){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x31b1ca);_0xbd1168(_0x31b1ca);});});}exports[_0x0a9e('0x19')]=function(_0x1314ae){var _0x112016=this;return new Promise(function(_0x1c696a,_0x105080){return db['SquareProject'][_0x0a9e('0x1a')]({'raw':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae['options'][_0x0a9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x1314ae['options']?_0x1314ae['options'][_0x0a9e('0x1d')]||null:null,'attributes':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1e')]||null:null,'include':_0x1314ae['options']?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')],function(_0x42ac8f){return{'model':db[_0x42ac8f[_0x0a9e('0x21')]],'as':_0x42ac8f['as'],'attributes':_0x42ac8f['attributes'],'include':_0x42ac8f['include']?_[_0x0a9e('0x20')](_0x42ac8f[_0x0a9e('0x1f')],function(_0x40c424){return{'model':db[_0x40c424[_0x0a9e('0x21')]],'as':_0x40c424['as'],'attributes':_0x40c424['attributes'],'include':_0x40c424[_0x0a9e('0x1f')]?_['map'](_0x40c424[_0x0a9e('0x1f')],function(_0x5bfb33){return{'model':db[_0x5bfb33[_0x0a9e('0x21')]],'as':_0x5bfb33['as'],'attributes':_0x5bfb33[_0x0a9e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x22')](function(_0x14433c){logger[_0x0a9e('0x16')](_0x0a9e('0x19'),_0x1314ae);logger[_0x0a9e('0x10')](_0x0a9e('0x19'),_0x1314ae,JSON['stringify'](_0x14433c));_0x1c696a(_0x14433c);})[_0x0a9e('0x18')](function(_0x468813){logger[_0x0a9e('0x13')](_0x0a9e('0x19'),_0x468813['message'],_0x1314ae);_0x105080(_0x112016[_0x0a9e('0x13')](0x1f4,_0x468813[_0x0a9e('0x15')]));});});}; \ No newline at end of file +var _0xa9e0=['catch','ShowSquareProject','find','options','raw','where','attributes','include','map','model','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});config[_0x0a9e('0xa')]=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xc'))(new Redis(config['redis']));require('./squareProject.socket')[_0x0a9e('0xd')](socket);function respondWithRpcPromise(_0xf81284,_0x307b3e,_0x3ab53f){return new BPromise(function(_0xfeb75b,_0xbd1168){return client['request'](_0xf81284,_0x3ab53f)['then'](function(_0x527cdd){logger['info'](_0x0a9e('0xe'),_0x307b3e,_0x0a9e('0xf'));logger[_0x0a9e('0x10')](_0x0a9e('0x11'),_0x307b3e,_0x0a9e('0xf'),JSON[_0x0a9e('0x12')](_0x527cdd));if(_0x527cdd['error']){if(_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x14')]===0x1f4){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x15')]);return _0xbd1168(_0x527cdd['error'][_0x0a9e('0x15')]);}logger['error'](_0x0a9e('0xe'),_0x307b3e,_0x527cdd['error'][_0x0a9e('0x15')]);return _0xfeb75b(_0x527cdd[_0x0a9e('0x13')]['message']);}else{logger[_0x0a9e('0x16')]('SquareProject,\x20%s,\x20%s',_0x307b3e,_0x0a9e('0xf'));_0xfeb75b(_0x527cdd[_0x0a9e('0x17')][_0x0a9e('0x15')]);}})[_0x0a9e('0x18')](function(_0x31b1ca){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x31b1ca);_0xbd1168(_0x31b1ca);});});}exports[_0x0a9e('0x19')]=function(_0x1314ae){var _0x112016=this;return new Promise(function(_0x1c696a,_0x105080){return db['SquareProject'][_0x0a9e('0x1a')]({'raw':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae['options'][_0x0a9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x1314ae['options']?_0x1314ae['options'][_0x0a9e('0x1d')]||null:null,'attributes':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1e')]||null:null,'include':_0x1314ae['options']?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')],function(_0x42ac8f){return{'model':db[_0x42ac8f[_0x0a9e('0x21')]],'as':_0x42ac8f['as'],'attributes':_0x42ac8f['attributes'],'include':_0x42ac8f['include']?_[_0x0a9e('0x20')](_0x42ac8f[_0x0a9e('0x1f')],function(_0x40c424){return{'model':db[_0x40c424[_0x0a9e('0x21')]],'as':_0x40c424['as'],'attributes':_0x40c424['attributes'],'include':_0x40c424[_0x0a9e('0x1f')]?_['map'](_0x40c424[_0x0a9e('0x1f')],function(_0x5bfb33){return{'model':db[_0x5bfb33[_0x0a9e('0x21')]],'as':_0x5bfb33['as'],'attributes':_0x5bfb33[_0x0a9e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x22')](function(_0x14433c){logger[_0x0a9e('0x16')](_0x0a9e('0x19'),_0x1314ae);logger[_0x0a9e('0x10')](_0x0a9e('0x19'),_0x1314ae,JSON['stringify'](_0x14433c));_0x1c696a(_0x14433c);})[_0x0a9e('0x18')](function(_0x468813){logger[_0x0a9e('0x13')](_0x0a9e('0x19'),_0x468813['message'],_0x1314ae);_0x105080(_0x112016[_0x0a9e('0x13')](0x1f4,_0x468813[_0x0a9e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index dfe8d67..effbbfb 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 _0x5b05=['update','emit','removeListener','length','save','remove'];(function(_0x24cd45,_0x39560c){var _0x150d83=function(_0x841b0e){while(--_0x841b0e){_0x24cd45['push'](_0x24cd45['shift']());}};_0x150d83(++_0x39560c);}(_0x5b05,0x190));var _0x55b0=function(_0x3c5a89,_0x403202){_0x3c5a89=_0x3c5a89-0x0;var _0xefc30c=_0x5b05[_0x3c5a89];return _0xefc30c;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x55b0('0x0'),_0x55b0('0x1'),_0x55b0('0x2')];function createListener(_0x4148d8,_0x28c785){return function(_0x2925fe){_0x28c785[_0x55b0('0x3')](_0x4148d8,_0x2925fe);};}function removeListener(_0x43a880,_0x2cbf51){return function(){SquareProjectEvents[_0x55b0('0x4')](_0x43a880,_0x2cbf51);};}exports['register']=function(_0x569adf){for(var _0x129898=0x0,_0xe0c407=events[_0x55b0('0x5')];_0x129898<_0xe0c407;_0x129898++){var _0x355e20=events[_0x129898];var _0xdf375f=createListener('squareProject:'+_0x355e20,_0x569adf);SquareProjectEvents['on'](_0x355e20,_0xdf375f);}}; \ No newline at end of file +var _0xaefc=['./squareProject.events','save','remove','length','squareProject:'];(function(_0x26b72c,_0x499dce){var _0x55f12a=function(_0x4c827f){while(--_0x4c827f){_0x26b72c['push'](_0x26b72c['shift']());}};_0x55f12a(++_0x499dce);}(_0xaefc,0xc8));var _0xcaef=function(_0x1f86ee,_0x45020d){_0x1f86ee=_0x1f86ee-0x0;var _0xbc31d0=_0xaefc[_0x1f86ee];return _0xbc31d0;};'use strict';var SquareProjectEvents=require(_0xcaef('0x0'));var events=[_0xcaef('0x1'),_0xcaef('0x2'),'update'];function createListener(_0x1da249,_0xd60229){return function(_0x49cc54){_0xd60229['emit'](_0x1da249,_0x49cc54);};}function removeListener(_0x37a134,_0x46a35e){return function(){SquareProjectEvents['removeListener'](_0x37a134,_0x46a35e);};}exports['register']=function(_0x47457d){for(var _0x4471a1=0x0,_0x567a8f=events[_0xcaef('0x3')];_0x4471a1<_0x567a8f;_0x4471a1++){var _0x538f22=events[_0x4471a1];var _0x49d64c=createListener(_0xcaef('0x4')+_0x538f22,_0x47457d);SquareProjectEvents['on'](_0x538f22,_0x49d64c);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 135b550..537b2e2 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 _0xda0d=['../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','post','create','update','destroy','multer','path','connect-timeout','express','Router'];(function(_0x4c321c,_0x3e9da0){var _0x25accb=function(_0x21bf7a){while(--_0x21bf7a){_0x4c321c['push'](_0x4c321c['shift']());}};_0x25accb(++_0x3e9da0);}(_0xda0d,0xcb));var _0xdda0=function(_0x28ae8c,_0x26f23e){_0x28ae8c=_0x28ae8c-0x0;var _0x3d31c9=_0xda0d[_0x28ae8c];return _0x3d31c9;};'use strict';var multer=require(_0xdda0('0x0'));var util=require('util');var path=require(_0xdda0('0x1'));var timeout=require(_0xdda0('0x2'));var express=require(_0xdda0('0x3'));var router=express[_0xdda0('0x4')]();var auth=require(_0xdda0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdda0('0x6'));var controller=require('./squareRecording.controller');router[_0xdda0('0x7')]('/',auth[_0xdda0('0x8')](),controller['index']);router[_0xdda0('0x7')](_0xdda0('0x9'),auth[_0xdda0('0x8')](),controller[_0xdda0('0xa')]);router['get'](_0xdda0('0xb'),auth[_0xdda0('0x8')](),controller['download']);router[_0xdda0('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda0('0xd')]);router['put'](_0xdda0('0x9'),auth[_0xdda0('0x8')](),controller[_0xdda0('0xe')]);router['delete'](_0xdda0('0x9'),auth[_0xdda0('0x8')](),controller[_0xdda0('0xf')]);module['exports']=router; \ No newline at end of file +var _0xe07d=['update','destroy','exports','multer','util','express','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','post','create'];(function(_0x399606,_0x376171){var _0x1e4bc1=function(_0xd92d16){while(--_0xd92d16){_0x399606['push'](_0x399606['shift']());}};_0x1e4bc1(++_0x376171);}(_0xe07d,0x179));var _0xde07=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xe07d[_0x1b828b];return _0x98da1a;};'use strict';var multer=require(_0xde07('0x0'));var util=require(_0xde07('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xde07('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xde07('0x3'));var config=require(_0xde07('0x4'));var controller=require(_0xde07('0x5'));router[_0xde07('0x6')]('/',auth[_0xde07('0x7')](),controller[_0xde07('0x8')]);router[_0xde07('0x6')](_0xde07('0x9'),auth['isAuthenticated'](),controller[_0xde07('0xa')]);router['get'](_0xde07('0xb'),auth[_0xde07('0x7')](),controller['download']);router[_0xde07('0xc')]('/',auth[_0xde07('0x7')](),controller[_0xde07('0xd')]);router['put'](_0xde07('0x9'),auth[_0xde07('0x7')](),controller[_0xde07('0xe')]);router['delete'](_0xde07('0x9'),auth[_0xde07('0x7')](),controller[_0xde07('0xf')]);module[_0xde07('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 a0699a6..2a23185 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 _0x81ce=['exports','STRING'];(function(_0x74835d,_0x4a898f){var _0xddf4e1=function(_0x12b63b){while(--_0x12b63b){_0x74835d['push'](_0x74835d['shift']());}};_0xddf4e1(++_0x4a898f);}(_0x81ce,0x13a));var _0xe81c=function(_0x5cce54,_0x50dbf1){_0x5cce54=_0x5cce54-0x0;var _0x23890d=_0x81ce[_0x5cce54];return _0x23890d;};'use strict';var Sequelize=require('sequelize');module[_0xe81c('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xe81c('0x1')]},'calleridname':{'type':Sequelize[_0xe81c('0x1')]},'context':{'type':Sequelize[_0xe81c('0x1')]},'extension':{'type':Sequelize[_0xe81c('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe81c('0x1')]},'dnid':{'type':Sequelize[_0xe81c('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xe81c('0x1')]},'savePath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa9de=['STRING','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9de,0x1ed));var _0xea9d=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xa9de[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');module[_0xea9d('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xea9d('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xea9d('0x1')]},'accountcode':{'type':Sequelize[_0xea9d('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0xea9d('0x1')]},'filename':{'type':Sequelize[_0xea9d('0x1')]},'savePath':{'type':Sequelize[_0xea9d('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 6c5663d..8cd9436 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 _0xe9be=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','SquareRecording','rawAttributes','model','keys','query','intersection','attributes','fields','length','order','sort','where','pick','filters','filter','type','key','field','merge','options','count','includeAll','catch','include','find','create','body','params','download','../../components/encryptor','uniqueid','savePath','%s.cypher','value','decryptFile','secrets','existsSync','SquareRecording\x20not\x20found','extname','unlink','html-pdf','eml-format','rimraf'];(function(_0x1bf91e,_0x243aab){var _0x354d30=function(_0x2b7aa8){while(--_0x2b7aa8){_0x1bf91e['push'](_0x1bf91e['shift']());}};_0x354d30(++_0x243aab);}(_0xe9be,0x188));var _0xee9b=function(_0x407e38,_0x30e1cb){_0x407e38=_0x407e38-0x0;var _0x996a91=_0xe9be[_0x407e38];return _0x996a91;};'use strict';var pdf=require(_0xee9b('0x0'));var emlformat=require(_0xee9b('0x1'));var rimraf=require(_0xee9b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xee9b('0x3'));var rp=require(_0xee9b('0x4'));var moment=require(_0xee9b('0x5'));var BPromise=require(_0xee9b('0x6'));var Mustache=require(_0xee9b('0x7'));var util=require(_0xee9b('0x8'));var path=require(_0xee9b('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xee9b('0xa'));var fs=require('fs');var _=require(_0xee9b('0xb'));var squel=require(_0xee9b('0xc'));var crypto=require(_0xee9b('0xd'));var jsforce=require(_0xee9b('0xe'));var deskjs=require(_0xee9b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xee9b('0x10'));var Papa=require('papaparse');var authService=require(_0xee9b('0x11'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0xee9b('0x12'));var logger=require(_0xee9b('0x13'))(_0xee9b('0x14'));var utils=require(_0xee9b('0x15'));var config=require(_0xee9b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dc445,_0x58e3b5){_0x58e3b5=_0x58e3b5||0xcc;return function(_0x2ab426){if(_0x2ab426){return _0x5dc445[_0xee9b('0x17')](_0x58e3b5);}return _0x5dc445[_0xee9b('0x18')](_0x58e3b5)['end']();};}function respondWithResult(_0x41c273,_0x56a2d5){_0x56a2d5=_0x56a2d5||0xc8;return function(_0x4fe5d2){if(_0x4fe5d2){return _0x41c273[_0xee9b('0x18')](_0x56a2d5)[_0xee9b('0x19')](_0x4fe5d2);}};}function respondWithFilteredResult(_0x3496a2,_0x1d0e61){return function(_0x4f5a89){if(_0x4f5a89){var _0x2681fd=_0x4f5a89['count'],_0x36bd04=_0x1d0e61['offset'],_0x5247ef=_0x1d0e61[_0xee9b('0x1a')]+_0x1d0e61[_0xee9b('0x1b')],_0x30e33d;if(_0x5247ef>=_0x2681fd){_0x5247ef=_0x2681fd;_0x30e33d=0xc8;}else{_0x30e33d=0xce;}_0x3496a2[_0xee9b('0x18')](_0x30e33d);return _0x3496a2[_0xee9b('0x1c')](_0xee9b('0x1d'),_0x36bd04+'-'+_0x5247ef+'/'+_0x2681fd)['json'](_0x4f5a89);}return null;};}function patchUpdates(_0x14fd5c){return function(_0x2301fb){try{jsonpatch[_0xee9b('0x1e')](_0x2301fb,_0x14fd5c,!![]);}catch(_0x5d2a67){return BPromise[_0xee9b('0x1f')](_0x5d2a67);}return _0x2301fb['save']();};}function saveUpdates(_0x6ca050,_0x4b0e82){return function(_0xce2a42){if(_0xce2a42){return _0xce2a42[_0xee9b('0x20')](_0x6ca050)[_0xee9b('0x21')](function(_0x304448){return _0x304448;});}return null;};}function removeEntity(_0x519a33,_0x32e91c){return function(_0x44f66c){if(_0x44f66c){return _0x44f66c[_0xee9b('0x22')]()[_0xee9b('0x21')](function(){_0x519a33[_0xee9b('0x18')](0xcc)[_0xee9b('0x23')]();});}};}function handleEntityNotFound(_0x23b918,_0x2d0d1a){return function(_0x57924e){if(!_0x57924e){_0x23b918[_0xee9b('0x17')](0x194);}return _0x57924e;};}function handleError(_0x415a64,_0x225b25){_0x225b25=_0x225b25||0x1f4;return function(_0x22a119){logger['error'](_0x22a119[_0xee9b('0x24')]);if(_0x22a119['name']){delete _0x22a119[_0xee9b('0x25')];}_0x415a64['status'](_0x225b25)[_0xee9b('0x26')](_0x22a119);};}exports['index']=function(_0x48c7f5,_0x490803){var _0x417c3a={},_0x5563a2={},_0x4124a9={'count':0x0,'rows':[]};var _0x4a276d=db[_0xee9b('0x27')][_0xee9b('0x28')];_0x5563a2[_0xee9b('0x29')]=_[_0xee9b('0x2a')](_0x4a276d);_0x5563a2[_0xee9b('0x2b')]=_['keys'](_0x48c7f5['query']);_0x5563a2['filters']=_[_0xee9b('0x2c')](_0x5563a2[_0xee9b('0x29')],_0x5563a2[_0xee9b('0x2b')]);_0x417c3a[_0xee9b('0x2d')]=_[_0xee9b('0x2c')](_0x5563a2[_0xee9b('0x29')],qs[_0xee9b('0x2e')](_0x48c7f5[_0xee9b('0x2b')][_0xee9b('0x2e')]));_0x417c3a['attributes']=_0x417c3a[_0xee9b('0x2d')][_0xee9b('0x2f')]?_0x417c3a[_0xee9b('0x2d')]:_0x5563a2[_0xee9b('0x29')];if(!_0x48c7f5[_0xee9b('0x2b')]['hasOwnProperty']('nolimit')){_0x417c3a[_0xee9b('0x1b')]=qs[_0xee9b('0x1b')](_0x48c7f5[_0xee9b('0x2b')][_0xee9b('0x1b')]);_0x417c3a[_0xee9b('0x1a')]=qs[_0xee9b('0x1a')](_0x48c7f5[_0xee9b('0x2b')][_0xee9b('0x1a')]);}_0x417c3a[_0xee9b('0x30')]=qs[_0xee9b('0x31')](_0x48c7f5['query']['sort']);_0x417c3a[_0xee9b('0x32')]=qs['filters'](_[_0xee9b('0x33')](_0x48c7f5['query'],_0x5563a2[_0xee9b('0x34')]));if(_0x48c7f5[_0xee9b('0x2b')][_0xee9b('0x35')]){_0x417c3a[_0xee9b('0x32')]=_['merge'](_0x417c3a[_0xee9b('0x32')],{'$or':_['map'](_0x4a276d,function(_0x1bc9e8){if(_0x1bc9e8[_0xee9b('0x36')][_0xee9b('0x37')]!=='VIRTUAL'){var _0x574681={};_0x574681[_0x1bc9e8[_0xee9b('0x38')]]={'$like':'%'+_0x48c7f5[_0xee9b('0x2b')]['filter']+'%'};return _0x574681;}})});}_0x417c3a=_[_0xee9b('0x39')]({},_0x417c3a,_0x48c7f5[_0xee9b('0x3a')]);var _0xc7a5f={'where':_0x417c3a[_0xee9b('0x32')]};return db['SquareRecording'][_0xee9b('0x3b')](_0xc7a5f)['then'](function(_0x179764){_0x4124a9['count']=_0x179764;if(_0x48c7f5[_0xee9b('0x2b')][_0xee9b('0x3c')]){_0x417c3a['include']=[{'all':!![]}];}return db[_0xee9b('0x27')]['findAll'](_0x417c3a);})['then'](function(_0x4efab4){_0x4124a9['rows']=_0x4efab4;return _0x4124a9;})['then'](respondWithFilteredResult(_0x490803,_0x417c3a))[_0xee9b('0x3d')](handleError(_0x490803,null));};exports['show']=function(_0x2752f7,_0xb258d0){var _0x138f75={'raw':!![],'where':{'id':_0x2752f7['params']['id']}},_0x43a98d={};_0x43a98d[_0xee9b('0x29')]=_['keys'](db[_0xee9b('0x27')][_0xee9b('0x28')]);_0x43a98d[_0xee9b('0x2b')]=_['keys'](_0x2752f7[_0xee9b('0x2b')]);_0x43a98d['filters']=_[_0xee9b('0x2c')](_0x43a98d[_0xee9b('0x29')],_0x43a98d[_0xee9b('0x2b')]);_0x138f75[_0xee9b('0x2d')]=_[_0xee9b('0x2c')](_0x43a98d[_0xee9b('0x29')],qs[_0xee9b('0x2e')](_0x2752f7['query'][_0xee9b('0x2e')]));_0x138f75[_0xee9b('0x2d')]=_0x138f75[_0xee9b('0x2d')]['length']?_0x138f75['attributes']:_0x43a98d[_0xee9b('0x29')];if(_0x2752f7[_0xee9b('0x2b')]['includeAll']){_0x138f75[_0xee9b('0x3e')]=[{'all':!![]}];}_0x138f75=_[_0xee9b('0x39')]({},_0x138f75,_0x2752f7[_0xee9b('0x3a')]);return db[_0xee9b('0x27')][_0xee9b('0x3f')](_0x138f75)[_0xee9b('0x21')](handleEntityNotFound(_0xb258d0,null))[_0xee9b('0x21')](respondWithResult(_0xb258d0,null))[_0xee9b('0x3d')](handleError(_0xb258d0,null));};exports['create']=function(_0x3a2caf,_0x327587){return db[_0xee9b('0x27')][_0xee9b('0x40')](_0x3a2caf['body'],{})['then'](respondWithResult(_0x327587,0xc9))[_0xee9b('0x3d')](handleError(_0x327587,null));};exports[_0xee9b('0x20')]=function(_0x2d9805,_0x5637d9){if(_0x2d9805[_0xee9b('0x41')]['id']){delete _0x2d9805[_0xee9b('0x41')]['id'];}return db[_0xee9b('0x27')][_0xee9b('0x3f')]({'where':{'id':_0x2d9805[_0xee9b('0x42')]['id']}})[_0xee9b('0x21')](handleEntityNotFound(_0x5637d9,null))['then'](saveUpdates(_0x2d9805[_0xee9b('0x41')],null))[_0xee9b('0x21')](respondWithResult(_0x5637d9,null))[_0xee9b('0x3d')](handleError(_0x5637d9,null));};exports['destroy']=function(_0x5e0c65,_0x1101de){return db[_0xee9b('0x27')][_0xee9b('0x3f')]({'where':{'id':_0x5e0c65[_0xee9b('0x42')]['id']}})[_0xee9b('0x21')](handleEntityNotFound(_0x1101de,null))[_0xee9b('0x21')](removeEntity(_0x1101de,null))[_0xee9b('0x3d')](handleError(_0x1101de,null));};exports[_0xee9b('0x43')]=function(_0x2acfb5,_0x46e69c,_0x2fd730){var _0x380c6b=require(_0xee9b('0x44'));var _0x272c5d=![];var _0x26a75b={};if(_0x2acfb5[_0xee9b('0x2b')][_0xee9b('0x36')]&&_0x2acfb5[_0xee9b('0x2b')][_0xee9b('0x36')]===_0xee9b('0x45')){_0x26a75b[_0xee9b('0x45')]=_0x2acfb5['params']['id'];}else{_0x26a75b['id']=_0x2acfb5['params']['id'];}return db[_0xee9b('0x27')][_0xee9b('0x3f')]({'where':_0x26a75b,'attributes':['id',_0xee9b('0x46'),'filename'],'raw':!![]})[_0xee9b('0x21')](handleEntityNotFound(_0x46e69c,null))['then'](function(_0x3f7f53){if(_0x3f7f53){var _0x4c184f=util['format'](_0xee9b('0x47'),_0x3f7f53[_0xee9b('0x48')]);if(fs['existsSync'](_0x4c184f)){_0x272c5d=!![];return _0x380c6b[_0xee9b('0x49')](_0x4c184f,_0x3f7f53['savePath'],config[_0xee9b('0x4a')]['recording'])[_0xee9b('0x21')](function(){return _0x3f7f53;});}return _0x3f7f53;}})[_0xee9b('0x21')](function(_0x3145bc){if(_0x3145bc){if(!fs[_0xee9b('0x4b')](_0x3145bc['savePath'])){throw new db['Sequelize']['ValidationError'](_0xee9b('0x4c'));}if(_0x3145bc['filename']){return _0x46e69c[_0xee9b('0x43')](_0x3145bc[_0xee9b('0x46')],_0x3145bc['filename']+path[_0xee9b('0x4d')](_0x3145bc['savePath']),function(){if(_0x272c5d){fs[_0xee9b('0x4e')](_0x3145bc['savePath']);}});}else{return _0x46e69c[_0xee9b('0x43')](_0x3145bc['savePath'],function(_0x183f53){if(_0x272c5d){fs[_0xee9b('0x4e')](_0x3145bc[_0xee9b('0x46')]);}});}}})[_0xee9b('0x3d')](handleError(_0x46e69c,null));}; \ No newline at end of file +var _0xcfb8=['uniqueid','savePath','format','value','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','filename','extname','unlink','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','save','then','destroy','error','stack','name','send','index','SquareRecording','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','update','download','../../components/encryptor'];(function(_0x36f6a7,_0x129428){var _0x1696d9=function(_0x5baf22){while(--_0x5baf22){_0x36f6a7['push'](_0x36f6a7['shift']());}};_0x1696d9(++_0x129428);}(_0xcfb8,0x1c5));var _0x8cfb=function(_0x2992d2,_0x3233b9){_0x2992d2=_0x2992d2-0x0;var _0x1646c7=_0xcfb8[_0x2992d2];return _0x1646c7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8cfb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8cfb('0x1'));var rp=require(_0x8cfb('0x2'));var moment=require(_0x8cfb('0x3'));var BPromise=require(_0x8cfb('0x4'));var Mustache=require('mustache');var util=require(_0x8cfb('0x5'));var path=require(_0x8cfb('0x6'));var sox=require(_0x8cfb('0x7'));var csv=require(_0x8cfb('0x8'));var ejs=require(_0x8cfb('0x9'));var fs=require('fs');var _=require(_0x8cfb('0xa'));var squel=require('squel');var crypto=require(_0x8cfb('0xb'));var jsforce=require(_0x8cfb('0xc'));var deskjs=require(_0x8cfb('0xd'));var toCsv=require(_0x8cfb('0x8'));var querystring=require(_0x8cfb('0xe'));var Papa=require('papaparse');var authService=require(_0x8cfb('0xf'));var hardwareService=require(_0x8cfb('0x10'));var Redis=require(_0x8cfb('0x11'));var qs=require(_0x8cfb('0x12'));var logger=require(_0x8cfb('0x13'))(_0x8cfb('0x14'));var utils=require(_0x8cfb('0x15'));var config=require(_0x8cfb('0x16'));var db=require(_0x8cfb('0x17'))['db'];function respondWithStatusCode(_0x58e3cc,_0x7f6f2d){_0x7f6f2d=_0x7f6f2d||0xcc;return function(_0x14c553){if(_0x14c553){return _0x58e3cc[_0x8cfb('0x18')](_0x7f6f2d);}return _0x58e3cc['status'](_0x7f6f2d)[_0x8cfb('0x19')]();};}function respondWithResult(_0x459e50,_0x16bb94){_0x16bb94=_0x16bb94||0xc8;return function(_0x4af1c5){if(_0x4af1c5){return _0x459e50[_0x8cfb('0x1a')](_0x16bb94)[_0x8cfb('0x1b')](_0x4af1c5);}};}function respondWithFilteredResult(_0x3d91ed,_0x2685ba){return function(_0x270a1a){if(_0x270a1a){var _0x3300c8=_0x270a1a[_0x8cfb('0x1c')],_0xd26ed2=_0x2685ba[_0x8cfb('0x1d')],_0xc8feb3=_0x2685ba[_0x8cfb('0x1d')]+_0x2685ba[_0x8cfb('0x1e')],_0x5197c7;if(_0xc8feb3>=_0x3300c8){_0xc8feb3=_0x3300c8;_0x5197c7=0xc8;}else{_0x5197c7=0xce;}_0x3d91ed[_0x8cfb('0x1a')](_0x5197c7);return _0x3d91ed[_0x8cfb('0x1f')]('Content-Range',_0xd26ed2+'-'+_0xc8feb3+'/'+_0x3300c8)[_0x8cfb('0x1b')](_0x270a1a);}return null;};}function patchUpdates(_0x1fbb47){return function(_0xf267c4){try{jsonpatch[_0x8cfb('0x20')](_0xf267c4,_0x1fbb47,!![]);}catch(_0x532e32){return BPromise['reject'](_0x532e32);}return _0xf267c4[_0x8cfb('0x21')]();};}function saveUpdates(_0x265c3c,_0x80efd5){return function(_0x4985bc){if(_0x4985bc){return _0x4985bc['update'](_0x265c3c)[_0x8cfb('0x22')](function(_0x5d5183){return _0x5d5183;});}return null;};}function removeEntity(_0x57e2e0,_0x29abfe){return function(_0x5a069d){if(_0x5a069d){return _0x5a069d[_0x8cfb('0x23')]()['then'](function(){_0x57e2e0['status'](0xcc)[_0x8cfb('0x19')]();});}};}function handleEntityNotFound(_0x394e76,_0x45dd0b){return function(_0x396b2c){if(!_0x396b2c){_0x394e76[_0x8cfb('0x18')](0x194);}return _0x396b2c;};}function handleError(_0x3f7620,_0xd7f8a4){_0xd7f8a4=_0xd7f8a4||0x1f4;return function(_0x4a63b7){logger[_0x8cfb('0x24')](_0x4a63b7[_0x8cfb('0x25')]);if(_0x4a63b7['name']){delete _0x4a63b7[_0x8cfb('0x26')];}_0x3f7620[_0x8cfb('0x1a')](_0xd7f8a4)[_0x8cfb('0x27')](_0x4a63b7);};}exports[_0x8cfb('0x28')]=function(_0x4a9619,_0x1a7f1a){var _0x291b5b={},_0x1acb4c={},_0x1f046a={'count':0x0,'rows':[]};var _0x41c439=db[_0x8cfb('0x29')][_0x8cfb('0x2a')];_0x1acb4c[_0x8cfb('0x2b')]=_[_0x8cfb('0x2c')](_0x41c439);_0x1acb4c[_0x8cfb('0x2d')]=_[_0x8cfb('0x2c')](_0x4a9619['query']);_0x1acb4c[_0x8cfb('0x2e')]=_['intersection'](_0x1acb4c[_0x8cfb('0x2b')],_0x1acb4c[_0x8cfb('0x2d')]);_0x291b5b[_0x8cfb('0x2f')]=_[_0x8cfb('0x30')](_0x1acb4c[_0x8cfb('0x2b')],qs[_0x8cfb('0x31')](_0x4a9619[_0x8cfb('0x2d')][_0x8cfb('0x31')]));_0x291b5b['attributes']=_0x291b5b[_0x8cfb('0x2f')][_0x8cfb('0x32')]?_0x291b5b[_0x8cfb('0x2f')]:_0x1acb4c['model'];if(!_0x4a9619[_0x8cfb('0x2d')][_0x8cfb('0x33')]('nolimit')){_0x291b5b[_0x8cfb('0x1e')]=qs['limit'](_0x4a9619['query'][_0x8cfb('0x1e')]);_0x291b5b[_0x8cfb('0x1d')]=qs['offset'](_0x4a9619[_0x8cfb('0x2d')][_0x8cfb('0x1d')]);}_0x291b5b[_0x8cfb('0x34')]=qs[_0x8cfb('0x35')](_0x4a9619[_0x8cfb('0x2d')][_0x8cfb('0x35')]);_0x291b5b[_0x8cfb('0x36')]=qs['filters'](_[_0x8cfb('0x37')](_0x4a9619[_0x8cfb('0x2d')],_0x1acb4c[_0x8cfb('0x2e')]));if(_0x4a9619[_0x8cfb('0x2d')][_0x8cfb('0x38')]){_0x291b5b['where']=_[_0x8cfb('0x39')](_0x291b5b[_0x8cfb('0x36')],{'$or':_[_0x8cfb('0x3a')](_0x41c439,function(_0x292c41){if(_0x292c41[_0x8cfb('0x3b')][_0x8cfb('0x3c')]!==_0x8cfb('0x3d')){var _0xcc6194={};_0xcc6194[_0x292c41['field']]={'$like':'%'+_0x4a9619[_0x8cfb('0x2d')]['filter']+'%'};return _0xcc6194;}})});}_0x291b5b=_['merge']({},_0x291b5b,_0x4a9619[_0x8cfb('0x3e')]);var _0x390b94={'where':_0x291b5b['where']};return db[_0x8cfb('0x29')][_0x8cfb('0x1c')](_0x390b94)[_0x8cfb('0x22')](function(_0x20d0da){_0x1f046a['count']=_0x20d0da;if(_0x4a9619[_0x8cfb('0x2d')][_0x8cfb('0x3f')]){_0x291b5b[_0x8cfb('0x40')]=[{'all':!![]}];}return db[_0x8cfb('0x29')][_0x8cfb('0x41')](_0x291b5b);})['then'](function(_0x3b1d8e){_0x1f046a['rows']=_0x3b1d8e;return _0x1f046a;})[_0x8cfb('0x22')](respondWithFilteredResult(_0x1a7f1a,_0x291b5b))[_0x8cfb('0x42')](handleError(_0x1a7f1a,null));};exports[_0x8cfb('0x43')]=function(_0x32cc55,_0x21aaa0){var _0x29e308={'raw':!![],'where':{'id':_0x32cc55[_0x8cfb('0x44')]['id']}},_0x435416={};_0x435416['model']=_[_0x8cfb('0x2c')](db[_0x8cfb('0x29')]['rawAttributes']);_0x435416['query']=_[_0x8cfb('0x2c')](_0x32cc55['query']);_0x435416['filters']=_[_0x8cfb('0x30')](_0x435416['model'],_0x435416[_0x8cfb('0x2d')]);_0x29e308[_0x8cfb('0x2f')]=_[_0x8cfb('0x30')](_0x435416[_0x8cfb('0x2b')],qs[_0x8cfb('0x31')](_0x32cc55[_0x8cfb('0x2d')][_0x8cfb('0x31')]));_0x29e308[_0x8cfb('0x2f')]=_0x29e308['attributes'][_0x8cfb('0x32')]?_0x29e308['attributes']:_0x435416[_0x8cfb('0x2b')];if(_0x32cc55['query'][_0x8cfb('0x3f')]){_0x29e308['include']=[{'all':!![]}];}_0x29e308=_[_0x8cfb('0x39')]({},_0x29e308,_0x32cc55['options']);return db[_0x8cfb('0x29')][_0x8cfb('0x45')](_0x29e308)[_0x8cfb('0x22')](handleEntityNotFound(_0x21aaa0,null))[_0x8cfb('0x22')](respondWithResult(_0x21aaa0,null))['catch'](handleError(_0x21aaa0,null));};exports[_0x8cfb('0x46')]=function(_0x4f52c7,_0x210ad0){return db[_0x8cfb('0x29')][_0x8cfb('0x46')](_0x4f52c7[_0x8cfb('0x47')],{})['then'](respondWithResult(_0x210ad0,0xc9))[_0x8cfb('0x42')](handleError(_0x210ad0,null));};exports[_0x8cfb('0x48')]=function(_0x4f70c7,_0x55140d){if(_0x4f70c7[_0x8cfb('0x47')]['id']){delete _0x4f70c7[_0x8cfb('0x47')]['id'];}return db['SquareRecording'][_0x8cfb('0x45')]({'where':{'id':_0x4f70c7[_0x8cfb('0x44')]['id']}})[_0x8cfb('0x22')](handleEntityNotFound(_0x55140d,null))[_0x8cfb('0x22')](saveUpdates(_0x4f70c7[_0x8cfb('0x47')],null))[_0x8cfb('0x22')](respondWithResult(_0x55140d,null))[_0x8cfb('0x42')](handleError(_0x55140d,null));};exports[_0x8cfb('0x23')]=function(_0x265125,_0x1e67ea){return db['SquareRecording'][_0x8cfb('0x45')]({'where':{'id':_0x265125[_0x8cfb('0x44')]['id']}})[_0x8cfb('0x22')](handleEntityNotFound(_0x1e67ea,null))[_0x8cfb('0x22')](removeEntity(_0x1e67ea,null))[_0x8cfb('0x42')](handleError(_0x1e67ea,null));};exports[_0x8cfb('0x49')]=function(_0x34139a,_0x31fd5d,_0x548f9e){var _0x4f7cd2=require(_0x8cfb('0x4a'));var _0x3c91aa=![];var _0x5c5820={};if(_0x34139a[_0x8cfb('0x2d')]['type']&&_0x34139a[_0x8cfb('0x2d')][_0x8cfb('0x3b')]===_0x8cfb('0x4b')){_0x5c5820[_0x8cfb('0x4b')]=_0x34139a[_0x8cfb('0x44')]['id'];}else{_0x5c5820['id']=_0x34139a[_0x8cfb('0x44')]['id'];}return db[_0x8cfb('0x29')][_0x8cfb('0x45')]({'where':_0x5c5820,'attributes':['id',_0x8cfb('0x4c'),'filename'],'raw':!![]})['then'](handleEntityNotFound(_0x31fd5d,null))[_0x8cfb('0x22')](function(_0x7ff6c){if(_0x7ff6c){var _0x44e4fd=util[_0x8cfb('0x4d')]('%s.cypher',_0x7ff6c[_0x8cfb('0x4e')]);if(fs[_0x8cfb('0x4f')](_0x44e4fd)){_0x3c91aa=!![];return _0x4f7cd2[_0x8cfb('0x50')](_0x44e4fd,_0x7ff6c['savePath'],config[_0x8cfb('0x51')][_0x8cfb('0x52')])['then'](function(){return _0x7ff6c;});}return _0x7ff6c;}})['then'](function(_0x805ac3){if(_0x805ac3){if(!fs[_0x8cfb('0x4f')](_0x805ac3['savePath'])){throw new db[(_0x8cfb('0x53'))]['ValidationError'](_0x8cfb('0x54'));}if(_0x805ac3[_0x8cfb('0x55')]){return _0x31fd5d[_0x8cfb('0x49')](_0x805ac3['savePath'],_0x805ac3[_0x8cfb('0x55')]+path[_0x8cfb('0x56')](_0x805ac3[_0x8cfb('0x4c')]),function(){if(_0x3c91aa){fs['unlink'](_0x805ac3['savePath']);}});}else{return _0x31fd5d['download'](_0x805ac3['savePath'],function(_0x2912cb){if(_0x3c91aa){fs[_0x8cfb('0x57')](_0x805ac3[_0x8cfb('0x4c')]);}});}}})[_0x8cfb('0x42')](handleError(_0x31fd5d,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 1b73269..0d9fa34 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 _0x3a5e=['util','../../config/logger','api','moment','bluebird','./squareRecording.attributes','exports','define','lodash'];(function(_0x495b1d,_0x1fd696){var _0x182081=function(_0xee3608){while(--_0xee3608){_0x495b1d['push'](_0x495b1d['shift']());}};_0x182081(++_0x1fd696);}(_0x3a5e,0x14c));var _0xe3a5=function(_0x1004f0,_0x344ab3){_0x1004f0=_0x1004f0-0x0;var _0x55d63d=_0x3a5e[_0x1004f0];return _0x55d63d;};'use strict';var _=require(_0xe3a5('0x0'));var util=require(_0xe3a5('0x1'));var logger=require(_0xe3a5('0x2'))(_0xe3a5('0x3'));var moment=require(_0xe3a5('0x4'));var BPromise=require(_0xe3a5('0x5'));var rp=require('request-promise');var attributes=require(_0xe3a5('0x6'));module[_0xe3a5('0x7')]=function(_0x46dbe3,_0xff984c){return _0x46dbe3[_0xe3a5('0x8')]('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4672=['exports','SquareRecording','lodash','../../config/logger','api','bluebird','./squareRecording.attributes'];(function(_0x55fe01,_0x12ed37){var _0x5b42f0=function(_0x461191){while(--_0x461191){_0x55fe01['push'](_0x55fe01['shift']());}};_0x5b42f0(++_0x12ed37);}(_0x4672,0x18a));var _0x2467=function(_0x3688d5,_0x51d2b7){_0x3688d5=_0x3688d5-0x0;var _0x3013c4=_0x4672[_0x3688d5];return _0x3013c4;};'use strict';var _=require(_0x2467('0x0'));var util=require('util');var logger=require(_0x2467('0x1'))(_0x2467('0x2'));var moment=require('moment');var BPromise=require(_0x2467('0x3'));var rp=require('request-promise');var attributes=require(_0x2467('0x4'));module[_0x2467('0x5')]=function(_0x1368f7,_0x182ea4){return _0x1368f7['define'](_0x2467('0x6'),attributes,{'tableName':'square_recordings','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 4d419d0..8f164c1 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 _0x45f8=['jayson/promise','client','request','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','info','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','then','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x49e533,_0x5daa8a){var _0x17769d=function(_0x22c440){while(--_0x22c440){_0x49e533['push'](_0x49e533['shift']());}};_0x17769d(++_0x5daa8a);}(_0x45f8,0x141));var _0x845f=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0x45f8[_0x99868f];return _0x27a71b;};'use strict';var _=require(_0x845f('0x0'));var util=require('util');var moment=require(_0x845f('0x1'));var BPromise=require(_0x845f('0x2'));var rs=require(_0x845f('0x3'));var fs=require('fs');var Redis=require(_0x845f('0x4'));var db=require(_0x845f('0x5'))['db'];var utils=require(_0x845f('0x6'));var logger=require(_0x845f('0x7'))(_0x845f('0x8'));var config=require('../../config/environment');var jayson=require(_0x845f('0x9'));var client=jayson[_0x845f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24ef2a,_0x5a7e12,_0xefb366){return new BPromise(function(_0x4276e7,_0x41aa2e){return client[_0x845f('0xb')](_0x24ef2a,_0xefb366)['then'](function(_0x121727){logger['info']('SquareRecording,\x20%s,\x20%s',_0x5a7e12,_0x845f('0xc'));logger['debug'](_0x845f('0xd'),_0x5a7e12,_0x845f('0xc'),JSON[_0x845f('0xe')](_0x121727));if(_0x121727['error']){if(_0x121727[_0x845f('0xf')][_0x845f('0x10')]===0x1f4){logger[_0x845f('0xf')](_0x845f('0x11'),_0x5a7e12,_0x121727[_0x845f('0xf')]['message']);return _0x41aa2e(_0x121727[_0x845f('0xf')]['message']);}logger[_0x845f('0xf')](_0x845f('0x11'),_0x5a7e12,_0x121727[_0x845f('0xf')][_0x845f('0x12')]);return _0x4276e7(_0x121727['error']['message']);}else{logger[_0x845f('0x13')](_0x845f('0x11'),_0x5a7e12,'request\x20sent');_0x4276e7(_0x121727[_0x845f('0x14')]['message']);}})[_0x845f('0x15')](function(_0x3fc9f3){logger[_0x845f('0xf')](_0x845f('0x11'),_0x5a7e12,_0x3fc9f3);_0x41aa2e(_0x3fc9f3);});});}exports[_0x845f('0x16')]=function(_0x556f08){var _0xd948ec=this;return new Promise(function(_0x653a2a,_0x2e8a2e){return db[_0x845f('0x17')][_0x845f('0x18')](_0x556f08[_0x845f('0x19')],{'raw':_0x556f08[_0x845f('0x1a')]?_0x556f08[_0x845f('0x1a')][_0x845f('0x1b')]===undefined?!![]:![]:!![]})[_0x845f('0x1c')](function(_0x5cc889){logger[_0x845f('0x13')](_0x845f('0x16'),_0x556f08);logger[_0x845f('0x1d')](_0x845f('0x16'),_0x556f08,JSON['stringify'](_0x5cc889));_0x653a2a(_0x5cc889);})[_0x845f('0x15')](function(_0x484b2d){logger[_0x845f('0xf')](_0x845f('0x16'),_0x484b2d[_0x845f('0x12')],_0x556f08);_0x2e8a2e(_0xd948ec[_0x845f('0xf')](0x1f4,_0x484b2d[_0x845f('0x12')]));});});}; \ No newline at end of file +var _0xd14b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','result','catch','CreateSquareRecording','create','body','options','then','util','moment'];(function(_0x29e3f4,_0x289e06){var _0x37d277=function(_0x57fe71){while(--_0x57fe71){_0x29e3f4['push'](_0x29e3f4['shift']());}};_0x37d277(++_0x289e06);}(_0xd14b,0x66));var _0xbd14=function(_0x32b8a9,_0x59d62b){_0x32b8a9=_0x32b8a9-0x0;var _0x40105c=_0xd14b[_0x32b8a9];return _0x40105c;};'use strict';var _=require('lodash');var util=require(_0xbd14('0x0'));var moment=require(_0xbd14('0x1'));var BPromise=require(_0xbd14('0x2'));var rs=require(_0xbd14('0x3'));var fs=require('fs');var Redis=require(_0xbd14('0x4'));var db=require(_0xbd14('0x5'))['db'];var utils=require(_0xbd14('0x6'));var logger=require('../../config/logger')(_0xbd14('0x7'));var config=require(_0xbd14('0x8'));var jayson=require(_0xbd14('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1df1ec,_0x28898c,_0x91f411){return new BPromise(function(_0x19f9dc,_0x4b0712){return client['request'](_0x1df1ec,_0x91f411)['then'](function(_0x21c2fb){logger[_0xbd14('0xa')]('SquareRecording,\x20%s,\x20%s',_0x28898c,_0xbd14('0xb'));logger[_0xbd14('0xc')](_0xbd14('0xd'),_0x28898c,'request\x20sent',JSON[_0xbd14('0xe')](_0x21c2fb));if(_0x21c2fb[_0xbd14('0xf')]){if(_0x21c2fb[_0xbd14('0xf')][_0xbd14('0x10')]===0x1f4){logger[_0xbd14('0xf')](_0xbd14('0x11'),_0x28898c,_0x21c2fb[_0xbd14('0xf')]['message']);return _0x4b0712(_0x21c2fb['error']['message']);}logger[_0xbd14('0xf')](_0xbd14('0x11'),_0x28898c,_0x21c2fb[_0xbd14('0xf')][_0xbd14('0x12')]);return _0x19f9dc(_0x21c2fb['error'][_0xbd14('0x12')]);}else{logger[_0xbd14('0xa')](_0xbd14('0x11'),_0x28898c,_0xbd14('0xb'));_0x19f9dc(_0x21c2fb[_0xbd14('0x13')][_0xbd14('0x12')]);}})[_0xbd14('0x14')](function(_0x2e09d8){logger[_0xbd14('0xf')](_0xbd14('0x11'),_0x28898c,_0x2e09d8);_0x4b0712(_0x2e09d8);});});}exports[_0xbd14('0x15')]=function(_0x50f4a4){var _0x3d7943=this;return new Promise(function(_0x4f232b,_0x45f99e){return db['SquareRecording'][_0xbd14('0x16')](_0x50f4a4[_0xbd14('0x17')],{'raw':_0x50f4a4[_0xbd14('0x18')]?_0x50f4a4['options']['raw']===undefined?!![]:![]:!![]})[_0xbd14('0x19')](function(_0x10e482){logger['info'](_0xbd14('0x15'),_0x50f4a4);logger['debug']('CreateSquareRecording',_0x50f4a4,JSON[_0xbd14('0xe')](_0x10e482));_0x4f232b(_0x10e482);})[_0xbd14('0x14')](function(_0x585e2d){logger[_0xbd14('0xf')]('CreateSquareRecording',_0x585e2d[_0xbd14('0x12')],_0x50f4a4);_0x45f99e(_0x3d7943[_0xbd14('0xf')](0x1f4,_0x585e2d[_0xbd14('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index e9cfe5d..3b9ebbd 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 _0xf2c0=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0xf2c0,0x6e));var _0x0f2c=function(_0x3b4759,_0x540e5a){_0x3b4759=_0x3b4759-0x0;var _0x3990de=_0xf2c0[_0x3b4759];return _0x3990de;};'use strict';var multer=require(_0x0f2c('0x0'));var util=require('util');var path=require(_0x0f2c('0x1'));var timeout=require('connect-timeout');var express=require(_0x0f2c('0x2'));var router=express[_0x0f2c('0x3')]();var auth=require(_0x0f2c('0x4'));var interaction=require(_0x0f2c('0x5'));var config=require(_0x0f2c('0x6'));var controller=require(_0x0f2c('0x7'));router[_0x0f2c('0x8')]('/',auth[_0x0f2c('0x9')](),controller[_0x0f2c('0xa')]);router[_0x0f2c('0x8')](_0x0f2c('0xb'),auth[_0x0f2c('0x9')](),controller[_0x0f2c('0xc')]);router[_0x0f2c('0x8')](_0x0f2c('0xd'),auth['isAuthenticated'](),controller[_0x0f2c('0xe')]);router[_0x0f2c('0xf')]('/',auth[_0x0f2c('0x9')](),controller[_0x0f2c('0x10')]);router[_0x0f2c('0x11')](_0x0f2c('0xd'),auth[_0x0f2c('0x9')](),controller[_0x0f2c('0x12')]);router[_0x0f2c('0x13')](_0x0f2c('0xd'),auth[_0x0f2c('0x9')](),controller[_0x0f2c('0x14')]);module[_0x0f2c('0x15')]=router; \ No newline at end of file +var _0x5289=['index','/describe','describe','/:id','isAuthenticated','show','post','create','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareReport.controller','get'];(function(_0x32a222,_0x136771){var _0x5afbba=function(_0x2da62c){while(--_0x2da62c){_0x32a222['push'](_0x32a222['shift']());}};_0x5afbba(++_0x136771);}(_0x5289,0x15e));var _0x9528=function(_0x18480e,_0x105431){_0x18480e=_0x18480e-0x0;var _0x4d38b9=_0x5289[_0x18480e];return _0x4d38b9;};'use strict';var multer=require(_0x9528('0x0'));var util=require(_0x9528('0x1'));var path=require(_0x9528('0x2'));var timeout=require(_0x9528('0x3'));var express=require(_0x9528('0x4'));var router=express[_0x9528('0x5')]();var auth=require(_0x9528('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9528('0x7'));var controller=require(_0x9528('0x8'));router[_0x9528('0x9')]('/',auth['isAuthenticated'](),controller[_0x9528('0xa')]);router[_0x9528('0x9')](_0x9528('0xb'),auth['isAuthenticated'](),controller[_0x9528('0xc')]);router[_0x9528('0x9')](_0x9528('0xd'),auth[_0x9528('0xe')](),controller[_0x9528('0xf')]);router[_0x9528('0x10')]('/',auth['isAuthenticated'](),controller[_0x9528('0x11')]);router['put'](_0x9528('0xd'),auth['isAuthenticated'](),controller[_0x9528('0x12')]);router['delete'](_0x9528('0xd'),auth[_0x9528('0xe')](),controller[_0x9528('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 3d9c27c..12dc9d0 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 _0x13c0=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0x13c0,0x79));var _0x013c=function(_0x1db481,_0x1627b2){_0x1db481=_0x1db481-0x0;var _0x3db95b=_0x13c0[_0x1db481];return _0x3db95b;};'use strict';var Sequelize=require(_0x013c('0x0'));module[_0x013c('0x1')]={'network':{'type':Sequelize[_0x013c('0x2')]},'network_script':{'type':Sequelize[_0x013c('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x013c('0x2')]},'uniqueid':{'type':Sequelize[_0x013c('0x2')]},'version':{'type':Sequelize[_0x013c('0x2')]},'callerid':{'type':Sequelize[_0x013c('0x2')]},'calleridname':{'type':Sequelize[_0x013c('0x2')]},'callingpres':{'type':Sequelize[_0x013c('0x2')]},'callingani2':{'type':Sequelize[_0x013c('0x2')]},'callington':{'type':Sequelize[_0x013c('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x013c('0x2')]},'extension':{'type':Sequelize[_0x013c('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x013c('0x2')]},'accountcode':{'type':Sequelize[_0x013c('0x2')]},'threadid':{'type':Sequelize[_0x013c('0x2')]},'project_name':{'type':Sequelize[_0x013c('0x2')]},'joinAt':{'type':Sequelize[_0x013c('0x3')]},'leaveAt':{'type':Sequelize[_0x013c('0x3')]},'bot':{'type':Sequelize[_0x013c('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x2ce1=['DATE','STRING'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0x2ce1,0x8b));var _0x12ce=function(_0x3529e8,_0x38b6d3){_0x3529e8=_0x3529e8-0x0;var _0xa7f326=_0x2ce1[_0x3529e8];return _0xa7f326;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x12ce('0x0')]},'request':{'type':Sequelize[_0x12ce('0x0')]},'channel':{'type':Sequelize[_0x12ce('0x0')]},'language':{'type':Sequelize[_0x12ce('0x0')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x12ce('0x0')]},'version':{'type':Sequelize[_0x12ce('0x0')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x12ce('0x0')]},'callingpres':{'type':Sequelize[_0x12ce('0x0')]},'callingani2':{'type':Sequelize[_0x12ce('0x0')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x12ce('0x0')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x12ce('0x0')]},'context':{'type':Sequelize[_0x12ce('0x0')]},'extension':{'type':Sequelize[_0x12ce('0x0')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x12ce('0x0')]},'accountcode':{'type':Sequelize[_0x12ce('0x0')]},'threadid':{'type':Sequelize[_0x12ce('0x0')]},'project_name':{'type':Sequelize[_0x12ce('0x0')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x12ce('0x1')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 6f33ffa..4d55d21 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 _0xefbb=['sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','api','status','json','offset','limit','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','index','SquareReport','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','count','includeAll','include','rows','catch','show','params','find','create','body','update','describe','html-pdf','zip-dir','request-promise','moment','util','path'];(function(_0x3f6bcf,_0x531e79){var _0x1c5350=function(_0x282fc5){while(--_0x282fc5){_0x3f6bcf['push'](_0x3f6bcf['shift']());}};_0x1c5350(++_0x531e79);}(_0xefbb,0x198));var _0xbefb=function(_0x172623,_0x3153d0){_0x172623=_0x172623-0x0;var _0x46c6f2=_0xefbb[_0x172623];return _0x46c6f2;};'use strict';var pdf=require(_0xbefb('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbefb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbefb('0x2'));var moment=require(_0xbefb('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbefb('0x4'));var path=require(_0xbefb('0x5'));var sox=require(_0xbefb('0x6'));var csv=require(_0xbefb('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbefb('0x8'));var squel=require(_0xbefb('0x9'));var crypto=require('crypto');var jsforce=require(_0xbefb('0xa'));var deskjs=require(_0xbefb('0xb'));var toCsv=require(_0xbefb('0x7'));var querystring=require(_0xbefb('0xc'));var Papa=require(_0xbefb('0xd'));var authService=require('../../components/auth/service');var hardwareService=require(_0xbefb('0xe'));var Redis=require(_0xbefb('0xf'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xbefb('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x514403,_0x105213){_0x105213=_0x105213||0xcc;return function(_0xc77975){if(_0xc77975){return _0x514403['sendStatus'](_0x105213);}return _0x514403[_0xbefb('0x11')](_0x105213)['end']();};}function respondWithResult(_0x4d0ddc,_0x5a0337){_0x5a0337=_0x5a0337||0xc8;return function(_0x1420a2){if(_0x1420a2){return _0x4d0ddc[_0xbefb('0x11')](_0x5a0337)[_0xbefb('0x12')](_0x1420a2);}};}function respondWithFilteredResult(_0x12e40f,_0x273b77){return function(_0x569709){if(_0x569709){var _0x44f6fd=_0x569709['count'],_0x27cad9=_0x273b77[_0xbefb('0x13')],_0x1822ee=_0x273b77[_0xbefb('0x13')]+_0x273b77[_0xbefb('0x14')],_0x66e7f8;if(_0x1822ee>=_0x44f6fd){_0x1822ee=_0x44f6fd;_0x66e7f8=0xc8;}else{_0x66e7f8=0xce;}_0x12e40f[_0xbefb('0x11')](_0x66e7f8);return _0x12e40f['set'](_0xbefb('0x15'),_0x27cad9+'-'+_0x1822ee+'/'+_0x44f6fd)['json'](_0x569709);}return null;};}function patchUpdates(_0x1550a5){return function(_0x1fb140){try{jsonpatch[_0xbefb('0x16')](_0x1fb140,_0x1550a5,!![]);}catch(_0x43ad73){return BPromise[_0xbefb('0x17')](_0x43ad73);}return _0x1fb140[_0xbefb('0x18')]();};}function saveUpdates(_0x16dd32,_0x539127){return function(_0x3bd64d){if(_0x3bd64d){return _0x3bd64d['update'](_0x16dd32)[_0xbefb('0x19')](function(_0x502190){return _0x502190;});}return null;};}function removeEntity(_0x5253b9,_0x2e05aa){return function(_0x563da1){if(_0x563da1){return _0x563da1[_0xbefb('0x1a')]()['then'](function(){_0x5253b9[_0xbefb('0x11')](0xcc)[_0xbefb('0x1b')]();});}};}function handleEntityNotFound(_0x1c0b40,_0x33ac6e){return function(_0x4d01f3){if(!_0x4d01f3){_0x1c0b40[_0xbefb('0x1c')](0x194);}return _0x4d01f3;};}function handleError(_0x258946,_0x37c342){_0x37c342=_0x37c342||0x1f4;return function(_0x56fdd7){logger[_0xbefb('0x1d')](_0x56fdd7[_0xbefb('0x1e')]);if(_0x56fdd7[_0xbefb('0x1f')]){delete _0x56fdd7[_0xbefb('0x1f')];}_0x258946[_0xbefb('0x11')](_0x37c342)[_0xbefb('0x20')](_0x56fdd7);};}exports[_0xbefb('0x21')]=function(_0xe8dbee,_0x352f8a){var _0x1d38f7={},_0x58d628={},_0xd35f8={'count':0x0,'rows':[]};var _0x35d77c=db[_0xbefb('0x22')][_0xbefb('0x23')];_0x58d628[_0xbefb('0x24')]=_[_0xbefb('0x25')](_0x35d77c);_0x58d628[_0xbefb('0x26')]=_[_0xbefb('0x25')](_0xe8dbee['query']);_0x58d628[_0xbefb('0x27')]=_['intersection'](_0x58d628[_0xbefb('0x24')],_0x58d628[_0xbefb('0x26')]);_0x1d38f7[_0xbefb('0x28')]=_[_0xbefb('0x29')](_0x58d628[_0xbefb('0x24')],qs[_0xbefb('0x2a')](_0xe8dbee[_0xbefb('0x26')][_0xbefb('0x2a')]));_0x1d38f7[_0xbefb('0x28')]=_0x1d38f7[_0xbefb('0x28')][_0xbefb('0x2b')]?_0x1d38f7['attributes']:_0x58d628[_0xbefb('0x24')];if(!_0xe8dbee[_0xbefb('0x26')]['hasOwnProperty'](_0xbefb('0x2c'))){_0x1d38f7[_0xbefb('0x14')]=qs['limit'](_0xe8dbee[_0xbefb('0x26')][_0xbefb('0x14')]);_0x1d38f7[_0xbefb('0x13')]=qs[_0xbefb('0x13')](_0xe8dbee[_0xbefb('0x26')][_0xbefb('0x13')]);}_0x1d38f7[_0xbefb('0x2d')]=qs['sort'](_0xe8dbee[_0xbefb('0x26')][_0xbefb('0x2e')]);_0x1d38f7[_0xbefb('0x2f')]=qs[_0xbefb('0x27')](_[_0xbefb('0x30')](_0xe8dbee['query'],_0x58d628[_0xbefb('0x27')]));if(_0xe8dbee[_0xbefb('0x26')][_0xbefb('0x31')]){_0x1d38f7[_0xbefb('0x2f')]=_[_0xbefb('0x32')](_0x1d38f7[_0xbefb('0x2f')],{'$or':_[_0xbefb('0x33')](_0x35d77c,function(_0x5e47a2){if(_0x5e47a2[_0xbefb('0x34')][_0xbefb('0x35')]!==_0xbefb('0x36')){var _0x1275d2={};_0x1275d2[_0x5e47a2[_0xbefb('0x37')]]={'$like':'%'+_0xe8dbee[_0xbefb('0x26')]['filter']+'%'};return _0x1275d2;}})});}_0x1d38f7=_[_0xbefb('0x32')]({},_0x1d38f7,_0xe8dbee[_0xbefb('0x38')]);var _0x2fd6bc={'where':_0x1d38f7[_0xbefb('0x2f')]};return db[_0xbefb('0x22')][_0xbefb('0x39')](_0x2fd6bc)[_0xbefb('0x19')](function(_0x24cff7){_0xd35f8[_0xbefb('0x39')]=_0x24cff7;if(_0xe8dbee[_0xbefb('0x26')][_0xbefb('0x3a')]){_0x1d38f7[_0xbefb('0x3b')]=[{'all':!![]}];}return db[_0xbefb('0x22')]['findAll'](_0x1d38f7);})['then'](function(_0xb90ff6){_0xd35f8[_0xbefb('0x3c')]=_0xb90ff6;return _0xd35f8;})['then'](respondWithFilteredResult(_0x352f8a,_0x1d38f7))[_0xbefb('0x3d')](handleError(_0x352f8a,null));};exports[_0xbefb('0x3e')]=function(_0x50c6e2,_0x474a4b){var _0x1a347f={'raw':!![],'where':{'id':_0x50c6e2[_0xbefb('0x3f')]['id']}},_0x41f477={};_0x41f477['model']=_[_0xbefb('0x25')](db[_0xbefb('0x22')]['rawAttributes']);_0x41f477['query']=_[_0xbefb('0x25')](_0x50c6e2[_0xbefb('0x26')]);_0x41f477['filters']=_[_0xbefb('0x29')](_0x41f477[_0xbefb('0x24')],_0x41f477[_0xbefb('0x26')]);_0x1a347f[_0xbefb('0x28')]=_[_0xbefb('0x29')](_0x41f477[_0xbefb('0x24')],qs[_0xbefb('0x2a')](_0x50c6e2[_0xbefb('0x26')][_0xbefb('0x2a')]));_0x1a347f['attributes']=_0x1a347f[_0xbefb('0x28')][_0xbefb('0x2b')]?_0x1a347f[_0xbefb('0x28')]:_0x41f477[_0xbefb('0x24')];if(_0x50c6e2[_0xbefb('0x26')]['includeAll']){_0x1a347f[_0xbefb('0x3b')]=[{'all':!![]}];}_0x1a347f=_[_0xbefb('0x32')]({},_0x1a347f,_0x50c6e2[_0xbefb('0x38')]);return db[_0xbefb('0x22')][_0xbefb('0x40')](_0x1a347f)[_0xbefb('0x19')](handleEntityNotFound(_0x474a4b,null))[_0xbefb('0x19')](respondWithResult(_0x474a4b,null))[_0xbefb('0x3d')](handleError(_0x474a4b,null));};exports[_0xbefb('0x41')]=function(_0x1577be,_0x433e39){return db[_0xbefb('0x22')][_0xbefb('0x41')](_0x1577be[_0xbefb('0x42')],{})['then'](respondWithResult(_0x433e39,0xc9))['catch'](handleError(_0x433e39,null));};exports[_0xbefb('0x43')]=function(_0x2ed9d0,_0x3f024a){if(_0x2ed9d0[_0xbefb('0x42')]['id']){delete _0x2ed9d0[_0xbefb('0x42')]['id'];}return db['SquareReport'][_0xbefb('0x40')]({'where':{'id':_0x2ed9d0[_0xbefb('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3f024a,null))[_0xbefb('0x19')](saveUpdates(_0x2ed9d0[_0xbefb('0x42')],null))[_0xbefb('0x19')](respondWithResult(_0x3f024a,null))[_0xbefb('0x3d')](handleError(_0x3f024a,null));};exports[_0xbefb('0x1a')]=function(_0x2b2f05,_0x5c19a6){return db['SquareReport'][_0xbefb('0x40')]({'where':{'id':_0x2b2f05[_0xbefb('0x3f')]['id']}})[_0xbefb('0x19')](handleEntityNotFound(_0x5c19a6,null))[_0xbefb('0x19')](removeEntity(_0x5c19a6,null))[_0xbefb('0x3d')](handleError(_0x5c19a6,null));};exports[_0xbefb('0x44')]=function(_0x188430,_0x350ccd){return db['SquareReport']['describe']()[_0xbefb('0x19')](respondWithResult(_0x350ccd,null))[_0xbefb('0x3d')](handleError(_0x350ccd,null));}; \ No newline at end of file +var _0x0d65=['sox','to-csv','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','options','SquareReport','count','rows','show','params','rawAttributes','includeAll','find','create','body','catch','describe','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util'];(function(_0x489618,_0x233987){var _0x3d34b8=function(_0xe4ffd0){while(--_0xe4ffd0){_0x489618['push'](_0x489618['shift']());}};_0x3d34b8(++_0x233987);}(_0x0d65,0x81));var _0x50d6=function(_0x2ce606,_0x117b1c){_0x2ce606=_0x2ce606-0x0;var _0x5b925c=_0x0d65[_0x2ce606];return _0x5b925c;};'use strict';var pdf=require(_0x50d6('0x0'));var emlformat=require(_0x50d6('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x50d6('0x2'));var moment=require(_0x50d6('0x3'));var BPromise=require(_0x50d6('0x4'));var Mustache=require(_0x50d6('0x5'));var util=require(_0x50d6('0x6'));var path=require('path');var sox=require(_0x50d6('0x7'));var csv=require(_0x50d6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x50d6('0x9'));var jsforce=require(_0x50d6('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x50d6('0x8'));var querystring=require(_0x50d6('0xb'));var Papa=require(_0x50d6('0xc'));var authService=require(_0x50d6('0xd'));var hardwareService=require(_0x50d6('0xe'));var Redis=require(_0x50d6('0xf'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x50d6('0x10'));var utils=require(_0x50d6('0x11'));var config=require(_0x50d6('0x12'));var db=require(_0x50d6('0x13'))['db'];function respondWithStatusCode(_0x28720e,_0x492fe5){_0x492fe5=_0x492fe5||0xcc;return function(_0x1ffd6e){if(_0x1ffd6e){return _0x28720e['sendStatus'](_0x492fe5);}return _0x28720e[_0x50d6('0x14')](_0x492fe5)[_0x50d6('0x15')]();};}function respondWithResult(_0x36f5bc,_0x47d59a){_0x47d59a=_0x47d59a||0xc8;return function(_0x47c037){if(_0x47c037){return _0x36f5bc[_0x50d6('0x14')](_0x47d59a)[_0x50d6('0x16')](_0x47c037);}};}function respondWithFilteredResult(_0x5e5273,_0x296e00){return function(_0x34c42d){if(_0x34c42d){var _0x5cb2dd=_0x34c42d['count'],_0x1e3e72=_0x296e00[_0x50d6('0x17')],_0x48e072=_0x296e00[_0x50d6('0x17')]+_0x296e00['limit'],_0x44cb90;if(_0x48e072>=_0x5cb2dd){_0x48e072=_0x5cb2dd;_0x44cb90=0xc8;}else{_0x44cb90=0xce;}_0x5e5273[_0x50d6('0x14')](_0x44cb90);return _0x5e5273[_0x50d6('0x18')](_0x50d6('0x19'),_0x1e3e72+'-'+_0x48e072+'/'+_0x5cb2dd)['json'](_0x34c42d);}return null;};}function patchUpdates(_0x27d26b){return function(_0x521a6f){try{jsonpatch[_0x50d6('0x1a')](_0x521a6f,_0x27d26b,!![]);}catch(_0xac61c4){return BPromise[_0x50d6('0x1b')](_0xac61c4);}return _0x521a6f['save']();};}function saveUpdates(_0x23a814,_0x2810ae){return function(_0x3a3700){if(_0x3a3700){return _0x3a3700[_0x50d6('0x1c')](_0x23a814)[_0x50d6('0x1d')](function(_0x4dbc66){return _0x4dbc66;});}return null;};}function removeEntity(_0x335a3d,_0x24638a){return function(_0x4818bb){if(_0x4818bb){return _0x4818bb[_0x50d6('0x1e')]()['then'](function(){_0x335a3d[_0x50d6('0x14')](0xcc)[_0x50d6('0x15')]();});}};}function handleEntityNotFound(_0x235105,_0x238e6e){return function(_0x47b72b){if(!_0x47b72b){_0x235105[_0x50d6('0x1f')](0x194);}return _0x47b72b;};}function handleError(_0x2d7e92,_0x48f346){_0x48f346=_0x48f346||0x1f4;return function(_0xf5f5ae){logger[_0x50d6('0x20')](_0xf5f5ae[_0x50d6('0x21')]);if(_0xf5f5ae[_0x50d6('0x22')]){delete _0xf5f5ae[_0x50d6('0x22')];}_0x2d7e92[_0x50d6('0x14')](_0x48f346)['send'](_0xf5f5ae);};}exports['index']=function(_0x3d7c6b,_0x1da76b){var _0x199a4f={},_0x4a85c3={},_0x1b4766={'count':0x0,'rows':[]};var _0x27adf4=db['SquareReport']['rawAttributes'];_0x4a85c3[_0x50d6('0x23')]=_[_0x50d6('0x24')](_0x27adf4);_0x4a85c3['query']=_[_0x50d6('0x24')](_0x3d7c6b['query']);_0x4a85c3[_0x50d6('0x25')]=_[_0x50d6('0x26')](_0x4a85c3[_0x50d6('0x23')],_0x4a85c3[_0x50d6('0x27')]);_0x199a4f[_0x50d6('0x28')]=_[_0x50d6('0x26')](_0x4a85c3[_0x50d6('0x23')],qs[_0x50d6('0x29')](_0x3d7c6b['query'][_0x50d6('0x29')]));_0x199a4f['attributes']=_0x199a4f[_0x50d6('0x28')][_0x50d6('0x2a')]?_0x199a4f[_0x50d6('0x28')]:_0x4a85c3[_0x50d6('0x23')];if(!_0x3d7c6b[_0x50d6('0x27')][_0x50d6('0x2b')]('nolimit')){_0x199a4f[_0x50d6('0x2c')]=qs[_0x50d6('0x2c')](_0x3d7c6b[_0x50d6('0x27')][_0x50d6('0x2c')]);_0x199a4f[_0x50d6('0x17')]=qs[_0x50d6('0x17')](_0x3d7c6b[_0x50d6('0x27')][_0x50d6('0x17')]);}_0x199a4f[_0x50d6('0x2d')]=qs[_0x50d6('0x2e')](_0x3d7c6b['query'][_0x50d6('0x2e')]);_0x199a4f[_0x50d6('0x2f')]=qs['filters'](_[_0x50d6('0x30')](_0x3d7c6b[_0x50d6('0x27')],_0x4a85c3[_0x50d6('0x25')]));if(_0x3d7c6b['query'][_0x50d6('0x31')]){_0x199a4f[_0x50d6('0x2f')]=_[_0x50d6('0x32')](_0x199a4f[_0x50d6('0x2f')],{'$or':_[_0x50d6('0x33')](_0x27adf4,function(_0x4e21c8){if(_0x4e21c8[_0x50d6('0x34')][_0x50d6('0x35')]!==_0x50d6('0x36')){var _0x112a7f={};_0x112a7f[_0x4e21c8['field']]={'$like':'%'+_0x3d7c6b[_0x50d6('0x27')][_0x50d6('0x31')]+'%'};return _0x112a7f;}})});}_0x199a4f=_['merge']({},_0x199a4f,_0x3d7c6b[_0x50d6('0x37')]);var _0x9e4c56={'where':_0x199a4f[_0x50d6('0x2f')]};return db[_0x50d6('0x38')][_0x50d6('0x39')](_0x9e4c56)[_0x50d6('0x1d')](function(_0x44b8cb){_0x1b4766[_0x50d6('0x39')]=_0x44b8cb;if(_0x3d7c6b[_0x50d6('0x27')]['includeAll']){_0x199a4f['include']=[{'all':!![]}];}return db[_0x50d6('0x38')]['findAll'](_0x199a4f);})[_0x50d6('0x1d')](function(_0x71b412){_0x1b4766[_0x50d6('0x3a')]=_0x71b412;return _0x1b4766;})[_0x50d6('0x1d')](respondWithFilteredResult(_0x1da76b,_0x199a4f))['catch'](handleError(_0x1da76b,null));};exports[_0x50d6('0x3b')]=function(_0x4a845d,_0x30ed6a){var _0xe8f0e7={'raw':!![],'where':{'id':_0x4a845d[_0x50d6('0x3c')]['id']}},_0x51ddf7={};_0x51ddf7[_0x50d6('0x23')]=_[_0x50d6('0x24')](db['SquareReport'][_0x50d6('0x3d')]);_0x51ddf7[_0x50d6('0x27')]=_[_0x50d6('0x24')](_0x4a845d['query']);_0x51ddf7[_0x50d6('0x25')]=_['intersection'](_0x51ddf7[_0x50d6('0x23')],_0x51ddf7['query']);_0xe8f0e7['attributes']=_[_0x50d6('0x26')](_0x51ddf7[_0x50d6('0x23')],qs[_0x50d6('0x29')](_0x4a845d[_0x50d6('0x27')][_0x50d6('0x29')]));_0xe8f0e7['attributes']=_0xe8f0e7[_0x50d6('0x28')][_0x50d6('0x2a')]?_0xe8f0e7[_0x50d6('0x28')]:_0x51ddf7[_0x50d6('0x23')];if(_0x4a845d['query'][_0x50d6('0x3e')]){_0xe8f0e7['include']=[{'all':!![]}];}_0xe8f0e7=_[_0x50d6('0x32')]({},_0xe8f0e7,_0x4a845d[_0x50d6('0x37')]);return db[_0x50d6('0x38')][_0x50d6('0x3f')](_0xe8f0e7)[_0x50d6('0x1d')](handleEntityNotFound(_0x30ed6a,null))['then'](respondWithResult(_0x30ed6a,null))['catch'](handleError(_0x30ed6a,null));};exports[_0x50d6('0x40')]=function(_0x259444,_0x3cc509){return db[_0x50d6('0x38')][_0x50d6('0x40')](_0x259444[_0x50d6('0x41')],{})[_0x50d6('0x1d')](respondWithResult(_0x3cc509,0xc9))[_0x50d6('0x42')](handleError(_0x3cc509,null));};exports[_0x50d6('0x1c')]=function(_0x273952,_0x1b045c){if(_0x273952[_0x50d6('0x41')]['id']){delete _0x273952[_0x50d6('0x41')]['id'];}return db[_0x50d6('0x38')]['find']({'where':{'id':_0x273952[_0x50d6('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1b045c,null))[_0x50d6('0x1d')](saveUpdates(_0x273952[_0x50d6('0x41')],null))[_0x50d6('0x1d')](respondWithResult(_0x1b045c,null))[_0x50d6('0x42')](handleError(_0x1b045c,null));};exports[_0x50d6('0x1e')]=function(_0x49c055,_0xaf83fa){return db[_0x50d6('0x38')]['find']({'where':{'id':_0x49c055[_0x50d6('0x3c')]['id']}})[_0x50d6('0x1d')](handleEntityNotFound(_0xaf83fa,null))[_0x50d6('0x1d')](removeEntity(_0xaf83fa,null))[_0x50d6('0x42')](handleError(_0xaf83fa,null));};exports[_0x50d6('0x43')]=function(_0x4fd69e,_0x5dc376){return db[_0x50d6('0x38')][_0x50d6('0x43')]()[_0x50d6('0x1d')](respondWithResult(_0x5dc376,null))[_0x50d6('0x42')](handleError(_0x5dc376,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index c56dcb1..97a75ce 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 _0xf5b1=['leaveAt','util','moment','bluebird','./squareReport.attributes','exports','report_square','uniqueid'];(function(_0x5115dc,_0x2b7197){var _0x48942b=function(_0x1318a7){while(--_0x1318a7){_0x5115dc['push'](_0x5115dc['shift']());}};_0x48942b(++_0x2b7197);}(_0xf5b1,0x81));var _0x1f5b=function(_0x1163be,_0x16befa){_0x1163be=_0x1163be-0x0;var _0x262e62=_0xf5b1[_0x1163be];return _0x262e62;};'use strict';var _=require('lodash');var util=require(_0x1f5b('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x1f5b('0x1'));var BPromise=require(_0x1f5b('0x2'));var rp=require('request-promise');var attributes=require(_0x1f5b('0x3'));module[_0x1f5b('0x4')]=function(_0x5b6050,_0x5bd877){return _0x5b6050['define']('SquareReport',attributes,{'tableName':_0x1f5b('0x5'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x1f5b('0x6'),'project_name']},{'name':'leaveAt','fields':[_0x1f5b('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x85f1=['moment','./squareReport.attributes','exports','SquareReport','uid_pname','uniqueid','leaveAt','lodash','../../config/logger'];(function(_0x6dc660,_0x5e63fb){var _0x4fa02a=function(_0x3351f3){while(--_0x3351f3){_0x6dc660['push'](_0x6dc660['shift']());}};_0x4fa02a(++_0x5e63fb);}(_0x85f1,0x142));var _0x185f=function(_0x30b0d8,_0x57470c){_0x30b0d8=_0x30b0d8-0x0;var _0x459c09=_0x85f1[_0x30b0d8];return _0x459c09;};'use strict';var _=require(_0x185f('0x0'));var util=require('util');var logger=require(_0x185f('0x1'))('api');var moment=require(_0x185f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x185f('0x3'));module[_0x185f('0x4')]=function(_0x3ca368,_0x45f116){return _0x3ca368['define'](_0x185f('0x5'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x185f('0x6'),'fields':[_0x185f('0x7'),'project_name']},{'name':_0x185f('0x8'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 18b5c85..61e9d4b 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 _0xec2b=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','code','SquareReport,\x20%s,\x20%s','message','error','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','stringify','UpdateSquareReport','update','where','attributes','limit','info','moment','bluebird','randomstring','ioredis'];(function(_0x44b3d2,_0x1e7dc0){var _0x420e23=function(_0x1b71dd){while(--_0x1b71dd){_0x44b3d2['push'](_0x44b3d2['shift']());}};_0x420e23(++_0x1e7dc0);}(_0xec2b,0x1e6));var _0xbec2=function(_0x25e540,_0x1a464d){_0x25e540=_0x25e540-0x0;var _0x5d2ec2=_0xec2b[_0x25e540];return _0x5d2ec2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbec2('0x0'));var BPromise=require(_0xbec2('0x1'));var rs=require(_0xbec2('0x2'));var fs=require('fs');var Redis=require(_0xbec2('0x3'));var db=require(_0xbec2('0x4'))['db'];var utils=require(_0xbec2('0x5'));var logger=require(_0xbec2('0x6'))(_0xbec2('0x7'));var config=require(_0xbec2('0x8'));var jayson=require(_0xbec2('0x9'));var client=jayson[_0xbec2('0xa')][_0xbec2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ac3a5,_0xc150f3,_0x3d67cc){return new BPromise(function(_0x3572d5,_0x3815d7){return client[_0xbec2('0xc')](_0x3ac3a5,_0x3d67cc)[_0xbec2('0xd')](function(_0xbcac8e){logger['info']('SquareReport,\x20%s,\x20%s',_0xc150f3,_0xbec2('0xe'));logger[_0xbec2('0xf')]('SquareReport,\x20%s,\x20%s,\x20%s',_0xc150f3,_0xbec2('0xe'),JSON['stringify'](_0xbcac8e));if(_0xbcac8e['error']){if(_0xbcac8e['error'][_0xbec2('0x10')]===0x1f4){logger['error'](_0xbec2('0x11'),_0xc150f3,_0xbcac8e['error'][_0xbec2('0x12')]);return _0x3815d7(_0xbcac8e[_0xbec2('0x13')][_0xbec2('0x12')]);}logger[_0xbec2('0x13')](_0xbec2('0x11'),_0xc150f3,_0xbcac8e[_0xbec2('0x13')][_0xbec2('0x12')]);return _0x3572d5(_0xbcac8e[_0xbec2('0x13')][_0xbec2('0x12')]);}else{logger['info']('SquareReport,\x20%s,\x20%s',_0xc150f3,'request\x20sent');_0x3572d5(_0xbcac8e[_0xbec2('0x14')][_0xbec2('0x12')]);}})[_0xbec2('0x15')](function(_0x16df49){logger['error'](_0xbec2('0x11'),_0xc150f3,_0x16df49);_0x3815d7(_0x16df49);});});}exports[_0xbec2('0x16')]=function(_0x4aac5e){var _0x52803b=this;return new Promise(function(_0x47b0e5,_0x5bbc17){return db[_0xbec2('0x17')][_0xbec2('0x18')](_0x4aac5e[_0xbec2('0x19')],{'raw':_0x4aac5e[_0xbec2('0x1a')]?_0x4aac5e['options'][_0xbec2('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4e041f){logger['info'](_0xbec2('0x16'),_0x4aac5e);logger[_0xbec2('0xf')](_0xbec2('0x16'),_0x4aac5e,JSON[_0xbec2('0x1c')](_0x4e041f));_0x47b0e5(_0x4e041f);})['catch'](function(_0x3d47bd){logger[_0xbec2('0x13')](_0xbec2('0x16'),_0x3d47bd[_0xbec2('0x12')],_0x4aac5e);_0x5bbc17(_0x52803b[_0xbec2('0x13')](0x1f4,_0x3d47bd[_0xbec2('0x12')]));});});};exports[_0xbec2('0x1d')]=function(_0xb9a9ea){var _0x549a10=this;return new Promise(function(_0x26efe3,_0x542f37){return db[_0xbec2('0x17')][_0xbec2('0x1e')](_0xb9a9ea[_0xbec2('0x19')],{'raw':_0xb9a9ea[_0xbec2('0x1a')]?_0xb9a9ea[_0xbec2('0x1a')][_0xbec2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb9a9ea[_0xbec2('0x1a')]?_0xb9a9ea['options'][_0xbec2('0x1f')]||null:null,'attributes':_0xb9a9ea['options']?_0xb9a9ea[_0xbec2('0x1a')][_0xbec2('0x20')]||null:null,'limit':_0xb9a9ea[_0xbec2('0x1a')]?_0xb9a9ea[_0xbec2('0x1a')][_0xbec2('0x21')]||null:null})[_0xbec2('0xd')](function(_0xabf18d){logger[_0xbec2('0x22')](_0xbec2('0x1d'),_0xb9a9ea);logger[_0xbec2('0xf')]('UpdateSquareReport',_0xb9a9ea,JSON[_0xbec2('0x1c')](_0xabf18d));_0x26efe3(_0xabf18d);})[_0xbec2('0x15')](function(_0x2e57ba){logger[_0xbec2('0x13')](_0xbec2('0x1d'),_0x2e57ba[_0xbec2('0x12')],_0xb9a9ea);_0x542f37(_0x549a10[_0xbec2('0x13')](0x1f4,_0x2e57ba[_0xbec2('0x12')]));});});}; \ No newline at end of file +var _0xa134=['debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','SquareReport','body','options','CreateSquareReport','stringify','update','attributes','UpdateSquareReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SquareReport,\x20%s,\x20%s'];(function(_0x4e1add,_0x52eb32){var _0xaab0d6=function(_0x3d1dc5){while(--_0x3d1dc5){_0x4e1add['push'](_0x4e1add['shift']());}};_0xaab0d6(++_0x52eb32);}(_0xa134,0xf0));var _0x4a13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa134[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4a13('0x0'));var util=require(_0x4a13('0x1'));var moment=require(_0x4a13('0x2'));var BPromise=require(_0x4a13('0x3'));var rs=require(_0x4a13('0x4'));var fs=require('fs');var Redis=require(_0x4a13('0x5'));var db=require(_0x4a13('0x6'))['db'];var utils=require(_0x4a13('0x7'));var logger=require(_0x4a13('0x8'))(_0x4a13('0x9'));var config=require(_0x4a13('0xa'));var jayson=require(_0x4a13('0xb'));var client=jayson[_0x4a13('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5af75b,_0x3ad29e,_0x3e11a1){return new BPromise(function(_0x2abbd6,_0x5752e6){return client['request'](_0x5af75b,_0x3e11a1)[_0x4a13('0xd')](function(_0x2a9f38){logger[_0x4a13('0xe')](_0x4a13('0xf'),_0x3ad29e,'request\x20sent');logger[_0x4a13('0x10')](_0x4a13('0x11'),_0x3ad29e,_0x4a13('0x12'),JSON['stringify'](_0x2a9f38));if(_0x2a9f38[_0x4a13('0x13')]){if(_0x2a9f38[_0x4a13('0x13')][_0x4a13('0x14')]===0x1f4){logger[_0x4a13('0x13')]('SquareReport,\x20%s,\x20%s',_0x3ad29e,_0x2a9f38[_0x4a13('0x13')]['message']);return _0x5752e6(_0x2a9f38[_0x4a13('0x13')][_0x4a13('0x15')]);}logger[_0x4a13('0x13')](_0x4a13('0xf'),_0x3ad29e,_0x2a9f38[_0x4a13('0x13')][_0x4a13('0x15')]);return _0x2abbd6(_0x2a9f38[_0x4a13('0x13')][_0x4a13('0x15')]);}else{logger[_0x4a13('0xe')](_0x4a13('0xf'),_0x3ad29e,_0x4a13('0x12'));_0x2abbd6(_0x2a9f38[_0x4a13('0x16')]['message']);}})[_0x4a13('0x17')](function(_0x45503c){logger[_0x4a13('0x13')](_0x4a13('0xf'),_0x3ad29e,_0x45503c);_0x5752e6(_0x45503c);});});}exports['CreateSquareReport']=function(_0x56127e){var _0x425c10=this;return new Promise(function(_0x5d6802,_0xd73651){return db[_0x4a13('0x18')]['create'](_0x56127e[_0x4a13('0x19')],{'raw':_0x56127e['options']?_0x56127e[_0x4a13('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x4a13('0xd')](function(_0x2e9fd3){logger[_0x4a13('0xe')](_0x4a13('0x1b'),_0x56127e);logger['debug']('CreateSquareReport',_0x56127e,JSON[_0x4a13('0x1c')](_0x2e9fd3));_0x5d6802(_0x2e9fd3);})[_0x4a13('0x17')](function(_0x543d35){logger[_0x4a13('0x13')]('CreateSquareReport',_0x543d35[_0x4a13('0x15')],_0x56127e);_0xd73651(_0x425c10[_0x4a13('0x13')](0x1f4,_0x543d35[_0x4a13('0x15')]));});});};exports['UpdateSquareReport']=function(_0x17a68a){var _0x28a979=this;return new Promise(function(_0x4bb7cd,_0x3a8dcd){return db[_0x4a13('0x18')][_0x4a13('0x1d')](_0x17a68a[_0x4a13('0x19')],{'raw':_0x17a68a[_0x4a13('0x1a')]?_0x17a68a[_0x4a13('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17a68a['options']?_0x17a68a[_0x4a13('0x1a')]['where']||null:null,'attributes':_0x17a68a[_0x4a13('0x1a')]?_0x17a68a['options'][_0x4a13('0x1e')]||null:null,'limit':_0x17a68a[_0x4a13('0x1a')]?_0x17a68a[_0x4a13('0x1a')]['limit']||null:null})[_0x4a13('0xd')](function(_0x49eea7){logger[_0x4a13('0xe')]('UpdateSquareReport',_0x17a68a);logger[_0x4a13('0x10')](_0x4a13('0x1f'),_0x17a68a,JSON[_0x4a13('0x1c')](_0x49eea7));_0x4bb7cd(_0x49eea7);})[_0x4a13('0x17')](function(_0x11d662){logger[_0x4a13('0x13')](_0x4a13('0x1f'),_0x11d662['message'],_0x17a68a);_0x3a8dcd(_0x28a979[_0x4a13('0x13')](0x1f4,_0x11d662[_0x4a13('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index acc98ab..0c3cc26 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 _0xd67c=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index','describe','/:id','show','create','put','delete','multer','util'];(function(_0x4df1f0,_0x4260bb){var _0x5c0f70=function(_0x42aa18){while(--_0x42aa18){_0x4df1f0['push'](_0x4df1f0['shift']());}};_0x5c0f70(++_0x4260bb);}(_0xd67c,0x8e));var _0xcd67=function(_0xd307d9,_0x50e8e0){_0xd307d9=_0xd307d9-0x0;var _0x209bf8=_0xd67c[_0xd307d9];return _0x209bf8;};'use strict';var multer=require(_0xcd67('0x0'));var util=require(_0xcd67('0x1'));var path=require('path');var timeout=require(_0xcd67('0x2'));var express=require('express');var router=express[_0xcd67('0x3')]();var auth=require(_0xcd67('0x4'));var interaction=require(_0xcd67('0x5'));var config=require('../../config/environment');var controller=require(_0xcd67('0x6'));router[_0xcd67('0x7')]('/',auth[_0xcd67('0x8')](),controller[_0xcd67('0x9')]);router[_0xcd67('0x7')]('/describe',auth[_0xcd67('0x8')](),controller[_0xcd67('0xa')]);router[_0xcd67('0x7')](_0xcd67('0xb'),auth[_0xcd67('0x8')](),controller[_0xcd67('0xc')]);router['post']('/',auth[_0xcd67('0x8')](),controller[_0xcd67('0xd')]);router[_0xcd67('0xe')]('/:id',auth[_0xcd67('0x8')](),controller['update']);router[_0xcd67('0xf')](_0xcd67('0xb'),auth[_0xcd67('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x40fe=['put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','post','create'];(function(_0x13d610,_0x291634){var _0x59f9cf=function(_0xdf7a7){while(--_0xdf7a7){_0x13d610['push'](_0x13d610['shift']());}};_0x59f9cf(++_0x291634);}(_0x40fe,0x17f));var _0xe40f=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x40fe[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xe40f('0x0'));var util=require('util');var path=require(_0xe40f('0x1'));var timeout=require(_0xe40f('0x2'));var express=require('express');var router=express[_0xe40f('0x3')]();var auth=require(_0xe40f('0x4'));var interaction=require(_0xe40f('0x5'));var config=require(_0xe40f('0x6'));var controller=require(_0xe40f('0x7'));router[_0xe40f('0x8')]('/',auth[_0xe40f('0x9')](),controller[_0xe40f('0xa')]);router[_0xe40f('0x8')](_0xe40f('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe40f('0x8')](_0xe40f('0xc'),auth['isAuthenticated'](),controller[_0xe40f('0xd')]);router[_0xe40f('0xe')]('/',auth['isAuthenticated'](),controller[_0xe40f('0xf')]);router[_0xe40f('0x10')](_0xe40f('0xc'),auth[_0xe40f('0x9')](),controller[_0xe40f('0x11')]);router[_0xe40f('0x12')](_0xe40f('0xc'),auth[_0xe40f('0x9')](),controller[_0xe40f('0x13')]);module[_0xe40f('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 5c6ef79..23009fd 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 _0x157b=['TEXT','sequelize','STRING'];(function(_0x5bb08e,_0x2fc579){var _0x2d38c8=function(_0x4cb4ac){while(--_0x4cb4ac){_0x5bb08e['push'](_0x5bb08e['shift']());}};_0x2d38c8(++_0x2fc579);}(_0x157b,0xeb));var _0xb157=function(_0x315bd7,_0x2c1e53){_0x315bd7=_0x315bd7-0x0;var _0x1a1420=_0x157b[_0x315bd7];return _0x1a1420;};'use strict';var Sequelize=require(_0xb157('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xb157('0x1')]},'node':{'type':Sequelize[_0xb157('0x1')]},'application':{'type':Sequelize[_0xb157('0x1')]},'data':{'type':Sequelize[_0xb157('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xb157('0x1')]}}; \ No newline at end of file +var _0xbaf9=['STRING','TEXT','sequelize','exports'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0xbaf9,0x17a));var _0x9baf=function(_0x1a1b94,_0x1edb18){_0x1a1b94=_0x1a1b94-0x0;var _0x4f253f=_0xbaf9[_0x1a1b94];return _0x4f253f;};'use strict';var Sequelize=require(_0x9baf('0x0'));module[_0x9baf('0x1')]={'uniqueid':{'type':Sequelize[_0x9baf('0x2')]},'node':{'type':Sequelize[_0x9baf('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x9baf('0x3')]},'project_name':{'type':Sequelize[_0x9baf('0x2')]},'callerid':{'type':Sequelize[_0x9baf('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 71c3b06..0757e4e 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 _0x9d9b=['sort','where','pick','filter','merge','map','field','options','count','includeAll','include','findAll','rows','find','catch','create','body','params','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','index','SquareDetailsReport','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','limit','order'];(function(_0x25b902,_0x4a7bf6){var _0x5ccf68=function(_0x50bd03){while(--_0x50bd03){_0x25b902['push'](_0x25b902['shift']());}};_0x5ccf68(++_0x4a7bf6);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x54e253,_0x4bbf99){_0x54e253=_0x54e253-0x0;var _0x17cddd=_0x9d9b[_0x54e253];return _0x17cddd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb9d9('0x0'));var rimraf=require(_0xb9d9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb9d9('0x2'));var rp=require('request-promise');var moment=require(_0xb9d9('0x3'));var BPromise=require(_0xb9d9('0x4'));var Mustache=require(_0xb9d9('0x5'));var util=require('util');var path=require(_0xb9d9('0x6'));var sox=require('sox');var csv=require(_0xb9d9('0x7'));var ejs=require(_0xb9d9('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb9d9('0x9'));var crypto=require(_0xb9d9('0xa'));var jsforce=require(_0xb9d9('0xb'));var deskjs=require(_0xb9d9('0xc'));var toCsv=require(_0xb9d9('0x7'));var querystring=require(_0xb9d9('0xd'));var Papa=require(_0xb9d9('0xe'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xb9d9('0xf'))(_0xb9d9('0x10'));var utils=require(_0xb9d9('0x11'));var config=require('../../config/environment');var db=require(_0xb9d9('0x12'))['db'];function respondWithStatusCode(_0x367560,_0x4cb239){_0x4cb239=_0x4cb239||0xcc;return function(_0x3cc03d){if(_0x3cc03d){return _0x367560['sendStatus'](_0x4cb239);}return _0x367560[_0xb9d9('0x13')](_0x4cb239)[_0xb9d9('0x14')]();};}function respondWithResult(_0x1fa082,_0x36c468){_0x36c468=_0x36c468||0xc8;return function(_0x26ef71){if(_0x26ef71){return _0x1fa082[_0xb9d9('0x13')](_0x36c468)[_0xb9d9('0x15')](_0x26ef71);}};}function respondWithFilteredResult(_0xfc9733,_0x4cbc4d){return function(_0x4c8864){if(_0x4c8864){var _0x3db648=_0x4c8864['count'],_0x2c9039=_0x4cbc4d['offset'],_0x3909ab=_0x4cbc4d[_0xb9d9('0x16')]+_0x4cbc4d['limit'],_0x168f07;if(_0x3909ab>=_0x3db648){_0x3909ab=_0x3db648;_0x168f07=0xc8;}else{_0x168f07=0xce;}_0xfc9733['status'](_0x168f07);return _0xfc9733[_0xb9d9('0x17')](_0xb9d9('0x18'),_0x2c9039+'-'+_0x3909ab+'/'+_0x3db648)[_0xb9d9('0x15')](_0x4c8864);}return null;};}function patchUpdates(_0x5aea9e){return function(_0x473b89){try{jsonpatch[_0xb9d9('0x19')](_0x473b89,_0x5aea9e,!![]);}catch(_0x493552){return BPromise[_0xb9d9('0x1a')](_0x493552);}return _0x473b89[_0xb9d9('0x1b')]();};}function saveUpdates(_0x491c1a,_0x1d0172){return function(_0x36d55e){if(_0x36d55e){return _0x36d55e['update'](_0x491c1a)[_0xb9d9('0x1c')](function(_0x42ca87){return _0x42ca87;});}return null;};}function removeEntity(_0x288d57,_0x2ab1a5){return function(_0x288ccd){if(_0x288ccd){return _0x288ccd[_0xb9d9('0x1d')]()['then'](function(){_0x288d57[_0xb9d9('0x13')](0xcc)[_0xb9d9('0x14')]();});}};}function handleEntityNotFound(_0x53c82a,_0x45520b){return function(_0x3d61bf){if(!_0x3d61bf){_0x53c82a[_0xb9d9('0x1e')](0x194);}return _0x3d61bf;};}function handleError(_0x1bc364,_0x543d1a){_0x543d1a=_0x543d1a||0x1f4;return function(_0x150085){logger[_0xb9d9('0x1f')](_0x150085[_0xb9d9('0x20')]);if(_0x150085[_0xb9d9('0x21')]){delete _0x150085[_0xb9d9('0x21')];}_0x1bc364[_0xb9d9('0x13')](_0x543d1a)['send'](_0x150085);};}exports[_0xb9d9('0x22')]=function(_0x42181d,_0x3cf063){var _0x48493c={},_0x2a30fe={},_0x1743b1={'count':0x0,'rows':[]};var _0x63a35e=db[_0xb9d9('0x23')][_0xb9d9('0x24')];_0x2a30fe[_0xb9d9('0x25')]=_[_0xb9d9('0x26')](_0x63a35e);_0x2a30fe['query']=_[_0xb9d9('0x26')](_0x42181d[_0xb9d9('0x27')]);_0x2a30fe[_0xb9d9('0x28')]=_[_0xb9d9('0x29')](_0x2a30fe[_0xb9d9('0x25')],_0x2a30fe[_0xb9d9('0x27')]);_0x48493c['attributes']=_[_0xb9d9('0x29')](_0x2a30fe[_0xb9d9('0x25')],qs[_0xb9d9('0x2a')](_0x42181d[_0xb9d9('0x27')]['fields']));_0x48493c[_0xb9d9('0x2b')]=_0x48493c[_0xb9d9('0x2b')][_0xb9d9('0x2c')]?_0x48493c[_0xb9d9('0x2b')]:_0x2a30fe[_0xb9d9('0x25')];if(!_0x42181d[_0xb9d9('0x27')]['hasOwnProperty']('nolimit')){_0x48493c[_0xb9d9('0x2d')]=qs['limit'](_0x42181d[_0xb9d9('0x27')][_0xb9d9('0x2d')]);_0x48493c[_0xb9d9('0x16')]=qs['offset'](_0x42181d[_0xb9d9('0x27')][_0xb9d9('0x16')]);}_0x48493c[_0xb9d9('0x2e')]=qs[_0xb9d9('0x2f')](_0x42181d[_0xb9d9('0x27')][_0xb9d9('0x2f')]);_0x48493c[_0xb9d9('0x30')]=qs[_0xb9d9('0x28')](_[_0xb9d9('0x31')](_0x42181d['query'],_0x2a30fe['filters']));if(_0x42181d['query'][_0xb9d9('0x32')]){_0x48493c[_0xb9d9('0x30')]=_[_0xb9d9('0x33')](_0x48493c[_0xb9d9('0x30')],{'$or':_[_0xb9d9('0x34')](_0x63a35e,function(_0xa574fe){if(_0xa574fe['type']['key']!=='VIRTUAL'){var _0x359a6f={};_0x359a6f[_0xa574fe[_0xb9d9('0x35')]]={'$like':'%'+_0x42181d[_0xb9d9('0x27')][_0xb9d9('0x32')]+'%'};return _0x359a6f;}})});}_0x48493c=_[_0xb9d9('0x33')]({},_0x48493c,_0x42181d[_0xb9d9('0x36')]);var _0x3cf589={'where':_0x48493c[_0xb9d9('0x30')]};return db[_0xb9d9('0x23')][_0xb9d9('0x37')](_0x3cf589)[_0xb9d9('0x1c')](function(_0x2ae9a4){_0x1743b1[_0xb9d9('0x37')]=_0x2ae9a4;if(_0x42181d[_0xb9d9('0x27')][_0xb9d9('0x38')]){_0x48493c[_0xb9d9('0x39')]=[{'all':!![]}];}return db[_0xb9d9('0x23')][_0xb9d9('0x3a')](_0x48493c);})[_0xb9d9('0x1c')](function(_0x4d3cea){_0x1743b1[_0xb9d9('0x3b')]=_0x4d3cea;return _0x1743b1;})[_0xb9d9('0x1c')](respondWithFilteredResult(_0x3cf063,_0x48493c))['catch'](handleError(_0x3cf063,null));};exports['show']=function(_0x41cf93,_0x5e8cb4){var _0xb0a6ef={'raw':!![],'where':{'id':_0x41cf93['params']['id']}},_0x4c63e3={};_0x4c63e3[_0xb9d9('0x25')]=_[_0xb9d9('0x26')](db[_0xb9d9('0x23')][_0xb9d9('0x24')]);_0x4c63e3[_0xb9d9('0x27')]=_[_0xb9d9('0x26')](_0x41cf93[_0xb9d9('0x27')]);_0x4c63e3[_0xb9d9('0x28')]=_['intersection'](_0x4c63e3['model'],_0x4c63e3[_0xb9d9('0x27')]);_0xb0a6ef[_0xb9d9('0x2b')]=_[_0xb9d9('0x29')](_0x4c63e3['model'],qs[_0xb9d9('0x2a')](_0x41cf93[_0xb9d9('0x27')][_0xb9d9('0x2a')]));_0xb0a6ef[_0xb9d9('0x2b')]=_0xb0a6ef[_0xb9d9('0x2b')][_0xb9d9('0x2c')]?_0xb0a6ef[_0xb9d9('0x2b')]:_0x4c63e3[_0xb9d9('0x25')];if(_0x41cf93['query'][_0xb9d9('0x38')]){_0xb0a6ef[_0xb9d9('0x39')]=[{'all':!![]}];}_0xb0a6ef=_[_0xb9d9('0x33')]({},_0xb0a6ef,_0x41cf93[_0xb9d9('0x36')]);return db[_0xb9d9('0x23')][_0xb9d9('0x3c')](_0xb0a6ef)[_0xb9d9('0x1c')](handleEntityNotFound(_0x5e8cb4,null))[_0xb9d9('0x1c')](respondWithResult(_0x5e8cb4,null))[_0xb9d9('0x3d')](handleError(_0x5e8cb4,null));};exports[_0xb9d9('0x3e')]=function(_0x2877bc,_0x474562){return db[_0xb9d9('0x23')][_0xb9d9('0x3e')](_0x2877bc[_0xb9d9('0x3f')],{})[_0xb9d9('0x1c')](respondWithResult(_0x474562,0xc9))[_0xb9d9('0x3d')](handleError(_0x474562,null));};exports['update']=function(_0x4717cd,_0x372853){if(_0x4717cd['body']['id']){delete _0x4717cd[_0xb9d9('0x3f')]['id'];}return db[_0xb9d9('0x23')][_0xb9d9('0x3c')]({'where':{'id':_0x4717cd[_0xb9d9('0x40')]['id']}})[_0xb9d9('0x1c')](handleEntityNotFound(_0x372853,null))[_0xb9d9('0x1c')](saveUpdates(_0x4717cd['body'],null))[_0xb9d9('0x1c')](respondWithResult(_0x372853,null))[_0xb9d9('0x3d')](handleError(_0x372853,null));};exports[_0xb9d9('0x1d')]=function(_0x30e3b1,_0x53f7cb){return db[_0xb9d9('0x23')][_0xb9d9('0x3c')]({'where':{'id':_0x30e3b1[_0xb9d9('0x40')]['id']}})['then'](handleEntityNotFound(_0x53f7cb,null))[_0xb9d9('0x1c')](removeEntity(_0x53f7cb,null))[_0xb9d9('0x3d')](handleError(_0x53f7cb,null));};exports[_0xb9d9('0x41')]=function(_0x445f17,_0x1be7ee){return db[_0xb9d9('0x23')]['describe']()[_0xb9d9('0x1c')](respondWithResult(_0x1be7ee,null))['catch'](handleError(_0x1be7ee,null));}; \ No newline at end of file +var _0x8d39=['request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','SquareDetailsReport','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','type','key','field','options','count','includeAll','include','findAll','show','catch','create','body','find','params','describe','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x48dae1,_0x5ed7ce){var _0x48fee6=function(_0x24405d){while(--_0x24405d){_0x48dae1['push'](_0x48dae1['shift']());}};_0x48fee6(++_0x5ed7ce);}(_0x8d39,0x120));var _0x98d3=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x8d39[_0x87b0ff];return _0x3bc0b2;};'use strict';var pdf=require(_0x98d3('0x0'));var emlformat=require(_0x98d3('0x1'));var rimraf=require(_0x98d3('0x2'));var zipdir=require(_0x98d3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98d3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x98d3('0x5'));var util=require(_0x98d3('0x6'));var path=require(_0x98d3('0x7'));var sox=require(_0x98d3('0x8'));var csv=require(_0x98d3('0x9'));var ejs=require(_0x98d3('0xa'));var fs=require('fs');var _=require(_0x98d3('0xb'));var squel=require(_0x98d3('0xc'));var crypto=require('crypto');var jsforce=require(_0x98d3('0xd'));var deskjs=require(_0x98d3('0xe'));var toCsv=require(_0x98d3('0x9'));var querystring=require(_0x98d3('0xf'));var Papa=require(_0x98d3('0x10'));var authService=require(_0x98d3('0x11'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x98d3('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0x98d3('0x13'))(_0x98d3('0x14'));var utils=require('../../config/utils');var config=require(_0x98d3('0x15'));var db=require(_0x98d3('0x16'))['db'];function respondWithStatusCode(_0x46f421,_0x5c7db5){_0x5c7db5=_0x5c7db5||0xcc;return function(_0x1737c6){if(_0x1737c6){return _0x46f421[_0x98d3('0x17')](_0x5c7db5);}return _0x46f421[_0x98d3('0x18')](_0x5c7db5)[_0x98d3('0x19')]();};}function respondWithResult(_0x424a94,_0x4bf68d){_0x4bf68d=_0x4bf68d||0xc8;return function(_0xab6a3e){if(_0xab6a3e){return _0x424a94[_0x98d3('0x18')](_0x4bf68d)['json'](_0xab6a3e);}};}function respondWithFilteredResult(_0x6df27a,_0x59728e){return function(_0x3637b6){if(_0x3637b6){var _0x586f79=_0x3637b6['count'],_0x3ac6e7=_0x59728e[_0x98d3('0x1a')],_0x1b2647=_0x59728e[_0x98d3('0x1a')]+_0x59728e[_0x98d3('0x1b')],_0x1d598a;if(_0x1b2647>=_0x586f79){_0x1b2647=_0x586f79;_0x1d598a=0xc8;}else{_0x1d598a=0xce;}_0x6df27a[_0x98d3('0x18')](_0x1d598a);return _0x6df27a['set']('Content-Range',_0x3ac6e7+'-'+_0x1b2647+'/'+_0x586f79)[_0x98d3('0x1c')](_0x3637b6);}return null;};}function patchUpdates(_0x10b4f2){return function(_0x3fc950){try{jsonpatch[_0x98d3('0x1d')](_0x3fc950,_0x10b4f2,!![]);}catch(_0x2851ae){return BPromise[_0x98d3('0x1e')](_0x2851ae);}return _0x3fc950[_0x98d3('0x1f')]();};}function saveUpdates(_0x45bcc9,_0x301044){return function(_0xa5c4cd){if(_0xa5c4cd){return _0xa5c4cd[_0x98d3('0x20')](_0x45bcc9)[_0x98d3('0x21')](function(_0x3ccde5){return _0x3ccde5;});}return null;};}function removeEntity(_0x2fb685,_0x4c60c7){return function(_0x17714a){if(_0x17714a){return _0x17714a[_0x98d3('0x22')]()['then'](function(){_0x2fb685[_0x98d3('0x18')](0xcc)[_0x98d3('0x19')]();});}};}function handleEntityNotFound(_0x56914a,_0x5ab2a7){return function(_0x5da6dc){if(!_0x5da6dc){_0x56914a[_0x98d3('0x17')](0x194);}return _0x5da6dc;};}function handleError(_0xf64b30,_0x2735b5){_0x2735b5=_0x2735b5||0x1f4;return function(_0x5b3a49){logger[_0x98d3('0x23')](_0x5b3a49[_0x98d3('0x24')]);if(_0x5b3a49['name']){delete _0x5b3a49[_0x98d3('0x25')];}_0xf64b30[_0x98d3('0x18')](_0x2735b5)[_0x98d3('0x26')](_0x5b3a49);};}exports[_0x98d3('0x27')]=function(_0x268e8d,_0x14725c){var _0xc46a89={},_0x8261d0={},_0x4297fa={'count':0x0,'rows':[]};var _0x52de44=db[_0x98d3('0x28')][_0x98d3('0x29')];_0x8261d0[_0x98d3('0x2a')]=_[_0x98d3('0x2b')](_0x52de44);_0x8261d0[_0x98d3('0x2c')]=_['keys'](_0x268e8d[_0x98d3('0x2c')]);_0x8261d0['filters']=_[_0x98d3('0x2d')](_0x8261d0[_0x98d3('0x2a')],_0x8261d0['query']);_0xc46a89[_0x98d3('0x2e')]=_[_0x98d3('0x2d')](_0x8261d0[_0x98d3('0x2a')],qs[_0x98d3('0x2f')](_0x268e8d[_0x98d3('0x2c')][_0x98d3('0x2f')]));_0xc46a89['attributes']=_0xc46a89[_0x98d3('0x2e')][_0x98d3('0x30')]?_0xc46a89[_0x98d3('0x2e')]:_0x8261d0[_0x98d3('0x2a')];if(!_0x268e8d[_0x98d3('0x2c')][_0x98d3('0x31')]('nolimit')){_0xc46a89[_0x98d3('0x1b')]=qs['limit'](_0x268e8d[_0x98d3('0x2c')][_0x98d3('0x1b')]);_0xc46a89[_0x98d3('0x1a')]=qs[_0x98d3('0x1a')](_0x268e8d[_0x98d3('0x2c')]['offset']);}_0xc46a89[_0x98d3('0x32')]=qs[_0x98d3('0x33')](_0x268e8d[_0x98d3('0x2c')]['sort']);_0xc46a89[_0x98d3('0x34')]=qs[_0x98d3('0x35')](_[_0x98d3('0x36')](_0x268e8d[_0x98d3('0x2c')],_0x8261d0[_0x98d3('0x35')]));if(_0x268e8d[_0x98d3('0x2c')][_0x98d3('0x37')]){_0xc46a89[_0x98d3('0x34')]=_[_0x98d3('0x38')](_0xc46a89[_0x98d3('0x34')],{'$or':_[_0x98d3('0x39')](_0x52de44,function(_0x1b9c00){if(_0x1b9c00[_0x98d3('0x3a')][_0x98d3('0x3b')]!=='VIRTUAL'){var _0x96f634={};_0x96f634[_0x1b9c00[_0x98d3('0x3c')]]={'$like':'%'+_0x268e8d['query']['filter']+'%'};return _0x96f634;}})});}_0xc46a89=_['merge']({},_0xc46a89,_0x268e8d[_0x98d3('0x3d')]);var _0x1cc55c={'where':_0xc46a89[_0x98d3('0x34')]};return db[_0x98d3('0x28')][_0x98d3('0x3e')](_0x1cc55c)[_0x98d3('0x21')](function(_0x3fc335){_0x4297fa[_0x98d3('0x3e')]=_0x3fc335;if(_0x268e8d[_0x98d3('0x2c')][_0x98d3('0x3f')]){_0xc46a89[_0x98d3('0x40')]=[{'all':!![]}];}return db[_0x98d3('0x28')][_0x98d3('0x41')](_0xc46a89);})[_0x98d3('0x21')](function(_0x26d86d){_0x4297fa['rows']=_0x26d86d;return _0x4297fa;})[_0x98d3('0x21')](respondWithFilteredResult(_0x14725c,_0xc46a89))['catch'](handleError(_0x14725c,null));};exports[_0x98d3('0x42')]=function(_0x3ff7d1,_0x4467e5){var _0x45dc00={'raw':!![],'where':{'id':_0x3ff7d1['params']['id']}},_0x278a1b={};_0x278a1b[_0x98d3('0x2a')]=_[_0x98d3('0x2b')](db[_0x98d3('0x28')][_0x98d3('0x29')]);_0x278a1b[_0x98d3('0x2c')]=_[_0x98d3('0x2b')](_0x3ff7d1['query']);_0x278a1b[_0x98d3('0x35')]=_['intersection'](_0x278a1b[_0x98d3('0x2a')],_0x278a1b['query']);_0x45dc00['attributes']=_[_0x98d3('0x2d')](_0x278a1b[_0x98d3('0x2a')],qs['fields'](_0x3ff7d1[_0x98d3('0x2c')][_0x98d3('0x2f')]));_0x45dc00[_0x98d3('0x2e')]=_0x45dc00[_0x98d3('0x2e')][_0x98d3('0x30')]?_0x45dc00['attributes']:_0x278a1b[_0x98d3('0x2a')];if(_0x3ff7d1['query'][_0x98d3('0x3f')]){_0x45dc00[_0x98d3('0x40')]=[{'all':!![]}];}_0x45dc00=_[_0x98d3('0x38')]({},_0x45dc00,_0x3ff7d1[_0x98d3('0x3d')]);return db[_0x98d3('0x28')]['find'](_0x45dc00)[_0x98d3('0x21')](handleEntityNotFound(_0x4467e5,null))[_0x98d3('0x21')](respondWithResult(_0x4467e5,null))[_0x98d3('0x43')](handleError(_0x4467e5,null));};exports[_0x98d3('0x44')]=function(_0x208469,_0x2380b9){return db[_0x98d3('0x28')][_0x98d3('0x44')](_0x208469['body'],{})[_0x98d3('0x21')](respondWithResult(_0x2380b9,0xc9))[_0x98d3('0x43')](handleError(_0x2380b9,null));};exports[_0x98d3('0x20')]=function(_0x5ec988,_0x5f3e41){if(_0x5ec988[_0x98d3('0x45')]['id']){delete _0x5ec988[_0x98d3('0x45')]['id'];}return db['SquareDetailsReport'][_0x98d3('0x46')]({'where':{'id':_0x5ec988[_0x98d3('0x47')]['id']}})['then'](handleEntityNotFound(_0x5f3e41,null))[_0x98d3('0x21')](saveUpdates(_0x5ec988[_0x98d3('0x45')],null))[_0x98d3('0x21')](respondWithResult(_0x5f3e41,null))[_0x98d3('0x43')](handleError(_0x5f3e41,null));};exports['destroy']=function(_0x21613c,_0x3c59b0){return db[_0x98d3('0x28')][_0x98d3('0x46')]({'where':{'id':_0x21613c['params']['id']}})['then'](handleEntityNotFound(_0x3c59b0,null))[_0x98d3('0x21')](removeEntity(_0x3c59b0,null))[_0x98d3('0x43')](handleError(_0x3c59b0,null));};exports[_0x98d3('0x48')]=function(_0x3c9c19,_0x313905){return db[_0x98d3('0x28')][_0x98d3('0x48')]()[_0x98d3('0x21')](respondWithResult(_0x313905,null))[_0x98d3('0x43')](handleError(_0x313905,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index d15f0d8..0647e18 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 _0xb10e=['../../config/logger','api','moment','bluebird','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util'];(function(_0x526e06,_0xd6e970){var _0x463b71=function(_0x41aa35){while(--_0x41aa35){_0x526e06['push'](_0x526e06['shift']());}};_0x463b71(++_0xd6e970);}(_0xb10e,0x11c));var _0xeb10=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xb10e[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xeb10('0x0'));var util=require(_0xeb10('0x1'));var logger=require(_0xeb10('0x2'))(_0xeb10('0x3'));var moment=require(_0xeb10('0x4'));var BPromise=require(_0xeb10('0x5'));var rp=require('request-promise');var attributes=require(_0xeb10('0x6'));module[_0xeb10('0x7')]=function(_0x1b5175,_0x35ac7e){return _0x1b5175[_0xeb10('0x8')](_0xeb10('0x9'),attributes,{'tableName':_0xeb10('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f6d=['bluebird','request-promise','./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','util','../../config/logger','api','moment'];(function(_0x4be11c,_0x5e82b9){var _0x112f00=function(_0x5585b8){while(--_0x5585b8){_0x4be11c['push'](_0x4be11c['shift']());}};_0x112f00(++_0x5e82b9);}(_0x6f6d,0xce));var _0xd6f6=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6f6d[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0xd6f6('0x0'));var logger=require(_0xd6f6('0x1'))(_0xd6f6('0x2'));var moment=require(_0xd6f6('0x3'));var BPromise=require(_0xd6f6('0x4'));var rp=require(_0xd6f6('0x5'));var attributes=require(_0xd6f6('0x6'));module['exports']=function(_0x3c0abd,_0x1fb465){return _0x3c0abd[_0xd6f6('0x7')](_0xd6f6('0x8'),attributes,{'tableName':_0xd6f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index b759f16..ecc2060 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 _0x3d6d=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x38daf7,_0x162ed6){var _0x363bb9=function(_0x52c620){while(--_0x52c620){_0x38daf7['push'](_0x38daf7['shift']());}};_0x363bb9(++_0x162ed6);}(_0x3d6d,0xb3));var _0xd3d6=function(_0x44ea1b,_0x36bbd3){_0x44ea1b=_0x44ea1b-0x0;var _0x239690=_0x3d6d[_0x44ea1b];return _0x239690;};'use strict';var _=require(_0xd3d6('0x0'));var util=require(_0xd3d6('0x1'));var moment=require(_0xd3d6('0x2'));var BPromise=require(_0xd3d6('0x3'));var rs=require(_0xd3d6('0x4'));var fs=require('fs');var Redis=require(_0xd3d6('0x5'));var db=require(_0xd3d6('0x6'))['db'];var utils=require(_0xd3d6('0x7'));var logger=require(_0xd3d6('0x8'))(_0xd3d6('0x9'));var config=require(_0xd3d6('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd3d6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f02f5,_0x1bb0d5,_0x3c2a9b){return new BPromise(function(_0x4356b7,_0x5a469d){return client[_0xd3d6('0xc')](_0x1f02f5,_0x3c2a9b)[_0xd3d6('0xd')](function(_0x465ffd){logger[_0xd3d6('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x1bb0d5,'request\x20sent');logger[_0xd3d6('0xf')](_0xd3d6('0x10'),_0x1bb0d5,_0xd3d6('0x11'),JSON[_0xd3d6('0x12')](_0x465ffd));if(_0x465ffd[_0xd3d6('0x13')]){if(_0x465ffd[_0xd3d6('0x13')][_0xd3d6('0x14')]===0x1f4){logger[_0xd3d6('0x13')](_0xd3d6('0x15'),_0x1bb0d5,_0x465ffd['error'][_0xd3d6('0x16')]);return _0x5a469d(_0x465ffd[_0xd3d6('0x13')][_0xd3d6('0x16')]);}logger['error'](_0xd3d6('0x15'),_0x1bb0d5,_0x465ffd[_0xd3d6('0x13')][_0xd3d6('0x16')]);return _0x4356b7(_0x465ffd['error'][_0xd3d6('0x16')]);}else{logger[_0xd3d6('0xe')](_0xd3d6('0x15'),_0x1bb0d5,_0xd3d6('0x11'));_0x4356b7(_0x465ffd[_0xd3d6('0x17')][_0xd3d6('0x16')]);}})[_0xd3d6('0x18')](function(_0x31d4f0){logger[_0xd3d6('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x1bb0d5,_0x31d4f0);_0x5a469d(_0x31d4f0);});});}exports[_0xd3d6('0x19')]=function(_0x27bac7){var _0x173ef4=this;return new Promise(function(_0x3581bd,_0x2e5630){return db[_0xd3d6('0x1a')][_0xd3d6('0x1b')](_0x27bac7[_0xd3d6('0x1c')],{'raw':_0x27bac7['options']?_0x27bac7[_0xd3d6('0x1d')][_0xd3d6('0x1e')]===undefined?!![]:![]:!![]})[_0xd3d6('0xd')](function(_0x4e7fa3){logger[_0xd3d6('0xe')](_0xd3d6('0x19'),_0x27bac7);logger[_0xd3d6('0xf')](_0xd3d6('0x19'),_0x27bac7,JSON['stringify'](_0x4e7fa3));_0x3581bd(_0x4e7fa3);})[_0xd3d6('0x18')](function(_0x794484){logger['error'](_0xd3d6('0x19'),_0x794484[_0xd3d6('0x16')],_0x27bac7);_0x2e5630(_0x173ef4[_0xd3d6('0x13')](0x1f4,_0x794484['message']));});});}; \ No newline at end of file +var _0x448b=['debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','CreateSquareDetailsReport','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x448b,0x125));var _0xb448=function(_0xbcd2c1,_0x34244c){_0xbcd2c1=_0xbcd2c1-0x0;var _0x4f5008=_0x448b[_0xbcd2c1];return _0x4f5008;};'use strict';var _=require(_0xb448('0x0'));var util=require(_0xb448('0x1'));var moment=require(_0xb448('0x2'));var BPromise=require(_0xb448('0x3'));var rs=require(_0xb448('0x4'));var fs=require('fs');var Redis=require(_0xb448('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb448('0x6'));var logger=require(_0xb448('0x7'))(_0xb448('0x8'));var config=require(_0xb448('0x9'));var jayson=require(_0xb448('0xa'));var client=jayson[_0xb448('0xb')][_0xb448('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5993ad,_0x2de6e5,_0x2f6f82){return new BPromise(function(_0x2c2bdd,_0x180c18){return client[_0xb448('0xd')](_0x5993ad,_0x2f6f82)[_0xb448('0xe')](function(_0x1e6e2f){logger[_0xb448('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x2de6e5,_0xb448('0x10'));logger[_0xb448('0x11')](_0xb448('0x12'),_0x2de6e5,_0xb448('0x10'),JSON[_0xb448('0x13')](_0x1e6e2f));if(_0x1e6e2f[_0xb448('0x14')]){if(_0x1e6e2f['error'][_0xb448('0x15')]===0x1f4){logger['error'](_0xb448('0x16'),_0x2de6e5,_0x1e6e2f[_0xb448('0x14')][_0xb448('0x17')]);return _0x180c18(_0x1e6e2f[_0xb448('0x14')][_0xb448('0x17')]);}logger[_0xb448('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x2de6e5,_0x1e6e2f[_0xb448('0x14')][_0xb448('0x17')]);return _0x2c2bdd(_0x1e6e2f[_0xb448('0x14')][_0xb448('0x17')]);}else{logger[_0xb448('0xf')](_0xb448('0x16'),_0x2de6e5,_0xb448('0x10'));_0x2c2bdd(_0x1e6e2f[_0xb448('0x18')][_0xb448('0x17')]);}})['catch'](function(_0x4a5fe5){logger[_0xb448('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x2de6e5,_0x4a5fe5);_0x180c18(_0x4a5fe5);});});}exports[_0xb448('0x19')]=function(_0x1986de){var _0x5556fb=this;return new Promise(function(_0x27906d,_0x28b73c){return db['SquareDetailsReport'][_0xb448('0x1a')](_0x1986de[_0xb448('0x1b')],{'raw':_0x1986de[_0xb448('0x1c')]?_0x1986de[_0xb448('0x1c')][_0xb448('0x1d')]===undefined?!![]:![]:!![]})[_0xb448('0xe')](function(_0x1c25af){logger[_0xb448('0xf')]('CreateSquareDetailsReport',_0x1986de);logger[_0xb448('0x11')](_0xb448('0x19'),_0x1986de,JSON['stringify'](_0x1c25af));_0x27906d(_0x1c25af);})[_0xb448('0x1e')](function(_0x3ef9c7){logger[_0xb448('0x14')](_0xb448('0x19'),_0x3ef9c7[_0xb448('0x17')],_0x1986de);_0x28b73c(_0x5556fb['error'](0x1f4,_0x3ef9c7['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 93cfa63..f5cacdf 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 _0x4d9d=['express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x4d9d,0x69));var _0xd4d9=function(_0x2d7836,_0x5a5412){_0x2d7836=_0x2d7836-0x0;var _0x491179=_0x4d9d[_0x2d7836];return _0x491179;};'use strict';var express=require(_0xd4d9('0x0'));var router=express[_0xd4d9('0x1')]();var auth=require(_0xd4d9('0x2'));var controller=require(_0xd4d9('0x3'));router[_0xd4d9('0x4')]('/',auth[_0xd4d9('0x5')](),controller['index']);router[_0xd4d9('0x4')](_0xd4d9('0x6'),auth[_0xd4d9('0x5')](),controller['killProcess']);module['exports']=router; \ No newline at end of file +var _0x717e=['/process/:pid/kill','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index'];(function(_0xba8da6,_0x5d784d){var _0x3602b1=function(_0x29fb74){while(--_0x29fb74){_0xba8da6['push'](_0xba8da6['shift']());}};_0x3602b1(++_0x5d784d);}(_0x717e,0x1ac));var _0xe717=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0x717e[_0x14fad0];return _0x5c665f;};'use strict';var express=require('express');var router=express[_0xe717('0x0')]();var auth=require(_0xe717('0x1'));var controller=require(_0xe717('0x2'));router[_0xe717('0x3')]('/',auth[_0xe717('0x4')](),controller[_0xe717('0x5')]);router[_0xe717('0x3')](_0xe717('0x6'),auth[_0xe717('0x4')](),controller['killProcess']);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index dbd464a..7325331 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 _0xfc44=['lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','json','catch','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','then','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','api','bluebird'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xfc44,0x157));var _0x4fc4=function(_0x5bcf79,_0x18b106){_0x5bcf79=_0x5bcf79-0x0;var _0x24af68=_0xfc44[_0x5bcf79];return _0x24af68;};'use strict';var info=require('systeminformation');var exec=require(_0x4fc4('0x0'))[_0x4fc4('0x1')];var logger=require(_0x4fc4('0x2'))(_0x4fc4('0x3'));var util=require('util');var BPromise=require(_0x4fc4('0x4'));var _=require(_0x4fc4('0x5'));function handleError(_0x310ed7,_0x5cefdb,_0x3d3eda){_0x5cefdb=_0x5cefdb||0x1f4;return function(_0x611b92){logger[_0x4fc4('0x6')](_0x4fc4('0x7'),_0x3d3eda,_0x5cefdb,util[_0x4fc4('0x8')](_0x611b92,{'showHidden':![],'depth':null}));delete _0x611b92[_0x4fc4('0x9')];_0x310ed7[_0x4fc4('0xa')](_0x5cefdb)[_0x4fc4('0xb')](_0x611b92);};}exports[_0x4fc4('0xc')]=function(_0x22ff5d,_0x471a3b){return info[_0x4fc4('0xd')]()['then'](function(_0x3a30bb){return _0x471a3b[_0x4fc4('0xa')](0xc8)[_0x4fc4('0xe')](_0x3a30bb);})[_0x4fc4('0xf')](function(_0xb98e1b){return _0x471a3b['status'](0x1f4)[_0x4fc4('0xe')](_0xb98e1b);});};exports['killProcess']=function(_0x44199b,_0x33f263){var _0x19fedf=[_0x4fc4('0x10')];return new BPromise(function(_0x317a04,_0x27cc15){return exec(util['format'](_0x4fc4('0x11'),_0x44199b[_0x4fc4('0x12')]['pid']),function(_0x277411,_0x10981a,_0x178f52){if(_0x277411){return _0x27cc15(_0x277411);}return _0x317a04(_0x10981a);});})[_0x4fc4('0x13')](function(_0x4644c2){var _0x2d2c0b=![];var _0x3a4764=_0x4644c2[_0x4fc4('0x14')](/\n/);for(var _0x5987a5=0x0,_0x3587d8=_0x19fedf[_0x4fc4('0x15')];_0x5987a5<_0x3587d8,_0x2d2c0b===![];_0x5987a5+=0x1){if(_0x4644c2[_0x4fc4('0x16')](_0x19fedf[_0x5987a5])>=0x0){_0x2d2c0b=!![];}}if(!_0x2d2c0b){throw new Error(util[_0x4fc4('0x17')](_0x4fc4('0x18'),_0x44199b[_0x4fc4('0x12')][_0x4fc4('0x19')]));}process[_0x4fc4('0x1a')](_0x44199b[_0x4fc4('0x12')][_0x4fc4('0x19')],_0x4fc4('0x1b'));return _0x33f263[_0x4fc4('0xa')](0xc8)['json']({'message':util['format'](_0x4fc4('0x1c'),_0x44199b[_0x4fc4('0x12')][_0x4fc4('0x19')])});})['catch'](handleError(_0x33f263,null,'killProcess'));}; \ No newline at end of file +var _0x9aef=['catch','json','params','pid','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','killProcess','systeminformation','child_process','exec','../../config/logger','bluebird','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','send','index','then','status'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9aef,0xff));var _0xf9ae=function(_0x4f8d61,_0x29eff0){_0x4f8d61=_0x4f8d61-0x0;var _0x3bc078=_0x9aef[_0x4f8d61];return _0x3bc078;};'use strict';var info=require(_0xf9ae('0x0'));var exec=require(_0xf9ae('0x1'))[_0xf9ae('0x2')];var logger=require(_0xf9ae('0x3'))('api');var util=require('util');var BPromise=require(_0xf9ae('0x4'));var _=require('lodash');function handleError(_0x433ef3,_0x436c77,_0x438958){_0x436c77=_0x436c77||0x1f4;return function(_0x899d63){logger['error'](_0xf9ae('0x5'),_0x438958,_0x436c77,util[_0xf9ae('0x6')](_0x899d63,{'showHidden':![],'depth':null}));delete _0x899d63['name'];_0x433ef3['status'](_0x436c77)[_0xf9ae('0x7')](_0x899d63);};}exports[_0xf9ae('0x8')]=function(_0x3061f2,_0x5773be){return info['getAllData']()[_0xf9ae('0x9')](function(_0x293a5c){return _0x5773be[_0xf9ae('0xa')](0xc8)['json'](_0x293a5c);})[_0xf9ae('0xb')](function(_0x2dd0c0){return _0x5773be[_0xf9ae('0xa')](0x1f4)[_0xf9ae('0xc')](_0x2dd0c0);});};exports['killProcess']=function(_0x1b9851,_0x558e8e){var _0x5f0bc1=['components/import/cm'];return new BPromise(function(_0x4262de,_0x513c33){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x1b9851[_0xf9ae('0xd')][_0xf9ae('0xe')]),function(_0x5c9bab,_0xacd969,_0x573c63){if(_0x5c9bab){return _0x513c33(_0x5c9bab);}return _0x4262de(_0xacd969);});})['then'](function(_0x2e5530){var _0x3a0c2c=![];var _0x6f3db3=_0x2e5530['split'](/\n/);for(var _0x1c68e9=0x0,_0x276565=_0x5f0bc1['length'];_0x1c68e9<_0x276565,_0x3a0c2c===![];_0x1c68e9+=0x1){if(_0x2e5530[_0xf9ae('0xf')](_0x5f0bc1[_0x1c68e9])>=0x0){_0x3a0c2c=!![];}}if(!_0x3a0c2c){throw new Error(util[_0xf9ae('0x10')](_0xf9ae('0x11'),_0x1b9851['params']['pid']));}process['kill'](_0x1b9851['params'][_0xf9ae('0xe')],'SIGINT');return _0x558e8e[_0xf9ae('0xa')](0xc8)[_0xf9ae('0xc')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x1b9851['params'][_0xf9ae('0xe')])});})[_0xf9ae('0xb')](handleError(_0x558e8e,null,_0xf9ae('0x12')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 34458b3..cfb9f4c 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 _0x0b0e=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','post','create','put','update','exports'];(function(_0x27a8d1,_0x205937){var _0xb33677=function(_0x3c2599){while(--_0x3c2599){_0x27a8d1['push'](_0x27a8d1['shift']());}};_0xb33677(++_0x205937);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3d4ef1,_0x5a957c){_0x3d4ef1=_0x3d4ef1-0x0;var _0x409423=_0x0b0e[_0x3d4ef1];return _0x409423;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xe0b0('0xc')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router[_0xe0b0('0xe')]('/:id',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xf')]);router['delete'](_0xe0b0('0xb'),auth[_0xe0b0('0x9')](),controller['destroy']);module[_0xe0b0('0x10')]=router; \ No newline at end of file +var _0x4fc2=['./tag.controller','get','index','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x9ea249,_0x4478c9){var _0x2eab06=function(_0x9f9f79){while(--_0x9f9f79){_0x9ea249['push'](_0x9ea249['shift']());}};_0x2eab06(++_0x4478c9);}(_0x4fc2,0x111));var _0x24fc=function(_0x2c7377,_0x32ade5){_0x2c7377=_0x2c7377-0x0;var _0x35e181=_0x4fc2[_0x2c7377];return _0x35e181;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var auth=require(_0x24fc('0x5'));var interaction=require(_0x24fc('0x6'));var config=require('../../config/environment');var controller=require(_0x24fc('0x7'));router[_0x24fc('0x8')]('/',auth['isAuthenticated'](),controller[_0x24fc('0x9')]);router[_0x24fc('0x8')]('/:id',auth[_0x24fc('0xa')](),controller[_0x24fc('0xb')]);router[_0x24fc('0xc')]('/',auth[_0x24fc('0xa')](),controller[_0x24fc('0xd')]);router[_0x24fc('0xe')]('/:id',auth[_0x24fc('0xa')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0x11'),auth[_0x24fc('0xa')](),controller[_0x24fc('0x12')]);module[_0x24fc('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 86972e5..726daae 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 _0x535a=['STRING','sequelize','exports','name'];(function(_0xf8be20,_0x7d7205){var _0x26d6d5=function(_0x3ccd13){while(--_0x3ccd13){_0xf8be20['push'](_0xf8be20['shift']());}};_0x26d6d5(++_0x7d7205);}(_0x535a,0x91));var _0xa535=function(_0x2cb41a,_0x56f34e){_0x2cb41a=_0x2cb41a-0x0;var _0x2f09ff=_0x535a[_0x2cb41a];return _0x2f09ff;};'use strict';var Sequelize=require(_0xa535('0x0'));module[_0xa535('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa535('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xa535('0x3')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xa535('0x3')]}}; \ No newline at end of file +var _0xb6e9=['name','#0091EA','sequelize','exports','STRING'];(function(_0x9ac8fb,_0x3ae4ba){var _0x2b19ae=function(_0x54e7a6){while(--_0x54e7a6){_0x9ac8fb['push'](_0x9ac8fb['shift']());}};_0x2b19ae(++_0x3ae4ba);}(_0xb6e9,0xe3));var _0x9b6e=function(_0x57af29,_0x56e3fb){_0x57af29=_0x57af29-0x0;var _0x2d791f=_0xb6e9[_0x57af29];return _0x2d791f;};'use strict';var Sequelize=require(_0x9b6e('0x0'));module[_0x9b6e('0x1')]={'name':{'type':Sequelize[_0x9b6e('0x2')],'unique':_0x9b6e('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x9b6e('0x2')],'defaultValue':_0x9b6e('0x4')},'description':{'type':Sequelize[_0x9b6e('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 38bc322..ac7ec87 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 _0x3266=['filter','merge','map','key','VIRTUAL','field','options','count','includeAll','findAll','rows','catch','show','params','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','Content-Range','reject','save','update','destroy','then','get','Tags','UserProfileResource','status','sendStatus','stack','name','send','index','Tag','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','offset','sort','where','pick'];(function(_0x2bf6fc,_0xc22f67){var _0x478df4=function(_0x78ac60){while(--_0x78ac60){_0x2bf6fc['push'](_0x2bf6fc['shift']());}};_0x478df4(++_0xc22f67);}(_0x3266,0x6a));var _0x6326=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0x3266[_0x33554b];return _0x256954;};'use strict';var pdf=require(_0x6326('0x0'));var emlformat=require(_0x6326('0x1'));var rimraf=require(_0x6326('0x2'));var zipdir=require(_0x6326('0x3'));var jsonpatch=require(_0x6326('0x4'));var rp=require(_0x6326('0x5'));var moment=require(_0x6326('0x6'));var BPromise=require(_0x6326('0x7'));var Mustache=require(_0x6326('0x8'));var util=require('util');var path=require(_0x6326('0x9'));var sox=require('sox');var csv=require(_0x6326('0xa'));var ejs=require(_0x6326('0xb'));var fs=require('fs');var _=require(_0x6326('0xc'));var squel=require('squel');var crypto=require(_0x6326('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6326('0xe'));var toCsv=require(_0x6326('0xa'));var querystring=require(_0x6326('0xf'));var Papa=require(_0x6326('0x10'));var authService=require(_0x6326('0x11'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x6326('0x12'));var qs=require(_0x6326('0x13'));var logger=require(_0x6326('0x14'))(_0x6326('0x15'));var utils=require(_0x6326('0x16'));var config=require(_0x6326('0x17'));var db=require(_0x6326('0x18'))['db'];function respondWithStatusCode(_0x77c4e,_0x40a68a){_0x40a68a=_0x40a68a||0xcc;return function(_0x379358){if(_0x379358){return _0x77c4e['sendStatus'](_0x40a68a);}return _0x77c4e['status'](_0x40a68a)[_0x6326('0x19')]();};}function respondWithResult(_0x136946,_0x591b81){_0x591b81=_0x591b81||0xc8;return function(_0x425878){if(_0x425878){return _0x136946['status'](_0x591b81)[_0x6326('0x1a')](_0x425878);}};}function respondWithFilteredResult(_0x20dcc6,_0x3d6ac0){return function(_0x41c352){if(_0x41c352){var _0x1ed3a3=_0x41c352['count'],_0x2c1879=_0x3d6ac0['offset'],_0x55923a=_0x3d6ac0['offset']+_0x3d6ac0['limit'],_0x1104c5;if(_0x55923a>=_0x1ed3a3){_0x55923a=_0x1ed3a3;_0x1104c5=0xc8;}else{_0x1104c5=0xce;}_0x20dcc6['status'](_0x1104c5);return _0x20dcc6['set'](_0x6326('0x1b'),_0x2c1879+'-'+_0x55923a+'/'+_0x1ed3a3)[_0x6326('0x1a')](_0x41c352);}return null;};}function patchUpdates(_0x2be78e){return function(_0x556c4e){try{jsonpatch['apply'](_0x556c4e,_0x2be78e,!![]);}catch(_0x954ed5){return BPromise[_0x6326('0x1c')](_0x954ed5);}return _0x556c4e[_0x6326('0x1d')]();};}function saveUpdates(_0x3db834,_0x3c08db){return function(_0x25957a){if(_0x25957a){return _0x25957a[_0x6326('0x1e')](_0x3db834)['then'](function(_0x22307f){return _0x22307f;});}return null;};}function removeEntity(_0x549f07,_0x3c5583){return function(_0x3c6cfa){if(_0x3c6cfa){return _0x3c6cfa[_0x6326('0x1f')]()[_0x6326('0x20')](function(){var _0x43cdfc=_0x3c6cfa[_0x6326('0x21')]({'plain':!![]});var _0x225555=_0x6326('0x22');return db[_0x6326('0x23')][_0x6326('0x1f')]({'where':{'type':_0x225555,'resourceId':_0x43cdfc['id']}})[_0x6326('0x20')](function(){return _0x3c6cfa;});})['then'](function(){_0x549f07[_0x6326('0x24')](0xcc)[_0x6326('0x19')]();});}};}function handleEntityNotFound(_0x575701,_0x4e272b){return function(_0x4d28fd){if(!_0x4d28fd){_0x575701[_0x6326('0x25')](0x194);}return _0x4d28fd;};}function handleError(_0x4dae28,_0x33c466){_0x33c466=_0x33c466||0x1f4;return function(_0x1a48da){logger['error'](_0x1a48da[_0x6326('0x26')]);if(_0x1a48da[_0x6326('0x27')]){delete _0x1a48da[_0x6326('0x27')];}_0x4dae28[_0x6326('0x24')](_0x33c466)[_0x6326('0x28')](_0x1a48da);};}exports[_0x6326('0x29')]=function(_0x40e036,_0x27802c){var _0x461e0f={},_0x127744={},_0x4980f6={'count':0x0,'rows':[]};var _0x2a8873=db[_0x6326('0x2a')][_0x6326('0x2b')];_0x127744[_0x6326('0x2c')]=_[_0x6326('0x2d')](_0x2a8873);_0x127744['query']=_[_0x6326('0x2d')](_0x40e036[_0x6326('0x2e')]);_0x127744[_0x6326('0x2f')]=_['intersection'](_0x127744[_0x6326('0x2c')],_0x127744['query']);_0x461e0f['attributes']=_[_0x6326('0x30')](_0x127744[_0x6326('0x2c')],qs[_0x6326('0x31')](_0x40e036[_0x6326('0x2e')][_0x6326('0x31')]));_0x461e0f[_0x6326('0x32')]=_0x461e0f[_0x6326('0x32')][_0x6326('0x33')]?_0x461e0f[_0x6326('0x32')]:_0x127744[_0x6326('0x2c')];if(!_0x40e036[_0x6326('0x2e')][_0x6326('0x34')]('nolimit')){_0x461e0f[_0x6326('0x35')]=qs[_0x6326('0x35')](_0x40e036['query'][_0x6326('0x35')]);_0x461e0f[_0x6326('0x36')]=qs[_0x6326('0x36')](_0x40e036['query'][_0x6326('0x36')]);}_0x461e0f['order']=qs['sort'](_0x40e036[_0x6326('0x2e')][_0x6326('0x37')]);_0x461e0f[_0x6326('0x38')]=qs['filters'](_[_0x6326('0x39')](_0x40e036['query'],_0x127744[_0x6326('0x2f')]));if(_0x40e036['query'][_0x6326('0x3a')]){_0x461e0f[_0x6326('0x38')]=_[_0x6326('0x3b')](_0x461e0f[_0x6326('0x38')],{'$or':_[_0x6326('0x3c')](_0x2a8873,function(_0x207fb1){if(_0x207fb1['type'][_0x6326('0x3d')]!==_0x6326('0x3e')){var _0x489f05={};_0x489f05[_0x207fb1[_0x6326('0x3f')]]={'$like':'%'+_0x40e036['query']['filter']+'%'};return _0x489f05;}})});}_0x461e0f=_[_0x6326('0x3b')]({},_0x461e0f,_0x40e036[_0x6326('0x40')]);var _0x3c170b={'where':_0x461e0f[_0x6326('0x38')]};return db[_0x6326('0x2a')][_0x6326('0x41')](_0x3c170b)['then'](function(_0x485bed){_0x4980f6[_0x6326('0x41')]=_0x485bed;if(_0x40e036['query'][_0x6326('0x42')]){_0x461e0f['include']=[{'all':!![]}];}return db[_0x6326('0x2a')][_0x6326('0x43')](_0x461e0f);})[_0x6326('0x20')](function(_0x1da798){_0x4980f6[_0x6326('0x44')]=_0x1da798;return _0x4980f6;})[_0x6326('0x20')](respondWithFilteredResult(_0x27802c,_0x461e0f))[_0x6326('0x45')](handleError(_0x27802c,null));};exports[_0x6326('0x46')]=function(_0x3b089b,_0x3998ba){var _0x301f9d={'raw':!![],'where':{'id':_0x3b089b[_0x6326('0x47')]['id']}},_0x5d36b1={};_0x5d36b1['model']=_[_0x6326('0x2d')](db[_0x6326('0x2a')][_0x6326('0x2b')]);_0x5d36b1[_0x6326('0x2e')]=_['keys'](_0x3b089b[_0x6326('0x2e')]);_0x5d36b1[_0x6326('0x2f')]=_['intersection'](_0x5d36b1[_0x6326('0x2c')],_0x5d36b1[_0x6326('0x2e')]);_0x301f9d[_0x6326('0x32')]=_[_0x6326('0x30')](_0x5d36b1['model'],qs[_0x6326('0x31')](_0x3b089b[_0x6326('0x2e')][_0x6326('0x31')]));_0x301f9d[_0x6326('0x32')]=_0x301f9d[_0x6326('0x32')][_0x6326('0x33')]?_0x301f9d[_0x6326('0x32')]:_0x5d36b1['model'];if(_0x3b089b[_0x6326('0x2e')][_0x6326('0x42')]){_0x301f9d[_0x6326('0x48')]=[{'all':!![]}];}_0x301f9d=_[_0x6326('0x3b')]({},_0x301f9d,_0x3b089b['options']);return db[_0x6326('0x2a')]['find'](_0x301f9d)[_0x6326('0x20')](handleEntityNotFound(_0x3998ba,null))[_0x6326('0x20')](respondWithResult(_0x3998ba,null))[_0x6326('0x45')](handleError(_0x3998ba,null));};exports[_0x6326('0x49')]=function(_0x183690,_0x5dc727){return db[_0x6326('0x2a')]['create'](_0x183690['body'],{})[_0x6326('0x20')](function(_0x44cf9d){var _0x5b14f4=_0x183690[_0x6326('0x4a')][_0x6326('0x21')]({'plain':!![]});if(!_0x5b14f4)throw new Error(_0x6326('0x4b'));if(_0x5b14f4[_0x6326('0x4c')]===_0x6326('0x4a')){var _0x4f8dc0=_0x44cf9d['get']({'plain':!![]});var _0x2d82c0=_0x6326('0x22');return db[_0x6326('0x4d')][_0x6326('0x4e')]({'where':{'name':_0x2d82c0,'userProfileId':_0x5b14f4[_0x6326('0x4f')]},'raw':!![]})[_0x6326('0x20')](function(_0xdc4522){if(_0xdc4522&&_0xdc4522['autoAssociation']===0x0){return db[_0x6326('0x23')][_0x6326('0x49')]({'name':_0x4f8dc0[_0x6326('0x27')],'resourceId':_0x4f8dc0['id'],'type':_0xdc4522[_0x6326('0x27')],'sectionId':_0xdc4522['id']},{})[_0x6326('0x20')](function(){return _0x44cf9d;});}else{return _0x44cf9d;}})['catch'](function(_0x189bef){logger['error'](_0x6326('0x50'),_0x189bef);throw _0x189bef;});}return _0x44cf9d;})[_0x6326('0x20')](respondWithResult(_0x5dc727,0xc9))['catch'](handleError(_0x5dc727,null));};exports[_0x6326('0x1e')]=function(_0x5040b1,_0xaa4c9d){if(_0x5040b1[_0x6326('0x51')]['id']){delete _0x5040b1[_0x6326('0x51')]['id'];}return db[_0x6326('0x2a')]['find']({'where':{'id':_0x5040b1[_0x6326('0x47')]['id']}})[_0x6326('0x20')](handleEntityNotFound(_0xaa4c9d,null))['then'](saveUpdates(_0x5040b1[_0x6326('0x51')],null))[_0x6326('0x20')](respondWithResult(_0xaa4c9d,null))[_0x6326('0x45')](handleError(_0xaa4c9d,null));};exports['destroy']=function(_0x2bece1,_0x2ac64b){return db['Tag'][_0x6326('0x4e')]({'where':{'id':_0x2bece1['params']['id']}})[_0x6326('0x20')](handleEntityNotFound(_0x2ac64b,null))[_0x6326('0x20')](removeEntity(_0x2ac64b,null))[_0x6326('0x45')](handleError(_0x2ac64b,null));}; \ No newline at end of file +var _0x32b6=['to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','save','destroy','get','Tags','UserProfileResource','then','error','stack','name','send','index','Tag','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','map','type','key','VIRTUAL','field','merge','options','count','show','params','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x32b6,0x1d1));var _0x632b=function(_0x582895,_0xd7f356){_0x582895=_0x582895-0x0;var _0x24b596=_0x32b6[_0x582895];return _0x24b596;};'use strict';var pdf=require(_0x632b('0x0'));var emlformat=require(_0x632b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x632b('0x2'));var jsonpatch=require(_0x632b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x632b('0x4'));var Mustache=require(_0x632b('0x5'));var util=require(_0x632b('0x6'));var path=require(_0x632b('0x7'));var sox=require(_0x632b('0x8'));var csv=require(_0x632b('0x9'));var ejs=require(_0x632b('0xa'));var fs=require('fs');var _=require(_0x632b('0xb'));var squel=require(_0x632b('0xc'));var crypto=require(_0x632b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x632b('0xe'));var toCsv=require(_0x632b('0x9'));var querystring=require(_0x632b('0xf'));var Papa=require(_0x632b('0x10'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0x632b('0x11'));var logger=require('../../config/logger')(_0x632b('0x12'));var utils=require(_0x632b('0x13'));var config=require(_0x632b('0x14'));var db=require(_0x632b('0x15'))['db'];function respondWithStatusCode(_0x249417,_0x2e1dbc){_0x2e1dbc=_0x2e1dbc||0xcc;return function(_0xe81378){if(_0xe81378){return _0x249417[_0x632b('0x16')](_0x2e1dbc);}return _0x249417[_0x632b('0x17')](_0x2e1dbc)['end']();};}function respondWithResult(_0xb5416c,_0x286f75){_0x286f75=_0x286f75||0xc8;return function(_0x9246a6){if(_0x9246a6){return _0xb5416c['status'](_0x286f75)[_0x632b('0x18')](_0x9246a6);}};}function respondWithFilteredResult(_0x1a3a60,_0x108249){return function(_0x17ff9b){if(_0x17ff9b){var _0x40d410=_0x17ff9b['count'],_0x21cdd3=_0x108249['offset'],_0x4efe39=_0x108249[_0x632b('0x19')]+_0x108249['limit'],_0x17ddc5;if(_0x4efe39>=_0x40d410){_0x4efe39=_0x40d410;_0x17ddc5=0xc8;}else{_0x17ddc5=0xce;}_0x1a3a60[_0x632b('0x17')](_0x17ddc5);return _0x1a3a60[_0x632b('0x1a')](_0x632b('0x1b'),_0x21cdd3+'-'+_0x4efe39+'/'+_0x40d410)['json'](_0x17ff9b);}return null;};}function patchUpdates(_0x2f3e88){return function(_0x32ca1){try{jsonpatch[_0x632b('0x1c')](_0x32ca1,_0x2f3e88,!![]);}catch(_0x3683e4){return BPromise['reject'](_0x3683e4);}return _0x32ca1[_0x632b('0x1d')]();};}function saveUpdates(_0xd9d29f,_0x4f377f){return function(_0x116f62){if(_0x116f62){return _0x116f62['update'](_0xd9d29f)['then'](function(_0x1b1092){return _0x1b1092;});}return null;};}function removeEntity(_0x5ce3fa,_0xc9d237){return function(_0x1c4530){if(_0x1c4530){return _0x1c4530[_0x632b('0x1e')]()['then'](function(){var _0x10fc32=_0x1c4530[_0x632b('0x1f')]({'plain':!![]});var _0x59d83a=_0x632b('0x20');return db[_0x632b('0x21')][_0x632b('0x1e')]({'where':{'type':_0x59d83a,'resourceId':_0x10fc32['id']}})[_0x632b('0x22')](function(){return _0x1c4530;});})[_0x632b('0x22')](function(){_0x5ce3fa[_0x632b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e7b20,_0x11fe61){return function(_0x4d3a70){if(!_0x4d3a70){_0x5e7b20[_0x632b('0x16')](0x194);}return _0x4d3a70;};}function handleError(_0x954fa0,_0x5d6855){_0x5d6855=_0x5d6855||0x1f4;return function(_0x273e89){logger[_0x632b('0x23')](_0x273e89[_0x632b('0x24')]);if(_0x273e89[_0x632b('0x25')]){delete _0x273e89[_0x632b('0x25')];}_0x954fa0[_0x632b('0x17')](_0x5d6855)[_0x632b('0x26')](_0x273e89);};}exports[_0x632b('0x27')]=function(_0x33a625,_0x4f8410){var _0x1bb484={},_0x35348e={},_0x1819fa={'count':0x0,'rows':[]};var _0x3999aa=db[_0x632b('0x28')][_0x632b('0x29')];_0x35348e[_0x632b('0x2a')]=_[_0x632b('0x2b')](_0x3999aa);_0x35348e[_0x632b('0x2c')]=_[_0x632b('0x2b')](_0x33a625[_0x632b('0x2c')]);_0x35348e[_0x632b('0x2d')]=_[_0x632b('0x2e')](_0x35348e[_0x632b('0x2a')],_0x35348e[_0x632b('0x2c')]);_0x1bb484[_0x632b('0x2f')]=_[_0x632b('0x2e')](_0x35348e[_0x632b('0x2a')],qs[_0x632b('0x30')](_0x33a625[_0x632b('0x2c')]['fields']));_0x1bb484[_0x632b('0x2f')]=_0x1bb484[_0x632b('0x2f')][_0x632b('0x31')]?_0x1bb484[_0x632b('0x2f')]:_0x35348e['model'];if(!_0x33a625[_0x632b('0x2c')]['hasOwnProperty'](_0x632b('0x32'))){_0x1bb484[_0x632b('0x33')]=qs['limit'](_0x33a625[_0x632b('0x2c')][_0x632b('0x33')]);_0x1bb484[_0x632b('0x19')]=qs[_0x632b('0x19')](_0x33a625[_0x632b('0x2c')][_0x632b('0x19')]);}_0x1bb484[_0x632b('0x34')]=qs[_0x632b('0x35')](_0x33a625['query']['sort']);_0x1bb484[_0x632b('0x36')]=qs[_0x632b('0x2d')](_[_0x632b('0x37')](_0x33a625[_0x632b('0x2c')],_0x35348e[_0x632b('0x2d')]));if(_0x33a625[_0x632b('0x2c')][_0x632b('0x38')]){_0x1bb484[_0x632b('0x36')]=_['merge'](_0x1bb484['where'],{'$or':_[_0x632b('0x39')](_0x3999aa,function(_0x581b92){if(_0x581b92[_0x632b('0x3a')][_0x632b('0x3b')]!==_0x632b('0x3c')){var _0x3c66a8={};_0x3c66a8[_0x581b92[_0x632b('0x3d')]]={'$like':'%'+_0x33a625[_0x632b('0x2c')][_0x632b('0x38')]+'%'};return _0x3c66a8;}})});}_0x1bb484=_[_0x632b('0x3e')]({},_0x1bb484,_0x33a625[_0x632b('0x3f')]);var _0x3eb3e0={'where':_0x1bb484[_0x632b('0x36')]};return db[_0x632b('0x28')][_0x632b('0x40')](_0x3eb3e0)[_0x632b('0x22')](function(_0x13beaa){_0x1819fa[_0x632b('0x40')]=_0x13beaa;if(_0x33a625[_0x632b('0x2c')]['includeAll']){_0x1bb484['include']=[{'all':!![]}];}return db['Tag']['findAll'](_0x1bb484);})['then'](function(_0x361cf6){_0x1819fa['rows']=_0x361cf6;return _0x1819fa;})['then'](respondWithFilteredResult(_0x4f8410,_0x1bb484))['catch'](handleError(_0x4f8410,null));};exports[_0x632b('0x41')]=function(_0x4490d4,_0x417a30){var _0x223457={'raw':!![],'where':{'id':_0x4490d4[_0x632b('0x42')]['id']}},_0x5a1017={};_0x5a1017[_0x632b('0x2a')]=_[_0x632b('0x2b')](db['Tag'][_0x632b('0x29')]);_0x5a1017[_0x632b('0x2c')]=_[_0x632b('0x2b')](_0x4490d4[_0x632b('0x2c')]);_0x5a1017[_0x632b('0x2d')]=_[_0x632b('0x2e')](_0x5a1017['model'],_0x5a1017[_0x632b('0x2c')]);_0x223457[_0x632b('0x2f')]=_[_0x632b('0x2e')](_0x5a1017[_0x632b('0x2a')],qs['fields'](_0x4490d4['query'][_0x632b('0x30')]));_0x223457[_0x632b('0x2f')]=_0x223457[_0x632b('0x2f')][_0x632b('0x31')]?_0x223457[_0x632b('0x2f')]:_0x5a1017[_0x632b('0x2a')];if(_0x4490d4['query'][_0x632b('0x43')]){_0x223457[_0x632b('0x44')]=[{'all':!![]}];}_0x223457=_[_0x632b('0x3e')]({},_0x223457,_0x4490d4[_0x632b('0x3f')]);return db[_0x632b('0x28')][_0x632b('0x45')](_0x223457)[_0x632b('0x22')](handleEntityNotFound(_0x417a30,null))[_0x632b('0x22')](respondWithResult(_0x417a30,null))['catch'](handleError(_0x417a30,null));};exports[_0x632b('0x46')]=function(_0x56f254,_0x2a1f09){return db['Tag'][_0x632b('0x46')](_0x56f254[_0x632b('0x47')],{})[_0x632b('0x22')](function(_0x2c4561){var _0x3924db=_0x56f254['user'][_0x632b('0x1f')]({'plain':!![]});if(!_0x3924db)throw new Error(_0x632b('0x48'));if(_0x3924db[_0x632b('0x49')]==='user'){var _0x253aec=_0x2c4561[_0x632b('0x1f')]({'plain':!![]});var _0x26b7f4=_0x632b('0x20');return db[_0x632b('0x4a')]['find']({'where':{'name':_0x26b7f4,'userProfileId':_0x3924db[_0x632b('0x4b')]},'raw':!![]})['then'](function(_0x33da2b){if(_0x33da2b&&_0x33da2b[_0x632b('0x4c')]===0x0){return db[_0x632b('0x21')][_0x632b('0x46')]({'name':_0x253aec[_0x632b('0x25')],'resourceId':_0x253aec['id'],'type':_0x33da2b['name'],'sectionId':_0x33da2b['id']},{})['then'](function(){return _0x2c4561;});}else{return _0x2c4561;}})[_0x632b('0x4d')](function(_0x12e1e2){logger[_0x632b('0x23')](_0x632b('0x4e'),_0x12e1e2);throw _0x12e1e2;});}return _0x2c4561;})[_0x632b('0x22')](respondWithResult(_0x2a1f09,0xc9))[_0x632b('0x4d')](handleError(_0x2a1f09,null));};exports['update']=function(_0xda006b,_0x1d35b2){if(_0xda006b[_0x632b('0x47')]['id']){delete _0xda006b['body']['id'];}return db[_0x632b('0x28')][_0x632b('0x45')]({'where':{'id':_0xda006b[_0x632b('0x42')]['id']}})[_0x632b('0x22')](handleEntityNotFound(_0x1d35b2,null))['then'](saveUpdates(_0xda006b[_0x632b('0x47')],null))[_0x632b('0x22')](respondWithResult(_0x1d35b2,null))[_0x632b('0x4d')](handleError(_0x1d35b2,null));};exports[_0x632b('0x1e')]=function(_0x279228,_0x4df503){return db[_0x632b('0x28')][_0x632b('0x45')]({'where':{'id':_0x279228[_0x632b('0x42')]['id']}})[_0x632b('0x22')](handleEntityNotFound(_0x4df503,null))[_0x632b('0x22')](removeEntity(_0x4df503,null))['catch'](handleError(_0x4df503,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 8097af1..dfbb3e6 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 _0xf09b=['define','Tag','tools_tags','../../config/logger','api','bluebird','request-promise','./tag.attributes','exports'];(function(_0x2b829d,_0x1493a5){var _0x57c5dc=function(_0x450b68){while(--_0x450b68){_0x2b829d['push'](_0x2b829d['shift']());}};_0x57c5dc(++_0x1493a5);}(_0xf09b,0xae));var _0xbf09=function(_0x488b2d,_0x34570a){_0x488b2d=_0x488b2d-0x0;var _0x4e3a9f=_0xf09b[_0x488b2d];return _0x4e3a9f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbf09('0x0'))(_0xbf09('0x1'));var moment=require('moment');var BPromise=require(_0xbf09('0x2'));var rp=require(_0xbf09('0x3'));var attributes=require(_0xbf09('0x4'));module[_0xbf09('0x5')]=function(_0x5c1f00,_0x455ab3){return _0x5c1f00[_0xbf09('0x6')](_0xbf09('0x7'),attributes,{'tableName':_0xbf09('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf52c=['tools_tags','util','../../config/logger','api','moment','./tag.attributes','define','Tag'];(function(_0x2438b6,_0x842fd7){var _0x30bc8d=function(_0x522ac5){while(--_0x522ac5){_0x2438b6['push'](_0x2438b6['shift']());}};_0x30bc8d(++_0x842fd7);}(_0xf52c,0xb1));var _0xcf52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf52c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xcf52('0x0'));var logger=require(_0xcf52('0x1'))(_0xcf52('0x2'));var moment=require(_0xcf52('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xcf52('0x4'));module['exports']=function(_0x529219,_0xb39eec){return _0x529219[_0xcf52('0x5')](_0xcf52('0x6'),attributes,{'tableName':_0xcf52('0x7'),'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 1a754f2..076a2ab 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 _0x1d02=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','Tag,\x20%s,\x20%s','Tag,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3ed9ba,_0x165047){var _0x16aba7=function(_0x5c9e79){while(--_0x5c9e79){_0x3ed9ba['push'](_0x3ed9ba['shift']());}};_0x16aba7(++_0x165047);}(_0x1d02,0x85));var _0x21d0=function(_0x536983,_0xbab905){_0x536983=_0x536983-0x0;var _0x12adf0=_0x1d02[_0x536983];return _0x12adf0;};'use strict';var _=require(_0x21d0('0x0'));var util=require(_0x21d0('0x1'));var moment=require(_0x21d0('0x2'));var BPromise=require(_0x21d0('0x3'));var rs=require(_0x21d0('0x4'));var fs=require('fs');var Redis=require(_0x21d0('0x5'));var db=require(_0x21d0('0x6'))['db'];var utils=require(_0x21d0('0x7'));var logger=require('../../config/logger')(_0x21d0('0x8'));var config=require(_0x21d0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x21d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c3863,_0x4e9bb8,_0x47a238){return new BPromise(function(_0x3e3a8d,_0x316507){return client[_0x21d0('0xb')](_0x3c3863,_0x47a238)[_0x21d0('0xc')](function(_0x13e739){logger[_0x21d0('0xd')](_0x21d0('0xe'),_0x4e9bb8,'request\x20sent');logger['debug'](_0x21d0('0xf'),_0x4e9bb8,'request\x20sent',JSON[_0x21d0('0x10')](_0x13e739));if(_0x13e739['error']){if(_0x13e739['error'][_0x21d0('0x11')]===0x1f4){logger[_0x21d0('0x12')](_0x21d0('0xe'),_0x4e9bb8,_0x13e739[_0x21d0('0x12')][_0x21d0('0x13')]);return _0x316507(_0x13e739[_0x21d0('0x12')]['message']);}logger['error'](_0x21d0('0xe'),_0x4e9bb8,_0x13e739[_0x21d0('0x12')]['message']);return _0x3e3a8d(_0x13e739[_0x21d0('0x12')][_0x21d0('0x13')]);}else{logger[_0x21d0('0xd')](_0x21d0('0xe'),_0x4e9bb8,_0x21d0('0x14'));_0x3e3a8d(_0x13e739[_0x21d0('0x15')][_0x21d0('0x13')]);}})[_0x21d0('0x16')](function(_0x2c8fd4){logger[_0x21d0('0x12')](_0x21d0('0xe'),_0x4e9bb8,_0x2c8fd4);_0x316507(_0x2c8fd4);});});} \ No newline at end of file +var _0x3e22=['randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','bluebird'];(function(_0x1685f3,_0x1d9664){var _0x1ace0b=function(_0x195968){while(--_0x195968){_0x1685f3['push'](_0x1685f3['shift']());}};_0x1ace0b(++_0x1d9664);}(_0x3e22,0x1ca));var _0x23e2=function(_0x23f7aa,_0xddb5ef){_0x23f7aa=_0x23f7aa-0x0;var _0x37441b=_0x3e22[_0x23f7aa];return _0x37441b;};'use strict';var _=require(_0x23e2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x23e2('0x1'));var rs=require(_0x23e2('0x2'));var fs=require('fs');var Redis=require(_0x23e2('0x3'));var db=require(_0x23e2('0x4'))['db'];var utils=require(_0x23e2('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x23e2('0x6'));var client=jayson[_0x23e2('0x7')][_0x23e2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f99b6,_0x55660f,_0x2ad8f6){return new BPromise(function(_0x398fea,_0x12b5ac){return client[_0x23e2('0x9')](_0x2f99b6,_0x2ad8f6)['then'](function(_0x24147f){logger['info'](_0x23e2('0xa'),_0x55660f,_0x23e2('0xb'));logger[_0x23e2('0xc')]('Tag,\x20%s,\x20%s,\x20%s',_0x55660f,_0x23e2('0xb'),JSON[_0x23e2('0xd')](_0x24147f));if(_0x24147f[_0x23e2('0xe')]){if(_0x24147f[_0x23e2('0xe')][_0x23e2('0xf')]===0x1f4){logger[_0x23e2('0xe')](_0x23e2('0xa'),_0x55660f,_0x24147f[_0x23e2('0xe')][_0x23e2('0x10')]);return _0x12b5ac(_0x24147f[_0x23e2('0xe')][_0x23e2('0x10')]);}logger[_0x23e2('0xe')](_0x23e2('0xa'),_0x55660f,_0x24147f[_0x23e2('0xe')][_0x23e2('0x10')]);return _0x398fea(_0x24147f[_0x23e2('0xe')][_0x23e2('0x10')]);}else{logger[_0x23e2('0x11')](_0x23e2('0xa'),_0x55660f,_0x23e2('0xb'));_0x398fea(_0x24147f[_0x23e2('0x12')][_0x23e2('0x10')]);}})[_0x23e2('0x13')](function(_0x3637ad){logger[_0x23e2('0xe')](_0x23e2('0xa'),_0x55660f,_0x3637ad);_0x12b5ac(_0x3637ad);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index f832550..b0b0f6a 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 _0xc6b7=['put','/:id','update','delete','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','show','/:id/queues','getQueues','get','getAgents','post','create','addQueues','/:id/users'];(function(_0x3d8fd3,_0x4450c4){var _0x286ea0=function(_0x23affe){while(--_0x23affe){_0x3d8fd3['push'](_0x3d8fd3['shift']());}};_0x286ea0(++_0x4450c4);}(_0xc6b7,0x19e));var _0x7c6b=function(_0x3c1708,_0x19aa49){_0x3c1708=_0x3c1708-0x0;var _0x464118=_0xc6b7[_0x3c1708];return _0x464118;};'use strict';var multer=require(_0x7c6b('0x0'));var util=require(_0x7c6b('0x1'));var path=require(_0x7c6b('0x2'));var timeout=require(_0x7c6b('0x3'));var express=require(_0x7c6b('0x4'));var router=express['Router']();var auth=require(_0x7c6b('0x5'));var interaction=require(_0x7c6b('0x6'));var config=require('../../config/environment');var controller=require('./team.controller');router['get']('/',auth[_0x7c6b('0x7')](),controller[_0x7c6b('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7c6b('0x9')]);router['get'](_0x7c6b('0xa'),auth[_0x7c6b('0x7')](),controller[_0x7c6b('0xb')]);router[_0x7c6b('0xc')]('/:id/users',auth['isAuthenticated'](),controller[_0x7c6b('0xd')]);router[_0x7c6b('0xe')]('/',auth['isAuthenticated'](),controller[_0x7c6b('0xf')]);router[_0x7c6b('0xe')](_0x7c6b('0xa'),auth['isAuthenticated'](),controller[_0x7c6b('0x10')]);router[_0x7c6b('0xe')](_0x7c6b('0x11'),auth[_0x7c6b('0x7')](),controller['addAgents']);router[_0x7c6b('0x12')](_0x7c6b('0x13'),auth[_0x7c6b('0x7')](),controller[_0x7c6b('0x14')]);router[_0x7c6b('0x15')](_0x7c6b('0x13'),auth[_0x7c6b('0x7')](),controller['destroy']);router[_0x7c6b('0x15')](_0x7c6b('0xa'),auth[_0x7c6b('0x7')](),controller['removeQueues']);router[_0x7c6b('0x15')](_0x7c6b('0x11'),auth[_0x7c6b('0x7')](),controller[_0x7c6b('0x16')]);module[_0x7c6b('0x17')]=router; \ No newline at end of file +var _0x9276=['index','show','/:id/queues','getQueues','/:id/users','post','create','addQueues','addAgents','put','update','delete','destroy','removeQueues','removeAgents','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated'];(function(_0x9c3b1e,_0x16bdcd){var _0x169558=function(_0x304d9b){while(--_0x304d9b){_0x9c3b1e['push'](_0x9c3b1e['shift']());}};_0x169558(++_0x16bdcd);}(_0x9276,0xc6));var _0x6927=function(_0x4e7165,_0x2a780e){_0x4e7165=_0x4e7165-0x0;var _0x4ef4e1=_0x9276[_0x4e7165];return _0x4ef4e1;};'use strict';var multer=require(_0x6927('0x0'));var util=require(_0x6927('0x1'));var path=require(_0x6927('0x2'));var timeout=require('connect-timeout');var express=require(_0x6927('0x3'));var router=express[_0x6927('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6927('0x5'));var config=require(_0x6927('0x6'));var controller=require(_0x6927('0x7'));router[_0x6927('0x8')]('/',auth[_0x6927('0x9')](),controller[_0x6927('0xa')]);router[_0x6927('0x8')]('/:id',auth[_0x6927('0x9')](),controller[_0x6927('0xb')]);router[_0x6927('0x8')](_0x6927('0xc'),auth[_0x6927('0x9')](),controller[_0x6927('0xd')]);router[_0x6927('0x8')](_0x6927('0xe'),auth['isAuthenticated'](),controller['getAgents']);router[_0x6927('0xf')]('/',auth[_0x6927('0x9')](),controller[_0x6927('0x10')]);router[_0x6927('0xf')]('/:id/queues',auth[_0x6927('0x9')](),controller[_0x6927('0x11')]);router[_0x6927('0xf')]('/:id/users',auth['isAuthenticated'](),controller[_0x6927('0x12')]);router[_0x6927('0x13')]('/:id',auth[_0x6927('0x9')](),controller[_0x6927('0x14')]);router[_0x6927('0x15')]('/:id',auth[_0x6927('0x9')](),controller[_0x6927('0x16')]);router[_0x6927('0x15')](_0x6927('0xc'),auth[_0x6927('0x9')](),controller[_0x6927('0x17')]);router['delete'](_0x6927('0xe'),auth[_0x6927('0x9')](),controller[_0x6927('0x18')]);module[_0x6927('0x19')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index c47d342..d3ca488 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 _0x5249=['sequelize','exports','STRING'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x5249,0x108));var _0x9524=function(_0x351358,_0x2f47af){_0x351358=_0x351358-0x0;var _0x2463b5=_0x5249[_0x351358];return _0x2463b5;};'use strict';var Sequelize=require(_0x9524('0x0'));module[_0x9524('0x1')]={'name':{'type':Sequelize[_0x9524('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x9524('0x2')]}}; \ No newline at end of file +var _0x7f91=['STRING','name','sequelize','exports'];(function(_0xc63c37,_0x436fb3){var _0x4e4578=function(_0x295f16){while(--_0x295f16){_0xc63c37['push'](_0xc63c37['shift']());}};_0x4e4578(++_0x436fb3);}(_0x7f91,0xd6));var _0x17f9=function(_0xd5f8c9,_0xdf425b){_0xd5f8c9=_0xd5f8c9-0x0;var _0x5ae8f6=_0x7f91[_0xd5f8c9];return _0x5ae8f6;};'use strict';var Sequelize=require(_0x17f9('0x0'));module[_0x17f9('0x1')]={'name':{'type':Sequelize[_0x17f9('0x2')],'allowNull':![],'unique':_0x17f9('0x3')},'description':{'type':Sequelize[_0x17f9('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 5a50977..1ba186c 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 _0xa9e0=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','isValidChannel','channel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','pick','Queues','addQueues','findOne','add','ids','removeQueues','remove','voice','chat','mail','sms','fax','openchannel','each','addAgents','User','findAll','loginInPause','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','omit','spread','userTeam:save','removeAgents','isArray','emit','userTeam:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','error','stack','name','index','Team','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','map','type','key','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var authService=require(_0x0a9e('0xe'));var hardwareService=require(_0x0a9e('0xf'));var Redis=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0a9e('0x13')]=_[_0x0a9e('0x14')](config[_0x0a9e('0x13')],{'host':_0x0a9e('0x15'),'port':0x18eb});var socket=require(_0x0a9e('0x16'))(new Redis(config[_0x0a9e('0x13')]));require('./team.socket')[_0x0a9e('0x17')](socket);function respondWithStatusCode(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xcc;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x18')](_0x2b4227);}return _0x239b12[_0x0a9e('0x19')](_0x2b4227)['end']();};}function respondWithResult(_0x22dccb,_0x5d0880){_0x5d0880=_0x5d0880||0xc8;return function(_0x1985b6){if(_0x1985b6){return _0x22dccb['status'](_0x5d0880)[_0x0a9e('0x1a')](_0x1985b6);}};}function respondWithFilteredResult(_0x12066b,_0x48f32d){return function(_0x225616){if(_0x225616){var _0x5a0a06=_0x225616[_0x0a9e('0x1b')],_0x459eb1=_0x48f32d[_0x0a9e('0x1c')],_0x478723=_0x48f32d[_0x0a9e('0x1c')]+_0x48f32d[_0x0a9e('0x1d')],_0x106033;if(_0x478723>=_0x5a0a06){_0x478723=_0x5a0a06;_0x106033=0xc8;}else{_0x106033=0xce;}_0x12066b[_0x0a9e('0x19')](_0x106033);return _0x12066b[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x459eb1+'-'+_0x478723+'/'+_0x5a0a06)[_0x0a9e('0x1a')](_0x225616);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x20')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x21')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x22')](_0x5a09ef)[_0x0a9e('0x23')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){var _0x370d86=_0x2fb0e4[_0x0a9e('0x25')]({'plain':!![]});var _0x16b1ca='Teams';return db['UserProfileResource'][_0x0a9e('0x24')]({'where':{'type':_0x16b1ca,'resourceId':_0x370d86['id']}})[_0x0a9e('0x23')](function(){return _0x2fb0e4;});})[_0x0a9e('0x23')](function(){_0x4abc77[_0x0a9e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x26')](_0x25fba9[_0x0a9e('0x27')]);if(_0x25fba9[_0x0a9e('0x28')]){delete _0x25fba9[_0x0a9e('0x28')];}_0x1dc186[_0x0a9e('0x19')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x29')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};var _0x40e7a3=db[_0x0a9e('0x2a')][_0x0a9e('0x2b')];_0x5c877d[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x40e7a3);_0x5c877d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x468813[_0x0a9e('0x2e')]);_0x5c877d['filters']=_[_0x0a9e('0x2f')](_0x5c877d['model'],_0x5c877d[_0x0a9e('0x2e')]);_0x2ec755[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5c877d[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x468813['query'][_0x0a9e('0x31')]));_0x2ec755[_0x0a9e('0x30')]=_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x2ec755[_0x0a9e('0x30')]:_0x5c877d[_0x0a9e('0x2c')];if(!_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x2ec755[_0x0a9e('0x1d')]=qs['limit'](_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x2ec755[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x468813['query'][_0x0a9e('0x1c')]);}_0x2ec755[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x468813[_0x0a9e('0x2e')]['sort']);_0x2ec755['where']=qs[_0x0a9e('0x36')](_['pick'](_0x468813[_0x0a9e('0x2e')],_0x5c877d[_0x0a9e('0x36')]));if(_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]){_0x2ec755['where']=_[_0x0a9e('0x38')](_0x2ec755[_0x0a9e('0x39')],{'$or':_[_0x0a9e('0x3a')](_0x40e7a3,function(_0x533942){if(_0x533942[_0x0a9e('0x3b')][_0x0a9e('0x3c')]!==_0x0a9e('0x3d')){var _0x4c1c0e={};_0x4c1c0e[_0x533942['field']]={'$like':'%'+_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x4c1c0e;}})});}_0x2ec755=_['merge']({},_0x2ec755,_0x468813[_0x0a9e('0x3e')]);var _0x419125={'where':_0x2ec755[_0x0a9e('0x39')]};return db[_0x0a9e('0x2a')]['count'](_0x419125)['then'](function(_0x15e37d){_0x15b200[_0x0a9e('0x1b')]=_0x15e37d;if(_0x468813['query'][_0x0a9e('0x3f')]){_0x2ec755[_0x0a9e('0x40')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')]['findAll'](_0x2ec755);})[_0x0a9e('0x23')](function(_0x2cfea9){_0x15b200[_0x0a9e('0x41')]=_0x2cfea9;return _0x15b200;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x2b1f27,_0x2ec755))[_0x0a9e('0x42')](handleError(_0x2b1f27,null));};exports[_0x0a9e('0x43')]=function(_0x2881b3,_0x45a9b8){var _0x23b089={'raw':![],'where':{'id':_0x2881b3[_0x0a9e('0x44')]['id']}},_0x3da2cd={};_0x3da2cd[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x3da2cd['query']=_['keys'](_0x2881b3[_0x0a9e('0x2e')]);_0x3da2cd[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],_0x3da2cd[_0x0a9e('0x2e')]);_0x23b089[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x23b089[_0x0a9e('0x30')]=_0x23b089['attributes'][_0x0a9e('0x32')]?_0x23b089[_0x0a9e('0x30')]:_0x3da2cd[_0x0a9e('0x2c')];if(_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x3f')]){_0x23b089[_0x0a9e('0x40')]=[{'all':!![]}];}_0x23b089=_[_0x0a9e('0x38')]({},_0x23b089,_0x2881b3[_0x0a9e('0x3e')]);return db['Team'][_0x0a9e('0x45')](_0x23b089)['then'](handleEntityNotFound(_0x45a9b8,null))[_0x0a9e('0x23')](respondWithResult(_0x45a9b8,null))[_0x0a9e('0x42')](handleError(_0x45a9b8,null));};exports[_0x0a9e('0x46')]=function(_0x562fb4,_0x14bec2){return db[_0x0a9e('0x2a')][_0x0a9e('0x46')](_0x562fb4[_0x0a9e('0x47')],{})[_0x0a9e('0x23')](function(_0x37be73){var _0x45bf7f=_0x562fb4['user'][_0x0a9e('0x25')]({'plain':!![]});if(!_0x45bf7f)throw new Error(_0x0a9e('0x48'));if(_0x45bf7f[_0x0a9e('0x49')]===_0x0a9e('0x4a')){var _0x409789=_0x37be73[_0x0a9e('0x25')]({'plain':!![]});var _0x6054ee=_0x0a9e('0x4b');return db[_0x0a9e('0x4c')]['find']({'where':{'name':_0x6054ee,'userProfileId':_0x45bf7f[_0x0a9e('0x4d')]},'raw':!![]})[_0x0a9e('0x23')](function(_0x4f7240){if(_0x4f7240&&_0x4f7240['autoAssociation']===0x0){return db['UserProfileResource'][_0x0a9e('0x46')]({'name':_0x409789[_0x0a9e('0x28')],'resourceId':_0x409789['id'],'type':_0x4f7240[_0x0a9e('0x28')],'sectionId':_0x4f7240['id']},{})[_0x0a9e('0x23')](function(){return _0x37be73;});}else{return _0x37be73;}})[_0x0a9e('0x42')](function(_0x30decb){logger[_0x0a9e('0x26')](_0x0a9e('0x4e'),_0x30decb);throw _0x30decb;});}return _0x37be73;})['then'](respondWithResult(_0x14bec2,0xc9))['catch'](handleError(_0x14bec2,null));};exports['update']=function(_0x39d77d,_0x204173){if(_0x39d77d[_0x0a9e('0x47')]['id']){delete _0x39d77d['body']['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x39d77d['params']['id']}})['then'](handleEntityNotFound(_0x204173,null))[_0x0a9e('0x23')](saveUpdates(_0x39d77d['body'],null))[_0x0a9e('0x23')](respondWithResult(_0x204173,null))['catch'](handleError(_0x204173,null));};exports[_0x0a9e('0x24')]=function(_0x3c20b2,_0x439340){return db['Team'][_0x0a9e('0x45')]({'where':{'id':_0x3c20b2[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x439340,null))['then'](removeEntity(_0x439340,null))[_0x0a9e('0x42')](handleError(_0x439340,null));};exports[_0x0a9e('0x4f')]=function(_0x49c095,_0x145931,_0x5ce9ac){return db[_0x0a9e('0x2a')]['findOne']({'where':{'id':_0x49c095[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x145931,null))['then'](function(_0x5df0ad){if(!_0x49c095[_0x0a9e('0x2e')]['channel']||!utils[_0x0a9e('0x50')](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x51')])){throw new db[(_0x0a9e('0x52'))][(_0x0a9e('0x53'))](_0x0a9e('0x54'));}var _0xd10662={};var _0x28d814={};_0x28d814['model']=_[_0x0a9e('0x2d')](db[_[_0x0a9e('0x55')](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x51')][_0x0a9e('0x56')]())+_0x0a9e('0x57')]['rawAttributes']);_0x28d814[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x49c095['query']);_0x28d814[_0x0a9e('0x36')]=_['intersection'](_0x28d814[_0x0a9e('0x2c')],_0x28d814['query']);_0xd10662['attributes']=_['intersection'](_0x28d814[_0x0a9e('0x2c')],qs['fields'](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0xd10662[_0x0a9e('0x30')]=_0xd10662[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0xd10662[_0x0a9e('0x30')]:_0x28d814['model'];_0xd10662[_0x0a9e('0x1d')]=qs['limit'](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0xd10662[_0x0a9e('0x1c')]=qs['offset'](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x1c')]);_0xd10662[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x49c095['query'][_0x0a9e('0x35')]);_0xd10662[_0x0a9e('0x39')]=qs['filters'](_[_0x0a9e('0x58')](_0x49c095[_0x0a9e('0x2e')],_0x28d814[_0x0a9e('0x36')]));_0xd10662=_[_0x0a9e('0x38')]({},_0xd10662,_0x49c095[_0x0a9e('0x3e')]);return _0x5df0ad['get'+_[_0x0a9e('0x55')](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x51')]['toLowerCase']())+_0x0a9e('0x59')](_0xd10662);})['then'](respondWithResult(_0x145931,null))['catch'](handleError(_0x145931,null));};exports[_0x0a9e('0x5a')]=function(_0x4556c5,_0x9375fb,_0x19c995){return db[_0x0a9e('0x2a')][_0x0a9e('0x5b')]({'where':{'id':_0x4556c5[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](function(_0x2d7205){if(_0x2d7205){if(!_0x4556c5[_0x0a9e('0x47')][_0x0a9e('0x51')]||!utils[_0x0a9e('0x50')](_0x4556c5[_0x0a9e('0x47')][_0x0a9e('0x51')])){throw new db[(_0x0a9e('0x52'))][(_0x0a9e('0x53'))](_0x0a9e('0x54'));}return _0x2d7205[_0x0a9e('0x5c')+_['capitalize'](_0x4556c5[_0x0a9e('0x47')][_0x0a9e('0x51')][_0x0a9e('0x56')]())+'Queues'](_0x4556c5[_0x0a9e('0x47')][_0x0a9e('0x5d')]);}return null;})['then'](handleEntityNotFound(_0x9375fb,null))[_0x0a9e('0x23')](respondWithStatusCode(_0x9375fb,null))[_0x0a9e('0x42')](handleError(_0x9375fb,null));};exports[_0x0a9e('0x5e')]=function(_0x427946,_0x13b5c0,_0x4a43a8){return db['Team']['findOne']({'where':{'id':_0x427946[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](function(_0x1104ad){if(_0x1104ad){if(!_0x427946[_0x0a9e('0x2e')][_0x0a9e('0x51')]||!utils[_0x0a9e('0x50')](_0x427946[_0x0a9e('0x2e')][_0x0a9e('0x51')])){throw new db['Sequelize'][(_0x0a9e('0x53'))](_0x0a9e('0x54'));}return _0x1104ad[_0x0a9e('0x5f')+_['capitalize'](_0x427946[_0x0a9e('0x2e')]['channel'][_0x0a9e('0x56')]())+_0x0a9e('0x59')](_0x427946['query'][_0x0a9e('0x5d')]);}return null;})[_0x0a9e('0x23')](handleEntityNotFound(_0x13b5c0,null))[_0x0a9e('0x23')](respondWithStatusCode(_0x13b5c0,null))[_0x0a9e('0x42')](handleError(_0x13b5c0,null));};exports['addAgents']=function(_0x1d442c,_0x2e9552,_0x371533){return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x1d442c[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x2e9552,null))[_0x0a9e('0x23')](function(_0x361b21){if(_0x361b21){return BPromise['each']([_0x0a9e('0x60'),_0x0a9e('0x61'),_0x0a9e('0x62'),_0x0a9e('0x63'),_0x0a9e('0x64'),_0x0a9e('0x65')],function(_0x40fc56){return _0x361b21[_0x0a9e('0x25')+_[_0x0a9e('0x55')](_0x40fc56)+_0x0a9e('0x59')]({'attributes':['id',_0x0a9e('0x28')]})[_0x0a9e('0x23')](function(_0x25744a){return BPromise[_0x0a9e('0x66')](_0x25744a,function(_0x5b35db){return _0x5b35db[_0x0a9e('0x67')](_0x1d442c[_0x0a9e('0x47')][_0x0a9e('0x5d')])['then'](function(){if(_0x40fc56===_0x0a9e('0x60')){return db[_0x0a9e('0x68')][_0x0a9e('0x69')]({'where':{'id':_0x1d442c[_0x0a9e('0x47')]['ids']},'attributes':['id','name',_0x0a9e('0x6a'),_0x0a9e('0x6b'),'interface'],'raw':!![]});}})[_0x0a9e('0x23')](function(_0x53a6a1){if(_0x40fc56===_0x0a9e('0x60')){return BPromise[_0x0a9e('0x66')](_0x53a6a1,function(_0x5637a1){return db[_0x0a9e('0x6c')][_0x0a9e('0x6d')]({'membername':_0x5637a1[_0x0a9e('0x28')],'UserId':_0x5637a1['id'],'queue_name':_0x5b35db[_0x0a9e('0x28')],'VoiceQueueId':_0x5b35db['id'],'interface':_[_0x0a9e('0x6e')](_0x5637a1[_0x0a9e('0x6f')])?util[_0x0a9e('0x70')]('SIP/%s',_0x5637a1[_0x0a9e('0x28')]):_0x5637a1[_0x0a9e('0x6f')],'paused':_0x5637a1[_0x0a9e('0x6b')]||![],'penalty':0x0});});}});});})[_0x0a9e('0x23')](function(){return _0x361b21;});})['then'](function(){return _0x361b21;});}})[_0x0a9e('0x23')](function(_0xf0db1){if(_0xf0db1){return _0xf0db1['addAgents'](_0x1d442c[_0x0a9e('0x47')]['ids'],_[_0x0a9e('0x71')](_0x1d442c[_0x0a9e('0x47')],[_0x0a9e('0x5d'),'id'])||{})[_0x0a9e('0x72')](function(_0x5af453){for(var _0x51ccd7=0x0;_0x51ccd7<_0x1d442c[_0x0a9e('0x47')][_0x0a9e('0x5d')][_0x0a9e('0x32')];_0x51ccd7+=0x1){socket['emit'](_0x0a9e('0x73'),{'UserId':_0x1d442c[_0x0a9e('0x47')]['ids'][_0x51ccd7],'TeamId':_0x1d442c['params']['id']});}return _0x5af453;});}})[_0x0a9e('0x23')](respondWithResult(_0x2e9552,null))['catch'](handleError(_0x2e9552,null));};exports['removeAgents']=function(_0x4dc6b3,_0x81d748,_0xf3601c){var _0x9044fe;return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x4dc6b3[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x81d748,null))[_0x0a9e('0x23')](function(_0x5955f1){if(_0x5955f1){return BPromise[_0x0a9e('0x66')]([_0x0a9e('0x60'),_0x0a9e('0x61'),_0x0a9e('0x62'),'sms',_0x0a9e('0x64'),_0x0a9e('0x65')],function(_0x1d4877){return _0x5955f1['get'+_[_0x0a9e('0x55')](_0x1d4877)+_0x0a9e('0x59')]({'attributes':['id',_0x0a9e('0x28')]})[_0x0a9e('0x23')](function(_0x255e49){return BPromise[_0x0a9e('0x66')](_0x255e49,function(_0x32b9bd){return _0x32b9bd[_0x0a9e('0x74')](_0x4dc6b3['query'][_0x0a9e('0x5d')])[_0x0a9e('0x23')](function(){if(_0x1d4877==='voice'){return db[_0x0a9e('0x6c')][_0x0a9e('0x24')]({'where':{'VoiceQueueId':_0x32b9bd['id'],'UserId':_0x4dc6b3[_0x0a9e('0x2e')]['ids']}});}});});})[_0x0a9e('0x23')](function(){return _0x5955f1;});})['then'](function(){return _0x5955f1;});}})[_0x0a9e('0x23')](function(_0x2b5148){if(_0x2b5148){return _0x2b5148[_0x0a9e('0x74')](_0x4dc6b3[_0x0a9e('0x2e')][_0x0a9e('0x5d')])[_0x0a9e('0x23')](function(_0x16a039){if(_[_0x0a9e('0x75')](_0x4dc6b3['query'][_0x0a9e('0x5d')])){for(var _0x31d25a=0x0;_0x31d25a<_0x4dc6b3[_0x0a9e('0x2e')][_0x0a9e('0x5d')][_0x0a9e('0x32')];_0x31d25a+=0x1){socket[_0x0a9e('0x76')](_0x0a9e('0x77'),{'UserId':_0x4dc6b3[_0x0a9e('0x2e')][_0x0a9e('0x5d')][_0x31d25a],'TeamId':_0x4dc6b3[_0x0a9e('0x44')]['id']});}}else{socket[_0x0a9e('0x76')](_0x0a9e('0x77'),{'UserId':_0x4dc6b3[_0x0a9e('0x2e')]['ids'],'TeamId':_0x4dc6b3[_0x0a9e('0x44')]['id']});}});}})[_0x0a9e('0x23')](respondWithStatusCode(_0x81d748,null))[_0x0a9e('0x42')](handleError(_0x81d748,null));};exports[_0x0a9e('0x78')]=function(_0xb0599a,_0x5d9ddb,_0x3afc8c){var _0x1756c7={};var _0x5ce99d={};var _0x23b447;var _0x5e725e;return db[_0x0a9e('0x2a')][_0x0a9e('0x5b')]({'where':{'id':_0xb0599a[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x5d9ddb,null))['then'](function(_0x3ceba6){if(_0x3ceba6){_0x23b447=_0x3ceba6;_0x5ce99d['model']=_[_0x0a9e('0x2d')](db[_0x0a9e('0x68')]['rawAttributes']);_0x5ce99d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xb0599a[_0x0a9e('0x2e')]);_0x5ce99d['filters']=_['intersection'](_0x5ce99d[_0x0a9e('0x2c')],_0x5ce99d[_0x0a9e('0x2e')]);_0x1756c7[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5ce99d[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0xb0599a[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x1756c7[_0x0a9e('0x30')]=_0x1756c7['attributes'][_0x0a9e('0x32')]?_0x1756c7['attributes']:_0x5ce99d[_0x0a9e('0x2c')];_0x1756c7[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0xb0599a[_0x0a9e('0x2e')][_0x0a9e('0x35')]);_0x1756c7['where']=qs[_0x0a9e('0x36')](_[_0x0a9e('0x58')](_0xb0599a[_0x0a9e('0x2e')],_0x5ce99d[_0x0a9e('0x36')]));if(_0xb0599a[_0x0a9e('0x2e')]['filter']){_0x1756c7['where']=_[_0x0a9e('0x38')](_0x1756c7['where'],{'$or':_[_0x0a9e('0x3a')](_0x1756c7[_0x0a9e('0x30')],function(_0x4672e1){var _0x16313e={};_0x16313e[_0x4672e1]={'$like':'%'+_0xb0599a[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x16313e;})});}_0x1756c7=_['merge']({},_0x1756c7,_0xb0599a['options']);return _0x23b447[_0x0a9e('0x78')](_0x1756c7);}})['then'](function(_0x2469d1){if(_0x2469d1){_0x5e725e=_0x2469d1['length'];if(!_0xb0599a[_0x0a9e('0x2e')]['hasOwnProperty']('nolimit')){_0x1756c7[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0xb0599a['query'][_0x0a9e('0x1d')]);_0x1756c7[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0xb0599a[_0x0a9e('0x2e')][_0x0a9e('0x1c')]);}return _0x23b447['getAgents'](_0x1756c7);}})['then'](function(_0x16449b){if(_0x16449b){return _0x16449b?{'count':_0x5e725e,'rows':_0x16449b}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x5d9ddb,null))[_0x0a9e('0x42')](handleError(_0x5d9ddb,null));}; \ No newline at end of file +var _0xa9e0=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','isValidChannel','channel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','pick','Queues','addQueues','findOne','add','ids','removeQueues','remove','voice','chat','mail','sms','fax','openchannel','each','addAgents','User','findAll','loginInPause','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','omit','spread','userTeam:save','removeAgents','isArray','emit','userTeam:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','error','stack','name','index','Team','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','map','type','key','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var authService=require(_0x0a9e('0xe'));var hardwareService=require(_0x0a9e('0xf'));var Redis=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0a9e('0x13')]=_[_0x0a9e('0x14')](config[_0x0a9e('0x13')],{'host':_0x0a9e('0x15'),'port':0x18eb});var socket=require(_0x0a9e('0x16'))(new Redis(config[_0x0a9e('0x13')]));require('./team.socket')[_0x0a9e('0x17')](socket);function respondWithStatusCode(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xcc;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x18')](_0x2b4227);}return _0x239b12[_0x0a9e('0x19')](_0x2b4227)['end']();};}function respondWithResult(_0x22dccb,_0x5d0880){_0x5d0880=_0x5d0880||0xc8;return function(_0x1985b6){if(_0x1985b6){return _0x22dccb['status'](_0x5d0880)[_0x0a9e('0x1a')](_0x1985b6);}};}function respondWithFilteredResult(_0x12066b,_0x48f32d){return function(_0x225616){if(_0x225616){var _0x5a0a06=_0x225616[_0x0a9e('0x1b')],_0x459eb1=_0x48f32d[_0x0a9e('0x1c')],_0x478723=_0x48f32d[_0x0a9e('0x1c')]+_0x48f32d[_0x0a9e('0x1d')],_0x106033;if(_0x478723>=_0x5a0a06){_0x478723=_0x5a0a06;_0x106033=0xc8;}else{_0x106033=0xce;}_0x12066b[_0x0a9e('0x19')](_0x106033);return _0x12066b[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x459eb1+'-'+_0x478723+'/'+_0x5a0a06)[_0x0a9e('0x1a')](_0x225616);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x20')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x21')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x22')](_0x5a09ef)[_0x0a9e('0x23')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){var _0x370d86=_0x2fb0e4[_0x0a9e('0x25')]({'plain':!![]});var _0x16b1ca='Teams';return db['UserProfileResource'][_0x0a9e('0x24')]({'where':{'type':_0x16b1ca,'resourceId':_0x370d86['id']}})[_0x0a9e('0x23')](function(){return _0x2fb0e4;});})[_0x0a9e('0x23')](function(){_0x4abc77[_0x0a9e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x26')](_0x25fba9[_0x0a9e('0x27')]);if(_0x25fba9[_0x0a9e('0x28')]){delete _0x25fba9[_0x0a9e('0x28')];}_0x1dc186[_0x0a9e('0x19')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x29')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};var _0x40e7a3=db[_0x0a9e('0x2a')][_0x0a9e('0x2b')];_0x5c877d[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x40e7a3);_0x5c877d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x468813[_0x0a9e('0x2e')]);_0x5c877d['filters']=_[_0x0a9e('0x2f')](_0x5c877d['model'],_0x5c877d[_0x0a9e('0x2e')]);_0x2ec755[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5c877d[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x468813['query'][_0x0a9e('0x31')]));_0x2ec755[_0x0a9e('0x30')]=_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x2ec755[_0x0a9e('0x30')]:_0x5c877d[_0x0a9e('0x2c')];if(!_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x2ec755[_0x0a9e('0x1d')]=qs['limit'](_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x2ec755[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x468813['query'][_0x0a9e('0x1c')]);}_0x2ec755[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x468813[_0x0a9e('0x2e')]['sort']);_0x2ec755['where']=qs[_0x0a9e('0x36')](_['pick'](_0x468813[_0x0a9e('0x2e')],_0x5c877d[_0x0a9e('0x36')]));if(_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]){_0x2ec755['where']=_[_0x0a9e('0x38')](_0x2ec755[_0x0a9e('0x39')],{'$or':_[_0x0a9e('0x3a')](_0x40e7a3,function(_0x533942){if(_0x533942[_0x0a9e('0x3b')][_0x0a9e('0x3c')]!==_0x0a9e('0x3d')){var _0x4c1c0e={};_0x4c1c0e[_0x533942['field']]={'$like':'%'+_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x4c1c0e;}})});}_0x2ec755=_['merge']({},_0x2ec755,_0x468813[_0x0a9e('0x3e')]);var _0x419125={'where':_0x2ec755[_0x0a9e('0x39')]};return db[_0x0a9e('0x2a')]['count'](_0x419125)['then'](function(_0x15e37d){_0x15b200[_0x0a9e('0x1b')]=_0x15e37d;if(_0x468813['query'][_0x0a9e('0x3f')]){_0x2ec755[_0x0a9e('0x40')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')]['findAll'](_0x2ec755);})[_0x0a9e('0x23')](function(_0x2cfea9){_0x15b200[_0x0a9e('0x41')]=_0x2cfea9;return _0x15b200;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x2b1f27,_0x2ec755))[_0x0a9e('0x42')](handleError(_0x2b1f27,null));};exports[_0x0a9e('0x43')]=function(_0x2881b3,_0x45a9b8){var _0x23b089={'raw':![],'where':{'id':_0x2881b3[_0x0a9e('0x44')]['id']}},_0x3da2cd={};_0x3da2cd[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x3da2cd['query']=_['keys'](_0x2881b3[_0x0a9e('0x2e')]);_0x3da2cd[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],_0x3da2cd[_0x0a9e('0x2e')]);_0x23b089[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x23b089[_0x0a9e('0x30')]=_0x23b089['attributes'][_0x0a9e('0x32')]?_0x23b089[_0x0a9e('0x30')]:_0x3da2cd[_0x0a9e('0x2c')];if(_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x3f')]){_0x23b089[_0x0a9e('0x40')]=[{'all':!![]}];}_0x23b089=_[_0x0a9e('0x38')]({},_0x23b089,_0x2881b3[_0x0a9e('0x3e')]);return db['Team'][_0x0a9e('0x45')](_0x23b089)['then'](handleEntityNotFound(_0x45a9b8,null))[_0x0a9e('0x23')](respondWithResult(_0x45a9b8,null))[_0x0a9e('0x42')](handleError(_0x45a9b8,null));};exports[_0x0a9e('0x46')]=function(_0x562fb4,_0x14bec2){return db[_0x0a9e('0x2a')][_0x0a9e('0x46')](_0x562fb4[_0x0a9e('0x47')],{})[_0x0a9e('0x23')](function(_0x37be73){var _0x45bf7f=_0x562fb4['user'][_0x0a9e('0x25')]({'plain':!![]});if(!_0x45bf7f)throw new Error(_0x0a9e('0x48'));if(_0x45bf7f[_0x0a9e('0x49')]===_0x0a9e('0x4a')){var _0x409789=_0x37be73[_0x0a9e('0x25')]({'plain':!![]});var _0x6054ee=_0x0a9e('0x4b');return db[_0x0a9e('0x4c')]['find']({'where':{'name':_0x6054ee,'userProfileId':_0x45bf7f[_0x0a9e('0x4d')]},'raw':!![]})[_0x0a9e('0x23')](function(_0x4f7240){if(_0x4f7240&&_0x4f7240['autoAssociation']===0x0){return db['UserProfileResource'][_0x0a9e('0x46')]({'name':_0x409789[_0x0a9e('0x28')],'resourceId':_0x409789['id'],'type':_0x4f7240[_0x0a9e('0x28')],'sectionId':_0x4f7240['id']},{})[_0x0a9e('0x23')](function(){return _0x37be73;});}else{return _0x37be73;}})[_0x0a9e('0x42')](function(_0x30decb){logger[_0x0a9e('0x26')](_0x0a9e('0x4e'),_0x30decb);throw _0x30decb;});}return _0x37be73;})['then'](respondWithResult(_0x14bec2,0xc9))['catch'](handleError(_0x14bec2,null));};exports['update']=function(_0x39d77d,_0x204173){if(_0x39d77d[_0x0a9e('0x47')]['id']){delete _0x39d77d['body']['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x39d77d['params']['id']}})['then'](handleEntityNotFound(_0x204173,null))[_0x0a9e('0x23')](saveUpdates(_0x39d77d['body'],null))[_0x0a9e('0x23')](respondWithResult(_0x204173,null))['catch'](handleError(_0x204173,null));};exports[_0x0a9e('0x24')]=function(_0x3c20b2,_0x439340){return db['Team'][_0x0a9e('0x45')]({'where':{'id':_0x3c20b2[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x439340,null))['then'](removeEntity(_0x439340,null))[_0x0a9e('0x42')](handleError(_0x439340,null));};exports[_0x0a9e('0x4f')]=function(_0x49c095,_0x145931,_0x5ce9ac){return db[_0x0a9e('0x2a')]['findOne']({'where':{'id':_0x49c095[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x145931,null))['then'](function(_0x5df0ad){if(!_0x49c095[_0x0a9e('0x2e')]['channel']||!utils[_0x0a9e('0x50')](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x51')])){throw new db[(_0x0a9e('0x52'))][(_0x0a9e('0x53'))](_0x0a9e('0x54'));}var _0xd10662={};var _0x28d814={};_0x28d814['model']=_[_0x0a9e('0x2d')](db[_[_0x0a9e('0x55')](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x51')][_0x0a9e('0x56')]())+_0x0a9e('0x57')]['rawAttributes']);_0x28d814[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x49c095['query']);_0x28d814[_0x0a9e('0x36')]=_['intersection'](_0x28d814[_0x0a9e('0x2c')],_0x28d814['query']);_0xd10662['attributes']=_['intersection'](_0x28d814[_0x0a9e('0x2c')],qs['fields'](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0xd10662[_0x0a9e('0x30')]=_0xd10662[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0xd10662[_0x0a9e('0x30')]:_0x28d814['model'];_0xd10662[_0x0a9e('0x1d')]=qs['limit'](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0xd10662[_0x0a9e('0x1c')]=qs['offset'](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x1c')]);_0xd10662[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x49c095['query'][_0x0a9e('0x35')]);_0xd10662[_0x0a9e('0x39')]=qs['filters'](_[_0x0a9e('0x58')](_0x49c095[_0x0a9e('0x2e')],_0x28d814[_0x0a9e('0x36')]));_0xd10662=_[_0x0a9e('0x38')]({},_0xd10662,_0x49c095[_0x0a9e('0x3e')]);return _0x5df0ad['get'+_[_0x0a9e('0x55')](_0x49c095[_0x0a9e('0x2e')][_0x0a9e('0x51')]['toLowerCase']())+_0x0a9e('0x59')](_0xd10662);})['then'](respondWithResult(_0x145931,null))['catch'](handleError(_0x145931,null));};exports[_0x0a9e('0x5a')]=function(_0x4556c5,_0x9375fb,_0x19c995){return db[_0x0a9e('0x2a')][_0x0a9e('0x5b')]({'where':{'id':_0x4556c5[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](function(_0x2d7205){if(_0x2d7205){if(!_0x4556c5[_0x0a9e('0x47')][_0x0a9e('0x51')]||!utils[_0x0a9e('0x50')](_0x4556c5[_0x0a9e('0x47')][_0x0a9e('0x51')])){throw new db[(_0x0a9e('0x52'))][(_0x0a9e('0x53'))](_0x0a9e('0x54'));}return _0x2d7205[_0x0a9e('0x5c')+_['capitalize'](_0x4556c5[_0x0a9e('0x47')][_0x0a9e('0x51')][_0x0a9e('0x56')]())+'Queues'](_0x4556c5[_0x0a9e('0x47')][_0x0a9e('0x5d')]);}return null;})['then'](handleEntityNotFound(_0x9375fb,null))[_0x0a9e('0x23')](respondWithStatusCode(_0x9375fb,null))[_0x0a9e('0x42')](handleError(_0x9375fb,null));};exports[_0x0a9e('0x5e')]=function(_0x427946,_0x13b5c0,_0x4a43a8){return db['Team']['findOne']({'where':{'id':_0x427946[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](function(_0x1104ad){if(_0x1104ad){if(!_0x427946[_0x0a9e('0x2e')][_0x0a9e('0x51')]||!utils[_0x0a9e('0x50')](_0x427946[_0x0a9e('0x2e')][_0x0a9e('0x51')])){throw new db['Sequelize'][(_0x0a9e('0x53'))](_0x0a9e('0x54'));}return _0x1104ad[_0x0a9e('0x5f')+_['capitalize'](_0x427946[_0x0a9e('0x2e')]['channel'][_0x0a9e('0x56')]())+_0x0a9e('0x59')](_0x427946['query'][_0x0a9e('0x5d')]);}return null;})[_0x0a9e('0x23')](handleEntityNotFound(_0x13b5c0,null))[_0x0a9e('0x23')](respondWithStatusCode(_0x13b5c0,null))[_0x0a9e('0x42')](handleError(_0x13b5c0,null));};exports['addAgents']=function(_0x1d442c,_0x2e9552,_0x371533){return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x1d442c[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x2e9552,null))[_0x0a9e('0x23')](function(_0x361b21){if(_0x361b21){return BPromise['each']([_0x0a9e('0x60'),_0x0a9e('0x61'),_0x0a9e('0x62'),_0x0a9e('0x63'),_0x0a9e('0x64'),_0x0a9e('0x65')],function(_0x40fc56){return _0x361b21[_0x0a9e('0x25')+_[_0x0a9e('0x55')](_0x40fc56)+_0x0a9e('0x59')]({'attributes':['id',_0x0a9e('0x28')]})[_0x0a9e('0x23')](function(_0x25744a){return BPromise[_0x0a9e('0x66')](_0x25744a,function(_0x5b35db){return _0x5b35db[_0x0a9e('0x67')](_0x1d442c[_0x0a9e('0x47')][_0x0a9e('0x5d')])['then'](function(){if(_0x40fc56===_0x0a9e('0x60')){return db[_0x0a9e('0x68')][_0x0a9e('0x69')]({'where':{'id':_0x1d442c[_0x0a9e('0x47')]['ids']},'attributes':['id','name',_0x0a9e('0x6a'),_0x0a9e('0x6b'),'interface'],'raw':!![]});}})[_0x0a9e('0x23')](function(_0x53a6a1){if(_0x40fc56===_0x0a9e('0x60')){return BPromise[_0x0a9e('0x66')](_0x53a6a1,function(_0x5637a1){return db[_0x0a9e('0x6c')][_0x0a9e('0x6d')]({'membername':_0x5637a1[_0x0a9e('0x28')],'UserId':_0x5637a1['id'],'queue_name':_0x5b35db[_0x0a9e('0x28')],'VoiceQueueId':_0x5b35db['id'],'interface':_[_0x0a9e('0x6e')](_0x5637a1[_0x0a9e('0x6f')])?util[_0x0a9e('0x70')]('SIP/%s',_0x5637a1[_0x0a9e('0x28')]):_0x5637a1[_0x0a9e('0x6f')],'paused':_0x5637a1[_0x0a9e('0x6b')]||![],'penalty':0x0});});}});});})[_0x0a9e('0x23')](function(){return _0x361b21;});})['then'](function(){return _0x361b21;});}})[_0x0a9e('0x23')](function(_0xf0db1){if(_0xf0db1){return _0xf0db1['addAgents'](_0x1d442c[_0x0a9e('0x47')]['ids'],_[_0x0a9e('0x71')](_0x1d442c[_0x0a9e('0x47')],[_0x0a9e('0x5d'),'id'])||{})[_0x0a9e('0x72')](function(_0x5af453){for(var _0x51ccd7=0x0;_0x51ccd7<_0x1d442c[_0x0a9e('0x47')][_0x0a9e('0x5d')][_0x0a9e('0x32')];_0x51ccd7+=0x1){socket['emit'](_0x0a9e('0x73'),{'UserId':_0x1d442c[_0x0a9e('0x47')]['ids'][_0x51ccd7],'TeamId':_0x1d442c['params']['id']});}return _0x5af453;});}})[_0x0a9e('0x23')](respondWithResult(_0x2e9552,null))['catch'](handleError(_0x2e9552,null));};exports['removeAgents']=function(_0x4dc6b3,_0x81d748,_0xf3601c){var _0x9044fe;return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x4dc6b3[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x81d748,null))[_0x0a9e('0x23')](function(_0x5955f1){if(_0x5955f1){return BPromise[_0x0a9e('0x66')]([_0x0a9e('0x60'),_0x0a9e('0x61'),_0x0a9e('0x62'),'sms',_0x0a9e('0x64'),_0x0a9e('0x65')],function(_0x1d4877){return _0x5955f1['get'+_[_0x0a9e('0x55')](_0x1d4877)+_0x0a9e('0x59')]({'attributes':['id',_0x0a9e('0x28')]})[_0x0a9e('0x23')](function(_0x255e49){return BPromise[_0x0a9e('0x66')](_0x255e49,function(_0x32b9bd){return _0x32b9bd[_0x0a9e('0x74')](_0x4dc6b3['query'][_0x0a9e('0x5d')])[_0x0a9e('0x23')](function(){if(_0x1d4877==='voice'){return db[_0x0a9e('0x6c')][_0x0a9e('0x24')]({'where':{'VoiceQueueId':_0x32b9bd['id'],'UserId':_0x4dc6b3[_0x0a9e('0x2e')]['ids']}});}});});})[_0x0a9e('0x23')](function(){return _0x5955f1;});})['then'](function(){return _0x5955f1;});}})[_0x0a9e('0x23')](function(_0x2b5148){if(_0x2b5148){return _0x2b5148[_0x0a9e('0x74')](_0x4dc6b3[_0x0a9e('0x2e')][_0x0a9e('0x5d')])[_0x0a9e('0x23')](function(_0x16a039){if(_[_0x0a9e('0x75')](_0x4dc6b3['query'][_0x0a9e('0x5d')])){for(var _0x31d25a=0x0;_0x31d25a<_0x4dc6b3[_0x0a9e('0x2e')][_0x0a9e('0x5d')][_0x0a9e('0x32')];_0x31d25a+=0x1){socket[_0x0a9e('0x76')](_0x0a9e('0x77'),{'UserId':_0x4dc6b3[_0x0a9e('0x2e')][_0x0a9e('0x5d')][_0x31d25a],'TeamId':_0x4dc6b3[_0x0a9e('0x44')]['id']});}}else{socket[_0x0a9e('0x76')](_0x0a9e('0x77'),{'UserId':_0x4dc6b3[_0x0a9e('0x2e')]['ids'],'TeamId':_0x4dc6b3[_0x0a9e('0x44')]['id']});}});}})[_0x0a9e('0x23')](respondWithStatusCode(_0x81d748,null))[_0x0a9e('0x42')](handleError(_0x81d748,null));};exports[_0x0a9e('0x78')]=function(_0xb0599a,_0x5d9ddb,_0x3afc8c){var _0x1756c7={};var _0x5ce99d={};var _0x23b447;var _0x5e725e;return db[_0x0a9e('0x2a')][_0x0a9e('0x5b')]({'where':{'id':_0xb0599a[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x5d9ddb,null))['then'](function(_0x3ceba6){if(_0x3ceba6){_0x23b447=_0x3ceba6;_0x5ce99d['model']=_[_0x0a9e('0x2d')](db[_0x0a9e('0x68')]['rawAttributes']);_0x5ce99d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xb0599a[_0x0a9e('0x2e')]);_0x5ce99d['filters']=_['intersection'](_0x5ce99d[_0x0a9e('0x2c')],_0x5ce99d[_0x0a9e('0x2e')]);_0x1756c7[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5ce99d[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0xb0599a[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x1756c7[_0x0a9e('0x30')]=_0x1756c7['attributes'][_0x0a9e('0x32')]?_0x1756c7['attributes']:_0x5ce99d[_0x0a9e('0x2c')];_0x1756c7[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0xb0599a[_0x0a9e('0x2e')][_0x0a9e('0x35')]);_0x1756c7['where']=qs[_0x0a9e('0x36')](_[_0x0a9e('0x58')](_0xb0599a[_0x0a9e('0x2e')],_0x5ce99d[_0x0a9e('0x36')]));if(_0xb0599a[_0x0a9e('0x2e')]['filter']){_0x1756c7['where']=_[_0x0a9e('0x38')](_0x1756c7['where'],{'$or':_[_0x0a9e('0x3a')](_0x1756c7[_0x0a9e('0x30')],function(_0x4672e1){var _0x16313e={};_0x16313e[_0x4672e1]={'$like':'%'+_0xb0599a[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x16313e;})});}_0x1756c7=_['merge']({},_0x1756c7,_0xb0599a['options']);return _0x23b447[_0x0a9e('0x78')](_0x1756c7);}})['then'](function(_0x2469d1){if(_0x2469d1){_0x5e725e=_0x2469d1['length'];if(!_0xb0599a[_0x0a9e('0x2e')]['hasOwnProperty']('nolimit')){_0x1756c7[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0xb0599a['query'][_0x0a9e('0x1d')]);_0x1756c7[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0xb0599a[_0x0a9e('0x2e')][_0x0a9e('0x1c')]);}return _0x23b447['getAgents'](_0x1756c7);}})['then'](function(_0x16449b){if(_0x16449b){return _0x16449b?{'count':_0x5e725e,'rows':_0x16449b}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x5d9ddb,null))[_0x0a9e('0x42')](handleError(_0x5d9ddb,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index d870703..643bc93 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 _0x0c1a=['hook','events','../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x152121,_0x120c53){var _0x592a85=function(_0x241cab){while(--_0x241cab){_0x152121['push'](_0x152121['shift']());}};_0x592a85(++_0x120c53);}(_0x0c1a,0x169));var _0xa0c1=function(_0x1fce06,_0x4f99d0){_0x1fce06=_0x1fce06-0x0;var _0x9e03dd=_0x0c1a[_0x1fce06];return _0x9e03dd;};'use strict';var EventEmitter=require(_0xa0c1('0x0'));var Team=require(_0xa0c1('0x1'))['db'][_0xa0c1('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xa0c1('0x3')](0x0);var events={'afterCreate':_0xa0c1('0x4'),'afterUpdate':_0xa0c1('0x5'),'afterDestroy':_0xa0c1('0x6')};function emitEvent(_0x65826d){return function(_0x3037d5,_0x4118f0,_0x36644c){TeamEvents['emit'](_0x65826d+':'+_0x3037d5['id'],_0x3037d5);TeamEvents[_0xa0c1('0x7')](_0x65826d,_0x3037d5);_0x36644c(null);};}for(var e in events){if(events[_0xa0c1('0x8')](e)){var event=events[e];Team[_0xa0c1('0x9')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0xef18=['emit','hasOwnProperty','hook','exports','../../mysqldb','Team','update','remove'];(function(_0x4891fc,_0x1f7a25){var _0x3ec7cd=function(_0x46cf78){while(--_0x46cf78){_0x4891fc['push'](_0x4891fc['shift']());}};_0x3ec7cd(++_0x1f7a25);}(_0xef18,0xac));var _0x8ef1=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xef18[_0x47fd36];return _0x21a0fc;};'use strict';var EventEmitter=require('events');var Team=require(_0x8ef1('0x0'))['db'][_0x8ef1('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8ef1('0x2'),'afterDestroy':_0x8ef1('0x3')};function emitEvent(_0x6ce4df){return function(_0x1e0249,_0xc8a864,_0x2faf04){TeamEvents[_0x8ef1('0x4')](_0x6ce4df+':'+_0x1e0249['id'],_0x1e0249);TeamEvents['emit'](_0x6ce4df,_0x1e0249);_0x2faf04(null);};}for(var e in events){if(events[_0x8ef1('0x5')](e)){var event=events[e];Team[_0x8ef1('0x6')](e,emitEvent(event));}}module[_0x8ef1('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index d741bd6..b0aace5 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','./team.attributes','exports','define','Team','teams','util'];(function(_0x49520c,_0x140484){var _0x4bd3e7=function(_0x47ec22){while(--_0x47ec22){_0x49520c['push'](_0x49520c['shift']());}};_0x4bd3e7(++_0x140484);}(_0xedd9,0xfc));var _0x9edd=function(_0x491903,_0x2e5a65){_0x491903=_0x491903-0x0;var _0x179dd8=_0xedd9[_0x491903];return _0x179dd8;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var attributes=require(_0x9edd('0x6'));module[_0x9edd('0x7')]=function(_0x5943b3,_0x33679f){return _0x5943b3[_0x9edd('0x8')](_0x9edd('0x9'),attributes,{'tableName':_0x9edd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['moment','./team.attributes','define','Team','teams','lodash','../../config/logger','api'];(function(_0x5af76c,_0x5f4ec3){var _0x517422=function(_0x3a6a82){while(--_0x3a6a82){_0x5af76c['push'](_0x5af76c['shift']());}};_0x517422(++_0x5f4ec3);}(_0x3e74,0x175));var _0x43e7=function(_0x1009fe,_0x423db0){_0x1009fe=_0x1009fe-0x0;var _0x215420=_0x3e74[_0x1009fe];return _0x215420;};'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 diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 24b5830..8b15e17 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 _0xc1a0=['request','then','info','Team,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register'];(function(_0x9ddebe,_0x4aeaf4){var _0x4950ff=function(_0x47906c){while(--_0x47906c){_0x9ddebe['push'](_0x9ddebe['shift']());}};_0x4950ff(++_0x4aeaf4);}(_0xc1a0,0xd2));var _0x0c1a=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0xc1a0[_0x4099ee];return _0x1b7bfc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0c1a('0x0'));var BPromise=require(_0x0c1a('0x1'));var rs=require(_0x0c1a('0x2'));var fs=require('fs');var Redis=require(_0x0c1a('0x3'));var db=require(_0x0c1a('0x4'))['db'];var utils=require(_0x0c1a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0c1a('0x6'));var jayson=require(_0x0c1a('0x7'));var client=jayson['client'][_0x0c1a('0x8')]({'port':0x232a});config[_0x0c1a('0x9')]=_[_0x0c1a('0xa')](config[_0x0c1a('0x9')],{'host':_0x0c1a('0xb'),'port':0x18eb});var socket=require(_0x0c1a('0xc'))(new Redis(config[_0x0c1a('0x9')]));require(_0x0c1a('0xd'))[_0x0c1a('0xe')](socket);function respondWithRpcPromise(_0x379ed1,_0x10b131,_0x2a0ab5){return new BPromise(function(_0x4a65b4,_0x184a3c){return client[_0x0c1a('0xf')](_0x379ed1,_0x2a0ab5)[_0x0c1a('0x10')](function(_0xff9fa6){logger[_0x0c1a('0x11')](_0x0c1a('0x12'),_0x10b131,'request\x20sent');logger[_0x0c1a('0x13')]('Team,\x20%s,\x20%s,\x20%s',_0x10b131,'request\x20sent',JSON['stringify'](_0xff9fa6));if(_0xff9fa6[_0x0c1a('0x14')]){if(_0xff9fa6[_0x0c1a('0x14')][_0x0c1a('0x15')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x10b131,_0xff9fa6[_0x0c1a('0x14')][_0x0c1a('0x16')]);return _0x184a3c(_0xff9fa6[_0x0c1a('0x14')][_0x0c1a('0x16')]);}logger['error'](_0x0c1a('0x12'),_0x10b131,_0xff9fa6['error'][_0x0c1a('0x16')]);return _0x4a65b4(_0xff9fa6['error']['message']);}else{logger[_0x0c1a('0x11')](_0x0c1a('0x12'),_0x10b131,_0x0c1a('0x17'));_0x4a65b4(_0xff9fa6[_0x0c1a('0x18')][_0x0c1a('0x16')]);}})['catch'](function(_0x17d7b3){logger[_0x0c1a('0x14')]('Team,\x20%s,\x20%s',_0x10b131,_0x17d7b3);_0x184a3c(_0x17d7b3);});});} \ No newline at end of file +var _0x9491=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','redis','./team.socket','register','request','then','info','debug','Team,\x20%s,\x20%s,\x20%s','stringify','code','error','Team,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis'];(function(_0x1836bb,_0x309bd3){var _0x253bf7=function(_0x27b3e1){while(--_0x27b3e1){_0x1836bb['push'](_0x1836bb['shift']());}};_0x253bf7(++_0x309bd3);}(_0x9491,0x190));var _0x1949=function(_0x2e07ee,_0x1523b5){_0x2e07ee=_0x2e07ee-0x0;var _0x2a967c=_0x9491[_0x2e07ee];return _0x2a967c;};'use strict';var _=require(_0x1949('0x0'));var util=require(_0x1949('0x1'));var moment=require(_0x1949('0x2'));var BPromise=require('bluebird');var rs=require(_0x1949('0x3'));var fs=require('fs');var Redis=require(_0x1949('0x4'));var db=require(_0x1949('0x5'))['db'];var utils=require(_0x1949('0x6'));var logger=require('../../config/logger')(_0x1949('0x7'));var config=require(_0x1949('0x8'));var jayson=require(_0x1949('0x9'));var client=jayson[_0x1949('0xa')][_0x1949('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1949('0xc'))(new Redis(config[_0x1949('0xd')]));require(_0x1949('0xe'))[_0x1949('0xf')](socket);function respondWithRpcPromise(_0x1382dd,_0xf017e6,_0x637b64){return new BPromise(function(_0x4d8515,_0x4f82bd){return client[_0x1949('0x10')](_0x1382dd,_0x637b64)[_0x1949('0x11')](function(_0x3cff4e){logger[_0x1949('0x12')]('Team,\x20%s,\x20%s',_0xf017e6,'request\x20sent');logger[_0x1949('0x13')](_0x1949('0x14'),_0xf017e6,'request\x20sent',JSON[_0x1949('0x15')](_0x3cff4e));if(_0x3cff4e['error']){if(_0x3cff4e['error'][_0x1949('0x16')]===0x1f4){logger[_0x1949('0x17')](_0x1949('0x18'),_0xf017e6,_0x3cff4e[_0x1949('0x17')][_0x1949('0x19')]);return _0x4f82bd(_0x3cff4e[_0x1949('0x17')]['message']);}logger['error']('Team,\x20%s,\x20%s',_0xf017e6,_0x3cff4e[_0x1949('0x17')][_0x1949('0x19')]);return _0x4d8515(_0x3cff4e['error'][_0x1949('0x19')]);}else{logger['info'](_0x1949('0x18'),_0xf017e6,'request\x20sent');_0x4d8515(_0x3cff4e[_0x1949('0x1a')][_0x1949('0x19')]);}})['catch'](function(_0x39db6a){logger['error'](_0x1949('0x18'),_0xf017e6,_0x39db6a);_0x4f82bd(_0x39db6a);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 6dad6cb..64a8b0c 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 _0xe8c6=['team:','./team.events','save','remove','update','removeListener','register','length'];(function(_0x2064b6,_0x49272f){var _0x1ad489=function(_0x4182c1){while(--_0x4182c1){_0x2064b6['push'](_0x2064b6['shift']());}};_0x1ad489(++_0x49272f);}(_0xe8c6,0x1d1));var _0x6e8c=function(_0x31179a,_0x2b61e0){_0x31179a=_0x31179a-0x0;var _0x5ca88c=_0xe8c6[_0x31179a];return _0x5ca88c;};'use strict';var TeamEvents=require(_0x6e8c('0x0'));var events=[_0x6e8c('0x1'),_0x6e8c('0x2'),_0x6e8c('0x3')];function createListener(_0x2f2230,_0x405ac3){return function(_0x312378){_0x405ac3['emit'](_0x2f2230,_0x312378);};}function removeListener(_0x6e3edd,_0x343d70){return function(){TeamEvents[_0x6e8c('0x4')](_0x6e3edd,_0x343d70);};}exports[_0x6e8c('0x5')]=function(_0x2ec9ec){for(var _0x4a198a=0x0,_0x26d588=events[_0x6e8c('0x6')];_0x4a198a<_0x26d588;_0x4a198a++){var _0x2f60ef=events[_0x4a198a];var _0x561f91=createListener(_0x6e8c('0x7')+_0x2f60ef,_0x2ec9ec);TeamEvents['on'](_0x2f60ef,_0x561f91);}}; \ No newline at end of file +var _0xe16a=['update','emit','register','length','remove'];(function(_0x57e05f,_0x318b8d){var _0x435e54=function(_0x5de9eb){while(--_0x5de9eb){_0x57e05f['push'](_0x57e05f['shift']());}};_0x435e54(++_0x318b8d);}(_0xe16a,0x1d5));var _0xae16=function(_0x513e65,_0x4155a9){_0x513e65=_0x513e65-0x0;var _0x136427=_0xe16a[_0x513e65];return _0x136427;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0xae16('0x0'),_0xae16('0x1')];function createListener(_0x268c49,_0x57a732){return function(_0x78619f){_0x57a732[_0xae16('0x2')](_0x268c49,_0x78619f);};}function removeListener(_0x58e2c1,_0x5ad421){return function(){TeamEvents['removeListener'](_0x58e2c1,_0x5ad421);};}exports[_0xae16('0x3')]=function(_0x4d0835){for(var _0x15d390=0x0,_0x4ffe8a=events[_0xae16('0x4')];_0x15d390<_0x4ffe8a;_0x15d390++){var _0x51ca15=events[_0x15d390];var _0x10ea1a=createListener('team:'+_0x51ca15,_0x4d0835);TeamEvents['on'](_0x51ca15,_0x10ea1a);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 92df3d6..254de68 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 _0x4400=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x4400,0x17d));var _0x0440=function(_0xb1498b,_0x16ef72){_0xb1498b=_0xb1498b-0x0;var _0xf0f762=_0x4400[_0xb1498b];return _0xf0f762;};'use strict';var multer=require(_0x0440('0x0'));var util=require('util');var path=require(_0x0440('0x1'));var timeout=require(_0x0440('0x2'));var express=require(_0x0440('0x3'));var router=express[_0x0440('0x4')]();var auth=require(_0x0440('0x5'));var interaction=require(_0x0440('0x6'));var config=require(_0x0440('0x7'));var controller=require(_0x0440('0x8'));router[_0x0440('0x9')]('/',auth[_0x0440('0xa')](),controller[_0x0440('0xb')]);router['get'](_0x0440('0xc'),auth['isAuthenticated'](),controller[_0x0440('0xd')]);router[_0x0440('0xe')]('/',auth[_0x0440('0xa')](),controller[_0x0440('0xf')]);router[_0x0440('0x10')](_0x0440('0xc'),auth[_0x0440('0xa')](),controller[_0x0440('0x11')]);router[_0x0440('0x12')](_0x0440('0xc'),auth[_0x0440('0xa')](),controller['destroy']);module[_0x0440('0x13')]=router; \ No newline at end of file +var _0x1333=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','isAuthenticated','get','post','create','put','/:id','delete','destroy','exports','multer'];(function(_0x100a6d,_0x58f65f){var _0x8d4564=function(_0x27166a){while(--_0x27166a){_0x100a6d['push'](_0x100a6d['shift']());}};_0x8d4564(++_0x58f65f);}(_0x1333,0x167));var _0x3133=function(_0x374680,_0x1f1217){_0x374680=_0x374680-0x0;var _0x564d5f=_0x1333[_0x374680];return _0x564d5f;};'use strict';var multer=require(_0x3133('0x0'));var util=require(_0x3133('0x1'));var path=require(_0x3133('0x2'));var timeout=require(_0x3133('0x3'));var express=require(_0x3133('0x4'));var router=express['Router']();var auth=require(_0x3133('0x5'));var interaction=require(_0x3133('0x6'));var config=require(_0x3133('0x7'));var controller=require(_0x3133('0x8'));router['get']('/',auth[_0x3133('0x9')](),controller['index']);router[_0x3133('0xa')]('/:id',auth[_0x3133('0x9')](),controller['show']);router[_0x3133('0xb')]('/',auth[_0x3133('0x9')](),controller[_0x3133('0xc')]);router[_0x3133('0xd')](_0x3133('0xe'),auth[_0x3133('0x9')](),controller['update']);router[_0x3133('0xf')](_0x3133('0xe'),auth[_0x3133('0x9')](),controller[_0x3133('0x10')]);module[_0x3133('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 ae5f861..78092f0 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 _0x23c8=['STRING','TEXT','sequelize'];(function(_0x112e0c,_0x301b86){var _0x189222=function(_0x204a3e){while(--_0x204a3e){_0x112e0c['push'](_0x112e0c['shift']());}};_0x189222(++_0x301b86);}(_0x23c8,0x7a));var _0x823c=function(_0x3ab4eb,_0x3de95e){_0x3ab4eb=_0x3ab4eb-0x0;var _0x7c432d=_0x23c8[_0x3ab4eb];return _0x7c432d;};'use strict';var Sequelize=require(_0x823c('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x823c('0x1')]},'html':{'type':Sequelize[_0x823c('0x2')]}}; \ No newline at end of file +var _0x1408=['exports','STRING','TEXT','sequelize'];(function(_0x5f34d0,_0x11931b){var _0x57b1d5=function(_0x43a947){while(--_0x43a947){_0x5f34d0['push'](_0x5f34d0['shift']());}};_0x57b1d5(++_0x11931b);}(_0x1408,0xf3));var _0x8140=function(_0x3b602d,_0xff871f){_0x3b602d=_0x3b602d-0x0;var _0x36a21c=_0x1408[_0x3b602d];return _0x36a21c;};'use strict';var Sequelize=require(_0x8140('0x0'));module[_0x8140('0x1')]={'name':{'type':Sequelize[_0x8140('0x2')]},'description':{'type':Sequelize[_0x8140('0x2')]},'html':{'type':Sequelize[_0x8140('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 5f290a3..b9b2ecf 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 _0x2e69=['nolimit','order','sort','where','pick','filter','merge','map','key','VIRTUAL','field','include','findAll','catch','show','params','intersection','length','includeAll','options','find','create','body','user','role','Templates','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','get','destroy','error','stack','name','index','Template','rawAttributes','keys','filters','model','query','attributes','fields','hasOwnProperty'];(function(_0x4c630b,_0x25f8ef){var _0x181259=function(_0x5d0e58){while(--_0x5d0e58){_0x4c630b['push'](_0x4c630b['shift']());}};_0x181259(++_0x25f8ef);}(_0x2e69,0x166));var _0x92e6=function(_0x8c49e7,_0x1abed0){_0x8c49e7=_0x8c49e7-0x0;var _0x271991=_0x2e69[_0x8c49e7];return _0x271991;};'use strict';var pdf=require(_0x92e6('0x0'));var emlformat=require(_0x92e6('0x1'));var rimraf=require(_0x92e6('0x2'));var zipdir=require(_0x92e6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x92e6('0x4'));var moment=require(_0x92e6('0x5'));var BPromise=require(_0x92e6('0x6'));var Mustache=require(_0x92e6('0x7'));var util=require(_0x92e6('0x8'));var path=require('path');var sox=require(_0x92e6('0x9'));var csv=require(_0x92e6('0xa'));var ejs=require(_0x92e6('0xb'));var fs=require('fs');var _=require(_0x92e6('0xc'));var squel=require(_0x92e6('0xd'));var crypto=require(_0x92e6('0xe'));var jsforce=require(_0x92e6('0xf'));var deskjs=require(_0x92e6('0x10'));var toCsv=require(_0x92e6('0xa'));var querystring=require(_0x92e6('0x11'));var Papa=require('papaparse');var authService=require(_0x92e6('0x12'));var hardwareService=require(_0x92e6('0x13'));var Redis=require('ioredis');var qs=require(_0x92e6('0x14'));var logger=require(_0x92e6('0x15'))('api');var utils=require(_0x92e6('0x16'));var config=require(_0x92e6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c3fe1,_0x7a016b){_0x7a016b=_0x7a016b||0xcc;return function(_0x4483ca){if(_0x4483ca){return _0x3c3fe1[_0x92e6('0x18')](_0x7a016b);}return _0x3c3fe1['status'](_0x7a016b)[_0x92e6('0x19')]();};}function respondWithResult(_0x441d2b,_0x25cb4d){_0x25cb4d=_0x25cb4d||0xc8;return function(_0x1f8b0e){if(_0x1f8b0e){return _0x441d2b[_0x92e6('0x1a')](_0x25cb4d)[_0x92e6('0x1b')](_0x1f8b0e);}};}function respondWithFilteredResult(_0x54e220,_0x1ba5fe){return function(_0x51c9c2){if(_0x51c9c2){var _0xcc88ef=_0x51c9c2[_0x92e6('0x1c')],_0x1eb974=_0x1ba5fe[_0x92e6('0x1d')],_0x7d2841=_0x1ba5fe[_0x92e6('0x1d')]+_0x1ba5fe[_0x92e6('0x1e')],_0x3ce3ac;if(_0x7d2841>=_0xcc88ef){_0x7d2841=_0xcc88ef;_0x3ce3ac=0xc8;}else{_0x3ce3ac=0xce;}_0x54e220[_0x92e6('0x1a')](_0x3ce3ac);return _0x54e220[_0x92e6('0x1f')]('Content-Range',_0x1eb974+'-'+_0x7d2841+'/'+_0xcc88ef)[_0x92e6('0x1b')](_0x51c9c2);}return null;};}function patchUpdates(_0x44fd5c){return function(_0x354357){try{jsonpatch[_0x92e6('0x20')](_0x354357,_0x44fd5c,!![]);}catch(_0x22e889){return BPromise[_0x92e6('0x21')](_0x22e889);}return _0x354357[_0x92e6('0x22')]();};}function saveUpdates(_0x41423a,_0x34c752){return function(_0x44b4a0){if(_0x44b4a0){return _0x44b4a0[_0x92e6('0x23')](_0x41423a)[_0x92e6('0x24')](function(_0xd54e94){return _0xd54e94;});}return null;};}function removeEntity(_0x1efbd7,_0x428f3d){return function(_0x60d21a){if(_0x60d21a){return _0x60d21a['destroy']()[_0x92e6('0x24')](function(){var _0x464fbd=_0x60d21a[_0x92e6('0x25')]({'plain':!![]});var _0x3cd315='Templates';return db['UserProfileResource'][_0x92e6('0x26')]({'where':{'type':_0x3cd315,'resourceId':_0x464fbd['id']}})[_0x92e6('0x24')](function(){return _0x60d21a;});})[_0x92e6('0x24')](function(){_0x1efbd7['status'](0xcc)[_0x92e6('0x19')]();});}};}function handleEntityNotFound(_0xb0ea87,_0x4f960e){return function(_0x1d5993){if(!_0x1d5993){_0xb0ea87[_0x92e6('0x18')](0x194);}return _0x1d5993;};}function handleError(_0x4f0959,_0x260461){_0x260461=_0x260461||0x1f4;return function(_0x49a3c6){logger[_0x92e6('0x27')](_0x49a3c6[_0x92e6('0x28')]);if(_0x49a3c6['name']){delete _0x49a3c6[_0x92e6('0x29')];}_0x4f0959[_0x92e6('0x1a')](_0x260461)['send'](_0x49a3c6);};}exports[_0x92e6('0x2a')]=function(_0x213a06,_0x3e1b94){var _0x309d06={},_0x2147ff={},_0x474846={'count':0x0,'rows':[]};var _0x3c5466=db[_0x92e6('0x2b')][_0x92e6('0x2c')];_0x2147ff['model']=_[_0x92e6('0x2d')](_0x3c5466);_0x2147ff['query']=_[_0x92e6('0x2d')](_0x213a06['query']);_0x2147ff[_0x92e6('0x2e')]=_['intersection'](_0x2147ff[_0x92e6('0x2f')],_0x2147ff[_0x92e6('0x30')]);_0x309d06[_0x92e6('0x31')]=_['intersection'](_0x2147ff[_0x92e6('0x2f')],qs['fields'](_0x213a06[_0x92e6('0x30')][_0x92e6('0x32')]));_0x309d06[_0x92e6('0x31')]=_0x309d06[_0x92e6('0x31')]['length']?_0x309d06[_0x92e6('0x31')]:_0x2147ff['model'];if(!_0x213a06[_0x92e6('0x30')][_0x92e6('0x33')](_0x92e6('0x34'))){_0x309d06['limit']=qs[_0x92e6('0x1e')](_0x213a06['query'][_0x92e6('0x1e')]);_0x309d06[_0x92e6('0x1d')]=qs[_0x92e6('0x1d')](_0x213a06[_0x92e6('0x30')][_0x92e6('0x1d')]);}_0x309d06[_0x92e6('0x35')]=qs[_0x92e6('0x36')](_0x213a06['query'][_0x92e6('0x36')]);_0x309d06[_0x92e6('0x37')]=qs['filters'](_[_0x92e6('0x38')](_0x213a06[_0x92e6('0x30')],_0x2147ff[_0x92e6('0x2e')]));if(_0x213a06[_0x92e6('0x30')][_0x92e6('0x39')]){_0x309d06[_0x92e6('0x37')]=_[_0x92e6('0x3a')](_0x309d06['where'],{'$or':_[_0x92e6('0x3b')](_0x3c5466,function(_0x3c5be0){if(_0x3c5be0['type'][_0x92e6('0x3c')]!==_0x92e6('0x3d')){var _0x3a0563={};_0x3a0563[_0x3c5be0[_0x92e6('0x3e')]]={'$like':'%'+_0x213a06[_0x92e6('0x30')][_0x92e6('0x39')]+'%'};return _0x3a0563;}})});}_0x309d06=_[_0x92e6('0x3a')]({},_0x309d06,_0x213a06['options']);var _0x57ef15={'where':_0x309d06[_0x92e6('0x37')]};return db['Template'][_0x92e6('0x1c')](_0x57ef15)[_0x92e6('0x24')](function(_0x5ec3de){_0x474846['count']=_0x5ec3de;if(_0x213a06['query']['includeAll']){_0x309d06[_0x92e6('0x3f')]=[{'all':!![]}];}return db[_0x92e6('0x2b')][_0x92e6('0x40')](_0x309d06);})[_0x92e6('0x24')](function(_0x2172ee){_0x474846['rows']=_0x2172ee;return _0x474846;})['then'](respondWithFilteredResult(_0x3e1b94,_0x309d06))[_0x92e6('0x41')](handleError(_0x3e1b94,null));};exports[_0x92e6('0x42')]=function(_0x3afd08,_0x4aa2f7){var _0x141db9={'raw':!![],'where':{'id':_0x3afd08[_0x92e6('0x43')]['id']}},_0x21c4bc={};_0x21c4bc['model']=_['keys'](db[_0x92e6('0x2b')][_0x92e6('0x2c')]);_0x21c4bc[_0x92e6('0x30')]=_['keys'](_0x3afd08[_0x92e6('0x30')]);_0x21c4bc[_0x92e6('0x2e')]=_['intersection'](_0x21c4bc['model'],_0x21c4bc['query']);_0x141db9[_0x92e6('0x31')]=_[_0x92e6('0x44')](_0x21c4bc[_0x92e6('0x2f')],qs[_0x92e6('0x32')](_0x3afd08[_0x92e6('0x30')][_0x92e6('0x32')]));_0x141db9[_0x92e6('0x31')]=_0x141db9[_0x92e6('0x31')][_0x92e6('0x45')]?_0x141db9[_0x92e6('0x31')]:_0x21c4bc['model'];if(_0x3afd08[_0x92e6('0x30')][_0x92e6('0x46')]){_0x141db9[_0x92e6('0x3f')]=[{'all':!![]}];}_0x141db9=_[_0x92e6('0x3a')]({},_0x141db9,_0x3afd08[_0x92e6('0x47')]);return db['Template'][_0x92e6('0x48')](_0x141db9)[_0x92e6('0x24')](handleEntityNotFound(_0x4aa2f7,null))['then'](respondWithResult(_0x4aa2f7,null))[_0x92e6('0x41')](handleError(_0x4aa2f7,null));};exports[_0x92e6('0x49')]=function(_0x3dfae2,_0x9aff9f){return db[_0x92e6('0x2b')][_0x92e6('0x49')](_0x3dfae2[_0x92e6('0x4a')],{})['then'](function(_0xce3d2d){var _0x442b2f=_0x3dfae2[_0x92e6('0x4b')][_0x92e6('0x25')]({'plain':!![]});if(!_0x442b2f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x442b2f[_0x92e6('0x4c')]===_0x92e6('0x4b')){var _0x5b7de7=_0xce3d2d[_0x92e6('0x25')]({'plain':!![]});var _0x489fb1=_0x92e6('0x4d');return db[_0x92e6('0x4e')][_0x92e6('0x48')]({'where':{'name':_0x489fb1,'userProfileId':_0x442b2f[_0x92e6('0x4f')]},'raw':!![]})[_0x92e6('0x24')](function(_0x503254){if(_0x503254&&_0x503254['autoAssociation']===0x0){return db[_0x92e6('0x50')][_0x92e6('0x49')]({'name':_0x5b7de7[_0x92e6('0x29')],'resourceId':_0x5b7de7['id'],'type':_0x503254[_0x92e6('0x29')],'sectionId':_0x503254['id']},{})[_0x92e6('0x24')](function(){return _0xce3d2d;});}else{return _0xce3d2d;}})[_0x92e6('0x41')](function(_0x4f7158){logger['error'](_0x92e6('0x51'),_0x4f7158);throw _0x4f7158;});}return _0xce3d2d;})['then'](respondWithResult(_0x9aff9f,0xc9))[_0x92e6('0x41')](handleError(_0x9aff9f,null));};exports[_0x92e6('0x23')]=function(_0x74bf9b,_0x4508ed){if(_0x74bf9b['body']['id']){delete _0x74bf9b[_0x92e6('0x4a')]['id'];}return db[_0x92e6('0x2b')]['find']({'where':{'id':_0x74bf9b[_0x92e6('0x43')]['id']}})[_0x92e6('0x24')](handleEntityNotFound(_0x4508ed,null))[_0x92e6('0x24')](saveUpdates(_0x74bf9b[_0x92e6('0x4a')],null))[_0x92e6('0x24')](respondWithResult(_0x4508ed,null))['catch'](handleError(_0x4508ed,null));};exports[_0x92e6('0x26')]=function(_0xfc94d7,_0x157fde){return db[_0x92e6('0x2b')]['find']({'where':{'id':_0xfc94d7[_0x92e6('0x43')]['id']}})[_0x92e6('0x24')](handleEntityNotFound(_0x157fde,null))['then'](removeEntity(_0x157fde,null))[_0x92e6('0x41')](handleError(_0x157fde,null));}; \ No newline at end of file +var _0x7872=['model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','merge','map','type','key','VIRTUAL','field','options','Template','include','findAll','rows','catch','show','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','set','Content-Range','json','apply','reject','then','destroy','get','Templates','error','stack','name','send','rawAttributes'];(function(_0x5d27c3,_0x5ac158){var _0xed73f8=function(_0xc9c3d2){while(--_0xc9c3d2){_0x5d27c3['push'](_0x5d27c3['shift']());}};_0xed73f8(++_0x5ac158);}(_0x7872,0x16c));var _0x2787=function(_0x2a3b26,_0x10a383){_0x2a3b26=_0x2a3b26-0x0;var _0x2e73d3=_0x7872[_0x2a3b26];return _0x2e73d3;};'use strict';var pdf=require(_0x2787('0x0'));var emlformat=require(_0x2787('0x1'));var rimraf=require(_0x2787('0x2'));var zipdir=require(_0x2787('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2787('0x4'));var moment=require(_0x2787('0x5'));var BPromise=require(_0x2787('0x6'));var Mustache=require('mustache');var util=require(_0x2787('0x7'));var path=require(_0x2787('0x8'));var sox=require(_0x2787('0x9'));var csv=require(_0x2787('0xa'));var ejs=require(_0x2787('0xb'));var fs=require('fs');var _=require(_0x2787('0xc'));var squel=require(_0x2787('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2787('0xe'));var toCsv=require(_0x2787('0xa'));var querystring=require(_0x2787('0xf'));var Papa=require(_0x2787('0x10'));var authService=require(_0x2787('0x11'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x2787('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0x2787('0x13'))(_0x2787('0x14'));var utils=require(_0x2787('0x15'));var config=require('../../config/environment');var db=require(_0x2787('0x16'))['db'];function respondWithStatusCode(_0x137615,_0x46770c){_0x46770c=_0x46770c||0xcc;return function(_0x4d8364){if(_0x4d8364){return _0x137615[_0x2787('0x17')](_0x46770c);}return _0x137615[_0x2787('0x18')](_0x46770c)[_0x2787('0x19')]();};}function respondWithResult(_0x527b43,_0x543307){_0x543307=_0x543307||0xc8;return function(_0x35943f){if(_0x35943f){return _0x527b43[_0x2787('0x18')](_0x543307)['json'](_0x35943f);}};}function respondWithFilteredResult(_0x11dcca,_0x35f932){return function(_0x20f6ae){if(_0x20f6ae){var _0x19b53f=_0x20f6ae[_0x2787('0x1a')],_0x219d70=_0x35f932['offset'],_0x1fae5e=_0x35f932['offset']+_0x35f932['limit'],_0x2981f4;if(_0x1fae5e>=_0x19b53f){_0x1fae5e=_0x19b53f;_0x2981f4=0xc8;}else{_0x2981f4=0xce;}_0x11dcca[_0x2787('0x18')](_0x2981f4);return _0x11dcca[_0x2787('0x1b')](_0x2787('0x1c'),_0x219d70+'-'+_0x1fae5e+'/'+_0x19b53f)[_0x2787('0x1d')](_0x20f6ae);}return null;};}function patchUpdates(_0x151bdc){return function(_0x1ff23d){try{jsonpatch[_0x2787('0x1e')](_0x1ff23d,_0x151bdc,!![]);}catch(_0x5418b5){return BPromise[_0x2787('0x1f')](_0x5418b5);}return _0x1ff23d['save']();};}function saveUpdates(_0x53e615,_0x3bde78){return function(_0x7aa9cc){if(_0x7aa9cc){return _0x7aa9cc['update'](_0x53e615)[_0x2787('0x20')](function(_0x218b29){return _0x218b29;});}return null;};}function removeEntity(_0x3714bc,_0x29ae3d){return function(_0x56782b){if(_0x56782b){return _0x56782b[_0x2787('0x21')]()[_0x2787('0x20')](function(){var _0x44ea04=_0x56782b[_0x2787('0x22')]({'plain':!![]});var _0x2a6c57=_0x2787('0x23');return db['UserProfileResource'][_0x2787('0x21')]({'where':{'type':_0x2a6c57,'resourceId':_0x44ea04['id']}})[_0x2787('0x20')](function(){return _0x56782b;});})[_0x2787('0x20')](function(){_0x3714bc[_0x2787('0x18')](0xcc)[_0x2787('0x19')]();});}};}function handleEntityNotFound(_0x4e5203,_0x18d320){return function(_0x36a6ce){if(!_0x36a6ce){_0x4e5203[_0x2787('0x17')](0x194);}return _0x36a6ce;};}function handleError(_0x5737ba,_0x20b53e){_0x20b53e=_0x20b53e||0x1f4;return function(_0x1812f6){logger[_0x2787('0x24')](_0x1812f6[_0x2787('0x25')]);if(_0x1812f6[_0x2787('0x26')]){delete _0x1812f6[_0x2787('0x26')];}_0x5737ba[_0x2787('0x18')](_0x20b53e)[_0x2787('0x27')](_0x1812f6);};}exports['index']=function(_0x214074,_0x40c335){var _0x2bd258={},_0x297199={},_0x5b2f3a={'count':0x0,'rows':[]};var _0x870a9c=db['Template'][_0x2787('0x28')];_0x297199[_0x2787('0x29')]=_[_0x2787('0x2a')](_0x870a9c);_0x297199[_0x2787('0x2b')]=_[_0x2787('0x2a')](_0x214074[_0x2787('0x2b')]);_0x297199[_0x2787('0x2c')]=_[_0x2787('0x2d')](_0x297199['model'],_0x297199['query']);_0x2bd258[_0x2787('0x2e')]=_[_0x2787('0x2d')](_0x297199['model'],qs[_0x2787('0x2f')](_0x214074['query'][_0x2787('0x2f')]));_0x2bd258[_0x2787('0x2e')]=_0x2bd258[_0x2787('0x2e')][_0x2787('0x30')]?_0x2bd258['attributes']:_0x297199[_0x2787('0x29')];if(!_0x214074[_0x2787('0x2b')][_0x2787('0x31')](_0x2787('0x32'))){_0x2bd258[_0x2787('0x33')]=qs['limit'](_0x214074[_0x2787('0x2b')][_0x2787('0x33')]);_0x2bd258[_0x2787('0x34')]=qs[_0x2787('0x34')](_0x214074['query']['offset']);}_0x2bd258[_0x2787('0x35')]=qs[_0x2787('0x36')](_0x214074['query'][_0x2787('0x36')]);_0x2bd258[_0x2787('0x37')]=qs[_0x2787('0x2c')](_[_0x2787('0x38')](_0x214074[_0x2787('0x2b')],_0x297199[_0x2787('0x2c')]));if(_0x214074[_0x2787('0x2b')]['filter']){_0x2bd258[_0x2787('0x37')]=_[_0x2787('0x39')](_0x2bd258['where'],{'$or':_[_0x2787('0x3a')](_0x870a9c,function(_0x314e06){if(_0x314e06[_0x2787('0x3b')][_0x2787('0x3c')]!==_0x2787('0x3d')){var _0x3edfee={};_0x3edfee[_0x314e06[_0x2787('0x3e')]]={'$like':'%'+_0x214074[_0x2787('0x2b')]['filter']+'%'};return _0x3edfee;}})});}_0x2bd258=_['merge']({},_0x2bd258,_0x214074[_0x2787('0x3f')]);var _0x145cf8={'where':_0x2bd258[_0x2787('0x37')]};return db[_0x2787('0x40')][_0x2787('0x1a')](_0x145cf8)[_0x2787('0x20')](function(_0x21c518){_0x5b2f3a['count']=_0x21c518;if(_0x214074[_0x2787('0x2b')]['includeAll']){_0x2bd258[_0x2787('0x41')]=[{'all':!![]}];}return db[_0x2787('0x40')][_0x2787('0x42')](_0x2bd258);})['then'](function(_0x3c6cbe){_0x5b2f3a[_0x2787('0x43')]=_0x3c6cbe;return _0x5b2f3a;})[_0x2787('0x20')](respondWithFilteredResult(_0x40c335,_0x2bd258))[_0x2787('0x44')](handleError(_0x40c335,null));};exports[_0x2787('0x45')]=function(_0x36ad0b,_0x3a97bc){var _0x5aa59d={'raw':!![],'where':{'id':_0x36ad0b['params']['id']}},_0x20782d={};_0x20782d[_0x2787('0x29')]=_[_0x2787('0x2a')](db['Template'][_0x2787('0x28')]);_0x20782d['query']=_[_0x2787('0x2a')](_0x36ad0b[_0x2787('0x2b')]);_0x20782d[_0x2787('0x2c')]=_[_0x2787('0x2d')](_0x20782d[_0x2787('0x29')],_0x20782d[_0x2787('0x2b')]);_0x5aa59d[_0x2787('0x2e')]=_[_0x2787('0x2d')](_0x20782d[_0x2787('0x29')],qs[_0x2787('0x2f')](_0x36ad0b[_0x2787('0x2b')][_0x2787('0x2f')]));_0x5aa59d['attributes']=_0x5aa59d[_0x2787('0x2e')]['length']?_0x5aa59d[_0x2787('0x2e')]:_0x20782d[_0x2787('0x29')];if(_0x36ad0b[_0x2787('0x2b')]['includeAll']){_0x5aa59d['include']=[{'all':!![]}];}_0x5aa59d=_[_0x2787('0x39')]({},_0x5aa59d,_0x36ad0b[_0x2787('0x3f')]);return db['Template'][_0x2787('0x46')](_0x5aa59d)[_0x2787('0x20')](handleEntityNotFound(_0x3a97bc,null))['then'](respondWithResult(_0x3a97bc,null))[_0x2787('0x44')](handleError(_0x3a97bc,null));};exports['create']=function(_0x1fb4c9,_0x4bad54){return db[_0x2787('0x40')][_0x2787('0x47')](_0x1fb4c9[_0x2787('0x48')],{})[_0x2787('0x20')](function(_0x4f4a5e){var _0x4d3a58=_0x1fb4c9[_0x2787('0x49')][_0x2787('0x22')]({'plain':!![]});if(!_0x4d3a58)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d3a58[_0x2787('0x4a')]===_0x2787('0x49')){var _0x55e7d0=_0x4f4a5e[_0x2787('0x22')]({'plain':!![]});var _0x57debc=_0x2787('0x23');return db[_0x2787('0x4b')][_0x2787('0x46')]({'where':{'name':_0x57debc,'userProfileId':_0x4d3a58[_0x2787('0x4c')]},'raw':!![]})[_0x2787('0x20')](function(_0x553b00){if(_0x553b00&&_0x553b00[_0x2787('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x55e7d0[_0x2787('0x26')],'resourceId':_0x55e7d0['id'],'type':_0x553b00[_0x2787('0x26')],'sectionId':_0x553b00['id']},{})[_0x2787('0x20')](function(){return _0x4f4a5e;});}else{return _0x4f4a5e;}})['catch'](function(_0x7e2061){logger[_0x2787('0x24')](_0x2787('0x4e'),_0x7e2061);throw _0x7e2061;});}return _0x4f4a5e;})[_0x2787('0x20')](respondWithResult(_0x4bad54,0xc9))['catch'](handleError(_0x4bad54,null));};exports[_0x2787('0x4f')]=function(_0x382135,_0x50eed1){if(_0x382135[_0x2787('0x48')]['id']){delete _0x382135[_0x2787('0x48')]['id'];}return db[_0x2787('0x40')][_0x2787('0x46')]({'where':{'id':_0x382135[_0x2787('0x50')]['id']}})[_0x2787('0x20')](handleEntityNotFound(_0x50eed1,null))[_0x2787('0x20')](saveUpdates(_0x382135[_0x2787('0x48')],null))[_0x2787('0x20')](respondWithResult(_0x50eed1,null))[_0x2787('0x44')](handleError(_0x50eed1,null));};exports['destroy']=function(_0x482824,_0x4a92a8){return db[_0x2787('0x40')][_0x2787('0x46')]({'where':{'id':_0x482824[_0x2787('0x50')]['id']}})[_0x2787('0x20')](handleEntityNotFound(_0x4a92a8,null))[_0x2787('0x20')](removeEntity(_0x4a92a8,null))['catch'](handleError(_0x4a92a8,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 4ab46ee..8e0a346 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 _0x4368=['tools_templates','lodash','moment','request-promise','./template.attributes','exports','Template'];(function(_0x1dc78e,_0x3eb207){var _0x26b975=function(_0x381558){while(--_0x381558){_0x1dc78e['push'](_0x1dc78e['shift']());}};_0x26b975(++_0x3eb207);}(_0x4368,0x19e));var _0x8436=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x4368[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x8436('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x8436('0x1'));var BPromise=require('bluebird');var rp=require(_0x8436('0x2'));var attributes=require(_0x8436('0x3'));module[_0x8436('0x4')]=function(_0x369825,_0x1bbae7){return _0x369825['define'](_0x8436('0x5'),attributes,{'tableName':_0x8436('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd615=['bluebird','request-promise','exports','tools_templates','lodash','util','../../config/logger','api','moment'];(function(_0x30033a,_0x5ce4a6){var _0x5e3518=function(_0x11494a){while(--_0x11494a){_0x30033a['push'](_0x30033a['shift']());}};_0x5e3518(++_0x5ce4a6);}(_0xd615,0x70));var _0x5d61=function(_0x477a0a,_0xa4670f){_0x477a0a=_0x477a0a-0x0;var _0x1ef2a7=_0xd615[_0x477a0a];return _0x1ef2a7;};'use strict';var _=require(_0x5d61('0x0'));var util=require(_0x5d61('0x1'));var logger=require(_0x5d61('0x2'))(_0x5d61('0x3'));var moment=require(_0x5d61('0x4'));var BPromise=require(_0x5d61('0x5'));var rp=require(_0x5d61('0x6'));var attributes=require('./template.attributes');module[_0x5d61('0x7')]=function(_0x36e025,_0x26091d){return _0x36e025['define']('Template',attributes,{'tableName':_0x5d61('0x8'),'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 3134ed5..7250f15 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 _0xaea9=['debug','Template,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetTemplate','Template','options','where','attributes','include','map','model','stringify','lodash','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Template,\x20%s,\x20%s','request\x20sent'];(function(_0x529870,_0x975245){var _0x39435f=function(_0x408986){while(--_0x408986){_0x529870['push'](_0x529870['shift']());}};_0x39435f(++_0x975245);}(_0xaea9,0x1b4));var _0x9aea=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xaea9[_0x494d1f];return _0x457b6e;};'use strict';var _=require(_0x9aea('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9aea('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9aea('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x9aea('0x3'))('rpc');var config=require(_0x9aea('0x4'));var jayson=require(_0x9aea('0x5'));var client=jayson[_0x9aea('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x154916,_0x3299bc,_0x26cc5e){return new BPromise(function(_0x302642,_0x4616ca){return client[_0x9aea('0x7')](_0x154916,_0x26cc5e)[_0x9aea('0x8')](function(_0x56fb46){logger[_0x9aea('0x9')](_0x9aea('0xa'),_0x3299bc,_0x9aea('0xb'));logger[_0x9aea('0xc')](_0x9aea('0xd'),_0x3299bc,'request\x20sent',JSON['stringify'](_0x56fb46));if(_0x56fb46['error']){if(_0x56fb46['error'][_0x9aea('0xe')]===0x1f4){logger[_0x9aea('0xf')](_0x9aea('0xa'),_0x3299bc,_0x56fb46[_0x9aea('0xf')][_0x9aea('0x10')]);return _0x4616ca(_0x56fb46[_0x9aea('0xf')][_0x9aea('0x10')]);}logger['error'](_0x9aea('0xa'),_0x3299bc,_0x56fb46[_0x9aea('0xf')][_0x9aea('0x10')]);return _0x302642(_0x56fb46[_0x9aea('0xf')][_0x9aea('0x10')]);}else{logger[_0x9aea('0x9')](_0x9aea('0xa'),_0x3299bc,_0x9aea('0xb'));_0x302642(_0x56fb46[_0x9aea('0x11')][_0x9aea('0x10')]);}})[_0x9aea('0x12')](function(_0x5969bb){logger[_0x9aea('0xf')](_0x9aea('0xa'),_0x3299bc,_0x5969bb);_0x4616ca(_0x5969bb);});});}exports[_0x9aea('0x13')]=function(_0x5e361b){var _0x59677d=this;return new Promise(function(_0x49305d,_0x1316f9){return db[_0x9aea('0x14')]['findAll']({'raw':_0x5e361b[_0x9aea('0x15')]?_0x5e361b['options']['raw']===undefined?!![]:![]:!![],'where':_0x5e361b['options']?_0x5e361b[_0x9aea('0x15')][_0x9aea('0x16')]||null:null,'attributes':_0x5e361b[_0x9aea('0x15')]?_0x5e361b['options'][_0x9aea('0x17')]||null:null,'limit':_0x5e361b[_0x9aea('0x15')]?_0x5e361b['options']['limit']||null:null,'include':_0x5e361b['options']?_0x5e361b['options'][_0x9aea('0x18')]?_[_0x9aea('0x19')](_0x5e361b[_0x9aea('0x15')][_0x9aea('0x18')],function(_0x48cdd9){return{'model':db[_0x48cdd9[_0x9aea('0x1a')]],'as':_0x48cdd9['as'],'attributes':_0x48cdd9[_0x9aea('0x17')],'include':_0x48cdd9[_0x9aea('0x18')]?_[_0x9aea('0x19')](_0x48cdd9[_0x9aea('0x18')],function(_0x2cd462){return{'model':db[_0x2cd462['model']],'as':_0x2cd462['as'],'attributes':_0x2cd462[_0x9aea('0x17')],'include':_0x2cd462[_0x9aea('0x18')]?_[_0x9aea('0x19')](_0x2cd462[_0x9aea('0x18')],function(_0xaf9b87){return{'model':db[_0xaf9b87[_0x9aea('0x1a')]],'as':_0xaf9b87['as'],'attributes':_0xaf9b87[_0x9aea('0x17')]};}):[]};}):[]};}):[]:[]})[_0x9aea('0x8')](function(_0x210e03){logger[_0x9aea('0x9')]('GetTemplate',_0x5e361b);logger[_0x9aea('0xc')]('GetTemplate',_0x5e361b,JSON[_0x9aea('0x1b')](_0x210e03));_0x49305d(_0x210e03);})[_0x9aea('0x12')](function(_0x3011b0){logger['error'](_0x9aea('0x13'),_0x3011b0[_0x9aea('0x10')],_0x5e361b);_0x1316f9(_0x59677d[_0x9aea('0xf')](0x1f4,_0x3011b0[_0x9aea('0x10')]));});});}; \ No newline at end of file +var _0xee02=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','map','include','model','lodash','util'];(function(_0x3986fc,_0x41fd49){var _0x514bd1=function(_0x4f038f){while(--_0x4f038f){_0x3986fc['push'](_0x3986fc['shift']());}};_0x514bd1(++_0x41fd49);}(_0xee02,0xad));var _0x2ee0=function(_0x566bdf,_0x1f4861){_0x566bdf=_0x566bdf-0x0;var _0x331215=_0xee02[_0x566bdf];return _0x331215;};'use strict';var _=require(_0x2ee0('0x0'));var util=require(_0x2ee0('0x1'));var moment=require(_0x2ee0('0x2'));var BPromise=require(_0x2ee0('0x3'));var rs=require(_0x2ee0('0x4'));var fs=require('fs');var Redis=require(_0x2ee0('0x5'));var db=require(_0x2ee0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ee0('0x7'))('rpc');var config=require(_0x2ee0('0x8'));var jayson=require(_0x2ee0('0x9'));var client=jayson[_0x2ee0('0xa')][_0x2ee0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a2515,_0x142da0,_0x27aef8){return new BPromise(function(_0x20060d,_0xa66110){return client[_0x2ee0('0xc')](_0x3a2515,_0x27aef8)[_0x2ee0('0xd')](function(_0x2b078e){logger['info'](_0x2ee0('0xe'),_0x142da0,_0x2ee0('0xf'));logger[_0x2ee0('0x10')](_0x2ee0('0x11'),_0x142da0,'request\x20sent',JSON[_0x2ee0('0x12')](_0x2b078e));if(_0x2b078e['error']){if(_0x2b078e[_0x2ee0('0x13')]['code']===0x1f4){logger[_0x2ee0('0x13')](_0x2ee0('0xe'),_0x142da0,_0x2b078e[_0x2ee0('0x13')][_0x2ee0('0x14')]);return _0xa66110(_0x2b078e['error'][_0x2ee0('0x14')]);}logger['error']('Template,\x20%s,\x20%s',_0x142da0,_0x2b078e[_0x2ee0('0x13')][_0x2ee0('0x14')]);return _0x20060d(_0x2b078e[_0x2ee0('0x13')][_0x2ee0('0x14')]);}else{logger[_0x2ee0('0x15')](_0x2ee0('0xe'),_0x142da0,_0x2ee0('0xf'));_0x20060d(_0x2b078e[_0x2ee0('0x16')][_0x2ee0('0x14')]);}})[_0x2ee0('0x17')](function(_0x201304){logger['error']('Template,\x20%s,\x20%s',_0x142da0,_0x201304);_0xa66110(_0x201304);});});}exports[_0x2ee0('0x18')]=function(_0x1454da){var _0x11b94b=this;return new Promise(function(_0x5cc98a,_0x3ee527){return db[_0x2ee0('0x19')][_0x2ee0('0x1a')]({'raw':_0x1454da[_0x2ee0('0x1b')]?_0x1454da['options'][_0x2ee0('0x1c')]===undefined?!![]:![]:!![],'where':_0x1454da['options']?_0x1454da['options'][_0x2ee0('0x1d')]||null:null,'attributes':_0x1454da[_0x2ee0('0x1b')]?_0x1454da[_0x2ee0('0x1b')][_0x2ee0('0x1e')]||null:null,'limit':_0x1454da[_0x2ee0('0x1b')]?_0x1454da[_0x2ee0('0x1b')][_0x2ee0('0x1f')]||null:null,'include':_0x1454da[_0x2ee0('0x1b')]?_0x1454da[_0x2ee0('0x1b')]['include']?_[_0x2ee0('0x20')](_0x1454da[_0x2ee0('0x1b')][_0x2ee0('0x21')],function(_0x583fbc){return{'model':db[_0x583fbc['model']],'as':_0x583fbc['as'],'attributes':_0x583fbc[_0x2ee0('0x1e')],'include':_0x583fbc[_0x2ee0('0x21')]?_[_0x2ee0('0x20')](_0x583fbc[_0x2ee0('0x21')],function(_0x269334){return{'model':db[_0x269334[_0x2ee0('0x22')]],'as':_0x269334['as'],'attributes':_0x269334[_0x2ee0('0x1e')],'include':_0x269334[_0x2ee0('0x21')]?_['map'](_0x269334[_0x2ee0('0x21')],function(_0x1b7d7b){return{'model':db[_0x1b7d7b[_0x2ee0('0x22')]],'as':_0x1b7d7b['as'],'attributes':_0x1b7d7b[_0x2ee0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2ee0('0xd')](function(_0x59433b){logger['info'](_0x2ee0('0x18'),_0x1454da);logger['debug'](_0x2ee0('0x18'),_0x1454da,JSON['stringify'](_0x59433b));_0x5cc98a(_0x59433b);})[_0x2ee0('0x17')](function(_0x385022){logger['error'](_0x2ee0('0x18'),_0x385022[_0x2ee0('0x14')],_0x1454da);_0x3ee527(_0x11b94b[_0x2ee0('0x13')](0x1f4,_0x385022[_0x2ee0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 731d13f..e3223de 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 _0x50af=['/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','put','update','delete','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x50af,0x1c9));var _0xf50a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x50af[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xf50a('0x0'));var path=require(_0xf50a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf50a('0x2')]();var auth=require(_0xf50a('0x3'));var interaction=require(_0xf50a('0x4'));var config=require(_0xf50a('0x5'));var controller=require('./trigger.controller');router[_0xf50a('0x6')]('/',auth[_0xf50a('0x7')](),controller[_0xf50a('0x8')]);router[_0xf50a('0x6')](_0xf50a('0x9'),auth[_0xf50a('0x7')](),controller[_0xf50a('0xa')]);router[_0xf50a('0x6')](_0xf50a('0xb'),auth['isAuthenticated'](),controller[_0xf50a('0xc')]);router[_0xf50a('0x6')]('/:id/any_conditions',auth[_0xf50a('0x7')](),controller[_0xf50a('0xd')]);router[_0xf50a('0x6')](_0xf50a('0xe'),auth[_0xf50a('0x7')](),controller['getActions']);router[_0xf50a('0xf')]('/',auth[_0xf50a('0x7')](),controller[_0xf50a('0x10')]);router[_0xf50a('0xf')](_0xf50a('0xb'),auth['isAuthenticated'](),controller[_0xf50a('0x11')]);router[_0xf50a('0xf')](_0xf50a('0x12'),auth[_0xf50a('0x7')](),controller[_0xf50a('0x13')]);router[_0xf50a('0xf')](_0xf50a('0xe'),auth[_0xf50a('0x7')](),controller[_0xf50a('0x14')]);router[_0xf50a('0x15')](_0xf50a('0x9'),auth[_0xf50a('0x7')](),controller[_0xf50a('0x16')]);router[_0xf50a('0x17')](_0xf50a('0x9'),auth[_0xf50a('0x7')](),controller[_0xf50a('0x18')]);module[_0xf50a('0x19')]=router; \ No newline at end of file +var _0x8bef=['../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id','/:id/all_conditions','/:id/any_conditions','getAnyConditions','getActions','post','create','addAllCondition','addAnyCondition','/:id/actions','put','update','delete','destroy','multer','path','express','Router','../../components/auth/service'];(function(_0x76eea1,_0x5836f3){var _0x59bd92=function(_0x3ef23c){while(--_0x3ef23c){_0x76eea1['push'](_0x76eea1['shift']());}};_0x59bd92(++_0x5836f3);}(_0x8bef,0x73));var _0xf8be=function(_0x55fb83,_0x1d3856){_0x55fb83=_0x55fb83-0x0;var _0x59a87a=_0x8bef[_0x55fb83];return _0x59a87a;};'use strict';var multer=require(_0xf8be('0x0'));var util=require('util');var path=require(_0xf8be('0x1'));var timeout=require('connect-timeout');var express=require(_0xf8be('0x2'));var router=express[_0xf8be('0x3')]();var auth=require(_0xf8be('0x4'));var interaction=require(_0xf8be('0x5'));var config=require(_0xf8be('0x6'));var controller=require(_0xf8be('0x7'));router[_0xf8be('0x8')]('/',auth[_0xf8be('0x9')](),controller['index']);router[_0xf8be('0x8')](_0xf8be('0xa'),auth[_0xf8be('0x9')](),controller['show']);router[_0xf8be('0x8')](_0xf8be('0xb'),auth['isAuthenticated'](),controller['getAllConditions']);router[_0xf8be('0x8')](_0xf8be('0xc'),auth['isAuthenticated'](),controller[_0xf8be('0xd')]);router[_0xf8be('0x8')]('/:id/actions',auth[_0xf8be('0x9')](),controller[_0xf8be('0xe')]);router[_0xf8be('0xf')]('/',auth[_0xf8be('0x9')](),controller[_0xf8be('0x10')]);router['post']('/:id/all_conditions',auth[_0xf8be('0x9')](),controller[_0xf8be('0x11')]);router['post']('/:id/any_conditions',auth[_0xf8be('0x9')](),controller[_0xf8be('0x12')]);router[_0xf8be('0xf')](_0xf8be('0x13'),auth[_0xf8be('0x9')](),controller['addAction']);router[_0xf8be('0x14')](_0xf8be('0xa'),auth[_0xf8be('0x9')](),controller[_0xf8be('0x15')]);router[_0xf8be('0x16')](_0xf8be('0xa'),auth[_0xf8be('0x9')](),controller[_0xf8be('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index a68faf5..6240c0c 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 _0xb0db=['exports','STRING','BOOLEAN'];(function(_0x56c203,_0x31deeb){var _0x1b3d05=function(_0x2367b0){while(--_0x2367b0){_0x56c203['push'](_0x56c203['shift']());}};_0x1b3d05(++_0x31deeb);}(_0xb0db,0xea));var _0xbb0d=function(_0x26cf12,_0x4d4f0c){_0x26cf12=_0x26cf12-0x0;var _0xec9fc5=_0xb0db[_0x26cf12];return _0xec9fc5;};'use strict';var Sequelize=require('sequelize');module[_0xbb0d('0x0')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbb0d('0x1')]},'status':{'type':Sequelize[_0xbb0d('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x0cf4=['STRING','BOOLEAN','sequelize','exports'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0x0cf4,0xfa));var _0x40cf=function(_0x267f04,_0x18005d){_0x267f04=_0x267f04-0x0;var _0x324621=_0x0cf4[_0x267f04];return _0x324621;};'use strict';var Sequelize=require(_0x40cf('0x0'));module[_0x40cf('0x1')]={'name':{'type':Sequelize[_0x40cf('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x40cf('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 563fe2d..659a5d7 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 _0xf7a8=['map','getAllConditions','getAnyConditions','addAction','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','Triggers','UserProfileResource','end','error','send','Trigger','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','key','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','where','pick'];(function(_0x57f3c4,_0x1250c2){var _0x990b28=function(_0x3c1119){while(--_0x3c1119){_0x57f3c4['push'](_0x57f3c4['shift']());}};_0x990b28(++_0x1250c2);}(_0xf7a8,0x117));var _0x8f7a=function(_0x5d097f,_0x4fc987){_0x5d097f=_0x5d097f-0x0;var _0x3fe76a=_0xf7a8[_0x5d097f];return _0x3fe76a;};'use strict';var pdf=require(_0x8f7a('0x0'));var emlformat=require(_0x8f7a('0x1'));var rimraf=require(_0x8f7a('0x2'));var zipdir=require(_0x8f7a('0x3'));var jsonpatch=require(_0x8f7a('0x4'));var rp=require(_0x8f7a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8f7a('0x6'));var util=require(_0x8f7a('0x7'));var path=require('path');var sox=require(_0x8f7a('0x8'));var csv=require(_0x8f7a('0x9'));var ejs=require(_0x8f7a('0xa'));var fs=require('fs');var _=require(_0x8f7a('0xb'));var squel=require(_0x8f7a('0xc'));var crypto=require(_0x8f7a('0xd'));var jsforce=require(_0x8f7a('0xe'));var deskjs=require(_0x8f7a('0xf'));var toCsv=require(_0x8f7a('0x9'));var querystring=require('querystring');var Papa=require(_0x8f7a('0x10'));var authService=require(_0x8f7a('0x11'));var hardwareService=require(_0x8f7a('0x12'));var Redis=require(_0x8f7a('0x13'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x8f7a('0x14'));var utils=require(_0x8f7a('0x15'));var config=require(_0x8f7a('0x16'));var db=require(_0x8f7a('0x17'))['db'];function respondWithStatusCode(_0x52a3b6,_0x54cf71){_0x54cf71=_0x54cf71||0xcc;return function(_0x22967a){if(_0x22967a){return _0x52a3b6[_0x8f7a('0x18')](_0x54cf71);}return _0x52a3b6['status'](_0x54cf71)['end']();};}function respondWithResult(_0x45a522,_0x21b9a6){_0x21b9a6=_0x21b9a6||0xc8;return function(_0x4eaa8d){if(_0x4eaa8d){return _0x45a522[_0x8f7a('0x19')](_0x21b9a6)[_0x8f7a('0x1a')](_0x4eaa8d);}};}function respondWithFilteredResult(_0x1a5e75,_0x578b53){return function(_0x5f0e43){if(_0x5f0e43){var _0x4eded6=_0x5f0e43[_0x8f7a('0x1b')],_0x53b601=_0x578b53[_0x8f7a('0x1c')],_0x55c1af=_0x578b53[_0x8f7a('0x1c')]+_0x578b53[_0x8f7a('0x1d')],_0x14cdfa;if(_0x55c1af>=_0x4eded6){_0x55c1af=_0x4eded6;_0x14cdfa=0xc8;}else{_0x14cdfa=0xce;}_0x1a5e75[_0x8f7a('0x19')](_0x14cdfa);return _0x1a5e75[_0x8f7a('0x1e')]('Content-Range',_0x53b601+'-'+_0x55c1af+'/'+_0x4eded6)[_0x8f7a('0x1a')](_0x5f0e43);}return null;};}function patchUpdates(_0x261a68){return function(_0x39457f){try{jsonpatch[_0x8f7a('0x1f')](_0x39457f,_0x261a68,!![]);}catch(_0x225821){return BPromise[_0x8f7a('0x20')](_0x225821);}return _0x39457f[_0x8f7a('0x21')]();};}function saveUpdates(_0x249c90,_0x2384dc){return function(_0x49dfc0){if(_0x49dfc0){return _0x49dfc0[_0x8f7a('0x22')](_0x249c90)[_0x8f7a('0x23')](function(_0x354e3e){return _0x354e3e;});}return null;};}function removeEntity(_0x1c5e03,_0x2d5389){return function(_0x55a639){if(_0x55a639){return _0x55a639[_0x8f7a('0x24')]()[_0x8f7a('0x23')](function(){var _0x180cc6=_0x55a639['get']({'plain':!![]});var _0x16e4fa=_0x8f7a('0x25');return db[_0x8f7a('0x26')][_0x8f7a('0x24')]({'where':{'type':_0x16e4fa,'resourceId':_0x180cc6['id']}})[_0x8f7a('0x23')](function(){return _0x55a639;});})['then'](function(){_0x1c5e03[_0x8f7a('0x19')](0xcc)[_0x8f7a('0x27')]();});}};}function handleEntityNotFound(_0x338baf,_0x3e81c9){return function(_0x2f7e36){if(!_0x2f7e36){_0x338baf[_0x8f7a('0x18')](0x194);}return _0x2f7e36;};}function handleError(_0x5c50a3,_0x593f74){_0x593f74=_0x593f74||0x1f4;return function(_0x57aed3){logger[_0x8f7a('0x28')](_0x57aed3['stack']);if(_0x57aed3['name']){delete _0x57aed3['name'];}_0x5c50a3[_0x8f7a('0x19')](_0x593f74)[_0x8f7a('0x29')](_0x57aed3);};}exports['index']=function(_0x1b9ccb,_0x5cd666){var _0x1fa536={},_0x2ba3be={},_0x20259b={'count':0x0,'rows':[]};var _0x161272=db[_0x8f7a('0x2a')][_0x8f7a('0x2b')];_0x2ba3be[_0x8f7a('0x2c')]=_[_0x8f7a('0x2d')](_0x161272);_0x2ba3be['query']=_[_0x8f7a('0x2d')](_0x1b9ccb[_0x8f7a('0x2e')]);_0x2ba3be[_0x8f7a('0x2f')]=_[_0x8f7a('0x30')](_0x2ba3be['model'],_0x2ba3be['query']);_0x1fa536['attributes']=_[_0x8f7a('0x30')](_0x2ba3be[_0x8f7a('0x2c')],qs[_0x8f7a('0x31')](_0x1b9ccb[_0x8f7a('0x2e')][_0x8f7a('0x31')]));_0x1fa536[_0x8f7a('0x32')]=_0x1fa536[_0x8f7a('0x32')][_0x8f7a('0x33')]?_0x1fa536[_0x8f7a('0x32')]:_0x2ba3be['model'];if(!_0x1b9ccb[_0x8f7a('0x2e')][_0x8f7a('0x34')](_0x8f7a('0x35'))){_0x1fa536['limit']=qs[_0x8f7a('0x1d')](_0x1b9ccb['query'][_0x8f7a('0x1d')]);_0x1fa536[_0x8f7a('0x1c')]=qs['offset'](_0x1b9ccb[_0x8f7a('0x2e')][_0x8f7a('0x1c')]);}_0x1fa536[_0x8f7a('0x36')]=qs[_0x8f7a('0x37')](_0x1b9ccb[_0x8f7a('0x2e')][_0x8f7a('0x37')]);_0x1fa536['where']=qs[_0x8f7a('0x2f')](_['pick'](_0x1b9ccb[_0x8f7a('0x2e')],_0x2ba3be[_0x8f7a('0x2f')]));if(_0x1b9ccb[_0x8f7a('0x2e')][_0x8f7a('0x38')]){_0x1fa536['where']=_['merge'](_0x1fa536['where'],{'$or':_['map'](_0x161272,function(_0x21c5d3){if(_0x21c5d3['type'][_0x8f7a('0x39')]!==_0x8f7a('0x3a')){var _0x5f522e={};_0x5f522e[_0x21c5d3['field']]={'$like':'%'+_0x1b9ccb[_0x8f7a('0x2e')][_0x8f7a('0x38')]+'%'};return _0x5f522e;}})});}_0x1fa536=_[_0x8f7a('0x3b')]({},_0x1fa536,_0x1b9ccb[_0x8f7a('0x3c')]);var _0x4c4b7a={'where':_0x1fa536['where']};return db[_0x8f7a('0x2a')][_0x8f7a('0x1b')](_0x4c4b7a)[_0x8f7a('0x23')](function(_0x2245d6){_0x20259b[_0x8f7a('0x1b')]=_0x2245d6;if(_0x1b9ccb[_0x8f7a('0x2e')][_0x8f7a('0x3d')]){_0x1fa536[_0x8f7a('0x3e')]=[{'all':!![]}];}return db['Trigger'][_0x8f7a('0x3f')](_0x1fa536);})[_0x8f7a('0x23')](function(_0xd8248){_0x20259b[_0x8f7a('0x40')]=_0xd8248;return _0x20259b;})[_0x8f7a('0x23')](respondWithFilteredResult(_0x5cd666,_0x1fa536))[_0x8f7a('0x41')](handleError(_0x5cd666,null));};exports['show']=function(_0x1d8c80,_0x225acc){var _0x7c5028={'raw':![],'where':{'id':_0x1d8c80[_0x8f7a('0x42')]['id']}},_0x591d9f={};_0x591d9f[_0x8f7a('0x2c')]=_[_0x8f7a('0x2d')](db[_0x8f7a('0x2a')][_0x8f7a('0x2b')]);_0x591d9f[_0x8f7a('0x2e')]=_[_0x8f7a('0x2d')](_0x1d8c80['query']);_0x591d9f['filters']=_[_0x8f7a('0x30')](_0x591d9f[_0x8f7a('0x2c')],_0x591d9f[_0x8f7a('0x2e')]);_0x7c5028[_0x8f7a('0x32')]=_[_0x8f7a('0x30')](_0x591d9f['model'],qs[_0x8f7a('0x31')](_0x1d8c80[_0x8f7a('0x2e')][_0x8f7a('0x31')]));_0x7c5028[_0x8f7a('0x32')]=_0x7c5028['attributes'][_0x8f7a('0x33')]?_0x7c5028[_0x8f7a('0x32')]:_0x591d9f[_0x8f7a('0x2c')];if(_0x1d8c80[_0x8f7a('0x2e')][_0x8f7a('0x3d')]){_0x7c5028['include']=[{'all':!![]}];}_0x7c5028=_[_0x8f7a('0x3b')]({},_0x7c5028,_0x1d8c80[_0x8f7a('0x3c')]);return db[_0x8f7a('0x2a')][_0x8f7a('0x43')](_0x7c5028)[_0x8f7a('0x23')](handleEntityNotFound(_0x225acc,null))[_0x8f7a('0x23')](respondWithResult(_0x225acc,null))[_0x8f7a('0x41')](handleError(_0x225acc,null));};exports[_0x8f7a('0x44')]=function(_0x4b80a,_0x221196){return db[_0x8f7a('0x2a')][_0x8f7a('0x44')](_0x4b80a[_0x8f7a('0x45')],{})[_0x8f7a('0x23')](function(_0x22473d){var _0x2d6ca7=_0x4b80a[_0x8f7a('0x46')][_0x8f7a('0x47')]({'plain':!![]});if(!_0x2d6ca7)throw new Error(_0x8f7a('0x48'));if(_0x2d6ca7['role']==='user'){var _0x3fc03e=_0x22473d['get']({'plain':!![]});var _0x1b209f='Triggers';return db[_0x8f7a('0x49')][_0x8f7a('0x43')]({'where':{'name':_0x1b209f,'userProfileId':_0x2d6ca7[_0x8f7a('0x4a')]},'raw':!![]})[_0x8f7a('0x23')](function(_0x5f5968){if(_0x5f5968&&_0x5f5968['autoAssociation']===0x0){return db[_0x8f7a('0x26')][_0x8f7a('0x44')]({'name':_0x3fc03e['name'],'resourceId':_0x3fc03e['id'],'type':_0x5f5968[_0x8f7a('0x4b')],'sectionId':_0x5f5968['id']},{})['then'](function(){return _0x22473d;});}else{return _0x22473d;}})[_0x8f7a('0x41')](function(_0x5a4b5b){logger[_0x8f7a('0x28')](_0x8f7a('0x4c'),_0x5a4b5b);throw _0x5a4b5b;});}return _0x22473d;})[_0x8f7a('0x23')](respondWithResult(_0x221196,0xc9))[_0x8f7a('0x41')](handleError(_0x221196,null));};exports['update']=function(_0x31938a,_0x22441b){if(_0x31938a['body']['id']){delete _0x31938a[_0x8f7a('0x45')]['id'];}return db[_0x8f7a('0x2a')][_0x8f7a('0x43')]({'where':{'id':_0x31938a[_0x8f7a('0x42')]['id']}})[_0x8f7a('0x23')](handleEntityNotFound(_0x22441b,null))[_0x8f7a('0x23')](saveUpdates(_0x31938a['body'],null))['then'](respondWithResult(_0x22441b,null))[_0x8f7a('0x41')](handleError(_0x22441b,null));};exports[_0x8f7a('0x24')]=function(_0x3e1d3c,_0xf845be){return db[_0x8f7a('0x2a')][_0x8f7a('0x43')]({'where':{'id':_0x3e1d3c[_0x8f7a('0x42')]['id']}})[_0x8f7a('0x23')](handleEntityNotFound(_0xf845be,null))[_0x8f7a('0x23')](removeEntity(_0xf845be,null))[_0x8f7a('0x41')](handleError(_0xf845be,null));};exports[_0x8f7a('0x4d')]=function(_0x5682e4,_0x13fd98,_0x4fddd7){if(_0x5682e4[_0x8f7a('0x45')]['id']){delete _0x5682e4[_0x8f7a('0x45')]['id'];}return db[_0x8f7a('0x2a')][_0x8f7a('0x43')]({'where':{'id':_0x5682e4[_0x8f7a('0x42')]['id']}})[_0x8f7a('0x23')](handleEntityNotFound(_0x13fd98,null))[_0x8f7a('0x23')](function(_0x3ed8eb){if(_0x3ed8eb){_0x5682e4[_0x8f7a('0x45')][_0x8f7a('0x4e')]=_0x3ed8eb['id'];return db[_0x8f7a('0x4f')][_0x8f7a('0x44')](_0x5682e4[_0x8f7a('0x45')]);}})[_0x8f7a('0x23')](respondWithResult(_0x13fd98,null))[_0x8f7a('0x41')](handleError(_0x13fd98,null));};exports[_0x8f7a('0x50')]=function(_0x5a7eed,_0x32cb2c,_0x420616){if(_0x5a7eed[_0x8f7a('0x45')]['id']){delete _0x5a7eed[_0x8f7a('0x45')]['id'];}return db['Trigger']['find']({'where':{'id':_0x5a7eed[_0x8f7a('0x42')]['id']}})['then'](handleEntityNotFound(_0x32cb2c,null))[_0x8f7a('0x23')](function(_0x3a67d8){if(_0x3a67d8){_0x5a7eed[_0x8f7a('0x45')][_0x8f7a('0x51')]=_0x3a67d8['id'];return db['Condition']['create'](_0x5a7eed[_0x8f7a('0x45')]);}})['then'](respondWithResult(_0x32cb2c,null))[_0x8f7a('0x41')](handleError(_0x32cb2c,null));};exports['getAllConditions']=function(_0x2c1069,_0xe2575,_0x204a4c){var _0x3369db={};var _0x7f98be={};var _0x4d1637;var _0x5f0efa;return db['Trigger'][_0x8f7a('0x52')]({'where':{'id':_0x2c1069[_0x8f7a('0x42')]['id']}})[_0x8f7a('0x23')](handleEntityNotFound(_0xe2575,null))[_0x8f7a('0x23')](function(_0xce6502){if(_0xce6502){_0x4d1637=_0xce6502;_0x7f98be[_0x8f7a('0x2c')]=_[_0x8f7a('0x2d')](db[_0x8f7a('0x4f')][_0x8f7a('0x2b')]);_0x7f98be[_0x8f7a('0x2e')]=_[_0x8f7a('0x2d')](_0x2c1069['query']);_0x7f98be[_0x8f7a('0x2f')]=_[_0x8f7a('0x30')](_0x7f98be[_0x8f7a('0x2c')],_0x7f98be['query']);_0x3369db[_0x8f7a('0x32')]=_[_0x8f7a('0x30')](_0x7f98be['model'],qs[_0x8f7a('0x31')](_0x2c1069[_0x8f7a('0x2e')][_0x8f7a('0x31')]));_0x3369db[_0x8f7a('0x32')]=_0x3369db[_0x8f7a('0x32')]['length']?_0x3369db[_0x8f7a('0x32')]:_0x7f98be[_0x8f7a('0x2c')];_0x3369db[_0x8f7a('0x36')]=qs[_0x8f7a('0x37')](_0x2c1069[_0x8f7a('0x2e')][_0x8f7a('0x37')]);_0x3369db[_0x8f7a('0x53')]=qs[_0x8f7a('0x2f')](_[_0x8f7a('0x54')](_0x2c1069[_0x8f7a('0x2e')],_0x7f98be[_0x8f7a('0x2f')]));if(_0x2c1069[_0x8f7a('0x2e')]['filter']){_0x3369db[_0x8f7a('0x53')]=_[_0x8f7a('0x3b')](_0x3369db['where'],{'$or':_[_0x8f7a('0x55')](_0x3369db[_0x8f7a('0x32')],function(_0x22eb77){var _0x2e29fa={};_0x2e29fa[_0x22eb77]={'$like':'%'+_0x2c1069['query'][_0x8f7a('0x38')]+'%'};return _0x2e29fa;})});}_0x3369db=_[_0x8f7a('0x3b')]({},_0x3369db,_0x2c1069[_0x8f7a('0x3c')]);return _0x4d1637[_0x8f7a('0x56')](_0x3369db);}})[_0x8f7a('0x23')](function(_0x1468b4){if(_0x1468b4){_0x5f0efa=_0x1468b4[_0x8f7a('0x33')];if(!_0x2c1069[_0x8f7a('0x2e')][_0x8f7a('0x34')](_0x8f7a('0x35'))){_0x3369db['limit']=qs['limit'](_0x2c1069[_0x8f7a('0x2e')][_0x8f7a('0x1d')]);_0x3369db[_0x8f7a('0x1c')]=qs[_0x8f7a('0x1c')](_0x2c1069[_0x8f7a('0x2e')][_0x8f7a('0x1c')]);}return _0x4d1637[_0x8f7a('0x56')](_0x3369db);}})[_0x8f7a('0x23')](function(_0x5f03b2){if(_0x5f03b2){return _0x5f03b2?{'count':_0x5f0efa,'rows':_0x5f03b2}:null;}})[_0x8f7a('0x23')](respondWithResult(_0xe2575,null))[_0x8f7a('0x41')](handleError(_0xe2575,null));};exports[_0x8f7a('0x57')]=function(_0x13d564,_0x264b0e,_0x381e43){var _0x16cd8c={};var _0x1e72ec={};var _0x20a513;var _0x9b420a;return db[_0x8f7a('0x2a')][_0x8f7a('0x52')]({'where':{'id':_0x13d564[_0x8f7a('0x42')]['id']}})['then'](handleEntityNotFound(_0x264b0e,null))['then'](function(_0x54c425){if(_0x54c425){_0x20a513=_0x54c425;_0x1e72ec[_0x8f7a('0x2c')]=_[_0x8f7a('0x2d')](db['Condition']['rawAttributes']);_0x1e72ec[_0x8f7a('0x2e')]=_[_0x8f7a('0x2d')](_0x13d564['query']);_0x1e72ec[_0x8f7a('0x2f')]=_['intersection'](_0x1e72ec['model'],_0x1e72ec[_0x8f7a('0x2e')]);_0x16cd8c[_0x8f7a('0x32')]=_[_0x8f7a('0x30')](_0x1e72ec[_0x8f7a('0x2c')],qs[_0x8f7a('0x31')](_0x13d564['query'][_0x8f7a('0x31')]));_0x16cd8c['attributes']=_0x16cd8c[_0x8f7a('0x32')]['length']?_0x16cd8c[_0x8f7a('0x32')]:_0x1e72ec[_0x8f7a('0x2c')];_0x16cd8c[_0x8f7a('0x36')]=qs['sort'](_0x13d564[_0x8f7a('0x2e')]['sort']);_0x16cd8c['where']=qs[_0x8f7a('0x2f')](_['pick'](_0x13d564[_0x8f7a('0x2e')],_0x1e72ec[_0x8f7a('0x2f')]));if(_0x13d564[_0x8f7a('0x2e')][_0x8f7a('0x38')]){_0x16cd8c[_0x8f7a('0x53')]=_[_0x8f7a('0x3b')](_0x16cd8c[_0x8f7a('0x53')],{'$or':_[_0x8f7a('0x55')](_0x16cd8c['attributes'],function(_0x4c588b){var _0x58072b={};_0x58072b[_0x4c588b]={'$like':'%'+_0x13d564[_0x8f7a('0x2e')][_0x8f7a('0x38')]+'%'};return _0x58072b;})});}_0x16cd8c=_[_0x8f7a('0x3b')]({},_0x16cd8c,_0x13d564[_0x8f7a('0x3c')]);return _0x20a513['getAnyConditions'](_0x16cd8c);}})[_0x8f7a('0x23')](function(_0x12aac6){if(_0x12aac6){_0x9b420a=_0x12aac6[_0x8f7a('0x33')];if(!_0x13d564[_0x8f7a('0x2e')][_0x8f7a('0x34')]('nolimit')){_0x16cd8c[_0x8f7a('0x1d')]=qs[_0x8f7a('0x1d')](_0x13d564['query'][_0x8f7a('0x1d')]);_0x16cd8c[_0x8f7a('0x1c')]=qs[_0x8f7a('0x1c')](_0x13d564[_0x8f7a('0x2e')][_0x8f7a('0x1c')]);}return _0x20a513[_0x8f7a('0x57')](_0x16cd8c);}})[_0x8f7a('0x23')](function(_0x52b09d){if(_0x52b09d){return _0x52b09d?{'count':_0x9b420a,'rows':_0x52b09d}:null;}})[_0x8f7a('0x23')](respondWithResult(_0x264b0e,null))['catch'](handleError(_0x264b0e,null));};exports[_0x8f7a('0x58')]=function(_0x538a3d,_0xaa4d79,_0x4bb9ce){if(_0x538a3d['body']['id']){delete _0x538a3d[_0x8f7a('0x45')]['id'];}return db[_0x8f7a('0x2a')][_0x8f7a('0x43')]({'where':{'id':_0x538a3d[_0x8f7a('0x42')]['id']}})['then'](handleEntityNotFound(_0xaa4d79,null))[_0x8f7a('0x23')](function(_0x284c09){if(_0x284c09){_0x538a3d[_0x8f7a('0x45')]['TriggerId']=_0x284c09['id'];return db[_0x8f7a('0x59')][_0x8f7a('0x44')](_0x538a3d[_0x8f7a('0x45')]);}})[_0x8f7a('0x23')](respondWithResult(_0xaa4d79,null))[_0x8f7a('0x41')](handleError(_0xaa4d79,null));};exports[_0x8f7a('0x5a')]=function(_0x2fea39,_0x3c8514,_0x58c15f){var _0x51c7a2={};var _0x4afa2c={};var _0x52a8e2;var _0x1ed7e9;return db[_0x8f7a('0x2a')][_0x8f7a('0x52')]({'where':{'id':_0x2fea39[_0x8f7a('0x42')]['id']}})[_0x8f7a('0x23')](handleEntityNotFound(_0x3c8514,null))[_0x8f7a('0x23')](function(_0x13b954){if(_0x13b954){_0x52a8e2=_0x13b954;_0x4afa2c[_0x8f7a('0x2c')]=_[_0x8f7a('0x2d')](db[_0x8f7a('0x59')][_0x8f7a('0x2b')]);_0x4afa2c['query']=_[_0x8f7a('0x2d')](_0x2fea39[_0x8f7a('0x2e')]);_0x4afa2c[_0x8f7a('0x2f')]=_[_0x8f7a('0x30')](_0x4afa2c[_0x8f7a('0x2c')],_0x4afa2c[_0x8f7a('0x2e')]);_0x51c7a2[_0x8f7a('0x32')]=_['intersection'](_0x4afa2c[_0x8f7a('0x2c')],qs[_0x8f7a('0x31')](_0x2fea39['query'][_0x8f7a('0x31')]));_0x51c7a2[_0x8f7a('0x32')]=_0x51c7a2[_0x8f7a('0x32')][_0x8f7a('0x33')]?_0x51c7a2[_0x8f7a('0x32')]:_0x4afa2c[_0x8f7a('0x2c')];_0x51c7a2['order']=qs[_0x8f7a('0x37')](_0x2fea39['query'][_0x8f7a('0x37')]);_0x51c7a2[_0x8f7a('0x53')]=qs['filters'](_[_0x8f7a('0x54')](_0x2fea39[_0x8f7a('0x2e')],_0x4afa2c[_0x8f7a('0x2f')]));if(_0x2fea39['query'][_0x8f7a('0x38')]){_0x51c7a2[_0x8f7a('0x53')]=_['merge'](_0x51c7a2[_0x8f7a('0x53')],{'$or':_[_0x8f7a('0x55')](_0x51c7a2[_0x8f7a('0x32')],function(_0x25f9e9){var _0x1521c0={};_0x1521c0[_0x25f9e9]={'$like':'%'+_0x2fea39[_0x8f7a('0x2e')]['filter']+'%'};return _0x1521c0;})});}_0x51c7a2=_['merge']({},_0x51c7a2,_0x2fea39[_0x8f7a('0x3c')]);return _0x52a8e2[_0x8f7a('0x5a')](_0x51c7a2);}})[_0x8f7a('0x23')](function(_0x466084){if(_0x466084){_0x1ed7e9=_0x466084[_0x8f7a('0x33')];if(!_0x2fea39[_0x8f7a('0x2e')][_0x8f7a('0x34')](_0x8f7a('0x35'))){_0x51c7a2['limit']=qs[_0x8f7a('0x1d')](_0x2fea39[_0x8f7a('0x2e')][_0x8f7a('0x1d')]);_0x51c7a2[_0x8f7a('0x1c')]=qs[_0x8f7a('0x1c')](_0x2fea39[_0x8f7a('0x2e')][_0x8f7a('0x1c')]);}return _0x52a8e2[_0x8f7a('0x5a')](_0x51c7a2);}})['then'](function(_0xbef843){if(_0xbef843){return _0xbef843?{'count':_0x1ed7e9,'rows':_0xbef843}:null;}})[_0x8f7a('0x23')](respondWithResult(_0x3c8514,null))[_0x8f7a('0x41')](handleError(_0x3c8514,null));}; \ No newline at end of file +var _0x5acb=['addAction','TriggerId','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','rawAttributes','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','type','VIRTUAL','field','merge','options','Trigger','include','findAll','rows','catch','show','params','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','order','pick','map','getAnyConditions'];(function(_0x54550e,_0x45bf45){var _0x56b007=function(_0x42fa05){while(--_0x42fa05){_0x54550e['push'](_0x54550e['shift']());}};_0x56b007(++_0x45bf45);}(_0x5acb,0x123));var _0xb5ac=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5acb[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xb5ac('0x0'));var emlformat=require(_0xb5ac('0x1'));var rimraf=require(_0xb5ac('0x2'));var zipdir=require(_0xb5ac('0x3'));var jsonpatch=require(_0xb5ac('0x4'));var rp=require('request-promise');var moment=require(_0xb5ac('0x5'));var BPromise=require(_0xb5ac('0x6'));var Mustache=require('mustache');var util=require(_0xb5ac('0x7'));var path=require(_0xb5ac('0x8'));var sox=require(_0xb5ac('0x9'));var csv=require(_0xb5ac('0xa'));var ejs=require(_0xb5ac('0xb'));var fs=require('fs');var _=require(_0xb5ac('0xc'));var squel=require(_0xb5ac('0xd'));var crypto=require(_0xb5ac('0xe'));var jsforce=require(_0xb5ac('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb5ac('0xa'));var querystring=require(_0xb5ac('0x10'));var Papa=require(_0xb5ac('0x11'));var authService=require(_0xb5ac('0x12'));var hardwareService=require(_0xb5ac('0x13'));var Redis=require(_0xb5ac('0x14'));var qs=require(_0xb5ac('0x15'));var logger=require(_0xb5ac('0x16'))('api');var utils=require(_0xb5ac('0x17'));var config=require(_0xb5ac('0x18'));var db=require(_0xb5ac('0x19'))['db'];function respondWithStatusCode(_0x2d431a,_0x2a3c01){_0x2a3c01=_0x2a3c01||0xcc;return function(_0x1fb96d){if(_0x1fb96d){return _0x2d431a[_0xb5ac('0x1a')](_0x2a3c01);}return _0x2d431a[_0xb5ac('0x1b')](_0x2a3c01)[_0xb5ac('0x1c')]();};}function respondWithResult(_0x4b44ee,_0x1fc510){_0x1fc510=_0x1fc510||0xc8;return function(_0x1446d6){if(_0x1446d6){return _0x4b44ee['status'](_0x1fc510)[_0xb5ac('0x1d')](_0x1446d6);}};}function respondWithFilteredResult(_0x23d128,_0x470440){return function(_0x35cecd){if(_0x35cecd){var _0x1f34b1=_0x35cecd[_0xb5ac('0x1e')],_0x5f247d=_0x470440[_0xb5ac('0x1f')],_0x10a4a6=_0x470440[_0xb5ac('0x1f')]+_0x470440[_0xb5ac('0x20')],_0x1fb518;if(_0x10a4a6>=_0x1f34b1){_0x10a4a6=_0x1f34b1;_0x1fb518=0xc8;}else{_0x1fb518=0xce;}_0x23d128[_0xb5ac('0x1b')](_0x1fb518);return _0x23d128[_0xb5ac('0x21')](_0xb5ac('0x22'),_0x5f247d+'-'+_0x10a4a6+'/'+_0x1f34b1)[_0xb5ac('0x1d')](_0x35cecd);}return null;};}function patchUpdates(_0x1dd008){return function(_0x5db65d){try{jsonpatch[_0xb5ac('0x23')](_0x5db65d,_0x1dd008,!![]);}catch(_0x35028a){return BPromise[_0xb5ac('0x24')](_0x35028a);}return _0x5db65d['save']();};}function saveUpdates(_0x57921f,_0x521b02){return function(_0x56e779){if(_0x56e779){return _0x56e779[_0xb5ac('0x25')](_0x57921f)[_0xb5ac('0x26')](function(_0x25251f){return _0x25251f;});}return null;};}function removeEntity(_0x28affb,_0xc6b6e4){return function(_0x2a3774){if(_0x2a3774){return _0x2a3774[_0xb5ac('0x27')]()[_0xb5ac('0x26')](function(){var _0x155078=_0x2a3774[_0xb5ac('0x28')]({'plain':!![]});var _0x30f13d='Triggers';return db[_0xb5ac('0x29')]['destroy']({'where':{'type':_0x30f13d,'resourceId':_0x155078['id']}})[_0xb5ac('0x26')](function(){return _0x2a3774;});})['then'](function(){_0x28affb[_0xb5ac('0x1b')](0xcc)[_0xb5ac('0x1c')]();});}};}function handleEntityNotFound(_0x56dc8c,_0x2262c0){return function(_0x563eb3){if(!_0x563eb3){_0x56dc8c[_0xb5ac('0x1a')](0x194);}return _0x563eb3;};}function handleError(_0x4d0724,_0x4888fb){_0x4888fb=_0x4888fb||0x1f4;return function(_0x4ca3e2){logger[_0xb5ac('0x2a')](_0x4ca3e2[_0xb5ac('0x2b')]);if(_0x4ca3e2[_0xb5ac('0x2c')]){delete _0x4ca3e2[_0xb5ac('0x2c')];}_0x4d0724['status'](_0x4888fb)[_0xb5ac('0x2d')](_0x4ca3e2);};}exports['index']=function(_0x1e1ed8,_0x5695e9){var _0x3194e1={},_0x4e473e={},_0x325252={'count':0x0,'rows':[]};var _0x16f40e=db['Trigger'][_0xb5ac('0x2e')];_0x4e473e[_0xb5ac('0x2f')]=_[_0xb5ac('0x30')](_0x16f40e);_0x4e473e[_0xb5ac('0x31')]=_[_0xb5ac('0x30')](_0x1e1ed8[_0xb5ac('0x31')]);_0x4e473e['filters']=_['intersection'](_0x4e473e[_0xb5ac('0x2f')],_0x4e473e[_0xb5ac('0x31')]);_0x3194e1[_0xb5ac('0x32')]=_[_0xb5ac('0x33')](_0x4e473e[_0xb5ac('0x2f')],qs[_0xb5ac('0x34')](_0x1e1ed8[_0xb5ac('0x31')][_0xb5ac('0x34')]));_0x3194e1[_0xb5ac('0x32')]=_0x3194e1['attributes'][_0xb5ac('0x35')]?_0x3194e1[_0xb5ac('0x32')]:_0x4e473e[_0xb5ac('0x2f')];if(!_0x1e1ed8[_0xb5ac('0x31')][_0xb5ac('0x36')](_0xb5ac('0x37'))){_0x3194e1[_0xb5ac('0x20')]=qs[_0xb5ac('0x20')](_0x1e1ed8[_0xb5ac('0x31')][_0xb5ac('0x20')]);_0x3194e1[_0xb5ac('0x1f')]=qs['offset'](_0x1e1ed8[_0xb5ac('0x31')][_0xb5ac('0x1f')]);}_0x3194e1['order']=qs[_0xb5ac('0x38')](_0x1e1ed8[_0xb5ac('0x31')][_0xb5ac('0x38')]);_0x3194e1[_0xb5ac('0x39')]=qs[_0xb5ac('0x3a')](_['pick'](_0x1e1ed8[_0xb5ac('0x31')],_0x4e473e['filters']));if(_0x1e1ed8[_0xb5ac('0x31')][_0xb5ac('0x3b')]){_0x3194e1[_0xb5ac('0x39')]=_['merge'](_0x3194e1[_0xb5ac('0x39')],{'$or':_['map'](_0x16f40e,function(_0x14132e){if(_0x14132e[_0xb5ac('0x3c')]['key']!==_0xb5ac('0x3d')){var _0x4196e5={};_0x4196e5[_0x14132e[_0xb5ac('0x3e')]]={'$like':'%'+_0x1e1ed8[_0xb5ac('0x31')][_0xb5ac('0x3b')]+'%'};return _0x4196e5;}})});}_0x3194e1=_[_0xb5ac('0x3f')]({},_0x3194e1,_0x1e1ed8[_0xb5ac('0x40')]);var _0x1ec890={'where':_0x3194e1['where']};return db[_0xb5ac('0x41')][_0xb5ac('0x1e')](_0x1ec890)[_0xb5ac('0x26')](function(_0x4069e5){_0x325252['count']=_0x4069e5;if(_0x1e1ed8['query']['includeAll']){_0x3194e1[_0xb5ac('0x42')]=[{'all':!![]}];}return db[_0xb5ac('0x41')][_0xb5ac('0x43')](_0x3194e1);})['then'](function(_0x14e3e2){_0x325252[_0xb5ac('0x44')]=_0x14e3e2;return _0x325252;})[_0xb5ac('0x26')](respondWithFilteredResult(_0x5695e9,_0x3194e1))[_0xb5ac('0x45')](handleError(_0x5695e9,null));};exports[_0xb5ac('0x46')]=function(_0x5551b8,_0x131588){var _0x53ac30={'raw':![],'where':{'id':_0x5551b8[_0xb5ac('0x47')]['id']}},_0x4f9aaa={};_0x4f9aaa[_0xb5ac('0x2f')]=_[_0xb5ac('0x30')](db[_0xb5ac('0x41')][_0xb5ac('0x2e')]);_0x4f9aaa['query']=_['keys'](_0x5551b8['query']);_0x4f9aaa[_0xb5ac('0x3a')]=_[_0xb5ac('0x33')](_0x4f9aaa[_0xb5ac('0x2f')],_0x4f9aaa['query']);_0x53ac30[_0xb5ac('0x32')]=_['intersection'](_0x4f9aaa[_0xb5ac('0x2f')],qs[_0xb5ac('0x34')](_0x5551b8[_0xb5ac('0x31')][_0xb5ac('0x34')]));_0x53ac30[_0xb5ac('0x32')]=_0x53ac30[_0xb5ac('0x32')][_0xb5ac('0x35')]?_0x53ac30[_0xb5ac('0x32')]:_0x4f9aaa[_0xb5ac('0x2f')];if(_0x5551b8[_0xb5ac('0x31')][_0xb5ac('0x48')]){_0x53ac30[_0xb5ac('0x42')]=[{'all':!![]}];}_0x53ac30=_[_0xb5ac('0x3f')]({},_0x53ac30,_0x5551b8['options']);return db['Trigger'][_0xb5ac('0x49')](_0x53ac30)[_0xb5ac('0x26')](handleEntityNotFound(_0x131588,null))[_0xb5ac('0x26')](respondWithResult(_0x131588,null))[_0xb5ac('0x45')](handleError(_0x131588,null));};exports[_0xb5ac('0x4a')]=function(_0x99be4e,_0x162ae8){return db[_0xb5ac('0x41')][_0xb5ac('0x4a')](_0x99be4e['body'],{})['then'](function(_0x1ff01c){var _0x58b476=_0x99be4e['user'][_0xb5ac('0x28')]({'plain':!![]});if(!_0x58b476)throw new Error(_0xb5ac('0x4b'));if(_0x58b476[_0xb5ac('0x4c')]==='user'){var _0xe57e62=_0x1ff01c['get']({'plain':!![]});var _0x40da64=_0xb5ac('0x4d');return db['UserProfileSection'][_0xb5ac('0x49')]({'where':{'name':_0x40da64,'userProfileId':_0x58b476[_0xb5ac('0x4e')]},'raw':!![]})['then'](function(_0x5ac9bd){if(_0x5ac9bd&&_0x5ac9bd[_0xb5ac('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0xe57e62['name'],'resourceId':_0xe57e62['id'],'type':_0x5ac9bd[_0xb5ac('0x2c')],'sectionId':_0x5ac9bd['id']},{})['then'](function(){return _0x1ff01c;});}else{return _0x1ff01c;}})[_0xb5ac('0x45')](function(_0x1fdaa4){logger['error'](_0xb5ac('0x50'),_0x1fdaa4);throw _0x1fdaa4;});}return _0x1ff01c;})['then'](respondWithResult(_0x162ae8,0xc9))[_0xb5ac('0x45')](handleError(_0x162ae8,null));};exports['update']=function(_0x4cc12c,_0x4d7e09){if(_0x4cc12c[_0xb5ac('0x51')]['id']){delete _0x4cc12c['body']['id'];}return db['Trigger'][_0xb5ac('0x49')]({'where':{'id':_0x4cc12c['params']['id']}})[_0xb5ac('0x26')](handleEntityNotFound(_0x4d7e09,null))[_0xb5ac('0x26')](saveUpdates(_0x4cc12c[_0xb5ac('0x51')],null))[_0xb5ac('0x26')](respondWithResult(_0x4d7e09,null))[_0xb5ac('0x45')](handleError(_0x4d7e09,null));};exports['destroy']=function(_0x785a67,_0x5bfd25){return db[_0xb5ac('0x41')]['find']({'where':{'id':_0x785a67[_0xb5ac('0x47')]['id']}})['then'](handleEntityNotFound(_0x5bfd25,null))['then'](removeEntity(_0x5bfd25,null))['catch'](handleError(_0x5bfd25,null));};exports[_0xb5ac('0x52')]=function(_0x32cd33,_0x579258,_0x566cad){if(_0x32cd33[_0xb5ac('0x51')]['id']){delete _0x32cd33[_0xb5ac('0x51')]['id'];}return db[_0xb5ac('0x41')][_0xb5ac('0x49')]({'where':{'id':_0x32cd33[_0xb5ac('0x47')]['id']}})[_0xb5ac('0x26')](handleEntityNotFound(_0x579258,null))[_0xb5ac('0x26')](function(_0x1a0089){if(_0x1a0089){_0x32cd33['body'][_0xb5ac('0x53')]=_0x1a0089['id'];return db['Condition'][_0xb5ac('0x4a')](_0x32cd33[_0xb5ac('0x51')]);}})[_0xb5ac('0x26')](respondWithResult(_0x579258,null))[_0xb5ac('0x45')](handleError(_0x579258,null));};exports[_0xb5ac('0x54')]=function(_0x2ed8a2,_0xa47727,_0x3986ed){if(_0x2ed8a2['body']['id']){delete _0x2ed8a2[_0xb5ac('0x51')]['id'];}return db['Trigger'][_0xb5ac('0x49')]({'where':{'id':_0x2ed8a2[_0xb5ac('0x47')]['id']}})['then'](handleEntityNotFound(_0xa47727,null))[_0xb5ac('0x26')](function(_0x488ed2){if(_0x488ed2){_0x2ed8a2[_0xb5ac('0x51')][_0xb5ac('0x55')]=_0x488ed2['id'];return db[_0xb5ac('0x56')][_0xb5ac('0x4a')](_0x2ed8a2[_0xb5ac('0x51')]);}})[_0xb5ac('0x26')](respondWithResult(_0xa47727,null))[_0xb5ac('0x45')](handleError(_0xa47727,null));};exports[_0xb5ac('0x57')]=function(_0x459e7d,_0x2a0bac,_0x424988){var _0x12c223={};var _0x302ac4={};var _0x121b18;var _0x4de572;return db[_0xb5ac('0x41')][_0xb5ac('0x58')]({'where':{'id':_0x459e7d[_0xb5ac('0x47')]['id']}})['then'](handleEntityNotFound(_0x2a0bac,null))[_0xb5ac('0x26')](function(_0x49b949){if(_0x49b949){_0x121b18=_0x49b949;_0x302ac4[_0xb5ac('0x2f')]=_[_0xb5ac('0x30')](db[_0xb5ac('0x56')][_0xb5ac('0x2e')]);_0x302ac4['query']=_[_0xb5ac('0x30')](_0x459e7d[_0xb5ac('0x31')]);_0x302ac4[_0xb5ac('0x3a')]=_[_0xb5ac('0x33')](_0x302ac4[_0xb5ac('0x2f')],_0x302ac4[_0xb5ac('0x31')]);_0x12c223[_0xb5ac('0x32')]=_[_0xb5ac('0x33')](_0x302ac4[_0xb5ac('0x2f')],qs[_0xb5ac('0x34')](_0x459e7d[_0xb5ac('0x31')][_0xb5ac('0x34')]));_0x12c223[_0xb5ac('0x32')]=_0x12c223[_0xb5ac('0x32')][_0xb5ac('0x35')]?_0x12c223[_0xb5ac('0x32')]:_0x302ac4['model'];_0x12c223[_0xb5ac('0x59')]=qs[_0xb5ac('0x38')](_0x459e7d['query'][_0xb5ac('0x38')]);_0x12c223[_0xb5ac('0x39')]=qs[_0xb5ac('0x3a')](_[_0xb5ac('0x5a')](_0x459e7d[_0xb5ac('0x31')],_0x302ac4['filters']));if(_0x459e7d['query'][_0xb5ac('0x3b')]){_0x12c223['where']=_[_0xb5ac('0x3f')](_0x12c223[_0xb5ac('0x39')],{'$or':_[_0xb5ac('0x5b')](_0x12c223[_0xb5ac('0x32')],function(_0x54fda5){var _0x15fea2={};_0x15fea2[_0x54fda5]={'$like':'%'+_0x459e7d[_0xb5ac('0x31')][_0xb5ac('0x3b')]+'%'};return _0x15fea2;})});}_0x12c223=_[_0xb5ac('0x3f')]({},_0x12c223,_0x459e7d[_0xb5ac('0x40')]);return _0x121b18['getAllConditions'](_0x12c223);}})['then'](function(_0x178d21){if(_0x178d21){_0x4de572=_0x178d21['length'];if(!_0x459e7d[_0xb5ac('0x31')][_0xb5ac('0x36')](_0xb5ac('0x37'))){_0x12c223['limit']=qs[_0xb5ac('0x20')](_0x459e7d['query']['limit']);_0x12c223[_0xb5ac('0x1f')]=qs[_0xb5ac('0x1f')](_0x459e7d[_0xb5ac('0x31')][_0xb5ac('0x1f')]);}return _0x121b18[_0xb5ac('0x57')](_0x12c223);}})[_0xb5ac('0x26')](function(_0x5deb2e){if(_0x5deb2e){return _0x5deb2e?{'count':_0x4de572,'rows':_0x5deb2e}:null;}})[_0xb5ac('0x26')](respondWithResult(_0x2a0bac,null))[_0xb5ac('0x45')](handleError(_0x2a0bac,null));};exports['getAnyConditions']=function(_0x2791d6,_0x51f4b8,_0x4eb732){var _0x457f5c={};var _0x339de9={};var _0xdbdd24;var _0x34d435;return db['Trigger'][_0xb5ac('0x58')]({'where':{'id':_0x2791d6[_0xb5ac('0x47')]['id']}})[_0xb5ac('0x26')](handleEntityNotFound(_0x51f4b8,null))[_0xb5ac('0x26')](function(_0x28a6c7){if(_0x28a6c7){_0xdbdd24=_0x28a6c7;_0x339de9[_0xb5ac('0x2f')]=_[_0xb5ac('0x30')](db[_0xb5ac('0x56')][_0xb5ac('0x2e')]);_0x339de9[_0xb5ac('0x31')]=_[_0xb5ac('0x30')](_0x2791d6[_0xb5ac('0x31')]);_0x339de9[_0xb5ac('0x3a')]=_[_0xb5ac('0x33')](_0x339de9[_0xb5ac('0x2f')],_0x339de9[_0xb5ac('0x31')]);_0x457f5c['attributes']=_[_0xb5ac('0x33')](_0x339de9[_0xb5ac('0x2f')],qs[_0xb5ac('0x34')](_0x2791d6[_0xb5ac('0x31')][_0xb5ac('0x34')]));_0x457f5c[_0xb5ac('0x32')]=_0x457f5c[_0xb5ac('0x32')][_0xb5ac('0x35')]?_0x457f5c['attributes']:_0x339de9[_0xb5ac('0x2f')];_0x457f5c['order']=qs[_0xb5ac('0x38')](_0x2791d6[_0xb5ac('0x31')][_0xb5ac('0x38')]);_0x457f5c[_0xb5ac('0x39')]=qs['filters'](_[_0xb5ac('0x5a')](_0x2791d6[_0xb5ac('0x31')],_0x339de9[_0xb5ac('0x3a')]));if(_0x2791d6[_0xb5ac('0x31')][_0xb5ac('0x3b')]){_0x457f5c[_0xb5ac('0x39')]=_[_0xb5ac('0x3f')](_0x457f5c['where'],{'$or':_[_0xb5ac('0x5b')](_0x457f5c['attributes'],function(_0x40db1f){var _0x93530e={};_0x93530e[_0x40db1f]={'$like':'%'+_0x2791d6[_0xb5ac('0x31')][_0xb5ac('0x3b')]+'%'};return _0x93530e;})});}_0x457f5c=_['merge']({},_0x457f5c,_0x2791d6[_0xb5ac('0x40')]);return _0xdbdd24[_0xb5ac('0x5c')](_0x457f5c);}})[_0xb5ac('0x26')](function(_0x2d6c81){if(_0x2d6c81){_0x34d435=_0x2d6c81[_0xb5ac('0x35')];if(!_0x2791d6[_0xb5ac('0x31')][_0xb5ac('0x36')]('nolimit')){_0x457f5c[_0xb5ac('0x20')]=qs[_0xb5ac('0x20')](_0x2791d6[_0xb5ac('0x31')][_0xb5ac('0x20')]);_0x457f5c[_0xb5ac('0x1f')]=qs[_0xb5ac('0x1f')](_0x2791d6['query']['offset']);}return _0xdbdd24[_0xb5ac('0x5c')](_0x457f5c);}})[_0xb5ac('0x26')](function(_0x845de6){if(_0x845de6){return _0x845de6?{'count':_0x34d435,'rows':_0x845de6}:null;}})[_0xb5ac('0x26')](respondWithResult(_0x51f4b8,null))['catch'](handleError(_0x51f4b8,null));};exports[_0xb5ac('0x5d')]=function(_0x3699c0,_0x49af5a,_0x21c7a7){if(_0x3699c0[_0xb5ac('0x51')]['id']){delete _0x3699c0[_0xb5ac('0x51')]['id'];}return db['Trigger'][_0xb5ac('0x49')]({'where':{'id':_0x3699c0[_0xb5ac('0x47')]['id']}})[_0xb5ac('0x26')](handleEntityNotFound(_0x49af5a,null))[_0xb5ac('0x26')](function(_0x520008){if(_0x520008){_0x3699c0[_0xb5ac('0x51')][_0xb5ac('0x5e')]=_0x520008['id'];return db['Action'][_0xb5ac('0x4a')](_0x3699c0[_0xb5ac('0x51')]);}})[_0xb5ac('0x26')](respondWithResult(_0x49af5a,null))[_0xb5ac('0x45')](handleError(_0x49af5a,null));};exports[_0xb5ac('0x5f')]=function(_0x26e8dd,_0x26a355,_0x290e4c){var _0x2c60e5={};var _0x2517ac={};var _0x4fed3d;var _0x47c905;return db[_0xb5ac('0x41')][_0xb5ac('0x58')]({'where':{'id':_0x26e8dd[_0xb5ac('0x47')]['id']}})['then'](handleEntityNotFound(_0x26a355,null))[_0xb5ac('0x26')](function(_0x264343){if(_0x264343){_0x4fed3d=_0x264343;_0x2517ac[_0xb5ac('0x2f')]=_[_0xb5ac('0x30')](db['Action'][_0xb5ac('0x2e')]);_0x2517ac[_0xb5ac('0x31')]=_[_0xb5ac('0x30')](_0x26e8dd[_0xb5ac('0x31')]);_0x2517ac['filters']=_['intersection'](_0x2517ac['model'],_0x2517ac[_0xb5ac('0x31')]);_0x2c60e5[_0xb5ac('0x32')]=_['intersection'](_0x2517ac[_0xb5ac('0x2f')],qs[_0xb5ac('0x34')](_0x26e8dd[_0xb5ac('0x31')]['fields']));_0x2c60e5['attributes']=_0x2c60e5[_0xb5ac('0x32')]['length']?_0x2c60e5[_0xb5ac('0x32')]:_0x2517ac[_0xb5ac('0x2f')];_0x2c60e5[_0xb5ac('0x59')]=qs[_0xb5ac('0x38')](_0x26e8dd[_0xb5ac('0x31')]['sort']);_0x2c60e5[_0xb5ac('0x39')]=qs[_0xb5ac('0x3a')](_[_0xb5ac('0x5a')](_0x26e8dd[_0xb5ac('0x31')],_0x2517ac[_0xb5ac('0x3a')]));if(_0x26e8dd['query'][_0xb5ac('0x3b')]){_0x2c60e5[_0xb5ac('0x39')]=_[_0xb5ac('0x3f')](_0x2c60e5[_0xb5ac('0x39')],{'$or':_[_0xb5ac('0x5b')](_0x2c60e5[_0xb5ac('0x32')],function(_0x1670b6){var _0x27e92={};_0x27e92[_0x1670b6]={'$like':'%'+_0x26e8dd[_0xb5ac('0x31')]['filter']+'%'};return _0x27e92;})});}_0x2c60e5=_[_0xb5ac('0x3f')]({},_0x2c60e5,_0x26e8dd[_0xb5ac('0x40')]);return _0x4fed3d[_0xb5ac('0x5f')](_0x2c60e5);}})['then'](function(_0x341a86){if(_0x341a86){_0x47c905=_0x341a86[_0xb5ac('0x35')];if(!_0x26e8dd[_0xb5ac('0x31')]['hasOwnProperty'](_0xb5ac('0x37'))){_0x2c60e5['limit']=qs[_0xb5ac('0x20')](_0x26e8dd[_0xb5ac('0x31')][_0xb5ac('0x20')]);_0x2c60e5[_0xb5ac('0x1f')]=qs['offset'](_0x26e8dd[_0xb5ac('0x31')][_0xb5ac('0x1f')]);}return _0x4fed3d[_0xb5ac('0x5f')](_0x2c60e5);}})['then'](function(_0x1ac602){if(_0x1ac602){return _0x1ac602?{'count':_0x47c905,'rows':_0x1ac602}:null;}})[_0xb5ac('0x26')](respondWithResult(_0x26a355,null))[_0xb5ac('0x45')](handleError(_0x26a355,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 6a8e5e1..76c924d 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 _0x2e7d=['api','moment','request-promise','./trigger.attributes','exports','define','tools_triggers','util','../../config/logger'];(function(_0x1f1307,_0x1011ed){var _0x131798=function(_0x33343f){while(--_0x33343f){_0x1f1307['push'](_0x1f1307['shift']());}};_0x131798(++_0x1011ed);}(_0x2e7d,0x103));var _0xd2e7=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x2e7d[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0xd2e7('0x0'));var logger=require(_0xd2e7('0x1'))(_0xd2e7('0x2'));var moment=require(_0xd2e7('0x3'));var BPromise=require('bluebird');var rp=require(_0xd2e7('0x4'));var attributes=require(_0xd2e7('0x5'));module[_0xd2e7('0x6')]=function(_0x1d2dc7,_0x500052){return _0x1d2dc7[_0xd2e7('0x7')]('Trigger',attributes,{'tableName':_0xd2e7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3efd=['util','../../config/logger','api','moment','request-promise','./trigger.attributes','exports','define','Trigger','tools_triggers'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x3efd,0x168));var _0xd3ef=function(_0x37600c,_0x542ff5){_0x37600c=_0x37600c-0x0;var _0x3fa7ba=_0x3efd[_0x37600c];return _0x3fa7ba;};'use strict';var _=require('lodash');var util=require(_0xd3ef('0x0'));var logger=require(_0xd3ef('0x1'))(_0xd3ef('0x2'));var moment=require(_0xd3ef('0x3'));var BPromise=require('bluebird');var rp=require(_0xd3ef('0x4'));var attributes=require(_0xd3ef('0x5'));module[_0xd3ef('0x6')]=function(_0x1f18f5,_0x70f00f){return _0x1f18f5[_0xd3ef('0x7')](_0xd3ef('0x8'),attributes,{'tableName':_0xd3ef('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 48dd3bf..1f21596 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 _0xb34c=['debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','include','model','find','map','then','ShowTrigger','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent'];(function(_0xaf7611,_0x3a62fd){var _0x186aac=function(_0x530890){while(--_0x530890){_0xaf7611['push'](_0xaf7611['shift']());}};_0x186aac(++_0x3a62fd);}(_0xb34c,0x125));var _0xcb34=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb34c[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xcb34('0x0'));var util=require('util');var moment=require(_0xcb34('0x1'));var BPromise=require(_0xcb34('0x2'));var rs=require(_0xcb34('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb34('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb34('0x5'))(_0xcb34('0x6'));var config=require(_0xcb34('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcb34('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57c0e7,_0x37539c,_0x43d5d0){return new BPromise(function(_0x460c3e,_0x23de9f){return client[_0xcb34('0x9')](_0x57c0e7,_0x43d5d0)['then'](function(_0x15f43f){logger[_0xcb34('0xa')](_0xcb34('0xb'),_0x37539c,_0xcb34('0xc'));logger[_0xcb34('0xd')](_0xcb34('0xe'),_0x37539c,_0xcb34('0xc'),JSON[_0xcb34('0xf')](_0x15f43f));if(_0x15f43f['error']){if(_0x15f43f[_0xcb34('0x10')][_0xcb34('0x11')]===0x1f4){logger[_0xcb34('0x10')](_0xcb34('0xb'),_0x37539c,_0x15f43f[_0xcb34('0x10')]['message']);return _0x23de9f(_0x15f43f[_0xcb34('0x10')][_0xcb34('0x12')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x37539c,_0x15f43f[_0xcb34('0x10')][_0xcb34('0x12')]);return _0x460c3e(_0x15f43f[_0xcb34('0x10')][_0xcb34('0x12')]);}else{logger['info'](_0xcb34('0xb'),_0x37539c,_0xcb34('0xc'));_0x460c3e(_0x15f43f[_0xcb34('0x13')][_0xcb34('0x12')]);}})[_0xcb34('0x14')](function(_0x33c7c1){logger[_0xcb34('0x10')](_0xcb34('0xb'),_0x37539c,_0x33c7c1);_0x23de9f(_0x33c7c1);});});}exports[_0xcb34('0x15')]=function(_0x435909){var _0x33148f=this;return new Promise(function(_0x48d196,_0x3f1656){return db[_0xcb34('0x16')][_0xcb34('0x17')]({'raw':_0x435909[_0xcb34('0x18')]?_0x435909['options'][_0xcb34('0x19')]===undefined?!![]:![]:!![],'where':_0x435909[_0xcb34('0x18')]?_0x435909[_0xcb34('0x18')][_0xcb34('0x1a')]||null:null,'attributes':_0x435909[_0xcb34('0x18')]?_0x435909[_0xcb34('0x18')][_0xcb34('0x1b')]||null:null,'limit':_0x435909[_0xcb34('0x18')]?_0x435909[_0xcb34('0x18')]['limit']||null:null,'include':_0x435909[_0xcb34('0x18')]?_0x435909[_0xcb34('0x18')][_0xcb34('0x1c')]?_['map'](_0x435909['options'][_0xcb34('0x1c')],function(_0x4a421e){return{'model':db[_0x4a421e[_0xcb34('0x1d')]],'as':_0x4a421e['as'],'attributes':_0x4a421e[_0xcb34('0x1b')],'include':_0x4a421e['include']?_['map'](_0x4a421e[_0xcb34('0x1c')],function(_0x416f0d){return{'model':db[_0x416f0d[_0xcb34('0x1d')]],'as':_0x416f0d['as'],'attributes':_0x416f0d[_0xcb34('0x1b')],'include':_0x416f0d[_0xcb34('0x1c')]?_['map'](_0x416f0d[_0xcb34('0x1c')],function(_0xa112f6){return{'model':db[_0xa112f6['model']],'as':_0xa112f6['as'],'attributes':_0xa112f6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3287d6){logger[_0xcb34('0xa')](_0xcb34('0x15'),_0x435909);logger[_0xcb34('0xd')]('GetTrigger',_0x435909,JSON[_0xcb34('0xf')](_0x3287d6));_0x48d196(_0x3287d6);})[_0xcb34('0x14')](function(_0x5c88ca){logger['error'](_0xcb34('0x15'),_0x5c88ca[_0xcb34('0x12')],_0x435909);_0x3f1656(_0x33148f[_0xcb34('0x10')](0x1f4,_0x5c88ca[_0xcb34('0x12')]));});});};exports['ShowTrigger']=function(_0x237aec){var _0x42ada1=this;return new Promise(function(_0x4affae,_0xed06ae){return db[_0xcb34('0x16')][_0xcb34('0x1e')]({'raw':_0x237aec[_0xcb34('0x18')]?_0x237aec[_0xcb34('0x18')][_0xcb34('0x19')]===undefined?!![]:![]:!![],'where':_0x237aec[_0xcb34('0x18')]?_0x237aec[_0xcb34('0x18')][_0xcb34('0x1a')]||null:null,'attributes':_0x237aec[_0xcb34('0x18')]?_0x237aec[_0xcb34('0x18')]['attributes']||null:null,'include':_0x237aec[_0xcb34('0x18')]?_0x237aec[_0xcb34('0x18')]['include']?_[_0xcb34('0x1f')](_0x237aec[_0xcb34('0x18')][_0xcb34('0x1c')],function(_0x9fa6a3){return{'model':db[_0x9fa6a3['model']],'as':_0x9fa6a3['as'],'attributes':_0x9fa6a3['attributes'],'include':_0x9fa6a3['include']?_[_0xcb34('0x1f')](_0x9fa6a3['include'],function(_0x2f75bb){return{'model':db[_0x2f75bb[_0xcb34('0x1d')]],'as':_0x2f75bb['as'],'attributes':_0x2f75bb['attributes'],'include':_0x2f75bb[_0xcb34('0x1c')]?_['map'](_0x2f75bb[_0xcb34('0x1c')],function(_0x508ea4){return{'model':db[_0x508ea4[_0xcb34('0x1d')]],'as':_0x508ea4['as'],'attributes':_0x508ea4[_0xcb34('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xcb34('0x20')](function(_0x135851){logger[_0xcb34('0xa')]('ShowTrigger',_0x237aec);logger['debug'](_0xcb34('0x21'),_0x237aec,JSON[_0xcb34('0xf')](_0x135851));_0x4affae(_0x135851);})[_0xcb34('0x14')](function(_0xa48d43){logger['error'](_0xcb34('0x21'),_0xa48d43['message'],_0x237aec);_0xed06ae(_0x42ada1[_0xcb34('0x10')](0x1f4,_0xa48d43[_0xcb34('0x12')]));});});}; \ No newline at end of file +var _0xf7d3=['map','model','ShowTrigger','Trigger','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','findAll','options','raw','where','attributes','limit','include'];(function(_0x2421e1,_0x17b4ee){var _0x465805=function(_0x531315){while(--_0x531315){_0x2421e1['push'](_0x2421e1['shift']());}};_0x465805(++_0x17b4ee);}(_0xf7d3,0x16c));var _0x3f7d=function(_0x32947a,_0x9d3597){_0x32947a=_0x32947a-0x0;var _0x2f072a=_0xf7d3[_0x32947a];return _0x2f072a;};'use strict';var _=require('lodash');var util=require(_0x3f7d('0x0'));var moment=require(_0x3f7d('0x1'));var BPromise=require(_0x3f7d('0x2'));var rs=require(_0x3f7d('0x3'));var fs=require('fs');var Redis=require(_0x3f7d('0x4'));var db=require(_0x3f7d('0x5'))['db'];var utils=require(_0x3f7d('0x6'));var logger=require(_0x3f7d('0x7'))(_0x3f7d('0x8'));var config=require(_0x3f7d('0x9'));var jayson=require(_0x3f7d('0xa'));var client=jayson[_0x3f7d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x824e4e,_0x4db3c3,_0x50a7f8){return new BPromise(function(_0xdab1ba,_0x4fbc58){return client[_0x3f7d('0xc')](_0x824e4e,_0x50a7f8)[_0x3f7d('0xd')](function(_0x1468d7){logger[_0x3f7d('0xe')]('Trigger,\x20%s,\x20%s',_0x4db3c3,_0x3f7d('0xf'));logger[_0x3f7d('0x10')]('Trigger,\x20%s,\x20%s,\x20%s',_0x4db3c3,_0x3f7d('0xf'),JSON[_0x3f7d('0x11')](_0x1468d7));if(_0x1468d7['error']){if(_0x1468d7[_0x3f7d('0x12')][_0x3f7d('0x13')]===0x1f4){logger[_0x3f7d('0x12')](_0x3f7d('0x14'),_0x4db3c3,_0x1468d7[_0x3f7d('0x12')][_0x3f7d('0x15')]);return _0x4fbc58(_0x1468d7[_0x3f7d('0x12')][_0x3f7d('0x15')]);}logger[_0x3f7d('0x12')](_0x3f7d('0x14'),_0x4db3c3,_0x1468d7[_0x3f7d('0x12')][_0x3f7d('0x15')]);return _0xdab1ba(_0x1468d7[_0x3f7d('0x12')][_0x3f7d('0x15')]);}else{logger[_0x3f7d('0xe')]('Trigger,\x20%s,\x20%s',_0x4db3c3,'request\x20sent');_0xdab1ba(_0x1468d7[_0x3f7d('0x16')][_0x3f7d('0x15')]);}})[_0x3f7d('0x17')](function(_0x225ebb){logger[_0x3f7d('0x12')]('Trigger,\x20%s,\x20%s',_0x4db3c3,_0x225ebb);_0x4fbc58(_0x225ebb);});});}exports[_0x3f7d('0x18')]=function(_0x486120){var _0x8240fb=this;return new Promise(function(_0x442844,_0x250605){return db['Trigger'][_0x3f7d('0x19')]({'raw':_0x486120['options']?_0x486120[_0x3f7d('0x1a')][_0x3f7d('0x1b')]===undefined?!![]:![]:!![],'where':_0x486120[_0x3f7d('0x1a')]?_0x486120[_0x3f7d('0x1a')][_0x3f7d('0x1c')]||null:null,'attributes':_0x486120[_0x3f7d('0x1a')]?_0x486120['options'][_0x3f7d('0x1d')]||null:null,'limit':_0x486120['options']?_0x486120[_0x3f7d('0x1a')][_0x3f7d('0x1e')]||null:null,'include':_0x486120['options']?_0x486120['options'][_0x3f7d('0x1f')]?_[_0x3f7d('0x20')](_0x486120[_0x3f7d('0x1a')]['include'],function(_0x83ef94){return{'model':db[_0x83ef94[_0x3f7d('0x21')]],'as':_0x83ef94['as'],'attributes':_0x83ef94[_0x3f7d('0x1d')],'include':_0x83ef94[_0x3f7d('0x1f')]?_[_0x3f7d('0x20')](_0x83ef94[_0x3f7d('0x1f')],function(_0x418bb4){return{'model':db[_0x418bb4[_0x3f7d('0x21')]],'as':_0x418bb4['as'],'attributes':_0x418bb4['attributes'],'include':_0x418bb4['include']?_[_0x3f7d('0x20')](_0x418bb4['include'],function(_0x4e2a09){return{'model':db[_0x4e2a09['model']],'as':_0x4e2a09['as'],'attributes':_0x4e2a09[_0x3f7d('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f0acd){logger[_0x3f7d('0xe')](_0x3f7d('0x18'),_0x486120);logger[_0x3f7d('0x10')]('GetTrigger',_0x486120,JSON[_0x3f7d('0x11')](_0x1f0acd));_0x442844(_0x1f0acd);})['catch'](function(_0x4f59fa){logger['error'](_0x3f7d('0x18'),_0x4f59fa['message'],_0x486120);_0x250605(_0x8240fb['error'](0x1f4,_0x4f59fa[_0x3f7d('0x15')]));});});};exports[_0x3f7d('0x22')]=function(_0x469ede){var _0x242193=this;return new Promise(function(_0x1f52f7,_0x2bb1c3){return db[_0x3f7d('0x23')]['find']({'raw':_0x469ede[_0x3f7d('0x1a')]?_0x469ede[_0x3f7d('0x1a')][_0x3f7d('0x1b')]===undefined?!![]:![]:!![],'where':_0x469ede[_0x3f7d('0x1a')]?_0x469ede[_0x3f7d('0x1a')][_0x3f7d('0x1c')]||null:null,'attributes':_0x469ede['options']?_0x469ede[_0x3f7d('0x1a')][_0x3f7d('0x1d')]||null:null,'include':_0x469ede['options']?_0x469ede[_0x3f7d('0x1a')][_0x3f7d('0x1f')]?_['map'](_0x469ede['options']['include'],function(_0x12b95b){return{'model':db[_0x12b95b[_0x3f7d('0x21')]],'as':_0x12b95b['as'],'attributes':_0x12b95b['attributes'],'include':_0x12b95b[_0x3f7d('0x1f')]?_['map'](_0x12b95b[_0x3f7d('0x1f')],function(_0x459191){return{'model':db[_0x459191[_0x3f7d('0x21')]],'as':_0x459191['as'],'attributes':_0x459191[_0x3f7d('0x1d')],'include':_0x459191['include']?_[_0x3f7d('0x20')](_0x459191[_0x3f7d('0x1f')],function(_0x1f01ee){return{'model':db[_0x1f01ee['model']],'as':_0x1f01ee['as'],'attributes':_0x1f01ee[_0x3f7d('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ad69f){logger[_0x3f7d('0xe')]('ShowTrigger',_0x469ede);logger[_0x3f7d('0x10')](_0x3f7d('0x22'),_0x469ede,JSON[_0x3f7d('0x11')](_0x1ad69f));_0x1f52f7(_0x1ad69f);})[_0x3f7d('0x17')](function(_0x58f18a){logger[_0x3f7d('0x12')]('ShowTrigger',_0x58f18a[_0x3f7d('0x15')],_0x469ede);_0x2bb1c3(_0x242193['error'](0x1f4,_0x58f18a[_0x3f7d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 9f0fd2b..55c77fb 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 _0x6617=['show','post','/:id/clone','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated'];(function(_0x530100,_0x186890){var _0x3bf99f=function(_0x4e2e96){while(--_0x4e2e96){_0x530100['push'](_0x530100['shift']());}};_0x3bf99f(++_0x186890);}(_0x6617,0x142));var _0x7661=function(_0x1b6311,_0x42ec20){_0x1b6311=_0x1b6311-0x0;var _0x25aab6=_0x6617[_0x1b6311];return _0x25aab6;};'use strict';var multer=require(_0x7661('0x0'));var util=require(_0x7661('0x1'));var path=require(_0x7661('0x2'));var timeout=require(_0x7661('0x3'));var express=require(_0x7661('0x4'));var router=express[_0x7661('0x5')]();var auth=require(_0x7661('0x6'));var interaction=require(_0x7661('0x7'));var config=require(_0x7661('0x8'));var controller=require(_0x7661('0x9'));router[_0x7661('0xa')]('/',auth['isAuthenticated'](),controller[_0x7661('0xb')]);router[_0x7661('0xa')](_0x7661('0xc'),auth[_0x7661('0xd')](),controller[_0x7661('0xe')]);router[_0x7661('0xf')](_0x7661('0x10'),auth[_0x7661('0xd')](),controller['clone']);router[_0x7661('0xf')]('/',auth[_0x7661('0xd')](),controller[_0x7661('0x11')]);router[_0x7661('0x12')]('/:id',auth[_0x7661('0xd')](),controller[_0x7661('0x13')]);router[_0x7661('0x14')](_0x7661('0xc'),auth[_0x7661('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb5ee=['update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./trunk.controller','isAuthenticated','index','show','post','/:id/clone','clone','create','put'];(function(_0x45bb89,_0xb21b76){var _0x1559bc=function(_0x431e88){while(--_0x431e88){_0x45bb89['push'](_0x45bb89['shift']());}};_0x1559bc(++_0xb21b76);}(_0xb5ee,0xe1));var _0xeb5e=function(_0x3d27a,_0x31311d){_0x3d27a=_0x3d27a-0x0;var _0x314fd7=_0xb5ee[_0x3d27a];return _0x314fd7;};'use strict';var multer=require(_0xeb5e('0x0'));var util=require(_0xeb5e('0x1'));var path=require(_0xeb5e('0x2'));var timeout=require(_0xeb5e('0x3'));var express=require(_0xeb5e('0x4'));var router=express[_0xeb5e('0x5')]();var auth=require(_0xeb5e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xeb5e('0x7'));var controller=require(_0xeb5e('0x8'));router['get']('/',auth[_0xeb5e('0x9')](),controller[_0xeb5e('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xeb5e('0xb')]);router[_0xeb5e('0xc')](_0xeb5e('0xd'),auth[_0xeb5e('0x9')](),controller[_0xeb5e('0xe')]);router['post']('/',auth[_0xeb5e('0x9')](),controller[_0xeb5e('0xf')]);router[_0xeb5e('0x10')]('/:id',auth[_0xeb5e('0x9')](),controller[_0xeb5e('0x11')]);router[_0xeb5e('0x12')](_0xeb5e('0x13'),auth[_0xeb5e('0x9')](),controller[_0xeb5e('0x14')]);module[_0xeb5e('0x15')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 0e4ce89..6b4c4e8 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(_0x28d175,_0x5449c6){var _0x1ad2b0=function(_0x2cd124){while(--_0x2cd124){_0x28d175['push'](_0x28d175['shift']());}};_0x1ad2b0(++_0x5449c6);}(_0xb7e7,0x121));var _0x7b7e=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xb7e7[_0x278e3c];return _0x3e2d9b;};'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 _0x757a=['always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','exports','STRING','user','peer','friend','from-voip-provider','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','nat','join','getDataValue','split','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]','never','INTEGER','\x22\x22\x20<>'];(function(_0x5cdb57,_0x3a9252){var _0xc8b9c2=function(_0xf0bcc9){while(--_0xf0bcc9){_0x5cdb57['push'](_0x5cdb57['shift']());}};_0xc8b9c2(++_0x3a9252);}(_0x757a,0xde));var _0xa757=function(_0x4ed34a,_0x258d51){_0x4ed34a=_0x4ed34a-0x0;var _0x3a0800=_0x757a[_0x4ed34a];return _0x3a0800;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend',_0xa757('0x2'),_0xa757('0x3')),'allowNull':![],'defaultValue':_0xa757('0x4')},'context':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'defaultValue':_0xa757('0x5')},'callingpres':{'type':Sequelize[_0xa757('0x6')]('ALLOWED_NOT_SCREENED',_0xa757('0x7'),_0xa757('0x8'),'ALLOWED',_0xa757('0x9'),_0xa757('0xa'),_0xa757('0xb'),_0xa757('0xc'))},'deny':{'type':Sequelize[_0xa757('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xa757('0x1')]},'md5secret':{'type':Sequelize[_0xa757('0x1')]},'remotesecret':{'type':Sequelize[_0xa757('0x1')]},'transport':{'type':Sequelize[_0xa757('0x1')],'defaultValue':_0xa757('0xd'),'set':function(_0x188ad5){this[_0xa757('0xe')]('transport',_0x188ad5?_0x188ad5['join'](','):null);},'get':function(){return this['getDataValue']('transport')?this['getDataValue'](_0xa757('0xf'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xa757('0x6')]('rfc2833','info',_0xa757('0x10'),_0xa757('0x11'),_0xa757('0x12')),'defaultValue':_0xa757('0x13')},'directmedia':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no',_0xa757('0x15'),_0xa757('0x16'),_0xa757('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa757('0x6')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa757('0x1')]},'directmediadeny':{'type':Sequelize[_0xa757('0x1')]},'nat':{'type':Sequelize[_0xa757('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x54b305){this[_0xa757('0xe')](_0xa757('0x18'),_0x54b305?_0x54b305[_0xa757('0x19')](','):null);},'get':function(){return this[_0xa757('0x1a')](_0xa757('0x18'))?this[_0xa757('0x1a')]('nat')[_0xa757('0x1b')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xa757('0x1')]},'namedcallgroup':{'type':Sequelize[_0xa757('0x1')]},'pickupgroup':{'type':Sequelize[_0xa757('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xa757('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xa757('0x1')],'defaultValue':_0xa757('0x1c')},'allow':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'defaultValue':_0xa757('0x1d'),'set':function(_0x1d6e2){this[_0xa757('0xe')](_0xa757('0x1e'),_0x1d6e2?_0x1d6e2[_0xa757('0x19')](';'):_0xa757('0x1d'));},'get':function(){return this['getDataValue'](_0xa757('0x1e'))?this['getDataValue'](_0xa757('0x1e'))['split'](';'):null;},'comment':_0xa757('0x1f')},'autoframing':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xa757('0x20'),'set':function(_0xcd98bd){this[_0xa757('0xe')](_0xa757('0x21'),_0xcd98bd?_0xcd98bd['join'](','):null);},'get':function(){return this[_0xa757('0x1a')]('insecure')?this['getDataValue']('insecure')['split'](','):null;},'comment':_0xa757('0x22')},'trustrpid':{'type':Sequelize['ENUM'](_0xa757('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa757('0x6')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa757('0x6')]('yes','no',_0xa757('0x23'))},'promiscredir':{'type':Sequelize[_0xa757('0x6')]('yes','no')},'useclientcode':{'type':Sequelize[_0xa757('0x6')]('yes','no')},'accountcode':{'type':Sequelize[_0xa757('0x24')](0xb)},'setvar':{'type':Sequelize[_0xa757('0x1')]},'callerid':{'type':Sequelize[_0xa757('0x1')],'defaultValue':_0xa757('0x25')},'amaflags':{'type':Sequelize[_0xa757('0x1')]},'callcounter':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no'),'defaultValue':_0xa757('0x14')},'busylevel':{'type':Sequelize[_0xa757('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no')},'allowsubscribe':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no')},'allowtransfer':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no')},'ignoresdpversion':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no')},'subscribecontext':{'type':Sequelize[_0xa757('0x1')]},'template':{'type':Sequelize[_0xa757('0x1')]},'videosupport':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no',_0xa757('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa757('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xa757('0x6')]('yes','no')},'mailbox':{'type':Sequelize[_0xa757('0x1')]},'session_timers':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x27'),_0xa757('0x28'),_0xa757('0x29'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xa757('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x2a'),_0xa757('0x2b')),'defaultValue':_0xa757('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0xa757('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xa757('0x1')]},'fromuser':{'type':Sequelize[_0xa757('0x1')]},'port':{'type':Sequelize[_0xa757('0x24')](0x5)},'qualify':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no'),'defaultValue':_0xa757('0x14')},'keepalive':{'type':Sequelize[_0xa757('0x24')](0xb)},'defaultip':{'type':Sequelize[_0xa757('0x1')]},'defaultuser':{'type':Sequelize[_0xa757('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xa757('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xa757('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no',_0xa757('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa757('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xa757('0x24')](0xb)},'timerb':{'type':Sequelize[_0xa757('0x24')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xa757('0x1')]},'contactacl':{'type':Sequelize[_0xa757('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xa757('0x24')](0xb)},'encryption':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xa757('0x14'),'no')},'force_avp':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no')},'icesupport':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x14'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xa757('0x14'),'no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0xa757('0x2d'),_0xa757('0x2e'))},'dtlsrekey':{'type':Sequelize[_0xa757('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0xa757('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xa757('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xa757('0x1')]},'dtlssetup':{'type':Sequelize[_0xa757('0x6')](_0xa757('0x2f'),_0xa757('0x30'),_0xa757('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa757('0x1')]},'usereqphone':{'type':Sequelize['ENUM'](_0xa757('0x14'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa757('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xa757('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xa757('0x14'),'no')},'subscribemwi':{'type':Sequelize[_0xa757('0x6')]('yes','no')},'vmexten':{'type':Sequelize[_0xa757('0x1')]},'mohinterpret':{'type':Sequelize[_0xa757('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xa757('0x1')]},'description':{'type':Sequelize[_0xa757('0x1')]},'host':{'type':Sequelize[_0xa757('0x1')],'defaultValue':_0xa757('0x32')},'canreinvite':{'type':Sequelize['ENUM'](_0xa757('0x14'),'no',_0xa757('0x15'),_0xa757('0x16'),_0xa757('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xa757('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index a6a700b..52005dc 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 _0x4508=['attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','count','include','show','params','intersection','clone','find','omit','createdAt','updatedAt','body','includeAll','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Trunks','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','findAll','/etc/asterisk/sip_xcally_trunks.conf','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','client','then','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','offset','set','Content-Range','json','reject','save','update','destroy','get','UserProfileResource','end','stack','name','index','Trunk','rawAttributes','model','keys','query','filters'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x4508,0x1d9));var _0x8450=function(_0x31ac53,_0x3cabf1){_0x31ac53=_0x31ac53-0x0;var _0x46f33c=_0x4508[_0x31ac53];return _0x46f33c;};'use strict';var pdf=require(_0x8450('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8450('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8450('0x2'));var rp=require(_0x8450('0x3'));var moment=require(_0x8450('0x4'));var BPromise=require(_0x8450('0x5'));var Mustache=require(_0x8450('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8450('0x7'));var csv=require('to-csv');var ejs=require(_0x8450('0x8'));var fs=require('fs');var _=require(_0x8450('0x9'));var squel=require('squel');var crypto=require(_0x8450('0xa'));var jsforce=require(_0x8450('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8450('0xc'));var querystring=require(_0x8450('0xd'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0x8450('0xe'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x8450('0xf'))(_0x8450('0x10'));var utils=require('../../config/utils');var config=require(_0x8450('0x11'));var db=require('../../mysqldb')['db'];var jayson=require(_0x8450('0x12'));var client=jayson[_0x8450('0x13')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5dcdf1,_0x6f32b0,_0x331333,_0x3177de){return new BPromise(function(_0x359fb3,_0x29e748){var _0x106e94=_0x3177de||client;return _0x106e94['request'](_0x5dcdf1,_0x331333)[_0x8450('0x14')](function(_0x1980d7){logger['info']('Trunk,\x20%s,\x20%s',_0x6f32b0,_0x8450('0x15'));logger[_0x8450('0x16')](_0x8450('0x17'),_0x6f32b0,_0x8450('0x15'),JSON[_0x8450('0x18')](_0x1980d7));if(_0x1980d7[_0x8450('0x19')]){if(_0x1980d7['error']['code']===0x1f4){logger[_0x8450('0x19')](_0x8450('0x1a'),_0x6f32b0,_0x1980d7[_0x8450('0x19')][_0x8450('0x1b')]);return _0x29e748(_0x1980d7[_0x8450('0x19')][_0x8450('0x1b')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x6f32b0,_0x1980d7[_0x8450('0x19')]['message']);return _0x359fb3(_0x1980d7['error'][_0x8450('0x1b')]);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x6f32b0,_0x8450('0x15'));_0x359fb3(_0x1980d7[_0x8450('0x1c')]['message']);}})[_0x8450('0x1d')](function(_0x28cbb5){logger['error'](_0x8450('0x1a'),_0x6f32b0,_0x28cbb5);_0x29e748(_0x28cbb5);});});}function respondWithStatusCode(_0x373b39,_0x58d02a){_0x58d02a=_0x58d02a||0xcc;return function(_0x8718d){if(_0x8718d){return _0x373b39[_0x8450('0x1e')](_0x58d02a);}return _0x373b39['status'](_0x58d02a)['end']();};}function respondWithResult(_0x5c59f6,_0x598e74){_0x598e74=_0x598e74||0xc8;return function(_0x40893b){if(_0x40893b){return _0x5c59f6[_0x8450('0x1f')](_0x598e74)['json'](_0x40893b);}};}function respondWithFilteredResult(_0x49c660,_0x473aac){return function(_0x5750d1){if(_0x5750d1){var _0x4faaf5=_0x5750d1['count'],_0x57d7f4=_0x473aac[_0x8450('0x20')],_0x48a7a6=_0x473aac['offset']+_0x473aac['limit'],_0x52597e;if(_0x48a7a6>=_0x4faaf5){_0x48a7a6=_0x4faaf5;_0x52597e=0xc8;}else{_0x52597e=0xce;}_0x49c660[_0x8450('0x1f')](_0x52597e);return _0x49c660[_0x8450('0x21')](_0x8450('0x22'),_0x57d7f4+'-'+_0x48a7a6+'/'+_0x4faaf5)[_0x8450('0x23')](_0x5750d1);}return null;};}function patchUpdates(_0x5c8fe0){return function(_0x566798){try{jsonpatch['apply'](_0x566798,_0x5c8fe0,!![]);}catch(_0x27a14c){return BPromise[_0x8450('0x24')](_0x27a14c);}return _0x566798[_0x8450('0x25')]();};}function saveUpdates(_0x3f0825,_0x1d1445){return function(_0x101cd2){if(_0x101cd2){return _0x101cd2[_0x8450('0x26')](_0x3f0825)[_0x8450('0x14')](function(_0x1fcd45){return _0x1fcd45;});}return null;};}function removeEntity(_0x8082f2,_0x287643){return function(_0x94b2fc){if(_0x94b2fc){return _0x94b2fc[_0x8450('0x27')]()['then'](function(){var _0x2fab9d=_0x94b2fc[_0x8450('0x28')]({'plain':!![]});var _0x1f7541='Trunks';return db[_0x8450('0x29')][_0x8450('0x27')]({'where':{'type':_0x1f7541,'resourceId':_0x2fab9d['id']}})[_0x8450('0x14')](function(){return _0x94b2fc;});})['then'](function(){_0x8082f2[_0x8450('0x1f')](0xcc)[_0x8450('0x2a')]();});}};}function handleEntityNotFound(_0xa2492,_0x2895f1){return function(_0x2dcc2c){if(!_0x2dcc2c){_0xa2492[_0x8450('0x1e')](0x194);}return _0x2dcc2c;};}function handleError(_0x58fae6,_0x16091c){_0x16091c=_0x16091c||0x1f4;return function(_0x2a427a){logger[_0x8450('0x19')](_0x2a427a[_0x8450('0x2b')]);if(_0x2a427a[_0x8450('0x2c')]){delete _0x2a427a[_0x8450('0x2c')];}_0x58fae6['status'](_0x16091c)['send'](_0x2a427a);};}exports[_0x8450('0x2d')]=function(_0x5e92f6,_0x78c812){var _0x14642e={},_0x3ad1e0={},_0x71085f={'count':0x0,'rows':[]};var _0x5ed1f2=db[_0x8450('0x2e')][_0x8450('0x2f')];_0x3ad1e0[_0x8450('0x30')]=_[_0x8450('0x31')](_0x5ed1f2);_0x3ad1e0[_0x8450('0x32')]=_[_0x8450('0x31')](_0x5e92f6['query']);_0x3ad1e0[_0x8450('0x33')]=_['intersection'](_0x3ad1e0[_0x8450('0x30')],_0x3ad1e0[_0x8450('0x32')]);_0x14642e[_0x8450('0x34')]=_['intersection'](_0x3ad1e0[_0x8450('0x30')],qs[_0x8450('0x35')](_0x5e92f6[_0x8450('0x32')][_0x8450('0x35')]));_0x14642e[_0x8450('0x34')]=_0x14642e[_0x8450('0x34')][_0x8450('0x36')]?_0x14642e[_0x8450('0x34')]:_0x3ad1e0['model'];if(!_0x5e92f6[_0x8450('0x32')][_0x8450('0x37')](_0x8450('0x38'))){_0x14642e[_0x8450('0x39')]=qs[_0x8450('0x39')](_0x5e92f6[_0x8450('0x32')][_0x8450('0x39')]);_0x14642e[_0x8450('0x20')]=qs[_0x8450('0x20')](_0x5e92f6[_0x8450('0x32')]['offset']);}_0x14642e[_0x8450('0x3a')]=qs[_0x8450('0x3b')](_0x5e92f6['query'][_0x8450('0x3b')]);_0x14642e[_0x8450('0x3c')]=qs['filters'](_[_0x8450('0x3d')](_0x5e92f6[_0x8450('0x32')],_0x3ad1e0[_0x8450('0x33')]));if(_0x5e92f6[_0x8450('0x32')][_0x8450('0x3e')]){_0x14642e[_0x8450('0x3c')]=_[_0x8450('0x3f')](_0x14642e['where'],{'$or':_[_0x8450('0x40')](_0x5ed1f2,function(_0x38a1c9){if(_0x38a1c9[_0x8450('0x41')][_0x8450('0x42')]!==_0x8450('0x43')){var _0x48c752={};_0x48c752[_0x38a1c9[_0x8450('0x44')]]={'$like':'%'+_0x5e92f6['query'][_0x8450('0x3e')]+'%'};return _0x48c752;}})});}_0x14642e=_[_0x8450('0x3f')]({},_0x14642e,_0x5e92f6[_0x8450('0x45')]);var _0xed731d={'where':_0x14642e[_0x8450('0x3c')]};return db['Trunk'][_0x8450('0x46')](_0xed731d)[_0x8450('0x14')](function(_0x18dba8){_0x71085f[_0x8450('0x46')]=_0x18dba8;if(_0x5e92f6['query']['includeAll']){_0x14642e[_0x8450('0x47')]=[{'all':!![]}];}return db['Trunk']['findAll'](_0x14642e);})['then'](function(_0x3368f4){_0x71085f['rows']=_0x3368f4;return _0x71085f;})['then'](respondWithFilteredResult(_0x78c812,_0x14642e))['catch'](handleError(_0x78c812,null));};exports[_0x8450('0x48')]=function(_0x2ee151,_0x21dd7e){var _0xe192ee={'raw':![],'where':{'id':_0x2ee151[_0x8450('0x49')]['id']}},_0x50f18b={};_0x50f18b[_0x8450('0x30')]=_['keys'](db['Trunk'][_0x8450('0x2f')]);_0x50f18b['query']=_[_0x8450('0x31')](_0x2ee151[_0x8450('0x32')]);_0x50f18b[_0x8450('0x33')]=_['intersection'](_0x50f18b[_0x8450('0x30')],_0x50f18b[_0x8450('0x32')]);_0xe192ee[_0x8450('0x34')]=_[_0x8450('0x4a')](_0x50f18b['model'],qs[_0x8450('0x35')](_0x2ee151['query'][_0x8450('0x35')]));_0xe192ee['attributes']=_0xe192ee[_0x8450('0x34')][_0x8450('0x36')]?_0xe192ee[_0x8450('0x34')]:_0x50f18b[_0x8450('0x30')];if(_0x2ee151[_0x8450('0x32')]['includeAll']){_0xe192ee[_0x8450('0x47')]=[{'all':!![]}];}_0xe192ee=_['merge']({},_0xe192ee,_0x2ee151[_0x8450('0x45')]);return db[_0x8450('0x2e')]['find'](_0xe192ee)[_0x8450('0x14')](handleEntityNotFound(_0x21dd7e,null))[_0x8450('0x14')](respondWithResult(_0x21dd7e,null))[_0x8450('0x1d')](handleError(_0x21dd7e,null));};exports[_0x8450('0x4b')]=function(_0x55937c,_0x2a73dc){var _0x3e3717={'raw':![],'where':{'id':_0x55937c[_0x8450('0x49')]['id']}},_0x1c2b36={};_0x1c2b36[_0x8450('0x30')]=_[_0x8450('0x31')](db[_0x8450('0x2e')][_0x8450('0x2f')]);_0x3e3717[_0x8450('0x34')]=_[_0x8450('0x4a')](_0x1c2b36['model'],qs[_0x8450('0x35')](_0x55937c[_0x8450('0x32')][_0x8450('0x35')]));_0x3e3717[_0x8450('0x34')]=_0x3e3717[_0x8450('0x34')]['length']?_0x3e3717[_0x8450('0x34')]:_0x1c2b36[_0x8450('0x30')];if(_0x55937c[_0x8450('0x32')]['includeAll']){_0x3e3717[_0x8450('0x47')]=[{'all':!![]}];}_0x3e3717=_[_0x8450('0x3f')]({},_0x3e3717,_0x55937c['options']);return db[_0x8450('0x2e')][_0x8450('0x4c')](_0x3e3717)[_0x8450('0x14')](handleEntityNotFound(_0x2a73dc,null))[_0x8450('0x14')](function(_0x542d28){if(_0x542d28){var _0x4d00a4=_0x542d28[_0x8450('0x28')]({'plain':!![]});_0x4d00a4=qs[_0x8450('0x4d')](_0x4d00a4,['id',_0x8450('0x4e'),_0x8450('0x4f')]);_0x55937c['body']=_[_0x8450('0x4d')](_0x55937c[_0x8450('0x50')],['id',_0x8450('0x4e'),'updatedAt']);return db['Trunk']['create'](_[_0x8450('0x3f')](_0x4d00a4,_0x55937c['body']),{'include':_0x55937c['query'][_0x8450('0x51')]?[{'all':!![]}]:undefined})['then'](function(_0x5011fa){var _0x2b8346=_0x55937c['user'][_0x8450('0x28')]({'plain':!![]});if(!_0x2b8346)throw new Error(_0x8450('0x52'));if(_0x2b8346['role']===_0x8450('0x53')){var _0x17ba2c=_0x5011fa['get']({'plain':!![]});var _0x59bf64=_0x8450('0x54');return db[_0x8450('0x55')][_0x8450('0x4c')]({'where':{'name':_0x59bf64,'userProfileId':_0x2b8346[_0x8450('0x56')]},'raw':!![]})['then'](function(_0x1287ab){if(_0x1287ab&&_0x1287ab[_0x8450('0x57')]===0x0){return db[_0x8450('0x29')][_0x8450('0x58')]({'name':_0x17ba2c[_0x8450('0x2c')],'resourceId':_0x17ba2c['id'],'type':_0x1287ab[_0x8450('0x2c')],'sectionId':_0x1287ab['id']},{})['then'](function(){return _0x5011fa;});}else{return _0x5011fa;}})[_0x8450('0x1d')](function(_0x3b2b82){logger[_0x8450('0x19')](_0x8450('0x59'),_0x3b2b82);throw _0x3b2b82;});}return _0x5011fa;});}})[_0x8450('0x14')](respondWithResult(_0x2a73dc,0xc9))['catch'](handleError(_0x2a73dc,null));};exports['create']=function(_0x9da374,_0x183852,_0x582941){var _0x1410ae;return db[_0x8450('0x2e')]['create'](_0x9da374[_0x8450('0x50')],{'raw':!![]})['then'](function(_0x1f02c0){_0x1410ae=_0x1f02c0;return db[_0x8450('0x2e')]['findAll']({'raw':!![]});})['then'](function(_0x310e30){var _0x4a0845=fs[_0x8450('0x5a')](path[_0x8450('0x5b')](config[_0x8450('0x5c')],_0x8450('0x5d')),_0x8450('0x5e'));var _0xdb36e9=fs[_0x8450('0x5a')](path[_0x8450('0x5b')](config['root'],_0x8450('0x5f')),_0x8450('0x5e'));var _0xe2409e=ejs[_0x8450('0x60')](_0x4a0845,{'trunks':_0x310e30||[]});fs[_0x8450('0x61')]('/etc/asterisk/sip_xcally_trunks.conf',_0xe2409e);if(_0x1410ae[_0x8450('0x62')]){var _0x3b27fc=ejs[_0x8450('0x60')](_0xdb36e9,{'trunks':_0x310e30||[]});fs[_0x8450('0x61')](_0x8450('0x63'),_0x3b27fc);}})[_0x8450('0x14')](function(){return respondWithRpcPromise(_0x8450('0x64'),_0x8450('0x58'),{'module':_0x8450('0x65')});})[_0x8450('0x14')](function(){var _0x218eed=_0x9da374[_0x8450('0x53')]['get']({'plain':!![]});if(!_0x218eed)throw new Error(_0x8450('0x52'));if(_0x218eed[_0x8450('0x66')]===_0x8450('0x53')){var _0x1b6081=_0x1410ae[_0x8450('0x28')]({'plain':!![]});return db[_0x8450('0x55')]['find']({'where':{'name':'Trunks','userProfileId':_0x218eed[_0x8450('0x56')]},'raw':!![]})[_0x8450('0x14')](function(_0x3f9e0b){if(_0x3f9e0b&&_0x3f9e0b['autoAssociation']===0x0){return db[_0x8450('0x29')]['create']({'name':_0x1b6081[_0x8450('0x2c')],'resourceId':_0x1b6081['id'],'type':_0x3f9e0b['name'],'sectionId':_0x3f9e0b['id']},{})[_0x8450('0x14')](function(){return _0x1410ae;});}else{return _0x1410ae;}})[_0x8450('0x1d')](function(_0xdda0f7){logger[_0x8450('0x19')](_0x8450('0x59'),_0xdda0f7);throw _0xdda0f7;});}return _0x1410ae;})['then'](respondWithResult(_0x183852,0xc9))[_0x8450('0x1d')](handleError(_0x183852,null));};exports['update']=function(_0x349437,_0x24a49b,_0x1ae38a){var _0x3bc833;return db['Trunk'][_0x8450('0x4c')]({'where':{'id':_0x349437[_0x8450('0x49')]['id']}})[_0x8450('0x14')](handleEntityNotFound(_0x24a49b,null))[_0x8450('0x14')](saveUpdates(_0x349437['body'],null))[_0x8450('0x14')](function(_0x45d044){if(_0x45d044){_0x3bc833=_0x45d044;return db[_0x8450('0x2e')][_0x8450('0x67')]({'raw':!![]});}})[_0x8450('0x14')](function(_0xeeda1){if(_0xeeda1){var _0x258afa=fs[_0x8450('0x5a')](path[_0x8450('0x5b')](config[_0x8450('0x5c')],'server/files/templates/trunk.ejs'),_0x8450('0x5e'));var _0x460229=fs['readFileSync'](path['join'](config[_0x8450('0x5c')],'server/files/templates/registry.ejs'),'utf8');var _0x10952c=ejs[_0x8450('0x60')](_0x258afa,{'trunks':_0xeeda1||[]});fs[_0x8450('0x61')](_0x8450('0x68'),_0x10952c);var _0xab285=ejs[_0x8450('0x60')](_0x460229,{'trunks':_0xeeda1||[]});fs[_0x8450('0x61')](_0x8450('0x63'),_0xab285);return respondWithRpcPromise(_0x8450('0x64'),_0x8450('0x26'),{'module':_0x8450('0x65')});}return null;})[_0x8450('0x14')](function(_0x4597b0){if(_0x4597b0){return _0x3bc833;}})['then'](respondWithResult(_0x24a49b,null))[_0x8450('0x1d')](handleError(_0x24a49b,null));};exports[_0x8450('0x27')]=function(_0x4c0aad,_0x282bfa,_0x14bf65){var _0x35a9f1;return db[_0x8450('0x2e')][_0x8450('0x4c')]({'where':{'id':_0x4c0aad[_0x8450('0x49')]['id']}})[_0x8450('0x14')](handleEntityNotFound(_0x282bfa,null))[_0x8450('0x14')](removeEntity(_0x282bfa,null))['then'](function(){return db[_0x8450('0x2e')][_0x8450('0x67')]({'raw':!![]});})[_0x8450('0x14')](function(_0x357b5a){var _0x5c312b=fs[_0x8450('0x5a')](path['join'](config[_0x8450('0x5c')],_0x8450('0x5d')),_0x8450('0x5e'));var _0x2e957f=fs['readFileSync'](path[_0x8450('0x5b')](config[_0x8450('0x5c')],_0x8450('0x5f')),_0x8450('0x5e'));var _0x549576=ejs['render'](_0x5c312b,{'trunks':_0x357b5a});var _0x23f5b6=ejs[_0x8450('0x60')](_0x2e957f,{'trunks':_0x357b5a});fs[_0x8450('0x61')](_0x8450('0x68'),_0x549576);fs[_0x8450('0x61')]('/etc/asterisk/sip_xcally_registers.conf',_0x23f5b6);return respondWithRpcPromise('Reload',_0x8450('0x27'),{'module':_0x8450('0x65')});})[_0x8450('0x1d')](handleError(_0x282bfa,null));}; \ No newline at end of file +var _0x4453=['then','destroy','UserProfileResource','stack','name','send','index','Trunk','rawAttributes','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','type','key','VIRTUAL','field','options','count','includeAll','findAll','rows','show','params','fields','find','clone','get','omit','updatedAt','body','createdAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','update'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x4453,0xb3));var _0x3445=function(_0x20575d,_0x34ab83){_0x20575d=_0x20575d-0x0;var _0x25a4a3=_0x4453[_0x20575d];return _0x25a4a3;};'use strict';var pdf=require(_0x3445('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3445('0x1'));var zipdir=require(_0x3445('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3445('0x3'));var BPromise=require(_0x3445('0x4'));var Mustache=require(_0x3445('0x5'));var util=require(_0x3445('0x6'));var path=require(_0x3445('0x7'));var sox=require(_0x3445('0x8'));var csv=require('to-csv');var ejs=require(_0x3445('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3445('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3445('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3445('0xc'));var Papa=require(_0x3445('0xd'));var authService=require(_0x3445('0xe'));var hardwareService=require(_0x3445('0xf'));var Redis=require(_0x3445('0x10'));var qs=require(_0x3445('0x11'));var logger=require('../../config/logger')(_0x3445('0x12'));var utils=require(_0x3445('0x13'));var config=require(_0x3445('0x14'));var db=require(_0x3445('0x15'))['db'];var jayson=require(_0x3445('0x16'));var client=jayson[_0x3445('0x17')][_0x3445('0x18')]({'port':0x232a});function respondWithRpcPromise(_0xf60748,_0x3977b9,_0x100db1,_0x50d654){return new BPromise(function(_0x1f95f0,_0x23250b){var _0x2eef28=_0x50d654||client;return _0x2eef28[_0x3445('0x19')](_0xf60748,_0x100db1)['then'](function(_0x4d6b1c){logger[_0x3445('0x1a')](_0x3445('0x1b'),_0x3977b9,'request\x20sent');logger[_0x3445('0x1c')](_0x3445('0x1d'),_0x3977b9,_0x3445('0x1e'),JSON[_0x3445('0x1f')](_0x4d6b1c));if(_0x4d6b1c['error']){if(_0x4d6b1c[_0x3445('0x20')][_0x3445('0x21')]===0x1f4){logger[_0x3445('0x20')](_0x3445('0x1b'),_0x3977b9,_0x4d6b1c[_0x3445('0x20')][_0x3445('0x22')]);return _0x23250b(_0x4d6b1c['error'][_0x3445('0x22')]);}logger['error'](_0x3445('0x1b'),_0x3977b9,_0x4d6b1c['error'][_0x3445('0x22')]);return _0x1f95f0(_0x4d6b1c[_0x3445('0x20')]['message']);}else{logger[_0x3445('0x1a')](_0x3445('0x1b'),_0x3977b9,_0x3445('0x1e'));_0x1f95f0(_0x4d6b1c[_0x3445('0x23')][_0x3445('0x22')]);}})[_0x3445('0x24')](function(_0x2f0a8c){logger['error'](_0x3445('0x1b'),_0x3977b9,_0x2f0a8c);_0x23250b(_0x2f0a8c);});});}function respondWithStatusCode(_0x39f88d,_0x42a719){_0x42a719=_0x42a719||0xcc;return function(_0x454805){if(_0x454805){return _0x39f88d[_0x3445('0x25')](_0x42a719);}return _0x39f88d[_0x3445('0x26')](_0x42a719)[_0x3445('0x27')]();};}function respondWithResult(_0x370210,_0x3f3976){_0x3f3976=_0x3f3976||0xc8;return function(_0x4d7ad6){if(_0x4d7ad6){return _0x370210['status'](_0x3f3976)['json'](_0x4d7ad6);}};}function respondWithFilteredResult(_0x595a73,_0x1e9d50){return function(_0x26ba49){if(_0x26ba49){var _0x12ebef=_0x26ba49['count'],_0xc572cf=_0x1e9d50[_0x3445('0x28')],_0x57436b=_0x1e9d50[_0x3445('0x28')]+_0x1e9d50['limit'],_0x18ff02;if(_0x57436b>=_0x12ebef){_0x57436b=_0x12ebef;_0x18ff02=0xc8;}else{_0x18ff02=0xce;}_0x595a73['status'](_0x18ff02);return _0x595a73[_0x3445('0x29')](_0x3445('0x2a'),_0xc572cf+'-'+_0x57436b+'/'+_0x12ebef)[_0x3445('0x2b')](_0x26ba49);}return null;};}function patchUpdates(_0x1d1544){return function(_0x46ed21){try{jsonpatch[_0x3445('0x2c')](_0x46ed21,_0x1d1544,!![]);}catch(_0xf430f7){return BPromise[_0x3445('0x2d')](_0xf430f7);}return _0x46ed21['save']();};}function saveUpdates(_0x4b2261,_0x4735cd){return function(_0x5169ff){if(_0x5169ff){return _0x5169ff[_0x3445('0x2e')](_0x4b2261)[_0x3445('0x2f')](function(_0x331f71){return _0x331f71;});}return null;};}function removeEntity(_0xdbd9f0,_0x2b759a){return function(_0x32abd6){if(_0x32abd6){return _0x32abd6[_0x3445('0x30')]()[_0x3445('0x2f')](function(){var _0x599c6f=_0x32abd6['get']({'plain':!![]});var _0x56007d='Trunks';return db[_0x3445('0x31')][_0x3445('0x30')]({'where':{'type':_0x56007d,'resourceId':_0x599c6f['id']}})[_0x3445('0x2f')](function(){return _0x32abd6;});})['then'](function(){_0xdbd9f0[_0x3445('0x26')](0xcc)[_0x3445('0x27')]();});}};}function handleEntityNotFound(_0x1321b6,_0x59cb20){return function(_0x23f977){if(!_0x23f977){_0x1321b6[_0x3445('0x25')](0x194);}return _0x23f977;};}function handleError(_0x569091,_0x300339){_0x300339=_0x300339||0x1f4;return function(_0x11bbf){logger[_0x3445('0x20')](_0x11bbf[_0x3445('0x32')]);if(_0x11bbf['name']){delete _0x11bbf[_0x3445('0x33')];}_0x569091[_0x3445('0x26')](_0x300339)[_0x3445('0x34')](_0x11bbf);};}exports[_0x3445('0x35')]=function(_0x3459e2,_0x1c3dd7){var _0x57cb3b={},_0x46710b={},_0x5dd615={'count':0x0,'rows':[]};var _0x35e75f=db[_0x3445('0x36')][_0x3445('0x37')];_0x46710b[_0x3445('0x38')]=_[_0x3445('0x39')](_0x35e75f);_0x46710b['query']=_[_0x3445('0x39')](_0x3459e2[_0x3445('0x3a')]);_0x46710b['filters']=_[_0x3445('0x3b')](_0x46710b[_0x3445('0x38')],_0x46710b['query']);_0x57cb3b['attributes']=_[_0x3445('0x3b')](_0x46710b['model'],qs['fields'](_0x3459e2[_0x3445('0x3a')]['fields']));_0x57cb3b[_0x3445('0x3c')]=_0x57cb3b[_0x3445('0x3c')][_0x3445('0x3d')]?_0x57cb3b[_0x3445('0x3c')]:_0x46710b[_0x3445('0x38')];if(!_0x3459e2[_0x3445('0x3a')][_0x3445('0x3e')](_0x3445('0x3f'))){_0x57cb3b['limit']=qs[_0x3445('0x40')](_0x3459e2[_0x3445('0x3a')][_0x3445('0x40')]);_0x57cb3b[_0x3445('0x28')]=qs[_0x3445('0x28')](_0x3459e2['query'][_0x3445('0x28')]);}_0x57cb3b[_0x3445('0x41')]=qs[_0x3445('0x42')](_0x3459e2[_0x3445('0x3a')][_0x3445('0x42')]);_0x57cb3b['where']=qs[_0x3445('0x43')](_[_0x3445('0x44')](_0x3459e2[_0x3445('0x3a')],_0x46710b[_0x3445('0x43')]));if(_0x3459e2[_0x3445('0x3a')][_0x3445('0x45')]){_0x57cb3b[_0x3445('0x46')]=_[_0x3445('0x47')](_0x57cb3b[_0x3445('0x46')],{'$or':_['map'](_0x35e75f,function(_0x32781b){if(_0x32781b[_0x3445('0x48')][_0x3445('0x49')]!==_0x3445('0x4a')){var _0x4db37d={};_0x4db37d[_0x32781b[_0x3445('0x4b')]]={'$like':'%'+_0x3459e2['query'][_0x3445('0x45')]+'%'};return _0x4db37d;}})});}_0x57cb3b=_['merge']({},_0x57cb3b,_0x3459e2[_0x3445('0x4c')]);var _0x3ce5cc={'where':_0x57cb3b['where']};return db[_0x3445('0x36')][_0x3445('0x4d')](_0x3ce5cc)[_0x3445('0x2f')](function(_0x3e9558){_0x5dd615[_0x3445('0x4d')]=_0x3e9558;if(_0x3459e2[_0x3445('0x3a')][_0x3445('0x4e')]){_0x57cb3b['include']=[{'all':!![]}];}return db['Trunk'][_0x3445('0x4f')](_0x57cb3b);})[_0x3445('0x2f')](function(_0x21ea2b){_0x5dd615[_0x3445('0x50')]=_0x21ea2b;return _0x5dd615;})[_0x3445('0x2f')](respondWithFilteredResult(_0x1c3dd7,_0x57cb3b))[_0x3445('0x24')](handleError(_0x1c3dd7,null));};exports[_0x3445('0x51')]=function(_0x432ed4,_0x15a242){var _0x4d5ea5={'raw':![],'where':{'id':_0x432ed4[_0x3445('0x52')]['id']}},_0x1fd5c7={};_0x1fd5c7[_0x3445('0x38')]=_[_0x3445('0x39')](db[_0x3445('0x36')]['rawAttributes']);_0x1fd5c7['query']=_[_0x3445('0x39')](_0x432ed4['query']);_0x1fd5c7[_0x3445('0x43')]=_[_0x3445('0x3b')](_0x1fd5c7['model'],_0x1fd5c7[_0x3445('0x3a')]);_0x4d5ea5[_0x3445('0x3c')]=_[_0x3445('0x3b')](_0x1fd5c7['model'],qs[_0x3445('0x53')](_0x432ed4['query'][_0x3445('0x53')]));_0x4d5ea5[_0x3445('0x3c')]=_0x4d5ea5[_0x3445('0x3c')][_0x3445('0x3d')]?_0x4d5ea5[_0x3445('0x3c')]:_0x1fd5c7[_0x3445('0x38')];if(_0x432ed4[_0x3445('0x3a')][_0x3445('0x4e')]){_0x4d5ea5['include']=[{'all':!![]}];}_0x4d5ea5=_[_0x3445('0x47')]({},_0x4d5ea5,_0x432ed4[_0x3445('0x4c')]);return db[_0x3445('0x36')][_0x3445('0x54')](_0x4d5ea5)[_0x3445('0x2f')](handleEntityNotFound(_0x15a242,null))[_0x3445('0x2f')](respondWithResult(_0x15a242,null))['catch'](handleError(_0x15a242,null));};exports[_0x3445('0x55')]=function(_0x559101,_0x407566){var _0x48780a={'raw':![],'where':{'id':_0x559101['params']['id']}},_0x31598c={};_0x31598c[_0x3445('0x38')]=_['keys'](db[_0x3445('0x36')][_0x3445('0x37')]);_0x48780a[_0x3445('0x3c')]=_['intersection'](_0x31598c[_0x3445('0x38')],qs[_0x3445('0x53')](_0x559101[_0x3445('0x3a')][_0x3445('0x53')]));_0x48780a[_0x3445('0x3c')]=_0x48780a['attributes']['length']?_0x48780a['attributes']:_0x31598c[_0x3445('0x38')];if(_0x559101[_0x3445('0x3a')][_0x3445('0x4e')]){_0x48780a['include']=[{'all':!![]}];}_0x48780a=_[_0x3445('0x47')]({},_0x48780a,_0x559101['options']);return db['Trunk'][_0x3445('0x54')](_0x48780a)['then'](handleEntityNotFound(_0x407566,null))[_0x3445('0x2f')](function(_0x33996a){if(_0x33996a){var _0x50b897=_0x33996a[_0x3445('0x56')]({'plain':!![]});_0x50b897=qs[_0x3445('0x57')](_0x50b897,['id','createdAt',_0x3445('0x58')]);_0x559101[_0x3445('0x59')]=_[_0x3445('0x57')](_0x559101['body'],['id',_0x3445('0x5a'),_0x3445('0x58')]);return db[_0x3445('0x36')][_0x3445('0x5b')](_[_0x3445('0x47')](_0x50b897,_0x559101[_0x3445('0x59')]),{'include':_0x559101[_0x3445('0x3a')][_0x3445('0x4e')]?[{'all':!![]}]:undefined})[_0x3445('0x2f')](function(_0x4bd6dc){var _0x1e7190=_0x559101[_0x3445('0x5c')][_0x3445('0x56')]({'plain':!![]});if(!_0x1e7190)throw new Error(_0x3445('0x5d'));if(_0x1e7190[_0x3445('0x5e')]===_0x3445('0x5c')){var _0x155904=_0x4bd6dc[_0x3445('0x56')]({'plain':!![]});var _0x5659b8=_0x3445('0x5f');return db[_0x3445('0x60')][_0x3445('0x54')]({'where':{'name':_0x5659b8,'userProfileId':_0x1e7190[_0x3445('0x61')]},'raw':!![]})[_0x3445('0x2f')](function(_0xfb954a){if(_0xfb954a&&_0xfb954a[_0x3445('0x62')]===0x0){return db[_0x3445('0x31')][_0x3445('0x5b')]({'name':_0x155904[_0x3445('0x33')],'resourceId':_0x155904['id'],'type':_0xfb954a[_0x3445('0x33')],'sectionId':_0xfb954a['id']},{})[_0x3445('0x2f')](function(){return _0x4bd6dc;});}else{return _0x4bd6dc;}})['catch'](function(_0x269661){logger[_0x3445('0x20')](_0x3445('0x63'),_0x269661);throw _0x269661;});}return _0x4bd6dc;});}})['then'](respondWithResult(_0x407566,0xc9))[_0x3445('0x24')](handleError(_0x407566,null));};exports[_0x3445('0x5b')]=function(_0x139cd1,_0x599c7f,_0xa40d51){var _0x365a7d;return db[_0x3445('0x36')][_0x3445('0x5b')](_0x139cd1[_0x3445('0x59')],{'raw':!![]})[_0x3445('0x2f')](function(_0x285af2){_0x365a7d=_0x285af2;return db[_0x3445('0x36')][_0x3445('0x4f')]({'raw':!![]});})[_0x3445('0x2f')](function(_0x294876){var _0x537582=fs[_0x3445('0x64')](path[_0x3445('0x65')](config[_0x3445('0x66')],_0x3445('0x67')),_0x3445('0x68'));var _0x4ce8f2=fs[_0x3445('0x64')](path['join'](config[_0x3445('0x66')],_0x3445('0x69')),'utf8');var _0x4d782d=ejs[_0x3445('0x6a')](_0x537582,{'trunks':_0x294876||[]});fs[_0x3445('0x6b')](_0x3445('0x6c'),_0x4d782d);if(_0x365a7d[_0x3445('0x6d')]){var _0x341077=ejs[_0x3445('0x6a')](_0x4ce8f2,{'trunks':_0x294876||[]});fs[_0x3445('0x6b')]('/etc/asterisk/sip_xcally_registers.conf',_0x341077);}})[_0x3445('0x2f')](function(){return respondWithRpcPromise(_0x3445('0x6e'),_0x3445('0x5b'),{'module':_0x3445('0x6f')});})['then'](function(){var _0x465eec=_0x139cd1[_0x3445('0x5c')]['get']({'plain':!![]});if(!_0x465eec)throw new Error(_0x3445('0x5d'));if(_0x465eec[_0x3445('0x5e')]===_0x3445('0x5c')){var _0x4d9e51=_0x365a7d['get']({'plain':!![]});return db[_0x3445('0x60')][_0x3445('0x54')]({'where':{'name':'Trunks','userProfileId':_0x465eec[_0x3445('0x61')]},'raw':!![]})[_0x3445('0x2f')](function(_0x47b557){if(_0x47b557&&_0x47b557[_0x3445('0x62')]===0x0){return db[_0x3445('0x31')][_0x3445('0x5b')]({'name':_0x4d9e51[_0x3445('0x33')],'resourceId':_0x4d9e51['id'],'type':_0x47b557[_0x3445('0x33')],'sectionId':_0x47b557['id']},{})['then'](function(){return _0x365a7d;});}else{return _0x365a7d;}})['catch'](function(_0x45b0b6){logger['error'](_0x3445('0x63'),_0x45b0b6);throw _0x45b0b6;});}return _0x365a7d;})[_0x3445('0x2f')](respondWithResult(_0x599c7f,0xc9))[_0x3445('0x24')](handleError(_0x599c7f,null));};exports[_0x3445('0x2e')]=function(_0x450431,_0x22ca36,_0x474a4c){var _0x14cbdf;return db['Trunk'][_0x3445('0x54')]({'where':{'id':_0x450431[_0x3445('0x52')]['id']}})[_0x3445('0x2f')](handleEntityNotFound(_0x22ca36,null))[_0x3445('0x2f')](saveUpdates(_0x450431[_0x3445('0x59')],null))['then'](function(_0x2d1b08){if(_0x2d1b08){_0x14cbdf=_0x2d1b08;return db[_0x3445('0x36')][_0x3445('0x4f')]({'raw':!![]});}})[_0x3445('0x2f')](function(_0x9da993){if(_0x9da993){var _0xa2be41=fs[_0x3445('0x64')](path[_0x3445('0x65')](config['root'],'server/files/templates/trunk.ejs'),_0x3445('0x68'));var _0x2cb76a=fs[_0x3445('0x64')](path['join'](config[_0x3445('0x66')],_0x3445('0x69')),_0x3445('0x68'));var _0x47d93c=ejs['render'](_0xa2be41,{'trunks':_0x9da993||[]});fs[_0x3445('0x6b')](_0x3445('0x6c'),_0x47d93c);var _0x43ecc7=ejs['render'](_0x2cb76a,{'trunks':_0x9da993||[]});fs[_0x3445('0x6b')](_0x3445('0x70'),_0x43ecc7);return respondWithRpcPromise(_0x3445('0x6e'),_0x3445('0x2e'),{'module':_0x3445('0x6f')});}return null;})['then'](function(_0x2f9d9f){if(_0x2f9d9f){return _0x14cbdf;}})[_0x3445('0x2f')](respondWithResult(_0x22ca36,null))['catch'](handleError(_0x22ca36,null));};exports[_0x3445('0x30')]=function(_0x320926,_0x51bcfd,_0x1023ea){var _0x4ced84;return db[_0x3445('0x36')][_0x3445('0x54')]({'where':{'id':_0x320926[_0x3445('0x52')]['id']}})['then'](handleEntityNotFound(_0x51bcfd,null))[_0x3445('0x2f')](removeEntity(_0x51bcfd,null))[_0x3445('0x2f')](function(){return db[_0x3445('0x36')]['findAll']({'raw':!![]});})[_0x3445('0x2f')](function(_0x34ce72){var _0x53b347=fs['readFileSync'](path['join'](config[_0x3445('0x66')],_0x3445('0x67')),_0x3445('0x68'));var _0x3d0c0c=fs[_0x3445('0x64')](path[_0x3445('0x65')](config[_0x3445('0x66')],_0x3445('0x69')),_0x3445('0x68'));var _0x234e36=ejs[_0x3445('0x6a')](_0x53b347,{'trunks':_0x34ce72});var _0x98a6b6=ejs[_0x3445('0x6a')](_0x3d0c0c,{'trunks':_0x34ce72});fs[_0x3445('0x6b')](_0x3445('0x6c'),_0x234e36);fs[_0x3445('0x6b')](_0x3445('0x70'),_0x98a6b6);return respondWithRpcPromise(_0x3445('0x6e'),_0x3445('0x30'),{'module':'chan_sip.so'});})[_0x3445('0x24')](handleError(_0x51bcfd,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 3625656..d6c6802 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 _0xa116=['request-promise','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api'];(function(_0x563c5c,_0x2c8563){var _0x204252=function(_0x1b386d){while(--_0x1b386d){_0x563c5c['push'](_0x563c5c['shift']());}};_0x204252(++_0x2c8563);}(_0xa116,0x71));var _0x6a11=function(_0x2fdce3,_0x3f35b9){_0x2fdce3=_0x2fdce3-0x0;var _0x4880ea=_0xa116[_0x2fdce3];return _0x4880ea;};'use strict';var _=require(_0x6a11('0x0'));var util=require(_0x6a11('0x1'));var logger=require(_0x6a11('0x2'))(_0x6a11('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6a11('0x4'));var attributes=require('./trunk.attributes');module[_0x6a11('0x5')]=function(_0x489b3d,_0x1eb716){return _0x489b3d[_0x6a11('0x6')](_0x6a11('0x7'),attributes,{'tableName':_0x6a11('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d75=['request-promise','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','moment'];(function(_0x30dca3,_0x318601){var _0x2953ef=function(_0x2a2cbc){while(--_0x2a2cbc){_0x30dca3['push'](_0x30dca3['shift']());}};_0x2953ef(++_0x318601);}(_0x3d75,0xce));var _0x53d7=function(_0x72b595,_0x413240){_0x72b595=_0x72b595-0x0;var _0x5783e3=_0x3d75[_0x72b595];return _0x5783e3;};'use strict';var _=require(_0x53d7('0x0'));var util=require(_0x53d7('0x1'));var logger=require(_0x53d7('0x2'))('api');var moment=require(_0x53d7('0x3'));var BPromise=require('bluebird');var rp=require(_0x53d7('0x4'));var attributes=require(_0x53d7('0x5'));module[_0x53d7('0x6')]=function(_0x5825a3,_0x3a3bc9){return _0x5825a3[_0x53d7('0x7')](_0x53d7('0x8'),attributes,{'tableName':_0x53d7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 75541b3..a46eeac 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 _0x7be4=['info','result','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','GetTrunk','catch','ShowTrunk','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s'];(function(_0xfab124,_0x5c6310){var _0x52a53a=function(_0x17e3ec){while(--_0x17e3ec){_0xfab124['push'](_0xfab124['shift']());}};_0x52a53a(++_0x5c6310);}(_0x7be4,0x7e));var _0x47be=function(_0x16e064,_0x57f4a3){_0x16e064=_0x16e064-0x0;var _0x2503bb=_0x7be4[_0x16e064];return _0x2503bb;};'use strict';var _=require(_0x47be('0x0'));var util=require(_0x47be('0x1'));var moment=require(_0x47be('0x2'));var BPromise=require(_0x47be('0x3'));var rs=require(_0x47be('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x47be('0x5'))['db'];var utils=require(_0x47be('0x6'));var logger=require(_0x47be('0x7'))(_0x47be('0x8'));var config=require(_0x47be('0x9'));var jayson=require(_0x47be('0xa'));var client=jayson[_0x47be('0xb')][_0x47be('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4046b8,_0x322916,_0x1a57e8){return new BPromise(function(_0x55af73,_0x1bf852){return client[_0x47be('0xd')](_0x4046b8,_0x1a57e8)['then'](function(_0x40b1d0){logger['info']('Trunk,\x20%s,\x20%s',_0x322916,_0x47be('0xe'));logger[_0x47be('0xf')](_0x47be('0x10'),_0x322916,_0x47be('0xe'),JSON[_0x47be('0x11')](_0x40b1d0));if(_0x40b1d0[_0x47be('0x12')]){if(_0x40b1d0[_0x47be('0x12')][_0x47be('0x13')]===0x1f4){logger[_0x47be('0x12')]('Trunk,\x20%s,\x20%s',_0x322916,_0x40b1d0[_0x47be('0x12')][_0x47be('0x14')]);return _0x1bf852(_0x40b1d0[_0x47be('0x12')][_0x47be('0x14')]);}logger[_0x47be('0x12')](_0x47be('0x15'),_0x322916,_0x40b1d0[_0x47be('0x12')]['message']);return _0x55af73(_0x40b1d0[_0x47be('0x12')][_0x47be('0x14')]);}else{logger[_0x47be('0x16')](_0x47be('0x15'),_0x322916,_0x47be('0xe'));_0x55af73(_0x40b1d0[_0x47be('0x17')][_0x47be('0x14')]);}})['catch'](function(_0x272b91){logger[_0x47be('0x12')]('Trunk,\x20%s,\x20%s',_0x322916,_0x272b91);_0x1bf852(_0x272b91);});});}exports['GetTrunk']=function(_0x2ecd7c){var _0x23e5fb=this;return new Promise(function(_0x4feaef,_0x588b3a){return db[_0x47be('0x18')][_0x47be('0x19')]({'raw':_0x2ecd7c[_0x47be('0x1a')]?_0x2ecd7c['options'][_0x47be('0x1b')]===undefined?!![]:![]:!![],'where':_0x2ecd7c[_0x47be('0x1a')]?_0x2ecd7c[_0x47be('0x1a')][_0x47be('0x1c')]||null:null,'attributes':_0x2ecd7c['options']?_0x2ecd7c[_0x47be('0x1a')][_0x47be('0x1d')]||null:null,'limit':_0x2ecd7c[_0x47be('0x1a')]?_0x2ecd7c['options'][_0x47be('0x1e')]||null:null,'include':_0x2ecd7c[_0x47be('0x1a')]?_0x2ecd7c[_0x47be('0x1a')][_0x47be('0x1f')]?_[_0x47be('0x20')](_0x2ecd7c[_0x47be('0x1a')][_0x47be('0x1f')],function(_0x5754dc){return{'model':db[_0x5754dc['model']],'as':_0x5754dc['as'],'attributes':_0x5754dc[_0x47be('0x1d')],'include':_0x5754dc[_0x47be('0x1f')]?_[_0x47be('0x20')](_0x5754dc[_0x47be('0x1f')],function(_0x44ecd3){return{'model':db[_0x44ecd3[_0x47be('0x21')]],'as':_0x44ecd3['as'],'attributes':_0x44ecd3[_0x47be('0x1d')],'include':_0x44ecd3['include']?_['map'](_0x44ecd3[_0x47be('0x1f')],function(_0x48b706){return{'model':db[_0x48b706[_0x47be('0x21')]],'as':_0x48b706['as'],'attributes':_0x48b706[_0x47be('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x195c07){logger[_0x47be('0x16')](_0x47be('0x22'),_0x2ecd7c);logger[_0x47be('0xf')](_0x47be('0x22'),_0x2ecd7c,JSON[_0x47be('0x11')](_0x195c07));_0x4feaef(_0x195c07);})[_0x47be('0x23')](function(_0x12ff40){logger[_0x47be('0x12')](_0x47be('0x22'),_0x12ff40[_0x47be('0x14')],_0x2ecd7c);_0x588b3a(_0x23e5fb[_0x47be('0x12')](0x1f4,_0x12ff40[_0x47be('0x14')]));});});};exports['ShowTrunk']=function(_0x2f3bcc){var _0x48f090=this;return new Promise(function(_0x285537,_0x2f195d){return db['Trunk']['find']({'raw':_0x2f3bcc[_0x47be('0x1a')]?_0x2f3bcc['options'][_0x47be('0x1b')]===undefined?!![]:![]:!![],'where':_0x2f3bcc[_0x47be('0x1a')]?_0x2f3bcc[_0x47be('0x1a')][_0x47be('0x1c')]||null:null,'attributes':_0x2f3bcc['options']?_0x2f3bcc[_0x47be('0x1a')][_0x47be('0x1d')]||null:null,'include':_0x2f3bcc['options']?_0x2f3bcc[_0x47be('0x1a')][_0x47be('0x1f')]?_['map'](_0x2f3bcc[_0x47be('0x1a')]['include'],function(_0x86c8f6){return{'model':db[_0x86c8f6[_0x47be('0x21')]],'as':_0x86c8f6['as'],'attributes':_0x86c8f6[_0x47be('0x1d')],'include':_0x86c8f6[_0x47be('0x1f')]?_[_0x47be('0x20')](_0x86c8f6[_0x47be('0x1f')],function(_0x59af5b){return{'model':db[_0x59af5b[_0x47be('0x21')]],'as':_0x59af5b['as'],'attributes':_0x59af5b['attributes'],'include':_0x59af5b[_0x47be('0x1f')]?_['map'](_0x59af5b[_0x47be('0x1f')],function(_0xe1f5dd){return{'model':db[_0xe1f5dd[_0x47be('0x21')]],'as':_0xe1f5dd['as'],'attributes':_0xe1f5dd[_0x47be('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e95a4){logger[_0x47be('0x16')](_0x47be('0x24'),_0x2f3bcc);logger['debug'](_0x47be('0x24'),_0x2f3bcc,JSON['stringify'](_0x4e95a4));_0x285537(_0x4e95a4);})[_0x47be('0x23')](function(_0x3ee14a){logger[_0x47be('0x12')](_0x47be('0x24'),_0x3ee14a[_0x47be('0x14')],_0x2f3bcc);_0x2f195d(_0x48f090['error'](0x1f4,_0x3ee14a[_0x47be('0x14')]));});});}; \ No newline at end of file +var _0xd36d=['result','findAll','options','raw','attributes','limit','include','map','model','GetTrunk','catch','ShowTrunk','Trunk','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x38b55f,_0xde010e){var _0x3d5a84=function(_0x338966){while(--_0x338966){_0x38b55f['push'](_0x38b55f['shift']());}};_0x3d5a84(++_0xde010e);}(_0xd36d,0x92));var _0xdd36=function(_0x5bfeac,_0x5123a5){_0x5bfeac=_0x5bfeac-0x0;var _0x38dc91=_0xd36d[_0x5bfeac];return _0x38dc91;};'use strict';var _=require('lodash');var util=require(_0xdd36('0x0'));var moment=require(_0xdd36('0x1'));var BPromise=require(_0xdd36('0x2'));var rs=require(_0xdd36('0x3'));var fs=require('fs');var Redis=require(_0xdd36('0x4'));var db=require(_0xdd36('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd36('0x6'))('rpc');var config=require(_0xdd36('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdd36('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x49004e,_0x6b3940,_0x577e89){return new BPromise(function(_0x19f737,_0x12b7a4){return client[_0xdd36('0x9')](_0x49004e,_0x577e89)[_0xdd36('0xa')](function(_0x5644ae){logger[_0xdd36('0xb')](_0xdd36('0xc'),_0x6b3940,_0xdd36('0xd'));logger[_0xdd36('0xe')](_0xdd36('0xf'),_0x6b3940,_0xdd36('0xd'),JSON[_0xdd36('0x10')](_0x5644ae));if(_0x5644ae['error']){if(_0x5644ae['error']['code']===0x1f4){logger[_0xdd36('0x11')](_0xdd36('0xc'),_0x6b3940,_0x5644ae[_0xdd36('0x11')][_0xdd36('0x12')]);return _0x12b7a4(_0x5644ae[_0xdd36('0x11')][_0xdd36('0x12')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x6b3940,_0x5644ae['error']['message']);return _0x19f737(_0x5644ae[_0xdd36('0x11')][_0xdd36('0x12')]);}else{logger[_0xdd36('0xb')](_0xdd36('0xc'),_0x6b3940,_0xdd36('0xd'));_0x19f737(_0x5644ae[_0xdd36('0x13')][_0xdd36('0x12')]);}})['catch'](function(_0x1584c5){logger['error']('Trunk,\x20%s,\x20%s',_0x6b3940,_0x1584c5);_0x12b7a4(_0x1584c5);});});}exports['GetTrunk']=function(_0x8cbf0){var _0x671a17=this;return new Promise(function(_0x12fc0d,_0x4bfb7c){return db['Trunk'][_0xdd36('0x14')]({'raw':_0x8cbf0[_0xdd36('0x15')]?_0x8cbf0[_0xdd36('0x15')][_0xdd36('0x16')]===undefined?!![]:![]:!![],'where':_0x8cbf0[_0xdd36('0x15')]?_0x8cbf0['options']['where']||null:null,'attributes':_0x8cbf0[_0xdd36('0x15')]?_0x8cbf0[_0xdd36('0x15')][_0xdd36('0x17')]||null:null,'limit':_0x8cbf0['options']?_0x8cbf0[_0xdd36('0x15')][_0xdd36('0x18')]||null:null,'include':_0x8cbf0[_0xdd36('0x15')]?_0x8cbf0['options'][_0xdd36('0x19')]?_[_0xdd36('0x1a')](_0x8cbf0[_0xdd36('0x15')]['include'],function(_0x5968ae){return{'model':db[_0x5968ae[_0xdd36('0x1b')]],'as':_0x5968ae['as'],'attributes':_0x5968ae[_0xdd36('0x17')],'include':_0x5968ae[_0xdd36('0x19')]?_['map'](_0x5968ae[_0xdd36('0x19')],function(_0xee909d){return{'model':db[_0xee909d['model']],'as':_0xee909d['as'],'attributes':_0xee909d[_0xdd36('0x17')],'include':_0xee909d[_0xdd36('0x19')]?_[_0xdd36('0x1a')](_0xee909d[_0xdd36('0x19')],function(_0x52806e){return{'model':db[_0x52806e[_0xdd36('0x1b')]],'as':_0x52806e['as'],'attributes':_0x52806e[_0xdd36('0x17')]};}):[]};}):[]};}):[]:[]})[_0xdd36('0xa')](function(_0xc847d5){logger['info'](_0xdd36('0x1c'),_0x8cbf0);logger[_0xdd36('0xe')](_0xdd36('0x1c'),_0x8cbf0,JSON[_0xdd36('0x10')](_0xc847d5));_0x12fc0d(_0xc847d5);})[_0xdd36('0x1d')](function(_0x51731d){logger[_0xdd36('0x11')](_0xdd36('0x1c'),_0x51731d[_0xdd36('0x12')],_0x8cbf0);_0x4bfb7c(_0x671a17[_0xdd36('0x11')](0x1f4,_0x51731d[_0xdd36('0x12')]));});});};exports[_0xdd36('0x1e')]=function(_0x299dc1){var _0x1554dd=this;return new Promise(function(_0x37c015,_0x4ad855){return db[_0xdd36('0x1f')][_0xdd36('0x20')]({'raw':_0x299dc1[_0xdd36('0x15')]?_0x299dc1[_0xdd36('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x299dc1[_0xdd36('0x15')]?_0x299dc1['options']['where']||null:null,'attributes':_0x299dc1[_0xdd36('0x15')]?_0x299dc1[_0xdd36('0x15')][_0xdd36('0x17')]||null:null,'include':_0x299dc1[_0xdd36('0x15')]?_0x299dc1[_0xdd36('0x15')][_0xdd36('0x19')]?_['map'](_0x299dc1[_0xdd36('0x15')][_0xdd36('0x19')],function(_0x143adf){return{'model':db[_0x143adf['model']],'as':_0x143adf['as'],'attributes':_0x143adf['attributes'],'include':_0x143adf[_0xdd36('0x19')]?_[_0xdd36('0x1a')](_0x143adf[_0xdd36('0x19')],function(_0xffd3af){return{'model':db[_0xffd3af[_0xdd36('0x1b')]],'as':_0xffd3af['as'],'attributes':_0xffd3af[_0xdd36('0x17')],'include':_0xffd3af[_0xdd36('0x19')]?_[_0xdd36('0x1a')](_0xffd3af[_0xdd36('0x19')],function(_0x5d14e0){return{'model':db[_0x5d14e0[_0xdd36('0x1b')]],'as':_0x5d14e0['as'],'attributes':_0x5d14e0[_0xdd36('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xce1b98){logger[_0xdd36('0xb')]('ShowTrunk',_0x299dc1);logger[_0xdd36('0xe')](_0xdd36('0x1e'),_0x299dc1,JSON[_0xdd36('0x10')](_0xce1b98));_0x37c015(_0xce1b98);})['catch'](function(_0x157b91){logger[_0xdd36('0x11')](_0xdd36('0x1e'),_0x157b91[_0xdd36('0x12')],_0x299dc1);_0x4ad855(_0x1554dd[_0xdd36('0x11')](0x1f4,_0x157b91['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 9c5b4a1..a00799a 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 _0x63cb=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','/:id/groups','/:id/recordings','getRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','getFaxInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/fax_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','getScheduledCalls','/:id/api_key','getApiKey','post','bulkCreate','addContacts','create','addQueues','diskStorage','root','format','now','single','/:id/login','login','/:id/logout','/:id/pause','pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addSquareProjects','put','update','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','removeChatInteractions','/:id/fax_interactions','removeFaxInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeSquareProjects'];(function(_0xf1942e,_0x1fa48d){var _0x58f2ac=function(_0x2447d4){while(--_0x2447d4){_0xf1942e['push'](_0xf1942e['shift']());}};_0x58f2ac(++_0x1fa48d);}(_0x63cb,0x124));var _0xb63c=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x63cb[_0x2555d0];return _0x3bb486;};'use strict';var multer=require(_0xb63c('0x0'));var util=require(_0xb63c('0x1'));var path=require(_0xb63c('0x2'));var timeout=require(_0xb63c('0x3'));var express=require(_0xb63c('0x4'));var router=express[_0xb63c('0x5')]();var auth=require(_0xb63c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb63c('0x7'));var controller=require('./user.controller');router[_0xb63c('0x8')]('/',auth[_0xb63c('0x9')](),controller[_0xb63c('0xa')]);router[_0xb63c('0x8')](_0xb63c('0xb'),auth[_0xb63c('0x9')](),controller[_0xb63c('0xc')]);router[_0xb63c('0x8')](_0xb63c('0xd'),auth['isAuthenticated'](),controller[_0xb63c('0xe')]);router[_0xb63c('0x8')](_0xb63c('0xf'),controller[_0xb63c('0x10')]);router[_0xb63c('0x8')](_0xb63c('0x11'),auth[_0xb63c('0x9')](),controller[_0xb63c('0x12')]);router[_0xb63c('0x8')](_0xb63c('0x13'),auth[_0xb63c('0x9')](),controller['getQueues']);router[_0xb63c('0x8')](_0xb63c('0x14'),auth[_0xb63c('0x9')](),controller['getVoiceQueuesRt']);router['get'](_0xb63c('0x15'),auth[_0xb63c('0x9')](),controller['getGroups']);router[_0xb63c('0x8')](_0xb63c('0x16'),auth[_0xb63c('0x9')](),controller[_0xb63c('0x17')]);router[_0xb63c('0x8')]('/:id/chat/interactions',auth[_0xb63c('0x9')](),controller[_0xb63c('0x18')]);router[_0xb63c('0x8')](_0xb63c('0x19'),auth[_0xb63c('0x9')](),controller[_0xb63c('0x1a')]);router[_0xb63c('0x8')](_0xb63c('0x1b'),auth[_0xb63c('0x9')](),controller[_0xb63c('0x1c')]);router['get']('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0xb63c('0x1d')]);router[_0xb63c('0x8')]('/:id/fax/interactions',auth[_0xb63c('0x9')](),controller[_0xb63c('0x1e')]);router[_0xb63c('0x8')](_0xb63c('0x1f'),auth['isAuthenticated'](),controller[_0xb63c('0x20')]);router[_0xb63c('0x8')](_0xb63c('0x21'),auth['isAuthenticated'](),controller[_0xb63c('0x22')]);router['get'](_0xb63c('0x23'),auth['isAuthenticated'](),controller[_0xb63c('0x24')]);router[_0xb63c('0x8')]('/:id/prefixes',auth['isAuthenticated'](),controller['getVoicePrefixes']);router[_0xb63c('0x8')](_0xb63c('0x25'),auth['isAuthenticated'](),controller['getFaxAccounts']);router['get']('/:id/mail_accounts',auth[_0xb63c('0x9')](),controller['getMailAccounts']);router[_0xb63c('0x8')](_0xb63c('0x26'),auth['isAuthenticated'](),controller[_0xb63c('0x27')]);router[_0xb63c('0x8')](_0xb63c('0x28'),auth[_0xb63c('0x9')](),controller[_0xb63c('0x29')]);router[_0xb63c('0x8')](_0xb63c('0x2a'),auth[_0xb63c('0x9')](),controller[_0xb63c('0x2b')]);router[_0xb63c('0x8')](_0xb63c('0x2c'),auth['isAuthenticated'](),controller['getSquareProjects']);router[_0xb63c('0x8')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0xb63c('0x2d')]);router['get'](_0xb63c('0x2e'),auth[_0xb63c('0x9')](),controller[_0xb63c('0x2f')]);router[_0xb63c('0x30')]('/create_many',auth['isAuthenticated'](),controller[_0xb63c('0x31')]);router[_0xb63c('0x30')]('/:id/contacts',auth[_0xb63c('0x9')](),controller[_0xb63c('0x32')]);router[_0xb63c('0x30')]('/',auth[_0xb63c('0x9')](),controller[_0xb63c('0x33')]);router[_0xb63c('0x30')]('/:id/queues',auth[_0xb63c('0x9')](),controller[_0xb63c('0x34')]);var upload=multer({'storage':multer[_0xb63c('0x35')]({'destination':function(_0xd220a3,_0x6e06a8,_0x18bc46){_0x18bc46(null,path['join'](config[_0xb63c('0x36')],'server/files/images/'));},'filename':function(_0x3a8493,_0x10d2cf,_0x39d702){_0x39d702(null,util[_0xb63c('0x37')]('%s-%s',Date[_0xb63c('0x38')](),_0x10d2cf['originalname']));}})});router[_0xb63c('0x30')](_0xb63c('0xf'),upload[_0xb63c('0x39')]('file'),controller['addAvatar']);router['post'](_0xb63c('0x3a'),auth[_0xb63c('0x9')](),controller[_0xb63c('0x3b')]);router[_0xb63c('0x30')](_0xb63c('0x3c'),auth[_0xb63c('0x9')](),controller['logout']);router[_0xb63c('0x30')](_0xb63c('0x3d'),auth[_0xb63c('0x9')](),controller[_0xb63c('0x3e')]);router[_0xb63c('0x30')]('/:id/unpause',auth[_0xb63c('0x9')](),controller[_0xb63c('0x3f')]);router[_0xb63c('0x30')](_0xb63c('0x1f'),auth[_0xb63c('0x9')](),controller[_0xb63c('0x40')]);router['post'](_0xb63c('0x41'),auth[_0xb63c('0x9')](),controller[_0xb63c('0x42')]);router[_0xb63c('0x30')](_0xb63c('0x43'),auth[_0xb63c('0x9')](),controller['addMailInteractions']);router[_0xb63c('0x30')]('/:id/fax_interactions',auth[_0xb63c('0x9')](),controller[_0xb63c('0x44')]);router[_0xb63c('0x30')](_0xb63c('0x45'),auth[_0xb63c('0x9')](),controller['addSmsInteractions']);router[_0xb63c('0x30')](_0xb63c('0x46'),auth['isAuthenticated'](),controller[_0xb63c('0x47')]);router[_0xb63c('0x30')]('/:id/fax_accounts',auth[_0xb63c('0x9')](),controller[_0xb63c('0x48')]);router[_0xb63c('0x30')](_0xb63c('0x49'),auth[_0xb63c('0x9')](),controller[_0xb63c('0x4a')]);router[_0xb63c('0x30')](_0xb63c('0x26'),auth['isAuthenticated'](),controller[_0xb63c('0x4b')]);router[_0xb63c('0x30')](_0xb63c('0x28'),auth[_0xb63c('0x9')](),controller[_0xb63c('0x4c')]);router[_0xb63c('0x30')](_0xb63c('0x2a'),auth['isAuthenticated'](),controller[_0xb63c('0x4d')]);router[_0xb63c('0x30')](_0xb63c('0x2c'),auth[_0xb63c('0x9')](),controller[_0xb63c('0x4e')]);router[_0xb63c('0x30')](_0xb63c('0x2e'),auth[_0xb63c('0x9')](),controller['createApiKey']);router[_0xb63c('0x4f')](_0xb63c('0xd'),auth['isAuthenticated'](),controller[_0xb63c('0x50')]);router[_0xb63c('0x4f')](_0xb63c('0x51'),auth[_0xb63c('0x9')](),controller[_0xb63c('0x52')]);router['delete'](_0xb63c('0x13'),auth[_0xb63c('0x9')](),controller[_0xb63c('0x53')]);router[_0xb63c('0x54')](_0xb63c('0x1f'),auth[_0xb63c('0x9')](),controller[_0xb63c('0x55')]);router[_0xb63c('0x54')](_0xb63c('0xd'),auth[_0xb63c('0x9')](),controller[_0xb63c('0x56')]);router[_0xb63c('0x54')]('/:id/chat_interactions',auth[_0xb63c('0x9')](),controller[_0xb63c('0x57')]);router[_0xb63c('0x54')](_0xb63c('0x43'),auth[_0xb63c('0x9')](),controller['removeMailInteractions']);router[_0xb63c('0x54')](_0xb63c('0x58'),auth[_0xb63c('0x9')](),controller[_0xb63c('0x59')]);router[_0xb63c('0x54')](_0xb63c('0x45'),auth[_0xb63c('0x9')](),controller['removeSmsInteractions']);router['delete'](_0xb63c('0x46'),auth[_0xb63c('0x9')](),controller[_0xb63c('0x5a')]);router[_0xb63c('0x54')](_0xb63c('0x25'),auth[_0xb63c('0x9')](),controller[_0xb63c('0x5b')]);router[_0xb63c('0x54')](_0xb63c('0x49'),auth[_0xb63c('0x9')](),controller[_0xb63c('0x5c')]);router[_0xb63c('0x54')](_0xb63c('0x26'),auth[_0xb63c('0x9')](),controller[_0xb63c('0x5d')]);router['delete']('/:id/sms_accounts',auth[_0xb63c('0x9')](),controller['removeSmsAccounts']);router['delete'](_0xb63c('0x2a'),auth['isAuthenticated'](),controller[_0xb63c('0x5e')]);router[_0xb63c('0x54')]('/:id/square_projects',auth[_0xb63c('0x9')](),controller[_0xb63c('0x5f')]);router[_0xb63c('0x54')](_0xb63c('0x2e'),auth[_0xb63c('0x9')](),controller['removeApiKey']);module[_0xb63c('0x60')]=router; \ No newline at end of file +var _0x7410=['exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','/:id','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','addMailInteractions','addFaxInteractions','addSmsInteractions','addOpenchannelInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addChatWebsites','update','put','changePassword','delete','removeQueues','destroy','/:id/chat_interactions','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','/:id/fax_interactions','/:id/sms_interactions','removeSmsInteractions','/:id/openchannel_interactions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeApiKey'];(function(_0x599be9,_0x379150){var _0x3e191f=function(_0x19d5bd){while(--_0x19d5bd){_0x599be9['push'](_0x599be9['shift']());}};_0x3e191f(++_0x379150);}(_0x7410,0x6c));var _0x0741=function(_0x1a5730,_0x228d67){_0x1a5730=_0x1a5730-0x0;var _0x5bf0c4=_0x7410[_0x1a5730];return _0x5bf0c4;};'use strict';var multer=require(_0x0741('0x0'));var util=require(_0x0741('0x1'));var path=require(_0x0741('0x2'));var timeout=require('connect-timeout');var express=require(_0x0741('0x3'));var router=express[_0x0741('0x4')]();var auth=require(_0x0741('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0741('0x6'));var controller=require(_0x0741('0x7'));router[_0x0741('0x8')]('/',auth[_0x0741('0x9')](),controller['index']);router[_0x0741('0x8')](_0x0741('0xa'),auth[_0x0741('0x9')](),controller['describe']);router[_0x0741('0x8')](_0x0741('0xb'),auth[_0x0741('0x9')](),controller[_0x0741('0xc')]);router[_0x0741('0x8')](_0x0741('0xd'),controller[_0x0741('0xe')]);router['get'](_0x0741('0xf'),auth['isAuthenticated'](),controller[_0x0741('0x10')]);router[_0x0741('0x8')](_0x0741('0x11'),auth[_0x0741('0x9')](),controller[_0x0741('0x12')]);router['get'](_0x0741('0x13'),auth[_0x0741('0x9')](),controller[_0x0741('0x14')]);router['get'](_0x0741('0x15'),auth[_0x0741('0x9')](),controller[_0x0741('0x16')]);router[_0x0741('0x8')](_0x0741('0x17'),auth[_0x0741('0x9')](),controller['getRecordings']);router[_0x0741('0x8')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0x0741('0x18')]);router[_0x0741('0x8')](_0x0741('0x19'),auth[_0x0741('0x9')](),controller[_0x0741('0x1a')]);router[_0x0741('0x8')](_0x0741('0x1b'),auth['isAuthenticated'](),controller[_0x0741('0x1c')]);router['get'](_0x0741('0x1d'),auth[_0x0741('0x9')](),controller[_0x0741('0x1e')]);router[_0x0741('0x8')](_0x0741('0x1f'),auth[_0x0741('0x9')](),controller[_0x0741('0x20')]);router[_0x0741('0x8')](_0x0741('0x21'),auth[_0x0741('0x9')](),controller[_0x0741('0x22')]);router['get'](_0x0741('0x23'),auth[_0x0741('0x9')](),controller[_0x0741('0x24')]);router[_0x0741('0x8')](_0x0741('0x25'),auth['isAuthenticated'](),controller[_0x0741('0x26')]);router['get'](_0x0741('0x27'),auth['isAuthenticated'](),controller[_0x0741('0x28')]);router[_0x0741('0x8')](_0x0741('0x29'),auth['isAuthenticated'](),controller[_0x0741('0x2a')]);router[_0x0741('0x8')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x0741('0x2b')]);router[_0x0741('0x8')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router[_0x0741('0x8')](_0x0741('0x2c'),auth['isAuthenticated'](),controller[_0x0741('0x2d')]);router[_0x0741('0x8')](_0x0741('0x2e'),auth[_0x0741('0x9')](),controller[_0x0741('0x2f')]);router[_0x0741('0x8')](_0x0741('0x30'),auth[_0x0741('0x9')](),controller[_0x0741('0x31')]);router[_0x0741('0x8')](_0x0741('0x32'),auth[_0x0741('0x9')](),controller[_0x0741('0x33')]);router[_0x0741('0x8')](_0x0741('0x34'),auth[_0x0741('0x9')](),controller[_0x0741('0x35')]);router['post']('/create_many',auth['isAuthenticated'](),controller['bulkCreate']);router[_0x0741('0x36')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x0741('0x37')]);router[_0x0741('0x36')]('/',auth[_0x0741('0x9')](),controller['create']);router[_0x0741('0x36')](_0x0741('0x11'),auth[_0x0741('0x9')](),controller[_0x0741('0x38')]);var upload=multer({'storage':multer[_0x0741('0x39')]({'destination':function(_0x3851a7,_0x22c588,_0x169b81){_0x169b81(null,path[_0x0741('0x3a')](config[_0x0741('0x3b')],_0x0741('0x3c')));},'filename':function(_0x8227f2,_0x5c47f3,_0x1d14da){_0x1d14da(null,util[_0x0741('0x3d')](_0x0741('0x3e'),Date[_0x0741('0x3f')](),_0x5c47f3[_0x0741('0x40')]));}})});router[_0x0741('0x36')](_0x0741('0xd'),upload[_0x0741('0x41')]('file'),controller[_0x0741('0x42')]);router[_0x0741('0x36')](_0x0741('0x43'),auth[_0x0741('0x9')](),controller[_0x0741('0x44')]);router[_0x0741('0x36')](_0x0741('0x45'),auth[_0x0741('0x9')](),controller[_0x0741('0x46')]);router[_0x0741('0x36')](_0x0741('0x47'),auth[_0x0741('0x9')](),controller[_0x0741('0x48')]);router[_0x0741('0x36')](_0x0741('0x49'),auth[_0x0741('0x9')](),controller[_0x0741('0x4a')]);router[_0x0741('0x36')]('/:id/teams',auth['isAuthenticated'](),controller[_0x0741('0x4b')]);router[_0x0741('0x36')]('/:id/chat_interactions',auth[_0x0741('0x9')](),controller['addChatInteractions']);router[_0x0741('0x36')]('/:id/mail_interactions',auth[_0x0741('0x9')](),controller[_0x0741('0x4c')]);router[_0x0741('0x36')]('/:id/fax_interactions',auth[_0x0741('0x9')](),controller[_0x0741('0x4d')]);router[_0x0741('0x36')]('/:id/sms_interactions',auth[_0x0741('0x9')](),controller[_0x0741('0x4e')]);router[_0x0741('0x36')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x0741('0x4f')]);router[_0x0741('0x36')](_0x0741('0x29'),auth[_0x0741('0x9')](),controller[_0x0741('0x50')]);router['post'](_0x0741('0x51'),auth[_0x0741('0x9')](),controller[_0x0741('0x52')]);router[_0x0741('0x36')](_0x0741('0x53'),auth[_0x0741('0x9')](),controller[_0x0741('0x54')]);router['post'](_0x0741('0x2c'),auth[_0x0741('0x9')](),controller['addSmsAccounts']);router[_0x0741('0x36')](_0x0741('0x2e'),auth[_0x0741('0x9')](),controller[_0x0741('0x55')]);router[_0x0741('0x36')](_0x0741('0x30'),auth['isAuthenticated'](),controller['addSquareProjects']);router['post'](_0x0741('0x34'),auth[_0x0741('0x9')](),controller['createApiKey']);router['put'](_0x0741('0xb'),auth[_0x0741('0x9')](),controller[_0x0741('0x56')]);router[_0x0741('0x57')]('/:id/password',auth['isAuthenticated'](),controller[_0x0741('0x58')]);router[_0x0741('0x59')](_0x0741('0x11'),auth[_0x0741('0x9')](),controller[_0x0741('0x5a')]);router[_0x0741('0x59')](_0x0741('0x21'),auth[_0x0741('0x9')](),controller['removeTeams']);router[_0x0741('0x59')]('/:id',auth[_0x0741('0x9')](),controller[_0x0741('0x5b')]);router[_0x0741('0x59')](_0x0741('0x5c'),auth[_0x0741('0x9')](),controller[_0x0741('0x5d')]);router[_0x0741('0x59')](_0x0741('0x5e'),auth[_0x0741('0x9')](),controller[_0x0741('0x5f')]);router[_0x0741('0x59')](_0x0741('0x60'),auth[_0x0741('0x9')](),controller['removeFaxInteractions']);router[_0x0741('0x59')](_0x0741('0x61'),auth[_0x0741('0x9')](),controller[_0x0741('0x62')]);router[_0x0741('0x59')](_0x0741('0x63'),auth[_0x0741('0x9')](),controller['removeOpenchannelInteractions']);router['delete']('/:id/fax_accounts',auth[_0x0741('0x9')](),controller[_0x0741('0x64')]);router[_0x0741('0x59')](_0x0741('0x51'),auth[_0x0741('0x9')](),controller[_0x0741('0x65')]);router[_0x0741('0x59')](_0x0741('0x53'),auth[_0x0741('0x9')](),controller[_0x0741('0x66')]);router[_0x0741('0x59')](_0x0741('0x2c'),auth[_0x0741('0x9')](),controller[_0x0741('0x67')]);router[_0x0741('0x59')](_0x0741('0x2e'),auth[_0x0741('0x9')](),controller[_0x0741('0x68')]);router[_0x0741('0x59')](_0x0741('0x30'),auth[_0x0741('0x9')](),controller['removeSquareProjects']);router[_0x0741('0x59')](_0x0741('0x34'),auth[_0x0741('0x9')](),controller[_0x0741('0x69')]);module[_0x0741('0x6a')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 9f366d9..e226972 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 _0xa91d=['email','toLowerCase','ENUM','user','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','dynamic','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','update','yes','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','refuse','uac','fingerprint','certificate','active','actpass','nonat','update,nonat','DATE','showWebBar','get','isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','avpf','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','sequelize','util','exports','STRING','name','setDataValue','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal'];(function(_0x42334c,_0x379771){var _0x4feed7=function(_0x1a8786){while(--_0x1a8786){_0x42334c['push'](_0x42334c['shift']());}};_0x4feed7(++_0x379771);}(_0xa91d,0x134));var _0xda91=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa91d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xda91('0x0'));var moment=require('moment');var util=require(_0xda91('0x1'));var _=require('lodash');module[_0xda91('0x2')]={'name':{'type':Sequelize[_0xda91('0x3')],'allowNull':![],'unique':_0xda91('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x374710){this[_0xda91('0x5')]('name',_0x374710);this['setDataValue']('defaultuser',_0x374710);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0xda91('0x3')],'allowNull':![],'set':function(_0x181788){this[_0xda91('0x5')](_0xda91('0x6'),_0x181788);this[_0xda91('0x5')](_0xda91('0x7'),util[_0xda91('0x8')](_0xda91('0x9'),_0x181788,this[_0xda91('0xa')](_0xda91('0xb'))));}},'alias':{'type':Sequelize[_0xda91('0x3')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xda91('0xc'),'validate':{'isEmail':!![]},'set':function(_0xba36f4){if(_0xba36f4){this[_0xda91('0x5')]('email',_0xba36f4[_0xda91('0xd')]());}}},'role':{'type':Sequelize[_0xda91('0xe')]('admin',_0xda91('0xf'),_0xda91('0x10'),_0xda91('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0xda91('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0xda91('0x12')},'internal':{'type':Sequelize[_0xda91('0x13')](0xb),'allowNull':![],'unique':_0xda91('0xb'),'set':function(_0x5caea1){this[_0xda91('0x5')](_0xda91('0xb'),_0x5caea1);this['setDataValue'](_0xda91('0x14'),_0x5caea1);this[_0xda91('0x5')](_0xda91('0x7'),util['format']('\x22%s\x22\x20<%s>',this[_0xda91('0xa')](_0xda91('0x6')),_0x5caea1));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xda91('0x3')]},'userpic':{'type':Sequelize[_0xda91('0x3')]},'city':{'type':Sequelize[_0xda91('0x3')]},'country':{'type':Sequelize[_0xda91('0x3')]},'online':{'type':Sequelize[_0xda91('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xda91('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xda91('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xda91('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xda91('0x3')],'defaultValue':_0xda91('0x16')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xda91('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xda91('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xda91('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xda91('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xda91('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xda91('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xda91('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xda91('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xda91('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![],'defaultValue':_0xda91('0x17')},'ipaddr':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0xda91('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xda91('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xda91('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xda91('0xe')]('friend',_0xda91('0xf'),_0xda91('0x18')),'allowNull':!![],'defaultValue':_0xda91('0x19')},'context':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![],'defaultValue':_0xda91('0x1a')},'callingpres':{'type':Sequelize['ENUM'](_0xda91('0x1b'),'ALLOWED_PASSED_SCREEN',_0xda91('0x1c'),'ALLOWED',_0xda91('0x1d'),_0xda91('0x1e'),_0xda91('0x1f'),_0xda91('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xda91('0x21'),'set':function(_0x40fd6d){this['setDataValue']('transport',_0x40fd6d?_0x40fd6d[_0xda91('0x22')](','):null);},'get':function(){return this[_0xda91('0xa')](_0xda91('0x23'))?this[_0xda91('0xa')]('transport')[_0xda91('0x24')](','):null;},'comment':_0xda91('0x25')},'dtmfmode':{'type':Sequelize[_0xda91('0xe')](_0xda91('0x26'),_0xda91('0x27'),'shortinfo',_0xda91('0x28'),_0xda91('0x29')),'allowNull':!![],'defaultValue':_0xda91('0x26')},'directmedia':{'type':Sequelize['ENUM']('yes','no','nonat',_0xda91('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xda91('0xe')](_0xda91('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![],'defaultValue':_0xda91('0x2c'),'set':function(_0xd9be86){this['setDataValue'](_0xda91('0x2d'),_0xd9be86?_0xd9be86[_0xda91('0x22')](','):null);},'get':function(){return this['getDataValue'](_0xda91('0x2d'))?this[_0xda91('0xa')](_0xda91('0x2d'))[_0xda91('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xda91('0x3')]},'namedcallgroup':{'type':Sequelize[_0xda91('0x3')]},'pickupgroup':{'type':Sequelize[_0xda91('0x3')]},'namedpickupgroup':{'type':Sequelize[_0xda91('0x3')]},'language':{'type':Sequelize[_0xda91('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xda91('0x3')]},'disallow':{'type':Sequelize[_0xda91('0x3')],'allowNull':![],'defaultValue':_0xda91('0x2e')},'allow':{'type':Sequelize[_0xda91('0x3')],'allowNull':![],'defaultValue':_0xda91('0x2f'),'set':function(_0x3c8bcf){this[_0xda91('0x5')]('allow',_0x3c8bcf?_0x3c8bcf['join'](';'):_0xda91('0x2f'));},'get':function(){return this[_0xda91('0xa')](_0xda91('0x30'))?this[_0xda91('0xa')](_0xda91('0x30'))[_0xda91('0x24')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xda91('0xe')](_0xda91('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![],'set':function(_0x541c08){this[_0xda91('0x5')]('insecure',_0x541c08?_0x541c08[_0xda91('0x22')](','):null);},'get':function(){return this[_0xda91('0xa')](_0xda91('0x31'))?this['getDataValue'](_0xda91('0x31'))[_0xda91('0x24')](','):null;},'comment':_0xda91('0x32')},'trustrpid':{'type':Sequelize[_0xda91('0xe')](_0xda91('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xda91('0xe')](_0xda91('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xda91('0xe')](_0xda91('0x2b'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xda91('0xe')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xda91('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![],'defaultValue':_0xda91('0x33')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xda91('0x2b'),'no'),'allowNull':!![],'defaultValue':_0xda91('0x2b')},'busylevel':{'type':Sequelize[_0xda91('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xda91('0xe')](_0xda91('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xda91('0xe')](_0xda91('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0xda91('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xda91('0xe')](_0xda91('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xda91('0xe')](_0xda91('0x2b'),'no',_0xda91('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xda91('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xda91('0xe')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xda91('0xe')]('accept',_0xda91('0x35'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xda91('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0xda91('0x36'),'uas'),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0xda91('0xe')]('yes','no'),'allowNull':!![],'defaultValue':_0xda91('0x2b')},'keepalive':{'type':Sequelize[_0xda91('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xda91('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xda91('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xda91('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xda91('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xda91('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xda91('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xda91('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xda91('0xe')](_0xda91('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xda91('0xe')](_0xda91('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xda91('0xe')](_0xda91('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xda91('0xe')](_0xda91('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xda91('0xe')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xda91('0xe')](_0xda91('0x2b'),'no',_0xda91('0x37'),_0xda91('0x38')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xda91('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xda91('0xe')](_0xda91('0x39'),'passive',_0xda91('0x3a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xda91('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xda91('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xda91('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xda91('0xe')](_0xda91('0x2b'),'no',_0xda91('0x3b'),_0xda91('0x2a'),_0xda91('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xda91('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0xda91('0x3d')]},'showWebBar':{'type':Sequelize[_0xda91('0x13')],'defaultValue':0x0,'set':function(_0x5dbcb4){this[_0xda91('0x5')](_0xda91('0x3e'),_0x5dbcb4);var _0x10aade=this[_0xda91('0x3f')]({'plain':!![]});switch(_0x5dbcb4){case 0x0:case 0x1:var _0xea1493=_0x10aade[_0xda91('0x23')]?_[_0xda91('0x40')](_0x10aade[_0xda91('0x23')])?_0x10aade[_0xda91('0x23')][_0xda91('0x22')]():_0x10aade[_0xda91('0x23')]:'udp';if(_0xea1493===_0xda91('0x41')){_0xea1493=_0xda91('0x21');}this['setDataValue']('transport',_0xea1493);this[_0xda91('0x5')](_0xda91('0x42'),'no');this[_0xda91('0x5')]('avpf',null);this['setDataValue'](_0xda91('0x43'),null);this['setDataValue'](_0xda91('0x44'),null);this['setDataValue'](_0xda91('0x45'),null);this[_0xda91('0x5')](_0xda91('0x46'),null);this['setDataValue']('dtlssetup',null);this[_0xda91('0x5')](_0xda91('0x47'),null);this[_0xda91('0x5')](_0xda91('0x48'),null);this[_0xda91('0x5')](_0xda91('0x49'),'no');break;case 0x2:this[_0xda91('0x5')](_0xda91('0x23'),_0xda91('0x41'));this[_0xda91('0x5')](_0xda91('0x42'),'yes');this[_0xda91('0x5')](_0xda91('0x4a'),_0xda91('0x2b'));this[_0xda91('0x5')]('force_avp',_0xda91('0x2b'));this['setDataValue'](_0xda91('0x44'),_0xda91('0x2b'));this[_0xda91('0x5')](_0xda91('0x45'),_0xda91('0x2b'));this[_0xda91('0x5')](_0xda91('0x46'),'no');this[_0xda91('0x5')](_0xda91('0x4b'),_0xda91('0x3a'));this[_0xda91('0x5')](_0xda91('0x47'),_0x10aade[_0xda91('0x47')]||_0xda91('0x4c'));this[_0xda91('0x5')](_0xda91('0x48'),_0x10aade[_0xda91('0x48')]||_0xda91('0x4d'));this[_0xda91('0x5')](_0xda91('0x49'),_0xda91('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0xda91('0x4e')],'set':function(_0x4c4f6f){this['setDataValue'](_0xda91('0x4f'),_0x4c4f6f?_0x4c4f6f[_0xda91('0x22')](','):[]);},'get':function(){return this['getDataValue'](_0xda91('0x4f'))?_['map'](this['getDataValue'](_0xda91('0x4f'))[_0xda91('0x24')](','),function(_0x32f29a){return parseInt(_0x32f29a,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0xda91('0x3')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xda91('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xda91('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xda91('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xda91('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xda91('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xda91('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xda91('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xda91('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xda91('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xda91('0x3')]},'passwordResetAt':{'type':Sequelize[_0xda91('0x3d')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0xda91('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xda91('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xda91('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xda91('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0xda91('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xda91('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xda91('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0x770e=['join','split','rfc2833','info','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','allow','ulaw;alaw;gsm','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','certificate','passive','showWebBar','get','isArray','encryption','icesupport','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','avpf','force_avp','dtlsenable','actpass','dtlscertfile','TEXT','permissions','map','sequelize','moment','util','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','admin','agent','accountcode','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','friend','user','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport'];(function(_0x79602a,_0x2afe78){var _0x43df2=function(_0x156d33){while(--_0x156d33){_0x79602a['push'](_0x79602a['shift']());}};_0x43df2(++_0x2afe78);}(_0x770e,0xc9));var _0xe770=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x770e[_0x373dee];return _0x46798f;};'use strict';var Sequelize=require(_0xe770('0x0'));var moment=require(_0xe770('0x1'));var util=require(_0xe770('0x2'));var _=require('lodash');module[_0xe770('0x3')]={'name':{'type':Sequelize[_0xe770('0x4')],'allowNull':![],'unique':_0xe770('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4f071b){this[_0xe770('0x6')](_0xe770('0x5'),_0x4f071b);this[_0xe770('0x6')](_0xe770('0x7'),_0x4f071b);},'comment':_0xe770('0x8')},'fullname':{'type':Sequelize[_0xe770('0x4')],'allowNull':![],'set':function(_0x4d0015){this[_0xe770('0x6')]('fullname',_0x4d0015);this[_0xe770('0x6')](_0xe770('0x9'),util['format'](_0xe770('0xa'),_0x4d0015,this[_0xe770('0xb')](_0xe770('0xc'))));}},'alias':{'type':Sequelize[_0xe770('0x4')]},'email':{'type':Sequelize[_0xe770('0x4')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x35a856){if(_0x35a856){this['setDataValue'](_0xe770('0xd'),_0x35a856['toLowerCase']());}}},'role':{'type':Sequelize[_0xe770('0xe')](_0xe770('0xf'),'user',_0xe770('0x10'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xe770('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xe770('0x4')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xe770('0xc'),'set':function(_0x29b919){this[_0xe770('0x6')]('internal',_0x29b919);this[_0xe770('0x6')](_0xe770('0x11'),_0x29b919);this[_0xe770('0x6')]('callerid',util['format'](_0xe770('0xa'),this[_0xe770('0xb')](_0xe770('0x12')),_0x29b919));}},'salt':{'type':Sequelize[_0xe770('0x4')]},'phone':{'type':Sequelize[_0xe770('0x4')]},'mobile':{'type':Sequelize[_0xe770('0x4')]},'address':{'type':Sequelize[_0xe770('0x4')]},'zipcode':{'type':Sequelize[_0xe770('0x4')]},'userpic':{'type':Sequelize[_0xe770('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xe770('0x4')]},'online':{'type':Sequelize[_0xe770('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xe770('0x14')]},'voicePause':{'type':Sequelize[_0xe770('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xe770('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xe770('0x13')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xe770('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xe770('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xe770('0x4')],'defaultValue':_0xe770('0x15')},'lastPauseAt':{'type':Sequelize[_0xe770('0x14')]},'chatCapacity':{'type':Sequelize[_0xe770('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xe770('0x16')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xe770('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xe770('0x16')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xe770('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xe770('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xe770('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xe770('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xe770('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xe770('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xe770('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xe770('0x13')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xe770('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xe770('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xe770('0xe')](_0xe770('0x17'),_0xe770('0x18'),_0xe770('0x19')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![],'defaultValue':_0xe770('0x1a')},'callingpres':{'type':Sequelize[_0xe770('0xe')](_0xe770('0x1b'),_0xe770('0x1c'),'ALLOWED_FAILED_SCREEN',_0xe770('0x1d'),_0xe770('0x1e'),_0xe770('0x1f'),_0xe770('0x20'),_0xe770('0x21')),'allowNull':!![]},'deny':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xe770('0x22'),'set':function(_0xb78c95){this[_0xe770('0x6')](_0xe770('0x23'),_0xb78c95?_0xb78c95[_0xe770('0x24')](','):null);},'get':function(){return this[_0xe770('0xb')](_0xe770('0x23'))?this[_0xe770('0xb')]('transport')[_0xe770('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xe770('0xe')](_0xe770('0x26'),_0xe770('0x27'),'shortinfo',_0xe770('0x28'),_0xe770('0x29')),'allowNull':!![],'defaultValue':_0xe770('0x26')},'directmedia':{'type':Sequelize['ENUM'](_0xe770('0x2a'),'no',_0xe770('0x2b'),'update',_0xe770('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xe770('0xe')](_0xe770('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![],'defaultValue':_0xe770('0x2d'),'set':function(_0x2e7539){this[_0xe770('0x6')](_0xe770('0x2e'),_0x2e7539?_0x2e7539[_0xe770('0x24')](','):null);},'get':function(){return this[_0xe770('0xb')](_0xe770('0x2e'))?this[_0xe770('0xb')](_0xe770('0x2e'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xe770('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xe770('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xe770('0x4')]},'language':{'type':Sequelize[_0xe770('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe770('0x4')]},'disallow':{'type':Sequelize[_0xe770('0x4')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xe770('0x4')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x369d94){this[_0xe770('0x6')](_0xe770('0x2f'),_0x369d94?_0x369d94[_0xe770('0x24')](';'):_0xe770('0x30'));},'get':function(){return this[_0xe770('0xb')](_0xe770('0x2f'))?this['getDataValue']('allow')[_0xe770('0x25')](';'):null;},'comment':_0xe770('0x31')},'autoframing':{'type':Sequelize[_0xe770('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![],'set':function(_0x119ebf){this['setDataValue'](_0xe770('0x32'),_0x119ebf?_0x119ebf['join'](','):null);},'get':function(){return this[_0xe770('0xb')]('insecure')?this[_0xe770('0xb')](_0xe770('0x32'))[_0xe770('0x25')](','):null;},'comment':_0xe770('0x33')},'trustrpid':{'type':Sequelize[_0xe770('0xe')](_0xe770('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xe770('0xe')](_0xe770('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe770('0xe')](_0xe770('0x2a'),'no',_0xe770('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xe770('0xe')](_0xe770('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xe770('0xe')](_0xe770('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![],'defaultValue':_0xe770('0x35')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xe770('0xe')](_0xe770('0x2a'),'no'),'allowNull':!![],'defaultValue':_0xe770('0x2a')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xe770('0xe')](_0xe770('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xe770('0xe')](_0xe770('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xe770('0xe')](_0xe770('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xe770('0xe')](_0xe770('0x2a'),'no',_0xe770('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xe770('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xe770('0x37'),_0xe770('0x38'),_0xe770('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xe770('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xe770('0xe')](_0xe770('0x3a'),_0xe770('0x3b')),'allowNull':!![],'defaultValue':_0xe770('0x3b')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xe770('0xe')](_0xe770('0x2a'),'no'),'allowNull':!![],'defaultValue':_0xe770('0x2a')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xe770('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xe770('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xe770('0xe')](_0xe770('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xe770('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xe770('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe770('0xe')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xe770('0xe')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xe770('0xe')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xe770('0xe')](_0xe770('0x2a'),'no','fingerprint',_0xe770('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xe770('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xe770('0xe')]('active',_0xe770('0x3d'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xe770('0xe')](_0xe770('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xe770('0x16')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xe770('0xe')](_0xe770('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xe770('0xe')](_0xe770('0x2a'),'no',_0xe770('0x2b'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xe770('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0xe770('0x14')]},'showWebBar':{'type':Sequelize[_0xe770('0x16')],'defaultValue':0x0,'set':function(_0x393896){this[_0xe770('0x6')](_0xe770('0x3e'),_0x393896);var _0x120776=this[_0xe770('0x3f')]({'plain':!![]});switch(_0x393896){case 0x0:case 0x1:var _0xd94ba7=_0x120776[_0xe770('0x23')]?_[_0xe770('0x40')](_0x120776[_0xe770('0x23')])?_0x120776[_0xe770('0x23')]['join']():_0x120776['transport']:_0xe770('0x22');if(_0xd94ba7==='wss'){_0xd94ba7=_0xe770('0x22');}this[_0xe770('0x6')]('transport',_0xd94ba7);this[_0xe770('0x6')](_0xe770('0x41'),'no');this[_0xe770('0x6')]('avpf',null);this[_0xe770('0x6')]('force_avp',null);this[_0xe770('0x6')](_0xe770('0x42'),null);this[_0xe770('0x6')]('dtlsenable',null);this[_0xe770('0x6')](_0xe770('0x43'),null);this[_0xe770('0x6')](_0xe770('0x44'),null);this['setDataValue']('dtlscertfile',null);this[_0xe770('0x6')](_0xe770('0x45'),null);this[_0xe770('0x6')](_0xe770('0x46'),'no');break;case 0x2:this['setDataValue'](_0xe770('0x23'),'wss');this[_0xe770('0x6')]('encryption',_0xe770('0x2a'));this[_0xe770('0x6')](_0xe770('0x47'),_0xe770('0x2a'));this[_0xe770('0x6')](_0xe770('0x48'),'yes');this[_0xe770('0x6')](_0xe770('0x42'),_0xe770('0x2a'));this[_0xe770('0x6')](_0xe770('0x49'),_0xe770('0x2a'));this['setDataValue'](_0xe770('0x43'),'no');this['setDataValue'](_0xe770('0x44'),_0xe770('0x4a'));this[_0xe770('0x6')](_0xe770('0x4b'),_0x120776[_0xe770('0x4b')]||'/etc/pki/tls/certs/motion.crt');this[_0xe770('0x6')](_0xe770('0x45'),_0x120776['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0xe770('0x6')](_0xe770('0x46'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xe770('0x4c')],'set':function(_0x1fe2f1){this[_0xe770('0x6')](_0xe770('0x4d'),_0x1fe2f1?_0x1fe2f1[_0xe770('0x24')](','):[]);},'get':function(){return this[_0xe770('0xb')](_0xe770('0x4d'))?_[_0xe770('0x4e')](this[_0xe770('0xb')](_0xe770('0x4d'))[_0xe770('0x25')](','),function(_0x59af3a){return parseInt(_0x59af3a,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xe770('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xe770('0x4')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xe770('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xe770('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xe770('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xe770('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xe770('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xe770('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xe770('0xe')](_0xe770('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xe770('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xe770('0x4')]},'passwordResetAt':{'type':Sequelize[_0xe770('0x14')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xe770('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xe770('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xe770('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xe770('0x4')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 71576c9..24f3a50 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 _0xa369=['path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./user.socket','register','jayson/promise','client','http','request','then','User,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','catch','sendStatus','status','end','count','offset','limit','set','json','reject','save','destroy','get','Users','user','Agents','agent','Telephones','filter','ignore','map','value','includes','find','role','name','UserProfileResource','stack','send','index','User','rawAttributes','differenceBy','keys','password','salt','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','merge','sequelize','lower','field','options','includeAll','include','findAll','rows','show','bulkCreate','body','update','params','describe','addContacts','ids','omit','agent\x20role','telephone','admin','../../config/license/util','getLicense','telephones','users','isNil','internal','Setting','findById','min_internal','max','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','fullname','email','permissions','101','102','103','110','104','105','106','107','108','100','create','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','oldPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','Wrong\x20credentials','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','addQueues','loginInPause','isValidChannel','capitalize','channel','toLowerCase','Queues','penalty','spread','QueueId','emit','Queue:save','voice','push','interface','format','SIP/%s','voicePause','each','UserVoiceQueueRt','upsert','removeQueues','Unknown\x20channel','remove','Queue:remove','addAvatar','userpic','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','CmContact','Tag','Tags','color','tag','getContacts','getQueues','findOne','Queue','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','getRecordings','UserId','VoiceRecording','getChatInteractions','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','login','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','x-forwarded-for','connection','remoteAddress','socket','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','all','getChannels','PAUSE','LOGININPAUSE','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','type','mailPause','chatPause','faxPause','openchannelPause','smsPause','pauseType','unpause','manual','mail','chat','fax','sms','openchannel','%s%s','getTeams','Team','addTeams','removeTeams','getLists','CmList','getVoiceQueues','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','VoicePrefix','getVoicePrefixes','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','concat','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$notBetween','$like','$iLike','$notILike','$overlap','$contains','$any','phone','Contact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privelages\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','removeApiKey','API\x20key\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util'];(function(_0x5d6f57,_0x177f99){var _0xa1d8e2=function(_0x47b2a7){while(--_0x47b2a7){_0x5d6f57['push'](_0x5d6f57['shift']());}};_0xa1d8e2(++_0x177f99);}(_0xa369,0x147));var _0x9a36=function(_0x41ec09,_0x191e41){_0x41ec09=_0x41ec09-0x0;var _0x3b6d46=_0xa369[_0x41ec09];return _0x3b6d46;};'use strict';var pdf=require(_0x9a36('0x0'));var emlformat=require(_0x9a36('0x1'));var rimraf=require(_0x9a36('0x2'));var zipdir=require(_0x9a36('0x3'));var jsonpatch=require(_0x9a36('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9a36('0x5'));var util=require(_0x9a36('0x6'));var path=require(_0x9a36('0x7'));var sox=require(_0x9a36('0x8'));var csv=require(_0x9a36('0x9'));var ejs=require(_0x9a36('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9a36('0xb'));var crypto=require(_0x9a36('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9a36('0xd'));var toCsv=require(_0x9a36('0x9'));var querystring=require(_0x9a36('0xe'));var Papa=require(_0x9a36('0xf'));var authService=require(_0x9a36('0x10'));var hardwareService=require(_0x9a36('0x11'));var Redis=require(_0x9a36('0x12'));var qs=require(_0x9a36('0x13'));var logger=require(_0x9a36('0x14'))('api');var utils=require(_0x9a36('0x15'));var config=require(_0x9a36('0x16'));var db=require('../../mysqldb')['db'];config[_0x9a36('0x17')]=_[_0x9a36('0x18')](config[_0x9a36('0x17')],{'host':_0x9a36('0x19'),'port':0x18eb});var socket=require(_0x9a36('0x1a'))(new Redis(config[_0x9a36('0x17')]));require(_0x9a36('0x1b'))[_0x9a36('0x1c')](socket);var jayson=require(_0x9a36('0x1d'));var client=jayson[_0x9a36('0x1e')][_0x9a36('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x44bad7,_0x3952d5,_0x4acfc5,_0x535b2a){return new BPromise(function(_0x1ecd2,_0x1dbaf8){var _0x1fdace=_0x535b2a||client;return _0x1fdace[_0x9a36('0x20')](_0x44bad7,_0x4acfc5)[_0x9a36('0x21')](function(_0x5df8c9){logger['info'](_0x9a36('0x22'),_0x3952d5,'request\x20sent');logger[_0x9a36('0x23')]('User,\x20%s,\x20%s,\x20%s',_0x3952d5,_0x9a36('0x24'),JSON['stringify'](_0x5df8c9));if(_0x5df8c9['error']){if(_0x5df8c9[_0x9a36('0x25')][_0x9a36('0x26')]===0x1f4){logger['error'](_0x9a36('0x22'),_0x3952d5,_0x5df8c9[_0x9a36('0x25')][_0x9a36('0x27')]);return _0x1dbaf8(_0x5df8c9['error'][_0x9a36('0x27')]);}logger[_0x9a36('0x25')]('User,\x20%s,\x20%s',_0x3952d5,_0x5df8c9[_0x9a36('0x25')][_0x9a36('0x27')]);return _0x1ecd2(_0x5df8c9[_0x9a36('0x25')][_0x9a36('0x27')]);}else{logger[_0x9a36('0x28')]('User,\x20%s,\x20%s',_0x3952d5,_0x9a36('0x24'));_0x1ecd2(_0x5df8c9[_0x9a36('0x29')][_0x9a36('0x27')]);}})[_0x9a36('0x2a')](function(_0x1d6ac2){logger[_0x9a36('0x25')](_0x9a36('0x22'),_0x3952d5,_0x1d6ac2);_0x1dbaf8(_0x1d6ac2);});});}function respondWithStatusCode(_0x554cf1,_0x3e3f4c){_0x3e3f4c=_0x3e3f4c||0xcc;return function(_0x59074e){if(_0x59074e){return _0x554cf1[_0x9a36('0x2b')](_0x3e3f4c);}return _0x554cf1[_0x9a36('0x2c')](_0x3e3f4c)[_0x9a36('0x2d')]();};}function respondWithResult(_0x233b98,_0x333f5b){_0x333f5b=_0x333f5b||0xc8;return function(_0x54fbe1){if(_0x54fbe1){return _0x233b98[_0x9a36('0x2c')](_0x333f5b)['json'](_0x54fbe1);}};}function respondWithFilteredResult(_0x52b263,_0x9b6320){return function(_0x42d899){if(_0x42d899){var _0xf6c4a8=_0x42d899[_0x9a36('0x2e')],_0x152f1d=_0x9b6320[_0x9a36('0x2f')],_0x1b0747=_0x9b6320[_0x9a36('0x2f')]+_0x9b6320[_0x9a36('0x30')],_0x35600e;if(_0x1b0747>=_0xf6c4a8){_0x1b0747=_0xf6c4a8;_0x35600e=0xc8;}else{_0x35600e=0xce;}_0x52b263[_0x9a36('0x2c')](_0x35600e);return _0x52b263[_0x9a36('0x31')]('Content-Range',_0x152f1d+'-'+_0x1b0747+'/'+_0xf6c4a8)[_0x9a36('0x32')](_0x42d899);}return null;};}function patchUpdates(_0x278b3a){return function(_0x6adfae){try{jsonpatch['apply'](_0x6adfae,_0x278b3a,!![]);}catch(_0x52772f){return BPromise[_0x9a36('0x33')](_0x52772f);}return _0x6adfae[_0x9a36('0x34')]();};}function saveUpdates(_0x40b28d,_0x34e8f6){return function(_0x1987a5){if(_0x1987a5){return _0x1987a5['update'](_0x40b28d)[_0x9a36('0x21')](function(_0x38386c){return _0x38386c;});}return null;};}function removeEntity(_0x3121a5,_0x47eccc){return function(_0x2e4332){if(_0x2e4332){return _0x2e4332[_0x9a36('0x35')]()[_0x9a36('0x21')](function(){var _0x47b8ff=_0x2e4332[_0x9a36('0x36')]({'plain':!![]});var _0x126206=[{'name':_0x9a36('0x37'),'value':_0x9a36('0x38'),'ignore':!![]},{'name':_0x9a36('0x39'),'value':_0x9a36('0x3a'),'ignore':![]},{'name':_0x9a36('0x3b'),'value':'telephone','ignore':![]}];var _0x411dcc=_(_0x126206)[_0x9a36('0x3c')](_0x9a36('0x3d'))[_0x9a36('0x3e')](_0x9a36('0x3f'))['value']();if(_[_0x9a36('0x40')](_0x411dcc,_0x47b8ff['role'])){return;}var _0x483dbe=_[_0x9a36('0x41')](_0x126206,[_0x9a36('0x3f'),_0x47b8ff[_0x9a36('0x42')]])[_0x9a36('0x43')];return db[_0x9a36('0x44')]['destroy']({'where':{'type':_0x483dbe,'resourceId':_0x47b8ff['id']}})[_0x9a36('0x21')](function(){return _0x2e4332;});})[_0x9a36('0x21')](function(){_0x3121a5[_0x9a36('0x2c')](0xcc)[_0x9a36('0x2d')]();});}};}function handleEntityNotFound(_0x5e07d3,_0x1f88f0){return function(_0x509f1e){if(!_0x509f1e){_0x5e07d3['sendStatus'](0x194);}return _0x509f1e;};}function handleError(_0x219f77,_0x418839){_0x418839=_0x418839||0x1f4;return function(_0x396393){logger[_0x9a36('0x25')](_0x396393[_0x9a36('0x45')]);if(_0x396393[_0x9a36('0x43')]){delete _0x396393['name'];}_0x219f77[_0x9a36('0x2c')](_0x418839)[_0x9a36('0x46')](_0x396393);};}exports[_0x9a36('0x47')]=function(_0x373ce5,_0x38c79d){var _0x1cf7c5={},_0x4f0d8e={},_0x5f3d6a={'count':0x0,'rows':[]};var _0x37cc3e=db[_0x9a36('0x48')][_0x9a36('0x49')];_0x4f0d8e['model']=_[_0x9a36('0x4a')](_[_0x9a36('0x4b')](_0x37cc3e),[_0x9a36('0x4c'),_0x9a36('0x4d')]);_0x4f0d8e[_0x9a36('0x4e')]=_[_0x9a36('0x4b')](_0x373ce5[_0x9a36('0x4e')]);_0x4f0d8e[_0x9a36('0x4f')]=_[_0x9a36('0x50')](_0x4f0d8e['model'],_0x4f0d8e[_0x9a36('0x4e')]);_0x1cf7c5[_0x9a36('0x51')]=_[_0x9a36('0x50')](_0x4f0d8e[_0x9a36('0x52')],qs[_0x9a36('0x53')](_0x373ce5['query'][_0x9a36('0x53')]));_0x1cf7c5[_0x9a36('0x51')]=_0x1cf7c5[_0x9a36('0x51')][_0x9a36('0x54')]?_0x1cf7c5['attributes']:_0x4f0d8e['model'];if(!_0x373ce5['query'][_0x9a36('0x55')]('nolimit')){_0x1cf7c5[_0x9a36('0x30')]=qs['limit'](_0x373ce5[_0x9a36('0x4e')][_0x9a36('0x30')]);_0x1cf7c5['offset']=qs[_0x9a36('0x2f')](_0x373ce5['query']['offset']);}_0x1cf7c5[_0x9a36('0x56')]=qs['sort'](_0x373ce5[_0x9a36('0x4e')][_0x9a36('0x57')]);_0x1cf7c5[_0x9a36('0x58')]=qs[_0x9a36('0x4f')](_[_0x9a36('0x59')](_0x373ce5[_0x9a36('0x4e')],_0x4f0d8e[_0x9a36('0x4f')]));if(_0x373ce5[_0x9a36('0x4e')][_0x9a36('0x3c')]){_0x1cf7c5[_0x9a36('0x58')]=_[_0x9a36('0x5a')](_0x1cf7c5[_0x9a36('0x58')],{'$or':_[_0x9a36('0x3e')](_0x37cc3e,function(_0x3c6ba3){return db[_0x9a36('0x5b')][_0x9a36('0x58')](db[_0x9a36('0x5b')]['fn'](_0x9a36('0x5c'),db[_0x9a36('0x5b')]['col'](_0x3c6ba3[_0x9a36('0x5d')])),{'$like':db['sequelize']['fn']('lower','%'+_0x373ce5[_0x9a36('0x4e')][_0x9a36('0x3c')]+'%')});})});}_0x1cf7c5=_[_0x9a36('0x5a')]({},_0x1cf7c5,_0x373ce5[_0x9a36('0x5e')]);var _0x30f1b7={'where':_0x1cf7c5[_0x9a36('0x58')]};return db[_0x9a36('0x48')][_0x9a36('0x2e')](_0x30f1b7)[_0x9a36('0x21')](function(_0x20a89c){_0x5f3d6a[_0x9a36('0x2e')]=_0x20a89c;if(_0x373ce5[_0x9a36('0x4e')][_0x9a36('0x5f')]){_0x1cf7c5[_0x9a36('0x60')]=[{'all':!![]}];}return db[_0x9a36('0x48')][_0x9a36('0x61')](_0x1cf7c5);})[_0x9a36('0x21')](function(_0x58f745){_0x5f3d6a[_0x9a36('0x62')]=_0x58f745;return _0x5f3d6a;})[_0x9a36('0x21')](respondWithFilteredResult(_0x38c79d,_0x1cf7c5))[_0x9a36('0x2a')](handleError(_0x38c79d,null));};exports[_0x9a36('0x63')]=function(_0x1a92cc,_0x3a72da){var _0x21c64e={'raw':![],'where':{'id':_0x1a92cc['params']['id']}},_0x24140a={};_0x24140a[_0x9a36('0x52')]=_[_0x9a36('0x4a')](_[_0x9a36('0x4b')](db[_0x9a36('0x48')]['rawAttributes']),[_0x9a36('0x4c'),'salt']);_0x24140a['query']=_[_0x9a36('0x4b')](_0x1a92cc['query']);_0x24140a['filters']=_['intersection'](_0x24140a[_0x9a36('0x52')],_0x24140a[_0x9a36('0x4e')]);_0x21c64e[_0x9a36('0x51')]=_['intersection'](_0x24140a[_0x9a36('0x52')],qs[_0x9a36('0x53')](_0x1a92cc['query'][_0x9a36('0x53')]));_0x21c64e[_0x9a36('0x51')]=_0x21c64e[_0x9a36('0x51')]['length']?_0x21c64e[_0x9a36('0x51')]:_0x24140a[_0x9a36('0x52')];if(_0x1a92cc[_0x9a36('0x4e')][_0x9a36('0x5f')]){_0x21c64e[_0x9a36('0x60')]=[{'all':!![]}];}_0x21c64e=_[_0x9a36('0x5a')]({},_0x21c64e,_0x1a92cc[_0x9a36('0x5e')]);return db[_0x9a36('0x48')][_0x9a36('0x41')](_0x21c64e)[_0x9a36('0x21')](handleEntityNotFound(_0x3a72da,null))[_0x9a36('0x21')](respondWithResult(_0x3a72da,null))[_0x9a36('0x2a')](handleError(_0x3a72da,null));};exports[_0x9a36('0x64')]=function(_0x476d4d,_0x276c6d){return db[_0x9a36('0x48')][_0x9a36('0x64')](_0x476d4d[_0x9a36('0x65')],{'raw':![],'individualHooks':!![]})[_0x9a36('0x21')](respondWithResult(_0x276c6d,0xc9))[_0x9a36('0x2a')](handleError(_0x276c6d,null));};exports[_0x9a36('0x66')]=function(_0x216f68,_0xfd2b29){if(_0x216f68[_0x9a36('0x65')]['id']){delete _0x216f68[_0x9a36('0x65')]['id'];}return db[_0x9a36('0x48')]['find']({'where':{'id':_0x216f68[_0x9a36('0x67')]['id']}})['then'](handleEntityNotFound(_0xfd2b29,null))[_0x9a36('0x21')](saveUpdates(_0x216f68[_0x9a36('0x65')],null))['then'](respondWithResult(_0xfd2b29,null))[_0x9a36('0x2a')](handleError(_0xfd2b29,null));};exports['describe']=function(_0x5a4f10,_0x4203bd){return db[_0x9a36('0x48')][_0x9a36('0x68')]()[_0x9a36('0x21')](respondWithResult(_0x4203bd,null))[_0x9a36('0x2a')](handleError(_0x4203bd,null));};exports[_0x9a36('0x69')]=function(_0x27a9e0,_0x4be072,_0x46213d){return db[_0x9a36('0x48')][_0x9a36('0x41')]({'where':{'id':_0x27a9e0[_0x9a36('0x67')]['id']}})[_0x9a36('0x21')](handleEntityNotFound(_0x4be072,null))[_0x9a36('0x21')](function(_0x25fb66){if(_0x25fb66){return _0x25fb66[_0x9a36('0x69')](_0x27a9e0[_0x9a36('0x65')][_0x9a36('0x6a')],_[_0x9a36('0x6b')](_0x27a9e0[_0x9a36('0x65')],[_0x9a36('0x6a'),'id'])||{});}})[_0x9a36('0x21')](respondWithResult(_0x4be072,null))[_0x9a36('0x2a')](handleError(_0x4be072,null));};var getLicense=function(_0x1c9d71){return new BPromise(function(_0x2d96e4,_0x73c95a){var _0x3ddca2=0x0;_0x1c9d71[_0x9a36('0x65')][_0x9a36('0x42')]===_0x9a36('0x3a')&&_0x2d96e4(_0x9a36('0x6c'));return db[_0x9a36('0x48')][_0x9a36('0x2e')]({'where':{'$or':[{'role':_0x1c9d71[_0x9a36('0x65')][_0x9a36('0x42')]===_0x9a36('0x6d')?_0x9a36('0x6d'):[_0x9a36('0x6e'),'user']}]}})['then'](function(_0x54e9ea){_0x3ddca2=_0x54e9ea;return require(_0x9a36('0x6f'))[_0x9a36('0x70')]();})['then'](function(_0x224abd){var _0x2ba490=_0x1c9d71[_0x9a36('0x65')][_0x9a36('0x42')]===_0x9a36('0x6d')?_0x9a36('0x71'):_0x9a36('0x72');if(!_[_0x9a36('0x73')](_0x224abd[_0x2ba490])&&_0x3ddca2>=_0x224abd[_0x2ba490]){return _0x73c95a({'message':'License\x20limit\x20reached'});}return _0x2d96e4(util['format']('count\x20%s:\x20%s',_0x2ba490,_0x3ddca2));})['catch'](function(_0x39da5c){return _0x73c95a(_0x39da5c);});});};exports['create']=function(_0x3648d8,_0x2de6cb){return getLicense(_0x3648d8)['then'](function(_0x28ed1c){if(!_0x3648d8['body'][_0x9a36('0x74')]){var _0x270eeb;return db[_0x9a36('0x75')][_0x9a36('0x76')](0x1)[_0x9a36('0x21')](function(_0x284acd){_0x270eeb=_0x284acd[_0x9a36('0x77')];return db[_0x9a36('0x48')][_0x9a36('0x78')](_0x9a36('0x74'));})[_0x9a36('0x21')](function(_0x3d8a0c){if(_['isNil'](_0x3d8a0c)){if(_0x270eeb){_0x3648d8['body'][_0x9a36('0x74')]=_0x270eeb;}else{_0x3648d8[_0x9a36('0x65')]['internal']=0x1;}}else{if(_[_0x9a36('0x73')](_0x270eeb)||_0x270eeb==_0x3d8a0c){_0x3648d8['body'][_0x9a36('0x74')]=_0x3d8a0c+0x1;}else if(_0x270eeb>_0x3d8a0c){_0x3648d8[_0x9a36('0x65')]['internal']=_0x270eeb;}else{return db[_0x9a36('0x5b')][_0x9a36('0x4e')](_0x9a36('0x79'),{'type':db[_0x9a36('0x5b')][_0x9a36('0x7a')][_0x9a36('0x7b')]})[_0x9a36('0x21')](function(_0x573059){if(_0x573059&&_0x573059[_0x9a36('0x54')]){for(var _0x215ce6=0x0,_0x19e398=_0x573059['length'];_0x215ce6<_0x19e398&&_[_0x9a36('0x73')](_0x3648d8[_0x9a36('0x65')][_0x9a36('0x74')]);_0x215ce6++){if(_0x270eeb<=_0x573059[_0x215ce6][_0x9a36('0x7c')]){_0x3648d8[_0x9a36('0x65')][_0x9a36('0x74')]=_0x573059[_0x215ce6]['from'];}else if(_0x270eeb>_0x573059[_0x215ce6]['from']&&_0x270eeb<=_0x573059[_0x215ce6]['to']){_0x3648d8['body']['internal']=_0x270eeb;}}}if(_[_0x9a36('0x73')](_0x3648d8[_0x9a36('0x65')]['internal'])){_0x3648d8[_0x9a36('0x65')][_0x9a36('0x74')]=_0x3d8a0c+0x1;}});}}});}})[_0x9a36('0x21')](function(){if(_0x3648d8[_0x9a36('0x65')][_0x9a36('0x7d')]){_0x3648d8[_0x9a36('0x65')][_0x9a36('0x7e')]=_0x3648d8[_0x9a36('0x65')]['internal'];_0x3648d8[_0x9a36('0x65')][_0x9a36('0x7f')]={'mailbox':_0x3648d8[_0x9a36('0x65')][_0x9a36('0x74')],'password':_0x3648d8[_0x9a36('0x65')][_0x9a36('0x4c')],'fullname':_0x3648d8[_0x9a36('0x65')][_0x9a36('0x80')],'email':_0x3648d8[_0x9a36('0x65')][_0x9a36('0x81')]};}if(_0x3648d8[_0x9a36('0x65')]&&_0x3648d8[_0x9a36('0x65')][_0x9a36('0x42')]===_0x9a36('0x3a')){_0x3648d8[_0x9a36('0x65')][_0x9a36('0x82')]=[_0x9a36('0x83'),_0x9a36('0x84'),_0x9a36('0x85'),_0x9a36('0x86'),_0x9a36('0x87'),_0x9a36('0x88'),_0x9a36('0x89'),_0x9a36('0x8a'),_0x9a36('0x8b'),'109',_0x9a36('0x8c'),'111'];}return db[_0x9a36('0x48')][_0x9a36('0x8d')](_0x3648d8[_0x9a36('0x65')],{'include':[{'model':db['VoiceMail'],'as':_0x9a36('0x7f')}]});})[_0x9a36('0x21')](function(_0x29a981){if(_0x3648d8[_0x9a36('0x65')]['role']===_0x9a36('0x38'))return _0x29a981;var _0x39c702=_0x3648d8[_0x9a36('0x38')]['get']({'plain':!![]});if(!_0x39c702)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39c702[_0x9a36('0x42')]===_0x9a36('0x38')){var _0x440b2f=_0x29a981[_0x9a36('0x36')]({'plain':!![]});var _0x117030=[{'name':'Agents','value':_0x9a36('0x3a')},{'name':_0x9a36('0x3b'),'value':_0x9a36('0x6d')}];var _0x4b7c0e=_[_0x9a36('0x41')](_0x117030,[_0x9a36('0x3f'),_0x440b2f[_0x9a36('0x42')]])[_0x9a36('0x43')];return db[_0x9a36('0x8e')][_0x9a36('0x41')]({'where':{'name':_0x4b7c0e,'userProfileId':_0x39c702['userProfileId']},'raw':!![]})[_0x9a36('0x21')](function(_0x423e3b){if(_0x423e3b&&_0x423e3b[_0x9a36('0x8f')]===0x0){return db['UserProfileResource'][_0x9a36('0x8d')]({'name':_0x440b2f['name'],'resourceId':_0x440b2f['id'],'type':_0x423e3b[_0x9a36('0x43')],'sectionId':_0x423e3b['id']},{})[_0x9a36('0x21')](function(){return _0x29a981;});}else{return _0x29a981;}})[_0x9a36('0x2a')](function(_0x10be9d){logger[_0x9a36('0x25')](_0x9a36('0x90'),_0x10be9d);throw _0x10be9d;});}return _0x29a981;})[_0x9a36('0x21')](respondWithResult(_0x2de6cb,0xc9))[_0x9a36('0x2a')](handleError(_0x2de6cb,null));};exports['changePassword']=function(_0x1f86c7,_0x50efe6,_0x1b6944){if(_0x1f86c7[_0x9a36('0x65')]['id']){delete _0x1f86c7[_0x9a36('0x65')]['id'];}return db[_0x9a36('0x48')]['find']({'where':{'id':_0x1f86c7[_0x9a36('0x67')]['id']}})[_0x9a36('0x21')](function(_0x9d9059){if(_0x9d9059){if(_0x9d9059['id']==_0x1f86c7[_0x9a36('0x38')]['id']){if(!_0x1f86c7['body'][_0x9a36('0x91')]||!_0x1f86c7[_0x9a36('0x65')]['newPassword']){throw new db[(_0x9a36('0x92'))][(_0x9a36('0x93'))](_0x9a36('0x94'));}if(!_0x9d9059['authenticate'](_0x1f86c7['body']['oldPassword'])){throw new db[(_0x9a36('0x92'))][(_0x9a36('0x93'))](_0x9a36('0x95'));}if(_0x1f86c7['body'][_0x9a36('0x91')]==_0x1f86c7[_0x9a36('0x65')][_0x9a36('0x96')]){throw new db[(_0x9a36('0x92'))][(_0x9a36('0x93'))](_0x9a36('0x97'));}return _0x9d9059;}else if(_0x1f86c7[_0x9a36('0x38')][_0x9a36('0x42')]=='admin'){if(!_0x1f86c7[_0x9a36('0x65')][_0x9a36('0x96')]){throw new db[(_0x9a36('0x92'))]['ValidationError'](_0x9a36('0x98'));}return _0x9d9059;}else if(_0x1f86c7[_0x9a36('0x38')]['role']==_0x9a36('0x38')){if(!_0x1f86c7[_0x9a36('0x65')][_0x9a36('0x96')]){throw new db[(_0x9a36('0x92'))][(_0x9a36('0x93'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x9d9059[_0x9a36('0x42')]!=_0x9a36('0x3a')){throw new db[(_0x9a36('0x92'))][(_0x9a36('0x93'))]('Unauthorized');}return _0x9d9059;}else{throw new db[(_0x9a36('0x92'))][(_0x9a36('0x93'))]('Unauthorized');}}return null;})['then'](handleEntityNotFound(_0x50efe6,null))[_0x9a36('0x21')](saveUpdates({'password':_0x1f86c7[_0x9a36('0x65')]['newPassword'],'passwordResetAt':_0x1f86c7[_0x9a36('0x38')]['id']==_0x1f86c7[_0x9a36('0x67')]['id']?moment():null},null))[_0x9a36('0x21')](respondWithResult(_0x50efe6,null))[_0x9a36('0x2a')](handleError(_0x50efe6,null));};exports[_0x9a36('0x99')]=function(_0x2a1df7,_0x3e255a,_0x1a8d58){var _0x59bc63;return db[_0x9a36('0x48')][_0x9a36('0x41')]({'where':{'id':_0x2a1df7['params']['id']},'attributes':['id',_0x9a36('0x43'),_0x9a36('0x42'),_0x9a36('0x9a'),'voicePause','interface']})['then'](handleEntityNotFound(_0x3e255a,null))['then'](function(_0x66f5ee){if(_0x66f5ee){_0x59bc63=_0x66f5ee;if(!utils[_0x9a36('0x9b')](_0x2a1df7[_0x9a36('0x65')]['channel'])){throw new db['Sequelize'][(_0x9a36('0x93'))]('Unknown\x20channel');}return _0x66f5ee['add'+_[_0x9a36('0x9c')](_0x2a1df7['body'][_0x9a36('0x9d')][_0x9a36('0x9e')]())+_0x9a36('0x9f')](_0x2a1df7[_0x9a36('0x65')][_0x9a36('0x6a')],{'penalty':_0x2a1df7['body'][_0x9a36('0xa0')]||0x0});}})[_0x9a36('0xa1')](function(_0x2a8796){for(var _0x6676f=0x0;_0x6676f<_0x2a1df7[_0x9a36('0x65')][_0x9a36('0x6a')][_0x9a36('0x54')];_0x6676f+=0x1){var _0x43eb31={'UserId':_0x2a1df7['params']['id']};_0x43eb31[_[_0x9a36('0x9c')](_0x2a1df7[_0x9a36('0x65')][_0x9a36('0x9d')][_0x9a36('0x9e')]())+_0x9a36('0xa2')]=_0x2a1df7['body'][_0x9a36('0x6a')][_0x6676f];socket[_0x9a36('0xa3')](_0x9a36('0x38')+_[_0x9a36('0x9c')](_0x2a1df7['body']['channel'][_0x9a36('0x9e')]())+_0x9a36('0xa4'),_0x43eb31);}return _0x2a8796;})[_0x9a36('0x21')](function(){if(_0x2a1df7[_0x9a36('0x65')][_0x9a36('0x9d')]==='voice'){return db['VoiceQueue']['findAll']({'where':{'id':_0x2a1df7['body'][_0x9a36('0x6a')]||[]},'raw':!![],'attributes':['id',_0x9a36('0x43')]});}})['then'](function(_0x310e4d){var _0xb4a7b3=[];if(_0x2a1df7[_0x9a36('0x65')]['channel']===_0x9a36('0xa5')&&_0x59bc63['role']===_0x9a36('0x3a')){for(var _0xbb9109=0x0;_0xbb9109<_0x310e4d[_0x9a36('0x54')];_0xbb9109+=0x1){_0xb4a7b3[_0x9a36('0xa6')]({'membername':_0x59bc63[_0x9a36('0x43')],'UserId':_0x59bc63['id'],'queue_name':_0x310e4d[_0xbb9109][_0x9a36('0x43')],'VoiceQueueId':_0x310e4d[_0xbb9109]['id'],'interface':_[_0x9a36('0x73')](_0x59bc63[_0x9a36('0xa7')])?util[_0x9a36('0xa8')](_0x9a36('0xa9'),_0x59bc63[_0x9a36('0x43')]):_0x59bc63[_0x9a36('0xa7')],'paused':_0x59bc63[_0x9a36('0xaa')]||![],'penalty':_0x2a1df7['body'][_0x9a36('0xa0')]||0x0});}return BPromise[_0x9a36('0xab')](_0xb4a7b3,function(_0xeb111a){return db[_0x9a36('0xac')][_0x9a36('0xad')](_0xeb111a);});}return _0x59bc63;})[_0x9a36('0x21')](respondWithStatusCode(_0x3e255a,null))[_0x9a36('0x2a')](handleError(_0x3e255a,null));};exports[_0x9a36('0xae')]=function(_0xb4ba10,_0x52df61,_0x2c439f){var _0x60cf04;return db[_0x9a36('0x48')][_0x9a36('0x41')]({'where':{'id':_0xb4ba10['params']['id']},'attributes':['id',_0x9a36('0x43'),_0x9a36('0x42')]})[_0x9a36('0x21')](handleEntityNotFound(_0x52df61,null))[_0x9a36('0x21')](function(_0x4ac635){if(_0x4ac635){_0x60cf04=_0x4ac635;if(!_0xb4ba10[_0x9a36('0x4e')]['channel']||!utils['isValidChannel'](_0xb4ba10['query'][_0x9a36('0x9d')])){throw new db['Sequelize'][(_0x9a36('0x93'))](_0x9a36('0xaf'));}return _0x4ac635[_0x9a36('0xb0')+_[_0x9a36('0x9c')](_0xb4ba10[_0x9a36('0x4e')]['channel'][_0x9a36('0x9e')]())+'Queues'](_0xb4ba10[_0x9a36('0x4e')]['ids']);}})[_0x9a36('0x21')](function(_0x25cdf0){for(var _0x43a6de=0x0;_0x43a6de<_0xb4ba10[_0x9a36('0x4e')][_0x9a36('0x6a')]['length'];_0x43a6de+=0x1){var _0x56210a={'UserId':_0xb4ba10[_0x9a36('0x67')]['id']};_0x56210a[_[_0x9a36('0x9c')](_0xb4ba10[_0x9a36('0x4e')][_0x9a36('0x9d')][_0x9a36('0x9e')]())+'QueueId']=_0xb4ba10[_0x9a36('0x4e')][_0x9a36('0x6a')][_0x43a6de];socket[_0x9a36('0xa3')]('user'+_[_0x9a36('0x9c')](_0xb4ba10[_0x9a36('0x4e')][_0x9a36('0x9d')][_0x9a36('0x9e')]())+_0x9a36('0xb1'),_0x56210a);}return _0x25cdf0;})[_0x9a36('0x21')](function(){if(_0xb4ba10[_0x9a36('0x4e')][_0x9a36('0x9d')]===_0x9a36('0xa5')){return db['UserVoiceQueueRt'][_0x9a36('0x35')]({'where':{'UserId':_0xb4ba10[_0x9a36('0x67')]['id'],'VoiceQueueId':_0xb4ba10['query'][_0x9a36('0x6a')]},'individualHooks':!![]})[_0x9a36('0x21')](function(){return _0x60cf04;});}return _0x60cf04;})[_0x9a36('0x21')](respondWithStatusCode(_0x52df61,null))['catch'](handleError(_0x52df61,null));};exports[_0x9a36('0xb2')]=function(_0x4caa7e,_0x26a750,_0x263f8c){_0x4caa7e[_0x9a36('0x65')][_0x9a36('0xb3')]=_0x4caa7e['file']['filename'];return db[_0x9a36('0x48')]['find']({'where':{'id':_0x4caa7e[_0x9a36('0x67')]['id']}})[_0x9a36('0x21')](handleEntityNotFound(_0x26a750,null))['then'](saveUpdates(_0x4caa7e[_0x9a36('0x65')],null))['then'](respondWithResult(_0x26a750,null))['catch'](handleError(_0x26a750,null));};exports['getAvatar']=function(_0x37858a,_0x38dc88,_0x10c8c9){var _0x35b6a8=path[_0x9a36('0xb4')](config[_0x9a36('0xb5')],_0x9a36('0xb6'));return db[_0x9a36('0x48')][_0x9a36('0x41')]({'where':{'id':_0x37858a[_0x9a36('0x67')]['id']},'attributes':['id',_0x9a36('0xb3')],'raw':!![]})['then'](handleEntityNotFound(_0x38dc88,null))[_0x9a36('0x21')](function(_0x579062){if(_0x579062){if(_[_0x9a36('0x73')](_0x579062[_0x9a36('0xb3')])){return _0x38dc88[_0x9a36('0xb7')](_0x35b6a8);}else{if(!fs[_0x9a36('0xb8')](path[_0x9a36('0xb4')](config[_0x9a36('0xb5')],_0x9a36('0xb9'),_0x579062[_0x9a36('0xb3')]))){return _0x38dc88[_0x9a36('0xb7')](_0x35b6a8);}return _0x38dc88[_0x9a36('0xb7')](path[_0x9a36('0xb4')](config['root'],'server/files/images/',_0x579062[_0x9a36('0xb3')]));}}})[_0x9a36('0x2a')](handleError(_0x38dc88,null));};exports['getContacts']=function(_0x5ac1a5,_0x5d242a,_0x3cd34d){var _0x3a0648={};var _0x1e0797={};var _0x206629;var _0x3689a9;return db[_0x9a36('0x48')]['findOne']({'where':{'id':_0x5ac1a5['params']['id']}})['then'](handleEntityNotFound(_0x5d242a,null))[_0x9a36('0x21')](function(_0x5bcb00){if(_0x5bcb00){_0x206629=_0x5bcb00;_0x1e0797[_0x9a36('0x52')]=_['keys'](db[_0x9a36('0xba')]['rawAttributes']);_0x1e0797[_0x9a36('0x4e')]=_[_0x9a36('0x4b')](_0x5ac1a5[_0x9a36('0x4e')]);_0x1e0797['filters']=_[_0x9a36('0x50')](_0x1e0797[_0x9a36('0x52')],_0x1e0797[_0x9a36('0x4e')]);_0x3a0648[_0x9a36('0x51')]=_[_0x9a36('0x50')](_0x1e0797[_0x9a36('0x52')],qs['fields'](_0x5ac1a5[_0x9a36('0x4e')][_0x9a36('0x53')]));_0x3a0648['attributes']=_0x3a0648[_0x9a36('0x51')][_0x9a36('0x54')]?_0x3a0648[_0x9a36('0x51')]:_0x1e0797[_0x9a36('0x52')];_0x3a0648['order']=qs['sort'](_0x5ac1a5['query']['sort']);_0x3a0648[_0x9a36('0x58')]=qs[_0x9a36('0x4f')](_['pick'](_0x5ac1a5[_0x9a36('0x4e')],_0x1e0797['filters']));if(_0x5ac1a5['query'][_0x9a36('0x3c')]){_0x3a0648[_0x9a36('0x58')]=_['merge'](_0x3a0648[_0x9a36('0x58')],{'$or':_['map'](_0x3a0648[_0x9a36('0x51')],function(_0x209b3b){var _0x1f8a0c={};_0x1f8a0c[_0x209b3b]={'$like':'%'+_0x5ac1a5[_0x9a36('0x4e')][_0x9a36('0x3c')]+'%'};return _0x1f8a0c;})});}_0x3a0648=_[_0x9a36('0x5a')]({},_0x3a0648,_0x5ac1a5[_0x9a36('0x5e')]);return _0x206629['getContacts'](_0x3a0648);}})[_0x9a36('0x21')](function(_0x1c0607){if(_0x1c0607){_0x3689a9=_0x1c0607['length'];if(_0x5ac1a5[_0x9a36('0x4e')][_0x9a36('0x55')](_0x9a36('0x5f'))){_0x3a0648[_0x9a36('0x60')]=[{'model':db['CmList'],'as':'List','required':![]},{'model':db[_0x9a36('0xbb')],'as':_0x9a36('0xbc'),'attributes':['id',_0x9a36('0x43'),_0x9a36('0xbd')],'where':_0x5ac1a5[_0x9a36('0x4e')][_0x9a36('0xbe')]?{'id':_0x5ac1a5['query']['tag']}:undefined,'required':_0x5ac1a5[_0x9a36('0x4e')][_0x9a36('0xbe')]?!![]:![]}];}if(!_0x5ac1a5[_0x9a36('0x4e')][_0x9a36('0x55')]('nolimit')){_0x3a0648['limit']=qs[_0x9a36('0x30')](_0x5ac1a5[_0x9a36('0x4e')][_0x9a36('0x30')]);_0x3a0648[_0x9a36('0x2f')]=qs['offset'](_0x5ac1a5[_0x9a36('0x4e')]['offset']);}return _0x206629[_0x9a36('0xbf')](_0x3a0648);}})[_0x9a36('0x21')](function(_0x58b770){if(_0x58b770){return _0x58b770?{'count':_0x3689a9,'rows':_0x58b770}:null;}})[_0x9a36('0x21')](respondWithResult(_0x5d242a,null))[_0x9a36('0x2a')](handleError(_0x5d242a,null));};exports[_0x9a36('0xc0')]=function(_0x368d17,_0x3e8aab,_0x3beccd){var _0x5b2bcd;var _0x314f1c;var _0x495153={};var _0x246f4f;return db[_0x9a36('0x48')][_0x9a36('0xc1')]({'where':{'id':_0x368d17[_0x9a36('0x67')]['id']},'attributes':['id',_0x9a36('0x43'),_0x9a36('0x42')]})[_0x9a36('0x21')](handleEntityNotFound(_0x3e8aab,null))['then'](function(_0x53b4ab){if(!utils['isValidChannel'](_0x368d17[_0x9a36('0x4e')][_0x9a36('0x9d')])){throw new db[(_0x9a36('0x92'))][(_0x9a36('0x93'))](_0x9a36('0xaf'));}_0x5b2bcd=_0x53b4ab;var _0xb75901={};_0xb75901['model']=_[_0x9a36('0x4b')](db[_[_0x9a36('0x9c')](_0x368d17[_0x9a36('0x4e')][_0x9a36('0x9d')])+_0x9a36('0xc2')][_0x9a36('0x49')]);_0xb75901['query']=_[_0x9a36('0x4b')](_0x368d17[_0x9a36('0x4e')]);_0xb75901[_0x9a36('0x4f')]=_[_0x9a36('0x50')](_0xb75901['model'],_0xb75901[_0x9a36('0x4e')]);_0x495153['attributes']=_['intersection'](_0xb75901[_0x9a36('0x52')],qs[_0x9a36('0x53')](_0x368d17['query']['fields']));_0x495153[_0x9a36('0x51')]=_0x495153[_0x9a36('0x51')][_0x9a36('0x54')]?_0x495153['attributes']:_0xb75901[_0x9a36('0x52')];_0x495153[_0x9a36('0x56')]=qs[_0x9a36('0x57')](_0x368d17[_0x9a36('0x4e')][_0x9a36('0x57')]);_0x495153[_0x9a36('0x58')]=qs[_0x9a36('0x4f')](_[_0x9a36('0x59')](_0x368d17[_0x9a36('0x4e')],_0xb75901[_0x9a36('0x4f')]));if(_0x368d17[_0x9a36('0x4e')][_0x9a36('0x3c')]){_0x495153[_0x9a36('0x58')]=_[_0x9a36('0x5a')](_0x495153[_0x9a36('0x58')],{'$or':_[_0x9a36('0x3e')](_0x495153['attributes'],function(_0x45f124){var _0x4537d6={};_0x4537d6[_0x45f124]={'$like':'%'+_0x368d17[_0x9a36('0x4e')][_0x9a36('0x3c')]+'%'};return _0x4537d6;})});}_0x495153=_[_0x9a36('0x5a')]({},_0x495153,_0x368d17[_0x9a36('0x5e')]);switch(_0x5b2bcd[_0x9a36('0x42')]){case _0x9a36('0x6e'):return db[_[_0x9a36('0x9c')](_0x368d17[_0x9a36('0x4e')][_0x9a36('0x9d')])+_0x9a36('0xc2')][_0x9a36('0x61')](_0x495153);case _0x9a36('0x38'):case _0x9a36('0x3a'):return _0x5b2bcd[_0x9a36('0x36')+_[_0x9a36('0x9c')](_0x368d17[_0x9a36('0x4e')][_0x9a36('0x9d')])+'Queues'](_0x495153);default:throw new db['Sequelize'][(_0x9a36('0x93'))](_0x9a36('0xc3'));}})[_0x9a36('0x21')](function(_0x11c39d){_0x246f4f=_0x11c39d[_0x9a36('0x54')];if(!_0x368d17['query'][_0x9a36('0x55')](_0x9a36('0xc4'))){_0x495153[_0x9a36('0x30')]=qs['limit'](_0x368d17['query'][_0x9a36('0x30')]);_0x495153[_0x9a36('0x2f')]=qs[_0x9a36('0x2f')](_0x368d17['query'][_0x9a36('0x2f')]);}switch(_0x5b2bcd['role']){case _0x9a36('0x6e'):return db[_[_0x9a36('0x9c')](_0x368d17[_0x9a36('0x4e')]['channel'])+_0x9a36('0xc2')][_0x9a36('0x61')](_0x495153);case _0x9a36('0x38'):case'agent':return _0x5b2bcd[_0x9a36('0x36')+_[_0x9a36('0x9c')](_0x368d17['query']['channel'])+_0x9a36('0x9f')](_0x495153);}})['then'](function(_0x4a91da){return{'count':_0x246f4f,'rows':_0x4a91da};})[_0x9a36('0x21')](respondWithResult(_0x3e8aab,null))[_0x9a36('0x2a')](handleError(_0x3e8aab,null));};exports[_0x9a36('0xc5')]=function(_0x416503,_0x2071c6,_0x4d4f06){var _0x26d834={};var _0x2ccdd1={};var _0x46f78a;var _0x5a0cf3;return db['User']['findOne']({'where':{'id':_0x416503[_0x9a36('0x67')]['id']}})[_0x9a36('0x21')](handleEntityNotFound(_0x2071c6,null))[_0x9a36('0x21')](function(_0x225349){if(_0x225349){_0x46f78a=_0x225349;_0x2ccdd1[_0x9a36('0x52')]=_['keys'](db[_0x9a36('0xac')][_0x9a36('0x49')]);_0x2ccdd1[_0x9a36('0x4e')]=_[_0x9a36('0x4b')](_0x416503[_0x9a36('0x4e')]);_0x2ccdd1['filters']=_[_0x9a36('0x50')](_0x2ccdd1[_0x9a36('0x52')],_0x2ccdd1[_0x9a36('0x4e')]);_0x26d834[_0x9a36('0x51')]=_['intersection'](_0x2ccdd1[_0x9a36('0x52')],qs[_0x9a36('0x53')](_0x416503[_0x9a36('0x4e')]['fields']));_0x26d834[_0x9a36('0x51')]=_0x26d834[_0x9a36('0x51')][_0x9a36('0x54')]?_0x26d834[_0x9a36('0x51')]:_0x2ccdd1['model'];_0x26d834['order']=qs[_0x9a36('0x57')](_0x416503[_0x9a36('0x4e')][_0x9a36('0x57')]);_0x26d834[_0x9a36('0x58')]=qs[_0x9a36('0x4f')](_[_0x9a36('0x59')](_0x416503[_0x9a36('0x4e')],_0x2ccdd1['filters']));if(_0x416503[_0x9a36('0x4e')][_0x9a36('0x3c')]){_0x26d834[_0x9a36('0x58')]=_['merge'](_0x26d834[_0x9a36('0x58')],{'$or':_[_0x9a36('0x3e')](_0x26d834['attributes'],function(_0x5cf6ff){var _0x475051={};_0x475051[_0x5cf6ff]={'$like':'%'+_0x416503[_0x9a36('0x4e')]['filter']+'%'};return _0x475051;})});}_0x26d834=_[_0x9a36('0x5a')]({},_0x26d834,_0x416503[_0x9a36('0x5e')]);return _0x46f78a[_0x9a36('0xc5')](_0x26d834);}})[_0x9a36('0x21')](function(_0x334ba9){if(_0x334ba9){_0x5a0cf3=_0x334ba9[_0x9a36('0x54')];if(!_0x416503[_0x9a36('0x4e')]['hasOwnProperty'](_0x9a36('0xc4'))){_0x26d834['limit']=qs['limit'](_0x416503[_0x9a36('0x4e')][_0x9a36('0x30')]);_0x26d834[_0x9a36('0x2f')]=qs[_0x9a36('0x2f')](_0x416503[_0x9a36('0x4e')][_0x9a36('0x2f')]);}return _0x46f78a['getVoiceQueuesRt'](_0x26d834);}})[_0x9a36('0x21')](function(_0x373c3d){if(_0x373c3d){return _0x373c3d?{'count':_0x5a0cf3,'rows':_0x373c3d}:null;}})[_0x9a36('0x21')](respondWithResult(_0x2071c6,null))['catch'](handleError(_0x2071c6,null));};exports[_0x9a36('0xc6')]=function(_0x53430a,_0x37ad86,_0x124bbb){var _0x5d1608={};var _0x3eb725={};var _0x445a36;var _0x253fc2;return db[_0x9a36('0x48')][_0x9a36('0xc1')]({'where':{'id':_0x53430a[_0x9a36('0x67')]['id']}})['then'](handleEntityNotFound(_0x37ad86,null))[_0x9a36('0x21')](function(_0x3ed87e){if(_0x3ed87e){_0x445a36=_0x3ed87e;_0x3eb725[_0x9a36('0x52')]=_[_0x9a36('0x4b')](db['ChatGroup'][_0x9a36('0x49')]);_0x3eb725[_0x9a36('0x4e')]=_[_0x9a36('0x4b')](_0x53430a['query']);_0x3eb725[_0x9a36('0x4f')]=_[_0x9a36('0x50')](_0x3eb725[_0x9a36('0x52')],_0x3eb725[_0x9a36('0x4e')]);_0x5d1608[_0x9a36('0x51')]=_[_0x9a36('0x50')](_0x3eb725['model'],qs[_0x9a36('0x53')](_0x53430a[_0x9a36('0x4e')]['fields']));_0x5d1608[_0x9a36('0x51')]=_0x5d1608['attributes'][_0x9a36('0x54')]?_0x5d1608['attributes']:_0x3eb725[_0x9a36('0x52')];_0x5d1608[_0x9a36('0x56')]=qs['sort'](_0x53430a['query'][_0x9a36('0x57')]);_0x5d1608['where']=qs[_0x9a36('0x4f')](_[_0x9a36('0x59')](_0x53430a[_0x9a36('0x4e')],_0x3eb725[_0x9a36('0x4f')]));if(_0x53430a[_0x9a36('0x4e')][_0x9a36('0x3c')]){_0x5d1608[_0x9a36('0x58')]=_[_0x9a36('0x5a')](_0x5d1608[_0x9a36('0x58')],{'$or':_[_0x9a36('0x3e')](_0x5d1608[_0x9a36('0x51')],function(_0x36c97f){var _0x5ac35f={};_0x5ac35f[_0x36c97f]={'$like':'%'+_0x53430a[_0x9a36('0x4e')][_0x9a36('0x3c')]+'%'};return _0x5ac35f;})});}_0x5d1608=_[_0x9a36('0x5a')]({},_0x5d1608,_0x53430a[_0x9a36('0x5e')]);return _0x445a36[_0x9a36('0xc6')](_0x5d1608);}})['then'](function(_0xee292f){if(_0xee292f){_0x253fc2=_0xee292f[_0x9a36('0x54')];if(!_0x53430a[_0x9a36('0x4e')][_0x9a36('0x55')](_0x9a36('0xc4'))){_0x5d1608[_0x9a36('0x30')]=qs[_0x9a36('0x30')](_0x53430a[_0x9a36('0x4e')]['limit']);_0x5d1608[_0x9a36('0x2f')]=qs['offset'](_0x53430a[_0x9a36('0x4e')][_0x9a36('0x2f')]);}return _0x445a36[_0x9a36('0xc6')](_0x5d1608);}})[_0x9a36('0x21')](function(_0x516aa2){if(_0x516aa2){return _0x516aa2?{'count':_0x253fc2,'rows':_0x516aa2}:null;}})[_0x9a36('0x21')](respondWithResult(_0x37ad86,null))[_0x9a36('0x2a')](handleError(_0x37ad86,null));};exports[_0x9a36('0xc7')]=function(_0x30ffb,_0x45914b,_0x5780bd){var _0x1a6f8f={'raw':!![],'where':{}};var _0x9189fa={};var _0x2ad418={'count':0x0,'rows':[]};return db[_0x9a36('0x48')][_0x9a36('0xc1')]({'where':{'id':_0x30ffb[_0x9a36('0x67')]['id']}})[_0x9a36('0x21')](handleEntityNotFound(_0x45914b,null))[_0x9a36('0x21')](function(_0x315605){if(_0x315605){_0x9189fa[_0x9a36('0x52')]=_[_0x9a36('0x4b')](db['VoiceRecording']['rawAttributes']);_0x9189fa[_0x9a36('0x4e')]=_[_0x9a36('0x4b')](_0x30ffb[_0x9a36('0x4e')]);_0x9189fa[_0x9a36('0x4f')]=_[_0x9a36('0x50')](_0x9189fa[_0x9a36('0x52')],_0x9189fa[_0x9a36('0x4e')]);_0x1a6f8f[_0x9a36('0x51')]=_[_0x9a36('0x50')](_0x9189fa[_0x9a36('0x52')],qs['fields'](_0x30ffb['query'][_0x9a36('0x53')]));_0x1a6f8f[_0x9a36('0x51')]=_0x1a6f8f[_0x9a36('0x51')][_0x9a36('0x54')]?_0x1a6f8f[_0x9a36('0x51')]:_0x9189fa[_0x9a36('0x52')];if(!_0x30ffb['query'][_0x9a36('0x55')](_0x9a36('0xc4'))){_0x1a6f8f['limit']=qs[_0x9a36('0x30')](_0x30ffb[_0x9a36('0x4e')][_0x9a36('0x30')]);_0x1a6f8f[_0x9a36('0x2f')]=qs[_0x9a36('0x2f')](_0x30ffb[_0x9a36('0x4e')][_0x9a36('0x2f')]);}_0x1a6f8f[_0x9a36('0x56')]=qs[_0x9a36('0x57')](_0x30ffb[_0x9a36('0x4e')][_0x9a36('0x57')]);_0x1a6f8f[_0x9a36('0x58')]=qs[_0x9a36('0x4f')](_[_0x9a36('0x59')](_0x30ffb[_0x9a36('0x4e')],_0x9189fa[_0x9a36('0x4f')]));_0x1a6f8f[_0x9a36('0x58')][_0x9a36('0xc8')]=_0x315605['id'];if(_0x30ffb['query'][_0x9a36('0x3c')]){_0x1a6f8f['where']=_[_0x9a36('0x5a')](_0x1a6f8f['where'],{'$or':_[_0x9a36('0x3e')](_0x1a6f8f[_0x9a36('0x51')],function(_0x46de7d){var _0x331631={};_0x331631[_0x46de7d]={'$like':'%'+_0x30ffb[_0x9a36('0x4e')]['filter']+'%'};return _0x331631;})});}_0x1a6f8f=_[_0x9a36('0x5a')]({},_0x1a6f8f,_0x30ffb['options']);return db[_0x9a36('0xc9')][_0x9a36('0x2e')]({'where':_0x1a6f8f[_0x9a36('0x58')]})[_0x9a36('0x21')](function(_0x36ae63){_0x2ad418['count']=_0x36ae63;if(_0x30ffb[_0x9a36('0x4e')][_0x9a36('0x5f')]){_0x1a6f8f[_0x9a36('0x60')]=[{'all':!![]}];}return db['VoiceRecording'][_0x9a36('0x61')](_0x1a6f8f);})[_0x9a36('0x21')](function(_0x43068c){_0x2ad418[_0x9a36('0x62')]=_0x43068c;return _0x2ad418;});}})[_0x9a36('0x21')](respondWithFilteredResult(_0x45914b,_0x1a6f8f))[_0x9a36('0x2a')](handleError(_0x45914b,null));};exports[_0x9a36('0xca')]=function(_0x189ac7,_0x43c509,_0x478642){var _0x278565={};var _0x287548={};var _0x50a89a;var _0x148a48;return db[_0x9a36('0x48')][_0x9a36('0xc1')]({'where':{'id':_0x189ac7[_0x9a36('0x67')]['id']}})[_0x9a36('0x21')](handleEntityNotFound(_0x43c509,null))['then'](function(_0xd4d004){if(_0xd4d004){_0x50a89a=_0xd4d004;_0x287548[_0x9a36('0x52')]=_[_0x9a36('0x4b')](db['ChatInteraction'][_0x9a36('0x49')]);_0x287548['query']=_['keys'](_0x189ac7[_0x9a36('0x4e')]);_0x287548[_0x9a36('0x4f')]=_[_0x9a36('0x50')](_0x287548[_0x9a36('0x52')],_0x287548['query']);_0x278565[_0x9a36('0x51')]=_[_0x9a36('0x50')](_0x287548[_0x9a36('0x52')],qs[_0x9a36('0x53')](_0x189ac7['query'][_0x9a36('0x53')]));_0x278565[_0x9a36('0x51')]=_0x278565[_0x9a36('0x51')][_0x9a36('0x54')]?_0x278565[_0x9a36('0x51')]:_0x287548[_0x9a36('0x52')];_0x278565['order']=qs[_0x9a36('0x57')](_0x189ac7['query'][_0x9a36('0x57')]);_0x278565[_0x9a36('0x58')]=qs[_0x9a36('0x4f')](_[_0x9a36('0x59')](_0x189ac7[_0x9a36('0x4e')],_0x287548[_0x9a36('0x4f')]));if(_0x189ac7[_0x9a36('0x4e')][_0x9a36('0x3c')]){_0x278565[_0x9a36('0x58')]=_[_0x9a36('0x5a')](_0x278565[_0x9a36('0x58')],{'$or':_[_0x9a36('0x3e')](_0x278565[_0x9a36('0x51')],function(_0x490d28){var _0x5b9c81={};_0x5b9c81[_0x490d28]={'$like':'%'+_0x189ac7[_0x9a36('0x4e')][_0x9a36('0x3c')]+'%'};return _0x5b9c81;})});}_0x278565=_['merge']({},_0x278565,_0x189ac7['options']);return _0x50a89a[_0x9a36('0xca')](_0x278565);}})['then'](function(_0x13967c){if(_0x13967c){_0x148a48=_0x13967c['length'];if(!_0x189ac7[_0x9a36('0x4e')]['hasOwnProperty'](_0x9a36('0xc4'))){_0x278565['limit']=qs[_0x9a36('0x30')](_0x189ac7[_0x9a36('0x4e')][_0x9a36('0x30')]);_0x278565[_0x9a36('0x2f')]=qs[_0x9a36('0x2f')](_0x189ac7['query']['offset']);}return _0x50a89a[_0x9a36('0xca')](_0x278565);}})[_0x9a36('0x21')](function(_0x268690){if(_0x268690){return _0x268690?{'count':_0x148a48,'rows':_0x268690}:null;}})[_0x9a36('0x21')](respondWithResult(_0x43c509,null))[_0x9a36('0x2a')](handleError(_0x43c509,null));};exports['getOpenchannelInteractions']=function(_0x2f7e4e,_0x58cd6f,_0x2b25a3){var _0x40dd8e={};var _0x393b28={};var _0x18312a;var _0x474e5f;return db['User'][_0x9a36('0xc1')]({'where':{'id':_0x2f7e4e[_0x9a36('0x67')]['id']}})[_0x9a36('0x21')](handleEntityNotFound(_0x58cd6f,null))[_0x9a36('0x21')](function(_0x44df11){if(_0x44df11){_0x18312a=_0x44df11;_0x393b28[_0x9a36('0x52')]=_['keys'](db[_0x9a36('0xcb')][_0x9a36('0x49')]);_0x393b28[_0x9a36('0x4e')]=_[_0x9a36('0x4b')](_0x2f7e4e[_0x9a36('0x4e')]);_0x393b28[_0x9a36('0x4f')]=_['intersection'](_0x393b28[_0x9a36('0x52')],_0x393b28[_0x9a36('0x4e')]);_0x40dd8e[_0x9a36('0x51')]=_['intersection'](_0x393b28[_0x9a36('0x52')],qs['fields'](_0x2f7e4e['query'][_0x9a36('0x53')]));_0x40dd8e[_0x9a36('0x51')]=_0x40dd8e['attributes']['length']?_0x40dd8e[_0x9a36('0x51')]:_0x393b28[_0x9a36('0x52')];_0x40dd8e[_0x9a36('0x56')]=qs[_0x9a36('0x57')](_0x2f7e4e['query'][_0x9a36('0x57')]);_0x40dd8e[_0x9a36('0x58')]=qs[_0x9a36('0x4f')](_[_0x9a36('0x59')](_0x2f7e4e['query'],_0x393b28['filters']));if(_0x2f7e4e['query']['filter']){_0x40dd8e['where']=_[_0x9a36('0x5a')](_0x40dd8e[_0x9a36('0x58')],{'$or':_[_0x9a36('0x3e')](_0x40dd8e['attributes'],function(_0x5517ef){var _0x2f4dc4={};_0x2f4dc4[_0x5517ef]={'$like':'%'+_0x2f7e4e[_0x9a36('0x4e')][_0x9a36('0x3c')]+'%'};return _0x2f4dc4;})});}_0x40dd8e=_[_0x9a36('0x5a')]({},_0x40dd8e,_0x2f7e4e[_0x9a36('0x5e')]);return _0x18312a[_0x9a36('0xcc')](_0x40dd8e);}})[_0x9a36('0x21')](function(_0xbfe969){if(_0xbfe969){_0x474e5f=_0xbfe969[_0x9a36('0x54')];if(!_0x2f7e4e[_0x9a36('0x4e')]['hasOwnProperty'](_0x9a36('0xc4'))){_0x40dd8e['limit']=qs[_0x9a36('0x30')](_0x2f7e4e[_0x9a36('0x4e')][_0x9a36('0x30')]);_0x40dd8e[_0x9a36('0x2f')]=qs[_0x9a36('0x2f')](_0x2f7e4e['query'][_0x9a36('0x2f')]);}return _0x18312a['getOpenchannelInteractions'](_0x40dd8e);}})[_0x9a36('0x21')](function(_0x2a578e){if(_0x2a578e){return _0x2a578e?{'count':_0x474e5f,'rows':_0x2a578e}:null;}})['then'](respondWithResult(_0x58cd6f,null))['catch'](handleError(_0x58cd6f,null));};exports[_0x9a36('0xcd')]=function(_0x44276a,_0x520463,_0x3d36ce){var _0x2e08fe={'raw':!![],'where':{}};var _0x560e4e={};var _0x1040f9={'count':0x0,'rows':[]};return db[_0x9a36('0x48')][_0x9a36('0xc1')]({'where':{'id':_0x44276a[_0x9a36('0x67')]['id']}})[_0x9a36('0x21')](handleEntityNotFound(_0x520463,null))[_0x9a36('0x21')](function(_0x971caa){if(_0x971caa){_0x560e4e[_0x9a36('0x52')]=_[_0x9a36('0x4b')](db['MailInteraction']['rawAttributes']);_0x560e4e[_0x9a36('0x4e')]=_['keys'](_0x44276a[_0x9a36('0x4e')]);_0x560e4e['filters']=_[_0x9a36('0x50')](_0x560e4e[_0x9a36('0x52')],_0x560e4e[_0x9a36('0x4e')]);_0x2e08fe['attributes']=_[_0x9a36('0x50')](_0x560e4e[_0x9a36('0x52')],qs['fields'](_0x44276a[_0x9a36('0x4e')][_0x9a36('0x53')]));_0x2e08fe[_0x9a36('0x51')]=_0x2e08fe[_0x9a36('0x51')][_0x9a36('0x54')]?_0x2e08fe['attributes']:_0x560e4e[_0x9a36('0x52')];if(!_0x44276a[_0x9a36('0x4e')]['hasOwnProperty']('nolimit')){_0x2e08fe[_0x9a36('0x30')]=qs[_0x9a36('0x30')](_0x44276a['query'][_0x9a36('0x30')]);_0x2e08fe[_0x9a36('0x2f')]=qs[_0x9a36('0x2f')](_0x44276a[_0x9a36('0x4e')][_0x9a36('0x2f')]);}_0x2e08fe['order']=qs[_0x9a36('0x57')](_0x44276a['query'][_0x9a36('0x57')]);_0x2e08fe['where']=qs['filters'](_['pick'](_0x44276a[_0x9a36('0x4e')],_0x560e4e['filters']));_0x2e08fe[_0x9a36('0x58')]['UserId']=_0x971caa['id'];if(_0x44276a['query']['filter']){_0x2e08fe[_0x9a36('0x58')]=_[_0x9a36('0x5a')](_0x2e08fe['where'],{'$or':_['map'](_0x2e08fe[_0x9a36('0x51')],function(_0x118bc9){var _0x3b5d21={};_0x3b5d21[_0x118bc9]={'$like':'%'+_0x44276a[_0x9a36('0x4e')][_0x9a36('0x3c')]+'%'};return _0x3b5d21;})});}_0x2e08fe=_[_0x9a36('0x5a')]({},_0x2e08fe,_0x44276a['options']);return db[_0x9a36('0xce')][_0x9a36('0x2e')]({'where':_0x2e08fe[_0x9a36('0x58')]})[_0x9a36('0x21')](function(_0x4d45d2){_0x1040f9['count']=_0x4d45d2;if(_0x44276a['query'][_0x9a36('0x5f')]){_0x2e08fe['include']=[{'all':!![]}];}return db[_0x9a36('0xce')][_0x9a36('0x61')](_0x2e08fe);})[_0x9a36('0x21')](function(_0x4872b9){_0x1040f9[_0x9a36('0x62')]=_0x4872b9;return _0x1040f9;});}})[_0x9a36('0x21')](respondWithFilteredResult(_0x520463,_0x2e08fe))[_0x9a36('0x2a')](handleError(_0x520463,null));};exports[_0x9a36('0xcf')]=function(_0x3eab8f,_0x44c5fc,_0x553957){var _0x5e010f={};var _0x318133={};var _0x117725;var _0x2ffe3c;return db[_0x9a36('0x48')][_0x9a36('0xc1')]({'where':{'id':_0x3eab8f[_0x9a36('0x67')]['id']}})[_0x9a36('0x21')](handleEntityNotFound(_0x44c5fc,null))[_0x9a36('0x21')](function(_0x2eb0c8){if(_0x2eb0c8){_0x117725=_0x2eb0c8;_0x318133[_0x9a36('0x52')]=_[_0x9a36('0x4b')](db[_0x9a36('0xd0')]['rawAttributes']);_0x318133[_0x9a36('0x4e')]=_[_0x9a36('0x4b')](_0x3eab8f[_0x9a36('0x4e')]);_0x318133[_0x9a36('0x4f')]=_[_0x9a36('0x50')](_0x318133[_0x9a36('0x52')],_0x318133[_0x9a36('0x4e')]);_0x5e010f['attributes']=_[_0x9a36('0x50')](_0x318133['model'],qs[_0x9a36('0x53')](_0x3eab8f[_0x9a36('0x4e')]['fields']));_0x5e010f[_0x9a36('0x51')]=_0x5e010f['attributes'][_0x9a36('0x54')]?_0x5e010f[_0x9a36('0x51')]:_0x318133[_0x9a36('0x52')];_0x5e010f[_0x9a36('0x56')]=qs['sort'](_0x3eab8f[_0x9a36('0x4e')]['sort']);_0x5e010f[_0x9a36('0x58')]=qs[_0x9a36('0x4f')](_[_0x9a36('0x59')](_0x3eab8f[_0x9a36('0x4e')],_0x318133[_0x9a36('0x4f')]));if(_0x3eab8f[_0x9a36('0x4e')]['filter']){_0x5e010f['where']=_[_0x9a36('0x5a')](_0x5e010f[_0x9a36('0x58')],{'$or':_['map'](_0x5e010f[_0x9a36('0x51')],function(_0x2797ea){var _0x296515={};_0x296515[_0x2797ea]={'$like':'%'+_0x3eab8f['query'][_0x9a36('0x3c')]+'%'};return _0x296515;})});}_0x5e010f=_[_0x9a36('0x5a')]({},_0x5e010f,_0x3eab8f[_0x9a36('0x5e')]);return _0x117725[_0x9a36('0xcf')](_0x5e010f);}})[_0x9a36('0x21')](function(_0x17ce64){if(_0x17ce64){_0x2ffe3c=_0x17ce64[_0x9a36('0x54')];if(!_0x3eab8f[_0x9a36('0x4e')][_0x9a36('0x55')]('nolimit')){_0x5e010f[_0x9a36('0x30')]=qs[_0x9a36('0x30')](_0x3eab8f[_0x9a36('0x4e')][_0x9a36('0x30')]);_0x5e010f[_0x9a36('0x2f')]=qs[_0x9a36('0x2f')](_0x3eab8f['query'][_0x9a36('0x2f')]);}return _0x117725[_0x9a36('0xcf')](_0x5e010f);}})[_0x9a36('0x21')](function(_0x201350){if(_0x201350){return _0x201350?{'count':_0x2ffe3c,'rows':_0x201350}:null;}})['then'](respondWithResult(_0x44c5fc,null))[_0x9a36('0x2a')](handleError(_0x44c5fc,null));};exports[_0x9a36('0xd1')]=function(_0x4a6a42,_0x4891c4,_0x1558f9){var _0x531873={};var _0x317778={};var _0x47dfb9;var _0x37d2c2;return db[_0x9a36('0x48')][_0x9a36('0xc1')]({'where':{'id':_0x4a6a42[_0x9a36('0x67')]['id']}})[_0x9a36('0x21')](handleEntityNotFound(_0x4891c4,null))[_0x9a36('0x21')](function(_0x143f8b){if(_0x143f8b){_0x47dfb9=_0x143f8b;_0x317778[_0x9a36('0x52')]=_[_0x9a36('0x4b')](db[_0x9a36('0xd2')][_0x9a36('0x49')]);_0x317778[_0x9a36('0x4e')]=_['keys'](_0x4a6a42[_0x9a36('0x4e')]);_0x317778[_0x9a36('0x4f')]=_[_0x9a36('0x50')](_0x317778[_0x9a36('0x52')],_0x317778[_0x9a36('0x4e')]);_0x531873[_0x9a36('0x51')]=_[_0x9a36('0x50')](_0x317778[_0x9a36('0x52')],qs[_0x9a36('0x53')](_0x4a6a42['query'][_0x9a36('0x53')]));_0x531873[_0x9a36('0x51')]=_0x531873[_0x9a36('0x51')][_0x9a36('0x54')]?_0x531873[_0x9a36('0x51')]:_0x317778[_0x9a36('0x52')];_0x531873[_0x9a36('0x56')]=qs[_0x9a36('0x57')](_0x4a6a42[_0x9a36('0x4e')][_0x9a36('0x57')]);_0x531873[_0x9a36('0x58')]=qs[_0x9a36('0x4f')](_[_0x9a36('0x59')](_0x4a6a42[_0x9a36('0x4e')],_0x317778[_0x9a36('0x4f')]));if(_0x4a6a42[_0x9a36('0x4e')]['filter']){_0x531873[_0x9a36('0x58')]=_[_0x9a36('0x5a')](_0x531873[_0x9a36('0x58')],{'$or':_[_0x9a36('0x3e')](_0x531873[_0x9a36('0x51')],function(_0xb5ae43){var _0x23288c={};_0x23288c[_0xb5ae43]={'$like':'%'+_0x4a6a42['query'][_0x9a36('0x3c')]+'%'};return _0x23288c;})});}_0x531873=_[_0x9a36('0x5a')]({},_0x531873,_0x4a6a42[_0x9a36('0x5e')]);return _0x47dfb9[_0x9a36('0xd1')](_0x531873);}})['then'](function(_0x2a4430){if(_0x2a4430){_0x37d2c2=_0x2a4430[_0x9a36('0x54')];if(!_0x4a6a42['query'][_0x9a36('0x55')]('nolimit')){_0x531873[_0x9a36('0x30')]=qs[_0x9a36('0x30')](_0x4a6a42[_0x9a36('0x4e')]['limit']);_0x531873[_0x9a36('0x2f')]=qs[_0x9a36('0x2f')](_0x4a6a42[_0x9a36('0x4e')][_0x9a36('0x2f')]);}return _0x47dfb9[_0x9a36('0xd1')](_0x531873);}})[_0x9a36('0x21')](function(_0x37a833){if(_0x37a833){return _0x37a833?{'count':_0x37d2c2,'rows':_0x37a833}:null;}})[_0x9a36('0x21')](respondWithResult(_0x4891c4,null))[_0x9a36('0x2a')](handleError(_0x4891c4,null));};exports[_0x9a36('0xd3')]=function(_0x35dab7,_0x12b08e,_0x59cf94){var _0x41deaf;var _0x1cdd00;var _0x5dd0c5;return db['User'][_0x9a36('0x41')]({'where':{'id':_0x35dab7[_0x9a36('0x67')]['id'],'role':'agent'},'attributes':['id',_0x9a36('0x43'),'phone',_0x9a36('0xd4'),'role',_0x9a36('0x74'),_0x9a36('0x9a')]})[_0x9a36('0x21')](handleEntityNotFound(_0x12b08e,null))[_0x9a36('0x21')](function(_0xf7eb81){if(_0xf7eb81){_0x41deaf=_0xf7eb81;if(_0x35dab7[_0x9a36('0x65')]['interface']){_0x5dd0c5=util[_0x9a36('0xa8')](_0x9a36('0xd5'),_0x41deaf[_0x35dab7[_0x9a36('0x65')]['interface']]);}else if(_0x35dab7[_0x9a36('0x65')][_0x9a36('0xd6')]){_0x5dd0c5=util[_0x9a36('0xa8')](_0x9a36('0xa9'),_0x35dab7[_0x9a36('0x65')][_0x9a36('0xd6')]);}else{_0x5dd0c5=util[_0x9a36('0xa8')](_0x9a36('0xa9'),_0x41deaf[_0x9a36('0x43')]);}socket['to'](util[_0x9a36('0xa8')](_0x9a36('0xd7'),_0x41deaf[_0x9a36('0x43')]))[_0x9a36('0xa3')](_0x9a36('0xd8'),{'ip':_0x35dab7['headers'][_0x9a36('0xd9')]||_0x35dab7[_0x9a36('0xda')][_0x9a36('0xdb')]||_0x35dab7[_0x9a36('0xdc')]['remoteAddress']||_0x35dab7[_0x9a36('0xda')][_0x9a36('0xdc')][_0x9a36('0xdb')]});return db[_0x9a36('0xac')][_0x9a36('0x35')]({'where':{'membername':_0x41deaf[_0x9a36('0x43')]},'individualHooks':!![]});}})['then'](function(_0x12e216){if(_0x41deaf){return _0x41deaf['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x154b6a){var _0x351936=[];if(_0x154b6a){_0x1cdd00=_0x154b6a;if(_0x1cdd00[_0x9a36('0x54')]){for(var _0x25f3ce=0x0;_0x25f3ce<_0x1cdd00['length'];_0x25f3ce++){_0x351936['push']({'membername':_0x41deaf[_0x9a36('0x43')],'UserId':_0x41deaf['id'],'queue_name':_0x1cdd00[_0x25f3ce]['name'],'VoiceQueueId':_0x1cdd00[_0x25f3ce]['id'],'interface':_0x5dd0c5,'paused':_0x41deaf[_0x9a36('0x9a')]||![],'penalty':_0x1cdd00[_0x25f3ce][_0x9a36('0xdd')]||0x0});}return BPromise[_0x9a36('0xab')](_0x351936,function(_0x3114ed){return db[_0x9a36('0xac')][_0x9a36('0xad')](_0x3114ed);});}}})['then'](function(){return db[_0x9a36('0xde')]['findAll']({'where':{'membername':_0x41deaf[_0x9a36('0x43')],'exitAt':null}});})[_0x9a36('0x21')](function(_0x4e25ca){var _0x38bd80=[];_0x4e25ca[_0x9a36('0xdf')](function(_0x1dd07d){_0x38bd80[_0x9a36('0xa6')](_0x1dd07d['update']({'exitAt':moment()[_0x9a36('0xa8')](_0x9a36('0xe0'))}));});return BPromise[_0x9a36('0xe1')](_0x38bd80);})[_0x9a36('0x21')](function(){var _0x4076c4=[];var _0x3c4af9=[];var _0x23f8e8=utils[_0x9a36('0xe2')]();var _0x2b9493={'membername':_0x41deaf['name'],'interface':_0x5dd0c5,'enterAt':moment()[_0x9a36('0xa8')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x41deaf[_0x9a36('0x42')],'internal':_0x41deaf[_0x9a36('0x74')]};_0x23f8e8['forEach'](function(_0x473c4f){_0x4076c4[_0x9a36('0xa6')](_[_0x9a36('0x5a')]({'channel':_0x473c4f,'type':'LOGIN','data1':_0x35dab7[_0x9a36('0x65')]['device'],'data2':_0x5dd0c5},_0x2b9493));if(_0x41deaf[_0x9a36('0x9a')]){_0x3c4af9[_0x9a36('0xa6')](_['merge']({'channel':_0x473c4f,'type':_0x9a36('0xe3'),'data1':_0x9a36('0xe4')},_0x2b9493));}});return db[_0x9a36('0xde')]['bulkCreate'](_0x4076c4['concat'](_0x3c4af9),{'individualHooks':!![]});})[_0x9a36('0x21')](function(){return _0x41deaf[_0x9a36('0x66')]({'online':!![],'lastLoginAt':moment()[_0x9a36('0xa8')](_0x9a36('0xe0')),'voicePause':_0x41deaf[_0x9a36('0x9a')]||![],'mailPause':_0x41deaf[_0x9a36('0x9a')]||![],'chatPause':_0x41deaf['loginInPause']||![],'faxPause':_0x41deaf[_0x9a36('0x9a')]||![],'smsPause':_0x41deaf[_0x9a36('0x9a')]||![],'openchannelPause':_0x41deaf[_0x9a36('0x9a')]||![],'pauseType':_0x41deaf[_0x9a36('0x9a')]?_0x9a36('0xe4'):null,'interface':_0x5dd0c5,'lastPauseAt':moment()[_0x9a36('0xa8')](_0x9a36('0xe0'))});})[_0x9a36('0x21')](respondWithResult(_0x12b08e,null))['catch'](handleError(_0x12b08e,null));};exports[_0x9a36('0xe5')]=function(_0x379a6d,_0x4a280d,_0x33826d){var _0x5bec17;return db[_0x9a36('0x48')][_0x9a36('0x41')]({'where':{'id':_0x379a6d['params']['id'],'role':_0x9a36('0x3a')},'attributes':['id',_0x9a36('0x43'),_0x9a36('0x42')]})[_0x9a36('0x21')](handleEntityNotFound(_0x4a280d,null))[_0x9a36('0x21')](function(_0x2f2c18){if(_0x2f2c18){_0x5bec17=_0x2f2c18;return db[_0x9a36('0xac')]['destroy']({'where':{'membername':_0x5bec17[_0x9a36('0x43')]},'individualHooks':!![]});}})[_0x9a36('0x21')](function(){return db[_0x9a36('0xde')][_0x9a36('0x61')]({'where':{'membername':_0x5bec17[_0x9a36('0x43')],'exitAt':null}});})[_0x9a36('0x21')](function(_0x389f9c){var _0x2a5204=[];_0x389f9c[_0x9a36('0xdf')](function(_0x3b6387){_0x2a5204[_0x9a36('0xa6')](_0x3b6387[_0x9a36('0x66')]({'exitAt':moment()[_0x9a36('0xa8')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x2a5204);})[_0x9a36('0x21')](function(){return _0x5bec17[_0x9a36('0x66')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})[_0x9a36('0x21')](respondWithResult(_0x4a280d,null))['catch'](handleError(_0x4a280d,null));};exports[_0x9a36('0xe6')]=function(_0x5ec2c8,_0x395dda,_0x429774){var _0x61a811;return db[_0x9a36('0xac')][_0x9a36('0x66')]({'paused':0x1},{'where':{'UserId':_0x5ec2c8['params']['id']},'individualHooks':!![]})[_0x9a36('0x21')](function(){return db['User'][_0x9a36('0x41')]({'where':{'id':_0x5ec2c8[_0x9a36('0x67')]['id'],'role':_0x9a36('0x3a')},'attributes':['id',_0x9a36('0x43'),_0x9a36('0x42'),_0x9a36('0x74'),_0x9a36('0xa7')]});})['then'](handleEntityNotFound(_0x395dda,null))[_0x9a36('0x21')](function(_0x445cf0){if(_0x445cf0){_0x61a811=_0x445cf0;return respondWithRpcPromise(_0x9a36('0xe7'),_0x9a36('0xe6'),{'id':_0x61a811['id'],'name':_0x61a811[_0x9a36('0x43')],'pause':!![]});}})[_0x9a36('0x21')](function(){if(_0x61a811){return db[_0x9a36('0xde')][_0x9a36('0x61')]({'where':{'membername':_0x61a811['name'],'type':'PAUSE','exitAt':null}});}})[_0x9a36('0x21')](function(_0x58fa9e){if(_0x58fa9e[_0x9a36('0x54')]){var _0x24d41e=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x3a21fb=0x0,_0xef4650=_0x58fa9e[_0x9a36('0x54')];_0x3a21fb<_0xef4650;_0x3a21fb++){_0x58fa9e[_0x3a21fb][_0x9a36('0xe8')]({'exitAt':_0x24d41e});}}})['then'](function(){var _0x596644=[];var _0xac88ea=utils[_0x9a36('0xe2')]();_0xac88ea['forEach'](function(_0x4a8c5a){_0x596644[_0x9a36('0xa6')]({'channel':_0x4a8c5a,'membername':_0x61a811[_0x9a36('0x43')],'interface':_['isNil'](_0x61a811[_0x9a36('0xa7')])?util['format']('SIP/%s',_0x61a811[_0x9a36('0x43')]):_0x61a811[_0x9a36('0xa7')],'type':_0x9a36('0xe3'),'enterAt':moment()['format'](_0x9a36('0xe0')),'data1':_0x5ec2c8[_0x9a36('0x65')]['type']||_0x9a36('0xe9'),'role':_0x61a811[_0x9a36('0x42')],'internal':_0x61a811[_0x9a36('0x74')]});});return db[_0x9a36('0xde')][_0x9a36('0x64')](_0x596644,{'individualHooks':!![]});})[_0x9a36('0x21')](function(){return _0x61a811['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x5ec2c8[_0x9a36('0x65')][_0x9a36('0xea')]||_0x9a36('0xe9'),'lastPauseAt':moment()[_0x9a36('0xa8')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x9a36('0x21')](respondWithResult(_0x395dda,null))[_0x9a36('0x2a')](handleError(_0x395dda,null));};exports['unpause']=function(_0x146df0,_0x408bbb,_0x353e16){var _0xffae1f;return db['User'][_0x9a36('0x41')]({'where':{'id':_0x146df0[_0x9a36('0x67')]['id']},'attributes':['id',_0x9a36('0x43'),_0x9a36('0x42'),_0x9a36('0xaa'),_0x9a36('0xeb'),_0x9a36('0xec'),_0x9a36('0xed'),_0x9a36('0xee'),_0x9a36('0xef'),_0x9a36('0xf0'),'lastPauseAt']})[_0x9a36('0x21')](handleEntityNotFound(_0x408bbb,null))[_0x9a36('0x21')](function(_0x2967c7){if(_0x2967c7){_0xffae1f=_0x2967c7;if(_0x146df0[_0x9a36('0x65')][_0x9a36('0x9d')]&&!utils[_0x9a36('0x9b')](_0x146df0['body'][_0x9a36('0x9d')])){throw new db[(_0x9a36('0x92'))][(_0x9a36('0x93'))](_0x9a36('0xaf'));}switch(_0x146df0['body'][_0x9a36('0x9d')]){case _0x9a36('0xa5'):return respondWithRpcPromise(_0x9a36('0xe7'),_0x9a36('0xf1'),{'id':_0xffae1f['id'],'name':_0xffae1f['name'],'pause':![]})['then'](function(){return db[_0x9a36('0xac')]['update']({'paused':0x0},{'where':{'UserId':_0xffae1f['id']},'individualHooks':!![]});})['then'](function(){return db[_0x9a36('0xde')][_0x9a36('0x41')]({'where':{'channel':_0x146df0[_0x9a36('0x65')]['channel'],'membername':_0xffae1f['name'],'type':_0x9a36('0xe3'),'exitAt':null}});})[_0x9a36('0x21')](function(_0xc16fce){if(_0xc16fce){return _0xc16fce['update']({'exitAt':moment()[_0x9a36('0xa8')](_0x9a36('0xe0')),'data2':_0x9a36('0xf2')},{'individualHooks':!![]});}return null;})[_0x9a36('0x21')](function(){return _0xffae1f['update']({'voicePause':![]});});case _0x9a36('0xf3'):case _0x9a36('0xf4'):case _0x9a36('0xf5'):case _0x9a36('0xf6'):case _0x9a36('0xf7'):return db[_0x9a36('0xde')][_0x9a36('0x41')]({'where':{'channel':_0x146df0[_0x9a36('0x65')][_0x9a36('0x9d')],'membername':_0xffae1f[_0x9a36('0x43')],'type':_0x9a36('0xe3'),'exitAt':null}})['then'](function(_0x373038){if(_0x373038){return _0x373038[_0x9a36('0x66')]({'exitAt':moment()[_0x9a36('0xa8')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x9a36('0xf2')},{'individualHooks':!![]});}return null;})[_0x9a36('0x21')](function(){var _0x121758={};_[_0x9a36('0x31')](_0x121758,util[_0x9a36('0xa8')](_0x9a36('0xf8'),_0x146df0['body'][_0x9a36('0x9d')],'Pause'),![]);return _0xffae1f[_0x9a36('0x66')](_0x121758);});default:return respondWithRpcPromise(_0x9a36('0xe7'),_0x9a36('0xf1'),{'id':_0xffae1f['id'],'name':_0xffae1f['name'],'pause':![]})[_0x9a36('0x21')](function(){return db[_0x9a36('0xac')][_0x9a36('0x66')]({'paused':0x0},{'where':{'UserId':_0xffae1f['id']}});})[_0x9a36('0x21')](function(){return db['MemberReport'][_0x9a36('0x61')]({'where':{'membername':_0xffae1f[_0x9a36('0x43')],'type':_0x9a36('0xe3'),'exitAt':null}});})['then'](function(_0x330934){var _0x2b230e=[];_0x330934[_0x9a36('0xdf')](function(_0xbb0583){_0x2b230e[_0x9a36('0xa6')](_0xbb0583[_0x9a36('0x66')]({'exitAt':moment()[_0x9a36('0xa8')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x9a36('0xf2')}));});return BPromise[_0x9a36('0xe1')](_0x2b230e);})[_0x9a36('0x21')](function(){return _0xffae1f[_0x9a36('0x66')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x9a36('0x21')](respondWithResult(_0x408bbb,null))[_0x9a36('0x2a')](handleError(_0x408bbb,null));};exports[_0x9a36('0xf9')]=function(_0x4ef649,_0x168675,_0x1be197){var _0x24879c={};var _0x381828={};var _0x272465;var _0x4eaeab;return db[_0x9a36('0x48')][_0x9a36('0xc1')]({'where':{'id':_0x4ef649[_0x9a36('0x67')]['id']}})[_0x9a36('0x21')](handleEntityNotFound(_0x168675,null))[_0x9a36('0x21')](function(_0x376e16){if(_0x376e16){_0x272465=_0x376e16;_0x381828['model']=_[_0x9a36('0x4b')](db[_0x9a36('0xfa')]['rawAttributes']);_0x381828['query']=_[_0x9a36('0x4b')](_0x4ef649[_0x9a36('0x4e')]);_0x381828[_0x9a36('0x4f')]=_[_0x9a36('0x50')](_0x381828[_0x9a36('0x52')],_0x381828[_0x9a36('0x4e')]);_0x24879c[_0x9a36('0x51')]=_[_0x9a36('0x50')](_0x381828[_0x9a36('0x52')],qs[_0x9a36('0x53')](_0x4ef649[_0x9a36('0x4e')][_0x9a36('0x53')]));_0x24879c[_0x9a36('0x51')]=_0x24879c[_0x9a36('0x51')][_0x9a36('0x54')]?_0x24879c[_0x9a36('0x51')]:_0x381828[_0x9a36('0x52')];_0x24879c[_0x9a36('0x56')]=qs['sort'](_0x4ef649[_0x9a36('0x4e')][_0x9a36('0x57')]);_0x24879c['where']=qs[_0x9a36('0x4f')](_[_0x9a36('0x59')](_0x4ef649[_0x9a36('0x4e')],_0x381828[_0x9a36('0x4f')]));if(_0x4ef649['query'][_0x9a36('0x3c')]){_0x24879c[_0x9a36('0x58')]=_[_0x9a36('0x5a')](_0x24879c[_0x9a36('0x58')],{'$or':_[_0x9a36('0x3e')](_0x24879c[_0x9a36('0x51')],function(_0x315131){var _0x17e022={};_0x17e022[_0x315131]={'$like':'%'+_0x4ef649[_0x9a36('0x4e')][_0x9a36('0x3c')]+'%'};return _0x17e022;})});}_0x24879c=_[_0x9a36('0x5a')]({},_0x24879c,_0x4ef649['options']);return _0x272465[_0x9a36('0xf9')](_0x24879c);}})[_0x9a36('0x21')](function(_0x3fb702){if(_0x3fb702){_0x4eaeab=_0x3fb702[_0x9a36('0x54')];if(!_0x4ef649[_0x9a36('0x4e')][_0x9a36('0x55')](_0x9a36('0xc4'))){_0x24879c[_0x9a36('0x30')]=qs[_0x9a36('0x30')](_0x4ef649[_0x9a36('0x4e')]['limit']);_0x24879c['offset']=qs[_0x9a36('0x2f')](_0x4ef649['query'][_0x9a36('0x2f')]);}return _0x272465[_0x9a36('0xf9')](_0x24879c);}})[_0x9a36('0x21')](function(_0x3ee304){if(_0x3ee304){return _0x3ee304?{'count':_0x4eaeab,'rows':_0x3ee304}:null;}})[_0x9a36('0x21')](respondWithResult(_0x168675,null))[_0x9a36('0x2a')](handleError(_0x168675,null));};exports[_0x9a36('0xfb')]=function(_0x4802e9,_0x1ffcb2,_0x7ba3b2){return db[_0x9a36('0x48')][_0x9a36('0x41')]({'where':{'id':_0x4802e9[_0x9a36('0x67')]['id']}})[_0x9a36('0x21')](handleEntityNotFound(_0x1ffcb2,null))[_0x9a36('0x21')](function(_0x468398){if(_0x468398){return _0x468398['addTeams'](_0x4802e9[_0x9a36('0x65')]['ids'],_[_0x9a36('0x6b')](_0x4802e9[_0x9a36('0x65')],['ids','id'])||{});}})[_0x9a36('0x21')](respondWithResult(_0x1ffcb2,null))[_0x9a36('0x2a')](handleError(_0x1ffcb2,null));};exports[_0x9a36('0xfc')]=function(_0x18af2d,_0x45027c,_0x469b97){var _0x1188bc;return db['User'][_0x9a36('0x41')]({'where':{'id':_0x18af2d[_0x9a36('0x67')]['id']}})['then'](handleEntityNotFound(_0x45027c,null))['then'](function(_0x42d05f){if(_0x42d05f){return _0x42d05f[_0x9a36('0xfc')](_0x18af2d[_0x9a36('0x4e')][_0x9a36('0x6a')]);}})[_0x9a36('0x21')](respondWithStatusCode(_0x45027c,null))[_0x9a36('0x2a')](handleError(_0x45027c,null));};exports[_0x9a36('0xfd')]=function(_0x44f880,_0x533485,_0x30eec0){var _0x5b30ac={};var _0x1c5a56={};var _0x1d2c7c;var _0x36767c;return db[_0x9a36('0x48')][_0x9a36('0xc1')]({'where':{'id':_0x44f880['params']['id']}})[_0x9a36('0x21')](handleEntityNotFound(_0x533485,null))[_0x9a36('0x21')](function(_0x384398){if(_0x384398){_0x1d2c7c=_0x384398;_0x1c5a56[_0x9a36('0x52')]=_[_0x9a36('0x4b')](db[_0x9a36('0xfe')]['rawAttributes']);_0x1c5a56['query']=_[_0x9a36('0x4b')](_0x44f880[_0x9a36('0x4e')]);_0x1c5a56['filters']=_[_0x9a36('0x50')](_0x1c5a56[_0x9a36('0x52')],_0x1c5a56['query']);_0x5b30ac[_0x9a36('0x51')]=_['intersection'](_0x1c5a56[_0x9a36('0x52')],qs[_0x9a36('0x53')](_0x44f880['query'][_0x9a36('0x53')]));_0x5b30ac[_0x9a36('0x51')]=_0x5b30ac[_0x9a36('0x51')][_0x9a36('0x54')]?_0x5b30ac[_0x9a36('0x51')]:_0x1c5a56['model'];_0x5b30ac['order']=qs['sort'](_0x44f880[_0x9a36('0x4e')][_0x9a36('0x57')]);_0x5b30ac[_0x9a36('0x58')]=qs['filters'](_['pick'](_0x44f880[_0x9a36('0x4e')],_0x1c5a56[_0x9a36('0x4f')]));if(_0x44f880[_0x9a36('0x4e')][_0x9a36('0x3c')]){_0x5b30ac['where']=_[_0x9a36('0x5a')](_0x5b30ac['where'],{'$or':_['map'](_0x5b30ac[_0x9a36('0x51')],function(_0x4604c3){var _0x247f1c={};_0x247f1c[_0x4604c3]={'$like':'%'+_0x44f880[_0x9a36('0x4e')][_0x9a36('0x3c')]+'%'};return _0x247f1c;})});}_0x5b30ac=_[_0x9a36('0x5a')]({},_0x5b30ac,_0x44f880[_0x9a36('0x5e')]);return _0x1d2c7c[_0x9a36('0xfd')](_0x5b30ac);}})['then'](function(_0x402c89){if(_0x402c89){_0x36767c=_0x402c89[_0x9a36('0x54')];if(!_0x44f880[_0x9a36('0x4e')][_0x9a36('0x55')]('nolimit')){_0x5b30ac[_0x9a36('0x30')]=qs[_0x9a36('0x30')](_0x44f880[_0x9a36('0x4e')][_0x9a36('0x30')]);_0x5b30ac['offset']=qs[_0x9a36('0x2f')](_0x44f880['query'][_0x9a36('0x2f')]);}return _0x1d2c7c[_0x9a36('0xfd')](_0x5b30ac);}})['then'](function(_0x2898d9){if(_0x2898d9){return _0x2898d9?{'count':_0x36767c,'rows':_0x2898d9}:null;}})[_0x9a36('0x21')](respondWithResult(_0x533485,null))[_0x9a36('0x2a')](handleError(_0x533485,null));};exports['getAgents']=function(_0x32a7cf,_0x3cd93d,_0x1dbdb5){var _0x1f6858={};var _0x285444={};var _0x46d03e;var _0x198016;return db[_0x9a36('0x48')][_0x9a36('0xc1')]({'where':{'id':_0x32a7cf[_0x9a36('0x67')]['id']}})[_0x9a36('0x21')](handleEntityNotFound(_0x3cd93d,null))['then'](function(_0x493e5e){if(_0x493e5e){_0x46d03e=_0x493e5e;_0x285444[_0x9a36('0x52')]=_[_0x9a36('0x4b')](db[_0x9a36('0x48')][_0x9a36('0x49')]);_0x285444[_0x9a36('0x4e')]=_['keys'](_0x32a7cf['query']);_0x285444[_0x9a36('0x4f')]=_[_0x9a36('0x50')](_0x285444[_0x9a36('0x52')],_0x285444['query']);_0x1f6858[_0x9a36('0x51')]=_[_0x9a36('0x50')](_0x285444['model'],qs[_0x9a36('0x53')](_0x32a7cf[_0x9a36('0x4e')][_0x9a36('0x53')]));_0x1f6858['attributes']=_0x1f6858[_0x9a36('0x51')][_0x9a36('0x54')]?_0x1f6858['attributes']:_0x285444[_0x9a36('0x52')];_0x1f6858[_0x9a36('0x56')]=qs[_0x9a36('0x57')](_0x32a7cf['query'][_0x9a36('0x57')]);_0x1f6858[_0x9a36('0x58')]=qs['filters'](_[_0x9a36('0x59')](_0x32a7cf[_0x9a36('0x4e')],_0x285444[_0x9a36('0x4f')]));if(_0x32a7cf[_0x9a36('0x4e')][_0x9a36('0x3c')]){_0x1f6858[_0x9a36('0x58')]=_[_0x9a36('0x5a')](_0x1f6858['where'],{'$or':_[_0x9a36('0x3e')](_0x1f6858[_0x9a36('0x51')],function(_0x10d7a7){var _0x547e4e={};_0x547e4e[_0x10d7a7]={'$like':'%'+_0x32a7cf[_0x9a36('0x4e')]['filter']+'%'};return _0x547e4e;})});}_0x1f6858['model']=db[_0x9a36('0x48')];_0x1f6858['as']=_0x9a36('0x39');_0x1f6858=_[_0x9a36('0x5a')]({},_0x1f6858,_0x32a7cf[_0x9a36('0x5e')]);return _0x46d03e[_0x9a36('0xff')]({'include':[_0x1f6858]});}})[_0x9a36('0x21')](function(_0x54358c){if(_0x54358c){var _0x1a05e2={},_0x21623a=[],_0x5f4b19=0x0;for(var _0x181198=0x0;_0x181198<_0x54358c[_0x9a36('0x54')];_0x181198+=0x1){for(var _0x3c11f2=0x0,_0x35287c;_0x3c11f2<_0x54358c[_0x181198]['Agents']['length'];_0x3c11f2+=0x1){_0x35287c=_0x54358c[_0x181198][_0x9a36('0x39')][_0x3c11f2]['get']({'plain':!![]});_0x1a05e2[_0x35287c['id']]=_0x35287c;}}_0x1a05e2=_[_0x9a36('0x100')](_0x1a05e2);for(var _0xa11ab6=qs[_0x9a36('0x2f')](_0x32a7cf[_0x9a36('0x4e')][_0x9a36('0x2f')]);_0xa11ab6<_0x1a05e2[_0x9a36('0x54')]&&_0x21623a[_0x9a36('0x54')]=_0x5d82f4){_0x6be2b8=_0x5d82f4;_0x216563=0xc8;}else{_0x216563=0xce;}_0x200697[_0x2baa('0x27')](_0x216563);return _0x200697[_0x2baa('0x2b')](_0x2baa('0x2c'),_0x4032d9+'-'+_0x6be2b8+'/'+_0x5d82f4)[_0x2baa('0x2d')](_0x2d7618);}return null;};}function patchUpdates(_0x1900af){return function(_0x649d26){try{jsonpatch['apply'](_0x649d26,_0x1900af,!![]);}catch(_0x1466ca){return BPromise[_0x2baa('0x2e')](_0x1466ca);}return _0x649d26[_0x2baa('0x2f')]();};}function saveUpdates(_0x118d85,_0x3f9ebf){return function(_0x5cc770){if(_0x5cc770){return _0x5cc770[_0x2baa('0x30')](_0x118d85)[_0x2baa('0x1d')](function(_0x1bbc58){return _0x1bbc58;});}return null;};}function removeEntity(_0x5130da,_0x2fb163){return function(_0x3d4dc7){if(_0x3d4dc7){return _0x3d4dc7[_0x2baa('0x31')]()[_0x2baa('0x1d')](function(){var _0x18e2c0=_0x3d4dc7[_0x2baa('0x32')]({'plain':!![]});var _0xc3407=[{'name':_0x2baa('0x33'),'value':_0x2baa('0x34'),'ignore':!![]},{'name':_0x2baa('0x35'),'value':_0x2baa('0x36'),'ignore':![]},{'name':'Telephones','value':_0x2baa('0x37'),'ignore':![]}];var _0x58d43a=_(_0xc3407)[_0x2baa('0x38')]('ignore')[_0x2baa('0x39')](_0x2baa('0x3a'))['value']();if(_[_0x2baa('0x3b')](_0x58d43a,_0x18e2c0['role'])){return;}var _0x3711cf=_[_0x2baa('0x3c')](_0xc3407,[_0x2baa('0x3a'),_0x18e2c0[_0x2baa('0x3d')]])[_0x2baa('0x3e')];return db['UserProfileResource'][_0x2baa('0x31')]({'where':{'type':_0x3711cf,'resourceId':_0x18e2c0['id']}})[_0x2baa('0x1d')](function(){return _0x3d4dc7;});})[_0x2baa('0x1d')](function(){_0x5130da['status'](0xcc)[_0x2baa('0x28')]();});}};}function handleEntityNotFound(_0x58308d,_0x369c08){return function(_0x55ac65){if(!_0x55ac65){_0x58308d[_0x2baa('0x26')](0x194);}return _0x55ac65;};}function handleError(_0x24d279,_0x3391fc){_0x3391fc=_0x3391fc||0x1f4;return function(_0x1ee818){logger[_0x2baa('0x22')](_0x1ee818[_0x2baa('0x3f')]);if(_0x1ee818['name']){delete _0x1ee818[_0x2baa('0x3e')];}_0x24d279['status'](_0x3391fc)['send'](_0x1ee818);};}exports[_0x2baa('0x40')]=function(_0x45faee,_0x556de2){var _0x51d005={},_0x4ac586={},_0x34799d={'count':0x0,'rows':[]};var _0x19a5de=db['User']['rawAttributes'];_0x4ac586[_0x2baa('0x41')]=_['differenceBy'](_[_0x2baa('0x42')](_0x19a5de),[_0x2baa('0x43'),'salt']);_0x4ac586[_0x2baa('0x44')]=_['keys'](_0x45faee[_0x2baa('0x44')]);_0x4ac586[_0x2baa('0x45')]=_['intersection'](_0x4ac586[_0x2baa('0x41')],_0x4ac586[_0x2baa('0x44')]);_0x51d005[_0x2baa('0x46')]=_['intersection'](_0x4ac586['model'],qs['fields'](_0x45faee['query'][_0x2baa('0x47')]));_0x51d005['attributes']=_0x51d005['attributes'][_0x2baa('0x48')]?_0x51d005['attributes']:_0x4ac586[_0x2baa('0x41')];if(!_0x45faee['query']['hasOwnProperty'](_0x2baa('0x49'))){_0x51d005[_0x2baa('0x2a')]=qs['limit'](_0x45faee[_0x2baa('0x44')][_0x2baa('0x2a')]);_0x51d005['offset']=qs[_0x2baa('0x29')](_0x45faee[_0x2baa('0x44')][_0x2baa('0x29')]);}_0x51d005[_0x2baa('0x4a')]=qs[_0x2baa('0x4b')](_0x45faee[_0x2baa('0x44')][_0x2baa('0x4b')]);_0x51d005[_0x2baa('0x4c')]=qs[_0x2baa('0x45')](_[_0x2baa('0x4d')](_0x45faee[_0x2baa('0x44')],_0x4ac586[_0x2baa('0x45')]));if(_0x45faee[_0x2baa('0x44')][_0x2baa('0x38')]){_0x51d005[_0x2baa('0x4c')]=_[_0x2baa('0x4e')](_0x51d005[_0x2baa('0x4c')],{'$or':_[_0x2baa('0x39')](_0x19a5de,function(_0x905cfd){return db[_0x2baa('0x4f')][_0x2baa('0x4c')](db[_0x2baa('0x4f')]['fn'](_0x2baa('0x50'),db['sequelize']['col'](_0x905cfd[_0x2baa('0x51')])),{'$like':db[_0x2baa('0x4f')]['fn'](_0x2baa('0x50'),'%'+_0x45faee['query']['filter']+'%')});})});}_0x51d005=_[_0x2baa('0x4e')]({},_0x51d005,_0x45faee[_0x2baa('0x52')]);var _0x470d38={'where':_0x51d005[_0x2baa('0x4c')]};return db[_0x2baa('0x53')]['count'](_0x470d38)['then'](function(_0x57f025){_0x34799d[_0x2baa('0x54')]=_0x57f025;if(_0x45faee[_0x2baa('0x44')][_0x2baa('0x55')]){_0x51d005[_0x2baa('0x56')]=[{'all':!![]}];}return db[_0x2baa('0x53')][_0x2baa('0x57')](_0x51d005);})['then'](function(_0x5e690a){_0x34799d['rows']=_0x5e690a;return _0x34799d;})[_0x2baa('0x1d')](respondWithFilteredResult(_0x556de2,_0x51d005))['catch'](handleError(_0x556de2,null));};exports['show']=function(_0x3b86ba,_0xbe8eec){var _0x511c5e={'raw':![],'where':{'id':_0x3b86ba['params']['id']}},_0x3a47b3={};_0x3a47b3[_0x2baa('0x41')]=_[_0x2baa('0x58')](_['keys'](db[_0x2baa('0x53')][_0x2baa('0x59')]),[_0x2baa('0x43'),_0x2baa('0x5a')]);_0x3a47b3[_0x2baa('0x44')]=_[_0x2baa('0x42')](_0x3b86ba[_0x2baa('0x44')]);_0x3a47b3[_0x2baa('0x45')]=_[_0x2baa('0x5b')](_0x3a47b3['model'],_0x3a47b3[_0x2baa('0x44')]);_0x511c5e[_0x2baa('0x46')]=_['intersection'](_0x3a47b3['model'],qs['fields'](_0x3b86ba[_0x2baa('0x44')][_0x2baa('0x47')]));_0x511c5e[_0x2baa('0x46')]=_0x511c5e['attributes']['length']?_0x511c5e[_0x2baa('0x46')]:_0x3a47b3[_0x2baa('0x41')];if(_0x3b86ba[_0x2baa('0x44')][_0x2baa('0x55')]){_0x511c5e[_0x2baa('0x56')]=[{'all':!![]}];}_0x511c5e=_['merge']({},_0x511c5e,_0x3b86ba[_0x2baa('0x52')]);return db[_0x2baa('0x53')][_0x2baa('0x3c')](_0x511c5e)[_0x2baa('0x1d')](handleEntityNotFound(_0xbe8eec,null))['then'](respondWithResult(_0xbe8eec,null))[_0x2baa('0x5c')](handleError(_0xbe8eec,null));};exports[_0x2baa('0x5d')]=function(_0x340cd5,_0x5ccb35){return db[_0x2baa('0x53')][_0x2baa('0x5d')](_0x340cd5[_0x2baa('0x5e')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x5ccb35,0xc9))['catch'](handleError(_0x5ccb35,null));};exports['update']=function(_0x1921c9,_0x452c76){if(_0x1921c9[_0x2baa('0x5e')]['id']){delete _0x1921c9['body']['id'];}return db[_0x2baa('0x53')][_0x2baa('0x3c')]({'where':{'id':_0x1921c9['params']['id']}})[_0x2baa('0x1d')](handleEntityNotFound(_0x452c76,null))[_0x2baa('0x1d')](saveUpdates(_0x1921c9[_0x2baa('0x5e')],null))[_0x2baa('0x1d')](respondWithResult(_0x452c76,null))[_0x2baa('0x5c')](handleError(_0x452c76,null));};exports['describe']=function(_0x12310e,_0x578e7f){return db[_0x2baa('0x53')][_0x2baa('0x5f')]()[_0x2baa('0x1d')](respondWithResult(_0x578e7f,null))['catch'](handleError(_0x578e7f,null));};exports[_0x2baa('0x60')]=function(_0x1e6310,_0x3b2c80,_0x43f26d){return db[_0x2baa('0x53')][_0x2baa('0x3c')]({'where':{'id':_0x1e6310[_0x2baa('0x61')]['id']}})['then'](handleEntityNotFound(_0x3b2c80,null))[_0x2baa('0x1d')](function(_0x1e2bc4){if(_0x1e2bc4){return _0x1e2bc4['addContacts'](_0x1e6310['body'][_0x2baa('0x62')],_['omit'](_0x1e6310[_0x2baa('0x5e')],[_0x2baa('0x62'),'id'])||{});}})['then'](respondWithResult(_0x3b2c80,null))['catch'](handleError(_0x3b2c80,null));};var getLicense=function(_0x2a3c10){return new BPromise(function(_0x135bde,_0x7feeca){var _0x269f4d=0x0;_0x2a3c10[_0x2baa('0x5e')][_0x2baa('0x3d')]==='agent'&&_0x135bde(_0x2baa('0x63'));return db[_0x2baa('0x53')]['count']({'where':{'$or':[{'role':_0x2a3c10[_0x2baa('0x5e')][_0x2baa('0x3d')]==='telephone'?'telephone':[_0x2baa('0x64'),_0x2baa('0x34')]}]}})[_0x2baa('0x1d')](function(_0x491bc8){_0x269f4d=_0x491bc8;return require('../../config/license/util')['getLicense']();})[_0x2baa('0x1d')](function(_0x1a3740){var _0xe32042=_0x2a3c10[_0x2baa('0x5e')][_0x2baa('0x3d')]===_0x2baa('0x37')?_0x2baa('0x65'):'users';if(!_[_0x2baa('0x66')](_0x1a3740[_0xe32042])&&_0x269f4d>=_0x1a3740[_0xe32042]){return _0x7feeca({'message':_0x2baa('0x67')});}return _0x135bde(util[_0x2baa('0x68')](_0x2baa('0x69'),_0xe32042,_0x269f4d));})[_0x2baa('0x5c')](function(_0x4b7901){return _0x7feeca(_0x4b7901);});});};exports[_0x2baa('0x6a')]=function(_0x51af64,_0x51672d){return getLicense(_0x51af64)[_0x2baa('0x1d')](function(_0x277718){if(!_0x51af64[_0x2baa('0x5e')][_0x2baa('0x6b')]){var _0x51e81e;return db[_0x2baa('0x6c')][_0x2baa('0x6d')](0x1)[_0x2baa('0x1d')](function(_0x2c77a5){_0x51e81e=_0x2c77a5[_0x2baa('0x6e')];return db[_0x2baa('0x53')]['max'](_0x2baa('0x6b'));})[_0x2baa('0x1d')](function(_0x158773){if(_[_0x2baa('0x66')](_0x158773)){if(_0x51e81e){_0x51af64['body'][_0x2baa('0x6b')]=_0x51e81e;}else{_0x51af64[_0x2baa('0x5e')][_0x2baa('0x6b')]=0x1;}}else{if(_[_0x2baa('0x66')](_0x51e81e)||_0x51e81e==_0x158773){_0x51af64['body'][_0x2baa('0x6b')]=_0x158773+0x1;}else if(_0x51e81e>_0x158773){_0x51af64[_0x2baa('0x5e')][_0x2baa('0x6b')]=_0x51e81e;}else{return db['sequelize'][_0x2baa('0x44')]('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[_0x2baa('0x4f')][_0x2baa('0x6f')][_0x2baa('0x70')]})[_0x2baa('0x1d')](function(_0x161dd9){if(_0x161dd9&&_0x161dd9[_0x2baa('0x48')]){for(var _0x1253e4=0x0,_0x126f14=_0x161dd9[_0x2baa('0x48')];_0x1253e4<_0x126f14&&_[_0x2baa('0x66')](_0x51af64[_0x2baa('0x5e')][_0x2baa('0x6b')]);_0x1253e4++){if(_0x51e81e<=_0x161dd9[_0x1253e4][_0x2baa('0x71')]){_0x51af64[_0x2baa('0x5e')][_0x2baa('0x6b')]=_0x161dd9[_0x1253e4][_0x2baa('0x71')];}else if(_0x51e81e>_0x161dd9[_0x1253e4]['from']&&_0x51e81e<=_0x161dd9[_0x1253e4]['to']){_0x51af64[_0x2baa('0x5e')][_0x2baa('0x6b')]=_0x51e81e;}}}if(_[_0x2baa('0x66')](_0x51af64[_0x2baa('0x5e')][_0x2baa('0x6b')])){_0x51af64['body'][_0x2baa('0x6b')]=_0x158773+0x1;}});}}});}})[_0x2baa('0x1d')](function(){if(_0x51af64['body'][_0x2baa('0x72')]){_0x51af64['body']['mailbox']=_0x51af64[_0x2baa('0x5e')]['internal'];_0x51af64[_0x2baa('0x5e')][_0x2baa('0x73')]={'mailbox':_0x51af64['body'][_0x2baa('0x6b')],'password':_0x51af64['body'][_0x2baa('0x43')],'fullname':_0x51af64[_0x2baa('0x5e')][_0x2baa('0x74')],'email':_0x51af64[_0x2baa('0x5e')]['email']};}if(_0x51af64['body']&&_0x51af64[_0x2baa('0x5e')][_0x2baa('0x3d')]==='agent'){_0x51af64[_0x2baa('0x5e')][_0x2baa('0x75')]=[_0x2baa('0x76'),_0x2baa('0x77'),_0x2baa('0x78'),'110',_0x2baa('0x79'),_0x2baa('0x7a'),'106',_0x2baa('0x7b'),_0x2baa('0x7c'),_0x2baa('0x7d'),_0x2baa('0x7e'),'111'];}return db['User'][_0x2baa('0x6a')](_0x51af64[_0x2baa('0x5e')],{'include':[{'model':db[_0x2baa('0x73')],'as':_0x2baa('0x73')}]});})[_0x2baa('0x1d')](function(_0x1af621){if(_0x51af64[_0x2baa('0x5e')][_0x2baa('0x3d')]===_0x2baa('0x34'))return _0x1af621;var _0x4b01cd=_0x51af64[_0x2baa('0x34')][_0x2baa('0x32')]({'plain':!![]});if(!_0x4b01cd)throw new Error(_0x2baa('0x7f'));if(_0x4b01cd[_0x2baa('0x3d')]===_0x2baa('0x34')){var _0x361cc9=_0x1af621[_0x2baa('0x32')]({'plain':!![]});var _0x5c0677=[{'name':_0x2baa('0x35'),'value':_0x2baa('0x36')},{'name':_0x2baa('0x80'),'value':_0x2baa('0x37')}];var _0x1fed60=_['find'](_0x5c0677,[_0x2baa('0x3a'),_0x361cc9[_0x2baa('0x3d')]])['name'];return db[_0x2baa('0x81')][_0x2baa('0x3c')]({'where':{'name':_0x1fed60,'userProfileId':_0x4b01cd[_0x2baa('0x82')]},'raw':!![]})['then'](function(_0x25a9fa){if(_0x25a9fa&&_0x25a9fa[_0x2baa('0x83')]===0x0){return db[_0x2baa('0x84')][_0x2baa('0x6a')]({'name':_0x361cc9[_0x2baa('0x3e')],'resourceId':_0x361cc9['id'],'type':_0x25a9fa[_0x2baa('0x3e')],'sectionId':_0x25a9fa['id']},{})[_0x2baa('0x1d')](function(){return _0x1af621;});}else{return _0x1af621;}})['catch'](function(_0x45561e){logger[_0x2baa('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45561e);throw _0x45561e;});}return _0x1af621;})[_0x2baa('0x1d')](respondWithResult(_0x51672d,0xc9))[_0x2baa('0x5c')](handleError(_0x51672d,null));};exports['changePassword']=function(_0x11897b,_0x3aaf1a,_0x3931ab){if(_0x11897b[_0x2baa('0x5e')]['id']){delete _0x11897b[_0x2baa('0x5e')]['id'];}return db['User']['find']({'where':{'id':_0x11897b['params']['id']}})[_0x2baa('0x1d')](function(_0x22e51d){if(_0x22e51d){if(_0x22e51d['id']==_0x11897b['user']['id']){if(!_0x11897b['body'][_0x2baa('0x85')]||!_0x11897b[_0x2baa('0x5e')][_0x2baa('0x86')]){throw new db[(_0x2baa('0x87'))][(_0x2baa('0x88'))]('Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword');}if(!_0x22e51d[_0x2baa('0x89')](_0x11897b['body'][_0x2baa('0x85')])){throw new db[(_0x2baa('0x87'))][(_0x2baa('0x88'))](_0x2baa('0x8a'));}if(_0x11897b['body'][_0x2baa('0x85')]==_0x11897b['body']['newPassword']){throw new db[(_0x2baa('0x87'))][(_0x2baa('0x88'))](_0x2baa('0x8b'));}return _0x22e51d;}else if(_0x11897b['user'][_0x2baa('0x3d')]=='admin'){if(!_0x11897b[_0x2baa('0x5e')]['newPassword']){throw new db[(_0x2baa('0x87'))][(_0x2baa('0x88'))](_0x2baa('0x8c'));}return _0x22e51d;}else if(_0x11897b['user']['role']==_0x2baa('0x34')){if(!_0x11897b[_0x2baa('0x5e')][_0x2baa('0x86')]){throw new db['Sequelize'][(_0x2baa('0x88'))](_0x2baa('0x8c'));}if(_0x22e51d[_0x2baa('0x3d')]!=_0x2baa('0x36')){throw new db['Sequelize'][(_0x2baa('0x88'))](_0x2baa('0x8d'));}return _0x22e51d;}else{throw new db['Sequelize']['ValidationError'](_0x2baa('0x8d'));}}return null;})[_0x2baa('0x1d')](handleEntityNotFound(_0x3aaf1a,null))[_0x2baa('0x1d')](saveUpdates({'password':_0x11897b['body'][_0x2baa('0x86')],'passwordResetAt':_0x11897b['user']['id']==_0x11897b['params']['id']?moment():null},null))[_0x2baa('0x1d')](respondWithResult(_0x3aaf1a,null))[_0x2baa('0x5c')](handleError(_0x3aaf1a,null));};exports[_0x2baa('0x8e')]=function(_0x524bb8,_0x5d47e3,_0x1995cb){var _0x543831;return db['User']['find']({'where':{'id':_0x524bb8[_0x2baa('0x61')]['id']},'attributes':['id',_0x2baa('0x3e'),'role',_0x2baa('0x8f'),_0x2baa('0x90'),_0x2baa('0x91')]})[_0x2baa('0x1d')](handleEntityNotFound(_0x5d47e3,null))[_0x2baa('0x1d')](function(_0x46ca0e){if(_0x46ca0e){_0x543831=_0x46ca0e;if(!utils[_0x2baa('0x92')](_0x524bb8[_0x2baa('0x5e')][_0x2baa('0x93')])){throw new db[(_0x2baa('0x87'))][(_0x2baa('0x88'))](_0x2baa('0x94'));}return _0x46ca0e[_0x2baa('0x95')+_[_0x2baa('0x96')](_0x524bb8['body']['channel'][_0x2baa('0x97')]())+_0x2baa('0x98')](_0x524bb8[_0x2baa('0x5e')][_0x2baa('0x62')],{'penalty':_0x524bb8[_0x2baa('0x5e')][_0x2baa('0x99')]||0x0});}})['spread'](function(_0x4cc44f){for(var _0x148219=0x0;_0x148219<_0x524bb8[_0x2baa('0x5e')][_0x2baa('0x62')][_0x2baa('0x48')];_0x148219+=0x1){var _0x3b0111={'UserId':_0x524bb8[_0x2baa('0x61')]['id']};_0x3b0111[_[_0x2baa('0x96')](_0x524bb8[_0x2baa('0x5e')][_0x2baa('0x93')][_0x2baa('0x97')]())+_0x2baa('0x9a')]=_0x524bb8[_0x2baa('0x5e')][_0x2baa('0x62')][_0x148219];socket['emit']('user'+_['capitalize'](_0x524bb8['body']['channel']['toLowerCase']())+_0x2baa('0x9b'),_0x3b0111);}return _0x4cc44f;})[_0x2baa('0x1d')](function(){if(_0x524bb8['body'][_0x2baa('0x93')]==='voice'){return db[_0x2baa('0x9c')][_0x2baa('0x57')]({'where':{'id':_0x524bb8[_0x2baa('0x5e')][_0x2baa('0x62')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x127e78){var _0x99793a=[];if(_0x524bb8['body'][_0x2baa('0x93')]===_0x2baa('0x9d')&&_0x543831['role']==='agent'){for(var _0x297bab=0x0;_0x297bab<_0x127e78[_0x2baa('0x48')];_0x297bab+=0x1){_0x99793a[_0x2baa('0x9e')]({'membername':_0x543831[_0x2baa('0x3e')],'UserId':_0x543831['id'],'queue_name':_0x127e78[_0x297bab][_0x2baa('0x3e')],'VoiceQueueId':_0x127e78[_0x297bab]['id'],'interface':_[_0x2baa('0x66')](_0x543831[_0x2baa('0x91')])?util[_0x2baa('0x68')]('SIP/%s',_0x543831[_0x2baa('0x3e')]):_0x543831[_0x2baa('0x91')],'paused':_0x543831['voicePause']||![],'penalty':_0x524bb8[_0x2baa('0x5e')][_0x2baa('0x99')]||0x0});}return BPromise[_0x2baa('0x9f')](_0x99793a,function(_0x2d2a78){return db[_0x2baa('0xa0')][_0x2baa('0xa1')](_0x2d2a78);});}return _0x543831;})[_0x2baa('0x1d')](respondWithStatusCode(_0x5d47e3,null))['catch'](handleError(_0x5d47e3,null));};exports['removeQueues']=function(_0xc99cbc,_0x17e014,_0x5052f6){var _0x5e9c01;return db[_0x2baa('0x53')][_0x2baa('0x3c')]({'where':{'id':_0xc99cbc[_0x2baa('0x61')]['id']},'attributes':['id',_0x2baa('0x3e'),_0x2baa('0x3d')]})[_0x2baa('0x1d')](handleEntityNotFound(_0x17e014,null))[_0x2baa('0x1d')](function(_0x23ea37){if(_0x23ea37){_0x5e9c01=_0x23ea37;if(!_0xc99cbc[_0x2baa('0x44')][_0x2baa('0x93')]||!utils['isValidChannel'](_0xc99cbc[_0x2baa('0x44')]['channel'])){throw new db[(_0x2baa('0x87'))][(_0x2baa('0x88'))]('Unknown\x20channel');}return _0x23ea37['remove'+_[_0x2baa('0x96')](_0xc99cbc['query'][_0x2baa('0x93')]['toLowerCase']())+_0x2baa('0x98')](_0xc99cbc[_0x2baa('0x44')]['ids']);}})['then'](function(_0x59d1ee){for(var _0x2c1da7=0x0;_0x2c1da7<_0xc99cbc['query'][_0x2baa('0x62')][_0x2baa('0x48')];_0x2c1da7+=0x1){var _0x4c417a={'UserId':_0xc99cbc['params']['id']};_0x4c417a[_[_0x2baa('0x96')](_0xc99cbc[_0x2baa('0x44')][_0x2baa('0x93')]['toLowerCase']())+_0x2baa('0x9a')]=_0xc99cbc[_0x2baa('0x44')][_0x2baa('0x62')][_0x2c1da7];socket[_0x2baa('0xa2')]('user'+_[_0x2baa('0x96')](_0xc99cbc[_0x2baa('0x44')][_0x2baa('0x93')][_0x2baa('0x97')]())+_0x2baa('0xa3'),_0x4c417a);}return _0x59d1ee;})['then'](function(){if(_0xc99cbc[_0x2baa('0x44')][_0x2baa('0x93')]===_0x2baa('0x9d')){return db[_0x2baa('0xa0')][_0x2baa('0x31')]({'where':{'UserId':_0xc99cbc[_0x2baa('0x61')]['id'],'VoiceQueueId':_0xc99cbc[_0x2baa('0x44')][_0x2baa('0x62')]},'individualHooks':!![]})['then'](function(){return _0x5e9c01;});}return _0x5e9c01;})[_0x2baa('0x1d')](respondWithStatusCode(_0x17e014,null))[_0x2baa('0x5c')](handleError(_0x17e014,null));};exports[_0x2baa('0xa4')]=function(_0x6e1a63,_0x524399,_0x4fd57a){_0x6e1a63[_0x2baa('0x5e')][_0x2baa('0xa5')]=_0x6e1a63[_0x2baa('0xa6')][_0x2baa('0xa7')];return db['User'][_0x2baa('0x3c')]({'where':{'id':_0x6e1a63[_0x2baa('0x61')]['id']}})[_0x2baa('0x1d')](handleEntityNotFound(_0x524399,null))[_0x2baa('0x1d')](saveUpdates(_0x6e1a63['body'],null))[_0x2baa('0x1d')](respondWithResult(_0x524399,null))[_0x2baa('0x5c')](handleError(_0x524399,null));};exports[_0x2baa('0xa8')]=function(_0x312a98,_0x3f850b,_0x35d002){var _0x5cf46d=path[_0x2baa('0xa9')](config[_0x2baa('0xaa')],_0x2baa('0xab'));return db[_0x2baa('0x53')]['find']({'where':{'id':_0x312a98[_0x2baa('0x61')]['id']},'attributes':['id',_0x2baa('0xa5')],'raw':!![]})[_0x2baa('0x1d')](handleEntityNotFound(_0x3f850b,null))[_0x2baa('0x1d')](function(_0x3b9939){if(_0x3b9939){if(_[_0x2baa('0x66')](_0x3b9939['userpic'])){return _0x3f850b[_0x2baa('0xac')](_0x5cf46d);}else{if(!fs[_0x2baa('0xad')](path['join'](config[_0x2baa('0xaa')],_0x2baa('0xae'),_0x3b9939[_0x2baa('0xa5')]))){return _0x3f850b[_0x2baa('0xac')](_0x5cf46d);}return _0x3f850b[_0x2baa('0xac')](path['join'](config[_0x2baa('0xaa')],_0x2baa('0xae'),_0x3b9939['userpic']));}}})[_0x2baa('0x5c')](handleError(_0x3f850b,null));};exports['getContacts']=function(_0x5dbe06,_0x3ec833,_0x4eb08b){var _0x3bd054={};var _0x509db8={};var _0x58856e;var _0x2461d1;return db[_0x2baa('0x53')][_0x2baa('0xaf')]({'where':{'id':_0x5dbe06[_0x2baa('0x61')]['id']}})[_0x2baa('0x1d')](handleEntityNotFound(_0x3ec833,null))[_0x2baa('0x1d')](function(_0x1c3285){if(_0x1c3285){_0x58856e=_0x1c3285;_0x509db8[_0x2baa('0x41')]=_[_0x2baa('0x42')](db[_0x2baa('0xb0')][_0x2baa('0x59')]);_0x509db8[_0x2baa('0x44')]=_['keys'](_0x5dbe06['query']);_0x509db8[_0x2baa('0x45')]=_['intersection'](_0x509db8[_0x2baa('0x41')],_0x509db8[_0x2baa('0x44')]);_0x3bd054[_0x2baa('0x46')]=_[_0x2baa('0x5b')](_0x509db8['model'],qs['fields'](_0x5dbe06['query'][_0x2baa('0x47')]));_0x3bd054['attributes']=_0x3bd054[_0x2baa('0x46')]['length']?_0x3bd054[_0x2baa('0x46')]:_0x509db8[_0x2baa('0x41')];_0x3bd054[_0x2baa('0x4a')]=qs[_0x2baa('0x4b')](_0x5dbe06['query'][_0x2baa('0x4b')]);_0x3bd054[_0x2baa('0x4c')]=qs[_0x2baa('0x45')](_[_0x2baa('0x4d')](_0x5dbe06[_0x2baa('0x44')],_0x509db8['filters']));if(_0x5dbe06['query'][_0x2baa('0x38')]){_0x3bd054[_0x2baa('0x4c')]=_[_0x2baa('0x4e')](_0x3bd054[_0x2baa('0x4c')],{'$or':_[_0x2baa('0x39')](_0x3bd054[_0x2baa('0x46')],function(_0x28737b){var _0x7b3ad={};_0x7b3ad[_0x28737b]={'$like':'%'+_0x5dbe06['query'][_0x2baa('0x38')]+'%'};return _0x7b3ad;})});}_0x3bd054=_['merge']({},_0x3bd054,_0x5dbe06['options']);return _0x58856e[_0x2baa('0xb1')](_0x3bd054);}})[_0x2baa('0x1d')](function(_0x1a3184){if(_0x1a3184){_0x2461d1=_0x1a3184[_0x2baa('0x48')];if(_0x5dbe06['query'][_0x2baa('0xb2')](_0x2baa('0x55'))){_0x3bd054[_0x2baa('0x56')]=[{'model':db[_0x2baa('0xb3')],'as':_0x2baa('0xb4'),'required':![]},{'model':db[_0x2baa('0xb5')],'as':_0x2baa('0xb6'),'attributes':['id',_0x2baa('0x3e'),_0x2baa('0xb7')],'where':_0x5dbe06[_0x2baa('0x44')][_0x2baa('0xb8')]?{'id':_0x5dbe06[_0x2baa('0x44')]['tag']}:undefined,'required':_0x5dbe06[_0x2baa('0x44')]['tag']?!![]:![]}];}if(!_0x5dbe06['query']['hasOwnProperty'](_0x2baa('0x49'))){_0x3bd054['limit']=qs[_0x2baa('0x2a')](_0x5dbe06['query'][_0x2baa('0x2a')]);_0x3bd054[_0x2baa('0x29')]=qs[_0x2baa('0x29')](_0x5dbe06[_0x2baa('0x44')][_0x2baa('0x29')]);}return _0x58856e['getContacts'](_0x3bd054);}})[_0x2baa('0x1d')](function(_0x5429fb){if(_0x5429fb){return _0x5429fb?{'count':_0x2461d1,'rows':_0x5429fb}:null;}})[_0x2baa('0x1d')](respondWithResult(_0x3ec833,null))[_0x2baa('0x5c')](handleError(_0x3ec833,null));};exports[_0x2baa('0xb9')]=function(_0x4d952c,_0x2d9f71,_0x201d74){var _0x44419f;var _0x893d5f;var _0x310d55={};var _0xdd0b20;return db[_0x2baa('0x53')][_0x2baa('0xaf')]({'where':{'id':_0x4d952c[_0x2baa('0x61')]['id']},'attributes':['id',_0x2baa('0x3e'),'role']})[_0x2baa('0x1d')](handleEntityNotFound(_0x2d9f71,null))[_0x2baa('0x1d')](function(_0x5894d2){if(!utils['isValidChannel'](_0x4d952c[_0x2baa('0x44')][_0x2baa('0x93')])){throw new db[(_0x2baa('0x87'))]['ValidationError'](_0x2baa('0x94'));}_0x44419f=_0x5894d2;var _0x4aaf3b={};_0x4aaf3b[_0x2baa('0x41')]=_[_0x2baa('0x42')](db[_[_0x2baa('0x96')](_0x4d952c[_0x2baa('0x44')][_0x2baa('0x93')])+_0x2baa('0xba')][_0x2baa('0x59')]);_0x4aaf3b[_0x2baa('0x44')]=_[_0x2baa('0x42')](_0x4d952c['query']);_0x4aaf3b[_0x2baa('0x45')]=_['intersection'](_0x4aaf3b[_0x2baa('0x41')],_0x4aaf3b[_0x2baa('0x44')]);_0x310d55['attributes']=_['intersection'](_0x4aaf3b[_0x2baa('0x41')],qs[_0x2baa('0x47')](_0x4d952c[_0x2baa('0x44')]['fields']));_0x310d55[_0x2baa('0x46')]=_0x310d55['attributes'][_0x2baa('0x48')]?_0x310d55['attributes']:_0x4aaf3b['model'];_0x310d55[_0x2baa('0x4a')]=qs[_0x2baa('0x4b')](_0x4d952c[_0x2baa('0x44')][_0x2baa('0x4b')]);_0x310d55[_0x2baa('0x4c')]=qs['filters'](_[_0x2baa('0x4d')](_0x4d952c[_0x2baa('0x44')],_0x4aaf3b[_0x2baa('0x45')]));if(_0x4d952c[_0x2baa('0x44')][_0x2baa('0x38')]){_0x310d55[_0x2baa('0x4c')]=_[_0x2baa('0x4e')](_0x310d55[_0x2baa('0x4c')],{'$or':_[_0x2baa('0x39')](_0x310d55['attributes'],function(_0x3ea6cc){var _0x189709={};_0x189709[_0x3ea6cc]={'$like':'%'+_0x4d952c[_0x2baa('0x44')][_0x2baa('0x38')]+'%'};return _0x189709;})});}_0x310d55=_[_0x2baa('0x4e')]({},_0x310d55,_0x4d952c[_0x2baa('0x52')]);switch(_0x44419f['role']){case _0x2baa('0x64'):return db[_[_0x2baa('0x96')](_0x4d952c[_0x2baa('0x44')][_0x2baa('0x93')])+_0x2baa('0xba')]['findAll'](_0x310d55);case'user':case _0x2baa('0x36'):return _0x44419f[_0x2baa('0x32')+_['capitalize'](_0x4d952c['query']['channel'])+_0x2baa('0x98')](_0x310d55);default:throw new db['Sequelize']['ValidationError'](_0x2baa('0xbb'));}})[_0x2baa('0x1d')](function(_0x44839f){_0xdd0b20=_0x44839f[_0x2baa('0x48')];if(!_0x4d952c[_0x2baa('0x44')][_0x2baa('0xb2')](_0x2baa('0x49'))){_0x310d55[_0x2baa('0x2a')]=qs['limit'](_0x4d952c[_0x2baa('0x44')]['limit']);_0x310d55[_0x2baa('0x29')]=qs['offset'](_0x4d952c['query'][_0x2baa('0x29')]);}switch(_0x44419f[_0x2baa('0x3d')]){case _0x2baa('0x64'):return db[_['capitalize'](_0x4d952c['query'][_0x2baa('0x93')])+_0x2baa('0xba')][_0x2baa('0x57')](_0x310d55);case'user':case'agent':return _0x44419f[_0x2baa('0x32')+_[_0x2baa('0x96')](_0x4d952c[_0x2baa('0x44')][_0x2baa('0x93')])+'Queues'](_0x310d55);}})[_0x2baa('0x1d')](function(_0x5e23a5){return{'count':_0xdd0b20,'rows':_0x5e23a5};})[_0x2baa('0x1d')](respondWithResult(_0x2d9f71,null))[_0x2baa('0x5c')](handleError(_0x2d9f71,null));};exports['getVoiceQueuesRt']=function(_0x505782,_0x62bf45,_0x2c8cde){var _0x316474={};var _0x39a8b8={};var _0x5cd866;var _0x4e06cf;return db['User'][_0x2baa('0xaf')]({'where':{'id':_0x505782[_0x2baa('0x61')]['id']}})[_0x2baa('0x1d')](handleEntityNotFound(_0x62bf45,null))[_0x2baa('0x1d')](function(_0x294c61){if(_0x294c61){_0x5cd866=_0x294c61;_0x39a8b8['model']=_[_0x2baa('0x42')](db[_0x2baa('0xa0')][_0x2baa('0x59')]);_0x39a8b8[_0x2baa('0x44')]=_['keys'](_0x505782[_0x2baa('0x44')]);_0x39a8b8[_0x2baa('0x45')]=_['intersection'](_0x39a8b8[_0x2baa('0x41')],_0x39a8b8[_0x2baa('0x44')]);_0x316474[_0x2baa('0x46')]=_[_0x2baa('0x5b')](_0x39a8b8['model'],qs['fields'](_0x505782[_0x2baa('0x44')][_0x2baa('0x47')]));_0x316474[_0x2baa('0x46')]=_0x316474[_0x2baa('0x46')][_0x2baa('0x48')]?_0x316474[_0x2baa('0x46')]:_0x39a8b8['model'];_0x316474[_0x2baa('0x4a')]=qs[_0x2baa('0x4b')](_0x505782[_0x2baa('0x44')][_0x2baa('0x4b')]);_0x316474['where']=qs[_0x2baa('0x45')](_['pick'](_0x505782[_0x2baa('0x44')],_0x39a8b8['filters']));if(_0x505782['query'][_0x2baa('0x38')]){_0x316474['where']=_[_0x2baa('0x4e')](_0x316474[_0x2baa('0x4c')],{'$or':_[_0x2baa('0x39')](_0x316474[_0x2baa('0x46')],function(_0x194c0b){var _0x25c6ee={};_0x25c6ee[_0x194c0b]={'$like':'%'+_0x505782[_0x2baa('0x44')][_0x2baa('0x38')]+'%'};return _0x25c6ee;})});}_0x316474=_[_0x2baa('0x4e')]({},_0x316474,_0x505782[_0x2baa('0x52')]);return _0x5cd866[_0x2baa('0xbc')](_0x316474);}})[_0x2baa('0x1d')](function(_0x110703){if(_0x110703){_0x4e06cf=_0x110703[_0x2baa('0x48')];if(!_0x505782[_0x2baa('0x44')][_0x2baa('0xb2')](_0x2baa('0x49'))){_0x316474[_0x2baa('0x2a')]=qs[_0x2baa('0x2a')](_0x505782[_0x2baa('0x44')][_0x2baa('0x2a')]);_0x316474['offset']=qs[_0x2baa('0x29')](_0x505782[_0x2baa('0x44')]['offset']);}return _0x5cd866['getVoiceQueuesRt'](_0x316474);}})[_0x2baa('0x1d')](function(_0x2fae0d){if(_0x2fae0d){return _0x2fae0d?{'count':_0x4e06cf,'rows':_0x2fae0d}:null;}})['then'](respondWithResult(_0x62bf45,null))[_0x2baa('0x5c')](handleError(_0x62bf45,null));};exports['getGroups']=function(_0x1749dc,_0x3ed0b0,_0xb8f93a){var _0x2fb183={};var _0x548c07={};var _0x4f33ff;var _0x22e0ae;return db[_0x2baa('0x53')][_0x2baa('0xaf')]({'where':{'id':_0x1749dc[_0x2baa('0x61')]['id']}})[_0x2baa('0x1d')](handleEntityNotFound(_0x3ed0b0,null))['then'](function(_0x948b04){if(_0x948b04){_0x4f33ff=_0x948b04;_0x548c07[_0x2baa('0x41')]=_[_0x2baa('0x42')](db[_0x2baa('0xbd')]['rawAttributes']);_0x548c07['query']=_['keys'](_0x1749dc[_0x2baa('0x44')]);_0x548c07[_0x2baa('0x45')]=_[_0x2baa('0x5b')](_0x548c07[_0x2baa('0x41')],_0x548c07[_0x2baa('0x44')]);_0x2fb183[_0x2baa('0x46')]=_[_0x2baa('0x5b')](_0x548c07[_0x2baa('0x41')],qs['fields'](_0x1749dc[_0x2baa('0x44')][_0x2baa('0x47')]));_0x2fb183[_0x2baa('0x46')]=_0x2fb183['attributes']['length']?_0x2fb183[_0x2baa('0x46')]:_0x548c07[_0x2baa('0x41')];_0x2fb183[_0x2baa('0x4a')]=qs[_0x2baa('0x4b')](_0x1749dc[_0x2baa('0x44')][_0x2baa('0x4b')]);_0x2fb183['where']=qs[_0x2baa('0x45')](_[_0x2baa('0x4d')](_0x1749dc['query'],_0x548c07[_0x2baa('0x45')]));if(_0x1749dc[_0x2baa('0x44')][_0x2baa('0x38')]){_0x2fb183[_0x2baa('0x4c')]=_['merge'](_0x2fb183[_0x2baa('0x4c')],{'$or':_[_0x2baa('0x39')](_0x2fb183[_0x2baa('0x46')],function(_0x50e75b){var _0xc8226b={};_0xc8226b[_0x50e75b]={'$like':'%'+_0x1749dc[_0x2baa('0x44')][_0x2baa('0x38')]+'%'};return _0xc8226b;})});}_0x2fb183=_['merge']({},_0x2fb183,_0x1749dc[_0x2baa('0x52')]);return _0x4f33ff[_0x2baa('0xbe')](_0x2fb183);}})[_0x2baa('0x1d')](function(_0x4ab1ba){if(_0x4ab1ba){_0x22e0ae=_0x4ab1ba[_0x2baa('0x48')];if(!_0x1749dc[_0x2baa('0x44')][_0x2baa('0xb2')](_0x2baa('0x49'))){_0x2fb183[_0x2baa('0x2a')]=qs[_0x2baa('0x2a')](_0x1749dc[_0x2baa('0x44')]['limit']);_0x2fb183[_0x2baa('0x29')]=qs['offset'](_0x1749dc['query']['offset']);}return _0x4f33ff[_0x2baa('0xbe')](_0x2fb183);}})[_0x2baa('0x1d')](function(_0x257ef0){if(_0x257ef0){return _0x257ef0?{'count':_0x22e0ae,'rows':_0x257ef0}:null;}})[_0x2baa('0x1d')](respondWithResult(_0x3ed0b0,null))[_0x2baa('0x5c')](handleError(_0x3ed0b0,null));};exports[_0x2baa('0xbf')]=function(_0x5d5bd4,_0x5318b4,_0x51eda1){var _0x3caa0b={'raw':!![],'where':{}};var _0x1c2be5={};var _0x29c4ca={'count':0x0,'rows':[]};return db[_0x2baa('0x53')]['findOne']({'where':{'id':_0x5d5bd4['params']['id']}})['then'](handleEntityNotFound(_0x5318b4,null))[_0x2baa('0x1d')](function(_0xe717c9){if(_0xe717c9){_0x1c2be5[_0x2baa('0x41')]=_[_0x2baa('0x42')](db[_0x2baa('0xc0')]['rawAttributes']);_0x1c2be5['query']=_[_0x2baa('0x42')](_0x5d5bd4[_0x2baa('0x44')]);_0x1c2be5[_0x2baa('0x45')]=_[_0x2baa('0x5b')](_0x1c2be5[_0x2baa('0x41')],_0x1c2be5[_0x2baa('0x44')]);_0x3caa0b[_0x2baa('0x46')]=_[_0x2baa('0x5b')](_0x1c2be5['model'],qs[_0x2baa('0x47')](_0x5d5bd4[_0x2baa('0x44')][_0x2baa('0x47')]));_0x3caa0b[_0x2baa('0x46')]=_0x3caa0b[_0x2baa('0x46')][_0x2baa('0x48')]?_0x3caa0b['attributes']:_0x1c2be5[_0x2baa('0x41')];if(!_0x5d5bd4[_0x2baa('0x44')][_0x2baa('0xb2')]('nolimit')){_0x3caa0b[_0x2baa('0x2a')]=qs['limit'](_0x5d5bd4[_0x2baa('0x44')]['limit']);_0x3caa0b['offset']=qs[_0x2baa('0x29')](_0x5d5bd4[_0x2baa('0x44')]['offset']);}_0x3caa0b[_0x2baa('0x4a')]=qs[_0x2baa('0x4b')](_0x5d5bd4[_0x2baa('0x44')][_0x2baa('0x4b')]);_0x3caa0b[_0x2baa('0x4c')]=qs[_0x2baa('0x45')](_[_0x2baa('0x4d')](_0x5d5bd4['query'],_0x1c2be5[_0x2baa('0x45')]));_0x3caa0b[_0x2baa('0x4c')][_0x2baa('0xc1')]=_0xe717c9['id'];if(_0x5d5bd4[_0x2baa('0x44')][_0x2baa('0x38')]){_0x3caa0b[_0x2baa('0x4c')]=_[_0x2baa('0x4e')](_0x3caa0b['where'],{'$or':_[_0x2baa('0x39')](_0x3caa0b[_0x2baa('0x46')],function(_0x1406c9){var _0x1eeb10={};_0x1eeb10[_0x1406c9]={'$like':'%'+_0x5d5bd4[_0x2baa('0x44')][_0x2baa('0x38')]+'%'};return _0x1eeb10;})});}_0x3caa0b=_[_0x2baa('0x4e')]({},_0x3caa0b,_0x5d5bd4[_0x2baa('0x52')]);return db[_0x2baa('0xc0')][_0x2baa('0x54')]({'where':_0x3caa0b['where']})[_0x2baa('0x1d')](function(_0x10e3df){_0x29c4ca[_0x2baa('0x54')]=_0x10e3df;if(_0x5d5bd4[_0x2baa('0x44')][_0x2baa('0x55')]){_0x3caa0b['include']=[{'all':!![]}];}return db[_0x2baa('0xc0')]['findAll'](_0x3caa0b);})[_0x2baa('0x1d')](function(_0x540e79){_0x29c4ca[_0x2baa('0xc2')]=_0x540e79;return _0x29c4ca;});}})['then'](respondWithFilteredResult(_0x5318b4,_0x3caa0b))[_0x2baa('0x5c')](handleError(_0x5318b4,null));};exports['getChatInteractions']=function(_0x4eaed8,_0x3f2b3f,_0xcff52f){var _0x178843={};var _0x517a26={};var _0x32922a;var _0x26f09a;return db[_0x2baa('0x53')]['findOne']({'where':{'id':_0x4eaed8[_0x2baa('0x61')]['id']}})['then'](handleEntityNotFound(_0x3f2b3f,null))['then'](function(_0x2405e8){if(_0x2405e8){_0x32922a=_0x2405e8;_0x517a26[_0x2baa('0x41')]=_[_0x2baa('0x42')](db[_0x2baa('0xc3')][_0x2baa('0x59')]);_0x517a26[_0x2baa('0x44')]=_[_0x2baa('0x42')](_0x4eaed8[_0x2baa('0x44')]);_0x517a26[_0x2baa('0x45')]=_[_0x2baa('0x5b')](_0x517a26[_0x2baa('0x41')],_0x517a26[_0x2baa('0x44')]);_0x178843[_0x2baa('0x46')]=_[_0x2baa('0x5b')](_0x517a26[_0x2baa('0x41')],qs[_0x2baa('0x47')](_0x4eaed8[_0x2baa('0x44')]['fields']));_0x178843[_0x2baa('0x46')]=_0x178843['attributes']['length']?_0x178843[_0x2baa('0x46')]:_0x517a26['model'];_0x178843[_0x2baa('0x4a')]=qs[_0x2baa('0x4b')](_0x4eaed8[_0x2baa('0x44')][_0x2baa('0x4b')]);_0x178843[_0x2baa('0x4c')]=qs[_0x2baa('0x45')](_[_0x2baa('0x4d')](_0x4eaed8['query'],_0x517a26['filters']));if(_0x4eaed8[_0x2baa('0x44')][_0x2baa('0x38')]){_0x178843[_0x2baa('0x4c')]=_[_0x2baa('0x4e')](_0x178843[_0x2baa('0x4c')],{'$or':_[_0x2baa('0x39')](_0x178843[_0x2baa('0x46')],function(_0x4c34cf){var _0x3cad2e={};_0x3cad2e[_0x4c34cf]={'$like':'%'+_0x4eaed8[_0x2baa('0x44')][_0x2baa('0x38')]+'%'};return _0x3cad2e;})});}_0x178843=_[_0x2baa('0x4e')]({},_0x178843,_0x4eaed8['options']);return _0x32922a[_0x2baa('0xc4')](_0x178843);}})[_0x2baa('0x1d')](function(_0x72d477){if(_0x72d477){_0x26f09a=_0x72d477[_0x2baa('0x48')];if(!_0x4eaed8[_0x2baa('0x44')]['hasOwnProperty']('nolimit')){_0x178843[_0x2baa('0x2a')]=qs[_0x2baa('0x2a')](_0x4eaed8[_0x2baa('0x44')][_0x2baa('0x2a')]);_0x178843['offset']=qs[_0x2baa('0x29')](_0x4eaed8[_0x2baa('0x44')][_0x2baa('0x29')]);}return _0x32922a['getChatInteractions'](_0x178843);}})['then'](function(_0x26e7d3){if(_0x26e7d3){return _0x26e7d3?{'count':_0x26f09a,'rows':_0x26e7d3}:null;}})[_0x2baa('0x1d')](respondWithResult(_0x3f2b3f,null))[_0x2baa('0x5c')](handleError(_0x3f2b3f,null));};exports[_0x2baa('0xc5')]=function(_0xa80a71,_0x56797c,_0x2c1dba){var _0x596914={};var _0xe1d646={};var _0x108f9d;var _0xf8c129;return db[_0x2baa('0x53')][_0x2baa('0xaf')]({'where':{'id':_0xa80a71[_0x2baa('0x61')]['id']}})[_0x2baa('0x1d')](handleEntityNotFound(_0x56797c,null))['then'](function(_0x20c707){if(_0x20c707){_0x108f9d=_0x20c707;_0xe1d646[_0x2baa('0x41')]=_[_0x2baa('0x42')](db['OpenchannelInteraction']['rawAttributes']);_0xe1d646[_0x2baa('0x44')]=_[_0x2baa('0x42')](_0xa80a71[_0x2baa('0x44')]);_0xe1d646[_0x2baa('0x45')]=_[_0x2baa('0x5b')](_0xe1d646[_0x2baa('0x41')],_0xe1d646[_0x2baa('0x44')]);_0x596914[_0x2baa('0x46')]=_['intersection'](_0xe1d646['model'],qs[_0x2baa('0x47')](_0xa80a71['query'][_0x2baa('0x47')]));_0x596914[_0x2baa('0x46')]=_0x596914[_0x2baa('0x46')][_0x2baa('0x48')]?_0x596914[_0x2baa('0x46')]:_0xe1d646[_0x2baa('0x41')];_0x596914['order']=qs[_0x2baa('0x4b')](_0xa80a71['query'][_0x2baa('0x4b')]);_0x596914['where']=qs['filters'](_[_0x2baa('0x4d')](_0xa80a71['query'],_0xe1d646[_0x2baa('0x45')]));if(_0xa80a71[_0x2baa('0x44')][_0x2baa('0x38')]){_0x596914[_0x2baa('0x4c')]=_[_0x2baa('0x4e')](_0x596914[_0x2baa('0x4c')],{'$or':_[_0x2baa('0x39')](_0x596914[_0x2baa('0x46')],function(_0x1307dd){var _0x5f3b49={};_0x5f3b49[_0x1307dd]={'$like':'%'+_0xa80a71[_0x2baa('0x44')]['filter']+'%'};return _0x5f3b49;})});}_0x596914=_['merge']({},_0x596914,_0xa80a71[_0x2baa('0x52')]);return _0x108f9d[_0x2baa('0xc5')](_0x596914);}})[_0x2baa('0x1d')](function(_0x10eeb0){if(_0x10eeb0){_0xf8c129=_0x10eeb0['length'];if(!_0xa80a71[_0x2baa('0x44')][_0x2baa('0xb2')](_0x2baa('0x49'))){_0x596914[_0x2baa('0x2a')]=qs['limit'](_0xa80a71[_0x2baa('0x44')][_0x2baa('0x2a')]);_0x596914[_0x2baa('0x29')]=qs[_0x2baa('0x29')](_0xa80a71['query'][_0x2baa('0x29')]);}return _0x108f9d[_0x2baa('0xc5')](_0x596914);}})[_0x2baa('0x1d')](function(_0x1965e2){if(_0x1965e2){return _0x1965e2?{'count':_0xf8c129,'rows':_0x1965e2}:null;}})['then'](respondWithResult(_0x56797c,null))[_0x2baa('0x5c')](handleError(_0x56797c,null));};exports['getMailInteractions']=function(_0x1f5521,_0x9a5f64,_0x2d5ebf){var _0x106e8a={'raw':!![],'where':{}};var _0x5e5e9f={};var _0x308e12={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x1f5521[_0x2baa('0x61')]['id']}})[_0x2baa('0x1d')](handleEntityNotFound(_0x9a5f64,null))['then'](function(_0xa95141){if(_0xa95141){_0x5e5e9f[_0x2baa('0x41')]=_[_0x2baa('0x42')](db[_0x2baa('0xc6')][_0x2baa('0x59')]);_0x5e5e9f[_0x2baa('0x44')]=_[_0x2baa('0x42')](_0x1f5521['query']);_0x5e5e9f['filters']=_[_0x2baa('0x5b')](_0x5e5e9f['model'],_0x5e5e9f[_0x2baa('0x44')]);_0x106e8a[_0x2baa('0x46')]=_[_0x2baa('0x5b')](_0x5e5e9f[_0x2baa('0x41')],qs[_0x2baa('0x47')](_0x1f5521[_0x2baa('0x44')]['fields']));_0x106e8a[_0x2baa('0x46')]=_0x106e8a[_0x2baa('0x46')][_0x2baa('0x48')]?_0x106e8a['attributes']:_0x5e5e9f[_0x2baa('0x41')];if(!_0x1f5521['query'][_0x2baa('0xb2')](_0x2baa('0x49'))){_0x106e8a['limit']=qs[_0x2baa('0x2a')](_0x1f5521['query'][_0x2baa('0x2a')]);_0x106e8a[_0x2baa('0x29')]=qs['offset'](_0x1f5521[_0x2baa('0x44')][_0x2baa('0x29')]);}_0x106e8a[_0x2baa('0x4a')]=qs[_0x2baa('0x4b')](_0x1f5521[_0x2baa('0x44')]['sort']);_0x106e8a[_0x2baa('0x4c')]=qs['filters'](_[_0x2baa('0x4d')](_0x1f5521[_0x2baa('0x44')],_0x5e5e9f['filters']));_0x106e8a[_0x2baa('0x4c')][_0x2baa('0xc1')]=_0xa95141['id'];if(_0x1f5521[_0x2baa('0x44')][_0x2baa('0x38')]){_0x106e8a['where']=_['merge'](_0x106e8a['where'],{'$or':_[_0x2baa('0x39')](_0x106e8a[_0x2baa('0x46')],function(_0x16e0da){var _0x4e4989={};_0x4e4989[_0x16e0da]={'$like':'%'+_0x1f5521[_0x2baa('0x44')][_0x2baa('0x38')]+'%'};return _0x4e4989;})});}_0x106e8a=_[_0x2baa('0x4e')]({},_0x106e8a,_0x1f5521[_0x2baa('0x52')]);return db[_0x2baa('0xc6')][_0x2baa('0x54')]({'where':_0x106e8a[_0x2baa('0x4c')]})[_0x2baa('0x1d')](function(_0x5ffd9b){_0x308e12['count']=_0x5ffd9b;if(_0x1f5521[_0x2baa('0x44')]['includeAll']){_0x106e8a[_0x2baa('0x56')]=[{'all':!![]}];}return db[_0x2baa('0xc6')]['findAll'](_0x106e8a);})[_0x2baa('0x1d')](function(_0x41650c){_0x308e12[_0x2baa('0xc2')]=_0x41650c;return _0x308e12;});}})['then'](respondWithFilteredResult(_0x9a5f64,_0x106e8a))[_0x2baa('0x5c')](handleError(_0x9a5f64,null));};exports[_0x2baa('0xc7')]=function(_0x910290,_0x3e54bd,_0x519385){var _0x359805={};var _0x1fb182={};var _0x4d8c29;var _0x301ed7;return db[_0x2baa('0x53')]['findOne']({'where':{'id':_0x910290[_0x2baa('0x61')]['id']}})['then'](handleEntityNotFound(_0x3e54bd,null))[_0x2baa('0x1d')](function(_0x55a634){if(_0x55a634){_0x4d8c29=_0x55a634;_0x1fb182[_0x2baa('0x41')]=_['keys'](db['SmsInteraction'][_0x2baa('0x59')]);_0x1fb182[_0x2baa('0x44')]=_[_0x2baa('0x42')](_0x910290['query']);_0x1fb182['filters']=_[_0x2baa('0x5b')](_0x1fb182['model'],_0x1fb182[_0x2baa('0x44')]);_0x359805[_0x2baa('0x46')]=_[_0x2baa('0x5b')](_0x1fb182[_0x2baa('0x41')],qs['fields'](_0x910290[_0x2baa('0x44')][_0x2baa('0x47')]));_0x359805[_0x2baa('0x46')]=_0x359805[_0x2baa('0x46')]['length']?_0x359805['attributes']:_0x1fb182[_0x2baa('0x41')];_0x359805[_0x2baa('0x4a')]=qs[_0x2baa('0x4b')](_0x910290['query']['sort']);_0x359805[_0x2baa('0x4c')]=qs[_0x2baa('0x45')](_[_0x2baa('0x4d')](_0x910290[_0x2baa('0x44')],_0x1fb182[_0x2baa('0x45')]));if(_0x910290[_0x2baa('0x44')]['filter']){_0x359805['where']=_[_0x2baa('0x4e')](_0x359805['where'],{'$or':_['map'](_0x359805[_0x2baa('0x46')],function(_0x3dcd8f){var _0x563bce={};_0x563bce[_0x3dcd8f]={'$like':'%'+_0x910290[_0x2baa('0x44')][_0x2baa('0x38')]+'%'};return _0x563bce;})});}_0x359805=_['merge']({},_0x359805,_0x910290[_0x2baa('0x52')]);return _0x4d8c29[_0x2baa('0xc7')](_0x359805);}})[_0x2baa('0x1d')](function(_0x5ee50c){if(_0x5ee50c){_0x301ed7=_0x5ee50c[_0x2baa('0x48')];if(!_0x910290[_0x2baa('0x44')][_0x2baa('0xb2')](_0x2baa('0x49'))){_0x359805[_0x2baa('0x2a')]=qs[_0x2baa('0x2a')](_0x910290[_0x2baa('0x44')][_0x2baa('0x2a')]);_0x359805[_0x2baa('0x29')]=qs[_0x2baa('0x29')](_0x910290[_0x2baa('0x44')][_0x2baa('0x29')]);}return _0x4d8c29['getSmsInteractions'](_0x359805);}})[_0x2baa('0x1d')](function(_0x571ff9){if(_0x571ff9){return _0x571ff9?{'count':_0x301ed7,'rows':_0x571ff9}:null;}})[_0x2baa('0x1d')](respondWithResult(_0x3e54bd,null))[_0x2baa('0x5c')](handleError(_0x3e54bd,null));};exports[_0x2baa('0xc8')]=function(_0x4121cf,_0x830129,_0x28e47){var _0x3099d5={};var _0x4e74f2={};var _0x14acd2;var _0x4a7640;return db[_0x2baa('0x53')][_0x2baa('0xaf')]({'where':{'id':_0x4121cf[_0x2baa('0x61')]['id']}})[_0x2baa('0x1d')](handleEntityNotFound(_0x830129,null))[_0x2baa('0x1d')](function(_0x280d2a){if(_0x280d2a){_0x14acd2=_0x280d2a;_0x4e74f2['model']=_[_0x2baa('0x42')](db[_0x2baa('0xc9')]['rawAttributes']);_0x4e74f2[_0x2baa('0x44')]=_[_0x2baa('0x42')](_0x4121cf[_0x2baa('0x44')]);_0x4e74f2[_0x2baa('0x45')]=_[_0x2baa('0x5b')](_0x4e74f2[_0x2baa('0x41')],_0x4e74f2[_0x2baa('0x44')]);_0x3099d5[_0x2baa('0x46')]=_[_0x2baa('0x5b')](_0x4e74f2[_0x2baa('0x41')],qs['fields'](_0x4121cf[_0x2baa('0x44')][_0x2baa('0x47')]));_0x3099d5[_0x2baa('0x46')]=_0x3099d5[_0x2baa('0x46')][_0x2baa('0x48')]?_0x3099d5[_0x2baa('0x46')]:_0x4e74f2[_0x2baa('0x41')];_0x3099d5['order']=qs[_0x2baa('0x4b')](_0x4121cf[_0x2baa('0x44')][_0x2baa('0x4b')]);_0x3099d5['where']=qs['filters'](_[_0x2baa('0x4d')](_0x4121cf[_0x2baa('0x44')],_0x4e74f2['filters']));if(_0x4121cf['query'][_0x2baa('0x38')]){_0x3099d5[_0x2baa('0x4c')]=_[_0x2baa('0x4e')](_0x3099d5[_0x2baa('0x4c')],{'$or':_[_0x2baa('0x39')](_0x3099d5['attributes'],function(_0x19a2a4){var _0x9ac600={};_0x9ac600[_0x19a2a4]={'$like':'%'+_0x4121cf[_0x2baa('0x44')][_0x2baa('0x38')]+'%'};return _0x9ac600;})});}_0x3099d5=_[_0x2baa('0x4e')]({},_0x3099d5,_0x4121cf[_0x2baa('0x52')]);return _0x14acd2[_0x2baa('0xc8')](_0x3099d5);}})[_0x2baa('0x1d')](function(_0x3aa904){if(_0x3aa904){_0x4a7640=_0x3aa904[_0x2baa('0x48')];if(!_0x4121cf['query'][_0x2baa('0xb2')](_0x2baa('0x49'))){_0x3099d5[_0x2baa('0x2a')]=qs[_0x2baa('0x2a')](_0x4121cf[_0x2baa('0x44')][_0x2baa('0x2a')]);_0x3099d5[_0x2baa('0x29')]=qs['offset'](_0x4121cf[_0x2baa('0x44')][_0x2baa('0x29')]);}return _0x14acd2['getFaxInteractions'](_0x3099d5);}})[_0x2baa('0x1d')](function(_0x32f8fc){if(_0x32f8fc){return _0x32f8fc?{'count':_0x4a7640,'rows':_0x32f8fc}:null;}})['then'](respondWithResult(_0x830129,null))['catch'](handleError(_0x830129,null));};exports[_0x2baa('0xca')]=function(_0x408812,_0x3a729d,_0x5b8a8b){var _0x359c57;var _0x4a8b92;var _0xb2bfd4;return db[_0x2baa('0x53')][_0x2baa('0x3c')]({'where':{'id':_0x408812[_0x2baa('0x61')]['id'],'role':_0x2baa('0x36')},'attributes':['id',_0x2baa('0x3e'),'phone',_0x2baa('0xcb'),_0x2baa('0x3d'),_0x2baa('0x6b'),_0x2baa('0x8f')]})[_0x2baa('0x1d')](handleEntityNotFound(_0x3a729d,null))['then'](function(_0x40d463){if(_0x40d463){_0x359c57=_0x40d463;if(_0x408812['body'][_0x2baa('0x91')]){_0xb2bfd4=util['format'](_0x2baa('0xcc'),_0x359c57[_0x408812[_0x2baa('0x5e')]['interface']]);}else if(_0x408812[_0x2baa('0x5e')]['intrf']){_0xb2bfd4=util[_0x2baa('0x68')](_0x2baa('0xcd'),_0x408812[_0x2baa('0x5e')][_0x2baa('0xce')]);}else{_0xb2bfd4=util[_0x2baa('0x68')]('SIP/%s',_0x359c57[_0x2baa('0x3e')]);}socket['to'](util[_0x2baa('0x68')](_0x2baa('0xcf'),_0x359c57['name']))[_0x2baa('0xa2')](_0x2baa('0xd0'),{'ip':_0x408812['headers'][_0x2baa('0xd1')]||_0x408812[_0x2baa('0xd2')]['remoteAddress']||_0x408812[_0x2baa('0xd3')][_0x2baa('0xd4')]||_0x408812[_0x2baa('0xd2')][_0x2baa('0xd3')][_0x2baa('0xd4')]});return db['UserVoiceQueueRt'][_0x2baa('0x31')]({'where':{'membername':_0x359c57[_0x2baa('0x3e')]},'individualHooks':!![]});}})['then'](function(_0x534443){if(_0x359c57){return _0x359c57[_0x2baa('0xd5')]({'raw':!![]});}})[_0x2baa('0x1d')](function(_0x569d88){var _0x7aeefe=[];if(_0x569d88){_0x4a8b92=_0x569d88;if(_0x4a8b92[_0x2baa('0x48')]){for(var _0x2d3369=0x0;_0x2d3369<_0x4a8b92[_0x2baa('0x48')];_0x2d3369++){_0x7aeefe[_0x2baa('0x9e')]({'membername':_0x359c57[_0x2baa('0x3e')],'UserId':_0x359c57['id'],'queue_name':_0x4a8b92[_0x2d3369][_0x2baa('0x3e')],'VoiceQueueId':_0x4a8b92[_0x2d3369]['id'],'interface':_0xb2bfd4,'paused':_0x359c57['loginInPause']||![],'penalty':_0x4a8b92[_0x2d3369][_0x2baa('0xd6')]||0x0});}return BPromise[_0x2baa('0x9f')](_0x7aeefe,function(_0x48865e){return db['UserVoiceQueueRt'][_0x2baa('0xa1')](_0x48865e);});}}})['then'](function(){return db[_0x2baa('0xd7')]['findAll']({'where':{'membername':_0x359c57[_0x2baa('0x3e')],'exitAt':null}});})[_0x2baa('0x1d')](function(_0x2d0c8f){var _0xd6ebcc=[];_0x2d0c8f[_0x2baa('0xd8')](function(_0x3f6636){_0xd6ebcc[_0x2baa('0x9e')](_0x3f6636[_0x2baa('0x30')]({'exitAt':moment()['format'](_0x2baa('0xd9'))}));});return BPromise[_0x2baa('0xda')](_0xd6ebcc);})[_0x2baa('0x1d')](function(){var _0x28cbde=[];var _0x307a57=[];var _0x23475e=utils[_0x2baa('0xdb')]();var _0x43dfe4={'membername':_0x359c57['name'],'interface':_0xb2bfd4,'enterAt':moment()[_0x2baa('0x68')](_0x2baa('0xd9')),'role':_0x359c57[_0x2baa('0x3d')],'internal':_0x359c57[_0x2baa('0x6b')]};_0x23475e[_0x2baa('0xd8')](function(_0x2764af){_0x28cbde[_0x2baa('0x9e')](_[_0x2baa('0x4e')]({'channel':_0x2764af,'type':_0x2baa('0xdc'),'data1':_0x408812['body'][_0x2baa('0xdd')],'data2':_0xb2bfd4},_0x43dfe4));if(_0x359c57[_0x2baa('0x8f')]){_0x307a57[_0x2baa('0x9e')](_[_0x2baa('0x4e')]({'channel':_0x2764af,'type':_0x2baa('0xde'),'data1':_0x2baa('0xdf')},_0x43dfe4));}});return db['MemberReport'][_0x2baa('0x5d')](_0x28cbde[_0x2baa('0xe0')](_0x307a57),{'individualHooks':!![]});})[_0x2baa('0x1d')](function(){return _0x359c57['update']({'online':!![],'lastLoginAt':moment()['format'](_0x2baa('0xd9')),'voicePause':_0x359c57['loginInPause']||![],'mailPause':_0x359c57[_0x2baa('0x8f')]||![],'chatPause':_0x359c57['loginInPause']||![],'faxPause':_0x359c57[_0x2baa('0x8f')]||![],'smsPause':_0x359c57[_0x2baa('0x8f')]||![],'openchannelPause':_0x359c57[_0x2baa('0x8f')]||![],'pauseType':_0x359c57[_0x2baa('0x8f')]?'LOGININPAUSE':null,'interface':_0xb2bfd4,'lastPauseAt':moment()[_0x2baa('0x68')](_0x2baa('0xd9'))});})[_0x2baa('0x1d')](respondWithResult(_0x3a729d,null))[_0x2baa('0x5c')](handleError(_0x3a729d,null));};exports[_0x2baa('0xe1')]=function(_0x5a2ff0,_0x2aed2c,_0x6ab919){var _0x366c75;return db['User'][_0x2baa('0x3c')]({'where':{'id':_0x5a2ff0[_0x2baa('0x61')]['id'],'role':_0x2baa('0x36')},'attributes':['id',_0x2baa('0x3e'),_0x2baa('0x3d')]})[_0x2baa('0x1d')](handleEntityNotFound(_0x2aed2c,null))[_0x2baa('0x1d')](function(_0xa5d492){if(_0xa5d492){_0x366c75=_0xa5d492;return db[_0x2baa('0xa0')][_0x2baa('0x31')]({'where':{'membername':_0x366c75[_0x2baa('0x3e')]},'individualHooks':!![]});}})[_0x2baa('0x1d')](function(){return db[_0x2baa('0xd7')][_0x2baa('0x57')]({'where':{'membername':_0x366c75[_0x2baa('0x3e')],'exitAt':null}});})['then'](function(_0x5dcc34){var _0xb046d0=[];_0x5dcc34[_0x2baa('0xd8')](function(_0xe1cdd3){_0xb046d0[_0x2baa('0x9e')](_0xe1cdd3['update']({'exitAt':moment()['format'](_0x2baa('0xd9'))}));});return BPromise[_0x2baa('0xda')](_0xb046d0);})['then'](function(){return _0x366c75[_0x2baa('0x30')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})['then'](respondWithResult(_0x2aed2c,null))['catch'](handleError(_0x2aed2c,null));};exports[_0x2baa('0xe2')]=function(_0x1f04b9,_0xd6287a,_0x4a82e9){var _0x21fb5f;return db[_0x2baa('0xa0')][_0x2baa('0x30')]({'paused':0x1},{'where':{'UserId':_0x1f04b9[_0x2baa('0x61')]['id']},'individualHooks':!![]})[_0x2baa('0x1d')](function(){return db[_0x2baa('0x53')][_0x2baa('0x3c')]({'where':{'id':_0x1f04b9['params']['id'],'role':_0x2baa('0x36')},'attributes':['id',_0x2baa('0x3e'),_0x2baa('0x3d'),_0x2baa('0x6b'),_0x2baa('0x91')]});})['then'](handleEntityNotFound(_0xd6287a,null))[_0x2baa('0x1d')](function(_0x59e59a){if(_0x59e59a){_0x21fb5f=_0x59e59a;return respondWithRpcPromise(_0x2baa('0xe3'),'pause',{'id':_0x21fb5f['id'],'name':_0x21fb5f['name'],'pause':!![]});}})['then'](function(){if(_0x21fb5f){return db[_0x2baa('0xd7')][_0x2baa('0x57')]({'where':{'membername':_0x21fb5f[_0x2baa('0x3e')],'type':'PAUSE','exitAt':null}});}})[_0x2baa('0x1d')](function(_0x1f1bc4){if(_0x1f1bc4[_0x2baa('0x48')]){var _0x5855fa=moment()[_0x2baa('0x68')](_0x2baa('0xd9'));for(var _0x3cba6e=0x0,_0x3a7b0e=_0x1f1bc4[_0x2baa('0x48')];_0x3cba6e<_0x3a7b0e;_0x3cba6e++){_0x1f1bc4[_0x3cba6e][_0x2baa('0xe4')]({'exitAt':_0x5855fa});}}})[_0x2baa('0x1d')](function(){var _0x5863b9=[];var _0x551955=utils[_0x2baa('0xdb')]();_0x551955[_0x2baa('0xd8')](function(_0xe6766b){_0x5863b9[_0x2baa('0x9e')]({'channel':_0xe6766b,'membername':_0x21fb5f['name'],'interface':_['isNil'](_0x21fb5f['interface'])?util[_0x2baa('0x68')](_0x2baa('0xcd'),_0x21fb5f[_0x2baa('0x3e')]):_0x21fb5f[_0x2baa('0x91')],'type':'PAUSE','enterAt':moment()[_0x2baa('0x68')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x1f04b9[_0x2baa('0x5e')][_0x2baa('0xe5')]||_0x2baa('0xe6'),'role':_0x21fb5f[_0x2baa('0x3d')],'internal':_0x21fb5f['internal']});});return db[_0x2baa('0xd7')]['bulkCreate'](_0x5863b9,{'individualHooks':!![]});})[_0x2baa('0x1d')](function(){return _0x21fb5f['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x1f04b9[_0x2baa('0x5e')][_0x2baa('0xe5')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x2baa('0x68')](_0x2baa('0xd9'))});})[_0x2baa('0x1d')](respondWithResult(_0xd6287a,null))['catch'](handleError(_0xd6287a,null));};exports['unpause']=function(_0x32c5b9,_0x527b3c,_0x5afa4d){var _0x57e426;return db[_0x2baa('0x53')][_0x2baa('0x3c')]({'where':{'id':_0x32c5b9[_0x2baa('0x61')]['id']},'attributes':['id','name',_0x2baa('0x3d'),_0x2baa('0x90'),_0x2baa('0xe7'),_0x2baa('0xe8'),'faxPause',_0x2baa('0xe9'),_0x2baa('0xea'),'pauseType','lastPauseAt']})[_0x2baa('0x1d')](handleEntityNotFound(_0x527b3c,null))[_0x2baa('0x1d')](function(_0x2d1fbf){if(_0x2d1fbf){_0x57e426=_0x2d1fbf;if(_0x32c5b9[_0x2baa('0x5e')][_0x2baa('0x93')]&&!utils[_0x2baa('0x92')](_0x32c5b9['body'][_0x2baa('0x93')])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}switch(_0x32c5b9[_0x2baa('0x5e')]['channel']){case'voice':return respondWithRpcPromise(_0x2baa('0xe3'),_0x2baa('0xeb'),{'id':_0x57e426['id'],'name':_0x57e426[_0x2baa('0x3e')],'pause':![]})['then'](function(){return db[_0x2baa('0xa0')][_0x2baa('0x30')]({'paused':0x0},{'where':{'UserId':_0x57e426['id']},'individualHooks':!![]});})[_0x2baa('0x1d')](function(){return db[_0x2baa('0xd7')]['find']({'where':{'channel':_0x32c5b9[_0x2baa('0x5e')][_0x2baa('0x93')],'membername':_0x57e426[_0x2baa('0x3e')],'type':_0x2baa('0xde'),'exitAt':null}});})[_0x2baa('0x1d')](function(_0x582fd1){if(_0x582fd1){return _0x582fd1[_0x2baa('0x30')]({'exitAt':moment()[_0x2baa('0x68')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x2baa('0xec')},{'individualHooks':!![]});}return null;})[_0x2baa('0x1d')](function(){return _0x57e426[_0x2baa('0x30')]({'voicePause':![]});});case _0x2baa('0xed'):case _0x2baa('0xee'):case _0x2baa('0xef'):case _0x2baa('0xf0'):case _0x2baa('0xf1'):return db[_0x2baa('0xd7')]['find']({'where':{'channel':_0x32c5b9['body'][_0x2baa('0x93')],'membername':_0x57e426[_0x2baa('0x3e')],'type':_0x2baa('0xde'),'exitAt':null}})['then'](function(_0x5ec8cd){if(_0x5ec8cd){return _0x5ec8cd['update']({'exitAt':moment()[_0x2baa('0x68')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x2baa('0x1d')](function(){var _0x1dfd37={};_[_0x2baa('0x2b')](_0x1dfd37,util[_0x2baa('0x68')]('%s%s',_0x32c5b9[_0x2baa('0x5e')]['channel'],_0x2baa('0xf2')),![]);return _0x57e426[_0x2baa('0x30')](_0x1dfd37);});default:return respondWithRpcPromise(_0x2baa('0xe3'),'unpause',{'id':_0x57e426['id'],'name':_0x57e426['name'],'pause':![]})['then'](function(){return db[_0x2baa('0xa0')][_0x2baa('0x30')]({'paused':0x0},{'where':{'UserId':_0x57e426['id']}});})[_0x2baa('0x1d')](function(){return db[_0x2baa('0xd7')][_0x2baa('0x57')]({'where':{'membername':_0x57e426[_0x2baa('0x3e')],'type':_0x2baa('0xde'),'exitAt':null}});})[_0x2baa('0x1d')](function(_0x226298){var _0x2d4a96=[];_0x226298[_0x2baa('0xd8')](function(_0x1f7f89){_0x2d4a96['push'](_0x1f7f89['update']({'exitAt':moment()[_0x2baa('0x68')](_0x2baa('0xd9')),'data2':_0x2baa('0xec')}));});return BPromise[_0x2baa('0xda')](_0x2d4a96);})[_0x2baa('0x1d')](function(){return _0x57e426[_0x2baa('0x30')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x527b3c,null))[_0x2baa('0x5c')](handleError(_0x527b3c,null));};exports['getTeams']=function(_0x345f65,_0xd0ef60,_0x5817d8){var _0x5620a0={};var _0x5b1734={};var _0x2239a0;var _0xcb50d1;return db[_0x2baa('0x53')]['findOne']({'where':{'id':_0x345f65['params']['id']}})[_0x2baa('0x1d')](handleEntityNotFound(_0xd0ef60,null))[_0x2baa('0x1d')](function(_0x473a0e){if(_0x473a0e){_0x2239a0=_0x473a0e;_0x5b1734['model']=_['keys'](db[_0x2baa('0xf3')]['rawAttributes']);_0x5b1734[_0x2baa('0x44')]=_[_0x2baa('0x42')](_0x345f65[_0x2baa('0x44')]);_0x5b1734[_0x2baa('0x45')]=_[_0x2baa('0x5b')](_0x5b1734[_0x2baa('0x41')],_0x5b1734[_0x2baa('0x44')]);_0x5620a0[_0x2baa('0x46')]=_[_0x2baa('0x5b')](_0x5b1734[_0x2baa('0x41')],qs['fields'](_0x345f65[_0x2baa('0x44')][_0x2baa('0x47')]));_0x5620a0[_0x2baa('0x46')]=_0x5620a0[_0x2baa('0x46')][_0x2baa('0x48')]?_0x5620a0[_0x2baa('0x46')]:_0x5b1734[_0x2baa('0x41')];_0x5620a0[_0x2baa('0x4a')]=qs[_0x2baa('0x4b')](_0x345f65[_0x2baa('0x44')][_0x2baa('0x4b')]);_0x5620a0[_0x2baa('0x4c')]=qs['filters'](_[_0x2baa('0x4d')](_0x345f65[_0x2baa('0x44')],_0x5b1734['filters']));if(_0x345f65[_0x2baa('0x44')][_0x2baa('0x38')]){_0x5620a0[_0x2baa('0x4c')]=_['merge'](_0x5620a0['where'],{'$or':_[_0x2baa('0x39')](_0x5620a0[_0x2baa('0x46')],function(_0x572803){var _0x54abf8={};_0x54abf8[_0x572803]={'$like':'%'+_0x345f65[_0x2baa('0x44')]['filter']+'%'};return _0x54abf8;})});}_0x5620a0=_[_0x2baa('0x4e')]({},_0x5620a0,_0x345f65['options']);return _0x2239a0[_0x2baa('0xf4')](_0x5620a0);}})[_0x2baa('0x1d')](function(_0x42368c){if(_0x42368c){_0xcb50d1=_0x42368c[_0x2baa('0x48')];if(!_0x345f65[_0x2baa('0x44')][_0x2baa('0xb2')](_0x2baa('0x49'))){_0x5620a0[_0x2baa('0x2a')]=qs['limit'](_0x345f65['query'][_0x2baa('0x2a')]);_0x5620a0[_0x2baa('0x29')]=qs[_0x2baa('0x29')](_0x345f65[_0x2baa('0x44')]['offset']);}return _0x2239a0[_0x2baa('0xf4')](_0x5620a0);}})[_0x2baa('0x1d')](function(_0x49ea7b){if(_0x49ea7b){return _0x49ea7b?{'count':_0xcb50d1,'rows':_0x49ea7b}:null;}})[_0x2baa('0x1d')](respondWithResult(_0xd0ef60,null))['catch'](handleError(_0xd0ef60,null));};exports[_0x2baa('0xf5')]=function(_0x1d50ae,_0x1e6492,_0x327de0){return db[_0x2baa('0x53')][_0x2baa('0x3c')]({'where':{'id':_0x1d50ae[_0x2baa('0x61')]['id']}})['then'](handleEntityNotFound(_0x1e6492,null))[_0x2baa('0x1d')](function(_0x7aef2a){if(_0x7aef2a){return _0x7aef2a['addTeams'](_0x1d50ae[_0x2baa('0x5e')][_0x2baa('0x62')],_['omit'](_0x1d50ae[_0x2baa('0x5e')],[_0x2baa('0x62'),'id'])||{});}})[_0x2baa('0x1d')](respondWithResult(_0x1e6492,null))['catch'](handleError(_0x1e6492,null));};exports[_0x2baa('0xf6')]=function(_0x1760e0,_0x2b490c,_0xa9ccd6){var _0x26092f;return db[_0x2baa('0x53')][_0x2baa('0x3c')]({'where':{'id':_0x1760e0['params']['id']}})[_0x2baa('0x1d')](handleEntityNotFound(_0x2b490c,null))[_0x2baa('0x1d')](function(_0x37d6aa){if(_0x37d6aa){return _0x37d6aa[_0x2baa('0xf6')](_0x1760e0[_0x2baa('0x44')][_0x2baa('0x62')]);}})[_0x2baa('0x1d')](respondWithStatusCode(_0x2b490c,null))['catch'](handleError(_0x2b490c,null));};exports[_0x2baa('0xf7')]=function(_0x10b618,_0xe29a8d,_0xe7d917){var _0x2bda68={};var _0x4dd5b6={};var _0x129301;var _0x3fe8ac;return db[_0x2baa('0x53')]['findOne']({'where':{'id':_0x10b618[_0x2baa('0x61')]['id']}})[_0x2baa('0x1d')](handleEntityNotFound(_0xe29a8d,null))['then'](function(_0xb8b9d3){if(_0xb8b9d3){_0x129301=_0xb8b9d3;_0x4dd5b6[_0x2baa('0x41')]=_[_0x2baa('0x42')](db[_0x2baa('0xb3')]['rawAttributes']);_0x4dd5b6[_0x2baa('0x44')]=_['keys'](_0x10b618[_0x2baa('0x44')]);_0x4dd5b6[_0x2baa('0x45')]=_['intersection'](_0x4dd5b6[_0x2baa('0x41')],_0x4dd5b6[_0x2baa('0x44')]);_0x2bda68['attributes']=_[_0x2baa('0x5b')](_0x4dd5b6[_0x2baa('0x41')],qs[_0x2baa('0x47')](_0x10b618[_0x2baa('0x44')]['fields']));_0x2bda68[_0x2baa('0x46')]=_0x2bda68[_0x2baa('0x46')][_0x2baa('0x48')]?_0x2bda68[_0x2baa('0x46')]:_0x4dd5b6['model'];_0x2bda68['order']=qs[_0x2baa('0x4b')](_0x10b618[_0x2baa('0x44')][_0x2baa('0x4b')]);_0x2bda68[_0x2baa('0x4c')]=qs[_0x2baa('0x45')](_[_0x2baa('0x4d')](_0x10b618[_0x2baa('0x44')],_0x4dd5b6[_0x2baa('0x45')]));if(_0x10b618[_0x2baa('0x44')]['filter']){_0x2bda68[_0x2baa('0x4c')]=_['merge'](_0x2bda68[_0x2baa('0x4c')],{'$or':_[_0x2baa('0x39')](_0x2bda68['attributes'],function(_0x5da017){var _0x1361ca={};_0x1361ca[_0x5da017]={'$like':'%'+_0x10b618[_0x2baa('0x44')][_0x2baa('0x38')]+'%'};return _0x1361ca;})});}_0x2bda68=_[_0x2baa('0x4e')]({},_0x2bda68,_0x10b618[_0x2baa('0x52')]);return _0x129301[_0x2baa('0xf7')](_0x2bda68);}})['then'](function(_0x126d1a){if(_0x126d1a){_0x3fe8ac=_0x126d1a[_0x2baa('0x48')];if(!_0x10b618['query'][_0x2baa('0xb2')](_0x2baa('0x49'))){_0x2bda68[_0x2baa('0x2a')]=qs[_0x2baa('0x2a')](_0x10b618[_0x2baa('0x44')]['limit']);_0x2bda68[_0x2baa('0x29')]=qs[_0x2baa('0x29')](_0x10b618[_0x2baa('0x44')]['offset']);}return _0x129301[_0x2baa('0xf7')](_0x2bda68);}})[_0x2baa('0x1d')](function(_0x2dfff2){if(_0x2dfff2){return _0x2dfff2?{'count':_0x3fe8ac,'rows':_0x2dfff2}:null;}})['then'](respondWithResult(_0xe29a8d,null))[_0x2baa('0x5c')](handleError(_0xe29a8d,null));};exports[_0x2baa('0xf8')]=function(_0x16e88e,_0x225f7a,_0x34afa9){var _0x4d5906={};var _0x41f37c={};var _0x5d012c;var _0xe408e1;return db[_0x2baa('0x53')][_0x2baa('0xaf')]({'where':{'id':_0x16e88e['params']['id']}})[_0x2baa('0x1d')](handleEntityNotFound(_0x225f7a,null))[_0x2baa('0x1d')](function(_0x13ab26){if(_0x13ab26){_0x5d012c=_0x13ab26;_0x41f37c[_0x2baa('0x41')]=_[_0x2baa('0x42')](db[_0x2baa('0x53')][_0x2baa('0x59')]);_0x41f37c[_0x2baa('0x44')]=_[_0x2baa('0x42')](_0x16e88e[_0x2baa('0x44')]);_0x41f37c[_0x2baa('0x45')]=_[_0x2baa('0x5b')](_0x41f37c[_0x2baa('0x41')],_0x41f37c[_0x2baa('0x44')]);_0x4d5906[_0x2baa('0x46')]=_['intersection'](_0x41f37c[_0x2baa('0x41')],qs[_0x2baa('0x47')](_0x16e88e[_0x2baa('0x44')]['fields']));_0x4d5906[_0x2baa('0x46')]=_0x4d5906['attributes'][_0x2baa('0x48')]?_0x4d5906[_0x2baa('0x46')]:_0x41f37c[_0x2baa('0x41')];_0x4d5906[_0x2baa('0x4a')]=qs[_0x2baa('0x4b')](_0x16e88e[_0x2baa('0x44')][_0x2baa('0x4b')]);_0x4d5906[_0x2baa('0x4c')]=qs[_0x2baa('0x45')](_[_0x2baa('0x4d')](_0x16e88e['query'],_0x41f37c[_0x2baa('0x45')]));if(_0x16e88e[_0x2baa('0x44')][_0x2baa('0x38')]){_0x4d5906[_0x2baa('0x4c')]=_[_0x2baa('0x4e')](_0x4d5906[_0x2baa('0x4c')],{'$or':_[_0x2baa('0x39')](_0x4d5906[_0x2baa('0x46')],function(_0x2651a2){var _0x570380={};_0x570380[_0x2651a2]={'$like':'%'+_0x16e88e[_0x2baa('0x44')][_0x2baa('0x38')]+'%'};return _0x570380;})});}_0x4d5906[_0x2baa('0x41')]=db[_0x2baa('0x53')];_0x4d5906['as']=_0x2baa('0x35');_0x4d5906=_[_0x2baa('0x4e')]({},_0x4d5906,_0x16e88e['options']);return _0x5d012c[_0x2baa('0xd5')]({'include':[_0x4d5906]});}})[_0x2baa('0x1d')](function(_0x1dea13){if(_0x1dea13){var _0x3f1e62={},_0x5be6e7=[],_0x49124e=0x0;for(var _0x178570=0x0;_0x178570<_0x1dea13[_0x2baa('0x48')];_0x178570+=0x1){for(var _0x1030d3=0x0,_0x4d761e;_0x1030d3<_0x1dea13[_0x178570][_0x2baa('0x35')][_0x2baa('0x48')];_0x1030d3+=0x1){_0x4d761e=_0x1dea13[_0x178570][_0x2baa('0x35')][_0x1030d3][_0x2baa('0x32')]({'plain':!![]});_0x3f1e62[_0x4d761e['id']]=_0x4d761e;}}_0x3f1e62=_[_0x2baa('0xf9')](_0x3f1e62);for(var _0x15b318=qs[_0x2baa('0x29')](_0x16e88e[_0x2baa('0x44')][_0x2baa('0x29')]);_0x15b318<_0x3f1e62[_0x2baa('0x48')]&&_0x5be6e7[_0x2baa('0x48')]=_0x24f75[_0x0d8b('0x4e')]){throw new Error(_0x0d8b('0x4f'));}})[_0x0d8b('0xd')](function(){if(_0x156859){return db[_0x0d8b('0x2b')]['destroy']({'where':{'membername':_0x156859[_0x0d8b('0x27')]},'individualHooks':!![]});}})[_0x0d8b('0xd')](function(){if(_0x156859){return _0x156859['getVoiceQueues']({'raw':!![]});}})[_0x0d8b('0xd')](function(_0x105df9){if(_0x156859){if(_0x105df9){var _0x303d6=[];_0x40d265=_0x105df9;if(_0x40d265[_0x0d8b('0x2d')]){for(var _0x16141a=0x0;_0x16141a<_0x40d265[_0x0d8b('0x2d')];_0x16141a++){_0x303d6[_0x0d8b('0x2f')](db[_0x0d8b('0x2b')][_0x0d8b('0x50')]({'membername':_0x156859[_0x0d8b('0x27')],'UserId':_0x156859['id'],'queue_name':_0x40d265[_0x16141a][_0x0d8b('0x27')],'VoiceQueueId':_0x40d265[_0x16141a]['id'],'interface':_0x1ca60c,'paused':_0x156859[_0x0d8b('0x4a')]||![],'penalty':_0x40d265[_0x16141a]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x0d8b('0x47')](_0x303d6);}}}})[_0x0d8b('0xd')](function(){if(_0x156859){return db[_0x0d8b('0x35')]['findAll']({'where':{'membername':_0x156859['name'],'exitAt':null}});}})[_0x0d8b('0xd')](function(_0x3aeb45){if(_0x156859){if(_0x3aeb45&&_0x3aeb45[_0x0d8b('0x2d')]){var _0x5b76af=[];_0x3aeb45['forEach'](function(_0x42de18){_0x5b76af[_0x0d8b('0x2f')](_0x42de18[_0x0d8b('0x2c')]({'exitAt':moment()[_0x0d8b('0x30')](_0x0d8b('0x31'))}));});return BPromise[_0x0d8b('0x47')](_0x5b76af);}}})[_0x0d8b('0xd')](function(_0x2c826b){if(_0x156859){var _0x20a3dd=[];var _0x3a5aea=[];var _0x195901=utils[_0x0d8b('0x51')]();var _0x3b060e={'membername':_0x156859['name'],'interface':_0x1ca60c,'enterAt':moment()[_0x0d8b('0x30')](_0x0d8b('0x31')),'role':_0x156859['role'],'internal':_0x156859['internal']};_0x195901[_0x0d8b('0x2e')](function(_0x1dad9f){_0x20a3dd[_0x0d8b('0x2f')](_[_0x0d8b('0x52')]({'channel':_0x1dad9f,'type':_0x0d8b('0x53'),'data1':_0x0d8b('0x54'),'data2':_0x1ca60c},_0x3b060e));if(_0x156859['loginInPause']){_0x3a5aea['push'](_['merge']({'channel':_0x1dad9f,'type':_0x0d8b('0x44'),'data1':_0x0d8b('0x55')},_0x3b060e));}});return db[_0x0d8b('0x35')][_0x0d8b('0x36')](_0x20a3dd[_0x0d8b('0x56')](_0x3a5aea),{'individualHooks':!![]});}})[_0x0d8b('0xd')](function(){if(_0x156859){return _0x156859['update']({'online':!![],'lastLoginAt':moment()[_0x0d8b('0x30')](_0x0d8b('0x31')),'voicePause':_0x156859['loginInPause']||![],'mailPause':_0x156859[_0x0d8b('0x4a')]||![],'chatPause':_0x156859['loginInPause']||![],'faxPause':_0x156859[_0x0d8b('0x4a')]||![],'smsPause':_0x156859[_0x0d8b('0x4a')]||![],'openchannelPause':_0x156859[_0x0d8b('0x4a')]||![],'pauseType':_0x156859[_0x0d8b('0x4a')]?_0x0d8b('0x55'):null,'lastPauseAt':moment()[_0x0d8b('0x30')](_0x0d8b('0x31')),'interface':_0x1ca60c});}})[_0x0d8b('0xd')](function(_0x391121){_0x435090(_0x391121);})[_0x0d8b('0x18')](function(_0x276558){_0x2ab72b(_0x70e4b2[_0x0d8b('0x14')](0x1f4,_0x276558['message']));});});}; \ No newline at end of file +var _0xb10b=['destroy','length','LoginUser','loginInPause','count','agent','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./user.socket','register','request','then','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','User,\x20%s,\x20%s','message','result','catch','GetUser','User','options','where','attributes','limit','include','map','model','ShowUser','find','raw','PauseUser','name','role','interface','UserVoiceQueueRt','MemberReport','findAll','format','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','PAUSE','YYYY-MM-DD\x20HH:mm:ss','body','DEFAULT\x20PAUSE','internal','uniqueid','bulkCreate','type','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','update','system','chat','fax','sms','openchannel','set','Pause','all','LogoutUser'];(function(_0x3915f4,_0x258f57){var _0x36c12d=function(_0x1801fc){while(--_0x1801fc){_0x3915f4['push'](_0x3915f4['shift']());}};_0x36c12d(++_0x258f57);}(_0xb10b,0x12a));var _0xbb10=function(_0x166e96,_0x55191d){_0x166e96=_0x166e96-0x0;var _0x553d73=_0xb10b[_0x166e96];return _0x553d73;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('User,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('User,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['findAll']({'raw':_0x19f48d[_0xbb10('0x1f')]?_0x19f48d[_0xbb10('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x19f48d['options']?_0x19f48d[_0xbb10('0x1f')][_0xbb10('0x20')]||null:null,'attributes':_0x19f48d[_0xbb10('0x1f')]?_0x19f48d[_0xbb10('0x1f')][_0xbb10('0x21')]||null:null,'limit':_0x19f48d[_0xbb10('0x1f')]?_0x19f48d[_0xbb10('0x1f')][_0xbb10('0x22')]||null:null,'include':_0x19f48d[_0xbb10('0x1f')]?_0x19f48d[_0xbb10('0x1f')][_0xbb10('0x23')]?_[_0xbb10('0x24')](_0x19f48d['options']['include'],function(_0x4fb5e0){return{'model':db[_0x4fb5e0[_0xbb10('0x25')]],'as':_0x4fb5e0['as'],'attributes':_0x4fb5e0[_0xbb10('0x21')],'include':_0x4fb5e0[_0xbb10('0x23')]?_['map'](_0x4fb5e0[_0xbb10('0x23')],function(_0x24d586){return{'model':db[_0x24d586[_0xbb10('0x25')]],'as':_0x24d586['as'],'attributes':_0x24d586[_0xbb10('0x21')],'include':_0x24d586[_0xbb10('0x23')]?_[_0xbb10('0x24')](_0x24d586[_0xbb10('0x23')],function(_0x4aabb9){return{'model':db[_0x4aabb9[_0xbb10('0x25')]],'as':_0x4aabb9['as'],'attributes':_0x4aabb9[_0xbb10('0x21')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0x11')](function(_0x2e0249){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger['debug'](_0xbb10('0x1d'),_0x19f48d,JSON['stringify'](_0x2e0249));_0x109908(_0x2e0249);})[_0xbb10('0x1c')](function(_0x56f2da){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x56f2da[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x56f2da['message']));});});};exports[_0xbb10('0x26')]=function(_0x34f65e){var _0x4f590d=this;return new Promise(function(_0x359ad4,_0x37dde7){return db[_0xbb10('0x1e')][_0xbb10('0x27')]({'raw':_0x34f65e[_0xbb10('0x1f')]?_0x34f65e[_0xbb10('0x1f')][_0xbb10('0x28')]===undefined?!![]:![]:!![],'where':_0x34f65e['options']?_0x34f65e[_0xbb10('0x1f')][_0xbb10('0x20')]||null:null,'attributes':_0x34f65e[_0xbb10('0x1f')]?_0x34f65e[_0xbb10('0x1f')][_0xbb10('0x21')]||null:null,'include':_0x34f65e[_0xbb10('0x1f')]?_0x34f65e[_0xbb10('0x1f')][_0xbb10('0x23')]?_[_0xbb10('0x24')](_0x34f65e['options'][_0xbb10('0x23')],function(_0x150107){return{'model':db[_0x150107[_0xbb10('0x25')]],'as':_0x150107['as'],'attributes':_0x150107[_0xbb10('0x21')],'include':_0x150107['include']?_[_0xbb10('0x24')](_0x150107['include'],function(_0x4e2754){return{'model':db[_0x4e2754[_0xbb10('0x25')]],'as':_0x4e2754['as'],'attributes':_0x4e2754[_0xbb10('0x21')],'include':_0x4e2754[_0xbb10('0x23')]?_[_0xbb10('0x24')](_0x4e2754[_0xbb10('0x23')],function(_0x29d11a){return{'model':db[_0x29d11a['model']],'as':_0x29d11a['as'],'attributes':_0x29d11a[_0xbb10('0x21')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0x11')](function(_0x52de31){logger['info']('ShowUser',_0x34f65e);logger[_0xbb10('0x14')](_0xbb10('0x26'),_0x34f65e,JSON[_0xbb10('0x16')](_0x52de31));_0x359ad4(_0x52de31);})['catch'](function(_0x3c0cd7){logger[_0xbb10('0x17')](_0xbb10('0x26'),_0x3c0cd7['message'],_0x34f65e);_0x37dde7(_0x4f590d[_0xbb10('0x17')](0x1f4,_0x3c0cd7[_0xbb10('0x1a')]));});});};exports[_0xbb10('0x29')]=function(_0x446f49){var _0x4f1cdd=this;return new Promise(function(_0xd238e9,_0x110eb5){var _0x5835fd;return db[_0xbb10('0x1e')][_0xbb10('0x27')]({'where':_0x446f49[_0xbb10('0x1f')][_0xbb10('0x20')]||{},'attributes':['id',_0xbb10('0x2a'),_0xbb10('0x2b'),'internal',_0xbb10('0x2c')]})[_0xbb10('0x11')](function(_0x3e7b4c){if(_0x3e7b4c){_0x5835fd=_0x3e7b4c;return db[_0xbb10('0x2d')]['update']({'paused':0x1},{'where':{'UserId':_0x5835fd['id']},'individualHooks':!![]});}})[_0xbb10('0x11')](function(){if(_0x5835fd){return db[_0xbb10('0x2e')][_0xbb10('0x2f')]({'where':{'membername':_0x5835fd[_0xbb10('0x2a')],'type':'PAUSE','exitAt':null}});}})[_0xbb10('0x11')](function(_0x202c60){if(_0x5835fd){if(_0x202c60&&_0x202c60['length']){var _0x5d9a4f=moment()[_0xbb10('0x30')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x318984=0x0,_0x180933=_0x202c60['length'];_0x318984<_0x180933;_0x318984++){_0x202c60[_0x318984][_0xbb10('0x31')]({'exitAt':_0x5d9a4f});}}}})[_0xbb10('0x11')](function(){if(_0x5835fd){var _0x474e99=[];var _0x5cf4f8=utils[_0xbb10('0x32')]();_0x5cf4f8[_0xbb10('0x33')](function(_0x3b9fdf){_0x474e99[_0xbb10('0x34')]({'channel':_0x3b9fdf,'membername':_0x5835fd[_0xbb10('0x2a')],'interface':_[_0xbb10('0x35')](_0x5835fd[_0xbb10('0x2c')])?util[_0xbb10('0x30')](_0xbb10('0x36'),_0x5835fd[_0xbb10('0x2a')]):_0x5835fd[_0xbb10('0x2c')],'type':_0xbb10('0x37'),'enterAt':moment()['format'](_0xbb10('0x38')),'data1':_0x446f49[_0xbb10('0x39')]['type']||_0xbb10('0x3a'),'role':_0x5835fd[_0xbb10('0x2b')],'internal':_0x5835fd[_0xbb10('0x3b')],'uniqueid':_0x446f49[_0xbb10('0x39')][_0xbb10('0x3c')]||null});});return db[_0xbb10('0x2e')][_0xbb10('0x3d')](_0x474e99,{'individualHooks':!![]});}})['then'](function(){if(_0x5835fd){return _0x5835fd['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x446f49[_0xbb10('0x39')][_0xbb10('0x3e')]||_0xbb10('0x3a'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xbb10('0x11')](function(_0x34cf4e){_0xd238e9(_0x34cf4e);})[_0xbb10('0x1c')](function(_0xf820fe){_0x110eb5(_0x4f1cdd[_0xbb10('0x17')](0x1f4,_0xf820fe[_0xbb10('0x1a')]));});});};exports[_0xbb10('0x3f')]=function(_0x460788){var _0x2626d8=this;return new Promise(function(_0x3d7e7e,_0x550111){var _0x5eafac;return db[_0xbb10('0x1e')][_0xbb10('0x40')]({'where':_0x460788[_0xbb10('0x1f')][_0xbb10('0x20')]||{},'attributes':['id',_0xbb10('0x2a')]})[_0xbb10('0x11')](function(_0x358e7e){if(_0x358e7e){_0x5eafac=_0x358e7e;if(_0x460788[_0xbb10('0x39')][_0xbb10('0x41')]&&!utils[_0xbb10('0x42')](_0x460788[_0xbb10('0x39')][_0xbb10('0x41')])){throw new Error(_0xbb10('0x43'));}switch(_0x460788[_0xbb10('0x39')][_0xbb10('0x41')]){case'voice':return db[_0xbb10('0x2d')]['update']({'paused':0x0},{'where':{'UserId':_0x5eafac['id']}})[_0xbb10('0x11')](function(){return db[_0xbb10('0x2e')][_0xbb10('0x27')]({'where':{'channel':_0x460788[_0xbb10('0x39')][_0xbb10('0x41')],'membername':_0x5eafac[_0xbb10('0x2a')],'type':_0xbb10('0x37'),'exitAt':null}});})[_0xbb10('0x11')](function(_0x180400){if(_0x180400){return _0x180400[_0xbb10('0x44')]({'exitAt':moment()[_0xbb10('0x30')](_0xbb10('0x38')),'data2':_0xbb10('0x45')},{'individualHooks':!![]});}return null;})[_0xbb10('0x11')](function(){return _0x5eafac[_0xbb10('0x44')]({'voicePause':![]});});case'mail':case _0xbb10('0x46'):case _0xbb10('0x47'):case _0xbb10('0x48'):case _0xbb10('0x49'):return db[_0xbb10('0x2e')][_0xbb10('0x27')]({'where':{'channel':_0x460788['body'][_0xbb10('0x41')],'membername':_0x5eafac[_0xbb10('0x2a')],'type':_0xbb10('0x37'),'exitAt':null}})[_0xbb10('0x11')](function(_0x432728){return _0x432728[_0xbb10('0x44')]({'exitAt':moment()[_0xbb10('0x30')](_0xbb10('0x38')),'data2':_0xbb10('0x45')},{'individualHooks':!![]});})[_0xbb10('0x11')](function(){var _0x2eb05a={};_[_0xbb10('0x4a')](_0x2eb05a,util[_0xbb10('0x30')]('%s%s',_0x460788['body'][_0xbb10('0x41')],_0xbb10('0x4b')),![]);return _0x5eafac[_0xbb10('0x44')](_0x2eb05a);});default:return db[_0xbb10('0x2d')]['update']({'paused':0x0},{'where':{'UserId':_0x5eafac['id']}})['then'](function(){return db[_0xbb10('0x2e')][_0xbb10('0x2f')]({'where':{'membername':_0x5eafac[_0xbb10('0x2a')],'type':_0xbb10('0x37'),'exitAt':null}});})[_0xbb10('0x11')](function(_0x3e9753){var _0x45c0dc=[];_0x3e9753['forEach'](function(_0x117e84){_0x45c0dc[_0xbb10('0x34')](_0x117e84['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xbb10('0x45')}));});return BPromise[_0xbb10('0x4c')](_0x45c0dc);})[_0xbb10('0x11')](function(){return _0x5eafac['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})['then'](function(_0x5846d1){_0x3d7e7e(_0x5846d1);})[_0xbb10('0x1c')](function(_0x249b33){_0x550111(_0x2626d8[_0xbb10('0x17')](0x1f4,_0x249b33['message']));});});};exports[_0xbb10('0x4d')]=function(_0x13131c){var _0x5a6538=this;return new Promise(function(_0x4a560c,_0x27d7b9){var _0x308896;return db[_0xbb10('0x1e')][_0xbb10('0x40')]({'where':_0x13131c['options'][_0xbb10('0x20')]||{},'attributes':['id',_0xbb10('0x2a')]})[_0xbb10('0x11')](function(_0x5202d7){if(_0x5202d7){_0x308896=_0x5202d7;return db[_0xbb10('0x2d')][_0xbb10('0x4e')]({'where':{'membername':_0x308896[_0xbb10('0x2a')]},'individualHooks':!![]});}})['then'](function(){if(_0x308896){return db[_0xbb10('0x2e')][_0xbb10('0x2f')]({'where':{'membername':_0x308896[_0xbb10('0x2a')],'exitAt':null}});}})[_0xbb10('0x11')](function(_0x5e4a6e){if(_0x308896){if(_0x5e4a6e&&_0x5e4a6e[_0xbb10('0x4f')]){var _0x258e55=[];_0x5e4a6e[_0xbb10('0x33')](function(_0x2d0f4b){_0x258e55['push'](_0x2d0f4b[_0xbb10('0x44')]({'exitAt':moment()[_0xbb10('0x30')](_0xbb10('0x38'))}));});return BPromise[_0xbb10('0x4c')](_0x258e55);}}})[_0xbb10('0x11')](function(){if(_0x308896){return _0x308896[_0xbb10('0x44')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xbb10('0x11')](function(_0x4a30c5){_0x4a560c(_0x4a30c5);})['catch'](function(_0x5acd5e){_0x27d7b9(_0x5a6538[_0xbb10('0x17')](0x1f4,_0x5acd5e[_0xbb10('0x1a')]));});});};exports[_0xbb10('0x50')]=function(_0x5c9afc){var _0x5cd089=this;return new Promise(function(_0x46f462,_0x1b11c0){var _0xd9e743;var _0x3a9677;var _0x260e06;var _0x1ad2ed;return db['User'][_0xbb10('0x40')]({'where':_0x5c9afc[_0xbb10('0x1f')][_0xbb10('0x20')]||{},'attributes':['id',_0xbb10('0x2a'),_0xbb10('0x2b'),'mobile','phone','internal',_0xbb10('0x51'),_0xbb10('0x2c')]})[_0xbb10('0x11')](function(_0x21459e){if(_0x21459e){_0xd9e743=_0x21459e;_0x1ad2ed=_0x5c9afc[_0xbb10('0x39')][_0xbb10('0x2c')]?_0x5c9afc['body'][_0xbb10('0x2c')]:util['format']('SIP/%s',_0xd9e743['name']);return db[_0xbb10('0x1e')][_0xbb10('0x52')]({'where':{'role':_0xbb10('0x53'),'online':!![],'id':{'$ne':_0xd9e743['id']}}});}})[_0xbb10('0x11')](function(_0x5ce94f){if(_0x5ce94f){_0x260e06=_0x5ce94f;return require(_0xbb10('0x54'))['getLicense']();}})['then'](function(_0x165fe9){if(_0x165fe9&&_0x165fe9[_0xbb10('0x55')]&&_0x260e06>=_0x165fe9[_0xbb10('0x55')]){throw new Error(_0xbb10('0x56'));}})[_0xbb10('0x11')](function(){if(_0xd9e743){return db['UserVoiceQueueRt'][_0xbb10('0x4e')]({'where':{'membername':_0xd9e743[_0xbb10('0x2a')]},'individualHooks':!![]});}})[_0xbb10('0x11')](function(){if(_0xd9e743){return _0xd9e743[_0xbb10('0x57')]({'raw':!![]});}})[_0xbb10('0x11')](function(_0x27f42f){if(_0xd9e743){if(_0x27f42f){var _0x174395=[];_0x3a9677=_0x27f42f;if(_0x3a9677['length']){for(var _0x387b10=0x0;_0x387b10<_0x3a9677[_0xbb10('0x4f')];_0x387b10++){_0x174395[_0xbb10('0x34')](db[_0xbb10('0x2d')][_0xbb10('0x58')]({'membername':_0xd9e743[_0xbb10('0x2a')],'UserId':_0xd9e743['id'],'queue_name':_0x3a9677[_0x387b10][_0xbb10('0x2a')],'VoiceQueueId':_0x3a9677[_0x387b10]['id'],'interface':_0x1ad2ed,'paused':_0xd9e743[_0xbb10('0x51')]||![],'penalty':_0x3a9677[_0x387b10]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xbb10('0x4c')](_0x174395);}}}})[_0xbb10('0x11')](function(){if(_0xd9e743){return db[_0xbb10('0x2e')]['findAll']({'where':{'membername':_0xd9e743['name'],'exitAt':null}});}})['then'](function(_0x23286d){if(_0xd9e743){if(_0x23286d&&_0x23286d['length']){var _0x4e3d6a=[];_0x23286d[_0xbb10('0x33')](function(_0x3ee56b){_0x4e3d6a[_0xbb10('0x34')](_0x3ee56b[_0xbb10('0x44')]({'exitAt':moment()[_0xbb10('0x30')](_0xbb10('0x38'))}));});return BPromise[_0xbb10('0x4c')](_0x4e3d6a);}}})[_0xbb10('0x11')](function(_0x188b97){if(_0xd9e743){var _0x5206e1=[];var _0x318a14=[];var _0x1351eb=utils[_0xbb10('0x32')]();var _0x35b811={'membername':_0xd9e743['name'],'interface':_0x1ad2ed,'enterAt':moment()['format'](_0xbb10('0x38')),'role':_0xd9e743[_0xbb10('0x2b')],'internal':_0xd9e743[_0xbb10('0x3b')]};_0x1351eb[_0xbb10('0x33')](function(_0x5ee705){_0x5206e1[_0xbb10('0x34')](_[_0xbb10('0x59')]({'channel':_0x5ee705,'type':_0xbb10('0x5a'),'data1':_0xbb10('0x5b'),'data2':_0x1ad2ed},_0x35b811));if(_0xd9e743[_0xbb10('0x51')]){_0x318a14['push'](_['merge']({'channel':_0x5ee705,'type':_0xbb10('0x37'),'data1':_0xbb10('0x5c')},_0x35b811));}});return db[_0xbb10('0x2e')]['bulkCreate'](_0x5206e1[_0xbb10('0x5d')](_0x318a14),{'individualHooks':!![]});}})[_0xbb10('0x11')](function(){if(_0xd9e743){return _0xd9e743['update']({'online':!![],'lastLoginAt':moment()['format'](_0xbb10('0x38')),'voicePause':_0xd9e743[_0xbb10('0x51')]||![],'mailPause':_0xd9e743[_0xbb10('0x51')]||![],'chatPause':_0xd9e743['loginInPause']||![],'faxPause':_0xd9e743[_0xbb10('0x51')]||![],'smsPause':_0xd9e743[_0xbb10('0x51')]||![],'openchannelPause':_0xd9e743[_0xbb10('0x51')]||![],'pauseType':_0xd9e743[_0xbb10('0x51')]?_0xbb10('0x5c'):null,'lastPauseAt':moment()[_0xbb10('0x30')](_0xbb10('0x38')),'interface':_0x1ad2ed});}})[_0xbb10('0x11')](function(_0x3e6246){_0x46f462(_0x3e6246);})['catch'](function(_0x3367d4){_0x1b11c0(_0x5cd089[_0xbb10('0x17')](0x1f4,_0x3367d4[_0xbb10('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 282b37c..af692f7 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 _0xdea5=['remove','update','emit','removeListener','register','length','./user.events'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xdea5,0x11e));var _0x5dea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdea5[_0x3dd15e];return _0x231fd0;};'use strict';var UserEvents=require(_0x5dea('0x0'));var events=['save',_0x5dea('0x1'),_0x5dea('0x2')];function createListener(_0x4e74c1,_0x1ce842){return function(_0x51c749){_0x1ce842[_0x5dea('0x3')](_0x4e74c1,_0x51c749);};}function removeListener(_0x52448f,_0x410ddc){return function(){UserEvents[_0x5dea('0x4')](_0x52448f,_0x410ddc);};}exports[_0x5dea('0x5')]=function(_0x19dc3e){for(var _0x3378d3=0x0,_0x493a9f=events[_0x5dea('0x6')];_0x3378d3<_0x493a9f;_0x3378d3++){var _0x533132=events[_0x3378d3];var _0xa133e4=createListener('user:'+_0x533132,_0x19dc3e);UserEvents['on'](_0x533132,_0xa133e4);}}; \ No newline at end of file +var _0x5a05=['user:','./user.events','remove','update','removeListener','register','length'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5a05,0x9b));var _0x55a0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5a05[_0x20a584];return _0x4b41a8;};'use strict';var UserEvents=require(_0x55a0('0x0'));var events=['save',_0x55a0('0x1'),_0x55a0('0x2')];function createListener(_0x3ce8f0,_0x1bdcbf){return function(_0x4834e1){_0x1bdcbf['emit'](_0x3ce8f0,_0x4834e1);};}function removeListener(_0x394945,_0x2eade6){return function(){UserEvents[_0x55a0('0x3')](_0x394945,_0x2eade6);};}exports[_0x55a0('0x4')]=function(_0x27fc86){for(var _0x25304c=0x0,_0x511edd=events[_0x55a0('0x5')];_0x25304c<_0x511edd;_0x25304c++){var _0x26e006=events[_0x25304c];var _0x224bfd=createListener(_0x55a0('0x6')+_0x26e006,_0x27fc86);UserEvents['on'](_0x26e006,_0x224bfd);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index afab2f9..e9d7f88 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 _0x4819=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path'];(function(_0xb92f13,_0x2696dd){var _0x144dda=function(_0x539c87){while(--_0x539c87){_0xb92f13['push'](_0xb92f13['shift']());}};_0x144dda(++_0x2696dd);}(_0x4819,0xcd));var _0x9481=function(_0x3db7ac,_0x4b9b9c){_0x3db7ac=_0x3db7ac-0x0;var _0x390337=_0x4819[_0x3db7ac];return _0x390337;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var auth=require(_0x9481('0x5'));var interaction=require(_0x9481('0x6'));var config=require(_0x9481('0x7'));module[_0x9481('0x8')]=router; \ No newline at end of file +var _0x07e8=['exports','multer','util','path','express','../../components/auth/service'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x07e8,0x10f));var _0x807e=function(_0x408845,_0x55874a){_0x408845=_0x408845-0x0;var _0x3302f6=_0x07e8[_0x408845];return _0x3302f6;};'use strict';var multer=require(_0x807e('0x0'));var util=require(_0x807e('0x1'));var path=require(_0x807e('0x2'));var timeout=require('connect-timeout');var express=require(_0x807e('0x3'));var router=express['Router']();var auth=require(_0x807e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x807e('0x5')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index c93e4fd..eea0418 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 _0x520b=['exports','INTEGER','sequelize'];(function(_0x5bbd88,_0xc3e30e){var _0xfce126=function(_0x76919c){while(--_0x76919c){_0x5bbd88['push'](_0x5bbd88['shift']());}};_0xfce126(++_0xc3e30e);}(_0x520b,0x116));var _0xb520=function(_0x378720,_0xa711f1){_0x378720=_0x378720-0x0;var _0x47920a=_0x520b[_0x378720];return _0x47920a;};'use strict';var Sequelize=require(_0xb520('0x0'));module[_0xb520('0x1')]={'penalty':{'type':Sequelize[_0xb520('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc435=['sequelize'];(function(_0x250995,_0x26f724){var _0x222592=function(_0x3414e2){while(--_0x3414e2){_0x250995['push'](_0x250995['shift']());}};_0x222592(++_0x26f724);}(_0xc435,0x184));var _0x5c43=function(_0x14c0df,_0xf8a72f){_0x14c0df=_0x14c0df-0x0;var _0x2a6baf=_0xc435[_0x14c0df];return _0x2a6baf;};'use strict';var Sequelize=require(_0x5c43('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 54cccc9..39a4ce0 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 _0x693f=['api','bluebird','request-promise','./userChatQueue.attributes','exports','define','user_has_chat_queues','lodash','util','../../config/logger'];(function(_0x2c0f81,_0x5e1fd7){var _0x16407c=function(_0x367484){while(--_0x367484){_0x2c0f81['push'](_0x2c0f81['shift']());}};_0x16407c(++_0x5e1fd7);}(_0x693f,0x9d));var _0xf693=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x693f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf693('0x0'));var util=require(_0xf693('0x1'));var logger=require(_0xf693('0x2'))(_0xf693('0x3'));var moment=require('moment');var BPromise=require(_0xf693('0x4'));var rp=require(_0xf693('0x5'));var attributes=require(_0xf693('0x6'));module[_0xf693('0x7')]=function(_0x3d2e05,_0x6e749b){return _0x3d2e05[_0xf693('0x8')]('UserChatQueue',attributes,{'tableName':_0xf693('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc901=['lodash','bluebird','request-promise','exports','define','UserChatQueue','user_has_chat_queues'];(function(_0x167ec1,_0xaa6d9a){var _0x4e93fe=function(_0x2d9fac){while(--_0x2d9fac){_0x167ec1['push'](_0x167ec1['shift']());}};_0x4e93fe(++_0xaa6d9a);}(_0xc901,0x142));var _0x1c90=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc901[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x1c90('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1c90('0x1'));var rp=require(_0x1c90('0x2'));var attributes=require('./userChatQueue.attributes');module[_0x1c90('0x3')]=function(_0x317443,_0x3dcf02){return _0x317443[_0x1c90('0x4')](_0x1c90('0x5'),attributes,{'tableName':_0x1c90('0x6'),'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 e18fdd7..e955476 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 _0x12b3=['jayson/promise','client','request','then','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5387a6,_0x3ed319){var _0x2f0845=function(_0x567721){while(--_0x567721){_0x5387a6['push'](_0x5387a6['shift']());}};_0x2f0845(++_0x3ed319);}(_0x12b3,0xf0));var _0x312b=function(_0x15a385,_0x5786fb){_0x15a385=_0x15a385-0x0;var _0xb433e8=_0x12b3[_0x15a385];return _0xb433e8;};'use strict';var _=require(_0x312b('0x0'));var util=require(_0x312b('0x1'));var moment=require('moment');var BPromise=require(_0x312b('0x2'));var rs=require(_0x312b('0x3'));var fs=require('fs');var Redis=require(_0x312b('0x4'));var db=require(_0x312b('0x5'))['db'];var utils=require(_0x312b('0x6'));var logger=require(_0x312b('0x7'))(_0x312b('0x8'));var config=require(_0x312b('0x9'));var jayson=require(_0x312b('0xa'));var client=jayson[_0x312b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17d2ee,_0xb3b239,_0x45aac4){return new BPromise(function(_0xe05211,_0x183ad7){return client[_0x312b('0xc')](_0x17d2ee,_0x45aac4)[_0x312b('0xd')](function(_0x7fe717){logger['info']('UserChatQueue,\x20%s,\x20%s',_0xb3b239,_0x312b('0xe'));logger[_0x312b('0xf')](_0x312b('0x10'),_0xb3b239,_0x312b('0xe'),JSON[_0x312b('0x11')](_0x7fe717));if(_0x7fe717['error']){if(_0x7fe717[_0x312b('0x12')][_0x312b('0x13')]===0x1f4){logger[_0x312b('0x12')](_0x312b('0x14'),_0xb3b239,_0x7fe717['error']['message']);return _0x183ad7(_0x7fe717[_0x312b('0x12')]['message']);}logger['error'](_0x312b('0x14'),_0xb3b239,_0x7fe717[_0x312b('0x12')][_0x312b('0x15')]);return _0xe05211(_0x7fe717[_0x312b('0x12')]['message']);}else{logger[_0x312b('0x16')](_0x312b('0x14'),_0xb3b239,_0x312b('0xe'));_0xe05211(_0x7fe717[_0x312b('0x17')][_0x312b('0x15')]);}})[_0x312b('0x18')](function(_0x2b4619){logger[_0x312b('0x12')](_0x312b('0x14'),_0xb3b239,_0x2b4619);_0x183ad7(_0x2b4619);});});} \ No newline at end of file +var _0xe2e2=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserChatQueue,\x20%s,\x20%s','message','result','lodash','util'];(function(_0x8338b1,_0x1eb097){var _0x4f4e95=function(_0x19fe46){while(--_0x19fe46){_0x8338b1['push'](_0x8338b1['shift']());}};_0x4f4e95(++_0x1eb097);}(_0xe2e2,0xe4));var _0x2e2e=function(_0x3dbead,_0x27f56b){_0x3dbead=_0x3dbead-0x0;var _0x3fad1d=_0xe2e2[_0x3dbead];return _0x3fad1d;};'use strict';var _=require(_0x2e2e('0x0'));var util=require(_0x2e2e('0x1'));var moment=require(_0x2e2e('0x2'));var BPromise=require(_0x2e2e('0x3'));var rs=require(_0x2e2e('0x4'));var fs=require('fs');var Redis=require(_0x2e2e('0x5'));var db=require(_0x2e2e('0x6'))['db'];var utils=require(_0x2e2e('0x7'));var logger=require('../../config/logger')(_0x2e2e('0x8'));var config=require(_0x2e2e('0x9'));var jayson=require(_0x2e2e('0xa'));var client=jayson[_0x2e2e('0xb')][_0x2e2e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x23f378,_0x3ed180,_0x1c51ef){return new BPromise(function(_0x3fdb0e,_0x174173){return client[_0x2e2e('0xd')](_0x23f378,_0x1c51ef)['then'](function(_0x1e56d0){logger[_0x2e2e('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x3ed180,_0x2e2e('0xf'));logger[_0x2e2e('0x10')](_0x2e2e('0x11'),_0x3ed180,'request\x20sent',JSON[_0x2e2e('0x12')](_0x1e56d0));if(_0x1e56d0[_0x2e2e('0x13')]){if(_0x1e56d0[_0x2e2e('0x13')]['code']===0x1f4){logger[_0x2e2e('0x13')](_0x2e2e('0x14'),_0x3ed180,_0x1e56d0['error'][_0x2e2e('0x15')]);return _0x174173(_0x1e56d0[_0x2e2e('0x13')][_0x2e2e('0x15')]);}logger['error'](_0x2e2e('0x14'),_0x3ed180,_0x1e56d0[_0x2e2e('0x13')]['message']);return _0x3fdb0e(_0x1e56d0[_0x2e2e('0x13')][_0x2e2e('0x15')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x3ed180,_0x2e2e('0xf'));_0x3fdb0e(_0x1e56d0[_0x2e2e('0x16')][_0x2e2e('0x15')]);}})['catch'](function(_0x124329){logger[_0x2e2e('0x13')](_0x2e2e('0x14'),_0x3ed180,_0x124329);_0x174173(_0x124329);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 29a2323..6b48fa4 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 _0x15b2=['../../components/interaction/service','../../config/environment','exports','util','connect-timeout','express','../../components/auth/service'];(function(_0x26a0d4,_0x4e402e){var _0x2302e6=function(_0x4828fb){while(--_0x4828fb){_0x26a0d4['push'](_0x26a0d4['shift']());}};_0x2302e6(++_0x4e402e);}(_0x15b2,0x145));var _0x215b=function(_0x1760e9,_0xbbfd0b){_0x1760e9=_0x1760e9-0x0;var _0x3fe586=_0x15b2[_0x1760e9];return _0x3fe586;};'use strict';var multer=require('multer');var util=require(_0x215b('0x0'));var path=require('path');var timeout=require(_0x215b('0x1'));var express=require(_0x215b('0x2'));var router=express['Router']();var auth=require(_0x215b('0x3'));var interaction=require(_0x215b('0x4'));var config=require(_0x215b('0x5'));module[_0x215b('0x6')]=router; \ No newline at end of file +var _0x444e=['express','../../components/auth/service','../../config/environment','exports','multer','path'];(function(_0xffa302,_0xfd695c){var _0x38ea4b=function(_0xaa04c3){while(--_0xaa04c3){_0xffa302['push'](_0xffa302['shift']());}};_0x38ea4b(++_0xfd695c);}(_0x444e,0xe8));var _0xe444=function(_0x16cfeb,_0x3cc891){_0x16cfeb=_0x16cfeb-0x0;var _0xdd837a=_0x444e[_0x16cfeb];return _0xdd837a;};'use strict';var multer=require(_0xe444('0x0'));var util=require('util');var path=require(_0xe444('0x1'));var timeout=require('connect-timeout');var express=require(_0xe444('0x2'));var router=express['Router']();var auth=require(_0xe444('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xe444('0x4'));module[_0xe444('0x5')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 5a5f1cc..ec9cfb1 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 _0xd12f=['sequelize'];(function(_0x11b614,_0x1bd832){var _0x517f63=function(_0x2e0caa){while(--_0x2e0caa){_0x11b614['push'](_0x11b614['shift']());}};_0x517f63(++_0x1bd832);}(_0xd12f,0xb9));var _0xfd12=function(_0x29a8c2,_0x4914cf){_0x29a8c2=_0x29a8c2-0x0;var _0x3f47f8=_0xd12f[_0x29a8c2];return _0x3f47f8;};'use strict';var Sequelize=require(_0xfd12('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4b88=['INTEGER','STRING','exports'];(function(_0x531a19,_0x43e019){var _0x4845d2=function(_0x4c9b62){while(--_0x4c9b62){_0x531a19['push'](_0x531a19['shift']());}};_0x4845d2(++_0x43e019);}(_0x4b88,0x1ca));var _0x84b8=function(_0x5d18cb,_0x2c2c0a){_0x5d18cb=_0x5d18cb-0x0;var _0x12b88e=_0x4b88[_0x5d18cb];return _0x12b88e;};'use strict';var Sequelize=require('sequelize');module[_0x84b8('0x0')]={'penalty':{'type':Sequelize[_0x84b8('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x84b8('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x84b8('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 86eb101..34f84c9 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 _0x4b84=['moment','./userFaxQueue.attributes','exports','user_has_fax_queues','lodash','util'];(function(_0x13156f,_0x368f8d){var _0x1cd24c=function(_0x2b0a1a){while(--_0x2b0a1a){_0x13156f['push'](_0x13156f['shift']());}};_0x1cd24c(++_0x368f8d);}(_0x4b84,0x1cc));var _0x44b8=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x4b84[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x44b8('0x3'));module[_0x44b8('0x4')]=function(_0x39ad16,_0x5766b0){return _0x39ad16['define']('UserFaxQueue',attributes,{'tableName':_0x44b8('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd67b=['define','UserFaxQueue','user_has_fax_queues','util','api','moment','bluebird','./userFaxQueue.attributes'];(function(_0x5d2f8b,_0x250199){var _0x165442=function(_0x3d4bbc){while(--_0x3d4bbc){_0x5d2f8b['push'](_0x5d2f8b['shift']());}};_0x165442(++_0x250199);}(_0xd67b,0x133));var _0xbd67=function(_0x17781a,_0x1af9b9){_0x17781a=_0x17781a-0x0;var _0x3c506d=_0xd67b[_0x17781a];return _0x3c506d;};'use strict';var _=require('lodash');var util=require(_0xbd67('0x0'));var logger=require('../../config/logger')(_0xbd67('0x1'));var moment=require(_0xbd67('0x2'));var BPromise=require(_0xbd67('0x3'));var rp=require('request-promise');var attributes=require(_0xbd67('0x4'));module['exports']=function(_0x1bf96,_0x5a827b){return _0x1bf96[_0xbd67('0x5')](_0xbd67('0x6'),attributes,{'tableName':_0xbd67('0x7'),'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 efc111c..6e08cca 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 _0x6c23=['then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request'];(function(_0x1ee0a3,_0x41ceb9){var _0x2a8fc1=function(_0x4184bd){while(--_0x4184bd){_0x1ee0a3['push'](_0x1ee0a3['shift']());}};_0x2a8fc1(++_0x41ceb9);}(_0x6c23,0x148));var _0x36c2=function(_0x71b71d,_0x342626){_0x71b71d=_0x71b71d-0x0;var _0x43ed54=_0x6c23[_0x71b71d];return _0x43ed54;};'use strict';var _=require(_0x36c2('0x0'));var util=require(_0x36c2('0x1'));var moment=require(_0x36c2('0x2'));var BPromise=require(_0x36c2('0x3'));var rs=require(_0x36c2('0x4'));var fs=require('fs');var Redis=require(_0x36c2('0x5'));var db=require(_0x36c2('0x6'))['db'];var utils=require(_0x36c2('0x7'));var logger=require(_0x36c2('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x36c2('0x9'));var client=jayson['client'][_0x36c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e9b88,_0x10bcdf,_0x279691){return new BPromise(function(_0x13f30a,_0x26409f){return client[_0x36c2('0xb')](_0x4e9b88,_0x279691)[_0x36c2('0xc')](function(_0x549ec9){logger[_0x36c2('0xd')](_0x36c2('0xe'),_0x10bcdf,'request\x20sent');logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x10bcdf,_0x36c2('0xf'),JSON['stringify'](_0x549ec9));if(_0x549ec9[_0x36c2('0x10')]){if(_0x549ec9[_0x36c2('0x10')][_0x36c2('0x11')]===0x1f4){logger[_0x36c2('0x10')](_0x36c2('0xe'),_0x10bcdf,_0x549ec9[_0x36c2('0x10')][_0x36c2('0x12')]);return _0x26409f(_0x549ec9[_0x36c2('0x10')][_0x36c2('0x12')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x10bcdf,_0x549ec9['error'][_0x36c2('0x12')]);return _0x13f30a(_0x549ec9[_0x36c2('0x10')][_0x36c2('0x12')]);}else{logger[_0x36c2('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x10bcdf,'request\x20sent');_0x13f30a(_0x549ec9[_0x36c2('0x13')][_0x36c2('0x12')]);}})['catch'](function(_0x25d281){logger[_0x36c2('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x10bcdf,_0x25d281);_0x26409f(_0x25d281);});});} \ No newline at end of file +var _0x8ae9=['info','UserFaxQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then'];(function(_0x187e24,_0x393e15){var _0x39b658=function(_0x386c91){while(--_0x386c91){_0x187e24['push'](_0x187e24['shift']());}};_0x39b658(++_0x393e15);}(_0x8ae9,0x127));var _0x98ae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8ae9[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x98ae('0x0'));var util=require(_0x98ae('0x1'));var moment=require(_0x98ae('0x2'));var BPromise=require(_0x98ae('0x3'));var rs=require(_0x98ae('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x98ae('0x5'))['db'];var utils=require(_0x98ae('0x6'));var logger=require(_0x98ae('0x7'))('rpc');var config=require(_0x98ae('0x8'));var jayson=require(_0x98ae('0x9'));var client=jayson['client'][_0x98ae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x599476,_0x411401,_0x23c175){return new BPromise(function(_0x48f098,_0x31a0ca){return client[_0x98ae('0xb')](_0x599476,_0x23c175)[_0x98ae('0xc')](function(_0x2011c7){logger[_0x98ae('0xd')](_0x98ae('0xe'),_0x411401,'request\x20sent');logger[_0x98ae('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x411401,_0x98ae('0x10'),JSON[_0x98ae('0x11')](_0x2011c7));if(_0x2011c7[_0x98ae('0x12')]){if(_0x2011c7[_0x98ae('0x12')][_0x98ae('0x13')]===0x1f4){logger[_0x98ae('0x12')](_0x98ae('0xe'),_0x411401,_0x2011c7[_0x98ae('0x12')][_0x98ae('0x14')]);return _0x31a0ca(_0x2011c7[_0x98ae('0x12')]['message']);}logger[_0x98ae('0x12')](_0x98ae('0xe'),_0x411401,_0x2011c7['error']['message']);return _0x48f098(_0x2011c7[_0x98ae('0x12')][_0x98ae('0x14')]);}else{logger[_0x98ae('0xd')](_0x98ae('0xe'),_0x411401,_0x98ae('0x10'));_0x48f098(_0x2011c7[_0x98ae('0x15')][_0x98ae('0x14')]);}})['catch'](function(_0x446d86){logger['error'](_0x98ae('0xe'),_0x411401,_0x446d86);_0x31a0ca(_0x446d86);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index fb55e02..2acad5e 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 _0x6b1b=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util'];(function(_0x2ac31a,_0x581ade){var _0x2ea3d0=function(_0x40a92f){while(--_0x40a92f){_0x2ac31a['push'](_0x2ac31a['shift']());}};_0x2ea3d0(++_0x581ade);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x6b1b[_0x298ed3];return _0x5aad28;};'use strict';var multer=require('multer');var util=require(_0xb6b1('0x0'));var path=require(_0xb6b1('0x1'));var timeout=require(_0xb6b1('0x2'));var express=require('express');var router=express[_0xb6b1('0x3')]();var auth=require(_0xb6b1('0x4'));var interaction=require(_0xb6b1('0x5'));var config=require(_0xb6b1('0x6'));module[_0xb6b1('0x7')]=router; \ No newline at end of file +var _0x5d0a=['../../components/interaction/service','exports','multer','path','express','Router','../../components/auth/service'];(function(_0x599c94,_0x464f0e){var _0x34e215=function(_0x36295a){while(--_0x36295a){_0x599c94['push'](_0x599c94['shift']());}};_0x34e215(++_0x464f0e);}(_0x5d0a,0x175));var _0xa5d0=function(_0x29c81f,_0x13f33f){_0x29c81f=_0x29c81f-0x0;var _0x50f34d=_0x5d0a[_0x29c81f];return _0x50f34d;};'use strict';var multer=require(_0xa5d0('0x0'));var util=require('util');var path=require(_0xa5d0('0x1'));var timeout=require('connect-timeout');var express=require(_0xa5d0('0x2'));var router=express[_0xa5d0('0x3')]();var auth=require(_0xa5d0('0x4'));var interaction=require(_0xa5d0('0x5'));var config=require('../../config/environment');module[_0xa5d0('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 70c7446..a286ca8 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 _0xa7ef=['exports','INTEGER','sequelize'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0xa7ef,0x9e));var _0xfa7e=function(_0x59aefb,_0x1f9891){_0x59aefb=_0x59aefb-0x0;var _0x22b1d9=_0xa7ef[_0x59aefb];return _0x22b1d9;};'use strict';var Sequelize=require(_0xfa7e('0x0'));module[_0xfa7e('0x1')]={'penalty':{'type':Sequelize[_0xfa7e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0c72=['sequelize'];(function(_0x480d88,_0x16790c){var _0x45e5bc=function(_0x9c698c){while(--_0x9c698c){_0x480d88['push'](_0x480d88['shift']());}};_0x45e5bc(++_0x16790c);}(_0x0c72,0xa7));var _0x20c7=function(_0x1270b8,_0x3da417){_0x1270b8=_0x1270b8-0x0;var _0x43081b=_0x0c72[_0x1270b8];return _0x43081b;};'use strict';var Sequelize=require(_0x20c7('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 2bc5744..244e9c7 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 _0xd1ca=['bluebird','request-promise','./userMailQueue.attributes','UserMailQueue','user_has_mail_queues','lodash','util'];(function(_0x10d6f2,_0x18ae62){var _0x59e5c7=function(_0x3edf41){while(--_0x3edf41){_0x10d6f2['push'](_0x10d6f2['shift']());}};_0x59e5c7(++_0x18ae62);}(_0xd1ca,0x140));var _0xad1c=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xd1ca[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0xad1c('0x0'));var util=require(_0xad1c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xad1c('0x2'));var rp=require(_0xad1c('0x3'));var attributes=require(_0xad1c('0x4'));module['exports']=function(_0x25a756,_0x4cf710){return _0x25a756['define'](_0xad1c('0x5'),attributes,{'tableName':_0xad1c('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x430c=['bluebird','define','user_has_mail_queues','lodash','api','moment'];(function(_0x1bdc52,_0x4876a9){var _0xdf3fa3=function(_0x2a3ba4){while(--_0x2a3ba4){_0x1bdc52['push'](_0x1bdc52['shift']());}};_0xdf3fa3(++_0x4876a9);}(_0x430c,0x1a1));var _0xc430=function(_0x367336,_0x18c229){_0x367336=_0x367336-0x0;var _0x3423a7=_0x430c[_0x367336];return _0x3423a7;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc430('0x1'));var moment=require(_0xc430('0x2'));var BPromise=require(_0xc430('0x3'));var rp=require('request-promise');var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x47d8b9,_0x338a82){return _0x47d8b9[_0xc430('0x4')]('UserMailQueue',attributes,{'tableName':_0xc430('0x5'),'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 b24fb19..bd6c02e 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 _0x2a72=['stringify','error','code','UserMailQueue,\x20%s,\x20%s','message','result','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x4db1d7,_0xe0d557){var _0x53f2d7=function(_0x167c55){while(--_0x167c55){_0x4db1d7['push'](_0x4db1d7['shift']());}};_0x53f2d7(++_0xe0d557);}(_0x2a72,0x16b));var _0x22a7=function(_0x1b75cb,_0x1e6e09){_0x1b75cb=_0x1b75cb-0x0;var _0x484e47=_0x2a72[_0x1b75cb];return _0x484e47;};'use strict';var _=require(_0x22a7('0x0'));var util=require('util');var moment=require(_0x22a7('0x1'));var BPromise=require(_0x22a7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x22a7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x22a7('0x4'))(_0x22a7('0x5'));var config=require(_0x22a7('0x6'));var jayson=require(_0x22a7('0x7'));var client=jayson[_0x22a7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x215ecc,_0x2220a4,_0x3b98a2){return new BPromise(function(_0x166369,_0x50b249){return client[_0x22a7('0x9')](_0x215ecc,_0x3b98a2)[_0x22a7('0xa')](function(_0x4a0abb){logger[_0x22a7('0xb')]('UserMailQueue,\x20%s,\x20%s',_0x2220a4,_0x22a7('0xc'));logger[_0x22a7('0xd')](_0x22a7('0xe'),_0x2220a4,_0x22a7('0xc'),JSON[_0x22a7('0xf')](_0x4a0abb));if(_0x4a0abb[_0x22a7('0x10')]){if(_0x4a0abb['error'][_0x22a7('0x11')]===0x1f4){logger['error'](_0x22a7('0x12'),_0x2220a4,_0x4a0abb[_0x22a7('0x10')][_0x22a7('0x13')]);return _0x50b249(_0x4a0abb[_0x22a7('0x10')][_0x22a7('0x13')]);}logger[_0x22a7('0x10')](_0x22a7('0x12'),_0x2220a4,_0x4a0abb[_0x22a7('0x10')][_0x22a7('0x13')]);return _0x166369(_0x4a0abb['error'][_0x22a7('0x13')]);}else{logger[_0x22a7('0xb')](_0x22a7('0x12'),_0x2220a4,_0x22a7('0xc'));_0x166369(_0x4a0abb[_0x22a7('0x14')][_0x22a7('0x13')]);}})['catch'](function(_0x33de87){logger[_0x22a7('0x10')](_0x22a7('0x12'),_0x2220a4,_0x33de87);_0x50b249(_0x33de87);});});} \ No newline at end of file +var _0xcb2d=['ioredis','../../config/logger','../../config/environment','jayson/promise','http','request','then','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x1de8dd,_0x43745a){var _0x49cd16=function(_0xbbaa7a){while(--_0xbbaa7a){_0x1de8dd['push'](_0x1de8dd['shift']());}};_0x49cd16(++_0x43745a);}(_0xcb2d,0x179));var _0xdcb2=function(_0x5e5024,_0x21bf7a){_0x5e5024=_0x5e5024-0x0;var _0xe77837=_0xcb2d[_0x5e5024];return _0xe77837;};'use strict';var _=require(_0xdcb2('0x0'));var util=require(_0xdcb2('0x1'));var moment=require(_0xdcb2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdcb2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdcb2('0x4'))('rpc');var config=require(_0xdcb2('0x5'));var jayson=require(_0xdcb2('0x6'));var client=jayson['client'][_0xdcb2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f047d,_0xd3ed4e,_0x466c8c){return new BPromise(function(_0x51a004,_0x4f02dd){return client[_0xdcb2('0x8')](_0x4f047d,_0x466c8c)[_0xdcb2('0x9')](function(_0x210813){logger['info'](_0xdcb2('0xa'),_0xd3ed4e,'request\x20sent');logger[_0xdcb2('0xb')](_0xdcb2('0xc'),_0xd3ed4e,_0xdcb2('0xd'),JSON[_0xdcb2('0xe')](_0x210813));if(_0x210813[_0xdcb2('0xf')]){if(_0x210813[_0xdcb2('0xf')][_0xdcb2('0x10')]===0x1f4){logger['error']('UserMailQueue,\x20%s,\x20%s',_0xd3ed4e,_0x210813['error'][_0xdcb2('0x11')]);return _0x4f02dd(_0x210813[_0xdcb2('0xf')][_0xdcb2('0x11')]);}logger[_0xdcb2('0xf')](_0xdcb2('0xa'),_0xd3ed4e,_0x210813[_0xdcb2('0xf')][_0xdcb2('0x11')]);return _0x51a004(_0x210813[_0xdcb2('0xf')][_0xdcb2('0x11')]);}else{logger['info'](_0xdcb2('0xa'),_0xd3ed4e,'request\x20sent');_0x51a004(_0x210813[_0xdcb2('0x12')][_0xdcb2('0x11')]);}})[_0xdcb2('0x13')](function(_0x40db3f){logger['error'](_0xdcb2('0xa'),_0xd3ed4e,_0x40db3f);_0x4f02dd(_0x40db3f);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 19da1c0..842b906 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 _0xef17=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout','express'];(function(_0x276b42,_0x3ecffe){var _0x2fbfa4=function(_0x4a0c52){while(--_0x4a0c52){_0x276b42['push'](_0x276b42['shift']());}};_0x2fbfa4(++_0x3ecffe);}(_0xef17,0x136));var _0x7ef1=function(_0x590b3d,_0x55630b){_0x590b3d=_0x590b3d-0x0;var _0x2bd810=_0xef17[_0x590b3d];return _0x2bd810;};'use strict';var multer=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var path=require(_0x7ef1('0x2'));var timeout=require(_0x7ef1('0x3'));var express=require(_0x7ef1('0x4'));var router=express[_0x7ef1('0x5')]();var auth=require(_0x7ef1('0x6'));var interaction=require(_0x7ef1('0x7'));var config=require(_0x7ef1('0x8'));module['exports']=router; \ No newline at end of file +var _0x539d=['exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x539d,0x17b));var _0xd539=function(_0x519c88,_0xb84103){_0x519c88=_0x519c88-0x0;var _0x4668d7=_0x539d[_0x519c88];return _0x4668d7;};'use strict';var multer=require(_0xd539('0x0'));var util=require('util');var path=require(_0xd539('0x1'));var timeout=require(_0xd539('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xd539('0x3'));var interaction=require(_0xd539('0x4'));var config=require(_0xd539('0x5'));module[_0xd539('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 0e4bcc9..937c471 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 _0xd8f4=['exports','INTEGER','sequelize'];(function(_0x454147,_0x5ef14c){var _0x2d9d38=function(_0x278e67){while(--_0x278e67){_0x454147['push'](_0x454147['shift']());}};_0x2d9d38(++_0x5ef14c);}(_0xd8f4,0x1eb));var _0x4d8f=function(_0x31f87e,_0x12a75c){_0x31f87e=_0x31f87e-0x0;var _0x4098c6=_0xd8f4[_0x31f87e];return _0x4098c6;};'use strict';var Sequelize=require(_0x4d8f('0x0'));module[_0x4d8f('0x1')]={'penalty':{'type':Sequelize[_0x4d8f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xef4d=['exports','sequelize'];(function(_0x5aacc2,_0x527dd5){var _0x477b8c=function(_0x57f76c){while(--_0x57f76c){_0x5aacc2['push'](_0x5aacc2['shift']());}};_0x477b8c(++_0x527dd5);}(_0xef4d,0x187));var _0xdef4=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xef4d[_0x580576];return _0x3f55a0;};'use strict';var Sequelize=require(_0xdef4('0x0'));module[_0xdef4('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 21f2cfa..400d6a6 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 _0x7c80=['request-promise','exports','UserOpenchannelQueue','lodash','util','moment','bluebird'];(function(_0x5ca52b,_0x4cd5ce){var _0x5f511f=function(_0x1dfbcd){while(--_0x1dfbcd){_0x5ca52b['push'](_0x5ca52b['shift']());}};_0x5f511f(++_0x4cd5ce);}(_0x7c80,0xa4));var _0x07c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c80[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x07c8('0x0'));var util=require(_0x07c8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x07c8('0x2'));var BPromise=require(_0x07c8('0x3'));var rp=require(_0x07c8('0x4'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x07c8('0x5')]=function(_0x750fb2,_0x2f652b){return _0x750fb2['define'](_0x07c8('0x6'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x624a=['api','moment','bluebird','request-promise','UserOpenchannelQueue','util'];(function(_0x11309c,_0xe18a74){var _0x3fea9c=function(_0xeb11c3){while(--_0xeb11c3){_0x11309c['push'](_0x11309c['shift']());}};_0x3fea9c(++_0xe18a74);}(_0x624a,0x143));var _0xa624=function(_0x50f21f,_0x26c387){_0x50f21f=_0x50f21f-0x0;var _0x42334a=_0x624a[_0x50f21f];return _0x42334a;};'use strict';var _=require('lodash');var util=require(_0xa624('0x0'));var logger=require('../../config/logger')(_0xa624('0x1'));var moment=require(_0xa624('0x2'));var BPromise=require(_0xa624('0x3'));var rp=require(_0xa624('0x4'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0xfd44e6,_0x4bc4ac){return _0xfd44e6['define'](_0xa624('0x5'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 5b13983..3c20672 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 _0x94a3=['jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x131bb1,_0x5c91cc){var _0x4b006b=function(_0x236496){while(--_0x236496){_0x131bb1['push'](_0x131bb1['shift']());}};_0x4b006b(++_0x5c91cc);}(_0x94a3,0x167));var _0x394a=function(_0x297812,_0x335ad3){_0x297812=_0x297812-0x0;var _0x402e0d=_0x94a3[_0x297812];return _0x402e0d;};'use strict';var _=require(_0x394a('0x0'));var util=require('util');var moment=require(_0x394a('0x1'));var BPromise=require(_0x394a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x394a('0x3'));var db=require(_0x394a('0x4'))['db'];var utils=require(_0x394a('0x5'));var logger=require(_0x394a('0x6'))(_0x394a('0x7'));var config=require(_0x394a('0x8'));var jayson=require(_0x394a('0x9'));var client=jayson[_0x394a('0xa')][_0x394a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x117ae0,_0x30fe83,_0x494895){return new BPromise(function(_0x3552ef,_0x43942a){return client[_0x394a('0xc')](_0x117ae0,_0x494895)[_0x394a('0xd')](function(_0x229b14){logger[_0x394a('0xe')](_0x394a('0xf'),_0x30fe83,'request\x20sent');logger[_0x394a('0x10')](_0x394a('0x11'),_0x30fe83,_0x394a('0x12'),JSON['stringify'](_0x229b14));if(_0x229b14[_0x394a('0x13')]){if(_0x229b14[_0x394a('0x13')][_0x394a('0x14')]===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x30fe83,_0x229b14['error'][_0x394a('0x15')]);return _0x43942a(_0x229b14[_0x394a('0x13')]['message']);}logger['error'](_0x394a('0xf'),_0x30fe83,_0x229b14[_0x394a('0x13')][_0x394a('0x15')]);return _0x3552ef(_0x229b14[_0x394a('0x13')]['message']);}else{logger[_0x394a('0xe')](_0x394a('0xf'),_0x30fe83,_0x394a('0x12'));_0x3552ef(_0x229b14[_0x394a('0x16')]['message']);}})['catch'](function(_0x38d3b8){logger[_0x394a('0x13')](_0x394a('0xf'),_0x30fe83,_0x38d3b8);_0x43942a(_0x38d3b8);});});} \ No newline at end of file +var _0x1280=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','bluebird'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x1280,0x13e));var _0x0128=function(_0x15dbca,_0x1d7c3c){_0x15dbca=_0x15dbca-0x0;var _0x326533=_0x1280[_0x15dbca];return _0x326533;};'use strict';var _=require(_0x0128('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0128('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0128('0x2'))['db'];var utils=require(_0x0128('0x3'));var logger=require(_0x0128('0x4'))(_0x0128('0x5'));var config=require(_0x0128('0x6'));var jayson=require(_0x0128('0x7'));var client=jayson[_0x0128('0x8')][_0x0128('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42a504,_0x518aef,_0x4cfaf2){return new BPromise(function(_0x4dffc3,_0x4b2409){return client[_0x0128('0xa')](_0x42a504,_0x4cfaf2)[_0x0128('0xb')](function(_0x54e402){logger['info'](_0x0128('0xc'),_0x518aef,_0x0128('0xd'));logger[_0x0128('0xe')](_0x0128('0xf'),_0x518aef,_0x0128('0xd'),JSON[_0x0128('0x10')](_0x54e402));if(_0x54e402[_0x0128('0x11')]){if(_0x54e402['error']['code']===0x1f4){logger['error'](_0x0128('0xc'),_0x518aef,_0x54e402[_0x0128('0x11')][_0x0128('0x12')]);return _0x4b2409(_0x54e402['error'][_0x0128('0x12')]);}logger[_0x0128('0x11')](_0x0128('0xc'),_0x518aef,_0x54e402[_0x0128('0x11')][_0x0128('0x12')]);return _0x4dffc3(_0x54e402[_0x0128('0x11')]['message']);}else{logger['info'](_0x0128('0xc'),_0x518aef,_0x0128('0xd'));_0x4dffc3(_0x54e402[_0x0128('0x13')][_0x0128('0x12')]);}})['catch'](function(_0x1169a6){logger[_0x0128('0x11')](_0x0128('0xc'),_0x518aef,_0x1169a6);_0x4b2409(_0x1169a6);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 8aaea78..8345eee 100644 --- a/server/api/userProfile/index.js +++ b/server/api/userProfile/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f97=['connect-timeout','express','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/resources','getResources','post','/:id/clone','clone','/:id/sections','addResources','update','delete','destroy','removeResources','exports','multer','util','path'];(function(_0x36087a,_0x2a1c18){var _0x2d3f12=function(_0x3c55c0){while(--_0x3c55c0){_0x36087a['push'](_0x36087a['shift']());}};_0x2d3f12(++_0x2a1c18);}(_0x9f97,0x1eb));var _0x79f9=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0x9f97[_0x2ed8f3];return _0x525a55;};'use strict';var multer=require(_0x79f9('0x0'));var util=require(_0x79f9('0x1'));var path=require(_0x79f9('0x2'));var timeout=require(_0x79f9('0x3'));var express=require(_0x79f9('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x79f9('0x5'));var config=require(_0x79f9('0x6'));var controller=require(_0x79f9('0x7'));router[_0x79f9('0x8')]('/',auth[_0x79f9('0x9')](),controller[_0x79f9('0xa')]);router[_0x79f9('0x8')](_0x79f9('0xb'),auth[_0x79f9('0x9')](),controller['describe']);router[_0x79f9('0x8')](_0x79f9('0xc'),auth[_0x79f9('0x9')](),controller[_0x79f9('0xd')]);router[_0x79f9('0x8')](_0x79f9('0xe'),auth['isAuthenticated'](),controller[_0x79f9('0xf')]);router[_0x79f9('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x79f9('0x10')](_0x79f9('0x11'),auth[_0x79f9('0x9')](),controller[_0x79f9('0x12')]);router[_0x79f9('0x10')](_0x79f9('0x13'),auth[_0x79f9('0x9')](),controller['addSections']);router[_0x79f9('0x10')]('/:id/resources',auth[_0x79f9('0x9')](),controller[_0x79f9('0x14')]);router['put'](_0x79f9('0xc'),auth[_0x79f9('0x9')](),controller[_0x79f9('0x15')]);router[_0x79f9('0x16')](_0x79f9('0xc'),auth[_0x79f9('0x9')](),controller[_0x79f9('0x17')]);router[_0x79f9('0x16')](_0x79f9('0x13'),auth[_0x79f9('0x9')](),controller['removeSections']);router[_0x79f9('0x16')]('/:id/resources',auth[_0x79f9('0x9')](),controller[_0x79f9('0x18')]);module[_0x79f9('0x19')]=router; \ No newline at end of file +var _0x9894=['describe','/:id','isAuthenticated','show','getResources','post','create','/:id/clone','clone','/:id/sections','addSections','/:id/resources','put','update','destroy','delete','removeSections','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','index','get','/describe'];(function(_0x4ac8a4,_0x807d75){var _0xebe718=function(_0x1a9fd4){while(--_0x1a9fd4){_0x4ac8a4['push'](_0x4ac8a4['shift']());}};_0xebe718(++_0x807d75);}(_0x9894,0x6c));var _0x4989=function(_0x15426a,_0x4e8f8a){_0x15426a=_0x15426a-0x0;var _0x3be922=_0x9894[_0x15426a];return _0x3be922;};'use strict';var multer=require(_0x4989('0x0'));var util=require(_0x4989('0x1'));var path=require(_0x4989('0x2'));var timeout=require(_0x4989('0x3'));var express=require('express');var router=express[_0x4989('0x4')]();var auth=require(_0x4989('0x5'));var interaction=require(_0x4989('0x6'));var config=require(_0x4989('0x7'));var controller=require(_0x4989('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x4989('0x9')]);router[_0x4989('0xa')](_0x4989('0xb'),auth['isAuthenticated'](),controller[_0x4989('0xc')]);router[_0x4989('0xa')](_0x4989('0xd'),auth[_0x4989('0xe')](),controller[_0x4989('0xf')]);router[_0x4989('0xa')]('/:id/resources',auth['isAuthenticated'](),controller[_0x4989('0x10')]);router[_0x4989('0x11')]('/',auth[_0x4989('0xe')](),controller[_0x4989('0x12')]);router[_0x4989('0x11')](_0x4989('0x13'),auth[_0x4989('0xe')](),controller[_0x4989('0x14')]);router[_0x4989('0x11')](_0x4989('0x15'),auth[_0x4989('0xe')](),controller[_0x4989('0x16')]);router['post'](_0x4989('0x17'),auth['isAuthenticated'](),controller['addResources']);router[_0x4989('0x18')](_0x4989('0xd'),auth[_0x4989('0xe')](),controller[_0x4989('0x19')]);router['delete']('/:id',auth[_0x4989('0xe')](),controller[_0x4989('0x1a')]);router[_0x4989('0x1b')](_0x4989('0x15'),auth['isAuthenticated'](),controller[_0x4989('0x1c')]);router['delete'](_0x4989('0x17'),auth['isAuthenticated'](),controller['removeResources']);module[_0x4989('0x1d')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index d078d66..53bd368 100644 --- a/server/api/userProfile/userProfile.attributes.js +++ b/server/api/userProfile/userProfile.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c4c=['name','STRING','crudPermissions','join','split'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x5c4c,0x118));var _0xc5c4=function(_0x388c04,_0x3a5606){_0x388c04=_0x388c04-0x0;var _0x417c69=_0x5c4c[_0x388c04];return _0x417c69;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc5c4('0x0')},'crudPermissions':{'type':Sequelize[_0xc5c4('0x1')],'set':function(_0x4c1445){this['setDataValue'](_0xc5c4('0x2'),_0x4c1445?_0x4c1445[_0xc5c4('0x3')](''):[]);},'get':function(){return this['getDataValue'](_0xc5c4('0x2'))?this['getDataValue'](_0xc5c4('0x2'))[_0xc5c4('0x4')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xc5c4('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x4f03=['split','sequelize','exports','STRING','name','setDataValue','crudPermissions','getDataValue'];(function(_0x3a6b77,_0x1e5e97){var _0x5951db=function(_0x9806ca){while(--_0x9806ca){_0x3a6b77['push'](_0x3a6b77['shift']());}};_0x5951db(++_0x1e5e97);}(_0x4f03,0x1c9));var _0x34f0=function(_0x1d5a32,_0x47974a){_0x1d5a32=_0x1d5a32-0x0;var _0x361ca0=_0x4f03[_0x1d5a32];return _0x361ca0;};'use strict';var Sequelize=require(_0x34f0('0x0'));module[_0x34f0('0x1')]={'name':{'type':Sequelize[_0x34f0('0x2')],'allowNull':![],'unique':_0x34f0('0x3')},'crudPermissions':{'type':Sequelize[_0x34f0('0x2')],'set':function(_0x23f5a1){this[_0x34f0('0x4')](_0x34f0('0x5'),_0x23f5a1?_0x23f5a1['join'](''):[]);},'get':function(){return this[_0x34f0('0x6')](_0x34f0('0x5'))?this[_0x34f0('0x6')](_0x34f0('0x5'))[_0x34f0('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x34f0('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 5593a7d..4cb148a 100644 --- a/server/api/userProfile/userProfile.controller.js +++ b/server/api/userProfile/userProfile.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7813=['end','error','stack','name','send','index','UserProfile','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','filter','where','merge','map','type','key','VIRTUAL','field','options','count','includeAll','rows','catch','show','params','include','create','clone','find','get','omit','createdAt','crudPermissions','updatedAt','sequelize','body','findAll','each','autoAssociation','UserProfileResource','sectionId','Resources','describe','addSections','transaction','UserProfileSection','userProfileId','push','removeSections','addResources','bulkCreate','removeResources','ids','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','isEmpty','parentSections','findOne','all','ignore','union','pick','foreignKey','resourceFields','resourceIds','forEach','AnalyticExtractedReport','reportType','default','reportId','DefaultReports','CmContact','Tag','color','tag','ThroughTags','value','resourceId','toLowerCase','squareprojects','SquareProject','SquareOdbc','squarerecordings','SquareRecording','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','contexts','VoiceContext','voicerecordings','VoiceRecording','Agents','User','role','agent','Telephones','membername','telephone','queue','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','Campaign','MailQueue','mailaccounts','MailAccount','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','Team','voicequeues','VoiceQueue','QueueCampaigns','users','agents','user','zendeskaccounts','salesforceaccounts','freshdeskaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','Template','triggers','trunks','variables','Plugin','extractedreports','Reports','metrics','AnalyticMetric','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','socket.io-emitter','./userProfile.socket','register','status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x444281,_0x5e0f6a){var _0x182bf1=function(_0xe26e2b){while(--_0xe26e2b){_0x444281['push'](_0x444281['shift']());}};_0x182bf1(++_0x5e0f6a);}(_0x7813,0x1a2));var _0x3781=function(_0x86a8fa,_0x323e96){_0x86a8fa=_0x86a8fa-0x0;var _0x551384=_0x7813[_0x86a8fa];return _0x551384;};'use strict';var pdf=require(_0x3781('0x0'));var emlformat=require(_0x3781('0x1'));var rimraf=require(_0x3781('0x2'));var zipdir=require(_0x3781('0x3'));var jsonpatch=require(_0x3781('0x4'));var rp=require('request-promise');var moment=require(_0x3781('0x5'));var BPromise=require(_0x3781('0x6'));var Mustache=require(_0x3781('0x7'));var util=require(_0x3781('0x8'));var path=require(_0x3781('0x9'));var sox=require(_0x3781('0xa'));var csv=require(_0x3781('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3781('0xc'));var squel=require(_0x3781('0xd'));var crypto=require(_0x3781('0xe'));var jsforce=require(_0x3781('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3781('0xb'));var querystring=require(_0x3781('0x10'));var Papa=require(_0x3781('0x11'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x3781('0x12'));var qs=require(_0x3781('0x13'));var logger=require(_0x3781('0x14'))(_0x3781('0x15'));var utils=require(_0x3781('0x16'));var config=require(_0x3781('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x3781('0x18')](config[_0x3781('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x3781('0x1a'))(new Redis(config[_0x3781('0x19')]));require(_0x3781('0x1b'))[_0x3781('0x1c')](socket);function respondWithStatusCode(_0x109b66,_0x5f5bd6){_0x5f5bd6=_0x5f5bd6||0xcc;return function(_0x21c5fb){if(_0x21c5fb){return _0x109b66['sendStatus'](_0x5f5bd6);}return _0x109b66[_0x3781('0x1d')](_0x5f5bd6)['end']();};}function respondWithResult(_0x1c854c,_0x20c6e3){_0x20c6e3=_0x20c6e3||0xc8;return function(_0x2767e1){if(_0x2767e1){return _0x1c854c['status'](_0x20c6e3)[_0x3781('0x1e')](_0x2767e1);}};}function respondWithFilteredResult(_0x1eae43,_0x3f795a){return function(_0x5a25a6){if(_0x5a25a6){var _0x419b1b=_0x5a25a6['count'],_0x1638d6=_0x3f795a[_0x3781('0x1f')],_0x4bf405=_0x3f795a['offset']+_0x3f795a['limit'],_0x5e0938;if(_0x4bf405>=_0x419b1b){_0x4bf405=_0x419b1b;_0x5e0938=0xc8;}else{_0x5e0938=0xce;}_0x1eae43[_0x3781('0x1d')](_0x5e0938);return _0x1eae43[_0x3781('0x20')](_0x3781('0x21'),_0x1638d6+'-'+_0x4bf405+'/'+_0x419b1b)[_0x3781('0x1e')](_0x5a25a6);}return null;};}function patchUpdates(_0x3cea0c){return function(_0x273103){try{jsonpatch[_0x3781('0x22')](_0x273103,_0x3cea0c,!![]);}catch(_0x4d5501){return BPromise[_0x3781('0x23')](_0x4d5501);}return _0x273103[_0x3781('0x24')]();};}function saveUpdates(_0x35b44e,_0x2b610b){return function(_0x9b1a9f){if(_0x9b1a9f){return _0x9b1a9f[_0x3781('0x25')](_0x35b44e)[_0x3781('0x26')](function(_0x5caa29){return _0x5caa29;});}return null;};}function removeEntity(_0x442860,_0x4de4f9){return function(_0xe02acd){if(_0xe02acd){return _0xe02acd[_0x3781('0x27')]()['then'](function(){_0x442860['status'](0xcc)[_0x3781('0x28')]();});}};}function handleEntityNotFound(_0x5774c1,_0x48267c){return function(_0x23db2a){if(!_0x23db2a){_0x5774c1['sendStatus'](0x194);}return _0x23db2a;};}function handleError(_0x453149,_0x5c6443){_0x5c6443=_0x5c6443||0x1f4;return function(_0x3c013c){logger[_0x3781('0x29')](_0x3c013c[_0x3781('0x2a')]);if(_0x3c013c[_0x3781('0x2b')]){delete _0x3c013c[_0x3781('0x2b')];}_0x453149[_0x3781('0x1d')](_0x5c6443)[_0x3781('0x2c')](_0x3c013c);};}exports[_0x3781('0x2d')]=function(_0xb729c9,_0x49fea8){var _0x484cc6={},_0x390f80={},_0x17ff72={'count':0x0,'rows':[]};var _0x1c5c6b=db[_0x3781('0x2e')][_0x3781('0x2f')];_0x390f80[_0x3781('0x30')]=_[_0x3781('0x31')](_0x1c5c6b);_0x390f80[_0x3781('0x32')]=_[_0x3781('0x31')](_0xb729c9[_0x3781('0x32')]);_0x390f80['filters']=_[_0x3781('0x33')](_0x390f80['model'],_0x390f80['query']);_0x484cc6[_0x3781('0x34')]=_['intersection'](_0x390f80['model'],qs[_0x3781('0x35')](_0xb729c9[_0x3781('0x32')]['fields']));_0x484cc6[_0x3781('0x34')]=_0x484cc6['attributes'][_0x3781('0x36')]?_0x484cc6['attributes']:_0x390f80[_0x3781('0x30')];if(!_0xb729c9[_0x3781('0x32')][_0x3781('0x37')](_0x3781('0x38'))){_0x484cc6[_0x3781('0x39')]=qs[_0x3781('0x39')](_0xb729c9[_0x3781('0x32')]['limit']);_0x484cc6[_0x3781('0x1f')]=qs[_0x3781('0x1f')](_0xb729c9[_0x3781('0x32')][_0x3781('0x1f')]);}_0x484cc6[_0x3781('0x3a')]=qs[_0x3781('0x3b')](_0xb729c9[_0x3781('0x32')]['sort']);_0x484cc6['where']=qs[_0x3781('0x3c')](_['pick'](_0xb729c9['query'],_0x390f80['filters']));if(_0xb729c9[_0x3781('0x32')][_0x3781('0x3d')]){_0x484cc6[_0x3781('0x3e')]=_[_0x3781('0x3f')](_0x484cc6[_0x3781('0x3e')],{'$or':_[_0x3781('0x40')](_0x1c5c6b,function(_0x30f3bd){if(_0x30f3bd[_0x3781('0x41')][_0x3781('0x42')]!==_0x3781('0x43')){var _0x12a18d={};_0x12a18d[_0x30f3bd[_0x3781('0x44')]]={'$like':'%'+_0xb729c9['query'][_0x3781('0x3d')]+'%'};return _0x12a18d;}})});}_0x484cc6=_[_0x3781('0x3f')]({},_0x484cc6,_0xb729c9[_0x3781('0x45')]);var _0xf0ffff={'where':_0x484cc6[_0x3781('0x3e')]};return db[_0x3781('0x2e')][_0x3781('0x46')](_0xf0ffff)['then'](function(_0x157be9){_0x17ff72[_0x3781('0x46')]=_0x157be9;if(_0xb729c9[_0x3781('0x32')][_0x3781('0x47')]){_0x484cc6['include']=[{'all':!![]}];}return db[_0x3781('0x2e')]['findAll'](_0x484cc6);})[_0x3781('0x26')](function(_0x5b8acc){_0x17ff72[_0x3781('0x48')]=_0x5b8acc;return _0x17ff72;})[_0x3781('0x26')](respondWithFilteredResult(_0x49fea8,_0x484cc6))[_0x3781('0x49')](handleError(_0x49fea8,null));};exports[_0x3781('0x4a')]=function(_0x5b498a,_0x27a063){var _0x463726={'raw':![],'where':{'id':_0x5b498a[_0x3781('0x4b')]['id']}},_0x12889d={};_0x12889d[_0x3781('0x30')]=_['keys'](db[_0x3781('0x2e')][_0x3781('0x2f')]);_0x12889d[_0x3781('0x32')]=_[_0x3781('0x31')](_0x5b498a[_0x3781('0x32')]);_0x12889d[_0x3781('0x3c')]=_[_0x3781('0x33')](_0x12889d[_0x3781('0x30')],_0x12889d[_0x3781('0x32')]);_0x463726[_0x3781('0x34')]=_[_0x3781('0x33')](_0x12889d[_0x3781('0x30')],qs['fields'](_0x5b498a[_0x3781('0x32')][_0x3781('0x35')]));_0x463726[_0x3781('0x34')]=_0x463726[_0x3781('0x34')][_0x3781('0x36')]?_0x463726[_0x3781('0x34')]:_0x12889d[_0x3781('0x30')];if(_0x5b498a[_0x3781('0x32')][_0x3781('0x47')]){_0x463726[_0x3781('0x4c')]=[{'all':!![]}];}_0x463726=_[_0x3781('0x3f')]({},_0x463726,_0x5b498a['options']);return db['UserProfile']['find'](_0x463726)[_0x3781('0x26')](handleEntityNotFound(_0x27a063,null))[_0x3781('0x26')](respondWithResult(_0x27a063,null))[_0x3781('0x49')](handleError(_0x27a063,null));};exports[_0x3781('0x4d')]=function(_0x468369,_0x577797){return db[_0x3781('0x2e')][_0x3781('0x4d')](_0x468369['body'],{})[_0x3781('0x26')](respondWithResult(_0x577797,0xc9))[_0x3781('0x49')](handleError(_0x577797,null));};exports[_0x3781('0x4e')]=function(_0x183995,_0x1a01e8){var _0x5cd998={'raw':![],'where':{'id':_0x183995['params']['id']}},_0x1ecd93={};_0x1ecd93['model']=_[_0x3781('0x31')](db[_0x3781('0x2e')][_0x3781('0x2f')]);_0x5cd998[_0x3781('0x34')]=_['intersection'](_0x1ecd93[_0x3781('0x30')],qs['fields'](_0x183995[_0x3781('0x32')]['fields']));_0x5cd998['attributes']=_0x5cd998[_0x3781('0x34')][_0x3781('0x36')]?_0x5cd998[_0x3781('0x34')]:_0x1ecd93[_0x3781('0x30')];if(_0x183995[_0x3781('0x32')][_0x3781('0x47')]){_0x5cd998[_0x3781('0x4c')]=[{'all':!![]}];}_0x5cd998=_[_0x3781('0x3f')]({},_0x5cd998,_0x183995[_0x3781('0x45')]);return db[_0x3781('0x2e')][_0x3781('0x4f')](_0x5cd998)[_0x3781('0x26')](handleEntityNotFound(_0x1a01e8,null))[_0x3781('0x26')](function(_0x52912f){if(_0x52912f){var _0x19065b=_0x52912f[_0x3781('0x50')]({'plain':!![]});_0x19065b=qs[_0x3781('0x51')](_0x19065b,['id',_0x3781('0x52'),'updatedAt',_0x3781('0x53')]);_0x183995['body']=_[_0x3781('0x51')](_0x183995['body'],['id',_0x3781('0x52'),_0x3781('0x54')]);return db[_0x3781('0x55')]['transaction'](function(_0x27de42){return db['UserProfile'][_0x3781('0x4d')](_['merge'](_0x19065b,_0x183995[_0x3781('0x56')]),{'include':_0x183995[_0x3781('0x32')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x27de42})[_0x3781('0x26')](function(_0x5eb1ab){var _0x1b5801=_0x5eb1ab[_0x3781('0x50')]({'plain':!![]});return db['UserProfileSection'][_0x3781('0x57')]({'where':{'userProfileId':_0x183995[_0x3781('0x4b')]['id']},'raw':!![]})['then'](function(_0x20cd6a){if(_0x20cd6a){return BPromise[_0x3781('0x58')](_0x20cd6a,function(_0x221d3e){return new BPromise(function(_0x45d4d4,_0x2f1c87){if(_0x221d3e[_0x3781('0x59')]===null||_0x221d3e[_0x3781('0x59')]===0x1)_0x45d4d4(null);return db[_0x3781('0x5a')][_0x3781('0x57')]({'where':{'sectionId':_0x221d3e['id']},'raw':!![]})['then'](function(_0x368a8e){var _0x400b5a=_[_0x3781('0x40')](_0x368a8e,function(_0x2e0cca){return qs[_0x3781('0x51')](_0x2e0cca,['id',_0x3781('0x52'),_0x3781('0x54'),_0x3781('0x5b')]);});_0x45d4d4(_0x400b5a);})[_0x3781('0x49')](function(_0x53484b){_0x2f1c87(_0x53484b);});})[_0x3781('0x26')](function(_0xbeff13){var _0x75614b=qs[_0x3781('0x51')](_0x221d3e,['id',_0x3781('0x52'),'updatedAt']);_0x75614b['userProfileId']=_0x1b5801['id'];if(_0xbeff13)_0x75614b[_0x3781('0x5c')]=_0xbeff13;return _0x75614b;})[_0x3781('0x26')](function(_0x3e733f){return db['UserProfileSection'][_0x3781('0x4d')](_0x3e733f,{'include':[{'model':db['UserProfileResource'],'as':_0x3781('0x5c')}],'raw':!![],'transaction':_0x27de42});});})[_0x3781('0x26')](function(){return _0x1b5801;});}});});});}})[_0x3781('0x26')](respondWithResult(_0x1a01e8,0xc9))[_0x3781('0x49')](handleError(_0x1a01e8,null));};exports[_0x3781('0x25')]=function(_0x2dc663,_0x1b57cb){if(_0x2dc663[_0x3781('0x56')]['id']){delete _0x2dc663[_0x3781('0x56')]['id'];}return db[_0x3781('0x2e')]['find']({'where':{'id':_0x2dc663[_0x3781('0x4b')]['id']}})[_0x3781('0x26')](handleEntityNotFound(_0x1b57cb,null))[_0x3781('0x26')](saveUpdates(_0x2dc663[_0x3781('0x56')],null))[_0x3781('0x26')](respondWithResult(_0x1b57cb,null))[_0x3781('0x49')](handleError(_0x1b57cb,null));};exports[_0x3781('0x27')]=function(_0x38d4d6,_0xf3cd9e){return db[_0x3781('0x2e')]['find']({'where':{'id':_0x38d4d6[_0x3781('0x4b')]['id']}})[_0x3781('0x26')](handleEntityNotFound(_0xf3cd9e,null))[_0x3781('0x26')](removeEntity(_0xf3cd9e,null))[_0x3781('0x49')](handleError(_0xf3cd9e,null));};exports[_0x3781('0x5d')]=function(_0x8da7a9,_0xe33dd5){return db[_0x3781('0x2e')][_0x3781('0x5d')]()[_0x3781('0x26')](respondWithResult(_0xe33dd5,null))[_0x3781('0x49')](handleError(_0xe33dd5,null));};exports[_0x3781('0x5e')]=function(_0x25d1b7,_0x32a7b6){var _0xfbd4bf=_0x25d1b7[_0x3781('0x56')];return db[_0x3781('0x2e')][_0x3781('0x4f')]({'where':{'id':_0x25d1b7[_0x3781('0x4b')]['id']}})[_0x3781('0x26')](handleEntityNotFound(_0x32a7b6,null))[_0x3781('0x26')](function(_0x48c278){if(_0x48c278){return db[_0x3781('0x55')][_0x3781('0x5f')](function(_0x455b06){return db[_0x3781('0x60')][_0x3781('0x27')]({'where':{'userProfileId':_0x25d1b7['params']['id'],'sectionId':_[_0x3781('0x40')](_0xfbd4bf,function(_0x5e45c9){return _0x5e45c9[_0x3781('0x5b')];})},'transaction':_0x455b06})[_0x3781('0x26')](function(){var _0x68020a=_[_0x3781('0x40')](_0xfbd4bf,function(_0x181b46){_0x181b46[_0x3781('0x61')]=_0x25d1b7[_0x3781('0x4b')]['id'];return _0x181b46;});var _0x36c893=[];return BPromise['each'](_0x68020a,function(_0xca3465){return db[_0x3781('0x60')][_0x3781('0x4d')](_0xca3465,{'include':[{'model':db[_0x3781('0x5a')],'as':_0x3781('0x5c')}],'raw':!![],'transaction':_0x455b06})[_0x3781('0x26')](function(_0x3537bb){_0x36c893[_0x3781('0x62')](_0x3537bb[_0x3781('0x50')]({'plain':!![]}));});})[_0x3781('0x26')](function(){return _0x36c893;});});});}})[_0x3781('0x26')](function(_0xc0d6d1){return _0xc0d6d1;})[_0x3781('0x26')](respondWithResult(_0x32a7b6,null))['catch'](handleError(_0x32a7b6,null));};exports[_0x3781('0x63')]=function(_0x393a69,_0x4d5125){var _0x5fe604;return db[_0x3781('0x2e')][_0x3781('0x4f')]({'where':{'id':_0x393a69[_0x3781('0x4b')]['id']},'attributes':['id',_0x3781('0x2b')]})['then'](handleEntityNotFound(_0x4d5125,null))[_0x3781('0x26')](function(_0x4ab75f){if(_0x4ab75f){_0x5fe604=_0x4ab75f;return db[_0x3781('0x60')][_0x3781('0x27')]({'where':{'userProfileId':_0x393a69['params']['id'],'sectionId':_0x393a69[_0x3781('0x32')]['ids']}});}})[_0x3781('0x26')](function(){return _0x5fe604;})[_0x3781('0x26')](respondWithStatusCode(_0x4d5125,null))['catch'](handleError(_0x4d5125,null));};exports[_0x3781('0x64')]=function(_0x3b1ada,_0x3ae708){return db[_0x3781('0x2e')][_0x3781('0x4f')]({'where':{'id':_0x3b1ada[_0x3781('0x4b')]['id']}})[_0x3781('0x26')](handleEntityNotFound(_0x3ae708,null))['then'](function(_0x12b375){if(_0x12b375){return db['sequelize'][_0x3781('0x5f')](function(_0x50c2c9){return db[_0x3781('0x60')][_0x3781('0x57')]({'where':{'userProfileId':_0x3b1ada[_0x3781('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0x3781('0x26')](function(_0x2d6428){if(_0x2d6428){return db['UserProfileSection'][_0x3781('0x27')]({'where':{'userProfileId':_0x3b1ada[_0x3781('0x4b')]['id'],'id':_['map'](_0x2d6428,function(_0x464e5a){return _0x464e5a['id'];})},'transaction':_0x50c2c9});}})[_0x3781('0x26')](function(_0x51cc71){var _0xce4ad0=_[_0x3781('0x40')](_0x3b1ada[_0x3781('0x56')],function(_0x1ad1cf){_0x1ad1cf[_0x3781('0x61')]=_0x3b1ada[_0x3781('0x4b')]['id'];return _0x1ad1cf;});return db['UserProfileSection'][_0x3781('0x65')](_0xce4ad0,{'raw':!![],'transaction':_0x50c2c9});})[_0x3781('0x26')](function(_0x4b6f6c){var _0x5255eb=_[_0x3781('0x3d')](_[_0x3781('0x40')](_0x4b6f6c,function(_0x211a6b){return _0x211a6b[_0x3781('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x5255eb){return db[_0x3781('0x60')][_0x3781('0x57')]({'where':{'userProfileId':_0x3b1ada[_0x3781('0x4b')]['id'],'sectionId':_['map'](_0x5255eb,function(_0x385a26){return _0x385a26[_0x3781('0x5b')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x3781('0x26')](function(_0x1c99e0){var _0x6982ea=_['map'](_0x3b1ada[_0x3781('0x56')],function(_0x331e9e){_0x331e9e['userProfileId']=_0x3b1ada[_0x3781('0x4b')]['id'];return _0x331e9e;});return db[_0x3781('0x5a')][_0x3781('0x65')](_0x6982ea,{'raw':!![],'transaction':_0x50c2c9});});}})['catch'](handleError(_0x3ae708,null));});}})['then'](function(_0x483cba){var _0x192201=_['map'](_0x483cba,function(_0x1d9241){return _0x1d9241[_0x3781('0x50')]({'plain':!![]});});})['then'](respondWithResult(_0x3ae708,null))[_0x3781('0x49')](handleError(_0x3ae708,null));};exports[_0x3781('0x66')]=function(_0x410ea4,_0x5114cd,_0x373c15){var _0x2e3a23;return db[_0x3781('0x2e')][_0x3781('0x4f')]({'where':{'id':_0x410ea4[_0x3781('0x4b')]['id']}})[_0x3781('0x26')](handleEntityNotFound(_0x5114cd,null))['then'](function(_0x22c306){if(_0x22c306){return _0x22c306[_0x3781('0x66')](_0x410ea4[_0x3781('0x32')][_0x3781('0x67')]);}})[_0x3781('0x26')](respondWithStatusCode(_0x5114cd,null))[_0x3781('0x49')](handleError(_0x5114cd,null));};exports[_0x3781('0x68')]=function(_0x43d22b,_0x2d7435){var _0x486309={'raw':![],'where':{}};var _0x561fb2={};var _0x3c9c81={'count':0x0,'rows':[]};var _0x1531a5=_0x43d22b[_0x3781('0x32')][_0x3781('0x69')];if(typeof _0x1531a5===_0x3781('0x6a')){throw new db[(_0x3781('0x6b'))][(_0x3781('0x6c'))](_0x3781('0x6d'));}var _0x2cadd6=_0x43d22b[_0x3781('0x32')][_0x3781('0x6e')]||![];var _0x4e64cf=getQueryModels(_0x1531a5,_0x2cadd6);if(typeof _0x4e64cf[_0x3781('0x6f')]===_0x3781('0x6a')){throw new db[(_0x3781('0x6b'))]['ValidationError'](_0x3781('0x70')+_0x1531a5+'\x27');}var _0x2b51f1=[];if(!_[_0x3781('0x71')](_0x4e64cf['parentSections'])){_0x2b51f1=_0x4e64cf[_0x3781('0x72')];}else{_0x2b51f1=[{'name':_0x1531a5}];}return db['UserProfile'][_0x3781('0x73')]({'where':{'id':_0x43d22b[_0x3781('0x4b')]['id']}})[_0x3781('0x26')](handleEntityNotFound(_0x2d7435,null))['then'](function(_0x1960e6){if(_0x1960e6){var _0x5c0be9=[];for(var _0x3074c3=0x0;_0x3074c3<_0x2b51f1[_0x3781('0x36')];_0x3074c3++){_0x5c0be9[_0x3781('0x62')](db['UserProfileSection'][_0x3781('0x73')]({'where':{'userProfileId':_0x1960e6['id'],'name':_0x2b51f1[_0x3074c3][_0x3781('0x2b')]},'raw':!![]}));}return BPromise[_0x3781('0x74')](_0x5c0be9);}})[_0x3781('0x26')](function(_0x45d794){var _0x5282c2=_['filter'](_0x45d794,function(_0x23dc0d){return _0x23dc0d?_0x23dc0d:undefined;});var _0x59c85a=_[_0x3781('0x3d')](_0x2b51f1,[_0x3781('0x75'),!![]]);var _0xe2020d=_[_0x3781('0x71')](_0x5282c2)&&_[_0x3781('0x71')](_0x59c85a)?null:_[_0x3781('0x76')](_0x59c85a,_0x5282c2);if(_0xe2020d){var _0xe81e5=[];for(var _0x1f9bdb=0x0;_0x1f9bdb<_0xe2020d['length'];_0x1f9bdb++){var _0x3fdc13=_[_0x3781('0x4f')](_0x2b51f1,function(_0x5118e2){return _0xe2020d[_0x1f9bdb]?_0x5118e2[_0x3781('0x2b')]===_0xe2020d[_0x1f9bdb][_0x3781('0x2b')]:null;});if(_0x3fdc13){if(_0xe2020d[_0x1f9bdb][_0x3781('0x75')]){_0xe81e5['push'](getAllResources(_0x4e64cf[_0x3781('0x6f')],_0xe2020d[_0x1f9bdb]));}else{if(!_0xe2020d[_0x1f9bdb][_0x3781('0x59')]){_0xe81e5[_0x3781('0x62')](getAllowedResources(_0x3fdc13,_0xe2020d[_0x1f9bdb]));}else{if(_0x3fdc13[_0x3781('0x30')]){_0xe81e5[_0x3781('0x62')](getAllFilteredResources(_0x3fdc13,_0xe2020d[_0x1f9bdb]));}}}}}return BPromise[_0x3781('0x74')](_0xe81e5);}else{return null;}})['then'](function(_0x46a410){var _0x164a3f=_0x46a410;var _0x41d12a=null;if(_0x164a3f){_0x41d12a=_0x164a3f['length']===0x1?_0x164a3f[0x0]:null;}if(_0x41d12a||_0x164a3f){var _0x155b4f=db[_0x4e64cf['childModel']][_0x3781('0x2f')];_0x561fb2[_0x3781('0x30')]=_[_0x3781('0x31')](_0x155b4f);_0x561fb2[_0x3781('0x32')]=_[_0x3781('0x31')](_0x43d22b[_0x3781('0x32')]);_0x561fb2['filters']=_['intersection'](_0x561fb2[_0x3781('0x30')],_0x561fb2[_0x3781('0x32')]);_0x486309[_0x3781('0x34')]=_['intersection'](_0x561fb2[_0x3781('0x30')],qs[_0x3781('0x35')](_0x43d22b['query']['fields']));_0x486309[_0x3781('0x34')]=_0x486309['attributes'][_0x3781('0x36')]?_0x486309[_0x3781('0x34')]:_0x561fb2[_0x3781('0x30')];if(!_0x43d22b[_0x3781('0x32')][_0x3781('0x37')](_0x3781('0x38'))){_0x486309['limit']=qs[_0x3781('0x39')](_0x43d22b[_0x3781('0x32')][_0x3781('0x39')]);_0x486309[_0x3781('0x1f')]=qs[_0x3781('0x1f')](_0x43d22b[_0x3781('0x32')]['offset']);}_0x486309[_0x3781('0x3a')]=qs[_0x3781('0x3b')](_0x43d22b[_0x3781('0x32')]['sort']);_0x486309['where']=qs[_0x3781('0x3c')](_[_0x3781('0x77')](_0x43d22b[_0x3781('0x32')],_0x561fb2[_0x3781('0x3c')]));var _0x2f673b=[];if(_0x41d12a){var _0x250e45=_[_0x3781('0x4f')](_0x2b51f1,[_0x3781('0x2b'),_0x41d12a[_0x3781('0x2b')]]);if(_0x250e45[_0x3781('0x44')]){var _0x1c64da={};_0x1c64da[_0x250e45[_0x3781('0x78')]]=_0x41d12a[_0x3781('0x79')];_0x2f673b[_0x3781('0x62')](_0x1c64da);}else{_0x486309[_0x3781('0x3e')]['id']=_0x41d12a['resourceIds'];}}else{var _0x2f673b=[];for(var _0x10ba90=0x0;_0x10ba90<_0x164a3f[_0x3781('0x36')];_0x10ba90++){var _0x250e45=_[_0x3781('0x4f')](_0x2b51f1,['name',_0x164a3f[_0x10ba90]['name']]);if(_0x250e45['field']){var _0x1c64da={};if(_0x250e45['field']==='id'){_0x1c64da[_0x250e45[_0x3781('0x78')]]=_0x164a3f[_0x10ba90][_0x3781('0x7a')];}else{_0x1c64da[_0x250e45[_0x3781('0x78')]]=_0x164a3f[_0x10ba90][_0x3781('0x79')];}_0x2f673b[_0x3781('0x62')](_0x1c64da);}else{if(!_0x486309[_0x3781('0x3e')]['id'])_0x486309[_0x3781('0x3e')]['id']=[];_0x164a3f[_0x10ba90]['resourceIds'][_0x3781('0x7b')](function(_0x2594e1){_0x486309[_0x3781('0x3e')]['id'][_0x3781('0x62')](_0x2594e1);});}}}if(!_[_0x3781('0x71')](_0x2f673b)){_0x486309['where']=_[_0x3781('0x3f')](_0x486309[_0x3781('0x3e')],{'$or':_0x2f673b});}if(_0x43d22b[_0x3781('0x32')]['filter']){_0x486309[_0x3781('0x3e')]=_['merge'](_0x486309[_0x3781('0x3e')],{'$or':_[_0x3781('0x40')](_0x155b4f,function(_0x5d8293){if(_0x5d8293['type']['key']!==_0x3781('0x43')){var _0x494866={};_0x494866[_0x5d8293[_0x3781('0x44')]]={'$like':'%'+_0x43d22b[_0x3781('0x32')][_0x3781('0x3d')]+'%'};return _0x494866;}})});}_0x486309=_[_0x3781('0x3f')]({},_0x486309,_0x43d22b[_0x3781('0x45')]);if(_0x41d12a&&!_0x41d12a[_0x3781('0x59')]&&_0x4e64cf['childModel']===_0x3781('0x7c')){if(_0x43d22b[_0x3781('0x32')]['includeAll']){_0x486309[_0x3781('0x4c')]=[{'all':!![]}];}return db[_0x4e64cf[_0x3781('0x6f')]][_0x3781('0x57')](_0x486309)['then'](function(_0x202b06){var _0x135f62=[];_0x202b06[_0x3781('0x7b')](function(_0x22ad69){var _0x39bef4;switch(_0x22ad69[_0x3781('0x7d')]){case _0x3781('0x7e'):_0x39bef4=_['find'](_0x41d12a[_0x3781('0x7a')],function(_0x264b48){return _0x264b48['id']===_0x22ad69[_0x3781('0x7f')]&&_0x264b48[_0x3781('0x41')]===_0x3781('0x80');});break;case'custom':_0x39bef4=_[_0x3781('0x4f')](_0x41d12a[_0x3781('0x7a')],function(_0x4ded3d){return _0x4ded3d['id']===_0x22ad69['reportId']&&_0x4ded3d['type']==='CustomReports';});break;}if(_0x39bef4)_0x135f62['push'](_0x22ad69);});_0x3c9c81[_0x3781('0x46')]=_0x135f62['length'];_0x3c9c81['rows']=_0x135f62;return _0x3c9c81;});}else{return db[_0x4e64cf[_0x3781('0x6f')]][_0x3781('0x46')]({'where':_0x486309[_0x3781('0x3e')]})[_0x3781('0x26')](function(_0x3cab39){_0x3c9c81[_0x3781('0x46')]=_0x3cab39;if(_0x43d22b[_0x3781('0x32')][_0x3781('0x47')]){if(_0x4e64cf[_0x3781('0x6f')]===_0x3781('0x81')){_0x486309['include']=[{'model':db[_0x3781('0x82')],'as':'Tags','attributes':['id',_0x3781('0x2b'),_0x3781('0x83')],'required':_0x43d22b[_0x3781('0x32')][_0x3781('0x84')]?!![]:![]},{'model':db['Tag'],'as':_0x3781('0x85'),'attributes':['id',_0x3781('0x2b'),'color'],'through':_0x43d22b[_0x3781('0x32')]['tag']?{'attributes':[],'where':{'TagId':_0x43d22b[_0x3781('0x32')]['tag']||undefined}}:{},'required':_0x43d22b[_0x3781('0x32')][_0x3781('0x84')]?!![]:![]}];}else{_0x486309[_0x3781('0x4c')]=[{'all':!![]}];}}return db[_0x4e64cf[_0x3781('0x6f')]][_0x3781('0x57')](_0x486309);})[_0x3781('0x26')](function(_0x12d5a8){_0x3c9c81['rows']=_0x12d5a8;return _0x3c9c81;});}}else{return _0x3c9c81;}})[_0x3781('0x26')](respondWithFilteredResult(_0x2d7435,_0x486309))[_0x3781('0x49')](handleError(_0x2d7435,null));};function getAllResources(_0x462168,_0x48f571){return new BPromise(function(_0xfc1c6,_0x39742a){if(_0x48f571){var _0x1ecb7a=_0x48f571[_0x3781('0x3d')]?{[_0x48f571[_0x3781('0x3d')][_0x3781('0x44')]]:_0x48f571['filter']['value']}:undefined;return db[_0x462168][_0x3781('0x57')]({'where':_0x1ecb7a,'raw':!![]})[_0x3781('0x26')](function(_0x2bb39e){_0x48f571['resourceIds']=_[_0x3781('0x40')](_0x2bb39e,'id');_0xfc1c6(_0x48f571);})[_0x3781('0x49')](function(_0x1fc931){_0x39742a(_0x1fc931);});}else{_0xfc1c6(null);}});}function getAllFilteredResources(_0x55a2f7,_0x4ec324){return new BPromise(function(_0x53c07b,_0x5d5563){var _0x2323a7=_0x55a2f7['filter']?{[_0x55a2f7[_0x3781('0x3d')][_0x3781('0x44')]]:_0x55a2f7[_0x3781('0x3d')][_0x3781('0x86')]}:undefined;return db[_0x55a2f7[_0x3781('0x30')]][_0x3781('0x57')]({'where':_0x2323a7,'raw':!![]})['then'](function(_0x486740){_0x4ec324[_0x3781('0x79')]=_[_0x3781('0x40')](_0x486740,function(_0x5b7f11){return _0x5b7f11['name'];});_0x53c07b(_0x4ec324);})[_0x3781('0x49')](function(_0x9f0114){_0x5d5563(_0x9f0114);});});}function getAllowedResources(_0x8e1a17,_0x4a7b54){return new BPromise(function(_0x299642,_0x10ccde){if(_0x4a7b54){return db[_0x3781('0x5a')][_0x3781('0x57')]({'where':{'sectionId':_0x4a7b54['id']},'raw':!![]})[_0x3781('0x26')](function(_0x77e9a3){if(_0x8e1a17[_0x3781('0x44')]&&_0x8e1a17[_0x3781('0x44')]!=='id'){_0x4a7b54[_0x3781('0x79')]=_[_0x3781('0x40')](_0x77e9a3,function(_0x301e87){return _0x301e87[_0x8e1a17[_0x3781('0x44')]];});}else{if(_0x8e1a17[_0x3781('0x6f')]==='AnalyticExtractedReport'){_0x4a7b54[_0x3781('0x7a')]=_[_0x3781('0x40')](_0x77e9a3,function(_0x160eec){return{'id':_0x160eec[_0x3781('0x87')],'type':_0x160eec[_0x3781('0x41')]};});}else{_0x4a7b54[_0x3781('0x7a')]=_[_0x3781('0x40')](_0x77e9a3,function(_0x5cdf26){return _0x5cdf26['resourceId'];});}}_0x299642(_0x4a7b54);})[_0x3781('0x49')](function(_0x209201){_0x10ccde(_0x209201);});}else{_0x299642(null);}});}function getQueryModels(_0x4a7293,_0x42341b){var _0x4362ea=_0x4a7293[_0x3781('0x88')]();var _0x126682={'childModel':undefined,'parentSections':[]};switch(_0x4362ea){case _0x3781('0x89'):_0x126682[_0x3781('0x6f')]=_0x3781('0x8a');break;case'odbc':_0x126682['childModel']=_0x3781('0x8b');break;case _0x3781('0x8c'):_0x126682['childModel']=_0x3781('0x8d');_0x126682[_0x3781('0x72')]=[{'name':'SquareProjects','field':_0x3781('0x2b'),'foreignKey':_0x3781('0x8e')}];break;case _0x3781('0x8f'):_0x126682[_0x3781('0x6f')]=_0x3781('0x90');break;case _0x3781('0x91'):_0x126682[_0x3781('0x6f')]='CmContact';_0x126682[_0x3781('0x72')]=[{'name':_0x3781('0x92'),'field':'id','foreignKey':_0x3781('0x93')}];break;case _0x3781('0x94'):_0x126682[_0x3781('0x6f')]=_0x3781('0x95');break;case _0x3781('0x96'):_0x126682[_0x3781('0x6f')]=_0x3781('0x97');break;case _0x3781('0x98'):_0x126682['childModel']='CmCustomField';break;case _0x3781('0x99'):_0x126682[_0x3781('0x6f')]=_0x3781('0x9a');break;case _0x3781('0x9b'):_0x126682['childModel']=_0x3781('0x9c');break;case _0x3781('0x9d'):_0x126682[_0x3781('0x6f')]=_0x3781('0x9e');break;case _0x3781('0x9f'):_0x126682[_0x3781('0x6f')]=_0x3781('0xa0');break;case'inboundroutes':case _0x3781('0xa1'):case _0x3781('0xa2'):_0x126682[_0x3781('0x6f')]='VoiceExtension';break;case _0x3781('0xa3'):_0x126682[_0x3781('0x6f')]=_0x3781('0xa4');break;case'voicemails':_0x126682[_0x3781('0x6f')]='VoiceMail';break;case _0x3781('0xa5'):_0x126682[_0x3781('0x6f')]=_0x3781('0xa6');_0x126682[_0x3781('0x72')]=[{'name':_0x3781('0xa7'),'field':_0x3781('0x2b'),'foreignKey':'membername','model':_0x3781('0xa8'),'filter':{'field':_0x3781('0xa9'),'value':[_0x3781('0xaa')]}},{'name':_0x3781('0xab'),'field':_0x3781('0x2b'),'foreignKey':_0x3781('0xac'),'model':_0x3781('0xa8'),'filter':{'field':_0x3781('0xa9'),'value':[_0x3781('0xad')]}},{'name':'VoiceQueues','field':_0x3781('0x2b'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x3781('0x41'),'value':['inbound']}},{'name':'QueueCampaigns','field':_0x3781('0x2b'),'foreignKey':_0x3781('0xae'),'model':'VoiceQueue','filter':{'field':_0x3781('0x41'),'value':[_0x3781('0xaf')]}}];break;case _0x3781('0xb0'):_0x126682['childModel']=_0x3781('0xb1');break;case'chanspies':_0x126682['childModel']=_0x3781('0xb2');break;case _0x3781('0xb3'):_0x126682[_0x3781('0x6f')]='VoicePrefix';break;case'ivrcampaigns':_0x126682['childModel']=_0x3781('0xb4');break;case'mailqueues':_0x126682[_0x3781('0x6f')]=_0x3781('0xb5');break;case _0x3781('0xb6'):_0x126682['childModel']=_0x3781('0xb7');break;case'mailsubstatuses':_0x126682['childModel']='MailSubstatus';break;case _0x3781('0xb8'):_0x126682[_0x3781('0x6f')]=_0x3781('0xb9');break;case _0x3781('0xba'):_0x126682[_0x3781('0x6f')]='OpenchannelAccount';break;case _0x3781('0xbb'):_0x126682[_0x3781('0x6f')]=_0x3781('0xbc');break;case _0x3781('0xbd'):_0x126682[_0x3781('0x6f')]='SmsAccount';break;case'teams':_0x126682['childModel']=_0x3781('0xbe');break;case _0x3781('0xbf'):case'queuecampaigns':_0x126682[_0x3781('0x6f')]=_0x3781('0xc0');if(_0x42341b){_0x126682['parentSections']=[{'name':'VoiceQueues'},{'name':_0x3781('0xc1')}];}break;case _0x3781('0xc2'):case _0x3781('0xc3'):case'telephones':_0x126682[_0x3781('0x6f')]=_0x3781('0xa8');if(_0x42341b){_0x126682[_0x3781('0x72')]=[{'name':'Users','filter':{'field':_0x3781('0xa9'),'value':['admin',_0x3781('0xc4')]},'ignore':!![]},{'name':_0x3781('0xa7')},{'name':_0x3781('0xab')}];}break;case _0x3781('0xc5'):_0x126682[_0x3781('0x6f')]='ZendeskAccount';break;case _0x3781('0xc6'):_0x126682['childModel']='SalesforceAccount';break;case _0x3781('0xc7'):_0x126682[_0x3781('0x6f')]='FreshdeskAccount';break;case'sugarcrmaccounts':_0x126682[_0x3781('0x6f')]=_0x3781('0xc8');break;case _0x3781('0xc9'):_0x126682['childModel']='DeskAccount';break;case _0x3781('0xca'):_0x126682[_0x3781('0x6f')]=_0x3781('0xcb');break;case _0x3781('0xcc'):_0x126682['childModel']=_0x3781('0xa8');break;case _0x3781('0xcd'):_0x126682['childModel']=_0x3781('0xce');break;case _0x3781('0xcf'):_0x126682[_0x3781('0x6f')]=_0x3781('0xd0');break;case _0x3781('0xd1'):_0x126682['childModel']='Dashboard';break;case _0x3781('0xd2'):_0x126682[_0x3781('0x6f')]=_0x3781('0xd3');break;case _0x3781('0xd4'):_0x126682[_0x3781('0x6f')]=_0x3781('0xd5');break;case _0x3781('0xd6'):_0x126682['childModel']=_0x3781('0xd7');break;case _0x3781('0xd8'):_0x126682[_0x3781('0x6f')]=_0x3781('0xd9');break;case _0x3781('0xda'):_0x126682[_0x3781('0x6f')]=_0x3781('0x82');break;case _0x3781('0xdb'):_0x126682['childModel']=_0x3781('0xdc');break;case _0x3781('0xdd'):_0x126682[_0x3781('0x6f')]='Trigger';break;case _0x3781('0xde'):_0x126682[_0x3781('0x6f')]='Trunk';break;case _0x3781('0xdf'):_0x126682[_0x3781('0x6f')]='Variable';break;case'plugins':_0x126682[_0x3781('0x6f')]=_0x3781('0xe0');break;case _0x3781('0xe1'):_0x126682['childModel']=_0x3781('0x7c');_0x126682['parentSections']=[{'name':_0x3781('0xe2'),'field':'id','foreignKey':_0x3781('0x7f')}];break;case _0x3781('0xe3'):_0x126682[_0x3781('0x6f')]=_0x3781('0xe4');break;default:return _0x126682;}return _0x126682;} \ No newline at end of file +var _0x2e01=['fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','map','type','key','VIRTUAL','field','options','count','includeAll','include','rows','catch','show','params','rawAttributes','merge','create','clone','find','get','omit','createdAt','body','updatedAt','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','findAll','sectionId','userProfileId','Resources','describe','push','removeSections','ids','addResources','bulkCreate','removeResources','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','isEmpty','parentSections','findOne','all','ignore','union','order','pick','foreignKey','resourceFields','resourceIds','forEach','AnalyticExtractedReport','reportType','default','reportId','custom','CustomReports','Tag','Tags','tag','ThroughTags','color','value','resourceId','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareProjects','projectName','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmCompany','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','role','agent','User','telephone','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','teams','Team','VoiceQueues','users','agents','telephones','admin','user','Telephones','ZendeskAccount','salesforceaccounts','SalesforceAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','Schedule','sounds','Sound','tags','templates','Template','triggers','Trigger','trunks','Trunk','variables','Plugin','extractedreports','AnalyticMetric','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','index','UserProfile','keys','query','filters','intersection','model'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x2e01,0xb9));var _0x12e0=function(_0x3fd6b8,_0x28e324){_0x3fd6b8=_0x3fd6b8-0x0;var _0x33b7be=_0x2e01[_0x3fd6b8];return _0x33b7be;};'use strict';var pdf=require(_0x12e0('0x0'));var emlformat=require(_0x12e0('0x1'));var rimraf=require(_0x12e0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x12e0('0x3'));var rp=require('request-promise');var moment=require(_0x12e0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x12e0('0x5'));var util=require('util');var path=require('path');var sox=require(_0x12e0('0x6'));var csv=require(_0x12e0('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x12e0('0x8'));var squel=require(_0x12e0('0x9'));var crypto=require(_0x12e0('0xa'));var jsforce=require(_0x12e0('0xb'));var deskjs=require(_0x12e0('0xc'));var toCsv=require(_0x12e0('0x7'));var querystring=require(_0x12e0('0xd'));var Papa=require(_0x12e0('0xe'));var authService=require(_0x12e0('0xf'));var hardwareService=require(_0x12e0('0x10'));var Redis=require('ioredis');var qs=require(_0x12e0('0x11'));var logger=require(_0x12e0('0x12'))(_0x12e0('0x13'));var utils=require(_0x12e0('0x14'));var config=require(_0x12e0('0x15'));var db=require(_0x12e0('0x16'))['db'];config[_0x12e0('0x17')]=_[_0x12e0('0x18')](config['redis'],{'host':_0x12e0('0x19'),'port':0x18eb});var socket=require(_0x12e0('0x1a'))(new Redis(config[_0x12e0('0x17')]));require(_0x12e0('0x1b'))[_0x12e0('0x1c')](socket);function respondWithStatusCode(_0x16f895,_0x5a4681){_0x5a4681=_0x5a4681||0xcc;return function(_0x1aefc5){if(_0x1aefc5){return _0x16f895[_0x12e0('0x1d')](_0x5a4681);}return _0x16f895[_0x12e0('0x1e')](_0x5a4681)[_0x12e0('0x1f')]();};}function respondWithResult(_0x47d2c8,_0x1982d1){_0x1982d1=_0x1982d1||0xc8;return function(_0x119aba){if(_0x119aba){return _0x47d2c8[_0x12e0('0x1e')](_0x1982d1)[_0x12e0('0x20')](_0x119aba);}};}function respondWithFilteredResult(_0x4ca65b,_0x2a62a3){return function(_0x35257b){if(_0x35257b){var _0x3da2b1=_0x35257b['count'],_0x22492b=_0x2a62a3[_0x12e0('0x21')],_0x944831=_0x2a62a3['offset']+_0x2a62a3[_0x12e0('0x22')],_0x2af334;if(_0x944831>=_0x3da2b1){_0x944831=_0x3da2b1;_0x2af334=0xc8;}else{_0x2af334=0xce;}_0x4ca65b[_0x12e0('0x1e')](_0x2af334);return _0x4ca65b[_0x12e0('0x23')](_0x12e0('0x24'),_0x22492b+'-'+_0x944831+'/'+_0x3da2b1)[_0x12e0('0x20')](_0x35257b);}return null;};}function patchUpdates(_0xbf2ec){return function(_0x37e0a3){try{jsonpatch[_0x12e0('0x25')](_0x37e0a3,_0xbf2ec,!![]);}catch(_0x430aca){return BPromise[_0x12e0('0x26')](_0x430aca);}return _0x37e0a3[_0x12e0('0x27')]();};}function saveUpdates(_0x3c212f,_0x5da733){return function(_0x5ae512){if(_0x5ae512){return _0x5ae512[_0x12e0('0x28')](_0x3c212f)['then'](function(_0x576aac){return _0x576aac;});}return null;};}function removeEntity(_0x4b4ff5,_0x2b4bd3){return function(_0x5c0b58){if(_0x5c0b58){return _0x5c0b58[_0x12e0('0x29')]()[_0x12e0('0x2a')](function(){_0x4b4ff5[_0x12e0('0x1e')](0xcc)[_0x12e0('0x1f')]();});}};}function handleEntityNotFound(_0x2e4932,_0x39bea){return function(_0x2a3a93){if(!_0x2a3a93){_0x2e4932['sendStatus'](0x194);}return _0x2a3a93;};}function handleError(_0xffca87,_0x203fbc){_0x203fbc=_0x203fbc||0x1f4;return function(_0x5e29d6){logger['error'](_0x5e29d6['stack']);if(_0x5e29d6[_0x12e0('0x2b')]){delete _0x5e29d6['name'];}_0xffca87[_0x12e0('0x1e')](_0x203fbc)[_0x12e0('0x2c')](_0x5e29d6);};}exports[_0x12e0('0x2d')]=function(_0x160b53,_0x12eecd){var _0x71d601={},_0xa9a931={},_0x2d0c3e={'count':0x0,'rows':[]};var _0x493ce6=db[_0x12e0('0x2e')]['rawAttributes'];_0xa9a931['model']=_[_0x12e0('0x2f')](_0x493ce6);_0xa9a931[_0x12e0('0x30')]=_[_0x12e0('0x2f')](_0x160b53[_0x12e0('0x30')]);_0xa9a931[_0x12e0('0x31')]=_[_0x12e0('0x32')](_0xa9a931[_0x12e0('0x33')],_0xa9a931[_0x12e0('0x30')]);_0x71d601['attributes']=_['intersection'](_0xa9a931[_0x12e0('0x33')],qs[_0x12e0('0x34')](_0x160b53[_0x12e0('0x30')][_0x12e0('0x34')]));_0x71d601[_0x12e0('0x35')]=_0x71d601[_0x12e0('0x35')][_0x12e0('0x36')]?_0x71d601['attributes']:_0xa9a931[_0x12e0('0x33')];if(!_0x160b53[_0x12e0('0x30')][_0x12e0('0x37')](_0x12e0('0x38'))){_0x71d601[_0x12e0('0x22')]=qs['limit'](_0x160b53[_0x12e0('0x30')]['limit']);_0x71d601[_0x12e0('0x21')]=qs[_0x12e0('0x21')](_0x160b53[_0x12e0('0x30')][_0x12e0('0x21')]);}_0x71d601['order']=qs[_0x12e0('0x39')](_0x160b53[_0x12e0('0x30')]['sort']);_0x71d601[_0x12e0('0x3a')]=qs[_0x12e0('0x31')](_['pick'](_0x160b53[_0x12e0('0x30')],_0xa9a931['filters']));if(_0x160b53[_0x12e0('0x30')][_0x12e0('0x3b')]){_0x71d601['where']=_['merge'](_0x71d601[_0x12e0('0x3a')],{'$or':_[_0x12e0('0x3c')](_0x493ce6,function(_0x1aa7b2){if(_0x1aa7b2[_0x12e0('0x3d')][_0x12e0('0x3e')]!==_0x12e0('0x3f')){var _0x514471={};_0x514471[_0x1aa7b2[_0x12e0('0x40')]]={'$like':'%'+_0x160b53[_0x12e0('0x30')][_0x12e0('0x3b')]+'%'};return _0x514471;}})});}_0x71d601=_['merge']({},_0x71d601,_0x160b53[_0x12e0('0x41')]);var _0x5958c6={'where':_0x71d601['where']};return db[_0x12e0('0x2e')][_0x12e0('0x42')](_0x5958c6)[_0x12e0('0x2a')](function(_0x109f6d){_0x2d0c3e[_0x12e0('0x42')]=_0x109f6d;if(_0x160b53[_0x12e0('0x30')][_0x12e0('0x43')]){_0x71d601[_0x12e0('0x44')]=[{'all':!![]}];}return db[_0x12e0('0x2e')]['findAll'](_0x71d601);})[_0x12e0('0x2a')](function(_0x3c8103){_0x2d0c3e[_0x12e0('0x45')]=_0x3c8103;return _0x2d0c3e;})[_0x12e0('0x2a')](respondWithFilteredResult(_0x12eecd,_0x71d601))[_0x12e0('0x46')](handleError(_0x12eecd,null));};exports[_0x12e0('0x47')]=function(_0x4a99fb,_0x56a719){var _0x237937={'raw':![],'where':{'id':_0x4a99fb[_0x12e0('0x48')]['id']}},_0x56d4ce={};_0x56d4ce[_0x12e0('0x33')]=_['keys'](db[_0x12e0('0x2e')][_0x12e0('0x49')]);_0x56d4ce['query']=_[_0x12e0('0x2f')](_0x4a99fb[_0x12e0('0x30')]);_0x56d4ce[_0x12e0('0x31')]=_[_0x12e0('0x32')](_0x56d4ce['model'],_0x56d4ce['query']);_0x237937['attributes']=_[_0x12e0('0x32')](_0x56d4ce[_0x12e0('0x33')],qs[_0x12e0('0x34')](_0x4a99fb['query'][_0x12e0('0x34')]));_0x237937['attributes']=_0x237937[_0x12e0('0x35')]['length']?_0x237937[_0x12e0('0x35')]:_0x56d4ce[_0x12e0('0x33')];if(_0x4a99fb[_0x12e0('0x30')][_0x12e0('0x43')]){_0x237937[_0x12e0('0x44')]=[{'all':!![]}];}_0x237937=_[_0x12e0('0x4a')]({},_0x237937,_0x4a99fb[_0x12e0('0x41')]);return db[_0x12e0('0x2e')]['find'](_0x237937)[_0x12e0('0x2a')](handleEntityNotFound(_0x56a719,null))[_0x12e0('0x2a')](respondWithResult(_0x56a719,null))[_0x12e0('0x46')](handleError(_0x56a719,null));};exports[_0x12e0('0x4b')]=function(_0xd05a2,_0x22eebc){return db[_0x12e0('0x2e')][_0x12e0('0x4b')](_0xd05a2['body'],{})[_0x12e0('0x2a')](respondWithResult(_0x22eebc,0xc9))[_0x12e0('0x46')](handleError(_0x22eebc,null));};exports[_0x12e0('0x4c')]=function(_0x1f41fe,_0x490cc1){var _0x53d47b={'raw':![],'where':{'id':_0x1f41fe[_0x12e0('0x48')]['id']}},_0xd2c68d={};_0xd2c68d[_0x12e0('0x33')]=_['keys'](db[_0x12e0('0x2e')][_0x12e0('0x49')]);_0x53d47b['attributes']=_[_0x12e0('0x32')](_0xd2c68d[_0x12e0('0x33')],qs[_0x12e0('0x34')](_0x1f41fe[_0x12e0('0x30')][_0x12e0('0x34')]));_0x53d47b[_0x12e0('0x35')]=_0x53d47b[_0x12e0('0x35')][_0x12e0('0x36')]?_0x53d47b[_0x12e0('0x35')]:_0xd2c68d[_0x12e0('0x33')];if(_0x1f41fe[_0x12e0('0x30')][_0x12e0('0x43')]){_0x53d47b[_0x12e0('0x44')]=[{'all':!![]}];}_0x53d47b=_[_0x12e0('0x4a')]({},_0x53d47b,_0x1f41fe[_0x12e0('0x41')]);return db['UserProfile'][_0x12e0('0x4d')](_0x53d47b)['then'](handleEntityNotFound(_0x490cc1,null))[_0x12e0('0x2a')](function(_0x643793){if(_0x643793){var _0x108e67=_0x643793[_0x12e0('0x4e')]({'plain':!![]});_0x108e67=qs[_0x12e0('0x4f')](_0x108e67,['id',_0x12e0('0x50'),'updatedAt','crudPermissions']);_0x1f41fe[_0x12e0('0x51')]=_[_0x12e0('0x4f')](_0x1f41fe[_0x12e0('0x51')],['id',_0x12e0('0x50'),_0x12e0('0x52')]);return db[_0x12e0('0x53')][_0x12e0('0x54')](function(_0x148584){return db[_0x12e0('0x2e')][_0x12e0('0x4b')](_[_0x12e0('0x4a')](_0x108e67,_0x1f41fe[_0x12e0('0x51')]),{'include':_0x1f41fe['query'][_0x12e0('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x148584})[_0x12e0('0x2a')](function(_0xf1662d){var _0x462ee4=_0xf1662d[_0x12e0('0x4e')]({'plain':!![]});return db[_0x12e0('0x55')]['findAll']({'where':{'userProfileId':_0x1f41fe[_0x12e0('0x48')]['id']},'raw':!![]})['then'](function(_0x231199){if(_0x231199){return BPromise[_0x12e0('0x56')](_0x231199,function(_0x39652d){return new BPromise(function(_0x12d9ec,_0x57539c){if(_0x39652d[_0x12e0('0x57')]===null||_0x39652d[_0x12e0('0x57')]===0x1)_0x12d9ec(null);return db[_0x12e0('0x58')][_0x12e0('0x59')]({'where':{'sectionId':_0x39652d['id']},'raw':!![]})[_0x12e0('0x2a')](function(_0x41b3f9){var _0x5a1843=_[_0x12e0('0x3c')](_0x41b3f9,function(_0x40a8b7){return qs[_0x12e0('0x4f')](_0x40a8b7,['id','createdAt','updatedAt',_0x12e0('0x5a')]);});_0x12d9ec(_0x5a1843);})['catch'](function(_0x31bdb0){_0x57539c(_0x31bdb0);});})[_0x12e0('0x2a')](function(_0x2b4a31){var _0x4f54c6=qs[_0x12e0('0x4f')](_0x39652d,['id',_0x12e0('0x50'),_0x12e0('0x52')]);_0x4f54c6[_0x12e0('0x5b')]=_0x462ee4['id'];if(_0x2b4a31)_0x4f54c6[_0x12e0('0x5c')]=_0x2b4a31;return _0x4f54c6;})[_0x12e0('0x2a')](function(_0x14ba0c){return db[_0x12e0('0x55')]['create'](_0x14ba0c,{'include':[{'model':db[_0x12e0('0x58')],'as':'Resources'}],'raw':!![],'transaction':_0x148584});});})['then'](function(){return _0x462ee4;});}});});});}})[_0x12e0('0x2a')](respondWithResult(_0x490cc1,0xc9))[_0x12e0('0x46')](handleError(_0x490cc1,null));};exports[_0x12e0('0x28')]=function(_0xd9587,_0x565a32){if(_0xd9587[_0x12e0('0x51')]['id']){delete _0xd9587[_0x12e0('0x51')]['id'];}return db[_0x12e0('0x2e')][_0x12e0('0x4d')]({'where':{'id':_0xd9587[_0x12e0('0x48')]['id']}})['then'](handleEntityNotFound(_0x565a32,null))[_0x12e0('0x2a')](saveUpdates(_0xd9587['body'],null))[_0x12e0('0x2a')](respondWithResult(_0x565a32,null))[_0x12e0('0x46')](handleError(_0x565a32,null));};exports['destroy']=function(_0x645d67,_0x4987d0){return db['UserProfile']['find']({'where':{'id':_0x645d67[_0x12e0('0x48')]['id']}})[_0x12e0('0x2a')](handleEntityNotFound(_0x4987d0,null))[_0x12e0('0x2a')](removeEntity(_0x4987d0,null))[_0x12e0('0x46')](handleError(_0x4987d0,null));};exports[_0x12e0('0x5d')]=function(_0x2d72a4,_0x582bc1){return db[_0x12e0('0x2e')][_0x12e0('0x5d')]()[_0x12e0('0x2a')](respondWithResult(_0x582bc1,null))[_0x12e0('0x46')](handleError(_0x582bc1,null));};exports['addSections']=function(_0x4398dc,_0x1f0a92){var _0x111240=_0x4398dc['body'];return db[_0x12e0('0x2e')][_0x12e0('0x4d')]({'where':{'id':_0x4398dc['params']['id']}})[_0x12e0('0x2a')](handleEntityNotFound(_0x1f0a92,null))[_0x12e0('0x2a')](function(_0x1a26ef){if(_0x1a26ef){return db[_0x12e0('0x53')][_0x12e0('0x54')](function(_0x4e92b5){return db['UserProfileSection'][_0x12e0('0x29')]({'where':{'userProfileId':_0x4398dc['params']['id'],'sectionId':_['map'](_0x111240,function(_0x14bac8){return _0x14bac8[_0x12e0('0x5a')];})},'transaction':_0x4e92b5})[_0x12e0('0x2a')](function(){var _0x532794=_[_0x12e0('0x3c')](_0x111240,function(_0x1fc277){_0x1fc277[_0x12e0('0x5b')]=_0x4398dc[_0x12e0('0x48')]['id'];return _0x1fc277;});var _0x308543=[];return BPromise[_0x12e0('0x56')](_0x532794,function(_0x435647){return db[_0x12e0('0x55')][_0x12e0('0x4b')](_0x435647,{'include':[{'model':db[_0x12e0('0x58')],'as':_0x12e0('0x5c')}],'raw':!![],'transaction':_0x4e92b5})[_0x12e0('0x2a')](function(_0x3f2adf){_0x308543[_0x12e0('0x5e')](_0x3f2adf['get']({'plain':!![]}));});})[_0x12e0('0x2a')](function(){return _0x308543;});});});}})[_0x12e0('0x2a')](function(_0x195125){return _0x195125;})[_0x12e0('0x2a')](respondWithResult(_0x1f0a92,null))[_0x12e0('0x46')](handleError(_0x1f0a92,null));};exports[_0x12e0('0x5f')]=function(_0x18f7df,_0x5458f4){var _0x1cd66a;return db[_0x12e0('0x2e')]['find']({'where':{'id':_0x18f7df[_0x12e0('0x48')]['id']},'attributes':['id',_0x12e0('0x2b')]})['then'](handleEntityNotFound(_0x5458f4,null))[_0x12e0('0x2a')](function(_0x2a9cd5){if(_0x2a9cd5){_0x1cd66a=_0x2a9cd5;return db[_0x12e0('0x55')][_0x12e0('0x29')]({'where':{'userProfileId':_0x18f7df[_0x12e0('0x48')]['id'],'sectionId':_0x18f7df[_0x12e0('0x30')][_0x12e0('0x60')]}});}})[_0x12e0('0x2a')](function(){return _0x1cd66a;})[_0x12e0('0x2a')](respondWithStatusCode(_0x5458f4,null))['catch'](handleError(_0x5458f4,null));};exports[_0x12e0('0x61')]=function(_0x5bdab5,_0x1b6cdc){return db[_0x12e0('0x2e')][_0x12e0('0x4d')]({'where':{'id':_0x5bdab5[_0x12e0('0x48')]['id']}})[_0x12e0('0x2a')](handleEntityNotFound(_0x1b6cdc,null))['then'](function(_0x1a8d49){if(_0x1a8d49){return db[_0x12e0('0x53')][_0x12e0('0x54')](function(_0xcd60b5){return db[_0x12e0('0x55')]['findAll']({'where':{'userProfileId':_0x5bdab5[_0x12e0('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0x12e0('0x2a')](function(_0x270862){if(_0x270862){return db[_0x12e0('0x55')][_0x12e0('0x29')]({'where':{'userProfileId':_0x5bdab5['params']['id'],'id':_['map'](_0x270862,function(_0x1ba559){return _0x1ba559['id'];})},'transaction':_0xcd60b5});}})['then'](function(_0x5912cf){var _0xc943e1=_['map'](_0x5bdab5['body'],function(_0x5e6a5a){_0x5e6a5a[_0x12e0('0x5b')]=_0x5bdab5[_0x12e0('0x48')]['id'];return _0x5e6a5a;});return db[_0x12e0('0x55')][_0x12e0('0x62')](_0xc943e1,{'raw':!![],'transaction':_0xcd60b5});})[_0x12e0('0x2a')](function(_0x45104a){var _0x532d35=_[_0x12e0('0x3b')](_['map'](_0x45104a,function(_0x595a3a){return _0x595a3a[_0x12e0('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x532d35){return db[_0x12e0('0x55')]['findAll']({'where':{'userProfileId':_0x5bdab5[_0x12e0('0x48')]['id'],'sectionId':_['map'](_0x532d35,function(_0x1b4fbf){return _0x1b4fbf['sectionId'];})},'attributes':['id',_0x12e0('0x5a')],'raw':!![]})[_0x12e0('0x2a')](function(_0x47ff0a){var _0x3a2106=_[_0x12e0('0x3c')](_0x5bdab5[_0x12e0('0x51')],function(_0x118dba){_0x118dba['userProfileId']=_0x5bdab5[_0x12e0('0x48')]['id'];return _0x118dba;});return db[_0x12e0('0x58')][_0x12e0('0x62')](_0x3a2106,{'raw':!![],'transaction':_0xcd60b5});});}})['catch'](handleError(_0x1b6cdc,null));});}})[_0x12e0('0x2a')](function(_0x3994af){var _0x3dd812=_[_0x12e0('0x3c')](_0x3994af,function(_0x23e2ef){return _0x23e2ef['get']({'plain':!![]});});})[_0x12e0('0x2a')](respondWithResult(_0x1b6cdc,null))['catch'](handleError(_0x1b6cdc,null));};exports['removeResources']=function(_0x12266d,_0x4c7952,_0x52b0f8){var _0x289d34;return db[_0x12e0('0x2e')][_0x12e0('0x4d')]({'where':{'id':_0x12266d[_0x12e0('0x48')]['id']}})['then'](handleEntityNotFound(_0x4c7952,null))['then'](function(_0x3dfcb){if(_0x3dfcb){return _0x3dfcb[_0x12e0('0x63')](_0x12266d[_0x12e0('0x30')]['ids']);}})[_0x12e0('0x2a')](respondWithStatusCode(_0x4c7952,null))['catch'](handleError(_0x4c7952,null));};exports[_0x12e0('0x64')]=function(_0x686740,_0x186848){var _0xaf8f4b={'raw':![],'where':{}};var _0x5b73fc={};var _0x5094f5={'count':0x0,'rows':[]};var _0xeaf0ff=_0x686740[_0x12e0('0x30')][_0x12e0('0x65')];if(typeof _0xeaf0ff===_0x12e0('0x66')){throw new db[(_0x12e0('0x67'))][(_0x12e0('0x68'))](_0x12e0('0x69'));}var _0x3d75fe=_0x686740['query'][_0x12e0('0x6a')]||![];var _0x2b76ec=getQueryModels(_0xeaf0ff,_0x3d75fe);if(typeof _0x2b76ec[_0x12e0('0x6b')]===_0x12e0('0x66')){throw new db[(_0x12e0('0x67'))]['ValidationError'](_0x12e0('0x6c')+_0xeaf0ff+'\x27');}var _0x2a67f4=[];if(!_[_0x12e0('0x6d')](_0x2b76ec[_0x12e0('0x6e')])){_0x2a67f4=_0x2b76ec[_0x12e0('0x6e')];}else{_0x2a67f4=[{'name':_0xeaf0ff}];}return db[_0x12e0('0x2e')][_0x12e0('0x6f')]({'where':{'id':_0x686740['params']['id']}})[_0x12e0('0x2a')](handleEntityNotFound(_0x186848,null))[_0x12e0('0x2a')](function(_0x5aec59){if(_0x5aec59){var _0x3fc3fe=[];for(var _0x4a5a13=0x0;_0x4a5a13<_0x2a67f4[_0x12e0('0x36')];_0x4a5a13++){_0x3fc3fe[_0x12e0('0x5e')](db[_0x12e0('0x55')][_0x12e0('0x6f')]({'where':{'userProfileId':_0x5aec59['id'],'name':_0x2a67f4[_0x4a5a13][_0x12e0('0x2b')]},'raw':!![]}));}return BPromise[_0x12e0('0x70')](_0x3fc3fe);}})[_0x12e0('0x2a')](function(_0xdecdea){var _0x2440ed=_[_0x12e0('0x3b')](_0xdecdea,function(_0xab186a){return _0xab186a?_0xab186a:undefined;});var _0x3ee970=_['filter'](_0x2a67f4,[_0x12e0('0x71'),!![]]);var _0x1e8c7f=_['isEmpty'](_0x2440ed)&&_[_0x12e0('0x6d')](_0x3ee970)?null:_[_0x12e0('0x72')](_0x3ee970,_0x2440ed);if(_0x1e8c7f){var _0x32581f=[];for(var _0x2093c1=0x0;_0x2093c1<_0x1e8c7f[_0x12e0('0x36')];_0x2093c1++){var _0x574d2d=_[_0x12e0('0x4d')](_0x2a67f4,function(_0x2dc176){return _0x1e8c7f[_0x2093c1]?_0x2dc176[_0x12e0('0x2b')]===_0x1e8c7f[_0x2093c1][_0x12e0('0x2b')]:null;});if(_0x574d2d){if(_0x1e8c7f[_0x2093c1][_0x12e0('0x71')]){_0x32581f['push'](getAllResources(_0x2b76ec[_0x12e0('0x6b')],_0x1e8c7f[_0x2093c1]));}else{if(!_0x1e8c7f[_0x2093c1][_0x12e0('0x57')]){_0x32581f[_0x12e0('0x5e')](getAllowedResources(_0x574d2d,_0x1e8c7f[_0x2093c1]));}else{if(_0x574d2d[_0x12e0('0x33')]){_0x32581f[_0x12e0('0x5e')](getAllFilteredResources(_0x574d2d,_0x1e8c7f[_0x2093c1]));}}}}}return BPromise[_0x12e0('0x70')](_0x32581f);}else{return null;}})['then'](function(_0x4a0710){var _0x1f7d94=_0x4a0710;var _0x10a4f4=null;if(_0x1f7d94){_0x10a4f4=_0x1f7d94['length']===0x1?_0x1f7d94[0x0]:null;}if(_0x10a4f4||_0x1f7d94){var _0x54d6a3=db[_0x2b76ec[_0x12e0('0x6b')]][_0x12e0('0x49')];_0x5b73fc[_0x12e0('0x33')]=_['keys'](_0x54d6a3);_0x5b73fc[_0x12e0('0x30')]=_[_0x12e0('0x2f')](_0x686740[_0x12e0('0x30')]);_0x5b73fc[_0x12e0('0x31')]=_[_0x12e0('0x32')](_0x5b73fc['model'],_0x5b73fc[_0x12e0('0x30')]);_0xaf8f4b[_0x12e0('0x35')]=_['intersection'](_0x5b73fc[_0x12e0('0x33')],qs[_0x12e0('0x34')](_0x686740['query'][_0x12e0('0x34')]));_0xaf8f4b['attributes']=_0xaf8f4b[_0x12e0('0x35')][_0x12e0('0x36')]?_0xaf8f4b[_0x12e0('0x35')]:_0x5b73fc['model'];if(!_0x686740[_0x12e0('0x30')][_0x12e0('0x37')](_0x12e0('0x38'))){_0xaf8f4b[_0x12e0('0x22')]=qs[_0x12e0('0x22')](_0x686740[_0x12e0('0x30')]['limit']);_0xaf8f4b[_0x12e0('0x21')]=qs[_0x12e0('0x21')](_0x686740['query'][_0x12e0('0x21')]);}_0xaf8f4b[_0x12e0('0x73')]=qs[_0x12e0('0x39')](_0x686740[_0x12e0('0x30')][_0x12e0('0x39')]);_0xaf8f4b[_0x12e0('0x3a')]=qs['filters'](_[_0x12e0('0x74')](_0x686740[_0x12e0('0x30')],_0x5b73fc[_0x12e0('0x31')]));var _0x30f9a5=[];if(_0x10a4f4){var _0x3e8a19=_['find'](_0x2a67f4,[_0x12e0('0x2b'),_0x10a4f4[_0x12e0('0x2b')]]);if(_0x3e8a19[_0x12e0('0x40')]){var _0x6f1de1={};_0x6f1de1[_0x3e8a19[_0x12e0('0x75')]]=_0x10a4f4[_0x12e0('0x76')];_0x30f9a5[_0x12e0('0x5e')](_0x6f1de1);}else{_0xaf8f4b[_0x12e0('0x3a')]['id']=_0x10a4f4[_0x12e0('0x77')];}}else{var _0x30f9a5=[];for(var _0x37d390=0x0;_0x37d390<_0x1f7d94[_0x12e0('0x36')];_0x37d390++){var _0x3e8a19=_[_0x12e0('0x4d')](_0x2a67f4,[_0x12e0('0x2b'),_0x1f7d94[_0x37d390]['name']]);if(_0x3e8a19[_0x12e0('0x40')]){var _0x6f1de1={};if(_0x3e8a19[_0x12e0('0x40')]==='id'){_0x6f1de1[_0x3e8a19[_0x12e0('0x75')]]=_0x1f7d94[_0x37d390]['resourceIds'];}else{_0x6f1de1[_0x3e8a19[_0x12e0('0x75')]]=_0x1f7d94[_0x37d390][_0x12e0('0x76')];}_0x30f9a5[_0x12e0('0x5e')](_0x6f1de1);}else{if(!_0xaf8f4b[_0x12e0('0x3a')]['id'])_0xaf8f4b[_0x12e0('0x3a')]['id']=[];_0x1f7d94[_0x37d390][_0x12e0('0x77')][_0x12e0('0x78')](function(_0x4b8924){_0xaf8f4b['where']['id']['push'](_0x4b8924);});}}}if(!_[_0x12e0('0x6d')](_0x30f9a5)){_0xaf8f4b[_0x12e0('0x3a')]=_[_0x12e0('0x4a')](_0xaf8f4b[_0x12e0('0x3a')],{'$or':_0x30f9a5});}if(_0x686740[_0x12e0('0x30')]['filter']){_0xaf8f4b[_0x12e0('0x3a')]=_[_0x12e0('0x4a')](_0xaf8f4b[_0x12e0('0x3a')],{'$or':_['map'](_0x54d6a3,function(_0x59fb51){if(_0x59fb51[_0x12e0('0x3d')][_0x12e0('0x3e')]!==_0x12e0('0x3f')){var _0xcc1f34={};_0xcc1f34[_0x59fb51[_0x12e0('0x40')]]={'$like':'%'+_0x686740[_0x12e0('0x30')][_0x12e0('0x3b')]+'%'};return _0xcc1f34;}})});}_0xaf8f4b=_[_0x12e0('0x4a')]({},_0xaf8f4b,_0x686740['options']);if(_0x10a4f4&&!_0x10a4f4[_0x12e0('0x57')]&&_0x2b76ec[_0x12e0('0x6b')]===_0x12e0('0x79')){if(_0x686740['query']['includeAll']){_0xaf8f4b[_0x12e0('0x44')]=[{'all':!![]}];}return db[_0x2b76ec['childModel']][_0x12e0('0x59')](_0xaf8f4b)[_0x12e0('0x2a')](function(_0x2db856){var _0x1ecda1=[];_0x2db856[_0x12e0('0x78')](function(_0x4638bc){var _0xfed86a;switch(_0x4638bc[_0x12e0('0x7a')]){case _0x12e0('0x7b'):_0xfed86a=_[_0x12e0('0x4d')](_0x10a4f4[_0x12e0('0x77')],function(_0x3aac18){return _0x3aac18['id']===_0x4638bc[_0x12e0('0x7c')]&&_0x3aac18[_0x12e0('0x3d')]==='DefaultReports';});break;case _0x12e0('0x7d'):_0xfed86a=_[_0x12e0('0x4d')](_0x10a4f4[_0x12e0('0x77')],function(_0x598b97){return _0x598b97['id']===_0x4638bc[_0x12e0('0x7c')]&&_0x598b97[_0x12e0('0x3d')]===_0x12e0('0x7e');});break;}if(_0xfed86a)_0x1ecda1[_0x12e0('0x5e')](_0x4638bc);});_0x5094f5[_0x12e0('0x42')]=_0x1ecda1[_0x12e0('0x36')];_0x5094f5[_0x12e0('0x45')]=_0x1ecda1;return _0x5094f5;});}else{return db[_0x2b76ec['childModel']][_0x12e0('0x42')]({'where':_0xaf8f4b[_0x12e0('0x3a')]})[_0x12e0('0x2a')](function(_0x118a24){_0x5094f5[_0x12e0('0x42')]=_0x118a24;if(_0x686740[_0x12e0('0x30')][_0x12e0('0x43')]){if(_0x2b76ec[_0x12e0('0x6b')]==='CmContact'){_0xaf8f4b['include']=[{'model':db[_0x12e0('0x7f')],'as':_0x12e0('0x80'),'attributes':['id',_0x12e0('0x2b'),'color'],'required':_0x686740[_0x12e0('0x30')][_0x12e0('0x81')]?!![]:![]},{'model':db[_0x12e0('0x7f')],'as':_0x12e0('0x82'),'attributes':['id',_0x12e0('0x2b'),_0x12e0('0x83')],'through':_0x686740['query'][_0x12e0('0x81')]?{'attributes':[],'where':{'TagId':_0x686740[_0x12e0('0x30')][_0x12e0('0x81')]||undefined}}:{},'required':_0x686740[_0x12e0('0x30')]['tag']?!![]:![]}];}else{_0xaf8f4b['include']=[{'all':!![]}];}}return db[_0x2b76ec[_0x12e0('0x6b')]]['findAll'](_0xaf8f4b);})[_0x12e0('0x2a')](function(_0x30f79a){_0x5094f5[_0x12e0('0x45')]=_0x30f79a;return _0x5094f5;});}}else{return _0x5094f5;}})[_0x12e0('0x2a')](respondWithFilteredResult(_0x186848,_0xaf8f4b))[_0x12e0('0x46')](handleError(_0x186848,null));};function getAllResources(_0x3b07a7,_0x2665fe){return new BPromise(function(_0x214c43,_0x4fb136){if(_0x2665fe){var _0x150852=_0x2665fe[_0x12e0('0x3b')]?{[_0x2665fe[_0x12e0('0x3b')][_0x12e0('0x40')]]:_0x2665fe[_0x12e0('0x3b')][_0x12e0('0x84')]}:undefined;return db[_0x3b07a7][_0x12e0('0x59')]({'where':_0x150852,'raw':!![]})[_0x12e0('0x2a')](function(_0x47aadd){_0x2665fe[_0x12e0('0x77')]=_[_0x12e0('0x3c')](_0x47aadd,'id');_0x214c43(_0x2665fe);})['catch'](function(_0x3c5e0f){_0x4fb136(_0x3c5e0f);});}else{_0x214c43(null);}});}function getAllFilteredResources(_0x54a552,_0x3ee8c5){return new BPromise(function(_0x239f06,_0x2fdfbb){var _0x712d12=_0x54a552[_0x12e0('0x3b')]?{[_0x54a552[_0x12e0('0x3b')][_0x12e0('0x40')]]:_0x54a552[_0x12e0('0x3b')][_0x12e0('0x84')]}:undefined;return db[_0x54a552[_0x12e0('0x33')]][_0x12e0('0x59')]({'where':_0x712d12,'raw':!![]})[_0x12e0('0x2a')](function(_0x134599){_0x3ee8c5[_0x12e0('0x76')]=_[_0x12e0('0x3c')](_0x134599,function(_0x2c62c7){return _0x2c62c7['name'];});_0x239f06(_0x3ee8c5);})[_0x12e0('0x46')](function(_0x281ad0){_0x2fdfbb(_0x281ad0);});});}function getAllowedResources(_0x24d336,_0x115b90){return new BPromise(function(_0x295095,_0x3ccf55){if(_0x115b90){return db[_0x12e0('0x58')]['findAll']({'where':{'sectionId':_0x115b90['id']},'raw':!![]})[_0x12e0('0x2a')](function(_0x455b71){if(_0x24d336[_0x12e0('0x40')]&&_0x24d336['field']!=='id'){_0x115b90[_0x12e0('0x76')]=_[_0x12e0('0x3c')](_0x455b71,function(_0x361902){return _0x361902[_0x24d336[_0x12e0('0x40')]];});}else{if(_0x24d336[_0x12e0('0x6b')]==='AnalyticExtractedReport'){_0x115b90[_0x12e0('0x77')]=_[_0x12e0('0x3c')](_0x455b71,function(_0x5df380){return{'id':_0x5df380[_0x12e0('0x85')],'type':_0x5df380[_0x12e0('0x3d')]};});}else{_0x115b90[_0x12e0('0x77')]=_[_0x12e0('0x3c')](_0x455b71,function(_0x3406b2){return _0x3406b2[_0x12e0('0x85')];});}}_0x295095(_0x115b90);})['catch'](function(_0x36e786){_0x3ccf55(_0x36e786);});}else{_0x295095(null);}});}function getQueryModels(_0x548bdd,_0x40f11f){var _0xf10f48=_0x548bdd[_0x12e0('0x86')]();var _0x1a8ff0={'childModel':undefined,'parentSections':[]};switch(_0xf10f48){case _0x12e0('0x87'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0x88');break;case _0x12e0('0x89'):_0x1a8ff0['childModel']=_0x12e0('0x8a');break;case _0x12e0('0x8b'):_0x1a8ff0[_0x12e0('0x6b')]='SquareRecording';_0x1a8ff0[_0x12e0('0x6e')]=[{'name':_0x12e0('0x8c'),'field':'name','foreignKey':_0x12e0('0x8d')}];break;case'projects':_0x1a8ff0['childModel']=_0x12e0('0x8e');break;case _0x12e0('0x8f'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0x90');_0x1a8ff0[_0x12e0('0x6e')]=[{'name':_0x12e0('0x91'),'field':'id','foreignKey':_0x12e0('0x92')}];break;case _0x12e0('0x93'):_0x1a8ff0[_0x12e0('0x6b')]='CmList';break;case'companies':_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0x94');break;case'globalcustomfields':_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0x95');break;case _0x12e0('0x96'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0x97');break;case'chatwebsites':_0x1a8ff0['childModel']=_0x12e0('0x98');break;case _0x12e0('0x99'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0x9a');break;case _0x12e0('0x9b'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0x9c');break;case _0x12e0('0x9d'):case _0x12e0('0x9e'):case'outboundroutes':_0x1a8ff0['childModel']=_0x12e0('0x9f');break;case _0x12e0('0xa0'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xa1');break;case _0x12e0('0xa2'):_0x1a8ff0[_0x12e0('0x6b')]='VoiceMail';break;case _0x12e0('0xa3'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xa4');_0x1a8ff0[_0x12e0('0x6e')]=[{'name':_0x12e0('0xa5'),'field':_0x12e0('0x2b'),'foreignKey':_0x12e0('0xa6'),'model':'User','filter':{'field':_0x12e0('0xa7'),'value':[_0x12e0('0xa8')]}},{'name':'Telephones','field':_0x12e0('0x2b'),'foreignKey':_0x12e0('0xa6'),'model':_0x12e0('0xa9'),'filter':{'field':'role','value':[_0x12e0('0xaa')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0x12e0('0xab'),'model':_0x12e0('0xac'),'filter':{'field':_0x12e0('0x3d'),'value':[_0x12e0('0xad')]}},{'name':_0x12e0('0xae'),'field':_0x12e0('0x2b'),'foreignKey':_0x12e0('0xab'),'model':_0x12e0('0xac'),'filter':{'field':_0x12e0('0x3d'),'value':[_0x12e0('0xaf')]}}];break;case _0x12e0('0xb0'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xb1');break;case _0x12e0('0xb2'):_0x1a8ff0[_0x12e0('0x6b')]='VoiceChanSpy';break;case _0x12e0('0xb3'):_0x1a8ff0['childModel']=_0x12e0('0xb4');break;case _0x12e0('0xb5'):_0x1a8ff0['childModel']=_0x12e0('0xb6');break;case _0x12e0('0xb7'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xb8');break;case _0x12e0('0xb9'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xba');break;case _0x12e0('0xbb'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xbc');break;case _0x12e0('0xbd'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xbe');break;case _0x12e0('0xbf'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xc0');break;case _0x12e0('0xc1'):_0x1a8ff0[_0x12e0('0x6b')]='SmsQueue';break;case _0x12e0('0xc2'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xc3');break;case _0x12e0('0xc4'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xc5');break;case'voicequeues':case'queuecampaigns':_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xac');if(_0x40f11f){_0x1a8ff0[_0x12e0('0x6e')]=[{'name':_0x12e0('0xc6')},{'name':'QueueCampaigns'}];}break;case _0x12e0('0xc7'):case _0x12e0('0xc8'):case _0x12e0('0xc9'):_0x1a8ff0['childModel']=_0x12e0('0xa9');if(_0x40f11f){_0x1a8ff0['parentSections']=[{'name':'Users','filter':{'field':_0x12e0('0xa7'),'value':[_0x12e0('0xca'),_0x12e0('0xcb')]},'ignore':!![]},{'name':_0x12e0('0xa5')},{'name':_0x12e0('0xcc')}];}break;case'zendeskaccounts':_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xcd');break;case _0x12e0('0xce'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xcf');break;case'freshdeskaccounts':_0x1a8ff0[_0x12e0('0x6b')]='FreshdeskAccount';break;case _0x12e0('0xd0'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xd1');break;case'deskaccounts':_0x1a8ff0['childModel']=_0x12e0('0xd2');break;case'zohoaccounts':_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xd3');break;case _0x12e0('0xd4'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xa9');break;case _0x12e0('0xd5'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xd6');break;case _0x12e0('0xd7'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xd8');break;case _0x12e0('0xd9'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xda');break;case _0x12e0('0xdb'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xdc');break;case _0x12e0('0xdd'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xde');break;case'scheduler':_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xdf');break;case _0x12e0('0xe0'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xe1');break;case _0x12e0('0xe2'):_0x1a8ff0['childModel']=_0x12e0('0x7f');break;case _0x12e0('0xe3'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xe4');break;case _0x12e0('0xe5'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xe6');break;case _0x12e0('0xe7'):_0x1a8ff0[_0x12e0('0x6b')]=_0x12e0('0xe8');break;case _0x12e0('0xe9'):_0x1a8ff0[_0x12e0('0x6b')]='Variable';break;case'plugins':_0x1a8ff0['childModel']=_0x12e0('0xea');break;case _0x12e0('0xeb'):_0x1a8ff0[_0x12e0('0x6b')]='AnalyticExtractedReport';_0x1a8ff0[_0x12e0('0x6e')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case'metrics':_0x1a8ff0['childModel']=_0x12e0('0xec');break;default:return _0x1a8ff0;}return _0x1a8ff0;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 5f0046b..2df06b2 100644 --- a/server/api/userProfile/userProfile.events.js +++ b/server/api/userProfile/userProfile.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','UserProfile'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53ec,0x192));var _0xc53e=function(_0x49a811,_0x190495){_0x49a811=_0x49a811-0x0;var _0xd8ff9d=_0x53ec[_0x49a811];return _0xd8ff9d;};'use strict';var EventEmitter=require(_0xc53e('0x0'));var UserProfile=require(_0xc53e('0x1'))['db'][_0xc53e('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xc53e('0x3')](0x0);var events={'afterCreate':_0xc53e('0x4'),'afterUpdate':_0xc53e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x266c42){return function(_0x4e954a,_0x2b90f6,_0x38033d){UserProfileEvents['emit'](_0x266c42+':'+_0x4e954a['id'],_0x4e954a);UserProfileEvents[_0xc53e('0x6')](_0x266c42,_0x4e954a);_0x38033d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xc53e('0x7')](e,emitEvent(event));}}module[_0xc53e('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x8784=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x8784,0x172));var _0x4878=function(_0xd13a88,_0x3c5269){_0xd13a88=_0xd13a88-0x0;var _0x1c993c=_0x8784[_0xd13a88];return _0x1c993c;};'use strict';var EventEmitter=require(_0x4878('0x0'));var UserProfile=require(_0x4878('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x4878('0x2')](0x0);var events={'afterCreate':_0x4878('0x3'),'afterUpdate':_0x4878('0x4'),'afterDestroy':_0x4878('0x5')};function emitEvent(_0x401abe){return function(_0x55969c,_0x509521,_0x101d58){UserProfileEvents[_0x4878('0x6')](_0x401abe+':'+_0x55969c['id'],_0x55969c);UserProfileEvents[_0x4878('0x6')](_0x401abe,_0x55969c);_0x101d58(null);};}for(var e in events){if(events[_0x4878('0x7')](e)){var event=events[e];UserProfile[_0x4878('0x8')](e,emitEvent(event));}}module[_0x4878('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 5d744c0..204b796 100644 --- a/server/api/userProfile/userProfile.model.js +++ b/server/api/userProfile/userProfile.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x47c0=['request-promise','UserProfile','util','../../config/logger','api'];(function(_0x2fa3ea,_0x5ccae6){var _0x3c3952=function(_0x4c182e){while(--_0x4c182e){_0x2fa3ea['push'](_0x2fa3ea['shift']());}};_0x3c3952(++_0x5ccae6);}(_0x47c0,0x1f1));var _0x047c=function(_0x450e7d,_0xb0cd29){_0x450e7d=_0x450e7d-0x0;var _0x5478fb=_0x47c0[_0x450e7d];return _0x5478fb;};'use strict';var _=require('lodash');var util=require(_0x047c('0x0'));var logger=require(_0x047c('0x1'))(_0x047c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x047c('0x3'));var attributes=require('./userProfile.attributes');module['exports']=function(_0x48ac0f,_0xe2a757){return _0x48ac0f['define'](_0x047c('0x4'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3354=['lodash','util','moment','request-promise','exports','define','user_profiles'];(function(_0x2d63ae,_0x2464bf){var _0xd22295=function(_0x46bf40){while(--_0x46bf40){_0x2d63ae['push'](_0x2d63ae['shift']());}};_0xd22295(++_0x2464bf);}(_0x3354,0xe0));var _0x4335=function(_0x477ed5,_0x1e316b){_0x477ed5=_0x477ed5-0x0;var _0x3a6648=_0x3354[_0x477ed5];return _0x3a6648;};'use strict';var _=require(_0x4335('0x0'));var util=require(_0x4335('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4335('0x2'));var BPromise=require('bluebird');var rp=require(_0x4335('0x3'));var attributes=require('./userProfile.attributes');module[_0x4335('0x4')]=function(_0x222158,_0x245e2a){return _0x222158[_0x4335('0x5')]('UserProfile',attributes,{'tableName':_0x4335('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 3eacd62..81a01ff 100644 --- a/server/api/userProfile/userProfile.rpc.js +++ b/server/api/userProfile/userProfile.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6a8=['redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xc6a8,0xf1));var _0x8c6a=function(_0x2d89b6,_0x16a550){_0x2d89b6=_0x2d89b6-0x0;var _0x37691a=_0xc6a8[_0x2d89b6];return _0x37691a;};'use strict';var _=require(_0x8c6a('0x0'));var util=require(_0x8c6a('0x1'));var moment=require(_0x8c6a('0x2'));var BPromise=require('bluebird');var rs=require(_0x8c6a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8c6a('0x4'))(_0x8c6a('0x5'));var config=require(_0x8c6a('0x6'));var jayson=require(_0x8c6a('0x7'));var client=jayson[_0x8c6a('0x8')][_0x8c6a('0x9')]({'port':0x232a});config['redis']=_[_0x8c6a('0xa')](config[_0x8c6a('0xb')],{'host':_0x8c6a('0xc'),'port':0x18eb});var socket=require(_0x8c6a('0xd'))(new Redis(config['redis']));require(_0x8c6a('0xe'))[_0x8c6a('0xf')](socket);function respondWithRpcPromise(_0x4231c3,_0x90d25a,_0x5139ea){return new BPromise(function(_0x79d752,_0x4b5284){return client[_0x8c6a('0x10')](_0x4231c3,_0x5139ea)[_0x8c6a('0x11')](function(_0x43a9bb){logger[_0x8c6a('0x12')](_0x8c6a('0x13'),_0x90d25a,_0x8c6a('0x14'));logger[_0x8c6a('0x15')](_0x8c6a('0x16'),_0x90d25a,_0x8c6a('0x14'),JSON[_0x8c6a('0x17')](_0x43a9bb));if(_0x43a9bb[_0x8c6a('0x18')]){if(_0x43a9bb[_0x8c6a('0x18')][_0x8c6a('0x19')]===0x1f4){logger[_0x8c6a('0x18')](_0x8c6a('0x13'),_0x90d25a,_0x43a9bb[_0x8c6a('0x18')]['message']);return _0x4b5284(_0x43a9bb[_0x8c6a('0x18')][_0x8c6a('0x1a')]);}logger[_0x8c6a('0x18')]('UserProfile,\x20%s,\x20%s',_0x90d25a,_0x43a9bb[_0x8c6a('0x18')][_0x8c6a('0x1a')]);return _0x79d752(_0x43a9bb[_0x8c6a('0x18')][_0x8c6a('0x1a')]);}else{logger[_0x8c6a('0x12')]('UserProfile,\x20%s,\x20%s',_0x90d25a,'request\x20sent');_0x79d752(_0x43a9bb[_0x8c6a('0x1b')][_0x8c6a('0x1a')]);}})['catch'](function(_0x1fad6d){logger[_0x8c6a('0x18')](_0x8c6a('0x13'),_0x90d25a,_0x1fad6d);_0x4b5284(_0x1fad6d);});});} \ No newline at end of file +var _0xb41a=['http','redis','localhost','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x24ff97,_0x1a0f27){var _0x56a03b=function(_0x3999fd){while(--_0x3999fd){_0x24ff97['push'](_0x24ff97['shift']());}};_0x56a03b(++_0x1a0f27);}(_0xb41a,0xd7));var _0xab41=function(_0x5944e9,_0xf3da60){_0x5944e9=_0x5944e9-0x0;var _0x1098b8=_0xb41a[_0x5944e9];return _0x1098b8;};'use strict';var _=require(_0xab41('0x0'));var util=require(_0xab41('0x1'));var moment=require(_0xab41('0x2'));var BPromise=require(_0xab41('0x3'));var rs=require(_0xab41('0x4'));var fs=require('fs');var Redis=require(_0xab41('0x5'));var db=require(_0xab41('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xab41('0x7'));var config=require(_0xab41('0x8'));var jayson=require(_0xab41('0x9'));var client=jayson['client'][_0xab41('0xa')]({'port':0x232a});config[_0xab41('0xb')]=_['defaults'](config['redis'],{'host':_0xab41('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xab41('0xb')]));require(_0xab41('0xd'))[_0xab41('0xe')](socket);function respondWithRpcPromise(_0x54051d,_0x400e39,_0x4a3e2a){return new BPromise(function(_0x1083bc,_0x351064){return client[_0xab41('0xf')](_0x54051d,_0x4a3e2a)[_0xab41('0x10')](function(_0x2f246d){logger[_0xab41('0x11')](_0xab41('0x12'),_0x400e39,_0xab41('0x13'));logger[_0xab41('0x14')](_0xab41('0x15'),_0x400e39,'request\x20sent',JSON[_0xab41('0x16')](_0x2f246d));if(_0x2f246d[_0xab41('0x17')]){if(_0x2f246d[_0xab41('0x17')]['code']===0x1f4){logger[_0xab41('0x17')](_0xab41('0x12'),_0x400e39,_0x2f246d[_0xab41('0x17')][_0xab41('0x18')]);return _0x351064(_0x2f246d[_0xab41('0x17')][_0xab41('0x18')]);}logger[_0xab41('0x17')]('UserProfile,\x20%s,\x20%s',_0x400e39,_0x2f246d[_0xab41('0x17')][_0xab41('0x18')]);return _0x1083bc(_0x2f246d['error'][_0xab41('0x18')]);}else{logger['info'](_0xab41('0x12'),_0x400e39,_0xab41('0x13'));_0x1083bc(_0x2f246d['result'][_0xab41('0x18')]);}})['catch'](function(_0x1d924b){logger[_0xab41('0x17')]('UserProfile,\x20%s,\x20%s',_0x400e39,_0x1d924b);_0x351064(_0x1d924b);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 00d726b..5c295db 100644 --- a/server/api/userProfile/userProfile.socket.js +++ b/server/api/userProfile/userProfile.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb2f1=['update','emit','removeListener','register','./userProfile.events','save'];(function(_0x2bd7d9,_0x374808){var _0x15fb8d=function(_0x56aa8d){while(--_0x56aa8d){_0x2bd7d9['push'](_0x2bd7d9['shift']());}};_0x15fb8d(++_0x374808);}(_0xb2f1,0xee));var _0x1b2f=function(_0x5a30b8,_0x4a447a){_0x5a30b8=_0x5a30b8-0x0;var _0x4f0032=_0xb2f1[_0x5a30b8];return _0x4f0032;};'use strict';var UserProfileEvents=require(_0x1b2f('0x0'));var events=[_0x1b2f('0x1'),'remove',_0x1b2f('0x2')];function createListener(_0x421e82,_0x52184d){return function(_0x23a24a){_0x52184d[_0x1b2f('0x3')](_0x421e82,_0x23a24a);};}function removeListener(_0x501165,_0x47a72f){return function(){UserProfileEvents[_0x1b2f('0x4')](_0x501165,_0x47a72f);};}exports[_0x1b2f('0x5')]=function(_0xad728b){for(var _0x4326ba=0x0,_0x57eed1=events['length'];_0x4326ba<_0x57eed1;_0x4326ba++){var _0x12a0bf=events[_0x4326ba];var _0x28a081=createListener('userProfile:'+_0x12a0bf,_0xad728b);UserProfileEvents['on'](_0x12a0bf,_0x28a081);}}; \ No newline at end of file +var _0x1f63=['register','length','./userProfile.events','save','update','emit'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1f63,0x7a));var _0x31f6=function(_0x7fb141,_0x280b79){_0x7fb141=_0x7fb141-0x0;var _0x1d30cb=_0x1f63[_0x7fb141];return _0x1d30cb;};'use strict';var UserProfileEvents=require(_0x31f6('0x0'));var events=[_0x31f6('0x1'),'remove',_0x31f6('0x2')];function createListener(_0x20f59e,_0x2c0157){return function(_0x4d3bf1){_0x2c0157[_0x31f6('0x3')](_0x20f59e,_0x4d3bf1);};}function removeListener(_0x33b415,_0x5326b7){return function(){UserProfileEvents['removeListener'](_0x33b415,_0x5326b7);};}exports[_0x31f6('0x4')]=function(_0x11250b){for(var _0xe8437e=0x0,_0x4d857b=events[_0x31f6('0x5')];_0xe8437e<_0x4d857b;_0xe8437e++){var _0x46a769=events[_0xe8437e];var _0x213c68=createListener('userProfile:'+_0x46a769,_0x11250b);UserProfileEvents['on'](_0x46a769,_0x213c68);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index fd765e2..1bea796 100644 --- a/server/api/userProfileResource/index.js +++ b/server/api/userProfileResource/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd10f=['/describe','describe','show','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x596102,_0xf1607b){var _0x560896=function(_0x13f08f){while(--_0x13f08f){_0x596102['push'](_0x596102['shift']());}};_0x560896(++_0xf1607b);}(_0xd10f,0x198));var _0xfd10=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd10f[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xfd10('0x0'));var util=require(_0xfd10('0x1'));var path=require(_0xfd10('0x2'));var timeout=require(_0xfd10('0x3'));var express=require(_0xfd10('0x4'));var router=express['Router']();var auth=require(_0xfd10('0x5'));var interaction=require(_0xfd10('0x6'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router[_0xfd10('0x7')]('/',auth[_0xfd10('0x8')](),controller[_0xfd10('0x9')]);router[_0xfd10('0x7')](_0xfd10('0xa'),auth[_0xfd10('0x8')](),controller[_0xfd10('0xb')]);router[_0xfd10('0x7')]('/:id',auth[_0xfd10('0x8')](),controller[_0xfd10('0xc')]);router['post']('/',auth[_0xfd10('0x8')](),controller[_0xfd10('0xd')]);router[_0xfd10('0xe')](_0xfd10('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xfd10('0x10')](_0xfd10('0xf'),auth['isAuthenticated'](),controller[_0xfd10('0x11')]);module[_0xfd10('0x12')]=router; \ No newline at end of file +var _0x199d=['connect-timeout','express','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','index','isAuthenticated','describe','show','post','create','put','delete','/:id','destroy','exports','multer','util','path'];(function(_0x35334a,_0x4a54ad){var _0x68df10=function(_0x359db2){while(--_0x359db2){_0x35334a['push'](_0x35334a['shift']());}};_0x68df10(++_0x4a54ad);}(_0x199d,0x13d));var _0xd199=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x199d[_0x3fba9f];return _0x192cf1;};'use strict';var multer=require(_0xd199('0x0'));var util=require(_0xd199('0x1'));var path=require(_0xd199('0x2'));var timeout=require(_0xd199('0x3'));var express=require(_0xd199('0x4'));var router=express['Router']();var auth=require(_0xd199('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd199('0x6'));var controller=require(_0xd199('0x7'));router[_0xd199('0x8')]('/',auth['isAuthenticated'](),controller[_0xd199('0x9')]);router[_0xd199('0x8')]('/describe',auth[_0xd199('0xa')](),controller[_0xd199('0xb')]);router[_0xd199('0x8')]('/:id',auth[_0xd199('0xa')](),controller[_0xd199('0xc')]);router[_0xd199('0xd')]('/',auth['isAuthenticated'](),controller[_0xd199('0xe')]);router[_0xd199('0xf')]('/:id',auth[_0xd199('0xa')](),controller['update']);router[_0xd199('0x10')](_0xd199('0x11'),auth[_0xd199('0xa')](),controller[_0xd199('0x12')]);module[_0xd199('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 573345e..a0c80bc 100644 --- a/server/api/userProfileResource/userProfileResource.attributes.js +++ b/server/api/userProfileResource/userProfileResource.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd8d=['sequelize','exports','STRING'];(function(_0x44517e,_0x16cf04){var _0x284f74=function(_0x310666){while(--_0x310666){_0x44517e['push'](_0x44517e['shift']());}};_0x284f74(++_0x16cf04);}(_0xfd8d,0xa5));var _0xdfd8=function(_0x57d231,_0x3325fe){_0x57d231=_0x57d231-0x0;var _0x590796=_0xfd8d[_0x57d231];return _0x590796;};'use strict';var Sequelize=require(_0xdfd8('0x0'));module[_0xdfd8('0x1')]={'name':{'type':Sequelize[_0xdfd8('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xdfd8('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x36a7=['INTEGER','sequelize','exports','STRING'];(function(_0x52ae40,_0x23c2bf){var _0xab6ed1=function(_0x36d880){while(--_0x36d880){_0x52ae40['push'](_0x52ae40['shift']());}};_0xab6ed1(++_0x23c2bf);}(_0x36a7,0x165));var _0x736a=function(_0x377be9,_0x26b0d3){_0x377be9=_0x377be9-0x0;var _0x3a82df=_0x36a7[_0x377be9];return _0x3a82df;};'use strict';var Sequelize=require(_0x736a('0x0'));module[_0x736a('0x1')]={'name':{'type':Sequelize[_0x736a('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x736a('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 94a9995..3cd3a57 100644 --- a/server/api/userProfileResource/userProfileResource.controller.js +++ b/server/api/userProfileResource/userProfileResource.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['includeAll','findAll','catch','params','model','options','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','send','index','UserProfileResource','rawAttributes','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','key','VIRTUAL','field','count'];(function(_0x4e9f70,_0x1370e0){var _0x97f592=function(_0x7cc9cb){while(--_0x7cc9cb){_0x4e9f70['push'](_0x4e9f70['shift']());}};_0x97f592(++_0x1370e0);}(_0xb10b,0x12a));var _0xbb10=function(_0x234341,_0x1f0568){_0x234341=_0x234341-0x0;var _0x2fd6e9=_0xb10b[_0x234341];return _0x2fd6e9;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var hardwareService=require(_0xbb10('0x13'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require(_0xbb10('0x16'));var config=require('../../config/environment');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xcc;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x18')](_0x44fb19);}return _0x5be7e0[_0xbb10('0x19')](_0x44fb19)[_0xbb10('0x1a')]();};}function respondWithResult(_0x147230,_0x58a612){_0x58a612=_0x58a612||0xc8;return function(_0x26e021){if(_0x26e021){return _0x147230[_0xbb10('0x19')](_0x58a612)[_0xbb10('0x1b')](_0x26e021);}};}function respondWithFilteredResult(_0x17fd46,_0x3df17b){return function(_0x2f2ebf){if(_0x2f2ebf){var _0x24a57b=_0x2f2ebf['count'],_0x36b5e8=_0x3df17b[_0xbb10('0x1c')],_0x3e26f4=_0x3df17b[_0xbb10('0x1c')]+_0x3df17b[_0xbb10('0x1d')],_0x2b184e;if(_0x3e26f4>=_0x24a57b){_0x3e26f4=_0x24a57b;_0x2b184e=0xc8;}else{_0x2b184e=0xce;}_0x17fd46[_0xbb10('0x19')](_0x2b184e);return _0x17fd46[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x36b5e8+'-'+_0x3e26f4+'/'+_0x24a57b)[_0xbb10('0x1b')](_0x2f2ebf);}return null;};}function patchUpdates(_0x30efc6){return function(_0xbf2906){try{jsonpatch[_0xbb10('0x20')](_0xbf2906,_0x30efc6,!![]);}catch(_0x48b6e9){return BPromise[_0xbb10('0x21')](_0x48b6e9);}return _0xbf2906[_0xbb10('0x22')]();};}function saveUpdates(_0x388fab,_0x109908){return function(_0xdf237d){if(_0xdf237d){return _0xdf237d[_0xbb10('0x23')](_0x388fab)['then'](function(_0x12f888){return _0x12f888;});}return null;};}function removeEntity(_0x12ef77,_0x50aea1){return function(_0x4c4b0d){if(_0x4c4b0d){return _0x4c4b0d[_0xbb10('0x24')]()[_0xbb10('0x25')](function(){_0x12ef77[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x445761,_0x1824b7){return function(_0x407cb4){if(!_0x407cb4){_0x445761[_0xbb10('0x18')](0x194);}return _0x407cb4;};}function handleError(_0x7f2377,_0x395404){_0x395404=_0x395404||0x1f4;return function(_0x3ba6cd){logger[_0xbb10('0x26')](_0x3ba6cd['stack']);if(_0x3ba6cd['name']){delete _0x3ba6cd['name'];}_0x7f2377[_0xbb10('0x19')](_0x395404)[_0xbb10('0x27')](_0x3ba6cd);};}exports[_0xbb10('0x28')]=function(_0x4e25ff,_0x2fdde9){var _0x24d586={},_0x6ed43b={},_0x1d5e95={'count':0x0,'rows':[]};var _0x1acce9=db[_0xbb10('0x29')][_0xbb10('0x2a')];_0x6ed43b['model']=_[_0xbb10('0x2b')](_0x1acce9);_0x6ed43b[_0xbb10('0x2c')]=_[_0xbb10('0x2b')](_0x4e25ff[_0xbb10('0x2c')]);_0x6ed43b[_0xbb10('0x2d')]=_[_0xbb10('0x2e')](_0x6ed43b['model'],_0x6ed43b[_0xbb10('0x2c')]);_0x24d586['attributes']=_[_0xbb10('0x2e')](_0x6ed43b['model'],qs[_0xbb10('0x2f')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x2f')]));_0x24d586['attributes']=_0x24d586['attributes'][_0xbb10('0x30')]?_0x24d586[_0xbb10('0x31')]:_0x6ed43b['model'];if(!_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x32')](_0xbb10('0x33'))){_0x24d586[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x1d')]);_0x24d586['offset']=qs[_0xbb10('0x1c')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x1c')]);}_0x24d586[_0xbb10('0x34')]=qs[_0xbb10('0x35')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x35')]);_0x24d586[_0xbb10('0x36')]=qs[_0xbb10('0x2d')](_['pick'](_0x4e25ff[_0xbb10('0x2c')],_0x6ed43b[_0xbb10('0x2d')]));if(_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x37')]){_0x24d586['where']=_[_0xbb10('0x38')](_0x24d586['where'],{'$or':_['map'](_0x1acce9,function(_0x3eb3cc){if(_0x3eb3cc[_0xbb10('0x39')][_0xbb10('0x3a')]!==_0xbb10('0x3b')){var _0x15d895={};_0x15d895[_0x3eb3cc[_0xbb10('0x3c')]]={'$like':'%'+_0x4e25ff['query'][_0xbb10('0x37')]+'%'};return _0x15d895;}})});}_0x24d586=_[_0xbb10('0x38')]({},_0x24d586,_0x4e25ff['options']);var _0x5e3fbd={'where':_0x24d586['where']};return db[_0xbb10('0x29')][_0xbb10('0x3d')](_0x5e3fbd)[_0xbb10('0x25')](function(_0x4d5a9b){_0x1d5e95[_0xbb10('0x3d')]=_0x4d5a9b;if(_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x3e')]){_0x24d586['include']=[{'all':!![]}];}return db[_0xbb10('0x29')][_0xbb10('0x3f')](_0x24d586);})[_0xbb10('0x25')](function(_0x446f49){_0x1d5e95['rows']=_0x446f49;return _0x1d5e95;})[_0xbb10('0x25')](respondWithFilteredResult(_0x2fdde9,_0x24d586))[_0xbb10('0x40')](handleError(_0x2fdde9,null));};exports['show']=function(_0xe2040f,_0x2e3214){var _0x44d6ae={'raw':![],'where':{'id':_0xe2040f[_0xbb10('0x41')]['id']}},_0x3a9934={};_0x3a9934[_0xbb10('0x42')]=_['keys'](db[_0xbb10('0x29')][_0xbb10('0x2a')]);_0x3a9934[_0xbb10('0x2c')]=_[_0xbb10('0x2b')](_0xe2040f['query']);_0x3a9934[_0xbb10('0x2d')]=_[_0xbb10('0x2e')](_0x3a9934[_0xbb10('0x42')],_0x3a9934[_0xbb10('0x2c')]);_0x44d6ae['attributes']=_[_0xbb10('0x2e')](_0x3a9934[_0xbb10('0x42')],qs['fields'](_0xe2040f['query'][_0xbb10('0x2f')]));_0x44d6ae['attributes']=_0x44d6ae[_0xbb10('0x31')][_0xbb10('0x30')]?_0x44d6ae['attributes']:_0x3a9934[_0xbb10('0x42')];if(_0xe2040f[_0xbb10('0x2c')][_0xbb10('0x3e')]){_0x44d6ae['include']=[{'all':!![]}];}_0x44d6ae=_[_0xbb10('0x38')]({},_0x44d6ae,_0xe2040f[_0xbb10('0x43')]);return db[_0xbb10('0x29')][_0xbb10('0x44')](_0x44d6ae)[_0xbb10('0x25')](handleEntityNotFound(_0x2e3214,null))[_0xbb10('0x25')](respondWithResult(_0x2e3214,null))[_0xbb10('0x40')](handleError(_0x2e3214,null));};exports[_0xbb10('0x45')]=function(_0x205bb4,_0x43b948){return db[_0xbb10('0x29')][_0xbb10('0x45')](_0x205bb4['body'],{})[_0xbb10('0x25')](respondWithResult(_0x43b948,0xc9))[_0xbb10('0x40')](handleError(_0x43b948,null));};exports['update']=function(_0x14e1cb,_0x2f5027){if(_0x14e1cb[_0xbb10('0x46')]['id']){delete _0x14e1cb[_0xbb10('0x46')]['id'];}return db[_0xbb10('0x29')][_0xbb10('0x44')]({'where':{'id':_0x14e1cb[_0xbb10('0x41')]['id']}})['then'](handleEntityNotFound(_0x2f5027,null))['then'](saveUpdates(_0x14e1cb[_0xbb10('0x46')],null))[_0xbb10('0x25')](respondWithResult(_0x2f5027,null))[_0xbb10('0x40')](handleError(_0x2f5027,null));};exports['destroy']=function(_0x5f0c12,_0x3cd6f3){return db[_0xbb10('0x29')][_0xbb10('0x44')]({'where':{'id':_0x5f0c12[_0xbb10('0x41')]['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0x3cd6f3,null))[_0xbb10('0x25')](removeEntity(_0x3cd6f3,null))[_0xbb10('0x40')](handleError(_0x3cd6f3,null));};exports[_0xbb10('0x47')]=function(_0x2626d8,_0x3d7e7e){return db['UserProfileResource']['describe']()[_0xbb10('0x25')](respondWithResult(_0x3d7e7e,null))[_0xbb10('0x40')](handleError(_0x3d7e7e,null));}; \ No newline at end of file +var _0xb10b=['includeAll','findAll','catch','params','model','options','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','send','index','UserProfileResource','rawAttributes','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','key','VIRTUAL','field','count'];(function(_0x1f1679,_0x207e6f){var _0x120584=function(_0x1a0ac0){while(--_0x1a0ac0){_0x1f1679['push'](_0x1f1679['shift']());}};_0x120584(++_0x207e6f);}(_0xb10b,0x12a));var _0xbb10=function(_0x27ebc2,_0x5a63d3){_0x27ebc2=_0x27ebc2-0x0;var _0x5aba33=_0xb10b[_0x27ebc2];return _0x5aba33;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var hardwareService=require(_0xbb10('0x13'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require(_0xbb10('0x16'));var config=require('../../config/environment');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xcc;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x18')](_0x44fb19);}return _0x5be7e0[_0xbb10('0x19')](_0x44fb19)[_0xbb10('0x1a')]();};}function respondWithResult(_0x147230,_0x58a612){_0x58a612=_0x58a612||0xc8;return function(_0x26e021){if(_0x26e021){return _0x147230[_0xbb10('0x19')](_0x58a612)[_0xbb10('0x1b')](_0x26e021);}};}function respondWithFilteredResult(_0x17fd46,_0x3df17b){return function(_0x2f2ebf){if(_0x2f2ebf){var _0x24a57b=_0x2f2ebf['count'],_0x36b5e8=_0x3df17b[_0xbb10('0x1c')],_0x3e26f4=_0x3df17b[_0xbb10('0x1c')]+_0x3df17b[_0xbb10('0x1d')],_0x2b184e;if(_0x3e26f4>=_0x24a57b){_0x3e26f4=_0x24a57b;_0x2b184e=0xc8;}else{_0x2b184e=0xce;}_0x17fd46[_0xbb10('0x19')](_0x2b184e);return _0x17fd46[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x36b5e8+'-'+_0x3e26f4+'/'+_0x24a57b)[_0xbb10('0x1b')](_0x2f2ebf);}return null;};}function patchUpdates(_0x30efc6){return function(_0xbf2906){try{jsonpatch[_0xbb10('0x20')](_0xbf2906,_0x30efc6,!![]);}catch(_0x48b6e9){return BPromise[_0xbb10('0x21')](_0x48b6e9);}return _0xbf2906[_0xbb10('0x22')]();};}function saveUpdates(_0x388fab,_0x109908){return function(_0xdf237d){if(_0xdf237d){return _0xdf237d[_0xbb10('0x23')](_0x388fab)['then'](function(_0x12f888){return _0x12f888;});}return null;};}function removeEntity(_0x12ef77,_0x50aea1){return function(_0x4c4b0d){if(_0x4c4b0d){return _0x4c4b0d[_0xbb10('0x24')]()[_0xbb10('0x25')](function(){_0x12ef77[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x445761,_0x1824b7){return function(_0x407cb4){if(!_0x407cb4){_0x445761[_0xbb10('0x18')](0x194);}return _0x407cb4;};}function handleError(_0x7f2377,_0x395404){_0x395404=_0x395404||0x1f4;return function(_0x3ba6cd){logger[_0xbb10('0x26')](_0x3ba6cd['stack']);if(_0x3ba6cd['name']){delete _0x3ba6cd['name'];}_0x7f2377[_0xbb10('0x19')](_0x395404)[_0xbb10('0x27')](_0x3ba6cd);};}exports[_0xbb10('0x28')]=function(_0x4e25ff,_0x2fdde9){var _0x24d586={},_0x6ed43b={},_0x1d5e95={'count':0x0,'rows':[]};var _0x1acce9=db[_0xbb10('0x29')][_0xbb10('0x2a')];_0x6ed43b['model']=_[_0xbb10('0x2b')](_0x1acce9);_0x6ed43b[_0xbb10('0x2c')]=_[_0xbb10('0x2b')](_0x4e25ff[_0xbb10('0x2c')]);_0x6ed43b[_0xbb10('0x2d')]=_[_0xbb10('0x2e')](_0x6ed43b['model'],_0x6ed43b[_0xbb10('0x2c')]);_0x24d586['attributes']=_[_0xbb10('0x2e')](_0x6ed43b['model'],qs[_0xbb10('0x2f')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x2f')]));_0x24d586['attributes']=_0x24d586['attributes'][_0xbb10('0x30')]?_0x24d586[_0xbb10('0x31')]:_0x6ed43b['model'];if(!_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x32')](_0xbb10('0x33'))){_0x24d586[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x1d')]);_0x24d586['offset']=qs[_0xbb10('0x1c')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x1c')]);}_0x24d586[_0xbb10('0x34')]=qs[_0xbb10('0x35')](_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x35')]);_0x24d586[_0xbb10('0x36')]=qs[_0xbb10('0x2d')](_['pick'](_0x4e25ff[_0xbb10('0x2c')],_0x6ed43b[_0xbb10('0x2d')]));if(_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x37')]){_0x24d586['where']=_[_0xbb10('0x38')](_0x24d586['where'],{'$or':_['map'](_0x1acce9,function(_0x3eb3cc){if(_0x3eb3cc[_0xbb10('0x39')][_0xbb10('0x3a')]!==_0xbb10('0x3b')){var _0x15d895={};_0x15d895[_0x3eb3cc[_0xbb10('0x3c')]]={'$like':'%'+_0x4e25ff['query'][_0xbb10('0x37')]+'%'};return _0x15d895;}})});}_0x24d586=_[_0xbb10('0x38')]({},_0x24d586,_0x4e25ff['options']);var _0x5e3fbd={'where':_0x24d586['where']};return db[_0xbb10('0x29')][_0xbb10('0x3d')](_0x5e3fbd)[_0xbb10('0x25')](function(_0x4d5a9b){_0x1d5e95[_0xbb10('0x3d')]=_0x4d5a9b;if(_0x4e25ff[_0xbb10('0x2c')][_0xbb10('0x3e')]){_0x24d586['include']=[{'all':!![]}];}return db[_0xbb10('0x29')][_0xbb10('0x3f')](_0x24d586);})[_0xbb10('0x25')](function(_0x446f49){_0x1d5e95['rows']=_0x446f49;return _0x1d5e95;})[_0xbb10('0x25')](respondWithFilteredResult(_0x2fdde9,_0x24d586))[_0xbb10('0x40')](handleError(_0x2fdde9,null));};exports['show']=function(_0xe2040f,_0x2e3214){var _0x44d6ae={'raw':![],'where':{'id':_0xe2040f[_0xbb10('0x41')]['id']}},_0x3a9934={};_0x3a9934[_0xbb10('0x42')]=_['keys'](db[_0xbb10('0x29')][_0xbb10('0x2a')]);_0x3a9934[_0xbb10('0x2c')]=_[_0xbb10('0x2b')](_0xe2040f['query']);_0x3a9934[_0xbb10('0x2d')]=_[_0xbb10('0x2e')](_0x3a9934[_0xbb10('0x42')],_0x3a9934[_0xbb10('0x2c')]);_0x44d6ae['attributes']=_[_0xbb10('0x2e')](_0x3a9934[_0xbb10('0x42')],qs['fields'](_0xe2040f['query'][_0xbb10('0x2f')]));_0x44d6ae['attributes']=_0x44d6ae[_0xbb10('0x31')][_0xbb10('0x30')]?_0x44d6ae['attributes']:_0x3a9934[_0xbb10('0x42')];if(_0xe2040f[_0xbb10('0x2c')][_0xbb10('0x3e')]){_0x44d6ae['include']=[{'all':!![]}];}_0x44d6ae=_[_0xbb10('0x38')]({},_0x44d6ae,_0xe2040f[_0xbb10('0x43')]);return db[_0xbb10('0x29')][_0xbb10('0x44')](_0x44d6ae)[_0xbb10('0x25')](handleEntityNotFound(_0x2e3214,null))[_0xbb10('0x25')](respondWithResult(_0x2e3214,null))[_0xbb10('0x40')](handleError(_0x2e3214,null));};exports[_0xbb10('0x45')]=function(_0x205bb4,_0x43b948){return db[_0xbb10('0x29')][_0xbb10('0x45')](_0x205bb4['body'],{})[_0xbb10('0x25')](respondWithResult(_0x43b948,0xc9))[_0xbb10('0x40')](handleError(_0x43b948,null));};exports['update']=function(_0x14e1cb,_0x2f5027){if(_0x14e1cb[_0xbb10('0x46')]['id']){delete _0x14e1cb[_0xbb10('0x46')]['id'];}return db[_0xbb10('0x29')][_0xbb10('0x44')]({'where':{'id':_0x14e1cb[_0xbb10('0x41')]['id']}})['then'](handleEntityNotFound(_0x2f5027,null))['then'](saveUpdates(_0x14e1cb[_0xbb10('0x46')],null))[_0xbb10('0x25')](respondWithResult(_0x2f5027,null))[_0xbb10('0x40')](handleError(_0x2f5027,null));};exports['destroy']=function(_0x5f0c12,_0x3cd6f3){return db[_0xbb10('0x29')][_0xbb10('0x44')]({'where':{'id':_0x5f0c12[_0xbb10('0x41')]['id']}})[_0xbb10('0x25')](handleEntityNotFound(_0x3cd6f3,null))[_0xbb10('0x25')](removeEntity(_0x3cd6f3,null))[_0xbb10('0x40')](handleError(_0x3cd6f3,null));};exports[_0xbb10('0x47')]=function(_0x2626d8,_0x3d7e7e){return db['UserProfileResource']['describe']()[_0xbb10('0x25')](respondWithResult(_0x3d7e7e,null))[_0xbb10('0x40')](handleError(_0x3d7e7e,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 1f7586c..b277ba8 100644 --- a/server/api/userProfileResource/userProfileResource.model.js +++ b/server/api/userProfileResource/userProfileResource.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbebb=['exports','define','UserProfileResource','compositeIndex','sectionId','lodash','util','../../config/logger','api','moment','request-promise','./userProfileResource.attributes'];(function(_0x4a2391,_0x82c6e1){var _0x16d5ba=function(_0x4202bb){while(--_0x4202bb){_0x4a2391['push'](_0x4a2391['shift']());}};_0x16d5ba(++_0x82c6e1);}(_0xbebb,0x191));var _0xbbeb=function(_0x18488f,_0x499856){_0x18488f=_0x18488f-0x0;var _0x2867f0=_0xbebb[_0x18488f];return _0x2867f0;};'use strict';var _=require(_0xbbeb('0x0'));var util=require(_0xbbeb('0x1'));var logger=require(_0xbbeb('0x2'))(_0xbbeb('0x3'));var moment=require(_0xbbeb('0x4'));var BPromise=require('bluebird');var rp=require(_0xbbeb('0x5'));var attributes=require(_0xbbeb('0x6'));module[_0xbbeb('0x7')]=function(_0x5af809,_0x5d0bcc){return _0x5af809[_0xbbeb('0x8')](_0xbbeb('0x9'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xbbeb('0xa'),'fields':['resourceId',_0xbbeb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x68fb=['exports','define','UserProfileResource','compositeIndex','resourceId','sectionId','api','bluebird','request-promise','./userProfileResource.attributes'];(function(_0xe68812,_0xc5a245){var _0xf304c3=function(_0xd8b116){while(--_0xd8b116){_0xe68812['push'](_0xe68812['shift']());}};_0xf304c3(++_0xc5a245);}(_0x68fb,0x182));var _0xb68f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x68fb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb68f('0x0'));var moment=require('moment');var BPromise=require(_0xb68f('0x1'));var rp=require(_0xb68f('0x2'));var attributes=require(_0xb68f('0x3'));module[_0xb68f('0x4')]=function(_0x115a31,_0x1464e1){return _0x115a31[_0xb68f('0x5')](_0xb68f('0x6'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xb68f('0x7'),'fields':[_0xb68f('0x8'),_0xb68f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index e62468b..25e7b20 100644 --- a/server/api/userProfileResource/userProfileResource.rpc.js +++ b/server/api/userProfileResource/userProfileResource.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4819=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment'];(function(_0x1be38f,_0xfd018b){var _0x310b31=function(_0x4cb28e){while(--_0x4cb28e){_0x1be38f['push'](_0x1be38f['shift']());}};_0x310b31(++_0xfd018b);}(_0x4819,0xcd));var _0x9481=function(_0x131bb1,_0x5c91cc){_0x131bb1=_0x131bb1-0x0;var _0x4b006b=_0x4819[_0x131bb1];return _0x4b006b;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var moment=require(_0x9481('0x1'));var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var Redis=require(_0x9481('0x4'));var db=require(_0x9481('0x5'))['db'];var utils=require(_0x9481('0x6'));var logger=require(_0x9481('0x7'))(_0x9481('0x8'));var config=require(_0x9481('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9481('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54cc78,_0x14e05a,_0x6c6a08){return new BPromise(function(_0x27c033,_0x3278ff){return client[_0x9481('0xb')](_0x54cc78,_0x6c6a08)['then'](function(_0x1818cf){logger['info'](_0x9481('0xc'),_0x14e05a,'request\x20sent');logger[_0x9481('0xd')](_0x9481('0xe'),_0x14e05a,_0x9481('0xf'),JSON[_0x9481('0x10')](_0x1818cf));if(_0x1818cf[_0x9481('0x11')]){if(_0x1818cf[_0x9481('0x11')][_0x9481('0x12')]===0x1f4){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf['error']['message']);return _0x3278ff(_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);}logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);return _0x27c033(_0x1818cf[_0x9481('0x11')]['message']);}else{logger[_0x9481('0x14')](_0x9481('0xc'),_0x14e05a,'request\x20sent');_0x27c033(_0x1818cf[_0x9481('0x15')]['message']);}})[_0x9481('0x16')](function(_0x7a2ac8){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x7a2ac8);_0x3278ff(_0x7a2ac8);});});} \ No newline at end of file +var _0x6050=['UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','then'];(function(_0x332237,_0x418da2){var _0x5ebe71=function(_0x2e9d4e){while(--_0x2e9d4e){_0x332237['push'](_0x332237['shift']());}};_0x5ebe71(++_0x418da2);}(_0x6050,0x196));var _0x0605=function(_0x380bd6,_0xbfc0fa){_0x380bd6=_0x380bd6-0x0;var _0x513440=_0x6050[_0x380bd6];return _0x513440;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var moment=require(_0x0605('0x2'));var BPromise=require(_0x0605('0x3'));var rs=require(_0x0605('0x4'));var fs=require('fs');var Redis=require(_0x0605('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0605('0x6'));var logger=require(_0x0605('0x7'))(_0x0605('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0605('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x578623,_0x58f7d2,_0x5660ad){return new BPromise(function(_0x1629bf,_0x11b8b5){return client[_0x0605('0xa')](_0x578623,_0x5660ad)[_0x0605('0xb')](function(_0x44fdd3){logger['info'](_0x0605('0xc'),_0x58f7d2,_0x0605('0xd'));logger[_0x0605('0xe')](_0x0605('0xf'),_0x58f7d2,_0x0605('0xd'),JSON[_0x0605('0x10')](_0x44fdd3));if(_0x44fdd3[_0x0605('0x11')]){if(_0x44fdd3[_0x0605('0x11')][_0x0605('0x12')]===0x1f4){logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);return _0x11b8b5(_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);}logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);return _0x1629bf(_0x44fdd3['error'][_0x0605('0x13')]);}else{logger[_0x0605('0x14')](_0x0605('0xc'),_0x58f7d2,'request\x20sent');_0x1629bf(_0x44fdd3['result'][_0x0605('0x13')]);}})[_0x0605('0x15')](function(_0xa83443){logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0xa83443);_0x11b8b5(_0xa83443);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 9167b35..195e77f 100644 --- a/server/api/userProfileSection/index.js +++ b/server/api/userProfileSection/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f6b=['isAuthenticated','index','/:id','show','post','create','put','update','destroy','util','path','connect-timeout','express','../../components/auth/service','get'];(function(_0x490cd3,_0x97d5ee){var _0x3320d7=function(_0x2ad809){while(--_0x2ad809){_0x490cd3['push'](_0x490cd3['shift']());}};_0x3320d7(++_0x97d5ee);}(_0x2f6b,0x81));var _0xb2f6=function(_0x4b793b,_0x1ee112){_0x4b793b=_0x4b793b-0x0;var _0xcfbd6a=_0x2f6b[_0x4b793b];return _0xcfbd6a;};'use strict';var multer=require('multer');var util=require(_0xb2f6('0x0'));var path=require(_0xb2f6('0x1'));var timeout=require(_0xb2f6('0x2'));var express=require(_0xb2f6('0x3'));var router=express['Router']();var auth=require(_0xb2f6('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0xb2f6('0x5')]('/',auth[_0xb2f6('0x6')](),controller[_0xb2f6('0x7')]);router[_0xb2f6('0x5')]('/describe',auth[_0xb2f6('0x6')](),controller['describe']);router[_0xb2f6('0x5')](_0xb2f6('0x8'),auth[_0xb2f6('0x6')](),controller[_0xb2f6('0x9')]);router[_0xb2f6('0xa')]('/',auth[_0xb2f6('0x6')](),controller[_0xb2f6('0xb')]);router[_0xb2f6('0xc')](_0xb2f6('0x8'),auth[_0xb2f6('0x6')](),controller[_0xb2f6('0xd')]);router['delete'](_0xb2f6('0x8'),auth[_0xb2f6('0x6')](),controller[_0xb2f6('0xe')]);module['exports']=router; \ No newline at end of file +var _0x1cbe=['/describe','isAuthenticated','/:id','show','post','create','put','update','delete','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index'];(function(_0x1b862a,_0x3e03af){var _0x1725fb=function(_0x599ab6){while(--_0x599ab6){_0x1b862a['push'](_0x1b862a['shift']());}};_0x1725fb(++_0x3e03af);}(_0x1cbe,0x1dd));var _0xe1cb=function(_0x1aaa57,_0x3b0b60){_0x1aaa57=_0x1aaa57-0x0;var _0x1e33ec=_0x1cbe[_0x1aaa57];return _0x1e33ec;};'use strict';var multer=require(_0xe1cb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe1cb('0x1'));var express=require('express');var router=express[_0xe1cb('0x2')]();var auth=require(_0xe1cb('0x3'));var interaction=require(_0xe1cb('0x4'));var config=require(_0xe1cb('0x5'));var controller=require(_0xe1cb('0x6'));router[_0xe1cb('0x7')]('/',auth['isAuthenticated'](),controller[_0xe1cb('0x8')]);router[_0xe1cb('0x7')](_0xe1cb('0x9'),auth[_0xe1cb('0xa')](),controller['describe']);router[_0xe1cb('0x7')](_0xe1cb('0xb'),auth[_0xe1cb('0xa')](),controller[_0xe1cb('0xc')]);router[_0xe1cb('0xd')]('/',auth['isAuthenticated'](),controller[_0xe1cb('0xe')]);router[_0xe1cb('0xf')](_0xe1cb('0xb'),auth[_0xe1cb('0xa')](),controller[_0xe1cb('0x10')]);router[_0xe1cb('0x11')](_0xe1cb('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 671f409..efbad2c 100644 --- a/server/api/userProfileSection/userProfileSection.attributes.js +++ b/server/api/userProfileSection/userProfileSection.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['setDataValue','crudPermissions','join','getDataValue','split','sequelize','STRING','INTEGER'];(function(_0x25b439,_0xb20872){var _0xbf2210=function(_0x518b01){while(--_0x518b01){_0x25b439['push'](_0x25b439['shift']());}};_0xbf2210(++_0xb20872);}(_0x3e74,0x175));var _0x43e7=function(_0x4cc3f3,_0x32c488){_0x4cc3f3=_0x4cc3f3-0x0;var _0x40d700=_0x3e74[_0x4cc3f3];return _0x40d700;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x43e7('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x43e7('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x43e7('0x1')],'set':function(_0x4f9bbe){this[_0x43e7('0x3')](_0x43e7('0x4'),_0x4f9bbe?_0x4f9bbe[_0x43e7('0x5')](''):[]);},'get':function(){return this[_0x43e7('0x6')](_0x43e7('0x4'))?this['getDataValue'](_0x43e7('0x4'))[_0x43e7('0x7')](''):[];}}}; \ No newline at end of file +var _0xedd9=['exports','STRING','INTEGER','BOOLEAN','crudPermissions','join','getDataValue'];(function(_0x184c55,_0x5efc44){var _0x1123a0=function(_0xedfffa){while(--_0xedfffa){_0x184c55['push'](_0x184c55['shift']());}};_0x1123a0(++_0x5efc44);}(_0xedd9,0xfc));var _0x9edd=function(_0x1cac1a,_0x3a49be){_0x1cac1a=_0x1cac1a-0x0;var _0x373ab9=_0xedd9[_0x1cac1a];return _0x373ab9;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'name':{'type':Sequelize[_0x9edd('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x9edd('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x9edd('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x9edd('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x9edd('0x1')],'set':function(_0x36b53f){this['setDataValue'](_0x9edd('0x4'),_0x36b53f?_0x36b53f[_0x9edd('0x5')](''):[]);},'get':function(){return this[_0x9edd('0x6')](_0x9edd('0x4'))?this['getDataValue'](_0x9edd('0x4'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 475cf7a..c08e508 100644 --- a/server/api/userProfileSection/userProfileSection.controller.js +++ b/server/api/userProfileSection/userProfileSection.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ff0=['fields','length','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','set','apply','update','destroy','then','stack','name','send','index','UserProfileSection','rawAttributes','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','key','field','options','count','includeAll','include','findAll','rows','catch','show','params'];(function(_0x382c20,_0x9e17dd){var _0x2e9687=function(_0x200091){while(--_0x200091){_0x382c20['push'](_0x382c20['shift']());}};_0x2e9687(++_0x9e17dd);}(_0x3ff0,0xd5));var _0x03ff=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x3ff0[_0x4709c0];return _0x13348b;};'use strict';var pdf=require(_0x03ff('0x0'));var emlformat=require(_0x03ff('0x1'));var rimraf=require(_0x03ff('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x03ff('0x3'));var rp=require(_0x03ff('0x4'));var moment=require(_0x03ff('0x5'));var BPromise=require(_0x03ff('0x6'));var Mustache=require('mustache');var util=require(_0x03ff('0x7'));var path=require(_0x03ff('0x8'));var sox=require('sox');var csv=require(_0x03ff('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x03ff('0xa'));var crypto=require(_0x03ff('0xb'));var jsforce=require(_0x03ff('0xc'));var deskjs=require(_0x03ff('0xd'));var toCsv=require(_0x03ff('0x9'));var querystring=require(_0x03ff('0xe'));var Papa=require(_0x03ff('0xf'));var authService=require(_0x03ff('0x10'));var hardwareService=require(_0x03ff('0x11'));var Redis=require(_0x03ff('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0x03ff('0x13'))(_0x03ff('0x14'));var utils=require(_0x03ff('0x15'));var config=require(_0x03ff('0x16'));var db=require(_0x03ff('0x17'))['db'];function respondWithStatusCode(_0xec239b,_0x8a8552){_0x8a8552=_0x8a8552||0xcc;return function(_0x35d084){if(_0x35d084){return _0xec239b['sendStatus'](_0x8a8552);}return _0xec239b[_0x03ff('0x18')](_0x8a8552)[_0x03ff('0x19')]();};}function respondWithResult(_0x55d798,_0x4a05f8){_0x4a05f8=_0x4a05f8||0xc8;return function(_0x4eb105){if(_0x4eb105){return _0x55d798[_0x03ff('0x18')](_0x4a05f8)['json'](_0x4eb105);}};}function respondWithFilteredResult(_0x29b25f,_0x41f40a){return function(_0x129a46){if(_0x129a46){var _0xb6682=_0x129a46['count'],_0x11910c=_0x41f40a['offset'],_0x20a931=_0x41f40a[_0x03ff('0x1a')]+_0x41f40a[_0x03ff('0x1b')],_0x3b344c;if(_0x20a931>=_0xb6682){_0x20a931=_0xb6682;_0x3b344c=0xc8;}else{_0x3b344c=0xce;}_0x29b25f[_0x03ff('0x18')](_0x3b344c);return _0x29b25f[_0x03ff('0x1c')]('Content-Range',_0x11910c+'-'+_0x20a931+'/'+_0xb6682)['json'](_0x129a46);}return null;};}function patchUpdates(_0x434bcf){return function(_0x4d1baa){try{jsonpatch[_0x03ff('0x1d')](_0x4d1baa,_0x434bcf,!![]);}catch(_0x516bd1){return BPromise['reject'](_0x516bd1);}return _0x4d1baa['save']();};}function saveUpdates(_0x17c59b,_0x35506c){return function(_0x5ae9a5){if(_0x5ae9a5){return _0x5ae9a5[_0x03ff('0x1e')](_0x17c59b)['then'](function(_0x4d35a5){return _0x4d35a5;});}return null;};}function removeEntity(_0x2325e3,_0x2ec3bf){return function(_0x2f2077){if(_0x2f2077){return _0x2f2077[_0x03ff('0x1f')]()[_0x03ff('0x20')](function(){_0x2325e3[_0x03ff('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dec4c,_0x19f630){return function(_0x1244a9){if(!_0x1244a9){_0x4dec4c['sendStatus'](0x194);}return _0x1244a9;};}function handleError(_0x35de57,_0x4f8817){_0x4f8817=_0x4f8817||0x1f4;return function(_0x439c1e){logger['error'](_0x439c1e[_0x03ff('0x21')]);if(_0x439c1e[_0x03ff('0x22')]){delete _0x439c1e[_0x03ff('0x22')];}_0x35de57[_0x03ff('0x18')](_0x4f8817)[_0x03ff('0x23')](_0x439c1e);};}exports[_0x03ff('0x24')]=function(_0x9bb1,_0x7b5342){var _0x23715a={},_0x4686b9={},_0x4fbf36={'count':0x0,'rows':[]};var _0x574638=db[_0x03ff('0x25')][_0x03ff('0x26')];_0x4686b9[_0x03ff('0x27')]=_[_0x03ff('0x28')](_0x574638);_0x4686b9[_0x03ff('0x29')]=_[_0x03ff('0x28')](_0x9bb1[_0x03ff('0x29')]);_0x4686b9[_0x03ff('0x2a')]=_['intersection'](_0x4686b9[_0x03ff('0x27')],_0x4686b9[_0x03ff('0x29')]);_0x23715a['attributes']=_[_0x03ff('0x2b')](_0x4686b9[_0x03ff('0x27')],qs['fields'](_0x9bb1['query']['fields']));_0x23715a[_0x03ff('0x2c')]=_0x23715a[_0x03ff('0x2c')]['length']?_0x23715a[_0x03ff('0x2c')]:_0x4686b9['model'];if(!_0x9bb1[_0x03ff('0x29')][_0x03ff('0x2d')](_0x03ff('0x2e'))){_0x23715a[_0x03ff('0x1b')]=qs[_0x03ff('0x1b')](_0x9bb1['query']['limit']);_0x23715a[_0x03ff('0x1a')]=qs[_0x03ff('0x1a')](_0x9bb1[_0x03ff('0x29')][_0x03ff('0x1a')]);}_0x23715a['order']=qs[_0x03ff('0x2f')](_0x9bb1[_0x03ff('0x29')][_0x03ff('0x2f')]);_0x23715a[_0x03ff('0x30')]=qs[_0x03ff('0x2a')](_[_0x03ff('0x31')](_0x9bb1[_0x03ff('0x29')],_0x4686b9[_0x03ff('0x2a')]));if(_0x9bb1[_0x03ff('0x29')][_0x03ff('0x32')]){_0x23715a[_0x03ff('0x30')]=_[_0x03ff('0x33')](_0x23715a[_0x03ff('0x30')],{'$or':_['map'](_0x574638,function(_0x4b823f){if(_0x4b823f['type'][_0x03ff('0x34')]!=='VIRTUAL'){var _0x24b2c3={};_0x24b2c3[_0x4b823f[_0x03ff('0x35')]]={'$like':'%'+_0x9bb1['query'][_0x03ff('0x32')]+'%'};return _0x24b2c3;}})});}_0x23715a=_[_0x03ff('0x33')]({},_0x23715a,_0x9bb1[_0x03ff('0x36')]);var _0x4f13d3={'where':_0x23715a[_0x03ff('0x30')]};return db[_0x03ff('0x25')][_0x03ff('0x37')](_0x4f13d3)['then'](function(_0x9c8cd2){_0x4fbf36['count']=_0x9c8cd2;if(_0x9bb1[_0x03ff('0x29')][_0x03ff('0x38')]){_0x23715a[_0x03ff('0x39')]=[{'all':!![]}];}return db['UserProfileSection'][_0x03ff('0x3a')](_0x23715a);})[_0x03ff('0x20')](function(_0x23d319){_0x4fbf36[_0x03ff('0x3b')]=_0x23d319;return _0x4fbf36;})[_0x03ff('0x20')](respondWithFilteredResult(_0x7b5342,_0x23715a))[_0x03ff('0x3c')](handleError(_0x7b5342,null));};exports[_0x03ff('0x3d')]=function(_0x500dc9,_0x1e34fe){var _0x4b3c10={'raw':![],'where':{'id':_0x500dc9[_0x03ff('0x3e')]['id']}},_0x20bae0={};_0x20bae0[_0x03ff('0x27')]=_[_0x03ff('0x28')](db['UserProfileSection']['rawAttributes']);_0x20bae0[_0x03ff('0x29')]=_[_0x03ff('0x28')](_0x500dc9[_0x03ff('0x29')]);_0x20bae0['filters']=_[_0x03ff('0x2b')](_0x20bae0['model'],_0x20bae0[_0x03ff('0x29')]);_0x4b3c10['attributes']=_['intersection'](_0x20bae0['model'],qs[_0x03ff('0x3f')](_0x500dc9['query'][_0x03ff('0x3f')]));_0x4b3c10[_0x03ff('0x2c')]=_0x4b3c10[_0x03ff('0x2c')][_0x03ff('0x40')]?_0x4b3c10[_0x03ff('0x2c')]:_0x20bae0[_0x03ff('0x27')];if(_0x500dc9[_0x03ff('0x29')]['includeAll']){_0x4b3c10[_0x03ff('0x39')]=[{'all':!![]}];}_0x4b3c10=_[_0x03ff('0x33')]({},_0x4b3c10,_0x500dc9[_0x03ff('0x36')]);return db['UserProfileSection'][_0x03ff('0x41')](_0x4b3c10)[_0x03ff('0x20')](handleEntityNotFound(_0x1e34fe,null))['then'](respondWithResult(_0x1e34fe,null))['catch'](handleError(_0x1e34fe,null));};exports[_0x03ff('0x42')]=function(_0x5bc554,_0x1482d2){return db[_0x03ff('0x25')][_0x03ff('0x42')](_0x5bc554[_0x03ff('0x43')],{})[_0x03ff('0x20')](respondWithResult(_0x1482d2,0xc9))[_0x03ff('0x3c')](handleError(_0x1482d2,null));};exports[_0x03ff('0x1e')]=function(_0x4ffdeb,_0x376b1d){if(_0x4ffdeb[_0x03ff('0x43')]['id']){delete _0x4ffdeb[_0x03ff('0x43')]['id'];}return db['UserProfileSection'][_0x03ff('0x41')]({'where':{'id':_0x4ffdeb['params']['id']}})[_0x03ff('0x20')](handleEntityNotFound(_0x376b1d,null))[_0x03ff('0x20')](saveUpdates(_0x4ffdeb[_0x03ff('0x43')],null))[_0x03ff('0x20')](respondWithResult(_0x376b1d,null))[_0x03ff('0x3c')](handleError(_0x376b1d,null));};exports[_0x03ff('0x1f')]=function(_0x2c681b,_0x5353b8){return db[_0x03ff('0x25')][_0x03ff('0x41')]({'where':{'id':_0x2c681b[_0x03ff('0x3e')]['id']}})[_0x03ff('0x20')](handleEntityNotFound(_0x5353b8,null))[_0x03ff('0x20')](removeEntity(_0x5353b8,null))[_0x03ff('0x3c')](handleError(_0x5353b8,null));};exports[_0x03ff('0x44')]=function(_0x5a633e,_0x5c2ac8){return db[_0x03ff('0x25')][_0x03ff('0x44')]()[_0x03ff('0x20')](respondWithResult(_0x5c2ac8,null))[_0x03ff('0x3c')](handleError(_0x5c2ac8,null));}; \ No newline at end of file +var _0xbe14=['intersection','fields','attributes','hasOwnProperty','limit','order','pick','filter','where','merge','map','type','key','VIRTUAL','field','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','name','send','index','UserProfileSection','model','keys','query','filters'];(function(_0x228106,_0x29b7c4){var _0x3d1588=function(_0x192f97){while(--_0x192f97){_0x228106['push'](_0x228106['shift']());}};_0x3d1588(++_0x29b7c4);}(_0xbe14,0xec));var _0x4be1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbe14[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4be1('0x0'));var rimraf=require(_0x4be1('0x1'));var zipdir=require(_0x4be1('0x2'));var jsonpatch=require(_0x4be1('0x3'));var rp=require(_0x4be1('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4be1('0x5'));var util=require('util');var path=require('path');var sox=require(_0x4be1('0x6'));var csv=require(_0x4be1('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4be1('0x8'));var squel=require(_0x4be1('0x9'));var crypto=require(_0x4be1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4be1('0xb'));var toCsv=require(_0x4be1('0x7'));var querystring=require('querystring');var Papa=require(_0x4be1('0xc'));var authService=require(_0x4be1('0xd'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x4be1('0xe'));var qs=require(_0x4be1('0xf'));var logger=require('../../config/logger')(_0x4be1('0x10'));var utils=require(_0x4be1('0x11'));var config=require('../../config/environment');var db=require(_0x4be1('0x12'))['db'];function respondWithStatusCode(_0x2393a2,_0x4a1841){_0x4a1841=_0x4a1841||0xcc;return function(_0x54390e){if(_0x54390e){return _0x2393a2[_0x4be1('0x13')](_0x4a1841);}return _0x2393a2[_0x4be1('0x14')](_0x4a1841)[_0x4be1('0x15')]();};}function respondWithResult(_0x4ec19e,_0x1485eb){_0x1485eb=_0x1485eb||0xc8;return function(_0x160d90){if(_0x160d90){return _0x4ec19e[_0x4be1('0x14')](_0x1485eb)[_0x4be1('0x16')](_0x160d90);}};}function respondWithFilteredResult(_0x1c6235,_0x4c8dbd){return function(_0x1fbed6){if(_0x1fbed6){var _0xa6a520=_0x1fbed6[_0x4be1('0x17')],_0x19cf5a=_0x4c8dbd['offset'],_0x3aebc1=_0x4c8dbd[_0x4be1('0x18')]+_0x4c8dbd['limit'],_0x593762;if(_0x3aebc1>=_0xa6a520){_0x3aebc1=_0xa6a520;_0x593762=0xc8;}else{_0x593762=0xce;}_0x1c6235[_0x4be1('0x14')](_0x593762);return _0x1c6235[_0x4be1('0x19')](_0x4be1('0x1a'),_0x19cf5a+'-'+_0x3aebc1+'/'+_0xa6a520)[_0x4be1('0x16')](_0x1fbed6);}return null;};}function patchUpdates(_0x50c19d){return function(_0x406ce7){try{jsonpatch[_0x4be1('0x1b')](_0x406ce7,_0x50c19d,!![]);}catch(_0x5885c9){return BPromise[_0x4be1('0x1c')](_0x5885c9);}return _0x406ce7[_0x4be1('0x1d')]();};}function saveUpdates(_0x2baf1d,_0x111653){return function(_0x5ea7b4){if(_0x5ea7b4){return _0x5ea7b4[_0x4be1('0x1e')](_0x2baf1d)[_0x4be1('0x1f')](function(_0x32b88e){return _0x32b88e;});}return null;};}function removeEntity(_0x80ab5b,_0x472f61){return function(_0x855c42){if(_0x855c42){return _0x855c42['destroy']()[_0x4be1('0x1f')](function(){_0x80ab5b['status'](0xcc)[_0x4be1('0x15')]();});}};}function handleEntityNotFound(_0x13e8a9,_0x44d9bc){return function(_0x1c518b){if(!_0x1c518b){_0x13e8a9['sendStatus'](0x194);}return _0x1c518b;};}function handleError(_0x439d78,_0x288e90){_0x288e90=_0x288e90||0x1f4;return function(_0x2a5037){logger['error'](_0x2a5037['stack']);if(_0x2a5037[_0x4be1('0x20')]){delete _0x2a5037[_0x4be1('0x20')];}_0x439d78['status'](_0x288e90)[_0x4be1('0x21')](_0x2a5037);};}exports[_0x4be1('0x22')]=function(_0x5073c8,_0x558db6){var _0x3a9da1={},_0x2b9460={},_0x4580d3={'count':0x0,'rows':[]};var _0x264c57=db[_0x4be1('0x23')]['rawAttributes'];_0x2b9460[_0x4be1('0x24')]=_[_0x4be1('0x25')](_0x264c57);_0x2b9460[_0x4be1('0x26')]=_[_0x4be1('0x25')](_0x5073c8[_0x4be1('0x26')]);_0x2b9460[_0x4be1('0x27')]=_[_0x4be1('0x28')](_0x2b9460['model'],_0x2b9460[_0x4be1('0x26')]);_0x3a9da1['attributes']=_['intersection'](_0x2b9460[_0x4be1('0x24')],qs[_0x4be1('0x29')](_0x5073c8[_0x4be1('0x26')][_0x4be1('0x29')]));_0x3a9da1[_0x4be1('0x2a')]=_0x3a9da1[_0x4be1('0x2a')]['length']?_0x3a9da1[_0x4be1('0x2a')]:_0x2b9460['model'];if(!_0x5073c8['query'][_0x4be1('0x2b')]('nolimit')){_0x3a9da1[_0x4be1('0x2c')]=qs[_0x4be1('0x2c')](_0x5073c8[_0x4be1('0x26')][_0x4be1('0x2c')]);_0x3a9da1[_0x4be1('0x18')]=qs['offset'](_0x5073c8[_0x4be1('0x26')][_0x4be1('0x18')]);}_0x3a9da1[_0x4be1('0x2d')]=qs['sort'](_0x5073c8[_0x4be1('0x26')]['sort']);_0x3a9da1['where']=qs[_0x4be1('0x27')](_[_0x4be1('0x2e')](_0x5073c8[_0x4be1('0x26')],_0x2b9460[_0x4be1('0x27')]));if(_0x5073c8[_0x4be1('0x26')][_0x4be1('0x2f')]){_0x3a9da1[_0x4be1('0x30')]=_[_0x4be1('0x31')](_0x3a9da1[_0x4be1('0x30')],{'$or':_[_0x4be1('0x32')](_0x264c57,function(_0x4ac5bd){if(_0x4ac5bd[_0x4be1('0x33')][_0x4be1('0x34')]!==_0x4be1('0x35')){var _0x2922dd={};_0x2922dd[_0x4ac5bd[_0x4be1('0x36')]]={'$like':'%'+_0x5073c8[_0x4be1('0x26')][_0x4be1('0x2f')]+'%'};return _0x2922dd;}})});}_0x3a9da1=_[_0x4be1('0x31')]({},_0x3a9da1,_0x5073c8[_0x4be1('0x37')]);var _0x2bf550={'where':_0x3a9da1[_0x4be1('0x30')]};return db[_0x4be1('0x23')][_0x4be1('0x17')](_0x2bf550)['then'](function(_0x2d61fd){_0x4580d3[_0x4be1('0x17')]=_0x2d61fd;if(_0x5073c8[_0x4be1('0x26')][_0x4be1('0x38')]){_0x3a9da1['include']=[{'all':!![]}];}return db[_0x4be1('0x23')][_0x4be1('0x39')](_0x3a9da1);})[_0x4be1('0x1f')](function(_0x364167){_0x4580d3[_0x4be1('0x3a')]=_0x364167;return _0x4580d3;})[_0x4be1('0x1f')](respondWithFilteredResult(_0x558db6,_0x3a9da1))[_0x4be1('0x3b')](handleError(_0x558db6,null));};exports[_0x4be1('0x3c')]=function(_0x29a653,_0x4e6127){var _0x3b7838={'raw':![],'where':{'id':_0x29a653[_0x4be1('0x3d')]['id']}},_0x1f5ec1={};_0x1f5ec1[_0x4be1('0x24')]=_[_0x4be1('0x25')](db[_0x4be1('0x23')]['rawAttributes']);_0x1f5ec1['query']=_[_0x4be1('0x25')](_0x29a653[_0x4be1('0x26')]);_0x1f5ec1['filters']=_[_0x4be1('0x28')](_0x1f5ec1[_0x4be1('0x24')],_0x1f5ec1[_0x4be1('0x26')]);_0x3b7838[_0x4be1('0x2a')]=_[_0x4be1('0x28')](_0x1f5ec1[_0x4be1('0x24')],qs['fields'](_0x29a653['query']['fields']));_0x3b7838[_0x4be1('0x2a')]=_0x3b7838['attributes'][_0x4be1('0x3e')]?_0x3b7838[_0x4be1('0x2a')]:_0x1f5ec1[_0x4be1('0x24')];if(_0x29a653[_0x4be1('0x26')][_0x4be1('0x38')]){_0x3b7838[_0x4be1('0x3f')]=[{'all':!![]}];}_0x3b7838=_[_0x4be1('0x31')]({},_0x3b7838,_0x29a653[_0x4be1('0x37')]);return db[_0x4be1('0x23')][_0x4be1('0x40')](_0x3b7838)[_0x4be1('0x1f')](handleEntityNotFound(_0x4e6127,null))['then'](respondWithResult(_0x4e6127,null))[_0x4be1('0x3b')](handleError(_0x4e6127,null));};exports['create']=function(_0x647449,_0x2a1fe2){return db['UserProfileSection'][_0x4be1('0x41')](_0x647449['body'],{})[_0x4be1('0x1f')](respondWithResult(_0x2a1fe2,0xc9))[_0x4be1('0x3b')](handleError(_0x2a1fe2,null));};exports[_0x4be1('0x1e')]=function(_0x53c26a,_0x4c94f6){if(_0x53c26a[_0x4be1('0x42')]['id']){delete _0x53c26a['body']['id'];}return db[_0x4be1('0x23')][_0x4be1('0x40')]({'where':{'id':_0x53c26a[_0x4be1('0x3d')]['id']}})[_0x4be1('0x1f')](handleEntityNotFound(_0x4c94f6,null))[_0x4be1('0x1f')](saveUpdates(_0x53c26a['body'],null))['then'](respondWithResult(_0x4c94f6,null))[_0x4be1('0x3b')](handleError(_0x4c94f6,null));};exports[_0x4be1('0x43')]=function(_0x176245,_0x25c9d8){return db['UserProfileSection'][_0x4be1('0x40')]({'where':{'id':_0x176245[_0x4be1('0x3d')]['id']}})['then'](handleEntityNotFound(_0x25c9d8,null))['then'](removeEntity(_0x25c9d8,null))[_0x4be1('0x3b')](handleError(_0x25c9d8,null));};exports[_0x4be1('0x44')]=function(_0x43c1cf,_0x2e3a3f){return db[_0x4be1('0x23')]['describe']()[_0x4be1('0x1f')](respondWithResult(_0x2e3a3f,null))['catch'](handleError(_0x2e3a3f,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 67061de..04c4f3d 100644 --- a/server/api/userProfileSection/userProfileSection.model.js +++ b/server/api/userProfileSection/userProfileSection.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6596=['util','api','moment','bluebird','request-promise','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','lodash'];(function(_0x5d64c7,_0x559161){var _0x4bc7da=function(_0x5efec5){while(--_0x5efec5){_0x5d64c7['push'](_0x5d64c7['shift']());}};_0x4bc7da(++_0x559161);}(_0x6596,0x1d3));var _0x6659=function(_0x1f2650,_0x33ac2f){_0x1f2650=_0x1f2650-0x0;var _0x1d8ae7=_0x6596[_0x1f2650];return _0x1d8ae7;};'use strict';var _=require(_0x6659('0x0'));var util=require(_0x6659('0x1'));var logger=require('../../config/logger')(_0x6659('0x2'));var moment=require(_0x6659('0x3'));var BPromise=require(_0x6659('0x4'));var rp=require(_0x6659('0x5'));var attributes=require(_0x6659('0x6'));module[_0x6659('0x7')]=function(_0x4bfd3c,_0x483945){return _0x4bfd3c[_0x6659('0x8')](_0x6659('0x9'),attributes,{'tableName':_0x6659('0xa'),'paranoid':![],'indexes':[{'name':_0x6659('0xb'),'fields':[_0x6659('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xde9c=['util','api','moment','bluebird','./userProfileSection.attributes','exports','user_profile_has_sections','compositeIndex','sectionId','lodash'];(function(_0x362b51,_0x4b3c31){var _0x18eb50=function(_0x4f0780){while(--_0x4f0780){_0x362b51['push'](_0x362b51['shift']());}};_0x18eb50(++_0x4b3c31);}(_0xde9c,0xa9));var _0xcde9=function(_0x25207a,_0x587b1e){_0x25207a=_0x25207a-0x0;var _0x41f3cf=_0xde9c[_0x25207a];return _0x41f3cf;};'use strict';var _=require(_0xcde9('0x0'));var util=require(_0xcde9('0x1'));var logger=require('../../config/logger')(_0xcde9('0x2'));var moment=require(_0xcde9('0x3'));var BPromise=require(_0xcde9('0x4'));var rp=require('request-promise');var attributes=require(_0xcde9('0x5'));module[_0xcde9('0x6')]=function(_0x30a01a,_0x38b589){return _0x30a01a['define']('UserProfileSection',attributes,{'tableName':_0xcde9('0x7'),'paranoid':![],'indexes':[{'name':_0xcde9('0x8'),'fields':[_0xcde9('0x9'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index d293a06..665e25a 100644 --- a/server/api/userProfileSection/userProfileSection.rpc.js +++ b/server/api/userProfileSection/userProfileSection.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb6b3=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xb6b3,0x12e));var _0x3b6b=function(_0x4fed6b,_0x36778f){_0x4fed6b=_0x4fed6b-0x0;var _0x430512=_0xb6b3[_0x4fed6b];return _0x430512;};'use strict';var _=require(_0x3b6b('0x0'));var util=require('util');var moment=require(_0x3b6b('0x1'));var BPromise=require(_0x3b6b('0x2'));var rs=require(_0x3b6b('0x3'));var fs=require('fs');var Redis=require(_0x3b6b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b6b('0x5'));var logger=require(_0x3b6b('0x6'))(_0x3b6b('0x7'));var config=require(_0x3b6b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3b6b('0x9')][_0x3b6b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c70a6,_0x3466b7,_0x433b29){return new BPromise(function(_0xee92d3,_0x19732d){return client[_0x3b6b('0xb')](_0x2c70a6,_0x433b29)[_0x3b6b('0xc')](function(_0x5d4bdc){logger[_0x3b6b('0xd')](_0x3b6b('0xe'),_0x3466b7,'request\x20sent');logger[_0x3b6b('0xf')](_0x3b6b('0x10'),_0x3466b7,_0x3b6b('0x11'),JSON['stringify'](_0x5d4bdc));if(_0x5d4bdc[_0x3b6b('0x12')]){if(_0x5d4bdc['error'][_0x3b6b('0x13')]===0x1f4){logger[_0x3b6b('0x12')](_0x3b6b('0xe'),_0x3466b7,_0x5d4bdc['error']['message']);return _0x19732d(_0x5d4bdc['error'][_0x3b6b('0x14')]);}logger[_0x3b6b('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x3466b7,_0x5d4bdc['error'][_0x3b6b('0x14')]);return _0xee92d3(_0x5d4bdc[_0x3b6b('0x12')][_0x3b6b('0x14')]);}else{logger[_0x3b6b('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x3466b7,_0x3b6b('0x11'));_0xee92d3(_0x5d4bdc[_0x3b6b('0x15')][_0x3b6b('0x14')]);}})[_0x3b6b('0x16')](function(_0x5b9b95){logger['error'](_0x3b6b('0xe'),_0x3466b7,_0x5b9b95);_0x19732d(_0x5b9b95);});});} \ No newline at end of file +var _0x3627=['then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request'];(function(_0x49a308,_0xff6076){var _0x1db127=function(_0x33f0c1){while(--_0x33f0c1){_0x49a308['push'](_0x49a308['shift']());}};_0x1db127(++_0xff6076);}(_0x3627,0x170));var _0x7362=function(_0x170453,_0x4fa4d9){_0x170453=_0x170453-0x0;var _0x14cd7e=_0x3627[_0x170453];return _0x14cd7e;};'use strict';var _=require(_0x7362('0x0'));var util=require('util');var moment=require(_0x7362('0x1'));var BPromise=require(_0x7362('0x2'));var rs=require(_0x7362('0x3'));var fs=require('fs');var Redis=require(_0x7362('0x4'));var db=require(_0x7362('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7362('0x6'));var jayson=require(_0x7362('0x7'));var client=jayson[_0x7362('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd47322,_0x268b53,_0x1f4ce2){return new BPromise(function(_0x36db9a,_0x3d51fa){return client[_0x7362('0x9')](_0xd47322,_0x1f4ce2)[_0x7362('0xa')](function(_0x1bbbe7){logger[_0x7362('0xb')](_0x7362('0xc'),_0x268b53,_0x7362('0xd'));logger['debug'](_0x7362('0xe'),_0x268b53,_0x7362('0xd'),JSON[_0x7362('0xf')](_0x1bbbe7));if(_0x1bbbe7[_0x7362('0x10')]){if(_0x1bbbe7[_0x7362('0x10')][_0x7362('0x11')]===0x1f4){logger[_0x7362('0x10')](_0x7362('0xc'),_0x268b53,_0x1bbbe7[_0x7362('0x10')][_0x7362('0x12')]);return _0x3d51fa(_0x1bbbe7[_0x7362('0x10')][_0x7362('0x12')]);}logger[_0x7362('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x268b53,_0x1bbbe7[_0x7362('0x10')]['message']);return _0x36db9a(_0x1bbbe7[_0x7362('0x10')][_0x7362('0x12')]);}else{logger['info'](_0x7362('0xc'),_0x268b53,_0x7362('0xd'));_0x36db9a(_0x1bbbe7[_0x7362('0x13')][_0x7362('0x12')]);}})[_0x7362('0x14')](function(_0x33f7f1){logger[_0x7362('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x268b53,_0x33f7f1);_0x3d51fa(_0x33f7f1);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index e9ed1d5..fc51900 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 _0x0af5=['../../config/environment','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xb5e11c,_0x4477e2){var _0x9de970=function(_0x2b2f49){while(--_0x2b2f49){_0xb5e11c['push'](_0xb5e11c['shift']());}};_0x9de970(++_0x4477e2);}(_0x0af5,0x158));var _0x50af=function(_0x16aaa6,_0x3dfb6b){_0x16aaa6=_0x16aaa6-0x0;var _0x3b2925=_0x0af5[_0x16aaa6];return _0x3b2925;};'use strict';var multer=require('multer');var util=require(_0x50af('0x0'));var path=require(_0x50af('0x1'));var timeout=require(_0x50af('0x2'));var express=require(_0x50af('0x3'));var router=express[_0x50af('0x4')]();var auth=require(_0x50af('0x5'));var interaction=require(_0x50af('0x6'));var config=require(_0x50af('0x7'));module[_0x50af('0x8')]=router; \ No newline at end of file +var _0xc4aa=['path','connect-timeout','express','Router','exports','multer','util'];(function(_0x37d44b,_0x59c26d){var _0x362102=function(_0x530a88){while(--_0x530a88){_0x37d44b['push'](_0x37d44b['shift']());}};_0x362102(++_0x59c26d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xc4aa[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xac4a('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index fe8a5d0..af9cb0a 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 _0x2567=['exports','INTEGER'];(function(_0x40151b,_0x2a54e0){var _0x25a8ed=function(_0x28b45d){while(--_0x28b45d){_0x40151b['push'](_0x40151b['shift']());}};_0x25a8ed(++_0x2a54e0);}(_0x2567,0x19c));var _0x7256=function(_0x12b2bc,_0x480fd4){_0x12b2bc=_0x12b2bc-0x0;var _0xd99024=_0x2567[_0x12b2bc];return _0xd99024;};'use strict';var Sequelize=require('sequelize');module[_0x7256('0x0')]={'penalty':{'type':Sequelize[_0x7256('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x098d=['exports','INTEGER','sequelize'];(function(_0x36487a,_0x46d60c){var _0x32d29e=function(_0x184462){while(--_0x184462){_0x36487a['push'](_0x36487a['shift']());}};_0x32d29e(++_0x46d60c);}(_0x098d,0x143));var _0xd098=function(_0x3e6729,_0x16d4af){_0x3e6729=_0x3e6729-0x0;var _0x535bcd=_0x098d[_0x3e6729];return _0x535bcd;};'use strict';var Sequelize=require(_0xd098('0x0'));module[_0xd098('0x1')]={'penalty':{'type':Sequelize[_0xd098('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index e0f9470..ae0c477 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 _0x0948=['request-promise','define','UserSmsQueue','user_has_sms_queues','../../config/logger','api','moment','bluebird'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0948,0x164));var _0x8094=function(_0x5e2c70,_0x108e64){_0x5e2c70=_0x5e2c70-0x0;var _0x1e6cbc=_0x0948[_0x5e2c70];return _0x1e6cbc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8094('0x0'))(_0x8094('0x1'));var moment=require(_0x8094('0x2'));var BPromise=require(_0x8094('0x3'));var rp=require(_0x8094('0x4'));var attributes=require('./userSmsQueue.attributes');module['exports']=function(_0x3578de,_0x96b667){return _0x3578de[_0x8094('0x5')](_0x8094('0x6'),attributes,{'tableName':_0x8094('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7af=['api','request-promise','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash'];(function(_0x51fc60,_0x5120df){var _0x2dbb3a=function(_0x291b18){while(--_0x291b18){_0x51fc60['push'](_0x51fc60['shift']());}};_0x2dbb3a(++_0x5120df);}(_0xa7af,0x1a7));var _0xfa7a=function(_0x51c42d,_0x5a3157){_0x51c42d=_0x51c42d-0x0;var _0x235f19=_0xa7af[_0x51c42d];return _0x235f19;};'use strict';var _=require(_0xfa7a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfa7a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfa7a('0x2'));var attributes=require(_0xfa7a('0x3'));module[_0xfa7a('0x4')]=function(_0x1f17fc,_0x589e14){return _0x1f17fc[_0xfa7a('0x5')](_0xfa7a('0x6'),attributes,{'tableName':_0xfa7a('0x7'),'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 ac29c88..b705c55 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 _0x035d=['request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http'];(function(_0x2a5f37,_0x34adf4){var _0x37789a=function(_0x1a5aee){while(--_0x1a5aee){_0x2a5f37['push'](_0x2a5f37['shift']());}};_0x37789a(++_0x34adf4);}(_0x035d,0x14c));var _0xd035=function(_0x3ae5a1,_0x5bce94){_0x3ae5a1=_0x3ae5a1-0x0;var _0x31ed3f=_0x035d[_0x3ae5a1];return _0x31ed3f;};'use strict';var _=require(_0xd035('0x0'));var util=require(_0xd035('0x1'));var moment=require(_0xd035('0x2'));var BPromise=require(_0xd035('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd035('0x4'));var db=require(_0xd035('0x5'))['db'];var utils=require(_0xd035('0x6'));var logger=require('../../config/logger')(_0xd035('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd035('0x8')][_0xd035('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a3bd6,_0x276964,_0x1b4ce2){return new BPromise(function(_0x154509,_0x418eb0){return client[_0xd035('0xa')](_0x3a3bd6,_0x1b4ce2)[_0xd035('0xb')](function(_0x2f5d87){logger['info'](_0xd035('0xc'),_0x276964,_0xd035('0xd'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x276964,'request\x20sent',JSON['stringify'](_0x2f5d87));if(_0x2f5d87['error']){if(_0x2f5d87[_0xd035('0xe')]['code']===0x1f4){logger[_0xd035('0xe')](_0xd035('0xc'),_0x276964,_0x2f5d87['error']['message']);return _0x418eb0(_0x2f5d87[_0xd035('0xe')][_0xd035('0xf')]);}logger[_0xd035('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x276964,_0x2f5d87[_0xd035('0xe')][_0xd035('0xf')]);return _0x154509(_0x2f5d87[_0xd035('0xe')][_0xd035('0xf')]);}else{logger[_0xd035('0x10')](_0xd035('0xc'),_0x276964,_0xd035('0xd'));_0x154509(_0x2f5d87[_0xd035('0x11')][_0xd035('0xf')]);}})[_0xd035('0x12')](function(_0x63703d){logger['error'](_0xd035('0xc'),_0x276964,_0x63703d);_0x418eb0(_0x63703d);});});} \ No newline at end of file +var _0xbfd7=['result','catch','lodash','moment','../../config/utils','../../config/logger','jayson/promise','http','then','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbfd7,0xb2));var _0x7bfd=function(_0x38eff3,_0x3fa62b){_0x38eff3=_0x38eff3-0x0;var _0x4e6bc9=_0xbfd7[_0x38eff3];return _0x4e6bc9;};'use strict';var _=require(_0x7bfd('0x0'));var util=require('util');var moment=require(_0x7bfd('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7bfd('0x2'));var logger=require(_0x7bfd('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7bfd('0x4'));var client=jayson['client'][_0x7bfd('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x55d2d2,_0xd2e8e0,_0x49b16c){return new BPromise(function(_0x202b05,_0x1d3b5e){return client['request'](_0x55d2d2,_0x49b16c)[_0x7bfd('0x6')](function(_0x512004){logger['info'](_0x7bfd('0x7'),_0xd2e8e0,'request\x20sent');logger[_0x7bfd('0x8')](_0x7bfd('0x9'),_0xd2e8e0,'request\x20sent',JSON[_0x7bfd('0xa')](_0x512004));if(_0x512004[_0x7bfd('0xb')]){if(_0x512004[_0x7bfd('0xb')]['code']===0x1f4){logger[_0x7bfd('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0xd2e8e0,_0x512004[_0x7bfd('0xb')][_0x7bfd('0xc')]);return _0x1d3b5e(_0x512004['error'][_0x7bfd('0xc')]);}logger[_0x7bfd('0xb')](_0x7bfd('0x7'),_0xd2e8e0,_0x512004['error'][_0x7bfd('0xc')]);return _0x202b05(_0x512004[_0x7bfd('0xb')][_0x7bfd('0xc')]);}else{logger['info'](_0x7bfd('0x7'),_0xd2e8e0,_0x7bfd('0xd'));_0x202b05(_0x512004[_0x7bfd('0xe')]['message']);}})[_0x7bfd('0xf')](function(_0x5e333c){logger[_0x7bfd('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0xd2e8e0,_0x5e333c);_0x1d3b5e(_0x5e333c);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 9db9d25..51b32b3 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 _0x6596=['../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','connect-timeout','express','Router'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x6596,0x1d3));var _0x6659=function(_0x3e5d35,_0x5d6e7f){_0x3e5d35=_0x3e5d35-0x0;var _0x287c7a=_0x6596[_0x3e5d35];return _0x287c7a;};'use strict';var multer=require(_0x6659('0x0'));var util=require(_0x6659('0x1'));var path=require('path');var timeout=require(_0x6659('0x2'));var express=require(_0x6659('0x3'));var router=express[_0x6659('0x4')]();var auth=require(_0x6659('0x5'));var interaction=require(_0x6659('0x6'));var config=require(_0x6659('0x7'));module['exports']=router; \ No newline at end of file +var _0x6dc0=['path','express','Router','../../components/auth/service','../../components/interaction/service','exports','multer','util'];(function(_0x235290,_0x2906df){var _0xc0de5b=function(_0x2d5efe){while(--_0x2d5efe){_0x235290['push'](_0x235290['shift']());}};_0xc0de5b(++_0x2906df);}(_0x6dc0,0xb6));var _0x06dc=function(_0x33a755,_0x73749e){_0x33a755=_0x33a755-0x0;var _0x22d12d=_0x6dc0[_0x33a755];return _0x22d12d;};'use strict';var multer=require(_0x06dc('0x0'));var util=require(_0x06dc('0x1'));var path=require(_0x06dc('0x2'));var timeout=require('connect-timeout');var express=require(_0x06dc('0x3'));var router=express[_0x06dc('0x4')]();var auth=require(_0x06dc('0x5'));var interaction=require(_0x06dc('0x6'));var config=require('../../config/environment');module[_0x06dc('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 888917b..f98f4a6 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 _0x062d=['INTEGER','sequelize','exports'];(function(_0x45d89e,_0x24664d){var _0x473b7e=function(_0x5351f6){while(--_0x5351f6){_0x45d89e['push'](_0x45d89e['shift']());}};_0x473b7e(++_0x24664d);}(_0x062d,0x166));var _0xd062=function(_0x5aa20c,_0x28b6ca){_0x5aa20c=_0x5aa20c-0x0;var _0x5d0a3a=_0x062d[_0x5aa20c];return _0x5d0a3a;};'use strict';var Sequelize=require(_0xd062('0x0'));module[_0xd062('0x1')]={'penalty':{'type':Sequelize[_0xd062('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x896f=['exports','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x896f,0x104));var _0xf896=function(_0x24fa1a,_0x16d9c2){_0x24fa1a=_0x24fa1a-0x0;var _0xc5621f=_0x896f[_0x24fa1a];return _0xc5621f;};'use strict';var Sequelize=require(_0xf896('0x0'));module[_0xf896('0x1')]={'penalty':{'type':Sequelize[_0xf896('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 7e7e3f8..9204dda 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 _0xc0cd=['moment','request-promise','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','../../config/logger','api'];(function(_0x26db22,_0x4daaaa){var _0x59c08c=function(_0x3dc28c){while(--_0x3dc28c){_0x26db22['push'](_0x26db22['shift']());}};_0x59c08c(++_0x4daaaa);}(_0xc0cd,0x73));var _0xdc0c=function(_0xbae92c,_0x3a32f1){_0xbae92c=_0xbae92c-0x0;var _0x5acfe4=_0xc0cd[_0xbae92c];return _0x5acfe4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdc0c('0x0'))(_0xdc0c('0x1'));var moment=require(_0xdc0c('0x2'));var BPromise=require('bluebird');var rp=require(_0xdc0c('0x3'));var attributes=require(_0xdc0c('0x4'));module[_0xdc0c('0x5')]=function(_0x5d889c,_0x560919){return _0x5d889c[_0xdc0c('0x6')](_0xdc0c('0x7'),attributes,{'tableName':_0xdc0c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fab=['define','UserVoiceQueue','user_has_voice_queues','util','api','bluebird','exports'];(function(_0x2cdec6,_0x39d4c8){var _0xa36703=function(_0x6bb8d4){while(--_0x6bb8d4){_0x2cdec6['push'](_0x2cdec6['shift']());}};_0xa36703(++_0x39d4c8);}(_0x9fab,0x1c3));var _0xb9fa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9fab[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xb9fa('0x0'));var logger=require('../../config/logger')(_0xb9fa('0x1'));var moment=require('moment');var BPromise=require(_0xb9fa('0x2'));var rp=require('request-promise');var attributes=require('./userVoiceQueue.attributes');module[_0xb9fa('0x3')]=function(_0x2f97f0,_0x1cce36){return _0x2f97f0[_0xb9fa('0x4')](_0xb9fa('0x5'),attributes,{'tableName':_0xb9fa('0x6'),'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 980dee8..4f341bb 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 _0x8068=['result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8068,0x1c9));var _0x8806=function(_0x52de9b,_0x19df61){_0x52de9b=_0x52de9b-0x0;var _0x1ad0c7=_0x8068[_0x52de9b];return _0x1ad0c7;};'use strict';var _=require(_0x8806('0x0'));var util=require('util');var moment=require(_0x8806('0x1'));var BPromise=require('bluebird');var rs=require(_0x8806('0x2'));var fs=require('fs');var Redis=require(_0x8806('0x3'));var db=require(_0x8806('0x4'))['db'];var utils=require(_0x8806('0x5'));var logger=require(_0x8806('0x6'))(_0x8806('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8806('0x8')][_0x8806('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5bd2ee,_0x582163,_0x544e32){return new BPromise(function(_0x56e537,_0x31714f){return client['request'](_0x5bd2ee,_0x544e32)[_0x8806('0xa')](function(_0x1861a8){logger[_0x8806('0xb')](_0x8806('0xc'),_0x582163,_0x8806('0xd'));logger[_0x8806('0xe')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x582163,_0x8806('0xd'),JSON['stringify'](_0x1861a8));if(_0x1861a8[_0x8806('0xf')]){if(_0x1861a8[_0x8806('0xf')][_0x8806('0x10')]===0x1f4){logger[_0x8806('0xf')](_0x8806('0xc'),_0x582163,_0x1861a8[_0x8806('0xf')][_0x8806('0x11')]);return _0x31714f(_0x1861a8[_0x8806('0xf')][_0x8806('0x11')]);}logger[_0x8806('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x582163,_0x1861a8[_0x8806('0xf')]['message']);return _0x56e537(_0x1861a8[_0x8806('0xf')][_0x8806('0x11')]);}else{logger['info'](_0x8806('0xc'),_0x582163,_0x8806('0xd'));_0x56e537(_0x1861a8[_0x8806('0x12')][_0x8806('0x11')]);}})['catch'](function(_0x576652){logger[_0x8806('0xf')](_0x8806('0xc'),_0x582163,_0x576652);_0x31714f(_0x576652);});});} \ No newline at end of file +var _0x87b2=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','catch','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug'];(function(_0x18a8eb,_0x411105){var _0x381c0b=function(_0x29257b){while(--_0x29257b){_0x18a8eb['push'](_0x18a8eb['shift']());}};_0x381c0b(++_0x411105);}(_0x87b2,0xa7));var _0x287b=function(_0x36676f,_0x29f51b){_0x36676f=_0x36676f-0x0;var _0x78a6f4=_0x87b2[_0x36676f];return _0x78a6f4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x287b('0x0'));var BPromise=require('bluebird');var rs=require(_0x287b('0x1'));var fs=require('fs');var Redis=require(_0x287b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x287b('0x3'));var logger=require(_0x287b('0x4'))(_0x287b('0x5'));var config=require('../../config/environment');var jayson=require(_0x287b('0x6'));var client=jayson['client'][_0x287b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5ba9b3,_0x41a42b,_0x161734){return new BPromise(function(_0xb5c2c9,_0x5a888f){return client[_0x287b('0x8')](_0x5ba9b3,_0x161734)[_0x287b('0x9')](function(_0x2ea58f){logger[_0x287b('0xa')]('UserVoiceQueue,\x20%s,\x20%s',_0x41a42b,_0x287b('0xb'));logger[_0x287b('0xc')](_0x287b('0xd'),_0x41a42b,_0x287b('0xb'),JSON[_0x287b('0xe')](_0x2ea58f));if(_0x2ea58f[_0x287b('0xf')]){if(_0x2ea58f[_0x287b('0xf')][_0x287b('0x10')]===0x1f4){logger[_0x287b('0xf')](_0x287b('0x11'),_0x41a42b,_0x2ea58f['error'][_0x287b('0x12')]);return _0x5a888f(_0x2ea58f['error'][_0x287b('0x12')]);}logger[_0x287b('0xf')](_0x287b('0x11'),_0x41a42b,_0x2ea58f[_0x287b('0xf')][_0x287b('0x12')]);return _0xb5c2c9(_0x2ea58f[_0x287b('0xf')]['message']);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x41a42b,'request\x20sent');_0xb5c2c9(_0x2ea58f['result'][_0x287b('0x12')]);}})[_0x287b('0x13')](function(_0x5ce9c0){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x41a42b,_0x5ce9c0);_0x5a888f(_0x5ce9c0);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 5d43e3e..ef0e15e 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 _0xe7de=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x1b3aab,_0x4c1b4b){var _0x42058c=function(_0x2070d8){while(--_0x2070d8){_0x1b3aab['push'](_0x1b3aab['shift']());}};_0x42058c(++_0x4c1b4b);}(_0xe7de,0x165));var _0xee7d=function(_0x39465e,_0x2f43bc){_0x39465e=_0x39465e-0x0;var _0x390880=_0xe7de[_0x39465e];return _0x390880;};'use strict';var multer=require(_0xee7d('0x0'));var util=require(_0xee7d('0x1'));var path=require(_0xee7d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xee7d('0x3')]();var auth=require(_0xee7d('0x4'));var interaction=require(_0xee7d('0x5'));var config=require(_0xee7d('0x6'));module[_0xee7d('0x7')]=router; \ No newline at end of file +var _0x6eec=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','exports'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x6eec,0x1e0));var _0xc6ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6eec[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc6ee('0x0'));var util=require(_0xc6ee('0x1'));var path=require(_0xc6ee('0x2'));var timeout=require(_0xc6ee('0x3'));var express=require('express');var router=express[_0xc6ee('0x4')]();var auth=require(_0xc6ee('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc6ee('0x6'));module[_0xc6ee('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index d3adef1..2b47581 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 _0xb5bf=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb5bf,0x1ee));var _0xfb5b=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xb5bf[_0x45783c];return _0x1161da;};'use strict';var Sequelize=require('sequelize');module[_0xfb5b('0x0')]={'uniqueid':{'type':Sequelize[_0xfb5b('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xfb5b('0x2')},'membername':{'type':Sequelize[_0xfb5b('0x3')],'allowNull':![],'comment':_0xfb5b('0x2')},'UserId':{'type':Sequelize[_0xfb5b('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xfb5b('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0xfb5b('0x2')},'VoiceQueueId':{'type':Sequelize[_0xfb5b('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0xfb5b('0x3')],'allowNull':![],'unique':_0xfb5b('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xfb5b('0x1')](0xb),'defaultValue':0x0,'comment':_0xfb5b('0x2')},'paused':{'type':Sequelize[_0xfb5b('0x1')](0xb),'defaultValue':0x0,'comment':_0xfb5b('0x2')}}; \ No newline at end of file +var _0xae03=['queue_interface','sequelize','exports','STRING','Required\x20by\x20Asterisk','INTEGER'];(function(_0x1ee6f0,_0x3bccc5){var _0x33fa2e=function(_0x3fcbb3){while(--_0x3fcbb3){_0x1ee6f0['push'](_0x1ee6f0['shift']());}};_0x33fa2e(++_0x3bccc5);}(_0xae03,0xdf));var _0x3ae0=function(_0x579ef8,_0x162ba7){_0x579ef8=_0x579ef8-0x0;var _0x1cad2f=_0xae03[_0x579ef8];return _0x1cad2f;};'use strict';var Sequelize=require(_0x3ae0('0x0'));module[_0x3ae0('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x3ae0('0x2')],'allowNull':![],'comment':_0x3ae0('0x3')},'UserId':{'type':Sequelize[_0x3ae0('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x3ae0('0x2')],'allowNull':![],'unique':_0x3ae0('0x5'),'comment':_0x3ae0('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x3ae0('0x2')],'allowNull':![],'unique':'queue_interface','comment':_0x3ae0('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x3ae0('0x3')},'paused':{'type':Sequelize[_0x3ae0('0x4')](0xb),'defaultValue':0x0,'comment':_0x3ae0('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index b1f223d..93b216d 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 _0x2a69=['UserVoiceQueueRt','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x319274,_0x220499){var _0x8fe093=function(_0xf9f6e6){while(--_0xf9f6e6){_0x319274['push'](_0x319274['shift']());}};_0x8fe093(++_0x220499);}(_0x2a69,0x176));var _0x92a6=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x2a69[_0x2c91e9];return _0x13f0ff;};'use strict';var EventEmitter=require(_0x92a6('0x0'));var UserVoiceQueueRt=require(_0x92a6('0x1'))['db'][_0x92a6('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x92a6('0x3'),'afterDestroy':_0x92a6('0x4')};function emitEvent(_0x219f38){return function(_0x171975,_0xa5f045,_0x37b48a){UserVoiceQueueRtEvents[_0x92a6('0x5')](_0x219f38+':'+_0x171975['id'],_0x171975);UserVoiceQueueRtEvents['emit'](_0x219f38,_0x171975);_0x37b48a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x92a6('0x6')](e,emitEvent(event));}}module[_0x92a6('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x6517=['emit','hook','exports','events','../../mysqldb','UserVoiceQueueRt','update','remove'];(function(_0x3d7eb7,_0x45fa98){var _0x4d6a70=function(_0x1ef32c){while(--_0x1ef32c){_0x3d7eb7['push'](_0x3d7eb7['shift']());}};_0x4d6a70(++_0x45fa98);}(_0x6517,0x16b));var _0x7651=function(_0x149818,_0x569eee){_0x149818=_0x149818-0x0;var _0x2ab83=_0x6517[_0x149818];return _0x2ab83;};'use strict';var EventEmitter=require(_0x7651('0x0'));var UserVoiceQueueRt=require(_0x7651('0x1'))['db'][_0x7651('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7651('0x3'),'afterDestroy':_0x7651('0x4')};function emitEvent(_0x25d080){return function(_0x1d3ac9,_0x55e8bc,_0x288606){UserVoiceQueueRtEvents['emit'](_0x25d080+':'+_0x1d3ac9['id'],_0x1d3ac9);UserVoiceQueueRtEvents[_0x7651('0x5')](_0x25d080,_0x1d3ac9);_0x288606(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x7651('0x6')](e,emitEvent(event));}}module[_0x7651('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 0d232a4..2afc7a6 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 _0xb9f8=['user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt'];(function(_0x43d1b3,_0x449640){var _0x1088cc=function(_0x27b858){while(--_0x27b858){_0x43d1b3['push'](_0x43d1b3['shift']());}};_0x1088cc(++_0x449640);}(_0xb9f8,0xab));var _0x8b9f=function(_0x12072,_0x481ee4){_0x12072=_0x12072-0x0;var _0x3d5c38=_0xb9f8[_0x12072];return _0x3d5c38;};'use strict';var _=require(_0x8b9f('0x0'));var util=require(_0x8b9f('0x1'));var logger=require(_0x8b9f('0x2'))(_0x8b9f('0x3'));var moment=require(_0x8b9f('0x4'));var BPromise=require(_0x8b9f('0x5'));var rp=require('request-promise');var attributes=require(_0x8b9f('0x6'));module['exports']=function(_0x4f82b5,_0x21c3bc){return _0x4f82b5[_0x8b9f('0x7')](_0x8b9f('0x8'),attributes,{'tableName':_0x8b9f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71cc=['./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','api','moment'];(function(_0x883d7,_0x28edb8){var _0x1559d6=function(_0x2a245b){while(--_0x2a245b){_0x883d7['push'](_0x883d7['shift']());}};_0x1559d6(++_0x28edb8);}(_0x71cc,0x12c));var _0xc71c=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x71cc[_0x4ae829];return _0x256b31;};'use strict';var _=require(_0xc71c('0x0'));var util=require('util');var logger=require(_0xc71c('0x1'))(_0xc71c('0x2'));var moment=require(_0xc71c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xc71c('0x4'));module[_0xc71c('0x5')]=function(_0x313c9f,_0x5ce6bf){return _0x313c9f['define'](_0xc71c('0x6'),attributes,{'tableName':_0xc71c('0x7'),'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 12d951f..9bc9d0b 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 _0xace3=['jayson/promise','defaults','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','options','raw','where','COUNT','sequelize','`paused`\x20=\x201,\x201,\x20null','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5bfa44,_0x76dacc){var _0x43815f=function(_0x307fca){while(--_0x307fca){_0x5bfa44['push'](_0x5bfa44['shift']());}};_0x43815f(++_0x76dacc);}(_0xace3,0x1d5));var _0x3ace=function(_0x1bcc0a,_0x5c17de){_0x1bcc0a=_0x1bcc0a-0x0;var _0x248988=_0xace3[_0x1bcc0a];return _0x248988;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3ace('0x0'));var BPromise=require(_0x3ace('0x1'));var rs=require(_0x3ace('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3ace('0x3'));var logger=require(_0x3ace('0x4'))(_0x3ace('0x5'));var config=require(_0x3ace('0x6'));var jayson=require(_0x3ace('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x3ace('0x8')](config[_0x3ace('0x9')],{'host':_0x3ace('0xa'),'port':0x18eb});var socket=require(_0x3ace('0xb'))(new Redis(config[_0x3ace('0x9')]));require(_0x3ace('0xc'))[_0x3ace('0xd')](socket);function respondWithRpcPromise(_0x4b45d8,_0x9d514d,_0x1e8c0e){return new BPromise(function(_0x3836f6,_0x236c86){return client[_0x3ace('0xe')](_0x4b45d8,_0x1e8c0e)[_0x3ace('0xf')](function(_0x1bcd7e){logger[_0x3ace('0x10')](_0x3ace('0x11'),_0x9d514d,_0x3ace('0x12'));logger[_0x3ace('0x13')](_0x3ace('0x14'),_0x9d514d,_0x3ace('0x12'),JSON[_0x3ace('0x15')](_0x1bcd7e));if(_0x1bcd7e['error']){if(_0x1bcd7e[_0x3ace('0x16')][_0x3ace('0x17')]===0x1f4){logger[_0x3ace('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x9d514d,_0x1bcd7e[_0x3ace('0x16')][_0x3ace('0x18')]);return _0x236c86(_0x1bcd7e[_0x3ace('0x16')]['message']);}logger[_0x3ace('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x9d514d,_0x1bcd7e[_0x3ace('0x16')][_0x3ace('0x18')]);return _0x3836f6(_0x1bcd7e[_0x3ace('0x16')][_0x3ace('0x18')]);}else{logger[_0x3ace('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x9d514d,_0x3ace('0x12'));_0x3836f6(_0x1bcd7e[_0x3ace('0x19')][_0x3ace('0x18')]);}})[_0x3ace('0x1a')](function(_0x2d4c65){logger[_0x3ace('0x16')](_0x3ace('0x11'),_0x9d514d,_0x2d4c65);_0x236c86(_0x2d4c65);});});}exports[_0x3ace('0x1b')]=function(_0x255378){var _0x57d29d=this;return new Promise(function(_0x87573c,_0x233010){return db['UserVoiceQueueRt']['findAll']({'raw':_0x255378[_0x3ace('0x1c')]?_0x255378[_0x3ace('0x1c')][_0x3ace('0x1d')]===undefined?!![]:![]:!![],'where':_0x255378[_0x3ace('0x1c')]?_0x255378[_0x3ace('0x1c')][_0x3ace('0x1e')]||null:null,'attributes':[[db['sequelize']['fn'](_0x3ace('0x1f'),db[_0x3ace('0x20')]['fn']('IF',db['sequelize']['literal'](_0x3ace('0x21')))),'outboundQueuePauses']]})[_0x3ace('0xf')](function(_0x9a68fd){logger[_0x3ace('0x10')](_0x3ace('0x1b'),_0x255378);logger['debug'](_0x3ace('0x1b'),_0x255378,JSON[_0x3ace('0x15')](_0x9a68fd));_0x87573c(_0x9a68fd);})['catch'](function(_0x47b993){logger['error'](_0x3ace('0x1b'),_0x47b993[_0x3ace('0x18')],_0x255378);_0x233010(_0x57d29d[_0x3ace('0x16')](0x1f4,_0x47b993[_0x3ace('0x18')]));});});}; \ No newline at end of file +var _0xd687=['request','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserVoiceQueueRt,\x20%s,\x20%s','info','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','literal','`paused`\x20=\x201,\x201,\x20null','then','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./userVoiceQueueRt.socket'];(function(_0x2ea57d,_0x2494cf){var _0x4e4b67=function(_0x414afb){while(--_0x414afb){_0x2ea57d['push'](_0x2ea57d['shift']());}};_0x4e4b67(++_0x2494cf);}(_0xd687,0x17d));var _0x7d68=function(_0x42ad6b,_0x39a94){_0x42ad6b=_0x42ad6b-0x0;var _0x442838=_0xd687[_0x42ad6b];return _0x442838;};'use strict';var _=require(_0x7d68('0x0'));var util=require(_0x7d68('0x1'));var moment=require(_0x7d68('0x2'));var BPromise=require(_0x7d68('0x3'));var rs=require(_0x7d68('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d68('0x5'))['db'];var utils=require(_0x7d68('0x6'));var logger=require(_0x7d68('0x7'))(_0x7d68('0x8'));var config=require(_0x7d68('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7d68('0xa')]['http']({'port':0x232a});config[_0x7d68('0xb')]=_[_0x7d68('0xc')](config[_0x7d68('0xb')],{'host':_0x7d68('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7d68('0xb')]));require(_0x7d68('0xe'))['register'](socket);function respondWithRpcPromise(_0x217dfe,_0xb56b6f,_0x4df22e){return new BPromise(function(_0x5659b8,_0x4ae2bb){return client[_0x7d68('0xf')](_0x217dfe,_0x4df22e)['then'](function(_0x368203){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0xb56b6f,_0x7d68('0x10'));logger['debug'](_0x7d68('0x11'),_0xb56b6f,_0x7d68('0x10'),JSON[_0x7d68('0x12')](_0x368203));if(_0x368203[_0x7d68('0x13')]){if(_0x368203[_0x7d68('0x13')][_0x7d68('0x14')]===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0xb56b6f,_0x368203[_0x7d68('0x13')][_0x7d68('0x15')]);return _0x4ae2bb(_0x368203[_0x7d68('0x13')][_0x7d68('0x15')]);}logger[_0x7d68('0x13')](_0x7d68('0x16'),_0xb56b6f,_0x368203[_0x7d68('0x13')][_0x7d68('0x15')]);return _0x5659b8(_0x368203[_0x7d68('0x13')]['message']);}else{logger[_0x7d68('0x17')](_0x7d68('0x16'),_0xb56b6f,_0x7d68('0x10'));_0x5659b8(_0x368203[_0x7d68('0x18')][_0x7d68('0x15')]);}})[_0x7d68('0x19')](function(_0x415efd){logger[_0x7d68('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xb56b6f,_0x415efd);_0x4ae2bb(_0x415efd);});});}exports[_0x7d68('0x1a')]=function(_0x1b725c){var _0x4ae818=this;return new Promise(function(_0x3fed8e,_0x2e2405){return db[_0x7d68('0x1b')][_0x7d68('0x1c')]({'raw':_0x1b725c['options']?_0x1b725c[_0x7d68('0x1d')][_0x7d68('0x1e')]===undefined?!![]:![]:!![],'where':_0x1b725c[_0x7d68('0x1d')]?_0x1b725c['options'][_0x7d68('0x1f')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x7d68('0x20')](_0x7d68('0x21')))),'outboundQueuePauses']]})[_0x7d68('0x22')](function(_0x260623){logger[_0x7d68('0x17')](_0x7d68('0x1a'),_0x1b725c);logger[_0x7d68('0x23')](_0x7d68('0x1a'),_0x1b725c,JSON[_0x7d68('0x12')](_0x260623));_0x3fed8e(_0x260623);})[_0x7d68('0x19')](function(_0x53551f){logger[_0x7d68('0x13')]('GetVoiceQueueRtPauses',_0x53551f[_0x7d68('0x15')],_0x1b725c);_0x2e2405(_0x4ae818['error'](0x1f4,_0x53551f[_0x7d68('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 3ced7d3..e0f4a00 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 _0xf873=['register','length','userVoiceQueueRt:','save','remove','update','emit'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf873,0xb2));var _0x3f87=function(_0x47f698,_0x44c102){_0x47f698=_0x47f698-0x0;var _0x1c7c9f=_0xf873[_0x47f698];return _0x1c7c9f;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x3f87('0x0'),_0x3f87('0x1'),_0x3f87('0x2')];function createListener(_0x3ef688,_0x1c56a3){return function(_0xd4592c){_0x1c56a3[_0x3f87('0x3')](_0x3ef688,_0xd4592c);};}function removeListener(_0x1d68dd,_0x3c80d6){return function(){UserVoiceQueueRtEvents['removeListener'](_0x1d68dd,_0x3c80d6);};}exports[_0x3f87('0x4')]=function(_0x43c8e4){for(var _0x27c03e=0x0,_0x5a5e37=events[_0x3f87('0x5')];_0x27c03e<_0x5a5e37;_0x27c03e++){var _0x2c7ccc=events[_0x27c03e];var _0x3b8e92=createListener(_0x3f87('0x6')+_0x2c7ccc,_0x43c8e4);UserVoiceQueueRtEvents['on'](_0x2c7ccc,_0x3b8e92);}}; \ No newline at end of file +var _0xdbf5=['save','emit','removeListener','register','length','userVoiceQueueRt:'];(function(_0x5837c9,_0x3b0ede){var _0x8d140a=function(_0x58b26d){while(--_0x58b26d){_0x5837c9['push'](_0x5837c9['shift']());}};_0x8d140a(++_0x3b0ede);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x4ef809,_0x56b3c4){_0x4ef809=_0x4ef809-0x0;var _0x2a95e8=_0xdbf5[_0x4ef809];return _0x2a95e8;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x5dbf('0x0'),'remove','update'];function createListener(_0x19d2b4,_0xfd972b){return function(_0x32ec6b){_0xfd972b[_0x5dbf('0x1')](_0x19d2b4,_0x32ec6b);};}function removeListener(_0x38b629,_0x1a1ea9){return function(){UserVoiceQueueRtEvents[_0x5dbf('0x2')](_0x38b629,_0x1a1ea9);};}exports[_0x5dbf('0x3')]=function(_0x3f8628){for(var _0x3f8222=0x0,_0x209b7d=events[_0x5dbf('0x4')];_0x3f8222<_0x209b7d;_0x3f8222++){var _0x93e657=events[_0x3f8222];var _0x52b039=createListener(_0x5dbf('0x5')+_0x93e657,_0x3f8628);UserVoiceQueueRtEvents['on'](_0x93e657,_0x52b039);}}; \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index f5f4709..261c84e 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 _0x9ffd=['/:id','isAuthenticated','show','post','create','put','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./variable.controller','get','index'];(function(_0x13e724,_0x296739){var _0x334a44=function(_0x28f54e){while(--_0x28f54e){_0x13e724['push'](_0x13e724['shift']());}};_0x334a44(++_0x296739);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x6189eb,_0x277902){_0x6189eb=_0x6189eb-0x0;var _0x3a2035=_0x9ffd[_0x6189eb];return _0x3a2035;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var auth=require(_0xd9ff('0x5'));var interaction=require(_0xd9ff('0x6'));var config=require('../../config/environment');var controller=require(_0xd9ff('0x7'));router[_0xd9ff('0x8')]('/',auth['isAuthenticated'](),controller[_0xd9ff('0x9')]);router[_0xd9ff('0x8')](_0xd9ff('0xa'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0xc')]);router[_0xd9ff('0xd')]('/',auth[_0xd9ff('0xb')](),controller[_0xd9ff('0xe')]);router[_0xd9ff('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xd9ff('0xa'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0x10')]);module[_0xd9ff('0x11')]=router; \ No newline at end of file +var _0xb688=['isAuthenticated','show','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./variable.controller','get'];(function(_0x185f14,_0x3b9323){var _0x4fe9a2=function(_0x42e33b){while(--_0x42e33b){_0x185f14['push'](_0x185f14['shift']());}};_0x4fe9a2(++_0x3b9323);}(_0xb688,0xcf));var _0x8b68=function(_0x49c109,_0x318336){_0x49c109=_0x49c109-0x0;var _0x39b4c6=_0xb688[_0x49c109];return _0x39b4c6;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var auth=require(_0x8b68('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8b68('0x6'));var controller=require(_0x8b68('0x7'));router[_0x8b68('0x8')]('/',auth[_0x8b68('0x9')](),controller['index']);router[_0x8b68('0x8')]('/:id',auth[_0x8b68('0x9')](),controller[_0x8b68('0xa')]);router[_0x8b68('0xb')]('/',auth[_0x8b68('0x9')](),controller[_0x8b68('0xc')]);router[_0x8b68('0xd')](_0x8b68('0xe'),auth[_0x8b68('0x9')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x10')](_0x8b68('0xe'),auth[_0x8b68('0x9')](),controller[_0x8b68('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index e9bb534..cb61cbb 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 _0xa10d=['STRING','name','sequelize','exports'];(function(_0x52e63c,_0x4c35e8){var _0x2c501f=function(_0x904484){while(--_0x904484){_0x52e63c['push'](_0x52e63c['shift']());}};_0x2c501f(++_0x4c35e8);}(_0xa10d,0xd2));var _0xda10=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xa10d[_0x2c7618];return _0x5ce3f0;};'use strict';var Sequelize=require(_0xda10('0x0'));module[_0xda10('0x1')]={'name':{'type':Sequelize[_0xda10('0x2')],'unique':_0xda10('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9199=['sequelize','exports','name'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9199,0x1e9));var _0x9919=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x9199[_0x8de54f];return _0x14cba4;};'use strict';var Sequelize=require(_0x9919('0x0'));module[_0x9919('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9919('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index c67065e..10faac1 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 _0xfcc0=['filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','map','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','Variables','UserProfileResource','then','end','error','stack','name','send','Variable','rawAttributes','model','keys','query'];(function(_0x5a452e,_0x355a90){var _0x2c4c43=function(_0x2d9e3f){while(--_0x2d9e3f){_0x5a452e['push'](_0x5a452e['shift']());}};_0x2c4c43(++_0x355a90);}(_0xfcc0,0x1c7));var _0x0fcc=function(_0x3bc667,_0x29418b){_0x3bc667=_0x3bc667-0x0;var _0x3eba74=_0xfcc0[_0x3bc667];return _0x3eba74;};'use strict';var pdf=require(_0x0fcc('0x0'));var emlformat=require(_0x0fcc('0x1'));var rimraf=require(_0x0fcc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fcc('0x3'));var rp=require(_0x0fcc('0x4'));var moment=require('moment');var BPromise=require(_0x0fcc('0x5'));var Mustache=require(_0x0fcc('0x6'));var util=require(_0x0fcc('0x7'));var path=require(_0x0fcc('0x8'));var sox=require(_0x0fcc('0x9'));var csv=require('to-csv');var ejs=require(_0x0fcc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0fcc('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0fcc('0xc'));var querystring=require(_0x0fcc('0xd'));var Papa=require(_0x0fcc('0xe'));var authService=require(_0x0fcc('0xf'));var hardwareService=require(_0x0fcc('0x10'));var Redis=require(_0x0fcc('0x11'));var qs=require(_0x0fcc('0x12'));var logger=require(_0x0fcc('0x13'))(_0x0fcc('0x14'));var utils=require(_0x0fcc('0x15'));var config=require(_0x0fcc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56a57a,_0x1dfafa){_0x1dfafa=_0x1dfafa||0xcc;return function(_0x4e04be){if(_0x4e04be){return _0x56a57a[_0x0fcc('0x17')](_0x1dfafa);}return _0x56a57a[_0x0fcc('0x18')](_0x1dfafa)['end']();};}function respondWithResult(_0x26a097,_0x35a194){_0x35a194=_0x35a194||0xc8;return function(_0x2cb7f4){if(_0x2cb7f4){return _0x26a097[_0x0fcc('0x18')](_0x35a194)[_0x0fcc('0x19')](_0x2cb7f4);}};}function respondWithFilteredResult(_0x3799bf,_0xe9b198){return function(_0x36b26e){if(_0x36b26e){var _0x606391=_0x36b26e[_0x0fcc('0x1a')],_0xe50a5e=_0xe9b198['offset'],_0x4c5135=_0xe9b198[_0x0fcc('0x1b')]+_0xe9b198['limit'],_0xa3612c;if(_0x4c5135>=_0x606391){_0x4c5135=_0x606391;_0xa3612c=0xc8;}else{_0xa3612c=0xce;}_0x3799bf['status'](_0xa3612c);return _0x3799bf[_0x0fcc('0x1c')](_0x0fcc('0x1d'),_0xe50a5e+'-'+_0x4c5135+'/'+_0x606391)[_0x0fcc('0x19')](_0x36b26e);}return null;};}function patchUpdates(_0x2a2b8a){return function(_0x1ca5c1){try{jsonpatch[_0x0fcc('0x1e')](_0x1ca5c1,_0x2a2b8a,!![]);}catch(_0x732861){return BPromise[_0x0fcc('0x1f')](_0x732861);}return _0x1ca5c1[_0x0fcc('0x20')]();};}function saveUpdates(_0x152d07,_0x66027c){return function(_0x359153){if(_0x359153){return _0x359153[_0x0fcc('0x21')](_0x152d07)['then'](function(_0x59ebb7){return _0x59ebb7;});}return null;};}function removeEntity(_0x212587,_0x3cc3e2){return function(_0x26412e){if(_0x26412e){return _0x26412e[_0x0fcc('0x22')]()['then'](function(){var _0x3cc6ef=_0x26412e[_0x0fcc('0x23')]({'plain':!![]});var _0x4ad1c1=_0x0fcc('0x24');return db[_0x0fcc('0x25')][_0x0fcc('0x22')]({'where':{'type':_0x4ad1c1,'resourceId':_0x3cc6ef['id']}})[_0x0fcc('0x26')](function(){return _0x26412e;});})[_0x0fcc('0x26')](function(){_0x212587[_0x0fcc('0x18')](0xcc)[_0x0fcc('0x27')]();});}};}function handleEntityNotFound(_0x4c88e0,_0x3f7c99){return function(_0x19b908){if(!_0x19b908){_0x4c88e0[_0x0fcc('0x17')](0x194);}return _0x19b908;};}function handleError(_0x4261b0,_0x58fccc){_0x58fccc=_0x58fccc||0x1f4;return function(_0x198705){logger[_0x0fcc('0x28')](_0x198705[_0x0fcc('0x29')]);if(_0x198705[_0x0fcc('0x2a')]){delete _0x198705[_0x0fcc('0x2a')];}_0x4261b0[_0x0fcc('0x18')](_0x58fccc)[_0x0fcc('0x2b')](_0x198705);};}exports['index']=function(_0x558a02,_0x71e3aa){var _0x4233d1={},_0x47cf83={},_0x3cc679={'count':0x0,'rows':[]};var _0x4a2ddb=db[_0x0fcc('0x2c')][_0x0fcc('0x2d')];_0x47cf83[_0x0fcc('0x2e')]=_[_0x0fcc('0x2f')](_0x4a2ddb);_0x47cf83[_0x0fcc('0x30')]=_[_0x0fcc('0x2f')](_0x558a02[_0x0fcc('0x30')]);_0x47cf83[_0x0fcc('0x31')]=_['intersection'](_0x47cf83['model'],_0x47cf83[_0x0fcc('0x30')]);_0x4233d1[_0x0fcc('0x32')]=_[_0x0fcc('0x33')](_0x47cf83[_0x0fcc('0x2e')],qs[_0x0fcc('0x34')](_0x558a02[_0x0fcc('0x30')][_0x0fcc('0x34')]));_0x4233d1[_0x0fcc('0x32')]=_0x4233d1['attributes'][_0x0fcc('0x35')]?_0x4233d1[_0x0fcc('0x32')]:_0x47cf83[_0x0fcc('0x2e')];if(!_0x558a02['query'][_0x0fcc('0x36')](_0x0fcc('0x37'))){_0x4233d1[_0x0fcc('0x38')]=qs[_0x0fcc('0x38')](_0x558a02[_0x0fcc('0x30')][_0x0fcc('0x38')]);_0x4233d1[_0x0fcc('0x1b')]=qs[_0x0fcc('0x1b')](_0x558a02['query']['offset']);}_0x4233d1[_0x0fcc('0x39')]=qs['sort'](_0x558a02[_0x0fcc('0x30')][_0x0fcc('0x3a')]);_0x4233d1[_0x0fcc('0x3b')]=qs[_0x0fcc('0x31')](_[_0x0fcc('0x3c')](_0x558a02[_0x0fcc('0x30')],_0x47cf83[_0x0fcc('0x31')]));if(_0x558a02[_0x0fcc('0x30')][_0x0fcc('0x3d')]){_0x4233d1[_0x0fcc('0x3b')]=_['merge'](_0x4233d1['where'],{'$or':_[_0x0fcc('0x3e')](_0x4a2ddb,function(_0x39696f){if(_0x39696f['type'][_0x0fcc('0x3f')]!==_0x0fcc('0x40')){var _0x219b92={};_0x219b92[_0x39696f[_0x0fcc('0x41')]]={'$like':'%'+_0x558a02[_0x0fcc('0x30')][_0x0fcc('0x3d')]+'%'};return _0x219b92;}})});}_0x4233d1=_['merge']({},_0x4233d1,_0x558a02[_0x0fcc('0x42')]);var _0x2f0f46={'where':_0x4233d1['where']};return db[_0x0fcc('0x2c')][_0x0fcc('0x1a')](_0x2f0f46)[_0x0fcc('0x26')](function(_0x3bf1ea){_0x3cc679[_0x0fcc('0x1a')]=_0x3bf1ea;if(_0x558a02[_0x0fcc('0x30')][_0x0fcc('0x43')]){_0x4233d1[_0x0fcc('0x44')]=[{'all':!![]}];}return db[_0x0fcc('0x2c')][_0x0fcc('0x45')](_0x4233d1);})[_0x0fcc('0x26')](function(_0x39575e){_0x3cc679[_0x0fcc('0x46')]=_0x39575e;return _0x3cc679;})['then'](respondWithFilteredResult(_0x71e3aa,_0x4233d1))[_0x0fcc('0x47')](handleError(_0x71e3aa,null));};exports[_0x0fcc('0x48')]=function(_0x25b84b,_0x2fb7e2){var _0x246193={'raw':!![],'where':{'id':_0x25b84b[_0x0fcc('0x49')]['id']}},_0x50999b={};_0x50999b['model']=_[_0x0fcc('0x2f')](db[_0x0fcc('0x2c')]['rawAttributes']);_0x50999b[_0x0fcc('0x30')]=_['keys'](_0x25b84b[_0x0fcc('0x30')]);_0x50999b[_0x0fcc('0x31')]=_[_0x0fcc('0x33')](_0x50999b['model'],_0x50999b[_0x0fcc('0x30')]);_0x246193['attributes']=_[_0x0fcc('0x33')](_0x50999b[_0x0fcc('0x2e')],qs[_0x0fcc('0x34')](_0x25b84b[_0x0fcc('0x30')][_0x0fcc('0x34')]));_0x246193[_0x0fcc('0x32')]=_0x246193[_0x0fcc('0x32')]['length']?_0x246193[_0x0fcc('0x32')]:_0x50999b[_0x0fcc('0x2e')];if(_0x25b84b[_0x0fcc('0x30')][_0x0fcc('0x43')]){_0x246193['include']=[{'all':!![]}];}_0x246193=_[_0x0fcc('0x4a')]({},_0x246193,_0x25b84b[_0x0fcc('0x42')]);return db['Variable'][_0x0fcc('0x4b')](_0x246193)[_0x0fcc('0x26')](handleEntityNotFound(_0x2fb7e2,null))[_0x0fcc('0x26')](respondWithResult(_0x2fb7e2,null))[_0x0fcc('0x47')](handleError(_0x2fb7e2,null));};exports['create']=function(_0xd348d7,_0x229994){return db[_0x0fcc('0x2c')][_0x0fcc('0x4c')](_0xd348d7[_0x0fcc('0x4d')],{})[_0x0fcc('0x26')](function(_0x5080f8){var _0x4042ce=_0xd348d7['user']['get']({'plain':!![]});if(!_0x4042ce)throw new Error(_0x0fcc('0x4e'));if(_0x4042ce['role']===_0x0fcc('0x4f')){var _0x2d9e81=_0x5080f8[_0x0fcc('0x23')]({'plain':!![]});var _0xfe8ab4='Variables';return db[_0x0fcc('0x50')][_0x0fcc('0x4b')]({'where':{'name':_0xfe8ab4,'userProfileId':_0x4042ce[_0x0fcc('0x51')]},'raw':!![]})[_0x0fcc('0x26')](function(_0xb20a7){if(_0xb20a7&&_0xb20a7[_0x0fcc('0x52')]===0x0){return db[_0x0fcc('0x25')]['create']({'name':_0x2d9e81[_0x0fcc('0x2a')],'resourceId':_0x2d9e81['id'],'type':_0xb20a7[_0x0fcc('0x2a')],'sectionId':_0xb20a7['id']},{})[_0x0fcc('0x26')](function(){return _0x5080f8;});}else{return _0x5080f8;}})['catch'](function(_0x4614e0){logger[_0x0fcc('0x28')](_0x0fcc('0x53'),_0x4614e0);throw _0x4614e0;});}return _0x5080f8;})['then'](respondWithResult(_0x229994,0xc9))[_0x0fcc('0x47')](handleError(_0x229994,null));};exports['update']=function(_0x151740,_0x4b290b){if(_0x151740[_0x0fcc('0x4d')]['id']){delete _0x151740['body']['id'];}return db['Variable'][_0x0fcc('0x4b')]({'where':{'id':_0x151740['params']['id']}})[_0x0fcc('0x26')](handleEntityNotFound(_0x4b290b,null))['then'](saveUpdates(_0x151740[_0x0fcc('0x4d')],null))[_0x0fcc('0x26')](respondWithResult(_0x4b290b,null))[_0x0fcc('0x47')](handleError(_0x4b290b,null));};exports[_0x0fcc('0x22')]=function(_0x52402f,_0x150507){return db[_0x0fcc('0x2c')][_0x0fcc('0x4b')]({'where':{'id':_0x52402f['params']['id']}})[_0x0fcc('0x26')](handleEntityNotFound(_0x150507,null))[_0x0fcc('0x26')](removeEntity(_0x150507,null))[_0x0fcc('0x47')](handleError(_0x150507,null));}; \ No newline at end of file +var _0x8193=['map','VIRTUAL','field','merge','options','includeAll','include','rows','catch','show','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','moment','mustache','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/utils','../../config/environment','status','json','count','offset','limit','set','Content-Range','apply','update','destroy','then','get','Variables','UserProfileResource','end','error','stack','name','send','index','Variable','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where'];(function(_0x8b8564,_0x162976){var _0x360c61=function(_0x164cc9){while(--_0x164cc9){_0x8b8564['push'](_0x8b8564['shift']());}};_0x360c61(++_0x162976);}(_0x8193,0xa4));var _0x3819=function(_0x277662,_0x5d1540){_0x277662=_0x277662-0x0;var _0x2a786f=_0x8193[_0x277662];return _0x2a786f;};'use strict';var pdf=require(_0x3819('0x0'));var emlformat=require(_0x3819('0x1'));var rimraf=require(_0x3819('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3819('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3819('0x4'));var util=require('util');var path=require(_0x3819('0x5'));var sox=require(_0x3819('0x6'));var csv=require('to-csv');var ejs=require(_0x3819('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3819('0x8'));var crypto=require('crypto');var jsforce=require(_0x3819('0x9'));var deskjs=require(_0x3819('0xa'));var toCsv=require(_0x3819('0xb'));var querystring=require(_0x3819('0xc'));var Papa=require(_0x3819('0xd'));var authService=require(_0x3819('0xe'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x3819('0xf'));var qs=require(_0x3819('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x3819('0x11'));var config=require(_0x3819('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1be0b3,_0x414556){_0x414556=_0x414556||0xcc;return function(_0x8903a5){if(_0x8903a5){return _0x1be0b3['sendStatus'](_0x414556);}return _0x1be0b3[_0x3819('0x13')](_0x414556)['end']();};}function respondWithResult(_0x226889,_0x13fc1b){_0x13fc1b=_0x13fc1b||0xc8;return function(_0x539050){if(_0x539050){return _0x226889['status'](_0x13fc1b)[_0x3819('0x14')](_0x539050);}};}function respondWithFilteredResult(_0x5bef97,_0x59b612){return function(_0xc5a49a){if(_0xc5a49a){var _0x4d86c0=_0xc5a49a[_0x3819('0x15')],_0x2eae3c=_0x59b612['offset'],_0x246e3e=_0x59b612[_0x3819('0x16')]+_0x59b612[_0x3819('0x17')],_0x2b7e0c;if(_0x246e3e>=_0x4d86c0){_0x246e3e=_0x4d86c0;_0x2b7e0c=0xc8;}else{_0x2b7e0c=0xce;}_0x5bef97[_0x3819('0x13')](_0x2b7e0c);return _0x5bef97[_0x3819('0x18')](_0x3819('0x19'),_0x2eae3c+'-'+_0x246e3e+'/'+_0x4d86c0)[_0x3819('0x14')](_0xc5a49a);}return null;};}function patchUpdates(_0x1ba1a3){return function(_0x524b12){try{jsonpatch[_0x3819('0x1a')](_0x524b12,_0x1ba1a3,!![]);}catch(_0x5d5ac0){return BPromise['reject'](_0x5d5ac0);}return _0x524b12['save']();};}function saveUpdates(_0x430532,_0x469ab4){return function(_0x18d93e){if(_0x18d93e){return _0x18d93e[_0x3819('0x1b')](_0x430532)['then'](function(_0x548832){return _0x548832;});}return null;};}function removeEntity(_0x59e6d8,_0x4474ed){return function(_0xb1ee){if(_0xb1ee){return _0xb1ee[_0x3819('0x1c')]()[_0x3819('0x1d')](function(){var _0xc6ebef=_0xb1ee[_0x3819('0x1e')]({'plain':!![]});var _0xe620b2=_0x3819('0x1f');return db[_0x3819('0x20')]['destroy']({'where':{'type':_0xe620b2,'resourceId':_0xc6ebef['id']}})[_0x3819('0x1d')](function(){return _0xb1ee;});})[_0x3819('0x1d')](function(){_0x59e6d8['status'](0xcc)[_0x3819('0x21')]();});}};}function handleEntityNotFound(_0x3167a8,_0x5bf508){return function(_0x257019){if(!_0x257019){_0x3167a8['sendStatus'](0x194);}return _0x257019;};}function handleError(_0x159c1b,_0x4d114a){_0x4d114a=_0x4d114a||0x1f4;return function(_0x444c0d){logger[_0x3819('0x22')](_0x444c0d[_0x3819('0x23')]);if(_0x444c0d[_0x3819('0x24')]){delete _0x444c0d[_0x3819('0x24')];}_0x159c1b[_0x3819('0x13')](_0x4d114a)[_0x3819('0x25')](_0x444c0d);};}exports[_0x3819('0x26')]=function(_0x20472a,_0x52932f){var _0x53ed63={},_0x5d9ac8={},_0x4c9824={'count':0x0,'rows':[]};var _0xa1dc71=db[_0x3819('0x27')][_0x3819('0x28')];_0x5d9ac8[_0x3819('0x29')]=_[_0x3819('0x2a')](_0xa1dc71);_0x5d9ac8[_0x3819('0x2b')]=_[_0x3819('0x2a')](_0x20472a[_0x3819('0x2b')]);_0x5d9ac8[_0x3819('0x2c')]=_[_0x3819('0x2d')](_0x5d9ac8['model'],_0x5d9ac8['query']);_0x53ed63[_0x3819('0x2e')]=_['intersection'](_0x5d9ac8['model'],qs['fields'](_0x20472a['query'][_0x3819('0x2f')]));_0x53ed63[_0x3819('0x2e')]=_0x53ed63[_0x3819('0x2e')][_0x3819('0x30')]?_0x53ed63[_0x3819('0x2e')]:_0x5d9ac8[_0x3819('0x29')];if(!_0x20472a['query'][_0x3819('0x31')](_0x3819('0x32'))){_0x53ed63[_0x3819('0x17')]=qs[_0x3819('0x17')](_0x20472a[_0x3819('0x2b')][_0x3819('0x17')]);_0x53ed63[_0x3819('0x16')]=qs[_0x3819('0x16')](_0x20472a[_0x3819('0x2b')][_0x3819('0x16')]);}_0x53ed63['order']=qs['sort'](_0x20472a['query'][_0x3819('0x33')]);_0x53ed63['where']=qs['filters'](_[_0x3819('0x34')](_0x20472a[_0x3819('0x2b')],_0x5d9ac8[_0x3819('0x2c')]));if(_0x20472a['query'][_0x3819('0x35')]){_0x53ed63[_0x3819('0x36')]=_['merge'](_0x53ed63[_0x3819('0x36')],{'$or':_[_0x3819('0x37')](_0xa1dc71,function(_0x467f71){if(_0x467f71['type']['key']!==_0x3819('0x38')){var _0x1f284d={};_0x1f284d[_0x467f71[_0x3819('0x39')]]={'$like':'%'+_0x20472a[_0x3819('0x2b')][_0x3819('0x35')]+'%'};return _0x1f284d;}})});}_0x53ed63=_[_0x3819('0x3a')]({},_0x53ed63,_0x20472a[_0x3819('0x3b')]);var _0x102ad0={'where':_0x53ed63[_0x3819('0x36')]};return db[_0x3819('0x27')]['count'](_0x102ad0)[_0x3819('0x1d')](function(_0x2c4a55){_0x4c9824[_0x3819('0x15')]=_0x2c4a55;if(_0x20472a[_0x3819('0x2b')][_0x3819('0x3c')]){_0x53ed63[_0x3819('0x3d')]=[{'all':!![]}];}return db[_0x3819('0x27')]['findAll'](_0x53ed63);})[_0x3819('0x1d')](function(_0x2a9fd2){_0x4c9824[_0x3819('0x3e')]=_0x2a9fd2;return _0x4c9824;})[_0x3819('0x1d')](respondWithFilteredResult(_0x52932f,_0x53ed63))[_0x3819('0x3f')](handleError(_0x52932f,null));};exports[_0x3819('0x40')]=function(_0x846be4,_0x59900b){var _0x44a31d={'raw':!![],'where':{'id':_0x846be4['params']['id']}},_0x3a4eb8={};_0x3a4eb8[_0x3819('0x29')]=_[_0x3819('0x2a')](db[_0x3819('0x27')][_0x3819('0x28')]);_0x3a4eb8[_0x3819('0x2b')]=_['keys'](_0x846be4[_0x3819('0x2b')]);_0x3a4eb8[_0x3819('0x2c')]=_[_0x3819('0x2d')](_0x3a4eb8['model'],_0x3a4eb8[_0x3819('0x2b')]);_0x44a31d[_0x3819('0x2e')]=_[_0x3819('0x2d')](_0x3a4eb8['model'],qs[_0x3819('0x2f')](_0x846be4[_0x3819('0x2b')][_0x3819('0x2f')]));_0x44a31d[_0x3819('0x2e')]=_0x44a31d[_0x3819('0x2e')][_0x3819('0x30')]?_0x44a31d[_0x3819('0x2e')]:_0x3a4eb8['model'];if(_0x846be4[_0x3819('0x2b')][_0x3819('0x3c')]){_0x44a31d[_0x3819('0x3d')]=[{'all':!![]}];}_0x44a31d=_[_0x3819('0x3a')]({},_0x44a31d,_0x846be4['options']);return db['Variable'][_0x3819('0x41')](_0x44a31d)[_0x3819('0x1d')](handleEntityNotFound(_0x59900b,null))['then'](respondWithResult(_0x59900b,null))[_0x3819('0x3f')](handleError(_0x59900b,null));};exports['create']=function(_0x53b34a,_0xa571ec){return db[_0x3819('0x27')]['create'](_0x53b34a[_0x3819('0x42')],{})[_0x3819('0x1d')](function(_0x11ebdb){var _0x4f2d1f=_0x53b34a[_0x3819('0x43')][_0x3819('0x1e')]({'plain':!![]});if(!_0x4f2d1f)throw new Error(_0x3819('0x44'));if(_0x4f2d1f['role']===_0x3819('0x43')){var _0x36fcfd=_0x11ebdb[_0x3819('0x1e')]({'plain':!![]});var _0x1a5672=_0x3819('0x1f');return db[_0x3819('0x45')][_0x3819('0x41')]({'where':{'name':_0x1a5672,'userProfileId':_0x4f2d1f['userProfileId']},'raw':!![]})[_0x3819('0x1d')](function(_0x30666f){if(_0x30666f&&_0x30666f['autoAssociation']===0x0){return db[_0x3819('0x20')][_0x3819('0x46')]({'name':_0x36fcfd[_0x3819('0x24')],'resourceId':_0x36fcfd['id'],'type':_0x30666f[_0x3819('0x24')],'sectionId':_0x30666f['id']},{})[_0x3819('0x1d')](function(){return _0x11ebdb;});}else{return _0x11ebdb;}})[_0x3819('0x3f')](function(_0x3b6550){logger[_0x3819('0x22')](_0x3819('0x47'),_0x3b6550);throw _0x3b6550;});}return _0x11ebdb;})[_0x3819('0x1d')](respondWithResult(_0xa571ec,0xc9))[_0x3819('0x3f')](handleError(_0xa571ec,null));};exports['update']=function(_0x81cb04,_0x48d38d){if(_0x81cb04['body']['id']){delete _0x81cb04[_0x3819('0x42')]['id'];}return db[_0x3819('0x27')]['find']({'where':{'id':_0x81cb04[_0x3819('0x48')]['id']}})[_0x3819('0x1d')](handleEntityNotFound(_0x48d38d,null))[_0x3819('0x1d')](saveUpdates(_0x81cb04[_0x3819('0x42')],null))[_0x3819('0x1d')](respondWithResult(_0x48d38d,null))[_0x3819('0x3f')](handleError(_0x48d38d,null));};exports[_0x3819('0x1c')]=function(_0xc99003,_0x2b6f0f){return db['Variable'][_0x3819('0x41')]({'where':{'id':_0xc99003['params']['id']}})[_0x3819('0x1d')](handleEntityNotFound(_0x2b6f0f,null))[_0x3819('0x1d')](removeEntity(_0x2b6f0f,null))['catch'](handleError(_0x2b6f0f,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 7cd4cbc..68df691 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 _0x5fab=['request-promise','./variable.attributes','exports','define','Variable','lodash','util','api','moment','bluebird'];(function(_0x4cdc10,_0x36a881){var _0x4fc7cd=function(_0x1bf170){while(--_0x1bf170){_0x4cdc10['push'](_0x4cdc10['shift']());}};_0x4fc7cd(++_0x36a881);}(_0x5fab,0x177));var _0xb5fa=function(_0x47a12a,_0x70f591){_0x47a12a=_0x47a12a-0x0;var _0x30cd40=_0x5fab[_0x47a12a];return _0x30cd40;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var attributes=require(_0xb5fa('0x6'));module[_0xb5fa('0x7')]=function(_0x29390a,_0x4341d3){return _0x29390a[_0xb5fa('0x8')](_0xb5fa('0x9'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['tools_variables','lodash','util','../../config/logger','moment','bluebird','./variable.attributes','exports','define'];(function(_0x4e25fe,_0x24b0c2){var _0x17fc4d=function(_0x57a3c2){while(--_0x57a3c2){_0x4e25fe['push'](_0x4e25fe['shift']());}};_0x17fc4d(++_0x24b0c2);}(_0x7a54,0x106));var _0x47a5=function(_0x1d53dd,_0x2d8e2b){_0x1d53dd=_0x1d53dd-0x0;var _0x2da745=_0x7a54[_0x1d53dd];return _0x2da745;};'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')]('Variable',attributes,{'tableName':_0x47a5('0x8'),'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 8cf822a..34627a9 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 _0xf214=['Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','raw','where','attributes','model','include','map','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xf214,0xce));var _0x4f21=function(_0x397f34,_0x3ac328){_0x397f34=_0x397f34-0x0;var _0x272cda=_0xf214[_0x397f34];return _0x272cda;};'use strict';var _=require(_0x4f21('0x0'));var util=require(_0x4f21('0x1'));var moment=require(_0x4f21('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f21('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4f21('0x4'));var logger=require(_0x4f21('0x5'))(_0x4f21('0x6'));var config=require(_0x4f21('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4f21('0x8')][_0x4f21('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f82c3,_0x2d8330,_0x3ac66f){return new BPromise(function(_0x320fe3,_0x4b174e){return client['request'](_0x3f82c3,_0x3ac66f)[_0x4f21('0xa')](function(_0x147c88){logger['info'](_0x4f21('0xb'),_0x2d8330,_0x4f21('0xc'));logger[_0x4f21('0xd')](_0x4f21('0xe'),_0x2d8330,_0x4f21('0xc'),JSON[_0x4f21('0xf')](_0x147c88));if(_0x147c88[_0x4f21('0x10')]){if(_0x147c88[_0x4f21('0x10')][_0x4f21('0x11')]===0x1f4){logger['error'](_0x4f21('0xb'),_0x2d8330,_0x147c88[_0x4f21('0x10')][_0x4f21('0x12')]);return _0x4b174e(_0x147c88[_0x4f21('0x10')][_0x4f21('0x12')]);}logger[_0x4f21('0x10')](_0x4f21('0xb'),_0x2d8330,_0x147c88[_0x4f21('0x10')][_0x4f21('0x12')]);return _0x320fe3(_0x147c88['error'][_0x4f21('0x12')]);}else{logger['info'](_0x4f21('0xb'),_0x2d8330,_0x4f21('0xc'));_0x320fe3(_0x147c88[_0x4f21('0x13')][_0x4f21('0x12')]);}})['catch'](function(_0x311093){logger[_0x4f21('0x10')](_0x4f21('0xb'),_0x2d8330,_0x311093);_0x4b174e(_0x311093);});});}exports[_0x4f21('0x14')]=function(_0x3d5c0f){var _0x22333=this;return new Promise(function(_0x51c3db,_0x3559cb){return db[_0x4f21('0x15')][_0x4f21('0x16')]({'raw':_0x3d5c0f[_0x4f21('0x17')]?_0x3d5c0f[_0x4f21('0x17')][_0x4f21('0x18')]===undefined?!![]:![]:!![],'where':_0x3d5c0f['options']?_0x3d5c0f[_0x4f21('0x17')][_0x4f21('0x19')]||null:null,'attributes':_0x3d5c0f[_0x4f21('0x17')]?_0x3d5c0f[_0x4f21('0x17')][_0x4f21('0x1a')]||null:null,'include':_0x3d5c0f['options']?_0x3d5c0f[_0x4f21('0x17')]['include']?_['map'](_0x3d5c0f[_0x4f21('0x17')]['include'],function(_0x480eab){return{'model':db[_0x480eab[_0x4f21('0x1b')]],'as':_0x480eab['as'],'attributes':_0x480eab['attributes'],'include':_0x480eab[_0x4f21('0x1c')]?_[_0x4f21('0x1d')](_0x480eab[_0x4f21('0x1c')],function(_0x6e201f){return{'model':db[_0x6e201f[_0x4f21('0x1b')]],'as':_0x6e201f['as'],'attributes':_0x6e201f[_0x4f21('0x1a')],'include':_0x6e201f[_0x4f21('0x1c')]?_['map'](_0x6e201f[_0x4f21('0x1c')],function(_0x48ce1b){return{'model':db[_0x48ce1b[_0x4f21('0x1b')]],'as':_0x48ce1b['as'],'attributes':_0x48ce1b[_0x4f21('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f21('0xa')](function(_0x546e17){logger['info'](_0x4f21('0x14'),_0x3d5c0f);logger['debug']('ShowVariable',_0x3d5c0f,JSON[_0x4f21('0xf')](_0x546e17));_0x51c3db(_0x546e17);})[_0x4f21('0x1e')](function(_0xf30910){logger[_0x4f21('0x10')](_0x4f21('0x14'),_0xf30910[_0x4f21('0x12')],_0x3d5c0f);_0x3559cb(_0x22333['error'](0x1f4,_0xf30910[_0x4f21('0x12')]));});});}; \ No newline at end of file +var _0xf2ea=['model','info','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowVariable','Variable','options','where','attributes','include','map'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf2ea,0x10a));var _0xaf2e=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xf2ea[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0xaf2e('0x0'));var util=require(_0xaf2e('0x1'));var moment=require(_0xaf2e('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf2e('0x3'));var fs=require('fs');var Redis=require(_0xaf2e('0x4'));var db=require(_0xaf2e('0x5'))['db'];var utils=require(_0xaf2e('0x6'));var logger=require(_0xaf2e('0x7'))(_0xaf2e('0x8'));var config=require(_0xaf2e('0x9'));var jayson=require(_0xaf2e('0xa'));var client=jayson[_0xaf2e('0xb')][_0xaf2e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x20b70d,_0x5d4b34,_0x2ba898){return new BPromise(function(_0x490c99,_0x9f1313){return client[_0xaf2e('0xd')](_0x20b70d,_0x2ba898)[_0xaf2e('0xe')](function(_0x4a1e4a){logger['info'](_0xaf2e('0xf'),_0x5d4b34,_0xaf2e('0x10'));logger[_0xaf2e('0x11')](_0xaf2e('0x12'),_0x5d4b34,_0xaf2e('0x10'),JSON[_0xaf2e('0x13')](_0x4a1e4a));if(_0x4a1e4a[_0xaf2e('0x14')]){if(_0x4a1e4a[_0xaf2e('0x14')][_0xaf2e('0x15')]===0x1f4){logger[_0xaf2e('0x14')](_0xaf2e('0xf'),_0x5d4b34,_0x4a1e4a[_0xaf2e('0x14')][_0xaf2e('0x16')]);return _0x9f1313(_0x4a1e4a['error']['message']);}logger[_0xaf2e('0x14')](_0xaf2e('0xf'),_0x5d4b34,_0x4a1e4a[_0xaf2e('0x14')]['message']);return _0x490c99(_0x4a1e4a[_0xaf2e('0x14')][_0xaf2e('0x16')]);}else{logger['info'](_0xaf2e('0xf'),_0x5d4b34,'request\x20sent');_0x490c99(_0x4a1e4a['result']['message']);}})[_0xaf2e('0x17')](function(_0x3f1a91){logger[_0xaf2e('0x14')](_0xaf2e('0xf'),_0x5d4b34,_0x3f1a91);_0x9f1313(_0x3f1a91);});});}exports[_0xaf2e('0x18')]=function(_0x246c36){var _0x15bf8b=this;return new Promise(function(_0x5ca107,_0x420cad){return db[_0xaf2e('0x19')]['find']({'raw':_0x246c36['options']?_0x246c36[_0xaf2e('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x246c36[_0xaf2e('0x1a')]?_0x246c36['options'][_0xaf2e('0x1b')]||null:null,'attributes':_0x246c36[_0xaf2e('0x1a')]?_0x246c36[_0xaf2e('0x1a')][_0xaf2e('0x1c')]||null:null,'include':_0x246c36[_0xaf2e('0x1a')]?_0x246c36[_0xaf2e('0x1a')][_0xaf2e('0x1d')]?_[_0xaf2e('0x1e')](_0x246c36[_0xaf2e('0x1a')][_0xaf2e('0x1d')],function(_0x2cac75){return{'model':db[_0x2cac75[_0xaf2e('0x1f')]],'as':_0x2cac75['as'],'attributes':_0x2cac75[_0xaf2e('0x1c')],'include':_0x2cac75[_0xaf2e('0x1d')]?_['map'](_0x2cac75[_0xaf2e('0x1d')],function(_0x19e6b2){return{'model':db[_0x19e6b2[_0xaf2e('0x1f')]],'as':_0x19e6b2['as'],'attributes':_0x19e6b2[_0xaf2e('0x1c')],'include':_0x19e6b2[_0xaf2e('0x1d')]?_[_0xaf2e('0x1e')](_0x19e6b2[_0xaf2e('0x1d')],function(_0x1f6826){return{'model':db[_0x1f6826[_0xaf2e('0x1f')]],'as':_0x1f6826['as'],'attributes':_0x1f6826[_0xaf2e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xaf2e('0xe')](function(_0x1b9600){logger[_0xaf2e('0x20')](_0xaf2e('0x18'),_0x246c36);logger[_0xaf2e('0x11')]('ShowVariable',_0x246c36,JSON[_0xaf2e('0x13')](_0x1b9600));_0x5ca107(_0x1b9600);})[_0xaf2e('0x17')](function(_0x474236){logger[_0xaf2e('0x14')](_0xaf2e('0x18'),_0x474236[_0xaf2e('0x16')],_0x246c36);_0x420cad(_0x15bf8b[_0xaf2e('0x14')](0x1f4,_0x474236['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 38427f2..0afbfc5 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 _0x0deb=['isAuthenticated','pull','/restart','/migrations','migrations','exports','Router','../../components/auth/service','./version.controller','get','canUpdate','/reset','/pull'];(function(_0x44952c,_0x1c303e){var _0x2480ff=function(_0x4b72a4){while(--_0x4b72a4){_0x44952c['push'](_0x44952c['shift']());}};_0x2480ff(++_0x1c303e);}(_0x0deb,0x6e));var _0xb0de=function(_0x460c30,_0x3f0b48){_0x460c30=_0x460c30-0x0;var _0x48cd43=_0x0deb[_0x460c30];return _0x48cd43;};'use strict';var express=require('express');var router=express[_0xb0de('0x0')]();var auth=require(_0xb0de('0x1'));var controller=require(_0xb0de('0x2'));router[_0xb0de('0x3')]('/',controller['index']);router[_0xb0de('0x3')]('/fetch',auth['isAuthenticated'](),auth[_0xb0de('0x4')](),controller['fetch']);router['get'](_0xb0de('0x5'),auth['isAuthenticated'](),auth[_0xb0de('0x4')](),controller['reset']);router[_0xb0de('0x3')](_0xb0de('0x6'),auth[_0xb0de('0x7')](),auth[_0xb0de('0x4')](),controller[_0xb0de('0x8')]);router[_0xb0de('0x3')](_0xb0de('0x9'),auth[_0xb0de('0x7')](),controller['restart']);router['get'](_0xb0de('0xa'),controller[_0xb0de('0xb')]);module[_0xb0de('0xc')]=router; \ No newline at end of file +var _0x661d=['/restart','restart','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x661d,0x64));var _0xd661=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0x661d[_0xa60623];return _0x4a6487;};'use strict';var express=require(_0xd661('0x0'));var router=express[_0xd661('0x1')]();var auth=require(_0xd661('0x2'));var controller=require(_0xd661('0x3'));router[_0xd661('0x4')]('/',controller['index']);router[_0xd661('0x4')]('/fetch',auth[_0xd661('0x5')](),auth[_0xd661('0x6')](),controller[_0xd661('0x7')]);router[_0xd661('0x4')](_0xd661('0x8'),auth[_0xd661('0x5')](),auth[_0xd661('0x6')](),controller[_0xd661('0x9')]);router[_0xd661('0x4')](_0xd661('0xa'),auth[_0xd661('0x5')](),auth[_0xd661('0x6')](),controller[_0xd661('0xb')]);router[_0xd661('0x4')](_0xd661('0xc'),auth[_0xd661('0x5')](),controller[_0xd661('0xd')]);router['get']('/migrations',controller[_0xd661('0xe')]);module[_0xd661('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 3062990..8d72c75 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(_0xa522f,_0x5debbc){var _0x2083b0=function(_0x288f01){while(--_0x288f01){_0xa522f['push'](_0xa522f['shift']());}};_0x2083b0(++_0x5debbc);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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(_0x40227e,_0x2a1c52){var _0x419728=function(_0x73a6c8){while(--_0x73a6c8){_0x40227e['push'](_0x40227e['shift']());}};_0x419728(++_0x2a1c52);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 04fb752..71a56b4 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 _0xe2fe=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index','/describe','get','show','create','delete','exports','multer'];(function(_0x562eea,_0x1f9ea7){var _0x39caf9=function(_0x14f022){while(--_0x14f022){_0x562eea['push'](_0x562eea['shift']());}};_0x39caf9(++_0x1f9ea7);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var auth=require(_0xee2f('0x3'));var interaction=require(_0xee2f('0x4'));var config=require(_0xee2f('0x5'));var controller=require(_0xee2f('0x6'));router['get']('/',auth[_0xee2f('0x7')](),controller[_0xee2f('0x8')]);router['get'](_0xee2f('0x9'),auth[_0xee2f('0x7')](),controller['describe']);router[_0xee2f('0xa')]('/:id',auth[_0xee2f('0x7')](),controller[_0xee2f('0xb')]);router['post']('/',auth[_0xee2f('0x7')](),controller[_0xee2f('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xee2f('0xd')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xee2f('0xe')]=router; \ No newline at end of file +var _0x27a0=['path','connect-timeout','express','Router','get','isAuthenticated','index','/describe','/:id','post','create','update','delete','destroy','exports','util'];(function(_0x205ab2,_0x2a602c){var _0x1948d9=function(_0x5a7795){while(--_0x5a7795){_0x205ab2['push'](_0x205ab2['shift']());}};_0x1948d9(++_0x2a602c);}(_0x27a0,0xbf));var _0x027a=function(_0x5de760,_0x27fe7c){_0x5de760=_0x5de760-0x0;var _0x5dba48=_0x27a0[_0x5de760];return _0x5dba48;};'use strict';var multer=require('multer');var util=require(_0x027a('0x0'));var path=require(_0x027a('0x1'));var timeout=require(_0x027a('0x2'));var express=require(_0x027a('0x3'));var router=express[_0x027a('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0x027a('0x5')]('/',auth[_0x027a('0x6')](),controller[_0x027a('0x7')]);router[_0x027a('0x5')](_0x027a('0x8'),auth[_0x027a('0x6')](),controller['describe']);router[_0x027a('0x5')](_0x027a('0x9'),auth[_0x027a('0x6')](),controller['show']);router[_0x027a('0xa')]('/',auth[_0x027a('0x6')](),controller[_0x027a('0xb')]);router['put'](_0x027a('0x9'),auth[_0x027a('0x6')](),controller[_0x027a('0xc')]);router[_0x027a('0xd')](_0x027a('0x9'),auth[_0x027a('0x6')](),controller[_0x027a('0xe')]);module[_0x027a('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 10c4520..ebb3b29 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 _0x5021=['exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x5a4f61,_0x5bf2dd){var _0x22180c=function(_0x5ed650){while(--_0x5ed650){_0x5a4f61['push'](_0x5a4f61['shift']());}};_0x22180c(++_0x5bf2dd);}(_0x5021,0xaf));var _0x1502=function(_0x4a84fa,_0x19ef1d){_0x4a84fa=_0x4a84fa-0x0;var _0x244900=_0x5021[_0x4a84fa];return _0x244900;};'use strict';var Sequelize=require('sequelize');module[_0x1502('0x0')]={'type':{'type':Sequelize[_0x1502('0x1')]},'uniqueid':{'type':Sequelize[_0x1502('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x1502('0x1')]},'membername':{'type':Sequelize[_0x1502('0x1')]},'agentcalledAt':{'type':Sequelize[_0x1502('0x2')]},'agentconnectAt':{'type':Sequelize[_0x1502('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x1502('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x1502('0x2')]},'holdtime':{'type':Sequelize[_0x1502('0x3')]},'agentcomplete':{'type':Sequelize[_0x1502('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x1502('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x1502('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x1502('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1502('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1502('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x1502('0x1')]},'connectedlinenum':{'type':Sequelize[_0x1502('0x1')]},'connectedlinename':{'type':Sequelize[_0x1502('0x1')]},'language':{'type':Sequelize[_0x1502('0x1')]},'accountcode':{'type':Sequelize[_0x1502('0x1')]},'context':{'type':Sequelize[_0x1502('0x1')]},'exten':{'type':Sequelize[_0x1502('0x1')]},'priority':{'type':Sequelize[_0x1502('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x1502('0x1')]},'destcalleridnum':{'type':Sequelize[_0x1502('0x1')]},'destcalleridname':{'type':Sequelize[_0x1502('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x1502('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x1502('0x1')]},'destaccountcode':{'type':Sequelize[_0x1502('0x1')]},'destcontext':{'type':Sequelize[_0x1502('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x1502('0x1')]},'destuniqueid':{'type':Sequelize[_0x1502('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x1502('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x1502('0x1')]}}; \ No newline at end of file +var _0xd17a=['INTEGER','BOOLEAN','sequelize','STRING','DATE'];(function(_0x8790de,_0x626867){var _0x295490=function(_0x5472b9){while(--_0x5472b9){_0x8790de['push'](_0x8790de['shift']());}};_0x295490(++_0x626867);}(_0xd17a,0x1e2));var _0xad17=function(_0x146bf6,_0x3a3461){_0x146bf6=_0x146bf6-0x0;var _0x4af2c3=_0xd17a[_0x146bf6];return _0x4af2c3;};'use strict';var Sequelize=require(_0xad17('0x0'));module['exports']={'type':{'type':Sequelize[_0xad17('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xad17('0x1')]},'calleridname':{'type':Sequelize[_0xad17('0x1')]},'queue':{'type':Sequelize[_0xad17('0x1')]},'interface':{'type':Sequelize[_0xad17('0x1')]},'membername':{'type':Sequelize[_0xad17('0x1')]},'agentcalledAt':{'type':Sequelize[_0xad17('0x2')]},'agentconnectAt':{'type':Sequelize[_0xad17('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xad17('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xad17('0x2')]},'agentdumpAt':{'type':Sequelize[_0xad17('0x2')]},'holdtime':{'type':Sequelize[_0xad17('0x3')]},'agentcomplete':{'type':Sequelize[_0xad17('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xad17('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xad17('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xad17('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xad17('0x1')]},'channel':{'type':Sequelize[_0xad17('0x1')]},'channelstate':{'type':Sequelize[_0xad17('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xad17('0x1')]},'connectedlinename':{'type':Sequelize[_0xad17('0x1')]},'language':{'type':Sequelize[_0xad17('0x1')]},'accountcode':{'type':Sequelize[_0xad17('0x1')]},'context':{'type':Sequelize[_0xad17('0x1')]},'exten':{'type':Sequelize[_0xad17('0x1')]},'priority':{'type':Sequelize[_0xad17('0x1')]},'destchannel':{'type':Sequelize[_0xad17('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xad17('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xad17('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xad17('0x1')]},'destlanguage':{'type':Sequelize[_0xad17('0x1')]},'destaccountcode':{'type':Sequelize[_0xad17('0x1')]},'destcontext':{'type':Sequelize[_0xad17('0x1')]},'destexten':{'type':Sequelize[_0xad17('0x1')]},'destpriority':{'type':Sequelize[_0xad17('0x1')]},'destuniqueid':{'type':Sequelize[_0xad17('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xad17('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 3ca94dc..eb227ea 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 _0x1a9e=['find','create','update','body','destroy','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','json','reject','save','then','error','stack','name','send','rawAttributes','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','limit','order','sort','where','pick','merge','map','type','key','field','options','VoiceAgentReport','includeAll','include','findAll','rows','catch','show','params','length'];(function(_0x36d5d7,_0x4fe3ba){var _0x16c671=function(_0x19cc26){while(--_0x19cc26){_0x36d5d7['push'](_0x36d5d7['shift']());}};_0x16c671(++_0x4fe3ba);}(_0x1a9e,0x122));var _0xe1a9=function(_0x18fdee,_0x1a1526){_0x18fdee=_0x18fdee-0x0;var _0x566900=_0x1a9e[_0x18fdee];return _0x566900;};'use strict';var pdf=require(_0xe1a9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe1a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe1a9('0x2'));var rp=require(_0xe1a9('0x3'));var moment=require(_0xe1a9('0x4'));var BPromise=require(_0xe1a9('0x5'));var Mustache=require(_0xe1a9('0x6'));var util=require('util');var path=require(_0xe1a9('0x7'));var sox=require(_0xe1a9('0x8'));var csv=require(_0xe1a9('0x9'));var ejs=require(_0xe1a9('0xa'));var fs=require('fs');var _=require(_0xe1a9('0xb'));var squel=require(_0xe1a9('0xc'));var crypto=require('crypto');var jsforce=require(_0xe1a9('0xd'));var deskjs=require(_0xe1a9('0xe'));var toCsv=require(_0xe1a9('0x9'));var querystring=require(_0xe1a9('0xf'));var Papa=require(_0xe1a9('0x10'));var authService=require(_0xe1a9('0x11'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xe1a9('0x12'));var utils=require(_0xe1a9('0x13'));var config=require(_0xe1a9('0x14'));var db=require(_0xe1a9('0x15'))['db'];function respondWithStatusCode(_0x1a2111,_0x398f7a){_0x398f7a=_0x398f7a||0xcc;return function(_0x2bfa6b){if(_0x2bfa6b){return _0x1a2111[_0xe1a9('0x16')](_0x398f7a);}return _0x1a2111[_0xe1a9('0x17')](_0x398f7a)['end']();};}function respondWithResult(_0x27af83,_0x182cb9){_0x182cb9=_0x182cb9||0xc8;return function(_0x2a7b73){if(_0x2a7b73){return _0x27af83['status'](_0x182cb9)['json'](_0x2a7b73);}};}function respondWithFilteredResult(_0x7a3c7d,_0x5cc40e){return function(_0x5c1d4b){if(_0x5c1d4b){var _0x5c2be4=_0x5c1d4b[_0xe1a9('0x18')],_0x164f8b=_0x5cc40e[_0xe1a9('0x19')],_0x26d99d=_0x5cc40e[_0xe1a9('0x19')]+_0x5cc40e['limit'],_0x253e9a;if(_0x26d99d>=_0x5c2be4){_0x26d99d=_0x5c2be4;_0x253e9a=0xc8;}else{_0x253e9a=0xce;}_0x7a3c7d[_0xe1a9('0x17')](_0x253e9a);return _0x7a3c7d[_0xe1a9('0x1a')](_0xe1a9('0x1b'),_0x164f8b+'-'+_0x26d99d+'/'+_0x5c2be4)[_0xe1a9('0x1c')](_0x5c1d4b);}return null;};}function patchUpdates(_0x1b07fc){return function(_0x49444e){try{jsonpatch['apply'](_0x49444e,_0x1b07fc,!![]);}catch(_0x3cdb61){return BPromise[_0xe1a9('0x1d')](_0x3cdb61);}return _0x49444e[_0xe1a9('0x1e')]();};}function saveUpdates(_0x15404c,_0xb112ba){return function(_0x20e4b3){if(_0x20e4b3){return _0x20e4b3['update'](_0x15404c)['then'](function(_0x7eff2f){return _0x7eff2f;});}return null;};}function removeEntity(_0x2a72fc,_0x259c20){return function(_0x59e777){if(_0x59e777){return _0x59e777['destroy']()[_0xe1a9('0x1f')](function(){_0x2a72fc[_0xe1a9('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51ec13,_0x110264){return function(_0x18be9d){if(!_0x18be9d){_0x51ec13[_0xe1a9('0x16')](0x194);}return _0x18be9d;};}function handleError(_0x7ddc5b,_0x3b7b9e){_0x3b7b9e=_0x3b7b9e||0x1f4;return function(_0x33a8f2){logger[_0xe1a9('0x20')](_0x33a8f2[_0xe1a9('0x21')]);if(_0x33a8f2['name']){delete _0x33a8f2[_0xe1a9('0x22')];}_0x7ddc5b[_0xe1a9('0x17')](_0x3b7b9e)[_0xe1a9('0x23')](_0x33a8f2);};}exports['index']=function(_0x3bb891,_0x26f53e){var _0x3b72a3={},_0x2916b4={},_0x2e396a={'count':0x0,'rows':[]};var _0x4f00f3=db['VoiceAgentReport'][_0xe1a9('0x24')];_0x2916b4[_0xe1a9('0x25')]=_[_0xe1a9('0x26')](_0x4f00f3);_0x2916b4[_0xe1a9('0x27')]=_['keys'](_0x3bb891[_0xe1a9('0x27')]);_0x2916b4[_0xe1a9('0x28')]=_[_0xe1a9('0x29')](_0x2916b4[_0xe1a9('0x25')],_0x2916b4[_0xe1a9('0x27')]);_0x3b72a3['attributes']=_['intersection'](_0x2916b4[_0xe1a9('0x25')],qs[_0xe1a9('0x2a')](_0x3bb891[_0xe1a9('0x27')]['fields']));_0x3b72a3[_0xe1a9('0x2b')]=_0x3b72a3[_0xe1a9('0x2b')]['length']?_0x3b72a3[_0xe1a9('0x2b')]:_0x2916b4[_0xe1a9('0x25')];if(!_0x3bb891[_0xe1a9('0x27')][_0xe1a9('0x2c')]('nolimit')){_0x3b72a3['limit']=qs[_0xe1a9('0x2d')](_0x3bb891[_0xe1a9('0x27')][_0xe1a9('0x2d')]);_0x3b72a3['offset']=qs[_0xe1a9('0x19')](_0x3bb891[_0xe1a9('0x27')][_0xe1a9('0x19')]);}_0x3b72a3[_0xe1a9('0x2e')]=qs['sort'](_0x3bb891[_0xe1a9('0x27')][_0xe1a9('0x2f')]);_0x3b72a3[_0xe1a9('0x30')]=qs['filters'](_[_0xe1a9('0x31')](_0x3bb891['query'],_0x2916b4[_0xe1a9('0x28')]));if(_0x3bb891[_0xe1a9('0x27')]['filter']){_0x3b72a3['where']=_[_0xe1a9('0x32')](_0x3b72a3[_0xe1a9('0x30')],{'$or':_[_0xe1a9('0x33')](_0x4f00f3,function(_0x3b5084){if(_0x3b5084[_0xe1a9('0x34')][_0xe1a9('0x35')]!=='VIRTUAL'){var _0x3332a2={};_0x3332a2[_0x3b5084[_0xe1a9('0x36')]]={'$like':'%'+_0x3bb891[_0xe1a9('0x27')]['filter']+'%'};return _0x3332a2;}})});}_0x3b72a3=_[_0xe1a9('0x32')]({},_0x3b72a3,_0x3bb891[_0xe1a9('0x37')]);var _0x35e2ca={'where':_0x3b72a3[_0xe1a9('0x30')]};return db[_0xe1a9('0x38')][_0xe1a9('0x18')](_0x35e2ca)[_0xe1a9('0x1f')](function(_0x438843){_0x2e396a['count']=_0x438843;if(_0x3bb891['query'][_0xe1a9('0x39')]){_0x3b72a3[_0xe1a9('0x3a')]=[{'all':!![]}];}return db[_0xe1a9('0x38')][_0xe1a9('0x3b')](_0x3b72a3);})['then'](function(_0x156008){_0x2e396a[_0xe1a9('0x3c')]=_0x156008;return _0x2e396a;})[_0xe1a9('0x1f')](respondWithFilteredResult(_0x26f53e,_0x3b72a3))[_0xe1a9('0x3d')](handleError(_0x26f53e,null));};exports[_0xe1a9('0x3e')]=function(_0x19c34b,_0x188496){var _0x48d8a7={'raw':![],'where':{'id':_0x19c34b[_0xe1a9('0x3f')]['id']}},_0x4c517d={};_0x4c517d[_0xe1a9('0x25')]=_[_0xe1a9('0x26')](db[_0xe1a9('0x38')][_0xe1a9('0x24')]);_0x4c517d[_0xe1a9('0x27')]=_['keys'](_0x19c34b[_0xe1a9('0x27')]);_0x4c517d[_0xe1a9('0x28')]=_['intersection'](_0x4c517d[_0xe1a9('0x25')],_0x4c517d[_0xe1a9('0x27')]);_0x48d8a7[_0xe1a9('0x2b')]=_[_0xe1a9('0x29')](_0x4c517d[_0xe1a9('0x25')],qs[_0xe1a9('0x2a')](_0x19c34b[_0xe1a9('0x27')][_0xe1a9('0x2a')]));_0x48d8a7[_0xe1a9('0x2b')]=_0x48d8a7[_0xe1a9('0x2b')][_0xe1a9('0x40')]?_0x48d8a7[_0xe1a9('0x2b')]:_0x4c517d[_0xe1a9('0x25')];if(_0x19c34b[_0xe1a9('0x27')][_0xe1a9('0x39')]){_0x48d8a7[_0xe1a9('0x3a')]=[{'all':!![]}];}_0x48d8a7=_[_0xe1a9('0x32')]({},_0x48d8a7,_0x19c34b[_0xe1a9('0x37')]);return db[_0xe1a9('0x38')][_0xe1a9('0x41')](_0x48d8a7)[_0xe1a9('0x1f')](handleEntityNotFound(_0x188496,null))['then'](respondWithResult(_0x188496,null))[_0xe1a9('0x3d')](handleError(_0x188496,null));};exports[_0xe1a9('0x42')]=function(_0x1496ee,_0x2fe61c){return db['VoiceAgentReport'][_0xe1a9('0x42')](_0x1496ee['body'],{})['then'](respondWithResult(_0x2fe61c,0xc9))['catch'](handleError(_0x2fe61c,null));};exports[_0xe1a9('0x43')]=function(_0x22d006,_0x44de70){if(_0x22d006[_0xe1a9('0x44')]['id']){delete _0x22d006['body']['id'];}return db[_0xe1a9('0x38')][_0xe1a9('0x41')]({'where':{'id':_0x22d006[_0xe1a9('0x3f')]['id']}})['then'](handleEntityNotFound(_0x44de70,null))['then'](saveUpdates(_0x22d006[_0xe1a9('0x44')],null))[_0xe1a9('0x1f')](respondWithResult(_0x44de70,null))[_0xe1a9('0x3d')](handleError(_0x44de70,null));};exports[_0xe1a9('0x45')]=function(_0x377370,_0x58b9a4){return db[_0xe1a9('0x38')]['find']({'where':{'id':_0x377370[_0xe1a9('0x3f')]['id']}})[_0xe1a9('0x1f')](handleEntityNotFound(_0x58b9a4,null))[_0xe1a9('0x1f')](removeEntity(_0x58b9a4,null))[_0xe1a9('0x3d')](handleError(_0x58b9a4,null));};exports[_0xe1a9('0x46')]=function(_0xe7f62e,_0x4382f7){return db[_0xe1a9('0x38')][_0xe1a9('0x46')]()[_0xe1a9('0x1f')](respondWithResult(_0x4382f7,null))[_0xe1a9('0x3d')](handleError(_0x4382f7,null));}; \ No newline at end of file +var _0x4fdb=['key','VIRTUAL','options','include','rows','show','params','length','includeAll','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','VoiceAgentReport','rawAttributes','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type'];(function(_0x1543c3,_0x5b44d3){var _0x496063=function(_0xda9297){while(--_0xda9297){_0x1543c3['push'](_0x1543c3['shift']());}};_0x496063(++_0x5b44d3);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x401644,_0x45e4d7){_0x401644=_0x401644-0x0;var _0x1191c5=_0x4fdb[_0x401644];return _0x1191c5;};'use strict';var pdf=require(_0xb4fd('0x0'));var emlformat=require(_0xb4fd('0x1'));var rimraf=require(_0xb4fd('0x2'));var zipdir=require(_0xb4fd('0x3'));var jsonpatch=require(_0xb4fd('0x4'));var rp=require(_0xb4fd('0x5'));var moment=require(_0xb4fd('0x6'));var BPromise=require(_0xb4fd('0x7'));var Mustache=require(_0xb4fd('0x8'));var util=require('util');var path=require(_0xb4fd('0x9'));var sox=require('sox');var csv=require(_0xb4fd('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb4fd('0xb'));var crypto=require(_0xb4fd('0xc'));var jsforce=require(_0xb4fd('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb4fd('0xe'));var Papa=require(_0xb4fd('0xf'));var authService=require(_0xb4fd('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0xb4fd('0x11'));var qs=require(_0xb4fd('0x12'));var logger=require(_0xb4fd('0x13'))(_0xb4fd('0x14'));var utils=require(_0xb4fd('0x15'));var config=require('../../config/environment');var db=require(_0xb4fd('0x16'))['db'];function respondWithStatusCode(_0x1f3e30,_0x2e8ee1){_0x2e8ee1=_0x2e8ee1||0xcc;return function(_0x120c2e){if(_0x120c2e){return _0x1f3e30['sendStatus'](_0x2e8ee1);}return _0x1f3e30[_0xb4fd('0x17')](_0x2e8ee1)[_0xb4fd('0x18')]();};}function respondWithResult(_0x345d35,_0x47b196){_0x47b196=_0x47b196||0xc8;return function(_0x399756){if(_0x399756){return _0x345d35[_0xb4fd('0x17')](_0x47b196)[_0xb4fd('0x19')](_0x399756);}};}function respondWithFilteredResult(_0x41e21a,_0x36e88f){return function(_0x37801f){if(_0x37801f){var _0x3a0872=_0x37801f[_0xb4fd('0x1a')],_0x47e288=_0x36e88f[_0xb4fd('0x1b')],_0x2076d5=_0x36e88f[_0xb4fd('0x1b')]+_0x36e88f[_0xb4fd('0x1c')],_0x12401d;if(_0x2076d5>=_0x3a0872){_0x2076d5=_0x3a0872;_0x12401d=0xc8;}else{_0x12401d=0xce;}_0x41e21a[_0xb4fd('0x17')](_0x12401d);return _0x41e21a[_0xb4fd('0x1d')](_0xb4fd('0x1e'),_0x47e288+'-'+_0x2076d5+'/'+_0x3a0872)[_0xb4fd('0x19')](_0x37801f);}return null;};}function patchUpdates(_0x19f7b0){return function(_0x5e930d){try{jsonpatch['apply'](_0x5e930d,_0x19f7b0,!![]);}catch(_0x504e80){return BPromise['reject'](_0x504e80);}return _0x5e930d[_0xb4fd('0x1f')]();};}function saveUpdates(_0x4413ad,_0x299764){return function(_0x1392c4){if(_0x1392c4){return _0x1392c4[_0xb4fd('0x20')](_0x4413ad)[_0xb4fd('0x21')](function(_0xedff2f){return _0xedff2f;});}return null;};}function removeEntity(_0x4ffaf1,_0x51ac94){return function(_0x216307){if(_0x216307){return _0x216307[_0xb4fd('0x22')]()[_0xb4fd('0x21')](function(){_0x4ffaf1['status'](0xcc)[_0xb4fd('0x18')]();});}};}function handleEntityNotFound(_0x49d42c,_0x46cba4){return function(_0x4f5032){if(!_0x4f5032){_0x49d42c[_0xb4fd('0x23')](0x194);}return _0x4f5032;};}function handleError(_0x2c2d8d,_0x3da99b){_0x3da99b=_0x3da99b||0x1f4;return function(_0x261eda){logger[_0xb4fd('0x24')](_0x261eda[_0xb4fd('0x25')]);if(_0x261eda[_0xb4fd('0x26')]){delete _0x261eda[_0xb4fd('0x26')];}_0x2c2d8d['status'](_0x3da99b)['send'](_0x261eda);};}exports['index']=function(_0x453982,_0x4bad85){var _0x3617b2={},_0x5e9d2b={},_0x5738c2={'count':0x0,'rows':[]};var _0x282fe4=db[_0xb4fd('0x27')][_0xb4fd('0x28')];_0x5e9d2b['model']=_[_0xb4fd('0x29')](_0x282fe4);_0x5e9d2b[_0xb4fd('0x2a')]=_[_0xb4fd('0x29')](_0x453982[_0xb4fd('0x2a')]);_0x5e9d2b['filters']=_[_0xb4fd('0x2b')](_0x5e9d2b[_0xb4fd('0x2c')],_0x5e9d2b['query']);_0x3617b2[_0xb4fd('0x2d')]=_[_0xb4fd('0x2b')](_0x5e9d2b[_0xb4fd('0x2c')],qs['fields'](_0x453982[_0xb4fd('0x2a')][_0xb4fd('0x2e')]));_0x3617b2[_0xb4fd('0x2d')]=_0x3617b2['attributes']['length']?_0x3617b2['attributes']:_0x5e9d2b['model'];if(!_0x453982[_0xb4fd('0x2a')][_0xb4fd('0x2f')](_0xb4fd('0x30'))){_0x3617b2[_0xb4fd('0x1c')]=qs[_0xb4fd('0x1c')](_0x453982[_0xb4fd('0x2a')][_0xb4fd('0x1c')]);_0x3617b2[_0xb4fd('0x1b')]=qs[_0xb4fd('0x1b')](_0x453982[_0xb4fd('0x2a')][_0xb4fd('0x1b')]);}_0x3617b2[_0xb4fd('0x31')]=qs[_0xb4fd('0x32')](_0x453982[_0xb4fd('0x2a')][_0xb4fd('0x32')]);_0x3617b2[_0xb4fd('0x33')]=qs[_0xb4fd('0x34')](_[_0xb4fd('0x35')](_0x453982['query'],_0x5e9d2b['filters']));if(_0x453982[_0xb4fd('0x2a')][_0xb4fd('0x36')]){_0x3617b2[_0xb4fd('0x33')]=_[_0xb4fd('0x37')](_0x3617b2[_0xb4fd('0x33')],{'$or':_['map'](_0x282fe4,function(_0x2e09d6){if(_0x2e09d6[_0xb4fd('0x38')][_0xb4fd('0x39')]!==_0xb4fd('0x3a')){var _0x43af26={};_0x43af26[_0x2e09d6['field']]={'$like':'%'+_0x453982[_0xb4fd('0x2a')]['filter']+'%'};return _0x43af26;}})});}_0x3617b2=_[_0xb4fd('0x37')]({},_0x3617b2,_0x453982[_0xb4fd('0x3b')]);var _0x5440ca={'where':_0x3617b2['where']};return db[_0xb4fd('0x27')][_0xb4fd('0x1a')](_0x5440ca)[_0xb4fd('0x21')](function(_0x357cf5){_0x5738c2[_0xb4fd('0x1a')]=_0x357cf5;if(_0x453982[_0xb4fd('0x2a')]['includeAll']){_0x3617b2[_0xb4fd('0x3c')]=[{'all':!![]}];}return db[_0xb4fd('0x27')]['findAll'](_0x3617b2);})[_0xb4fd('0x21')](function(_0x5da3c0){_0x5738c2[_0xb4fd('0x3d')]=_0x5da3c0;return _0x5738c2;})[_0xb4fd('0x21')](respondWithFilteredResult(_0x4bad85,_0x3617b2))['catch'](handleError(_0x4bad85,null));};exports[_0xb4fd('0x3e')]=function(_0xdcd955,_0xdd0e59){var _0x2ab6bd={'raw':![],'where':{'id':_0xdcd955[_0xb4fd('0x3f')]['id']}},_0xcbd37={};_0xcbd37['model']=_[_0xb4fd('0x29')](db[_0xb4fd('0x27')]['rawAttributes']);_0xcbd37[_0xb4fd('0x2a')]=_[_0xb4fd('0x29')](_0xdcd955[_0xb4fd('0x2a')]);_0xcbd37[_0xb4fd('0x34')]=_[_0xb4fd('0x2b')](_0xcbd37['model'],_0xcbd37[_0xb4fd('0x2a')]);_0x2ab6bd[_0xb4fd('0x2d')]=_[_0xb4fd('0x2b')](_0xcbd37['model'],qs[_0xb4fd('0x2e')](_0xdcd955['query'][_0xb4fd('0x2e')]));_0x2ab6bd[_0xb4fd('0x2d')]=_0x2ab6bd['attributes'][_0xb4fd('0x40')]?_0x2ab6bd['attributes']:_0xcbd37[_0xb4fd('0x2c')];if(_0xdcd955[_0xb4fd('0x2a')][_0xb4fd('0x41')]){_0x2ab6bd['include']=[{'all':!![]}];}_0x2ab6bd=_[_0xb4fd('0x37')]({},_0x2ab6bd,_0xdcd955[_0xb4fd('0x3b')]);return db[_0xb4fd('0x27')][_0xb4fd('0x42')](_0x2ab6bd)[_0xb4fd('0x21')](handleEntityNotFound(_0xdd0e59,null))[_0xb4fd('0x21')](respondWithResult(_0xdd0e59,null))[_0xb4fd('0x43')](handleError(_0xdd0e59,null));};exports['create']=function(_0x5a2b61,_0x1595f2){return db[_0xb4fd('0x27')][_0xb4fd('0x44')](_0x5a2b61[_0xb4fd('0x45')],{})['then'](respondWithResult(_0x1595f2,0xc9))[_0xb4fd('0x43')](handleError(_0x1595f2,null));};exports['update']=function(_0x4d5d04,_0x18b264){if(_0x4d5d04[_0xb4fd('0x45')]['id']){delete _0x4d5d04['body']['id'];}return db[_0xb4fd('0x27')][_0xb4fd('0x42')]({'where':{'id':_0x4d5d04['params']['id']}})[_0xb4fd('0x21')](handleEntityNotFound(_0x18b264,null))[_0xb4fd('0x21')](saveUpdates(_0x4d5d04[_0xb4fd('0x45')],null))['then'](respondWithResult(_0x18b264,null))['catch'](handleError(_0x18b264,null));};exports[_0xb4fd('0x22')]=function(_0x1b5f2d,_0x17fbc7){return db[_0xb4fd('0x27')]['find']({'where':{'id':_0x1b5f2d[_0xb4fd('0x3f')]['id']}})[_0xb4fd('0x21')](handleEntityNotFound(_0x17fbc7,null))['then'](removeEntity(_0x17fbc7,null))[_0xb4fd('0x43')](handleError(_0x17fbc7,null));};exports[_0xb4fd('0x46')]=function(_0x38a530,_0x4bc6b2){return db[_0xb4fd('0x27')][_0xb4fd('0x46')]()['then'](respondWithResult(_0x4bc6b2,null))[_0xb4fd('0x43')](handleError(_0x4bc6b2,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 734f2ba..d0ee66e 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 _0xe8bf=['util','moment','bluebird','request-promise','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe8bf,0x113));var _0xfe8b=function(_0x59bfcd,_0x2e88a1){_0x59bfcd=_0x59bfcd-0x0;var _0x38d605=_0xe8bf[_0x59bfcd];return _0x38d605;};'use strict';var _=require('lodash');var util=require(_0xfe8b('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xfe8b('0x1'));var BPromise=require(_0xfe8b('0x2'));var rp=require(_0xfe8b('0x3'));var attributes=require(_0xfe8b('0x4'));module[_0xfe8b('0x5')]=function(_0x16f899,_0x502d75){return _0x16f899[_0xfe8b('0x6')](_0xfe8b('0x7'),attributes,{'tableName':_0xfe8b('0x8'),'paranoid':![],'indexes':[{'fields':[_0xfe8b('0x9'),_0xfe8b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x01dc=['api','request-promise','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','destuniqueid','lodash','util','../../config/logger'];(function(_0x1fe2b4,_0x12dcce){var _0x839f9c=function(_0x49d9fa){while(--_0x49d9fa){_0x1fe2b4['push'](_0x1fe2b4['shift']());}};_0x839f9c(++_0x12dcce);}(_0x01dc,0x1b5));var _0xc01d=function(_0x65064e,_0xaf0379){_0x65064e=_0x65064e-0x0;var _0x4ebd68=_0x01dc[_0x65064e];return _0x4ebd68;};'use strict';var _=require(_0xc01d('0x0'));var util=require(_0xc01d('0x1'));var logger=require(_0xc01d('0x2'))(_0xc01d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc01d('0x4'));var attributes=require(_0xc01d('0x5'));module[_0xc01d('0x6')]=function(_0x3ae622,_0x324823){return _0x3ae622[_0xc01d('0x7')](_0xc01d('0x8'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid',_0xc01d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 387c933..06b1a07 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 _0x9957=['catch','CreateVoiceAgentReport','create','options','raw','UpdateVoiceAgentReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xae2cbf,_0x1446a6){var _0x31931b=function(_0x2717af){while(--_0x2717af){_0xae2cbf['push'](_0xae2cbf['shift']());}};_0x31931b(++_0x1446a6);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['VoiceAgentReport'][_0x7995('0x19')](_0x291317['body'],{'raw':_0x291317['options']?_0x291317[_0x7995('0x1a')][_0x7995('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3a9b54){logger['info']('CreateVoiceAgentReport',_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x3a9b54));_0x37a7d4(_0x3a9b54);})[_0x7995('0x17')](function(_0x460924){logger[_0x7995('0x13')]('CreateVoiceAgentReport',_0x460924[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x460924[_0x7995('0x15')]));});});};exports[_0x7995('0x1c')]=function(_0x563799){var _0x13bc35=this;return new Promise(function(_0x475351,_0x472195){return db['VoiceAgentReport'][_0x7995('0x1d')](_0x563799[_0x7995('0x1e')],{'raw':_0x563799[_0x7995('0x1a')]?_0x563799[_0x7995('0x1a')][_0x7995('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x563799[_0x7995('0x1a')]?_0x563799['options'][_0x7995('0x1f')]||null:null,'attributes':_0x563799['options']?_0x563799[_0x7995('0x1a')][_0x7995('0x20')]||null:null,'limit':_0x563799[_0x7995('0x1a')]?_0x563799[_0x7995('0x1a')][_0x7995('0x21')]||null:null})['then'](function(_0x9b2a15){logger['info'](_0x7995('0x1c'),_0x563799);logger[_0x7995('0x10')](_0x7995('0x1c'),_0x563799,JSON['stringify'](_0x9b2a15));_0x475351(_0x9b2a15);})['catch'](function(_0x48e573){logger[_0x7995('0x13')](_0x7995('0x1c'),_0x48e573[_0x7995('0x15')],_0x563799);_0x472195(_0x13bc35[_0x7995('0x13')](0x1f4,_0x48e573[_0x7995('0x15')]));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceAgentReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','VoiceAgentReport','create','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','where','attributes','limit','then','lodash','util'];(function(_0x15162e,_0x5a9ed4){var _0x15fed9=function(_0x3c6c5c){while(--_0x3c6c5c){_0x15162e['push'](_0x15162e['shift']());}};_0x15fed9(++_0x5a9ed4);}(_0x7a54,0x106));var _0x47a5=function(_0x52cddf,_0x2a54c1){_0x52cddf=_0x52cddf-0x0;var _0x402b19=_0x7a54[_0x52cddf];return _0x402b19;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateVoiceAgentReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateVoiceAgentReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index b0249f1..5a09acb 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 _0x0ca0=['/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','multer','connect-timeout','express','Router','../../components/interaction/service','get'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x0ca0,0x10a));var _0x00ca=function(_0x3769bc,_0x19aca8){_0x3769bc=_0x3769bc-0x0;var _0x433d14=_0x0ca0[_0x3769bc];return _0x433d14;};'use strict';var multer=require(_0x00ca('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x00ca('0x1'));var express=require(_0x00ca('0x2'));var router=express[_0x00ca('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x00ca('0x4'));var config=require('../../config/environment');var controller=require('./voiceCallReport.controller');router[_0x00ca('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x00ca('0x5')](_0x00ca('0x6'),auth[_0x00ca('0x7')](),controller[_0x00ca('0x8')]);router[_0x00ca('0x5')](_0x00ca('0x9'),auth[_0x00ca('0x7')](),controller[_0x00ca('0xa')]);router[_0x00ca('0xb')]('/',auth[_0x00ca('0x7')](),controller[_0x00ca('0xc')]);router[_0x00ca('0xd')](_0x00ca('0x9'),auth[_0x00ca('0x7')](),controller[_0x00ca('0xe')]);router['delete'](_0x00ca('0x9'),auth['isAuthenticated'](),controller[_0x00ca('0xf')]);module['exports']=router; \ No newline at end of file +var _0xbd25=['update','delete','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x2067e9,_0x5e6a97){var _0x280ce4=function(_0x2eca23){while(--_0x2eca23){_0x2067e9['push'](_0x2067e9['shift']());}};_0x280ce4(++_0x5e6a97);}(_0xbd25,0x74));var _0x5bd2=function(_0x1956b9,_0x2ad4a6){_0x1956b9=_0x1956b9-0x0;var _0x2b3628=_0xbd25[_0x1956b9];return _0x2b3628;};'use strict';var multer=require(_0x5bd2('0x0'));var util=require(_0x5bd2('0x1'));var path=require(_0x5bd2('0x2'));var timeout=require('connect-timeout');var express=require(_0x5bd2('0x3'));var router=express[_0x5bd2('0x4')]();var auth=require(_0x5bd2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5bd2('0x6'));var controller=require(_0x5bd2('0x7'));router[_0x5bd2('0x8')]('/',auth[_0x5bd2('0x9')](),controller[_0x5bd2('0xa')]);router[_0x5bd2('0x8')](_0x5bd2('0xb'),auth[_0x5bd2('0x9')](),controller[_0x5bd2('0xc')]);router[_0x5bd2('0x8')](_0x5bd2('0xd'),auth[_0x5bd2('0x9')](),controller[_0x5bd2('0xe')]);router[_0x5bd2('0xf')]('/',auth[_0x5bd2('0x9')](),controller[_0x5bd2('0x10')]);router['put'](_0x5bd2('0xd'),auth[_0x5bd2('0x9')](),controller[_0x5bd2('0x11')]);router[_0x5bd2('0x12')]('/:id',auth[_0x5bd2('0x9')](),controller['destroy']);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 5f18119..9e2a3c1 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 _0xcf71=['inbound-fax','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x203a94,_0x25d1c2){var _0x401f88=function(_0x1aecc6){while(--_0x1aecc6){_0x203a94['push'](_0x203a94['shift']());}};_0x401f88(++_0x25d1c2);}(_0xcf71,0x174));var _0x1cf7=function(_0x598152,_0x4230ac){_0x598152=_0x598152-0x0;var _0x71af95=_0xcf71[_0x598152];return _0x71af95;};'use strict';var Sequelize=require(_0x1cf7('0x0'));module[_0x1cf7('0x1')]={'uniqueid':{'type':Sequelize[_0x1cf7('0x2')]},'type':{'type':Sequelize[_0x1cf7('0x3')]('inbound','internal','outbound',_0x1cf7('0x4'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0x1cf7('0x2')]},'accountcode':{'type':Sequelize[_0x1cf7('0x2')]},'source':{'type':Sequelize[_0x1cf7('0x2')]},'destination':{'type':Sequelize[_0x1cf7('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x1cf7('0x2')]},'channel':{'type':Sequelize[_0x1cf7('0x2')]},'destinationchannel':{'type':Sequelize[_0x1cf7('0x2')]},'lastapplication':{'type':Sequelize[_0x1cf7('0x2')]},'lastdata':{'type':Sequelize[_0x1cf7('0x5')]},'starttime':{'type':Sequelize[_0x1cf7('0x6')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x1cf7('0x7')]},'billableseconds':{'type':Sequelize[_0x1cf7('0x7')]},'mohtime':{'type':Sequelize[_0x1cf7('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1cf7('0x2')]},'amaflags':{'type':Sequelize[_0x1cf7('0x2')]},'userfield':{'type':Sequelize[_0x1cf7('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1cf7('0x2')]},'prefix':{'type':Sequelize[_0x1cf7('0x2')]},'routeid':{'type':Sequelize[_0x1cf7('0x7')]}}; \ No newline at end of file +var _0x85bc=['outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','exports','STRING','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x85bc,0x18d));var _0xc85b=function(_0x10f861,_0x3c61ae){_0x10f861=_0x10f861-0x0;var _0xce297a=_0x85bc[_0x10f861];return _0xce297a;};'use strict';var Sequelize=require('sequelize');module[_0xc85b('0x0')]={'uniqueid':{'type':Sequelize[_0xc85b('0x1')]},'type':{'type':Sequelize[_0xc85b('0x2')]('inbound','internal',_0xc85b('0x3'),_0xc85b('0x4'),_0xc85b('0x5'),_0xc85b('0x6'))},'tag':{'type':Sequelize[_0xc85b('0x1')]},'accountcode':{'type':Sequelize[_0xc85b('0x1')]},'source':{'type':Sequelize[_0xc85b('0x1')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xc85b('0x1')]},'callerid':{'type':Sequelize[_0xc85b('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xc85b('0x1')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xc85b('0x7')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xc85b('0x8')]},'duration':{'type':Sequelize[_0xc85b('0x9')]},'billableseconds':{'type':Sequelize[_0xc85b('0x9')]},'mohtime':{'type':Sequelize[_0xc85b('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc85b('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xc85b('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xc85b('0x1')]},'routeid':{'type':Sequelize[_0xc85b('0x9')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index ab50efb..f9bf3e4 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 _0xd488=['Content-Range','json','apply','update','then','destroy','error','name','send','VoiceCallReport','rawAttributes','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','map','key','field','filter','includeAll','include','alias','User','findAll','rows','show','params','options','find','create','catch','describe','body','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit'];(function(_0x238acf,_0x647024){var _0x26e9b0=function(_0x1e2484){while(--_0x1e2484){_0x238acf['push'](_0x238acf['shift']());}};_0x26e9b0(++_0x647024);}(_0xd488,0x193));var _0x8d48=function(_0x330e03,_0x2f8432){_0x330e03=_0x330e03-0x0;var _0x5884b5=_0xd488[_0x330e03];return _0x5884b5;};'use strict';var pdf=require(_0x8d48('0x0'));var emlformat=require(_0x8d48('0x1'));var rimraf=require(_0x8d48('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8d48('0x3'));var moment=require(_0x8d48('0x4'));var BPromise=require(_0x8d48('0x5'));var Mustache=require(_0x8d48('0x6'));var util=require(_0x8d48('0x7'));var path=require(_0x8d48('0x8'));var sox=require(_0x8d48('0x9'));var csv=require(_0x8d48('0xa'));var ejs=require(_0x8d48('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8d48('0xc'));var jsforce=require(_0x8d48('0xd'));var deskjs=require(_0x8d48('0xe'));var toCsv=require(_0x8d48('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x8d48('0xf'));var hardwareService=require(_0x8d48('0x10'));var Redis=require(_0x8d48('0x11'));var qs=require(_0x8d48('0x12'));var logger=require(_0x8d48('0x13'))('api');var utils=require(_0x8d48('0x14'));var config=require(_0x8d48('0x15'));var db=require(_0x8d48('0x16'))['db'];function respondWithStatusCode(_0x6984e4,_0x168093){_0x168093=_0x168093||0xcc;return function(_0x1a24ba){if(_0x1a24ba){return _0x6984e4[_0x8d48('0x17')](_0x168093);}return _0x6984e4[_0x8d48('0x18')](_0x168093)[_0x8d48('0x19')]();};}function respondWithResult(_0x5f338f,_0x211782){_0x211782=_0x211782||0xc8;return function(_0x2a58db){if(_0x2a58db){return _0x5f338f[_0x8d48('0x18')](_0x211782)['json'](_0x2a58db);}};}function respondWithFilteredResult(_0x37a148,_0xded631){return function(_0x3860e4){if(_0x3860e4){var _0x4cc287=_0x3860e4[_0x8d48('0x1a')],_0x291267=_0xded631[_0x8d48('0x1b')],_0x583094=_0xded631[_0x8d48('0x1b')]+_0xded631[_0x8d48('0x1c')],_0x4d2815;if(_0x583094>=_0x4cc287){_0x583094=_0x4cc287;_0x4d2815=0xc8;}else{_0x4d2815=0xce;}_0x37a148[_0x8d48('0x18')](_0x4d2815);return _0x37a148['set'](_0x8d48('0x1d'),_0x291267+'-'+_0x583094+'/'+_0x4cc287)[_0x8d48('0x1e')](_0x3860e4);}return null;};}function patchUpdates(_0x14a57f){return function(_0x2761e2){try{jsonpatch[_0x8d48('0x1f')](_0x2761e2,_0x14a57f,!![]);}catch(_0x1b1c1a){return BPromise['reject'](_0x1b1c1a);}return _0x2761e2['save']();};}function saveUpdates(_0x1fe983,_0x442a23){return function(_0x225f7b){if(_0x225f7b){return _0x225f7b[_0x8d48('0x20')](_0x1fe983)[_0x8d48('0x21')](function(_0x7f385e){return _0x7f385e;});}return null;};}function removeEntity(_0x55abd8,_0x447b93){return function(_0x59076e){if(_0x59076e){return _0x59076e[_0x8d48('0x22')]()[_0x8d48('0x21')](function(){_0x55abd8[_0x8d48('0x18')](0xcc)[_0x8d48('0x19')]();});}};}function handleEntityNotFound(_0x1e9785,_0x145929){return function(_0x54fbaa){if(!_0x54fbaa){_0x1e9785[_0x8d48('0x17')](0x194);}return _0x54fbaa;};}function handleError(_0x2d70ae,_0x5286cc){_0x5286cc=_0x5286cc||0x1f4;return function(_0x12a470){logger[_0x8d48('0x23')](_0x12a470['stack']);if(_0x12a470[_0x8d48('0x24')]){delete _0x12a470[_0x8d48('0x24')];}_0x2d70ae[_0x8d48('0x18')](_0x5286cc)[_0x8d48('0x25')](_0x12a470);};}exports['index']=function(_0x3ceeb0,_0xdfb4ad){var _0x1a1f66={},_0x2ac9d5={},_0x357a2a={'count':0x0,'rows':[]};var _0x2ff9fb=db[_0x8d48('0x26')][_0x8d48('0x27')];_0x2ac9d5['model']=_['keys'](_0x2ff9fb);_0x2ac9d5[_0x8d48('0x28')]=_[_0x8d48('0x29')](_0x3ceeb0[_0x8d48('0x28')]);_0x2ac9d5['filters']=_[_0x8d48('0x2a')](_0x2ac9d5[_0x8d48('0x2b')],_0x2ac9d5[_0x8d48('0x28')]);_0x1a1f66['attributes']=_[_0x8d48('0x2a')](_0x2ac9d5[_0x8d48('0x2b')],qs[_0x8d48('0x2c')](_0x3ceeb0[_0x8d48('0x28')][_0x8d48('0x2c')]));_0x1a1f66['attributes']=_0x1a1f66[_0x8d48('0x2d')][_0x8d48('0x2e')]?_0x1a1f66[_0x8d48('0x2d')]:_0x2ac9d5[_0x8d48('0x2b')];if(!_0x3ceeb0['query'][_0x8d48('0x2f')](_0x8d48('0x30'))){_0x1a1f66[_0x8d48('0x1c')]=qs[_0x8d48('0x1c')](_0x3ceeb0[_0x8d48('0x28')][_0x8d48('0x1c')]);_0x1a1f66[_0x8d48('0x1b')]=qs[_0x8d48('0x1b')](_0x3ceeb0[_0x8d48('0x28')][_0x8d48('0x1b')]);}_0x1a1f66[_0x8d48('0x31')]=qs[_0x8d48('0x32')](_0x3ceeb0['query'][_0x8d48('0x32')]);_0x1a1f66[_0x8d48('0x33')]=qs[_0x8d48('0x34')](_['pick'](_0x3ceeb0[_0x8d48('0x28')],_0x2ac9d5['filters']));if(_0x3ceeb0[_0x8d48('0x28')]['filter']){_0x1a1f66[_0x8d48('0x33')]=_[_0x8d48('0x35')](_0x1a1f66['where'],{'$or':_[_0x8d48('0x36')](_0x2ff9fb,function(_0x46c199){if(_0x46c199['type'][_0x8d48('0x37')]!=='VIRTUAL'){var _0x547fae={};_0x547fae[_0x46c199[_0x8d48('0x38')]]={'$like':'%'+_0x3ceeb0['query'][_0x8d48('0x39')]+'%'};return _0x547fae;}})});}_0x1a1f66=_[_0x8d48('0x35')]({},_0x1a1f66,_0x3ceeb0['options']);var _0x4d9766={'where':_0x1a1f66[_0x8d48('0x33')]};return db['VoiceCallReport']['count'](_0x4d9766)[_0x8d48('0x21')](function(_0x18f1af){_0x357a2a[_0x8d48('0x1a')]=_0x18f1af;if(_0x3ceeb0['query'][_0x8d48('0x3a')]){_0x1a1f66[_0x8d48('0x3b')]=[{'attributes':['id',_0x8d48('0x24'),'fullname',_0x8d48('0x3c')],'model':db['User'],'as':_0x8d48('0x3d')}];}return db[_0x8d48('0x26')][_0x8d48('0x3e')](_0x1a1f66);})[_0x8d48('0x21')](function(_0x252c9d){_0x357a2a[_0x8d48('0x3f')]=_0x252c9d;return _0x357a2a;})[_0x8d48('0x21')](respondWithFilteredResult(_0xdfb4ad,_0x1a1f66))['catch'](handleError(_0xdfb4ad,null));};exports[_0x8d48('0x40')]=function(_0x34def7,_0x5135c6){var _0x4f2a05={'raw':!![],'where':{'id':_0x34def7[_0x8d48('0x41')]['id']}},_0xd07f15={};_0xd07f15[_0x8d48('0x2b')]=_['keys'](db['VoiceCallReport'][_0x8d48('0x27')]);_0xd07f15[_0x8d48('0x28')]=_[_0x8d48('0x29')](_0x34def7[_0x8d48('0x28')]);_0xd07f15['filters']=_[_0x8d48('0x2a')](_0xd07f15['model'],_0xd07f15['query']);_0x4f2a05[_0x8d48('0x2d')]=_[_0x8d48('0x2a')](_0xd07f15['model'],qs['fields'](_0x34def7[_0x8d48('0x28')][_0x8d48('0x2c')]));_0x4f2a05[_0x8d48('0x2d')]=_0x4f2a05[_0x8d48('0x2d')]['length']?_0x4f2a05['attributes']:_0xd07f15['model'];if(_0x34def7[_0x8d48('0x28')][_0x8d48('0x3a')]){_0x4f2a05[_0x8d48('0x3b')]=[{'all':!![]}];}_0x4f2a05=_[_0x8d48('0x35')]({},_0x4f2a05,_0x34def7[_0x8d48('0x42')]);return db[_0x8d48('0x26')][_0x8d48('0x43')](_0x4f2a05)[_0x8d48('0x21')](handleEntityNotFound(_0x5135c6,null))['then'](respondWithResult(_0x5135c6,null))['catch'](handleError(_0x5135c6,null));};exports[_0x8d48('0x44')]=function(_0x598fb8,_0x7dd4a3){return db['VoiceCallReport'][_0x8d48('0x44')](_0x598fb8['body'],{})['then'](respondWithResult(_0x7dd4a3,0xc9))[_0x8d48('0x45')](handleError(_0x7dd4a3,null));};exports[_0x8d48('0x22')]=function(_0x2fd107,_0x1a6fab){return db[_0x8d48('0x26')][_0x8d48('0x43')]({'where':{'id':_0x2fd107[_0x8d48('0x41')]['id']}})[_0x8d48('0x21')](handleEntityNotFound(_0x1a6fab,null))[_0x8d48('0x21')](removeEntity(_0x1a6fab,null))['catch'](handleError(_0x1a6fab,null));};exports['describe']=function(_0xd8d476,_0x4af98f){return db['VoiceCallReport'][_0x8d48('0x46')]()[_0x8d48('0x21')](respondWithResult(_0x4af98f,null))[_0x8d48('0x45')](handleError(_0x4af98f,null));};exports[_0x8d48('0x20')]=function(_0x2319a5,_0x32457a){if(_0x2319a5['body']['uniqueid']){delete _0x2319a5[_0x8d48('0x47')]['uniqueid'];}return db[_0x8d48('0x26')][_0x8d48('0x43')]({'where':{'uniqueid':_0x2319a5[_0x8d48('0x41')]['id'],'UserId':{'$or':[null,_0x2319a5['user']['id']]}}})[_0x8d48('0x21')](handleEntityNotFound(_0x32457a,null))[_0x8d48('0x21')](saveUpdates(_0x2319a5[_0x8d48('0x47')],null))[_0x8d48('0x21')](respondWithResult(_0x32457a,null))['catch'](handleError(_0x32457a,null));}; \ No newline at end of file +var _0x4635=['to-csv','ejs','lodash','squel','crypto','desk.js','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','field','options','VoiceCallReport','alias','User','findAll','show','includeAll','include','catch','create','destroy','params','describe','body','uniqueid','user','html-pdf','zip-dir','request-promise','moment','util','path','sox'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0x4635,0x1ea));var _0x5463=function(_0x57b501,_0x5b583d){_0x57b501=_0x57b501-0x0;var _0x261cb1=_0x4635[_0x57b501];return _0x261cb1;};'use strict';var pdf=require(_0x5463('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5463('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5463('0x2'));var moment=require(_0x5463('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5463('0x4'));var path=require(_0x5463('0x5'));var sox=require(_0x5463('0x6'));var csv=require(_0x5463('0x7'));var ejs=require(_0x5463('0x8'));var fs=require('fs');var _=require(_0x5463('0x9'));var squel=require(_0x5463('0xa'));var crypto=require(_0x5463('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5463('0xc'));var toCsv=require(_0x5463('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var authService=require(_0x5463('0xd'));var hardwareService=require(_0x5463('0xe'));var Redis=require(_0x5463('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0x5463('0x10'))(_0x5463('0x11'));var utils=require(_0x5463('0x12'));var config=require(_0x5463('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ab4eb,_0x363a61){_0x363a61=_0x363a61||0xcc;return function(_0x2fa7b0){if(_0x2fa7b0){return _0x4ab4eb['sendStatus'](_0x363a61);}return _0x4ab4eb[_0x5463('0x14')](_0x363a61)['end']();};}function respondWithResult(_0xd8d1ee,_0x785be1){_0x785be1=_0x785be1||0xc8;return function(_0xb5bf7f){if(_0xb5bf7f){return _0xd8d1ee[_0x5463('0x14')](_0x785be1)[_0x5463('0x15')](_0xb5bf7f);}};}function respondWithFilteredResult(_0x47c02d,_0x2b8634){return function(_0x487fa9){if(_0x487fa9){var _0x56547e=_0x487fa9[_0x5463('0x16')],_0x6e1646=_0x2b8634['offset'],_0xc140ec=_0x2b8634[_0x5463('0x17')]+_0x2b8634[_0x5463('0x18')],_0x54e593;if(_0xc140ec>=_0x56547e){_0xc140ec=_0x56547e;_0x54e593=0xc8;}else{_0x54e593=0xce;}_0x47c02d[_0x5463('0x14')](_0x54e593);return _0x47c02d['set'](_0x5463('0x19'),_0x6e1646+'-'+_0xc140ec+'/'+_0x56547e)[_0x5463('0x15')](_0x487fa9);}return null;};}function patchUpdates(_0xc6fff2){return function(_0x17d2ed){try{jsonpatch[_0x5463('0x1a')](_0x17d2ed,_0xc6fff2,!![]);}catch(_0x2aad58){return BPromise[_0x5463('0x1b')](_0x2aad58);}return _0x17d2ed[_0x5463('0x1c')]();};}function saveUpdates(_0x18a2f2,_0x58ef3b){return function(_0xafab8b){if(_0xafab8b){return _0xafab8b[_0x5463('0x1d')](_0x18a2f2)[_0x5463('0x1e')](function(_0x151635){return _0x151635;});}return null;};}function removeEntity(_0x37fba3,_0x507a9b){return function(_0x5b9fb2){if(_0x5b9fb2){return _0x5b9fb2['destroy']()[_0x5463('0x1e')](function(){_0x37fba3[_0x5463('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e45a7,_0xb0952b){return function(_0x22e08a){if(!_0x22e08a){_0x2e45a7[_0x5463('0x1f')](0x194);}return _0x22e08a;};}function handleError(_0x1fd440,_0x4199e9){_0x4199e9=_0x4199e9||0x1f4;return function(_0x169104){logger[_0x5463('0x20')](_0x169104[_0x5463('0x21')]);if(_0x169104[_0x5463('0x22')]){delete _0x169104[_0x5463('0x22')];}_0x1fd440[_0x5463('0x14')](_0x4199e9)[_0x5463('0x23')](_0x169104);};}exports['index']=function(_0x10fef6,_0x20a4d8){var _0x4f3aa0={},_0x37d8ab={},_0x5412bf={'count':0x0,'rows':[]};var _0x1fe449=db['VoiceCallReport'][_0x5463('0x24')];_0x37d8ab[_0x5463('0x25')]=_[_0x5463('0x26')](_0x1fe449);_0x37d8ab[_0x5463('0x27')]=_['keys'](_0x10fef6[_0x5463('0x27')]);_0x37d8ab[_0x5463('0x28')]=_['intersection'](_0x37d8ab['model'],_0x37d8ab[_0x5463('0x27')]);_0x4f3aa0[_0x5463('0x29')]=_[_0x5463('0x2a')](_0x37d8ab[_0x5463('0x25')],qs[_0x5463('0x2b')](_0x10fef6[_0x5463('0x27')][_0x5463('0x2b')]));_0x4f3aa0[_0x5463('0x29')]=_0x4f3aa0[_0x5463('0x29')][_0x5463('0x2c')]?_0x4f3aa0[_0x5463('0x29')]:_0x37d8ab['model'];if(!_0x10fef6[_0x5463('0x27')][_0x5463('0x2d')](_0x5463('0x2e'))){_0x4f3aa0[_0x5463('0x18')]=qs[_0x5463('0x18')](_0x10fef6[_0x5463('0x27')]['limit']);_0x4f3aa0['offset']=qs[_0x5463('0x17')](_0x10fef6[_0x5463('0x27')][_0x5463('0x17')]);}_0x4f3aa0['order']=qs[_0x5463('0x2f')](_0x10fef6[_0x5463('0x27')][_0x5463('0x2f')]);_0x4f3aa0[_0x5463('0x30')]=qs['filters'](_[_0x5463('0x31')](_0x10fef6['query'],_0x37d8ab[_0x5463('0x28')]));if(_0x10fef6[_0x5463('0x27')][_0x5463('0x32')]){_0x4f3aa0[_0x5463('0x30')]=_[_0x5463('0x33')](_0x4f3aa0[_0x5463('0x30')],{'$or':_['map'](_0x1fe449,function(_0x38a4c1){if(_0x38a4c1[_0x5463('0x34')]['key']!==_0x5463('0x35')){var _0x309529={};_0x309529[_0x38a4c1[_0x5463('0x36')]]={'$like':'%'+_0x10fef6['query'][_0x5463('0x32')]+'%'};return _0x309529;}})});}_0x4f3aa0=_['merge']({},_0x4f3aa0,_0x10fef6[_0x5463('0x37')]);var _0x15e8f0={'where':_0x4f3aa0['where']};return db[_0x5463('0x38')][_0x5463('0x16')](_0x15e8f0)['then'](function(_0x178a7d){_0x5412bf[_0x5463('0x16')]=_0x178a7d;if(_0x10fef6[_0x5463('0x27')]['includeAll']){_0x4f3aa0['include']=[{'attributes':['id',_0x5463('0x22'),'fullname',_0x5463('0x39')],'model':db[_0x5463('0x3a')],'as':'User'}];}return db[_0x5463('0x38')][_0x5463('0x3b')](_0x4f3aa0);})[_0x5463('0x1e')](function(_0x2941a0){_0x5412bf['rows']=_0x2941a0;return _0x5412bf;})[_0x5463('0x1e')](respondWithFilteredResult(_0x20a4d8,_0x4f3aa0))['catch'](handleError(_0x20a4d8,null));};exports[_0x5463('0x3c')]=function(_0xd53a91,_0x5cd121){var _0x3255ce={'raw':!![],'where':{'id':_0xd53a91['params']['id']}},_0x120aba={};_0x120aba[_0x5463('0x25')]=_[_0x5463('0x26')](db[_0x5463('0x38')]['rawAttributes']);_0x120aba[_0x5463('0x27')]=_[_0x5463('0x26')](_0xd53a91[_0x5463('0x27')]);_0x120aba['filters']=_[_0x5463('0x2a')](_0x120aba[_0x5463('0x25')],_0x120aba[_0x5463('0x27')]);_0x3255ce['attributes']=_[_0x5463('0x2a')](_0x120aba[_0x5463('0x25')],qs[_0x5463('0x2b')](_0xd53a91[_0x5463('0x27')][_0x5463('0x2b')]));_0x3255ce['attributes']=_0x3255ce['attributes'][_0x5463('0x2c')]?_0x3255ce['attributes']:_0x120aba[_0x5463('0x25')];if(_0xd53a91[_0x5463('0x27')][_0x5463('0x3d')]){_0x3255ce[_0x5463('0x3e')]=[{'all':!![]}];}_0x3255ce=_[_0x5463('0x33')]({},_0x3255ce,_0xd53a91[_0x5463('0x37')]);return db[_0x5463('0x38')]['find'](_0x3255ce)[_0x5463('0x1e')](handleEntityNotFound(_0x5cd121,null))['then'](respondWithResult(_0x5cd121,null))[_0x5463('0x3f')](handleError(_0x5cd121,null));};exports[_0x5463('0x40')]=function(_0x213bd4,_0x5d3dba){return db[_0x5463('0x38')]['create'](_0x213bd4['body'],{})[_0x5463('0x1e')](respondWithResult(_0x5d3dba,0xc9))['catch'](handleError(_0x5d3dba,null));};exports[_0x5463('0x41')]=function(_0x13ca1b,_0x3ca2db){return db[_0x5463('0x38')]['find']({'where':{'id':_0x13ca1b[_0x5463('0x42')]['id']}})[_0x5463('0x1e')](handleEntityNotFound(_0x3ca2db,null))[_0x5463('0x1e')](removeEntity(_0x3ca2db,null))[_0x5463('0x3f')](handleError(_0x3ca2db,null));};exports[_0x5463('0x43')]=function(_0x17c47c,_0x29cbf5){return db[_0x5463('0x38')][_0x5463('0x43')]()[_0x5463('0x1e')](respondWithResult(_0x29cbf5,null))['catch'](handleError(_0x29cbf5,null));};exports[_0x5463('0x1d')]=function(_0x5cf437,_0x2fded6){if(_0x5cf437[_0x5463('0x44')][_0x5463('0x45')]){delete _0x5cf437[_0x5463('0x44')]['uniqueid'];}return db['VoiceCallReport']['find']({'where':{'uniqueid':_0x5cf437[_0x5463('0x42')]['id'],'UserId':{'$or':[null,_0x5cf437[_0x5463('0x46')]['id']]}}})[_0x5463('0x1e')](handleEntityNotFound(_0x2fded6,null))[_0x5463('0x1e')](saveUpdates(_0x5cf437[_0x5463('0x44')],null))[_0x5463('0x1e')](respondWithResult(_0x2fded6,null))[_0x5463('0x3f')](handleError(_0x2fded6,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 3d55e3c..810cf25 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 _0x707a=['request-promise','./voiceCallReport.attributes','exports','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api'];(function(_0x4d6cbb,_0x5b0991){var _0x2fc021=function(_0x5bc72b){while(--_0x5bc72b){_0x4d6cbb['push'](_0x4d6cbb['shift']());}};_0x2fc021(++_0x5b0991);}(_0x707a,0xf6));var _0xa707=function(_0x2e3297,_0x4e4db8){_0x2e3297=_0x2e3297-0x0;var _0x551b42=_0x707a[_0x2e3297];return _0x551b42;};'use strict';var _=require(_0xa707('0x0'));var util=require(_0xa707('0x1'));var logger=require(_0xa707('0x2'))(_0xa707('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa707('0x4'));var attributes=require(_0xa707('0x5'));module[_0xa707('0x6')]=function(_0x1acc7a,_0x5f34f2){return _0x1acc7a['define'](_0xa707('0x7'),attributes,{'tableName':_0xa707('0x8'),'paranoid':![],'indexes':[{'fields':[_0xa707('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc6be=['moment','request-promise','exports','define','VoiceCallReport','report_call','util','../../config/logger'];(function(_0x27841e,_0x45435f){var _0x30d008=function(_0x2d2a60){while(--_0x2d2a60){_0x27841e['push'](_0x27841e['shift']());}};_0x30d008(++_0x45435f);}(_0xc6be,0x16e));var _0xec6b=function(_0x257dc8,_0x5116a9){_0x257dc8=_0x257dc8-0x0;var _0x3125ec=_0xc6be[_0x257dc8];return _0x3125ec;};'use strict';var _=require('lodash');var util=require(_0xec6b('0x0'));var logger=require(_0xec6b('0x1'))('api');var moment=require(_0xec6b('0x2'));var BPromise=require('bluebird');var rp=require(_0xec6b('0x3'));var attributes=require('./voiceCallReport.attributes');module[_0xec6b('0x4')]=function(_0x4e20a3,_0x587aa9){return _0x4e20a3[_0xec6b('0x5')](_0xec6b('0x6'),attributes,{'tableName':_0xec6b('0x7'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index c7c025d..4ddfe3f 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 _0xd7ad=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','GetVoiceCallReport','VoiceCallReport','findAll','options','attributes','limit','map','include','model','CreateVoiceCallReport','create','body','raw','catch','where','UpdateVoiceCallReport','lodash','util'];(function(_0x5c56fb,_0x2b6646){var _0x2b529f=function(_0x432f18){while(--_0x432f18){_0x5c56fb['push'](_0x5c56fb['shift']());}};_0x2b529f(++_0x2b6646);}(_0xd7ad,0xe2));var _0xdd7a=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0xd7ad[_0x4ed4d2];return _0x15ae2e;};'use strict';var _=require(_0xdd7a('0x0'));var util=require(_0xdd7a('0x1'));var moment=require(_0xdd7a('0x2'));var BPromise=require(_0xdd7a('0x3'));var rs=require(_0xdd7a('0x4'));var fs=require('fs');var Redis=require(_0xdd7a('0x5'));var db=require(_0xdd7a('0x6'))['db'];var utils=require(_0xdd7a('0x7'));var logger=require(_0xdd7a('0x8'))(_0xdd7a('0x9'));var config=require(_0xdd7a('0xa'));var jayson=require(_0xdd7a('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51bef8,_0x3a97d2,_0x35cdd2){return new BPromise(function(_0x11ce15,_0x4da561){return client[_0xdd7a('0xc')](_0x51bef8,_0x35cdd2)[_0xdd7a('0xd')](function(_0xc9e850){logger[_0xdd7a('0xe')](_0xdd7a('0xf'),_0x3a97d2,_0xdd7a('0x10'));logger[_0xdd7a('0x11')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x3a97d2,_0xdd7a('0x10'),JSON[_0xdd7a('0x12')](_0xc9e850));if(_0xc9e850[_0xdd7a('0x13')]){if(_0xc9e850['error']['code']===0x1f4){logger['error'](_0xdd7a('0xf'),_0x3a97d2,_0xc9e850[_0xdd7a('0x13')][_0xdd7a('0x14')]);return _0x4da561(_0xc9e850[_0xdd7a('0x13')][_0xdd7a('0x14')]);}logger['error'](_0xdd7a('0xf'),_0x3a97d2,_0xc9e850[_0xdd7a('0x13')][_0xdd7a('0x14')]);return _0x11ce15(_0xc9e850[_0xdd7a('0x13')][_0xdd7a('0x14')]);}else{logger[_0xdd7a('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x3a97d2,'request\x20sent');_0x11ce15(_0xc9e850[_0xdd7a('0x15')][_0xdd7a('0x14')]);}})['catch'](function(_0x5f1665){logger[_0xdd7a('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x3a97d2,_0x5f1665);_0x4da561(_0x5f1665);});});}exports[_0xdd7a('0x16')]=function(_0x114d8a){var _0xbf11ad=this;return new Promise(function(_0x573b94,_0x7fb93){return db[_0xdd7a('0x17')][_0xdd7a('0x18')]({'raw':_0x114d8a[_0xdd7a('0x19')]?_0x114d8a['options']['raw']===undefined?!![]:![]:!![],'where':_0x114d8a[_0xdd7a('0x19')]?_0x114d8a[_0xdd7a('0x19')]['where']||null:null,'attributes':_0x114d8a[_0xdd7a('0x19')]?_0x114d8a['options'][_0xdd7a('0x1a')]||null:null,'limit':_0x114d8a['options']?_0x114d8a[_0xdd7a('0x19')][_0xdd7a('0x1b')]||null:null,'include':_0x114d8a[_0xdd7a('0x19')]?_0x114d8a['options']['include']?_[_0xdd7a('0x1c')](_0x114d8a[_0xdd7a('0x19')][_0xdd7a('0x1d')],function(_0x3bf106){return{'model':db[_0x3bf106['model']],'as':_0x3bf106['as'],'attributes':_0x3bf106['attributes'],'include':_0x3bf106[_0xdd7a('0x1d')]?_[_0xdd7a('0x1c')](_0x3bf106[_0xdd7a('0x1d')],function(_0x4fb170){return{'model':db[_0x4fb170[_0xdd7a('0x1e')]],'as':_0x4fb170['as'],'attributes':_0x4fb170[_0xdd7a('0x1a')],'include':_0x4fb170[_0xdd7a('0x1d')]?_['map'](_0x4fb170[_0xdd7a('0x1d')],function(_0x186c25){return{'model':db[_0x186c25[_0xdd7a('0x1e')]],'as':_0x186c25['as'],'attributes':_0x186c25['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2136f4){logger['info'](_0xdd7a('0x16'),_0x114d8a);logger[_0xdd7a('0x11')](_0xdd7a('0x16'),_0x114d8a,JSON[_0xdd7a('0x12')](_0x2136f4));_0x573b94(_0x2136f4);})['catch'](function(_0x404cb1){logger[_0xdd7a('0x13')](_0xdd7a('0x16'),_0x404cb1[_0xdd7a('0x14')],_0x114d8a);_0x7fb93(_0xbf11ad[_0xdd7a('0x13')](0x1f4,_0x404cb1['message']));});});};exports[_0xdd7a('0x1f')]=function(_0x4a563e){var _0x17bb36=this;return new Promise(function(_0x25a343,_0x2c7992){return db[_0xdd7a('0x17')][_0xdd7a('0x20')](_0x4a563e[_0xdd7a('0x21')],{'raw':_0x4a563e[_0xdd7a('0x19')]?_0x4a563e[_0xdd7a('0x19')][_0xdd7a('0x22')]===undefined?!![]:![]:!![]})[_0xdd7a('0xd')](function(_0x20c2f6){logger['info'](_0xdd7a('0x1f'),_0x4a563e);logger[_0xdd7a('0x11')]('CreateVoiceCallReport',_0x4a563e,JSON[_0xdd7a('0x12')](_0x20c2f6));_0x25a343(_0x20c2f6);})[_0xdd7a('0x23')](function(_0x4d47de){logger[_0xdd7a('0x13')]('CreateVoiceCallReport',_0x4d47de[_0xdd7a('0x14')],_0x4a563e);_0x2c7992(_0x17bb36['error'](0x1f4,_0x4d47de[_0xdd7a('0x14')]));});});};exports['UpdateVoiceCallReport']=function(_0x2a3d88){var _0xf7390b=this;return new Promise(function(_0x5cb8e,_0x187ebb){return db['VoiceCallReport']['update'](_0x2a3d88[_0xdd7a('0x21')],{'raw':_0x2a3d88[_0xdd7a('0x19')]?_0x2a3d88[_0xdd7a('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a3d88['options']?_0x2a3d88['options'][_0xdd7a('0x24')]||null:null,'attributes':_0x2a3d88[_0xdd7a('0x19')]?_0x2a3d88[_0xdd7a('0x19')][_0xdd7a('0x1a')]||null:null,'limit':_0x2a3d88[_0xdd7a('0x19')]?_0x2a3d88[_0xdd7a('0x19')][_0xdd7a('0x1b')]||null:null})[_0xdd7a('0xd')](function(_0x252990){logger[_0xdd7a('0xe')](_0xdd7a('0x25'),_0x2a3d88);logger['debug']('UpdateVoiceCallReport',_0x2a3d88,JSON[_0xdd7a('0x12')](_0x252990));_0x5cb8e(_0x252990);})[_0xdd7a('0x23')](function(_0x36c8c2){logger[_0xdd7a('0x13')](_0xdd7a('0x25'),_0x36c8c2[_0xdd7a('0x14')],_0x2a3d88);_0x187ebb(_0xf7390b[_0xdd7a('0x13')](0x1f4,_0x36c8c2[_0xdd7a('0x14')]));});});}; \ No newline at end of file +var _0xfb99=['VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','findAll','options','attributes','limit','include','map','model','VoiceCallReport','create','raw','CreateVoiceCallReport','UpdateVoiceCallReport','update','where','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x59e791,_0x1d7bb8){var _0x5df1ef=function(_0xf5643a){while(--_0xf5643a){_0x59e791['push'](_0x59e791['shift']());}};_0x5df1ef(++_0x1d7bb8);}(_0xfb99,0x82));var _0x9fb9=function(_0x547359,_0x46573a){_0x547359=_0x547359-0x0;var _0x2da331=_0xfb99[_0x547359];return _0x2da331;};'use strict';var _=require('lodash');var util=require(_0x9fb9('0x0'));var moment=require('moment');var BPromise=require(_0x9fb9('0x1'));var rs=require(_0x9fb9('0x2'));var fs=require('fs');var Redis=require(_0x9fb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9fb9('0x4'));var logger=require('../../config/logger')(_0x9fb9('0x5'));var config=require('../../config/environment');var jayson=require(_0x9fb9('0x6'));var client=jayson[_0x9fb9('0x7')][_0x9fb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4339e,_0x34f9f2,_0x37f11b){return new BPromise(function(_0x2d8f34,_0x1e967e){return client['request'](_0x4339e,_0x37f11b)[_0x9fb9('0x9')](function(_0x1d9d7f){logger[_0x9fb9('0xa')](_0x9fb9('0xb'),_0x34f9f2,_0x9fb9('0xc'));logger[_0x9fb9('0xd')](_0x9fb9('0xe'),_0x34f9f2,_0x9fb9('0xc'),JSON[_0x9fb9('0xf')](_0x1d9d7f));if(_0x1d9d7f[_0x9fb9('0x10')]){if(_0x1d9d7f[_0x9fb9('0x10')][_0x9fb9('0x11')]===0x1f4){logger[_0x9fb9('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x34f9f2,_0x1d9d7f[_0x9fb9('0x10')][_0x9fb9('0x12')]);return _0x1e967e(_0x1d9d7f['error']['message']);}logger['error'](_0x9fb9('0xb'),_0x34f9f2,_0x1d9d7f['error']['message']);return _0x2d8f34(_0x1d9d7f[_0x9fb9('0x10')][_0x9fb9('0x12')]);}else{logger[_0x9fb9('0xa')](_0x9fb9('0xb'),_0x34f9f2,'request\x20sent');_0x2d8f34(_0x1d9d7f[_0x9fb9('0x13')][_0x9fb9('0x12')]);}})[_0x9fb9('0x14')](function(_0x42e150){logger['error'](_0x9fb9('0xb'),_0x34f9f2,_0x42e150);_0x1e967e(_0x42e150);});});}exports[_0x9fb9('0x15')]=function(_0x142519){var _0x267851=this;return new Promise(function(_0x3c7d30,_0x567728){return db['VoiceCallReport'][_0x9fb9('0x16')]({'raw':_0x142519[_0x9fb9('0x17')]?_0x142519[_0x9fb9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x142519[_0x9fb9('0x17')]?_0x142519[_0x9fb9('0x17')]['where']||null:null,'attributes':_0x142519[_0x9fb9('0x17')]?_0x142519[_0x9fb9('0x17')][_0x9fb9('0x18')]||null:null,'limit':_0x142519[_0x9fb9('0x17')]?_0x142519['options'][_0x9fb9('0x19')]||null:null,'include':_0x142519[_0x9fb9('0x17')]?_0x142519['options'][_0x9fb9('0x1a')]?_[_0x9fb9('0x1b')](_0x142519[_0x9fb9('0x17')][_0x9fb9('0x1a')],function(_0x4c8aa5){return{'model':db[_0x4c8aa5[_0x9fb9('0x1c')]],'as':_0x4c8aa5['as'],'attributes':_0x4c8aa5[_0x9fb9('0x18')],'include':_0x4c8aa5[_0x9fb9('0x1a')]?_['map'](_0x4c8aa5['include'],function(_0x4d246b){return{'model':db[_0x4d246b['model']],'as':_0x4d246b['as'],'attributes':_0x4d246b[_0x9fb9('0x18')],'include':_0x4d246b[_0x9fb9('0x1a')]?_['map'](_0x4d246b[_0x9fb9('0x1a')],function(_0x4076c7){return{'model':db[_0x4076c7['model']],'as':_0x4076c7['as'],'attributes':_0x4076c7[_0x9fb9('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1900c7){logger[_0x9fb9('0xa')](_0x9fb9('0x15'),_0x142519);logger[_0x9fb9('0xd')]('GetVoiceCallReport',_0x142519,JSON[_0x9fb9('0xf')](_0x1900c7));_0x3c7d30(_0x1900c7);})[_0x9fb9('0x14')](function(_0x1cd8fd){logger[_0x9fb9('0x10')](_0x9fb9('0x15'),_0x1cd8fd['message'],_0x142519);_0x567728(_0x267851[_0x9fb9('0x10')](0x1f4,_0x1cd8fd['message']));});});};exports['CreateVoiceCallReport']=function(_0x211931){var _0x175bb2=this;return new Promise(function(_0x323001,_0x55bfad){return db[_0x9fb9('0x1d')][_0x9fb9('0x1e')](_0x211931['body'],{'raw':_0x211931[_0x9fb9('0x17')]?_0x211931[_0x9fb9('0x17')][_0x9fb9('0x1f')]===undefined?!![]:![]:!![]})[_0x9fb9('0x9')](function(_0x416eff){logger[_0x9fb9('0xa')](_0x9fb9('0x20'),_0x211931);logger[_0x9fb9('0xd')]('CreateVoiceCallReport',_0x211931,JSON[_0x9fb9('0xf')](_0x416eff));_0x323001(_0x416eff);})[_0x9fb9('0x14')](function(_0xdd1473){logger['error'](_0x9fb9('0x20'),_0xdd1473[_0x9fb9('0x12')],_0x211931);_0x55bfad(_0x175bb2[_0x9fb9('0x10')](0x1f4,_0xdd1473['message']));});});};exports[_0x9fb9('0x21')]=function(_0x2271a7){var _0x405c4f=this;return new Promise(function(_0x586b22,_0x19d8f3){return db[_0x9fb9('0x1d')][_0x9fb9('0x22')](_0x2271a7['body'],{'raw':_0x2271a7['options']?_0x2271a7[_0x9fb9('0x17')][_0x9fb9('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2271a7[_0x9fb9('0x17')]?_0x2271a7[_0x9fb9('0x17')][_0x9fb9('0x23')]||null:null,'attributes':_0x2271a7[_0x9fb9('0x17')]?_0x2271a7['options']['attributes']||null:null,'limit':_0x2271a7['options']?_0x2271a7[_0x9fb9('0x17')][_0x9fb9('0x19')]||null:null})[_0x9fb9('0x9')](function(_0x570a0a){logger[_0x9fb9('0xa')](_0x9fb9('0x21'),_0x2271a7);logger['debug'](_0x9fb9('0x21'),_0x2271a7,JSON[_0x9fb9('0xf')](_0x570a0a));_0x586b22(_0x570a0a);})[_0x9fb9('0x14')](function(_0x3cd4e5){logger['error'](_0x9fb9('0x21'),_0x3cd4e5[_0x9fb9('0x12')],_0x2271a7);_0x19d8f3(_0x405c4f[_0x9fb9('0x10')](0x1f4,_0x3cd4e5[_0x9fb9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 6621093..69c4d89 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 _0x47cc=['isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','path','express','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller'];(function(_0x354a4a,_0xa721d3){var _0x54fcff=function(_0x1c233f){while(--_0x1c233f){_0x354a4a['push'](_0x354a4a['shift']());}};_0x54fcff(++_0xa721d3);}(_0x47cc,0x181));var _0xc47c=function(_0x22e2fe,_0x4ad069){_0x22e2fe=_0x22e2fe-0x0;var _0x269f59=_0x47cc[_0x22e2fe];return _0x269f59;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc47c('0x0'));var timeout=require('connect-timeout');var express=require(_0xc47c('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc47c('0x2'));var config=require(_0xc47c('0x3'));var controller=require(_0xc47c('0x4'));router['get']('/',auth[_0xc47c('0x5')](),controller[_0xc47c('0x6')]);router[_0xc47c('0x7')](_0xc47c('0x8'),auth[_0xc47c('0x5')](),controller[_0xc47c('0x9')]);router[_0xc47c('0xa')]('/',auth[_0xc47c('0x5')](),controller[_0xc47c('0xb')]);router[_0xc47c('0xc')](_0xc47c('0x8'),auth[_0xc47c('0x5')](),controller[_0xc47c('0xd')]);router['delete'](_0xc47c('0x8'),auth[_0xc47c('0x5')](),controller[_0xc47c('0xe')]);module['exports']=router; \ No newline at end of file +var _0x37c9=['util','path','express','Router','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','multer'];(function(_0x752c7f,_0x32ea38){var _0x53feee=function(_0x39f028){while(--_0x39f028){_0x752c7f['push'](_0x752c7f['shift']());}};_0x53feee(++_0x32ea38);}(_0x37c9,0x1e5));var _0x937c=function(_0xb56afa,_0x575ddf){_0xb56afa=_0xb56afa-0x0;var _0x525754=_0x37c9[_0xb56afa];return _0x525754;};'use strict';var multer=require(_0x937c('0x0'));var util=require(_0x937c('0x1'));var path=require(_0x937c('0x2'));var timeout=require('connect-timeout');var express=require(_0x937c('0x3'));var router=express[_0x937c('0x4')]();var auth=require(_0x937c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x937c('0x6'));var controller=require(_0x937c('0x7'));router[_0x937c('0x8')]('/',auth[_0x937c('0x9')](),controller[_0x937c('0xa')]);router[_0x937c('0x8')](_0x937c('0xb'),auth[_0x937c('0x9')](),controller['show']);router[_0x937c('0xc')]('/',auth[_0x937c('0x9')](),controller[_0x937c('0xd')]);router['put'](_0x937c('0xb'),auth[_0x937c('0x9')](),controller[_0x937c('0xe')]);router[_0x937c('0xf')]('/:id',auth[_0x937c('0x9')](),controller[_0x937c('0x10')]);module[_0x937c('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 0524012..0f48373 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 _0x2679=['BOOLEAN','sequelize','STRING','name','setDataValue','options','join','getDataValue'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x2679,0x169));var _0x9267=function(_0x2512be,_0x2715eb){_0x2512be=_0x2512be-0x0;var _0x323f42=_0x2679[_0x2512be];return _0x323f42;};'use strict';var Sequelize=require(_0x9267('0x0'));module['exports']={'name':{'type':Sequelize[_0x9267('0x1')]},'prefix':{'type':Sequelize[_0x9267('0x1')],'unique':_0x9267('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x2a6a0d){this[_0x9267('0x3')](_0x9267('0x4'),_0x2a6a0d?_0x2a6a0d[_0x9267('0x5')](''):[]);},'get':function(){return this['getDataValue']('options')?this[_0x9267('0x6')](_0x9267('0x4'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x9267('0x1')]},'record':{'type':Sequelize[_0x9267('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x9267('0x1')]},'description':{'type':Sequelize[_0x9267('0x1')]}}; \ No newline at end of file +var _0x9663=['join','getDataValue','split','BOOLEAN','sequelize','exports','name','STRING','setDataValue','options'];(function(_0x1273b4,_0x161fc8){var _0x5eb9ab=function(_0x33a56d){while(--_0x33a56d){_0x1273b4['push'](_0x1273b4['shift']());}};_0x5eb9ab(++_0x161fc8);}(_0x9663,0xcc));var _0x3966=function(_0x4132d8,_0x1aff6d){_0x4132d8=_0x4132d8-0x0;var _0x4abf13=_0x9663[_0x4132d8];return _0x4abf13;};'use strict';var Sequelize=require(_0x3966('0x0'));module[_0x3966('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0x3966('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x3966('0x3')],'set':function(_0x20f086){this[_0x3966('0x4')](_0x3966('0x5'),_0x20f086?_0x20f086[_0x3966('0x6')](''):[]);},'get':function(){return this[_0x3966('0x7')](_0x3966('0x5'))?this[_0x3966('0x7')](_0x3966('0x5'))[_0x3966('0x8')](''):[];}},'auth':{'type':Sequelize[_0x3966('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x3966('0x3')]},'record':{'type':Sequelize[_0x3966('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x3966('0x3')]},'description':{'type':Sequelize[_0x3966('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index e6183d8..376d9e0 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 _0x8eac=['desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','ChanSpies','destroy','then','error','stack','name','send','VoiceChanSpy','rawAttributes','keys','query','filters','model','attributes','intersection','fields','order','where','pick','merge','map','type','key','VIRTUAL','field','filter','includeAll','include','findAll','catch','show','params','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce'];(function(_0x169ff3,_0x13fb48){var _0x4f8172=function(_0x22a3af){while(--_0x22a3af){_0x169ff3['push'](_0x169ff3['shift']());}};_0x4f8172(++_0x13fb48);}(_0x8eac,0x11c));var _0xc8ea=function(_0x4da78e,_0x13cb84){_0x4da78e=_0x4da78e-0x0;var _0x4463b1=_0x8eac[_0x4da78e];return _0x4463b1;};'use strict';var pdf=require(_0xc8ea('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc8ea('0x1'));var zipdir=require(_0xc8ea('0x2'));var jsonpatch=require(_0xc8ea('0x3'));var rp=require(_0xc8ea('0x4'));var moment=require(_0xc8ea('0x5'));var BPromise=require(_0xc8ea('0x6'));var Mustache=require(_0xc8ea('0x7'));var util=require(_0xc8ea('0x8'));var path=require(_0xc8ea('0x9'));var sox=require(_0xc8ea('0xa'));var csv=require(_0xc8ea('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc8ea('0xc'));var squel=require(_0xc8ea('0xd'));var crypto=require(_0xc8ea('0xe'));var jsforce=require(_0xc8ea('0xf'));var deskjs=require(_0xc8ea('0x10'));var toCsv=require(_0xc8ea('0xb'));var querystring=require(_0xc8ea('0x11'));var Papa=require(_0xc8ea('0x12'));var authService=require(_0xc8ea('0x13'));var hardwareService=require(_0xc8ea('0x14'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0xc8ea('0x15'));var config=require('../../config/environment');var db=require(_0xc8ea('0x16'))['db'];function respondWithStatusCode(_0x53ded0,_0x271388){_0x271388=_0x271388||0xcc;return function(_0xad0e1f){if(_0xad0e1f){return _0x53ded0[_0xc8ea('0x17')](_0x271388);}return _0x53ded0[_0xc8ea('0x18')](_0x271388)[_0xc8ea('0x19')]();};}function respondWithResult(_0x3e7ebc,_0x574b59){_0x574b59=_0x574b59||0xc8;return function(_0x5284be){if(_0x5284be){return _0x3e7ebc[_0xc8ea('0x18')](_0x574b59)[_0xc8ea('0x1a')](_0x5284be);}};}function respondWithFilteredResult(_0x44857f,_0x44a280){return function(_0x5bcafc){if(_0x5bcafc){var _0x2f0c14=_0x5bcafc[_0xc8ea('0x1b')],_0x6e8671=_0x44a280[_0xc8ea('0x1c')],_0x489807=_0x44a280[_0xc8ea('0x1c')]+_0x44a280[_0xc8ea('0x1d')],_0x225e91;if(_0x489807>=_0x2f0c14){_0x489807=_0x2f0c14;_0x225e91=0xc8;}else{_0x225e91=0xce;}_0x44857f[_0xc8ea('0x18')](_0x225e91);return _0x44857f[_0xc8ea('0x1e')](_0xc8ea('0x1f'),_0x6e8671+'-'+_0x489807+'/'+_0x2f0c14)['json'](_0x5bcafc);}return null;};}function patchUpdates(_0x4294aa){return function(_0x4f008d){try{jsonpatch[_0xc8ea('0x20')](_0x4f008d,_0x4294aa,!![]);}catch(_0x5ccb09){return BPromise[_0xc8ea('0x21')](_0x5ccb09);}return _0x4f008d['save']();};}function saveUpdates(_0x69e528,_0x1ee76b){return function(_0x2fbc81){if(_0x2fbc81){return _0x2fbc81[_0xc8ea('0x22')](_0x69e528)['then'](function(_0x2f9c26){return _0x2f9c26;});}return null;};}function removeEntity(_0x42b746,_0x3a47fe){return function(_0x5b0d28){if(_0x5b0d28){return _0x5b0d28['destroy']()['then'](function(){var _0x58998e=_0x5b0d28['get']({'plain':!![]});var _0x32214a=_0xc8ea('0x23');return db['UserProfileResource'][_0xc8ea('0x24')]({'where':{'type':_0x32214a,'resourceId':_0x58998e['id']}})[_0xc8ea('0x25')](function(){return _0x5b0d28;});})[_0xc8ea('0x25')](function(){_0x42b746[_0xc8ea('0x18')](0xcc)[_0xc8ea('0x19')]();});}};}function handleEntityNotFound(_0x21db35,_0x588933){return function(_0x5abdbc){if(!_0x5abdbc){_0x21db35[_0xc8ea('0x17')](0x194);}return _0x5abdbc;};}function handleError(_0x5607e1,_0x4a70d7){_0x4a70d7=_0x4a70d7||0x1f4;return function(_0x33f9c9){logger[_0xc8ea('0x26')](_0x33f9c9[_0xc8ea('0x27')]);if(_0x33f9c9[_0xc8ea('0x28')]){delete _0x33f9c9[_0xc8ea('0x28')];}_0x5607e1['status'](_0x4a70d7)[_0xc8ea('0x29')](_0x33f9c9);};}exports['index']=function(_0x87abfb,_0x325c65){var _0x1286fc={},_0x1bc8ee={},_0x54fa99={'count':0x0,'rows':[]};var _0x52de6f=db[_0xc8ea('0x2a')][_0xc8ea('0x2b')];_0x1bc8ee['model']=_[_0xc8ea('0x2c')](_0x52de6f);_0x1bc8ee[_0xc8ea('0x2d')]=_[_0xc8ea('0x2c')](_0x87abfb['query']);_0x1bc8ee[_0xc8ea('0x2e')]=_['intersection'](_0x1bc8ee[_0xc8ea('0x2f')],_0x1bc8ee[_0xc8ea('0x2d')]);_0x1286fc[_0xc8ea('0x30')]=_[_0xc8ea('0x31')](_0x1bc8ee[_0xc8ea('0x2f')],qs[_0xc8ea('0x32')](_0x87abfb['query'][_0xc8ea('0x32')]));_0x1286fc[_0xc8ea('0x30')]=_0x1286fc['attributes']['length']?_0x1286fc['attributes']:_0x1bc8ee[_0xc8ea('0x2f')];if(!_0x87abfb[_0xc8ea('0x2d')]['hasOwnProperty']('nolimit')){_0x1286fc[_0xc8ea('0x1d')]=qs['limit'](_0x87abfb['query'][_0xc8ea('0x1d')]);_0x1286fc[_0xc8ea('0x1c')]=qs[_0xc8ea('0x1c')](_0x87abfb[_0xc8ea('0x2d')]['offset']);}_0x1286fc[_0xc8ea('0x33')]=qs['sort'](_0x87abfb[_0xc8ea('0x2d')]['sort']);_0x1286fc[_0xc8ea('0x34')]=qs[_0xc8ea('0x2e')](_[_0xc8ea('0x35')](_0x87abfb[_0xc8ea('0x2d')],_0x1bc8ee[_0xc8ea('0x2e')]));if(_0x87abfb['query']['filter']){_0x1286fc[_0xc8ea('0x34')]=_[_0xc8ea('0x36')](_0x1286fc[_0xc8ea('0x34')],{'$or':_[_0xc8ea('0x37')](_0x52de6f,function(_0x3338e4){if(_0x3338e4[_0xc8ea('0x38')][_0xc8ea('0x39')]!==_0xc8ea('0x3a')){var _0x54eef7={};_0x54eef7[_0x3338e4[_0xc8ea('0x3b')]]={'$like':'%'+_0x87abfb[_0xc8ea('0x2d')][_0xc8ea('0x3c')]+'%'};return _0x54eef7;}})});}_0x1286fc=_[_0xc8ea('0x36')]({},_0x1286fc,_0x87abfb['options']);var _0x4d9b58={'where':_0x1286fc[_0xc8ea('0x34')]};return db[_0xc8ea('0x2a')][_0xc8ea('0x1b')](_0x4d9b58)['then'](function(_0x559372){_0x54fa99[_0xc8ea('0x1b')]=_0x559372;if(_0x87abfb[_0xc8ea('0x2d')][_0xc8ea('0x3d')]){_0x1286fc[_0xc8ea('0x3e')]=[{'all':!![]}];}return db[_0xc8ea('0x2a')][_0xc8ea('0x3f')](_0x1286fc);})[_0xc8ea('0x25')](function(_0x15820f){_0x54fa99['rows']=_0x15820f;return _0x54fa99;})[_0xc8ea('0x25')](respondWithFilteredResult(_0x325c65,_0x1286fc))[_0xc8ea('0x40')](handleError(_0x325c65,null));};exports[_0xc8ea('0x41')]=function(_0x3ea31b,_0x3d1bab){var _0x18b520={'raw':![],'where':{'id':_0x3ea31b[_0xc8ea('0x42')]['id']}},_0xb1dad9={};_0xb1dad9[_0xc8ea('0x2f')]=_[_0xc8ea('0x2c')](db[_0xc8ea('0x2a')][_0xc8ea('0x2b')]);_0xb1dad9['query']=_[_0xc8ea('0x2c')](_0x3ea31b[_0xc8ea('0x2d')]);_0xb1dad9[_0xc8ea('0x2e')]=_[_0xc8ea('0x31')](_0xb1dad9[_0xc8ea('0x2f')],_0xb1dad9[_0xc8ea('0x2d')]);_0x18b520[_0xc8ea('0x30')]=_[_0xc8ea('0x31')](_0xb1dad9[_0xc8ea('0x2f')],qs['fields'](_0x3ea31b[_0xc8ea('0x2d')][_0xc8ea('0x32')]));_0x18b520['attributes']=_0x18b520[_0xc8ea('0x30')][_0xc8ea('0x43')]?_0x18b520[_0xc8ea('0x30')]:_0xb1dad9[_0xc8ea('0x2f')];if(_0x3ea31b['query'][_0xc8ea('0x3d')]){_0x18b520[_0xc8ea('0x3e')]=[{'all':!![]}];}_0x18b520=_[_0xc8ea('0x36')]({},_0x18b520,_0x3ea31b['options']);return db['VoiceChanSpy'][_0xc8ea('0x44')](_0x18b520)[_0xc8ea('0x25')](handleEntityNotFound(_0x3d1bab,null))[_0xc8ea('0x25')](respondWithResult(_0x3d1bab,null))[_0xc8ea('0x40')](handleError(_0x3d1bab,null));};exports['create']=function(_0x3e415f,_0x13b9ba){return db[_0xc8ea('0x2a')][_0xc8ea('0x45')](_0x3e415f[_0xc8ea('0x46')],{})[_0xc8ea('0x25')](function(_0x5b1294){var _0x372ded=_0x3e415f['user'][_0xc8ea('0x47')]({'plain':!![]});if(!_0x372ded)throw new Error(_0xc8ea('0x48'));if(_0x372ded[_0xc8ea('0x49')]==='user'){var _0x4aeaad=_0x5b1294[_0xc8ea('0x47')]({'plain':!![]});var _0x53f2d0='ChanSpies';return db['UserProfileSection'][_0xc8ea('0x44')]({'where':{'name':_0x53f2d0,'userProfileId':_0x372ded[_0xc8ea('0x4a')]},'raw':!![]})['then'](function(_0x1e3e10){if(_0x1e3e10&&_0x1e3e10['autoAssociation']===0x0){return db['UserProfileResource'][_0xc8ea('0x45')]({'name':_0x4aeaad['name'],'resourceId':_0x4aeaad['id'],'type':_0x1e3e10[_0xc8ea('0x28')],'sectionId':_0x1e3e10['id']},{})[_0xc8ea('0x25')](function(){return _0x5b1294;});}else{return _0x5b1294;}})[_0xc8ea('0x40')](function(_0x2cc96e){logger[_0xc8ea('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cc96e);throw _0x2cc96e;});}return _0x5b1294;})['then'](respondWithResult(_0x13b9ba,0xc9))[_0xc8ea('0x40')](handleError(_0x13b9ba,null));};exports[_0xc8ea('0x22')]=function(_0x21fcf2,_0x194857){if(_0x21fcf2[_0xc8ea('0x46')]['id']){delete _0x21fcf2[_0xc8ea('0x46')]['id'];}return db[_0xc8ea('0x2a')][_0xc8ea('0x44')]({'where':{'id':_0x21fcf2['params']['id']}})[_0xc8ea('0x25')](handleEntityNotFound(_0x194857,null))[_0xc8ea('0x25')](saveUpdates(_0x21fcf2[_0xc8ea('0x46')],null))['then'](respondWithResult(_0x194857,null))[_0xc8ea('0x40')](handleError(_0x194857,null));};exports[_0xc8ea('0x24')]=function(_0x9dfe33,_0x4fc927){return db[_0xc8ea('0x2a')]['find']({'where':{'id':_0x9dfe33['params']['id']}})[_0xc8ea('0x25')](handleEntityNotFound(_0x4fc927,null))[_0xc8ea('0x25')](removeEntity(_0x4fc927,null))[_0xc8ea('0x40')](handleError(_0x4fc927,null));}; \ No newline at end of file +var _0x3084=['options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../mysqldb','status','end','count','offset','limit','set','Content-Range','save','update','then','destroy','get','ChanSpies','sendStatus','error','name','VoiceChanSpy','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','field'];(function(_0x2bc979,_0x594534){var _0x449e4e=function(_0x2347d1){while(--_0x2347d1){_0x2bc979['push'](_0x2bc979['shift']());}};_0x449e4e(++_0x594534);}(_0x3084,0x1d7));var _0x4308=function(_0x433193,_0x2911fc){_0x433193=_0x433193-0x0;var _0x2dc7e8=_0x3084[_0x433193];return _0x2dc7e8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4308('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4308('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4308('0x2'));var BPromise=require(_0x4308('0x3'));var Mustache=require(_0x4308('0x4'));var util=require(_0x4308('0x5'));var path=require(_0x4308('0x6'));var sox=require(_0x4308('0x7'));var csv=require('to-csv');var ejs=require(_0x4308('0x8'));var fs=require('fs');var _=require(_0x4308('0x9'));var squel=require(_0x4308('0xa'));var crypto=require('crypto');var jsforce=require(_0x4308('0xb'));var deskjs=require(_0x4308('0xc'));var toCsv=require(_0x4308('0xd'));var querystring=require('querystring');var Papa=require(_0x4308('0xe'));var authService=require(_0x4308('0xf'));var hardwareService=require(_0x4308('0x10'));var Redis=require(_0x4308('0x11'));var qs=require(_0x4308('0x12'));var logger=require('../../config/logger')(_0x4308('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x4308('0x14'))['db'];function respondWithStatusCode(_0x5df512,_0x3b1624){_0x3b1624=_0x3b1624||0xcc;return function(_0x5c78d6){if(_0x5c78d6){return _0x5df512['sendStatus'](_0x3b1624);}return _0x5df512[_0x4308('0x15')](_0x3b1624)[_0x4308('0x16')]();};}function respondWithResult(_0x593229,_0x2cabe3){_0x2cabe3=_0x2cabe3||0xc8;return function(_0x1a9285){if(_0x1a9285){return _0x593229[_0x4308('0x15')](_0x2cabe3)['json'](_0x1a9285);}};}function respondWithFilteredResult(_0x5d47b6,_0x25118b){return function(_0x164d62){if(_0x164d62){var _0x236255=_0x164d62[_0x4308('0x17')],_0x3f123b=_0x25118b[_0x4308('0x18')],_0x47e84e=_0x25118b[_0x4308('0x18')]+_0x25118b[_0x4308('0x19')],_0x1aaaf8;if(_0x47e84e>=_0x236255){_0x47e84e=_0x236255;_0x1aaaf8=0xc8;}else{_0x1aaaf8=0xce;}_0x5d47b6[_0x4308('0x15')](_0x1aaaf8);return _0x5d47b6[_0x4308('0x1a')](_0x4308('0x1b'),_0x3f123b+'-'+_0x47e84e+'/'+_0x236255)['json'](_0x164d62);}return null;};}function patchUpdates(_0x27c83d){return function(_0x467717){try{jsonpatch['apply'](_0x467717,_0x27c83d,!![]);}catch(_0x3c36f9){return BPromise['reject'](_0x3c36f9);}return _0x467717[_0x4308('0x1c')]();};}function saveUpdates(_0x3c983e,_0x17941e){return function(_0x3ebf29){if(_0x3ebf29){return _0x3ebf29[_0x4308('0x1d')](_0x3c983e)[_0x4308('0x1e')](function(_0x46cd4a){return _0x46cd4a;});}return null;};}function removeEntity(_0x5bb52b,_0x2f7dc7){return function(_0x4506c5){if(_0x4506c5){return _0x4506c5[_0x4308('0x1f')]()[_0x4308('0x1e')](function(){var _0x5f582f=_0x4506c5[_0x4308('0x20')]({'plain':!![]});var _0x8fb54=_0x4308('0x21');return db['UserProfileResource'][_0x4308('0x1f')]({'where':{'type':_0x8fb54,'resourceId':_0x5f582f['id']}})[_0x4308('0x1e')](function(){return _0x4506c5;});})['then'](function(){_0x5bb52b[_0x4308('0x15')](0xcc)[_0x4308('0x16')]();});}};}function handleEntityNotFound(_0x32fbda,_0x1d1bb7){return function(_0x450d71){if(!_0x450d71){_0x32fbda[_0x4308('0x22')](0x194);}return _0x450d71;};}function handleError(_0x52e569,_0x49329e){_0x49329e=_0x49329e||0x1f4;return function(_0x177328){logger[_0x4308('0x23')](_0x177328['stack']);if(_0x177328[_0x4308('0x24')]){delete _0x177328[_0x4308('0x24')];}_0x52e569[_0x4308('0x15')](_0x49329e)['send'](_0x177328);};}exports['index']=function(_0x263d29,_0x21e292){var _0x3b50c9={},_0x3c5d63={},_0x374577={'count':0x0,'rows':[]};var _0x5454cd=db[_0x4308('0x25')]['rawAttributes'];_0x3c5d63[_0x4308('0x26')]=_[_0x4308('0x27')](_0x5454cd);_0x3c5d63['query']=_[_0x4308('0x27')](_0x263d29[_0x4308('0x28')]);_0x3c5d63[_0x4308('0x29')]=_[_0x4308('0x2a')](_0x3c5d63[_0x4308('0x26')],_0x3c5d63['query']);_0x3b50c9[_0x4308('0x2b')]=_[_0x4308('0x2a')](_0x3c5d63['model'],qs[_0x4308('0x2c')](_0x263d29[_0x4308('0x28')][_0x4308('0x2c')]));_0x3b50c9[_0x4308('0x2b')]=_0x3b50c9[_0x4308('0x2b')]['length']?_0x3b50c9[_0x4308('0x2b')]:_0x3c5d63[_0x4308('0x26')];if(!_0x263d29['query'][_0x4308('0x2d')](_0x4308('0x2e'))){_0x3b50c9[_0x4308('0x19')]=qs[_0x4308('0x19')](_0x263d29[_0x4308('0x28')]['limit']);_0x3b50c9[_0x4308('0x18')]=qs[_0x4308('0x18')](_0x263d29[_0x4308('0x28')][_0x4308('0x18')]);}_0x3b50c9[_0x4308('0x2f')]=qs[_0x4308('0x30')](_0x263d29[_0x4308('0x28')][_0x4308('0x30')]);_0x3b50c9[_0x4308('0x31')]=qs[_0x4308('0x29')](_['pick'](_0x263d29[_0x4308('0x28')],_0x3c5d63[_0x4308('0x29')]));if(_0x263d29[_0x4308('0x28')][_0x4308('0x32')]){_0x3b50c9[_0x4308('0x31')]=_[_0x4308('0x33')](_0x3b50c9['where'],{'$or':_['map'](_0x5454cd,function(_0x1da721){if(_0x1da721[_0x4308('0x34')]['key']!=='VIRTUAL'){var _0x3989a2={};_0x3989a2[_0x1da721[_0x4308('0x35')]]={'$like':'%'+_0x263d29[_0x4308('0x28')][_0x4308('0x32')]+'%'};return _0x3989a2;}})});}_0x3b50c9=_[_0x4308('0x33')]({},_0x3b50c9,_0x263d29[_0x4308('0x36')]);var _0x5d51f5={'where':_0x3b50c9['where']};return db[_0x4308('0x25')]['count'](_0x5d51f5)[_0x4308('0x1e')](function(_0x57c10d){_0x374577[_0x4308('0x17')]=_0x57c10d;if(_0x263d29[_0x4308('0x28')]['includeAll']){_0x3b50c9[_0x4308('0x37')]=[{'all':!![]}];}return db[_0x4308('0x25')][_0x4308('0x38')](_0x3b50c9);})['then'](function(_0x1ba598){_0x374577[_0x4308('0x39')]=_0x1ba598;return _0x374577;})['then'](respondWithFilteredResult(_0x21e292,_0x3b50c9))[_0x4308('0x3a')](handleError(_0x21e292,null));};exports[_0x4308('0x3b')]=function(_0x5e472b,_0x219699){var _0xf966d0={'raw':![],'where':{'id':_0x5e472b[_0x4308('0x3c')]['id']}},_0x55f1e1={};_0x55f1e1[_0x4308('0x26')]=_[_0x4308('0x27')](db['VoiceChanSpy'][_0x4308('0x3d')]);_0x55f1e1[_0x4308('0x28')]=_[_0x4308('0x27')](_0x5e472b[_0x4308('0x28')]);_0x55f1e1[_0x4308('0x29')]=_[_0x4308('0x2a')](_0x55f1e1[_0x4308('0x26')],_0x55f1e1['query']);_0xf966d0[_0x4308('0x2b')]=_[_0x4308('0x2a')](_0x55f1e1[_0x4308('0x26')],qs[_0x4308('0x2c')](_0x5e472b[_0x4308('0x28')][_0x4308('0x2c')]));_0xf966d0[_0x4308('0x2b')]=_0xf966d0[_0x4308('0x2b')][_0x4308('0x3e')]?_0xf966d0[_0x4308('0x2b')]:_0x55f1e1[_0x4308('0x26')];if(_0x5e472b[_0x4308('0x28')][_0x4308('0x3f')]){_0xf966d0[_0x4308('0x37')]=[{'all':!![]}];}_0xf966d0=_[_0x4308('0x33')]({},_0xf966d0,_0x5e472b[_0x4308('0x36')]);return db[_0x4308('0x25')][_0x4308('0x40')](_0xf966d0)['then'](handleEntityNotFound(_0x219699,null))[_0x4308('0x1e')](respondWithResult(_0x219699,null))[_0x4308('0x3a')](handleError(_0x219699,null));};exports[_0x4308('0x41')]=function(_0x3627a1,_0x19cdd2){return db[_0x4308('0x25')]['create'](_0x3627a1[_0x4308('0x42')],{})[_0x4308('0x1e')](function(_0x3f3f41){var _0x5577df=_0x3627a1[_0x4308('0x43')]['get']({'plain':!![]});if(!_0x5577df)throw new Error(_0x4308('0x44'));if(_0x5577df[_0x4308('0x45')]===_0x4308('0x43')){var _0x50a140=_0x3f3f41[_0x4308('0x20')]({'plain':!![]});var _0x3bcb92='ChanSpies';return db[_0x4308('0x46')][_0x4308('0x40')]({'where':{'name':_0x3bcb92,'userProfileId':_0x5577df[_0x4308('0x47')]},'raw':!![]})[_0x4308('0x1e')](function(_0xcb6135){if(_0xcb6135&&_0xcb6135[_0x4308('0x48')]===0x0){return db[_0x4308('0x49')][_0x4308('0x41')]({'name':_0x50a140[_0x4308('0x24')],'resourceId':_0x50a140['id'],'type':_0xcb6135[_0x4308('0x24')],'sectionId':_0xcb6135['id']},{})[_0x4308('0x1e')](function(){return _0x3f3f41;});}else{return _0x3f3f41;}})['catch'](function(_0x4ca1bd){logger[_0x4308('0x23')](_0x4308('0x4a'),_0x4ca1bd);throw _0x4ca1bd;});}return _0x3f3f41;})['then'](respondWithResult(_0x19cdd2,0xc9))[_0x4308('0x3a')](handleError(_0x19cdd2,null));};exports[_0x4308('0x1d')]=function(_0x1d25f2,_0x53e2a9){if(_0x1d25f2[_0x4308('0x42')]['id']){delete _0x1d25f2[_0x4308('0x42')]['id'];}return db['VoiceChanSpy'][_0x4308('0x40')]({'where':{'id':_0x1d25f2['params']['id']}})['then'](handleEntityNotFound(_0x53e2a9,null))[_0x4308('0x1e')](saveUpdates(_0x1d25f2[_0x4308('0x42')],null))[_0x4308('0x1e')](respondWithResult(_0x53e2a9,null))[_0x4308('0x3a')](handleError(_0x53e2a9,null));};exports[_0x4308('0x1f')]=function(_0x527263,_0xc0be2a){return db[_0x4308('0x25')][_0x4308('0x40')]({'where':{'id':_0x527263['params']['id']}})[_0x4308('0x1e')](handleEntityNotFound(_0xc0be2a,null))['then'](removeEntity(_0xc0be2a,null))['catch'](handleError(_0xc0be2a,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 87a2a8b..ba5512a 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 _0x5865=['record','MixMonitor','${UNIQUEID}.%s,ab','recordingFormat','auth','Authenticate','ChanSpy','name','options','join','StopMixMonitor','length','concat','findAll','internal','catch','exports','models','define','then','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','api','./voiceChanSpy.attributes','from-sip','system','%s%s','prefix','push','merge','Set','format','CDR(type)=%s'];(function(_0x220704,_0x12f839){var _0x12cb05=function(_0x57dba4){while(--_0x57dba4){_0x220704['push'](_0x220704['shift']());}};_0x12cb05(++_0x12f839);}(_0x5865,0x11a));var _0x5586=function(_0x17cb2b,_0x42d611){_0x17cb2b=_0x17cb2b-0x0;var _0x541f02=_0x5865[_0x17cb2b];return _0x541f02;};'use strict';var _=require(_0x5586('0x0'));var util=require(_0x5586('0x1'));var BPromise=require(_0x5586('0x2'));var logger=require('../../config/logger')(_0x5586('0x3'));var attributes=require(_0x5586('0x4'));var getUserApplications=function(_0xe9750f,_0x2fdab7,_0x3bc868){var _0x48a781=0x1;var _0x2f727b=[];var _0x4ffc00={'context':_0x5586('0x5'),'type':_0x5586('0x6'),'isApp':![]};var _0x4be85f={'exten':util['format'](_0x5586('0x7'),_0xe9750f[_0x5586('0x8')],_0x3bc868),'ChanSpyId':_0xe9750f['id'],'UserId':_0x2fdab7['id']};_0x2f727b[_0x5586('0x9')](_[_0x5586('0xa')]({'app':_0x5586('0xb'),'appdata':util[_0x5586('0xc')](_0x5586('0xd'),'chanspy'),'priority':_0x48a781++},_0x4ffc00,_0x4be85f));if(_0xe9750f[_0x5586('0xe')]){_0x2f727b[_0x5586('0x9')](_[_0x5586('0xa')]({'app':_0x5586('0xf'),'appdata':util[_0x5586('0xc')](_0x5586('0x10'),_0xe9750f[_0x5586('0x11')]),'priority':_0x48a781++},_0x4ffc00,_0x4be85f));}if(_0xe9750f[_0x5586('0x12')]){_0x2f727b[_0x5586('0x9')](_[_0x5586('0xa')]({'app':_0x5586('0x13'),'appdata':_0xe9750f['password'],'priority':_0x48a781++},_0x4ffc00,_0x4be85f));}_0x2f727b[_0x5586('0x9')](_[_0x5586('0xa')]({'app':_0x5586('0x14'),'appdata':util['format']('SIP/%s,%s',_0x2fdab7[_0x5586('0x15')],_0xe9750f['options']?_0xe9750f[_0x5586('0x16')][_0x5586('0x17')](''):''),'priority':_0x48a781++},_0x4ffc00,_0x4be85f));if(_0xe9750f[_0x5586('0xe')]){_0x2f727b[_0x5586('0x9')](_['merge']({'app':_0x5586('0x18'),'priority':_0x48a781++},_0x4ffc00,_0x4be85f));}return _0x2f727b;};var getChanSpyApplications=function(_0x40596b,_0x4f0b82){var _0x2b4162=[];for(var _0x4c5a08=0x0,_0x210359=0x1;_0x4c5a08<_0x4f0b82[_0x5586('0x19')];_0x4c5a08++,_0x210359=0x1){var _0x3331bc=getUserApplications(_0x40596b,_0x4f0b82[_0x4c5a08],_0x4f0b82[_0x4c5a08]['internal']);var _0x4c6acc=getUserApplications(_0x40596b,_0x4f0b82[_0x4c5a08],_0x4f0b82[_0x4c5a08][_0x5586('0x15')]);_0x2b4162=_0x2b4162[_0x5586('0x1a')](_0x3331bc,_0x4c6acc);}return _0x2b4162;};var getChanSpyPromise=function(_0x5e5fc0,_0x1a9602){return new BPromise(function(_0x1339b0,_0x1ec784){return _0x5e5fc0['User'][_0x5586('0x1b')]({'attributes':['id',_0x5586('0x15'),_0x5586('0x1c')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x4d17dd){if(_0x4d17dd){return _0x1339b0(getChanSpyApplications(_0x1a9602,_0x4d17dd));}return _0x1339b0([]);})[_0x5586('0x1d')](function(_0x440dfe){_0x1ec784(_0x440dfe);});});};module[_0x5586('0x1e')]=function(_0x536157,_0x364e47){var _0x2ba9d3=_0x536157[_0x5586('0x1f')];return _0x536157[_0x5586('0x20')]('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x176969,_0x11af74,_0x2fe89a){return getChanSpyPromise(_0x2ba9d3,_0x176969)[_0x5586('0x21')](function(_0x4cc9f7){if(_0x4cc9f7&&_0x4cc9f7[_0x5586('0x19')]){return _0x2ba9d3[_0x5586('0x22')][_0x5586('0x23')](_0x4cc9f7);}})[_0x5586('0x21')](function(){_0x2fe89a();})[_0x5586('0x1d')](function(_0x211d64){_0x2fe89a(_0x211d64);});},'afterUpdate':function(_0x2bd375,_0x43c26c,_0x128b41){return _0x2ba9d3[_0x5586('0x22')][_0x5586('0x24')]({'where':{'ChanSpyId':_0x2bd375['id']}})[_0x5586('0x21')](function(){return getChanSpyPromise(_0x2ba9d3,_0x2bd375);})[_0x5586('0x21')](function(_0x21ae0a){if(_0x21ae0a&&_0x21ae0a['length']){return _0x2ba9d3['VoiceExtension'][_0x5586('0x23')](_0x21ae0a);}})[_0x5586('0x21')](function(){_0x128b41();})[_0x5586('0x1d')](function(_0x3099bb){_0x128b41(_0x3099bb);});},'afterDestroy':function(_0x517542,_0x268f63,_0xcff4e0){return _0x2ba9d3[_0x5586('0x22')]['destroy']({'where':{'ChanSpyId':_0x517542['id']}})[_0x5586('0x21')](function(){_0xcff4e0();})[_0x5586('0x1d')](function(_0x287a8b){_0xcff4e0(_0x287a8b);});}}});}; \ No newline at end of file +var _0x1054=['system','prefix','push','merge','Set','format','record','MixMonitor','recordingFormat','Authenticate','password','ChanSpy','name','options','join','StopMixMonitor','length','internal','concat','User','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','bulkCreate','lodash','util','bluebird','../../config/logger','api','./voiceChanSpy.attributes','from-sip'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x1054,0x10a));var _0x4105=function(_0xa9ecac,_0x2915e4){_0xa9ecac=_0xa9ecac-0x0;var _0x2c284c=_0x1054[_0xa9ecac];return _0x2c284c;};'use strict';var _=require(_0x4105('0x0'));var util=require(_0x4105('0x1'));var BPromise=require(_0x4105('0x2'));var logger=require(_0x4105('0x3'))(_0x4105('0x4'));var attributes=require(_0x4105('0x5'));var getUserApplications=function(_0x534ba9,_0x7300c5,_0x3b5f88){var _0x515c3a=0x1;var _0x3959b9=[];var _0x25f9a4={'context':_0x4105('0x6'),'type':_0x4105('0x7'),'isApp':![]};var _0x3e25da={'exten':util['format']('%s%s',_0x534ba9[_0x4105('0x8')],_0x3b5f88),'ChanSpyId':_0x534ba9['id'],'UserId':_0x7300c5['id']};_0x3959b9[_0x4105('0x9')](_[_0x4105('0xa')]({'app':_0x4105('0xb'),'appdata':util[_0x4105('0xc')]('CDR(type)=%s','chanspy'),'priority':_0x515c3a++},_0x25f9a4,_0x3e25da));if(_0x534ba9[_0x4105('0xd')]){_0x3959b9[_0x4105('0x9')](_[_0x4105('0xa')]({'app':_0x4105('0xe'),'appdata':util[_0x4105('0xc')]('${UNIQUEID}.%s,ab',_0x534ba9[_0x4105('0xf')]),'priority':_0x515c3a++},_0x25f9a4,_0x3e25da));}if(_0x534ba9['auth']){_0x3959b9[_0x4105('0x9')](_[_0x4105('0xa')]({'app':_0x4105('0x10'),'appdata':_0x534ba9[_0x4105('0x11')],'priority':_0x515c3a++},_0x25f9a4,_0x3e25da));}_0x3959b9['push'](_[_0x4105('0xa')]({'app':_0x4105('0x12'),'appdata':util[_0x4105('0xc')]('SIP/%s,%s',_0x7300c5[_0x4105('0x13')],_0x534ba9[_0x4105('0x14')]?_0x534ba9[_0x4105('0x14')][_0x4105('0x15')](''):''),'priority':_0x515c3a++},_0x25f9a4,_0x3e25da));if(_0x534ba9[_0x4105('0xd')]){_0x3959b9[_0x4105('0x9')](_[_0x4105('0xa')]({'app':_0x4105('0x16'),'priority':_0x515c3a++},_0x25f9a4,_0x3e25da));}return _0x3959b9;};var getChanSpyApplications=function(_0xe5ee1f,_0x5e09f5){var _0x3c60fc=[];for(var _0x4332b0=0x0,_0x36ee5b=0x1;_0x4332b0<_0x5e09f5[_0x4105('0x17')];_0x4332b0++,_0x36ee5b=0x1){var _0x5b52dd=getUserApplications(_0xe5ee1f,_0x5e09f5[_0x4332b0],_0x5e09f5[_0x4332b0][_0x4105('0x18')]);var _0x5b33ab=getUserApplications(_0xe5ee1f,_0x5e09f5[_0x4332b0],_0x5e09f5[_0x4332b0][_0x4105('0x13')]);_0x3c60fc=_0x3c60fc[_0x4105('0x19')](_0x5b52dd,_0x5b33ab);}return _0x3c60fc;};var getChanSpyPromise=function(_0x343e9b,_0x84f4c6){return new BPromise(function(_0x34f4be,_0x42cd5c){return _0x343e9b[_0x4105('0x1a')][_0x4105('0x1b')]({'attributes':['id',_0x4105('0x13'),_0x4105('0x18')],'where':{'role':_0x4105('0x1c'),'chanspy':!![]},'raw':!![]})[_0x4105('0x1d')](function(_0x3b8ed6){if(_0x3b8ed6){return _0x34f4be(getChanSpyApplications(_0x84f4c6,_0x3b8ed6));}return _0x34f4be([]);})[_0x4105('0x1e')](function(_0x1e0ea3){_0x42cd5c(_0x1e0ea3);});});};module[_0x4105('0x1f')]=function(_0x28d79c,_0x325383){var _0xb3aeff=_0x28d79c[_0x4105('0x20')];return _0x28d79c[_0x4105('0x21')](_0x4105('0x22'),attributes,{'tableName':_0x4105('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x16a240,_0x3aef2c,_0x562f9e){return getChanSpyPromise(_0xb3aeff,_0x16a240)[_0x4105('0x1d')](function(_0x4e6e24){if(_0x4e6e24&&_0x4e6e24[_0x4105('0x17')]){return _0xb3aeff[_0x4105('0x24')]['bulkCreate'](_0x4e6e24);}})['then'](function(){_0x562f9e();})[_0x4105('0x1e')](function(_0x46a12f){_0x562f9e(_0x46a12f);});},'afterUpdate':function(_0x56f875,_0x424e84,_0x5ccb33){return _0xb3aeff[_0x4105('0x24')][_0x4105('0x25')]({'where':{'ChanSpyId':_0x56f875['id']}})[_0x4105('0x1d')](function(){return getChanSpyPromise(_0xb3aeff,_0x56f875);})[_0x4105('0x1d')](function(_0x4cee23){if(_0x4cee23&&_0x4cee23[_0x4105('0x17')]){return _0xb3aeff[_0x4105('0x24')][_0x4105('0x26')](_0x4cee23);}})[_0x4105('0x1d')](function(){_0x5ccb33();})[_0x4105('0x1e')](function(_0x25691f){_0x5ccb33(_0x25691f);});},'afterDestroy':function(_0x279c4f,_0x54ec0a,_0x5e660){return _0xb3aeff[_0x4105('0x24')]['destroy']({'where':{'ChanSpyId':_0x279c4f['id']}})[_0x4105('0x1d')](function(){_0x5e660();})['catch'](function(_0xecf2da){_0x5e660(_0xecf2da);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 13641fc..4e0adff 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 _0x3238=['error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x3238,0x13e));var _0x8323=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3238[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8323('0x0'));var util=require('util');var moment=require(_0x8323('0x1'));var BPromise=require(_0x8323('0x2'));var rs=require(_0x8323('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8323('0x4'))['db'];var utils=require(_0x8323('0x5'));var logger=require(_0x8323('0x6'))(_0x8323('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8323('0x8')][_0x8323('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40b1f0,_0x14b3b5,_0x4ddf1f){return new BPromise(function(_0x232f4b,_0x5950e2){return client[_0x8323('0xa')](_0x40b1f0,_0x4ddf1f)[_0x8323('0xb')](function(_0x1577a6){logger[_0x8323('0xc')](_0x8323('0xd'),_0x14b3b5,_0x8323('0xe'));logger[_0x8323('0xf')](_0x8323('0x10'),_0x14b3b5,'request\x20sent',JSON[_0x8323('0x11')](_0x1577a6));if(_0x1577a6[_0x8323('0x12')]){if(_0x1577a6[_0x8323('0x12')]['code']===0x1f4){logger[_0x8323('0x12')](_0x8323('0xd'),_0x14b3b5,_0x1577a6[_0x8323('0x12')][_0x8323('0x13')]);return _0x5950e2(_0x1577a6[_0x8323('0x12')][_0x8323('0x13')]);}logger[_0x8323('0x12')](_0x8323('0xd'),_0x14b3b5,_0x1577a6[_0x8323('0x12')][_0x8323('0x13')]);return _0x232f4b(_0x1577a6[_0x8323('0x12')][_0x8323('0x13')]);}else{logger[_0x8323('0xc')](_0x8323('0xd'),_0x14b3b5,'request\x20sent');_0x232f4b(_0x1577a6[_0x8323('0x14')][_0x8323('0x13')]);}})['catch'](function(_0x320e7f){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x14b3b5,_0x320e7f);_0x5950e2(_0x320e7f);});});} \ No newline at end of file +var _0xf95d=['http','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xf95d,0x14e));var _0xdf95=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xf95d[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require(_0xdf95('0x0'));var util=require('util');var moment=require(_0xdf95('0x1'));var BPromise=require(_0xdf95('0x2'));var rs=require(_0xdf95('0x3'));var fs=require('fs');var Redis=require(_0xdf95('0x4'));var db=require(_0xdf95('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdf95('0x6'))(_0xdf95('0x7'));var config=require(_0xdf95('0x8'));var jayson=require(_0xdf95('0x9'));var client=jayson[_0xdf95('0xa')][_0xdf95('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cda3a,_0x43c62e,_0x3db211){return new BPromise(function(_0x3bedd9,_0x46252c){return client['request'](_0x4cda3a,_0x3db211)[_0xdf95('0xc')](function(_0x13f462){logger[_0xdf95('0xd')](_0xdf95('0xe'),_0x43c62e,_0xdf95('0xf'));logger[_0xdf95('0x10')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x43c62e,_0xdf95('0xf'),JSON[_0xdf95('0x11')](_0x13f462));if(_0x13f462['error']){if(_0x13f462[_0xdf95('0x12')][_0xdf95('0x13')]===0x1f4){logger[_0xdf95('0x12')](_0xdf95('0xe'),_0x43c62e,_0x13f462[_0xdf95('0x12')][_0xdf95('0x14')]);return _0x46252c(_0x13f462[_0xdf95('0x12')][_0xdf95('0x14')]);}logger[_0xdf95('0x12')](_0xdf95('0xe'),_0x43c62e,_0x13f462[_0xdf95('0x12')][_0xdf95('0x14')]);return _0x3bedd9(_0x13f462['error']['message']);}else{logger[_0xdf95('0xd')](_0xdf95('0xe'),_0x43c62e,_0xdf95('0xf'));_0x3bedd9(_0x13f462[_0xdf95('0x15')]['message']);}})[_0xdf95('0x16')](function(_0x5207c6){logger[_0xdf95('0x12')](_0xdf95('0xe'),_0x43c62e,_0x5207c6);_0x46252c(_0x5207c6);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index d897316..5c1409d 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 _0x0598=['update','delete','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','show','post','/:id'];(function(_0x14012f,_0x1cec1d){var _0x53f8fc=function(_0x4e5cf0){while(--_0x4e5cf0){_0x14012f['push'](_0x14012f['shift']());}};_0x53f8fc(++_0x1cec1d);}(_0x0598,0x92));var _0x8059=function(_0xbb28d4,_0x47b88f){_0xbb28d4=_0xbb28d4-0x0;var _0x37e83d=_0x0598[_0xbb28d4];return _0x37e83d;};'use strict';var multer=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var path=require('path');var timeout=require(_0x8059('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x8059('0x3'));var interaction=require(_0x8059('0x4'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router['get']('/',auth[_0x8059('0x5')](),controller[_0x8059('0x6')]);router['get']('/:id',auth[_0x8059('0x5')](),controller[_0x8059('0x7')]);router[_0x8059('0x8')]('/',auth[_0x8059('0x5')](),controller['create']);router['put'](_0x8059('0x9'),auth[_0x8059('0x5')](),controller[_0x8059('0xa')]);router[_0x8059('0xb')](_0x8059('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x8059('0xc')]=router; \ No newline at end of file +var _0x79d7=['Router','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','/:id','show','post','update','delete','exports','multer','path','connect-timeout','express'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x79d7,0x9c));var _0x779d=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x79d7[_0x2e4aa2];return _0x5e6092;};'use strict';var multer=require(_0x779d('0x0'));var util=require('util');var path=require(_0x779d('0x1'));var timeout=require(_0x779d('0x2'));var express=require(_0x779d('0x3'));var router=express[_0x779d('0x4')]();var auth=require(_0x779d('0x5'));var interaction=require(_0x779d('0x6'));var config=require('../../config/environment');var controller=require(_0x779d('0x7'));router[_0x779d('0x8')]('/',auth[_0x779d('0x9')](),controller['index']);router['get'](_0x779d('0xa'),auth['isAuthenticated'](),controller[_0x779d('0xb')]);router[_0x779d('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x779d('0x9')](),controller[_0x779d('0xd')]);router[_0x779d('0xe')]('/:id',auth[_0x779d('0x9')](),controller['destroy']);module[_0x779d('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index e866ccd..75cf444 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 _0x0904=['sequelize','STRING','BOOLEAN'];(function(_0x40ffa6,_0x7eda5){var _0x1adbec=function(_0x4ffff3){while(--_0x4ffff3){_0x40ffa6['push'](_0x40ffa6['shift']());}};_0x1adbec(++_0x7eda5);}(_0x0904,0xab));var _0x4090=function(_0x2389bc,_0x167cd2){_0x2389bc=_0x2389bc-0x0;var _0x170548=_0x0904[_0x2389bc];return _0x170548;};'use strict';var Sequelize=require(_0x4090('0x0'));module['exports']={'name':{'type':Sequelize[_0x4090('0x1')],'unique':'name'},'description':{'type':Sequelize[_0x4090('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x4090('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x351b=['sequelize','exports','STRING','BOOLEAN'];(function(_0x5cb474,_0x4d7fb0){var _0x2f48f6=function(_0x5d5505){while(--_0x5d5505){_0x5cb474['push'](_0x5cb474['shift']());}};_0x2f48f6(++_0x4d7fb0);}(_0x351b,0x188));var _0xb351=function(_0x250817,_0x6052fb){_0x250817=_0x250817-0x0;var _0x231c58=_0x351b[_0x250817];return _0x231c58;};'use strict';var Sequelize=require(_0xb351('0x0'));module[_0xb351('0x1')]={'name':{'type':Sequelize[_0xb351('0x2')],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xb351('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index d9dcc1e..b7df999 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 _0x262d=['model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','VIRTUAL','field','includeAll','include','findAll','params','find','create','body','readFileSync','join','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','role','UserProfileSection','root','server/files/templates/context.ejs','Reload','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','name','send','index','VoiceContext','rawAttributes'];(function(_0x55c2e0,_0x43e360){var _0x47b48b=function(_0x2a56b9){while(--_0x2a56b9){_0x55c2e0['push'](_0x55c2e0['shift']());}};_0x47b48b(++_0x43e360);}(_0x262d,0xf0));var _0xd262=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x262d[_0x2d8fc2];return _0x3a9e53;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd262('0x0'));var rimraf=require(_0xd262('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd262('0x2'));var rp=require('request-promise');var moment=require(_0xd262('0x3'));var BPromise=require(_0xd262('0x4'));var Mustache=require(_0xd262('0x5'));var util=require(_0xd262('0x6'));var path=require(_0xd262('0x7'));var sox=require('sox');var csv=require(_0xd262('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd262('0x9'));var squel=require(_0xd262('0xa'));var crypto=require(_0xd262('0xb'));var jsforce=require(_0xd262('0xc'));var deskjs=require(_0xd262('0xd'));var toCsv=require(_0xd262('0x8'));var querystring=require(_0xd262('0xe'));var Papa=require('papaparse');var authService=require(_0xd262('0xf'));var hardwareService=require(_0xd262('0x10'));var Redis=require(_0xd262('0x11'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xd262('0x12'));var utils=require(_0xd262('0x13'));var config=require(_0xd262('0x14'));var db=require(_0xd262('0x15'))['db'];var jayson=require(_0xd262('0x16'));var client=jayson[_0xd262('0x17')][_0xd262('0x18')]({'port':0x232a});function respondWithRpcPromise(_0xfff179,_0x4a221f,_0x31c1c1,_0x5b3c0b){return new BPromise(function(_0x28c02c,_0x4e320e){var _0x5ec241=_0x5b3c0b||client;return _0x5ec241[_0xd262('0x19')](_0xfff179,_0x31c1c1)[_0xd262('0x1a')](function(_0x5cbfd3){logger[_0xd262('0x1b')]('VoiceContext,\x20%s,\x20%s',_0x4a221f,_0xd262('0x1c'));logger[_0xd262('0x1d')](_0xd262('0x1e'),_0x4a221f,_0xd262('0x1c'),JSON[_0xd262('0x1f')](_0x5cbfd3));if(_0x5cbfd3['error']){if(_0x5cbfd3[_0xd262('0x20')][_0xd262('0x21')]===0x1f4){logger[_0xd262('0x20')]('VoiceContext,\x20%s,\x20%s',_0x4a221f,_0x5cbfd3['error'][_0xd262('0x22')]);return _0x4e320e(_0x5cbfd3[_0xd262('0x20')][_0xd262('0x22')]);}logger[_0xd262('0x20')]('VoiceContext,\x20%s,\x20%s',_0x4a221f,_0x5cbfd3[_0xd262('0x20')][_0xd262('0x22')]);return _0x28c02c(_0x5cbfd3[_0xd262('0x20')]['message']);}else{logger[_0xd262('0x1b')](_0xd262('0x23'),_0x4a221f,_0xd262('0x1c'));_0x28c02c(_0x5cbfd3[_0xd262('0x24')]['message']);}})[_0xd262('0x25')](function(_0x5b637b){logger['error'](_0xd262('0x23'),_0x4a221f,_0x5b637b);_0x4e320e(_0x5b637b);});});}function respondWithStatusCode(_0x6b8049,_0x53bbaa){_0x53bbaa=_0x53bbaa||0xcc;return function(_0x111a19){if(_0x111a19){return _0x6b8049[_0xd262('0x26')](_0x53bbaa);}return _0x6b8049[_0xd262('0x27')](_0x53bbaa)[_0xd262('0x28')]();};}function respondWithResult(_0x264fcf,_0x1462bb){_0x1462bb=_0x1462bb||0xc8;return function(_0x402046){if(_0x402046){return _0x264fcf[_0xd262('0x27')](_0x1462bb)[_0xd262('0x29')](_0x402046);}};}function respondWithFilteredResult(_0x490583,_0x3ab36e){return function(_0x58be36){if(_0x58be36){var _0x3e0b73=_0x58be36[_0xd262('0x2a')],_0x2d93e1=_0x3ab36e[_0xd262('0x2b')],_0x21a618=_0x3ab36e[_0xd262('0x2b')]+_0x3ab36e[_0xd262('0x2c')],_0x2b084c;if(_0x21a618>=_0x3e0b73){_0x21a618=_0x3e0b73;_0x2b084c=0xc8;}else{_0x2b084c=0xce;}_0x490583[_0xd262('0x27')](_0x2b084c);return _0x490583[_0xd262('0x2d')](_0xd262('0x2e'),_0x2d93e1+'-'+_0x21a618+'/'+_0x3e0b73)['json'](_0x58be36);}return null;};}function patchUpdates(_0x516ae7){return function(_0x5f453e){try{jsonpatch['apply'](_0x5f453e,_0x516ae7,!![]);}catch(_0x4bd05d){return BPromise[_0xd262('0x2f')](_0x4bd05d);}return _0x5f453e[_0xd262('0x30')]();};}function saveUpdates(_0x397adb,_0x2ba8ff){return function(_0x2a6d08){if(_0x2a6d08){return _0x2a6d08[_0xd262('0x31')](_0x397adb)[_0xd262('0x1a')](function(_0x4653f4){return _0x4653f4;});}return null;};}function removeEntity(_0x307c20,_0x29276d){return function(_0x5040d0){if(_0x5040d0){return _0x5040d0[_0xd262('0x32')]()[_0xd262('0x1a')](function(){var _0x5611ab=_0x5040d0[_0xd262('0x33')]({'plain':!![]});var _0x44bd2b=_0xd262('0x34');return db[_0xd262('0x35')]['destroy']({'where':{'type':_0x44bd2b,'resourceId':_0x5611ab['id']}})[_0xd262('0x1a')](function(){return _0x5040d0;});})[_0xd262('0x1a')](function(){_0x307c20[_0xd262('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x333e3a,_0x47237b){return function(_0x1d92ed){if(!_0x1d92ed){_0x333e3a[_0xd262('0x26')](0x194);}return _0x1d92ed;};}function handleError(_0x5e0134,_0x1475ac){_0x1475ac=_0x1475ac||0x1f4;return function(_0x22970c){logger['error'](_0x22970c[_0xd262('0x36')]);if(_0x22970c[_0xd262('0x37')]){delete _0x22970c[_0xd262('0x37')];}_0x5e0134[_0xd262('0x27')](_0x1475ac)[_0xd262('0x38')](_0x22970c);};}exports[_0xd262('0x39')]=function(_0x46b781,_0x2e680a){var _0x1f429d={},_0x3eed3e={},_0x2a192f={'count':0x0,'rows':[]};var _0x5d76f7=db[_0xd262('0x3a')][_0xd262('0x3b')];_0x3eed3e[_0xd262('0x3c')]=_[_0xd262('0x3d')](_0x5d76f7);_0x3eed3e['query']=_[_0xd262('0x3d')](_0x46b781[_0xd262('0x3e')]);_0x3eed3e[_0xd262('0x3f')]=_[_0xd262('0x40')](_0x3eed3e[_0xd262('0x3c')],_0x3eed3e['query']);_0x1f429d[_0xd262('0x41')]=_[_0xd262('0x40')](_0x3eed3e[_0xd262('0x3c')],qs[_0xd262('0x42')](_0x46b781[_0xd262('0x3e')]['fields']));_0x1f429d[_0xd262('0x41')]=_0x1f429d[_0xd262('0x41')][_0xd262('0x43')]?_0x1f429d[_0xd262('0x41')]:_0x3eed3e['model'];if(!_0x46b781[_0xd262('0x3e')][_0xd262('0x44')](_0xd262('0x45'))){_0x1f429d[_0xd262('0x2c')]=qs[_0xd262('0x2c')](_0x46b781[_0xd262('0x3e')][_0xd262('0x2c')]);_0x1f429d[_0xd262('0x2b')]=qs[_0xd262('0x2b')](_0x46b781[_0xd262('0x3e')][_0xd262('0x2b')]);}_0x1f429d[_0xd262('0x46')]=qs[_0xd262('0x47')](_0x46b781[_0xd262('0x3e')][_0xd262('0x47')]);_0x1f429d['where']=qs[_0xd262('0x3f')](_[_0xd262('0x48')](_0x46b781[_0xd262('0x3e')],_0x3eed3e['filters']));if(_0x46b781[_0xd262('0x3e')][_0xd262('0x49')]){_0x1f429d[_0xd262('0x4a')]=_[_0xd262('0x4b')](_0x1f429d[_0xd262('0x4a')],{'$or':_[_0xd262('0x4c')](_0x5d76f7,function(_0x20a219){if(_0x20a219[_0xd262('0x4d')]['key']!==_0xd262('0x4e')){var _0x2d7a4b={};_0x2d7a4b[_0x20a219[_0xd262('0x4f')]]={'$like':'%'+_0x46b781['query'][_0xd262('0x49')]+'%'};return _0x2d7a4b;}})});}_0x1f429d=_[_0xd262('0x4b')]({},_0x1f429d,_0x46b781['options']);var _0x4b1a7a={'where':_0x1f429d[_0xd262('0x4a')]};return db['VoiceContext'][_0xd262('0x2a')](_0x4b1a7a)[_0xd262('0x1a')](function(_0x40cdeb){_0x2a192f[_0xd262('0x2a')]=_0x40cdeb;if(_0x46b781[_0xd262('0x3e')][_0xd262('0x50')]){_0x1f429d[_0xd262('0x51')]=[{'all':!![]}];}return db[_0xd262('0x3a')][_0xd262('0x52')](_0x1f429d);})[_0xd262('0x1a')](function(_0x2718f1){_0x2a192f['rows']=_0x2718f1;return _0x2a192f;})[_0xd262('0x1a')](respondWithFilteredResult(_0x2e680a,_0x1f429d))['catch'](handleError(_0x2e680a,null));};exports['show']=function(_0x2c648f,_0x292808){var _0x352fde={'raw':![],'where':{'id':_0x2c648f[_0xd262('0x53')]['id']}},_0x9f60cf={};_0x9f60cf['model']=_[_0xd262('0x3d')](db[_0xd262('0x3a')][_0xd262('0x3b')]);_0x9f60cf[_0xd262('0x3e')]=_[_0xd262('0x3d')](_0x2c648f[_0xd262('0x3e')]);_0x9f60cf[_0xd262('0x3f')]=_[_0xd262('0x40')](_0x9f60cf[_0xd262('0x3c')],_0x9f60cf[_0xd262('0x3e')]);_0x352fde[_0xd262('0x41')]=_['intersection'](_0x9f60cf[_0xd262('0x3c')],qs['fields'](_0x2c648f[_0xd262('0x3e')][_0xd262('0x42')]));_0x352fde[_0xd262('0x41')]=_0x352fde['attributes'][_0xd262('0x43')]?_0x352fde[_0xd262('0x41')]:_0x9f60cf[_0xd262('0x3c')];if(_0x2c648f[_0xd262('0x3e')]['includeAll']){_0x352fde[_0xd262('0x51')]=[{'all':!![]}];}_0x352fde=_[_0xd262('0x4b')]({},_0x352fde,_0x2c648f['options']);return db[_0xd262('0x3a')][_0xd262('0x54')](_0x352fde)['then'](handleEntityNotFound(_0x292808,null))['then'](respondWithResult(_0x292808,null))[_0xd262('0x25')](handleError(_0x292808,null));};exports[_0xd262('0x55')]=function(_0x34f992,_0x25d22b,_0x591638){var _0x39d938;return db[_0xd262('0x3a')]['create'](_0x34f992[_0xd262('0x56')],{'raw':!![]})['then'](function(_0xdf8e8b){_0x39d938=_0xdf8e8b;return db['VoiceContext'][_0xd262('0x52')]({'raw':!![]});})[_0xd262('0x1a')](function(_0x285c08){var _0x2147b7=fs[_0xd262('0x57')](path[_0xd262('0x58')](config['root'],'server/files/templates/context.ejs'),_0xd262('0x59'));var _0x43f046=ejs[_0xd262('0x5a')](_0x2147b7,{'contexts':_0x285c08||[]});fs[_0xd262('0x5b')](_0xd262('0x5c'),_0x43f046);})['then'](function(){return respondWithRpcPromise('Reload','create',{'module':_0xd262('0x5d')});})[_0xd262('0x1a')](function(){var _0x23f5e8=_0x34f992[_0xd262('0x5e')][_0xd262('0x33')]({'plain':!![]});if(!_0x23f5e8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23f5e8[_0xd262('0x5f')]===_0xd262('0x5e')){var _0x39fac3=_0x39d938['get']({'plain':!![]});return db[_0xd262('0x60')][_0xd262('0x54')]({'where':{'name':_0xd262('0x34'),'userProfileId':_0x23f5e8['userProfileId']},'raw':!![]})['then'](function(_0x3497b0){if(_0x3497b0&&_0x3497b0['autoAssociation']===0x0){return db[_0xd262('0x35')]['create']({'name':_0x39fac3[_0xd262('0x37')],'resourceId':_0x39fac3['id'],'type':_0x3497b0['name'],'sectionId':_0x3497b0['id']},{})[_0xd262('0x1a')](function(){return _0x39d938;});}else{return _0x39d938;}})[_0xd262('0x25')](function(_0x34fc89){logger[_0xd262('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34fc89);throw _0x34fc89;});}return _0x39d938;})['then'](respondWithResult(_0x25d22b,0xc9))['catch'](handleError(_0x25d22b,null));};exports['update']=function(_0x38eee0,_0x2b5e6b,_0x1bb403){var _0x1a528b;return db['VoiceContext'][_0xd262('0x54')]({'where':{'id':_0x38eee0[_0xd262('0x53')]['id']}})['then'](handleEntityNotFound(_0x2b5e6b,null))[_0xd262('0x1a')](saveUpdates(_0x38eee0[_0xd262('0x56')],null))[_0xd262('0x1a')](function(_0x14ffdb){if(_0x14ffdb){_0x1a528b=_0x14ffdb;return db[_0xd262('0x3a')][_0xd262('0x52')]({'raw':!![]});}})[_0xd262('0x1a')](function(_0x229be6){var _0x2bcbde=fs[_0xd262('0x57')](path[_0xd262('0x58')](config[_0xd262('0x61')],_0xd262('0x62')),_0xd262('0x59'));var _0xdeb6ca=ejs[_0xd262('0x5a')](_0x2bcbde,{'contexts':_0x229be6||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0xdeb6ca);})[_0xd262('0x1a')](function(){return respondWithRpcPromise(_0xd262('0x63'),'update',{'module':'chan_sip.so'});})[_0xd262('0x1a')](function(){return _0x1a528b;})[_0xd262('0x1a')](respondWithResult(_0x2b5e6b,null))[_0xd262('0x25')](handleError(_0x2b5e6b,null));};exports[_0xd262('0x32')]=function(_0x2085bd,_0x3159b1,_0xdb1649){var _0x49486e;return db[_0xd262('0x3a')][_0xd262('0x54')]({'where':{'id':_0x2085bd[_0xd262('0x53')]['id']}})[_0xd262('0x1a')](handleEntityNotFound(_0x3159b1,null))[_0xd262('0x1a')](removeEntity(_0x3159b1,null))[_0xd262('0x1a')](function(){return db[_0xd262('0x3a')]['findAll']({'raw':!![]});})[_0xd262('0x1a')](function(_0x2f5827){var _0x2d45e3=fs[_0xd262('0x57')](path[_0xd262('0x58')](config['root'],_0xd262('0x62')),_0xd262('0x59'));var _0x59897d=ejs[_0xd262('0x5a')](_0x2d45e3,{'contexts':_0x2f5827});fs[_0xd262('0x5b')](_0xd262('0x5c'),_0x59897d);return respondWithRpcPromise(_0xd262('0x63'),_0xd262('0x32'),{'module':_0xd262('0x5d')});})['catch'](handleError(_0x3159b1,null));}; \ No newline at end of file +var _0x7d81=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','destroy','UserProfileResource','stack','name','index','VoiceContext','rawAttributes','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','limit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','count','includeAll','include','findAll','catch','show','params','length','find','create','body','join','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','writeFileSync','chan_sip.so','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x9bca53,_0x59b4f8){var _0x3894bc=function(_0x1ae67d){while(--_0x1ae67d){_0x9bca53['push'](_0x9bca53['shift']());}};_0x3894bc(++_0x59b4f8);}(_0x7d81,0xcc));var _0x17d8=function(_0x355ccf,_0x4bf57f){_0x355ccf=_0x355ccf-0x0;var _0x3a4ed3=_0x7d81[_0x355ccf];return _0x3a4ed3;};'use strict';var pdf=require(_0x17d8('0x0'));var emlformat=require(_0x17d8('0x1'));var rimraf=require(_0x17d8('0x2'));var zipdir=require(_0x17d8('0x3'));var jsonpatch=require(_0x17d8('0x4'));var rp=require(_0x17d8('0x5'));var moment=require(_0x17d8('0x6'));var BPromise=require(_0x17d8('0x7'));var Mustache=require(_0x17d8('0x8'));var util=require(_0x17d8('0x9'));var path=require(_0x17d8('0xa'));var sox=require(_0x17d8('0xb'));var csv=require(_0x17d8('0xc'));var ejs=require(_0x17d8('0xd'));var fs=require('fs');var _=require(_0x17d8('0xe'));var squel=require(_0x17d8('0xf'));var crypto=require(_0x17d8('0x10'));var jsforce=require(_0x17d8('0x11'));var deskjs=require(_0x17d8('0x12'));var toCsv=require(_0x17d8('0xc'));var querystring=require(_0x17d8('0x13'));var Papa=require('papaparse');var authService=require(_0x17d8('0x14'));var hardwareService=require(_0x17d8('0x15'));var Redis=require(_0x17d8('0x16'));var qs=require(_0x17d8('0x17'));var logger=require('../../config/logger')(_0x17d8('0x18'));var utils=require(_0x17d8('0x19'));var config=require(_0x17d8('0x1a'));var db=require(_0x17d8('0x1b'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x17d8('0x1c')][_0x17d8('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x35d411,_0x1b47ba,_0x1ae5d6,_0x355fb4){return new BPromise(function(_0x189b2f,_0x577b8a){var _0x59a1e9=_0x355fb4||client;return _0x59a1e9[_0x17d8('0x1e')](_0x35d411,_0x1ae5d6)[_0x17d8('0x1f')](function(_0x92e960){logger[_0x17d8('0x20')](_0x17d8('0x21'),_0x1b47ba,_0x17d8('0x22'));logger['debug'](_0x17d8('0x23'),_0x1b47ba,'request\x20sent',JSON[_0x17d8('0x24')](_0x92e960));if(_0x92e960[_0x17d8('0x25')]){if(_0x92e960[_0x17d8('0x25')][_0x17d8('0x26')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x1b47ba,_0x92e960[_0x17d8('0x25')][_0x17d8('0x27')]);return _0x577b8a(_0x92e960['error'][_0x17d8('0x27')]);}logger['error'](_0x17d8('0x21'),_0x1b47ba,_0x92e960[_0x17d8('0x25')]['message']);return _0x189b2f(_0x92e960[_0x17d8('0x25')][_0x17d8('0x27')]);}else{logger[_0x17d8('0x20')](_0x17d8('0x21'),_0x1b47ba,_0x17d8('0x22'));_0x189b2f(_0x92e960[_0x17d8('0x28')]['message']);}})['catch'](function(_0x31cb0d){logger[_0x17d8('0x25')]('VoiceContext,\x20%s,\x20%s',_0x1b47ba,_0x31cb0d);_0x577b8a(_0x31cb0d);});});}function respondWithStatusCode(_0x29ae71,_0x1eaf90){_0x1eaf90=_0x1eaf90||0xcc;return function(_0x591e78){if(_0x591e78){return _0x29ae71[_0x17d8('0x29')](_0x1eaf90);}return _0x29ae71[_0x17d8('0x2a')](_0x1eaf90)[_0x17d8('0x2b')]();};}function respondWithResult(_0xa8d7e4,_0x48e6e2){_0x48e6e2=_0x48e6e2||0xc8;return function(_0x172415){if(_0x172415){return _0xa8d7e4[_0x17d8('0x2a')](_0x48e6e2)[_0x17d8('0x2c')](_0x172415);}};}function respondWithFilteredResult(_0x2f938b,_0x5d6a68){return function(_0x40445f){if(_0x40445f){var _0x413651=_0x40445f['count'],_0x20b1c6=_0x5d6a68[_0x17d8('0x2d')],_0x275ca6=_0x5d6a68['offset']+_0x5d6a68['limit'],_0x3dc70e;if(_0x275ca6>=_0x413651){_0x275ca6=_0x413651;_0x3dc70e=0xc8;}else{_0x3dc70e=0xce;}_0x2f938b[_0x17d8('0x2a')](_0x3dc70e);return _0x2f938b[_0x17d8('0x2e')](_0x17d8('0x2f'),_0x20b1c6+'-'+_0x275ca6+'/'+_0x413651)[_0x17d8('0x2c')](_0x40445f);}return null;};}function patchUpdates(_0x530d81){return function(_0x2d3ce0){try{jsonpatch[_0x17d8('0x30')](_0x2d3ce0,_0x530d81,!![]);}catch(_0x4c910e){return BPromise[_0x17d8('0x31')](_0x4c910e);}return _0x2d3ce0[_0x17d8('0x32')]();};}function saveUpdates(_0x43cd0c,_0x4b6bd3){return function(_0x1315f1){if(_0x1315f1){return _0x1315f1[_0x17d8('0x33')](_0x43cd0c)[_0x17d8('0x1f')](function(_0x40c48c){return _0x40c48c;});}return null;};}function removeEntity(_0x58ebdf,_0x1b1ad6){return function(_0x1e1022){if(_0x1e1022){return _0x1e1022[_0x17d8('0x34')]()['then'](function(){var _0x4a1d79=_0x1e1022['get']({'plain':!![]});var _0x53eda3='Contexts';return db[_0x17d8('0x35')][_0x17d8('0x34')]({'where':{'type':_0x53eda3,'resourceId':_0x4a1d79['id']}})[_0x17d8('0x1f')](function(){return _0x1e1022;});})[_0x17d8('0x1f')](function(){_0x58ebdf['status'](0xcc)[_0x17d8('0x2b')]();});}};}function handleEntityNotFound(_0x31f8e6,_0x36b822){return function(_0x3466f5){if(!_0x3466f5){_0x31f8e6['sendStatus'](0x194);}return _0x3466f5;};}function handleError(_0x4be6f2,_0x1b2bab){_0x1b2bab=_0x1b2bab||0x1f4;return function(_0x4aeace){logger[_0x17d8('0x25')](_0x4aeace[_0x17d8('0x36')]);if(_0x4aeace[_0x17d8('0x37')]){delete _0x4aeace[_0x17d8('0x37')];}_0x4be6f2['status'](_0x1b2bab)['send'](_0x4aeace);};}exports[_0x17d8('0x38')]=function(_0x537679,_0x11eb6d){var _0x324ee5={},_0x53f9a5={},_0x23b773={'count':0x0,'rows':[]};var _0x347a33=db[_0x17d8('0x39')][_0x17d8('0x3a')];_0x53f9a5[_0x17d8('0x3b')]=_[_0x17d8('0x3c')](_0x347a33);_0x53f9a5[_0x17d8('0x3d')]=_[_0x17d8('0x3c')](_0x537679[_0x17d8('0x3d')]);_0x53f9a5[_0x17d8('0x3e')]=_['intersection'](_0x53f9a5[_0x17d8('0x3b')],_0x53f9a5[_0x17d8('0x3d')]);_0x324ee5['attributes']=_[_0x17d8('0x3f')](_0x53f9a5[_0x17d8('0x3b')],qs[_0x17d8('0x40')](_0x537679[_0x17d8('0x3d')][_0x17d8('0x40')]));_0x324ee5[_0x17d8('0x41')]=_0x324ee5['attributes']['length']?_0x324ee5[_0x17d8('0x41')]:_0x53f9a5['model'];if(!_0x537679[_0x17d8('0x3d')][_0x17d8('0x42')]('nolimit')){_0x324ee5['limit']=qs[_0x17d8('0x43')](_0x537679[_0x17d8('0x3d')][_0x17d8('0x43')]);_0x324ee5[_0x17d8('0x2d')]=qs['offset'](_0x537679[_0x17d8('0x3d')]['offset']);}_0x324ee5[_0x17d8('0x44')]=qs[_0x17d8('0x45')](_0x537679[_0x17d8('0x3d')][_0x17d8('0x45')]);_0x324ee5[_0x17d8('0x46')]=qs[_0x17d8('0x3e')](_[_0x17d8('0x47')](_0x537679[_0x17d8('0x3d')],_0x53f9a5[_0x17d8('0x3e')]));if(_0x537679[_0x17d8('0x3d')][_0x17d8('0x48')]){_0x324ee5['where']=_[_0x17d8('0x49')](_0x324ee5['where'],{'$or':_[_0x17d8('0x4a')](_0x347a33,function(_0x511b71){if(_0x511b71[_0x17d8('0x4b')][_0x17d8('0x4c')]!==_0x17d8('0x4d')){var _0xa9fef3={};_0xa9fef3[_0x511b71[_0x17d8('0x4e')]]={'$like':'%'+_0x537679['query'][_0x17d8('0x48')]+'%'};return _0xa9fef3;}})});}_0x324ee5=_['merge']({},_0x324ee5,_0x537679[_0x17d8('0x4f')]);var _0x162ad3={'where':_0x324ee5[_0x17d8('0x46')]};return db[_0x17d8('0x39')][_0x17d8('0x50')](_0x162ad3)['then'](function(_0x517d3d){_0x23b773[_0x17d8('0x50')]=_0x517d3d;if(_0x537679[_0x17d8('0x3d')][_0x17d8('0x51')]){_0x324ee5[_0x17d8('0x52')]=[{'all':!![]}];}return db[_0x17d8('0x39')][_0x17d8('0x53')](_0x324ee5);})[_0x17d8('0x1f')](function(_0x5e1d44){_0x23b773['rows']=_0x5e1d44;return _0x23b773;})[_0x17d8('0x1f')](respondWithFilteredResult(_0x11eb6d,_0x324ee5))[_0x17d8('0x54')](handleError(_0x11eb6d,null));};exports[_0x17d8('0x55')]=function(_0xbe4505,_0x438d61){var _0x54d370={'raw':![],'where':{'id':_0xbe4505[_0x17d8('0x56')]['id']}},_0x1fb99a={};_0x1fb99a[_0x17d8('0x3b')]=_[_0x17d8('0x3c')](db['VoiceContext'][_0x17d8('0x3a')]);_0x1fb99a[_0x17d8('0x3d')]=_[_0x17d8('0x3c')](_0xbe4505[_0x17d8('0x3d')]);_0x1fb99a[_0x17d8('0x3e')]=_['intersection'](_0x1fb99a[_0x17d8('0x3b')],_0x1fb99a['query']);_0x54d370['attributes']=_[_0x17d8('0x3f')](_0x1fb99a[_0x17d8('0x3b')],qs['fields'](_0xbe4505[_0x17d8('0x3d')][_0x17d8('0x40')]));_0x54d370[_0x17d8('0x41')]=_0x54d370['attributes'][_0x17d8('0x57')]?_0x54d370[_0x17d8('0x41')]:_0x1fb99a[_0x17d8('0x3b')];if(_0xbe4505[_0x17d8('0x3d')][_0x17d8('0x51')]){_0x54d370[_0x17d8('0x52')]=[{'all':!![]}];}_0x54d370=_[_0x17d8('0x49')]({},_0x54d370,_0xbe4505[_0x17d8('0x4f')]);return db['VoiceContext'][_0x17d8('0x58')](_0x54d370)[_0x17d8('0x1f')](handleEntityNotFound(_0x438d61,null))[_0x17d8('0x1f')](respondWithResult(_0x438d61,null))[_0x17d8('0x54')](handleError(_0x438d61,null));};exports['create']=function(_0xa38f68,_0xfff994,_0x41e7cb){var _0x3063bd;return db[_0x17d8('0x39')][_0x17d8('0x59')](_0xa38f68[_0x17d8('0x5a')],{'raw':!![]})['then'](function(_0x27205e){_0x3063bd=_0x27205e;return db[_0x17d8('0x39')][_0x17d8('0x53')]({'raw':!![]});})[_0x17d8('0x1f')](function(_0x3ca46a){var _0x385906=fs['readFileSync'](path[_0x17d8('0x5b')](config[_0x17d8('0x5c')],_0x17d8('0x5d')),_0x17d8('0x5e'));var _0x458906=ejs[_0x17d8('0x5f')](_0x385906,{'contexts':_0x3ca46a||[]});fs['writeFileSync'](_0x17d8('0x60'),_0x458906);})[_0x17d8('0x1f')](function(){return respondWithRpcPromise(_0x17d8('0x61'),_0x17d8('0x59'),{'module':'chan_sip.so'});})[_0x17d8('0x1f')](function(){var _0x4871b1=_0xa38f68[_0x17d8('0x62')][_0x17d8('0x63')]({'plain':!![]});if(!_0x4871b1)throw new Error(_0x17d8('0x64'));if(_0x4871b1[_0x17d8('0x65')]===_0x17d8('0x62')){var _0x19d8bd=_0x3063bd[_0x17d8('0x63')]({'plain':!![]});return db[_0x17d8('0x66')]['find']({'where':{'name':'Contexts','userProfileId':_0x4871b1['userProfileId']},'raw':!![]})[_0x17d8('0x1f')](function(_0x967b87){if(_0x967b87&&_0x967b87[_0x17d8('0x67')]===0x0){return db[_0x17d8('0x35')]['create']({'name':_0x19d8bd['name'],'resourceId':_0x19d8bd['id'],'type':_0x967b87['name'],'sectionId':_0x967b87['id']},{})['then'](function(){return _0x3063bd;});}else{return _0x3063bd;}})[_0x17d8('0x54')](function(_0x4bce32){logger['error'](_0x17d8('0x68'),_0x4bce32);throw _0x4bce32;});}return _0x3063bd;})[_0x17d8('0x1f')](respondWithResult(_0xfff994,0xc9))[_0x17d8('0x54')](handleError(_0xfff994,null));};exports[_0x17d8('0x33')]=function(_0x3a3027,_0x3ee196,_0x276634){var _0x2c9215;return db[_0x17d8('0x39')][_0x17d8('0x58')]({'where':{'id':_0x3a3027[_0x17d8('0x56')]['id']}})['then'](handleEntityNotFound(_0x3ee196,null))[_0x17d8('0x1f')](saveUpdates(_0x3a3027['body'],null))['then'](function(_0xa66948){if(_0xa66948){_0x2c9215=_0xa66948;return db['VoiceContext'][_0x17d8('0x53')]({'raw':!![]});}})[_0x17d8('0x1f')](function(_0x1c2e50){var _0x35e3fd=fs['readFileSync'](path[_0x17d8('0x5b')](config[_0x17d8('0x5c')],_0x17d8('0x5d')),_0x17d8('0x5e'));var _0x499cc3=ejs[_0x17d8('0x5f')](_0x35e3fd,{'contexts':_0x1c2e50||[]});fs[_0x17d8('0x69')](_0x17d8('0x60'),_0x499cc3);})[_0x17d8('0x1f')](function(){return respondWithRpcPromise('Reload',_0x17d8('0x33'),{'module':_0x17d8('0x6a')});})[_0x17d8('0x1f')](function(){return _0x2c9215;})[_0x17d8('0x1f')](respondWithResult(_0x3ee196,null))[_0x17d8('0x54')](handleError(_0x3ee196,null));};exports[_0x17d8('0x34')]=function(_0x5f5889,_0xf419b9,_0x41d094){var _0x224b41;return db[_0x17d8('0x39')]['find']({'where':{'id':_0x5f5889[_0x17d8('0x56')]['id']}})[_0x17d8('0x1f')](handleEntityNotFound(_0xf419b9,null))[_0x17d8('0x1f')](removeEntity(_0xf419b9,null))['then'](function(){return db[_0x17d8('0x39')][_0x17d8('0x53')]({'raw':!![]});})[_0x17d8('0x1f')](function(_0x4e3e55){var _0x217541=fs['readFileSync'](path['join'](config[_0x17d8('0x5c')],_0x17d8('0x5d')),_0x17d8('0x5e'));var _0x1d903d=ejs['render'](_0x217541,{'contexts':_0x4e3e55});fs[_0x17d8('0x69')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x1d903d);return respondWithRpcPromise(_0x17d8('0x61'),_0x17d8('0x34'),{'module':'chan_sip.so'});})[_0x17d8('0x54')](handleError(_0xf419b9,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 8b96fdc..1c3756b 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 _0xa855=['voice_contexts','lodash','util','api','request-promise','./voiceContext.attributes','exports','define'];(function(_0x667081,_0x1d02b8){var _0x1c1e88=function(_0x4231c2){while(--_0x4231c2){_0x667081['push'](_0x667081['shift']());}};_0x1c1e88(++_0x1d02b8);}(_0xa855,0xc9));var _0x5a85=function(_0x9516c6,_0x217446){_0x9516c6=_0x9516c6-0x0;var _0x5a9a4d=_0xa855[_0x9516c6];return _0x5a9a4d;};'use strict';var _=require(_0x5a85('0x0'));var util=require(_0x5a85('0x1'));var logger=require('../../config/logger')(_0x5a85('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5a85('0x3'));var attributes=require(_0x5a85('0x4'));module[_0x5a85('0x5')]=function(_0x3f78da,_0x4407ea){return _0x3f78da[_0x5a85('0x6')]('VoiceContext',attributes,{'tableName':_0x5a85('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x489c=['request-promise','./voiceContext.attributes','exports','voice_contexts','util','api','moment','bluebird'];(function(_0x46d72b,_0x5b4918){var _0x1eac63=function(_0x2bedf5){while(--_0x2bedf5){_0x46d72b['push'](_0x46d72b['shift']());}};_0x1eac63(++_0x5b4918);}(_0x489c,0x18c));var _0xc489=function(_0x4fc096,_0x405977){_0x4fc096=_0x4fc096-0x0;var _0xeaa802=_0x489c[_0x4fc096];return _0xeaa802;};'use strict';var _=require('lodash');var util=require(_0xc489('0x0'));var logger=require('../../config/logger')(_0xc489('0x1'));var moment=require(_0xc489('0x2'));var BPromise=require(_0xc489('0x3'));var rp=require(_0xc489('0x4'));var attributes=require(_0xc489('0x5'));module[_0xc489('0x6')]=function(_0x3a0c6c,_0x215f23){return _0x3a0c6c['define']('VoiceContext',attributes,{'tableName':_0xc489('0x7'),'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 5cd126e..17d1ca3 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 _0xff22=['../../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','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x4df7dc,_0x30d040){var _0xbbc3d1=function(_0x3eb794){while(--_0x3eb794){_0x4df7dc['push'](_0x4df7dc['shift']());}};_0xbbc3d1(++_0x30d040);}(_0xff22,0x149));var _0x2ff2=function(_0x43547f,_0x3bcdf5){_0x43547f=_0x43547f-0x0;var _0x926d88=_0xff22[_0x43547f];return _0x926d88;};'use strict';var _=require(_0x2ff2('0x0'));var util=require(_0x2ff2('0x1'));var moment=require(_0x2ff2('0x2'));var BPromise=require(_0x2ff2('0x3'));var rs=require(_0x2ff2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ff2('0x5'))['db'];var utils=require(_0x2ff2('0x6'));var logger=require(_0x2ff2('0x7'))(_0x2ff2('0x8'));var config=require(_0x2ff2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2ff2('0xa')][_0x2ff2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x228441,_0x1cb8bb,_0x431ba8){return new BPromise(function(_0x5984ec,_0x46c4d9){return client[_0x2ff2('0xc')](_0x228441,_0x431ba8)[_0x2ff2('0xd')](function(_0x33e7bb){logger[_0x2ff2('0xe')](_0x2ff2('0xf'),_0x1cb8bb,_0x2ff2('0x10'));logger[_0x2ff2('0x11')](_0x2ff2('0x12'),_0x1cb8bb,_0x2ff2('0x10'),JSON[_0x2ff2('0x13')](_0x33e7bb));if(_0x33e7bb[_0x2ff2('0x14')]){if(_0x33e7bb[_0x2ff2('0x14')][_0x2ff2('0x15')]===0x1f4){logger[_0x2ff2('0x14')](_0x2ff2('0xf'),_0x1cb8bb,_0x33e7bb['error'][_0x2ff2('0x16')]);return _0x46c4d9(_0x33e7bb[_0x2ff2('0x14')]['message']);}logger[_0x2ff2('0x14')]('VoiceContext,\x20%s,\x20%s',_0x1cb8bb,_0x33e7bb['error'][_0x2ff2('0x16')]);return _0x5984ec(_0x33e7bb[_0x2ff2('0x14')][_0x2ff2('0x16')]);}else{logger[_0x2ff2('0xe')]('VoiceContext,\x20%s,\x20%s',_0x1cb8bb,_0x2ff2('0x10'));_0x5984ec(_0x33e7bb[_0x2ff2('0x17')][_0x2ff2('0x16')]);}})['catch'](function(_0xdf1f8c){logger[_0x2ff2('0x14')](_0x2ff2('0xf'),_0x1cb8bb,_0xdf1f8c);_0x46c4d9(_0xdf1f8c);});});} \ No newline at end of file +var _0x57bf=['message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x2e41e2,_0x4e7250){var _0x2844d6=function(_0x28ce24){while(--_0x28ce24){_0x2e41e2['push'](_0x2e41e2['shift']());}};_0x2844d6(++_0x4e7250);}(_0x57bf,0xc9));var _0xf57b=function(_0x558f99,_0x49b477){_0x558f99=_0x558f99-0x0;var _0x5eb09e=_0x57bf[_0x558f99];return _0x5eb09e;};'use strict';var _=require(_0xf57b('0x0'));var util=require('util');var moment=require(_0xf57b('0x1'));var BPromise=require(_0xf57b('0x2'));var rs=require(_0xf57b('0x3'));var fs=require('fs');var Redis=require(_0xf57b('0x4'));var db=require(_0xf57b('0x5'))['db'];var utils=require(_0xf57b('0x6'));var logger=require(_0xf57b('0x7'))('rpc');var config=require(_0xf57b('0x8'));var jayson=require(_0xf57b('0x9'));var client=jayson['client'][_0xf57b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc3ab12,_0x5363f3,_0x4af92e){return new BPromise(function(_0x58d9d8,_0x4a7f04){return client[_0xf57b('0xb')](_0xc3ab12,_0x4af92e)['then'](function(_0xa4e42e){logger[_0xf57b('0xc')](_0xf57b('0xd'),_0x5363f3,_0xf57b('0xe'));logger[_0xf57b('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x5363f3,_0xf57b('0xe'),JSON[_0xf57b('0x10')](_0xa4e42e));if(_0xa4e42e[_0xf57b('0x11')]){if(_0xa4e42e[_0xf57b('0x11')][_0xf57b('0x12')]===0x1f4){logger[_0xf57b('0x11')]('VoiceContext,\x20%s,\x20%s',_0x5363f3,_0xa4e42e[_0xf57b('0x11')][_0xf57b('0x13')]);return _0x4a7f04(_0xa4e42e[_0xf57b('0x11')][_0xf57b('0x13')]);}logger[_0xf57b('0x11')]('VoiceContext,\x20%s,\x20%s',_0x5363f3,_0xa4e42e['error'][_0xf57b('0x13')]);return _0x58d9d8(_0xa4e42e[_0xf57b('0x11')]['message']);}else{logger[_0xf57b('0xc')]('VoiceContext,\x20%s,\x20%s',_0x5363f3,_0xf57b('0xe'));_0x58d9d8(_0xa4e42e['result'][_0xf57b('0x13')]);}})['catch'](function(_0x380b68){logger[_0xf57b('0x11')](_0xf57b('0xd'),_0x5363f3,_0x380b68);_0x4a7f04(_0x380b68);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index e80fe5f..7bcef60 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 _0x74d2=['exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete'];(function(_0xafe711,_0x21ef56){var _0x1a89a2=function(_0x318c84){while(--_0x318c84){_0xafe711['push'](_0xafe711['shift']());}};_0x1a89a2(++_0x21ef56);}(_0x74d2,0x1e1));var _0x274d=function(_0x485201,_0x3c533a){_0x485201=_0x485201-0x0;var _0x9ca98a=_0x74d2[_0x485201];return _0x9ca98a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x274d('0x0'));var timeout=require(_0x274d('0x1'));var express=require(_0x274d('0x2'));var router=express['Router']();var auth=require(_0x274d('0x3'));var interaction=require(_0x274d('0x4'));var config=require(_0x274d('0x5'));var controller=require(_0x274d('0x6'));router[_0x274d('0x7')]('/',auth['isAuthenticated'](),controller[_0x274d('0x8')]);router[_0x274d('0x7')](_0x274d('0x9'),auth[_0x274d('0xa')](),controller[_0x274d('0xb')]);router[_0x274d('0x7')](_0x274d('0xc'),auth[_0x274d('0xa')](),controller[_0x274d('0xd')]);router[_0x274d('0xe')]('/',auth[_0x274d('0xa')](),controller[_0x274d('0xf')]);router[_0x274d('0x10')](_0x274d('0xc'),auth['isAuthenticated'](),controller[_0x274d('0x11')]);router[_0x274d('0x12')](_0x274d('0xc'),auth[_0x274d('0xa')](),controller['destroy']);module[_0x274d('0x13')]=router; \ No newline at end of file +var _0x4081=['../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','describe','get','show','post','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x418310,_0x5af7a3){var _0x45d63b=function(_0x40d6bf){while(--_0x40d6bf){_0x418310['push'](_0x418310['shift']());}};_0x45d63b(++_0x5af7a3);}(_0x4081,0x1b1));var _0x1408=function(_0x5693fd,_0x2f9c95){_0x5693fd=_0x5693fd-0x0;var _0x1fdfc5=_0x4081[_0x5693fd];return _0x1fdfc5;};'use strict';var multer=require(_0x1408('0x0'));var util=require(_0x1408('0x1'));var path=require(_0x1408('0x2'));var timeout=require(_0x1408('0x3'));var express=require(_0x1408('0x4'));var router=express[_0x1408('0x5')]();var auth=require(_0x1408('0x6'));var interaction=require(_0x1408('0x7'));var config=require(_0x1408('0x8'));var controller=require(_0x1408('0x9'));router['get']('/',auth[_0x1408('0xa')](),controller[_0x1408('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x1408('0xc')]);router[_0x1408('0xd')]('/:id',auth[_0x1408('0xa')](),controller[_0x1408('0xe')]);router[_0x1408('0xf')]('/',auth[_0x1408('0xa')](),controller[_0x1408('0x10')]);router[_0x1408('0x11')]('/:id',auth[_0x1408('0xa')](),controller[_0x1408('0x12')]);router[_0x1408('0x13')](_0x1408('0x14'),auth[_0x1408('0xa')](),controller['destroy']);module[_0x1408('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index f3b5562..7c02f45 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 _0xe384=['sequelize','STRING','INTEGER','DATE'];(function(_0x14d896,_0x53578b){var _0x28679a=function(_0x14921f){while(--_0x14921f){_0x14d896['push'](_0x14d896['shift']());}};_0x28679a(++_0x53578b);}(_0xe384,0x160));var _0x4e38=function(_0x335be0,_0x27550d){_0x335be0=_0x335be0-0x0;var _0x32c20a=_0xe384[_0x335be0];return _0x32c20a;};'use strict';var Sequelize=require(_0x4e38('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x4e38('0x1')]},'channel':{'type':Sequelize[_0x4e38('0x1')]},'channelstate':{'type':Sequelize[_0x4e38('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4e38('0x1')]},'connectedlinenum':{'type':Sequelize[_0x4e38('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4e38('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x4e38('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x4e38('0x1')]},'destchannelstate':{'type':Sequelize[_0x4e38('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x4e38('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x4e38('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x4e38('0x1')]},'destaccountcode':{'type':Sequelize[_0x4e38('0x1')]},'destcontext':{'type':Sequelize[_0x4e38('0x1')]},'destexten':{'type':Sequelize[_0x4e38('0x1')]},'destpriority':{'type':Sequelize[_0x4e38('0x2')]},'destuniqueid':{'type':Sequelize[_0x4e38('0x1')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x4e38('0x1')]},'dialstatus':{'type':Sequelize[_0x4e38('0x1')]},'starttime':{'type':Sequelize[_0x4e38('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x4e38('0x3')]},'lastevent':{'type':Sequelize[_0x4e38('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x4e38('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x4e38('0x2')]}}; \ No newline at end of file +var _0x4f4f=['INTEGER','DATE','sequelize','STRING'];(function(_0x5b671c,_0x112901){var _0x2284a0=function(_0x4287b9){while(--_0x4287b9){_0x5b671c['push'](_0x5b671c['shift']());}};_0x2284a0(++_0x112901);}(_0x4f4f,0x1ca));var _0xf4f4=function(_0x4f487c,_0x312d09){_0x4f487c=_0x4f487c-0x0;var _0x5c4f31=_0x4f4f[_0x4f487c];return _0x5c4f31;};'use strict';var Sequelize=require(_0xf4f4('0x0'));module['exports']={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf4f4('0x1')]},'channelstate':{'type':Sequelize[_0xf4f4('0x2')]},'channelstatedesc':{'type':Sequelize[_0xf4f4('0x1')]},'calleridnum':{'type':Sequelize[_0xf4f4('0x1')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xf4f4('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf4f4('0x1')]},'accountcode':{'type':Sequelize[_0xf4f4('0x1')]},'context':{'type':Sequelize[_0xf4f4('0x1')]},'exten':{'type':Sequelize[_0xf4f4('0x1')]},'priority':{'type':Sequelize[_0xf4f4('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xf4f4('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xf4f4('0x1')]},'destcalleridname':{'type':Sequelize[_0xf4f4('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xf4f4('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xf4f4('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xf4f4('0x1')]},'destpriority':{'type':Sequelize[_0xf4f4('0x2')]},'destuniqueid':{'type':Sequelize[_0xf4f4('0x1')]},'destlinkedid':{'type':Sequelize[_0xf4f4('0x1')]},'dialstring':{'type':Sequelize[_0xf4f4('0x1')]},'dialstatus':{'type':Sequelize[_0xf4f4('0x1')]},'starttime':{'type':Sequelize[_0xf4f4('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf4f4('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xf4f4('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xf4f4('0x2')]},'billableseconds':{'type':Sequelize[_0xf4f4('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index b9f6624..2b3a2c1 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 _0xfe8b=['rows','catch','show','fields','include','options','find','create','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','map','key','VIRTUAL','field','filter','merge','VoiceDialReport','count','includeAll','findAll'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xfe8b,0xab));var _0xbfe8=function(_0x4da196,_0x357dc9){_0x4da196=_0x4da196-0x0;var _0x375df3=_0xfe8b[_0x4da196];return _0x375df3;};'use strict';var pdf=require(_0xbfe8('0x0'));var emlformat=require(_0xbfe8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbfe8('0x2'));var jsonpatch=require(_0xbfe8('0x3'));var rp=require('request-promise');var moment=require(_0xbfe8('0x4'));var BPromise=require(_0xbfe8('0x5'));var Mustache=require(_0xbfe8('0x6'));var util=require('util');var path=require(_0xbfe8('0x7'));var sox=require(_0xbfe8('0x8'));var csv=require('to-csv');var ejs=require(_0xbfe8('0x9'));var fs=require('fs');var _=require(_0xbfe8('0xa'));var squel=require(_0xbfe8('0xb'));var crypto=require(_0xbfe8('0xc'));var jsforce=require(_0xbfe8('0xd'));var deskjs=require(_0xbfe8('0xe'));var toCsv=require(_0xbfe8('0xf'));var querystring=require(_0xbfe8('0x10'));var Papa=require(_0xbfe8('0x11'));var authService=require(_0xbfe8('0x12'));var hardwareService=require(_0xbfe8('0x13'));var Redis=require(_0xbfe8('0x14'));var qs=require(_0xbfe8('0x15'));var logger=require(_0xbfe8('0x16'))(_0xbfe8('0x17'));var utils=require(_0xbfe8('0x18'));var config=require(_0xbfe8('0x19'));var db=require(_0xbfe8('0x1a'))['db'];function respondWithStatusCode(_0xea6dcc,_0x2c18a5){_0x2c18a5=_0x2c18a5||0xcc;return function(_0x2b675d){if(_0x2b675d){return _0xea6dcc[_0xbfe8('0x1b')](_0x2c18a5);}return _0xea6dcc[_0xbfe8('0x1c')](_0x2c18a5)[_0xbfe8('0x1d')]();};}function respondWithResult(_0x3d2e4b,_0x2243dc){_0x2243dc=_0x2243dc||0xc8;return function(_0x131a08){if(_0x131a08){return _0x3d2e4b[_0xbfe8('0x1c')](_0x2243dc)[_0xbfe8('0x1e')](_0x131a08);}};}function respondWithFilteredResult(_0xa9fd20,_0xe8714){return function(_0x38c2dd){if(_0x38c2dd){var _0x1546d7=_0x38c2dd['count'],_0x1d4f5=_0xe8714[_0xbfe8('0x1f')],_0x5786d9=_0xe8714[_0xbfe8('0x1f')]+_0xe8714[_0xbfe8('0x20')],_0x49537e;if(_0x5786d9>=_0x1546d7){_0x5786d9=_0x1546d7;_0x49537e=0xc8;}else{_0x49537e=0xce;}_0xa9fd20[_0xbfe8('0x1c')](_0x49537e);return _0xa9fd20[_0xbfe8('0x21')](_0xbfe8('0x22'),_0x1d4f5+'-'+_0x5786d9+'/'+_0x1546d7)[_0xbfe8('0x1e')](_0x38c2dd);}return null;};}function patchUpdates(_0x5a4c04){return function(_0x57bfd6){try{jsonpatch[_0xbfe8('0x23')](_0x57bfd6,_0x5a4c04,!![]);}catch(_0x35fead){return BPromise[_0xbfe8('0x24')](_0x35fead);}return _0x57bfd6[_0xbfe8('0x25')]();};}function saveUpdates(_0x41321f,_0x492b37){return function(_0x53c7cd){if(_0x53c7cd){return _0x53c7cd[_0xbfe8('0x26')](_0x41321f)[_0xbfe8('0x27')](function(_0x10fc0a){return _0x10fc0a;});}return null;};}function removeEntity(_0xf4fabf,_0x1fe317){return function(_0x5d0d63){if(_0x5d0d63){return _0x5d0d63[_0xbfe8('0x28')]()[_0xbfe8('0x27')](function(){_0xf4fabf[_0xbfe8('0x1c')](0xcc)[_0xbfe8('0x1d')]();});}};}function handleEntityNotFound(_0x2774d3,_0x1739be){return function(_0x44f7c0){if(!_0x44f7c0){_0x2774d3[_0xbfe8('0x1b')](0x194);}return _0x44f7c0;};}function handleError(_0x4f0421,_0x29d34e){_0x29d34e=_0x29d34e||0x1f4;return function(_0x93f0c7){logger[_0xbfe8('0x29')](_0x93f0c7[_0xbfe8('0x2a')]);if(_0x93f0c7[_0xbfe8('0x2b')]){delete _0x93f0c7[_0xbfe8('0x2b')];}_0x4f0421['status'](_0x29d34e)[_0xbfe8('0x2c')](_0x93f0c7);};}exports[_0xbfe8('0x2d')]=function(_0x33c2da,_0x1a709a){var _0x10bf71={},_0x236f29={},_0x4876d2={'count':0x0,'rows':[]};var _0x826b5e=db['VoiceDialReport'][_0xbfe8('0x2e')];_0x236f29[_0xbfe8('0x2f')]=_[_0xbfe8('0x30')](_0x826b5e);_0x236f29[_0xbfe8('0x31')]=_[_0xbfe8('0x30')](_0x33c2da[_0xbfe8('0x31')]);_0x236f29[_0xbfe8('0x32')]=_[_0xbfe8('0x33')](_0x236f29[_0xbfe8('0x2f')],_0x236f29['query']);_0x10bf71[_0xbfe8('0x34')]=_[_0xbfe8('0x33')](_0x236f29[_0xbfe8('0x2f')],qs['fields'](_0x33c2da[_0xbfe8('0x31')]['fields']));_0x10bf71[_0xbfe8('0x34')]=_0x10bf71[_0xbfe8('0x34')][_0xbfe8('0x35')]?_0x10bf71['attributes']:_0x236f29[_0xbfe8('0x2f')];if(!_0x33c2da[_0xbfe8('0x31')][_0xbfe8('0x36')](_0xbfe8('0x37'))){_0x10bf71[_0xbfe8('0x20')]=qs[_0xbfe8('0x20')](_0x33c2da[_0xbfe8('0x31')][_0xbfe8('0x20')]);_0x10bf71[_0xbfe8('0x1f')]=qs[_0xbfe8('0x1f')](_0x33c2da[_0xbfe8('0x31')]['offset']);}_0x10bf71[_0xbfe8('0x38')]=qs['sort'](_0x33c2da[_0xbfe8('0x31')][_0xbfe8('0x39')]);_0x10bf71['where']=qs[_0xbfe8('0x32')](_['pick'](_0x33c2da['query'],_0x236f29[_0xbfe8('0x32')]));if(_0x33c2da[_0xbfe8('0x31')]['filter']){_0x10bf71[_0xbfe8('0x3a')]=_['merge'](_0x10bf71[_0xbfe8('0x3a')],{'$or':_[_0xbfe8('0x3b')](_0x826b5e,function(_0x526f98){if(_0x526f98['type'][_0xbfe8('0x3c')]!==_0xbfe8('0x3d')){var _0x56eebf={};_0x56eebf[_0x526f98[_0xbfe8('0x3e')]]={'$like':'%'+_0x33c2da['query'][_0xbfe8('0x3f')]+'%'};return _0x56eebf;}})});}_0x10bf71=_[_0xbfe8('0x40')]({},_0x10bf71,_0x33c2da['options']);var _0x1a2d4f={'where':_0x10bf71[_0xbfe8('0x3a')]};return db[_0xbfe8('0x41')][_0xbfe8('0x42')](_0x1a2d4f)['then'](function(_0x6f274a){_0x4876d2['count']=_0x6f274a;if(_0x33c2da[_0xbfe8('0x31')][_0xbfe8('0x43')]){_0x10bf71['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0xbfe8('0x44')](_0x10bf71);})['then'](function(_0x71ba4a){_0x4876d2[_0xbfe8('0x45')]=_0x71ba4a;return _0x4876d2;})[_0xbfe8('0x27')](respondWithFilteredResult(_0x1a709a,_0x10bf71))[_0xbfe8('0x46')](handleError(_0x1a709a,null));};exports[_0xbfe8('0x47')]=function(_0x599ce9,_0x4db95c){var _0x10d52e={'raw':!![],'where':{'id':_0x599ce9['params']['id']}},_0x32f3fb={};_0x32f3fb['model']=_[_0xbfe8('0x30')](db[_0xbfe8('0x41')]['rawAttributes']);_0x32f3fb['query']=_['keys'](_0x599ce9[_0xbfe8('0x31')]);_0x32f3fb[_0xbfe8('0x32')]=_[_0xbfe8('0x33')](_0x32f3fb[_0xbfe8('0x2f')],_0x32f3fb[_0xbfe8('0x31')]);_0x10d52e[_0xbfe8('0x34')]=_['intersection'](_0x32f3fb[_0xbfe8('0x2f')],qs[_0xbfe8('0x48')](_0x599ce9[_0xbfe8('0x31')]['fields']));_0x10d52e[_0xbfe8('0x34')]=_0x10d52e[_0xbfe8('0x34')][_0xbfe8('0x35')]?_0x10d52e[_0xbfe8('0x34')]:_0x32f3fb['model'];if(_0x599ce9[_0xbfe8('0x31')][_0xbfe8('0x43')]){_0x10d52e[_0xbfe8('0x49')]=[{'all':!![]}];}_0x10d52e=_['merge']({},_0x10d52e,_0x599ce9[_0xbfe8('0x4a')]);return db[_0xbfe8('0x41')][_0xbfe8('0x4b')](_0x10d52e)[_0xbfe8('0x27')](handleEntityNotFound(_0x4db95c,null))[_0xbfe8('0x27')](respondWithResult(_0x4db95c,null))[_0xbfe8('0x46')](handleError(_0x4db95c,null));};exports[_0xbfe8('0x4c')]=function(_0x3423e3,_0x3be9d2){return db[_0xbfe8('0x41')]['create'](_0x3423e3['body'],{})[_0xbfe8('0x27')](respondWithResult(_0x3be9d2,0xc9))[_0xbfe8('0x46')](handleError(_0x3be9d2,null));};exports[_0xbfe8('0x26')]=function(_0x1049c6,_0x141ae3){if(_0x1049c6[_0xbfe8('0x4d')]['id']){delete _0x1049c6[_0xbfe8('0x4d')]['id'];}return db[_0xbfe8('0x41')]['find']({'where':{'id':_0x1049c6[_0xbfe8('0x4e')]['id']}})[_0xbfe8('0x27')](handleEntityNotFound(_0x141ae3,null))[_0xbfe8('0x27')](saveUpdates(_0x1049c6[_0xbfe8('0x4d')],null))[_0xbfe8('0x27')](respondWithResult(_0x141ae3,null))['catch'](handleError(_0x141ae3,null));};exports[_0xbfe8('0x28')]=function(_0x4b69d1,_0x320920){return db[_0xbfe8('0x41')][_0xbfe8('0x4b')]({'where':{'id':_0x4b69d1[_0xbfe8('0x4e')]['id']}})['then'](handleEntityNotFound(_0x320920,null))[_0xbfe8('0x27')](removeEntity(_0x320920,null))[_0xbfe8('0x46')](handleError(_0x320920,null));};exports['describe']=function(_0x46a737,_0x3e5f39){return db[_0xbfe8('0x41')][_0xbfe8('0x4f')]()['then'](respondWithResult(_0x3e5f39,null))[_0xbfe8('0x46')](handleError(_0x3e5f39,null));}; \ No newline at end of file +var _0x304a=['include','findAll','rows','catch','show','length','find','create','body','destroy','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','VoiceDialReport','rawAttributes','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','type','key','VIRTUAL','field','options','count','includeAll'];(function(_0x24eb2f,_0x361426){var _0x231c1b=function(_0x49cc7d){while(--_0x49cc7d){_0x24eb2f['push'](_0x24eb2f['shift']());}};_0x231c1b(++_0x361426);}(_0x304a,0x18d));var _0xa304=function(_0x47783e,_0x488668){_0x47783e=_0x47783e-0x0;var _0x55fcba=_0x304a[_0x47783e];return _0x55fcba;};'use strict';var pdf=require(_0xa304('0x0'));var emlformat=require(_0xa304('0x1'));var rimraf=require(_0xa304('0x2'));var zipdir=require(_0xa304('0x3'));var jsonpatch=require(_0xa304('0x4'));var rp=require(_0xa304('0x5'));var moment=require('moment');var BPromise=require(_0xa304('0x6'));var Mustache=require('mustache');var util=require(_0xa304('0x7'));var path=require('path');var sox=require(_0xa304('0x8'));var csv=require(_0xa304('0x9'));var ejs=require(_0xa304('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa304('0xb'));var crypto=require(_0xa304('0xc'));var jsforce=require(_0xa304('0xd'));var deskjs=require(_0xa304('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa304('0xf'));var Papa=require(_0xa304('0x10'));var authService=require(_0xa304('0x11'));var hardwareService=require(_0xa304('0x12'));var Redis=require(_0xa304('0x13'));var qs=require(_0xa304('0x14'));var logger=require(_0xa304('0x15'))(_0xa304('0x16'));var utils=require('../../config/utils');var config=require(_0xa304('0x17'));var db=require(_0xa304('0x18'))['db'];function respondWithStatusCode(_0x27adec,_0x4ebf9b){_0x4ebf9b=_0x4ebf9b||0xcc;return function(_0x43e91e){if(_0x43e91e){return _0x27adec[_0xa304('0x19')](_0x4ebf9b);}return _0x27adec[_0xa304('0x1a')](_0x4ebf9b)[_0xa304('0x1b')]();};}function respondWithResult(_0x1aa284,_0x4221e0){_0x4221e0=_0x4221e0||0xc8;return function(_0xa69e88){if(_0xa69e88){return _0x1aa284[_0xa304('0x1a')](_0x4221e0)[_0xa304('0x1c')](_0xa69e88);}};}function respondWithFilteredResult(_0x998220,_0x5ce668){return function(_0x47e655){if(_0x47e655){var _0x515443=_0x47e655['count'],_0x1ab38e=_0x5ce668[_0xa304('0x1d')],_0x49a9a8=_0x5ce668['offset']+_0x5ce668[_0xa304('0x1e')],_0xd63529;if(_0x49a9a8>=_0x515443){_0x49a9a8=_0x515443;_0xd63529=0xc8;}else{_0xd63529=0xce;}_0x998220['status'](_0xd63529);return _0x998220[_0xa304('0x1f')](_0xa304('0x20'),_0x1ab38e+'-'+_0x49a9a8+'/'+_0x515443)[_0xa304('0x1c')](_0x47e655);}return null;};}function patchUpdates(_0x266c81){return function(_0x23c2ae){try{jsonpatch[_0xa304('0x21')](_0x23c2ae,_0x266c81,!![]);}catch(_0x426c0f){return BPromise['reject'](_0x426c0f);}return _0x23c2ae[_0xa304('0x22')]();};}function saveUpdates(_0x13f9cd,_0x13364c){return function(_0x215514){if(_0x215514){return _0x215514[_0xa304('0x23')](_0x13f9cd)[_0xa304('0x24')](function(_0x318a97){return _0x318a97;});}return null;};}function removeEntity(_0x3fc217,_0x4b1cb5){return function(_0x3f98ea){if(_0x3f98ea){return _0x3f98ea['destroy']()[_0xa304('0x24')](function(){_0x3fc217[_0xa304('0x1a')](0xcc)[_0xa304('0x1b')]();});}};}function handleEntityNotFound(_0x33319f,_0x31e7c8){return function(_0x4d2990){if(!_0x4d2990){_0x33319f[_0xa304('0x19')](0x194);}return _0x4d2990;};}function handleError(_0x2238d5,_0x106a32){_0x106a32=_0x106a32||0x1f4;return function(_0x48a94a){logger[_0xa304('0x25')](_0x48a94a[_0xa304('0x26')]);if(_0x48a94a[_0xa304('0x27')]){delete _0x48a94a['name'];}_0x2238d5['status'](_0x106a32)[_0xa304('0x28')](_0x48a94a);};}exports['index']=function(_0x4427be,_0x348c5c){var _0x1e5bf4={},_0x2dbed9={},_0x611ef7={'count':0x0,'rows':[]};var _0x1d5d2f=db[_0xa304('0x29')][_0xa304('0x2a')];_0x2dbed9['model']=_['keys'](_0x1d5d2f);_0x2dbed9[_0xa304('0x2b')]=_[_0xa304('0x2c')](_0x4427be[_0xa304('0x2b')]);_0x2dbed9['filters']=_[_0xa304('0x2d')](_0x2dbed9['model'],_0x2dbed9[_0xa304('0x2b')]);_0x1e5bf4[_0xa304('0x2e')]=_[_0xa304('0x2d')](_0x2dbed9[_0xa304('0x2f')],qs[_0xa304('0x30')](_0x4427be['query'][_0xa304('0x30')]));_0x1e5bf4['attributes']=_0x1e5bf4[_0xa304('0x2e')]['length']?_0x1e5bf4['attributes']:_0x2dbed9[_0xa304('0x2f')];if(!_0x4427be['query'][_0xa304('0x31')](_0xa304('0x32'))){_0x1e5bf4['limit']=qs[_0xa304('0x1e')](_0x4427be[_0xa304('0x2b')][_0xa304('0x1e')]);_0x1e5bf4[_0xa304('0x1d')]=qs[_0xa304('0x1d')](_0x4427be[_0xa304('0x2b')][_0xa304('0x1d')]);}_0x1e5bf4[_0xa304('0x33')]=qs[_0xa304('0x34')](_0x4427be['query'][_0xa304('0x34')]);_0x1e5bf4[_0xa304('0x35')]=qs[_0xa304('0x36')](_['pick'](_0x4427be[_0xa304('0x2b')],_0x2dbed9['filters']));if(_0x4427be['query'][_0xa304('0x37')]){_0x1e5bf4[_0xa304('0x35')]=_[_0xa304('0x38')](_0x1e5bf4['where'],{'$or':_[_0xa304('0x39')](_0x1d5d2f,function(_0x5361d1){if(_0x5361d1[_0xa304('0x3a')][_0xa304('0x3b')]!==_0xa304('0x3c')){var _0x2f1c19={};_0x2f1c19[_0x5361d1[_0xa304('0x3d')]]={'$like':'%'+_0x4427be['query'][_0xa304('0x37')]+'%'};return _0x2f1c19;}})});}_0x1e5bf4=_[_0xa304('0x38')]({},_0x1e5bf4,_0x4427be[_0xa304('0x3e')]);var _0x3a7139={'where':_0x1e5bf4[_0xa304('0x35')]};return db[_0xa304('0x29')][_0xa304('0x3f')](_0x3a7139)['then'](function(_0x3a46c4){_0x611ef7[_0xa304('0x3f')]=_0x3a46c4;if(_0x4427be['query'][_0xa304('0x40')]){_0x1e5bf4[_0xa304('0x41')]=[{'all':!![]}];}return db[_0xa304('0x29')][_0xa304('0x42')](_0x1e5bf4);})[_0xa304('0x24')](function(_0x19bffa){_0x611ef7[_0xa304('0x43')]=_0x19bffa;return _0x611ef7;})[_0xa304('0x24')](respondWithFilteredResult(_0x348c5c,_0x1e5bf4))[_0xa304('0x44')](handleError(_0x348c5c,null));};exports[_0xa304('0x45')]=function(_0x3cbd98,_0x47cc50){var _0x16ba98={'raw':!![],'where':{'id':_0x3cbd98['params']['id']}},_0x2e3995={};_0x2e3995[_0xa304('0x2f')]=_[_0xa304('0x2c')](db[_0xa304('0x29')][_0xa304('0x2a')]);_0x2e3995[_0xa304('0x2b')]=_[_0xa304('0x2c')](_0x3cbd98[_0xa304('0x2b')]);_0x2e3995['filters']=_[_0xa304('0x2d')](_0x2e3995[_0xa304('0x2f')],_0x2e3995[_0xa304('0x2b')]);_0x16ba98[_0xa304('0x2e')]=_[_0xa304('0x2d')](_0x2e3995[_0xa304('0x2f')],qs['fields'](_0x3cbd98[_0xa304('0x2b')][_0xa304('0x30')]));_0x16ba98[_0xa304('0x2e')]=_0x16ba98[_0xa304('0x2e')][_0xa304('0x46')]?_0x16ba98[_0xa304('0x2e')]:_0x2e3995[_0xa304('0x2f')];if(_0x3cbd98[_0xa304('0x2b')][_0xa304('0x40')]){_0x16ba98[_0xa304('0x41')]=[{'all':!![]}];}_0x16ba98=_[_0xa304('0x38')]({},_0x16ba98,_0x3cbd98[_0xa304('0x3e')]);return db[_0xa304('0x29')][_0xa304('0x47')](_0x16ba98)[_0xa304('0x24')](handleEntityNotFound(_0x47cc50,null))['then'](respondWithResult(_0x47cc50,null))[_0xa304('0x44')](handleError(_0x47cc50,null));};exports['create']=function(_0x675025,_0x43330e){return db[_0xa304('0x29')][_0xa304('0x48')](_0x675025['body'],{})[_0xa304('0x24')](respondWithResult(_0x43330e,0xc9))[_0xa304('0x44')](handleError(_0x43330e,null));};exports[_0xa304('0x23')]=function(_0x4c9e10,_0x2e2968){if(_0x4c9e10[_0xa304('0x49')]['id']){delete _0x4c9e10['body']['id'];}return db[_0xa304('0x29')][_0xa304('0x47')]({'where':{'id':_0x4c9e10['params']['id']}})['then'](handleEntityNotFound(_0x2e2968,null))[_0xa304('0x24')](saveUpdates(_0x4c9e10['body'],null))[_0xa304('0x24')](respondWithResult(_0x2e2968,null))[_0xa304('0x44')](handleError(_0x2e2968,null));};exports[_0xa304('0x4a')]=function(_0x378b8c,_0x1840d3){return db[_0xa304('0x29')]['find']({'where':{'id':_0x378b8c[_0xa304('0x4b')]['id']}})[_0xa304('0x24')](handleEntityNotFound(_0x1840d3,null))[_0xa304('0x24')](removeEntity(_0x1840d3,null))['catch'](handleError(_0x1840d3,null));};exports[_0xa304('0x4c')]=function(_0x411c10,_0xd3f7d4){return db[_0xa304('0x29')][_0xa304('0x4c')]()[_0xa304('0x24')](respondWithResult(_0xd3f7d4,null))['catch'](handleError(_0xd3f7d4,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 8e7fd00..5bcb458 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 _0x5848=['util','../../config/logger','api','request-promise','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash'];(function(_0x38aaf8,_0x223147){var _0x49c255=function(_0x57ea3f){while(--_0x57ea3f){_0x38aaf8['push'](_0x38aaf8['shift']());}};_0x49c255(++_0x223147);}(_0x5848,0x133));var _0x8584=function(_0x5c6eb9,_0xddc789){_0x5c6eb9=_0x5c6eb9-0x0;var _0x58d45d=_0x5848[_0x5c6eb9];return _0x58d45d;};'use strict';var _=require(_0x8584('0x0'));var util=require(_0x8584('0x1'));var logger=require(_0x8584('0x2'))(_0x8584('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8584('0x4'));var attributes=require(_0x8584('0x5'));module[_0x8584('0x6')]=function(_0x3648e1,_0x168ee3){return _0x3648e1[_0x8584('0x7')](_0x8584('0x8'),attributes,{'tableName':_0x8584('0x9'),'paranoid':![],'indexes':[{'fields':[_0x8584('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd203=['uniqueid','lodash','util','api','moment','bluebird','request-promise','exports','define','VoiceDialReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd203,0xa1));var _0x3d20=function(_0x7d94f4,_0x4dad1c){_0x7d94f4=_0x7d94f4-0x0;var _0x41e687=_0xd203[_0x7d94f4];return _0x41e687;};'use strict';var _=require(_0x3d20('0x0'));var util=require(_0x3d20('0x1'));var logger=require('../../config/logger')(_0x3d20('0x2'));var moment=require(_0x3d20('0x3'));var BPromise=require(_0x3d20('0x4'));var rp=require(_0x3d20('0x5'));var attributes=require('./voiceDialReport.attributes');module[_0x3d20('0x6')]=function(_0x2504b1,_0x19817c){return _0x2504b1[_0x3d20('0x7')](_0x3d20('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x3d20('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index ef81e13..f262e63 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 _0x25a3=['UpdateVoiceDialReport','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceDialReport','create','body','options','raw','then','CreateVoiceDialReport','where','attributes','limit'];(function(_0x28611e,_0x586726){var _0x530f69=function(_0x407906){while(--_0x407906){_0x28611e['push'](_0x28611e['shift']());}};_0x530f69(++_0x586726);}(_0x25a3,0x121));var _0x325a=function(_0x2aea82,_0xe095d2){_0x2aea82=_0x2aea82-0x0;var _0x51657b=_0x25a3[_0x2aea82];return _0x51657b;};'use strict';var _=require(_0x325a('0x0'));var util=require(_0x325a('0x1'));var moment=require(_0x325a('0x2'));var BPromise=require('bluebird');var rs=require(_0x325a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x325a('0x4'))['db'];var utils=require(_0x325a('0x5'));var logger=require(_0x325a('0x6'))('rpc');var config=require(_0x325a('0x7'));var jayson=require(_0x325a('0x8'));var client=jayson[_0x325a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x533867,_0x3bb82f,_0x209f5e){return new BPromise(function(_0x43bd79,_0x33f09a){return client['request'](_0x533867,_0x209f5e)['then'](function(_0x37e954){logger[_0x325a('0xa')](_0x325a('0xb'),_0x3bb82f,_0x325a('0xc'));logger[_0x325a('0xd')](_0x325a('0xe'),_0x3bb82f,'request\x20sent',JSON[_0x325a('0xf')](_0x37e954));if(_0x37e954[_0x325a('0x10')]){if(_0x37e954['error'][_0x325a('0x11')]===0x1f4){logger[_0x325a('0x10')](_0x325a('0xb'),_0x3bb82f,_0x37e954[_0x325a('0x10')]['message']);return _0x33f09a(_0x37e954['error'][_0x325a('0x12')]);}logger['error'](_0x325a('0xb'),_0x3bb82f,_0x37e954[_0x325a('0x10')][_0x325a('0x12')]);return _0x43bd79(_0x37e954[_0x325a('0x10')][_0x325a('0x12')]);}else{logger[_0x325a('0xa')](_0x325a('0xb'),_0x3bb82f,_0x325a('0xc'));_0x43bd79(_0x37e954[_0x325a('0x13')][_0x325a('0x12')]);}})[_0x325a('0x14')](function(_0x21315f){logger[_0x325a('0x10')](_0x325a('0xb'),_0x3bb82f,_0x21315f);_0x33f09a(_0x21315f);});});}exports['CreateVoiceDialReport']=function(_0x4cba7){var _0x4fbd50=this;return new Promise(function(_0x4a1f9f,_0x34c4c8){return db[_0x325a('0x15')][_0x325a('0x16')](_0x4cba7[_0x325a('0x17')],{'raw':_0x4cba7[_0x325a('0x18')]?_0x4cba7[_0x325a('0x18')][_0x325a('0x19')]===undefined?!![]:![]:!![]})[_0x325a('0x1a')](function(_0x347f2d){logger[_0x325a('0xa')](_0x325a('0x1b'),_0x4cba7);logger[_0x325a('0xd')]('CreateVoiceDialReport',_0x4cba7,JSON[_0x325a('0xf')](_0x347f2d));_0x4a1f9f(_0x347f2d);})[_0x325a('0x14')](function(_0x18e29f){logger[_0x325a('0x10')](_0x325a('0x1b'),_0x18e29f[_0x325a('0x12')],_0x4cba7);_0x34c4c8(_0x4fbd50['error'](0x1f4,_0x18e29f[_0x325a('0x12')]));});});};exports['UpdateVoiceDialReport']=function(_0x15b5a6){var _0x3e6934=this;return new Promise(function(_0x309c06,_0x22c4a6){return db[_0x325a('0x15')]['update'](_0x15b5a6[_0x325a('0x17')],{'raw':_0x15b5a6['options']?_0x15b5a6[_0x325a('0x18')][_0x325a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15b5a6[_0x325a('0x18')]?_0x15b5a6['options'][_0x325a('0x1c')]||null:null,'attributes':_0x15b5a6[_0x325a('0x18')]?_0x15b5a6[_0x325a('0x18')][_0x325a('0x1d')]||null:null,'limit':_0x15b5a6[_0x325a('0x18')]?_0x15b5a6[_0x325a('0x18')][_0x325a('0x1e')]||null:null})[_0x325a('0x1a')](function(_0x44468d){logger['info'](_0x325a('0x1f'),_0x15b5a6);logger[_0x325a('0xd')](_0x325a('0x1f'),_0x15b5a6,JSON[_0x325a('0xf')](_0x44468d));_0x309c06(_0x44468d);})[_0x325a('0x14')](function(_0x5acbcd){logger[_0x325a('0x10')]('UpdateVoiceDialReport',_0x5acbcd[_0x325a('0x12')],_0x15b5a6);_0x22c4a6(_0x3e6934[_0x325a('0x10')](0x1f4,_0x5acbcd['message']));});});}; \ No newline at end of file +var _0x3164=['http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','body','options','raw','UpdateVoiceDialReport','VoiceDialReport','update','where','limit','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x317f51,_0x4113ac){var _0x558ab0=function(_0x2cbf28){while(--_0x2cbf28){_0x317f51['push'](_0x317f51['shift']());}};_0x558ab0(++_0x4113ac);}(_0x3164,0x182));var _0x4316=function(_0x9f1fb1,_0x4c7ade){_0x9f1fb1=_0x9f1fb1-0x0;var _0x45477d=_0x3164[_0x9f1fb1];return _0x45477d;};'use strict';var _=require(_0x4316('0x0'));var util=require(_0x4316('0x1'));var moment=require(_0x4316('0x2'));var BPromise=require(_0x4316('0x3'));var rs=require(_0x4316('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4316('0x5'))['db'];var utils=require(_0x4316('0x6'));var logger=require(_0x4316('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4316('0x8'));var client=jayson[_0x4316('0x9')][_0x4316('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29c3c1,_0x25be1f,_0x473cd2){return new BPromise(function(_0x1bcd38,_0x2b1420){return client[_0x4316('0xb')](_0x29c3c1,_0x473cd2)[_0x4316('0xc')](function(_0x2ad6dc){logger[_0x4316('0xd')](_0x4316('0xe'),_0x25be1f,_0x4316('0xf'));logger['debug'](_0x4316('0x10'),_0x25be1f,_0x4316('0xf'),JSON[_0x4316('0x11')](_0x2ad6dc));if(_0x2ad6dc[_0x4316('0x12')]){if(_0x2ad6dc['error'][_0x4316('0x13')]===0x1f4){logger[_0x4316('0x12')](_0x4316('0xe'),_0x25be1f,_0x2ad6dc[_0x4316('0x12')]['message']);return _0x2b1420(_0x2ad6dc[_0x4316('0x12')]['message']);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x25be1f,_0x2ad6dc[_0x4316('0x12')][_0x4316('0x14')]);return _0x1bcd38(_0x2ad6dc['error'][_0x4316('0x14')]);}else{logger['info'](_0x4316('0xe'),_0x25be1f,_0x4316('0xf'));_0x1bcd38(_0x2ad6dc[_0x4316('0x15')][_0x4316('0x14')]);}})[_0x4316('0x16')](function(_0x2d579f){logger[_0x4316('0x12')](_0x4316('0xe'),_0x25be1f,_0x2d579f);_0x2b1420(_0x2d579f);});});}exports[_0x4316('0x17')]=function(_0x3bf044){var _0x5a414f=this;return new Promise(function(_0x43069f,_0x34c667){return db['VoiceDialReport']['create'](_0x3bf044[_0x4316('0x18')],{'raw':_0x3bf044[_0x4316('0x19')]?_0x3bf044[_0x4316('0x19')][_0x4316('0x1a')]===undefined?!![]:![]:!![]})[_0x4316('0xc')](function(_0x5865a3){logger[_0x4316('0xd')](_0x4316('0x17'),_0x3bf044);logger['debug'](_0x4316('0x17'),_0x3bf044,JSON[_0x4316('0x11')](_0x5865a3));_0x43069f(_0x5865a3);})[_0x4316('0x16')](function(_0x494f82){logger[_0x4316('0x12')](_0x4316('0x17'),_0x494f82[_0x4316('0x14')],_0x3bf044);_0x34c667(_0x5a414f['error'](0x1f4,_0x494f82[_0x4316('0x14')]));});});};exports[_0x4316('0x1b')]=function(_0x37043c){var _0x2d2bda=this;return new Promise(function(_0x4bd8b2,_0x270688){return db[_0x4316('0x1c')][_0x4316('0x1d')](_0x37043c[_0x4316('0x18')],{'raw':_0x37043c[_0x4316('0x19')]?_0x37043c[_0x4316('0x19')][_0x4316('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37043c[_0x4316('0x19')]?_0x37043c[_0x4316('0x19')][_0x4316('0x1e')]||null:null,'attributes':_0x37043c[_0x4316('0x19')]?_0x37043c[_0x4316('0x19')]['attributes']||null:null,'limit':_0x37043c['options']?_0x37043c[_0x4316('0x19')][_0x4316('0x1f')]||null:null})[_0x4316('0xc')](function(_0x334f61){logger[_0x4316('0xd')]('UpdateVoiceDialReport',_0x37043c);logger[_0x4316('0x20')]('UpdateVoiceDialReport',_0x37043c,JSON[_0x4316('0x11')](_0x334f61));_0x4bd8b2(_0x334f61);})['catch'](function(_0x46df48){logger['error'](_0x4316('0x1b'),_0x46df48[_0x4316('0x14')],_0x37043c);_0x270688(_0x2d2bda['error'](0x1f4,_0x46df48[_0x4316('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index d19c716..46f1278 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 _0x1c9a=['multer','path','express','Router','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','show','post','create','/:id/applications','put','/:id','update','delete','destroy','exports'];(function(_0xe1a3a5,_0xd3e341){var _0x362646=function(_0xdcef03){while(--_0xdcef03){_0xe1a3a5['push'](_0xe1a3a5['shift']());}};_0x362646(++_0xd3e341);}(_0x1c9a,0x98));var _0xa1c9=function(_0x51a5c9,_0x93ec7){_0x51a5c9=_0x51a5c9-0x0;var _0x4ac3ac=_0x1c9a[_0x51a5c9];return _0x4ac3ac;};'use strict';var multer=require(_0xa1c9('0x0'));var util=require('util');var path=require(_0xa1c9('0x1'));var timeout=require('connect-timeout');var express=require(_0xa1c9('0x2'));var router=express[_0xa1c9('0x3')]();var auth=require(_0xa1c9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa1c9('0x5'));var controller=require(_0xa1c9('0x6'));router[_0xa1c9('0x7')]('/',auth[_0xa1c9('0x8')](),controller['index']);router[_0xa1c9('0x7')]('/:id',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x9')]);router[_0xa1c9('0xa')]('/',auth['isAuthenticated'](),controller[_0xa1c9('0xb')]);router[_0xa1c9('0xa')](_0xa1c9('0xc'),auth[_0xa1c9('0x8')](),controller['addApplications']);router[_0xa1c9('0xd')](_0xa1c9('0xe'),auth[_0xa1c9('0x8')](),controller[_0xa1c9('0xf')]);router[_0xa1c9('0x10')](_0xa1c9('0xe'),auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x11')]);module[_0xa1c9('0x12')]=router; \ No newline at end of file +var _0xd0e4=['get','/:id','isAuthenticated','post','/:id/applications','addApplications','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller'];(function(_0x144a81,_0x161c3a){var _0x4c453d=function(_0x178f6a){while(--_0x178f6a){_0x144a81['push'](_0x144a81['shift']());}};_0x4c453d(++_0x161c3a);}(_0xd0e4,0x1d3));var _0x4d0e=function(_0x230daa,_0x2d4dd0){_0x230daa=_0x230daa-0x0;var _0x210dc5=_0xd0e4[_0x230daa];return _0x210dc5;};'use strict';var multer=require(_0x4d0e('0x0'));var util=require(_0x4d0e('0x1'));var path=require(_0x4d0e('0x2'));var timeout=require(_0x4d0e('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x4d0e('0x4'));var interaction=require(_0x4d0e('0x5'));var config=require(_0x4d0e('0x6'));var controller=require(_0x4d0e('0x7'));router[_0x4d0e('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4d0e('0x9'),auth[_0x4d0e('0xa')](),controller['show']);router[_0x4d0e('0xb')]('/',auth[_0x4d0e('0xa')](),controller['create']);router['post'](_0x4d0e('0xc'),auth['isAuthenticated'](),controller[_0x4d0e('0xd')]);router[_0x4d0e('0xe')](_0x4d0e('0x9'),auth['isAuthenticated'](),controller[_0x4d0e('0xf')]);router[_0x4d0e('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x4d0e('0x11')]);module[_0x4d0e('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 8a856ed..57447f6 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 _0xe706=['VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0x4d3c3b,_0xd4e4ee){var _0x3983aa=function(_0x12adc3){while(--_0x12adc3){_0x4d3c3b['push'](_0x4d3c3b['shift']());}};_0x3983aa(++_0xd4e4ee);}(_0xe706,0xa3));var _0x6e70=function(_0x5948dd,_0x1f6ac8){_0x5948dd=_0x5948dd-0x0;var _0xb1f8be=_0xe706[_0x5948dd];return _0xb1f8be;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'context':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':_0x6e70('0x3')},'priority':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x6e70('0x3')},'tag':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0x4')},'appdata':{'type':Sequelize[_0x6e70('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x6e70('0x5')](_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0x6e70('0x2')]},'interval':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0xd')},'IntervalId':{'type':Sequelize[_0x6e70('0xe')]},'isApp':{'type':Sequelize[_0x6e70('0xf')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x6e70('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x10')},'answer':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':!![]},'name':{'type':Sequelize[_0x6e70('0x11')],'get':function(_0x27dd9b){return this[_0x6e70('0x12')](_0x6e70('0x13'));}}}; \ No newline at end of file +var _0xae60=['BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','*,*,*,*','INTEGER'];(function(_0x3a0531,_0x1d5717){var _0x2fc7d5=function(_0x5b0342){while(--_0x5b0342){_0x3a0531['push'](_0x3a0531['shift']());}};_0x2fc7d5(++_0x1d5717);}(_0xae60,0x1c7));var _0x0ae6=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xae60[_0x1589dd];return _0x1bddd1;};'use strict';var Sequelize=require(_0x0ae6('0x0'));module[_0x0ae6('0x1')]={'context':{'type':Sequelize[_0x0ae6('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x0ae6('0x2')],'allowNull':![],'unique':_0x0ae6('0x3')},'priority':{'type':Sequelize[_0x0ae6('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x0ae6('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0ae6('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x0ae6('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0ae6('0x4')](_0x0ae6('0x5'),_0x0ae6('0x6'),_0x0ae6('0x7'),_0x0ae6('0x8'),_0x0ae6('0x9'),_0x0ae6('0xa'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x0ae6('0x2')]},'interval':{'type':Sequelize[_0x0ae6('0x2')],'allowNull':![],'defaultValue':_0x0ae6('0xb')},'IntervalId':{'type':Sequelize[_0x0ae6('0xc')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0ae6('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0ae6('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x0ae6('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0ae6('0xc')]},'recordingFormat':{'type':Sequelize[_0x0ae6('0x2')],'defaultValue':_0x0ae6('0xe')},'answer':{'type':Sequelize[_0x0ae6('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0ae6('0xf')],'get':function(_0x3b05a4){return this[_0x0ae6('0x10')](_0x0ae6('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 58e879c..3f00922 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 _0x13fe=['bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','../../config/license/hardware','ioredis','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','inbound','OutboundRoutes','internal','filter','ignore','map','value','find','type','name','UserProfileResource','destroy','sendStatus','error','send','VoiceExtension','rawAttributes','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','key','VIRTUAL','field','includeAll','include','findAll','params','length','options','catch','create','body','startsWith','exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','outbound','InternalRoutes','UserProfileSection','userProfileId','context','description','recordingFormat','cutdigits','addApplications','findOne','sequelize','transaction'];(function(_0x825d94,_0x2e8884){var _0x2cdd0d=function(_0x2220de){while(--_0x2220de){_0x825d94['push'](_0x825d94['shift']());}};_0x2cdd0d(++_0x2e8884);}(_0x13fe,0x138));var _0xe13f=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x13fe[_0x580576];return _0x3f55a0;};'use strict';var pdf=require(_0xe13f('0x0'));var emlformat=require(_0xe13f('0x1'));var rimraf=require(_0xe13f('0x2'));var zipdir=require(_0xe13f('0x3'));var jsonpatch=require(_0xe13f('0x4'));var rp=require(_0xe13f('0x5'));var moment=require('moment');var BPromise=require(_0xe13f('0x6'));var Mustache=require(_0xe13f('0x7'));var util=require(_0xe13f('0x8'));var path=require(_0xe13f('0x9'));var sox=require(_0xe13f('0xa'));var csv=require(_0xe13f('0xb'));var ejs=require(_0xe13f('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe13f('0xd'));var jsforce=require(_0xe13f('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe13f('0xf'));var Papa=require(_0xe13f('0x10'));var authService=require('../../components/auth/service');var hardwareService=require(_0xe13f('0x11'));var Redis=require(_0xe13f('0x12'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xe13f('0x13'));var utils=require(_0xe13f('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xe13f('0x15')]=_[_0xe13f('0x16')](config[_0xe13f('0x15')],{'host':_0xe13f('0x17'),'port':0x18eb});var socket=require(_0xe13f('0x18'))(new Redis(config['redis']));require(_0xe13f('0x19'))[_0xe13f('0x1a')](socket);function respondWithStatusCode(_0x571787,_0x69222){_0x69222=_0x69222||0xcc;return function(_0x1bdde1){if(_0x1bdde1){return _0x571787['sendStatus'](_0x69222);}return _0x571787[_0xe13f('0x1b')](_0x69222)[_0xe13f('0x1c')]();};}function respondWithResult(_0x2f1f4f,_0x474730){_0x474730=_0x474730||0xc8;return function(_0x398c2e){if(_0x398c2e){return _0x2f1f4f[_0xe13f('0x1b')](_0x474730)['json'](_0x398c2e);}};}function respondWithFilteredResult(_0x1ae44a,_0x5afd47){return function(_0x11d180){if(_0x11d180){var _0x4b5697=_0x11d180[_0xe13f('0x1d')],_0x28770d=_0x5afd47[_0xe13f('0x1e')],_0x5b01d7=_0x5afd47[_0xe13f('0x1e')]+_0x5afd47[_0xe13f('0x1f')],_0x39852b;if(_0x5b01d7>=_0x4b5697){_0x5b01d7=_0x4b5697;_0x39852b=0xc8;}else{_0x39852b=0xce;}_0x1ae44a[_0xe13f('0x1b')](_0x39852b);return _0x1ae44a[_0xe13f('0x20')](_0xe13f('0x21'),_0x28770d+'-'+_0x5b01d7+'/'+_0x4b5697)['json'](_0x11d180);}return null;};}function patchUpdates(_0x48ea63){return function(_0x1519e4){try{jsonpatch[_0xe13f('0x22')](_0x1519e4,_0x48ea63,!![]);}catch(_0x3ebf70){return BPromise[_0xe13f('0x23')](_0x3ebf70);}return _0x1519e4[_0xe13f('0x24')]();};}function saveUpdates(_0x612555,_0x199590){return function(_0x5c93da){if(_0x5c93da){return _0x5c93da[_0xe13f('0x25')](_0x612555)[_0xe13f('0x26')](function(_0x17ef1b){return _0x17ef1b;});}return null;};}function removeEntity(_0x45f6a2,_0x415adf){return function(_0x2ce943){if(_0x2ce943){return _0x2ce943['destroy']()[_0xe13f('0x26')](function(){var _0x46da38=_0x2ce943[_0xe13f('0x27')]({'plain':!![]});var _0x37eff0=[{'name':'InboundRoutes','value':_0xe13f('0x28'),'ignore':![]},{'name':_0xe13f('0x29'),'value':'outbound','ignore':![]},{'name':'InternalRoutes','value':_0xe13f('0x2a'),'ignore':![]}];var _0x2ae303=_(_0x37eff0)[_0xe13f('0x2b')](_0xe13f('0x2c'))[_0xe13f('0x2d')](_0xe13f('0x2e'))['value']();if(_['includes'](_0x2ae303,_0x46da38['type'])){return;}var _0x1404d0=_[_0xe13f('0x2f')](_0x37eff0,[_0xe13f('0x2e'),_0x46da38[_0xe13f('0x30')]])[_0xe13f('0x31')];return db[_0xe13f('0x32')][_0xe13f('0x33')]({'where':{'type':_0x1404d0,'resourceId':_0x46da38['id']}})[_0xe13f('0x26')](function(){return _0x2ce943;});})[_0xe13f('0x26')](function(){_0x45f6a2[_0xe13f('0x1b')](0xcc)[_0xe13f('0x1c')]();});}};}function handleEntityNotFound(_0x58abe7,_0x3f9cf9){return function(_0x414358){if(!_0x414358){_0x58abe7[_0xe13f('0x34')](0x194);}return _0x414358;};}function handleError(_0x52e8a2,_0x4c4547){_0x4c4547=_0x4c4547||0x1f4;return function(_0xeb4abf){logger[_0xe13f('0x35')](_0xeb4abf['stack']);if(_0xeb4abf['name']){delete _0xeb4abf[_0xe13f('0x31')];}_0x52e8a2[_0xe13f('0x1b')](_0x4c4547)[_0xe13f('0x36')](_0xeb4abf);};}exports['index']=function(_0xa632cf,_0x169e04){var _0x430557={},_0x379c04={},_0x3eb4cc={'count':0x0,'rows':[]};var _0x434dcb=db[_0xe13f('0x37')][_0xe13f('0x38')];_0x379c04['model']=_['keys'](_0x434dcb);_0x379c04[_0xe13f('0x39')]=_[_0xe13f('0x3a')](_0xa632cf['query']);_0x379c04[_0xe13f('0x3b')]=_[_0xe13f('0x3c')](_0x379c04[_0xe13f('0x3d')],_0x379c04[_0xe13f('0x39')]);_0x430557[_0xe13f('0x3e')]=_[_0xe13f('0x3c')](_0x379c04[_0xe13f('0x3d')],qs['fields'](_0xa632cf['query'][_0xe13f('0x3f')]));_0x430557[_0xe13f('0x3e')]=_0x430557['attributes']['length']?_0x430557['attributes']:_0x379c04[_0xe13f('0x3d')];if(!_0xa632cf[_0xe13f('0x39')][_0xe13f('0x40')](_0xe13f('0x41'))){_0x430557[_0xe13f('0x1f')]=qs['limit'](_0xa632cf[_0xe13f('0x39')][_0xe13f('0x1f')]);_0x430557[_0xe13f('0x1e')]=qs[_0xe13f('0x1e')](_0xa632cf[_0xe13f('0x39')]['offset']);}_0x430557[_0xe13f('0x42')]=qs[_0xe13f('0x43')](_0xa632cf[_0xe13f('0x39')][_0xe13f('0x43')]);_0x430557[_0xe13f('0x44')]=qs[_0xe13f('0x3b')](_[_0xe13f('0x45')](_0xa632cf[_0xe13f('0x39')],_0x379c04['filters']));if(_0xa632cf[_0xe13f('0x39')][_0xe13f('0x2b')]){_0x430557[_0xe13f('0x44')]=_[_0xe13f('0x46')](_0x430557[_0xe13f('0x44')],{'$or':_[_0xe13f('0x2d')](_0x434dcb,function(_0x4c3861){if(_0x4c3861[_0xe13f('0x30')][_0xe13f('0x47')]!==_0xe13f('0x48')){var _0x439526={};_0x439526[_0x4c3861[_0xe13f('0x49')]]={'$like':'%'+_0xa632cf[_0xe13f('0x39')][_0xe13f('0x2b')]+'%'};return _0x439526;}})});}_0x430557=_['merge']({},_0x430557,_0xa632cf['options']);var _0x9c90ce={'where':_0x430557[_0xe13f('0x44')]};return db['VoiceExtension']['count'](_0x9c90ce)[_0xe13f('0x26')](function(_0x23bfd0){_0x3eb4cc[_0xe13f('0x1d')]=_0x23bfd0;if(_0xa632cf[_0xe13f('0x39')][_0xe13f('0x4a')]){_0x430557[_0xe13f('0x4b')]=[{'all':!![]}];}return db[_0xe13f('0x37')][_0xe13f('0x4c')](_0x430557);})['then'](function(_0x363539){_0x3eb4cc['rows']=_0x363539;return _0x3eb4cc;})[_0xe13f('0x26')](respondWithFilteredResult(_0x169e04,_0x430557))['catch'](handleError(_0x169e04,null));};exports['show']=function(_0x469907,_0x35545b){var _0x57b5c6={'raw':![],'where':{'id':_0x469907[_0xe13f('0x4d')]['id']}},_0x13b350={};_0x13b350[_0xe13f('0x3d')]=_[_0xe13f('0x3a')](db[_0xe13f('0x37')][_0xe13f('0x38')]);_0x13b350['query']=_['keys'](_0x469907[_0xe13f('0x39')]);_0x13b350['filters']=_[_0xe13f('0x3c')](_0x13b350[_0xe13f('0x3d')],_0x13b350['query']);_0x57b5c6[_0xe13f('0x3e')]=_[_0xe13f('0x3c')](_0x13b350[_0xe13f('0x3d')],qs[_0xe13f('0x3f')](_0x469907[_0xe13f('0x39')][_0xe13f('0x3f')]));_0x57b5c6[_0xe13f('0x3e')]=_0x57b5c6[_0xe13f('0x3e')][_0xe13f('0x4e')]?_0x57b5c6[_0xe13f('0x3e')]:_0x13b350['model'];if(_0x469907[_0xe13f('0x39')]['includeAll']){_0x57b5c6[_0xe13f('0x4b')]=[{'all':!![]}];}_0x57b5c6=_[_0xe13f('0x46')]({},_0x57b5c6,_0x469907[_0xe13f('0x4f')]);return db[_0xe13f('0x37')][_0xe13f('0x2f')](_0x57b5c6)[_0xe13f('0x26')](handleEntityNotFound(_0x35545b,null))['then'](respondWithResult(_0x35545b,null))['catch'](handleError(_0x35545b,null));};exports['destroy']=function(_0x501575,_0x365aff){return db[_0xe13f('0x37')][_0xe13f('0x2f')]({'where':{'id':_0x501575[_0xe13f('0x4d')]['id']}})[_0xe13f('0x26')](handleEntityNotFound(_0x365aff,null))[_0xe13f('0x26')](removeEntity(_0x365aff,null))[_0xe13f('0x50')](handleError(_0x365aff,null));};exports[_0xe13f('0x51')]=function(_0x54f378,_0x42e46c){if(_0x54f378[_0xe13f('0x52')][_0xe13f('0x30')]==='outbound'&&!_[_0xe13f('0x53')](_0x54f378[_0xe13f('0x52')][_0xe13f('0x54')],'_')){_0x54f378['body']['exten']='_'['concat'](_0x54f378['body'][_0xe13f('0x54')]);}return db['VoiceExtension'][_0xe13f('0x51')](_0x54f378[_0xe13f('0x52')],{'raw':![]})['then'](function(_0x3a8adf){var _0x1cc755=_0x54f378['user'][_0xe13f('0x27')]({'plain':!![]});if(!_0x1cc755)throw new Error(_0xe13f('0x55'));if(_0x1cc755[_0xe13f('0x56')]==='user'){var _0x3cc74e=_0x3a8adf[_0xe13f('0x27')]({'plain':!![]});var _0x5387cf=[{'name':_0xe13f('0x57'),'value':_0xe13f('0x28')},{'name':_0xe13f('0x29'),'value':_0xe13f('0x58')},{'name':_0xe13f('0x59'),'value':_0xe13f('0x2a')}];var _0x124aaa=_['find'](_0x5387cf,[_0xe13f('0x2e'),_0x3cc74e[_0xe13f('0x30')]])['name'];return db[_0xe13f('0x5a')][_0xe13f('0x2f')]({'where':{'name':_0x124aaa,'userProfileId':_0x1cc755[_0xe13f('0x5b')]},'raw':!![]})['then'](function(_0x5445b2){if(_0x5445b2&&_0x5445b2['autoAssociation']===0x0){return db[_0xe13f('0x32')][_0xe13f('0x51')]({'name':_0x3cc74e['name'],'resourceId':_0x3cc74e['id'],'type':_0x5445b2[_0xe13f('0x31')],'sectionId':_0x5445b2['id']},{})[_0xe13f('0x26')](function(){return _0x3a8adf;});}else{return _0x3a8adf;}})[_0xe13f('0x50')](function(_0x2125cf){logger[_0xe13f('0x35')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2125cf);throw _0x2125cf;});}return _0x3a8adf;})['then'](respondWithResult(_0x42e46c,0xc9))[_0xe13f('0x50')](handleError(_0x42e46c,null));};exports['update']=function(_0x3bd8bc,_0x1db09b){if(_0x3bd8bc['body']['id']){delete _0x3bd8bc['body']['id'];}return db[_0xe13f('0x37')]['find']({'where':{'id':_0x3bd8bc[_0xe13f('0x4d')]['id']}})[_0xe13f('0x26')](handleEntityNotFound(_0x1db09b,null))[_0xe13f('0x26')](function(_0x52e5cb){if(_0x52e5cb){return db['VoiceExtension'][_0xe13f('0x25')](_[_0xe13f('0x45')](_0x3bd8bc[_0xe13f('0x52')],[_0xe13f('0x54'),_0xe13f('0x5c'),_0xe13f('0x5d'),_0xe13f('0x5e'),_0xe13f('0x5f'),'mandatoryDisposition']),{'where':{'context':_0x52e5cb[_0xe13f('0x5c')],'exten':_0x52e5cb[_0xe13f('0x54')]},'individualHooks':!![]})[_0xe13f('0x26')](function(_0x6e498a){return _0x6e498a;});}return null;})[_0xe13f('0x26')](respondWithStatusCode(_0x1db09b,null))[_0xe13f('0x50')](handleError(_0x1db09b,null));};exports[_0xe13f('0x60')]=function(_0x453015,_0x12e317,_0x5d4d1e){return db[_0xe13f('0x37')][_0xe13f('0x61')]({'where':{'id':_0x453015[_0xe13f('0x4d')]['id']}})[_0xe13f('0x26')](handleEntityNotFound(_0x12e317,null))[_0xe13f('0x26')](function(_0x587c95){if(_0x587c95){return db[_0xe13f('0x62')][_0xe13f('0x63')](function(_0x95c903){return db[_0xe13f('0x37')][_0xe13f('0x33')]({'where':{'VoiceExtensionId':_0x453015[_0xe13f('0x4d')]['id']},'transaction':_0x95c903})[_0xe13f('0x26')](function(_0x562449){var _0x36a1a2=_[_0xe13f('0x2d')](_0x453015[_0xe13f('0x52')],function(_0x29df11){_0x29df11['VoiceExtensionId']=_0x453015['params']['id'];return _0x29df11;});return db[_0xe13f('0x37')][_0xe13f('0x64')](_0x36a1a2,{'transaction':_0x95c903});});})[_0xe13f('0x26')](function(){return db[_0xe13f('0x37')][_0xe13f('0x65')]({'where':{'isApp':!![],'VoiceExtensionId':_0x453015[_0xe13f('0x4d')]['id']},'order':_0xe13f('0x66')});});}})[_0xe13f('0x26')](respondWithResult(_0x12e317,null))[_0xe13f('0x50')](handleError(_0x12e317,null));}; \ No newline at end of file +var _0xf52f=['keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','map','key','field','includeAll','include','findAll','rows','catch','show','fields','options','params','create','body','startsWith','exten','concat','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','defaults','localhost','socket.io-emitter','redis','./voiceExtension.socket','end','status','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','value','type','find','UserProfileResource','sendStatus','error','name','send','index','VoiceExtension','rawAttributes','model','query'];(function(_0x481e76,_0x3dfaa6){var _0x58efac=function(_0x4c6291){while(--_0x4c6291){_0x481e76['push'](_0x481e76['shift']());}};_0x58efac(++_0x3dfaa6);}(_0xf52f,0x113));var _0xff52=function(_0x507a18,_0x1323ee){_0x507a18=_0x507a18-0x0;var _0x1e9de4=_0xf52f[_0x507a18];return _0x1e9de4;};'use strict';var pdf=require(_0xff52('0x0'));var emlformat=require(_0xff52('0x1'));var rimraf=require(_0xff52('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xff52('0x3'));var rp=require(_0xff52('0x4'));var moment=require(_0xff52('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xff52('0x6'));var util=require(_0xff52('0x7'));var path=require('path');var sox=require(_0xff52('0x8'));var csv=require(_0xff52('0x9'));var ejs=require(_0xff52('0xa'));var fs=require('fs');var _=require(_0xff52('0xb'));var squel=require(_0xff52('0xc'));var crypto=require(_0xff52('0xd'));var jsforce=require(_0xff52('0xe'));var deskjs=require(_0xff52('0xf'));var toCsv=require(_0xff52('0x9'));var querystring=require(_0xff52('0x10'));var Papa=require(_0xff52('0x11'));var authService=require(_0xff52('0x12'));var hardwareService=require(_0xff52('0x13'));var Redis=require(_0xff52('0x14'));var qs=require(_0xff52('0x15'));var logger=require(_0xff52('0x16'))(_0xff52('0x17'));var utils=require(_0xff52('0x18'));var config=require(_0xff52('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xff52('0x1a')](config['redis'],{'host':_0xff52('0x1b'),'port':0x18eb});var socket=require(_0xff52('0x1c'))(new Redis(config[_0xff52('0x1d')]));require(_0xff52('0x1e'))['register'](socket);function respondWithStatusCode(_0x54eccf,_0x5bc4dd){_0x5bc4dd=_0x5bc4dd||0xcc;return function(_0x32f7e5){if(_0x32f7e5){return _0x54eccf['sendStatus'](_0x5bc4dd);}return _0x54eccf['status'](_0x5bc4dd)[_0xff52('0x1f')]();};}function respondWithResult(_0x1e1818,_0x3fc985){_0x3fc985=_0x3fc985||0xc8;return function(_0x440701){if(_0x440701){return _0x1e1818[_0xff52('0x20')](_0x3fc985)['json'](_0x440701);}};}function respondWithFilteredResult(_0x853d6b,_0x5ecf12){return function(_0xc8d493){if(_0xc8d493){var _0x4794a8=_0xc8d493[_0xff52('0x21')],_0x568cad=_0x5ecf12['offset'],_0x1de477=_0x5ecf12['offset']+_0x5ecf12[_0xff52('0x22')],_0x28601f;if(_0x1de477>=_0x4794a8){_0x1de477=_0x4794a8;_0x28601f=0xc8;}else{_0x28601f=0xce;}_0x853d6b[_0xff52('0x20')](_0x28601f);return _0x853d6b[_0xff52('0x23')](_0xff52('0x24'),_0x568cad+'-'+_0x1de477+'/'+_0x4794a8)['json'](_0xc8d493);}return null;};}function patchUpdates(_0x147db2){return function(_0x45fe57){try{jsonpatch[_0xff52('0x25')](_0x45fe57,_0x147db2,!![]);}catch(_0x434a9f){return BPromise[_0xff52('0x26')](_0x434a9f);}return _0x45fe57[_0xff52('0x27')]();};}function saveUpdates(_0x78d437,_0x176c10){return function(_0x5eb3f9){if(_0x5eb3f9){return _0x5eb3f9[_0xff52('0x28')](_0x78d437)[_0xff52('0x29')](function(_0x517eb4){return _0x517eb4;});}return null;};}function removeEntity(_0x313ee0,_0x3cf849){return function(_0x4b8157){if(_0x4b8157){return _0x4b8157[_0xff52('0x2a')]()['then'](function(){var _0x5e94a7=_0x4b8157['get']({'plain':!![]});var _0x363857=[{'name':_0xff52('0x2b'),'value':_0xff52('0x2c'),'ignore':![]},{'name':_0xff52('0x2d'),'value':_0xff52('0x2e'),'ignore':![]},{'name':_0xff52('0x2f'),'value':_0xff52('0x30'),'ignore':![]}];var _0x384aa3=_(_0x363857)[_0xff52('0x31')](_0xff52('0x32'))['map'](_0xff52('0x33'))[_0xff52('0x33')]();if(_['includes'](_0x384aa3,_0x5e94a7[_0xff52('0x34')])){return;}var _0x32df90=_[_0xff52('0x35')](_0x363857,[_0xff52('0x33'),_0x5e94a7[_0xff52('0x34')]])['name'];return db[_0xff52('0x36')]['destroy']({'where':{'type':_0x32df90,'resourceId':_0x5e94a7['id']}})[_0xff52('0x29')](function(){return _0x4b8157;});})[_0xff52('0x29')](function(){_0x313ee0[_0xff52('0x20')](0xcc)[_0xff52('0x1f')]();});}};}function handleEntityNotFound(_0x94faa5,_0x50aaf2){return function(_0x4bced2){if(!_0x4bced2){_0x94faa5[_0xff52('0x37')](0x194);}return _0x4bced2;};}function handleError(_0x347d75,_0x26889c){_0x26889c=_0x26889c||0x1f4;return function(_0x4cb51a){logger[_0xff52('0x38')](_0x4cb51a['stack']);if(_0x4cb51a[_0xff52('0x39')]){delete _0x4cb51a[_0xff52('0x39')];}_0x347d75['status'](_0x26889c)[_0xff52('0x3a')](_0x4cb51a);};}exports[_0xff52('0x3b')]=function(_0x1c9719,_0x294975){var _0x2064d9={},_0x17c672={},_0x368a9d={'count':0x0,'rows':[]};var _0x459cb9=db[_0xff52('0x3c')][_0xff52('0x3d')];_0x17c672[_0xff52('0x3e')]=_['keys'](_0x459cb9);_0x17c672[_0xff52('0x3f')]=_[_0xff52('0x40')](_0x1c9719['query']);_0x17c672[_0xff52('0x41')]=_[_0xff52('0x42')](_0x17c672[_0xff52('0x3e')],_0x17c672[_0xff52('0x3f')]);_0x2064d9[_0xff52('0x43')]=_[_0xff52('0x42')](_0x17c672[_0xff52('0x3e')],qs['fields'](_0x1c9719[_0xff52('0x3f')]['fields']));_0x2064d9['attributes']=_0x2064d9[_0xff52('0x43')][_0xff52('0x44')]?_0x2064d9['attributes']:_0x17c672[_0xff52('0x3e')];if(!_0x1c9719[_0xff52('0x3f')][_0xff52('0x45')](_0xff52('0x46'))){_0x2064d9[_0xff52('0x22')]=qs[_0xff52('0x22')](_0x1c9719[_0xff52('0x3f')][_0xff52('0x22')]);_0x2064d9[_0xff52('0x47')]=qs[_0xff52('0x47')](_0x1c9719['query'][_0xff52('0x47')]);}_0x2064d9[_0xff52('0x48')]=qs[_0xff52('0x49')](_0x1c9719[_0xff52('0x3f')][_0xff52('0x49')]);_0x2064d9[_0xff52('0x4a')]=qs[_0xff52('0x41')](_[_0xff52('0x4b')](_0x1c9719['query'],_0x17c672[_0xff52('0x41')]));if(_0x1c9719['query'][_0xff52('0x31')]){_0x2064d9['where']=_[_0xff52('0x4c')](_0x2064d9[_0xff52('0x4a')],{'$or':_[_0xff52('0x4d')](_0x459cb9,function(_0x323743){if(_0x323743[_0xff52('0x34')][_0xff52('0x4e')]!=='VIRTUAL'){var _0x32c1f3={};_0x32c1f3[_0x323743[_0xff52('0x4f')]]={'$like':'%'+_0x1c9719[_0xff52('0x3f')][_0xff52('0x31')]+'%'};return _0x32c1f3;}})});}_0x2064d9=_[_0xff52('0x4c')]({},_0x2064d9,_0x1c9719['options']);var _0x236d4f={'where':_0x2064d9['where']};return db[_0xff52('0x3c')][_0xff52('0x21')](_0x236d4f)[_0xff52('0x29')](function(_0xb4fbe8){_0x368a9d['count']=_0xb4fbe8;if(_0x1c9719[_0xff52('0x3f')][_0xff52('0x50')]){_0x2064d9[_0xff52('0x51')]=[{'all':!![]}];}return db[_0xff52('0x3c')][_0xff52('0x52')](_0x2064d9);})[_0xff52('0x29')](function(_0x239df2){_0x368a9d[_0xff52('0x53')]=_0x239df2;return _0x368a9d;})[_0xff52('0x29')](respondWithFilteredResult(_0x294975,_0x2064d9))[_0xff52('0x54')](handleError(_0x294975,null));};exports[_0xff52('0x55')]=function(_0x5f069f,_0x3a8481){var _0x23f62c={'raw':![],'where':{'id':_0x5f069f['params']['id']}},_0x1ac6e8={};_0x1ac6e8[_0xff52('0x3e')]=_[_0xff52('0x40')](db[_0xff52('0x3c')][_0xff52('0x3d')]);_0x1ac6e8[_0xff52('0x3f')]=_['keys'](_0x5f069f['query']);_0x1ac6e8[_0xff52('0x41')]=_[_0xff52('0x42')](_0x1ac6e8[_0xff52('0x3e')],_0x1ac6e8['query']);_0x23f62c[_0xff52('0x43')]=_[_0xff52('0x42')](_0x1ac6e8[_0xff52('0x3e')],qs[_0xff52('0x56')](_0x5f069f[_0xff52('0x3f')][_0xff52('0x56')]));_0x23f62c['attributes']=_0x23f62c[_0xff52('0x43')][_0xff52('0x44')]?_0x23f62c[_0xff52('0x43')]:_0x1ac6e8[_0xff52('0x3e')];if(_0x5f069f['query'][_0xff52('0x50')]){_0x23f62c[_0xff52('0x51')]=[{'all':!![]}];}_0x23f62c=_[_0xff52('0x4c')]({},_0x23f62c,_0x5f069f[_0xff52('0x57')]);return db[_0xff52('0x3c')][_0xff52('0x35')](_0x23f62c)[_0xff52('0x29')](handleEntityNotFound(_0x3a8481,null))[_0xff52('0x29')](respondWithResult(_0x3a8481,null))[_0xff52('0x54')](handleError(_0x3a8481,null));};exports[_0xff52('0x2a')]=function(_0x208b92,_0x12b43d){return db['VoiceExtension'][_0xff52('0x35')]({'where':{'id':_0x208b92[_0xff52('0x58')]['id']}})['then'](handleEntityNotFound(_0x12b43d,null))[_0xff52('0x29')](removeEntity(_0x12b43d,null))[_0xff52('0x54')](handleError(_0x12b43d,null));};exports[_0xff52('0x59')]=function(_0x11001a,_0x45c3fb){if(_0x11001a[_0xff52('0x5a')][_0xff52('0x34')]==='outbound'&&!_[_0xff52('0x5b')](_0x11001a[_0xff52('0x5a')]['exten'],'_')){_0x11001a[_0xff52('0x5a')][_0xff52('0x5c')]='_'[_0xff52('0x5d')](_0x11001a[_0xff52('0x5a')]['exten']);}return db[_0xff52('0x3c')][_0xff52('0x59')](_0x11001a[_0xff52('0x5a')],{'raw':![]})[_0xff52('0x29')](function(_0x209e54){var _0x467d06=_0x11001a['user'][_0xff52('0x5e')]({'plain':!![]});if(!_0x467d06)throw new Error(_0xff52('0x5f'));if(_0x467d06[_0xff52('0x60')]===_0xff52('0x61')){var _0x1cabdb=_0x209e54[_0xff52('0x5e')]({'plain':!![]});var _0xc55989=[{'name':_0xff52('0x2b'),'value':_0xff52('0x2c')},{'name':'OutboundRoutes','value':_0xff52('0x2e')},{'name':_0xff52('0x2f'),'value':_0xff52('0x30')}];var _0x33126a=_[_0xff52('0x35')](_0xc55989,[_0xff52('0x33'),_0x1cabdb[_0xff52('0x34')]])[_0xff52('0x39')];return db[_0xff52('0x62')][_0xff52('0x35')]({'where':{'name':_0x33126a,'userProfileId':_0x467d06[_0xff52('0x63')]},'raw':!![]})[_0xff52('0x29')](function(_0x427325){if(_0x427325&&_0x427325[_0xff52('0x64')]===0x0){return db[_0xff52('0x36')][_0xff52('0x59')]({'name':_0x1cabdb[_0xff52('0x39')],'resourceId':_0x1cabdb['id'],'type':_0x427325[_0xff52('0x39')],'sectionId':_0x427325['id']},{})[_0xff52('0x29')](function(){return _0x209e54;});}else{return _0x209e54;}})[_0xff52('0x54')](function(_0x408d4a){logger[_0xff52('0x38')](_0xff52('0x65'),_0x408d4a);throw _0x408d4a;});}return _0x209e54;})['then'](respondWithResult(_0x45c3fb,0xc9))[_0xff52('0x54')](handleError(_0x45c3fb,null));};exports[_0xff52('0x28')]=function(_0x7aad63,_0x4ae315){if(_0x7aad63[_0xff52('0x5a')]['id']){delete _0x7aad63[_0xff52('0x5a')]['id'];}return db[_0xff52('0x3c')]['find']({'where':{'id':_0x7aad63['params']['id']}})['then'](handleEntityNotFound(_0x4ae315,null))['then'](function(_0x2cc039){if(_0x2cc039){return db[_0xff52('0x3c')]['update'](_[_0xff52('0x4b')](_0x7aad63['body'],[_0xff52('0x5c'),_0xff52('0x66'),_0xff52('0x67'),_0xff52('0x68'),_0xff52('0x69'),_0xff52('0x6a')]),{'where':{'context':_0x2cc039[_0xff52('0x66')],'exten':_0x2cc039[_0xff52('0x5c')]},'individualHooks':!![]})[_0xff52('0x29')](function(_0x40a7f5){return _0x40a7f5;});}return null;})[_0xff52('0x29')](respondWithStatusCode(_0x4ae315,null))['catch'](handleError(_0x4ae315,null));};exports[_0xff52('0x6b')]=function(_0x2196ff,_0x18e7f1,_0x28e4b7){return db['VoiceExtension'][_0xff52('0x6c')]({'where':{'id':_0x2196ff[_0xff52('0x58')]['id']}})['then'](handleEntityNotFound(_0x18e7f1,null))[_0xff52('0x29')](function(_0x3de81e){if(_0x3de81e){return db[_0xff52('0x6d')][_0xff52('0x6e')](function(_0x2956e1){return db[_0xff52('0x3c')][_0xff52('0x2a')]({'where':{'VoiceExtensionId':_0x2196ff[_0xff52('0x58')]['id']},'transaction':_0x2956e1})[_0xff52('0x29')](function(_0x101caa){var _0x233e14=_[_0xff52('0x4d')](_0x2196ff[_0xff52('0x5a')],function(_0x216237){_0x216237[_0xff52('0x6f')]=_0x2196ff[_0xff52('0x58')]['id'];return _0x216237;});return db[_0xff52('0x3c')]['bulkCreate'](_0x233e14,{'transaction':_0x2956e1});});})[_0xff52('0x29')](function(){return db[_0xff52('0x3c')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x2196ff[_0xff52('0x58')]['id']},'order':_0xff52('0x70')});});}})[_0xff52('0x29')](respondWithResult(_0x18e7f1,null))[_0xff52('0x54')](handleError(_0x18e7f1,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 1c62cfb..812af51 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 _0xa8c7=['events','VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1f2fc6,_0x13f01c){var _0x508957=function(_0x3eeedc){while(--_0x3eeedc){_0x1f2fc6['push'](_0x1f2fc6['shift']());}};_0x508957(++_0x13f01c);}(_0xa8c7,0x1b8));var _0x7a8c=function(_0xd002e9,_0x1f0520){_0xd002e9=_0xd002e9-0x0;var _0x2e940c=_0xa8c7[_0xd002e9];return _0x2e940c;};'use strict';var EventEmitter=require(_0x7a8c('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x7a8c('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x7a8c('0x2')](0x0);var events={'afterCreate':_0x7a8c('0x3'),'afterUpdate':_0x7a8c('0x4'),'afterDestroy':_0x7a8c('0x5')};function emitEvent(_0x161223){return function(_0x3184a5,_0x1c65af,_0x52cddd){VoiceExtensionEvents[_0x7a8c('0x6')](_0x161223+':'+_0x3184a5['id'],_0x3184a5);VoiceExtensionEvents['emit'](_0x161223,_0x3184a5);_0x52cddd(null);};}for(var e in events){if(events[_0x7a8c('0x7')](e)){var event=events[e];VoiceExtension[_0x7a8c('0x8')](e,emitEvent(event));}}module[_0x7a8c('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0xac35=['VoiceExtension','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x50c96f,_0x2ee009){var _0x38fcf2=function(_0x299a4d){while(--_0x299a4d){_0x50c96f['push'](_0x50c96f['shift']());}};_0x38fcf2(++_0x2ee009);}(_0xac35,0xa9));var _0x5ac3=function(_0xbe94e8,_0x61191a){_0xbe94e8=_0xbe94e8-0x0;var _0x94ebaf=_0xac35[_0xbe94e8];return _0x94ebaf;};'use strict';var EventEmitter=require(_0x5ac3('0x0'));var VoiceExtension=require(_0x5ac3('0x1'))['db'][_0x5ac3('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5ac3('0x3'),'afterUpdate':_0x5ac3('0x4'),'afterDestroy':_0x5ac3('0x5')};function emitEvent(_0x504039){return function(_0x13785e,_0x47081d,_0x333370){VoiceExtensionEvents[_0x5ac3('0x6')](_0x504039+':'+_0x13785e['id'],_0x13785e);VoiceExtensionEvents['emit'](_0x504039,_0x13785e);_0x333370(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x5ac3('0x7')](e,emitEvent(event));}}module[_0x5ac3('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 03ab345..f4d7afe 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 _0x8c91=['voice_extensions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./voiceExtension.attributes','exports'];(function(_0x5cdf5d,_0x616e66){var _0x2b947a=function(_0x15243a){while(--_0x15243a){_0x5cdf5d['push'](_0x5cdf5d['shift']());}};_0x2b947a(++_0x616e66);}(_0x8c91,0x15f));var _0x18c9=function(_0x1755fd,_0x1e52d8){_0x1755fd=_0x1755fd-0x0;var _0x42559a=_0x8c91[_0x1755fd];return _0x42559a;};'use strict';var _=require(_0x18c9('0x0'));var util=require(_0x18c9('0x1'));var logger=require(_0x18c9('0x2'))(_0x18c9('0x3'));var moment=require(_0x18c9('0x4'));var BPromise=require(_0x18c9('0x5'));var rp=require(_0x18c9('0x6'));var attributes=require(_0x18c9('0x7'));module[_0x18c9('0x8')]=function(_0x2425de,_0x2f268c){return _0x2425de['define']('VoiceExtension',attributes,{'tableName':_0x18c9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x759e=['request-promise','./voiceExtension.attributes','exports','VoiceExtension','lodash','../../config/logger'];(function(_0xde7c0a,_0x2b3518){var _0x28adad=function(_0x5988a9){while(--_0x5988a9){_0xde7c0a['push'](_0xde7c0a['shift']());}};_0x28adad(++_0x2b3518);}(_0x759e,0x1de));var _0xe759=function(_0x290868,_0x7b837a){_0x290868=_0x290868-0x0;var _0x4ad8e0=_0x759e[_0x290868];return _0x4ad8e0;};'use strict';var _=require(_0xe759('0x0'));var util=require('util');var logger=require(_0xe759('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe759('0x2'));var attributes=require(_0xe759('0x3'));module[_0xe759('0x4')]=function(_0x5177ce,_0x19bd95){return _0x5177ce['define'](_0xe759('0x5'),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 c137c9c..72973fc 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 _0xe5b5=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','info','lodash','util'];(function(_0x151381,_0x97b314){var _0x2afab6=function(_0x4b3941){while(--_0x4b3941){_0x151381['push'](_0x151381['shift']());}};_0x2afab6(++_0x97b314);}(_0xe5b5,0x12b));var _0x5e5b=function(_0xb5fc3e,_0x234703){_0xb5fc3e=_0xb5fc3e-0x0;var _0x2efc3c=_0xe5b5[_0xb5fc3e];return _0x2efc3c;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var moment=require(_0x5e5b('0x2'));var BPromise=require(_0x5e5b('0x3'));var rs=require(_0x5e5b('0x4'));var fs=require('fs');var Redis=require(_0x5e5b('0x5'));var db=require(_0x5e5b('0x6'))['db'];var utils=require(_0x5e5b('0x7'));var logger=require(_0x5e5b('0x8'))(_0x5e5b('0x9'));var config=require(_0x5e5b('0xa'));var jayson=require(_0x5e5b('0xb'));var client=jayson[_0x5e5b('0xc')][_0x5e5b('0xd')]({'port':0x232a});config[_0x5e5b('0xe')]=_[_0x5e5b('0xf')](config[_0x5e5b('0xe')],{'host':_0x5e5b('0x10'),'port':0x18eb});var socket=require(_0x5e5b('0x11'))(new Redis(config[_0x5e5b('0xe')]));require(_0x5e5b('0x12'))[_0x5e5b('0x13')](socket);function respondWithRpcPromise(_0x3f8534,_0x492a0e,_0x300890){return new BPromise(function(_0x59112d,_0x108c34){return client[_0x5e5b('0x14')](_0x3f8534,_0x300890)[_0x5e5b('0x15')](function(_0x3f64b6){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x492a0e,'request\x20sent');logger[_0x5e5b('0x16')](_0x5e5b('0x17'),_0x492a0e,_0x5e5b('0x18'),JSON[_0x5e5b('0x19')](_0x3f64b6));if(_0x3f64b6[_0x5e5b('0x1a')]){if(_0x3f64b6[_0x5e5b('0x1a')][_0x5e5b('0x1b')]===0x1f4){logger['error'](_0x5e5b('0x1c'),_0x492a0e,_0x3f64b6[_0x5e5b('0x1a')]['message']);return _0x108c34(_0x3f64b6[_0x5e5b('0x1a')]['message']);}logger['error'](_0x5e5b('0x1c'),_0x492a0e,_0x3f64b6[_0x5e5b('0x1a')][_0x5e5b('0x1d')]);return _0x59112d(_0x3f64b6['error'][_0x5e5b('0x1d')]);}else{logger['info'](_0x5e5b('0x1c'),_0x492a0e,_0x5e5b('0x18'));_0x59112d(_0x3f64b6['result'][_0x5e5b('0x1d')]);}})[_0x5e5b('0x1e')](function(_0x2281c8){logger['error'](_0x5e5b('0x1c'),_0x492a0e,_0x2281c8);_0x108c34(_0x2281c8);});});}exports[_0x5e5b('0x1f')]=function(_0x490e2b){var _0x2fdc38=this;return new Promise(function(_0x1aa0c2,_0x3c488e){return db[_0x5e5b('0x20')][_0x5e5b('0x21')]({'raw':_0x490e2b[_0x5e5b('0x22')]?_0x490e2b[_0x5e5b('0x22')][_0x5e5b('0x23')]===undefined?!![]:![]:!![],'where':_0x490e2b['options']?_0x490e2b['options'][_0x5e5b('0x24')]||null:null,'attributes':_0x490e2b[_0x5e5b('0x22')]?_0x490e2b[_0x5e5b('0x22')][_0x5e5b('0x25')]||null:null,'limit':_0x490e2b[_0x5e5b('0x22')]?_0x490e2b[_0x5e5b('0x22')][_0x5e5b('0x26')]||null:null,'include':_0x490e2b[_0x5e5b('0x22')]?_0x490e2b[_0x5e5b('0x22')][_0x5e5b('0x27')]?_[_0x5e5b('0x28')](_0x490e2b['options'][_0x5e5b('0x27')],function(_0x75800d){return{'model':db[_0x75800d[_0x5e5b('0x29')]],'as':_0x75800d['as'],'attributes':_0x75800d['attributes'],'include':_0x75800d[_0x5e5b('0x27')]?_[_0x5e5b('0x28')](_0x75800d['include'],function(_0x13ff91){return{'model':db[_0x13ff91[_0x5e5b('0x29')]],'as':_0x13ff91['as'],'attributes':_0x13ff91[_0x5e5b('0x25')],'include':_0x13ff91[_0x5e5b('0x27')]?_[_0x5e5b('0x28')](_0x13ff91[_0x5e5b('0x27')],function(_0x2cb695){return{'model':db[_0x2cb695[_0x5e5b('0x29')]],'as':_0x2cb695['as'],'attributes':_0x2cb695[_0x5e5b('0x25')]};}):[]};}):[]};}):[]:[]})[_0x5e5b('0x15')](function(_0xcb272c){logger[_0x5e5b('0x2a')]('GetVoiceExtension',_0x490e2b);logger['debug'](_0x5e5b('0x1f'),_0x490e2b,JSON[_0x5e5b('0x19')](_0xcb272c));_0x1aa0c2(_0xcb272c);})[_0x5e5b('0x1e')](function(_0x3dcdab){logger[_0x5e5b('0x1a')]('GetVoiceExtension',_0x3dcdab[_0x5e5b('0x1d')],_0x490e2b);_0x3c488e(_0x2fdc38['error'](0x1f4,_0x3dcdab[_0x5e5b('0x1d')]));});});}; \ No newline at end of file +var _0xd8b0=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','raw','options','attributes','limit','include','model','map','lodash','util'];(function(_0x47022b,_0x220850){var _0x4c331a=function(_0x9ddd3b){while(--_0x9ddd3b){_0x47022b['push'](_0x47022b['shift']());}};_0x4c331a(++_0x220850);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});config[_0x0d8b('0x9')]=_['defaults'](config[_0x0d8b('0x9')],{'host':_0x0d8b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d8b('0x9')]));require(_0x0d8b('0xb'))[_0x0d8b('0xc')](socket);function respondWithRpcPromise(_0x1f4800,_0x28ff7f,_0x1cac62){return new BPromise(function(_0x2c5e9e,_0x28f87c){return client['request'](_0x1f4800,_0x1cac62)[_0x0d8b('0xd')](function(_0x4e0269){logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));logger[_0x0d8b('0x11')](_0x0d8b('0x12'),_0x28ff7f,_0x0d8b('0x10'),JSON[_0x0d8b('0x13')](_0x4e0269));if(_0x4e0269[_0x0d8b('0x14')]){if(_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x15')]===0x1f4){logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x28f87c(_0x4e0269['error'][_0x0d8b('0x16')]);}logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x2c5e9e(_0x4e0269['error'][_0x0d8b('0x16')]);}else{logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));_0x2c5e9e(_0x4e0269[_0x0d8b('0x17')][_0x0d8b('0x16')]);}})[_0x0d8b('0x18')](function(_0xa3612a){logger['error'](_0x0d8b('0xf'),_0x28ff7f,_0xa3612a);_0x28f87c(_0xa3612a);});});}exports[_0x0d8b('0x19')]=function(_0x196c0a){var _0x143372=this;return new Promise(function(_0x24e8ed,_0x5b709c){return db[_0x0d8b('0x1a')][_0x0d8b('0x1b')]({'raw':_0x196c0a['options']?_0x196c0a['options'][_0x0d8b('0x1c')]===undefined?!![]:![]:!![],'where':_0x196c0a['options']?_0x196c0a['options']['where']||null:null,'attributes':_0x196c0a[_0x0d8b('0x1d')]?_0x196c0a[_0x0d8b('0x1d')][_0x0d8b('0x1e')]||null:null,'limit':_0x196c0a[_0x0d8b('0x1d')]?_0x196c0a[_0x0d8b('0x1d')][_0x0d8b('0x1f')]||null:null,'include':_0x196c0a[_0x0d8b('0x1d')]?_0x196c0a[_0x0d8b('0x1d')][_0x0d8b('0x20')]?_['map'](_0x196c0a[_0x0d8b('0x1d')][_0x0d8b('0x20')],function(_0x5363e3){return{'model':db[_0x5363e3[_0x0d8b('0x21')]],'as':_0x5363e3['as'],'attributes':_0x5363e3['attributes'],'include':_0x5363e3[_0x0d8b('0x20')]?_[_0x0d8b('0x22')](_0x5363e3[_0x0d8b('0x20')],function(_0x4fe6f9){return{'model':db[_0x4fe6f9['model']],'as':_0x4fe6f9['as'],'attributes':_0x4fe6f9[_0x0d8b('0x1e')],'include':_0x4fe6f9[_0x0d8b('0x20')]?_['map'](_0x4fe6f9[_0x0d8b('0x20')],function(_0x59aa83){return{'model':db[_0x59aa83[_0x0d8b('0x21')]],'as':_0x59aa83['as'],'attributes':_0x59aa83['attributes']};}):[]};}):[]};}):[]:[]})[_0x0d8b('0xd')](function(_0x48f24f){logger[_0x0d8b('0xe')]('GetVoiceExtension',_0x196c0a);logger[_0x0d8b('0x11')]('GetVoiceExtension',_0x196c0a,JSON[_0x0d8b('0x13')](_0x48f24f));_0x24e8ed(_0x48f24f);})[_0x0d8b('0x18')](function(_0x2c058d){logger['error']('GetVoiceExtension',_0x2c058d['message'],_0x196c0a);_0x5b709c(_0x143372[_0x0d8b('0x14')](0x1f4,_0x2c058d['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index f6b82bd..9fc7c1e 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 _0x9ef9=['./voiceExtension.events','save','remove','emit','removeListener','register','length','voiceExtension:'];(function(_0x2423f7,_0x310edc){var _0x4ec8e1=function(_0x2b4e76){while(--_0x2b4e76){_0x2423f7['push'](_0x2423f7['shift']());}};_0x4ec8e1(++_0x310edc);}(_0x9ef9,0x190));var _0x99ef=function(_0x3e321f,_0x480fc5){_0x3e321f=_0x3e321f-0x0;var _0x4e8cea=_0x9ef9[_0x3e321f];return _0x4e8cea;};'use strict';var VoiceExtensionEvents=require(_0x99ef('0x0'));var events=[_0x99ef('0x1'),_0x99ef('0x2'),'update'];function createListener(_0x40e348,_0x226924){return function(_0x462654){_0x226924[_0x99ef('0x3')](_0x40e348,_0x462654);};}function removeListener(_0x415f57,_0x319cd8){return function(){VoiceExtensionEvents[_0x99ef('0x4')](_0x415f57,_0x319cd8);};}exports[_0x99ef('0x5')]=function(_0x134063){for(var _0x4c9d3c=0x0,_0x749d43=events[_0x99ef('0x6')];_0x4c9d3c<_0x749d43;_0x4c9d3c++){var _0x20f3f9=events[_0x4c9d3c];var _0x50f6c3=createListener(_0x99ef('0x7')+_0x20f3f9,_0x134063);VoiceExtensionEvents['on'](_0x20f3f9,_0x50f6c3);}}; \ No newline at end of file +var _0x4a3d=['update','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove'];(function(_0x1af628,_0x130bb8){var _0x24117e=function(_0x3a77c8){while(--_0x3a77c8){_0x1af628['push'](_0x1af628['shift']());}};_0x24117e(++_0x130bb8);}(_0x4a3d,0x96));var _0xd4a3=function(_0x3e0781,_0x4a8dc2){_0x3e0781=_0x3e0781-0x0;var _0x145233=_0x4a3d[_0x3e0781];return _0x145233;};'use strict';var VoiceExtensionEvents=require(_0xd4a3('0x0'));var events=[_0xd4a3('0x1'),_0xd4a3('0x2'),_0xd4a3('0x3')];function createListener(_0x23c972,_0x3f58a0){return function(_0x45d004){_0x3f58a0[_0xd4a3('0x4')](_0x23c972,_0x45d004);};}function removeListener(_0x300d24,_0x10d738){return function(){VoiceExtensionEvents[_0xd4a3('0x5')](_0x300d24,_0x10d738);};}exports[_0xd4a3('0x6')]=function(_0x3da8f4){for(var _0x1585bb=0x0,_0x237007=events[_0xd4a3('0x7')];_0x1585bb<_0x237007;_0x1585bb++){var _0x38f5c4=events[_0x1585bb];var _0x379478=createListener(_0xd4a3('0x8')+_0x38f5c4,_0x3da8f4);VoiceExtensionEvents['on'](_0x38f5c4,_0x379478);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index df044b2..3cfdb0d 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 _0xc016=['exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','getMessages','create','update','delete','/:id','destroy'];(function(_0x3b96cf,_0x1592f2){var _0x2e315a=function(_0x21fa50){while(--_0x21fa50){_0x3b96cf['push'](_0x3b96cf['shift']());}};_0x2e315a(++_0x1592f2);}(_0xc016,0xde));var _0x6c01=function(_0x1f1af2,_0x477c53){_0x1f1af2=_0x1f1af2-0x0;var _0x143e55=_0xc016[_0x1f1af2];return _0x143e55;};'use strict';var multer=require(_0x6c01('0x0'));var util=require(_0x6c01('0x1'));var path=require(_0x6c01('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c01('0x3'));var router=express['Router']();var auth=require(_0x6c01('0x4'));var interaction=require(_0x6c01('0x5'));var config=require(_0x6c01('0x6'));var controller=require(_0x6c01('0x7'));router[_0x6c01('0x8')]('/',auth[_0x6c01('0x9')](),controller['index']);router[_0x6c01('0x8')]('/:id',auth[_0x6c01('0x9')](),controller['show']);router[_0x6c01('0x8')]('/:id/messages',auth[_0x6c01('0x9')](),controller[_0x6c01('0xa')]);router['post']('/',auth[_0x6c01('0x9')](),controller[_0x6c01('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6c01('0xc')]);router[_0x6c01('0xd')](_0x6c01('0xe'),auth[_0x6c01('0x9')](),controller[_0x6c01('0xf')]);module[_0x6c01('0x10')]=router; \ No newline at end of file +var _0xc9aa=['put','update','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','getMessages','post','create'];(function(_0x337651,_0x2af690){var _0x20893c=function(_0x545dcd){while(--_0x545dcd){_0x337651['push'](_0x337651['shift']());}};_0x20893c(++_0x2af690);}(_0xc9aa,0x17e));var _0xac9a=function(_0x545bed,_0x221e96){_0x545bed=_0x545bed-0x0;var _0x16c79c=_0xc9aa[_0x545bed];return _0x16c79c;};'use strict';var multer=require(_0xac9a('0x0'));var util=require(_0xac9a('0x1'));var path=require('path');var timeout=require(_0xac9a('0x2'));var express=require('express');var router=express[_0xac9a('0x3')]();var auth=require(_0xac9a('0x4'));var interaction=require(_0xac9a('0x5'));var config=require(_0xac9a('0x6'));var controller=require(_0xac9a('0x7'));router[_0xac9a('0x8')]('/',auth[_0xac9a('0x9')](),controller['index']);router[_0xac9a('0x8')](_0xac9a('0xa'),auth[_0xac9a('0x9')](),controller['show']);router['get']('/:id/messages',auth[_0xac9a('0x9')](),controller[_0xac9a('0xb')]);router[_0xac9a('0xc')]('/',auth['isAuthenticated'](),controller[_0xac9a('0xd')]);router[_0xac9a('0xe')](_0xac9a('0xa'),auth[_0xac9a('0x9')](),controller[_0xac9a('0xf')]);router['delete'](_0xac9a('0xa'),auth[_0xac9a('0x9')](),controller[_0xac9a('0x10')]);module[_0xac9a('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index ac86230..e282a64 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 _0x3558=['\x20-\x20','mailbox','sequelize','exports','STRING','contest_mailbox','email','string','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname'];(function(_0x50e6d7,_0x64c311){var _0x3df90e=function(_0x379bde){while(--_0x379bde){_0x50e6d7['push'](_0x50e6d7['shift']());}};_0x3df90e(++_0x64c311);}(_0x3558,0x172));var _0x8355=function(_0x31eb67,_0x9bc8c0){_0x31eb67=_0x31eb67-0x0;var _0x2a8cb8=_0x3558[_0x31eb67];return _0x2a8cb8;};'use strict';var Sequelize=require(_0x8355('0x0'));module[_0x8355('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8355('0x2')],'defaultValue':'from-voicemail','unique':_0x8355('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x8355('0x3')},'password':{'type':Sequelize[_0x8355('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x8355('0x2')],'validate':{'isEmail':!![]},'set':function(_0x57f6d0){this['setDataValue'](_0x8355('0x4'),typeof _0x57f6d0===_0x8355('0x5')&&_0x57f6d0['trim']()?_0x57f6d0['trim']():null);}},'pager':{'type':Sequelize[_0x8355('0x2')]},'tz':{'type':Sequelize[_0x8355('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x8355('0x6'),'allowNull':![]},'saycid':{'type':Sequelize[_0x8355('0x7')](_0x8355('0x6'),'no'),'defaultValue':_0x8355('0x6'),'allowNull':![]},'dialout':{'type':Sequelize[_0x8355('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x8355('0x7')](_0x8355('0x6'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x8355('0x7')](_0x8355('0x6'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x8355('0x6'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x8355('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x8355('0x8'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x8355('0x6'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x8355('0x6'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x8355('0x7')]('yes','no'),'defaultValue':_0x8355('0x6'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x8355('0x6'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x8355('0x7')](_0x8355('0x6'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x8355('0x6'),'no'),'defaultValue':_0x8355('0x6'),'allowNull':![]},'stamp':{'type':_0x8355('0x9')},'emailsubject':{'type':Sequelize[_0x8355('0x2')]},'emailbody':{'type':Sequelize[_0x8355('0x2')]},'maxsecs':{'type':Sequelize[_0x8355('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x8355('0xb')],'get':function(){return this[_0x8355('0xc')](_0x8355('0xd'))+_0x8355('0xe')+this[_0x8355('0xc')](_0x8355('0xf'));}}}; \ No newline at end of file +var _0x64d6=['trim','central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','string'];(function(_0x33a649,_0x31a34f){var _0x466624=function(_0x393dcd){while(--_0x393dcd){_0x33a649['push'](_0x33a649['shift']());}};_0x466624(++_0x31a34f);}(_0x64d6,0x1da));var _0x664d=function(_0x2e5603,_0x1ecd03){_0x2e5603=_0x2e5603-0x0;var _0x23ebc5=_0x64d6[_0x2e5603];return _0x23ebc5;};'use strict';var Sequelize=require(_0x664d('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x664d('0x1')],'defaultValue':_0x664d('0x2'),'unique':_0x664d('0x3')},'mailbox':{'type':Sequelize[_0x664d('0x1')],'defaultValue':'','allowNull':![],'unique':_0x664d('0x3')},'password':{'type':Sequelize[_0x664d('0x1')]},'fullname':{'type':Sequelize[_0x664d('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x4dc945){this[_0x664d('0x4')]('email',typeof _0x4dc945===_0x664d('0x5')&&_0x4dc945[_0x664d('0x6')]()?_0x4dc945[_0x664d('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x664d('0x1')],'defaultValue':_0x664d('0x7')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x664d('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x664d('0x9')](_0x664d('0x8'),'no'),'defaultValue':_0x664d('0x8'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x664d('0x9')](_0x664d('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x664d('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x664d('0x9')](_0x664d('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x664d('0x9')](_0x664d('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x664d('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x664d('0x9')](_0x664d('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x664d('0x9')](_0x664d('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x664d('0x9')](_0x664d('0x8'),'no'),'defaultValue':_0x664d('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x664d('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x664d('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x664d('0x8'),'no'),'defaultValue':_0x664d('0x8'),'allowNull':![]},'stamp':{'type':_0x664d('0xb')},'emailsubject':{'type':Sequelize[_0x664d('0x1')]},'emailbody':{'type':Sequelize[_0x664d('0x1')]},'maxsecs':{'type':Sequelize[_0x664d('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x664d('0xd')],'get':function(){return this[_0x664d('0xe')]('fullname')+'\x20-\x20'+this[_0x664d('0xe')](_0x664d('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index e902fb7..ccf3716 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 _0x899f=['fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','reject','save','Voicemails','UserProfileResource','destroy','then','end','sendStatus','stack','name','index','VoiceMail','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','map','type','key','field','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','update','findOne','VoiceMailMessage','mailbox','findAndCountAll','html-pdf','rimraf','zip-dir'];(function(_0xffece5,_0x6d2acf){var _0x5d8fa6=function(_0x56412d){while(--_0x56412d){_0xffece5['push'](_0xffece5['shift']());}};_0x5d8fa6(++_0x6d2acf);}(_0x899f,0x1b0));var _0xf899=function(_0x435150,_0x591cd9){_0x435150=_0x435150-0x0;var _0x13b3a4=_0x899f[_0x435150];return _0x13b3a4;};'use strict';var pdf=require(_0xf899('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf899('0x1'));var zipdir=require(_0xf899('0x2'));var jsonpatch=require(_0xf899('0x3'));var rp=require('request-promise');var moment=require(_0xf899('0x4'));var BPromise=require(_0xf899('0x5'));var Mustache=require(_0xf899('0x6'));var util=require(_0xf899('0x7'));var path=require('path');var sox=require(_0xf899('0x8'));var csv=require('to-csv');var ejs=require(_0xf899('0x9'));var fs=require('fs');var _=require(_0xf899('0xa'));var squel=require('squel');var crypto=require(_0xf899('0xb'));var jsforce=require(_0xf899('0xc'));var deskjs=require(_0xf899('0xd'));var toCsv=require(_0xf899('0xe'));var querystring=require(_0xf899('0xf'));var Papa=require(_0xf899('0x10'));var authService=require(_0xf899('0x11'));var hardwareService=require(_0xf899('0x12'));var Redis=require(_0xf899('0x13'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xf899('0x14'));var utils=require(_0xf899('0x15'));var config=require(_0xf899('0x16'));var db=require(_0xf899('0x17'))['db'];function respondWithStatusCode(_0x657e6d,_0x4f5f1e){_0x4f5f1e=_0x4f5f1e||0xcc;return function(_0xefc1ce){if(_0xefc1ce){return _0x657e6d['sendStatus'](_0x4f5f1e);}return _0x657e6d[_0xf899('0x18')](_0x4f5f1e)['end']();};}function respondWithResult(_0x2a36de,_0x4296af){_0x4296af=_0x4296af||0xc8;return function(_0x29c38e){if(_0x29c38e){return _0x2a36de['status'](_0x4296af)[_0xf899('0x19')](_0x29c38e);}};}function respondWithFilteredResult(_0x3d893e,_0x111f8d){return function(_0x5cf0c6){if(_0x5cf0c6){var _0x4da480=_0x5cf0c6[_0xf899('0x1a')],_0x2fdc76=_0x111f8d[_0xf899('0x1b')],_0x11af25=_0x111f8d[_0xf899('0x1b')]+_0x111f8d[_0xf899('0x1c')],_0x24dac9;if(_0x11af25>=_0x4da480){_0x11af25=_0x4da480;_0x24dac9=0xc8;}else{_0x24dac9=0xce;}_0x3d893e[_0xf899('0x18')](_0x24dac9);return _0x3d893e[_0xf899('0x1d')](_0xf899('0x1e'),_0x2fdc76+'-'+_0x11af25+'/'+_0x4da480)[_0xf899('0x19')](_0x5cf0c6);}return null;};}function patchUpdates(_0xe51a7){return function(_0x5a7bc7){try{jsonpatch['apply'](_0x5a7bc7,_0xe51a7,!![]);}catch(_0x2a907d){return BPromise[_0xf899('0x1f')](_0x2a907d);}return _0x5a7bc7[_0xf899('0x20')]();};}function saveUpdates(_0x425aa2,_0x449c65){return function(_0x1f618c){if(_0x1f618c){return _0x1f618c['update'](_0x425aa2)['then'](function(_0x3afcd7){return _0x3afcd7;});}return null;};}function removeEntity(_0x2780e9,_0x560d4f){return function(_0x5713fe){if(_0x5713fe){return _0x5713fe['destroy']()['then'](function(){var _0x5be0e1=_0x5713fe['get']({'plain':!![]});var _0x49fb4d=_0xf899('0x21');return db[_0xf899('0x22')][_0xf899('0x23')]({'where':{'type':_0x49fb4d,'resourceId':_0x5be0e1['id']}})['then'](function(){return _0x5713fe;});})[_0xf899('0x24')](function(){_0x2780e9[_0xf899('0x18')](0xcc)[_0xf899('0x25')]();});}};}function handleEntityNotFound(_0x1a31ae,_0x358c50){return function(_0x5e19c1){if(!_0x5e19c1){_0x1a31ae[_0xf899('0x26')](0x194);}return _0x5e19c1;};}function handleError(_0x351435,_0x369ebd){_0x369ebd=_0x369ebd||0x1f4;return function(_0x1540e1){logger['error'](_0x1540e1[_0xf899('0x27')]);if(_0x1540e1['name']){delete _0x1540e1[_0xf899('0x28')];}_0x351435[_0xf899('0x18')](_0x369ebd)['send'](_0x1540e1);};}exports[_0xf899('0x29')]=function(_0x7f8d21,_0x14ae89){var _0x34752e={},_0x1c913d={},_0x1a2c35={'count':0x0,'rows':[]};var _0x4f7aee=db[_0xf899('0x2a')]['rawAttributes'];_0x1c913d[_0xf899('0x2b')]=_[_0xf899('0x2c')](_0x4f7aee);_0x1c913d[_0xf899('0x2d')]=_[_0xf899('0x2c')](_0x7f8d21['query']);_0x1c913d[_0xf899('0x2e')]=_[_0xf899('0x2f')](_0x1c913d[_0xf899('0x2b')],_0x1c913d[_0xf899('0x2d')]);_0x34752e[_0xf899('0x30')]=_[_0xf899('0x2f')](_0x1c913d[_0xf899('0x2b')],qs[_0xf899('0x31')](_0x7f8d21['query'][_0xf899('0x31')]));_0x34752e[_0xf899('0x30')]=_0x34752e[_0xf899('0x30')]['length']?_0x34752e['attributes']:_0x1c913d[_0xf899('0x2b')];if(!_0x7f8d21[_0xf899('0x2d')][_0xf899('0x32')](_0xf899('0x33'))){_0x34752e['limit']=qs[_0xf899('0x1c')](_0x7f8d21[_0xf899('0x2d')][_0xf899('0x1c')]);_0x34752e[_0xf899('0x1b')]=qs['offset'](_0x7f8d21[_0xf899('0x2d')]['offset']);}_0x34752e[_0xf899('0x34')]=qs[_0xf899('0x35')](_0x7f8d21['query'][_0xf899('0x35')]);_0x34752e['where']=qs[_0xf899('0x2e')](_[_0xf899('0x36')](_0x7f8d21[_0xf899('0x2d')],_0x1c913d['filters']));if(_0x7f8d21[_0xf899('0x2d')][_0xf899('0x37')]){_0x34752e['where']=_[_0xf899('0x38')](_0x34752e[_0xf899('0x39')],{'$or':_[_0xf899('0x3a')](_0x4f7aee,function(_0x4b833c){if(_0x4b833c[_0xf899('0x3b')][_0xf899('0x3c')]!=='VIRTUAL'){var _0x58da15={};_0x58da15[_0x4b833c[_0xf899('0x3d')]]={'$like':'%'+_0x7f8d21['query'][_0xf899('0x37')]+'%'};return _0x58da15;}})});}_0x34752e=_[_0xf899('0x38')]({},_0x34752e,_0x7f8d21[_0xf899('0x3e')]);var _0x3f54d6={'where':_0x34752e['where']};return db[_0xf899('0x2a')][_0xf899('0x1a')](_0x3f54d6)[_0xf899('0x24')](function(_0x29dccb){_0x1a2c35[_0xf899('0x1a')]=_0x29dccb;if(_0x7f8d21[_0xf899('0x2d')]['includeAll']){_0x34752e[_0xf899('0x3f')]=[{'all':!![]}];}return db[_0xf899('0x2a')][_0xf899('0x40')](_0x34752e);})[_0xf899('0x24')](function(_0x69e143){_0x1a2c35[_0xf899('0x41')]=_0x69e143;return _0x1a2c35;})[_0xf899('0x24')](respondWithFilteredResult(_0x14ae89,_0x34752e))[_0xf899('0x42')](handleError(_0x14ae89,null));};exports[_0xf899('0x43')]=function(_0x269b84,_0x4056e9){var _0x1f12a7={'raw':!![],'where':{'id':_0x269b84[_0xf899('0x44')]['id']}},_0x2f0648={};_0x2f0648[_0xf899('0x2b')]=_[_0xf899('0x2c')](db[_0xf899('0x2a')][_0xf899('0x45')]);_0x2f0648['query']=_[_0xf899('0x2c')](_0x269b84[_0xf899('0x2d')]);_0x2f0648[_0xf899('0x2e')]=_[_0xf899('0x2f')](_0x2f0648[_0xf899('0x2b')],_0x2f0648[_0xf899('0x2d')]);_0x1f12a7['attributes']=_[_0xf899('0x2f')](_0x2f0648[_0xf899('0x2b')],qs[_0xf899('0x31')](_0x269b84[_0xf899('0x2d')][_0xf899('0x31')]));_0x1f12a7[_0xf899('0x30')]=_0x1f12a7[_0xf899('0x30')][_0xf899('0x46')]?_0x1f12a7[_0xf899('0x30')]:_0x2f0648[_0xf899('0x2b')];if(_0x269b84['query'][_0xf899('0x47')]){_0x1f12a7[_0xf899('0x3f')]=[{'all':!![]}];}_0x1f12a7=_[_0xf899('0x38')]({},_0x1f12a7,_0x269b84[_0xf899('0x3e')]);return db[_0xf899('0x2a')][_0xf899('0x48')](_0x1f12a7)[_0xf899('0x24')](handleEntityNotFound(_0x4056e9,null))[_0xf899('0x24')](respondWithResult(_0x4056e9,null))[_0xf899('0x42')](handleError(_0x4056e9,null));};exports[_0xf899('0x49')]=function(_0x189382,_0x2d2884){return db['VoiceMail'][_0xf899('0x49')](_0x189382[_0xf899('0x4a')],{})['then'](function(_0x440fb5){var _0x5014c5=_0x189382[_0xf899('0x4b')]['get']({'plain':!![]});if(!_0x5014c5)throw new Error(_0xf899('0x4c'));if(_0x5014c5[_0xf899('0x4d')]==='user'){var _0x5aa16b=_0x440fb5[_0xf899('0x4e')]({'plain':!![]});var _0x42e465='Voicemails';return db[_0xf899('0x4f')][_0xf899('0x48')]({'where':{'name':_0x42e465,'userProfileId':_0x5014c5[_0xf899('0x50')]},'raw':!![]})['then'](function(_0x5ca186){if(_0x5ca186&&_0x5ca186[_0xf899('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x5aa16b['name'],'resourceId':_0x5aa16b['id'],'type':_0x5ca186[_0xf899('0x28')],'sectionId':_0x5ca186['id']},{})['then'](function(){return _0x440fb5;});}else{return _0x440fb5;}})[_0xf899('0x42')](function(_0x499eb9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x499eb9);throw _0x499eb9;});}return _0x440fb5;})[_0xf899('0x24')](respondWithResult(_0x2d2884,0xc9))['catch'](handleError(_0x2d2884,null));};exports[_0xf899('0x52')]=function(_0x555f6b,_0xc92fa0){if(_0x555f6b[_0xf899('0x4a')]['id']){delete _0x555f6b[_0xf899('0x4a')]['id'];}return db['VoiceMail'][_0xf899('0x48')]({'where':{'id':_0x555f6b[_0xf899('0x44')]['id']}})[_0xf899('0x24')](handleEntityNotFound(_0xc92fa0,null))['then'](saveUpdates(_0x555f6b['body'],null))[_0xf899('0x24')](respondWithResult(_0xc92fa0,null))['catch'](handleError(_0xc92fa0,null));};exports[_0xf899('0x23')]=function(_0x177f84,_0x378f9e){return db[_0xf899('0x2a')][_0xf899('0x48')]({'where':{'id':_0x177f84[_0xf899('0x44')]['id']}})[_0xf899('0x24')](handleEntityNotFound(_0x378f9e,null))[_0xf899('0x24')](removeEntity(_0x378f9e,null))[_0xf899('0x42')](handleError(_0x378f9e,null));};exports['getMessages']=function(_0x59d42d,_0x375b07,_0xb5489e){return db[_0xf899('0x2a')][_0xf899('0x53')]({'where':{'id':_0x59d42d[_0xf899('0x44')]['id']}})['then'](handleEntityNotFound(_0x375b07,null))['then'](function(_0x2c9069){var _0x308056;var _0x4985ab={},_0x4df4be={};_0x4df4be['model']=_[_0xf899('0x2c')](db[_0xf899('0x54')][_0xf899('0x45')]);_0x4df4be[_0xf899('0x2d')]=_[_0xf899('0x2c')](_0x59d42d[_0xf899('0x2d')]);_0x4df4be[_0xf899('0x2e')]=_['intersection'](_0x4df4be[_0xf899('0x2b')],_0x4df4be[_0xf899('0x2d')]);_0x4985ab[_0xf899('0x30')]=_[_0xf899('0x2f')](_0x4df4be[_0xf899('0x2b')],qs[_0xf899('0x31')](_0x59d42d[_0xf899('0x2d')][_0xf899('0x31')]));_0x4985ab['attributes']=_0x4985ab[_0xf899('0x30')]['length']?_0x4985ab[_0xf899('0x30')]:_0x4df4be[_0xf899('0x2b')];if(!_0x59d42d[_0xf899('0x2d')][_0xf899('0x32')](_0xf899('0x33'))){_0x4985ab['limit']=qs['limit'](_0x59d42d[_0xf899('0x2d')][_0xf899('0x1c')]);_0x4985ab[_0xf899('0x1b')]=qs[_0xf899('0x1b')](_0x59d42d[_0xf899('0x2d')][_0xf899('0x1b')]);}_0x4985ab[_0xf899('0x34')]=qs[_0xf899('0x35')](_0x59d42d[_0xf899('0x2d')]['sort']);_0x4985ab[_0xf899('0x39')]=qs[_0xf899('0x2e')](_['pick'](_0x59d42d[_0xf899('0x2d')],_0x4df4be[_0xf899('0x2e')]));if(_0x59d42d[_0xf899('0x2d')][_0xf899('0x37')]){_0x4985ab[_0xf899('0x39')]=_[_0xf899('0x38')](_0x4985ab[_0xf899('0x39')],{'$or':_[_0xf899('0x3a')](_0x4985ab[_0xf899('0x30')],function(_0x1a5d79){var _0x83cce7={};_0x83cce7[_0x1a5d79]={'$like':'%'+_0x59d42d[_0xf899('0x2d')][_0xf899('0x37')]+'%'};return _0x83cce7;})});}_0x4985ab['where']=_[_0xf899('0x38')](_0x4985ab[_0xf899('0x39')],{'mailboxuser':_0x2c9069[_0xf899('0x55')]});_0x4985ab=_[_0xf899('0x38')]({},_0x4985ab,_0x59d42d['options']);return db[_0xf899('0x54')][_0xf899('0x56')](_0x4985ab)['then'](respondWithFilteredResult(_0x375b07,_0x4985ab));})['catch'](handleError(_0x375b07,null));}; \ No newline at end of file +var _0x9fe2=['lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','get','error','stack','name','index','VoiceMail','rawAttributes','model','keys','query','intersection','attributes','fields','length','order','where','filters','map','type','VIRTUAL','filter','merge','count','include','findAll','rows','catch','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','getMessages','findOne','VoiceMailMessage','nolimit','sort','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x17f2f7,_0xd04113){var _0x30baa1=function(_0x5182ab){while(--_0x5182ab){_0x17f2f7['push'](_0x17f2f7['shift']());}};_0x30baa1(++_0xd04113);}(_0x9fe2,0x194));var _0x29fe=function(_0x39c891,_0x40e5ef){_0x39c891=_0x39c891-0x0;var _0x44605e=_0x9fe2[_0x39c891];return _0x44605e;};'use strict';var pdf=require(_0x29fe('0x0'));var emlformat=require(_0x29fe('0x1'));var rimraf=require(_0x29fe('0x2'));var zipdir=require(_0x29fe('0x3'));var jsonpatch=require(_0x29fe('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x29fe('0x5'));var Mustache=require(_0x29fe('0x6'));var util=require(_0x29fe('0x7'));var path=require(_0x29fe('0x8'));var sox=require('sox');var csv=require(_0x29fe('0x9'));var ejs=require(_0x29fe('0xa'));var fs=require('fs');var _=require(_0x29fe('0xb'));var squel=require(_0x29fe('0xc'));var crypto=require('crypto');var jsforce=require(_0x29fe('0xd'));var deskjs=require(_0x29fe('0xe'));var toCsv=require(_0x29fe('0x9'));var querystring=require('querystring');var Papa=require(_0x29fe('0xf'));var authService=require(_0x29fe('0x10'));var hardwareService=require(_0x29fe('0x11'));var Redis=require(_0x29fe('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0x29fe('0x13'))(_0x29fe('0x14'));var utils=require(_0x29fe('0x15'));var config=require(_0x29fe('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22410b,_0x43a290){_0x43a290=_0x43a290||0xcc;return function(_0x5a30a7){if(_0x5a30a7){return _0x22410b[_0x29fe('0x17')](_0x43a290);}return _0x22410b[_0x29fe('0x18')](_0x43a290)[_0x29fe('0x19')]();};}function respondWithResult(_0x577f3a,_0x439fe5){_0x439fe5=_0x439fe5||0xc8;return function(_0x50326b){if(_0x50326b){return _0x577f3a[_0x29fe('0x18')](_0x439fe5)[_0x29fe('0x1a')](_0x50326b);}};}function respondWithFilteredResult(_0x455723,_0x341b5e){return function(_0x3accd8){if(_0x3accd8){var _0x223714=_0x3accd8['count'],_0x11ad19=_0x341b5e[_0x29fe('0x1b')],_0x2ad623=_0x341b5e[_0x29fe('0x1b')]+_0x341b5e[_0x29fe('0x1c')],_0x344500;if(_0x2ad623>=_0x223714){_0x2ad623=_0x223714;_0x344500=0xc8;}else{_0x344500=0xce;}_0x455723[_0x29fe('0x18')](_0x344500);return _0x455723[_0x29fe('0x1d')](_0x29fe('0x1e'),_0x11ad19+'-'+_0x2ad623+'/'+_0x223714)['json'](_0x3accd8);}return null;};}function patchUpdates(_0x1d05ff){return function(_0x3ef520){try{jsonpatch[_0x29fe('0x1f')](_0x3ef520,_0x1d05ff,!![]);}catch(_0x159f1b){return BPromise[_0x29fe('0x20')](_0x159f1b);}return _0x3ef520[_0x29fe('0x21')]();};}function saveUpdates(_0x1d1a90,_0x4bd9bd){return function(_0x108094){if(_0x108094){return _0x108094['update'](_0x1d1a90)[_0x29fe('0x22')](function(_0x38468b){return _0x38468b;});}return null;};}function removeEntity(_0x5e70f5,_0x31c616){return function(_0xe01336){if(_0xe01336){return _0xe01336['destroy']()[_0x29fe('0x22')](function(){var _0x18caf8=_0xe01336[_0x29fe('0x23')]({'plain':!![]});var _0x8c227='Voicemails';return db['UserProfileResource']['destroy']({'where':{'type':_0x8c227,'resourceId':_0x18caf8['id']}})[_0x29fe('0x22')](function(){return _0xe01336;});})['then'](function(){_0x5e70f5[_0x29fe('0x18')](0xcc)[_0x29fe('0x19')]();});}};}function handleEntityNotFound(_0x31a3e3,_0x4884b2){return function(_0x42a524){if(!_0x42a524){_0x31a3e3[_0x29fe('0x17')](0x194);}return _0x42a524;};}function handleError(_0x233728,_0xab99c6){_0xab99c6=_0xab99c6||0x1f4;return function(_0x34cd36){logger[_0x29fe('0x24')](_0x34cd36[_0x29fe('0x25')]);if(_0x34cd36[_0x29fe('0x26')]){delete _0x34cd36[_0x29fe('0x26')];}_0x233728[_0x29fe('0x18')](_0xab99c6)['send'](_0x34cd36);};}exports[_0x29fe('0x27')]=function(_0x2e4587,_0x4fcd98){var _0x360e88={},_0x542053={},_0x1aaae4={'count':0x0,'rows':[]};var _0x57e23e=db[_0x29fe('0x28')][_0x29fe('0x29')];_0x542053[_0x29fe('0x2a')]=_[_0x29fe('0x2b')](_0x57e23e);_0x542053[_0x29fe('0x2c')]=_[_0x29fe('0x2b')](_0x2e4587[_0x29fe('0x2c')]);_0x542053['filters']=_[_0x29fe('0x2d')](_0x542053[_0x29fe('0x2a')],_0x542053['query']);_0x360e88[_0x29fe('0x2e')]=_['intersection'](_0x542053[_0x29fe('0x2a')],qs[_0x29fe('0x2f')](_0x2e4587[_0x29fe('0x2c')][_0x29fe('0x2f')]));_0x360e88[_0x29fe('0x2e')]=_0x360e88['attributes'][_0x29fe('0x30')]?_0x360e88[_0x29fe('0x2e')]:_0x542053[_0x29fe('0x2a')];if(!_0x2e4587[_0x29fe('0x2c')]['hasOwnProperty']('nolimit')){_0x360e88[_0x29fe('0x1c')]=qs['limit'](_0x2e4587[_0x29fe('0x2c')][_0x29fe('0x1c')]);_0x360e88['offset']=qs[_0x29fe('0x1b')](_0x2e4587[_0x29fe('0x2c')][_0x29fe('0x1b')]);}_0x360e88[_0x29fe('0x31')]=qs['sort'](_0x2e4587[_0x29fe('0x2c')]['sort']);_0x360e88[_0x29fe('0x32')]=qs[_0x29fe('0x33')](_['pick'](_0x2e4587[_0x29fe('0x2c')],_0x542053[_0x29fe('0x33')]));if(_0x2e4587[_0x29fe('0x2c')]['filter']){_0x360e88[_0x29fe('0x32')]=_['merge'](_0x360e88[_0x29fe('0x32')],{'$or':_[_0x29fe('0x34')](_0x57e23e,function(_0x3d3f41){if(_0x3d3f41[_0x29fe('0x35')]['key']!==_0x29fe('0x36')){var _0x2f8c85={};_0x2f8c85[_0x3d3f41['field']]={'$like':'%'+_0x2e4587[_0x29fe('0x2c')][_0x29fe('0x37')]+'%'};return _0x2f8c85;}})});}_0x360e88=_[_0x29fe('0x38')]({},_0x360e88,_0x2e4587['options']);var _0x5d8525={'where':_0x360e88[_0x29fe('0x32')]};return db['VoiceMail'][_0x29fe('0x39')](_0x5d8525)[_0x29fe('0x22')](function(_0x2cff40){_0x1aaae4[_0x29fe('0x39')]=_0x2cff40;if(_0x2e4587['query']['includeAll']){_0x360e88[_0x29fe('0x3a')]=[{'all':!![]}];}return db[_0x29fe('0x28')][_0x29fe('0x3b')](_0x360e88);})[_0x29fe('0x22')](function(_0x5b86d2){_0x1aaae4[_0x29fe('0x3c')]=_0x5b86d2;return _0x1aaae4;})[_0x29fe('0x22')](respondWithFilteredResult(_0x4fcd98,_0x360e88))[_0x29fe('0x3d')](handleError(_0x4fcd98,null));};exports[_0x29fe('0x3e')]=function(_0x5954f1,_0x1d631d){var _0x17c1eb={'raw':!![],'where':{'id':_0x5954f1[_0x29fe('0x3f')]['id']}},_0x1690d0={};_0x1690d0[_0x29fe('0x2a')]=_['keys'](db[_0x29fe('0x28')][_0x29fe('0x29')]);_0x1690d0[_0x29fe('0x2c')]=_[_0x29fe('0x2b')](_0x5954f1[_0x29fe('0x2c')]);_0x1690d0[_0x29fe('0x33')]=_['intersection'](_0x1690d0[_0x29fe('0x2a')],_0x1690d0['query']);_0x17c1eb[_0x29fe('0x2e')]=_['intersection'](_0x1690d0[_0x29fe('0x2a')],qs['fields'](_0x5954f1[_0x29fe('0x2c')][_0x29fe('0x2f')]));_0x17c1eb['attributes']=_0x17c1eb[_0x29fe('0x2e')]['length']?_0x17c1eb[_0x29fe('0x2e')]:_0x1690d0['model'];if(_0x5954f1['query']['includeAll']){_0x17c1eb[_0x29fe('0x3a')]=[{'all':!![]}];}_0x17c1eb=_[_0x29fe('0x38')]({},_0x17c1eb,_0x5954f1[_0x29fe('0x40')]);return db[_0x29fe('0x28')]['find'](_0x17c1eb)[_0x29fe('0x22')](handleEntityNotFound(_0x1d631d,null))[_0x29fe('0x22')](respondWithResult(_0x1d631d,null))[_0x29fe('0x3d')](handleError(_0x1d631d,null));};exports[_0x29fe('0x41')]=function(_0x3446dc,_0x1334d0){return db[_0x29fe('0x28')][_0x29fe('0x41')](_0x3446dc[_0x29fe('0x42')],{})['then'](function(_0x3f0d23){var _0x5673b3=_0x3446dc[_0x29fe('0x43')][_0x29fe('0x23')]({'plain':!![]});if(!_0x5673b3)throw new Error(_0x29fe('0x44'));if(_0x5673b3[_0x29fe('0x45')]==='user'){var _0x2a1a0a=_0x3f0d23[_0x29fe('0x23')]({'plain':!![]});var _0xee206e=_0x29fe('0x46');return db[_0x29fe('0x47')][_0x29fe('0x48')]({'where':{'name':_0xee206e,'userProfileId':_0x5673b3[_0x29fe('0x49')]},'raw':!![]})['then'](function(_0xcde9f3){if(_0xcde9f3&&_0xcde9f3[_0x29fe('0x4a')]===0x0){return db[_0x29fe('0x4b')]['create']({'name':_0x2a1a0a[_0x29fe('0x26')],'resourceId':_0x2a1a0a['id'],'type':_0xcde9f3[_0x29fe('0x26')],'sectionId':_0xcde9f3['id']},{})[_0x29fe('0x22')](function(){return _0x3f0d23;});}else{return _0x3f0d23;}})[_0x29fe('0x3d')](function(_0x2c2de2){logger['error'](_0x29fe('0x4c'),_0x2c2de2);throw _0x2c2de2;});}return _0x3f0d23;})[_0x29fe('0x22')](respondWithResult(_0x1334d0,0xc9))[_0x29fe('0x3d')](handleError(_0x1334d0,null));};exports['update']=function(_0xc9d1a6,_0x3fb5cb){if(_0xc9d1a6[_0x29fe('0x42')]['id']){delete _0xc9d1a6[_0x29fe('0x42')]['id'];}return db[_0x29fe('0x28')]['find']({'where':{'id':_0xc9d1a6[_0x29fe('0x3f')]['id']}})[_0x29fe('0x22')](handleEntityNotFound(_0x3fb5cb,null))['then'](saveUpdates(_0xc9d1a6[_0x29fe('0x42')],null))[_0x29fe('0x22')](respondWithResult(_0x3fb5cb,null))[_0x29fe('0x3d')](handleError(_0x3fb5cb,null));};exports[_0x29fe('0x4d')]=function(_0x4d9c12,_0x2d6d85){return db[_0x29fe('0x28')][_0x29fe('0x48')]({'where':{'id':_0x4d9c12[_0x29fe('0x3f')]['id']}})[_0x29fe('0x22')](handleEntityNotFound(_0x2d6d85,null))[_0x29fe('0x22')](removeEntity(_0x2d6d85,null))[_0x29fe('0x3d')](handleError(_0x2d6d85,null));};exports[_0x29fe('0x4e')]=function(_0x4d7253,_0x5c8fb3,_0x2f56ea){return db[_0x29fe('0x28')][_0x29fe('0x4f')]({'where':{'id':_0x4d7253[_0x29fe('0x3f')]['id']}})[_0x29fe('0x22')](handleEntityNotFound(_0x5c8fb3,null))[_0x29fe('0x22')](function(_0x4f22e2){var _0xc62201;var _0x12423f={},_0x4978f4={};_0x4978f4[_0x29fe('0x2a')]=_[_0x29fe('0x2b')](db[_0x29fe('0x50')]['rawAttributes']);_0x4978f4[_0x29fe('0x2c')]=_['keys'](_0x4d7253['query']);_0x4978f4['filters']=_[_0x29fe('0x2d')](_0x4978f4[_0x29fe('0x2a')],_0x4978f4[_0x29fe('0x2c')]);_0x12423f[_0x29fe('0x2e')]=_[_0x29fe('0x2d')](_0x4978f4[_0x29fe('0x2a')],qs[_0x29fe('0x2f')](_0x4d7253['query'][_0x29fe('0x2f')]));_0x12423f['attributes']=_0x12423f[_0x29fe('0x2e')][_0x29fe('0x30')]?_0x12423f['attributes']:_0x4978f4[_0x29fe('0x2a')];if(!_0x4d7253[_0x29fe('0x2c')]['hasOwnProperty'](_0x29fe('0x51'))){_0x12423f[_0x29fe('0x1c')]=qs[_0x29fe('0x1c')](_0x4d7253[_0x29fe('0x2c')]['limit']);_0x12423f['offset']=qs['offset'](_0x4d7253[_0x29fe('0x2c')][_0x29fe('0x1b')]);}_0x12423f[_0x29fe('0x31')]=qs[_0x29fe('0x52')](_0x4d7253['query'][_0x29fe('0x52')]);_0x12423f[_0x29fe('0x32')]=qs[_0x29fe('0x33')](_['pick'](_0x4d7253[_0x29fe('0x2c')],_0x4978f4[_0x29fe('0x33')]));if(_0x4d7253[_0x29fe('0x2c')][_0x29fe('0x37')]){_0x12423f['where']=_[_0x29fe('0x38')](_0x12423f['where'],{'$or':_[_0x29fe('0x34')](_0x12423f[_0x29fe('0x2e')],function(_0x10f906){var _0x4c745c={};_0x4c745c[_0x10f906]={'$like':'%'+_0x4d7253[_0x29fe('0x2c')][_0x29fe('0x37')]+'%'};return _0x4c745c;})});}_0x12423f[_0x29fe('0x32')]=_[_0x29fe('0x38')](_0x12423f['where'],{'mailboxuser':_0x4f22e2['mailbox']});_0x12423f=_[_0x29fe('0x38')]({},_0x12423f,_0x4d7253['options']);return db[_0x29fe('0x50')]['findAndCountAll'](_0x12423f)[_0x29fe('0x22')](respondWithFilteredResult(_0x5c8fb3,_0x12423f));})[_0x29fe('0x3d')](handleError(_0x5c8fb3,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index b4d2e6f..562cba9 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 _0xe3f7=['../../config/logger','api','moment','bluebird','./voiceMail.attributes','VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe3f7,0x1d7));var _0x7e3f=function(_0x39ec87,_0x1acb12){_0x39ec87=_0x39ec87-0x0;var _0x3f8ed8=_0xe3f7[_0x39ec87];return _0x3f8ed8;};'use strict';var _=require(_0x7e3f('0x0'));var util=require(_0x7e3f('0x1'));var logger=require(_0x7e3f('0x2'))(_0x7e3f('0x3'));var moment=require(_0x7e3f('0x4'));var BPromise=require(_0x7e3f('0x5'));var rp=require('request-promise');var attributes=require(_0x7e3f('0x6'));module['exports']=function(_0x1bd062,_0x143380){return _0x1bd062['define'](_0x7e3f('0x7'),attributes,{'tableName':_0x7e3f('0x8'),'paranoid':![],'indexes':[{'name':_0x7e3f('0x9'),'fields':[_0x7e3f('0xa'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3247=['moment','request-promise','exports','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api'];(function(_0x564821,_0x4d037e){var _0x2b604d=function(_0x26fabf){while(--_0x26fabf){_0x564821['push'](_0x564821['shift']());}};_0x2b604d(++_0x4d037e);}(_0x3247,0x75));var _0x7324=function(_0x1ef09d,_0x156a32){_0x1ef09d=_0x1ef09d-0x0;var _0x15c495=_0x3247[_0x1ef09d];return _0x15c495;};'use strict';var _=require(_0x7324('0x0'));var util=require(_0x7324('0x1'));var logger=require(_0x7324('0x2'))(_0x7324('0x3'));var moment=require(_0x7324('0x4'));var BPromise=require('bluebird');var rp=require(_0x7324('0x5'));var attributes=require('./voiceMail.attributes');module[_0x7324('0x6')]=function(_0x207373,_0x478dfc){return _0x207373['define']('VoiceMail',attributes,{'tableName':_0x7324('0x7'),'paranoid':![],'indexes':[{'name':_0x7324('0x8'),'fields':[_0x7324('0x9'),_0x7324('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index c9986fc..94c3913 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 _0xd4fd=['error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x6330a4,_0x31ce3f){var _0x3a9b65=function(_0x5cb8d1){while(--_0x5cb8d1){_0x6330a4['push'](_0x6330a4['shift']());}};_0x3a9b65(++_0x31ce3f);}(_0xd4fd,0x121));var _0xdd4f=function(_0x541d38,_0x1ed6ae){_0x541d38=_0x541d38-0x0;var _0x1f26ca=_0xd4fd[_0x541d38];return _0x1f26ca;};'use strict';var _=require(_0xdd4f('0x0'));var util=require(_0xdd4f('0x1'));var moment=require('moment');var BPromise=require(_0xdd4f('0x2'));var rs=require(_0xdd4f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd4f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd4f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdd4f('0x6'));var client=jayson['client'][_0xdd4f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4af9c5,_0x42d71c,_0x109321){return new BPromise(function(_0x358ed4,_0x2e6560){return client[_0xdd4f('0x8')](_0x4af9c5,_0x109321)[_0xdd4f('0x9')](function(_0x5c5a66){logger[_0xdd4f('0xa')](_0xdd4f('0xb'),_0x42d71c,_0xdd4f('0xc'));logger[_0xdd4f('0xd')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x42d71c,_0xdd4f('0xc'),JSON[_0xdd4f('0xe')](_0x5c5a66));if(_0x5c5a66[_0xdd4f('0xf')]){if(_0x5c5a66[_0xdd4f('0xf')]['code']===0x1f4){logger[_0xdd4f('0xf')](_0xdd4f('0xb'),_0x42d71c,_0x5c5a66[_0xdd4f('0xf')][_0xdd4f('0x10')]);return _0x2e6560(_0x5c5a66[_0xdd4f('0xf')][_0xdd4f('0x10')]);}logger[_0xdd4f('0xf')](_0xdd4f('0xb'),_0x42d71c,_0x5c5a66[_0xdd4f('0xf')]['message']);return _0x358ed4(_0x5c5a66[_0xdd4f('0xf')]['message']);}else{logger[_0xdd4f('0xa')](_0xdd4f('0xb'),_0x42d71c,_0xdd4f('0xc'));_0x358ed4(_0x5c5a66[_0xdd4f('0x11')][_0xdd4f('0x10')]);}})[_0xdd4f('0x12')](function(_0x30e34b){logger[_0xdd4f('0xf')](_0xdd4f('0xb'),_0x42d71c,_0x30e34b);_0x2e6560(_0x30e34b);});});} \ No newline at end of file +var _0xefa7=['debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','VoiceMail,\x20%s,\x20%s'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xefa7,0x97));var _0x7efa=function(_0x5c1c85,_0x5f5d87){_0x5c1c85=_0x5c1c85-0x0;var _0x2d5c4e=_0xefa7[_0x5c1c85];return _0x2d5c4e;};'use strict';var _=require(_0x7efa('0x0'));var util=require('util');var moment=require(_0x7efa('0x1'));var BPromise=require('bluebird');var rs=require(_0x7efa('0x2'));var fs=require('fs');var Redis=require(_0x7efa('0x3'));var db=require(_0x7efa('0x4'))['db'];var utils=require(_0x7efa('0x5'));var logger=require(_0x7efa('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7efa('0x7'));var client=jayson['client'][_0x7efa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4fe485,_0x539c4b,_0x48d99f){return new BPromise(function(_0x38a4ad,_0x1e246f){return client[_0x7efa('0x9')](_0x4fe485,_0x48d99f)['then'](function(_0x5ddd0c){logger['info'](_0x7efa('0xa'),_0x539c4b,'request\x20sent');logger[_0x7efa('0xb')](_0x7efa('0xc'),_0x539c4b,'request\x20sent',JSON[_0x7efa('0xd')](_0x5ddd0c));if(_0x5ddd0c[_0x7efa('0xe')]){if(_0x5ddd0c[_0x7efa('0xe')]['code']===0x1f4){logger[_0x7efa('0xe')]('VoiceMail,\x20%s,\x20%s',_0x539c4b,_0x5ddd0c['error'][_0x7efa('0xf')]);return _0x1e246f(_0x5ddd0c['error']['message']);}logger[_0x7efa('0xe')](_0x7efa('0xa'),_0x539c4b,_0x5ddd0c[_0x7efa('0xe')][_0x7efa('0xf')]);return _0x38a4ad(_0x5ddd0c['error']['message']);}else{logger[_0x7efa('0x10')](_0x7efa('0xa'),_0x539c4b,_0x7efa('0x11'));_0x38a4ad(_0x5ddd0c['result'][_0x7efa('0xf')]);}})['catch'](function(_0x3ff999){logger[_0x7efa('0xe')]('VoiceMail,\x20%s,\x20%s',_0x539c4b,_0x3ff999);_0x1e246f(_0x3ff999);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 5851790..cc2212e 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 _0x1530=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','create','put','update','delete','destroy','exports'];(function(_0x2ea9b9,_0x2d9e99){var _0x1f0800=function(_0x178441){while(--_0x178441){_0x2ea9b9['push'](_0x2ea9b9['shift']());}};_0x1f0800(++_0x2d9e99);}(_0x1530,0xc6));var _0x0153=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x1530[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x0153('0x0'));var util=require(_0x0153('0x1'));var path=require(_0x0153('0x2'));var timeout=require(_0x0153('0x3'));var express=require(_0x0153('0x4'));var router=express['Router']();var auth=require(_0x0153('0x5'));var interaction=require(_0x0153('0x6'));var config=require(_0x0153('0x7'));var controller=require(_0x0153('0x8'));router[_0x0153('0x9')]('/',auth[_0x0153('0xa')](),controller[_0x0153('0xb')]);router[_0x0153('0x9')](_0x0153('0xc'),auth[_0x0153('0xa')](),controller[_0x0153('0xd')]);router[_0x0153('0x9')](_0x0153('0xe'),auth[_0x0153('0xa')](),controller[_0x0153('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0153('0x10')]);router[_0x0153('0x11')](_0x0153('0xc'),auth['isAuthenticated'](),controller[_0x0153('0x12')]);router[_0x0153('0x13')](_0x0153('0xc'),auth['isAuthenticated'](),controller[_0x0153('0x14')]);module[_0x0153('0x15')]=router; \ No newline at end of file +var _0x3646=['express','Router','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','destroy','multer','util','path','connect-timeout'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x3646,0x12c));var _0x6364=function(_0x3e0b61,_0x210913){_0x3e0b61=_0x3e0b61-0x0;var _0x4c0162=_0x3646[_0x3e0b61];return _0x4c0162;};'use strict';var multer=require(_0x6364('0x0'));var util=require(_0x6364('0x1'));var path=require(_0x6364('0x2'));var timeout=require(_0x6364('0x3'));var express=require(_0x6364('0x4'));var router=express[_0x6364('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x6364('0x6'));var config=require('../../config/environment');var controller=require(_0x6364('0x7'));router[_0x6364('0x8')]('/',auth[_0x6364('0x9')](),controller[_0x6364('0xa')]);router[_0x6364('0x8')](_0x6364('0xb'),auth[_0x6364('0x9')](),controller[_0x6364('0xc')]);router['get'](_0x6364('0xd'),auth['isAuthenticated'](),controller[_0x6364('0xe')]);router[_0x6364('0xf')]('/',auth[_0x6364('0x9')](),controller[_0x6364('0x10')]);router[_0x6364('0x11')](_0x6364('0xb'),auth[_0x6364('0x9')](),controller['update']);router['delete']('/:id',auth[_0x6364('0x9')](),controller[_0x6364('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index b80fc80..e65d627 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 _0x6f02=['long','TIMESTAMP','sequelize','VIRTUAL','getDataValue','INTEGER','STRING','BLOB'];(function(_0x57ed02,_0x461345){var _0x1e4c03=function(_0x535146){while(--_0x535146){_0x57ed02['push'](_0x57ed02['shift']());}};_0x1e4c03(++_0x461345);}(_0x6f02,0x7a));var _0x26f0=function(_0x59990d,_0x34ac47){_0x59990d=_0x59990d-0x0;var _0x3846e1=_0x6f02[_0x59990d];return _0x3846e1;};'use strict';var Sequelize=require(_0x26f0('0x0'));module['exports']={'name':{'type':Sequelize[_0x26f0('0x1')],'get':function(_0x1ff7bd){return this[_0x26f0('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x26f0('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x26f0('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x26f0('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x26f0('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x26f0('0x5')](_0x26f0('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x26f0('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x26f0('0x7'),'allowNull':![]}}; \ No newline at end of file +var _0x53f0=['getDataValue','INTEGER','STRING','BLOB','sequelize','exports'];(function(_0x2085f3,_0x50105b){var _0x384e3c=function(_0x235fa0){while(--_0x235fa0){_0x2085f3['push'](_0x2085f3['shift']());}};_0x384e3c(++_0x50105b);}(_0x53f0,0x130));var _0x053f=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x53f0[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x053f('0x0'));module[_0x053f('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x31bbe7){return this[_0x053f('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x053f('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x053f('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x053f('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x053f('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x053f('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x053f('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x053f('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x053f('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x053f('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x053f('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x053f('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 417e9ab..bc64ab2 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 _0x5c3c=['destroy','end','error','stack','send','index','VoiceMailMessage','rawAttributes','model','differenceBy','keys','name','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','map','type','key','VIRTUAL','field','filter','count','findAll','catch','show','params','includeAll','options','find','create','body','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','then'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x5c3c,0x132));var _0xc5c3=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x5c3c[_0x9fd887];return _0x1a54ab;};'use strict';var pdf=require(_0xc5c3('0x0'));var emlformat=require(_0xc5c3('0x1'));var rimraf=require(_0xc5c3('0x2'));var zipdir=require(_0xc5c3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc5c3('0x4'));var moment=require(_0xc5c3('0x5'));var BPromise=require(_0xc5c3('0x6'));var Mustache=require(_0xc5c3('0x7'));var util=require(_0xc5c3('0x8'));var path=require(_0xc5c3('0x9'));var sox=require(_0xc5c3('0xa'));var csv=require(_0xc5c3('0xb'));var ejs=require(_0xc5c3('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc5c3('0xd'));var deskjs=require(_0xc5c3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc5c3('0xf'));var Papa=require(_0xc5c3('0x10'));var authService=require('../../components/auth/service');var hardwareService=require(_0xc5c3('0x11'));var Redis=require(_0xc5c3('0x12'));var qs=require('../../components/parsers/qs');var logger=require(_0xc5c3('0x13'))(_0xc5c3('0x14'));var utils=require(_0xc5c3('0x15'));var config=require('../../config/environment');var db=require(_0xc5c3('0x16'))['db'];function respondWithStatusCode(_0x6d6a29,_0x532065){_0x532065=_0x532065||0xcc;return function(_0x2b56e6){if(_0x2b56e6){return _0x6d6a29[_0xc5c3('0x17')](_0x532065);}return _0x6d6a29[_0xc5c3('0x18')](_0x532065)['end']();};}function respondWithResult(_0x2042a0,_0x54fa08){_0x54fa08=_0x54fa08||0xc8;return function(_0x1488ab){if(_0x1488ab){return _0x2042a0[_0xc5c3('0x18')](_0x54fa08)[_0xc5c3('0x19')](_0x1488ab);}};}function respondWithFilteredResult(_0x5f34bb,_0x5c0341){return function(_0x4445ea){if(_0x4445ea){var _0x577e1a=_0x4445ea['count'],_0x1bae87=_0x5c0341[_0xc5c3('0x1a')],_0xef8b21=_0x5c0341['offset']+_0x5c0341[_0xc5c3('0x1b')],_0x5ecd4b;if(_0xef8b21>=_0x577e1a){_0xef8b21=_0x577e1a;_0x5ecd4b=0xc8;}else{_0x5ecd4b=0xce;}_0x5f34bb[_0xc5c3('0x18')](_0x5ecd4b);return _0x5f34bb[_0xc5c3('0x1c')](_0xc5c3('0x1d'),_0x1bae87+'-'+_0xef8b21+'/'+_0x577e1a)[_0xc5c3('0x19')](_0x4445ea);}return null;};}function patchUpdates(_0x5e11d5){return function(_0x364f42){try{jsonpatch[_0xc5c3('0x1e')](_0x364f42,_0x5e11d5,!![]);}catch(_0x123dba){return BPromise[_0xc5c3('0x1f')](_0x123dba);}return _0x364f42['save']();};}function saveUpdates(_0x25ef16,_0x41578a){return function(_0x3cc612){if(_0x3cc612){return _0x3cc612[_0xc5c3('0x20')](_0x25ef16)[_0xc5c3('0x21')](function(_0x564815){return _0x564815;});}return null;};}function removeEntity(_0xb07420,_0x159bec){return function(_0x370254){if(_0x370254){return _0x370254[_0xc5c3('0x22')]()[_0xc5c3('0x21')](function(){_0xb07420[_0xc5c3('0x18')](0xcc)[_0xc5c3('0x23')]();});}};}function handleEntityNotFound(_0x5996a0,_0x52d638){return function(_0x45affe){if(!_0x45affe){_0x5996a0[_0xc5c3('0x17')](0x194);}return _0x45affe;};}function handleError(_0x53ab72,_0x5c7329){_0x5c7329=_0x5c7329||0x1f4;return function(_0x23e2fb){logger[_0xc5c3('0x24')](_0x23e2fb[_0xc5c3('0x25')]);if(_0x23e2fb['name']){delete _0x23e2fb['name'];}_0x53ab72[_0xc5c3('0x18')](_0x5c7329)[_0xc5c3('0x26')](_0x23e2fb);};}exports[_0xc5c3('0x27')]=function(_0x29791c,_0x5caf85){var _0x21efd6={},_0x5176c4={},_0x2eacec={'count':0x0,'rows':[]};var _0x4e6e6f=db[_0xc5c3('0x28')][_0xc5c3('0x29')];_0x5176c4[_0xc5c3('0x2a')]=_[_0xc5c3('0x2b')](_[_0xc5c3('0x2c')](_0x4e6e6f),[_0xc5c3('0x2d')]);_0x5176c4[_0xc5c3('0x2e')]=_['keys'](_0x29791c[_0xc5c3('0x2e')]);_0x5176c4['filters']=_[_0xc5c3('0x2f')](_0x5176c4[_0xc5c3('0x2a')],_0x5176c4['query']);_0x21efd6['attributes']=_[_0xc5c3('0x2f')](_0x5176c4[_0xc5c3('0x2a')],qs[_0xc5c3('0x30')](_0x29791c[_0xc5c3('0x2e')]['fields']));_0x21efd6[_0xc5c3('0x31')]=_0x21efd6[_0xc5c3('0x31')][_0xc5c3('0x32')]?_0x21efd6[_0xc5c3('0x31')]:_0x5176c4[_0xc5c3('0x2a')];if(!_0x29791c[_0xc5c3('0x2e')][_0xc5c3('0x33')](_0xc5c3('0x34'))){_0x21efd6[_0xc5c3('0x1b')]=qs['limit'](_0x29791c[_0xc5c3('0x2e')][_0xc5c3('0x1b')]);_0x21efd6[_0xc5c3('0x1a')]=qs[_0xc5c3('0x1a')](_0x29791c[_0xc5c3('0x2e')][_0xc5c3('0x1a')]);}_0x21efd6[_0xc5c3('0x35')]=qs['sort'](_0x29791c['query'][_0xc5c3('0x36')]);_0x21efd6['where']=qs[_0xc5c3('0x37')](_[_0xc5c3('0x38')](_0x29791c[_0xc5c3('0x2e')],_0x5176c4[_0xc5c3('0x37')]));if(_0x29791c[_0xc5c3('0x2e')]['filter']){_0x21efd6[_0xc5c3('0x39')]=_[_0xc5c3('0x3a')](_0x21efd6['where'],{'$or':_[_0xc5c3('0x3b')](_0x4e6e6f,function(_0x17d93c){if(_0x17d93c[_0xc5c3('0x3c')][_0xc5c3('0x3d')]!==_0xc5c3('0x3e')){var _0x32118c={};_0x32118c[_0x17d93c[_0xc5c3('0x3f')]]={'$like':'%'+_0x29791c[_0xc5c3('0x2e')][_0xc5c3('0x40')]+'%'};return _0x32118c;}})});}_0x21efd6=_[_0xc5c3('0x3a')]({},_0x21efd6,_0x29791c['options']);var _0x361b04={'where':_0x21efd6['where']};return db['VoiceMailMessage'][_0xc5c3('0x41')](_0x361b04)[_0xc5c3('0x21')](function(_0x1b546e){_0x2eacec[_0xc5c3('0x41')]=_0x1b546e;if(_0x29791c[_0xc5c3('0x2e')]['includeAll']){_0x21efd6['include']=[{'all':!![]}];}return db[_0xc5c3('0x28')][_0xc5c3('0x42')](_0x21efd6);})['then'](function(_0x3e12ee){_0x2eacec['rows']=_0x3e12ee;return _0x2eacec;})[_0xc5c3('0x21')](respondWithFilteredResult(_0x5caf85,_0x21efd6))[_0xc5c3('0x43')](handleError(_0x5caf85,null));};exports[_0xc5c3('0x44')]=function(_0x59c9cb,_0xca2b9a){var _0x34f376={'raw':!![],'where':{'id':_0x59c9cb[_0xc5c3('0x45')]['id']}},_0x525ef8={};_0x525ef8['model']=_[_0xc5c3('0x2c')](db[_0xc5c3('0x28')]['rawAttributes']);_0x525ef8['query']=_['keys'](_0x59c9cb[_0xc5c3('0x2e')]);_0x525ef8[_0xc5c3('0x37')]=_['intersection'](_0x525ef8[_0xc5c3('0x2a')],_0x525ef8[_0xc5c3('0x2e')]);_0x34f376[_0xc5c3('0x31')]=_[_0xc5c3('0x2f')](_0x525ef8['model'],qs[_0xc5c3('0x30')](_0x59c9cb['query']['fields']));_0x34f376[_0xc5c3('0x31')]=_0x34f376[_0xc5c3('0x31')]['length']?_0x34f376[_0xc5c3('0x31')]:_0x525ef8[_0xc5c3('0x2a')];if(_0x59c9cb['query'][_0xc5c3('0x46')]){_0x34f376['include']=[{'all':!![]}];}_0x34f376=_[_0xc5c3('0x3a')]({},_0x34f376,_0x59c9cb[_0xc5c3('0x47')]);return db['VoiceMailMessage'][_0xc5c3('0x48')](_0x34f376)['then'](handleEntityNotFound(_0xca2b9a,null))[_0xc5c3('0x21')](respondWithResult(_0xca2b9a,null))[_0xc5c3('0x43')](handleError(_0xca2b9a,null));};exports['create']=function(_0x1b10f4,_0x33822d){return db[_0xc5c3('0x28')][_0xc5c3('0x49')](_0x1b10f4[_0xc5c3('0x4a')],{})[_0xc5c3('0x21')](respondWithResult(_0x33822d,0xc9))['catch'](handleError(_0x33822d,null));};exports[_0xc5c3('0x20')]=function(_0xf13d81,_0xaec5d1){if(_0xf13d81[_0xc5c3('0x4a')]['id']){delete _0xf13d81[_0xc5c3('0x4a')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0xf13d81[_0xc5c3('0x45')]['id']}})[_0xc5c3('0x21')](handleEntityNotFound(_0xaec5d1,null))[_0xc5c3('0x21')](saveUpdates(_0xf13d81['body'],null))[_0xc5c3('0x21')](respondWithResult(_0xaec5d1,null))[_0xc5c3('0x43')](handleError(_0xaec5d1,null));};exports[_0xc5c3('0x22')]=function(_0x1a150a,_0x2c1cde){return db[_0xc5c3('0x28')][_0xc5c3('0x48')]({'where':{'id':_0x1a150a['params']['id']}})[_0xc5c3('0x21')](handleEntityNotFound(_0x2c1cde,null))[_0xc5c3('0x21')](removeEntity(_0x2c1cde,null))[_0xc5c3('0x43')](handleError(_0x2c1cde,null));};exports['download']=function(_0x1741de,_0xe79a4,_0x3b1bc2){return db[_0xc5c3('0x28')][_0xc5c3('0x48')]({'where':{'id':_0x1741de['params']['id']},'attributes':['id',_0xc5c3('0x4b'),'msg_id']})[_0xc5c3('0x21')](handleEntityNotFound(_0xe79a4,null))['then'](function(_0x2f7a0a){if(_0x2f7a0a){if(!_0x2f7a0a[_0xc5c3('0x4b')]){throw new db[(_0xc5c3('0x4c'))][(_0xc5c3('0x4d'))](_0xc5c3('0x4e'));}var _0x4be969={'Content-Type':_0xc5c3('0x4f'),'Content-Disposition':_0xc5c3('0x50')};if(_0x2f7a0a[_0xc5c3('0x51')]){_0x4be969[_0xc5c3('0x52')]=_0xc5c3('0x53')+_0x2f7a0a['msg_id']+_0xc5c3('0x54');}_0xe79a4[_0xc5c3('0x1c')](_0x4be969);return _0xe79a4[_0xc5c3('0x26')](new Buffer(_0x2f7a0a['recording']));}})[_0xc5c3('0x43')](handleError(_0xe79a4,null));}; \ No newline at end of file +var _0x4991=['VoiceMailMessage\x20not\x20found','attachment','attachment;\x20filename=\x22','.wav\x22','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../config/license/hardware','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','model','differenceBy','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','map','type','options','count','includeAll','VoiceMailMessage','findAll','show','params','rawAttributes','include','find','catch','create','body','download','recording','msg_id','Sequelize'];(function(_0x58eec7,_0x2353db){var _0x25c5d3=function(_0x1ae895){while(--_0x1ae895){_0x58eec7['push'](_0x58eec7['shift']());}};_0x25c5d3(++_0x2353db);}(_0x4991,0xf7));var _0x1499=function(_0x32ebfe,_0x1f7d1c){_0x32ebfe=_0x32ebfe-0x0;var _0x4e710d=_0x4991[_0x32ebfe];return _0x4e710d;};'use strict';var pdf=require(_0x1499('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1499('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1499('0x2'));var rp=require(_0x1499('0x3'));var moment=require(_0x1499('0x4'));var BPromise=require(_0x1499('0x5'));var Mustache=require(_0x1499('0x6'));var util=require(_0x1499('0x7'));var path=require(_0x1499('0x8'));var sox=require(_0x1499('0x9'));var csv=require('to-csv');var ejs=require(_0x1499('0xa'));var fs=require('fs');var _=require(_0x1499('0xb'));var squel=require(_0x1499('0xc'));var crypto=require(_0x1499('0xd'));var jsforce=require(_0x1499('0xe'));var deskjs=require(_0x1499('0xf'));var toCsv=require(_0x1499('0x10'));var querystring=require(_0x1499('0x11'));var Papa=require('papaparse');var authService=require(_0x1499('0x12'));var hardwareService=require(_0x1499('0x13'));var Redis=require('ioredis');var qs=require(_0x1499('0x14'));var logger=require(_0x1499('0x15'))('api');var utils=require(_0x1499('0x16'));var config=require(_0x1499('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ab173,_0x4dd594){_0x4dd594=_0x4dd594||0xcc;return function(_0x3039ce){if(_0x3039ce){return _0x4ab173[_0x1499('0x18')](_0x4dd594);}return _0x4ab173[_0x1499('0x19')](_0x4dd594)[_0x1499('0x1a')]();};}function respondWithResult(_0x2b95a5,_0x57a0a2){_0x57a0a2=_0x57a0a2||0xc8;return function(_0x5f34f2){if(_0x5f34f2){return _0x2b95a5[_0x1499('0x19')](_0x57a0a2)['json'](_0x5f34f2);}};}function respondWithFilteredResult(_0x37d99e,_0x12cde0){return function(_0x308318){if(_0x308318){var _0x3ab605=_0x308318['count'],_0x48f654=_0x12cde0[_0x1499('0x1b')],_0x1ed43b=_0x12cde0[_0x1499('0x1b')]+_0x12cde0[_0x1499('0x1c')],_0x373f57;if(_0x1ed43b>=_0x3ab605){_0x1ed43b=_0x3ab605;_0x373f57=0xc8;}else{_0x373f57=0xce;}_0x37d99e[_0x1499('0x19')](_0x373f57);return _0x37d99e[_0x1499('0x1d')](_0x1499('0x1e'),_0x48f654+'-'+_0x1ed43b+'/'+_0x3ab605)['json'](_0x308318);}return null;};}function patchUpdates(_0x541477){return function(_0x5bcb5f){try{jsonpatch[_0x1499('0x1f')](_0x5bcb5f,_0x541477,!![]);}catch(_0xad534b){return BPromise['reject'](_0xad534b);}return _0x5bcb5f[_0x1499('0x20')]();};}function saveUpdates(_0x3c13a1,_0x28dff3){return function(_0x18e4a6){if(_0x18e4a6){return _0x18e4a6[_0x1499('0x21')](_0x3c13a1)[_0x1499('0x22')](function(_0x2b0458){return _0x2b0458;});}return null;};}function removeEntity(_0x253439,_0xf8003e){return function(_0x15bcd4){if(_0x15bcd4){return _0x15bcd4[_0x1499('0x23')]()[_0x1499('0x22')](function(){_0x253439[_0x1499('0x19')](0xcc)[_0x1499('0x1a')]();});}};}function handleEntityNotFound(_0x4ec57a,_0x1e2c51){return function(_0x2c7f57){if(!_0x2c7f57){_0x4ec57a['sendStatus'](0x194);}return _0x2c7f57;};}function handleError(_0x258e9c,_0xc79f69){_0xc79f69=_0xc79f69||0x1f4;return function(_0x30f014){logger[_0x1499('0x24')](_0x30f014[_0x1499('0x25')]);if(_0x30f014[_0x1499('0x26')]){delete _0x30f014['name'];}_0x258e9c['status'](_0xc79f69)[_0x1499('0x27')](_0x30f014);};}exports[_0x1499('0x28')]=function(_0x3b9259,_0x50f0cc){var _0x32782a={},_0x525d6f={},_0x3e5ed1={'count':0x0,'rows':[]};var _0x573b51=db['VoiceMailMessage']['rawAttributes'];_0x525d6f[_0x1499('0x29')]=_[_0x1499('0x2a')](_[_0x1499('0x2b')](_0x573b51),[_0x1499('0x26')]);_0x525d6f[_0x1499('0x2c')]=_[_0x1499('0x2b')](_0x3b9259[_0x1499('0x2c')]);_0x525d6f['filters']=_[_0x1499('0x2d')](_0x525d6f[_0x1499('0x29')],_0x525d6f[_0x1499('0x2c')]);_0x32782a['attributes']=_[_0x1499('0x2d')](_0x525d6f[_0x1499('0x29')],qs['fields'](_0x3b9259[_0x1499('0x2c')][_0x1499('0x2e')]));_0x32782a['attributes']=_0x32782a[_0x1499('0x2f')][_0x1499('0x30')]?_0x32782a[_0x1499('0x2f')]:_0x525d6f[_0x1499('0x29')];if(!_0x3b9259[_0x1499('0x2c')][_0x1499('0x31')](_0x1499('0x32'))){_0x32782a[_0x1499('0x1c')]=qs[_0x1499('0x1c')](_0x3b9259[_0x1499('0x2c')][_0x1499('0x1c')]);_0x32782a[_0x1499('0x1b')]=qs[_0x1499('0x1b')](_0x3b9259[_0x1499('0x2c')][_0x1499('0x1b')]);}_0x32782a[_0x1499('0x33')]=qs[_0x1499('0x34')](_0x3b9259[_0x1499('0x2c')][_0x1499('0x34')]);_0x32782a[_0x1499('0x35')]=qs['filters'](_[_0x1499('0x36')](_0x3b9259[_0x1499('0x2c')],_0x525d6f[_0x1499('0x37')]));if(_0x3b9259[_0x1499('0x2c')][_0x1499('0x38')]){_0x32782a[_0x1499('0x35')]=_[_0x1499('0x39')](_0x32782a[_0x1499('0x35')],{'$or':_[_0x1499('0x3a')](_0x573b51,function(_0x3fddb3){if(_0x3fddb3[_0x1499('0x3b')]['key']!=='VIRTUAL'){var _0x11fc19={};_0x11fc19[_0x3fddb3['field']]={'$like':'%'+_0x3b9259[_0x1499('0x2c')]['filter']+'%'};return _0x11fc19;}})});}_0x32782a=_[_0x1499('0x39')]({},_0x32782a,_0x3b9259[_0x1499('0x3c')]);var _0x13ae73={'where':_0x32782a[_0x1499('0x35')]};return db['VoiceMailMessage'][_0x1499('0x3d')](_0x13ae73)['then'](function(_0x2f9c59){_0x3e5ed1[_0x1499('0x3d')]=_0x2f9c59;if(_0x3b9259[_0x1499('0x2c')][_0x1499('0x3e')]){_0x32782a['include']=[{'all':!![]}];}return db[_0x1499('0x3f')][_0x1499('0x40')](_0x32782a);})[_0x1499('0x22')](function(_0x3b67a7){_0x3e5ed1['rows']=_0x3b67a7;return _0x3e5ed1;})[_0x1499('0x22')](respondWithFilteredResult(_0x50f0cc,_0x32782a))['catch'](handleError(_0x50f0cc,null));};exports[_0x1499('0x41')]=function(_0x38f449,_0x2a2441){var _0x370f15={'raw':!![],'where':{'id':_0x38f449[_0x1499('0x42')]['id']}},_0x3ed978={};_0x3ed978[_0x1499('0x29')]=_[_0x1499('0x2b')](db[_0x1499('0x3f')][_0x1499('0x43')]);_0x3ed978['query']=_[_0x1499('0x2b')](_0x38f449['query']);_0x3ed978[_0x1499('0x37')]=_[_0x1499('0x2d')](_0x3ed978['model'],_0x3ed978[_0x1499('0x2c')]);_0x370f15[_0x1499('0x2f')]=_[_0x1499('0x2d')](_0x3ed978[_0x1499('0x29')],qs[_0x1499('0x2e')](_0x38f449['query']['fields']));_0x370f15[_0x1499('0x2f')]=_0x370f15[_0x1499('0x2f')]['length']?_0x370f15[_0x1499('0x2f')]:_0x3ed978[_0x1499('0x29')];if(_0x38f449['query']['includeAll']){_0x370f15[_0x1499('0x44')]=[{'all':!![]}];}_0x370f15=_[_0x1499('0x39')]({},_0x370f15,_0x38f449[_0x1499('0x3c')]);return db['VoiceMailMessage'][_0x1499('0x45')](_0x370f15)[_0x1499('0x22')](handleEntityNotFound(_0x2a2441,null))[_0x1499('0x22')](respondWithResult(_0x2a2441,null))[_0x1499('0x46')](handleError(_0x2a2441,null));};exports['create']=function(_0x292c23,_0x405901){return db[_0x1499('0x3f')][_0x1499('0x47')](_0x292c23['body'],{})[_0x1499('0x22')](respondWithResult(_0x405901,0xc9))[_0x1499('0x46')](handleError(_0x405901,null));};exports[_0x1499('0x21')]=function(_0x4b36c4,_0x593708){if(_0x4b36c4[_0x1499('0x48')]['id']){delete _0x4b36c4['body']['id'];}return db[_0x1499('0x3f')][_0x1499('0x45')]({'where':{'id':_0x4b36c4[_0x1499('0x42')]['id']}})[_0x1499('0x22')](handleEntityNotFound(_0x593708,null))[_0x1499('0x22')](saveUpdates(_0x4b36c4[_0x1499('0x48')],null))[_0x1499('0x22')](respondWithResult(_0x593708,null))['catch'](handleError(_0x593708,null));};exports[_0x1499('0x23')]=function(_0x4c81db,_0x2ff0db){return db[_0x1499('0x3f')]['find']({'where':{'id':_0x4c81db[_0x1499('0x42')]['id']}})[_0x1499('0x22')](handleEntityNotFound(_0x2ff0db,null))[_0x1499('0x22')](removeEntity(_0x2ff0db,null))['catch'](handleError(_0x2ff0db,null));};exports[_0x1499('0x49')]=function(_0xf80ba6,_0x10b9a1,_0x29ac0f){return db[_0x1499('0x3f')][_0x1499('0x45')]({'where':{'id':_0xf80ba6[_0x1499('0x42')]['id']},'attributes':['id',_0x1499('0x4a'),_0x1499('0x4b')]})[_0x1499('0x22')](handleEntityNotFound(_0x10b9a1,null))['then'](function(_0x13770a){if(_0x13770a){if(!_0x13770a[_0x1499('0x4a')]){throw new db[(_0x1499('0x4c'))]['ValidationError'](_0x1499('0x4d'));}var _0x2a7614={'Content-Type':'audio/wav','Content-Disposition':_0x1499('0x4e')};if(_0x13770a[_0x1499('0x4b')]){_0x2a7614['Content-Disposition']=_0x1499('0x4f')+_0x13770a[_0x1499('0x4b')]+_0x1499('0x50');}_0x10b9a1[_0x1499('0x1d')](_0x2a7614);return _0x10b9a1[_0x1499('0x27')](new Buffer(_0x13770a[_0x1499('0x4a')]));}})[_0x1499('0x46')](handleError(_0x10b9a1,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index c2cfb9c..35fbcf6 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 _0x4db0=['dir','lodash','util','api','moment','request-promise','./voiceMailMessage.attributes','exports','define'];(function(_0x24a5c1,_0x52a879){var _0x1261f2=function(_0x4a15d8){while(--_0x4a15d8){_0x24a5c1['push'](_0x24a5c1['shift']());}};_0x1261f2(++_0x52a879);}(_0x4db0,0x169));var _0x04db=function(_0x343b56,_0x27ebbf){_0x343b56=_0x343b56-0x0;var _0x4bdc57=_0x4db0[_0x343b56];return _0x4bdc57;};'use strict';var _=require(_0x04db('0x0'));var util=require(_0x04db('0x1'));var logger=require('../../config/logger')(_0x04db('0x2'));var moment=require(_0x04db('0x3'));var BPromise=require('bluebird');var rp=require(_0x04db('0x4'));var attributes=require(_0x04db('0x5'));module[_0x04db('0x6')]=function(_0x23e844,_0x572a39){return _0x23e844[_0x04db('0x7')]('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x04db('0x8'),'fields':[_0x04db('0x8')]}],'timestamps':![]});}; \ No newline at end of file +var _0x4838=['exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','api','moment','bluebird','request-promise','./voiceMailMessage.attributes'];(function(_0x38e98a,_0x2b3d4a){var _0x585dc6=function(_0x564976){while(--_0x564976){_0x38e98a['push'](_0x38e98a['shift']());}};_0x585dc6(++_0x2b3d4a);}(_0x4838,0xe9));var _0x8483=function(_0x3be62f,_0x3796d8){_0x3be62f=_0x3be62f-0x0;var _0x4656ed=_0x4838[_0x3be62f];return _0x4656ed;};'use strict';var _=require(_0x8483('0x0'));var util=require(_0x8483('0x1'));var logger=require('../../config/logger')(_0x8483('0x2'));var moment=require(_0x8483('0x3'));var BPromise=require(_0x8483('0x4'));var rp=require(_0x8483('0x5'));var attributes=require(_0x8483('0x6'));module[_0x8483('0x7')]=function(_0x12c3bc,_0x19e2ea){return _0x12c3bc[_0x8483('0x8')](_0x8483('0x9'),attributes,{'tableName':_0x8483('0xa'),'paranoid':![],'indexes':[{'name':_0x8483('0xb'),'fields':[_0x8483('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 59489f8..32eb2ed 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 _0xf2ae=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x49b52a,_0x43cd67){var _0x3199da=function(_0xf1940a){while(--_0xf1940a){_0x49b52a['push'](_0x49b52a['shift']());}};_0x3199da(++_0x43cd67);}(_0xf2ae,0x178));var _0xef2a=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xf2ae[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0xef2a('0x0'));var util=require(_0xef2a('0x1'));var moment=require(_0xef2a('0x2'));var BPromise=require(_0xef2a('0x3'));var rs=require(_0xef2a('0x4'));var fs=require('fs');var Redis=require(_0xef2a('0x5'));var db=require(_0xef2a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xef2a('0x7'))(_0xef2a('0x8'));var config=require(_0xef2a('0x9'));var jayson=require(_0xef2a('0xa'));var client=jayson[_0xef2a('0xb')][_0xef2a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x37f2dd,_0x57a95,_0x2d2ae5){return new BPromise(function(_0x20ed88,_0x4da9ef){return client[_0xef2a('0xd')](_0x37f2dd,_0x2d2ae5)[_0xef2a('0xe')](function(_0xe731a8){logger[_0xef2a('0xf')](_0xef2a('0x10'),_0x57a95,'request\x20sent');logger['debug'](_0xef2a('0x11'),_0x57a95,'request\x20sent',JSON['stringify'](_0xe731a8));if(_0xe731a8['error']){if(_0xe731a8[_0xef2a('0x12')][_0xef2a('0x13')]===0x1f4){logger[_0xef2a('0x12')](_0xef2a('0x10'),_0x57a95,_0xe731a8[_0xef2a('0x12')]['message']);return _0x4da9ef(_0xe731a8[_0xef2a('0x12')]['message']);}logger[_0xef2a('0x12')](_0xef2a('0x10'),_0x57a95,_0xe731a8['error'][_0xef2a('0x14')]);return _0x20ed88(_0xe731a8[_0xef2a('0x12')][_0xef2a('0x14')]);}else{logger[_0xef2a('0xf')](_0xef2a('0x10'),_0x57a95,_0xef2a('0x15'));_0x20ed88(_0xe731a8[_0xef2a('0x16')][_0xef2a('0x14')]);}})[_0xef2a('0x17')](function(_0x11eb36){logger['error'](_0xef2a('0x10'),_0x57a95,_0x11eb36);_0x4da9ef(_0x11eb36);});});} \ No newline at end of file +var _0x2d76=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','message','VoiceMailMessage,\x20%s,\x20%s','util','bluebird','randomstring'];(function(_0x47de55,_0x4a19e8){var _0x1a6194=function(_0x34311a){while(--_0x34311a){_0x47de55['push'](_0x47de55['shift']());}};_0x1a6194(++_0x4a19e8);}(_0x2d76,0x101));var _0x62d7=function(_0x443e1c,_0x229f8c){_0x443e1c=_0x443e1c-0x0;var _0x1a659a=_0x2d76[_0x443e1c];return _0x1a659a;};'use strict';var _=require('lodash');var util=require(_0x62d7('0x0'));var moment=require('moment');var BPromise=require(_0x62d7('0x1'));var rs=require(_0x62d7('0x2'));var fs=require('fs');var Redis=require(_0x62d7('0x3'));var db=require(_0x62d7('0x4'))['db'];var utils=require(_0x62d7('0x5'));var logger=require(_0x62d7('0x6'))(_0x62d7('0x7'));var config=require(_0x62d7('0x8'));var jayson=require(_0x62d7('0x9'));var client=jayson[_0x62d7('0xa')][_0x62d7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38a596,_0x38ec71,_0x2957ae){return new BPromise(function(_0x40fa98,_0x52ba0d){return client['request'](_0x38a596,_0x2957ae)[_0x62d7('0xc')](function(_0x5c60e0){logger[_0x62d7('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x38ec71,_0x62d7('0xe'));logger[_0x62d7('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x38ec71,_0x62d7('0xe'),JSON['stringify'](_0x5c60e0));if(_0x5c60e0[_0x62d7('0x10')]){if(_0x5c60e0[_0x62d7('0x10')][_0x62d7('0x11')]===0x1f4){logger[_0x62d7('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x38ec71,_0x5c60e0[_0x62d7('0x10')][_0x62d7('0x12')]);return _0x52ba0d(_0x5c60e0['error']['message']);}logger[_0x62d7('0x10')](_0x62d7('0x13'),_0x38ec71,_0x5c60e0[_0x62d7('0x10')][_0x62d7('0x12')]);return _0x40fa98(_0x5c60e0[_0x62d7('0x10')]['message']);}else{logger[_0x62d7('0xd')](_0x62d7('0x13'),_0x38ec71,'request\x20sent');_0x40fa98(_0x5c60e0['result'][_0x62d7('0x12')]);}})['catch'](function(_0x27c760){logger['error'](_0x62d7('0x13'),_0x38ec71,_0x27c760);_0x52ba0d(_0x27c760);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 3b97b21..56846b6 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 _0xf021=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','index','/:id','isAuthenticated','show','get','/:id/sounds','getSounds','post','addSound','put','update'];(function(_0x5a3287,_0x30ebbb){var _0x39c481=function(_0x5af795){while(--_0x5af795){_0x5a3287['push'](_0x5a3287['shift']());}};_0x39c481(++_0x30ebbb);}(_0xf021,0x18f));var _0x1f02=function(_0x1e9604,_0x5de613){_0x1e9604=_0x1e9604-0x0;var _0x522053=_0xf021[_0x1e9604];return _0x522053;};'use strict';var multer=require(_0x1f02('0x0'));var util=require(_0x1f02('0x1'));var path=require(_0x1f02('0x2'));var timeout=require(_0x1f02('0x3'));var express=require(_0x1f02('0x4'));var router=express['Router']();var auth=require(_0x1f02('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1f02('0x6'));var controller=require(_0x1f02('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1f02('0x8')]);router['get'](_0x1f02('0x9'),auth[_0x1f02('0xa')](),controller[_0x1f02('0xb')]);router[_0x1f02('0xc')](_0x1f02('0xd'),auth['isAuthenticated'](),controller[_0x1f02('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1f02('0xf')](_0x1f02('0xd'),auth[_0x1f02('0xa')](),controller[_0x1f02('0x10')]);router[_0x1f02('0x11')]('/:id',auth[_0x1f02('0xa')](),controller[_0x1f02('0x12')]);router[_0x1f02('0x13')]('/:id',auth[_0x1f02('0xa')](),controller[_0x1f02('0x14')]);router[_0x1f02('0x13')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller['removeSound']);module[_0x1f02('0x15')]=router; \ No newline at end of file +var _0xb821=['./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','delete','destroy','/:id/sounds/:id2','exports','util','path','Router','../../config/environment'];(function(_0x128db6,_0x3e3448){var _0x3bea36=function(_0xd7d35f){while(--_0xd7d35f){_0x128db6['push'](_0x128db6['shift']());}};_0x3bea36(++_0x3e3448);}(_0xb821,0xa7));var _0x1b82=function(_0x10b678,_0x3184c4){_0x10b678=_0x10b678-0x0;var _0x40b717=_0xb821[_0x10b678];return _0x40b717;};'use strict';var multer=require('multer');var util=require(_0x1b82('0x0'));var path=require(_0x1b82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b82('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b82('0x3'));var controller=require(_0x1b82('0x4'));router[_0x1b82('0x5')]('/',auth[_0x1b82('0x6')](),controller['index']);router[_0x1b82('0x5')](_0x1b82('0x7'),auth[_0x1b82('0x6')](),controller[_0x1b82('0x8')]);router[_0x1b82('0x5')](_0x1b82('0x9'),auth[_0x1b82('0x6')](),controller[_0x1b82('0xa')]);router[_0x1b82('0xb')]('/',auth['isAuthenticated'](),controller[_0x1b82('0xc')]);router[_0x1b82('0xb')](_0x1b82('0x9'),auth[_0x1b82('0x6')](),controller[_0x1b82('0xd')]);router[_0x1b82('0xe')](_0x1b82('0x7'),auth[_0x1b82('0x6')](),controller['update']);router[_0x1b82('0xf')](_0x1b82('0x7'),auth[_0x1b82('0x6')](),controller[_0x1b82('0x10')]);router['delete'](_0x1b82('0x11'),auth['isAuthenticated'](),controller['removeSound']);module[_0x1b82('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 2a7e3b1..314310d 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 _0x6d67=['ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','TIMESTAMP','sequelize','exports','STRING','name'];(function(_0x27c21f,_0x10276e){var _0x2831db=function(_0x4e5101){while(--_0x4e5101){_0x27c21f['push'](_0x27c21f['shift']());}};_0x2831db(++_0x10276e);}(_0x6d67,0x19e));var _0x76d6=function(_0x1f5baf,_0x782936){_0x1f5baf=_0x1f5baf-0x0;var _0x32301c=_0x6d67[_0x1f5baf];return _0x32301c;};'use strict';var Sequelize=require(_0x76d6('0x0'));module[_0x76d6('0x1')]={'name':{'type':Sequelize[_0x76d6('0x2')],'allowNull':![],'unique':_0x76d6('0x3')},'mode':{'type':Sequelize[_0x76d6('0x4')](_0x76d6('0x5'),_0x76d6('0x6'),_0x76d6('0x7'),_0x76d6('0x8'),_0x76d6('0x9'),'mp3'),'allowNull':!![],'defaultValue':_0x76d6('0x6')},'directory':{'type':Sequelize[_0x76d6('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x76d6('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x76d6('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x76d6('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x76d6('0x2')],'allowNull':!![]},'stamp':{'type':_0x76d6('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd90f=['ENUM','files','mp3nb','quietmp3nb','quietmp3','mp3','sequelize','STRING','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd90f,0x1ec));var _0xfd90=function(_0x323830,_0x5e1cb2){_0x323830=_0x323830-0x0;var _0x44a9d4=_0xd90f[_0x323830];return _0x44a9d4;};'use strict';var Sequelize=require(_0xfd90('0x0'));module['exports']={'name':{'type':Sequelize[_0xfd90('0x1')],'allowNull':![],'unique':_0xfd90('0x2')},'mode':{'type':Sequelize[_0xfd90('0x3')]('custom',_0xfd90('0x4'),_0xfd90('0x5'),_0xfd90('0x6'),_0xfd90('0x7'),_0xfd90('0x8')),'allowNull':!![],'defaultValue':_0xfd90('0x4')},'directory':{'type':Sequelize[_0xfd90('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0xfd90('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xfd90('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xfd90('0x1')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xfd90('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'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 3b6224c..606e3d2 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 _0xb1e0=['ioredis','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','name','send','index','VoiceMusicOnHold','rawAttributes','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','map','type','key','VIRTUAL','field','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','body','sequelize','mode','files','directory','join','root','create','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','unlinkSync','ValidationError','message','addSound','Sound','findOne','save_name','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','converted_format','symlinkSync','Sequelize','removeSound','transaction','id2','getSounds','nolimit','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb1e0,0x1af));var _0x0b1e=function(_0x13b313,_0x2ff8c9){_0x13b313=_0x13b313-0x0;var _0x339ebc=_0xb1e0[_0x13b313];return _0x339ebc;};'use strict';var pdf=require(_0x0b1e('0x0'));var emlformat=require(_0x0b1e('0x1'));var rimraf=require(_0x0b1e('0x2'));var zipdir=require(_0x0b1e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0b1e('0x4'));var moment=require('moment');var BPromise=require(_0x0b1e('0x5'));var Mustache=require(_0x0b1e('0x6'));var util=require(_0x0b1e('0x7'));var path=require(_0x0b1e('0x8'));var sox=require(_0x0b1e('0x9'));var csv=require(_0x0b1e('0xa'));var ejs=require(_0x0b1e('0xb'));var fs=require('fs');var _=require(_0x0b1e('0xc'));var squel=require(_0x0b1e('0xd'));var crypto=require(_0x0b1e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0b1e('0xf'));var toCsv=require(_0x0b1e('0xa'));var querystring=require('querystring');var Papa=require(_0x0b1e('0x10'));var authService=require('../../components/auth/service');var hardwareService=require('../../config/license/hardware');var Redis=require(_0x0b1e('0x11'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x0b1e('0x12'));var utils=require(_0x0b1e('0x13'));var config=require(_0x0b1e('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32ac6d,_0x2ff5ec){_0x2ff5ec=_0x2ff5ec||0xcc;return function(_0x325c9c){if(_0x325c9c){return _0x32ac6d[_0x0b1e('0x15')](_0x2ff5ec);}return _0x32ac6d[_0x0b1e('0x16')](_0x2ff5ec)[_0x0b1e('0x17')]();};}function respondWithResult(_0x167c94,_0x421116){_0x421116=_0x421116||0xc8;return function(_0x40a6c9){if(_0x40a6c9){return _0x167c94['status'](_0x421116)[_0x0b1e('0x18')](_0x40a6c9);}};}function respondWithFilteredResult(_0x4677a3,_0x599a05){return function(_0x3f1923){if(_0x3f1923){var _0x1d3f9e=_0x3f1923[_0x0b1e('0x19')],_0x4d3762=_0x599a05[_0x0b1e('0x1a')],_0x29da4a=_0x599a05[_0x0b1e('0x1a')]+_0x599a05[_0x0b1e('0x1b')],_0x1eced1;if(_0x29da4a>=_0x1d3f9e){_0x29da4a=_0x1d3f9e;_0x1eced1=0xc8;}else{_0x1eced1=0xce;}_0x4677a3[_0x0b1e('0x16')](_0x1eced1);return _0x4677a3[_0x0b1e('0x1c')](_0x0b1e('0x1d'),_0x4d3762+'-'+_0x29da4a+'/'+_0x1d3f9e)[_0x0b1e('0x18')](_0x3f1923);}return null;};}function patchUpdates(_0x430a64){return function(_0x36ae56){try{jsonpatch[_0x0b1e('0x1e')](_0x36ae56,_0x430a64,!![]);}catch(_0xe642d5){return BPromise[_0x0b1e('0x1f')](_0xe642d5);}return _0x36ae56[_0x0b1e('0x20')]();};}function saveUpdates(_0x51be50,_0x5e7450){return function(_0x514007){if(_0x514007){return _0x514007[_0x0b1e('0x21')](_0x51be50)[_0x0b1e('0x22')](function(_0x123d7d){return _0x123d7d;});}return null;};}function removeEntity(_0x1d86f3,_0x64f30f){return function(_0x39be5f){if(_0x39be5f){return _0x39be5f[_0x0b1e('0x23')]()[_0x0b1e('0x22')](function(){var _0x5551a3=_0x39be5f[_0x0b1e('0x24')]({'plain':!![]});var _0x2489ac=_0x0b1e('0x25');return db[_0x0b1e('0x26')][_0x0b1e('0x23')]({'where':{'type':_0x2489ac,'resourceId':_0x5551a3['id']}})['then'](function(){return _0x39be5f;});})[_0x0b1e('0x22')](function(){_0x1d86f3[_0x0b1e('0x16')](0xcc)[_0x0b1e('0x17')]();});}};}function handleEntityNotFound(_0x53eb5f,_0x378033){return function(_0x597a5c){if(!_0x597a5c){_0x53eb5f[_0x0b1e('0x15')](0x194);}return _0x597a5c;};}function handleError(_0x1b4466,_0x1d11d4){_0x1d11d4=_0x1d11d4||0x1f4;return function(_0x2cb58c){logger[_0x0b1e('0x27')](_0x2cb58c['stack']);if(_0x2cb58c[_0x0b1e('0x28')]){delete _0x2cb58c[_0x0b1e('0x28')];}_0x1b4466[_0x0b1e('0x16')](_0x1d11d4)[_0x0b1e('0x29')](_0x2cb58c);};}exports[_0x0b1e('0x2a')]=function(_0x27f449,_0x136460){var _0x2f3c28={},_0x1861ae={},_0x37d7bc={'count':0x0,'rows':[]};var _0x415851=db[_0x0b1e('0x2b')][_0x0b1e('0x2c')];_0x1861ae['model']=_[_0x0b1e('0x2d')](_0x415851);_0x1861ae[_0x0b1e('0x2e')]=_[_0x0b1e('0x2d')](_0x27f449['query']);_0x1861ae[_0x0b1e('0x2f')]=_[_0x0b1e('0x30')](_0x1861ae[_0x0b1e('0x31')],_0x1861ae[_0x0b1e('0x2e')]);_0x2f3c28[_0x0b1e('0x32')]=_[_0x0b1e('0x30')](_0x1861ae[_0x0b1e('0x31')],qs[_0x0b1e('0x33')](_0x27f449['query'][_0x0b1e('0x33')]));_0x2f3c28[_0x0b1e('0x32')]=_0x2f3c28[_0x0b1e('0x32')]['length']?_0x2f3c28[_0x0b1e('0x32')]:_0x1861ae['model'];if(!_0x27f449[_0x0b1e('0x2e')][_0x0b1e('0x34')]('nolimit')){_0x2f3c28[_0x0b1e('0x1b')]=qs[_0x0b1e('0x1b')](_0x27f449[_0x0b1e('0x2e')][_0x0b1e('0x1b')]);_0x2f3c28[_0x0b1e('0x1a')]=qs[_0x0b1e('0x1a')](_0x27f449['query'][_0x0b1e('0x1a')]);}_0x2f3c28[_0x0b1e('0x35')]=qs[_0x0b1e('0x36')](_0x27f449['query'][_0x0b1e('0x36')]);_0x2f3c28[_0x0b1e('0x37')]=qs['filters'](_[_0x0b1e('0x38')](_0x27f449[_0x0b1e('0x2e')],_0x1861ae['filters']));if(_0x27f449[_0x0b1e('0x2e')][_0x0b1e('0x39')]){_0x2f3c28[_0x0b1e('0x37')]=_['merge'](_0x2f3c28[_0x0b1e('0x37')],{'$or':_[_0x0b1e('0x3a')](_0x415851,function(_0x5636ad){if(_0x5636ad[_0x0b1e('0x3b')][_0x0b1e('0x3c')]!==_0x0b1e('0x3d')){var _0x6a030e={};_0x6a030e[_0x5636ad[_0x0b1e('0x3e')]]={'$like':'%'+_0x27f449[_0x0b1e('0x2e')]['filter']+'%'};return _0x6a030e;}})});}_0x2f3c28=_[_0x0b1e('0x3f')]({},_0x2f3c28,_0x27f449[_0x0b1e('0x40')]);var _0x43aa50={'where':_0x2f3c28[_0x0b1e('0x37')]};return db[_0x0b1e('0x2b')]['count'](_0x43aa50)[_0x0b1e('0x22')](function(_0x3095d1){_0x37d7bc[_0x0b1e('0x19')]=_0x3095d1;if(_0x27f449['query'][_0x0b1e('0x41')]){_0x2f3c28[_0x0b1e('0x42')]=[{'all':!![]}];}return db[_0x0b1e('0x2b')][_0x0b1e('0x43')](_0x2f3c28);})[_0x0b1e('0x22')](function(_0x30b40e){_0x37d7bc[_0x0b1e('0x44')]=_0x30b40e;return _0x37d7bc;})[_0x0b1e('0x22')](respondWithFilteredResult(_0x136460,_0x2f3c28))[_0x0b1e('0x45')](handleError(_0x136460,null));};exports[_0x0b1e('0x46')]=function(_0x538a6d,_0xa77271){var _0x52fda3={'raw':![],'where':{'id':_0x538a6d[_0x0b1e('0x47')]['id']}},_0x489de3={};_0x489de3[_0x0b1e('0x31')]=_[_0x0b1e('0x2d')](db[_0x0b1e('0x2b')][_0x0b1e('0x2c')]);_0x489de3[_0x0b1e('0x2e')]=_[_0x0b1e('0x2d')](_0x538a6d[_0x0b1e('0x2e')]);_0x489de3[_0x0b1e('0x2f')]=_['intersection'](_0x489de3[_0x0b1e('0x31')],_0x489de3['query']);_0x52fda3['attributes']=_[_0x0b1e('0x30')](_0x489de3[_0x0b1e('0x31')],qs[_0x0b1e('0x33')](_0x538a6d[_0x0b1e('0x2e')][_0x0b1e('0x33')]));_0x52fda3[_0x0b1e('0x32')]=_0x52fda3[_0x0b1e('0x32')][_0x0b1e('0x48')]?_0x52fda3[_0x0b1e('0x32')]:_0x489de3[_0x0b1e('0x31')];if(_0x538a6d[_0x0b1e('0x2e')][_0x0b1e('0x41')]){_0x52fda3[_0x0b1e('0x42')]=[{'all':!![]}];}_0x52fda3=_[_0x0b1e('0x3f')]({},_0x52fda3,_0x538a6d[_0x0b1e('0x40')]);return db[_0x0b1e('0x2b')][_0x0b1e('0x49')](_0x52fda3)[_0x0b1e('0x22')](handleEntityNotFound(_0xa77271,null))[_0x0b1e('0x22')](respondWithResult(_0xa77271,null))['catch'](handleError(_0xa77271,null));};exports[_0x0b1e('0x21')]=function(_0x2837cb,_0x488d51){if(_0x2837cb[_0x0b1e('0x4a')]['id']){delete _0x2837cb[_0x0b1e('0x4a')]['id'];}return db[_0x0b1e('0x2b')]['find']({'where':{'id':_0x2837cb[_0x0b1e('0x47')]['id']}})[_0x0b1e('0x22')](handleEntityNotFound(_0x488d51,null))[_0x0b1e('0x22')](saveUpdates(_0x2837cb['body'],null))['then'](respondWithResult(_0x488d51,null))[_0x0b1e('0x45')](handleError(_0x488d51,null));};exports['create']=function(_0x37a4e4,_0x2154a6,_0x417c5d){return db[_0x0b1e('0x4b')]['transaction'](function(_0x4971de){if(_0x37a4e4[_0x0b1e('0x4a')][_0x0b1e('0x4c')]===_0x0b1e('0x4d')){_0x37a4e4[_0x0b1e('0x4a')][_0x0b1e('0x4e')]=path[_0x0b1e('0x4f')](config[_0x0b1e('0x50')],'server/files/moh',_0x37a4e4[_0x0b1e('0x4a')]['name']);}return db['VoiceMusicOnHold'][_0x0b1e('0x51')](_0x37a4e4[_0x0b1e('0x4a')],{'transaction':_0x4971de})[_0x0b1e('0x22')](function(_0xe081d1){if(_0x37a4e4[_0x0b1e('0x4a')]['mode']===_0x0b1e('0x4d')){fs[_0x0b1e('0x52')](_0xe081d1['directory'],parseInt(_0x0b1e('0x53'),0x8));}var _0x178309=_0x37a4e4[_0x0b1e('0x54')][_0x0b1e('0x24')]({'plain':!![]});if(!_0x178309)throw new Error(_0x0b1e('0x55'));if(_0x178309['role']==='user'){var _0x50ce5c=_0xe081d1[_0x0b1e('0x24')]({'plain':!![]});return db[_0x0b1e('0x56')]['find']({'where':{'name':_0x0b1e('0x25'),'userProfileId':_0x178309[_0x0b1e('0x57')]},'raw':!![]})['then'](function(_0x9c05f9){if(_0x9c05f9&&_0x9c05f9[_0x0b1e('0x58')]===0x0){return db[_0x0b1e('0x26')][_0x0b1e('0x51')]({'name':_0x50ce5c[_0x0b1e('0x28')],'resourceId':_0x50ce5c['id'],'type':_0x9c05f9[_0x0b1e('0x28')],'sectionId':_0x9c05f9['id']},{})[_0x0b1e('0x22')](function(){return _0xe081d1;});}else{return _0xe081d1;}})[_0x0b1e('0x45')](function(_0x32eb55){logger[_0x0b1e('0x27')](_0x0b1e('0x59'),_0x32eb55);});}return _0xe081d1;});})[_0x0b1e('0x22')](respondWithResult(_0x2154a6,0xc9))[_0x0b1e('0x45')](handleError(_0x2154a6,null));};exports[_0x0b1e('0x23')]=function(_0x51ba41,_0x162bef,_0x1f70ba){var _0x4d56c9;return db['VoiceMusicOnHold'][_0x0b1e('0x49')]({'where':{'id':_0x51ba41[_0x0b1e('0x47')]['id']}})[_0x0b1e('0x22')](function(_0xb2c50){if(_0xb2c50){return db['sequelize']['transaction'](function(_0x5879ad){return _0xb2c50[_0x0b1e('0x23')]({'transaction':_0x5879ad,'raw':!![]})['then'](function(_0x18ac78){if(_0x18ac78[_0x0b1e('0x4e')]){fs['readdirSync'](_0x18ac78[_0x0b1e('0x4e')])[_0x0b1e('0x5a')](function(_0x5b71d3){fs[_0x0b1e('0x5b')](path[_0x0b1e('0x4f')](_0x18ac78[_0x0b1e('0x4e')],_0x5b71d3));});fs['rmdirSync'](_0x18ac78[_0x0b1e('0x4e')]);}return _0x18ac78;});})[_0x0b1e('0x45')](function(_0x19c255){throw new db['Sequelize'][(_0x0b1e('0x5c'))](_0x19c255[_0x0b1e('0x5d')]);});}})['then'](handleEntityNotFound(_0x162bef,null))[_0x0b1e('0x22')](removeEntity(_0x162bef,null))[_0x0b1e('0x45')](handleError(_0x162bef,null));};exports[_0x0b1e('0x5e')]=function(_0x31fc27,_0x304161,_0x152951){return db[_0x0b1e('0x4b')]['transaction'](function(_0x5f7cbc){var _0x9f0da5;return db[_0x0b1e('0x2b')][_0x0b1e('0x49')]({'where':{'id':_0x31fc27[_0x0b1e('0x47')]['id']}})['then'](function(_0x1f2b77){if(_0x1f2b77){_0x9f0da5=_0x1f2b77;return _0x1f2b77[_0x0b1e('0x5e')](_0x31fc27[_0x0b1e('0x4a')]['id'],{'transaction':_0x5f7cbc});}})[_0x0b1e('0x22')](function(_0x4ce3e8){if(_0x4ce3e8){return db[_0x0b1e('0x5f')][_0x0b1e('0x60')]({'where':{'id':_0x31fc27['body']['id']},'attributes':['id',_0x0b1e('0x28'),_0x0b1e('0x61'),'converted_format',_0x0b1e('0x62')],'raw':!![]});}})[_0x0b1e('0x22')](function(_0x1b52e0){if(_0x1b52e0){var _0x8d7740=path[_0x0b1e('0x4f')](config[_0x0b1e('0x50')],_0x0b1e('0x63'),util[_0x0b1e('0x64')](_0x0b1e('0x65'),path[_0x0b1e('0x66')](_0x1b52e0[_0x0b1e('0x61')],path[_0x0b1e('0x67')](_0x1b52e0['save_name'])),_0x1b52e0[_0x0b1e('0x68')]));var _0xd2f8f4=path['join'](config[_0x0b1e('0x50')],'server/files/moh',_0x9f0da5[_0x0b1e('0x28')],util[_0x0b1e('0x64')](_0x0b1e('0x65'),_0x1b52e0[_0x0b1e('0x28')],_0x1b52e0[_0x0b1e('0x68')]));fs[_0x0b1e('0x69')](_0x8d7740,_0xd2f8f4);return _0x1b52e0;}})['catch'](function(_0x3450af){throw new db[(_0x0b1e('0x6a'))][(_0x0b1e('0x5c'))](_0x3450af['message']);});})['then'](handleEntityNotFound(_0x304161,null))['then'](respondWithResult(_0x304161,0xc9))[_0x0b1e('0x45')](handleError(_0x304161,null));};exports[_0x0b1e('0x6b')]=function(_0x5eacfc,_0x721f32,_0x5bb9f1){return db[_0x0b1e('0x4b')][_0x0b1e('0x6c')](function(_0x3738f8){var _0xa12b6d;return db[_0x0b1e('0x2b')]['findOne']({'where':{'id':_0x5eacfc[_0x0b1e('0x47')]['id']}})['then'](handleEntityNotFound(_0x721f32,null))[_0x0b1e('0x22')](function(_0x256f23){if(_0x256f23){_0xa12b6d=_0x256f23;return _0x256f23[_0x0b1e('0x6b')](_0x5eacfc[_0x0b1e('0x47')][_0x0b1e('0x6d')]);}})[_0x0b1e('0x22')](function(_0x53b71){if(_0x53b71){return db[_0x0b1e('0x5f')][_0x0b1e('0x60')]({'where':{'id':_0x5eacfc['params'][_0x0b1e('0x6d')]},'attributes':['id',_0x0b1e('0x28'),_0x0b1e('0x61'),'converted_format',_0x0b1e('0x62')],'raw':!![]});}})['then'](function(_0xf221b4){if(_0xf221b4){fs['unlinkSync'](path[_0x0b1e('0x4f')](_0xa12b6d[_0x0b1e('0x4e')],util[_0x0b1e('0x64')](_0x0b1e('0x65'),_0xf221b4[_0x0b1e('0x28')],_0xf221b4[_0x0b1e('0x68')])));return _0xf221b4;}})[_0x0b1e('0x45')](function(_0x5ada67){throw new db[(_0x0b1e('0x6a'))][(_0x0b1e('0x5c'))](_0x5ada67['message']);});})[_0x0b1e('0x22')](handleEntityNotFound(_0x721f32,null))[_0x0b1e('0x22')](respondWithStatusCode(_0x721f32,0xcc))[_0x0b1e('0x45')](handleError(_0x721f32,null));};exports[_0x0b1e('0x6e')]=function(_0x1b7571,_0x3df371,_0x7b0333){var _0x543438={};var _0x3d7618={};var _0x2fb940;var _0xb09af;return db['VoiceMusicOnHold'][_0x0b1e('0x60')]({'where':{'id':_0x1b7571[_0x0b1e('0x47')]['id']}})['then'](handleEntityNotFound(_0x3df371,null))['then'](function(_0x335a19){if(_0x335a19){_0x2fb940=_0x335a19;_0x3d7618[_0x0b1e('0x31')]=_[_0x0b1e('0x2d')](db['Sound'][_0x0b1e('0x2c')]);_0x3d7618[_0x0b1e('0x2e')]=_[_0x0b1e('0x2d')](_0x1b7571[_0x0b1e('0x2e')]);_0x3d7618['filters']=_[_0x0b1e('0x30')](_0x3d7618['model'],_0x3d7618[_0x0b1e('0x2e')]);_0x543438['attributes']=_[_0x0b1e('0x30')](_0x3d7618['model'],qs[_0x0b1e('0x33')](_0x1b7571['query'][_0x0b1e('0x33')]));_0x543438['attributes']=_0x543438['attributes'][_0x0b1e('0x48')]?_0x543438[_0x0b1e('0x32')]:_0x3d7618['model'];_0x543438[_0x0b1e('0x35')]=qs[_0x0b1e('0x36')](_0x1b7571[_0x0b1e('0x2e')][_0x0b1e('0x36')]);_0x543438['where']=qs[_0x0b1e('0x2f')](_[_0x0b1e('0x38')](_0x1b7571[_0x0b1e('0x2e')],_0x3d7618[_0x0b1e('0x2f')]));if(_0x1b7571['query']['filter']){_0x543438[_0x0b1e('0x37')]=_['merge'](_0x543438['where'],{'$or':_[_0x0b1e('0x3a')](_0x543438[_0x0b1e('0x32')],function(_0x5486d9){var _0x52ac27={};_0x52ac27[_0x5486d9]={'$like':'%'+_0x1b7571[_0x0b1e('0x2e')]['filter']+'%'};return _0x52ac27;})});}_0x543438=_[_0x0b1e('0x3f')]({},_0x543438,_0x1b7571[_0x0b1e('0x40')]);return _0x2fb940[_0x0b1e('0x6e')](_0x543438);}})[_0x0b1e('0x22')](function(_0x303ae9){if(_0x303ae9){_0xb09af=_0x303ae9['length'];if(!_0x1b7571[_0x0b1e('0x2e')][_0x0b1e('0x34')](_0x0b1e('0x6f'))){_0x543438['limit']=qs['limit'](_0x1b7571[_0x0b1e('0x2e')][_0x0b1e('0x1b')]);_0x543438[_0x0b1e('0x1a')]=qs[_0x0b1e('0x1a')](_0x1b7571['query']['offset']);}return _0x2fb940[_0x0b1e('0x6e')](_0x543438);}})[_0x0b1e('0x22')](function(_0x5f3d52){if(_0x5f3d52){return _0x5f3d52?{'count':_0xb09af,'rows':_0x5f3d52}:null;}})['then'](respondWithResult(_0x3df371,null))[_0x0b1e('0x45')](handleError(_0x3df371,null));}; \ No newline at end of file +var _0x48b7=['directory','join','root','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','UserProfileResource','readdirSync','forEach','Sequelize','ValidationError','message','addSound','findOne','converted_format','createdAt','format','%s.%s','basename','save_name','extname','server/files/moh','removeSound','Sound','id2','unlinkSync','getSounds','order','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','update','then','get','destroy','stack','name','index','VoiceMusicOnHold','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','count','includeAll','include','findAll','rows','catch','show','params','find','body','create','sequelize','transaction','mode','files'];(function(_0x14ee4f,_0x4bb718){var _0x3d6b1d=function(_0x36e9fe){while(--_0x36e9fe){_0x14ee4f['push'](_0x14ee4f['shift']());}};_0x3d6b1d(++_0x4bb718);}(_0x48b7,0x1d5));var _0x748b=function(_0x2ea40b,_0x3e556a){_0x2ea40b=_0x2ea40b-0x0;var _0x21a686=_0x48b7[_0x2ea40b];return _0x21a686;};'use strict';var pdf=require(_0x748b('0x0'));var emlformat=require(_0x748b('0x1'));var rimraf=require(_0x748b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x748b('0x3'));var rp=require(_0x748b('0x4'));var moment=require(_0x748b('0x5'));var BPromise=require(_0x748b('0x6'));var Mustache=require(_0x748b('0x7'));var util=require(_0x748b('0x8'));var path=require(_0x748b('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x748b('0xa'));var squel=require(_0x748b('0xb'));var crypto=require('crypto');var jsforce=require(_0x748b('0xc'));var deskjs=require(_0x748b('0xd'));var toCsv=require(_0x748b('0xe'));var querystring=require(_0x748b('0xf'));var Papa=require(_0x748b('0x10'));var authService=require(_0x748b('0x11'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require(_0x748b('0x12'));var logger=require(_0x748b('0x13'))(_0x748b('0x14'));var utils=require('../../config/utils');var config=require(_0x748b('0x15'));var db=require(_0x748b('0x16'))['db'];function respondWithStatusCode(_0x5b350b,_0x1db35a){_0x1db35a=_0x1db35a||0xcc;return function(_0x2cedae){if(_0x2cedae){return _0x5b350b[_0x748b('0x17')](_0x1db35a);}return _0x5b350b[_0x748b('0x18')](_0x1db35a)[_0x748b('0x19')]();};}function respondWithResult(_0x950501,_0x15bfdb){_0x15bfdb=_0x15bfdb||0xc8;return function(_0x310973){if(_0x310973){return _0x950501[_0x748b('0x18')](_0x15bfdb)[_0x748b('0x1a')](_0x310973);}};}function respondWithFilteredResult(_0x11789c,_0x2e16ce){return function(_0x1b3a4e){if(_0x1b3a4e){var _0x25ab97=_0x1b3a4e['count'],_0x2a751c=_0x2e16ce['offset'],_0x4c65a8=_0x2e16ce[_0x748b('0x1b')]+_0x2e16ce[_0x748b('0x1c')],_0x251bf9;if(_0x4c65a8>=_0x25ab97){_0x4c65a8=_0x25ab97;_0x251bf9=0xc8;}else{_0x251bf9=0xce;}_0x11789c[_0x748b('0x18')](_0x251bf9);return _0x11789c[_0x748b('0x1d')]('Content-Range',_0x2a751c+'-'+_0x4c65a8+'/'+_0x25ab97)[_0x748b('0x1a')](_0x1b3a4e);}return null;};}function patchUpdates(_0x28160a){return function(_0x326d42){try{jsonpatch[_0x748b('0x1e')](_0x326d42,_0x28160a,!![]);}catch(_0x482ebf){return BPromise['reject'](_0x482ebf);}return _0x326d42['save']();};}function saveUpdates(_0xe6e4d7,_0x1c1be7){return function(_0x4f7e3d){if(_0x4f7e3d){return _0x4f7e3d[_0x748b('0x1f')](_0xe6e4d7)[_0x748b('0x20')](function(_0x12dcdc){return _0x12dcdc;});}return null;};}function removeEntity(_0x6bccdb,_0x1fc51c){return function(_0x3eb151){if(_0x3eb151){return _0x3eb151['destroy']()[_0x748b('0x20')](function(){var _0xa7e1c2=_0x3eb151[_0x748b('0x21')]({'plain':!![]});var _0x117e8b='MusicOnHolds';return db['UserProfileResource'][_0x748b('0x22')]({'where':{'type':_0x117e8b,'resourceId':_0xa7e1c2['id']}})[_0x748b('0x20')](function(){return _0x3eb151;});})['then'](function(){_0x6bccdb['status'](0xcc)[_0x748b('0x19')]();});}};}function handleEntityNotFound(_0x52b17b,_0x18cd55){return function(_0x1db1fc){if(!_0x1db1fc){_0x52b17b['sendStatus'](0x194);}return _0x1db1fc;};}function handleError(_0x2c3716,_0x46ae48){_0x46ae48=_0x46ae48||0x1f4;return function(_0xea72b3){logger['error'](_0xea72b3[_0x748b('0x23')]);if(_0xea72b3[_0x748b('0x24')]){delete _0xea72b3[_0x748b('0x24')];}_0x2c3716[_0x748b('0x18')](_0x46ae48)['send'](_0xea72b3);};}exports[_0x748b('0x25')]=function(_0x4d809e,_0x458bae){var _0x96a53={},_0x1bf886={},_0x3ed0d3={'count':0x0,'rows':[]};var _0x4d640f=db[_0x748b('0x26')][_0x748b('0x27')];_0x1bf886[_0x748b('0x28')]=_[_0x748b('0x29')](_0x4d640f);_0x1bf886[_0x748b('0x2a')]=_['keys'](_0x4d809e[_0x748b('0x2a')]);_0x1bf886[_0x748b('0x2b')]=_[_0x748b('0x2c')](_0x1bf886[_0x748b('0x28')],_0x1bf886[_0x748b('0x2a')]);_0x96a53['attributes']=_[_0x748b('0x2c')](_0x1bf886[_0x748b('0x28')],qs[_0x748b('0x2d')](_0x4d809e[_0x748b('0x2a')]['fields']));_0x96a53[_0x748b('0x2e')]=_0x96a53[_0x748b('0x2e')][_0x748b('0x2f')]?_0x96a53[_0x748b('0x2e')]:_0x1bf886[_0x748b('0x28')];if(!_0x4d809e[_0x748b('0x2a')][_0x748b('0x30')](_0x748b('0x31'))){_0x96a53[_0x748b('0x1c')]=qs[_0x748b('0x1c')](_0x4d809e['query'][_0x748b('0x1c')]);_0x96a53[_0x748b('0x1b')]=qs['offset'](_0x4d809e[_0x748b('0x2a')][_0x748b('0x1b')]);}_0x96a53['order']=qs[_0x748b('0x32')](_0x4d809e['query'][_0x748b('0x32')]);_0x96a53[_0x748b('0x33')]=qs[_0x748b('0x2b')](_[_0x748b('0x34')](_0x4d809e[_0x748b('0x2a')],_0x1bf886['filters']));if(_0x4d809e[_0x748b('0x2a')][_0x748b('0x35')]){_0x96a53['where']=_[_0x748b('0x36')](_0x96a53[_0x748b('0x33')],{'$or':_[_0x748b('0x37')](_0x4d640f,function(_0x5dca8a){if(_0x5dca8a[_0x748b('0x38')][_0x748b('0x39')]!==_0x748b('0x3a')){var _0x51459a={};_0x51459a[_0x5dca8a[_0x748b('0x3b')]]={'$like':'%'+_0x4d809e[_0x748b('0x2a')][_0x748b('0x35')]+'%'};return _0x51459a;}})});}_0x96a53=_[_0x748b('0x36')]({},_0x96a53,_0x4d809e[_0x748b('0x3c')]);var _0x7fd1a1={'where':_0x96a53['where']};return db['VoiceMusicOnHold']['count'](_0x7fd1a1)['then'](function(_0x400e23){_0x3ed0d3[_0x748b('0x3d')]=_0x400e23;if(_0x4d809e[_0x748b('0x2a')][_0x748b('0x3e')]){_0x96a53[_0x748b('0x3f')]=[{'all':!![]}];}return db[_0x748b('0x26')][_0x748b('0x40')](_0x96a53);})[_0x748b('0x20')](function(_0x1b171b){_0x3ed0d3[_0x748b('0x41')]=_0x1b171b;return _0x3ed0d3;})[_0x748b('0x20')](respondWithFilteredResult(_0x458bae,_0x96a53))[_0x748b('0x42')](handleError(_0x458bae,null));};exports[_0x748b('0x43')]=function(_0x505bff,_0x2b844d){var _0x72c83f={'raw':![],'where':{'id':_0x505bff[_0x748b('0x44')]['id']}},_0x577004={};_0x577004[_0x748b('0x28')]=_['keys'](db[_0x748b('0x26')][_0x748b('0x27')]);_0x577004[_0x748b('0x2a')]=_[_0x748b('0x29')](_0x505bff[_0x748b('0x2a')]);_0x577004['filters']=_[_0x748b('0x2c')](_0x577004[_0x748b('0x28')],_0x577004[_0x748b('0x2a')]);_0x72c83f['attributes']=_['intersection'](_0x577004['model'],qs[_0x748b('0x2d')](_0x505bff['query'][_0x748b('0x2d')]));_0x72c83f[_0x748b('0x2e')]=_0x72c83f[_0x748b('0x2e')][_0x748b('0x2f')]?_0x72c83f['attributes']:_0x577004[_0x748b('0x28')];if(_0x505bff[_0x748b('0x2a')][_0x748b('0x3e')]){_0x72c83f[_0x748b('0x3f')]=[{'all':!![]}];}_0x72c83f=_[_0x748b('0x36')]({},_0x72c83f,_0x505bff[_0x748b('0x3c')]);return db['VoiceMusicOnHold'][_0x748b('0x45')](_0x72c83f)[_0x748b('0x20')](handleEntityNotFound(_0x2b844d,null))['then'](respondWithResult(_0x2b844d,null))[_0x748b('0x42')](handleError(_0x2b844d,null));};exports[_0x748b('0x1f')]=function(_0x1c8355,_0xc29baf){if(_0x1c8355[_0x748b('0x46')]['id']){delete _0x1c8355[_0x748b('0x46')]['id'];}return db['VoiceMusicOnHold'][_0x748b('0x45')]({'where':{'id':_0x1c8355[_0x748b('0x44')]['id']}})[_0x748b('0x20')](handleEntityNotFound(_0xc29baf,null))[_0x748b('0x20')](saveUpdates(_0x1c8355['body'],null))['then'](respondWithResult(_0xc29baf,null))[_0x748b('0x42')](handleError(_0xc29baf,null));};exports[_0x748b('0x47')]=function(_0x328360,_0x395cb2,_0x2d5e2f){return db[_0x748b('0x48')][_0x748b('0x49')](function(_0xa4b7a0){if(_0x328360[_0x748b('0x46')][_0x748b('0x4a')]===_0x748b('0x4b')){_0x328360[_0x748b('0x46')][_0x748b('0x4c')]=path[_0x748b('0x4d')](config[_0x748b('0x4e')],'server/files/moh',_0x328360['body']['name']);}return db[_0x748b('0x26')]['create'](_0x328360[_0x748b('0x46')],{'transaction':_0xa4b7a0})['then'](function(_0x58d2af){if(_0x328360[_0x748b('0x46')][_0x748b('0x4a')]===_0x748b('0x4b')){fs[_0x748b('0x4f')](_0x58d2af[_0x748b('0x4c')],parseInt(_0x748b('0x50'),0x8));}var _0x398738=_0x328360['user'][_0x748b('0x21')]({'plain':!![]});if(!_0x398738)throw new Error(_0x748b('0x51'));if(_0x398738[_0x748b('0x52')]==='user'){var _0x330b33=_0x58d2af[_0x748b('0x21')]({'plain':!![]});return db[_0x748b('0x53')][_0x748b('0x45')]({'where':{'name':_0x748b('0x54'),'userProfileId':_0x398738[_0x748b('0x55')]},'raw':!![]})[_0x748b('0x20')](function(_0x1fc5d2){if(_0x1fc5d2&&_0x1fc5d2[_0x748b('0x56')]===0x0){return db[_0x748b('0x57')][_0x748b('0x47')]({'name':_0x330b33[_0x748b('0x24')],'resourceId':_0x330b33['id'],'type':_0x1fc5d2['name'],'sectionId':_0x1fc5d2['id']},{})[_0x748b('0x20')](function(){return _0x58d2af;});}else{return _0x58d2af;}})[_0x748b('0x42')](function(_0x238526){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x238526);});}return _0x58d2af;});})[_0x748b('0x20')](respondWithResult(_0x395cb2,0xc9))['catch'](handleError(_0x395cb2,null));};exports[_0x748b('0x22')]=function(_0x5f44c1,_0x556db9,_0x2f1a95){var _0x3ff188;return db[_0x748b('0x26')][_0x748b('0x45')]({'where':{'id':_0x5f44c1[_0x748b('0x44')]['id']}})[_0x748b('0x20')](function(_0x18e1cf){if(_0x18e1cf){return db[_0x748b('0x48')][_0x748b('0x49')](function(_0x227e08){return _0x18e1cf[_0x748b('0x22')]({'transaction':_0x227e08,'raw':!![]})[_0x748b('0x20')](function(_0x4be414){if(_0x4be414['directory']){fs[_0x748b('0x58')](_0x4be414['directory'])[_0x748b('0x59')](function(_0x59f2e3){fs['unlinkSync'](path['join'](_0x4be414[_0x748b('0x4c')],_0x59f2e3));});fs['rmdirSync'](_0x4be414[_0x748b('0x4c')]);}return _0x4be414;});})['catch'](function(_0x45f082){throw new db[(_0x748b('0x5a'))][(_0x748b('0x5b'))](_0x45f082[_0x748b('0x5c')]);});}})['then'](handleEntityNotFound(_0x556db9,null))[_0x748b('0x20')](removeEntity(_0x556db9,null))['catch'](handleError(_0x556db9,null));};exports['addSound']=function(_0x5442ab,_0xe60467,_0x584f82){return db[_0x748b('0x48')]['transaction'](function(_0x41357c){var _0xf01ff6;return db[_0x748b('0x26')][_0x748b('0x45')]({'where':{'id':_0x5442ab[_0x748b('0x44')]['id']}})[_0x748b('0x20')](function(_0x4f1faf){if(_0x4f1faf){_0xf01ff6=_0x4f1faf;return _0x4f1faf[_0x748b('0x5d')](_0x5442ab[_0x748b('0x46')]['id'],{'transaction':_0x41357c});}})[_0x748b('0x20')](function(_0x333617){if(_0x333617){return db['Sound'][_0x748b('0x5e')]({'where':{'id':_0x5442ab[_0x748b('0x46')]['id']},'attributes':['id',_0x748b('0x24'),'save_name',_0x748b('0x5f'),_0x748b('0x60')],'raw':!![]});}})[_0x748b('0x20')](function(_0x4fd8fb){if(_0x4fd8fb){var _0x2c048d=path[_0x748b('0x4d')](config['root'],'server/files/sounds/converted',util[_0x748b('0x61')](_0x748b('0x62'),path[_0x748b('0x63')](_0x4fd8fb[_0x748b('0x64')],path[_0x748b('0x65')](_0x4fd8fb[_0x748b('0x64')])),_0x4fd8fb[_0x748b('0x5f')]));var _0x30ebd2=path[_0x748b('0x4d')](config['root'],_0x748b('0x66'),_0xf01ff6[_0x748b('0x24')],util[_0x748b('0x61')]('%s.%s',_0x4fd8fb['name'],_0x4fd8fb['converted_format']));fs['symlinkSync'](_0x2c048d,_0x30ebd2);return _0x4fd8fb;}})[_0x748b('0x42')](function(_0x465014){throw new db[(_0x748b('0x5a'))]['ValidationError'](_0x465014[_0x748b('0x5c')]);});})[_0x748b('0x20')](handleEntityNotFound(_0xe60467,null))[_0x748b('0x20')](respondWithResult(_0xe60467,0xc9))['catch'](handleError(_0xe60467,null));};exports[_0x748b('0x67')]=function(_0x8210f2,_0x58f3ab,_0x5d7a55){return db[_0x748b('0x48')][_0x748b('0x49')](function(_0x474a73){var _0x5f08df;return db[_0x748b('0x26')]['findOne']({'where':{'id':_0x8210f2[_0x748b('0x44')]['id']}})['then'](handleEntityNotFound(_0x58f3ab,null))[_0x748b('0x20')](function(_0x420737){if(_0x420737){_0x5f08df=_0x420737;return _0x420737[_0x748b('0x67')](_0x8210f2['params']['id2']);}})[_0x748b('0x20')](function(_0x528176){if(_0x528176){return db[_0x748b('0x68')]['findOne']({'where':{'id':_0x8210f2[_0x748b('0x44')][_0x748b('0x69')]},'attributes':['id','name',_0x748b('0x64'),_0x748b('0x5f'),'createdAt'],'raw':!![]});}})[_0x748b('0x20')](function(_0x2df38d){if(_0x2df38d){fs[_0x748b('0x6a')](path[_0x748b('0x4d')](_0x5f08df[_0x748b('0x4c')],util[_0x748b('0x61')](_0x748b('0x62'),_0x2df38d[_0x748b('0x24')],_0x2df38d[_0x748b('0x5f')])));return _0x2df38d;}})[_0x748b('0x42')](function(_0x4c5868){throw new db[(_0x748b('0x5a'))][(_0x748b('0x5b'))](_0x4c5868[_0x748b('0x5c')]);});})[_0x748b('0x20')](handleEntityNotFound(_0x58f3ab,null))['then'](respondWithStatusCode(_0x58f3ab,0xcc))[_0x748b('0x42')](handleError(_0x58f3ab,null));};exports[_0x748b('0x6b')]=function(_0x29de61,_0x1c5f60,_0x3a9020){var _0x4fae11={};var _0x1076ca={};var _0x127ec7;var _0x105824;return db[_0x748b('0x26')][_0x748b('0x5e')]({'where':{'id':_0x29de61[_0x748b('0x44')]['id']}})[_0x748b('0x20')](handleEntityNotFound(_0x1c5f60,null))['then'](function(_0x397d76){if(_0x397d76){_0x127ec7=_0x397d76;_0x1076ca[_0x748b('0x28')]=_['keys'](db['Sound'][_0x748b('0x27')]);_0x1076ca[_0x748b('0x2a')]=_['keys'](_0x29de61[_0x748b('0x2a')]);_0x1076ca['filters']=_[_0x748b('0x2c')](_0x1076ca[_0x748b('0x28')],_0x1076ca[_0x748b('0x2a')]);_0x4fae11[_0x748b('0x2e')]=_['intersection'](_0x1076ca[_0x748b('0x28')],qs[_0x748b('0x2d')](_0x29de61['query'][_0x748b('0x2d')]));_0x4fae11[_0x748b('0x2e')]=_0x4fae11[_0x748b('0x2e')]['length']?_0x4fae11[_0x748b('0x2e')]:_0x1076ca[_0x748b('0x28')];_0x4fae11[_0x748b('0x6c')]=qs['sort'](_0x29de61[_0x748b('0x2a')][_0x748b('0x32')]);_0x4fae11[_0x748b('0x33')]=qs[_0x748b('0x2b')](_[_0x748b('0x34')](_0x29de61[_0x748b('0x2a')],_0x1076ca[_0x748b('0x2b')]));if(_0x29de61[_0x748b('0x2a')][_0x748b('0x35')]){_0x4fae11[_0x748b('0x33')]=_[_0x748b('0x36')](_0x4fae11['where'],{'$or':_[_0x748b('0x37')](_0x4fae11[_0x748b('0x2e')],function(_0x405e90){var _0x533e06={};_0x533e06[_0x405e90]={'$like':'%'+_0x29de61[_0x748b('0x2a')][_0x748b('0x35')]+'%'};return _0x533e06;})});}_0x4fae11=_[_0x748b('0x36')]({},_0x4fae11,_0x29de61[_0x748b('0x3c')]);return _0x127ec7['getSounds'](_0x4fae11);}})['then'](function(_0x5326ae){if(_0x5326ae){_0x105824=_0x5326ae['length'];if(!_0x29de61[_0x748b('0x2a')][_0x748b('0x30')](_0x748b('0x31'))){_0x4fae11['limit']=qs[_0x748b('0x1c')](_0x29de61[_0x748b('0x2a')][_0x748b('0x1c')]);_0x4fae11[_0x748b('0x1b')]=qs[_0x748b('0x1b')](_0x29de61['query'][_0x748b('0x1b')]);}return _0x127ec7[_0x748b('0x6b')](_0x4fae11);}})[_0x748b('0x20')](function(_0xdaad63){if(_0xdaad63){return _0xdaad63?{'count':_0x105824,'rows':_0xdaad63}:null;}})[_0x748b('0x20')](respondWithResult(_0x1c5f60,null))[_0x748b('0x42')](handleError(_0x1c5f60,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 97017c2..ca13635 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 _0x59b9=['./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x28c567,_0x534b59){var _0x3579ce=function(_0x4af643){while(--_0x4af643){_0x28c567['push'](_0x28c567['shift']());}};_0x3579ce(++_0x534b59);}(_0x59b9,0x14e));var _0x959b=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x59b9[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x959b('0x0'));var util=require(_0x959b('0x1'));var logger=require(_0x959b('0x2'))(_0x959b('0x3'));var moment=require(_0x959b('0x4'));var BPromise=require(_0x959b('0x5'));var rp=require(_0x959b('0x6'));var attributes=require(_0x959b('0x7'));module[_0x959b('0x8')]=function(_0x11f52e,_0x2215b2){return _0x11f52e[_0x959b('0x9')](_0x959b('0xa'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9558=['../../config/logger','api','moment','bluebird','./voiceMusicOnHold.attributes','exports','define','lodash','util'];(function(_0x44599f,_0x12bba9){var _0x1969b5=function(_0x54895f){while(--_0x54895f){_0x44599f['push'](_0x44599f['shift']());}};_0x1969b5(++_0x12bba9);}(_0x9558,0x181));var _0x8955=function(_0x4f270c,_0x469a4d){_0x4f270c=_0x4f270c-0x0;var _0x1be88e=_0x9558[_0x4f270c];return _0x1be88e;};'use strict';var _=require(_0x8955('0x0'));var util=require(_0x8955('0x1'));var logger=require(_0x8955('0x2'))(_0x8955('0x3'));var moment=require(_0x8955('0x4'));var BPromise=require(_0x8955('0x5'));var rp=require('request-promise');var attributes=require(_0x8955('0x6'));module[_0x8955('0x7')]=function(_0x19ac22,_0x39c097){return _0x19ac22[_0x8955('0x8')]('VoiceMusicOnHold',attributes,{'tableName':'voice_musiconhold','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 8412fc3..968b0ee 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 _0x4ecf=['then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request'];(function(_0x4dbdc4,_0x4d2e00){var _0xcf4eee=function(_0x4223c1){while(--_0x4223c1){_0x4dbdc4['push'](_0x4dbdc4['shift']());}};_0xcf4eee(++_0x4d2e00);}(_0x4ecf,0x186));var _0xf4ec=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x4ecf[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xf4ec('0x0'));var util=require(_0xf4ec('0x1'));var moment=require('moment');var BPromise=require(_0xf4ec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4ec('0x3'))['db'];var utils=require(_0xf4ec('0x4'));var logger=require('../../config/logger')(_0xf4ec('0x5'));var config=require(_0xf4ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf4ec('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a8988,_0xd21f52,_0x213f0a){return new BPromise(function(_0x313c1e,_0x44054a){return client[_0xf4ec('0x8')](_0x2a8988,_0x213f0a)[_0xf4ec('0x9')](function(_0x2048a2){logger[_0xf4ec('0xa')](_0xf4ec('0xb'),_0xd21f52,_0xf4ec('0xc'));logger[_0xf4ec('0xd')](_0xf4ec('0xe'),_0xd21f52,_0xf4ec('0xc'),JSON[_0xf4ec('0xf')](_0x2048a2));if(_0x2048a2['error']){if(_0x2048a2[_0xf4ec('0x10')][_0xf4ec('0x11')]===0x1f4){logger[_0xf4ec('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xd21f52,_0x2048a2['error']['message']);return _0x44054a(_0x2048a2[_0xf4ec('0x10')]['message']);}logger[_0xf4ec('0x10')](_0xf4ec('0xb'),_0xd21f52,_0x2048a2['error'][_0xf4ec('0x12')]);return _0x313c1e(_0x2048a2[_0xf4ec('0x10')][_0xf4ec('0x12')]);}else{logger[_0xf4ec('0xa')](_0xf4ec('0xb'),_0xd21f52,'request\x20sent');_0x313c1e(_0x2048a2[_0xf4ec('0x13')][_0xf4ec('0x12')]);}})[_0xf4ec('0x14')](function(_0x13df84){logger[_0xf4ec('0x10')](_0xf4ec('0xb'),_0xd21f52,_0x13df84);_0x44054a(_0x13df84);});});} \ No newline at end of file +var _0xb28a=['catch','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x5f189b,_0xc7e235){var _0x256f5f=function(_0x238e04){while(--_0x238e04){_0x5f189b['push'](_0x5f189b['shift']());}};_0x256f5f(++_0xc7e235);}(_0xb28a,0x166));var _0xab28=function(_0x293aa5,_0x1aa2d8){_0x293aa5=_0x293aa5-0x0;var _0x1a0982=_0xb28a[_0x293aa5];return _0x1a0982;};'use strict';var _=require('lodash');var util=require(_0xab28('0x0'));var moment=require(_0xab28('0x1'));var BPromise=require('bluebird');var rs=require(_0xab28('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xab28('0x3'))(_0xab28('0x4'));var config=require(_0xab28('0x5'));var jayson=require(_0xab28('0x6'));var client=jayson[_0xab28('0x7')][_0xab28('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x450e5b,_0x3b2507,_0x48949b){return new BPromise(function(_0x479267,_0x294e36){return client[_0xab28('0x9')](_0x450e5b,_0x48949b)[_0xab28('0xa')](function(_0x2508ef){logger[_0xab28('0xb')](_0xab28('0xc'),_0x3b2507,'request\x20sent');logger[_0xab28('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x3b2507,_0xab28('0xe'),JSON[_0xab28('0xf')](_0x2508ef));if(_0x2508ef[_0xab28('0x10')]){if(_0x2508ef[_0xab28('0x10')][_0xab28('0x11')]===0x1f4){logger[_0xab28('0x10')](_0xab28('0xc'),_0x3b2507,_0x2508ef[_0xab28('0x10')]['message']);return _0x294e36(_0x2508ef[_0xab28('0x10')][_0xab28('0x12')]);}logger[_0xab28('0x10')](_0xab28('0xc'),_0x3b2507,_0x2508ef[_0xab28('0x10')][_0xab28('0x12')]);return _0x479267(_0x2508ef['error']['message']);}else{logger[_0xab28('0xb')](_0xab28('0xc'),_0x3b2507,_0xab28('0xe'));_0x479267(_0x2508ef[_0xab28('0x13')]['message']);}})[_0xab28('0x14')](function(_0x4912fa){logger[_0xab28('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3b2507,_0x4912fa);_0x294e36(_0x4912fa);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index bc95739..9453cb2 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 _0x261b=['getAgents','post','create','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','/:id/users'];(function(_0x250b46,_0x134118){var _0x3c5d3f=function(_0x65350a){while(--_0x65350a){_0x250b46['push'](_0x250b46['shift']());}};_0x3c5d3f(++_0x134118);}(_0x261b,0x15a));var _0xb261=function(_0x513c19,_0xa9907c){_0x513c19=_0x513c19-0x0;var _0x5d4250=_0x261b[_0x513c19];return _0x5d4250;};'use strict';var multer=require(_0xb261('0x0'));var util=require(_0xb261('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xb261('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xb261('0x3'));var controller=require('./voicePrefix.controller');router[_0xb261('0x4')]('/',auth['isAuthenticated'](),controller[_0xb261('0x5')]);router[_0xb261('0x4')](_0xb261('0x6'),auth[_0xb261('0x7')](),controller['describe']);router[_0xb261('0x4')](_0xb261('0x8'),auth[_0xb261('0x7')](),controller[_0xb261('0x9')]);router['get'](_0xb261('0xa'),auth[_0xb261('0x7')](),controller[_0xb261('0xb')]);router[_0xb261('0xc')]('/',auth[_0xb261('0x7')](),controller[_0xb261('0xd')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xb261('0xe')]);router[_0xb261('0xf')](_0xb261('0x8'),auth[_0xb261('0x7')](),controller[_0xb261('0x10')]);router[_0xb261('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xb261('0x12')]);router[_0xb261('0x11')](_0xb261('0xa'),auth[_0xb261('0x7')](),controller[_0xb261('0x13')]);module[_0xb261('0x14')]=router; \ No newline at end of file +var _0xc89e=['update','destroy','delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','/:id/users','addAgents'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc89e,0x10c));var _0xec89=function(_0x42ac98,_0x5b7782){_0x42ac98=_0x42ac98-0x0;var _0xed4224=_0xc89e[_0x42ac98];return _0xed4224;};'use strict';var multer=require('multer');var util=require(_0xec89('0x0'));var path=require(_0xec89('0x1'));var timeout=require(_0xec89('0x2'));var express=require(_0xec89('0x3'));var router=express['Router']();var auth=require(_0xec89('0x4'));var interaction=require(_0xec89('0x5'));var config=require(_0xec89('0x6'));var controller=require('./voicePrefix.controller');router[_0xec89('0x7')]('/',auth[_0xec89('0x8')](),controller[_0xec89('0x9')]);router[_0xec89('0x7')](_0xec89('0xa'),auth[_0xec89('0x8')](),controller[_0xec89('0xb')]);router[_0xec89('0x7')](_0xec89('0xc'),auth['isAuthenticated'](),controller[_0xec89('0xd')]);router[_0xec89('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xec89('0xe')]('/',auth['isAuthenticated'](),controller[_0xec89('0xf')]);router[_0xec89('0xe')](_0xec89('0x10'),auth[_0xec89('0x8')](),controller[_0xec89('0x11')]);router['put'](_0xec89('0xc'),auth[_0xec89('0x8')](),controller[_0xec89('0x12')]);router['delete'](_0xec89('0xc'),auth[_0xec89('0x8')](),controller[_0xec89('0x13')]);router[_0xec89('0x14')](_0xec89('0x10'),auth[_0xec89('0x8')](),controller['removeAgents']);module[_0xec89('0x15')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index a37c313..830b541 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 _0x99cc=['name','VIRTUAL','getDataValue','INTEGER','sequelize','exports','STRING'];(function(_0x554292,_0x82948a){var _0x3dd555=function(_0xab7590){while(--_0xab7590){_0x554292['push'](_0x554292['shift']());}};_0x3dd555(++_0x82948a);}(_0x99cc,0xdd));var _0xc99c=function(_0x50ca6d,_0x56af9a){_0x50ca6d=_0x50ca6d-0x0;var _0x25311a=_0x99cc[_0x50ca6d];return _0x25311a;};'use strict';var Sequelize=require(_0xc99c('0x0'));module[_0xc99c('0x1')]={'name':{'type':Sequelize[_0xc99c('0x2')],'allowNull':![],'unique':_0xc99c('0x3')},'prefix':{'type':Sequelize[_0xc99c('0x4')],'get':function(_0x17cf70){return'system-'+this[_0xc99c('0x5')](_0xc99c('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xc99c('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xc99c('0x6')]}}; \ No newline at end of file +var _0xed28=['STRING','INTEGER','name','system-','getDataValue'];(function(_0x673eb0,_0x4f2ee4){var _0xe49c68=function(_0x4a3ada){while(--_0x4a3ada){_0x673eb0['push'](_0x673eb0['shift']());}};_0xe49c68(++_0x4f2ee4);}(_0xed28,0x93));var _0x8ed2=function(_0x431598,_0x34983e){_0x431598=_0x431598-0x0;var _0x4a40b4=_0xed28[_0x431598];return _0x4a40b4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8ed2('0x0')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x5acb67){return _0x8ed2('0x1')+this[_0x8ed2('0x2')](_0x8ed2('0x0'))+'-';}},'description':{'type':Sequelize[_0x8ed2('0x3')]},'callerIdAll':{'type':Sequelize[_0x8ed2('0x3')]},'VoiceExtensionId':{'type':Sequelize[_0x8ed2('0x4')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 8350754..07b7747 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 _0xa9e0=['includeAll','include','rows','catch','show','params','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoicePrefixes','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','charAt','system-','findById','addAgents','omit','ids','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','pick','getAgents','nolimit','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','error','stack','name','index','VoicePrefix','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','map','type','key','VIRTUAL','options'];(function(_0x63046e,_0x4af842){var _0x2073ce=function(_0x855db0){while(--_0x855db0){_0x63046e['push'](_0x63046e['shift']());}};_0x2073ce(++_0x4af842);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var authService=require(_0x0a9e('0xe'));var hardwareService=require(_0x0a9e('0xf'));var Redis=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0a9e('0x13')]=_[_0x0a9e('0x14')](config[_0x0a9e('0x13')],{'host':_0x0a9e('0x15'),'port':0x18eb});var socket=require(_0x0a9e('0x16'))(new Redis(config[_0x0a9e('0x13')]));require('./voicePrefix.socket')[_0x0a9e('0x17')](socket);function respondWithStatusCode(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xcc;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x18')](_0x2b4227);}return _0x239b12[_0x0a9e('0x19')](_0x2b4227)['end']();};}function respondWithResult(_0x22dccb,_0x5d0880){_0x5d0880=_0x5d0880||0xc8;return function(_0x1985b6){if(_0x1985b6){return _0x22dccb['status'](_0x5d0880)[_0x0a9e('0x1a')](_0x1985b6);}};}function respondWithFilteredResult(_0x12066b,_0x48f32d){return function(_0x225616){if(_0x225616){var _0x5a0a06=_0x225616[_0x0a9e('0x1b')],_0x459eb1=_0x48f32d[_0x0a9e('0x1c')],_0x478723=_0x48f32d[_0x0a9e('0x1c')]+_0x48f32d[_0x0a9e('0x1d')],_0x106033;if(_0x478723>=_0x5a0a06){_0x478723=_0x5a0a06;_0x106033=0xc8;}else{_0x106033=0xce;}_0x12066b[_0x0a9e('0x19')](_0x106033);return _0x12066b[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x459eb1+'-'+_0x478723+'/'+_0x5a0a06)[_0x0a9e('0x1a')](_0x225616);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x20')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x21')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x22')](_0x5a09ef)[_0x0a9e('0x23')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){var _0x370d86=_0x2fb0e4[_0x0a9e('0x25')]({'plain':!![]});var _0x16b1ca='VoicePrefixes';return db['UserProfileResource'][_0x0a9e('0x24')]({'where':{'type':_0x16b1ca,'resourceId':_0x370d86['id']}})[_0x0a9e('0x23')](function(){return _0x2fb0e4;});})[_0x0a9e('0x23')](function(){_0x4abc77[_0x0a9e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x26')](_0x25fba9[_0x0a9e('0x27')]);if(_0x25fba9[_0x0a9e('0x28')]){delete _0x25fba9[_0x0a9e('0x28')];}_0x1dc186[_0x0a9e('0x19')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x29')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};var _0x40e7a3=db[_0x0a9e('0x2a')][_0x0a9e('0x2b')];_0x5c877d[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x40e7a3);_0x5c877d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x468813[_0x0a9e('0x2e')]);_0x5c877d['filters']=_[_0x0a9e('0x2f')](_0x5c877d['model'],_0x5c877d[_0x0a9e('0x2e')]);_0x2ec755[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5c877d[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x468813['query'][_0x0a9e('0x31')]));_0x2ec755[_0x0a9e('0x30')]=_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x2ec755[_0x0a9e('0x30')]:_0x5c877d[_0x0a9e('0x2c')];if(!_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x2ec755[_0x0a9e('0x1d')]=qs['limit'](_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x2ec755[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x468813['query'][_0x0a9e('0x1c')]);}_0x2ec755[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x468813[_0x0a9e('0x2e')]['sort']);_0x2ec755['where']=qs[_0x0a9e('0x36')](_['pick'](_0x468813[_0x0a9e('0x2e')],_0x5c877d[_0x0a9e('0x36')]));if(_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]){_0x2ec755['where']=_[_0x0a9e('0x38')](_0x2ec755[_0x0a9e('0x39')],{'$or':_[_0x0a9e('0x3a')](_0x40e7a3,function(_0x533942){if(_0x533942[_0x0a9e('0x3b')][_0x0a9e('0x3c')]!==_0x0a9e('0x3d')){var _0x4c1c0e={};_0x4c1c0e[_0x533942['field']]={'$like':'%'+_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x4c1c0e;}})});}_0x2ec755=_['merge']({},_0x2ec755,_0x468813[_0x0a9e('0x3e')]);var _0x419125={'where':_0x2ec755[_0x0a9e('0x39')]};return db[_0x0a9e('0x2a')]['count'](_0x419125)['then'](function(_0x15e37d){_0x15b200[_0x0a9e('0x1b')]=_0x15e37d;if(_0x468813['query'][_0x0a9e('0x3f')]){_0x2ec755[_0x0a9e('0x40')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')]['findAll'](_0x2ec755);})[_0x0a9e('0x23')](function(_0x2cfea9){_0x15b200[_0x0a9e('0x41')]=_0x2cfea9;return _0x15b200;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x2b1f27,_0x2ec755))[_0x0a9e('0x42')](handleError(_0x2b1f27,null));};exports[_0x0a9e('0x43')]=function(_0x2881b3,_0x45a9b8){var _0x23b089={'raw':![],'where':{'id':_0x2881b3[_0x0a9e('0x44')]['id']}},_0x3da2cd={};_0x3da2cd[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x3da2cd['query']=_['keys'](_0x2881b3[_0x0a9e('0x2e')]);_0x3da2cd[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],_0x3da2cd[_0x0a9e('0x2e')]);_0x23b089[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x23b089[_0x0a9e('0x30')]=_0x23b089['attributes'][_0x0a9e('0x32')]?_0x23b089[_0x0a9e('0x30')]:_0x3da2cd[_0x0a9e('0x2c')];if(_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x3f')]){_0x23b089[_0x0a9e('0x40')]=[{'all':!![]}];}_0x23b089=_[_0x0a9e('0x38')]({},_0x23b089,_0x2881b3[_0x0a9e('0x3e')]);return db['VoicePrefix'][_0x0a9e('0x45')](_0x23b089)['then'](handleEntityNotFound(_0x45a9b8,null))[_0x0a9e('0x23')](respondWithResult(_0x45a9b8,null))[_0x0a9e('0x42')](handleError(_0x45a9b8,null));};exports[_0x0a9e('0x24')]=function(_0x562fb4,_0x14bec2){return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x562fb4[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x14bec2,null))[_0x0a9e('0x23')](removeEntity(_0x14bec2,null))[_0x0a9e('0x42')](handleError(_0x14bec2,null));};exports['describe']=function(_0x13f44d,_0x1bde3c){return db[_0x0a9e('0x2a')][_0x0a9e('0x46')]()[_0x0a9e('0x23')](respondWithResult(_0x1bde3c,null))[_0x0a9e('0x42')](handleError(_0x1bde3c,null));};exports[_0x0a9e('0x47')]=function(_0x19383e,_0x34febd){var _0x58a5c2;return db[_0x0a9e('0x48')][_0x0a9e('0x49')](function(_0x4f7240){return db['VoicePrefix']['create'](_0x19383e[_0x0a9e('0x4a')],{'transaction':_0x4f7240})[_0x0a9e('0x23')](function(_0x37edaa){_0x58a5c2=_0x37edaa[_0x0a9e('0x25')]({'plain':!![]});return db[_0x0a9e('0x4b')][_0x0a9e('0x45')]({'where':{'id':_0x58a5c2[_0x0a9e('0x4c')]},'raw':!![]})[_0x0a9e('0x23')](function(_0x5d38ae){return createVoicePrefixExtensions(_0x58a5c2,_0x5d38ae,_0x4f7240);});});})['then'](function(){var _0x53975a=_0x19383e[_0x0a9e('0x4d')][_0x0a9e('0x25')]({'plain':!![]});if(!_0x53975a)throw new Error(_0x0a9e('0x4e'));if(_0x53975a['role']===_0x0a9e('0x4d')){var _0x161aa7=_0x58a5c2;return db['UserProfileSection']['find']({'where':{'name':_0x0a9e('0x4f'),'userProfileId':_0x53975a['userProfileId']},'raw':!![]})[_0x0a9e('0x23')](function(_0x4c3845){if(_0x4c3845&&_0x4c3845[_0x0a9e('0x50')]===0x0){return db[_0x0a9e('0x51')][_0x0a9e('0x47')]({'name':_0x161aa7['name'],'resourceId':_0x161aa7['id'],'type':_0x4c3845[_0x0a9e('0x28')],'sectionId':_0x4c3845['id']},{})[_0x0a9e('0x23')](function(){return _0x58a5c2;});}else{return _0x58a5c2;}})['catch'](function(_0x50f687){logger[_0x0a9e('0x26')](_0x0a9e('0x52'),_0x50f687);throw _0x50f687;});}return _0x58a5c2;})['then'](respondWithResult(_0x34febd,null))[_0x0a9e('0x42')](handleError(_0x34febd,null));};function Extension(_0x5ce9ac,_0x211ef9,_0x523cd2,_0xe22ccc){this['context']='from-sip';this['exten']=_0x5ce9ac;this[_0x0a9e('0x53')]=_0x523cd2;this['type']=_0x0a9e('0x54');this[_0x0a9e('0x55')]=_0x0a9e('0x56');this[_0x0a9e('0x57')]=_0x211ef9;this[_0x0a9e('0x58')]=_0xe22ccc;}function createVoicePrefixExtensions(_0x272738,_0xd10662,_0x28d814){return new BPromise(function(_0x4e67ab,_0x1c693e){var _0x121cef=new Extension(formatPrefixName(_0x272738[_0x0a9e('0x59')]),0x1,_0x0a9e('0x5a'),_0x0a9e('0x5b'));_0x121cef[_0x0a9e('0x5c')]=_0x272738['id'];return db['VoiceExtension'][_0x0a9e('0x47')](_0x121cef,{'transaction':_0x28d814})[_0x0a9e('0x23')](function(_0x5239ef){var _0x3649cc=_0x5239ef['get']({'plain':!![]});var _0x20c668=_['map'](addVoicePrefixExtensions(_0x272738,_0xd10662),function(_0x4b3c1a){_0x4b3c1a['VoiceExtensionId']=_0x3649cc['id'];_0x4b3c1a[_0x0a9e('0x5c')]=_0x272738['id'];return _0x4b3c1a;});return db['VoiceExtension'][_0x0a9e('0x5d')](_0x20c668,{'transaction':_0x28d814})[_0x0a9e('0x23')](function(_0x261adb){if(!_0x261adb){return _0x1c693e(_0x0a9e('0x5e'));}else{return _0x4e67ab(_0x261adb);}})[_0x0a9e('0x42')](function(_0x26d7db){return _0x1c693e(_0x26d7db);});});;});};function addVoicePrefixExtensions(_0x49eed0,_0x1627a7){var _0x5854cc=[];var _0xca4ade=formatPrefixName(_0x49eed0[_0x0a9e('0x59')]);_0x5854cc[_0x0a9e('0x5f')](new Extension(_0xca4ade,0x2,'Set',_0x0a9e('0x60')+_0x49eed0[_0x0a9e('0x28')]));if(_0x49eed0[_0x0a9e('0x61')]){_0x5854cc[_0x0a9e('0x5f')](new Extension(_0xca4ade,0x3,'Set',_0x0a9e('0x62')+_0x49eed0[_0x0a9e('0x61')]));}else{_0x5854cc['push'](new Extension(_0xca4ade,0x3,_0x0a9e('0x5a'),_0x0a9e('0x63')));}_0x5854cc[_0x0a9e('0x5f')](new Extension(_0xca4ade,0x4,_0x0a9e('0x64'),_0x1627a7[_0x0a9e('0x65')]+','+'${EXTEN:'+(0x8+_0x49eed0[_0x0a9e('0x28')][_0x0a9e('0x32')])+'}'+','+0x1));return _0x5854cc;}function formatPrefixName(_0x281c7d){var _0x47bb43='_';for(var _0x3528b7=0x0;_0x3528b7<_0x281c7d['length'];_0x3528b7++){if(_0x281c7d['charAt'](_0x3528b7)=='-'){_0x47bb43+=_0x281c7d[_0x0a9e('0x66')](_0x3528b7);}else{_0x47bb43+='['+_0x281c7d[_0x0a9e('0x66')](_0x3528b7)+']';}}_0x47bb43+='.';return _0x47bb43;}exports[_0x0a9e('0x22')]=function(_0x19c995,_0x186f39,_0xc8c264){var _0x387489=_0x19c995[_0x0a9e('0x4a')];_0x387489[_0x0a9e('0x59')]=_0x0a9e('0x67')+_0x387489[_0x0a9e('0x28')]+'-';return db[_0x0a9e('0x48')][_0x0a9e('0x49')](function(_0x2b8192){return db[_0x0a9e('0x2a')][_0x0a9e('0x22')](_0x387489,{'where':{'id':_0x387489['id']},'transaction':_0x2b8192})[_0x0a9e('0x23')](function(){return db[_0x0a9e('0x4b')]['destroy']({'where':{'VoicePrefixId':_0x387489['id']},'transaction':_0x2b8192})[_0x0a9e('0x23')](function(){return db[_0x0a9e('0x4b')][_0x0a9e('0x45')]({'where':{'id':_0x387489['VoiceExtensionId']},'raw':!![]})[_0x0a9e('0x23')](function(_0x30944e){return createVoicePrefixExtensions(_0x387489,_0x30944e,_0x2b8192);});});});})['then'](function(){return db[_0x0a9e('0x2a')][_0x0a9e('0x68')](_0x387489['id']);})[_0x0a9e('0x23')](respondWithResult(_0x186f39,null))[_0x0a9e('0x42')](handleError(_0x186f39,null));};exports[_0x0a9e('0x69')]=function(_0x4a43a8,_0x50cdce,_0x4a2438){return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x4a43a8[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x50cdce,null))[_0x0a9e('0x23')](function(_0x380ab3){if(_0x380ab3){return _0x380ab3[_0x0a9e('0x69')](_0x4a43a8[_0x0a9e('0x4a')]['ids'],_[_0x0a9e('0x6a')](_0x4a43a8[_0x0a9e('0x4a')],[_0x0a9e('0x6b'),'id'])||{})['spread'](function(_0x2bdc44){for(var _0x583b2e=0x0;_0x583b2e<_0x4a43a8[_0x0a9e('0x4a')][_0x0a9e('0x6b')]['length'];_0x583b2e+=0x1){socket[_0x0a9e('0x6c')](_0x0a9e('0x6d'),{'UserId':_0x4a43a8[_0x0a9e('0x4a')][_0x0a9e('0x6b')][_0x583b2e],'VoicePrefixId':_0x4a43a8['params']['id']});}return _0x2bdc44;});}})[_0x0a9e('0x23')](respondWithResult(_0x50cdce,null))[_0x0a9e('0x42')](handleError(_0x50cdce,null));};exports[_0x0a9e('0x6e')]=function(_0x278ab4,_0x5b7fc3,_0x109ccb){var _0x3d91db;return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x278ab4['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x5b7fc3,null))[_0x0a9e('0x23')](function(_0x30a4c7){if(_0x30a4c7){return _0x30a4c7[_0x0a9e('0x6e')](_0x278ab4[_0x0a9e('0x2e')][_0x0a9e('0x6b')])[_0x0a9e('0x23')](function(_0x3df0e3){if(_[_0x0a9e('0x6f')](_0x278ab4[_0x0a9e('0x2e')][_0x0a9e('0x6b')])){for(var _0x1f10ef=0x0;_0x1f10ef<_0x278ab4[_0x0a9e('0x2e')][_0x0a9e('0x6b')]['length'];_0x1f10ef+=0x1){socket[_0x0a9e('0x6c')](_0x0a9e('0x70'),{'UserId':_0x278ab4[_0x0a9e('0x2e')]['ids'][_0x1f10ef],'VoicePrefixId':_0x278ab4[_0x0a9e('0x44')]['id']});}}else{socket[_0x0a9e('0x6c')](_0x0a9e('0x70'),{'UserId':_0x278ab4[_0x0a9e('0x2e')]['ids'],'VoicePrefixId':_0x278ab4['params']['id']});}});}})[_0x0a9e('0x23')](respondWithStatusCode(_0x5b7fc3,null))[_0x0a9e('0x42')](handleError(_0x5b7fc3,null));};exports['getAgents']=function(_0x45108c,_0x53a6a1,_0x260f4b){var _0x8ebf02={};var _0x5637a1={};var _0x28a942;var _0x41cf12;return db[_0x0a9e('0x2a')][_0x0a9e('0x71')]({'where':{'id':_0x45108c[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x53a6a1,null))[_0x0a9e('0x23')](function(_0x482ca2){if(_0x482ca2){_0x28a942=_0x482ca2;_0x5637a1[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x72')][_0x0a9e('0x2b')]);_0x5637a1['query']=_[_0x0a9e('0x2d')](_0x45108c[_0x0a9e('0x2e')]);_0x5637a1['filters']=_[_0x0a9e('0x2f')](_0x5637a1['model'],_0x5637a1[_0x0a9e('0x2e')]);_0x8ebf02[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5637a1[_0x0a9e('0x2c')],qs['fields'](_0x45108c['query'][_0x0a9e('0x31')]));_0x8ebf02[_0x0a9e('0x30')]=_0x8ebf02[_0x0a9e('0x30')]['length']?_0x8ebf02[_0x0a9e('0x30')]:_0x5637a1[_0x0a9e('0x2c')];_0x8ebf02['order']=qs['sort'](_0x45108c[_0x0a9e('0x2e')]['sort']);_0x8ebf02['where']=qs['filters'](_[_0x0a9e('0x73')](_0x45108c[_0x0a9e('0x2e')],_0x5637a1[_0x0a9e('0x36')]));if(_0x45108c[_0x0a9e('0x2e')][_0x0a9e('0x37')]){_0x8ebf02[_0x0a9e('0x39')]=_['merge'](_0x8ebf02[_0x0a9e('0x39')],{'$or':_['map'](_0x8ebf02[_0x0a9e('0x30')],function(_0x2aabab){var _0x18ad56={};_0x18ad56[_0x2aabab]={'$like':'%'+_0x45108c[_0x0a9e('0x2e')]['filter']+'%'};return _0x18ad56;})});}_0x8ebf02=_[_0x0a9e('0x38')]({},_0x8ebf02,_0x45108c[_0x0a9e('0x3e')]);return _0x28a942[_0x0a9e('0x74')](_0x8ebf02);}})['then'](function(_0xb6e411){if(_0xb6e411){_0x41cf12=_0xb6e411[_0x0a9e('0x32')];if(!_0x45108c[_0x0a9e('0x2e')][_0x0a9e('0x33')](_0x0a9e('0x75'))){_0x8ebf02[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x45108c[_0x0a9e('0x2e')]['limit']);_0x8ebf02[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x45108c['query'][_0x0a9e('0x1c')]);}return _0x28a942[_0x0a9e('0x74')](_0x8ebf02);}})[_0x0a9e('0x23')](function(_0x5a26c8){if(_0x5a26c8){return _0x5a26c8?{'count':_0x41cf12,'rows':_0x5a26c8}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x53a6a1,null))['catch'](handleError(_0x53a6a1,null));}; \ No newline at end of file +var _0xa9e0=['includeAll','include','rows','catch','show','params','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoicePrefixes','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','charAt','system-','findById','addAgents','omit','ids','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','pick','getAgents','nolimit','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','error','stack','name','index','VoicePrefix','rawAttributes','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','map','type','key','VIRTUAL','options'];(function(_0x7376fe,_0x13b94f){var _0xb4db76=function(_0x15159f){while(--_0x15159f){_0x7376fe['push'](_0x7376fe['shift']());}};_0xb4db76(++_0x13b94f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var authService=require(_0x0a9e('0xe'));var hardwareService=require(_0x0a9e('0xf'));var Redis=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var logger=require(_0x0a9e('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0a9e('0x13')]=_[_0x0a9e('0x14')](config[_0x0a9e('0x13')],{'host':_0x0a9e('0x15'),'port':0x18eb});var socket=require(_0x0a9e('0x16'))(new Redis(config[_0x0a9e('0x13')]));require('./voicePrefix.socket')[_0x0a9e('0x17')](socket);function respondWithStatusCode(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xcc;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x18')](_0x2b4227);}return _0x239b12[_0x0a9e('0x19')](_0x2b4227)['end']();};}function respondWithResult(_0x22dccb,_0x5d0880){_0x5d0880=_0x5d0880||0xc8;return function(_0x1985b6){if(_0x1985b6){return _0x22dccb['status'](_0x5d0880)[_0x0a9e('0x1a')](_0x1985b6);}};}function respondWithFilteredResult(_0x12066b,_0x48f32d){return function(_0x225616){if(_0x225616){var _0x5a0a06=_0x225616[_0x0a9e('0x1b')],_0x459eb1=_0x48f32d[_0x0a9e('0x1c')],_0x478723=_0x48f32d[_0x0a9e('0x1c')]+_0x48f32d[_0x0a9e('0x1d')],_0x106033;if(_0x478723>=_0x5a0a06){_0x478723=_0x5a0a06;_0x106033=0xc8;}else{_0x106033=0xce;}_0x12066b[_0x0a9e('0x19')](_0x106033);return _0x12066b[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x459eb1+'-'+_0x478723+'/'+_0x5a0a06)[_0x0a9e('0x1a')](_0x225616);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x20')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x21')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x22')](_0x5a09ef)[_0x0a9e('0x23')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){var _0x370d86=_0x2fb0e4[_0x0a9e('0x25')]({'plain':!![]});var _0x16b1ca='VoicePrefixes';return db['UserProfileResource'][_0x0a9e('0x24')]({'where':{'type':_0x16b1ca,'resourceId':_0x370d86['id']}})[_0x0a9e('0x23')](function(){return _0x2fb0e4;});})[_0x0a9e('0x23')](function(){_0x4abc77[_0x0a9e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x384319,_0x479bc4){return function(_0x45a1e7){if(!_0x45a1e7){_0x384319['sendStatus'](0x194);}return _0x45a1e7;};}function handleError(_0x1dc186,_0x34dc65){_0x34dc65=_0x34dc65||0x1f4;return function(_0x25fba9){logger[_0x0a9e('0x26')](_0x25fba9[_0x0a9e('0x27')]);if(_0x25fba9[_0x0a9e('0x28')]){delete _0x25fba9[_0x0a9e('0x28')];}_0x1dc186[_0x0a9e('0x19')](_0x34dc65)['send'](_0x25fba9);};}exports[_0x0a9e('0x29')]=function(_0x468813,_0x2b1f27){var _0x2ec755={},_0x5c877d={},_0x15b200={'count':0x0,'rows':[]};var _0x40e7a3=db[_0x0a9e('0x2a')][_0x0a9e('0x2b')];_0x5c877d[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x40e7a3);_0x5c877d[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x468813[_0x0a9e('0x2e')]);_0x5c877d['filters']=_[_0x0a9e('0x2f')](_0x5c877d['model'],_0x5c877d[_0x0a9e('0x2e')]);_0x2ec755[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5c877d[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x468813['query'][_0x0a9e('0x31')]));_0x2ec755[_0x0a9e('0x30')]=_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x2ec755[_0x0a9e('0x30')]:_0x5c877d[_0x0a9e('0x2c')];if(!_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x33')]('nolimit')){_0x2ec755[_0x0a9e('0x1d')]=qs['limit'](_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x1d')]);_0x2ec755[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x468813['query'][_0x0a9e('0x1c')]);}_0x2ec755[_0x0a9e('0x34')]=qs[_0x0a9e('0x35')](_0x468813[_0x0a9e('0x2e')]['sort']);_0x2ec755['where']=qs[_0x0a9e('0x36')](_['pick'](_0x468813[_0x0a9e('0x2e')],_0x5c877d[_0x0a9e('0x36')]));if(_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]){_0x2ec755['where']=_[_0x0a9e('0x38')](_0x2ec755[_0x0a9e('0x39')],{'$or':_[_0x0a9e('0x3a')](_0x40e7a3,function(_0x533942){if(_0x533942[_0x0a9e('0x3b')][_0x0a9e('0x3c')]!==_0x0a9e('0x3d')){var _0x4c1c0e={};_0x4c1c0e[_0x533942['field']]={'$like':'%'+_0x468813[_0x0a9e('0x2e')][_0x0a9e('0x37')]+'%'};return _0x4c1c0e;}})});}_0x2ec755=_['merge']({},_0x2ec755,_0x468813[_0x0a9e('0x3e')]);var _0x419125={'where':_0x2ec755[_0x0a9e('0x39')]};return db[_0x0a9e('0x2a')]['count'](_0x419125)['then'](function(_0x15e37d){_0x15b200[_0x0a9e('0x1b')]=_0x15e37d;if(_0x468813['query'][_0x0a9e('0x3f')]){_0x2ec755[_0x0a9e('0x40')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')]['findAll'](_0x2ec755);})[_0x0a9e('0x23')](function(_0x2cfea9){_0x15b200[_0x0a9e('0x41')]=_0x2cfea9;return _0x15b200;})[_0x0a9e('0x23')](respondWithFilteredResult(_0x2b1f27,_0x2ec755))[_0x0a9e('0x42')](handleError(_0x2b1f27,null));};exports[_0x0a9e('0x43')]=function(_0x2881b3,_0x45a9b8){var _0x23b089={'raw':![],'where':{'id':_0x2881b3[_0x0a9e('0x44')]['id']}},_0x3da2cd={};_0x3da2cd[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x3da2cd['query']=_['keys'](_0x2881b3[_0x0a9e('0x2e')]);_0x3da2cd[_0x0a9e('0x36')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],_0x3da2cd[_0x0a9e('0x2e')]);_0x23b089[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x3da2cd[_0x0a9e('0x2c')],qs[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x31')]));_0x23b089[_0x0a9e('0x30')]=_0x23b089['attributes'][_0x0a9e('0x32')]?_0x23b089[_0x0a9e('0x30')]:_0x3da2cd[_0x0a9e('0x2c')];if(_0x2881b3[_0x0a9e('0x2e')][_0x0a9e('0x3f')]){_0x23b089[_0x0a9e('0x40')]=[{'all':!![]}];}_0x23b089=_[_0x0a9e('0x38')]({},_0x23b089,_0x2881b3[_0x0a9e('0x3e')]);return db['VoicePrefix'][_0x0a9e('0x45')](_0x23b089)['then'](handleEntityNotFound(_0x45a9b8,null))[_0x0a9e('0x23')](respondWithResult(_0x45a9b8,null))[_0x0a9e('0x42')](handleError(_0x45a9b8,null));};exports[_0x0a9e('0x24')]=function(_0x562fb4,_0x14bec2){return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x562fb4[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x14bec2,null))[_0x0a9e('0x23')](removeEntity(_0x14bec2,null))[_0x0a9e('0x42')](handleError(_0x14bec2,null));};exports['describe']=function(_0x13f44d,_0x1bde3c){return db[_0x0a9e('0x2a')][_0x0a9e('0x46')]()[_0x0a9e('0x23')](respondWithResult(_0x1bde3c,null))[_0x0a9e('0x42')](handleError(_0x1bde3c,null));};exports[_0x0a9e('0x47')]=function(_0x19383e,_0x34febd){var _0x58a5c2;return db[_0x0a9e('0x48')][_0x0a9e('0x49')](function(_0x4f7240){return db['VoicePrefix']['create'](_0x19383e[_0x0a9e('0x4a')],{'transaction':_0x4f7240})[_0x0a9e('0x23')](function(_0x37edaa){_0x58a5c2=_0x37edaa[_0x0a9e('0x25')]({'plain':!![]});return db[_0x0a9e('0x4b')][_0x0a9e('0x45')]({'where':{'id':_0x58a5c2[_0x0a9e('0x4c')]},'raw':!![]})[_0x0a9e('0x23')](function(_0x5d38ae){return createVoicePrefixExtensions(_0x58a5c2,_0x5d38ae,_0x4f7240);});});})['then'](function(){var _0x53975a=_0x19383e[_0x0a9e('0x4d')][_0x0a9e('0x25')]({'plain':!![]});if(!_0x53975a)throw new Error(_0x0a9e('0x4e'));if(_0x53975a['role']===_0x0a9e('0x4d')){var _0x161aa7=_0x58a5c2;return db['UserProfileSection']['find']({'where':{'name':_0x0a9e('0x4f'),'userProfileId':_0x53975a['userProfileId']},'raw':!![]})[_0x0a9e('0x23')](function(_0x4c3845){if(_0x4c3845&&_0x4c3845[_0x0a9e('0x50')]===0x0){return db[_0x0a9e('0x51')][_0x0a9e('0x47')]({'name':_0x161aa7['name'],'resourceId':_0x161aa7['id'],'type':_0x4c3845[_0x0a9e('0x28')],'sectionId':_0x4c3845['id']},{})[_0x0a9e('0x23')](function(){return _0x58a5c2;});}else{return _0x58a5c2;}})['catch'](function(_0x50f687){logger[_0x0a9e('0x26')](_0x0a9e('0x52'),_0x50f687);throw _0x50f687;});}return _0x58a5c2;})['then'](respondWithResult(_0x34febd,null))[_0x0a9e('0x42')](handleError(_0x34febd,null));};function Extension(_0x5ce9ac,_0x211ef9,_0x523cd2,_0xe22ccc){this['context']='from-sip';this['exten']=_0x5ce9ac;this[_0x0a9e('0x53')]=_0x523cd2;this['type']=_0x0a9e('0x54');this[_0x0a9e('0x55')]=_0x0a9e('0x56');this[_0x0a9e('0x57')]=_0x211ef9;this[_0x0a9e('0x58')]=_0xe22ccc;}function createVoicePrefixExtensions(_0x272738,_0xd10662,_0x28d814){return new BPromise(function(_0x4e67ab,_0x1c693e){var _0x121cef=new Extension(formatPrefixName(_0x272738[_0x0a9e('0x59')]),0x1,_0x0a9e('0x5a'),_0x0a9e('0x5b'));_0x121cef[_0x0a9e('0x5c')]=_0x272738['id'];return db['VoiceExtension'][_0x0a9e('0x47')](_0x121cef,{'transaction':_0x28d814})[_0x0a9e('0x23')](function(_0x5239ef){var _0x3649cc=_0x5239ef['get']({'plain':!![]});var _0x20c668=_['map'](addVoicePrefixExtensions(_0x272738,_0xd10662),function(_0x4b3c1a){_0x4b3c1a['VoiceExtensionId']=_0x3649cc['id'];_0x4b3c1a[_0x0a9e('0x5c')]=_0x272738['id'];return _0x4b3c1a;});return db['VoiceExtension'][_0x0a9e('0x5d')](_0x20c668,{'transaction':_0x28d814})[_0x0a9e('0x23')](function(_0x261adb){if(!_0x261adb){return _0x1c693e(_0x0a9e('0x5e'));}else{return _0x4e67ab(_0x261adb);}})[_0x0a9e('0x42')](function(_0x26d7db){return _0x1c693e(_0x26d7db);});});;});};function addVoicePrefixExtensions(_0x49eed0,_0x1627a7){var _0x5854cc=[];var _0xca4ade=formatPrefixName(_0x49eed0[_0x0a9e('0x59')]);_0x5854cc[_0x0a9e('0x5f')](new Extension(_0xca4ade,0x2,'Set',_0x0a9e('0x60')+_0x49eed0[_0x0a9e('0x28')]));if(_0x49eed0[_0x0a9e('0x61')]){_0x5854cc[_0x0a9e('0x5f')](new Extension(_0xca4ade,0x3,'Set',_0x0a9e('0x62')+_0x49eed0[_0x0a9e('0x61')]));}else{_0x5854cc['push'](new Extension(_0xca4ade,0x3,_0x0a9e('0x5a'),_0x0a9e('0x63')));}_0x5854cc[_0x0a9e('0x5f')](new Extension(_0xca4ade,0x4,_0x0a9e('0x64'),_0x1627a7[_0x0a9e('0x65')]+','+'${EXTEN:'+(0x8+_0x49eed0[_0x0a9e('0x28')][_0x0a9e('0x32')])+'}'+','+0x1));return _0x5854cc;}function formatPrefixName(_0x281c7d){var _0x47bb43='_';for(var _0x3528b7=0x0;_0x3528b7<_0x281c7d['length'];_0x3528b7++){if(_0x281c7d['charAt'](_0x3528b7)=='-'){_0x47bb43+=_0x281c7d[_0x0a9e('0x66')](_0x3528b7);}else{_0x47bb43+='['+_0x281c7d[_0x0a9e('0x66')](_0x3528b7)+']';}}_0x47bb43+='.';return _0x47bb43;}exports[_0x0a9e('0x22')]=function(_0x19c995,_0x186f39,_0xc8c264){var _0x387489=_0x19c995[_0x0a9e('0x4a')];_0x387489[_0x0a9e('0x59')]=_0x0a9e('0x67')+_0x387489[_0x0a9e('0x28')]+'-';return db[_0x0a9e('0x48')][_0x0a9e('0x49')](function(_0x2b8192){return db[_0x0a9e('0x2a')][_0x0a9e('0x22')](_0x387489,{'where':{'id':_0x387489['id']},'transaction':_0x2b8192})[_0x0a9e('0x23')](function(){return db[_0x0a9e('0x4b')]['destroy']({'where':{'VoicePrefixId':_0x387489['id']},'transaction':_0x2b8192})[_0x0a9e('0x23')](function(){return db[_0x0a9e('0x4b')][_0x0a9e('0x45')]({'where':{'id':_0x387489['VoiceExtensionId']},'raw':!![]})[_0x0a9e('0x23')](function(_0x30944e){return createVoicePrefixExtensions(_0x387489,_0x30944e,_0x2b8192);});});});})['then'](function(){return db[_0x0a9e('0x2a')][_0x0a9e('0x68')](_0x387489['id']);})[_0x0a9e('0x23')](respondWithResult(_0x186f39,null))[_0x0a9e('0x42')](handleError(_0x186f39,null));};exports[_0x0a9e('0x69')]=function(_0x4a43a8,_0x50cdce,_0x4a2438){return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x4a43a8[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x50cdce,null))[_0x0a9e('0x23')](function(_0x380ab3){if(_0x380ab3){return _0x380ab3[_0x0a9e('0x69')](_0x4a43a8[_0x0a9e('0x4a')]['ids'],_[_0x0a9e('0x6a')](_0x4a43a8[_0x0a9e('0x4a')],[_0x0a9e('0x6b'),'id'])||{})['spread'](function(_0x2bdc44){for(var _0x583b2e=0x0;_0x583b2e<_0x4a43a8[_0x0a9e('0x4a')][_0x0a9e('0x6b')]['length'];_0x583b2e+=0x1){socket[_0x0a9e('0x6c')](_0x0a9e('0x6d'),{'UserId':_0x4a43a8[_0x0a9e('0x4a')][_0x0a9e('0x6b')][_0x583b2e],'VoicePrefixId':_0x4a43a8['params']['id']});}return _0x2bdc44;});}})[_0x0a9e('0x23')](respondWithResult(_0x50cdce,null))[_0x0a9e('0x42')](handleError(_0x50cdce,null));};exports[_0x0a9e('0x6e')]=function(_0x278ab4,_0x5b7fc3,_0x109ccb){var _0x3d91db;return db[_0x0a9e('0x2a')][_0x0a9e('0x45')]({'where':{'id':_0x278ab4['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x5b7fc3,null))[_0x0a9e('0x23')](function(_0x30a4c7){if(_0x30a4c7){return _0x30a4c7[_0x0a9e('0x6e')](_0x278ab4[_0x0a9e('0x2e')][_0x0a9e('0x6b')])[_0x0a9e('0x23')](function(_0x3df0e3){if(_[_0x0a9e('0x6f')](_0x278ab4[_0x0a9e('0x2e')][_0x0a9e('0x6b')])){for(var _0x1f10ef=0x0;_0x1f10ef<_0x278ab4[_0x0a9e('0x2e')][_0x0a9e('0x6b')]['length'];_0x1f10ef+=0x1){socket[_0x0a9e('0x6c')](_0x0a9e('0x70'),{'UserId':_0x278ab4[_0x0a9e('0x2e')]['ids'][_0x1f10ef],'VoicePrefixId':_0x278ab4[_0x0a9e('0x44')]['id']});}}else{socket[_0x0a9e('0x6c')](_0x0a9e('0x70'),{'UserId':_0x278ab4[_0x0a9e('0x2e')]['ids'],'VoicePrefixId':_0x278ab4['params']['id']});}});}})[_0x0a9e('0x23')](respondWithStatusCode(_0x5b7fc3,null))[_0x0a9e('0x42')](handleError(_0x5b7fc3,null));};exports['getAgents']=function(_0x45108c,_0x53a6a1,_0x260f4b){var _0x8ebf02={};var _0x5637a1={};var _0x28a942;var _0x41cf12;return db[_0x0a9e('0x2a')][_0x0a9e('0x71')]({'where':{'id':_0x45108c[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x53a6a1,null))[_0x0a9e('0x23')](function(_0x482ca2){if(_0x482ca2){_0x28a942=_0x482ca2;_0x5637a1[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x72')][_0x0a9e('0x2b')]);_0x5637a1['query']=_[_0x0a9e('0x2d')](_0x45108c[_0x0a9e('0x2e')]);_0x5637a1['filters']=_[_0x0a9e('0x2f')](_0x5637a1['model'],_0x5637a1[_0x0a9e('0x2e')]);_0x8ebf02[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x5637a1[_0x0a9e('0x2c')],qs['fields'](_0x45108c['query'][_0x0a9e('0x31')]));_0x8ebf02[_0x0a9e('0x30')]=_0x8ebf02[_0x0a9e('0x30')]['length']?_0x8ebf02[_0x0a9e('0x30')]:_0x5637a1[_0x0a9e('0x2c')];_0x8ebf02['order']=qs['sort'](_0x45108c[_0x0a9e('0x2e')]['sort']);_0x8ebf02['where']=qs['filters'](_[_0x0a9e('0x73')](_0x45108c[_0x0a9e('0x2e')],_0x5637a1[_0x0a9e('0x36')]));if(_0x45108c[_0x0a9e('0x2e')][_0x0a9e('0x37')]){_0x8ebf02[_0x0a9e('0x39')]=_['merge'](_0x8ebf02[_0x0a9e('0x39')],{'$or':_['map'](_0x8ebf02[_0x0a9e('0x30')],function(_0x2aabab){var _0x18ad56={};_0x18ad56[_0x2aabab]={'$like':'%'+_0x45108c[_0x0a9e('0x2e')]['filter']+'%'};return _0x18ad56;})});}_0x8ebf02=_[_0x0a9e('0x38')]({},_0x8ebf02,_0x45108c[_0x0a9e('0x3e')]);return _0x28a942[_0x0a9e('0x74')](_0x8ebf02);}})['then'](function(_0xb6e411){if(_0xb6e411){_0x41cf12=_0xb6e411[_0x0a9e('0x32')];if(!_0x45108c[_0x0a9e('0x2e')][_0x0a9e('0x33')](_0x0a9e('0x75'))){_0x8ebf02[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x45108c[_0x0a9e('0x2e')]['limit']);_0x8ebf02[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x45108c['query'][_0x0a9e('0x1c')]);}return _0x28a942[_0x0a9e('0x74')](_0x8ebf02);}})[_0x0a9e('0x23')](function(_0x5a26c8){if(_0x5a26c8){return _0x5a26c8?{'count':_0x41cf12,'rows':_0x5a26c8}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x53a6a1,null))['catch'](handleError(_0x53a6a1,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index a18f628..299102b 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 _0xae24=['hook','exports','events','VoicePrefix','save','update','emit','hasOwnProperty'];(function(_0x3645cc,_0x25ba47){var _0x351979=function(_0x5829a0){while(--_0x5829a0){_0x3645cc['push'](_0x3645cc['shift']());}};_0x351979(++_0x25ba47);}(_0xae24,0x182));var _0x4ae2=function(_0x2f7e06,_0x391dd8){_0x2f7e06=_0x2f7e06-0x0;var _0x50c81a=_0xae24[_0x2f7e06];return _0x50c81a;};'use strict';var EventEmitter=require(_0x4ae2('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x4ae2('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4ae2('0x2'),'afterUpdate':_0x4ae2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5b6f4d){return function(_0x1afc7a,_0x5b25b5,_0x2ed9ff){VoicePrefixEvents[_0x4ae2('0x4')](_0x5b6f4d+':'+_0x1afc7a['id'],_0x1afc7a);VoicePrefixEvents[_0x4ae2('0x4')](_0x5b6f4d,_0x1afc7a);_0x2ed9ff(null);};}for(var e in events){if(events[_0x4ae2('0x5')](e)){var event=events[e];VoicePrefix[_0x4ae2('0x6')](e,emitEvent(event));}}module[_0x4ae2('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0x17ba=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xd89ec,_0xe75af4){var _0x5b8870=function(_0xf55b12){while(--_0xf55b12){_0xd89ec['push'](_0xd89ec['shift']());}};_0x5b8870(++_0xe75af4);}(_0x17ba,0xab));var _0xa17b=function(_0xc92480,_0x4918b2){_0xc92480=_0xc92480-0x0;var _0x517d08=_0x17ba[_0xc92480];return _0x517d08;};'use strict';var EventEmitter=require(_0xa17b('0x0'));var VoicePrefix=require(_0xa17b('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xa17b('0x2')](0x0);var events={'afterCreate':_0xa17b('0x3'),'afterUpdate':_0xa17b('0x4'),'afterDestroy':_0xa17b('0x5')};function emitEvent(_0x106b5b){return function(_0x38c13c,_0x11d7b7,_0x2f64d0){VoicePrefixEvents[_0xa17b('0x6')](_0x106b5b+':'+_0x38c13c['id'],_0x38c13c);VoicePrefixEvents[_0xa17b('0x6')](_0x106b5b,_0x38c13c);_0x2f64d0(null);};}for(var e in events){if(events[_0xa17b('0x7')](e)){var event=events[e];VoicePrefix[_0xa17b('0x8')](e,emitEvent(event));}}module[_0xa17b('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index aaa7b72..01a9ec9 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 _0x2b83=['../../config/logger','moment','bluebird','request-promise','VoicePrefix','util'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x2b83,0x1d3));var _0x32b8=function(_0x331ab7,_0x3d4069){_0x331ab7=_0x331ab7-0x0;var _0x35e560=_0x2b83[_0x331ab7];return _0x35e560;};'use strict';var _=require('lodash');var util=require(_0x32b8('0x0'));var logger=require(_0x32b8('0x1'))('api');var moment=require(_0x32b8('0x2'));var BPromise=require(_0x32b8('0x3'));var rp=require(_0x32b8('0x4'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0xdd712a,_0x1cc832){return _0xdd712a['define'](_0x32b8('0x5'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5cb5=['moment','bluebird','request-promise','exports','define','VoicePrefix','voice_prefixes','lodash','../../config/logger','api'];(function(_0x5e0fb7,_0x22f6d2){var _0x150dbd=function(_0x716dd3){while(--_0x716dd3){_0x5e0fb7['push'](_0x5e0fb7['shift']());}};_0x150dbd(++_0x22f6d2);}(_0x5cb5,0xd9));var _0x55cb=function(_0x50ef4b,_0x46d84d){_0x50ef4b=_0x50ef4b-0x0;var _0x1ac700=_0x5cb5[_0x50ef4b];return _0x1ac700;};'use strict';var _=require(_0x55cb('0x0'));var util=require('util');var logger=require(_0x55cb('0x1'))(_0x55cb('0x2'));var moment=require(_0x55cb('0x3'));var BPromise=require(_0x55cb('0x4'));var rp=require(_0x55cb('0x5'));var attributes=require('./voicePrefix.attributes');module[_0x55cb('0x6')]=function(_0x16f697,_0x335bac){return _0x16f697[_0x55cb('0x7')](_0x55cb('0x8'),attributes,{'tableName':_0x55cb('0x9'),'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 ec5b2a2..052776b 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 _0x43b4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x21ffd5,_0x182023){var _0x31b1d9=function(_0x4ccc09){while(--_0x4ccc09){_0x21ffd5['push'](_0x21ffd5['shift']());}};_0x31b1d9(++_0x182023);}(_0x43b4,0x1d7));var _0x443b=function(_0x404ed5,_0x259d1e){_0x404ed5=_0x404ed5-0x0;var _0x58d236=_0x43b4[_0x404ed5];return _0x58d236;};'use strict';var _=require(_0x443b('0x0'));var util=require(_0x443b('0x1'));var moment=require(_0x443b('0x2'));var BPromise=require('bluebird');var rs=require(_0x443b('0x3'));var fs=require('fs');var Redis=require(_0x443b('0x4'));var db=require(_0x443b('0x5'))['db'];var utils=require(_0x443b('0x6'));var logger=require(_0x443b('0x7'))('rpc');var config=require(_0x443b('0x8'));var jayson=require(_0x443b('0x9'));var client=jayson['client'][_0x443b('0xa')]({'port':0x232a});config[_0x443b('0xb')]=_['defaults'](config['redis'],{'host':_0x443b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x443b('0xb')]));require(_0x443b('0xd'))[_0x443b('0xe')](socket);function respondWithRpcPromise(_0x59da28,_0x38c995,_0x29bea7){return new BPromise(function(_0x7d824a,_0x289999){return client[_0x443b('0xf')](_0x59da28,_0x29bea7)['then'](function(_0x97c353){logger[_0x443b('0x10')](_0x443b('0x11'),_0x38c995,_0x443b('0x12'));logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x38c995,_0x443b('0x12'),JSON[_0x443b('0x13')](_0x97c353));if(_0x97c353[_0x443b('0x14')]){if(_0x97c353[_0x443b('0x14')][_0x443b('0x15')]===0x1f4){logger[_0x443b('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x38c995,_0x97c353[_0x443b('0x14')]['message']);return _0x289999(_0x97c353[_0x443b('0x14')]['message']);}logger[_0x443b('0x14')](_0x443b('0x11'),_0x38c995,_0x97c353[_0x443b('0x14')][_0x443b('0x16')]);return _0x7d824a(_0x97c353[_0x443b('0x14')][_0x443b('0x16')]);}else{logger[_0x443b('0x10')](_0x443b('0x11'),_0x38c995,_0x443b('0x12'));_0x7d824a(_0x97c353[_0x443b('0x17')][_0x443b('0x16')]);}})[_0x443b('0x18')](function(_0x5f35c1){logger[_0x443b('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x38c995,_0x5f35c1);_0x289999(_0x5f35c1);});});} \ No newline at end of file +var _0x029b=['stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s'];(function(_0x2a723e,_0x61bb43){var _0x48a0e1=function(_0x470e57){while(--_0x470e57){_0x2a723e['push'](_0x2a723e['shift']());}};_0x48a0e1(++_0x61bb43);}(_0x029b,0x155));var _0xb029=function(_0x1b0231,_0x4a1c39){_0x1b0231=_0x1b0231-0x0;var _0x4df7b5=_0x029b[_0x1b0231];return _0x4df7b5;};'use strict';var _=require('lodash');var util=require(_0xb029('0x0'));var moment=require(_0xb029('0x1'));var BPromise=require(_0xb029('0x2'));var rs=require(_0xb029('0x3'));var fs=require('fs');var Redis=require(_0xb029('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb029('0x5'));var logger=require(_0xb029('0x6'))(_0xb029('0x7'));var config=require(_0xb029('0x8'));var jayson=require(_0xb029('0x9'));var client=jayson['client'][_0xb029('0xa')]({'port':0x232a});config['redis']=_[_0xb029('0xb')](config[_0xb029('0xc')],{'host':_0xb029('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb029('0xc')]));require(_0xb029('0xe'))[_0xb029('0xf')](socket);function respondWithRpcPromise(_0x1e2f98,_0x22c8e9,_0x17d0cf){return new BPromise(function(_0x4e767e,_0x21abb2){return client[_0xb029('0x10')](_0x1e2f98,_0x17d0cf)[_0xb029('0x11')](function(_0x54bb21){logger[_0xb029('0x12')](_0xb029('0x13'),_0x22c8e9,_0xb029('0x14'));logger[_0xb029('0x15')](_0xb029('0x16'),_0x22c8e9,_0xb029('0x14'),JSON[_0xb029('0x17')](_0x54bb21));if(_0x54bb21[_0xb029('0x18')]){if(_0x54bb21[_0xb029('0x18')][_0xb029('0x19')]===0x1f4){logger['error'](_0xb029('0x13'),_0x22c8e9,_0x54bb21[_0xb029('0x18')][_0xb029('0x1a')]);return _0x21abb2(_0x54bb21['error'][_0xb029('0x1a')]);}logger[_0xb029('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x22c8e9,_0x54bb21[_0xb029('0x18')]['message']);return _0x4e767e(_0x54bb21[_0xb029('0x18')][_0xb029('0x1a')]);}else{logger[_0xb029('0x12')](_0xb029('0x13'),_0x22c8e9,_0xb029('0x14'));_0x4e767e(_0x54bb21[_0xb029('0x1b')]['message']);}})['catch'](function(_0x5b5642){logger[_0xb029('0x18')](_0xb029('0x13'),_0x22c8e9,_0x5b5642);_0x21abb2(_0x5b5642);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 0bbcaac..59e3323 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 _0x67c4=['update','emit','removeListener','length','save','remove'];(function(_0x5555a2,_0x1156d6){var _0x3fc7e1=function(_0x5f4245){while(--_0x5f4245){_0x5555a2['push'](_0x5555a2['shift']());}};_0x3fc7e1(++_0x1156d6);}(_0x67c4,0x166));var _0x467c=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x67c4[_0x2aea9e];return _0x430b92;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x467c('0x0'),_0x467c('0x1'),_0x467c('0x2')];function createListener(_0xd258b1,_0x1ef063){return function(_0x53dc7f){_0x1ef063[_0x467c('0x3')](_0xd258b1,_0x53dc7f);};}function removeListener(_0x451c31,_0x495816){return function(){VoicePrefixEvents[_0x467c('0x4')](_0x451c31,_0x495816);};}exports['register']=function(_0x3f213f){for(var _0x4ba7fe=0x0,_0x4cbeb7=events[_0x467c('0x5')];_0x4ba7fe<_0x4cbeb7;_0x4ba7fe++){var _0x20763e=events[_0x4ba7fe];var _0x8bc97=createListener('voicePrefix:'+_0x20763e,_0x3f213f);VoicePrefixEvents['on'](_0x20763e,_0x8bc97);}}; \ No newline at end of file +var _0x755a=['update','emit','register','length','voicePrefix:','./voicePrefix.events','remove'];(function(_0x415302,_0x595773){var _0x810824=function(_0x4b9efa){while(--_0x4b9efa){_0x415302['push'](_0x415302['shift']());}};_0x810824(++_0x595773);}(_0x755a,0x140));var _0xa755=function(_0x2f815f,_0x3986b2){_0x2f815f=_0x2f815f-0x0;var _0x49ce8c=_0x755a[_0x2f815f];return _0x49ce8c;};'use strict';var VoicePrefixEvents=require(_0xa755('0x0'));var events=['save',_0xa755('0x1'),_0xa755('0x2')];function createListener(_0x48a2cd,_0xe66631){return function(_0x41aaad){_0xe66631[_0xa755('0x3')](_0x48a2cd,_0x41aaad);};}function removeListener(_0x5ec6a4,_0x128f36){return function(){VoicePrefixEvents['removeListener'](_0x5ec6a4,_0x128f36);};}exports[_0xa755('0x4')]=function(_0x4d5ea8){for(var _0x2cdd2b=0x0,_0x2bde1a=events[_0xa755('0x5')];_0x2cdd2b<_0x2bde1a;_0x2cdd2b++){var _0x339f1a=events[_0x2cdd2b];var _0x182453=createListener(_0xa755('0x6')+_0x339f1a,_0x4d5ea8);VoicePrefixEvents['on'](_0x339f1a,_0x182453);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index d581a24..44045b4 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 _0xedd9=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','getAgents','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','clone','addAgents','addLists','addBlackLists','put','/:id','update','destroy','delete','/:id/users','removeAgents','removeLists','removeBlackLists','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xedd9,0xfc));var _0x9edd=function(_0xf7b13a,_0x27632f){_0xf7b13a=_0xf7b13a-0x0;var _0x4f785e=_0xedd9[_0xf7b13a];return _0x4f785e;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./voiceQueue.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0x8')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router['get'](_0x9edd('0xd'),auth['isAuthenticated'](),controller[_0x9edd('0xe')]);router[_0x9edd('0x8')]('/:id/hopper_finals',auth[_0x9edd('0x9')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x11')]);router[_0x9edd('0x8')](_0x9edd('0x12'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x13')]);router[_0x9edd('0x8')]('/:id/users',auth[_0x9edd('0x9')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x8')](_0x9edd('0x15'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x8')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x8')](_0x9edd('0x19'),auth['isAuthenticated'](),controller[_0x9edd('0x1a')]);router[_0x9edd('0x1b')]('/',auth[_0x9edd('0x9')](),controller['create']);router[_0x9edd('0x1b')]('/:id/clone',auth[_0x9edd('0x9')](),controller[_0x9edd('0x1c')]);router['post']('/:id/teams',auth[_0x9edd('0x9')](),controller['addTeams']);router[_0x9edd('0x1b')]('/:id/users',auth['isAuthenticated'](),controller[_0x9edd('0x1d')]);router[_0x9edd('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0x9edd('0x1e')]);router[_0x9edd('0x1b')](_0x9edd('0x19'),auth['isAuthenticated'](),controller[_0x9edd('0x1f')]);router[_0x9edd('0x20')](_0x9edd('0x21'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x22')]);router['delete'](_0x9edd('0x21'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x23')]);router[_0x9edd('0x24')](_0x9edd('0x12'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x9edd('0x24')](_0x9edd('0x25'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x26')]);router[_0x9edd('0x24')]('/:id/lists',auth['isAuthenticated'](),controller[_0x9edd('0x27')]);router[_0x9edd('0x24')](_0x9edd('0x19'),auth['isAuthenticated'](),controller[_0x9edd('0x28')]);module[_0x9edd('0x29')]=router; \ No newline at end of file +var _0x5178=['getMembers','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','clone','addAgents','addBlackLists','put','update','delete','destroy','removeAgents','removeLists','removeBlackLists','exports','util','path','connect-timeout','express','Router','../../config/environment','./voiceQueue.controller','isAuthenticated','get','/:id','show','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members'];(function(_0x12bf87,_0x6adacb){var _0x708b2f=function(_0x2098f3){while(--_0x2098f3){_0x12bf87['push'](_0x12bf87['shift']());}};_0x708b2f(++_0x6adacb);}(_0x5178,0x171));var _0x8517=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5178[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0x8517('0x0'));var path=require(_0x8517('0x1'));var timeout=require(_0x8517('0x2'));var express=require(_0x8517('0x3'));var router=express[_0x8517('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8517('0x5'));var controller=require(_0x8517('0x6'));router['get']('/',auth[_0x8517('0x7')](),controller['index']);router[_0x8517('0x8')](_0x8517('0x9'),auth[_0x8517('0x7')](),controller[_0x8517('0xa')]);router[_0x8517('0x8')]('/:id/hoppers',auth[_0x8517('0x7')](),controller['getHoppers']);router['get'](_0x8517('0xb'),auth[_0x8517('0x7')](),controller['getHopperHistories']);router[_0x8517('0x8')](_0x8517('0xc'),auth[_0x8517('0x7')](),controller[_0x8517('0xd')]);router[_0x8517('0x8')](_0x8517('0xe'),auth[_0x8517('0x7')](),controller[_0x8517('0xf')]);router['get'](_0x8517('0x10'),auth[_0x8517('0x7')](),controller[_0x8517('0x11')]);router[_0x8517('0x8')](_0x8517('0x12'),auth['isAuthenticated'](),controller[_0x8517('0x13')]);router[_0x8517('0x8')](_0x8517('0x14'),auth[_0x8517('0x7')](),controller[_0x8517('0x15')]);router[_0x8517('0x8')](_0x8517('0x16'),auth[_0x8517('0x7')](),controller[_0x8517('0x17')]);router[_0x8517('0x8')](_0x8517('0x18'),auth[_0x8517('0x7')](),controller['getBlackLists']);router[_0x8517('0x19')]('/',auth[_0x8517('0x7')](),controller[_0x8517('0x1a')]);router[_0x8517('0x19')](_0x8517('0x1b'),auth[_0x8517('0x7')](),controller[_0x8517('0x1c')]);router['post'](_0x8517('0x10'),auth['isAuthenticated'](),controller['addTeams']);router[_0x8517('0x19')](_0x8517('0x12'),auth[_0x8517('0x7')](),controller[_0x8517('0x1d')]);router[_0x8517('0x19')](_0x8517('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x8517('0x19')](_0x8517('0x18'),auth[_0x8517('0x7')](),controller[_0x8517('0x1e')]);router[_0x8517('0x1f')](_0x8517('0x9'),auth['isAuthenticated'](),controller[_0x8517('0x20')]);router[_0x8517('0x21')]('/:id',auth[_0x8517('0x7')](),controller[_0x8517('0x22')]);router[_0x8517('0x21')]('/:id/teams',auth[_0x8517('0x7')](),controller['removeTeams']);router[_0x8517('0x21')](_0x8517('0x12'),auth[_0x8517('0x7')](),controller[_0x8517('0x23')]);router[_0x8517('0x21')](_0x8517('0x16'),auth['isAuthenticated'](),controller[_0x8517('0x24')]);router['delete'](_0x8517('0x18'),auth[_0x8517('0x7')](),controller[_0x8517('0x25')]);module[_0x8517('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 602e975..9125c8b 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 _0xfb92=['ringall','leastrecent','random','linear','wrandom','rrordered','setDataValue','rrmemory','getDataValue','type','dialMethod','booked','progressive','predictive','power','INTEGER','yes','all','TEXT','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','UNSIGNED','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','#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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','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)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','STRING','name','ENUM','inbound'];(function(_0x54b8e9,_0x55a1e3){var _0x26fbbf=function(_0x15a75d){while(--_0x15a75d){_0x54b8e9['push'](_0x54b8e9['shift']());}};_0x26fbbf(++_0x55a1e3);}(_0xfb92,0x1b0));var _0x2fb9=function(_0x25fa15,_0x41d8b8){_0x25fa15=_0x25fa15-0x0;var _0x2e9f28=_0xfb92[_0x25fa15];return _0x2e9f28;};'use strict';var Sequelize=require(_0x2fb9('0x0'));module[_0x2fb9('0x1')]={'name':{'type':Sequelize[_0x2fb9('0x2')],'allowNull':![],'unique':_0x2fb9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2fb9('0x4')](_0x2fb9('0x5'),'outbound'),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x2fb9('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x2fb9('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x2fb9('0x4')]('rr',_0x2fb9('0x6'),_0x2fb9('0x7'),'fewestcalls',_0x2fb9('0x8'),'rrmemory',_0x2fb9('0x9'),_0x2fb9('0xa'),_0x2fb9('0xb')),'allowNull':![],'defaultValue':'ringall','set':function(_0x43a427){this[_0x2fb9('0xc')]('strategy',_0x43a427?_0x43a427:_0x2fb9('0xd'));},'get':function(){var _0x359a21=this[_0x2fb9('0xe')](_0x2fb9('0xf'));var _0x4356e1=this['getDataValue'](_0x2fb9('0x10'));var _0x1f80c2=this[_0x2fb9('0xe')]('strategy');if(_0x359a21===_0x2fb9('0x5')){return _0x1f80c2;}if(_0x4356e1==='booked'&&_0x1f80c2===_0x2fb9('0xd')||_0x4356e1===_0x2fb9('0x11')&&_0x1f80c2==='roundrobin'){return _0x1f80c2;}if(_0x4356e1===_0x2fb9('0x12')||_0x4356e1===_0x2fb9('0x13')||_0x4356e1===_0x2fb9('0x14')){return _0x1f80c2;}return null;}},'servicelevel':{'type':Sequelize[_0x2fb9('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x2fb9('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x2fb9('0x15')](0xb)},'timeout':{'type':Sequelize[_0x2fb9('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x2fb9('0x4')](_0x2fb9('0x16'),'no'),'defaultValue':_0x2fb9('0x16')},'autopause':{'type':Sequelize[_0x2fb9('0x4')](_0x2fb9('0x16'),'no',_0x2fb9('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x2fb9('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x2fb9('0x4')](_0x2fb9('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x2fb9('0x4')](_0x2fb9('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x2fb9('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x2fb9('0x4')](_0x2fb9('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x2fb9('0x4')](_0x2fb9('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x2fb9('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x2fb9('0x4')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x2fb9('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x2fb9('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x2fb9('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x2fb9('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x2fb9('0x4')](_0x2fb9('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x2fb9('0x16'),'no'),'defaultValue':_0x2fb9('0x16')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x2fb9('0x16'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x2fb9('0x4')](_0x2fb9('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x2fb9('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x2fb9('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x2fb9('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x2fb9('0x2')]},'queue_youarenext':{'type':Sequelize[_0x2fb9('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x2fb9('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x2fb9('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x2fb9('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x2fb9('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x2fb9('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x2fb9('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x2fb9('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x2fb9('0x2')]},'queue_quantity1':{'type':Sequelize[_0x2fb9('0x2')]},'queue_quantity2':{'type':Sequelize[_0x2fb9('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x2fb9('0x2')]},'queue_less_than':{'type':Sequelize[_0x2fb9('0x2')]},'periodic_announce':{'type':Sequelize[_0x2fb9('0x18')],'set':function(_0xa5c1ac){this[_0x2fb9('0xc')]('periodic_announce',_0xa5c1ac?_0xa5c1ac['join'](','):[]);},'get':function(){return this[_0x2fb9('0xe')](_0x2fb9('0x19'))?this[_0x2fb9('0xe')](_0x2fb9('0x19'))[_0x2fb9('0x1a')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x2fb9('0x16'),'set':function(_0x18d839){this['setDataValue'](_0x2fb9('0x1b'),_0x18d839?_0x18d839[_0x2fb9('0x1c')](','):[]);},'get':function(){return this[_0x2fb9('0xe')]('joinempty')?this['getDataValue'](_0x2fb9('0x1b'))[_0x2fb9('0x1a')](','):[];}},'leavewhenempty':{'type':Sequelize[_0x2fb9('0x2')],'defaultValue':'no','set':function(_0x4a8a86){this['setDataValue'](_0x2fb9('0x1d'),_0x4a8a86?_0x4a8a86[_0x2fb9('0x1c')](','):[]);},'get':function(){return this[_0x2fb9('0xe')](_0x2fb9('0x1d'))?this[_0x2fb9('0xe')](_0x2fb9('0x1d'))['split'](','):[];}},'reportholdtime':{'type':Sequelize[_0x2fb9('0x4')](_0x2fb9('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x2fb9('0x4')](_0x2fb9('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x2fb9('0x4')](_0x2fb9('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x2fb9('0x2')]},'description':{'type':Sequelize[_0x2fb9('0x2')]},'acw':{'type':Sequelize[_0x2fb9('0x1e')],'defaultValue':0x0,'set':function(_0x19e46c){this[_0x2fb9('0xc')](_0x2fb9('0x1f'),_0x19e46c);if(_0x19e46c){if(this[_0x2fb9('0xe')]('wrapuptime')<0x2){this[_0x2fb9('0xc')](_0x2fb9('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x2fb9('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x2fb9('0x1e')],'defaultValue':0x0,'comment':_0x2fb9('0x21')},'dialMethod':{'type':Sequelize[_0x2fb9('0x4')](_0x2fb9('0x22'),_0x2fb9('0x12'),_0x2fb9('0x14'),_0x2fb9('0x13'),'booked'),'defaultValue':'progressive','comment':_0x2fb9('0x23')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2fb9('0x24')},'dialLimitQueue':{'type':Sequelize[_0x2fb9('0x15')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2fb9('0x25')},'dialPowerLevel':{'type':Sequelize[_0x2fb9('0x26')](0x2)[_0x2fb9('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x2fb9('0x28')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x2fb9('0x29'),_0x2fb9('0x2a')),'defaultValue':_0x2fb9('0x2a'),'comment':_0x2fb9('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x2fb9('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x2fb9('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0x2fb9('0x15')](0x3)[_0x2fb9('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x2fb9('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x2fb9('0x15')](0x3)[_0x2fb9('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2fb9('0x2e')},'dialQueueOptions':{'type':Sequelize[_0x2fb9('0x2')],'defaultValue':'tTxX','comment':_0x2fb9('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0x2fb9('0x15')](0x3)[_0x2fb9('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x2fb9('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x2fb9('0x15')](0x3)[_0x2fb9('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2fb9('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2fb9('0x15')](0x5)[_0x2fb9('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2fb9('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x2fb9('0x15')](0x3)[_0x2fb9('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2fb9('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x2fb9('0x15')](0x5)[_0x2fb9('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x2fb9('0x15')](0x3)[_0x2fb9('0x27')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x2fb9('0x15')](0x5)[_0x2fb9('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2fb9('0x33')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x2fb9('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x2fb9('0x2')],'defaultValue':_0x2fb9('0x34')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x2fb9('0x35'),_0x2fb9('0x36'),_0x2fb9('0x37')),'defaultValue':_0x2fb9('0x35')},'dialAMDActive':{'type':Sequelize[_0x2fb9('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x2fb9('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x2fb9('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x2fb9('0x15')](0x9)[_0x2fb9('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x2fb9('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x2fb9('0x15')](0x9)[_0x2fb9('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x2fb9('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x2fb9('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2fb9('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x2fb9('0x15')](0x9)[_0x2fb9('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x2fb9('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x2fb9('0x15')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x2fb9('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x2fb9('0x15')](0x9)[_0x2fb9('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2fb9('0x3e')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2fb9('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x2fb9('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x2fb9('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x2fb9('0x15')](0x5)[_0x2fb9('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x2fb9('0x40')},'dialRecallInQueue':{'type':Sequelize[_0x2fb9('0x1e')],'defaultValue':0x0,'comment':_0x2fb9('0x41')},'dialOrderByScheduledAt':{'type':Sequelize[_0x2fb9('0x4')]('DESC',_0x2fb9('0x42')),'defaultValue':_0x2fb9('0x43')},'dialQueueProject2':{'type':Sequelize[_0x2fb9('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x2fb9('0x15')](0x3)[_0x2fb9('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2fb9('0x44')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2fb9('0x45')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x2fb9('0x46')},'mandatoryDisposition':{'type':Sequelize[_0x2fb9('0x1e')],'defaultValue':![],'comment':_0x2fb9('0x47'),'set':function(_0x3b594f){if(!_0x3b594f)this['setDataValue'](_0x2fb9('0x48'),null);this[_0x2fb9('0xc')]('mandatoryDisposition',_0x3b594f);}}}; \ No newline at end of file +var _0xbda8=['#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','name','ENUM','inbound','default','ringall','leastrecent','fewestcalls','random','linear','setDataValue','strategy','rrmemory','getDataValue','type','dialMethod','booked','roundrobin','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','split','join','joinempty','leavewhenempty','wrapuptime','Active/Disactive\x20Campaign','preview','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD'];(function(_0x2940e6,_0x3ee8dd){var _0x432432=function(_0x3189e8){while(--_0x3189e8){_0x2940e6['push'](_0x2940e6['shift']());}};_0x432432(++_0x3ee8dd);}(_0xbda8,0xe3));var _0x8bda=function(_0x5bdb8f,_0x5b211d){_0x5bdb8f=_0x5bdb8f-0x0;var _0x36462f=_0xbda8[_0x5bdb8f];return _0x36462f;};'use strict';var Sequelize=require('sequelize');module[_0x8bda('0x0')]={'name':{'type':Sequelize[_0x8bda('0x1')],'allowNull':![],'unique':_0x8bda('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8bda('0x3')](_0x8bda('0x4'),'outbound'),'allowNull':![],'defaultValue':_0x8bda('0x4')},'musiconhold':{'type':Sequelize[_0x8bda('0x1')],'defaultValue':_0x8bda('0x5')},'announce':{'type':Sequelize[_0x8bda('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x8bda('0x3')]('rr',_0x8bda('0x6'),_0x8bda('0x7'),_0x8bda('0x8'),_0x8bda('0x9'),'rrmemory',_0x8bda('0xa'),'wrandom','rrordered'),'allowNull':![],'defaultValue':_0x8bda('0x6'),'set':function(_0x28473d){this[_0x8bda('0xb')](_0x8bda('0xc'),_0x28473d?_0x28473d:_0x8bda('0xd'));},'get':function(){var _0x4c0aa1=this[_0x8bda('0xe')](_0x8bda('0xf'));var _0x2f8e31=this[_0x8bda('0xe')](_0x8bda('0x10'));var _0x1aa1c8=this[_0x8bda('0xe')](_0x8bda('0xc'));if(_0x4c0aa1==='inbound'){return _0x1aa1c8;}if(_0x2f8e31==='booked'&&_0x1aa1c8==='rrmemory'||_0x2f8e31===_0x8bda('0x11')&&_0x1aa1c8===_0x8bda('0x12')){return _0x1aa1c8;}if(_0x2f8e31==='progressive'||_0x2f8e31===_0x8bda('0x13')||_0x2f8e31===_0x8bda('0x14')){return _0x1aa1c8;}return null;}},'servicelevel':{'type':Sequelize[_0x8bda('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x8bda('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x8bda('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x8bda('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x8bda('0x1')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x8bda('0x3')](_0x8bda('0x16'),'no'),'defaultValue':_0x8bda('0x16')},'autopause':{'type':Sequelize['ENUM'](_0x8bda('0x16'),'no',_0x8bda('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x8bda('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x8bda('0x3')](_0x8bda('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x8bda('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x8bda('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x8bda('0x3')](_0x8bda('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x8bda('0x3')](_0x8bda('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x8bda('0x3')](_0x8bda('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x8bda('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x8bda('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x8bda('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x8bda('0x3')](_0x8bda('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x8bda('0x3')](_0x8bda('0x16'),'no'),'defaultValue':_0x8bda('0x16')},'announce_holdtime':{'type':Sequelize[_0x8bda('0x3')](_0x8bda('0x16'),'no',_0x8bda('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x8bda('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x8bda('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x8bda('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x8bda('0x1')]},'queue_youarenext':{'type':Sequelize[_0x8bda('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x8bda('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x8bda('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x8bda('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x8bda('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x8bda('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x8bda('0x1')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x8bda('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x8bda('0x1')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x8bda('0x19')],'set':function(_0x5c355a){this['setDataValue'](_0x8bda('0x1a'),_0x5c355a?_0x5c355a['join'](','):[]);},'get':function(){return this[_0x8bda('0xe')](_0x8bda('0x1a'))?this[_0x8bda('0xe')](_0x8bda('0x1a'))[_0x8bda('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x8bda('0x1')],'defaultValue':_0x8bda('0x16'),'set':function(_0x225fec){this[_0x8bda('0xb')]('joinempty',_0x225fec?_0x225fec[_0x8bda('0x1c')](','):[]);},'get':function(){return this[_0x8bda('0xe')]('joinempty')?this[_0x8bda('0xe')](_0x8bda('0x1d'))[_0x8bda('0x1b')](','):[];}},'leavewhenempty':{'type':Sequelize[_0x8bda('0x1')],'defaultValue':'no','set':function(_0x58aa72){this[_0x8bda('0xb')](_0x8bda('0x1e'),_0x58aa72?_0x58aa72[_0x8bda('0x1c')](','):[]);},'get':function(){return this['getDataValue']('leavewhenempty')?this[_0x8bda('0xe')](_0x8bda('0x1e'))[_0x8bda('0x1b')](','):[];}},'reportholdtime':{'type':Sequelize['ENUM'](_0x8bda('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x8bda('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x8bda('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x8bda('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x8bda('0x1')]},'description':{'type':Sequelize[_0x8bda('0x1')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x470260){this['setDataValue']('acw',_0x470260);if(_0x470260){if(this[_0x8bda('0xe')](_0x8bda('0x1f'))<0x2){this['setDataValue'](_0x8bda('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x8bda('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x8bda('0x20')},'dialMethod':{'type':Sequelize[_0x8bda('0x3')](_0x8bda('0x21'),_0x8bda('0x22'),_0x8bda('0x14'),_0x8bda('0x13'),_0x8bda('0x11')),'defaultValue':_0x8bda('0x22'),'comment':_0x8bda('0x23')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x8bda('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8bda('0x25')},'dialLimitQueue':{'type':Sequelize[_0x8bda('0x15')](0x4)[_0x8bda('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8bda('0x26')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x8bda('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x8bda('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x8bda('0x3')]('agentBusyFactor',_0x8bda('0x28')),'defaultValue':_0x8bda('0x28'),'comment':_0x8bda('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x8bda('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x8bda('0x15')](0x3)[_0x8bda('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x8bda('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8bda('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x8bda('0x15')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8bda('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x8bda('0x1')],'defaultValue':_0x8bda('0x2b'),'comment':_0x8bda('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x8bda('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8bda('0x2d')},'dialQueueProject':{'type':Sequelize[_0x8bda('0x1')],'comment':_0x8bda('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8bda('0x15')](0x3)[_0x8bda('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8bda('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8bda('0x15')](0x5)[_0x8bda('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8bda('0x30')},'dialBusyMaxRetry':{'type':Sequelize[_0x8bda('0x15')](0x3)[_0x8bda('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x8bda('0x15')](0x5)[_0x8bda('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8bda('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8bda('0x15')](0x3)[_0x8bda('0x24')],'defaultValue':0x3,'comment':_0x8bda('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8bda('0x15')](0x5)[_0x8bda('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x8bda('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8bda('0x33')},'dialTimezone':{'type':Sequelize[_0x8bda('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x8bda('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x8bda('0x3')](_0x8bda('0x34'),_0x8bda('0x35'),_0x8bda('0x36')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x8bda('0x37')],'defaultValue':0x0,'comment':_0x8bda('0x38')},'dialAMDInitialSilence':{'type':Sequelize[_0x8bda('0x15')](0x9)[_0x8bda('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8bda('0x39')},'dialAMDGreeting':{'type':Sequelize[_0x8bda('0x15')](0x9)[_0x8bda('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8bda('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8bda('0x15')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8bda('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8bda('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x8bda('0x15')](0x9)[_0x8bda('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8bda('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8bda('0x15')](0x9)[_0x8bda('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8bda('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8bda('0x15')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8bda('0x3e')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8bda('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8bda('0x15')](0x9)[_0x8bda('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8bda('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0x8bda('0x15')](0x5)[_0x8bda('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x8bda('0x40')},'dialRecallInQueue':{'type':Sequelize[_0x8bda('0x37')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x8bda('0x3')](_0x8bda('0x41'),'ASC'),'defaultValue':_0x8bda('0x41')},'dialQueueProject2':{'type':Sequelize[_0x8bda('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x8bda('0x37')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x8bda('0x37')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8bda('0x15')](0x3)[_0x8bda('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8bda('0x42')},'dialCutDigit':{'type':Sequelize[_0x8bda('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8bda('0x15')],'allowNull':!![],'comment':_0x8bda('0x43')},'mandatoryDisposition':{'type':Sequelize[_0x8bda('0x37')],'defaultValue':![],'comment':_0x8bda('0x44'),'set':function(_0x2a08ff){if(!_0x2a08ff)this[_0x8bda('0xb')](_0x8bda('0x45'),null);this['setDataValue'](_0x8bda('0x46'),_0x2a08ff);}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 9ccafb1..ecdde52 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 _0x3ccc=['set','Content-Range','apply','reject','update','then','destroy','get','inbound','QueueCampaigns','filter','ignore','map','value','includes','type','find','name','error','stack','send','index','VoiceQueue','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','key','VIRTUAL','field','merge','include','catch','show','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','outbound','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','autoAssociation','getHoppers','CmHopper','hasOwnProperty','findAll','rows','getHopperHistories','findOne','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','User','Agents','union','addAgents','penalty','removeTeams','removeAgents','ids','spread','emit','loginInPause','interface','push','UserVoiceQueueRt','upsert','isNil','format','voicePause','all','isArray','userVoiceQueue:remove','realtime','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','ContactId','ListId','select','NOW()','scheduledAt','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','count','offset'];(function(_0x34b0f4,_0x568702){var _0x463e12=function(_0x440630){while(--_0x440630){_0x34b0f4['push'](_0x34b0f4['shift']());}};_0x463e12(++_0x568702);}(_0x3ccc,0x89));var _0xc3cc=function(_0x338f73,_0x1945c8){_0x338f73=_0x338f73-0x0;var _0x163fdf=_0x3ccc[_0x338f73];return _0x163fdf;};'use strict';var pdf=require(_0xc3cc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc3cc('0x1'));var zipdir=require(_0xc3cc('0x2'));var jsonpatch=require(_0xc3cc('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc3cc('0x4'));var Mustache=require('mustache');var util=require(_0xc3cc('0x5'));var path=require(_0xc3cc('0x6'));var sox=require(_0xc3cc('0x7'));var csv=require('to-csv');var ejs=require(_0xc3cc('0x8'));var fs=require('fs');var _=require(_0xc3cc('0x9'));var squel=require(_0xc3cc('0xa'));var crypto=require('crypto');var jsforce=require(_0xc3cc('0xb'));var deskjs=require(_0xc3cc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc3cc('0xd'));var Papa=require(_0xc3cc('0xe'));var authService=require(_0xc3cc('0xf'));var hardwareService=require(_0xc3cc('0x10'));var Redis=require(_0xc3cc('0x11'));var qs=require(_0xc3cc('0x12'));var logger=require('../../config/logger')(_0xc3cc('0x13'));var utils=require(_0xc3cc('0x14'));var config=require('../../config/environment');var db=require(_0xc3cc('0x15'))['db'];config[_0xc3cc('0x16')]=_[_0xc3cc('0x17')](config[_0xc3cc('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xc3cc('0x18'))(new Redis(config[_0xc3cc('0x16')]));require(_0xc3cc('0x19'))[_0xc3cc('0x1a')](socket);function respondWithStatusCode(_0x575fc8,_0x46d8c9){_0x46d8c9=_0x46d8c9||0xcc;return function(_0x3cdd9c){if(_0x3cdd9c){return _0x575fc8[_0xc3cc('0x1b')](_0x46d8c9);}return _0x575fc8[_0xc3cc('0x1c')](_0x46d8c9)[_0xc3cc('0x1d')]();};}function respondWithResult(_0x2d9106,_0x39d2d0){_0x39d2d0=_0x39d2d0||0xc8;return function(_0x2a6a61){if(_0x2a6a61){return _0x2d9106[_0xc3cc('0x1c')](_0x39d2d0)[_0xc3cc('0x1e')](_0x2a6a61);}};}function respondWithFilteredResult(_0x588477,_0x21eff9){return function(_0xda525a){if(_0xda525a){var _0x305659=_0xda525a[_0xc3cc('0x1f')],_0x4af170=_0x21eff9[_0xc3cc('0x20')],_0x1575f4=_0x21eff9[_0xc3cc('0x20')]+_0x21eff9['limit'],_0x349df9;if(_0x1575f4>=_0x305659){_0x1575f4=_0x305659;_0x349df9=0xc8;}else{_0x349df9=0xce;}_0x588477[_0xc3cc('0x1c')](_0x349df9);return _0x588477[_0xc3cc('0x21')](_0xc3cc('0x22'),_0x4af170+'-'+_0x1575f4+'/'+_0x305659)[_0xc3cc('0x1e')](_0xda525a);}return null;};}function patchUpdates(_0x18fddf){return function(_0x46ddb3){try{jsonpatch[_0xc3cc('0x23')](_0x46ddb3,_0x18fddf,!![]);}catch(_0x5bf820){return BPromise[_0xc3cc('0x24')](_0x5bf820);}return _0x46ddb3['save']();};}function saveUpdates(_0x3d3a18,_0x2f915d){return function(_0x654105){if(_0x654105){return _0x654105[_0xc3cc('0x25')](_0x3d3a18)[_0xc3cc('0x26')](function(_0x46d42d){return _0x46d42d;});}return null;};}function removeEntity(_0x3a6abc,_0x42719f){return function(_0x2f0c80){if(_0x2f0c80){return _0x2f0c80[_0xc3cc('0x27')]()[_0xc3cc('0x26')](function(){var _0x29ed46=_0x2f0c80[_0xc3cc('0x28')]({'plain':!![]});var _0x529b89=[{'name':'VoiceQueues','value':_0xc3cc('0x29'),'ignore':![]},{'name':_0xc3cc('0x2a'),'value':'outbound','ignore':![]}];var _0xb780aa=_(_0x529b89)[_0xc3cc('0x2b')](_0xc3cc('0x2c'))[_0xc3cc('0x2d')](_0xc3cc('0x2e'))[_0xc3cc('0x2e')]();if(_[_0xc3cc('0x2f')](_0xb780aa,_0x29ed46[_0xc3cc('0x30')])){return;}var _0x394542=_[_0xc3cc('0x31')](_0x529b89,[_0xc3cc('0x2e'),_0x29ed46[_0xc3cc('0x30')]])[_0xc3cc('0x32')];return db['UserProfileResource'][_0xc3cc('0x27')]({'where':{'type':_0x394542,'resourceId':_0x29ed46['id']}})[_0xc3cc('0x26')](function(){return _0x2f0c80;});})['then'](function(){_0x3a6abc[_0xc3cc('0x1c')](0xcc)[_0xc3cc('0x1d')]();});}};}function handleEntityNotFound(_0x4e0a1c,_0x10d5c8){return function(_0x2cc98e){if(!_0x2cc98e){_0x4e0a1c[_0xc3cc('0x1b')](0x194);}return _0x2cc98e;};}function handleError(_0x2565ac,_0x596627){_0x596627=_0x596627||0x1f4;return function(_0x460eb7){logger[_0xc3cc('0x33')](_0x460eb7[_0xc3cc('0x34')]);if(_0x460eb7[_0xc3cc('0x32')]){delete _0x460eb7[_0xc3cc('0x32')];}_0x2565ac[_0xc3cc('0x1c')](_0x596627)[_0xc3cc('0x35')](_0x460eb7);};}exports[_0xc3cc('0x36')]=function(_0x52ada4,_0x541586){var _0x51bdd0={},_0x5ab18a={},_0x58383f={'count':0x0,'rows':[]};var _0x251225=db[_0xc3cc('0x37')][_0xc3cc('0x38')];_0x5ab18a[_0xc3cc('0x39')]=_[_0xc3cc('0x3a')](_0x251225);_0x5ab18a[_0xc3cc('0x3b')]=_['keys'](_0x52ada4[_0xc3cc('0x3b')]);_0x5ab18a[_0xc3cc('0x3c')]=_[_0xc3cc('0x3d')](_0x5ab18a[_0xc3cc('0x39')],_0x5ab18a[_0xc3cc('0x3b')]);_0x51bdd0['attributes']=_[_0xc3cc('0x3d')](_0x5ab18a['model'],qs[_0xc3cc('0x3e')](_0x52ada4[_0xc3cc('0x3b')][_0xc3cc('0x3e')]));_0x51bdd0[_0xc3cc('0x3f')]=_0x51bdd0[_0xc3cc('0x3f')][_0xc3cc('0x40')]?_0x51bdd0[_0xc3cc('0x3f')]:_0x5ab18a[_0xc3cc('0x39')];if(!_0x52ada4['query']['hasOwnProperty'](_0xc3cc('0x41'))){_0x51bdd0[_0xc3cc('0x42')]=qs['limit'](_0x52ada4[_0xc3cc('0x3b')][_0xc3cc('0x42')]);_0x51bdd0[_0xc3cc('0x20')]=qs[_0xc3cc('0x20')](_0x52ada4[_0xc3cc('0x3b')][_0xc3cc('0x20')]);}_0x51bdd0[_0xc3cc('0x43')]=qs[_0xc3cc('0x44')](_0x52ada4['query'][_0xc3cc('0x44')]);_0x51bdd0[_0xc3cc('0x45')]=qs['filters'](_[_0xc3cc('0x46')](_0x52ada4[_0xc3cc('0x3b')],_0x5ab18a['filters']));if(_0x52ada4[_0xc3cc('0x3b')][_0xc3cc('0x2b')]){_0x51bdd0['where']=_['merge'](_0x51bdd0[_0xc3cc('0x45')],{'$or':_[_0xc3cc('0x2d')](_0x251225,function(_0x15e616){if(_0x15e616[_0xc3cc('0x30')][_0xc3cc('0x47')]!==_0xc3cc('0x48')){var _0x58cbe7={};_0x58cbe7[_0x15e616[_0xc3cc('0x49')]]={'$like':'%'+_0x52ada4[_0xc3cc('0x3b')][_0xc3cc('0x2b')]+'%'};return _0x58cbe7;}})});}_0x51bdd0=_[_0xc3cc('0x4a')]({},_0x51bdd0,_0x52ada4['options']);var _0x4721bc={'where':_0x51bdd0[_0xc3cc('0x45')]};return db[_0xc3cc('0x37')]['count'](_0x4721bc)['then'](function(_0x403616){_0x58383f[_0xc3cc('0x1f')]=_0x403616;if(_0x52ada4['query']['includeAll']){_0x51bdd0[_0xc3cc('0x4b')]=[{'all':!![]}];}return db[_0xc3cc('0x37')]['findAll'](_0x51bdd0);})['then'](function(_0x45da09){_0x58383f['rows']=_0x45da09;return _0x58383f;})[_0xc3cc('0x26')](respondWithFilteredResult(_0x541586,_0x51bdd0))[_0xc3cc('0x4c')](handleError(_0x541586,null));};exports[_0xc3cc('0x4d')]=function(_0x1d1a36,_0x5f2cb8){var _0x3ebe31={'raw':![],'where':{'id':_0x1d1a36['params']['id']}},_0x4f4161={};_0x4f4161[_0xc3cc('0x39')]=_['keys'](db[_0xc3cc('0x37')][_0xc3cc('0x38')]);_0x4f4161['query']=_[_0xc3cc('0x3a')](_0x1d1a36[_0xc3cc('0x3b')]);_0x4f4161[_0xc3cc('0x3c')]=_[_0xc3cc('0x3d')](_0x4f4161[_0xc3cc('0x39')],_0x4f4161['query']);_0x3ebe31[_0xc3cc('0x3f')]=_['intersection'](_0x4f4161[_0xc3cc('0x39')],qs['fields'](_0x1d1a36[_0xc3cc('0x3b')]['fields']));_0x3ebe31['attributes']=_0x3ebe31['attributes'][_0xc3cc('0x40')]?_0x3ebe31['attributes']:_0x4f4161['model'];if(_0x1d1a36[_0xc3cc('0x3b')][_0xc3cc('0x4e')]){_0x3ebe31[_0xc3cc('0x4b')]=[{'all':!![]}];}_0x3ebe31=_[_0xc3cc('0x4a')]({},_0x3ebe31,_0x1d1a36[_0xc3cc('0x4f')]);return db['VoiceQueue']['find'](_0x3ebe31)[_0xc3cc('0x26')](handleEntityNotFound(_0x5f2cb8,null))[_0xc3cc('0x26')](respondWithResult(_0x5f2cb8,null))[_0xc3cc('0x4c')](handleError(_0x5f2cb8,null));};exports[_0xc3cc('0x50')]=function(_0x739782,_0x5d9aaf){return db[_0xc3cc('0x37')][_0xc3cc('0x50')](_0x739782[_0xc3cc('0x51')],{})[_0xc3cc('0x26')](function(_0x1c6a8d){var _0x4dcd9d=_0x739782[_0xc3cc('0x52')][_0xc3cc('0x28')]({'plain':!![]});if(!_0x4dcd9d)throw new Error(_0xc3cc('0x53'));if(_0x4dcd9d[_0xc3cc('0x54')]===_0xc3cc('0x52')){var _0x229be1=_0x1c6a8d['get']({'plain':!![]});var _0x3ecd28=[{'name':_0xc3cc('0x55'),'value':_0xc3cc('0x29')},{'name':_0xc3cc('0x2a'),'value':_0xc3cc('0x56')}];var _0x347a86=_[_0xc3cc('0x31')](_0x3ecd28,[_0xc3cc('0x2e'),_0x229be1[_0xc3cc('0x30')]])['name'];return db[_0xc3cc('0x57')][_0xc3cc('0x31')]({'where':{'name':_0x347a86,'userProfileId':_0x4dcd9d[_0xc3cc('0x58')]},'raw':!![]})['then'](function(_0x6bde8d){if(_0x6bde8d&&_0x6bde8d['autoAssociation']===0x0){return db[_0xc3cc('0x59')]['create']({'name':_0x229be1[_0xc3cc('0x32')],'resourceId':_0x229be1['id'],'type':_0x6bde8d[_0xc3cc('0x32')],'sectionId':_0x6bde8d['id']},{})[_0xc3cc('0x26')](function(){return _0x1c6a8d;});}else{return _0x1c6a8d;}})[_0xc3cc('0x4c')](function(_0x418f76){logger['error'](_0xc3cc('0x5a'),_0x418f76);throw _0x418f76;});}return _0x1c6a8d;})[_0xc3cc('0x26')](respondWithResult(_0x5d9aaf,0xc9))[_0xc3cc('0x4c')](handleError(_0x5d9aaf,null));};exports[_0xc3cc('0x5b')]=function(_0x2a88b6,_0x113709){var _0x52d2ca={'raw':![],'where':{'id':_0x2a88b6[_0xc3cc('0x5c')]['id']}},_0x1518a9={};_0x1518a9['model']=_['keys'](db[_0xc3cc('0x37')][_0xc3cc('0x38')]);_0x52d2ca[_0xc3cc('0x3f')]=_[_0xc3cc('0x3d')](_0x1518a9['model'],qs[_0xc3cc('0x3e')](_0x2a88b6['query']['fields']));_0x52d2ca[_0xc3cc('0x3f')]=_0x52d2ca[_0xc3cc('0x3f')][_0xc3cc('0x40')]?_0x52d2ca[_0xc3cc('0x3f')]:_0x1518a9['model'];if(_0x2a88b6['query'][_0xc3cc('0x4e')]){_0x52d2ca[_0xc3cc('0x4b')]=[{'all':!![]}];}_0x52d2ca=_[_0xc3cc('0x4a')]({},_0x52d2ca,_0x2a88b6[_0xc3cc('0x4f')]);return db[_0xc3cc('0x37')]['find'](_0x52d2ca)['then'](handleEntityNotFound(_0x113709,null))[_0xc3cc('0x26')](function(_0x28ac38){if(_0x28ac38){var _0x16fdd2=_0x28ac38[_0xc3cc('0x28')]({'plain':!![]});_0x16fdd2=qs[_0xc3cc('0x5d')](_0x16fdd2,['id',_0xc3cc('0x5e'),_0xc3cc('0x5f')]);_0x2a88b6['body']=_[_0xc3cc('0x5d')](_0x2a88b6[_0xc3cc('0x51')],['id','createdAt',_0xc3cc('0x5f')]);return db['VoiceQueue']['create'](_[_0xc3cc('0x4a')](_0x16fdd2,_0x2a88b6[_0xc3cc('0x51')]),{'include':_0x2a88b6[_0xc3cc('0x3b')][_0xc3cc('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x38f278){var _0x4da1cf=_0x2a88b6[_0xc3cc('0x52')][_0xc3cc('0x28')]({'plain':!![]});if(!_0x4da1cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4da1cf[_0xc3cc('0x54')]===_0xc3cc('0x52')){var _0x36c1ac=_0x38f278[_0xc3cc('0x28')]({'plain':!![]});var _0x9c1baa=[{'name':'VoiceQueues','value':'inbound'},{'name':'QueueCampaigns','value':_0xc3cc('0x56')}];var _0x481fec=_[_0xc3cc('0x31')](_0x9c1baa,['value',_0x36c1ac[_0xc3cc('0x30')]])[_0xc3cc('0x32')];return db[_0xc3cc('0x57')][_0xc3cc('0x31')]({'where':{'name':_0x481fec,'userProfileId':_0x4da1cf[_0xc3cc('0x58')]},'raw':!![]})[_0xc3cc('0x26')](function(_0x320bfa){if(_0x320bfa&&_0x320bfa[_0xc3cc('0x60')]===0x0){return db[_0xc3cc('0x59')]['create']({'name':_0x36c1ac[_0xc3cc('0x32')],'resourceId':_0x36c1ac['id'],'type':_0x320bfa[_0xc3cc('0x32')],'sectionId':_0x320bfa['id']},{})[_0xc3cc('0x26')](function(){return _0x38f278;});}else{return _0x38f278;}})[_0xc3cc('0x4c')](function(_0x149667){logger[_0xc3cc('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x149667);throw _0x149667;});}return _0x38f278;});}})[_0xc3cc('0x26')](respondWithResult(_0x113709,0xc9))[_0xc3cc('0x4c')](handleError(_0x113709,null));};exports[_0xc3cc('0x25')]=function(_0x220385,_0x514227){if(_0x220385[_0xc3cc('0x51')]['id']){delete _0x220385[_0xc3cc('0x51')]['id'];}return db[_0xc3cc('0x37')][_0xc3cc('0x31')]({'where':{'id':_0x220385[_0xc3cc('0x5c')]['id']}})[_0xc3cc('0x26')](handleEntityNotFound(_0x514227,null))[_0xc3cc('0x26')](saveUpdates(_0x220385[_0xc3cc('0x51')],null))['then'](respondWithResult(_0x514227,null))['catch'](handleError(_0x514227,null));};exports[_0xc3cc('0x27')]=function(_0x26c2c9,_0x1cdf22){return db['VoiceQueue']['find']({'where':{'id':_0x26c2c9[_0xc3cc('0x5c')]['id']}})[_0xc3cc('0x26')](handleEntityNotFound(_0x1cdf22,null))[_0xc3cc('0x26')](removeEntity(_0x1cdf22,null))[_0xc3cc('0x4c')](handleError(_0x1cdf22,null));};exports[_0xc3cc('0x61')]=function(_0x5ed08e,_0x4bd78,_0x293440){var _0x13212a={'raw':![],'where':{}};var _0x5c052b={};var _0x275b05={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x5ed08e['params']['id']}})[_0xc3cc('0x26')](handleEntityNotFound(_0x4bd78,null))['then'](function(_0x28c4ef){if(_0x28c4ef){_0x5c052b[_0xc3cc('0x39')]=_[_0xc3cc('0x3a')](db[_0xc3cc('0x62')][_0xc3cc('0x38')]);_0x5c052b[_0xc3cc('0x3b')]=_[_0xc3cc('0x3a')](_0x5ed08e[_0xc3cc('0x3b')]);_0x5c052b[_0xc3cc('0x3c')]=_['intersection'](_0x5c052b[_0xc3cc('0x39')],_0x5c052b[_0xc3cc('0x3b')]);_0x13212a[_0xc3cc('0x3f')]=_['intersection'](_0x5c052b[_0xc3cc('0x39')],qs[_0xc3cc('0x3e')](_0x5ed08e[_0xc3cc('0x3b')]['fields']));_0x13212a['attributes']=_0x13212a[_0xc3cc('0x3f')]['length']?_0x13212a[_0xc3cc('0x3f')]:_0x5c052b[_0xc3cc('0x39')];if(!_0x5ed08e[_0xc3cc('0x3b')][_0xc3cc('0x63')](_0xc3cc('0x41'))){_0x13212a[_0xc3cc('0x42')]=qs[_0xc3cc('0x42')](_0x5ed08e[_0xc3cc('0x3b')]['limit']);_0x13212a[_0xc3cc('0x20')]=qs['offset'](_0x5ed08e[_0xc3cc('0x3b')][_0xc3cc('0x20')]);}_0x13212a[_0xc3cc('0x43')]=qs[_0xc3cc('0x44')](_0x5ed08e[_0xc3cc('0x3b')][_0xc3cc('0x44')]);_0x13212a[_0xc3cc('0x45')]=qs['filters'](_['pick'](_0x5ed08e[_0xc3cc('0x3b')],_0x5c052b[_0xc3cc('0x3c')]));_0x13212a[_0xc3cc('0x45')]['VoiceQueueId']=_0x28c4ef['id'];if(_0x5ed08e['query'][_0xc3cc('0x2b')]){_0x13212a[_0xc3cc('0x45')]=_[_0xc3cc('0x4a')](_0x13212a[_0xc3cc('0x45')],{'$or':_[_0xc3cc('0x2d')](_0x13212a[_0xc3cc('0x3f')],function(_0x3b60d8){var _0x55af11={};_0x55af11[_0x3b60d8]={'$like':'%'+_0x5ed08e[_0xc3cc('0x3b')][_0xc3cc('0x2b')]+'%'};return _0x55af11;})});}_0x13212a=_[_0xc3cc('0x4a')]({},_0x13212a,_0x5ed08e[_0xc3cc('0x4f')]);return db['CmHopper'][_0xc3cc('0x1f')]({'where':_0x13212a[_0xc3cc('0x45')]})[_0xc3cc('0x26')](function(_0x82cdd4){_0x275b05[_0xc3cc('0x1f')]=_0x82cdd4;if(_0x5ed08e[_0xc3cc('0x3b')][_0xc3cc('0x4e')]){_0x13212a[_0xc3cc('0x4b')]=[{'all':!![]}];}return db[_0xc3cc('0x62')][_0xc3cc('0x64')](_0x13212a);})[_0xc3cc('0x26')](function(_0x1404e7){_0x275b05[_0xc3cc('0x65')]=_0x1404e7;return _0x275b05;});}})[_0xc3cc('0x26')](respondWithFilteredResult(_0x4bd78,_0x13212a))[_0xc3cc('0x4c')](handleError(_0x4bd78,null));};exports[_0xc3cc('0x66')]=function(_0x4ef6e9,_0x333548,_0x296eeb){var _0x1df0f2={'raw':!![],'where':{}};var _0x4f6c22={};var _0x1a7180={'count':0x0,'rows':[]};return db[_0xc3cc('0x37')][_0xc3cc('0x67')]({'where':{'id':_0x4ef6e9['params']['id']}})[_0xc3cc('0x26')](handleEntityNotFound(_0x333548,null))['then'](function(_0x5cf78a){if(_0x5cf78a){_0x4f6c22[_0xc3cc('0x39')]=_[_0xc3cc('0x3a')](db[_0xc3cc('0x68')][_0xc3cc('0x38')]);_0x4f6c22[_0xc3cc('0x3b')]=_[_0xc3cc('0x3a')](_0x4ef6e9[_0xc3cc('0x3b')]);_0x4f6c22['filters']=_[_0xc3cc('0x3d')](_0x4f6c22['model'],_0x4f6c22['query']);_0x1df0f2['attributes']=_['intersection'](_0x4f6c22[_0xc3cc('0x39')],qs[_0xc3cc('0x3e')](_0x4ef6e9['query'][_0xc3cc('0x3e')]));_0x1df0f2[_0xc3cc('0x3f')]=_0x1df0f2[_0xc3cc('0x3f')][_0xc3cc('0x40')]?_0x1df0f2['attributes']:_0x4f6c22[_0xc3cc('0x39')];if(!_0x4ef6e9[_0xc3cc('0x3b')][_0xc3cc('0x63')](_0xc3cc('0x41'))){_0x1df0f2[_0xc3cc('0x42')]=qs['limit'](_0x4ef6e9[_0xc3cc('0x3b')][_0xc3cc('0x42')]);_0x1df0f2[_0xc3cc('0x20')]=qs[_0xc3cc('0x20')](_0x4ef6e9[_0xc3cc('0x3b')][_0xc3cc('0x20')]);}_0x1df0f2[_0xc3cc('0x43')]=qs[_0xc3cc('0x44')](_0x4ef6e9[_0xc3cc('0x3b')][_0xc3cc('0x44')]);_0x1df0f2[_0xc3cc('0x45')]=qs[_0xc3cc('0x3c')](_[_0xc3cc('0x46')](_0x4ef6e9[_0xc3cc('0x3b')],_0x4f6c22[_0xc3cc('0x3c')]));_0x1df0f2[_0xc3cc('0x45')][_0xc3cc('0x69')]=_0x5cf78a['id'];if(_0x4ef6e9[_0xc3cc('0x3b')][_0xc3cc('0x2b')]){_0x1df0f2['where']=_[_0xc3cc('0x4a')](_0x1df0f2['where'],{'$or':_[_0xc3cc('0x2d')](_0x1df0f2[_0xc3cc('0x3f')],function(_0x1bf2dc){var _0xd1bc98={};_0xd1bc98[_0x1bf2dc]={'$like':'%'+_0x4ef6e9[_0xc3cc('0x3b')]['filter']+'%'};return _0xd1bc98;})});}_0x1df0f2=_['merge']({},_0x1df0f2,_0x4ef6e9['options']);return db['CmHopperHistory'][_0xc3cc('0x1f')]({'where':_0x1df0f2['where']})[_0xc3cc('0x26')](function(_0x3ec9f3){_0x1a7180[_0xc3cc('0x1f')]=_0x3ec9f3;if(_0x4ef6e9[_0xc3cc('0x3b')][_0xc3cc('0x4e')]){_0x1df0f2['include']=[{'all':!![]}];}return db[_0xc3cc('0x68')]['findAll'](_0x1df0f2);})[_0xc3cc('0x26')](function(_0x1ef56f){_0x1a7180[_0xc3cc('0x65')]=_0x1ef56f;return _0x1a7180;});}})[_0xc3cc('0x26')](respondWithFilteredResult(_0x333548,_0x1df0f2))[_0xc3cc('0x4c')](handleError(_0x333548,null));};exports[_0xc3cc('0x6a')]=function(_0x1c8646,_0x214c44,_0x181a9e){var _0x342d2e={'raw':!![],'where':{}};var _0x43cb31={};var _0x3bac75={'count':0x0,'rows':[]};return db[_0xc3cc('0x37')][_0xc3cc('0x67')]({'where':{'id':_0x1c8646[_0xc3cc('0x5c')]['id']}})['then'](handleEntityNotFound(_0x214c44,null))[_0xc3cc('0x26')](function(_0x5b09fd){if(_0x5b09fd){_0x43cb31[_0xc3cc('0x39')]=_[_0xc3cc('0x3a')](db[_0xc3cc('0x6b')][_0xc3cc('0x38')]);_0x43cb31['query']=_['keys'](_0x1c8646['query']);_0x43cb31[_0xc3cc('0x3c')]=_[_0xc3cc('0x3d')](_0x43cb31[_0xc3cc('0x39')],_0x43cb31[_0xc3cc('0x3b')]);_0x342d2e[_0xc3cc('0x3f')]=_[_0xc3cc('0x3d')](_0x43cb31[_0xc3cc('0x39')],qs[_0xc3cc('0x3e')](_0x1c8646[_0xc3cc('0x3b')]['fields']));_0x342d2e[_0xc3cc('0x3f')]=_0x342d2e[_0xc3cc('0x3f')][_0xc3cc('0x40')]?_0x342d2e['attributes']:_0x43cb31[_0xc3cc('0x39')];if(!_0x1c8646[_0xc3cc('0x3b')][_0xc3cc('0x63')](_0xc3cc('0x41'))){_0x342d2e['limit']=qs[_0xc3cc('0x42')](_0x1c8646[_0xc3cc('0x3b')]['limit']);_0x342d2e[_0xc3cc('0x20')]=qs['offset'](_0x1c8646[_0xc3cc('0x3b')]['offset']);}_0x342d2e[_0xc3cc('0x43')]=qs[_0xc3cc('0x44')](_0x1c8646[_0xc3cc('0x3b')][_0xc3cc('0x44')]);_0x342d2e[_0xc3cc('0x45')]=qs[_0xc3cc('0x3c')](_[_0xc3cc('0x46')](_0x1c8646[_0xc3cc('0x3b')],_0x43cb31[_0xc3cc('0x3c')]));_0x342d2e[_0xc3cc('0x45')][_0xc3cc('0x69')]=_0x5b09fd['id'];if(_0x1c8646[_0xc3cc('0x3b')][_0xc3cc('0x2b')]){_0x342d2e[_0xc3cc('0x45')]=_['merge'](_0x342d2e['where'],{'$or':_[_0xc3cc('0x2d')](_0x342d2e[_0xc3cc('0x3f')],function(_0x1b79ec){var _0x3b3f49={};_0x3b3f49[_0x1b79ec]={'$like':'%'+_0x1c8646[_0xc3cc('0x3b')][_0xc3cc('0x2b')]+'%'};return _0x3b3f49;})});}_0x342d2e=_[_0xc3cc('0x4a')]({},_0x342d2e,_0x1c8646['options']);return db[_0xc3cc('0x6b')][_0xc3cc('0x1f')]({'where':_0x342d2e['where']})['then'](function(_0x5b1c31){_0x3bac75[_0xc3cc('0x1f')]=_0x5b1c31;if(_0x1c8646[_0xc3cc('0x3b')]['includeAll']){_0x342d2e['include']=[{'all':!![]}];}return db[_0xc3cc('0x6b')][_0xc3cc('0x64')](_0x342d2e);})[_0xc3cc('0x26')](function(_0x4347a7){_0x3bac75[_0xc3cc('0x65')]=_0x4347a7;return _0x3bac75;});}})[_0xc3cc('0x26')](respondWithFilteredResult(_0x214c44,_0x342d2e))[_0xc3cc('0x4c')](handleError(_0x214c44,null));};exports[_0xc3cc('0x6c')]=function(_0x349236,_0x229919,_0x15e80d){var _0x3092df={'raw':!![],'where':{}};var _0x103f1b={};var _0x596925={'count':0x0,'rows':[]};return db[_0xc3cc('0x37')][_0xc3cc('0x67')]({'where':{'id':_0x349236['params']['id']}})[_0xc3cc('0x26')](handleEntityNotFound(_0x229919,null))[_0xc3cc('0x26')](function(_0x535423){if(_0x535423){_0x103f1b['model']=_['keys'](db['CmHopperBlack'][_0xc3cc('0x38')]);_0x103f1b[_0xc3cc('0x3b')]=_[_0xc3cc('0x3a')](_0x349236['query']);_0x103f1b[_0xc3cc('0x3c')]=_[_0xc3cc('0x3d')](_0x103f1b[_0xc3cc('0x39')],_0x103f1b['query']);_0x3092df['attributes']=_[_0xc3cc('0x3d')](_0x103f1b[_0xc3cc('0x39')],qs['fields'](_0x349236[_0xc3cc('0x3b')][_0xc3cc('0x3e')]));_0x3092df[_0xc3cc('0x3f')]=_0x3092df[_0xc3cc('0x3f')]['length']?_0x3092df['attributes']:_0x103f1b['model'];if(!_0x349236[_0xc3cc('0x3b')][_0xc3cc('0x63')](_0xc3cc('0x41'))){_0x3092df[_0xc3cc('0x42')]=qs[_0xc3cc('0x42')](_0x349236['query']['limit']);_0x3092df[_0xc3cc('0x20')]=qs[_0xc3cc('0x20')](_0x349236[_0xc3cc('0x3b')][_0xc3cc('0x20')]);}_0x3092df[_0xc3cc('0x43')]=qs[_0xc3cc('0x44')](_0x349236['query']['sort']);_0x3092df[_0xc3cc('0x45')]=qs[_0xc3cc('0x3c')](_[_0xc3cc('0x46')](_0x349236[_0xc3cc('0x3b')],_0x103f1b['filters']));_0x3092df['where'][_0xc3cc('0x69')]=_0x535423['id'];if(_0x349236[_0xc3cc('0x3b')][_0xc3cc('0x2b')]){_0x3092df[_0xc3cc('0x45')]=_['merge'](_0x3092df[_0xc3cc('0x45')],{'$or':_['map'](_0x3092df[_0xc3cc('0x3f')],function(_0x307f62){var _0x1de332={};_0x1de332[_0x307f62]={'$like':'%'+_0x349236[_0xc3cc('0x3b')][_0xc3cc('0x2b')]+'%'};return _0x1de332;})});}_0x3092df=_['merge']({},_0x3092df,_0x349236[_0xc3cc('0x4f')]);return db[_0xc3cc('0x6d')][_0xc3cc('0x1f')]({'where':_0x3092df['where']})[_0xc3cc('0x26')](function(_0x87e651){_0x596925['count']=_0x87e651;if(_0x349236[_0xc3cc('0x3b')]['includeAll']){_0x3092df['include']=[{'all':!![]}];}return db[_0xc3cc('0x6d')][_0xc3cc('0x64')](_0x3092df);})[_0xc3cc('0x26')](function(_0x3b1051){_0x596925[_0xc3cc('0x65')]=_0x3b1051;return _0x596925;});}})[_0xc3cc('0x26')](respondWithFilteredResult(_0x229919,_0x3092df))[_0xc3cc('0x4c')](handleError(_0x229919,null));};exports[_0xc3cc('0x6e')]=function(_0x5ddda8,_0x265972,_0x4b6337){var _0x54a823={};var _0x58a113={};var _0x34b947;var _0x444e93;return db[_0xc3cc('0x37')][_0xc3cc('0x67')]({'where':{'id':_0x5ddda8[_0xc3cc('0x5c')]['id']}})[_0xc3cc('0x26')](handleEntityNotFound(_0x265972,null))[_0xc3cc('0x26')](function(_0x4ae3e5){if(_0x4ae3e5){_0x34b947=_0x4ae3e5;_0x58a113[_0xc3cc('0x39')]=_[_0xc3cc('0x3a')](db[_0xc3cc('0x6f')][_0xc3cc('0x38')]);_0x58a113['query']=_[_0xc3cc('0x3a')](_0x5ddda8[_0xc3cc('0x3b')]);_0x58a113[_0xc3cc('0x3c')]=_[_0xc3cc('0x3d')](_0x58a113[_0xc3cc('0x39')],_0x58a113['query']);_0x54a823[_0xc3cc('0x3f')]=_[_0xc3cc('0x3d')](_0x58a113[_0xc3cc('0x39')],qs[_0xc3cc('0x3e')](_0x5ddda8[_0xc3cc('0x3b')][_0xc3cc('0x3e')]));_0x54a823[_0xc3cc('0x3f')]=_0x54a823[_0xc3cc('0x3f')][_0xc3cc('0x40')]?_0x54a823[_0xc3cc('0x3f')]:_0x58a113[_0xc3cc('0x39')];_0x54a823[_0xc3cc('0x43')]=qs[_0xc3cc('0x44')](_0x5ddda8[_0xc3cc('0x3b')][_0xc3cc('0x44')]);_0x54a823['where']=qs[_0xc3cc('0x3c')](_['pick'](_0x5ddda8['query'],_0x58a113[_0xc3cc('0x3c')]));if(_0x5ddda8['query'][_0xc3cc('0x2b')]){_0x54a823[_0xc3cc('0x45')]=_['merge'](_0x54a823[_0xc3cc('0x45')],{'$or':_[_0xc3cc('0x2d')](_0x54a823[_0xc3cc('0x3f')],function(_0x5883ec){var _0x1854cd={};_0x1854cd[_0x5883ec]={'$like':'%'+_0x5ddda8[_0xc3cc('0x3b')][_0xc3cc('0x2b')]+'%'};return _0x1854cd;})});}_0x54a823=_[_0xc3cc('0x4a')]({},_0x54a823,_0x5ddda8[_0xc3cc('0x4f')]);return _0x34b947[_0xc3cc('0x6e')](_0x54a823);}})[_0xc3cc('0x26')](function(_0x59817d){if(_0x59817d){_0x444e93=_0x59817d[_0xc3cc('0x40')];if(!_0x5ddda8['query'][_0xc3cc('0x63')](_0xc3cc('0x41'))){_0x54a823[_0xc3cc('0x42')]=qs[_0xc3cc('0x42')](_0x5ddda8[_0xc3cc('0x3b')][_0xc3cc('0x42')]);_0x54a823[_0xc3cc('0x20')]=qs['offset'](_0x5ddda8[_0xc3cc('0x3b')][_0xc3cc('0x20')]);}return _0x34b947[_0xc3cc('0x6e')](_0x54a823);}})['then'](function(_0x1ab276){if(_0x1ab276){return _0x1ab276?{'count':_0x444e93,'rows':_0x1ab276}:null;}})[_0xc3cc('0x26')](respondWithResult(_0x265972,null))['catch'](handleError(_0x265972,null));};exports[_0xc3cc('0x70')]=function(_0x2e75ab,_0x1fbe1c,_0x953634){var _0x520c06=[];var _0x142934;return db[_0xc3cc('0x6f')][_0xc3cc('0x64')]({'where':{'id':_0x2e75ab[_0xc3cc('0x51')]['ids']},'attributes':['id'],'include':[{'model':db[_0xc3cc('0x71')],'as':_0xc3cc('0x72'),'attributes':['id'],'raw':!![]}]})[_0xc3cc('0x26')](function(_0x5e123d){if(_0x5e123d){for(var _0x9db3bc=0x0;_0x9db3bc<_0x5e123d[_0xc3cc('0x40')];_0x9db3bc+=0x1){for(var _0x93f4ef=0x0;_0x93f4ef<_0x5e123d[_0x9db3bc][_0xc3cc('0x72')][_0xc3cc('0x40')];_0x93f4ef+=0x1){_0x520c06=_[_0xc3cc('0x73')](_0x520c06,[_0x5e123d[_0x9db3bc][_0xc3cc('0x72')][_0x93f4ef]['id']]);}}return _0x520c06;}})[_0xc3cc('0x26')](function(_0x208290){if(_0x208290){return db[_0xc3cc('0x37')][_0xc3cc('0x31')]({'where':{'id':_0x2e75ab[_0xc3cc('0x5c')]['id']}});}})[_0xc3cc('0x26')](function(_0x4442a0){if(_0x4442a0){_0x142934=_0x4442a0;return _0x142934[_0xc3cc('0x74')](_0x520c06,{'penalty':_0x2e75ab['body'][_0xc3cc('0x75')]});}})[_0xc3cc('0x26')](function(_0x566c00){if(_0x566c00){return _0x142934['addTeams'](_0x2e75ab[_0xc3cc('0x51')]['ids']);}})['then'](handleEntityNotFound(_0x1fbe1c,null))[_0xc3cc('0x26')](respondWithStatusCode(_0x1fbe1c,null))[_0xc3cc('0x4c')](handleError(_0x1fbe1c,null));};exports[_0xc3cc('0x76')]=function(_0x7dea27,_0x2eb613,_0x3595d9){var _0x197d22=[];var _0x4c8bee;return db[_0xc3cc('0x6f')]['findAll']({'where':{'id':_0x7dea27[_0xc3cc('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc3cc('0x72'),'attributes':['id'],'raw':!![]}]})[_0xc3cc('0x26')](function(_0x403552){if(_0x403552){for(var _0x3c0333=0x0;_0x3c0333<_0x403552[_0xc3cc('0x40')];_0x3c0333+=0x1){for(var _0x3df7bc=0x0;_0x3df7bc<_0x403552[_0x3c0333][_0xc3cc('0x72')][_0xc3cc('0x40')];_0x3df7bc+=0x1){_0x197d22=_[_0xc3cc('0x73')](_0x197d22,[_0x403552[_0x3c0333][_0xc3cc('0x72')][_0x3df7bc]['id']]);}}return _0x197d22;}})[_0xc3cc('0x26')](function(_0x396f9a){if(_0x396f9a){return db[_0xc3cc('0x37')]['find']({'where':{'id':_0x7dea27[_0xc3cc('0x5c')]['id']}});}})[_0xc3cc('0x26')](function(_0x142aeb){if(_0x142aeb){_0x4c8bee=_0x142aeb;return _0x4c8bee[_0xc3cc('0x77')](_0x197d22);}})['then'](function(_0x558bd2){if(_0x4c8bee){return _0x4c8bee[_0xc3cc('0x76')](_0x7dea27[_0xc3cc('0x3b')]['ids']);}})[_0xc3cc('0x26')](handleEntityNotFound(_0x2eb613,null))[_0xc3cc('0x26')](respondWithStatusCode(_0x2eb613,null))['catch'](handleError(_0x2eb613,null));};exports[_0xc3cc('0x74')]=function(_0x12116a,_0x27c037,_0xab6867){var _0x404e33,_0x575963;return db['VoiceQueue'][_0xc3cc('0x31')]({'where':{'id':_0x12116a[_0xc3cc('0x5c')]['id']}})[_0xc3cc('0x26')](handleEntityNotFound(_0x27c037,null))[_0xc3cc('0x26')](function(_0x4cb641){if(_0x4cb641){_0x575963=_0x4cb641;return _0x4cb641['addAgents'](_0x12116a[_0xc3cc('0x51')][_0xc3cc('0x78')],_[_0xc3cc('0x5d')](_0x12116a[_0xc3cc('0x51')],['ids','id'])||{})[_0xc3cc('0x79')](function(_0x32ca0c){for(var _0x450fa9=0x0;_0x450fa9<_0x12116a['body']['ids'][_0xc3cc('0x40')];_0x450fa9+=0x1){socket[_0xc3cc('0x7a')]('userVoiceQueue:save',{'UserId':_0x12116a['body']['ids'][_0x450fa9],'VoiceQueueId':_0x12116a[_0xc3cc('0x5c')]['id']});}return _0x32ca0c;});}})[_0xc3cc('0x26')](function(_0x29f252){_0x404e33=_0x29f252||[];if(_0x575963){return db['User'][_0xc3cc('0x64')]({'where':{'id':_0x12116a['body']['ids']},'attributes':['id','name',_0xc3cc('0x7b'),'voicePause',_0xc3cc('0x7c')],'raw':!![]});}})[_0xc3cc('0x26')](function(_0x53c4aa){if(_0x53c4aa&&_0x53c4aa[_0xc3cc('0x40')]){var _0x3a6368=[];for(var _0x449ab8=0x0;_0x449ab8<_0x53c4aa[_0xc3cc('0x40')];_0x449ab8++){_0x3a6368[_0xc3cc('0x7d')](db[_0xc3cc('0x7e')][_0xc3cc('0x7f')]({'membername':_0x53c4aa[_0x449ab8]['name'],'UserId':_0x53c4aa[_0x449ab8]['id'],'queue_name':_0x575963[_0xc3cc('0x32')],'VoiceQueueId':_0x575963['id'],'interface':_[_0xc3cc('0x80')](_0x53c4aa[_0x449ab8][_0xc3cc('0x7c')])?util[_0xc3cc('0x81')]('SIP/%s',_0x53c4aa[_0x449ab8]['name']):_0x53c4aa[_0x449ab8][_0xc3cc('0x7c')],'paused':_0x53c4aa[_0x449ab8][_0xc3cc('0x82')]||![],'penalty':_0x12116a['body']['penalty']||0x0}));}return BPromise[_0xc3cc('0x83')](_0x3a6368);}})[_0xc3cc('0x26')](function(_0x50a3f1){return _0x404e33;})['then'](respondWithResult(_0x27c037,null))['catch'](handleError(_0x27c037,null));};exports[_0xc3cc('0x77')]=function(_0x529d24,_0x5374c2,_0x2d3c10){var _0x2dc8a6;return db['VoiceQueue'][_0xc3cc('0x31')]({'where':{'id':_0x529d24[_0xc3cc('0x5c')]['id']}})[_0xc3cc('0x26')](handleEntityNotFound(_0x5374c2,null))[_0xc3cc('0x26')](function(_0x29606c){if(_0x29606c){return _0x29606c['removeAgents'](_0x529d24[_0xc3cc('0x3b')][_0xc3cc('0x78')])['then'](function(_0xa3e90c){if(_[_0xc3cc('0x84')](_0x529d24[_0xc3cc('0x3b')][_0xc3cc('0x78')])){for(var _0x2feb58=0x0;_0x2feb58<_0x529d24['query'][_0xc3cc('0x78')][_0xc3cc('0x40')];_0x2feb58+=0x1){socket[_0xc3cc('0x7a')](_0xc3cc('0x85'),{'UserId':_0x529d24['query'][_0xc3cc('0x78')][_0x2feb58],'VoiceQueueId':_0x529d24[_0xc3cc('0x5c')]['id']});}}else{socket[_0xc3cc('0x7a')](_0xc3cc('0x85'),{'UserId':_0x529d24[_0xc3cc('0x3b')][_0xc3cc('0x78')],'VoiceQueueId':_0x529d24['params']['id']});}});}})['then'](function(_0x2aa17c){if(_0x529d24['query'][_0xc3cc('0x86')]){_0x2dc8a6=_0x2aa17c;return db[_0xc3cc('0x7e')][_0xc3cc('0x27')]({'where':{'VoiceQueueId':_0x529d24[_0xc3cc('0x5c')]['id'],'UserId':_0x529d24[_0xc3cc('0x3b')][_0xc3cc('0x78')]}})[_0xc3cc('0x26')](function(){return _0x2dc8a6;});}})[_0xc3cc('0x26')](respondWithStatusCode(_0x5374c2,null))[_0xc3cc('0x4c')](handleError(_0x5374c2,null));};exports[_0xc3cc('0x87')]=function(_0x3e9f60,_0x2c29d9,_0x25746a){var _0x538299={};var _0x370f84={};var _0x452523;var _0x59f33c;return db[_0xc3cc('0x37')]['findOne']({'where':{'id':_0x3e9f60['params']['id']}})[_0xc3cc('0x26')](handleEntityNotFound(_0x2c29d9,null))[_0xc3cc('0x26')](function(_0x122a1e){if(_0x122a1e){_0x452523=_0x122a1e;_0x370f84[_0xc3cc('0x39')]=_[_0xc3cc('0x3a')](db[_0xc3cc('0x71')]['rawAttributes']);_0x370f84['query']=_[_0xc3cc('0x3a')](_0x3e9f60[_0xc3cc('0x3b')]);_0x370f84['filters']=_['intersection'](_0x370f84[_0xc3cc('0x39')],_0x370f84[_0xc3cc('0x3b')]);_0x538299[_0xc3cc('0x3f')]=_[_0xc3cc('0x3d')](_0x370f84['model'],qs[_0xc3cc('0x3e')](_0x3e9f60['query'][_0xc3cc('0x3e')]));_0x538299['attributes']=_0x538299[_0xc3cc('0x3f')][_0xc3cc('0x40')]?_0x538299['attributes']:_0x370f84['model'];_0x538299[_0xc3cc('0x43')]=qs[_0xc3cc('0x44')](_0x3e9f60[_0xc3cc('0x3b')][_0xc3cc('0x44')]);_0x538299['where']=qs[_0xc3cc('0x3c')](_[_0xc3cc('0x46')](_0x3e9f60[_0xc3cc('0x3b')],_0x370f84['filters']));if(_0x3e9f60['query'][_0xc3cc('0x2b')]){_0x538299[_0xc3cc('0x45')]=_[_0xc3cc('0x4a')](_0x538299['where'],{'$or':_[_0xc3cc('0x2d')](_0x538299[_0xc3cc('0x3f')],function(_0x300260){var _0x1ada5e={};_0x1ada5e[_0x300260]={'$like':'%'+_0x3e9f60[_0xc3cc('0x3b')]['filter']+'%'};return _0x1ada5e;})});}_0x538299=_[_0xc3cc('0x4a')]({},_0x538299,_0x3e9f60['options']);return _0x452523[_0xc3cc('0x87')](_0x538299);}})[_0xc3cc('0x26')](function(_0x1d6921){if(_0x1d6921){_0x59f33c=_0x1d6921['length'];if(!_0x3e9f60['query'][_0xc3cc('0x63')](_0xc3cc('0x41'))){_0x538299[_0xc3cc('0x42')]=qs[_0xc3cc('0x42')](_0x3e9f60[_0xc3cc('0x3b')][_0xc3cc('0x42')]);_0x538299[_0xc3cc('0x20')]=qs[_0xc3cc('0x20')](_0x3e9f60[_0xc3cc('0x3b')]['offset']);}return _0x452523[_0xc3cc('0x87')](_0x538299);}})[_0xc3cc('0x26')](function(_0x45b7d3){if(_0x45b7d3){return _0x45b7d3?{'count':_0x59f33c,'rows':_0x45b7d3}:null;}})[_0xc3cc('0x26')](respondWithResult(_0x2c29d9,null))['catch'](handleError(_0x2c29d9,null));};exports[_0xc3cc('0x88')]=function(_0x55bfa3,_0x5970d2,_0x529f52){var _0x4c6ae3={};var _0x11dffa={};var _0x7929b9;var _0x2f1d8e;return db[_0xc3cc('0x37')][_0xc3cc('0x67')]({'where':{'id':_0x55bfa3['params']['id']}})['then'](handleEntityNotFound(_0x5970d2,null))[_0xc3cc('0x26')](function(_0x32ea53){if(_0x32ea53){_0x7929b9=_0x32ea53;_0x11dffa['model']=_[_0xc3cc('0x3a')](db[_0xc3cc('0x7e')][_0xc3cc('0x38')]);_0x11dffa['query']=_['keys'](_0x55bfa3[_0xc3cc('0x3b')]);_0x11dffa[_0xc3cc('0x3c')]=_[_0xc3cc('0x3d')](_0x11dffa[_0xc3cc('0x39')],_0x11dffa[_0xc3cc('0x3b')]);_0x4c6ae3[_0xc3cc('0x3f')]=_[_0xc3cc('0x3d')](_0x11dffa[_0xc3cc('0x39')],qs[_0xc3cc('0x3e')](_0x55bfa3[_0xc3cc('0x3b')]['fields']));_0x4c6ae3[_0xc3cc('0x3f')]=_0x4c6ae3[_0xc3cc('0x3f')][_0xc3cc('0x40')]?_0x4c6ae3[_0xc3cc('0x3f')]:_0x11dffa[_0xc3cc('0x39')];_0x4c6ae3[_0xc3cc('0x43')]=qs['sort'](_0x55bfa3[_0xc3cc('0x3b')]['sort']);_0x4c6ae3[_0xc3cc('0x45')]=qs[_0xc3cc('0x3c')](_[_0xc3cc('0x46')](_0x55bfa3[_0xc3cc('0x3b')],_0x11dffa[_0xc3cc('0x3c')]));if(_0x55bfa3[_0xc3cc('0x3b')]['filter']){_0x4c6ae3[_0xc3cc('0x45')]=_[_0xc3cc('0x4a')](_0x4c6ae3[_0xc3cc('0x45')],{'$or':_[_0xc3cc('0x2d')](_0x4c6ae3[_0xc3cc('0x3f')],function(_0xaab9ac){var _0x114e3b={};_0x114e3b[_0xaab9ac]={'$like':'%'+_0x55bfa3[_0xc3cc('0x3b')][_0xc3cc('0x2b')]+'%'};return _0x114e3b;})});}_0x4c6ae3=_[_0xc3cc('0x4a')]({},_0x4c6ae3,_0x55bfa3[_0xc3cc('0x4f')]);return _0x7929b9[_0xc3cc('0x88')](_0x4c6ae3);}})[_0xc3cc('0x26')](function(_0x57ecbf){if(_0x57ecbf){_0x2f1d8e=_0x57ecbf['length'];if(!_0x55bfa3[_0xc3cc('0x3b')]['hasOwnProperty'](_0xc3cc('0x41'))){_0x4c6ae3['limit']=qs[_0xc3cc('0x42')](_0x55bfa3[_0xc3cc('0x3b')][_0xc3cc('0x42')]);_0x4c6ae3[_0xc3cc('0x20')]=qs[_0xc3cc('0x20')](_0x55bfa3[_0xc3cc('0x3b')][_0xc3cc('0x20')]);}return _0x7929b9[_0xc3cc('0x88')](_0x4c6ae3);}})['then'](function(_0x99c281){return _0x99c281?{'count':_0x2f1d8e,'rows':_0x99c281}:null;})[_0xc3cc('0x26')](respondWithResult(_0x5970d2,null))['catch'](handleError(_0x5970d2,null));};exports[_0xc3cc('0x89')]=function(_0x1a66e4,_0x2b74b4,_0x5f12c9){var _0x1f70b9={};var _0x3f7e86={};var _0x4e23c6;var _0x5b3e8b;return db['VoiceQueue'][_0xc3cc('0x67')]({'where':{'id':_0x1a66e4[_0xc3cc('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2b74b4,null))[_0xc3cc('0x26')](function(_0x4e3a4d){if(_0x4e3a4d){_0x4e23c6=_0x4e3a4d;_0x3f7e86[_0xc3cc('0x39')]=_[_0xc3cc('0x3a')](db[_0xc3cc('0x8a')]['rawAttributes']);_0x3f7e86[_0xc3cc('0x3b')]=_[_0xc3cc('0x3a')](_0x1a66e4[_0xc3cc('0x3b')]);_0x3f7e86[_0xc3cc('0x3c')]=_['intersection'](_0x3f7e86[_0xc3cc('0x39')],_0x3f7e86[_0xc3cc('0x3b')]);_0x1f70b9[_0xc3cc('0x3f')]=_['intersection'](_0x3f7e86[_0xc3cc('0x39')],qs[_0xc3cc('0x3e')](_0x1a66e4[_0xc3cc('0x3b')]['fields']));_0x1f70b9[_0xc3cc('0x3f')]=_0x1f70b9['attributes'][_0xc3cc('0x40')]?_0x1f70b9[_0xc3cc('0x3f')]:_0x3f7e86['model'];_0x1f70b9[_0xc3cc('0x43')]=qs[_0xc3cc('0x44')](_0x1a66e4['query']['sort']);_0x1f70b9['where']=qs['filters'](_[_0xc3cc('0x46')](_0x1a66e4[_0xc3cc('0x3b')],_0x3f7e86[_0xc3cc('0x3c')]));if(_0x1a66e4[_0xc3cc('0x3b')][_0xc3cc('0x2b')]){_0x1f70b9['where']=_['merge'](_0x1f70b9[_0xc3cc('0x45')],{'$or':_[_0xc3cc('0x2d')](_0x1f70b9['attributes'],function(_0x1e5998){var _0x449fe6={};_0x449fe6[_0x1e5998]={'$like':'%'+_0x1a66e4[_0xc3cc('0x3b')][_0xc3cc('0x2b')]+'%'};return _0x449fe6;})});}_0x1f70b9=_[_0xc3cc('0x4a')]({},_0x1f70b9,_0x1a66e4[_0xc3cc('0x4f')]);return _0x4e23c6[_0xc3cc('0x89')](_0x1f70b9);}})[_0xc3cc('0x26')](function(_0x2825a8){if(_0x2825a8){_0x5b3e8b=_0x2825a8[_0xc3cc('0x40')];if(!_0x1a66e4['query'][_0xc3cc('0x63')](_0xc3cc('0x41'))){_0x1f70b9[_0xc3cc('0x42')]=qs[_0xc3cc('0x42')](_0x1a66e4[_0xc3cc('0x3b')][_0xc3cc('0x42')]);_0x1f70b9[_0xc3cc('0x20')]=qs[_0xc3cc('0x20')](_0x1a66e4[_0xc3cc('0x3b')]['offset']);}return _0x4e23c6['getLists'](_0x1f70b9);}})[_0xc3cc('0x26')](function(_0x391b31){if(_0x391b31){return _0x391b31?{'count':_0x5b3e8b,'rows':_0x391b31}:null;}})[_0xc3cc('0x26')](respondWithResult(_0x2b74b4,null))[_0xc3cc('0x4c')](handleError(_0x2b74b4,null));};exports[_0xc3cc('0x8b')]=function(_0x16ab39,_0x2bb595,_0x368251){var _0x349e1d,_0x46d33a;return db[_0xc3cc('0x37')][_0xc3cc('0x31')]({'where':{'id':_0x16ab39[_0xc3cc('0x5c')]['id']}})[_0xc3cc('0x26')](handleEntityNotFound(_0x2bb595,null))[_0xc3cc('0x26')](function(_0x5216cb){if(_0x5216cb){_0x46d33a=_0x5216cb;return _0x5216cb['addLists'](_0x16ab39['body'][_0xc3cc('0x78')],_['omit'](_0x16ab39['body'],[_0xc3cc('0x78'),'id'])||{});}return null;})[_0xc3cc('0x79')](function(_0x356bd4){var _0x3bac14;_0x349e1d=_0x356bd4||[];var _0x1a4f31=[];if(_0x356bd4){for(var _0x4379a7=0x0;_0x4379a7<_0x356bd4[_0xc3cc('0x40')];_0x4379a7+=0x1){var _0x5f3542=_0x356bd4[_0x4379a7][_0xc3cc('0x28')]({'plain':!![]});_0x46d33a[_0xc3cc('0x8c')]=_0x16ab39[_0xc3cc('0x51')][_0xc3cc('0x8c')]?_0x16ab39[_0xc3cc('0x51')][_0xc3cc('0x8c')]:_0x46d33a['dialCheckDuplicateType'];switch(_0x46d33a[_0xc3cc('0x8c')]){case _0xc3cc('0x8d'):_0x3bac14=squel[_0xc3cc('0x8e')]()[_0xc3cc('0x8f')](_0xc3cc('0x90'))['fromQuery']([_0xc3cc('0x91'),'scheduledAt',_0xc3cc('0x92'),_0xc3cc('0x93'),'VoiceQueueId','createdAt',_0xc3cc('0x5f')],squel[_0xc3cc('0x94')]()[_0xc3cc('0x49')](_0xc3cc('0x91'),_0xc3cc('0x91'))[_0xc3cc('0x49')](_0xc3cc('0x95'),_0xc3cc('0x96'))['field']('id',_0xc3cc('0x92'))[_0xc3cc('0x49')](_0x5f3542[_0xc3cc('0x97')][_0xc3cc('0x98')](),_0xc3cc('0x93'))[_0xc3cc('0x49')](_0x16ab39[_0xc3cc('0x5c')]['id'][_0xc3cc('0x98')](),_0xc3cc('0x69'))[_0xc3cc('0x49')](_0xc3cc('0x95'),_0xc3cc('0x5e'))[_0xc3cc('0x49')](_0xc3cc('0x95'),_0xc3cc('0x5f'))[_0xc3cc('0x99')](_0xc3cc('0x9a'))[_0xc3cc('0x45')](_0xc3cc('0x9b'))[_0xc3cc('0x45')](_0xc3cc('0x9c'),_0x5f3542[_0xc3cc('0x97')]['toString']())[_0xc3cc('0x45')]('phone\x20IS\x20NOT\x20NULL')[_0xc3cc('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc3cc('0x94')]()[_0xc3cc('0x49')]('COALESCE(calleridnum,\x27\x27)')[_0xc3cc('0x99')](_0xc3cc('0x9d'))['where'](_0xc3cc('0x9e'),_0x16ab39[_0xc3cc('0x5c')]['id'][_0xc3cc('0x98')]()))[_0xc3cc('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc3cc('0x94')]()[_0xc3cc('0x49')](_0xc3cc('0x9f'))[_0xc3cc('0x99')](_0xc3cc('0x90'))['where']('VoiceQueueId\x20=\x20?',_0x16ab39['params']['id'][_0xc3cc('0x98')]())))[_0xc3cc('0x98')]();break;case _0xc3cc('0xa0'):_0x3bac14=squel[_0xc3cc('0x8e')]()[_0xc3cc('0x8f')](_0xc3cc('0x90'))[_0xc3cc('0xa1')]([_0xc3cc('0x91'),_0xc3cc('0x96'),'ContactId','ListId','VoiceQueueId',_0xc3cc('0x5e'),'updatedAt'],squel[_0xc3cc('0x94')]()['field'](_0xc3cc('0x91'),_0xc3cc('0x91'))['field'](_0xc3cc('0x95'),_0xc3cc('0x96'))[_0xc3cc('0x49')]('id',_0xc3cc('0x92'))[_0xc3cc('0x49')](_0x5f3542['CmListId'][_0xc3cc('0x98')](),'ListId')[_0xc3cc('0x49')](_0x16ab39[_0xc3cc('0x5c')]['id']['toString'](),_0xc3cc('0x69'))[_0xc3cc('0x49')](_0xc3cc('0x95'),_0xc3cc('0x5e'))[_0xc3cc('0x49')](_0xc3cc('0x95'),_0xc3cc('0x5f'))[_0xc3cc('0x99')]('cm_contacts')[_0xc3cc('0x45')](_0xc3cc('0x9b'))[_0xc3cc('0x45')](_0xc3cc('0x9c'),_0x5f3542[_0xc3cc('0x97')][_0xc3cc('0x98')]())[_0xc3cc('0x45')](_0xc3cc('0xa2'))[_0xc3cc('0x45')](_0xc3cc('0xa3'),squel[_0xc3cc('0x94')]()[_0xc3cc('0x49')](_0xc3cc('0x9f'))['from'](_0xc3cc('0x90'))[_0xc3cc('0x45')](_0xc3cc('0x9e'),_0x16ab39['params']['id']['toString']())))[_0xc3cc('0x98')]();break;default:_0x3bac14=squel[_0xc3cc('0x8e')]()['into']('cm_hopper')['fromQuery']([_0xc3cc('0x91'),_0xc3cc('0x96'),_0xc3cc('0x92'),_0xc3cc('0x93'),_0xc3cc('0x69'),_0xc3cc('0x5e'),_0xc3cc('0x5f')],squel[_0xc3cc('0x94')]()[_0xc3cc('0x49')](_0xc3cc('0x91'),_0xc3cc('0x91'))[_0xc3cc('0x49')](_0xc3cc('0x95'),_0xc3cc('0x96'))[_0xc3cc('0x49')]('id','ContactId')[_0xc3cc('0x49')](_0x5f3542[_0xc3cc('0x97')][_0xc3cc('0x98')](),_0xc3cc('0x93'))[_0xc3cc('0x49')](_0x16ab39[_0xc3cc('0x5c')]['id'][_0xc3cc('0x98')](),'VoiceQueueId')['field'](_0xc3cc('0x95'),_0xc3cc('0x5e'))[_0xc3cc('0x49')](_0xc3cc('0x95'),_0xc3cc('0x5f'))[_0xc3cc('0x99')](_0xc3cc('0x9a'))[_0xc3cc('0x45')](_0xc3cc('0x9b'))['where'](_0xc3cc('0x9c'),_0x5f3542[_0xc3cc('0x97')][_0xc3cc('0x98')]())[_0xc3cc('0x45')]('phone\x20IS\x20NOT\x20NULL'))[_0xc3cc('0x98')]();}_0x1a4f31[_0xc3cc('0x7d')](db[_0xc3cc('0xa4')][_0xc3cc('0x3b')](_0x3bac14));}return BPromise[_0xc3cc('0x83')](_0x1a4f31);}})[_0xc3cc('0x26')](function(){return _0x349e1d;})[_0xc3cc('0x26')](respondWithResult(_0x2bb595,null))['catch'](handleError(_0x2bb595,null));};exports[_0xc3cc('0xa5')]=function(_0x2ee541,_0x3fb373,_0x4931a2){var _0x30c425;return db[_0xc3cc('0x37')][_0xc3cc('0x31')]({'where':{'id':_0x2ee541[_0xc3cc('0x5c')]['id']}})[_0xc3cc('0x26')](handleEntityNotFound(_0x3fb373,null))[_0xc3cc('0x26')](function(_0x51e3a3){if(_0x51e3a3){return _0x51e3a3['removeLists'](_0x2ee541[_0xc3cc('0x3b')][_0xc3cc('0x78')]);}})['then'](function(_0x326937){if(_0x326937){_0x30c425=_0x326937;return db[_0xc3cc('0x62')][_0xc3cc('0x27')]({'where':{'ListId':_0x2ee541[_0xc3cc('0x3b')][_0xc3cc('0x78')],'VoiceQueueId':_0x2ee541[_0xc3cc('0x5c')]['id']}})[_0xc3cc('0x26')](function(){return _0x30c425;});}})[_0xc3cc('0x26')](respondWithStatusCode(_0x3fb373,null))[_0xc3cc('0x4c')](handleError(_0x3fb373,null));};exports[_0xc3cc('0xa6')]=function(_0x5f294c,_0x4fb379,_0x251bf4){var _0x31ae79={};var _0xc74741={};var _0x2d13f6;var _0x59c49b;return db['VoiceQueue'][_0xc3cc('0x67')]({'where':{'id':_0x5f294c[_0xc3cc('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4fb379,null))['then'](function(_0x43b72d){if(_0x43b72d){_0x2d13f6=_0x43b72d;_0xc74741[_0xc3cc('0x39')]=_[_0xc3cc('0x3a')](db[_0xc3cc('0x8a')]['rawAttributes']);_0xc74741[_0xc3cc('0x3b')]=_['keys'](_0x5f294c[_0xc3cc('0x3b')]);_0xc74741['filters']=_[_0xc3cc('0x3d')](_0xc74741['model'],_0xc74741['query']);_0x31ae79[_0xc3cc('0x3f')]=_[_0xc3cc('0x3d')](_0xc74741['model'],qs[_0xc3cc('0x3e')](_0x5f294c[_0xc3cc('0x3b')][_0xc3cc('0x3e')]));_0x31ae79[_0xc3cc('0x3f')]=_0x31ae79['attributes'][_0xc3cc('0x40')]?_0x31ae79[_0xc3cc('0x3f')]:_0xc74741[_0xc3cc('0x39')];_0x31ae79[_0xc3cc('0x43')]=qs[_0xc3cc('0x44')](_0x5f294c[_0xc3cc('0x3b')][_0xc3cc('0x44')]);_0x31ae79[_0xc3cc('0x45')]=qs['filters'](_[_0xc3cc('0x46')](_0x5f294c[_0xc3cc('0x3b')],_0xc74741['filters']));if(_0x5f294c[_0xc3cc('0x3b')][_0xc3cc('0x2b')]){_0x31ae79['where']=_[_0xc3cc('0x4a')](_0x31ae79[_0xc3cc('0x45')],{'$or':_[_0xc3cc('0x2d')](_0x31ae79[_0xc3cc('0x3f')],function(_0x942f48){var _0x4202a4={};_0x4202a4[_0x942f48]={'$like':'%'+_0x5f294c[_0xc3cc('0x3b')][_0xc3cc('0x2b')]+'%'};return _0x4202a4;})});}_0x31ae79=_[_0xc3cc('0x4a')]({},_0x31ae79,_0x5f294c[_0xc3cc('0x4f')]);return _0x2d13f6['getBlackLists'](_0x31ae79);}})[_0xc3cc('0x26')](function(_0x48f71a){if(_0x48f71a){_0x59c49b=_0x48f71a[_0xc3cc('0x40')];if(!_0x5f294c['query'][_0xc3cc('0x63')]('nolimit')){_0x31ae79[_0xc3cc('0x42')]=qs['limit'](_0x5f294c[_0xc3cc('0x3b')][_0xc3cc('0x42')]);_0x31ae79['offset']=qs[_0xc3cc('0x20')](_0x5f294c[_0xc3cc('0x3b')][_0xc3cc('0x20')]);}return _0x2d13f6[_0xc3cc('0xa6')](_0x31ae79);}})[_0xc3cc('0x26')](function(_0x38c7a4){if(_0x38c7a4){return _0x38c7a4?{'count':_0x59c49b,'rows':_0x38c7a4}:null;}})[_0xc3cc('0x26')](respondWithResult(_0x4fb379,null))[_0xc3cc('0x4c')](handleError(_0x4fb379,null));};exports[_0xc3cc('0xa7')]=function(_0x15d69f,_0x60dfde,_0x467fc7){var _0x557eac,_0x286380;return db[_0xc3cc('0x37')]['find']({'where':{'id':_0x15d69f[_0xc3cc('0x5c')]['id']}})['then'](handleEntityNotFound(_0x60dfde,null))['then'](function(_0x496d59){if(_0x496d59){_0x286380=_0x496d59;return _0x496d59[_0xc3cc('0xa7')](_0x15d69f[_0xc3cc('0x51')]['ids'],_['omit'](_0x15d69f['body'],[_0xc3cc('0x78'),'id'])||{});}return null;})['spread'](function(_0x378c30){var _0x20ecd9;_0x557eac=_0x378c30||[];var _0x19fb39=[];if(_0x378c30){for(var _0x4a95e7=0x0;_0x4a95e7<_0x378c30[_0xc3cc('0x40')];_0x4a95e7+=0x1){var _0x5d8a8a=_0x378c30[_0x4a95e7][_0xc3cc('0x28')]({'plain':!![]});_0x20ecd9=squel[_0xc3cc('0x8e')]()[_0xc3cc('0x8f')](_0xc3cc('0xa8'))[_0xc3cc('0xa1')]([_0xc3cc('0x91'),_0xc3cc('0x92'),_0xc3cc('0x93'),_0xc3cc('0x69'),'createdAt',_0xc3cc('0x5f')],squel[_0xc3cc('0x94')]()[_0xc3cc('0x49')](_0xc3cc('0x91'),'phone')[_0xc3cc('0x49')]('id',_0xc3cc('0x92'))[_0xc3cc('0x49')](_0x5d8a8a['CmListId'][_0xc3cc('0x98')](),_0xc3cc('0x93'))['field'](_0x15d69f['params']['id'][_0xc3cc('0x98')](),_0xc3cc('0x69'))[_0xc3cc('0x49')]('NOW()',_0xc3cc('0x5e'))[_0xc3cc('0x49')](_0xc3cc('0x95'),_0xc3cc('0x5f'))[_0xc3cc('0x99')]('cm_contacts')[_0xc3cc('0x45')](_0xc3cc('0x9b'))[_0xc3cc('0x45')](_0xc3cc('0x9c'),_0x5d8a8a['CmListId'][_0xc3cc('0x98')]())[_0xc3cc('0x45')](_0xc3cc('0xa2')))['toString']();_0x19fb39['push'](db['sequelize'][_0xc3cc('0x3b')](_0x20ecd9));}return BPromise[_0xc3cc('0x83')](_0x19fb39);}})['then'](function(){return _0x557eac;})[_0xc3cc('0x26')](respondWithResult(_0x60dfde,null))[_0xc3cc('0x4c')](handleError(_0x60dfde,null));};exports[_0xc3cc('0xa9')]=function(_0xb7699,_0x3db138,_0x2cfc83){var _0x3b4169;return db['VoiceQueue'][_0xc3cc('0x31')]({'where':{'id':_0xb7699[_0xc3cc('0x5c')]['id']}})[_0xc3cc('0x26')](handleEntityNotFound(_0x3db138,null))['then'](function(_0x1d1e22){if(_0x1d1e22){return _0x1d1e22[_0xc3cc('0xa9')](_0xb7699[_0xc3cc('0x3b')][_0xc3cc('0x78')]);}})[_0xc3cc('0x26')](function(_0x2429c1){if(_0x2429c1){_0x3b4169=_0x2429c1;return db['CmHopperBlack']['destroy']({'where':{'ListId':_0xb7699[_0xc3cc('0x3b')][_0xc3cc('0x78')],'VoiceQueueId':_0xb7699[_0xc3cc('0x5c')]['id']}})[_0xc3cc('0x26')](function(){return _0x3b4169;});}})[_0xc3cc('0x26')](respondWithStatusCode(_0x3db138,null))['catch'](handleError(_0x3db138,null));}; \ No newline at end of file +var _0x1ad4=['intersection','length','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','user','error','getHoppers','CmHopper','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','findAll','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','ids','User','Agents','union','addAgents','penalty','removeTeams','removeAgents','emit','userVoiceQueue:save','loginInPause','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','voicePause','all','realtime','getAgents','getMembers','CmList','getLists','addLists','spread','dialCheckDuplicateType','insert','cm_hopper','fromQuery','phone','ListId','select','NOW()','scheduledAt','ContactId','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','sequelize','removeLists','getBlackLists','addBlackLists','push','removeBlackLists','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','querystring','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./voiceQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','get','inbound','QueueCampaigns','outbound','map','value','includes','type','find','name','UserProfileResource','stack','index','VoiceQueue','rawAttributes','model','keys','query','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','key','field','merge','options','includeAll','include','rows','params'];(function(_0x1891fe,_0x333cc4){var _0x771a27=function(_0x120a15){while(--_0x120a15){_0x1891fe['push'](_0x1891fe['shift']());}};_0x771a27(++_0x333cc4);}(_0x1ad4,0xf4));var _0x41ad=function(_0x782d78,_0x5ec4fe){_0x782d78=_0x782d78-0x0;var _0x4ef52b=_0x1ad4[_0x782d78];return _0x4ef52b;};'use strict';var pdf=require(_0x41ad('0x0'));var emlformat=require(_0x41ad('0x1'));var rimraf=require(_0x41ad('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x41ad('0x3'));var rp=require(_0x41ad('0x4'));var moment=require('moment');var BPromise=require(_0x41ad('0x5'));var Mustache=require('mustache');var util=require(_0x41ad('0x6'));var path=require(_0x41ad('0x7'));var sox=require(_0x41ad('0x8'));var csv=require(_0x41ad('0x9'));var ejs=require(_0x41ad('0xa'));var fs=require('fs');var _=require(_0x41ad('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x41ad('0x9'));var querystring=require(_0x41ad('0xc'));var Papa=require('papaparse');var authService=require(_0x41ad('0xd'));var hardwareService=require('../../config/license/hardware');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x41ad('0xe'))(_0x41ad('0xf'));var utils=require(_0x41ad('0x10'));var config=require(_0x41ad('0x11'));var db=require(_0x41ad('0x12'))['db'];config[_0x41ad('0x13')]=_['defaults'](config[_0x41ad('0x13')],{'host':_0x41ad('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x41ad('0x13')]));require(_0x41ad('0x15'))[_0x41ad('0x16')](socket);function respondWithStatusCode(_0x1df773,_0x10d8c1){_0x10d8c1=_0x10d8c1||0xcc;return function(_0x2ae14b){if(_0x2ae14b){return _0x1df773[_0x41ad('0x17')](_0x10d8c1);}return _0x1df773[_0x41ad('0x18')](_0x10d8c1)[_0x41ad('0x19')]();};}function respondWithResult(_0x13d01e,_0x3f83e8){_0x3f83e8=_0x3f83e8||0xc8;return function(_0x7eaf3c){if(_0x7eaf3c){return _0x13d01e['status'](_0x3f83e8)[_0x41ad('0x1a')](_0x7eaf3c);}};}function respondWithFilteredResult(_0xed9b43,_0x2f85b8){return function(_0x210ed2){if(_0x210ed2){var _0x145128=_0x210ed2[_0x41ad('0x1b')],_0x582ce8=_0x2f85b8['offset'],_0x3f232b=_0x2f85b8[_0x41ad('0x1c')]+_0x2f85b8[_0x41ad('0x1d')],_0x1152f9;if(_0x3f232b>=_0x145128){_0x3f232b=_0x145128;_0x1152f9=0xc8;}else{_0x1152f9=0xce;}_0xed9b43[_0x41ad('0x18')](_0x1152f9);return _0xed9b43[_0x41ad('0x1e')](_0x41ad('0x1f'),_0x582ce8+'-'+_0x3f232b+'/'+_0x145128)[_0x41ad('0x1a')](_0x210ed2);}return null;};}function patchUpdates(_0x2fb883){return function(_0x4a6d3e){try{jsonpatch['apply'](_0x4a6d3e,_0x2fb883,!![]);}catch(_0x372004){return BPromise[_0x41ad('0x20')](_0x372004);}return _0x4a6d3e['save']();};}function saveUpdates(_0x3b1d36,_0x33e61e){return function(_0x2a1111){if(_0x2a1111){return _0x2a1111[_0x41ad('0x21')](_0x3b1d36)[_0x41ad('0x22')](function(_0x27a144){return _0x27a144;});}return null;};}function removeEntity(_0x56727c,_0x20555d){return function(_0x3abe45){if(_0x3abe45){return _0x3abe45[_0x41ad('0x23')]()[_0x41ad('0x22')](function(){var _0x170689=_0x3abe45[_0x41ad('0x24')]({'plain':!![]});var _0x4ecb5e=[{'name':'VoiceQueues','value':_0x41ad('0x25'),'ignore':![]},{'name':_0x41ad('0x26'),'value':_0x41ad('0x27'),'ignore':![]}];var _0x368dd3=_(_0x4ecb5e)['filter']('ignore')[_0x41ad('0x28')](_0x41ad('0x29'))['value']();if(_[_0x41ad('0x2a')](_0x368dd3,_0x170689[_0x41ad('0x2b')])){return;}var _0x1d6103=_[_0x41ad('0x2c')](_0x4ecb5e,['value',_0x170689['type']])[_0x41ad('0x2d')];return db[_0x41ad('0x2e')][_0x41ad('0x23')]({'where':{'type':_0x1d6103,'resourceId':_0x170689['id']}})[_0x41ad('0x22')](function(){return _0x3abe45;});})[_0x41ad('0x22')](function(){_0x56727c[_0x41ad('0x18')](0xcc)[_0x41ad('0x19')]();});}};}function handleEntityNotFound(_0x5c3621,_0x3025ba){return function(_0x26c108){if(!_0x26c108){_0x5c3621[_0x41ad('0x17')](0x194);}return _0x26c108;};}function handleError(_0x29fbfd,_0x1e1d2f){_0x1e1d2f=_0x1e1d2f||0x1f4;return function(_0x56bde8){logger['error'](_0x56bde8[_0x41ad('0x2f')]);if(_0x56bde8['name']){delete _0x56bde8[_0x41ad('0x2d')];}_0x29fbfd[_0x41ad('0x18')](_0x1e1d2f)['send'](_0x56bde8);};}exports[_0x41ad('0x30')]=function(_0x5c5114,_0x23f29c){var _0x1a6ed0={},_0x1cab07={},_0x274057={'count':0x0,'rows':[]};var _0x7f7819=db[_0x41ad('0x31')][_0x41ad('0x32')];_0x1cab07[_0x41ad('0x33')]=_[_0x41ad('0x34')](_0x7f7819);_0x1cab07[_0x41ad('0x35')]=_[_0x41ad('0x34')](_0x5c5114[_0x41ad('0x35')]);_0x1cab07[_0x41ad('0x36')]=_['intersection'](_0x1cab07[_0x41ad('0x33')],_0x1cab07[_0x41ad('0x35')]);_0x1a6ed0['attributes']=_['intersection'](_0x1cab07[_0x41ad('0x33')],qs[_0x41ad('0x37')](_0x5c5114[_0x41ad('0x35')]['fields']));_0x1a6ed0[_0x41ad('0x38')]=_0x1a6ed0[_0x41ad('0x38')]['length']?_0x1a6ed0[_0x41ad('0x38')]:_0x1cab07[_0x41ad('0x33')];if(!_0x5c5114[_0x41ad('0x35')][_0x41ad('0x39')](_0x41ad('0x3a'))){_0x1a6ed0[_0x41ad('0x1d')]=qs[_0x41ad('0x1d')](_0x5c5114[_0x41ad('0x35')]['limit']);_0x1a6ed0[_0x41ad('0x1c')]=qs[_0x41ad('0x1c')](_0x5c5114[_0x41ad('0x35')]['offset']);}_0x1a6ed0[_0x41ad('0x3b')]=qs['sort'](_0x5c5114[_0x41ad('0x35')][_0x41ad('0x3c')]);_0x1a6ed0[_0x41ad('0x3d')]=qs[_0x41ad('0x36')](_[_0x41ad('0x3e')](_0x5c5114['query'],_0x1cab07[_0x41ad('0x36')]));if(_0x5c5114['query'][_0x41ad('0x3f')]){_0x1a6ed0[_0x41ad('0x3d')]=_['merge'](_0x1a6ed0['where'],{'$or':_[_0x41ad('0x28')](_0x7f7819,function(_0x4baaef){if(_0x4baaef[_0x41ad('0x2b')][_0x41ad('0x40')]!=='VIRTUAL'){var _0x4eb321={};_0x4eb321[_0x4baaef[_0x41ad('0x41')]]={'$like':'%'+_0x5c5114[_0x41ad('0x35')][_0x41ad('0x3f')]+'%'};return _0x4eb321;}})});}_0x1a6ed0=_[_0x41ad('0x42')]({},_0x1a6ed0,_0x5c5114[_0x41ad('0x43')]);var _0x19eaa3={'where':_0x1a6ed0[_0x41ad('0x3d')]};return db[_0x41ad('0x31')][_0x41ad('0x1b')](_0x19eaa3)['then'](function(_0xb2463e){_0x274057[_0x41ad('0x1b')]=_0xb2463e;if(_0x5c5114['query'][_0x41ad('0x44')]){_0x1a6ed0[_0x41ad('0x45')]=[{'all':!![]}];}return db[_0x41ad('0x31')]['findAll'](_0x1a6ed0);})['then'](function(_0x4f09a7){_0x274057[_0x41ad('0x46')]=_0x4f09a7;return _0x274057;})[_0x41ad('0x22')](respondWithFilteredResult(_0x23f29c,_0x1a6ed0))['catch'](handleError(_0x23f29c,null));};exports['show']=function(_0x3f0622,_0xfdad1a){var _0x4295f3={'raw':![],'where':{'id':_0x3f0622[_0x41ad('0x47')]['id']}},_0x14b486={};_0x14b486[_0x41ad('0x33')]=_['keys'](db[_0x41ad('0x31')][_0x41ad('0x32')]);_0x14b486[_0x41ad('0x35')]=_[_0x41ad('0x34')](_0x3f0622['query']);_0x14b486[_0x41ad('0x36')]=_[_0x41ad('0x48')](_0x14b486[_0x41ad('0x33')],_0x14b486['query']);_0x4295f3[_0x41ad('0x38')]=_['intersection'](_0x14b486[_0x41ad('0x33')],qs[_0x41ad('0x37')](_0x3f0622['query'][_0x41ad('0x37')]));_0x4295f3[_0x41ad('0x38')]=_0x4295f3[_0x41ad('0x38')][_0x41ad('0x49')]?_0x4295f3[_0x41ad('0x38')]:_0x14b486[_0x41ad('0x33')];if(_0x3f0622[_0x41ad('0x35')][_0x41ad('0x44')]){_0x4295f3[_0x41ad('0x45')]=[{'all':!![]}];}_0x4295f3=_[_0x41ad('0x42')]({},_0x4295f3,_0x3f0622['options']);return db['VoiceQueue']['find'](_0x4295f3)[_0x41ad('0x22')](handleEntityNotFound(_0xfdad1a,null))[_0x41ad('0x22')](respondWithResult(_0xfdad1a,null))[_0x41ad('0x4a')](handleError(_0xfdad1a,null));};exports[_0x41ad('0x4b')]=function(_0x531195,_0x42798c){return db[_0x41ad('0x31')][_0x41ad('0x4b')](_0x531195[_0x41ad('0x4c')],{})[_0x41ad('0x22')](function(_0x22e4c6){var _0x51f1ab=_0x531195['user'][_0x41ad('0x24')]({'plain':!![]});if(!_0x51f1ab)throw new Error(_0x41ad('0x4d'));if(_0x51f1ab[_0x41ad('0x4e')]==='user'){var _0xc73553=_0x22e4c6['get']({'plain':!![]});var _0x26c226=[{'name':_0x41ad('0x4f'),'value':_0x41ad('0x25')},{'name':_0x41ad('0x26'),'value':'outbound'}];var _0x3fc16e=_['find'](_0x26c226,['value',_0xc73553[_0x41ad('0x2b')]])[_0x41ad('0x2d')];return db[_0x41ad('0x50')]['find']({'where':{'name':_0x3fc16e,'userProfileId':_0x51f1ab[_0x41ad('0x51')]},'raw':!![]})[_0x41ad('0x22')](function(_0x26bfa0){if(_0x26bfa0&&_0x26bfa0[_0x41ad('0x52')]===0x0){return db[_0x41ad('0x2e')]['create']({'name':_0xc73553['name'],'resourceId':_0xc73553['id'],'type':_0x26bfa0[_0x41ad('0x2d')],'sectionId':_0x26bfa0['id']},{})['then'](function(){return _0x22e4c6;});}else{return _0x22e4c6;}})['catch'](function(_0x5d5906){logger['error'](_0x41ad('0x53'),_0x5d5906);throw _0x5d5906;});}return _0x22e4c6;})[_0x41ad('0x22')](respondWithResult(_0x42798c,0xc9))[_0x41ad('0x4a')](handleError(_0x42798c,null));};exports[_0x41ad('0x54')]=function(_0xcef98c,_0x35e05c){var _0x22ca05={'raw':![],'where':{'id':_0xcef98c['params']['id']}},_0x3d865e={};_0x3d865e[_0x41ad('0x33')]=_[_0x41ad('0x34')](db[_0x41ad('0x31')][_0x41ad('0x32')]);_0x22ca05[_0x41ad('0x38')]=_[_0x41ad('0x48')](_0x3d865e[_0x41ad('0x33')],qs[_0x41ad('0x37')](_0xcef98c[_0x41ad('0x35')][_0x41ad('0x37')]));_0x22ca05[_0x41ad('0x38')]=_0x22ca05[_0x41ad('0x38')]['length']?_0x22ca05['attributes']:_0x3d865e[_0x41ad('0x33')];if(_0xcef98c[_0x41ad('0x35')][_0x41ad('0x44')]){_0x22ca05[_0x41ad('0x45')]=[{'all':!![]}];}_0x22ca05=_['merge']({},_0x22ca05,_0xcef98c[_0x41ad('0x43')]);return db[_0x41ad('0x31')][_0x41ad('0x2c')](_0x22ca05)[_0x41ad('0x22')](handleEntityNotFound(_0x35e05c,null))[_0x41ad('0x22')](function(_0x2150ee){if(_0x2150ee){var _0x2c6d8f=_0x2150ee[_0x41ad('0x24')]({'plain':!![]});_0x2c6d8f=qs[_0x41ad('0x55')](_0x2c6d8f,['id',_0x41ad('0x56'),'updatedAt']);_0xcef98c[_0x41ad('0x4c')]=_[_0x41ad('0x55')](_0xcef98c['body'],['id',_0x41ad('0x56'),_0x41ad('0x57')]);return db[_0x41ad('0x31')]['create'](_[_0x41ad('0x42')](_0x2c6d8f,_0xcef98c['body']),{'include':_0xcef98c[_0x41ad('0x35')][_0x41ad('0x44')]?[{'all':!![]}]:undefined})[_0x41ad('0x22')](function(_0x45d8d8){var _0x3ca15e=_0xcef98c[_0x41ad('0x58')]['get']({'plain':!![]});if(!_0x3ca15e)throw new Error(_0x41ad('0x4d'));if(_0x3ca15e['role']==='user'){var _0x2c64ee=_0x45d8d8[_0x41ad('0x24')]({'plain':!![]});var _0x32fe6f=[{'name':_0x41ad('0x4f'),'value':_0x41ad('0x25')},{'name':_0x41ad('0x26'),'value':_0x41ad('0x27')}];var _0x355bb4=_[_0x41ad('0x2c')](_0x32fe6f,[_0x41ad('0x29'),_0x2c64ee['type']])['name'];return db[_0x41ad('0x50')][_0x41ad('0x2c')]({'where':{'name':_0x355bb4,'userProfileId':_0x3ca15e['userProfileId']},'raw':!![]})[_0x41ad('0x22')](function(_0x3e9b69){if(_0x3e9b69&&_0x3e9b69[_0x41ad('0x52')]===0x0){return db['UserProfileResource'][_0x41ad('0x4b')]({'name':_0x2c64ee[_0x41ad('0x2d')],'resourceId':_0x2c64ee['id'],'type':_0x3e9b69['name'],'sectionId':_0x3e9b69['id']},{})[_0x41ad('0x22')](function(){return _0x45d8d8;});}else{return _0x45d8d8;}})['catch'](function(_0x15d663){logger[_0x41ad('0x59')](_0x41ad('0x53'),_0x15d663);throw _0x15d663;});}return _0x45d8d8;});}})[_0x41ad('0x22')](respondWithResult(_0x35e05c,0xc9))['catch'](handleError(_0x35e05c,null));};exports[_0x41ad('0x21')]=function(_0x5bc669,_0x4e537b){if(_0x5bc669[_0x41ad('0x4c')]['id']){delete _0x5bc669[_0x41ad('0x4c')]['id'];}return db[_0x41ad('0x31')][_0x41ad('0x2c')]({'where':{'id':_0x5bc669['params']['id']}})['then'](handleEntityNotFound(_0x4e537b,null))[_0x41ad('0x22')](saveUpdates(_0x5bc669[_0x41ad('0x4c')],null))[_0x41ad('0x22')](respondWithResult(_0x4e537b,null))['catch'](handleError(_0x4e537b,null));};exports[_0x41ad('0x23')]=function(_0x9389bf,_0x1206c4){return db[_0x41ad('0x31')]['find']({'where':{'id':_0x9389bf[_0x41ad('0x47')]['id']}})['then'](handleEntityNotFound(_0x1206c4,null))[_0x41ad('0x22')](removeEntity(_0x1206c4,null))[_0x41ad('0x4a')](handleError(_0x1206c4,null));};exports[_0x41ad('0x5a')]=function(_0x10d414,_0xfedf8f,_0xc81741){var _0x2c1a25={'raw':![],'where':{}};var _0x15c94c={};var _0x57857e={'count':0x0,'rows':[]};return db[_0x41ad('0x31')]['findOne']({'where':{'id':_0x10d414['params']['id']}})[_0x41ad('0x22')](handleEntityNotFound(_0xfedf8f,null))[_0x41ad('0x22')](function(_0x54e776){if(_0x54e776){_0x15c94c[_0x41ad('0x33')]=_[_0x41ad('0x34')](db[_0x41ad('0x5b')][_0x41ad('0x32')]);_0x15c94c[_0x41ad('0x35')]=_['keys'](_0x10d414[_0x41ad('0x35')]);_0x15c94c['filters']=_[_0x41ad('0x48')](_0x15c94c[_0x41ad('0x33')],_0x15c94c[_0x41ad('0x35')]);_0x2c1a25['attributes']=_['intersection'](_0x15c94c[_0x41ad('0x33')],qs[_0x41ad('0x37')](_0x10d414[_0x41ad('0x35')][_0x41ad('0x37')]));_0x2c1a25[_0x41ad('0x38')]=_0x2c1a25[_0x41ad('0x38')]['length']?_0x2c1a25[_0x41ad('0x38')]:_0x15c94c[_0x41ad('0x33')];if(!_0x10d414[_0x41ad('0x35')][_0x41ad('0x39')](_0x41ad('0x3a'))){_0x2c1a25[_0x41ad('0x1d')]=qs[_0x41ad('0x1d')](_0x10d414['query'][_0x41ad('0x1d')]);_0x2c1a25[_0x41ad('0x1c')]=qs[_0x41ad('0x1c')](_0x10d414['query'][_0x41ad('0x1c')]);}_0x2c1a25[_0x41ad('0x3b')]=qs[_0x41ad('0x3c')](_0x10d414[_0x41ad('0x35')][_0x41ad('0x3c')]);_0x2c1a25['where']=qs[_0x41ad('0x36')](_[_0x41ad('0x3e')](_0x10d414['query'],_0x15c94c[_0x41ad('0x36')]));_0x2c1a25[_0x41ad('0x3d')][_0x41ad('0x5c')]=_0x54e776['id'];if(_0x10d414[_0x41ad('0x35')][_0x41ad('0x3f')]){_0x2c1a25['where']=_['merge'](_0x2c1a25['where'],{'$or':_['map'](_0x2c1a25[_0x41ad('0x38')],function(_0x3a96cd){var _0x4fbff9={};_0x4fbff9[_0x3a96cd]={'$like':'%'+_0x10d414[_0x41ad('0x35')][_0x41ad('0x3f')]+'%'};return _0x4fbff9;})});}_0x2c1a25=_['merge']({},_0x2c1a25,_0x10d414[_0x41ad('0x43')]);return db[_0x41ad('0x5b')][_0x41ad('0x1b')]({'where':_0x2c1a25['where']})[_0x41ad('0x22')](function(_0x9af244){_0x57857e['count']=_0x9af244;if(_0x10d414[_0x41ad('0x35')]['includeAll']){_0x2c1a25['include']=[{'all':!![]}];}return db[_0x41ad('0x5b')]['findAll'](_0x2c1a25);})['then'](function(_0x1357f7){_0x57857e[_0x41ad('0x46')]=_0x1357f7;return _0x57857e;});}})[_0x41ad('0x22')](respondWithFilteredResult(_0xfedf8f,_0x2c1a25))[_0x41ad('0x4a')](handleError(_0xfedf8f,null));};exports[_0x41ad('0x5d')]=function(_0x14f9f5,_0xfbd11b,_0x4596b2){var _0x16e34b={'raw':!![],'where':{}};var _0xb77b5f={};var _0x2188f6={'count':0x0,'rows':[]};return db[_0x41ad('0x31')][_0x41ad('0x5e')]({'where':{'id':_0x14f9f5[_0x41ad('0x47')]['id']}})[_0x41ad('0x22')](handleEntityNotFound(_0xfbd11b,null))[_0x41ad('0x22')](function(_0x2b9304){if(_0x2b9304){_0xb77b5f[_0x41ad('0x33')]=_[_0x41ad('0x34')](db[_0x41ad('0x5f')][_0x41ad('0x32')]);_0xb77b5f[_0x41ad('0x35')]=_[_0x41ad('0x34')](_0x14f9f5[_0x41ad('0x35')]);_0xb77b5f[_0x41ad('0x36')]=_[_0x41ad('0x48')](_0xb77b5f[_0x41ad('0x33')],_0xb77b5f[_0x41ad('0x35')]);_0x16e34b['attributes']=_[_0x41ad('0x48')](_0xb77b5f[_0x41ad('0x33')],qs[_0x41ad('0x37')](_0x14f9f5[_0x41ad('0x35')][_0x41ad('0x37')]));_0x16e34b['attributes']=_0x16e34b[_0x41ad('0x38')]['length']?_0x16e34b[_0x41ad('0x38')]:_0xb77b5f[_0x41ad('0x33')];if(!_0x14f9f5['query'][_0x41ad('0x39')](_0x41ad('0x3a'))){_0x16e34b['limit']=qs[_0x41ad('0x1d')](_0x14f9f5[_0x41ad('0x35')][_0x41ad('0x1d')]);_0x16e34b[_0x41ad('0x1c')]=qs[_0x41ad('0x1c')](_0x14f9f5[_0x41ad('0x35')][_0x41ad('0x1c')]);}_0x16e34b[_0x41ad('0x3b')]=qs[_0x41ad('0x3c')](_0x14f9f5[_0x41ad('0x35')][_0x41ad('0x3c')]);_0x16e34b[_0x41ad('0x3d')]=qs[_0x41ad('0x36')](_[_0x41ad('0x3e')](_0x14f9f5[_0x41ad('0x35')],_0xb77b5f[_0x41ad('0x36')]));_0x16e34b['where'][_0x41ad('0x5c')]=_0x2b9304['id'];if(_0x14f9f5[_0x41ad('0x35')][_0x41ad('0x3f')]){_0x16e34b[_0x41ad('0x3d')]=_['merge'](_0x16e34b[_0x41ad('0x3d')],{'$or':_[_0x41ad('0x28')](_0x16e34b[_0x41ad('0x38')],function(_0xb20830){var _0x1c100c={};_0x1c100c[_0xb20830]={'$like':'%'+_0x14f9f5[_0x41ad('0x35')][_0x41ad('0x3f')]+'%'};return _0x1c100c;})});}_0x16e34b=_[_0x41ad('0x42')]({},_0x16e34b,_0x14f9f5[_0x41ad('0x43')]);return db[_0x41ad('0x5f')][_0x41ad('0x1b')]({'where':_0x16e34b[_0x41ad('0x3d')]})['then'](function(_0x25c453){_0x2188f6[_0x41ad('0x1b')]=_0x25c453;if(_0x14f9f5[_0x41ad('0x35')]['includeAll']){_0x16e34b[_0x41ad('0x45')]=[{'all':!![]}];}return db[_0x41ad('0x5f')][_0x41ad('0x60')](_0x16e34b);})[_0x41ad('0x22')](function(_0xdad714){_0x2188f6[_0x41ad('0x46')]=_0xdad714;return _0x2188f6;});}})[_0x41ad('0x22')](respondWithFilteredResult(_0xfbd11b,_0x16e34b))[_0x41ad('0x4a')](handleError(_0xfbd11b,null));};exports[_0x41ad('0x61')]=function(_0x479f76,_0x2d09de,_0x55ebaf){var _0x43c132={'raw':!![],'where':{}};var _0x56823c={};var _0x2ddca4={'count':0x0,'rows':[]};return db[_0x41ad('0x31')][_0x41ad('0x5e')]({'where':{'id':_0x479f76[_0x41ad('0x47')]['id']}})[_0x41ad('0x22')](handleEntityNotFound(_0x2d09de,null))[_0x41ad('0x22')](function(_0x40eaa8){if(_0x40eaa8){_0x56823c[_0x41ad('0x33')]=_[_0x41ad('0x34')](db[_0x41ad('0x62')][_0x41ad('0x32')]);_0x56823c[_0x41ad('0x35')]=_[_0x41ad('0x34')](_0x479f76['query']);_0x56823c['filters']=_['intersection'](_0x56823c[_0x41ad('0x33')],_0x56823c[_0x41ad('0x35')]);_0x43c132['attributes']=_[_0x41ad('0x48')](_0x56823c[_0x41ad('0x33')],qs['fields'](_0x479f76[_0x41ad('0x35')][_0x41ad('0x37')]));_0x43c132[_0x41ad('0x38')]=_0x43c132[_0x41ad('0x38')]['length']?_0x43c132[_0x41ad('0x38')]:_0x56823c[_0x41ad('0x33')];if(!_0x479f76[_0x41ad('0x35')][_0x41ad('0x39')]('nolimit')){_0x43c132[_0x41ad('0x1d')]=qs['limit'](_0x479f76[_0x41ad('0x35')][_0x41ad('0x1d')]);_0x43c132[_0x41ad('0x1c')]=qs[_0x41ad('0x1c')](_0x479f76['query'][_0x41ad('0x1c')]);}_0x43c132[_0x41ad('0x3b')]=qs[_0x41ad('0x3c')](_0x479f76[_0x41ad('0x35')][_0x41ad('0x3c')]);_0x43c132['where']=qs[_0x41ad('0x36')](_['pick'](_0x479f76['query'],_0x56823c['filters']));_0x43c132[_0x41ad('0x3d')][_0x41ad('0x5c')]=_0x40eaa8['id'];if(_0x479f76[_0x41ad('0x35')][_0x41ad('0x3f')]){_0x43c132['where']=_[_0x41ad('0x42')](_0x43c132[_0x41ad('0x3d')],{'$or':_['map'](_0x43c132[_0x41ad('0x38')],function(_0x350bd2){var _0x208d5a={};_0x208d5a[_0x350bd2]={'$like':'%'+_0x479f76[_0x41ad('0x35')][_0x41ad('0x3f')]+'%'};return _0x208d5a;})});}_0x43c132=_['merge']({},_0x43c132,_0x479f76[_0x41ad('0x43')]);return db['CmHopperFinal'][_0x41ad('0x1b')]({'where':_0x43c132[_0x41ad('0x3d')]})['then'](function(_0x19a145){_0x2ddca4[_0x41ad('0x1b')]=_0x19a145;if(_0x479f76[_0x41ad('0x35')][_0x41ad('0x44')]){_0x43c132[_0x41ad('0x45')]=[{'all':!![]}];}return db[_0x41ad('0x62')][_0x41ad('0x60')](_0x43c132);})['then'](function(_0x5638af){_0x2ddca4['rows']=_0x5638af;return _0x2ddca4;});}})[_0x41ad('0x22')](respondWithFilteredResult(_0x2d09de,_0x43c132))[_0x41ad('0x4a')](handleError(_0x2d09de,null));};exports[_0x41ad('0x63')]=function(_0x26469d,_0x2347ff,_0x4c451c){var _0x43c02a={'raw':!![],'where':{}};var _0x36a9ee={};var _0x58f87d={'count':0x0,'rows':[]};return db[_0x41ad('0x31')][_0x41ad('0x5e')]({'where':{'id':_0x26469d[_0x41ad('0x47')]['id']}})[_0x41ad('0x22')](handleEntityNotFound(_0x2347ff,null))[_0x41ad('0x22')](function(_0x1eeac3){if(_0x1eeac3){_0x36a9ee[_0x41ad('0x33')]=_[_0x41ad('0x34')](db[_0x41ad('0x64')][_0x41ad('0x32')]);_0x36a9ee[_0x41ad('0x35')]=_[_0x41ad('0x34')](_0x26469d[_0x41ad('0x35')]);_0x36a9ee['filters']=_['intersection'](_0x36a9ee[_0x41ad('0x33')],_0x36a9ee[_0x41ad('0x35')]);_0x43c02a['attributes']=_[_0x41ad('0x48')](_0x36a9ee['model'],qs[_0x41ad('0x37')](_0x26469d['query'][_0x41ad('0x37')]));_0x43c02a[_0x41ad('0x38')]=_0x43c02a[_0x41ad('0x38')][_0x41ad('0x49')]?_0x43c02a[_0x41ad('0x38')]:_0x36a9ee['model'];if(!_0x26469d[_0x41ad('0x35')][_0x41ad('0x39')](_0x41ad('0x3a'))){_0x43c02a['limit']=qs['limit'](_0x26469d['query'][_0x41ad('0x1d')]);_0x43c02a[_0x41ad('0x1c')]=qs[_0x41ad('0x1c')](_0x26469d[_0x41ad('0x35')][_0x41ad('0x1c')]);}_0x43c02a[_0x41ad('0x3b')]=qs[_0x41ad('0x3c')](_0x26469d['query'][_0x41ad('0x3c')]);_0x43c02a[_0x41ad('0x3d')]=qs[_0x41ad('0x36')](_['pick'](_0x26469d['query'],_0x36a9ee['filters']));_0x43c02a[_0x41ad('0x3d')][_0x41ad('0x5c')]=_0x1eeac3['id'];if(_0x26469d[_0x41ad('0x35')][_0x41ad('0x3f')]){_0x43c02a[_0x41ad('0x3d')]=_['merge'](_0x43c02a[_0x41ad('0x3d')],{'$or':_[_0x41ad('0x28')](_0x43c02a[_0x41ad('0x38')],function(_0x4b8d5e){var _0x48b663={};_0x48b663[_0x4b8d5e]={'$like':'%'+_0x26469d[_0x41ad('0x35')][_0x41ad('0x3f')]+'%'};return _0x48b663;})});}_0x43c02a=_[_0x41ad('0x42')]({},_0x43c02a,_0x26469d[_0x41ad('0x43')]);return db[_0x41ad('0x64')]['count']({'where':_0x43c02a[_0x41ad('0x3d')]})[_0x41ad('0x22')](function(_0x6fe976){_0x58f87d[_0x41ad('0x1b')]=_0x6fe976;if(_0x26469d[_0x41ad('0x35')][_0x41ad('0x44')]){_0x43c02a['include']=[{'all':!![]}];}return db[_0x41ad('0x64')][_0x41ad('0x60')](_0x43c02a);})[_0x41ad('0x22')](function(_0x5cfef7){_0x58f87d[_0x41ad('0x46')]=_0x5cfef7;return _0x58f87d;});}})['then'](respondWithFilteredResult(_0x2347ff,_0x43c02a))[_0x41ad('0x4a')](handleError(_0x2347ff,null));};exports['getTeams']=function(_0xf2e093,_0x16dfcd,_0x5a16af){var _0x187c06={};var _0x5ae25d={};var _0x2189da;var _0x40c20b;return db[_0x41ad('0x31')][_0x41ad('0x5e')]({'where':{'id':_0xf2e093[_0x41ad('0x47')]['id']}})[_0x41ad('0x22')](handleEntityNotFound(_0x16dfcd,null))[_0x41ad('0x22')](function(_0x373d57){if(_0x373d57){_0x2189da=_0x373d57;_0x5ae25d[_0x41ad('0x33')]=_[_0x41ad('0x34')](db[_0x41ad('0x65')][_0x41ad('0x32')]);_0x5ae25d[_0x41ad('0x35')]=_[_0x41ad('0x34')](_0xf2e093[_0x41ad('0x35')]);_0x5ae25d[_0x41ad('0x36')]=_[_0x41ad('0x48')](_0x5ae25d[_0x41ad('0x33')],_0x5ae25d['query']);_0x187c06['attributes']=_[_0x41ad('0x48')](_0x5ae25d['model'],qs[_0x41ad('0x37')](_0xf2e093['query'][_0x41ad('0x37')]));_0x187c06[_0x41ad('0x38')]=_0x187c06['attributes'][_0x41ad('0x49')]?_0x187c06[_0x41ad('0x38')]:_0x5ae25d[_0x41ad('0x33')];_0x187c06[_0x41ad('0x3b')]=qs['sort'](_0xf2e093[_0x41ad('0x35')][_0x41ad('0x3c')]);_0x187c06[_0x41ad('0x3d')]=qs['filters'](_[_0x41ad('0x3e')](_0xf2e093[_0x41ad('0x35')],_0x5ae25d[_0x41ad('0x36')]));if(_0xf2e093[_0x41ad('0x35')][_0x41ad('0x3f')]){_0x187c06[_0x41ad('0x3d')]=_[_0x41ad('0x42')](_0x187c06[_0x41ad('0x3d')],{'$or':_[_0x41ad('0x28')](_0x187c06[_0x41ad('0x38')],function(_0x10637f){var _0x1f5993={};_0x1f5993[_0x10637f]={'$like':'%'+_0xf2e093[_0x41ad('0x35')][_0x41ad('0x3f')]+'%'};return _0x1f5993;})});}_0x187c06=_['merge']({},_0x187c06,_0xf2e093['options']);return _0x2189da['getTeams'](_0x187c06);}})[_0x41ad('0x22')](function(_0x8e65d6){if(_0x8e65d6){_0x40c20b=_0x8e65d6['length'];if(!_0xf2e093['query']['hasOwnProperty']('nolimit')){_0x187c06[_0x41ad('0x1d')]=qs['limit'](_0xf2e093[_0x41ad('0x35')]['limit']);_0x187c06['offset']=qs[_0x41ad('0x1c')](_0xf2e093['query'][_0x41ad('0x1c')]);}return _0x2189da[_0x41ad('0x66')](_0x187c06);}})[_0x41ad('0x22')](function(_0x1ca610){if(_0x1ca610){return _0x1ca610?{'count':_0x40c20b,'rows':_0x1ca610}:null;}})[_0x41ad('0x22')](respondWithResult(_0x16dfcd,null))[_0x41ad('0x4a')](handleError(_0x16dfcd,null));};exports[_0x41ad('0x67')]=function(_0xc1c24f,_0x3f0e7a,_0x5da41d){var _0x1f3a6f=[];var _0x8bd88c;return db[_0x41ad('0x65')]['findAll']({'where':{'id':_0xc1c24f[_0x41ad('0x4c')][_0x41ad('0x68')]},'attributes':['id'],'include':[{'model':db[_0x41ad('0x69')],'as':_0x41ad('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x41ad('0x22')](function(_0x17f5a0){if(_0x17f5a0){for(var _0x280161=0x0;_0x280161<_0x17f5a0[_0x41ad('0x49')];_0x280161+=0x1){for(var _0x24a157=0x0;_0x24a157<_0x17f5a0[_0x280161]['Agents'][_0x41ad('0x49')];_0x24a157+=0x1){_0x1f3a6f=_[_0x41ad('0x6b')](_0x1f3a6f,[_0x17f5a0[_0x280161][_0x41ad('0x6a')][_0x24a157]['id']]);}}return _0x1f3a6f;}})[_0x41ad('0x22')](function(_0x50c64d){if(_0x50c64d){return db[_0x41ad('0x31')]['find']({'where':{'id':_0xc1c24f[_0x41ad('0x47')]['id']}});}})[_0x41ad('0x22')](function(_0x4863eb){if(_0x4863eb){_0x8bd88c=_0x4863eb;return _0x8bd88c[_0x41ad('0x6c')](_0x1f3a6f,{'penalty':_0xc1c24f['body'][_0x41ad('0x6d')]});}})[_0x41ad('0x22')](function(_0x474d3e){if(_0x474d3e){return _0x8bd88c[_0x41ad('0x67')](_0xc1c24f[_0x41ad('0x4c')]['ids']);}})[_0x41ad('0x22')](handleEntityNotFound(_0x3f0e7a,null))[_0x41ad('0x22')](respondWithStatusCode(_0x3f0e7a,null))[_0x41ad('0x4a')](handleError(_0x3f0e7a,null));};exports[_0x41ad('0x6e')]=function(_0xd94d69,_0x4d2843,_0x86d306){var _0x40404b=[];var _0x346599;return db[_0x41ad('0x65')][_0x41ad('0x60')]({'where':{'id':_0xd94d69['query'][_0x41ad('0x68')]},'attributes':['id'],'include':[{'model':db[_0x41ad('0x69')],'as':_0x41ad('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x2ff279){if(_0x2ff279){for(var _0x4f56f5=0x0;_0x4f56f5<_0x2ff279[_0x41ad('0x49')];_0x4f56f5+=0x1){for(var _0x307a11=0x0;_0x307a11<_0x2ff279[_0x4f56f5][_0x41ad('0x6a')]['length'];_0x307a11+=0x1){_0x40404b=_[_0x41ad('0x6b')](_0x40404b,[_0x2ff279[_0x4f56f5][_0x41ad('0x6a')][_0x307a11]['id']]);}}return _0x40404b;}})['then'](function(_0x77efc6){if(_0x77efc6){return db['VoiceQueue'][_0x41ad('0x2c')]({'where':{'id':_0xd94d69[_0x41ad('0x47')]['id']}});}})[_0x41ad('0x22')](function(_0x153804){if(_0x153804){_0x346599=_0x153804;return _0x346599[_0x41ad('0x6f')](_0x40404b);}})['then'](function(_0x2cf4cd){if(_0x346599){return _0x346599[_0x41ad('0x6e')](_0xd94d69[_0x41ad('0x35')]['ids']);}})[_0x41ad('0x22')](handleEntityNotFound(_0x4d2843,null))[_0x41ad('0x22')](respondWithStatusCode(_0x4d2843,null))[_0x41ad('0x4a')](handleError(_0x4d2843,null));};exports[_0x41ad('0x6c')]=function(_0x19c200,_0x580fe2,_0x11c4c0){var _0x3b5577,_0x5d5e1e;return db[_0x41ad('0x31')][_0x41ad('0x2c')]({'where':{'id':_0x19c200[_0x41ad('0x47')]['id']}})[_0x41ad('0x22')](handleEntityNotFound(_0x580fe2,null))[_0x41ad('0x22')](function(_0x218da2){if(_0x218da2){_0x5d5e1e=_0x218da2;return _0x218da2[_0x41ad('0x6c')](_0x19c200[_0x41ad('0x4c')][_0x41ad('0x68')],_[_0x41ad('0x55')](_0x19c200[_0x41ad('0x4c')],['ids','id'])||{})['spread'](function(_0x3482e8){for(var _0x25b18a=0x0;_0x25b18a<_0x19c200['body'][_0x41ad('0x68')]['length'];_0x25b18a+=0x1){socket[_0x41ad('0x70')](_0x41ad('0x71'),{'UserId':_0x19c200[_0x41ad('0x4c')][_0x41ad('0x68')][_0x25b18a],'VoiceQueueId':_0x19c200[_0x41ad('0x47')]['id']});}return _0x3482e8;});}})['then'](function(_0x37e69b){_0x3b5577=_0x37e69b||[];if(_0x5d5e1e){return db[_0x41ad('0x69')][_0x41ad('0x60')]({'where':{'id':_0x19c200[_0x41ad('0x4c')][_0x41ad('0x68')]},'attributes':['id',_0x41ad('0x2d'),_0x41ad('0x72'),'voicePause','interface'],'raw':!![]});}})[_0x41ad('0x22')](function(_0x1bad72){if(_0x1bad72&&_0x1bad72[_0x41ad('0x49')]){var _0x20fc49=[];for(var _0x4a9fcb=0x0;_0x4a9fcb<_0x1bad72[_0x41ad('0x49')];_0x4a9fcb++){_0x20fc49['push'](db[_0x41ad('0x73')][_0x41ad('0x74')]({'membername':_0x1bad72[_0x4a9fcb][_0x41ad('0x2d')],'UserId':_0x1bad72[_0x4a9fcb]['id'],'queue_name':_0x5d5e1e[_0x41ad('0x2d')],'VoiceQueueId':_0x5d5e1e['id'],'interface':_[_0x41ad('0x75')](_0x1bad72[_0x4a9fcb][_0x41ad('0x76')])?util[_0x41ad('0x77')](_0x41ad('0x78'),_0x1bad72[_0x4a9fcb][_0x41ad('0x2d')]):_0x1bad72[_0x4a9fcb][_0x41ad('0x76')],'paused':_0x1bad72[_0x4a9fcb][_0x41ad('0x79')]||![],'penalty':_0x19c200[_0x41ad('0x4c')][_0x41ad('0x6d')]||0x0}));}return BPromise[_0x41ad('0x7a')](_0x20fc49);}})[_0x41ad('0x22')](function(_0x450ffe){return _0x3b5577;})[_0x41ad('0x22')](respondWithResult(_0x580fe2,null))[_0x41ad('0x4a')](handleError(_0x580fe2,null));};exports[_0x41ad('0x6f')]=function(_0x3f2cd0,_0x1c7bf3,_0x1036ef){var _0x1de2b0;return db[_0x41ad('0x31')][_0x41ad('0x2c')]({'where':{'id':_0x3f2cd0[_0x41ad('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c7bf3,null))[_0x41ad('0x22')](function(_0x120642){if(_0x120642){return _0x120642[_0x41ad('0x6f')](_0x3f2cd0[_0x41ad('0x35')][_0x41ad('0x68')])[_0x41ad('0x22')](function(_0x5d40c4){if(_['isArray'](_0x3f2cd0[_0x41ad('0x35')]['ids'])){for(var _0x3a430d=0x0;_0x3a430d<_0x3f2cd0[_0x41ad('0x35')]['ids']['length'];_0x3a430d+=0x1){socket[_0x41ad('0x70')]('userVoiceQueue:remove',{'UserId':_0x3f2cd0[_0x41ad('0x35')][_0x41ad('0x68')][_0x3a430d],'VoiceQueueId':_0x3f2cd0['params']['id']});}}else{socket[_0x41ad('0x70')]('userVoiceQueue:remove',{'UserId':_0x3f2cd0[_0x41ad('0x35')][_0x41ad('0x68')],'VoiceQueueId':_0x3f2cd0['params']['id']});}});}})[_0x41ad('0x22')](function(_0x4982a6){if(_0x3f2cd0['query'][_0x41ad('0x7b')]){_0x1de2b0=_0x4982a6;return db[_0x41ad('0x73')]['destroy']({'where':{'VoiceQueueId':_0x3f2cd0['params']['id'],'UserId':_0x3f2cd0['query']['ids']}})[_0x41ad('0x22')](function(){return _0x1de2b0;});}})[_0x41ad('0x22')](respondWithStatusCode(_0x1c7bf3,null))[_0x41ad('0x4a')](handleError(_0x1c7bf3,null));};exports[_0x41ad('0x7c')]=function(_0x505378,_0x1e0cb5,_0x48f356){var _0x1af7f8={};var _0x285787={};var _0x2fbe6f;var _0x3ee9a5;return db[_0x41ad('0x31')][_0x41ad('0x5e')]({'where':{'id':_0x505378[_0x41ad('0x47')]['id']}})[_0x41ad('0x22')](handleEntityNotFound(_0x1e0cb5,null))[_0x41ad('0x22')](function(_0x4fae6d){if(_0x4fae6d){_0x2fbe6f=_0x4fae6d;_0x285787['model']=_['keys'](db[_0x41ad('0x69')]['rawAttributes']);_0x285787[_0x41ad('0x35')]=_[_0x41ad('0x34')](_0x505378[_0x41ad('0x35')]);_0x285787[_0x41ad('0x36')]=_[_0x41ad('0x48')](_0x285787[_0x41ad('0x33')],_0x285787[_0x41ad('0x35')]);_0x1af7f8[_0x41ad('0x38')]=_[_0x41ad('0x48')](_0x285787['model'],qs['fields'](_0x505378[_0x41ad('0x35')]['fields']));_0x1af7f8[_0x41ad('0x38')]=_0x1af7f8[_0x41ad('0x38')][_0x41ad('0x49')]?_0x1af7f8[_0x41ad('0x38')]:_0x285787['model'];_0x1af7f8[_0x41ad('0x3b')]=qs['sort'](_0x505378['query'][_0x41ad('0x3c')]);_0x1af7f8[_0x41ad('0x3d')]=qs[_0x41ad('0x36')](_[_0x41ad('0x3e')](_0x505378[_0x41ad('0x35')],_0x285787[_0x41ad('0x36')]));if(_0x505378['query'][_0x41ad('0x3f')]){_0x1af7f8[_0x41ad('0x3d')]=_[_0x41ad('0x42')](_0x1af7f8[_0x41ad('0x3d')],{'$or':_[_0x41ad('0x28')](_0x1af7f8[_0x41ad('0x38')],function(_0x98ae02){var _0x42ecef={};_0x42ecef[_0x98ae02]={'$like':'%'+_0x505378[_0x41ad('0x35')][_0x41ad('0x3f')]+'%'};return _0x42ecef;})});}_0x1af7f8=_[_0x41ad('0x42')]({},_0x1af7f8,_0x505378[_0x41ad('0x43')]);return _0x2fbe6f[_0x41ad('0x7c')](_0x1af7f8);}})['then'](function(_0xfbcf60){if(_0xfbcf60){_0x3ee9a5=_0xfbcf60[_0x41ad('0x49')];if(!_0x505378[_0x41ad('0x35')][_0x41ad('0x39')](_0x41ad('0x3a'))){_0x1af7f8[_0x41ad('0x1d')]=qs[_0x41ad('0x1d')](_0x505378[_0x41ad('0x35')][_0x41ad('0x1d')]);_0x1af7f8[_0x41ad('0x1c')]=qs[_0x41ad('0x1c')](_0x505378[_0x41ad('0x35')][_0x41ad('0x1c')]);}return _0x2fbe6f[_0x41ad('0x7c')](_0x1af7f8);}})['then'](function(_0x4fb538){if(_0x4fb538){return _0x4fb538?{'count':_0x3ee9a5,'rows':_0x4fb538}:null;}})[_0x41ad('0x22')](respondWithResult(_0x1e0cb5,null))[_0x41ad('0x4a')](handleError(_0x1e0cb5,null));};exports[_0x41ad('0x7d')]=function(_0x5e6d29,_0xd4112f,_0x5d697f){var _0x29d53f={};var _0x1a40e7={};var _0x4ff965;var _0x403865;return db[_0x41ad('0x31')][_0x41ad('0x5e')]({'where':{'id':_0x5e6d29[_0x41ad('0x47')]['id']}})['then'](handleEntityNotFound(_0xd4112f,null))[_0x41ad('0x22')](function(_0x10770a){if(_0x10770a){_0x4ff965=_0x10770a;_0x1a40e7['model']=_[_0x41ad('0x34')](db['UserVoiceQueueRt'][_0x41ad('0x32')]);_0x1a40e7[_0x41ad('0x35')]=_[_0x41ad('0x34')](_0x5e6d29[_0x41ad('0x35')]);_0x1a40e7[_0x41ad('0x36')]=_[_0x41ad('0x48')](_0x1a40e7['model'],_0x1a40e7[_0x41ad('0x35')]);_0x29d53f[_0x41ad('0x38')]=_[_0x41ad('0x48')](_0x1a40e7[_0x41ad('0x33')],qs[_0x41ad('0x37')](_0x5e6d29[_0x41ad('0x35')]['fields']));_0x29d53f['attributes']=_0x29d53f['attributes']['length']?_0x29d53f['attributes']:_0x1a40e7[_0x41ad('0x33')];_0x29d53f[_0x41ad('0x3b')]=qs[_0x41ad('0x3c')](_0x5e6d29['query'][_0x41ad('0x3c')]);_0x29d53f['where']=qs[_0x41ad('0x36')](_['pick'](_0x5e6d29[_0x41ad('0x35')],_0x1a40e7[_0x41ad('0x36')]));if(_0x5e6d29['query'][_0x41ad('0x3f')]){_0x29d53f[_0x41ad('0x3d')]=_[_0x41ad('0x42')](_0x29d53f['where'],{'$or':_[_0x41ad('0x28')](_0x29d53f[_0x41ad('0x38')],function(_0xc52a47){var _0x557258={};_0x557258[_0xc52a47]={'$like':'%'+_0x5e6d29['query']['filter']+'%'};return _0x557258;})});}_0x29d53f=_[_0x41ad('0x42')]({},_0x29d53f,_0x5e6d29['options']);return _0x4ff965['getMembers'](_0x29d53f);}})[_0x41ad('0x22')](function(_0x268388){if(_0x268388){_0x403865=_0x268388['length'];if(!_0x5e6d29[_0x41ad('0x35')][_0x41ad('0x39')]('nolimit')){_0x29d53f[_0x41ad('0x1d')]=qs[_0x41ad('0x1d')](_0x5e6d29[_0x41ad('0x35')][_0x41ad('0x1d')]);_0x29d53f['offset']=qs[_0x41ad('0x1c')](_0x5e6d29[_0x41ad('0x35')][_0x41ad('0x1c')]);}return _0x4ff965[_0x41ad('0x7d')](_0x29d53f);}})[_0x41ad('0x22')](function(_0x1ee462){return _0x1ee462?{'count':_0x403865,'rows':_0x1ee462}:null;})[_0x41ad('0x22')](respondWithResult(_0xd4112f,null))['catch'](handleError(_0xd4112f,null));};exports['getLists']=function(_0x37fc15,_0x434696,_0x2c92f8){var _0x585dfd={};var _0x7357f6={};var _0x2f1175;var _0x30ff81;return db[_0x41ad('0x31')][_0x41ad('0x5e')]({'where':{'id':_0x37fc15[_0x41ad('0x47')]['id']}})[_0x41ad('0x22')](handleEntityNotFound(_0x434696,null))[_0x41ad('0x22')](function(_0x509858){if(_0x509858){_0x2f1175=_0x509858;_0x7357f6[_0x41ad('0x33')]=_['keys'](db[_0x41ad('0x7e')]['rawAttributes']);_0x7357f6[_0x41ad('0x35')]=_['keys'](_0x37fc15[_0x41ad('0x35')]);_0x7357f6[_0x41ad('0x36')]=_[_0x41ad('0x48')](_0x7357f6[_0x41ad('0x33')],_0x7357f6['query']);_0x585dfd[_0x41ad('0x38')]=_[_0x41ad('0x48')](_0x7357f6[_0x41ad('0x33')],qs[_0x41ad('0x37')](_0x37fc15['query'][_0x41ad('0x37')]));_0x585dfd[_0x41ad('0x38')]=_0x585dfd[_0x41ad('0x38')][_0x41ad('0x49')]?_0x585dfd[_0x41ad('0x38')]:_0x7357f6[_0x41ad('0x33')];_0x585dfd[_0x41ad('0x3b')]=qs[_0x41ad('0x3c')](_0x37fc15[_0x41ad('0x35')][_0x41ad('0x3c')]);_0x585dfd['where']=qs[_0x41ad('0x36')](_[_0x41ad('0x3e')](_0x37fc15['query'],_0x7357f6[_0x41ad('0x36')]));if(_0x37fc15[_0x41ad('0x35')][_0x41ad('0x3f')]){_0x585dfd[_0x41ad('0x3d')]=_[_0x41ad('0x42')](_0x585dfd['where'],{'$or':_[_0x41ad('0x28')](_0x585dfd['attributes'],function(_0x119632){var _0x246375={};_0x246375[_0x119632]={'$like':'%'+_0x37fc15[_0x41ad('0x35')][_0x41ad('0x3f')]+'%'};return _0x246375;})});}_0x585dfd=_[_0x41ad('0x42')]({},_0x585dfd,_0x37fc15['options']);return _0x2f1175[_0x41ad('0x7f')](_0x585dfd);}})[_0x41ad('0x22')](function(_0xb64e47){if(_0xb64e47){_0x30ff81=_0xb64e47[_0x41ad('0x49')];if(!_0x37fc15['query'][_0x41ad('0x39')](_0x41ad('0x3a'))){_0x585dfd[_0x41ad('0x1d')]=qs['limit'](_0x37fc15['query']['limit']);_0x585dfd[_0x41ad('0x1c')]=qs['offset'](_0x37fc15[_0x41ad('0x35')][_0x41ad('0x1c')]);}return _0x2f1175[_0x41ad('0x7f')](_0x585dfd);}})['then'](function(_0x13e6f1){if(_0x13e6f1){return _0x13e6f1?{'count':_0x30ff81,'rows':_0x13e6f1}:null;}})[_0x41ad('0x22')](respondWithResult(_0x434696,null))['catch'](handleError(_0x434696,null));};exports[_0x41ad('0x80')]=function(_0x3eb914,_0x3a843e,_0x38443d){var _0x2ddfde,_0x3d180a;return db[_0x41ad('0x31')][_0x41ad('0x2c')]({'where':{'id':_0x3eb914[_0x41ad('0x47')]['id']}})['then'](handleEntityNotFound(_0x3a843e,null))['then'](function(_0x50607b){if(_0x50607b){_0x3d180a=_0x50607b;return _0x50607b[_0x41ad('0x80')](_0x3eb914[_0x41ad('0x4c')][_0x41ad('0x68')],_[_0x41ad('0x55')](_0x3eb914[_0x41ad('0x4c')],[_0x41ad('0x68'),'id'])||{});}return null;})[_0x41ad('0x81')](function(_0x13cfa4){var _0x23b3f8;_0x2ddfde=_0x13cfa4||[];var _0x490d97=[];if(_0x13cfa4){for(var _0x2330df=0x0;_0x2330df<_0x13cfa4['length'];_0x2330df+=0x1){var _0x8dbbd3=_0x13cfa4[_0x2330df][_0x41ad('0x24')]({'plain':!![]});_0x3d180a['dialCheckDuplicateType']=_0x3eb914[_0x41ad('0x4c')][_0x41ad('0x82')]?_0x3eb914[_0x41ad('0x4c')][_0x41ad('0x82')]:_0x3d180a[_0x41ad('0x82')];switch(_0x3d180a[_0x41ad('0x82')]){case'always':_0x23b3f8=squel[_0x41ad('0x83')]()['into'](_0x41ad('0x84'))[_0x41ad('0x85')]([_0x41ad('0x86'),'scheduledAt','ContactId',_0x41ad('0x87'),_0x41ad('0x5c'),_0x41ad('0x56'),_0x41ad('0x57')],squel[_0x41ad('0x88')]()[_0x41ad('0x41')](_0x41ad('0x86'),_0x41ad('0x86'))[_0x41ad('0x41')](_0x41ad('0x89'),_0x41ad('0x8a'))[_0x41ad('0x41')]('id',_0x41ad('0x8b'))[_0x41ad('0x41')](_0x8dbbd3[_0x41ad('0x8c')][_0x41ad('0x8d')](),'ListId')[_0x41ad('0x41')](_0x3eb914[_0x41ad('0x47')]['id'][_0x41ad('0x8d')](),'VoiceQueueId')[_0x41ad('0x41')](_0x41ad('0x89'),_0x41ad('0x56'))[_0x41ad('0x41')]('NOW()',_0x41ad('0x57'))['from'](_0x41ad('0x8e'))[_0x41ad('0x3d')](_0x41ad('0x8f'))['where'](_0x41ad('0x90'),_0x8dbbd3[_0x41ad('0x8c')][_0x41ad('0x8d')]())[_0x41ad('0x3d')](_0x41ad('0x91'))[_0x41ad('0x3d')](_0x41ad('0x92'),squel[_0x41ad('0x88')]()[_0x41ad('0x41')]('COALESCE(calleridnum,\x27\x27)')[_0x41ad('0x93')]('cm_hopper_final')[_0x41ad('0x3d')](_0x41ad('0x94'),_0x3eb914['params']['id'][_0x41ad('0x8d')]()))['where'](_0x41ad('0x92'),squel[_0x41ad('0x88')]()['field'](_0x41ad('0x95'))[_0x41ad('0x93')](_0x41ad('0x84'))['where'](_0x41ad('0x94'),_0x3eb914[_0x41ad('0x47')]['id'][_0x41ad('0x8d')]())))[_0x41ad('0x8d')]();break;case _0x41ad('0x96'):_0x23b3f8=squel[_0x41ad('0x83')]()[_0x41ad('0x97')](_0x41ad('0x84'))[_0x41ad('0x85')](['phone','scheduledAt',_0x41ad('0x8b'),'ListId',_0x41ad('0x5c'),_0x41ad('0x56'),_0x41ad('0x57')],squel[_0x41ad('0x88')]()[_0x41ad('0x41')](_0x41ad('0x86'),_0x41ad('0x86'))[_0x41ad('0x41')]('NOW()','scheduledAt')[_0x41ad('0x41')]('id',_0x41ad('0x8b'))[_0x41ad('0x41')](_0x8dbbd3['CmListId'][_0x41ad('0x8d')](),_0x41ad('0x87'))[_0x41ad('0x41')](_0x3eb914['params']['id'][_0x41ad('0x8d')](),_0x41ad('0x5c'))[_0x41ad('0x41')]('NOW()','createdAt')[_0x41ad('0x41')](_0x41ad('0x89'),_0x41ad('0x57'))[_0x41ad('0x93')](_0x41ad('0x8e'))[_0x41ad('0x3d')](_0x41ad('0x8f'))[_0x41ad('0x3d')](_0x41ad('0x90'),_0x8dbbd3[_0x41ad('0x8c')]['toString']())[_0x41ad('0x3d')](_0x41ad('0x91'))['where'](_0x41ad('0x92'),squel[_0x41ad('0x88')]()[_0x41ad('0x41')]('COALESCE(phone,\x27\x27)')[_0x41ad('0x93')](_0x41ad('0x84'))[_0x41ad('0x3d')]('VoiceQueueId\x20=\x20?',_0x3eb914[_0x41ad('0x47')]['id'][_0x41ad('0x8d')]())))['toString']();break;default:_0x23b3f8=squel[_0x41ad('0x83')]()[_0x41ad('0x97')](_0x41ad('0x84'))[_0x41ad('0x85')]([_0x41ad('0x86'),_0x41ad('0x8a'),_0x41ad('0x8b'),_0x41ad('0x87'),'VoiceQueueId',_0x41ad('0x56'),_0x41ad('0x57')],squel['select']()[_0x41ad('0x41')]('phone',_0x41ad('0x86'))[_0x41ad('0x41')](_0x41ad('0x89'),'scheduledAt')[_0x41ad('0x41')]('id',_0x41ad('0x8b'))[_0x41ad('0x41')](_0x8dbbd3[_0x41ad('0x8c')]['toString'](),_0x41ad('0x87'))[_0x41ad('0x41')](_0x3eb914['params']['id'][_0x41ad('0x8d')](),_0x41ad('0x5c'))[_0x41ad('0x41')](_0x41ad('0x89'),_0x41ad('0x56'))[_0x41ad('0x41')]('NOW()',_0x41ad('0x57'))[_0x41ad('0x93')](_0x41ad('0x8e'))[_0x41ad('0x3d')](_0x41ad('0x8f'))[_0x41ad('0x3d')](_0x41ad('0x90'),_0x8dbbd3[_0x41ad('0x8c')][_0x41ad('0x8d')]())['where'](_0x41ad('0x91')))[_0x41ad('0x8d')]();}_0x490d97['push'](db[_0x41ad('0x98')]['query'](_0x23b3f8));}return BPromise[_0x41ad('0x7a')](_0x490d97);}})[_0x41ad('0x22')](function(){return _0x2ddfde;})[_0x41ad('0x22')](respondWithResult(_0x3a843e,null))[_0x41ad('0x4a')](handleError(_0x3a843e,null));};exports['removeLists']=function(_0x488197,_0xa4f4e0,_0x3f5196){var _0x4daded;return db['VoiceQueue'][_0x41ad('0x2c')]({'where':{'id':_0x488197[_0x41ad('0x47')]['id']}})['then'](handleEntityNotFound(_0xa4f4e0,null))['then'](function(_0x4d632c){if(_0x4d632c){return _0x4d632c[_0x41ad('0x99')](_0x488197[_0x41ad('0x35')]['ids']);}})[_0x41ad('0x22')](function(_0x1cb844){if(_0x1cb844){_0x4daded=_0x1cb844;return db[_0x41ad('0x5b')]['destroy']({'where':{'ListId':_0x488197[_0x41ad('0x35')][_0x41ad('0x68')],'VoiceQueueId':_0x488197[_0x41ad('0x47')]['id']}})['then'](function(){return _0x4daded;});}})[_0x41ad('0x22')](respondWithStatusCode(_0xa4f4e0,null))['catch'](handleError(_0xa4f4e0,null));};exports[_0x41ad('0x9a')]=function(_0x393158,_0x14b1f9,_0x1ed5cc){var _0x362b1e={};var _0x287fe4={};var _0x3840fb;var _0x26f956;return db['VoiceQueue'][_0x41ad('0x5e')]({'where':{'id':_0x393158[_0x41ad('0x47')]['id']}})[_0x41ad('0x22')](handleEntityNotFound(_0x14b1f9,null))[_0x41ad('0x22')](function(_0xc8e3a9){if(_0xc8e3a9){_0x3840fb=_0xc8e3a9;_0x287fe4[_0x41ad('0x33')]=_[_0x41ad('0x34')](db['CmList']['rawAttributes']);_0x287fe4['query']=_[_0x41ad('0x34')](_0x393158[_0x41ad('0x35')]);_0x287fe4[_0x41ad('0x36')]=_['intersection'](_0x287fe4[_0x41ad('0x33')],_0x287fe4[_0x41ad('0x35')]);_0x362b1e[_0x41ad('0x38')]=_[_0x41ad('0x48')](_0x287fe4[_0x41ad('0x33')],qs[_0x41ad('0x37')](_0x393158[_0x41ad('0x35')][_0x41ad('0x37')]));_0x362b1e[_0x41ad('0x38')]=_0x362b1e[_0x41ad('0x38')]['length']?_0x362b1e['attributes']:_0x287fe4['model'];_0x362b1e[_0x41ad('0x3b')]=qs[_0x41ad('0x3c')](_0x393158[_0x41ad('0x35')][_0x41ad('0x3c')]);_0x362b1e[_0x41ad('0x3d')]=qs[_0x41ad('0x36')](_[_0x41ad('0x3e')](_0x393158[_0x41ad('0x35')],_0x287fe4['filters']));if(_0x393158['query']['filter']){_0x362b1e[_0x41ad('0x3d')]=_[_0x41ad('0x42')](_0x362b1e['where'],{'$or':_[_0x41ad('0x28')](_0x362b1e[_0x41ad('0x38')],function(_0x264153){var _0x22877d={};_0x22877d[_0x264153]={'$like':'%'+_0x393158[_0x41ad('0x35')][_0x41ad('0x3f')]+'%'};return _0x22877d;})});}_0x362b1e=_['merge']({},_0x362b1e,_0x393158[_0x41ad('0x43')]);return _0x3840fb[_0x41ad('0x9a')](_0x362b1e);}})[_0x41ad('0x22')](function(_0x3b58f6){if(_0x3b58f6){_0x26f956=_0x3b58f6[_0x41ad('0x49')];if(!_0x393158['query'][_0x41ad('0x39')](_0x41ad('0x3a'))){_0x362b1e['limit']=qs['limit'](_0x393158[_0x41ad('0x35')][_0x41ad('0x1d')]);_0x362b1e[_0x41ad('0x1c')]=qs['offset'](_0x393158['query'][_0x41ad('0x1c')]);}return _0x3840fb[_0x41ad('0x9a')](_0x362b1e);}})[_0x41ad('0x22')](function(_0x4882f6){if(_0x4882f6){return _0x4882f6?{'count':_0x26f956,'rows':_0x4882f6}:null;}})[_0x41ad('0x22')](respondWithResult(_0x14b1f9,null))['catch'](handleError(_0x14b1f9,null));};exports[_0x41ad('0x9b')]=function(_0x3e7a2c,_0x2d2a19,_0x369061){var _0x16e743,_0x27efa6;return db[_0x41ad('0x31')][_0x41ad('0x2c')]({'where':{'id':_0x3e7a2c['params']['id']}})[_0x41ad('0x22')](handleEntityNotFound(_0x2d2a19,null))[_0x41ad('0x22')](function(_0x3e91d3){if(_0x3e91d3){_0x27efa6=_0x3e91d3;return _0x3e91d3[_0x41ad('0x9b')](_0x3e7a2c[_0x41ad('0x4c')][_0x41ad('0x68')],_[_0x41ad('0x55')](_0x3e7a2c[_0x41ad('0x4c')],[_0x41ad('0x68'),'id'])||{});}return null;})[_0x41ad('0x81')](function(_0x59890e){var _0x355efb;_0x16e743=_0x59890e||[];var _0x2a7fc6=[];if(_0x59890e){for(var _0x3a2ffb=0x0;_0x3a2ffb<_0x59890e[_0x41ad('0x49')];_0x3a2ffb+=0x1){var _0x3083ee=_0x59890e[_0x3a2ffb][_0x41ad('0x24')]({'plain':!![]});_0x355efb=squel['insert']()[_0x41ad('0x97')]('cm_hopper_black')['fromQuery'](['phone','ContactId',_0x41ad('0x87'),_0x41ad('0x5c'),_0x41ad('0x56'),_0x41ad('0x57')],squel['select']()[_0x41ad('0x41')](_0x41ad('0x86'),_0x41ad('0x86'))[_0x41ad('0x41')]('id',_0x41ad('0x8b'))[_0x41ad('0x41')](_0x3083ee['CmListId'][_0x41ad('0x8d')](),_0x41ad('0x87'))[_0x41ad('0x41')](_0x3e7a2c['params']['id']['toString'](),'VoiceQueueId')['field'](_0x41ad('0x89'),_0x41ad('0x56'))[_0x41ad('0x41')](_0x41ad('0x89'),_0x41ad('0x57'))[_0x41ad('0x93')]('cm_contacts')['where'](_0x41ad('0x8f'))[_0x41ad('0x3d')]('ListId\x20=\x20?',_0x3083ee[_0x41ad('0x8c')][_0x41ad('0x8d')]())[_0x41ad('0x3d')](_0x41ad('0x91')))[_0x41ad('0x8d')]();_0x2a7fc6[_0x41ad('0x9c')](db[_0x41ad('0x98')][_0x41ad('0x35')](_0x355efb));}return BPromise[_0x41ad('0x7a')](_0x2a7fc6);}})[_0x41ad('0x22')](function(){return _0x16e743;})[_0x41ad('0x22')](respondWithResult(_0x2d2a19,null))[_0x41ad('0x4a')](handleError(_0x2d2a19,null));};exports[_0x41ad('0x9d')]=function(_0x3ad946,_0x321102,_0x41e189){var _0x5be5db;return db[_0x41ad('0x31')][_0x41ad('0x2c')]({'where':{'id':_0x3ad946['params']['id']}})[_0x41ad('0x22')](handleEntityNotFound(_0x321102,null))[_0x41ad('0x22')](function(_0x3a3013){if(_0x3a3013){return _0x3a3013[_0x41ad('0x9d')](_0x3ad946[_0x41ad('0x35')][_0x41ad('0x68')]);}})[_0x41ad('0x22')](function(_0x3534f8){if(_0x3534f8){_0x5be5db=_0x3534f8;return db[_0x41ad('0x64')][_0x41ad('0x23')]({'where':{'ListId':_0x3ad946['query']['ids'],'VoiceQueueId':_0x3ad946['params']['id']}})[_0x41ad('0x22')](function(){return _0x5be5db;});}})[_0x41ad('0x22')](respondWithStatusCode(_0x321102,null))[_0x41ad('0x4a')](handleError(_0x321102,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index f74ce47..fb3a318 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 _0x3079=['emit','hook','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x17d81a,_0x495098){var _0x529175=function(_0x3e542f){while(--_0x3e542f){_0x17d81a['push'](_0x17d81a['shift']());}};_0x529175(++_0x495098);}(_0x3079,0x112));var _0x9307=function(_0x2b1d7b,_0x1f7aff){_0x2b1d7b=_0x2b1d7b-0x0;var _0x2bca23=_0x3079[_0x2b1d7b];return _0x2bca23;};'use strict';var EventEmitter=require(_0x9307('0x0'));var VoiceQueue=require(_0x9307('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x9307('0x2')](0x0);var events={'afterCreate':_0x9307('0x3'),'afterUpdate':_0x9307('0x4'),'afterDestroy':_0x9307('0x5')};function emitEvent(_0xfd3499){return function(_0x4d5bd9,_0x22e943,_0x3f1f38){VoiceQueueEvents[_0x9307('0x6')](_0xfd3499+':'+_0x4d5bd9['id'],_0x4d5bd9);VoiceQueueEvents['emit'](_0xfd3499,_0x4d5bd9);_0x3f1f38(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x9307('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xb3ea=['remove','emit','hook','events','../../mysqldb','VoiceQueue','save'];(function(_0xf55e73,_0x3fecc5){var _0x116b99=function(_0x314e0c){while(--_0x314e0c){_0xf55e73['push'](_0xf55e73['shift']());}};_0x116b99(++_0x3fecc5);}(_0xb3ea,0x10d));var _0xab3e=function(_0x2d07ed,_0x36b27d){_0x2d07ed=_0x2d07ed-0x0;var _0xcc3eea=_0xb3ea[_0x2d07ed];return _0xcc3eea;};'use strict';var EventEmitter=require(_0xab3e('0x0'));var VoiceQueue=require(_0xab3e('0x1'))['db'][_0xab3e('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xab3e('0x3'),'afterUpdate':'update','afterDestroy':_0xab3e('0x4')};function emitEvent(_0x5d862a){return function(_0x30e8e6,_0x196c45,_0x1f0c0f){VoiceQueueEvents[_0xab3e('0x5')](_0x5d862a+':'+_0x30e8e6['id'],_0x30e8e6);VoiceQueueEvents[_0xab3e('0x5')](_0x5d862a,_0x30e8e6);_0x1f0c0f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xab3e('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 426a2a7..07857b2 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 _0x45e5=['lodash','util','api','moment','request-promise','./voiceQueue.attributes','define','VoiceQueue','voice_queues'];(function(_0x1504e6,_0x14014b){var _0x599626=function(_0x34891c){while(--_0x34891c){_0x1504e6['push'](_0x1504e6['shift']());}};_0x599626(++_0x14014b);}(_0x45e5,0x15f));var _0x545e=function(_0xfe7020,_0x43ff4a){_0xfe7020=_0xfe7020-0x0;var _0x28104f=_0x45e5[_0xfe7020];return _0x28104f;};'use strict';var _=require(_0x545e('0x0'));var util=require(_0x545e('0x1'));var logger=require('../../config/logger')(_0x545e('0x2'));var moment=require(_0x545e('0x3'));var BPromise=require('bluebird');var rp=require(_0x545e('0x4'));var attributes=require(_0x545e('0x5'));module['exports']=function(_0x34f422,_0x4bb795){return _0x34f422[_0x545e('0x6')](_0x545e('0x7'),attributes,{'tableName':_0x545e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe954=['../../config/logger','api','bluebird','./voiceQueue.attributes','exports','define','VoiceQueue'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xe954,0xbd));var _0x4e95=function(_0xd7c3ae,_0x554409){_0xd7c3ae=_0xd7c3ae-0x0;var _0xb2ab5d=_0xe954[_0xd7c3ae];return _0xb2ab5d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4e95('0x0'))(_0x4e95('0x1'));var moment=require('moment');var BPromise=require(_0x4e95('0x2'));var rp=require('request-promise');var attributes=require(_0x4e95('0x3'));module[_0x4e95('0x4')]=function(_0x340f28,_0x4aef64){return _0x340f28[_0x4e95('0x5')](_0x4e95('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 bf4c791..d0c0d54 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 _0x9957=['register','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','options','raw','where','attributes','limit','include','model','map','catch','GetVoiceQueue','ShowVoiceQueue','VoiceQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket'];(function(_0x56a715,_0x1ba2c3){var _0x12e87b=function(_0x46c10c){while(--_0x46c10c){_0x56a715['push'](_0x56a715['shift']());}};_0x12e87b(++_0x1ba2c3);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});config[_0x7995('0xc')]=_[_0x7995('0xd')](config['redis'],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require(_0x7995('0xf'))(new Redis(config['redis']));require(_0x7995('0x10'))[_0x7995('0x11')](socket);function respondWithRpcPromise(_0x18c8a3,_0x35b5fe,_0x3c1d19){return new BPromise(function(_0x1e400a,_0x341672){return client['request'](_0x18c8a3,_0x3c1d19)[_0x7995('0x12')](function(_0x41c652){logger['info'](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));logger[_0x7995('0x15')](_0x7995('0x16'),_0x35b5fe,_0x7995('0x14'),JSON[_0x7995('0x17')](_0x41c652));if(_0x41c652[_0x7995('0x18')]){if(_0x41c652['error']['code']===0x1f4){logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);return _0x341672(_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);}logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652['error'][_0x7995('0x19')]);return _0x1e400a(_0x41c652['error'][_0x7995('0x19')]);}else{logger[_0x7995('0x1a')](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));_0x1e400a(_0x41c652[_0x7995('0x1b')][_0x7995('0x19')]);}})['catch'](function(_0x54c9ae){logger[_0x7995('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x35b5fe,_0x54c9ae);_0x341672(_0x54c9ae);});});}exports['GetVoiceQueue']=function(_0x3ec178){var _0x3d463e=this;return new Promise(function(_0x4cbe10,_0x3a9b54){return db['VoiceQueue']['findAll']({'raw':_0x3ec178[_0x7995('0x1c')]?_0x3ec178[_0x7995('0x1c')][_0x7995('0x1d')]===undefined?!![]:![]:!![],'where':_0x3ec178[_0x7995('0x1c')]?_0x3ec178[_0x7995('0x1c')][_0x7995('0x1e')]||null:null,'attributes':_0x3ec178['options']?_0x3ec178[_0x7995('0x1c')][_0x7995('0x1f')]||null:null,'limit':_0x3ec178[_0x7995('0x1c')]?_0x3ec178[_0x7995('0x1c')][_0x7995('0x20')]||null:null,'include':_0x3ec178[_0x7995('0x1c')]?_0x3ec178[_0x7995('0x1c')][_0x7995('0x21')]?_['map'](_0x3ec178[_0x7995('0x1c')][_0x7995('0x21')],function(_0x401dc3){return{'model':db[_0x401dc3[_0x7995('0x22')]],'as':_0x401dc3['as'],'attributes':_0x401dc3[_0x7995('0x1f')],'include':_0x401dc3[_0x7995('0x21')]?_['map'](_0x401dc3[_0x7995('0x21')],function(_0x5911c3){return{'model':db[_0x5911c3[_0x7995('0x22')]],'as':_0x5911c3['as'],'attributes':_0x5911c3[_0x7995('0x1f')],'include':_0x5911c3[_0x7995('0x21')]?_[_0x7995('0x23')](_0x5911c3[_0x7995('0x21')],function(_0x4b6f99){return{'model':db[_0x4b6f99[_0x7995('0x22')]],'as':_0x4b6f99['as'],'attributes':_0x4b6f99['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x3250e0){logger[_0x7995('0x1a')]('GetVoiceQueue',_0x3ec178);logger['debug']('GetVoiceQueue',_0x3ec178,JSON[_0x7995('0x17')](_0x3250e0));_0x4cbe10(_0x3250e0);})[_0x7995('0x24')](function(_0x327a81){logger[_0x7995('0x18')](_0x7995('0x25'),_0x327a81[_0x7995('0x19')],_0x3ec178);_0x3a9b54(_0x3d463e['error'](0x1f4,_0x327a81['message']));});});};exports[_0x7995('0x26')]=function(_0x5524af){var _0x553671=this;return new Promise(function(_0x3eb566,_0x29fac5){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':_0x5524af['options']?_0x5524af[_0x7995('0x1c')][_0x7995('0x1d')]===undefined?!![]:![]:!![],'where':_0x5524af['options']?_0x5524af['options']['where']||null:null,'attributes':_0x5524af[_0x7995('0x1c')]?_0x5524af[_0x7995('0x1c')]['attributes']||null:null,'include':_0x5524af[_0x7995('0x1c')]?_0x5524af['options'][_0x7995('0x21')]?_[_0x7995('0x23')](_0x5524af[_0x7995('0x1c')]['include'],function(_0x52d76d){return{'model':db[_0x52d76d[_0x7995('0x22')]],'as':_0x52d76d['as'],'attributes':_0x52d76d['attributes'],'include':_0x52d76d['include']?_[_0x7995('0x23')](_0x52d76d[_0x7995('0x21')],function(_0x5212ff){return{'model':db[_0x5212ff[_0x7995('0x22')]],'as':_0x5212ff['as'],'attributes':_0x5212ff[_0x7995('0x1f')],'include':_0x5212ff[_0x7995('0x21')]?_[_0x7995('0x23')](_0x5212ff[_0x7995('0x21')],function(_0x53002a){return{'model':db[_0x53002a[_0x7995('0x22')]],'as':_0x53002a['as'],'attributes':_0x53002a[_0x7995('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x1d60b8){logger['info'](_0x7995('0x26'),_0x5524af);logger[_0x7995('0x15')](_0x7995('0x26'),_0x5524af,JSON[_0x7995('0x17')](_0x1d60b8));_0x3eb566(_0x1d60b8);})[_0x7995('0x24')](function(_0x1035dc){logger['error'](_0x7995('0x26'),_0x1035dc[_0x7995('0x19')],_0x5524af);_0x29fac5(_0x553671[_0x7995('0x18')](0x1f4,_0x1035dc[_0x7995('0x19')]));});});}; \ No newline at end of file +var _0xa9e0=['register','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowVoiceQueue','VoiceQueue','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter'];(function(_0x21085f,_0x336cb9){var _0xb0b371=function(_0x18dbc3){while(--_0x18dbc3){_0x21085f['push'](_0x21085f['shift']());}};_0xb0b371(++_0x336cb9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});config[_0x0a9e('0xa')]=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xc'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0x0a9e('0xd')](socket);function respondWithRpcPromise(_0xf81284,_0x307b3e,_0x3ab53f){return new BPromise(function(_0xfeb75b,_0xbd1168){return client['request'](_0xf81284,_0x3ab53f)['then'](function(_0x527cdd){logger['info'](_0x0a9e('0xe'),_0x307b3e,_0x0a9e('0xf'));logger[_0x0a9e('0x10')](_0x0a9e('0x11'),_0x307b3e,_0x0a9e('0xf'),JSON[_0x0a9e('0x12')](_0x527cdd));if(_0x527cdd['error']){if(_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x14')]===0x1f4){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x527cdd[_0x0a9e('0x13')][_0x0a9e('0x15')]);return _0xbd1168(_0x527cdd['error'][_0x0a9e('0x15')]);}logger['error'](_0x0a9e('0xe'),_0x307b3e,_0x527cdd['error'][_0x0a9e('0x15')]);return _0xfeb75b(_0x527cdd[_0x0a9e('0x13')]['message']);}else{logger[_0x0a9e('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x307b3e,_0x0a9e('0xf'));_0xfeb75b(_0x527cdd[_0x0a9e('0x17')][_0x0a9e('0x15')]);}})[_0x0a9e('0x18')](function(_0x31b1ca){logger[_0x0a9e('0x13')](_0x0a9e('0xe'),_0x307b3e,_0x31b1ca);_0xbd1168(_0x31b1ca);});});}exports[_0x0a9e('0x19')]=function(_0x1314ae){var _0x112016=this;return new Promise(function(_0x1c696a,_0x105080){return db['VoiceQueue'][_0x0a9e('0x1a')]({'raw':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae['options'][_0x0a9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x1314ae['options']?_0x1314ae['options'][_0x0a9e('0x1d')]||null:null,'attributes':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1e')]||null:null,'limit':_0x1314ae['options']?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x1f')]||null:null,'include':_0x1314ae[_0x0a9e('0x1b')]?_0x1314ae[_0x0a9e('0x1b')][_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x1314ae[_0x0a9e('0x1b')]['include'],function(_0x59181e){return{'model':db[_0x59181e[_0x0a9e('0x22')]],'as':_0x59181e['as'],'attributes':_0x59181e[_0x0a9e('0x1e')],'include':_0x59181e[_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x59181e['include'],function(_0x384319){return{'model':db[_0x384319['model']],'as':_0x384319['as'],'attributes':_0x384319[_0x0a9e('0x1e')],'include':_0x384319['include']?_[_0x0a9e('0x21')](_0x384319[_0x0a9e('0x20')],function(_0x25fba9){return{'model':db[_0x25fba9[_0x0a9e('0x22')]],'as':_0x25fba9['as'],'attributes':_0x25fba9[_0x0a9e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x11c3b6){logger[_0x0a9e('0x16')]('GetVoiceQueue',_0x1314ae);logger[_0x0a9e('0x10')](_0x0a9e('0x19'),_0x1314ae,JSON[_0x0a9e('0x12')](_0x11c3b6));_0x1c696a(_0x11c3b6);})[_0x0a9e('0x18')](function(_0x5c877d){logger[_0x0a9e('0x13')](_0x0a9e('0x19'),_0x5c877d[_0x0a9e('0x15')],_0x1314ae);_0x105080(_0x112016[_0x0a9e('0x13')](0x1f4,_0x5c877d[_0x0a9e('0x15')]));});});};exports[_0x0a9e('0x24')]=function(_0x296f41){var _0x2e8759=this;return new Promise(function(_0x1dbde2,_0x540530){return db[_0x0a9e('0x25')]['find']({'raw':_0x296f41[_0x0a9e('0x1b')]?_0x296f41[_0x0a9e('0x1b')][_0x0a9e('0x1c')]===undefined?!![]:![]:!![],'where':_0x296f41[_0x0a9e('0x1b')]?_0x296f41[_0x0a9e('0x1b')]['where']||null:null,'attributes':_0x296f41[_0x0a9e('0x1b')]?_0x296f41[_0x0a9e('0x1b')][_0x0a9e('0x1e')]||null:null,'include':_0x296f41[_0x0a9e('0x1b')]?_0x296f41[_0x0a9e('0x1b')][_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x296f41[_0x0a9e('0x1b')]['include'],function(_0x44295a){return{'model':db[_0x44295a['model']],'as':_0x44295a['as'],'attributes':_0x44295a[_0x0a9e('0x1e')],'include':_0x44295a[_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x44295a[_0x0a9e('0x20')],function(_0x567193){return{'model':db[_0x567193[_0x0a9e('0x22')]],'as':_0x567193['as'],'attributes':_0x567193[_0x0a9e('0x1e')],'include':_0x567193[_0x0a9e('0x20')]?_[_0x0a9e('0x21')](_0x567193['include'],function(_0x54135e){return{'model':db[_0x54135e[_0x0a9e('0x22')]],'as':_0x54135e['as'],'attributes':_0x54135e['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x3d9717){logger[_0x0a9e('0x16')](_0x0a9e('0x24'),_0x296f41);logger['debug'](_0x0a9e('0x24'),_0x296f41,JSON[_0x0a9e('0x12')](_0x3d9717));_0x1dbde2(_0x3d9717);})[_0x0a9e('0x18')](function(_0x533942){logger[_0x0a9e('0x13')](_0x0a9e('0x24'),_0x533942[_0x0a9e('0x15')],_0x296f41);_0x540530(_0x2e8759['error'](0x1f4,_0x533942['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 9f81f5f..f5bd97a 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 _0x3c88=['removeListener','register','remove','emit'];(function(_0x3b83c1,_0x3365fe){var _0x111cea=function(_0x3743eb){while(--_0x3743eb){_0x3b83c1['push'](_0x3b83c1['shift']());}};_0x111cea(++_0x3365fe);}(_0x3c88,0x112));var _0x83c8=function(_0x5ca998,_0x3e297d){_0x5ca998=_0x5ca998-0x0;var _0x2ffbc4=_0x3c88[_0x5ca998];return _0x2ffbc4;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save',_0x83c8('0x0'),'update'];function createListener(_0x139a7d,_0x2b9f4b){return function(_0x40eb2b){_0x2b9f4b[_0x83c8('0x1')](_0x139a7d,_0x40eb2b);};}function removeListener(_0x42ed6d,_0x119bc4){return function(){VoiceQueueEvents[_0x83c8('0x2')](_0x42ed6d,_0x119bc4);};}exports[_0x83c8('0x3')]=function(_0x51aa8b){for(var _0x49e8a0=0x0,_0x1d1873=events['length'];_0x49e8a0<_0x1d1873;_0x49e8a0++){var _0x213e7e=events[_0x49e8a0];var _0x283643=createListener('voiceQueue:'+_0x213e7e,_0x51aa8b);VoiceQueueEvents['on'](_0x213e7e,_0x283643);}}; \ No newline at end of file +var _0x8bc7=['update','emit','./voiceQueue.events','remove'];(function(_0x47c902,_0x220fd2){var _0x1ad6a0=function(_0xf9fdb0){while(--_0xf9fdb0){_0x47c902['push'](_0x47c902['shift']());}};_0x1ad6a0(++_0x220fd2);}(_0x8bc7,0x102));var _0x78bc=function(_0x4db7de,_0x996b29){_0x4db7de=_0x4db7de-0x0;var _0x1f757b=_0x8bc7[_0x4db7de];return _0x1f757b;};'use strict';var VoiceQueueEvents=require(_0x78bc('0x0'));var events=['save',_0x78bc('0x1'),_0x78bc('0x2')];function createListener(_0x4b7cb9,_0x400438){return function(_0x2903eb){_0x400438[_0x78bc('0x3')](_0x4b7cb9,_0x2903eb);};}function removeListener(_0x3ce4c6,_0x498e84){return function(){VoiceQueueEvents['removeListener'](_0x3ce4c6,_0x498e84);};}exports['register']=function(_0x3edeac){for(var _0x4aec6e=0x0,_0x4bc433=events['length'];_0x4aec6e<_0x4bc433;_0x4aec6e++){var _0x18eeed=events[_0x4aec6e];var _0x301314=createListener('voiceQueue:'+_0x18eeed,_0x3edeac);VoiceQueueEvents['on'](_0x18eeed,_0x301314);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index f0ef572..24eecc6 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 _0x8eef=['create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','get','/describe','/index','getVoiceQueuesReport','show','post'];(function(_0x3e99f3,_0x1ae487){var _0x4d1a72=function(_0x451335){while(--_0x451335){_0x3e99f3['push'](_0x3e99f3['shift']());}};_0x4d1a72(++_0x1ae487);}(_0x8eef,0x1d3));var _0xf8ee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8eef[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xf8ee('0x0'));var util=require(_0xf8ee('0x1'));var path=require(_0xf8ee('0x2'));var timeout=require(_0xf8ee('0x3'));var express=require(_0xf8ee('0x4'));var router=express['Router']();var auth=require(_0xf8ee('0x5'));var interaction=require(_0xf8ee('0x6'));var config=require(_0xf8ee('0x7'));var controller=require(_0xf8ee('0x8'));router['get']('/',auth[_0xf8ee('0x9')](),controller['index']);router[_0xf8ee('0xa')](_0xf8ee('0xb'),auth[_0xf8ee('0x9')](),controller['describe']);router[_0xf8ee('0xa')](_0xf8ee('0xc'),auth['isAuthenticated'](),controller[_0xf8ee('0xd')]);router[_0xf8ee('0xa')]('/:id',auth[_0xf8ee('0x9')](),controller[_0xf8ee('0xe')]);router[_0xf8ee('0xf')]('/',auth[_0xf8ee('0x9')](),controller[_0xf8ee('0x10')]);router[_0xf8ee('0x11')]('/:id',auth[_0xf8ee('0x9')](),controller[_0xf8ee('0x12')]);router[_0xf8ee('0x13')](_0xf8ee('0x14'),auth['isAuthenticated'](),controller[_0xf8ee('0x15')]);module[_0xf8ee('0x16')]=router; \ No newline at end of file +var _0x974a=['/index','getVoiceQueuesReport','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x44779e,_0x19cd70){var _0x1bc0ed=function(_0x3c9843){while(--_0x3c9843){_0x44779e['push'](_0x44779e['shift']());}};_0x1bc0ed(++_0x19cd70);}(_0x974a,0x164));var _0xa974=function(_0x59a165,_0x369cb5){_0x59a165=_0x59a165-0x0;var _0x576cdd=_0x974a[_0x59a165];return _0x576cdd;};'use strict';var multer=require('multer');var util=require(_0xa974('0x0'));var path=require(_0xa974('0x1'));var timeout=require(_0xa974('0x2'));var express=require(_0xa974('0x3'));var router=express[_0xa974('0x4')]();var auth=require(_0xa974('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa974('0x6'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth[_0xa974('0x7')](),controller[_0xa974('0x8')]);router[_0xa974('0x9')](_0xa974('0xa'),auth['isAuthenticated'](),controller[_0xa974('0xb')]);router['get'](_0xa974('0xc'),auth[_0xa974('0x7')](),controller[_0xa974('0xd')]);router[_0xa974('0x9')](_0xa974('0xe'),auth['isAuthenticated'](),controller[_0xa974('0xf')]);router[_0xa974('0x10')]('/',auth[_0xa974('0x7')](),controller[_0xa974('0x11')]);router[_0xa974('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa974('0x13')]);router[_0xa974('0x14')](_0xa974('0xe'),auth[_0xa974('0x7')](),controller[_0xa974('0x15')]);module[_0xa974('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index ae71ecc..bcb8b2e 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 _0x5c0f=['sequelize','moment','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x5af48a,_0x3ad76e){var _0x1a3123=function(_0x40c2c2){while(--_0x40c2c2){_0x5af48a['push'](_0x5af48a['shift']());}};_0x1a3123(++_0x3ad76e);}(_0x5c0f,0xd2));var _0xf5c0=function(_0x2b2a30,_0x3a062f){_0x2b2a30=_0x2b2a30-0x0;var _0x5cbbc0=_0x5c0f[_0x2b2a30];return _0x5cbbc0;};'use strict';var Sequelize=require(_0xf5c0('0x0'));var moment=require(_0xf5c0('0x1'));module[_0xf5c0('0x2')]={'type':{'type':Sequelize[_0xf5c0('0x3')]},'uniqueid':{'type':Sequelize[_0xf5c0('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xf5c0('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xf5c0('0x4')],'set':function(_0x50dab0){var _0x645f3f=moment(_0x50dab0);var _0x25af64=moment(this['getDataValue']('queuecallerjoinAt'))[_0xf5c0('0x5')](_0xf5c0('0x6'));var _0x30a31c=_0x645f3f[_0xf5c0('0x7')](_0x25af64,_0xf5c0('0x8'));this[_0xf5c0('0x9')](_0xf5c0('0xa'),_0x50dab0);this[_0xf5c0('0x9')]('holdtime',_0x30a31c||null);}},'position':{'type':Sequelize[_0xf5c0('0xb')]},'count':{'type':Sequelize[_0xf5c0('0xb')]},'queuecallerabandon':{'type':Sequelize[_0xf5c0('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xf5c0('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xf5c0('0x4')]},'queuecallerexit':{'type':Sequelize[_0xf5c0('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xf5c0('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0xf5c0('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xf5c0('0x3')]},'connectedlinename':{'type':Sequelize[_0xf5c0('0x3')]},'accountcode':{'type':Sequelize[_0xf5c0('0x3')]},'context':{'type':Sequelize[_0xf5c0('0x3')]},'exten':{'type':Sequelize[_0xf5c0('0x3')]},'priority':{'type':Sequelize[_0xf5c0('0x3')]},'holdtime':{'type':Sequelize[_0xf5c0('0xb')]},'mohtime':{'type':Sequelize[_0xf5c0('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf5c0('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xf5c0('0x3')]},'transfer':{'type':Sequelize[_0xf5c0('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xf5c0('0xd')},'transferexten':{'type':Sequelize[_0xf5c0('0x3')]},'transferuniqueid':{'type':Sequelize[_0xf5c0('0x3')]},'disposition':{'type':Sequelize[_0xf5c0('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xf5c0('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xed24=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','seconds','setDataValue','holdtime'];(function(_0x1a68d5,_0x552b61){var _0x22a9fe=function(_0x1d32f1){while(--_0x1d32f1){_0x1a68d5['push'](_0x1a68d5['shift']());}};_0x22a9fe(++_0x552b61);}(_0xed24,0x9d));var _0x4ed2=function(_0x34ae45,_0x5de15c){_0x34ae45=_0x34ae45-0x0;var _0x33cc69=_0xed24[_0x34ae45];return _0x33cc69;};'use strict';var Sequelize=require(_0x4ed2('0x0'));var moment=require(_0x4ed2('0x1'));module[_0x4ed2('0x2')]={'type':{'type':Sequelize[_0x4ed2('0x3')]},'uniqueid':{'type':Sequelize[_0x4ed2('0x3')]},'calleridnum':{'type':Sequelize[_0x4ed2('0x3')]},'calleridname':{'type':Sequelize[_0x4ed2('0x3')]},'queue':{'type':Sequelize[_0x4ed2('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x4ed2('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x4ed2('0x4')],'set':function(_0x1bef5c){var _0x1b9868=moment(_0x1bef5c);var _0x411a38=moment(this[_0x4ed2('0x5')](_0x4ed2('0x6')))[_0x4ed2('0x7')]('YYYY-MM-DD\x20HH:mm:ss');var _0x5121a6=_0x1b9868['diff'](_0x411a38,_0x4ed2('0x8'));this[_0x4ed2('0x9')]('queuecallerleaveAt',_0x1bef5c);this[_0x4ed2('0x9')](_0x4ed2('0xa'),_0x5121a6||null);}},'position':{'type':Sequelize[_0x4ed2('0xb')]},'count':{'type':Sequelize[_0x4ed2('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x4ed2('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x4ed2('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x4ed2('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x4ed2('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x4ed2('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x4ed2('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x4ed2('0xb')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4ed2('0x3')]},'connectedlinename':{'type':Sequelize[_0x4ed2('0x3')]},'accountcode':{'type':Sequelize[_0x4ed2('0x3')]},'context':{'type':Sequelize[_0x4ed2('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x4ed2('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x4ed2('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x4ed2('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4ed2('0x3')],'comment':_0x4ed2('0xd')},'transferexten':{'type':Sequelize[_0x4ed2('0x3')]},'transferuniqueid':{'type':Sequelize[_0x4ed2('0x3')]},'disposition':{'type':Sequelize[_0x4ed2('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x4ed2('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 5747987..72814d2 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 _0x8159=['intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','key','field','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','destroy','describe','getVoiceQueuesReport','hasOwnProperty','map','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','count','offset','limit','Content-Range','json','save','update','then','error','name','send','index','VoiceQueueReport','model','query','keys','filters'];(function(_0x22f0d2,_0xd53ed1){var _0x3a85ee=function(_0x3abef9){while(--_0x3abef9){_0x22f0d2['push'](_0x22f0d2['shift']());}};_0x3a85ee(++_0xd53ed1);}(_0x8159,0x6e));var _0x9815=function(_0x51c1ca,_0x3ec228){_0x51c1ca=_0x51c1ca-0x0;var _0xf9c5f6=_0x8159[_0x51c1ca];return _0xf9c5f6;};'use strict';var pdf=require(_0x9815('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9815('0x1'));var zipdir=require(_0x9815('0x2'));var jsonpatch=require(_0x9815('0x3'));var rp=require(_0x9815('0x4'));var moment=require('moment');var BPromise=require(_0x9815('0x5'));var Mustache=require(_0x9815('0x6'));var util=require(_0x9815('0x7'));var path=require(_0x9815('0x8'));var sox=require(_0x9815('0x9'));var csv=require('to-csv');var ejs=require(_0x9815('0xa'));var fs=require('fs');var _=require(_0x9815('0xb'));var squel=require(_0x9815('0xc'));var crypto=require(_0x9815('0xd'));var jsforce=require(_0x9815('0xe'));var deskjs=require(_0x9815('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9815('0x10'));var Papa=require('papaparse');var authService=require('../../components/auth/service');var hardwareService=require(_0x9815('0x11'));var Redis=require(_0x9815('0x12'));var qs=require(_0x9815('0x13'));var logger=require(_0x9815('0x14'))(_0x9815('0x15'));var utils=require(_0x9815('0x16'));var config=require(_0x9815('0x17'));var db=require(_0x9815('0x18'))['db'];config[_0x9815('0x19')]=_['defaults'](config[_0x9815('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x9815('0x1a'))(new Redis(config[_0x9815('0x19')]));require('./voiceQueueReport.socket')[_0x9815('0x1b')](socket);function respondWithStatusCode(_0x557872,_0x27e645){_0x27e645=_0x27e645||0xcc;return function(_0x3147f8){if(_0x3147f8){return _0x557872[_0x9815('0x1c')](_0x27e645);}return _0x557872[_0x9815('0x1d')](_0x27e645)[_0x9815('0x1e')]();};}function respondWithResult(_0x533b56,_0x1e2705){_0x1e2705=_0x1e2705||0xc8;return function(_0x3848b8){if(_0x3848b8){return _0x533b56[_0x9815('0x1d')](_0x1e2705)['json'](_0x3848b8);}};}function respondWithFilteredResult(_0x2e57f5,_0x1d529c){return function(_0x40ff54){if(_0x40ff54){var _0x41fa5b=_0x40ff54[_0x9815('0x1f')],_0x3211e2=_0x1d529c[_0x9815('0x20')],_0x351c03=_0x1d529c[_0x9815('0x20')]+_0x1d529c[_0x9815('0x21')],_0x4aac16;if(_0x351c03>=_0x41fa5b){_0x351c03=_0x41fa5b;_0x4aac16=0xc8;}else{_0x4aac16=0xce;}_0x2e57f5['status'](_0x4aac16);return _0x2e57f5['set'](_0x9815('0x22'),_0x3211e2+'-'+_0x351c03+'/'+_0x41fa5b)[_0x9815('0x23')](_0x40ff54);}return null;};}function patchUpdates(_0x134918){return function(_0x95016e){try{jsonpatch['apply'](_0x95016e,_0x134918,!![]);}catch(_0x272ffe){return BPromise['reject'](_0x272ffe);}return _0x95016e[_0x9815('0x24')]();};}function saveUpdates(_0x118ea9,_0x235ce1){return function(_0x531035){if(_0x531035){return _0x531035[_0x9815('0x25')](_0x118ea9)['then'](function(_0x97887e){return _0x97887e;});}return null;};}function removeEntity(_0xed33e7,_0x22d9cf){return function(_0x311877){if(_0x311877){return _0x311877['destroy']()[_0x9815('0x26')](function(){_0xed33e7[_0x9815('0x1d')](0xcc)[_0x9815('0x1e')]();});}};}function handleEntityNotFound(_0x4b0d9c,_0xcd079f){return function(_0x3a4403){if(!_0x3a4403){_0x4b0d9c['sendStatus'](0x194);}return _0x3a4403;};}function handleError(_0x5c7fcf,_0x9c9626){_0x9c9626=_0x9c9626||0x1f4;return function(_0x4b5219){logger[_0x9815('0x27')](_0x4b5219['stack']);if(_0x4b5219['name']){delete _0x4b5219[_0x9815('0x28')];}_0x5c7fcf[_0x9815('0x1d')](_0x9c9626)[_0x9815('0x29')](_0x4b5219);};}exports[_0x9815('0x2a')]=function(_0x47f6e0,_0x2df0d4){var _0x568b0c={},_0x227a17={},_0x53f2a0={'count':0x0,'rows':[]};var _0x1bdf4b=db[_0x9815('0x2b')]['rawAttributes'];_0x227a17[_0x9815('0x2c')]=_['keys'](_0x1bdf4b);_0x227a17[_0x9815('0x2d')]=_[_0x9815('0x2e')](_0x47f6e0[_0x9815('0x2d')]);_0x227a17[_0x9815('0x2f')]=_[_0x9815('0x30')](_0x227a17[_0x9815('0x2c')],_0x227a17[_0x9815('0x2d')]);_0x568b0c[_0x9815('0x31')]=_[_0x9815('0x30')](_0x227a17['model'],qs[_0x9815('0x32')](_0x47f6e0[_0x9815('0x2d')][_0x9815('0x32')]));_0x568b0c[_0x9815('0x31')]=_0x568b0c['attributes'][_0x9815('0x33')]?_0x568b0c[_0x9815('0x31')]:_0x227a17[_0x9815('0x2c')];if(!_0x47f6e0['query']['hasOwnProperty'](_0x9815('0x34'))){_0x568b0c[_0x9815('0x21')]=qs[_0x9815('0x21')](_0x47f6e0['query'][_0x9815('0x21')]);_0x568b0c[_0x9815('0x20')]=qs[_0x9815('0x20')](_0x47f6e0[_0x9815('0x2d')][_0x9815('0x20')]);}_0x568b0c[_0x9815('0x35')]=qs[_0x9815('0x36')](_0x47f6e0[_0x9815('0x2d')][_0x9815('0x36')]);_0x568b0c[_0x9815('0x37')]=qs[_0x9815('0x2f')](_[_0x9815('0x38')](_0x47f6e0[_0x9815('0x2d')],_0x227a17[_0x9815('0x2f')]));if(_0x47f6e0[_0x9815('0x2d')][_0x9815('0x39')]){_0x568b0c['where']=_[_0x9815('0x3a')](_0x568b0c[_0x9815('0x37')],{'$or':_['map'](_0x1bdf4b,function(_0x526134){if(_0x526134[_0x9815('0x3b')][_0x9815('0x3c')]!=='VIRTUAL'){var _0x43cbd2={};_0x43cbd2[_0x526134[_0x9815('0x3d')]]={'$like':'%'+_0x47f6e0['query'][_0x9815('0x39')]+'%'};return _0x43cbd2;}})});}_0x568b0c=_['merge']({},_0x568b0c,_0x47f6e0['options']);var _0x1a9cd2={'where':_0x568b0c['where']};return db['VoiceQueueReport'][_0x9815('0x1f')](_0x1a9cd2)[_0x9815('0x26')](function(_0x2d9b9d){_0x53f2a0[_0x9815('0x1f')]=_0x2d9b9d;if(_0x47f6e0[_0x9815('0x2d')][_0x9815('0x3e')]){_0x568b0c[_0x9815('0x3f')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x9815('0x40')](_0x568b0c);})[_0x9815('0x26')](function(_0x34963c){_0x53f2a0[_0x9815('0x41')]=_0x34963c;return _0x53f2a0;})['then'](respondWithFilteredResult(_0x2df0d4,_0x568b0c))[_0x9815('0x42')](handleError(_0x2df0d4,null));};exports[_0x9815('0x43')]=function(_0x42f480,_0x19669f){var _0x547c05={'raw':![],'where':{'id':_0x42f480[_0x9815('0x44')]['id']}},_0x6a76b2={};_0x6a76b2['model']=_[_0x9815('0x2e')](db['VoiceQueueReport'][_0x9815('0x45')]);_0x6a76b2[_0x9815('0x2d')]=_[_0x9815('0x2e')](_0x42f480['query']);_0x6a76b2[_0x9815('0x2f')]=_[_0x9815('0x30')](_0x6a76b2[_0x9815('0x2c')],_0x6a76b2[_0x9815('0x2d')]);_0x547c05[_0x9815('0x31')]=_['intersection'](_0x6a76b2['model'],qs['fields'](_0x42f480['query']['fields']));_0x547c05[_0x9815('0x31')]=_0x547c05[_0x9815('0x31')]['length']?_0x547c05['attributes']:_0x6a76b2[_0x9815('0x2c')];if(_0x42f480[_0x9815('0x2d')][_0x9815('0x3e')]){_0x547c05['include']=[{'all':!![]}];}_0x547c05=_[_0x9815('0x3a')]({},_0x547c05,_0x42f480[_0x9815('0x46')]);return db[_0x9815('0x2b')][_0x9815('0x47')](_0x547c05)[_0x9815('0x26')](handleEntityNotFound(_0x19669f,null))[_0x9815('0x26')](respondWithResult(_0x19669f,null))['catch'](handleError(_0x19669f,null));};exports[_0x9815('0x48')]=function(_0x243aa2,_0x5ae1ea){return db[_0x9815('0x2b')][_0x9815('0x48')](_0x243aa2[_0x9815('0x49')],{})[_0x9815('0x26')](respondWithResult(_0x5ae1ea,0xc9))['catch'](handleError(_0x5ae1ea,null));};exports['update']=function(_0x47b18e,_0x2ddc56){if(_0x47b18e[_0x9815('0x49')]['id']){delete _0x47b18e[_0x9815('0x49')]['id'];}return db[_0x9815('0x2b')]['find']({'where':{'id':_0x47b18e[_0x9815('0x44')]['id']}})[_0x9815('0x26')](handleEntityNotFound(_0x2ddc56,null))[_0x9815('0x26')](saveUpdates(_0x47b18e[_0x9815('0x49')],null))[_0x9815('0x26')](respondWithResult(_0x2ddc56,null))['catch'](handleError(_0x2ddc56,null));};exports[_0x9815('0x4a')]=function(_0x30d690,_0x245eb9){return db[_0x9815('0x2b')]['find']({'where':{'id':_0x30d690[_0x9815('0x44')]['id']}})[_0x9815('0x26')](handleEntityNotFound(_0x245eb9,null))[_0x9815('0x26')](removeEntity(_0x245eb9,null))[_0x9815('0x42')](handleError(_0x245eb9,null));};exports['describe']=function(_0x61b5f6,_0x58ce0e){return db[_0x9815('0x2b')][_0x9815('0x4b')]()[_0x9815('0x26')](respondWithResult(_0x58ce0e,null))[_0x9815('0x42')](handleError(_0x58ce0e,null));};exports[_0x9815('0x4c')]=function(_0x50711f,_0x419e57){var _0x1862ef={},_0x4ebd63={},_0x52de1b={'count':0x0,'rows':[]};_0x4ebd63[_0x9815('0x2c')]=_[_0x9815('0x2e')](db['VoiceQueueReport'][_0x9815('0x45')]);_0x4ebd63[_0x9815('0x2d')]=_['keys'](_0x50711f[_0x9815('0x2d')]);_0x4ebd63[_0x9815('0x2f')]=_[_0x9815('0x30')](_0x4ebd63['model'],_0x4ebd63[_0x9815('0x2d')]);_0x1862ef[_0x9815('0x31')]=_[_0x9815('0x30')](_0x4ebd63[_0x9815('0x2c')],qs[_0x9815('0x32')](_0x50711f['query'][_0x9815('0x32')]));_0x1862ef[_0x9815('0x31')]=_0x1862ef[_0x9815('0x31')][_0x9815('0x33')]?_0x1862ef[_0x9815('0x31')]:_0x4ebd63['model'];if(!_0x50711f[_0x9815('0x2d')][_0x9815('0x4d')](_0x9815('0x34'))){_0x1862ef['limit']=qs[_0x9815('0x21')](_0x50711f[_0x9815('0x2d')][_0x9815('0x21')]);_0x1862ef['offset']=qs[_0x9815('0x20')](_0x50711f[_0x9815('0x2d')][_0x9815('0x20')]);}_0x1862ef['order']=qs[_0x9815('0x36')](_0x50711f[_0x9815('0x2d')][_0x9815('0x36')]);_0x1862ef['where']=qs[_0x9815('0x2f')](_['pick'](_0x50711f[_0x9815('0x2d')],_0x4ebd63[_0x9815('0x2f')]));if(_0x50711f[_0x9815('0x2d')][_0x9815('0x39')]){_0x1862ef[_0x9815('0x37')]=_[_0x9815('0x3a')](_0x1862ef[_0x9815('0x37')],{'$or':_[_0x9815('0x4e')](_0x1862ef['attributes'],function(_0x4afb91){var _0x1e69bf={};_0x1e69bf[_0x4afb91]={'$like':'%'+_0x50711f[_0x9815('0x2d')][_0x9815('0x39')]+'%'};return _0x1e69bf;})});}_0x1862ef=_[_0x9815('0x3a')]({},_0x1862ef,_0x50711f[_0x9815('0x46')]);var _0x713564={'where':_0x1862ef[_0x9815('0x37')]};return db[_0x9815('0x2b')][_0x9815('0x1f')](_0x713564)[_0x9815('0x26')](function(_0x54987b){_0x52de1b[_0x9815('0x1f')]=_0x54987b;if(_0x50711f[_0x9815('0x2d')][_0x9815('0x3e')]){_0x1862ef[_0x9815('0x3f')]=[{'all':!![]}];}return db[_0x9815('0x2b')][_0x9815('0x40')](_0x1862ef);})['then'](function(_0x33ba6c){_0x52de1b['rows']=_0x33ba6c;return _0x52de1b;})['then'](respondWithFilteredResult(_0x419e57,_0x1862ef,_0x9815('0x4c')))[_0x9815('0x42')](handleError(_0x419e57,null,_0x9815('0x4c')));}; \ No newline at end of file +var _0x1091=['rawAttributes','rows','getVoiceQueuesReport','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','ioredis','../../components/parsers/qs','../../config/utils','redis','localhost','register','sendStatus','end','json','count','offset','limit','status','set','apply','save','update','destroy','error','stack','name','send','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','key','VIRTUAL','field','filter','then','includeAll','include','VoiceQueueReport','findAll','catch','show','params','keys','options','find','create','body','describe'];(function(_0x149943,_0x22c3d3){var _0x4b12f7=function(_0x2b7311){while(--_0x2b7311){_0x149943['push'](_0x149943['shift']());}};_0x4b12f7(++_0x22c3d3);}(_0x1091,0x17a));var _0x1109=function(_0x3e1ac4,_0x5da168){_0x3e1ac4=_0x3e1ac4-0x0;var _0x130028=_0x1091[_0x3e1ac4];return _0x130028;};'use strict';var pdf=require(_0x1109('0x0'));var emlformat=require(_0x1109('0x1'));var rimraf=require(_0x1109('0x2'));var zipdir=require(_0x1109('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1109('0x4'));var moment=require(_0x1109('0x5'));var BPromise=require(_0x1109('0x6'));var Mustache=require(_0x1109('0x7'));var util=require(_0x1109('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x1109('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1109('0xa'));var crypto=require(_0x1109('0xb'));var jsforce=require(_0x1109('0xc'));var deskjs=require(_0x1109('0xd'));var toCsv=require(_0x1109('0x9'));var querystring=require(_0x1109('0xe'));var Papa=require(_0x1109('0xf'));var authService=require(_0x1109('0x10'));var hardwareService=require('../../config/license/hardware');var Redis=require(_0x1109('0x11'));var qs=require(_0x1109('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x1109('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x1109('0x14')]=_['defaults'](config['redis'],{'host':_0x1109('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1109('0x14')]));require('./voiceQueueReport.socket')[_0x1109('0x16')](socket);function respondWithStatusCode(_0x298258,_0x21d52d){_0x21d52d=_0x21d52d||0xcc;return function(_0x82c96f){if(_0x82c96f){return _0x298258[_0x1109('0x17')](_0x21d52d);}return _0x298258['status'](_0x21d52d)[_0x1109('0x18')]();};}function respondWithResult(_0x8278e5,_0x54b56b){_0x54b56b=_0x54b56b||0xc8;return function(_0x4c1e9b){if(_0x4c1e9b){return _0x8278e5['status'](_0x54b56b)[_0x1109('0x19')](_0x4c1e9b);}};}function respondWithFilteredResult(_0x3c12b1,_0x176244){return function(_0x412497){if(_0x412497){var _0x4285d8=_0x412497[_0x1109('0x1a')],_0x53a765=_0x176244[_0x1109('0x1b')],_0x5a5905=_0x176244[_0x1109('0x1b')]+_0x176244[_0x1109('0x1c')],_0x3c3cb7;if(_0x5a5905>=_0x4285d8){_0x5a5905=_0x4285d8;_0x3c3cb7=0xc8;}else{_0x3c3cb7=0xce;}_0x3c12b1[_0x1109('0x1d')](_0x3c3cb7);return _0x3c12b1[_0x1109('0x1e')]('Content-Range',_0x53a765+'-'+_0x5a5905+'/'+_0x4285d8)['json'](_0x412497);}return null;};}function patchUpdates(_0x377bdd){return function(_0x5ce866){try{jsonpatch[_0x1109('0x1f')](_0x5ce866,_0x377bdd,!![]);}catch(_0x286cdd){return BPromise['reject'](_0x286cdd);}return _0x5ce866[_0x1109('0x20')]();};}function saveUpdates(_0x1466a4,_0x60e2d7){return function(_0x488ccb){if(_0x488ccb){return _0x488ccb[_0x1109('0x21')](_0x1466a4)['then'](function(_0x36da48){return _0x36da48;});}return null;};}function removeEntity(_0x3dbd91,_0x149efc){return function(_0x33fc86){if(_0x33fc86){return _0x33fc86[_0x1109('0x22')]()['then'](function(){_0x3dbd91[_0x1109('0x1d')](0xcc)[_0x1109('0x18')]();});}};}function handleEntityNotFound(_0x545bd3,_0x19acad){return function(_0x243c45){if(!_0x243c45){_0x545bd3['sendStatus'](0x194);}return _0x243c45;};}function handleError(_0x145f7c,_0x440506){_0x440506=_0x440506||0x1f4;return function(_0x3b155d){logger[_0x1109('0x23')](_0x3b155d[_0x1109('0x24')]);if(_0x3b155d[_0x1109('0x25')]){delete _0x3b155d['name'];}_0x145f7c[_0x1109('0x1d')](_0x440506)[_0x1109('0x26')](_0x3b155d);};}exports['index']=function(_0x5315b4,_0x3ea62c){var _0x2880ff={},_0x42ddb8={},_0x4951fc={'count':0x0,'rows':[]};var _0x387710=db['VoiceQueueReport']['rawAttributes'];_0x42ddb8[_0x1109('0x27')]=_['keys'](_0x387710);_0x42ddb8[_0x1109('0x28')]=_['keys'](_0x5315b4[_0x1109('0x28')]);_0x42ddb8[_0x1109('0x29')]=_[_0x1109('0x2a')](_0x42ddb8['model'],_0x42ddb8[_0x1109('0x28')]);_0x2880ff['attributes']=_['intersection'](_0x42ddb8[_0x1109('0x27')],qs[_0x1109('0x2b')](_0x5315b4[_0x1109('0x28')]['fields']));_0x2880ff['attributes']=_0x2880ff[_0x1109('0x2c')][_0x1109('0x2d')]?_0x2880ff[_0x1109('0x2c')]:_0x42ddb8[_0x1109('0x27')];if(!_0x5315b4[_0x1109('0x28')][_0x1109('0x2e')](_0x1109('0x2f'))){_0x2880ff[_0x1109('0x1c')]=qs['limit'](_0x5315b4[_0x1109('0x28')][_0x1109('0x1c')]);_0x2880ff[_0x1109('0x1b')]=qs[_0x1109('0x1b')](_0x5315b4[_0x1109('0x28')]['offset']);}_0x2880ff[_0x1109('0x30')]=qs[_0x1109('0x31')](_0x5315b4['query'][_0x1109('0x31')]);_0x2880ff['where']=qs[_0x1109('0x29')](_[_0x1109('0x32')](_0x5315b4[_0x1109('0x28')],_0x42ddb8[_0x1109('0x29')]));if(_0x5315b4[_0x1109('0x28')]['filter']){_0x2880ff[_0x1109('0x33')]=_[_0x1109('0x34')](_0x2880ff[_0x1109('0x33')],{'$or':_[_0x1109('0x35')](_0x387710,function(_0x5c28a8){if(_0x5c28a8['type'][_0x1109('0x36')]!==_0x1109('0x37')){var _0x3de937={};_0x3de937[_0x5c28a8[_0x1109('0x38')]]={'$like':'%'+_0x5315b4['query'][_0x1109('0x39')]+'%'};return _0x3de937;}})});}_0x2880ff=_['merge']({},_0x2880ff,_0x5315b4['options']);var _0x3f9efe={'where':_0x2880ff[_0x1109('0x33')]};return db['VoiceQueueReport']['count'](_0x3f9efe)[_0x1109('0x3a')](function(_0x37c075){_0x4951fc['count']=_0x37c075;if(_0x5315b4[_0x1109('0x28')][_0x1109('0x3b')]){_0x2880ff[_0x1109('0x3c')]=[{'all':!![]}];}return db[_0x1109('0x3d')][_0x1109('0x3e')](_0x2880ff);})[_0x1109('0x3a')](function(_0x10fd5c){_0x4951fc['rows']=_0x10fd5c;return _0x4951fc;})[_0x1109('0x3a')](respondWithFilteredResult(_0x3ea62c,_0x2880ff))[_0x1109('0x3f')](handleError(_0x3ea62c,null));};exports[_0x1109('0x40')]=function(_0xb8f6f3,_0xe2402d){var _0x36c84a={'raw':![],'where':{'id':_0xb8f6f3[_0x1109('0x41')]['id']}},_0x2288bf={};_0x2288bf[_0x1109('0x27')]=_[_0x1109('0x42')](db[_0x1109('0x3d')]['rawAttributes']);_0x2288bf[_0x1109('0x28')]=_[_0x1109('0x42')](_0xb8f6f3[_0x1109('0x28')]);_0x2288bf[_0x1109('0x29')]=_[_0x1109('0x2a')](_0x2288bf[_0x1109('0x27')],_0x2288bf[_0x1109('0x28')]);_0x36c84a[_0x1109('0x2c')]=_[_0x1109('0x2a')](_0x2288bf['model'],qs[_0x1109('0x2b')](_0xb8f6f3['query'][_0x1109('0x2b')]));_0x36c84a[_0x1109('0x2c')]=_0x36c84a[_0x1109('0x2c')][_0x1109('0x2d')]?_0x36c84a['attributes']:_0x2288bf['model'];if(_0xb8f6f3[_0x1109('0x28')][_0x1109('0x3b')]){_0x36c84a[_0x1109('0x3c')]=[{'all':!![]}];}_0x36c84a=_[_0x1109('0x34')]({},_0x36c84a,_0xb8f6f3[_0x1109('0x43')]);return db[_0x1109('0x3d')][_0x1109('0x44')](_0x36c84a)['then'](handleEntityNotFound(_0xe2402d,null))[_0x1109('0x3a')](respondWithResult(_0xe2402d,null))[_0x1109('0x3f')](handleError(_0xe2402d,null));};exports[_0x1109('0x45')]=function(_0x5cdf98,_0xd9cd6f){return db[_0x1109('0x3d')][_0x1109('0x45')](_0x5cdf98[_0x1109('0x46')],{})['then'](respondWithResult(_0xd9cd6f,0xc9))[_0x1109('0x3f')](handleError(_0xd9cd6f,null));};exports[_0x1109('0x21')]=function(_0x43ad44,_0xe034a5){if(_0x43ad44[_0x1109('0x46')]['id']){delete _0x43ad44[_0x1109('0x46')]['id'];}return db['VoiceQueueReport'][_0x1109('0x44')]({'where':{'id':_0x43ad44[_0x1109('0x41')]['id']}})[_0x1109('0x3a')](handleEntityNotFound(_0xe034a5,null))[_0x1109('0x3a')](saveUpdates(_0x43ad44[_0x1109('0x46')],null))[_0x1109('0x3a')](respondWithResult(_0xe034a5,null))[_0x1109('0x3f')](handleError(_0xe034a5,null));};exports['destroy']=function(_0xf32140,_0x379508){return db[_0x1109('0x3d')][_0x1109('0x44')]({'where':{'id':_0xf32140[_0x1109('0x41')]['id']}})[_0x1109('0x3a')](handleEntityNotFound(_0x379508,null))[_0x1109('0x3a')](removeEntity(_0x379508,null))[_0x1109('0x3f')](handleError(_0x379508,null));};exports[_0x1109('0x47')]=function(_0x755f9a,_0xcb592){return db[_0x1109('0x3d')]['describe']()[_0x1109('0x3a')](respondWithResult(_0xcb592,null))[_0x1109('0x3f')](handleError(_0xcb592,null));};exports['getVoiceQueuesReport']=function(_0x23590b,_0x1d0935){var _0x2be0da={},_0x5606ab={},_0x14edb4={'count':0x0,'rows':[]};_0x5606ab[_0x1109('0x27')]=_[_0x1109('0x42')](db[_0x1109('0x3d')][_0x1109('0x48')]);_0x5606ab[_0x1109('0x28')]=_['keys'](_0x23590b[_0x1109('0x28')]);_0x5606ab[_0x1109('0x29')]=_[_0x1109('0x2a')](_0x5606ab[_0x1109('0x27')],_0x5606ab[_0x1109('0x28')]);_0x2be0da[_0x1109('0x2c')]=_['intersection'](_0x5606ab[_0x1109('0x27')],qs[_0x1109('0x2b')](_0x23590b[_0x1109('0x28')]['fields']));_0x2be0da[_0x1109('0x2c')]=_0x2be0da['attributes'][_0x1109('0x2d')]?_0x2be0da[_0x1109('0x2c')]:_0x5606ab[_0x1109('0x27')];if(!_0x23590b['query'][_0x1109('0x2e')](_0x1109('0x2f'))){_0x2be0da[_0x1109('0x1c')]=qs[_0x1109('0x1c')](_0x23590b[_0x1109('0x28')][_0x1109('0x1c')]);_0x2be0da[_0x1109('0x1b')]=qs[_0x1109('0x1b')](_0x23590b[_0x1109('0x28')][_0x1109('0x1b')]);}_0x2be0da[_0x1109('0x30')]=qs[_0x1109('0x31')](_0x23590b[_0x1109('0x28')]['sort']);_0x2be0da[_0x1109('0x33')]=qs[_0x1109('0x29')](_[_0x1109('0x32')](_0x23590b[_0x1109('0x28')],_0x5606ab[_0x1109('0x29')]));if(_0x23590b[_0x1109('0x28')][_0x1109('0x39')]){_0x2be0da['where']=_['merge'](_0x2be0da[_0x1109('0x33')],{'$or':_[_0x1109('0x35')](_0x2be0da[_0x1109('0x2c')],function(_0x6f0e21){var _0x18d165={};_0x18d165[_0x6f0e21]={'$like':'%'+_0x23590b[_0x1109('0x28')][_0x1109('0x39')]+'%'};return _0x18d165;})});}_0x2be0da=_[_0x1109('0x34')]({},_0x2be0da,_0x23590b['options']);var _0x18e85b={'where':_0x2be0da[_0x1109('0x33')]};return db['VoiceQueueReport'][_0x1109('0x1a')](_0x18e85b)[_0x1109('0x3a')](function(_0x370ed0){_0x14edb4[_0x1109('0x1a')]=_0x370ed0;if(_0x23590b['query'][_0x1109('0x3b')]){_0x2be0da[_0x1109('0x3c')]=[{'all':!![]}];}return db[_0x1109('0x3d')]['findAll'](_0x2be0da);})[_0x1109('0x3a')](function(_0x596f30){_0x14edb4[_0x1109('0x49')]=_0x596f30;return _0x14edb4;})[_0x1109('0x3a')](respondWithFilteredResult(_0x1d0935,_0x2be0da,_0x1109('0x4a')))[_0x1109('0x3f')](handleError(_0x1d0935,null,_0x1109('0x4a')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 257d00c..8685181 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 _0x745d=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueueReport','update'];(function(_0x119e2e,_0x4c2335){var _0x192ca9=function(_0x5d17e6){while(--_0x5d17e6){_0x119e2e['push'](_0x119e2e['shift']());}};_0x192ca9(++_0x4c2335);}(_0x745d,0x1cc));var _0xd745=function(_0x24a1f4,_0x225b5d){_0x24a1f4=_0x24a1f4-0x0;var _0x8ca549=_0x745d[_0x24a1f4];return _0x8ca549;};'use strict';var EventEmitter=require(_0xd745('0x0'));var VoiceQueueReport=require(_0xd745('0x1'))['db'][_0xd745('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd745('0x3'),'afterDestroy':_0xd745('0x4')};function emitEvent(_0x1de142){return function(_0x2ebf74,_0x4dbf28,_0x33e448){VoiceQueueReportEvents[_0xd745('0x5')](_0x1de142+':'+_0x2ebf74['id'],_0x2ebf74);VoiceQueueReportEvents['emit'](_0x1de142,_0x2ebf74);_0x33e448(null);};}for(var e in events){if(events[_0xd745('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xd745('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xedc8=['events','../../mysqldb','VoiceQueueReport','save','remove','emit','hasOwnProperty','exports'];(function(_0x325c1d,_0xaac33){var _0x41620d=function(_0x44e13c){while(--_0x44e13c){_0x325c1d['push'](_0x325c1d['shift']());}};_0x41620d(++_0xaac33);}(_0xedc8,0x90));var _0x8edc=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xedc8[_0x4fbfd9];return _0x31dc94;};'use strict';var EventEmitter=require(_0x8edc('0x0'));var VoiceQueueReport=require(_0x8edc('0x1'))['db'][_0x8edc('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8edc('0x3'),'afterUpdate':'update','afterDestroy':_0x8edc('0x4')};function emitEvent(_0x3f68dc){return function(_0x352612,_0x13c9f7,_0x5786f7){VoiceQueueReportEvents[_0x8edc('0x5')](_0x3f68dc+':'+_0x352612['id'],_0x352612);VoiceQueueReportEvents[_0x8edc('0x5')](_0x3f68dc,_0x352612);_0x5786f7(null);};}for(var e in events){if(events[_0x8edc('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x8edc('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index e779f4f..9e1fb49 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 _0x2f60=['report_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','define'];(function(_0x4605dc,_0x3f7ae5){var _0x5d3e81=function(_0x1d0375){while(--_0x1d0375){_0x4605dc['push'](_0x4605dc['shift']());}};_0x5d3e81(++_0x3f7ae5);}(_0x2f60,0xa4));var _0x02f6=function(_0x2bb269,_0x20ee77){_0x2bb269=_0x2bb269-0x0;var _0x515d7e=_0x2f60[_0x2bb269];return _0x515d7e;};'use strict';var _=require(_0x02f6('0x0'));var util=require(_0x02f6('0x1'));var logger=require(_0x02f6('0x2'))(_0x02f6('0x3'));var moment=require(_0x02f6('0x4'));var BPromise=require(_0x02f6('0x5'));var rp=require('request-promise');var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x21a38c,_0x5df9dc){return _0x21a38c[_0x02f6('0x6')]('VoiceQueueReport',attributes,{'tableName':_0x02f6('0x7'),'paranoid':![],'indexes':[{'fields':[_0x02f6('0x8')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbb07=['../../config/logger','api','request-promise','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash'];(function(_0x3d2c99,_0x2f5c4d){var _0x118f60=function(_0x5167fc){while(--_0x5167fc){_0x3d2c99['push'](_0x3d2c99['shift']());}};_0x118f60(++_0x2f5c4d);}(_0xbb07,0xfc));var _0x7bb0=function(_0xf58288,_0x35333c){_0xf58288=_0xf58288-0x0;var _0x196e87=_0xbb07[_0xf58288];return _0x196e87;};'use strict';var _=require(_0x7bb0('0x0'));var util=require('util');var logger=require(_0x7bb0('0x1'))(_0x7bb0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7bb0('0x3'));var attributes=require(_0x7bb0('0x4'));module[_0x7bb0('0x5')]=function(_0x22cddb,_0x4666eb){return _0x22cddb[_0x7bb0('0x6')](_0x7bb0('0x7'),attributes,{'tableName':_0x7bb0('0x8'),'paranoid':![],'indexes':[{'fields':[_0x7bb0('0x9')]},{'fields':[_0x7bb0('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 87d09f5..c1f3500 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 _0x7e58=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','include','model','attributes','map','debug','CreateVoiceQueueReport','body','update','where','limit','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring'];(function(_0x1bf639,_0x864d54){var _0x553079=function(_0x144bd4){while(--_0x144bd4){_0x1bf639['push'](_0x1bf639['shift']());}};_0x553079(++_0x864d54);}(_0x7e58,0x7f));var _0x87e5=function(_0x499a5d,_0x108b59){_0x499a5d=_0x499a5d-0x0;var _0x1cc49e=_0x7e58[_0x499a5d];return _0x1cc49e;};'use strict';var _=require(_0x87e5('0x0'));var util=require(_0x87e5('0x1'));var moment=require(_0x87e5('0x2'));var BPromise=require(_0x87e5('0x3'));var rs=require(_0x87e5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x87e5('0x5'))['db'];var utils=require(_0x87e5('0x6'));var logger=require(_0x87e5('0x7'))(_0x87e5('0x8'));var config=require(_0x87e5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x87e5('0xa')][_0x87e5('0xb')]({'port':0x232a});config[_0x87e5('0xc')]=_[_0x87e5('0xd')](config[_0x87e5('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x87e5('0xc')]));require(_0x87e5('0xe'))[_0x87e5('0xf')](socket);function respondWithRpcPromise(_0x25bd9d,_0x1db36d,_0x44df8c){return new BPromise(function(_0x238907,_0x49cc62){return client[_0x87e5('0x10')](_0x25bd9d,_0x44df8c)[_0x87e5('0x11')](function(_0x895e16){logger[_0x87e5('0x12')](_0x87e5('0x13'),_0x1db36d,'request\x20sent');logger['debug'](_0x87e5('0x14'),_0x1db36d,_0x87e5('0x15'),JSON[_0x87e5('0x16')](_0x895e16));if(_0x895e16[_0x87e5('0x17')]){if(_0x895e16[_0x87e5('0x17')][_0x87e5('0x18')]===0x1f4){logger[_0x87e5('0x17')](_0x87e5('0x13'),_0x1db36d,_0x895e16[_0x87e5('0x17')][_0x87e5('0x19')]);return _0x49cc62(_0x895e16['error'][_0x87e5('0x19')]);}logger[_0x87e5('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x1db36d,_0x895e16[_0x87e5('0x17')][_0x87e5('0x19')]);return _0x238907(_0x895e16[_0x87e5('0x17')][_0x87e5('0x19')]);}else{logger['info'](_0x87e5('0x13'),_0x1db36d,_0x87e5('0x15'));_0x238907(_0x895e16[_0x87e5('0x1a')][_0x87e5('0x19')]);}})[_0x87e5('0x1b')](function(_0x1b7e0b){logger[_0x87e5('0x17')](_0x87e5('0x13'),_0x1db36d,_0x1b7e0b);_0x49cc62(_0x1b7e0b);});});}exports[_0x87e5('0x1c')]=function(_0x4651ae){var _0x3ceb10=this;return new Promise(function(_0x2e740b,_0x1f016b){return db[_0x87e5('0x1d')][_0x87e5('0x1e')]({'raw':_0x4651ae[_0x87e5('0x1f')]?_0x4651ae[_0x87e5('0x1f')][_0x87e5('0x20')]===undefined?!![]:![]:!![],'where':_0x4651ae[_0x87e5('0x1f')]?_0x4651ae[_0x87e5('0x1f')]['where']||null:null,'attributes':_0x4651ae[_0x87e5('0x1f')]?_0x4651ae[_0x87e5('0x1f')]['attributes']||null:null,'limit':_0x4651ae[_0x87e5('0x1f')]?_0x4651ae[_0x87e5('0x1f')]['limit']||null:null,'include':_0x4651ae[_0x87e5('0x1f')]?_0x4651ae[_0x87e5('0x1f')][_0x87e5('0x21')]?_['map'](_0x4651ae[_0x87e5('0x1f')]['include'],function(_0x5836d0){return{'model':db[_0x5836d0[_0x87e5('0x22')]],'as':_0x5836d0['as'],'attributes':_0x5836d0[_0x87e5('0x23')],'include':_0x5836d0['include']?_[_0x87e5('0x24')](_0x5836d0[_0x87e5('0x21')],function(_0x1196d6){return{'model':db[_0x1196d6[_0x87e5('0x22')]],'as':_0x1196d6['as'],'attributes':_0x1196d6[_0x87e5('0x23')],'include':_0x1196d6[_0x87e5('0x21')]?_[_0x87e5('0x24')](_0x1196d6['include'],function(_0x2924ed){return{'model':db[_0x2924ed[_0x87e5('0x22')]],'as':_0x2924ed['as'],'attributes':_0x2924ed[_0x87e5('0x23')]};}):[]};}):[]};}):[]:[]})[_0x87e5('0x11')](function(_0x2c7651){logger['info'](_0x87e5('0x1c'),_0x4651ae);logger[_0x87e5('0x25')](_0x87e5('0x1c'),_0x4651ae,JSON['stringify'](_0x2c7651));_0x2e740b(_0x2c7651);})[_0x87e5('0x1b')](function(_0x360ffe){logger[_0x87e5('0x17')](_0x87e5('0x1c'),_0x360ffe['message'],_0x4651ae);_0x1f016b(_0x3ceb10[_0x87e5('0x17')](0x1f4,_0x360ffe[_0x87e5('0x19')]));});});};exports[_0x87e5('0x26')]=function(_0x31c0fe){var _0x5193a9=this;return new Promise(function(_0x4c645a,_0x386f94){return db[_0x87e5('0x1d')]['create'](_0x31c0fe[_0x87e5('0x27')],{'raw':_0x31c0fe[_0x87e5('0x1f')]?_0x31c0fe[_0x87e5('0x1f')][_0x87e5('0x20')]===undefined?!![]:![]:!![]})[_0x87e5('0x11')](function(_0x2f784c){logger['info']('CreateVoiceQueueReport',_0x31c0fe);logger['debug'](_0x87e5('0x26'),_0x31c0fe,JSON[_0x87e5('0x16')](_0x2f784c));_0x4c645a(_0x2f784c);})[_0x87e5('0x1b')](function(_0x4e9ce4){logger[_0x87e5('0x17')]('CreateVoiceQueueReport',_0x4e9ce4[_0x87e5('0x19')],_0x31c0fe);_0x386f94(_0x5193a9[_0x87e5('0x17')](0x1f4,_0x4e9ce4[_0x87e5('0x19')]));});});};exports['UpdateVoiceQueueReport']=function(_0x60a351){var _0x4b1e0c=this;return new Promise(function(_0x2b7bf7,_0x84c586){return db['VoiceQueueReport'][_0x87e5('0x28')](_0x60a351[_0x87e5('0x27')],{'raw':_0x60a351[_0x87e5('0x1f')]?_0x60a351[_0x87e5('0x1f')][_0x87e5('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x60a351[_0x87e5('0x1f')]?_0x60a351['options'][_0x87e5('0x29')]||null:null,'attributes':_0x60a351['options']?_0x60a351[_0x87e5('0x1f')][_0x87e5('0x23')]||null:null,'limit':_0x60a351[_0x87e5('0x1f')]?_0x60a351[_0x87e5('0x1f')][_0x87e5('0x2a')]||null:null})[_0x87e5('0x11')](function(_0x302e6d){logger['info'](_0x87e5('0x2b'),_0x60a351);logger[_0x87e5('0x25')](_0x87e5('0x2b'),_0x60a351,JSON[_0x87e5('0x16')](_0x302e6d));_0x2b7bf7(_0x302e6d);})[_0x87e5('0x1b')](function(_0xeb270){logger[_0x87e5('0x17')](_0x87e5('0x2b'),_0xeb270[_0x87e5('0x19')],_0x60a351);_0x84c586(_0x4b1e0c[_0x87e5('0x17')](0x1f4,_0xeb270[_0x87e5('0x19')]));});});}; \ No newline at end of file +var _0xe1fa=['body','UpdateVoiceQueueReport','update','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceQueueReport,\x20%s,\x20%s','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model','catch','CreateVoiceQueueReport','create'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xe1fa,0x19d));var _0xae1f=function(_0x15afa8,_0x53e762){_0x15afa8=_0x15afa8-0x0;var _0x205b1e=_0xe1fa[_0x15afa8];return _0x205b1e;};'use strict';var _=require(_0xae1f('0x0'));var util=require(_0xae1f('0x1'));var moment=require('moment');var BPromise=require(_0xae1f('0x2'));var rs=require(_0xae1f('0x3'));var fs=require('fs');var Redis=require(_0xae1f('0x4'));var db=require(_0xae1f('0x5'))['db'];var utils=require(_0xae1f('0x6'));var logger=require('../../config/logger')(_0xae1f('0x7'));var config=require(_0xae1f('0x8'));var jayson=require(_0xae1f('0x9'));var client=jayson[_0xae1f('0xa')][_0xae1f('0xb')]({'port':0x232a});config[_0xae1f('0xc')]=_[_0xae1f('0xd')](config[_0xae1f('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xae1f('0xc')]));require('./voiceQueueReport.socket')[_0xae1f('0xe')](socket);function respondWithRpcPromise(_0x2fea6b,_0x44e892,_0x599d6b){return new BPromise(function(_0x276ede,_0x491223){return client[_0xae1f('0xf')](_0x2fea6b,_0x599d6b)[_0xae1f('0x10')](function(_0x150165){logger[_0xae1f('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x44e892,_0xae1f('0x12'));logger[_0xae1f('0x13')](_0xae1f('0x14'),_0x44e892,'request\x20sent',JSON[_0xae1f('0x15')](_0x150165));if(_0x150165[_0xae1f('0x16')]){if(_0x150165['error']['code']===0x1f4){logger[_0xae1f('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x44e892,_0x150165[_0xae1f('0x16')][_0xae1f('0x17')]);return _0x491223(_0x150165[_0xae1f('0x16')]['message']);}logger['error'](_0xae1f('0x18'),_0x44e892,_0x150165['error']['message']);return _0x276ede(_0x150165['error'][_0xae1f('0x17')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x44e892,'request\x20sent');_0x276ede(_0x150165['result'][_0xae1f('0x17')]);}})['catch'](function(_0x5d60a5){logger[_0xae1f('0x16')](_0xae1f('0x18'),_0x44e892,_0x5d60a5);_0x491223(_0x5d60a5);});});}exports[_0xae1f('0x19')]=function(_0x6b2c5){var _0x4b25f7=this;return new Promise(function(_0x9585c1,_0x3913ee){return db[_0xae1f('0x1a')][_0xae1f('0x1b')]({'raw':_0x6b2c5[_0xae1f('0x1c')]?_0x6b2c5[_0xae1f('0x1c')][_0xae1f('0x1d')]===undefined?!![]:![]:!![],'where':_0x6b2c5[_0xae1f('0x1c')]?_0x6b2c5[_0xae1f('0x1c')]['where']||null:null,'attributes':_0x6b2c5[_0xae1f('0x1c')]?_0x6b2c5[_0xae1f('0x1c')][_0xae1f('0x1e')]||null:null,'limit':_0x6b2c5['options']?_0x6b2c5['options'][_0xae1f('0x1f')]||null:null,'include':_0x6b2c5[_0xae1f('0x1c')]?_0x6b2c5[_0xae1f('0x1c')][_0xae1f('0x20')]?_['map'](_0x6b2c5[_0xae1f('0x1c')]['include'],function(_0x25e2e1){return{'model':db[_0x25e2e1['model']],'as':_0x25e2e1['as'],'attributes':_0x25e2e1[_0xae1f('0x1e')],'include':_0x25e2e1[_0xae1f('0x20')]?_[_0xae1f('0x21')](_0x25e2e1['include'],function(_0x30069a){return{'model':db[_0x30069a[_0xae1f('0x22')]],'as':_0x30069a['as'],'attributes':_0x30069a[_0xae1f('0x1e')],'include':_0x30069a[_0xae1f('0x20')]?_[_0xae1f('0x21')](_0x30069a[_0xae1f('0x20')],function(_0x1e48a6){return{'model':db[_0x1e48a6[_0xae1f('0x22')]],'as':_0x1e48a6['as'],'attributes':_0x1e48a6[_0xae1f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xae1f('0x10')](function(_0x8f107e){logger[_0xae1f('0x11')](_0xae1f('0x19'),_0x6b2c5);logger[_0xae1f('0x13')]('GetVoiceQueueReport',_0x6b2c5,JSON['stringify'](_0x8f107e));_0x9585c1(_0x8f107e);})[_0xae1f('0x23')](function(_0x17398f){logger[_0xae1f('0x16')](_0xae1f('0x19'),_0x17398f['message'],_0x6b2c5);_0x3913ee(_0x4b25f7[_0xae1f('0x16')](0x1f4,_0x17398f[_0xae1f('0x17')]));});});};exports[_0xae1f('0x24')]=function(_0xc9b5c8){var _0x1fb729=this;return new Promise(function(_0x27bea9,_0x1cacee){return db['VoiceQueueReport'][_0xae1f('0x25')](_0xc9b5c8[_0xae1f('0x26')],{'raw':_0xc9b5c8[_0xae1f('0x1c')]?_0xc9b5c8[_0xae1f('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xae1f('0x10')](function(_0x542653){logger[_0xae1f('0x11')](_0xae1f('0x24'),_0xc9b5c8);logger[_0xae1f('0x13')]('CreateVoiceQueueReport',_0xc9b5c8,JSON[_0xae1f('0x15')](_0x542653));_0x27bea9(_0x542653);})['catch'](function(_0x10adc1){logger['error'](_0xae1f('0x24'),_0x10adc1[_0xae1f('0x17')],_0xc9b5c8);_0x1cacee(_0x1fb729['error'](0x1f4,_0x10adc1[_0xae1f('0x17')]));});});};exports[_0xae1f('0x27')]=function(_0xcd64da){var _0x37cb8f=this;return new Promise(function(_0x398910,_0x122fdb){return db['VoiceQueueReport'][_0xae1f('0x28')](_0xcd64da['body'],{'raw':_0xcd64da[_0xae1f('0x1c')]?_0xcd64da[_0xae1f('0x1c')][_0xae1f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcd64da['options']?_0xcd64da[_0xae1f('0x1c')]['where']||null:null,'attributes':_0xcd64da['options']?_0xcd64da[_0xae1f('0x1c')]['attributes']||null:null,'limit':_0xcd64da[_0xae1f('0x1c')]?_0xcd64da[_0xae1f('0x1c')][_0xae1f('0x1f')]||null:null})[_0xae1f('0x10')](function(_0x5628aa){logger[_0xae1f('0x11')](_0xae1f('0x27'),_0xcd64da);logger[_0xae1f('0x13')](_0xae1f('0x27'),_0xcd64da,JSON['stringify'](_0x5628aa));_0x398910(_0x5628aa);})[_0xae1f('0x23')](function(_0x167430){logger[_0xae1f('0x16')]('UpdateVoiceQueueReport',_0x167430[_0xae1f('0x17')],_0xcd64da);_0x122fdb(_0x37cb8f['error'](0x1f4,_0x167430[_0xae1f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 36b0811..179f9f5 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 _0xb296=['register','length','./voiceQueueReport.events','save','remove','update','removeListener'];(function(_0x2370a5,_0x5e9f45){var _0x5e22d5=function(_0x5129a4){while(--_0x5129a4){_0x2370a5['push'](_0x2370a5['shift']());}};_0x5e22d5(++_0x5e9f45);}(_0xb296,0xa3));var _0x6b29=function(_0x5bb611,_0x2e5ffa){_0x5bb611=_0x5bb611-0x0;var _0xccb61a=_0xb296[_0x5bb611];return _0xccb61a;};'use strict';var VoiceQueueReportEvents=require(_0x6b29('0x0'));var events=[_0x6b29('0x1'),_0x6b29('0x2'),_0x6b29('0x3')];function createListener(_0x2e0ea3,_0x20b375){return function(_0x2c502e){_0x20b375['emit'](_0x2e0ea3,_0x2c502e);};}function removeListener(_0x3ff65c,_0x5c1cf5){return function(){VoiceQueueReportEvents[_0x6b29('0x4')](_0x3ff65c,_0x5c1cf5);};}exports[_0x6b29('0x5')]=function(_0x5e0aa1){for(var _0x327329=0x0,_0xf1b5ac=events[_0x6b29('0x6')];_0x327329<_0xf1b5ac;_0x327329++){var _0x1c506f=events[_0x327329];var _0x12bcae=createListener('voiceQueueReport:'+_0x1c506f,_0x5e0aa1);VoiceQueueReportEvents['on'](_0x1c506f,_0x12bcae);}}; \ No newline at end of file +var _0xd472=['save','remove','emit','length','voiceQueueReport:','./voiceQueueReport.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd472,0x1eb));var _0x2d47=function(_0x144e7d,_0x15475a){_0x144e7d=_0x144e7d-0x0;var _0x548313=_0xd472[_0x144e7d];return _0x548313;};'use strict';var VoiceQueueReportEvents=require(_0x2d47('0x0'));var events=[_0x2d47('0x1'),_0x2d47('0x2'),'update'];function createListener(_0x1ca961,_0x1a4ad5){return function(_0x42ce96){_0x1a4ad5[_0x2d47('0x3')](_0x1ca961,_0x42ce96);};}function removeListener(_0xdc4c59,_0xd50ba1){return function(){VoiceQueueReportEvents['removeListener'](_0xdc4c59,_0xd50ba1);};}exports['register']=function(_0x28cd0a){for(var _0x3dd0cc=0x0,_0x1cbb92=events[_0x2d47('0x4')];_0x3dd0cc<_0x1cbb92;_0x3dd0cc++){var _0x3d25b6=events[_0x3dd0cc];var _0x4df28b=createListener(_0x2d47('0x5')+_0x3d25b6,_0x28cd0a);VoiceQueueReportEvents['on'](_0x3d25b6,_0x4df28b);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 1a6edbd..df55022 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 _0x3b74=['../../config/environment','get','isAuthenticated','index','/:id','create','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x21bee1,_0x1bc743){var _0x40df80=function(_0x160abc){while(--_0x160abc){_0x21bee1['push'](_0x21bee1['shift']());}};_0x40df80(++_0x1bc743);}(_0x3b74,0x80));var _0x43b7=function(_0x558e3f,_0x40a0de){_0x558e3f=_0x558e3f-0x0;var _0x3d6dc9=_0x3b74[_0x558e3f];return _0x3d6dc9;};'use strict';var multer=require(_0x43b7('0x0'));var util=require(_0x43b7('0x1'));var path=require(_0x43b7('0x2'));var timeout=require(_0x43b7('0x3'));var express=require('express');var router=express[_0x43b7('0x4')]();var auth=require(_0x43b7('0x5'));var interaction=require(_0x43b7('0x6'));var config=require(_0x43b7('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0x43b7('0x8')]('/',auth[_0x43b7('0x9')](),controller[_0x43b7('0xa')]);router[_0x43b7('0x8')](_0x43b7('0xb'),auth[_0x43b7('0x9')](),controller['show']);router['post']('/',auth[_0x43b7('0x9')](),controller[_0x43b7('0xc')]);router['put'](_0x43b7('0xb'),auth[_0x43b7('0x9')](),controller['update']);router[_0x43b7('0xd')]('/:id',auth[_0x43b7('0x9')](),controller[_0x43b7('0xe')]);module['exports']=router; \ No newline at end of file +var _0xc74c=['express','Router','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','show','post','create','update','delete','destroy','exports','multer','util'];(function(_0x4b54dc,_0xc76168){var _0x4d22b8=function(_0x11b4f3){while(--_0x11b4f3){_0x4b54dc['push'](_0x4b54dc['shift']());}};_0x4d22b8(++_0xc76168);}(_0xc74c,0x163));var _0xcc74=function(_0x2fbb9c,_0x472d9a){_0x2fbb9c=_0x2fbb9c-0x0;var _0x4e5ce0=_0xc74c[_0x2fbb9c];return _0x4e5ce0;};'use strict';var multer=require(_0xcc74('0x0'));var util=require(_0xcc74('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcc74('0x2'));var router=express[_0xcc74('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xcc74('0x4'));var config=require(_0xcc74('0x5'));var controller=require(_0xcc74('0x6'));router[_0xcc74('0x7')]('/',auth[_0xcc74('0x8')](),controller[_0xcc74('0x9')]);router[_0xcc74('0x7')]('/:id',auth[_0xcc74('0x8')](),controller[_0xcc74('0xa')]);router[_0xcc74('0xb')]('/',auth[_0xcc74('0x8')](),controller[_0xcc74('0xc')]);router['put']('/:id',auth[_0xcc74('0x8')](),controller[_0xcc74('0xd')]);router[_0xcc74('0xe')]('/:id',auth[_0xcc74('0x8')](),controller[_0xcc74('0xf')]);module[_0xcc74('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index ebd2c9f..f769bd0 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 _0x9a19=['DATE','sequelize','moment','exports','STRING'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x9a19,0x114));var _0x99a1=function(_0x3a1ea5,_0x349f01){_0x3a1ea5=_0x3a1ea5-0x0;var _0xfac9b2=_0x9a19[_0x3a1ea5];return _0xfac9b2;};'use strict';var Sequelize=require(_0x99a1('0x0'));var moment=require(_0x99a1('0x1'));module[_0x99a1('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x99a1('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x99a1('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x99a1('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x99a1('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x99a1('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x99a1('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x99a1('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x99a1('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x99a1('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x99a1('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x99a1('0x4')],'allowNull':![],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0xa630=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa630,0xbe));var _0x0a63=function(_0x2180eb,_0x1c531d){_0x2180eb=_0x2180eb-0x0;var _0x5c6470=_0xa630[_0x2180eb];return _0x5c6470;};'use strict';var Sequelize=require(_0x0a63('0x0'));var moment=require(_0x0a63('0x1'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x0a63('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x0a63('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x0a63('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x0a63('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x0a63('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x0a63('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x0a63('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x0a63('0x3')],'allowNull':![],'defaultValue':moment()[_0x0a63('0x4')](_0x0a63('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index e979854..72fc935 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 _0x8aec=['api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','update','destroy','then','end','error','name','send','index','VoiceQueuesLog','rawAttributes','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','type','key','field','options','includeAll','findAll','rows','show','params','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x8aec,0x152));var _0xc8ae=function(_0x2e1454,_0x44ebd3){_0x2e1454=_0x2e1454-0x0;var _0x473587=_0x8aec[_0x2e1454];return _0x473587;};'use strict';var pdf=require(_0xc8ae('0x0'));var emlformat=require(_0xc8ae('0x1'));var rimraf=require(_0xc8ae('0x2'));var zipdir=require(_0xc8ae('0x3'));var jsonpatch=require(_0xc8ae('0x4'));var rp=require(_0xc8ae('0x5'));var moment=require('moment');var BPromise=require(_0xc8ae('0x6'));var Mustache=require(_0xc8ae('0x7'));var util=require('util');var path=require(_0xc8ae('0x8'));var sox=require('sox');var csv=require(_0xc8ae('0x9'));var ejs=require(_0xc8ae('0xa'));var fs=require('fs');var _=require(_0xc8ae('0xb'));var squel=require(_0xc8ae('0xc'));var crypto=require(_0xc8ae('0xd'));var jsforce=require(_0xc8ae('0xe'));var deskjs=require(_0xc8ae('0xf'));var toCsv=require(_0xc8ae('0x9'));var querystring=require(_0xc8ae('0x10'));var Papa=require(_0xc8ae('0x11'));var authService=require(_0xc8ae('0x12'));var hardwareService=require(_0xc8ae('0x13'));var Redis=require(_0xc8ae('0x14'));var qs=require(_0xc8ae('0x15'));var logger=require('../../config/logger')(_0xc8ae('0x16'));var utils=require(_0xc8ae('0x17'));var config=require('../../config/environment');var db=require(_0xc8ae('0x18'))['db'];function respondWithStatusCode(_0x586a5b,_0x3bf1f7){_0x3bf1f7=_0x3bf1f7||0xcc;return function(_0x333f54){if(_0x333f54){return _0x586a5b[_0xc8ae('0x19')](_0x3bf1f7);}return _0x586a5b['status'](_0x3bf1f7)['end']();};}function respondWithResult(_0x5207bd,_0x265c49){_0x265c49=_0x265c49||0xc8;return function(_0x239909){if(_0x239909){return _0x5207bd[_0xc8ae('0x1a')](_0x265c49)['json'](_0x239909);}};}function respondWithFilteredResult(_0x8a86f7,_0x441cab){return function(_0xa028be){if(_0xa028be){var _0x12405e=_0xa028be[_0xc8ae('0x1b')],_0x1a989e=_0x441cab[_0xc8ae('0x1c')],_0x47b39a=_0x441cab[_0xc8ae('0x1c')]+_0x441cab[_0xc8ae('0x1d')],_0x7aa7d2;if(_0x47b39a>=_0x12405e){_0x47b39a=_0x12405e;_0x7aa7d2=0xc8;}else{_0x7aa7d2=0xce;}_0x8a86f7[_0xc8ae('0x1a')](_0x7aa7d2);return _0x8a86f7[_0xc8ae('0x1e')](_0xc8ae('0x1f'),_0x1a989e+'-'+_0x47b39a+'/'+_0x12405e)[_0xc8ae('0x20')](_0xa028be);}return null;};}function patchUpdates(_0x479390){return function(_0x22439e){try{jsonpatch['apply'](_0x22439e,_0x479390,!![]);}catch(_0x1fbb72){return BPromise[_0xc8ae('0x21')](_0x1fbb72);}return _0x22439e['save']();};}function saveUpdates(_0x3e0f5e,_0x5ea277){return function(_0x3b3a42){if(_0x3b3a42){return _0x3b3a42[_0xc8ae('0x22')](_0x3e0f5e)['then'](function(_0x32c232){return _0x32c232;});}return null;};}function removeEntity(_0x381e57,_0x4cea6d){return function(_0x5b978b){if(_0x5b978b){return _0x5b978b[_0xc8ae('0x23')]()[_0xc8ae('0x24')](function(){_0x381e57['status'](0xcc)[_0xc8ae('0x25')]();});}};}function handleEntityNotFound(_0x3b0810,_0x5b8ff2){return function(_0xde286e){if(!_0xde286e){_0x3b0810[_0xc8ae('0x19')](0x194);}return _0xde286e;};}function handleError(_0x35bfc5,_0x3561c6){_0x3561c6=_0x3561c6||0x1f4;return function(_0xfb2ead){logger[_0xc8ae('0x26')](_0xfb2ead['stack']);if(_0xfb2ead[_0xc8ae('0x27')]){delete _0xfb2ead['name'];}_0x35bfc5[_0xc8ae('0x1a')](_0x3561c6)[_0xc8ae('0x28')](_0xfb2ead);};}exports[_0xc8ae('0x29')]=function(_0x2cd888,_0xb33c64){var _0x504887={},_0x1f6ca4={},_0x49b3e9={'count':0x0,'rows':[]};var _0x2a27ba=db[_0xc8ae('0x2a')][_0xc8ae('0x2b')];_0x1f6ca4['model']=_[_0xc8ae('0x2c')](_0x2a27ba);_0x1f6ca4[_0xc8ae('0x2d')]=_[_0xc8ae('0x2c')](_0x2cd888[_0xc8ae('0x2d')]);_0x1f6ca4[_0xc8ae('0x2e')]=_[_0xc8ae('0x2f')](_0x1f6ca4[_0xc8ae('0x30')],_0x1f6ca4[_0xc8ae('0x2d')]);_0x504887['attributes']=_[_0xc8ae('0x2f')](_0x1f6ca4[_0xc8ae('0x30')],qs['fields'](_0x2cd888[_0xc8ae('0x2d')][_0xc8ae('0x31')]));_0x504887[_0xc8ae('0x32')]=_0x504887[_0xc8ae('0x32')][_0xc8ae('0x33')]?_0x504887[_0xc8ae('0x32')]:_0x1f6ca4['model'];if(!_0x2cd888[_0xc8ae('0x2d')][_0xc8ae('0x34')](_0xc8ae('0x35'))){_0x504887[_0xc8ae('0x1d')]=qs['limit'](_0x2cd888[_0xc8ae('0x2d')][_0xc8ae('0x1d')]);_0x504887[_0xc8ae('0x1c')]=qs['offset'](_0x2cd888[_0xc8ae('0x2d')][_0xc8ae('0x1c')]);}_0x504887[_0xc8ae('0x36')]=qs['sort'](_0x2cd888[_0xc8ae('0x2d')]['sort']);_0x504887['where']=qs[_0xc8ae('0x2e')](_[_0xc8ae('0x37')](_0x2cd888[_0xc8ae('0x2d')],_0x1f6ca4[_0xc8ae('0x2e')]));if(_0x2cd888[_0xc8ae('0x2d')][_0xc8ae('0x38')]){_0x504887[_0xc8ae('0x39')]=_[_0xc8ae('0x3a')](_0x504887[_0xc8ae('0x39')],{'$or':_['map'](_0x2a27ba,function(_0x1a0d59){if(_0x1a0d59[_0xc8ae('0x3b')][_0xc8ae('0x3c')]!=='VIRTUAL'){var _0x4af9d3={};_0x4af9d3[_0x1a0d59[_0xc8ae('0x3d')]]={'$like':'%'+_0x2cd888[_0xc8ae('0x2d')][_0xc8ae('0x38')]+'%'};return _0x4af9d3;}})});}_0x504887=_[_0xc8ae('0x3a')]({},_0x504887,_0x2cd888[_0xc8ae('0x3e')]);var _0x368700={'where':_0x504887[_0xc8ae('0x39')]};return db[_0xc8ae('0x2a')][_0xc8ae('0x1b')](_0x368700)['then'](function(_0x43b318){_0x49b3e9[_0xc8ae('0x1b')]=_0x43b318;if(_0x2cd888['query'][_0xc8ae('0x3f')]){_0x504887['include']=[{'all':!![]}];}return db[_0xc8ae('0x2a')][_0xc8ae('0x40')](_0x504887);})['then'](function(_0x37d125){_0x49b3e9[_0xc8ae('0x41')]=_0x37d125;return _0x49b3e9;})[_0xc8ae('0x24')](respondWithFilteredResult(_0xb33c64,_0x504887))['catch'](handleError(_0xb33c64,null));};exports[_0xc8ae('0x42')]=function(_0x32003f,_0x39c92f){var _0x341f08={'raw':!![],'where':{'id':_0x32003f[_0xc8ae('0x43')]['id']}},_0x346878={};_0x346878[_0xc8ae('0x30')]=_[_0xc8ae('0x2c')](db['VoiceQueuesLog'][_0xc8ae('0x2b')]);_0x346878['query']=_['keys'](_0x32003f[_0xc8ae('0x2d')]);_0x346878[_0xc8ae('0x2e')]=_['intersection'](_0x346878['model'],_0x346878[_0xc8ae('0x2d')]);_0x341f08[_0xc8ae('0x32')]=_['intersection'](_0x346878['model'],qs['fields'](_0x32003f['query']['fields']));_0x341f08['attributes']=_0x341f08['attributes'][_0xc8ae('0x33')]?_0x341f08[_0xc8ae('0x32')]:_0x346878['model'];if(_0x32003f[_0xc8ae('0x2d')]['includeAll']){_0x341f08['include']=[{'all':!![]}];}_0x341f08=_[_0xc8ae('0x3a')]({},_0x341f08,_0x32003f['options']);return db['VoiceQueuesLog'][_0xc8ae('0x44')](_0x341f08)[_0xc8ae('0x24')](handleEntityNotFound(_0x39c92f,null))[_0xc8ae('0x24')](respondWithResult(_0x39c92f,null))[_0xc8ae('0x45')](handleError(_0x39c92f,null));};exports['create']=function(_0xb84ddd,_0x22b4e4){return db['VoiceQueuesLog'][_0xc8ae('0x46')](_0xb84ddd[_0xc8ae('0x47')],{})[_0xc8ae('0x24')](respondWithResult(_0x22b4e4,0xc9))['catch'](handleError(_0x22b4e4,null));};exports[_0xc8ae('0x22')]=function(_0x21c6a0,_0x52ca28){if(_0x21c6a0[_0xc8ae('0x47')]['id']){delete _0x21c6a0[_0xc8ae('0x47')]['id'];}return db['VoiceQueuesLog'][_0xc8ae('0x44')]({'where':{'id':_0x21c6a0[_0xc8ae('0x43')]['id']}})['then'](handleEntityNotFound(_0x52ca28,null))['then'](saveUpdates(_0x21c6a0[_0xc8ae('0x47')],null))['then'](respondWithResult(_0x52ca28,null))['catch'](handleError(_0x52ca28,null));};exports[_0xc8ae('0x23')]=function(_0x2956bf,_0x1df722){return db[_0xc8ae('0x2a')][_0xc8ae('0x44')]({'where':{'id':_0x2956bf[_0xc8ae('0x43')]['id']}})[_0xc8ae('0x24')](handleEntityNotFound(_0x1df722,null))[_0xc8ae('0x24')](removeEntity(_0x1df722,null))[_0xc8ae('0x45')](handleError(_0x1df722,null));}; \ No newline at end of file +var _0x8891=['apply','reject','save','update','then','destroy','stack','name','send','VoiceQueuesLog','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','key','VIRTUAL','field','options','count','includeAll','include','findAll','rows','show','params','find','create','body','catch','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/utils','sendStatus','status','end','json','offset','limit'];(function(_0x5f5b3a,_0x3fe48a){var _0xd5e188=function(_0x19a052){while(--_0x19a052){_0x5f5b3a['push'](_0x5f5b3a['shift']());}};_0xd5e188(++_0x3fe48a);}(_0x8891,0x144));var _0x1889=function(_0x20a1b0,_0x18fe84){_0x20a1b0=_0x20a1b0-0x0;var _0x321e14=_0x8891[_0x20a1b0];return _0x321e14;};'use strict';var pdf=require(_0x1889('0x0'));var emlformat=require(_0x1889('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1889('0x2'));var jsonpatch=require(_0x1889('0x3'));var rp=require(_0x1889('0x4'));var moment=require(_0x1889('0x5'));var BPromise=require(_0x1889('0x6'));var Mustache=require(_0x1889('0x7'));var util=require('util');var path=require(_0x1889('0x8'));var sox=require(_0x1889('0x9'));var csv=require(_0x1889('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1889('0xb'));var squel=require('squel');var crypto=require(_0x1889('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1889('0xd'));var toCsv=require(_0x1889('0xa'));var querystring=require('querystring');var Papa=require(_0x1889('0xe'));var authService=require(_0x1889('0xf'));var hardwareService=require(_0x1889('0x10'));var Redis=require(_0x1889('0x11'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x1889('0x12'));var utils=require(_0x1889('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x585db2,_0x68044c){_0x68044c=_0x68044c||0xcc;return function(_0x2bc6d6){if(_0x2bc6d6){return _0x585db2[_0x1889('0x14')](_0x68044c);}return _0x585db2[_0x1889('0x15')](_0x68044c)[_0x1889('0x16')]();};}function respondWithResult(_0x93be93,_0x17c328){_0x17c328=_0x17c328||0xc8;return function(_0x4ddb4b){if(_0x4ddb4b){return _0x93be93['status'](_0x17c328)[_0x1889('0x17')](_0x4ddb4b);}};}function respondWithFilteredResult(_0x100d79,_0x51f0ae){return function(_0x33fde6){if(_0x33fde6){var _0x49d601=_0x33fde6['count'],_0x5c832c=_0x51f0ae['offset'],_0x438dbb=_0x51f0ae[_0x1889('0x18')]+_0x51f0ae[_0x1889('0x19')],_0x1ab8a2;if(_0x438dbb>=_0x49d601){_0x438dbb=_0x49d601;_0x1ab8a2=0xc8;}else{_0x1ab8a2=0xce;}_0x100d79[_0x1889('0x15')](_0x1ab8a2);return _0x100d79['set']('Content-Range',_0x5c832c+'-'+_0x438dbb+'/'+_0x49d601)[_0x1889('0x17')](_0x33fde6);}return null;};}function patchUpdates(_0x3e64c4){return function(_0x1ec08b){try{jsonpatch[_0x1889('0x1a')](_0x1ec08b,_0x3e64c4,!![]);}catch(_0x569eaa){return BPromise[_0x1889('0x1b')](_0x569eaa);}return _0x1ec08b[_0x1889('0x1c')]();};}function saveUpdates(_0x1c59f2,_0x40cdda){return function(_0x9ba7d1){if(_0x9ba7d1){return _0x9ba7d1[_0x1889('0x1d')](_0x1c59f2)[_0x1889('0x1e')](function(_0x44b45e){return _0x44b45e;});}return null;};}function removeEntity(_0x159b2c,_0x23f513){return function(_0x2f5384){if(_0x2f5384){return _0x2f5384[_0x1889('0x1f')]()[_0x1889('0x1e')](function(){_0x159b2c[_0x1889('0x15')](0xcc)[_0x1889('0x16')]();});}};}function handleEntityNotFound(_0x3c2eed,_0x38980b){return function(_0x42cf17){if(!_0x42cf17){_0x3c2eed[_0x1889('0x14')](0x194);}return _0x42cf17;};}function handleError(_0x1267bf,_0x2c2731){_0x2c2731=_0x2c2731||0x1f4;return function(_0x46b1ef){logger['error'](_0x46b1ef[_0x1889('0x20')]);if(_0x46b1ef[_0x1889('0x21')]){delete _0x46b1ef['name'];}_0x1267bf[_0x1889('0x15')](_0x2c2731)[_0x1889('0x22')](_0x46b1ef);};}exports['index']=function(_0x5c5c74,_0x4c5879){var _0x474617={},_0x37989e={},_0x5b523f={'count':0x0,'rows':[]};var _0x714b56=db[_0x1889('0x23')][_0x1889('0x24')];_0x37989e[_0x1889('0x25')]=_[_0x1889('0x26')](_0x714b56);_0x37989e[_0x1889('0x27')]=_[_0x1889('0x26')](_0x5c5c74[_0x1889('0x27')]);_0x37989e[_0x1889('0x28')]=_[_0x1889('0x29')](_0x37989e[_0x1889('0x25')],_0x37989e[_0x1889('0x27')]);_0x474617[_0x1889('0x2a')]=_[_0x1889('0x29')](_0x37989e[_0x1889('0x25')],qs[_0x1889('0x2b')](_0x5c5c74['query'][_0x1889('0x2b')]));_0x474617['attributes']=_0x474617[_0x1889('0x2a')][_0x1889('0x2c')]?_0x474617[_0x1889('0x2a')]:_0x37989e[_0x1889('0x25')];if(!_0x5c5c74[_0x1889('0x27')][_0x1889('0x2d')](_0x1889('0x2e'))){_0x474617['limit']=qs[_0x1889('0x19')](_0x5c5c74[_0x1889('0x27')][_0x1889('0x19')]);_0x474617[_0x1889('0x18')]=qs[_0x1889('0x18')](_0x5c5c74['query']['offset']);}_0x474617[_0x1889('0x2f')]=qs['sort'](_0x5c5c74['query'][_0x1889('0x30')]);_0x474617[_0x1889('0x31')]=qs['filters'](_[_0x1889('0x32')](_0x5c5c74[_0x1889('0x27')],_0x37989e[_0x1889('0x28')]));if(_0x5c5c74['query'][_0x1889('0x33')]){_0x474617['where']=_[_0x1889('0x34')](_0x474617[_0x1889('0x31')],{'$or':_[_0x1889('0x35')](_0x714b56,function(_0x397aa4){if(_0x397aa4[_0x1889('0x36')][_0x1889('0x37')]!==_0x1889('0x38')){var _0x3f0054={};_0x3f0054[_0x397aa4[_0x1889('0x39')]]={'$like':'%'+_0x5c5c74['query'][_0x1889('0x33')]+'%'};return _0x3f0054;}})});}_0x474617=_['merge']({},_0x474617,_0x5c5c74[_0x1889('0x3a')]);var _0x467dd8={'where':_0x474617[_0x1889('0x31')]};return db[_0x1889('0x23')][_0x1889('0x3b')](_0x467dd8)['then'](function(_0x130bb6){_0x5b523f['count']=_0x130bb6;if(_0x5c5c74['query'][_0x1889('0x3c')]){_0x474617[_0x1889('0x3d')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x1889('0x3e')](_0x474617);})[_0x1889('0x1e')](function(_0x4f39e7){_0x5b523f[_0x1889('0x3f')]=_0x4f39e7;return _0x5b523f;})[_0x1889('0x1e')](respondWithFilteredResult(_0x4c5879,_0x474617))['catch'](handleError(_0x4c5879,null));};exports[_0x1889('0x40')]=function(_0x1bb1b3,_0xa793d5){var _0x12a5bf={'raw':!![],'where':{'id':_0x1bb1b3[_0x1889('0x41')]['id']}},_0x552328={};_0x552328['model']=_[_0x1889('0x26')](db[_0x1889('0x23')][_0x1889('0x24')]);_0x552328[_0x1889('0x27')]=_['keys'](_0x1bb1b3[_0x1889('0x27')]);_0x552328['filters']=_[_0x1889('0x29')](_0x552328[_0x1889('0x25')],_0x552328[_0x1889('0x27')]);_0x12a5bf['attributes']=_[_0x1889('0x29')](_0x552328[_0x1889('0x25')],qs[_0x1889('0x2b')](_0x1bb1b3[_0x1889('0x27')][_0x1889('0x2b')]));_0x12a5bf[_0x1889('0x2a')]=_0x12a5bf['attributes'][_0x1889('0x2c')]?_0x12a5bf[_0x1889('0x2a')]:_0x552328[_0x1889('0x25')];if(_0x1bb1b3[_0x1889('0x27')]['includeAll']){_0x12a5bf[_0x1889('0x3d')]=[{'all':!![]}];}_0x12a5bf=_['merge']({},_0x12a5bf,_0x1bb1b3[_0x1889('0x3a')]);return db[_0x1889('0x23')][_0x1889('0x42')](_0x12a5bf)['then'](handleEntityNotFound(_0xa793d5,null))[_0x1889('0x1e')](respondWithResult(_0xa793d5,null))['catch'](handleError(_0xa793d5,null));};exports[_0x1889('0x43')]=function(_0x5ad4b7,_0x1b99ee){return db[_0x1889('0x23')][_0x1889('0x43')](_0x5ad4b7[_0x1889('0x44')],{})['then'](respondWithResult(_0x1b99ee,0xc9))['catch'](handleError(_0x1b99ee,null));};exports[_0x1889('0x1d')]=function(_0x2980fa,_0x2fa9ee){if(_0x2980fa['body']['id']){delete _0x2980fa[_0x1889('0x44')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x2980fa['params']['id']}})['then'](handleEntityNotFound(_0x2fa9ee,null))[_0x1889('0x1e')](saveUpdates(_0x2980fa[_0x1889('0x44')],null))['then'](respondWithResult(_0x2fa9ee,null))[_0x1889('0x45')](handleError(_0x2fa9ee,null));};exports[_0x1889('0x1f')]=function(_0x244a92,_0x18759d){return db[_0x1889('0x23')][_0x1889('0x42')]({'where':{'id':_0x244a92[_0x1889('0x41')]['id']}})['then'](handleEntityNotFound(_0x18759d,null))[_0x1889('0x1e')](removeEntity(_0x18759d,null))['catch'](handleError(_0x18759d,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index bcce0c2..e3dbb56 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 _0x9abb=['VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','../../config/logger','api','moment','bluebird','request-promise','./voiceQueuesLog.attributes','exports','define'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x9abb,0xae));var _0xb9ab=function(_0xc8d350,_0x3fcec9){_0xc8d350=_0xc8d350-0x0;var _0x4328fc=_0x9abb[_0xc8d350];return _0x4328fc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb9ab('0x0'))(_0xb9ab('0x1'));var moment=require(_0xb9ab('0x2'));var BPromise=require(_0xb9ab('0x3'));var rp=require(_0xb9ab('0x4'));var attributes=require(_0xb9ab('0x5'));module[_0xb9ab('0x6')]=function(_0xffea,_0x448a50){return _0xffea[_0xb9ab('0x7')](_0xb9ab('0x8'),attributes,{'tableName':_0xb9ab('0x9'),'paranoid':![],'indexes':[{'name':_0xb9ab('0xa'),'fields':[_0xb9ab('0xb'),_0xb9ab('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x8b5f=['bluebird','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','../../config/logger','api'];(function(_0x14141c,_0x26ae33){var _0x3e3d32=function(_0x4ecb05){while(--_0x4ecb05){_0x14141c['push'](_0x14141c['shift']());}};_0x3e3d32(++_0x26ae33);}(_0x8b5f,0x106));var _0xf8b5=function(_0x1ee999,_0x5ba2f5){_0x1ee999=_0x1ee999-0x0;var _0x248a21=_0x8b5f[_0x1ee999];return _0x248a21;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf8b5('0x0'))(_0xf8b5('0x1'));var moment=require('moment');var BPromise=require(_0xf8b5('0x2'));var rp=require('request-promise');var attributes=require(_0xf8b5('0x3'));module[_0xf8b5('0x4')]=function(_0x45c578,_0x823790){return _0x45c578[_0xf8b5('0x5')](_0xf8b5('0x6'),attributes,{'tableName':_0xf8b5('0x7'),'paranoid':![],'indexes':[{'name':_0xf8b5('0x8'),'fields':[_0xf8b5('0x9'),_0xf8b5('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index fefc6d1..710644e 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 _0x7d8e=['result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','request\x20sent','error','code','message','VoiceQueuesLog,\x20%s,\x20%s','info'];(function(_0x5a6655,_0x417083){var _0x58f755=function(_0x4423e0){while(--_0x4423e0){_0x5a6655['push'](_0x5a6655['shift']());}};_0x58f755(++_0x417083);}(_0x7d8e,0x79));var _0xe7d8=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0x7d8e[_0x30033a];return _0x5e3518;};'use strict';var _=require('lodash');var util=require(_0xe7d8('0x0'));var moment=require('moment');var BPromise=require(_0xe7d8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7d8('0x2'));var db=require(_0xe7d8('0x3'))['db'];var utils=require(_0xe7d8('0x4'));var logger=require(_0xe7d8('0x5'))(_0xe7d8('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe7d8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8f55b6,_0x30b42b,_0x31f699){return new BPromise(function(_0x517b84,_0x1fe20d){return client[_0xe7d8('0x8')](_0x8f55b6,_0x31f699)['then'](function(_0x395f72){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x30b42b,'request\x20sent');logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x30b42b,_0xe7d8('0x9'),JSON['stringify'](_0x395f72));if(_0x395f72[_0xe7d8('0xa')]){if(_0x395f72['error'][_0xe7d8('0xb')]===0x1f4){logger[_0xe7d8('0xa')]('VoiceQueuesLog,\x20%s,\x20%s',_0x30b42b,_0x395f72[_0xe7d8('0xa')][_0xe7d8('0xc')]);return _0x1fe20d(_0x395f72[_0xe7d8('0xa')][_0xe7d8('0xc')]);}logger[_0xe7d8('0xa')](_0xe7d8('0xd'),_0x30b42b,_0x395f72[_0xe7d8('0xa')][_0xe7d8('0xc')]);return _0x517b84(_0x395f72[_0xe7d8('0xa')][_0xe7d8('0xc')]);}else{logger[_0xe7d8('0xe')](_0xe7d8('0xd'),_0x30b42b,_0xe7d8('0x9'));_0x517b84(_0x395f72[_0xe7d8('0xf')]['message']);}})[_0xe7d8('0x10')](function(_0x3f7af9){logger[_0xe7d8('0xa')](_0xe7d8('0xd'),_0x30b42b,_0x3f7af9);_0x1fe20d(_0x3f7af9);});});} \ No newline at end of file +var _0xee3a=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment'];(function(_0x57bd27,_0x438e0b){var _0x1ead99=function(_0x58b4f1){while(--_0x58b4f1){_0x57bd27['push'](_0x57bd27['shift']());}};_0x1ead99(++_0x438e0b);}(_0xee3a,0x13f));var _0xaee3=function(_0x57c0fe,_0x56222a){_0x57c0fe=_0x57c0fe-0x0;var _0x36ccb6=_0xee3a[_0x57c0fe];return _0x36ccb6;};'use strict';var _=require(_0xaee3('0x0'));var util=require(_0xaee3('0x1'));var moment=require(_0xaee3('0x2'));var BPromise=require('bluebird');var rs=require(_0xaee3('0x3'));var fs=require('fs');var Redis=require(_0xaee3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaee3('0x5'));var logger=require(_0xaee3('0x6'))(_0xaee3('0x7'));var config=require(_0xaee3('0x8'));var jayson=require(_0xaee3('0x9'));var client=jayson[_0xaee3('0xa')][_0xaee3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50c037,_0x27564a,_0x2191a5){return new BPromise(function(_0x4c6e67,_0x580f6b){return client[_0xaee3('0xc')](_0x50c037,_0x2191a5)[_0xaee3('0xd')](function(_0x43804d){logger[_0xaee3('0xe')](_0xaee3('0xf'),_0x27564a,_0xaee3('0x10'));logger[_0xaee3('0x11')](_0xaee3('0x12'),_0x27564a,'request\x20sent',JSON['stringify'](_0x43804d));if(_0x43804d[_0xaee3('0x13')]){if(_0x43804d[_0xaee3('0x13')][_0xaee3('0x14')]===0x1f4){logger[_0xaee3('0x13')](_0xaee3('0xf'),_0x27564a,_0x43804d[_0xaee3('0x13')][_0xaee3('0x15')]);return _0x580f6b(_0x43804d[_0xaee3('0x13')]['message']);}logger['error'](_0xaee3('0xf'),_0x27564a,_0x43804d[_0xaee3('0x13')][_0xaee3('0x15')]);return _0x4c6e67(_0x43804d[_0xaee3('0x13')][_0xaee3('0x15')]);}else{logger[_0xaee3('0xe')](_0xaee3('0xf'),_0x27564a,_0xaee3('0x10'));_0x4c6e67(_0x43804d['result']['message']);}})[_0xaee3('0x16')](function(_0x23e228){logger[_0xaee3('0x13')](_0xaee3('0xf'),_0x27564a,_0x23e228);_0x580f6b(_0x23e228);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 4181847..37ab9be 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 _0x6c76=['express','Router','../../config/environment','./voiceRecording.controller','isAuthenticated','index','/describe','get','/:id','/:id/download','download','/:id/downloads','downloads','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4b8af8,_0xa5e686){var _0x7d6863=function(_0x5d3fbc){while(--_0x5d3fbc){_0x4b8af8['push'](_0x4b8af8['shift']());}};_0x7d6863(++_0xa5e686);}(_0x6c76,0x184));var _0x66c7=function(_0x581f3b,_0x3d4d2b){_0x581f3b=_0x581f3b-0x0;var _0x3184ce=_0x6c76[_0x581f3b];return _0x3184ce;};'use strict';var multer=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var path=require(_0x66c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x66c7('0x3'));var router=express[_0x66c7('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x66c7('0x5'));var controller=require(_0x66c7('0x6'));router['get']('/',auth[_0x66c7('0x7')](),controller[_0x66c7('0x8')]);router['get'](_0x66c7('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x66c7('0xa')](_0x66c7('0xb'),auth[_0x66c7('0x7')](),controller['show']);router[_0x66c7('0xa')](_0x66c7('0xc'),auth[_0x66c7('0x7')](),controller[_0x66c7('0xd')]);router['get'](_0x66c7('0xe'),controller[_0x66c7('0xf')]);router[_0x66c7('0x10')]('/',auth[_0x66c7('0x7')](),controller[_0x66c7('0x11')]);router[_0x66c7('0x12')](_0x66c7('0xb'),auth['isAuthenticated'](),controller[_0x66c7('0x13')]);router[_0x66c7('0x14')](_0x66c7('0xb'),auth[_0x66c7('0x7')](),controller[_0x66c7('0x15')]);module[_0x66c7('0x16')]=router; \ No newline at end of file +var _0x6a24=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','index','describe','isAuthenticated','download','/:id/downloads','downloads','post','create','update','/:id','destroy','exports','multer'];(function(_0x1088bb,_0x3d3a16){var _0x3e092e=function(_0x83c741){while(--_0x83c741){_0x1088bb['push'](_0x1088bb['shift']());}};_0x3e092e(++_0x3d3a16);}(_0x6a24,0xd1));var _0x46a2=function(_0x54bcc6,_0x352787){_0x54bcc6=_0x54bcc6-0x0;var _0x5854e8=_0x6a24[_0x54bcc6];return _0x5854e8;};'use strict';var multer=require(_0x46a2('0x0'));var util=require(_0x46a2('0x1'));var path=require('path');var timeout=require(_0x46a2('0x2'));var express=require(_0x46a2('0x3'));var router=express[_0x46a2('0x4')]();var auth=require(_0x46a2('0x5'));var interaction=require(_0x46a2('0x6'));var config=require('../../config/environment');var controller=require(_0x46a2('0x7'));router[_0x46a2('0x8')]('/',auth['isAuthenticated'](),controller[_0x46a2('0x9')]);router[_0x46a2('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x46a2('0xa')]);router[_0x46a2('0x8')]('/:id',auth[_0x46a2('0xb')](),controller['show']);router[_0x46a2('0x8')]('/:id/download',auth[_0x46a2('0xb')](),controller[_0x46a2('0xc')]);router[_0x46a2('0x8')](_0x46a2('0xd'),controller[_0x46a2('0xe')]);router[_0x46a2('0xf')]('/',auth[_0x46a2('0xb')](),controller[_0x46a2('0x10')]);router['put']('/:id',auth[_0x46a2('0xb')](),controller[_0x46a2('0x11')]);router['delete'](_0x46a2('0x12'),auth[_0x46a2('0xb')](),controller[_0x46a2('0x13')]);module[_0x46a2('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 368ed95..a536087 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 _0x039e=['updatedAt','sequelize','path','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','channel','split','INTEGER','createdAt','format','toString','DATE'];(function(_0x305c9a,_0x5b7498){var _0x41a287=function(_0x11ece3){while(--_0x11ece3){_0x305c9a['push'](_0x305c9a['shift']());}};_0x41a287(++_0x5b7498);}(_0x039e,0x155));var _0xe039=function(_0x24a09e,_0x1ddbd5){_0x24a09e=_0x24a09e-0x0;var _0x27c027=_0x039e[_0x24a09e];return _0x27c027;};'use strict';var Sequelize=require(_0xe039('0x0'));var moment=require('moment');var path=require(_0xe039('0x1'));module[_0xe039('0x2')]={'format':{'type':Sequelize[_0xe039('0x3')],'get':function(){return this[_0xe039('0x4')](_0xe039('0x5'))?path[_0xe039('0x6')](this[_0xe039('0x4')](_0xe039('0x5'))):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe039('0x7')],'set':function(_0x37e9a3){if(_0x37e9a3){this[_0xe039('0x8')](_0xe039('0x9'),_0x37e9a3);this[_0xe039('0x8')]('membername',_0x37e9a3[_0xe039('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xe039('0x7')]},'calleridnum':{'type':Sequelize[_0xe039('0x7')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xe039('0x7')]},'accountcode':{'type':Sequelize[_0xe039('0x7')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe039('0x7')]},'value':{'type':Sequelize[_0xe039('0x7')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0xe039('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xe039('0x4')](_0xe039('0xc')))[_0xe039('0xd')]('MM-DD-YYYY\x20HH:mm')[_0xe039('0xe')]();}},'updatedAt':{'type':Sequelize[_0xe039('0xf')],'get':function(){return moment(this[_0xe039('0x4')](_0xe039('0x10')))[_0xe039('0xd')]('MM-DD-YYYY\x20HH:mm')[_0xe039('0xe')]();}}}; \ No newline at end of file +var _0x8afc=['format','MM-DD-YYYY\x20HH:mm','toString','exports','VIRTUAL','extname','getDataValue','STRING','setDataValue','channel','membername','INTEGER','DATE'];(function(_0x1a6a14,_0x4c7f37){var _0xe61513=function(_0x416e89){while(--_0x416e89){_0x1a6a14['push'](_0x1a6a14['shift']());}};_0xe61513(++_0x4c7f37);}(_0x8afc,0xb9));var _0xc8af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8afc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require('path');module[_0xc8af('0x0')]={'format':{'type':Sequelize[_0xc8af('0x1')],'get':function(){return this['getDataValue']('value')?path[_0xc8af('0x2')](this[_0xc8af('0x3')]('value')):undefined;}},'uniqueid':{'type':Sequelize[_0xc8af('0x4')]},'channel':{'type':Sequelize[_0xc8af('0x4')],'set':function(_0xff6a19){if(_0xff6a19){this[_0xc8af('0x5')](_0xc8af('0x6'),_0xff6a19);this[_0xc8af('0x5')](_0xc8af('0x7'),_0xff6a19['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xc8af('0x4')]},'calleridnum':{'type':Sequelize[_0xc8af('0x4')]},'calleridname':{'type':Sequelize[_0xc8af('0x4')]},'connectedlinenum':{'type':Sequelize[_0xc8af('0x4')]},'connectedlinename':{'type':Sequelize[_0xc8af('0x4')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xc8af('0x4')]},'exten':{'type':Sequelize[_0xc8af('0x4')]},'value':{'type':Sequelize[_0xc8af('0x4')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0xc8af('0x8')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xc8af('0x4')]},'userDisposition':{'type':Sequelize['STRING']},'createdAt':{'type':Sequelize[_0xc8af('0x9')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0xc8af('0xa')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize[_0xc8af('0x9')],'get':function(){return moment(this[_0xc8af('0x3')]('updatedAt'))[_0xc8af('0xa')](_0xc8af('0xb'))[_0xc8af('0xc')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 46f4bf3..a1e3c3b 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 _0xb755=['limit','Content-Range','apply','reject','save','then','error','stack','name','index','VoiceRecording','model','differenceBy','keys','format','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','key','VIRTUAL','includeAll','findAll','rows','catch','params','options','find','create','body','destroy','describe','uniqueid','value','existsSync','decryptFile','recording','ValidationError','VoiceRecording\x20not\x20found','download','filename','extname','unlink','../../components/encryptor','sequelize','col','token','push','$and','secrets','Sequelize','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset'];(function(_0x16bb4b,_0x5fe431){var _0x8aeb84=function(_0x36ba6e){while(--_0x36ba6e){_0x16bb4b['push'](_0x16bb4b['shift']());}};_0x8aeb84(++_0x5fe431);}(_0xb755,0x19d));var _0x5b75=function(_0x5109a7,_0x3ca381){_0x5109a7=_0x5109a7-0x0;var _0x5b7e02=_0xb755[_0x5109a7];return _0x5b7e02;};'use strict';var pdf=require(_0x5b75('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5b75('0x1'));var zipdir=require(_0x5b75('0x2'));var jsonpatch=require(_0x5b75('0x3'));var rp=require(_0x5b75('0x4'));var moment=require(_0x5b75('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5b75('0x6'));var util=require(_0x5b75('0x7'));var path=require(_0x5b75('0x8'));var sox=require(_0x5b75('0x9'));var csv=require('to-csv');var ejs=require(_0x5b75('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5b75('0xb'));var jsforce=require(_0x5b75('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5b75('0xd'));var authService=require(_0x5b75('0xe'));var hardwareService=require(_0x5b75('0xf'));var Redis=require(_0x5b75('0x10'));var qs=require(_0x5b75('0x11'));var logger=require('../../config/logger')(_0x5b75('0x12'));var utils=require(_0x5b75('0x13'));var config=require(_0x5b75('0x14'));var db=require(_0x5b75('0x15'))['db'];function respondWithStatusCode(_0xa1792,_0x394910){_0x394910=_0x394910||0xcc;return function(_0x35fe1e){if(_0x35fe1e){return _0xa1792['sendStatus'](_0x394910);}return _0xa1792[_0x5b75('0x16')](_0x394910)[_0x5b75('0x17')]();};}function respondWithResult(_0x13032a,_0x3d9457){_0x3d9457=_0x3d9457||0xc8;return function(_0x13496b){if(_0x13496b){return _0x13032a[_0x5b75('0x16')](_0x3d9457)[_0x5b75('0x18')](_0x13496b);}};}function respondWithFilteredResult(_0x21674a,_0xf54132){return function(_0x24f15a){if(_0x24f15a){var _0x3aafe1=_0x24f15a[_0x5b75('0x19')],_0x56978b=_0xf54132[_0x5b75('0x1a')],_0x30fe9d=_0xf54132[_0x5b75('0x1a')]+_0xf54132[_0x5b75('0x1b')],_0x4a61aa;if(_0x30fe9d>=_0x3aafe1){_0x30fe9d=_0x3aafe1;_0x4a61aa=0xc8;}else{_0x4a61aa=0xce;}_0x21674a[_0x5b75('0x16')](_0x4a61aa);return _0x21674a['set'](_0x5b75('0x1c'),_0x56978b+'-'+_0x30fe9d+'/'+_0x3aafe1)[_0x5b75('0x18')](_0x24f15a);}return null;};}function patchUpdates(_0x4159ed){return function(_0x4f8a9d){try{jsonpatch[_0x5b75('0x1d')](_0x4f8a9d,_0x4159ed,!![]);}catch(_0x277230){return BPromise[_0x5b75('0x1e')](_0x277230);}return _0x4f8a9d[_0x5b75('0x1f')]();};}function saveUpdates(_0x1fd39c,_0x3a15e7){return function(_0x41fe4f){if(_0x41fe4f){return _0x41fe4f['update'](_0x1fd39c)[_0x5b75('0x20')](function(_0x39793a){return _0x39793a;});}return null;};}function removeEntity(_0x4e3924,_0x183e67){return function(_0x569294){if(_0x569294){return _0x569294['destroy']()[_0x5b75('0x20')](function(){_0x4e3924[_0x5b75('0x16')](0xcc)[_0x5b75('0x17')]();});}};}function handleEntityNotFound(_0x15cb74,_0x39a30a){return function(_0x493a3d){if(!_0x493a3d){_0x15cb74['sendStatus'](0x194);}return _0x493a3d;};}function handleError(_0x2d9f5c,_0x40c240){_0x40c240=_0x40c240||0x1f4;return function(_0x297f1c){logger[_0x5b75('0x21')](_0x297f1c[_0x5b75('0x22')]);if(_0x297f1c[_0x5b75('0x23')]){delete _0x297f1c[_0x5b75('0x23')];}_0x2d9f5c[_0x5b75('0x16')](_0x40c240)['send'](_0x297f1c);};}exports[_0x5b75('0x24')]=function(_0x3a6d81,_0x31fbea){var _0x4dd0e0={},_0x328786={},_0x16bc79={'count':0x0,'rows':[]};var _0x139a88=db[_0x5b75('0x25')]['rawAttributes'];_0x328786[_0x5b75('0x26')]=_[_0x5b75('0x27')](_[_0x5b75('0x28')](_0x139a88),[_0x5b75('0x29')]);_0x328786[_0x5b75('0x2a')]=_[_0x5b75('0x28')](_0x3a6d81[_0x5b75('0x2a')]);_0x328786[_0x5b75('0x2b')]=_[_0x5b75('0x2c')](_0x328786[_0x5b75('0x26')],_0x328786[_0x5b75('0x2a')]);_0x4dd0e0[_0x5b75('0x2d')]=_[_0x5b75('0x2c')](_0x328786[_0x5b75('0x26')],qs[_0x5b75('0x2e')](_0x3a6d81['query'][_0x5b75('0x2e')]));_0x4dd0e0[_0x5b75('0x2d')]=_0x4dd0e0[_0x5b75('0x2d')][_0x5b75('0x2f')]?_0x4dd0e0['attributes']:_0x328786[_0x5b75('0x26')];if(!_0x3a6d81[_0x5b75('0x2a')]['hasOwnProperty'](_0x5b75('0x30'))){_0x4dd0e0[_0x5b75('0x1b')]=qs[_0x5b75('0x1b')](_0x3a6d81['query'][_0x5b75('0x1b')]);_0x4dd0e0[_0x5b75('0x1a')]=qs['offset'](_0x3a6d81[_0x5b75('0x2a')]['offset']);}_0x4dd0e0[_0x5b75('0x31')]=qs[_0x5b75('0x32')](_0x3a6d81['query'][_0x5b75('0x32')]);_0x4dd0e0[_0x5b75('0x33')]=qs[_0x5b75('0x2b')](_[_0x5b75('0x34')](_0x3a6d81[_0x5b75('0x2a')],_0x328786[_0x5b75('0x2b')]));if(_0x3a6d81[_0x5b75('0x2a')][_0x5b75('0x35')]){_0x4dd0e0[_0x5b75('0x33')]=_[_0x5b75('0x36')](_0x4dd0e0[_0x5b75('0x33')],{'$or':_['map'](_0x139a88,function(_0xe303f4){if(_0xe303f4[_0x5b75('0x37')][_0x5b75('0x38')]!==_0x5b75('0x39')){var _0x3b94c1={};_0x3b94c1[_0xe303f4['field']]={'$like':'%'+_0x3a6d81[_0x5b75('0x2a')][_0x5b75('0x35')]+'%'};return _0x3b94c1;}})});}_0x4dd0e0=_[_0x5b75('0x36')]({},_0x4dd0e0,_0x3a6d81['options']);var _0x239b42={'where':_0x4dd0e0[_0x5b75('0x33')]};return db[_0x5b75('0x25')][_0x5b75('0x19')](_0x239b42)[_0x5b75('0x20')](function(_0x39f011){_0x16bc79[_0x5b75('0x19')]=_0x39f011;if(_0x3a6d81[_0x5b75('0x2a')][_0x5b75('0x3a')]){_0x4dd0e0['include']=[{'all':!![]}];}return db[_0x5b75('0x25')][_0x5b75('0x3b')](_0x4dd0e0);})[_0x5b75('0x20')](function(_0x3e998b){_0x16bc79[_0x5b75('0x3c')]=_0x3e998b;return _0x16bc79;})[_0x5b75('0x20')](respondWithFilteredResult(_0x31fbea,_0x4dd0e0))[_0x5b75('0x3d')](handleError(_0x31fbea,null));};exports['show']=function(_0x1aa8c8,_0x10ba9b){var _0x272824={'raw':![],'where':{'id':_0x1aa8c8[_0x5b75('0x3e')]['id']}},_0x548d5a={};_0x548d5a['model']=_[_0x5b75('0x28')](db[_0x5b75('0x25')]['rawAttributes']);_0x548d5a['query']=_[_0x5b75('0x28')](_0x1aa8c8['query']);_0x548d5a[_0x5b75('0x2b')]=_[_0x5b75('0x2c')](_0x548d5a[_0x5b75('0x26')],_0x548d5a[_0x5b75('0x2a')]);_0x272824[_0x5b75('0x2d')]=_[_0x5b75('0x2c')](_0x548d5a[_0x5b75('0x26')],qs[_0x5b75('0x2e')](_0x1aa8c8[_0x5b75('0x2a')]['fields']));_0x272824[_0x5b75('0x2d')]=_0x272824[_0x5b75('0x2d')][_0x5b75('0x2f')]?_0x272824['attributes']:_0x548d5a[_0x5b75('0x26')];if(_0x1aa8c8[_0x5b75('0x2a')][_0x5b75('0x3a')]){_0x272824['include']=[{'all':!![]}];}_0x272824=_['merge']({},_0x272824,_0x1aa8c8[_0x5b75('0x3f')]);return db[_0x5b75('0x25')][_0x5b75('0x40')](_0x272824)[_0x5b75('0x20')](handleEntityNotFound(_0x10ba9b,null))[_0x5b75('0x20')](respondWithResult(_0x10ba9b,null))[_0x5b75('0x3d')](handleError(_0x10ba9b,null));};exports[_0x5b75('0x41')]=function(_0x5914e7,_0x10390f){return db[_0x5b75('0x25')][_0x5b75('0x41')](_0x5914e7[_0x5b75('0x42')],{})['then'](respondWithResult(_0x10390f,0xc9))[_0x5b75('0x3d')](handleError(_0x10390f,null));};exports['update']=function(_0x3dcd4d,_0x4dbb7d){if(_0x3dcd4d[_0x5b75('0x42')]['id']){delete _0x3dcd4d['body']['id'];}return db['VoiceRecording'][_0x5b75('0x40')]({'where':{'id':_0x3dcd4d['params']['id']}})[_0x5b75('0x20')](handleEntityNotFound(_0x4dbb7d,null))[_0x5b75('0x20')](saveUpdates(_0x3dcd4d['body'],null))['then'](respondWithResult(_0x4dbb7d,null))['catch'](handleError(_0x4dbb7d,null));};exports[_0x5b75('0x43')]=function(_0x584ae3,_0xba7590){return db['VoiceRecording'][_0x5b75('0x40')]({'where':{'id':_0x584ae3['params']['id']}})[_0x5b75('0x20')](handleEntityNotFound(_0xba7590,null))[_0x5b75('0x20')](removeEntity(_0xba7590,null))[_0x5b75('0x3d')](handleError(_0xba7590,null));};exports[_0x5b75('0x44')]=function(_0x2d5775,_0x2bf354){return db['VoiceRecording'][_0x5b75('0x44')]()[_0x5b75('0x20')](respondWithResult(_0x2bf354,null))[_0x5b75('0x3d')](handleError(_0x2bf354,null));};exports['download']=function(_0x364aed,_0x148e83,_0x508cdb){var _0xf8074a=require('../../components/encryptor');var _0x2008b4=![];var _0x340be4={};if(_0x364aed['query'][_0x5b75('0x37')]&&_0x364aed[_0x5b75('0x2a')][_0x5b75('0x37')]===_0x5b75('0x45')){_0x340be4[_0x5b75('0x45')]=_0x364aed[_0x5b75('0x3e')]['id'];}else{_0x340be4['id']=_0x364aed[_0x5b75('0x3e')]['id'];}return db[_0x5b75('0x25')][_0x5b75('0x40')]({'where':_0x340be4,'attributes':['id',_0x5b75('0x46')],'raw':!![]})[_0x5b75('0x20')](handleEntityNotFound(_0x148e83,null))['then'](function(_0x545a8c){if(_0x545a8c){var _0xfa1c95=util['format']('%s.cypher',_0x545a8c['value']);if(fs[_0x5b75('0x47')](_0xfa1c95)){_0x2008b4=!![];return _0xf8074a[_0x5b75('0x48')](_0xfa1c95,_0x545a8c[_0x5b75('0x46')],config['secrets'][_0x5b75('0x49')])[_0x5b75('0x20')](function(){return _0x545a8c;});}return _0x545a8c;}})[_0x5b75('0x20')](function(_0xa8fe85){if(_0xa8fe85){if(!fs['existsSync'](_0xa8fe85[_0x5b75('0x46')])){throw new db['Sequelize'][(_0x5b75('0x4a'))](_0x5b75('0x4b'));}if(_0xa8fe85['filename']){return _0x148e83[_0x5b75('0x4c')](_0xa8fe85['value'],_0xa8fe85[_0x5b75('0x4d')]+path[_0x5b75('0x4e')](_0xa8fe85[_0x5b75('0x46')]),function(){if(_0x2008b4){fs['unlink'](_0xa8fe85[_0x5b75('0x46')]);}});}else{return _0x148e83[_0x5b75('0x4c')](_0xa8fe85[_0x5b75('0x46')],function(_0x5ce939){if(_0x2008b4){fs[_0x5b75('0x4f')](_0xa8fe85[_0x5b75('0x46')]);}});}}})[_0x5b75('0x3d')](handleError(_0x148e83,null));};exports['downloads']=function(_0x511808,_0x18332d,_0x234003){var _0x97b936=require(_0x5b75('0x50'));var _0x95c670=![];var _0x1443b4={'$and':[db[_0x5b75('0x51')]['where'](db[_0x5b75('0x51')]['fn']('MD5',db[_0x5b75('0x51')][_0x5b75('0x52')](_0x5b75('0x45'))),_0x511808[_0x5b75('0x2a')][_0x5b75('0x53')])]};if(_0x511808[_0x5b75('0x2a')][_0x5b75('0x37')]&&_0x511808[_0x5b75('0x2a')][_0x5b75('0x37')]===_0x5b75('0x45')){_0x1443b4['$and'][_0x5b75('0x54')]({'uniqueid':_0x511808[_0x5b75('0x3e')]['id']});}else{_0x1443b4[_0x5b75('0x55')][_0x5b75('0x54')]({'id':_0x511808[_0x5b75('0x3e')]['id']});}return db['VoiceRecording'][_0x5b75('0x40')]({'where':_0x1443b4,'attributes':['id',_0x5b75('0x46')],'raw':!![]})[_0x5b75('0x20')](handleEntityNotFound(_0x18332d,null))['then'](function(_0x16df85){if(_0x16df85){var _0xfa19e1=util[_0x5b75('0x29')]('%s.cypher',_0x16df85[_0x5b75('0x46')]);if(fs[_0x5b75('0x47')](_0xfa19e1)){_0x95c670=!![];return _0x97b936['decryptFile'](_0xfa19e1,_0x16df85['value'],config[_0x5b75('0x56')][_0x5b75('0x49')])[_0x5b75('0x20')](function(){return _0x16df85;});}return _0x16df85;}})['then'](function(_0x3094d5){if(_0x3094d5){if(!fs[_0x5b75('0x47')](_0x3094d5['value'])){throw new db[(_0x5b75('0x57'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x3094d5[_0x5b75('0x4d')]){return _0x18332d[_0x5b75('0x4c')](_0x3094d5[_0x5b75('0x46')],_0x3094d5[_0x5b75('0x4d')]+path[_0x5b75('0x4e')](_0x3094d5[_0x5b75('0x46')]),function(){if(_0x95c670){fs[_0x5b75('0x4f')](_0x3094d5[_0x5b75('0x46')]);}});}else{return _0x18332d[_0x5b75('0x4c')](_0x3094d5[_0x5b75('0x46')],function(_0x26c439){if(_0x95c670){fs[_0x5b75('0x4f')](_0x3094d5[_0x5b75('0x46')]);}});}}})[_0x5b75('0x3d')](handleError(_0x18332d,null));}; \ No newline at end of file +var _0x7d6a=['../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','VoiceRecording','rawAttributes','differenceBy','keys','format','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','map','type','key','VIRTUAL','field','options','findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','download','../../components/encryptor','uniqueid','value','decryptFile','secrets','recording','existsSync','VoiceRecording\x20not\x20found','filename','extname','unlink','sequelize','$and','push','%s.cypher','Sequelize','html-pdf','rimraf','fast-json-patch','request-promise','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x4d2021,_0x17d09c){var _0x59de86=function(_0x4f9eba){while(--_0x4f9eba){_0x4d2021['push'](_0x4d2021['shift']());}};_0x59de86(++_0x17d09c);}(_0x7d6a,0x100));var _0xa7d6=function(_0x1ea0be,_0x238449){_0x1ea0be=_0x1ea0be-0x0;var _0x41994e=_0x7d6a[_0x1ea0be];return _0x41994e;};'use strict';var pdf=require(_0xa7d6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa7d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa7d6('0x2'));var rp=require(_0xa7d6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa7d6('0x4'));var path=require('path');var sox=require(_0xa7d6('0x5'));var csv=require(_0xa7d6('0x6'));var ejs=require(_0xa7d6('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa7d6('0x8'));var crypto=require(_0xa7d6('0x9'));var jsforce=require(_0xa7d6('0xa'));var deskjs=require(_0xa7d6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa7d6('0xc'));var Papa=require('papaparse');var authService=require(_0xa7d6('0xd'));var hardwareService=require(_0xa7d6('0xe'));var Redis=require(_0xa7d6('0xf'));var qs=require('../../components/parsers/qs');var logger=require(_0xa7d6('0x10'))(_0xa7d6('0x11'));var utils=require(_0xa7d6('0x12'));var config=require(_0xa7d6('0x13'));var db=require(_0xa7d6('0x14'))['db'];function respondWithStatusCode(_0x7e78b1,_0x39ada7){_0x39ada7=_0x39ada7||0xcc;return function(_0xb5a197){if(_0xb5a197){return _0x7e78b1[_0xa7d6('0x15')](_0x39ada7);}return _0x7e78b1['status'](_0x39ada7)[_0xa7d6('0x16')]();};}function respondWithResult(_0x1cad6a,_0x21bafe){_0x21bafe=_0x21bafe||0xc8;return function(_0x4d3e67){if(_0x4d3e67){return _0x1cad6a[_0xa7d6('0x17')](_0x21bafe)[_0xa7d6('0x18')](_0x4d3e67);}};}function respondWithFilteredResult(_0x48428b,_0x3f45a9){return function(_0x2ab4bd){if(_0x2ab4bd){var _0x24c547=_0x2ab4bd[_0xa7d6('0x19')],_0x4b5bb2=_0x3f45a9[_0xa7d6('0x1a')],_0x40a64d=_0x3f45a9['offset']+_0x3f45a9['limit'],_0x2227ff;if(_0x40a64d>=_0x24c547){_0x40a64d=_0x24c547;_0x2227ff=0xc8;}else{_0x2227ff=0xce;}_0x48428b['status'](_0x2227ff);return _0x48428b[_0xa7d6('0x1b')](_0xa7d6('0x1c'),_0x4b5bb2+'-'+_0x40a64d+'/'+_0x24c547)['json'](_0x2ab4bd);}return null;};}function patchUpdates(_0x3e0779){return function(_0x4aa391){try{jsonpatch[_0xa7d6('0x1d')](_0x4aa391,_0x3e0779,!![]);}catch(_0xc19677){return BPromise[_0xa7d6('0x1e')](_0xc19677);}return _0x4aa391[_0xa7d6('0x1f')]();};}function saveUpdates(_0x3caa28,_0x5ccb42){return function(_0x5504bf){if(_0x5504bf){return _0x5504bf[_0xa7d6('0x20')](_0x3caa28)[_0xa7d6('0x21')](function(_0x22ff51){return _0x22ff51;});}return null;};}function removeEntity(_0x34ad62,_0xa1421d){return function(_0x39a12a){if(_0x39a12a){return _0x39a12a[_0xa7d6('0x22')]()[_0xa7d6('0x21')](function(){_0x34ad62['status'](0xcc)[_0xa7d6('0x16')]();});}};}function handleEntityNotFound(_0x3dec83,_0x49ab67){return function(_0x482ba2){if(!_0x482ba2){_0x3dec83[_0xa7d6('0x15')](0x194);}return _0x482ba2;};}function handleError(_0x2d0870,_0x43032c){_0x43032c=_0x43032c||0x1f4;return function(_0x14ca41){logger['error'](_0x14ca41[_0xa7d6('0x23')]);if(_0x14ca41[_0xa7d6('0x24')]){delete _0x14ca41[_0xa7d6('0x24')];}_0x2d0870['status'](_0x43032c)[_0xa7d6('0x25')](_0x14ca41);};}exports['index']=function(_0x792bd1,_0x27ab42){var _0x36ddf5={},_0x2e75df={},_0x400844={'count':0x0,'rows':[]};var _0x25af39=db[_0xa7d6('0x26')][_0xa7d6('0x27')];_0x2e75df['model']=_[_0xa7d6('0x28')](_[_0xa7d6('0x29')](_0x25af39),[_0xa7d6('0x2a')]);_0x2e75df[_0xa7d6('0x2b')]=_[_0xa7d6('0x29')](_0x792bd1[_0xa7d6('0x2b')]);_0x2e75df['filters']=_[_0xa7d6('0x2c')](_0x2e75df['model'],_0x2e75df[_0xa7d6('0x2b')]);_0x36ddf5[_0xa7d6('0x2d')]=_[_0xa7d6('0x2c')](_0x2e75df[_0xa7d6('0x2e')],qs[_0xa7d6('0x2f')](_0x792bd1[_0xa7d6('0x2b')]['fields']));_0x36ddf5[_0xa7d6('0x2d')]=_0x36ddf5['attributes']['length']?_0x36ddf5['attributes']:_0x2e75df['model'];if(!_0x792bd1[_0xa7d6('0x2b')][_0xa7d6('0x30')](_0xa7d6('0x31'))){_0x36ddf5[_0xa7d6('0x32')]=qs['limit'](_0x792bd1[_0xa7d6('0x2b')][_0xa7d6('0x32')]);_0x36ddf5['offset']=qs[_0xa7d6('0x1a')](_0x792bd1['query'][_0xa7d6('0x1a')]);}_0x36ddf5[_0xa7d6('0x33')]=qs[_0xa7d6('0x34')](_0x792bd1[_0xa7d6('0x2b')][_0xa7d6('0x34')]);_0x36ddf5[_0xa7d6('0x35')]=qs[_0xa7d6('0x36')](_[_0xa7d6('0x37')](_0x792bd1['query'],_0x2e75df[_0xa7d6('0x36')]));if(_0x792bd1[_0xa7d6('0x2b')][_0xa7d6('0x38')]){_0x36ddf5[_0xa7d6('0x35')]=_[_0xa7d6('0x39')](_0x36ddf5['where'],{'$or':_[_0xa7d6('0x3a')](_0x25af39,function(_0x3bb6c9){if(_0x3bb6c9[_0xa7d6('0x3b')][_0xa7d6('0x3c')]!==_0xa7d6('0x3d')){var _0x5bf7b7={};_0x5bf7b7[_0x3bb6c9[_0xa7d6('0x3e')]]={'$like':'%'+_0x792bd1[_0xa7d6('0x2b')][_0xa7d6('0x38')]+'%'};return _0x5bf7b7;}})});}_0x36ddf5=_[_0xa7d6('0x39')]({},_0x36ddf5,_0x792bd1[_0xa7d6('0x3f')]);var _0x4f74d1={'where':_0x36ddf5['where']};return db[_0xa7d6('0x26')][_0xa7d6('0x19')](_0x4f74d1)[_0xa7d6('0x21')](function(_0x3bf5d5){_0x400844[_0xa7d6('0x19')]=_0x3bf5d5;if(_0x792bd1[_0xa7d6('0x2b')]['includeAll']){_0x36ddf5['include']=[{'all':!![]}];}return db[_0xa7d6('0x26')][_0xa7d6('0x40')](_0x36ddf5);})[_0xa7d6('0x21')](function(_0x6c475f){_0x400844[_0xa7d6('0x41')]=_0x6c475f;return _0x400844;})[_0xa7d6('0x21')](respondWithFilteredResult(_0x27ab42,_0x36ddf5))[_0xa7d6('0x42')](handleError(_0x27ab42,null));};exports[_0xa7d6('0x43')]=function(_0x5e9775,_0x41b962){var _0x5adb36={'raw':![],'where':{'id':_0x5e9775[_0xa7d6('0x44')]['id']}},_0x29e9f0={};_0x29e9f0[_0xa7d6('0x2e')]=_['keys'](db[_0xa7d6('0x26')][_0xa7d6('0x27')]);_0x29e9f0[_0xa7d6('0x2b')]=_[_0xa7d6('0x29')](_0x5e9775[_0xa7d6('0x2b')]);_0x29e9f0[_0xa7d6('0x36')]=_[_0xa7d6('0x2c')](_0x29e9f0['model'],_0x29e9f0[_0xa7d6('0x2b')]);_0x5adb36[_0xa7d6('0x2d')]=_['intersection'](_0x29e9f0[_0xa7d6('0x2e')],qs[_0xa7d6('0x2f')](_0x5e9775[_0xa7d6('0x2b')][_0xa7d6('0x2f')]));_0x5adb36[_0xa7d6('0x2d')]=_0x5adb36[_0xa7d6('0x2d')][_0xa7d6('0x45')]?_0x5adb36[_0xa7d6('0x2d')]:_0x29e9f0[_0xa7d6('0x2e')];if(_0x5e9775[_0xa7d6('0x2b')][_0xa7d6('0x46')]){_0x5adb36['include']=[{'all':!![]}];}_0x5adb36=_[_0xa7d6('0x39')]({},_0x5adb36,_0x5e9775[_0xa7d6('0x3f')]);return db[_0xa7d6('0x26')][_0xa7d6('0x47')](_0x5adb36)[_0xa7d6('0x21')](handleEntityNotFound(_0x41b962,null))[_0xa7d6('0x21')](respondWithResult(_0x41b962,null))[_0xa7d6('0x42')](handleError(_0x41b962,null));};exports[_0xa7d6('0x48')]=function(_0x264344,_0x5b1202){return db[_0xa7d6('0x26')][_0xa7d6('0x48')](_0x264344['body'],{})[_0xa7d6('0x21')](respondWithResult(_0x5b1202,0xc9))[_0xa7d6('0x42')](handleError(_0x5b1202,null));};exports[_0xa7d6('0x20')]=function(_0x1effa9,_0xb8c595){if(_0x1effa9[_0xa7d6('0x49')]['id']){delete _0x1effa9[_0xa7d6('0x49')]['id'];}return db[_0xa7d6('0x26')][_0xa7d6('0x47')]({'where':{'id':_0x1effa9[_0xa7d6('0x44')]['id']}})[_0xa7d6('0x21')](handleEntityNotFound(_0xb8c595,null))[_0xa7d6('0x21')](saveUpdates(_0x1effa9[_0xa7d6('0x49')],null))['then'](respondWithResult(_0xb8c595,null))['catch'](handleError(_0xb8c595,null));};exports[_0xa7d6('0x22')]=function(_0x1e7306,_0xea1955){return db[_0xa7d6('0x26')][_0xa7d6('0x47')]({'where':{'id':_0x1e7306[_0xa7d6('0x44')]['id']}})['then'](handleEntityNotFound(_0xea1955,null))[_0xa7d6('0x21')](removeEntity(_0xea1955,null))[_0xa7d6('0x42')](handleError(_0xea1955,null));};exports['describe']=function(_0x23ac96,_0x485a24){return db[_0xa7d6('0x26')][_0xa7d6('0x4a')]()[_0xa7d6('0x21')](respondWithResult(_0x485a24,null))[_0xa7d6('0x42')](handleError(_0x485a24,null));};exports[_0xa7d6('0x4b')]=function(_0x4d995e,_0x3cabe9,_0x363014){var _0x157191=require(_0xa7d6('0x4c'));var _0x2dd2da=![];var _0x56c115={};if(_0x4d995e[_0xa7d6('0x2b')]['type']&&_0x4d995e[_0xa7d6('0x2b')][_0xa7d6('0x3b')]==='uniqueid'){_0x56c115[_0xa7d6('0x4d')]=_0x4d995e[_0xa7d6('0x44')]['id'];}else{_0x56c115['id']=_0x4d995e[_0xa7d6('0x44')]['id'];}return db[_0xa7d6('0x26')]['find']({'where':_0x56c115,'attributes':['id',_0xa7d6('0x4e')],'raw':!![]})[_0xa7d6('0x21')](handleEntityNotFound(_0x3cabe9,null))[_0xa7d6('0x21')](function(_0x5f4385){if(_0x5f4385){var _0x4a2be3=util[_0xa7d6('0x2a')]('%s.cypher',_0x5f4385[_0xa7d6('0x4e')]);if(fs['existsSync'](_0x4a2be3)){_0x2dd2da=!![];return _0x157191[_0xa7d6('0x4f')](_0x4a2be3,_0x5f4385['value'],config[_0xa7d6('0x50')][_0xa7d6('0x51')])[_0xa7d6('0x21')](function(){return _0x5f4385;});}return _0x5f4385;}})[_0xa7d6('0x21')](function(_0x1c727a){if(_0x1c727a){if(!fs[_0xa7d6('0x52')](_0x1c727a['value'])){throw new db['Sequelize']['ValidationError'](_0xa7d6('0x53'));}if(_0x1c727a[_0xa7d6('0x54')]){return _0x3cabe9['download'](_0x1c727a[_0xa7d6('0x4e')],_0x1c727a[_0xa7d6('0x54')]+path[_0xa7d6('0x55')](_0x1c727a[_0xa7d6('0x4e')]),function(){if(_0x2dd2da){fs[_0xa7d6('0x56')](_0x1c727a[_0xa7d6('0x4e')]);}});}else{return _0x3cabe9[_0xa7d6('0x4b')](_0x1c727a[_0xa7d6('0x4e')],function(_0x8f157b){if(_0x2dd2da){fs['unlink'](_0x1c727a[_0xa7d6('0x4e')]);}});}}})['catch'](handleError(_0x3cabe9,null));};exports['downloads']=function(_0x143cdc,_0x50d7d6,_0x29965b){var _0x2581d3=require(_0xa7d6('0x4c'));var _0x5aa2f4=![];var _0x33de8f={'$and':[db[_0xa7d6('0x57')][_0xa7d6('0x35')](db[_0xa7d6('0x57')]['fn']('MD5',db[_0xa7d6('0x57')]['col']('uniqueid')),_0x143cdc[_0xa7d6('0x2b')]['token'])]};if(_0x143cdc[_0xa7d6('0x2b')][_0xa7d6('0x3b')]&&_0x143cdc[_0xa7d6('0x2b')][_0xa7d6('0x3b')]===_0xa7d6('0x4d')){_0x33de8f[_0xa7d6('0x58')][_0xa7d6('0x59')]({'uniqueid':_0x143cdc[_0xa7d6('0x44')]['id']});}else{_0x33de8f[_0xa7d6('0x58')][_0xa7d6('0x59')]({'id':_0x143cdc[_0xa7d6('0x44')]['id']});}return db[_0xa7d6('0x26')][_0xa7d6('0x47')]({'where':_0x33de8f,'attributes':['id',_0xa7d6('0x4e')],'raw':!![]})[_0xa7d6('0x21')](handleEntityNotFound(_0x50d7d6,null))[_0xa7d6('0x21')](function(_0x7baeb1){if(_0x7baeb1){var _0x3e43e9=util[_0xa7d6('0x2a')](_0xa7d6('0x5a'),_0x7baeb1[_0xa7d6('0x4e')]);if(fs[_0xa7d6('0x52')](_0x3e43e9)){_0x5aa2f4=!![];return _0x2581d3[_0xa7d6('0x4f')](_0x3e43e9,_0x7baeb1['value'],config[_0xa7d6('0x50')][_0xa7d6('0x51')])[_0xa7d6('0x21')](function(){return _0x7baeb1;});}return _0x7baeb1;}})[_0xa7d6('0x21')](function(_0x19c633){if(_0x19c633){if(!fs[_0xa7d6('0x52')](_0x19c633['value'])){throw new db[(_0xa7d6('0x5b'))]['ValidationError'](_0xa7d6('0x53'));}if(_0x19c633['filename']){return _0x50d7d6[_0xa7d6('0x4b')](_0x19c633[_0xa7d6('0x4e')],_0x19c633[_0xa7d6('0x54')]+path[_0xa7d6('0x55')](_0x19c633['value']),function(){if(_0x5aa2f4){fs[_0xa7d6('0x56')](_0x19c633['value']);}});}else{return _0x50d7d6[_0xa7d6('0x4b')](_0x19c633[_0xa7d6('0x4e')],function(_0x4638a3){if(_0x5aa2f4){fs[_0xa7d6('0x56')](_0x19c633[_0xa7d6('0x4e')]);}});}}})[_0xa7d6('0x42')](handleError(_0x50d7d6,null));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index cd0ec1e..e0a86c9 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 _0x053e=['../../config/logger','api','bluebird','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x3a2562,_0x2acdef){var _0x59eb58=function(_0x1b5e69){while(--_0x1b5e69){_0x3a2562['push'](_0x3a2562['shift']());}};_0x59eb58(++_0x2acdef);}(_0x053e,0x129));var _0xe053=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x053e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe053('0x0'))(_0xe053('0x1'));var moment=require('moment');var BPromise=require(_0xe053('0x2'));var rp=require('request-promise');var attributes=require(_0xe053('0x3'));module[_0xe053('0x4')]=function(_0x1542fc,_0x4e0386){return _0x1542fc[_0xe053('0x5')](_0xe053('0x6'),attributes,{'tableName':_0xe053('0x7'),'paranoid':![],'indexes':[{'name':_0xe053('0x8'),'fields':[_0xe053('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7c3b=['lodash','util','api','moment','bluebird','request-promise','./voiceRecording.attributes','exports','define','voice_recordings','uniqueid'];(function(_0xf12f64,_0x58fdf4){var _0x1dfe6a=function(_0x37aa66){while(--_0x37aa66){_0xf12f64['push'](_0xf12f64['shift']());}};_0x1dfe6a(++_0x58fdf4);}(_0x7c3b,0x1ef));var _0xb7c3=function(_0x3a21d5,_0x19501a){_0x3a21d5=_0x3a21d5-0x0;var _0x276fd9=_0x7c3b[_0x3a21d5];return _0x276fd9;};'use strict';var _=require(_0xb7c3('0x0'));var util=require(_0xb7c3('0x1'));var logger=require('../../config/logger')(_0xb7c3('0x2'));var moment=require(_0xb7c3('0x3'));var BPromise=require(_0xb7c3('0x4'));var rp=require(_0xb7c3('0x5'));var attributes=require(_0xb7c3('0x6'));module[_0xb7c3('0x7')]=function(_0x914cc9,_0x2d886e){return _0x914cc9[_0xb7c3('0x8')]('VoiceRecording',attributes,{'tableName':_0xb7c3('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb7c3('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 fb2b534..2aa5441 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 _0x05f6=['http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','%s.cypher','value','encryptFile','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x05f6,0x9e));var _0x605f=function(_0x29037e,_0x3428bc){_0x29037e=_0x29037e-0x0;var _0x528dcc=_0x05f6[_0x29037e];return _0x528dcc;};'use strict';var _=require('lodash');var util=require(_0x605f('0x0'));var moment=require(_0x605f('0x1'));var BPromise=require(_0x605f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x605f('0x3'));var db=require(_0x605f('0x4'))['db'];var utils=require(_0x605f('0x5'));var logger=require(_0x605f('0x6'))(_0x605f('0x7'));var config=require(_0x605f('0x8'));var jayson=require(_0x605f('0x9'));var client=jayson['client'][_0x605f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28b96b,_0x33b0eb,_0x836805){return new BPromise(function(_0x231fc0,_0x30db34){return client[_0x605f('0xb')](_0x28b96b,_0x836805)[_0x605f('0xc')](function(_0x239e84){logger[_0x605f('0xd')](_0x605f('0xe'),_0x33b0eb,_0x605f('0xf'));logger[_0x605f('0x10')](_0x605f('0x11'),_0x33b0eb,_0x605f('0xf'),JSON[_0x605f('0x12')](_0x239e84));if(_0x239e84[_0x605f('0x13')]){if(_0x239e84['error'][_0x605f('0x14')]===0x1f4){logger[_0x605f('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x33b0eb,_0x239e84[_0x605f('0x13')]['message']);return _0x30db34(_0x239e84['error']['message']);}logger['error'](_0x605f('0xe'),_0x33b0eb,_0x239e84['error'][_0x605f('0x15')]);return _0x231fc0(_0x239e84['error'][_0x605f('0x15')]);}else{logger[_0x605f('0xd')](_0x605f('0xe'),_0x33b0eb,_0x605f('0xf'));_0x231fc0(_0x239e84['result'][_0x605f('0x15')]);}})[_0x605f('0x16')](function(_0x39f748){logger[_0x605f('0x13')](_0x605f('0xe'),_0x33b0eb,_0x39f748);_0x30db34(_0x39f748);});});}exports[_0x605f('0x17')]=function(_0x529a60){var _0x2aab35=this;return new Promise(function(_0x62bb3e,_0x43b090){return db[_0x605f('0x18')][_0x605f('0x19')](_0x529a60[_0x605f('0x1a')],{'raw':_0x529a60[_0x605f('0x1b')]?_0x529a60['options'][_0x605f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529a60['options']?_0x529a60[_0x605f('0x1b')][_0x605f('0x1d')]||null:null,'attributes':_0x529a60[_0x605f('0x1b')]?_0x529a60['options'][_0x605f('0x1e')]||null:null,'limit':_0x529a60['options']?_0x529a60[_0x605f('0x1b')]['limit']||null:null})[_0x605f('0xc')](function(_0x17d6b5){logger['info'](_0x605f('0x17'),_0x529a60);logger[_0x605f('0x10')](_0x605f('0x17'),_0x529a60,JSON[_0x605f('0x12')](_0x17d6b5));_0x62bb3e(_0x17d6b5);})[_0x605f('0x16')](function(_0xa9f7e5){logger['error']('UpdateVoiceRecording',_0xa9f7e5[_0x605f('0x15')],_0x529a60);_0x43b090(_0x2aab35[_0x605f('0x13')](0x1f4,_0xa9f7e5[_0x605f('0x15')]));});});};exports['CreateVoiceRecording']=function(_0x59a368){var _0x589367=this;return new Promise(function(_0x755a96,_0x2d417e){var _0x3c6d96=require(_0x605f('0x1f'));var _0x3e70bb;return db[_0x605f('0x20')][_0x605f('0x21')]({'attributes':['id',_0x605f('0x22')],'where':{'id':0x1},'raw':!![]})[_0x605f('0xc')](function(_0x423ddf){_0x3e70bb=_0x423ddf;return db['VoiceRecording'][_0x605f('0x23')](_0x59a368['body']);})[_0x605f('0xc')](function(_0x33f966){if(_0x3e70bb['callRecordingEncryption']&&fs[_0x605f('0x24')](_0x33f966['value'])){var _0x103fd4=util['format'](_0x605f('0x25'),_0x33f966[_0x605f('0x26')]);return _0x3c6d96[_0x605f('0x27')](_0x33f966[_0x605f('0x26')],_0x103fd4,config['secrets']['recording'])[_0x605f('0xc')](function(){fs['unlink'](_0x33f966[_0x605f('0x26')]);logger[_0x605f('0xd')](_0x605f('0x28'));return _0x33f966;});}return _0x33f966;})[_0x605f('0xc')](function(_0x909d3b){logger['info'](_0x605f('0x29'),_0x59a368);logger[_0x605f('0x10')]('CreateVoiceRecording',_0x59a368,JSON[_0x605f('0x12')](_0x909d3b));_0x755a96(_0x909d3b);})[_0x605f('0x16')](function(_0x58558a){logger[_0x605f('0x13')](_0x605f('0x29'),_0x58558a['message'],_0x59a368);_0x2d417e(_0x589367[_0x605f('0x13')](0x1f4,_0x58558a[_0x605f('0x15')]));});});}; \ No newline at end of file +var _0x5698=['message','info','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','where','attributes','limit','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','value','format','%s.cypher','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','VoiceRecording,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x5adf1f,_0x215247){var _0x5c895a=function(_0x37a45f){while(--_0x37a45f){_0x5adf1f['push'](_0x5adf1f['shift']());}};_0x5c895a(++_0x215247);}(_0x5698,0x6c));var _0x8569=function(_0x184e69,_0x39af04){_0x184e69=_0x184e69-0x0;var _0x57d8ad=_0x5698[_0x184e69];return _0x57d8ad;};'use strict';var _=require(_0x8569('0x0'));var util=require(_0x8569('0x1'));var moment=require(_0x8569('0x2'));var BPromise=require('bluebird');var rs=require(_0x8569('0x3'));var fs=require('fs');var Redis=require(_0x8569('0x4'));var db=require(_0x8569('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8569('0x6'))('rpc');var config=require(_0x8569('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8569('0x8')][_0x8569('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b74b6,_0x1462fe,_0x16baa6){return new BPromise(function(_0x37bde5,_0x25b419){return client[_0x8569('0xa')](_0x3b74b6,_0x16baa6)[_0x8569('0xb')](function(_0x5c09f1){logger['info'](_0x8569('0xc'),_0x1462fe,'request\x20sent');logger[_0x8569('0xd')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x1462fe,_0x8569('0xe'),JSON[_0x8569('0xf')](_0x5c09f1));if(_0x5c09f1[_0x8569('0x10')]){if(_0x5c09f1['error'][_0x8569('0x11')]===0x1f4){logger[_0x8569('0x10')](_0x8569('0xc'),_0x1462fe,_0x5c09f1[_0x8569('0x10')][_0x8569('0x12')]);return _0x25b419(_0x5c09f1['error'][_0x8569('0x12')]);}logger['error'](_0x8569('0xc'),_0x1462fe,_0x5c09f1[_0x8569('0x10')][_0x8569('0x12')]);return _0x37bde5(_0x5c09f1[_0x8569('0x10')][_0x8569('0x12')]);}else{logger[_0x8569('0x13')](_0x8569('0xc'),_0x1462fe,_0x8569('0xe'));_0x37bde5(_0x5c09f1[_0x8569('0x14')][_0x8569('0x12')]);}})[_0x8569('0x15')](function(_0x924ffc){logger[_0x8569('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x1462fe,_0x924ffc);_0x25b419(_0x924ffc);});});}exports[_0x8569('0x16')]=function(_0x4e31e9){var _0x1d8a2f=this;return new Promise(function(_0x1ae442,_0x19cefe){return db[_0x8569('0x17')]['update'](_0x4e31e9[_0x8569('0x18')],{'raw':_0x4e31e9[_0x8569('0x19')]?_0x4e31e9['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e31e9[_0x8569('0x19')]?_0x4e31e9['options'][_0x8569('0x1a')]||null:null,'attributes':_0x4e31e9['options']?_0x4e31e9[_0x8569('0x19')][_0x8569('0x1b')]||null:null,'limit':_0x4e31e9[_0x8569('0x19')]?_0x4e31e9[_0x8569('0x19')][_0x8569('0x1c')]||null:null})[_0x8569('0xb')](function(_0x382cca){logger['info'](_0x8569('0x16'),_0x4e31e9);logger[_0x8569('0xd')](_0x8569('0x16'),_0x4e31e9,JSON[_0x8569('0xf')](_0x382cca));_0x1ae442(_0x382cca);})['catch'](function(_0x5a714d){logger[_0x8569('0x10')]('UpdateVoiceRecording',_0x5a714d['message'],_0x4e31e9);_0x19cefe(_0x1d8a2f['error'](0x1f4,_0x5a714d[_0x8569('0x12')]));});});};exports['CreateVoiceRecording']=function(_0x439931){var _0x414583=this;return new Promise(function(_0x39c4ec,_0x3a2e10){var _0x4af615=require(_0x8569('0x1d'));var _0x3093f6;return db[_0x8569('0x1e')][_0x8569('0x1f')]({'attributes':['id',_0x8569('0x20')],'where':{'id':0x1},'raw':!![]})[_0x8569('0xb')](function(_0x39a4ba){_0x3093f6=_0x39a4ba;return db[_0x8569('0x17')][_0x8569('0x21')](_0x439931[_0x8569('0x18')]);})[_0x8569('0xb')](function(_0x328750){if(_0x3093f6[_0x8569('0x20')]&&fs['existsSync'](_0x328750[_0x8569('0x22')])){var _0x50279d=util[_0x8569('0x23')](_0x8569('0x24'),_0x328750[_0x8569('0x22')]);return _0x4af615['encryptFile'](_0x328750['value'],_0x50279d,config[_0x8569('0x25')][_0x8569('0x26')])[_0x8569('0xb')](function(){fs[_0x8569('0x27')](_0x328750[_0x8569('0x22')]);logger['info'](_0x8569('0x28'));return _0x328750;});}return _0x328750;})[_0x8569('0xb')](function(_0x2bae3d){logger[_0x8569('0x13')](_0x8569('0x29'),_0x439931);logger[_0x8569('0xd')](_0x8569('0x29'),_0x439931,JSON['stringify'](_0x2bae3d));_0x39c4ec(_0x2bae3d);})['catch'](function(_0x23c7d3){logger[_0x8569('0x10')](_0x8569('0x29'),_0x23c7d3[_0x8569('0x12')],_0x439931);_0x3a2e10(_0x414583[_0x8569('0x10')](0x1f4,_0x23c7d3[_0x8569('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 6865a06..94477cc 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 _0xfa6e=['update','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x27625a,_0x10c778){var _0x481f91=function(_0x351f84){while(--_0x351f84){_0x27625a['push'](_0x27625a['shift']());}};_0x481f91(++_0x10c778);}(_0xfa6e,0x158));var _0xefa6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfa6e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xefa6('0x0'));var path=require(_0xefa6('0x1'));var timeout=require(_0xefa6('0x2'));var express=require('express');var router=express[_0xefa6('0x3')]();var auth=require(_0xefa6('0x4'));var interaction=require(_0xefa6('0x5'));var config=require(_0xefa6('0x6'));var controller=require(_0xefa6('0x7'));router[_0xefa6('0x8')]('/',auth[_0xefa6('0x9')](),controller[_0xefa6('0xa')]);router[_0xefa6('0x8')](_0xefa6('0xb'),auth['isAuthenticated'](),controller[_0xefa6('0xc')]);router[_0xefa6('0xd')]('/',auth[_0xefa6('0x9')](),controller[_0xefa6('0xe')]);router[_0xefa6('0xf')](_0xefa6('0xb'),auth[_0xefa6('0x9')](),controller[_0xefa6('0x10')]);router['delete'](_0xefa6('0xb'),auth[_0xefa6('0x9')](),controller[_0xefa6('0x11')]);module['exports']=router; \ No newline at end of file +var _0xfb65=['isAuthenticated','index','/:id','post','create','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get'];(function(_0x103fe5,_0x523877){var _0x4a3025=function(_0x27cbfe){while(--_0x27cbfe){_0x103fe5['push'](_0x103fe5['shift']());}};_0x4a3025(++_0x523877);}(_0xfb65,0xb7));var _0x5fb6=function(_0x9097bc,_0x348605){_0x9097bc=_0x9097bc-0x0;var _0x5af24a=_0xfb65[_0x9097bc];return _0x5af24a;};'use strict';var multer=require(_0x5fb6('0x0'));var util=require(_0x5fb6('0x1'));var path=require(_0x5fb6('0x2'));var timeout=require(_0x5fb6('0x3'));var express=require('express');var router=express[_0x5fb6('0x4')]();var auth=require(_0x5fb6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5fb6('0x6'));var controller=require(_0x5fb6('0x7'));router[_0x5fb6('0x8')]('/',auth[_0x5fb6('0x9')](),controller[_0x5fb6('0xa')]);router[_0x5fb6('0x8')](_0x5fb6('0xb'),auth[_0x5fb6('0x9')](),controller['show']);router[_0x5fb6('0xc')]('/',auth['isAuthenticated'](),controller[_0x5fb6('0xd')]);router['put'](_0x5fb6('0xb'),auth[_0x5fb6('0x9')](),controller['update']);router['delete'](_0x5fb6('0xb'),auth['isAuthenticated'](),controller[_0x5fb6('0xe')]);module[_0x5fb6('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 dd54d97..ab8bd96 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 _0x37e6=['Yes','moment','ENUM','blind','attended','STRING'];(function(_0x532dbd,_0x2f440c){var _0x157706=function(_0x3b8c73){while(--_0x3b8c73){_0x532dbd['push'](_0x532dbd['shift']());}};_0x157706(++_0x2f440c);}(_0x37e6,0x115));var _0x637e=function(_0x194440,_0x18d048){_0x194440=_0x194440-0x0;var _0x4a3676=_0x37e6[_0x194440];return _0x4a3676;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x637e('0x0'));module['exports']={'type':{'type':Sequelize[_0x637e('0x1')](_0x637e('0x2'),_0x637e('0x3'))},'result':{'type':Sequelize[_0x637e('0x4')]},'transfererchannel':{'type':Sequelize[_0x637e('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x637e('0x4')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x637e('0x4')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x637e('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x637e('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x637e('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x637e('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x637e('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x637e('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x637e('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x637e('0x4')]},'transfereecontext':{'type':Sequelize[_0x637e('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x637e('0x4')]},'isexternal':{'type':Sequelize['ENUM'](_0x637e('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x30a5=['sequelize','moment','exports','ENUM','blind','STRING','Yes'];(function(_0x4f7bb8,_0x3c93a8){var _0x2f98b8=function(_0x28fc6a){while(--_0x28fc6a){_0x4f7bb8['push'](_0x4f7bb8['shift']());}};_0x2f98b8(++_0x3c93a8);}(_0x30a5,0x181));var _0x530a=function(_0x2e2857,_0x2c8066){_0x2e2857=_0x2e2857-0x0;var _0x294569=_0x30a5[_0x2e2857];return _0x294569;};'use strict';var Sequelize=require(_0x530a('0x0'));var moment=require(_0x530a('0x1'));module[_0x530a('0x2')]={'type':{'type':Sequelize[_0x530a('0x3')](_0x530a('0x4'),'attended')},'result':{'type':Sequelize[_0x530a('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x530a('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x530a('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x530a('0x5')]},'transferercontext':{'type':Sequelize[_0x530a('0x5')]},'transfererexten':{'type':Sequelize[_0x530a('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x530a('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x530a('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x530a('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x530a('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x530a('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x530a('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x530a('0x5')]},'isexternal':{'type':Sequelize[_0x530a('0x3')](_0x530a('0x6'),'No')},'context':{'type':Sequelize[_0x530a('0x5')]},'extension':{'type':Sequelize[_0x530a('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 4b77d81..c18394f 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 _0x844d=['params','find','body','html-pdf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','destroy','end','error','stack','name','send','index','VoiceTransferReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','map','type','VIRTUAL','field','merge','options','includeAll','include','findAll','then','catch','show'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x844d,0x1df));var _0xd844=function(_0x569caa,_0x5174ce){_0x569caa=_0x569caa-0x0;var _0x44cb5a=_0x844d[_0x569caa];return _0x44cb5a;};'use strict';var pdf=require(_0xd844('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd844('0x1'));var jsonpatch=require(_0xd844('0x2'));var rp=require(_0xd844('0x3'));var moment=require(_0xd844('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd844('0x5'));var path=require('path');var sox=require(_0xd844('0x6'));var csv=require(_0xd844('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd844('0x8'));var squel=require(_0xd844('0x9'));var crypto=require('crypto');var jsforce=require(_0xd844('0xa'));var deskjs=require(_0xd844('0xb'));var toCsv=require(_0xd844('0x7'));var querystring=require(_0xd844('0xc'));var Papa=require(_0xd844('0xd'));var authService=require(_0xd844('0xe'));var hardwareService=require(_0xd844('0xf'));var Redis=require(_0xd844('0x10'));var qs=require('../../components/parsers/qs');var logger=require(_0xd844('0x11'))(_0xd844('0x12'));var utils=require(_0xd844('0x13'));var config=require(_0xd844('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b3ecc,_0x11a1d6){_0x11a1d6=_0x11a1d6||0xcc;return function(_0x25b845){if(_0x25b845){return _0x4b3ecc[_0xd844('0x15')](_0x11a1d6);}return _0x4b3ecc['status'](_0x11a1d6)['end']();};}function respondWithResult(_0x4ca328,_0x4588ee){_0x4588ee=_0x4588ee||0xc8;return function(_0x5d235b){if(_0x5d235b){return _0x4ca328[_0xd844('0x16')](_0x4588ee)[_0xd844('0x17')](_0x5d235b);}};}function respondWithFilteredResult(_0x1a8732,_0x566bdd){return function(_0x24c41b){if(_0x24c41b){var _0x60355b=_0x24c41b[_0xd844('0x18')],_0x6e060b=_0x566bdd[_0xd844('0x19')],_0x4eb076=_0x566bdd[_0xd844('0x19')]+_0x566bdd[_0xd844('0x1a')],_0x390572;if(_0x4eb076>=_0x60355b){_0x4eb076=_0x60355b;_0x390572=0xc8;}else{_0x390572=0xce;}_0x1a8732['status'](_0x390572);return _0x1a8732[_0xd844('0x1b')](_0xd844('0x1c'),_0x6e060b+'-'+_0x4eb076+'/'+_0x60355b)['json'](_0x24c41b);}return null;};}function patchUpdates(_0x10131a){return function(_0x2caa6b){try{jsonpatch[_0xd844('0x1d')](_0x2caa6b,_0x10131a,!![]);}catch(_0x111d91){return BPromise['reject'](_0x111d91);}return _0x2caa6b['save']();};}function saveUpdates(_0x11fcf8,_0x3ce0b3){return function(_0x55fd3b){if(_0x55fd3b){return _0x55fd3b[_0xd844('0x1e')](_0x11fcf8)['then'](function(_0x577e82){return _0x577e82;});}return null;};}function removeEntity(_0x3ab746,_0x243b30){return function(_0x586545){if(_0x586545){return _0x586545[_0xd844('0x1f')]()['then'](function(){_0x3ab746[_0xd844('0x16')](0xcc)[_0xd844('0x20')]();});}};}function handleEntityNotFound(_0x5e36a0,_0x26ac8f){return function(_0x3e7c21){if(!_0x3e7c21){_0x5e36a0['sendStatus'](0x194);}return _0x3e7c21;};}function handleError(_0x2fea0b,_0x507f3d){_0x507f3d=_0x507f3d||0x1f4;return function(_0x4e97b6){logger[_0xd844('0x21')](_0x4e97b6[_0xd844('0x22')]);if(_0x4e97b6['name']){delete _0x4e97b6[_0xd844('0x23')];}_0x2fea0b[_0xd844('0x16')](_0x507f3d)[_0xd844('0x24')](_0x4e97b6);};}exports[_0xd844('0x25')]=function(_0x40dc79,_0x1bc5af){var _0x45a266={},_0x2807ee={},_0x24eea4={'count':0x0,'rows':[]};var _0x193987=db[_0xd844('0x26')][_0xd844('0x27')];_0x2807ee[_0xd844('0x28')]=_[_0xd844('0x29')](_0x193987);_0x2807ee[_0xd844('0x2a')]=_[_0xd844('0x29')](_0x40dc79[_0xd844('0x2a')]);_0x2807ee[_0xd844('0x2b')]=_[_0xd844('0x2c')](_0x2807ee[_0xd844('0x28')],_0x2807ee[_0xd844('0x2a')]);_0x45a266[_0xd844('0x2d')]=_[_0xd844('0x2c')](_0x2807ee['model'],qs[_0xd844('0x2e')](_0x40dc79[_0xd844('0x2a')]['fields']));_0x45a266[_0xd844('0x2d')]=_0x45a266[_0xd844('0x2d')][_0xd844('0x2f')]?_0x45a266['attributes']:_0x2807ee[_0xd844('0x28')];if(!_0x40dc79[_0xd844('0x2a')][_0xd844('0x30')](_0xd844('0x31'))){_0x45a266[_0xd844('0x1a')]=qs[_0xd844('0x1a')](_0x40dc79[_0xd844('0x2a')][_0xd844('0x1a')]);_0x45a266[_0xd844('0x19')]=qs[_0xd844('0x19')](_0x40dc79[_0xd844('0x2a')][_0xd844('0x19')]);}_0x45a266['order']=qs['sort'](_0x40dc79[_0xd844('0x2a')][_0xd844('0x32')]);_0x45a266[_0xd844('0x33')]=qs[_0xd844('0x2b')](_[_0xd844('0x34')](_0x40dc79['query'],_0x2807ee['filters']));if(_0x40dc79['query']['filter']){_0x45a266['where']=_['merge'](_0x45a266[_0xd844('0x33')],{'$or':_[_0xd844('0x35')](_0x193987,function(_0x4e89d0){if(_0x4e89d0[_0xd844('0x36')]['key']!==_0xd844('0x37')){var _0xd05c05={};_0xd05c05[_0x4e89d0[_0xd844('0x38')]]={'$like':'%'+_0x40dc79['query']['filter']+'%'};return _0xd05c05;}})});}_0x45a266=_[_0xd844('0x39')]({},_0x45a266,_0x40dc79[_0xd844('0x3a')]);var _0x34126a={'where':_0x45a266['where']};return db[_0xd844('0x26')][_0xd844('0x18')](_0x34126a)['then'](function(_0x5209a9){_0x24eea4['count']=_0x5209a9;if(_0x40dc79[_0xd844('0x2a')][_0xd844('0x3b')]){_0x45a266[_0xd844('0x3c')]=[{'all':!![]}];}return db[_0xd844('0x26')][_0xd844('0x3d')](_0x45a266);})['then'](function(_0x42d6d1){_0x24eea4['rows']=_0x42d6d1;return _0x24eea4;})[_0xd844('0x3e')](respondWithFilteredResult(_0x1bc5af,_0x45a266))[_0xd844('0x3f')](handleError(_0x1bc5af,null));};exports[_0xd844('0x40')]=function(_0x21814c,_0x26e4be){var _0x58c905={'raw':!![],'where':{'id':_0x21814c[_0xd844('0x41')]['id']}},_0x2351a0={};_0x2351a0[_0xd844('0x28')]=_[_0xd844('0x29')](db[_0xd844('0x26')]['rawAttributes']);_0x2351a0['query']=_[_0xd844('0x29')](_0x21814c[_0xd844('0x2a')]);_0x2351a0[_0xd844('0x2b')]=_[_0xd844('0x2c')](_0x2351a0['model'],_0x2351a0[_0xd844('0x2a')]);_0x58c905[_0xd844('0x2d')]=_[_0xd844('0x2c')](_0x2351a0[_0xd844('0x28')],qs[_0xd844('0x2e')](_0x21814c[_0xd844('0x2a')][_0xd844('0x2e')]));_0x58c905[_0xd844('0x2d')]=_0x58c905[_0xd844('0x2d')][_0xd844('0x2f')]?_0x58c905[_0xd844('0x2d')]:_0x2351a0[_0xd844('0x28')];if(_0x21814c[_0xd844('0x2a')][_0xd844('0x3b')]){_0x58c905['include']=[{'all':!![]}];}_0x58c905=_[_0xd844('0x39')]({},_0x58c905,_0x21814c['options']);return db['VoiceTransferReport'][_0xd844('0x42')](_0x58c905)[_0xd844('0x3e')](handleEntityNotFound(_0x26e4be,null))['then'](respondWithResult(_0x26e4be,null))[_0xd844('0x3f')](handleError(_0x26e4be,null));};exports['create']=function(_0x122831,_0x59111f){return db[_0xd844('0x26')]['create'](_0x122831['body'],{})[_0xd844('0x3e')](respondWithResult(_0x59111f,0xc9))[_0xd844('0x3f')](handleError(_0x59111f,null));};exports['update']=function(_0xce3235,_0x995f23){if(_0xce3235[_0xd844('0x43')]['id']){delete _0xce3235[_0xd844('0x43')]['id'];}return db['VoiceTransferReport'][_0xd844('0x42')]({'where':{'id':_0xce3235[_0xd844('0x41')]['id']}})[_0xd844('0x3e')](handleEntityNotFound(_0x995f23,null))['then'](saveUpdates(_0xce3235['body'],null))[_0xd844('0x3e')](respondWithResult(_0x995f23,null))[_0xd844('0x3f')](handleError(_0x995f23,null));};exports[_0xd844('0x1f')]=function(_0xf0edc0,_0x20ab8c){return db[_0xd844('0x26')][_0xd844('0x42')]({'where':{'id':_0xf0edc0[_0xd844('0x41')]['id']}})[_0xd844('0x3e')](handleEntityNotFound(_0x20ab8c,null))[_0xd844('0x3e')](removeEntity(_0x20ab8c,null))[_0xd844('0x3f')](handleError(_0x20ab8c,null));}; \ No newline at end of file +var _0x7eea=['../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','then','destroy','error','stack','name','index','rawAttributes','keys','query','filters','intersection','model','attributes','length','order','sort','pick','filter','where','merge','map','type','key','field','VoiceTransferReport','includeAll','include','rows','catch','show','fields','find','create','body','update','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/auth/service'];(function(_0x131103,_0x35e5fa){var _0x768dee=function(_0x249364){while(--_0x249364){_0x131103['push'](_0x131103['shift']());}};_0x768dee(++_0x35e5fa);}(_0x7eea,0x7e));var _0xa7ee=function(_0x24ef6f,_0x27946c){_0x24ef6f=_0x24ef6f-0x0;var _0x4cc959=_0x7eea[_0x24ef6f];return _0x4cc959;};'use strict';var pdf=require(_0xa7ee('0x0'));var emlformat=require(_0xa7ee('0x1'));var rimraf=require(_0xa7ee('0x2'));var zipdir=require(_0xa7ee('0x3'));var jsonpatch=require(_0xa7ee('0x4'));var rp=require(_0xa7ee('0x5'));var moment=require(_0xa7ee('0x6'));var BPromise=require(_0xa7ee('0x7'));var Mustache=require(_0xa7ee('0x8'));var util=require(_0xa7ee('0x9'));var path=require(_0xa7ee('0xa'));var sox=require('sox');var csv=require(_0xa7ee('0xb'));var ejs=require(_0xa7ee('0xc'));var fs=require('fs');var _=require(_0xa7ee('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa7ee('0xe'));var deskjs=require(_0xa7ee('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa7ee('0x10'));var Papa=require('papaparse');var authService=require(_0xa7ee('0x11'));var hardwareService=require(_0xa7ee('0x12'));var Redis=require(_0xa7ee('0x13'));var qs=require(_0xa7ee('0x14'));var logger=require(_0xa7ee('0x15'))(_0xa7ee('0x16'));var utils=require(_0xa7ee('0x17'));var config=require(_0xa7ee('0x18'));var db=require(_0xa7ee('0x19'))['db'];function respondWithStatusCode(_0x1a964e,_0x5906e5){_0x5906e5=_0x5906e5||0xcc;return function(_0x57eced){if(_0x57eced){return _0x1a964e[_0xa7ee('0x1a')](_0x5906e5);}return _0x1a964e[_0xa7ee('0x1b')](_0x5906e5)[_0xa7ee('0x1c')]();};}function respondWithResult(_0x386877,_0x252494){_0x252494=_0x252494||0xc8;return function(_0x360978){if(_0x360978){return _0x386877['status'](_0x252494)[_0xa7ee('0x1d')](_0x360978);}};}function respondWithFilteredResult(_0x282a1d,_0x3f3c2c){return function(_0x35965d){if(_0x35965d){var _0x51dcf8=_0x35965d[_0xa7ee('0x1e')],_0x18f35e=_0x3f3c2c['offset'],_0x4c72c7=_0x3f3c2c[_0xa7ee('0x1f')]+_0x3f3c2c[_0xa7ee('0x20')],_0xf85314;if(_0x4c72c7>=_0x51dcf8){_0x4c72c7=_0x51dcf8;_0xf85314=0xc8;}else{_0xf85314=0xce;}_0x282a1d[_0xa7ee('0x1b')](_0xf85314);return _0x282a1d[_0xa7ee('0x21')](_0xa7ee('0x22'),_0x18f35e+'-'+_0x4c72c7+'/'+_0x51dcf8)[_0xa7ee('0x1d')](_0x35965d);}return null;};}function patchUpdates(_0x2e7f72){return function(_0x4f4003){try{jsonpatch['apply'](_0x4f4003,_0x2e7f72,!![]);}catch(_0x2a354e){return BPromise['reject'](_0x2a354e);}return _0x4f4003[_0xa7ee('0x23')]();};}function saveUpdates(_0x5bd4bd,_0x46829b){return function(_0x2486ef){if(_0x2486ef){return _0x2486ef['update'](_0x5bd4bd)[_0xa7ee('0x24')](function(_0x38209a){return _0x38209a;});}return null;};}function removeEntity(_0x40b7ae,_0x1489d5){return function(_0x370de4){if(_0x370de4){return _0x370de4[_0xa7ee('0x25')]()[_0xa7ee('0x24')](function(){_0x40b7ae['status'](0xcc)[_0xa7ee('0x1c')]();});}};}function handleEntityNotFound(_0x184d6c,_0x572e41){return function(_0x41b358){if(!_0x41b358){_0x184d6c['sendStatus'](0x194);}return _0x41b358;};}function handleError(_0x30afcb,_0x5ce2e8){_0x5ce2e8=_0x5ce2e8||0x1f4;return function(_0x2a837f){logger[_0xa7ee('0x26')](_0x2a837f[_0xa7ee('0x27')]);if(_0x2a837f[_0xa7ee('0x28')]){delete _0x2a837f[_0xa7ee('0x28')];}_0x30afcb[_0xa7ee('0x1b')](_0x5ce2e8)['send'](_0x2a837f);};}exports[_0xa7ee('0x29')]=function(_0x29977c,_0x17cd6d){var _0x1d6fba={},_0x24e3a6={},_0x542f65={'count':0x0,'rows':[]};var _0x37b45b=db['VoiceTransferReport'][_0xa7ee('0x2a')];_0x24e3a6['model']=_[_0xa7ee('0x2b')](_0x37b45b);_0x24e3a6[_0xa7ee('0x2c')]=_['keys'](_0x29977c['query']);_0x24e3a6[_0xa7ee('0x2d')]=_[_0xa7ee('0x2e')](_0x24e3a6[_0xa7ee('0x2f')],_0x24e3a6['query']);_0x1d6fba[_0xa7ee('0x30')]=_[_0xa7ee('0x2e')](_0x24e3a6['model'],qs['fields'](_0x29977c[_0xa7ee('0x2c')]['fields']));_0x1d6fba[_0xa7ee('0x30')]=_0x1d6fba['attributes'][_0xa7ee('0x31')]?_0x1d6fba[_0xa7ee('0x30')]:_0x24e3a6[_0xa7ee('0x2f')];if(!_0x29977c[_0xa7ee('0x2c')]['hasOwnProperty']('nolimit')){_0x1d6fba['limit']=qs[_0xa7ee('0x20')](_0x29977c['query']['limit']);_0x1d6fba[_0xa7ee('0x1f')]=qs[_0xa7ee('0x1f')](_0x29977c[_0xa7ee('0x2c')]['offset']);}_0x1d6fba[_0xa7ee('0x32')]=qs[_0xa7ee('0x33')](_0x29977c['query']['sort']);_0x1d6fba['where']=qs[_0xa7ee('0x2d')](_[_0xa7ee('0x34')](_0x29977c[_0xa7ee('0x2c')],_0x24e3a6[_0xa7ee('0x2d')]));if(_0x29977c[_0xa7ee('0x2c')][_0xa7ee('0x35')]){_0x1d6fba[_0xa7ee('0x36')]=_[_0xa7ee('0x37')](_0x1d6fba[_0xa7ee('0x36')],{'$or':_[_0xa7ee('0x38')](_0x37b45b,function(_0x491ba3){if(_0x491ba3[_0xa7ee('0x39')][_0xa7ee('0x3a')]!=='VIRTUAL'){var _0x55de6c={};_0x55de6c[_0x491ba3[_0xa7ee('0x3b')]]={'$like':'%'+_0x29977c[_0xa7ee('0x2c')][_0xa7ee('0x35')]+'%'};return _0x55de6c;}})});}_0x1d6fba=_[_0xa7ee('0x37')]({},_0x1d6fba,_0x29977c['options']);var _0x419c56={'where':_0x1d6fba['where']};return db[_0xa7ee('0x3c')][_0xa7ee('0x1e')](_0x419c56)[_0xa7ee('0x24')](function(_0x354d45){_0x542f65['count']=_0x354d45;if(_0x29977c[_0xa7ee('0x2c')][_0xa7ee('0x3d')]){_0x1d6fba[_0xa7ee('0x3e')]=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x1d6fba);})[_0xa7ee('0x24')](function(_0xcf9f61){_0x542f65[_0xa7ee('0x3f')]=_0xcf9f61;return _0x542f65;})[_0xa7ee('0x24')](respondWithFilteredResult(_0x17cd6d,_0x1d6fba))[_0xa7ee('0x40')](handleError(_0x17cd6d,null));};exports[_0xa7ee('0x41')]=function(_0x52d46e,_0x1944f3){var _0x17ef12={'raw':!![],'where':{'id':_0x52d46e['params']['id']}},_0x2500e9={};_0x2500e9[_0xa7ee('0x2f')]=_[_0xa7ee('0x2b')](db[_0xa7ee('0x3c')][_0xa7ee('0x2a')]);_0x2500e9[_0xa7ee('0x2c')]=_[_0xa7ee('0x2b')](_0x52d46e[_0xa7ee('0x2c')]);_0x2500e9[_0xa7ee('0x2d')]=_[_0xa7ee('0x2e')](_0x2500e9['model'],_0x2500e9[_0xa7ee('0x2c')]);_0x17ef12[_0xa7ee('0x30')]=_[_0xa7ee('0x2e')](_0x2500e9[_0xa7ee('0x2f')],qs[_0xa7ee('0x42')](_0x52d46e[_0xa7ee('0x2c')][_0xa7ee('0x42')]));_0x17ef12[_0xa7ee('0x30')]=_0x17ef12[_0xa7ee('0x30')][_0xa7ee('0x31')]?_0x17ef12[_0xa7ee('0x30')]:_0x2500e9[_0xa7ee('0x2f')];if(_0x52d46e[_0xa7ee('0x2c')][_0xa7ee('0x3d')]){_0x17ef12[_0xa7ee('0x3e')]=[{'all':!![]}];}_0x17ef12=_[_0xa7ee('0x37')]({},_0x17ef12,_0x52d46e['options']);return db['VoiceTransferReport'][_0xa7ee('0x43')](_0x17ef12)[_0xa7ee('0x24')](handleEntityNotFound(_0x1944f3,null))[_0xa7ee('0x24')](respondWithResult(_0x1944f3,null))[_0xa7ee('0x40')](handleError(_0x1944f3,null));};exports[_0xa7ee('0x44')]=function(_0x47145e,_0x32dd33){return db[_0xa7ee('0x3c')][_0xa7ee('0x44')](_0x47145e[_0xa7ee('0x45')],{})['then'](respondWithResult(_0x32dd33,0xc9))['catch'](handleError(_0x32dd33,null));};exports[_0xa7ee('0x46')]=function(_0x2e6341,_0x15a14a){if(_0x2e6341[_0xa7ee('0x45')]['id']){delete _0x2e6341[_0xa7ee('0x45')]['id'];}return db[_0xa7ee('0x3c')]['find']({'where':{'id':_0x2e6341[_0xa7ee('0x47')]['id']}})['then'](handleEntityNotFound(_0x15a14a,null))[_0xa7ee('0x24')](saveUpdates(_0x2e6341['body'],null))['then'](respondWithResult(_0x15a14a,null))['catch'](handleError(_0x15a14a,null));};exports[_0xa7ee('0x25')]=function(_0x412d3d,_0x80ae57){return db[_0xa7ee('0x3c')][_0xa7ee('0x43')]({'where':{'id':_0x412d3d[_0xa7ee('0x47')]['id']}})[_0xa7ee('0x24')](handleEntityNotFound(_0x80ae57,null))[_0xa7ee('0x24')](removeEntity(_0x80ae57,null))[_0xa7ee('0x40')](handleError(_0x80ae57,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index d2e6aa3..58da49a 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 _0x91d3=['moment','bluebird','request-promise','exports','define','lodash','util','../../config/logger','api'];(function(_0x1e1965,_0x55785c){var _0x1a2e96=function(_0x27d366){while(--_0x27d366){_0x1e1965['push'](_0x1e1965['shift']());}};_0x1a2e96(++_0x55785c);}(_0x91d3,0x19a));var _0x391d=function(_0x1e012d,_0x1bbf22){_0x1e012d=_0x1e012d-0x0;var _0x3f504c=_0x91d3[_0x1e012d];return _0x3f504c;};'use strict';var _=require(_0x391d('0x0'));var util=require(_0x391d('0x1'));var logger=require(_0x391d('0x2'))(_0x391d('0x3'));var moment=require(_0x391d('0x4'));var BPromise=require(_0x391d('0x5'));var rp=require(_0x391d('0x6'));var attributes=require('./voiceTransferReport.attributes');module[_0x391d('0x7')]=function(_0x1b3be4,_0x7f661d){return _0x1b3be4[_0x391d('0x8')]('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fcc=['bluebird','request-promise','VoiceTransferReport','lodash','util','api','moment'];(function(_0x5dee52,_0x2f398f){var _0x3559cd=function(_0x85921c){while(--_0x85921c){_0x5dee52['push'](_0x5dee52['shift']());}};_0x3559cd(++_0x2f398f);}(_0x7fcc,0xf8));var _0xc7fc=function(_0x2ae86d,_0x483df9){_0x2ae86d=_0x2ae86d-0x0;var _0x118340=_0x7fcc[_0x2ae86d];return _0x118340;};'use strict';var _=require(_0xc7fc('0x0'));var util=require(_0xc7fc('0x1'));var logger=require('../../config/logger')(_0xc7fc('0x2'));var moment=require(_0xc7fc('0x3'));var BPromise=require(_0xc7fc('0x4'));var rp=require(_0xc7fc('0x5'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0xc0d154,_0x2eee70){return _0xc0d154['define'](_0xc7fc('0x6'),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 c14deee..54e88c3 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 _0xc554=['VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','CreateVoiceTransferReport','create','body','options','raw','stringify','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1ae0f5,_0x25d756){var _0xa96dc1=function(_0xe9a62){while(--_0xe9a62){_0x1ae0f5['push'](_0x1ae0f5['shift']());}};_0xa96dc1(++_0x25d756);}(_0xc554,0x127));var _0x4c55=function(_0x82f586,_0x382c19){_0x82f586=_0x82f586-0x0;var _0x591ec8=_0xc554[_0x82f586];return _0x591ec8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4c55('0x0'));var BPromise=require(_0x4c55('0x1'));var rs=require(_0x4c55('0x2'));var fs=require('fs');var Redis=require(_0x4c55('0x3'));var db=require(_0x4c55('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c55('0x5'))(_0x4c55('0x6'));var config=require(_0x4c55('0x7'));var jayson=require(_0x4c55('0x8'));var client=jayson[_0x4c55('0x9')][_0x4c55('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e1515,_0x6c525b,_0x7613a7){return new BPromise(function(_0x4e51cf,_0x27fc39){return client[_0x4c55('0xb')](_0x3e1515,_0x7613a7)[_0x4c55('0xc')](function(_0x542aa2){logger['info'](_0x4c55('0xd'),_0x6c525b,'request\x20sent');logger[_0x4c55('0xe')](_0x4c55('0xf'),_0x6c525b,_0x4c55('0x10'),JSON['stringify'](_0x542aa2));if(_0x542aa2[_0x4c55('0x11')]){if(_0x542aa2[_0x4c55('0x11')]['code']===0x1f4){logger[_0x4c55('0x11')](_0x4c55('0xd'),_0x6c525b,_0x542aa2[_0x4c55('0x11')][_0x4c55('0x12')]);return _0x27fc39(_0x542aa2[_0x4c55('0x11')][_0x4c55('0x12')]);}logger[_0x4c55('0x11')](_0x4c55('0xd'),_0x6c525b,_0x542aa2[_0x4c55('0x11')]['message']);return _0x4e51cf(_0x542aa2[_0x4c55('0x11')]['message']);}else{logger[_0x4c55('0x13')](_0x4c55('0xd'),_0x6c525b,_0x4c55('0x10'));_0x4e51cf(_0x542aa2[_0x4c55('0x14')][_0x4c55('0x12')]);}})['catch'](function(_0x11d26d){logger[_0x4c55('0x11')](_0x4c55('0xd'),_0x6c525b,_0x11d26d);_0x27fc39(_0x11d26d);});});}exports[_0x4c55('0x15')]=function(_0x328af0){var _0x400926=this;return new Promise(function(_0x4f8083,_0x3484e5){return db['VoiceTransferReport'][_0x4c55('0x16')](_0x328af0[_0x4c55('0x17')],{'raw':_0x328af0['options']?_0x328af0[_0x4c55('0x18')][_0x4c55('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3b768c){logger[_0x4c55('0x13')](_0x4c55('0x15'),_0x328af0);logger[_0x4c55('0xe')](_0x4c55('0x15'),_0x328af0,JSON[_0x4c55('0x1a')](_0x3b768c));_0x4f8083(_0x3b768c);})[_0x4c55('0x1b')](function(_0x557ed1){logger[_0x4c55('0x11')](_0x4c55('0x15'),_0x557ed1['message'],_0x328af0);_0x3484e5(_0x400926[_0x4c55('0x11')](0x1f4,_0x557ed1[_0x4c55('0x12')]));});});}; \ No newline at end of file +var _0x87ad=['VoiceTransferReport','create','body','options','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceTransferReport,\x20%s,\x20%s','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateVoiceTransferReport'];(function(_0x1c5f7b,_0x5675c5){var _0x4c1099=function(_0x5b0e97){while(--_0x5b0e97){_0x1c5f7b['push'](_0x1c5f7b['shift']());}};_0x4c1099(++_0x5675c5);}(_0x87ad,0xf8));var _0xd87a=function(_0x55ed85,_0x3f0501){_0x55ed85=_0x55ed85-0x0;var _0x16f315=_0x87ad[_0x55ed85];return _0x16f315;};'use strict';var _=require(_0xd87a('0x0'));var util=require('util');var moment=require(_0xd87a('0x1'));var BPromise=require('bluebird');var rs=require(_0xd87a('0x2'));var fs=require('fs');var Redis=require(_0xd87a('0x3'));var db=require(_0xd87a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd87a('0x5'))(_0xd87a('0x6'));var config=require(_0xd87a('0x7'));var jayson=require(_0xd87a('0x8'));var client=jayson[_0xd87a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32b4b5,_0x2e0ec4,_0x5541b2){return new BPromise(function(_0x47024c,_0x2e5c3f){return client[_0xd87a('0xa')](_0x32b4b5,_0x5541b2)[_0xd87a('0xb')](function(_0xa37cfa){logger[_0xd87a('0xc')](_0xd87a('0xd'),_0x2e0ec4,'request\x20sent');logger['debug'](_0xd87a('0xe'),_0x2e0ec4,_0xd87a('0xf'),JSON[_0xd87a('0x10')](_0xa37cfa));if(_0xa37cfa[_0xd87a('0x11')]){if(_0xa37cfa['error']['code']===0x1f4){logger[_0xd87a('0x11')](_0xd87a('0xd'),_0x2e0ec4,_0xa37cfa['error'][_0xd87a('0x12')]);return _0x2e5c3f(_0xa37cfa[_0xd87a('0x11')][_0xd87a('0x12')]);}logger[_0xd87a('0x11')](_0xd87a('0xd'),_0x2e0ec4,_0xa37cfa[_0xd87a('0x11')][_0xd87a('0x12')]);return _0x47024c(_0xa37cfa['error'][_0xd87a('0x12')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x2e0ec4,'request\x20sent');_0x47024c(_0xa37cfa[_0xd87a('0x13')][_0xd87a('0x12')]);}})[_0xd87a('0x14')](function(_0x594598){logger['error'](_0xd87a('0xd'),_0x2e0ec4,_0x594598);_0x2e5c3f(_0x594598);});});}exports[_0xd87a('0x15')]=function(_0x4a4ae0){var _0x1dcb10=this;return new Promise(function(_0x2549d8,_0x3361e2){return db[_0xd87a('0x16')][_0xd87a('0x17')](_0x4a4ae0[_0xd87a('0x18')],{'raw':_0x4a4ae0[_0xd87a('0x19')]?_0x4a4ae0[_0xd87a('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xb63d54){logger[_0xd87a('0xc')]('CreateVoiceTransferReport',_0x4a4ae0);logger[_0xd87a('0x1a')](_0xd87a('0x15'),_0x4a4ae0,JSON[_0xd87a('0x10')](_0xb63d54));_0x2549d8(_0xb63d54);})[_0xd87a('0x14')](function(_0xb5761){logger[_0xd87a('0x11')]('CreateVoiceTransferReport',_0xb5761['message'],_0x4a4ae0);_0x3361e2(_0x1dcb10[_0xd87a('0x11')](0x1f4,_0xb5761[_0xd87a('0x12')]));});});}; \ No newline at end of file diff --git a/server/app.js b/server/app.js index e64fe54..40bc9d3 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf148=['Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','sync','listen','then','info','start','Online\x20apps:','map','filter','online','join','status','name','None','seedDB','./config/seedDB','default','catch','error'];(function(_0xb78d44,_0x3ed3cd){var _0x519f67=function(_0x3a1ad0){while(--_0x3a1ad0){_0xb78d44['push'](_0xb78d44['shift']());}};_0x519f67(++_0x3ed3cd);}(_0xf148,0x16d));var _0x8f14=function(_0x199491,_0x4bc67d){_0x199491=_0x199491-0x0;var _0x2e3293=_0xf148[_0x199491];return _0x2e3293;};'use strict';var _=require(_0x8f14('0x0'));var mysqldb=require(_0x8f14('0x1'));var rpc=require('./rpc');var config=require(_0x8f14('0x2'));var logger=require(_0x8f14('0x3'))(_0x8f14('0x4'));var pm2=require(_0x8f14('0x5'));var pm2Config=require(_0x8f14('0x6'));var schedule=require(_0x8f14('0x7'));var chat=require(_0x8f14('0x8'));function main(){return mysqldb['db']['sequelize'][_0x8f14('0x9')]()['then'](function(){return rpc[_0x8f14('0xa')]();})[_0x8f14('0xb')](function(_0x1845bf){logger[_0x8f14('0xc')](_0x1845bf);return chat[_0x8f14('0xd')]();})[_0x8f14('0xb')](function(){return schedule[_0x8f14('0xd')]();})[_0x8f14('0xb')](function(_0x320a36){logger[_0x8f14('0xc')](_0x320a36);return pm2[_0x8f14('0xd')](pm2Config);})[_0x8f14('0xb')](function(_0xafc1b9){logger[_0x8f14('0xc')](_0x8f14('0xe'),_[_0x8f14('0xf')](_[_0x8f14('0x10')](_0xafc1b9,{'status':_0x8f14('0x11')}),'name')[_0x8f14('0x12')]());logger[_0x8f14('0xc')]('Offline\x20apps:',_[_0x8f14('0xf')](_[_0x8f14('0x10')](_0xafc1b9,function(_0x4788c4){return _0x4788c4[_0x8f14('0x13')]!=='online';}),_0x8f14('0x14'))[_0x8f14('0x12')]()||_0x8f14('0x15'));config[_0x8f14('0x16')]&&require(_0x8f14('0x17'))[_0x8f14('0x18')]();require('./config/license')['default']();})[_0x8f14('0x19')](function(_0x918b7b){logger[_0x8f14('0x1a')](_0x8f14('0x1b'),_0x918b7b);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x682c=['./config/schedule/chat','sync','listen','then','start','info','Online\x20apps:','filter','online','name','join','Offline\x20apps:','map','status','None','seedDB','./config/seedDB','default','./config/license','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./rpc','./config/logger','app','./config/pm2'];(function(_0x11cb7e,_0x4b10e0){var _0x5ec7a6=function(_0x2f2edb){while(--_0x2f2edb){_0x11cb7e['push'](_0x11cb7e['shift']());}};_0x5ec7a6(++_0x4b10e0);}(_0x682c,0x167));var _0xc682=function(_0x18c99e,_0x570c07){_0x18c99e=_0x18c99e-0x0;var _0x451f60=_0x682c[_0x18c99e];return _0x451f60;};'use strict';var _=require(_0xc682('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0xc682('0x1'));var config=require('./config/environment');var logger=require(_0xc682('0x2'))(_0xc682('0x3'));var pm2=require(_0xc682('0x4'));var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0xc682('0x5'));function main(){return mysqldb['db']['sequelize'][_0xc682('0x6')]()['then'](function(){return rpc[_0xc682('0x7')]();})[_0xc682('0x8')](function(_0x1a197f){logger['info'](_0x1a197f);return chat[_0xc682('0x9')]();})[_0xc682('0x8')](function(){return schedule['start']();})['then'](function(_0x514fb4){logger[_0xc682('0xa')](_0x514fb4);return pm2['start'](pm2Config);})[_0xc682('0x8')](function(_0x5c11f3){logger[_0xc682('0xa')](_0xc682('0xb'),_['map'](_[_0xc682('0xc')](_0x5c11f3,{'status':_0xc682('0xd')}),_0xc682('0xe'))[_0xc682('0xf')]());logger['info'](_0xc682('0x10'),_[_0xc682('0x11')](_[_0xc682('0xc')](_0x5c11f3,function(_0x14129f){return _0x14129f[_0xc682('0x12')]!==_0xc682('0xd');}),_0xc682('0xe'))[_0xc682('0xf')]()||_0xc682('0x13'));config[_0xc682('0x14')]&&require(_0xc682('0x15'))[_0xc682('0x16')]();require(_0xc682('0x17'))['default']();})['catch'](function(_0x107134){logger['error'](_0xc682('0x18'),_0x107134);process[_0xc682('0x19')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 4179593..814c395 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 _0xa1a5=['../../config/license/util','update','canUpdate','hasRole','Required\x20role\x20needs\x20to\x20be\x20set','userRoles','indexOf','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','stringify','pick','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','randomBytes','toString','hex','floor','now','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','sign','HS512','../../mysqldb','../../config/environment','jsonwebtoken','express-jwt','composable-middleware','basic-auth','secrets','session','role','fullname','name','internal','email','userpic','voicePause','mailPause','faxPause','openchannelPause','pauseType','showWebBar','phoneBarRemoteControlPort','phoneBarRemoteControl','userProfileId','isChatInteractionAuthorized','use','ChatInteraction','findOne','params','closed','disposition','status','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','User','find','then','authenticate','pass','json','Wrong\x20credentials.','user','Bearer','Unknown\x20authorization\x20format','query','apikey','verify','getUuid','sub','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','log','Unrecognized\x20API\x20access\x20key','User\x20not\x20found.'];(function(_0x551239,_0x5dc8f7){var _0x16e26d=function(_0xd0e2f0){while(--_0xd0e2f0){_0x551239['push'](_0x551239['shift']());}};_0x16e26d(++_0x5dc8f7);}(_0xa1a5,0xc4));var _0x5a1a=function(_0x59473d,_0x173303){_0x59473d=_0x59473d-0x0;var _0x39a833=_0xa1a5[_0x59473d];return _0x39a833;};'use strict';var db=require(_0x5a1a('0x0'))['db'];var config=require(_0x5a1a('0x1'));var hardwareConf=require('../../config/license/hardware');var _=require('lodash');var jwt=require(_0x5a1a('0x2'));var expressJwt=require(_0x5a1a('0x3'));var compose=require(_0x5a1a('0x4'));var basicAuth=require(_0x5a1a('0x5'));var crypto=require('crypto');var ipaddr=require('ipaddr.js');var validateJwt=expressJwt({'secret':config[_0x5a1a('0x6')][_0x5a1a('0x7')]});var userAttributes=['id',_0x5a1a('0x8'),_0x5a1a('0x9'),_0x5a1a('0xa'),_0x5a1a('0xb'),_0x5a1a('0xc'),_0x5a1a('0xd'),'permissions',_0x5a1a('0xe'),'chatPause',_0x5a1a('0xf'),_0x5a1a('0x10'),'smsPause',_0x5a1a('0x11'),_0x5a1a('0x12'),_0x5a1a('0x13'),_0x5a1a('0x14'),_0x5a1a('0x15'),'interface',_0x5a1a('0x16')];exports[_0x5a1a('0x17')]=function(){return isAuthenticated(!![])[_0x5a1a('0x18')](function(_0x4a9923,_0x10874b,_0x18b0de){if(_0x4a9923['user']){_0x18b0de();}else{return db[_0x5a1a('0x19')][_0x5a1a('0x1a')]({'where':{'id':_0x4a9923[_0x5a1a('0x1b')]['id']},'attributes':['id',_0x5a1a('0x1c'),_0x5a1a('0x1d')],'raw':!![]})['then'](function(_0x330543){if(_0x330543&&_0x330543[_0x5a1a('0x1c')]){return _0x10874b[_0x5a1a('0x1e')](_0x330543['disposition']===_0x5a1a('0x1f')?0x195:0x193)['json']({'message':_0x330543['disposition']===_0x5a1a('0x1f')?_0x5a1a('0x20'):_0x5a1a('0x21')});}else{_0x18b0de();}})[_0x5a1a('0x22')](function(_0xfdbe89){_0x18b0de(_0xfdbe89);});}});};function isAuthenticated(_0x3cd451){return compose()['use'](function(_0x693335,_0x5a2e89,_0x443d5f){if(_0x693335[_0x5a1a('0x23')][_0x5a1a('0x24')]){if(_[_0x5a1a('0x25')](_0x693335['headers'][_0x5a1a('0x24')],'Basic')){var _0x5bc038=basicAuth(_0x693335);db[_0x5a1a('0x26')][_0x5a1a('0x27')]({'where':{'name':_0x5bc038['name']}})[_0x5a1a('0x28')](function(_0x466a41){if(!_0x466a41||!_0x466a41[_0x5a1a('0x29')](_0x5bc038[_0x5a1a('0x2a')])){return _0x5a2e89[_0x5a1a('0x1e')](0x191)[_0x5a1a('0x2b')]({'message':_0x5a1a('0x2c')});}_0x693335[_0x5a1a('0x2d')]={'id':_0x466a41['id']};_0x443d5f();})[_0x5a1a('0x22')](function(_0x36168f){_0x443d5f(_0x36168f);});}else if(_[_0x5a1a('0x25')](_0x693335[_0x5a1a('0x23')][_0x5a1a('0x24')],_0x5a1a('0x2e'))){validateJwt(_0x693335,_0x5a2e89,_0x443d5f);}else{if(_0x3cd451){_0x443d5f();}else{return _0x5a2e89[_0x5a1a('0x1e')](0x193)['json']({'message':_0x5a1a('0x2f')});}}}else if(_0x693335[_0x5a1a('0x30')][_0x5a1a('0x31')]){try{var _0x4abc95=jwt[_0x5a1a('0x32')](_0x693335['query'][_0x5a1a('0x31')],config['secrets'][_0x5a1a('0x7')],{'audience':hardwareConf[_0x5a1a('0x33')](),'issuer':hardwareConf[_0x5a1a('0x33')]()});db[_0x5a1a('0x26')]['find']({'where':{'id':_0x4abc95[_0x5a1a('0x34')]}})[_0x5a1a('0x28')](function(_0x5adfb0){if(!_0x5adfb0||!_['isEqual'](_0x5adfb0[_0x5a1a('0x35')],_0x4abc95[_0x5a1a('0x36')])){return _0x5a2e89[_0x5a1a('0x1e')](0x193)[_0x5a1a('0x2b')]({'message':_0x5a1a('0x37')});}_0x693335['user']={'id':_0x5adfb0['id']};_0x443d5f();})[_0x5a1a('0x22')](function(_0x2d828f){_0x443d5f(_0x2d828f);});}catch(_0x585fc5){console[_0x5a1a('0x38')](_0x585fc5);return _0x5a2e89[_0x5a1a('0x1e')](0x193)['json']({'message':_0x5a1a('0x39')});}}else if(_0x3cd451){_0x443d5f();}else{return _0x5a2e89[_0x5a1a('0x1e')](0x193)[_0x5a1a('0x2b')]({'message':_0x5a1a('0x2f')});}})[_0x5a1a('0x18')](function(_0x199abf,_0x1e92c5,_0x5ce827){if(_0x199abf[_0x5a1a('0x2d')]){db[_0x5a1a('0x26')]['find']({'where':{'id':_0x199abf[_0x5a1a('0x2d')]['id']},'attributes':userAttributes})[_0x5a1a('0x28')](function(_0x57d710){if(!_0x57d710){return _0x1e92c5[_0x5a1a('0x1e')](0x194)[_0x5a1a('0x2b')]({'message':_0x5a1a('0x3a')});}_0x199abf[_0x5a1a('0x2d')]=_0x57d710;_0x5ce827();})['catch'](function(_0x39cbec){_0x5ce827(_0x39cbec);});}else if(_0x3cd451){_0x5ce827();}else{return _0x1e92c5[_0x5a1a('0x1e')](0x194)[_0x5a1a('0x2b')]({'message':'User\x20object\x20not\x20found.'});}});}exports['isAuthenticated']=isAuthenticated;function canUpdate(){return compose()[_0x5a1a('0x18')](function(_0x386da6,_0x4e612e,_0x2b0423){return require(_0x5a1a('0x3b'))['getLicense']()[_0x5a1a('0x28')](function(_0x18dc8a){if(_0x18dc8a[_0x5a1a('0x3c')]){_0x2b0423();}else{return _0x4e612e[_0x5a1a('0x1e')](0x193)[_0x5a1a('0x2b')]({'message':'Forbidden'});}})['catch'](function(_0x1f46cf){_0x2b0423(_0x1f46cf);});});}exports[_0x5a1a('0x3d')]=canUpdate;function signToken(_0x11a607,_0x354d23){return jwt['sign']({'id':_0x11a607,'role':_0x354d23},config[_0x5a1a('0x6')][_0x5a1a('0x7')],{'expiresIn':0x15180});}exports['signToken']=signToken;exports[_0x5a1a('0x3e')]=function(_0x507fa5){if(!_0x507fa5){throw new Error(_0x5a1a('0x3f'));}return compose()[_0x5a1a('0x18')](isAuthenticated())['use'](function meetsRequirements(_0x41fc4c,_0x1fb11a,_0x699efa){if(config[_0x5a1a('0x40')][_0x5a1a('0x41')](_0x41fc4c[_0x5a1a('0x2d')][_0x5a1a('0x8')])>=config['userRoles'][_0x5a1a('0x41')](_0x507fa5)){return _0x699efa();}else{return _0x1fb11a[_0x5a1a('0x1e')](0x193)[_0x5a1a('0x2b')]({'message':'Forbidden'});}});};exports[_0x5a1a('0x42')]=function(_0x4bd326,_0x57a88f){if(!_0x4bd326[_0x5a1a('0x2d')]){return _0x57a88f['status'](0x194)[_0x5a1a('0x2b')]({'message':_0x5a1a('0x43')});}var _0x36dcd2=signToken(_0x4bd326['user']['id'],_0x4bd326[_0x5a1a('0x2d')][_0x5a1a('0x8')]);_0x57a88f[_0x5a1a('0x44')](_0x5a1a('0x45'),_0x36dcd2);_0x57a88f[_0x5a1a('0x44')]('motion.user',JSON[_0x5a1a('0x46')](_[_0x5a1a('0x47')](_0x4bd326[_0x5a1a('0x2d')],userAttributes)));_0x57a88f[_0x5a1a('0x48')](_0x5a1a('0x49'));};exports[_0x5a1a('0x4a')]=function(_0x311e14){if(_[_0x5a1a('0x4b')](_0x311e14[_0x5a1a('0x35')])||_[_0x5a1a('0x4b')](_0x311e14[_0x5a1a('0x4c')]))return null;else return createJwt(_0x311e14);};exports['generateApiKey']=function(_0x2f639b){_0x2f639b[_0x5a1a('0x35')]=crypto[_0x5a1a('0x4d')](0x10)[_0x5a1a('0x4e')](_0x5a1a('0x4f'));_0x2f639b['apiKeyIat']=Math[_0x5a1a('0x50')](Date[_0x5a1a('0x51')]()/0x3e8)['toString']();return createJwt(_0x2f639b);};exports['regenerateApiKey']=function(_0xb3daab,_0xe03d8c){if(_0xb3daab[_0x5a1a('0x30')][_0x5a1a('0x31')]){jwt['verify'](_0xb3daab[_0x5a1a('0x30')][_0x5a1a('0x31')],config['secrets'][_0x5a1a('0x7')],{'nonce':_0xe03d8c[_0x5a1a('0x35')],'iat':_0xe03d8c[_0x5a1a('0x4c')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x5a1a('0x33')]()});return generateApiKey(_0xe03d8c);}else{throw{'message':_0x5a1a('0x52')};}};function createJwt(_0x3a2674){return jwt[_0x5a1a('0x53')]({'iat':_0x3a2674[_0x5a1a('0x4c')],'nonce':_0x3a2674[_0x5a1a('0x35')]},config[_0x5a1a('0x6')][_0x5a1a('0x7')],{'algorithm':_0x5a1a('0x54'),'subject':_0x3a2674['id'][_0x5a1a('0x4e')](),'issuer':hardwareConf[_0x5a1a('0x33')](),'audience':hardwareConf[_0x5a1a('0x33')]()});} \ No newline at end of file +var _0xfbf6=['/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','randomBytes','toString','hex','floor','now','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','express-jwt','composable-middleware','basic-auth','secrets','role','fullname','email','permissions','chatPause','mailPause','faxPause','openchannelPause','pauseType','showWebBar','phoneBarRemoteControl','interface','userProfileId','isChatInteractionAuthorized','use','user','ChatInteraction','params','closed','disposition','then','unmanaged','json','Unmanaged.','catch','headers','authorization','startsWith','Basic','name','authenticate','pass','status','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','verify','session','getUuid','User','find','sub','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','User\x20not\x20found.','User\x20object\x20not\x20found.','isAuthenticated','getLicense','update','canUpdate','sign','Required\x20role\x20needs\x20to\x20be\x20set','indexOf','userRoles','setTokenCookie','cookie','motion.user','stringify','pick','redirect'];(function(_0x1ea9b4,_0x1c4568){var _0x24d948=function(_0x2069d){while(--_0x2069d){_0x1ea9b4['push'](_0x1ea9b4['shift']());}};_0x24d948(++_0x1c4568);}(_0xfbf6,0x1b0));var _0x6fbf=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xfbf6[_0x50007c];return _0x5c1ec7;};'use strict';var db=require(_0x6fbf('0x0'))['db'];var config=require(_0x6fbf('0x1'));var hardwareConf=require(_0x6fbf('0x2'));var _=require(_0x6fbf('0x3'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x6fbf('0x4'));var compose=require(_0x6fbf('0x5'));var basicAuth=require(_0x6fbf('0x6'));var crypto=require('crypto');var ipaddr=require('ipaddr.js');var validateJwt=expressJwt({'secret':config[_0x6fbf('0x7')]['session']});var userAttributes=['id',_0x6fbf('0x8'),_0x6fbf('0x9'),'name','internal',_0x6fbf('0xa'),'userpic',_0x6fbf('0xb'),'voicePause',_0x6fbf('0xc'),_0x6fbf('0xd'),_0x6fbf('0xe'),'smsPause',_0x6fbf('0xf'),_0x6fbf('0x10'),_0x6fbf('0x11'),'phoneBarRemoteControlPort',_0x6fbf('0x12'),_0x6fbf('0x13'),_0x6fbf('0x14')];exports[_0x6fbf('0x15')]=function(){return isAuthenticated(!![])[_0x6fbf('0x16')](function(_0x3850af,_0xed67d2,_0x490a56){if(_0x3850af[_0x6fbf('0x17')]){_0x490a56();}else{return db[_0x6fbf('0x18')]['findOne']({'where':{'id':_0x3850af[_0x6fbf('0x19')]['id']},'attributes':['id',_0x6fbf('0x1a'),_0x6fbf('0x1b')],'raw':!![]})[_0x6fbf('0x1c')](function(_0x496add){if(_0x496add&&_0x496add[_0x6fbf('0x1a')]){return _0xed67d2['status'](_0x496add[_0x6fbf('0x1b')]===_0x6fbf('0x1d')?0x195:0x193)[_0x6fbf('0x1e')]({'message':_0x496add['disposition']===_0x6fbf('0x1d')?_0x6fbf('0x1f'):'Forbidden.'});}else{_0x490a56();}})[_0x6fbf('0x20')](function(_0x1fed82){_0x490a56(_0x1fed82);});}});};function isAuthenticated(_0x2002b2){return compose()[_0x6fbf('0x16')](function(_0x297dea,_0x4c7d33,_0x3a7e1c){if(_0x297dea[_0x6fbf('0x21')][_0x6fbf('0x22')]){if(_[_0x6fbf('0x23')](_0x297dea[_0x6fbf('0x21')][_0x6fbf('0x22')],_0x6fbf('0x24'))){var _0x32656a=basicAuth(_0x297dea);db['User']['find']({'where':{'name':_0x32656a[_0x6fbf('0x25')]}})[_0x6fbf('0x1c')](function(_0x18ac19){if(!_0x18ac19||!_0x18ac19[_0x6fbf('0x26')](_0x32656a[_0x6fbf('0x27')])){return _0x4c7d33[_0x6fbf('0x28')](0x191)[_0x6fbf('0x1e')]({'message':_0x6fbf('0x29')});}_0x297dea[_0x6fbf('0x17')]={'id':_0x18ac19['id']};_0x3a7e1c();})[_0x6fbf('0x20')](function(_0x25c50f){_0x3a7e1c(_0x25c50f);});}else if(_[_0x6fbf('0x23')](_0x297dea[_0x6fbf('0x21')][_0x6fbf('0x22')],_0x6fbf('0x2a'))){validateJwt(_0x297dea,_0x4c7d33,_0x3a7e1c);}else{if(_0x2002b2){_0x3a7e1c();}else{return _0x4c7d33[_0x6fbf('0x28')](0x193)[_0x6fbf('0x1e')]({'message':_0x6fbf('0x2b')});}}}else if(_0x297dea[_0x6fbf('0x2c')][_0x6fbf('0x2d')]){try{var _0x3ddd78=jwt[_0x6fbf('0x2e')](_0x297dea[_0x6fbf('0x2c')][_0x6fbf('0x2d')],config[_0x6fbf('0x7')][_0x6fbf('0x2f')],{'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x6fbf('0x30')]()});db[_0x6fbf('0x31')][_0x6fbf('0x32')]({'where':{'id':_0x3ddd78[_0x6fbf('0x33')]}})[_0x6fbf('0x1c')](function(_0x350afa){if(!_0x350afa||!_[_0x6fbf('0x34')](_0x350afa[_0x6fbf('0x35')],_0x3ddd78[_0x6fbf('0x36')])){return _0x4c7d33[_0x6fbf('0x28')](0x193)[_0x6fbf('0x1e')]({'message':_0x6fbf('0x37')});}_0x297dea[_0x6fbf('0x17')]={'id':_0x350afa['id']};_0x3a7e1c();})[_0x6fbf('0x20')](function(_0x3aa165){_0x3a7e1c(_0x3aa165);});}catch(_0x198a44){console['log'](_0x198a44);return _0x4c7d33[_0x6fbf('0x28')](0x193)[_0x6fbf('0x1e')]({'message':'Unrecognized\x20API\x20access\x20key'});}}else if(_0x2002b2){_0x3a7e1c();}else{return _0x4c7d33['status'](0x193)[_0x6fbf('0x1e')]({'message':_0x6fbf('0x2b')});}})[_0x6fbf('0x16')](function(_0x2d0ad2,_0x9de423,_0x43998f){if(_0x2d0ad2[_0x6fbf('0x17')]){db[_0x6fbf('0x31')][_0x6fbf('0x32')]({'where':{'id':_0x2d0ad2['user']['id']},'attributes':userAttributes})[_0x6fbf('0x1c')](function(_0x341139){if(!_0x341139){return _0x9de423['status'](0x194)[_0x6fbf('0x1e')]({'message':_0x6fbf('0x38')});}_0x2d0ad2[_0x6fbf('0x17')]=_0x341139;_0x43998f();})[_0x6fbf('0x20')](function(_0x1f56df){_0x43998f(_0x1f56df);});}else if(_0x2002b2){_0x43998f();}else{return _0x9de423['status'](0x194)[_0x6fbf('0x1e')]({'message':_0x6fbf('0x39')});}});}exports[_0x6fbf('0x3a')]=isAuthenticated;function canUpdate(){return compose()['use'](function(_0x20d5b2,_0x3bd0e7,_0x2f1f66){return require('../../config/license/util')[_0x6fbf('0x3b')]()['then'](function(_0x496ee4){if(_0x496ee4[_0x6fbf('0x3c')]){_0x2f1f66();}else{return _0x3bd0e7[_0x6fbf('0x28')](0x193)[_0x6fbf('0x1e')]({'message':'Forbidden'});}})[_0x6fbf('0x20')](function(_0x285c67){_0x2f1f66(_0x285c67);});});}exports[_0x6fbf('0x3d')]=canUpdate;function signToken(_0x2f58d1,_0x11f923){return jwt[_0x6fbf('0x3e')]({'id':_0x2f58d1,'role':_0x11f923},config[_0x6fbf('0x7')][_0x6fbf('0x2f')],{'expiresIn':0x15180});}exports['signToken']=signToken;exports['hasRole']=function(_0x372c33){if(!_0x372c33){throw new Error(_0x6fbf('0x3f'));}return compose()[_0x6fbf('0x16')](isAuthenticated())['use'](function meetsRequirements(_0x32663f,_0x3448bd,_0x50a121){if(config['userRoles'][_0x6fbf('0x40')](_0x32663f['user'][_0x6fbf('0x8')])>=config[_0x6fbf('0x41')][_0x6fbf('0x40')](_0x372c33)){return _0x50a121();}else{return _0x3448bd['status'](0x193)[_0x6fbf('0x1e')]({'message':'Forbidden'});}});};exports[_0x6fbf('0x42')]=function(_0x37e764,_0x33f367){if(!_0x37e764[_0x6fbf('0x17')]){return _0x33f367[_0x6fbf('0x28')](0x194)[_0x6fbf('0x1e')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0xd9b8a3=signToken(_0x37e764['user']['id'],_0x37e764['user'][_0x6fbf('0x8')]);_0x33f367[_0x6fbf('0x43')]('motion.token',_0xd9b8a3);_0x33f367['cookie'](_0x6fbf('0x44'),JSON[_0x6fbf('0x45')](_[_0x6fbf('0x46')](_0x37e764['user'],userAttributes)));_0x33f367[_0x6fbf('0x47')](_0x6fbf('0x48'));};exports[_0x6fbf('0x49')]=function(_0x122a17){if(_['isNil'](_0x122a17[_0x6fbf('0x35')])||_[_0x6fbf('0x4a')](_0x122a17[_0x6fbf('0x4b')]))return null;else return createJwt(_0x122a17);};exports[_0x6fbf('0x4c')]=function(_0x2fc197){_0x2fc197[_0x6fbf('0x35')]=crypto[_0x6fbf('0x4d')](0x10)[_0x6fbf('0x4e')](_0x6fbf('0x4f'));_0x2fc197[_0x6fbf('0x4b')]=Math[_0x6fbf('0x50')](Date[_0x6fbf('0x51')]()/0x3e8)[_0x6fbf('0x4e')]();return createJwt(_0x2fc197);};exports[_0x6fbf('0x52')]=function(_0xf3c714,_0x2b3bcf){if(_0xf3c714[_0x6fbf('0x2c')]['apikey']){jwt[_0x6fbf('0x2e')](_0xf3c714[_0x6fbf('0x2c')]['apikey'],config['secrets'][_0x6fbf('0x2f')],{'nonce':_0x2b3bcf[_0x6fbf('0x35')],'iat':_0x2b3bcf[_0x6fbf('0x4b')],'audience':hardwareConf[_0x6fbf('0x30')](),'issuer':hardwareConf['getUuid']()});return generateApiKey(_0x2b3bcf);}else{throw{'message':_0x6fbf('0x53')};}};function createJwt(_0x39565e){return jwt['sign']({'iat':_0x39565e[_0x6fbf('0x4b')],'nonce':_0x39565e['apiKeyNonce']},config[_0x6fbf('0x7')]['session'],{'algorithm':'HS512','subject':_0x39565e['id'][_0x6fbf('0x4e')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x6fbf('0x30')]()});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 12fc8c5..a2bec87 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 _0xaa6e=['aes192','hasOwnProperty','createReadStream','createCipher','algorithm','update','end','binary','close','unlink','decryptFile','createDecipher','data','write','crypto','bluebird'];(function(_0x1a3689,_0x3d233f){var _0xc59e17=function(_0x1b2293){while(--_0x1b2293){_0x1a3689['push'](_0x1a3689['shift']());}};_0xc59e17(++_0x3d233f);}(_0xaa6e,0xee));var _0xeaa6=function(_0x1f3f5a,_0x4336f1){_0x1f3f5a=_0x1f3f5a-0x0;var _0x3c7fc5=_0xaa6e[_0x1f3f5a];return _0x3c7fc5;};'use strict';var crypto=require(_0xeaa6('0x0'));var fs=require('fs');var BPromise=require(_0xeaa6('0x1'));var defaultOptions={'algorithm':_0xeaa6('0x2')};function combineOptions(_0x242525){var _0x5bd5c3={};for(var _0x545330 in defaultOptions){if(defaultOptions[_0xeaa6('0x3')](_0x545330)){_0x5bd5c3[_0x545330]=defaultOptions[_0x545330];}}if(_0x242525){for(var _0x3b9e37 in _0x242525){if(_0x242525[_0xeaa6('0x3')](_0x3b9e37)){_0x5bd5c3[_0x3b9e37]=_0x242525[_0x3b9e37];}}}return _0x5bd5c3;}exports['encryptFile']=function(_0x4fe424,_0x5dd6a6,_0x21a3e0,_0x150062){return new BPromise(function(_0x5e64c3,_0x48ca19){_0x150062=combineOptions(_0x150062);var _0x3b4386=new Buffer(_0x21a3e0);var _0x1bcf7c=fs[_0xeaa6('0x4')](_0x4fe424);var _0x23aca3=fs['createWriteStream'](_0x5dd6a6);var _0x5658ac=crypto[_0xeaa6('0x5')](_0x150062[_0xeaa6('0x6')],_0x3b4386);_0x1bcf7c['on']('data',function(_0x16d975){var _0x36b3bb=new Buffer(_0x5658ac[_0xeaa6('0x7')](_0x16d975),'binary');_0x23aca3['write'](_0x36b3bb);});_0x1bcf7c['on'](_0xeaa6('0x8'),function(){try{var _0x28ee50=new Buffer(_0x5658ac['final']('binary'),_0xeaa6('0x9'));_0x23aca3['write'](_0x28ee50);_0x23aca3[_0xeaa6('0x8')]();_0x23aca3['on'](_0xeaa6('0xa'),function(){return _0x5e64c3(_0x5dd6a6);});}catch(_0x65f480){fs[_0xeaa6('0xb')](_0x5dd6a6);return _0x48ca19(_0x65f480);}});});};exports[_0xeaa6('0xc')]=function(_0xadcf79,_0x4d4867,_0x4ea8ba,_0x5d665c){return new BPromise(function(_0x3adc0e,_0x58609b){_0x5d665c=combineOptions(_0x5d665c);var _0x20a99d=new Buffer(_0x4ea8ba);var _0x2cf2b0=fs['createReadStream'](_0xadcf79);var _0xd67938=fs['createWriteStream'](_0x4d4867);var _0x3b2b08=crypto[_0xeaa6('0xd')](_0x5d665c[_0xeaa6('0x6')],_0x20a99d);_0x2cf2b0['on'](_0xeaa6('0xe'),function(_0x1ad40d){var _0x39f03b=new Buffer(_0x3b2b08[_0xeaa6('0x7')](_0x1ad40d),_0xeaa6('0x9'));_0xd67938[_0xeaa6('0xf')](_0x39f03b);});_0x2cf2b0['on']('end',function(){try{var _0x21b743=new Buffer(_0x3b2b08['final']('binary'),_0xeaa6('0x9'));_0xd67938['write'](_0x21b743);_0xd67938[_0xeaa6('0x8')]();_0xd67938['on'](_0xeaa6('0xa'),function(){return _0x3adc0e(_0x4d4867);});}catch(_0xac134f){fs['unlink'](_0x4d4867);return _0x58609b(_0xac134f);}});});}; \ No newline at end of file +var _0x84ff=['close','unlink','decryptFile','createWriteStream','crypto','hasOwnProperty','encryptFile','createReadStream','createCipher','algorithm','data','update','binary','write','end','final'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0x84ff,0xe4));var _0xf84f=function(_0x2894a9,_0x542d48){_0x2894a9=_0x2894a9-0x0;var _0x27a085=_0x84ff[_0x2894a9];return _0x27a085;};'use strict';var crypto=require(_0xf84f('0x0'));var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':'aes192'};function combineOptions(_0x2f64e1){var _0xe31f4={};for(var _0xf6b0c3 in defaultOptions){if(defaultOptions[_0xf84f('0x1')](_0xf6b0c3)){_0xe31f4[_0xf6b0c3]=defaultOptions[_0xf6b0c3];}}if(_0x2f64e1){for(var _0xfd2621 in _0x2f64e1){if(_0x2f64e1[_0xf84f('0x1')](_0xfd2621)){_0xe31f4[_0xfd2621]=_0x2f64e1[_0xfd2621];}}}return _0xe31f4;}exports[_0xf84f('0x2')]=function(_0x3d029a,_0x432f0c,_0x4d49b5,_0x497ef5){return new BPromise(function(_0x3b8375,_0x308f73){_0x497ef5=combineOptions(_0x497ef5);var _0x188d2c=new Buffer(_0x4d49b5);var _0x5b8f0f=fs[_0xf84f('0x3')](_0x3d029a);var _0x61157f=fs['createWriteStream'](_0x432f0c);var _0x574211=crypto[_0xf84f('0x4')](_0x497ef5[_0xf84f('0x5')],_0x188d2c);_0x5b8f0f['on'](_0xf84f('0x6'),function(_0xb9f412){var _0x297d8a=new Buffer(_0x574211[_0xf84f('0x7')](_0xb9f412),_0xf84f('0x8'));_0x61157f[_0xf84f('0x9')](_0x297d8a);});_0x5b8f0f['on'](_0xf84f('0xa'),function(){try{var _0x2139a4=new Buffer(_0x574211[_0xf84f('0xb')](_0xf84f('0x8')),_0xf84f('0x8'));_0x61157f[_0xf84f('0x9')](_0x2139a4);_0x61157f['end']();_0x61157f['on'](_0xf84f('0xc'),function(){return _0x3b8375(_0x432f0c);});}catch(_0x1f2da4){fs[_0xf84f('0xd')](_0x432f0c);return _0x308f73(_0x1f2da4);}});});};exports[_0xf84f('0xe')]=function(_0x2df19c,_0x29c541,_0x38b23c,_0x194d0a){return new BPromise(function(_0x25b35e,_0x546901){_0x194d0a=combineOptions(_0x194d0a);var _0x32a227=new Buffer(_0x38b23c);var _0x1f1eab=fs[_0xf84f('0x3')](_0x2df19c);var _0x489a51=fs[_0xf84f('0xf')](_0x29c541);var _0x56aa96=crypto['createDecipher'](_0x194d0a[_0xf84f('0x5')],_0x32a227);_0x1f1eab['on'](_0xf84f('0x6'),function(_0x46fd76){var _0x440d2e=new Buffer(_0x56aa96['update'](_0x46fd76),_0xf84f('0x8'));_0x489a51[_0xf84f('0x9')](_0x440d2e);});_0x1f1eab['on'](_0xf84f('0xa'),function(){try{var _0x33936b=new Buffer(_0x56aa96[_0xf84f('0xb')]('binary'),_0xf84f('0x8'));_0x489a51[_0xf84f('0x9')](_0x33936b);_0x489a51[_0xf84f('0xa')]();_0x489a51['on'](_0xf84f('0xc'),function(){return _0x25b35e(_0x29c541);});}catch(_0x5a076c){fs[_0xf84f('0xd')](_0x29c541);return _0x546901(_0x5a076c);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index ee585a9..938fb81 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 _0x70c0=['QueryTypes','dirname','basename','join','mkdirSync','%s%d.%s','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','csv','inspect','Failed','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','split','push'];(function(_0x5c7fcb,_0x42c462){var _0x19dcc4=function(_0x3856c3){while(--_0x3856c3){_0x5c7fcb['push'](_0x5c7fcb['shift']());}};_0x19dcc4(++_0x42c462);}(_0x70c0,0x1f2));var _0x070c=function(_0x3a67fd,_0x55c89f){_0x3a67fd=_0x3a67fd-0x0;var _0x325bf0=_0x70c0[_0x3a67fd];return _0x325bf0;};'use strict';var util=require(_0x070c('0x0'));var path=require(_0x070c('0x1'));var _=require(_0x070c('0x2'));var csv=require(_0x070c('0x3'));var fs=require('fs');var BPromise=require(_0x070c('0x4'));var zipdir=require(_0x070c('0x5'));var rimraf=require(_0x070c('0x6'));var db=require(_0x070c('0x7'))['db'];var dbH=require(_0x070c('0x7'))[_0x070c('0x8')];var logger=require(_0x070c('0x9'))(_0x070c('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x070c('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x2b6940,_0x192bbc){var _0x5c229e={'status':_0x2b6940};var _0x5a0dc9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x192bbc){_0x5c229e[_0x070c('0xc')]=_0x192bbc;}return db[_0x070c('0xd')]['update'](_0x5c229e,_0x5a0dc9);}function main(){var _0x3aabda=0x1388;var _0x211efd;logger[_0x070c('0xe')](util[_0x070c('0xf')](_0x070c('0x10'),EXTRACTED_REPORT_ID,_0x070c('0x11')));return db[_0x070c('0x12')][_0x070c('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x070c('0x14')]})[_0x070c('0x15')](function(_0x551d5f){if(_0x551d5f){_0x211efd=_0x551d5f;_0x3aabda=_0x211efd[_0x070c('0x14')]||0x1388;}})[_0x070c('0x15')](function(){return dbH[_0x070c('0x16')]['query'](util[_0x070c('0xf')](_0x070c('0x17'),QUERY),{'type':dbH[_0x070c('0x16')]['QueryTypes'][_0x070c('0x18')]});})[_0x070c('0x15')](function(_0x3596df){if(!_0x3596df[0x0][_0x070c('0x19')]){return analyticExtractedReport(_0x070c('0x1a'));}var _0x2e5919=[];var _0x47be32=0x0;var _0xa630de=!![];if(_0x3596df&&_0x3596df[_0x070c('0x1b')]){var _0x48297c=_0x3596df[0x0][_0x070c('0x19')]%(_0x47be32+_0x3aabda);if(_0x211efd[_0x070c('0x1c')]){for(;_0xa630de;_0x47be32+=_0x3aabda,_0x48297c=_0x3596df[0x0][_0x070c('0x19')]%(_0x47be32+_0x3aabda)){if(_0x48297c==0x0||_0x48297c==_0x3596df[0x0][_0x070c('0x19')]){_0xa630de=![];}_0x2e5919[_0x070c('0x1d')](dbH[_0x070c('0x16')]['query'](util[_0x070c('0xf')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3aabda,_0x47be32),{'type':dbH[_0x070c('0x16')][_0x070c('0x1e')][_0x070c('0x18')]}));}}else{_0x2e5919['push'](dbH[_0x070c('0x16')]['query'](QUERY,{'type':dbH[_0x070c('0x16')][_0x070c('0x1e')][_0x070c('0x18')]}));}}var _0x3d6844=path[_0x070c('0x1f')](PATH);var _0x54f8e3=path[_0x070c('0x20')](PATH,'.csv');var _0xba7ade=_0x211efd[_0x070c('0x1c')]&&_0x2e5919[_0x070c('0x1b')]>0x1;var _0x3276c2=[];if(!fs['existsSync'](path[_0x070c('0x21')](_0x3d6844,_0x54f8e3))&&_0xba7ade){fs[_0x070c('0x22')](path[_0x070c('0x21')](_0x3d6844,_0x54f8e3));}return BPromise['each'](_0x2e5919,function(_0xde204d){_0x3276c2[_0x070c('0x1d')](_0xde204d);})[_0x070c('0x15')](function(){for(var _0x175369=0x0;_0x175369<_0x3276c2[_0x070c('0x1b')];_0x175369+=0x1){var _0x6c1f68;var _0x449be7=_0x3276c2[_0x175369];if(_0xba7ade){_0x6c1f68=path[_0x070c('0x21')](_0x3d6844,_0x54f8e3,util[_0x070c('0xf')](_0x070c('0x23'),_0x54f8e3,_0x175369,'csv'));}else{_0x6c1f68=path[_0x070c('0x21')](_0x3d6844,util[_0x070c('0xf')](_0x070c('0x24'),_0x54f8e3,'csv'));}fs[_0x070c('0x25')](_0x6c1f68,csv(_0x449be7));}})['then'](function(){if(_0xba7ade){zipdir(path[_0x070c('0x21')](_0x3d6844,_0x54f8e3),{'saveTo':path[_0x070c('0x21')](_0x3d6844,util['format'](_0x070c('0x24'),_0x54f8e3,_0x070c('0x26')))},function(_0x5274b9,_0x39df7c){});rimraf(path['join'](_0x3d6844,_0x54f8e3),function(){});}})[_0x070c('0x15')](function(){logger[_0x070c('0xe')](util[_0x070c('0xf')](_0x070c('0x27'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x070c('0x28'),_0xba7ade?util[_0x070c('0xf')]('%s.%s',_0x54f8e3,_0xba7ade?'zip':_0x070c('0x29')):null);});})['catch'](function(_0x400e23){logger[_0x070c('0xe')](util[_0x070c('0xf')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util[_0x070c('0x2a')](_0x400e23,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x070c('0x2b'));});}main(); \ No newline at end of file +var _0x4b2a=['catch','inspect','Failed','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','Empty','length','num','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push','dirname','basename','split','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0x4b2a,0x11d));var _0xa4b2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4b2a[_0x2641f9];return _0x585741;};'use strict';var util=require(_0xa4b2('0x0'));var path=require(_0xa4b2('0x1'));var _=require(_0xa4b2('0x2'));var csv=require(_0xa4b2('0x3'));var fs=require('fs');var BPromise=require(_0xa4b2('0x4'));var zipdir=require(_0xa4b2('0x5'));var rimraf=require(_0xa4b2('0x6'));var db=require(_0xa4b2('0x7'))['db'];var dbH=require(_0xa4b2('0x7'))[_0xa4b2('0x8')];var logger=require(_0xa4b2('0x9'))(_0xa4b2('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xa4b2('0xb')][0x3];var PATH=process[_0xa4b2('0xb')][0x4];function analyticExtractedReport(_0x5ebae9,_0x279e79){var _0x23d607={'status':_0x5ebae9};var _0x7e0778={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x279e79){_0x23d607['savename']=_0x279e79;}return db['AnalyticExtractedReport'][_0xa4b2('0xc')](_0x23d607,_0x7e0778);}function main(){var _0x2049de=0x1388;var _0x1e2219;logger[_0xa4b2('0xd')](util[_0xa4b2('0xe')](_0xa4b2('0xf'),EXTRACTED_REPORT_ID,_0xa4b2('0x10')));return db[_0xa4b2('0x11')][_0xa4b2('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xa4b2('0x13')]})[_0xa4b2('0x14')](function(_0x219758){if(_0x219758){_0x1e2219=_0x219758;_0x2049de=_0x1e2219['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0xa4b2('0x15')][_0xa4b2('0x16')](util[_0xa4b2('0xe')](_0xa4b2('0x17'),QUERY),{'type':dbH[_0xa4b2('0x15')][_0xa4b2('0x18')]['SELECT']});})[_0xa4b2('0x14')](function(_0x45066b){if(!_0x45066b[0x0]['num']){return analyticExtractedReport(_0xa4b2('0x19'));}var _0x2f699f=[];var _0x5fb211=0x0;var _0x237095=!![];if(_0x45066b&&_0x45066b[_0xa4b2('0x1a')]){var _0xd1ffb4=_0x45066b[0x0][_0xa4b2('0x1b')]%(_0x5fb211+_0x2049de);if(_0x1e2219['split']){for(;_0x237095;_0x5fb211+=_0x2049de,_0xd1ffb4=_0x45066b[0x0][_0xa4b2('0x1b')]%(_0x5fb211+_0x2049de)){if(_0xd1ffb4==0x0||_0xd1ffb4==_0x45066b[0x0]['num']){_0x237095=![];}_0x2f699f['push'](dbH[_0xa4b2('0x15')][_0xa4b2('0x16')](util[_0xa4b2('0xe')](_0xa4b2('0x1c'),QUERY,_0x2049de,_0x5fb211),{'type':dbH[_0xa4b2('0x15')]['QueryTypes'][_0xa4b2('0x1d')]}));}}else{_0x2f699f[_0xa4b2('0x1e')](dbH[_0xa4b2('0x15')][_0xa4b2('0x16')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xa4b2('0x1d')]}));}}var _0x5028d1=path[_0xa4b2('0x1f')](PATH);var _0x274289=path[_0xa4b2('0x20')](PATH,'.csv');var _0x527fa6=_0x1e2219[_0xa4b2('0x21')]&&_0x2f699f[_0xa4b2('0x1a')]>0x1;var _0x23fbf3=[];if(!fs['existsSync'](path[_0xa4b2('0x22')](_0x5028d1,_0x274289))&&_0x527fa6){fs[_0xa4b2('0x23')](path[_0xa4b2('0x22')](_0x5028d1,_0x274289));}return BPromise[_0xa4b2('0x24')](_0x2f699f,function(_0x70886b){_0x23fbf3['push'](_0x70886b);})[_0xa4b2('0x14')](function(){for(var _0x2fe7e2=0x0;_0x2fe7e2<_0x23fbf3[_0xa4b2('0x1a')];_0x2fe7e2+=0x1){var _0x3da8cb;var _0x370da2=_0x23fbf3[_0x2fe7e2];if(_0x527fa6){_0x3da8cb=path[_0xa4b2('0x22')](_0x5028d1,_0x274289,util[_0xa4b2('0xe')](_0xa4b2('0x25'),_0x274289,_0x2fe7e2,_0xa4b2('0x26')));}else{_0x3da8cb=path['join'](_0x5028d1,util[_0xa4b2('0xe')](_0xa4b2('0x27'),_0x274289,_0xa4b2('0x26')));}fs[_0xa4b2('0x28')](_0x3da8cb,csv(_0x370da2));}})[_0xa4b2('0x14')](function(){if(_0x527fa6){zipdir(path[_0xa4b2('0x22')](_0x5028d1,_0x274289),{'saveTo':path['join'](_0x5028d1,util[_0xa4b2('0xe')]('%s.%s',_0x274289,_0xa4b2('0x29')))},function(_0x3b68f1,_0x56d70f){});rimraf(path['join'](_0x5028d1,_0x274289),function(){});}})['then'](function(){logger[_0xa4b2('0xd')](util[_0xa4b2('0xe')](_0xa4b2('0x2a'),EXTRACTED_REPORT_ID,_0xa4b2('0x10')));return analyticExtractedReport(_0xa4b2('0x2b'),_0x527fa6?util['format'](_0xa4b2('0x27'),_0x274289,_0x527fa6?_0xa4b2('0x29'):_0xa4b2('0x26')):null);});})[_0xa4b2('0x2c')](function(_0x411a95){logger[_0xa4b2('0xd')](util[_0xa4b2('0xe')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa4b2('0x10')),util[_0xa4b2('0x2d')](_0x411a95,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xa4b2('0x2e'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index e83e17c..a9b6a87 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 _0x57e3=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','util','path','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','hasOwnProperty','push','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','sequelize','query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','length','existsSync','join','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','landscape','black','body','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','createPdfKitDocument','%s%d.%s','%s.%s','pdf','pipe','createWriteStream','log','err','end','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF'];(function(_0x3c2b2e,_0x3e6e53){var _0x27a338=function(_0x40d29d){while(--_0x40d29d){_0x3c2b2e['push'](_0x3c2b2e['shift']());}};_0x27a338(++_0x3e6e53);}(_0x57e3,0x159));var _0x357e=function(_0x35b8b9,_0xa08e93){_0x35b8b9=_0x35b8b9-0x0;var _0x459faa=_0x57e3[_0x35b8b9];return _0x459faa;};'use strict';var _=require(_0x357e('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0x357e('0x1'));var path=require(_0x357e('0x2'));var moment=require('moment');var PdfPrinter=require(_0x357e('0x3'));var zipdir=require(_0x357e('0x4'));var rimraf=require(_0x357e('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0x357e('0x6'))[_0x357e('0x7')];var logger=require(_0x357e('0x8'))(_0x357e('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x357e('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x357e('0xa')][0x4];var NAME=process[_0x357e('0xa')][0x5];var FORMAT=_0x357e('0xb');var _extractedReport;function analyticExtractedReport(_0x203cc0,_0x48415c){var _0xd616ef={'status':_0x203cc0};var _0x4624a3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x48415c){_0xd616ef[_0x357e('0xc')]=_0x48415c;}return db['AnalyticExtractedReport']['update'](_0xd616ef,_0x4624a3);}function getHeader(_0x15b944){var _0x4fbc7f=[];for(var _0x9c4482 in _0x15b944){if(_0x15b944[_0x357e('0xd')](_0x9c4482)){_0x4fbc7f[_0x357e('0xe')]({'text':_0x9c4482,'style':_0x357e('0xf')});}}return _0x4fbc7f;}function extractReport(_0x5b9fd5){var _0x53f39d=0x1388;var _0x447cd8;if(!_0x5b9fd5[0x0][_0x357e('0x10')]){return analyticExtractedReport(_0x357e('0x11'));}var _0xd7a8cb=[];var _0x32bbc9=0x0;var _0x28f776=!![];var _0x43a690=path[_0x357e('0x12')](PATH);var _0x28da80=path[_0x357e('0x13')](PATH,_0x357e('0x14'));var _0x1cd6c7=![];var _0x524abf=[];return db[_0x357e('0x15')][_0x357e('0x16')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x357e('0x17'),_0x357e('0x18')]})[_0x357e('0x19')](function(_0x5dc091){if(_0x5dc091){_0x447cd8=_0x5dc091;_0x53f39d=_0x447cd8['splitSizePdf']||0x3e8;}})[_0x357e('0x19')](function(){if(_0x5b9fd5&&_0x5b9fd5['length']){var _0x145158=_0x5b9fd5[0x0]['num']%(_0x32bbc9+_0x53f39d);if(_0x447cd8[_0x357e('0x17')]){for(;_0x28f776;_0x32bbc9+=_0x53f39d,_0x145158=_0x5b9fd5[0x0][_0x357e('0x10')]%(_0x32bbc9+_0x53f39d)){if(_0x145158==0x0||_0x145158==_0x5b9fd5[0x0][_0x357e('0x10')]){_0x28f776=![];}_0xd7a8cb[_0x357e('0xe')](dbH[_0x357e('0x1a')][_0x357e('0x1b')](util[_0x357e('0x1c')](_0x357e('0x1d'),QUERY,_0x53f39d,_0x32bbc9),{'type':dbH['sequelize'][_0x357e('0x1e')][_0x357e('0x1f')]}));}}else{_0xd7a8cb[_0x357e('0xe')](dbH[_0x357e('0x1a')]['query'](QUERY,{'type':dbH[_0x357e('0x1a')][_0x357e('0x1e')][_0x357e('0x1f')]}));}}_0x1cd6c7=_0x447cd8['split']&&_0xd7a8cb[_0x357e('0x20')]>0x1;if(!fs[_0x357e('0x21')](path[_0x357e('0x22')](_0x43a690,_0x28da80))&&_0x1cd6c7){fs['mkdirSync'](path['join'](_0x43a690,_0x28da80));}return BPromise[_0x357e('0x23')](_0xd7a8cb,function(_0x1f685b){_0x524abf[_0x357e('0xe')](_0x1f685b);});})[_0x357e('0x19')](function(){return BPromise[_0x357e('0x23')](_0xd7a8cb,function(_0x315f13,_0x3123d3){var _0x557b77;var _0x2eccb5=util[_0x357e('0x1c')](_0x357e('0x24'),NAME,_extractedReport[_0x357e('0x25')],moment(_extractedReport[_0x357e('0x26')])[_0x357e('0x1c')](FORMAT),moment(_extractedReport[_0x357e('0x27')])['format'](FORMAT));var _0x10ed62={'pageSize':'A4','pageOrientation':_0x357e('0x28'),'content':[{'text':_0x2eccb5,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x357e('0x29')}}};var _0x3ba62b={'headerRows':0x1,'body':[]};_0x3ba62b[_0x357e('0x2a')]['push'](getHeader(_0x315f13[0x0]));var _0x207de9;for(var _0x374e18=0x0;_0x374e18<_0x315f13[_0x357e('0x20')];_0x374e18+=0x1){_0x207de9=[];for(var _0xca202d in _0x315f13[_0x374e18]){if(_0x315f13[_0x374e18][_0x357e('0xd')](_0xca202d)){_0x207de9[_0x357e('0xe')](_0x315f13[_0x374e18][_0xca202d]?_[_0x357e('0x2b')](_0x315f13[_0x374e18][_0xca202d]):'');}}_0x3ba62b['body'][_0x357e('0xe')](_0x207de9);}_0x10ed62[_0x357e('0x2c')][_0x357e('0xe')]({'table':_0x3ba62b});return new BPromise(function(_0x509040,_0x44ddb1){var _0x56a7ba=new PdfPrinter({'Roboto':{'normal':__dirname+_0x357e('0x2d'),'bold':__dirname+_0x357e('0x2e'),'italics':__dirname+_0x357e('0x2f'),'bolditalics':__dirname+'/fonts/Roboto-MediumItalic.ttf'}});var _0xa56807=_0x56a7ba[_0x357e('0x30')](_0x10ed62);if(_0x1cd6c7){_0x557b77=path[_0x357e('0x22')](_0x43a690,_0x28da80,util['format'](_0x357e('0x31'),_0x28da80,_0x3123d3,'pdf'));}else{_0x557b77=path[_0x357e('0x22')](_0x43a690,util[_0x357e('0x1c')](_0x357e('0x32'),_0x28da80,_0x357e('0x33')));}var _0x2d90e9=_0xa56807[_0x357e('0x34')](fs[_0x357e('0x35')](_0x557b77));_0x2d90e9['on']('finish',function(){_0x509040();});_0x2d90e9['on']('error',function(_0x2fdcbd){console[_0x357e('0x36')](_0x357e('0x37'),_0x2fdcbd);_0x44ddb1(_0x2fdcbd);});_0xa56807[_0x357e('0x38')]();});});})['then'](function(){if(_0x1cd6c7){return new BPromise(function(_0x38303c,_0x10dbf3){zipdir(path[_0x357e('0x22')](_0x43a690,_0x28da80),{'saveTo':path[_0x357e('0x22')](_0x43a690,util[_0x357e('0x1c')]('%s.%s',_0x28da80,'zip'))},function(_0x42d6ab){if(_0x42d6ab){_0x10dbf3(_0x42d6ab);}else{_0x38303c();}});});}})[_0x357e('0x19')](function(){if(_0x1cd6c7){rimraf(path[_0x357e('0x22')](_0x43a690,_0x28da80),function(){});}})[_0x357e('0x19')](function(){logger[_0x357e('0x39')](util[_0x357e('0x1c')](_0x357e('0x3a'),EXTRACTED_REPORT_ID,_0x357e('0x3b')));return analyticExtractedReport(_0x357e('0x3c'),_0x1cd6c7?util[_0x357e('0x1c')]('%s.%s',_0x28da80,_0x1cd6c7?'zip':_0x357e('0x33')):null);});}function main(){logger[_0x357e('0x39')](util['format'](_0x357e('0x3d'),EXTRACTED_REPORT_ID,_0x357e('0x3e')));return db['AnalyticExtractedReport']['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x357e('0x19')](function(_0x386f06){_extractedReport=_0x386f06;return dbH[_0x357e('0x1a')][_0x357e('0x1b')](util['format'](_0x357e('0x3f'),QUERY),{'type':dbH[_0x357e('0x1a')]['QueryTypes'][_0x357e('0x1f')]});})[_0x357e('0x19')](extractReport)[_0x357e('0x40')](function(_0x29db76){logger[_0x357e('0x39')](util[_0x357e('0x1c')](_0x357e('0x41'),EXTRACTED_REPORT_ID,'PDF'),util[_0x357e('0x42')](_0x29db76,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x357e('0x43'));});}main(); \ No newline at end of file +var _0x6c4f=['endDate','landscape','toString','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','%s.%s','pipe','error','log','err','end','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','pdf','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','bluebird','util','path','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','push','num','Empty','dirname','basename','Setting','find','split','splitSizePdf','then','length','sequelize','query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','existsSync','join','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate'];(function(_0x5c956b,_0xa87d11){var _0xaff46a=function(_0x463d89){while(--_0x463d89){_0x5c956b['push'](_0x5c956b['shift']());}};_0xaff46a(++_0xa87d11);}(_0x6c4f,0x1a0));var _0xf6c4=function(_0x3ba0c4,_0x581790){_0x3ba0c4=_0x3ba0c4-0x0;var _0x1bd690=_0x6c4f[_0x3ba0c4];return _0x1bd690;};'use strict';var _=require('lodash');var fs=require('fs');var BPromise=require(_0xf6c4('0x0'));var util=require(_0xf6c4('0x1'));var path=require(_0xf6c4('0x2'));var moment=require('moment');var PdfPrinter=require(_0xf6c4('0x3'));var zipdir=require(_0xf6c4('0x4'));var rimraf=require(_0xf6c4('0x5'));var db=require(_0xf6c4('0x6'))['db'];var dbH=require(_0xf6c4('0x6'))[_0xf6c4('0x7')];var logger=require(_0xf6c4('0x8'))(_0xf6c4('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xf6c4('0xa')][0x2]);var QUERY=process[_0xf6c4('0xa')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xf6c4('0xa')][0x5];var FORMAT=_0xf6c4('0xb');var _extractedReport;function analyticExtractedReport(_0x3e70ce,_0x3e6351){var _0x5393c6={'status':_0x3e70ce};var _0x5d8eb2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3e6351){_0x5393c6[_0xf6c4('0xc')]=_0x3e6351;}return db[_0xf6c4('0xd')][_0xf6c4('0xe')](_0x5393c6,_0x5d8eb2);}function getHeader(_0x34042e){var _0x58fd2b=[];for(var _0x46ef00 in _0x34042e){if(_0x34042e[_0xf6c4('0xf')](_0x46ef00)){_0x58fd2b[_0xf6c4('0x10')]({'text':_0x46ef00,'style':'tableHeader'});}}return _0x58fd2b;}function extractReport(_0x256adb){var _0xfd6880=0x1388;var _0x4d3f6e;if(!_0x256adb[0x0][_0xf6c4('0x11')]){return analyticExtractedReport(_0xf6c4('0x12'));}var _0x71f131=[];var _0x15d4e2=0x0;var _0x5b0067=!![];var _0x5eadaa=path[_0xf6c4('0x13')](PATH);var _0x2b59b3=path[_0xf6c4('0x14')](PATH,'.pdf');var _0x38f7cb=![];var _0x24a2dc=[];return db[_0xf6c4('0x15')][_0xf6c4('0x16')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf6c4('0x17'),_0xf6c4('0x18')]})[_0xf6c4('0x19')](function(_0x14e822){if(_0x14e822){_0x4d3f6e=_0x14e822;_0xfd6880=_0x4d3f6e['splitSizePdf']||0x3e8;}})['then'](function(){if(_0x256adb&&_0x256adb[_0xf6c4('0x1a')]){var _0x2edb2d=_0x256adb[0x0]['num']%(_0x15d4e2+_0xfd6880);if(_0x4d3f6e[_0xf6c4('0x17')]){for(;_0x5b0067;_0x15d4e2+=_0xfd6880,_0x2edb2d=_0x256adb[0x0][_0xf6c4('0x11')]%(_0x15d4e2+_0xfd6880)){if(_0x2edb2d==0x0||_0x2edb2d==_0x256adb[0x0][_0xf6c4('0x11')]){_0x5b0067=![];}_0x71f131[_0xf6c4('0x10')](dbH[_0xf6c4('0x1b')][_0xf6c4('0x1c')](util[_0xf6c4('0x1d')](_0xf6c4('0x1e'),QUERY,_0xfd6880,_0x15d4e2),{'type':dbH[_0xf6c4('0x1b')]['QueryTypes'][_0xf6c4('0x1f')]}));}}else{_0x71f131[_0xf6c4('0x10')](dbH[_0xf6c4('0x1b')][_0xf6c4('0x1c')](QUERY,{'type':dbH[_0xf6c4('0x1b')][_0xf6c4('0x20')][_0xf6c4('0x1f')]}));}}_0x38f7cb=_0x4d3f6e[_0xf6c4('0x17')]&&_0x71f131[_0xf6c4('0x1a')]>0x1;if(!fs[_0xf6c4('0x21')](path[_0xf6c4('0x22')](_0x5eadaa,_0x2b59b3))&&_0x38f7cb){fs['mkdirSync'](path['join'](_0x5eadaa,_0x2b59b3));}return BPromise[_0xf6c4('0x23')](_0x71f131,function(_0x18ea1e){_0x24a2dc['push'](_0x18ea1e);});})[_0xf6c4('0x19')](function(){return BPromise['each'](_0x71f131,function(_0x13718c,_0x2caf62){var _0x59e30c;var _0x358493=util[_0xf6c4('0x1d')](_0xf6c4('0x24'),NAME,_extractedReport[_0xf6c4('0x25')],moment(_extractedReport[_0xf6c4('0x26')])[_0xf6c4('0x1d')](FORMAT),moment(_extractedReport[_0xf6c4('0x27')])[_0xf6c4('0x1d')](FORMAT));var _0x2ba155={'pageSize':'A4','pageOrientation':_0xf6c4('0x28'),'content':[{'text':_0x358493,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'}}};var _0x206908={'headerRows':0x1,'body':[]};_0x206908['body']['push'](getHeader(_0x13718c[0x0]));var _0xdc994f;for(var _0x1f66cd=0x0;_0x1f66cd<_0x13718c[_0xf6c4('0x1a')];_0x1f66cd+=0x1){_0xdc994f=[];for(var _0x4ba4a3 in _0x13718c[_0x1f66cd]){if(_0x13718c[_0x1f66cd][_0xf6c4('0xf')](_0x4ba4a3)){_0xdc994f[_0xf6c4('0x10')](_0x13718c[_0x1f66cd][_0x4ba4a3]?_[_0xf6c4('0x29')](_0x13718c[_0x1f66cd][_0x4ba4a3]):'');}}_0x206908['body'][_0xf6c4('0x10')](_0xdc994f);}_0x2ba155['content'][_0xf6c4('0x10')]({'table':_0x206908});return new BPromise(function(_0x563fca,_0x5cb0ab){var _0x3ec112=new PdfPrinter({'Roboto':{'normal':__dirname+_0xf6c4('0x2a'),'bold':__dirname+_0xf6c4('0x2b'),'italics':__dirname+'/fonts/Roboto-Italic.ttf','bolditalics':__dirname+_0xf6c4('0x2c')}});var _0x27a5a8=_0x3ec112[_0xf6c4('0x2d')](_0x2ba155);if(_0x38f7cb){_0x59e30c=path[_0xf6c4('0x22')](_0x5eadaa,_0x2b59b3,util[_0xf6c4('0x1d')](_0xf6c4('0x2e'),_0x2b59b3,_0x2caf62,'pdf'));}else{_0x59e30c=path[_0xf6c4('0x22')](_0x5eadaa,util['format'](_0xf6c4('0x2f'),_0x2b59b3,'pdf'));}var _0x38fef2=_0x27a5a8[_0xf6c4('0x30')](fs['createWriteStream'](_0x59e30c));_0x38fef2['on']('finish',function(){_0x563fca();});_0x38fef2['on'](_0xf6c4('0x31'),function(_0x2bc3c7){console[_0xf6c4('0x32')](_0xf6c4('0x33'),_0x2bc3c7);_0x5cb0ab(_0x2bc3c7);});_0x27a5a8[_0xf6c4('0x34')]();});});})[_0xf6c4('0x19')](function(){if(_0x38f7cb){return new BPromise(function(_0x2c7d5d,_0x56487c){zipdir(path['join'](_0x5eadaa,_0x2b59b3),{'saveTo':path['join'](_0x5eadaa,util[_0xf6c4('0x1d')](_0xf6c4('0x2f'),_0x2b59b3,'zip'))},function(_0x2cc323){if(_0x2cc323){_0x56487c(_0x2cc323);}else{_0x2c7d5d();}});});}})[_0xf6c4('0x19')](function(){if(_0x38f7cb){rimraf(path[_0xf6c4('0x22')](_0x5eadaa,_0x2b59b3),function(){});}})[_0xf6c4('0x19')](function(){logger['info'](util[_0xf6c4('0x1d')](_0xf6c4('0x35'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xf6c4('0x36'),_0x38f7cb?util[_0xf6c4('0x1d')]('%s.%s',_0x2b59b3,_0x38f7cb?_0xf6c4('0x37'):_0xf6c4('0x38')):null);});}function main(){logger[_0xf6c4('0x39')](util[_0xf6c4('0x1d')](_0xf6c4('0x3a'),EXTRACTED_REPORT_ID,_0xf6c4('0x3b')));return db[_0xf6c4('0xd')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf6c4('0x19')](function(_0x535281){_extractedReport=_0x535281;return dbH[_0xf6c4('0x1b')][_0xf6c4('0x1c')](util['format'](_0xf6c4('0x3c'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xf6c4('0x1f')]});})[_0xf6c4('0x19')](extractReport)[_0xf6c4('0x3d')](function(_0x591d74){logger['info'](util['format'](_0xf6c4('0x3e'),EXTRACTED_REPORT_ID,'PDF'),util[_0xf6c4('0x3f')](_0x591d74,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xf6c4('0x40'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 1eddfe9..903725d 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 _0xa735=['query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','length','num','SELECT','push','basename','.xlsx','join','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','util','path','json2xls','zip-dir','rimraf','../../mysqldb','dbH','argv','AnalyticExtractedReport','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','split','then','sequelize'];(function(_0x812b4,_0x5c732f){var _0x1b1950=function(_0xfe8cb1){while(--_0xfe8cb1){_0x812b4['push'](_0x812b4['shift']());}};_0x1b1950(++_0x5c732f);}(_0xa735,0x1df));var _0x5a73=function(_0x426b8c,_0x6c0c64){_0x426b8c=_0x426b8c-0x0;var _0x1813ba=_0xa735[_0x426b8c];return _0x1813ba;};'use strict';var util=require(_0x5a73('0x0'));var path=require(_0x5a73('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x5a73('0x2'));var BPromise=require('bluebird');var zipdir=require(_0x5a73('0x3'));var rimraf=require(_0x5a73('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x5a73('0x5'))[_0x5a73('0x6')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x5a73('0x7')][0x2]);var QUERY=process[_0x5a73('0x7')][0x3];var PATH=process[_0x5a73('0x7')][0x4];function analyticExtractedReport(_0x1bf455,_0x548b30){var _0x94ae3f={'status':_0x1bf455};var _0x346877={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x548b30){_0x94ae3f['savename']=_0x548b30;}return db[_0x5a73('0x8')][_0x5a73('0x9')](_0x94ae3f,_0x346877);}function main(){var _0x3fe55e=0x1388;var _0x4519c0;logger['info'](util['format'](_0x5a73('0xa'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x5a73('0xb')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5a73('0xc'),'splitSizeXlsx']})[_0x5a73('0xd')](function(_0x41c36a){if(_0x41c36a){_0x4519c0=_0x41c36a;_0x3fe55e=_0x4519c0['splitSizeXlsx']||0x1388;}})[_0x5a73('0xd')](function(){return dbH[_0x5a73('0xe')][_0x5a73('0xf')](util[_0x5a73('0x10')](_0x5a73('0x11'),QUERY),{'type':dbH['sequelize'][_0x5a73('0x12')]['SELECT']});})[_0x5a73('0xd')](function(_0x2986f7){if(!_0x2986f7[0x0]['num']){return analyticExtractedReport('Empty');}var _0x1733e8=[];var _0x5ef980=0x0;var _0x18f7d0=!![];if(_0x4519c0[_0x5a73('0xc')]){if(_0x2986f7&&_0x2986f7[_0x5a73('0x13')]){var _0x676679=_0x2986f7[0x0][_0x5a73('0x14')]%(_0x5ef980+_0x3fe55e);for(;_0x18f7d0;_0x5ef980+=_0x3fe55e,_0x676679=_0x2986f7[0x0][_0x5a73('0x14')]%(_0x5ef980+_0x3fe55e)){if(_0x676679==0x0||_0x676679==_0x2986f7[0x0][_0x5a73('0x14')]){_0x18f7d0=![];}_0x1733e8['push'](dbH['sequelize'][_0x5a73('0xf')](util[_0x5a73('0x10')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3fe55e,_0x5ef980),{'type':dbH[_0x5a73('0xe')][_0x5a73('0x12')][_0x5a73('0x15')]}));}}}else{_0x1733e8[_0x5a73('0x16')](dbH[_0x5a73('0xe')]['query'](QUERY,{'type':dbH[_0x5a73('0xe')][_0x5a73('0x12')][_0x5a73('0x15')]}));}var _0x3d27c2=path['dirname'](PATH);var _0x14bcaf=path[_0x5a73('0x17')](PATH,_0x5a73('0x18'));var _0x2c02ea=_0x4519c0[_0x5a73('0xc')]&&_0x1733e8['length']>0x1;var _0x53706b=[];if(!fs['existsSync'](path[_0x5a73('0x19')](_0x3d27c2,_0x14bcaf))&&_0x2c02ea){fs['mkdirSync'](path[_0x5a73('0x19')](_0x3d27c2,_0x14bcaf));}return BPromise['each'](_0x1733e8,function(_0x16ee81){_0x53706b[_0x5a73('0x16')](_0x16ee81);})[_0x5a73('0xd')](function(){for(var _0x4f1291=0x0;_0x4f1291<_0x53706b['length'];_0x4f1291+=0x1){var _0x592450;var _0x42f514=_0x53706b[_0x4f1291];if(_0x2c02ea){_0x592450=path['join'](_0x3d27c2,_0x14bcaf,util[_0x5a73('0x10')]('%s%d.%s',_0x14bcaf,_0x4f1291,_0x5a73('0x1a')));}else{_0x592450=path['join'](_0x3d27c2,util[_0x5a73('0x10')](_0x5a73('0x1b'),_0x14bcaf,_0x5a73('0x1a')));}fs[_0x5a73('0x1c')](_0x592450,json2xls(_0x42f514),_0x5a73('0x1d'));}})[_0x5a73('0xd')](function(){if(_0x2c02ea){zipdir(path[_0x5a73('0x19')](_0x3d27c2,_0x14bcaf),{'saveTo':path[_0x5a73('0x19')](_0x3d27c2,util[_0x5a73('0x10')](_0x5a73('0x1b'),_0x14bcaf,_0x5a73('0x1e')))},function(_0x539c62,_0x5afe8c){});rimraf(path[_0x5a73('0x19')](_0x3d27c2,_0x14bcaf),function(){});}})[_0x5a73('0xd')](function(){logger['info'](util[_0x5a73('0x10')](_0x5a73('0x1f'),EXTRACTED_REPORT_ID,_0x5a73('0x20')));return analyticExtractedReport(_0x5a73('0x21'),_0x2c02ea?util[_0x5a73('0x10')](_0x5a73('0x1b'),_0x14bcaf,_0x2c02ea?_0x5a73('0x1e'):_0x5a73('0x1a')):null);});})[_0x5a73('0x22')](function(_0x13d307){logger[_0x5a73('0x23')](util['format'](_0x5a73('0x24'),EXTRACTED_REPORT_ID,_0x5a73('0x20')),util[_0x5a73('0x25')](_0x13d307,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0x293c=['Setting','find','then','splitSizeXlsx','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','length','existsSync','each','%s%d.%s','xlsx','join','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x2ff624,_0x124531){var _0x16d566=function(_0x1ad28a){while(--_0x1ad28a){_0x2ff624['push'](_0x2ff624['shift']());}};_0x16d566(++_0x124531);}(_0x293c,0x135));var _0xc293=function(_0x2955be,_0x17e9c4){_0x2955be=_0x2955be-0x0;var _0x27604b=_0x293c[_0x2955be];return _0x27604b;};'use strict';var util=require('util');var path=require(_0xc293('0x0'));var _=require(_0xc293('0x1'));var fs=require('fs');var json2xls=require(_0xc293('0x2'));var BPromise=require('bluebird');var zipdir=require(_0xc293('0x3'));var rimraf=require(_0xc293('0x4'));var db=require(_0xc293('0x5'))['db'];var dbH=require(_0xc293('0x5'))['dbH'];var logger=require(_0xc293('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xc293('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xc293('0x7')][0x4];function analyticExtractedReport(_0x18aa58,_0x27804d){var _0x432ef8={'status':_0x18aa58};var _0x5f4b04={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x27804d){_0x432ef8[_0xc293('0x8')]=_0x27804d;}return db[_0xc293('0x9')][_0xc293('0xa')](_0x432ef8,_0x5f4b04);}function main(){var _0x2ab91f=0x1388;var _0x26be3b;logger[_0xc293('0xb')](util['format'](_0xc293('0xc'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xc293('0xd')][_0xc293('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})[_0xc293('0xf')](function(_0x23eaec){if(_0x23eaec){_0x26be3b=_0x23eaec;_0x2ab91f=_0x26be3b[_0xc293('0x10')]||0x1388;}})[_0xc293('0xf')](function(){return dbH[_0xc293('0x11')][_0xc293('0x12')](util[_0xc293('0x13')](_0xc293('0x14'),QUERY),{'type':dbH[_0xc293('0x11')][_0xc293('0x15')][_0xc293('0x16')]});})[_0xc293('0xf')](function(_0x56e3ed){if(!_0x56e3ed[0x0][_0xc293('0x17')]){return analyticExtractedReport(_0xc293('0x18'));}var _0xd22923=[];var _0x34f882=0x0;var _0x47ec51=!![];if(_0x26be3b[_0xc293('0x19')]){if(_0x56e3ed&&_0x56e3ed['length']){var _0x21e040=_0x56e3ed[0x0][_0xc293('0x17')]%(_0x34f882+_0x2ab91f);for(;_0x47ec51;_0x34f882+=_0x2ab91f,_0x21e040=_0x56e3ed[0x0]['num']%(_0x34f882+_0x2ab91f)){if(_0x21e040==0x0||_0x21e040==_0x56e3ed[0x0][_0xc293('0x17')]){_0x47ec51=![];}_0xd22923[_0xc293('0x1a')](dbH['sequelize'][_0xc293('0x12')](util['format'](_0xc293('0x1b'),QUERY,_0x2ab91f,_0x34f882),{'type':dbH[_0xc293('0x11')][_0xc293('0x15')][_0xc293('0x16')]}));}}}else{_0xd22923['push'](dbH[_0xc293('0x11')][_0xc293('0x12')](QUERY,{'type':dbH[_0xc293('0x11')][_0xc293('0x15')][_0xc293('0x16')]}));}var _0x5f6c7=path[_0xc293('0x1c')](PATH);var _0x5d2860=path[_0xc293('0x1d')](PATH,_0xc293('0x1e'));var _0x3a7c12=_0x26be3b[_0xc293('0x19')]&&_0xd22923[_0xc293('0x1f')]>0x1;var _0x445b84=[];if(!fs[_0xc293('0x20')](path['join'](_0x5f6c7,_0x5d2860))&&_0x3a7c12){fs['mkdirSync'](path['join'](_0x5f6c7,_0x5d2860));}return BPromise[_0xc293('0x21')](_0xd22923,function(_0x3e0d9f){_0x445b84[_0xc293('0x1a')](_0x3e0d9f);})[_0xc293('0xf')](function(){for(var _0x212901=0x0;_0x212901<_0x445b84[_0xc293('0x1f')];_0x212901+=0x1){var _0x414519;var _0x415508=_0x445b84[_0x212901];if(_0x3a7c12){_0x414519=path['join'](_0x5f6c7,_0x5d2860,util[_0xc293('0x13')](_0xc293('0x22'),_0x5d2860,_0x212901,_0xc293('0x23')));}else{_0x414519=path[_0xc293('0x24')](_0x5f6c7,util[_0xc293('0x13')](_0xc293('0x25'),_0x5d2860,_0xc293('0x23')));}fs[_0xc293('0x26')](_0x414519,json2xls(_0x415508),_0xc293('0x27'));}})[_0xc293('0xf')](function(){if(_0x3a7c12){zipdir(path[_0xc293('0x24')](_0x5f6c7,_0x5d2860),{'saveTo':path[_0xc293('0x24')](_0x5f6c7,util[_0xc293('0x13')]('%s.%s',_0x5d2860,_0xc293('0x28')))},function(_0x1f9bd5,_0x1cea5e){});rimraf(path['join'](_0x5f6c7,_0x5d2860),function(){});}})['then'](function(){logger[_0xc293('0xb')](util[_0xc293('0x13')](_0xc293('0x29'),EXTRACTED_REPORT_ID,_0xc293('0x2a')));return analyticExtractedReport(_0xc293('0x2b'),_0x3a7c12?util['format'](_0xc293('0x25'),_0x5d2860,_0x3a7c12?_0xc293('0x28'):_0xc293('0x23')):null);});})[_0xc293('0x2c')](function(_0x1a1498){logger['info'](util[_0xc293('0x13')](_0xc293('0x2d'),EXTRACTED_REPORT_ID,_0xc293('0x2a')),util['inspect'](_0x1a1498,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index d6431ae..850fbb3 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 _0xa8d9=['toLowerCase','createdAt','updatedAt','interval','*,*,*,*','map','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','hasOwnProperty','priority','extensions','find','push','type','Set','context','VoiceExtensionId','outbound','extension','CDR(destination)=','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','cutdigits','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length'];(function(_0x3ce0d5,_0x203024){var _0x2e5731=function(_0x4be620){while(--_0x4be620){_0x3ce0d5['push'](_0x3ce0d5['shift']());}};_0x2e5731(++_0x203024);}(_0xa8d9,0x1f2));var _0x9a8d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa8d9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x3a3329,_0x28ee5b){var _0x3d3557=this;return _0x3a3329[_0x9a8d('0x0')][_0x9a8d('0x1')][_0x9a8d('0x2')]({'raw':!![]})[_0x9a8d('0x3')](function(_0x44ce2e){_0x3d3557[_0x9a8d('0x4')]=_0x44ce2e;return _0x3a3329['models'][_0x9a8d('0x5')][_0x9a8d('0x2')]({'where':{'IntervalId':_0x28ee5b[_0x9a8d('0x6')]},'raw':!![]});})[_0x9a8d('0x3')](function(_0x5bda0e){return _0x3a3329['models'][_0x9a8d('0x5')][_0x9a8d('0x2')]({'where':{'exten':{'$in':_[_0x9a8d('0x7')](_['map'](_0x5bda0e,_0x9a8d('0x8')))}},'order':[{'raw':_0x9a8d('0x9')}],'raw':!![]});})[_0x9a8d('0x3')](function(_0x6c205e){var _0x311b2a=_['filter'](_0x6c205e,{'priority':'1'});var _0x239085=_[_0x9a8d('0xa')](_0x6c205e,{'isApp':0x1});var _0x42d28f=_[_0x9a8d('0xb')](_0x239085,'exten');var _0x3eb606=[_0x9a8d('0xc'),'playback'];var _0x296b4e=[];var _0x5d66db=[];for(var _0x426df1 in _0x42d28f){if(_0x42d28f[_0x9a8d('0xd')](_0x426df1)){_0x3d3557[_0x9a8d('0xe')]=0x2;_0x3d3557[_0x9a8d('0xf')]=[];_0x3d3557['extension']=_[_0x9a8d('0x10')](_0x311b2a,{'exten':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x8')]});_0x3d3557['extensions'][_0x9a8d('0x11')]({'type':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x12')],'app':_0x9a8d('0x13'),'appdata':util['format']('CDR(type)=%s',_0x42d28f[_0x426df1][0x0][_0x9a8d('0x12')]),'context':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x14')],'exten':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x8')],'priority':_0x3d3557[_0x9a8d('0xe')]++,'VoiceExtensionId':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x15')]});if(_0x42d28f[_0x426df1][0x0][_0x9a8d('0x12')]===_0x9a8d('0x16')){if(_0x3d3557[_0x9a8d('0x17')]){_0x3d3557[_0x9a8d('0xf')][_0x9a8d('0x11')]({'type':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x12')],'app':_0x9a8d('0x13'),'appdata':_0x9a8d('0x18')+(_0x3d3557[_0x9a8d('0x17')]['cutdigits']?_0x9a8d('0x19')+_0x3d3557['extension']['cutdigits']+'}':'${EXTEN}'),'context':_0x42d28f[_0x426df1][0x0]['context'],'exten':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x8')],'priority':_0x3d3557['priority']++,'VoiceExtensionId':_0x42d28f[_0x426df1][0x0]['VoiceExtensionId']});}_0x3d3557[_0x9a8d('0xf')][_0x9a8d('0x11')]({'type':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x12')],'app':_0x9a8d('0x13'),'appdata':'CDR(routeid)='+_0x42d28f[_0x426df1][0x0][_0x9a8d('0x15')],'context':_0x42d28f[_0x426df1][0x0]['context'],'exten':_0x42d28f[_0x426df1][0x0]['exten'],'priority':_0x3d3557[_0x9a8d('0xe')]++,'VoiceExtensionId':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x15')]});var _0x35d0a6=_0x3d3557[_0x9a8d('0xe')]++;_0x3d3557[_0x9a8d('0xf')][_0x9a8d('0x11')]({'type':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x12')],'app':_0x9a8d('0x1a'),'appdata':_0x9a8d('0x1b')+(_0x35d0a6+0x2)+'):Goto('+(_0x35d0a6+0x1)+')','context':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x14')],'exten':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x8')],'priority':_0x35d0a6,'VoiceExtensionId':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x15')]});if(_0x3d3557[_0x9a8d('0x17')]){_0x3d3557[_0x9a8d('0xf')][_0x9a8d('0x11')]({'type':_0x42d28f[_0x426df1][0x0]['type'],'app':'Set','appdata':_0x3d3557['extension']['cutdigits']?_0x9a8d('0x1c')+_0x3d3557[_0x9a8d('0x17')][_0x9a8d('0x1d')]+'}':_0x9a8d('0x1e'),'context':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x14')],'exten':_0x42d28f[_0x426df1][0x0]['exten'],'priority':_0x3d3557[_0x9a8d('0xe')]++,'VoiceExtensionId':_0x42d28f[_0x426df1][0x0]['VoiceExtensionId']});}_0x3d3557[_0x9a8d('0xf')]['push']({'type':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x12')],'app':_0x9a8d('0x13'),'appdata':'outboundrouteid='+_0x42d28f[_0x426df1][0x0][_0x9a8d('0x15')],'context':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x14')],'exten':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x8')],'priority':_0x3d3557[_0x9a8d('0xe')]++,'VoiceExtensionId':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x15')]});if(_0x3d3557['extension']&&_0x3d3557[_0x9a8d('0x17')][_0x9a8d('0xd')](_0x9a8d('0x1f'))&&_0x3d3557['extension'][_0x9a8d('0x1f')]!==_0x9a8d('0x20')){_0x3d3557[_0x9a8d('0xf')][_0x9a8d('0x11')]({'type':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x12')],'app':_0x9a8d('0x13'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x14')],'exten':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x8')],'priority':_0x3d3557[_0x9a8d('0xe')]++,'VoiceExtensionId':_0x42d28f[_0x426df1][0x0]['VoiceExtensionId']});_0x3d3557[_0x9a8d('0xf')][_0x9a8d('0x11')]({'type':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x12')],'app':_0x9a8d('0x13'),'appdata':_0x9a8d('0x21')+_0x3d3557[_0x9a8d('0x17')]['recordingFormat']||'wav','context':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x14')],'exten':_0x42d28f[_0x426df1][0x0]['exten'],'priority':_0x3d3557[_0x9a8d('0xe')]++,'VoiceExtensionId':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x15')]});}}_0x3d3557[_0x9a8d('0xf')][_0x9a8d('0x11')]({'type':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x12')],'app':'Set','appdata':_0x9a8d('0x22'),'context':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x14')],'exten':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x8')],'priority':_0x3d3557[_0x9a8d('0xe')]++,'VoiceExtensionId':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x15')]});_0x3d3557['extensions'][_0x9a8d('0x11')]({'type':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x12')],'app':_0x9a8d('0x13'),'appdata':_0x9a8d('0x23'),'context':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x14')],'exten':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x8')],'priority':_0x3d3557[_0x9a8d('0xe')]++,'VoiceExtensionId':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x15')]});_0x3d3557['extensions'][_0x9a8d('0x11')]({'type':_0x42d28f[_0x426df1][0x0]['type'],'app':_0x9a8d('0x13'),'appdata':_0x9a8d('0x24'),'context':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x14')],'exten':_0x42d28f[_0x426df1][0x0]['exten'],'priority':_0x3d3557[_0x9a8d('0xe')]++,'VoiceExtensionId':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x15')]});for(var _0x45b9fc=0x0,_0x3328c0=0x0;_0x45b9fc<_0x42d28f[_0x426df1][_0x9a8d('0x25')];_0x45b9fc+=0x1,_0x3328c0=0x0){var _0x4ddf5d=_0x42d28f[_0x426df1][_0x45b9fc];if(_0x4ddf5d[_0x9a8d('0x12')]){_0x4ddf5d[_0x9a8d('0x12')]=_0x4ddf5d[_0x9a8d('0x12')][_0x9a8d('0x26')]();}var _0x1e04b9=[];var _0x49ee59=[];delete _0x4ddf5d['id'];delete _0x4ddf5d[_0x9a8d('0x27')];delete _0x4ddf5d[_0x9a8d('0x28')];var _0x268899=_0x4ddf5d[_0x9a8d('0x29')]!==_0x9a8d('0x2a')?[_0x4ddf5d['interval']]:_0x4ddf5d[_0x9a8d('0x6')]?_[_0x9a8d('0x2b')](_[_0x9a8d('0xa')](_0x3d3557[_0x9a8d('0x4')],{'IntervalId':_0x4ddf5d[_0x9a8d('0x6')]}),'interval'):[];if(_0x4ddf5d[_0x9a8d('0xd')](_0x9a8d('0x2c'))){if(_0x4ddf5d['tag']&&_0x4ddf5d[_0x9a8d('0x2c')]!=='--'){_0x1e04b9[_0x9a8d('0x11')]({'type':_0x4ddf5d['type'],'app':_0x9a8d('0x13'),'appdata':_0x9a8d('0x2d')+_0x4ddf5d['tag'],'context':_0x4ddf5d['context'],'exten':_0x4ddf5d[_0x9a8d('0x8')],'priority':_0x268899[_0x9a8d('0x25')]+_0x3d3557[_0x9a8d('0xe')]+_0x3328c0++,'VoiceExtensionId':_0x4ddf5d[_0x9a8d('0x15')]});}}if(_0x4ddf5d[_0x9a8d('0x12')]===_0x9a8d('0x16')&&_0x4ddf5d['hasOwnProperty'](_0x9a8d('0x2e'))){if(_0x4ddf5d[_0x9a8d('0x2e')]){_0x1e04b9[_0x9a8d('0x11')]({'type':_0x4ddf5d[_0x9a8d('0x12')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x4ddf5d[_0x9a8d('0x2e')]+')','context':_0x4ddf5d['context'],'exten':_0x4ddf5d[_0x9a8d('0x8')],'priority':_0x268899[_0x9a8d('0x25')]+_0x3d3557[_0x9a8d('0xe')]+_0x3328c0++,'VoiceExtensionId':_0x4ddf5d['VoiceExtensionId']});}else{_0x1e04b9[_0x9a8d('0x11')]({'type':_0x4ddf5d[_0x9a8d('0x12')],'app':_0x9a8d('0x1a'),'appdata':_0x9a8d('0x2f'),'context':_0x4ddf5d[_0x9a8d('0x14')],'exten':_0x4ddf5d[_0x9a8d('0x8')],'priority':_0x268899[_0x9a8d('0x25')]+_0x3d3557[_0x9a8d('0xe')]+_0x3328c0++,'VoiceExtensionId':_0x4ddf5d['VoiceExtensionId']});}}if(_0x4ddf5d[_0x9a8d('0xd')](_0x9a8d('0x30'))){if(_0x3eb606['indexOf'](_0x4ddf5d[_0x9a8d('0x31')][_0x9a8d('0x26')]())>=0x0&&_0x4ddf5d['appType']!==_0x9a8d('0x32')){if(_0x4ddf5d[_0x9a8d('0x30')]){_0x1e04b9[_0x9a8d('0x11')]({'type':_0x4ddf5d[_0x9a8d('0x12')],'app':_0x9a8d('0x1a'),'appdata':_0x9a8d('0x33'),'context':_0x4ddf5d[_0x9a8d('0x14')],'exten':_0x4ddf5d['exten'],'priority':_0x268899['length']+_0x3d3557['priority']+_0x3328c0++,'VoiceExtensionId':_0x4ddf5d[_0x9a8d('0x15')]});_0x1e04b9[_0x9a8d('0x11')]({'type':_0x4ddf5d[_0x9a8d('0x12')],'app':'Set','appdata':_0x9a8d('0x34'),'context':_0x4ddf5d[_0x9a8d('0x14')],'exten':_0x4ddf5d[_0x9a8d('0x8')],'priority':_0x268899[_0x9a8d('0x25')]+_0x3d3557[_0x9a8d('0xe')]+_0x3328c0++,'VoiceExtensionId':_0x4ddf5d[_0x9a8d('0x15')]});}else{_0x1e04b9['push']({'type':_0x4ddf5d[_0x9a8d('0x12')],'app':'ExecIf','appdata':_0x9a8d('0x35'),'context':_0x4ddf5d[_0x9a8d('0x14')],'exten':_0x4ddf5d[_0x9a8d('0x8')],'priority':_0x268899[_0x9a8d('0x25')]+_0x3d3557[_0x9a8d('0xe')]+_0x3328c0++,'VoiceExtensionId':_0x4ddf5d[_0x9a8d('0x15')]});_0x1e04b9['push']({'type':_0x4ddf5d[_0x9a8d('0x12')],'app':_0x9a8d('0x13'),'appdata':_0x9a8d('0x36'),'context':_0x4ddf5d['context'],'exten':_0x4ddf5d[_0x9a8d('0x8')],'priority':_0x268899['length']+_0x3d3557[_0x9a8d('0xe')]+_0x3328c0++,'VoiceExtensionId':_0x4ddf5d['VoiceExtensionId']});}}}for(var _0x1cff72=0x0;_0x1cff72<_0x268899[_0x9a8d('0x25')];_0x1cff72+=0x1){var _0x24251c=_0x3d3557[_0x9a8d('0xe')]+_0x268899['length'];var _0x2240f8=_0x1cff72===_0x268899['length']-0x1?_0x3d3557[_0x9a8d('0xe')]+_0x1e04b9[_0x9a8d('0x25')]+_0x49ee59[_0x9a8d('0x25')]+0x2:_0x3d3557[_0x9a8d('0xe')]+_0x1cff72+0x1;_0x1e04b9[_0x9a8d('0x37')](_0x1cff72,0x0,{'type':_0x4ddf5d[_0x9a8d('0x12')],'app':_0x9a8d('0x38'),'appdata':_0x268899[_0x1cff72]+'?'+_0x4ddf5d[_0x9a8d('0x14')]+_0x9a8d('0x39')+_0x24251c+':'+_0x4ddf5d[_0x9a8d('0x14')]+',${EXTEN},'+_0x2240f8,'exten':_0x4ddf5d['exten'],'context':_0x4ddf5d[_0x9a8d('0x14')],'priority':_0x3d3557['priority']+_0x1cff72,'VoiceExtensionId':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x15')]});}_0x4ddf5d['priority']=_0x1e04b9[_0x9a8d('0x25')]?_[_0x9a8d('0x3a')](_0x1e04b9)[_0x9a8d('0xe')]+0x1:_0x3d3557['priority'];_0x3d3557[_0x9a8d('0xe')]=(_0x49ee59['length']?_[_0x9a8d('0x3a')](_0x49ee59)[_0x9a8d('0xe')]:_0x4ddf5d['priority'])+0x1;_0x3d3557[_0x9a8d('0xf')]=_['concat'](_0x3d3557['extensions'],_0x1e04b9,[_0x4ddf5d],_0x49ee59);}_0x3d3557['extensions']['push']({'type':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x12')],'app':_0x9a8d('0x3b'),'exten':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x8')],'context':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x14')],'priority':_0x3d3557[_0x9a8d('0xe')],'VoiceExtensionId':_0x42d28f[_0x426df1][0x0][_0x9a8d('0x15')]});_0x296b4e[_0x9a8d('0x11')](_0x42d28f[_0x426df1][0x0][_0x9a8d('0x15')]);_0x5d66db=_['concat'](_0x5d66db,_0x3d3557[_0x9a8d('0xf')]);}}return _0x3a3329[_0x9a8d('0x3c')](function(_0x22606a){return _0x3a3329['models'][_0x9a8d('0x5')][_0x9a8d('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x296b4e}},'transaction':_0x22606a})[_0x9a8d('0x3')](function(_0x480ab1){return _0x3a3329[_0x9a8d('0x0')][_0x9a8d('0x5')][_0x9a8d('0x3e')](_[_0x9a8d('0x3f')](_0x5d66db,_0x9a8d('0xe')),{'transaction':_0x22606a});});});})[_0x9a8d('0x40')](function(_0x3d4a97){console[_0x9a8d('0x41')](_0x3d4a97);});}exports[_0x9a8d('0x42')]=rewrite; \ No newline at end of file +var _0x0e68=['createdAt','updatedAt','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','hasOwnProperty','priority','find','extensions','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','extension','CDR(destination)=','${EXTEN:','push','CDR(routeid)=','ExecIf','):Goto(','cutdigits','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase'];(function(_0x311a06,_0x58073f){var _0x373deb=function(_0x261d14){while(--_0x261d14){_0x311a06['push'](_0x311a06['shift']());}};_0x373deb(++_0x58073f);}(_0x0e68,0x66));var _0x80e6=function(_0x1ea855,_0x26f59f){_0x1ea855=_0x1ea855-0x0;var _0x4f1e6a=_0x0e68[_0x1ea855];return _0x4f1e6a;};'use strict';var _=require(_0x80e6('0x0'));var util=require(_0x80e6('0x1'));function rewrite(_0x4e8607,_0x434464){var _0x12b6f7=this;return _0x4e8607[_0x80e6('0x2')][_0x80e6('0x3')][_0x80e6('0x4')]({'raw':!![]})[_0x80e6('0x5')](function(_0x22baf0){_0x12b6f7[_0x80e6('0x6')]=_0x22baf0;return _0x4e8607[_0x80e6('0x2')][_0x80e6('0x7')][_0x80e6('0x4')]({'where':{'IntervalId':_0x434464['IntervalId']},'raw':!![]});})[_0x80e6('0x5')](function(_0x4fe2a0){return _0x4e8607[_0x80e6('0x2')][_0x80e6('0x7')][_0x80e6('0x4')]({'where':{'exten':{'$in':_[_0x80e6('0x8')](_[_0x80e6('0x9')](_0x4fe2a0,'exten'))}},'order':[{'raw':_0x80e6('0xa')}],'raw':!![]});})[_0x80e6('0x5')](function(_0x2d637a){var _0x33504b=_['filter'](_0x2d637a,{'priority':'1'});var _0x25271d=_[_0x80e6('0xb')](_0x2d637a,{'isApp':0x1});var _0x765a11=_[_0x80e6('0xc')](_0x25271d,_0x80e6('0xd'));var _0x5305ea=['queue','playback'];var _0x1f85b0=[];var _0x18fd7f=[];for(var _0x5bc96c in _0x765a11){if(_0x765a11[_0x80e6('0xe')](_0x5bc96c)){_0x12b6f7[_0x80e6('0xf')]=0x2;_0x12b6f7['extensions']=[];_0x12b6f7['extension']=_[_0x80e6('0x10')](_0x33504b,{'exten':_0x765a11[_0x5bc96c][0x0][_0x80e6('0xd')]});_0x12b6f7[_0x80e6('0x11')]['push']({'type':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x12')],'app':_0x80e6('0x13'),'appdata':util[_0x80e6('0x14')](_0x80e6('0x15'),_0x765a11[_0x5bc96c][0x0][_0x80e6('0x12')]),'context':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x16')],'exten':_0x765a11[_0x5bc96c][0x0]['exten'],'priority':_0x12b6f7[_0x80e6('0xf')]++,'VoiceExtensionId':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x17')]});if(_0x765a11[_0x5bc96c][0x0][_0x80e6('0x12')]==='outbound'){if(_0x12b6f7[_0x80e6('0x18')]){_0x12b6f7['extensions']['push']({'type':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x12')],'app':'Set','appdata':_0x80e6('0x19')+(_0x12b6f7[_0x80e6('0x18')]['cutdigits']?_0x80e6('0x1a')+_0x12b6f7[_0x80e6('0x18')]['cutdigits']+'}':'${EXTEN}'),'context':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x16')],'exten':_0x765a11[_0x5bc96c][0x0][_0x80e6('0xd')],'priority':_0x12b6f7[_0x80e6('0xf')]++,'VoiceExtensionId':_0x765a11[_0x5bc96c][0x0]['VoiceExtensionId']});}_0x12b6f7[_0x80e6('0x11')][_0x80e6('0x1b')]({'type':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x12')],'app':_0x80e6('0x13'),'appdata':_0x80e6('0x1c')+_0x765a11[_0x5bc96c][0x0]['VoiceExtensionId'],'context':_0x765a11[_0x5bc96c][0x0]['context'],'exten':_0x765a11[_0x5bc96c][0x0][_0x80e6('0xd')],'priority':_0x12b6f7[_0x80e6('0xf')]++,'VoiceExtensionId':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x17')]});var _0x184a1c=_0x12b6f7[_0x80e6('0xf')]++;_0x12b6f7[_0x80e6('0x11')]['push']({'type':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x12')],'app':_0x80e6('0x1d'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x184a1c+0x2)+_0x80e6('0x1e')+(_0x184a1c+0x1)+')','context':_0x765a11[_0x5bc96c][0x0]['context'],'exten':_0x765a11[_0x5bc96c][0x0][_0x80e6('0xd')],'priority':_0x184a1c,'VoiceExtensionId':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x17')]});if(_0x12b6f7[_0x80e6('0x18')]){_0x12b6f7['extensions'][_0x80e6('0x1b')]({'type':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x12')],'app':'Set','appdata':_0x12b6f7[_0x80e6('0x18')][_0x80e6('0x1f')]?'CDR(prefix)=${EXTEN:0:'+_0x12b6f7[_0x80e6('0x18')][_0x80e6('0x1f')]+'}':_0x80e6('0x20'),'context':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x16')],'exten':_0x765a11[_0x5bc96c][0x0][_0x80e6('0xd')],'priority':_0x12b6f7[_0x80e6('0xf')]++,'VoiceExtensionId':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x17')]});}_0x12b6f7[_0x80e6('0x11')]['push']({'type':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x12')],'app':_0x80e6('0x13'),'appdata':_0x80e6('0x21')+_0x765a11[_0x5bc96c][0x0]['VoiceExtensionId'],'context':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x16')],'exten':_0x765a11[_0x5bc96c][0x0][_0x80e6('0xd')],'priority':_0x12b6f7[_0x80e6('0xf')]++,'VoiceExtensionId':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x17')]});if(_0x12b6f7[_0x80e6('0x18')]&&_0x12b6f7[_0x80e6('0x18')][_0x80e6('0xe')](_0x80e6('0x22'))&&_0x12b6f7[_0x80e6('0x18')][_0x80e6('0x22')]!=='none'){_0x12b6f7['extensions'][_0x80e6('0x1b')]({'type':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x12')],'app':_0x80e6('0x13'),'appdata':_0x80e6('0x23'),'context':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x16')],'exten':_0x765a11[_0x5bc96c][0x0][_0x80e6('0xd')],'priority':_0x12b6f7['priority']++,'VoiceExtensionId':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x17')]});_0x12b6f7[_0x80e6('0x11')][_0x80e6('0x1b')]({'type':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x12')],'app':_0x80e6('0x13'),'appdata':_0x80e6('0x24')+_0x12b6f7[_0x80e6('0x18')]['recordingFormat']||_0x80e6('0x25'),'context':_0x765a11[_0x5bc96c][0x0]['context'],'exten':_0x765a11[_0x5bc96c][0x0][_0x80e6('0xd')],'priority':_0x12b6f7[_0x80e6('0xf')]++,'VoiceExtensionId':_0x765a11[_0x5bc96c][0x0]['VoiceExtensionId']});}}_0x12b6f7['extensions'][_0x80e6('0x1b')]({'type':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x12')],'app':_0x80e6('0x13'),'appdata':_0x80e6('0x26'),'context':_0x765a11[_0x5bc96c][0x0]['context'],'exten':_0x765a11[_0x5bc96c][0x0][_0x80e6('0xd')],'priority':_0x12b6f7[_0x80e6('0xf')]++,'VoiceExtensionId':_0x765a11[_0x5bc96c][0x0]['VoiceExtensionId']});_0x12b6f7['extensions']['push']({'type':_0x765a11[_0x5bc96c][0x0]['type'],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x16')],'exten':_0x765a11[_0x5bc96c][0x0][_0x80e6('0xd')],'priority':_0x12b6f7[_0x80e6('0xf')]++,'VoiceExtensionId':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x17')]});_0x12b6f7[_0x80e6('0x11')][_0x80e6('0x1b')]({'type':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x12')],'app':'Set','appdata':_0x80e6('0x27'),'context':_0x765a11[_0x5bc96c][0x0]['context'],'exten':_0x765a11[_0x5bc96c][0x0]['exten'],'priority':_0x12b6f7['priority']++,'VoiceExtensionId':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x17')]});for(var _0x389562=0x0,_0x539509=0x0;_0x389562<_0x765a11[_0x5bc96c][_0x80e6('0x28')];_0x389562+=0x1,_0x539509=0x0){var _0x5ea839=_0x765a11[_0x5bc96c][_0x389562];if(_0x5ea839[_0x80e6('0x12')]){_0x5ea839[_0x80e6('0x12')]=_0x5ea839[_0x80e6('0x12')][_0x80e6('0x29')]();}var _0x4d8828=[];var _0x5dda73=[];delete _0x5ea839['id'];delete _0x5ea839[_0x80e6('0x2a')];delete _0x5ea839[_0x80e6('0x2b')];var _0x16edbe=_0x5ea839[_0x80e6('0x2c')]!==_0x80e6('0x2d')?[_0x5ea839['interval']]:_0x5ea839[_0x80e6('0x2e')]?_[_0x80e6('0x9')](_[_0x80e6('0xb')](_0x12b6f7[_0x80e6('0x6')],{'IntervalId':_0x5ea839[_0x80e6('0x2e')]}),'interval'):[];if(_0x5ea839[_0x80e6('0xe')]('tag')){if(_0x5ea839['tag']&&_0x5ea839[_0x80e6('0x2f')]!=='--'){_0x4d8828['push']({'type':_0x5ea839[_0x80e6('0x12')],'app':_0x80e6('0x13'),'appdata':_0x80e6('0x30')+_0x5ea839[_0x80e6('0x2f')],'context':_0x5ea839[_0x80e6('0x16')],'exten':_0x5ea839[_0x80e6('0xd')],'priority':_0x16edbe[_0x80e6('0x28')]+_0x12b6f7[_0x80e6('0xf')]+_0x539509++,'VoiceExtensionId':_0x5ea839[_0x80e6('0x17')]});}}if(_0x5ea839['type']===_0x80e6('0x31')&&_0x5ea839[_0x80e6('0xe')](_0x80e6('0x32'))){if(_0x5ea839[_0x80e6('0x32')]){_0x4d8828[_0x80e6('0x1b')]({'type':_0x5ea839['type'],'app':_0x80e6('0x1d'),'appdata':_0x80e6('0x33')+_0x5ea839['callerID']+')','context':_0x5ea839[_0x80e6('0x16')],'exten':_0x5ea839[_0x80e6('0xd')],'priority':_0x16edbe['length']+_0x12b6f7[_0x80e6('0xf')]+_0x539509++,'VoiceExtensionId':_0x5ea839[_0x80e6('0x17')]});}else{_0x4d8828[_0x80e6('0x1b')]({'type':_0x5ea839[_0x80e6('0x12')],'app':_0x80e6('0x1d'),'appdata':_0x80e6('0x34'),'context':_0x5ea839[_0x80e6('0x16')],'exten':_0x5ea839[_0x80e6('0xd')],'priority':_0x16edbe['length']+_0x12b6f7[_0x80e6('0xf')]+_0x539509++,'VoiceExtensionId':_0x5ea839[_0x80e6('0x17')]});}}if(_0x5ea839['hasOwnProperty'](_0x80e6('0x35'))){if(_0x5305ea[_0x80e6('0x36')](_0x5ea839[_0x80e6('0x37')][_0x80e6('0x29')]())>=0x0&&_0x5ea839[_0x80e6('0x38')]!=='custom'){if(_0x5ea839[_0x80e6('0x35')]){_0x4d8828['push']({'type':_0x5ea839[_0x80e6('0x12')],'app':_0x80e6('0x1d'),'appdata':_0x80e6('0x39'),'context':_0x5ea839[_0x80e6('0x16')],'exten':_0x5ea839[_0x80e6('0xd')],'priority':_0x16edbe[_0x80e6('0x28')]+_0x12b6f7[_0x80e6('0xf')]+_0x539509++,'VoiceExtensionId':_0x5ea839['VoiceExtensionId']});_0x4d8828['push']({'type':_0x5ea839[_0x80e6('0x12')],'app':_0x80e6('0x13'),'appdata':_0x80e6('0x3a'),'context':_0x5ea839[_0x80e6('0x16')],'exten':_0x5ea839['exten'],'priority':_0x16edbe[_0x80e6('0x28')]+_0x12b6f7[_0x80e6('0xf')]+_0x539509++,'VoiceExtensionId':_0x5ea839[_0x80e6('0x17')]});}else{_0x4d8828[_0x80e6('0x1b')]({'type':_0x5ea839[_0x80e6('0x12')],'app':_0x80e6('0x1d'),'appdata':_0x80e6('0x3b'),'context':_0x5ea839[_0x80e6('0x16')],'exten':_0x5ea839[_0x80e6('0xd')],'priority':_0x16edbe[_0x80e6('0x28')]+_0x12b6f7['priority']+_0x539509++,'VoiceExtensionId':_0x5ea839[_0x80e6('0x17')]});_0x4d8828[_0x80e6('0x1b')]({'type':_0x5ea839['type'],'app':_0x80e6('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x5ea839[_0x80e6('0x16')],'exten':_0x5ea839['exten'],'priority':_0x16edbe[_0x80e6('0x28')]+_0x12b6f7[_0x80e6('0xf')]+_0x539509++,'VoiceExtensionId':_0x5ea839[_0x80e6('0x17')]});}}}for(var _0x15b7b7=0x0;_0x15b7b7<_0x16edbe[_0x80e6('0x28')];_0x15b7b7+=0x1){var _0x1fc473=_0x12b6f7[_0x80e6('0xf')]+_0x16edbe[_0x80e6('0x28')];var _0x5e315e=_0x15b7b7===_0x16edbe[_0x80e6('0x28')]-0x1?_0x12b6f7['priority']+_0x4d8828[_0x80e6('0x28')]+_0x5dda73[_0x80e6('0x28')]+0x2:_0x12b6f7['priority']+_0x15b7b7+0x1;_0x4d8828[_0x80e6('0x3c')](_0x15b7b7,0x0,{'type':_0x5ea839[_0x80e6('0x12')],'app':'GotoIfTime','appdata':_0x16edbe[_0x15b7b7]+'?'+_0x5ea839['context']+_0x80e6('0x3d')+_0x1fc473+':'+_0x5ea839[_0x80e6('0x16')]+_0x80e6('0x3d')+_0x5e315e,'exten':_0x5ea839['exten'],'context':_0x5ea839['context'],'priority':_0x12b6f7['priority']+_0x15b7b7,'VoiceExtensionId':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x17')]});}_0x5ea839[_0x80e6('0xf')]=_0x4d8828[_0x80e6('0x28')]?_[_0x80e6('0x3e')](_0x4d8828)[_0x80e6('0xf')]+0x1:_0x12b6f7[_0x80e6('0xf')];_0x12b6f7[_0x80e6('0xf')]=(_0x5dda73[_0x80e6('0x28')]?_[_0x80e6('0x3e')](_0x5dda73)['priority']:_0x5ea839[_0x80e6('0xf')])+0x1;_0x12b6f7['extensions']=_[_0x80e6('0x3f')](_0x12b6f7[_0x80e6('0x11')],_0x4d8828,[_0x5ea839],_0x5dda73);}_0x12b6f7[_0x80e6('0x11')][_0x80e6('0x1b')]({'type':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x12')],'app':_0x80e6('0x40'),'exten':_0x765a11[_0x5bc96c][0x0]['exten'],'context':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x16')],'priority':_0x12b6f7['priority'],'VoiceExtensionId':_0x765a11[_0x5bc96c][0x0][_0x80e6('0x17')]});_0x1f85b0[_0x80e6('0x1b')](_0x765a11[_0x5bc96c][0x0][_0x80e6('0x17')]);_0x18fd7f=_[_0x80e6('0x3f')](_0x18fd7f,_0x12b6f7[_0x80e6('0x11')]);}}return _0x4e8607[_0x80e6('0x41')](function(_0x219435){return _0x4e8607[_0x80e6('0x2')]['VoiceExtension'][_0x80e6('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x1f85b0}},'transaction':_0x219435})[_0x80e6('0x5')](function(_0x13376c){return _0x4e8607[_0x80e6('0x2')][_0x80e6('0x7')][_0x80e6('0x43')](_[_0x80e6('0x44')](_0x18fd7f,_0x80e6('0xf')),{'transaction':_0x219435});});});})[_0x80e6('0x45')](function(_0x57a672){console[_0x80e6('0x46')](_0x57a672);});}exports[_0x80e6('0x47')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index aa064c1..557c227 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 _0x7851=['CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','socket.io-emitter','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','errors','length','map','message','join','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','CmContact','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','scheduledAt','ContactId','createdAt','field','NOW()','from','cm_contacts','where','ListId\x20=\x20?','toString','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','fromQuery','updatedAt','select','deletedAt\x20IS\x20NULL','id\x20IN\x20?','cm_hopper_final','str','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','BlackLists','Campaign','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','pause'];(function(_0x480ccc,_0x1d99c9){var _0x321595=function(_0x229936){while(--_0x229936){_0x480ccc['push'](_0x480ccc['shift']());}};_0x321595(++_0x1d99c9);}(_0x7851,0xd0));var _0x1785=function(_0x383113,_0x416b37){_0x383113=_0x383113-0x0;var _0x37564a=_0x7851[_0x383113];return _0x37564a;};'use strict';var BPromise=require(_0x1785('0x0'));var util=require(_0x1785('0x1'));var _=require(_0x1785('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x1785('0x3'));var Redis=require(_0x1785('0x4'));var db=require(_0x1785('0x5'))['db'];var config=require(_0x1785('0x6'));var logger=require(_0x1785('0x7'))(_0x1785('0x8'));config[_0x1785('0x9')]=_[_0x1785('0xa')](config[_0x1785('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x1785('0xb'))(new Redis(config[_0x1785('0x9')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x1785('0xc')][0x2]||process[_0x1785('0xc')][0x2]===_0x1785('0xd')||process[_0x1785('0xc')][0x2]==='null'){throw new Error(_0x1785('0xe'));}var FILEPATH=process['argv'][0x2];if(!process[_0x1785('0xc')][0x3]||process[_0x1785('0xc')][0x3]===_0x1785('0xd')||process[_0x1785('0xc')][0x3]===_0x1785('0xf')||!process[_0x1785('0xc')][0x4]||process[_0x1785('0xc')][0x4]===_0x1785('0xd')||process[_0x1785('0xc')][0x4]==='null'){throw new Error(_0x1785('0x10'));}var FIELDS=_['zipObject'](process[_0x1785('0xc')][0x3][_0x1785('0x11')](','),process[_0x1785('0xc')][0x4][_0x1785('0x11')](','));if(!process['argv'][0x5]||process[_0x1785('0xc')][0x5]==='undefined'||process[_0x1785('0xc')][0x5]===_0x1785('0xf')){throw new Error(_0x1785('0x12'));}var LISTID=process[_0x1785('0xc')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x1785('0xc')][0x6]!==_0x1785('0xd')&&process['argv'][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process[_0x1785('0xc')][0x7]&&process[_0x1785('0xc')][0x7]!==_0x1785('0xd')&&process[_0x1785('0xc')][0x7]!==_0x1785('0xf')?process[_0x1785('0xc')][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]===_0x1785('0xd')||process[_0x1785('0xc')][0x8]===_0x1785('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x410574){logger[_0x1785('0x13')](_0x410574);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(_0x270899,_0x25b5e1,_0x334e6c,_0x4f4604){var _0x100d1f={'message':_0x25b5e1};_0x100d1f[_0x270899]=!![];if(_0x334e6c){_0x100d1f[_0x1785('0x14')]=_0x334e6c;}if(_0x4f4604){_0x100d1f[_0x1785('0x15')]=_0x4f4604;}return _0x100d1f;}function isEmail(_0x144415){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'](_0x144415);}function checkRow(_0x40aaf2,_0x4a9165,_0x53f0bd){return new BPromise(function(_0x5af534,_0xf60203){if(_['isNil'](_0x40aaf2)){return _0xf60203(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x53f0bd));}if(_0x40aaf2['errors']&&_0x40aaf2[_0x1785('0x16')][_0x1785('0x17')]){var _0x34157c=_[_0x1785('0x18')](_0x40aaf2[_0x1785('0x16')],_0x1785('0x19'))[_0x1785('0x1a')](';');return _0xf60203(handleCheckRowError('error',_0x34157c,null,_0x53f0bd));}var _0x76f208={};for(var _0x2f41b2 in FIELDS){if(FIELDS[_0x1785('0x1b')](_0x2f41b2)&&FIELDS[_0x2f41b2]){_0x76f208[_0x2f41b2]=_0x40aaf2['data'][0x0][FIELDS[_0x2f41b2]]||_0x40aaf2[_0x1785('0x1c')][0x0]['\ufeff'+FIELDS[_0x2f41b2]];}}if(!_0x76f208['firstName']){return _0xf60203(handleCheckRowError(_0x1785('0x13'),'firstName\x20not\x20specified!',null,_0x53f0bd));}if(!_0x76f208[_0x1785('0x1d')]){return _0xf60203(handleCheckRowError(_0x1785('0x13'),_0x1785('0x1e'),null,_0x53f0bd));}if(_0x76f208[_0x1785('0x1f')]){var _0x3afb19=moment(_0x76f208[_0x1785('0x1f')],'YYYY-MM-DD');if(!_0x3afb19[_0x1785('0x20')]()){return _0xf60203(handleCheckRowError(_0x1785('0x13'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x53f0bd));}}if(_0x76f208[_0x1785('0x21')]){if(!isEmail(_0x76f208[_0x1785('0x21')])){return _0xf60203(handleCheckRowError(_0x1785('0x13'),_0x1785('0x22'),null,_0x53f0bd));}}_0x76f208[_0x1785('0x23')]=LISTID;_0x76f208[_0x1785('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x4a9165){var _0x3284d2={};for(var _0x556517=0x0,_0x20ea27=DUPLICATES['length'];_0x556517<_0x20ea27;_0x556517+=0x1){_0x3284d2[DUPLICATES[_0x556517]]=_0x76f208[DUPLICATES[_0x556517]];}var _0x1a5eef=_['find'](_0x4a9165,_0x3284d2);if(_0x1a5eef){return _0xf60203(handleCheckRowError(_0x1785('0x25'),'Duplicate\x20Contact',_0x1a5eef,_0x53f0bd));}}return db[_0x1785('0x26')]['create'](_0x76f208,{'raw':!![],'hooks':![],'fields':_[_0x1785('0x27')](_0x76f208)})[_0x1785('0x28')](function(_0x3e1ecd){if(DUPLICATES&&DUPLICATES['length']&&_0x4a9165){_0x4a9165[_0x1785('0x29')](_[_0x1785('0x2a')](_0x76f208,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3e1ecd['id'];return _0x5af534();})[_0x1785('0x2b')](function(_0x21b510){return _0xf60203(handleCheckRowError(_0x1785('0x13'),_0x1785('0x2c')+(_0x21b510[_0x1785('0x19')]||JSON[_0x1785('0x2d')](_0x21b510)),null,_0x53f0bd));});});}function checkHopper(){function _0x1b1b42(){return function(_0x17b75d){logger[_0x1785('0x13')](_0x1785('0x2e'),_0x1785('0x2f'),util[_0x1785('0x30')](_0x17b75d,{'showHidden':![],'depth':null}));};}var _0x2517b3=function(_0x19d72d,_0x5a0664){var _0x117000=squel[_0x1785('0x31')]()[_0x1785('0x32')](_0x1785('0x33'))['fromQuery']([_0x1785('0x1d'),_0x1785('0x34'),_0x1785('0x35'),_0x1785('0x23'),_0x5a0664,_0x1785('0x36'),'updatedAt'],squel['select']()[_0x1785('0x37')](_0x1785('0x1d'),_0x1785('0x1d'))[_0x1785('0x37')](_0x1785('0x38'),_0x1785('0x34'))[_0x1785('0x37')]('id','ContactId')[_0x1785('0x37')](LISTID['toString'](),_0x1785('0x23'))[_0x1785('0x37')](_0x19d72d['id']['toString'](),_0x5a0664)[_0x1785('0x37')](_0x1785('0x38'),'createdAt')['field'](_0x1785('0x38'),'updatedAt')[_0x1785('0x39')](_0x1785('0x3a'))[_0x1785('0x3b')]('deletedAt\x20IS\x20NULL')['where'](_0x1785('0x3c'),LISTID[_0x1785('0x3d')]())['where'](_0x1785('0x3e'))[_0x1785('0x3b')](_0x1785('0x3f'),squel['select']()['field'](_0x1785('0x1d'))[_0x1785('0x39')](_0x1785('0x33'))[_0x1785('0x3b')](_0x5a0664+_0x1785('0x40'),_0x19d72d['id'][_0x1785('0x3d')]())))[_0x1785('0x3d')]();return _0x117000;};var _0x3233f4=function(_0x228307,_0x5e10b9){var _0x22b3c5=squel['insert']()[_0x1785('0x32')]('cm_hopper')[_0x1785('0x41')](['phone',_0x1785('0x34'),_0x1785('0x35'),_0x1785('0x23'),_0x5e10b9,_0x1785('0x36'),_0x1785('0x42')],squel[_0x1785('0x43')]()[_0x1785('0x37')](_0x1785('0x1d'),_0x1785('0x1d'))[_0x1785('0x37')](_0x1785('0x38'),_0x1785('0x34'))[_0x1785('0x37')]('id','ContactId')['field'](LISTID[_0x1785('0x3d')](),_0x1785('0x23'))['field'](_0x228307['id'][_0x1785('0x3d')](),_0x5e10b9)[_0x1785('0x37')](_0x1785('0x38'),_0x1785('0x36'))['field']('NOW()',_0x1785('0x42'))[_0x1785('0x39')](_0x1785('0x3a'))[_0x1785('0x3b')](_0x1785('0x44'))[_0x1785('0x3b')](_0x1785('0x3c'),LISTID[_0x1785('0x3d')]())[_0x1785('0x3b')](_0x1785('0x45'),squel['str'](hopperContacts))[_0x1785('0x3b')](_0x1785('0x3e'))[_0x1785('0x3b')](_0x1785('0x3f'),squel[_0x1785('0x43')]()['field']('calleridnum')[_0x1785('0x39')](_0x1785('0x46'))['where'](_0x5e10b9+'\x20=\x20?',_0x228307['id'][_0x1785('0x3d')]()))[_0x1785('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1785('0x43')]()[_0x1785('0x37')](_0x1785('0x1d'))['from'](_0x1785('0x33'))[_0x1785('0x3b')](_0x5e10b9+_0x1785('0x40'),_0x228307['id'][_0x1785('0x3d')]())))[_0x1785('0x3d')]();return _0x22b3c5;};function _0xbd7df4(_0x5f3f6c,_0x51beba){var _0x2f9938=squel[_0x1785('0x31')]()[_0x1785('0x32')](_0x1785('0x33'))['fromQuery'](['phone',_0x1785('0x34'),_0x1785('0x35'),_0x1785('0x23'),_0x51beba,_0x1785('0x36'),_0x1785('0x42')],squel[_0x1785('0x43')]()[_0x1785('0x37')]('phone','phone')[_0x1785('0x37')](_0x1785('0x38'),_0x1785('0x34'))['field']('id',_0x1785('0x35'))[_0x1785('0x37')](LISTID['toString'](),'ListId')[_0x1785('0x37')](_0x5f3f6c['id'][_0x1785('0x3d')](),_0x51beba)[_0x1785('0x37')](_0x1785('0x38'),_0x1785('0x36'))['field']('NOW()',_0x1785('0x42'))[_0x1785('0x39')](_0x1785('0x3a'))[_0x1785('0x3b')](_0x1785('0x44'))[_0x1785('0x3b')](_0x1785('0x3c'),LISTID[_0x1785('0x3d')]())['where'](_0x1785('0x45'),squel[_0x1785('0x47')](hopperContacts))[_0x1785('0x3b')](_0x1785('0x3e')))['toString']();return _0x2f9938;}function _0x455040(_0x6b597d,_0x4b99f8){var _0x3ebcc9=squel[_0x1785('0x31')]()['into'](_0x1785('0x48'))[_0x1785('0x41')]([_0x1785('0x1d'),_0x1785('0x35'),_0x1785('0x23'),_0x4b99f8,_0x1785('0x36'),_0x1785('0x42')],squel[_0x1785('0x43')]()['field'](_0x1785('0x1d'),'phone')[_0x1785('0x37')]('id',_0x1785('0x35'))[_0x1785('0x37')](LISTID[_0x1785('0x3d')](),'ListId')[_0x1785('0x37')](_0x6b597d['id']['toString'](),_0x4b99f8)[_0x1785('0x37')](_0x1785('0x38'),'createdAt')[_0x1785('0x37')](_0x1785('0x38'),_0x1785('0x42'))[_0x1785('0x39')](_0x1785('0x3a'))[_0x1785('0x3b')](_0x1785('0x44'))['where'](_0x1785('0x3c'),LISTID['toString']())[_0x1785('0x3b')](_0x1785('0x45'),squel[_0x1785('0x47')](hopperContacts))[_0x1785('0x3b')](_0x1785('0x3e')))[_0x1785('0x3d')]();return _0x3ebcc9;}return db[_0x1785('0x49')][_0x1785('0x4a')]({'where':{'type':_0x1785('0x4b')},'attributes':['id',_0x1785('0x4c')],'include':[{'model':db[_0x1785('0x4d')],'as':_0x1785('0x4e'),'where':{'id':LISTID}}]})[_0x1785('0x28')](function(_0x49b350){var _0x6b33aa=[];if(_0x49b350){var _0x3a5771;for(var _0x581dd4=0x0,_0x460448;_0x581dd4<_0x49b350[_0x1785('0x17')];_0x581dd4+=0x1){_0x460448=_0x49b350[_0x581dd4][_0x1785('0x4f')]({'plain':!![]});switch(_0x460448['dialCheckDuplicateType']){case _0x1785('0x50'):_0x6b33aa[_0x1785('0x29')](db[_0x1785('0x51')][_0x1785('0x52')](_0x3233f4(_0x460448,_0x1785('0x53')))[_0x1785('0x28')](function(){})[_0x1785('0x2b')](_0x1b1b42()));break;case _0x1785('0x54'):_0x6b33aa[_0x1785('0x29')](db[_0x1785('0x51')]['query'](_0x2517b3(_0x460448,_0x1785('0x53')))[_0x1785('0x28')](function(){})[_0x1785('0x2b')](_0x1b1b42()));break;default:_0x6b33aa['push'](db[_0x1785('0x51')][_0x1785('0x52')](_0xbd7df4(_0x460448,_0x1785('0x53')))['then'](function(){})[_0x1785('0x2b')](_0x1b1b42()));}}}return _0x6b33aa;})[_0x1785('0x55')]()[_0x1785('0x28')](function(){return db[_0x1785('0x49')][_0x1785('0x4a')]({'where':{'type':_0x1785('0x4b')},'attributes':['id'],'include':[{'model':db[_0x1785('0x4d')],'as':_0x1785('0x56'),'where':{'id':LISTID}}]})[_0x1785('0x28')](function(_0x3efbd9){var _0x3b5b53=[];if(_0x3efbd9){var _0x4168f3;for(var _0x28b242=0x0,_0x44ed17;_0x28b242<_0x3efbd9[_0x1785('0x17')];_0x28b242+=0x1){_0x44ed17=_0x3efbd9[_0x28b242][_0x1785('0x4f')]({'plain':!![]});_0x3b5b53[_0x1785('0x29')](db[_0x1785('0x51')][_0x1785('0x52')](_0x455040(_0x44ed17,_0x1785('0x53')))[_0x1785('0x28')](function(){})[_0x1785('0x2b')](_0x1b1b42()));}}return _0x3b5b53;})[_0x1785('0x55')]();})['then'](function(){return db[_0x1785('0x57')][_0x1785('0x4a')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x1785('0x4d')],'as':_0x1785('0x4e'),'where':{'id':LISTID}}]})[_0x1785('0x28')](function(_0x418f4d){var _0x2c6b7c=[];if(_0x418f4d){for(var _0x413f95=0x0,_0x2da82f;_0x413f95<_0x418f4d[_0x1785('0x17')];_0x413f95+=0x1){_0x2da82f=_0x418f4d[_0x413f95]['get']({'plain':!![]});switch(_0x2da82f[_0x1785('0x4c')]){case _0x1785('0x50'):_0x2c6b7c[_0x1785('0x29')](db[_0x1785('0x51')][_0x1785('0x52')](_0x3233f4(_0x2da82f,'CampaignId'))[_0x1785('0x28')](function(){})['catch'](_0x1b1b42()));break;case _0x1785('0x54'):_0x2c6b7c[_0x1785('0x29')](db[_0x1785('0x51')][_0x1785('0x52')](_0x2517b3(_0x2da82f,'CampaignId'))['then'](function(){})[_0x1785('0x2b')](_0x1b1b42()));break;default:_0x2c6b7c['push'](db[_0x1785('0x51')]['query'](_0xbd7df4(_0x2da82f,'CampaignId'))[_0x1785('0x28')](function(){})[_0x1785('0x2b')](_0x1b1b42()));}}}return _0x2c6b7c;})[_0x1785('0x55')]();})[_0x1785('0x28')](function(){return db[_0x1785('0x57')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x1785('0x4d')],'as':_0x1785('0x56'),'where':{'id':LISTID}}]})['then'](function(_0x1a4e6d){var _0x1f60f4=[];if(_0x1a4e6d){for(var _0x200300=0x0,_0x282656;_0x200300<_0x1a4e6d[_0x1785('0x17')];_0x200300+=0x1){_0x282656=_0x1a4e6d[_0x200300]['get']({'plain':!![]});_0x1f60f4[_0x1785('0x29')](db[_0x1785('0x51')][_0x1785('0x52')](_0x455040(_0x282656,'CampaignId'))[_0x1785('0x28')](function(){})[_0x1785('0x2b')](_0x1b1b42()));}}return _0x1f60f4;})[_0x1785('0x55')]();})[_0x1785('0x2b')](function(_0x194120){logger[_0x1785('0x13')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x194120[_0x1785('0x19')]);});}var processPromises=function(_0x584ef7){return BPromise['all'](promises)[_0x1785('0x28')](function(_0x51d878){})[_0x1785('0x2b')](function(_0xbc9bbf){logger[_0x1785('0x13')](_0x1785('0x58'),JSON[_0x1785('0x2d')](_0xbc9bbf));})[_0x1785('0x59')](function(){socket[_0x1785('0x5a')](_0x1785('0x5b')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x584ef7){return _0x584ef7[_0x1785('0x5c')]();}});};var endCsv=function(){return BPromise[_0x1785('0x5d')]()[_0x1785('0x28')](function(){if(hopperContacts){return checkHopper();}})[_0x1785('0x28')](function(){socket['emit'](_0x1785('0x5b')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1785('0x5e')](FILEPATH);}catch(_0x2941c2){logger['error'](_0x1785('0x5f'),JSON[_0x1785('0x2d')](_0x2941c2));}finally{process[_0x1785('0x60')](0x0);}});};process['on']('SIGINT',function(){logger[_0x1785('0x61')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x1785('0x5d')]()[_0x1785('0x28')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1785('0x11')](',');return db[_0x1785('0x26')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xa379e9){var _0x14aaa2=fs[_0x1785('0x62')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x1785('0x63')](_0x14aaa2,{'header':!![],'skipEmptyLines':!![],'step':function(_0x150ced,_0x241e82){total+=0x1;var _0x220142=total;promises[_0x1785('0x29')](checkRow(_0x150ced,_0xa379e9,_0x220142)[_0x1785('0x28')](function(){success+=0x1;})[_0x1785('0x2b')](function(_0x5313d8){if(_0x5313d8[_0x1785('0x13')]){errors+=0x1;delete _0x5313d8['error'];}else if(_0x5313d8[_0x1785('0x25')]){duplicates+=0x1;delete _0x5313d8[_0x1785('0x25')];}rows['push'](_0x5313d8);}));if(total%0xc8===0x0){_0x241e82[_0x1785('0x64')]();return processPromises(_0x241e82);}},'complete':function(){return processPromises()[_0x1785('0x28')](function(){logger[_0x1785('0x61')](_0x1785('0x65'));endCsv();});},'error':function(_0xa83f5,_0x295fb7){logger[_0x1785('0x61')]('CSV\x20parse\x20error',JSON[_0x1785('0x2d')](_0xa83f5));endCsv();}});})[_0x1785('0x2b')](function(_0x47e9b5){logger[_0x1785('0x13')](_0x1785('0x66'),JSON[_0x1785('0x2d')](_0x47e9b5));});}main(); \ No newline at end of file +var _0x4d2a=['catch','onlyIfOpen','sequelize','VoiceQueueId','all','Campaign','CampaignId','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','Unable\x20to\x20delete\x20temp\x20file:','createReadStream','pause','info','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','register','argv','undefined','Missing\x20filepath\x20parameter!','null','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','birthDate','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','find','Duplicate\x20Contact','CmContact','create','keys','pick','message','stringify','cmContact','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','createdAt','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','phone\x20IS\x20NOT\x20NULL','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','then','get','always','push','query'];(function(_0x674724,_0x537ad4){var _0x58380e=function(_0x32f98b){while(--_0x32f98b){_0x674724['push'](_0x674724['shift']());}};_0x58380e(++_0x537ad4);}(_0x4d2a,0x7b));var _0xa4d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d2a[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xa4d2('0x0'));var util=require(_0xa4d2('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0xa4d2('0x2'));var Papa=require('papaparse');var Redis=require(_0xa4d2('0x3'));var db=require(_0xa4d2('0x4'))['db'];var config=require(_0xa4d2('0x5'));var logger=require(_0xa4d2('0x6'))(_0xa4d2('0x7'));config[_0xa4d2('0x8')]=_['defaults'](config[_0xa4d2('0x8')],{'host':_0xa4d2('0x9'),'port':0x18eb});var socket=require(_0xa4d2('0xa'))(new Redis(config[_0xa4d2('0x8')]));require('../../../api/cmContact/cmContact.socket')[_0xa4d2('0xb')](socket);try{if(!process[_0xa4d2('0xc')][0x2]||process[_0xa4d2('0xc')][0x2]===_0xa4d2('0xd')||process[_0xa4d2('0xc')][0x2]==='null'){throw new Error(_0xa4d2('0xe'));}var FILEPATH=process[_0xa4d2('0xc')][0x2];if(!process[_0xa4d2('0xc')][0x3]||process[_0xa4d2('0xc')][0x3]===_0xa4d2('0xd')||process['argv'][0x3]===_0xa4d2('0xf')||!process[_0xa4d2('0xc')][0x4]||process[_0xa4d2('0xc')][0x4]==='undefined'||process[_0xa4d2('0xc')][0x4]===_0xa4d2('0xf')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0xa4d2('0x10')](process[_0xa4d2('0xc')][0x3][_0xa4d2('0x11')](','),process[_0xa4d2('0xc')][0x4]['split'](','));if(!process['argv'][0x5]||process[_0xa4d2('0xc')][0x5]===_0xa4d2('0xd')||process['argv'][0x5]==='null'){throw new Error(_0xa4d2('0x12'));}var LISTID=process[_0xa4d2('0xc')][0x5];var COMPANYID=process[_0xa4d2('0xc')][0x6]&&process['argv'][0x6]!==_0xa4d2('0xd')&&process[_0xa4d2('0xc')][0x6]!==_0xa4d2('0xf')?process[_0xa4d2('0xc')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0xa4d2('0xc')][0x7]!==_0xa4d2('0xf')?process[_0xa4d2('0xc')][0x7]:null;if(!process[_0xa4d2('0xc')][0x8]||process[_0xa4d2('0xc')][0x8]===_0xa4d2('0xd')||process[_0xa4d2('0xc')][0x8]===_0xa4d2('0xf')){throw new Error(_0xa4d2('0x13'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x34e0bb){logger['error'](_0x34e0bb);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(_0x168ab3,_0x140c18,_0x139185,_0x298dc3){var _0x549dcc={'message':_0x140c18};_0x549dcc[_0x168ab3]=!![];if(_0x139185){_0x549dcc[_0xa4d2('0x14')]=_0x139185;}if(_0x298dc3){_0x549dcc[_0xa4d2('0x15')]=_0x298dc3;}return _0x549dcc;}function isEmail(_0x66bfc2){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))*$/[_0xa4d2('0x16')](_0x66bfc2);}function checkRow(_0x498a52,_0x2bbba1,_0x2a3192){return new BPromise(function(_0x5cc91a,_0x49c0e0){if(_[_0xa4d2('0x17')](_0x498a52)){return _0x49c0e0(handleCheckRowError(_0xa4d2('0x18'),_0xa4d2('0x19'),null,_0x2a3192));}if(_0x498a52[_0xa4d2('0x1a')]&&_0x498a52[_0xa4d2('0x1a')][_0xa4d2('0x1b')]){var _0x3c2a11=_['map'](_0x498a52[_0xa4d2('0x1a')],'message')[_0xa4d2('0x1c')](';');return _0x49c0e0(handleCheckRowError(_0xa4d2('0x18'),_0x3c2a11,null,_0x2a3192));}var _0x5a7c46={};for(var _0x39dfe1 in FIELDS){if(FIELDS[_0xa4d2('0x1d')](_0x39dfe1)&&FIELDS[_0x39dfe1]){_0x5a7c46[_0x39dfe1]=_0x498a52[_0xa4d2('0x1e')][0x0][FIELDS[_0x39dfe1]]||_0x498a52[_0xa4d2('0x1e')][0x0]['\ufeff'+FIELDS[_0x39dfe1]];}}if(!_0x5a7c46['firstName']){return _0x49c0e0(handleCheckRowError(_0xa4d2('0x18'),_0xa4d2('0x1f'),null,_0x2a3192));}if(!_0x5a7c46[_0xa4d2('0x20')]){return _0x49c0e0(handleCheckRowError(_0xa4d2('0x18'),'phone\x20not\x20specified!',null,_0x2a3192));}if(_0x5a7c46[_0xa4d2('0x21')]){var _0x19a405=moment(_0x5a7c46[_0xa4d2('0x21')],'YYYY-MM-DD');if(!_0x19a405[_0xa4d2('0x22')]()){return _0x49c0e0(handleCheckRowError(_0xa4d2('0x18'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x2a3192));}}if(_0x5a7c46[_0xa4d2('0x23')]){if(!isEmail(_0x5a7c46[_0xa4d2('0x23')])){return _0x49c0e0(handleCheckRowError(_0xa4d2('0x18'),_0xa4d2('0x24'),null,_0x2a3192));}}_0x5a7c46[_0xa4d2('0x25')]=LISTID;_0x5a7c46['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xa4d2('0x1b')]&&_0x2bbba1){var _0x5842ed={};for(var _0x576d58=0x0,_0x322ebb=DUPLICATES['length'];_0x576d58<_0x322ebb;_0x576d58+=0x1){_0x5842ed[DUPLICATES[_0x576d58]]=_0x5a7c46[DUPLICATES[_0x576d58]];}var _0x5a9d82=_[_0xa4d2('0x26')](_0x2bbba1,_0x5842ed);if(_0x5a9d82){return _0x49c0e0(handleCheckRowError('duplicate',_0xa4d2('0x27'),_0x5a9d82,_0x2a3192));}}return db[_0xa4d2('0x28')][_0xa4d2('0x29')](_0x5a7c46,{'raw':!![],'hooks':![],'fields':_[_0xa4d2('0x2a')](_0x5a7c46)})['then'](function(_0x3b899e){if(DUPLICATES&&DUPLICATES['length']&&_0x2bbba1){_0x2bbba1['push'](_[_0xa4d2('0x2b')](_0x5a7c46,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3b899e['id'];return _0x5cc91a();})['catch'](function(_0x4d45e0){return _0x49c0e0(handleCheckRowError(_0xa4d2('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x4d45e0[_0xa4d2('0x2c')]||JSON[_0xa4d2('0x2d')](_0x4d45e0)),null,_0x2a3192));});});}function checkHopper(){function _0x48f27d(){return function(_0x4012f9){logger[_0xa4d2('0x18')](_0xa4d2('0x2e'),'checkHopper',util['inspect'](_0x4012f9,{'showHidden':![],'depth':null}));};}var _0x408d62=function(_0x13f25f,_0x165d89){var _0x442054=squel[_0xa4d2('0x2f')]()[_0xa4d2('0x30')](_0xa4d2('0x31'))[_0xa4d2('0x32')]([_0xa4d2('0x20'),_0xa4d2('0x33'),_0xa4d2('0x34'),_0xa4d2('0x25'),_0x165d89,'createdAt',_0xa4d2('0x35')],squel[_0xa4d2('0x36')]()[_0xa4d2('0x37')]('phone','phone')['field'](_0xa4d2('0x38'),'scheduledAt')[_0xa4d2('0x37')]('id','ContactId')[_0xa4d2('0x37')](LISTID[_0xa4d2('0x39')](),_0xa4d2('0x25'))[_0xa4d2('0x37')](_0x13f25f['id'][_0xa4d2('0x39')](),_0x165d89)[_0xa4d2('0x37')]('NOW()','createdAt')[_0xa4d2('0x37')](_0xa4d2('0x38'),_0xa4d2('0x35'))[_0xa4d2('0x3a')](_0xa4d2('0x3b'))[_0xa4d2('0x3c')](_0xa4d2('0x3d'))['where'](_0xa4d2('0x3e'),LISTID[_0xa4d2('0x39')]())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0xa4d2('0x3f'),squel['select']()[_0xa4d2('0x37')](_0xa4d2('0x20'))[_0xa4d2('0x3a')](_0xa4d2('0x31'))[_0xa4d2('0x3c')](_0x165d89+_0xa4d2('0x40'),_0x13f25f['id'][_0xa4d2('0x39')]())))[_0xa4d2('0x39')]();return _0x442054;};var _0x47d1fa=function(_0xf57617,_0x245569){var _0x17da1a=squel[_0xa4d2('0x2f')]()[_0xa4d2('0x30')](_0xa4d2('0x31'))['fromQuery']([_0xa4d2('0x20'),_0xa4d2('0x33'),_0xa4d2('0x34'),'ListId',_0x245569,_0xa4d2('0x41'),_0xa4d2('0x35')],squel[_0xa4d2('0x36')]()[_0xa4d2('0x37')](_0xa4d2('0x20'),_0xa4d2('0x20'))['field'](_0xa4d2('0x38'),_0xa4d2('0x33'))[_0xa4d2('0x37')]('id',_0xa4d2('0x34'))['field'](LISTID[_0xa4d2('0x39')](),_0xa4d2('0x25'))[_0xa4d2('0x37')](_0xf57617['id'][_0xa4d2('0x39')](),_0x245569)[_0xa4d2('0x37')](_0xa4d2('0x38'),_0xa4d2('0x41'))[_0xa4d2('0x37')](_0xa4d2('0x38'),'updatedAt')[_0xa4d2('0x3a')](_0xa4d2('0x3b'))['where'](_0xa4d2('0x3d'))[_0xa4d2('0x3c')](_0xa4d2('0x3e'),LISTID[_0xa4d2('0x39')]())[_0xa4d2('0x3c')](_0xa4d2('0x42'),squel[_0xa4d2('0x43')](hopperContacts))[_0xa4d2('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0xa4d2('0x3c')](_0xa4d2('0x3f'),squel['select']()[_0xa4d2('0x37')](_0xa4d2('0x44'))[_0xa4d2('0x3a')](_0xa4d2('0x45'))[_0xa4d2('0x3c')](_0x245569+_0xa4d2('0x40'),_0xf57617['id'][_0xa4d2('0x39')]()))[_0xa4d2('0x3c')](_0xa4d2('0x3f'),squel['select']()[_0xa4d2('0x37')](_0xa4d2('0x20'))[_0xa4d2('0x3a')](_0xa4d2('0x31'))[_0xa4d2('0x3c')](_0x245569+_0xa4d2('0x40'),_0xf57617['id']['toString']())))['toString']();return _0x17da1a;};function _0x3bb3b4(_0x2d6c0d,_0x30f640){var _0x21d1b3=squel[_0xa4d2('0x2f')]()['into'](_0xa4d2('0x31'))[_0xa4d2('0x32')]([_0xa4d2('0x20'),'scheduledAt',_0xa4d2('0x34'),_0xa4d2('0x25'),_0x30f640,_0xa4d2('0x41'),_0xa4d2('0x35')],squel['select']()['field']('phone',_0xa4d2('0x20'))[_0xa4d2('0x37')](_0xa4d2('0x38'),_0xa4d2('0x33'))['field']('id',_0xa4d2('0x34'))[_0xa4d2('0x37')](LISTID['toString'](),_0xa4d2('0x25'))[_0xa4d2('0x37')](_0x2d6c0d['id'][_0xa4d2('0x39')](),_0x30f640)[_0xa4d2('0x37')](_0xa4d2('0x38'),'createdAt')[_0xa4d2('0x37')](_0xa4d2('0x38'),_0xa4d2('0x35'))['from'](_0xa4d2('0x3b'))[_0xa4d2('0x3c')](_0xa4d2('0x3d'))['where'](_0xa4d2('0x3e'),LISTID['toString']())[_0xa4d2('0x3c')]('id\x20IN\x20?',squel[_0xa4d2('0x43')](hopperContacts))[_0xa4d2('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0xa4d2('0x39')]();return _0x21d1b3;}function _0xdc0cad(_0x457f20,_0x53933a){var _0x54ea5e=squel['insert']()[_0xa4d2('0x30')](_0xa4d2('0x46'))[_0xa4d2('0x32')]([_0xa4d2('0x20'),_0xa4d2('0x34'),_0xa4d2('0x25'),_0x53933a,'createdAt',_0xa4d2('0x35')],squel[_0xa4d2('0x36')]()[_0xa4d2('0x37')](_0xa4d2('0x20'),_0xa4d2('0x20'))['field']('id',_0xa4d2('0x34'))[_0xa4d2('0x37')](LISTID['toString'](),_0xa4d2('0x25'))[_0xa4d2('0x37')](_0x457f20['id']['toString'](),_0x53933a)['field'](_0xa4d2('0x38'),_0xa4d2('0x41'))[_0xa4d2('0x37')](_0xa4d2('0x38'),_0xa4d2('0x35'))[_0xa4d2('0x3a')](_0xa4d2('0x3b'))[_0xa4d2('0x3c')](_0xa4d2('0x3d'))[_0xa4d2('0x3c')](_0xa4d2('0x3e'),LISTID[_0xa4d2('0x39')]())[_0xa4d2('0x3c')](_0xa4d2('0x42'),squel[_0xa4d2('0x43')](hopperContacts))['where'](_0xa4d2('0x47')))[_0xa4d2('0x39')]();return _0x54ea5e;}return db[_0xa4d2('0x48')][_0xa4d2('0x49')]({'where':{'type':_0xa4d2('0x4a')},'attributes':['id',_0xa4d2('0x4b')],'include':[{'model':db[_0xa4d2('0x4c')],'as':_0xa4d2('0x4d'),'where':{'id':LISTID}}]})[_0xa4d2('0x4e')](function(_0x1a135f){var _0x5eae41=[];if(_0x1a135f){var _0x5f10c0;for(var _0xa21278=0x0,_0x57612f;_0xa21278<_0x1a135f[_0xa4d2('0x1b')];_0xa21278+=0x1){_0x57612f=_0x1a135f[_0xa21278][_0xa4d2('0x4f')]({'plain':!![]});switch(_0x57612f['dialCheckDuplicateType']){case _0xa4d2('0x50'):_0x5eae41[_0xa4d2('0x51')](db['sequelize'][_0xa4d2('0x52')](_0x47d1fa(_0x57612f,'VoiceQueueId'))[_0xa4d2('0x4e')](function(){})[_0xa4d2('0x53')](_0x48f27d()));break;case _0xa4d2('0x54'):_0x5eae41[_0xa4d2('0x51')](db[_0xa4d2('0x55')]['query'](_0x408d62(_0x57612f,_0xa4d2('0x56')))[_0xa4d2('0x4e')](function(){})['catch'](_0x48f27d()));break;default:_0x5eae41['push'](db[_0xa4d2('0x55')][_0xa4d2('0x52')](_0x3bb3b4(_0x57612f,_0xa4d2('0x56')))[_0xa4d2('0x4e')](function(){})[_0xa4d2('0x53')](_0x48f27d()));}}}return _0x5eae41;})['all']()[_0xa4d2('0x4e')](function(){return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xa4d2('0x4c')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0xea4bbd){var _0x708982=[];if(_0xea4bbd){var _0x468c6;for(var _0x2f1de1=0x0,_0x28d4f8;_0x2f1de1<_0xea4bbd[_0xa4d2('0x1b')];_0x2f1de1+=0x1){_0x28d4f8=_0xea4bbd[_0x2f1de1][_0xa4d2('0x4f')]({'plain':!![]});_0x708982[_0xa4d2('0x51')](db[_0xa4d2('0x55')]['query'](_0xdc0cad(_0x28d4f8,_0xa4d2('0x56')))[_0xa4d2('0x4e')](function(){})['catch'](_0x48f27d()));}}return _0x708982;})[_0xa4d2('0x57')]();})[_0xa4d2('0x4e')](function(){return db[_0xa4d2('0x58')][_0xa4d2('0x49')]({'attributes':['id',_0xa4d2('0x4b')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xa4d2('0x4e')](function(_0x305d68){var _0x52cd8c=[];if(_0x305d68){for(var _0x1f910c=0x0,_0x16665b;_0x1f910c<_0x305d68[_0xa4d2('0x1b')];_0x1f910c+=0x1){_0x16665b=_0x305d68[_0x1f910c][_0xa4d2('0x4f')]({'plain':!![]});switch(_0x16665b[_0xa4d2('0x4b')]){case'always':_0x52cd8c['push'](db[_0xa4d2('0x55')][_0xa4d2('0x52')](_0x47d1fa(_0x16665b,_0xa4d2('0x59')))[_0xa4d2('0x4e')](function(){})[_0xa4d2('0x53')](_0x48f27d()));break;case _0xa4d2('0x54'):_0x52cd8c[_0xa4d2('0x51')](db[_0xa4d2('0x55')][_0xa4d2('0x52')](_0x408d62(_0x16665b,_0xa4d2('0x59')))[_0xa4d2('0x4e')](function(){})['catch'](_0x48f27d()));break;default:_0x52cd8c[_0xa4d2('0x51')](db[_0xa4d2('0x55')][_0xa4d2('0x52')](_0x3bb3b4(_0x16665b,_0xa4d2('0x59')))[_0xa4d2('0x4e')](function(){})['catch'](_0x48f27d()));}}}return _0x52cd8c;})['all']();})[_0xa4d2('0x4e')](function(){return db['Campaign'][_0xa4d2('0x49')]({'attributes':['id'],'include':[{'model':db[_0xa4d2('0x4c')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xa4d2('0x4e')](function(_0x324baa){var _0x27c9b7=[];if(_0x324baa){for(var _0x13a3e5=0x0,_0x1da890;_0x13a3e5<_0x324baa[_0xa4d2('0x1b')];_0x13a3e5+=0x1){_0x1da890=_0x324baa[_0x13a3e5][_0xa4d2('0x4f')]({'plain':!![]});_0x27c9b7[_0xa4d2('0x51')](db[_0xa4d2('0x55')][_0xa4d2('0x52')](_0xdc0cad(_0x1da890,_0xa4d2('0x59')))[_0xa4d2('0x4e')](function(){})[_0xa4d2('0x53')](_0x48f27d()));}}return _0x27c9b7;})[_0xa4d2('0x57')]();})[_0xa4d2('0x53')](function(_0x9ebd48){logger[_0xa4d2('0x18')]('cmContact,\x20%s,\x20%s',_0xa4d2('0x5a'),_0x9ebd48[_0xa4d2('0x2c')]);});}var processPromises=function(_0x13ebd7){return BPromise[_0xa4d2('0x57')](promises)[_0xa4d2('0x4e')](function(_0x22aee0){})['catch'](function(_0x5c6075){logger[_0xa4d2('0x18')](_0xa4d2('0x5b'),JSON['stringify'](_0x5c6075));})[_0xa4d2('0x5c')](function(){socket[_0xa4d2('0x5d')](_0xa4d2('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x13ebd7){return _0x13ebd7[_0xa4d2('0x5f')]();}});};var endCsv=function(){return BPromise[_0xa4d2('0x60')]()[_0xa4d2('0x4e')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xa4d2('0x5d')](_0xa4d2('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x397e4a){logger[_0xa4d2('0x18')](_0xa4d2('0x61'),JSON[_0xa4d2('0x2d')](_0x397e4a));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xa4d2('0x60')]()[_0xa4d2('0x4e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xa4d2('0x28')][_0xa4d2('0x49')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xa4d2('0x4e')](function(_0x517cfa){var _0x51ed5e=fs[_0xa4d2('0x62')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x51ed5e,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2edcee,_0x2b41c5){total+=0x1;var _0x4148a3=total;promises[_0xa4d2('0x51')](checkRow(_0x2edcee,_0x517cfa,_0x4148a3)[_0xa4d2('0x4e')](function(){success+=0x1;})['catch'](function(_0x130773){if(_0x130773[_0xa4d2('0x18')]){errors+=0x1;delete _0x130773[_0xa4d2('0x18')];}else if(_0x130773['duplicate']){duplicates+=0x1;delete _0x130773['duplicate'];}rows[_0xa4d2('0x51')](_0x130773);}));if(total%0xc8===0x0){_0x2b41c5[_0xa4d2('0x63')]();return processPromises(_0x2b41c5);}},'complete':function(){return processPromises()['then'](function(){logger[_0xa4d2('0x64')](_0xa4d2('0x65'));endCsv();});},'error':function(_0x3ea301,_0x53747e){logger[_0xa4d2('0x64')]('CSV\x20parse\x20error',JSON['stringify'](_0x3ea301));endCsv();}});})[_0xa4d2('0x53')](function(_0xac0608){logger[_0xa4d2('0x18')](_0xa4d2('0x66'),JSON[_0xa4d2('0x2d')](_0xac0608));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 0b76c18..36a10e8 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 _0x8f52=['.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','select','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','\x20=\x20?','concat',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','spread','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','createReadStream','data','length','hasOwnProperty','trim','replace','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','duplicates','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','CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','unlink','catch','argv','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','util','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','.id\x20=\x20','\x20=\x20','where'];(function(_0x4bc64f,_0x4c57b2){var _0x347ac7=function(_0x27530f){while(--_0x27530f){_0x4bc64f['push'](_0x4bc64f['shift']());}};_0x347ac7(++_0x4c57b2);}(_0x8f52,0x74));var _0x28f5=function(_0x5c6994,_0x19ad9a){_0x5c6994=_0x5c6994-0x0;var _0x1d5c84=_0x8f52[_0x5c6994];return _0x1d5c84;};'use strict';var fs=require('fs');var path=require(_0x28f5('0x0'));var _=require(_0x28f5('0x1'));var Papa=require('papaparse');var util=require(_0x28f5('0x2'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x28f5('0x3'));var Redis=require(_0x28f5('0x4'));var db=require(_0x28f5('0x5'))['db'];var config=require(_0x28f5('0x6'));var logger=require(_0x28f5('0x7'))(_0x28f5('0x8'));config[_0x28f5('0x9')]=_[_0x28f5('0xa')](config[_0x28f5('0x9')],{'host':_0x28f5('0xb'),'port':0x18eb});var socket=require(_0x28f5('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x28f5('0xd')](_0x28f5('0xe'));function isEmail(_0x24c28b){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))*$/[_0x28f5('0xf')](_0x24c28b);}function selectNotIn(_0x4e5cf5,_0xa54123,_0x1b19a5,_0x578bd9,_0x1b1595){return squel['select']()[_0x28f5('0x10')](_0x28f5('0x11'))[_0x28f5('0x12')](_0x578bd9)['join'](_0xa54123,null,_0xa54123+_0x28f5('0x13')+_0x578bd9+'.'+_0x1b19a5)['where'](_0x578bd9+'.'+_0x1b19a5+_0x28f5('0x14')+_0x4e5cf5+'.'+_0x1b19a5)[_0x28f5('0x15')](_0xa54123+_0x28f5('0x16')+_0x1b1595[_0x28f5('0x17')]()+')');}function insertCmHopper(_0x4aacba,_0x246502,_0x4600b6,_0x572a9b,_0x3da389){var _0x575f39=['cm_contacts.phone',_0x28f5('0x18'),_0x28f5('0x19'),_0x28f5('0x1a'),_0x246502+'.'+_0x572a9b,_0x28f5('0x1b'),_0x28f5('0x1c'),_0x28f5('0x1d'),_0x28f5('0x1e'),'\x22'+_0x3da389+'\x22'];return squel[_0x28f5('0x1f')]()[_0x28f5('0x20')]('cm_hopper')[_0x28f5('0x21')](['phone',_0x28f5('0x22'),_0x28f5('0x23'),_0x28f5('0x24'),_0x572a9b,_0x28f5('0x25'),_0x28f5('0x26'),_0x28f5('0x27'),_0x28f5('0x28'),_0x28f5('0x29')],squel[_0x28f5('0x2a')]()[_0x28f5('0x2b')](_0x575f39)[_0x28f5('0x12')](_0x246502)['join'](_0x28f5('0x2c'),null,'cm_contacts.ListId\x20=\x20'+_0x246502+_0x28f5('0x2d'))[_0x28f5('0x17')](_0x4600b6,null,_0x4600b6+_0x28f5('0x13')+_0x246502+'.'+_0x572a9b)['where'](_0x246502+_0x28f5('0x2e'),_0x4aacba)[_0x28f5('0x15')](_0x28f5('0x2f'),NOW)['where'](_0x28f5('0x30'),selectNotIn(_0x246502,_0x4600b6,_0x572a9b,_0x28f5('0x31'),[_0x28f5('0x32'),_0x28f5('0x33')]))[_0x28f5('0x15')](_0x28f5('0x30'),selectNotIn(_0x246502,_0x4600b6,_0x572a9b,_0x28f5('0x31'),[_0x28f5('0x32')])))[_0x28f5('0x34')]();}function insertCmHopperBlack(_0x39719b,_0x4d746e,_0x2900b8,_0x17aad9){var _0xdfef73=['cm_contacts.phone','cm_contacts.id','cm_contacts.ListId',_0x4d746e+'.'+_0x17aad9,_0x28f5('0x1b'),_0x28f5('0x1c')];return squel[_0x28f5('0x1f')]()[_0x28f5('0x20')](_0x28f5('0x35'))[_0x28f5('0x21')]([_0x28f5('0x11'),_0x28f5('0x23'),'ListId',_0x17aad9,_0x28f5('0x25'),_0x28f5('0x26')],squel[_0x28f5('0x2a')]()['fields'](_0xdfef73)['from'](_0x4d746e)['join'](_0x28f5('0x2c'),null,_0x28f5('0x36')+_0x4d746e+_0x28f5('0x2d'))[_0x28f5('0x17')](_0x2900b8,null,_0x2900b8+_0x28f5('0x13')+_0x4d746e+'.'+_0x17aad9)['where'](_0x4d746e+_0x28f5('0x2e'),_0x39719b)[_0x28f5('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x28f5('0x30'),squel[_0x28f5('0x2a')]()[_0x28f5('0x10')](_0x28f5('0x11'))['from'](_0x28f5('0x35'))[_0x28f5('0x15')](_0x28f5('0x37'),_0x39719b)['where'](_0x17aad9+_0x28f5('0x38'),_0x4d746e+'.'+_0x17aad9)))['toString']();}function insertCmContact(_0x502e18,_0x5910ce,_0x173732,_0x352970){var _0x7f5381=_[_0x28f5('0x39')](_['keys'](_0x352970),[_0x28f5('0x24'),'CompanyId','createdAt',_0x28f5('0x26')]);return squel['insert']()[_0x28f5('0x20')]('cm_contacts')[_0x28f5('0x21')](_0x7f5381,squel[_0x28f5('0x2a')]()[_0x28f5('0x2b')](_0x7f5381)['from'](_0x5910ce)['where']('('+_0x173732['join'](',')+_0x28f5('0x3a'),squel['select']()[_0x28f5('0x2b')](_0x173732)['from']('cm_contacts')[_0x28f5('0x15')]('ListId\x20=\x20?',_0x502e18))['where'](_0x28f5('0x3b'),squel[_0x28f5('0x2a')]()['field'](_0x28f5('0x3c'),_0x28f5('0x3d'))['from'](_0x5910ce)[_0x28f5('0x3e')](_0x173732['join'](','))))['toString']();}function handleStop(){logger[_0x28f5('0x3f')](_0x28f5('0x40'));stopped=!![];}function handleUncaughtException(_0x28cfc1){logger[_0x28f5('0x41')](_0x28cfc1[_0x28f5('0x42')]);process[_0x28f5('0x43')](0x1);}function handleError(_0x26b52a,_0x868cb4){stats[_0x28f5('0x44')][_0x28f5('0x45')]({'name':_0x868cb4['code'],'message':_0x868cb4[_0x28f5('0x42')],'row':_0x26b52a});}function handleQuery(_0xb7885b){logger[_0x28f5('0x3f')](_0xb7885b);return db['sequelize']['query'](_0xb7885b)[_0x28f5('0x46')](function(_0x55881b){results[_0x28f5('0x45')](_0x55881b);})['catch'](function(_0x33cbda){logger['error'](_0x33cbda[_0x28f5('0x42')]);});}function main(_0x48a2da,_0x1bf400,_0x32d24a,_0x2925a2){logger[_0x28f5('0x3f')](_0x28f5('0x47'),_0x48a2da,JSON[_0x28f5('0x48')](_0x1bf400));process[_0x28f5('0x49')](_0x28f5('0x4a'));var _0x551da7=_0x1bf400[_0x28f5('0x4b')];var _0x546aaf=_0x1bf400[_0x28f5('0x4c')];var _0xccec6e=path['join'](config[_0x28f5('0x4d')],_0x28f5('0x4e'),_0x546aaf+_0x28f5('0x4f'));var _0x399319=_['keys'](_0x551da7)['join']();logger[_0x28f5('0x3f')](_0x28f5('0x50'),_0x399319);fs['writeFileSync'](_0xccec6e,_0x399319+'\x0a');Papa['parse'](fs[_0x28f5('0x51')](_0x48a2da),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4e8000,_0x49e495){try{for(var _0x2dab84=0x0,_0xf3dbf2=[];_0x2dab84<_0x4e8000[_0x28f5('0x52')][_0x28f5('0x53')];_0x2dab84++){stats['rows']+=0x1;if(_0x4e8000[_0x28f5('0x44')][_0x2dab84]){handleError(_0x4e8000[_0x28f5('0x52')][_0x2dab84],_0x4e8000['errors'][_0x2dab84]);}else{var _0x4d08a7=[];for(var _0x3b2d41 in _0x551da7){if(_0x551da7[_0x28f5('0x54')](_0x3b2d41)){if(_0x4e8000[_0x28f5('0x52')][_0x2dab84][_0x551da7[_0x3b2d41]]){var _0x32c60f=_[_0x28f5('0x55')](_0x4e8000[_0x28f5('0x52')][_0x2dab84][_0x551da7[_0x3b2d41]][_0x28f5('0x56')](/"/g,'\x27'));switch(_0x3b2d41){case _0x28f5('0x22'):var _0x52fa8f=moment(_0x32c60f,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x52fa8f['isValid']()){_0xf3dbf2['push']('\x22'+_0x32c60f+'\x22');}else{_0x4d08a7[_0x28f5('0x45')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x5bf837=parseInt(_0x32c60f);_0x32c60f=_[_0x28f5('0x57')](_0x5bf837)||_0x5bf837<0x0||_0x5bf837>0x4?_0x2925a2?0x3:0x2:_0x5bf837;_0xf3dbf2[_0x28f5('0x45')]('\x22'+_0x32c60f+'\x22');break;case _0x28f5('0x28'):var _0x455f32=parseInt(_0x32c60f);if(_[_0x28f5('0x58')](_0x455f32)&&_[_0x28f5('0x59')](_0x32d24a,_0x455f32)){_0xf3dbf2[_0x28f5('0x45')]('\x22'+_0x455f32+'\x22');}else{_0x4d08a7[_0x28f5('0x45')](_0x28f5('0x5a'));}break;case _0x28f5('0x5b'):if(isEmail(_0x32c60f)){_0xf3dbf2['push']('\x22'+_0x32c60f+'\x22');}else{_0x4d08a7[_0x28f5('0x45')](_0x28f5('0x5c'));}break;case _0x28f5('0x5d'):var _0x5d3c9e=moment(_0x32c60f,_0x28f5('0x5e'),!![]);if(_0x5d3c9e[_0x28f5('0x5f')]()){_0xf3dbf2[_0x28f5('0x45')]('\x22'+_0x32c60f+'\x22');}else{_0x4d08a7[_0x28f5('0x45')](_0x28f5('0x60'));}break;default:_0xf3dbf2[_0x28f5('0x45')]('\x22'+_0x32c60f+'\x22');}}else{switch(_0x3b2d41){case'firstName':case _0x28f5('0x11'):_0x4d08a7['push'](_0x3b2d41+_0x28f5('0x61'));break;default:_0xf3dbf2[_0x28f5('0x45')]('\x22\x22');}}}}if(_0x4d08a7[_0x28f5('0x53')]){handleError(_0x4e8000[_0x28f5('0x52')][_0x2dab84],{'code':'SystemRow','message':_0x4d08a7['join']()});}else{fs[_0x28f5('0x62')](_0xccec6e,_0xf3dbf2[_0x28f5('0x17')]()+'\x0a');}_0xf3dbf2=[];}if(!(stats[_0x28f5('0x63')]%0xc8)){socket[_0x28f5('0x64')](_0x28f5('0x65')+_0x546aaf,stats);stats[_0x28f5('0x44')]=[];}}if(stopped){logger['info'](_0x28f5('0x66'));_0x49e495[_0x28f5('0x67')]();}}catch(_0x17f8bd){handleError(_0x4e8000['data'][_0x2dab84],{'code':_0x28f5('0x68'),'message':_0x17f8bd[_0x28f5('0x42')]});logger[_0x28f5('0x41')]('step',_0x17f8bd[_0x28f5('0x42')]);}},'complete':function(){try{var _0x46b149=[];var _0x46b78b=_0x28f5('0x2c');if(_0x1bf400[_0x28f5('0x69')]&&_0x1bf400[_0x28f5('0x69')][_0x28f5('0x53')]){_0x46b78b='cm_contacts_'+_0x546aaf;_0x46b149['push'](_0x28f5('0x6a')+_0x46b78b+_0x28f5('0x6b'));}var _0x1d9ec3=util['format'](_0x28f5('0x6c'),_0xccec6e,_0x46b78b,_0x399319,_0x1bf400[_0x28f5('0x24')],_0x1bf400[_0x28f5('0x6d')]||null,NOW,NOW);if(_['isNil'](_0x551da7[_0x28f5('0x22')])){_0x1d9ec3+=_0x28f5('0x6e');}_0x46b149[_0x28f5('0x45')](_0x1d9ec3);if(_0x1bf400[_0x28f5('0x69')]&&_0x1bf400[_0x28f5('0x69')][_0x28f5('0x53')]){_0x46b149['push'](insertCmContact(_0x1bf400['ListId'],_0x46b78b,_0x1bf400[_0x28f5('0x69')],_0x551da7));_0x46b149[_0x28f5('0x45')](_0x28f5('0x6f')+_0x46b78b+';');}_0x46b149[_0x28f5('0x45')](insertCmHopper(_0x1bf400[_0x28f5('0x24')],'voice_queues_has_cm_lists',_0x28f5('0x70'),_0x28f5('0x71'),_0x2925a2));_0x46b149[_0x28f5('0x45')](insertCmHopperBlack(_0x1bf400[_0x28f5('0x24')],_0x28f5('0x72'),_0x28f5('0x70'),_0x28f5('0x71')));_0x46b149[_0x28f5('0x45')](insertCmHopper(_0x1bf400['ListId'],'campaigns_has_cm_lists',_0x28f5('0x73'),_0x28f5('0x74'),_0x2925a2));_0x46b149[_0x28f5('0x45')](insertCmHopperBlack(_0x1bf400['ListId'],_0x28f5('0x75'),_0x28f5('0x73'),_0x28f5('0x74')));BPromise[_0x28f5('0x76')](_0x46b149,handleQuery)[_0x28f5('0x77')](function(_0x2231d4){stats[_0x28f5('0x78')]=!![];stats[_0x28f5('0x79')]=_0x1bf400[_0x28f5('0x69')]&&_0x1bf400[_0x28f5('0x69')][_0x28f5('0x53')]?results[0x2]['affectedRows']:results[0x0]['affectedRows'];socket[_0x28f5('0x64')]('contact:import:'+_0x546aaf,stats);fs[_0x28f5('0x7a')](_0x48a2da);fs[_0x28f5('0x7a')](_0xccec6e);process[_0x28f5('0x43')](0x0);})[_0x28f5('0x7b')](function(_0x4ecef7){logger[_0x28f5('0x41')](_0x4ecef7[_0x28f5('0x42')]);process['exit'](0x1);});}catch(_0x18cf62){logger[_0x28f5('0x41')]('complete',_0x18cf62[_0x28f5('0x42')]);process[_0x28f5('0x43')](0x1);}},'error':function(_0x3d5ae2,_0x579079,_0x52cab1,_0x4a02bc){throw new Error(_0x4a02bc);}});}function validate(){if(process[_0x28f5('0x7c')]&&process[_0x28f5('0x7c')][_0x28f5('0x53')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x4c036a=path[_0x28f5('0x17')](config['root'],_0x28f5('0x4e'),process[_0x28f5('0x7c')][0x2]);if(!fs[_0x28f5('0x7d')](_0x4c036a)){throw new Error(_0x28f5('0x7e'));}var _0x53cb0f={};try{_0x53cb0f=JSON[_0x28f5('0x7f')](process[_0x28f5('0x7c')][0x3]);if(!_0x53cb0f[_0x28f5('0x4b')]){throw new Error(_0x28f5('0x80'));}if(!_0x53cb0f[_0x28f5('0x4b')]['phone']){throw new Error(_0x28f5('0x81'));}if(!_0x53cb0f[_0x28f5('0x4b')][_0x28f5('0x82')]){throw new Error(_0x28f5('0x83'));}var _0x6ea2a2=0x0;if(_0x53cb0f[_0x28f5('0x4b')][_0x28f5('0x28')]){_0x6ea2a2=0x1;}if(!_0x53cb0f[_0x28f5('0x24')]){throw new Error(_0x28f5('0x84'));}}catch(_0x2c3ec3){throw new Error(_0x28f5('0x85'));}var _0x468a06=[];try{_0x468a06=_[_0x28f5('0x86')](JSON[_0x28f5('0x7f')](process[_0x28f5('0x7c')][0x4]),'id');}catch(_0x36a6e0){logger[_0x28f5('0x3f')](_0x28f5('0x87'));}main(_0x4c036a,_0x53cb0f,_0x468a06,_0x6ea2a2);}validate();process['on'](_0x28f5('0x88'),handleStop);process['on'](_0x28f5('0x89'),handleUncaughtException); \ No newline at end of file +var _0x5b11=['cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','insert','cm_hopper_black','fields','cm_contacts','ListId\x20=\x20?','\x20=\x20?','toString','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','error','message','exit','errors','push','code','query','spread','catch','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','parse','length','rows','data','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','format','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','voice_queues','campaigns_has_cm_lists','CampaignId','campaigns','then','finish','affectedRows','unlink','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','localhost','socket.io-emitter','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','into'];(function(_0x3eed08,_0x3c8c1c){var _0x4cc529=function(_0x39df07){while(--_0x39df07){_0x3eed08['push'](_0x3eed08['shift']());}};_0x4cc529(++_0x3c8c1c);}(_0x5b11,0x17a));var _0x15b1=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x5b11[_0x465a0c];return _0x1e202e;};'use strict';var fs=require('fs');var path=require(_0x15b1('0x0'));var _=require(_0x15b1('0x1'));var Papa=require(_0x15b1('0x2'));var util=require(_0x15b1('0x3'));var BPromise=require(_0x15b1('0x4'));var moment=require(_0x15b1('0x5'));var squel=require(_0x15b1('0x6'));var Redis=require(_0x15b1('0x7'));var db=require(_0x15b1('0x8'))['db'];var config=require(_0x15b1('0x9'));var logger=require(_0x15b1('0xa'))('import');config[_0x15b1('0xb')]=_['defaults'](config[_0x15b1('0xb')],{'host':_0x15b1('0xc'),'port':0x18eb});var socket=require(_0x15b1('0xd'))(new Redis(config[_0x15b1('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x23a4f5){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))*$/[_0x15b1('0xe')](_0x23a4f5);}function selectNotIn(_0x266bc6,_0x497df4,_0x187b56,_0x5cb3b0,_0x26362b){return squel[_0x15b1('0xf')]()[_0x15b1('0x10')](_0x15b1('0x11'))[_0x15b1('0x12')](_0x5cb3b0)[_0x15b1('0x13')](_0x497df4,null,_0x497df4+_0x15b1('0x14')+_0x5cb3b0+'.'+_0x187b56)[_0x15b1('0x15')](_0x5cb3b0+'.'+_0x187b56+'\x20=\x20'+_0x266bc6+'.'+_0x187b56)[_0x15b1('0x15')](_0x497df4+_0x15b1('0x16')+_0x26362b[_0x15b1('0x13')]()+')');}function insertCmHopper(_0x3b8d79,_0x1acb77,_0x4182be,_0x3d01b0,_0x3375a5){var _0x5c2359=[_0x15b1('0x17'),_0x15b1('0x18'),_0x15b1('0x19'),'cm_contacts.ListId',_0x1acb77+'.'+_0x3d01b0,_0x15b1('0x1a'),_0x15b1('0x1b'),'cm_contacts.priority',_0x15b1('0x1c'),'\x22'+_0x3375a5+'\x22'];return squel['insert']()[_0x15b1('0x1d')](_0x15b1('0x1e'))[_0x15b1('0x1f')]([_0x15b1('0x11'),_0x15b1('0x20'),_0x15b1('0x21'),_0x15b1('0x22'),_0x3d01b0,_0x15b1('0x23'),_0x15b1('0x24'),_0x15b1('0x25'),'UserId',_0x15b1('0x26')],squel[_0x15b1('0xf')]()['fields'](_0x5c2359)[_0x15b1('0x12')](_0x1acb77)['join']('cm_contacts',null,_0x15b1('0x27')+_0x1acb77+_0x15b1('0x28'))[_0x15b1('0x13')](_0x4182be,null,_0x4182be+'.id\x20=\x20'+_0x1acb77+'.'+_0x3d01b0)[_0x15b1('0x15')](_0x1acb77+_0x15b1('0x29'),_0x3b8d79)[_0x15b1('0x15')](_0x15b1('0x2a'),NOW)[_0x15b1('0x15')](_0x15b1('0x2b'),selectNotIn(_0x1acb77,_0x4182be,_0x3d01b0,_0x15b1('0x1e'),[_0x15b1('0x2c'),_0x15b1('0x2d')]))[_0x15b1('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1acb77,_0x4182be,_0x3d01b0,_0x15b1('0x1e'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x34dada,_0x4c5995,_0x35c72e,_0x56d191){var _0x50d708=[_0x15b1('0x17'),_0x15b1('0x19'),'cm_contacts.ListId',_0x4c5995+'.'+_0x56d191,_0x15b1('0x1a'),_0x15b1('0x1b')];return squel[_0x15b1('0x2e')]()[_0x15b1('0x1d')](_0x15b1('0x2f'))['fromQuery']([_0x15b1('0x11'),'ContactId','ListId',_0x56d191,_0x15b1('0x23'),'updatedAt'],squel[_0x15b1('0xf')]()[_0x15b1('0x30')](_0x50d708)[_0x15b1('0x12')](_0x4c5995)[_0x15b1('0x13')](_0x15b1('0x31'),null,_0x15b1('0x27')+_0x4c5995+_0x15b1('0x28'))[_0x15b1('0x13')](_0x35c72e,null,_0x35c72e+_0x15b1('0x14')+_0x4c5995+'.'+_0x56d191)['where'](_0x4c5995+_0x15b1('0x29'),_0x34dada)[_0x15b1('0x15')](_0x15b1('0x2a'),NOW)[_0x15b1('0x15')](_0x15b1('0x2b'),squel['select']()[_0x15b1('0x10')](_0x15b1('0x11'))[_0x15b1('0x12')](_0x15b1('0x2f'))[_0x15b1('0x15')](_0x15b1('0x32'),_0x34dada)[_0x15b1('0x15')](_0x56d191+_0x15b1('0x33'),_0x4c5995+'.'+_0x56d191)))[_0x15b1('0x34')]();}function insertCmContact(_0x4f1c90,_0x4a56e1,_0x2a1470,_0x377726){var _0x251bf4=_[_0x15b1('0x35')](_[_0x15b1('0x36')](_0x377726),['ListId',_0x15b1('0x37'),_0x15b1('0x23'),_0x15b1('0x24')]);return squel[_0x15b1('0x2e')]()[_0x15b1('0x1d')](_0x15b1('0x31'))[_0x15b1('0x1f')](_0x251bf4,squel[_0x15b1('0xf')]()[_0x15b1('0x30')](_0x251bf4)[_0x15b1('0x12')](_0x4a56e1)[_0x15b1('0x15')]('('+_0x2a1470['join'](',')+_0x15b1('0x38'),squel[_0x15b1('0xf')]()[_0x15b1('0x30')](_0x2a1470)['from'](_0x15b1('0x31'))['where'](_0x15b1('0x32'),_0x4f1c90))[_0x15b1('0x15')](_0x15b1('0x39'),squel[_0x15b1('0xf')]()[_0x15b1('0x10')](_0x15b1('0x3a'),_0x15b1('0x3b'))[_0x15b1('0x12')](_0x4a56e1)[_0x15b1('0x3c')](_0x2a1470['join'](','))))[_0x15b1('0x34')]();}function handleStop(){logger[_0x15b1('0x3d')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x1136d6){logger[_0x15b1('0x3e')](_0x1136d6[_0x15b1('0x3f')]);process[_0x15b1('0x40')](0x1);}function handleError(_0x5cfc5e,_0x43db2d){stats[_0x15b1('0x41')][_0x15b1('0x42')]({'name':_0x43db2d[_0x15b1('0x43')],'message':_0x43db2d[_0x15b1('0x3f')],'row':_0x5cfc5e});}function handleQuery(_0x36966c){logger[_0x15b1('0x3d')](_0x36966c);return db['sequelize'][_0x15b1('0x44')](_0x36966c)[_0x15b1('0x45')](function(_0x47713e){results[_0x15b1('0x42')](_0x47713e);})[_0x15b1('0x46')](function(_0x5a9df2){logger['error'](_0x5a9df2[_0x15b1('0x3f')]);});}function main(_0x5a5845,_0x7c09d7,_0x239577,_0x55a243){logger[_0x15b1('0x3d')](_0x15b1('0x47'),_0x5a5845,JSON[_0x15b1('0x48')](_0x7c09d7));process[_0x15b1('0x49')](_0x15b1('0x4a'));var _0x1346a0=_0x7c09d7[_0x15b1('0x4b')];var _0x37fc38=_0x7c09d7[_0x15b1('0x4c')];var _0x237b0b=path['join'](config[_0x15b1('0x4d')],_0x15b1('0x4e'),_0x37fc38+_0x15b1('0x4f'));var _0x38063b=_['keys'](_0x1346a0)[_0x15b1('0x13')]();logger[_0x15b1('0x3d')]('header',_0x38063b);fs['writeFileSync'](_0x237b0b,_0x38063b+'\x0a');Papa[_0x15b1('0x50')](fs['createReadStream'](_0x5a5845),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2ea9a3,_0x5def67){try{for(var _0x1f685f=0x0,_0x401242=[];_0x1f685f<_0x2ea9a3['data'][_0x15b1('0x51')];_0x1f685f++){stats[_0x15b1('0x52')]+=0x1;if(_0x2ea9a3[_0x15b1('0x41')][_0x1f685f]){handleError(_0x2ea9a3[_0x15b1('0x53')][_0x1f685f],_0x2ea9a3[_0x15b1('0x41')][_0x1f685f]);}else{var _0x28f8ff=[];for(var _0x162533 in _0x1346a0){if(_0x1346a0[_0x15b1('0x54')](_0x162533)){if(_0x2ea9a3[_0x15b1('0x53')][_0x1f685f][_0x1346a0[_0x162533]]){var _0x185afc=_[_0x15b1('0x55')](_0x2ea9a3['data'][_0x1f685f][_0x1346a0[_0x162533]][_0x15b1('0x56')](/"/g,'\x27'));switch(_0x162533){case'scheduledat':var _0x5557ac=moment(_0x185afc,_0x15b1('0x57'),!![]);if(_0x5557ac[_0x15b1('0x58')]()){_0x401242[_0x15b1('0x42')]('\x22'+_0x185afc+'\x22');}else{_0x28f8ff[_0x15b1('0x42')](_0x15b1('0x59'));}break;case'priority':var _0x15d73a=parseInt(_0x185afc);_0x185afc=_[_0x15b1('0x5a')](_0x15d73a)||_0x15d73a<0x0||_0x15d73a>0x4?_0x55a243?0x3:0x2:_0x15d73a;_0x401242[_0x15b1('0x42')]('\x22'+_0x185afc+'\x22');break;case _0x15b1('0x5b'):var _0x11b70c=parseInt(_0x185afc);if(_['isNumber'](_0x11b70c)&&_[_0x15b1('0x5c')](_0x239577,_0x11b70c)){_0x401242[_0x15b1('0x42')]('\x22'+_0x11b70c+'\x22');}else{_0x28f8ff[_0x15b1('0x42')](_0x15b1('0x5d'));}break;case _0x15b1('0x5e'):if(isEmail(_0x185afc)){_0x401242[_0x15b1('0x42')]('\x22'+_0x185afc+'\x22');}else{_0x28f8ff[_0x15b1('0x42')](_0x15b1('0x5f'));}break;case _0x15b1('0x60'):var _0x77c8e7=moment(_0x185afc,_0x15b1('0x61'),!![]);if(_0x77c8e7[_0x15b1('0x58')]()){_0x401242[_0x15b1('0x42')]('\x22'+_0x185afc+'\x22');}else{_0x28f8ff[_0x15b1('0x42')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x401242[_0x15b1('0x42')]('\x22'+_0x185afc+'\x22');}}else{switch(_0x162533){case _0x15b1('0x62'):case'phone':_0x28f8ff[_0x15b1('0x42')](_0x162533+_0x15b1('0x63'));break;default:_0x401242[_0x15b1('0x42')]('\x22\x22');}}}}if(_0x28f8ff[_0x15b1('0x51')]){handleError(_0x2ea9a3[_0x15b1('0x53')][_0x1f685f],{'code':_0x15b1('0x64'),'message':_0x28f8ff[_0x15b1('0x13')]()});}else{fs[_0x15b1('0x65')](_0x237b0b,_0x401242[_0x15b1('0x13')]()+'\x0a');}_0x401242=[];}if(!(stats['rows']%0xc8)){socket[_0x15b1('0x66')](_0x15b1('0x67')+_0x37fc38,stats);stats[_0x15b1('0x41')]=[];}}if(stopped){logger[_0x15b1('0x3d')](_0x15b1('0x68'));_0x5def67[_0x15b1('0x69')]();}}catch(_0x175fbf){handleError(_0x2ea9a3[_0x15b1('0x53')][_0x1f685f],{'code':_0x15b1('0x6a'),'message':_0x175fbf[_0x15b1('0x3f')]});logger[_0x15b1('0x3e')]('step',_0x175fbf[_0x15b1('0x3f')]);}},'complete':function(){try{var _0x25e24d=[];var _0x20e245=_0x15b1('0x31');if(_0x7c09d7['duplicates']&&_0x7c09d7[_0x15b1('0x6b')][_0x15b1('0x51')]){_0x20e245='cm_contacts_'+_0x37fc38;_0x25e24d['push'](_0x15b1('0x6c')+_0x20e245+_0x15b1('0x6d'));}var _0x9c924e=util[_0x15b1('0x6e')](_0x15b1('0x6f'),_0x237b0b,_0x20e245,_0x38063b,_0x7c09d7['ListId'],_0x7c09d7['CompanyId']||null,NOW,NOW);if(_[_0x15b1('0x70')](_0x1346a0[_0x15b1('0x20')])){_0x9c924e+=_0x15b1('0x71');}_0x25e24d['push'](_0x9c924e);if(_0x7c09d7[_0x15b1('0x6b')]&&_0x7c09d7['duplicates'][_0x15b1('0x51')]){_0x25e24d['push'](insertCmContact(_0x7c09d7[_0x15b1('0x22')],_0x20e245,_0x7c09d7[_0x15b1('0x6b')],_0x1346a0));_0x25e24d['push'](_0x15b1('0x72')+_0x20e245+';');}_0x25e24d[_0x15b1('0x42')](insertCmHopper(_0x7c09d7[_0x15b1('0x22')],_0x15b1('0x73'),'voice_queues',_0x15b1('0x74'),_0x55a243));_0x25e24d[_0x15b1('0x42')](insertCmHopperBlack(_0x7c09d7[_0x15b1('0x22')],_0x15b1('0x75'),_0x15b1('0x76'),_0x15b1('0x74')));_0x25e24d[_0x15b1('0x42')](insertCmHopper(_0x7c09d7['ListId'],_0x15b1('0x77'),'campaigns',_0x15b1('0x78'),_0x55a243));_0x25e24d[_0x15b1('0x42')](insertCmHopperBlack(_0x7c09d7['ListId'],'campaigns_has_cm_blacklists',_0x15b1('0x79'),_0x15b1('0x78')));BPromise['each'](_0x25e24d,handleQuery)[_0x15b1('0x7a')](function(_0xd874ef){stats[_0x15b1('0x7b')]=!![];stats[_0x15b1('0x7c')]=_0x7c09d7[_0x15b1('0x6b')]&&_0x7c09d7[_0x15b1('0x6b')][_0x15b1('0x51')]?results[0x2][_0x15b1('0x7c')]:results[0x0][_0x15b1('0x7c')];socket[_0x15b1('0x66')](_0x15b1('0x67')+_0x37fc38,stats);fs[_0x15b1('0x7d')](_0x5a5845);fs[_0x15b1('0x7d')](_0x237b0b);process['exit'](0x0);})[_0x15b1('0x46')](function(_0x15b71b){logger[_0x15b1('0x3e')](_0x15b71b[_0x15b1('0x3f')]);process[_0x15b1('0x40')](0x1);});}catch(_0x54d143){logger[_0x15b1('0x3e')]('complete',_0x54d143[_0x15b1('0x3f')]);process[_0x15b1('0x40')](0x1);}},'error':function(_0x1a6ca8,_0x55252c,_0x48a060,_0x2f0fca){throw new Error(_0x2f0fca);}});}function validate(){if(process['argv']&&process[_0x15b1('0x7e')][_0x15b1('0x51')]<0x4){throw new Error(_0x15b1('0x7f'));}var _0x24037d=path[_0x15b1('0x13')](config[_0x15b1('0x4d')],_0x15b1('0x4e'),process[_0x15b1('0x7e')][0x2]);if(!fs[_0x15b1('0x80')](_0x24037d)){throw new Error(_0x15b1('0x81'));}var _0x128495={};try{_0x128495=JSON[_0x15b1('0x50')](process['argv'][0x3]);if(!_0x128495[_0x15b1('0x4b')]){throw new Error(_0x15b1('0x82'));}if(!_0x128495[_0x15b1('0x4b')][_0x15b1('0x11')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x128495[_0x15b1('0x4b')][_0x15b1('0x62')]){throw new Error(_0x15b1('0x83'));}var _0x1e553c=0x0;if(_0x128495[_0x15b1('0x4b')][_0x15b1('0x5b')]){_0x1e553c=0x1;}if(!_0x128495[_0x15b1('0x22')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x5aa4d2){throw new Error('body\x20id\x20mandatory');}var _0x275288=[];try{_0x275288=_[_0x15b1('0x84')](JSON[_0x15b1('0x50')](process['argv'][0x4]),'id');}catch(_0x1dbde1){logger['info'](_0x15b1('0x85'));}main(_0x24037d,_0x128495,_0x275288,_0x1e553c);}validate();process['on'](_0x15b1('0x86'),handleStop);process['on'](_0x15b1('0x87'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 5dab250..166d810 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 _0x5f66=['***\x20Time\x20Info\x20***','Agent\x20Ring','agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','***\x20Call\x20Info\x20***','Called\x20Number','Member\x20Name','starttime','Answer\x20Time','Complete\x20Time','endtime','Duration','Billable\x20Time','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','variable','queue','calleridnum','outbound','push','Outbound\x20Call','getDescriptions','keyValue','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','Agent\x20Number','destcalleridnum'];(function(_0x35d3f9,_0x587e7f){var _0x33ca01=function(_0x338469){while(--_0x338469){_0x35d3f9['push'](_0x35d3f9['shift']());}};_0x33ca01(++_0x587e7f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';exports['getSubjects']=function(_0x61c60c,_0x4a3887){var _0x2d5fd9=[{'type':_0x65f6('0x0'),'content':_0x65f6('0x1'),'variableName':null}];switch(_0x61c60c[_0x65f6('0x2')]()){case _0x65f6('0x3'):switch(_0x4a3887['toLowerCase']()){case _0x65f6('0x4'):_0x2d5fd9['push']({'type':_0x65f6('0x5'),'content':'','variableName':_0x65f6('0x6')});_0x2d5fd9['push']({'type':'variable','content':'','variableName':_0x65f6('0x7')});break;case _0x65f6('0x8'):_0x2d5fd9[_0x65f6('0x9')]({'type':_0x65f6('0x0'),'content':_0x65f6('0xa'),'variableName':null});_0x2d5fd9[_0x65f6('0x9')]({'type':'variable','content':'','variableName':'destcalleridnum'});break;}}return _0x2d5fd9;};exports[_0x65f6('0xb')]=function(_0x2f6d5b,_0x264647){var _0x25c416=[];switch(_0x2f6d5b['toLowerCase']()){case _0x65f6('0x3'):switch(_0x264647['toLowerCase']()){case'inbound':_0x25c416=[{'type':_0x65f6('0x0'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x65f6('0xc'),'content':'','key':'Caller\x20Number','keyType':_0x65f6('0x5'),'variableName':_0x65f6('0x7')},{'type':_0x65f6('0xc'),'content':'','key':_0x65f6('0xd'),'keyType':_0x65f6('0x5'),'variableName':_0x65f6('0xe')},{'type':_0x65f6('0xc'),'content':'','key':_0x65f6('0xf'),'keyType':_0x65f6('0x5'),'variableName':_0x65f6('0x10')},{'type':'keyValue','content':'','key':_0x65f6('0x11'),'keyType':'variable','variableName':'queue'},{'type':_0x65f6('0xc'),'content':'','key':_0x65f6('0x12'),'keyType':_0x65f6('0x5'),'variableName':_0x65f6('0x13')},{'type':_0x65f6('0xc'),'content':'','key':_0x65f6('0x14'),'keyType':_0x65f6('0x5'),'variableName':_0x65f6('0x15')},{'type':'string','content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x65f6('0xc'),'content':'','key':'Agent\x20Name','keyType':'variable','variableName':'destcalleridname'},{'type':_0x65f6('0xc'),'content':'','key':_0x65f6('0x16'),'keyType':'variable','variableName':_0x65f6('0x17')},{'type':_0x65f6('0x0'),'content':_0x65f6('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x65f6('0xc'),'content':'','key':_0x65f6('0x19'),'keyType':_0x65f6('0x5'),'variableName':'agentcalledAt'},{'type':_0x65f6('0xc'),'content':'','key':'Agent\x20Connect','keyType':'variable','variableName':_0x65f6('0x1a')},{'type':_0x65f6('0xc'),'content':'','key':'Agent\x20Complete','keyType':_0x65f6('0x5'),'variableName':_0x65f6('0x1b')},{'type':_0x65f6('0xc'),'content':'','key':_0x65f6('0x1c'),'keyType':'variable','variableName':_0x65f6('0x1d')},{'type':_0x65f6('0xc'),'content':'','key':_0x65f6('0x1e'),'keyType':'variable','variableName':'talktime'}];break;case'outbound':_0x25c416=[{'type':_0x65f6('0x0'),'content':_0x65f6('0x1f'),'variableName':null},{'type':'keyValue','content':'','key':_0x65f6('0x20'),'keyType':_0x65f6('0x5'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0x65f6('0xc'),'content':'','key':_0x65f6('0x21'),'keyType':_0x65f6('0x5'),'keyContent':'','variableName':'membername'},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0x65f6('0x5'),'keyContent':'','variableName':_0x65f6('0x13')},{'type':_0x65f6('0xc'),'content':'','key':_0x65f6('0x14'),'keyType':_0x65f6('0x5'),'keyContent':'','variableName':_0x65f6('0x22')},{'type':_0x65f6('0x0'),'content':'***\x20Time\x20Info\x20***'},{'type':'keyValue','content':'','key':_0x65f6('0x23'),'keyType':_0x65f6('0x5'),'keyContent':'','variableName':'answertime'},{'type':'keyValue','content':'','key':_0x65f6('0x24'),'keyType':_0x65f6('0x5'),'keyContent':'','variableName':_0x65f6('0x25')},{'type':_0x65f6('0xc'),'content':'','key':_0x65f6('0x26'),'keyType':_0x65f6('0x5'),'keyContent':'','variableName':'duration'},{'type':_0x65f6('0xc'),'content':'','key':_0x65f6('0x27'),'keyType':_0x65f6('0x5'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x25c416;}; \ No newline at end of file +var _0x0b0e=['Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','UniqueId','Date','answertime','Complete\x20Time','Duration','duration','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridnum','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','uniqueid','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','agentconnectAt','Agent\x20Complete','agentcompleteAt'];(function(_0x2bf6be,_0x5b23f1){var _0x532ef4=function(_0x3760df){while(--_0x3760df){_0x2bf6be['push'](_0x2bf6be['shift']());}};_0x532ef4(++_0x5b23f1);}(_0x0b0e,0x187));var _0xe0b0=function(_0x24875d,_0x4fb24d){_0x24875d=_0x24875d-0x0;var _0x181471=_0x0b0e[_0x24875d];return _0x181471;};'use strict';exports[_0xe0b0('0x0')]=function(_0x503596,_0xc416e3){var _0x536e9b=[{'type':_0xe0b0('0x1'),'content':_0xe0b0('0x2'),'variableName':null}];switch(_0x503596[_0xe0b0('0x3')]()){case _0xe0b0('0x4'):switch(_0xc416e3[_0xe0b0('0x3')]()){case _0xe0b0('0x5'):_0x536e9b[_0xe0b0('0x6')]({'type':_0xe0b0('0x7'),'content':'','variableName':_0xe0b0('0x8')});_0x536e9b[_0xe0b0('0x6')]({'type':_0xe0b0('0x7'),'content':'','variableName':'calleridnum'});break;case'outbound':_0x536e9b[_0xe0b0('0x6')]({'type':_0xe0b0('0x1'),'content':_0xe0b0('0x9'),'variableName':null});_0x536e9b[_0xe0b0('0x6')]({'type':'variable','content':'','variableName':_0xe0b0('0xa')});break;}}return _0x536e9b;};exports[_0xe0b0('0xb')]=function(_0x553d4f,_0x1fef28){var _0x2f32b6=[];switch(_0x553d4f['toLowerCase']()){case _0xe0b0('0x4'):switch(_0x1fef28[_0xe0b0('0x3')]()){case _0xe0b0('0x5'):_0x2f32b6=[{'type':'string','content':_0xe0b0('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0xe0b0('0xd'),'content':'','key':_0xe0b0('0xe'),'keyType':_0xe0b0('0x7'),'variableName':_0xe0b0('0xf')},{'type':'keyValue','content':'','key':_0xe0b0('0x10'),'keyType':_0xe0b0('0x7'),'variableName':_0xe0b0('0x11')},{'type':_0xe0b0('0xd'),'content':'','key':_0xe0b0('0x12'),'keyType':'variable','variableName':_0xe0b0('0x13')},{'type':'keyValue','content':'','key':_0xe0b0('0x14'),'keyType':_0xe0b0('0x7'),'variableName':'queue'},{'type':_0xe0b0('0xd'),'content':'','key':'UniqueId','keyType':_0xe0b0('0x7'),'variableName':_0xe0b0('0x15')},{'type':'keyValue','content':'','key':'Date','keyType':_0xe0b0('0x7'),'variableName':'agentcalledAt'},{'type':'string','content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xe0b0('0xd'),'content':'','key':'Agent\x20Name','keyType':'variable','variableName':_0xe0b0('0x16')},{'type':'keyValue','content':'','key':_0xe0b0('0x17'),'keyType':'variable','variableName':_0xe0b0('0xa')},{'type':_0xe0b0('0x1'),'content':_0xe0b0('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0xe0b0('0xd'),'content':'','key':_0xe0b0('0x19'),'keyType':'variable','variableName':'agentcalledAt'},{'type':_0xe0b0('0xd'),'content':'','key':'Agent\x20Connect','keyType':_0xe0b0('0x7'),'variableName':_0xe0b0('0x1a')},{'type':'keyValue','content':'','key':_0xe0b0('0x1b'),'keyType':'variable','variableName':_0xe0b0('0x1c')},{'type':'keyValue','content':'','key':_0xe0b0('0x1d'),'keyType':'variable','variableName':_0xe0b0('0x1e')},{'type':'keyValue','content':'','key':_0xe0b0('0x1f'),'keyType':'variable','variableName':_0xe0b0('0x20')}];break;case'outbound':_0x2f32b6=[{'type':_0xe0b0('0x1'),'content':_0xe0b0('0xc'),'variableName':null},{'type':_0xe0b0('0xd'),'content':'','key':_0xe0b0('0x21'),'keyType':_0xe0b0('0x7'),'keyContent':'','variableName':_0xe0b0('0xa')},{'type':'keyValue','content':'','key':_0xe0b0('0x22'),'keyType':_0xe0b0('0x7'),'keyContent':'','variableName':'membername'},{'type':_0xe0b0('0xd'),'content':'','key':_0xe0b0('0x23'),'keyType':_0xe0b0('0x7'),'keyContent':'','variableName':_0xe0b0('0x15')},{'type':_0xe0b0('0xd'),'content':'','key':_0xe0b0('0x24'),'keyType':_0xe0b0('0x7'),'keyContent':'','variableName':'starttime'},{'type':_0xe0b0('0x1'),'content':_0xe0b0('0x18')},{'type':'keyValue','content':'','key':'Answer\x20Time','keyType':_0xe0b0('0x7'),'keyContent':'','variableName':_0xe0b0('0x25')},{'type':_0xe0b0('0xd'),'content':'','key':_0xe0b0('0x26'),'keyType':_0xe0b0('0x7'),'keyContent':'','variableName':'endtime'},{'type':_0xe0b0('0xd'),'content':'','key':_0xe0b0('0x27'),'keyType':_0xe0b0('0x7'),'keyContent':'','variableName':_0xe0b0('0x28')},{'type':_0xe0b0('0xd'),'content':'','key':'Billable\x20Time','keyType':_0xe0b0('0x7'),'keyContent':'','variableName':_0xe0b0('0x29')}];break;}}return _0x2f32b6;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 884d80c..a091aa9 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 _0xbcdf=['InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','null','Interaction','findOne','update','then','info','tracked','user','clone','body','html','fax','lodash','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','upperFirst'];(function(_0x252171,_0x4877f5){var _0x238505=function(_0x517320){while(--_0x517320){_0x252171['push'](_0x252171['shift']());}};_0x238505(++_0x4877f5);}(_0xbcdf,0x8e));var _0xfbcd=function(_0x3af955,_0x21431c){_0x3af955=_0x3af955-0x0;var _0x167de5=_0xbcdf[_0x3af955];return _0x167de5;};'use strict';var _=require(_0xfbcd('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0xfbcd('0x1'))(_0xfbcd('0x2')),'mail':require(_0xfbcd('0x1'))(_0xfbcd('0x3')),'fax':require(_0xfbcd('0x1'))(_0xfbcd('0x4')),'sms':require(_0xfbcd('0x1'))(_0xfbcd('0x5')),'chat':require(_0xfbcd('0x1'))(_0xfbcd('0x6'))};function getInteractionId(_0x38184f,_0x2e07b1,_0x4211ea){if(_0x38184f&&_0x38184f[_[_0xfbcd('0x7')](_0x4211ea)+_0xfbcd('0x8')]){return _0x38184f[_[_0xfbcd('0x7')](_0x4211ea)+'InteractionId'];}else if(_0x38184f&&_0x38184f['id']){return _0x38184f['id'];}else if(_0x2e07b1&&_0x2e07b1['id']){return _0x2e07b1['id'];}else{return'unknown';}}function log(_0xa5c78e,_0x131397,_0x51aa6d,_0x252e7b,_0x34496a,_0x5d7526){loggers[_0x34496a[_0xfbcd('0x9')]()][_0xa5c78e](_0xfbcd('0xa'),_0x5d7526[_0xfbcd('0xb')](),_0x131397?_0x131397['id']:null,_0x131397?_0x131397[_0xfbcd('0xc')]:null,_0x131397?_0x131397['role']:null,getInteractionId(_0x51aa6d,_0x252e7b,_0x34496a),_0x51aa6d?JSON['stringify'](_0x51aa6d):_0xfbcd('0xd'));}function updateUser(_0x264f06,_0x399880,_0x58d7e6,_0xd03d6a,_0x561ccf){db[_['upperFirst'](_0xd03d6a)+_0xfbcd('0xe')][_0xfbcd('0xf')]({'where':{'id':getInteractionId(_0x399880,_0x58d7e6,_0xd03d6a)}})['then'](function(_0x436017){if(_0x436017){return _0x436017[_0xfbcd('0x10')]({'UserId':_0x264f06?_0x264f06['id']:null});}})[_0xfbcd('0x11')](function(_0xc6cc9a){if(_0xc6cc9a){log(_0xfbcd('0x12'),_0x264f06,_0x399880,_0x58d7e6,_0xd03d6a,_0x561ccf);}})['catch'](function(){log('error',_0x264f06,_0x399880,_0x58d7e6,_0xd03d6a,_0x561ccf);});}exports[_0xfbcd('0x13')]=function(_0x38c1ff,_0x2d6736){return function(_0x4ee12c,_0x29d6d8,_0x5904b0){var _0x24949f=_0x4ee12c[_0xfbcd('0x14')];var _0x51d31b={};var _0x586663=_0x4ee12c['query'];if(_0x51d31b){_0x51d31b=_[_0xfbcd('0x15')](_0x4ee12c[_0xfbcd('0x16')]);_0x51d31b=_['omit'](_0x51d31b,[_0xfbcd('0x16'),_0xfbcd('0x17'),'phone',_0xfbcd('0x18'),'mobile']);}updateUser(_0x24949f,_0x51d31b,_0x586663,_0x38c1ff,_0x2d6736);_0x5904b0(null);};}; \ No newline at end of file +var _0xfa91=['Interaction','then','info','catch','error','user','query','clone','body','omit','html','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null'];(function(_0x72cc4f,_0x38df3b){var _0x3c14d5=function(_0x10d93b){while(--_0x10d93b){_0x72cc4f['push'](_0x72cc4f['shift']());}};_0x3c14d5(++_0x38df3b);}(_0xfa91,0x1df));var _0x1fa9=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xfa91[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x1fa9('0x0'));var db=require(_0x1fa9('0x1'))['db'];var loggers={'openchannel':require(_0x1fa9('0x2'))(_0x1fa9('0x3')),'mail':require(_0x1fa9('0x2'))(_0x1fa9('0x4')),'fax':require(_0x1fa9('0x2'))(_0x1fa9('0x5')),'sms':require(_0x1fa9('0x2'))(_0x1fa9('0x6')),'chat':require(_0x1fa9('0x2'))('chat-interactions')};function getInteractionId(_0x400ae3,_0x4b4503,_0x37468d){if(_0x400ae3&&_0x400ae3[_[_0x1fa9('0x7')](_0x37468d)+'InteractionId']){return _0x400ae3[_[_0x1fa9('0x7')](_0x37468d)+_0x1fa9('0x8')];}else if(_0x400ae3&&_0x400ae3['id']){return _0x400ae3['id'];}else if(_0x4b4503&&_0x4b4503['id']){return _0x4b4503['id'];}else{return _0x1fa9('0x9');}}function log(_0x3f25bf,_0x2653d5,_0xe85c3d,_0x2e33b4,_0x4774c2,_0xa7649a){loggers[_0x4774c2[_0x1fa9('0xa')]()][_0x3f25bf](_0x1fa9('0xb'),_0xa7649a[_0x1fa9('0xc')](),_0x2653d5?_0x2653d5['id']:null,_0x2653d5?_0x2653d5[_0x1fa9('0xd')]:null,_0x2653d5?_0x2653d5[_0x1fa9('0xe')]:null,getInteractionId(_0xe85c3d,_0x2e33b4,_0x4774c2),_0xe85c3d?JSON[_0x1fa9('0xf')](_0xe85c3d):_0x1fa9('0x10'));}function updateUser(_0x155f1a,_0x1c856e,_0x137cb7,_0x1eb447,_0x46d942){db[_[_0x1fa9('0x7')](_0x1eb447)+_0x1fa9('0x11')]['findOne']({'where':{'id':getInteractionId(_0x1c856e,_0x137cb7,_0x1eb447)}})[_0x1fa9('0x12')](function(_0x2e3692){if(_0x2e3692){return _0x2e3692['update']({'UserId':_0x155f1a?_0x155f1a['id']:null});}})[_0x1fa9('0x12')](function(_0x2fe26d){if(_0x2fe26d){log(_0x1fa9('0x13'),_0x155f1a,_0x1c856e,_0x137cb7,_0x1eb447,_0x46d942);}})[_0x1fa9('0x14')](function(){log(_0x1fa9('0x15'),_0x155f1a,_0x1c856e,_0x137cb7,_0x1eb447,_0x46d942);});}exports['tracked']=function(_0x59cce8,_0x508dd4){return function(_0x4d5a5d,_0x502209,_0x1497df){var _0xe19989=_0x4d5a5d[_0x1fa9('0x16')];var _0x1ac530={};var _0x21122e=_0x4d5a5d[_0x1fa9('0x17')];if(_0x1ac530){_0x1ac530=_[_0x1fa9('0x18')](_0x4d5a5d[_0x1fa9('0x19')]);_0x1ac530=_[_0x1fa9('0x1a')](_0x1ac530,['body',_0x1fa9('0x1b'),_0x1fa9('0x1c'),_0x1fa9('0x1d'),_0x1fa9('0x1e')]);}updateUser(_0xe19989,_0x1ac530,_0x21122e,_0x59cce8,_0x508dd4);_0x1497df(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 118ee86..d904325 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 _0x1681=['status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','admin','isUserLimit','composable-middleware','../../mysqldb','../../config/environment','data1','split','createDecipher','aes-256-ctr','%s:%s:%s','base64','utf8','parse','hasOwnProperty','use','License','then'];(function(_0x2c7e4b,_0x540197){var _0x229383=function(_0x429be0){while(--_0x429be0){_0x2c7e4b['push'](_0x2c7e4b['shift']());}};_0x229383(++_0x540197);}(_0x1681,0x12c));var _0x1168=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1681[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require(_0x1168('0x0'));var db=require(_0x1168('0x1'))['db'];var config=require(_0x1168('0x2'));function getValueFromLicense(_0x3f21a4,_0x38996b){if(_0x3f21a4&&_0x38996b){if(_0x38996b[_0x1168('0x3')]&&_0x38996b['license']){var _0x50cddd=_0x38996b[_0x1168('0x3')];var _0x1972ca=_0x38996b['license'];var _0x4601fe=_0x50cddd[_0x1168('0x4')]('-')[0x4];var _0x5e6752=_0x50cddd[_0x1168('0x4')]('-')[0x0];var _0x53baca=crypto[_0x1168('0x5')](_0x1168('0x6'),util['format'](_0x1168('0x7'),_0x4601fe,_0x50cddd,_0x5e6752));var _0xe46a1c=_0x53baca['update'](_0x1972ca,_0x1168('0x8'),_0x1168('0x9'));_0xe46a1c+=_0x53baca['final']('utf8');var _0x355409=JSON[_0x1168('0xa')](_0xe46a1c);return _0x355409[_0x1168('0xb')](_0x3f21a4)?_0x355409[_0x3f21a4]:null;}}return null;}function isLimit(_0x35441b,_0x36050b,_0x50638d,_0x4123a5){var _0xbe4880=_0x36050b;return compose()[_0x1168('0xc')](function(_0x54baa8,_0x4002a2,_0x4fdd1c){return db[_0x1168('0xd')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x1168('0xe')](function(_0x20bb91){var _0x52c8a0=getValueFromLicense(_0x35441b,_0x20bb91);return _0x52c8a0?_0x52c8a0:_0xbe4880;})[_0x1168('0xe')](function(_0x41205b){_0xbe4880=_0x41205b;return _0x50638d['count'](_0x4123a5);})[_0x1168('0xe')](function(_0x5cdd34){if(_0x5cdd34>=_0xbe4880){return _0x4002a2[_0x1168('0xf')](0x193)[_0x1168('0x10')]({'message':util['format'](_0x1168('0x11'),_0x35441b)});}_0x4fdd1c();})[_0x1168('0x12')](function(_0x213c45){_0x4fdd1c(_0x213c45);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':_0x1168('0x13')},{'role':'user'}]}});}exports[_0x1168('0x14')]=isUserLimit; \ No newline at end of file +var _0xdd23=['composable-middleware','../../mysqldb','data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto'];(function(_0x2f3b99,_0x303684){var _0xc7875a=function(_0x9d965a){while(--_0x9d965a){_0x2f3b99['push'](_0x2f3b99['shift']());}};_0xc7875a(++_0x303684);}(_0xdd23,0x1a3));var _0x3dd2=function(_0x3d3fea,_0xb9616e){_0x3d3fea=_0x3d3fea-0x0;var _0x13744c=_0xdd23[_0x3d3fea];return _0x13744c;};'use strict';var crypto=require(_0x3dd2('0x0'));var util=require('util');var compose=require(_0x3dd2('0x1'));var db=require(_0x3dd2('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x5c7ac6,_0x192e90){if(_0x5c7ac6&&_0x192e90){if(_0x192e90[_0x3dd2('0x3')]&&_0x192e90['license']){var _0x1aba1c=_0x192e90[_0x3dd2('0x3')];var _0x35c9b8=_0x192e90[_0x3dd2('0x4')];var _0x45d4cd=_0x1aba1c[_0x3dd2('0x5')]('-')[0x4];var _0x69c49d=_0x1aba1c[_0x3dd2('0x5')]('-')[0x0];var _0x26766d=crypto[_0x3dd2('0x6')](_0x3dd2('0x7'),util['format'](_0x3dd2('0x8'),_0x45d4cd,_0x1aba1c,_0x69c49d));var _0x3a907a=_0x26766d['update'](_0x35c9b8,_0x3dd2('0x9'),_0x3dd2('0xa'));_0x3a907a+=_0x26766d[_0x3dd2('0xb')](_0x3dd2('0xa'));var _0x38129d=JSON[_0x3dd2('0xc')](_0x3a907a);return _0x38129d[_0x3dd2('0xd')](_0x5c7ac6)?_0x38129d[_0x5c7ac6]:null;}}return null;}function isLimit(_0x34eb49,_0x188b4e,_0x1108e7,_0x427d0a){var _0x56771c=_0x188b4e;return compose()[_0x3dd2('0xe')](function(_0x573cec,_0x31a82a,_0x44003f){return db[_0x3dd2('0xf')][_0x3dd2('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x3dd2('0x11')](function(_0x42f68a){var _0x18cbc7=getValueFromLicense(_0x34eb49,_0x42f68a);return _0x18cbc7?_0x18cbc7:_0x56771c;})[_0x3dd2('0x11')](function(_0x5f494f){_0x56771c=_0x5f494f;return _0x1108e7['count'](_0x427d0a);})[_0x3dd2('0x11')](function(_0x5cf876){if(_0x5cf876>=_0x56771c){return _0x31a82a[_0x3dd2('0x12')](0x193)[_0x3dd2('0x13')]({'message':util[_0x3dd2('0x14')](_0x3dd2('0x15'),_0x34eb49)});}_0x44003f();})[_0x3dd2('0x16')](function(_0x136ba7){_0x44003f(_0x136ba7);});});}function isUserLimit(){return isLimit(_0x3dd2('0x17'),0x1,db[_0x3dd2('0x18')],{'where':{'$or':[{'role':_0x3dd2('0x19')},{'role':_0x3dd2('0x1a')}]}});}exports[_0x3dd2('0x1b')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 25f18ec..a058ed4 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 _0x7f71=['split','filters','isEmpty','forOwn','sort','map','indexOf','priority','cast','col','unsigned','substr','omit','length','isObject','isString','isArray','unset','hasOwnProperty','lodash','fields'];(function(_0x4533ae,_0x2fdd61){var _0x339c89=function(_0x448372){while(--_0x448372){_0x4533ae['push'](_0x4533ae['shift']());}};_0x339c89(++_0x2fdd61);}(_0x7f71,0x178));var _0x17f7=function(_0xc5775d,_0x3701ab){_0xc5775d=_0xc5775d-0x0;var _0x3b4edd=_0x7f71[_0xc5775d];return _0x3b4edd;};'use strict';var _=require(_0x17f7('0x0'));var sequelize=require('sequelize');var LIMIT_VALUE=0xfa;exports[_0x17f7('0x1')]=function(_0xc5c116){var _0x8ba175=null;if(_0xc5c116){_0x8ba175=_0xc5c116[_0x17f7('0x2')](',');}return _0x8ba175;};exports[_0x17f7('0x3')]=function(_0x55502d){var _0x5bd903={};if(!_[_0x17f7('0x4')](_0x55502d)){_0x5bd903={};_[_0x17f7('0x5')](_0x55502d,function(_0x49836f,_0x47cb09){try{_0x5bd903[_0x47cb09]=JSON['parse'](_0x49836f);}catch(_0x35ddbb){_0x5bd903[_0x47cb09]=_0x49836f[_0x17f7('0x2')](',');}});}return _0x5bd903;};exports['limit']=function(_0x15d251){_0x15d251=parseInt(_0x15d251,0xa);if(!_0x15d251||_0x15d251<0x0){_0x15d251=LIMIT_VALUE;}return _0x15d251;};exports['offset']=function(_0xc1704b){_0xc1704b=parseInt(_0xc1704b,0xa);if(!_0xc1704b||_0xc1704b<0x0){_0xc1704b=0x0;}return _0xc1704b;};exports[_0x17f7('0x6')]=function(_0x1cd0c0){var _0x402df0,_0x3e373f=null;if(_0x1cd0c0){_0x402df0=_0x1cd0c0[_0x17f7('0x2')](',');_0x3e373f=_[_0x17f7('0x7')](_0x402df0,function(_0x184a0e){if(_0x184a0e[_0x17f7('0x8')]('-')===0x0){return[_0x184a0e===_0x17f7('0x9')?sequelize[_0x17f7('0xa')](sequelize[_0x17f7('0xb')]('priority'),_0x17f7('0xc')):_0x184a0e[_0x17f7('0xd')](0x1),'DESC'];}else{return[_0x184a0e===_0x17f7('0x9')?sequelize[_0x17f7('0xa')](sequelize[_0x17f7('0xb')](_0x17f7('0x9')),_0x17f7('0xc')):_0x184a0e,'ASC'];}});}return _0x3e373f;};exports[_0x17f7('0xe')]=function(_0x1b8eba,_0x1e6846){if(_[_0x17f7('0x4')](_0x1b8eba)){return _0x1b8eba;}if(_['isArray'](_0x1b8eba)){for(var _0x3f1aaa=0x0;_0x3f1aaa<_0x1b8eba[_0x17f7('0xf')];_0x3f1aaa+=0x1){_0x1b8eba[_0x3f1aaa]=this[_0x17f7('0xe')](_0x1b8eba[_0x3f1aaa],_0x1e6846);}return _0x1b8eba;}if(!_[_0x17f7('0x10')](_0x1b8eba)){return _0x1b8eba;}if(_[_0x17f7('0x11')](_0x1e6846)){_0x1e6846=[_0x1e6846];}if(!_[_0x17f7('0x12')](_0x1e6846)){return _0x1b8eba;}for(var _0x16a508=0x0;_0x16a508<_0x1e6846[_0x17f7('0xf')];_0x16a508+=0x1){_[_0x17f7('0x13')](_0x1b8eba,_0x1e6846[_0x16a508]);}for(var _0x3b48fd in _0x1b8eba){if(_0x1b8eba[_0x17f7('0x14')](_0x3b48fd)){_0x1b8eba[_0x3b48fd]=this[_0x17f7('0xe')](_0x1b8eba[_0x3b48fd],_0x1e6846);}}return _0x1b8eba;}; \ No newline at end of file +var _0xca35=['split','filters','isEmpty','parse','limit','offset','sort','indexOf','priority','cast','col','unsigned','substr','ASC','omit','isArray','isObject','isString','unset','hasOwnProperty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xca35,0x78));var _0x5ca3=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0xca35[_0xfcbcb8];return _0x1b1f97;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var LIMIT_VALUE=0xfa;exports['fields']=function(_0x55a1cc){var _0x5482f0=null;if(_0x55a1cc){_0x5482f0=_0x55a1cc[_0x5ca3('0x0')](',');}return _0x5482f0;};exports[_0x5ca3('0x1')]=function(_0x62cf22){var _0x40c511={};if(!_[_0x5ca3('0x2')](_0x62cf22)){_0x40c511={};_['forOwn'](_0x62cf22,function(_0x5e768c,_0x3a1eea){try{_0x40c511[_0x3a1eea]=JSON[_0x5ca3('0x3')](_0x5e768c);}catch(_0x1dfe70){_0x40c511[_0x3a1eea]=_0x5e768c[_0x5ca3('0x0')](',');}});}return _0x40c511;};exports[_0x5ca3('0x4')]=function(_0x4ec1ff){_0x4ec1ff=parseInt(_0x4ec1ff,0xa);if(!_0x4ec1ff||_0x4ec1ff<0x0){_0x4ec1ff=LIMIT_VALUE;}return _0x4ec1ff;};exports[_0x5ca3('0x5')]=function(_0xab896c){_0xab896c=parseInt(_0xab896c,0xa);if(!_0xab896c||_0xab896c<0x0){_0xab896c=0x0;}return _0xab896c;};exports[_0x5ca3('0x6')]=function(_0x20b1a4){var _0xee6a86,_0x1e0ec4=null;if(_0x20b1a4){_0xee6a86=_0x20b1a4[_0x5ca3('0x0')](',');_0x1e0ec4=_['map'](_0xee6a86,function(_0x561e28){if(_0x561e28[_0x5ca3('0x7')]('-')===0x0){return[_0x561e28===_0x5ca3('0x8')?sequelize[_0x5ca3('0x9')](sequelize[_0x5ca3('0xa')](_0x5ca3('0x8')),_0x5ca3('0xb')):_0x561e28[_0x5ca3('0xc')](0x1),'DESC'];}else{return[_0x561e28==='priority'?sequelize[_0x5ca3('0x9')](sequelize[_0x5ca3('0xa')](_0x5ca3('0x8')),_0x5ca3('0xb')):_0x561e28,_0x5ca3('0xd')];}});}return _0x1e0ec4;};exports[_0x5ca3('0xe')]=function(_0x3a091f,_0x3df24a){if(_['isEmpty'](_0x3a091f)){return _0x3a091f;}if(_[_0x5ca3('0xf')](_0x3a091f)){for(var _0x3d9661=0x0;_0x3d9661<_0x3a091f['length'];_0x3d9661+=0x1){_0x3a091f[_0x3d9661]=this[_0x5ca3('0xe')](_0x3a091f[_0x3d9661],_0x3df24a);}return _0x3a091f;}if(!_[_0x5ca3('0x10')](_0x3a091f)){return _0x3a091f;}if(_[_0x5ca3('0x11')](_0x3df24a)){_0x3df24a=[_0x3df24a];}if(!_['isArray'](_0x3df24a)){return _0x3a091f;}for(var _0x37cdda=0x0;_0x37cdda<_0x3df24a['length'];_0x37cdda+=0x1){_[_0x5ca3('0x12')](_0x3a091f,_0x3df24a[_0x37cdda]);}for(var _0x43778d in _0x3a091f){if(_0x3a091f[_0x5ca3('0x13')](_0x43778d)){_0x3a091f[_0x43778d]=this[_0x5ca3('0xe')](_0x3a091f[_0x43778d],_0x3df24a);}}return _0x3a091f;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 8655c80..e742bf7 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['passport','cors','moment','./environment','../mysqldb','get','env','production','use','join','root','public','favicon.ico','set','appPath','development','test','client','json\x20replacer','split','/server/views','engine','html','ejs','renderFile','urlencoded','50mb','json','express','serve-favicon','body-parser','method-override','errorhandler','path'];(function(_0x5093e9,_0x5154d0){var _0x4c9a22=function(_0x15176d){while(--_0x15176d){_0x5093e9['push'](_0x5093e9['shift']());}};_0x4c9a22(++_0x5154d0);}(_0x34e8,0x12c));var _0x834e=function(_0x424a2b,_0x390ad5){_0x424a2b=_0x424a2b-0x0;var _0x1e6ec8=_0x34e8[_0x424a2b];return _0x1e6ec8;};'use strict';var express=require(_0x834e('0x0'));var favicon=require(_0x834e('0x1'));var bodyParser=require(_0x834e('0x2'));var methodOverride=require(_0x834e('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require(_0x834e('0x4'));var path=require(_0x834e('0x5'));var passport=require(_0x834e('0x6'));var cors=require(_0x834e('0x7'));var moment=require(_0x834e('0x8'));var config=require(_0x834e('0x9'));var db=require(_0x834e('0xa'))['db'];exports['default']=function(_0x858aa1){var _0x52056d=_0x858aa1[_0x834e('0xb')](_0x834e('0xc'));if(_0x52056d===_0x834e('0xd')){_0x858aa1[_0x834e('0xe')](favicon(path[_0x834e('0xf')](config[_0x834e('0x10')],_0x834e('0x11'),_0x834e('0x12'))));_0x858aa1[_0x834e('0x13')](_0x834e('0x14'),path[_0x834e('0xf')](config[_0x834e('0x10')],_0x834e('0x11')));}if(_0x52056d===_0x834e('0x15')||_0x52056d===_0x834e('0x16')){_0x858aa1[_0x834e('0xe')](favicon(path[_0x834e('0xf')](config['root'],_0x834e('0x17'),_0x834e('0x12'))));_0x858aa1['set'](_0x834e('0x14'),path[_0x834e('0xf')](config[_0x834e('0x10')],_0x834e('0x17')));_0x858aa1['use'](errorHandler());}_0x858aa1[_0x834e('0x13')](_0x834e('0x18'),function(_0x57274a,_0x316205){if(this[_0x57274a]instanceof Date){_0x316205=this[_0x57274a]['toISOString']()[_0x834e('0x19')]('.')[0x0]+'Z';}return _0x316205;});_0x858aa1[_0x834e('0xe')](express['static'](_0x858aa1[_0x834e('0xb')](_0x834e('0x14'))));_0x858aa1[_0x834e('0x13')]('views',config[_0x834e('0x10')]+_0x834e('0x1a'));_0x858aa1[_0x834e('0x1b')](_0x834e('0x1c'),require(_0x834e('0x1d'))[_0x834e('0x1e')]);_0x858aa1[_0x834e('0x13')]('view\x20engine',_0x834e('0x1c'));_0x858aa1[_0x834e('0xe')](bodyParser[_0x834e('0x1f')]({'limit':_0x834e('0x20'),'extended':!![]}));_0x858aa1['use'](bodyParser[_0x834e('0x21')]({'limit':_0x834e('0x20')}));_0x858aa1['use'](cors());_0x858aa1[_0x834e('0xe')](methodOverride());_0x858aa1[_0x834e('0xe')](cookieParser());_0x858aa1[_0x834e('0xe')](passport['initialize']());}; \ No newline at end of file +var _0x9c44=['appPath','development','favicon.ico','set','client','json\x20replacer','split','static','views','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','body-parser','method-override','cookie-parser','errorhandler','path','passport','./environment','default','get','env','use','join','root','public'];(function(_0x169669,_0x1c7094){var _0x12e24d=function(_0x142462){while(--_0x142462){_0x169669['push'](_0x169669['shift']());}};_0x12e24d(++_0x1c7094);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var express=require('express');var favicon=require('serve-favicon');var bodyParser=require(_0x49c4('0x0'));var methodOverride=require(_0x49c4('0x1'));var cookieParser=require(_0x49c4('0x2'));var errorHandler=require(_0x49c4('0x3'));var path=require(_0x49c4('0x4'));var passport=require(_0x49c4('0x5'));var cors=require('cors');var moment=require('moment');var config=require(_0x49c4('0x6'));var db=require('../mysqldb')['db'];exports[_0x49c4('0x7')]=function(_0x6030ae){var _0x69bc41=_0x6030ae[_0x49c4('0x8')](_0x49c4('0x9'));if(_0x69bc41==='production'){_0x6030ae[_0x49c4('0xa')](favicon(path[_0x49c4('0xb')](config[_0x49c4('0xc')],_0x49c4('0xd'),'favicon.ico')));_0x6030ae['set'](_0x49c4('0xe'),path[_0x49c4('0xb')](config['root'],_0x49c4('0xd')));}if(_0x69bc41===_0x49c4('0xf')||_0x69bc41==='test'){_0x6030ae['use'](favicon(path[_0x49c4('0xb')](config[_0x49c4('0xc')],'client',_0x49c4('0x10'))));_0x6030ae[_0x49c4('0x11')]('appPath',path[_0x49c4('0xb')](config[_0x49c4('0xc')],_0x49c4('0x12')));_0x6030ae[_0x49c4('0xa')](errorHandler());}_0x6030ae[_0x49c4('0x11')](_0x49c4('0x13'),function(_0x75ea8,_0x3de397){if(this[_0x75ea8]instanceof Date){_0x3de397=this[_0x75ea8]['toISOString']()[_0x49c4('0x14')]('.')[0x0]+'Z';}return _0x3de397;});_0x6030ae[_0x49c4('0xa')](express[_0x49c4('0x15')](_0x6030ae[_0x49c4('0x8')](_0x49c4('0xe'))));_0x6030ae['set'](_0x49c4('0x16'),config[_0x49c4('0xc')]+'/server/views');_0x6030ae['engine'](_0x49c4('0x17'),require(_0x49c4('0x18'))[_0x49c4('0x19')]);_0x6030ae['set'](_0x49c4('0x1a'),'html');_0x6030ae[_0x49c4('0xa')](bodyParser[_0x49c4('0x1b')]({'limit':_0x49c4('0x1c'),'extended':!![]}));_0x6030ae[_0x49c4('0xa')](bodyParser[_0x49c4('0x1d')]({'limit':_0x49c4('0x1c')}));_0x6030ae[_0x49c4('0xa')](cors());_0x6030ae[_0x49c4('0xa')](methodOverride());_0x6030ae[_0x49c4('0xa')](cookieParser());_0x6030ae['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 6be9a02..984cf28 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 _0xf6c3=['model','join','update','digest','hex','platform','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','substring','lodash','crypto','child_process','networkInterfaces','orderBy','keys','length','filter','family','IPv4','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xf6c3,0x1cf));var _0x3f6c=function(_0x3da79c,_0x3cfe54){_0x3da79c=_0x3da79c-0x0;var _0x34ec41=_0xf6c3[_0x3da79c];return _0x34ec41;};'use strict';var _=require(_0x3f6c('0x0'));var os=require('os');var crypto=require(_0x3f6c('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x3f6c('0x2'))['execSync'];function getInterfaces(){var _0x74dd3=[];var _0x4f70ba=os[_0x3f6c('0x3')]();var _0x3f129f=_[_0x3f6c('0x4')](_[_0x3f6c('0x5')](_0x4f70ba));for(var _0x1ce3a7=0x0;_0x1ce3a7<_0x3f129f[_0x3f6c('0x6')];_0x1ce3a7++){var _0x1d6889=_0x4f70ba[_0x3f129f[_0x1ce3a7]][_0x3f6c('0x7')](function(_0x2ff7ca){return _0x2ff7ca[_0x3f6c('0x8')]===_0x3f6c('0x9')&&_0x2ff7ca['internal']===![];});_0x74dd3=_0x74dd3['concat'](_0x1d6889);}return _0x74dd3;}function getFirstInterface(){var _0x56236b=_[_0x3f6c('0xa')](getInterfaces());return{'macAddress':_0x56236b&&_0x56236b[_0x3f6c('0xb')]?_0x56236b[_0x3f6c('0xb')]:_0x3f6c('0xc'),'ipAddress':_0x56236b&&_0x56236b[_0x3f6c('0xd')]?_0x56236b['address']:_0x3f6c('0xe')};}exports[_0x3f6c('0xf')]=getFirstInterface;function getCPUhash(){var _0x2a045a=_[_0x3f6c('0x4')](os['cpus']()[_0x3f6c('0x10')](function(_0x1e1746){return _0x1e1746[_0x3f6c('0x11')];}))[_0x3f6c('0x12')](':');return crypto['createHash']('md5')[_0x3f6c('0x13')](_0x2a045a)[_0x3f6c('0x14')](_0x3f6c('0x15'));}exports['getUuid']=function(){switch(os[_0x3f6c('0x16')]()){case'win32':return exec(_0x3f6c('0x17'),{'encoding':_0x3f6c('0x18')})[_0x3f6c('0x19')]('\x0d\x0a','');default:var _0x4cf0b6=getFirstInterface();var _0x768008=getCPUhash();var _0x18dec9=_0x768008+'|'+os[_0x3f6c('0x1a')]()+'|'+_0x4cf0b6[_0x3f6c('0x1b')]+'|'+_0x4cf0b6[_0x3f6c('0x1c')];var _0x397bf5=crypto['createHash']('md5')[_0x3f6c('0x13')](_0x18dec9)[_0x3f6c('0x14')](_0x3f6c('0x15'));return _0x397bf5['substring'](0x0,0x8)+'-'+_0x397bf5['substring'](0x8,0xc)+'-'+_0x397bf5['substring'](0xc,0x10)+'-'+_0x397bf5[_0x3f6c('0x1d')](0x10,0x14)+'-'+_0x397bf5[_0x3f6c('0x1d')](0x14);}}; \ No newline at end of file +var _0x212c=['crypto','bimedia-machine-uuid','child_process','networkInterfaces','orderBy','keys','length','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','join','md5','update','digest','hex','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','ipAddress','createHash','substring','lodash'];(function(_0x8e1e89,_0x396be9){var _0x411cbd=function(_0x47aaad){while(--_0x47aaad){_0x8e1e89['push'](_0x8e1e89['shift']());}};_0x411cbd(++_0x396be9);}(_0x212c,0x15d));var _0xc212=function(_0x4116f3,_0x458df3){_0x4116f3=_0x4116f3-0x0;var _0x103289=_0x212c[_0x4116f3];return _0x103289;};'use strict';var _=require(_0xc212('0x0'));var os=require('os');var crypto=require(_0xc212('0x1'));var machine=require(_0xc212('0x2'));var exec=require(_0xc212('0x3'))['execSync'];function getInterfaces(){var _0x54cfb6=[];var _0x33e240=os[_0xc212('0x4')]();var _0x1bf365=_[_0xc212('0x5')](_[_0xc212('0x6')](_0x33e240));for(var _0x5d3811=0x0;_0x5d3811<_0x1bf365[_0xc212('0x7')];_0x5d3811++){var _0x3cdaae=_0x33e240[_0x1bf365[_0x5d3811]][_0xc212('0x8')](function(_0x3402e0){return _0x3402e0[_0xc212('0x9')]==='IPv4'&&_0x3402e0[_0xc212('0xa')]===![];});_0x54cfb6=_0x54cfb6[_0xc212('0xb')](_0x3cdaae);}return _0x54cfb6;}function getFirstInterface(){var _0x32c885=_[_0xc212('0xc')](getInterfaces());return{'macAddress':_0x32c885&&_0x32c885[_0xc212('0xd')]?_0x32c885[_0xc212('0xd')]:_0xc212('0xe'),'ipAddress':_0x32c885&&_0x32c885[_0xc212('0xf')]?_0x32c885[_0xc212('0xf')]:_0xc212('0x10')};}exports[_0xc212('0x11')]=getFirstInterface;function getCPUhash(){var _0x4fdacf=_[_0xc212('0x5')](os[_0xc212('0x12')]()['map'](function(_0x140dbd){return _0x140dbd[_0xc212('0x13')];}))[_0xc212('0x14')](':');return crypto['createHash'](_0xc212('0x15'))[_0xc212('0x16')](_0x4fdacf)[_0xc212('0x17')](_0xc212('0x18'));}exports[_0xc212('0x19')]=function(){switch(os[_0xc212('0x1a')]()){case _0xc212('0x1b'):return exec(_0xc212('0x1c'),{'encoding':_0xc212('0x1d')})['replace']('\x0d\x0a','');default:var _0x599c74=getFirstInterface();var _0x121c53=getCPUhash();var _0x2eb6a8=_0x121c53+'|'+os[_0xc212('0x1e')]()+'|'+_0x599c74[_0xc212('0x1f')]+'|'+_0x599c74[_0xc212('0x20')];var _0x175fd5=crypto[_0xc212('0x21')](_0xc212('0x15'))[_0xc212('0x16')](_0x2eb6a8)[_0xc212('0x17')]('hex');return _0x175fd5['substring'](0x0,0x8)+'-'+_0x175fd5[_0xc212('0x22')](0x8,0xc)+'-'+_0x175fd5[_0xc212('0x22')](0xc,0x10)+'-'+_0x175fd5[_0xc212('0x22')](0x10,0x14)+'-'+_0x175fd5['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index cbf2f11..19d6b9c 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 _0x85fe=['aes-256-ctr','update','base64','final','createDecipher','secrets','session','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','email','then','|reason|','|machineUuid|','|name|','|email|','getFirstInterface','openIssue','Motion\x20License\x20Alert','Alert','get','active','license','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','DEMO\x20START\x20AT\x20%s','message','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','catch','default','util','https','crypto','moment','pkginfo','version','../../mysqldb','./hardware','../logger','www.xcallymotion.com','/api/servers/%s/check?version=%s','exports','format','/api/servers/%s/check?version=%s&oldtoken=%s','GET','application/json','request','setEncoding','utf8','data','end','error','createCipher'];(function(_0x1d30e2,_0x283441){var _0x3b422f=function(_0x4089c5){while(--_0x4089c5){_0x1d30e2['push'](_0x1d30e2['shift']());}};_0x3b422f(++_0x283441);}(_0x85fe,0x73));var _0xe85f=function(_0x5c9472,_0x19655a){_0x5c9472=_0x5c9472-0x0;var _0x1fd215=_0x85fe[_0x5c9472];return _0x1fd215;};'use strict';var util=require(_0xe85f('0x0'));var https=require(_0xe85f('0x1'));var crypto=require(_0xe85f('0x2'));var moment=require(_0xe85f('0x3'));var BPromise=require('bluebird');var pkginfo=require(_0xe85f('0x4'))(module,_0xe85f('0x5'));var db=require(_0xe85f('0x6'))['db'];var config=require('../environment');var hardware=require(_0xe85f('0x7'));var logger=require(_0xe85f('0x8'))('license');var jira=require('../../api/jira/jira.controller');var HOST=_0xe85f('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x5b963c){return new BPromise(function(_0x2c117e,_0x465710){var _0x33623d=util['format'](_0xe85f('0xa'),_0x5b963c,module[_0xe85f('0xb')][_0xe85f('0x5')]);if(oldToken){_0x33623d=util[_0xe85f('0xc')](_0xe85f('0xd'),_0x5b963c,module[_0xe85f('0xb')][_0xe85f('0x5')],oldToken);}var _0x567f48={'host':HOST,'port':0x1bb,'path':util[_0xe85f('0xc')]('/api/servers/%s/check?version=%s',_0x5b963c,module[_0xe85f('0xb')][_0xe85f('0x5')]),'method':_0xe85f('0xe'),'timeout':0xea60,'headers':{'Content-Type':_0xe85f('0xf')}};var _0x296e1d=https[_0xe85f('0x10')](_0x567f48,function(_0x4c20cf){_0x4c20cf[_0xe85f('0x11')](_0xe85f('0x12'));var _0x1c4ddb='';_0x4c20cf['on'](_0xe85f('0x13'),function(_0xa9d745){_0x1c4ddb+=_0xa9d745;});_0x4c20cf['on'](_0xe85f('0x14'),function(){try{_0x2c117e(JSON['parse'](_0x1c4ddb));}catch(_0x3a71f1){_0x465710(_0x3a71f1);}});});_0x296e1d['on'](_0xe85f('0x15'),_0x465710);_0x296e1d[_0xe85f('0x14')]();});}function encryptDate(_0x29800b){var _0xd8d718=crypto[_0xe85f('0x16')](_0xe85f('0x17'),config['secrets']['session']);var _0x49fa64=_0xd8d718[_0xe85f('0x18')](_0x29800b,_0xe85f('0x12'),_0xe85f('0x19'));_0x49fa64+=_0xd8d718[_0xe85f('0x1a')](_0xe85f('0x19'));return _0x49fa64;}function decryptDate(_0x420c3d){var _0x4fe226=crypto[_0xe85f('0x1b')]('aes-256-ctr',config[_0xe85f('0x1c')][_0xe85f('0x1d')]);var _0x11c6c0=_0x4fe226[_0xe85f('0x18')](_0x420c3d,_0xe85f('0x19'),'utf8');_0x11c6c0+=_0x4fe226[_0xe85f('0x1a')](_0xe85f('0x12'));return _0x11c6c0;}function sendJiraAlert(_0x11886f,_0x34edfe,_0x51eb26){var _0x2cf23f=_0xe85f('0x1e');return db[_0xe85f('0x1f')][_0xe85f('0x20')]({'where':{'role':_0xe85f('0x21')},'attributes':[_0xe85f('0x22'),_0xe85f('0x23')],'raw':!![]})[_0xe85f('0x24')](function(_0x101905){ADMIN=_0x101905;_0x2cf23f+=_0xe85f('0x25')+_0x51eb26+'|\x0a';_0x2cf23f+='|uuid|'+_0x11886f+'|\x0a';_0x2cf23f+=_0xe85f('0x26')+_0x34edfe+'|\x0a';_0x2cf23f+=_0xe85f('0x27')+ADMIN[_0xe85f('0x22')]+'|\x0a';_0x2cf23f+=_0xe85f('0x28')+ADMIN['email']+'|\x0a';return _0x2cf23f;})['then'](function(_0x20daa8){var _0x52ed28=hardware[_0xe85f('0x29')]()['ipAddress'];return jira[_0xe85f('0x2a')]({'key':'MOTLICENSE','summary':_0xe85f('0x2b'),'description':_0x20daa8,'issuetype':_0xe85f('0x2c'),'oldToken':_0x11886f,'newToken':_0x34edfe,'email':ADMIN[_0xe85f('0x23')],'name':ADMIN[_0xe85f('0x22')],'reason':GRAY_PERIOD_REASON,'ip':_0x52ed28});});}function manageLicense(_0x589544,_0x283e44){var _0x27e6be=_0x283e44[_0xe85f('0x2d')]({'plain':!![]});httpRequest(_0x589544)['then'](function(_0x1bc32f){if(oldToken){oldToken=undefined;}if(_0x1bc32f[_0xe85f('0x2e')]){if(!_0x27e6be[_0xe85f('0x2f')]&&_0x27e6be['license']!=_0x1bc32f[_0xe85f('0x2f')]||_0x27e6be[_0xe85f('0x2f')]&&_0x27e6be[_0xe85f('0x30')]){logger[_0xe85f('0x31')](_0xe85f('0x32'));}if(_0x27e6be[_0xe85f('0x2f')]&&!_0x27e6be['data2']&&_0x27e6be[_0xe85f('0x2f')]!=_0x1bc32f[_0xe85f('0x2f')]){logger[_0xe85f('0x31')](_0xe85f('0x33'));}if(_0x27e6be[_0xe85f('0x2f')]&&!_0x27e6be['data2']&&_0x27e6be[_0xe85f('0x2f')]==_0x1bc32f[_0xe85f('0x2f')]){return _0x283e44;}return _0x283e44[_0xe85f('0x18')]({'data1':_0x589544,'data2':null,'license':_0x1bc32f[_0xe85f('0x2f')]});}else{if(_0x1bc32f[_0xe85f('0x2f')]||_0x27e6be[_0xe85f('0x2f')]){if(!_0x27e6be['data2']){if(_0x27e6be[_0xe85f('0x34')]==_0x589544){GRAY_PERIOD_REASON=_0xe85f('0x35');logger[_0xe85f('0x31')](_0xe85f('0x36'));}else{GRAY_PERIOD_REASON=_0xe85f('0x37');oldToken=_0x27e6be[_0xe85f('0x34')];logger[_0xe85f('0x31')](_0xe85f('0x38'),_0x27e6be[_0xe85f('0x34')],_0x589544);}sendJiraAlert(_0x27e6be[_0xe85f('0x34')],_0x1bc32f[_0xe85f('0x39')],GRAY_PERIOD_REASON);logger[_0xe85f('0x31')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xe85f('0x3a')](),moment()[_0xe85f('0xc')](_0xe85f('0x3b')));return _0x283e44['update']({'data2':encryptDate(moment()[_0xe85f('0xc')](_0xe85f('0x3b')))});}else{if(moment()[_0xe85f('0x3c')](decryptDate(_0x27e6be[_0xe85f('0x30')]),'days')>DAYS){logger[_0xe85f('0x31')](_0xe85f('0x3d'),moment()['format'](_0xe85f('0x3b')));return _0x283e44[_0xe85f('0x18')]({'data1':_0x589544,'data2':null,'license':null});}}}else{if(_0x27e6be['data1']!=_0x589544){logger[_0xe85f('0x31')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x27e6be['data1'],_0x589544);return _0x283e44[_0xe85f('0x18')]({'data1':_0x589544,'data2':null,'license':null});}}}return _0x283e44;})['then'](function(_0x5edc94){_0x283e44=_0x5edc94;})['catch'](function(_0x21afb8){logger[_0xe85f('0x15')](_0x21afb8[_0xe85f('0x3e')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xe85f('0x3f')](),_0x283e44);},TIME);});}function defaultLicense(){var _0x1667c8=hardware[_0xe85f('0x3f')]();if(_0x1667c8){return db[_0xe85f('0x40')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x1667c8}})[_0xe85f('0x41')](function(_0x5d135d,_0x5c3b8c){logger[_0xe85f('0x31')](_0xe85f('0x42'),_0x1667c8);manageLicense(_0x1667c8,_0x5d135d);})[_0xe85f('0x43')](function(_0x4625b2){logger['error'](_0x4625b2[_0xe85f('0x3e')]);});}}exports[_0xe85f('0x44')]=defaultLicense; \ No newline at end of file +var _0xb786=['|uuid|','|machineUuid|','|name|','email','then','getFirstInterface','Alert','get','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','catch','error','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','https','crypto','bluebird','pkginfo','version','../environment','./hardware','../logger','license','../../api/jira/jira.controller','format','/api/servers/%s/check?version=%s','exports','GET','application/json','request','setEncoding','utf8','data','parse','aes-256-ctr','session','update','base64','createDecipher','secrets','final','||FIELD||VALUE||\x0a','findOne','fullname','|reason|'];(function(_0x15a296,_0x4357a){var _0xff8396=function(_0x2fbaef){while(--_0x2fbaef){_0x15a296['push'](_0x15a296['shift']());}};_0xff8396(++_0x4357a);}(_0xb786,0x1d8));var _0x6b78=function(_0x4c22d3,_0x2e2c58){_0x4c22d3=_0x4c22d3-0x0;var _0x724640=_0xb786[_0x4c22d3];return _0x724640;};'use strict';var util=require(_0x6b78('0x0'));var https=require(_0x6b78('0x1'));var crypto=require(_0x6b78('0x2'));var moment=require('moment');var BPromise=require(_0x6b78('0x3'));var pkginfo=require(_0x6b78('0x4'))(module,_0x6b78('0x5'));var db=require('../../mysqldb')['db'];var config=require(_0x6b78('0x6'));var hardware=require(_0x6b78('0x7'));var logger=require(_0x6b78('0x8'))(_0x6b78('0x9'));var jira=require(_0x6b78('0xa'));var HOST='www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x3c4c19){return new BPromise(function(_0x411dbe,_0x3f8e3b){var _0x16e5d8=util[_0x6b78('0xb')](_0x6b78('0xc'),_0x3c4c19,module[_0x6b78('0xd')][_0x6b78('0x5')]);if(oldToken){_0x16e5d8=util[_0x6b78('0xb')]('/api/servers/%s/check?version=%s&oldtoken=%s',_0x3c4c19,module[_0x6b78('0xd')]['version'],oldToken);}var _0x122d91={'host':HOST,'port':0x1bb,'path':util[_0x6b78('0xb')](_0x6b78('0xc'),_0x3c4c19,module[_0x6b78('0xd')][_0x6b78('0x5')]),'method':_0x6b78('0xe'),'timeout':0xea60,'headers':{'Content-Type':_0x6b78('0xf')}};var _0x4686f3=https[_0x6b78('0x10')](_0x122d91,function(_0x18ec4a){_0x18ec4a[_0x6b78('0x11')](_0x6b78('0x12'));var _0x2b9ea6='';_0x18ec4a['on'](_0x6b78('0x13'),function(_0x3fd9be){_0x2b9ea6+=_0x3fd9be;});_0x18ec4a['on']('end',function(){try{_0x411dbe(JSON[_0x6b78('0x14')](_0x2b9ea6));}catch(_0x450728){_0x3f8e3b(_0x450728);}});});_0x4686f3['on']('error',_0x3f8e3b);_0x4686f3['end']();});}function encryptDate(_0x481173){var _0x2e8e64=crypto['createCipher'](_0x6b78('0x15'),config['secrets'][_0x6b78('0x16')]);var _0x1cb1eb=_0x2e8e64[_0x6b78('0x17')](_0x481173,_0x6b78('0x12'),'base64');_0x1cb1eb+=_0x2e8e64['final'](_0x6b78('0x18'));return _0x1cb1eb;}function decryptDate(_0x296b82){var _0x2eaa8a=crypto[_0x6b78('0x19')](_0x6b78('0x15'),config[_0x6b78('0x1a')][_0x6b78('0x16')]);var _0x3aa183=_0x2eaa8a[_0x6b78('0x17')](_0x296b82,_0x6b78('0x18'),'utf8');_0x3aa183+=_0x2eaa8a[_0x6b78('0x1b')](_0x6b78('0x12'));return _0x3aa183;}function sendJiraAlert(_0x2e0f63,_0x28ac76,_0x7f2406){var _0x2da214=_0x6b78('0x1c');return db['User'][_0x6b78('0x1d')]({'where':{'role':'admin'},'attributes':[_0x6b78('0x1e'),'email'],'raw':!![]})['then'](function(_0x193649){ADMIN=_0x193649;_0x2da214+=_0x6b78('0x1f')+_0x7f2406+'|\x0a';_0x2da214+=_0x6b78('0x20')+_0x2e0f63+'|\x0a';_0x2da214+=_0x6b78('0x21')+_0x28ac76+'|\x0a';_0x2da214+=_0x6b78('0x22')+ADMIN['fullname']+'|\x0a';_0x2da214+='|email|'+ADMIN[_0x6b78('0x23')]+'|\x0a';return _0x2da214;})[_0x6b78('0x24')](function(_0x48c169){var _0x376df1=hardware[_0x6b78('0x25')]()['ipAddress'];return jira['openIssue']({'key':'MOTLICENSE','summary':'Motion\x20License\x20Alert','description':_0x48c169,'issuetype':_0x6b78('0x26'),'oldToken':_0x2e0f63,'newToken':_0x28ac76,'email':ADMIN[_0x6b78('0x23')],'name':ADMIN[_0x6b78('0x1e')],'reason':GRAY_PERIOD_REASON,'ip':_0x376df1});});}function manageLicense(_0x4006cf,_0x59fa07){var _0x26f260=_0x59fa07[_0x6b78('0x27')]({'plain':!![]});httpRequest(_0x4006cf)['then'](function(_0x4d76f8){if(oldToken){oldToken=undefined;}if(_0x4d76f8[_0x6b78('0x28')]){if(!_0x26f260[_0x6b78('0x9')]&&_0x26f260[_0x6b78('0x9')]!=_0x4d76f8[_0x6b78('0x9')]||_0x26f260[_0x6b78('0x9')]&&_0x26f260['data2']){logger[_0x6b78('0x29')](_0x6b78('0x2a'));}if(_0x26f260['license']&&!_0x26f260[_0x6b78('0x2b')]&&_0x26f260[_0x6b78('0x9')]!=_0x4d76f8['license']){logger[_0x6b78('0x29')](_0x6b78('0x2c'));}if(_0x26f260[_0x6b78('0x9')]&&!_0x26f260['data2']&&_0x26f260[_0x6b78('0x9')]==_0x4d76f8[_0x6b78('0x9')]){return _0x59fa07;}return _0x59fa07[_0x6b78('0x17')]({'data1':_0x4006cf,'data2':null,'license':_0x4d76f8['license']});}else{if(_0x4d76f8[_0x6b78('0x9')]||_0x26f260[_0x6b78('0x9')]){if(!_0x26f260[_0x6b78('0x2b')]){if(_0x26f260[_0x6b78('0x2d')]==_0x4006cf){GRAY_PERIOD_REASON='Disabled';logger[_0x6b78('0x29')](_0x6b78('0x2e'));}else{GRAY_PERIOD_REASON=_0x6b78('0x2f');oldToken=_0x26f260[_0x6b78('0x2d')];logger[_0x6b78('0x29')](_0x6b78('0x30'),_0x26f260['data1'],_0x4006cf);}sendJiraAlert(_0x26f260[_0x6b78('0x2d')],_0x4d76f8[_0x6b78('0x31')],GRAY_PERIOD_REASON);logger[_0x6b78('0x29')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x6b78('0x32')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x59fa07[_0x6b78('0x17')]({'data2':encryptDate(moment()['format'](_0x6b78('0x33')))});}else{if(moment()[_0x6b78('0x34')](decryptDate(_0x26f260[_0x6b78('0x2b')]),_0x6b78('0x35'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()['format'](_0x6b78('0x33')));return _0x59fa07[_0x6b78('0x17')]({'data1':_0x4006cf,'data2':null,'license':null});}}}else{if(_0x26f260[_0x6b78('0x2d')]!=_0x4006cf){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x26f260[_0x6b78('0x2d')],_0x4006cf);return _0x59fa07['update']({'data1':_0x4006cf,'data2':null,'license':null});}}}return _0x59fa07;})[_0x6b78('0x24')](function(_0x244419){_0x59fa07=_0x244419;})[_0x6b78('0x36')](function(_0x57fb90){logger[_0x6b78('0x37')](_0x57fb90['message']);})[_0x6b78('0x38')](function(){setTimeout(function(){manageLicense(hardware[_0x6b78('0x39')](),_0x59fa07);},TIME);});}function defaultLicense(){var _0x26b2e4=hardware[_0x6b78('0x39')]();if(_0x26b2e4){return db[_0x6b78('0x3a')][_0x6b78('0x3b')]({'where':{'id':0x1},'defaults':{'data1':_0x26b2e4}})['spread'](function(_0x2d3edd,_0x4587d5){logger[_0x6b78('0x29')](_0x6b78('0x3c'),_0x26b2e4);manageLicense(_0x26b2e4,_0x2d3edd);})['catch'](function(_0x2b5723){logger['error'](_0x2b5723[_0x6b78('0x3d')]);});}}exports[_0x6b78('0x3e')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index ab8cfd7..0e83ff4 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 _0xd528=['machineUuid','secrets','session','utf8','gray','deadline','add','days','changed','2027-01-01T00:00:00.000Z','Breaking\x20license','getUuid','message','getLicense','License','find','defaults','then','checkLicense','util','lodash','./hardware','../../mysqldb','license','License\x20key\x20value\x20not\x20found','data1','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','final','parse','uuid'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xd528,0x1c3));var _0x8d52=function(_0xbe6165,_0x1a5bbd){_0xbe6165=_0xbe6165-0x0;var _0xf41b3c=_0xd528[_0xbe6165];return _0xf41b3c;};'use strict';var crypto=require('crypto');var util=require(_0x8d52('0x0'));var _=require(_0x8d52('0x1'));var moment=require('moment');var hardware=require(_0x8d52('0x2'));var config=require('../environment');var db=require(_0x8d52('0x3'))['db'];function checkLicense(_0x110e85,_0x4f126b){if(_0x110e85){try{var _0x40b291=_0x4f126b||_0x110e85[_0x8d52('0x4')];if(_['isEmpty'](_0x40b291)){throw new Error(_0x8d52('0x5'));}var _0x494c94=_0x110e85[_0x8d52('0x6')];var _0x271ac5=_0x110e85['data2'];var _0x219450=_0x494c94[_0x8d52('0x7')]('-')[0x4];var _0x278b1f=_0x494c94['split']('-')[0x0];var _0x3927f7=crypto[_0x8d52('0x8')](_0x8d52('0x9'),util[_0x8d52('0xa')](_0x8d52('0xb'),_0x219450,_0x494c94,_0x278b1f));var _0x3fca33=_0x3927f7[_0x8d52('0xc')](_0x40b291,_0x8d52('0xd'),'utf8');_0x3fca33+=_0x3927f7[_0x8d52('0xe')]('utf8');var _0x552eb2=JSON[_0x8d52('0xf')](_0x3fca33);_0x552eb2['demo']=![];_0x552eb2[_0x8d52('0x10')]=_0x494c94;_0x552eb2[_0x8d52('0x11')]=hardware['getUuid']();if(_0x271ac5){var _0x40a5e2=crypto[_0x8d52('0x8')]('aes-256-ctr',config[_0x8d52('0x12')][_0x8d52('0x13')]);var _0x3a621f=_0x40a5e2[_0x8d52('0xc')](_0x271ac5,_0x8d52('0xd'),_0x8d52('0x14'));_0x3a621f+=_0x40a5e2['final']('utf8');_0x552eb2[_0x8d52('0x15')]=_0x3a621f;_0x552eb2[_0x8d52('0x16')]=moment(_0x3a621f)[_0x8d52('0x17')](0x7,_0x8d52('0x18'))['format']();_0x552eb2['grayReason']=_0x552eb2[_0x8d52('0x10')]!=_0x552eb2['machineUuid']?_0x8d52('0x19'):'disabled';}return _0x552eb2;}catch(_0xea8cf3){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x8d52('0x1a'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x8d52('0x1b'),'uuid':_0x110e85[_0x8d52('0x6')],'machineUuid':hardware[_0x8d52('0x1c')](),'message':_0xea8cf3[_0x8d52('0x1d')],'virtual':0x0,'voice':!![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x8d52('0x1a'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Demo\x20license','uuid':_0x110e85['data1'],'machineUuid':hardware[_0x8d52('0x1c')](),'virtual':0x0,'voice':!![],'preferred':![]};}exports[_0x8d52('0x1e')]=function(_0x38c167){return db[_0x8d52('0x1f')][_0x8d52('0x20')](_[_0x8d52('0x21')](_0x38c167,{'raw':!![],'where':{'id':0x1}}))[_0x8d52('0x22')](function(_0x4eb782){return checkLicense(_0x4eb782,null);});};exports[_0x8d52('0x23')]=checkLicense; \ No newline at end of file +var _0x56c4=['Breaking\x20license','2027-01-01T00:00:00.000Z','Demo\x20license','getLicense','License','defaults','then','checkLicense','crypto','util','lodash','moment','../../mysqldb','isEmpty','data1','data2','split','%s:%s:%s','update','utf8','final','parse','demo','uuid','machineUuid','getUuid','aes-256-ctr','secrets','session','base64','gray','deadline','add','format'];(function(_0x57028d,_0x434748){var _0x188d2d=function(_0x5a38d6){while(--_0x5a38d6){_0x57028d['push'](_0x57028d['shift']());}};_0x188d2d(++_0x434748);}(_0x56c4,0x1e4));var _0x456c=function(_0x2d7868,_0x516d8a){_0x2d7868=_0x2d7868-0x0;var _0x140fde=_0x56c4[_0x2d7868];return _0x140fde;};'use strict';var crypto=require(_0x456c('0x0'));var util=require(_0x456c('0x1'));var _=require(_0x456c('0x2'));var moment=require(_0x456c('0x3'));var hardware=require('./hardware');var config=require('../environment');var db=require(_0x456c('0x4'))['db'];function checkLicense(_0x4af7fb,_0xde8ac3){if(_0x4af7fb){try{var _0x31006c=_0xde8ac3||_0x4af7fb['license'];if(_[_0x456c('0x5')](_0x31006c)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x5ccf14=_0x4af7fb[_0x456c('0x6')];var _0xd1c999=_0x4af7fb[_0x456c('0x7')];var _0xb0928a=_0x5ccf14[_0x456c('0x8')]('-')[0x4];var _0x4bf20=_0x5ccf14[_0x456c('0x8')]('-')[0x0];var _0x32cdab=crypto['createDecipher']('aes-256-ctr',util['format'](_0x456c('0x9'),_0xb0928a,_0x5ccf14,_0x4bf20));var _0x33dcdf=_0x32cdab[_0x456c('0xa')](_0x31006c,'base64',_0x456c('0xb'));_0x33dcdf+=_0x32cdab[_0x456c('0xc')](_0x456c('0xb'));var _0x5ceece=JSON[_0x456c('0xd')](_0x33dcdf);_0x5ceece[_0x456c('0xe')]=![];_0x5ceece[_0x456c('0xf')]=_0x5ccf14;_0x5ceece[_0x456c('0x10')]=hardware[_0x456c('0x11')]();if(_0xd1c999){var _0x249dfd=crypto['createDecipher'](_0x456c('0x12'),config[_0x456c('0x13')][_0x456c('0x14')]);var _0x451b11=_0x249dfd[_0x456c('0xa')](_0xd1c999,_0x456c('0x15'),_0x456c('0xb'));_0x451b11+=_0x249dfd[_0x456c('0xc')](_0x456c('0xb'));_0x5ceece[_0x456c('0x16')]=_0x451b11;_0x5ceece[_0x456c('0x17')]=moment(_0x451b11)[_0x456c('0x18')](0x7,'days')[_0x456c('0x19')]();_0x5ceece['grayReason']=_0x5ceece[_0x456c('0xf')]!=_0x5ceece[_0x456c('0x10')]?'changed':'disabled';}return _0x5ceece;}catch(_0x366e12){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':_0x456c('0x1a'),'uuid':_0x4af7fb[_0x456c('0x6')],'machineUuid':hardware[_0x456c('0x11')](),'message':_0x366e12['message'],'virtual':0x0,'voice':!![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x456c('0x1b'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x456c('0x1c'),'uuid':_0x4af7fb['data1'],'machineUuid':hardware[_0x456c('0x11')](),'virtual':0x0,'voice':!![],'preferred':![]};}exports[_0x456c('0x1d')]=function(_0x7f98aa){return db[_0x456c('0x1e')]['find'](_[_0x456c('0x1f')](_0x7f98aa,{'raw':!![],'where':{'id':0x1}}))[_0x456c('0x20')](function(_0x35a91c){return checkLicense(_0x35a91c,null);});};exports[_0x456c('0x21')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 33efeb7..cc7b4f3 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 _0x534d=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x534d,0x79));var _0xd534=function(_0x1fc620,_0x40a88e){_0x1fc620=_0x1fc620-0x0;var _0x57e28e=_0x534d[_0x1fc620];return _0x57e28e;};'use strict';module[_0xd534('0x0')]={'DOMAIN':_0xd534('0x1'),'SESSION_SECRET':_0xd534('0x2'),'GOOGLE_ID':_0xd534('0x3'),'GOOGLE_SECRET':_0xd534('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x702d=['app-id','secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x4631dc,_0x6dec53){var _0xc0586a=function(_0x839f2a){while(--_0x839f2a){_0x4631dc['push'](_0x4631dc['shift']());}};_0xc0586a(++_0x6dec53);}(_0x702d,0x147));var _0xd702=function(_0x5505f5,_0xf174ed){_0x5505f5=_0x5505f5-0x0;var _0x2c0247=_0x702d[_0x5505f5];return _0x2c0247;};'use strict';module[_0xd702('0x0')]={'DOMAIN':_0xd702('0x1'),'SESSION_SECRET':_0xd702('0x2'),'GOOGLE_ID':_0xd702('0x3'),'GOOGLE_SECRET':_0xd702('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 13e8cbf..c57f6bb 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb24=['log','format','%s-%s.log','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','message','exports','File','%s-%s','error','transports','info','Console','env','debugLevel','winston','util','path','join','/var'];(function(_0x3da64e,_0x246f5f){var _0x441d3e=function(_0x2314f0){while(--_0x2314f0){_0x3da64e['push'](_0x3da64e['shift']());}};_0x441d3e(++_0x246f5f);}(_0xbb24,0x1c7));var _0x4bb2=function(_0x2376df,_0x2634b9){_0x2376df=_0x2376df-0x0;var _0x1517a6=_0xbb24[_0x2376df];return _0x1517a6;};'use strict';var moment=require('moment');var winston=require(_0x4bb2('0x0'));var util=require(_0x4bb2('0x1'));var path=require(_0x4bb2('0x2'));var debugLevel='INFO';function filename(_0x324455,_0x43be44){return path[_0x4bb2('0x3')](_0x4bb2('0x4'),_0x4bb2('0x5'),'xcally',util[_0x4bb2('0x6')](_0x4bb2('0x7'),_0x324455,_0x43be44));}function formatter(_0x478411,_0x4b5fe9){return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x4bb2('0x6')](_0x4bb2('0x8')),_0x4b5fe9['level'][_0x4bb2('0x9')](),_0x478411,_0x4b5fe9[_0x4bb2('0xa')]);}module[_0x4bb2('0xb')]=function(_0x2c3f09){return new winston['Logger']({'transports':[new winston['transports'][(_0x4bb2('0xc'))]({'name':util[_0x4bb2('0x6')](_0x4bb2('0xd'),_0x2c3f09,_0x4bb2('0xe')),'filename':filename(_0x2c3f09,_0x4bb2('0xe')),'level':_0x4bb2('0xe'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5c35dd){return formatter(_0x2c3f09,_0x5c35dd);}}),new winston[(_0x4bb2('0xf'))][(_0x4bb2('0xc'))]({'name':util[_0x4bb2('0x6')](_0x4bb2('0xd'),_0x2c3f09,_0x4bb2('0x10')),'filename':filename(_0x2c3f09,_0x4bb2('0x10')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x767b72){return formatter(_0x2c3f09,_0x767b72);}}),new winston[(_0x4bb2('0xf'))][(_0x4bb2('0x11'))]({'level':process[_0x4bb2('0x12')][_0x4bb2('0x13')]||debugLevel,'json':![],'formatter':function(_0x27263a){return formatter(_0x2c3f09,_0x27263a);}})]});}; \ No newline at end of file +var _0x5059=['Logger','File','%s-%s','error','transports','info','Console','debugLevel','moment','winston','util','path','join','/var','log','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','message','exports'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x5059,0x13c));var _0x9505=function(_0x172ed7,_0x3d08fd){_0x172ed7=_0x172ed7-0x0;var _0xfa8f61=_0x5059[_0x172ed7];return _0xfa8f61;};'use strict';var moment=require(_0x9505('0x0'));var winston=require(_0x9505('0x1'));var util=require(_0x9505('0x2'));var path=require(_0x9505('0x3'));var debugLevel='INFO';function filename(_0x2e017c,_0x2a681a){return path[_0x9505('0x4')](_0x9505('0x5'),_0x9505('0x6'),'xcally',util[_0x9505('0x7')](_0x9505('0x8'),_0x2e017c,_0x2a681a));}function formatter(_0x88f8ba,_0x2b8ec3){return util[_0x9505('0x7')](_0x9505('0x9'),moment()[_0x9505('0x7')](_0x9505('0xa')),_0x2b8ec3['level'][_0x9505('0xb')](),_0x88f8ba,_0x2b8ec3[_0x9505('0xc')]);}module[_0x9505('0xd')]=function(_0x229efd){return new winston[(_0x9505('0xe'))]({'transports':[new winston['transports'][(_0x9505('0xf'))]({'name':util[_0x9505('0x7')](_0x9505('0x10'),_0x229efd,'error'),'filename':filename(_0x229efd,'error'),'level':_0x9505('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xddbb9f){return formatter(_0x229efd,_0xddbb9f);}}),new winston[(_0x9505('0x12'))][(_0x9505('0xf'))]({'name':util[_0x9505('0x7')](_0x9505('0x10'),_0x229efd,_0x9505('0x13')),'filename':filename(_0x229efd,_0x9505('0x13')),'level':_0x9505('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x250271){return formatter(_0x229efd,_0x250271);}}),new winston[(_0x9505('0x12'))][(_0x9505('0x14'))]({'level':process['env'][_0x9505('0x15')]||debugLevel,'json':![],'formatter':function(_0x43fe55){return formatter(_0x229efd,_0x43fe55);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index aafb756..e33c1cb 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 _0xe0ae=['../../services/xdr/index.js','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/routing/index.js'];(function(_0x1d046a,_0x30db41){var _0x2c0b0c=function(_0x30a3c5){while(--_0x30a3c5){_0x1d046a['push'](_0x1d046a['shift']());}};_0x2c0b0c(++_0x30db41);}(_0xe0ae,0x135));var _0xee0a=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0xe0ae[_0x45b034];return _0x509cb0;};'use strict';var path=require(_0xee0a('0x0'));var os=require('os');var config={'apps':[{'name':_0xee0a('0x1'),'script':path[_0xee0a('0x2')](__dirname,_0xee0a('0x3'))},{'name':_0xee0a('0x4'),'script':path['join'](__dirname,_0xee0a('0x5'))},{'name':_0xee0a('0x6'),'script':path[_0xee0a('0x2')](__dirname,_0xee0a('0x7'))},{'name':_0xee0a('0x8'),'script':path[_0xee0a('0x2')](__dirname,'../../services/email/index.js')},{'name':'routing','script':path['join'](__dirname,_0xee0a('0x9'))},{'name':'xdr','script':path[_0xee0a('0x2')](__dirname,_0xee0a('0xa'))}]};module['exports']=config; \ No newline at end of file +var _0x226f=['../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','join','../../services/express/index.js','../../services/agi/index.js'];(function(_0x550e29,_0x4047f){var _0x3515b6=function(_0x303fe2){while(--_0x303fe2){_0x550e29['push'](_0x550e29['shift']());}};_0x3515b6(++_0x4047f);}(_0x226f,0x12d));var _0xf226=function(_0x5b75cd,_0x44deb2){_0x5b75cd=_0x5b75cd-0x0;var _0x1363aa=_0x226f[_0x5b75cd];return _0x1363aa;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path[_0xf226('0x0')](__dirname,_0xf226('0x1'))},{'name':'ami','script':path[_0xf226('0x0')](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path['join'](__dirname,_0xf226('0x2'))},{'name':'email','script':path[_0xf226('0x0')](__dirname,_0xf226('0x3'))},{'name':'routing','script':path['join'](__dirname,_0xf226('0x4'))},{'name':_0xf226('0x5'),'script':path[_0xf226('0x0')](__dirname,_0xf226('0x6'))}]};module[_0xf226('0x7')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 5066db6..706c524 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 _0xedd9=['restart','list','describe','delete','saved','bluebird','./config','connect','connected','start','then','stop','disconnect'];(function(_0x361563,_0x4f911c){var _0x5a5318=function(_0x3dc711){while(--_0x3dc711){_0x361563['push'](_0x361563['shift']());}};_0x5a5318(++_0x4f911c);}(_0xedd9,0xfc));var _0x9edd=function(_0x1caf4f,_0xd0b32d){_0x1caf4f=_0x1caf4f-0x0;var _0x11b9e2=_0xedd9[_0x1caf4f];return _0x11b9e2;};'use strict';var pm2=require('pm2');var BPromise=require(_0x9edd('0x0'));var config=require(_0x9edd('0x1'));function connect(){return new BPromise(function(_0x2af857,_0x2c16b8){return pm2[_0x9edd('0x2')](function(_0x127cbe){if(_0x127cbe){return _0x2c16b8(_0x127cbe);}return _0x2af857(_0x9edd('0x3'));});});};exports[_0x9edd('0x4')]=function(_0x5943b3){return connect()[_0x9edd('0x5')](function(){return new BPromise(function(_0x2cd163,_0x268f9e){return pm2[_0x9edd('0x4')](_0x5943b3,function(_0x5319f7,_0xf0b2d8){if(_0x5319f7){return _0x268f9e(_0x5319f7);}pm2['disconnect']();return _0x2cd163(_0xf0b2d8);});});});};exports[_0x9edd('0x6')]=function(_0x190185){return connect()[_0x9edd('0x5')](function(){return new BPromise(function(_0x3280fd,_0x49d5e3){return pm2[_0x9edd('0x6')](_0x190185,function(_0x5d2f90,_0x2076fc){if(_0x5d2f90){return _0x49d5e3(_0x5d2f90);}pm2[_0x9edd('0x7')]();return _0x3280fd(_0x2076fc);});});});};exports['restart']=function(_0xbf9da6){return connect()[_0x9edd('0x5')](function(){return new BPromise(function(_0x5b6c00,_0x30c0d7){return pm2[_0x9edd('0x8')](_0xbf9da6,function(_0x25e64c,_0xfd544a){if(_0x25e64c){return _0x30c0d7(_0x25e64c);}pm2[_0x9edd('0x7')]();return _0x5b6c00(_0xfd544a);});});});};exports[_0x9edd('0x9')]=function(){return connect()[_0x9edd('0x5')](function(){return new BPromise(function(_0xef5498,_0x47eb64){return pm2[_0x9edd('0x9')](function(_0x44fc7c,_0x891832){if(_0x44fc7c){return _0x47eb64(_0x44fc7c);}pm2[_0x9edd('0x7')]();return _0xef5498(_0x891832);});});});};exports[_0x9edd('0xa')]=function(_0x338f3c){return connect()[_0x9edd('0x5')](function(){return new BPromise(function(_0x75a4ab,_0x4ea60f){return pm2[_0x9edd('0xa')](_0x338f3c,function(_0x448996,_0x449cee){if(_0x448996){return _0x4ea60f(_0x448996);}pm2['disconnect']();return _0x75a4ab(_0x449cee);});});});};exports[_0x9edd('0xb')]=function(_0x35f454){return connect()[_0x9edd('0x5')](function(){return new BPromise(function(_0x4d8f33,_0x43dc70){return pm2['delete'](_0x35f454,function(_0x2cdcef,_0x1083e4){if(_0x2cdcef){return _0x43dc70(_0x2cdcef);}pm2['disconnect']();return _0x4d8f33(_0x1083e4);});});});};exports['dump']=function(){return connect()[_0x9edd('0x5')](function(){return new BPromise(function(_0x50338f,_0x27a95a){return pm2['dump'](function(_0x535f37){if(_0x535f37){return _0x27a95a(_0x535f37);}return _0x50338f(_0x9edd('0xc'));});});});}; \ No newline at end of file +var _0x7217=['connect','then','start','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','./config'];(function(_0x34fcf9,_0x2a2a38){var _0x1decf0=function(_0x2ed9e7){while(--_0x2ed9e7){_0x34fcf9['push'](_0x34fcf9['shift']());}};_0x1decf0(++_0x2a2a38);}(_0x7217,0x19e));var _0x7721=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7217[_0x2dafbe];return _0x58a45a;};'use strict';var pm2=require(_0x7721('0x0'));var BPromise=require('bluebird');var config=require(_0x7721('0x1'));function connect(){return new BPromise(function(_0x4170dd,_0x1de988){return pm2[_0x7721('0x2')](function(_0x115ab3){if(_0x115ab3){return _0x1de988(_0x115ab3);}return _0x4170dd('connected');});});};exports['start']=function(_0x472a96){return connect()[_0x7721('0x3')](function(){return new BPromise(function(_0x46415c,_0x3fe47c){return pm2[_0x7721('0x4')](_0x472a96,function(_0xf7ff37,_0x18ab6b){if(_0xf7ff37){return _0x3fe47c(_0xf7ff37);}pm2[_0x7721('0x5')]();return _0x46415c(_0x18ab6b);});});});};exports[_0x7721('0x6')]=function(_0x2f99ed){return connect()[_0x7721('0x3')](function(){return new BPromise(function(_0x2a66cb,_0xfa8835){return pm2[_0x7721('0x6')](_0x2f99ed,function(_0x2c3986,_0x578d59){if(_0x2c3986){return _0xfa8835(_0x2c3986);}pm2[_0x7721('0x5')]();return _0x2a66cb(_0x578d59);});});});};exports[_0x7721('0x7')]=function(_0x8729a6){return connect()[_0x7721('0x3')](function(){return new BPromise(function(_0xa8977c,_0x409b37){return pm2[_0x7721('0x7')](_0x8729a6,function(_0x27b36b,_0x55b4ca){if(_0x27b36b){return _0x409b37(_0x27b36b);}pm2[_0x7721('0x5')]();return _0xa8977c(_0x55b4ca);});});});};exports[_0x7721('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x109900,_0x30da54){return pm2[_0x7721('0x8')](function(_0x2e9752,_0x5069da){if(_0x2e9752){return _0x30da54(_0x2e9752);}pm2[_0x7721('0x5')]();return _0x109900(_0x5069da);});});});};exports[_0x7721('0x9')]=function(_0x534f1b){return connect()['then'](function(){return new BPromise(function(_0x4b183e,_0x5ed54){return pm2[_0x7721('0x9')](_0x534f1b,function(_0x3cc909,_0x32550d){if(_0x3cc909){return _0x5ed54(_0x3cc909);}pm2['disconnect']();return _0x4b183e(_0x32550d);});});});};exports[_0x7721('0xa')]=function(_0x54a838){return connect()[_0x7721('0x3')](function(){return new BPromise(function(_0x5cb0e6,_0xfec626){return pm2[_0x7721('0xa')](_0x54a838,function(_0x3ab5a5,_0x3e140d){if(_0x3ab5a5){return _0xfec626(_0x3ab5a5);}pm2[_0x7721('0x5')]();return _0x5cb0e6(_0x3e140d);});});});};exports[_0x7721('0xb')]=function(){return connect()[_0x7721('0x3')](function(){return new BPromise(function(_0x413263,_0x3b29ac){return pm2[_0x7721('0xb')](function(_0x4ce1db){if(_0x4ce1db){return _0x3b29ac(_0x4ce1db);}return _0x413263(_0x7721('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 8f4ec9b..0aa12bd 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 _0x7cda=['map','length','chatInteraction:update','catch','error','start','moment','ioredis','../../mysqldb','redis','defaults','localhost','socket.io-emitter','Setting','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','system','timeout','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1cf49b,_0x46cd5d){var _0x2dc6fc=function(_0x291f16){while(--_0x291f16){_0x1cf49b['push'](_0x1cf49b['shift']());}};_0x2dc6fc(++_0x46cd5d);}(_0x7cda,0xf6));var _0xa7cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7cda[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require(_0xa7cd('0x0'));var Redis=require(_0xa7cd('0x1'));var db=require(_0xa7cd('0x2'))['db'];var config=require('../../config/environment');config[_0xa7cd('0x3')]=_[_0xa7cd('0x4')](config['redis'],{'host':_0xa7cd('0x5'),'port':0x18eb});var io=require(_0xa7cd('0x6'))(new Redis(config[_0xa7cd('0x3')]));function closeInteractions(){var _0x37990d=0x0;var _0x5f20a2=[];return db[_0xa7cd('0x7')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xa7cd('0x8')](function(_0x4a9e39){_0x37990d=_0x4a9e39[_0xa7cd('0x9')];if(_0x37990d){return db[_0xa7cd('0xa')][_0xa7cd('0xb')]({'raw':!![],'attributes':['id',_0xa7cd('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xa7cd('0xd')](_0x4a9e39[_0xa7cd('0x9')],_0xa7cd('0xe'))}}});}else{return[];}})[_0xa7cd('0x8')](function(_0xd20e5d){_0x5f20a2=_0xd20e5d;if(_0x37990d){return db['ChatInteraction']['update']({'closeReason':_0xa7cd('0xf'),'disposition':_0xa7cd('0x10'),'closed':!![],'closedAt':moment()['format'](_0xa7cd('0x11'))},{'where':{'id':_[_0xa7cd('0x12')](_0x5f20a2||[],'id')}});}})['then'](function(_0x3bbf3b){for(var _0x3f72f8=0x0;_0x3f72f8<_0x5f20a2[_0xa7cd('0x13')];_0x3f72f8++){io['emit'](_0xa7cd('0x14'),{'id':_0x5f20a2[_0x3f72f8]['id'],'closed':!![]});}})[_0xa7cd('0x15')](function(_0x43abdf){console[_0xa7cd('0x16')](_0x43abdf);});}exports[_0xa7cd('0x17')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xdb76=['chatInteraction:update','catch','error','start','lodash','moment','ioredis','../../mysqldb','../../config/environment','defaults','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','findAll','lastMsgAt','subtract','minutes','then','update','system','format','YYYY-MM-DD\x20HH:mm:ss','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb76,0x1be));var _0x6db7=function(_0x167151,_0x5234a2){_0x167151=_0x167151-0x0;var _0x4019fc=_0xdb76[_0x167151];return _0x4019fc;};'use strict';var _=require(_0x6db7('0x0'));var moment=require(_0x6db7('0x1'));var Redis=require(_0x6db7('0x2'));var db=require(_0x6db7('0x3'))['db'];var config=require(_0x6db7('0x4'));config['redis']=_[_0x6db7('0x5')](config[_0x6db7('0x6')],{'host':_0x6db7('0x7'),'port':0x18eb});var io=require(_0x6db7('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x117f1c=0x0;var _0x7bba2d=[];return db[_0x6db7('0x9')][_0x6db7('0xa')]({'raw':!![],'attributes':['id',_0x6db7('0xb')],'where':{'id':0x1}})['then'](function(_0x1c7f92){_0x117f1c=_0x1c7f92[_0x6db7('0xb')];if(_0x117f1c){return db['ChatInteraction'][_0x6db7('0xc')]({'raw':!![],'attributes':['id',_0x6db7('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x6db7('0xe')](_0x1c7f92[_0x6db7('0xb')],_0x6db7('0xf'))}}});}else{return[];}})[_0x6db7('0x10')](function(_0x59fb7c){_0x7bba2d=_0x59fb7c;if(_0x117f1c){return db['ChatInteraction'][_0x6db7('0x11')]({'closeReason':_0x6db7('0x12'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x6db7('0x13')](_0x6db7('0x14'))},{'where':{'id':_[_0x6db7('0x15')](_0x7bba2d||[],'id')}});}})[_0x6db7('0x10')](function(_0x375f4a){for(var _0x4640ef=0x0;_0x4640ef<_0x7bba2d['length'];_0x4640ef++){io['emit'](_0x6db7('0x16'),{'id':_0x7bba2d[_0x4640ef]['id'],'closed':!![]});}})[_0x6db7('0x17')](function(_0x167384){console[_0x6db7('0x18')](_0x167384);});}exports[_0x6db7('0x19')]=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 4bc122d..e56ae09 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 _0x914e=['deleteJob','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','add','add\x20cron','stop\x20cron','endAt','update','update\x20cron','start','util','path','jayson/promise','../logger','schedule','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','email','MailAccount','service','Smtp','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','savename','%s.%s','basename','zip','join','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','status','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','subtractNumber','subtractUnit','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','keys','jobs','map','toString','keyBy','difference','length','stop'];(function(_0x3d56cd,_0x39788e){var _0x220b5f=function(_0x107625){while(--_0x107625){_0x3d56cd['push'](_0x3d56cd['shift']());}};_0x220b5f(++_0x39788e);}(_0x914e,0xbb));var _0xe914=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x914e[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var util=require(_0xe914('0x0'));var path=require(_0xe914('0x1'));var _=require('lodash');var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require(_0xe914('0x2'));var BPromise=require('bluebird');var logger=require(_0xe914('0x3'))(_0xe914('0x4'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xe914('0x5'));var client=jayson['client'][_0xe914('0x6')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x52f76d,_0x1bc232){return function(){logger[_0xe914('0x7')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x52f76d[_0xe914('0x8')]);var _0x4bf25d=!![];var _0x59d5a2={'tls':{'rejectUnauthorized':![]}};if(_0x52f76d[_0xe914('0x9')]['Smtp'][_0xe914('0xa')]){_0x59d5a2['service']=_0x52f76d[_0xe914('0x9')][_0xe914('0xb')][_0xe914('0xa')];}else{_0x59d5a2['host']=_0x52f76d[_0xe914('0x9')][_0xe914('0xb')][_0xe914('0xc')];_0x59d5a2[_0xe914('0xd')]=_0x52f76d[_0xe914('0x9')][_0xe914('0xb')][_0xe914('0xd')];_0x59d5a2[_0xe914('0xe')]=_0x52f76d[_0xe914('0x9')][_0xe914('0xb')][_0xe914('0xe')];}if(_0x52f76d[_0xe914('0x9')][_0xe914('0xb')][_0xe914('0xf')]){_0x59d5a2[_0xe914('0x10')]={'user':_0x52f76d['MailAccount'][_0xe914('0xb')][_0xe914('0x11')],'pass':_0x52f76d[_0xe914('0x9')][_0xe914('0xb')][_0xe914('0x12')]};}var _0x1d24be={'account':_0x59d5a2,'message':{'from':util[_0xe914('0x13')](_0xe914('0x14'),_0x52f76d[_0xe914('0x9')][_0xe914('0x15')],_0x52f76d[_0xe914('0x9')][_0xe914('0x8')]||_0x52f76d['MailAccount']['Smtp'][_0xe914('0x11')]),'to':_0x52f76d['email'],'cc':_0x52f76d['cc'],'bcc':_0x52f76d[_0xe914('0x16')],'subject':util[_0xe914('0x13')](_0xe914('0x17'),_0x1bc232[_0xe914('0x15')],_0x52f76d['subtractNumber'],_0x52f76d['subtractUnit'])}};var _0x205a8f=path['join'](__dirname,'../../files/reports');var _0x5ac42d=_0x1bc232[_0xe914('0x18')];var _0x512683=util[_0xe914('0x13')](_0xe914('0x19'),path[_0xe914('0x1a')](_0x1bc232[_0xe914('0x18')],path['extname'](_0x1bc232[_0xe914('0x18')])),_0xe914('0x1b'));var _0x320071=path[_0xe914('0x1c')](_0x205a8f,_0x5ac42d);var _0x3d3062=path[_0xe914('0x1c')](_0x205a8f,_0x512683);if(fs['existsSync'](_0x320071)){_0x1bc232['status']=_0xe914('0x1d');_0x1d24be[_0xe914('0x1e')][_0xe914('0x1f')]=[{'filename':_0x5ac42d,'path':_0x320071}];_0x1d24be[_0xe914('0x1e')][_0xe914('0x20')]=util[_0xe914('0x13')](_0xe914('0x21'),JSON[_0xe914('0x22')](_0x1bc232,null,0x2));}else if(fs[_0xe914('0x23')](_0x3d3062)){_0x1bc232[_0xe914('0x24')]=_0xe914('0x1d');_0x1d24be['message'][_0xe914('0x1f')]=[{'filename':_0x512683,'path':_0x3d3062}];}else{_0x1d24be['message'][_0xe914('0x20')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x52f76d[_0xe914('0x25')]){_0x4bf25d=![];logger['info'](_0xe914('0x26'));}}if(_0x4bf25d){return client['request'](_0xe914('0x27'),_0x1d24be)[_0xe914('0x28')](function(_0x51bdf7){if(_0x51bdf7[_0xe914('0x29')]){return logger[_0xe914('0x29')](_0xe914('0x2a'),JSON[_0xe914('0x22')](_0x51bdf7));}return logger['info'](_0xe914('0x2b'));})[_0xe914('0x2c')](function(_0x4e664a){return logger['error'](_0xe914('0x2a'),JSON[_0xe914('0x22')](_0x4e664a));});}};}function handleError(){return function(_0x1818ac){return logger['error'](JSON[_0xe914('0x22')](_0x1818ac));};}function handleResult(_0x3b5450){return function(_0x37b3b4){logger[_0xe914('0x7')](_0xe914('0x2d'),JSON[_0xe914('0x22')](_0x37b3b4));if(_0x3b5450[_0xe914('0x9')]&&_0x3b5450[_0xe914('0x9')][_0xe914('0xb')]&&!_['isNil'](_0x3b5450[_0xe914('0x8')])){setTimeout(handleSendEmail(_0x3b5450,_0x37b3b4),0x3c*0x3e8);}};}function handleJob(_0x412624){return function(){try{if(_[_0xe914('0x2e')](_0x412624['subtractNumber'])){return logger[_0xe914('0x7')](_0xe914('0x2f'));}if(_[_0xe914('0x2e')](_0x412624['subtractUnit'])){return logger[_0xe914('0x7')](_0xe914('0x30'));}var _0x2999d2={'startDate':moment()[_0xe914('0x31')](_0x412624[_0xe914('0x32')],_0x412624[_0xe914('0x33')])['format'](_0xe914('0x34')),'endDate':moment()['format'](_0xe914('0x34')),'type':_0xe914('0x35'),'output':_0x412624[_0xe914('0x36')],'name':_0x412624['name']};if(!_['isNil'](_0x412624[_0xe914('0x37')])){logger[_0xe914('0x7')](_0xe914('0x38'),_0x412624['DefaultReportId']);return analyticDefaultReportController[_0xe914('0x39')]({'id':_0x412624[_0xe914('0x37')]},_0x2999d2)[_0xe914('0x28')](handleResult(_0x412624))[_0xe914('0x2c')](handleError());}if(!_['isNil'](_0x412624[_0xe914('0x3a')])){logger['info'](_0xe914('0x3b'),_0x412624['CustomReportId']);return analyticCustomReportController[_0xe914('0x39')]({'id':_0x412624[_0xe914('0x3a')]},_0x2999d2)[_0xe914('0x28')](handleResult(_0x412624))[_0xe914('0x2c')](handleError());}}catch(_0x36e910){logger[_0xe914('0x29')](JSON[_0xe914('0x22')](_0x36e910));}return logger[_0xe914('0x7')](_0xe914('0x3c'));};}function getJobs(_0x1d58a6){var _0x563762={};if(_0x1d58a6){_0x563762['id']=_0x1d58a6;}return db[_0xe914('0x3d')][_0xe914('0x3e')]({'where':_0x563762,'include':[{'model':db[_0xe914('0x9')],'attributes':['id',_0xe914('0x15'),_0xe914('0x8')],'include':[{'model':db['MailServerOut'],'as':_0xe914('0xb')}]}]})[_0xe914('0x28')](function(_0xf3dbed){var _0x4b6d81=_[_0xe914('0x3f')](manager[_0xe914('0x40')]);var _0x242930=_[_0xe914('0x41')](_0xf3dbed,function(_0xbd69a9){return _0xbd69a9['id'][_0xe914('0x42')]();});var _0x593291=_[_0xe914('0x43')](_0xf3dbed,function(_0x7200ea){return _0x7200ea['id'][_0xe914('0x42')]();});var _0x481349=_0x1d58a6?_0x242930:_['difference'](_0x242930,_0x4b6d81);var _0x193f4a=_['intersection'](_0x242930,_0x4b6d81);var _0x4a6fb1=_[_0xe914('0x44')](_0x4b6d81,_0x242930);var _0x764e0c;var _0x48ef5b;for(_0x764e0c=0x0;_0x764e0c<_0x4a6fb1[_0xe914('0x45')]&&!_0x1d58a6;_0x764e0c+=0x1){_0x48ef5b=_0x4a6fb1[_0x764e0c][_0xe914('0x42')]();if(manager['exists'](_0x48ef5b)){manager[_0xe914('0x46')](_0x48ef5b);manager[_0xe914('0x47')](_0x48ef5b);logger[_0xe914('0x7')]('delete\x20cron',_0x48ef5b);}}logger[_0xe914('0x7')]('toRun',JSON['stringify'](_0x481349));for(_0x764e0c=0x0;_0x764e0c<_0x481349['length'];_0x764e0c+=0x1){_0x48ef5b=_0x481349[_0x764e0c][_0xe914('0x42')]();logger[_0xe914('0x7')]('index',_0x48ef5b);if(_0x1d58a6){logger[_0xe914('0x7')](_0xe914('0x48'),_0x1d58a6);logger[_0xe914('0x7')](JSON[_0xe914('0x22')](_0x593291[_0x48ef5b]));BPromise[_0xe914('0x49')]()[_0xe914('0x28')](handleJob(_0x593291[_0x48ef5b]));logger['info'](_0xe914('0x4a'),_0x593291[_0x48ef5b][_0xe914('0x15')],_0x593291[_0x48ef5b][_0xe914('0x4b')]);}else if(_0x593291[_0x48ef5b][_0xe914('0x4b')]&&_0x593291[_0x48ef5b][_0xe914('0x4c')]&&moment()[_0xe914('0x4d')](_0x593291[_0x48ef5b][_0xe914('0x4e')],_0x593291[_0x48ef5b]['endAt'])){manager[_0xe914('0x4f')](_0x48ef5b,_0x593291[_0x48ef5b][_0xe914('0x4b')],handleJob(_0x593291[_0x48ef5b]));manager['start'](_0x48ef5b);logger[_0xe914('0x7')](_0xe914('0x50'),_0x593291[_0x48ef5b]['name'],_0x593291[_0x48ef5b][_0xe914('0x4b')]);}else if(manager['exists'](_0x48ef5b)){manager[_0xe914('0x46')](_0x48ef5b);manager[_0xe914('0x47')](_0x48ef5b);logger[_0xe914('0x7')](_0xe914('0x51'),_0x593291[_0x48ef5b][_0xe914('0x15')],_0x593291[_0x48ef5b]['cron']);}}for(_0x764e0c=0x0,_0x48ef5b;_0x764e0c<_0x193f4a[_0xe914('0x45')]&&!_0x1d58a6;_0x764e0c+=0x1){_0x48ef5b=_0x193f4a[_0x764e0c][_0xe914('0x42')]();if(manager['exists'](_0x48ef5b)){if(_0x593291[_0x48ef5b][_0xe914('0x4b')]&&_0x593291[_0x48ef5b][_0xe914('0x4c')]&&moment()[_0xe914('0x4d')](_0x593291[_0x48ef5b]['startAt'],_0x593291[_0x48ef5b][_0xe914('0x52')])){manager[_0xe914('0x53')](_0x48ef5b,_0x593291[_0x48ef5b]['cron'],handleJob(_0x593291[_0x48ef5b]));logger['info'](_0xe914('0x54'),_0x593291[_0x48ef5b][_0xe914('0x15')],_0x593291[_0x48ef5b][_0xe914('0x4b')]);}else{manager[_0xe914('0x46')](_0x48ef5b);manager[_0xe914('0x47')](_0x48ef5b);logger[_0xe914('0x7')](_0xe914('0x51'),_0x593291[_0x48ef5b][_0xe914('0x15')],_0x593291[_0x48ef5b][_0xe914('0x4b')]);}}}})[_0xe914('0x2c')](function(_0x3026be){logger[_0xe914('0x29')](JSON[_0xe914('0x22')](_0x3026be));});}exports['run']=function(_0x3ecfc8){return getJobs(_0x3ecfc8);};exports[_0xe914('0x55')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x23b3=['subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','keyBy','difference','intersection','stop','deleteJob','delete\x20cron','toRun','length','index','my\x20id','resolve','cron','active','isBetween','endAt','add','start','add\x20cron','exists','stop\x20cron','startAt','update','run','util','path','lodash','moment','jayson/promise','bluebird','../logger','schedule','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','format','\x22%s\x22\x20<%s>','user','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','error','error\x20mail','email\x20sent','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit'];(function(_0x5f4030,_0x492118){var _0x16ff74=function(_0x419da1){while(--_0x419da1){_0x5f4030['push'](_0x5f4030['shift']());}};_0x16ff74(++_0x492118);}(_0x23b3,0x1f4));var _0x323b=function(_0x4af1fd,_0x166611){_0x4af1fd=_0x4af1fd-0x0;var _0x2acc3a=_0x23b3[_0x4af1fd];return _0x2acc3a;};'use strict';var fs=require('fs');var util=require(_0x323b('0x0'));var path=require(_0x323b('0x1'));var _=require(_0x323b('0x2'));var moment=require(_0x323b('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x323b('0x4'));var BPromise=require(_0x323b('0x5'));var logger=require(_0x323b('0x6'))(_0x323b('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x323b('0x8'));var client=jayson[_0x323b('0x9')][_0x323b('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x136757,_0x281969){return function(){logger[_0x323b('0xb')](_0x323b('0xc'),_0x136757[_0x323b('0xd')]);var _0x2afd5e=!![];var _0x5df9e7={'tls':{'rejectUnauthorized':![]}};if(_0x136757[_0x323b('0xe')][_0x323b('0xf')]['service']){_0x5df9e7[_0x323b('0x10')]=_0x136757[_0x323b('0xe')][_0x323b('0xf')][_0x323b('0x10')];}else{_0x5df9e7['host']=_0x136757['MailAccount'][_0x323b('0xf')][_0x323b('0x11')];_0x5df9e7['port']=_0x136757[_0x323b('0xe')]['Smtp'][_0x323b('0x12')];_0x5df9e7[_0x323b('0x13')]=_0x136757[_0x323b('0xe')][_0x323b('0xf')][_0x323b('0x13')];}if(_0x136757[_0x323b('0xe')][_0x323b('0xf')][_0x323b('0x14')]){_0x5df9e7['auth']={'user':_0x136757[_0x323b('0xe')][_0x323b('0xf')]['user'],'pass':_0x136757[_0x323b('0xe')][_0x323b('0xf')]['pass']};}var _0x381e65={'account':_0x5df9e7,'message':{'from':util[_0x323b('0x15')](_0x323b('0x16'),_0x136757[_0x323b('0xe')]['name'],_0x136757[_0x323b('0xe')][_0x323b('0xd')]||_0x136757[_0x323b('0xe')][_0x323b('0xf')][_0x323b('0x17')]),'to':_0x136757[_0x323b('0xd')],'cc':_0x136757['cc'],'bcc':_0x136757['bcc'],'subject':util[_0x323b('0x15')](_0x323b('0x18'),_0x281969[_0x323b('0x19')],_0x136757[_0x323b('0x1a')],_0x136757['subtractUnit'])}};var _0x2d0fdb=path[_0x323b('0x1b')](__dirname,_0x323b('0x1c'));var _0x507775=_0x281969[_0x323b('0x1d')];var _0x444196=util[_0x323b('0x15')](_0x323b('0x1e'),path[_0x323b('0x1f')](_0x281969[_0x323b('0x1d')],path[_0x323b('0x20')](_0x281969['savename'])),_0x323b('0x21'));var _0x4a179d=path[_0x323b('0x1b')](_0x2d0fdb,_0x507775);var _0xee3481=path[_0x323b('0x1b')](_0x2d0fdb,_0x444196);if(fs[_0x323b('0x22')](_0x4a179d)){_0x281969[_0x323b('0x23')]=_0x323b('0x24');_0x381e65[_0x323b('0x25')][_0x323b('0x26')]=[{'filename':_0x507775,'path':_0x4a179d}];_0x381e65[_0x323b('0x25')][_0x323b('0x27')]=util[_0x323b('0x15')](_0x323b('0x28'),JSON[_0x323b('0x29')](_0x281969,null,0x2));}else if(fs[_0x323b('0x22')](_0xee3481)){_0x281969[_0x323b('0x23')]=_0x323b('0x24');_0x381e65[_0x323b('0x25')][_0x323b('0x26')]=[{'filename':_0x444196,'path':_0xee3481}];}else{_0x381e65['message']['text']=_0x323b('0x2a');if(!_0x136757[_0x323b('0x2b')]){_0x2afd5e=![];logger[_0x323b('0xb')](_0x323b('0x2c'));}}if(_0x2afd5e){return client[_0x323b('0x2d')]('SendMail',_0x381e65)['then'](function(_0x19f3f8){if(_0x19f3f8[_0x323b('0x2e')]){return logger[_0x323b('0x2e')](_0x323b('0x2f'),JSON[_0x323b('0x29')](_0x19f3f8));}return logger[_0x323b('0xb')](_0x323b('0x30'));})['catch'](function(_0x5f2374){return logger[_0x323b('0x2e')]('error\x20mail',JSON[_0x323b('0x29')](_0x5f2374));});}};}function handleError(){return function(_0x1b14db){return logger[_0x323b('0x2e')](JSON[_0x323b('0x29')](_0x1b14db));};}function handleResult(_0x4b634b){return function(_0x353859){logger[_0x323b('0xb')]('data',JSON['stringify'](_0x353859));if(_0x4b634b[_0x323b('0xe')]&&_0x4b634b[_0x323b('0xe')]['Smtp']&&!_[_0x323b('0x31')](_0x4b634b[_0x323b('0xd')])){setTimeout(handleSendEmail(_0x4b634b,_0x353859),0x3c*0x3e8);}};}function handleJob(_0x49e75d){return function(){try{if(_[_0x323b('0x31')](_0x49e75d[_0x323b('0x1a')])){return logger[_0x323b('0xb')](_0x323b('0x32'));}if(_[_0x323b('0x31')](_0x49e75d[_0x323b('0x33')])){return logger[_0x323b('0xb')]('subtractUnit\x20null\x20or\x20undefined');}var _0x277068={'startDate':moment()[_0x323b('0x34')](_0x49e75d[_0x323b('0x1a')],_0x49e75d[_0x323b('0x33')])[_0x323b('0x15')](_0x323b('0x35')),'endDate':moment()[_0x323b('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x323b('0x36'),'output':_0x49e75d[_0x323b('0x37')],'name':_0x49e75d[_0x323b('0x19')]};if(!_[_0x323b('0x31')](_0x49e75d[_0x323b('0x38')])){logger['info'](_0x323b('0x39'),_0x49e75d[_0x323b('0x38')]);return analyticDefaultReportController[_0x323b('0x3a')]({'id':_0x49e75d[_0x323b('0x38')]},_0x277068)[_0x323b('0x3b')](handleResult(_0x49e75d))['catch'](handleError());}if(!_[_0x323b('0x31')](_0x49e75d[_0x323b('0x3c')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x49e75d[_0x323b('0x3c')]);return analyticCustomReportController[_0x323b('0x3a')]({'id':_0x49e75d[_0x323b('0x3c')]},_0x277068)[_0x323b('0x3b')](handleResult(_0x49e75d))['catch'](handleError());}}catch(_0x160625){logger[_0x323b('0x2e')](JSON['stringify'](_0x160625));}return logger[_0x323b('0xb')](_0x323b('0x3d'));};}function getJobs(_0x335068){var _0xd696ec={};if(_0x335068){_0xd696ec['id']=_0x335068;}return db[_0x323b('0x3e')][_0x323b('0x3f')]({'where':_0xd696ec,'include':[{'model':db['MailAccount'],'attributes':['id','name',_0x323b('0xd')],'include':[{'model':db[_0x323b('0x40')],'as':'Smtp'}]}]})[_0x323b('0x3b')](function(_0x51c44c){var _0x258959=_[_0x323b('0x41')](manager[_0x323b('0x42')]);var _0x1dbde8=_[_0x323b('0x43')](_0x51c44c,function(_0x1b1749){return _0x1b1749['id'][_0x323b('0x44')]();});var _0x52e5f6=_[_0x323b('0x45')](_0x51c44c,function(_0xb7863f){return _0xb7863f['id'][_0x323b('0x44')]();});var _0xf1a31a=_0x335068?_0x1dbde8:_[_0x323b('0x46')](_0x1dbde8,_0x258959);var _0x51f35a=_[_0x323b('0x47')](_0x1dbde8,_0x258959);var _0x3e7097=_[_0x323b('0x46')](_0x258959,_0x1dbde8);var _0x25c596;var _0x1eedc5;for(_0x25c596=0x0;_0x25c596<_0x3e7097['length']&&!_0x335068;_0x25c596+=0x1){_0x1eedc5=_0x3e7097[_0x25c596]['toString']();if(manager['exists'](_0x1eedc5)){manager[_0x323b('0x48')](_0x1eedc5);manager[_0x323b('0x49')](_0x1eedc5);logger['info'](_0x323b('0x4a'),_0x1eedc5);}}logger['info'](_0x323b('0x4b'),JSON[_0x323b('0x29')](_0xf1a31a));for(_0x25c596=0x0;_0x25c596<_0xf1a31a[_0x323b('0x4c')];_0x25c596+=0x1){_0x1eedc5=_0xf1a31a[_0x25c596][_0x323b('0x44')]();logger['info'](_0x323b('0x4d'),_0x1eedc5);if(_0x335068){logger['info'](_0x323b('0x4e'),_0x335068);logger[_0x323b('0xb')](JSON[_0x323b('0x29')](_0x52e5f6[_0x1eedc5]));BPromise[_0x323b('0x4f')]()[_0x323b('0x3b')](handleJob(_0x52e5f6[_0x1eedc5]));logger[_0x323b('0xb')]('run\x20job',_0x52e5f6[_0x1eedc5][_0x323b('0x19')],_0x52e5f6[_0x1eedc5][_0x323b('0x50')]);}else if(_0x52e5f6[_0x1eedc5]['cron']&&_0x52e5f6[_0x1eedc5][_0x323b('0x51')]&&moment()[_0x323b('0x52')](_0x52e5f6[_0x1eedc5]['startAt'],_0x52e5f6[_0x1eedc5][_0x323b('0x53')])){manager[_0x323b('0x54')](_0x1eedc5,_0x52e5f6[_0x1eedc5][_0x323b('0x50')],handleJob(_0x52e5f6[_0x1eedc5]));manager[_0x323b('0x55')](_0x1eedc5);logger[_0x323b('0xb')](_0x323b('0x56'),_0x52e5f6[_0x1eedc5][_0x323b('0x19')],_0x52e5f6[_0x1eedc5][_0x323b('0x50')]);}else if(manager[_0x323b('0x57')](_0x1eedc5)){manager['stop'](_0x1eedc5);manager[_0x323b('0x49')](_0x1eedc5);logger['info'](_0x323b('0x58'),_0x52e5f6[_0x1eedc5][_0x323b('0x19')],_0x52e5f6[_0x1eedc5][_0x323b('0x50')]);}}for(_0x25c596=0x0,_0x1eedc5;_0x25c596<_0x51f35a['length']&&!_0x335068;_0x25c596+=0x1){_0x1eedc5=_0x51f35a[_0x25c596][_0x323b('0x44')]();if(manager[_0x323b('0x57')](_0x1eedc5)){if(_0x52e5f6[_0x1eedc5][_0x323b('0x50')]&&_0x52e5f6[_0x1eedc5][_0x323b('0x51')]&&moment()[_0x323b('0x52')](_0x52e5f6[_0x1eedc5][_0x323b('0x59')],_0x52e5f6[_0x1eedc5][_0x323b('0x53')])){manager[_0x323b('0x5a')](_0x1eedc5,_0x52e5f6[_0x1eedc5][_0x323b('0x50')],handleJob(_0x52e5f6[_0x1eedc5]));logger[_0x323b('0xb')]('update\x20cron',_0x52e5f6[_0x1eedc5]['name'],_0x52e5f6[_0x1eedc5][_0x323b('0x50')]);}else{manager[_0x323b('0x48')](_0x1eedc5);manager[_0x323b('0x49')](_0x1eedc5);logger[_0x323b('0xb')](_0x323b('0x58'),_0x52e5f6[_0x1eedc5][_0x323b('0x19')],_0x52e5f6[_0x1eedc5]['cron']);}}}})['catch'](function(_0x57ed7f){logger[_0x323b('0x2e')](JSON[_0x323b('0x29')](_0x57ed7f));});}exports[_0x323b('0x5b')]=function(_0x15697b){return getJobs(_0x15697b);};exports['start']=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 68ee02b..271acbc 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b55=['util','../mysqldb','push','Innocenzo','@xcally.com','now','Biondo','innocenzo.biondo','CmContact','destroy','then','log','finished\x20populating','contacts1','bulkCreate','hopper1','hopper2','catch'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0b55,0x90));var _0x50b5=function(_0xaf41ff,_0x3ac587){_0xaf41ff=_0xaf41ff-0x0;var _0x2190c2=_0x0b55[_0xaf41ff];return _0x2190c2;};'use strict';var util=require(_0x50b5('0x0'));var db=require(_0x50b5('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x50b5('0x2')]({'id':i,'firstName':_0x50b5('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x50b5('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x50b5('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x50b5('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x50b5('0x5')](),'updatedAt':Date[_0x50b5('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x50b5('0x2')]({'id':i,'firstName':_0x50b5('0x3')+i,'lastName':_0x50b5('0x6')+i,'phone':0xf879fb460+i,'email':_0x50b5('0x7')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x50b5('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x50b5('0x5')](),'updatedAt':Date[_0x50b5('0x5')]()});}db[_0x50b5('0x8')][_0x50b5('0x9')]({'where':{}})['then'](function(){return db['CmContact']['bulkCreate'](contacts);})[_0x50b5('0xa')](function(){console[_0x50b5('0xb')](_0x50b5('0xc'),_0x50b5('0xd'));return db['CmHopper'][_0x50b5('0x9')]({'where':{}});})[_0x50b5('0xa')](function(){return db['CmHopper'][_0x50b5('0xe')](hopper);})[_0x50b5('0xa')](function(){console['log'](_0x50b5('0xc'),_0x50b5('0xf'));return db['CmContact']['bulkCreate'](contacts2);})['then'](function(){console[_0x50b5('0xb')](_0x50b5('0xc'),'contacts2');return db['CmHopper'][_0x50b5('0xe')](hopper2);})[_0x50b5('0xa')](function(){console[_0x50b5('0xb')]('finished\x20populating',_0x50b5('0x10'));})[_0x50b5('0x11')](function(_0x22d9d8){console[_0x50b5('0xb')](_0x22d9d8);}); \ No newline at end of file +var _0xf5b7=['contacts1','destroy','CmHopper','bulkCreate','finished\x20populating','contacts2','hopper2','catch','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','then','log'];(function(_0x1f1c51,_0x45eab9){var _0x161a85=function(_0x103655){while(--_0x103655){_0x1f1c51['push'](_0x1f1c51['shift']());}};_0x161a85(++_0x45eab9);}(_0xf5b7,0x74));var _0x7f5b=function(_0x3234b1,_0x5dcf82){_0x3234b1=_0x3234b1-0x0;var _0x461b35=_0xf5b7[_0x3234b1];return _0x461b35;};'use strict';var util=require(_0x7f5b('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x7f5b('0x1')]({'id':i,'firstName':_0x7f5b('0x2')+i,'lastName':_0x7f5b('0x3')+i,'phone':0xf879fb460+i,'email':_0x7f5b('0x4')+i+_0x7f5b('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x7f5b('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x7f5b('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7f5b('0x6')](),'updatedAt':Date[_0x7f5b('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x7f5b('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x7f5b('0x3')+i,'phone':0xf879fb460+i,'email':_0x7f5b('0x4')+i+_0x7f5b('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x7f5b('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x7f5b('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7f5b('0x6')](),'updatedAt':Date['now']()});}db[_0x7f5b('0x7')]['destroy']({'where':{}})[_0x7f5b('0x8')](function(){return db[_0x7f5b('0x7')]['bulkCreate'](contacts);})[_0x7f5b('0x8')](function(){console[_0x7f5b('0x9')]('finished\x20populating',_0x7f5b('0xa'));return db['CmHopper'][_0x7f5b('0xb')]({'where':{}});})[_0x7f5b('0x8')](function(){return db[_0x7f5b('0xc')]['bulkCreate'](hopper);})[_0x7f5b('0x8')](function(){console[_0x7f5b('0x9')]('finished\x20populating','hopper1');return db[_0x7f5b('0x7')][_0x7f5b('0xd')](contacts2);})[_0x7f5b('0x8')](function(){console[_0x7f5b('0x9')](_0x7f5b('0xe'),_0x7f5b('0xf'));return db[_0x7f5b('0xc')][_0x7f5b('0xd')](hopper2);})['then'](function(){console['log'](_0x7f5b('0xe'),_0x7f5b('0x10'));})[_0x7f5b('0x11')](function(_0x53493a){console['log'](_0x53493a);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index bc4d7af..bc04789 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b0d=['yes','/etc/pki/tls/certs/motion.crt','actpass','then','log','add\x20user','catch','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw'];(function(_0x5cf861,_0xd787da){var _0xe8b0c4=function(_0x2a3fe4){while(--_0x2a3fe4){_0x5cf861['push'](_0x5cf861['shift']());}};_0xe8b0c4(++_0xd787da);}(_0x3b0d,0xeb));var _0xd3b0=function(_0x255a63,_0x2b8f0c){_0x255a63=_0x255a63-0x0;var _0xf6a438=_0x3b0d[_0x255a63];return _0xf6a438;};'use strict';var util=require('util');var db=require(_0xd3b0('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xd3b0('0x1')]({'name':util[_0xd3b0('0x2')](_0xd3b0('0x3'),'agent',i),'fullname':util[_0xd3b0('0x2')](_0xd3b0('0x3'),_0xd3b0('0x4'),i),'email':util['format'](_0xd3b0('0x5'),'agent',i),'role':_0xd3b0('0x4'),'password':_0xd3b0('0x6'),'internal':0xfa0+i,'type':_0xd3b0('0x7'),'transport':[_0xd3b0('0x8'),'ws',_0xd3b0('0x9')],'disallow':[_0xd3b0('0xa')],'allow':[_0xd3b0('0xb')],'defaultuser':util[_0xd3b0('0x2')](_0xd3b0('0x3'),_0xd3b0('0x4'),i),'encryption':'yes','avpf':'yes','force_avp':_0xd3b0('0xc'),'icesupport':_0xd3b0('0xc'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xd3b0('0xd'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xd3b0('0xe'),'callerid':util[_0xd3b0('0x2')]('\x22%s\x22\x20<%s>',util[_0xd3b0('0x2')](_0xd3b0('0x3'),_0xd3b0('0x4'),i),0xfa0+i)});}db['User']['bulkCreate'](users)[_0xd3b0('0xf')](function(){console[_0xd3b0('0x10')](_0xd3b0('0x11'));})[_0xd3b0('0x12')](function(_0x38f57){console[_0xd3b0('0x10')](_0x38f57);}); \ No newline at end of file +var _0xbeb5=['../mysqldb','format','%s%s','agent','%s%s@xcally.com','password','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','User','bulkCreate','then','log','add\x20user','util'];(function(_0x262a84,_0x11c4b8){var _0x1877b8=function(_0x3ff654){while(--_0x3ff654){_0x262a84['push'](_0x262a84['shift']());}};_0x1877b8(++_0x11c4b8);}(_0xbeb5,0x7d));var _0x5beb=function(_0x3f9b94,_0x227989){_0x3f9b94=_0x3f9b94-0x0;var _0x864ba5=_0xbeb5[_0x3f9b94];return _0x864ba5;};'use strict';var util=require(_0x5beb('0x0'));var db=require(_0x5beb('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x5beb('0x2')](_0x5beb('0x3'),'agent',i),'fullname':util[_0x5beb('0x2')]('%s%s',_0x5beb('0x4'),i),'email':util[_0x5beb('0x2')](_0x5beb('0x5'),_0x5beb('0x4'),i),'role':'agent','password':_0x5beb('0x6'),'internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0x5beb('0x7')],'disallow':[_0x5beb('0x8')],'allow':[_0x5beb('0x9')],'defaultuser':util[_0x5beb('0x2')](_0x5beb('0x3'),_0x5beb('0x4'),i),'encryption':'yes','avpf':_0x5beb('0xa'),'force_avp':'yes','icesupport':_0x5beb('0xa'),'dtlsenable':_0x5beb('0xa'),'dtlsverify':'no','dtlscertfile':_0x5beb('0xb'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x5beb('0xc'),'callerid':util['format']('\x22%s\x22\x20<%s>',util['format'](_0x5beb('0x3'),_0x5beb('0x4'),i),0xfa0+i)});}db[_0x5beb('0xd')][_0x5beb('0xe')](users)[_0x5beb('0xf')](function(){console[_0x5beb('0x10')](_0x5beb('0x11'));})['catch'](function(_0x17a7b5){console[_0x5beb('0x10')](_0x17a7b5);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index c501aff..b57d488 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe434=['SocketIO\x20','disconnect','lodash','util','bluebird','Agents','User','name','role','agent','type','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','telephone','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','SmsQueue','MailQueue','OpenchannelQueue','user','ChatQueue','FaxQueue','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','then','voice','fax','sms','mail','openchannel','leave','ChatInteractions','removeChatInteractions','emit','map','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','catch','log','default','connection','request','remoteAddress','remotePort','connectedAt'];(function(_0x12012d,_0x46e1f6){var _0x2ccaf1=function(_0x3a9488){while(--_0x3a9488){_0x12012d['push'](_0x12012d['shift']());}};_0x2ccaf1(++_0x46e1f6);}(_0xe434,0x1ba));var _0x4e43=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xe434[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x4e43('0x0'));var util=require(_0x4e43('0x1'));var BPromise=require(_0x4e43('0x2'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0x4e43('0x3'),'model':db[_0x4e43('0x4')],'attributes':['id',_0x4e43('0x5'),_0x4e43('0x6')],'raw':!![],'where':{'role':_0x4e43('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x4e43('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x4e43('0x5')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x4e43('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x4e43('0x5'),_0x4e43('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0x3427c6,_0x22a1c2,_0x199fbf){return db[_0x4e43('0x9')][_0x4e43('0xa')]({'where':{'name':_0x3427c6,'userProfileId':_0x22a1c2},'raw':!![]})['then'](function(_0x568f84){if(_0x568f84){if(_0x568f84[_0x4e43('0xb')]){switch(_0x3427c6){case _0x4e43('0xc'):case _0x4e43('0xd'):case _0x4e43('0xe'):case _0x4e43('0xf'):case _0x4e43('0x10'):case _0x4e43('0x11'):return db[_0x199fbf][_0x4e43('0x12')](queryQueues);case _0x4e43('0x13'):return db[_0x199fbf][_0x4e43('0x12')](queryTelephones);case _0x4e43('0x14'):return db[_0x199fbf][_0x4e43('0x12')](queryTrunks);case _0x4e43('0x15'):return db[_0x199fbf][_0x4e43('0x12')](queryCampaigns);}}else{return db[_0x4e43('0x16')][_0x4e43('0x12')]({'attributes':[_0x4e43('0x17')],'where':{'sectionId':_0x568f84['id']},'raw':!![]})['then'](function(_0x5836d2){if(_0x5836d2){var _0x53e4f3={'where':{'id':_['map'](_0x5836d2,'resourceId')},'raw':!![]};switch(_0x199fbf){case _0x4e43('0x4'):_0x53e4f3['where'][_0x4e43('0x6')]=_0x4e43('0x18');break;case _0x4e43('0x19'):_0x53e4f3['where'][_0x4e43('0x8')]='ivr';break;}return db[_0x199fbf][_0x4e43('0x12')](_0x53e4f3);}else{return[];}});}}else{return[];}})['then'](function(_0x5da4d2){return _0x5da4d2;});}function joinOrLeaveQueues(_0x1d4399,_0x153fbb,_0x4704cc,_0x524db7){_0x1d4399[_0x153fbb](util[_0x4e43('0x1a')](_0x4e43('0x1b'),_0x4704cc,_0x524db7[_0x4e43('0x5')]));if(_0x524db7['Agents']){for(var _0x11b78f=0x0;_0x11b78f<_0x524db7[_0x4e43('0x3')][_0x4e43('0x1c')];_0x11b78f+=0x1){_0x1d4399[_0x153fbb](util[_0x4e43('0x1a')](_0x4e43('0x1d'),_0x524db7[_0x4e43('0x3')][_0x11b78f]['name']));}}}function joinOrLeave(_0x30d35b,_0x315989,_0x5f2ac4){var _0x56cc50;if(_0x30d35b[_0x4e43('0x1e')][_0x4e43('0x1f')]['id']){db[_0x4e43('0x4')][_0x4e43('0x20')]({'attributes':['id','name','role',_0x4e43('0x21')],'where':{'id':_0x30d35b['handshake'][_0x4e43('0x1f')]['id']},'include':[{'model':db[_0x4e43('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x4e43('0x23')],'as':_0x4e43('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x4e43('0x25')],'as':_0x4e43('0x26'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x4e43('0x27'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x4e43('0x28'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x5f1e7f){if(_0x5f1e7f){_0x56cc50=_0x5f1e7f;_0x30d35b[_0x315989](util[_0x4e43('0x1a')]('user:%s',_0x5f1e7f['name']));var _0x2f2e69=[];switch(_0x5f1e7f[_0x4e43('0x6')]){case _0x4e43('0x29'):_0x30d35b[_0x315989](_0x4e43('0x2a'));_0x30d35b[_0x315989](_0x4e43('0x2b'));if(queryQueues[_0x4e43('0x2c')](_0x4e43('0x2d'))){delete queryQueues[_0x4e43('0x2d')];}_0x2f2e69[_0x4e43('0x2e')](db[_0x4e43('0x2f')][_0x4e43('0x12')](queryQueues));_0x2f2e69[_0x4e43('0x2e')](db['ChatQueue'][_0x4e43('0x12')](queryQueues));_0x2f2e69['push'](db['FaxQueue'][_0x4e43('0x12')](queryQueues));_0x2f2e69['push'](db[_0x4e43('0x30')][_0x4e43('0x12')](queryQueues));_0x2f2e69[_0x4e43('0x2e')](db[_0x4e43('0x31')][_0x4e43('0x12')](queryQueues));_0x2f2e69['push'](db[_0x4e43('0x32')]['findAll'](queryQueues));_0x2f2e69['push'](db[_0x4e43('0x4')][_0x4e43('0x12')](queryTelephones));_0x2f2e69[_0x4e43('0x2e')](db['Trunk'][_0x4e43('0x12')](queryTrunks));_0x2f2e69[_0x4e43('0x2e')](db['Campaign']['findAll'](queryCampaigns));_0x2f2e69[_0x4e43('0x2e')](db[_0x4e43('0x4')][_0x4e43('0x12')](queryAgents));break;case _0x4e43('0x33'):_0x30d35b[_0x315989](_0x4e43('0x2a'));_0x30d35b[_0x315989](_0x4e43('0x2b'));_0x2f2e69['push'](getAssociatedResources('VoiceQueues',_0x5f1e7f[_0x4e43('0x21')],'VoiceQueue'));_0x2f2e69[_0x4e43('0x2e')](getAssociatedResources(_0x4e43('0xd'),_0x5f1e7f['userProfileId'],_0x4e43('0x34')));_0x2f2e69[_0x4e43('0x2e')](getAssociatedResources(_0x4e43('0xe'),_0x5f1e7f[_0x4e43('0x21')],_0x4e43('0x35')));_0x2f2e69[_0x4e43('0x2e')](getAssociatedResources(_0x4e43('0xf'),_0x5f1e7f[_0x4e43('0x21')],_0x4e43('0x30')));_0x2f2e69[_0x4e43('0x2e')](getAssociatedResources(_0x4e43('0x10'),_0x5f1e7f[_0x4e43('0x21')],_0x4e43('0x31')));_0x2f2e69['push'](getAssociatedResources(_0x4e43('0x11'),_0x5f1e7f[_0x4e43('0x21')],'OpenchannelQueue'));_0x2f2e69[_0x4e43('0x2e')](getAssociatedResources(_0x4e43('0x13'),_0x5f1e7f[_0x4e43('0x21')],_0x4e43('0x4')));_0x2f2e69[_0x4e43('0x2e')](getAssociatedResources('Trunks',_0x5f1e7f['userProfileId'],_0x4e43('0x36')));_0x2f2e69[_0x4e43('0x2e')](getAssociatedResources(_0x4e43('0x15'),_0x5f1e7f[_0x4e43('0x21')],_0x4e43('0x19')));_0x2f2e69[_0x4e43('0x2e')](db[_0x4e43('0x4')][_0x4e43('0x12')](queryAgents));break;case _0x4e43('0x7'):_0x30d35b[_0x315989]('voice:inbound');_0x30d35b[_0x315989]('voice:outbound');_0x2f2e69[_0x4e43('0x2e')](_0x5f1e7f[_0x4e43('0x37')]({'attributes':['id',_0x4e43('0x5')]}));_0x2f2e69['push'](_0x5f1e7f[_0x4e43('0x38')]({'attributes':['id',_0x4e43('0x5')]}));_0x2f2e69[_0x4e43('0x2e')](_0x5f1e7f[_0x4e43('0x39')]({'attributes':['id',_0x4e43('0x5')]}));_0x2f2e69[_0x4e43('0x2e')](_0x5f1e7f[_0x4e43('0x3a')]({'attributes':['id',_0x4e43('0x5')]}));_0x2f2e69['push'](_0x5f1e7f[_0x4e43('0x3b')]({'attributes':['id',_0x4e43('0x5')]}));_0x2f2e69[_0x4e43('0x2e')](_0x5f1e7f[_0x4e43('0x3c')]({'attributes':['id',_0x4e43('0x5')]}));break;}return BPromise[_0x4e43('0x3d')](_0x2f2e69);}})[_0x4e43('0x3e')](function(_0x15000c){if(_0x15000c&&_0x15000c[_0x4e43('0x1c')]){for(var _0x27a18b=0x0;_0x27a18b<_0x15000c[_0x4e43('0x1c')];_0x27a18b+=0x1){for(var _0x480d19=0x0;_0x480d19<_0x15000c[_0x27a18b][_0x4e43('0x1c')];_0x480d19+=0x1){switch(_0x27a18b){case 0x0:joinOrLeaveQueues(_0x30d35b,_0x315989,_0x4e43('0x3f'),_0x15000c[_0x27a18b][_0x480d19]);break;case 0x1:joinOrLeaveQueues(_0x30d35b,_0x315989,'chat',_0x15000c[_0x27a18b][_0x480d19]);break;case 0x2:joinOrLeaveQueues(_0x30d35b,_0x315989,_0x4e43('0x40'),_0x15000c[_0x27a18b][_0x480d19]);break;case 0x3:joinOrLeaveQueues(_0x30d35b,_0x315989,_0x4e43('0x41'),_0x15000c[_0x27a18b][_0x480d19]);break;case 0x4:joinOrLeaveQueues(_0x30d35b,_0x315989,_0x4e43('0x42'),_0x15000c[_0x27a18b][_0x480d19]);break;case 0x5:joinOrLeaveQueues(_0x30d35b,_0x315989,_0x4e43('0x43'),_0x15000c[_0x27a18b][_0x480d19]);break;case 0x6:_0x30d35b[_0x315989](util[_0x4e43('0x1a')]('telephone:%s',_0x15000c[_0x27a18b][_0x480d19][_0x4e43('0x5')]));break;case 0x7:_0x30d35b[_0x315989](util[_0x4e43('0x1a')]('trunk:%s',_0x15000c[_0x27a18b][_0x480d19][_0x4e43('0x5')]));break;case 0x8:_0x30d35b[_0x315989](util[_0x4e43('0x1a')]('campaign:%s:%s',_0x15000c[_0x27a18b][_0x480d19]['type'],_0x15000c[_0x27a18b][_0x480d19][_0x4e43('0x5')]));break;case 0x9:_0x30d35b[_0x315989](util[_0x4e43('0x1a')](_0x4e43('0x1d'),_0x15000c[_0x27a18b][_0x480d19][_0x4e43('0x5')]));break;}}}}})[_0x4e43('0x3e')](function(){if(_0x315989===_0x4e43('0x44')){var _0x321fdd=_['map'](_0x56cc50[_0x4e43('0x45')],'id');return _0x56cc50[_0x4e43('0x46')](_0x321fdd)[_0x4e43('0x3e')](function(){for(var _0x2ee39e=0x0;_0x2ee39e<_0x321fdd[_0x4e43('0x1c')];_0x2ee39e+=0x1){_0x5f2ac4[_0x4e43('0x47')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x321fdd[_0x2ee39e]),'UserId':Number(_0x56cc50['id'])});}});}})[_0x4e43('0x3e')](function(){if(_0x315989===_0x4e43('0x44')){var _0x4d113b=_[_0x4e43('0x48')](_0x56cc50[_0x4e43('0x24')],'id');return _0x56cc50['removeMailInteractions'](_0x4d113b)['then'](function(){for(var _0x4d218e=0x0;_0x4d218e<_0x4d113b[_0x4e43('0x1c')];_0x4d218e+=0x1){_0x5f2ac4['emit'](_0x4e43('0x49'),{'MailInteractionId':Number(_0x4d113b[_0x4d218e]),'UserId':Number(_0x56cc50['id'])});}});}})[_0x4e43('0x3e')](function(){if(_0x315989==='leave'){var _0x4364dc=_[_0x4e43('0x48')](_0x56cc50['FaxInteractions'],'id');return _0x56cc50[_0x4e43('0x4a')](_0x4364dc)[_0x4e43('0x3e')](function(){for(var _0x3a51c=0x0;_0x3a51c<_0x4364dc[_0x4e43('0x1c')];_0x3a51c+=0x1){_0x5f2ac4['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x4364dc[_0x3a51c]),'UserId':Number(_0x56cc50['id'])});}});}})[_0x4e43('0x3e')](function(){if(_0x315989===_0x4e43('0x44')){var _0x41d43d=_[_0x4e43('0x48')](_0x56cc50[_0x4e43('0x27')],'id');return _0x56cc50[_0x4e43('0x4b')](_0x41d43d)['then'](function(){for(var _0x2e912b=0x0;_0x2e912b<_0x41d43d['length'];_0x2e912b+=0x1){_0x5f2ac4[_0x4e43('0x47')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x41d43d[_0x2e912b]),'UserId':Number(_0x56cc50['id'])});}});}})['then'](function(){if(_0x315989==='leave'){var _0x468122=_[_0x4e43('0x48')](_0x56cc50['OpenchannelInteractions'],'id');return _0x56cc50[_0x4e43('0x4c')](_0x468122)['then'](function(){for(var _0x4151d2=0x0;_0x4151d2<_0x468122[_0x4e43('0x1c')];_0x4151d2+=0x1){_0x5f2ac4[_0x4e43('0x47')](_0x4e43('0x4d'),{'OpenchannelInteractionId':Number(_0x468122[_0x4151d2]),'UserId':Number(_0x56cc50['id'])});}});}})[_0x4e43('0x4e')](function(_0x2e146d){_0x30d35b[_0x4e43('0x4f')](_0x2e146d);});}}function onDisconnect(_0x555379,_0x12d32f){joinOrLeave(_0x555379,_0x4e43('0x44'),_0x12d32f);}function onConnect(_0x47c5b8){joinOrLeave(_0x47c5b8,'join');}exports[_0x4e43('0x50')]=function(_0x178c0f){_0x178c0f['on'](_0x4e43('0x51'),function(_0x302200){_0x302200['setMaxListeners'](0x0);_0x302200['address']=_0x302200[_0x4e43('0x52')][_0x4e43('0x51')][_0x4e43('0x53')]+':'+_0x302200['request'][_0x4e43('0x51')][_0x4e43('0x54')];_0x302200[_0x4e43('0x55')]=new Date();_0x302200[_0x4e43('0x4f')]=function(_0x23ad0f){console[_0x4e43('0x4f')](_0x4e43('0x56')+_0x302200['nsp'][_0x4e43('0x5')]+'['+_0x302200['address']+']',_0x23ad0f);};_0x302200['on'](_0x4e43('0x57'),function(){onDisconnect(_0x302200,_0x178c0f);_0x302200['log']('DISCONNECTED');});onConnect(_0x302200);_0x302200[_0x4e43('0x4f')]('CONNECTED');});}; \ No newline at end of file +var _0x2492=['request','remoteAddress','remotePort','connectedAt','nsp','disconnect','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','User','role','telephone','agent','type','ivr','UserProfileSection','findOne','VoiceQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','map','where','format','Agents','length','user:%s','query','find','handshake','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','Trunk','userProfileId','ChatQueues','MailQueue','Telephones','Campaign','voice:inbound','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','voice','fax','mail','openchannel','telephone:%s','trunk:%s','leave','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','catch','log','join','default','connection','address'];(function(_0x9a87d2,_0x4daa32){var _0x1a78ad=function(_0x35a671){while(--_0x35a671){_0x9a87d2['push'](_0x9a87d2['shift']());}};_0x1a78ad(++_0x4daa32);}(_0x2492,0x1dd));var _0x2249=function(_0x15df0f,_0x13f84d){_0x15df0f=_0x15df0f-0x0;var _0x2693ff=_0x2492[_0x15df0f];return _0x2693ff;};'use strict';var _=require(_0x2249('0x0'));var util=require(_0x2249('0x1'));var BPromise=require(_0x2249('0x2'));var db=require(_0x2249('0x3'))['db'];var config=require(_0x2249('0x4'));var queryQueues={'attributes':['id',_0x2249('0x5')],'include':[{'as':'Agents','model':db[_0x2249('0x6')],'attributes':['id',_0x2249('0x5'),_0x2249('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x2249('0x5')],'where':{'role':_0x2249('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x2249('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x2249('0x5')],'where':{'role':_0x2249('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x2249('0x5'),_0x2249('0xa')],'where':{'type':_0x2249('0xb')}};function getAssociatedResources(_0x7a2503,_0x524afd,_0x1fd741){return db[_0x2249('0xc')][_0x2249('0xd')]({'where':{'name':_0x7a2503,'userProfileId':_0x524afd},'raw':!![]})['then'](function(_0x50bed8){if(_0x50bed8){if(_0x50bed8['autoAssociation']){switch(_0x7a2503){case _0x2249('0xe'):case'ChatQueues':case _0x2249('0xf'):case _0x2249('0x10'):case _0x2249('0x11'):case _0x2249('0x12'):return db[_0x1fd741]['findAll'](queryQueues);case'Telephones':return db[_0x1fd741][_0x2249('0x13')](queryTelephones);case _0x2249('0x14'):return db[_0x1fd741][_0x2249('0x13')](queryTrunks);case _0x2249('0x15'):return db[_0x1fd741]['findAll'](queryCampaigns);}}else{return db[_0x2249('0x16')]['findAll']({'attributes':[_0x2249('0x17')],'where':{'sectionId':_0x50bed8['id']},'raw':!![]})[_0x2249('0x18')](function(_0x50728a){if(_0x50728a){var _0x582127={'where':{'id':_[_0x2249('0x19')](_0x50728a,_0x2249('0x17'))},'raw':!![]};switch(_0x1fd741){case _0x2249('0x6'):_0x582127[_0x2249('0x1a')][_0x2249('0x7')]=_0x2249('0x8');break;case'Campaign':_0x582127[_0x2249('0x1a')][_0x2249('0xa')]=_0x2249('0xb');break;}return db[_0x1fd741][_0x2249('0x13')](_0x582127);}else{return[];}});}}else{return[];}})[_0x2249('0x18')](function(_0x590ed9){return _0x590ed9;});}function joinOrLeaveQueues(_0x152d45,_0xebca65,_0x271c46,_0x1ae06c){_0x152d45[_0xebca65](util[_0x2249('0x1b')]('%s:queue:%s',_0x271c46,_0x1ae06c[_0x2249('0x5')]));if(_0x1ae06c[_0x2249('0x1c')]){for(var _0x4bd45c=0x0;_0x4bd45c<_0x1ae06c[_0x2249('0x1c')][_0x2249('0x1d')];_0x4bd45c+=0x1){_0x152d45[_0xebca65](util[_0x2249('0x1b')](_0x2249('0x1e'),_0x1ae06c[_0x2249('0x1c')][_0x4bd45c][_0x2249('0x5')]));}}}function joinOrLeave(_0x1f033a,_0x54decc,_0x4aeca4){var _0x2c2d04;if(_0x1f033a['handshake'][_0x2249('0x1f')]['id']){db[_0x2249('0x6')][_0x2249('0x20')]({'attributes':['id',_0x2249('0x5'),_0x2249('0x7'),'userProfileId'],'where':{'id':_0x1f033a[_0x2249('0x21')][_0x2249('0x1f')]['id']},'include':[{'model':db[_0x2249('0x22')],'as':_0x2249('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x2249('0x24')],'as':_0x2249('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x2249('0x26')],'as':_0x2249('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x2249('0x28')],'as':_0x2249('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x2249('0x2a')],'as':_0x2249('0x2b'),'attributes':['id'],'raw':!![]}]})[_0x2249('0x18')](function(_0x51e0d6){if(_0x51e0d6){_0x2c2d04=_0x51e0d6;_0x1f033a[_0x54decc](util[_0x2249('0x1b')](_0x2249('0x1e'),_0x51e0d6[_0x2249('0x5')]));var _0x52d75a=[];switch(_0x51e0d6[_0x2249('0x7')]){case'admin':_0x1f033a[_0x54decc]('voice:inbound');_0x1f033a[_0x54decc](_0x2249('0x2c'));if(queryQueues[_0x2249('0x2d')](_0x2249('0x2e'))){delete queryQueues['include'];}_0x52d75a[_0x2249('0x2f')](db[_0x2249('0x30')][_0x2249('0x13')](queryQueues));_0x52d75a[_0x2249('0x2f')](db[_0x2249('0x31')][_0x2249('0x13')](queryQueues));_0x52d75a[_0x2249('0x2f')](db[_0x2249('0x32')][_0x2249('0x13')](queryQueues));_0x52d75a[_0x2249('0x2f')](db[_0x2249('0x33')]['findAll'](queryQueues));_0x52d75a[_0x2249('0x2f')](db['MailQueue']['findAll'](queryQueues));_0x52d75a[_0x2249('0x2f')](db[_0x2249('0x34')][_0x2249('0x13')](queryQueues));_0x52d75a['push'](db[_0x2249('0x6')][_0x2249('0x13')](queryTelephones));_0x52d75a['push'](db[_0x2249('0x35')][_0x2249('0x13')](queryTrunks));_0x52d75a[_0x2249('0x2f')](db['Campaign'][_0x2249('0x13')](queryCampaigns));_0x52d75a[_0x2249('0x2f')](db['User'][_0x2249('0x13')](queryAgents));break;case'user':_0x1f033a[_0x54decc]('voice:inbound');_0x1f033a[_0x54decc]('voice:outbound');_0x52d75a[_0x2249('0x2f')](getAssociatedResources(_0x2249('0xe'),_0x51e0d6[_0x2249('0x36')],_0x2249('0x30')));_0x52d75a[_0x2249('0x2f')](getAssociatedResources(_0x2249('0x37'),_0x51e0d6[_0x2249('0x36')],_0x2249('0x31')));_0x52d75a[_0x2249('0x2f')](getAssociatedResources(_0x2249('0xf'),_0x51e0d6[_0x2249('0x36')],_0x2249('0x32')));_0x52d75a['push'](getAssociatedResources(_0x2249('0x10'),_0x51e0d6[_0x2249('0x36')],_0x2249('0x33')));_0x52d75a[_0x2249('0x2f')](getAssociatedResources(_0x2249('0x11'),_0x51e0d6['userProfileId'],_0x2249('0x38')));_0x52d75a['push'](getAssociatedResources(_0x2249('0x12'),_0x51e0d6[_0x2249('0x36')],'OpenchannelQueue'));_0x52d75a['push'](getAssociatedResources(_0x2249('0x39'),_0x51e0d6[_0x2249('0x36')],'User'));_0x52d75a[_0x2249('0x2f')](getAssociatedResources(_0x2249('0x14'),_0x51e0d6[_0x2249('0x36')],_0x2249('0x35')));_0x52d75a['push'](getAssociatedResources(_0x2249('0x15'),_0x51e0d6['userProfileId'],_0x2249('0x3a')));_0x52d75a[_0x2249('0x2f')](db[_0x2249('0x6')][_0x2249('0x13')](queryAgents));break;case _0x2249('0x9'):_0x1f033a[_0x54decc](_0x2249('0x3b'));_0x1f033a[_0x54decc](_0x2249('0x2c'));_0x52d75a[_0x2249('0x2f')](_0x51e0d6['getVoiceQueues']({'attributes':['id',_0x2249('0x5')]}));_0x52d75a[_0x2249('0x2f')](_0x51e0d6[_0x2249('0x3c')]({'attributes':['id',_0x2249('0x5')]}));_0x52d75a['push'](_0x51e0d6[_0x2249('0x3d')]({'attributes':['id',_0x2249('0x5')]}));_0x52d75a[_0x2249('0x2f')](_0x51e0d6[_0x2249('0x3e')]({'attributes':['id',_0x2249('0x5')]}));_0x52d75a['push'](_0x51e0d6[_0x2249('0x3f')]({'attributes':['id',_0x2249('0x5')]}));_0x52d75a[_0x2249('0x2f')](_0x51e0d6[_0x2249('0x40')]({'attributes':['id',_0x2249('0x5')]}));break;}return BPromise[_0x2249('0x41')](_0x52d75a);}})[_0x2249('0x18')](function(_0x59f253){if(_0x59f253&&_0x59f253[_0x2249('0x1d')]){for(var _0x4c9885=0x0;_0x4c9885<_0x59f253[_0x2249('0x1d')];_0x4c9885+=0x1){for(var _0x22bc72=0x0;_0x22bc72<_0x59f253[_0x4c9885][_0x2249('0x1d')];_0x22bc72+=0x1){switch(_0x4c9885){case 0x0:joinOrLeaveQueues(_0x1f033a,_0x54decc,_0x2249('0x42'),_0x59f253[_0x4c9885][_0x22bc72]);break;case 0x1:joinOrLeaveQueues(_0x1f033a,_0x54decc,'chat',_0x59f253[_0x4c9885][_0x22bc72]);break;case 0x2:joinOrLeaveQueues(_0x1f033a,_0x54decc,_0x2249('0x43'),_0x59f253[_0x4c9885][_0x22bc72]);break;case 0x3:joinOrLeaveQueues(_0x1f033a,_0x54decc,'sms',_0x59f253[_0x4c9885][_0x22bc72]);break;case 0x4:joinOrLeaveQueues(_0x1f033a,_0x54decc,_0x2249('0x44'),_0x59f253[_0x4c9885][_0x22bc72]);break;case 0x5:joinOrLeaveQueues(_0x1f033a,_0x54decc,_0x2249('0x45'),_0x59f253[_0x4c9885][_0x22bc72]);break;case 0x6:_0x1f033a[_0x54decc](util[_0x2249('0x1b')](_0x2249('0x46'),_0x59f253[_0x4c9885][_0x22bc72][_0x2249('0x5')]));break;case 0x7:_0x1f033a[_0x54decc](util[_0x2249('0x1b')](_0x2249('0x47'),_0x59f253[_0x4c9885][_0x22bc72][_0x2249('0x5')]));break;case 0x8:_0x1f033a[_0x54decc](util['format']('campaign:%s:%s',_0x59f253[_0x4c9885][_0x22bc72][_0x2249('0xa')],_0x59f253[_0x4c9885][_0x22bc72][_0x2249('0x5')]));break;case 0x9:_0x1f033a[_0x54decc](util[_0x2249('0x1b')](_0x2249('0x1e'),_0x59f253[_0x4c9885][_0x22bc72][_0x2249('0x5')]));break;}}}}})[_0x2249('0x18')](function(){if(_0x54decc===_0x2249('0x48')){var _0x1cb90a=_[_0x2249('0x19')](_0x2c2d04[_0x2249('0x23')],'id');return _0x2c2d04['removeChatInteractions'](_0x1cb90a)[_0x2249('0x18')](function(){for(var _0x4da31a=0x0;_0x4da31a<_0x1cb90a[_0x2249('0x1d')];_0x4da31a+=0x1){_0x4aeca4['emit'](_0x2249('0x49'),{'ChatInteractionId':Number(_0x1cb90a[_0x4da31a]),'UserId':Number(_0x2c2d04['id'])});}});}})[_0x2249('0x18')](function(){if(_0x54decc===_0x2249('0x48')){var _0x2aae58=_[_0x2249('0x19')](_0x2c2d04[_0x2249('0x25')],'id');return _0x2c2d04[_0x2249('0x4a')](_0x2aae58)[_0x2249('0x18')](function(){for(var _0x3b42a3=0x0;_0x3b42a3<_0x2aae58[_0x2249('0x1d')];_0x3b42a3+=0x1){_0x4aeca4[_0x2249('0x4b')](_0x2249('0x4c'),{'MailInteractionId':Number(_0x2aae58[_0x3b42a3]),'UserId':Number(_0x2c2d04['id'])});}});}})[_0x2249('0x18')](function(){if(_0x54decc==='leave'){var _0x58714f=_[_0x2249('0x19')](_0x2c2d04[_0x2249('0x27')],'id');return _0x2c2d04['removeFaxInteractions'](_0x58714f)['then'](function(){for(var _0x350d3e=0x0;_0x350d3e<_0x58714f[_0x2249('0x1d')];_0x350d3e+=0x1){_0x4aeca4['emit'](_0x2249('0x4d'),{'FaxInteractionId':Number(_0x58714f[_0x350d3e]),'UserId':Number(_0x2c2d04['id'])});}});}})[_0x2249('0x18')](function(){if(_0x54decc===_0x2249('0x48')){var _0x41916b=_[_0x2249('0x19')](_0x2c2d04[_0x2249('0x29')],'id');return _0x2c2d04[_0x2249('0x4e')](_0x41916b)['then'](function(){for(var _0x4ad2b3=0x0;_0x4ad2b3<_0x41916b['length'];_0x4ad2b3+=0x1){_0x4aeca4[_0x2249('0x4b')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x41916b[_0x4ad2b3]),'UserId':Number(_0x2c2d04['id'])});}});}})[_0x2249('0x18')](function(){if(_0x54decc==='leave'){var _0x3e6488=_[_0x2249('0x19')](_0x2c2d04['OpenchannelInteractions'],'id');return _0x2c2d04[_0x2249('0x4f')](_0x3e6488)[_0x2249('0x18')](function(){for(var _0x253270=0x0;_0x253270<_0x3e6488[_0x2249('0x1d')];_0x253270+=0x1){_0x4aeca4[_0x2249('0x4b')](_0x2249('0x50'),{'OpenchannelInteractionId':Number(_0x3e6488[_0x253270]),'UserId':Number(_0x2c2d04['id'])});}});}})[_0x2249('0x51')](function(_0x5eb02e){_0x1f033a[_0x2249('0x52')](_0x5eb02e);});}}function onDisconnect(_0x2818b0,_0x4ea0be){joinOrLeave(_0x2818b0,_0x2249('0x48'),_0x4ea0be);}function onConnect(_0x401ff4){joinOrLeave(_0x401ff4,_0x2249('0x53'));}exports[_0x2249('0x54')]=function(_0x34f8ae){_0x34f8ae['on'](_0x2249('0x55'),function(_0x1887bd){_0x1887bd['setMaxListeners'](0x0);_0x1887bd[_0x2249('0x56')]=_0x1887bd[_0x2249('0x57')]['connection'][_0x2249('0x58')]+':'+_0x1887bd[_0x2249('0x57')][_0x2249('0x55')][_0x2249('0x59')];_0x1887bd[_0x2249('0x5a')]=new Date();_0x1887bd['log']=function(_0x44573c){console[_0x2249('0x52')]('SocketIO\x20'+_0x1887bd[_0x2249('0x5b')][_0x2249('0x5')]+'['+_0x1887bd[_0x2249('0x56')]+']',_0x44573c);};_0x1887bd['on'](_0x2249('0x5c'),function(){onDisconnect(_0x1887bd,_0x34f8ae);_0x1887bd[_0x2249('0x52')]('DISCONNECTED');});onConnect(_0x1887bd);_0x1887bd[_0x2249('0x52')](_0x2249('0x5d'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index a5d4650..da6e908 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 _0x6205=['name','incomingmessage','outgoingmessage','get','changed','closed','default','length','hasOwnProperty','model','hook','callback','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','Chat','ChatInteraction','newinteraction','afterUpdate','closedinteraction','ChatMessage','afterCreate','Sms','SmsInteraction','SmsMessage','newmessage','FaxInteraction','Fax','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','request','EventManager','then','info','Trigger,\x20%s','code','error','catch','channel','event','direction','UserId','User','find','interface','format','SIP/%s'];(function(_0x2a34bc,_0x13316c){var _0x149d84=function(_0x3732a2){while(--_0x3732a2){_0x2a34bc['push'](_0x2a34bc['shift']());}};_0x149d84(++_0x13316c);}(_0x6205,0x187));var _0x5620=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6205[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x5620('0x0'));var db=require(_0x5620('0x1'))['db'];var jayson=require(_0x5620('0x2'));var logger=require(_0x5620('0x3'))(_0x5620('0x4'));var client=jayson[_0x5620('0x5')]['http']({'port':0x232a});var triggers=[{'channel':_0x5620('0x6'),'model':_0x5620('0x7'),'event':'afterCreate','condition':_0x5620('0x8'),'callback':afterCreate},{'channel':_0x5620('0x6'),'model':_0x5620('0x7'),'event':_0x5620('0x9'),'condition':_0x5620('0xa'),'callback':afterUpdate},{'channel':'Chat','model':_0x5620('0xb'),'event':_0x5620('0xc'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x5620('0xd'),'model':_0x5620('0xe'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x5620('0xd'),'model':_0x5620('0xe'),'event':_0x5620('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x5620('0xd'),'model':_0x5620('0xf'),'event':_0x5620('0xc'),'condition':_0x5620('0x10'),'callback':afterCreateMessage},{'channel':'Fax','model':_0x5620('0x11'),'event':_0x5620('0xc'),'condition':_0x5620('0x8'),'callback':afterCreate},{'channel':_0x5620('0x12'),'model':_0x5620('0x11'),'event':_0x5620('0x9'),'condition':_0x5620('0xa'),'callback':afterUpdate},{'channel':'Fax','model':'FaxMessage','event':_0x5620('0xc'),'condition':_0x5620('0x10'),'callback':afterCreateMessage},{'channel':_0x5620('0x13'),'model':_0x5620('0x14'),'event':_0x5620('0xc'),'condition':_0x5620('0x8'),'callback':afterCreate},{'channel':_0x5620('0x13'),'model':'MailInteraction','event':_0x5620('0x9'),'condition':_0x5620('0xa'),'callback':afterUpdate},{'channel':_0x5620('0x13'),'model':_0x5620('0x15'),'event':_0x5620('0xc'),'condition':_0x5620('0x10'),'callback':afterCreateMessage},{'channel':_0x5620('0x16'),'model':'OpenchannelInteraction','event':_0x5620('0xc'),'condition':_0x5620('0x8'),'callback':afterCreate},{'channel':_0x5620('0x16'),'model':_0x5620('0x17'),'event':_0x5620('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x5620('0x16'),'model':'OpenchannelMessage','event':_0x5620('0xc'),'condition':_0x5620('0x10'),'callback':afterCreateMessage}];function request(_0x3850d6){return client[_0x5620('0x18')](_0x5620('0x19'),_0x3850d6)[_0x5620('0x1a')](function(_0x3cc118){logger[_0x5620('0x1b')](_0x5620('0x1c'),_0x5620('0x19'),_0x3cc118);if(_0x3cc118['error']){if(_0x3cc118['error'][_0x5620('0x1d')]===0x1f4){logger[_0x5620('0x1e')]('Trigger,\x20%s',_0x5620('0x19'),_0x3cc118['error']);}}})[_0x5620('0x1f')](function(_0x2a63cb){logger['error'](_0x5620('0x1c'),'EventManager',_0x2a63cb);});}function afterCreateMessage(_0x19e601,_0x416d7b){return function(_0x193b39,_0x26fcc9){_0x193b39=_0x193b39['get']({'plain':!![]});_0x193b39[_0x5620('0x20')]=_0x19e601;_0x193b39[_0x5620('0x21')]=_0x193b39[_0x5620('0x22')];if(_0x193b39[_0x5620('0x23')]){return db[_0x5620('0x24')][_0x5620('0x25')]({'where':{'id':_0x193b39[_0x5620('0x23')]},'attributes':['id','name'],'raw':!![]})[_0x5620('0x1a')](function(_0x367dc0){_0x193b39[_0x5620('0x26')]=util[_0x5620('0x27')](_0x5620('0x28'),_0x367dc0[_0x5620('0x29')]);_0x193b39[_0x5620('0x20')]=_0x19e601;return request({'event':_0x5620('0x2a'),'message':_0x193b39});})[_0x5620('0x1f')](function(_0x37fd90){console[_0x5620('0x1e')](_0x37fd90);});}else{return request({'event':_0x5620('0x2b'),'message':_0x193b39});}};}function afterCreate(_0xc18afa,_0x4870d2){return function(_0x2cfe7d,_0x4c93be){_0x2cfe7d=_0x2cfe7d[_0x5620('0x2c')]({'plain':!![]});_0x2cfe7d['channel']=_0xc18afa;_0x2cfe7d[_0x5620('0x21')]='opened';return request({'event':_0x4870d2,'message':_0x2cfe7d});};}function afterUpdate(_0x781209,_0xab2449){return function(_0x45a0ed,_0x391459){if(_0x45a0ed[_0x5620('0x2d')](_0x5620('0x2e'))&&_0x45a0ed[_0x5620('0x2e')]){_0x45a0ed=_0x45a0ed[_0x5620('0x2c')]({'plain':!![]});_0x45a0ed[_0x5620('0x20')]=_0x781209;_0x45a0ed[_0x5620('0x21')]=_0x5620('0x2e');if(_0x45a0ed[_0x5620('0x23')]){return db[_0x5620('0x24')][_0x5620('0x25')]({'where':{'id':_0x45a0ed[_0x5620('0x23')]},'attributes':['id',_0x5620('0x29')],'raw':!![]})['then'](function(_0x2915c1){_0x45a0ed[_0x5620('0x26')]=util[_0x5620('0x27')]('SIP/%s',_0x2915c1[_0x5620('0x29')]);return request({'event':_0xab2449,'message':_0x45a0ed});})[_0x5620('0x1f')](function(_0x54a219){console[_0x5620('0x1e')](_0x54a219);});}else{return request({'event':_0xab2449,'message':_0x45a0ed});}}};}exports[_0x5620('0x2f')]=function(){for(var _0x1e073e=0x0;_0x1e073e0x3){var _0x21573d=/\((.+)\)/;var _0x31bfc0=_0x399037['rx']['match'](_0x21573d);if(_0x31bfc0){_0x50fe0f=_0x31bfc0[0x1];}else{_0x50fe0f=null;}}else{_0x50fe0f=null;}_0x399037['cb'](null,{'code':_0x2316e9,'result':_0x739028,'extra':_0x50fe0f});}});_0x5c71aa['on'](_0x4fe4('0x18'),function(_0x345a1e){_0x3b4e07['emit'](_0x4fe4('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x345a1e['code']));});_0x5c71aa['on']('close',function(){_0x3b4e07['emit'](_0x4fe4('0x19'),new AGIError(_0x4fe4('0x1a')));});_0x5c71aa['on'](_0x4fe4('0x1b'),function(){_0x3b4e07[_0x4fe4('0x9')]('timeout',new AGIError(_0x4fe4('0x1c')));_0x5c71aa[_0x4fe4('0x1d')]();});_0x5c71aa['pipe'](_0x440839);this['command']=function(_0x35f66f,_0x247a19){var _0x35f66f=_0x35f66f||'',_0x247a19=typeof _0x247a19==_0x4fe4('0xf')?_0x247a19:new Function();_0x399037={'tx':_0x35f66f,'rx':'','cb':_0x247a19};_0x5c71aa[_0x4fe4('0x1e')](_0x35f66f+'\x0a');},this[_0x4fe4('0x19')]=function(){_0x5c71aa[_0x4fe4('0x1d')]();};}util[_0x4fe4('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x4fe4('0x20')]['sendRequest']=function(_0x509dad){return this[_0x4fe4('0x21')][_0x4fe4('0x22')](this,_0x509dad);};AGIChannel[_0x4fe4('0x20')]['answer']=function(){return this[_0x4fe4('0x23')](_0x4fe4('0x24'));};AGIChannel[_0x4fe4('0x20')][_0x4fe4('0x25')]=function(_0x577bdb,_0xab401b,_0x552f00){_0x577bdb=_0x577bdb===undefined?_0x4fe4('0x26'):_0x577bdb;_0xab401b=_0xab401b===undefined?'5':_0xab401b;_0x552f00=_0x552f00===undefined?'1':_0x552f00;return this[_0x4fe4('0x23')](util[_0x4fe4('0x27')](_0x4fe4('0x28'),_0x577bdb,_0xab401b*0x3e8,_0x552f00));};AGIChannel[_0x4fe4('0x20')][_0x4fe4('0x29')]=function(_0xdb9ab1){_0xdb9ab1=_0xdb9ab1||_0x4fe4('0x2a');return this[_0x4fe4('0x23')](util['format'](_0x4fe4('0x2b'),_0xdb9ab1));};AGIChannel[_0x4fe4('0x20')][_0x4fe4('0x2c')]=function(_0x4f95d1,_0x5cf1ab){if(_[_0x4fe4('0x2d')](_0x5cf1ab)){return this[_0x4fe4('0x23')](util['format']('EXEC\x20%s\x20%s',_0x4f95d1,_0x5cf1ab[_0x4fe4('0x2e')](',')));}return this[_0x4fe4('0x23')](util['format'](_0x4fe4('0x2f'),_0x4f95d1,_0x5cf1ab));};AGIChannel[_0x4fe4('0x20')][_0x4fe4('0x30')]=function(_0x3113f1){return this[_0x4fe4('0x23')](util[_0x4fe4('0x27')]('SET\x20CONTEXT\x20%s',_0x3113f1));};AGIChannel[_0x4fe4('0x20')][_0x4fe4('0x31')]=function(_0x3aa504){return this[_0x4fe4('0x23')](util['format'](_0x4fe4('0x32'),_0x3aa504));};AGIChannel[_0x4fe4('0x20')][_0x4fe4('0x33')]=function(_0x40442d){return this[_0x4fe4('0x23')](util['format'](_0x4fe4('0x34'),_0x40442d));};AGIChannel[_0x4fe4('0x20')][_0x4fe4('0xb')]=function(){return this[_0x4fe4('0x23')](_0x4fe4('0x35'));};AGIChannel['prototype'][_0x4fe4('0x36')]=function(_0x4777a2,_0x2bc844){return this[_0x4fe4('0x23')](util['format'](_0x4fe4('0x37'),_0x4777a2,_0x2bc844?_0x2bc844['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x4fe4('0x20')][_0x4fe4('0x38')]=function(_0x5db417,_0x525c52){return this[_0x4fe4('0x23')](util[_0x4fe4('0x27')](_0x4fe4('0x39'),_0x5db417,_0x525c52));};AGIChannel[_0x4fe4('0x20')]['sayDigits']=function(_0x4d57bb,_0x52e715){return this[_0x4fe4('0x23')](util[_0x4fe4('0x27')]('SAY\x20DIGITS\x20%s\x20%s',_0x4d57bb,_0x52e715));};AGIChannel[_0x4fe4('0x20')][_0x4fe4('0x3a')]=function(_0x2fe4c6,_0x1260c6){return this['sendRequest'](util[_0x4fe4('0x27')](_0x4fe4('0x3b'),_0x2fe4c6,_0x1260c6));};AGIChannel['prototype'][_0x4fe4('0x3c')]=function(_0x5bce49,_0x31d9ed,_0x5edb85){_0x31d9ed=_0x31d9ed||this[_0x4fe4('0x3d')];_0x5edb85=_0x5edb85||0x1;this[_0x4fe4('0x30')](_0x5bce49);this[_0x4fe4('0x31')](_0x31d9ed);this['setPriority'](_0x5edb85);return this[_0x4fe4('0x29')](util[_0x4fe4('0x27')](_0x4fe4('0x3e'),_0x5bce49,_0x31d9ed,_0x5edb85));};AGIChannel[_0x4fe4('0x20')][_0x4fe4('0x3f')]=function(_0x2cdaad){return this[_0x4fe4('0x23')](util[_0x4fe4('0x27')](_0x4fe4('0x40'),_0x2cdaad));};AGIChannel[_0x4fe4('0x20')][_0x4fe4('0x41')]=function(_0x346127,_0x5ab324,_0x1e9b0d,_0x176066,_0x23e91a,_0x566112){_0x5ab324=_0x5ab324||_0x4fe4('0x42');_0x1e9b0d=_0x1e9b0d||'';_0x176066=_0x176066===undefined?-0x1:_0x176066==='-1'?-0x1:_0x176066*0x3e8;_0x23e91a=_0x23e91a===undefined?'':'s='+_0x23e91a;_0x566112=_0x566112?_0x4fe4('0x43'):'';return this[_0x4fe4('0x23')](util[_0x4fe4('0x27')](_0x4fe4('0x44'),_0x346127,_0x5ab324,_0x1e9b0d,_0x176066,_0x566112,_0x23e91a));};AGIChannel[_0x4fe4('0x20')][_0x4fe4('0x45')]=function(_0x77b963,_0x4c4e5e){_0x4c4e5e=_0x4c4e5e||'';return this['sendRequest'](util[_0x4fe4('0x27')](_0x4fe4('0x46'),_0x77b963,_0x4c4e5e));};AGIChannel[_0x4fe4('0x20')][_0x4fe4('0x47')]=function(_0x594260){return this[_0x4fe4('0x2c')](_0x4fe4('0x48'),_0x594260);};AGIChannel[_0x4fe4('0x20')]['wait']=function(_0x25e221){return this[_0x4fe4('0x2c')](_0x4fe4('0x49'),_0x25e221);};AGIChannel[_0x4fe4('0x20')][_0x4fe4('0x18')]=function(_0x3cdbd9,_0x368898){this[_0x4fe4('0x29')](util[_0x4fe4('0x27')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x3cdbd9['id'],_0x3cdbd9[_0x4fe4('0x4a')],_0x368898));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x4fe4('0x4b')]=AGIChannel; \ No newline at end of file +var _0xd4da=['inherits','sendRequest','sync','prototype','answer','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','noop','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','events','EventEmitter','./reply','./error','call','utf8','setEncoding','headers','emit','ready','toLowerCase','hangup','substring','520-Invalid','search','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','close','timeout','destroy','command'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd4da,0x166));var _0xad4d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd4da[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0xad4d('0x0'));var _=require('lodash');var EventEmitter=require(_0xad4d('0x1'))[_0xad4d('0x2')];var AGIReply=require(_0xad4d('0x3'));var AGIError=require(_0xad4d('0x4'));function AGIChannel(_0x3c068d){var _0x3d4d76=this,_0x27e660=new AGIReply(),_0x423c89=![],_0x415510={};EventEmitter[_0xad4d('0x5')](_0x3d4d76);_0x3c068d['setEncoding'](_0xad4d('0x6'));_0x3c068d['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x27e660[_0xad4d('0x7')](_0xad4d('0x6'));_0x27e660['on'](_0xad4d('0x8'),function(_0x305d13){for(var _0x34675d in _0x305d13){_0x3d4d76[_0x34675d]=_0x305d13[_0x34675d];}_0x3d4d76[_0xad4d('0x9')](_0xad4d('0xa'));});_0x27e660['on']('line',function(_0x5a4755){if(_0x5a4755[_0xad4d('0xb')]()==_0xad4d('0xc')){_0x3d4d76[_0xad4d('0x9')](_0xad4d('0xc'));return;}if(_0x5a4755[_0xad4d('0xd')](0x0,0xb)==_0xad4d('0xe')){_0x423c89=!![];}if(_0x423c89){_0x415510['rx']+=_0x5a4755+'\x0a';if(_0x5a4755[_0xad4d('0xf')]('520\x20End\x20of\x20proper')!=-0x1){_0x423c89=![];}}else{_0x415510['rx']=_0x5a4755;}if(_0x423c89){return;}if(typeof _0x415510['cb']==_0xad4d('0x10')){var _0x418763=_0x415510['rx'][_0xad4d('0xd')](0x0,0x3),_0x770b90=null,_0xebbe03=null;_0x418763=parseInt(_0x418763);if(isNaN(_0x418763)){_0x415510['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xad4d('0x11')});return;}if(_0x418763!=0xc8){_0x415510['cb'](null,{'code':_0x418763,'result':-0x1,'extra':'KO'});return;}_0x770b90=_0x415510['rx'][_0xad4d('0xd')](0x4)[_0xad4d('0x12')](_0xad4d('0x13'),'');if(_0x770b90[_0xad4d('0x14')]('\x20')!=-0x1){_0x770b90=_0x770b90[_0xad4d('0x15')](0x0,_0x770b90['indexOf']('\x20'));}if(_[_0xad4d('0x16')](_0x770b90,'-1')){_0x770b90=parseInt(_0x770b90);}_0xebbe03=_0x415510['rx'][_0xad4d('0x17')]('\x20');if(_0xebbe03[_0xad4d('0x18')]==0x3){_0xebbe03=_0xebbe03[0x2]['substring'](0x1,_0xebbe03[0x2][_0xad4d('0x18')]-0x1);}else if(_0xebbe03[_0xad4d('0x18')]>0x3){var _0x40b6b2=/\((.+)\)/;var _0x33f5de=_0x415510['rx'][_0xad4d('0x19')](_0x40b6b2);if(_0x33f5de){_0xebbe03=_0x33f5de[0x1];}else{_0xebbe03=null;}}else{_0xebbe03=null;}_0x415510['cb'](null,{'code':_0x418763,'result':_0x770b90,'extra':_0xebbe03});}});_0x3c068d['on'](_0xad4d('0x1a'),function(_0x2320e7){_0x3d4d76[_0xad4d('0x9')](_0xad4d('0x1a'),new AGIError(_0xad4d('0x1b'),_0x2320e7['code']));});_0x3c068d['on']('close',function(){_0x3d4d76[_0xad4d('0x9')](_0xad4d('0x1c'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x3c068d['on'](_0xad4d('0x1d'),function(){_0x3d4d76['emit'](_0xad4d('0x1d'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x3c068d[_0xad4d('0x1e')]();});_0x3c068d['pipe'](_0x27e660);this[_0xad4d('0x1f')]=function(_0x1d45d2,_0x1641e5){var _0x1d45d2=_0x1d45d2||'',_0x1641e5=typeof _0x1641e5==_0xad4d('0x10')?_0x1641e5:new Function();_0x415510={'tx':_0x1d45d2,'rx':'','cb':_0x1641e5};_0x3c068d['write'](_0x1d45d2+'\x0a');},this[_0xad4d('0x1c')]=function(){_0x3c068d[_0xad4d('0x1e')]();};}util[_0xad4d('0x20')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xad4d('0x21')]=function(_0x2213de){return this['command'][_0xad4d('0x22')](this,_0x2213de);};AGIChannel[_0xad4d('0x23')][_0xad4d('0x24')]=function(){return this[_0xad4d('0x21')](_0xad4d('0x25'));};AGIChannel[_0xad4d('0x23')][_0xad4d('0x26')]=function(_0x2aa9cd,_0x1dfb68,_0x3a8a1e){_0x2aa9cd=_0x2aa9cd===undefined?'beep':_0x2aa9cd;_0x1dfb68=_0x1dfb68===undefined?'5':_0x1dfb68;_0x3a8a1e=_0x3a8a1e===undefined?'1':_0x3a8a1e;return this['sendRequest'](util['format'](_0xad4d('0x27'),_0x2aa9cd,_0x1dfb68*0x3e8,_0x3a8a1e));};AGIChannel['prototype']['noop']=function(_0x1d1acf){_0x1d1acf=_0x1d1acf||_0xad4d('0x28');return this['sendRequest'](util[_0xad4d('0x29')](_0xad4d('0x2a'),_0x1d1acf));};AGIChannel[_0xad4d('0x23')][_0xad4d('0x2b')]=function(_0x236fcb,_0x46f558){if(_['isArray'](_0x46f558)){return this[_0xad4d('0x21')](util[_0xad4d('0x29')](_0xad4d('0x2c'),_0x236fcb,_0x46f558[_0xad4d('0x2d')](',')));}return this['sendRequest'](util[_0xad4d('0x29')](_0xad4d('0x2c'),_0x236fcb,_0x46f558));};AGIChannel[_0xad4d('0x23')]['setContext']=function(_0x5b0fe9){return this[_0xad4d('0x21')](util['format'](_0xad4d('0x2e'),_0x5b0fe9));};AGIChannel['prototype'][_0xad4d('0x2f')]=function(_0x286a41){return this[_0xad4d('0x21')](util[_0xad4d('0x29')](_0xad4d('0x30'),_0x286a41));};AGIChannel['prototype'][_0xad4d('0x31')]=function(_0x32eef7){return this[_0xad4d('0x21')](util[_0xad4d('0x29')](_0xad4d('0x32'),_0x32eef7));};AGIChannel[_0xad4d('0x23')]['hangup']=function(){return this['sendRequest'](_0xad4d('0x33'));};AGIChannel[_0xad4d('0x23')][_0xad4d('0x34')]=function(_0x326b77,_0x5d4952){return this[_0xad4d('0x21')](util[_0xad4d('0x29')](_0xad4d('0x35'),_0x326b77,_0x5d4952?_0x5d4952[_0xad4d('0x36')]()[_0xad4d('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xad4d('0x23')][_0xad4d('0x37')]=function(_0x4c7922,_0x523e74){return this[_0xad4d('0x21')](util[_0xad4d('0x29')](_0xad4d('0x38'),_0x4c7922,_0x523e74));};AGIChannel[_0xad4d('0x23')]['sayDigits']=function(_0x4f6c49,_0x640a3){return this['sendRequest'](util[_0xad4d('0x29')](_0xad4d('0x39'),_0x4f6c49,_0x640a3));};AGIChannel[_0xad4d('0x23')][_0xad4d('0x3a')]=function(_0x439be2,_0x52eea2){return this[_0xad4d('0x21')](util['format'](_0xad4d('0x3b'),_0x439be2,_0x52eea2));};AGIChannel[_0xad4d('0x23')][_0xad4d('0x3c')]=function(_0x4fe1d6,_0x8cc604,_0x1dfff4){_0x8cc604=_0x8cc604||this[_0xad4d('0x3d')];_0x1dfff4=_0x1dfff4||0x1;this[_0xad4d('0x3e')](_0x4fe1d6);this[_0xad4d('0x2f')](_0x8cc604);this[_0xad4d('0x31')](_0x1dfff4);return this[_0xad4d('0x3f')](util['format'](_0xad4d('0x40'),_0x4fe1d6,_0x8cc604,_0x1dfff4));};AGIChannel['prototype'][_0xad4d('0x41')]=function(_0x379346){return this[_0xad4d('0x21')](util[_0xad4d('0x29')]('GET\x20VARIABLE\x20\x22%s\x22',_0x379346));};AGIChannel[_0xad4d('0x23')][_0xad4d('0x42')]=function(_0x5a9f19,_0x577640,_0x34f0b6,_0x2ae8db,_0x334aa8,_0x2dd4c4){_0x577640=_0x577640||_0xad4d('0x43');_0x34f0b6=_0x34f0b6||'';_0x2ae8db=_0x2ae8db===undefined?-0x1:_0x2ae8db==='-1'?-0x1:_0x2ae8db*0x3e8;_0x334aa8=_0x334aa8===undefined?'':'s='+_0x334aa8;_0x2dd4c4=_0x2dd4c4?_0xad4d('0x44'):'';return this[_0xad4d('0x21')](util[_0xad4d('0x29')](_0xad4d('0x45'),_0x5a9f19,_0x577640,_0x34f0b6,_0x2ae8db,_0x2dd4c4,_0x334aa8));};AGIChannel[_0xad4d('0x23')][_0xad4d('0x46')]=function(_0x34cb99,_0x4b71fe){_0x4b71fe=_0x4b71fe||'';return this[_0xad4d('0x21')](util[_0xad4d('0x29')](_0xad4d('0x47'),_0x34cb99,_0x4b71fe));};AGIChannel[_0xad4d('0x23')][_0xad4d('0x48')]=function(_0x2addd7){return this['exec']('AGI',_0x2addd7);};AGIChannel[_0xad4d('0x23')][_0xad4d('0x49')]=function(_0x4c9e74){return this[_0xad4d('0x2b')](_0xad4d('0x4a'),_0x4c9e74);};AGIChannel[_0xad4d('0x23')][_0xad4d('0x1a')]=function(_0x5836a0,_0x151cce){this[_0xad4d('0x3f')](util[_0xad4d('0x29')](_0xad4d('0x4b'),_0x5836a0['id'],_0x5836a0[_0xad4d('0x4c')],_0x151cce));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xad4d('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 7cb1db0..8281f09 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 _0x871c=['Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','format','apply','message','name','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.'];(function(_0x584b81,_0x1298cc){var _0x37f084=function(_0x50c2cf){while(--_0x50c2cf){_0x584b81['push'](_0x584b81['shift']());}};_0x37f084(++_0x1298cc);}(_0x871c,0x178));var _0xc871=function(_0x598dfc,_0x3c3fcd){_0x598dfc=_0x598dfc-0x0;var _0x406dc6=_0x871c[_0x598dfc];return _0x406dc6;};'use strict';var util=require(_0xc871('0x0'));var error={'E_AGI_UNDEFINED':_0xc871('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xc871('0x2'),'E_AGI_SERVER_CLOSE':_0xc871('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xc871('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xc871('0x5'),'E_AGI_SOCKET_TIMEOUT':_0xc871('0x6'),'E_AGI_COMMAND_EMPTY':_0xc871('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xc871('0x8'),'E_AGI_IVR_ENTRY':_0xc871('0x9')};function AGIError(_0x148fa4){var _0x148fa4=_0x148fa4||null,_0x296072=_0x296072||[],_0x21fb1c=0x1,_0x33969e='';if(!error[_0x148fa4]){_0x148fa4=_0xc871('0xa');}_0x296072['push'](error[_0x148fa4]);while(arguments[_0x21fb1c]){_0x296072['push'](arguments[_0x21fb1c]);_0x21fb1c++;}_0x33969e=util[_0xc871('0xb')][_0xc871('0xc')](util,_0x296072);this[_0xc871('0xd')]=_0x33969e;this[_0xc871('0xe')]=_0x148fa4;}module[_0xc871('0xf')]=AGIError; \ No newline at end of file +var _0xd49e=['Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.'];(function(_0x124ca1,_0x3d35ef){var _0x135a7a=function(_0x36ab7b){while(--_0x36ab7b){_0x124ca1['push'](_0x124ca1['shift']());}};_0x135a7a(++_0x3d35ef);}(_0xd49e,0xaf));var _0xed49=function(_0x3b0d98,_0x346f06){_0x3b0d98=_0x3b0d98-0x0;var _0x296885=_0xd49e[_0x3b0d98];return _0x296885;};'use strict';var util=require(_0xed49('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xed49('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xed49('0x2'),'E_AGI_SERVER_VOICE_DISABLED':_0xed49('0x3'),'E_AGI_SOCKET_ERROR':_0xed49('0x4'),'E_AGI_SOCKET_CLOSE':_0xed49('0x5'),'E_AGI_SOCKET_TIMEOUT':_0xed49('0x6'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xed49('0x7'),'E_AGI_IVR_ENTRY':_0xed49('0x8')};function AGIError(_0x4aa38d){var _0x4aa38d=_0x4aa38d||null,_0x4a19d1=_0x4a19d1||[],_0x2bcf8a=0x1,_0x35357e='';if(!error[_0x4aa38d]){_0x4aa38d=_0xed49('0x9');}_0x4a19d1[_0xed49('0xa')](error[_0x4aa38d]);while(arguments[_0x2bcf8a]){_0x4a19d1['push'](arguments[_0x2bcf8a]);_0x2bcf8a++;}_0x35357e=util[_0xed49('0xb')][_0xed49('0xc')](util,_0x4a19d1);this['message']=_0x35357e;this[_0xed49('0xd')]=_0x4aa38d;}module[_0xed49('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 dccea01..80b408a 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 _0x7af2=['exports','../../../config/logger','agi','menu','getdigits','vertices','edges','numberOfEdges','prototype','addVertex','push','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','target','invalid','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found'];(function(_0x4e7fa9,_0x29d247){var _0x401f9e=function(_0x2f6a12){while(--_0x2f6a12){_0x4e7fa9['push'](_0x4e7fa9['shift']());}};_0x401f9e(++_0x29d247);}(_0x7af2,0x119));var _0x27af=function(_0x5ebedc,_0x18775d){_0x5ebedc=_0x5ebedc-0x0;var _0x5d3aa6=_0x7af2[_0x5ebedc];return _0x5d3aa6;};'use strict';var _=require('lodash');var logger=require(_0x27af('0x0'))(_0x27af('0x1'));var verticesWithRetry=[_0x27af('0x2'),_0x27af('0x3'),'getsecretdigits'];var Graph=function(){this[_0x27af('0x4')]={};this[_0x27af('0x5')]={};this[_0x27af('0x6')]=0x0;};Graph[_0x27af('0x7')][_0x27af('0x8')]=function(_0x418f21){this[_0x27af('0x4')][_0x418f21['id']]=_0x418f21;this[_0x27af('0x5')][_0x418f21['id']]=[];};Graph[_0x27af('0x7')]['addEdge']=function(_0x1e2509,_0x366868,_0x389e97){this['edges'][_0x1e2509][_0x27af('0x9')]({'target':_0x366868,'condition':_0x389e97});this[_0x27af('0x6')]+=0x1;};Graph[_0x27af('0x7')]['size']=function(){return _[_0x27af('0xa')](this['vertices']);};Graph['prototype'][_0x27af('0xb')]=function(){return this['numberOfEdges'];};Graph['prototype'][_0x27af('0xc')]=function(_0x59c073){return this[_0x27af('0x4')][_0x59c073];};Graph['prototype'][_0x27af('0xd')]=function(_0x203501,_0x1fd964){if(!this[_0x27af('0x4')][_0x203501]){return logger[_0x27af('0xe')](_0x27af('0xf'));}var _0x234825=_0x1fd964(this[_0x27af('0x4')][_0x203501]);if(!_0x234825){return logger[_0x27af('0xe')](_0x27af('0x10'));}if(this[_0x27af('0x5')][_0x203501][_0x27af('0x11')]===0x0){return logger[_0x27af('0xe')](_0x27af('0x12'));}for(var _0x2bfc9=0x0,_0xf13104=[],_0x13f8ed=![];_0x2bfc9\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','xml2json','util','moment','../../config/environment','../../config/logger','../../config/license/util','./rpc','./mailRpc','./graph','agi','defaults','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','root','agicommand','hasOwnProperty','retry','maxRetry','omit','mxCell','length','target','addEdge','source','value','getSquareProject','then','catch','agi_'];(function(_0x5af401,_0x5e47a6){var _0x5a172c=function(_0x47425e){while(--_0x47425e){_0x5af401['push'](_0x5af401['shift']());}};_0x5a172c(++_0x5e47a6);}(_0x44e8,0xd7));var _0x844e=function(_0x56ad7d,_0x4c4733){_0x56ad7d=_0x56ad7d-0x0;var _0xed99d5=_0x44e8[_0x56ad7d];return _0xed99d5;};'use strict';var parser=require(_0x844e('0x0'));var _=require('lodash');var syncho=require('syncho');var util=require(_0x844e('0x1'));var moment=require(_0x844e('0x2'));var config=require(_0x844e('0x3'));var logger=require(_0x844e('0x4'))('agi');var utilLicense=require(_0x844e('0x5'));var rpc=require(_0x844e('0x6'));var mailRpc=require(_0x844e('0x7'));var Graph=require(_0x844e('0x8'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x844e('0x9')]=_[_0x844e('0xa')](config[_0x844e('0x9')],{'ip':_0x844e('0xb'),'port':0x11dd});function connectionHandler(_0x571b91){process[_0x844e('0xc')](function(){syncho(function(){try{setChannelVariables(_0x571b91);agiHandler(_0x571b91);}catch(_0x7dff16){logger[_0x844e('0xd')](_0x7dff16[_0x844e('0xe')]);}});});}function listeningHandler(){console[_0x844e('0xf')](_0x844e('0x10'),config['agi'][_0x844e('0x11')]);logger[_0x844e('0x12')](util[_0x844e('0x13')](_0x844e('0x14'),config[_0x844e('0x9')]['ip'],config[_0x844e('0x9')][_0x844e('0x11')]));}function errorHandler(_0x5c6c08){if(_0x5c6c08&&_0x5c6c08[_0x844e('0x15')]&&_0x5c6c08[_0x844e('0x16')]){logger['error'](util[_0x844e('0x13')](_0x844e('0x17'),_0x5c6c08['name'],_0x5c6c08[_0x844e('0x16')]));}else{logger[_0x844e('0xd')](util[_0x844e('0x13')]('[ERROR]\x20%s',_0x5c6c08[_0x844e('0xe')]));}}function closeHandler(){logger[_0x844e('0x12')](util[_0x844e('0x13')](_0x844e('0x18'),this[_0x844e('0x19')],this[_0x844e('0x1a')],this[_0x844e('0x1b')],this[_0x844e('0x1c')],this['uniqueid']));try{createSquareReport(this);}catch(_0x36286c){logger['error'](_0x36286c[_0x844e('0xe')]);}}function timeoutHandler(){logger['info'](util[_0x844e('0x13')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x844e('0x19')],this[_0x844e('0x1a')],this[_0x844e('0x1b')],this[_0x844e('0x1c')],this[_0x844e('0x1d')]));}function hangupHandler(){logger[_0x844e('0x12')](util[_0x844e('0x13')](_0x844e('0x1e'),this['arg_1'],this[_0x844e('0x1a')],this['callerid'],this['dnid'],this[_0x844e('0x1d')]));this[_0x844e('0x1f')]=!![];}function getRoot(_0x439b26){return parser[_0x844e('0x20')](_0x439b26,{'object':!![]})['mxGraphModel'][_0x844e('0x21')];}function addVertex(_0x3dde07,_0x571498,_0x2520f8){_0x571498[_0x844e('0x22')]=_0x2520f8;if(_0x571498[_0x844e('0x23')](_0x844e('0x24'))){_0x571498[_0x844e('0x25')]=parseInt(_0x571498[_0x844e('0x24')],0xa);}_0x3dde07['addVertex'](_[_0x844e('0x26')](_0x571498,_0x844e('0x27')));}function initGraph(_0x11859a,_0x263702){var _0x2c915f=new Graph();for(var _0x5d6856 in _0x11859a){if(_0x11859a[_0x844e('0x23')](_0x5d6856)){if(_['isArray'](_0x11859a[_0x5d6856])){for(var _0x57b2ef=0x0;_0x57b2ef<_0x11859a[_0x5d6856][_0x844e('0x28')];_0x57b2ef+=0x1){addVertex(_0x2c915f,_0x11859a[_0x5d6856][_0x57b2ef],_0x5d6856);}}else{addVertex(_0x2c915f,_0x11859a[_0x5d6856],_0x5d6856);}}}for(var _0x130d87=0x0;_0x130d87<_0x263702[_0x844e('0x28')];_0x130d87+=0x1){if(_0x263702[_0x130d87]['source']&&_0x263702[_0x130d87][_0x844e('0x29')]){_0x2c915f[_0x844e('0x2a')](_0x263702[_0x130d87][_0x844e('0x2b')],_0x263702[_0x130d87]['target'],_0x263702[_0x130d87][_0x844e('0x2c')]);}}return _0x2c915f;}function getSquareProject(_0x81d4de,_0x2f1697){rpc[_0x844e('0x2d')](_0x81d4de)[_0x844e('0x2e')](function(_0x799cde){_0x2f1697(null,_0x799cde);})[_0x844e('0x2f')](function(_0x2a06a){_0x2f1697(null,_0x2a06a);});}function createSquareReport(_0x618bf6,_0x2e4bdf){rpc['createSquareReport'](_0x618bf6)[_0x844e('0x2e')](function(_0x397546){if(_0x2e4bdf){_0x2e4bdf(null,_0x397546);}})[_0x844e('0x2f')](function(_0x5f5dc3){if(_0x2e4bdf){_0x2e4bdf(null,_0x5f5dc3);}});}function setChannelVariables(_0x43ae36){for(var _0x31754e in _0x43ae36){if(_0x43ae36[_0x844e('0x23')](_0x31754e)){if(_0x31754e['indexOf'](_0x844e('0x30'))===0x0){_0x43ae36[_0x31754e[_0x844e('0x31')](0x4)]=_0x43ae36[_0x31754e];delete _0x43ae36[_0x31754e];}}}}function getLogFromObject(_0x294dea){return util['inspect'](_0x294dea,{'showHidden':![],'depth':null});}function agiHandler(_0x1d8f82){var _0x1592fb,_0x5d613d,_0x1fdba9,_0x10e867,_0x4eaf55;logger[_0x844e('0x32')](_0x844e('0x33'),JSON[_0x844e('0x34')](_0x1d8f82,null,0x2));logger[_0x844e('0x12')](util[_0x844e('0x13')](_0x844e('0x35'),_0x1d8f82[_0x844e('0x19')],_0x1d8f82['calleridname'],_0x1d8f82[_0x844e('0x1b')],_0x1d8f82[_0x844e('0x1c')],_0x1d8f82[_0x844e('0x1d')]));_0x1d8f82['on'](_0x844e('0xd'),errorHandler);_0x1d8f82['on'](_0x844e('0x36'),closeHandler);_0x1d8f82['on'](_0x844e('0x37'),timeoutHandler);_0x1d8f82[_0x844e('0x1f')]=![];_0x1d8f82['on'](_0x844e('0x38'),hangupHandler);var _0x10dc63=getSquareProject[_0x844e('0x39')](null,_0x1d8f82[_0x844e('0x19')]);if(_0x10dc63){if(_0x10dc63['production']){_0x1592fb=getRoot(_0x10dc63['production']);if(_0x1592fb&&_0x1592fb[_0x844e('0x3a')]){logger[_0x844e('0x32')](_0x844e('0x21'),JSON[_0x844e('0x34')](_0x1592fb,null,0x2));_0x1d8f82[_0x844e('0x3b')]=moment()[_0x844e('0x13')](_0x844e('0x3c'));_0x5d613d=initGraph(_[_0x844e('0x26')](_0x1592fb,_0x844e('0x27')),_0x1592fb['mxCell']);_0x1fdba9=new Vertices(_0x1d8f82,rpc,mailRpc);logger[_0x844e('0x12')](util['format'](_0x844e('0x3d'),_0x1d8f82['arg_1'],_0x1d8f82[_0x844e('0x1a')],_0x1d8f82['callerid'],_0x1d8f82[_0x844e('0x1c')],_0x1d8f82[_0x844e('0x1d')]));_0x5d613d[_0x844e('0x3e')](_0x1592fb[_0x844e('0x3a')]['id'],function(_0x2eb412){try{_0x2eb412=_0x1fdba9[_0x844e('0x3f')](_0x2eb412);logger[_0x844e('0x32')](_0x844e('0x40'),JSON[_0x844e('0x34')](_0x2eb412,null,0x2));if(_0x2eb412[_0x844e('0x22')]===_0x844e('0x41')){logger['info'](_0x844e('0x42'));_0x1d8f82[_0x844e('0x43')]=_0x2eb412[_0x844e('0x43')]||_0x1d8f82['context'];_0x1d8f82['extension']=_0x2eb412[_0x844e('0x44')];_0x1d8f82[_0x844e('0x45')]=_0x2eb412[_0x844e('0x45')]?_0x2eb412['priority']-0x1:0x1;return null;}else if(_0x2eb412&&_0x1fdba9[_0x2eb412['agicommand']]){_0x4eaf55=_0x1fdba9[_0x2eb412['agicommand']](_0x2eb412);logger['info'](_0x844e('0x46'),JSON[_0x844e('0x34')](_0x4eaf55,null,0x2));if(_0x4eaf55&&_0x4eaf55[_0x844e('0x47')]===AGI_CODE_SUCCESS&&_0x4eaf55[_0x844e('0x48')]!==AGI_RESULT_ERROR&&!_0x1d8f82[_0x844e('0x1f')]){logger['debug'](_0x844e('0x46'),getLogFromObject(_0x4eaf55));return _['isUndefined'](_0x4eaf55['result'])?null:_0x4eaf55[_0x844e('0x48')][_0x844e('0x49')]();}else{logger[_0x844e('0xd')](_0x844e('0x46'),getLogFromObject(_0x4eaf55));return null;}}else{logger['error'](_0x844e('0x4a'));return null;}}catch(_0x46f258){logger[_0x844e('0xd')](_0x46f258['stack']);return null;}});if(_0x1592fb[_0x844e('0x4b')]){logger[_0x844e('0x12')](util['format'](_0x844e('0x4c'),_0x1d8f82[_0x844e('0x19')],_0x1d8f82[_0x844e('0x1a')],_0x1d8f82[_0x844e('0x1b')],_0x1d8f82[_0x844e('0x1c')],_0x1d8f82[_0x844e('0x1d')]));_0x5d613d['traverseBFS'](_0x1592fb[_0x844e('0x4b')]['id'],function(_0xf828c3){try{_0xf828c3=_0x1fdba9[_0x844e('0x3f')](_0xf828c3);logger[_0x844e('0x32')](_0x844e('0x40'),JSON[_0x844e('0x34')](_0xf828c3,null,0x2));if(_0xf828c3&&_0x1fdba9[_0xf828c3[_0x844e('0x22')]]){_0x4eaf55=_0x1fdba9[_0xf828c3[_0x844e('0x22')]](_0xf828c3);if(_0x4eaf55){logger[_0x844e('0x32')](_0x844e('0x46'),getLogFromObject(_0x4eaf55));return _['isUndefined'](_0x4eaf55[_0x844e('0x48')])?null:_0x4eaf55[_0x844e('0x48')][_0x844e('0x49')]();}else{logger['error'](_0x844e('0x46'),getLogFromObject(_0x4eaf55));return null;}}else{logger[_0x844e('0xd')](_0x844e('0x4a'));return null;}}catch(_0x247276){logger[_0x844e('0xd')](_0x247276[_0x844e('0xe')]);return null;}});}logger[_0x844e('0x12')](util['format'](_0x844e('0x4d'),_0x1d8f82[_0x844e('0x19')],_0x1d8f82[_0x844e('0x1a')],_0x1d8f82[_0x844e('0x1b')],_0x1d8f82[_0x844e('0x1c')],_0x1d8f82[_0x844e('0x1d')]));logger[_0x844e('0x12')](util[_0x844e('0x13')](_0x844e('0x4e'),_0x1d8f82[_0x844e('0x43')],_0x1d8f82[_0x844e('0x44')],parseInt(_0x1d8f82[_0x844e('0x45')],0xa)+0x1));_0x1d8f82[_0x844e('0x4f')](_0x1d8f82['context'],_0x1d8f82[_0x844e('0x44')],parseInt(_0x1d8f82[_0x844e('0x45')],0xa)+0x1);_0x1d8f82[_0x844e('0x36')]();}}else{logger[_0x844e('0xd')](util[_0x844e('0x13')](_0x844e('0x50'),_0x1d8f82['arg_1']));_0x1d8f82[_0x844e('0x4f')](_0x1d8f82[_0x844e('0x43')],_0x1d8f82['extension'],parseInt(_0x1d8f82[_0x844e('0x45')],0xa)+0x1);_0x1d8f82[_0x844e('0x36')]();}}else{logger[_0x844e('0xd')](util[_0x844e('0x13')](_0x844e('0x51'),_0x1d8f82[_0x844e('0x19')]));_0x1d8f82[_0x844e('0x4f')](_0x1d8f82[_0x844e('0x43')],_0x1d8f82[_0x844e('0x44')],parseInt(_0x1d8f82[_0x844e('0x45')],0xa)+0x1);_0x1d8f82[_0x844e('0x36')]();}}function main(){var _0x1a22a0;return utilLicense[_0x844e('0x52')]()[_0x844e('0x2e')](function(_0x5e723f){if(_0x5e723f){if(_0x5e723f[_0x844e('0x53')]){if(_0x5e723f[_0x844e('0x54')]&&_0x5e723f['callysquare']>0x0){logger[_0x844e('0x12')](util['format'](_0x844e('0x55'),_0x5e723f[_0x844e('0x54')]));_0x1a22a0=_0x5e723f[_0x844e('0x54')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x844e('0x12')](_0x844e('0x56'));_0x1a22a0=-0x1;}}})[_0x844e('0x2f')](function(_0x3d6fa7){logger[_0x844e('0xd')]('[LICENSE]',_0x3d6fa7[_0x844e('0xe')]);})[_0x844e('0x4b')](function(){var _0x4656ab=require(_0x844e('0x57'))(config['agi'][_0x844e('0x11')],config[_0x844e('0x9')]['ip'],_0x1a22a0);_0x4656ab['on'](_0x844e('0xd'),errorHandler);_0x4656ab['on']('listening',listeningHandler);_0x4656ab['on']('connection',connectionHandler);_0x4656ab['on'](_0x844e('0x36'),closeHandler);});}main(); \ No newline at end of file +var _0xf006=['name','message','[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','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','uniqueid','toJson','mxGraphModel','root','agicommand','retry','maxRetry','omit','hasOwnProperty','isArray','length','source','target','addEdge','value','getSquareProject','then','catch','indexOf','agi_','substring','inspect','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','traverseBFS','clear','vertex','gotoc','context','extension','priority','code','result','evtHangup','debug','response','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','[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','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','listening','syncho','util','../../config/environment','agi','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d'];(function(_0x28833e,_0xdf7fd0){var _0x21d852=function(_0x1e0d17){while(--_0x1e0d17){_0x28833e['push'](_0x28833e['shift']());}};_0x21d852(++_0xdf7fd0);}(_0xf006,0x146));var _0x6f00=function(_0x46dcd7,_0xb1dbe5){_0x46dcd7=_0x46dcd7-0x0;var _0x5de4a6=_0xf006[_0x46dcd7];return _0x5de4a6;};'use strict';var parser=require('xml2json');var _=require('lodash');var syncho=require(_0x6f00('0x0'));var util=require(_0x6f00('0x1'));var moment=require('moment');var config=require(_0x6f00('0x2'));var logger=require('../../config/logger')(_0x6f00('0x3'));var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var mailRpc=require(_0x6f00('0x4'));var Graph=require(_0x6f00('0x5'));var Vertices=require(_0x6f00('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x6f00('0x7')](config['agi'],{'ip':_0x6f00('0x8'),'port':0x11dd});function connectionHandler(_0x3001b1){process[_0x6f00('0x9')](function(){syncho(function(){try{setChannelVariables(_0x3001b1);agiHandler(_0x3001b1);}catch(_0x2d2c55){logger[_0x6f00('0xa')](_0x2d2c55[_0x6f00('0xb')]);}});});}function listeningHandler(){console[_0x6f00('0xc')](_0x6f00('0xd'),config[_0x6f00('0x3')][_0x6f00('0xe')]);logger[_0x6f00('0xf')](util[_0x6f00('0x10')](_0x6f00('0x11'),config['agi']['ip'],config[_0x6f00('0x3')][_0x6f00('0xe')]));}function errorHandler(_0x158817){if(_0x158817&&_0x158817[_0x6f00('0x12')]&&_0x158817[_0x6f00('0x13')]){logger['error'](util[_0x6f00('0x10')]('[%s]\x20%s',_0x158817[_0x6f00('0x12')],_0x158817['message']));}else{logger[_0x6f00('0xa')](util[_0x6f00('0x10')](_0x6f00('0x14'),_0x158817[_0x6f00('0xb')]));}}function closeHandler(){logger[_0x6f00('0xf')](util[_0x6f00('0x10')](_0x6f00('0x15'),this[_0x6f00('0x16')],this[_0x6f00('0x17')],this['callerid'],this[_0x6f00('0x18')],this['uniqueid']));try{createSquareReport(this);}catch(_0x534275){logger[_0x6f00('0xa')](_0x534275[_0x6f00('0xb')]);}}function timeoutHandler(){logger[_0x6f00('0xf')](util[_0x6f00('0x10')](_0x6f00('0x19'),this[_0x6f00('0x16')],this[_0x6f00('0x17')],this[_0x6f00('0x1a')],this[_0x6f00('0x18')],this[_0x6f00('0x1b')]));}function hangupHandler(){logger[_0x6f00('0xf')](util[_0x6f00('0x10')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this['calleridname'],this[_0x6f00('0x1a')],this[_0x6f00('0x18')],this[_0x6f00('0x1b')]));this['evtHangup']=!![];}function getRoot(_0xe301e5){return parser[_0x6f00('0x1c')](_0xe301e5,{'object':!![]})[_0x6f00('0x1d')][_0x6f00('0x1e')];}function addVertex(_0x388983,_0x1cbf1c,_0x90d74c){_0x1cbf1c[_0x6f00('0x1f')]=_0x90d74c;if(_0x1cbf1c['hasOwnProperty'](_0x6f00('0x20'))){_0x1cbf1c[_0x6f00('0x21')]=parseInt(_0x1cbf1c[_0x6f00('0x20')],0xa);}_0x388983['addVertex'](_[_0x6f00('0x22')](_0x1cbf1c,'mxCell'));}function initGraph(_0x25c6a7,_0x511293){var _0x434735=new Graph();for(var _0x39375d in _0x25c6a7){if(_0x25c6a7[_0x6f00('0x23')](_0x39375d)){if(_[_0x6f00('0x24')](_0x25c6a7[_0x39375d])){for(var _0x375d76=0x0;_0x375d76<_0x25c6a7[_0x39375d]['length'];_0x375d76+=0x1){addVertex(_0x434735,_0x25c6a7[_0x39375d][_0x375d76],_0x39375d);}}else{addVertex(_0x434735,_0x25c6a7[_0x39375d],_0x39375d);}}}for(var _0x23a346=0x0;_0x23a346<_0x511293[_0x6f00('0x25')];_0x23a346+=0x1){if(_0x511293[_0x23a346][_0x6f00('0x26')]&&_0x511293[_0x23a346][_0x6f00('0x27')]){_0x434735[_0x6f00('0x28')](_0x511293[_0x23a346][_0x6f00('0x26')],_0x511293[_0x23a346][_0x6f00('0x27')],_0x511293[_0x23a346][_0x6f00('0x29')]);}}return _0x434735;}function getSquareProject(_0x22f107,_0x3f0b64){rpc[_0x6f00('0x2a')](_0x22f107)[_0x6f00('0x2b')](function(_0x29555d){_0x3f0b64(null,_0x29555d);})[_0x6f00('0x2c')](function(_0x5dde51){_0x3f0b64(null,_0x5dde51);});}function createSquareReport(_0x5775c5,_0x5d16ad){rpc['createSquareReport'](_0x5775c5)['then'](function(_0x4edc83){if(_0x5d16ad){_0x5d16ad(null,_0x4edc83);}})[_0x6f00('0x2c')](function(_0x56338c){if(_0x5d16ad){_0x5d16ad(null,_0x56338c);}});}function setChannelVariables(_0x3c0e5d){for(var _0x192bc1 in _0x3c0e5d){if(_0x3c0e5d[_0x6f00('0x23')](_0x192bc1)){if(_0x192bc1[_0x6f00('0x2d')](_0x6f00('0x2e'))===0x0){_0x3c0e5d[_0x192bc1[_0x6f00('0x2f')](0x4)]=_0x3c0e5d[_0x192bc1];delete _0x3c0e5d[_0x192bc1];}}}}function getLogFromObject(_0x599c67){return util[_0x6f00('0x30')](_0x599c67,{'showHidden':![],'depth':null});}function agiHandler(_0x1c5443){var _0x3cefb8,_0x526aa1,_0x4255e8,_0x4fed1c,_0x52274f;logger['debug'](_0x6f00('0x31'),JSON[_0x6f00('0x32')](_0x1c5443,null,0x2));logger[_0x6f00('0xf')](util[_0x6f00('0x10')](_0x6f00('0x33'),_0x1c5443['arg_1'],_0x1c5443[_0x6f00('0x17')],_0x1c5443[_0x6f00('0x1a')],_0x1c5443[_0x6f00('0x18')],_0x1c5443[_0x6f00('0x1b')]));_0x1c5443['on'](_0x6f00('0xa'),errorHandler);_0x1c5443['on'](_0x6f00('0x34'),closeHandler);_0x1c5443['on'](_0x6f00('0x35'),timeoutHandler);_0x1c5443['evtHangup']=![];_0x1c5443['on'](_0x6f00('0x36'),hangupHandler);var _0x1dee52=getSquareProject[_0x6f00('0x37')](null,_0x1c5443['arg_1']);if(_0x1dee52){if(_0x1dee52[_0x6f00('0x38')]){_0x3cefb8=getRoot(_0x1dee52[_0x6f00('0x38')]);if(_0x3cefb8&&_0x3cefb8[_0x6f00('0x39')]){logger['debug'](_0x6f00('0x1e'),JSON['stringify'](_0x3cefb8,null,0x2));_0x1c5443[_0x6f00('0x3a')]=moment()['format'](_0x6f00('0x3b'));_0x526aa1=initGraph(_[_0x6f00('0x22')](_0x3cefb8,_0x6f00('0x3c')),_0x3cefb8[_0x6f00('0x3c')]);_0x4255e8=new Vertices(_0x1c5443,rpc,mailRpc);logger['info'](util[_0x6f00('0x10')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1c5443[_0x6f00('0x16')],_0x1c5443['calleridname'],_0x1c5443[_0x6f00('0x1a')],_0x1c5443[_0x6f00('0x18')],_0x1c5443[_0x6f00('0x1b')]));_0x526aa1[_0x6f00('0x3d')](_0x3cefb8['start']['id'],function(_0x53dc8c){try{_0x53dc8c=_0x4255e8[_0x6f00('0x3e')](_0x53dc8c);logger['debug'](_0x6f00('0x3f'),JSON[_0x6f00('0x32')](_0x53dc8c,null,0x2));if(_0x53dc8c['agicommand']===_0x6f00('0x40')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x1c5443[_0x6f00('0x41')]=_0x53dc8c[_0x6f00('0x41')]||_0x1c5443[_0x6f00('0x41')];_0x1c5443[_0x6f00('0x42')]=_0x53dc8c['extension'];_0x1c5443[_0x6f00('0x43')]=_0x53dc8c[_0x6f00('0x43')]?_0x53dc8c[_0x6f00('0x43')]-0x1:0x1;return null;}else if(_0x53dc8c&&_0x4255e8[_0x53dc8c[_0x6f00('0x1f')]]){_0x52274f=_0x4255e8[_0x53dc8c[_0x6f00('0x1f')]](_0x53dc8c);logger[_0x6f00('0xf')]('response',JSON[_0x6f00('0x32')](_0x52274f,null,0x2));if(_0x52274f&&_0x52274f[_0x6f00('0x44')]===AGI_CODE_SUCCESS&&_0x52274f[_0x6f00('0x45')]!==AGI_RESULT_ERROR&&!_0x1c5443[_0x6f00('0x46')]){logger[_0x6f00('0x47')](_0x6f00('0x48'),getLogFromObject(_0x52274f));return _['isUndefined'](_0x52274f[_0x6f00('0x45')])?null:_0x52274f[_0x6f00('0x45')][_0x6f00('0x49')]();}else{logger['error'](_0x6f00('0x48'),getLogFromObject(_0x52274f));return null;}}else{logger['error'](_0x6f00('0x4a'));return null;}}catch(_0x346c0c){logger['error'](_0x346c0c[_0x6f00('0xb')]);return null;}});if(_0x3cefb8['finally']){logger[_0x6f00('0xf')](util[_0x6f00('0x10')](_0x6f00('0x4b'),_0x1c5443[_0x6f00('0x16')],_0x1c5443['calleridname'],_0x1c5443[_0x6f00('0x1a')],_0x1c5443['dnid'],_0x1c5443[_0x6f00('0x1b')]));_0x526aa1['traverseBFS'](_0x3cefb8[_0x6f00('0x4c')]['id'],function(_0x22f492){try{_0x22f492=_0x4255e8[_0x6f00('0x3e')](_0x22f492);logger[_0x6f00('0x47')](_0x6f00('0x3f'),JSON[_0x6f00('0x32')](_0x22f492,null,0x2));if(_0x22f492&&_0x4255e8[_0x22f492[_0x6f00('0x1f')]]){_0x52274f=_0x4255e8[_0x22f492[_0x6f00('0x1f')]](_0x22f492);if(_0x52274f){logger['debug'](_0x6f00('0x48'),getLogFromObject(_0x52274f));return _['isUndefined'](_0x52274f[_0x6f00('0x45')])?null:_0x52274f[_0x6f00('0x45')][_0x6f00('0x49')]();}else{logger['error']('response',getLogFromObject(_0x52274f));return null;}}else{logger[_0x6f00('0xa')](_0x6f00('0x4a'));return null;}}catch(_0x494ba5){logger[_0x6f00('0xa')](_0x494ba5['stack']);return null;}});}logger[_0x6f00('0xf')](util['format'](_0x6f00('0x4d'),_0x1c5443[_0x6f00('0x16')],_0x1c5443['calleridname'],_0x1c5443['callerid'],_0x1c5443[_0x6f00('0x18')],_0x1c5443[_0x6f00('0x1b')]));logger['info'](util[_0x6f00('0x10')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x1c5443[_0x6f00('0x41')],_0x1c5443[_0x6f00('0x42')],parseInt(_0x1c5443[_0x6f00('0x43')],0xa)+0x1));_0x1c5443[_0x6f00('0x4e')](_0x1c5443[_0x6f00('0x41')],_0x1c5443[_0x6f00('0x42')],parseInt(_0x1c5443[_0x6f00('0x43')],0xa)+0x1);_0x1c5443[_0x6f00('0x34')]();}}else{logger[_0x6f00('0xa')](util[_0x6f00('0x10')](_0x6f00('0x4f'),_0x1c5443[_0x6f00('0x16')]));_0x1c5443[_0x6f00('0x4e')](_0x1c5443[_0x6f00('0x41')],_0x1c5443[_0x6f00('0x42')],parseInt(_0x1c5443[_0x6f00('0x43')],0xa)+0x1);_0x1c5443[_0x6f00('0x34')]();}}else{logger[_0x6f00('0xa')](util[_0x6f00('0x10')](_0x6f00('0x50'),_0x1c5443['arg_1']));_0x1c5443['continueAt'](_0x1c5443[_0x6f00('0x41')],_0x1c5443['extension'],parseInt(_0x1c5443[_0x6f00('0x43')],0xa)+0x1);_0x1c5443[_0x6f00('0x34')]();}}function main(){var _0x4edd9f;return utilLicense[_0x6f00('0x51')]()[_0x6f00('0x2b')](function(_0x2c87b5){if(_0x2c87b5){if(_0x2c87b5['voice']){if(_0x2c87b5[_0x6f00('0x52')]&&_0x2c87b5['callysquare']>0x0){logger[_0x6f00('0xf')](util[_0x6f00('0x10')]('[LICENSE]\x20CHANNELS:\x20%s',_0x2c87b5[_0x6f00('0x52')]));_0x4edd9f=_0x2c87b5[_0x6f00('0x52')];}else{logger[_0x6f00('0xf')](_0x6f00('0x53'));}}else{logger[_0x6f00('0xf')](_0x6f00('0x54'));_0x4edd9f=-0x1;}}})[_0x6f00('0x2c')](function(_0x4a4905){logger['error']('[LICENSE]',_0x4a4905['stack']);})[_0x6f00('0x4c')](function(){var _0x269753=require('./server')(config['agi'][_0x6f00('0xe')],config[_0x6f00('0x3')]['ip'],_0x4edd9f);_0x269753['on'](_0x6f00('0xa'),errorHandler);_0x269753['on'](_0x6f00('0x55'),listeningHandler);_0x269753['on']('connection',connectionHandler);_0x269753['on'](_0x6f00('0x34'),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 a48f227..2d02003 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 _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x32ead4,_0x928e77){var _0x9ca169=function(_0x5919fd){while(--_0x5919fd){_0x32ead4['push'](_0x32ead4['shift']());}};_0x9ca169(++_0x928e77);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x4a05be,_0x3663a6){var _0x149577=function(_0x4df721){while(--_0x4df721){_0x4a05be['push'](_0x4a05be['shift']());}};_0x149577(++_0x3663a6);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 56fad41..f32a1f4 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 _0x7a54=['substring','length','split','indexOf','slice','trim','emit','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody'];(function(_0x1599aa,_0x2b48b6){var _0x2f2cb3=function(_0x43d0d2){while(--_0x43d0d2){_0x1599aa['push'](_0x1599aa['shift']());}};_0x2f2cb3(++_0x2b48b6);}(_0x7a54,0x106));var _0x47a5=function(_0x30560b,_0x3dd5be){_0x30560b=_0x30560b-0x0;var _0x1115e9=_0x7a54[_0x30560b];return _0x1115e9;};'use strict';var util=require(_0x47a5('0x0'));var Transform=require(_0x47a5('0x1'))[_0x47a5('0x2')];function AGIReply(_0x58157c){Transform[_0x47a5('0x3')](this,_0x58157c);this[_0x47a5('0x4')]='';this['_inBody']=![];}util[_0x47a5('0x5')](AGIReply,Transform);AGIReply[_0x47a5('0x6')][_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){var _0x3d5629='\x0a',_0x59199c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x343372=-0x1,_0x30e405=-0x1,_0x506eda='',_0x194fb0=0x0,_0x5077f3='',_0x5d90b3='';this[_0x47a5('0x4')]+=_0x3717e1[_0x47a5('0x8')]();_0x5077f3=this['_localBuffer'];if(!this[_0x47a5('0x9')]){_0x194fb0=0x0;while(_0x59199c[_0x194fb0]){while((_0x30e405=_0x5077f3['indexOf'](_0x59199c[_0x194fb0]))!=-0x1){_0x506eda=_0x59199c[_0x194fb0];_0x5d90b3=_0x5077f3['substring'](0x0,_0x30e405);_0x5077f3=_0x5077f3[_0x47a5('0xa')](_0x30e405+_0x506eda[_0x47a5('0xb')]);var _0x2f399b=_0x5d90b3[_0x47a5('0xc')](_0x3d5629),_0x250fad=0x0,_0xd612dd={},_0xd308b8='',_0x1eae59='',_0x5beb89=-0x1;while(_0x2f399b[_0x250fad]){_0x5beb89=_0x2f399b[_0x250fad][_0x47a5('0xd')](':');if(_0x5beb89!=-0x1){_0xd308b8=_0x2f399b[_0x250fad][_0x47a5('0xe')](0x0,_0x5beb89)[_0x47a5('0xf')]();_0x1eae59=_0x2f399b[_0x250fad][_0x47a5('0xe')](_0x5beb89+0x1)[_0x47a5('0xf')]();if(_0xd308b8[_0x47a5('0xb')]>0x0){_0xd612dd[_0xd308b8]=_0x1eae59;}}else{}_0x250fad++;}this[_0x47a5('0x10')]('headers',_0xd612dd);this[_0x47a5('0x9')]=!![];}_0x194fb0++;}this[_0x47a5('0x4')]=_0x5077f3;}else{while((_0x343372=_0x5077f3[_0x47a5('0xd')](_0x3d5629))!=-0x1){_0x5d90b3=_0x5077f3[_0x47a5('0xa')](0x0,_0x343372);this[_0x47a5('0x10')]('line',_0x5d90b3);_0x5077f3=_0x5077f3['substring'](_0x343372+_0x3d5629[_0x47a5('0xb')]);}this['_localBuffer']=_0x5077f3;}_0x545a97();};module['exports']=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(_0x38ff1e,_0x3b9385){var _0x3755d4=function(_0x6e6692){while(--_0x6e6692){_0x38ff1e['push'](_0x38ff1e['shift']());}};_0x3755d4(++_0x3b9385);}(_0x5f2f,0x73));var _0xf5f2=function(_0x588e20,_0x4dbe2a){_0x588e20=_0x588e20-0x0;var _0x31d4f4=_0x5f2f[_0x588e20];return _0x31d4f4;};'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 10074d2..c5bbc78 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 _0xabfc=['dsn','getUserById','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','jayson/promise','client','http','then','error','catch','getSquareProject','ShowSquareProject','production','MailServerOut','Smtp','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc'];(function(_0x21b05a,_0x172bda){var _0x1f3e32=function(_0x935747){while(--_0x935747){_0x21b05a['push'](_0x21b05a['shift']());}};_0x1f3e32(++_0x172bda);}(_0xabfc,0x137));var _0xcabf=function(_0x40927b,_0xf9b0a0){_0x40927b=_0x40927b-0x0;var _0x2635e8=_0xabfc[_0x40927b];return _0x2635e8;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0xcabf('0x0'));var util=require('util');var jayson=require(_0xcabf('0x1'));var client=jayson[_0xcabf('0x2')][_0xcabf('0x3')]({'port':0x2329});function request(_0x1e281c,_0x330efb){return new BPromise(function(_0x383217,_0x269133){return client['request'](_0x1e281c,_0x330efb)[_0xcabf('0x4')](function(_0x27c5b8){if(_0x27c5b8['error']){return _0x269133(_0x27c5b8[_0xcabf('0x5')]['message']);}else{return _0x383217(_0x27c5b8['result']);}})[_0xcabf('0x6')](function(_0x5ada19){return _0x269133(_0x5ada19);});});}exports[_0xcabf('0x7')]=function(_0x20470b){return request(_0xcabf('0x8'),{'options':{'raw':![],'where':{'name':_0x20470b},'attributes':[_0xcabf('0x9')]}});};exports['getMailAccountById']=function(_0x1fdbc9){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x1fdbc9},'include':[{'model':_0xcabf('0xa'),'as':_0xcabf('0xb')}],'attributes':['id',_0xcabf('0xc'),'email']}});};exports['getSquareProjectById']=function(_0x413173){return request(_0xcabf('0x8'),{'options':{'where':{'id':_0x413173},'attributes':['name']}});};exports[_0xcabf('0xd')]=function(_0x458ba2){return request(_0xcabf('0xe'),{'options':{'where':{'id':_0x458ba2},'attributes':[_0xcabf('0xc')]}});};exports[_0xcabf('0xf')]=function(_0x328e4f){return request(_0xcabf('0x10'),{'options':{'where':{'id':_0x328e4f},'attributes':[_0xcabf('0xc')]}});};exports[_0xcabf('0x11')]=function(_0x346342){return request(_0xcabf('0x12'),{'options':{'where':{'id':_0x346342},'attributes':[_0xcabf('0x13')]}});};exports[_0xcabf('0x14')]=function(_0x4f9850){return request('ShowUser',{'options':{'where':{'id':_0x4f9850},'attributes':[_0xcabf('0xc')]}});};exports[_0xcabf('0x15')]=function(_0x588af7){return request(_0xcabf('0x16'),{'options':{'where':{'id':_0x588af7},'attributes':[_0xcabf('0xc')]}});};exports[_0xcabf('0x17')]=function(_0x3bd3a4){return request('ShowSound',{'options':{'where':{'id':_0x3bd3a4},'attributes':[_0xcabf('0x18')]}});};exports[_0xcabf('0x19')]=function(_0x59fa5a){return request(_0xcabf('0x1a'),{'options':{'raw':![],'where':{'id':_0x59fa5a},'include':[{'model':_0xcabf('0x1b'),'as':_0xcabf('0x1c')}]}});};exports[_0xcabf('0x1d')]=function(_0x2f06cc){return request('ShowSmsAccount',{'options':{'where':{'id':_0x2f06cc},'attributes':['id',_0xcabf('0xc')]}});};exports[_0xcabf('0x1e')]=function(_0x430777){return request(_0xcabf('0x1f'),{'body':_0x430777});};exports[_0xcabf('0x20')]=function(_0x3057cc){return request(_0xcabf('0x21'),{'body':_0x3057cc});};exports[_0xcabf('0x22')]=function(_0x395d99){return request('CreateSquareReport',{'body':_[_0xcabf('0x23')](_0x395d99,{'project_name':_0x395d99[_0xcabf('0x24')],'prev_project_name':_0x395d99[_0xcabf('0x25')]||'','is_subproject':_0x395d99['arg_2']?!![]:![],'leaveAt':moment()[_0xcabf('0x26')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xcabf('0x27')]=function(_0x5cd137){return request(_0xcabf('0x28'),{'body':_0x5cd137});};exports[_0xcabf('0x29')]=function(_0x2e7719){return request(_0xcabf('0x2a'),{'body':_0x2e7719});};exports[_0xcabf('0x2b')]=function(_0x2f3688){return request(_0xcabf('0x2c'),{'options':{'raw':![],'where':{'phone':_0x2f3688[_0xcabf('0x2d')],'ListId':_0x2f3688[_0xcabf('0x2e')]}}})['then'](function(_0x70a714){if(_0x70a714){return _0x70a714;}return request(_0xcabf('0x2f'),{'body':_0x2f3688});});};exports[_0xcabf('0x30')]=function(_0x5475f4){return request('ShowPause',{'options':{'where':{'id':_0x5475f4},'attributes':[_0xcabf('0xc')]}});};exports['agentLogin']=function(_0x22cb95,_0x34d36c){return request(_0xcabf('0x31'),{'body':{'interface':_0x34d36c},'options':{'where':_0x22cb95}});};exports['agentPause']=function(_0x4cf7ba,_0x351402,_0x24952e){return request(_0xcabf('0x32'),{'body':{'type':_0x351402,'uniqueid':_0x24952e},'options':{'where':_0x4cf7ba}});};exports[_0xcabf('0x33')]=function(_0x30a040){return request(_0xcabf('0x34'),{'body':{},'options':{'where':_0x30a040}});};exports[_0xcabf('0x35')]=function(_0x5e6e44){return request(_0xcabf('0x36'),{'body':{},'options':{'where':_0x5e6e44}});}; \ No newline at end of file +var _0x6333=['jayson/promise','client','http','request','then','error','result','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp','email','getSquareProjectById','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','ShowTrunk','getSoundById','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','LoginUser','agentPause','agentUnpause','agentLogout','LogoutUser','bluebird','moment','lodash'];(function(_0x3aaa14,_0x421b08){var _0x4fb50c=function(_0x40e940){while(--_0x40e940){_0x3aaa14['push'](_0x3aaa14['shift']());}};_0x4fb50c(++_0x421b08);}(_0x6333,0x185));var _0x3633=function(_0x8e957a,_0x4223fa){_0x8e957a=_0x8e957a-0x0;var _0x4cc7b8=_0x6333[_0x8e957a];return _0x4cc7b8;};'use strict';var BPromise=require(_0x3633('0x0'));var moment=require(_0x3633('0x1'));var _=require(_0x3633('0x2'));var util=require('util');var jayson=require(_0x3633('0x3'));var client=jayson[_0x3633('0x4')][_0x3633('0x5')]({'port':0x2329});function request(_0x20497b,_0x36ece7){return new BPromise(function(_0xeb7d6c,_0x29a5b7){return client[_0x3633('0x6')](_0x20497b,_0x36ece7)[_0x3633('0x7')](function(_0x5a8701){if(_0x5a8701[_0x3633('0x8')]){return _0x29a5b7(_0x5a8701[_0x3633('0x8')]['message']);}else{return _0xeb7d6c(_0x5a8701[_0x3633('0x9')]);}})['catch'](function(_0x2ab6ba){return _0x29a5b7(_0x2ab6ba);});});}exports[_0x3633('0xa')]=function(_0x8d30a4){return request(_0x3633('0xb'),{'options':{'raw':![],'where':{'name':_0x8d30a4},'attributes':['production']}});};exports[_0x3633('0xc')]=function(_0x2e325d){return request(_0x3633('0xd'),{'options':{'raw':![],'where':{'id':_0x2e325d},'include':[{'model':'MailServerOut','as':_0x3633('0xe')}],'attributes':['id','name',_0x3633('0xf')]}});};exports[_0x3633('0x10')]=function(_0x4a92fa){return request(_0x3633('0xb'),{'options':{'where':{'id':_0x4a92fa},'attributes':[_0x3633('0x11')]}});};exports[_0x3633('0x12')]=function(_0x1667de){return request(_0x3633('0x13'),{'options':{'where':{'id':_0x1667de},'attributes':[_0x3633('0x11')]}});};exports[_0x3633('0x14')]=function(_0x2752d1){return request(_0x3633('0x15'),{'options':{'where':{'id':_0x2752d1},'attributes':[_0x3633('0x11')]}});};exports[_0x3633('0x16')]=function(_0x266afc){return request(_0x3633('0x17'),{'options':{'where':{'id':_0x266afc},'attributes':[_0x3633('0x18')]}});};exports[_0x3633('0x19')]=function(_0x1f04b2){return request(_0x3633('0x1a'),{'options':{'where':{'id':_0x1f04b2},'attributes':[_0x3633('0x11')]}});};exports['getTrunkById']=function(_0x36f6a4){return request(_0x3633('0x1b'),{'options':{'where':{'id':_0x36f6a4},'attributes':[_0x3633('0x11')]}});};exports[_0x3633('0x1c')]=function(_0x28478c){return request('ShowSound',{'options':{'where':{'id':_0x28478c},'attributes':['save_name']}});};exports[_0x3633('0x1d')]=function(_0x1edc90){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x1edc90},'include':[{'model':_0x3633('0x1e'),'as':_0x3633('0x1f')}]}});};exports[_0x3633('0x20')]=function(_0x12a734){return request(_0x3633('0x21'),{'options':{'where':{'id':_0x12a734},'attributes':['id',_0x3633('0x11')]}});};exports['createSmsMessage']=function(_0x5c63d2){return request('CreateSmsMessage',{'body':_0x5c63d2});};exports[_0x3633('0x22')]=function(_0x596407){return request('CreateSquareDetailsReport',{'body':_0x596407});};exports[_0x3633('0x23')]=function(_0x48b2e0){return request(_0x3633('0x24'),{'body':_[_0x3633('0x25')](_0x48b2e0,{'project_name':_0x48b2e0['arg_1'],'prev_project_name':_0x48b2e0['arg_2']||'','is_subproject':_0x48b2e0[_0x3633('0x26')]?!![]:![],'leaveAt':moment()[_0x3633('0x27')](_0x3633('0x28'))})});};exports[_0x3633('0x29')]=function(_0x781887){return request('CreateSquareRecording',{'body':_0x781887});};exports[_0x3633('0x2a')]=function(_0x2cac48){return request(_0x3633('0x2b'),{'body':_0x2cac48});};exports[_0x3633('0x2c')]=function(_0x483533){return request(_0x3633('0x2d'),{'options':{'raw':![],'where':{'phone':_0x483533[_0x3633('0x2e')],'ListId':_0x483533[_0x3633('0x2f')]}}})[_0x3633('0x7')](function(_0x4ad8b7){if(_0x4ad8b7){return _0x4ad8b7;}return request(_0x3633('0x30'),{'body':_0x483533});});};exports[_0x3633('0x31')]=function(_0x42345e){return request(_0x3633('0x32'),{'options':{'where':{'id':_0x42345e},'attributes':[_0x3633('0x11')]}});};exports['agentLogin']=function(_0x19f1ae,_0x28654c){return request(_0x3633('0x33'),{'body':{'interface':_0x28654c},'options':{'where':_0x19f1ae}});};exports[_0x3633('0x34')]=function(_0x5d4e4a,_0x4ed8de,_0x711e1b){return request('PauseUser',{'body':{'type':_0x4ed8de,'uniqueid':_0x711e1b},'options':{'where':_0x5d4e4a}});};exports[_0x3633('0x35')]=function(_0x5548ae){return request('UnpauseUser',{'body':{},'options':{'where':_0x5548ae}});};exports[_0x3633('0x36')]=function(_0x2bd348){return request(_0x3633('0x37'),{'body':{},'options':{'where':_0x2bd348}});}; \ 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 681f0e8..b4a66ea 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 _0x6f1b=['./polly','exports'];(function(_0x44cb8b,_0x3fe293){var _0x2ac8d3=function(_0x217082){while(--_0x217082){_0x44cb8b['push'](_0x44cb8b['shift']());}};_0x2ac8d3(++_0x3fe293);}(_0x6f1b,0x96));var _0xb6f1=function(_0x98e00d,_0x1f6bbd){_0x98e00d=_0x98e00d-0x0;var _0x5b2a79=_0x6f1b[_0x98e00d];return _0x5b2a79;};var polly=require(_0xb6f1('0x0'));var lex=require('./lex');module[_0xb6f1('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x9418=['./lex','exports','./polly'];(function(_0x1cddb4,_0x3200a8){var _0xc78900=function(_0x3090fd){while(--_0x3090fd){_0x1cddb4['push'](_0x1cddb4['shift']());}};_0xc78900(++_0x3200a8);}(_0x9418,0x116));var _0x8941=function(_0x3074f3,_0x4f2c03){_0x3074f3=_0x3074f3-0x0;var _0x53f112=_0x9418[_0x3074f3];return _0x53f112;};var polly=require(_0x8941('0x0'));var lex=require(_0x8941('0x1'));module[_0x8941('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index ec0a1d2..b8cdaa0 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad95=['./lib/api','exports'];(function(_0x31236c,_0x34f702){var _0x12eb2f=function(_0x6bb9a){while(--_0x6bb9a){_0x31236c['push'](_0x31236c['shift']());}};_0x12eb2f(++_0x34f702);}(_0xad95,0x70));var _0x5ad9=function(_0x6a709a,_0xb95654){_0x6a709a=_0x6a709a-0x0;var _0x52b903=_0xad95[_0x6a709a];return _0x52b903;};'use strict';var lex=require(_0x5ad9('0x0'));module[_0x5ad9('0x1')]=function(_0x1fe578,_0x51c14c,_0x52ad89,_0x409d5b,_0x235c61,_0x59809d){return lex(_0x1fe578,_0x51c14c,_0x52ad89,_0x409d5b,_0x235c61,_0x59809d);}; \ No newline at end of file +var _0x98d3=['exports','./lib/api'];(function(_0x164e7e,_0x4e442a){var _0x11ce15=function(_0x348810){while(--_0x348810){_0x164e7e['push'](_0x164e7e['shift']());}};_0x11ce15(++_0x4e442a);}(_0x98d3,0x173));var _0x398d=function(_0x15ef87,_0x15e2e7){_0x15ef87=_0x15ef87-0x0;var _0x1df367=_0x98d3[_0x15ef87];return _0x1df367;};'use strict';var lex=require(_0x398d('0x0'));module[_0x398d('0x1')]=function(_0x58c1f9,_0x35bbe1,_0x4f5ff0,_0x18da44,_0x48fcf0,_0x465d4a){return lex(_0x58c1f9,_0x35bbe1,_0x4f5ff0,_0x18da44,_0x48fcf0,_0x465d4a);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 363a4e6..86d2452 100644 --- a/server/services/agi/scripts/aws/lex/lib/api.js +++ b/server/services/agi/scripts/aws/lex/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x23e9=['hasOwnProperty','slot_','LexRuntime','$LATEST','bluebird','aws-sdk','postText','slots'];(function(_0x3a081b,_0x516437){var _0xb166c4=function(_0x22bc5d){while(--_0x22bc5d){_0x3a081b['push'](_0x3a081b['shift']());}};_0xb166c4(++_0x516437);}(_0x23e9,0x14c));var _0x923e=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x23e9[_0x160c73];return _0xd9302;};'use strict';var BPromise=require(_0x923e('0x0'));var AWS=require(_0x923e('0x1'));function lexResult(_0x5f173c,_0x2ba620){return new BPromise(function(_0x4c1bc4,_0x1160a2){_0x5f173c[_0x923e('0x2')](_0x2ba620,function(_0x34b169,_0x34fb98){if(_0x34b169){_0x1160a2(_0x34b169);}if(_0x34fb98[_0x923e('0x3')]){for(const _0x1ab91c in _0x34fb98[_0x923e('0x3')]){if(_0x34fb98[_0x923e('0x3')][_0x923e('0x4')](_0x1ab91c)){var _0x4191eb=_0x34fb98[_0x923e('0x3')][_0x1ab91c];_0x34fb98[_0x923e('0x5')+_0x1ab91c]=_0x4191eb;}}}_0x4c1bc4(_0x34fb98);});});}module['exports']=function(_0x4e6055,_0x469a9,_0x3e7cc3,_0x32880b,_0x166a72,_0x3ae333){var _0x190ea6=new AWS[(_0x923e('0x6'))]({'accessKeyId':_0x469a9,'secretAccessKey':_0x3e7cc3,'region':_0x32880b});var _0x3fd438={'botAlias':_0x923e('0x7'),'botName':_0x3ae333,'inputText':_0x166a72,'userId':_0x4e6055};return lexResult(_0x190ea6,_0x3fd438);}; \ No newline at end of file +var _0x1023=['slots','hasOwnProperty','exports','LexRuntime','$LATEST','aws-sdk'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x1023,0x11f));var _0x3102=function(_0x28ba53,_0x33f25c){_0x28ba53=_0x28ba53-0x0;var _0x540128=_0x1023[_0x28ba53];return _0x540128;};'use strict';var BPromise=require('bluebird');var AWS=require(_0x3102('0x0'));function lexResult(_0x5353ae,_0x42656c){return new BPromise(function(_0xa844ef,_0x1da582){_0x5353ae['postText'](_0x42656c,function(_0x41130a,_0x333f0f){if(_0x41130a){_0x1da582(_0x41130a);}if(_0x333f0f[_0x3102('0x1')]){for(const _0x5ebec7 in _0x333f0f[_0x3102('0x1')]){if(_0x333f0f[_0x3102('0x1')][_0x3102('0x2')](_0x5ebec7)){var _0x44c1a8=_0x333f0f[_0x3102('0x1')][_0x5ebec7];_0x333f0f['slot_'+_0x5ebec7]=_0x44c1a8;}}}_0xa844ef(_0x333f0f);});});}module[_0x3102('0x3')]=function(_0x55c096,_0xefc134,_0xf14448,_0x26da15,_0x50d2f8,_0x3ae93b){var _0x3a76b4=new AWS[(_0x3102('0x4'))]({'accessKeyId':_0xefc134,'secretAccessKey':_0xf14448,'region':_0x26da15});var _0x10d393={'botAlias':_0x3102('0x5'),'botName':_0x3ae93b,'inputText':_0x50d2f8,'userId':_0x55c096};return lexResult(_0x3a76b4,_0x10d393);}; \ 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 7923ebe..ba3906e 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 _0x90c8=['exports','./lib/api'];(function(_0x552144,_0x2742a0){var _0x412488=function(_0xb384ed){while(--_0xb384ed){_0x552144['push'](_0x552144['shift']());}};_0x412488(++_0x2742a0);}(_0x90c8,0xdb));var _0x890c=function(_0x4bb145,_0x3e7d33){_0x4bb145=_0x4bb145-0x0;var _0x4db596=_0x90c8[_0x4bb145];return _0x4db596;};'use strict';var polly=require(_0x890c('0x0'));module[_0x890c('0x1')]=function(_0x433da5,_0xd5bce3,_0x504c21,_0x27f257,_0x45ae07,_0x5cd0c2,_0x239f98){return polly(_0x433da5,_0xd5bce3,_0x504c21,_0x27f257,_0x45ae07,_0x5cd0c2,_0x239f98);}; \ No newline at end of file +var _0x4d7e=['exports','./lib/api'];(function(_0x42e465,_0x31344d){var _0x5ce301=function(_0x2fe75b){while(--_0x2fe75b){_0x42e465['push'](_0x42e465['shift']());}};_0x5ce301(++_0x31344d);}(_0x4d7e,0xf9));var _0xe4d7=function(_0x3be658,_0x5b5905){_0x3be658=_0x3be658-0x0;var _0x8382ed=_0x4d7e[_0x3be658];return _0x8382ed;};'use strict';var polly=require(_0xe4d7('0x0'));module[_0xe4d7('0x1')]=function(_0x101897,_0x5bc678,_0x2c8368,_0x3ff9db,_0x1710ce,_0x1781d0,_0x129450){return polly(_0x101897,_0x5bc678,_0x2c8368,_0x3ff9db,_0x1710ce,_0x1781d0,_0x129450);}; \ 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 a4c3d98..584804c 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 _0x4dc9=['text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x15e6fe,_0x1a5c39){var _0x34894d=function(_0x32eec2){while(--_0x32eec2){_0x15e6fe['push'](_0x15e6fe['shift']());}};_0x34894d(++_0x1a5c39);}(_0x4dc9,0x124));var _0x94dc=function(_0xbe188a,_0x58ee76){_0xbe188a=_0xbe188a-0x0;var _0x23263e=_0x4dc9[_0xbe188a];return _0x23263e;};'use strict';var fs=require('fs');var path=require(_0x94dc('0x0'));var BPromise=require(_0x94dc('0x1'));var rs=require(_0x94dc('0x2'));var AWS=require(_0x94dc('0x3'));function pollyResult(_0x341fbe,_0xd89819,_0x35011e){return new BPromise(function(_0x4fb381,_0x12845f){_0x341fbe[_0x94dc('0x4')](_0xd89819,function(_0x4b7a19,_0x36492c){if(_0x4b7a19){_0x12845f(_0x4b7a19);}else if(_0x36492c){if(_0x36492c[_0x94dc('0x5')]instanceof Buffer){fs[_0x94dc('0x6')](_0x35011e,_0x36492c['AudioStream'],function(_0x465275){if(_0x465275){_0x12845f(_0x465275);}else{_0x4fb381();}});}else{_0x12845f(new Error(_0x94dc('0x7')));}}else{_0x12845f(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x222d89,_0x4152f6,_0x219554,_0x2bc390,_0x2da0ce,_0x40ea98,_0x4e5d8f){var _0x2a3ffa=new AWS['Polly']({'accessKeyId':_0x222d89,'secretAccessKey':_0x4152f6,'region':_0x219554});var _0x4f5ace={'Text':_0x2da0ce,'TextType':_0x40ea98||_0x94dc('0x8'),'OutputFormat':_0x94dc('0x9'),'VoiceId':_0x2bc390};return pollyResult(_0x2a3ffa,_0x4f5ace,_0x4e5d8f);}; \ No newline at end of file +var _0x4a8e=['aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path','bluebird'];(function(_0x875d66,_0x109b24){var _0x5b9be2=function(_0x5b83db){while(--_0x5b83db){_0x875d66['push'](_0x875d66['shift']());}};_0x5b9be2(++_0x109b24);}(_0x4a8e,0xfb));var _0xe4a8=function(_0x10784b,_0x59bd34){_0x10784b=_0x10784b-0x0;var _0x3123b4=_0x4a8e[_0x10784b];return _0x3123b4;};'use strict';var fs=require('fs');var path=require(_0xe4a8('0x0'));var BPromise=require(_0xe4a8('0x1'));var rs=require('randomstring');var AWS=require(_0xe4a8('0x2'));function pollyResult(_0x25c9a4,_0x256140,_0x443cce){return new BPromise(function(_0x3818f7,_0x499d38){_0x25c9a4[_0xe4a8('0x3')](_0x256140,function(_0x1a8bd0,_0x186aae){if(_0x1a8bd0){_0x499d38(_0x1a8bd0);}else if(_0x186aae){if(_0x186aae[_0xe4a8('0x4')]instanceof Buffer){fs[_0xe4a8('0x5')](_0x443cce,_0x186aae[_0xe4a8('0x4')],function(_0x4229b1){if(_0x4229b1){_0x499d38(_0x4229b1);}else{_0x3818f7();}});}else{_0x499d38(new Error(_0xe4a8('0x6')));}}else{_0x499d38(new Error(_0xe4a8('0x7')));}});});}module[_0xe4a8('0x8')]=function(_0x69f69e,_0x45900f,_0x1268a3,_0x1fdb85,_0x4c7ece,_0x521b64,_0x5be298){var _0xa92c70=new AWS[(_0xe4a8('0x9'))]({'accessKeyId':_0x69f69e,'secretAccessKey':_0x45900f,'region':_0x1268a3});var _0x3991ee={'Text':_0x4c7ece,'TextType':_0x521b64||'text','OutputFormat':_0xe4a8('0xa'),'VoiceId':_0x1fdb85};return pollyResult(_0xa92c70,_0x3991ee,_0x5be298);}; \ 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 4fa0c9a..0ce9031 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 _0x1e9c=['exports','./lib/api'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x1e9c,0x1d9));var _0xc1e9=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x1e9c[_0x2be8c2];return _0x97f531;};'use strict';var asr=require(_0xc1e9('0x0'));module[_0xc1e9('0x1')]=function(_0xb60249,_0x3aab0c,_0x2a698f,_0x47bed6){return asr(_0xb60249,_0x3aab0c,_0x2a698f);}; \ No newline at end of file +var _0x1707=['./lib/api'];(function(_0x3955bf,_0x2085ef){var _0x176c3b=function(_0x1a5c81){while(--_0x1a5c81){_0x3955bf['push'](_0x3955bf['shift']());}};_0x176c3b(++_0x2085ef);}(_0x1707,0x1df));var _0x7170=function(_0x4de333,_0x2a9110){_0x4de333=_0x4de333-0x0;var _0x340fb6=_0x1707[_0x4de333];return _0x340fb6;};'use strict';var asr=require(_0x7170('0x0'));module['exports']=function(_0x4db1df,_0x527d00,_0x25eb89,_0x10ac7c){return asr(_0x4db1df,_0x527d00,_0x25eb89);}; \ 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 e920fff..a29a72a 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 _0x0aa6=['base64','/v1/speech:recognize?key=','8000','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString'];(function(_0x13150b,_0x3358){var _0x5b4dcb=function(_0x21878f){while(--_0x21878f){_0x13150b['push'](_0x13150b['shift']());}};_0x5b4dcb(++_0x3358);}(_0x0aa6,0x17d));var _0x60aa=function(_0x5372fe,_0x15a0b9){_0x5372fe=_0x5372fe-0x0;var _0x21c49c=_0x0aa6[_0x5372fe];return _0x21c49c;};'use strict';var url=require('url');var BPromise=require(_0x60aa('0x0'));var fs=require('fs');var host=_0x60aa('0x1');module[_0x60aa('0x2')]=function(_0x1ba2e3,_0x287534,_0x2ce21e){return new BPromise(function(_0xbda43a,_0x3dc7a6){var _0x235937;if(typeof _0x1ba2e3!==_0x60aa('0x3')||_0x1ba2e3[_0x60aa('0x4')]===0x0){return _0x3dc7a6(_0x60aa('0x5'));}if(typeof _0x287534!==_0x60aa('0x3')||_0x287534[_0x60aa('0x4')]===0x0){return _0x3dc7a6(_0x60aa('0x6'));}if(typeof _0x2ce21e!==_0x60aa('0x7')&&(typeof _0x2ce21e!=='string'||_0x2ce21e['length']===0x0)){return _0x3dc7a6(_0x60aa('0x8'));}try{_0x235937=fs[_0x60aa('0x9')](_0x1ba2e3)[_0x60aa('0xa')](_0x60aa('0xb'));}catch(_0xb1ec0c){return _0x3dc7a6(_0xb1ec0c);}return _0xbda43a({'method':'POST','uri':host+_0x60aa('0xc')+_0x287534,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x60aa('0xd'),'languageCode':_0x2ce21e},'audio':{'content':_0x235937}},'json':!![]});});}; \ No newline at end of file +var _0xbed8=['8000','url','bluebird','https://speech.googleapis.com','exports','string','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','undefined','base64','POST','/v1/speech:recognize?key=','LINEAR16'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xbed8,0x16d));var _0x8bed=function(_0x18b73e,_0x39b3f2){_0x18b73e=_0x18b73e-0x0;var _0x25fa91=_0xbed8[_0x18b73e];return _0x25fa91;};'use strict';var url=require(_0x8bed('0x0'));var BPromise=require(_0x8bed('0x1'));var fs=require('fs');var host=_0x8bed('0x2');module[_0x8bed('0x3')]=function(_0x8f5ea5,_0x308197,_0x3169e0){return new BPromise(function(_0x14b9f2,_0xa0a55d){var _0x5ac277;if(typeof _0x8f5ea5!==_0x8bed('0x4')||_0x8f5ea5['length']===0x0){return _0xa0a55d(_0x8bed('0x5'));}if(typeof _0x308197!==_0x8bed('0x4')||_0x308197[_0x8bed('0x6')]===0x0){return _0xa0a55d(_0x8bed('0x7'));}if(typeof _0x3169e0!==_0x8bed('0x8')&&(typeof _0x3169e0!==_0x8bed('0x4')||_0x3169e0[_0x8bed('0x6')]===0x0)){return _0xa0a55d('lang\x20should\x20be\x20a\x20string');}try{_0x5ac277=fs['readFileSync'](_0x8f5ea5)['toString'](_0x8bed('0x9'));}catch(_0x5aae1b){return _0xa0a55d(_0x5aae1b);}return _0x14b9f2({'method':_0x8bed('0xa'),'uri':host+_0x8bed('0xb')+_0x308197,'body':{'config':{'encoding':_0x8bed('0xc'),'sampleRateHertz':_0x8bed('0xd'),'languageCode':_0x3169e0},'audio':{'content':_0x5ac277}},'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 847fc53..93ea82f 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 _0x34e8=['./asr','exports'];(function(_0x36bff5,_0x3156cb){var _0x80ade5=function(_0x5eee65){while(--_0x5eee65){_0x36bff5['push'](_0x36bff5['shift']());}};_0x80ade5(++_0x3156cb);}(_0x34e8,0x12c));var _0x834e=function(_0x40dc52,_0x3be558){_0x40dc52=_0x40dc52-0x0;var _0x32a69c=_0x34e8[_0x40dc52];return _0x32a69c;};var asr=require(_0x834e('0x0'));module[_0x834e('0x1')]={'asr':asr}; \ No newline at end of file +var _0xa9e0=['exports','./asr'];(function(_0x1a3232,_0x2755dc){var _0xf98c6=function(_0x415587){while(--_0x415587){_0x1a3232['push'](_0x1a3232['shift']());}};_0xf98c6(++_0x2755dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};var asr=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 310827b..8b2c6c2 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 _0xa9e0=['text','channelData','CustomAction','AudioFromTts','Data','dirName','path','http','https','bluebird','sox','request-promise','util','querystring','moment','apiai-promise','md5','./google','./sestek','https://api.ispeech.org/api/rest','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','error','unlink','download\x20error','pipe','end','protocol','https:','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','base64','then','chmodSync','777','split','readFileSync','googleTTS','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','format','freeform=3','parse','sestekNDA','nda'];(function(_0x4343f3,_0x9d0b59){var _0xf0d8c9=function(_0x294cd7){while(--_0x294cd7){_0x4343f3['push'](_0x4343f3['shift']());}};_0xf0d8c9(++_0x9d0b59);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var fs=require('fs');var path=require(_0x0a9e('0x0'));var http=require(_0x0a9e('0x1'));var https=require(_0x0a9e('0x2'));var urlParse=require('url')['parse'];var BPromise=require(_0x0a9e('0x3'));var rs=require('randomstring');var sox=require(_0x0a9e('0x4'));var rp=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var querystring=require(_0x0a9e('0x7'));var moment=require(_0x0a9e('0x8'));var tts=require('google-tts-api');var apiai=require(_0x0a9e('0x9'));var md5=require(_0x0a9e('0xa'));var google=require(_0x0a9e('0xb'));var aws=require('./aws');var tilde=require('./tilde');var sestek=require(_0x0a9e('0xc'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0x0a9e('0xd');function downloadFile(_0xf81284,_0x307b3e){return new BPromise(function(_0x3ab53f,_0xfeb75b){var _0xbd1168=urlParse(_0xf81284);var _0x4a4c56=_0xbd1168['protocol']==='https:'?https:http;var _0x4cfe67={'host':_0xbd1168[_0x0a9e('0xe')],'path':_0xbd1168[_0x0a9e('0x0')],'headers':{'user-agent':_0x0a9e('0xf')}};_0x4a4c56[_0x0a9e('0x10')](_0x4cfe67,function(_0x32d742){if(_0x32d742[_0x0a9e('0x11')]!==0xc8){logger['error'](_0x0a9e('0x12')+_0xf81284+_0x0a9e('0x13')+_0x32d742[_0x0a9e('0x11')]+'\x20('+_0x32d742[_0x0a9e('0x14')]+')');_0xfeb75b(new Error(_0x0a9e('0x12')+_0xf81284+_0x0a9e('0x13')+_0x32d742['statusCode']+'\x20('+_0x32d742[_0x0a9e('0x14')]+')'));return;}var _0x5d0880=fs[_0x0a9e('0x15')](_0x307b3e);_0x5d0880['on']('finish',function(){logger[_0x0a9e('0x16')](_0x0a9e('0x17'));_0x5d0880['close'](_0x3ab53f);});_0x5d0880['on'](_0x0a9e('0x18'),function(_0x5a0a06){fs[_0x0a9e('0x19')](_0x307b3e);logger[_0x0a9e('0x18')](_0x0a9e('0x1a'),_0x5a0a06);_0xfeb75b(_0x5a0a06);});_0x32d742[_0x0a9e('0x1b')](_0x5d0880);})['on'](_0x0a9e('0x18'),function(_0x2eb11f){logger[_0x0a9e('0x18')](_0x2eb11f);_0xfeb75b(_0x2eb11f);})[_0x0a9e('0x1c')]();});}function uploadFile(_0x1314ae){return new BPromise(function(_0x112016,_0x1c696a){var _0x105080=urlParse(_0x1314ae);var _0x4bb1e3=_0x105080[_0x0a9e('0x1d')]===_0x0a9e('0x1e')?https:http;var _0x53682f={'host':_0x105080[_0x0a9e('0xe')],'path':_0x105080['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x4bb1e3[_0x0a9e('0x10')](_0x53682f,function(_0x432e56){if(_0x432e56[_0x0a9e('0x11')]!==0xc8){_0x1c696a(new Error(_0x0a9e('0x12')+_0x1314ae+'\x20failed,\x20status\x20code\x20=\x20'+_0x432e56[_0x0a9e('0x11')]+'\x20('+_0x432e56[_0x0a9e('0x14')]+')'));return;}var _0x3b45bc='';_0x432e56['on'](_0x0a9e('0x1f'),function(_0x370d86){_0x3b45bc+=_0x370d86;});_0x432e56['on'](_0x0a9e('0x1c'),function(){_0x112016(_0x3b45bc);});})['on'](_0x0a9e('0x18'),function(_0x5ea472){_0x1c696a(_0x5ea472);})['end']();});}function convertFile(_0x197ec0,_0x3a8e58){return new BPromise(function(_0x40c424,_0x33161b){var _0x526cf3=sox[_0x0a9e('0x20')](_0x197ec0,_0x3a8e58,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x526cf3['on'](_0x0a9e('0x18'),function(_0x5bfb33){logger[_0x0a9e('0x18')](_0x0a9e('0x21'),_0x5bfb33);_0x33161b(_0x5bfb33);});_0x526cf3['on'](_0x0a9e('0x1c'),function(){logger[_0x0a9e('0x16')](_0x0a9e('0x22'));_0x40c424();});_0x526cf3[_0x0a9e('0x23')]();});}function base64Decode(_0x11c3b6,_0x14de77){var _0x5a101a=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x27'));fs['writeFileSync'](_0x5a101a,_0x11c3b6,_0x0a9e('0x28'));return convertFile(_0x5a101a,_0x14de77)[_0x0a9e('0x29')](function(){try{fs[_0x0a9e('0x19')](_0x5a101a);fs[_0x0a9e('0x2a')](_0x14de77,_0x0a9e('0x2b'));}catch(_0x563b45){logger[_0x0a9e('0x18')](_0x563b45);}return _0x14de77[_0x0a9e('0x2c')]('.')[0x0];});}function base64Encode(_0x1dbde2){var _0x540530=fs[_0x0a9e('0x2d')](_0x1dbde2);return new Buffer(_0x540530)['toString'](_0x0a9e('0x28'));}exports[_0x0a9e('0x2e')]=function(_0x1122db,_0x33bdb7){var _0x25ce3a,_0x5180f1;return tts(_0x1122db,_0x33bdb7||'en',0x1)[_0x0a9e('0x29')](function(_0x46f0a5){logger[_0x0a9e('0x16')](_0x46f0a5);_0x25ce3a=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x2f'));return downloadFile(_0x46f0a5,_0x25ce3a);})[_0x0a9e('0x29')](function(){_0x5180f1=path['resolve'](__dirname,_0x0a9e('0x25'),rs['generate'](0x4)+_0x0a9e('0x27'));return convertFile(_0x25ce3a,_0x5180f1);})[_0x0a9e('0x29')](function(){try{fs[_0x0a9e('0x19')](_0x25ce3a);fs[_0x0a9e('0x2a')](_0x5180f1,'777');}catch(_0x191e91){logger[_0x0a9e('0x18')](_0x191e91);}logger[_0x0a9e('0x16')](_0x0a9e('0x30'),_0x5180f1['split']('.')[0x0]);return _0x5180f1['split']('.')[0x0];});};exports[_0x0a9e('0x31')]=function(_0x5640eb,_0x24936a,_0x3d9717){return google[_0x0a9e('0x32')](_0x5640eb,_0x24936a,_0x3d9717)[_0x0a9e('0x29')](function(_0x4f41ae){logger[_0x0a9e('0x16')](_0x4f41ae[_0x0a9e('0x33')]);return rp(_0x4f41ae);})[_0x0a9e('0x29')](function(_0x533942){var _0x1dbf74='';var _0x1a180b=0x0;try{fs[_0x0a9e('0x19')](_0x5640eb);}catch(_0x4c1c0e){logger['error'](_0x4c1c0e);}if(_0x533942&&_0x533942[_0x0a9e('0x34')]){_0x1dbf74=_0x533942[_0x0a9e('0x34')]['map'](function(_0x2b814e){return _0x2b814e&&_0x2b814e[_0x0a9e('0x35')][0x0]&&_0x2b814e[_0x0a9e('0x35')][0x0][_0x0a9e('0x36')]?_0x2b814e['alternatives'][0x0]['transcript']:'';})[_0x0a9e('0x37')]('\x0a');_0x1a180b=_0x533942[_0x0a9e('0x34')]['map'](function(_0x183991){return _0x183991&&_0x183991[_0x0a9e('0x35')][0x0]&&_0x183991[_0x0a9e('0x35')][0x0]['confidence']?_0x183991[_0x0a9e('0x35')][0x0][_0x0a9e('0x38')]:0x0;})[_0x0a9e('0x37')]('\x0a');}logger[_0x0a9e('0x16')](_0x0a9e('0x39'),_0x1dbf74);logger[_0x0a9e('0x16')](_0x0a9e('0x3a'),_0x1a180b);return{'transcript':_0x1dbf74,'confidence':_0x1a180b};})[_0x0a9e('0x3b')](function(_0x23b089){logger[_0x0a9e('0x18')](_0x0a9e('0x3c'),_0x23b089[_0x0a9e('0x11')],_0x23b089[_0x0a9e('0x3d')],_0x23b089[_0x0a9e('0x3e')]);});};exports[_0x0a9e('0x3f')]=function(_0x4d04c8,_0x52628e,_0x473fdc,_0xb3795a){var _0x405c8f=apiai(_0x52628e,{'language':_0xb3795a||'en'});return _0x405c8f[_0x0a9e('0x40')](_0x473fdc,{'sessionId':md5(_0x4d04c8)})[_0x0a9e('0x29')](function(_0xc9a702){logger[_0x0a9e('0x16')](JSON[_0x0a9e('0x41')](_0xc9a702));return{'source':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x43')],'resolvedQuery':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x44')],'action':_0xc9a702['result'][_0x0a9e('0x45')],'actionIncomplete':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x46')],'speech':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x47')][_0x0a9e('0x48')],'score':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x49')],'statusCode':_0xc9a702['status'][_0x0a9e('0x4a')],'endConversation':_0xc9a702['result'][_0x0a9e('0x4b')][_0x0a9e('0x4c')]||![],'isFallbackIntent':_0xc9a702[_0x0a9e('0x42')]['metadata'][_0x0a9e('0x4d')]};});};exports[_0x0a9e('0x4e')]=function(_0x4774f4,_0x34aa5a,_0x45c845,_0x37be73){return tilde[_0x0a9e('0x32')](_0x4774f4,_0x34aa5a,_0x45c845,_0x37be73)['then'](function(_0x13f44d){try{fs[_0x0a9e('0x19')](_0x4774f4);}catch(_0x1b5e80){logger[_0x0a9e('0x18')](_0x1b5e80);}logger[_0x0a9e('0x16')](_0x0a9e('0x4f'),_0x13f44d[_0x0a9e('0x36')]);logger[_0x0a9e('0x16')](_0x0a9e('0x50'),_0x13f44d['confidence']);return _0x13f44d;});};exports[_0x0a9e('0x51')]=function(_0x3fe430,_0x4f7240,_0x4ae14b,_0x5ddf84,_0x1adfee,_0x4317e3){var _0x37edaa=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x2f'));var _0x375c18;return aws['polly'](_0x3fe430,_0x4f7240,_0x4ae14b,_0x5ddf84,_0x1adfee,_0x4317e3,_0x37edaa)['then'](function(){_0x375c18=path['resolve'](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x27'));return convertFile(_0x37edaa,_0x375c18);})['then'](function(){try{fs[_0x0a9e('0x19')](_0x37edaa);fs[_0x0a9e('0x2a')](_0x375c18,'777');}catch(_0x5a88da){logger[_0x0a9e('0x18')](_0x5a88da);}return _0x375c18['split']('.')[0x0];});};exports[_0x0a9e('0x52')]=function(_0x4c3845,_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da){return aws[_0x0a9e('0x53')](_0x4c3845,_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da)['then'](function(_0x50f687){logger[_0x0a9e('0x16')](JSON[_0x0a9e('0x41')](_0x50f687));return _0x50f687;});};exports['ispeechTTS']=function(_0x145931,_0x5ce9ac,_0x211ef9,_0x523cd2){var _0xe22ccc=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x145931,encodeURIComponent(_0x5ce9ac),_0x211ef9,_0x523cd2);var _0x5df0ad=path[_0x0a9e('0x24')](__dirname,'tmp',rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x2f'));var _0x3cfd00;return downloadFile(_0xe22ccc,_0x5df0ad)[_0x0a9e('0x29')](function(){_0x3cfd00=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x27'));return convertFile(_0x5df0ad,_0x3cfd00);})['then'](function(){try{fs[_0x0a9e('0x19')](_0x5df0ad);fs[_0x0a9e('0x2a')](_0x3cfd00,_0x0a9e('0x2b'));}catch(_0x30c491){logger[_0x0a9e('0x18')](_0x30c491);}return _0x3cfd00[_0x0a9e('0x2c')]('.')[0x0];});};exports['ispeechASR']=function(_0x956fbe,_0x26bc80,_0x5239ef,_0x3649cc){var _0x5cc8fb=util[_0x0a9e('0x54')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x26bc80,_0x5239ef,base64Encode(_0x956fbe),_0x3649cc?util['format']('model=%s',encodeURIComponent(_0x3649cc)):_0x0a9e('0x55'));return uploadFile(_0x5cc8fb)['then'](function(_0x2244d6){return querystring[_0x0a9e('0x56')](_0x2244d6);});};exports[_0x0a9e('0x57')]=function(_0x7be420,_0x1cca9f){return sestek[_0x0a9e('0x58')](_0x7be420,_0x1cca9f)['then'](function(_0x1627a7){logger['info'](JSON[_0x0a9e('0x41')](_0x1627a7));var _0x1f07cb={'speech':_0x1627a7[_0x0a9e('0x59')],'action':_0x1627a7['channelData']?_0x1627a7[_0x0a9e('0x5a')][_0x0a9e('0x5b')]:undefined,'actiondata':_0x1627a7[_0x0a9e('0x5a')]?_0x1627a7[_0x0a9e('0x5a')]['CustomActionData']:undefined};if(_0x1627a7[_0x0a9e('0x5a')]&&_0x1627a7[_0x0a9e('0x5a')]['AudioFromTts']){return base64Decode(_0x1627a7[_0x0a9e('0x5a')][_0x0a9e('0x5c')][_0x0a9e('0x5d')],path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs['generate'](0x4)+_0x0a9e('0x27')))[_0x0a9e('0x29')](function(_0x281c7d){_0x1f07cb['audiofile']=_0x281c7d;return _0x1f07cb;});}return _0x1f07cb;});};exports[_0x0a9e('0x5e')]=function(){return __dirname;}; \ No newline at end of file +var _0xa9e0=['text','channelData','CustomAction','AudioFromTts','Data','dirName','path','http','https','bluebird','sox','request-promise','util','querystring','moment','apiai-promise','md5','./google','./sestek','https://api.ispeech.org/api/rest','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','error','unlink','download\x20error','pipe','end','protocol','https:','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','base64','then','chmodSync','777','split','readFileSync','googleTTS','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','format','freeform=3','parse','sestekNDA','nda'];(function(_0x5406c1,_0x4beea0){var _0x3c4e09=function(_0x2a7a16){while(--_0x2a7a16){_0x5406c1['push'](_0x5406c1['shift']());}};_0x3c4e09(++_0x4beea0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var fs=require('fs');var path=require(_0x0a9e('0x0'));var http=require(_0x0a9e('0x1'));var https=require(_0x0a9e('0x2'));var urlParse=require('url')['parse'];var BPromise=require(_0x0a9e('0x3'));var rs=require('randomstring');var sox=require(_0x0a9e('0x4'));var rp=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var querystring=require(_0x0a9e('0x7'));var moment=require(_0x0a9e('0x8'));var tts=require('google-tts-api');var apiai=require(_0x0a9e('0x9'));var md5=require(_0x0a9e('0xa'));var google=require(_0x0a9e('0xb'));var aws=require('./aws');var tilde=require('./tilde');var sestek=require(_0x0a9e('0xc'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0x0a9e('0xd');function downloadFile(_0xf81284,_0x307b3e){return new BPromise(function(_0x3ab53f,_0xfeb75b){var _0xbd1168=urlParse(_0xf81284);var _0x4a4c56=_0xbd1168['protocol']==='https:'?https:http;var _0x4cfe67={'host':_0xbd1168[_0x0a9e('0xe')],'path':_0xbd1168[_0x0a9e('0x0')],'headers':{'user-agent':_0x0a9e('0xf')}};_0x4a4c56[_0x0a9e('0x10')](_0x4cfe67,function(_0x32d742){if(_0x32d742[_0x0a9e('0x11')]!==0xc8){logger['error'](_0x0a9e('0x12')+_0xf81284+_0x0a9e('0x13')+_0x32d742[_0x0a9e('0x11')]+'\x20('+_0x32d742[_0x0a9e('0x14')]+')');_0xfeb75b(new Error(_0x0a9e('0x12')+_0xf81284+_0x0a9e('0x13')+_0x32d742['statusCode']+'\x20('+_0x32d742[_0x0a9e('0x14')]+')'));return;}var _0x5d0880=fs[_0x0a9e('0x15')](_0x307b3e);_0x5d0880['on']('finish',function(){logger[_0x0a9e('0x16')](_0x0a9e('0x17'));_0x5d0880['close'](_0x3ab53f);});_0x5d0880['on'](_0x0a9e('0x18'),function(_0x5a0a06){fs[_0x0a9e('0x19')](_0x307b3e);logger[_0x0a9e('0x18')](_0x0a9e('0x1a'),_0x5a0a06);_0xfeb75b(_0x5a0a06);});_0x32d742[_0x0a9e('0x1b')](_0x5d0880);})['on'](_0x0a9e('0x18'),function(_0x2eb11f){logger[_0x0a9e('0x18')](_0x2eb11f);_0xfeb75b(_0x2eb11f);})[_0x0a9e('0x1c')]();});}function uploadFile(_0x1314ae){return new BPromise(function(_0x112016,_0x1c696a){var _0x105080=urlParse(_0x1314ae);var _0x4bb1e3=_0x105080[_0x0a9e('0x1d')]===_0x0a9e('0x1e')?https:http;var _0x53682f={'host':_0x105080[_0x0a9e('0xe')],'path':_0x105080['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x4bb1e3[_0x0a9e('0x10')](_0x53682f,function(_0x432e56){if(_0x432e56[_0x0a9e('0x11')]!==0xc8){_0x1c696a(new Error(_0x0a9e('0x12')+_0x1314ae+'\x20failed,\x20status\x20code\x20=\x20'+_0x432e56[_0x0a9e('0x11')]+'\x20('+_0x432e56[_0x0a9e('0x14')]+')'));return;}var _0x3b45bc='';_0x432e56['on'](_0x0a9e('0x1f'),function(_0x370d86){_0x3b45bc+=_0x370d86;});_0x432e56['on'](_0x0a9e('0x1c'),function(){_0x112016(_0x3b45bc);});})['on'](_0x0a9e('0x18'),function(_0x5ea472){_0x1c696a(_0x5ea472);})['end']();});}function convertFile(_0x197ec0,_0x3a8e58){return new BPromise(function(_0x40c424,_0x33161b){var _0x526cf3=sox[_0x0a9e('0x20')](_0x197ec0,_0x3a8e58,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x526cf3['on'](_0x0a9e('0x18'),function(_0x5bfb33){logger[_0x0a9e('0x18')](_0x0a9e('0x21'),_0x5bfb33);_0x33161b(_0x5bfb33);});_0x526cf3['on'](_0x0a9e('0x1c'),function(){logger[_0x0a9e('0x16')](_0x0a9e('0x22'));_0x40c424();});_0x526cf3[_0x0a9e('0x23')]();});}function base64Decode(_0x11c3b6,_0x14de77){var _0x5a101a=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x27'));fs['writeFileSync'](_0x5a101a,_0x11c3b6,_0x0a9e('0x28'));return convertFile(_0x5a101a,_0x14de77)[_0x0a9e('0x29')](function(){try{fs[_0x0a9e('0x19')](_0x5a101a);fs[_0x0a9e('0x2a')](_0x14de77,_0x0a9e('0x2b'));}catch(_0x563b45){logger[_0x0a9e('0x18')](_0x563b45);}return _0x14de77[_0x0a9e('0x2c')]('.')[0x0];});}function base64Encode(_0x1dbde2){var _0x540530=fs[_0x0a9e('0x2d')](_0x1dbde2);return new Buffer(_0x540530)['toString'](_0x0a9e('0x28'));}exports[_0x0a9e('0x2e')]=function(_0x1122db,_0x33bdb7){var _0x25ce3a,_0x5180f1;return tts(_0x1122db,_0x33bdb7||'en',0x1)[_0x0a9e('0x29')](function(_0x46f0a5){logger[_0x0a9e('0x16')](_0x46f0a5);_0x25ce3a=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x2f'));return downloadFile(_0x46f0a5,_0x25ce3a);})[_0x0a9e('0x29')](function(){_0x5180f1=path['resolve'](__dirname,_0x0a9e('0x25'),rs['generate'](0x4)+_0x0a9e('0x27'));return convertFile(_0x25ce3a,_0x5180f1);})[_0x0a9e('0x29')](function(){try{fs[_0x0a9e('0x19')](_0x25ce3a);fs[_0x0a9e('0x2a')](_0x5180f1,'777');}catch(_0x191e91){logger[_0x0a9e('0x18')](_0x191e91);}logger[_0x0a9e('0x16')](_0x0a9e('0x30'),_0x5180f1['split']('.')[0x0]);return _0x5180f1['split']('.')[0x0];});};exports[_0x0a9e('0x31')]=function(_0x5640eb,_0x24936a,_0x3d9717){return google[_0x0a9e('0x32')](_0x5640eb,_0x24936a,_0x3d9717)[_0x0a9e('0x29')](function(_0x4f41ae){logger[_0x0a9e('0x16')](_0x4f41ae[_0x0a9e('0x33')]);return rp(_0x4f41ae);})[_0x0a9e('0x29')](function(_0x533942){var _0x1dbf74='';var _0x1a180b=0x0;try{fs[_0x0a9e('0x19')](_0x5640eb);}catch(_0x4c1c0e){logger['error'](_0x4c1c0e);}if(_0x533942&&_0x533942[_0x0a9e('0x34')]){_0x1dbf74=_0x533942[_0x0a9e('0x34')]['map'](function(_0x2b814e){return _0x2b814e&&_0x2b814e[_0x0a9e('0x35')][0x0]&&_0x2b814e[_0x0a9e('0x35')][0x0][_0x0a9e('0x36')]?_0x2b814e['alternatives'][0x0]['transcript']:'';})[_0x0a9e('0x37')]('\x0a');_0x1a180b=_0x533942[_0x0a9e('0x34')]['map'](function(_0x183991){return _0x183991&&_0x183991[_0x0a9e('0x35')][0x0]&&_0x183991[_0x0a9e('0x35')][0x0]['confidence']?_0x183991[_0x0a9e('0x35')][0x0][_0x0a9e('0x38')]:0x0;})[_0x0a9e('0x37')]('\x0a');}logger[_0x0a9e('0x16')](_0x0a9e('0x39'),_0x1dbf74);logger[_0x0a9e('0x16')](_0x0a9e('0x3a'),_0x1a180b);return{'transcript':_0x1dbf74,'confidence':_0x1a180b};})[_0x0a9e('0x3b')](function(_0x23b089){logger[_0x0a9e('0x18')](_0x0a9e('0x3c'),_0x23b089[_0x0a9e('0x11')],_0x23b089[_0x0a9e('0x3d')],_0x23b089[_0x0a9e('0x3e')]);});};exports[_0x0a9e('0x3f')]=function(_0x4d04c8,_0x52628e,_0x473fdc,_0xb3795a){var _0x405c8f=apiai(_0x52628e,{'language':_0xb3795a||'en'});return _0x405c8f[_0x0a9e('0x40')](_0x473fdc,{'sessionId':md5(_0x4d04c8)})[_0x0a9e('0x29')](function(_0xc9a702){logger[_0x0a9e('0x16')](JSON[_0x0a9e('0x41')](_0xc9a702));return{'source':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x43')],'resolvedQuery':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x44')],'action':_0xc9a702['result'][_0x0a9e('0x45')],'actionIncomplete':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x46')],'speech':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x47')][_0x0a9e('0x48')],'score':_0xc9a702[_0x0a9e('0x42')][_0x0a9e('0x49')],'statusCode':_0xc9a702['status'][_0x0a9e('0x4a')],'endConversation':_0xc9a702['result'][_0x0a9e('0x4b')][_0x0a9e('0x4c')]||![],'isFallbackIntent':_0xc9a702[_0x0a9e('0x42')]['metadata'][_0x0a9e('0x4d')]};});};exports[_0x0a9e('0x4e')]=function(_0x4774f4,_0x34aa5a,_0x45c845,_0x37be73){return tilde[_0x0a9e('0x32')](_0x4774f4,_0x34aa5a,_0x45c845,_0x37be73)['then'](function(_0x13f44d){try{fs[_0x0a9e('0x19')](_0x4774f4);}catch(_0x1b5e80){logger[_0x0a9e('0x18')](_0x1b5e80);}logger[_0x0a9e('0x16')](_0x0a9e('0x4f'),_0x13f44d[_0x0a9e('0x36')]);logger[_0x0a9e('0x16')](_0x0a9e('0x50'),_0x13f44d['confidence']);return _0x13f44d;});};exports[_0x0a9e('0x51')]=function(_0x3fe430,_0x4f7240,_0x4ae14b,_0x5ddf84,_0x1adfee,_0x4317e3){var _0x37edaa=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x2f'));var _0x375c18;return aws['polly'](_0x3fe430,_0x4f7240,_0x4ae14b,_0x5ddf84,_0x1adfee,_0x4317e3,_0x37edaa)['then'](function(){_0x375c18=path['resolve'](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x27'));return convertFile(_0x37edaa,_0x375c18);})['then'](function(){try{fs[_0x0a9e('0x19')](_0x37edaa);fs[_0x0a9e('0x2a')](_0x375c18,'777');}catch(_0x5a88da){logger[_0x0a9e('0x18')](_0x5a88da);}return _0x375c18['split']('.')[0x0];});};exports[_0x0a9e('0x52')]=function(_0x4c3845,_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da){return aws[_0x0a9e('0x53')](_0x4c3845,_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da)['then'](function(_0x50f687){logger[_0x0a9e('0x16')](JSON[_0x0a9e('0x41')](_0x50f687));return _0x50f687;});};exports['ispeechTTS']=function(_0x145931,_0x5ce9ac,_0x211ef9,_0x523cd2){var _0xe22ccc=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x145931,encodeURIComponent(_0x5ce9ac),_0x211ef9,_0x523cd2);var _0x5df0ad=path[_0x0a9e('0x24')](__dirname,'tmp',rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x2f'));var _0x3cfd00;return downloadFile(_0xe22ccc,_0x5df0ad)[_0x0a9e('0x29')](function(){_0x3cfd00=path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs[_0x0a9e('0x26')](0x4)+_0x0a9e('0x27'));return convertFile(_0x5df0ad,_0x3cfd00);})['then'](function(){try{fs[_0x0a9e('0x19')](_0x5df0ad);fs[_0x0a9e('0x2a')](_0x3cfd00,_0x0a9e('0x2b'));}catch(_0x30c491){logger[_0x0a9e('0x18')](_0x30c491);}return _0x3cfd00[_0x0a9e('0x2c')]('.')[0x0];});};exports['ispeechASR']=function(_0x956fbe,_0x26bc80,_0x5239ef,_0x3649cc){var _0x5cc8fb=util[_0x0a9e('0x54')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x26bc80,_0x5239ef,base64Encode(_0x956fbe),_0x3649cc?util['format']('model=%s',encodeURIComponent(_0x3649cc)):_0x0a9e('0x55'));return uploadFile(_0x5cc8fb)['then'](function(_0x2244d6){return querystring[_0x0a9e('0x56')](_0x2244d6);});};exports[_0x0a9e('0x57')]=function(_0x7be420,_0x1cca9f){return sestek[_0x0a9e('0x58')](_0x7be420,_0x1cca9f)['then'](function(_0x1627a7){logger['info'](JSON[_0x0a9e('0x41')](_0x1627a7));var _0x1f07cb={'speech':_0x1627a7[_0x0a9e('0x59')],'action':_0x1627a7['channelData']?_0x1627a7[_0x0a9e('0x5a')][_0x0a9e('0x5b')]:undefined,'actiondata':_0x1627a7[_0x0a9e('0x5a')]?_0x1627a7[_0x0a9e('0x5a')]['CustomActionData']:undefined};if(_0x1627a7[_0x0a9e('0x5a')]&&_0x1627a7[_0x0a9e('0x5a')]['AudioFromTts']){return base64Decode(_0x1627a7[_0x0a9e('0x5a')][_0x0a9e('0x5c')][_0x0a9e('0x5d')],path[_0x0a9e('0x24')](__dirname,_0x0a9e('0x25'),rs['generate'](0x4)+_0x0a9e('0x27')))[_0x0a9e('0x29')](function(_0x281c7d){_0x1f07cb['audiofile']=_0x281c7d;return _0x1f07cb;});}return _0x1f07cb;});};exports[_0x0a9e('0x5e')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index fe89fbb..5c3ef7a 100644 --- a/server/services/agi/scripts/sestek/index.js +++ b/server/services/agi/scripts/sestek/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b7e=['./nda'];(function(_0x396d0e,_0x544182){var _0x515b38=function(_0xf1d1c){while(--_0xf1d1c){_0x396d0e['push'](_0x396d0e['shift']());}};_0x515b38(++_0x544182);}(_0x9b7e,0x141));var _0xe9b7=function(_0x55b037,_0x2d9392){_0x55b037=_0x55b037-0x0;var _0x5f1053=_0x9b7e[_0x55b037];return _0x5f1053;};var nda=require(_0xe9b7('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x966f=['./nda','exports'];(function(_0x227a3b,_0x126d1c){var _0x30a8a5=function(_0x2fd985){while(--_0x2fd985){_0x227a3b['push'](_0x227a3b['shift']());}};_0x30a8a5(++_0x126d1c);}(_0x966f,0x15c));var _0xf966=function(_0x53c39a,_0x5e5338){_0x53c39a=_0x53c39a-0x0;var _0x106c3d=_0x966f[_0x53c39a];return _0x106c3d;};var nda=require(_0xf966('0x0'));module[_0xf966('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 6344460..2f030d1 100644 --- a/server/services/agi/scripts/sestek/nda/index.js +++ b/server/services/agi/scripts/sestek/nda/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c8e=['info','stringify','../../../../../config/logger','agi','exports','POST','ndauth_url','password','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','dnid','text','Bearer\x20','access_token','project','body','channelData','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData'];(function(_0x2a4cdd,_0x59b83b){var _0x3e6848=function(_0x15cd0a){while(--_0x15cd0a){_0x2a4cdd['push'](_0x2a4cdd['shift']());}};_0x3e6848(++_0x59b83b);}(_0x6c8e,0x110));var _0xe6c8=function(_0x2460ab,_0x2882df){_0x2460ab=_0x2460ab-0x0;var _0x339bec=_0x6c8e[_0x2460ab];return _0x339bec;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0xe6c8('0x0'))(_0xe6c8('0x1'));module[_0xe6c8('0x2')]=function(_0x54ed0f,_0x22a085){var _0x25664e={'method':_0xe6c8('0x3'),'uri':url['resolve'](_0x22a085[_0xe6c8('0x4')],'/token'),'form':{'grant_type':_0xe6c8('0x5'),'username':_0x22a085['username'],'password':_0x22a085['password']},'json':!![]};return rp(_0x25664e)[_0xe6c8('0x6')](function(_0x303259){var _0x56100d={'method':_0xe6c8('0x3'),'uri':url[_0xe6c8('0x7')](_0x22a085[_0xe6c8('0x8')],_0xe6c8('0x9')),'body':{'type':_0x22a085[_0xe6c8('0xa')]||_0xe6c8('0xb'),'channelId':_0xe6c8('0xc'),'conversation':{'id':_0x54ed0f[_0xe6c8('0xd')]},'from':{'id':_0x54ed0f['callerid'],'name':_0x54ed0f['calleridname']},'recipient':{'id':_0x54ed0f[_0xe6c8('0xe')],'name':_0x54ed0f['extension']},'text':_0x22a085[_0xe6c8('0xf')],'channelData':{}},'headers':{'Authorization':_0xe6c8('0x10')+_0x303259[_0xe6c8('0x11')]},'json':!![]};if(_0x22a085[_0xe6c8('0x12')]){_0x56100d[_0xe6c8('0x13')][_0xe6c8('0x14')]['ProjectName']=_0x22a085[_0xe6c8('0x12')];}if(_0x22a085[_0xe6c8('0x15')]=='1'){_0x56100d[_0xe6c8('0x13')][_0xe6c8('0x14')][_0xe6c8('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xe6c8('0x17')};}if(_0x22a085[_0xe6c8('0x18')]){_0x56100d['body'][_0xe6c8('0x14')][_0xe6c8('0x19')]=_0x22a085[_0xe6c8('0x18')];if(_0x22a085[_0xe6c8('0x1a')]){_0x56100d[_0xe6c8('0x13')][_0xe6c8('0x14')][_0xe6c8('0x1b')]=_0x22a085[_0xe6c8('0x1a')];}}logger[_0xe6c8('0x1c')](JSON[_0xe6c8('0x1d')](_0x56100d));return rp(_0x56100d);});}; \ No newline at end of file +var _0xe2bd=['username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','extension','text','Bearer\x20','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','custom_action','custom_action_data','CustomActionData','info','request-promise','../../../../../config/logger','agi','POST','resolve','ndauth_url','password'];(function(_0x1bf8e7,_0x53f0ec){var _0x55f190=function(_0x5c8f6a){while(--_0x5c8f6a){_0x1bf8e7['push'](_0x1bf8e7['shift']());}};_0x55f190(++_0x53f0ec);}(_0xe2bd,0x13d));var _0xde2b=function(_0x33ac31,_0x569436){_0x33ac31=_0x33ac31-0x0;var _0x456324=_0xe2bd[_0x33ac31];return _0x456324;};'use strict';var rp=require(_0xde2b('0x0'));var url=require('url');var logger=require(_0xde2b('0x1'))(_0xde2b('0x2'));module['exports']=function(_0x248947,_0xa55d86){var _0x4a6031={'method':_0xde2b('0x3'),'uri':url[_0xde2b('0x4')](_0xa55d86[_0xde2b('0x5')],'/token'),'form':{'grant_type':_0xde2b('0x6'),'username':_0xa55d86[_0xde2b('0x7')],'password':_0xa55d86[_0xde2b('0x6')]},'json':!![]};return rp(_0x4a6031)[_0xde2b('0x8')](function(_0x4c8e6d){var _0x761c99={'method':_0xde2b('0x3'),'uri':url[_0xde2b('0x4')](_0xa55d86[_0xde2b('0x9')],_0xde2b('0xa')),'body':{'type':_0xa55d86[_0xde2b('0xb')]||'message','channelId':_0xde2b('0xc'),'conversation':{'id':_0x248947[_0xde2b('0xd')]},'from':{'id':_0x248947['callerid'],'name':_0x248947['calleridname']},'recipient':{'id':_0x248947['dnid'],'name':_0x248947[_0xde2b('0xe')]},'text':_0xa55d86[_0xde2b('0xf')],'channelData':{}},'headers':{'Authorization':_0xde2b('0x10')+_0x4c8e6d['access_token']},'json':!![]};if(_0xa55d86[_0xde2b('0x11')]){_0x761c99[_0xde2b('0x12')][_0xde2b('0x13')][_0xde2b('0x14')]=_0xa55d86[_0xde2b('0x11')];}if(_0xa55d86[_0xde2b('0x15')]=='1'){_0x761c99['body'][_0xde2b('0x13')][_0xde2b('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0xa55d86[_0xde2b('0x17')]){_0x761c99[_0xde2b('0x12')][_0xde2b('0x13')]['CustomAction']=_0xa55d86[_0xde2b('0x17')];if(_0xa55d86[_0xde2b('0x18')]){_0x761c99[_0xde2b('0x12')][_0xde2b('0x13')][_0xde2b('0x19')]=_0xa55d86[_0xde2b('0x18')];}}logger[_0xde2b('0x1a')](JSON['stringify'](_0x761c99));return rp(_0x761c99);});}; \ 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 2de7d14..76035b6 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 _0x017f=['./lib/api','exports'];(function(_0x135ff4,_0x5120e6){var _0x36706f=function(_0x54842b){while(--_0x54842b){_0x135ff4['push'](_0x135ff4['shift']());}};_0x36706f(++_0x5120e6);}(_0x017f,0x160));var _0xf017=function(_0x5eb959,_0x27f32a){_0x5eb959=_0x5eb959-0x0;var _0x502558=_0x017f[_0x5eb959];return _0x502558;};'use strict';var asr=require(_0xf017('0x0'));module[_0xf017('0x1')]=function(_0x53b39b,_0x15603e,_0x2caee4,_0x254b61){return asr(_0x53b39b,_0x15603e,_0x2caee4,_0x254b61);}; \ No newline at end of file +var _0x13a4=['./lib/api'];(function(_0x3d8bc7,_0x470565){var _0x4def56=function(_0x2df56e){while(--_0x2df56e){_0x3d8bc7['push'](_0x3d8bc7['shift']());}};_0x4def56(++_0x470565);}(_0x13a4,0x106));var _0x413a=function(_0xd8d686,_0x2aa466){_0xd8d686=_0xd8d686-0x0;var _0xb9cd22=_0x13a4[_0xd8d686];return _0xb9cd22;};'use strict';var asr=require(_0x413a('0x0'));module['exports']=function(_0x35bb49,_0x15384b,_0x654dca,_0x21038f){return asr(_0x35bb49,_0x15384b,_0x654dca,_0x21038f);}; \ 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 a41cc03..e661ebc 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 _0x4353=['parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','hex','unix','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate'];(function(_0x2e023f,_0x3ffd94){var _0x42441b=function(_0x239689){while(--_0x239689){_0x2e023f['push'](_0x2e023f['shift']());}};_0x42441b(++_0x3ffd94);}(_0x4353,0x14b));var _0x3435=function(_0x1f6ff0,_0x11875e){_0x1f6ff0=_0x1f6ff0-0x0;var _0x2d7dea=_0x4353[_0x1f6ff0];return _0x2d7dea;};'use strict';var BPromise=require(_0x3435('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x3435('0x1'));var logger=require(_0x3435('0x2'))(_0x3435('0x3'));module[_0x3435('0x4')]=function(_0x47fac9,_0x516052,_0xe8ec31,_0x3684aa){return new BPromise(function(_0x215c28,_0x55eb76){logger[_0x3435('0x5')](_0x3435('0x6'),_0x3684aa||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x4c0539=new WebSocket(_0x3684aa||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x438e42='';var _0x5dd49a='0';var _0x4d8692='1';var _0x4d5ea4=_0x3435('0x7');function _0x1ba7b9(_0x28b51e){var _0x321c4f=crypto[_0x3435('0x8')]('sha1');_0x321c4f[_0x3435('0x9')](_0x28b51e);return _0x321c4f['digest'](_0x3435('0xa'));}function _0x1afd32(){try{logger[_0x3435('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x31b440=moment()[_0x3435('0xb')]();var _0x418405=_0x1ba7b9(_0x31b440+_0x516052+_0xe8ec31);_0x4c0539[_0x3435('0xc')](JSON['stringify']({'appID':_0x516052,'timestamp':_0x31b440,'appKey':_0x418405}));var _0x530154=fs['createReadStream'](_0x47fac9);_0x530154['on']('data',function(_0x560bee){_0x4c0539[_0x3435('0xc')](_0x560bee);});_0x530154['on'](_0x3435('0xd'),function(){_0x4c0539['send'](_0x3435('0xe'));});}catch(_0x223323){logger[_0x3435('0xf')](_0x3435('0x10'),JSON[_0x3435('0x11')](_0x223323));_0x4c0539[_0x3435('0x12')]();}}function _0x5b4826(_0x2a55c5){try{if(_0x2a55c5){var _0x897971=JSON[_0x3435('0x13')](_0x2a55c5);switch(_0x897971['status']){case 0x0:if(_0x897971[_0x3435('0x14')]){if(_0x897971[_0x3435('0x14')][_0x3435('0x15')]){logger[_0x3435('0x5')](_0x3435('0x16'),JSON[_0x3435('0x11')](_0x897971[_0x3435('0x14')]['hypotheses']));_0x438e42=_0x897971[_0x3435('0x14')]['hypotheses'][0x0]['transcript'];_0x5dd49a=_0x897971['result'][_0x3435('0x17')][0x0][_0x3435('0x18')];_0x4d8692='0';_0x4d5ea4=_0x3435('0x19');_0x4c0539[_0x3435('0x12')]();}}break;case 0x1:logger[_0x3435('0x5')](_0x3435('0x7'));_0x4d8692='1';_0x4d5ea4=_0x3435('0x7');break;case 0x2:logger[_0x3435('0x5')](_0x3435('0x1a'));_0x4d8692='2';_0x4d5ea4='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x3435('0x5')](_0x3435('0x1b'));_0x4d8692='9';_0x4d5ea4='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x3435('0x5')](_0x3435('0x1c'));_0x4d8692='10';_0x4d5ea4=_0x3435('0x1c');break;case 0xb:logger[_0x3435('0x5')](_0x3435('0x1d'));_0x4d8692='11';_0x4d5ea4=_0x3435('0x1d');}}}catch(_0x54c51a){logger[_0x3435('0xf')](_0x3435('0x1e'),JSON[_0x3435('0x11')](_0x54c51a));_0x4c0539['terminate']();}}function _0x273d10(){logger[_0x3435('0x5')](_0x3435('0x1f'));_0x215c28({'transcript':_0x438e42,'confidence':_0x5dd49a,'status':_0x4d8692,'status_message':_0x4d5ea4});}function _0x46c60c(_0x1e6625){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x3435('0x20')](_0x1e6625)){logger[_0x3435('0xf')](_[_0x3435('0x21')](_0x1e6625)?JSON[_0x3435('0x11')](_0x1e6625):_0x1e6625);}}_0x4c0539['on']('open',_0x1afd32);_0x4c0539['on'](_0x3435('0x22'),_0x5b4826);_0x4c0539['on']('close',_0x273d10);_0x4c0539['on']('error',_0x46c60c);});}; \ No newline at end of file +var _0x2705=['info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','stringify','send','EOS','error','Tilde\x20ASR\x20send\x20error','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','lodash','../../../../../../config/logger','agi','exports'];(function(_0x4e9a47,_0x275288){var _0x5865e3=function(_0x2934b0){while(--_0x2934b0){_0x4e9a47['push'](_0x4e9a47['shift']());}};_0x5865e3(++_0x275288);}(_0x2705,0xba));var _0x5270=function(_0x497856,_0x49fa55){_0x497856=_0x497856-0x0;var _0x481849=_0x2705[_0x497856];return _0x481849;};'use strict';var BPromise=require('bluebird');var _=require(_0x5270('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require(_0x5270('0x1'))(_0x5270('0x2'));module[_0x5270('0x3')]=function(_0x3d40bb,_0x226690,_0x4164c7,_0x373d17){return new BPromise(function(_0x3440d6,_0x48708f){logger[_0x5270('0x4')](_0x5270('0x5'),_0x373d17||_0x5270('0x6'));var _0xdc2c1d=new WebSocket(_0x373d17||_0x5270('0x6'),{'perMessageDeflate':![]});var _0x565351='';var _0xbffa56='0';var _0x2a981c='1';var _0x305e49=_0x5270('0x7');function _0x5cfec2(_0x154eb7){var _0x34700a=crypto[_0x5270('0x8')]('sha1');_0x34700a[_0x5270('0x9')](_0x154eb7);return _0x34700a['digest'](_0x5270('0xa'));}function _0x2aa4b2(){try{logger[_0x5270('0x4')](_0x5270('0xb'));var _0x3fcb16=moment()[_0x5270('0xc')]();var _0x18331e=_0x5cfec2(_0x3fcb16+_0x226690+_0x4164c7);_0xdc2c1d['send'](JSON[_0x5270('0xd')]({'appID':_0x226690,'timestamp':_0x3fcb16,'appKey':_0x18331e}));var _0x5f20c4=fs['createReadStream'](_0x3d40bb);_0x5f20c4['on']('data',function(_0x197364){_0xdc2c1d[_0x5270('0xe')](_0x197364);});_0x5f20c4['on']('close',function(){_0xdc2c1d['send'](_0x5270('0xf'));});}catch(_0x4d40df){logger[_0x5270('0x10')](_0x5270('0x11'),JSON[_0x5270('0xd')](_0x4d40df));_0xdc2c1d['terminate']();}}function _0x146f8c(_0x51776c){try{if(_0x51776c){var _0x422902=JSON[_0x5270('0x12')](_0x51776c);switch(_0x422902['status']){case 0x0:if(_0x422902[_0x5270('0x13')]){if(_0x422902[_0x5270('0x13')][_0x5270('0x14')]){logger[_0x5270('0x4')](_0x5270('0x15'),JSON[_0x5270('0xd')](_0x422902[_0x5270('0x13')][_0x5270('0x16')]));_0x565351=_0x422902[_0x5270('0x13')][_0x5270('0x16')][0x0][_0x5270('0x17')];_0xbffa56=_0x422902[_0x5270('0x13')][_0x5270('0x16')][0x0][_0x5270('0x18')];_0x2a981c='0';_0x305e49=_0x5270('0x19');_0xdc2c1d[_0x5270('0x1a')]();}}break;case 0x1:logger['info'](_0x5270('0x7'));_0x2a981c='1';_0x305e49=_0x5270('0x7');break;case 0x2:logger[_0x5270('0x4')](_0x5270('0x1b'));_0x2a981c='2';_0x305e49=_0x5270('0x1b');break;case 0x9:logger[_0x5270('0x4')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x2a981c='9';_0x305e49=_0x5270('0x1c');break;case 0xa:logger['info'](_0x5270('0x1d'));_0x2a981c='10';_0x305e49=_0x5270('0x1d');break;case 0xb:logger[_0x5270('0x4')](_0x5270('0x1e'));_0x2a981c='11';_0x305e49=_0x5270('0x1e');}}}catch(_0x2eca29){logger[_0x5270('0x10')](_0x5270('0x1f'),JSON[_0x5270('0xd')](_0x2eca29));_0xdc2c1d[_0x5270('0x1a')]();}}function _0x5bf299(){logger['info'](_0x5270('0x20'));_0x3440d6({'transcript':_0x565351,'confidence':_0xbffa56,'status':_0x2a981c,'status_message':_0x305e49});}function _0xf0fe59(_0x26576c){logger[_0x5270('0x10')](_0x5270('0x21'));if(!_[_0x5270('0x22')](_0x26576c)){logger[_0x5270('0x10')](_[_0x5270('0x23')](_0x26576c)?JSON[_0x5270('0xd')](_0x26576c):_0x26576c);}}_0xdc2c1d['on'](_0x5270('0x24'),_0x2aa4b2);_0xdc2c1d['on'](_0x5270('0x25'),_0x146f8c);_0xdc2c1d['on']('close',_0x5bf299);_0xdc2c1d['on'](_0x5270('0x10'),_0xf0fe59);});}; \ 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 60aa94d..10cb4be 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(_0x5de532,_0x2941c4){var _0x4e9192=function(_0x548a81){while(--_0x548a81){_0x5de532['push'](_0x5de532['shift']());}};_0x4e9192(++_0x2941c4);}(_0x70e0,0x17b));var _0x070e=function(_0x2461e5,_0x8812d5){_0x2461e5=_0x2461e5-0x0;var _0x16ec52=_0x70e0[_0x2461e5];return _0x16ec52;};var asr=require(_0x070e('0x0'));module[_0x070e('0x1')]={'asr':asr}; \ No newline at end of file +var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index ae37249..f0e5d0f 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 _0x605a=['E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','util','events','EventEmitter','./error','./channel','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections'];(function(_0x2002b3,_0x11e91c){var _0x2756f0=function(_0x4bf0b3){while(--_0x4bf0b3){_0x2002b3['push'](_0x2002b3['shift']());}};_0x2756f0(++_0x11e91c);}(_0x605a,0x1d7));var _0xa605=function(_0x5ef677,_0x1c0329){_0x5ef677=_0x5ef677-0x0;var _0x281c1e=_0x605a[_0x5ef677];return _0x281c1e;};'use strict';var util=require(_0xa605('0x0'));var net=require('net');var EventEmitter=require(_0xa605('0x1'))[_0xa605('0x2')];var AGIError=require(_0xa605('0x3'));var AGIChannel=require(_0xa605('0x4'));var AGIServer=function(_0x12a988,_0x2da672,_0xe4c2f0){var _0x143555=this,_0x12a988=_0x12a988||0x11dd,_0x2da672=_0x2da672||'127.0.0.1',_0x267687=null,_0x2bd0c9=0x0;EventEmitter['call'](_0x143555);function _0x3573f5(){if(!_0x12a988){_0x143555[_0xa605('0x5')](_0xa605('0x6'),new AGIError(_0xa605('0x7')));return![];}_0x267687=net[_0xa605('0x8')]();_0x267687[_0xa605('0x9')](_0x12a988,_0x2da672);_0x267687['on'](_0xa605('0xa'),function(){_0x143555[_0xa605('0x5')](_0xa605('0xa'));});_0x267687['on'](_0xa605('0xb'),function(_0x3bd73f){_0x267687[_0xa605('0xc')](function(_0x3a775a,_0x8fcde2){if(_0x3a775a){_0x143555[_0xa605('0x5')](_0xa605('0x6'),new AGIError(_0xa605('0xd'),_0x3a775a));}else if(_0xe4c2f0&&_0xe4c2f0<0x0){_0x143555[_0xa605('0x5')](_0xa605('0x6'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x3bd73f[_0xa605('0xe')]();}else if(_0xe4c2f0&&_0xe4c2f0>0x0&&_0xe4c2f0<_0x8fcde2){_0x2bd0c9+=0x1;_0x143555[_0xa605('0x5')]('error',new AGIError(_0xa605('0xf'),_0x2bd0c9));_0x3bd73f[_0xa605('0xe')]();}else{var _0x28d6f6=new AGIChannel(_0x3bd73f);_0x28d6f6['on'](_0xa605('0x10'),function(){_0x143555[_0xa605('0x5')](_0xa605('0xb'),_0x28d6f6);});}});});_0x267687['on'](_0xa605('0x6'),function(_0x442b8f){_0x143555[_0xa605('0x5')]('error',new AGIError(_0xa605('0xd'),_0x442b8f[_0xa605('0x11')]));});_0x267687['on'](_0xa605('0x12'),function(){_0x143555[_0xa605('0x5')](_0xa605('0x12'),new AGIError(_0xa605('0x13')));});}process[_0xa605('0x14')](function(){_0x3573f5();});};util['inherits'](AGIServer,EventEmitter);module[_0xa605('0x15')]=function(_0x3a8446,_0x3f19f0,_0x2ce4de){return new AGIServer(_0x3a8446,_0x3f19f0,_0x2ce4de);}; \ No newline at end of file +var _0x745d=['call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listening','connection','getConnections','E_AGI_SERVER_MAXCONNECTION','destroy','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','net','events','EventEmitter','./channel'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x745d,0xa4));var _0xd745=function(_0x5c40e7,_0xd96368){_0x5c40e7=_0x5c40e7-0x0;var _0x5bc219=_0x745d[_0x5c40e7];return _0x5bc219;};'use strict';var util=require('util');var net=require(_0xd745('0x0'));var EventEmitter=require(_0xd745('0x1'))[_0xd745('0x2')];var AGIError=require('./error');var AGIChannel=require(_0xd745('0x3'));var AGIServer=function(_0x4d9fd8,_0x159233,_0x310741){var _0x557e43=this,_0x4d9fd8=_0x4d9fd8||0x11dd,_0x159233=_0x159233||'127.0.0.1',_0x2b3b69=null,_0xe5cd1d=0x0;EventEmitter[_0xd745('0x4')](_0x557e43);function _0x45a085(){if(!_0x4d9fd8){_0x557e43[_0xd745('0x5')](_0xd745('0x6'),new AGIError(_0xd745('0x7')));return![];}_0x2b3b69=net[_0xd745('0x8')]();_0x2b3b69['listen'](_0x4d9fd8,_0x159233);_0x2b3b69['on'](_0xd745('0x9'),function(){_0x557e43[_0xd745('0x5')]('listening');});_0x2b3b69['on'](_0xd745('0xa'),function(_0x5abc35){_0x2b3b69[_0xd745('0xb')](function(_0xbfe74b,_0x4d83b0){if(_0xbfe74b){_0x557e43[_0xd745('0x5')]('error',new AGIError('E_AGI_SERVER_ERROR',_0xbfe74b));}else if(_0x310741&&_0x310741<0x0){_0x557e43[_0xd745('0x5')]('error',new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x5abc35['destroy']();}else if(_0x310741&&_0x310741>0x0&&_0x310741<_0x4d83b0){_0xe5cd1d+=0x1;_0x557e43[_0xd745('0x5')]('error',new AGIError(_0xd745('0xc'),_0xe5cd1d));_0x5abc35[_0xd745('0xd')]();}else{var _0x24995e=new AGIChannel(_0x5abc35);_0x24995e['on']('ready',function(){_0x557e43[_0xd745('0x5')]('connection',_0x24995e);});}});});_0x2b3b69['on'](_0xd745('0x6'),function(_0x3fd6b4){_0x557e43[_0xd745('0x5')]('error',new AGIError(_0xd745('0xe'),_0x3fd6b4[_0xd745('0xf')]));});_0x2b3b69['on'](_0xd745('0x10'),function(){_0x557e43[_0xd745('0x5')](_0xd745('0x10'),new AGIError(_0xd745('0x11')));});}process[_0xd745('0x12')](function(){_0x45a085();});};util[_0xd745('0x13')](AGIServer,EventEmitter);module[_0xd745('0x14')]=function(_0x376010,_0x2601a6,_0x2c9dec){return new AGIServer(_0x376010,_0x2601a6,_0x2c9dec);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 097ff06..3339ab2 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 _0x743e=['IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','success','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','response','digit','no\x20variable\x20found','Enter\x20in\x20NOOP\x20(%s)\x20block','output','getPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','PLAYBACK','queue','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','position','QUEUE','record','recordingFormat','%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','saynumber','sayNumber','number','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','service','host','port','secure','auth','user','pass','debug','Trying\x20SendMail\x20with\x20account\x20%s','sendMailMessage','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','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','START\x20CALLY\x20SQUARE','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','util','lodash','shelljs','odbc','mustache','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','menu','getdigits','getsecretdigits','channel','mailRpc','getVariable','rpc','getVariableById','then','name','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getTrunk','getTrunkById','getSoundById','getSoundPath','getMailAccount','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','createSquareRecording','callerid','calleridname','context','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','scheduledAt','callback','callback_priority','getPauseById','agentPause','agentUnpause','agentLogout','agent','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleTTS','text','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_text_type','awsLex','aws_lex_region','aws_bot_name','tildeASR','appid','appsecret','uri','clear','clone','hasOwnProperty','isString','replaceAllVariables','split','length','replaceAll','extra','toString','getAndSetVariable','result','setVariable','maxRetry','sync','retry','Enter\x20in\x20AGI\x20(%s)\x20block','label','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','timeout','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','delay','add','minutes','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','options','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','keys','forEach','%s_ROWS_COUNT','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','SESTEK_NDA_%s','out','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','SIP/%s/%s','url','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','getSound','file_id','no\x20file\x20audio\x20found','getData','maxdigit','test','stringify','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','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','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','googleASR','toUpperCase','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','wav','%s.%s','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','Enter\x20in\x20GOTOIF\x20(%s)\x20block','true','EVAL\x20CONDITION\x20%s\x20%s','condition','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)'];(function(_0xe3f0b0,_0x43edc9){var _0x3a839e=function(_0x45e9cf){while(--_0x45e9cf){_0xe3f0b0['push'](_0xe3f0b0['shift']());}};_0x3a839e(++_0x43edc9);}(_0x743e,0x7c));var _0xe743=function(_0xf1f073,_0xd08cea){_0xf1f073=_0xf1f073-0x0;var _0x3c0110=_0x743e[_0xf1f073];return _0x3c0110;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xe743('0x0'));var _=require(_0xe743('0x1'));var sh=require(_0xe743('0x2'));var odbc=require(_0xe743('0x3'))();var rs=require('randomstring');var moment=require('moment');var Mustache=require(_0xe743('0x4'));var logger=require(_0xe743('0x5'))(_0xe743('0x6'));var config=require('../../config/environment');var scripts=require(_0xe743('0x7'));var FILES_PATH=_0xe743('0x8');var verticesWithRetry=[_0xe743('0x9'),_0xe743('0xa'),_0xe743('0xb')];var AGIVertices=function(_0x2031ed,_0x4bdfb0,_0x7cd513){this[_0xe743('0xc')]=_0x2031ed;this['rpc']=_0x4bdfb0;this[_0xe743('0xd')]=_0x7cd513;};AGIVertices['prototype'][_0xe743('0xe')]=function(_0x2f6281,_0x3ebedd){this[_0xe743('0xf')][_0xe743('0x10')](_0x2f6281)[_0xe743('0x11')](function(_0x59c228){_0x3ebedd(null,_0x59c228?_0x59c228[_0xe743('0x12')]:![]);})[_0xe743('0x13')](function(_0x4225b5){_0x3ebedd(_0x4225b5);});};AGIVertices[_0xe743('0x14')][_0xe743('0x15')]=function(_0x3a37b1,_0x440ba7){this[_0xe743('0xf')][_0xe743('0x16')](_0x3a37b1)[_0xe743('0x11')](function(_0x2f0513){_0x440ba7(null,_0x2f0513?_0x2f0513[_0xe743('0x12')]:![]);})['catch'](function(_0x7ebbd){_0x440ba7(_0x7ebbd);});};AGIVertices[_0xe743('0x14')][_0xe743('0x17')]=function(_0x120992,_0x108187){this[_0xe743('0xf')][_0xe743('0x18')](_0x120992)['then'](function(_0x757b90){_0x108187(null,_0x757b90?_0x757b90['name']:![]);})[_0xe743('0x13')](function(_0x2ee16b){_0x108187(_0x2ee16b);});};AGIVertices[_0xe743('0x14')][_0xe743('0x19')]=function(_0x204579,_0x1dd086){this[_0xe743('0xf')]['getSquareOdbcById'](_0x204579)[_0xe743('0x11')](function(_0x310b5b){_0x1dd086(null,_0x310b5b?_0x310b5b[_0xe743('0x1a')]:![]);})[_0xe743('0x13')](function(_0x349e09){_0x1dd086(_0x349e09);});};AGIVertices[_0xe743('0x14')][_0xe743('0x1b')]=function(_0x1f6de6,_0x3f0ca4){this[_0xe743('0xf')]['getUserById'](_0x1f6de6)[_0xe743('0x11')](function(_0x14b96b){_0x3f0ca4(null,_0x14b96b?_0x14b96b[_0xe743('0x12')]:![]);})[_0xe743('0x13')](function(_0x406202){_0x3f0ca4(_0x406202);});};AGIVertices[_0xe743('0x14')][_0xe743('0x1c')]=function(_0x1d9664,_0x345c8e){this[_0xe743('0xf')][_0xe743('0x1d')](_0x1d9664)['then'](function(_0x237722){_0x345c8e(null,_0x237722?_0x237722[_0xe743('0x12')]:![]);})[_0xe743('0x13')](function(_0x18a958){_0x345c8e(_0x18a958);});};AGIVertices[_0xe743('0x14')]['getSound']=function(_0xd0b62,_0x5b8765){var _0x3ae1f1=this;this[_0xe743('0xf')][_0xe743('0x1e')](_0xd0b62)[_0xe743('0x11')](function(_0x2019a0){_0x5b8765(null,_0x2019a0?_0x3ae1f1[_0xe743('0x1f')](_0x2019a0['save_name']):![]);})[_0xe743('0x13')](function(_0x3a2a32){_0x5b8765(_0x3a2a32);});};AGIVertices['prototype'][_0xe743('0x20')]=function(_0x1784d2,_0x41e3dc){this[_0xe743('0xf')]['getMailAccountById'](_0x1784d2)[_0xe743('0x11')](function(_0x2c8d11){_0x41e3dc(null,_0x2c8d11?_0x2c8d11:![]);})[_0xe743('0x13')](function(_0x23a720){_0x41e3dc(_0x23a720);});};AGIVertices[_0xe743('0x14')]['sendMailMessage']=function(_0x5dd104,_0x391e9f,_0x2072fc){this[_0xe743('0xd')]['sendMailMessage'](_0x5dd104,_0x391e9f)['then'](function(){_0x2072fc(null);})[_0xe743('0x13')](function(_0x7d0bf6){_0x2072fc(_0x7d0bf6);});};AGIVertices[_0xe743('0x14')][_0xe743('0x21')]=function(_0x40f698,_0xba73fb){this[_0xe743('0xf')][_0xe743('0x22')](_0x40f698)[_0xe743('0x11')](function(_0x12988d){if(_0x12988d){if(_0x12988d[_0xe743('0x23')]){_0xba73fb(null,[_0x12988d[_0xe743('0x24')]]);}else{_0xba73fb(null,_[_0xe743('0x25')](_0x12988d[_0xe743('0x26')],'interval'));}}else{_0xba73fb(null,![]);}})[_0xe743('0x13')](function(_0xae8c92){_0xba73fb(_0xae8c92);});};AGIVertices[_0xe743('0x14')][_0xe743('0x1f')]=function(_0x290bd0){return util[_0xe743('0x27')](_0xe743('0x28'),FILES_PATH,_0x290bd0);};AGIVertices[_0xe743('0x14')][_0xe743('0x29')]=function(_0x5521aa,_0x45fa29,_0x2705c6){odbc[_0xe743('0x2a')](_0x5521aa,function(_0x28eb85){if(_0x28eb85){logger['error'](_0xe743('0x2b'),_0x28eb85);_0x2705c6(_0x28eb85);}else{logger[_0xe743('0x2c')](_0xe743('0x2d'));odbc['query'](_0x45fa29,function(_0x29de9f,_0x5cd8a6){if(_0x29de9f){logger[_0xe743('0x2c')]('Error\x20executing\x20query\x20%s',_0x45fa29);_0x2705c6(_0x29de9f);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x45fa29);odbc['close'](function(_0x593509){if(_0x593509){logger[_0xe743('0x2e')](_0xe743('0x2f'),_0x593509);}_0x2705c6(null,_0x5cd8a6);});}});}});};AGIVertices[_0xe743('0x14')][_0xe743('0x30')]=function(_0x59e8ce,_0x1aaf50){this[_0xe743('0xf')][_0xe743('0x31')](_0x59e8ce)[_0xe743('0x11')](function(_0xf7615b){_0x1aaf50(null,_0xf7615b?_0xf7615b:![]);})['catch'](function(_0xecfa2a){_0x1aaf50(_0xecfa2a);});};AGIVertices['prototype'][_0xe743('0x32')]=function(_0x169922,_0x2ee65b){this[_0xe743('0xf')][_0xe743('0x32')](_0x169922)[_0xe743('0x11')](function(_0x5abd10){_0x2ee65b(null,_0x5abd10);})['catch'](function(_0x66fd5){_0x2ee65b(_0x66fd5);});};AGIVertices[_0xe743('0x14')][_0xe743('0x33')]=function(_0x13996b,_0x32efc8,_0xdcdd3a){this[_0xe743('0xf')][_0xe743('0x33')]({'uniqueid':this[_0xe743('0xc')][_0xe743('0x34')],'node':_0x13996b['label'],'application':_0x13996b['agicommand'],'data':_0x32efc8||null,'project_name':this[_0xe743('0xc')]['arg_1'],'callerid':this[_0xe743('0xc')]['callerid']})[_0xe743('0x11')](function(_0x3ae5b3){if(_0xdcdd3a){_0xdcdd3a(null,_0x3ae5b3);}})[_0xe743('0x13')](function(_0x178187){if(_0xdcdd3a){_0xdcdd3a(_0x178187);}});};AGIVertices[_0xe743('0x14')]['createSquareRecording']=function(_0x197c3c,_0x46cbea,_0x53b351,_0x3f45e3){this[_0xe743('0xf')][_0xe743('0x35')]({'uniqueid':this['channel']['uniqueid'],'callerid':this['channel'][_0xe743('0x36')],'calleridname':this[_0xe743('0xc')][_0xe743('0x37')],'context':this['channel'][_0xe743('0x38')],'extension':this['channel']['extension'],'priority':this[_0xe743('0xc')][_0xe743('0x39')],'accountcode':this['channel'][_0xe743('0x3a')],'dnid':this['channel'][_0xe743('0x3b')],'projectName':this['channel'][_0xe743('0x3c')],'saveName':_0x46cbea,'filename':_0x197c3c[_0xe743('0x3d')]||_0x46cbea,'savePath':_0x53b351})[_0xe743('0x11')](function(_0x162a44){_0x3f45e3(null,_0x162a44);})[_0xe743('0x13')](function(_0x560635){_0x3f45e3(_0x560635);});};AGIVertices[_0xe743('0x14')]['createSquareMessage']=function(_0x3a1712,_0x268959,_0x482b26){this[_0xe743('0xf')][_0xe743('0x3e')]({'uniqueid':this['channel'][_0xe743('0x34')],'body':_0x3a1712,'direction':_0x268959})['then'](function(_0x347b27){if(_0x482b26){_0x482b26(null,_0x347b27);}})[_0xe743('0x13')](function(_0x297e1a){if(_0x482b26){_0x482b26(_0x297e1a);}});};AGIVertices['prototype'][_0xe743('0x3f')]=function(_0x2d48ab,_0x3f797a){this['rpc'][_0xe743('0x3f')]({'firstName':_[_0xe743('0x40')](_0x2d48ab['name'])||_[_0xe743('0x41')](_0x2d48ab['name'])?_0xe743('0x42')+Math['random']():_0x2d48ab[_0xe743('0x12')],'lastName':_[_0xe743('0x40')](_0x2d48ab[_0xe743('0x43')])||_[_0xe743('0x41')](_0x2d48ab['lastName'])?null:_0x2d48ab[_0xe743('0x43')],'phone':_0x2d48ab[_0xe743('0x44')],'ListId':_0x2d48ab['list_id'],'scheduledAt':_0x2d48ab[_0xe743('0x45')],'callbackUniqueid':this[_0xe743('0xc')][_0xe743('0x34')],'tags':_0xe743('0x46'),'description':'Callback\x20scheduled\x20at\x20'+_0x2d48ab['scheduledAt']['toString'](),'priority':_0x2d48ab[_0xe743('0x47')]})[_0xe743('0x11')](function(_0x39875d){_0x3f797a(null,_0x39875d);})[_0xe743('0x13')](function(_0x59ed85){_0x3f797a(_0x59ed85);});};AGIVertices[_0xe743('0x14')]['getPause']=function(_0x821b8f,_0x5b9c58){this['rpc'][_0xe743('0x48')](_0x821b8f)[_0xe743('0x11')](function(_0x454bd2){_0x5b9c58(null,_0x454bd2?_0x454bd2[_0xe743('0x12')]:![]);})[_0xe743('0x13')](function(_0x54408a){_0x5b9c58(_0x54408a);});};AGIVertices[_0xe743('0x14')][_0xe743('0x49')]=function(_0x25786b,_0xa49819,_0x522eea){var _0x5c3cf6={'role':'agent'};_0x5c3cf6[_0x25786b]=this[_0xe743('0xc')][_0xe743('0x36')];this[_0xe743('0xf')]['agentPause'](_0x5c3cf6,_0xa49819,this[_0xe743('0xc')][_0xe743('0x34')])['then'](function(_0x3a3e81){_0x522eea(null,_[_0xe743('0x41')](_0x3a3e81)?![]:!![]);})['catch'](function(_0x37c4e6){logger[_0xe743('0x2e')](_0x37c4e6);_0x522eea(null,![]);});};AGIVertices[_0xe743('0x14')][_0xe743('0x4a')]=function(_0x4c4541,_0x4de2ca){var _0x173063={'role':'agent'};_0x173063[_0x4c4541]=this[_0xe743('0xc')][_0xe743('0x36')];this[_0xe743('0xf')][_0xe743('0x4a')](_0x173063)[_0xe743('0x11')](function(_0xb66e5c){_0x4de2ca(null,_['isNil'](_0xb66e5c)?![]:!![]);})[_0xe743('0x13')](function(_0x1bc797){logger[_0xe743('0x2e')](_0x1bc797);_0x4de2ca(null,![]);});};AGIVertices[_0xe743('0x14')][_0xe743('0x4b')]=function(_0x163dbd,_0xa3dc2c){var _0x56d9d3={'role':_0xe743('0x4c')};_0x56d9d3[_0x163dbd]=this['channel']['callerid'];this[_0xe743('0xf')]['agentLogout'](_0x56d9d3)[_0xe743('0x11')](function(_0x5c3db8){_0xa3dc2c(null,_[_0xe743('0x41')](_0x5c3db8)?![]:!![]);})[_0xe743('0x13')](function(_0x4fd57c){logger['error'](_0x4fd57c);_0xa3dc2c(null,![]);});};AGIVertices[_0xe743('0x14')][_0xe743('0x4d')]=function(_0x2d4007,_0x2dfeae){var _0x138f40={'role':_0xe743('0x4c')};_0x138f40[_0x2d4007]=this[_0xe743('0xc')]['callerid'];var _0x56be98=_0x2d4007!=_0xe743('0x4e')?util[_0xe743('0x27')](_0xe743('0x4f'),_0xe743('0x50'),this[_0xe743('0xc')]['callerid']):undefined;this[_0xe743('0xf')][_0xe743('0x4d')](_0x138f40,_0x56be98)['then'](function(_0x20ba47){_0x2dfeae(null,_[_0xe743('0x41')](_0x20ba47)?![]:!![]);})['catch'](function(_0x1fe09d){logger[_0xe743('0x2e')](_0x1fe09d);_0x2dfeae(null,![]);});};AGIVertices['prototype'][_0xe743('0x51')]=function(_0x2b966f,_0x4a0262){sh[_0xe743('0x52')](_[_0xe743('0x53')](_0x2b966f),function(_0x3eb590,_0x123416){var _0x3be22e=_0x123416[_0xe743('0x54')](/(\r\n|\n|\r)/gm,'');_0x4a0262(null,_0x3be22e);});};AGIVertices[_0xe743('0x14')][_0xe743('0x55')]=function(_0x2ef103,_0x90cc0b){scripts[_0xe743('0x55')](_0x2ef103[_0xe743('0x56')],_0x2ef103['google_tts_language']||'en',0x1)[_0xe743('0x11')](function(_0x13da75){_0x90cc0b(null,_0x13da75);})[_0xe743('0x13')](function(_0x56654a){_0x90cc0b(_0x56654a);});};AGIVertices[_0xe743('0x14')][_0xe743('0x57')]=function(_0x3adb31,_0x48c360){scripts[_0xe743('0x57')](this[_0xe743('0xc')][_0xe743('0x34')],_0x3adb31[_0xe743('0x58')],_0x3adb31[_0xe743('0x56')],_0x3adb31[_0xe743('0x59')]||'en')[_0xe743('0x11')](function(_0x19cd36){_0x48c360(null,_0x19cd36);})['catch'](function(_0x248b4d){_0x48c360(_0x248b4d);});};AGIVertices[_0xe743('0x14')][_0xe743('0x5a')]=function(_0x3e39db,_0x120b0e){scripts[_0xe743('0x5a')](this[_0xe743('0xc')],_0x3e39db)[_0xe743('0x11')](function(_0x5b3c77){_0x120b0e(null,_0x5b3c77);})['catch'](function(_0x718a24){_0x120b0e(_0x718a24);});};AGIVertices[_0xe743('0x14')][_0xe743('0x5b')]=function(_0x16c41a,_0x2546c3){scripts[_0xe743('0x5b')](_0x16c41a['key'],_0x16c41a[_0xe743('0x56')],_0x16c41a[_0xe743('0x5c')]||_0xe743('0x5d'),_0x16c41a[_0xe743('0x5e')])[_0xe743('0x11')](function(_0x35c30a){_0x2546c3(null,_0x35c30a);})[_0xe743('0x13')](function(_0x4a81e8){_0x2546c3(_0x4a81e8);});};AGIVertices[_0xe743('0x14')][_0xe743('0x5f')]=function(_0x597623,_0x40869d,_0x57af2d){scripts['ispeechASR'](_0x40869d,_0x597623[_0xe743('0x58')],_0x597623[_0xe743('0x60')]||_0xe743('0x5d'),this[_0xe743('0x61')](_0x597623[_0xe743('0x62')])?_0x597623['model']:undefined)[_0xe743('0x11')](function(_0x193851){_0x57af2d(null,_0x193851);})[_0xe743('0x13')](function(_0x158808){_0x57af2d(_0x158808);});};AGIVertices[_0xe743('0x14')][_0xe743('0x63')]=function(_0x55a994,_0x40b7c5){scripts[_0xe743('0x63')](_0x55a994[_0xe743('0x64')],_0x55a994['aws_secret_access_key'],_0x55a994[_0xe743('0x65')],_0x55a994['aws_polly_voice']||'Amy',_0x55a994[_0xe743('0x56')],_0x55a994[_0xe743('0x66')]||_0xe743('0x56'))[_0xe743('0x11')](function(_0x5d71a4){_0x40b7c5(null,_0x5d71a4);})[_0xe743('0x13')](function(_0x13f9bb){_0x40b7c5(_0x13f9bb);});};AGIVertices['prototype'][_0xe743('0x67')]=function(_0x279a31,_0x1aec4a){scripts['awsLex'](this[_0xe743('0xc')][_0xe743('0x34')],_0x279a31[_0xe743('0x64')],_0x279a31['aws_secret_access_key'],_0x279a31[_0xe743('0x68')],_0x279a31[_0xe743('0x56')],_0x279a31[_0xe743('0x69')])[_0xe743('0x11')](function(_0x3ca5f0){_0x1aec4a(null,_0x3ca5f0);})[_0xe743('0x13')](function(_0x9b3c22){_0x1aec4a(_0x9b3c22);});};AGIVertices[_0xe743('0x14')]['googleASR']=function(_0x5566ae,_0x2cc679,_0x356ce2){scripts['googleASR'](_0x2cc679,_0x5566ae['key'],_0x5566ae['google_asr_language']||_0xe743('0x5d'))[_0xe743('0x11')](function(_0x4ffc98){_0x356ce2(null,_0x4ffc98);})[_0xe743('0x13')](function(_0x2c794f){_0x356ce2(_0x2c794f);});};AGIVertices['prototype']['tildeASR']=function(_0xc30e3d,_0x3beffc,_0x326241){scripts[_0xe743('0x6a')](_0x3beffc,_0xc30e3d[_0xe743('0x6b')],_0xc30e3d[_0xe743('0x6c')],_0xc30e3d[_0xe743('0x6d')])[_0xe743('0x11')](function(_0x83af24){_0x326241(null,_0x83af24);})[_0xe743('0x13')](function(_0x5247bd){_0x326241(_0x5247bd);});};AGIVertices['prototype'][_0xe743('0x6e')]=function(_0x341b51){var _0x2bc5ff=_['includes'](verticesWithRetry,_0x341b51['agicommand'])?_0x341b51:_[_0xe743('0x6f')](_0x341b51);for(var _0x459d8f in _0x2bc5ff){if(_0x2bc5ff[_0xe743('0x70')](_0x459d8f)){if(_0x2bc5ff[_0x459d8f]&&_[_0xe743('0x71')](_0x2bc5ff[_0x459d8f])){_0x2bc5ff[_0x459d8f]=this[_0xe743('0x72')](_0x2bc5ff[_0x459d8f]);}}}return _0x2bc5ff;};AGIVertices[_0xe743('0x14')][_0xe743('0x72')]=function(_0x43f2b3){var _0x3206d8=_0x43f2b3[_0xe743('0x73')]('{');for(var _0x5a6f69=0x1;_0x5a6f69<_0x3206d8[_0xe743('0x74')];_0x5a6f69+=0x1){var _0x14860c=_0x3206d8[_0x5a6f69][_0xe743('0x73')]('}');if(_0x14860c['length']>0x1){_0x43f2b3=_0x43f2b3[_0xe743('0x75')]('{'+_0x14860c[0x0]+'}',this[_0xe743('0xc')][_0xe743('0xe')](_0x14860c[0x0])[_0xe743('0x76')]||_0x14860c[0x0]);}}if(_0x3206d8['length']===0x1){return _0x43f2b3[_0xe743('0x77')]();}return this[_0xe743('0x72')](_0x43f2b3);};AGIVertices[_0xe743('0x14')][_0xe743('0x78')]=function(_0x39c14d,_0x5b9618){var _0x497581=this[_0xe743('0xc')]['getVariable'](_0x39c14d);if(_0x497581[_0xe743('0x79')]===-0x1){return _0x497581;}logger[_0xe743('0x2c')](util[_0xe743('0x27')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x5b9618,_0x497581['extra']));return this[_0xe743('0xc')][_0xe743('0x7a')](_0x5b9618,_0x497581[_0xe743('0x76')]);};AGIVertices[_0xe743('0x14')][_0xe743('0x61')]=function(_0x41618d){return _0x41618d&&_0x41618d!=='0'&&_0x41618d!=='-1'&&_0x41618d!=='';};AGIVertices['prototype'][_0xe743('0x7b')]=function(_0x4b872c){this['createSquareDetailsReport'][_0xe743('0x7c')](this,_0x4b872c,'-');_0x4b872c[_0xe743('0x7d')]=_0x4b872c[_0xe743('0x7b')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xe743('0x14')][_0xe743('0x6')]=function(_0x3c009e){logger[_0xe743('0x2c')](util['format'](_0xe743('0x7e'),_0x3c009e[_0xe743('0x7f')]));return this[_0xe743('0xc')]['agi']([_0x3c009e[_0xe743('0x80')],_0x3c009e[_0xe743('0x81')]]);};AGIVertices[_0xe743('0x14')][_0xe743('0x82')]=function(_0xe0c5e9){logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0x83'),_0xe0c5e9['label']));if(this['isConfigured'](_0xe0c5e9[_0xe743('0x84')])){logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0x85'),_0xe0c5e9[_0xe743('0x84')]));var _0x15faf6=this['channel'][_0xe743('0x86')](_0xe0c5e9[_0xe743('0x84')]);if(_0x15faf6['result']===-0x1){return _0x15faf6;}}return this[_0xe743('0xc')][_0xe743('0x82')]();};AGIVertices[_0xe743('0x14')][_0xe743('0x46')]=function(_0x522902){logger['info'](util[_0xe743('0x27')](_0xe743('0x87'),_0x522902[_0xe743('0x7f')]));if(!this['isConfigured'](_0x522902[_0xe743('0x88')])){return this['channel']['error'](_0x522902,'no\x20list\x20selected');}_0x522902['scheduledAt']=moment();if(this[_0xe743('0x61')](_0x522902[_0xe743('0x89')])){_0x522902[_0xe743('0x45')]=moment()[_0xe743('0x8a')](_0x522902[_0xe743('0x89')],_0xe743('0x8b'));}if(!this[_0xe743('0x61')](_0x522902[_0xe743('0x47')])){_0x522902[_0xe743('0x47')]=0x2;}this[_0xe743('0x3f')][_0xe743('0x7c')](this,_0x522902);return this[_0xe743('0xc')][_0xe743('0x8c')](util['format'](_0xe743('0x8d'),_0x522902[_0xe743('0x44')],_0x522902[_0xe743('0x88')],_0x522902['scheduledAt']));};AGIVertices[_0xe743('0x14')]['custom_app']=function(_0x59b178){logger[_0xe743('0x2c')](util['format'](_0xe743('0x8e'),_0x59b178['label']));var _0x36bcd7=this[_0xe743('0xc')][_0xe743('0x52')](_0x59b178[_0xe743('0x8f')],_0x59b178['options']);if(_0x36bcd7[_0xe743('0x79')]===-0x1){return _0x36bcd7;}return this[_0xe743('0xc')][_0xe743('0x8c')](util[_0xe743('0x27')]('Executed\x20command\x20%s\x20%s',_0x59b178[_0xe743('0x8f')],_0x59b178['options']));};AGIVertices[_0xe743('0x14')][_0xe743('0x90')]=function(_0x46425c){logger[_0xe743('0x2c')](util['format'](_0xe743('0x91'),_0x46425c[_0xe743('0x7f')]));if(!this[_0xe743('0x61')](_0x46425c[_0xe743('0x56')])){return this[_0xe743('0xc')][_0xe743('0x8c')]('no\x20text\x20configured');}var _0xfaee87='\x22'+_0x46425c[_0xe743('0x56')]+'\x22';if(this[_0xe743('0x61')](_0x46425c[_0xe743('0x92')])){_0xfaee87+=','+_0x46425c[_0xe743('0x92')];}var _0x5074fe=this[_0xe743('0xc')][_0xe743('0x52')]('MRCPSynth',_0xfaee87);if(_0x5074fe[_0xe743('0x79')]===-0x1){return _0x5074fe;}return this['channel'][_0xe743('0x8c')](util['format'](_0xe743('0x93'),_0xfaee87));};AGIVertices['prototype']['sestektts']=function(_0x4100e4){logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0x94'),_0x4100e4[_0xe743('0x7f')]));if(!this['isConfigured'](_0x4100e4[_0xe743('0x56')])){return this[_0xe743('0xc')]['noop'](_0xe743('0x95'));}var _0x55796c='\x22'+_0x4100e4[_0xe743('0x56')]+'\x22';if(this['isConfigured'](_0x4100e4['options'])){_0x55796c+=','+_0x4100e4[_0xe743('0x92')];}var _0x93d5a4=this[_0xe743('0xc')][_0xe743('0x52')](_0xe743('0x96'),_0x55796c);if(_0x93d5a4[_0xe743('0x79')]===-0x1){return _0x93d5a4;}return this[_0xe743('0xc')][_0xe743('0x8c')](util[_0xe743('0x27')](_0xe743('0x93'),_0x55796c));};AGIVertices['prototype'][_0xe743('0x97')]=function(_0x425dff){logger['info'](util[_0xe743('0x27')](_0xe743('0x98'),_0x425dff[_0xe743('0x7f')]));if(!this[_0xe743('0x61')](_0x425dff[_0xe743('0x99')])){return this[_0xe743('0xc')][_0xe743('0x8c')](_0xe743('0x9a'));}var _0x366a26=_0x425dff['grammar'];if(this[_0xe743('0x61')](_0x425dff[_0xe743('0x92')])){_0x366a26+=','+_0x425dff[_0xe743('0x92')];}var _0x523643=this[_0xe743('0xc')]['exec']('MRCPRecog',_0x366a26);if(_0x523643['result']===-0x1){return _0x523643;}var _0x21bba1=this['getAndSetVariable'](_0xe743('0x9b'),_0xe743('0x9c'));if(_0x21bba1[_0xe743('0x79')]===-0x1){return _0x21bba1;}var _0x402223=this['getAndSetVariable'](_0xe743('0x9d'),_0xe743('0x9e'));if(_0x402223['result']===-0x1){return _0x402223;}var _0x59dbae=this['getAndSetVariable'](_0xe743('0x9f'),_0xe743('0xa0'));if(_0x59dbae[_0xe743('0x79')]===-0x1){return _0x59dbae;}return this[_0xe743('0xc')][_0xe743('0x8c')](util[_0xe743('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0x366a26));};AGIVertices[_0xe743('0x14')][_0xe743('0xa1')]=function(_0xd2ffc7){logger[_0xe743('0x2c')](util['format'](_0xe743('0xa2'),_0xd2ffc7[_0xe743('0x7f')]));if(!this[_0xe743('0x61')](_0xd2ffc7[_0xe743('0x99')])){return this[_0xe743('0xc')][_0xe743('0x8c')](_0xe743('0x9a'));}var _0x3c14f9=_0xd2ffc7[_0xe743('0x99')];if(this[_0xe743('0x61')](_0xd2ffc7[_0xe743('0x92')])){_0x3c14f9+=','+_0xd2ffc7[_0xe743('0x92')];}var _0x42661b=this[_0xe743('0xc')][_0xe743('0x52')]('MRCPRecog',_0x3c14f9);if(_0x42661b['result']===-0x1){return _0x42661b;}var _0x4ca2e8=this[_0xe743('0x78')](_0xe743('0x9b'),_0xe743('0xa3'));if(_0x4ca2e8[_0xe743('0x79')]===-0x1){return _0x4ca2e8;}var _0x3cc4f4=this['getAndSetVariable']('RECOG_INPUT()',_0xe743('0xa4'));if(_0x3cc4f4[_0xe743('0x79')]===-0x1){return _0x3cc4f4;}var _0x5cce3f=this[_0xe743('0x78')](_0xe743('0x9f'),_0xe743('0xa5'));if(_0x5cce3f[_0xe743('0x79')]===-0x1){return _0x5cce3f;}return this['channel'][_0xe743('0x8c')](util['format'](_0xe743('0xa6'),_0x3c14f9));};AGIVertices[_0xe743('0x14')]['database']=function(_0x2ed023){logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0xa7'),_0x2ed023[_0xe743('0x7f')]));if(!this['isConfigured'](_0x2ed023[_0xe743('0xa8')])){return this[_0xe743('0xc')][_0xe743('0x2e')](_0x2ed023,_0xe743('0xa9'));}var _0x42ac1c=this[_0xe743('0x19')][_0xe743('0x7c')](this,_0x2ed023['odbc_id']);if(!_0x42ac1c){return this[_0xe743('0xc')]['error'](_0x2ed023,_0xe743('0xaa'));}if(!this[_0xe743('0x61')](_0x2ed023[_0xe743('0xab')])){return this[_0xe743('0xc')][_0xe743('0x2e')](_0x2ed023,'no\x20query\x20configured');}var _0x220651=_0x2ed023['query'][_0xe743('0x54')](/(\r\n|\n|\r)/gm,'\x20');this[_0xe743('0xc')][_0xe743('0x8c')](util[_0xe743('0x27')](_0xe743('0xac'),_0x220651));var _0x5cbe08=this[_0xe743('0x29')]['sync'](this,_0x42ac1c,_0x220651);this['createSquareDetailsReport'][_0xe743('0x7c')](this,_0x2ed023,_0x220651);if(!this['isConfigured'](_0x2ed023[_0xe743('0xad')])){return this[_0xe743('0xc')][_0xe743('0x8c')](_0xe743('0xae'));}var _0x3f303c=this[_0xe743('0xe')]['sync'](this,_0x2ed023['variable_id']);if(!_0x3f303c){return this[_0xe743('0xc')][_0xe743('0x2e')](_0x2ed023,'no\x20variable\x20found');}var _0x49411d=this;_0x5cbe08['forEach'](function(_0x2adea7,_0x53ecff){Object[_0xe743('0xaf')](_0x2adea7)[_0xe743('0xb0')](function(_0x267f22){_0x49411d[_0xe743('0xc')][_0xe743('0x7a')](util['format']('%s[%s][%s]',_0x3f303c,_0x53ecff,_0x267f22),_0x2adea7[_0x267f22]);});});this[_0xe743('0xc')]['setVariable'](util['format'](_0xe743('0xb1'),_0x3f303c),_0x5cbe08[_0xe743('0x74')]);return this['channel'][_0xe743('0x8c')](util['format']('variable\x20%s\x20set',_0x3f303c));};AGIVertices[_0xe743('0x14')][_0xe743('0xb2')]=function(_0x2d7a22){logger['debug'](util[_0xe743('0x27')](_0xe743('0xb3'),_0x2d7a22['label']));if(!this[_0xe743('0x61')](_0x2d7a22[_0xe743('0xb4')])){return this[_0xe743('0xc')][_0xe743('0x2e')](_0x2d7a22,_0xe743('0xb5'));}var _0x2b4c90=this[_0xe743('0x1b')][_0xe743('0x7c')](this,_0x2d7a22[_0xe743('0xb4')]);if(!_0x2b4c90){return this[_0xe743('0xc')][_0xe743('0x2e')](_0x2d7a22,'no\x20user\x20found');}var _0x3d7265=this[_0xe743('0xc')]['exec'](_0xe743('0xb6'),[util[_0xe743('0x27')]('SIP/%s',_0x2b4c90),_0x2d7a22[_0xe743('0x84')],_0x2d7a22[_0xe743('0xb7')],_0x2d7a22['url']]);if(_0x3d7265[_0xe743('0x79')]===-0x1){return _0x3d7265;}return this[_0xe743('0xc')]['noop'](util['format'](_0xe743('0xb8'),_0xe743('0xb6')));};AGIVertices[_0xe743('0x14')][_0xe743('0xb9')]=function(_0x52b875){logger['info'](util[_0xe743('0x27')](_0xe743('0xba'),_0x52b875[_0xe743('0x7f')]));if(!this['isConfigured'](_0x52b875[_0xe743('0x58')])){return this['channel'][_0xe743('0x8c')](_0xe743('0xbb'));}if(!this[_0xe743('0x61')](_0x52b875[_0xe743('0x56')])){return this[_0xe743('0xc')][_0xe743('0x8c')](_0xe743('0x95'));}this[_0xe743('0xc')][_0xe743('0xbc')]=!![];this[_0xe743('0x33')](_0x52b875);this[_0xe743('0x3e')](_0x52b875[_0xe743('0x56')],'in');this[_0xe743('0xc')]['noop'](util['format'](_0xe743('0xbd'),_0x52b875[_0xe743('0x56')]));var _0x40e63d=this[_0xe743('0x57')][_0xe743('0x7c')](this,_0x52b875);if(_0x40e63d){for(var _0x4bf092 in _0x40e63d){if(_0x40e63d['hasOwnProperty'](_0x4bf092)){this['channel'][_0xe743('0x7a')](util[_0xe743('0x27')](_0xe743('0xbe'),_0x4bf092['toUpperCase']()),_0x40e63d[_0x4bf092]);}}this[_0xe743('0x3e')](_0x40e63d['speech'],'out');return this[_0xe743('0xc')]['noop'](util[_0xe743('0x27')](_0xe743('0xbf'),_0x40e63d[_0xe743('0xc0')]));}return this['channel'][_0xe743('0x2e')](_0x52b875,_0xe743('0xc1'));};AGIVertices['prototype']['sesteknda']=function(_0xb0f85e){logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0xc2'),_0xb0f85e['label']));if(!this[_0xe743('0x61')](_0xb0f85e[_0xe743('0xc3')])){return this[_0xe743('0xc')][_0xe743('0x8c')](_0xe743('0xc4'));}if(!this['isConfigured'](_0xb0f85e[_0xe743('0xc5')])){return this['channel'][_0xe743('0x8c')](_0xe743('0xc6'));}if(!this[_0xe743('0x61')](_0xb0f85e[_0xe743('0xc7')])){return this[_0xe743('0xc')][_0xe743('0x8c')]('no\x20password\x20configured');}if(!this[_0xe743('0x61')](_0xb0f85e[_0xe743('0xc8')])){return this[_0xe743('0xc')][_0xe743('0x8c')](_0xe743('0x95'));}this[_0xe743('0xc')]['bot']=!![];this[_0xe743('0x33')](_0xb0f85e);this[_0xe743('0x3e')](_0xb0f85e[_0xe743('0x56')],'in');this[_0xe743('0xc')]['noop'](util[_0xe743('0x27')]('Trying\x20SestekNDA:\x20%s',_0xb0f85e[_0xe743('0x56')]));var _0x55dac6=this['sestekNDA']['sync'](this,_0xb0f85e);if(_0x55dac6){for(var _0x22ab7f in _0x55dac6){if(_0x55dac6['hasOwnProperty'](_0x22ab7f)){this[_0xe743('0xc')][_0xe743('0x7a')](util['format'](_0xe743('0xc9'),_0x22ab7f['toUpperCase']()),_0x55dac6[_0x22ab7f]);}}this[_0xe743('0x3e')](_0x55dac6[_0xe743('0xc0')],_0xe743('0xca'));if(_0x55dac6['audiofile']){this['channel']['noop'](util[_0xe743('0x27')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x55dac6[_0xe743('0xcb')]));var _0x58ac5a=this[_0xe743('0xc')][_0xe743('0xcc')](_0x55dac6['audiofile']);try{fs[_0xe743('0xcd')](_0x55dac6[_0xe743('0xcb')]+_0xe743('0xce'));}catch(_0x306be8){logger['error'](_0x306be8);}return _0x58ac5a;}else{return this[_0xe743('0xc')][_0xe743('0x8c')](util['format'](_0xe743('0xcf'),_0x55dac6[_0xe743('0xc0')]));}}return this[_0xe743('0xc')][_0xe743('0x2e')](_0xb0f85e,_0xe743('0xd0'));};AGIVertices[_0xe743('0x14')][_0xe743('0xd1')]=function(_0x330233){logger[_0xe743('0x2c')](util['format'](_0xe743('0xd2'),_0x330233[_0xe743('0x7f')]));return this[_0xe743('0xc')][_0xe743('0x8c')]('end');};AGIVertices[_0xe743('0x14')][_0xe743('0xd3')]=function(_0x583225){logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0xd4'),_0x583225[_0xe743('0x7f')]));var _0x22f1df='';if(_0x583225[_0xe743('0xd5')]){if(!this[_0xe743('0x61')](_0x583225[_0xe743('0xd5')])){return this[_0xe743('0xc')][_0xe743('0x2e')](_0x583225,'no\x20trunk\x20selected');}else{var _0x56940e=parseInt(_0x583225['trunk_id'],0xa);if(isNaN(_0x56940e)){_0x22f1df=_0x583225[_0xe743('0xd5')];}else{_0x22f1df=this[_0xe743('0x1c')]['sync'](this,_0x583225['trunk_id']);if(!_0x22f1df){return this['channel'][_0xe743('0x2e')](_0x583225,_0xe743('0xd6'));}}}}else if(_0x583225[_0xe743('0xd7')]){_0x22f1df=_0x583225[_0xe743('0xd7')];}else{return this[_0xe743('0xc')][_0xe743('0x2e')](_0x583225,'no\x20trunk\x20selected');}var _0x1fc010=this['channel'][_0xe743('0x52')](_0xe743('0xb6'),[util[_0xe743('0x27')](_0xe743('0xd8'),_0x22f1df,_0x583225[_0xe743('0x44')]),_0x583225[_0xe743('0x84')],_0x583225[_0xe743('0xb7')],_0x583225[_0xe743('0xd9')]]);if(_0x1fc010['result']===-0x1){return _0x1fc010;}return this[_0xe743('0xc')][_0xe743('0x8c')](util['format']('Executed\x20command\x20%s',_0xe743('0xb6')));};AGIVertices[_0xe743('0x14')][_0xe743('0xda')]=function(_0xa2028b){logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0xdb'),_0xa2028b[_0xe743('0x7f')]));return this[_0xe743('0xc')][_0xe743('0x8c')]('finally');};AGIVertices[_0xe743('0x14')][_0xe743('0xa')]=function(_0x4d9263){logger[_0xe743('0x2c')](util['format'](_0xe743('0xdc'),_0x4d9263['label']));if(_0x4d9263[_0xe743('0x7d')]===0x0){return this['maxRetry'](_0x4d9263);}_0x4d9263[_0xe743('0x7d')]-=0x1;if(!this[_0xe743('0x61')](_0x4d9263['file_id'])){return this[_0xe743('0xc')][_0xe743('0x2e')](_0x4d9263,_0xe743('0xdd'));}var _0x3fa249=this[_0xe743('0xde')][_0xe743('0x7c')](this,_0x4d9263[_0xe743('0xdf')]);if(!_0x3fa249){return this[_0xe743('0xc')][_0xe743('0x2e')](_0x4d9263,_0xe743('0xe0'));}if(!this[_0xe743('0x61')](_0x4d9263[_0xe743('0xad')])){return this[_0xe743('0xc')][_0xe743('0x2e')](_0xe743('0xae'));}var _0x282063=this[_0xe743('0xc')][_0xe743('0xe1')](_0x3fa249,_0x4d9263['response'],_0x4d9263[_0xe743('0xe2')]);var _0xd648b6=_0x282063[_0xe743('0x79')]?_0x282063[_0xe743('0x79')][_0xe743('0x77')]():'';logger[_0xe743('0x2c')](_0xe743('0xe3'),JSON[_0xe743('0xe4')](_0x282063));if(_0x282063[_0xe743('0x79')]===-0x1){this[_0xe743('0x33')][_0xe743('0x7c')](this,_0x4d9263,_0xd648b6);return _0x282063;}else if(_0x282063[_0xe743('0x76')]===_0xe743('0x84')){_0x282063['result']=_0xd648b6[_0xe743('0x74')]>=parseInt(_0x4d9263[_0xe743('0xe5')])?'x':'i';}else{_0x282063[_0xe743('0x79')]=_0xd648b6[_0xe743('0x74')]>=parseInt(_0x4d9263[_0xe743('0xe5')])&&_0xd648b6[_0xe743('0x74')]<=parseInt(_0x4d9263[_0xe743('0xe2')])?'x':'i';}var _0x23dadf=this[_0xe743('0xe')][_0xe743('0x7c')](this,_0x4d9263[_0xe743('0xad')]);if(!_0x23dadf){return this[_0xe743('0xc')][_0xe743('0x2e')](_0x4d9263,'no\x20variable\x20found');}this[_0xe743('0xc')][_0xe743('0x7a')](_0x23dadf,_0xd648b6);if(this['isConfigured'](_0x4d9263[_0xe743('0xe6')])){var _0xc7a167=parseInt(_0x4d9263[_0xe743('0xe6')],0xa);var _0x10ac52=rs[_0xe743('0xe7')]({'charset':'*','length':_0xc7a167});var _0x30bd96=_0xd648b6[_0xe743('0x74')];if(_0x30bd96>0x0){if(_0x30bd96>_0xc7a167){this['createSquareDetailsReport'][_0xe743('0x7c')](this,_0x4d9263,_0x4d9263[_0xe743('0xe8')]===_0xe743('0xe9')?_0x10ac52+_0xd648b6[_0xe743('0xea')](_0xc7a167):_0xd648b6['substr'](0x0,_0x30bd96-_0xc7a167)+_0x10ac52);}else{this[_0xe743('0x33')][_0xe743('0x7c')](this,_0x4d9263,rs['generate']({'charset':'*','length':_0x30bd96}));}}else{this[_0xe743('0x33')][_0xe743('0x7c')](this,_0x4d9263,'');}}else{this['createSquareDetailsReport'][_0xe743('0x7c')](this,_0x4d9263,_0xd648b6);}return _0x282063;};AGIVertices[_0xe743('0x14')]['getsecretdigits']=function(_0x2ead51){logger[_0xe743('0x2c')](util[_0xe743('0x27')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x2ead51[_0xe743('0x7f')]));return this[_0xe743('0xa')](_0x2ead51);};AGIVertices[_0xe743('0x14')][_0xe743('0xeb')]=function(_0x20c20d){logger[_0xe743('0x2c')](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x20c20d[_0xe743('0x7f')]));this[_0xe743('0x33')][_0xe743('0x7c')](this,_0x20c20d,_0x20c20d[_0xe743('0xec')]);return this[_0xe743('0xc')][_0xe743('0x8c')](util[_0xe743('0x27')](_0xe743('0xed'),_0x20c20d[_0xe743('0xec')]));};AGIVertices[_0xe743('0x14')][_0xe743('0xee')]=function(_0x264dcb){logger['info'](util[_0xe743('0x27')](_0xe743('0xef'),_0x264dcb['label']));if(!this[_0xe743('0x61')](_0x264dcb[_0xe743('0x64')])||!this[_0xe743('0x61')](_0x264dcb['aws_secret_access_key'])){return this[_0xe743('0xc')][_0xe743('0x8c')](_0xe743('0xf0'));}if(!this[_0xe743('0x61')](_0x264dcb['text'])){return this[_0xe743('0xc')][_0xe743('0x8c')]('no\x20text\x20configured');}this[_0xe743('0xc')][_0xe743('0x8c')](util[_0xe743('0x27')](_0xe743('0xf1'),_0x264dcb['text']));var _0x12035d=this[_0xe743('0x63')][_0xe743('0x7c')](this,_0x264dcb);if(_0x12035d){this[_0xe743('0xc')][_0xe743('0x8c')](util[_0xe743('0x27')](_0xe743('0xf2'),_0x12035d));var _0x18dbf6=this[_0xe743('0xc')]['streamFile'](_0x12035d);try{fs['unlink'](_0x12035d+_0xe743('0xce'));}catch(_0x376c2d){logger[_0xe743('0x2e')](_0x376c2d);}return _0x18dbf6;}return this[_0xe743('0xc')][_0xe743('0x2e')](_0x264dcb,_0xe743('0xf3'));};AGIVertices['prototype'][_0xe743('0xf4')]=function(_0x1e9c97){logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0xf5'),_0x1e9c97[_0xe743('0x7f')]));if(!this[_0xe743('0x61')](_0x1e9c97[_0xe743('0x64')])||!this[_0xe743('0x61')](_0x1e9c97['aws_secret_access_key'])){return this[_0xe743('0xc')][_0xe743('0x8c')](_0xe743('0xf0'));}if(!this['isConfigured'](_0x1e9c97[_0xe743('0x69')])){return this[_0xe743('0xc')][_0xe743('0x8c')](_0xe743('0xf6'));}if(!this[_0xe743('0x61')](_0x1e9c97['text'])){return this[_0xe743('0xc')][_0xe743('0x8c')]('no\x20text\x20configured');}this[_0xe743('0xc')][_0xe743('0xbc')]=!![];this['createSquareDetailsReport'](_0x1e9c97);this[_0xe743('0x3e')](_0x1e9c97[_0xe743('0x56')],'in');this[_0xe743('0xc')]['noop'](util[_0xe743('0x27')](_0xe743('0xf7'),_0x1e9c97[_0xe743('0x56')]));var _0x465f83=this[_0xe743('0x67')][_0xe743('0x7c')](this,_0x1e9c97);if(_0x465f83){for(var _0x843b2e in _0x465f83){if(_0x465f83[_0xe743('0x70')](_0x843b2e)&&_['isString'](_0x465f83[_0x843b2e])){this[_0xe743('0xc')][_0xe743('0x7a')](util[_0xe743('0x27')](_0xe743('0xf8'),_0x843b2e['toUpperCase']()),_0x465f83[_0x843b2e]);}}if(_['isNil'](_0x465f83[_0xe743('0xf9')])){return this[_0xe743('0xc')]['noop'](_0xe743('0xfa'));}else{this[_0xe743('0x3e')](_0x465f83['message'],_0xe743('0xca'));return this['channel'][_0xe743('0x8c')](util[_0xe743('0x27')](_0xe743('0xfb'),_0x465f83[_0xe743('0xf9')]));}}return this[_0xe743('0xc')][_0xe743('0x2e')](_0x1e9c97,_0xe743('0xfc'));};AGIVertices[_0xe743('0x14')]['googleasr']=function(_0x4ab13c){logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0xfd'),_0x4ab13c['label'],_0x4ab13c[_0xe743('0x84')]));if(!this[_0xe743('0x61')](_0x4ab13c[_0xe743('0x58')])){return this[_0xe743('0xc')]['noop'](_0xe743('0xbb'));}var _0x19e4d8='wav';var _0x237bb6=util[_0xe743('0x27')](_0xe743('0xfe'),FILES_PATH,rs[_0xe743('0xe7')](0x4));var _0xb80425=util[_0xe743('0x27')]('%s.%s',_0x237bb6,_0x19e4d8);var _0xc98073=!![];if(_0x4ab13c[_0xe743('0xff')]===_0xe743('0x100')){_0xc98073=![];}var _0x47ef2f=this[_0xe743('0xc')][_0xe743('0x101')](_0x237bb6,_0x19e4d8,_0x4ab13c[_0xe743('0x102')],_0x4ab13c['timeout'],undefined,_0xc98073);if(_0x47ef2f['result']!==-0x1){this[_0xe743('0xc')][_0xe743('0x8c')](util['format'](_0xe743('0x103'),_0xb80425));var _0x35cca8=this[_0xe743('0x104')][_0xe743('0x7c')](this,_0x4ab13c,_0xb80425);if(_0x35cca8){for(var _0x492d8f in _0x35cca8){if(_0x35cca8[_0xe743('0x70')](_0x492d8f)){this[_0xe743('0xc')]['setVariable'](util[_0xe743('0x27')]('GOOGLE_ASR_%s',_0x492d8f[_0xe743('0x105')]()),_0x35cca8[_0x492d8f]);}}return this[_0xe743('0xc')][_0xe743('0x8c')](util[_0xe743('0x27')](_0xe743('0x106'),JSON[_0xe743('0xe4')](_0x35cca8)));}}return _0x47ef2f;};AGIVertices[_0xe743('0x14')][_0xe743('0x107')]=function(_0x12d35e){logger['info'](util[_0xe743('0x27')](_0xe743('0x108'),_0x12d35e['label']));if(!this['isConfigured'](_0x12d35e['appid'])){return this['channel']['noop']('no\x20appid\x20configured');}if(!this['isConfigured'](_0x12d35e[_0xe743('0x6c')])){return this[_0xe743('0xc')][_0xe743('0x8c')](_0xe743('0x109'));}var _0x2a8ad0=_0xe743('0x10a');var _0xa05881=util[_0xe743('0x27')](_0xe743('0xfe'),FILES_PATH,rs[_0xe743('0xe7')](0x4));var _0x35ee90=util[_0xe743('0x27')](_0xe743('0x10b'),_0xa05881,_0x2a8ad0);var _0x51871a=!![];if(_0x12d35e[_0xe743('0xff')]===_0xe743('0x100')){_0x51871a=![];}var _0x146b1b=this['channel'][_0xe743('0x101')](_0xa05881,_0x2a8ad0,_0x12d35e[_0xe743('0x102')],_0x12d35e[_0xe743('0x84')],undefined,_0x51871a);if(_0x146b1b[_0xe743('0x79')]!==-0x1){this['channel'][_0xe743('0x8c')](util['format'](_0xe743('0x10c'),_0x35ee90));var _0x52320d=this[_0xe743('0x6a')][_0xe743('0x7c')](this,_0x12d35e,_0x35ee90);if(_0x52320d){for(var _0x218658 in _0x52320d){if(_0x52320d[_0xe743('0x70')](_0x218658)){this[_0xe743('0xc')][_0xe743('0x7a')](util[_0xe743('0x27')](_0xe743('0x10d'),_0x218658['toUpperCase']()),_0x52320d[_0x218658]);}}return this[_0xe743('0xc')]['noop'](util[_0xe743('0x27')](_0xe743('0x10e'),JSON[_0xe743('0xe4')](_0x52320d)));}}return _0x146b1b;};AGIVertices[_0xe743('0x14')]['gotoc']=function(_0x160630){logger[_0xe743('0x2c')](util['format'](_0xe743('0x10f'),_0x160630['label']));return this[_0xe743('0xc')][_0xe743('0x110')](_0x160630['context'],_0x160630[_0xe743('0x111')],_0x160630['priority']);};AGIVertices['prototype']['gotoif']=function(_0x3f51a7){logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0x112'),_0x3f51a7[_0xe743('0x7f')]));if(!this[_0xe743('0x61')](_0x3f51a7['condition'])){return this[_0xe743('0xc')][_0xe743('0x2e')](_0x3f51a7,'no\x20condition\x20configured');}try{var _0x587f61=eval(_0x3f51a7['condition'])?_0xe743('0x113'):'false';this[_0xe743('0xc')][_0xe743('0x8c')](util['format'](_0xe743('0x114'),_0x3f51a7[_0xe743('0x115')],_0x587f61));return{'code':0xc8,'result':_0x587f61};}catch(_0x249bcc){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xe743('0x14')][_0xe743('0x116')]=function(_0x4cba16){logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0x117'),_0x4cba16[_0xe743('0x7f')]));if(!this[_0xe743('0x61')](_0x4cba16[_0xe743('0x118')])){return this[_0xe743('0xc')][_0xe743('0x2e')](_0x4cba16,_0xe743('0x119'));}var _0x22c49e=this[_0xe743('0x21')][_0xe743('0x7c')](this,_0x4cba16[_0xe743('0x118')]);if(!_0x22c49e){return this['channel'][_0xe743('0x2e')](_0x4cba16,_0xe743('0x11a'));}for(var _0x646b8a=0x0;_0x646b8a<_0x22c49e[_0xe743('0x74')];_0x646b8a+=0x1){var _0x1fde63=this[_0xe743('0xc')][_0xe743('0xe')](util[_0xe743('0x27')](_0xe743('0x11b'),_0x22c49e[_0x646b8a]));if(_0x1fde63['result']===-0x1){return _0x1fde63;}logger[_0xe743('0x2c')](util['format'](_0xe743('0x11c'),_0x22c49e[_0x646b8a],_0x1fde63[_0xe743('0x76')]));if(_0x1fde63[_0xe743('0x76')]==='true'){logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0x11c'),_0x22c49e[_0x646b8a],_0xe743('0x113')));this[_0xe743('0xc')][_0xe743('0x8c')](util['format'](_0xe743('0x11c'),_0x22c49e[_0x646b8a],_0xe743('0x113')));return{'code':0xc8,'result':_0xe743('0x113')};}else{logger[_0xe743('0x2c')](util[_0xe743('0x27')]('IFTIME\x20%s\x20%s',_0x22c49e[_0x646b8a],'false'));this[_0xe743('0xc')][_0xe743('0x8c')](util['format']('IFTIME\x20%s\x20%s',_0x22c49e[_0x646b8a],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0xe743('0x11d')]=function(_0x1b39b6){logger['info'](util[_0xe743('0x27')](_0xe743('0x11e'),_0x1b39b6['label']));return this[_0xe743('0xc')][_0xe743('0x11d')]();};AGIVertices[_0xe743('0x14')][_0xe743('0x11f')]=function(_0x5e0732){logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0x120'),_0x5e0732[_0xe743('0x7f')]));if(!this[_0xe743('0x61')](_0x5e0732['key'])){return this[_0xe743('0xc')]['noop'](_0xe743('0xbb'));}var _0x57eb26='wav';var _0x5c0bd4=util['format'](_0xe743('0xfe'),FILES_PATH,rs[_0xe743('0xe7')](0x4));var _0x49100a=util[_0xe743('0x27')]('%s.%s',_0x5c0bd4,_0x57eb26);var _0x5699ef=!![];if(_0x5e0732['beep']===_0xe743('0x100')){_0x5699ef=![];}var _0x26237e=this[_0xe743('0xc')][_0xe743('0x101')](_0x5c0bd4,_0x57eb26,_0x5e0732[_0xe743('0x102')],_0x5e0732[_0xe743('0x84')],undefined,_0x5699ef);if(_0x26237e[_0xe743('0x79')]!==-0x1){this['channel'][_0xe743('0x8c')](util[_0xe743('0x27')]('ispeech\x20%s\x20file\x20created',_0x49100a));var _0x470bdf=this['ispeechASR'][_0xe743('0x7c')](this,_0x5e0732,_0x49100a);if(_0x470bdf){for(var _0x363800 in _0x470bdf){if(_0x470bdf[_0xe743('0x70')](_0x363800)){this[_0xe743('0xc')][_0xe743('0x7a')](util[_0xe743('0x27')](_0xe743('0x121'),_0x363800[_0xe743('0x105')]()),_0x470bdf[_0x363800]);}}return this[_0xe743('0xc')][_0xe743('0x8c')](util[_0xe743('0x27')]('IspeechASR\x20Result\x20%s',JSON[_0xe743('0xe4')](_0x470bdf)));}}return _0x26237e;};AGIVertices[_0xe743('0x14')]['ispeechtts']=function(_0x4403fa){logger['info'](util[_0xe743('0x27')](_0xe743('0x122'),_0x4403fa[_0xe743('0x7f')]));if(!this[_0xe743('0x61')](_0x4403fa[_0xe743('0x58')])){return this[_0xe743('0xc')]['noop']('no\x20key\x20configured');}if(!this[_0xe743('0x61')](_0x4403fa[_0xe743('0x56')])){return this[_0xe743('0xc')][_0xe743('0x8c')](_0xe743('0x95'));}this[_0xe743('0xc')][_0xe743('0x8c')](util[_0xe743('0x27')](_0xe743('0x123'),_0x4403fa['text']));var _0x1a5d9d=this[_0xe743('0x5b')][_0xe743('0x7c')](this,_0x4403fa);if(_0x1a5d9d){this[_0xe743('0xc')]['noop'](util[_0xe743('0x27')]('ispeech\x20%s\x20file\x20created',_0x1a5d9d));var _0x3455f6=this[_0xe743('0xc')][_0xe743('0xcc')](_0x1a5d9d,_0x4403fa[_0xe743('0x102')]);try{fs[_0xe743('0xcd')](_0x1a5d9d+'.wav');}catch(_0x4d489b){logger[_0xe743('0x2e')](_0x4d489b);}return _0x3455f6;}return this[_0xe743('0xc')][_0xe743('0x2e')](_0x4403fa,_0xe743('0x124'));};AGIVertices[_0xe743('0x14')][_0xe743('0x125')]=function(_0x7a96d0){logger['info'](util[_0xe743('0x27')](_0xe743('0x126'),_0x7a96d0['label']));if(!this['isConfigured'](_0x7a96d0['findBy'])){return this[_0xe743('0xc')][_0xe743('0x2e')](_0x7a96d0,'no\x20find\x20by\x20configured');}logger['info'](util['format'](_0xe743('0x127'),this['channel'][_0xe743('0x36')],_0x7a96d0['findBy']));var _0x72c79e=this[_0xe743('0x4d')][_0xe743('0x7c')](this,_0x7a96d0[_0xe743('0x128')]);if(_0x72c79e){logger['info'](util[_0xe743('0x27')](_0xe743('0x129'),this[_0xe743('0xc')][_0xe743('0x36')],_0x7a96d0[_0xe743('0x128')]));this[_0xe743('0xc')][_0xe743('0x8c')](util['format'](_0xe743('0x129'),this['channel'][_0xe743('0x36')],_0x7a96d0[_0xe743('0x128')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xe743('0x27')](_0xe743('0x12a'),this[_0xe743('0xc')][_0xe743('0x36')],_0x7a96d0[_0xe743('0x128')]));this[_0xe743('0xc')][_0xe743('0x8c')](util[_0xe743('0x27')](_0xe743('0x12a'),this[_0xe743('0xc')][_0xe743('0x36')],_0x7a96d0[_0xe743('0x128')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xe743('0x14')]['logout']=function(_0x533f8c){logger[_0xe743('0x2c')](util['format'](_0xe743('0x12b'),_0x533f8c[_0xe743('0x7f')]));if(!this[_0xe743('0x61')](_0x533f8c['findBy'])){return this[_0xe743('0xc')][_0xe743('0x2e')](_0x533f8c,_0xe743('0x12c'));}logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0x127'),this[_0xe743('0xc')][_0xe743('0x36')],_0x533f8c[_0xe743('0x128')]));var _0x4ffb3e=this[_0xe743('0x4b')][_0xe743('0x7c')](this,_0x533f8c[_0xe743('0x128')]);if(_0x4ffb3e){logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0x129'),this[_0xe743('0xc')][_0xe743('0x36')],_0x533f8c['findBy']));this['channel'][_0xe743('0x8c')](util[_0xe743('0x27')](_0xe743('0x129'),this['channel'][_0xe743('0x36')],_0x533f8c[_0xe743('0x128')]));return{'code':0xc8,'result':_0xe743('0x12d')};}else{logger[_0xe743('0x2c')](util[_0xe743('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe743('0xc')]['callerid'],_0x533f8c['findBy']));this[_0xe743('0xc')][_0xe743('0x8c')](util[_0xe743('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe743('0xc')][_0xe743('0x36')],_0x533f8c[_0xe743('0x128')]));return{'code':0xc8,'result':_0xe743('0x12e')};}};AGIVertices['prototype'][_0xe743('0x12f')]=function(_0x56ad8d){logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0x130'),_0x56ad8d['label']));if(!this['isConfigured'](_0x56ad8d[_0xe743('0x131')])){return this[_0xe743('0xc')][_0xe743('0x2e')](_0x56ad8d,_0xe743('0x132'));}this['channel']['noop'](util[_0xe743('0x27')](_0xe743('0x133'),_0x56ad8d[_0xe743('0x131')]));var _0x36b21a=eval(_0x56ad8d[_0xe743('0x131')]);if(!this['isConfigured'](_0x56ad8d[_0xe743('0xad')])){return this['channel'][_0xe743('0x8c')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x337126=this[_0xe743('0xe')]['sync'](this,_0x56ad8d['variable_id']);if(!_0x337126){return this[_0xe743('0xc')][_0xe743('0x2e')](_0x56ad8d,'no\x20variable\x20found');}if(_['isArray'](_0x36b21a)){var _0x256833=this;_0x36b21a['forEach'](function(_0x5821f7,_0x24d181){_0x256833[_0xe743('0xc')]['setVariable'](util[_0xe743('0x27')](_0xe743('0x134'),_0x337126,_0x24d181),_0x5821f7);});return this[_0xe743('0xc')]['noop'](util['format'](_0xe743('0x135'),_0x337126));}else{return this['channel'][_0xe743('0x7a')](_0x337126,_0x36b21a);}};AGIVertices[_0xe743('0x14')]['menu']=function(_0x347114){logger[_0xe743('0x2c')](util[_0xe743('0x27')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x347114[_0xe743('0x7f')]));if(_0x347114['retry']===0x0){return this[_0xe743('0x7b')](_0x347114);}_0x347114[_0xe743('0x7d')]-=0x1;if(!this[_0xe743('0x61')](_0x347114[_0xe743('0xdf')])){return this[_0xe743('0xc')]['error'](_0x347114,_0xe743('0xdd'));}var _0x543940=this[_0xe743('0xde')][_0xe743('0x7c')](this,_0x347114[_0xe743('0xdf')]);if(!_0x543940){return this['channel'][_0xe743('0x2e')](_0x347114,_0xe743('0xe0'));}var _0x224cf6=this[_0xe743('0xc')][_0xe743('0xe1')](_0x543940,_0x347114[_0xe743('0x136')],_0x347114[_0xe743('0x137')]);var _0x517e8f=_0x224cf6[_0xe743('0x79')];if(_0x224cf6[_0xe743('0x79')]===-0x1){this[_0xe743('0x33')][_0xe743('0x7c')](this,_0x347114,'-1');return _0x224cf6;}else if(_0x224cf6[_0xe743('0x76')]===_0xe743('0x84')){_0x224cf6[_0xe743('0x79')]=_0x224cf6[_0xe743('0x79')]['length']>0x0?_0x224cf6['result']:'t';}else if(_['isEmpty'](_0x224cf6[_0xe743('0x79')])){_0x224cf6['result']='#';_0x517e8f='#';}if(!this[_0xe743('0x61')](_0x347114[_0xe743('0xad')])){this[_0xe743('0xc')][_0xe743('0x8c')](_0xe743('0xae'));}else{var _0x393243=this[_0xe743('0xe')][_0xe743('0x7c')](this,_0x347114['variable_id']);if(!_0x393243){return this[_0xe743('0xc')][_0xe743('0x2e')](_0x347114,_0xe743('0x138'));}this[_0xe743('0xc')][_0xe743('0x7a')](_0x393243,_0x517e8f);}this['createSquareDetailsReport'][_0xe743('0x7c')](this,_0x347114,_0x517e8f);return _0x224cf6;};AGIVertices[_0xe743('0x14')][_0xe743('0x8c')]=function(_0x39208c){logger[_0xe743('0x2c')](util['format'](_0xe743('0x139'),_0x39208c['label']));return this[_0xe743('0xc')][_0xe743('0x8c')](_0x39208c[_0xe743('0x13a')]||_0x39208c[_0xe743('0x7f')]);};AGIVertices[_0xe743('0x14')]['pause']=function(_0xdeaf96){logger[_0xe743('0x2c')](util['format']('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0xdeaf96[_0xe743('0x7f')]));if(!this['isConfigured'](_0xdeaf96['findBy'])){return this[_0xe743('0xc')]['error'](_0xdeaf96,'no\x20find\x20by\x20configured');}logger[_0xe743('0x2c')](util['format'](_0xe743('0x127'),this[_0xe743('0xc')][_0xe743('0x36')],_0xdeaf96[_0xe743('0x128')]));var _0x513904=this[_0xe743('0x13b')][_0xe743('0x7c')](this,_0xdeaf96['pause_id']);var _0x42a997=this['agentPause'][_0xe743('0x7c')](this,_0xdeaf96['findBy'],_0x513904);if(_0x42a997){logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0x129'),this[_0xe743('0xc')][_0xe743('0x36')],_0xdeaf96['findBy']));this[_0xe743('0xc')]['noop'](util[_0xe743('0x27')](_0xe743('0x129'),this['channel'][_0xe743('0x36')],_0xdeaf96[_0xe743('0x128')]));return{'code':0xc8,'result':_0xe743('0x12d')};}else{logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0x12a'),this[_0xe743('0xc')][_0xe743('0x36')],_0xdeaf96[_0xe743('0x128')]));this[_0xe743('0xc')][_0xe743('0x8c')](util[_0xe743('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0xdeaf96['findBy']));return{'code':0xc8,'result':_0xe743('0x12e')};}};AGIVertices[_0xe743('0x14')][_0xe743('0x13c')]=function(_0xa8976){logger['info'](util['format'](_0xe743('0x13d'),_0xa8976[_0xe743('0x7f')]));if(!this[_0xe743('0x61')](_0xa8976[_0xe743('0xdf')])){return this['channel']['error'](_0xa8976,_0xe743('0xdd'));}var _0x5a928a=this[_0xe743('0xde')][_0xe743('0x7c')](this,_0xa8976[_0xe743('0xdf')]);if(!_0x5a928a){return this[_0xe743('0xc')]['error'](_0xa8976,'no\x20file\x20audio\x20found');}var _0x1341e5=this[_0xe743('0xc')]['exec']('PLAYBACK',[_0x5a928a,_0xa8976[_0xe743('0xb7')]]);if(_0x1341e5[_0xe743('0x79')]===-0x1){return _0x1341e5;}return this[_0xe743('0xc')][_0xe743('0x8c')](util[_0xe743('0x27')](_0xe743('0x13e'),_0xe743('0x13f'),_0x5a928a));};AGIVertices[_0xe743('0x14')][_0xe743('0x140')]=function(_0x39816f){logger[_0xe743('0x2c')](util[_0xe743('0x27')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x39816f[_0xe743('0x7f')]));if(!this[_0xe743('0x61')](_0x39816f['queue_id'])){return this['channel']['error'](_0x39816f,_0xe743('0x141'));}var _0x240556='';var _0x5d2aeb=parseInt(_0x39816f[_0xe743('0x142')],0xa);if(isNaN(_0x5d2aeb)){_0x240556=_0x39816f[_0xe743('0x142')];}else{_0x240556=this[_0xe743('0x15')][_0xe743('0x7c')](this,_0x39816f[_0xe743('0x142')]);if(!_0x240556){return this[_0xe743('0xc')][_0xe743('0x2e')](_0x39816f,_0xe743('0x143'));}}var _0x2e030f='';if(this[_0xe743('0x61')](_0x39816f[_0xe743('0xdf')])){var _0x474a06=this[_0xe743('0xde')][_0xe743('0x7c')](this,_0x39816f['file_id']);if(_0x474a06){_0x2e030f=_0x474a06;}}this['createSquareDetailsReport']['sync'](this,_0x39816f,_0x240556);if(_0x39816f[_0xe743('0xb7')][_0xe743('0x144')]('x')<0x0){_0x39816f[_0xe743('0xb7')]+='x';}if(_0x39816f[_0xe743('0xb7')]['indexOf']('X')<0x0){_0x39816f[_0xe743('0xb7')]+='X';}this[_0xe743('0xc')][_0xe743('0x7a')](_0xe743('0x145'),_0x240556?_0x240556[_0xe743('0x146')]():'');var _0x3acaaf=this[_0xe743('0xc')][_0xe743('0x52')]('QUEUE',[_0x240556,_0x39816f['opts'],_0x39816f[_0xe743('0xd9')],_0x2e030f,_0x39816f['timeout'],_0x39816f[_0xe743('0x6')],_0x39816f[_0xe743('0x147')],_0x39816f[_0xe743('0x148')],'',_0x39816f[_0xe743('0x149')]]);if(_0x3acaaf[_0xe743('0x79')]===-0x1){return _0x3acaaf;}return this['channel']['noop'](util[_0xe743('0x27')](_0xe743('0x13e'),_0xe743('0x14a'),_0x240556));};AGIVertices[_0xe743('0x14')][_0xe743('0x14b')]=function(_0x22d112){logger[_0xe743('0x2c')](util[_0xe743('0x27')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x22d112[_0xe743('0x7f')]));var _0x467a64=_0x22d112[_0xe743('0x14c')]||_0xe743('0x10a');var _0x426b4e=util[_0xe743('0x27')](_0xe743('0x14d'),this[_0xe743('0xc')][_0xe743('0x34')],rs[_0xe743('0xe7')](0x5));var _0x2829af=util[_0xe743('0x27')](_0xe743('0x14e'),FILES_PATH,_0x426b4e,_0x467a64);var _0xa00062=util[_0xe743('0x27')](_0xe743('0xfe'),FILES_PATH,_0x426b4e);this[_0xe743('0x35')][_0xe743('0x7c')](this,_0x22d112,_0x426b4e,_0x2829af);this['channel']['setVariable'](_0xe743('0x14f'),_0x426b4e);logger['info'](_0xe743('0x150'),_0xa00062,_0x467a64,_0x22d112[_0xe743('0x151')],_0x22d112[_0xe743('0x84')]);return this[_0xe743('0xc')][_0xe743('0x101')](_0xa00062,_0x467a64,_0x22d112[_0xe743('0x151')],_0x22d112[_0xe743('0x84')],undefined,!![]);};AGIVertices['prototype'][_0xe743('0x152')]=function(_0x9a89dc){logger['info'](util[_0xe743('0x27')](_0xe743('0x153'),_0x9a89dc[_0xe743('0x7f')]));return this[_0xe743('0xc')][_0xe743('0x154')](_0x9a89dc[_0xe743('0x155')]['replace'](/\s+/g,''),_0x9a89dc[_0xe743('0x151')]);};AGIVertices[_0xe743('0x14')][_0xe743('0x156')]=function(_0x561342){logger[_0xe743('0x2c')](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x561342[_0xe743('0x7f')]));return this[_0xe743('0xc')][_0xe743('0x157')](_0x561342[_0xe743('0x158')][_0xe743('0x54')](/\s+/g,''),_0x561342[_0xe743('0x151')]);};AGIVertices['prototype']['sayphonetic']=function(_0x81639b){logger[_0xe743('0x2c')](util[_0xe743('0x27')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x81639b[_0xe743('0x7f')]));return this[_0xe743('0xc')][_0xe743('0x159')](_0x81639b['text'],_0x81639b[_0xe743('0x151')]);};AGIVertices[_0xe743('0x14')][_0xe743('0x15a')]=function(_0x5eb155){logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0x15b'),_0x5eb155[_0xe743('0x7f')]));if(!this[_0xe743('0x61')](_0x5eb155[_0xe743('0x15c')])){return this['channel']['noop'](_0xe743('0x15d'));}var _0x251ae5=this[_0xe743('0x20')][_0xe743('0x7c')](this,_0x5eb155[_0xe743('0x15c')]);if(!_0x251ae5||!_0x251ae5[_0xe743('0x15e')]){return this[_0xe743('0xc')][_0xe743('0x2e')](_0x5eb155,_0xe743('0x15f'));}var _0x33aeb4={'from':util[_0xe743('0x27')](_0xe743('0x160'),_0x251ae5[_0xe743('0x12')],_0x251ae5[_0xe743('0x161')]||_0x251ae5['Smtp']['user']),'to':_0x5eb155['to']||'','cc':_0x5eb155['cc']||'','bcc':_0x5eb155[_0xe743('0x162')]||'','subject':_0x5eb155[_0xe743('0x163')],'html':_0x5eb155['text'],'text':_0x5eb155[_0xe743('0x56')]};var _0x48f76b={'tls':{'rejectUnauthorized':![]}};if(_0x251ae5[_0xe743('0x15e')][_0xe743('0x164')]){_0x48f76b['service']=_0x251ae5[_0xe743('0x15e')][_0xe743('0x164')];}else{_0x48f76b[_0xe743('0x165')]=_0x251ae5[_0xe743('0x15e')][_0xe743('0x165')];_0x48f76b[_0xe743('0x166')]=_0x251ae5['Smtp'][_0xe743('0x166')];_0x48f76b[_0xe743('0x167')]=_0x251ae5[_0xe743('0x15e')][_0xe743('0x167')];}if(_0x251ae5['Smtp']['authentication']){_0x48f76b[_0xe743('0x168')]={'user':_0x251ae5[_0xe743('0x15e')][_0xe743('0x169')],'pass':_0x251ae5[_0xe743('0x15e')][_0xe743('0x16a')]};}if(this[_0xe743('0x61')](_0x5eb155['template_id'])){}logger[_0xe743('0x16b')]('sendMail\x20message',JSON[_0xe743('0xe4')](_0x33aeb4));this[_0xe743('0x33')][_0xe743('0x7c')](this,_0x5eb155,_0x5eb155[_0xe743('0x15c')]);this[_0xe743('0xc')][_0xe743('0x8c')](util['format'](_0xe743('0x16c'),_0x251ae5[_0xe743('0x12')]));this[_0xe743('0x16d')]['sync'](this,_0x48f76b,_0x33aeb4);return this[_0xe743('0xc')]['noop'](_0xe743('0x16e'));};AGIVertices[_0xe743('0x14')][_0xe743('0x16f')]=function(_0x10ca25){logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0x170'),_0x10ca25[_0xe743('0x7f')]));return this[_0xe743('0xc')][_0xe743('0x8c')](_0xe743('0x171'));};AGIVertices[_0xe743('0x14')][_0xe743('0x172')]=function(_0x325d41){logger['info'](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x325d41[_0xe743('0x7f')]));if(!this[_0xe743('0x61')](_0x325d41[_0xe743('0x173')])){return this[_0xe743('0xc')][_0xe743('0x8c')](_0xe743('0x174'));}var _0x48095b=this[_0xe743('0x30')][_0xe743('0x7c')](this,_0x325d41[_0xe743('0x173')]);if(!_0x48095b){return this['channel'][_0xe743('0x2e')](_0x325d41,_0xe743('0x175'));}var _0x272b52={'body':_0x325d41[_0xe743('0x176')],'phone':_0x325d41['to']||'','SmsAccountId':_0x48095b['id']};logger[_0xe743('0x16b')]('sendSMS\x20message',JSON[_0xe743('0xe4')](_0x272b52));this['createSquareDetailsReport'][_0xe743('0x7c')](this,_0x325d41,_0x325d41['sms_account_id']);this['channel']['noop'](util['format'](_0xe743('0x177'),_0x48095b[_0xe743('0x12')]));this[_0xe743('0x32')][_0xe743('0x7c')](this,_0x272b52);return this[_0xe743('0xc')]['noop'](_0xe743('0x178'));};AGIVertices[_0xe743('0x14')][_0xe743('0x179')]=function(_0x2a7c4e){logger['info'](util[_0xe743('0x27')](_0xe743('0x17a'),_0x2a7c4e[_0xe743('0x7f')]));if(!this[_0xe743('0x61')](_0x2a7c4e[_0xe743('0xad')])){return this[_0xe743('0xc')][_0xe743('0x2e')](_0x2a7c4e,_0xe743('0x17b'));}var _0x4a5eb8=this[_0xe743('0xe')]['sync'](this,_0x2a7c4e[_0xe743('0xad')]);if(!_0x4a5eb8){return this[_0xe743('0xc')][_0xe743('0x2e')](_0x2a7c4e,_0xe743('0x138'));}return this['channel'][_0xe743('0x7a')](_0x4a5eb8,_0x2a7c4e[_0xe743('0x17c')]);};AGIVertices[_0xe743('0x14')][_0xe743('0x17d')]=function(_0x3d3d83){logger[_0xe743('0x2c')](util[_0xe743('0x27')]('Enter\x20in\x20START\x20(%s)\x20block',_0x3d3d83[_0xe743('0x7f')]));this[_0xe743('0xc')][_0xe743('0x8c')](_0xe743('0x17e'));if(_0x3d3d83[_0xe743('0x82')]===_0xe743('0x17f')){this['channel']['noop'](_0xe743('0x180'));return this['channel']['answer']();}return this[_0xe743('0xc')][_0xe743('0x8c')]('Skipped\x20Answer');};AGIVertices['prototype'][_0xe743('0x181')]=function(_0x45618b){logger[_0xe743('0x2c')](util['format'](_0xe743('0x182'),_0x45618b[_0xe743('0x7f')]));if(!this[_0xe743('0x61')](_0x45618b[_0xe743('0x183')])){return this[_0xe743('0xc')][_0xe743('0x2e')](_0x45618b,_0xe743('0x184'));}var _0x23d930=this[_0xe743('0x17')][_0xe743('0x7c')](this,_0x45618b[_0xe743('0x183')]);if(!this[_0xe743('0x61')](_0x23d930)){return this[_0xe743('0xc')][_0xe743('0x2e')](_0x45618b,util[_0xe743('0x27')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x45618b[_0xe743('0x183')]));}if(_0x23d930===this[_0xe743('0xc')][_0xe743('0x3c')]){return this[_0xe743('0xc')]['error'](_0x45618b,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xe743('0x33')]['sync'](this,_0x45618b,_0x23d930);var _0x40067c=this[_0xe743('0xc')][_0xe743('0x52')]('AGI',util['format'](_0xe743('0x185'),config[_0xe743('0x6')][_0xe743('0x165')]||_0xe743('0x186'),_0x23d930,this[_0xe743('0xc')]['arg_1']));if(_0x40067c['result']===-0x1){return _0x40067c;}return this[_0xe743('0xc')][_0xe743('0x8c')](util['format'](_0xe743('0x13e'),_0xe743('0x187'),_0x23d930));};AGIVertices[_0xe743('0x14')][_0xe743('0x188')]=function(_0x403c84){logger['info'](util['format'](_0xe743('0x189'),_0x403c84[_0xe743('0x7f')]));var _0x10249c=this['shellCommand'][_0xe743('0x7c')](this,_0x403c84['command']);this[_0xe743('0x33')][_0xe743('0x7c')](this,_0x403c84,_0x403c84['command']);if(this[_0xe743('0x61')](_0x403c84['variable_id'])){var _0x43dd4e=this[_0xe743('0xe')]['sync'](this,_0x403c84[_0xe743('0xad')]);if(_0x43dd4e){this[_0xe743('0xc')][_0xe743('0x7a')](_0x43dd4e,_0x10249c);return this['channel']['noop'](util[_0xe743('0x27')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x403c84[_0xe743('0x80')],_0x43dd4e));}}return this[_0xe743('0xc')][_0xe743('0x8c')](util[_0xe743('0x27')](_0xe743('0x18a'),_0x403c84[_0xe743('0x80')]));};AGIVertices[_0xe743('0x14')][_0xe743('0x18b')]=function(_0x3d6b49){logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0x18c'),_0x3d6b49['label']));if(!this[_0xe743('0x61')](_0x3d6b49[_0xe743('0x56')])){return this[_0xe743('0xc')]['noop']('no\x20text\x20configured');}this['channel'][_0xe743('0x8c')](util['format'](_0xe743('0x18d'),_0x3d6b49[_0xe743('0x56')]));var _0x26d20e=this[_0xe743('0x55')]['sync'](this,_0x3d6b49);if(_0x26d20e){this[_0xe743('0xc')][_0xe743('0x8c')](util['format'](_0xe743('0x18e'),_0x26d20e));var _0x1d2d07=this[_0xe743('0xc')][_0xe743('0xcc')](_0x26d20e);try{fs['unlink'](_0x26d20e+_0xe743('0xce'));}catch(_0x919b27){logger['error'](_0x919b27);}return _0x1d2d07;}return this[_0xe743('0xc')][_0xe743('0x2e')](_0x3d6b49,_0xe743('0x18f'));};AGIVertices[_0xe743('0x14')][_0xe743('0x190')]=function(_0x43e92d){logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0x191'),_0x43e92d['label']));if(!this[_0xe743('0x61')](_0x43e92d[_0xe743('0x128')])){return this[_0xe743('0xc')][_0xe743('0x2e')](_0x43e92d,'no\x20find\x20by\x20configured');}logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0x127'),this[_0xe743('0xc')][_0xe743('0x36')],_0x43e92d[_0xe743('0x128')]));var _0x3a60d1=this[_0xe743('0x4a')][_0xe743('0x7c')](this,_0x43e92d['findBy']);if(_0x3a60d1){logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0x129'),this[_0xe743('0xc')][_0xe743('0x36')],_0x43e92d[_0xe743('0x128')]));this[_0xe743('0xc')][_0xe743('0x8c')](util[_0xe743('0x27')](_0xe743('0x129'),this[_0xe743('0xc')][_0xe743('0x36')],_0x43e92d[_0xe743('0x128')]));return{'code':0xc8,'result':'success'};}else{logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0x12a'),this[_0xe743('0xc')]['callerid'],_0x43e92d[_0xe743('0x128')]));this[_0xe743('0xc')][_0xe743('0x8c')](util[_0xe743('0x27')](_0xe743('0x12a'),this[_0xe743('0xc')][_0xe743('0x36')],_0x43e92d['findBy']));return{'code':0xc8,'result':_0xe743('0x12e')};}};AGIVertices['prototype'][_0xe743('0x192')]=function(_0x8f3086){logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0x193'),_0x8f3086[_0xe743('0x7f')]));var _0x3d50b4=this['channel'][_0xe743('0x52')]('VOICEMAIL',[_0x8f3086[_0xe743('0x194')],_0x8f3086[_0xe743('0x92')]]);if(_0x3d50b4[_0xe743('0x79')]===-0x1){return _0x3d50b4;}return this[_0xe743('0xc')]['noop'](util[_0xe743('0x27')]('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x8f3086[_0xe743('0x194')]));};AGIVertices[_0xe743('0x14')][_0xe743('0x195')]=function(_0xd86e93){logger[_0xe743('0x2c')](util[_0xe743('0x27')](_0xe743('0x196'),_0xd86e93[_0xe743('0x7f')]));if(!this[_0xe743('0x61')](_0xd86e93['variable_id'])){return this[_0xe743('0xc')][_0xe743('0x2e')](_0xd86e93,'no\x20variable\x20selected');}var _0x3370f8=this[_0xe743('0xe')][_0xe743('0x7c')](this,_0xd86e93[_0xe743('0xad')]);if(!_0x3370f8){return this['channel']['error'](_0xd86e93,'no\x20variable\x20found');}var _0x2c912f=this['channel'][_0xe743('0xe')](_0x3370f8);return{'code':0xc8,'result':_0x2c912f[_0xe743('0x76')]?_0x2c912f[_0xe743('0x76')]:'-'};};String['prototype'][_0xe743('0x75')]=function(_0x3c4278,_0x43619e){return this[_0xe743('0x73')](_0x3c4278)['join'](_0x43619e);};module[_0xe743('0x197')]=AGIVertices; \ No newline at end of file +var _0x1065=['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','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','maxdigit','test','stringify','mindigit','no\x20variable\x20found','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','%s.%s','beep','NOBEEP','recordFile','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','agentLogout','AGENT\x20%s\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','no\x20mail\x20account\x20found','email','Smtp','user','bcc','subject','service','host','secure','authentication','auth','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','createSmsMessage','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','exports','shelljs','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','menu','getdigits','getsecretdigits','channel','mailRpc','getVariable','rpc','getVariableById','then','name','catch','prototype','getVoiceQueue','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','Intervals','interval','format','%s/sounds/converted/%s','getQueryOdbc','open','error','ODBC\x20connection\x20successfully','info','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSquareDetailsReport','label','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','googleTTS','text','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','en-US','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appsecret','uri','includes','clone','hasOwnProperty','isString','replaceAllVariables','split','length','replaceAll','extra','getAndSetVariable','result','maxRetry','sync','retry','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','timeout','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','options','noop','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','setVariable','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id'];(function(_0x43f836,_0x17df0c){var _0x160fd9=function(_0x3ae992){while(--_0x3ae992){_0x43f836['push'](_0x43f836['shift']());}};_0x160fd9(++_0x17df0c);}(_0x1065,0xd9));var _0x5106=function(_0x169a0d,_0x2d7f46){_0x169a0d=_0x169a0d-0x0;var _0x440c7b=_0x1065[_0x169a0d];return _0x440c7b;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var _=require('lodash');var sh=require(_0x5106('0x0'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0x5106('0x1'));var Mustache=require(_0x5106('0x2'));var logger=require(_0x5106('0x3'))(_0x5106('0x4'));var config=require(_0x5106('0x5'));var scripts=require(_0x5106('0x6'));var FILES_PATH=_0x5106('0x7');var verticesWithRetry=[_0x5106('0x8'),_0x5106('0x9'),_0x5106('0xa')];var AGIVertices=function(_0x1f63c5,_0x39e004,_0x3a0e97){this[_0x5106('0xb')]=_0x1f63c5;this['rpc']=_0x39e004;this[_0x5106('0xc')]=_0x3a0e97;};AGIVertices['prototype'][_0x5106('0xd')]=function(_0x5e2e09,_0x49ac1b){this[_0x5106('0xe')][_0x5106('0xf')](_0x5e2e09)[_0x5106('0x10')](function(_0x595171){_0x49ac1b(null,_0x595171?_0x595171[_0x5106('0x11')]:![]);})[_0x5106('0x12')](function(_0x507baf){_0x49ac1b(_0x507baf);});};AGIVertices[_0x5106('0x13')][_0x5106('0x14')]=function(_0x22e0db,_0x28f0ce){this[_0x5106('0xe')]['getVoiceQueueById'](_0x22e0db)['then'](function(_0x51b696){_0x28f0ce(null,_0x51b696?_0x51b696['name']:![]);})['catch'](function(_0x2a4f3e){_0x28f0ce(_0x2a4f3e);});};AGIVertices[_0x5106('0x13')][_0x5106('0x15')]=function(_0x54cc69,_0x2f6c61){this['rpc'][_0x5106('0x16')](_0x54cc69)[_0x5106('0x10')](function(_0x2d8ec5){_0x2f6c61(null,_0x2d8ec5?_0x2d8ec5[_0x5106('0x11')]:![]);})[_0x5106('0x12')](function(_0x5c7282){_0x2f6c61(_0x5c7282);});};AGIVertices[_0x5106('0x13')][_0x5106('0x17')]=function(_0x127ffe,_0x55ed29){this[_0x5106('0xe')][_0x5106('0x18')](_0x127ffe)[_0x5106('0x10')](function(_0x12594e){_0x55ed29(null,_0x12594e?_0x12594e['dsn']:![]);})[_0x5106('0x12')](function(_0x4910){_0x55ed29(_0x4910);});};AGIVertices[_0x5106('0x13')][_0x5106('0x19')]=function(_0xd9eaeb,_0x2f5b5e){this[_0x5106('0xe')][_0x5106('0x1a')](_0xd9eaeb)['then'](function(_0x2f105a){_0x2f5b5e(null,_0x2f105a?_0x2f105a[_0x5106('0x11')]:![]);})[_0x5106('0x12')](function(_0x13c2b6){_0x2f5b5e(_0x13c2b6);});};AGIVertices[_0x5106('0x13')][_0x5106('0x1b')]=function(_0x5512fb,_0x6ae68f){this[_0x5106('0xe')][_0x5106('0x1c')](_0x5512fb)['then'](function(_0x273890){_0x6ae68f(null,_0x273890?_0x273890[_0x5106('0x11')]:![]);})['catch'](function(_0x3e06de){_0x6ae68f(_0x3e06de);});};AGIVertices[_0x5106('0x13')][_0x5106('0x1d')]=function(_0x5c71a7,_0x401088){var _0x1f4e8a=this;this['rpc'][_0x5106('0x1e')](_0x5c71a7)[_0x5106('0x10')](function(_0x4dc23f){_0x401088(null,_0x4dc23f?_0x1f4e8a[_0x5106('0x1f')](_0x4dc23f[_0x5106('0x20')]):![]);})['catch'](function(_0xc55c2d){_0x401088(_0xc55c2d);});};AGIVertices['prototype'][_0x5106('0x21')]=function(_0x4e4e8b,_0x565e97){this[_0x5106('0xe')][_0x5106('0x22')](_0x4e4e8b)['then'](function(_0x13fba4){_0x565e97(null,_0x13fba4?_0x13fba4:![]);})['catch'](function(_0x245dbb){_0x565e97(_0x245dbb);});};AGIVertices[_0x5106('0x13')][_0x5106('0x23')]=function(_0x5e504b,_0x4849f5,_0x4a8b14){this[_0x5106('0xc')][_0x5106('0x23')](_0x5e504b,_0x4849f5)[_0x5106('0x10')](function(){_0x4a8b14(null);})[_0x5106('0x12')](function(_0x266da0){_0x4a8b14(_0x266da0);});};AGIVertices[_0x5106('0x13')][_0x5106('0x24')]=function(_0xa205ca,_0x552138){this[_0x5106('0xe')][_0x5106('0x25')](_0xa205ca)[_0x5106('0x10')](function(_0x3ce790){if(_0x3ce790){if(_0x3ce790[_0x5106('0x26')]){_0x552138(null,[_0x3ce790['interval']]);}else{_0x552138(null,_['map'](_0x3ce790[_0x5106('0x27')],_0x5106('0x28')));}}else{_0x552138(null,![]);}})['catch'](function(_0x3b5731){_0x552138(_0x3b5731);});};AGIVertices[_0x5106('0x13')]['getSoundPath']=function(_0x3b6672){return util[_0x5106('0x29')](_0x5106('0x2a'),FILES_PATH,_0x3b6672);};AGIVertices[_0x5106('0x13')][_0x5106('0x2b')]=function(_0x4c437e,_0x41d703,_0x1074f4){odbc[_0x5106('0x2c')](_0x4c437e,function(_0x509838){if(_0x509838){logger[_0x5106('0x2d')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x509838);_0x1074f4(_0x509838);}else{logger['info'](_0x5106('0x2e'));odbc['query'](_0x41d703,function(_0x34a20e,_0xdb92f1){if(_0x34a20e){logger[_0x5106('0x2f')]('Error\x20executing\x20query\x20%s',_0x41d703);_0x1074f4(_0x34a20e);}else{logger[_0x5106('0x2f')]('Query\x20executed\x20correctly\x20%s',_0x41d703);odbc[_0x5106('0x30')](function(_0x350c98){if(_0x350c98){logger['error'](_0x5106('0x31'),_0x350c98);}_0x1074f4(null,_0xdb92f1);});}});}});};AGIVertices[_0x5106('0x13')][_0x5106('0x32')]=function(_0x551d2a,_0x28da84){this[_0x5106('0xe')][_0x5106('0x33')](_0x551d2a)['then'](function(_0x410948){_0x28da84(null,_0x410948?_0x410948:![]);})[_0x5106('0x12')](function(_0x81637b){_0x28da84(_0x81637b);});};AGIVertices[_0x5106('0x13')]['createSmsMessage']=function(_0x1e0d24,_0x1b56e0){this[_0x5106('0xe')]['createSmsMessage'](_0x1e0d24)[_0x5106('0x10')](function(_0x35c42d){_0x1b56e0(null,_0x35c42d);})['catch'](function(_0x213823){_0x1b56e0(_0x213823);});};AGIVertices[_0x5106('0x13')][_0x5106('0x34')]=function(_0x4b4de2,_0x22abbc,_0x10bba8){this[_0x5106('0xe')]['createSquareDetailsReport']({'uniqueid':this['channel']['uniqueid'],'node':_0x4b4de2[_0x5106('0x35')],'application':_0x4b4de2['agicommand'],'data':_0x22abbc||null,'project_name':this[_0x5106('0xb')][_0x5106('0x36')],'callerid':this[_0x5106('0xb')][_0x5106('0x37')]})['then'](function(_0x1c590c){if(_0x10bba8){_0x10bba8(null,_0x1c590c);}})[_0x5106('0x12')](function(_0xcb4b2c){if(_0x10bba8){_0x10bba8(_0xcb4b2c);}});};AGIVertices[_0x5106('0x13')][_0x5106('0x38')]=function(_0x350c00,_0x135acf,_0x3ed39d,_0x3ac761){this[_0x5106('0xe')][_0x5106('0x38')]({'uniqueid':this[_0x5106('0xb')][_0x5106('0x39')],'callerid':this[_0x5106('0xb')][_0x5106('0x37')],'calleridname':this[_0x5106('0xb')][_0x5106('0x3a')],'context':this[_0x5106('0xb')][_0x5106('0x3b')],'extension':this[_0x5106('0xb')][_0x5106('0x3c')],'priority':this[_0x5106('0xb')][_0x5106('0x3d')],'accountcode':this[_0x5106('0xb')][_0x5106('0x3e')],'dnid':this[_0x5106('0xb')][_0x5106('0x3f')],'projectName':this[_0x5106('0xb')][_0x5106('0x36')],'saveName':_0x135acf,'filename':_0x350c00['file']||_0x135acf,'savePath':_0x3ed39d})[_0x5106('0x10')](function(_0x3618ba){_0x3ac761(null,_0x3618ba);})[_0x5106('0x12')](function(_0x82843d){_0x3ac761(_0x82843d);});};AGIVertices[_0x5106('0x13')][_0x5106('0x40')]=function(_0x38de0a,_0xa6ba58,_0x4aea3a){this[_0x5106('0xe')][_0x5106('0x40')]({'uniqueid':this[_0x5106('0xb')][_0x5106('0x39')],'body':_0x38de0a,'direction':_0xa6ba58})[_0x5106('0x10')](function(_0x1a1122){if(_0x4aea3a){_0x4aea3a(null,_0x1a1122);}})[_0x5106('0x12')](function(_0x1bbb7b){if(_0x4aea3a){_0x4aea3a(_0x1bbb7b);}});};AGIVertices['prototype'][_0x5106('0x41')]=function(_0x2850fe,_0x4e6ece){this['rpc'][_0x5106('0x41')]({'firstName':_[_0x5106('0x42')](_0x2850fe['name'])||_[_0x5106('0x43')](_0x2850fe[_0x5106('0x11')])?_0x5106('0x44')+Math['random']():_0x2850fe[_0x5106('0x11')],'lastName':_['isEmpty'](_0x2850fe[_0x5106('0x45')])||_['isNil'](_0x2850fe['lastName'])?null:_0x2850fe['lastName'],'phone':_0x2850fe[_0x5106('0x46')],'ListId':_0x2850fe[_0x5106('0x47')],'scheduledAt':_0x2850fe['scheduledAt'],'callbackUniqueid':this[_0x5106('0xb')][_0x5106('0x39')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x2850fe[_0x5106('0x48')][_0x5106('0x49')](),'priority':_0x2850fe[_0x5106('0x4a')]})[_0x5106('0x10')](function(_0x5728ba){_0x4e6ece(null,_0x5728ba);})['catch'](function(_0x55c5e2){_0x4e6ece(_0x55c5e2);});};AGIVertices[_0x5106('0x13')][_0x5106('0x4b')]=function(_0x5126eb,_0x1c5502){this[_0x5106('0xe')][_0x5106('0x4c')](_0x5126eb)[_0x5106('0x10')](function(_0xc21076){_0x1c5502(null,_0xc21076?_0xc21076['name']:![]);})[_0x5106('0x12')](function(_0x136e9f){_0x1c5502(_0x136e9f);});};AGIVertices[_0x5106('0x13')][_0x5106('0x4d')]=function(_0x10318f,_0x506c7b,_0x202aa1){var _0x16cb48={'role':_0x5106('0x4e')};_0x16cb48[_0x10318f]=this[_0x5106('0xb')][_0x5106('0x37')];this[_0x5106('0xe')][_0x5106('0x4d')](_0x16cb48,_0x506c7b,this[_0x5106('0xb')][_0x5106('0x39')])[_0x5106('0x10')](function(_0x686b74){_0x202aa1(null,_['isNil'](_0x686b74)?![]:!![]);})['catch'](function(_0x2d8876){logger[_0x5106('0x2d')](_0x2d8876);_0x202aa1(null,![]);});};AGIVertices[_0x5106('0x13')][_0x5106('0x4f')]=function(_0x3ebd73,_0x242287){var _0x245fa4={'role':_0x5106('0x4e')};_0x245fa4[_0x3ebd73]=this['channel'][_0x5106('0x37')];this[_0x5106('0xe')][_0x5106('0x4f')](_0x245fa4)[_0x5106('0x10')](function(_0x1bb014){_0x242287(null,_['isNil'](_0x1bb014)?![]:!![]);})['catch'](function(_0x7c0fee){logger[_0x5106('0x2d')](_0x7c0fee);_0x242287(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x211b28,_0x468f72){var _0x83de7={'role':_0x5106('0x4e')};_0x83de7[_0x211b28]=this[_0x5106('0xb')][_0x5106('0x37')];this[_0x5106('0xe')]['agentLogout'](_0x83de7)[_0x5106('0x10')](function(_0x16d932){_0x468f72(null,_['isNil'](_0x16d932)?![]:!![]);})[_0x5106('0x12')](function(_0x1abf6f){logger['error'](_0x1abf6f);_0x468f72(null,![]);});};AGIVertices[_0x5106('0x13')][_0x5106('0x50')]=function(_0x3d6459,_0x20b414){var _0x5de067={'role':'agent'};_0x5de067[_0x3d6459]=this[_0x5106('0xb')][_0x5106('0x37')];var _0x412b21=_0x3d6459!=_0x5106('0x51')?util[_0x5106('0x29')](_0x5106('0x52'),_0x5106('0x53'),this['channel']['callerid']):undefined;this[_0x5106('0xe')]['agentLogin'](_0x5de067,_0x412b21)[_0x5106('0x10')](function(_0x1e4c9b){_0x20b414(null,_['isNil'](_0x1e4c9b)?![]:!![]);})['catch'](function(_0x5d8ab2){logger[_0x5106('0x2d')](_0x5d8ab2);_0x20b414(null,![]);});};AGIVertices[_0x5106('0x13')][_0x5106('0x54')]=function(_0x2dadbc,_0x585548){sh[_0x5106('0x55')](_['trim'](_0x2dadbc),function(_0x2d2ec9,_0x2ba8be){var _0x3db50f=_0x2ba8be['replace'](/(\r\n|\n|\r)/gm,'');_0x585548(null,_0x3db50f);});};AGIVertices[_0x5106('0x13')]['googleTTS']=function(_0x1d5b7d,_0x8aef14){scripts[_0x5106('0x56')](_0x1d5b7d[_0x5106('0x57')],_0x1d5b7d['google_tts_language']||'en',0x1)[_0x5106('0x10')](function(_0x3a8a81){_0x8aef14(null,_0x3a8a81);})[_0x5106('0x12')](function(_0x3487a9){_0x8aef14(_0x3487a9);});};AGIVertices[_0x5106('0x13')]['googleDialogflow']=function(_0xde3507,_0x3adbdf){scripts[_0x5106('0x58')](this[_0x5106('0xb')]['uniqueid'],_0xde3507[_0x5106('0x59')],_0xde3507[_0x5106('0x57')],_0xde3507[_0x5106('0x5a')]||'en')[_0x5106('0x10')](function(_0x9de6cb){_0x3adbdf(null,_0x9de6cb);})[_0x5106('0x12')](function(_0x24937e){_0x3adbdf(_0x24937e);});};AGIVertices[_0x5106('0x13')][_0x5106('0x5b')]=function(_0x52661f,_0x708859){scripts[_0x5106('0x5b')](this[_0x5106('0xb')],_0x52661f)[_0x5106('0x10')](function(_0x159a28){_0x708859(null,_0x159a28);})[_0x5106('0x12')](function(_0x183712){_0x708859(_0x183712);});};AGIVertices['prototype'][_0x5106('0x5c')]=function(_0x2c14ce,_0x2e8206){scripts[_0x5106('0x5c')](_0x2c14ce['key'],_0x2c14ce[_0x5106('0x57')],_0x2c14ce[_0x5106('0x5d')]||'en-US',_0x2c14ce[_0x5106('0x5e')])[_0x5106('0x10')](function(_0x42dd32){_0x2e8206(null,_0x42dd32);})[_0x5106('0x12')](function(_0x4960cf){_0x2e8206(_0x4960cf);});};AGIVertices['prototype']['ispeechASR']=function(_0x3625e1,_0x30ed16,_0x3a80a1){scripts[_0x5106('0x5f')](_0x30ed16,_0x3625e1['key'],_0x3625e1[_0x5106('0x60')]||_0x5106('0x61'),this[_0x5106('0x62')](_0x3625e1[_0x5106('0x63')])?_0x3625e1[_0x5106('0x63')]:undefined)[_0x5106('0x10')](function(_0x259950){_0x3a80a1(null,_0x259950);})[_0x5106('0x12')](function(_0x4e9ea6){_0x3a80a1(_0x4e9ea6);});};AGIVertices['prototype']['awsPolly']=function(_0x456364,_0x25ebfc){scripts[_0x5106('0x64')](_0x456364[_0x5106('0x65')],_0x456364[_0x5106('0x66')],_0x456364[_0x5106('0x67')],_0x456364[_0x5106('0x68')]||_0x5106('0x69'),_0x456364['text'],_0x456364[_0x5106('0x6a')]||'text')['then'](function(_0x21b1b6){_0x25ebfc(null,_0x21b1b6);})[_0x5106('0x12')](function(_0x26206f){_0x25ebfc(_0x26206f);});};AGIVertices[_0x5106('0x13')]['awsLex']=function(_0x312991,_0xb5be0c){scripts[_0x5106('0x6b')](this[_0x5106('0xb')][_0x5106('0x39')],_0x312991[_0x5106('0x65')],_0x312991['aws_secret_access_key'],_0x312991[_0x5106('0x6c')],_0x312991[_0x5106('0x57')],_0x312991['aws_bot_name'])['then'](function(_0x92f10b){_0xb5be0c(null,_0x92f10b);})[_0x5106('0x12')](function(_0x38e4d2){_0xb5be0c(_0x38e4d2);});};AGIVertices['prototype'][_0x5106('0x6d')]=function(_0x5c13b6,_0x37ac57,_0x3e6c95){scripts[_0x5106('0x6d')](_0x37ac57,_0x5c13b6[_0x5106('0x59')],_0x5c13b6[_0x5106('0x6e')]||_0x5106('0x61'))[_0x5106('0x10')](function(_0x20c75c){_0x3e6c95(null,_0x20c75c);})['catch'](function(_0x573bf0){_0x3e6c95(_0x573bf0);});};AGIVertices[_0x5106('0x13')][_0x5106('0x6f')]=function(_0x369a69,_0x37fb53,_0x14f257){scripts[_0x5106('0x6f')](_0x37fb53,_0x369a69['appid'],_0x369a69[_0x5106('0x70')],_0x369a69[_0x5106('0x71')])[_0x5106('0x10')](function(_0x5550d0){_0x14f257(null,_0x5550d0);})[_0x5106('0x12')](function(_0x6ba759){_0x14f257(_0x6ba759);});};AGIVertices['prototype']['clear']=function(_0x3844d9){var _0x1e816e=_[_0x5106('0x72')](verticesWithRetry,_0x3844d9['agicommand'])?_0x3844d9:_[_0x5106('0x73')](_0x3844d9);for(var _0x44d8f5 in _0x1e816e){if(_0x1e816e[_0x5106('0x74')](_0x44d8f5)){if(_0x1e816e[_0x44d8f5]&&_[_0x5106('0x75')](_0x1e816e[_0x44d8f5])){_0x1e816e[_0x44d8f5]=this[_0x5106('0x76')](_0x1e816e[_0x44d8f5]);}}}return _0x1e816e;};AGIVertices['prototype'][_0x5106('0x76')]=function(_0x1672aa){var _0x3be93a=_0x1672aa[_0x5106('0x77')]('{');for(var _0x439dc8=0x1;_0x439dc8<_0x3be93a['length'];_0x439dc8+=0x1){var _0x50b546=_0x3be93a[_0x439dc8]['split']('}');if(_0x50b546[_0x5106('0x78')]>0x1){_0x1672aa=_0x1672aa[_0x5106('0x79')]('{'+_0x50b546[0x0]+'}',this[_0x5106('0xb')][_0x5106('0xd')](_0x50b546[0x0])[_0x5106('0x7a')]||_0x50b546[0x0]);}}if(_0x3be93a[_0x5106('0x78')]===0x1){return _0x1672aa[_0x5106('0x49')]();}return this[_0x5106('0x76')](_0x1672aa);};AGIVertices[_0x5106('0x13')][_0x5106('0x7b')]=function(_0x5775cc,_0x32dc30){var _0x2ddd27=this[_0x5106('0xb')][_0x5106('0xd')](_0x5775cc);if(_0x2ddd27[_0x5106('0x7c')]===-0x1){return _0x2ddd27;}logger[_0x5106('0x2f')](util[_0x5106('0x29')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x32dc30,_0x2ddd27[_0x5106('0x7a')]));return this[_0x5106('0xb')]['setVariable'](_0x32dc30,_0x2ddd27['extra']);};AGIVertices[_0x5106('0x13')][_0x5106('0x62')]=function(_0x1b6e29){return _0x1b6e29&&_0x1b6e29!=='0'&&_0x1b6e29!=='-1'&&_0x1b6e29!=='';};AGIVertices[_0x5106('0x13')][_0x5106('0x7d')]=function(_0x1b515e){this[_0x5106('0x34')][_0x5106('0x7e')](this,_0x1b515e,'-');_0x1b515e[_0x5106('0x7f')]=_0x1b515e[_0x5106('0x7d')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x5106('0x13')][_0x5106('0x4')]=function(_0x1574b9){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x80'),_0x1574b9[_0x5106('0x35')]));return this[_0x5106('0xb')][_0x5106('0x4')]([_0x1574b9[_0x5106('0x81')],_0x1574b9['args']]);};AGIVertices[_0x5106('0x13')][_0x5106('0x82')]=function(_0x58456e){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x83'),_0x58456e[_0x5106('0x35')]));if(this[_0x5106('0x62')](_0x58456e[_0x5106('0x84')])){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x85'),_0x58456e[_0x5106('0x84')]));var _0x20bcb5=this[_0x5106('0xb')][_0x5106('0x86')](_0x58456e['timeout']);if(_0x20bcb5[_0x5106('0x7c')]===-0x1){return _0x20bcb5;}}return this['channel']['answer']();};AGIVertices['prototype'][_0x5106('0x87')]=function(_0x55a9a1){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x88'),_0x55a9a1[_0x5106('0x35')]));if(!this[_0x5106('0x62')](_0x55a9a1['list_id'])){return this[_0x5106('0xb')][_0x5106('0x2d')](_0x55a9a1,_0x5106('0x89'));}_0x55a9a1[_0x5106('0x48')]=moment();if(this[_0x5106('0x62')](_0x55a9a1[_0x5106('0x8a')])){_0x55a9a1[_0x5106('0x48')]=moment()[_0x5106('0x8b')](_0x55a9a1[_0x5106('0x8a')],_0x5106('0x8c'));}if(!this['isConfigured'](_0x55a9a1[_0x5106('0x4a')])){_0x55a9a1[_0x5106('0x4a')]=0x2;}this[_0x5106('0x41')][_0x5106('0x7e')](this,_0x55a9a1);return this[_0x5106('0xb')]['noop'](util[_0x5106('0x29')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x55a9a1[_0x5106('0x46')],_0x55a9a1['list_id'],_0x55a9a1[_0x5106('0x48')]));};AGIVertices['prototype'][_0x5106('0x8d')]=function(_0x32bb9e){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x8e'),_0x32bb9e['label']));var _0x18aefb=this['channel'][_0x5106('0x55')](_0x32bb9e['application'],_0x32bb9e[_0x5106('0x8f')]);if(_0x18aefb['result']===-0x1){return _0x18aefb;}return this[_0x5106('0xb')][_0x5106('0x90')](util[_0x5106('0x29')](_0x5106('0x91'),_0x32bb9e['application'],_0x32bb9e[_0x5106('0x8f')]));};AGIVertices[_0x5106('0x13')][_0x5106('0x92')]=function(_0x2b2530){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x93'),_0x2b2530[_0x5106('0x35')]));if(!this['isConfigured'](_0x2b2530[_0x5106('0x57')])){return this[_0x5106('0xb')][_0x5106('0x90')](_0x5106('0x94'));}var _0x5401cb='\x22'+_0x2b2530[_0x5106('0x57')]+'\x22';if(this[_0x5106('0x62')](_0x2b2530[_0x5106('0x8f')])){_0x5401cb+=','+_0x2b2530[_0x5106('0x8f')];}var _0x1dfa5f=this['channel'][_0x5106('0x55')](_0x5106('0x95'),_0x5401cb);if(_0x1dfa5f[_0x5106('0x7c')]===-0x1){return _0x1dfa5f;}return this['channel']['noop'](util[_0x5106('0x29')](_0x5106('0x96'),_0x5401cb));};AGIVertices[_0x5106('0x13')][_0x5106('0x97')]=function(_0xc917d4){logger[_0x5106('0x2f')](util[_0x5106('0x29')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0xc917d4[_0x5106('0x35')]));if(!this[_0x5106('0x62')](_0xc917d4[_0x5106('0x57')])){return this['channel'][_0x5106('0x90')](_0x5106('0x94'));}var _0x1eee3d='\x22'+_0xc917d4[_0x5106('0x57')]+'\x22';if(this[_0x5106('0x62')](_0xc917d4['options'])){_0x1eee3d+=','+_0xc917d4[_0x5106('0x8f')];}var _0x123752=this[_0x5106('0xb')][_0x5106('0x55')](_0x5106('0x95'),_0x1eee3d);if(_0x123752[_0x5106('0x7c')]===-0x1){return _0x123752;}return this['channel'][_0x5106('0x90')](util[_0x5106('0x29')](_0x5106('0x96'),_0x1eee3d));};AGIVertices[_0x5106('0x13')][_0x5106('0x98')]=function(_0x3ea37f){logger['info'](util['format'](_0x5106('0x99'),_0x3ea37f[_0x5106('0x35')]));if(!this[_0x5106('0x62')](_0x3ea37f['grammar'])){return this[_0x5106('0xb')][_0x5106('0x90')](_0x5106('0x9a'));}var _0x346e31=_0x3ea37f[_0x5106('0x9b')];if(this[_0x5106('0x62')](_0x3ea37f[_0x5106('0x8f')])){_0x346e31+=','+_0x3ea37f[_0x5106('0x8f')];}var _0x31c479=this['channel']['exec'](_0x5106('0x9c'),_0x346e31);if(_0x31c479[_0x5106('0x7c')]===-0x1){return _0x31c479;}var _0x4cac4c=this['getAndSetVariable'](_0x5106('0x9d'),_0x5106('0x9e'));if(_0x4cac4c[_0x5106('0x7c')]===-0x1){return _0x4cac4c;}var _0x58f327=this['getAndSetVariable'](_0x5106('0x9f'),_0x5106('0xa0'));if(_0x58f327['result']===-0x1){return _0x58f327;}var _0x44d087=this[_0x5106('0x7b')]('RECOG_INSTANCE()',_0x5106('0xa1'));if(_0x44d087['result']===-0x1){return _0x44d087;}return this['channel'][_0x5106('0x90')](util[_0x5106('0x29')](_0x5106('0xa2'),_0x346e31));};AGIVertices['prototype'][_0x5106('0xa3')]=function(_0x225c5c){logger['info'](util[_0x5106('0x29')](_0x5106('0xa4'),_0x225c5c[_0x5106('0x35')]));if(!this[_0x5106('0x62')](_0x225c5c[_0x5106('0x9b')])){return this[_0x5106('0xb')][_0x5106('0x90')](_0x5106('0x9a'));}var _0x5908e3=_0x225c5c[_0x5106('0x9b')];if(this[_0x5106('0x62')](_0x225c5c[_0x5106('0x8f')])){_0x5908e3+=','+_0x225c5c[_0x5106('0x8f')];}var _0x5a228e=this[_0x5106('0xb')][_0x5106('0x55')]('MRCPRecog',_0x5908e3);if(_0x5a228e[_0x5106('0x7c')]===-0x1){return _0x5a228e;}var _0x584623=this['getAndSetVariable'](_0x5106('0x9d'),_0x5106('0xa5'));if(_0x584623['result']===-0x1){return _0x584623;}var _0x39cc7b=this[_0x5106('0x7b')](_0x5106('0x9f'),_0x5106('0xa6'));if(_0x39cc7b[_0x5106('0x7c')]===-0x1){return _0x39cc7b;}var _0x3cc32b=this[_0x5106('0x7b')](_0x5106('0xa7'),'SESTEK_ASR_INSTANCE');if(_0x3cc32b[_0x5106('0x7c')]===-0x1){return _0x3cc32b;}return this[_0x5106('0xb')]['noop'](util['format'](_0x5106('0xa2'),_0x5908e3));};AGIVertices[_0x5106('0x13')][_0x5106('0xa8')]=function(_0x4e5223){logger['info'](util[_0x5106('0x29')](_0x5106('0xa9'),_0x4e5223[_0x5106('0x35')]));if(!this[_0x5106('0x62')](_0x4e5223[_0x5106('0xaa')])){return this[_0x5106('0xb')][_0x5106('0x2d')](_0x4e5223,_0x5106('0xab'));}var _0x2adf22=this[_0x5106('0x17')][_0x5106('0x7e')](this,_0x4e5223[_0x5106('0xaa')]);if(!_0x2adf22){return this[_0x5106('0xb')]['error'](_0x4e5223,_0x5106('0xac'));}if(!this[_0x5106('0x62')](_0x4e5223[_0x5106('0xad')])){return this['channel']['error'](_0x4e5223,_0x5106('0xae'));}var _0x36cbfd=_0x4e5223[_0x5106('0xad')][_0x5106('0xaf')](/(\r\n|\n|\r)/gm,'\x20');this[_0x5106('0xb')][_0x5106('0x90')](util['format'](_0x5106('0xb0'),_0x36cbfd));var _0x2a7027=this[_0x5106('0x2b')][_0x5106('0x7e')](this,_0x2adf22,_0x36cbfd);this['createSquareDetailsReport']['sync'](this,_0x4e5223,_0x36cbfd);if(!this[_0x5106('0x62')](_0x4e5223[_0x5106('0xb1')])){return this['channel']['noop'](_0x5106('0xb2'));}var _0x498287=this[_0x5106('0xd')]['sync'](this,_0x4e5223[_0x5106('0xb1')]);if(!_0x498287){return this[_0x5106('0xb')][_0x5106('0x2d')](_0x4e5223,'no\x20variable\x20found');}var _0x588a41=this;_0x2a7027[_0x5106('0xb3')](function(_0x6f1ccc,_0x5e7f0a){Object[_0x5106('0xb4')](_0x6f1ccc)[_0x5106('0xb3')](function(_0x5920bb){_0x588a41[_0x5106('0xb')][_0x5106('0xb5')](util[_0x5106('0x29')](_0x5106('0xb6'),_0x498287,_0x5e7f0a,_0x5920bb),_0x6f1ccc[_0x5920bb]);});});this[_0x5106('0xb')]['setVariable'](util[_0x5106('0x29')](_0x5106('0xb7'),_0x498287),_0x2a7027[_0x5106('0x78')]);return this[_0x5106('0xb')]['noop'](util[_0x5106('0x29')](_0x5106('0xb8'),_0x498287));};AGIVertices[_0x5106('0x13')][_0x5106('0xb9')]=function(_0x4ec16e){logger[_0x5106('0xba')](util[_0x5106('0x29')](_0x5106('0xbb'),_0x4ec16e[_0x5106('0x35')]));if(!this[_0x5106('0x62')](_0x4ec16e[_0x5106('0xbc')])){return this[_0x5106('0xb')][_0x5106('0x2d')](_0x4ec16e,_0x5106('0xbd'));}var _0x5c7a12=this[_0x5106('0x19')][_0x5106('0x7e')](this,_0x4ec16e[_0x5106('0xbc')]);if(!_0x5c7a12){return this[_0x5106('0xb')][_0x5106('0x2d')](_0x4ec16e,_0x5106('0xbe'));}var _0x3c848a=this['channel'][_0x5106('0x55')](_0x5106('0xbf'),[util[_0x5106('0x29')](_0x5106('0xc0'),_0x5c7a12),_0x4ec16e['timeout'],_0x4ec16e[_0x5106('0xc1')],_0x4ec16e[_0x5106('0xc2')]]);if(_0x3c848a[_0x5106('0x7c')]===-0x1){return _0x3c848a;}return this[_0x5106('0xb')]['noop'](util[_0x5106('0x29')](_0x5106('0xc3'),_0x5106('0xbf')));};AGIVertices[_0x5106('0x13')][_0x5106('0xc4')]=function(_0x4d32fc){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0xc5'),_0x4d32fc[_0x5106('0x35')]));if(!this[_0x5106('0x62')](_0x4d32fc[_0x5106('0x59')])){return this[_0x5106('0xb')]['noop'](_0x5106('0xc6'));}if(!this[_0x5106('0x62')](_0x4d32fc[_0x5106('0x57')])){return this[_0x5106('0xb')]['noop']('no\x20text\x20configured');}this[_0x5106('0xb')][_0x5106('0xc7')]=!![];this[_0x5106('0x34')](_0x4d32fc);this[_0x5106('0x40')](_0x4d32fc[_0x5106('0x57')],'in');this[_0x5106('0xb')]['noop'](util[_0x5106('0x29')](_0x5106('0xc8'),_0x4d32fc[_0x5106('0x57')]));var _0x4c4f67=this[_0x5106('0x58')][_0x5106('0x7e')](this,_0x4d32fc);if(_0x4c4f67){for(var _0x2915ad in _0x4c4f67){if(_0x4c4f67[_0x5106('0x74')](_0x2915ad)){this[_0x5106('0xb')][_0x5106('0xb5')](util['format'](_0x5106('0xc9'),_0x2915ad[_0x5106('0xca')]()),_0x4c4f67[_0x2915ad]);}}this[_0x5106('0x40')](_0x4c4f67[_0x5106('0xcb')],_0x5106('0xcc'));return this[_0x5106('0xb')][_0x5106('0x90')](util[_0x5106('0x29')](_0x5106('0xcd'),_0x4c4f67[_0x5106('0xcb')]));}return this[_0x5106('0xb')][_0x5106('0x2d')](_0x4d32fc,_0x5106('0xce'));};AGIVertices[_0x5106('0x13')][_0x5106('0xcf')]=function(_0x5eaee8){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0xd0'),_0x5eaee8['label']));if(!this[_0x5106('0x62')](_0x5eaee8[_0x5106('0xd1')])){return this['channel']['noop'](_0x5106('0xd2'));}if(!this[_0x5106('0x62')](_0x5eaee8[_0x5106('0xd3')])){return this[_0x5106('0xb')][_0x5106('0x90')]('no\x20username\x20configured');}if(!this[_0x5106('0x62')](_0x5eaee8[_0x5106('0xd4')])){return this[_0x5106('0xb')][_0x5106('0x90')](_0x5106('0xd5'));}if(!this[_0x5106('0x62')](_0x5eaee8[_0x5106('0xd6')])){return this[_0x5106('0xb')][_0x5106('0x90')](_0x5106('0x94'));}this[_0x5106('0xb')][_0x5106('0xc7')]=!![];this['createSquareDetailsReport'](_0x5eaee8);this['createSquareMessage'](_0x5eaee8[_0x5106('0x57')],'in');this['channel']['noop'](util[_0x5106('0x29')](_0x5106('0xd7'),_0x5eaee8[_0x5106('0x57')]));var _0x172221=this[_0x5106('0x5b')][_0x5106('0x7e')](this,_0x5eaee8);if(_0x172221){for(var _0x4e80da in _0x172221){if(_0x172221[_0x5106('0x74')](_0x4e80da)){this[_0x5106('0xb')]['setVariable'](util[_0x5106('0x29')]('SESTEK_NDA_%s',_0x4e80da['toUpperCase']()),_0x172221[_0x4e80da]);}}this[_0x5106('0x40')](_0x172221[_0x5106('0xcb')],'out');if(_0x172221[_0x5106('0xd8')]){this[_0x5106('0xb')][_0x5106('0x90')](util[_0x5106('0x29')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x172221[_0x5106('0xd8')]));var _0x2fb60d=this[_0x5106('0xb')][_0x5106('0xd9')](_0x172221[_0x5106('0xd8')]);try{fs[_0x5106('0xda')](_0x172221['audiofile']+_0x5106('0xdb'));}catch(_0x49b6b2){logger[_0x5106('0x2d')](_0x49b6b2);}return _0x2fb60d;}else{return this[_0x5106('0xb')][_0x5106('0x90')](util[_0x5106('0x29')]('SestekNDA\x20Result\x20%s',_0x172221[_0x5106('0xcb')]));}}return this['channel']['error'](_0x5eaee8,_0x5106('0xdc'));};AGIVertices[_0x5106('0x13')][_0x5106('0xdd')]=function(_0x1ceca1){logger[_0x5106('0x2f')](util[_0x5106('0x29')]('Enter\x20in\x20END\x20(%s)\x20block',_0x1ceca1[_0x5106('0x35')]));return this['channel'][_0x5106('0x90')](_0x5106('0xdd'));};AGIVertices['prototype'][_0x5106('0xde')]=function(_0x4af2d6){logger['info'](util[_0x5106('0x29')](_0x5106('0xdf'),_0x4af2d6[_0x5106('0x35')]));var _0x2f342a='';if(_0x4af2d6[_0x5106('0xe0')]){if(!this['isConfigured'](_0x4af2d6[_0x5106('0xe0')])){return this[_0x5106('0xb')][_0x5106('0x2d')](_0x4af2d6,_0x5106('0xe1'));}else{var _0x22e42e=parseInt(_0x4af2d6[_0x5106('0xe0')],0xa);if(isNaN(_0x22e42e)){_0x2f342a=_0x4af2d6['trunk_id'];}else{_0x2f342a=this[_0x5106('0x1b')][_0x5106('0x7e')](this,_0x4af2d6[_0x5106('0xe0')]);if(!_0x2f342a){return this[_0x5106('0xb')][_0x5106('0x2d')](_0x4af2d6,_0x5106('0xe2'));}}}}else if(_0x4af2d6['trunk_name']){_0x2f342a=_0x4af2d6[_0x5106('0xe3')];}else{return this[_0x5106('0xb')][_0x5106('0x2d')](_0x4af2d6,_0x5106('0xe1'));}var _0x1e20fd=this[_0x5106('0xb')][_0x5106('0x55')]('DIAL',[util[_0x5106('0x29')](_0x5106('0xe4'),_0x2f342a,_0x4af2d6[_0x5106('0x46')]),_0x4af2d6[_0x5106('0x84')],_0x4af2d6[_0x5106('0xc1')],_0x4af2d6['url']]);if(_0x1e20fd['result']===-0x1){return _0x1e20fd;}return this[_0x5106('0xb')][_0x5106('0x90')](util[_0x5106('0x29')](_0x5106('0xc3'),_0x5106('0xbf')));};AGIVertices[_0x5106('0x13')][_0x5106('0xe5')]=function(_0x80320c){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0xe6'),_0x80320c[_0x5106('0x35')]));return this[_0x5106('0xb')][_0x5106('0x90')](_0x5106('0xe5'));};AGIVertices['prototype'][_0x5106('0x9')]=function(_0x3552d1){logger['info'](util[_0x5106('0x29')](_0x5106('0xe7'),_0x3552d1[_0x5106('0x35')]));if(_0x3552d1[_0x5106('0x7f')]===0x0){return this['maxRetry'](_0x3552d1);}_0x3552d1[_0x5106('0x7f')]-=0x1;if(!this['isConfigured'](_0x3552d1[_0x5106('0xe8')])){return this['channel'][_0x5106('0x2d')](_0x3552d1,_0x5106('0xe9'));}var _0x44af7b=this[_0x5106('0x1d')]['sync'](this,_0x3552d1['file_id']);if(!_0x44af7b){return this[_0x5106('0xb')][_0x5106('0x2d')](_0x3552d1,_0x5106('0xea'));}if(!this['isConfigured'](_0x3552d1[_0x5106('0xb1')])){return this[_0x5106('0xb')][_0x5106('0x2d')](_0x5106('0xb2'));}var _0x5e8bfa=this[_0x5106('0xb')][_0x5106('0xeb')](_0x44af7b,_0x3552d1['response'],_0x3552d1[_0x5106('0xec')]);var _0x59793e=_0x5e8bfa[_0x5106('0x7c')]?_0x5e8bfa[_0x5106('0x7c')][_0x5106('0x49')]():'';logger[_0x5106('0x2f')](_0x5106('0xed'),JSON[_0x5106('0xee')](_0x5e8bfa));if(_0x5e8bfa[_0x5106('0x7c')]===-0x1){this[_0x5106('0x34')][_0x5106('0x7e')](this,_0x3552d1,_0x59793e);return _0x5e8bfa;}else if(_0x5e8bfa['extra']===_0x5106('0x84')){_0x5e8bfa['result']=_0x59793e['length']>=parseInt(_0x3552d1[_0x5106('0xef')])?'x':'i';}else{_0x5e8bfa[_0x5106('0x7c')]=_0x59793e[_0x5106('0x78')]>=parseInt(_0x3552d1[_0x5106('0xef')])&&_0x59793e[_0x5106('0x78')]<=parseInt(_0x3552d1['maxdigit'])?'x':'i';}var _0x22ee1b=this[_0x5106('0xd')]['sync'](this,_0x3552d1[_0x5106('0xb1')]);if(!_0x22ee1b){return this['channel'][_0x5106('0x2d')](_0x3552d1,_0x5106('0xf0'));}this[_0x5106('0xb')][_0x5106('0xb5')](_0x22ee1b,_0x59793e);if(this[_0x5106('0x62')](_0x3552d1['hiddendigitsnum'])){var _0x20e834=parseInt(_0x3552d1[_0x5106('0xf1')],0xa);var _0x3210e1=rs['generate']({'charset':'*','length':_0x20e834});var _0x788de8=_0x59793e[_0x5106('0x78')];if(_0x788de8>0x0){if(_0x788de8>_0x20e834){this['createSquareDetailsReport'][_0x5106('0x7e')](this,_0x3552d1,_0x3552d1[_0x5106('0xf2')]===_0x5106('0xf3')?_0x3210e1+_0x59793e[_0x5106('0xf4')](_0x20e834):_0x59793e[_0x5106('0xf4')](0x0,_0x788de8-_0x20e834)+_0x3210e1);}else{this[_0x5106('0x34')][_0x5106('0x7e')](this,_0x3552d1,rs[_0x5106('0xf5')]({'charset':'*','length':_0x788de8}));}}else{this[_0x5106('0x34')][_0x5106('0x7e')](this,_0x3552d1,'');}}else{this[_0x5106('0x34')][_0x5106('0x7e')](this,_0x3552d1,_0x59793e);}return _0x5e8bfa;};AGIVertices['prototype'][_0x5106('0xa')]=function(_0x3a9e38){logger['info'](util[_0x5106('0x29')](_0x5106('0xf6'),_0x3a9e38['label']));return this[_0x5106('0x9')](_0x3a9e38);};AGIVertices[_0x5106('0x13')][_0x5106('0xf7')]=function(_0x294182){logger[_0x5106('0x2f')](util['format'](_0x5106('0xf8'),_0x294182['label']));this[_0x5106('0x34')]['sync'](this,_0x294182,_0x294182[_0x5106('0xf9')]);return this[_0x5106('0xb')][_0x5106('0x90')](util[_0x5106('0x29')](_0x5106('0xfa'),_0x294182[_0x5106('0xf9')]));};AGIVertices[_0x5106('0x13')]['awspolly']=function(_0x273bf4){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0xfb'),_0x273bf4[_0x5106('0x35')]));if(!this[_0x5106('0x62')](_0x273bf4[_0x5106('0x65')])||!this[_0x5106('0x62')](_0x273bf4[_0x5106('0x66')])){return this[_0x5106('0xb')][_0x5106('0x90')](_0x5106('0xfc'));}if(!this[_0x5106('0x62')](_0x273bf4['text'])){return this['channel'][_0x5106('0x90')](_0x5106('0x94'));}this[_0x5106('0xb')]['noop'](util['format']('Trying\x20aws\x20Polly\x20%s',_0x273bf4['text']));var _0x59bdb1=this['awsPolly'][_0x5106('0x7e')](this,_0x273bf4);if(_0x59bdb1){this[_0x5106('0xb')][_0x5106('0x90')](util[_0x5106('0x29')](_0x5106('0xfd'),_0x59bdb1));var _0x17190e=this[_0x5106('0xb')][_0x5106('0xd9')](_0x59bdb1);try{fs['unlink'](_0x59bdb1+_0x5106('0xdb'));}catch(_0x180dc6){logger['error'](_0x180dc6);}return _0x17190e;}return this[_0x5106('0xb')]['error'](_0x273bf4,_0x5106('0xfe'));};AGIVertices[_0x5106('0x13')][_0x5106('0xff')]=function(_0x47edf1){logger['info'](util[_0x5106('0x29')](_0x5106('0x100'),_0x47edf1[_0x5106('0x35')]));if(!this['isConfigured'](_0x47edf1[_0x5106('0x65')])||!this[_0x5106('0x62')](_0x47edf1[_0x5106('0x66')])){return this[_0x5106('0xb')][_0x5106('0x90')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x5106('0x62')](_0x47edf1[_0x5106('0x101')])){return this[_0x5106('0xb')][_0x5106('0x90')]('no\x20bot\x20name\x20configured');}if(!this[_0x5106('0x62')](_0x47edf1[_0x5106('0x57')])){return this[_0x5106('0xb')][_0x5106('0x90')](_0x5106('0x94'));}this['channel'][_0x5106('0xc7')]=!![];this[_0x5106('0x34')](_0x47edf1);this['createSquareMessage'](_0x47edf1[_0x5106('0x57')],'in');this['channel'][_0x5106('0x90')](util[_0x5106('0x29')](_0x5106('0x102'),_0x47edf1[_0x5106('0x57')]));var _0x5f149f=this[_0x5106('0x6b')][_0x5106('0x7e')](this,_0x47edf1);if(_0x5f149f){for(var _0x469705 in _0x5f149f){if(_0x5f149f['hasOwnProperty'](_0x469705)&&_['isString'](_0x5f149f[_0x469705])){this[_0x5106('0xb')][_0x5106('0xb5')](util[_0x5106('0x29')](_0x5106('0x103'),_0x469705['toUpperCase']()),_0x5f149f[_0x469705]);}}if(_[_0x5106('0x43')](_0x5f149f[_0x5106('0x104')])){return this['channel'][_0x5106('0x90')](_0x5106('0x105'));}else{this[_0x5106('0x40')](_0x5f149f[_0x5106('0x104')],_0x5106('0xcc'));return this[_0x5106('0xb')][_0x5106('0x90')](util[_0x5106('0x29')](_0x5106('0x106'),_0x5f149f[_0x5106('0x104')]));}}return this[_0x5106('0xb')]['error'](_0x47edf1,_0x5106('0x107'));};AGIVertices[_0x5106('0x13')]['googleasr']=function(_0x26c181){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x108'),_0x26c181['label'],_0x26c181[_0x5106('0x84')]));if(!this[_0x5106('0x62')](_0x26c181[_0x5106('0x59')])){return this[_0x5106('0xb')][_0x5106('0x90')](_0x5106('0xc6'));}var _0x2f14eb=_0x5106('0x109');var _0x17f452=util['format'](_0x5106('0x10a'),FILES_PATH,rs[_0x5106('0xf5')](0x4));var _0x4064c1=util[_0x5106('0x29')](_0x5106('0x10b'),_0x17f452,_0x2f14eb);var _0x80b85b=!![];if(_0x26c181[_0x5106('0x10c')]===_0x5106('0x10d')){_0x80b85b=![];}var _0x3d17c5=this[_0x5106('0xb')][_0x5106('0x10e')](_0x17f452,_0x2f14eb,_0x26c181['intKey'],_0x26c181[_0x5106('0x84')],undefined,_0x80b85b);if(_0x3d17c5[_0x5106('0x7c')]!==-0x1){this['channel'][_0x5106('0x90')](util['format']('google\x20%s\x20file\x20created',_0x4064c1));var _0x2fcd33=this[_0x5106('0x6d')]['sync'](this,_0x26c181,_0x4064c1);if(_0x2fcd33){for(var _0x362b78 in _0x2fcd33){if(_0x2fcd33['hasOwnProperty'](_0x362b78)){this['channel'][_0x5106('0xb5')](util[_0x5106('0x29')]('GOOGLE_ASR_%s',_0x362b78[_0x5106('0xca')]()),_0x2fcd33[_0x362b78]);}}return this[_0x5106('0xb')][_0x5106('0x90')](util[_0x5106('0x29')](_0x5106('0x10f'),JSON[_0x5106('0xee')](_0x2fcd33)));}}return _0x3d17c5;};AGIVertices[_0x5106('0x13')]['tildeasr']=function(_0x51aa05){logger['info'](util[_0x5106('0x29')](_0x5106('0x110'),_0x51aa05[_0x5106('0x35')]));if(!this[_0x5106('0x62')](_0x51aa05['appid'])){return this[_0x5106('0xb')][_0x5106('0x90')](_0x5106('0x111'));}if(!this[_0x5106('0x62')](_0x51aa05['appsecret'])){return this['channel']['noop'](_0x5106('0x112'));}var _0x4a9d1c='wav';var _0x4ce7cf=util['format'](_0x5106('0x10a'),FILES_PATH,rs[_0x5106('0xf5')](0x4));var _0x46c68b=util[_0x5106('0x29')](_0x5106('0x10b'),_0x4ce7cf,_0x4a9d1c);var _0x344550=!![];if(_0x51aa05[_0x5106('0x10c')]===_0x5106('0x10d')){_0x344550=![];}var _0x509e70=this[_0x5106('0xb')]['recordFile'](_0x4ce7cf,_0x4a9d1c,_0x51aa05[_0x5106('0x113')],_0x51aa05[_0x5106('0x84')],undefined,_0x344550);if(_0x509e70[_0x5106('0x7c')]!==-0x1){this['channel'][_0x5106('0x90')](util[_0x5106('0x29')](_0x5106('0x114'),_0x46c68b));var _0x554b21=this[_0x5106('0x6f')][_0x5106('0x7e')](this,_0x51aa05,_0x46c68b);if(_0x554b21){for(var _0x1cc655 in _0x554b21){if(_0x554b21[_0x5106('0x74')](_0x1cc655)){this[_0x5106('0xb')]['setVariable'](util[_0x5106('0x29')](_0x5106('0x115'),_0x1cc655['toUpperCase']()),_0x554b21[_0x1cc655]);}}return this[_0x5106('0xb')][_0x5106('0x90')](util[_0x5106('0x29')](_0x5106('0x116'),JSON[_0x5106('0xee')](_0x554b21)));}}return _0x509e70;};AGIVertices[_0x5106('0x13')]['gotoc']=function(_0x5463ef){logger[_0x5106('0x2f')](util[_0x5106('0x29')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x5463ef[_0x5106('0x35')]));return this[_0x5106('0xb')]['continueAt'](_0x5463ef[_0x5106('0x3b')],_0x5463ef[_0x5106('0x3c')],_0x5463ef[_0x5106('0x3d')]);};AGIVertices[_0x5106('0x13')][_0x5106('0x117')]=function(_0x3cc6a9){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x118'),_0x3cc6a9[_0x5106('0x35')]));if(!this[_0x5106('0x62')](_0x3cc6a9[_0x5106('0x119')])){return this[_0x5106('0xb')][_0x5106('0x2d')](_0x3cc6a9,_0x5106('0x11a'));}try{var _0x2a50d0=eval(_0x3cc6a9['condition'])?_0x5106('0x11b'):_0x5106('0x11c');this[_0x5106('0xb')][_0x5106('0x90')](util[_0x5106('0x29')]('EVAL\x20CONDITION\x20%s\x20%s',_0x3cc6a9['condition'],_0x2a50d0));return{'code':0xc8,'result':_0x2a50d0};}catch(_0x4625cd){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x5106('0x13')][_0x5106('0x11d')]=function(_0x461c74){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x11e'),_0x461c74[_0x5106('0x35')]));if(!this[_0x5106('0x62')](_0x461c74[_0x5106('0x11f')])){return this[_0x5106('0xb')][_0x5106('0x2d')](_0x461c74,_0x5106('0x120'));}var _0x4bad36=this[_0x5106('0x24')]['sync'](this,_0x461c74[_0x5106('0x11f')]);if(!_0x4bad36){return this[_0x5106('0xb')][_0x5106('0x2d')](_0x461c74,'no\x20intervals\x20found');}for(var _0x145679=0x0;_0x145679<_0x4bad36[_0x5106('0x78')];_0x145679+=0x1){var _0x23981c=this['channel'][_0x5106('0xd')](util[_0x5106('0x29')](_0x5106('0x121'),_0x4bad36[_0x145679]));if(_0x23981c[_0x5106('0x7c')]===-0x1){return _0x23981c;}logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x122'),_0x4bad36[_0x145679],_0x23981c[_0x5106('0x7a')]));if(_0x23981c[_0x5106('0x7a')]==='true'){logger[_0x5106('0x2f')](util[_0x5106('0x29')]('IFTIME\x20%s\x20%s',_0x4bad36[_0x145679],_0x5106('0x11b')));this[_0x5106('0xb')][_0x5106('0x90')](util[_0x5106('0x29')](_0x5106('0x122'),_0x4bad36[_0x145679],'true'));return{'code':0xc8,'result':_0x5106('0x11b')};}else{logger[_0x5106('0x2f')](util['format']('IFTIME\x20%s\x20%s',_0x4bad36[_0x145679],_0x5106('0x11c')));this[_0x5106('0xb')]['noop'](util[_0x5106('0x29')](_0x5106('0x122'),_0x4bad36[_0x145679],_0x5106('0x11c')));}}return{'code':0xc8,'result':_0x5106('0x11c')};};AGIVertices[_0x5106('0x13')][_0x5106('0x123')]=function(_0x21f0d5){logger[_0x5106('0x2f')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x21f0d5[_0x5106('0x35')]));return this[_0x5106('0xb')]['hangup']();};AGIVertices[_0x5106('0x13')][_0x5106('0x124')]=function(_0x207da9){logger[_0x5106('0x2f')](util[_0x5106('0x29')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x207da9[_0x5106('0x35')]));if(!this['isConfigured'](_0x207da9['key'])){return this[_0x5106('0xb')][_0x5106('0x90')](_0x5106('0xc6'));}var _0x307ee5=_0x5106('0x109');var _0x3b2cdf=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x5106('0xf5')](0x4));var _0x3ee011=util[_0x5106('0x29')](_0x5106('0x10b'),_0x3b2cdf,_0x307ee5);var _0x4fb0d3=!![];if(_0x207da9[_0x5106('0x10c')]===_0x5106('0x10d')){_0x4fb0d3=![];}var _0x5408fd=this[_0x5106('0xb')][_0x5106('0x10e')](_0x3b2cdf,_0x307ee5,_0x207da9[_0x5106('0x113')],_0x207da9[_0x5106('0x84')],undefined,_0x4fb0d3);if(_0x5408fd[_0x5106('0x7c')]!==-0x1){this[_0x5106('0xb')][_0x5106('0x90')](util[_0x5106('0x29')](_0x5106('0x125'),_0x3ee011));var _0x2f4785=this['ispeechASR'][_0x5106('0x7e')](this,_0x207da9,_0x3ee011);if(_0x2f4785){for(var _0x29dafd in _0x2f4785){if(_0x2f4785[_0x5106('0x74')](_0x29dafd)){this[_0x5106('0xb')][_0x5106('0xb5')](util[_0x5106('0x29')](_0x5106('0x126'),_0x29dafd[_0x5106('0xca')]()),_0x2f4785[_0x29dafd]);}}return this[_0x5106('0xb')][_0x5106('0x90')](util[_0x5106('0x29')](_0x5106('0x127'),JSON['stringify'](_0x2f4785)));}}return _0x5408fd;};AGIVertices[_0x5106('0x13')][_0x5106('0x128')]=function(_0x5d3b60){logger['info'](util[_0x5106('0x29')](_0x5106('0x129'),_0x5d3b60[_0x5106('0x35')]));if(!this['isConfigured'](_0x5d3b60[_0x5106('0x59')])){return this[_0x5106('0xb')][_0x5106('0x90')](_0x5106('0xc6'));}if(!this[_0x5106('0x62')](_0x5d3b60[_0x5106('0x57')])){return this[_0x5106('0xb')]['noop']('no\x20text\x20configured');}this[_0x5106('0xb')][_0x5106('0x90')](util['format'](_0x5106('0x12a'),_0x5d3b60[_0x5106('0x57')]));var _0x41bf8e=this['ispeechTTS'][_0x5106('0x7e')](this,_0x5d3b60);if(_0x41bf8e){this[_0x5106('0xb')]['noop'](util[_0x5106('0x29')]('ispeech\x20%s\x20file\x20created',_0x41bf8e));var _0x54adef=this['channel'][_0x5106('0xd9')](_0x41bf8e,_0x5d3b60['intKey']);try{fs[_0x5106('0xda')](_0x41bf8e+_0x5106('0xdb'));}catch(_0x1c8ae5){logger[_0x5106('0x2d')](_0x1c8ae5);}return _0x54adef;}return this[_0x5106('0xb')][_0x5106('0x2d')](_0x5d3b60,_0x5106('0x12b'));};AGIVertices['prototype']['login']=function(_0xccd47d){logger[_0x5106('0x2f')](util['format'](_0x5106('0x12c'),_0xccd47d[_0x5106('0x35')]));if(!this[_0x5106('0x62')](_0xccd47d['findBy'])){return this['channel']['error'](_0xccd47d,'no\x20find\x20by\x20configured');}logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x12d'),this['channel'][_0x5106('0x37')],_0xccd47d[_0x5106('0x12e')]));var _0x29a10f=this['agentLogin'][_0x5106('0x7e')](this,_0xccd47d[_0x5106('0x12e')]);if(_0x29a10f){logger[_0x5106('0x2f')](util[_0x5106('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x5106('0xb')][_0x5106('0x37')],_0xccd47d[_0x5106('0x12e')]));this[_0x5106('0xb')]['noop'](util[_0x5106('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x5106('0xb')][_0x5106('0x37')],_0xccd47d['findBy']));return{'code':0xc8,'result':_0x5106('0x12f')};}else{logger[_0x5106('0x2f')](util['format'](_0x5106('0x130'),this['channel'][_0x5106('0x37')],_0xccd47d['findBy']));this[_0x5106('0xb')][_0x5106('0x90')](util[_0x5106('0x29')](_0x5106('0x130'),this[_0x5106('0xb')][_0x5106('0x37')],_0xccd47d[_0x5106('0x12e')]));return{'code':0xc8,'result':_0x5106('0x131')};}};AGIVertices[_0x5106('0x13')][_0x5106('0x132')]=function(_0x4c10ba){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x133'),_0x4c10ba[_0x5106('0x35')]));if(!this[_0x5106('0x62')](_0x4c10ba[_0x5106('0x12e')])){return this[_0x5106('0xb')][_0x5106('0x2d')](_0x4c10ba,'no\x20find\x20by\x20configured');}logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x12d'),this[_0x5106('0xb')][_0x5106('0x37')],_0x4c10ba[_0x5106('0x12e')]));var _0x2022c5=this[_0x5106('0x134')][_0x5106('0x7e')](this,_0x4c10ba[_0x5106('0x12e')]);if(_0x2022c5){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x135'),this[_0x5106('0xb')]['callerid'],_0x4c10ba[_0x5106('0x12e')]));this[_0x5106('0xb')][_0x5106('0x90')](util[_0x5106('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x5106('0xb')]['callerid'],_0x4c10ba[_0x5106('0x12e')]));return{'code':0xc8,'result':'success'};}else{logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x130'),this[_0x5106('0xb')]['callerid'],_0x4c10ba[_0x5106('0x12e')]));this[_0x5106('0xb')][_0x5106('0x90')](util[_0x5106('0x29')](_0x5106('0x130'),this['channel'][_0x5106('0x37')],_0x4c10ba[_0x5106('0x12e')]));return{'code':0xc8,'result':_0x5106('0x131')};}};AGIVertices[_0x5106('0x13')][_0x5106('0x136')]=function(_0x8f104d){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x137'),_0x8f104d[_0x5106('0x35')]));if(!this['isConfigured'](_0x8f104d['operation'])){return this[_0x5106('0xb')]['error'](_0x8f104d,_0x5106('0x138'));}this[_0x5106('0xb')]['noop'](util[_0x5106('0x29')](_0x5106('0x139'),_0x8f104d[_0x5106('0x13a')]));var _0x3bde86=eval(_0x8f104d['operation']);if(!this[_0x5106('0x62')](_0x8f104d[_0x5106('0xb1')])){return this[_0x5106('0xb')][_0x5106('0x90')](_0x5106('0xb2'));}var _0x5b44c7=this[_0x5106('0xd')][_0x5106('0x7e')](this,_0x8f104d[_0x5106('0xb1')]);if(!_0x5b44c7){return this[_0x5106('0xb')][_0x5106('0x2d')](_0x8f104d,_0x5106('0xf0'));}if(_['isArray'](_0x3bde86)){var _0x3bf002=this;_0x3bde86['forEach'](function(_0x46b19b,_0x1ad12d){_0x3bf002[_0x5106('0xb')][_0x5106('0xb5')](util[_0x5106('0x29')]('%s[%s]',_0x5b44c7,_0x1ad12d),_0x46b19b);});return this['channel']['noop'](util[_0x5106('0x29')](_0x5106('0x13b'),_0x5b44c7));}else{return this['channel'][_0x5106('0xb5')](_0x5b44c7,_0x3bde86);}};AGIVertices[_0x5106('0x13')]['menu']=function(_0x14f872){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x13c'),_0x14f872[_0x5106('0x35')]));if(_0x14f872[_0x5106('0x7f')]===0x0){return this[_0x5106('0x7d')](_0x14f872);}_0x14f872[_0x5106('0x7f')]-=0x1;if(!this[_0x5106('0x62')](_0x14f872[_0x5106('0xe8')])){return this[_0x5106('0xb')][_0x5106('0x2d')](_0x14f872,_0x5106('0xe9'));}var _0x3b94a9=this['getSound'][_0x5106('0x7e')](this,_0x14f872[_0x5106('0xe8')]);if(!_0x3b94a9){return this['channel'][_0x5106('0x2d')](_0x14f872,'no\x20file\x20audio\x20found');}var _0x381a17=this[_0x5106('0xb')]['getData'](_0x3b94a9,_0x14f872[_0x5106('0x13d')],_0x14f872['digit']);var _0xacdcea=_0x381a17[_0x5106('0x7c')];if(_0x381a17['result']===-0x1){this[_0x5106('0x34')][_0x5106('0x7e')](this,_0x14f872,'-1');return _0x381a17;}else if(_0x381a17[_0x5106('0x7a')]===_0x5106('0x84')){_0x381a17[_0x5106('0x7c')]=_0x381a17[_0x5106('0x7c')][_0x5106('0x78')]>0x0?_0x381a17[_0x5106('0x7c')]:'t';}else if(_[_0x5106('0x42')](_0x381a17[_0x5106('0x7c')])){_0x381a17[_0x5106('0x7c')]='#';_0xacdcea='#';}if(!this[_0x5106('0x62')](_0x14f872[_0x5106('0xb1')])){this[_0x5106('0xb')][_0x5106('0x90')](_0x5106('0xb2'));}else{var _0x1d1da2=this[_0x5106('0xd')][_0x5106('0x7e')](this,_0x14f872[_0x5106('0xb1')]);if(!_0x1d1da2){return this['channel'][_0x5106('0x2d')](_0x14f872,_0x5106('0xf0'));}this['channel'][_0x5106('0xb5')](_0x1d1da2,_0xacdcea);}this[_0x5106('0x34')][_0x5106('0x7e')](this,_0x14f872,_0xacdcea);return _0x381a17;};AGIVertices[_0x5106('0x13')]['noop']=function(_0x5ce2d2){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x13e'),_0x5ce2d2[_0x5106('0x35')]));return this['channel']['noop'](_0x5ce2d2[_0x5106('0x13f')]||_0x5ce2d2['label']);};AGIVertices['prototype']['pause']=function(_0xbc7513){logger['info'](util[_0x5106('0x29')](_0x5106('0x140'),_0xbc7513[_0x5106('0x35')]));if(!this['isConfigured'](_0xbc7513['findBy'])){return this[_0x5106('0xb')][_0x5106('0x2d')](_0xbc7513,_0x5106('0x141'));}logger[_0x5106('0x2f')](util[_0x5106('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x5106('0xb')][_0x5106('0x37')],_0xbc7513['findBy']));var _0x3c08c4=this[_0x5106('0x4b')][_0x5106('0x7e')](this,_0xbc7513[_0x5106('0x142')]);var _0xf158b4=this['agentPause']['sync'](this,_0xbc7513[_0x5106('0x12e')],_0x3c08c4);if(_0xf158b4){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x135'),this['channel']['callerid'],_0xbc7513[_0x5106('0x12e')]));this[_0x5106('0xb')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x5106('0xb')][_0x5106('0x37')],_0xbc7513[_0x5106('0x12e')]));return{'code':0xc8,'result':'success'};}else{logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x130'),this['channel']['callerid'],_0xbc7513[_0x5106('0x12e')]));this[_0x5106('0xb')][_0x5106('0x90')](util['format'](_0x5106('0x135'),this[_0x5106('0xb')][_0x5106('0x37')],_0xbc7513[_0x5106('0x12e')]));return{'code':0xc8,'result':_0x5106('0x131')};}};AGIVertices[_0x5106('0x13')][_0x5106('0x143')]=function(_0x18f2f1){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x144'),_0x18f2f1['label']));if(!this['isConfigured'](_0x18f2f1[_0x5106('0xe8')])){return this[_0x5106('0xb')][_0x5106('0x2d')](_0x18f2f1,_0x5106('0xe9'));}var _0x35d3ae=this[_0x5106('0x1d')]['sync'](this,_0x18f2f1[_0x5106('0xe8')]);if(!_0x35d3ae){return this['channel'][_0x5106('0x2d')](_0x18f2f1,_0x5106('0xea'));}var _0x880a82=this[_0x5106('0xb')][_0x5106('0x55')](_0x5106('0x145'),[_0x35d3ae,_0x18f2f1['opts']]);if(_0x880a82[_0x5106('0x7c')]===-0x1){return _0x880a82;}return this['channel'][_0x5106('0x90')](util[_0x5106('0x29')](_0x5106('0x91'),_0x5106('0x145'),_0x35d3ae));};AGIVertices['prototype'][_0x5106('0x146')]=function(_0x5d0be5){logger[_0x5106('0x2f')](util['format'](_0x5106('0x147'),_0x5d0be5['label']));if(!this[_0x5106('0x62')](_0x5d0be5[_0x5106('0x148')])){return this['channel']['error'](_0x5d0be5,_0x5106('0x149'));}var _0x5a991a='';var _0x5972ac=parseInt(_0x5d0be5[_0x5106('0x148')],0xa);if(isNaN(_0x5972ac)){_0x5a991a=_0x5d0be5[_0x5106('0x148')];}else{_0x5a991a=this[_0x5106('0x14')][_0x5106('0x7e')](this,_0x5d0be5[_0x5106('0x148')]);if(!_0x5a991a){return this[_0x5106('0xb')]['error'](_0x5d0be5,_0x5106('0x14a'));}}var _0xe533ea='';if(this[_0x5106('0x62')](_0x5d0be5[_0x5106('0xe8')])){var _0x178e09=this[_0x5106('0x1d')][_0x5106('0x7e')](this,_0x5d0be5['file_id']);if(_0x178e09){_0xe533ea=_0x178e09;}}this[_0x5106('0x34')][_0x5106('0x7e')](this,_0x5d0be5,_0x5a991a);if(_0x5d0be5['opts'][_0x5106('0x14b')]('x')<0x0){_0x5d0be5[_0x5106('0xc1')]+='x';}if(_0x5d0be5['opts'][_0x5106('0x14b')]('X')<0x0){_0x5d0be5['opts']+='X';}this[_0x5106('0xb')][_0x5106('0xb5')](_0x5106('0x14c'),_0x5a991a?_0x5a991a[_0x5106('0x14d')]():'');var _0x38e7aa=this[_0x5106('0xb')]['exec'](_0x5106('0x14e'),[_0x5a991a,_0x5d0be5['opts'],_0x5d0be5[_0x5106('0xc2')],_0xe533ea,_0x5d0be5[_0x5106('0x84')],_0x5d0be5[_0x5106('0x4')],_0x5d0be5[_0x5106('0x14f')],_0x5d0be5[_0x5106('0x150')],'',_0x5d0be5[_0x5106('0x151')]]);if(_0x38e7aa[_0x5106('0x7c')]===-0x1){return _0x38e7aa;}return this[_0x5106('0xb')][_0x5106('0x90')](util[_0x5106('0x29')](_0x5106('0x91'),_0x5106('0x14e'),_0x5a991a));};AGIVertices[_0x5106('0x13')][_0x5106('0x152')]=function(_0xc66f71){logger[_0x5106('0x2f')](util['format'](_0x5106('0x153'),_0xc66f71[_0x5106('0x35')]));var _0x6baf8f=_0xc66f71[_0x5106('0x154')]||_0x5106('0x109');var _0x565646=util['format']('%s_%s',this[_0x5106('0xb')][_0x5106('0x39')],rs[_0x5106('0xf5')](0x5));var _0x5547b1=util[_0x5106('0x29')](_0x5106('0x155'),FILES_PATH,_0x565646,_0x6baf8f);var _0x49e48d=util[_0x5106('0x29')](_0x5106('0x10a'),FILES_PATH,_0x565646);this['createSquareRecording'][_0x5106('0x7e')](this,_0xc66f71,_0x565646,_0x5547b1);this['channel'][_0x5106('0xb5')](_0x5106('0x156'),_0x565646);logger[_0x5106('0x2f')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x49e48d,_0x6baf8f,_0xc66f71[_0x5106('0x157')],_0xc66f71['timeout']);return this[_0x5106('0xb')][_0x5106('0x10e')](_0x49e48d,_0x6baf8f,_0xc66f71[_0x5106('0x157')],_0xc66f71[_0x5106('0x84')],undefined,!![]);};AGIVertices['prototype'][_0x5106('0x158')]=function(_0x29a30b){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x159'),_0x29a30b[_0x5106('0x35')]));return this[_0x5106('0xb')]['sayDigits'](_0x29a30b['digits']['replace'](/\s+/g,''),_0x29a30b['escape_digits']);};AGIVertices[_0x5106('0x13')]['saynumber']=function(_0x34f01c){logger[_0x5106('0x2f')](util['format'](_0x5106('0x15a'),_0x34f01c['label']));return this['channel'][_0x5106('0x15b')](_0x34f01c[_0x5106('0x15c')]['replace'](/\s+/g,''),_0x34f01c[_0x5106('0x157')]);};AGIVertices['prototype'][_0x5106('0x15d')]=function(_0x54f3dc){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x15e'),_0x54f3dc[_0x5106('0x35')]));return this['channel']['sayPhonetic'](_0x54f3dc['text'],_0x54f3dc[_0x5106('0x157')]);};AGIVertices[_0x5106('0x13')][_0x5106('0x15f')]=function(_0x59b9fa){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x160'),_0x59b9fa[_0x5106('0x35')]));if(!this[_0x5106('0x62')](_0x59b9fa['account_id'])){return this[_0x5106('0xb')][_0x5106('0x90')](_0x5106('0x161'));}var _0x2f2861=this[_0x5106('0x21')][_0x5106('0x7e')](this,_0x59b9fa[_0x5106('0x162')]);if(!_0x2f2861||!_0x2f2861['Smtp']){return this[_0x5106('0xb')]['error'](_0x59b9fa,_0x5106('0x163'));}var _0x522df5={'from':util[_0x5106('0x29')]('\x22%s\x22\x20<%s>',_0x2f2861['name'],_0x2f2861[_0x5106('0x164')]||_0x2f2861[_0x5106('0x165')][_0x5106('0x166')]),'to':_0x59b9fa['to']||'','cc':_0x59b9fa['cc']||'','bcc':_0x59b9fa[_0x5106('0x167')]||'','subject':_0x59b9fa[_0x5106('0x168')],'html':_0x59b9fa[_0x5106('0x57')],'text':_0x59b9fa[_0x5106('0x57')]};var _0x3bcca6={'tls':{'rejectUnauthorized':![]}};if(_0x2f2861['Smtp']['service']){_0x3bcca6[_0x5106('0x169')]=_0x2f2861[_0x5106('0x165')][_0x5106('0x169')];}else{_0x3bcca6[_0x5106('0x16a')]=_0x2f2861['Smtp']['host'];_0x3bcca6['port']=_0x2f2861[_0x5106('0x165')]['port'];_0x3bcca6[_0x5106('0x16b')]=_0x2f2861[_0x5106('0x165')]['secure'];}if(_0x2f2861[_0x5106('0x165')][_0x5106('0x16c')]){_0x3bcca6[_0x5106('0x16d')]={'user':_0x2f2861[_0x5106('0x165')]['user'],'pass':_0x2f2861[_0x5106('0x165')]['pass']};}if(this[_0x5106('0x62')](_0x59b9fa[_0x5106('0x16e')])){}logger[_0x5106('0xba')](_0x5106('0x16f'),JSON[_0x5106('0xee')](_0x522df5));this[_0x5106('0x34')]['sync'](this,_0x59b9fa,_0x59b9fa[_0x5106('0x162')]);this[_0x5106('0xb')][_0x5106('0x90')](util[_0x5106('0x29')](_0x5106('0x170'),_0x2f2861[_0x5106('0x11')]));this[_0x5106('0x23')][_0x5106('0x7e')](this,_0x3bcca6,_0x522df5);return this[_0x5106('0xb')][_0x5106('0x90')](_0x5106('0x171'));};AGIVertices[_0x5106('0x13')][_0x5106('0x172')]=function(_0x18292a){logger[_0x5106('0x2f')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x18292a[_0x5106('0x35')]));return this[_0x5106('0xb')][_0x5106('0x90')](_0x5106('0x173'));};AGIVertices[_0x5106('0x13')]['sendSMS']=function(_0x113957){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x174'),_0x113957[_0x5106('0x35')]));if(!this[_0x5106('0x62')](_0x113957[_0x5106('0x175')])){return this[_0x5106('0xb')][_0x5106('0x90')]('no\x20sms\x20account\x20configured');}var _0x5e4431=this['getSmsAccount'][_0x5106('0x7e')](this,_0x113957[_0x5106('0x175')]);if(!_0x5e4431){return this[_0x5106('0xb')][_0x5106('0x2d')](_0x113957,_0x5106('0x176'));}var _0x58785e={'body':_0x113957['sms_text'],'phone':_0x113957['to']||'','SmsAccountId':_0x5e4431['id']};logger[_0x5106('0xba')](_0x5106('0x177'),JSON[_0x5106('0xee')](_0x58785e));this[_0x5106('0x34')][_0x5106('0x7e')](this,_0x113957,_0x113957[_0x5106('0x175')]);this[_0x5106('0xb')]['noop'](util[_0x5106('0x29')](_0x5106('0x178'),_0x5e4431['name']));this[_0x5106('0x179')][_0x5106('0x7e')](this,_0x58785e);return this['channel'][_0x5106('0x90')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x5106('0x13')]['set']=function(_0x137161){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x17a'),_0x137161['label']));if(!this[_0x5106('0x62')](_0x137161[_0x5106('0xb1')])){return this[_0x5106('0xb')][_0x5106('0x2d')](_0x137161,_0x5106('0x17b'));}var _0x33ce27=this['getVariable'][_0x5106('0x7e')](this,_0x137161[_0x5106('0xb1')]);if(!_0x33ce27){return this[_0x5106('0xb')]['error'](_0x137161,_0x5106('0xf0'));}return this['channel'][_0x5106('0xb5')](_0x33ce27,_0x137161[_0x5106('0x17c')]);};AGIVertices[_0x5106('0x13')]['start']=function(_0x11518e){logger['info'](util[_0x5106('0x29')](_0x5106('0x17d'),_0x11518e[_0x5106('0x35')]));this['channel'][_0x5106('0x90')]('START\x20CALLY\x20SQUARE');if(_0x11518e[_0x5106('0x82')]===_0x5106('0x17e')){this['channel'][_0x5106('0x90')](_0x5106('0x17f'));return this[_0x5106('0xb')][_0x5106('0x82')]();}return this[_0x5106('0xb')][_0x5106('0x90')]('Skipped\x20Answer');};AGIVertices[_0x5106('0x13')]['subproject']=function(_0x2ce34c){logger[_0x5106('0x2f')](util['format'](_0x5106('0x180'),_0x2ce34c['label']));if(!this[_0x5106('0x62')](_0x2ce34c[_0x5106('0x181')])){return this[_0x5106('0xb')]['error'](_0x2ce34c,_0x5106('0x182'));}var _0x2f0f05=this[_0x5106('0x15')][_0x5106('0x7e')](this,_0x2ce34c[_0x5106('0x181')]);if(!this[_0x5106('0x62')](_0x2f0f05)){return this['channel']['error'](_0x2ce34c,util[_0x5106('0x29')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x2ce34c[_0x5106('0x181')]));}if(_0x2f0f05===this[_0x5106('0xb')][_0x5106('0x36')]){return this[_0x5106('0xb')][_0x5106('0x2d')](_0x2ce34c,_0x5106('0x183'));}this[_0x5106('0x34')][_0x5106('0x7e')](this,_0x2ce34c,_0x2f0f05);var _0x59060c=this[_0x5106('0xb')][_0x5106('0x55')]('AGI',util[_0x5106('0x29')](_0x5106('0x184'),config[_0x5106('0x4')][_0x5106('0x16a')]||_0x5106('0x185'),_0x2f0f05,this[_0x5106('0xb')][_0x5106('0x36')]));if(_0x59060c[_0x5106('0x7c')]===-0x1){return _0x59060c;}return this[_0x5106('0xb')][_0x5106('0x90')](util[_0x5106('0x29')](_0x5106('0x91'),'AGI',_0x2f0f05));};AGIVertices[_0x5106('0x13')][_0x5106('0x186')]=function(_0xf63689){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x187'),_0xf63689[_0x5106('0x35')]));var _0x4bb12f=this[_0x5106('0x54')][_0x5106('0x7e')](this,_0xf63689[_0x5106('0x81')]);this[_0x5106('0x34')][_0x5106('0x7e')](this,_0xf63689,_0xf63689[_0x5106('0x81')]);if(this['isConfigured'](_0xf63689[_0x5106('0xb1')])){var _0x4feb78=this[_0x5106('0xd')][_0x5106('0x7e')](this,_0xf63689[_0x5106('0xb1')]);if(_0x4feb78){this[_0x5106('0xb')][_0x5106('0xb5')](_0x4feb78,_0x4bb12f);return this[_0x5106('0xb')][_0x5106('0x90')](util[_0x5106('0x29')](_0x5106('0x188'),_0xf63689[_0x5106('0x81')],_0x4feb78));}}return this[_0x5106('0xb')][_0x5106('0x90')](util['format'](_0x5106('0x189'),_0xf63689[_0x5106('0x81')]));};AGIVertices['prototype'][_0x5106('0x18a')]=function(_0x3652f8){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x18b'),_0x3652f8[_0x5106('0x35')]));if(!this[_0x5106('0x62')](_0x3652f8[_0x5106('0x57')])){return this[_0x5106('0xb')][_0x5106('0x90')](_0x5106('0x94'));}this['channel'][_0x5106('0x90')](util['format'](_0x5106('0x18c'),_0x3652f8['text']));var _0x2271ba=this[_0x5106('0x56')]['sync'](this,_0x3652f8);if(_0x2271ba){this['channel']['noop'](util[_0x5106('0x29')](_0x5106('0x18d'),_0x2271ba));var _0x3af02e=this[_0x5106('0xb')][_0x5106('0xd9')](_0x2271ba);try{fs['unlink'](_0x2271ba+_0x5106('0xdb'));}catch(_0x4c6919){logger[_0x5106('0x2d')](_0x4c6919);}return _0x3af02e;}return this[_0x5106('0xb')]['error'](_0x3652f8,_0x5106('0x18e'));};AGIVertices[_0x5106('0x13')][_0x5106('0x18f')]=function(_0x150e9b){logger[_0x5106('0x2f')](util['format'](_0x5106('0x190'),_0x150e9b[_0x5106('0x35')]));if(!this[_0x5106('0x62')](_0x150e9b[_0x5106('0x12e')])){return this[_0x5106('0xb')][_0x5106('0x2d')](_0x150e9b,'no\x20find\x20by\x20configured');}logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x12d'),this[_0x5106('0xb')][_0x5106('0x37')],_0x150e9b['findBy']));var _0x2b2223=this['agentUnpause'][_0x5106('0x7e')](this,_0x150e9b['findBy']);if(_0x2b2223){logger[_0x5106('0x2f')](util[_0x5106('0x29')](_0x5106('0x135'),this[_0x5106('0xb')]['callerid'],_0x150e9b[_0x5106('0x12e')]));this[_0x5106('0xb')][_0x5106('0x90')](util[_0x5106('0x29')](_0x5106('0x135'),this[_0x5106('0xb')]['callerid'],_0x150e9b[_0x5106('0x12e')]));return{'code':0xc8,'result':_0x5106('0x12f')};}else{logger['info'](util[_0x5106('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x5106('0x37')],_0x150e9b[_0x5106('0x12e')]));this[_0x5106('0xb')][_0x5106('0x90')](util['format'](_0x5106('0x130'),this['channel'][_0x5106('0x37')],_0x150e9b[_0x5106('0x12e')]));return{'code':0xc8,'result':_0x5106('0x131')};}};AGIVertices['prototype'][_0x5106('0x191')]=function(_0x3297a8){logger['info'](util[_0x5106('0x29')](_0x5106('0x192'),_0x3297a8['label']));var _0x139efd=this['channel'][_0x5106('0x55')]('VOICEMAIL',[_0x3297a8[_0x5106('0x193')],_0x3297a8[_0x5106('0x8f')]]);if(_0x139efd[_0x5106('0x7c')]===-0x1){return _0x139efd;}return this[_0x5106('0xb')][_0x5106('0x90')](util[_0x5106('0x29')](_0x5106('0x91'),_0x5106('0x194'),_0x3297a8['mailbox']));};AGIVertices[_0x5106('0x13')]['vswitch']=function(_0x1c53db){logger[_0x5106('0x2f')](util[_0x5106('0x29')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x1c53db[_0x5106('0x35')]));if(!this[_0x5106('0x62')](_0x1c53db[_0x5106('0xb1')])){return this['channel'][_0x5106('0x2d')](_0x1c53db,_0x5106('0x17b'));}var _0x1c1f51=this[_0x5106('0xd')][_0x5106('0x7e')](this,_0x1c53db[_0x5106('0xb1')]);if(!_0x1c1f51){return this[_0x5106('0xb')]['error'](_0x1c53db,_0x5106('0xf0'));}var _0x41b863=this['channel'][_0x5106('0xd')](_0x1c1f51);return{'code':0xc8,'result':_0x41b863[_0x5106('0x7a')]?_0x41b863[_0x5106('0x7a')]:'-'};};String[_0x5106('0x13')][_0x5106('0x79')]=function(_0x2d44f2,_0x4c0473){return this[_0x5106('0x77')](_0x2d44f2)['join'](_0x4c0473);};module[_0x5106('0x195')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 317f801..95a3aae 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 _0x33af=['seconds','prototype','startAcw','interface','queue','ACW','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','acwTimeout','lastPauseAt','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','saveUnpause','stringify','[ACW][STOP]\x20%s','message','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff'];(function(_0x398841,_0xfa02fe){var _0x171adc=function(_0x21f426){while(--_0x21f426){_0x398841['push'](_0x398841['shift']());}};_0x171adc(++_0xfa02fe);}(_0x33af,0xec));var _0xf33a=function(_0x23ca4d,_0x5c2a32){_0x23ca4d=_0x23ca4d-0x0;var _0x435432=_0x33af[_0x23ca4d];return _0x435432;};'use strict';var util=require('util');var _=require(_0xf33a('0x0'));var moment=require('moment');var ami=require(_0xf33a('0x1'));var logger=require(_0xf33a('0x2'))(_0xf33a('0x3'));var RpcUser=require(_0xf33a('0x4'));var RpcVoiceAgentReport=require(_0xf33a('0x5'));function Acw(_0x25f156){this['voiceQueues']=_0x25f156[_0xf33a('0x6')];this[_0xf33a('0x7')]=_0x25f156['agents'];this[_0xf33a('0x8')]=_0x25f156[_0xf33a('0x8')];this[_0xf33a('0x9')]={};ami['on'](_0xf33a('0xa'),this[_0xf33a('0xb')][_0xf33a('0xc')](this));ami['on']('hanguprequest',this[_0xf33a('0xd')][_0xf33a('0xc')](this));ami['on'](_0xf33a('0xe'),this[_0xf33a('0xf')][_0xf33a('0xc')](this));ami['on'](_0xf33a('0x10'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0xf33a('0x11'),this[_0xf33a('0x12')][_0xf33a('0xc')](this));ami['on'](_0xf33a('0x13'),this[_0xf33a('0x14')]['bind'](this));ami['on'](_0xf33a('0x15'),this[_0xf33a('0x16')]['bind'](this));}function getDiff(_0x506924){var _0x374b01=moment()[_0xf33a('0x17')](0x0);var _0x17043=moment(_0x506924)[_0xf33a('0x17')](0x0);return _0x374b01[_0xf33a('0x18')](_0x17043,_0xf33a('0x19'));}Acw[_0xf33a('0x1a')][_0xf33a('0x1b')]=function(_0x507cb9){try{var _0x441f59=this;var _0x5b5f27=this[_0xf33a('0x9')][_0x507cb9][_0xf33a('0x1c')];var _0x5138f9=this[_0xf33a('0x9')][_0x507cb9][_0xf33a('0x1d')];var _0x524109=this[_0xf33a('0x6')][_0x5138f9];var _0x23d9e2=![];var _0x38d69a=_0xf33a('0x1e');if(_0x524109['mandatoryDisposition']){if(_0x524109[_0xf33a('0x1f')][_0xf33a('0x20')]){_0x23d9e2=!![];_0x38d69a=_0x524109[_0xf33a('0x1f')][_0xf33a('0x20')];}}ami[_0xf33a('0x21')]({'action':_0xf33a('0x22'),'interface':_0x5b5f27,'paused':!![],'reason':_0x38d69a})[_0xf33a('0x23')](function(_0x288275){if(_0x441f59[_0xf33a('0x7')][_0x5b5f27]){return RpcUser[_0xf33a('0x24')](_0x441f59['agents'][_0x5b5f27]['id'])[_0xf33a('0x23')](function(_0x272e60){if(_0x272e60&&!_0x272e60[_0xf33a('0x25')]){logger[_0xf33a('0x26')](_0xf33a('0x27'),_0x507cb9,_0x5b5f27,_0x5138f9);var _0x51d3fd=_0x441f59[_0xf33a('0x9')][_0x507cb9]['attended']&&_0x441f59[_0xf33a('0x9')][_0x507cb9][_0xf33a('0x28')]?_0x441f59[_0xf33a('0x9')][_0x507cb9][_0xf33a('0x28')]:_0x507cb9;return RpcUser[_0xf33a('0x29')](_0x441f59['agents'][_0x5b5f27],_0x38d69a,_0x51d3fd)[_0xf33a('0x23')](function(_0x393005){if(!_0x23d9e2){_0x441f59['timers'][_0x5b5f27]={};logger['info'](_0xf33a('0x2a'),_0x507cb9,_0x441f59['voiceQueues'][_0x5138f9]['acwTimeout'],_0x5b5f27,_0x5138f9);_0x441f59[_0xf33a('0x8')][_0x5b5f27]['timer']=setTimeout(_0x441f59[_0xf33a('0x2b')]['bind'](_0x441f59,_0x5b5f27),_0x441f59[_0xf33a('0x6')][_0x5138f9][_0xf33a('0x2c')]*0x3e8);_0x441f59[_0xf33a('0x8')][_0x5b5f27][_0xf33a('0x2d')]=_0x393005[_0xf33a('0x2d')];_0x441f59[_0xf33a('0x8')][_0x5b5f27][_0xf33a('0x2e')]=_0x507cb9;_0x441f59[_0xf33a('0x8')][_0x5b5f27][_0xf33a('0x1d')]=_0x5138f9;_0x441f59[_0xf33a('0x8')][_0x5b5f27][_0xf33a('0x2f')]=function(){var _0x8f8ddc=getDiff(_0x441f59[_0xf33a('0x8')][_0x5b5f27][_0xf33a('0x2d')]);clearTimeout(_0x441f59[_0xf33a('0x8')][_0x5b5f27]['timer']);RpcVoiceAgentReport[_0xf33a('0x30')]({'acwtime':_0x8f8ddc},_0x441f59[_0xf33a('0x8')][_0x5b5f27][_0xf33a('0x2e')],_0x5b5f27)[_0xf33a('0x23')](function(_0x4ee492){logger[_0xf33a('0x26')](_0xf33a('0x31'),_0x507cb9,_0x8f8ddc,_0x4ee492);})[_0xf33a('0x32')](function(_0x31cb7c){logger[_0xf33a('0x33')](_0xf33a('0x34'),_0x507cb9,_0x31cb7c);});delete _0x441f59['timers'][_0x5b5f27];};}});}else{logger[_0xf33a('0x26')](_0xf33a('0x35'),_0x507cb9,_0x5b5f27,_0x5138f9);}});}})[_0xf33a('0x32')](function(_0x300007){logger[_0xf33a('0x33')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x507cb9,_0x441f59['voiceQueues'][_0x5138f9][_0xf33a('0x2c')],_0x5b5f27,_0x5138f9);})['finally'](function(){delete _0x441f59['channels'][_0x507cb9];});}catch(_0x4b9036){logger[_0xf33a('0x33')](_0xf33a('0x36'),_0x4b9036['message']);}};Acw[_0xf33a('0x1a')]['stopAcw']=function(_0x2103b5){try{var _0x1f11b3=this;if(_0x1f11b3[_0xf33a('0x8')][_0x2103b5]){var _0x2a8e9e=_0x1f11b3[_0xf33a('0x8')][_0x2103b5][_0xf33a('0x2e')];var _0x5a4076=_0x1f11b3[_0xf33a('0x8')][_0x2103b5][_0xf33a('0x1d')];var _0x5b8607=_0x1f11b3[_0xf33a('0x6')][_0x5a4076][_0xf33a('0x2c')];logger[_0xf33a('0x26')]('[TIMER][STOP][AGENT:%s]',_0x2103b5);RpcUser[_0xf33a('0x37')](this[_0xf33a('0x7')][_0x2103b5]);RpcVoiceAgentReport[_0xf33a('0x30')]({'acwtime':_0x5b8607,'agentacw':!![]},_0x2a8e9e,_0x2103b5)[_0xf33a('0x23')](function(_0x3ec562){logger[_0xf33a('0x26')](_0xf33a('0x31'),_0x2a8e9e,_0x5b8607,_0x3ec562);})[_0xf33a('0x32')](function(_0xd488ef){logger['error'](_0xf33a('0x34'),_0x2a8e9e,_0xd488ef);});}else{logger[_0xf33a('0x33')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x2103b5);if(_0x1f11b3[_0xf33a('0x8')]){logger['info']('[ACW][TIMERS]',JSON[_0xf33a('0x38')](_0x1f11b3[_0xf33a('0x8')]));}}}catch(_0x4dada1){logger[_0xf33a('0x33')](_0xf33a('0x39'),_0x4dada1[_0xf33a('0x3a')]);}};Acw['prototype'][_0xf33a('0xb')]=function(_0x21b8da){try{if(this['voiceQueues'][_0x21b8da[_0xf33a('0x1d')]]&&(this[_0xf33a('0x6')][_0x21b8da[_0xf33a('0x1d')]][_0xf33a('0x3')]||this[_0xf33a('0x6')][_0x21b8da['queue']][_0xf33a('0x3b')])){if(this[_0xf33a('0x7')][_0x21b8da[_0xf33a('0x1c')]]){this[_0xf33a('0x9')][_0x21b8da[_0xf33a('0x2e')]]={'queue':_0x21b8da['queue'],'interface':_0x21b8da[_0xf33a('0x1c')],'destlinkedid':_0x21b8da[_0xf33a('0x28')]};}}}catch(_0x6ae3ef){logger['error'](_0xf33a('0x3c'),_0x6ae3ef[_0xf33a('0x3a')]);}};Acw[_0xf33a('0x1a')][_0xf33a('0x16')]=function(_0x2e36f2){try{if(this[_0xf33a('0x6')][_0x2e36f2['queue']]&&(this[_0xf33a('0x6')][_0x2e36f2[_0xf33a('0x1d')]][_0xf33a('0x3')]||this[_0xf33a('0x6')][_0x2e36f2[_0xf33a('0x1d')]]['mandatoryDisposition'])){if(this[_0xf33a('0x7')][_0x2e36f2[_0xf33a('0x1c')]]){this[_0xf33a('0x9')][_0x2e36f2['uniqueid']]={'queue':_0x2e36f2[_0xf33a('0x1d')],'interface':_0x2e36f2[_0xf33a('0x1c')]};}}}catch(_0x4bcb39){logger['error'](_0xf33a('0x3d'),_0x4bcb39['message']);}};Acw[_0xf33a('0x1a')][_0xf33a('0xd')]=function(_0x333ac7){try{if(this[_0xf33a('0x9')][_0x333ac7[_0xf33a('0x2e')]]&&_[_0xf33a('0x3e')](this[_0xf33a('0x9')][_0x333ac7[_0xf33a('0x2e')]][_0xf33a('0x3f')])){logger[_0xf33a('0x26')](_0xf33a('0x40'),_0x333ac7[_0xf33a('0x2e')]);this[_0xf33a('0x1b')](_0x333ac7[_0xf33a('0x2e')]);}else if(this[_0xf33a('0x9')][_0x333ac7[_0xf33a('0x41')]]&&_[_0xf33a('0x3e')](this[_0xf33a('0x9')][_0x333ac7[_0xf33a('0x41')]][_0xf33a('0x3f')])){logger[_0xf33a('0x26')](_0xf33a('0x42'),_0x333ac7[_0xf33a('0x41')]);this[_0xf33a('0x1b')](_0x333ac7[_0xf33a('0x41')]);}}catch(_0x1b15a1){logger[_0xf33a('0x33')](_0xf33a('0x43'),_0x1b15a1[_0xf33a('0x3a')]);}};Acw['prototype'][_0xf33a('0xf')]=function(_0x3d70ca){try{if(this['channels'][_0x3d70ca[_0xf33a('0x2e')]]&&this[_0xf33a('0x9')][_0x3d70ca[_0xf33a('0x2e')]]['attended']){logger[_0xf33a('0x26')](_0xf33a('0x44'),_0x3d70ca[_0xf33a('0x2e')]);this['startAcw'](_0x3d70ca[_0xf33a('0x2e')]);}else if(this['channels'][_0x3d70ca[_0xf33a('0x41')]]&&this[_0xf33a('0x9')][_0x3d70ca['linkedid']]['attended']){logger[_0xf33a('0x26')](_0xf33a('0x45'),_0x3d70ca[_0xf33a('0x41')]);this['startAcw'](_0x3d70ca[_0xf33a('0x41')]);}}catch(_0x38c5df){logger[_0xf33a('0x33')](_0xf33a('0x46'),_0x38c5df[_0xf33a('0x3a')]);}};Acw[_0xf33a('0x1a')][_0xf33a('0x12')]=function(_0x5d66a4){try{if(!_[_0xf33a('0x47')](this['channels'][_0x5d66a4['transfereeuniqueid']])){this['startAcw'](_0x5d66a4[_0xf33a('0x48')]);if(this[_0xf33a('0x9')][_0x5d66a4[_0xf33a('0x49')]]){this['channels'][_0x5d66a4[_0xf33a('0x49')]][_0xf33a('0x3f')]=!![];this[_0xf33a('0x9')][_0x5d66a4[_0xf33a('0x4a')]]=this[_0xf33a('0x9')][_0x5d66a4['secondtransfereruniqueid']];delete this['channels'][_0x5d66a4['secondtransfereruniqueid']];}}else if(!_[_0xf33a('0x47')](this['channels'][_0x5d66a4[_0xf33a('0x4a')]])){this[_0xf33a('0x1b')](_0x5d66a4[_0xf33a('0x4a')]);if(this[_0xf33a('0x9')][_0x5d66a4[_0xf33a('0x4b')]]){this[_0xf33a('0x9')][_0x5d66a4['origtransfereruniqueid']][_0xf33a('0x3f')]=!![];this[_0xf33a('0x9')][_0x5d66a4[_0xf33a('0x48')]]=this['channels'][_0x5d66a4[_0xf33a('0x4b')]];delete this[_0xf33a('0x9')][_0x5d66a4[_0xf33a('0x4b')]];}}}catch(_0x24b575){logger[_0xf33a('0x33')](_0xf33a('0x4c'),_0x24b575[_0xf33a('0x3a')]);}};Acw[_0xf33a('0x1a')][_0xf33a('0x14')]=function(_0x4b1b00){try{if(this[_0xf33a('0x9')][_0x4b1b00[_0xf33a('0x4d')]]){logger[_0xf33a('0x26')](_0xf33a('0x4e'),JSON['stringify'](_0x4b1b00['transfereruniqueid']));this[_0xf33a('0x1b')](_0x4b1b00[_0xf33a('0x4d')]);}else if(this[_0xf33a('0x9')][_0x4b1b00[_0xf33a('0x4f')]]){logger[_0xf33a('0x26')](_0xf33a('0x50'),JSON[_0xf33a('0x38')](_0x4b1b00[_0xf33a('0x4f')]));this[_0xf33a('0x1b')](_0x4b1b00[_0xf33a('0x4f')]);}}catch(_0x3cc18f){logger['error'](_0xf33a('0x51'),_0x3cc18f[_0xf33a('0x3a')]);}};Acw[_0xf33a('0x1a')][_0xf33a('0x52')]=function(_0x3ffcca){try{if(this[_0xf33a('0x6')][_0x3ffcca[_0xf33a('0x1d')]]&&this[_0xf33a('0x6')][_0x3ffcca[_0xf33a('0x1d')]]['autopause']===_0xf33a('0x53')){if(this[_0xf33a('0x7')][_0x3ffcca['interface']]){logger[_0xf33a('0x26')](_0xf33a('0x54'),_0x3ffcca[_0xf33a('0x2e')],_0x3ffcca[_0xf33a('0x1c')],_0x3ffcca[_0xf33a('0x1d')]);return RpcUser[_0xf33a('0x29')](this['agents'][_0x3ffcca[_0xf33a('0x1c')]],_0xf33a('0x55'),_0x3ffcca[_0xf33a('0x2e')]);}}}catch(_0x289a08){logger[_0xf33a('0x33')](_0xf33a('0x56'),_0x289a08[_0xf33a('0x3a')]);}};module['exports']=Acw; \ No newline at end of file +var _0x2a07=['updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','util','lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','uniqueid','queue'];(function(_0x1365bb,_0x297a78){var _0x209ae2=function(_0x123c87){while(--_0x123c87){_0x1365bb['push'](_0x1365bb['shift']());}};_0x209ae2(++_0x297a78);}(_0x2a07,0x74));var _0x72a0=function(_0x423e15,_0x12b2b2){_0x423e15=_0x423e15-0x0;var _0x184279=_0x2a07[_0x423e15];return _0x184279;};'use strict';var util=require(_0x72a0('0x0'));var _=require(_0x72a0('0x1'));var moment=require(_0x72a0('0x2'));var ami=require(_0x72a0('0x3'));var logger=require(_0x72a0('0x4'))('acw');var RpcUser=require(_0x72a0('0x5'));var RpcVoiceAgentReport=require(_0x72a0('0x6'));function Acw(_0x135982){this[_0x72a0('0x7')]=_0x135982[_0x72a0('0x7')];this[_0x72a0('0x8')]=_0x135982[_0x72a0('0x8')];this[_0x72a0('0x9')]=_0x135982[_0x72a0('0x9')];this[_0x72a0('0xa')]={};ami['on'](_0x72a0('0xb'),this[_0x72a0('0xc')][_0x72a0('0xd')](this));ami['on'](_0x72a0('0xe'),this[_0x72a0('0xf')][_0x72a0('0xd')](this));ami['on']('hangup',this[_0x72a0('0x10')][_0x72a0('0xd')](this));ami['on']('agentringnoanswer',this[_0x72a0('0x11')][_0x72a0('0xd')](this));ami['on'](_0x72a0('0x12'),this[_0x72a0('0x13')][_0x72a0('0xd')](this));ami['on']('blindtransfer',this[_0x72a0('0x14')][_0x72a0('0xd')](this));ami['on'](_0x72a0('0x15'),this[_0x72a0('0x16')][_0x72a0('0xd')](this));}function getDiff(_0x324cbd){var _0xe73b5e=moment()['milliseconds'](0x0);var _0x4930c5=moment(_0x324cbd)[_0x72a0('0x17')](0x0);return _0xe73b5e[_0x72a0('0x18')](_0x4930c5,_0x72a0('0x19'));}Acw[_0x72a0('0x1a')][_0x72a0('0x1b')]=function(_0x3f3d62){try{var _0x4ab55e=this;var _0x30248e=this[_0x72a0('0xa')][_0x3f3d62][_0x72a0('0x1c')];var _0xb7e22d=this[_0x72a0('0xa')][_0x3f3d62]['queue'];var _0x100d8f=this[_0x72a0('0x7')][_0xb7e22d];var _0x131b73=![];var _0x5b63c8=_0x72a0('0x1d');if(_0x100d8f[_0x72a0('0x1e')]){if(_0x100d8f[_0x72a0('0x1f')][_0x72a0('0x20')]){_0x131b73=!![];_0x5b63c8=_0x100d8f['mandatoryDispositionPause'][_0x72a0('0x20')];}}ami['Action']({'action':_0x72a0('0x21'),'interface':_0x30248e,'paused':!![],'reason':_0x5b63c8})[_0x72a0('0x22')](function(_0xde058c){if(_0x4ab55e['agents'][_0x30248e]){return RpcUser[_0x72a0('0x23')](_0x4ab55e[_0x72a0('0x8')][_0x30248e]['id'])[_0x72a0('0x22')](function(_0x3d1965){if(_0x3d1965&&!_0x3d1965['voicePause']){logger[_0x72a0('0x24')](_0x72a0('0x25'),_0x3f3d62,_0x30248e,_0xb7e22d);var _0x1ddd54=_0x4ab55e[_0x72a0('0xa')][_0x3f3d62][_0x72a0('0x26')]&&_0x4ab55e[_0x72a0('0xa')][_0x3f3d62]['destlinkedid']?_0x4ab55e['channels'][_0x3f3d62][_0x72a0('0x27')]:_0x3f3d62;return RpcUser[_0x72a0('0x28')](_0x4ab55e[_0x72a0('0x8')][_0x30248e],_0x5b63c8,_0x1ddd54)[_0x72a0('0x22')](function(_0xf5cb49){if(!_0x131b73){_0x4ab55e[_0x72a0('0x9')][_0x30248e]={};logger[_0x72a0('0x24')](_0x72a0('0x29'),_0x3f3d62,_0x4ab55e[_0x72a0('0x7')][_0xb7e22d][_0x72a0('0x2a')],_0x30248e,_0xb7e22d);_0x4ab55e['timers'][_0x30248e][_0x72a0('0x2b')]=setTimeout(_0x4ab55e[_0x72a0('0x2c')][_0x72a0('0xd')](_0x4ab55e,_0x30248e),_0x4ab55e[_0x72a0('0x7')][_0xb7e22d][_0x72a0('0x2a')]*0x3e8);_0x4ab55e[_0x72a0('0x9')][_0x30248e][_0x72a0('0x2d')]=_0xf5cb49[_0x72a0('0x2d')];_0x4ab55e[_0x72a0('0x9')][_0x30248e][_0x72a0('0x2e')]=_0x3f3d62;_0x4ab55e['timers'][_0x30248e][_0x72a0('0x2f')]=_0xb7e22d;_0x4ab55e[_0x72a0('0x9')][_0x30248e][_0x72a0('0x30')]=function(){var _0xfbe9b3=getDiff(_0x4ab55e[_0x72a0('0x9')][_0x30248e][_0x72a0('0x2d')]);clearTimeout(_0x4ab55e[_0x72a0('0x9')][_0x30248e]['timer']);RpcVoiceAgentReport[_0x72a0('0x31')]({'acwtime':_0xfbe9b3},_0x4ab55e[_0x72a0('0x9')][_0x30248e][_0x72a0('0x2e')],_0x30248e)[_0x72a0('0x22')](function(_0x89d598){logger[_0x72a0('0x24')](_0x72a0('0x32'),_0x3f3d62,_0xfbe9b3,_0x89d598);})[_0x72a0('0x33')](function(_0x5e93f8){logger[_0x72a0('0x34')](_0x72a0('0x35'),_0x3f3d62,_0x5e93f8);});delete _0x4ab55e[_0x72a0('0x9')][_0x30248e];};}});}else{logger['info'](_0x72a0('0x36'),_0x3f3d62,_0x30248e,_0xb7e22d);}});}})['catch'](function(_0x4b2b44){logger[_0x72a0('0x34')](_0x72a0('0x29'),_0x3f3d62,_0x4ab55e[_0x72a0('0x7')][_0xb7e22d][_0x72a0('0x2a')],_0x30248e,_0xb7e22d);})[_0x72a0('0x37')](function(){delete _0x4ab55e[_0x72a0('0xa')][_0x3f3d62];});}catch(_0x148e71){logger[_0x72a0('0x34')](_0x72a0('0x38'),_0x148e71[_0x72a0('0x39')]);}};Acw[_0x72a0('0x1a')]['stopAcw']=function(_0x265d96){try{var _0x5eb8f1=this;if(_0x5eb8f1[_0x72a0('0x9')][_0x265d96]){var _0x13c251=_0x5eb8f1[_0x72a0('0x9')][_0x265d96][_0x72a0('0x2e')];var _0xbb1f4=_0x5eb8f1[_0x72a0('0x9')][_0x265d96][_0x72a0('0x2f')];var _0x3c9b74=_0x5eb8f1[_0x72a0('0x7')][_0xbb1f4]['acwTimeout'];logger['info'](_0x72a0('0x3a'),_0x265d96);RpcUser[_0x72a0('0x3b')](this[_0x72a0('0x8')][_0x265d96]);RpcVoiceAgentReport[_0x72a0('0x31')]({'acwtime':_0x3c9b74,'agentacw':!![]},_0x13c251,_0x265d96)[_0x72a0('0x22')](function(_0x512a06){logger[_0x72a0('0x24')](_0x72a0('0x32'),_0x13c251,_0x3c9b74,_0x512a06);})['catch'](function(_0x21ad08){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x13c251,_0x21ad08);});}else{logger['error'](_0x72a0('0x3c'),_0x265d96);if(_0x5eb8f1['timers']){logger[_0x72a0('0x24')](_0x72a0('0x3d'),JSON[_0x72a0('0x3e')](_0x5eb8f1[_0x72a0('0x9')]));}}}catch(_0x4bf56e){logger['error']('[ACW][STOP]\x20%s',_0x4bf56e['message']);}};Acw[_0x72a0('0x1a')][_0x72a0('0xc')]=function(_0x4a7032){try{if(this[_0x72a0('0x7')][_0x4a7032[_0x72a0('0x2f')]]&&(this['voiceQueues'][_0x4a7032[_0x72a0('0x2f')]][_0x72a0('0x3f')]||this[_0x72a0('0x7')][_0x4a7032[_0x72a0('0x2f')]][_0x72a0('0x1e')])){if(this[_0x72a0('0x8')][_0x4a7032['interface']]){this[_0x72a0('0xa')][_0x4a7032['uniqueid']]={'queue':_0x4a7032[_0x72a0('0x2f')],'interface':_0x4a7032['interface'],'destlinkedid':_0x4a7032[_0x72a0('0x27')]};}}}catch(_0x3bd306){logger['error'](_0x72a0('0x40'),_0x3bd306['message']);}};Acw[_0x72a0('0x1a')][_0x72a0('0x16')]=function(_0x13254c){try{if(this['voiceQueues'][_0x13254c[_0x72a0('0x2f')]]&&(this[_0x72a0('0x7')][_0x13254c[_0x72a0('0x2f')]]['acw']||this['voiceQueues'][_0x13254c[_0x72a0('0x2f')]]['mandatoryDisposition'])){if(this[_0x72a0('0x8')][_0x13254c[_0x72a0('0x1c')]]){this[_0x72a0('0xa')][_0x13254c[_0x72a0('0x2e')]]={'queue':_0x13254c[_0x72a0('0x2f')],'interface':_0x13254c[_0x72a0('0x1c')]};}}}catch(_0x451558){logger[_0x72a0('0x34')](_0x72a0('0x41'),_0x451558['message']);}};Acw[_0x72a0('0x1a')][_0x72a0('0xf')]=function(_0x134150){try{if(this[_0x72a0('0xa')][_0x134150[_0x72a0('0x2e')]]&&_[_0x72a0('0x42')](this[_0x72a0('0xa')][_0x134150['uniqueid']]['attended'])){logger[_0x72a0('0x24')](_0x72a0('0x43'),_0x134150[_0x72a0('0x2e')]);this[_0x72a0('0x1b')](_0x134150[_0x72a0('0x2e')]);}else if(this[_0x72a0('0xa')][_0x134150[_0x72a0('0x44')]]&&_[_0x72a0('0x42')](this[_0x72a0('0xa')][_0x134150[_0x72a0('0x44')]]['attended'])){logger[_0x72a0('0x24')](_0x72a0('0x45'),_0x134150[_0x72a0('0x44')]);this[_0x72a0('0x1b')](_0x134150[_0x72a0('0x44')]);}}catch(_0x5c1570){logger[_0x72a0('0x34')]('[ACW][syncHangupRequest]\x20%s',_0x5c1570['message']);}};Acw[_0x72a0('0x1a')][_0x72a0('0x10')]=function(_0x343f42){try{if(this[_0x72a0('0xa')][_0x343f42[_0x72a0('0x2e')]]&&this['channels'][_0x343f42[_0x72a0('0x2e')]][_0x72a0('0x26')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x343f42[_0x72a0('0x2e')]);this[_0x72a0('0x1b')](_0x343f42[_0x72a0('0x2e')]);}else if(this[_0x72a0('0xa')][_0x343f42[_0x72a0('0x44')]]&&this[_0x72a0('0xa')][_0x343f42[_0x72a0('0x44')]][_0x72a0('0x26')]){logger['info'](_0x72a0('0x46'),_0x343f42['linkedid']);this['startAcw'](_0x343f42['linkedid']);}}catch(_0x1f30e0){logger[_0x72a0('0x34')]('[ACW][syncHangup]\x20%s',_0x1f30e0[_0x72a0('0x39')]);}};Acw['prototype'][_0x72a0('0x13')]=function(_0x5a0ec6){try{if(!_['isNil'](this[_0x72a0('0xa')][_0x5a0ec6[_0x72a0('0x47')]])){this['startAcw'](_0x5a0ec6[_0x72a0('0x47')]);if(this['channels'][_0x5a0ec6[_0x72a0('0x48')]]){this['channels'][_0x5a0ec6['secondtransfereruniqueid']][_0x72a0('0x26')]=!![];this[_0x72a0('0xa')][_0x5a0ec6[_0x72a0('0x49')]]=this['channels'][_0x5a0ec6['secondtransfereruniqueid']];delete this[_0x72a0('0xa')][_0x5a0ec6['secondtransfereruniqueid']];}}else if(!_[_0x72a0('0x4a')](this[_0x72a0('0xa')][_0x5a0ec6[_0x72a0('0x49')]])){this[_0x72a0('0x1b')](_0x5a0ec6[_0x72a0('0x49')]);if(this[_0x72a0('0xa')][_0x5a0ec6[_0x72a0('0x4b')]]){this[_0x72a0('0xa')][_0x5a0ec6[_0x72a0('0x4b')]][_0x72a0('0x26')]=!![];this[_0x72a0('0xa')][_0x5a0ec6[_0x72a0('0x47')]]=this['channels'][_0x5a0ec6[_0x72a0('0x4b')]];delete this['channels'][_0x5a0ec6['origtransfereruniqueid']];}}}catch(_0x55ba28){logger['error'](_0x72a0('0x4c'),_0x55ba28[_0x72a0('0x39')]);}};Acw[_0x72a0('0x1a')]['syncBlindTransfer']=function(_0x27398d){try{if(this['channels'][_0x27398d[_0x72a0('0x4d')]]){logger[_0x72a0('0x24')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x72a0('0x3e')](_0x27398d[_0x72a0('0x4d')]));this[_0x72a0('0x1b')](_0x27398d[_0x72a0('0x4d')]);}else if(this['channels'][_0x27398d[_0x72a0('0x4e')]]){logger['info'](_0x72a0('0x4f'),JSON[_0x72a0('0x3e')](_0x27398d[_0x72a0('0x4e')]));this['startAcw'](_0x27398d[_0x72a0('0x4e')]);}}catch(_0x3eb3b5){logger[_0x72a0('0x34')](_0x72a0('0x50'),_0x3eb3b5[_0x72a0('0x39')]);}};Acw['prototype']['syncAgentRingNoAnswer']=function(_0xa65d14){try{if(this['voiceQueues'][_0xa65d14[_0x72a0('0x2f')]]&&this['voiceQueues'][_0xa65d14[_0x72a0('0x2f')]][_0x72a0('0x51')]==='all'){if(this[_0x72a0('0x8')][_0xa65d14[_0x72a0('0x1c')]]){logger[_0x72a0('0x24')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0xa65d14[_0x72a0('0x2e')],_0xa65d14['interface'],_0xa65d14[_0x72a0('0x2f')]);return RpcUser[_0x72a0('0x28')](this['agents'][_0xa65d14[_0x72a0('0x1c')]],'Auto-Pause',_0xa65d14['uniqueid']);}}}catch(_0x5142de){logger[_0x72a0('0x34')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x5142de[_0x72a0('0x39')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 1b3f17d..148f946 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 _0x310e=['actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionDeviceStateList','catch','asterisk-manager','moment','util','lodash','../../config/logger','ami','port','asterisk','username','keepConnected','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','devicestatelist'];(function(_0x9a4341,_0x1dae3e){var _0x2e433f=function(_0xeeca76){while(--_0xeeca76){_0x9a4341['push'](_0x9a4341['shift']());}};_0x2e433f(++_0x1dae3e);}(_0x310e,0x96));var _0xe310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x310e[_0x3dd15e];return _0x231fd0;};'use strict';var Manager=require(_0xe310('0x0'));var BPromise=require('bluebird');var moment=require(_0xe310('0x1'));var util=require(_0xe310('0x2'));var _=require(_0xe310('0x3'));var logger=require(_0xe310('0x4'))(_0xe310('0x5'));var config=require('../../config/environment');var ami=new Manager(config['asterisk'][_0xe310('0x6')],config[_0xe310('0x7')]['ip'],config[_0xe310('0x7')][_0xe310('0x8')],config[_0xe310('0x7')]['password'],!![]);ami[_0xe310('0x9')]();ami[_0xe310('0xa')]=BPromise[_0xe310('0xb')](ami[_0xe310('0xc')]);function error(_0x295592){logger['error'](util[_0xe310('0xd')](_0xe310('0xe'),config['asterisk']['username'],config[_0xe310('0x7')]['ip'],config[_0xe310('0x7')][_0xe310('0x6')],util[_0xe310('0xf')](_0x295592,![],null)));}function close(){logger[_0xe310('0x10')](util[_0xe310('0xd')](_0xe310('0x11'),config[_0xe310('0x7')][_0xe310('0x8')],config[_0xe310('0x7')]['ip'],config[_0xe310('0x7')][_0xe310('0x6')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xe310('0xa')]({'action':_0xe310('0x12')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xe310('0xa')]({'action':_0xe310('0x13')});};};ami[_0xe310('0x14')]=function(){return function(){return ami[_0xe310('0xa')]({'action':_0xe310('0x15')});};};ami[_0xe310('0x16')]=function(){return function(){return ami[_0xe310('0xa')]({'action':_0xe310('0x17')});};};ami[_0xe310('0x18')]=function(){return function(){return ami[_0xe310('0xa')]({'action':'coreshowchannels'});};};function connect(_0x50bc8c){logger[_0xe310('0x19')](util[_0xe310('0xd')](_0xe310('0x1a'),config['asterisk'][_0xe310('0x8')],config[_0xe310('0x7')]['ip'],config['asterisk'][_0xe310('0x6')]));ami['once']('error',error);ami[_0xe310('0x1b')](_0xe310('0x1c'),close);}ami['on']('connect',connect);ami['on'](_0xe310('0x1d'),function(_0x371a30){logger[_0xe310('0x19')](util[_0xe310('0xd')](_0xe310('0x1e'),config[_0xe310('0x7')][_0xe310('0x8')],config[_0xe310('0x7')]['ip'],config['asterisk'][_0xe310('0x6')],util['inspect'](_0x371a30,![],null)));});ami['on']('fullybooted',function(_0x352d2d){logger[_0xe310('0x19')](util[_0xe310('0xd')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xe310('0x7')][_0xe310('0x8')],config[_0xe310('0x7')]['ip'],config[_0xe310('0x7')][_0xe310('0x6')]));return BPromise['resolve']()[_0xe310('0x1f')](ami['actionSipShowRegistry']())[_0xe310('0x1f')](ami[_0xe310('0x20')]())[_0xe310('0x1f')](ami[_0xe310('0x14')]())['then'](ami['actionQueueSummary']())[_0xe310('0x1f')](ami[_0xe310('0x18')]())[_0xe310('0x21')](function(_0x146402){console['log'](_0x146402);});});ami[_0xe310('0x1b')]('error',error);ami[_0xe310('0x1b')](_0xe310('0x1c'),close);module['exports']=ami; \ No newline at end of file +var _0x9884=['once','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','actionSipShowRegistry','actionDeviceStateList','actionQueueSummary','log','exports','bluebird','moment','lodash','../../config/logger','asterisk','port','username','keepConnected','Action','action','error','format','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s'];(function(_0x3ee5a9,_0x59aa32){var _0x51d8e6=function(_0x4aac9a){while(--_0x4aac9a){_0x3ee5a9['push'](_0x3ee5a9['shift']());}};_0x51d8e6(++_0x59aa32);}(_0x9884,0x148));var _0x4988=function(_0x323a65,_0x3b37d3){_0x323a65=_0x323a65-0x0;var _0x224ef3=_0x9884[_0x323a65];return _0x224ef3;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x4988('0x0'));var moment=require(_0x4988('0x1'));var util=require('util');var _=require(_0x4988('0x2'));var logger=require(_0x4988('0x3'))('ami');var config=require('../../config/environment');var ami=new Manager(config[_0x4988('0x4')][_0x4988('0x5')],config[_0x4988('0x4')]['ip'],config[_0x4988('0x4')][_0x4988('0x6')],config[_0x4988('0x4')]['password'],!![]);ami[_0x4988('0x7')]();ami[_0x4988('0x8')]=BPromise['promisify'](ami[_0x4988('0x9')]);function error(_0x288b01){logger[_0x4988('0xa')](util[_0x4988('0xb')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x4988('0x4')][_0x4988('0x6')],config[_0x4988('0x4')]['ip'],config[_0x4988('0x4')][_0x4988('0x5')],util[_0x4988('0xc')](_0x288b01,![],null)));}function close(){logger[_0x4988('0xa')](util['format'](_0x4988('0xd'),config[_0x4988('0x4')][_0x4988('0x6')],config[_0x4988('0x4')]['ip'],config[_0x4988('0x4')]['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x4988('0x8')]({'action':_0x4988('0xe')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x4988('0x8')]({'action':_0x4988('0xf')});};};ami[_0x4988('0x10')]=function(){return function(){return ami[_0x4988('0x8')]({'action':_0x4988('0x11')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x4988('0x8')]({'action':_0x4988('0x12')});};};ami[_0x4988('0x13')]=function(){return function(){return ami[_0x4988('0x8')]({'action':_0x4988('0x14')});};};function connect(_0x1f7f79){logger['info'](util[_0x4988('0xb')](_0x4988('0x15'),config['asterisk'][_0x4988('0x6')],config['asterisk']['ip'],config[_0x4988('0x4')]['port']));ami[_0x4988('0x16')](_0x4988('0xa'),error);ami[_0x4988('0x16')](_0x4988('0x17'),close);}ami['on']('connect',connect);ami['on'](_0x4988('0x18'),function(_0x1a2382){logger[_0x4988('0x19')](util[_0x4988('0xb')](_0x4988('0x1a'),config[_0x4988('0x4')]['username'],config[_0x4988('0x4')]['ip'],config[_0x4988('0x4')][_0x4988('0x5')],util[_0x4988('0xc')](_0x1a2382,![],null)));});ami['on'](_0x4988('0x1b'),function(_0x20ca19){logger[_0x4988('0x19')](util[_0x4988('0xb')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x4988('0x4')][_0x4988('0x6')],config[_0x4988('0x4')]['ip'],config[_0x4988('0x4')][_0x4988('0x5')]));return BPromise[_0x4988('0x1c')]()[_0x4988('0x1d')](ami[_0x4988('0x1e')]())[_0x4988('0x1d')](ami[_0x4988('0x1f')]())[_0x4988('0x1d')](ami[_0x4988('0x10')]())[_0x4988('0x1d')](ami[_0x4988('0x20')]())[_0x4988('0x1d')](ami[_0x4988('0x13')]())['catch'](function(_0x491838){console[_0x4988('0x21')](_0x491838);});});ami['once']('error',error);ami[_0x4988('0x16')](_0x4988('0x17'),close);module[_0x4988('0x22')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 37384d8..1fcb900 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 _0x096d=['exports','bluebird','ami','client','Request','request','then','debug','memberReport','error','rpc','message','result','catch'];(function(_0x2647d8,_0x496c56){var _0x433340=function(_0xbd30c0){while(--_0xbd30c0){_0x2647d8['push'](_0x2647d8['shift']());}};_0x433340(++_0x496c56);}(_0x096d,0x10b));var _0xd096=function(_0x4c2d60,_0x92e137){_0x4c2d60=_0x4c2d60-0x0;var _0x29664f=_0x096d[_0x4c2d60];return _0x29664f;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xd096('0x0'));var logger=require('../../config/logger')(_0xd096('0x1'));var client=jayson[_0xd096('0x2')]['http']({'port':0x2329});client[_0xd096('0x3')]=function(_0x450554,_0x30c243){return new BPromise(function(_0x323fc0,_0x15379a){return client[_0xd096('0x4')](_0x450554,_0x30c243)[_0xd096('0x5')](function(_0x1baa31){logger[_0xd096('0x6')]('rpc',_0xd096('0x7'),_0x450554,_0x30c243,_0x1baa31);if(_0x1baa31[_0xd096('0x8')]){logger[_0xd096('0x8')](_0xd096('0x9'),_0xd096('0x7'),_0x450554,_0x1baa31[_0xd096('0x8')][_0xd096('0xa')],_0x30c243);return _0x15379a(_0x1baa31[_0xd096('0x8')][_0xd096('0xa')]);}else{return _0x323fc0(_0x1baa31[_0xd096('0xb')]);}})[_0xd096('0xc')](function(_0x55973f){logger[_0xd096('0x8')](_0xd096('0x9'),_0xd096('0x7'),_0x450554,_0x55973f,_0x30c243);return _0x15379a(_0x55973f);});});};module[_0xd096('0xd')]=client; \ No newline at end of file +var _0x71d8=['client','http','Request','request','debug','rpc','memberReport','error','message','result','exports','../../config/logger'];(function(_0x4a15e8,_0xbdad9b){var _0x5c536f=function(_0x467aec){while(--_0x467aec){_0x4a15e8['push'](_0x4a15e8['shift']());}};_0x5c536f(++_0xbdad9b);}(_0x71d8,0x77));var _0x871d=function(_0x4f6f69,_0x3e672e){_0x4f6f69=_0x4f6f69-0x0;var _0x41891f=_0x71d8[_0x4f6f69];return _0x41891f;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x871d('0x0'))('ami');var client=jayson[_0x871d('0x1')][_0x871d('0x2')]({'port':0x2329});client[_0x871d('0x3')]=function(_0x1fe796,_0x23c5a1){return new BPromise(function(_0x3a1af4,_0x4c5f0f){return client[_0x871d('0x4')](_0x1fe796,_0x23c5a1)['then'](function(_0x1f1a30){logger[_0x871d('0x5')](_0x871d('0x6'),_0x871d('0x7'),_0x1fe796,_0x23c5a1,_0x1f1a30);if(_0x1f1a30[_0x871d('0x8')]){logger[_0x871d('0x8')](_0x871d('0x6'),_0x871d('0x7'),_0x1fe796,_0x1f1a30[_0x871d('0x8')][_0x871d('0x9')],_0x23c5a1);return _0x4c5f0f(_0x1f1a30['error'][_0x871d('0x9')]);}else{return _0x3a1af4(_0x1f1a30[_0x871d('0xa')]);}})['catch'](function(_0x1a6812){logger[_0x871d('0x8')](_0x871d('0x6'),'memberReport',_0x1fe796,_0x1a6812,_0x23c5a1);return _0x4c5f0f(_0x1a6812);});});};module[_0x871d('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 2025085..e3d10c7 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 _0xeac9=['scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','format','callback','callbackuniqueid','callbackat','recallme','getCaller','dialCutDigit','substring','prototype','getQueue','queue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','phone','Contact','firstName','lastName','number','active','type','dialQueueTimeout'];(function(_0x280265,_0x391e3b){var _0x5ac28a=function(_0x1d98fc){while(--_0x1d98fc){_0x280265['push'](_0x280265['shift']());}};_0x5ac28a(++_0x391e3b);}(_0xeac9,0x16c));var _0x9eac=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xeac9[_0xc4001c];return _0x49f7bc;};'use strict';var util=require(_0x9eac('0x0'));var _=require(_0x9eac('0x1'));var moment=require(_0x9eac('0x2'));function checkNameSurname(_0x197fb1,_0x52bb8c,_0x579d20){var _0x34d838='';if(!_[_0x9eac('0x3')](_0x52bb8c)&&_0x9eac('0x4')===typeof _0x52bb8c){_0x34d838+=_0x52bb8c;}if(!_[_0x9eac('0x3')](_0x579d20)&&'string'===typeof _0x579d20){_0x34d838+='\x20'+_0x579d20;}if(_0x34d838!==''){return _0x34d838;}return _0x197fb1;}function Action(_0x381a50,_0x11eaef,_0x86ba63){this[_0x9eac('0x5')]=_0x381a50;this[_0x9eac('0x6')]=_0x86ba63||undefined;this[_0x9eac('0x7')]=checkNameSurname(_0x11eaef['Contact'][_0x9eac('0x8')],_0x11eaef[_0x9eac('0x9')][_0x9eac('0xa')],_0x11eaef[_0x9eac('0x9')][_0x9eac('0xb')]);this[_0x9eac('0xc')]=_0x11eaef[_0x9eac('0x9')]['phone'];this['queue']=_0x381a50[_0x9eac('0x7')];this[_0x9eac('0xd')]=_0x11eaef['active']||![];this[_0x9eac('0xe')]=_0x381a50['type'];this[_0x9eac('0xf')]=_0x381a50['dialQueueTimeout']||0x3;this['scheduledat']=_0x11eaef[_0x9eac('0x10')];this[_0x9eac('0x11')]=_0x11eaef[_0x9eac('0x11')];this[_0x9eac('0x12')]=_0x11eaef[_0x9eac('0x12')];this[_0x9eac('0x13')]=_0x11eaef[_0x9eac('0x13')];this[_0x9eac('0x14')]=_0x11eaef[_0x9eac('0x14')];this[_0x9eac('0x15')]=_0x11eaef[_0x9eac('0x15')];this[_0x9eac('0x16')]=_0x11eaef['UserId'];this[_0x9eac('0x17')]=_0x11eaef[_0x9eac('0x17')];this[_0x9eac('0x18')]=_0x11eaef[_0x9eac('0x18')];this[_0x9eac('0x19')]=_0x11eaef['id'];this['ContactFirstName']=_0x11eaef[_0x9eac('0x9')][_0x9eac('0xa')]||'';this['starttime']=moment()[_0x9eac('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x9eac('0x1b')]=_0x11eaef['callback'];this[_0x9eac('0x1c')]=_0x11eaef['callbackuniqueid'];this[_0x9eac('0x1d')]=_0x11eaef[_0x9eac('0x1d')];this[_0x9eac('0x1e')]=_0x11eaef[_0x9eac('0x1e')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action['prototype'][_0x9eac('0x1f')]=function(){return util[_0x9eac('0x1a')]('\x22%s\x22\x20<%s>',this[_0x9eac('0x7')],this['voiceQueue'][_0x9eac('0x20')]>0x0?this[_0x9eac('0xc')][_0x9eac('0x21')](this['voiceQueue']['dialCutDigit']):this[_0x9eac('0xc')]);};Action[_0x9eac('0x22')][_0x9eac('0x23')]=function(){return this[_0x9eac('0x24')];};module[_0x9eac('0x25')]=Action; \ No newline at end of file +var _0x26c7=['number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','lastName'];(function(_0x5b1f99,_0x5400b2){var _0x478845=function(_0x463fdc){while(--_0x463fdc){_0x5b1f99['push'](_0x5b1f99['shift']());}};_0x478845(++_0x5400b2);}(_0x26c7,0x91));var _0x726c=function(_0x3eb017,_0x145f85){_0x3eb017=_0x3eb017-0x0;var _0x54f041=_0x26c7[_0x3eb017];return _0x54f041;};'use strict';var util=require(_0x726c('0x0'));var _=require(_0x726c('0x1'));var moment=require(_0x726c('0x2'));function checkNameSurname(_0x686f9a,_0x593c56,_0x31f57a){var _0x32b515='';if(!_[_0x726c('0x3')](_0x593c56)&&_0x726c('0x4')===typeof _0x593c56){_0x32b515+=_0x593c56;}if(!_[_0x726c('0x3')](_0x31f57a)&&'string'===typeof _0x31f57a){_0x32b515+='\x20'+_0x31f57a;}if(_0x32b515!==''){return _0x32b515;}return _0x686f9a;}function Action(_0x18591c,_0xa77f50,_0x3a8a6a){this[_0x726c('0x5')]=_0x18591c;this[_0x726c('0x6')]=_0x3a8a6a||undefined;this[_0x726c('0x7')]=checkNameSurname(_0xa77f50[_0x726c('0x8')]['phone'],_0xa77f50[_0x726c('0x8')][_0x726c('0x9')],_0xa77f50['Contact'][_0x726c('0xa')]);this[_0x726c('0xb')]=_0xa77f50[_0x726c('0x8')][_0x726c('0xc')];this[_0x726c('0xd')]=_0x18591c[_0x726c('0x7')];this[_0x726c('0xe')]=_0xa77f50[_0x726c('0xe')]||![];this[_0x726c('0xf')]=_0x18591c[_0x726c('0xf')];this[_0x726c('0x10')]=_0x18591c[_0x726c('0x10')]||0x3;this[_0x726c('0x11')]=_0xa77f50[_0x726c('0x11')];this['countbusyretry']=_0xa77f50[_0x726c('0x12')];this[_0x726c('0x13')]=_0xa77f50[_0x726c('0x13')];this['countnoanswerretry']=_0xa77f50[_0x726c('0x14')];this[_0x726c('0x15')]=_0xa77f50[_0x726c('0x15')];this['ListId']=_0xa77f50[_0x726c('0x16')];this[_0x726c('0x17')]=_0xa77f50[_0x726c('0x17')];this[_0x726c('0x18')]=_0xa77f50['VoiceQueueId'];this[_0x726c('0x19')]=_0xa77f50[_0x726c('0x19')];this[_0x726c('0x1a')]=_0xa77f50['id'];this[_0x726c('0x1b')]=_0xa77f50[_0x726c('0x8')][_0x726c('0x9')]||'';this[_0x726c('0x1c')]=moment()[_0x726c('0x1d')](_0x726c('0x1e'));this[_0x726c('0x1f')]=_0xa77f50[_0x726c('0x1f')];this[_0x726c('0x20')]=_0xa77f50['callbackuniqueid'];this[_0x726c('0x21')]=_0xa77f50[_0x726c('0x21')];this['recallme']=_0xa77f50[_0x726c('0x22')];this['originatecalleridnum']='';this[_0x726c('0x23')]='';}Action[_0x726c('0x24')]['getCaller']=function(){return util[_0x726c('0x1d')](_0x726c('0x25'),this['name'],this[_0x726c('0x5')]['dialCutDigit']>0x0?this[_0x726c('0xb')]['substring'](this[_0x726c('0x5')]['dialCutDigit']):this[_0x726c('0xb')]);};Action[_0x726c('0x24')]['getQueue']=function(){return this[_0x726c('0xd')];};module[_0x726c('0x26')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 1be68e3..58da67c 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 _0x408d=['answertime','ringtime','holdtime','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','uniqueid','calleridname','calleridnum','starttime','responsetime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x408d,0xd5));var _0xd408=function(_0x262ff6,_0x158799){_0x262ff6=_0x262ff6-0x0;var _0x4c9b82=_0x408d[_0x262ff6];return _0x4c9b82;};'use strict';var util=require(_0xd408('0x0'));var _=require('lodash');var moment=require(_0xd408('0x1'));function getSeconds(_0x359395,_0x2e2ff8){var _0x514afc=moment(_0x359395)['milliseconds'](0x0);var _0x53c6f1=moment(_0x2e2ff8)[_0xd408('0x2')](0x0);return _0x514afc[_0xd408('0x3')](_0x53c6f1,_0xd408('0x4'));}function AgentComplete(_0x2a33fa,_0x22e810){this[_0xd408('0x5')]=0x4;this[_0xd408('0x6')]=_0xd408('0x7');this[_0xd408('0x8')]=_0x2a33fa[_0xd408('0x8')];this['type']=_0x2a33fa[_0xd408('0x9')];this[_0xd408('0xa')]=_0x2a33fa[_0xd408('0x9')]===_0xd408('0xb')?_0xd408('0xc'):_0x2a33fa['type'];this[_0xd408('0xd')]=_0x2a33fa[_0xd408('0xd')];this[_0xd408('0xe')]=_0x2a33fa['countcongestionretry'];this['countnoanswerretry']=_0x2a33fa[_0xd408('0xf')];this['countglobal']=_0x2a33fa[_0xd408('0xd')]+_0x2a33fa[_0xd408('0xe')]+_0x2a33fa[_0xd408('0xf')];this[_0xd408('0x10')]=_0x22e810[_0xd408('0x10')];this[_0xd408('0x11')]=_0x2a33fa['name'];this[_0xd408('0x12')]=_0x2a33fa['number'];this[_0xd408('0x13')]=_0x2a33fa[_0xd408('0x13')];this['responsetime']=_0x2a33fa[_0xd408('0x14')];this[_0xd408('0x15')]=_0x2a33fa[_0xd408('0x15')];this['endtime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xd408('0x16')]=getSeconds(_0x2a33fa['responsetime'],_0x2a33fa[_0xd408('0x13')]);this[_0xd408('0x17')]=getSeconds(_0x2a33fa[_0xd408('0x15')],_0x2a33fa[_0xd408('0x14')]);this[_0xd408('0x18')]=getSeconds(this[_0xd408('0x19')],_0x2a33fa['answertime']);this[_0xd408('0xc')]=_0x22e810[_0xd408('0xc')];this[_0xd408('0x1a')]=_0x22e810[_0xd408('0x1a')];this['reason']=_0x22e810[_0xd408('0x1b')];this[_0xd408('0x1c')]=_0x2a33fa[_0xd408('0x1c')];this[_0xd408('0x1d')]=_0x2a33fa[_0xd408('0x1d')];this[_0xd408('0x1e')]=_0x2a33fa[_0xd408('0x1e')];this['recallme']=_0x2a33fa['recallme'];this[_0xd408('0x1f')]=_0x2a33fa[_0xd408('0x1f')];this[_0xd408('0x20')]=_0x2a33fa['ListId'];this[_0xd408('0x21')]=_0x2a33fa[_0xd408('0x21')];this[_0xd408('0x22')]=_0x2a33fa[_0xd408('0x22')];this['CampaignId']=_0x2a33fa[_0xd408('0x23')];this[_0xd408('0x24')]=_0x2a33fa['originatecalleridnum']||'';this[_0xd408('0x25')]=_0x2a33fa[_0xd408('0x25')]||'';}module[_0xd408('0x26')]=AgentComplete; \ No newline at end of file +var _0x2e22=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','calleridname','name','calleridnum','number','starttime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','responsetime','holdtime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme'];(function(_0x126fb9,_0x122c59){var _0xc8a3b1=function(_0x355744){while(--_0x355744){_0x126fb9['push'](_0x126fb9['shift']());}};_0xc8a3b1(++_0x122c59);}(_0x2e22,0x148));var _0x22e2=function(_0x496ee9,_0x4dba12){_0x496ee9=_0x496ee9-0x0;var _0xb7016a=_0x2e22[_0x496ee9];return _0xb7016a;};'use strict';var util=require(_0x22e2('0x0'));var _=require('lodash');var moment=require(_0x22e2('0x1'));function getSeconds(_0x47b99f,_0x542189){var _0x49e7e1=moment(_0x47b99f)[_0x22e2('0x2')](0x0);var _0x5a6c55=moment(_0x542189)[_0x22e2('0x2')](0x0);return _0x49e7e1[_0x22e2('0x3')](_0x5a6c55,'seconds');}function AgentComplete(_0x5a5b74,_0x1ac757){this['state']=0x4;this[_0x22e2('0x4')]='Answer';this[_0x22e2('0x5')]=_0x5a5b74[_0x22e2('0x5')];this[_0x22e2('0x6')]=_0x5a5b74['type'];this[_0x22e2('0x7')]=_0x5a5b74[_0x22e2('0x6')]===_0x22e2('0x8')?_0x22e2('0x9'):_0x5a5b74[_0x22e2('0x6')];this[_0x22e2('0xa')]=_0x5a5b74['countbusyretry'];this[_0x22e2('0xb')]=_0x5a5b74['countcongestionretry'];this['countnoanswerretry']=_0x5a5b74[_0x22e2('0xc')];this[_0x22e2('0xd')]=_0x5a5b74[_0x22e2('0xa')]+_0x5a5b74[_0x22e2('0xb')]+_0x5a5b74[_0x22e2('0xc')];this[_0x22e2('0xe')]=_0x1ac757[_0x22e2('0xe')];this[_0x22e2('0xf')]=_0x5a5b74[_0x22e2('0x10')];this[_0x22e2('0x11')]=_0x5a5b74[_0x22e2('0x12')];this[_0x22e2('0x13')]=_0x5a5b74['starttime'];this['responsetime']=_0x5a5b74['responsetime'];this[_0x22e2('0x14')]=_0x5a5b74['answertime'];this['endtime']=moment()[_0x22e2('0x15')](_0x22e2('0x16'));this['ringtime']=getSeconds(_0x5a5b74[_0x22e2('0x17')],_0x5a5b74[_0x22e2('0x13')]);this[_0x22e2('0x18')]=getSeconds(_0x5a5b74[_0x22e2('0x14')],_0x5a5b74[_0x22e2('0x17')]);this['talktime']=getSeconds(this[_0x22e2('0x19')],_0x5a5b74[_0x22e2('0x14')]);this[_0x22e2('0x9')]=_0x1ac757[_0x22e2('0x9')];this[_0x22e2('0x1a')]=_0x1ac757[_0x22e2('0x1a')];this['reason']=_0x1ac757[_0x22e2('0x1b')];this[_0x22e2('0x1c')]=_0x5a5b74[_0x22e2('0x1c')];this['callbackuniqueid']=_0x5a5b74[_0x22e2('0x1d')];this[_0x22e2('0x1e')]=_0x5a5b74[_0x22e2('0x1e')];this[_0x22e2('0x1f')]=_0x5a5b74[_0x22e2('0x1f')];this[_0x22e2('0x20')]=_0x5a5b74[_0x22e2('0x20')];this[_0x22e2('0x21')]=_0x5a5b74['ListId'];this[_0x22e2('0x22')]=_0x5a5b74[_0x22e2('0x22')];this[_0x22e2('0x23')]=_0x5a5b74[_0x22e2('0x23')];this['CampaignId']=_0x5a5b74[_0x22e2('0x24')];this[_0x22e2('0x25')]=_0x5a5b74['originatecalleridnum']||'';this[_0x22e2('0x26')]=_0x5a5b74[_0x22e2('0x26')]||'';}module[_0x22e2('0x27')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index b1c3975..172d95d 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 _0xda81=['diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds'];(function(_0x5d8ff3,_0x1bf750){var _0x7fb8db=function(_0x1a4b49){while(--_0x1a4b49){_0x5d8ff3['push'](_0x5d8ff3['shift']());}};_0x7fb8db(++_0x1bf750);}(_0xda81,0x1c3));var _0x1da8=function(_0x18c695,_0x5a2e79){_0x18c695=_0x18c695-0x0;var _0x1cee2b=_0xda81[_0x18c695];return _0x1cee2b;};'use strict';var util=require(_0x1da8('0x0'));var _=require(_0x1da8('0x1'));var moment=require(_0x1da8('0x2'));function getSeconds(_0x5503ee,_0x2ee31b){var _0x3b96cf=moment(_0x5503ee)[_0x1da8('0x3')](0x0);var _0x177870=moment(_0x2ee31b)['milliseconds'](0x0);return _0x3b96cf[_0x1da8('0x4')](_0x177870,_0x1da8('0x5'));}function Final(_0x5ac2b7){this[_0x1da8('0x6')]=_0x5ac2b7['uniqueid'];this[_0x1da8('0x7')]=_0x5ac2b7[_0x1da8('0x7')];this[_0x1da8('0x8')]=_0x5ac2b7[_0x1da8('0x8')];this[_0x1da8('0x9')]=_0x5ac2b7[_0x1da8('0x8')]===_0x1da8('0xa')?_0x1da8('0xb'):_0x5ac2b7[_0x1da8('0x8')];this['countbusyretry']=_0x5ac2b7[_0x1da8('0xc')];this[_0x1da8('0xd')]=_0x5ac2b7[_0x1da8('0xd')];this[_0x1da8('0xe')]=_0x5ac2b7[_0x1da8('0xe')];this['countglobal']=_0x5ac2b7[_0x1da8('0xc')]+_0x5ac2b7['countcongestionretry']+_0x5ac2b7[_0x1da8('0xe')];this[_0x1da8('0xb')]=_0x5ac2b7[_0x1da8('0xb')];this[_0x1da8('0xf')]=_0x5ac2b7[_0x1da8('0xf')];this['calleridnum']=_0x5ac2b7[_0x1da8('0x10')];this['starttime']=_0x5ac2b7[_0x1da8('0x11')];this[_0x1da8('0x12')]=_0x5ac2b7[_0x1da8('0x12')];this[_0x1da8('0x13')]=_0x5ac2b7[_0x1da8('0x12')];this[_0x1da8('0x14')]=_0x5ac2b7['ringtime']||0x0;this[_0x1da8('0x15')]=_0x5ac2b7[_0x1da8('0x15')]||0x0;this[_0x1da8('0x16')]=_0x5ac2b7[_0x1da8('0x16')]||0x0;this[_0x1da8('0x17')]=_0x5ac2b7[_0x1da8('0x17')];this[_0x1da8('0x18')]=_0x5ac2b7[_0x1da8('0x18')];this[_0x1da8('0x19')]=_0x5ac2b7['callbackat'];this[_0x1da8('0x1a')]=_0x5ac2b7[_0x1da8('0x1a')];this[_0x1da8('0x1b')]=_0x5ac2b7[_0x1da8('0x1b')];this[_0x1da8('0x1c')]=_0x5ac2b7[_0x1da8('0x1c')];this['UserId']=_0x5ac2b7[_0x1da8('0x1d')];this[_0x1da8('0x1e')]=_0x5ac2b7[_0x1da8('0x1e')];this[_0x1da8('0x1f')]=_0x5ac2b7[_0x1da8('0x1f')];this[_0x1da8('0x20')]=_0x5ac2b7['originatecalleridnum']||'';this[_0x1da8('0x21')]=_0x5ac2b7['originatecalleridname']||'';}module[_0x1da8('0x22')]=Final; \ No newline at end of file +var _0x1967=['recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x1967,0x173));var _0x7196=function(_0x2c79d4,_0x3ef9bf){_0x2c79d4=_0x2c79d4-0x0;var _0x59a631=_0x1967[_0x2c79d4];return _0x59a631;};'use strict';var util=require('util');var _=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));function getSeconds(_0x4d0a98,_0x35803d){var _0x3319fa=moment(_0x4d0a98)[_0x7196('0x2')](0x0);var _0x302f34=moment(_0x35803d)[_0x7196('0x2')](0x0);return _0x3319fa[_0x7196('0x3')](_0x302f34,_0x7196('0x4'));}function Final(_0x5c128f){this[_0x7196('0x5')]=_0x5c128f[_0x7196('0x5')];this[_0x7196('0x6')]=_0x5c128f[_0x7196('0x6')];this[_0x7196('0x7')]=_0x5c128f[_0x7196('0x7')];this['campaigntype']=_0x5c128f[_0x7196('0x7')]===_0x7196('0x8')?_0x7196('0x9'):_0x5c128f[_0x7196('0x7')];this[_0x7196('0xa')]=_0x5c128f['countbusyretry'];this['countcongestionretry']=_0x5c128f[_0x7196('0xb')];this[_0x7196('0xc')]=_0x5c128f[_0x7196('0xc')];this[_0x7196('0xd')]=_0x5c128f[_0x7196('0xa')]+_0x5c128f[_0x7196('0xb')]+_0x5c128f[_0x7196('0xc')];this[_0x7196('0x9')]=_0x5c128f[_0x7196('0x9')];this[_0x7196('0xe')]=_0x5c128f[_0x7196('0xe')];this['calleridnum']=_0x5c128f[_0x7196('0xf')];this[_0x7196('0x10')]=_0x5c128f[_0x7196('0x10')];this[_0x7196('0x11')]=_0x5c128f['responsetime'];this[_0x7196('0x12')]=_0x5c128f['responsetime'];this[_0x7196('0x13')]=_0x5c128f[_0x7196('0x13')]||0x0;this[_0x7196('0x14')]=_0x5c128f[_0x7196('0x14')]||0x0;this[_0x7196('0x15')]=_0x5c128f[_0x7196('0x15')]||0x0;this[_0x7196('0x16')]=_0x5c128f[_0x7196('0x16')];this[_0x7196('0x17')]=_0x5c128f[_0x7196('0x17')];this[_0x7196('0x18')]=_0x5c128f['callbackat'];this['recallme']=_0x5c128f[_0x7196('0x19')];this[_0x7196('0x1a')]=_0x5c128f[_0x7196('0x1a')];this['ListId']=_0x5c128f[_0x7196('0x1b')];this['UserId']=_0x5c128f['UserId'];this[_0x7196('0x1c')]=_0x5c128f[_0x7196('0x1c')];this[_0x7196('0x1d')]=_0x5c128f['CampaignId'];this['originatecalleridnum']=_0x5c128f[_0x7196('0x1e')]||'';this[_0x7196('0x1f')]=_0x5c128f['originatecalleridname']||'';}module[_0x7196('0x20')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index ac0f486..8a19b97 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 _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(_0x5b3996,_0x43bb21){var _0x46590c=function(_0x2e91d9){while(--_0x2e91d9){_0x5b3996['push'](_0x5b3996['shift']());}};_0x46590c(++_0x43bb21);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 +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(_0x43d79c,_0x531a55){var _0x4866b0=function(_0x847a){while(--_0x847a){_0x43d79c['push'](_0x43d79c['shift']());}};_0x4866b0(++_0x531a55);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 9676cec..654e8d9 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 _0x4297=['originatecalleridname','exports','moment','milliseconds','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','queue','name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','CampaignId','originatecalleridnum'];(function(_0x60df74,_0x458e29){var _0x5ee872=function(_0x356888){while(--_0x356888){_0x60df74['push'](_0x60df74['shift']());}};_0x5ee872(++_0x458e29);}(_0x4297,0xfe));var _0x7429=function(_0x17e735,_0x328f40){_0x17e735=_0x17e735-0x0;var _0x1824d6=_0x4297[_0x17e735];return _0x1824d6;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x7429('0x0'));function getSeconds(_0xb903e7,_0x5840c3){var _0x1401df=moment(_0xb903e7)[_0x7429('0x1')](0x0);var _0x24ea16=moment(_0x5840c3)[_0x7429('0x1')](0x0);return _0x1401df['diff'](_0x24ea16,'seconds');}function History(_0x30d64d){this[_0x7429('0x2')]=_0x30d64d[_0x7429('0x2')];this[_0x7429('0x3')]=_0x30d64d[_0x7429('0x3')]||undefined;this[_0x7429('0x4')]=_0x30d64d[_0x7429('0x4')];this[_0x7429('0x5')]=_0x30d64d[_0x7429('0x4')]==='outbound'?'queue':_0x30d64d[_0x7429('0x4')];this[_0x7429('0x6')]=_0x30d64d[_0x7429('0x6')];this[_0x7429('0x7')]=_0x30d64d[_0x7429('0x7')];this[_0x7429('0x8')]=_0x30d64d['countnoanswerretry'];this['countglobal']=_0x30d64d[_0x7429('0x6')]+_0x30d64d[_0x7429('0x7')]+_0x30d64d[_0x7429('0x8')];this[_0x7429('0x9')]=_0x30d64d[_0x7429('0x9')];this['calleridname']=_0x30d64d[_0x7429('0xa')];this[_0x7429('0xb')]=_0x30d64d[_0x7429('0xc')];this[_0x7429('0xd')]=_0x30d64d[_0x7429('0xd')];this[_0x7429('0xe')]=_0x30d64d['responsetime'];this[_0x7429('0xf')]=_0x30d64d['responsetime'];this[_0x7429('0x10')]=getSeconds(_0x30d64d['responsetime'],_0x30d64d['starttime']);this['holdtime']=0x0;this[_0x7429('0x11')]=0x0;this[_0x7429('0x12')]=_0x30d64d[_0x7429('0x12')];this[_0x7429('0x13')]=_0x30d64d[_0x7429('0x13')];this['callbackat']=_0x30d64d[_0x7429('0x14')];this[_0x7429('0x15')]=_0x30d64d['recallme'];this[_0x7429('0x16')]=_0x30d64d[_0x7429('0x16')];this['ListId']=_0x30d64d['ListId'];this[_0x7429('0x17')]=_0x30d64d['UserId'];this['VoiceQueueId']=_0x30d64d['VoiceQueueId'];this[_0x7429('0x18')]=_0x30d64d[_0x7429('0x18')];this['originatecalleridnum']=_0x30d64d[_0x7429('0x19')]||'';this[_0x7429('0x1a')]=_0x30d64d[_0x7429('0x1a')]||'';}module[_0x7429('0x1b')]=History; \ No newline at end of file +var _0x95b0=['responsetime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','calleridname','name','calleridnum','number','starttime'];(function(_0x4bbe11,_0x46519e){var _0x3176f5=function(_0x46e6b1){while(--_0x46e6b1){_0x4bbe11['push'](_0x4bbe11['shift']());}};_0x3176f5(++_0x46519e);}(_0x95b0,0x17a));var _0x095b=function(_0x4f5b0d,_0x4e8406){_0x4f5b0d=_0x4f5b0d-0x0;var _0x29a7d0=_0x95b0[_0x4f5b0d];return _0x29a7d0;};'use strict';var util=require(_0x095b('0x0'));var _=require(_0x095b('0x1'));var moment=require(_0x095b('0x2'));function getSeconds(_0x2e8e70,_0x38af6c){var _0x2db735=moment(_0x2e8e70)[_0x095b('0x3')](0x0);var _0x53946c=moment(_0x38af6c)[_0x095b('0x3')](0x0);return _0x2db735['diff'](_0x53946c,_0x095b('0x4'));}function History(_0x726371){this['uniqueid']=_0x726371['uniqueid'];this[_0x095b('0x5')]=_0x726371[_0x095b('0x5')]||undefined;this[_0x095b('0x6')]=_0x726371['type'];this[_0x095b('0x7')]=_0x726371[_0x095b('0x6')]==='outbound'?_0x095b('0x8'):_0x726371[_0x095b('0x6')];this[_0x095b('0x9')]=_0x726371[_0x095b('0x9')];this[_0x095b('0xa')]=_0x726371[_0x095b('0xa')];this[_0x095b('0xb')]=_0x726371['countnoanswerretry'];this[_0x095b('0xc')]=_0x726371[_0x095b('0x9')]+_0x726371[_0x095b('0xa')]+_0x726371[_0x095b('0xb')];this[_0x095b('0x8')]=_0x726371[_0x095b('0x8')];this[_0x095b('0xd')]=_0x726371[_0x095b('0xe')];this[_0x095b('0xf')]=_0x726371[_0x095b('0x10')];this['starttime']=_0x726371[_0x095b('0x11')];this[_0x095b('0x12')]=_0x726371[_0x095b('0x12')];this['endtime']=_0x726371[_0x095b('0x12')];this['ringtime']=getSeconds(_0x726371[_0x095b('0x12')],_0x726371[_0x095b('0x11')]);this[_0x095b('0x13')]=0x0;this[_0x095b('0x14')]=0x0;this[_0x095b('0x15')]=_0x726371[_0x095b('0x15')];this[_0x095b('0x16')]=_0x726371['callbackuniqueid'];this['callbackat']=_0x726371[_0x095b('0x17')];this['recallme']=_0x726371[_0x095b('0x18')];this[_0x095b('0x19')]=_0x726371[_0x095b('0x19')];this[_0x095b('0x1a')]=_0x726371['ListId'];this[_0x095b('0x1b')]=_0x726371[_0x095b('0x1b')];this[_0x095b('0x1c')]=_0x726371[_0x095b('0x1c')];this['CampaignId']=_0x726371[_0x095b('0x1d')];this[_0x095b('0x1e')]=_0x726371[_0x095b('0x1e')]||'';this[_0x095b('0x1f')]=_0x726371[_0x095b('0x1f')]||'';}module[_0x095b('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 2cd98f8..1752ad7 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 _0x9348=['[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','membername','amd','[syncMachine][createHistory]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncMachineIvr][createHistory]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','YYYY-MM-DD\x20HH:mm:ss','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','Drop','dropreason','TIMEOUT','Abandoned','CALLEREXIT','actionid','strategy','paused','stateinterface','locked','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','roundrobin','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','isArray','Action','interval','content','indexOf','true','command','iftime\x20%s,%s','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','dialMethod','progressive','handlePower','method\x20not\x20recognized','handleIvr','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','match','originate','voiceQueue\x20is\x20undefine','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','Contact','createdAt','updatedAt','%s%s','XMD-','toUpper','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','phone','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','callProgressDetecting','[callProgressDetecting]\x20','dialGlobalMaxRetry','countnoanswerretry','dialNoAnswerMaxRetry','add','dialNoAnswerRetryFrequency','minutes','[rescheduleContact][NoAnswer]','countbusyretry','dialBusyMaxRetry','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','object','[callProgressDetecting]','reason','NoSuchNumber','[syncAgentComplete][createHistory][0]','checkRetriveMax','countcongestionretry','createStateFinal','reason\x200\x20no\x20such\x20number....','countglobal','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','stateGlobal','outboundBusyCallsDay','Busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','[syncAgentComplete][createHistory][?]','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','predictiveIntervalPauses','talking','predictiveIntervalLowerLimit','floor','erlangCalls','erlangAbandonmentRate','[startMethodPredictive][StartProgressive][First]','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Date]','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][LowerLimitInterval]','Agent\x20free','agent\x20max\x20free\x20','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','dialPredictiveInterval','[startMethodPredictive][StartPredictive][First]','startMethodPredictive','[averageHandleTime][ErlangB]\x20','getDataPredictive','getVoiceQueueRtPauses','outboundQueuePauses','abandonmentRate','agentBusyFactor','predictiveIntervalDroppedCallsCallersExit','dialPredictiveOptimizationPercentage','busyFactor','[getDataPredictive]','check\x20failure','erlangCallToSecond','[startMethodPredictive]','[startMethodPredictive][milliseconds]\x20','Failure\x20','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallMeTimeout','run','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','[countReScheduled]\x20','RUNNING','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[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]','\x20interval\x20=\x20','m\x20=\x20','util','lodash','bluebird','uuid','moment','ioredis','../../../config/environment/','dialer','../../../config/logger','booked','predictive','syncQueueSummary','../ami','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','agents','trunks','maxNumberOriginate','channels','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','Intervals','INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','emit','type','outbound','available','loggedIn','pTalking','sumDuration','total','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','Trunk','active','callerid','md5','format','voice:queue:%s','voice_queue:save','ivr','campaign:save','info','isUndefined','[checkGetDataPredictive][avgHoldtime]','[checkGetDataPredictive][totalCalls]','[checkGetDataPredictive][obj]','[ErlangB]','merge','[freeVariablesPredictive]','handlePredictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','originated','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','uniqueId','[uniqueid]','actions','[actions]','hasOwnProperty','isNil','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','campaigns','[Dialer][checkChannel][ivr]','countReScheduled','resolve','checkIsBlackList','then','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact]','isSuccess','isTrunkReachable','status','SIP/%s','unmonitored','syncVarSet','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','AMD'];(function(_0x103e55,_0xe99a88){var _0x13b2db=function(_0x512e21){while(--_0x512e21){_0x103e55['push'](_0x103e55['shift']());}};_0x13b2db(++_0xe99a88);}(_0x9348,0x10d));var _0x8934=function(_0x16d7fe,_0x50c2c0){_0x16d7fe=_0x16d7fe-0x0;var _0x3a354d=_0x9348[_0x16d7fe];return _0x3a354d;};'use strict';var util=require(_0x8934('0x0'));var _=require(_0x8934('0x1'));var BPromise=require(_0x8934('0x2'));var uuid=require(_0x8934('0x3'));var moment=require(_0x8934('0x4'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x8934('0x5'));var config=require(_0x8934('0x6'));var logger=require('../../../config/logger')(_0x8934('0x7'));var loggerBooked=require(_0x8934('0x8'))(_0x8934('0x9'));var loggerPredictive=require(_0x8934('0x8'))(_0x8934('0xa'));var loggerPredictiveCalls=require(_0x8934('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x8934('0x8'))(_0x8934('0xb'));var ami=require(_0x8934('0xc'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8934('0xd'))(new Redis(config['redis']));var cmHopper=require(_0x8934('0xe'));var cmHopperFinal=require(_0x8934('0xf'));var cmHopperHistory=require(_0x8934('0x10'));var cmHopperBlack=require(_0x8934('0x11'));var voiceQueueRt=require(_0x8934('0x12'));var Action=require(_0x8934('0x13'));var History=require(_0x8934('0x14'));var Final=require(_0x8934('0x15'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x8934('0x16'));var Hangup=require(_0x8934('0x17'));var ipAgi=process[_0x8934('0x18')][_0x8934('0x19')]||_0x8934('0x1a');var strategy={'rrmemory':_0x8934('0x1b'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x8934('0x1c')][_0x8934('0x1d')]=function(_0xdfc97c){this[_0x8934('0x1e')]=this[_0x8934('0x1e')]?this[_0x8934('0x1e')][_0x8934('0x1f')](_0xdfc97c):_0xdfc97c();};function Dialer(_0x357cf8,_0x52de6a){this[_0x8934('0x20')]=new Sequence();this[_0x8934('0x21')]=_0x52de6a;this[_0x8934('0x22')]=_0x357cf8['voiceQueues'];this['campaigns']=_0x357cf8['campaigns'];this[_0x8934('0x23')]=_0x357cf8['agents'];this[_0x8934('0x24')]=_0x357cf8[_0x8934('0x24')];this[_0x8934('0x25')]=config[_0x8934('0x25')]||0x2;this[_0x8934('0x26')]={};this['actions']={};this[_0x8934('0x27')]={};this['uniqueId']={};this[_0x8934('0x28')]={};this[_0x8934('0x29')]={};this[_0x8934('0x2a')]={};this[_0x8934('0x2b')]={};this[_0x8934('0x2c')]={};this[_0x8934('0x2d')]={};ami['on'](_0x8934('0x2e'),this['syncAgentConnect'][_0x8934('0x2f')](this));ami['on'](_0x8934('0x30'),this[_0x8934('0x31')][_0x8934('0x2f')](this));ami['on'](_0x8934('0x32'),this['syncOriginateResponse'][_0x8934('0x2f')](this));ami['on'](_0x8934('0x33'),this[_0x8934('0x34')]['bind'](this));ami['on'](_0x8934('0x35'),this['syncQueueSummary'][_0x8934('0x2f')](this));ami['on'](_0x8934('0x36'),this[_0x8934('0x37')]['bind'](this));ami['on'](_0x8934('0x38'),this[_0x8934('0x39')][_0x8934('0x2f')](this));ami['on'](_0x8934('0x3a'),this['syncVarSet'][_0x8934('0x2f')](this));ami['on'](_0x8934('0x3b'),this[_0x8934('0x3c')][_0x8934('0x2f')](this));ami['on'](_0x8934('0x3d'),this[_0x8934('0x3e')][_0x8934('0x2f')](this));this[_0x8934('0x3f')]();this[_0x8934('0x40')]();}function isNotNull(_0x18938a){return _0x18938a!==null&&!_['isUndefined'](_0x18938a);}function checkIsLoggedIn(_0x1d068c,_0x3e973e){return function(){if(_0x3e973e<=0x0){_0x1d068c['message']=_0x8934('0x41');throw _0x1d068c[_0x8934('0x42')]+_0x8934('0x43');}};}function isActive(_0x13aeeb){return _0x13aeeb;}function checkIsActive(_0x4b3cb9,_0x78b2c){return function(){if(!isActive(_0x78b2c)){_0x4b3cb9[_0x8934('0x44')]=_0x8934('0x45');throw _0x4b3cb9[_0x8934('0x42')]+_0x8934('0x46');}};}function checkInterval(_0x49c5e2){return function(){if(!isNotNull(_0x49c5e2[_0x8934('0x47')])){_0x49c5e2['message']='INTERVAL_IS_NULL';throw _0x49c5e2[_0x8934('0x42')]+_0x8934('0x48');}if(!isNotNull(_0x49c5e2[_0x8934('0x47')][_0x8934('0x49')])){_0x49c5e2['message']=_0x8934('0x4a');throw _0x49c5e2[_0x8934('0x42')]+_0x8934('0x48');}if(!isNotNull(_[_0x8934('0x4b')](_0x49c5e2[_0x8934('0x47')]['Intervals']))){_0x49c5e2[_0x8934('0x44')]=_0x8934('0x4a');throw _0x49c5e2['name']+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x845028,_0x2a790f,_0x4a4a50){return{'action':_0x845028,'response':_0x2a790f,'message':_0x4a4a50};}function myreject(_0x519273){return function(_0x1a30c1){return _0x519273(msgResponse(_0x8934('0x4c'),_0x8934('0x4d'),JSON[_0x8934('0x4e')](_0x1a30c1)));};}function getSeconds(_0x834d54,_0x1c624f){var _0x30f8c6=moment(_0x834d54)[_0x8934('0x4f')](0x0);var _0x27920e=moment(_0x1c624f)[_0x8934('0x4f')](0x0);return _0x30f8c6[_0x8934('0x50')](_0x27920e,'seconds');}function emit(_0x31c805,_0x180236,_0x524139){io['to'](_0x31c805)[_0x8934('0x51')](_0x180236,_0x524139);}function emitVoiceQueueSummary(_0x122ad1){if(_0x122ad1[_0x8934('0x52')]===_0x8934('0x53')){var _0xb189f1={'id':_0x122ad1['id'],'name':_0x122ad1['name'],'strategy':_0x122ad1['strategy'],'answered':_0x122ad1['answered'],'available':_0x122ad1[_0x8934('0x54')],'loggedIn':_0x122ad1[_0x8934('0x55')],'pTalking':_0x122ad1[_0x8934('0x56')],'sumBillable':_0x122ad1['sumBillable'],'sumDuration':_0x122ad1[_0x8934('0x57')],'sumHoldTime':_0x122ad1['sumHoldTime']||0x0,'talking':_0x122ad1['talking'],'total':_0x122ad1[_0x8934('0x58')],'type':_0x122ad1[_0x8934('0x52')],'unmanaged':_0x122ad1['unmanaged'],'abandoned':_0x122ad1['abandoned'],'waiting':_0x122ad1[_0x8934('0x59')],'loggedInDb':_0x122ad1[_0x8934('0x5a')],'dialActive':_0x122ad1[_0x8934('0x5b')],'dialMethod':_0x122ad1['dialMethod'],'dialOriginateCallerIdName':_0x122ad1[_0x8934('0x5c')],'dialOriginateCallerIdNumber':_0x122ad1['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x122ad1[_0x8934('0x5d')],'dialPrefix':_0x122ad1['dialPrefix'],'outboundAnswerAgiCallsDay':_0x122ad1[_0x8934('0x5e')],'outboundAnswerCallsDay':_0x122ad1[_0x8934('0x5f')],'outboundBlacklistCallsDay':_0x122ad1[_0x8934('0x60')],'outboundBusyCallsDay':_0x122ad1['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x122ad1[_0x8934('0x61')],'outboundDropCallsDayACS':_0x122ad1[_0x8934('0x62')],'outboundDropCallsDayCallersExit':_0x122ad1[_0x8934('0x63')],'outboundDropCallsDayTimeout':_0x122ad1[_0x8934('0x64')],'outboundNoAnswerCallsDay':_0x122ad1['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x122ad1[_0x8934('0x65')],'outboundOriginateFailureCallsDay':_0x122ad1[_0x8934('0x66')],'outboundReCallsDay':_0x122ad1[_0x8934('0x67')],'outboundRejectCallsDay':_0x122ad1[_0x8934('0x68')],'outboundUnknownCallsDay':_0x122ad1[_0x8934('0x69')],'predictiveIntervalAnsweredCalls':_0x122ad1[_0x8934('0x6a')],'predictiveIntervalAvgHoldtime':_0x122ad1[_0x8934('0x6b')],'predictiveIntervalAvgTalktime':_0x122ad1[_0x8934('0x6c')],'predictiveIntervalDroppedCallsCallersExit':_0x122ad1['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x122ad1['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x122ad1['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x122ad1[_0x8934('0x6d')],'predictiveIntervalHitRate':_0x122ad1[_0x8934('0x6e')],'predictiveIntervalLowerLimit':_0x122ad1['predictiveIntervalLowerLimit'],'predictiveIntervalMultiplicativeFactor':_0x122ad1[_0x8934('0x6f')],'predictiveIntervalPauses':_0x122ad1['predictiveIntervalPauses'],'predictiveIntervalTotalCalls':_0x122ad1[_0x8934('0x70')],'message':_0x122ad1[_0x8934('0x44')],'originated':_0x122ad1['originated']};if(_0x122ad1[_0x8934('0x71')]){_0xb189f1[_0x8934('0x71')]={'id':_0x122ad1[_0x8934('0x71')]['id'],'name':_0x122ad1[_0x8934('0x71')]['name'],'active':_0x122ad1[_0x8934('0x71')][_0x8934('0x72')],'callerid':_0x122ad1['Trunk'][_0x8934('0x73')]};}if(_0x122ad1[_0x8934('0x47')]){_0xb189f1[_0x8934('0x47')]={'id':_0x122ad1[_0x8934('0x47')]['id'],'name':_0x122ad1[_0x8934('0x47')][_0x8934('0x42')]};}var _0xa45543=md5(JSON[_0x8934('0x4e')](_0xb189f1));if(_0x122ad1[_0x8934('0x74')]!==_0xa45543){_0x122ad1[_0x8934('0x74')]=_0xa45543;emit(util[_0x8934('0x75')](_0x8934('0x76'),_0xb189f1[_0x8934('0x42')]),_0x8934('0x77'),_0xb189f1);}}}function emitCampaignSummary(_0x11b06f){if(_0x11b06f[_0x8934('0x52')]===_0x8934('0x78')){emit(util[_0x8934('0x75')]('campaign:ivr:%s',_0x11b06f[_0x8934('0x42')]),_0x8934('0x79'),_0x11b06f);}}function checkGetDataPredictive(_0x5cc36c){if(isNotNull(_0x5cc36c)){if(!_['isEmpty'](_0x5cc36c)){if(_0x5cc36c['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x5cc36c[_0x8934('0x6c')])&&_0x5cc36c[_0x8934('0x6c')]>0x0){return!![];}else{loggerPredictive[_0x8934('0x7a')]('[checkGetDataPredictive][avgTalktime]',JSON['stringify'](_0x5cc36c));}if(!_[_0x8934('0x7b')](_0x5cc36c['predictiveIntervalAvgHoldtime'])&&_0x5cc36c['predictiveIntervalAvgHoldtime']>0x0){return!![];}else{loggerPredictive[_0x8934('0x7a')](_0x8934('0x7c'),JSON[_0x8934('0x4e')](_0x5cc36c));}}else{loggerPredictive[_0x8934('0x7a')](_0x8934('0x7d'),JSON[_0x8934('0x4e')](_0x5cc36c));}}else{loggerPredictive[_0x8934('0x7a')]('[checkGetDataPredictive][objIsEmpty]',JSON[_0x8934('0x4e')](_0x5cc36c));}}else{loggerPredictive['info'](_0x8934('0x7e'),JSON[_0x8934('0x4e')](_0x5cc36c));}return![];}function mergeDataErlangB(_0x2d776a){return function(_0x3df31e){loggerPredictive[_0x8934('0x7a')](_0x8934('0x7f'),JSON[_0x8934('0x4e')](_0x3df31e));_[_0x8934('0x80')](_0x2d776a,_0x3df31e);};}function getDiff(_0x597e04){var _0x67069f=moment()[_0x8934('0x4f')](0x0);var _0x25cfe0=moment(_0x597e04)[_0x8934('0x4f')](0x0);return _0x67069f[_0x8934('0x50')](_0x25cfe0,'seconds');}function ifInterval(_0x44708a,_0x38d604){if(_[_0x8934('0x7b')](_0x38d604)){return![];}if(getDiff(_0x38d604)<_0x44708a*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x4c2a52){if(isNotNull(_0x4c2a52)){if(!_[_0x8934('0x7b')](_0x4c2a52[_0x8934('0x2a')])){_0x4c2a52[_0x8934('0x2a')]=undefined;loggerPredictive['info']('[freeVariablesPredictive]','startProgressive',_0x4c2a52[_0x8934('0x42')]);}if(!_[_0x8934('0x7b')](_0x4c2a52[_0x8934('0x29')])){_0x4c2a52['startPredictive']=undefined;loggerPredictive[_0x8934('0x7a')](_0x8934('0x81'),'startPredictive',_0x4c2a52['name']);}if(!_[_0x8934('0x7b')](_0x4c2a52[_0x8934('0x82')])){clearInterval(_0x4c2a52[_0x8934('0x82')]);_0x4c2a52[_0x8934('0x82')]=undefined;loggerPredictive['info']('[freeVariablesPredictive]','handlePredictive',_0x4c2a52['name']);}}}function erlangb(_0x43933f,_0x2b8837){if(_0x2b8837===0x0){return 0x0;}var _0x18d08e=0x1;for(var _0x3c49dd=0x1;_0x3c49dd<=_0x2b8837;_0x3c49dd+=0x1){_0x18d08e=0x1+_0x18d08e*_0x3c49dd/_0x43933f;}return 0x1/_0x18d08e;}function isVoiceQueueOutbound(_0x44cc23){return _0x44cc23===_0x8934('0x53');}function isNotPreview(_0x5a487e){return _0x5a487e!==_0x8934('0x21');}function isCampaignIvr(_0x389ba6){return _0x389ba6==='ivr';}function getCallerId(_0x41e6b4,_0x5abde1,_0x822e82){if(!_['isUndefined'](_0x822e82)&&_0x8934('0x83')===typeof _0x822e82&&!_[_0x8934('0x4b')](_0x822e82)){if(!_[_0x8934('0x7b')](_0x5abde1)&&_0x8934('0x83')===typeof _0x5abde1&&!_[_0x8934('0x4b')](_0x5abde1)){return util[_0x8934('0x75')](_0x8934('0x84'),_0x5abde1,_0x822e82);}return util['format']('\x22%s\x22\x20<%s>',_0x822e82,_0x822e82);}if(!_[_0x8934('0x7b')](_0x41e6b4)&&_0x8934('0x83')===typeof _0x41e6b4&&!_[_0x8934('0x4b')](_0x41e6b4)){return _0x41e6b4;}return _0x8934('0x85');}function loggerCatchQueueSummary(_0x511ac6,_0x18850a){return function(_0x35c437){freeVariablesPredictive(_0x18850a);emitVoiceQueueSummary(_0x18850a);emitCampaignSummary(_0x18850a);loggerSyncQueueSummary[_0x8934('0x86')](_0x511ac6,util[_0x8934('0x87')](_0x35c437,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2b1888,_0x27ca38){return function(_0x2d1344){loggerPredictive[_0x8934('0x86')](_0x2b1888,JSON[_0x8934('0x4e')](_0x2d1344));freeVariablesPredictive(_0x27ca38);};}function loggerCatch(_0x5c7b96){return function(_0x5c2819){logger[_0x8934('0x86')](_0x5c7b96,util[_0x8934('0x87')](_0x5c2819,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x135861){return _0x135861&&!_[_0x8934('0x7b')](_0x135861)&&_0x135861[_0x8934('0x88')]>0x0;}function decremetOriginate(_0x1b54ed){if(!_[_0x8934('0x7b')](_0x1b54ed)&&_0x1b54ed!==null){if(_0x1b54ed['hasOwnProperty'](_0x8934('0x89'))){if(_0x1b54ed[_0x8934('0x89')]>0x0){_0x1b54ed['originated']-=0x1;}else{logger[_0x8934('0x86')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x8934('0x86')](_0x8934('0x8a'));}}function checkContactLowerLimitOriginate(_0x3f7bd3,_0x504265,_0x2e1b40){if(_0x504265>_0x2e1b40){for(var _0x16ea01=0x0;_0x16ea01<_0x504265-_0x2e1b40;_0x16ea01+=0x1){decremetOriginate(_0x3f7bd3);}}}function loggerGetContactDialer(_0x544fa7,_0x2ffbf0,_0x558f93){return function(_0x1311e6){checkContactLowerLimitOriginate(_0x2ffbf0,_0x558f93,0x0);logger['error'](_0x544fa7,util[_0x8934('0x87')](_0x1311e6,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x6b3376){return function(_0x24b0ce){if(isNotNull(_0x24b0ce)&&isNotNull(_0x24b0ce[0x0])){if(_0x24b0ce[0x0]['contactsRescheduled']>0x0){_0x6b3376[_0x8934('0x44')]=_0x8934('0x8b');logger[_0x8934('0x7a')](_0x8934('0x8c')+_0x6b3376['name'],_0x24b0ce[0x0][_0x8934('0x8d')],'contacts');}else{_0x6b3376[_0x8934('0x44')]=_0x8934('0x8e');logger[_0x8934('0x7a')](_0x8934('0x8f')+_0x6b3376['name']);}}};}function notSendMessagesQueue(_0xc2799d){if(_0xc2799d[_0x8934('0x90')]){freeVariablesPredictive(_0xc2799d);if(_0xc2799d[_0x8934('0x89')]===0x0&&_0xc2799d['talking']===0x0&&_0xc2799d[_0x8934('0x59')]===0x0&&(_0xc2799d[_0x8934('0x56')]||0x0)===0x0){_0xc2799d[_0x8934('0x90')]=![];_0xc2799d['available']=0x0;_0xc2799d['message']=_0x8934('0x45');loggerSyncQueueSummary[_0x8934('0x86')](_0x8934('0x91'),_0xc2799d[_0x8934('0x42')],_0x8934('0x92'));}else{_0xc2799d[_0x8934('0x44')]=_0x8934('0x93');loggerSyncQueueSummary[_0x8934('0x86')](_0x8934('0x91'),_0xc2799d['name'],_0x8934('0x94'));}emitVoiceQueueSummary(_0xc2799d);}}function notSendMessagesCampaign(_0x2c26e3){if(_0x2c26e3[_0x8934('0x90')]){if(_0x2c26e3[_0x8934('0x89')]===0x0){_0x2c26e3[_0x8934('0x90')]=![];_0x2c26e3['message']=_0x8934('0x45');loggerSyncQueueSummary[_0x8934('0x86')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x2c26e3[_0x8934('0x42')],'is\x20not\x20active');}else{_0x2c26e3['message']='IS_DISACTIVED';loggerSyncQueueSummary[_0x8934('0x86')](_0x8934('0x95'),_0x2c26e3[_0x8934('0x42')],'is\x20disactive');}emitCampaignSummary(_0x2c26e3);}}function createObjHistory(_0x2c289b,_0x1d3372,_0x4c5708,_0x1d3365,_0x3bf26f){_0x2c289b[_0x8934('0x44')]=_0x4c5708;var _0x45d655=new Action(_0x2c289b,_0x1d3372);var _0x277988=new History(_0x45d655);_0x277988[_0x8934('0x96')]=_0x1d3365;_0x277988[_0x8934('0x97')]=_0x3bf26f;_0x277988[_0x8934('0x98')]=_0x45d655[_0x8934('0x99')];return _0x277988;}Dialer[_0x8934('0x1c')]['loopClearZombieChannels']=function(){var _0x3b3fb4=this;setInterval(function(){_0x3b3fb4[_0x8934('0x9a')](_0x3b3fb4[_0x8934('0x9b')],_0x8934('0x9c'));_0x3b3fb4[_0x8934('0x9a')](_0x3b3fb4[_0x8934('0x9d')],_0x8934('0x9e'));},0x32c8);};Dialer['prototype'][_0x8934('0x9a')]=function(_0x230b36,_0x201c1b){var _0x3c7ce7=this;for(var _0x9de459 in _0x230b36){if(_0x230b36[_0x8934('0x9f')](_0x9de459)){this[_0x8934('0x20')][_0x8934('0x1d')](function(){if(!_[_0x8934('0xa0')](_0x230b36[_0x9de459])){return ami['Action']({'action':'status','channel':_0x230b36[_0x9de459][_0x8934('0xa1')]})[_0x8934('0xa2')](function(_0x4faab2){if(_0x4faab2[_0x8934('0x44')]===_0x8934('0xa3')){setTimeout(function(){if(_0x230b36[_0x9de459]&&_0x230b36[_0x9de459][_0x8934('0x52')]!==_0x8934('0x78')){_0x3c7ce7[_0x8934('0xa4')](_0x3c7ce7[_0x8934('0x22')][_0x230b36[_0x9de459][_0x8934('0xa5')]]);logger[_0x8934('0x86')](_0x8934('0xa6'),_0x201c1b,_0x9de459,_0x230b36[_0x9de459][_0x8934('0xa5')]);delete _0x230b36[_0x9de459];}if(_0x230b36[_0x9de459]&&_0x230b36[_0x9de459][_0x8934('0x52')]==='ivr'){_0x3c7ce7[_0x8934('0xa4')](_0x3c7ce7[_0x8934('0xa7')][_0x230b36[_0x9de459][_0x8934('0xa5')]]);logger['error'](_0x8934('0xa8'),_0x201c1b,_0x9de459,_0x230b36[_0x9de459]['queue']);delete _0x230b36[_0x9de459];}},0x2328);}});}});}}};Dialer[_0x8934('0x1c')][_0x8934('0xa9')]=function(_0x21a14f){return BPromise[_0x8934('0xaa')]()['then'](cmHopper['countReScheduled'](_0x21a14f))[_0x8934('0xa2')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x8934('0x1c')][_0x8934('0xab')]=function(_0xe97eee){return BPromise[_0x8934('0xaa')]()['then'](cmHopperBlack[_0x8934('0xab')](_0xe97eee))['catch'](loggerCatch('[checkIsBlackList]\x20'));};Dialer['prototype']['checkIsBlackListIvr']=function(_0xbde223){return BPromise[_0x8934('0xaa')]()[_0x8934('0xac')](cmHopperBlack[_0x8934('0xad')](_0xbde223))[_0x8934('0xa2')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer['prototype'][_0x8934('0xae')]=function(_0x982f81){return BPromise[_0x8934('0xaa')]()[_0x8934('0xac')](cmHopperHistory[_0x8934('0xaf')](_0x982f81))[_0x8934('0xa2')](loggerCatch(_0x8934('0xb0')));};Dialer[_0x8934('0x1c')][_0x8934('0xb1')]=function(_0x3df0c9){return BPromise[_0x8934('0xaa')]()[_0x8934('0xac')](cmHopper[_0x8934('0xb1')](_0x3df0c9))[_0x8934('0xa2')](loggerCatch(_0x8934('0xb2')));};Dialer[_0x8934('0x1c')]['getContactDialer']=function(_0x5f4251,_0x1b1ce9,_0x3d6a93,_0x4b79ab){return BPromise[_0x8934('0xaa')]()[_0x8934('0xac')](cmHopper[_0x8934('0xb3')](_0x5f4251,_0x1b1ce9,_0x3d6a93,_0x4b79ab))[_0x8934('0xa2')](loggerCatch(_0x8934('0xb4')));};Dialer[_0x8934('0x1c')][_0x8934('0xb5')]=function(_0x4e55fb,_0x12fd3c,_0x5aab65){return BPromise[_0x8934('0xaa')]()[_0x8934('0xac')](cmHopper[_0x8934('0xb5')](_0x4e55fb,_0x12fd3c,_0x5aab65))[_0x8934('0xa2')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x8934('0x1c')]['getVoiceQueueRtPauses']=function(_0x591eb7){return BPromise[_0x8934('0xaa')]()[_0x8934('0xac')](voiceQueueRt['getVoiceQueueRtPauses'](_0x591eb7))['catch'](loggerCatch(_0x8934('0xb6')));};Dialer['prototype'][_0x8934('0xb7')]=function(_0x79bd0d){return BPromise[_0x8934('0xaa')]()[_0x8934('0xac')](cmHopper[_0x8934('0xb7')](_0x79bd0d))[_0x8934('0xa2')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x8934('0x1c')][_0x8934('0xb8')]=function(_0x487442){return BPromise['resolve']()[_0x8934('0xac')](cmHopperHistory[_0x8934('0xb8')](_0x487442))[_0x8934('0xa2')](loggerCatch('[createHistory]\x20'));};Dialer['prototype'][_0x8934('0xa4')]=function(_0x5ba3d3){if(!_[_0x8934('0x7b')](_0x5ba3d3)&&_0x5ba3d3!==null){if(_0x5ba3d3[_0x8934('0x9f')](_0x8934('0x89'))){if(_0x5ba3d3[_0x8934('0x89')]>0x0){_0x5ba3d3[_0x8934('0x89')]-=0x1;}else{logger[_0x8934('0x86')](_0x8934('0xb9'));}}}else{logger[_0x8934('0x86')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x8934('0x1c')][_0x8934('0xba')]=function(_0x524078,_0x4f38e2){var _0x133537=this;return function(_0x53f5de){_0x133537[_0x8934('0xa4')](_0x4f38e2);logger[_0x8934('0x86')](_0x524078,util['inspect'](_0x53f5de,{'showHidden':![],'depth':null}));};};Dialer[_0x8934('0x1c')][_0x8934('0xbb')]=function(_0x1e8fa6,_0x2dbe00,_0x517dee){var _0x39ef00={'state':0x19,'statedesc':_0x8934('0xbc')};this[_0x8934('0xa4')](_0x2dbe00);this[_0x8934('0xbd')](_['merge'](_0x39ef00,_[_0x8934('0xbe')](_0x517dee,[_0x8934('0xbf'),_0x8934('0xc0'),_0x8934('0xc1'),_0x8934('0xc2'),_0x8934('0xc3')])),'[emptyContact][createHistory]',_0x8934('0xc4'));logger['error'](_0x1e8fa6);};Dialer[_0x8934('0x1c')][_0x8934('0xc5')]=function(_0x15dc51){return _0x15dc51==='Success';};Dialer[_0x8934('0x1c')][_0x8934('0xc6')]=function(_0x27de9a){return!_[_0x8934('0x7b')](_0x27de9a)&&_0x27de9a&&!_['isUndefined'](_0x27de9a[_0x8934('0x42')])&&!_[_0x8934('0x7b')](_0x27de9a[_0x8934('0x72')])&&_0x27de9a['active']&&(this['trunks'][util['format']('SIP/%s',_0x27de9a[_0x8934('0x42')])][_0x8934('0xc7')]==='reachable'||this['trunks'][util['format'](_0x8934('0xc8'),_0x27de9a[_0x8934('0x42')])][_0x8934('0xc7')]===_0x8934('0xc9'));};Dialer[_0x8934('0x1c')][_0x8934('0xbd')]=function(_0x3cd86b,_0x41a3d5,_0x4c331d){this[_0x8934('0xb8')](_0x3cd86b)['catch'](loggerCatch(_0x41a3d5));this[_0x8934('0xb7')](_0x3cd86b)[_0x8934('0xa2')](loggerCatch(_0x4c331d));};Dialer[_0x8934('0x1c')][_0x8934('0xca')]=function(_0x55b1b3){var _0x122f82=this[_0x8934('0x9b')][_0x55b1b3[_0x8934('0xcb')]];var _0x2eb89a;if(!_[_0x8934('0xa0')](_0x55b1b3)&&!_['isNil'](_0x55b1b3[_0x8934('0xcc')])&&!_[_0x8934('0xa0')](_0x55b1b3[_0x8934('0xcc')][_0x8934('0xcd')])&&_0x55b1b3[_0x8934('0xce')]===_0x8934('0xcf')&&_0x122f82){if(_0x122f82[_0x8934('0x52')]!==_0x8934('0x78')&&this[_0x8934('0x22')][_0x122f82['queue']][_0x8934('0xd0')]&&_0x55b1b3[_0x8934('0xd1')]===_0x8934('0xd2')){delete this['uniqueId'][_0x55b1b3[_0x8934('0xcb')]];this[_0x8934('0xa4')](this[_0x8934('0x22')][_0x122f82[_0x8934('0xa5')]]);this[_0x8934('0x22')][_0x122f82[_0x8934('0xa5')]][_0x8934('0x5f')]+=0x1;this[_0x8934('0x22')][_0x122f82['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x2eb89a=new Hangup(_0x122f82,_0x55b1b3);_0x2eb89a[_0x8934('0x96')]=0x12;_0x2eb89a[_0x8934('0x97')]='HangupInAMD';_0x2eb89a['membername']=_0x8934('0xd3');this[_0x8934('0xbd')](_0x2eb89a,_0x8934('0xd4'),_0x8934('0xd5'));}if(_0x122f82[_0x8934('0x52')]!==_0x8934('0x78')&&this['voiceQueues'][_0x122f82[_0x8934('0xa5')]]['dialAMDActive']&&_0x55b1b3[_0x8934('0xd1')]===_0x8934('0xd6')){delete this[_0x8934('0x9b')][_0x55b1b3[_0x8934('0xcb')]];this['updateOriginated'](this[_0x8934('0x22')][_0x122f82[_0x8934('0xa5')]]);this[_0x8934('0x22')][_0x122f82[_0x8934('0xa5')]][_0x8934('0x5f')]+=0x1;this[_0x8934('0x22')][_0x122f82['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x2eb89a=new Hangup(_0x122f82,_0x55b1b3);_0x2eb89a[_0x8934('0x96')]=0x13;_0x2eb89a['statedesc']='Machine';_0x2eb89a[_0x8934('0xd7')]=_0x8934('0xd3');_0x2eb89a[_0x8934('0xd8')]=!![];this[_0x8934('0xbd')](_0x2eb89a,_0x8934('0xd9'),'[syncMachine]');}if(_0x122f82[_0x8934('0x52')]===_0x8934('0x78')&&this['campaigns'][_0x122f82[_0x8934('0xa5')]][_0x8934('0xd0')]&&_0x55b1b3[_0x8934('0xd1')]===_0x8934('0xd2')){delete this['uniqueId'][_0x55b1b3[_0x8934('0xcb')]];this['updateOriginated'](this['campaigns'][_0x122f82[_0x8934('0xa5')]]);_0x2eb89a=new Hangup(_0x122f82,_0x55b1b3);_0x2eb89a['state']=0x12;_0x2eb89a[_0x8934('0x97')]=_0x8934('0xda');_0x2eb89a[_0x8934('0xd7')]=_0x8934('0xd3');this[_0x8934('0xbd')](_0x2eb89a,_0x8934('0xdb'),_0x8934('0xdc'));}if(_0x122f82[_0x8934('0x52')]===_0x8934('0x78')&&this[_0x8934('0xa7')][_0x122f82['queue']]['dialAMDActive']&&_0x55b1b3[_0x8934('0xd1')]===_0x8934('0xd6')){delete this[_0x8934('0x9b')][_0x55b1b3['uniqueid']];this[_0x8934('0xa4')](this['campaigns'][_0x122f82[_0x8934('0xa5')]]);_0x2eb89a=new Hangup(_0x122f82,_0x55b1b3);_0x2eb89a['state']=0x13;_0x2eb89a[_0x8934('0x97')]='Machine';_0x2eb89a['membername']='AMD';_0x2eb89a[_0x8934('0xd8')]=!![];this[_0x8934('0xbd')](_0x2eb89a,_0x8934('0xdd'),'[syncMachineIvr]');}}};Dialer['prototype'][_0x8934('0x37')]=function(_0x1ed085){var _0x1ddfee=this[_0x8934('0x9b')][_0x1ed085['uniqueid']];var _0x58a540=this;var _0x41ae29;if(_0x1ddfee&&_0x1ddfee['type']===_0x8934('0x78')){delete this[_0x8934('0x9b')][_0x1ed085['uniqueid']];this[_0x8934('0xa4')](this[_0x8934('0xa7')][_0x1ddfee['queue']]);this[_0x8934('0xa7')][_0x1ddfee['queue']][_0x8934('0xde')]+=0x1;_0x41ae29=new Hangup(_0x1ddfee,_0x1ed085);this[_0x8934('0xb8')](_0x41ae29)['catch'](loggerCatch(_0x8934('0xdf')));this['moveContactManagedDialer'](_0x41ae29)['catch'](loggerCatch(_0x8934('0xe0')));}if(_0x1ddfee&&_0x1ddfee[_0x8934('0x52')]!==_0x8934('0x78')&&isNotNull(this[_0x8934('0x22')][_0x1ddfee[_0x8934('0xa5')]][_0x8934('0xe1')])){delete this[_0x8934('0x9b')][_0x1ed085['uniqueid']];this[_0x8934('0xa4')](this[_0x8934('0x22')][_0x1ddfee[_0x8934('0xa5')]]);this['voiceQueues'][_0x1ddfee[_0x8934('0xa5')]][_0x8934('0x5f')]+=0x1;this['voiceQueues'][_0x1ddfee[_0x8934('0xa5')]][_0x8934('0x5e')]+=0x1;_0x41ae29=new Hangup(_0x1ddfee,_0x1ed085);_0x41ae29[_0x8934('0x96')]=0x10;_0x41ae29[_0x8934('0x97')]=_0x8934('0xe2');_0x41ae29['membername']=_0x8934('0xe3');this[_0x8934('0xb8')](_0x41ae29)[_0x8934('0xa2')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x8934('0xb7')](_0x41ae29)[_0x8934('0xa2')](loggerCatch(_0x8934('0xe0')));}if(_0x1ddfee&&_0x1ddfee[_0x8934('0x52')]!==_0x8934('0x78')&&!isNotNull(this[_0x8934('0x22')][_0x1ddfee[_0x8934('0xa5')]][_0x8934('0xe1')])){delete this[_0x8934('0x9b')][_0x1ed085[_0x8934('0xcb')]];this[_0x8934('0xa4')](this[_0x8934('0x22')][_0x1ddfee['queue']]);this['voiceQueues'][_0x1ddfee[_0x8934('0xa5')]][_0x8934('0x69')]+=0x1;_0x41ae29=new Hangup(_0x1ddfee,_0x1ed085);_0x41ae29['state']=0xc;_0x41ae29['statedesc']=_0x1ed085[_0x8934('0xe4')];_0x41ae29['membername']=_0x8934('0xe5');this[_0x8934('0xb8')](_0x41ae29)[_0x8934('0xa2')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x8934('0xb7')](_0x41ae29)[_0x8934('0xa2')](loggerCatch(_0x8934('0xe0')));}};Dialer['prototype']['syncAgentComplete']=function(_0x16b7ac){var _0x24676a=this[_0x8934('0x9b')][_0x16b7ac[_0x8934('0xcb')]];var _0x15ac45=this;if(this[_0x8934('0x22')][_0x16b7ac[_0x8934('0xa5')]]){if(_0x24676a&&_0x24676a[_0x8934('0x52')]!==_0x8934('0x78')){delete this[_0x8934('0x9b')][_0x16b7ac[_0x8934('0xcb')]];this['voiceQueues'][_0x16b7ac['queue']][_0x8934('0x5f')]+=0x1;var _0x241111=new AgentComplete(_0x24676a,_0x16b7ac);if(_0x16b7ac['reason']===_0x8934('0xe6')){_0x241111[_0x8934('0xe7')]=this[_0x8934('0x22')][_0x16b7ac['queue']][_0x8934('0xe8')]&&this[_0x8934('0x22')][_0x16b7ac[_0x8934('0xa5')]][_0x8934('0xe9')]?moment()[_0x8934('0x75')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this['createHistory'](_0x241111)['catch'](loggerCatch(_0x8934('0xea')));this['moveContactManagedDialer'](_0x241111)[_0x8934('0xa2')](loggerCatch(_0x8934('0xeb')));}}};Dialer[_0x8934('0x1c')]['syncAgentConnect']=function(_0x2913ad){if(this['voiceQueues'][_0x2913ad[_0x8934('0xa5')]]){if(this[_0x8934('0x9b')][_0x2913ad['uniqueid']]&&this[_0x8934('0x9b')][_0x2913ad[_0x8934('0xcb')]][_0x8934('0x52')]!==_0x8934('0x78')){this[_0x8934('0xa4')](this['voiceQueues'][_0x2913ad[_0x8934('0xa5')]]);this[_0x8934('0x9b')][_0x2913ad[_0x8934('0xcb')]][_0x8934('0xec')]=moment()[_0x8934('0x75')](_0x8934('0xed'));}}};Dialer[_0x8934('0x1c')][_0x8934('0xee')]=function(_0xa0f3e2){this[_0x8934('0xb8')](_0xa0f3e2)[_0x8934('0xa2')](loggerCatch(_0x8934('0xea')));this[_0x8934('0xb7')](_0xa0f3e2)[_0x8934('0xa2')](loggerCatch(_0x8934('0xef')));};Dialer[_0x8934('0x1c')][_0x8934('0x31')]=function(_0xf2d541){var _0xb1aa65=this[_0x8934('0x9b')][_0xf2d541[_0x8934('0xcb')]];var _0x288077=this;if(this[_0x8934('0x22')][_0xf2d541[_0x8934('0xa5')]]){if(_0xb1aa65&&_0xb1aa65['type']!==_0x8934('0x78')){delete this['uniqueId'][_0xf2d541[_0x8934('0xcb')]];this['updateOriginated'](this[_0x8934('0x22')][_0xf2d541[_0x8934('0xa5')]]);_0xb1aa65['droptime']=moment()[_0x8934('0x75')](_0x8934('0xed'));var _0x59ec1d=new QueueCallerAbandon(_0xb1aa65,_0xf2d541);if(getSeconds(_0xb1aa65[_0x8934('0xf0')],_0xb1aa65['responsetime'])>=_0xb1aa65[_0x8934('0xf1')]){this[_0x8934('0x22')][_0xf2d541[_0x8934('0xa5')]][_0x8934('0xf2')]+=0x1;this[_0x8934('0x22')][_0xf2d541['queue']][_0x8934('0x64')]+=0x1;this['voiceQueues'][_0xf2d541[_0x8934('0xa5')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x59ec1d[_0x8934('0x96')]=0xa;_0x59ec1d[_0x8934('0x97')]=_0x8934('0xf3');_0x59ec1d[_0x8934('0xf4')]=_0x8934('0xf5');_0x59ec1d[_0x8934('0xe7')]=this[_0x8934('0x22')][_0xf2d541['queue']][_0x8934('0xe8')]?moment()[_0x8934('0x75')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;this[_0x8934('0xee')](_0x59ec1d);}else{this[_0x8934('0x22')][_0xf2d541[_0x8934('0xa5')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x8934('0x22')][_0xf2d541[_0x8934('0xa5')]]['outboundDropCallsDayCallersExit']+=0x1;_0x59ec1d[_0x8934('0x96')]=0xb;_0x59ec1d[_0x8934('0x97')]=_0x8934('0xf6');_0x59ec1d[_0x8934('0xf4')]=_0x8934('0xf7');this[_0x8934('0xee')](_0x59ec1d);}}}};Dialer[_0x8934('0x1c')]['syncNewExten']=function(_0x4be360){if(this[_0x8934('0x9d')][_0x4be360[_0x8934('0xcb')]]){this[_0x8934('0x9d')][_0x4be360[_0x8934('0xcb')]][_0x8934('0xa1')]=_0x4be360[_0x8934('0xa1')];}if(this[_0x8934('0x9b')][_0x4be360[_0x8934('0xcb')]]){this[_0x8934('0x9b')][_0x4be360[_0x8934('0xcb')]][_0x8934('0xa1')]=_0x4be360['channel'];}};Dialer['prototype']['syncQueueMember']=function(_0x50a222){if(strategy[this[_0x8934('0x22')][this['actions'][_0x50a222[_0x8934('0xf8')]][_0x8934('0xa5')]][_0x8934('0xf9')]]==='roundrobin'){if(this['actions'][_0x50a222['actionid']]&&_[_0x8934('0xa0')](this['actions'][_0x50a222[_0x8934('0xf8')]]['locked'])&&_0x50a222[_0x8934('0xc7')]==='1'&&_0x50a222[_0x8934('0xfa')]==='0'){if(this[_0x8934('0x23')][_0x50a222['stateinterface']]){if(!this['agents'][_0x50a222[_0x8934('0xfb')]][_0x8934('0xfc')]){this[_0x8934('0x23')][_0x50a222['stateinterface']][_0x8934('0xfc')]=!![];this[_0x8934('0x9d')][_0x50a222[_0x8934('0xf8')]][_0x8934('0xfc')]=!![];this[_0x8934('0x9d')][_0x50a222[_0x8934('0xf8')]]['stateinterface']=_0x50a222['stateinterface'];}}}}else if((strategy[this[_0x8934('0x22')][this[_0x8934('0x9d')][_0x50a222[_0x8934('0xf8')]][_0x8934('0xa5')]][_0x8934('0xf9')]]||_0x8934('0x1b'))==='rrmemory'){if(this['actions'][_0x50a222[_0x8934('0xf8')]]){if(this[_0x8934('0x23')][_0x50a222[_0x8934('0xfb')]]){this[_0x8934('0x9d')][_0x50a222['actionid']][_0x8934('0xfb')]=_0x50a222[_0x8934('0xfb')];if(_[_0x8934('0xa0')](this[_0x8934('0x2c')][this[_0x8934('0x9d')][_0x50a222[_0x8934('0xf8')]][_0x8934('0xa5')]])){this['queueBooked'][this['actions'][_0x50a222['actionid']][_0x8934('0xa5')]]=[];}this[_0x8934('0x2c')][this[_0x8934('0x9d')][_0x50a222[_0x8934('0xf8')]][_0x8934('0xa5')]][_0x8934('0xfd')](_[_0x8934('0x80')](_[_0x8934('0xbe')](this[_0x8934('0x9d')][_0x50a222[_0x8934('0xf8')]],[_0x8934('0xfe'),_0x8934('0xfb')]),{'status':_0x50a222[_0x8934('0xc7')],'paused':_0x50a222[_0x8934('0xfa')]}));}}}};function unlockQueueStatus(_0x36527a,_0x595592){setTimeout(function(){if(_[_0x8934('0x7b')](_0x36527a[_0x8934('0xff')])){loggerBooked['error'](_0x8934('0x100'),_0x595592);}_0x36527a[_0x8934('0xff')]=!![];loggerBooked[_0x8934('0x7a')](_0x8934('0x101'),_0x595592,JSON[_0x8934('0x4e')](_['pick'](_0x36527a,['name',_0x8934('0xff')])));},0x1f3);}Dialer[_0x8934('0x1c')]['syncQueueStatusComplete']=function(_0x316ca1){var _0x1cba02=this;var _0x38abcb=_0x1cba02[_0x8934('0x22')][_0x1cba02['actions'][_0x316ca1[_0x8934('0xf8')]]['queue']];if(strategy[this[_0x8934('0x22')][this['actions'][_0x316ca1[_0x8934('0xf8')]][_0x8934('0xa5')]][_0x8934('0xf9')]]===_0x8934('0x102')){if(this[_0x8934('0x9d')][_0x316ca1[_0x8934('0xf8')]]&&this['actions'][_0x316ca1[_0x8934('0xf8')]]['stateinterface']){this[_0x8934('0x21')]['run'](this[_0x8934('0x9d')][_0x316ca1[_0x8934('0xf8')]]['idHopper'],this[_0x8934('0x9d')][_0x316ca1[_0x8934('0xf8')]][_0x8934('0xfb')])[_0x8934('0xa2')](function(_0x49efe8){logger[_0x8934('0x86')](_0x8934('0x103'),util[_0x8934('0x87')](_0x49efe8,{'showHidden':![],'depth':null}));})[_0x8934('0x1f')](function(){_0x1cba02['updateOriginated'](_0x1cba02[_0x8934('0x22')][_0x1cba02[_0x8934('0x9d')][_0x316ca1[_0x8934('0xf8')]][_0x8934('0xa5')]]);_0x1cba02[_0x8934('0x23')][_0x1cba02[_0x8934('0x9d')][_0x316ca1[_0x8934('0xf8')]][_0x8934('0xfb')]][_0x8934('0xfc')]=![];delete _0x1cba02[_0x8934('0x9d')][_0x316ca1[_0x8934('0xf8')]];unlockQueueStatus(_0x38abcb);});}else{this[_0x8934('0xa4')](this[_0x8934('0x22')][this[_0x8934('0x9d')][_0x316ca1[_0x8934('0xf8')]]['queue']]);this[_0x8934('0xb1')]({'active':![],'ContactId':this[_0x8934('0x9d')][_0x316ca1[_0x8934('0xf8')]][_0x8934('0xbf')],'ListId':this[_0x8934('0x9d')][_0x316ca1[_0x8934('0xf8')]][_0x8934('0xc0')],'VoiceQueueId':this['actions'][_0x316ca1[_0x8934('0xf8')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x8934('0x9d')][_0x316ca1['actionid']][_0x8934('0xc3')]||undefined})[_0x8934('0xa2')](loggerCatch(_0x8934('0x104')));delete this[_0x8934('0x9d')][_0x316ca1[_0x8934('0xf8')]];unlockQueueStatus(_0x38abcb);}}else if((strategy[this[_0x8934('0x22')][this[_0x8934('0x9d')][_0x316ca1[_0x8934('0xf8')]]['queue']][_0x8934('0xf9')]]||_0x8934('0x1b'))===_0x8934('0x1b')){var _0x4b1c51;if(this[_0x8934('0x9d')][_0x316ca1[_0x8934('0xf8')]]&&!_[_0x8934('0x4b')](this[_0x8934('0x2c')][this['actions'][_0x316ca1[_0x8934('0xf8')]][_0x8934('0xa5')]])){if(this[_0x8934('0x2d')][_0x1cba02[_0x8934('0x9d')][_0x316ca1[_0x8934('0xf8')]][_0x8934('0xa5')]]){this[_0x8934('0x2d')][_0x1cba02[_0x8934('0x9d')][_0x316ca1[_0x8934('0xf8')]][_0x8934('0xa5')]]=this['queueBookedRR'][this['actions'][_0x316ca1[_0x8934('0xf8')]][_0x8934('0xa5')]]?this[_0x8934('0x2d')][this[_0x8934('0x9d')][_0x316ca1[_0x8934('0xf8')]][_0x8934('0xa5')]]:this[_0x8934('0x2c')][this[_0x8934('0x9d')][_0x316ca1[_0x8934('0xf8')]]['queue']]?this['queueBooked'][this[_0x8934('0x9d')][_0x316ca1[_0x8934('0xf8')]]['queue']]['_rr']||0x0:0x0;}this[_0x8934('0x2c')][this[_0x8934('0x9d')][_0x316ca1[_0x8934('0xf8')]][_0x8934('0xa5')]][_0x8934('0x105')]=this[_0x8934('0x2d')][this['actions'][_0x316ca1[_0x8934('0xf8')]][_0x8934('0xa5')]];for(var _0xaaaf57=0x0;_0xaaaf57=0x0?!![]:![];})[_0x8934('0xa2')](myreject(_0x2e45d9)));}}else{_0x423724[_0x8934('0xfd')](ami[_0x8934('0x11f')]({'action':_0x8934('0x124'),'command':util[_0x8934('0x75')](_0x8934('0x125'),_0x3735e0,!_['isUndefined'](config[_0x8934('0x11c')][_0x2b241d])?_0x2b241d:'')})[_0x8934('0xac')](function(_0x46e5df){return _0x46e5df['content'][_0x8934('0x122')]('true')>=0x0?!![]:![];})['catch'](myreject(_0x2e45d9)));}BPromise[_0x8934('0x126')](_0x423724)[_0x8934('0xac')](function(_0x4d1002){var _0x1e4b63=_[_0x8934('0x127')](_0x4d1002);if(_0x1e4b63){return _0x2950f5(_0x1e4b63);}else{_0x13e8f9[_0x8934('0x44')]=_0x36e82b?'GLOBAL_INTERVAL_IS_OVERTIME':_0x8934('0x128');return _0x2e45d9(msgResponse(_0x8934('0x129'),_0x8934('0x11a'),_0x8934('0x12a')+_0x36e82b+'\x20'+_0xe30c39+'\x20Interval\x20is\x20overtime:\x20'+util[_0x8934('0x87')](_0x3735e0,{'showHidden':![],'depth':null})+_0x8934('0x12b')+_0x2b241d));}})[_0x8934('0xa2')](function(_0x5532e1){return _0x2e45d9(msgResponse(_0x8934('0x116'),'Failure',JSON[_0x8934('0x4e')](_0x5532e1)));});});};Dialer[_0x8934('0x1c')]['checkDialMethod']=function(_0x291904){var _0x19eb88=this;return function(){switch(_0x291904[_0x8934('0x12c')]){case _0x8934('0x12d'):freeVariablesPredictive(_0x291904);_0x19eb88[_0x8934('0x12e')](_0x291904,0x1);break;case'power':freeVariablesPredictive(_0x291904);_0x19eb88[_0x8934('0x12e')](_0x291904,_0x291904['dialPowerLevel']);break;case _0x8934('0xa'):_0x19eb88[_0x8934('0xa')](_0x291904);break;case _0x8934('0x9'):freeVariablesPredictive(_0x291904);_0x19eb88['handlePower'](_0x291904,0x1);break;default:freeVariablesPredictive(_0x291904);logger[_0x8934('0x86')]('Queue',_0x291904[_0x8934('0x42')],_0x8934('0x12f'));}};};Dialer[_0x8934('0x1c')]['launchHandleIvr']=function(_0x282842){var _0x1b6728=this;return function(){_0x1b6728[_0x8934('0x130')](_0x282842);};};Dialer['prototype'][_0x8934('0xb')]=function(_0x2114e1){var _0x4a75c2=this;if(isNotPreview(_0x2114e1[_0x8934('0x12c')])){if(isVoiceQueueOutbound(_0x2114e1[_0x8934('0x52')])&&isActive(_0x2114e1[_0x8934('0x5b')])){_0x2114e1[_0x8934('0x90')]=!![];BPromise[_0x8934('0xaa')]()[_0x8934('0xac')](checkIsLoggedIn(_0x2114e1,_0x2114e1[_0x8934('0x55')]))[_0x8934('0xac')](checkIsActive(_0x2114e1,_0x2114e1[_0x8934('0x5b')]))[_0x8934('0xac')](checkInterval(_0x2114e1))[_0x8934('0xac')](_0x4a75c2[_0x8934('0x111')](_0x2114e1))['then'](_0x4a75c2[_0x8934('0x115')](_0x2114e1[_0x8934('0x131')],_0x2114e1[_0x8934('0x132')],_0x2114e1['name'],_0x2114e1))['then'](_0x4a75c2[_0x8934('0x117')](_0x2114e1[_0x8934('0x47')],_0x2114e1[_0x8934('0x132')],_0x2114e1[_0x8934('0x42')],_0x2114e1))[_0x8934('0xac')](_0x4a75c2['checkDialMethod'](_0x2114e1))[_0x8934('0xa2')](loggerCatchQueueSummary('[syncQueueSummary]',_0x2114e1));}else{notSendMessagesQueue(_0x2114e1);}}else{freeVariablesPredictive(_0x2114e1);}};Dialer[_0x8934('0x1c')][_0x8934('0x110')]=function(){var _0x238784=this;var _0x23da6d;for(var _0x414e21 in this[_0x8934('0xa7')]){if(this[_0x8934('0xa7')][_0x8934('0x9f')](_0x414e21)){_0x23da6d=this[_0x8934('0xa7')][_0x414e21];if(isCampaignIvr(_0x23da6d[_0x8934('0x52')])&&isActive(_0x23da6d[_0x8934('0x72')])){_0x23da6d[_0x8934('0x90')]=!![];BPromise[_0x8934('0xaa')]()[_0x8934('0xac')](checkIsActive(_0x23da6d,_0x23da6d[_0x8934('0x72')]))[_0x8934('0xac')](checkInterval(_0x23da6d))[_0x8934('0xac')](_0x238784['checkIsTrunkReachable'](_0x23da6d))[_0x8934('0xac')](_0x238784[_0x8934('0x115')](_0x23da6d[_0x8934('0x131')],_0x23da6d[_0x8934('0x132')],_0x23da6d[_0x8934('0x42')],_0x23da6d))[_0x8934('0xac')](_0x238784[_0x8934('0x117')](_0x23da6d['Interval'],_0x23da6d[_0x8934('0x132')],_0x23da6d[_0x8934('0x42')],_0x23da6d))[_0x8934('0xac')](_0x238784[_0x8934('0x133')](_0x23da6d))['catch'](loggerCatchQueueSummary(_0x8934('0x134'),_0x23da6d));}else{notSendMessagesCampaign(_0x23da6d);}}}};function getCallerIdRandom(_0x41017a,_0x426d64){var _0xaff8d,_0x55bb3e,_0x5da4b4;if(_0x426d64<=0x0){_0x426d64=0x1;}_0xaff8d=new RegExp(_0x8934('0x135')+_0x426d64+'}$');_0x55bb3e=Math[_0x8934('0x136')](0xa,_0x426d64-0x1);_0x5da4b4=Math['pow'](0xa,_0x426d64)-0x1;return util[_0x8934('0x75')]('%s',_[_0x8934('0x137')](_0x41017a,_0xaff8d,_['random'](_0x55bb3e,_0x5da4b4)));}function extractCalleridName(_0x596cf0){var _0x1b7c32=_0x596cf0[_0x8934('0x138')](/"(.*?)"/);return _0x1b7c32?_0x1b7c32[0x1]:_0x596cf0;}function extractCalleridNumber(_0x3a9142){var _0x515a58=_0x3a9142[_0x8934('0x138')](/<(.*?)>/);return _0x515a58?_0x515a58[0x1]:_0x3a9142;}Dialer[_0x8934('0x1c')]['actionOriginate']=function(_0x3893e0,_0x40c482){var _0x409796=this;var _0xcc4747=uuid['v4']();this['actions'][_0xcc4747]=new Action(_0x3893e0,_0x40c482,_0xcc4747);return new BPromise(function(_0x192eaf,_0xd8a7a5){if(_[_0x8934('0x7b')](_0x3893e0)&&'object'!==typeof _0x3893e0){return _0xd8a7a5(msgResponse(_0x8934('0x139'),_0x8934('0x11a'),_0x8934('0x13a')));}if(_[_0x8934('0x7b')](_0x40c482['Contact']['phone'])||_0x40c482['Contact']['phone']===null){return _0xd8a7a5(msgResponse(_0x8934('0x139'),_0x8934('0x11a'),_0x8934('0x13b')));}var _0x268761={'XMD-CALLERID':_0x409796[_0x8934('0x9d')][_0xcc4747][_0x8934('0x13c')](),'XMD-AGI':_0x3893e0[_0x8934('0xe1')]?util[_0x8934('0x75')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3893e0[_0x8934('0xe1')]):_0x8934('0x13d'),'XMD-AGIAFTER':_0x3893e0['dialQueueProject2']?util['format'](_0x8934('0x13e'),ipAgi,_0x3893e0[_0x8934('0xe8')]):_0x8934('0x13d'),'XMD-QUEUE':_0x3893e0['type']===_0x8934('0x53')?util['format']('\x22%s,%s%s,,,%s\x22',_0x3893e0[_0x8934('0x42')],_0x3893e0['dialQueueOptions']||'',_0x3893e0['dialAgiAfterHangupAgent']?'c':'',_0x3893e0[_0x8934('0xf1')]||0x3):_0x8934('0x13d'),'XMD-CONTACTID':_0x40c482['ContactId'],'XMD-CDRTYPE':_0x8934('0x7'),'CALLERID(all)':_0x409796['actions'][_0xcc4747][_0x8934('0x13c')](),'XMD-AMD':_0x3893e0[_0x8934('0xd0')]?_0x8934('0x13f'):'NONE','XMD-DESTINATION':_0x8934('0xcf')};if(_0x3893e0[_0x8934('0xd0')]){_0x268761[_0x8934('0x140')]=_0x3893e0[_0x8934('0x141')]||0x9c4;_0x268761['XMD-AMDGREETING']=_0x3893e0['dialAMDGreeting']||0x5dc;_0x268761[_0x8934('0x142')]=_0x3893e0[_0x8934('0x143')]||0x320;_0x268761[_0x8934('0x144')]=_0x3893e0[_0x8934('0x145')]||0x1388;_0x268761[_0x8934('0x146')]=_0x3893e0['dialAMDMinWordLength']||0x64;_0x268761['XMD-AMDBETWEENWORDSSILENCE']=_0x3893e0['dialAMDBetweenWordsSilence']||0x32;_0x268761[_0x8934('0x147')]=_0x3893e0[_0x8934('0x148')]||0x3;_0x268761[_0x8934('0x149')]=_0x3893e0[_0x8934('0x14a')]||0x100;_0x268761[_0x8934('0x14b')]=_0x3893e0[_0x8934('0x14c')]||0x1388;}if(_0x3893e0[_0x8934('0x52')]===_0x8934('0x53')){_0x268761['XMD-VOICEQUEUEID']=_0x40c482[_0x8934('0xc2')];}else{_0x268761['XMD-CAMPAIGNID']=_0x40c482['CampaignId'];}for(var _0x5aed5b in _0x40c482['Contact']){if(_0x40c482[_0x8934('0x14d')][_0x8934('0x9f')](_0x5aed5b)){if(isNotNull(_0x40c482[_0x8934('0x14d')][_0x5aed5b])&&_0x5aed5b!=='id'&&_0x5aed5b!=='tags'&&_0x5aed5b!==_0x8934('0x14e')&&_0x5aed5b!==_0x8934('0x14f')){_0x268761[util[_0x8934('0x75')](_0x8934('0x150'),_0x8934('0x151'),_[_0x8934('0x152')](_0x5aed5b))]=_0x40c482[_0x8934('0x14d')][_0x5aed5b];}}}var _0x30dc75=_0x409796[_0x8934('0xc6')](_0x3893e0[_0x8934('0x71')])?getCallerId(_0x3893e0[_0x8934('0x71')][_0x8934('0x73')],_0x3893e0[_0x8934('0x5c')],_0x3893e0['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x3893e0[_0x8934('0x153')],_0x3893e0[_0x8934('0x154')]):_0x3893e0[_0x8934('0x153')]):getCallerId(_[_0x8934('0xa0')](_0x3893e0[_0x8934('0x112')])?_0x3893e0[_0x8934('0x71')][_0x8934('0x73')]:_0x3893e0[_0x8934('0x112')][_0x8934('0x73')],_0x3893e0[_0x8934('0x5c')],_0x3893e0[_0x8934('0x154')]>0x0?getCallerIdRandom(_0x3893e0[_0x8934('0x153')],_0x3893e0[_0x8934('0x154')]):_0x3893e0[_0x8934('0x153')]);if(_0x30dc75){_0x268761['XMD-ORIGINATECALLERIDNAME']=_0x409796['actions'][_0xcc4747]['originatecalleridname']=extractCalleridName(_0x30dc75);_0x268761[_0x8934('0x155')]=_0x409796[_0x8934('0x9d')][_0xcc4747]['originatecalleridnum']=extractCalleridNumber(_0x30dc75);}return ami['Action']({'actionid':_0xcc4747,'action':_0x8934('0x139'),'channel':_0x409796[_0x8934('0xc6')](_0x3893e0[_0x8934('0x71')])?util[_0x8934('0x75')](_0x8934('0x156'),_0x3893e0['Trunk'][_0x8934('0x42')],isNotNull(_0x3893e0['dialPrefix'])?_0x3893e0[_0x8934('0x157')][_0x8934('0x158')]()||'':'',_0x3893e0[_0x8934('0x159')]>0x0?_0x40c482[_0x8934('0x14d')]['phone'][_0x8934('0x15a')](_0x3893e0[_0x8934('0x159')]):_0x40c482[_0x8934('0x14d')][_0x8934('0x15b')]):util['format'](_0x8934('0x156'),_['isNil'](_0x3893e0[_0x8934('0x112')])?_0x3893e0['Trunk'][_0x8934('0x42')]:_0x3893e0[_0x8934('0x112')][_0x8934('0x42')],isNotNull(_0x3893e0[_0x8934('0x157')])?_0x3893e0[_0x8934('0x157')][_0x8934('0x158')]()||'':'',_0x3893e0['dialCutDigit']>0x0?_0x40c482[_0x8934('0x14d')][_0x8934('0x15b')][_0x8934('0x15a')](_0x3893e0[_0x8934('0x159')]):_0x40c482[_0x8934('0x14d')][_0x8934('0x15b')]),'callerid':_0x30dc75,'Exten':_0x8934('0xcf'),'Context':_0x8934('0x15c'),'Priority':'1','variable':_0x268761,'timeout':(_0x3893e0[_0x8934('0x5d')]||0x1e)*0x3e8,'async':!![],'channelid':_0xcc4747})[_0x8934('0xac')](function(_0x39a784){return _0x192eaf(_0x39a784);})[_0x8934('0xa2')](function(_0x280af6){_0x3893e0[_0x8934('0x66')]+=0x1;var _0xeaf9b6=new History(_0x409796[_0x8934('0x9d')][_0xcc4747]);logger['error'](util[_0x8934('0x75')](_0x8934('0x15d'),JSON[_0x8934('0x4e')](_0x280af6)));_0xeaf9b6[_0x8934('0x96')]=0xe;_0xeaf9b6[_0x8934('0x97')]=_0x8934('0x15e');_0xeaf9b6[_0x8934('0x99')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xeaf9b6['endtime']=_0xeaf9b6[_0x8934('0x99')];_0x409796['createHistory'](_0xeaf9b6)['catch'](loggerCatch(_0x8934('0x15f')));_0x409796['moveContactManagedDialer'](_0xeaf9b6)[_0x8934('0xa2')](loggerCatch(_0x8934('0x15f')))[_0x8934('0x1f')](function(){delete _0x409796[_0x8934('0x9d')][_0xcc4747];return _0xd8a7a5(msgResponse('originate',_0x8934('0x4d'),_0x8934('0x160')));});});});};Dialer[_0x8934('0x1c')]['syncOriginateResponse']=function(_0x2d78de){var _0x5b6313=this['actions'][_0x2d78de[_0x8934('0xf8')]];var _0xa99451=this;if(_0x5b6313){delete this['actions'][_0x2d78de['actionid']];_0x5b6313['responsetime']=moment()[_0x8934('0x75')]('YYYY-MM-DD\x20HH:mm:ss');var _0x24b098=_0x5b6313['type']===_0x8934('0x78')?this[_0x8934('0xa7')][_0x5b6313[_0x8934('0xa5')]]:this[_0x8934('0x22')][_0x5b6313[_0x8934('0x161')]()];if(!this[_0x8934('0xc5')](_0x2d78de['response'])){this['updateOriginated'](_0x24b098);return this[_0x8934('0x162')](_0x5b6313,_0x24b098,_0x2d78de)[_0x8934('0xac')](function(_0x165f84){})[_0x8934('0xa2')](loggerCatch(_0x8934('0x163')));}else{this[_0x8934('0x9b')][_0x2d78de['uniqueid']]=_0x5b6313;}}};Dialer[_0x8934('0x1c')]['checkRetriveMax']=function(_0x393a47,_0x1a0891,_0x2d2396){var _0x419b61=new History(_0x1a0891);if(_0x419b61['countbusyretry']+_0x419b61['countcongestionretry']+_0x419b61['countnoanswerretry']>=_0x2d2396[_0x8934('0x164')]-0x1){return!![];}switch(_0x393a47){case 0x3:if(_0x419b61[_0x8934('0x165')]>=_0x2d2396[_0x8934('0x166')]-0x1){return!![];}else{this[_0x8934('0xb1')]({'active':![],'countnoanswerretry':_0x419b61[_0x8934('0x165')]+=0x1,'scheduledat':moment()[_0x8934('0x167')](_0x2d2396[_0x8934('0x168')],_0x8934('0x169'))['format'](_0x8934('0xed')),'ContactId':_0x419b61[_0x8934('0xbf')],'ListId':_0x419b61[_0x8934('0xc0')],'VoiceQueueId':_0x419b61[_0x8934('0xc2')]||undefined,'CampaignId':_0x419b61[_0x8934('0xc3')]||undefined})[_0x8934('0xa2')](loggerCatch(_0x8934('0x16a')));}break;case 0x5:if(_0x419b61[_0x8934('0x16b')]>=_0x2d2396[_0x8934('0x16c')]-0x1){return!![];}else{this[_0x8934('0xb1')]({'active':![],'countbusyretry':_0x419b61[_0x8934('0x16b')]+=0x1,'scheduledat':moment()[_0x8934('0x167')](_0x2d2396['dialBusyRetryFrequency'],_0x8934('0x169'))[_0x8934('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x419b61[_0x8934('0xbf')],'ListId':_0x419b61['ListId'],'VoiceQueueId':_0x419b61[_0x8934('0xc2')]||undefined,'CampaignId':_0x419b61[_0x8934('0xc3')]||undefined})[_0x8934('0xa2')](loggerCatch('[rescheduleContact]\x20[Busy]'));}break;case 0x8:if(_0x419b61['countcongestionretry']>=_0x2d2396[_0x8934('0x16d')]-0x1){return!![];}else{this[_0x8934('0xb1')]({'active':![],'countcongestionretry':_0x419b61['countcongestionretry']+=0x1,'scheduledat':moment()[_0x8934('0x167')](_0x2d2396[_0x8934('0x16e')],_0x8934('0x169'))[_0x8934('0x75')](_0x8934('0xed')),'ContactId':_0x419b61[_0x8934('0xbf')],'ListId':_0x419b61[_0x8934('0xc0')],'VoiceQueueId':_0x419b61[_0x8934('0xc2')]||undefined,'CampaignId':_0x419b61['CampaignId']||undefined})['catch'](loggerCatch(_0x8934('0x16f')));}break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x362b3f,_0x10a377,_0x28878a){var _0x22770d=this;var _0x24d494=new History(_0x362b3f);return new BPromise(function(_0x1f57bd,_0xdd6423){if(_[_0x8934('0x7b')](_0x10a377)&&_0x8934('0x170')!==typeof _0x10a377){return _0xdd6423(msgResponse(_0x8934('0x171'),_0x8934('0x11a'),'entity\x20is\x20undefine'));}if(_[_0x8934('0x7b')](_0x28878a)&&_0x8934('0x170')!==typeof _0x28878a){return _0xdd6423(msgResponse(_0x8934('0x171'),_0x8934('0x11a'),'evt\x20is\x20undefine'));}switch(_0x28878a[_0x8934('0x172')]){case'0':_0x10a377[_0x8934('0x65')]+=0x1;_0x24d494[_0x8934('0x96')]=0x0;_0x24d494[_0x8934('0x97')]=_0x8934('0x173');_0x22770d['createHistory'](_0x24d494)[_0x8934('0xa2')](loggerCatch(_0x8934('0x174')));if(_0x22770d[_0x8934('0x175')](0x0,_0x362b3f,_0x10a377)){if(_0x24d494[_0x8934('0x16b')]+_0x24d494[_0x8934('0x176')]+_0x24d494[_0x8934('0x165')]>=_0x10a377['dialGlobalMaxRetry']){_0x22770d['stateGlobal'](_0x24d494,_0x1f57bd,_0xdd6423,'reason\x200\x20no\x20such\x20number....');}else{_0x22770d[_0x8934('0x177')](_0x24d494,_0x1f57bd,_0xdd6423,_0x8934('0x178'));}}break;case'3':_0x10a377['outboundNoAnswerCallsDay']+=0x1;_0x24d494['state']=0x3;_0x24d494['statedesc']='NoAnswer';_0x24d494[_0x8934('0x165')]+=0x1;_0x24d494[_0x8934('0x179')]+=0x1;_0x22770d['createHistory'](_0x24d494)[_0x8934('0xa2')](loggerCatch(_0x8934('0x17a')));if(_0x22770d['checkRetriveMax'](0x3,_0x362b3f,_0x10a377)){if(_0x24d494[_0x8934('0x165')]>=_0x10a377[_0x8934('0x166')]){_0x22770d['createStateFinal'](_0x24d494,_0x1f57bd,_0xdd6423,_0x8934('0x17b'));}else{_0x22770d[_0x8934('0x17c')](_0x24d494,_0x1f57bd,_0xdd6423,_0x8934('0x17b'));}}break;case'5':_0x10a377[_0x8934('0x17d')]+=0x1;_0x24d494[_0x8934('0x96')]=0x5;_0x24d494['statedesc']=_0x8934('0x17e');_0x24d494[_0x8934('0x16b')]+=0x1;_0x24d494[_0x8934('0x179')]+=0x1;_0x22770d[_0x8934('0xb8')](_0x24d494)[_0x8934('0xa2')](loggerCatch(_0x8934('0x17f')));if(_0x22770d[_0x8934('0x175')](0x5,_0x362b3f,_0x10a377)){if(_0x24d494['countbusyretry']>=_0x10a377[_0x8934('0x16c')]){_0x22770d['createStateFinal'](_0x24d494,_0x1f57bd,_0xdd6423,_0x8934('0x180'));}else{_0x22770d[_0x8934('0x17c')](_0x24d494,_0x1f57bd,_0xdd6423,_0x8934('0x180'));}}break;case'8':_0x10a377[_0x8934('0x61')]+=0x1;_0x24d494[_0x8934('0x96')]=0x8;_0x24d494[_0x8934('0x97')]=_0x8934('0x181');_0x24d494['countcongestionretry']+=0x1;_0x24d494[_0x8934('0x179')]+=0x1;_0x22770d[_0x8934('0xb8')](_0x24d494)[_0x8934('0xa2')](loggerCatch(_0x8934('0x182')));if(_0x22770d[_0x8934('0x175')](0x8,_0x362b3f,_0x10a377)){if(_0x24d494[_0x8934('0x176')]>=_0x10a377[_0x8934('0x16d')]){_0x22770d['createStateFinal'](_0x24d494,_0x1f57bd,_0xdd6423,'reason\x208\x20congestion');}else{_0x22770d[_0x8934('0x17c')](_0x24d494,_0x1f57bd,_0xdd6423,_0x8934('0x183'));}}break;default:_0x10a377[_0x8934('0x69')]+=0x1;_0x24d494['state']=0xc;_0x24d494[_0x8934('0x97')]=_0x28878a['reason'];_0x22770d[_0x8934('0xb8')](_0x24d494)[_0x8934('0xa2')](loggerCatch(_0x8934('0x184')));if(_0x22770d[_0x8934('0x175')](_0x28878a[_0x8934('0x172')],_0x362b3f,_0x10a377)){if(_0x24d494[_0x8934('0x16b')]+_0x24d494[_0x8934('0x176')]+_0x24d494['countnoanswerretry']>=_0x10a377[_0x8934('0x164')]){_0x22770d['stateGlobal'](_0x24d494,_0x1f57bd,_0xdd6423,_0x28878a[_0x8934('0x172')]);}else{_0x22770d[_0x8934('0x177')](_0x24d494,_0x1f57bd,_0xdd6423,_0x28878a[_0x8934('0x172')]);}}}});};Dialer['prototype']['stateGlobal']=function(_0x566bda,_0x4d2aa6,_0x2fd10e,_0x47718e){var _0xe6c9fa=new Final(_0x566bda);_0xe6c9fa[_0x8934('0x96')]=0xf;_0xe6c9fa['statedesc']='Global';this[_0x8934('0x177')](_0xe6c9fa,_0x4d2aa6,_0x2fd10e,_0x47718e);};Dialer[_0x8934('0x1c')]['createStateFinal']=function(_0x7daeb4,_0x3f7c8d,_0x4c96ec,_0x211f44){this[_0x8934('0xb7')](_0x7daeb4)['then'](function(_0x567a71){return _0x3f7c8d(msgResponse(_0x8934('0x171'),_0x8934('0x185'),_0x211f44));})[_0x8934('0xa2')](function(_0x25bdde){return _0x4c96ec(msgResponse(_0x8934('0x186'),_0x8934('0x11a'),_0x8934('0x187')));});};Dialer['prototype'][_0x8934('0xa')]=function(_0x4731ae){var _0x3b97af=this;var _0x5bf2c0=_0x4731ae['dialPredictiveOptimizationPercentage']/0x64;var _0x592461=_0x4731ae[_0x8934('0x64')]/(_0x4731ae[_0x8934('0x64')]+_0x4731ae[_0x8934('0x5f')]);var _0x10950f=_0x4731ae[_0x8934('0x55')]-_0x4731ae[_0x8934('0x188')]-_0x4731ae[_0x8934('0x59')]-_0x4731ae[_0x8934('0x89')]-_0x4731ae[_0x8934('0x189')];var _0x319426=(_0x4731ae[_0x8934('0x55')]-_0x4731ae[_0x8934('0x188')])*_0x4731ae[_0x8934('0x18a')];var _0x463391=Math[_0x8934('0x18b')](_0x4731ae[_0x8934('0x18c')]*_0x4731ae[_0x8934('0x18d')]*_0x4731ae[_0x8934('0x6e')]*_0x4731ae[_0x8934('0x6f')]);if(_[_0x8934('0x7b')](_0x4731ae[_0x8934('0x2a')])){loggerPredictive[_0x8934('0x7a')](_0x8934('0x18e'));if(!_[_0x8934('0x7b')](_0x4731ae[_0x8934('0x29')])){_0x4731ae[_0x8934('0x29')]=undefined;loggerPredictive[_0x8934('0x86')](_0x8934('0x18f'),_0x8934('0x190'));}if(!_[_0x8934('0x7b')](_0x4731ae[_0x8934('0x82')])){loggerPredictive[_0x8934('0x86')](_0x8934('0x18f'),_0x8934('0x191'));clearInterval(_0x4731ae['handlePredictive']);_0x4731ae[_0x8934('0x82')]=undefined;}_0x4731ae[_0x8934('0x2a')]=moment()[_0x8934('0x75')](_0x8934('0xed'));loggerPredictive[_0x8934('0x7a')](_0x8934('0x192'),_0x4731ae['startProgressive'],_0x4731ae[_0x8934('0x42')]);this[_0x8934('0x12e')](_0x4731ae,0x1);}else if(ifInterval(_0x4731ae['dialPredictiveInterval'],_0x4731ae[_0x8934('0x2a')])){this['handlePower'](_0x4731ae,0x1);loggerPredictiveCalls[_0x8934('0x7a')](_0x8934('0x193'),_0x4731ae[_0x8934('0x2a')],_0x4731ae[_0x8934('0x42')]);_0x4731ae[_0x8934('0x18c')]=0x0;_0x4731ae[_0x8934('0x6d')]=0x0;}else if(_0x5bf2c0<_0x592461&&_0x4731ae[_0x8934('0x194')]==='dropRate'){freeVariablesPredictive(_0x4731ae);loggerPredictive[_0x8934('0x7a')](_0x8934('0x195'),'Dropped\x20calls\x20day',_0x592461,'startProgressive',_0x4731ae[_0x8934('0x42')]);}else if(_0x10950f>_0x319426){freeVariablesPredictive(_0x4731ae);loggerPredictive[_0x8934('0x7a')](_0x8934('0x196'),_0x8934('0x197'),_0x10950f,_0x8934('0x198'),_0x319426);}else if(_0x463391<_0x4731ae[_0x8934('0x6d')]&&_0x4731ae[_0x8934('0x194')]===_0x8934('0x199')){freeVariablesPredictive(_0x4731ae);loggerPredictive[_0x8934('0x7a')](_0x8934('0x19a'),_0x8934('0x19b'),_0x463391,'Drop\x20in\x20this\x20interval',_0x4731ae[_0x8934('0x6d')],_0x8934('0x2a'),_0x4731ae[_0x8934('0x42')]);}else if(!ifInterval(_0x4731ae[_0x8934('0x19c')],_0x4731ae[_0x8934('0x2a')])&&_[_0x8934('0x7b')](_0x4731ae[_0x8934('0x29')])&&!_[_0x8934('0x7b')](_0x4731ae[_0x8934('0x2a')])){_0x4731ae[_0x8934('0x29')]=moment()[_0x8934('0x75')](_0x8934('0xed'));loggerPredictive['info'](_0x8934('0x19d'),_0x4731ae[_0x8934('0x29')],_0x4731ae[_0x8934('0x42')]);this[_0x8934('0xae')](_0x4731ae[_0x8934('0x19c')])[_0x8934('0xac')](this['getDataPredictive'](_0x4731ae))[_0x8934('0xac')](mergeDataErlangB(_0x4731ae))['then'](this[_0x8934('0x19e')](_0x4731ae))['catch'](loggerCatchPredictive(_0x8934('0x19f'),_0x4731ae));}else if(!ifInterval(_0x4731ae['dialPredictiveInterval'],_0x4731ae['startPredictive'])){_0x4731ae['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x4731ae['startPredictive']=moment()[_0x8934('0x75')](_0x8934('0xed'));loggerPredictive[_0x8934('0x7a')]('[startMethodPredictive][StartPredictive][Repeat]',_0x4731ae[_0x8934('0x29')],_0x4731ae[_0x8934('0x42')]);clearInterval(_0x4731ae[_0x8934('0x82')]);_0x4731ae['handlePredictive']=undefined;this[_0x8934('0xae')](_0x4731ae['dialPredictiveInterval'])['then'](this[_0x8934('0x1a0')](_0x4731ae))[_0x8934('0xac')](mergeDataErlangB(_0x4731ae))[_0x8934('0xac')](this['startMethodPredictive'](_0x4731ae))[_0x8934('0xa2')](loggerCatchPredictive(_0x8934('0x19f'),_0x4731ae));}};Dialer['prototype'][_0x8934('0x1a0')]=function(_0x4a2ba3){var _0x22839c=this;return function(_0x10b13f){return new BPromise(function(_0x3fdd82,_0x574798){_[_0x8934('0x80')](_0x4a2ba3,_0x10b13f[0x0]);if(checkGetDataPredictive(_0x10b13f[0x0])){loggerPredictive[_0x8934('0x7a')](JSON[_0x8934('0x4e')](_0x10b13f[0x0]));if(_0x4a2ba3['dialPredictiveOptimization']===_0x8934('0x199')){return _0x22839c[_0x8934('0x1a1')](_0x4a2ba3['id'])[_0x8934('0xac')](function(_0x5ed5ce){var _0x453d93=_0x4a2ba3['loggedIn']-_0x5ed5ce[0x0]['outboundQueuePauses'];var _0x4416c9=_0x4a2ba3[_0x8934('0x19c')]*0x3c;var _0x7587ee=_0x10b13f[0x0]['predictiveIntervalAvgTalktime']+_0x10b13f[0x0][_0x8934('0x6b')];var _0x2765be=(_0x10b13f[0x0][_0x8934('0x6a')]+_0x10b13f[0x0][_0x8934('0xf2')]+_0x10b13f[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x10b13f[0x0][_0x8934('0x70')];var _0x253ab0=_0x4a2ba3['dialPredictiveOptimizationPercentage']/0x64;_0x4a2ba3[_0x8934('0x188')]=_0x5ed5ce[0x0][_0x8934('0x1a2')]||0x0;_0x4a2ba3[_0x8934('0x6e')]=_0x2765be>0x0?_0x2765be:0x1;return _0x22839c[_0x8934('0x1a3')](_0x453d93,_0x4416c9,_0x7587ee,_0x2765be,_0x253ab0);})[_0x8934('0xac')](function(_0x1df35e){return _0x3fdd82(_0x1df35e);})[_0x8934('0xa2')](function(_0x2c7571){return _0x574798(msgResponse('[CatchErlangB]',_0x8934('0x11a'),JSON[_0x8934('0x4e')](_0x2c7571)));});}if(_0x4a2ba3[_0x8934('0x194')]===_0x8934('0x1a4')){return _0x22839c[_0x8934('0x1a1')](_0x4a2ba3['id'])['then'](function(_0x39c9ae){var _0x4553e5=_0x4a2ba3[_0x8934('0x55')]-_0x39c9ae[0x0]['outboundQueuePauses'];var _0xad035=_0x4a2ba3[_0x8934('0x19c')]*0x3c;var _0x29f556=_0x10b13f[0x0][_0x8934('0x6c')]+_0x10b13f[0x0][_0x8934('0x6b')];var _0x4ef1b2=(_0x10b13f[0x0][_0x8934('0x6a')]+_0x10b13f[0x0][_0x8934('0xf2')]+_0x10b13f[0x0][_0x8934('0x1a5')])/_0x10b13f[0x0][_0x8934('0x70')];var _0x2e7744=_0x4a2ba3[_0x8934('0x1a6')]/0x64;_0x4a2ba3[_0x8934('0x188')]=_0x39c9ae[0x0]['outboundQueuePauses']||0x0;_0x4a2ba3[_0x8934('0x6e')]=_0x4ef1b2>0x0?_0x4ef1b2:0x1;return _0x22839c[_0x8934('0x1a7')](_0x4553e5,_0xad035,_0x29f556,_0x4ef1b2,_0x2e7744);})[_0x8934('0xac')](function(_0x4d18da){return _0x3fdd82(_0x4d18da);})[_0x8934('0xa2')](function(_0x29a7ab){return _0x574798(msgResponse('[CatchErlangB]',_0x8934('0x11a'),JSON[_0x8934('0x4e')](_0x29a7ab)));});}}else{return _0x574798(msgResponse(_0x8934('0x1a8'),_0x8934('0x11a'),_0x8934('0x1a9')));}});};};Dialer[_0x8934('0x1c')][_0x8934('0x19e')]=function(_0xe375aa){var _0x379562=this;return function(){var _0x5b813a=0x0;var _0x3ad009=Math['floor'](_0xe375aa[_0x8934('0x1aa')]*0x3e8);if(_0x3ad009>0x0){_0x3ad009=_0x3ad009<0x64?0x64:_0x3ad009;loggerPredictive[_0x8934('0x7a')](_0x8934('0x1ab'),_0x3ad009);_0xe375aa[_0x8934('0x82')]=setInterval(function(){_0x379562['handlePredictive'](_0xe375aa);loggerPredictiveCalls[_0x8934('0x7a')]('[handlePredictive]',_0x5b813a+=0x1);},_0x3ad009);}else{loggerPredictive[_0x8934('0x7a')](_0x8934('0x1ac'),_0x8934('0x1ad'),_0x3ad009);}};};Dialer[_0x8934('0x1c')][_0x8934('0x1ae')]=function(_0x395e67,_0x11eb47){var _0x360c0b=this;return function(_0x25ed66){if(_['isEmpty'](_0x25ed66)){if(_[_0x8934('0xa0')](_0x11eb47[_0x8934('0xc1')])||!_0x11eb47[_0x8934('0x1af')]){if(_0x395e67[_0x8934('0x12c')]===_0x8934('0x9')){_0x395e67['queueStatusComplete']=_[_0x8934('0x7b')](_0x395e67[_0x8934('0xff')])?!![]:_0x395e67[_0x8934('0xff')];var _0x10fda1=uuid['v4']();_0x360c0b['actions'][_0x10fda1]=new Action(_0x395e67,_0x11eb47,_0x10fda1);loggerBooked['info'](_0x8934('0x1b0'),_0x10fda1,'queueStatusComplete:\x20',JSON['stringify'](_0x395e67[_0x8934('0xff')]),_0x8934('0x1b1'),_0x395e67[_0x8934('0x42')]);if(_0x395e67[_0x8934('0xff')]){_0x395e67[_0x8934('0xff')]=![];_0x360c0b['queueBooked'][_0x360c0b[_0x8934('0x9d')][_0x10fda1][_0x8934('0xa5')]]=[];ami[_0x8934('0x11f')]({'actionid':_0x10fda1,'action':_0x8934('0x1b2'),'queue':_0x395e67[_0x8934('0x42')]})[_0x8934('0xa2')](function(_0x3f74fe){_0x360c0b[_0x8934('0xa4')](_0x395e67);_0x360c0b['rescheduleContact']({'active':![],'ContactId':_0x360c0b[_0x8934('0x9d')][_0x10fda1][_0x8934('0xbf')],'ListId':_0x360c0b[_0x8934('0x9d')][_0x10fda1]['ListId'],'VoiceQueueId':_0x360c0b[_0x8934('0x9d')][_0x10fda1][_0x8934('0xc2')]||undefined,'CampaignId':_0x360c0b[_0x8934('0x9d')][_0x10fda1][_0x8934('0xc3')]||undefined})[_0x8934('0xa2')](loggerCatch(_0x8934('0x1b3')));delete _0x360c0b[_0x8934('0x9d')][_0x10fda1];});}else{loggerBooked[_0x8934('0x7a')](_0x8934('0x1b4'),JSON[_0x8934('0x4e')](_0x395e67[_0x8934('0xff')]),_0x8934('0x1b1'),_0x395e67['name']);_0x360c0b[_0x8934('0xa4')](_0x395e67);_0x360c0b[_0x8934('0xb1')]({'active':![],'ContactId':_0x360c0b['actions'][_0x10fda1][_0x8934('0xbf')],'ListId':_0x360c0b[_0x8934('0x9d')][_0x10fda1]['ListId'],'VoiceQueueId':_0x360c0b[_0x8934('0x9d')][_0x10fda1][_0x8934('0xc2')]||undefined,'CampaignId':_0x360c0b['actions'][_0x10fda1][_0x8934('0xc3')]||undefined})[_0x8934('0xa2')](loggerCatch(_0x8934('0x1b3')));delete _0x360c0b[_0x8934('0x9d')][_0x10fda1];}}else{return _0x360c0b[_0x8934('0x1b5')](_0x395e67,_0x11eb47);}}else{if(getDiff(_0x11eb47[_0x8934('0x1b6')])<_0x395e67[_0x8934('0x1b7')]*0x3c){_0x360c0b[_0x8934('0x21')][_0x8934('0x1b8')](_0x11eb47['id'])['finally'](function(){_0x360c0b['updateOriginated'](_0x395e67);});}else{_0x395e67[_0x8934('0x67')]+=0x1;_0x360c0b[_0x8934('0xa4')](_0x395e67);if(_0x395e67[_0x8934('0x1b9')]){_0x360c0b['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x11eb47[_0x8934('0xbf')],'ListId':_0x11eb47['ListId'],'VoiceQueueId':_0x11eb47['VoiceQueueId']||undefined,'CampaignId':_0x11eb47['CampaignId']||undefined})[_0x8934('0xa2')](loggerCatch(_0x8934('0x1ba')));_0x360c0b['createHistory'](createObjHistory(_0x395e67,_0x11eb47,_0x8934('0x1bb'),0x17,_0x8934('0x1bc')))['catch'](loggerCatch(_0x8934('0x1bd')));}else{_0x360c0b['saveInDb'](createObjHistory(_0x395e67,_0x11eb47,'RECALLFAILEDTIMEOUT',0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]',_0x8934('0x1be'));}}}}else{_0x395e67[_0x8934('0x60')]+=0x1;_0x360c0b['saveInDb'](createObjHistory(_0x395e67,_0x11eb47,'BLACKLIST',0xd,_0x8934('0x1bf')),_0x8934('0x1c0'),_0x8934('0x1c1'));throw _0x8934('0x1c2');}};};Dialer[_0x8934('0x1c')][_0x8934('0x130')]=function(_0x82593){var _0x331f83=this;var _0x35ea09=[];var _0x42334c=_0x82593[_0x8934('0x1c3')]-_0x82593[_0x8934('0x89')]-_0x82593[_0x8934('0x1c4')];emitCampaignSummary(_0x82593);if(_0x42334c>0x0){if(_0x42334c>this['maxNumberOriginate']){_0x42334c=this[_0x8934('0x25')];}_0x82593[_0x8934('0x1c4')]+=_0x42334c;this[_0x8934('0xb5')](_0x82593['id'],_0x42334c,_0x82593[_0x8934('0x1c5')])['then'](function(_0x3662c7){_0x82593[_0x8934('0x1c4')]-=_0x42334c;_0x82593['temp']=_0x82593['temp']>0x0?_0x82593[_0x8934('0x1c4')]:0x0;if(!checkContactEmpty(_0x3662c7)){_0x82593[_0x8934('0x44')]=_0x8934('0x8e');logger['info'](_0x8934('0x1c6')+_0x82593[_0x8934('0x42')]);}else{_0x82593['originated']+=_0x3662c7[_0x8934('0x88')];_0x82593[_0x8934('0x44')]='RUNNING';for(var _0x53028a=0x0;_0x53028a<_0x3662c7['length'];_0x53028a+=0x1){_0x82593[_0x8934('0x1c7')]+=0x1;if(_[_0x8934('0xa0')](_0x3662c7[_0x53028a])||_[_0x8934('0xa0')](_0x3662c7[_0x53028a][_0x8934('0x14d')])||_[_0x8934('0xa0')](_0x3662c7[_0x53028a][_0x8934('0x14d')][_0x8934('0x15b')])){_0x331f83[_0x8934('0xbb')](_0x8934('0x1c8'),_0x82593,_0x3662c7[_0x53028a]);}else{_0x331f83[_0x8934('0xad')](_[_0x8934('0xbe')](_0x3662c7[_0x53028a],['CampaignId',_0x8934('0x1c9')]))[_0x8934('0xac')](_0x331f83[_0x8934('0x1ae')](_0x82593,_0x3662c7[_0x53028a]))[_0x8934('0xa2')](_0x331f83[_0x8934('0xba')](_0x8934('0x1ca'),_0x82593));}}}})[_0x8934('0xa2')](loggerGetContactDialer(_0x8934('0x1cb'),_0x82593,_0x42334c));}};Dialer[_0x8934('0x1c')][_0x8934('0x12e')]=function(_0x387640,_0x289a08){var _0x3029f4=this;var _0xe4221=[];var _0x2903a5=_0x289a08>=0x1?_0x289a08:0x1;var _0x2b9c61=[];if(_0x387640[_0x8934('0x12c')]===_0x8934('0x9')){_0x2903a5=0x1;}var _0x3ef73f=Math[_0x8934('0x18b')](_0x387640[_0x8934('0x54')]*_0x2903a5)-_0x387640[_0x8934('0x89')]-_0x387640[_0x8934('0x1c4')];emitVoiceQueueSummary(_0x387640);if(_0x387640[_0x8934('0x1cc')]>0x0){var _0x1d916a=_0x387640[_0x8934('0x1cc')]-_0x387640['originated']-_0x387640[_0x8934('0x189')]-_0x387640[_0x8934('0x1c4')]-_0x387640[_0x8934('0x56')];if(_0x3ef73f>_0x1d916a){_0x3ef73f=_0x1d916a;}}if(_0x3ef73f>0x0){if(_0x387640[_0x8934('0x12c')]===_0x8934('0x9')){_0x3ef73f=0x1;}if(_0x3ef73f>this[_0x8934('0x25')]){_0x3ef73f=this['maxNumberOriginate'];}_0x387640[_0x8934('0x1c4')]+=_0x3ef73f;for(var _0x436b5f in this[_0x8934('0x23')]){if(this[_0x8934('0x23')][_0x8934('0x9f')](_0x436b5f)){if(this[_0x8934('0x23')][_0x436b5f][_0x8934('0x96')]===_0x8934('0x1cd')&&this[_0x8934('0x23')][_0x436b5f][_0x8934('0xc7')]===_0x8934('0x1ce')){_0xe4221['push'](this[_0x8934('0x23')][_0x436b5f]['id']);}}}this[_0x8934('0xb3')](_0x387640['id'],_0xe4221,_0x3ef73f,_0x387640[_0x8934('0x1c5')])[_0x8934('0xac')](function(_0x147050){_0x387640['temp']-=_0x3ef73f;_0x387640[_0x8934('0x1c4')]=_0x387640[_0x8934('0x1c4')]>0x0?_0x387640['temp']:0x0;if(!checkContactEmpty(_0x147050)){_0x3029f4[_0x8934('0xa9')](_0x387640)['then'](sendMessageReschedule(_0x387640))[_0x8934('0xa2')](loggerCatch(_0x8934('0x1cf')));}else{_0x387640[_0x8934('0x89')]+=_0x147050['length'];_0x387640[_0x8934('0x44')]=_0x387640[_0x8934('0x12c')]===_0x8934('0x9')?_0x8934('0x13f'):_0x8934('0x1d0');for(var _0x41c45e=0x0;_0x41c45e<_0x147050['length'];_0x41c45e+=0x1){if(_[_0x8934('0xa0')](_0x147050[_0x41c45e])||_[_0x8934('0xa0')](_0x147050[_0x41c45e][_0x8934('0x14d')])||_[_0x8934('0xa0')](_0x147050[_0x41c45e][_0x8934('0x14d')][_0x8934('0x15b')])){_0x3029f4['emptyContact'](_0x8934('0x1c8'),_0x387640,_0x147050[_0x41c45e]);}else{_0x3029f4[_0x8934('0xab')](_[_0x8934('0xbe')](_0x147050[_0x41c45e],[_0x8934('0xc2'),_0x8934('0x1c9')]))['then'](_0x3029f4[_0x8934('0x1ae')](_0x387640,_0x147050[_0x41c45e]))[_0x8934('0xa2')](_0x3029f4['loggerHandler'](_0x8934('0x1c8'),_0x387640));}}}})['catch'](loggerGetContactDialer(_0x8934('0x1d1'),_0x387640,_0x3ef73f));}};Dialer[_0x8934('0x1c')][_0x8934('0x82')]=function(_0x32be5e){var _0x112388=this;if(_0x32be5e[_0x8934('0x1cc')]>0x0){var _0x49a964=_0x32be5e[_0x8934('0x1cc')]-_0x32be5e[_0x8934('0x89')]-_0x32be5e['talking'];if(_0x49a964>0x0){this[_0x8934('0x1d2')](_0x32be5e);}else{loggerPredictiveCalls[_0x8934('0x7a')](_0x8934('0x1d3'));}}else{this['tryOriginatePredictive'](_0x32be5e);}};Dialer[_0x8934('0x1c')][_0x8934('0x1d2')]=function(_0x4b0f47){var _0x40eb72=this;var _0x17750d=[];_0x4b0f47[_0x8934('0x89')]+=0x1;for(var _0xf6f888 in this[_0x8934('0x23')]){if(this[_0x8934('0x23')][_0x8934('0x9f')](_0xf6f888)){if(this[_0x8934('0x23')][_0xf6f888][_0x8934('0x96')]===_0x8934('0x1cd')&&this[_0x8934('0x23')][_0xf6f888][_0x8934('0xc7')]===_0x8934('0x1ce')){_0x17750d[_0x8934('0xfd')](this[_0x8934('0x23')][_0xf6f888]['id']);}}}this[_0x8934('0xb3')](_0x4b0f47['id'],_0x17750d,0x1,_0x4b0f47[_0x8934('0x1c5')])[_0x8934('0xac')](function(_0xce0953){if(!checkContactEmpty(_0xce0953)){checkContactLowerLimitOriginate(_0x4b0f47,0x1,0x0);_0x40eb72[_0x8934('0xa9')](_0x4b0f47)[_0x8934('0xac')](sendMessageReschedule(_0x4b0f47))[_0x8934('0xa2')](loggerCatch('[countReScheduled]\x20'));}else{_0x4b0f47[_0x8934('0x44')]=_0x8934('0x1d0');if(_[_0x8934('0xa0')](_0xce0953[0x0])||_['isNil'](_0xce0953[0x0][_0x8934('0x14d')])||_[_0x8934('0xa0')](_0xce0953[0x0]['Contact']['phone'])){_0x40eb72['emptyContact'](_0x8934('0x1c8'),_0x4b0f47,_0xce0953[0x0]);}else{_0x40eb72[_0x8934('0xab')](_[_0x8934('0xbe')](_0xce0953[0x0],['VoiceQueueId',_0x8934('0x1c9')]))[_0x8934('0xac')](_0x40eb72[_0x8934('0x1ae')](_0x4b0f47,_0xce0953[0x0]))[_0x8934('0xa2')](_0x40eb72[_0x8934('0xba')](_0x8934('0x1d4'),_0x4b0f47));}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x4b0f47,0x1));emitVoiceQueueSummary(_0x4b0f47);};Dialer[_0x8934('0x1c')][_0x8934('0x1a3')]=function(_0x2b5fa3,_0x7e9a94,_0x3b1717,_0x3ba5ee,_0xa3ddb6,_0x5a42cd){loggerPredictive[_0x8934('0x7a')](_0x8934('0x1d5'),_0x8934('0x1d6'),_0x2b5fa3,'\x20interval\x20=\x20',_0x7e9a94,_0x8934('0x1d7'),_0x3b1717,_0x8934('0x1d8'),_0x3ba5ee,_0x8934('0x1d9'),_0xa3ddb6);return new BPromise(function(_0x250313,_0xca8113){if(_0x2b5fa3<=0x0||isNaN(_0x2b5fa3)){return _0xca8113(msgResponse(_0x8934('0x1d5'),_0x8934('0x4d'),'m\x20=\x20'+_0x2b5fa3));}if(_0x3b1717<=0x0||isNaN(_0x3b1717)){return _0xca8113(msgResponse(_0x8934('0x1d5'),_0x8934('0x4d'),_0x8934('0x1da')+_0x3b1717));}if(_0x3ba5ee<=0x0||isNaN(_0x3ba5ee)){return _0xca8113(msgResponse('[abandonmentRate]',_0x8934('0x4d'),_0x8934('0x1db')+_0x3ba5ee));}if(_0x7e9a94<=0x0||isNaN(_0x7e9a94)){return _0xca8113(msgResponse(_0x8934('0x1d5'),_0x8934('0x4d'),_0x8934('0x1dc')+_0x7e9a94));}if(_0xa3ddb6<=0x0||isNaN(_0xa3ddb6)){return _0xca8113(msgResponse(_0x8934('0x1d5'),'Error',_0x8934('0x1dd')+_0xa3ddb6));}_0x5a42cd=_0x5a42cd||0x0;var _0x56d2cf=0x1/_0x3b1717;var _0x50d323=0x0;var _0x3e91c5=0x0;var _0x3a0b33=0x0;var _0xe7fc9b=0x0;for(var _0x47b0ac=0x0;_0x3a0b33<_0xa3ddb6;_0x47b0ac+=0x1){_0x3e91c5=_0x47b0ac/_0x7e9a94;_0x50d323=(_0x3ba5ee*_0x3e91c5+_0x5a42cd)/_0x56d2cf;_0x3a0b33=erlangb(_0x50d323,_0x2b5fa3);_0xe7fc9b=_0x50d323/_0x2b5fa3*(0x1-erlangb(_0x50d323,_0x2b5fa3));}return _0x250313({'erlangCalls':_0x47b0ac,'erlangCallToSecond':_0x7e9a94/_0x47b0ac,'erlangAbandonmentRate':_0x3a0b33,'erlangBusyFactor':_0xe7fc9b});});};Dialer[_0x8934('0x1c')]['busyFactor']=function(_0x4ec1b2,_0x381cf2,_0x5bb916,_0x47f9e7,_0x2e01f2,_0x19c1e6){loggerPredictive[_0x8934('0x7a')](_0x8934('0x1de'),_0x8934('0x1d6'),_0x4ec1b2,_0x8934('0x1df'),_0x381cf2,_0x8934('0x1d7'),_0x5bb916,_0x8934('0x1d8'),_0x47f9e7,'\x20Umin\x20=\x20',_0x2e01f2);return new BPromise(function(_0xe5ea8d,_0x3ca7ba){if(_0x4ec1b2<=0x0||isNaN(_0x4ec1b2)){return _0x3ca7ba(msgResponse(_0x8934('0x1d5'),_0x8934('0x4d'),_0x8934('0x1e0')+_0x4ec1b2));}if(_0x5bb916<=0x0||isNaN(_0x5bb916)){return _0x3ca7ba(msgResponse(_0x8934('0x1d5'),'Error','Ts\x20=\x20'+_0x5bb916));}if(_0x47f9e7<=0x0||isNaN(_0x47f9e7)){return _0x3ca7ba(msgResponse(_0x8934('0x1d5'),_0x8934('0x4d'),_0x8934('0x1db')+_0x47f9e7));}if(_0x381cf2<=0x0||isNaN(_0x381cf2)){return _0x3ca7ba(msgResponse(_0x8934('0x1d5'),_0x8934('0x4d'),_0x8934('0x1dc')+_0x381cf2));}if(_0x2e01f2<=0x0||isNaN(_0x2e01f2)){return _0x3ca7ba(msgResponse(_0x8934('0x1d5'),'Error','Amax\x20=\x20'+_0x2e01f2));}_0x19c1e6=_0x19c1e6||0x0;var _0x353802=0x1/_0x5bb916;var _0x531b74=0x0;var _0x3c2e2e=0x0;var _0x3caf5e=0x0;var _0xaf565e=0x0;for(var _0x42be64=0x0;_0xaf565e<_0x2e01f2;_0x42be64+=0x1){_0x3c2e2e=_0x42be64/_0x381cf2;_0x531b74=(_0x47f9e7*_0x3c2e2e+_0x19c1e6)/_0x353802;_0x3caf5e=erlangb(_0x531b74,_0x4ec1b2);_0xaf565e=_0x531b74/_0x4ec1b2*(0x1-erlangb(_0x531b74,_0x4ec1b2));}return _0xe5ea8d({'erlangCalls':_0x42be64,'erlangCallToSecond':_0x381cf2/_0x42be64,'erlangAbandonmentRate':_0x3caf5e,'erlangBusyFactor':_0xaf565e});});};module['exports']=Dialer; \ No newline at end of file +var _0xb7e7=['CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','Machine','amd','[syncMachine][createHistory]','[syncMachine]','[syncHangupInAMDIvr]','MACHINE','[syncMachineIvr][createHistory]','[syncMachineIvr]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete]','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','outboundDropCallsDayTimeout','dropreason','TIMEOUT','Abandoned','CALLEREXIT','syncQueueMember','roundrobin','actionid','paused','stateinterface','locked','strategy','rrmemory','push','idHopper','queueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','finally','ListId','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','syncCampaigns','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','iftime\x20%s,%s','interval','content','indexOf','true','command','all','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','dialPowerLevel','booked','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','checkIsTrunkReachable','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDMaximumNumberOfWords','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','updatedAt','%s%s','XMD-','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','syncOriginateResponse','responsetime','getQueue','response','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','countcongestionretry','countnoanswerretry','dialGlobalMaxRetry','dialNoAnswerMaxRetry','add','dialNoAnswerRetryFrequency','minutes','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','[syncAgentComplete][createHistory][0]','stateGlobal','reason\x200\x20no\x20such\x20number....','NoAnswer','countglobal','[syncAgentComplete][createHistory][3]','createStateFinal','reason\x203\x20ringing\x20no\x20answer','Busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','floor','erlangCalls','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive][First]','[startMethodPredictive][StartProgressive]','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][LowerLimitInterval]','Agent\x20free','agent\x20max\x20free\x20','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','[startMethodPredictive][StartPredictive][First]','getDataPredictive','[startMethodPredictive][StartPredictive][Repeat]','startMethodPredictive','[averageHandleTime][ErlangB]\x20','predictiveIntervalAnsweredCalls','outboundQueuePauses','predictiveIntervalHitRate','abandonmentRate','[CatchErlangB]','agentBusyFactor','busyFactor','check\x20failure','[handlePredictive]','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','dialRecallMeTimeout','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','limitCalls','temp','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','\x20interval\x20=\x20','\x20Ts\x20=\x20','\x20p\x20=\x20','\x20Amax\x20=\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','[busyFactor]','\x20m\x20=\x20','\x20Umin\x20=\x20','exports','util','bluebird','moment','ioredis','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./hangup','env','127.0.0.1','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuestatuscomplete','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','answered','available','loggedIn','sumDuration','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerCallsDay','outboundBusyCallsDay','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','Trunk','callerid','md5','format','voice:queue:%s','voice_queue:save','ivr','campaign:save','info','[checkGetDataPredictive][avgTalktime]','[checkGetDataPredictive][objIsEmpty]','[checkGetDataPredictive][obj]','[ErlangB]','[freeVariablesPredictive]','handlePredictive','string','\x22%s\x22\x20<%s>','error','inspect','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','clearZombieChannels','uniqueId','[uniqueid]','[actions]','hasOwnProperty','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','merge','pick','ContactId','UserId','VoiceQueueId'];(function(_0x20bf02,_0xe0d695){var _0x340a22=function(_0x396948){while(--_0x396948){_0x20bf02['push'](_0x20bf02['shift']());}};_0x340a22(++_0xe0d695);}(_0xb7e7,0x121));var _0x7b7e=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0xb7e7[_0xa6cc5c];return _0x44803d;};'use strict';var util=require(_0x7b7e('0x0'));var _=require('lodash');var BPromise=require(_0x7b7e('0x1'));var uuid=require('uuid');var moment=require(_0x7b7e('0x2'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x7b7e('0x3'));var config=require('../../../config/environment/');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var loggerBooked=require(_0x7b7e('0x4'))('booked');var loggerPredictive=require('../../../config/logger')(_0x7b7e('0x6'));var loggerPredictiveCalls=require(_0x7b7e('0x4'))(_0x7b7e('0x7'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x7b7e('0x8'));var ami=require(_0x7b7e('0x9'));config[_0x7b7e('0xa')]=_[_0x7b7e('0xb')](config[_0x7b7e('0xa')],{'host':_0x7b7e('0xc'),'port':0x18eb});var io=require(_0x7b7e('0xd'))(new Redis(config['redis']));var cmHopper=require(_0x7b7e('0xe'));var cmHopperFinal=require(_0x7b7e('0xf'));var cmHopperHistory=require(_0x7b7e('0x10'));var cmHopperBlack=require(_0x7b7e('0x11'));var voiceQueueRt=require(_0x7b7e('0x12'));var Action=require(_0x7b7e('0x13'));var History=require(_0x7b7e('0x14'));var Final=require(_0x7b7e('0x15'));var AgentComplete=require(_0x7b7e('0x16'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x7b7e('0x17'));var ipAgi=process[_0x7b7e('0x18')]['XCALLY_IP_AGI']||_0x7b7e('0x19');var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x7b7e('0x1a')][_0x7b7e('0x1b')]=function(_0xf067da){this[_0x7b7e('0x1c')]=this[_0x7b7e('0x1c')]?this['tail']['finally'](_0xf067da):_0xf067da();};function Dialer(_0xc7f087,_0x36444d){this[_0x7b7e('0x1d')]=new Sequence();this[_0x7b7e('0x1e')]=_0x36444d;this[_0x7b7e('0x1f')]=_0xc7f087[_0x7b7e('0x1f')];this[_0x7b7e('0x20')]=_0xc7f087[_0x7b7e('0x20')];this[_0x7b7e('0x21')]=_0xc7f087[_0x7b7e('0x21')];this[_0x7b7e('0x22')]=_0xc7f087[_0x7b7e('0x22')];this[_0x7b7e('0x23')]=config[_0x7b7e('0x23')]||0x2;this[_0x7b7e('0x24')]={};this[_0x7b7e('0x25')]={};this[_0x7b7e('0x26')]={};this['uniqueId']={};this[_0x7b7e('0x27')]={};this[_0x7b7e('0x28')]={};this[_0x7b7e('0x29')]={};this['ivrOriginated']={};this[_0x7b7e('0x2a')]={};this[_0x7b7e('0x2b')]={};ami['on'](_0x7b7e('0x2c'),this[_0x7b7e('0x2d')][_0x7b7e('0x2e')](this));ami['on'](_0x7b7e('0x2f'),this[_0x7b7e('0x30')][_0x7b7e('0x2e')](this));ami['on']('originateresponse',this['syncOriginateResponse']['bind'](this));ami['on'](_0x7b7e('0x31'),this[_0x7b7e('0x32')][_0x7b7e('0x2e')](this));ami['on']('custom:queuesummary',this['syncQueueSummary']['bind'](this));ami['on'](_0x7b7e('0x33'),this[_0x7b7e('0x34')][_0x7b7e('0x2e')](this));ami['on'](_0x7b7e('0x35'),this[_0x7b7e('0x36')]['bind'](this));ami['on'](_0x7b7e('0x37'),this[_0x7b7e('0x38')]['bind'](this));ami['on']('queuemember',this['syncQueueMember'][_0x7b7e('0x2e')](this));ami['on'](_0x7b7e('0x39'),this['syncQueueStatusComplete'][_0x7b7e('0x2e')](this));this['loopCampaigns']();this[_0x7b7e('0x3a')]();}function isNotNull(_0xb9b6bf){return _0xb9b6bf!==null&&!_[_0x7b7e('0x3b')](_0xb9b6bf);}function checkIsLoggedIn(_0x5515ca,_0x3960b8){return function(){if(_0x3960b8<=0x0){_0x5515ca[_0x7b7e('0x3c')]=_0x7b7e('0x3d');throw _0x5515ca[_0x7b7e('0x3e')]+_0x7b7e('0x3f');}};}function isActive(_0x5732ee){return _0x5732ee;}function checkIsActive(_0x41af57,_0x51c010){return function(){if(!isActive(_0x51c010)){_0x41af57[_0x7b7e('0x3c')]=_0x7b7e('0x40');throw _0x41af57[_0x7b7e('0x3e')]+_0x7b7e('0x41');}};}function checkInterval(_0x378faa){return function(){if(!isNotNull(_0x378faa[_0x7b7e('0x42')])){_0x378faa[_0x7b7e('0x3c')]='INTERVAL_IS_NULL';throw _0x378faa['name']+_0x7b7e('0x43');}if(!isNotNull(_0x378faa[_0x7b7e('0x42')]['Intervals'])){_0x378faa[_0x7b7e('0x3c')]=_0x7b7e('0x44');throw _0x378faa[_0x7b7e('0x3e')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x7b7e('0x45')](_0x378faa[_0x7b7e('0x42')][_0x7b7e('0x46')]))){_0x378faa[_0x7b7e('0x3c')]=_0x7b7e('0x44');throw _0x378faa[_0x7b7e('0x3e')]+_0x7b7e('0x43');}};}function msgResponse(_0x202f04,_0x44497c,_0x39b3bb){return{'action':_0x202f04,'response':_0x44497c,'message':_0x39b3bb};}function myreject(_0xd5a64d){return function(_0x2d0620){return _0xd5a64d(msgResponse(_0x7b7e('0x47'),_0x7b7e('0x48'),JSON[_0x7b7e('0x49')](_0x2d0620)));};}function getSeconds(_0x279f46,_0x5a4f92){var _0x8c80d5=moment(_0x279f46)[_0x7b7e('0x4a')](0x0);var _0xb20532=moment(_0x5a4f92)[_0x7b7e('0x4a')](0x0);return _0x8c80d5[_0x7b7e('0x4b')](_0xb20532,_0x7b7e('0x4c'));}function emit(_0x7f15,_0x1e6280,_0x1c6d11){io['to'](_0x7f15)[_0x7b7e('0x4d')](_0x1e6280,_0x1c6d11);}function emitVoiceQueueSummary(_0x5f3de5){if(_0x5f3de5[_0x7b7e('0x4e')]===_0x7b7e('0x4f')){var _0x213a8c={'id':_0x5f3de5['id'],'name':_0x5f3de5[_0x7b7e('0x3e')],'strategy':_0x5f3de5['strategy'],'answered':_0x5f3de5[_0x7b7e('0x50')],'available':_0x5f3de5[_0x7b7e('0x51')],'loggedIn':_0x5f3de5[_0x7b7e('0x52')],'pTalking':_0x5f3de5['pTalking'],'sumBillable':_0x5f3de5['sumBillable'],'sumDuration':_0x5f3de5[_0x7b7e('0x53')],'sumHoldTime':_0x5f3de5['sumHoldTime']||0x0,'talking':_0x5f3de5[_0x7b7e('0x54')],'total':_0x5f3de5[_0x7b7e('0x55')],'type':_0x5f3de5['type'],'unmanaged':_0x5f3de5[_0x7b7e('0x56')],'abandoned':_0x5f3de5[_0x7b7e('0x57')],'waiting':_0x5f3de5[_0x7b7e('0x58')],'loggedInDb':_0x5f3de5[_0x7b7e('0x59')],'dialActive':_0x5f3de5[_0x7b7e('0x5a')],'dialMethod':_0x5f3de5[_0x7b7e('0x5b')],'dialOriginateCallerIdName':_0x5f3de5[_0x7b7e('0x5c')],'dialOriginateCallerIdNumber':_0x5f3de5[_0x7b7e('0x5d')],'dialOriginateTimeout':_0x5f3de5[_0x7b7e('0x5e')],'dialPrefix':_0x5f3de5['dialPrefix'],'outboundAnswerAgiCallsDay':_0x5f3de5['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x5f3de5[_0x7b7e('0x5f')],'outboundBlacklistCallsDay':_0x5f3de5['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x5f3de5[_0x7b7e('0x60')],'outboundCongestionCallsDay':_0x5f3de5['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x5f3de5['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x5f3de5[_0x7b7e('0x61')],'outboundDropCallsDayTimeout':_0x5f3de5['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x5f3de5[_0x7b7e('0x62')],'outboundNoSuchCallsDay':_0x5f3de5['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x5f3de5[_0x7b7e('0x63')],'outboundReCallsDay':_0x5f3de5[_0x7b7e('0x64')],'outboundRejectCallsDay':_0x5f3de5[_0x7b7e('0x65')],'outboundUnknownCallsDay':_0x5f3de5[_0x7b7e('0x66')],'predictiveIntervalAnsweredCalls':_0x5f3de5['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x5f3de5[_0x7b7e('0x67')],'predictiveIntervalAvgTalktime':_0x5f3de5[_0x7b7e('0x68')],'predictiveIntervalDroppedCallsCallersExit':_0x5f3de5[_0x7b7e('0x69')],'predictiveIntervalDroppedCallsTimeout':_0x5f3de5[_0x7b7e('0x6a')],'predictiveIntervalErlangCalls':_0x5f3de5[_0x7b7e('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0x5f3de5[_0x7b7e('0x6c')],'predictiveIntervalHitRate':_0x5f3de5['predictiveIntervalHitRate'],'predictiveIntervalLowerLimit':_0x5f3de5['predictiveIntervalLowerLimit'],'predictiveIntervalMultiplicativeFactor':_0x5f3de5['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x5f3de5[_0x7b7e('0x6d')],'predictiveIntervalTotalCalls':_0x5f3de5[_0x7b7e('0x6e')],'message':_0x5f3de5[_0x7b7e('0x3c')],'originated':_0x5f3de5[_0x7b7e('0x6f')]};if(_0x5f3de5[_0x7b7e('0x70')]){_0x213a8c[_0x7b7e('0x70')]={'id':_0x5f3de5['Trunk']['id'],'name':_0x5f3de5[_0x7b7e('0x70')][_0x7b7e('0x3e')],'active':_0x5f3de5['Trunk']['active'],'callerid':_0x5f3de5[_0x7b7e('0x70')][_0x7b7e('0x71')]};}if(_0x5f3de5[_0x7b7e('0x42')]){_0x213a8c[_0x7b7e('0x42')]={'id':_0x5f3de5[_0x7b7e('0x42')]['id'],'name':_0x5f3de5[_0x7b7e('0x42')]['name']};}var _0x2673eb=md5(JSON['stringify'](_0x213a8c));if(_0x5f3de5[_0x7b7e('0x72')]!==_0x2673eb){_0x5f3de5[_0x7b7e('0x72')]=_0x2673eb;emit(util[_0x7b7e('0x73')](_0x7b7e('0x74'),_0x213a8c['name']),_0x7b7e('0x75'),_0x213a8c);}}}function emitCampaignSummary(_0x1010b3){if(_0x1010b3[_0x7b7e('0x4e')]===_0x7b7e('0x76')){emit(util[_0x7b7e('0x73')]('campaign:ivr:%s',_0x1010b3[_0x7b7e('0x3e')]),_0x7b7e('0x77'),_0x1010b3);}}function checkGetDataPredictive(_0x21868a){if(isNotNull(_0x21868a)){if(!_[_0x7b7e('0x45')](_0x21868a)){if(_0x21868a[_0x7b7e('0x6e')]>0x0){if(!_['isUndefined'](_0x21868a[_0x7b7e('0x68')])&&_0x21868a[_0x7b7e('0x68')]>0x0){return!![];}else{loggerPredictive[_0x7b7e('0x78')](_0x7b7e('0x79'),JSON[_0x7b7e('0x49')](_0x21868a));}if(!_[_0x7b7e('0x3b')](_0x21868a[_0x7b7e('0x67')])&&_0x21868a['predictiveIntervalAvgHoldtime']>0x0){return!![];}else{loggerPredictive[_0x7b7e('0x78')]('[checkGetDataPredictive][avgHoldtime]',JSON[_0x7b7e('0x49')](_0x21868a));}}else{loggerPredictive[_0x7b7e('0x78')]('[checkGetDataPredictive][totalCalls]',JSON[_0x7b7e('0x49')](_0x21868a));}}else{loggerPredictive[_0x7b7e('0x78')](_0x7b7e('0x7a'),JSON[_0x7b7e('0x49')](_0x21868a));}}else{loggerPredictive[_0x7b7e('0x78')](_0x7b7e('0x7b'),JSON[_0x7b7e('0x49')](_0x21868a));}return![];}function mergeDataErlangB(_0x5f15ce){return function(_0xbf044d){loggerPredictive[_0x7b7e('0x78')](_0x7b7e('0x7c'),JSON[_0x7b7e('0x49')](_0xbf044d));_['merge'](_0x5f15ce,_0xbf044d);};}function getDiff(_0x527403){var _0x5bdf1d=moment()[_0x7b7e('0x4a')](0x0);var _0x41530f=moment(_0x527403)[_0x7b7e('0x4a')](0x0);return _0x5bdf1d['diff'](_0x41530f,'seconds');}function ifInterval(_0x360cd0,_0x39efb5){if(_['isUndefined'](_0x39efb5)){return![];}if(getDiff(_0x39efb5)<_0x360cd0*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0xf54f87){if(isNotNull(_0xf54f87)){if(!_[_0x7b7e('0x3b')](_0xf54f87[_0x7b7e('0x29')])){_0xf54f87['startProgressive']=undefined;loggerPredictive[_0x7b7e('0x78')](_0x7b7e('0x7d'),'startProgressive',_0xf54f87[_0x7b7e('0x3e')]);}if(!_[_0x7b7e('0x3b')](_0xf54f87[_0x7b7e('0x28')])){_0xf54f87[_0x7b7e('0x28')]=undefined;loggerPredictive[_0x7b7e('0x78')](_0x7b7e('0x7d'),_0x7b7e('0x28'),_0xf54f87[_0x7b7e('0x3e')]);}if(!_[_0x7b7e('0x3b')](_0xf54f87['handlePredictive'])){clearInterval(_0xf54f87[_0x7b7e('0x7e')]);_0xf54f87[_0x7b7e('0x7e')]=undefined;loggerPredictive['info'](_0x7b7e('0x7d'),_0x7b7e('0x7e'),_0xf54f87[_0x7b7e('0x3e')]);}}}function erlangb(_0x59f2df,_0x1729e0){if(_0x1729e0===0x0){return 0x0;}var _0x4fc349=0x1;for(var _0x50c544=0x1;_0x50c544<=_0x1729e0;_0x50c544+=0x1){_0x4fc349=0x1+_0x4fc349*_0x50c544/_0x59f2df;}return 0x1/_0x4fc349;}function isVoiceQueueOutbound(_0x206ee7){return _0x206ee7==='outbound';}function isNotPreview(_0x2a17c7){return _0x2a17c7!==_0x7b7e('0x1e');}function isCampaignIvr(_0x561158){return _0x561158===_0x7b7e('0x76');}function getCallerId(_0x369103,_0x1d43af,_0x3b1adb){if(!_['isUndefined'](_0x3b1adb)&&_0x7b7e('0x7f')===typeof _0x3b1adb&&!_[_0x7b7e('0x45')](_0x3b1adb)){if(!_[_0x7b7e('0x3b')](_0x1d43af)&&_0x7b7e('0x7f')===typeof _0x1d43af&&!_[_0x7b7e('0x45')](_0x1d43af)){return util[_0x7b7e('0x73')](_0x7b7e('0x80'),_0x1d43af,_0x3b1adb);}return util[_0x7b7e('0x73')](_0x7b7e('0x80'),_0x3b1adb,_0x3b1adb);}if(!_[_0x7b7e('0x3b')](_0x369103)&&'string'===typeof _0x369103&&!_[_0x7b7e('0x45')](_0x369103)){return _0x369103;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x53e2f7,_0x2b105a){return function(_0x7cbe6c){freeVariablesPredictive(_0x2b105a);emitVoiceQueueSummary(_0x2b105a);emitCampaignSummary(_0x2b105a);loggerSyncQueueSummary[_0x7b7e('0x81')](_0x53e2f7,util[_0x7b7e('0x82')](_0x7cbe6c,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x5cd4ae,_0x275998){return function(_0x45e714){loggerPredictive[_0x7b7e('0x81')](_0x5cd4ae,JSON[_0x7b7e('0x49')](_0x45e714));freeVariablesPredictive(_0x275998);};}function loggerCatch(_0x169540){return function(_0x2b2afd){logger['error'](_0x169540,util[_0x7b7e('0x82')](_0x2b2afd,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x52b070){return _0x52b070&&!_['isUndefined'](_0x52b070)&&_0x52b070[_0x7b7e('0x83')]>0x0;}function decremetOriginate(_0x4ef741){if(!_[_0x7b7e('0x3b')](_0x4ef741)&&_0x4ef741!==null){if(_0x4ef741['hasOwnProperty'](_0x7b7e('0x6f'))){if(_0x4ef741[_0x7b7e('0x6f')]>0x0){_0x4ef741['originated']-=0x1;}else{logger[_0x7b7e('0x81')](_0x7b7e('0x84'));}}}else{logger['error'](_0x7b7e('0x85'));}}function checkContactLowerLimitOriginate(_0x27a552,_0x50184c,_0x430033){if(_0x50184c>_0x430033){for(var _0x36ea09=0x0;_0x36ea09<_0x50184c-_0x430033;_0x36ea09+=0x1){decremetOriginate(_0x27a552);}}}function loggerGetContactDialer(_0x2147d9,_0x8e9813,_0x3f8f8f){return function(_0x457365){checkContactLowerLimitOriginate(_0x8e9813,_0x3f8f8f,0x0);logger[_0x7b7e('0x81')](_0x2147d9,util['inspect'](_0x457365,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x59ecf9){return function(_0x34e7df){if(isNotNull(_0x34e7df)&&isNotNull(_0x34e7df[0x0])){if(_0x34e7df[0x0][_0x7b7e('0x86')]>0x0){_0x59ecf9[_0x7b7e('0x3c')]=_0x7b7e('0x87');logger[_0x7b7e('0x78')](_0x7b7e('0x88')+_0x59ecf9[_0x7b7e('0x3e')],_0x34e7df[0x0]['contactsRescheduled'],_0x7b7e('0x89'));}else{_0x59ecf9[_0x7b7e('0x3c')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x7b7e('0x78')](_0x7b7e('0x8a')+_0x59ecf9[_0x7b7e('0x3e')]);}}};}function notSendMessagesQueue(_0x271318){if(_0x271318[_0x7b7e('0x8b')]){freeVariablesPredictive(_0x271318);if(_0x271318[_0x7b7e('0x6f')]===0x0&&_0x271318[_0x7b7e('0x54')]===0x0&&_0x271318[_0x7b7e('0x58')]===0x0&&(_0x271318[_0x7b7e('0x8c')]||0x0)===0x0){_0x271318[_0x7b7e('0x8b')]=![];_0x271318[_0x7b7e('0x51')]=0x0;_0x271318['message']=_0x7b7e('0x40');loggerSyncQueueSummary[_0x7b7e('0x81')](_0x7b7e('0x8d'),_0x271318[_0x7b7e('0x3e')],_0x7b7e('0x8e'));}else{_0x271318[_0x7b7e('0x3c')]=_0x7b7e('0x8f');loggerSyncQueueSummary['error'](_0x7b7e('0x8d'),_0x271318[_0x7b7e('0x3e')],_0x7b7e('0x90'));}emitVoiceQueueSummary(_0x271318);}}function notSendMessagesCampaign(_0x49f0a4){if(_0x49f0a4[_0x7b7e('0x8b')]){if(_0x49f0a4[_0x7b7e('0x6f')]===0x0){_0x49f0a4[_0x7b7e('0x8b')]=![];_0x49f0a4[_0x7b7e('0x3c')]=_0x7b7e('0x40');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x49f0a4['name'],_0x7b7e('0x8e'));}else{_0x49f0a4[_0x7b7e('0x3c')]=_0x7b7e('0x8f');loggerSyncQueueSummary['error'](_0x7b7e('0x91'),_0x49f0a4[_0x7b7e('0x3e')],_0x7b7e('0x90'));}emitCampaignSummary(_0x49f0a4);}}function createObjHistory(_0x5bf4d1,_0x2983bf,_0x2b27ef,_0x111c99,_0x34a06c){_0x5bf4d1['message']=_0x2b27ef;var _0x315923=new Action(_0x5bf4d1,_0x2983bf);var _0x40b4ae=new History(_0x315923);_0x40b4ae[_0x7b7e('0x92')]=_0x111c99;_0x40b4ae[_0x7b7e('0x93')]=_0x34a06c;_0x40b4ae['endtime']=_0x315923['starttime'];return _0x40b4ae;}Dialer[_0x7b7e('0x1a')]['loopClearZombieChannels']=function(){var _0x1ecb55=this;setInterval(function(){_0x1ecb55[_0x7b7e('0x94')](_0x1ecb55[_0x7b7e('0x95')],_0x7b7e('0x96'));_0x1ecb55['clearZombieChannels'](_0x1ecb55[_0x7b7e('0x25')],_0x7b7e('0x97'));},0x32c8);};Dialer[_0x7b7e('0x1a')][_0x7b7e('0x94')]=function(_0x374312,_0x443cfc){var _0x2d40f4=this;for(var _0x372478 in _0x374312){if(_0x374312[_0x7b7e('0x98')](_0x372478)){this[_0x7b7e('0x1d')][_0x7b7e('0x1b')](function(){if(!_[_0x7b7e('0x99')](_0x374312[_0x372478])){return ami[_0x7b7e('0x9a')]({'action':_0x7b7e('0x9b'),'channel':_0x374312[_0x372478][_0x7b7e('0x9c')]})[_0x7b7e('0x9d')](function(_0x57d925){if(_0x57d925[_0x7b7e('0x3c')]===_0x7b7e('0x9e')){setTimeout(function(){if(_0x374312[_0x372478]&&_0x374312[_0x372478][_0x7b7e('0x4e')]!==_0x7b7e('0x76')){_0x2d40f4[_0x7b7e('0x9f')](_0x2d40f4[_0x7b7e('0x1f')][_0x374312[_0x372478][_0x7b7e('0xa0')]]);logger['error'](_0x7b7e('0xa1'),_0x443cfc,_0x372478,_0x374312[_0x372478][_0x7b7e('0xa0')]);delete _0x374312[_0x372478];}if(_0x374312[_0x372478]&&_0x374312[_0x372478][_0x7b7e('0x4e')]===_0x7b7e('0x76')){_0x2d40f4[_0x7b7e('0x9f')](_0x2d40f4['campaigns'][_0x374312[_0x372478]['queue']]);logger[_0x7b7e('0x81')](_0x7b7e('0xa2'),_0x443cfc,_0x372478,_0x374312[_0x372478][_0x7b7e('0xa0')]);delete _0x374312[_0x372478];}},0x2328);}});}});}}};Dialer[_0x7b7e('0x1a')][_0x7b7e('0xa3')]=function(_0x332ded){return BPromise[_0x7b7e('0xa4')]()[_0x7b7e('0xa5')](cmHopper[_0x7b7e('0xa3')](_0x332ded))[_0x7b7e('0x9d')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x7b7e('0x1a')][_0x7b7e('0xa6')]=function(_0x24c201){return BPromise[_0x7b7e('0xa4')]()[_0x7b7e('0xa5')](cmHopperBlack[_0x7b7e('0xa6')](_0x24c201))[_0x7b7e('0x9d')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x7b7e('0x1a')]['checkIsBlackListIvr']=function(_0x14b252){return BPromise[_0x7b7e('0xa4')]()['then'](cmHopperBlack[_0x7b7e('0xa7')](_0x14b252))[_0x7b7e('0x9d')](loggerCatch(_0x7b7e('0xa8')));};Dialer[_0x7b7e('0x1a')][_0x7b7e('0xa9')]=function(_0x515290){return BPromise[_0x7b7e('0xa4')]()['then'](cmHopperHistory['avgHandleTime'](_0x515290))[_0x7b7e('0x9d')](loggerCatch(_0x7b7e('0xaa')));};Dialer[_0x7b7e('0x1a')][_0x7b7e('0xab')]=function(_0x4bb87b){return BPromise[_0x7b7e('0xa4')]()['then'](cmHopper[_0x7b7e('0xab')](_0x4bb87b))[_0x7b7e('0x9d')](loggerCatch(_0x7b7e('0xac')));};Dialer[_0x7b7e('0x1a')][_0x7b7e('0xad')]=function(_0x3afd15,_0xc48937,_0x57c8d1,_0x4c1efb){return BPromise[_0x7b7e('0xa4')]()['then'](cmHopper[_0x7b7e('0xad')](_0x3afd15,_0xc48937,_0x57c8d1,_0x4c1efb))[_0x7b7e('0x9d')](loggerCatch(_0x7b7e('0xae')));};Dialer[_0x7b7e('0x1a')][_0x7b7e('0xaf')]=function(_0x728fbe,_0xa304f1,_0x15bbf5){return BPromise[_0x7b7e('0xa4')]()[_0x7b7e('0xa5')](cmHopper[_0x7b7e('0xaf')](_0x728fbe,_0xa304f1,_0x15bbf5))[_0x7b7e('0x9d')](loggerCatch(_0x7b7e('0xae')));};Dialer[_0x7b7e('0x1a')][_0x7b7e('0xb0')]=function(_0x1e2f9f){return BPromise[_0x7b7e('0xa4')]()[_0x7b7e('0xa5')](voiceQueueRt[_0x7b7e('0xb0')](_0x1e2f9f))[_0x7b7e('0x9d')](loggerCatch(_0x7b7e('0xb1')));};Dialer[_0x7b7e('0x1a')]['moveContactManagedDialer']=function(_0x2691c4){return BPromise[_0x7b7e('0xa4')]()['then'](cmHopper[_0x7b7e('0xb2')](_0x2691c4))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x7b7e('0x1a')]['createHistory']=function(_0x4d91c6){return BPromise[_0x7b7e('0xa4')]()[_0x7b7e('0xa5')](cmHopperHistory[_0x7b7e('0xb3')](_0x4d91c6))['catch'](loggerCatch(_0x7b7e('0xb4')));};Dialer[_0x7b7e('0x1a')][_0x7b7e('0x9f')]=function(_0x3b92e0){if(!_[_0x7b7e('0x3b')](_0x3b92e0)&&_0x3b92e0!==null){if(_0x3b92e0[_0x7b7e('0x98')](_0x7b7e('0x6f'))){if(_0x3b92e0[_0x7b7e('0x6f')]>0x0){_0x3b92e0[_0x7b7e('0x6f')]-=0x1;}else{logger['error'](_0x7b7e('0xb5'));}}}else{logger[_0x7b7e('0x81')](_0x7b7e('0xb6'));}};Dialer['prototype'][_0x7b7e('0xb7')]=function(_0x440070,_0x5d8068){var _0x3d2ae8=this;return function(_0x50e4b1){_0x3d2ae8['updateOriginated'](_0x5d8068);logger[_0x7b7e('0x81')](_0x440070,util[_0x7b7e('0x82')](_0x50e4b1,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x7b7e('0xb8')]=function(_0x5ab8a7,_0x4c7158,_0x5c0d1c){var _0x10682b={'state':0x19,'statedesc':_0x7b7e('0xb9')};this[_0x7b7e('0x9f')](_0x4c7158);this[_0x7b7e('0xba')](_[_0x7b7e('0xbb')](_0x10682b,_[_0x7b7e('0xbc')](_0x5c0d1c,[_0x7b7e('0xbd'),'ListId',_0x7b7e('0xbe'),_0x7b7e('0xbf'),_0x7b7e('0xc0')])),_0x7b7e('0xc1'),_0x7b7e('0xc2'));logger[_0x7b7e('0x81')](_0x5ab8a7);};Dialer[_0x7b7e('0x1a')][_0x7b7e('0xc3')]=function(_0x18a52b){return _0x18a52b===_0x7b7e('0xc4');};Dialer[_0x7b7e('0x1a')][_0x7b7e('0xc5')]=function(_0x4dfb0c){return!_['isUndefined'](_0x4dfb0c)&&_0x4dfb0c&&!_[_0x7b7e('0x3b')](_0x4dfb0c[_0x7b7e('0x3e')])&&!_[_0x7b7e('0x3b')](_0x4dfb0c[_0x7b7e('0xc6')])&&_0x4dfb0c[_0x7b7e('0xc6')]&&(this[_0x7b7e('0x22')][util[_0x7b7e('0x73')](_0x7b7e('0xc7'),_0x4dfb0c[_0x7b7e('0x3e')])][_0x7b7e('0x9b')]===_0x7b7e('0xc8')||this[_0x7b7e('0x22')][util['format'](_0x7b7e('0xc7'),_0x4dfb0c['name'])][_0x7b7e('0x9b')]===_0x7b7e('0xc9'));};Dialer[_0x7b7e('0x1a')]['saveInDb']=function(_0x592692,_0x4e7889,_0x110ad6){this[_0x7b7e('0xb3')](_0x592692)[_0x7b7e('0x9d')](loggerCatch(_0x4e7889));this[_0x7b7e('0xb2')](_0x592692)[_0x7b7e('0x9d')](loggerCatch(_0x110ad6));};Dialer[_0x7b7e('0x1a')][_0x7b7e('0x38')]=function(_0x37fa8d){var _0x18846e=this[_0x7b7e('0x95')][_0x37fa8d[_0x7b7e('0xca')]];var _0x5194bd;if(!_[_0x7b7e('0x99')](_0x37fa8d)&&!_[_0x7b7e('0x99')](_0x37fa8d[_0x7b7e('0xcb')])&&!_[_0x7b7e('0x99')](_0x37fa8d['variable'][_0x7b7e('0xcc')])&&_0x37fa8d[_0x7b7e('0xcd')]===_0x7b7e('0xce')&&_0x18846e){if(_0x18846e[_0x7b7e('0x4e')]!==_0x7b7e('0x76')&&this[_0x7b7e('0x1f')][_0x18846e[_0x7b7e('0xa0')]][_0x7b7e('0xcf')]&&_0x37fa8d[_0x7b7e('0xd0')]===_0x7b7e('0xd1')){delete this[_0x7b7e('0x95')][_0x37fa8d[_0x7b7e('0xca')]];this[_0x7b7e('0x9f')](this[_0x7b7e('0x1f')][_0x18846e[_0x7b7e('0xa0')]]);this[_0x7b7e('0x1f')][_0x18846e[_0x7b7e('0xa0')]][_0x7b7e('0x5f')]+=0x1;this[_0x7b7e('0x1f')][_0x18846e[_0x7b7e('0xa0')]][_0x7b7e('0xd2')]+=0x1;_0x5194bd=new Hangup(_0x18846e,_0x37fa8d);_0x5194bd[_0x7b7e('0x92')]=0x12;_0x5194bd[_0x7b7e('0x93')]=_0x7b7e('0xd3');_0x5194bd[_0x7b7e('0xd4')]=_0x7b7e('0xd5');this[_0x7b7e('0xba')](_0x5194bd,_0x7b7e('0xd6'),'[syncHangupInAMD]');}if(_0x18846e[_0x7b7e('0x4e')]!=='ivr'&&this['voiceQueues'][_0x18846e['queue']][_0x7b7e('0xcf')]&&_0x37fa8d[_0x7b7e('0xd0')]==='MACHINE'){delete this['uniqueId'][_0x37fa8d[_0x7b7e('0xca')]];this[_0x7b7e('0x9f')](this[_0x7b7e('0x1f')][_0x18846e['queue']]);this[_0x7b7e('0x1f')][_0x18846e['queue']]['outboundAnswerCallsDay']+=0x1;this[_0x7b7e('0x1f')][_0x18846e['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x5194bd=new Hangup(_0x18846e,_0x37fa8d);_0x5194bd[_0x7b7e('0x92')]=0x13;_0x5194bd[_0x7b7e('0x93')]=_0x7b7e('0xd7');_0x5194bd['membername']='AMD';_0x5194bd[_0x7b7e('0xd8')]=!![];this[_0x7b7e('0xba')](_0x5194bd,_0x7b7e('0xd9'),_0x7b7e('0xda'));}if(_0x18846e[_0x7b7e('0x4e')]===_0x7b7e('0x76')&&this[_0x7b7e('0x20')][_0x18846e[_0x7b7e('0xa0')]][_0x7b7e('0xcf')]&&_0x37fa8d['value']===_0x7b7e('0xd1')){delete this['uniqueId'][_0x37fa8d[_0x7b7e('0xca')]];this[_0x7b7e('0x9f')](this[_0x7b7e('0x20')][_0x18846e[_0x7b7e('0xa0')]]);_0x5194bd=new Hangup(_0x18846e,_0x37fa8d);_0x5194bd[_0x7b7e('0x92')]=0x12;_0x5194bd['statedesc']=_0x7b7e('0xd3');_0x5194bd[_0x7b7e('0xd4')]=_0x7b7e('0xd5');this[_0x7b7e('0xba')](_0x5194bd,'[syncHangupInAMDIvr][createHistory]',_0x7b7e('0xdb'));}if(_0x18846e[_0x7b7e('0x4e')]==='ivr'&&this[_0x7b7e('0x20')][_0x18846e[_0x7b7e('0xa0')]][_0x7b7e('0xcf')]&&_0x37fa8d[_0x7b7e('0xd0')]===_0x7b7e('0xdc')){delete this[_0x7b7e('0x95')][_0x37fa8d[_0x7b7e('0xca')]];this[_0x7b7e('0x9f')](this[_0x7b7e('0x20')][_0x18846e[_0x7b7e('0xa0')]]);_0x5194bd=new Hangup(_0x18846e,_0x37fa8d);_0x5194bd[_0x7b7e('0x92')]=0x13;_0x5194bd['statedesc']=_0x7b7e('0xd7');_0x5194bd[_0x7b7e('0xd4')]='AMD';_0x5194bd[_0x7b7e('0xd8')]=!![];this['saveInDb'](_0x5194bd,_0x7b7e('0xdd'),_0x7b7e('0xde'));}}};Dialer[_0x7b7e('0x1a')]['syncHangup']=function(_0x8f0731){var _0x444e16=this[_0x7b7e('0x95')][_0x8f0731[_0x7b7e('0xca')]];var _0xeeaf19=this;var _0x27785c;if(_0x444e16&&_0x444e16[_0x7b7e('0x4e')]===_0x7b7e('0x76')){delete this[_0x7b7e('0x95')][_0x8f0731[_0x7b7e('0xca')]];this['updateOriginated'](this[_0x7b7e('0x20')][_0x444e16[_0x7b7e('0xa0')]]);this[_0x7b7e('0x20')][_0x444e16['queue']]['ivrAnswerCallsDay']+=0x1;_0x27785c=new Hangup(_0x444e16,_0x8f0731);this[_0x7b7e('0xb3')](_0x27785c)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x7b7e('0xb2')](_0x27785c)[_0x7b7e('0x9d')](loggerCatch(_0x7b7e('0xdf')));}if(_0x444e16&&_0x444e16['type']!==_0x7b7e('0x76')&&isNotNull(this[_0x7b7e('0x1f')][_0x444e16[_0x7b7e('0xa0')]][_0x7b7e('0xe0')])){delete this[_0x7b7e('0x95')][_0x8f0731['uniqueid']];this[_0x7b7e('0x9f')](this[_0x7b7e('0x1f')][_0x444e16[_0x7b7e('0xa0')]]);this[_0x7b7e('0x1f')][_0x444e16[_0x7b7e('0xa0')]][_0x7b7e('0x5f')]+=0x1;this['voiceQueues'][_0x444e16['queue']][_0x7b7e('0xd2')]+=0x1;_0x27785c=new Hangup(_0x444e16,_0x8f0731);_0x27785c['state']=0x10;_0x27785c[_0x7b7e('0x93')]=_0x7b7e('0xe1');_0x27785c[_0x7b7e('0xd4')]=_0x7b7e('0xe2');this[_0x7b7e('0xb3')](_0x27785c)[_0x7b7e('0x9d')](loggerCatch(_0x7b7e('0xe3')));this['moveContactManagedDialer'](_0x27785c)['catch'](loggerCatch(_0x7b7e('0xdf')));}if(_0x444e16&&_0x444e16[_0x7b7e('0x4e')]!=='ivr'&&!isNotNull(this[_0x7b7e('0x1f')][_0x444e16[_0x7b7e('0xa0')]]['dialQueueProject'])){delete this['uniqueId'][_0x8f0731[_0x7b7e('0xca')]];this[_0x7b7e('0x9f')](this[_0x7b7e('0x1f')][_0x444e16['queue']]);this[_0x7b7e('0x1f')][_0x444e16[_0x7b7e('0xa0')]][_0x7b7e('0x66')]+=0x1;_0x27785c=new Hangup(_0x444e16,_0x8f0731);_0x27785c[_0x7b7e('0x92')]=0xc;_0x27785c[_0x7b7e('0x93')]=_0x8f0731[_0x7b7e('0xe4')];_0x27785c[_0x7b7e('0xd4')]=_0x7b7e('0xe5');this[_0x7b7e('0xb3')](_0x27785c)[_0x7b7e('0x9d')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x27785c)['catch'](loggerCatch(_0x7b7e('0xdf')));}};Dialer['prototype'][_0x7b7e('0x32')]=function(_0x662874){var _0x1e7d0a=this['uniqueId'][_0x662874[_0x7b7e('0xca')]];var _0xdaa08c=this;if(this[_0x7b7e('0x1f')][_0x662874[_0x7b7e('0xa0')]]){if(_0x1e7d0a&&_0x1e7d0a[_0x7b7e('0x4e')]!==_0x7b7e('0x76')){delete this[_0x7b7e('0x95')][_0x662874['uniqueid']];this['voiceQueues'][_0x662874['queue']][_0x7b7e('0x5f')]+=0x1;var _0x3a980d=new AgentComplete(_0x1e7d0a,_0x662874);if(_0x662874[_0x7b7e('0xe6')]===_0x7b7e('0xe7')){_0x3a980d[_0x7b7e('0xe8')]=this[_0x7b7e('0x1f')][_0x662874[_0x7b7e('0xa0')]][_0x7b7e('0xe9')]&&this[_0x7b7e('0x1f')][_0x662874['queue']][_0x7b7e('0xea')]?moment()[_0x7b7e('0x73')](_0x7b7e('0xeb')):undefined;}this['createHistory'](_0x3a980d)[_0x7b7e('0x9d')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x7b7e('0xb2')](_0x3a980d)[_0x7b7e('0x9d')](loggerCatch(_0x7b7e('0xec')));}}};Dialer[_0x7b7e('0x1a')]['syncAgentConnect']=function(_0x40b101){if(this[_0x7b7e('0x1f')][_0x40b101[_0x7b7e('0xa0')]]){if(this[_0x7b7e('0x95')][_0x40b101[_0x7b7e('0xca')]]&&this['uniqueId'][_0x40b101[_0x7b7e('0xca')]][_0x7b7e('0x4e')]!==_0x7b7e('0x76')){this[_0x7b7e('0x9f')](this[_0x7b7e('0x1f')][_0x40b101[_0x7b7e('0xa0')]]);this[_0x7b7e('0x95')][_0x40b101[_0x7b7e('0xca')]]['answertime']=moment()[_0x7b7e('0x73')](_0x7b7e('0xeb'));}}};Dialer[_0x7b7e('0x1a')][_0x7b7e('0xed')]=function(_0x4577c7){this['createHistory'](_0x4577c7)[_0x7b7e('0x9d')](loggerCatch(_0x7b7e('0xee')));this[_0x7b7e('0xb2')](_0x4577c7)[_0x7b7e('0x9d')](loggerCatch(_0x7b7e('0xef')));};Dialer[_0x7b7e('0x1a')][_0x7b7e('0x30')]=function(_0x10795a){var _0x3cfe88=this[_0x7b7e('0x95')][_0x10795a['uniqueid']];var _0x44d724=this;if(this['voiceQueues'][_0x10795a[_0x7b7e('0xa0')]]){if(_0x3cfe88&&_0x3cfe88[_0x7b7e('0x4e')]!==_0x7b7e('0x76')){delete this[_0x7b7e('0x95')][_0x10795a[_0x7b7e('0xca')]];this[_0x7b7e('0x9f')](this[_0x7b7e('0x1f')][_0x10795a[_0x7b7e('0xa0')]]);_0x3cfe88[_0x7b7e('0xf0')]=moment()[_0x7b7e('0x73')](_0x7b7e('0xeb'));var _0x1c57ff=new QueueCallerAbandon(_0x3cfe88,_0x10795a);if(getSeconds(_0x3cfe88[_0x7b7e('0xf0')],_0x3cfe88['responsetime'])>=_0x3cfe88['dialQueueTimeout']){this[_0x7b7e('0x1f')][_0x10795a['queue']][_0x7b7e('0x6a')]+=0x1;this[_0x7b7e('0x1f')][_0x10795a[_0x7b7e('0xa0')]][_0x7b7e('0xf1')]+=0x1;this[_0x7b7e('0x1f')][_0x10795a['queue']][_0x7b7e('0x6c')]+=0x1;_0x1c57ff['state']=0xa;_0x1c57ff['statedesc']='Drop';_0x1c57ff[_0x7b7e('0xf2')]=_0x7b7e('0xf3');_0x1c57ff[_0x7b7e('0xe8')]=this[_0x7b7e('0x1f')][_0x10795a[_0x7b7e('0xa0')]][_0x7b7e('0xe9')]?moment()[_0x7b7e('0x73')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;this[_0x7b7e('0xed')](_0x1c57ff);}else{this[_0x7b7e('0x1f')][_0x10795a[_0x7b7e('0xa0')]][_0x7b7e('0x69')]+=0x1;this[_0x7b7e('0x1f')][_0x10795a[_0x7b7e('0xa0')]][_0x7b7e('0x61')]+=0x1;_0x1c57ff[_0x7b7e('0x92')]=0xb;_0x1c57ff[_0x7b7e('0x93')]=_0x7b7e('0xf4');_0x1c57ff[_0x7b7e('0xf2')]=_0x7b7e('0xf5');this[_0x7b7e('0xed')](_0x1c57ff);}}}};Dialer[_0x7b7e('0x1a')]['syncNewExten']=function(_0x5ef163){if(this[_0x7b7e('0x25')][_0x5ef163[_0x7b7e('0xca')]]){this[_0x7b7e('0x25')][_0x5ef163['uniqueid']][_0x7b7e('0x9c')]=_0x5ef163[_0x7b7e('0x9c')];}if(this[_0x7b7e('0x95')][_0x5ef163[_0x7b7e('0xca')]]){this[_0x7b7e('0x95')][_0x5ef163['uniqueid']]['channel']=_0x5ef163['channel'];}};Dialer[_0x7b7e('0x1a')][_0x7b7e('0xf6')]=function(_0x3a5b34){if(strategy[this[_0x7b7e('0x1f')][this[_0x7b7e('0x25')][_0x3a5b34['actionid']][_0x7b7e('0xa0')]]['strategy']]===_0x7b7e('0xf7')){if(this['actions'][_0x3a5b34['actionid']]&&_['isNil'](this[_0x7b7e('0x25')][_0x3a5b34[_0x7b7e('0xf8')]]['locked'])&&_0x3a5b34[_0x7b7e('0x9b')]==='1'&&_0x3a5b34[_0x7b7e('0xf9')]==='0'){if(this[_0x7b7e('0x21')][_0x3a5b34[_0x7b7e('0xfa')]]){if(!this['agents'][_0x3a5b34[_0x7b7e('0xfa')]][_0x7b7e('0xfb')]){this['agents'][_0x3a5b34[_0x7b7e('0xfa')]][_0x7b7e('0xfb')]=!![];this[_0x7b7e('0x25')][_0x3a5b34[_0x7b7e('0xf8')]]['locked']=!![];this[_0x7b7e('0x25')][_0x3a5b34[_0x7b7e('0xf8')]]['stateinterface']=_0x3a5b34[_0x7b7e('0xfa')];}}}}else if((strategy[this[_0x7b7e('0x1f')][this[_0x7b7e('0x25')][_0x3a5b34[_0x7b7e('0xf8')]][_0x7b7e('0xa0')]][_0x7b7e('0xfc')]]||'rrmemory')===_0x7b7e('0xfd')){if(this['actions'][_0x3a5b34[_0x7b7e('0xf8')]]){if(this['agents'][_0x3a5b34[_0x7b7e('0xfa')]]){this[_0x7b7e('0x25')][_0x3a5b34['actionid']]['stateinterface']=_0x3a5b34['stateinterface'];if(_[_0x7b7e('0x99')](this[_0x7b7e('0x2a')][this[_0x7b7e('0x25')][_0x3a5b34[_0x7b7e('0xf8')]][_0x7b7e('0xa0')]])){this[_0x7b7e('0x2a')][this['actions'][_0x3a5b34[_0x7b7e('0xf8')]][_0x7b7e('0xa0')]]=[];}this[_0x7b7e('0x2a')][this['actions'][_0x3a5b34[_0x7b7e('0xf8')]][_0x7b7e('0xa0')]][_0x7b7e('0xfe')](_[_0x7b7e('0xbb')](_[_0x7b7e('0xbc')](this[_0x7b7e('0x25')][_0x3a5b34[_0x7b7e('0xf8')]],[_0x7b7e('0xff'),_0x7b7e('0xfa')]),{'status':_0x3a5b34[_0x7b7e('0x9b')],'paused':_0x3a5b34[_0x7b7e('0xf9')]}));}}}};function unlockQueueStatus(_0x93e2b6,_0x597867){setTimeout(function(){if(_[_0x7b7e('0x3b')](_0x93e2b6['queueStatusComplete'])){loggerBooked[_0x7b7e('0x81')]('[unlockQueueStatus][undefined]',_0x597867);}_0x93e2b6[_0x7b7e('0x100')]=!![];loggerBooked[_0x7b7e('0x78')]('[booked][unlockQueueStatus]',_0x597867,JSON[_0x7b7e('0x49')](_['pick'](_0x93e2b6,[_0x7b7e('0x3e'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x7b7e('0x1a')]['syncQueueStatusComplete']=function(_0x2c8493){var _0x3442dd=this;var _0x3c62ad=_0x3442dd[_0x7b7e('0x1f')][_0x3442dd[_0x7b7e('0x25')][_0x2c8493[_0x7b7e('0xf8')]][_0x7b7e('0xa0')]];if(strategy[this[_0x7b7e('0x1f')][this[_0x7b7e('0x25')][_0x2c8493[_0x7b7e('0xf8')]][_0x7b7e('0xa0')]]['strategy']]==='roundrobin'){if(this['actions'][_0x2c8493['actionid']]&&this['actions'][_0x2c8493[_0x7b7e('0xf8')]][_0x7b7e('0xfa')]){this[_0x7b7e('0x1e')][_0x7b7e('0x101')](this[_0x7b7e('0x25')][_0x2c8493['actionid']]['idHopper'],this[_0x7b7e('0x25')][_0x2c8493['actionid']][_0x7b7e('0xfa')])[_0x7b7e('0x9d')](function(_0x124ed1){logger[_0x7b7e('0x81')](_0x7b7e('0x102'),util[_0x7b7e('0x82')](_0x124ed1,{'showHidden':![],'depth':null}));})[_0x7b7e('0x103')](function(){_0x3442dd[_0x7b7e('0x9f')](_0x3442dd['voiceQueues'][_0x3442dd[_0x7b7e('0x25')][_0x2c8493['actionid']]['queue']]);_0x3442dd[_0x7b7e('0x21')][_0x3442dd[_0x7b7e('0x25')][_0x2c8493[_0x7b7e('0xf8')]][_0x7b7e('0xfa')]][_0x7b7e('0xfb')]=![];delete _0x3442dd[_0x7b7e('0x25')][_0x2c8493[_0x7b7e('0xf8')]];unlockQueueStatus(_0x3c62ad);});}else{this[_0x7b7e('0x9f')](this[_0x7b7e('0x1f')][this[_0x7b7e('0x25')][_0x2c8493[_0x7b7e('0xf8')]][_0x7b7e('0xa0')]]);this[_0x7b7e('0xab')]({'active':![],'ContactId':this['actions'][_0x2c8493[_0x7b7e('0xf8')]][_0x7b7e('0xbd')],'ListId':this[_0x7b7e('0x25')][_0x2c8493[_0x7b7e('0xf8')]][_0x7b7e('0x104')],'VoiceQueueId':this[_0x7b7e('0x25')][_0x2c8493[_0x7b7e('0xf8')]][_0x7b7e('0xbf')]||undefined,'CampaignId':this[_0x7b7e('0x25')][_0x2c8493['actionid']][_0x7b7e('0xc0')]||undefined})[_0x7b7e('0x9d')](loggerCatch(_0x7b7e('0x105')));delete this[_0x7b7e('0x25')][_0x2c8493[_0x7b7e('0xf8')]];unlockQueueStatus(_0x3c62ad);}}else if((strategy[this['voiceQueues'][this[_0x7b7e('0x25')][_0x2c8493[_0x7b7e('0xf8')]][_0x7b7e('0xa0')]]['strategy']]||_0x7b7e('0xfd'))===_0x7b7e('0xfd')){var _0x54f04b;if(this['actions'][_0x2c8493[_0x7b7e('0xf8')]]&&!_[_0x7b7e('0x45')](this['queueBooked'][this[_0x7b7e('0x25')][_0x2c8493[_0x7b7e('0xf8')]][_0x7b7e('0xa0')]])){if(this[_0x7b7e('0x2b')][_0x3442dd[_0x7b7e('0x25')][_0x2c8493['actionid']]['queue']]){this[_0x7b7e('0x2b')][_0x3442dd['actions'][_0x2c8493[_0x7b7e('0xf8')]]['queue']]=this[_0x7b7e('0x2b')][this['actions'][_0x2c8493[_0x7b7e('0xf8')]]['queue']]?this['queueBookedRR'][this[_0x7b7e('0x25')][_0x2c8493['actionid']]['queue']]:this[_0x7b7e('0x2a')][this[_0x7b7e('0x25')][_0x2c8493['actionid']][_0x7b7e('0xa0')]]?this[_0x7b7e('0x2a')][this[_0x7b7e('0x25')][_0x2c8493[_0x7b7e('0xf8')]][_0x7b7e('0xa0')]][_0x7b7e('0x106')]||0x0:0x0;}this[_0x7b7e('0x2a')][this[_0x7b7e('0x25')][_0x2c8493['actionid']]['queue']][_0x7b7e('0x106')]=this[_0x7b7e('0x2b')][this[_0x7b7e('0x25')][_0x2c8493[_0x7b7e('0xf8')]][_0x7b7e('0xa0')]];for(var _0x5afbe8=0x0;_0x5afbe8=0x0?!![]:![];})['catch'](myreject(_0x644994)));}}else{_0x58ab3e['push'](ami[_0x7b7e('0x9a')]({'action':_0x7b7e('0x121'),'command':util[_0x7b7e('0x73')](_0x7b7e('0x11c'),_0x2f2a5a,!_[_0x7b7e('0x3b')](config[_0x7b7e('0x119')][_0x1e29b8])?_0x1e29b8:'')})[_0x7b7e('0xa5')](function(_0x1a0eb6){return _0x1a0eb6[_0x7b7e('0x11e')][_0x7b7e('0x11f')](_0x7b7e('0x120'))>=0x0?!![]:![];})[_0x7b7e('0x9d')](myreject(_0x644994)));}BPromise[_0x7b7e('0x122')](_0x58ab3e)[_0x7b7e('0xa5')](function(_0x2eb712){var _0x3167db=_['some'](_0x2eb712);if(_0x3167db){return _0x41b340(_0x3167db);}else{_0x39d655[_0x7b7e('0x3c')]=_0x51cc3a?'GLOBAL_INTERVAL_IS_OVERTIME':_0x7b7e('0x123');return _0x644994(msgResponse(_0x7b7e('0x124'),_0x7b7e('0x116'),_0x7b7e('0x125')+_0x51cc3a+'\x20'+_0x7292bf+'\x20Interval\x20is\x20overtime:\x20'+util[_0x7b7e('0x82')](_0x2f2a5a,{'showHidden':![],'depth':null})+_0x7b7e('0x126')+_0x1e29b8));}})[_0x7b7e('0x9d')](function(_0x38fcb0){return _0x644994(msgResponse(_0x7b7e('0x115'),_0x7b7e('0x116'),JSON[_0x7b7e('0x49')](_0x38fcb0)));});});};Dialer[_0x7b7e('0x1a')][_0x7b7e('0x127')]=function(_0x193ce1){var _0x1d8cb4=this;return function(){switch(_0x193ce1[_0x7b7e('0x5b')]){case _0x7b7e('0x128'):freeVariablesPredictive(_0x193ce1);_0x1d8cb4[_0x7b7e('0x129')](_0x193ce1,0x1);break;case'power':freeVariablesPredictive(_0x193ce1);_0x1d8cb4[_0x7b7e('0x129')](_0x193ce1,_0x193ce1[_0x7b7e('0x12a')]);break;case _0x7b7e('0x6'):_0x1d8cb4['predictive'](_0x193ce1);break;case _0x7b7e('0x12b'):freeVariablesPredictive(_0x193ce1);_0x1d8cb4[_0x7b7e('0x129')](_0x193ce1,0x1);break;default:freeVariablesPredictive(_0x193ce1);logger['error'](_0x7b7e('0x12c'),_0x193ce1[_0x7b7e('0x3e')],_0x7b7e('0x12d'));}};};Dialer[_0x7b7e('0x1a')][_0x7b7e('0x12e')]=function(_0x4ca283){var _0x320437=this;return function(){_0x320437[_0x7b7e('0x12f')](_0x4ca283);};};Dialer[_0x7b7e('0x1a')][_0x7b7e('0x8')]=function(_0x1da40b){var _0x377613=this;if(isNotPreview(_0x1da40b[_0x7b7e('0x5b')])){if(isVoiceQueueOutbound(_0x1da40b[_0x7b7e('0x4e')])&&isActive(_0x1da40b[_0x7b7e('0x5a')])){_0x1da40b[_0x7b7e('0x8b')]=!![];BPromise[_0x7b7e('0xa4')]()[_0x7b7e('0xa5')](checkIsLoggedIn(_0x1da40b,_0x1da40b[_0x7b7e('0x52')]))[_0x7b7e('0xa5')](checkIsActive(_0x1da40b,_0x1da40b[_0x7b7e('0x5a')]))[_0x7b7e('0xa5')](checkInterval(_0x1da40b))[_0x7b7e('0xa5')](_0x377613['checkIsTrunkReachable'](_0x1da40b))[_0x7b7e('0xa5')](_0x377613[_0x7b7e('0x114')](_0x1da40b[_0x7b7e('0x130')],_0x1da40b[_0x7b7e('0x131')],_0x1da40b[_0x7b7e('0x3e')],_0x1da40b))[_0x7b7e('0xa5')](_0x377613[_0x7b7e('0x132')](_0x1da40b[_0x7b7e('0x42')],_0x1da40b[_0x7b7e('0x131')],_0x1da40b[_0x7b7e('0x3e')],_0x1da40b))['then'](_0x377613['checkDialMethod'](_0x1da40b))['catch'](loggerCatchQueueSummary('[syncQueueSummary]',_0x1da40b));}else{notSendMessagesQueue(_0x1da40b);}}else{freeVariablesPredictive(_0x1da40b);}};Dialer[_0x7b7e('0x1a')][_0x7b7e('0x111')]=function(){var _0x3ede92=this;var _0x41df81;for(var _0x43a7fa in this['campaigns']){if(this[_0x7b7e('0x20')][_0x7b7e('0x98')](_0x43a7fa)){_0x41df81=this['campaigns'][_0x43a7fa];if(isCampaignIvr(_0x41df81[_0x7b7e('0x4e')])&&isActive(_0x41df81['active'])){_0x41df81[_0x7b7e('0x8b')]=!![];BPromise[_0x7b7e('0xa4')]()[_0x7b7e('0xa5')](checkIsActive(_0x41df81,_0x41df81['active']))[_0x7b7e('0xa5')](checkInterval(_0x41df81))['then'](_0x3ede92[_0x7b7e('0x133')](_0x41df81))[_0x7b7e('0xa5')](_0x3ede92[_0x7b7e('0x114')](_0x41df81[_0x7b7e('0x130')],_0x41df81[_0x7b7e('0x131')],_0x41df81[_0x7b7e('0x3e')],_0x41df81))[_0x7b7e('0xa5')](_0x3ede92['checkIfTimeIntervals'](_0x41df81[_0x7b7e('0x42')],_0x41df81['dialTimezone'],_0x41df81[_0x7b7e('0x3e')],_0x41df81))[_0x7b7e('0xa5')](_0x3ede92[_0x7b7e('0x12e')](_0x41df81))[_0x7b7e('0x9d')](loggerCatchQueueSummary(_0x7b7e('0x134'),_0x41df81));}else{notSendMessagesCampaign(_0x41df81);}}}};function getCallerIdRandom(_0x52a7be,_0x3c9c06){var _0x1ead5a,_0x361964,_0x56db3e;if(_0x3c9c06<=0x0){_0x3c9c06=0x1;}_0x1ead5a=new RegExp(_0x7b7e('0x135')+_0x3c9c06+'}$');_0x361964=Math[_0x7b7e('0x136')](0xa,_0x3c9c06-0x1);_0x56db3e=Math['pow'](0xa,_0x3c9c06)-0x1;return util[_0x7b7e('0x73')]('%s',_[_0x7b7e('0x137')](_0x52a7be,_0x1ead5a,_[_0x7b7e('0x138')](_0x361964,_0x56db3e)));}function extractCalleridName(_0x49e6b3){var _0x2039a4=_0x49e6b3[_0x7b7e('0x139')](/"(.*?)"/);return _0x2039a4?_0x2039a4[0x1]:_0x49e6b3;}function extractCalleridNumber(_0x213840){var _0x141363=_0x213840[_0x7b7e('0x139')](/<(.*?)>/);return _0x141363?_0x141363[0x1]:_0x213840;}Dialer['prototype']['actionOriginate']=function(_0x2eb434,_0x424d5c){var _0x527a81=this;var _0x13aea9=uuid['v4']();this[_0x7b7e('0x25')][_0x13aea9]=new Action(_0x2eb434,_0x424d5c,_0x13aea9);return new BPromise(function(_0x12fa7d,_0x3fe59f){if(_[_0x7b7e('0x3b')](_0x2eb434)&&'object'!==typeof _0x2eb434){return _0x3fe59f(msgResponse(_0x7b7e('0x13a'),_0x7b7e('0x116'),_0x7b7e('0x13b')));}if(_[_0x7b7e('0x3b')](_0x424d5c[_0x7b7e('0x13c')][_0x7b7e('0x13d')])||_0x424d5c[_0x7b7e('0x13c')][_0x7b7e('0x13d')]===null){return _0x3fe59f(msgResponse(_0x7b7e('0x13a'),'Failure',_0x7b7e('0x13e')));}var _0x248439={'XMD-CALLERID':_0x527a81[_0x7b7e('0x25')][_0x13aea9]['getCaller'](),'XMD-AGI':_0x2eb434[_0x7b7e('0xe0')]?util[_0x7b7e('0x73')](_0x7b7e('0x13f'),ipAgi,_0x2eb434[_0x7b7e('0xe0')]):_0x7b7e('0x140'),'XMD-AGIAFTER':_0x2eb434[_0x7b7e('0xe9')]?util['format'](_0x7b7e('0x13f'),ipAgi,_0x2eb434[_0x7b7e('0xe9')]):'NONE','XMD-QUEUE':_0x2eb434[_0x7b7e('0x4e')]===_0x7b7e('0x4f')?util[_0x7b7e('0x73')](_0x7b7e('0x141'),_0x2eb434[_0x7b7e('0x3e')],_0x2eb434[_0x7b7e('0x142')]||'',_0x2eb434[_0x7b7e('0xea')]?'c':'',_0x2eb434[_0x7b7e('0x143')]||0x3):'NONE','XMD-CONTACTID':_0x424d5c['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x527a81[_0x7b7e('0x25')][_0x13aea9]['getCaller'](),'XMD-AMD':_0x2eb434[_0x7b7e('0xcf')]?_0x7b7e('0x144'):_0x7b7e('0x140'),'XMD-DESTINATION':_0x7b7e('0xce')};if(_0x2eb434[_0x7b7e('0xcf')]){_0x248439[_0x7b7e('0x145')]=_0x2eb434['dialAMDInitialSilence']||0x9c4;_0x248439[_0x7b7e('0x146')]=_0x2eb434[_0x7b7e('0x147')]||0x5dc;_0x248439[_0x7b7e('0x148')]=_0x2eb434[_0x7b7e('0x149')]||0x320;_0x248439[_0x7b7e('0x14a')]=_0x2eb434[_0x7b7e('0x14b')]||0x1388;_0x248439[_0x7b7e('0x14c')]=_0x2eb434[_0x7b7e('0x14d')]||0x64;_0x248439[_0x7b7e('0x14e')]=_0x2eb434['dialAMDBetweenWordsSilence']||0x32;_0x248439['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x2eb434[_0x7b7e('0x14f')]||0x3;_0x248439['XMD-AMDSILENCETHRESHOLD']=_0x2eb434['dialAMDSilenceThreshold']||0x100;_0x248439[_0x7b7e('0x150')]=_0x2eb434[_0x7b7e('0x151')]||0x1388;}if(_0x2eb434[_0x7b7e('0x4e')]===_0x7b7e('0x4f')){_0x248439[_0x7b7e('0x152')]=_0x424d5c[_0x7b7e('0xbf')];}else{_0x248439['XMD-CAMPAIGNID']=_0x424d5c[_0x7b7e('0xc0')];}for(var _0x23869e in _0x424d5c[_0x7b7e('0x13c')]){if(_0x424d5c[_0x7b7e('0x13c')][_0x7b7e('0x98')](_0x23869e)){if(isNotNull(_0x424d5c[_0x7b7e('0x13c')][_0x23869e])&&_0x23869e!=='id'&&_0x23869e!=='tags'&&_0x23869e!=='createdAt'&&_0x23869e!==_0x7b7e('0x153')){_0x248439[util[_0x7b7e('0x73')](_0x7b7e('0x154'),_0x7b7e('0x155'),_['toUpper'](_0x23869e))]=_0x424d5c['Contact'][_0x23869e];}}}var _0x245e80=_0x527a81['isTrunkReachable'](_0x2eb434['Trunk'])?getCallerId(_0x2eb434['Trunk'][_0x7b7e('0x71')],_0x2eb434[_0x7b7e('0x5c')],_0x2eb434['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x2eb434[_0x7b7e('0x5d')],_0x2eb434[_0x7b7e('0x156')]):_0x2eb434[_0x7b7e('0x5d')]):getCallerId(_[_0x7b7e('0x99')](_0x2eb434[_0x7b7e('0x157')])?_0x2eb434[_0x7b7e('0x70')][_0x7b7e('0x71')]:_0x2eb434[_0x7b7e('0x157')][_0x7b7e('0x71')],_0x2eb434['dialOriginateCallerIdName'],_0x2eb434['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x2eb434[_0x7b7e('0x5d')],_0x2eb434['dialRandomLastDigitCallerIdNumber']):_0x2eb434[_0x7b7e('0x5d')]);if(_0x245e80){_0x248439[_0x7b7e('0x158')]=_0x527a81[_0x7b7e('0x25')][_0x13aea9]['originatecalleridname']=extractCalleridName(_0x245e80);_0x248439[_0x7b7e('0x159')]=_0x527a81[_0x7b7e('0x25')][_0x13aea9]['originatecalleridnum']=extractCalleridNumber(_0x245e80);}return ami[_0x7b7e('0x9a')]({'actionid':_0x13aea9,'action':_0x7b7e('0x13a'),'channel':_0x527a81['isTrunkReachable'](_0x2eb434['Trunk'])?util['format'](_0x7b7e('0x15a'),_0x2eb434[_0x7b7e('0x70')][_0x7b7e('0x3e')],isNotNull(_0x2eb434[_0x7b7e('0x15b')])?_0x2eb434[_0x7b7e('0x15b')]['trim']()||'':'',_0x2eb434[_0x7b7e('0x15c')]>0x0?_0x424d5c[_0x7b7e('0x13c')][_0x7b7e('0x13d')][_0x7b7e('0x15d')](_0x2eb434['dialCutDigit']):_0x424d5c[_0x7b7e('0x13c')][_0x7b7e('0x13d')]):util[_0x7b7e('0x73')](_0x7b7e('0x15a'),_[_0x7b7e('0x99')](_0x2eb434[_0x7b7e('0x157')])?_0x2eb434[_0x7b7e('0x70')][_0x7b7e('0x3e')]:_0x2eb434[_0x7b7e('0x157')][_0x7b7e('0x3e')],isNotNull(_0x2eb434[_0x7b7e('0x15b')])?_0x2eb434[_0x7b7e('0x15b')][_0x7b7e('0x15e')]()||'':'',_0x2eb434[_0x7b7e('0x15c')]>0x0?_0x424d5c[_0x7b7e('0x13c')][_0x7b7e('0x13d')][_0x7b7e('0x15d')](_0x2eb434[_0x7b7e('0x15c')]):_0x424d5c[_0x7b7e('0x13c')][_0x7b7e('0x13d')]),'callerid':_0x245e80,'Exten':_0x7b7e('0xce'),'Context':'from-sip','Priority':'1','variable':_0x248439,'timeout':(_0x2eb434[_0x7b7e('0x5e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x13aea9})[_0x7b7e('0xa5')](function(_0x554684){return _0x12fa7d(_0x554684);})[_0x7b7e('0x9d')](function(_0x201573){_0x2eb434[_0x7b7e('0x63')]+=0x1;var _0x19a7f3=new History(_0x527a81[_0x7b7e('0x25')][_0x13aea9]);logger[_0x7b7e('0x81')](util['format'](_0x7b7e('0x15f'),JSON['stringify'](_0x201573)));_0x19a7f3[_0x7b7e('0x92')]=0xe;_0x19a7f3[_0x7b7e('0x93')]='OriginateError';_0x19a7f3['starttime']=moment()[_0x7b7e('0x73')]('YYYY-MM-DD\x20HH:mm:ss');_0x19a7f3['endtime']=_0x19a7f3['starttime'];_0x527a81[_0x7b7e('0xb3')](_0x19a7f3)[_0x7b7e('0x9d')](loggerCatch(_0x7b7e('0x160')));_0x527a81[_0x7b7e('0xb2')](_0x19a7f3)[_0x7b7e('0x9d')](loggerCatch(_0x7b7e('0x160')))[_0x7b7e('0x103')](function(){delete _0x527a81[_0x7b7e('0x25')][_0x13aea9];return _0x3fe59f(msgResponse(_0x7b7e('0x13a'),_0x7b7e('0x48'),_0x7b7e('0x161')));});});});};Dialer[_0x7b7e('0x1a')][_0x7b7e('0x162')]=function(_0x5b8cf7){var _0x9dcc8b=this[_0x7b7e('0x25')][_0x5b8cf7[_0x7b7e('0xf8')]];var _0x313d65=this;if(_0x9dcc8b){delete this[_0x7b7e('0x25')][_0x5b8cf7[_0x7b7e('0xf8')]];_0x9dcc8b[_0x7b7e('0x163')]=moment()[_0x7b7e('0x73')](_0x7b7e('0xeb'));var _0x22740a=_0x9dcc8b[_0x7b7e('0x4e')]===_0x7b7e('0x76')?this[_0x7b7e('0x20')][_0x9dcc8b['queue']]:this['voiceQueues'][_0x9dcc8b[_0x7b7e('0x164')]()];if(!this['isSuccess'](_0x5b8cf7[_0x7b7e('0x165')])){this[_0x7b7e('0x9f')](_0x22740a);return this['callProgressDetecting'](_0x9dcc8b,_0x22740a,_0x5b8cf7)[_0x7b7e('0xa5')](function(_0x297ef5){})[_0x7b7e('0x9d')](loggerCatch(_0x7b7e('0x166')));}else{this[_0x7b7e('0x95')][_0x5b8cf7[_0x7b7e('0xca')]]=_0x9dcc8b;}}};Dialer[_0x7b7e('0x1a')][_0x7b7e('0x167')]=function(_0x1234e6,_0x2c068a,_0x5a25e0){var _0x50c6d0=new History(_0x2c068a);if(_0x50c6d0[_0x7b7e('0x168')]+_0x50c6d0[_0x7b7e('0x169')]+_0x50c6d0[_0x7b7e('0x16a')]>=_0x5a25e0[_0x7b7e('0x16b')]-0x1){return!![];}switch(_0x1234e6){case 0x3:if(_0x50c6d0[_0x7b7e('0x16a')]>=_0x5a25e0[_0x7b7e('0x16c')]-0x1){return!![];}else{this[_0x7b7e('0xab')]({'active':![],'countnoanswerretry':_0x50c6d0[_0x7b7e('0x16a')]+=0x1,'scheduledat':moment()[_0x7b7e('0x16d')](_0x5a25e0[_0x7b7e('0x16e')],_0x7b7e('0x16f'))[_0x7b7e('0x73')](_0x7b7e('0xeb')),'ContactId':_0x50c6d0['ContactId'],'ListId':_0x50c6d0['ListId'],'VoiceQueueId':_0x50c6d0[_0x7b7e('0xbf')]||undefined,'CampaignId':_0x50c6d0[_0x7b7e('0xc0')]||undefined})[_0x7b7e('0x9d')](loggerCatch('[rescheduleContact][NoAnswer]'));}break;case 0x5:if(_0x50c6d0[_0x7b7e('0x168')]>=_0x5a25e0[_0x7b7e('0x170')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countbusyretry':_0x50c6d0[_0x7b7e('0x168')]+=0x1,'scheduledat':moment()[_0x7b7e('0x16d')](_0x5a25e0[_0x7b7e('0x171')],_0x7b7e('0x16f'))[_0x7b7e('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x50c6d0[_0x7b7e('0xbd')],'ListId':_0x50c6d0[_0x7b7e('0x104')],'VoiceQueueId':_0x50c6d0[_0x7b7e('0xbf')]||undefined,'CampaignId':_0x50c6d0[_0x7b7e('0xc0')]||undefined})['catch'](loggerCatch(_0x7b7e('0x172')));}break;case 0x8:if(_0x50c6d0['countcongestionretry']>=_0x5a25e0[_0x7b7e('0x173')]-0x1){return!![];}else{this[_0x7b7e('0xab')]({'active':![],'countcongestionretry':_0x50c6d0[_0x7b7e('0x169')]+=0x1,'scheduledat':moment()[_0x7b7e('0x16d')](_0x5a25e0[_0x7b7e('0x174')],'minutes')[_0x7b7e('0x73')](_0x7b7e('0xeb')),'ContactId':_0x50c6d0['ContactId'],'ListId':_0x50c6d0[_0x7b7e('0x104')],'VoiceQueueId':_0x50c6d0[_0x7b7e('0xbf')]||undefined,'CampaignId':_0x50c6d0[_0x7b7e('0xc0')]||undefined})['catch'](loggerCatch(_0x7b7e('0x175')));}break;default:return!![];}};Dialer[_0x7b7e('0x1a')]['callProgressDetecting']=function(_0x465654,_0x2c4869,_0x4ad73e){var _0x20a100=this;var _0x424521=new History(_0x465654);return new BPromise(function(_0x54c09a,_0x3438b8){if(_[_0x7b7e('0x3b')](_0x2c4869)&&_0x7b7e('0x176')!==typeof _0x2c4869){return _0x3438b8(msgResponse(_0x7b7e('0x177'),_0x7b7e('0x116'),_0x7b7e('0x178')));}if(_[_0x7b7e('0x3b')](_0x4ad73e)&&_0x7b7e('0x176')!==typeof _0x4ad73e){return _0x3438b8(msgResponse(_0x7b7e('0x177'),_0x7b7e('0x116'),_0x7b7e('0x179')));}switch(_0x4ad73e['reason']){case'0':_0x2c4869[_0x7b7e('0x17a')]+=0x1;_0x424521['state']=0x0;_0x424521[_0x7b7e('0x93')]=_0x7b7e('0x17b');_0x20a100[_0x7b7e('0xb3')](_0x424521)[_0x7b7e('0x9d')](loggerCatch(_0x7b7e('0x17c')));if(_0x20a100[_0x7b7e('0x167')](0x0,_0x465654,_0x2c4869)){if(_0x424521['countbusyretry']+_0x424521[_0x7b7e('0x169')]+_0x424521[_0x7b7e('0x16a')]>=_0x2c4869[_0x7b7e('0x16b')]){_0x20a100[_0x7b7e('0x17d')](_0x424521,_0x54c09a,_0x3438b8,_0x7b7e('0x17e'));}else{_0x20a100['createStateFinal'](_0x424521,_0x54c09a,_0x3438b8,_0x7b7e('0x17e'));}}break;case'3':_0x2c4869['outboundNoAnswerCallsDay']+=0x1;_0x424521[_0x7b7e('0x92')]=0x3;_0x424521['statedesc']=_0x7b7e('0x17f');_0x424521[_0x7b7e('0x16a')]+=0x1;_0x424521[_0x7b7e('0x180')]+=0x1;_0x20a100['createHistory'](_0x424521)[_0x7b7e('0x9d')](loggerCatch(_0x7b7e('0x181')));if(_0x20a100[_0x7b7e('0x167')](0x3,_0x465654,_0x2c4869)){if(_0x424521[_0x7b7e('0x16a')]>=_0x2c4869[_0x7b7e('0x16c')]){_0x20a100[_0x7b7e('0x182')](_0x424521,_0x54c09a,_0x3438b8,_0x7b7e('0x183'));}else{_0x20a100[_0x7b7e('0x17d')](_0x424521,_0x54c09a,_0x3438b8,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x2c4869[_0x7b7e('0x60')]+=0x1;_0x424521[_0x7b7e('0x92')]=0x5;_0x424521[_0x7b7e('0x93')]=_0x7b7e('0x184');_0x424521[_0x7b7e('0x168')]+=0x1;_0x424521[_0x7b7e('0x180')]+=0x1;_0x20a100['createHistory'](_0x424521)['catch'](loggerCatch(_0x7b7e('0x185')));if(_0x20a100[_0x7b7e('0x167')](0x5,_0x465654,_0x2c4869)){if(_0x424521['countbusyretry']>=_0x2c4869[_0x7b7e('0x170')]){_0x20a100[_0x7b7e('0x182')](_0x424521,_0x54c09a,_0x3438b8,'reason\x205\x20busy');}else{_0x20a100[_0x7b7e('0x17d')](_0x424521,_0x54c09a,_0x3438b8,_0x7b7e('0x186'));}}break;case'8':_0x2c4869[_0x7b7e('0x187')]+=0x1;_0x424521['state']=0x8;_0x424521[_0x7b7e('0x93')]=_0x7b7e('0x188');_0x424521[_0x7b7e('0x169')]+=0x1;_0x424521[_0x7b7e('0x180')]+=0x1;_0x20a100[_0x7b7e('0xb3')](_0x424521)['catch'](loggerCatch(_0x7b7e('0x189')));if(_0x20a100[_0x7b7e('0x167')](0x8,_0x465654,_0x2c4869)){if(_0x424521[_0x7b7e('0x169')]>=_0x2c4869[_0x7b7e('0x173')]){_0x20a100[_0x7b7e('0x182')](_0x424521,_0x54c09a,_0x3438b8,_0x7b7e('0x18a'));}else{_0x20a100[_0x7b7e('0x17d')](_0x424521,_0x54c09a,_0x3438b8,_0x7b7e('0x18a'));}}break;default:_0x2c4869['outboundUnknownCallsDay']+=0x1;_0x424521[_0x7b7e('0x92')]=0xc;_0x424521[_0x7b7e('0x93')]=_0x4ad73e[_0x7b7e('0xe6')];_0x20a100[_0x7b7e('0xb3')](_0x424521)[_0x7b7e('0x9d')](loggerCatch(_0x7b7e('0x18b')));if(_0x20a100[_0x7b7e('0x167')](_0x4ad73e[_0x7b7e('0xe6')],_0x465654,_0x2c4869)){if(_0x424521[_0x7b7e('0x168')]+_0x424521[_0x7b7e('0x169')]+_0x424521['countnoanswerretry']>=_0x2c4869['dialGlobalMaxRetry']){_0x20a100[_0x7b7e('0x17d')](_0x424521,_0x54c09a,_0x3438b8,_0x4ad73e[_0x7b7e('0xe6')]);}else{_0x20a100[_0x7b7e('0x182')](_0x424521,_0x54c09a,_0x3438b8,_0x4ad73e[_0x7b7e('0xe6')]);}}}});};Dialer[_0x7b7e('0x1a')][_0x7b7e('0x17d')]=function(_0x43a6a5,_0xd2684e,_0x172605,_0x29d23d){var _0x18aef8=new Final(_0x43a6a5);_0x18aef8[_0x7b7e('0x92')]=0xf;_0x18aef8[_0x7b7e('0x93')]='Global';this[_0x7b7e('0x182')](_0x18aef8,_0xd2684e,_0x172605,_0x29d23d);};Dialer[_0x7b7e('0x1a')][_0x7b7e('0x182')]=function(_0x130ab5,_0x529e0e,_0x8a0cba,_0x2eef95){this['moveContactManagedDialer'](_0x130ab5)['then'](function(_0xaca8b8){return _0x529e0e(msgResponse('[callProgressDetecting]','Success',_0x2eef95));})[_0x7b7e('0x9d')](function(_0x24a9d6){return _0x8a0cba(msgResponse(_0x7b7e('0x18c'),_0x7b7e('0x116'),_0x7b7e('0x18d')));});};Dialer['prototype'][_0x7b7e('0x6')]=function(_0x34f1e5){var _0x2801b3=this;var _0x827d3f=_0x34f1e5[_0x7b7e('0x18e')]/0x64;var _0x3947ea=_0x34f1e5['outboundDropCallsDayTimeout']/(_0x34f1e5[_0x7b7e('0xf1')]+_0x34f1e5[_0x7b7e('0x5f')]);var _0x37fd3e=_0x34f1e5[_0x7b7e('0x52')]-_0x34f1e5[_0x7b7e('0x6d')]-_0x34f1e5[_0x7b7e('0x58')]-_0x34f1e5[_0x7b7e('0x6f')]-_0x34f1e5[_0x7b7e('0x54')];var _0x2b3e47=(_0x34f1e5[_0x7b7e('0x52')]-_0x34f1e5[_0x7b7e('0x6d')])*_0x34f1e5['predictiveIntervalLowerLimit'];var _0x5294aa=Math[_0x7b7e('0x18f')](_0x34f1e5[_0x7b7e('0x190')]*_0x34f1e5['erlangAbandonmentRate']*_0x34f1e5['predictiveIntervalHitRate']*_0x34f1e5[_0x7b7e('0x191')]);if(_[_0x7b7e('0x3b')](_0x34f1e5[_0x7b7e('0x29')])){loggerPredictive[_0x7b7e('0x78')](_0x7b7e('0x192'));if(!_['isUndefined'](_0x34f1e5['startPredictive'])){_0x34f1e5['startPredictive']=undefined;loggerPredictive[_0x7b7e('0x81')](_0x7b7e('0x193'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x7b7e('0x3b')](_0x34f1e5['handlePredictive'])){loggerPredictive['error'](_0x7b7e('0x193'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x34f1e5['handlePredictive']);_0x34f1e5[_0x7b7e('0x7e')]=undefined;}_0x34f1e5[_0x7b7e('0x29')]=moment()[_0x7b7e('0x73')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x7b7e('0x78')]('[startMethodPredictive][StartProgressive][Date]',_0x34f1e5['startProgressive'],_0x34f1e5[_0x7b7e('0x3e')]);this['handlePower'](_0x34f1e5,0x1);}else if(ifInterval(_0x34f1e5[_0x7b7e('0x194')],_0x34f1e5['startProgressive'])){this[_0x7b7e('0x129')](_0x34f1e5,0x1);loggerPredictiveCalls[_0x7b7e('0x78')](_0x7b7e('0x195'),_0x34f1e5['startProgressive'],_0x34f1e5[_0x7b7e('0x3e')]);_0x34f1e5[_0x7b7e('0x190')]=0x0;_0x34f1e5['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x827d3f<_0x3947ea&&_0x34f1e5[_0x7b7e('0x196')]===_0x7b7e('0x197')){freeVariablesPredictive(_0x34f1e5);loggerPredictive[_0x7b7e('0x78')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x7b7e('0x198'),_0x3947ea,'startProgressive',_0x34f1e5['name']);}else if(_0x37fd3e>_0x2b3e47){freeVariablesPredictive(_0x34f1e5);loggerPredictive['info'](_0x7b7e('0x199'),_0x7b7e('0x19a'),_0x37fd3e,_0x7b7e('0x19b'),_0x2b3e47);}else if(_0x5294aa<_0x34f1e5[_0x7b7e('0x6c')]&&_0x34f1e5[_0x7b7e('0x196')]===_0x7b7e('0x197')){freeVariablesPredictive(_0x34f1e5);loggerPredictive[_0x7b7e('0x78')](_0x7b7e('0x19c'),_0x7b7e('0x19d'),_0x5294aa,_0x7b7e('0x19e'),_0x34f1e5[_0x7b7e('0x6c')],_0x7b7e('0x29'),_0x34f1e5['name']);}else if(!ifInterval(_0x34f1e5[_0x7b7e('0x194')],_0x34f1e5[_0x7b7e('0x29')])&&_[_0x7b7e('0x3b')](_0x34f1e5['startPredictive'])&&!_['isUndefined'](_0x34f1e5[_0x7b7e('0x29')])){_0x34f1e5[_0x7b7e('0x28')]=moment()[_0x7b7e('0x73')](_0x7b7e('0xeb'));loggerPredictive[_0x7b7e('0x78')](_0x7b7e('0x19f'),_0x34f1e5[_0x7b7e('0x28')],_0x34f1e5[_0x7b7e('0x3e')]);this[_0x7b7e('0xa9')](_0x34f1e5[_0x7b7e('0x194')])['then'](this[_0x7b7e('0x1a0')](_0x34f1e5))[_0x7b7e('0xa5')](mergeDataErlangB(_0x34f1e5))[_0x7b7e('0xa5')](this['startMethodPredictive'](_0x34f1e5))[_0x7b7e('0x9d')](loggerCatchPredictive('[averageHandleTime][ErlangB]\x20',_0x34f1e5));}else if(!ifInterval(_0x34f1e5[_0x7b7e('0x194')],_0x34f1e5['startPredictive'])){_0x34f1e5[_0x7b7e('0x6c')]=0x0;_0x34f1e5[_0x7b7e('0x28')]=moment()['format'](_0x7b7e('0xeb'));loggerPredictive[_0x7b7e('0x78')](_0x7b7e('0x1a1'),_0x34f1e5[_0x7b7e('0x28')],_0x34f1e5['name']);clearInterval(_0x34f1e5[_0x7b7e('0x7e')]);_0x34f1e5[_0x7b7e('0x7e')]=undefined;this[_0x7b7e('0xa9')](_0x34f1e5['dialPredictiveInterval'])[_0x7b7e('0xa5')](this[_0x7b7e('0x1a0')](_0x34f1e5))['then'](mergeDataErlangB(_0x34f1e5))[_0x7b7e('0xa5')](this[_0x7b7e('0x1a2')](_0x34f1e5))[_0x7b7e('0x9d')](loggerCatchPredictive(_0x7b7e('0x1a3'),_0x34f1e5));}};Dialer['prototype']['getDataPredictive']=function(_0x20020e){var _0x3eddef=this;return function(_0x177568){return new BPromise(function(_0x51d7dc,_0x19b7ba){_[_0x7b7e('0xbb')](_0x20020e,_0x177568[0x0]);if(checkGetDataPredictive(_0x177568[0x0])){loggerPredictive[_0x7b7e('0x78')](JSON['stringify'](_0x177568[0x0]));if(_0x20020e['dialPredictiveOptimization']===_0x7b7e('0x197')){return _0x3eddef[_0x7b7e('0xb0')](_0x20020e['id'])['then'](function(_0x4bcbe5){var _0x499350=_0x20020e['loggedIn']-_0x4bcbe5[0x0]['outboundQueuePauses'];var _0x15c9dc=_0x20020e[_0x7b7e('0x194')]*0x3c;var _0xd7b54c=_0x177568[0x0][_0x7b7e('0x68')]+_0x177568[0x0][_0x7b7e('0x67')];var _0x3d18e2=(_0x177568[0x0][_0x7b7e('0x1a4')]+_0x177568[0x0][_0x7b7e('0x6a')]+_0x177568[0x0][_0x7b7e('0x69')])/_0x177568[0x0]['predictiveIntervalTotalCalls'];var _0x35239d=_0x20020e[_0x7b7e('0x18e')]/0x64;_0x20020e[_0x7b7e('0x6d')]=_0x4bcbe5[0x0][_0x7b7e('0x1a5')]||0x0;_0x20020e[_0x7b7e('0x1a6')]=_0x3d18e2>0x0?_0x3d18e2:0x1;return _0x3eddef[_0x7b7e('0x1a7')](_0x499350,_0x15c9dc,_0xd7b54c,_0x3d18e2,_0x35239d);})[_0x7b7e('0xa5')](function(_0x44beb2){return _0x51d7dc(_0x44beb2);})[_0x7b7e('0x9d')](function(_0x15c537){return _0x19b7ba(msgResponse(_0x7b7e('0x1a8'),'Failure',JSON[_0x7b7e('0x49')](_0x15c537)));});}if(_0x20020e[_0x7b7e('0x196')]===_0x7b7e('0x1a9')){return _0x3eddef[_0x7b7e('0xb0')](_0x20020e['id'])[_0x7b7e('0xa5')](function(_0x28b5ff){var _0x1dabf0=_0x20020e[_0x7b7e('0x52')]-_0x28b5ff[0x0]['outboundQueuePauses'];var _0x3f7ce4=_0x20020e[_0x7b7e('0x194')]*0x3c;var _0x233d12=_0x177568[0x0]['predictiveIntervalAvgTalktime']+_0x177568[0x0][_0x7b7e('0x67')];var _0x17a691=(_0x177568[0x0][_0x7b7e('0x1a4')]+_0x177568[0x0][_0x7b7e('0x6a')]+_0x177568[0x0][_0x7b7e('0x69')])/_0x177568[0x0][_0x7b7e('0x6e')];var _0x5933da=_0x20020e['dialPredictiveOptimizationPercentage']/0x64;_0x20020e[_0x7b7e('0x6d')]=_0x28b5ff[0x0][_0x7b7e('0x1a5')]||0x0;_0x20020e[_0x7b7e('0x1a6')]=_0x17a691>0x0?_0x17a691:0x1;return _0x3eddef[_0x7b7e('0x1aa')](_0x1dabf0,_0x3f7ce4,_0x233d12,_0x17a691,_0x5933da);})[_0x7b7e('0xa5')](function(_0x26b6cb){return _0x51d7dc(_0x26b6cb);})[_0x7b7e('0x9d')](function(_0x26443d){return _0x19b7ba(msgResponse('[CatchErlangB]',_0x7b7e('0x116'),JSON[_0x7b7e('0x49')](_0x26443d)));});}}else{return _0x19b7ba(msgResponse('[getDataPredictive]',_0x7b7e('0x116'),_0x7b7e('0x1ab')));}});};};Dialer[_0x7b7e('0x1a')][_0x7b7e('0x1a2')]=function(_0x10c13e){var _0x192030=this;return function(){var _0xc933dd=0x0;var _0x5b00cf=Math[_0x7b7e('0x18f')](_0x10c13e['erlangCallToSecond']*0x3e8);if(_0x5b00cf>0x0){_0x5b00cf=_0x5b00cf<0x64?0x64:_0x5b00cf;loggerPredictive[_0x7b7e('0x78')]('[startMethodPredictive]',_0x5b00cf);_0x10c13e['handlePredictive']=setInterval(function(){_0x192030[_0x7b7e('0x7e')](_0x10c13e);loggerPredictiveCalls['info'](_0x7b7e('0x1ac'),_0xc933dd+=0x1);},_0x5b00cf);}else{loggerPredictive[_0x7b7e('0x78')]('[startMethodPredictive][milliseconds]\x20','Failure\x20',_0x5b00cf);}};};Dialer[_0x7b7e('0x1a')][_0x7b7e('0x1ad')]=function(_0xd86950,_0x5a33d9){var _0x58b39e=this;return function(_0x44d379){if(_[_0x7b7e('0x45')](_0x44d379)){if(_[_0x7b7e('0x99')](_0x5a33d9['UserId'])||!_0x5a33d9['recallme']){if(_0xd86950[_0x7b7e('0x5b')]==='booked'){_0xd86950[_0x7b7e('0x100')]=_['isUndefined'](_0xd86950[_0x7b7e('0x100')])?!![]:_0xd86950[_0x7b7e('0x100')];var _0x18cf90=uuid['v4']();_0x58b39e[_0x7b7e('0x25')][_0x18cf90]=new Action(_0xd86950,_0x5a33d9,_0x18cf90);loggerBooked[_0x7b7e('0x78')](_0x7b7e('0x1ae'),_0x18cf90,_0x7b7e('0x1af'),JSON[_0x7b7e('0x49')](_0xd86950[_0x7b7e('0x100')]),_0x7b7e('0x1b0'),_0xd86950[_0x7b7e('0x3e')]);if(_0xd86950[_0x7b7e('0x100')]){_0xd86950[_0x7b7e('0x100')]=![];_0x58b39e[_0x7b7e('0x2a')][_0x58b39e[_0x7b7e('0x25')][_0x18cf90][_0x7b7e('0xa0')]]=[];ami['Action']({'actionid':_0x18cf90,'action':_0x7b7e('0x1b1'),'queue':_0xd86950[_0x7b7e('0x3e')]})[_0x7b7e('0x9d')](function(_0xf79313){_0x58b39e[_0x7b7e('0x9f')](_0xd86950);_0x58b39e[_0x7b7e('0xab')]({'active':![],'ContactId':_0x58b39e[_0x7b7e('0x25')][_0x18cf90]['ContactId'],'ListId':_0x58b39e[_0x7b7e('0x25')][_0x18cf90][_0x7b7e('0x104')],'VoiceQueueId':_0x58b39e[_0x7b7e('0x25')][_0x18cf90][_0x7b7e('0xbf')]||undefined,'CampaignId':_0x58b39e[_0x7b7e('0x25')][_0x18cf90][_0x7b7e('0xc0')]||undefined})[_0x7b7e('0x9d')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x58b39e[_0x7b7e('0x25')][_0x18cf90];});}else{loggerBooked[_0x7b7e('0x78')]('[booked][checkContactBlack][else]',JSON[_0x7b7e('0x49')](_0xd86950['queueStatusComplete']),'Queue:\x20',_0xd86950['name']);_0x58b39e['updateOriginated'](_0xd86950);_0x58b39e[_0x7b7e('0xab')]({'active':![],'ContactId':_0x58b39e[_0x7b7e('0x25')][_0x18cf90][_0x7b7e('0xbd')],'ListId':_0x58b39e[_0x7b7e('0x25')][_0x18cf90][_0x7b7e('0x104')],'VoiceQueueId':_0x58b39e[_0x7b7e('0x25')][_0x18cf90][_0x7b7e('0xbf')]||undefined,'CampaignId':_0x58b39e['actions'][_0x18cf90][_0x7b7e('0xc0')]||undefined})[_0x7b7e('0x9d')](loggerCatch(_0x7b7e('0x1b2')));delete _0x58b39e[_0x7b7e('0x25')][_0x18cf90];}}else{return _0x58b39e[_0x7b7e('0x1b3')](_0xd86950,_0x5a33d9);}}else{if(getDiff(_0x5a33d9[_0x7b7e('0x1b4')])<_0xd86950[_0x7b7e('0x1b5')]*0x3c){_0x58b39e[_0x7b7e('0x1e')][_0x7b7e('0x101')](_0x5a33d9['id'])[_0x7b7e('0x103')](function(){_0x58b39e['updateOriginated'](_0xd86950);});}else{_0xd86950[_0x7b7e('0x64')]+=0x1;_0x58b39e[_0x7b7e('0x9f')](_0xd86950);if(_0xd86950[_0x7b7e('0x1b6')]){_0x58b39e[_0x7b7e('0xab')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5a33d9[_0x7b7e('0xbd')],'ListId':_0x5a33d9[_0x7b7e('0x104')],'VoiceQueueId':_0x5a33d9[_0x7b7e('0xbf')]||undefined,'CampaignId':_0x5a33d9[_0x7b7e('0xc0')]||undefined})[_0x7b7e('0x9d')](loggerCatch(_0x7b7e('0x1b7')));_0x58b39e[_0x7b7e('0xb3')](createObjHistory(_0xd86950,_0x5a33d9,_0x7b7e('0x1b8'),0x17,_0x7b7e('0x1b9')))[_0x7b7e('0x9d')](loggerCatch(_0x7b7e('0x1ba')));}else{_0x58b39e[_0x7b7e('0xba')](createObjHistory(_0xd86950,_0x5a33d9,_0x7b7e('0x1bb'),0x16,_0x7b7e('0x1bc')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0xd86950[_0x7b7e('0x1bd')]+=0x1;_0x58b39e[_0x7b7e('0xba')](createObjHistory(_0xd86950,_0x5a33d9,_0x7b7e('0x1be'),0xd,_0x7b7e('0x1bf')),'[Originate][historyBlacklist]',_0x7b7e('0x1c0'));throw'inBlackList';}};};Dialer[_0x7b7e('0x1a')][_0x7b7e('0x12f')]=function(_0x5183d4){var _0x288664=this;var _0x46483c=[];var _0x401f92=_0x5183d4[_0x7b7e('0x1c1')]-_0x5183d4[_0x7b7e('0x6f')]-_0x5183d4[_0x7b7e('0x1c2')];emitCampaignSummary(_0x5183d4);if(_0x401f92>0x0){if(_0x401f92>this[_0x7b7e('0x23')]){_0x401f92=this[_0x7b7e('0x23')];}_0x5183d4[_0x7b7e('0x1c2')]+=_0x401f92;this[_0x7b7e('0xaf')](_0x5183d4['id'],_0x401f92,_0x5183d4[_0x7b7e('0x1c3')])[_0x7b7e('0xa5')](function(_0x3a6cb3){_0x5183d4[_0x7b7e('0x1c2')]-=_0x401f92;_0x5183d4[_0x7b7e('0x1c2')]=_0x5183d4['temp']>0x0?_0x5183d4[_0x7b7e('0x1c2')]:0x0;if(!checkContactEmpty(_0x3a6cb3)){_0x5183d4[_0x7b7e('0x3c')]=_0x7b7e('0x1c4');logger[_0x7b7e('0x78')](_0x7b7e('0x1c5')+_0x5183d4[_0x7b7e('0x3e')]);}else{_0x5183d4[_0x7b7e('0x6f')]+=_0x3a6cb3[_0x7b7e('0x83')];_0x5183d4[_0x7b7e('0x3c')]=_0x7b7e('0x1c6');for(var _0x2e0102=0x0;_0x2e0102<_0x3a6cb3['length'];_0x2e0102+=0x1){_0x5183d4[_0x7b7e('0x1c7')]+=0x1;if(_[_0x7b7e('0x99')](_0x3a6cb3[_0x2e0102])||_[_0x7b7e('0x99')](_0x3a6cb3[_0x2e0102][_0x7b7e('0x13c')])||_[_0x7b7e('0x99')](_0x3a6cb3[_0x2e0102][_0x7b7e('0x13c')][_0x7b7e('0x13d')])){_0x288664[_0x7b7e('0xb8')](_0x7b7e('0x1c8'),_0x5183d4,_0x3a6cb3[_0x2e0102]);}else{_0x288664['checkIsBlackListIvr'](_[_0x7b7e('0xbc')](_0x3a6cb3[_0x2e0102],[_0x7b7e('0xc0'),'Contact.phone']))[_0x7b7e('0xa5')](_0x288664['checkContactBlack'](_0x5183d4,_0x3a6cb3[_0x2e0102]))[_0x7b7e('0x9d')](_0x288664['loggerHandler'](_0x7b7e('0x1c9'),_0x5183d4));}}}})[_0x7b7e('0x9d')](loggerGetContactDialer(_0x7b7e('0x1ca'),_0x5183d4,_0x401f92));}};Dialer[_0x7b7e('0x1a')][_0x7b7e('0x129')]=function(_0x390990,_0x595ff9){var _0x24acbd=this;var _0x5183e9=[];var _0x2d9930=_0x595ff9>=0x1?_0x595ff9:0x1;var _0x415aef=[];if(_0x390990[_0x7b7e('0x5b')]===_0x7b7e('0x12b')){_0x2d9930=0x1;}var _0x269ebc=Math[_0x7b7e('0x18f')](_0x390990[_0x7b7e('0x51')]*_0x2d9930)-_0x390990[_0x7b7e('0x6f')]-_0x390990[_0x7b7e('0x1c2')];emitVoiceQueueSummary(_0x390990);if(_0x390990[_0x7b7e('0x1cb')]>0x0){var _0x38fe1a=_0x390990[_0x7b7e('0x1cb')]-_0x390990[_0x7b7e('0x6f')]-_0x390990['talking']-_0x390990['temp']-_0x390990['pTalking'];if(_0x269ebc>_0x38fe1a){_0x269ebc=_0x38fe1a;}}if(_0x269ebc>0x0){if(_0x390990['dialMethod']===_0x7b7e('0x12b')){_0x269ebc=0x1;}if(_0x269ebc>this['maxNumberOriginate']){_0x269ebc=this[_0x7b7e('0x23')];}_0x390990[_0x7b7e('0x1c2')]+=_0x269ebc;for(var _0xa55bb8 in this[_0x7b7e('0x21')]){if(this[_0x7b7e('0x21')][_0x7b7e('0x98')](_0xa55bb8)){if(this[_0x7b7e('0x21')][_0xa55bb8]['state']===_0x7b7e('0x1cc')&&this['agents'][_0xa55bb8]['status']===_0x7b7e('0xc8')){_0x5183e9[_0x7b7e('0xfe')](this[_0x7b7e('0x21')][_0xa55bb8]['id']);}}}this[_0x7b7e('0xad')](_0x390990['id'],_0x5183e9,_0x269ebc,_0x390990['dialOrderByScheduledAt'])[_0x7b7e('0xa5')](function(_0x2f7b65){_0x390990[_0x7b7e('0x1c2')]-=_0x269ebc;_0x390990[_0x7b7e('0x1c2')]=_0x390990[_0x7b7e('0x1c2')]>0x0?_0x390990[_0x7b7e('0x1c2')]:0x0;if(!checkContactEmpty(_0x2f7b65)){_0x24acbd[_0x7b7e('0xa3')](_0x390990)[_0x7b7e('0xa5')](sendMessageReschedule(_0x390990))['catch'](loggerCatch(_0x7b7e('0x1cd')));}else{_0x390990[_0x7b7e('0x6f')]+=_0x2f7b65[_0x7b7e('0x83')];_0x390990[_0x7b7e('0x3c')]=_0x390990[_0x7b7e('0x5b')]==='booked'?_0x7b7e('0x144'):'RUNNING';for(var _0x91e52=0x0;_0x91e52<_0x2f7b65[_0x7b7e('0x83')];_0x91e52+=0x1){if(_['isNil'](_0x2f7b65[_0x91e52])||_[_0x7b7e('0x99')](_0x2f7b65[_0x91e52][_0x7b7e('0x13c')])||_[_0x7b7e('0x99')](_0x2f7b65[_0x91e52][_0x7b7e('0x13c')][_0x7b7e('0x13d')])){_0x24acbd[_0x7b7e('0xb8')](_0x7b7e('0x1c8'),_0x390990,_0x2f7b65[_0x91e52]);}else{_0x24acbd[_0x7b7e('0xa6')](_[_0x7b7e('0xbc')](_0x2f7b65[_0x91e52],[_0x7b7e('0xbf'),_0x7b7e('0x1ce')]))[_0x7b7e('0xa5')](_0x24acbd[_0x7b7e('0x1ad')](_0x390990,_0x2f7b65[_0x91e52]))['catch'](_0x24acbd[_0x7b7e('0xb7')](_0x7b7e('0x1c8'),_0x390990));}}}})[_0x7b7e('0x9d')](loggerGetContactDialer(_0x7b7e('0x1cf'),_0x390990,_0x269ebc));}};Dialer['prototype'][_0x7b7e('0x7e')]=function(_0x54c6e1){var _0x2f03c1=this;if(_0x54c6e1[_0x7b7e('0x1cb')]>0x0){var _0x57f5b1=_0x54c6e1[_0x7b7e('0x1cb')]-_0x54c6e1[_0x7b7e('0x6f')]-_0x54c6e1['talking'];if(_0x57f5b1>0x0){this[_0x7b7e('0x1d0')](_0x54c6e1);}else{loggerPredictiveCalls[_0x7b7e('0x78')](_0x7b7e('0x1d1'));}}else{this[_0x7b7e('0x1d0')](_0x54c6e1);}};Dialer[_0x7b7e('0x1a')][_0x7b7e('0x1d0')]=function(_0x209c89){var _0x45838d=this;var _0x4cb08c=[];_0x209c89[_0x7b7e('0x6f')]+=0x1;for(var _0x14ee05 in this[_0x7b7e('0x21')]){if(this['agents'][_0x7b7e('0x98')](_0x14ee05)){if(this[_0x7b7e('0x21')][_0x14ee05][_0x7b7e('0x92')]===_0x7b7e('0x1cc')&&this['agents'][_0x14ee05]['status']===_0x7b7e('0xc8')){_0x4cb08c[_0x7b7e('0xfe')](this[_0x7b7e('0x21')][_0x14ee05]['id']);}}}this[_0x7b7e('0xad')](_0x209c89['id'],_0x4cb08c,0x1,_0x209c89['dialOrderByScheduledAt'])['then'](function(_0x5ef0b5){if(!checkContactEmpty(_0x5ef0b5)){checkContactLowerLimitOriginate(_0x209c89,0x1,0x0);_0x45838d['countReScheduled'](_0x209c89)[_0x7b7e('0xa5')](sendMessageReschedule(_0x209c89))[_0x7b7e('0x9d')](loggerCatch('[countReScheduled]\x20'));}else{_0x209c89['message']=_0x7b7e('0x1c6');if(_[_0x7b7e('0x99')](_0x5ef0b5[0x0])||_[_0x7b7e('0x99')](_0x5ef0b5[0x0][_0x7b7e('0x13c')])||_[_0x7b7e('0x99')](_0x5ef0b5[0x0][_0x7b7e('0x13c')][_0x7b7e('0x13d')])){_0x45838d['emptyContact'](_0x7b7e('0x1c8'),_0x209c89,_0x5ef0b5[0x0]);}else{_0x45838d[_0x7b7e('0xa6')](_['pick'](_0x5ef0b5[0x0],[_0x7b7e('0xbf'),_0x7b7e('0x1ce')]))[_0x7b7e('0xa5')](_0x45838d[_0x7b7e('0x1ad')](_0x209c89,_0x5ef0b5[0x0]))['catch'](_0x45838d[_0x7b7e('0xb7')](_0x7b7e('0x1d2'),_0x209c89));}}})[_0x7b7e('0x9d')](loggerGetContactDialer(_0x7b7e('0x1d3'),_0x209c89,0x1));emitVoiceQueueSummary(_0x209c89);};Dialer[_0x7b7e('0x1a')][_0x7b7e('0x1a7')]=function(_0x3eb0c0,_0xd6293e,_0x2dc993,_0x20a924,_0x3b1457,_0x5c9939){loggerPredictive['info']('[abandonmentRate]','\x20m\x20=\x20',_0x3eb0c0,_0x7b7e('0x1d4'),_0xd6293e,_0x7b7e('0x1d5'),_0x2dc993,_0x7b7e('0x1d6'),_0x20a924,_0x7b7e('0x1d7'),_0x3b1457);return new BPromise(function(_0x45b479,_0x2d5da4){if(_0x3eb0c0<=0x0||isNaN(_0x3eb0c0)){return _0x2d5da4(msgResponse(_0x7b7e('0x1d8'),_0x7b7e('0x48'),_0x7b7e('0x1d9')+_0x3eb0c0));}if(_0x2dc993<=0x0||isNaN(_0x2dc993)){return _0x2d5da4(msgResponse(_0x7b7e('0x1d8'),_0x7b7e('0x48'),_0x7b7e('0x1da')+_0x2dc993));}if(_0x20a924<=0x0||isNaN(_0x20a924)){return _0x2d5da4(msgResponse('[abandonmentRate]',_0x7b7e('0x48'),_0x7b7e('0x1db')+_0x20a924));}if(_0xd6293e<=0x0||isNaN(_0xd6293e)){return _0x2d5da4(msgResponse(_0x7b7e('0x1d8'),_0x7b7e('0x48'),'interval\x20=\x20'+_0xd6293e));}if(_0x3b1457<=0x0||isNaN(_0x3b1457)){return _0x2d5da4(msgResponse(_0x7b7e('0x1d8'),'Error',_0x7b7e('0x1dc')+_0x3b1457));}_0x5c9939=_0x5c9939||0x0;var _0x411788=0x1/_0x2dc993;var _0x3f7233=0x0;var _0x1bf318=0x0;var _0x1dae4e=0x0;var _0x5322ce=0x0;for(var _0x53d3e3=0x0;_0x1dae4e<_0x3b1457;_0x53d3e3+=0x1){_0x1bf318=_0x53d3e3/_0xd6293e;_0x3f7233=(_0x20a924*_0x1bf318+_0x5c9939)/_0x411788;_0x1dae4e=erlangb(_0x3f7233,_0x3eb0c0);_0x5322ce=_0x3f7233/_0x3eb0c0*(0x1-erlangb(_0x3f7233,_0x3eb0c0));}return _0x45b479({'erlangCalls':_0x53d3e3,'erlangCallToSecond':_0xd6293e/_0x53d3e3,'erlangAbandonmentRate':_0x1dae4e,'erlangBusyFactor':_0x5322ce});});};Dialer[_0x7b7e('0x1a')][_0x7b7e('0x1aa')]=function(_0x40dd98,_0x4ef312,_0x4ac1fa,_0x5b4a74,_0x1e2a70,_0x12593f){loggerPredictive[_0x7b7e('0x78')](_0x7b7e('0x1dd'),_0x7b7e('0x1de'),_0x40dd98,_0x7b7e('0x1d4'),_0x4ef312,'\x20Ts\x20=\x20',_0x4ac1fa,_0x7b7e('0x1d6'),_0x5b4a74,_0x7b7e('0x1df'),_0x1e2a70);return new BPromise(function(_0x40285a,_0x12999b){if(_0x40dd98<=0x0||isNaN(_0x40dd98)){return _0x12999b(msgResponse(_0x7b7e('0x1d8'),_0x7b7e('0x48'),_0x7b7e('0x1d9')+_0x40dd98));}if(_0x4ac1fa<=0x0||isNaN(_0x4ac1fa)){return _0x12999b(msgResponse(_0x7b7e('0x1d8'),_0x7b7e('0x48'),_0x7b7e('0x1da')+_0x4ac1fa));}if(_0x5b4a74<=0x0||isNaN(_0x5b4a74)){return _0x12999b(msgResponse('[abandonmentRate]','Error','p\x20=\x20'+_0x5b4a74));}if(_0x4ef312<=0x0||isNaN(_0x4ef312)){return _0x12999b(msgResponse(_0x7b7e('0x1d8'),_0x7b7e('0x48'),'interval\x20=\x20'+_0x4ef312));}if(_0x1e2a70<=0x0||isNaN(_0x1e2a70)){return _0x12999b(msgResponse(_0x7b7e('0x1d8'),_0x7b7e('0x48'),_0x7b7e('0x1dc')+_0x1e2a70));}_0x12593f=_0x12593f||0x0;var _0x4dbb31=0x1/_0x4ac1fa;var _0x3d3a27=0x0;var _0x330698=0x0;var _0x55a93f=0x0;var _0x2127f9=0x0;for(var _0x578f69=0x0;_0x2127f9<_0x1e2a70;_0x578f69+=0x1){_0x330698=_0x578f69/_0x4ef312;_0x3d3a27=(_0x5b4a74*_0x330698+_0x12593f)/_0x4dbb31;_0x55a93f=erlangb(_0x3d3a27,_0x40dd98);_0x2127f9=_0x3d3a27/_0x40dd98*(0x1-erlangb(_0x3d3a27,_0x40dd98));}return _0x40285a({'erlangCalls':_0x578f69,'erlangCallToSecond':_0x4ef312/_0x578f69,'erlangAbandonmentRate':_0x55a93f,'erlangBusyFactor':_0x2127f9});});};module[_0x7b7e('0x1e0')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 852908d..405162f 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 _0x8f7d=['endtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime'];(function(_0x23d7e4,_0x5d4f4a){var _0x46f716=function(_0x2ba5e9){while(--_0x2ba5e9){_0x23d7e4['push'](_0x23d7e4['shift']());}};_0x46f716(++_0x5d4f4a);}(_0x8f7d,0x7f));var _0xd8f7=function(_0x24b88e,_0x6f1d0a){_0x24b88e=_0x24b88e-0x0;var _0x26f9cd=_0x8f7d[_0x24b88e];return _0x26f9cd;};'use strict';var util=require(_0xd8f7('0x0'));var _=require(_0xd8f7('0x1'));var moment=require(_0xd8f7('0x2'));function getSeconds(_0x3d9e0f,_0x481775){var _0x21b265=moment(_0x3d9e0f)[_0xd8f7('0x3')](0x0);var _0x48f3c6=moment(_0x481775)[_0xd8f7('0x3')](0x0);return _0x21b265[_0xd8f7('0x4')](_0x48f3c6,_0xd8f7('0x5'));}function QueueCallerAbandon(_0x362bfb,_0x18abce){this[_0xd8f7('0x6')]=_0x362bfb[_0xd8f7('0x6')];this[_0xd8f7('0x7')]=_0x362bfb[_0xd8f7('0x7')];this[_0xd8f7('0x8')]=_0x362bfb['type']===_0xd8f7('0x9')?_0xd8f7('0xa'):_0x362bfb['type'];this[_0xd8f7('0xb')]=_0x362bfb['countbusyretry'];this[_0xd8f7('0xc')]=_0x362bfb[_0xd8f7('0xc')];this[_0xd8f7('0xd')]=_0x362bfb[_0xd8f7('0xd')];this['countglobal']=_0x362bfb['countbusyretry']+_0x362bfb[_0xd8f7('0xc')]+_0x362bfb[_0xd8f7('0xd')];this[_0xd8f7('0xe')]=_0x18abce['uniqueid'];this[_0xd8f7('0xf')]=_0x362bfb[_0xd8f7('0x10')];this['calleridnum']=_0x362bfb[_0xd8f7('0x11')];this['starttime']=_0x362bfb[_0xd8f7('0x12')];this['responsetime']=_0x362bfb[_0xd8f7('0x13')];this['droptime']=_0x362bfb[_0xd8f7('0x14')];this[_0xd8f7('0x15')]=this[_0xd8f7('0x14')];this['ringtime']=getSeconds(_0x362bfb[_0xd8f7('0x13')],_0x362bfb[_0xd8f7('0x12')]);this[_0xd8f7('0x16')]=getSeconds(this[_0xd8f7('0x14')],_0x362bfb[_0xd8f7('0x13')]);this[_0xd8f7('0x17')]=0x0;this[_0xd8f7('0xa')]=_0x18abce[_0xd8f7('0xa')];this[_0xd8f7('0x18')]=_0x18abce[_0xd8f7('0x19')];this[_0xd8f7('0x1a')]=_0x18abce[_0xd8f7('0x1a')];this[_0xd8f7('0x1b')]=_0x362bfb[_0xd8f7('0x1b')];this[_0xd8f7('0x1c')]=_0x362bfb['callbackuniqueid'];this[_0xd8f7('0x1d')]=_0x362bfb[_0xd8f7('0x1d')];this[_0xd8f7('0x1e')]=_0x362bfb['recallme'];this[_0xd8f7('0x1f')]=_0x362bfb['ContactId'];this['ListId']=_0x362bfb['ListId'];this['UserId']=_0x362bfb['UserId'];this['VoiceQueueId']=_0x362bfb[_0xd8f7('0x20')];this[_0xd8f7('0x21')]=_0x362bfb['CampaignId'];this[_0xd8f7('0x22')]=_0x362bfb[_0xd8f7('0x22')]||'';this[_0xd8f7('0x23')]=_0x362bfb[_0xd8f7('0x23')]||'';}module[_0xd8f7('0x24')]=QueueCallerAbandon; \ No newline at end of file +var _0xf155=['connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','lodash','milliseconds','diff','seconds','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','calleridname','calleridnum','starttime','responsetime','droptime','endtime','ringtime','talktime','queue'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xf155,0x1b9));var _0x5f15=function(_0x3c6c1b,_0x82a1e4){_0x3c6c1b=_0x3c6c1b-0x0;var _0x15170e=_0xf155[_0x3c6c1b];return _0x15170e;};'use strict';var util=require('util');var _=require(_0x5f15('0x0'));var moment=require('moment');function getSeconds(_0x1aa6eb,_0x1d07d8){var _0x2b9493=moment(_0x1aa6eb)['milliseconds'](0x0);var _0x54d42c=moment(_0x1d07d8)[_0x5f15('0x1')](0x0);return _0x2b9493[_0x5f15('0x2')](_0x54d42c,_0x5f15('0x3'));}function QueueCallerAbandon(_0x4df6d8,_0x41de19){this[_0x5f15('0x4')]=_0x4df6d8['scheduledat'];this[_0x5f15('0x5')]=_0x4df6d8[_0x5f15('0x5')];this['campaigntype']=_0x4df6d8['type']===_0x5f15('0x6')?'queue':_0x4df6d8[_0x5f15('0x5')];this[_0x5f15('0x7')]=_0x4df6d8['countbusyretry'];this[_0x5f15('0x8')]=_0x4df6d8[_0x5f15('0x8')];this[_0x5f15('0x9')]=_0x4df6d8['countnoanswerretry'];this[_0x5f15('0xa')]=_0x4df6d8['countbusyretry']+_0x4df6d8[_0x5f15('0x8')]+_0x4df6d8[_0x5f15('0x9')];this[_0x5f15('0xb')]=_0x41de19[_0x5f15('0xb')];this[_0x5f15('0xc')]=_0x4df6d8['name'];this[_0x5f15('0xd')]=_0x4df6d8['number'];this[_0x5f15('0xe')]=_0x4df6d8['starttime'];this[_0x5f15('0xf')]=_0x4df6d8[_0x5f15('0xf')];this[_0x5f15('0x10')]=_0x4df6d8[_0x5f15('0x10')];this[_0x5f15('0x11')]=this[_0x5f15('0x10')];this[_0x5f15('0x12')]=getSeconds(_0x4df6d8['responsetime'],_0x4df6d8['starttime']);this['holdtime']=getSeconds(this[_0x5f15('0x10')],_0x4df6d8[_0x5f15('0xf')]);this[_0x5f15('0x13')]=0x0;this[_0x5f15('0x14')]=_0x41de19[_0x5f15('0x14')];this['membername']=_0x41de19[_0x5f15('0x15')];this[_0x5f15('0x16')]=_0x41de19[_0x5f15('0x16')];this[_0x5f15('0x17')]=_0x4df6d8[_0x5f15('0x17')];this[_0x5f15('0x18')]=_0x4df6d8['callbackuniqueid'];this[_0x5f15('0x19')]=_0x4df6d8['callbackat'];this[_0x5f15('0x1a')]=_0x4df6d8[_0x5f15('0x1a')];this[_0x5f15('0x1b')]=_0x4df6d8[_0x5f15('0x1b')];this[_0x5f15('0x1c')]=_0x4df6d8[_0x5f15('0x1c')];this[_0x5f15('0x1d')]=_0x4df6d8[_0x5f15('0x1d')];this[_0x5f15('0x1e')]=_0x4df6d8[_0x5f15('0x1e')];this[_0x5f15('0x1f')]=_0x4df6d8[_0x5f15('0x1f')];this['originatecalleridnum']=_0x4df6d8['originatecalleridnum']||'';this['originatecalleridname']=_0x4df6d8[_0x5f15('0x20')]||'';}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 5243d7d..0e9f307 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 _0xa513=['localstationid','headerinfo','path','AttachmentId','exports','util','lodash','moment','uniqueid','channel','format','%s/%s/%s','tech','Trunk','name','fax'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa513,0xd5));var _0x3a51=function(_0x368e50,_0x1a8ea3){_0x368e50=_0x368e50-0x0;var _0x13214b=_0xa513[_0x368e50];return _0x13214b;};'use strict';var util=require(_0x3a51('0x0'));var _=require(_0x3a51('0x1'));var moment=require(_0x3a51('0x2'));function Action(_0xba64ea,_0x3f019b,_0x3625f){this[_0x3a51('0x3')]=_0xba64ea||undefined;this[_0x3a51('0x4')]=util[_0x3a51('0x5')](_0x3a51('0x6'),_0x3f019b[_0x3a51('0x7')],_0x3f019b[_0x3a51('0x8')][_0x3a51('0x9')],_0x3625f[_0x3a51('0xa')]);this[_0x3a51('0xb')]=_0x3f019b['localstationid'];this['headerinfo']=_0x3f019b[_0x3a51('0xc')];this[_0x3a51('0xd')]=_0x3625f['path'];this[_0x3a51('0xe')]=_0x3625f[_0x3a51('0xe')];}module[_0x3a51('0xf')]=Action; \ No newline at end of file +var _0x4428=['localstationid','headerinfo','path','AttachmentId','util','lodash','moment','uniqueid','format','%s/%s/%s','Trunk','name','fax'];(function(_0x11451d,_0xcf7903){var _0x360a51=function(_0x1b63f6){while(--_0x1b63f6){_0x11451d['push'](_0x11451d['shift']());}};_0x360a51(++_0xcf7903);}(_0x4428,0x170));var _0x8442=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x4428[_0x1deb03];return _0x189fe7;};'use strict';var util=require(_0x8442('0x0'));var _=require(_0x8442('0x1'));var moment=require(_0x8442('0x2'));function Action(_0x3825de,_0xabd815,_0x53cd88){this[_0x8442('0x3')]=_0x3825de||undefined;this['channel']=util[_0x8442('0x4')](_0x8442('0x5'),_0xabd815['tech'],_0xabd815[_0x8442('0x6')][_0x8442('0x7')],_0x53cd88[_0x8442('0x8')]);this[_0x8442('0x9')]=_0xabd815[_0x8442('0x9')];this[_0x8442('0xa')]=_0xabd815[_0x8442('0xa')];this['path']=_0x53cd88[_0x8442('0xb')];this[_0x8442('0xc')]=_0x53cd88['AttachmentId'];}module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 11c3e54..9a9bc9a 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 _0xf114=['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','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Empty\x20Fax','Is\x20Valid','exports','util','lodash','tiff2pdf','./util/gs','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','faxAccounts','trunks','newchannel','syncNewchannel','bind','syncVarSet','syncNewState','newexten','syncNewExten','syncFaxStatus','receivefax','syncHangup','originateresponse','context','from-voip-provider','hasOwnProperty','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','value','channelstate','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','\x20result\x20conversion\x20file\x20','message','parse','application/pdf','then','calleridnum','fax','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','actions','merge','pick','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20failed','checkAfterSend'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf114,0x168));var _0x4f11=function(_0xc6f416,_0x5e4f6d){_0xc6f416=_0xc6f416-0x0;var _0x48db2e=_0xf114[_0xc6f416];return _0x48db2e;};'use strict';var util=require(_0x4f11('0x0'));var _=require(_0x4f11('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require('moment');var path=require('path');var tiff2pdf=require(_0x4f11('0x2'));var gs=require(_0x4f11('0x3'));var logger=require('../../../config/logger')('fax');var ami=require('../ami');var rpcDb=require(_0x4f11('0x4'));var Channel=require(_0x4f11('0x5'));var ut=require(_0x4f11('0x6'));var Action=require(_0x4f11('0x7'));var faxAccount=require(_0x4f11('0x8'));var attachment=require(_0x4f11('0x9'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x3a9f00){this['channels']={};this[_0x4f11('0xa')]=_0x3a9f00[_0x4f11('0xa')];this[_0x4f11('0xb')]=_0x3a9f00[_0x4f11('0xb')];this['actions']={};ami['on'](_0x4f11('0xc'),this[_0x4f11('0xd')][_0x4f11('0xe')](this));ami['on']('varset',this[_0x4f11('0xf')][_0x4f11('0xe')](this));ami['on']('newstate',this[_0x4f11('0x10')][_0x4f11('0xe')](this));ami['on'](_0x4f11('0x11'),this[_0x4f11('0x12')][_0x4f11('0xe')](this));ami['on']('faxstatus',this[_0x4f11('0x13')][_0x4f11('0xe')](this));ami['on'](_0x4f11('0x14'),this['syncReceiveFax']['bind'](this));ami['on']('hangup',this[_0x4f11('0x15')][_0x4f11('0xe')](this));ami['on'](_0x4f11('0x16'),this['syncOriginateResponse'][_0x4f11('0xe')](this));}Fax['prototype'][_0x4f11('0xd')]=function(_0x1d0a78){if(_0x1d0a78[_0x4f11('0x17')]===_0x4f11('0x18')){for(var _0x3225ad in this['faxAccounts']){if(this[_0x4f11('0xa')][_0x4f11('0x19')](_0x3225ad)){if(_0x1d0a78['exten']===this[_0x4f11('0xa')][_0x3225ad][_0x4f11('0x1a')]){this[_0x4f11('0x1b')][_0x1d0a78[_0x4f11('0x1c')]]={};this[_0x4f11('0x1b')][_0x1d0a78[_0x4f11('0x1c')]][_0x4f11('0x1d')]=_0x1d0a78[_0x4f11('0x1d')];this[_0x4f11('0x1b')][_0x1d0a78[_0x4f11('0x1c')]]['id']=this[_0x4f11('0xa')][_0x3225ad]['id'];this[_0x4f11('0x1b')][_0x1d0a78[_0x4f11('0x1c')]][_0x4f11('0x1e')]=this[_0x4f11('0xa')][_0x3225ad]['name'];logger[_0x4f11('0x1f')](_0x1d0a78[_0x4f11('0x1c')],_0x4f11('0x20'));}}}}if(this['actions'][_0x1d0a78['uniqueid']]){this[_0x4f11('0x1b')][_0x1d0a78['uniqueid']]={};this[_0x4f11('0x1b')][_0x1d0a78[_0x4f11('0x1c')]][_0x4f11('0x1d')]=_0x1d0a78[_0x4f11('0x1d')];logger[_0x4f11('0x1f')](_0x1d0a78[_0x4f11('0x1c')],'\x20syncNewchannel\x20');}};Fax[_0x4f11('0x21')][_0x4f11('0xf')]=function(_0x3d9924){if(this[_0x4f11('0x1b')][_0x3d9924['uniqueid']]){for(var _0x1e4280 in _0x3d9924[_0x4f11('0x22')]){if(_0x3d9924[_0x4f11('0x22')][_0x4f11('0x19')](_0x1e4280)){this[_0x4f11('0x1b')][_0x3d9924[_0x4f11('0x1c')]][_0x1e4280]=_0x3d9924[_0x4f11('0x23')];}}}};Fax['prototype'][_0x4f11('0x10')]=function(_0x389678){if(this[_0x4f11('0x1b')][_0x389678[_0x4f11('0x1c')]]){this[_0x4f11('0x1b')][_0x389678[_0x4f11('0x1c')]][_0x4f11('0x24')]=_0x389678['channelstate'];this[_0x4f11('0x1b')][_0x389678[_0x4f11('0x1c')]]['channelstatedesc']=_0x389678['channelstatedesc'];}};Fax[_0x4f11('0x21')][_0x4f11('0x12')]=function(_0xbe48a0){if(this['channels'][_0xbe48a0[_0x4f11('0x1c')]]){for(var _0x3b2ab4 in _0xbe48a0['variable']){if(_0xbe48a0[_0x4f11('0x22')][_0x4f11('0x19')](_0x3b2ab4)){this[_0x4f11('0x1b')][_0xbe48a0['uniqueid']][_0x3b2ab4]=_0xbe48a0[_0x4f11('0x23')];}}}};Fax['prototype'][_0x4f11('0x13')]=function(_0xb87b48){if(this['channels'][_0xb87b48[_0x4f11('0x1c')]]){this['channels'][_0xb87b48[_0x4f11('0x1c')]][_0x4f11('0x25')]=_0xb87b48[_0x4f11('0x25')];this[_0x4f11('0x1b')][_0xb87b48[_0x4f11('0x1c')]]['status']=_0xb87b48[_0x4f11('0x26')];this[_0x4f11('0x1b')][_0xb87b48[_0x4f11('0x1c')]]['localstationid']=_0xb87b48[_0x4f11('0x1a')];this['channels'][_0xb87b48['uniqueid']][_0x4f11('0x27')]=_0xb87b48['filename'];logger['info'](_0xb87b48[_0x4f11('0x1c')],_0x4f11('0x28'));}};Fax[_0x4f11('0x21')][_0x4f11('0x29')]=function(_0x3561de){var _0x5230aa=this;if(this[_0x4f11('0x1b')][_0x3561de[_0x4f11('0x1c')]]){var _0x5e590d=this[_0x4f11('0x1b')][_0x3561de[_0x4f11('0x1c')]]['id'];this[_0x4f11('0x1b')][_0x3561de[_0x4f11('0x1c')]][_0x4f11('0x2a')]=_0x3561de['remotestationid'];this[_0x4f11('0x1b')][_0x3561de[_0x4f11('0x1c')]][_0x4f11('0x2b')]=_0x3561de['pagestransferred'];this[_0x4f11('0x1b')][_0x3561de[_0x4f11('0x1c')]][_0x4f11('0x1a')]=_0x3561de[_0x4f11('0x1a')];this[_0x4f11('0x1b')][_0x3561de[_0x4f11('0x1c')]][_0x4f11('0x2c')]=_0x3561de[_0x4f11('0x2c')];this['channels'][_0x3561de['uniqueid']][_0x4f11('0x2d')]=_0x3561de[_0x4f11('0x2d')];this['channels'][_0x3561de['uniqueid']]['filename']=_0x3561de[_0x4f11('0x27')];this[_0x4f11('0x1b')][_0x3561de['uniqueid']]['calleridnum']=_0x3561de['calleridnum'];if(this[_0x4f11('0x1b')][_0x3561de[_0x4f11('0x1c')]][_0x4f11('0x2b')]>0x0){tiff2pdf(_0x3561de[_0x4f11('0x27')],'/var/opt/motion2/server/files/attachments/',function(_0x18af38){logger[_0x4f11('0x1f')](_0x3561de[_0x4f11('0x1c')],_0x4f11('0x2e'),_0x18af38[_0x4f11('0x2f')]);attachment['create']({'name':path[_0x4f11('0x30')](_0x3561de['filename'])['name'],'basename':path['parse'](_0x3561de['filename'])[_0x4f11('0x1e')]+'.pdf','type':_0x4f11('0x31')})[_0x4f11('0x32')](function(_0x29b2d6){faxAccount['notify'](_0x5e590d,{'from':_0x3561de[_0x4f11('0x33')],'mapKey':_0x4f11('0x34'),'body':path['parse'](_0x3561de[_0x4f11('0x27')])[_0x4f11('0x1e')]+_0x4f11('0x35'),'AttachmentId':_0x29b2d6['id']})[_0x4f11('0x36')](function(_0x59b344){logger[_0x4f11('0x37')](_0x3561de[_0x4f11('0x1c')],_0x4f11('0x38'),JSON[_0x4f11('0x39')](_0x59b344));});})[_0x4f11('0x36')](function(_0x250360){logger[_0x4f11('0x37')](_0x3561de[_0x4f11('0x1c')],_0x4f11('0x3a'),JSON[_0x4f11('0x39')](_0x250360));});});}logger[_0x4f11('0x1f')](_0x3561de[_0x4f11('0x1c')],'\x20receiveFax\x20');}};Fax[_0x4f11('0x21')]['syncOriginateResponse']=function(_0x1cbe3){if(this[_0x4f11('0x3b')][_0x1cbe3[_0x4f11('0x1c')]]){_[_0x4f11('0x3c')](this[_0x4f11('0x1b')][_0x1cbe3['uniqueid']],_[_0x4f11('0x3d')](_0x1cbe3,[_0x4f11('0x3e'),_0x4f11('0x3f')]));}};function updateStatus(_0x427182){if(_0x427182['AttachmentId']){faxMessage[_0x4f11('0x40')](_0x427182[_0x4f11('0x41')],{'failMessage':_0x4f11('0x42')})[_0x4f11('0x32')](function(_0x794813){ut['logger'](_0x4f11('0x43'),_0x794813);})[_0x4f11('0x36')](function(_0x54ee2a){ut[_0x4f11('0x44')](_0x4f11('0x45'),_0x54ee2a);});}else{ut[_0x4f11('0x44')](_0x4f11('0x46'));}}Fax[_0x4f11('0x21')][_0x4f11('0x47')]=function(_0x40bb6c,_0x5b6e32,_0x2961d0){var _0x4e8609=this;var _0x519718={};if(_0x5b6e32){_0x519718={'read':_0x5b6e32};}else{_0x519718={'failMessage':_0x2961d0};}if(this['actions'][_0x40bb6c][_0x4f11('0x41')]){faxMessage[_0x4f11('0x40')](this[_0x4f11('0x3b')][_0x40bb6c][_0x4f11('0x41')],_0x519718)[_0x4f11('0x32')](function(_0x4f7766){ut[_0x4f11('0x44')](_0x4f11('0x48'),_0x4f7766);})[_0x4f11('0x36')](function(_0x218450){ut['logger'](_0x4f11('0x49'),_0x218450);})[_0x4f11('0x4a')](function(){delete _0x4e8609['channels'][_0x40bb6c];delete _0x4e8609[_0x4f11('0x3b')][_0x40bb6c];});}else{ut[_0x4f11('0x44')](_0x4f11('0x4b'));delete this['channels'][_0x40bb6c];delete this[_0x4f11('0x3b')][_0x40bb6c];}};Fax[_0x4f11('0x21')]['syncHangup']=function(_0x5229ff){var _0x3eed98=this;if(this['channels'][_0x5229ff['uniqueid']]){if(this[_0x4f11('0x3b')][_0x5229ff[_0x4f11('0x1c')]]){this[_0x4f11('0x1b')][_0x5229ff[_0x4f11('0x1c')]]['id']=this[_0x4f11('0x3b')][_0x5229ff[_0x4f11('0x1c')]]['id'];this[_0x4f11('0x1b')][_0x5229ff[_0x4f11('0x1c')]][_0x4f11('0x1e')]=this[_0x4f11('0x3b')][_0x5229ff['uniqueid']][_0x4f11('0x1e')];}logger[_0x4f11('0x1f')](_0x5229ff[_0x4f11('0x1c')],this[_0x4f11('0x3b')][_0x5229ff['uniqueid']]?_0x4f11('0x4c'):_0x4f11('0x4d'),JSON[_0x4f11('0x39')](this[_0x4f11('0x1b')][_0x5229ff[_0x4f11('0x1c')]]));if(this[_0x4f11('0x3b')][_0x5229ff[_0x4f11('0x1c')]]){if(this[_0x4f11('0x1b')][_0x5229ff['uniqueid']]['faxpages']>0x0&&this[_0x4f11('0x1b')][_0x5229ff[_0x4f11('0x1c')]][_0x4f11('0x4e')]===_0x4f11('0x4f')){this[_0x4f11('0x47')](_0x5229ff[_0x4f11('0x1c')],!![]);}else{this[_0x4f11('0x47')](_0x5229ff[_0x4f11('0x1c')],![],this[_0x4f11('0x1b')][_0x5229ff[_0x4f11('0x1c')]][_0x4f11('0x50')]?'SENDING\x20FAILED:\x20'+this['channels'][_0x5229ff[_0x4f11('0x1c')]]['faxstatusstring']:_0x4f11('0x51'));}}}};Fax['prototype'][_0x4f11('0x52')]=function(_0x58b7bf){var _0x491335=this;return new BPromise(function(_0x55c61b,_0x4d72bf){_0x491335[_0x4f11('0x53')](_0x58b7bf,_0x491335[_0x4f11('0xa')][_0x58b7bf[_0x4f11('0x54')]])[_0x4f11('0x32')](function(_0x38b008){ut['logger'](_0x4f11('0x55'),_0x38b008);_0x55c61b(ut[_0x4f11('0x2f')]('Fax\x20received'));})[_0x4f11('0x36')](function(_0xf0db86){ut['logger']('[Fax][execOriginate][failure]',_0xf0db86);updateStatus(_0x58b7bf);_0x4d72bf(ut[_0x4f11('0x2f')](_0x4f11('0x56')));});});};Fax[_0x4f11('0x21')][_0x4f11('0x57')]=function(_0x58f6ec){var _0xeaf696=this;return new BPromise(function(_0x5e34ac,_0x413236){var _0x56fa92=_0xeaf696[_0x4f11('0x58')](_0xeaf696['faxAccounts'][_0x58f6ec[_0x4f11('0x54')]][_0x4f11('0x59')],_0x58f6ec);if(_0x56fa92[_0x4f11('0x5a')]){_0x5e34ac(ut['message'](_0x4f11('0x5b')));}else{_0x413236(ut[_0x4f11('0x2f')](_0x56fa92[_0x4f11('0x2f')]));}});};function originate(_0x579779,_0x2b8399,_0x3b0720){return new BPromise(function(_0x40d705,_0x38036d){if(_0x3b0720){var _0x847e8b=util[_0x4f11('0x5c')](_0x4f11('0x5d'),path[_0x4f11('0x30')](_0x579779[_0x4f11('0x5e')])[_0x4f11('0x1e')],_0x579779[_0x4f11('0x5e')]);gs[_0x4f11('0x5f')](_0x847e8b)[_0x4f11('0x32')](function(){_0x579779[_0x4f11('0x5e')]=util['format'](_0x4f11('0x60'),path[_0x4f11('0x30')](_0x579779[_0x4f11('0x5e')])[_0x4f11('0x61')],path[_0x4f11('0x30')](_0x579779['path'])['name']);_0x2b8399['XMF-PATH']=_0x579779[_0x4f11('0x5e')];ut[_0x4f11('0x44')](_0x4f11('0x62'),'');ami[_0x4f11('0x63')](ut[_0x4f11('0x64')](_0x579779,_0x2b8399))[_0x4f11('0x32')](function(_0x37332a){_0x40d705(_0x37332a);})[_0x4f11('0x36')](function(_0x3fb059){_0x38036d(_0x3fb059);});})[_0x4f11('0x36')](function(_0x167f5f){_0x38036d(_0x167f5f);});}else{ami[_0x4f11('0x63')](ut[_0x4f11('0x64')](_0x579779,_0x2b8399))[_0x4f11('0x32')](function(_0x5bcfdf){_0x40d705(_0x5bcfdf);})[_0x4f11('0x36')](function(_0x363d94){_0x38036d(_0x363d94);});}});}Fax[_0x4f11('0x21')]['execOriginate']=function(_0x34cdc1,_0x4020e6){var _0x36553b=this;return new BPromise(function(_0x115fa8,_0x51795c){var _0x230499=uuid['v4']();var _0x1ef9f7=ut[_0x4f11('0x65')](_0x34cdc1,_0x4020e6);_0x36553b[_0x4f11('0x3b')][_0x230499]=new Action(_0x230499,_0x4020e6,_0x34cdc1);var _0x522ea6=_0x36553b[_0x4f11('0x3b')][_0x230499];if(path[_0x4f11('0x30')](_0x34cdc1[_0x4f11('0x5e')])[_0x4f11('0x66')]===_0x4f11('0x35')){originate(_0x522ea6,_0x1ef9f7,!![])['then'](function(_0x37702a){_0x115fa8(_0x37702a);})['catch'](function(_0x4c721e){_0x51795c(_0x4c721e);});}else{originate(_0x522ea6,_0x1ef9f7,![])[_0x4f11('0x32')](function(_0x4cec99){_0x115fa8(_0x4cec99);})['catch'](function(_0x5646e5){_0x51795c(_0x5646e5);});}});};Fax[_0x4f11('0x21')][_0x4f11('0x67')]=function(_0x3af7e8){return!_['isNil'](_0x3af7e8)&&!_[_0x4f11('0x68')](_0x3af7e8[_0x4f11('0x1e')])&&!_[_0x4f11('0x68')](_0x3af7e8['active'])&&_0x3af7e8[_0x4f11('0x69')]&&!_['isNil'](this['trunks'][util[_0x4f11('0x5c')](_0x4f11('0x6a'),_0x3af7e8[_0x4f11('0x1e')])])&&!_[_0x4f11('0x68')](this[_0x4f11('0xb')][util['format'](_0x4f11('0x6a'),_0x3af7e8['name'])][_0x4f11('0x26')])&&(this[_0x4f11('0xb')][util[_0x4f11('0x5c')](_0x4f11('0x6a'),_0x3af7e8[_0x4f11('0x1e')])][_0x4f11('0x26')]==='reachable'||this[_0x4f11('0xb')][util[_0x4f11('0x5c')](_0x4f11('0x6a'),_0x3af7e8[_0x4f11('0x1e')])][_0x4f11('0x26')]==='unmonitored');};Fax['prototype']['checkTrunk']=function(_0x5ed76a,_0x32f68a){if(!this[_0x4f11('0x67')](_0x5ed76a)){ut['logger'](_0x4f11('0x6b'),_['isNil'](_0x5ed76a)?'':_0x5ed76a[_0x4f11('0x1e')]+_0x4f11('0x6c'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x4f11('0x68')](_0x32f68a[_0x4f11('0x34')])){ut[_0x4f11('0x44')]('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0x32f68a));return{'isValid':![],'message':_0x4f11('0x6d')};}if(_['isNil'](_0x32f68a[_0x4f11('0x5e')])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x32f68a));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x4f11('0x6e')};};module[_0x4f11('0x6f')]=Fax; \ No newline at end of file +var _0x9a5d=['Fax\x20failed','checkTrunk','Trunk','Trunk\x20Reachable','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','uuid','path','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','newstate','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','syncNewState','channelstate','channelstatedesc','syncNewExten','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','create','parse','.pdf','application/pdf','then','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','response','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','message','Fax\x20received','[Fax][execOriginate][failure]'];(function(_0x247731,_0x5880b7){var _0x113cbf=function(_0x47b2c0){while(--_0x47b2c0){_0x247731['push'](_0x247731['shift']());}};_0x113cbf(++_0x5880b7);}(_0x9a5d,0x1d5));var _0xd9a5=function(_0x5787cb,_0x45363f){_0x5787cb=_0x5787cb-0x0;var _0x438d54=_0x9a5d[_0x5787cb];return _0x438d54;};'use strict';var util=require(_0xd9a5('0x0'));var _=require(_0xd9a5('0x1'));var BPromise=require(_0xd9a5('0x2'));var uuid=require(_0xd9a5('0x3'));var moment=require('moment');var path=require(_0xd9a5('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require(_0xd9a5('0x5'));var logger=require('../../../config/logger')(_0xd9a5('0x6'));var ami=require(_0xd9a5('0x7'));var rpcDb=require(_0xd9a5('0x8'));var Channel=require(_0xd9a5('0x9'));var ut=require(_0xd9a5('0xa'));var Action=require('./action');var faxAccount=require(_0xd9a5('0xb'));var attachment=require(_0xd9a5('0xc'));var faxMessage=require(_0xd9a5('0xd'));function Fax(_0x1358b1){this['channels']={};this[_0xd9a5('0xe')]=_0x1358b1[_0xd9a5('0xe')];this['trunks']=_0x1358b1[_0xd9a5('0xf')];this[_0xd9a5('0x10')]={};ami['on']('newchannel',this[_0xd9a5('0x11')][_0xd9a5('0x12')](this));ami['on'](_0xd9a5('0x13'),this[_0xd9a5('0x14')][_0xd9a5('0x12')](this));ami['on'](_0xd9a5('0x15'),this['syncNewState'][_0xd9a5('0x12')](this));ami['on']('newexten',this['syncNewExten'][_0xd9a5('0x12')](this));ami['on'](_0xd9a5('0x16'),this[_0xd9a5('0x17')][_0xd9a5('0x12')](this));ami['on'](_0xd9a5('0x18'),this[_0xd9a5('0x19')][_0xd9a5('0x12')](this));ami['on'](_0xd9a5('0x1a'),this[_0xd9a5('0x1b')][_0xd9a5('0x12')](this));ami['on']('originateresponse',this[_0xd9a5('0x1c')][_0xd9a5('0x12')](this));}Fax[_0xd9a5('0x1d')][_0xd9a5('0x11')]=function(_0x36a8c9){if(_0x36a8c9[_0xd9a5('0x1e')]===_0xd9a5('0x1f')){for(var _0x1182c3 in this[_0xd9a5('0xe')]){if(this[_0xd9a5('0xe')][_0xd9a5('0x20')](_0x1182c3)){if(_0x36a8c9['exten']===this[_0xd9a5('0xe')][_0x1182c3][_0xd9a5('0x21')]){this[_0xd9a5('0x22')][_0x36a8c9[_0xd9a5('0x23')]]={};this['channels'][_0x36a8c9[_0xd9a5('0x23')]][_0xd9a5('0x24')]=_0x36a8c9['channel'];this[_0xd9a5('0x22')][_0x36a8c9[_0xd9a5('0x23')]]['id']=this['faxAccounts'][_0x1182c3]['id'];this[_0xd9a5('0x22')][_0x36a8c9['uniqueid']]['name']=this[_0xd9a5('0xe')][_0x1182c3][_0xd9a5('0x25')];logger[_0xd9a5('0x26')](_0x36a8c9[_0xd9a5('0x23')],_0xd9a5('0x27'));}}}}if(this[_0xd9a5('0x10')][_0x36a8c9['uniqueid']]){this['channels'][_0x36a8c9['uniqueid']]={};this[_0xd9a5('0x22')][_0x36a8c9[_0xd9a5('0x23')]]['channel']=_0x36a8c9['channel'];logger[_0xd9a5('0x26')](_0x36a8c9[_0xd9a5('0x23')],'\x20syncNewchannel\x20');}};Fax['prototype']['syncVarSet']=function(_0x1f5939){if(this[_0xd9a5('0x22')][_0x1f5939[_0xd9a5('0x23')]]){for(var _0x26883e in _0x1f5939['variable']){if(_0x1f5939[_0xd9a5('0x28')]['hasOwnProperty'](_0x26883e)){this['channels'][_0x1f5939['uniqueid']][_0x26883e]=_0x1f5939[_0xd9a5('0x29')];}}}};Fax[_0xd9a5('0x1d')][_0xd9a5('0x2a')]=function(_0x781539){if(this[_0xd9a5('0x22')][_0x781539['uniqueid']]){this[_0xd9a5('0x22')][_0x781539['uniqueid']][_0xd9a5('0x2b')]=_0x781539[_0xd9a5('0x2b')];this[_0xd9a5('0x22')][_0x781539[_0xd9a5('0x23')]][_0xd9a5('0x2c')]=_0x781539['channelstatedesc'];}};Fax['prototype'][_0xd9a5('0x2d')]=function(_0xa9db6e){if(this['channels'][_0xa9db6e[_0xd9a5('0x23')]]){for(var _0x1b450c in _0xa9db6e[_0xd9a5('0x28')]){if(_0xa9db6e[_0xd9a5('0x28')][_0xd9a5('0x20')](_0x1b450c)){this[_0xd9a5('0x22')][_0xa9db6e[_0xd9a5('0x23')]][_0x1b450c]=_0xa9db6e[_0xd9a5('0x29')];}}}};Fax[_0xd9a5('0x1d')][_0xd9a5('0x17')]=function(_0x2756c0){if(this[_0xd9a5('0x22')][_0x2756c0[_0xd9a5('0x23')]]){this['channels'][_0x2756c0[_0xd9a5('0x23')]][_0xd9a5('0x2e')]=_0x2756c0[_0xd9a5('0x2e')];this[_0xd9a5('0x22')][_0x2756c0['uniqueid']][_0xd9a5('0x2f')]=_0x2756c0[_0xd9a5('0x2f')];this[_0xd9a5('0x22')][_0x2756c0[_0xd9a5('0x23')]][_0xd9a5('0x21')]=_0x2756c0[_0xd9a5('0x21')];this[_0xd9a5('0x22')][_0x2756c0[_0xd9a5('0x23')]][_0xd9a5('0x30')]=_0x2756c0[_0xd9a5('0x30')];logger[_0xd9a5('0x26')](_0x2756c0[_0xd9a5('0x23')],'\x20syncFaxStatus\x20');}};Fax[_0xd9a5('0x1d')][_0xd9a5('0x19')]=function(_0x2219c3){var _0x432a3f=this;if(this[_0xd9a5('0x22')][_0x2219c3[_0xd9a5('0x23')]]){var _0x41f17c=this[_0xd9a5('0x22')][_0x2219c3['uniqueid']]['id'];this[_0xd9a5('0x22')][_0x2219c3[_0xd9a5('0x23')]][_0xd9a5('0x31')]=_0x2219c3[_0xd9a5('0x31')];this[_0xd9a5('0x22')][_0x2219c3['uniqueid']][_0xd9a5('0x32')]=_0x2219c3[_0xd9a5('0x32')];this[_0xd9a5('0x22')][_0x2219c3[_0xd9a5('0x23')]]['localstationid']=_0x2219c3[_0xd9a5('0x21')];this[_0xd9a5('0x22')][_0x2219c3[_0xd9a5('0x23')]][_0xd9a5('0x33')]=_0x2219c3[_0xd9a5('0x33')];this[_0xd9a5('0x22')][_0x2219c3['uniqueid']][_0xd9a5('0x34')]=_0x2219c3[_0xd9a5('0x34')];this[_0xd9a5('0x22')][_0x2219c3[_0xd9a5('0x23')]]['filename']=_0x2219c3[_0xd9a5('0x30')];this[_0xd9a5('0x22')][_0x2219c3[_0xd9a5('0x23')]][_0xd9a5('0x35')]=_0x2219c3[_0xd9a5('0x35')];if(this[_0xd9a5('0x22')][_0x2219c3[_0xd9a5('0x23')]][_0xd9a5('0x32')]>0x0){tiff2pdf(_0x2219c3['filename'],_0xd9a5('0x36'),function(_0x1d20c0){logger[_0xd9a5('0x26')](_0x2219c3[_0xd9a5('0x23')],'\x20result\x20conversion\x20file\x20',_0x1d20c0['message']);attachment[_0xd9a5('0x37')]({'name':path[_0xd9a5('0x38')](_0x2219c3[_0xd9a5('0x30')])['name'],'basename':path[_0xd9a5('0x38')](_0x2219c3['filename'])[_0xd9a5('0x25')]+_0xd9a5('0x39'),'type':_0xd9a5('0x3a')})[_0xd9a5('0x3b')](function(_0x474b35){faxAccount['notify'](_0x41f17c,{'from':_0x2219c3[_0xd9a5('0x35')],'mapKey':_0xd9a5('0x6'),'body':path[_0xd9a5('0x38')](_0x2219c3['filename'])[_0xd9a5('0x25')]+_0xd9a5('0x39'),'AttachmentId':_0x474b35['id']})['catch'](function(_0x18fa3c){logger[_0xd9a5('0x3c')](_0x2219c3[_0xd9a5('0x23')],_0xd9a5('0x3d'),JSON[_0xd9a5('0x3e')](_0x18fa3c));});})[_0xd9a5('0x3f')](function(_0x3d9a19){logger[_0xd9a5('0x3c')](_0x2219c3[_0xd9a5('0x23')],'\x20receiveFax\x20',JSON[_0xd9a5('0x3e')](_0x3d9a19));});});}logger[_0xd9a5('0x26')](_0x2219c3[_0xd9a5('0x23')],_0xd9a5('0x40'));}};Fax['prototype'][_0xd9a5('0x1c')]=function(_0x4acc66){if(this[_0xd9a5('0x10')][_0x4acc66[_0xd9a5('0x23')]]){_['merge'](this['channels'][_0x4acc66['uniqueid']],_['pick'](_0x4acc66,[_0xd9a5('0x41'),'reason']));}};function updateStatus(_0x1c9ef1){if(_0x1c9ef1[_0xd9a5('0x42')]){faxMessage[_0xd9a5('0x43')](_0x1c9ef1['AttachmentId'],{'failMessage':_0xd9a5('0x44')})[_0xd9a5('0x3b')](function(_0x5ef74d){ut['logger'](_0xd9a5('0x45'),_0x5ef74d);})['catch'](function(_0x2cd0d9){ut[_0xd9a5('0x46')](_0xd9a5('0x47'),_0x2cd0d9);});}else{ut[_0xd9a5('0x46')](_0xd9a5('0x48'));}}Fax['prototype'][_0xd9a5('0x49')]=function(_0x3f9565,_0x1084c7,_0x4203dc){var _0x11f07a=this;var _0x2e0123={};if(_0x1084c7){_0x2e0123={'read':_0x1084c7};}else{_0x2e0123={'failMessage':_0x4203dc};}if(this['actions'][_0x3f9565][_0xd9a5('0x42')]){faxMessage[_0xd9a5('0x43')](this['actions'][_0x3f9565]['AttachmentId'],_0x2e0123)[_0xd9a5('0x3b')](function(_0x81f262){ut[_0xd9a5('0x46')]('[Fax][Message][Updated]',_0x81f262);})['catch'](function(_0x313122){ut[_0xd9a5('0x46')]('[Fax][Message][NoUpdate1]',_0x313122);})[_0xd9a5('0x4a')](function(){delete _0x11f07a[_0xd9a5('0x22')][_0x3f9565];delete _0x11f07a[_0xd9a5('0x10')][_0x3f9565];});}else{ut['logger'](_0xd9a5('0x4b'));delete this[_0xd9a5('0x22')][_0x3f9565];delete this[_0xd9a5('0x10')][_0x3f9565];}};Fax[_0xd9a5('0x1d')][_0xd9a5('0x1b')]=function(_0x3d331e){var _0x23611a=this;if(this[_0xd9a5('0x22')][_0x3d331e[_0xd9a5('0x23')]]){if(this[_0xd9a5('0x10')][_0x3d331e[_0xd9a5('0x23')]]){this[_0xd9a5('0x22')][_0x3d331e[_0xd9a5('0x23')]]['id']=this[_0xd9a5('0x10')][_0x3d331e['uniqueid']]['id'];this[_0xd9a5('0x22')][_0x3d331e[_0xd9a5('0x23')]][_0xd9a5('0x25')]=this['actions'][_0x3d331e[_0xd9a5('0x23')]][_0xd9a5('0x25')];}logger[_0xd9a5('0x26')](_0x3d331e[_0xd9a5('0x23')],this[_0xd9a5('0x10')][_0x3d331e[_0xd9a5('0x23')]]?_0xd9a5('0x4c'):'\x20hangup\x20faxRiceive\x20',JSON['stringify'](this['channels'][_0x3d331e[_0xd9a5('0x23')]]));if(this['actions'][_0x3d331e['uniqueid']]){if(this['channels'][_0x3d331e[_0xd9a5('0x23')]][_0xd9a5('0x4d')]>0x0&&this['channels'][_0x3d331e['uniqueid']][_0xd9a5('0x16')]==='SUCCESS'){this['updateStatus'](_0x3d331e[_0xd9a5('0x23')],!![]);}else{this[_0xd9a5('0x49')](_0x3d331e[_0xd9a5('0x23')],![],this[_0xd9a5('0x22')][_0x3d331e[_0xd9a5('0x23')]][_0xd9a5('0x4e')]?_0xd9a5('0x4f')+this[_0xd9a5('0x22')][_0x3d331e['uniqueid']][_0xd9a5('0x4e')]:_0xd9a5('0x50'));}}}};Fax[_0xd9a5('0x1d')]['send']=function(_0x3d5f67){var _0xcea6ee=this;return new BPromise(function(_0x312d2d,_0x13ac7c){_0xcea6ee[_0xd9a5('0x51')](_0x3d5f67,_0xcea6ee[_0xd9a5('0xe')][_0x3d5f67[_0xd9a5('0x52')]])[_0xd9a5('0x3b')](function(_0xde5213){ut[_0xd9a5('0x46')]('[Fax][execOriginate][success]',_0xde5213);_0x312d2d(ut[_0xd9a5('0x53')](_0xd9a5('0x54')));})[_0xd9a5('0x3f')](function(_0x18c672){ut[_0xd9a5('0x46')](_0xd9a5('0x55'),_0x18c672);updateStatus(_0x3d5f67);_0x13ac7c(ut[_0xd9a5('0x53')](_0xd9a5('0x56')));});});};Fax['prototype']['checkAfterSend']=function(_0x146507){var _0x24d53e=this;return new BPromise(function(_0x3253d4,_0x1a2a86){var _0x491750=_0x24d53e[_0xd9a5('0x57')](_0x24d53e['faxAccounts'][_0x146507['FaxAccountId']][_0xd9a5('0x58')],_0x146507);if(_0x491750['isValid']){_0x3253d4(ut['message'](_0xd9a5('0x59')));}else{_0x1a2a86(ut[_0xd9a5('0x53')](_0x491750['message']));}});};function originate(_0x23c4f1,_0x1f7602,_0xcc1015){return new BPromise(function(_0x5ef3df,_0x31dc7c){if(_0xcc1015){var _0x58e87a=util[_0xd9a5('0x5a')]('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[_0xd9a5('0x38')](_0x23c4f1[_0xd9a5('0x4')])[_0xd9a5('0x25')],_0x23c4f1['path']);gs['execute'](_0x58e87a)[_0xd9a5('0x3b')](function(){_0x23c4f1[_0xd9a5('0x4')]=util[_0xd9a5('0x5a')](_0xd9a5('0x5b'),path[_0xd9a5('0x38')](_0x23c4f1[_0xd9a5('0x4')])[_0xd9a5('0x5c')],path[_0xd9a5('0x38')](_0x23c4f1[_0xd9a5('0x4')])[_0xd9a5('0x25')]);_0x1f7602[_0xd9a5('0x5d')]=_0x23c4f1['path'];ut[_0xd9a5('0x46')](_0xd9a5('0x5e'),'');ami[_0xd9a5('0x5f')](ut[_0xd9a5('0x60')](_0x23c4f1,_0x1f7602))[_0xd9a5('0x3b')](function(_0x356cab){_0x5ef3df(_0x356cab);})[_0xd9a5('0x3f')](function(_0x12e6b3){_0x31dc7c(_0x12e6b3);});})['catch'](function(_0x5c0bb7){_0x31dc7c(_0x5c0bb7);});}else{ami[_0xd9a5('0x5f')](ut[_0xd9a5('0x60')](_0x23c4f1,_0x1f7602))[_0xd9a5('0x3b')](function(_0x18bb72){_0x5ef3df(_0x18bb72);})[_0xd9a5('0x3f')](function(_0x3f05f8){_0x31dc7c(_0x3f05f8);});}});}Fax[_0xd9a5('0x1d')][_0xd9a5('0x51')]=function(_0x4b46ea,_0x27712a){var _0x3cb680=this;return new BPromise(function(_0x599cd0,_0x3adc5b){var _0x15d2f5=uuid['v4']();var _0x14f10f=ut[_0xd9a5('0x61')](_0x4b46ea,_0x27712a);_0x3cb680[_0xd9a5('0x10')][_0x15d2f5]=new Action(_0x15d2f5,_0x27712a,_0x4b46ea);var _0x2980a4=_0x3cb680[_0xd9a5('0x10')][_0x15d2f5];if(path[_0xd9a5('0x38')](_0x4b46ea[_0xd9a5('0x4')])[_0xd9a5('0x62')]===_0xd9a5('0x39')){originate(_0x2980a4,_0x14f10f,!![])[_0xd9a5('0x3b')](function(_0x372e5b){_0x599cd0(_0x372e5b);})[_0xd9a5('0x3f')](function(_0x546769){_0x3adc5b(_0x546769);});}else{originate(_0x2980a4,_0x14f10f,![])[_0xd9a5('0x3b')](function(_0x4f66c0){_0x599cd0(_0x4f66c0);})[_0xd9a5('0x3f')](function(_0x53d509){_0x3adc5b(_0x53d509);});}});};Fax['prototype'][_0xd9a5('0x63')]=function(_0x46a2ac){return!_[_0xd9a5('0x64')](_0x46a2ac)&&!_['isNil'](_0x46a2ac[_0xd9a5('0x25')])&&!_[_0xd9a5('0x64')](_0x46a2ac[_0xd9a5('0x65')])&&_0x46a2ac[_0xd9a5('0x65')]&&!_[_0xd9a5('0x64')](this[_0xd9a5('0xf')][util[_0xd9a5('0x5a')](_0xd9a5('0x66'),_0x46a2ac['name'])])&&!_[_0xd9a5('0x64')](this[_0xd9a5('0xf')][util[_0xd9a5('0x5a')](_0xd9a5('0x66'),_0x46a2ac[_0xd9a5('0x25')])]['status'])&&(this['trunks'][util[_0xd9a5('0x5a')](_0xd9a5('0x66'),_0x46a2ac[_0xd9a5('0x25')])][_0xd9a5('0x2f')]===_0xd9a5('0x67')||this[_0xd9a5('0xf')][util[_0xd9a5('0x5a')]('SIP/%s',_0x46a2ac['name'])][_0xd9a5('0x2f')]===_0xd9a5('0x68'));};Fax[_0xd9a5('0x1d')][_0xd9a5('0x57')]=function(_0x1c08ff,_0x2b05c2){if(!this[_0xd9a5('0x63')](_0x1c08ff)){ut[_0xd9a5('0x46')](_0xd9a5('0x69'),_[_0xd9a5('0x64')](_0x1c08ff)?'':_0x1c08ff[_0xd9a5('0x25')]+_0xd9a5('0x6a'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0xd9a5('0x64')](_0x2b05c2[_0xd9a5('0x6')])){ut['logger'](_0xd9a5('0x6b'),JSON['stringify'](_0x2b05c2));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xd9a5('0x64')](_0x2b05c2[_0xd9a5('0x4')])){ut['logger'](_0xd9a5('0x6c'),JSON[_0xd9a5('0x3e')](_0x2b05c2));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xd9a5('0x6d')};};module[_0xd9a5('0x6e')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 0bcd57e..458b5df 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 _0xf105=['resolve','then','catch','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','inspect','notify'];(function(_0x3913ff,_0xc83bed){var _0xa29738=function(_0x40ed23){while(--_0x40ed23){_0x3913ff['push'](_0x3913ff['shift']());}};_0xa29738(++_0xc83bed);}(_0xf105,0x1b0));var _0x5f10=function(_0x3c9ab7,_0x270630){_0x3c9ab7=_0x3c9ab7-0x0;var _0x58cb6b=_0xf105[_0x3c9ab7];return _0x58cb6b;};'use strict';var util=require(_0x5f10('0x0'));var BPromise=require(_0x5f10('0x1'));var logger=require(_0x5f10('0x2'))(_0x5f10('0x3'));var _=require(_0x5f10('0x4'));var faxAccount=require(_0x5f10('0x5'));function loggerCatch(_0x5601d6){return function(_0x395cc9){logger['error'](_0x5601d6,util[_0x5f10('0x6')](_0x395cc9,{'showHidden':![],'depth':null}));};}exports[_0x5f10('0x7')]=function(_0xd0dde3,_0x1b7489){return BPromise[_0x5f10('0x8')]()[_0x5f10('0x9')](faxAccount[_0x5f10('0x7')](_0xd0dde3,_0x1b7489))[_0x5f10('0xa')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x89a6=['error','inspect','notify','resolve','then','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount'];(function(_0x533a48,_0x9f94c2){var _0x503de4=function(_0x489b0d){while(--_0x489b0d){_0x533a48['push'](_0x533a48['shift']());}};_0x503de4(++_0x9f94c2);}(_0x89a6,0xfe));var _0x689a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x89a6[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x689a('0x0'));var BPromise=require(_0x689a('0x1'));var logger=require(_0x689a('0x2'))(_0x689a('0x3'));var _=require(_0x689a('0x4'));var faxAccount=require(_0x689a('0x5'));function loggerCatch(_0x5625f1){return function(_0x9ff12a){logger[_0x689a('0x6')](_0x5625f1,util[_0x689a('0x7')](_0x9ff12a,{'showHidden':![],'depth':null}));};}exports[_0x689a('0x8')]=function(_0x3914a,_0x505b62){return BPromise[_0x689a('0x9')]()[_0x689a('0xa')](faxAccount['notify'](_0x3914a,_0x505b62))[_0x689a('0xb')](loggerCatch(_0x689a('0xc')));}; \ 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 3e1c259..0c863b9 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 _0x1990=['bluebird','child_process','exec','Exec\x20gs','info','\x20Error\x20:','inspect','fax'];(function(_0x20a2b9,_0x5c349a){var _0x36ad83=function(_0x132cbc){while(--_0x132cbc){_0x20a2b9['push'](_0x20a2b9['shift']());}};_0x36ad83(++_0x5c349a);}(_0x1990,0x1bf));var _0x0199=function(_0xf032b,_0x22eb4e){_0xf032b=_0xf032b-0x0;var _0x49ee22=_0x1990[_0xf032b];return _0x49ee22;};'use strict';var util=require('util');var logger=require('../../../../config/logger')(_0x0199('0x0'));var BPromise=require(_0x0199('0x1'));var exec=require(_0x0199('0x2'))[_0x0199('0x3')];exports['execute']=function(_0x4a8e0c){return new BPromise(function(_0x330f4e,_0x11a840){exec(_0x4a8e0c,function(_0x8aa9c1,_0x2decb7,_0x49cd2b){logger['info'](_0x0199('0x4'),_0x2decb7);if(_0x8aa9c1){logger[_0x0199('0x5')](_0x0199('0x4'),_0x0199('0x6'),util[_0x0199('0x7')](_0x8aa9c1,{'showHidden':![],'depth':null}),_0x2decb7,_0x49cd2b);_0x11a840(_0x8aa9c1);}_0x330f4e(_0x2decb7);});});}; \ No newline at end of file +var _0x183b=['child_process','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird'];(function(_0x17e474,_0x287d41){var _0x5a2f0c=function(_0x32cc86){while(--_0x32cc86){_0x17e474['push'](_0x17e474['shift']());}};_0x5a2f0c(++_0x287d41);}(_0x183b,0x128));var _0xb183=function(_0x19ca53,_0x4a1bca){_0x19ca53=_0x19ca53-0x0;var _0x387e6c=_0x183b[_0x19ca53];return _0x387e6c;};'use strict';var util=require(_0xb183('0x0'));var logger=require(_0xb183('0x1'))(_0xb183('0x2'));var BPromise=require(_0xb183('0x3'));var exec=require(_0xb183('0x4'))['exec'];exports[_0xb183('0x5')]=function(_0x52f8fc){return new BPromise(function(_0x4bcd1e,_0x1ad478){exec(_0x52f8fc,function(_0x3c6d7a,_0x229d7d,_0x2cb6b8){logger[_0xb183('0x6')](_0xb183('0x7'),_0x229d7d);if(_0x3c6d7a){logger['info'](_0xb183('0x7'),_0xb183('0x8'),util[_0xb183('0x9')](_0x3c6d7a,{'showHidden':![],'depth':null}),_0x229d7d,_0x2cb6b8);_0x1ad478(_0x3c6d7a);}_0x4bcd1e(_0x229d7d);});});}; \ 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 c77de9f..908637b 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 _0x1285=['headerinfo','format','\x22%s\x22','gateway','faxdetect','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','uniqueid','util','lodash','fax','message','logger','info','ecm'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x1285,0x175));var _0x5128=function(_0x203301,_0x3814f2){_0x203301=_0x203301-0x0;var _0x53970b=_0x1285[_0x203301];return _0x53970b;};'use strict';var util=require(_0x5128('0x0'));var _=require(_0x5128('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x5128('0x2'));exports[_0x5128('0x3')]=function(_0x5a8b31){return{'message':_0x5a8b31};};exports[_0x5128('0x4')]=function(_0x37dcab,_0x49a73a){logger[_0x5128('0x5')](_0x37dcab,util['inspect'](_0x49a73a,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0xc6c2a6,_0x3ac4b6){var _0x1fe2a3={'XMF-ECM':_0x3ac4b6[_0x5128('0x6')],'XMF-HEADERINFO':_0x3ac4b6[_0x5128('0x7')],'XMF-MINRATE':_0x3ac4b6['minrate'],'XMF-MAXRATE':_0x3ac4b6['maxrate'],'XMF-MODEM':util[_0x5128('0x8')](_0x5128('0x9'),_0x3ac4b6['modem']),'XMF-GATEWAY':_0x3ac4b6[_0x5128('0xa')],'XMF-FAXDETECT':_0x3ac4b6[_0x5128('0xb')],'XMF-T38TIMEOUT':_0x3ac4b6['t38timeout'],'XMF-LOCALSTATIONID':_0x3ac4b6[_0x5128('0xc')],'XMF-PATH':_0xc6c2a6[_0x5128('0xd')]};return _0x1fe2a3;};exports[_0x5128('0xe')]=function(_0x1ca76e,_0x573fcf){return{'actionid':_0x1ca76e['uniqueid'],'action':_0x5128('0xf'),'channel':_0x1ca76e[_0x5128('0x10')],'Exten':_0x5128('0x11'),'Context':'from-sip','Priority':'1','callerid':util['format'](_0x5128('0x12'),_0x1ca76e[_0x5128('0x7')]?_0x1ca76e['headerinfo']:'',_0x1ca76e[_0x5128('0xc')]),'variable':_0x573fcf,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1ca76e[_0x5128('0x13')]};}; \ No newline at end of file +var _0x9729=['path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','util','fax','info','inspect','addVariables','ecm','headerinfo','minrate','format','modem','faxdetect','t38timeout','localstationid'];(function(_0x5cedd1,_0x26b81f){var _0xd92895=function(_0x4e692f){while(--_0x4e692f){_0x5cedd1['push'](_0x5cedd1['shift']());}};_0xd92895(++_0x26b81f);}(_0x9729,0x1bb));var _0x9972=function(_0x46448d,_0x2da978){_0x46448d=_0x46448d-0x0;var _0x178442=_0x9729[_0x46448d];return _0x178442;};'use strict';var util=require(_0x9972('0x0'));var _=require('lodash');var moment=require('moment');var logger=require('../../../../config/logger')(_0x9972('0x1'));exports['message']=function(_0x30696b){return{'message':_0x30696b};};exports['logger']=function(_0x1b61f7,_0x252f21){logger[_0x9972('0x2')](_0x1b61f7,util[_0x9972('0x3')](_0x252f21,{'showHidden':![],'depth':null}));};exports[_0x9972('0x4')]=function(_0xd0911a,_0x5b9d79){var _0x226874={'XMF-ECM':_0x5b9d79[_0x9972('0x5')],'XMF-HEADERINFO':_0x5b9d79[_0x9972('0x6')],'XMF-MINRATE':_0x5b9d79[_0x9972('0x7')],'XMF-MAXRATE':_0x5b9d79['maxrate'],'XMF-MODEM':util[_0x9972('0x8')]('\x22%s\x22',_0x5b9d79[_0x9972('0x9')]),'XMF-GATEWAY':_0x5b9d79['gateway'],'XMF-FAXDETECT':_0x5b9d79[_0x9972('0xa')],'XMF-T38TIMEOUT':_0x5b9d79[_0x9972('0xb')],'XMF-LOCALSTATIONID':_0x5b9d79[_0x9972('0xc')],'XMF-PATH':_0xd0911a[_0x9972('0xd')]};return _0x226874;};exports[_0x9972('0xe')]=function(_0x18628f,_0x5870d4){return{'actionid':_0x18628f[_0x9972('0xf')],'action':_0x9972('0x10'),'channel':_0x18628f[_0x9972('0x11')],'Exten':_0x9972('0x12'),'Context':'from-sip','Priority':'1','callerid':util[_0x9972('0x8')]('\x22%s\x22\x20<%s>',_0x18628f[_0x9972('0x6')]?_0x18628f[_0x9972('0x6')]:'',_0x18628f[_0x9972('0xc')]),'variable':_0x5870d4,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x18628f['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 56c8f0e..bf92aa7 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 _0x148e=['getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','moment','./realtime','./report','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/trunk','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/dynamics365','get','hour','resolve','then','initAgents','getTrunks','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts'];(function(_0x2f0057,_0x448b27){var _0x17f2c3=function(_0x12efc3){while(--_0x12efc3){_0x2f0057['push'](_0x2f0057['shift']());}};_0x17f2c3(++_0x448b27);}(_0x148e,0x173));var _0xe148=function(_0x16b133,_0x1fc6f3){_0x16b133=_0x16b133-0x0;var _0x248b99=_0x148e[_0x16b133];return _0x248b99;};'use strict';var BPromise=require(_0xe148('0x0'));var util=require('util');var moment=require(_0xe148('0x1'));var server=require('./server');var Realtime=require(_0xe148('0x2'));var Report=require(_0xe148('0x3'));var Acw=require('./acw');var Trigger=require(_0xe148('0x4'));var Dialer=require('./dialer');var Preview=require(_0xe148('0x5'));var Fax=require(_0xe148('0x6'));var user=require(_0xe148('0x7'));var voiceQueue=require(_0xe148('0x8'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xe148('0x9'));var trigger=require('./rpc/trigger');var template=require(_0xe148('0xa'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xe148('0xb'));var voiceExtension=require(_0xe148('0xc'));var faxAccount=require(_0xe148('0xd'));var zendesk=require(_0xe148('0xe'));var salesforce=require(_0xe148('0xf'));var sugarcrm=require(_0xe148('0x10'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xe148('0x11'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xe148('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()[_0xe148('0x13')](_0xe148('0x14'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xe148('0x13')](_0xe148('0x14'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xe148('0x15')]()[_0xe148('0x16')](user['getAgents']())[_0xe148('0x16')](realtime[_0xe148('0x17')]())[_0xe148('0x16')](user['getTelephones']())[_0xe148('0x16')](realtime['initTelephones']())[_0xe148('0x16')](trunk[_0xe148('0x18')]())[_0xe148('0x16')](realtime['initTrunks']())[_0xe148('0x16')](voiceQueue['getVoiceQueues']())['then'](realtime['initVoiceQueues']())[_0xe148('0x16')](trigger[_0xe148('0x19')]())[_0xe148('0x16')](realtime[_0xe148('0x1a')]())[_0xe148('0x16')](template['getTemplates']())[_0xe148('0x16')](realtime[_0xe148('0x1b')]())[_0xe148('0x16')](zendesk[_0xe148('0x1c')]())[_0xe148('0x16')](realtime[_0xe148('0x1d')]())[_0xe148('0x16')](salesforce['getSalesforceAccounts']())[_0xe148('0x16')](realtime[_0xe148('0x1e')]())[_0xe148('0x16')](sugarcrm[_0xe148('0x1f')]())[_0xe148('0x16')](realtime[_0xe148('0x20')]())[_0xe148('0x16')](freshdesk[_0xe148('0x21')]())[_0xe148('0x16')](realtime[_0xe148('0x22')]())[_0xe148('0x16')](desk[_0xe148('0x23')]())[_0xe148('0x16')](realtime[_0xe148('0x24')]())[_0xe148('0x16')](zoho[_0xe148('0x25')]())[_0xe148('0x16')](realtime[_0xe148('0x26')]())['then'](vtiger['getVtigerAccounts']())[_0xe148('0x16')](realtime[_0xe148('0x27')]())['then'](servicenow['getServicenowAccounts']())[_0xe148('0x16')](realtime['initServicenowAccounts']())[_0xe148('0x16')](dynamics365[_0xe148('0x28')]())[_0xe148('0x16')](realtime[_0xe148('0x29')]())[_0xe148('0x16')](campaign[_0xe148('0x2a')]())[_0xe148('0x16')](realtime[_0xe148('0x2b')]())[_0xe148('0x16')](voiceExtension[_0xe148('0x2c')]())[_0xe148('0x16')](realtime['initVoiceExtensions']())['then'](faxAccount['getFaxAccounts']())['then'](realtime[_0xe148('0x2d')]())[_0xe148('0x16')](function(){return realtime;});}function initParams(){return BPromise[_0xe148('0x15')]()[_0xe148('0x16')](voiceQueueReport[_0xe148('0x2e')]())[_0xe148('0x16')](realtime[_0xe148('0x2f')]())[_0xe148('0x16')](cmHopperHistory[_0xe148('0x30')]())[_0xe148('0x16')](realtime[_0xe148('0x31')]())['then'](cmHopperHistory[_0xe148('0x32')]())['then'](realtime[_0xe148('0x33')]())[_0xe148('0x16')](voiceCallReport[_0xe148('0x34')]())['then'](realtime[_0xe148('0x35')]())['then'](function(_0x43c787){})[_0xe148('0x36')](function(_0x5743c3){console[_0xe148('0x37')](_0x5743c3);});}function main(){return server[_0xe148('0x38')](realtime,preview,fax)[_0xe148('0x16')](function(_0x57f688){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report[_0xe148('0x39')]();setInterval(initRealtime,0x1388);})[_0xe148('0x36')](function(_0x4b2510){console[_0xe148('0x37')](_0x4b2510);});}main(); \ No newline at end of file +var _0x960e=['./rpc/integrations/dynamics365','get','hour','then','getAgents','initAgents','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTemplates','initTemplates','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','getServicenowAccounts','getCampaigns','initCampaigns','getVoiceExtensions','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','util','moment','./realtime','./report','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/servicenow'];(function(_0x5af251,_0x527694){var _0x5475a7=function(_0x5416bf){while(--_0x5416bf){_0x5af251['push'](_0x5af251['shift']());}};_0x5475a7(++_0x527694);}(_0x960e,0x92));var _0xe960=function(_0x29da0c,_0x5bd465){_0x29da0c=_0x29da0c-0x0;var _0x50589d=_0x960e[_0x29da0c];return _0x50589d;};'use strict';var BPromise=require('bluebird');var util=require(_0xe960('0x0'));var moment=require(_0xe960('0x1'));var server=require('./server');var Realtime=require(_0xe960('0x2'));var Report=require(_0xe960('0x3'));var Acw=require(_0xe960('0x4'));var Trigger=require(_0xe960('0x5'));var Dialer=require(_0xe960('0x6'));var Preview=require('./preview');var Fax=require(_0xe960('0x7'));var user=require(_0xe960('0x8'));var voiceQueue=require(_0xe960('0x9'));var voiceQueueReport=require(_0xe960('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xe960('0xb'));var trigger=require(_0xe960('0xc'));var template=require(_0xe960('0xd'));var cmHopperHistory=require(_0xe960('0xe'));var campaign=require(_0xe960('0xf'));var voiceExtension=require(_0xe960('0x10'));var faxAccount=require(_0xe960('0x11'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xe960('0x12'));var freshdesk=require(_0xe960('0x13'));var desk=require('./rpc/integrations/desk');var zoho=require(_0xe960('0x14'));var vtiger=require('./rpc/integrations/vtiger');var servicenow=require(_0xe960('0x15'));var dynamics365=require(_0xe960('0x16'));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()[_0xe960('0x17')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xe960('0x17')](_0xe960('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xe960('0x19')](user[_0xe960('0x1a')]())[_0xe960('0x19')](realtime[_0xe960('0x1b')]())[_0xe960('0x19')](user['getTelephones']())['then'](realtime[_0xe960('0x1c')]())[_0xe960('0x19')](trunk['getTrunks']())[_0xe960('0x19')](realtime[_0xe960('0x1d')]())[_0xe960('0x19')](voiceQueue[_0xe960('0x1e')]())['then'](realtime[_0xe960('0x1f')]())[_0xe960('0x19')](trigger['getTriggers']())[_0xe960('0x19')](realtime['initTriggers']())[_0xe960('0x19')](template[_0xe960('0x20')]())[_0xe960('0x19')](realtime[_0xe960('0x21')]())[_0xe960('0x19')](zendesk['getZendeskAccounts']())[_0xe960('0x19')](realtime['initZendeskAccounts']())[_0xe960('0x19')](salesforce[_0xe960('0x22')]())[_0xe960('0x19')](realtime[_0xe960('0x23')]())[_0xe960('0x19')](sugarcrm[_0xe960('0x24')]())['then'](realtime[_0xe960('0x25')]())[_0xe960('0x19')](freshdesk['getFreshdeskAccounts']())[_0xe960('0x19')](realtime[_0xe960('0x26')]())['then'](desk['getDeskAccounts']())[_0xe960('0x19')](realtime[_0xe960('0x27')]())['then'](zoho[_0xe960('0x28')]())[_0xe960('0x19')](realtime['initZohoAccounts']())[_0xe960('0x19')](vtiger[_0xe960('0x29')]())['then'](realtime['initVtigerAccounts']())[_0xe960('0x19')](servicenow[_0xe960('0x2a')]())[_0xe960('0x19')](realtime['initServicenowAccounts']())[_0xe960('0x19')](dynamics365['getDynamics365Accounts']())[_0xe960('0x19')](realtime['initDynamics365Accounts']())[_0xe960('0x19')](campaign[_0xe960('0x2b')]())[_0xe960('0x19')](realtime[_0xe960('0x2c')]())['then'](voiceExtension[_0xe960('0x2d')]())['then'](realtime['initVoiceExtensions']())[_0xe960('0x19')](faxAccount['getFaxAccounts']())[_0xe960('0x19')](realtime[_0xe960('0x2e')]())[_0xe960('0x19')](function(){return realtime;});}function initParams(){return BPromise[_0xe960('0x2f')]()[_0xe960('0x19')](voiceQueueReport[_0xe960('0x30')]())[_0xe960('0x19')](realtime[_0xe960('0x31')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xe960('0x19')](realtime[_0xe960('0x32')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0xe960('0x19')](realtime[_0xe960('0x33')]())['then'](voiceCallReport[_0xe960('0x34')]())[_0xe960('0x19')](realtime[_0xe960('0x35')]())[_0xe960('0x19')](function(_0xae213a){})[_0xe960('0x36')](function(_0x387269){console[_0xe960('0x37')](_0x387269);});}function main(){return server['listen'](realtime,preview,fax)[_0xe960('0x19')](function(_0x261dc7){return initRealtime();})[_0xe960('0x19')](function(){return initParams();})[_0xe960('0x19')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xe960('0x36')](function(_0x30c3cb){console[_0xe960('0x37')](_0x30c3cb);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 2bc00a6..3e373c9 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 _0xdef3=['talking','statePause','voiceStatusTime','status','emit','user:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','accountcode','fullname','state','unknown','stateTime','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse'];(function(_0x2f6d16,_0x516c0c){var _0xf706a=function(_0x43dd25){while(--_0x43dd25){_0x2f6d16['push'](_0x2f6d16['shift']());}};_0xf706a(++_0x516c0c);}(_0xdef3,0x1d5));var _0x3def=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xdef3[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x3def('0x0'));var util=require('util');var moment=require('moment');var md5=require(_0x3def('0x1'));var Redis=require(_0x3def('0x2'));var config=require(_0x3def('0x3'));config[_0x3def('0x4')]=_[_0x3def('0x5')](config[_0x3def('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x3def('0x6'))(new Redis(config[_0x3def('0x4')]));function Agent(_0xa3c8c){this['id']=_0xa3c8c['id']||0x0;this[_0x3def('0x7')]=_0xa3c8c[_0x3def('0x7')]||'';this['email']=_0xa3c8c['email']||'';this[_0x3def('0x8')]=_0xa3c8c[_0x3def('0x8')]||'';this[_0x3def('0x9')]=_0xa3c8c['fullname']||'';this[_0x3def('0xa')]=_0x3def('0xb');this[_0x3def('0xc')]=0x0;this['status']=_0x3def('0xb');this[_0x3def('0xd')]='';this['phone']='';this[_0x3def('0xe')]='';this[_0x3def('0xf')]='';this[_0x3def('0x10')]=_0xa3c8c[_0x3def('0x10')]||![];this[_0x3def('0x11')]=_0x3def('0xb');this['voiceStatusTime']=0x0;this[_0x3def('0x12')]='';this[_0x3def('0x13')]='';this[_0x3def('0x14')]=![];this['local']=![];this[_0x3def('0x1')]='';}Agent['prototype'][_0x3def('0x15')]=function(_0x31adef){var _0x4c2af7;if(_0x31adef&&_0x31adef[_0x3def('0xa')]){_0x4c2af7=_0x31adef[_0x3def('0xa')][_0x3def('0x16')]();switch(_0x4c2af7){case _0x3def('0x17'):_0x4c2af7=_0x3def('0x18');break;case _0x3def('0x19'):_0x4c2af7=_0x3def('0x1a');break;}}if(_0x4c2af7&&this['voiceStatus']!==_0x4c2af7||_0x31adef[_0x3def('0x1b')]){this[_0x3def('0x1c')]=_['toNumber'](moment()['format']('x'));}if(_0x4c2af7){this['voiceStatus']=_0x4c2af7;}var _0x2a8349={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this[_0x3def('0x8')],'fullname':this[_0x3def('0x9')],'state':this[_0x3def('0xa')],'stateTime':this[_0x3def('0xc')],'status':this[_0x3def('0x1d')],'address':this['address'],'online':this[_0x3def('0x10')],'voiceStatus':this[_0x3def('0x11')],'voiceStatusTime':this[_0x3def('0x1c')],'voiceStatusCallerIdNumber':this[_0x3def('0x12')],'voiceStatusQueue':this[_0x3def('0x13')],'interface':this[_0x3def('0xf')],'onhold':this[_0x3def('0x14')]};var _0x4211bb=md5(JSON['stringify'](_0x2a8349));if(this[_0x3def('0x1')]!==_0x4211bb){this[_0x3def('0x1')]=_0x4211bb;io['to'](util['format']('user:%s',_0x2a8349['name']))[_0x3def('0x1e')](_0x3def('0x1f'),_0x2a8349);}};module[_0x3def('0x20')]=Agent; \ No newline at end of file +var _0x5d3b=['voiceStatusCallerIdNumber','voiceStatusQueue','prototype','state','toLowerCase','not_inuse','idle','inuse','talking','voiceStatus','voiceStatusTime','toNumber','format','onhold','stringify','emit','user:save','lodash','util','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','stateTime','status','unknown','address','mobile','interface','online'];(function(_0x35942b,_0xa1d5e3){var _0x1d536d=function(_0x3ea7fa){while(--_0x3ea7fa){_0x35942b['push'](_0x35942b['shift']());}};_0x1d536d(++_0xa1d5e3);}(_0x5d3b,0x1f2));var _0xb5d3=function(_0xb808cd,_0x279de7){_0xb808cd=_0xb808cd-0x0;var _0x5117a1=_0x5d3b[_0xb808cd];return _0x5117a1;};'use strict';var _=require(_0xb5d3('0x0'));var util=require(_0xb5d3('0x1'));var moment=require(_0xb5d3('0x2'));var md5=require(_0xb5d3('0x3'));var Redis=require(_0xb5d3('0x4'));var config=require(_0xb5d3('0x5'));config[_0xb5d3('0x6')]=_[_0xb5d3('0x7')](config[_0xb5d3('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xb5d3('0x8'))(new Redis(config['redis']));function Agent(_0x1b0a13){this['id']=_0x1b0a13['id']||0x0;this['name']=_0x1b0a13[_0xb5d3('0x9')]||'';this[_0xb5d3('0xa')]=_0x1b0a13['email']||'';this[_0xb5d3('0xb')]=_0x1b0a13[_0xb5d3('0xb')]||'';this[_0xb5d3('0xc')]=_0x1b0a13[_0xb5d3('0xc')]||'';this['state']='unknown';this[_0xb5d3('0xd')]=0x0;this[_0xb5d3('0xe')]=_0xb5d3('0xf');this[_0xb5d3('0x10')]='';this['phone']='';this[_0xb5d3('0x11')]='';this[_0xb5d3('0x12')]='';this['online']=_0x1b0a13[_0xb5d3('0x13')]||![];this['voiceStatus']=_0xb5d3('0xf');this['voiceStatusTime']=0x0;this[_0xb5d3('0x14')]='';this[_0xb5d3('0x15')]='';this['onhold']=![];this['local']=![];this['md5']='';}Agent[_0xb5d3('0x16')]['updateStatusRealtime']=function(_0x13c666){var _0x5cb9ba;if(_0x13c666&&_0x13c666[_0xb5d3('0x17')]){_0x5cb9ba=_0x13c666[_0xb5d3('0x17')][_0xb5d3('0x18')]();switch(_0x5cb9ba){case _0xb5d3('0x19'):_0x5cb9ba=_0xb5d3('0x1a');break;case _0xb5d3('0x1b'):_0x5cb9ba=_0xb5d3('0x1c');break;}}if(_0x5cb9ba&&this[_0xb5d3('0x1d')]!==_0x5cb9ba||_0x13c666['statePause']){this[_0xb5d3('0x1e')]=_[_0xb5d3('0x1f')](moment()[_0xb5d3('0x20')]('x'));}if(_0x5cb9ba){this['voiceStatus']=_0x5cb9ba;}var _0xdea05c={'id':this['id'],'name':this[_0xb5d3('0x9')],'email':this[_0xb5d3('0xa')],'accountcode':this[_0xb5d3('0xb')],'fullname':this['fullname'],'state':this['state'],'stateTime':this[_0xb5d3('0xd')],'status':this[_0xb5d3('0xe')],'address':this['address'],'online':this[_0xb5d3('0x13')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0xb5d3('0x1e')],'voiceStatusCallerIdNumber':this[_0xb5d3('0x14')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0xb5d3('0x21')]};var _0x5ade1d=md5(JSON[_0xb5d3('0x22')](_0xdea05c));if(this[_0xb5d3('0x3')]!==_0x5ade1d){this[_0xb5d3('0x3')]=_0x5ade1d;io['to'](util[_0xb5d3('0x20')]('user:%s',_0xdea05c[_0xb5d3('0x9')]))[_0xb5d3('0x23')](_0xb5d3('0x24'),_0xdea05c);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index fee15a3..cdc3ad5 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 _0x74f0=['dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','exports','name','type','campaign','originated','temp','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','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence'];(function(_0x56fd7b,_0x189318){var _0x279371=function(_0x1ed4df){while(--_0x1ed4df){_0x56fd7b['push'](_0x56fd7b['shift']());}};_0x279371(++_0x189318);}(_0x74f0,0xf3));var _0x074f=function(_0x21d0c3,_0x16c71c){_0x21d0c3=_0x21d0c3-0x0;var _0x4df18e=_0x74f0[_0x21d0c3];return _0x4df18e;};'use strict';function Campaign(_0x86dcc6){this['id']=_0x86dcc6['id']||0x0;this[_0x074f('0x0')]=_0x86dcc6['name']||'';this['type']=_0x86dcc6[_0x074f('0x1')]||_0x074f('0x2');this[_0x074f('0x3')]=0x0;this[_0x074f('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x074f('0x5')]='';this[_0x074f('0x6')]=!![];this[_0x074f('0x7')]=_0x86dcc6[_0x074f('0x7')];this[_0x074f('0x8')]=_0x86dcc6[_0x074f('0x8')];this[_0x074f('0x9')]=_0x86dcc6['dialTimezone']||null;this[_0x074f('0xa')]=_0x86dcc6[_0x074f('0xa')]?_0x86dcc6['dialGlobalInterval']:null;this[_0x074f('0xb')]=_0x86dcc6[_0x074f('0xb')];this[_0x074f('0xc')]=_0x86dcc6[_0x074f('0xc')];this[_0x074f('0xd')]=_0x86dcc6['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x86dcc6[_0x074f('0xe')];this[_0x074f('0xf')]=_0x86dcc6[_0x074f('0xf')];this[_0x074f('0x10')]=_0x86dcc6[_0x074f('0x10')];this[_0x074f('0x11')]=_0x86dcc6[_0x074f('0x11')];this[_0x074f('0x12')]=_0x86dcc6[_0x074f('0x12')];this['dialNoAnswerRetryFrequency']=_0x86dcc6[_0x074f('0x13')];this['dialGlobalMaxRetry']=_0x86dcc6[_0x074f('0x14')];this[_0x074f('0x15')]=_0x86dcc6[_0x074f('0x15')]||_0x074f('0x16');this[_0x074f('0x17')]=_0x86dcc6[_0x074f('0x17')]||undefined;this[_0x074f('0x18')]=_0x86dcc6[_0x074f('0x18')]||undefined;this[_0x074f('0x19')]=_0x86dcc6[_0x074f('0x19')]||undefined;this[_0x074f('0x1a')]=_0x86dcc6['TrunkBackup']?_0x86dcc6[_0x074f('0x1a')]:undefined;this[_0x074f('0x1b')]=_0x86dcc6[_0x074f('0x1b')]?_0x86dcc6[_0x074f('0x1b')]:undefined;this[_0x074f('0x1c')]=_0x86dcc6[_0x074f('0x1c')]?_0x86dcc6['Interval']:undefined;this['SquareProject']=_0x86dcc6[_0x074f('0x1d')]?_0x86dcc6['SquareProject']:undefined;this['dialQueueProject']=_0x86dcc6[_0x074f('0x1d')]?_0x86dcc6[_0x074f('0x1d')][_0x074f('0x0')]:undefined;this[_0x074f('0x1e')]=_0x86dcc6[_0x074f('0x1e')]||![];this[_0x074f('0x1f')]=_0x86dcc6[_0x074f('0x1f')];this[_0x074f('0x20')]=_0x86dcc6[_0x074f('0x20')];this[_0x074f('0x21')]=_0x86dcc6[_0x074f('0x21')];this[_0x074f('0x22')]=_0x86dcc6[_0x074f('0x22')];this[_0x074f('0x23')]=_0x86dcc6[_0x074f('0x23')];this[_0x074f('0x24')]=_0x86dcc6[_0x074f('0x24')];this[_0x074f('0x25')]=_0x86dcc6[_0x074f('0x25')];this[_0x074f('0x26')]=_0x86dcc6['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x86dcc6['dialAMDMaximumWordLength'];}module[_0x074f('0x27')]=Campaign; \ No newline at end of file +var _0x0db9=['dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','type','campaign','temp','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting'];(function(_0x3b98ce,_0x14bcb6){var _0x49bc20=function(_0x345505){while(--_0x345505){_0x3b98ce['push'](_0x3b98ce['shift']());}};_0x49bc20(++_0x14bcb6);}(_0x0db9,0xa3));var _0x90db=function(_0x2afb44,_0x249a57){_0x2afb44=_0x2afb44-0x0;var _0x15ccc2=_0x0db9[_0x2afb44];return _0x15ccc2;};'use strict';function Campaign(_0x3be2aa){this['id']=_0x3be2aa['id']||0x0;this['name']=_0x3be2aa['name']||'';this['type']=_0x3be2aa[_0x90db('0x0')]||_0x90db('0x1');this['originated']=0x0;this[_0x90db('0x2')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x90db('0x3')]=0x0;this[_0x90db('0x4')]='';this['sendMessageOneNotActive']=!![];this[_0x90db('0x5')]=_0x3be2aa[_0x90db('0x5')];this[_0x90db('0x6')]=_0x3be2aa[_0x90db('0x6')];this[_0x90db('0x7')]=_0x3be2aa[_0x90db('0x7')]||null;this['dialGlobalInterval']=_0x3be2aa[_0x90db('0x8')]?_0x3be2aa[_0x90db('0x8')]:null;this[_0x90db('0x9')]=_0x3be2aa[_0x90db('0x9')];this[_0x90db('0xa')]=_0x3be2aa[_0x90db('0xa')];this[_0x90db('0xb')]=_0x3be2aa[_0x90db('0xb')]||0x1e;this[_0x90db('0xc')]=_0x3be2aa[_0x90db('0xc')];this[_0x90db('0xd')]=_0x3be2aa['dialCongestionRetryFrequency'];this[_0x90db('0xe')]=_0x3be2aa[_0x90db('0xe')];this[_0x90db('0xf')]=_0x3be2aa[_0x90db('0xf')];this[_0x90db('0x10')]=_0x3be2aa[_0x90db('0x10')];this[_0x90db('0x11')]=_0x3be2aa[_0x90db('0x11')];this[_0x90db('0x12')]=_0x3be2aa[_0x90db('0x12')];this[_0x90db('0x13')]=_0x3be2aa[_0x90db('0x13')]||_0x90db('0x14');this[_0x90db('0x15')]=_0x3be2aa['dialPrefix']||undefined;this[_0x90db('0x16')]=_0x3be2aa['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x90db('0x17')]=_0x3be2aa[_0x90db('0x17')]||undefined;this[_0x90db('0x18')]=_0x3be2aa[_0x90db('0x18')]?_0x3be2aa[_0x90db('0x18')]:undefined;this[_0x90db('0x19')]=_0x3be2aa[_0x90db('0x19')]?_0x3be2aa[_0x90db('0x19')]:undefined;this[_0x90db('0x1a')]=_0x3be2aa[_0x90db('0x1a')]?_0x3be2aa['Interval']:undefined;this[_0x90db('0x1b')]=_0x3be2aa[_0x90db('0x1b')]?_0x3be2aa['SquareProject']:undefined;this['dialQueueProject']=_0x3be2aa[_0x90db('0x1b')]?_0x3be2aa[_0x90db('0x1b')][_0x90db('0x1c')]:undefined;this[_0x90db('0x1d')]=_0x3be2aa[_0x90db('0x1d')]||![];this[_0x90db('0x1e')]=_0x3be2aa[_0x90db('0x1e')];this['dialAMDGreeting']=_0x3be2aa[_0x90db('0x1f')];this[_0x90db('0x20')]=_0x3be2aa[_0x90db('0x20')];this[_0x90db('0x21')]=_0x3be2aa['dialAMDTotalAnalysisTime'];this[_0x90db('0x22')]=_0x3be2aa['dialAMDMinWordLength'];this[_0x90db('0x23')]=_0x3be2aa[_0x90db('0x23')];this['dialAMDMaximumNumberOfWords']=_0x3be2aa[_0x90db('0x24')];this[_0x90db('0x25')]=_0x3be2aa['dialAMDSilenceThreshold'];this[_0x90db('0x26')]=_0x3be2aa[_0x90db('0x26')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index f1b9ad4..80fc5a4 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 _0xdb7e=['linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','starttime','channel','destinationchannel','calleridname','connectedlinenum','connectedlinename','context','uniqueid'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xdb7e,0x11a));var _0xedb7=function(_0x4adf75,_0x5c00c3){_0x4adf75=_0x4adf75-0x0;var _0x2c16fa=_0xdb7e[_0x4adf75];return _0x2c16fa;};'use strict';function Channel(){this[_0xedb7('0x0')]=null;this[_0xedb7('0x1')]='';this[_0xedb7('0x2')]='';this['calleridnum']=0x0;this[_0xedb7('0x3')]='';this[_0xedb7('0x4')]=undefined;this[_0xedb7('0x5')]=undefined;this['accountcode']=0x0;this[_0xedb7('0x6')]='';this[_0xedb7('0x7')]=0x0;this[_0xedb7('0x8')]=0x0;this[_0xedb7('0x9')]=0x0;this[_0xedb7('0xa')]=![];this[_0xedb7('0xb')]=null;this[_0xedb7('0xc')]=null;this[_0xedb7('0xd')]=![];this[_0xedb7('0xe')]=![];this[_0xedb7('0xf')]='';this['lastdata']='';this[_0xedb7('0x10')]=0x0;this[_0xedb7('0x11')]=0x0;this[_0xedb7('0x12')]=0x0;this[_0xedb7('0x13')]=null;this[_0xedb7('0x14')]=null;this[_0xedb7('0x15')]=null;this[_0xedb7('0x16')]=![];this[_0xedb7('0x17')]=null;this[_0xedb7('0x18')]=null;this[_0xedb7('0x19')]=[];this[_0xedb7('0x1a')]=undefined;this[_0xedb7('0x1b')]=undefined;this[_0xedb7('0x1c')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xbd0a=['type','tag','disposition','monitor','queue','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','destinationchannel','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','abandoned','lastapplication','lastdata','billableseconds'];(function(_0x1c2110,_0x4c49ae){var _0x19c845=function(_0x5d2d90){while(--_0x5d2d90){_0x1c2110['push'](_0x1c2110['shift']());}};_0x19c845(++_0x4c49ae);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x165be4,_0x34bf25){_0x165be4=_0x165be4-0x0;var _0x75b4d8=_0xbd0a[_0x165be4];return _0x75b4d8;};'use strict';function Channel(){this[_0xabd0('0x0')]=null;this['channel']='';this[_0xabd0('0x1')]='';this['calleridnum']=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this[_0xabd0('0x2')]=undefined;this[_0xabd0('0x3')]=0x0;this[_0xabd0('0x4')]='';this[_0xabd0('0x5')]=0x0;this[_0xabd0('0x6')]=0x0;this[_0xabd0('0x7')]=0x0;this[_0xabd0('0x8')]=![];this[_0xabd0('0x9')]=null;this[_0xabd0('0xa')]=null;this['unmanaged']=![];this[_0xabd0('0xb')]=![];this[_0xabd0('0xc')]='';this[_0xabd0('0xd')]='';this['duration']=0x0;this[_0xabd0('0xe')]=0x0;this['holdtime']=0x0;this[_0xabd0('0xf')]=null;this[_0xabd0('0x10')]=null;this[_0xabd0('0x11')]=null;this[_0xabd0('0x12')]=![];this['monitorFilename']=null;this[_0xabd0('0x13')]=null;this['monitors']=[];this[_0xabd0('0x14')]=undefined;this[_0xabd0('0x15')]=undefined;this[_0xabd0('0x16')]=0x0;}module[_0xabd0('0x17')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index d3c10a2..7250b96 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 _0x10ec=['token','tokenSecret','type','serverUrl','Configurations','exports','name','remoteUri','authType','password','consumerSecret'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x10ec,0xcc));var _0xc10e=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x10ec[_0x465a0c];return _0x1e202e;};'use strict';function DeskAccount(_0x2e9f74){this['id']=_0x2e9f74['id']||0x0;this[_0xc10e('0x0')]=_0x2e9f74[_0xc10e('0x0')]||'';this['username']=_0x2e9f74['username']||'';this['remoteUri']=_0x2e9f74[_0xc10e('0x1')]||'';this[_0xc10e('0x2')]=_0x2e9f74[_0xc10e('0x2')]||'';this[_0xc10e('0x3')]=_0x2e9f74[_0xc10e('0x3')]||'';this['consumerKey']=_0x2e9f74['consumerKey']||'';this[_0xc10e('0x4')]=_0x2e9f74[_0xc10e('0x4')]||'';this[_0xc10e('0x5')]=_0x2e9f74[_0xc10e('0x5')]||'';this[_0xc10e('0x6')]=_0x2e9f74[_0xc10e('0x6')]||'';this['type']=_0x2e9f74[_0xc10e('0x7')]||'';this[_0xc10e('0x8')]=_0x2e9f74[_0xc10e('0x8')]||'';this[_0xc10e('0x9')]=_0x2e9f74[_0xc10e('0x9')]||{};}module[_0xc10e('0xa')]=DeskAccount; \ No newline at end of file +var _0x2125=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0x15ed84,_0x589521){var _0x426d2b=function(_0x5d294a){while(--_0x5d294a){_0x15ed84['push'](_0x15ed84['shift']());}};_0x426d2b(++_0x589521);}(_0x2125,0xdc));var _0x5212=function(_0xbd7056,_0x1a6941){_0xbd7056=_0xbd7056-0x0;var _0x45e3f2=_0x2125[_0xbd7056];return _0x45e3f2;};'use strict';function DeskAccount(_0x169acd){this['id']=_0x169acd['id']||0x0;this['name']=_0x169acd[_0x5212('0x0')]||'';this[_0x5212('0x1')]=_0x169acd[_0x5212('0x1')]||'';this[_0x5212('0x2')]=_0x169acd[_0x5212('0x2')]||'';this[_0x5212('0x3')]=_0x169acd[_0x5212('0x3')]||'';this['password']=_0x169acd[_0x5212('0x4')]||'';this[_0x5212('0x5')]=_0x169acd[_0x5212('0x5')]||'';this[_0x5212('0x6')]=_0x169acd['consumerSecret']||'';this[_0x5212('0x7')]=_0x169acd[_0x5212('0x7')]||'';this[_0x5212('0x8')]=_0x169acd[_0x5212('0x8')]||'';this[_0x5212('0x9')]=_0x169acd[_0x5212('0x9')]||'';this['serverUrl']=_0x169acd[_0x5212('0xa')]||'';this[_0x5212('0xb')]=_0x169acd[_0x5212('0xb')]||{};}module[_0x5212('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 13f954d..7e6c6da 100644 --- a/server/services/ami/model/dynamics365Account.js +++ b/server/services/ami/model/dynamics365Account.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5b0e=['clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','tenantId'];(function(_0x2cdb90,_0x3cd9ca){var _0x2ed6e4=function(_0x5afd9b){while(--_0x5afd9b){_0x2cdb90['push'](_0x2cdb90['shift']());}};_0x2ed6e4(++_0x3cd9ca);}(_0x5b0e,0x101));var _0xe5b0=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0x5b0e[_0x245afe];return _0x4eefde;};'use strict';function Dynamics365Account(_0x55f8ee){this['id']=_0x55f8ee['id']||0x0;this[_0xe5b0('0x0')]=_0x55f8ee['name']||'';this[_0xe5b0('0x1')]=_0x55f8ee[_0xe5b0('0x1')]||'';this['password']=_0x55f8ee[_0xe5b0('0x2')]||'';this['remoteUri']=_0x55f8ee['remoteUri']||'';this[_0xe5b0('0x3')]=_0x55f8ee[_0xe5b0('0x3')]||'';this[_0xe5b0('0x4')]=_0x55f8ee[_0xe5b0('0x4')]||'';this['clientSecret']=_0x55f8ee[_0xe5b0('0x5')]||{};this[_0xe5b0('0x6')]=_0x55f8ee['serverUrl']||'';this[_0xe5b0('0x7')]=_0x55f8ee[_0xe5b0('0x7')]||{};}module[_0xe5b0('0x8')]=Dynamics365Account; \ No newline at end of file +var _0xb3b4=['Configurations','exports','username','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x44eb1f,_0x426903){var _0x59d307=function(_0x4bb5a6){while(--_0x4bb5a6){_0x44eb1f['push'](_0x44eb1f['shift']());}};_0x59d307(++_0x426903);}(_0xb3b4,0xba));var _0x4b3b=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xb3b4[_0x5c351c];return _0x26f3b3;};'use strict';function Dynamics365Account(_0x2accb7){this['id']=_0x2accb7['id']||0x0;this['name']=_0x2accb7['name']||'';this['username']=_0x2accb7[_0x4b3b('0x0')]||'';this['password']=_0x2accb7['password']||'';this[_0x4b3b('0x1')]=_0x2accb7[_0x4b3b('0x1')]||'';this[_0x4b3b('0x2')]=_0x2accb7[_0x4b3b('0x2')]||'';this[_0x4b3b('0x3')]=_0x2accb7[_0x4b3b('0x3')]||'';this[_0x4b3b('0x4')]=_0x2accb7[_0x4b3b('0x4')]||{};this[_0x4b3b('0x5')]=_0x2accb7[_0x4b3b('0x5')]||'';this[_0x4b3b('0x6')]=_0x2accb7[_0x4b3b('0x6')]||{};}module[_0x4b3b('0x7')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 8644993..1660825 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 _0x5c00=['gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29'];(function(_0x17040c,_0x548ad0){var _0x3b7f62=function(_0x16c486){while(--_0x16c486){_0x17040c['push'](_0x17040c['shift']());}};_0x3b7f62(++_0x548ad0);}(_0x5c00,0x17e));var _0x05c0=function(_0x8550ba,_0x57c10d){_0x8550ba=_0x8550ba-0x0;var _0x432399=_0x5c00[_0x8550ba];return _0x432399;};'use strict';function FaxAccount(_0x29fe0e){this['id']=_0x29fe0e['id']||0x0;this[_0x05c0('0x0')]=_0x29fe0e[_0x05c0('0x0')]||'';this['description']=_0x29fe0e[_0x05c0('0x1')];this['ecm']=_0x29fe0e[_0x05c0('0x2')];this[_0x05c0('0x3')]=_0x29fe0e[_0x05c0('0x3')];this[_0x05c0('0x4')]=_0x29fe0e['localstationid'];this[_0x05c0('0x5')]=_0x29fe0e[_0x05c0('0x5')]||0x960;this[_0x05c0('0x6')]=_0x29fe0e[_0x05c0('0x6')]||0x3840;this['modem']=_0x29fe0e[_0x05c0('0x7')]||_0x05c0('0x8');this[_0x05c0('0x9')]=_0x29fe0e['gateway']||'no';this[_0x05c0('0xa')]=_0x29fe0e[_0x05c0('0xa')]||'no';this[_0x05c0('0xb')]=_0x29fe0e[_0x05c0('0xb')]||0x1388;this[_0x05c0('0xc')]=_0x29fe0e[_0x05c0('0xc')]||'SIP';this['Trunk']=_0x29fe0e[_0x05c0('0xd')]?_0x29fe0e['Trunk']:undefined;this[_0x05c0('0xe')]=_0x29fe0e[_0x05c0('0xe')];this[_0x05c0('0xf')]=_0x29fe0e['key'];}module[_0x05c0('0x10')]=FaxAccount; \ No newline at end of file +var _0x76dc=['SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech'];(function(_0xc56093,_0x5703fe){var _0x581fa4=function(_0x434bc4){while(--_0x434bc4){_0xc56093['push'](_0xc56093['shift']());}};_0x581fa4(++_0x5703fe);}(_0x76dc,0x1f2));var _0xc76d=function(_0x16d0e8,_0x9312a8){_0x16d0e8=_0x16d0e8-0x0;var _0xe813fe=_0x76dc[_0x16d0e8];return _0xe813fe;};'use strict';function FaxAccount(_0x10240b){this['id']=_0x10240b['id']||0x0;this[_0xc76d('0x0')]=_0x10240b[_0xc76d('0x0')]||'';this[_0xc76d('0x1')]=_0x10240b['description'];this[_0xc76d('0x2')]=_0x10240b[_0xc76d('0x2')];this['headerinfo']=_0x10240b[_0xc76d('0x3')];this['localstationid']=_0x10240b['localstationid'];this[_0xc76d('0x4')]=_0x10240b[_0xc76d('0x4')]||0x960;this[_0xc76d('0x5')]=_0x10240b['maxrate']||0x3840;this['modem']=_0x10240b[_0xc76d('0x6')]||_0xc76d('0x7');this[_0xc76d('0x8')]=_0x10240b['gateway']||'no';this['faxdetect']=_0x10240b[_0xc76d('0x9')]||'no';this[_0xc76d('0xa')]=_0x10240b['t38timeout']||0x1388;this[_0xc76d('0xb')]=_0x10240b['tech']||_0xc76d('0xc');this[_0xc76d('0xd')]=_0x10240b[_0xc76d('0xd')]?_0x10240b[_0xc76d('0xd')]:undefined;this[_0xc76d('0xe')]=_0x10240b[_0xc76d('0xe')];this[_0xc76d('0xf')]=_0x10240b[_0xc76d('0xf')];}module[_0xc76d('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index e12239d..7cbe384 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 _0xb8c4=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xb8c4,0x185));var _0x4b8c=function(_0x309bde,_0x3ef7f5){_0x309bde=_0x309bde-0x0;var _0x5fa8bc=_0xb8c4[_0x309bde];return _0x5fa8bc;};'use strict';function FreshdeskAccount(_0x6a056a){this['id']=_0x6a056a['id']||0x0;this[_0x4b8c('0x0')]=_0x6a056a[_0x4b8c('0x0')]||'';this['username']=_0x6a056a[_0x4b8c('0x1')]||'';this[_0x4b8c('0x2')]=_0x6a056a[_0x4b8c('0x3')]||'';this[_0x4b8c('0x4')]=_0x6a056a[_0x4b8c('0x4')]||'';this['serverUrl']=_0x6a056a[_0x4b8c('0x5')]||'';this[_0x4b8c('0x6')]=_0x6a056a[_0x4b8c('0x6')]||{};}module[_0x4b8c('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x22a2=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0xb7a459,_0xc13228){var _0x104ab5=function(_0x186a0e){while(--_0x186a0e){_0xb7a459['push'](_0xb7a459['shift']());}};_0x104ab5(++_0xc13228);}(_0x22a2,0xac));var _0x222a=function(_0x26b5ea,_0x32da3a){_0x26b5ea=_0x26b5ea-0x0;var _0xb66e68=_0x22a2[_0x26b5ea];return _0xb66e68;};'use strict';function FreshdeskAccount(_0x458a36){this['id']=_0x458a36['id']||0x0;this['name']=_0x458a36[_0x222a('0x0')]||'';this['username']=_0x458a36[_0x222a('0x1')]||'';this[_0x222a('0x2')]=_0x458a36['token']||'';this['remoteUri']=_0x458a36[_0x222a('0x3')]||'';this[_0x222a('0x4')]=_0x458a36[_0x222a('0x4')]||'';this[_0x222a('0x5')]=_0x458a36[_0x222a('0x5')]||{};}module[_0x222a('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 3e222ad..dc71d9b 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 _0x0cb0=['calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandonAt','queuecallercomplete','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','inbound'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0cb0,0x168));var _0x00cb=function(_0xa56b88,_0x59be29){_0xa56b88=_0xa56b88-0x0;var _0x174d56=_0x0cb0[_0xa56b88];return _0x174d56;};'use strict';function QueueReport(){this['type']=_0x00cb('0x0');this['uniqueid']='';this[_0x00cb('0x1')]='';this[_0x00cb('0x2')]='';this['queue']='';this[_0x00cb('0x3')]=null;this[_0x00cb('0x4')]=null;this['position']=0x1;this[_0x00cb('0x5')]=0x1;this['queuecallerabandon']=![];this[_0x00cb('0x6')]=null;this[_0x00cb('0x7')]=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this['channel']='';this['connectedlinenum']='';this[_0x00cb('0x8')]='';this[_0x00cb('0x9')]='';this[_0x00cb('0xa')]='';this[_0x00cb('0xb')]='';this[_0x00cb('0xc')]='';this[_0x00cb('0xd')]=0x0;this[_0x00cb('0xe')]=![];this[_0x00cb('0xf')]='';this[_0x00cb('0x10')]=0x0;this[_0x00cb('0x11')]={};}module[_0x00cb('0x12')]=QueueReport; \ No newline at end of file +var _0xd150=['exten','priority','assigned','lastAssignedTo','mohtime','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','context'];(function(_0x5aba4f,_0x1afb63){var _0x10cf5c=function(_0x1adea5){while(--_0x1adea5){_0x5aba4f['push'](_0x5aba4f['shift']());}};_0x10cf5c(++_0x1afb63);}(_0xd150,0x114));var _0x0d15=function(_0xacca8e,_0x1245a5){_0xacca8e=_0xacca8e-0x0;var _0x4574ad=_0xd150[_0xacca8e];return _0x4574ad;};'use strict';function QueueReport(){this[_0x0d15('0x0')]=_0x0d15('0x1');this[_0x0d15('0x2')]='';this[_0x0d15('0x3')]='';this[_0x0d15('0x4')]='';this[_0x0d15('0x5')]='';this[_0x0d15('0x6')]=null;this[_0x0d15('0x7')]=null;this[_0x0d15('0x8')]=0x1;this[_0x0d15('0x9')]=0x1;this[_0x0d15('0xa')]=![];this[_0x0d15('0xb')]=null;this[_0x0d15('0xc')]=![];this[_0x0d15('0xd')]=null;this[_0x0d15('0xe')]=![];this[_0x0d15('0xf')]=null;this[_0x0d15('0x10')]=0x1;this[_0x0d15('0x11')]='';this[_0x0d15('0x12')]='';this[_0x0d15('0x13')]='';this['accountcode']='';this[_0x0d15('0x14')]='';this[_0x0d15('0x15')]='';this[_0x0d15('0x16')]='';this['holdtime']=0x0;this[_0x0d15('0x17')]=![];this[_0x0d15('0x18')]='';this[_0x0d15('0x19')]=0x0;this['variables']={};}module[_0x0d15('0x1a')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 11c598e..bc9e8d4 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 _0xe16e=['clientId','securityToken','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0x5c9aa5,_0x18c91e){var _0x5cf146=function(_0xc3a150){while(--_0xc3a150){_0x5c9aa5['push'](_0x5c9aa5['shift']());}};_0x5cf146(++_0x18c91e);}(_0xe16e,0x15a));var _0xee16=function(_0x3c487b,_0x44c5e2){_0x3c487b=_0x3c487b-0x0;var _0x1d65f6=_0xe16e[_0x3c487b];return _0x1d65f6;};'use strict';function SalesforceAccount(_0x1b522a){this['id']=_0x1b522a['id']||0x0;this[_0xee16('0x0')]=_0x1b522a[_0xee16('0x0')]||'';this[_0xee16('0x1')]=_0x1b522a['username']||'';this[_0xee16('0x2')]=_0x1b522a[_0xee16('0x2')]||'';this[_0xee16('0x3')]=_0x1b522a[_0xee16('0x3')]||'';this[_0xee16('0x4')]=_0x1b522a['clientId']||'';this['clientSecret']=_0x1b522a['clientSecret']||'';this[_0xee16('0x5')]=_0x1b522a[_0xee16('0x5')]||'';this['type']=_0x1b522a['type']||_0xee16('0x6');this['serverUrl']=_0x1b522a[_0xee16('0x7')]||'';this[_0xee16('0x8')]=_0x1b522a[_0xee16('0x8')]||{};}module[_0xee16('0x9')]=SalesforceAccount; \ No newline at end of file +var _0x3589=['name','username','remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl','Configurations','exports'];(function(_0x2cf55a,_0x274252){var _0x5337a4=function(_0x587ac1){while(--_0x587ac1){_0x2cf55a['push'](_0x2cf55a['shift']());}};_0x5337a4(++_0x274252);}(_0x3589,0x134));var _0x9358=function(_0x1d098b,_0x5af6cf){_0x1d098b=_0x1d098b-0x0;var _0x53b48a=_0x3589[_0x1d098b];return _0x53b48a;};'use strict';function SalesforceAccount(_0x34c766){this['id']=_0x34c766['id']||0x0;this[_0x9358('0x0')]=_0x34c766['name']||'';this[_0x9358('0x1')]=_0x34c766[_0x9358('0x1')]||'';this[_0x9358('0x2')]=_0x34c766[_0x9358('0x2')]||'';this[_0x9358('0x3')]=_0x34c766[_0x9358('0x3')]||'';this['clientId']=_0x34c766[_0x9358('0x4')]||'';this[_0x9358('0x5')]=_0x34c766[_0x9358('0x5')]||'';this[_0x9358('0x6')]=_0x34c766[_0x9358('0x6')]||'';this[_0x9358('0x7')]=_0x34c766['type']||'integrationTab';this[_0x9358('0x8')]=_0x34c766[_0x9358('0x8')]||'';this['Configurations']=_0x34c766[_0x9358('0x9')]||{};}module[_0x9358('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index fe1f500..8f68e22 100644 --- a/server/services/ami/model/servicenowAccount.js +++ b/server/services/ami/model/servicenowAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c40=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x52fe13,_0x230938){var _0x2b5664=function(_0xb785b3){while(--_0xb785b3){_0x52fe13['push'](_0x52fe13['shift']());}};_0x2b5664(++_0x230938);}(_0x7c40,0x8f));var _0x07c4=function(_0xbf9d38,_0x3f6b15){_0xbf9d38=_0xbf9d38-0x0;var _0x40959c=_0x7c40[_0xbf9d38];return _0x40959c;};'use strict';function ServicenowAccount(_0x28d922){this['id']=_0x28d922['id']||0x0;this[_0x07c4('0x0')]=_0x28d922[_0x07c4('0x0')]||'';this[_0x07c4('0x1')]=_0x28d922[_0x07c4('0x1')]||'';this[_0x07c4('0x2')]=_0x28d922[_0x07c4('0x2')]||'';this[_0x07c4('0x3')]=_0x28d922[_0x07c4('0x3')]||'';this[_0x07c4('0x4')]=_0x28d922['serverUrl']||'';this[_0x07c4('0x5')]=_0x28d922['Configurations']||{};}module[_0x07c4('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x61e8=['password','remoteUri','serverUrl','Configurations','username'];(function(_0x5b36bd,_0x4dfb36){var _0x1614fe=function(_0x559b7c){while(--_0x559b7c){_0x5b36bd['push'](_0x5b36bd['shift']());}};_0x1614fe(++_0x4dfb36);}(_0x61e8,0x18f));var _0x861e=function(_0x1103de,_0x12152e){_0x1103de=_0x1103de-0x0;var _0x166215=_0x61e8[_0x1103de];return _0x166215;};'use strict';function ServicenowAccount(_0x5485b3){this['id']=_0x5485b3['id']||0x0;this['name']=_0x5485b3['name']||'';this[_0x861e('0x0')]=_0x5485b3[_0x861e('0x0')]||'';this[_0x861e('0x1')]=_0x5485b3[_0x861e('0x1')]||'';this['remoteUri']=_0x5485b3[_0x861e('0x2')]||'';this[_0x861e('0x3')]=_0x5485b3['serverUrl']||'';this[_0x861e('0x4')]=_0x5485b3[_0x861e('0x4')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index fddc94d..fac1435 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 _0x4346=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x41382c,_0xc3ffd1){var _0x4da35b=function(_0x5d56b8){while(--_0x5d56b8){_0x41382c['push'](_0x41382c['shift']());}};_0x4da35b(++_0xc3ffd1);}(_0x4346,0x124));var _0x6434=function(_0x53f897,_0x539857){_0x53f897=_0x53f897-0x0;var _0x6879f8=_0x4346[_0x53f897];return _0x6879f8;};'use strict';function SugarcrmAccount(_0x3356b9){this['id']=_0x3356b9['id']||0x0;this[_0x6434('0x0')]=_0x3356b9['name']||'';this[_0x6434('0x1')]=_0x3356b9[_0x6434('0x1')]||'';this[_0x6434('0x2')]=_0x3356b9[_0x6434('0x2')]||'';this[_0x6434('0x3')]=_0x3356b9[_0x6434('0x3')]||'';this[_0x6434('0x4')]=_0x3356b9[_0x6434('0x4')]||'';this[_0x6434('0x5')]=_0x3356b9['Configurations']||{};}module[_0x6434('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x2f58=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x205b46,_0x3ca65b){var _0x2b6ae8=function(_0x1f4ae9){while(--_0x1f4ae9){_0x205b46['push'](_0x205b46['shift']());}};_0x2b6ae8(++_0x3ca65b);}(_0x2f58,0x1d4));var _0x82f5=function(_0x512406,_0x327591){_0x512406=_0x512406-0x0;var _0x599b4a=_0x2f58[_0x512406];return _0x599b4a;};'use strict';function SugarcrmAccount(_0x545cf8){this['id']=_0x545cf8['id']||0x0;this[_0x82f5('0x0')]=_0x545cf8['name']||'';this[_0x82f5('0x1')]=_0x545cf8[_0x82f5('0x1')]||'';this[_0x82f5('0x2')]=_0x545cf8[_0x82f5('0x2')]||'';this[_0x82f5('0x3')]=_0x545cf8[_0x82f5('0x3')]||'';this[_0x82f5('0x4')]=_0x545cf8[_0x82f5('0x4')]||'';this['Configurations']=_0x545cf8[_0x82f5('0x5')]||{};}module[_0x82f5('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 5eeaa7e..a124aa7 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 _0x5860=['status','address','exports','name','accountcode','state','unknown','stateTime'];(function(_0x419b6a,_0x265b43){var _0x229232=function(_0x514a3e){while(--_0x514a3e){_0x419b6a['push'](_0x419b6a['shift']());}};_0x229232(++_0x265b43);}(_0x5860,0x14b));var _0x0586=function(_0x4ea955,_0x1eda76){_0x4ea955=_0x4ea955-0x0;var _0x558561=_0x5860[_0x4ea955];return _0x558561;};'use strict';function Telephone(_0xf219da){this['id']=_0xf219da['id']||0x0;this['name']=_0xf219da[_0x0586('0x0')]||'';this['accountcode']=_0xf219da[_0x0586('0x1')]||'';this[_0x0586('0x2')]=_0x0586('0x3');this[_0x0586('0x4')]=0x0;this[_0x0586('0x5')]=_0x0586('0x3');this[_0x0586('0x6')]='';}module[_0x0586('0x7')]=Telephone; \ No newline at end of file +var _0x80f3=['status','name','unknown'];(function(_0x20fd45,_0xeb415b){var _0x1dcbea=function(_0x543e0f){while(--_0x543e0f){_0x20fd45['push'](_0x20fd45['shift']());}};_0x1dcbea(++_0xeb415b);}(_0x80f3,0x1e4));var _0x380f=function(_0x65c903,_0x41e920){_0x65c903=_0x65c903-0x0;var _0x23e1d7=_0x80f3[_0x65c903];return _0x23e1d7;};'use strict';function Telephone(_0x53bff0){this['id']=_0x53bff0['id']||0x0;this[_0x380f('0x0')]=_0x53bff0[_0x380f('0x0')]||'';this['accountcode']=_0x53bff0['accountcode']||'';this['state']=_0x380f('0x1');this['stateTime']=0x0;this[_0x380f('0x2')]=_0x380f('0x1');this['address']='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 9962cd2..e95dee9 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 _0xcb91=['html','exports','name'];(function(_0x2c0c15,_0x40a09e){var _0x4b4eac=function(_0x5f348f){while(--_0x5f348f){_0x2c0c15['push'](_0x2c0c15['shift']());}};_0x4b4eac(++_0x40a09e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1d426f,_0x37e919){_0x1d426f=_0x1d426f-0x0;var _0x17f71a=_0xcb91[_0x1d426f];return _0x17f71a;};'use strict';function template(_0x181cac){this['id']=_0x181cac['id']||0x0;this['name']=_0x181cac[_0x1cb9('0x0')]||'';this[_0x1cb9('0x1')]=_0x181cac[_0x1cb9('0x1')]||'';}module[_0x1cb9('0x2')]=template; \ No newline at end of file +var _0xfe57=['name','html','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe57,0x195));var _0x7fe5=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0xfe57[_0x361d3f];return _0x320229;};'use strict';function template(_0x3f2a0d){this['id']=_0x3f2a0d['id']||0x0;this[_0x7fe5('0x0')]=_0x3f2a0d['name']||'';this['html']=_0x3f2a0d[_0x7fe5('0x1')]||'';}module[_0x7fe5('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 4aa6452..a589509 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 _0x870b=['voice','status','AllConditions','AnyConditions','Actions','name','channel'];(function(_0x5a3cf4,_0x537d82){var _0x28f6cb=function(_0x2080f8){while(--_0x2080f8){_0x5a3cf4['push'](_0x5a3cf4['shift']());}};_0x28f6cb(++_0x537d82);}(_0x870b,0x108));var _0xb870=function(_0x16dcce,_0xc4d793){_0x16dcce=_0x16dcce-0x0;var _0xd44998=_0x870b[_0x16dcce];return _0xd44998;};'use strict';function Trigger(_0x1d55af){this['id']=_0x1d55af['id']||0x0;this[_0xb870('0x0')]=_0x1d55af[_0xb870('0x0')]||'';this[_0xb870('0x1')]=_0x1d55af[_0xb870('0x1')]||_0xb870('0x2');this[_0xb870('0x3')]=_0x1d55af[_0xb870('0x3')]||![];this[_0xb870('0x4')]=_0x1d55af[_0xb870('0x4')]||[];this[_0xb870('0x5')]=_0x1d55af[_0xb870('0x5')]||[];this['Actions']=_0x1d55af[_0xb870('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0xde12=['AllConditions','AnyConditions','Actions','exports','channel','voice','status'];(function(_0x2320a6,_0x390e97){var _0x2cc1d2=function(_0x147f26){while(--_0x147f26){_0x2320a6['push'](_0x2320a6['shift']());}};_0x2cc1d2(++_0x390e97);}(_0xde12,0xe4));var _0x2de1=function(_0x385703,_0x3b0d19){_0x385703=_0x385703-0x0;var _0x1abd70=_0xde12[_0x385703];return _0x1abd70;};'use strict';function Trigger(_0x1228cf){this['id']=_0x1228cf['id']||0x0;this['name']=_0x1228cf['name']||'';this[_0x2de1('0x0')]=_0x1228cf['channel']||_0x2de1('0x1');this[_0x2de1('0x2')]=_0x1228cf[_0x2de1('0x2')]||![];this[_0x2de1('0x3')]=_0x1228cf['AllConditions']||[];this[_0x2de1('0x4')]=_0x1228cf[_0x2de1('0x4')]||[];this[_0x2de1('0x5')]=_0x1228cf['Actions']||[];}module[_0x2de1('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 569b816..6ba496a 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 _0x56f7=['active','name','unknown','stateTime','status','registry','indexOf','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','exports'];(function(_0x46fe97,_0x2321fa){var _0x2b351d=function(_0x2acf75){while(--_0x2acf75){_0x46fe97['push'](_0x46fe97['shift']());}};_0x2b351d(++_0x2321fa);}(_0x56f7,0x110));var _0x756f=function(_0x14cee7,_0x4e7406){_0x14cee7=_0x14cee7-0x0;var _0x28ddc9=_0x56f7[_0x14cee7];return _0x28ddc9;};'use strict';function Trunk(_0x3819ee){this['id']=_0x3819ee['id']||0x0;this[_0x756f('0x0')]=_0x3819ee['active']||![];this[_0x756f('0x1')]=_0x3819ee[_0x756f('0x1')]||'';this['state']=_0x756f('0x2');this[_0x756f('0x3')]=0x0;this[_0x756f('0x4')]=_0x756f('0x2');this[_0x756f('0x5')]=_0x3819ee[_0x756f('0x5')]&&_0x3819ee['registry'][_0x756f('0x6')](':')?_0x3819ee['registry']['split'](':')[0x0]:'';this[_0x756f('0x7')]='';this[_0x756f('0x8')]='';this[_0x756f('0x9')]='';this[_0x756f('0xa')]='';this[_0x756f('0xb')]='';this[_0x756f('0xc')]=_0x756f('0x2');this[_0x756f('0xd')]='';this[_0x756f('0xe')]='';}module[_0x756f('0xf')]=Trunk; \ No newline at end of file +var _0x0b88=['address','exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','port','domain','domainport','stateRegistry'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x0b88,0x122));var _0x80b8=function(_0x44cd36,_0xa66b75){_0x44cd36=_0x44cd36-0x0;var _0x4b3aca=_0x0b88[_0x44cd36];return _0x4b3aca;};'use strict';function Trunk(_0x18ed79){this['id']=_0x18ed79['id']||0x0;this[_0x80b8('0x0')]=_0x18ed79[_0x80b8('0x0')]||![];this['name']=_0x18ed79[_0x80b8('0x1')]||'';this[_0x80b8('0x2')]=_0x80b8('0x3');this[_0x80b8('0x4')]=0x0;this[_0x80b8('0x5')]=_0x80b8('0x3');this['registry']=_0x18ed79[_0x80b8('0x6')]&&_0x18ed79[_0x80b8('0x6')][_0x80b8('0x7')](':')?_0x18ed79[_0x80b8('0x6')][_0x80b8('0x8')](':')[0x0]:'';this[_0x80b8('0x9')]='';this[_0x80b8('0xa')]='';this[_0x80b8('0xb')]='';this[_0x80b8('0xc')]='';this['refresh']='';this[_0x80b8('0xd')]='unknown';this['registrationtime']='';this[_0x80b8('0xe')]='';}module[_0x80b8('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 1ad4abe..682e8c7 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 _0xdee3=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0x4c2e30,_0x58e21d){var _0x1a5fa0=function(_0x5f19c3){while(--_0x5f19c3){_0x4c2e30['push'](_0x4c2e30['shift']());}};_0x1a5fa0(++_0x58e21d);}(_0xdee3,0x14f));var _0x3dee=function(_0x4c2388,_0x5aefc8){_0x4c2388=_0x4c2388-0x0;var _0x318dc2=_0xdee3[_0x4c2388];return _0x318dc2;};'use strict';function voiceExtension(_0x4edc9a){this['id']=_0x4edc9a['id']||0x0;this[_0x3dee('0x0')]=_0x4edc9a[_0x3dee('0x0')]||'';this[_0x3dee('0x1')]=_0x4edc9a[_0x3dee('0x1')]||'none';this[_0x3dee('0x2')]=_0x4edc9a['mandatoryDisposition']||![];}module[_0x3dee('0x3')]=voiceExtension; \ No newline at end of file +var _0x916f=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x362cd6,_0x5da5a8){var _0x851b34=function(_0x4b8edc){while(--_0x4b8edc){_0x362cd6['push'](_0x362cd6['shift']());}};_0x851b34(++_0x5da5a8);}(_0x916f,0xec));var _0xf916=function(_0x51af18,_0x7329eb){_0x51af18=_0x51af18-0x0;var _0x6f5d6f=_0x916f[_0x51af18];return _0x6f5d6f;};'use strict';function voiceExtension(_0x4b65b5){this['id']=_0x4b65b5['id']||0x0;this['exten']=_0x4b65b5[_0xf916('0x0')]||'';this[_0xf916('0x1')]=_0x4b65b5[_0xf916('0x1')]||_0xf916('0x2');this[_0xf916('0x3')]=_0x4b65b5[_0xf916('0x3')]||![];}module[_0xf916('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index cfcbbbf..5218346 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 _0x59ce=['temp','dialGlobalInterval','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalLowerLimit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','busy','invalid','ringing','ringinuse','onhold','wav','wav49','gsm','roundrobin','name','monitor_format','type','inbound','waiting','talking','answered','sumDuration','sumHoldTime','unmanaged','abandoned','loggedIn','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated'];(function(_0x27604f,_0x5ae336){var _0x40d189=function(_0xebacde){while(--_0xebacde){_0x27604f['push'](_0x27604f['shift']());}};_0x40d189(++_0x5ae336);}(_0x59ce,0x1f1));var _0xe59c=function(_0x519bd8,_0x164062){_0x519bd8=_0x519bd8-0x0;var _0x317ec5=_0x59ce[_0x519bd8];return _0x317ec5;};'use strict';var statusDesc=['unknown',_0xe59c('0x0'),'inuse',_0xe59c('0x1'),_0xe59c('0x2'),'unavailable',_0xe59c('0x3'),_0xe59c('0x4'),_0xe59c('0x5')];var monitorFormat={'wav':_0xe59c('0x6'),'wav49':_0xe59c('0x7'),'gsm':_0xe59c('0x8')};var strategy={'rrmemory':'rrmemory','roundrobin':_0xe59c('0x9')};function VoiceQueue(_0x39f1ba){this['id']=_0x39f1ba['id']||0x0;this[_0xe59c('0xa')]=_0x39f1ba[_0xe59c('0xa')]||'';this[_0xe59c('0xb')]=_0x39f1ba[_0xe59c('0xb')]||'';this[_0xe59c('0xc')]=_0x39f1ba[_0xe59c('0xc')]||_0xe59c('0xd');this[_0xe59c('0xe')]=0x0;this[_0xe59c('0xf')]=0x0;this['total']=0x0;this[_0xe59c('0x10')]=0x0;this[_0xe59c('0x11')]=0x0;this[_0xe59c('0x12')]=0x0;this['sumBillable']=0x0;this[_0xe59c('0x13')]=0x0;this[_0xe59c('0x14')]=0x0;this[_0xe59c('0x15')]=0x0;this['available']=0x0;this[_0xe59c('0x16')]=_0x39f1ba[_0xe59c('0x16')]||![];this['acwTimeout']=_0x39f1ba[_0xe59c('0x17')]||0xa;this['autopause']=_0x39f1ba[_0xe59c('0x18')]||'no';this[_0xe59c('0x19')]=!![];this[_0xe59c('0x1a')]='';this[_0xe59c('0x1b')]=0x0;this[_0xe59c('0x1c')]=0x0;this['dialTimezone']=_0x39f1ba['dialTimezone']||null;this[_0xe59c('0x1d')]=_0x39f1ba[_0xe59c('0x1d')]?_0x39f1ba[_0xe59c('0x1d')]:null;this[_0xe59c('0x1e')]=_0x39f1ba[_0xe59c('0x1e')];this[_0xe59c('0x1f')]=_0x39f1ba[_0xe59c('0x1f')]||'progressive';this['dialLimitChannel']=_0x39f1ba['dialLimitChannel']||0x0;this[_0xe59c('0x20')]=_0x39f1ba['dialLimitQueue']||0x0;this[_0xe59c('0x21')]=_0x39f1ba[_0xe59c('0x21')]||0x1;this[_0xe59c('0x22')]=_0x39f1ba[_0xe59c('0x22')]||_0xe59c('0x23');this[_0xe59c('0x24')]=_0x39f1ba['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x39f1ba[_0xe59c('0x25')]||0x258;this[_0xe59c('0x26')]=_0x39f1ba[_0xe59c('0x26')]||_0xe59c('0x27');this[_0xe59c('0x28')]=_0x39f1ba['dialOriginateCallerIdNumber']||_0xe59c('0x27');this['dialOriginateTimeout']=_0x39f1ba[_0xe59c('0x29')]||0x1e;this[_0xe59c('0x2a')]=_0x39f1ba[_0xe59c('0x2a')]||_0xe59c('0x2b');this[_0xe59c('0x2c')]=_0x39f1ba[_0xe59c('0x2c')]||0x3;this[_0xe59c('0x2d')]=_0x39f1ba[_0xe59c('0x2d')]||undefined;this[_0xe59c('0x2e')]=_0x39f1ba[_0xe59c('0x2e')]||0x3;this[_0xe59c('0x2f')]=_0x39f1ba[_0xe59c('0x2f')]||0x96;this[_0xe59c('0x30')]=_0x39f1ba[_0xe59c('0x30')]||0x3;this[_0xe59c('0x31')]=_0x39f1ba[_0xe59c('0x31')]||0x96;this[_0xe59c('0x32')]=_0x39f1ba[_0xe59c('0x32')]||0x3;this[_0xe59c('0x33')]=_0x39f1ba[_0xe59c('0x33')]||0x96;this[_0xe59c('0x34')]=_0x39f1ba[_0xe59c('0x34')]||0x4;this['Trunk']=_0x39f1ba['Trunk']?_0x39f1ba['Trunk']:undefined;this['TrunkBackup']=_0x39f1ba[_0xe59c('0x35')]?_0x39f1ba[_0xe59c('0x35')]:undefined;this[_0xe59c('0x36')]=_0x39f1ba['dialPrefix']||undefined;this[_0xe59c('0x37')]=_0x39f1ba[_0xe59c('0x37')]?_0x39f1ba[_0xe59c('0x37')]:undefined;this[_0xe59c('0x38')]=_0x39f1ba[_0xe59c('0x38')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x39f1ba['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xe59c('0x39')]=_0x39f1ba[_0xe59c('0x39')]||undefined;this[_0xe59c('0x3a')]=strategy[_0x39f1ba['strategy']]||_0xe59c('0x3b');this[_0xe59c('0x3c')]=!![];this[_0xe59c('0x3d')]=_0x39f1ba[_0xe59c('0x3d')]||![];this[_0xe59c('0x3e')]=_0x39f1ba[_0xe59c('0x3e')];this[_0xe59c('0x3f')]=_0x39f1ba[_0xe59c('0x3f')];this[_0xe59c('0x40')]=_0x39f1ba[_0xe59c('0x40')];this[_0xe59c('0x41')]=_0x39f1ba[_0xe59c('0x41')];this[_0xe59c('0x42')]=_0x39f1ba[_0xe59c('0x42')];this[_0xe59c('0x43')]=_0x39f1ba[_0xe59c('0x43')];this['dialAMDMaximumNumberOfWords']=_0x39f1ba['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x39f1ba[_0xe59c('0x44')];this[_0xe59c('0x45')]=_0x39f1ba[_0xe59c('0x45')];this[_0xe59c('0x46')]=0x0;this['pTalking']=0x0;this['timeout']=_0x39f1ba[_0xe59c('0x47')];this[_0xe59c('0x48')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xe59c('0x49')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xe59c('0x4a')]=0x0;this[_0xe59c('0x4b')]=0x0;this[_0xe59c('0x4c')]=0x0;this[_0xe59c('0x4d')]=0x0;this[_0xe59c('0x4e')]=0x0;this[_0xe59c('0x4f')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xe59c('0x50')]=0x0;this[_0xe59c('0x51')]=undefined;this[_0xe59c('0x52')]=undefined;this['handlePredictive']=undefined;this[_0xe59c('0x53')]=1.05;this[_0xe59c('0x54')]=0x0;this[_0xe59c('0x55')]=0x0;this[_0xe59c('0x56')]=0x0;this[_0xe59c('0x57')]=0x0;this[_0xe59c('0x58')]=0x0;this[_0xe59c('0x59')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xe59c('0x5a')]=0.4;this[_0xe59c('0x5b')]=0x0;this[_0xe59c('0x5c')]=0x0;this[_0xe59c('0x5d')]=0x1;this[_0xe59c('0x5e')]=0x0;this['erlangCallToSecond']=0x0;this[_0xe59c('0x5f')]=0x0;this[_0xe59c('0x60')]=0x0;this[_0xe59c('0x61')]=_0x39f1ba['dialRecallMeTimeout']||0x1e;this[_0xe59c('0x62')]=_0x39f1ba[_0xe59c('0x62')]||![];this[_0xe59c('0x63')]=_0x39f1ba[_0xe59c('0x63')]||undefined;this[_0xe59c('0x64')]=_0x39f1ba['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x39f1ba[_0xe59c('0x65')]||![];this[_0xe59c('0xb')]=monitorFormat[_0x39f1ba['monitor_format']]?monitorFormat[_0x39f1ba[_0xe59c('0xb')]]:undefined;this['mandatoryDisposition']=_0x39f1ba[_0xe59c('0x66')]||![];this[_0xe59c('0x67')]=_0x39f1ba[_0xe59c('0x67')]?_0x39f1ba[_0xe59c('0x67')]:undefined;}module[_0xe59c('0x68')]=VoiceQueue; \ No newline at end of file +var _0x0272=['anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalLowerLimit','predictiveIntervalErlangCallsDroppedCalls','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','exports','not_inuse','inuse','busy','invalid','unavailable','ringinuse','onhold','wav','gsm','rrmemory','roundrobin','name','monitor_format','inbound','waiting','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber'];(function(_0x156d8b,_0x6aad9f){var _0x3ee763=function(_0xafdda6){while(--_0xafdda6){_0x156d8b['push'](_0x156d8b['shift']());}};_0x3ee763(++_0x6aad9f);}(_0x0272,0x98));var _0x2027=function(_0x1ad117,_0x5c73bb){_0x1ad117=_0x1ad117-0x0;var _0x3811fb=_0x0272[_0x1ad117];return _0x3811fb;};'use strict';var statusDesc=['unknown',_0x2027('0x0'),_0x2027('0x1'),_0x2027('0x2'),_0x2027('0x3'),_0x2027('0x4'),'ringing',_0x2027('0x5'),_0x2027('0x6')];var monitorFormat={'wav':_0x2027('0x7'),'wav49':'wav49','gsm':_0x2027('0x8')};var strategy={'rrmemory':_0x2027('0x9'),'roundrobin':_0x2027('0xa')};function VoiceQueue(_0x3e0262){this['id']=_0x3e0262['id']||0x0;this[_0x2027('0xb')]=_0x3e0262[_0x2027('0xb')]||'';this[_0x2027('0xc')]=_0x3e0262[_0x2027('0xc')]||'';this['type']=_0x3e0262['type']||_0x2027('0xd');this[_0x2027('0xe')]=0x0;this['talking']=0x0;this['total']=0x0;this[_0x2027('0xf')]=0x0;this[_0x2027('0x10')]=0x0;this[_0x2027('0x11')]=0x0;this[_0x2027('0x12')]=0x0;this[_0x2027('0x13')]=0x0;this[_0x2027('0x14')]=0x0;this['loggedIn']=0x0;this[_0x2027('0x15')]=0x0;this[_0x2027('0x16')]=_0x3e0262[_0x2027('0x16')]||![];this[_0x2027('0x17')]=_0x3e0262[_0x2027('0x17')]||0xa;this[_0x2027('0x18')]=_0x3e0262[_0x2027('0x18')]||'no';this[_0x2027('0x19')]=!![];this['message']='';this[_0x2027('0x1a')]=0x0;this[_0x2027('0x1b')]=0x0;this[_0x2027('0x1c')]=_0x3e0262[_0x2027('0x1c')]||null;this[_0x2027('0x1d')]=_0x3e0262[_0x2027('0x1d')]?_0x3e0262[_0x2027('0x1d')]:null;this[_0x2027('0x1e')]=_0x3e0262[_0x2027('0x1e')];this[_0x2027('0x1f')]=_0x3e0262[_0x2027('0x1f')]||'progressive';this[_0x2027('0x20')]=_0x3e0262[_0x2027('0x20')]||0x0;this[_0x2027('0x21')]=_0x3e0262[_0x2027('0x21')]||0x0;this['dialPowerLevel']=_0x3e0262[_0x2027('0x22')]||0x1;this['dialPredictiveOptimization']=_0x3e0262[_0x2027('0x23')]||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x3e0262[_0x2027('0x24')]||0.03;this[_0x2027('0x25')]=_0x3e0262[_0x2027('0x25')]||0x258;this[_0x2027('0x26')]=_0x3e0262[_0x2027('0x26')]||'anonymous';this[_0x2027('0x27')]=_0x3e0262[_0x2027('0x27')]||_0x2027('0x28');this[_0x2027('0x29')]=_0x3e0262[_0x2027('0x29')]||0x1e;this[_0x2027('0x2a')]=_0x3e0262[_0x2027('0x2a')]||'tTxX';this[_0x2027('0x2b')]=_0x3e0262[_0x2027('0x2b')]||0x3;this[_0x2027('0x2c')]=_0x3e0262[_0x2027('0x2c')]||undefined;this[_0x2027('0x2d')]=_0x3e0262[_0x2027('0x2d')]||0x3;this[_0x2027('0x2e')]=_0x3e0262[_0x2027('0x2e')]||0x96;this['dialBusyMaxRetry']=_0x3e0262['dialBusyMaxRetry']||0x3;this[_0x2027('0x2f')]=_0x3e0262[_0x2027('0x2f')]||0x96;this[_0x2027('0x30')]=_0x3e0262['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x3e0262[_0x2027('0x31')]||0x96;this['dialGlobalMaxRetry']=_0x3e0262[_0x2027('0x32')]||0x4;this[_0x2027('0x33')]=_0x3e0262[_0x2027('0x33')]?_0x3e0262[_0x2027('0x33')]:undefined;this[_0x2027('0x34')]=_0x3e0262[_0x2027('0x34')]?_0x3e0262[_0x2027('0x34')]:undefined;this[_0x2027('0x35')]=_0x3e0262[_0x2027('0x35')]||undefined;this[_0x2027('0x36')]=_0x3e0262[_0x2027('0x36')]?_0x3e0262[_0x2027('0x36')]:undefined;this[_0x2027('0x37')]=_0x3e0262[_0x2027('0x37')]||'DESC';this[_0x2027('0x38')]=_0x3e0262[_0x2027('0x38')]||undefined;this[_0x2027('0x39')]=_0x3e0262[_0x2027('0x39')]||undefined;this[_0x2027('0x3a')]=strategy[_0x3e0262[_0x2027('0x3a')]]||_0x2027('0x9');this[_0x2027('0x3b')]=!![];this['dialAMDActive']=_0x3e0262[_0x2027('0x3c')]||![];this[_0x2027('0x3d')]=_0x3e0262['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x3e0262['dialAMDGreeting'];this[_0x2027('0x3e')]=_0x3e0262['dialAMDAfterGreetingSilence'];this[_0x2027('0x3f')]=_0x3e0262[_0x2027('0x3f')];this[_0x2027('0x40')]=_0x3e0262[_0x2027('0x40')];this['dialAMDBetweenWordsSilence']=_0x3e0262[_0x2027('0x41')];this[_0x2027('0x42')]=_0x3e0262['dialAMDMaximumNumberOfWords'];this[_0x2027('0x43')]=_0x3e0262[_0x2027('0x43')];this[_0x2027('0x44')]=_0x3e0262[_0x2027('0x44')];this[_0x2027('0x45')]=0x0;this[_0x2027('0x46')]=0x0;this['timeout']=_0x3e0262['timeout'];this[_0x2027('0x47')]=0x0;this[_0x2027('0x48')]=0x0;this[_0x2027('0x49')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x2027('0x4a')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x2027('0x4b')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x2027('0x4c')]=0x0;this[_0x2027('0x4d')]=0x0;this[_0x2027('0x4e')]=undefined;this[_0x2027('0x4f')]=undefined;this[_0x2027('0x50')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x2027('0x51')]=0x0;this[_0x2027('0x52')]=0x0;this[_0x2027('0x53')]=0x0;this[_0x2027('0x54')]=0x0;this[_0x2027('0x55')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this[_0x2027('0x56')]=0.4;this['predictiveIntervalErlangCalls']=0x0;this[_0x2027('0x57')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this['erlangCallToSecond']=0x0;this[_0x2027('0x58')]=0x0;this['erlangBusyFactor']=0x0;this[_0x2027('0x59')]=_0x3e0262[_0x2027('0x59')]||0x1e;this['dialRecallInQueue']=_0x3e0262[_0x2027('0x5a')]||![];this[_0x2027('0x5b')]=_0x3e0262[_0x2027('0x5b')]||undefined;this[_0x2027('0x5c')]=_0x3e0262['dialAgiAfterHangupClient']||![];this[_0x2027('0x5d')]=_0x3e0262[_0x2027('0x5d')]||![];this['monitor_format']=monitorFormat[_0x3e0262[_0x2027('0xc')]]?monitorFormat[_0x3e0262[_0x2027('0xc')]]:undefined;this['mandatoryDisposition']=_0x3e0262['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x3e0262[_0x2027('0x5e')]?_0x3e0262[_0x2027('0x5e')]:undefined;}module[_0x2027('0x5f')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 719d346..07e557a 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 _0x7e20=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x1c5850,_0x358c15){var _0x589b53=function(_0x5a570f){while(--_0x5a570f){_0x1c5850['push'](_0x1c5850['shift']());}};_0x589b53(++_0x358c15);}(_0x7e20,0x7b));var _0x07e2=function(_0xb7e74f,_0x5d28cf){_0xb7e74f=_0xb7e74f-0x0;var _0x37f4ab=_0x7e20[_0xb7e74f];return _0x37f4ab;};'use strict';function VtigerAccount(_0xc69f08){this['id']=_0xc69f08['id']||0x0;this[_0x07e2('0x0')]=_0xc69f08[_0x07e2('0x0')]||'';this[_0x07e2('0x1')]=_0xc69f08[_0x07e2('0x1')]||'';this[_0x07e2('0x2')]=_0xc69f08[_0x07e2('0x2')]||'';this[_0x07e2('0x3')]=_0xc69f08['remoteUri']||'';this[_0x07e2('0x4')]=_0xc69f08['serverUrl']||'';this[_0x07e2('0x5')]=_0xc69f08[_0x07e2('0x5')]||{};}module[_0x07e2('0x6')]=VtigerAccount; \ No newline at end of file +var _0x3858=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x9b5bb2,_0x5db315){var _0x2e1e92=function(_0x5621c9){while(--_0x5621c9){_0x9b5bb2['push'](_0x9b5bb2['shift']());}};_0x2e1e92(++_0x5db315);}(_0x3858,0xbf));var _0x8385=function(_0x3bb59b,_0x5ed5fe){_0x3bb59b=_0x3bb59b-0x0;var _0x1cd9e1=_0x3858[_0x3bb59b];return _0x1cd9e1;};'use strict';function VtigerAccount(_0x315ca2){this['id']=_0x315ca2['id']||0x0;this[_0x8385('0x0')]=_0x315ca2[_0x8385('0x0')]||'';this[_0x8385('0x1')]=_0x315ca2[_0x8385('0x1')]||'';this[_0x8385('0x2')]=_0x315ca2['accessKey']||'';this[_0x8385('0x3')]=_0x315ca2[_0x8385('0x3')]||'';this[_0x8385('0x4')]=_0x315ca2[_0x8385('0x4')]||'';this['Configurations']=_0x315ca2[_0x8385('0x5')]||{};}module[_0x8385('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 67a904a..6ff0d31 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 _0x30b6=['type','integrationTab','serverUrl','Configurations','name','username','password','token','remoteUri','authType'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x30b6,0xcc));var _0x630b=function(_0x2fe0d3,_0x22b619){_0x2fe0d3=_0x2fe0d3-0x0;var _0x287da8=_0x30b6[_0x2fe0d3];return _0x287da8;};'use strict';function ZendeskAccount(_0x47e990){this['id']=_0x47e990['id']||0x0;this['name']=_0x47e990[_0x630b('0x0')]||'';this[_0x630b('0x1')]=_0x47e990[_0x630b('0x1')]||'';this[_0x630b('0x2')]=_0x47e990[_0x630b('0x2')]||'';this[_0x630b('0x3')]=_0x47e990[_0x630b('0x3')]||'';this[_0x630b('0x4')]=_0x47e990['remoteUri']||'';this[_0x630b('0x5')]=_0x47e990[_0x630b('0x5')]||'';this[_0x630b('0x6')]=_0x47e990['type']||_0x630b('0x7');this['serverUrl']=_0x47e990[_0x630b('0x8')]||'';this[_0x630b('0x9')]=_0x47e990[_0x630b('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x4f80=['remoteUri','authType','type','serverUrl','Configurations','name','username','password','token'];(function(_0x14a513,_0x3239f){var _0x47236c=function(_0x394191){while(--_0x394191){_0x14a513['push'](_0x14a513['shift']());}};_0x47236c(++_0x3239f);}(_0x4f80,0xcb));var _0x04f8=function(_0x3ae2b2,_0x2d936f){_0x3ae2b2=_0x3ae2b2-0x0;var _0x1dbf00=_0x4f80[_0x3ae2b2];return _0x1dbf00;};'use strict';function ZendeskAccount(_0x3cd0cb){this['id']=_0x3cd0cb['id']||0x0;this[_0x04f8('0x0')]=_0x3cd0cb[_0x04f8('0x0')]||'';this['username']=_0x3cd0cb[_0x04f8('0x1')]||'';this[_0x04f8('0x2')]=_0x3cd0cb[_0x04f8('0x2')]||'';this[_0x04f8('0x3')]=_0x3cd0cb[_0x04f8('0x3')]||'';this[_0x04f8('0x4')]=_0x3cd0cb['remoteUri']||'';this[_0x04f8('0x5')]=_0x3cd0cb['authType']||'';this['type']=_0x3cd0cb[_0x04f8('0x6')]||'integrationTab';this[_0x04f8('0x7')]=_0x3cd0cb[_0x04f8('0x7')]||'';this[_0x04f8('0x8')]=_0x3cd0cb['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index aab95f6..4b7c665 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 _0xafc4=['name','authToken','host','Configurations','exports'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xafc4,0x69));var _0x4afc=function(_0x28edff,_0x49e27f){_0x28edff=_0x28edff-0x0;var _0x15d9be=_0xafc4[_0x28edff];return _0x15d9be;};'use strict';function ZohoAccount(_0x49c56d){this['id']=_0x49c56d['id']||0x0;this['name']=_0x49c56d[_0x4afc('0x0')]||'';this['authToken']=_0x49c56d[_0x4afc('0x1')]||'';this[_0x4afc('0x2')]=_0x49c56d[_0x4afc('0x2')]||'';this[_0x4afc('0x3')]=_0x49c56d['Configurations']||{};this['serverUrl']=_0x49c56d['serverUrl']||'';}module[_0x4afc('0x4')]=ZohoAccount; \ No newline at end of file +var _0xc1c6=['Configurations','exports','name','authToken','host'];(function(_0x7f84a2,_0x1a9b95){var _0x256c2f=function(_0x14d3a8){while(--_0x14d3a8){_0x7f84a2['push'](_0x7f84a2['shift']());}};_0x256c2f(++_0x1a9b95);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x427a41,_0x5c75ae){_0x427a41=_0x427a41-0x0;var _0x1ac823=_0xc1c6[_0x427a41];return _0x1ac823;};'use strict';function ZohoAccount(_0xfb8a07){this['id']=_0xfb8a07['id']||0x0;this[_0x6c1c('0x0')]=_0xfb8a07[_0x6c1c('0x0')]||'';this['authToken']=_0xfb8a07[_0x6c1c('0x1')]||'';this['host']=_0xfb8a07[_0x6c1c('0x2')]||'';this[_0x6c1c('0x3')]=_0xfb8a07[_0x6c1c('0x3')]||{};this['serverUrl']=_0xfb8a07['serverUrl']||'';}module[_0x6c1c('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 fb70c69..597c8cc 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 _0xeb40=['name','type','campaigntype','dialAnswer','membername','channelAgent','format','SIP/%s','calleridname','phone','firstName','active','Contact','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','callback','callbackat','recallme','ContactId','ListId','UserId','Agent','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','lodash','moment','isNil','string','uniqueid','idContact','queue'];(function(_0x359c87,_0x2b61dd){var _0x398aee=function(_0x331315){while(--_0x331315){_0x359c87['push'](_0x359c87['shift']());}};_0x398aee(++_0x2b61dd);}(_0xeb40,0xe3));var _0x0eb4=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xeb40[_0x369151];return _0x4292d5;};'use strict';var util=require('util');var _=require(_0x0eb4('0x0'));var moment=require(_0x0eb4('0x1'));function checkNameSurname(_0x18091b,_0x3ef927,_0x1c481e){var _0xda13b7='';if(!_[_0x0eb4('0x2')](_0x3ef927)&&_0x0eb4('0x3')===typeof _0x3ef927){_0xda13b7+=_0x3ef927;}if(!_[_0x0eb4('0x2')](_0x1c481e)&&_0x0eb4('0x3')===typeof _0x1c481e){_0xda13b7+='\x20'+_0x1c481e;}if(_0xda13b7!==''){return _0xda13b7;}return _0x18091b;}function Action(_0x5dea4b,_0x1d2d14,_0x1f6b12,_0x565c36,_0x335ede){this[_0x0eb4('0x4')]=_0x1f6b12||undefined;this[_0x0eb4('0x5')]=_0x5dea4b['id'];this[_0x0eb4('0x6')]=_0x1d2d14[_0x0eb4('0x7')];this['type']=_0x1d2d14[_0x0eb4('0x8')];this[_0x0eb4('0x9')]=_0x0eb4('0x6');this[_0x0eb4('0xa')]=![];this[_0x0eb4('0xb')]=_[_0x0eb4('0x2')](_0x5dea4b['Agent'])?undefined:_0x5dea4b['Agent'][_0x0eb4('0x7')];this[_0x0eb4('0xc')]=this[_0x0eb4('0xb')]?util[_0x0eb4('0xd')](_0x0eb4('0xe'),this[_0x0eb4('0xb')]):_0x565c36||undefined;this[_0x0eb4('0xf')]=checkNameSurname(_0x5dea4b['Contact'][_0x0eb4('0x10')],_0x5dea4b['Contact'][_0x0eb4('0x11')],_0x5dea4b['Contact']['lastName']);this[_0x0eb4('0x12')]=_0x5dea4b[_0x0eb4('0x12')]||![];this['calleridnum']=_0x5dea4b[_0x0eb4('0x13')][_0x0eb4('0x10')];this[_0x0eb4('0x14')]=_0x5dea4b['scheduledat'];this[_0x0eb4('0x15')]=_0x5dea4b[_0x0eb4('0x15')]||0x0;this[_0x0eb4('0x16')]=_0x5dea4b[_0x0eb4('0x16')]||0x0;this[_0x0eb4('0x17')]=_0x5dea4b[_0x0eb4('0x17')]||0x0;this[_0x0eb4('0x18')]=(_0x5dea4b['countbusyretry']||0x0)+(_0x5dea4b[_0x0eb4('0x16')]||0x0)+(_0x5dea4b[_0x0eb4('0x17')]||0x0);this['callback']=_0x5dea4b[_0x0eb4('0x19')];this['callbackuniqueid']=_0x5dea4b['callbackuniqueid'];this[_0x0eb4('0x1a')]=_0x5dea4b[_0x0eb4('0x1a')];this[_0x0eb4('0x1b')]=_0x5dea4b[_0x0eb4('0x1b')];this[_0x0eb4('0x1c')]=_0x5dea4b[_0x0eb4('0x1c')];this[_0x0eb4('0x1d')]=_0x5dea4b[_0x0eb4('0x1d')];this[_0x0eb4('0x1e')]=_[_0x0eb4('0x2')](_0x5dea4b[_0x0eb4('0x1f')])?_0x5dea4b[_0x0eb4('0x1e')]:_0x5dea4b[_0x0eb4('0x1f')]['id'];this[_0x0eb4('0x20')]=_0x5dea4b['VoiceQueueId'];this['originatecalleridnum']='';this[_0x0eb4('0x21')]='';}Action[_0x0eb4('0x22')][_0x0eb4('0x23')]=function(){return util['format'](_0x0eb4('0x24'),this[_0x0eb4('0xf')],this[_0x0eb4('0x25')]);};module[_0x0eb4('0x26')]=Action; \ No newline at end of file +var _0xf1d7=['channelAgent','format','SIP/%s','calleridname','Contact','active','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','exports','lodash','moment','string','isNil','uniqueid','queue','name','type','campaigntype','membername','Agent'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xf1d7,0xfd));var _0x7f1d=function(_0x4b36ca,_0x1e40ab){_0x4b36ca=_0x4b36ca-0x0;var _0x3c64c0=_0xf1d7[_0x4b36ca];return _0x3c64c0;};'use strict';var util=require('util');var _=require(_0x7f1d('0x0'));var moment=require(_0x7f1d('0x1'));function checkNameSurname(_0x356158,_0x877c6a,_0x2bfce1){var _0x2e4aec='';if(!_['isNil'](_0x877c6a)&&_0x7f1d('0x2')===typeof _0x877c6a){_0x2e4aec+=_0x877c6a;}if(!_[_0x7f1d('0x3')](_0x2bfce1)&&_0x7f1d('0x2')===typeof _0x2bfce1){_0x2e4aec+='\x20'+_0x2bfce1;}if(_0x2e4aec!==''){return _0x2e4aec;}return _0x356158;}function Action(_0x118b69,_0x26bf0d,_0x217e73,_0x214b01,_0x404fc6){this[_0x7f1d('0x4')]=_0x217e73||undefined;this['idContact']=_0x118b69['id'];this[_0x7f1d('0x5')]=_0x26bf0d[_0x7f1d('0x6')];this[_0x7f1d('0x7')]=_0x26bf0d['type'];this[_0x7f1d('0x8')]=_0x7f1d('0x5');this['dialAnswer']=![];this[_0x7f1d('0x9')]=_[_0x7f1d('0x3')](_0x118b69[_0x7f1d('0xa')])?undefined:_0x118b69['Agent'][_0x7f1d('0x6')];this[_0x7f1d('0xb')]=this['membername']?util[_0x7f1d('0xc')](_0x7f1d('0xd'),this[_0x7f1d('0x9')]):_0x214b01||undefined;this[_0x7f1d('0xe')]=checkNameSurname(_0x118b69['Contact']['phone'],_0x118b69['Contact']['firstName'],_0x118b69[_0x7f1d('0xf')]['lastName']);this[_0x7f1d('0x10')]=_0x118b69[_0x7f1d('0x10')]||![];this['calleridnum']=_0x118b69[_0x7f1d('0xf')][_0x7f1d('0x11')];this[_0x7f1d('0x12')]=_0x118b69[_0x7f1d('0x12')];this[_0x7f1d('0x13')]=_0x118b69['countbusyretry']||0x0;this[_0x7f1d('0x14')]=_0x118b69[_0x7f1d('0x14')]||0x0;this[_0x7f1d('0x15')]=_0x118b69[_0x7f1d('0x15')]||0x0;this['countglobal']=(_0x118b69[_0x7f1d('0x13')]||0x0)+(_0x118b69[_0x7f1d('0x14')]||0x0)+(_0x118b69[_0x7f1d('0x15')]||0x0);this[_0x7f1d('0x16')]=_0x118b69['callback'];this[_0x7f1d('0x17')]=_0x118b69[_0x7f1d('0x17')];this['callbackat']=_0x118b69['callbackat'];this['recallme']=_0x118b69[_0x7f1d('0x18')];this[_0x7f1d('0x19')]=_0x118b69[_0x7f1d('0x19')];this[_0x7f1d('0x1a')]=_0x118b69[_0x7f1d('0x1a')];this['UserId']=_[_0x7f1d('0x3')](_0x118b69['Agent'])?_0x118b69[_0x7f1d('0x1b')]:_0x118b69[_0x7f1d('0xa')]['id'];this[_0x7f1d('0x1c')]=_0x118b69[_0x7f1d('0x1c')];this['originatecalleridnum']='';this[_0x7f1d('0x1d')]='';}Action[_0x7f1d('0x1e')][_0x7f1d('0x1f')]=function(){return util[_0x7f1d('0xc')]('\x22%s\x22\x20<%s>',this[_0x7f1d('0xe')],this['number']);};module[_0x7f1d('0x20')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 2ce4513..38b9048 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 _0xef53=['pick','contactId','ListId','Action','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[action]','getContactRecallMe','agentReadyId','length','scheduledat','dialRecallMeTimeout','run','then','logger2','[RecallMe]','catch','starttime','logCustomer','RecallInQueue','createBody','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','setMessage','AGENTS_NOT_LOGGED','isActive','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','countbusyretry','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','unlockAgent','activeContact','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','scheduledAt','dialNoAnswerRetryFrequency','CONGESTION','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','dialBusyRetryFrequency','CANCEL','AgentReject','[syncHangupRequest][logAgentReject]','unlockContact','idContact','[default]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','Busy','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','called','[Preview][execCall][failure]','logBlacklist','Contact\x20in\x20black\x20List','isTrunkReachable','SIP/%s','reachable','unmonitored','execRun','unlock','disableContact','recallme','isValid','checkIsBlackList','Contact.phone','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','Agent','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','dialCutDigit','substring','SIP/%s/%s%s','trim','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','toLowerVariables','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','custom:agentringnoanswer','[syncHangup][talking]','[syncHangup][talking][cause]','cause','statedesc','transfer','[syncHangup][talking][transfer]','destuniqueid','syncHangupRequest','addVariable','variables','syncVarSet','filterKey','keys','variable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','util','bluebird','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','syncDialEnd','newexten','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','type','name','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','message','originated','Trunk','active','callerid','Interval','format','voice:queue:%s','voice_queue:save','sendMessageOneNotActive','available','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','outbound','clearZombieChannels','recallMe','clearZombieChannel','sequence','isNil','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','stringify','pTalking:\x20'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0xef53,0x1ee));var _0x3ef5=function(_0x5e06a1,_0x340f61){_0x5e06a1=_0x5e06a1-0x0;var _0x5b3253=_0xef53[_0x5e06a1];return _0x5b3253;};'use strict';var util=require(_0x3ef5('0x0'));var _=require('lodash');var BPromise=require(_0x3ef5('0x1'));var uuid=require('uuid');var moment=require(_0x3ef5('0x2'));var md5=require(_0x3ef5('0x3'));var Redis=require(_0x3ef5('0x4'));var config=require(_0x3ef5('0x5'));var logger=require(_0x3ef5('0x6'))(_0x3ef5('0x7'));var loggerAction=require(_0x3ef5('0x6'))(_0x3ef5('0x8'));var ami=require(_0x3ef5('0x9'));var rpcDb=require(_0x3ef5('0xa'));var Action=require('./action');var ut=require('./util/util');config[_0x3ef5('0xb')]=_[_0x3ef5('0xc')](config[_0x3ef5('0xb')],{'host':_0x3ef5('0xd'),'port':0x18eb});var io=require(_0x3ef5('0xe'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x3ef5('0xf')][_0x3ef5('0x10')]=function(_0x532637){this[_0x3ef5('0x11')]=this[_0x3ef5('0x11')]?this[_0x3ef5('0x11')][_0x3ef5('0x12')](_0x532637):_0x532637();};function Preview(_0x397183){this['sequence']=new Sequence();this['campaignsPreview']=_0x397183['voiceQueues'];this[_0x3ef5('0x13')]=_0x397183['trunks'];this[_0x3ef5('0x14')]={};this[_0x3ef5('0x15')]=_0x397183[_0x3ef5('0x15')];this[_0x3ef5('0x16')]=0x0;ami['on'](_0x3ef5('0x17'),this[_0x3ef5('0x18')][_0x3ef5('0x19')](this));ami['on']('hangup',this[_0x3ef5('0x1a')][_0x3ef5('0x19')](this));ami['on'](_0x3ef5('0x1b'),this['syncHangupRequest'][_0x3ef5('0x19')](this));ami['on']('dialend',this[_0x3ef5('0x1c')]['bind'](this));ami['on'](_0x3ef5('0x1d'),this['syncNewExten'][_0x3ef5('0x19')](this));ami['on'](_0x3ef5('0x1e'),this['syncVarSet'][_0x3ef5('0x19')](this));ami['on'](_0x3ef5('0x1f'),this[_0x3ef5('0x20')]['bind'](this));ami['on'](_0x3ef5('0x21'),this[_0x3ef5('0x22')][_0x3ef5('0x19')](this));this[_0x3ef5('0x23')](this[_0x3ef5('0x24')]);}function emit(_0x1e4083,_0x56e046,_0x43476a){io['to'](_0x1e4083)[_0x3ef5('0x25')](_0x56e046,_0x43476a);}function emitCampaignPreview(_0x4a73f8){if(_0x4a73f8[_0x3ef5('0x26')]==='outbound'){var _0x58af55={'id':_0x4a73f8['id'],'name':_0x4a73f8[_0x3ef5('0x27')],'strategy':_0x4a73f8['strategy'],'answered':_0x4a73f8[_0x3ef5('0x28')],'available':_0x4a73f8['available'],'loggedIn':_0x4a73f8[_0x3ef5('0x29')],'pTalking':_0x4a73f8[_0x3ef5('0x2a')],'sumBillable':_0x4a73f8[_0x3ef5('0x2b')],'sumDuration':_0x4a73f8[_0x3ef5('0x2c')],'sumHoldTime':_0x4a73f8[_0x3ef5('0x2d')]||0x0,'talking':_0x4a73f8[_0x3ef5('0x2e')],'total':_0x4a73f8[_0x3ef5('0x2f')],'type':_0x4a73f8[_0x3ef5('0x26')],'unmanaged':_0x4a73f8['unmanaged'],'abandoned':_0x4a73f8[_0x3ef5('0x30')],'waiting':_0x4a73f8[_0x3ef5('0x31')],'loggedInDb':_0x4a73f8['loggedInDb'],'dialActive':_0x4a73f8[_0x3ef5('0x32')],'dialMethod':_0x4a73f8[_0x3ef5('0x33')],'dialOriginateCallerIdName':_0x4a73f8[_0x3ef5('0x34')],'dialOriginateCallerIdNumber':_0x4a73f8[_0x3ef5('0x35')],'dialOriginateTimeout':_0x4a73f8[_0x3ef5('0x36')],'dialPrefix':_0x4a73f8[_0x3ef5('0x37')],'outboundAnswerAgiCallsDay':_0x4a73f8['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x4a73f8[_0x3ef5('0x38')],'outboundBlacklistCallsDay':_0x4a73f8[_0x3ef5('0x39')],'outboundBusyCallsDay':_0x4a73f8[_0x3ef5('0x3a')],'outboundCongestionCallsDay':_0x4a73f8['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x4a73f8[_0x3ef5('0x3b')],'outboundDropCallsDayCallersExit':_0x4a73f8[_0x3ef5('0x3c')],'outboundDropCallsDayTimeout':_0x4a73f8[_0x3ef5('0x3d')],'outboundNoAnswerCallsDay':_0x4a73f8['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x4a73f8[_0x3ef5('0x3e')],'outboundOriginateFailureCallsDay':_0x4a73f8[_0x3ef5('0x3f')],'outboundReCallsDay':_0x4a73f8[_0x3ef5('0x40')],'outboundRejectCallsDay':_0x4a73f8[_0x3ef5('0x41')],'outboundUnknownCallsDay':_0x4a73f8[_0x3ef5('0x42')],'predictiveIntervalAnsweredCalls':_0x4a73f8[_0x3ef5('0x43')],'predictiveIntervalAvgHoldtime':_0x4a73f8[_0x3ef5('0x44')],'predictiveIntervalAvgTalktime':_0x4a73f8[_0x3ef5('0x45')],'predictiveIntervalDroppedCallsCallersExit':_0x4a73f8['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x4a73f8[_0x3ef5('0x46')],'predictiveIntervalErlangCalls':_0x4a73f8[_0x3ef5('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x4a73f8[_0x3ef5('0x48')],'predictiveIntervalHitRate':_0x4a73f8[_0x3ef5('0x49')],'predictiveIntervalLowerLimit':_0x4a73f8[_0x3ef5('0x4a')],'predictiveIntervalMultiplicativeFactor':_0x4a73f8[_0x3ef5('0x4b')],'predictiveIntervalPauses':_0x4a73f8[_0x3ef5('0x4c')],'predictiveIntervalTotalCalls':_0x4a73f8['predictiveIntervalTotalCalls'],'message':_0x4a73f8[_0x3ef5('0x4d')],'originated':_0x4a73f8[_0x3ef5('0x4e')]};if(_0x4a73f8[_0x3ef5('0x4f')]){_0x58af55['Trunk']={'id':_0x4a73f8[_0x3ef5('0x4f')]['id'],'name':_0x4a73f8[_0x3ef5('0x4f')][_0x3ef5('0x27')],'active':_0x4a73f8['Trunk'][_0x3ef5('0x50')],'callerid':_0x4a73f8[_0x3ef5('0x4f')][_0x3ef5('0x51')]};}if(_0x4a73f8[_0x3ef5('0x52')]){_0x58af55[_0x3ef5('0x52')]={'id':_0x4a73f8[_0x3ef5('0x52')]['id'],'name':_0x4a73f8[_0x3ef5('0x52')][_0x3ef5('0x27')]};}var _0x8dc9f=md5(JSON['stringify'](_0x58af55));if(_0x4a73f8[_0x3ef5('0x3')]!==_0x8dc9f){_0x4a73f8[_0x3ef5('0x3')]=_0x8dc9f;emit(util[_0x3ef5('0x53')](_0x3ef5('0x54'),_0x58af55[_0x3ef5('0x27')]),_0x3ef5('0x55'),_0x58af55);}}}function emitVoiceQueueChannelRemove(_0x12394e){emit(util[_0x3ef5('0x53')](_0x3ef5('0x54'),_0x12394e['name']),'voice_queue_channel:remove',_0x12394e);}function notSendMessagesQueue(_0x103b18){if(_0x103b18[_0x3ef5('0x56')]){if(_0x103b18['originated']===0x0&&_0x103b18[_0x3ef5('0x2a')]===0x0){_0x103b18[_0x3ef5('0x56')]=![];_0x103b18[_0x3ef5('0x57')]=0x0;_0x103b18[_0x3ef5('0x58')]=0x0;_0x103b18[_0x3ef5('0x4d')]=_0x3ef5('0x59');ut[_0x3ef5('0x5a')](_0x3ef5('0x5b'),_0x103b18[_0x3ef5('0x27')]+_0x3ef5('0x5c'));}else{_0x103b18['message']=_0x3ef5('0x5d');ut[_0x3ef5('0x5a')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x103b18[_0x3ef5('0x27')]+_0x3ef5('0x5e'));}emitCampaignPreview(_0x103b18);}}Preview[_0x3ef5('0xf')][_0x3ef5('0x23')]=function(){var _0x1bfd80=this;setInterval(function(){_0x1bfd80['syncCampaigns']();},0x7cf);};Preview[_0x3ef5('0xf')][_0x3ef5('0x5f')]=function(){var _0x2f3a6a=this[_0x3ef5('0x24')];this[_0x3ef5('0x16')]+=0x1;for(var _0x33c718 in _0x2f3a6a){if(_0x2f3a6a[_0x3ef5('0x60')](_0x33c718)&&(_0x2f3a6a[_0x33c718][_0x3ef5('0x33')]===_0x3ef5('0x7')||_0x2f3a6a[_0x33c718][_0x3ef5('0x33')]==='booked')&&_0x2f3a6a[_0x33c718][_0x3ef5('0x26')]===_0x3ef5('0x61')){if(this[_0x3ef5('0x16')]>0x7){this[_0x3ef5('0x16')]=0x0;this[_0x3ef5('0x62')]();}}if(_0x2f3a6a[_0x3ef5('0x60')](_0x33c718)&&_0x2f3a6a[_0x33c718]['dialMethod']===_0x3ef5('0x7')&&_0x2f3a6a[_0x33c718][_0x3ef5('0x26')]===_0x3ef5('0x61')){if(_0x2f3a6a[_0x33c718][_0x3ef5('0x32')]){this['setMessage'](_0x2f3a6a[_0x33c718]);this[_0x3ef5('0x63')](_0x2f3a6a[_0x33c718]);}else{notSendMessagesQueue(_0x2f3a6a[_0x33c718]);}}}};Preview[_0x3ef5('0xf')][_0x3ef5('0x64')]=function(_0x56d4f6){var _0x342ef7=this;this[_0x3ef5('0x65')][_0x3ef5('0x10')](function(){if(!_[_0x3ef5('0x66')](_0x342ef7['actions'][_0x56d4f6])){loggerAction[_0x3ef5('0x67')](_0x3ef5('0x68'),_0x56d4f6,_0x3ef5('0x69'),_0x342ef7[_0x3ef5('0x14')][_0x56d4f6][_0x3ef5('0x6a')],_0x3ef5('0x6b'),JSON[_0x3ef5('0x6c')](_0x342ef7[_0x3ef5('0x24')][_0x342ef7[_0x3ef5('0x14')][_0x56d4f6]['queue']][_0x3ef5('0x4e')]),_0x3ef5('0x6d'),JSON[_0x3ef5('0x6c')](_0x342ef7[_0x3ef5('0x24')][_0x342ef7[_0x3ef5('0x14')][_0x56d4f6][_0x3ef5('0x6a')]]['pTalking']),JSON[_0x3ef5('0x6c')](_0x342ef7[_0x3ef5('0x14')][_0x56d4f6]['dialAnswer']),JSON[_0x3ef5('0x6c')](_[_0x3ef5('0x6e')](_0x342ef7[_0x3ef5('0x14')][_0x56d4f6],[_0x3ef5('0x6f'),'UserId','VoiceQueueId',_0x3ef5('0x70')])));return ami[_0x3ef5('0x71')]({'action':_0x3ef5('0x72'),'channel':_0x342ef7[_0x3ef5('0x14')][_0x56d4f6][_0x3ef5('0x73')]})['catch'](function(_0x471cec){if(_0x471cec['message']===_0x3ef5('0x74')){setTimeout(function(){if(_0x342ef7[_0x3ef5('0x14')][_0x56d4f6]){ut[_0x3ef5('0x75')](_0x342ef7[_0x3ef5('0x24')][_0x342ef7[_0x3ef5('0x14')][_0x56d4f6][_0x3ef5('0x6a')]],_0x3ef5('0x76'));if(_0x342ef7[_0x3ef5('0x14')][_0x56d4f6][_0x3ef5('0x77')]===!![]){ut[_0x3ef5('0x78')](_0x342ef7[_0x3ef5('0x24')][_0x342ef7[_0x3ef5('0x14')][_0x56d4f6][_0x3ef5('0x6a')]],_0x3ef5('0x76'));ut[_0x3ef5('0x79')]('[Dialer][checkChannel][pTalking][Preview]'+_0x56d4f6,_0x342ef7[_0x3ef5('0x14')][_0x56d4f6][_0x3ef5('0x6a')]);}ut[_0x3ef5('0x79')]('[Dialer][checkChannel][Preview]'+_0x56d4f6,_0x342ef7['actions'][_0x56d4f6][_0x3ef5('0x6a')]);delete _0x342ef7[_0x3ef5('0x14')][_0x56d4f6];}},0x2328);}});}});};Preview[_0x3ef5('0xf')]['clearZombieChannels']=function(){var _0x128fae=this;loggerAction[_0x3ef5('0x67')](_0x3ef5('0x7a'),_['size'](this['actions']));for(var _0xc693a0 in this[_0x3ef5('0x14')]){if(_0x128fae[_0x3ef5('0x14')][_0x3ef5('0x60')](_0xc693a0)){_0x128fae['clearZombieChannel'](_0xc693a0);}}};Preview['prototype'][_0x3ef5('0x63')]=function(_0x244ea1){var _0x3ab658=this;rpcDb[_0x3ef5('0x7b')](_0x244ea1['id'],ut[_0x3ef5('0x7c')](this[_0x3ef5('0x15')]))['then'](function(_0x4304e3){if(!_['isNil'](_0x4304e3)){for(var _0x53bb71=0x0;_0x53bb71<_0x4304e3[_0x3ef5('0x7d')];_0x53bb71+=0x1){if(ut['getDiff'](_0x4304e3[_0x53bb71][_0x3ef5('0x7e')])<_0x244ea1[_0x3ef5('0x7f')]*0x3c){_0x3ab658[_0x3ef5('0x80')](_0x4304e3[_0x53bb71]['id'])[_0x3ef5('0x81')](ut[_0x3ef5('0x82')](_0x3ef5('0x83')))[_0x3ef5('0x84')](ut[_0x3ef5('0x82')](_0x3ef5('0x83')));}else{var _0xa5597=new Action(_0x4304e3[_0x53bb71],_0x244ea1);_0xa5597[_0x3ef5('0x85')]=moment()[_0x3ef5('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x244ea1[_0x3ef5('0x40')]+=0x1;ut[_0x3ef5('0x86')](_0xa5597,0x17,_0x3ef5('0x87'));if(_0x244ea1['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut[_0x3ef5('0x88')](_0x4304e3[_0x53bb71]));rpcDb[_0x3ef5('0x89')](_0xa5597,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x3ef5('0x86')](_0xa5597,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0xa5597,_0x3ef5('0x8a'));rpcDb[_0x3ef5('0x8b')](_0xa5597,_0x3ef5('0x8a'));}}}}})[_0x3ef5('0x84')](ut[_0x3ef5('0x82')]('[getContactRecallMe]'));};Preview[_0x3ef5('0xf')][_0x3ef5('0x8c')]=function(_0x19ccc8){_0x19ccc8[_0x3ef5('0x56')]=!![];if(ut['IsNotLoggedIn'](_0x19ccc8[_0x3ef5('0x29')])){_0x19ccc8[_0x3ef5('0x4d')]=_0x3ef5('0x8d');}else if(!ut[_0x3ef5('0x8e')](_0x19ccc8[_0x3ef5('0x32')])){_0x19ccc8[_0x3ef5('0x4d')]=_0x3ef5('0x59');}else if(!this['isTrunkReachable'](_0x19ccc8['Trunk'])){if(!this['isTrunkReachable'](_0x19ccc8[_0x3ef5('0x8f')])){_0x19ccc8[_0x3ef5('0x4d')]=_0x3ef5('0x90');}else{_0x19ccc8[_0x3ef5('0x4d')]='ACTIVE';}}else{_0x19ccc8[_0x3ef5('0x4d')]=_0x3ef5('0x91');}emitCampaignPreview(_0x19ccc8);};Preview[_0x3ef5('0xf')][_0x3ef5('0x92')]=function(_0x3b6c27,_0x36dfb1,_0x42fcdb){var _0x18d661=this;var _0x336448=this[_0x3ef5('0x14')][_0x36dfb1];var _0x37936e=this[_0x3ef5('0x24')][_0x336448[_0x3ef5('0x6a')]];var _0x295b43;if(_0x37936e){switch(_0x42fcdb){case'1':_0x37936e['outboundNoSuchCallsDay']+=0x1;_0x336448[_0x3ef5('0x93')]=ut[_0x3ef5('0x94')](_0x336448);ut['logCustomer'](_0x336448,0x0,_0x3ef5('0x95'));rpcDb['createCustomerHistory'](_0x336448,_0x3ef5('0x96'));if(ut[_0x3ef5('0x94')](_0x336448)>=_0x37936e[_0x3ef5('0x97')]){_0x295b43=ut[_0x3ef5('0x98')](_0x336448,0xf,'Global');rpcDb['createCustomerFinal'](_0x295b43,_0x3ef5('0x99'));}else{rpcDb[_0x3ef5('0x8b')](_0x336448,'[callProgressDetectingCustomer][logNoSuchGlobal]');}delete this[_0x3ef5('0x14')][_0x3b6c27[_0x3ef5('0x9a')]];break;case _0x3ef5('0x9b'):var _0x4d7de5=moment()['format'](_0x3ef5('0x9c'));_0x336448['responsetime']=_0x4d7de5;_0x336448[_0x3ef5('0x9d')]=_0x4d7de5;_0x336448[_0x3ef5('0x77')]=!![];_0x37936e[_0x3ef5('0x2a')]+=0x1;logger[_0x3ef5('0x67')](_0x3ef5('0x9e'),_0x336448[_0x3ef5('0x9f')],_0x3ef5('0xa0'),_0x37936e[_0x3ef5('0x27')],_0x3ef5('0x6d'),_0x37936e['pTalking']);ami['emit']('custom:agentconnect',ut[_0x3ef5('0xa1')](_0x336448,_0x3ef5('0xa2')));if(_0x37936e[_0x3ef5('0xa3')]){ami[_0x3ef5('0x25')](_0x3ef5('0xa4'),ut[_0x3ef5('0xa5')](_0x336448));}break;case'16':ami[_0x3ef5('0x25')](_0x3ef5('0xa6'),ut[_0x3ef5('0xa1')](_0x336448,_0x3ef5('0xa7')));emitVoiceQueueChannelRemove(ut[_0x3ef5('0xa1')](_0x336448,_0x3ef5('0xa7')));_0x37936e[_0x3ef5('0x38')]+=0x1;_0x37936e[_0x3ef5('0x2f')]+=0x1;_0x37936e['answered']+=0x1;ut[_0x3ef5('0x78')](_0x37936e,_0x3ef5('0xa8'));_0x336448['countglobal']=ut[_0x3ef5('0x94')](_0x336448);ut[_0x3ef5('0x86')](_0x336448,0x4,_0x3ef5('0xa9'));rpcDb[_0x3ef5('0x89')](_0x336448,_0x3ef5('0xaa'));rpcDb[_0x3ef5('0x8b')](_0x336448,_0x3ef5('0xab'));rpcDb[_0x3ef5('0xac')](_0x336448);_0x37936e[_0x3ef5('0x2c')]+=_0x336448[_0x3ef5('0xad')];_0x37936e[_0x3ef5('0x2b')]+=_0x336448[_0x3ef5('0xad')];logger[_0x3ef5('0x67')]('[syncHangup][talking][decrement]',_0x336448[_0x3ef5('0x9f')],_0x3ef5('0xa0'),_0x37936e[_0x3ef5('0x27')],_0x3ef5('0x6d'),_0x37936e[_0x3ef5('0x2a')]);delete this[_0x3ef5('0x14')][_0x3b6c27['linkedid']];break;case'BUSY':_0x37936e['outboundBusyCallsDay']+=0x1;_0x336448[_0x3ef5('0xae')]+=0x1;_0x336448[_0x3ef5('0x93')]=ut['totalGlobal'](_0x336448);ut[_0x3ef5('0x86')](_0x336448,0x5,'Busy');rpcDb['createCustomerHistory'](_0x336448,_0x3ef5('0xaf'));if(ut['totalGlobal'](_0x336448)>=_0x37936e[_0x3ef5('0x97')]){_0x295b43=ut[_0x3ef5('0x98')](_0x336448,0xf,_0x3ef5('0xb0'));rpcDb[_0x3ef5('0x8b')](_0x295b43,_0x3ef5('0xb1'));}else{if(_0x336448[_0x3ef5('0xae')]>=_0x37936e[_0x3ef5('0xb2')]){rpcDb['createCustomerFinal'](_0x336448,_0x3ef5('0xaf'));}else{rpcDb[_0x3ef5('0xb3')](ut['scheduledAt'](_0x336448,'countbusyretry',_0x37936e['dialBusyRetryFrequency']),_0x336448[_0x3ef5('0xb4')],_0x336448[_0x3ef5('0xb5')]);}}break;case'NOANSWER':_0x37936e[_0x3ef5('0xb6')]+=0x1;_0x336448[_0x3ef5('0xb7')]+=0x1;_0x336448[_0x3ef5('0x93')]=ut[_0x3ef5('0x94')](_0x336448);ut['logCustomer'](_0x336448,0x3,_0x3ef5('0xb8'));rpcDb[_0x3ef5('0x89')](_0x336448,_0x3ef5('0xb9'));if(ut[_0x3ef5('0x94')](_0x336448)>=_0x37936e[_0x3ef5('0x97')]){_0x295b43=ut[_0x3ef5('0x98')](_0x336448,0xf,'Global');rpcDb['createCustomerFinal'](_0x295b43,_0x3ef5('0xba'));}else{if(_0x336448[_0x3ef5('0xb7')]>=_0x37936e[_0x3ef5('0xbb')]){rpcDb['createCustomerFinal'](_0x336448,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x3ef5('0xb3')](ut[_0x3ef5('0xbc')](_0x336448,_0x3ef5('0xb7'),_0x37936e[_0x3ef5('0xbd')]),_0x336448[_0x3ef5('0xb4')],_0x336448[_0x3ef5('0xb5')]);}}break;case _0x3ef5('0xbe'):_0x37936e['outboundCongestionCallsDay']+=0x1;_0x336448['countcongestionretry']+=0x1;_0x336448[_0x3ef5('0x93')]=ut['totalGlobal'](_0x336448);ut[_0x3ef5('0x86')](_0x336448,0x8,_0x3ef5('0xbf'));rpcDb[_0x3ef5('0x89')](_0x336448,_0x3ef5('0xc0'));if(ut['totalGlobal'](_0x336448)>=_0x37936e[_0x3ef5('0x97')]){_0x295b43=ut[_0x3ef5('0x98')](_0x336448,0xf,_0x3ef5('0xb0'));rpcDb[_0x3ef5('0x8b')](_0x295b43,_0x3ef5('0xc1'));}else{if(_0x336448[_0x3ef5('0xc2')]>=_0x37936e[_0x3ef5('0xc3')]){rpcDb[_0x3ef5('0x8b')](_0x336448,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x3ef5('0xb3')](ut['scheduledAt'](_0x336448,'countcongestionretry',_0x37936e[_0x3ef5('0xc4')]),_0x336448['unlockAgent'],_0x336448[_0x3ef5('0xb5')]);}}break;case _0x3ef5('0xc5'):_0x37936e[_0x3ef5('0x41')]+=0x1;_0x336448[_0x3ef5('0x93')]=ut['totalGlobal'](_0x336448);ut[_0x3ef5('0x86')](_0x336448,0x14,_0x3ef5('0xc6'));rpcDb[_0x3ef5('0x89')](_0x336448,_0x3ef5('0xc7'));if(_0x336448['unlockAgent']){rpcDb[_0x3ef5('0xc8')](_0x336448[_0x3ef5('0xc9')]);}if(_0x336448['activeContact']){rpcDb['disableContact'](_0x336448[_0x3ef5('0xc9')]);}break;default:if(_0x336448[_0x3ef5('0x77')]){ut[_0x3ef5('0x78')](_0x37936e,_0x3ef5('0xca'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x37936e[_0x3ef5('0x27')],_0x3b6c27);}_0x37936e[_0x3ef5('0x42')]+=0x1;_0x336448[_0x3ef5('0x93')]=ut[_0x3ef5('0x94')](_0x336448);ut['logCustomer'](_0x336448,0xc,_0x3b6c27[_0x3ef5('0xcb')]||_0x3b6c27[_0x3ef5('0xcc')]);rpcDb[_0x3ef5('0x89')](_0x336448,_0x3ef5('0xcd'));if(ut[_0x3ef5('0x94')](_0x336448)>=_0x37936e[_0x3ef5('0x97')]){_0x295b43=ut[_0x3ef5('0x98')](_0x336448,0xf,'Global');rpcDb[_0x3ef5('0x8b')](_0x295b43,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x3ef5('0x8b')](_0x336448,_0x3ef5('0xce'));}delete this[_0x3ef5('0x14')][_0x3b6c27['linkedid']];}if(!(_0x336448[_0x3ef5('0x77')]&&_0x42fcdb==='16')){ut[_0x3ef5('0x75')](_0x37936e,_0x3ef5('0xcf'));logger['info'](_0x3ef5('0xd0'),_0x336448['uniqueid'],'\x20Queue',_0x37936e[_0x3ef5('0x27')],_0x3ef5('0x6b'),_0x37936e[_0x3ef5('0x4e')]);}if(_0x42fcdb!==_0x3ef5('0x9b')){delete this[_0x3ef5('0x14')][_0x3b6c27['linkedid']];delete this[_0x3ef5('0x14')][_0x3b6c27[_0x3ef5('0xd1')]];}}};Preview[_0x3ef5('0xf')][_0x3ef5('0xd2')]=function(_0x5a55dc,_0x3a7563,_0x5eb707){if(_[_0x3ef5('0xd3')](_0x3a7563)&&_0x3ef5('0xd4')!==typeof _0x3a7563){return;}if(_[_0x3ef5('0xd3')](_0x5eb707)&&_0x3ef5('0xd4')!==typeof _0x5eb707){return;}switch(_0x5eb707[_0x3ef5('0xd5')]){case'0':ut[_0x3ef5('0xd6')](_0x5a55dc,0x0,_0x3ef5('0x95'));rpcDb['createAgentHistory'](_0x5a55dc,_0x3ef5('0xd7'));break;case'3':ut[_0x3ef5('0xd6')](_0x5a55dc,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0x5a55dc,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x3ef5('0xd6')](_0x5a55dc,0x5,_0x3ef5('0xd8'));rpcDb[_0x3ef5('0xd9')](_0x5a55dc,_0x3ef5('0xda'));break;case'8':ut[_0x3ef5('0xd6')](_0x5a55dc,0x8,'Congestion');rpcDb[_0x3ef5('0xd9')](_0x5a55dc,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x3ef5('0xd6')](_0x5a55dc,0x16,'AnswerAGI');rpcDb[_0x3ef5('0xd9')](_0x5a55dc,_0x3ef5('0xdb'));break;default:ut[_0x3ef5('0xd6')](_0x5a55dc,0xc,_0x5eb707['reason']);rpcDb[_0x3ef5('0xd9')](_0x5a55dc,_0x3ef5('0xdc'));}ut[_0x3ef5('0x75')](_0x3a7563,_0x3ef5('0xdd'));logger[_0x3ef5('0x67')](_0x3ef5('0xde'),_0x5a55dc[_0x3ef5('0x9f')],_0x3ef5('0xa0'),_0x3a7563['name'],_0x3ef5('0x6b'),_0x3a7563[_0x3ef5('0x4e')]);delete this[_0x3ef5('0x14')][_0x5a55dc['uniqueid']];};Preview[_0x3ef5('0xf')]['checkInBlack']=function(_0x3b0557,_0x214ae8,_0x466726,_0x2fd84d,_0x44a0d7){var _0x4b720f=this;return new BPromise(function(_0x31d550,_0x25c9e4){if(_[_0x3ef5('0x66')](_0x214ae8)||_[_0x3ef5('0x66')](_0x214ae8[_0x3ef5('0xdf')])||_[_0x3ef5('0x66')](_0x214ae8[_0x3ef5('0xdf')][_0x3ef5('0xe0')])||_['isNil'](_0x214ae8[_0x3ef5('0xe1')])){_0x25c9e4(ut[_0x3ef5('0x4d')](_0x3ef5('0xe2'),_0x2fd84d,_0x44a0d7));return;}var _0x39e1da=uuid['v4']();var _0x2322d3=_0x4b720f[_0x3ef5('0x24')][_0x214ae8[_0x3ef5('0x69')][_0x3ef5('0x27')]];var _0x207d96=_0x466726?_0x4b720f[_0x3ef5('0x15')][_0x466726]['id']:undefined;_0x4b720f[_0x3ef5('0x14')][_0x39e1da]=new Action(_0x214ae8,_0x2322d3,_0x39e1da,_0x466726,_0x207d96);var _0x428b39=_0x4b720f[_0x3ef5('0x14')][_0x39e1da];_0x428b39['unlockAgent']=_0x2fd84d;_0x428b39[_0x3ef5('0xb5')]=_0x44a0d7;_0x428b39[_0x3ef5('0xe3')]=_0x466726;if(_[_0x3ef5('0xe4')](_0x3b0557)){_0x4b720f[_0x3ef5('0xe5')](_0x428b39,_0x2322d3,_0x214ae8,_0x466726)[_0x3ef5('0x81')](function(_0xe87e7a){logger[_0x3ef5('0x67')](_0x3ef5('0xe6'),_0x3ef5('0xe7')+_0x428b39['queue']+'\x20IdHopper:\x20'+_0x428b39[_0x3ef5('0xc9')],JSON['stringify'](_0xe87e7a));ami[_0x3ef5('0x25')](_0x3ef5('0xe8'),ut['buildObj'](_0x428b39,_0x3ef5('0xe9')));_0x31d550(ut['message']('Calling'));})[_0x3ef5('0x84')](function(_0xe3c811){ut[_0x3ef5('0x5a')](_0x3ef5('0xea'),_0xe3c811);_0x25c9e4(ut[_0x3ef5('0x4d')]('Call\x20failed',_0x2fd84d,_0x44a0d7));});}else{_0x2322d3[_0x3ef5('0x39')]+=0x1;ut[_0x3ef5('0xeb')](_0x428b39);rpcDb['createHistory'](_0x428b39,'[Blacklist][error]');delete _0x4b720f[_0x3ef5('0x14')][_0x39e1da];_0x25c9e4(ut[_0x3ef5('0x4d')](_0x3ef5('0xec'),_0x2fd84d,_0x44a0d7));}});};Preview[_0x3ef5('0xf')][_0x3ef5('0xed')]=function(_0x25b1d4){return!_['isNil'](_0x25b1d4)&&!_['isNil'](_0x25b1d4[_0x3ef5('0x27')])&&!_[_0x3ef5('0x66')](_0x25b1d4[_0x3ef5('0x50')])&&_0x25b1d4[_0x3ef5('0x50')]&&!_['isNil'](this[_0x3ef5('0x13')][util[_0x3ef5('0x53')]('SIP/%s',_0x25b1d4['name'])])&&!_['isNil'](this['trunks'][util[_0x3ef5('0x53')](_0x3ef5('0xee'),_0x25b1d4['name'])][_0x3ef5('0x72')])&&(this[_0x3ef5('0x13')][util['format'](_0x3ef5('0xee'),_0x25b1d4[_0x3ef5('0x27')])][_0x3ef5('0x72')]===_0x3ef5('0xef')||this[_0x3ef5('0x13')][util[_0x3ef5('0x53')](_0x3ef5('0xee'),_0x25b1d4[_0x3ef5('0x27')])]['status']===_0x3ef5('0xf0'));};Preview[_0x3ef5('0xf')][_0x3ef5('0x80')]=function(_0x4b478e,_0x2fa59c){var _0x118e68=this;return new BPromise(function(_0x426074,_0x171990){_0x118e68[_0x3ef5('0xf1')](_0x4b478e,_0x2fa59c)['then'](function(_0x363b69){_0x426074(_[_0x3ef5('0x6e')](_0x363b69,['message']));})[_0x3ef5('0x84')](function(_0x29792d){if(_0x29792d[_0x3ef5('0xf2')]){rpcDb['unlockContact'](_0x4b478e);}if(_0x29792d['active']){rpcDb[_0x3ef5('0xf3')](_0x4b478e);}_0x171990(_[_0x3ef5('0x6e')](_0x29792d,['message']));});});};Preview[_0x3ef5('0xf')][_0x3ef5('0xf1')]=function(_0x4b8c0a,_0x44bc11){var _0x107e2e=this;return new BPromise(function(_0x241605,_0x2d0d00){var _0xb34563,_0xbed713;rpcDb['getContactPreview'](_0x4b8c0a)[_0x3ef5('0x81')](function(_0x2dd311){if(!_[_0x3ef5('0x66')](_0x2dd311[0x0])){_0xbed713=_0x2dd311[0x0][_0x3ef5('0xf4')]?![]:!![];_0xb34563=_0x2dd311[0x0][_0x3ef5('0xf4')]?!![]:![];_0xb34563=_0x44bc11?!![]:_0xb34563;}var _0xf2b544=_0x107e2e['validateContact'](_0x2dd311);if(_0xf2b544[_0x3ef5('0xf5')]){rpcDb[_0x3ef5('0xf6')](_[_0x3ef5('0x6e')](_0x2dd311[0x0],[_0x3ef5('0xe1'),_0x3ef5('0xf7')]))[_0x3ef5('0x81')](function(_0x506e38){_0x107e2e[_0x3ef5('0xf8')](_0x506e38,_0x2dd311[0x0],_0x44bc11,_0xbed713,_0xb34563)[_0x3ef5('0x81')](function(_0x1548d5){_0x241605(_0x1548d5);})['catch'](function(_0x42f97a){_0x2d0d00(_0x42f97a);});})[_0x3ef5('0x84')](function(_0x3d8106){ut[_0x3ef5('0x5a')](_0x3ef5('0xf9'),_0x3d8106);_0x2d0d00(ut[_0x3ef5('0x4d')](_0x3ef5('0xfa'),_0xbed713,_0xb34563));});}else{_0x2d0d00(ut['message'](_0xf2b544[_0x3ef5('0x4d')],_0xbed713,_0xb34563));}})[_0x3ef5('0x84')](function(_0x38d267){ut[_0x3ef5('0x5a')](_0x3ef5('0xfb'),_0x38d267);_0x2d0d00(ut['message'](_0x3ef5('0xfa'),![],!![]));});});};Preview[_0x3ef5('0xf')][_0x3ef5('0xfc')]=function(_0x5d7628){if(_[_0x3ef5('0x66')](_0x5d7628)||_[_0x3ef5('0xe4')](_0x5d7628)||!_['isNil'](_0x5d7628[0x0][_0x3ef5('0xfd')])&&_['isNil'](_0x5d7628[0x0][_0x3ef5('0xfd')][_0x3ef5('0x27')])){ut[_0x3ef5('0x5a')]('[Preview][validateContact][Empty\x20Contact]',_0x5d7628);return{'isValid':![],'message':_0x3ef5('0xfe')};}var _0x27410f=this[_0x3ef5('0x24')][_0x5d7628[0x0]['Queue'][_0x3ef5('0x27')]];_0x27410f[_0x3ef5('0x4d')]=_0x3ef5('0x91');if(_[_0x3ef5('0x66')](_0x27410f)){ut[_0x3ef5('0x5a')](_0x3ef5('0xff'),_0x27410f);return{'isValid':![],'message':_0x3ef5('0x100')};}if(!this[_0x3ef5('0xed')](_0x27410f[_0x3ef5('0x4f')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x3ef5('0x101')+_0x27410f['name']+_0x3ef5('0x102'));if(!this[_0x3ef5('0xed')](_0x27410f[_0x3ef5('0x8f')])){ut[_0x3ef5('0x5a')](_0x3ef5('0x103'),_0x27410f['name']+_0x3ef5('0x104'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0x3ef5('0x8e')](_0x27410f[_0x3ef5('0x32')])){ut[_0x3ef5('0x5a')](_0x3ef5('0x105'),_0x27410f[_0x3ef5('0x27')]+_0x3ef5('0x106'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x27410f[_0x3ef5('0x27')]+_0x3ef5('0x106')};}return{'isValid':!![],'message':_0x3ef5('0x107')};};Preview[_0x3ef5('0xf')][_0x3ef5('0xe5')]=function(_0x22e334,_0x3d8450,_0x511130,_0x598de1){var _0x122fd7=this;return new BPromise(function(_0x2ee8d4,_0xfb9395){var _0x2bf4df=_0x22e334[_0x3ef5('0x9f')];var _0x17154e=_0x122fd7[_0x3ef5('0xed')](_0x3d8450[_0x3ef5('0x4f')])?util[_0x3ef5('0x53')]('SIP/%s/%s%s',_0x3d8450[_0x3ef5('0x4f')][_0x3ef5('0x27')],_['isNil'](_0x3d8450[_0x3ef5('0x37')])?'':_0x3d8450[_0x3ef5('0x37')]['trim']()||'',_0x3d8450[_0x3ef5('0x108')]>0x0?_0x511130['Contact']['phone'][_0x3ef5('0x109')](_0x3d8450['dialCutDigit']):_0x511130[_0x3ef5('0xdf')][_0x3ef5('0xe0')]):util[_0x3ef5('0x53')](_0x3ef5('0x10a'),_['isNil'](_0x3d8450[_0x3ef5('0x8f')])?_0x3d8450[_0x3ef5('0x4f')][_0x3ef5('0x27')]:_0x3d8450[_0x3ef5('0x8f')][_0x3ef5('0x27')],_[_0x3ef5('0x66')](_0x3d8450[_0x3ef5('0x37')])?'':_0x3d8450[_0x3ef5('0x37')][_0x3ef5('0x10b')]()||'',_0x3d8450['dialCutDigit']>0x0?_0x511130[_0x3ef5('0xdf')]['phone']['substring'](_0x3d8450[_0x3ef5('0x108')]):_0x511130[_0x3ef5('0xdf')][_0x3ef5('0xe0')]);var _0x489fb1=_0x122fd7[_0x3ef5('0xed')](_0x3d8450[_0x3ef5('0x4f')])?ut[_0x3ef5('0x10c')](_0x3d8450[_0x3ef5('0x4f')][_0x3ef5('0x51')],_0x3d8450['dialOriginateCallerIdName'],_0x3d8450[_0x3ef5('0x10d')]>0x0?ut['getCallerIdRandom'](_0x3d8450[_0x3ef5('0x35')],_0x3d8450[_0x3ef5('0x10d')]):_0x3d8450['dialOriginateCallerIdNumber']):ut['getCallerId'](_['isNil'](_0x3d8450[_0x3ef5('0x8f')])?_0x3d8450['Trunk'][_0x3ef5('0x51')]:_0x3d8450['TrunkBackup'][_0x3ef5('0x51')],_0x3d8450[_0x3ef5('0x34')],_0x3d8450[_0x3ef5('0x10d')]>0x0?ut[_0x3ef5('0x10e')](_0x3d8450['dialOriginateCallerIdNumber'],_0x3d8450['dialRandomLastDigitCallerIdNumber']):_0x3d8450[_0x3ef5('0x35')]);if(_0x489fb1){_0x22e334[_0x3ef5('0x10f')]=ut[_0x3ef5('0x110')](_0x489fb1);_0x22e334['originatecalleridnum']=ut[_0x3ef5('0x111')](_0x489fb1);}var _0x39d137=ut[_0x3ef5('0x112')](_0x3d8450,_0x511130,_0x17154e,_0x489fb1,_0x2bf4df,_0x22e334);_['merge'](_0x22e334,ut[_0x3ef5('0x113')](_0x39d137));_0x22e334[_0x3ef5('0x85')]=moment()[_0x3ef5('0x53')]('YYYY-MM-DD\x20HH:mm:ss');ami['Action'](ut['variablesAction'](_0x22e334,_0x3d8450,_0x39d137,_0x22e334[_0x3ef5('0xb5')],_0x598de1))[_0x3ef5('0x81')](function(_0x558558){_0x3d8450[_0x3ef5('0x4e')]+=0x1;logger['info'](_0x3ef5('0x114'),_0x2bf4df,_0x3ef5('0xa0'),_0x3d8450['name'],_0x3ef5('0x6b'),_0x3d8450['originated']);_0x2ee8d4(_0x558558);})['catch'](function(_0x354e5a){ut[_0x3ef5('0xd6')](_0x22e334,0xe,'OriginateError');rpcDb[_0x3ef5('0xd9')](_0x22e334,_0x3ef5('0x115'));_0xfb9395(_0x354e5a);});});};Preview[_0x3ef5('0xf')]['syncNewExten']=function(_0x4dc659){if(this[_0x3ef5('0x14')][_0x4dc659[_0x3ef5('0x9a')]]){this['actions'][_0x4dc659[_0x3ef5('0x9a')]][_0x3ef5('0x73')]=_0x4dc659[_0x3ef5('0x73')];}};Preview[_0x3ef5('0xf')]['syncOriginateResponse']=function(_0x3c10fb){var _0xc0c001=this;var _0x2ea6e9=this[_0x3ef5('0x14')][_0x3c10fb[_0x3ef5('0x116')]];if(_0x2ea6e9){if(_0x2ea6e9[_0x3ef5('0xe3')]&&this[_0x3ef5('0x15')][_0x2ea6e9['lookAgent']]){ut[_0x3ef5('0x117')](_0x2ea6e9,this['agents'][_0x2ea6e9[_0x3ef5('0xe3')]][_0x3ef5('0x27')],this[_0x3ef5('0x15')][_0x2ea6e9[_0x3ef5('0xe3')]]['id']);}var _0x2e5720=_[_0x3ef5('0x118')](_0x2ea6e9);_0x2e5720[_0x3ef5('0x119')]=moment()[_0x3ef5('0x53')](_0x3ef5('0x9c'));var _0x30a21b=_0xc0c001['campaignsPreview'][_0x2ea6e9[_0x3ef5('0x6a')]];if(ut['isFailure'](_0x3c10fb[_0x3ef5('0x11a')])){if(_0x2ea6e9[_0x3ef5('0xb4')]){rpcDb[_0x3ef5('0xc8')](_0x2ea6e9[_0x3ef5('0xc9')]);}if(_0x2ea6e9[_0x3ef5('0xb5')]){rpcDb['disableContact'](_0x2ea6e9[_0x3ef5('0xc9')]);}ami['emit'](_0x3ef5('0x11b'),ut['buildObj'](_0x2ea6e9,'rejected'));this[_0x3ef5('0xd2')](_0x2e5720,_0x30a21b,_0x3c10fb);}else{_0x2ea6e9[_0x3ef5('0x85')]=moment()['format'](_0x3ef5('0x9c'));ut[_0x3ef5('0xd6')](_0x2e5720,0x4,_0x3ef5('0xa9'));rpcDb[_0x3ef5('0xd9')](_0x2e5720,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x3ef5('0xf')][_0x3ef5('0x1a')]=function(_0x5cabbc){var _0x4fef10=this;var _0x433195=this['actions'][_0x5cabbc['linkedid']];var _0x83b13b;if(_0x433195){_0x83b13b=this[_0x3ef5('0x24')][_0x433195[_0x3ef5('0x6a')]];logger[_0x3ef5('0x67')](_0x3ef5('0x11c'),_0x5cabbc[_0x3ef5('0x9a')],_0x3ef5('0xa0'),_0x83b13b[_0x3ef5('0x27')],'pTalking:\x20',_0x83b13b['pTalking']);}if(this[_0x3ef5('0x14')][_0x5cabbc['linkedid']]&&_0x5cabbc['linkedid']!==_0x5cabbc[_0x3ef5('0x9f')]){if(_0x5cabbc['cause']==='16'&&this[_0x3ef5('0x14')][_0x5cabbc['linkedid']]['dialAnswer']){this['callProgressDetectingCustomer'](_0x5cabbc,_0x5cabbc[_0x3ef5('0x9a')],_0x5cabbc['cause']);}else if(this[_0x3ef5('0x14')][_0x5cabbc[_0x3ef5('0x9a')]][_0x3ef5('0x77')]){logger[_0x3ef5('0x67')](_0x3ef5('0x11d'),_0x5cabbc[_0x3ef5('0x9a')],_0x5cabbc[_0x3ef5('0x11e')],_0x3ef5('0xa0'),_0x83b13b[_0x3ef5('0x27')],'pTalking:\x20',_0x83b13b[_0x3ef5('0x2a')]);this[_0x3ef5('0x92')](_0x5cabbc,_0x5cabbc['linkedid'],_0x5cabbc[_0x3ef5('0x11e')]);}}else if(_0x433195&&_[_0x3ef5('0x66')](_0x433195[_0x3ef5('0x11f')])&&_0x83b13b['dialQueueProject']&&_0x5cabbc[_0x3ef5('0x9a')]===_0x5cabbc[_0x3ef5('0x9f')]&&_['isNil'](_0x5cabbc['reason'])&&_0x5cabbc[_0x3ef5('0x11e')]==='16'&&_0x5cabbc['channelstate']==='6'&&_[_0x3ef5('0xd3')](_0x433195[_0x3ef5('0x120')])){if(_0x433195[_0x3ef5('0xb4')]){rpcDb[_0x3ef5('0xc8')](_0x433195[_0x3ef5('0xc9')]);}if(_0x433195[_0x3ef5('0xb5')]){rpcDb[_0x3ef5('0xf3')](_0x433195['idContact']);}_0x5cabbc[_0x3ef5('0xd5')]='22';this[_0x3ef5('0xd2')](_0x433195,_0x83b13b,_0x5cabbc);}else if(_0x433195&&_0x433195['transfer']){if(_0x5cabbc['cause']==='16'&&this['actions'][_0x5cabbc[_0x3ef5('0x9a')]][_0x3ef5('0x77')]){logger[_0x3ef5('0x67')](_0x3ef5('0x121'),_0x5cabbc[_0x3ef5('0x9a')],_0x5cabbc[_0x3ef5('0x11e')],_0x3ef5('0xa0'),_0x83b13b[_0x3ef5('0x27')],_0x3ef5('0x6d'),_0x83b13b[_0x3ef5('0x2a')]);this[_0x3ef5('0x92')](_0x5cabbc,_0x5cabbc[_0x3ef5('0x9a')],_0x5cabbc['cause']);}else if(this[_0x3ef5('0x14')][_0x5cabbc['linkedid']][_0x3ef5('0x77')]){logger[_0x3ef5('0x67')](_0x3ef5('0x11d'),_0x5cabbc['linkedid'],_0x5cabbc[_0x3ef5('0x11e')],_0x3ef5('0xa0'),_0x83b13b['name'],_0x3ef5('0x6d'),_0x83b13b[_0x3ef5('0x2a')]);this[_0x3ef5('0x92')](_0x5cabbc,_0x5cabbc[_0x3ef5('0x9a')],_0x5cabbc[_0x3ef5('0x11e')]);}}};Preview['prototype']['syncDialEnd']=function(_0x3ec3fe){if(this[_0x3ef5('0x14')][_0x3ec3fe[_0x3ef5('0xd1')]]&&_0x3ec3fe[_0x3ef5('0xd1')]!==_0x3ec3fe[_0x3ef5('0x122')]){this[_0x3ef5('0x92')](_0x3ec3fe,_0x3ec3fe[_0x3ef5('0xd1')],_0x3ec3fe[_0x3ef5('0xcc')]);}};Preview[_0x3ef5('0xf')][_0x3ef5('0x123')]=function(_0xea9712){if(this[_0x3ef5('0x14')][_0xea9712[_0x3ef5('0x9a')]]&&_0xea9712[_0x3ef5('0x9a')]!==_0xea9712[_0x3ef5('0x9f')]&&!this[_0x3ef5('0x14')][_0xea9712['linkedid']][_0x3ef5('0x77')]){if(_0xea9712[_0x3ef5('0x11e')]==='1'){this[_0x3ef5('0x92')](_0xea9712,_0xea9712[_0x3ef5('0x9a')],_0xea9712[_0x3ef5('0x11e')]);}}};Preview[_0x3ef5('0xf')][_0x3ef5('0x124')]=function(_0x5e9237,_0x35f43c,_0x3336fc){if(this[_0x3ef5('0x14')][_0x5e9237]){if(_[_0x3ef5('0x66')](this[_0x3ef5('0x14')][_0x5e9237]['variables'])){this[_0x3ef5('0x14')][_0x5e9237][_0x3ef5('0x125')]={};}this[_0x3ef5('0x14')][_0x5e9237]['variables'][_0x35f43c]=_0x3336fc;}};Preview[_0x3ef5('0xf')][_0x3ef5('0x126')]=function(_0x41dd0e){try{if(!_[_0x3ef5('0x66')](_0x41dd0e)){if(ut[_0x3ef5('0x127')](_[_0x3ef5('0x128')](_0x41dd0e[_0x3ef5('0x129')])[0x0])){this['addVariable'](_0x41dd0e['uniqueid'],_[_0x3ef5('0x128')](_0x41dd0e[_0x3ef5('0x129')])[0x0],_0x41dd0e['value']);}}}catch(_0x1b57bd){logger[_0x3ef5('0x12a')](_0x3ef5('0x12b'),util[_0x3ef5('0x12c')](_0x1b57bd,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x3ef5('0x20')]=function(_0x3bd0b7){if(_0x3bd0b7){if(this[_0x3ef5('0x14')][_0x3bd0b7[_0x3ef5('0x12d')]]){this[_0x3ef5('0x14')][_0x3bd0b7[_0x3ef5('0x12d')]][_0x3ef5('0x120')]=!![];}}};Preview[_0x3ef5('0xf')]['syncBlindTransfer']=function(_0x2e4533){if(_0x2e4533){if(this[_0x3ef5('0x14')][_0x2e4533['transfererlinkedid']]){this[_0x3ef5('0x14')][_0x2e4533['transfererlinkedid']][_0x3ef5('0x120')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x5351=['countglobal','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','BUSY','Busy','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','rescheduleContact','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','activeContact','CONGESTION','countcongestionretry','[callProgressDetectingCustomer][logCongestion]','Global','[callProgressDetectingCustomer][logCongestionGlobal]','scheduledAt','CANCEL','[syncHangupRequest][logAgentReject]','unlockContact','idContact','disableContact','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','Call\x20failed','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','Agent','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','campaign\x20Name:\x20','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','callerid','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','isFailure','custom:agentringnoanswer','rejected','Answer','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','syncDialEnd','destuniqueid','dialstatus','variables','syncVarSet','keys','addVariable','variable','error','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','defaults','localhost','socket.io-emitter','redis','prototype','tail','finally','campaignsPreview','trunks','agents','clockClearZombieChannels','originateresponse','bind','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','name','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','originated','Trunk','active','Interval','stringify','format','voice:queue:%s','voice_queue:save','voice_queue_channel:remove','sendMessageOneNotActive','paused','message','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','outbound','recallMe','clearZombieChannel','sequence','enqueue','isNil','Queue','actions','queue','originated:\x20','pTalking:\x20','pick','UserId','VoiceQueueId','ListId','Action','channel','catch','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','info','[action]','size','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','dialRecallMeTimeout','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','totalGlobal','NoSuchNumber','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','linkedid','ANSWER','answertime','dialAnswer','uniqueid','\x20Queue','emit','custom:agentconnect','connect','acw','custom:agentConnectPreview','custom:agentcomplete','buildObj','complete'];(function(_0x7460d8,_0x2fc1a1){var _0x338f82=function(_0x1cec50){while(--_0x1cec50){_0x7460d8['push'](_0x7460d8['shift']());}};_0x338f82(++_0x2fc1a1);}(_0x5351,0x1c0));var _0x1535=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5351[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x1535('0x0'));var _=require(_0x1535('0x1'));var BPromise=require(_0x1535('0x2'));var uuid=require(_0x1535('0x3'));var moment=require(_0x1535('0x4'));var md5=require(_0x1535('0x5'));var Redis=require(_0x1535('0x6'));var config=require(_0x1535('0x7'));var logger=require(_0x1535('0x8'))(_0x1535('0x9'));var loggerAction=require('../../../config/logger')(_0x1535('0xa'));var ami=require(_0x1535('0xb'));var rpcDb=require(_0x1535('0xc'));var Action=require(_0x1535('0xd'));var ut=require('./util/util');config['redis']=_[_0x1535('0xe')](config['redis'],{'host':_0x1535('0xf'),'port':0x18eb});var io=require(_0x1535('0x10'))(new Redis(config[_0x1535('0x11')]));var Sequence=function(){};Sequence[_0x1535('0x12')]['enqueue']=function(_0x16253b){this['tail']=this['tail']?this[_0x1535('0x13')][_0x1535('0x14')](_0x16253b):_0x16253b();};function Preview(_0x246823){this['sequence']=new Sequence();this[_0x1535('0x15')]=_0x246823['voiceQueues'];this[_0x1535('0x16')]=_0x246823['trunks'];this['actions']={};this[_0x1535('0x17')]=_0x246823[_0x1535('0x17')];this[_0x1535('0x18')]=0x0;ami['on'](_0x1535('0x19'),this['syncOriginateResponse']['bind'](this));ami['on']('hangup',this['syncHangup'][_0x1535('0x1a')](this));ami['on'](_0x1535('0x1b'),this[_0x1535('0x1c')]['bind'](this));ami['on'](_0x1535('0x1d'),this['syncDialEnd'][_0x1535('0x1a')](this));ami['on'](_0x1535('0x1e'),this[_0x1535('0x1f')][_0x1535('0x1a')](this));ami['on'](_0x1535('0x20'),this['syncVarSet'][_0x1535('0x1a')](this));ami['on'](_0x1535('0x21'),this[_0x1535('0x22')]['bind'](this));ami['on'](_0x1535('0x23'),this['syncBlindTransfer'][_0x1535('0x1a')](this));this[_0x1535('0x24')](this['campaignsPreview']);}function emit(_0x2db0e1,_0x5bad07,_0x4cafb9){io['to'](_0x2db0e1)['emit'](_0x5bad07,_0x4cafb9);}function emitCampaignPreview(_0x468510){if(_0x468510['type']==='outbound'){var _0x2a3d3b={'id':_0x468510['id'],'name':_0x468510[_0x1535('0x25')],'strategy':_0x468510['strategy'],'answered':_0x468510[_0x1535('0x26')],'available':_0x468510[_0x1535('0x27')],'loggedIn':_0x468510[_0x1535('0x28')],'pTalking':_0x468510[_0x1535('0x29')],'sumBillable':_0x468510[_0x1535('0x2a')],'sumDuration':_0x468510[_0x1535('0x2b')],'sumHoldTime':_0x468510[_0x1535('0x2c')]||0x0,'talking':_0x468510[_0x1535('0x2d')],'total':_0x468510[_0x1535('0x2e')],'type':_0x468510[_0x1535('0x2f')],'unmanaged':_0x468510[_0x1535('0x30')],'abandoned':_0x468510[_0x1535('0x31')],'waiting':_0x468510['waiting'],'loggedInDb':_0x468510[_0x1535('0x32')],'dialActive':_0x468510[_0x1535('0x33')],'dialMethod':_0x468510[_0x1535('0x34')],'dialOriginateCallerIdName':_0x468510[_0x1535('0x35')],'dialOriginateCallerIdNumber':_0x468510[_0x1535('0x36')],'dialOriginateTimeout':_0x468510[_0x1535('0x37')],'dialPrefix':_0x468510[_0x1535('0x38')],'outboundAnswerAgiCallsDay':_0x468510[_0x1535('0x39')],'outboundAnswerCallsDay':_0x468510[_0x1535('0x3a')],'outboundBlacklistCallsDay':_0x468510[_0x1535('0x3b')],'outboundBusyCallsDay':_0x468510[_0x1535('0x3c')],'outboundCongestionCallsDay':_0x468510['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x468510['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x468510['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x468510[_0x1535('0x3d')],'outboundNoAnswerCallsDay':_0x468510[_0x1535('0x3e')],'outboundNoSuchCallsDay':_0x468510['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x468510['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x468510['outboundReCallsDay'],'outboundRejectCallsDay':_0x468510[_0x1535('0x3f')],'outboundUnknownCallsDay':_0x468510[_0x1535('0x40')],'predictiveIntervalAnsweredCalls':_0x468510[_0x1535('0x41')],'predictiveIntervalAvgHoldtime':_0x468510[_0x1535('0x42')],'predictiveIntervalAvgTalktime':_0x468510[_0x1535('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x468510['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x468510[_0x1535('0x44')],'predictiveIntervalErlangCalls':_0x468510[_0x1535('0x45')],'predictiveIntervalErlangCallsDroppedCalls':_0x468510[_0x1535('0x46')],'predictiveIntervalHitRate':_0x468510[_0x1535('0x47')],'predictiveIntervalLowerLimit':_0x468510['predictiveIntervalLowerLimit'],'predictiveIntervalMultiplicativeFactor':_0x468510[_0x1535('0x48')],'predictiveIntervalPauses':_0x468510['predictiveIntervalPauses'],'predictiveIntervalTotalCalls':_0x468510[_0x1535('0x49')],'message':_0x468510['message'],'originated':_0x468510[_0x1535('0x4a')]};if(_0x468510[_0x1535('0x4b')]){_0x2a3d3b['Trunk']={'id':_0x468510[_0x1535('0x4b')]['id'],'name':_0x468510[_0x1535('0x4b')][_0x1535('0x25')],'active':_0x468510['Trunk'][_0x1535('0x4c')],'callerid':_0x468510[_0x1535('0x4b')]['callerid']};}if(_0x468510[_0x1535('0x4d')]){_0x2a3d3b[_0x1535('0x4d')]={'id':_0x468510['Interval']['id'],'name':_0x468510[_0x1535('0x4d')]['name']};}var _0x2073b7=md5(JSON[_0x1535('0x4e')](_0x2a3d3b));if(_0x468510[_0x1535('0x5')]!==_0x2073b7){_0x468510[_0x1535('0x5')]=_0x2073b7;emit(util[_0x1535('0x4f')](_0x1535('0x50'),_0x2a3d3b[_0x1535('0x25')]),_0x1535('0x51'),_0x2a3d3b);}}}function emitVoiceQueueChannelRemove(_0x233074){emit(util['format'](_0x1535('0x50'),_0x233074['name']),_0x1535('0x52'),_0x233074);}function notSendMessagesQueue(_0x429d7c){if(_0x429d7c[_0x1535('0x53')]){if(_0x429d7c[_0x1535('0x4a')]===0x0&&_0x429d7c[_0x1535('0x29')]===0x0){_0x429d7c[_0x1535('0x53')]=![];_0x429d7c[_0x1535('0x27')]=0x0;_0x429d7c[_0x1535('0x54')]=0x0;_0x429d7c[_0x1535('0x55')]=_0x1535('0x56');ut[_0x1535('0x57')](_0x1535('0x58'),_0x429d7c[_0x1535('0x25')]+_0x1535('0x59'));}else{_0x429d7c[_0x1535('0x55')]='IS_DISACTIVED';ut[_0x1535('0x57')](_0x1535('0x58'),_0x429d7c[_0x1535('0x25')]+_0x1535('0x5a'));}emitCampaignPreview(_0x429d7c);}}Preview[_0x1535('0x12')]['loopCampaigns']=function(){var _0x330efa=this;setInterval(function(){_0x330efa[_0x1535('0x5b')]();},0x7cf);};Preview['prototype'][_0x1535('0x5b')]=function(){var _0x376c03=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x204ae7 in _0x376c03){if(_0x376c03[_0x1535('0x5c')](_0x204ae7)&&(_0x376c03[_0x204ae7][_0x1535('0x34')]===_0x1535('0x9')||_0x376c03[_0x204ae7][_0x1535('0x34')]===_0x1535('0x5d'))&&_0x376c03[_0x204ae7]['type']==='outbound'){if(this[_0x1535('0x18')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x376c03[_0x1535('0x5c')](_0x204ae7)&&_0x376c03[_0x204ae7][_0x1535('0x34')]===_0x1535('0x9')&&_0x376c03[_0x204ae7][_0x1535('0x2f')]===_0x1535('0x5e')){if(_0x376c03[_0x204ae7]['dialActive']){this['setMessage'](_0x376c03[_0x204ae7]);this[_0x1535('0x5f')](_0x376c03[_0x204ae7]);}else{notSendMessagesQueue(_0x376c03[_0x204ae7]);}}}};Preview[_0x1535('0x12')][_0x1535('0x60')]=function(_0x8e8c72){var _0x1ae103=this;this[_0x1535('0x61')][_0x1535('0x62')](function(){if(!_[_0x1535('0x63')](_0x1ae103['actions'][_0x8e8c72])){loggerAction['info']('[clearZombieChannels][talking]',_0x8e8c72,_0x1535('0x64'),_0x1ae103[_0x1535('0x65')][_0x8e8c72][_0x1535('0x66')],_0x1535('0x67'),JSON[_0x1535('0x4e')](_0x1ae103['campaignsPreview'][_0x1ae103[_0x1535('0x65')][_0x8e8c72][_0x1535('0x66')]][_0x1535('0x4a')]),_0x1535('0x68'),JSON[_0x1535('0x4e')](_0x1ae103['campaignsPreview'][_0x1ae103[_0x1535('0x65')][_0x8e8c72]['queue']]['pTalking']),JSON['stringify'](_0x1ae103[_0x1535('0x65')][_0x8e8c72]['dialAnswer']),JSON[_0x1535('0x4e')](_[_0x1535('0x69')](_0x1ae103[_0x1535('0x65')][_0x8e8c72],['contactId',_0x1535('0x6a'),_0x1535('0x6b'),_0x1535('0x6c')])));return ami[_0x1535('0x6d')]({'action':'status','channel':_0x1ae103['actions'][_0x8e8c72][_0x1535('0x6e')]})[_0x1535('0x6f')](function(_0x2b6289){if(_0x2b6289[_0x1535('0x55')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x1ae103[_0x1535('0x65')][_0x8e8c72]){ut[_0x1535('0x70')](_0x1ae103['campaignsPreview'][_0x1ae103['actions'][_0x8e8c72][_0x1535('0x66')]],_0x1535('0x71'));if(_0x1ae103[_0x1535('0x65')][_0x8e8c72]['dialAnswer']===!![]){ut[_0x1535('0x72')](_0x1ae103[_0x1535('0x15')][_0x1ae103[_0x1535('0x65')][_0x8e8c72][_0x1535('0x66')]],_0x1535('0x71'));ut[_0x1535('0x73')](_0x1535('0x74')+_0x8e8c72,_0x1ae103[_0x1535('0x65')][_0x8e8c72][_0x1535('0x66')]);}ut['loggerError'](_0x1535('0x75')+_0x8e8c72,_0x1ae103['actions'][_0x8e8c72][_0x1535('0x66')]);delete _0x1ae103[_0x1535('0x65')][_0x8e8c72];}},0x2328);}});}});};Preview[_0x1535('0x12')][_0x1535('0x76')]=function(){var _0x4f88f6=this;loggerAction[_0x1535('0x77')](_0x1535('0x78'),_[_0x1535('0x79')](this[_0x1535('0x65')]));for(var _0x1dc4d6 in this[_0x1535('0x65')]){if(_0x4f88f6['actions'][_0x1535('0x5c')](_0x1dc4d6)){_0x4f88f6[_0x1535('0x60')](_0x1dc4d6);}}};Preview[_0x1535('0x12')][_0x1535('0x5f')]=function(_0x23edcd){var _0x25c59f=this;rpcDb[_0x1535('0x7a')](_0x23edcd['id'],ut[_0x1535('0x7b')](this['agents']))[_0x1535('0x7c')](function(_0xcfe253){if(!_[_0x1535('0x63')](_0xcfe253)){for(var _0x5ed7f7=0x0;_0x5ed7f7<_0xcfe253['length'];_0x5ed7f7+=0x1){if(ut[_0x1535('0x7d')](_0xcfe253[_0x5ed7f7][_0x1535('0x7e')])<_0x23edcd[_0x1535('0x7f')]*0x3c){_0x25c59f[_0x1535('0x80')](_0xcfe253[_0x5ed7f7]['id'])[_0x1535('0x7c')](ut[_0x1535('0x81')](_0x1535('0x82')))[_0x1535('0x6f')](ut['logger2']('[RecallMe]'));}else{var _0x579779=new Action(_0xcfe253[_0x5ed7f7],_0x23edcd);_0x579779[_0x1535('0x83')]=moment()[_0x1535('0x4f')](_0x1535('0x84'));_0x23edcd[_0x1535('0x85')]+=0x1;ut[_0x1535('0x86')](_0x579779,0x17,_0x1535('0x87'));if(_0x23edcd['dialRecallInQueue']){rpcDb[_0x1535('0x88')](ut['createBody'](_0xcfe253[_0x5ed7f7]));rpcDb[_0x1535('0x89')](_0x579779,_0x1535('0x8a'));}else{ut[_0x1535('0x86')](_0x579779,0x16,_0x1535('0x8b'));rpcDb[_0x1535('0x89')](_0x579779,_0x1535('0x8c'));rpcDb['createCustomerFinal'](_0x579779,_0x1535('0x8c'));}}}}})['catch'](ut[_0x1535('0x81')](_0x1535('0x8d')));};Preview[_0x1535('0x12')]['setMessage']=function(_0x1c63f6){_0x1c63f6[_0x1535('0x53')]=!![];if(ut[_0x1535('0x8e')](_0x1c63f6[_0x1535('0x28')])){_0x1c63f6[_0x1535('0x55')]=_0x1535('0x8f');}else if(!ut['isActive'](_0x1c63f6['dialActive'])){_0x1c63f6['message']=_0x1535('0x56');}else if(!this[_0x1535('0x90')](_0x1c63f6[_0x1535('0x4b')])){if(!this[_0x1535('0x90')](_0x1c63f6[_0x1535('0x91')])){_0x1c63f6[_0x1535('0x55')]='TRUNK_IS_NOT_REACHABLE';}else{_0x1c63f6['message']=_0x1535('0x92');}}else{_0x1c63f6[_0x1535('0x55')]=_0x1535('0x92');}emitCampaignPreview(_0x1c63f6);};Preview[_0x1535('0x12')][_0x1535('0x93')]=function(_0x42bab7,_0xe70bdb,_0x495c05){var _0x238c9c=this;var _0x3c8b07=this['actions'][_0xe70bdb];var _0x5360f7=this['campaignsPreview'][_0x3c8b07['queue']];var _0x4c0d49;if(_0x5360f7){switch(_0x495c05){case'1':_0x5360f7[_0x1535('0x94')]+=0x1;_0x3c8b07['countglobal']=ut[_0x1535('0x95')](_0x3c8b07);ut[_0x1535('0x86')](_0x3c8b07,0x0,_0x1535('0x96'));rpcDb['createCustomerHistory'](_0x3c8b07,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0x1535('0x95')](_0x3c8b07)>=_0x5360f7['dialGlobalMaxRetry']){_0x4c0d49=ut[_0x1535('0x97')](_0x3c8b07,0xf,'Global');rpcDb[_0x1535('0x98')](_0x4c0d49,_0x1535('0x99'));}else{rpcDb[_0x1535('0x98')](_0x3c8b07,_0x1535('0x99'));}delete this[_0x1535('0x65')][_0x42bab7[_0x1535('0x9a')]];break;case _0x1535('0x9b'):var _0x1a41ff=moment()[_0x1535('0x4f')](_0x1535('0x84'));_0x3c8b07['responsetime']=_0x1a41ff;_0x3c8b07[_0x1535('0x9c')]=_0x1a41ff;_0x3c8b07[_0x1535('0x9d')]=!![];_0x5360f7['pTalking']+=0x1;logger[_0x1535('0x77')]('[syncHangup][talking][increment]',_0x3c8b07[_0x1535('0x9e')],_0x1535('0x9f'),_0x5360f7[_0x1535('0x25')],'pTalking:\x20',_0x5360f7[_0x1535('0x29')]);ami[_0x1535('0xa0')](_0x1535('0xa1'),ut['buildObj'](_0x3c8b07,_0x1535('0xa2')));if(_0x5360f7[_0x1535('0xa3')]){ami[_0x1535('0xa0')](_0x1535('0xa4'),ut['buildAcw'](_0x3c8b07));}break;case'16':ami[_0x1535('0xa0')](_0x1535('0xa5'),ut[_0x1535('0xa6')](_0x3c8b07,_0x1535('0xa7')));emitVoiceQueueChannelRemove(ut[_0x1535('0xa6')](_0x3c8b07,'complete'));_0x5360f7[_0x1535('0x3a')]+=0x1;_0x5360f7[_0x1535('0x2e')]+=0x1;_0x5360f7['answered']+=0x1;ut[_0x1535('0x72')](_0x5360f7,'[16]');_0x3c8b07[_0x1535('0xa8')]=ut[_0x1535('0x95')](_0x3c8b07);ut['logCustomer'](_0x3c8b07,0x4,'Answer');rpcDb[_0x1535('0x89')](_0x3c8b07,_0x1535('0xa9'));rpcDb[_0x1535('0x98')](_0x3c8b07,_0x1535('0xaa'));rpcDb['crateCustomerReportQueue'](_0x3c8b07);_0x5360f7['sumDuration']+=_0x3c8b07[_0x1535('0xab')];_0x5360f7['sumBillable']+=_0x3c8b07[_0x1535('0xab')];logger[_0x1535('0x77')](_0x1535('0xac'),_0x3c8b07['uniqueid'],_0x1535('0x9f'),_0x5360f7[_0x1535('0x25')],'pTalking:\x20',_0x5360f7[_0x1535('0x29')]);delete this[_0x1535('0x65')][_0x42bab7[_0x1535('0x9a')]];break;case _0x1535('0xad'):_0x5360f7[_0x1535('0x3c')]+=0x1;_0x3c8b07['countbusyretry']+=0x1;_0x3c8b07[_0x1535('0xa8')]=ut[_0x1535('0x95')](_0x3c8b07);ut[_0x1535('0x86')](_0x3c8b07,0x5,_0x1535('0xae'));rpcDb[_0x1535('0x89')](_0x3c8b07,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x1535('0x95')](_0x3c8b07)>=_0x5360f7[_0x1535('0xaf')]){_0x4c0d49=ut['cloneAction'](_0x3c8b07,0xf,'Global');rpcDb['createCustomerFinal'](_0x4c0d49,_0x1535('0xb0'));}else{if(_0x3c8b07[_0x1535('0xb1')]>=_0x5360f7[_0x1535('0xb2')]){rpcDb['createCustomerFinal'](_0x3c8b07,_0x1535('0xb3'));}else{rpcDb[_0x1535('0xb4')](ut['scheduledAt'](_0x3c8b07,_0x1535('0xb1'),_0x5360f7[_0x1535('0xb5')]),_0x3c8b07[_0x1535('0xb6')],_0x3c8b07['activeContact']);}}break;case _0x1535('0xb7'):_0x5360f7[_0x1535('0x3e')]+=0x1;_0x3c8b07[_0x1535('0xb8')]+=0x1;_0x3c8b07['countglobal']=ut[_0x1535('0x95')](_0x3c8b07);ut[_0x1535('0x86')](_0x3c8b07,0x3,_0x1535('0xb9'));rpcDb[_0x1535('0x89')](_0x3c8b07,_0x1535('0xba'));if(ut[_0x1535('0x95')](_0x3c8b07)>=_0x5360f7[_0x1535('0xaf')]){_0x4c0d49=ut[_0x1535('0x97')](_0x3c8b07,0xf,'Global');rpcDb[_0x1535('0x98')](_0x4c0d49,_0x1535('0xbb'));}else{if(_0x3c8b07[_0x1535('0xb8')]>=_0x5360f7[_0x1535('0xbc')]){rpcDb[_0x1535('0x98')](_0x3c8b07,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x1535('0xb4')](ut['scheduledAt'](_0x3c8b07,_0x1535('0xb8'),_0x5360f7[_0x1535('0xbd')]),_0x3c8b07[_0x1535('0xb6')],_0x3c8b07[_0x1535('0xbe')]);}}break;case _0x1535('0xbf'):_0x5360f7['outboundCongestionCallsDay']+=0x1;_0x3c8b07[_0x1535('0xc0')]+=0x1;_0x3c8b07[_0x1535('0xa8')]=ut[_0x1535('0x95')](_0x3c8b07);ut['logCustomer'](_0x3c8b07,0x8,'Congestion');rpcDb[_0x1535('0x89')](_0x3c8b07,_0x1535('0xc1'));if(ut[_0x1535('0x95')](_0x3c8b07)>=_0x5360f7[_0x1535('0xaf')]){_0x4c0d49=ut['cloneAction'](_0x3c8b07,0xf,_0x1535('0xc2'));rpcDb[_0x1535('0x98')](_0x4c0d49,_0x1535('0xc3'));}else{if(_0x3c8b07[_0x1535('0xc0')]>=_0x5360f7['dialCongestionMaxRetry']){rpcDb[_0x1535('0x98')](_0x3c8b07,_0x1535('0xc1'));}else{rpcDb[_0x1535('0xb4')](ut[_0x1535('0xc4')](_0x3c8b07,'countcongestionretry',_0x5360f7[_0x1535('0xb5')]),_0x3c8b07[_0x1535('0xb6')],_0x3c8b07[_0x1535('0xbe')]);}}break;case _0x1535('0xc5'):_0x5360f7['outboundRejectCallsDay']+=0x1;_0x3c8b07['countglobal']=ut[_0x1535('0x95')](_0x3c8b07);ut[_0x1535('0x86')](_0x3c8b07,0x14,'AgentReject');rpcDb[_0x1535('0x89')](_0x3c8b07,_0x1535('0xc6'));if(_0x3c8b07[_0x1535('0xb6')]){rpcDb[_0x1535('0xc7')](_0x3c8b07[_0x1535('0xc8')]);}if(_0x3c8b07[_0x1535('0xbe')]){rpcDb[_0x1535('0xc9')](_0x3c8b07[_0x1535('0xc8')]);}break;default:if(_0x3c8b07['dialAnswer']){ut[_0x1535('0x72')](_0x5360f7,_0x1535('0xca'));ut[_0x1535('0x73')](_0x1535('0xcb')+_0x5360f7[_0x1535('0x25')],_0x42bab7);}_0x5360f7[_0x1535('0x40')]+=0x1;_0x3c8b07[_0x1535('0xa8')]=ut['totalGlobal'](_0x3c8b07);ut[_0x1535('0x86')](_0x3c8b07,0xc,_0x42bab7['cause-txt']||_0x42bab7['dialstatus']);rpcDb['createCustomerHistory'](_0x3c8b07,_0x1535('0xcc'));if(ut['totalGlobal'](_0x3c8b07)>=_0x5360f7['dialGlobalMaxRetry']){_0x4c0d49=ut[_0x1535('0x97')](_0x3c8b07,0xf,'Global');rpcDb[_0x1535('0x98')](_0x4c0d49,_0x1535('0xcd'));}else{rpcDb[_0x1535('0x98')](_0x3c8b07,_0x1535('0xcd'));}delete this[_0x1535('0x65')][_0x42bab7[_0x1535('0x9a')]];}if(!(_0x3c8b07[_0x1535('0x9d')]&&_0x495c05==='16')){ut[_0x1535('0x70')](_0x5360f7,_0x1535('0xce'));logger['info'](_0x1535('0xcf'),_0x3c8b07[_0x1535('0x9e')],_0x1535('0x9f'),_0x5360f7[_0x1535('0x25')],'originated:\x20',_0x5360f7['originated']);}if(_0x495c05!==_0x1535('0x9b')){delete this[_0x1535('0x65')][_0x42bab7[_0x1535('0x9a')]];delete this[_0x1535('0x65')][_0x42bab7[_0x1535('0xd0')]];}}};Preview[_0x1535('0x12')][_0x1535('0xd1')]=function(_0x2dbeae,_0x545b0b,_0x50af5a){if(_[_0x1535('0xd2')](_0x545b0b)&&_0x1535('0xd3')!==typeof _0x545b0b){return;}if(_[_0x1535('0xd2')](_0x50af5a)&&_0x1535('0xd3')!==typeof _0x50af5a){return;}switch(_0x50af5a[_0x1535('0xd4')]){case'0':ut[_0x1535('0xd5')](_0x2dbeae,0x0,'NoSuchNumber');rpcDb[_0x1535('0xd6')](_0x2dbeae,_0x1535('0xd7'));break;case'3':ut['logAgent'](_0x2dbeae,0x3,_0x1535('0xb9'));rpcDb[_0x1535('0xd6')](_0x2dbeae,_0x1535('0xd8'));break;case'5':ut[_0x1535('0xd5')](_0x2dbeae,0x5,_0x1535('0xae'));rpcDb[_0x1535('0xd6')](_0x2dbeae,_0x1535('0xd9'));break;case'8':ut[_0x1535('0xd5')](_0x2dbeae,0x8,_0x1535('0xda'));rpcDb[_0x1535('0xd6')](_0x2dbeae,_0x1535('0xdb'));break;case'22':ut[_0x1535('0xd5')](_0x2dbeae,0x16,_0x1535('0xdc'));rpcDb[_0x1535('0xd6')](_0x2dbeae,_0x1535('0xdd'));break;default:ut['logAgent'](_0x2dbeae,0xc,_0x50af5a[_0x1535('0xd4')]);rpcDb['createAgentHistory'](_0x2dbeae,_0x1535('0xdb'));}ut[_0x1535('0x70')](_0x545b0b,_0x1535('0xde'));logger[_0x1535('0x77')](_0x1535('0xdf'),_0x2dbeae[_0x1535('0x9e')],_0x1535('0x9f'),_0x545b0b[_0x1535('0x25')],'originated:\x20',_0x545b0b['originated']);delete this[_0x1535('0x65')][_0x2dbeae[_0x1535('0x9e')]];};Preview[_0x1535('0x12')][_0x1535('0xe0')]=function(_0x4a65dd,_0x394795,_0xd8f08d,_0x5e2fdd,_0x2111c9){var _0x2a1d7e=this;return new BPromise(function(_0x966b11,_0x182cca){if(_[_0x1535('0x63')](_0x394795)||_[_0x1535('0x63')](_0x394795[_0x1535('0xe1')])||_[_0x1535('0x63')](_0x394795[_0x1535('0xe1')][_0x1535('0xe2')])||_[_0x1535('0x63')](_0x394795['VoiceQueueId'])){_0x182cca(ut[_0x1535('0x55')](_0x1535('0xe3'),_0x5e2fdd,_0x2111c9));return;}var _0x330b38=uuid['v4']();var _0x538b3f=_0x2a1d7e[_0x1535('0x15')][_0x394795[_0x1535('0x64')][_0x1535('0x25')]];var _0x146e91=_0xd8f08d?_0x2a1d7e[_0x1535('0x17')][_0xd8f08d]['id']:undefined;_0x2a1d7e[_0x1535('0x65')][_0x330b38]=new Action(_0x394795,_0x538b3f,_0x330b38,_0xd8f08d,_0x146e91);var _0x94b665=_0x2a1d7e['actions'][_0x330b38];_0x94b665['unlockAgent']=_0x5e2fdd;_0x94b665[_0x1535('0xbe')]=_0x2111c9;_0x94b665[_0x1535('0xe4')]=_0xd8f08d;if(_[_0x1535('0xe5')](_0x4a65dd)){_0x2a1d7e['execCall'](_0x94b665,_0x538b3f,_0x394795,_0xd8f08d)[_0x1535('0x7c')](function(_0x16b3a7){logger[_0x1535('0x77')](_0x1535('0xe6'),_0x1535('0xe7')+_0x94b665[_0x1535('0x66')]+_0x1535('0xe8')+_0x94b665[_0x1535('0xc8')],JSON[_0x1535('0x4e')](_0x16b3a7));ami[_0x1535('0xa0')](_0x1535('0xe9'),ut[_0x1535('0xa6')](_0x94b665,_0x1535('0xea')));_0x966b11(ut[_0x1535('0x55')](_0x1535('0xeb')));})[_0x1535('0x6f')](function(_0x35a9d4){ut['logger']('[Preview][execCall][failure]',_0x35a9d4);_0x182cca(ut[_0x1535('0x55')](_0x1535('0xec'),_0x5e2fdd,_0x2111c9));});}else{_0x538b3f[_0x1535('0x3b')]+=0x1;ut['logBlacklist'](_0x94b665);rpcDb[_0x1535('0xed')](_0x94b665,_0x1535('0xee'));delete _0x2a1d7e['actions'][_0x330b38];_0x182cca(ut[_0x1535('0x55')](_0x1535('0xef'),_0x5e2fdd,_0x2111c9));}});};Preview[_0x1535('0x12')][_0x1535('0x90')]=function(_0x26227b){return!_[_0x1535('0x63')](_0x26227b)&&!_[_0x1535('0x63')](_0x26227b[_0x1535('0x25')])&&!_[_0x1535('0x63')](_0x26227b[_0x1535('0x4c')])&&_0x26227b[_0x1535('0x4c')]&&!_[_0x1535('0x63')](this[_0x1535('0x16')][util[_0x1535('0x4f')]('SIP/%s',_0x26227b[_0x1535('0x25')])])&&!_['isNil'](this[_0x1535('0x16')][util[_0x1535('0x4f')](_0x1535('0xf0'),_0x26227b[_0x1535('0x25')])]['status'])&&(this[_0x1535('0x16')][util[_0x1535('0x4f')](_0x1535('0xf0'),_0x26227b['name'])][_0x1535('0xf1')]===_0x1535('0xf2')||this['trunks'][util[_0x1535('0x4f')]('SIP/%s',_0x26227b[_0x1535('0x25')])][_0x1535('0xf1')]===_0x1535('0xf3'));};Preview[_0x1535('0x12')][_0x1535('0x80')]=function(_0x26b185,_0x50b6e7){var _0x44e915=this;return new BPromise(function(_0x253d0f,_0x863f23){_0x44e915[_0x1535('0xf4')](_0x26b185,_0x50b6e7)[_0x1535('0x7c')](function(_0x20b20e){_0x253d0f(_[_0x1535('0x69')](_0x20b20e,[_0x1535('0x55')]));})[_0x1535('0x6f')](function(_0x5d5d5a){if(_0x5d5d5a[_0x1535('0xf5')]){rpcDb['unlockContact'](_0x26b185);}if(_0x5d5d5a[_0x1535('0x4c')]){rpcDb[_0x1535('0xc9')](_0x26b185);}_0x863f23(_[_0x1535('0x69')](_0x5d5d5a,[_0x1535('0x55')]));});});};Preview[_0x1535('0x12')][_0x1535('0xf4')]=function(_0x256d74,_0x183591){var _0x70fcc8=this;return new BPromise(function(_0x51f5b4,_0x185755){var _0x23ee2d,_0x6db01b;rpcDb[_0x1535('0xf6')](_0x256d74)[_0x1535('0x7c')](function(_0x216f30){if(!_[_0x1535('0x63')](_0x216f30[0x0])){_0x6db01b=_0x216f30[0x0][_0x1535('0xf7')]?![]:!![];_0x23ee2d=_0x216f30[0x0][_0x1535('0xf7')]?!![]:![];_0x23ee2d=_0x183591?!![]:_0x23ee2d;}var _0x5a7eeb=_0x70fcc8[_0x1535('0xf8')](_0x216f30);if(_0x5a7eeb['isValid']){rpcDb['checkIsBlackList'](_['pick'](_0x216f30[0x0],[_0x1535('0x6b'),'Contact.phone']))[_0x1535('0x7c')](function(_0x3f11a5){_0x70fcc8['checkInBlack'](_0x3f11a5,_0x216f30[0x0],_0x183591,_0x6db01b,_0x23ee2d)[_0x1535('0x7c')](function(_0x1d4db1){_0x51f5b4(_0x1d4db1);})[_0x1535('0x6f')](function(_0x69a3c){_0x185755(_0x69a3c);});})[_0x1535('0x6f')](function(_0x41c298){ut[_0x1535('0x57')](_0x1535('0xf9'),_0x41c298);_0x185755(ut[_0x1535('0x55')](_0x1535('0xfa'),_0x6db01b,_0x23ee2d));});}else{_0x185755(ut['message'](_0x5a7eeb[_0x1535('0x55')],_0x6db01b,_0x23ee2d));}})[_0x1535('0x6f')](function(_0x13c4fd){ut[_0x1535('0x57')](_0x1535('0xfb'),_0x13c4fd);_0x185755(ut['message'](_0x1535('0xfa'),![],!![]));});});};Preview[_0x1535('0x12')][_0x1535('0xf8')]=function(_0x32a7c9){if(_[_0x1535('0x63')](_0x32a7c9)||_['isEmpty'](_0x32a7c9)||!_[_0x1535('0x63')](_0x32a7c9[0x0][_0x1535('0xfc')])&&_['isNil'](_0x32a7c9[0x0][_0x1535('0xfc')][_0x1535('0x25')])){ut[_0x1535('0x57')](_0x1535('0xfd'),_0x32a7c9);return{'isValid':![],'message':_0x1535('0xfe')};}var _0x28775a=this['campaignsPreview'][_0x32a7c9[0x0][_0x1535('0x64')][_0x1535('0x25')]];_0x28775a[_0x1535('0x55')]='ACTIVE';if(_['isNil'](_0x28775a)){ut[_0x1535('0x57')](_0x1535('0xff'),_0x28775a);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x1535('0x90')](_0x28775a[_0x1535('0x4b')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x1535('0x100')+_0x28775a['name']+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x1535('0x90')](_0x28775a[_0x1535('0x91')])){ut[_0x1535('0x57')](_0x1535('0x101'),_0x28775a[_0x1535('0x25')]+_0x1535('0x102'));return{'isValid':![],'message':_0x1535('0x103')};}}if(!ut[_0x1535('0x104')](_0x28775a[_0x1535('0x33')])){ut[_0x1535('0x57')](_0x1535('0x105'),_0x28775a[_0x1535('0x25')]+_0x1535('0x106'));return{'isValid':![],'message':_0x1535('0x100')+_0x28775a['name']+_0x1535('0x106')};}return{'isValid':!![],'message':_0x1535('0x107')};};Preview[_0x1535('0x12')]['execCall']=function(_0x65205c,_0x10a551,_0x1dd699,_0x3ca350){var _0x4c50a5=this;return new BPromise(function(_0x54d6f1,_0x1fd554){var _0x22ed1d=_0x65205c[_0x1535('0x9e')];var _0x16c332=_0x4c50a5[_0x1535('0x90')](_0x10a551[_0x1535('0x4b')])?util['format'](_0x1535('0x108'),_0x10a551[_0x1535('0x4b')][_0x1535('0x25')],_[_0x1535('0x63')](_0x10a551['dialPrefix'])?'':_0x10a551['dialPrefix'][_0x1535('0x109')]()||'',_0x10a551[_0x1535('0x10a')]>0x0?_0x1dd699[_0x1535('0xe1')][_0x1535('0xe2')][_0x1535('0x10b')](_0x10a551[_0x1535('0x10a')]):_0x1dd699[_0x1535('0xe1')][_0x1535('0xe2')]):util['format'](_0x1535('0x108'),_['isNil'](_0x10a551[_0x1535('0x91')])?_0x10a551[_0x1535('0x4b')][_0x1535('0x25')]:_0x10a551[_0x1535('0x91')][_0x1535('0x25')],_['isNil'](_0x10a551[_0x1535('0x38')])?'':_0x10a551[_0x1535('0x38')][_0x1535('0x109')]()||'',_0x10a551[_0x1535('0x10a')]>0x0?_0x1dd699[_0x1535('0xe1')]['phone'][_0x1535('0x10b')](_0x10a551[_0x1535('0x10a')]):_0x1dd699[_0x1535('0xe1')][_0x1535('0xe2')]);var _0x16aa0f=_0x4c50a5[_0x1535('0x90')](_0x10a551[_0x1535('0x4b')])?ut[_0x1535('0x10c')](_0x10a551[_0x1535('0x4b')]['callerid'],_0x10a551[_0x1535('0x35')],_0x10a551[_0x1535('0x10d')]>0x0?ut[_0x1535('0x10e')](_0x10a551[_0x1535('0x36')],_0x10a551[_0x1535('0x10d')]):_0x10a551[_0x1535('0x36')]):ut['getCallerId'](_[_0x1535('0x63')](_0x10a551[_0x1535('0x91')])?_0x10a551['Trunk'][_0x1535('0x10f')]:_0x10a551['TrunkBackup']['callerid'],_0x10a551['dialOriginateCallerIdName'],_0x10a551[_0x1535('0x10d')]>0x0?ut[_0x1535('0x10e')](_0x10a551[_0x1535('0x36')],_0x10a551[_0x1535('0x10d')]):_0x10a551[_0x1535('0x36')]);if(_0x16aa0f){_0x65205c['originatecalleridname']=ut[_0x1535('0x110')](_0x16aa0f);_0x65205c[_0x1535('0x111')]=ut[_0x1535('0x112')](_0x16aa0f);}var _0x19bf1f=ut[_0x1535('0x113')](_0x10a551,_0x1dd699,_0x16c332,_0x16aa0f,_0x22ed1d,_0x65205c);_['merge'](_0x65205c,ut['toLowerVariables'](_0x19bf1f));_0x65205c[_0x1535('0x83')]=moment()['format'](_0x1535('0x84'));ami['Action'](ut[_0x1535('0x114')](_0x65205c,_0x10a551,_0x19bf1f,_0x65205c['activeContact'],_0x3ca350))[_0x1535('0x7c')](function(_0x426023){_0x10a551[_0x1535('0x4a')]+=0x1;logger[_0x1535('0x77')](_0x1535('0x115'),_0x22ed1d,_0x1535('0x9f'),_0x10a551[_0x1535('0x25')],_0x1535('0x67'),_0x10a551[_0x1535('0x4a')]);_0x54d6f1(_0x426023);})[_0x1535('0x6f')](function(_0x429876){ut[_0x1535('0xd5')](_0x65205c,0xe,_0x1535('0x116'));rpcDb[_0x1535('0xd6')](_0x65205c,_0x1535('0x117'));_0x1fd554(_0x429876);});});};Preview[_0x1535('0x12')][_0x1535('0x1f')]=function(_0xec3fef){if(this[_0x1535('0x65')][_0xec3fef[_0x1535('0x9a')]]){this[_0x1535('0x65')][_0xec3fef[_0x1535('0x9a')]][_0x1535('0x6e')]=_0xec3fef[_0x1535('0x6e')];}};Preview[_0x1535('0x12')]['syncOriginateResponse']=function(_0x4b5787){var _0x245ca8=this;var _0xd52d70=this[_0x1535('0x65')][_0x4b5787[_0x1535('0x118')]];if(_0xd52d70){if(_0xd52d70[_0x1535('0xe4')]&&this[_0x1535('0x17')][_0xd52d70[_0x1535('0xe4')]]){ut[_0x1535('0x119')](_0xd52d70,this['agents'][_0xd52d70[_0x1535('0xe4')]][_0x1535('0x25')],this['agents'][_0xd52d70[_0x1535('0xe4')]]['id']);}var _0x4126fb=_[_0x1535('0x11a')](_0xd52d70);_0x4126fb[_0x1535('0x11b')]=moment()[_0x1535('0x4f')](_0x1535('0x84'));var _0x908fa9=_0x245ca8['campaignsPreview'][_0xd52d70[_0x1535('0x66')]];if(ut[_0x1535('0x11c')](_0x4b5787['response'])){if(_0xd52d70[_0x1535('0xb6')]){rpcDb[_0x1535('0xc7')](_0xd52d70[_0x1535('0xc8')]);}if(_0xd52d70[_0x1535('0xbe')]){rpcDb[_0x1535('0xc9')](_0xd52d70['idContact']);}ami[_0x1535('0xa0')](_0x1535('0x11d'),ut[_0x1535('0xa6')](_0xd52d70,_0x1535('0x11e')));this[_0x1535('0xd1')](_0x4126fb,_0x908fa9,_0x4b5787);}else{_0xd52d70[_0x1535('0x83')]=moment()[_0x1535('0x4f')](_0x1535('0x84'));ut[_0x1535('0xd5')](_0x4126fb,0x4,_0x1535('0x11f'));rpcDb[_0x1535('0xd6')](_0x4126fb,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x1535('0x12')][_0x1535('0x120')]=function(_0x512cfe){var _0x16be56=this;var _0x4c42fa=this[_0x1535('0x65')][_0x512cfe[_0x1535('0x9a')]];var _0x1385d2;if(_0x4c42fa){_0x1385d2=this[_0x1535('0x15')][_0x4c42fa[_0x1535('0x66')]];logger[_0x1535('0x77')](_0x1535('0x121'),_0x512cfe['linkedid'],_0x1535('0x9f'),_0x1385d2[_0x1535('0x25')],_0x1535('0x68'),_0x1385d2['pTalking']);}if(this[_0x1535('0x65')][_0x512cfe[_0x1535('0x9a')]]&&_0x512cfe[_0x1535('0x9a')]!==_0x512cfe[_0x1535('0x9e')]){if(_0x512cfe[_0x1535('0x122')]==='16'&&this['actions'][_0x512cfe[_0x1535('0x9a')]][_0x1535('0x9d')]){this[_0x1535('0x93')](_0x512cfe,_0x512cfe[_0x1535('0x9a')],_0x512cfe[_0x1535('0x122')]);}else if(this[_0x1535('0x65')][_0x512cfe[_0x1535('0x9a')]]['dialAnswer']){logger[_0x1535('0x77')](_0x1535('0x123'),_0x512cfe[_0x1535('0x9a')],_0x512cfe[_0x1535('0x122')],_0x1535('0x9f'),_0x1385d2['name'],'pTalking:\x20',_0x1385d2[_0x1535('0x29')]);this[_0x1535('0x93')](_0x512cfe,_0x512cfe[_0x1535('0x9a')],_0x512cfe[_0x1535('0x122')]);}}else if(_0x4c42fa&&_[_0x1535('0x63')](_0x4c42fa['statedesc'])&&_0x1385d2[_0x1535('0x124')]&&_0x512cfe[_0x1535('0x9a')]===_0x512cfe[_0x1535('0x9e')]&&_[_0x1535('0x63')](_0x512cfe['reason'])&&_0x512cfe[_0x1535('0x122')]==='16'&&_0x512cfe[_0x1535('0x125')]==='6'&&_[_0x1535('0xd2')](_0x4c42fa[_0x1535('0x126')])){if(_0x4c42fa[_0x1535('0xb6')]){rpcDb[_0x1535('0xc7')](_0x4c42fa['idContact']);}if(_0x4c42fa[_0x1535('0xbe')]){rpcDb[_0x1535('0xc9')](_0x4c42fa[_0x1535('0xc8')]);}_0x512cfe[_0x1535('0xd4')]='22';this[_0x1535('0xd1')](_0x4c42fa,_0x1385d2,_0x512cfe);}else if(_0x4c42fa&&_0x4c42fa[_0x1535('0x126')]){if(_0x512cfe['cause']==='16'&&this[_0x1535('0x65')][_0x512cfe[_0x1535('0x9a')]][_0x1535('0x9d')]){logger[_0x1535('0x77')]('[syncHangup][talking][transfer]',_0x512cfe[_0x1535('0x9a')],_0x512cfe[_0x1535('0x122')],_0x1535('0x9f'),_0x1385d2[_0x1535('0x25')],_0x1535('0x68'),_0x1385d2[_0x1535('0x29')]);this[_0x1535('0x93')](_0x512cfe,_0x512cfe[_0x1535('0x9a')],_0x512cfe[_0x1535('0x122')]);}else if(this['actions'][_0x512cfe['linkedid']][_0x1535('0x9d')]){logger[_0x1535('0x77')]('[syncHangup][talking][cause]',_0x512cfe[_0x1535('0x9a')],_0x512cfe['cause'],_0x1535('0x9f'),_0x1385d2[_0x1535('0x25')],_0x1535('0x68'),_0x1385d2[_0x1535('0x29')]);this[_0x1535('0x93')](_0x512cfe,_0x512cfe[_0x1535('0x9a')],_0x512cfe[_0x1535('0x122')]);}}};Preview[_0x1535('0x12')][_0x1535('0x127')]=function(_0x1f48f3){if(this[_0x1535('0x65')][_0x1f48f3['destlinkedid']]&&_0x1f48f3['destlinkedid']!==_0x1f48f3[_0x1535('0x128')]){this['callProgressDetectingCustomer'](_0x1f48f3,_0x1f48f3['destlinkedid'],_0x1f48f3[_0x1535('0x129')]);}};Preview[_0x1535('0x12')]['syncHangupRequest']=function(_0x54333d){if(this[_0x1535('0x65')][_0x54333d[_0x1535('0x9a')]]&&_0x54333d['linkedid']!==_0x54333d['uniqueid']&&!this[_0x1535('0x65')][_0x54333d[_0x1535('0x9a')]][_0x1535('0x9d')]){if(_0x54333d[_0x1535('0x122')]==='1'){this[_0x1535('0x93')](_0x54333d,_0x54333d[_0x1535('0x9a')],_0x54333d['cause']);}}};Preview['prototype']['addVariable']=function(_0x11244a,_0x1959b7,_0x59bdfa){if(this[_0x1535('0x65')][_0x11244a]){if(_[_0x1535('0x63')](this[_0x1535('0x65')][_0x11244a][_0x1535('0x12a')])){this[_0x1535('0x65')][_0x11244a]['variables']={};}this[_0x1535('0x65')][_0x11244a][_0x1535('0x12a')][_0x1959b7]=_0x59bdfa;}};Preview[_0x1535('0x12')][_0x1535('0x12b')]=function(_0x555553){try{if(!_[_0x1535('0x63')](_0x555553)){if(ut['filterKey'](_[_0x1535('0x12c')](_0x555553['variable'])[0x0])){this[_0x1535('0x12d')](_0x555553[_0x1535('0x9e')],_[_0x1535('0x12c')](_0x555553[_0x1535('0x12e')])[0x0],_0x555553['value']);}}}catch(_0x141b4b){logger[_0x1535('0x12f')]('[syncVarSet][Preview]',util[_0x1535('0x130')](_0x141b4b,{'showHidden':![],'depth':null}));}};Preview[_0x1535('0x12')][_0x1535('0x22')]=function(_0x2f5a31){if(_0x2f5a31){if(this[_0x1535('0x65')][_0x2f5a31['transfertargetlinkedid']]){this['actions'][_0x2f5a31[_0x1535('0x131')]]['transfer']=!![];}}};Preview[_0x1535('0x12')][_0x1535('0x132')]=function(_0x1304cd){if(_0x1304cd){if(this[_0x1535('0x65')][_0x1304cd[_0x1535('0x133')]]){this[_0x1535('0x65')][_0x1304cd['transfererlinkedid']][_0x1535('0x126')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 450a57f..574144a 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 _0xd8bc=['crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','createHistory','[createHistory]\x20','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xd8bc,0x101));var _0xcd8b=function(_0x48f5e9,_0x23693a){_0x48f5e9=_0x48f5e9-0x0;var _0x516e95=_0xd8bc[_0x48f5e9];return _0x516e95;};'use strict';var util=require(_0xcd8b('0x0'));var BPromise=require(_0xcd8b('0x1'));var logger=require(_0xcd8b('0x2'))(_0xcd8b('0x3'));var _=require(_0xcd8b('0x4'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xcd8b('0x5'));var cmHopperHistory=require(_0xcd8b('0x6'));var cmHopperBlack=require(_0xcd8b('0x7'));var voiceQueueRt=require(_0xcd8b('0x8'));var agentReportPreview=require(_0xcd8b('0x9'));var voiceQueueReport=require(_0xcd8b('0xa'));function loggerCatch(_0x330ee7){return function(_0x284f1b){logger[_0xcd8b('0xb')](_0x330ee7,util['inspect'](_0x284f1b,{'showHidden':![],'depth':null}));};}function create(_0x3122f7){return BPromise[_0xcd8b('0xc')]()[_0xcd8b('0xd')](cmHopperHistory[_0xcd8b('0xe')](_0x3122f7))['catch'](loggerCatch(_0xcd8b('0xf')));}function createAgent(_0x2365d4){return BPromise[_0xcd8b('0xc')]()[_0xcd8b('0xd')](agentReportPreview[_0xcd8b('0xe')](_0x2365d4))[_0xcd8b('0x10')](loggerCatch(_0xcd8b('0xf')));}function moveContact(_0x53d478){return BPromise[_0xcd8b('0xc')]()[_0xcd8b('0xd')](cmHopper[_0xcd8b('0x11')](_0x53d478,!![]))['catch'](loggerCatch(_0xcd8b('0x12')));}exports[_0xcd8b('0x13')]=function(_0x9366f9){return BPromise[_0xcd8b('0xc')]()[_0xcd8b('0xd')](cmHopperBlack[_0xcd8b('0x13')](_0x9366f9))[_0xcd8b('0x10')](loggerCatch(_0xcd8b('0x14')));};exports[_0xcd8b('0x15')]=function(_0x5452e7){return BPromise[_0xcd8b('0xc')]()[_0xcd8b('0xd')](cmHopper[_0xcd8b('0x15')](_0x5452e7))[_0xcd8b('0x10')](loggerCatch('[getContactPreview]\x20'));};exports[_0xcd8b('0xe')]=function(_0x303e72,_0x199606){create(_0x303e72)[_0xcd8b('0x10')](loggerCatch(_0x199606));moveContact(_0x303e72)[_0xcd8b('0x10')](loggerCatch(_0x199606));};exports['createAgentHistory']=function(_0x10f5d0,_0x21f2f9){createAgent(_0x10f5d0)[_0xcd8b('0x10')](loggerCatch(_0x21f2f9));};exports[_0xcd8b('0x16')]=function(_0x5bf618,_0xd0533c){create(_0x5bf618)['catch'](loggerCatch(_0xd0533c));};exports[_0xcd8b('0x17')]=function(_0x494e9c,_0x1996bd){moveContact(_0x494e9c)['catch'](loggerCatch(_0x1996bd));};exports[_0xcd8b('0x18')]=function(_0x21b056,_0x29707a,_0x240f90){if(_0x29707a){_0x21b056[_0xcd8b('0x19')]=null;}if(_0x240f90){_0x21b056[_0xcd8b('0x1a')]=![];}return BPromise[_0xcd8b('0xc')]()['then'](cmHopper[_0xcd8b('0x18')](_0x21b056))[_0xcd8b('0x10')](loggerCatch(_0xcd8b('0x1b')));};exports[_0xcd8b('0x1c')]=function(_0x538d2f){return BPromise['resolve']()[_0xcd8b('0xd')](cmHopper[_0xcd8b('0x1c')](_0x538d2f))[_0xcd8b('0x10')](loggerCatch(_0xcd8b('0x1d')));};exports[_0xcd8b('0x1e')]=function(_0x407b47){return BPromise['resolve']()[_0xcd8b('0xd')](cmHopper['unlockContact']({'UserId':null},_0x407b47,0x1))[_0xcd8b('0x10')](loggerCatch('[unlockContact]\x20'));};exports[_0xcd8b('0x1f')]=function(_0x1e8721){return BPromise[_0xcd8b('0xc')]()[_0xcd8b('0xd')](cmHopper[_0xcd8b('0x1e')]({'active':![]},_0x1e8721,0x1))['catch'](loggerCatch(_0xcd8b('0x20')));};exports[_0xcd8b('0x21')]=function(_0x443939){var _0x4d619d={};_0x4d619d['type']=_0x443939[_0xcd8b('0x22')];_0x4d619d[_0xcd8b('0x23')]=_0x443939[_0xcd8b('0x23')];_0x4d619d[_0xcd8b('0x24')]=_0x443939[_0xcd8b('0x24')];_0x4d619d[_0xcd8b('0x25')]=_0x443939[_0xcd8b('0x25')];_0x4d619d['queue']=_0x443939['queue'];_0x4d619d[_0xcd8b('0x26')]=_0x443939['answertime'];_0x4d619d[_0xcd8b('0x27')]=_0x443939[_0xcd8b('0x28')];_0x4d619d['queuecallercomplete']=0x1;_0x4d619d[_0xcd8b('0x29')]=_0x443939[_0xcd8b('0x2a')];_0x4d619d[_0xcd8b('0x2b')]=_0x443939[_0xcd8b('0x2c')];_0x4d619d[_0xcd8b('0x2d')]=_0xcd8b('0x2e');_0x4d619d[_0xcd8b('0x2f')]='xcally-motion-preview';_0x4d619d[_0xcd8b('0x30')]=0x0;_0x4d619d[_0xcd8b('0x31')]=0x1;_0x4d619d[_0xcd8b('0x32')]=_0x443939[_0xcd8b('0x2c')];_0x4d619d[_0xcd8b('0x33')]=_0xcd8b('0x34');return BPromise[_0xcd8b('0xc')]()[_0xcd8b('0xd')](voiceQueueReport[_0xcd8b('0x35')](_0x4d619d))[_0xcd8b('0x10')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0xcd8b('0x36')]=function(_0x132e03,_0x3246a4){return BPromise['resolve']()[_0xcd8b('0xd')](cmHopper['getContactRecallMe'](_0x132e03,_0x3246a4))[_0xcd8b('0x10')](loggerCatch(_0xcd8b('0x37')));};exports[_0xcd8b('0x38')]=function(_0x323877){return BPromise[_0xcd8b('0xc')]()[_0xcd8b('0xd')](cmHopper['rescheduleContact'](_0x323877,!![],!![]))[_0xcd8b('0x10')](loggerCatch(_0xcd8b('0x39')));}; \ No newline at end of file +var _0x6ebe=['inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error'];(function(_0x56c70f,_0x4e4493){var _0x3812ed=function(_0x25460f){while(--_0x25460f){_0x56c70f['push'](_0x56c70f['shift']());}};_0x3812ed(++_0x4e4493);}(_0x6ebe,0x90));var _0xe6eb=function(_0x333151,_0x347994){_0x333151=_0x333151-0x0;var _0x52ead1=_0x6ebe[_0x333151];return _0x52ead1;};'use strict';var util=require(_0xe6eb('0x0'));var BPromise=require(_0xe6eb('0x1'));var logger=require(_0xe6eb('0x2'))(_0xe6eb('0x3'));var _=require('lodash');var cmHopper=require(_0xe6eb('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xe6eb('0x5'));var cmHopperBlack=require(_0xe6eb('0x6'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xe6eb('0x7'));function loggerCatch(_0x52a6cc){return function(_0x4dc365){logger[_0xe6eb('0x8')](_0x52a6cc,util[_0xe6eb('0x9')](_0x4dc365,{'showHidden':![],'depth':null}));};}function create(_0x4da201){return BPromise[_0xe6eb('0xa')]()[_0xe6eb('0xb')](cmHopperHistory[_0xe6eb('0xc')](_0x4da201))[_0xe6eb('0xd')](loggerCatch(_0xe6eb('0xe')));}function createAgent(_0x41406c){return BPromise[_0xe6eb('0xa')]()[_0xe6eb('0xb')](agentReportPreview[_0xe6eb('0xc')](_0x41406c))['catch'](loggerCatch(_0xe6eb('0xe')));}function moveContact(_0x9a7930){return BPromise['resolve']()['then'](cmHopper[_0xe6eb('0xf')](_0x9a7930,!![]))['catch'](loggerCatch(_0xe6eb('0x10')));}exports[_0xe6eb('0x11')]=function(_0x1795ee){return BPromise[_0xe6eb('0xa')]()['then'](cmHopperBlack[_0xe6eb('0x11')](_0x1795ee))['catch'](loggerCatch(_0xe6eb('0x12')));};exports['getContactPreview']=function(_0x27974f){return BPromise[_0xe6eb('0xa')]()[_0xe6eb('0xb')](cmHopper['getContactPreview'](_0x27974f))[_0xe6eb('0xd')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x5dd569,_0x476565){create(_0x5dd569)[_0xe6eb('0xd')](loggerCatch(_0x476565));moveContact(_0x5dd569)[_0xe6eb('0xd')](loggerCatch(_0x476565));};exports['createAgentHistory']=function(_0x21b09a,_0x137841){createAgent(_0x21b09a)[_0xe6eb('0xd')](loggerCatch(_0x137841));};exports['createCustomerHistory']=function(_0x1b22e1,_0x2c3ee0){create(_0x1b22e1)['catch'](loggerCatch(_0x2c3ee0));};exports['createCustomerFinal']=function(_0x337fd,_0x2c058b){moveContact(_0x337fd)[_0xe6eb('0xd')](loggerCatch(_0x2c058b));};exports[_0xe6eb('0x13')]=function(_0x30c610,_0x143ddf,_0x25d586){if(_0x143ddf){_0x30c610[_0xe6eb('0x14')]=null;}if(_0x25d586){_0x30c610['active']=![];}return BPromise['resolve']()[_0xe6eb('0xb')](cmHopper[_0xe6eb('0x13')](_0x30c610))[_0xe6eb('0xd')](loggerCatch(_0xe6eb('0x15')));};exports[_0xe6eb('0x16')]=function(_0xd8e6bb){return BPromise[_0xe6eb('0xa')]()[_0xe6eb('0xb')](cmHopper[_0xe6eb('0x16')](_0xd8e6bb))['catch'](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x41fca2){return BPromise[_0xe6eb('0xa')]()[_0xe6eb('0xb')](cmHopper[_0xe6eb('0x17')]({'UserId':null},_0x41fca2,0x1))[_0xe6eb('0xd')](loggerCatch(_0xe6eb('0x18')));};exports[_0xe6eb('0x19')]=function(_0x9d09d5){return BPromise[_0xe6eb('0xa')]()['then'](cmHopper['unlockContact']({'active':![]},_0x9d09d5,0x1))['catch'](loggerCatch(_0xe6eb('0x1a')));};exports[_0xe6eb('0x1b')]=function(_0x5d51e3){var _0x19d73f={};_0x19d73f['type']=_0x5d51e3['type'];_0x19d73f[_0xe6eb('0x1c')]=_0x5d51e3[_0xe6eb('0x1c')];_0x19d73f['calleridnum']=_0x5d51e3['calleridnum'];_0x19d73f[_0xe6eb('0x1d')]=_0x5d51e3[_0xe6eb('0x1d')];_0x19d73f['queue']=_0x5d51e3[_0xe6eb('0x1e')];_0x19d73f[_0xe6eb('0x1f')]=_0x5d51e3['answertime'];_0x19d73f[_0xe6eb('0x20')]=_0x5d51e3[_0xe6eb('0x21')];_0x19d73f[_0xe6eb('0x22')]=0x1;_0x19d73f[_0xe6eb('0x23')]=_0x5d51e3[_0xe6eb('0x24')];_0x19d73f[_0xe6eb('0x25')]=_0x5d51e3[_0xe6eb('0x26')];_0x19d73f[_0xe6eb('0x27')]=_0xe6eb('0x28');_0x19d73f[_0xe6eb('0x29')]=_0xe6eb('0x2a');_0x19d73f[_0xe6eb('0x2b')]=0x0;_0x19d73f['assigned']=0x1;_0x19d73f[_0xe6eb('0x2c')]=_0x5d51e3[_0xe6eb('0x26')];_0x19d73f[_0xe6eb('0x2d')]=_0xe6eb('0x2e');return BPromise['resolve']()['then'](voiceQueueReport['create'](_0x19d73f))[_0xe6eb('0xd')](loggerCatch(_0xe6eb('0x2f')));};exports[_0xe6eb('0x30')]=function(_0xa6cdad,_0x3b1d50){return BPromise['resolve']()['then'](cmHopper[_0xe6eb('0x30')](_0xa6cdad,_0x3b1d50))['catch'](loggerCatch(_0xe6eb('0x31')));};exports[_0xe6eb('0x32')]=function(_0x2105a9){return BPromise[_0xe6eb('0xa')]()[_0xe6eb('0xb')](cmHopper[_0xe6eb('0x13')](_0x2105a9,!![],!![]))[_0xe6eb('0xd')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index bd64a59..657350b 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 _0xbbef=['countglobal','callback','callbackat','xmd-voicequeueid','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','util','moment','../../../../config/logger','env','milliseconds','seconds','loggerCatch','error','inspect','logger','info','logger2','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','hasOwnProperty','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','state','ringtime','logLookAgent','membername','UserId','logCustomer','answertime','isFailure','BOOKED','originate','channelAgent','from-sip','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','queue','interface','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','diff','CampaignId','filterKey','type','dialAnswer'];(function(_0x26dde2,_0x19686c){var _0x1d4bec=function(_0x45d380){while(--_0x45d380){_0x26dde2['push'](_0x26dde2['shift']());}};_0x1d4bec(++_0x19686c);}(_0xbbef,0x11e));var _0xfbbe=function(_0x284dfd,_0x24f3a3){_0x284dfd=_0x284dfd-0x0;var _0x34bc99=_0xbbef[_0x284dfd];return _0x34bc99;};'use strict';var util=require(_0xfbbe('0x0'));var _=require('lodash');var moment=require(_0xfbbe('0x1'));var logger=require(_0xfbbe('0x2'))('preview');var ipAgi=process[_0xfbbe('0x3')]['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0x3c1c6b,_0x4fc7e0){var _0x56e554=moment(_0x3c1c6b)[_0xfbbe('0x4')](0x0);var _0x33c9f9=moment(_0x4fc7e0)[_0xfbbe('0x4')](0x0);return _0x56e554['diff'](_0x33c9f9,_0xfbbe('0x5'));}exports[_0xfbbe('0x6')]=function(_0x59e811){return function(_0x15928a){logger[_0xfbbe('0x7')](_0x59e811,util[_0xfbbe('0x8')](_0x15928a,{'showHidden':![],'depth':null}));};};exports[_0xfbbe('0x9')]=function(_0xe90a11,_0x207db9){logger[_0xfbbe('0xa')](_0xe90a11,util[_0xfbbe('0x8')](_0x207db9,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0xe2c5c0,_0x3d1365){logger[_0xfbbe('0x7')](_0xe2c5c0,util[_0xfbbe('0x8')](_0x3d1365,{'showHidden':![],'depth':null}));};exports[_0xfbbe('0xb')]=function(_0x14cd83){return function(_0x5e854c){logger['info'](_0x14cd83,util[_0xfbbe('0x8')](_0x5e854c,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x5ccb4d,_0x17b5e9,_0x27f7c3){return{'message':_0x5ccb4d,'unlock':_0x17b5e9,'active':_0x27f7c3};};exports[_0xfbbe('0xc')]=function(_0x3bd370,_0x280fc9,_0x1128cc){if(!_[_0xfbbe('0xd')](_0x1128cc)&&_0xfbbe('0xe')===typeof _0x1128cc&&!_[_0xfbbe('0xf')](_0x1128cc)){if(!_[_0xfbbe('0xd')](_0x280fc9)&&_0xfbbe('0xe')===typeof _0x280fc9&&!_[_0xfbbe('0xf')](_0x280fc9)){return util[_0xfbbe('0x10')]('\x22%s\x22\x20<%s>',_0x280fc9,_0x1128cc);}return util[_0xfbbe('0x10')](_0xfbbe('0x11'),_0x1128cc,_0x1128cc);}if(!_[_0xfbbe('0xd')](_0x3bd370)&&_0xfbbe('0xe')===typeof _0x3bd370&&!_[_0xfbbe('0xf')](_0x3bd370)){return _0x3bd370;}return'\x22\x22\x20<>';};exports[_0xfbbe('0x12')]=function(_0x1023b4){if(_[_0xfbbe('0x13')](_0x1023b4)){return![];}return _0x1023b4;};exports[_0xfbbe('0x14')]=function(_0x59cf75,_0x2f1629,_0x3b854d,_0x55a09b,_0x27338a,_0x57cd6c){var _0x1b62bb={'XMD-QUEUE':_0x2f1629[_0xfbbe('0x15')]?_0x2f1629['Queue'][_0xfbbe('0x16')]:'','XMD-CALLERID':_0x55a09b,'XMD-CALLERID-PREVIEW':_0x57cd6c?util[_0xfbbe('0x10')](_0xfbbe('0x11'),_0x57cd6c[_0xfbbe('0x17')],_0x57cd6c[_0xfbbe('0x18')]):_0x55a09b,'XMD-DIALID':_0x27338a,'XMD-CONTACTID':_0x2f1629['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x55a09b,'XMD-VOICEQUEUEID':_0x2f1629[_0xfbbe('0x19')],'XMD-DIALCHANNEL':_0x3b854d,'XMD-DIALTIMEOUT':_0x59cf75[_0xfbbe('0x1a')]||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x59cf75[_0xfbbe('0x1b')]?'g':'',_['isEmpty'](_0x59cf75[_0xfbbe('0x1c')])?'':_0xfbbe('0x1d')),'XMD-DIALURL':_0x59cf75['dialPreviewUrl']||'','XMD-AGI':_0x59cf75['dialQueueProject']?util[_0xfbbe('0x10')](_0xfbbe('0x1e'),ipAgi,_0x59cf75[_0xfbbe('0x1f')]):_0xfbbe('0x20'),'XMD-AGIAFTER':_0x59cf75[_0xfbbe('0x1b')]?util[_0xfbbe('0x10')](_0xfbbe('0x1e'),ipAgi,_0x59cf75[_0xfbbe('0x1b')]):_0xfbbe('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x57cd6c?_0x57cd6c[_0xfbbe('0x21')]:'','XMD-ORIGINATECALLERIDNAME':_0x57cd6c?_0x57cd6c['originatecalleridname']:'','XMD-DESTINATION':_0xfbbe('0x22')};if(!_[_0xfbbe('0xf')](_0x59cf75[_0xfbbe('0x1c')])){_0x1b62bb[util[_0xfbbe('0x10')]('%s',_0xfbbe('0x23'))]=_0x59cf75[_0xfbbe('0x1c')];_0x1b62bb[util[_0xfbbe('0x10')]('%s',_0xfbbe('0x24'))]=_0x27338a;}if(_0x2f1629&&_0x2f1629[_0xfbbe('0x25')]){for(var _0x35653c in _0x2f1629[_0xfbbe('0x25')]){if(_0x2f1629['Contact']['hasOwnProperty'](_0x35653c)){if(!_[_0xfbbe('0x13')](_0x2f1629[_0xfbbe('0x25')][_0x35653c])&&_0x35653c!=='id'&&_0x35653c!=='tags'&&_0x35653c!==_0xfbbe('0x26')&&_0x35653c!==_0xfbbe('0x27')){_0x1b62bb[util[_0xfbbe('0x10')](_0xfbbe('0x28'),_0xfbbe('0x29'),_[_0xfbbe('0x2a')](_0x35653c))]=_0x2f1629[_0xfbbe('0x25')][_0x35653c];}}}}return _0x1b62bb;};exports[_0xfbbe('0x2b')]=function(_0x4c775f){var _0x29b094={};for(var _0x27da80 in _0x4c775f){if(_0x4c775f[_0xfbbe('0x2c')](_0x27da80)){_0x29b094[util[_0xfbbe('0x10')]('%s',_['toLower'](_0x27da80))]=_0x4c775f[_0x27da80];}}return{'variables':_0x29b094};};exports[_0xfbbe('0x2d')]=function(_0x4063d7,_0x2833cd){if(!_[_0xfbbe('0x13')](_0x4063d7)){if(_0x4063d7['hasOwnProperty'](_0xfbbe('0x2e'))){if(_0x4063d7[_0xfbbe('0x2e')]>0x0){_0x4063d7['originated']-=0x1;}else{logger[_0xfbbe('0x7')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x2833cd);}}}else{logger[_0xfbbe('0x7')](_0xfbbe('0x2f'),_0x2833cd);}};exports['logBlacklist']=function(_0x9f30bc){var _0x402e9d=moment()[_0xfbbe('0x10')](_0xfbbe('0x30'));_0x9f30bc['state']=0xd;_0x9f30bc[_0xfbbe('0x31')]=_0xfbbe('0x32');_0x9f30bc[_0xfbbe('0x33')]=_0x402e9d;_0x9f30bc[_0xfbbe('0x34')]=_0x402e9d;_0x9f30bc[_0xfbbe('0x35')]=_0x402e9d;};exports[_0xfbbe('0x36')]=function(_0x563278,_0x3e97c0,_0x3c9a29){var _0x575378=moment()[_0xfbbe('0x10')](_0xfbbe('0x30'));_0x563278[_0xfbbe('0x37')]=_0x3e97c0;_0x563278['statedesc']=_0x3c9a29;_0x563278[_0xfbbe('0x34')]=_0x575378;_0x563278[_0xfbbe('0x38')]=getSeconds(_0x563278[_0xfbbe('0x34')],_0x563278[_0xfbbe('0x33')]);};exports[_0xfbbe('0x39')]=function(_0x5d74b4,_0x343697,_0x1c578c){_0x5d74b4[_0xfbbe('0x3a')]=_0x343697;_0x5d74b4[_0xfbbe('0x3b')]=_0x1c578c;};exports[_0xfbbe('0x3c')]=function(_0x3053f5,_0x4df027,_0x1e6bbe){var _0x256d95=moment()[_0xfbbe('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x3053f5[_0xfbbe('0x37')]=_0x4df027;_0x3053f5[_0xfbbe('0x31')]=_0x1e6bbe;_0x3053f5[_0xfbbe('0x34')]=_0x3053f5['responsetime']?_0x3053f5['responsetime']:_0x256d95;_0x3053f5[_0xfbbe('0x35')]=_0x3053f5[_0xfbbe('0x35')]?_0x3053f5[_0xfbbe('0x35')]:_0x256d95;_0x3053f5[_0xfbbe('0x38')]=getSeconds(_0x3053f5[_0xfbbe('0x34')]||0x0,_0x3053f5[_0xfbbe('0x33')]||0x0);_0x3053f5['talktime']=_0x3053f5[_0xfbbe('0x3d')]?getSeconds(_0x3053f5[_0xfbbe('0x35')],_0x3053f5[_0xfbbe('0x3d')]):0x0;};exports[_0xfbbe('0x3e')]=function(_0x4955cb){return _0x4955cb==='Failure';};exports['variablesAction']=function(_0x471b70,_0xeb7546,_0x25c5e0,_0x5e5c71,_0x2ba5b0){var _0x46179a=_0x5e5c71?'RECALL':_0x471b70[_0xfbbe('0x17')];_0x46179a=_0x2ba5b0?_0xfbbe('0x3f'):_0x46179a;return{'actionid':_0x471b70['uniqueid'],'action':_0xfbbe('0x40'),'channel':_0x471b70[_0xfbbe('0x41')],'callerid':util[_0xfbbe('0x10')](_0xfbbe('0x11'),_0x46179a,_0x471b70[_0xfbbe('0x18')]),'Exten':'xcally-motion-preview','Context':_0xfbbe('0x42'),'Priority':'1','variable':_0x25c5e0,'timeout':(_0xeb7546['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x471b70[_0xfbbe('0x43')]};};exports[_0xfbbe('0x44')]=function(_0x3110b7){return _0x3110b7[_0xfbbe('0x45')]+_0x3110b7[_0xfbbe('0x46')]+_0x3110b7[_0xfbbe('0x47')];};exports[_0xfbbe('0x48')]=function(_0x131d23){var _0xc7fd6b=_[_0xfbbe('0x49')](_0x131d23);_0xc7fd6b[_0xfbbe('0x37')]=0xf;_0xc7fd6b[_0xfbbe('0x31')]=_0xfbbe('0x4a');return _0xc7fd6b;};exports[_0xfbbe('0x4b')]=function(_0x409ae3,_0x19b382,_0x386e0a){var _0x504fdc={};_0x504fdc[_0x19b382]=_0x409ae3[_0x19b382];_0x504fdc[_0xfbbe('0x4c')]=![];_0x504fdc[_0xfbbe('0x4d')]=moment()[_0xfbbe('0x4e')](_0x386e0a,_0xfbbe('0x4f'))[_0xfbbe('0x10')](_0xfbbe('0x30'));_0x504fdc[_0xfbbe('0x50')]=_0x409ae3['ContactId'];_0x504fdc['ListId']=_0x409ae3[_0xfbbe('0x51')];_0x504fdc[_0xfbbe('0x19')]=_0x409ae3[_0xfbbe('0x19')]||undefined;return _0x504fdc;};exports[_0xfbbe('0x52')]=function(_0x1068e1,_0xcc570f){if(!_['isNil'](_0x1068e1)){if(_0x1068e1[_0xfbbe('0x53')]>0x0){_0x1068e1[_0xfbbe('0x53')]-=0x1;}else{logger[_0xfbbe('0x7')](_0xcc570f,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0xcc570f,_0xfbbe('0x54'));}};exports[_0xfbbe('0x55')]=function(_0x1dbfca){if(_0x1dbfca<=0x0){return!![];}return![];};exports[_0xfbbe('0x56')]=function(_0x2e94f1,_0x9024e3){_0x2e94f1['lastevent']=_0x9024e3;_0x2e94f1['name']=_0x2e94f1[_0xfbbe('0x57')];_0x2e94f1[_0xfbbe('0x58')]=_0x2e94f1[_0xfbbe('0x41')];return _0x2e94f1;};exports[_0xfbbe('0x59')]=function(_0x59700f){var _0x2fd281={};_0x2fd281['queue']=_0x59700f[_0xfbbe('0x57')];_0x2fd281[_0xfbbe('0x58')]=_0x59700f[_0xfbbe('0x41')];_0x2fd281['uniqueid']=_0x59700f[_0xfbbe('0x43')];return _0x2fd281;};exports[_0xfbbe('0x5a')]=function(_0x38f954){var _0x5c3c0f=[];for(var _0x583191 in _0x38f954){if(_0x38f954[_0xfbbe('0x2c')](_0x583191)){if(!_[_0xfbbe('0x13')](_0x38f954[_0x583191])&&_0x38f954[_0x583191]['state']===_0xfbbe('0x5b')&&_0x38f954[_0x583191][_0xfbbe('0x5c')]===_0xfbbe('0x5d')){_0x5c3c0f[_0xfbbe('0x5e')](_0x38f954[_0x583191]['id']);}}}return _0x5c3c0f;};exports[_0xfbbe('0x5f')]=function(_0x52eccd){var _0x589c6c=moment()[_0xfbbe('0x4')](0x0);var _0xc523f8=moment(_0x52eccd)[_0xfbbe('0x4')](0x0);return _0x589c6c[_0xfbbe('0x60')](_0xc523f8,_0xfbbe('0x5'));};exports['createBody']=function(_0x9dd5da){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x9dd5da[_0xfbbe('0x50')],'ListId':_0x9dd5da[_0xfbbe('0x51')],'VoiceQueueId':_0x9dd5da['VoiceQueueId']||undefined,'CampaignId':_0x9dd5da[_0xfbbe('0x61')]||undefined};};exports[_0xfbbe('0x62')]=function(_0x401d23){if(_0x401d23===_0xfbbe('0x43')||_0x401d23==='idContact'||_0x401d23===_0xfbbe('0x57')||_0x401d23===_0xfbbe('0x63')||_0x401d23==='campaigntype'||_0x401d23===_0xfbbe('0x64')||_0x401d23===_0xfbbe('0x3a')||_0x401d23==='channelAgent'||_0x401d23===_0xfbbe('0x17')||_0x401d23===_0xfbbe('0x4c')||_0x401d23==='calleridnum'||_0x401d23==='scheduledat'||_0x401d23===_0xfbbe('0x45')||_0x401d23==='countcongestionretry'||_0x401d23===_0xfbbe('0x47')||_0x401d23===_0xfbbe('0x65')||_0x401d23===_0xfbbe('0x66')||_0x401d23==='callbackuniqueid'||_0x401d23===_0xfbbe('0x67')||_0x401d23==='recallme'||_0x401d23===_0xfbbe('0x50')||_0x401d23===_0xfbbe('0x51')||_0x401d23==='UserId'||_0x401d23===_0xfbbe('0x19')||_0x401d23==='sipcallid'||_0x401d23===_0xfbbe('0x68')||_0x401d23==='xmd-queue'||_0x401d23===_0xfbbe('0x69')||_0x401d23==='xmd-listid'||_0x401d23===_0xfbbe('0x6a')||_0x401d23===_0xfbbe('0x6b')||_0x401d23===_0xfbbe('0x6c')||_0x401d23==='xmd-dialid'||_0x401d23===_0xfbbe('0x6d')||_0x401d23==='xmd-contactid'||_0x401d23===_0xfbbe('0x6e')||_0x401d23===_0xfbbe('0x6f')||_0x401d23===_0xfbbe('0x70')||_0x401d23===_0xfbbe('0x71')||_0x401d23===_0xfbbe('0x72')||_0x401d23==='rtpaudioqosbridged'||_0x401d23==='rtpaudioqosjitter'||_0x401d23===_0xfbbe('0x73')||_0x401d23===_0xfbbe('0x74')||_0x401d23===_0xfbbe('0x75')||_0x401d23===_0xfbbe('0x76')||_0x401d23===_0xfbbe('0x77')||_0x401d23===_0xfbbe('0x72')||_0x401d23==='rtpaudioqosbridged'||_0x401d23==='rtpaudioqosjitter'||_0x401d23==='rtpaudioqosjitterbridged'||_0x401d23===_0xfbbe('0x74')||_0x401d23==='rtpaudioqoslossbridged'||_0x401d23===_0xfbbe('0x76')||_0x401d23===_0xfbbe('0x77')||_0x401d23===_0xfbbe('0x78')||_0x401d23===_0xfbbe('0x79')||_0x401d23==='state'||_0x401d23===_0xfbbe('0x31')){return![];}return!![];};exports[_0xfbbe('0x7a')]=function(_0x3f0d4f,_0x57a2da){var _0x480945,_0x3b70c8,_0x3db979;if(_0x57a2da<=0x0){_0x57a2da=0x1;}_0x480945=new RegExp(_0xfbbe('0x7b')+_0x57a2da+'}$');_0x3b70c8=Math[_0xfbbe('0x7c')](0xa,_0x57a2da-0x1);_0x3db979=Math[_0xfbbe('0x7c')](0xa,_0x57a2da)-0x1;return util[_0xfbbe('0x10')]('%s',_[_0xfbbe('0x7d')](_0x3f0d4f,_0x480945,_[_0xfbbe('0x7e')](_0x3b70c8,_0x3db979)));};exports[_0xfbbe('0x7f')]=function(_0x2a173e){var _0x377723=_0x2a173e['match'](/"(.*?)"/);return _0x377723?_0x377723[0x1]:_0x2a173e;};exports['extractCalleridNumber']=function(_0xdeda0){var _0x540cf3=_0xdeda0[_0xfbbe('0x80')](/<(.*?)>/);return _0x540cf3?_0x540cf3[0x1]:_0xdeda0;}; \ No newline at end of file +var _0x9432=['%s%s','XMD-','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','endtime','logAgent','ringtime','starttime','logLookAgent','membername','UserId','talktime','answertime','isFailure','Failure','RECALL','calleridname','BOOKED','channelAgent','calleridnum','from-sip','timeout','uniqueid','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledAt','active','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','name','queue','interface','not_inuse','status','push','getDiff','createBody','CampaignId','idContact','type','campaigntype','scheduledat','countbusyretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','extractCalleridNumber','util','../../../../config/logger','127.0.0.1','milliseconds','diff','seconds','error','inspect','info','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','ContactId','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','createdAt','updatedAt'];(function(_0x565d60,_0x2cbc5b){var _0x2cdf0e=function(_0x4ffbde){while(--_0x4ffbde){_0x565d60['push'](_0x565d60['shift']());}};_0x2cdf0e(++_0x2cbc5b);}(_0x9432,0xdd));var _0x2943=function(_0x26356d,_0x55a10f){_0x26356d=_0x26356d-0x0;var _0x21eb6a=_0x9432[_0x26356d];return _0x21eb6a;};'use strict';var util=require(_0x2943('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x2943('0x1'))('preview');var ipAgi=process['env']['XCALLY_IP_AGI']||_0x2943('0x2');function getSeconds(_0x1fdf5f,_0x298114){var _0x2fba26=moment(_0x1fdf5f)[_0x2943('0x3')](0x0);var _0x4acd15=moment(_0x298114)[_0x2943('0x3')](0x0);return _0x2fba26[_0x2943('0x4')](_0x4acd15,_0x2943('0x5'));}exports['loggerCatch']=function(_0x25619b){return function(_0x1e8083){logger[_0x2943('0x6')](_0x25619b,util[_0x2943('0x7')](_0x1e8083,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x4911e8,_0x35575f){logger[_0x2943('0x8')](_0x4911e8,util[_0x2943('0x7')](_0x35575f,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x39b990,_0x5a8693){logger[_0x2943('0x6')](_0x39b990,util[_0x2943('0x7')](_0x5a8693,{'showHidden':![],'depth':null}));};exports[_0x2943('0x9')]=function(_0x12d9e7){return function(_0xe6f2db){logger[_0x2943('0x8')](_0x12d9e7,util[_0x2943('0x7')](_0xe6f2db,{'showHidden':![],'depth':null}));};};exports[_0x2943('0xa')]=function(_0x8fe60b,_0x72ee8b,_0x25822e){return{'message':_0x8fe60b,'unlock':_0x72ee8b,'active':_0x25822e};};exports[_0x2943('0xb')]=function(_0x15e08e,_0x404494,_0x561019){if(!_[_0x2943('0xc')](_0x561019)&&_0x2943('0xd')===typeof _0x561019&&!_[_0x2943('0xe')](_0x561019)){if(!_[_0x2943('0xc')](_0x404494)&&_0x2943('0xd')===typeof _0x404494&&!_[_0x2943('0xe')](_0x404494)){return util[_0x2943('0xf')](_0x2943('0x10'),_0x404494,_0x561019);}return util[_0x2943('0xf')](_0x2943('0x10'),_0x561019,_0x561019);}if(!_[_0x2943('0xc')](_0x15e08e)&&_0x2943('0xd')===typeof _0x15e08e&&!_[_0x2943('0xe')](_0x15e08e)){return _0x15e08e;}return _0x2943('0x11');};exports[_0x2943('0x12')]=function(_0x70f43d){if(_['isNil'](_0x70f43d)){return![];}return _0x70f43d;};exports[_0x2943('0x13')]=function(_0x4913e6,_0x4841f7,_0x26a449,_0x4958b3,_0x446d61,_0xb945fd){var _0x50b7a1={'XMD-QUEUE':_0x4841f7['Queue']?_0x4841f7[_0x2943('0x14')]['name']:'','XMD-CALLERID':_0x4958b3,'XMD-CALLERID-PREVIEW':_0xb945fd?util[_0x2943('0xf')](_0x2943('0x10'),_0xb945fd['calleridname'],_0xb945fd['calleridnum']):_0x4958b3,'XMD-DIALID':_0x446d61,'XMD-CONTACTID':_0x4841f7[_0x2943('0x15')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4958b3,'XMD-VOICEQUEUEID':_0x4841f7[_0x2943('0x16')],'XMD-DIALCHANNEL':_0x26a449,'XMD-DIALTIMEOUT':_0x4913e6[_0x2943('0x17')]||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x4913e6[_0x2943('0x18')]?'g':'',_[_0x2943('0xe')](_0x4913e6[_0x2943('0x19')])?'':_0x2943('0x1a')),'XMD-DIALURL':_0x4913e6[_0x2943('0x1b')]||'','XMD-AGI':_0x4913e6[_0x2943('0x1c')]?util[_0x2943('0xf')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4913e6['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x4913e6[_0x2943('0x18')]?util[_0x2943('0xf')](_0x2943('0x1d'),ipAgi,_0x4913e6['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0xb945fd?_0xb945fd[_0x2943('0x1e')]:'','XMD-ORIGINATECALLERIDNAME':_0xb945fd?_0xb945fd[_0x2943('0x1f')]:'','XMD-DESTINATION':_0x2943('0x20')};if(!_[_0x2943('0xe')](_0x4913e6['monitor_format'])){_0x50b7a1[util[_0x2943('0xf')]('%s',_0x2943('0x21'))]=_0x4913e6[_0x2943('0x19')];_0x50b7a1[util[_0x2943('0xf')]('%s',_0x2943('0x22'))]=_0x446d61;}if(_0x4841f7&&_0x4841f7[_0x2943('0x23')]){for(var _0x5238f8 in _0x4841f7[_0x2943('0x23')]){if(_0x4841f7[_0x2943('0x23')][_0x2943('0x24')](_0x5238f8)){if(!_[_0x2943('0x25')](_0x4841f7[_0x2943('0x23')][_0x5238f8])&&_0x5238f8!=='id'&&_0x5238f8!==_0x2943('0x26')&&_0x5238f8!==_0x2943('0x27')&&_0x5238f8!==_0x2943('0x28')){_0x50b7a1[util[_0x2943('0xf')](_0x2943('0x29'),_0x2943('0x2a'),_['toUpper'](_0x5238f8))]=_0x4841f7['Contact'][_0x5238f8];}}}}return _0x50b7a1;};exports[_0x2943('0x2b')]=function(_0x351354){var _0x31c6f1={};for(var _0x3b78fb in _0x351354){if(_0x351354[_0x2943('0x24')](_0x3b78fb)){_0x31c6f1[util[_0x2943('0xf')]('%s',_[_0x2943('0x2c')](_0x3b78fb))]=_0x351354[_0x3b78fb];}}return{'variables':_0x31c6f1};};exports['updateOriginated']=function(_0x64b147,_0x5b8ee4){if(!_[_0x2943('0x25')](_0x64b147)){if(_0x64b147['hasOwnProperty']('originated')){if(_0x64b147['originated']>0x0){_0x64b147[_0x2943('0x2d')]-=0x1;}else{logger[_0x2943('0x6')](_0x2943('0x2e'),_0x5b8ee4);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x5b8ee4);}};exports[_0x2943('0x2f')]=function(_0x13b93d){var _0x20aacc=moment()['format'](_0x2943('0x30'));_0x13b93d[_0x2943('0x31')]=0xd;_0x13b93d[_0x2943('0x32')]=_0x2943('0x33');_0x13b93d['starttime']=_0x20aacc;_0x13b93d[_0x2943('0x34')]=_0x20aacc;_0x13b93d[_0x2943('0x35')]=_0x20aacc;};exports[_0x2943('0x36')]=function(_0x1f369e,_0x179126,_0x1b2a21){var _0x20dbe7=moment()[_0x2943('0xf')](_0x2943('0x30'));_0x1f369e[_0x2943('0x31')]=_0x179126;_0x1f369e['statedesc']=_0x1b2a21;_0x1f369e[_0x2943('0x34')]=_0x20dbe7;_0x1f369e[_0x2943('0x37')]=getSeconds(_0x1f369e[_0x2943('0x34')],_0x1f369e[_0x2943('0x38')]);};exports[_0x2943('0x39')]=function(_0x380834,_0x567142,_0x41686d){_0x380834[_0x2943('0x3a')]=_0x567142;_0x380834[_0x2943('0x3b')]=_0x41686d;};exports['logCustomer']=function(_0x1134f8,_0xd8d017,_0x32af7c){var _0x39edee=moment()[_0x2943('0xf')](_0x2943('0x30'));_0x1134f8[_0x2943('0x31')]=_0xd8d017;_0x1134f8[_0x2943('0x32')]=_0x32af7c;_0x1134f8[_0x2943('0x34')]=_0x1134f8['responsetime']?_0x1134f8[_0x2943('0x34')]:_0x39edee;_0x1134f8['endtime']=_0x1134f8['endtime']?_0x1134f8['endtime']:_0x39edee;_0x1134f8['ringtime']=getSeconds(_0x1134f8[_0x2943('0x34')]||0x0,_0x1134f8[_0x2943('0x38')]||0x0);_0x1134f8[_0x2943('0x3c')]=_0x1134f8[_0x2943('0x3d')]?getSeconds(_0x1134f8[_0x2943('0x35')],_0x1134f8[_0x2943('0x3d')]):0x0;};exports[_0x2943('0x3e')]=function(_0x58a389){return _0x58a389===_0x2943('0x3f');};exports['variablesAction']=function(_0x4fee43,_0x2a94f2,_0x907a89,_0x7a568f,_0x4f0668){var _0x25e257=_0x7a568f?_0x2943('0x40'):_0x4fee43[_0x2943('0x41')];_0x25e257=_0x4f0668?_0x2943('0x42'):_0x25e257;return{'actionid':_0x4fee43['uniqueid'],'action':'originate','channel':_0x4fee43[_0x2943('0x43')],'callerid':util[_0x2943('0xf')]('\x22%s\x22\x20<%s>',_0x25e257,_0x4fee43[_0x2943('0x44')]),'Exten':_0x2943('0x20'),'Context':_0x2943('0x45'),'Priority':'1','variable':_0x907a89,'timeout':(_0x2a94f2[_0x2943('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4fee43[_0x2943('0x47')]};};exports['totalGlobal']=function(_0x54be14){return _0x54be14['countbusyretry']+_0x54be14[_0x2943('0x48')]+_0x54be14[_0x2943('0x49')];};exports[_0x2943('0x4a')]=function(_0x367746){var _0x4ebd5a=_[_0x2943('0x4b')](_0x367746);_0x4ebd5a['state']=0xf;_0x4ebd5a[_0x2943('0x32')]=_0x2943('0x4c');return _0x4ebd5a;};exports[_0x2943('0x4d')]=function(_0x4a5719,_0x116eeb,_0x5d0333){var _0x18a59e={};_0x18a59e[_0x116eeb]=_0x4a5719[_0x116eeb];_0x18a59e[_0x2943('0x4e')]=![];_0x18a59e['scheduledat']=moment()['add'](_0x5d0333,_0x2943('0x4f'))[_0x2943('0xf')](_0x2943('0x30'));_0x18a59e['ContactId']=_0x4a5719[_0x2943('0x15')];_0x18a59e[_0x2943('0x50')]=_0x4a5719['ListId'];_0x18a59e[_0x2943('0x16')]=_0x4a5719['VoiceQueueId']||undefined;return _0x18a59e;};exports[_0x2943('0x51')]=function(_0x1252e9,_0x12b08e){if(!_['isNil'](_0x1252e9)){if(_0x1252e9[_0x2943('0x52')]>0x0){_0x1252e9[_0x2943('0x52')]-=0x1;}else{logger[_0x2943('0x6')](_0x12b08e,_0x2943('0x53'));}}else{logger[_0x2943('0x6')](_0x12b08e,_0x2943('0x54'));}};exports[_0x2943('0x55')]=function(_0xc4b9c){if(_0xc4b9c<=0x0){return!![];}return![];};exports[_0x2943('0x56')]=function(_0x1fbf0b,_0x23c665){_0x1fbf0b['lastevent']=_0x23c665;_0x1fbf0b[_0x2943('0x57')]=_0x1fbf0b[_0x2943('0x58')];_0x1fbf0b[_0x2943('0x59')]=_0x1fbf0b[_0x2943('0x43')];return _0x1fbf0b;};exports['buildAcw']=function(_0x18d8f4){var _0x2234ee={};_0x2234ee['queue']=_0x18d8f4[_0x2943('0x58')];_0x2234ee['interface']=_0x18d8f4[_0x2943('0x43')];_0x2234ee['uniqueid']=_0x18d8f4[_0x2943('0x47')];return _0x2234ee;};exports['agentReadyId']=function(_0x2cca36){var _0x575455=[];for(var _0x1355d6 in _0x2cca36){if(_0x2cca36[_0x2943('0x24')](_0x1355d6)){if(!_[_0x2943('0x25')](_0x2cca36[_0x1355d6])&&_0x2cca36[_0x1355d6]['state']===_0x2943('0x5a')&&_0x2cca36[_0x1355d6][_0x2943('0x5b')]==='reachable'){_0x575455[_0x2943('0x5c')](_0x2cca36[_0x1355d6]['id']);}}}return _0x575455;};exports[_0x2943('0x5d')]=function(_0x3b710d){var _0x77f7fe=moment()[_0x2943('0x3')](0x0);var _0x1cc9e6=moment(_0x3b710d)['milliseconds'](0x0);return _0x77f7fe[_0x2943('0x4')](_0x1cc9e6,_0x2943('0x5'));};exports[_0x2943('0x5e')]=function(_0xcc7556){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xcc7556['ContactId'],'ListId':_0xcc7556[_0x2943('0x50')],'VoiceQueueId':_0xcc7556[_0x2943('0x16')]||undefined,'CampaignId':_0xcc7556[_0x2943('0x5f')]||undefined};};exports['filterKey']=function(_0x200768){if(_0x200768===_0x2943('0x47')||_0x200768===_0x2943('0x60')||_0x200768===_0x2943('0x58')||_0x200768===_0x2943('0x61')||_0x200768===_0x2943('0x62')||_0x200768==='dialAnswer'||_0x200768===_0x2943('0x3a')||_0x200768==='channelAgent'||_0x200768===_0x2943('0x41')||_0x200768===_0x2943('0x4e')||_0x200768===_0x2943('0x44')||_0x200768===_0x2943('0x63')||_0x200768===_0x2943('0x64')||_0x200768==='countcongestionretry'||_0x200768===_0x2943('0x49')||_0x200768===_0x2943('0x65')||_0x200768===_0x2943('0x66')||_0x200768===_0x2943('0x67')||_0x200768===_0x2943('0x68')||_0x200768===_0x2943('0x69')||_0x200768===_0x2943('0x15')||_0x200768===_0x2943('0x50')||_0x200768===_0x2943('0x3b')||_0x200768==='VoiceQueueId'||_0x200768===_0x2943('0x6a')||_0x200768==='xmd-voicequeueid'||_0x200768==='xmd-queue'||_0x200768==='xmd-phone'||_0x200768==='xmd-listid'||_0x200768==='xmd-dialurl'||_0x200768===_0x2943('0x6b')||_0x200768==='xmd-dialoptions'||_0x200768===_0x2943('0x6c')||_0x200768===_0x2943('0x6d')||_0x200768===_0x2943('0x6e')||_0x200768===_0x2943('0x6f')||_0x200768===_0x2943('0x70')||_0x200768===_0x2943('0x71')||_0x200768===_0x2943('0x72')||_0x200768===_0x2943('0x73')||_0x200768===_0x2943('0x74')||_0x200768===_0x2943('0x75')||_0x200768===_0x2943('0x76')||_0x200768===_0x2943('0x77')||_0x200768===_0x2943('0x78')||_0x200768===_0x2943('0x79')||_0x200768===_0x2943('0x7a')||_0x200768===_0x2943('0x73')||_0x200768===_0x2943('0x74')||_0x200768===_0x2943('0x75')||_0x200768===_0x2943('0x76')||_0x200768===_0x2943('0x77')||_0x200768==='rtpaudioqoslossbridged'||_0x200768===_0x2943('0x79')||_0x200768===_0x2943('0x7a')||_0x200768===_0x2943('0x7b')||_0x200768===_0x2943('0x7c')||_0x200768===_0x2943('0x31')||_0x200768===_0x2943('0x32')){return![];}return!![];};exports[_0x2943('0x7d')]=function(_0x5c9e92,_0x30130b){var _0x14d31c,_0x1885ae,_0x47c9b8;if(_0x30130b<=0x0){_0x30130b=0x1;}_0x14d31c=new RegExp(_0x2943('0x7e')+_0x30130b+'}$');_0x1885ae=Math[_0x2943('0x7f')](0xa,_0x30130b-0x1);_0x47c9b8=Math[_0x2943('0x7f')](0xa,_0x30130b)-0x1;return util[_0x2943('0xf')]('%s',_[_0x2943('0x80')](_0x5c9e92,_0x14d31c,_['random'](_0x1885ae,_0x47c9b8)));};exports[_0x2943('0x81')]=function(_0x18e053){var _0x3b1074=_0x18e053['match'](/"(.*?)"/);return _0x3b1074?_0x3b1074[0x1]:_0x18e053;};exports[_0x2943('0x82')]=function(_0x2ef144){var _0x137a41=_0x2ef144['match'](/<(.*?)>/);return _0x137a41?_0x137a41[0x1]:_0x2ef144;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index d0813c2..1c57ad2 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 _0xc090=['number','boolean','queueremove','voicechannel','queueadd','string'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc090,0x112));var _0x0c09=function(_0x47fbaa,_0x24306c){_0x47fbaa=_0x47fbaa-0x0;var _0x29f7a4=_0xc090[_0x47fbaa];return _0x29f7a4;};'use strict';exports[_0x0c09('0x0')]={'queue':{'type':_0x0c09('0x1'),'required':!![]},'interface':{'type':_0x0c09('0x1'),'required':!![]},'membername':{'type':_0x0c09('0x1'),'required':!![]},'penalty':{'type':_0x0c09('0x2'),'required':![]},'paused':{'type':_0x0c09('0x3'),'required':![]}};exports[_0x0c09('0x4')]={'queue':{'type':_0x0c09('0x1'),'required':!![]},'interface':{'type':_0x0c09('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x0c09('0x1'),'required':!![]},'paused':{'type':_0x0c09('0x3')},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':_0x0c09('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x0c09('0x1'),'required':!![]}};exports[_0x0c09('0x5')]={'uniqueid':{'type':_0x0c09('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x0c09('0x1')},'mixmonitorid':{'type':_0x0c09('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x0c09('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x0c09('0x1'),'required':!![]},'exten':{'type':_0x0c09('0x1'),'required':!![]},'context':{'type':_0x0c09('0x1')}}; \ No newline at end of file +var _0x2070=['queueremove','queuepause','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','number'];(function(_0x3ed430,_0x5fafab){var _0xae4a10=function(_0x53105d){while(--_0x53105d){_0x3ed430['push'](_0x3ed430['shift']());}};_0xae4a10(++_0x5fafab);}(_0x2070,0x1a2));var _0x0207=function(_0x36fbd3,_0x309770){_0x36fbd3=_0x36fbd3-0x0;var _0x566fcb=_0x2070[_0x36fbd3];return _0x566fcb;};'use strict';exports['queueadd']={'queue':{'type':'string','required':!![]},'interface':{'type':_0x0207('0x0'),'required':!![]},'membername':{'type':_0x0207('0x0'),'required':!![]},'penalty':{'type':_0x0207('0x1'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x0207('0x2')]={'queue':{'type':_0x0207('0x0'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x0207('0x3')]={'interface':{'type':_0x0207('0x0'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x0207('0x0'),'required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports[_0x0207('0x4')]={'uniqueid':{'type':_0x0207('0x0'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x0207('0x0'),'required':!![]},'filename':{'type':_0x0207('0x0')},'format':{'type':'string'},'mixmonitorid':{'type':_0x0207('0x0')}};exports[_0x0207('0x5')]={'uniqueid':{'type':_0x0207('0x0'),'required':!![]}};exports[_0x0207('0x6')]={'uniqueid':{'type':_0x0207('0x0'),'required':!![]},'exten':{'type':_0x0207('0x0'),'required':!![]},'context':{'type':_0x0207('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 6785201..9f87666 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 _0x10c4=['queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','interface','SIP/%s','isUndefined','initTelephones','initTrunks','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','seconds','queuecallercomplete','queuecallerleaveAt','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','format','name','isNil','hasOwnProperty','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','abandoned','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundAnswerCallsDay'];(function(_0x4e2682,_0x5ef978){var _0xd287f8=function(_0x4a3423){while(--_0x4a3423){_0x4e2682['push'](_0x4e2682['shift']());}};_0xd287f8(++_0x5ef978);}(_0x10c4,0x16b));var _0x410c=function(_0x524145,_0x5b1b28){_0x524145=_0x524145-0x0;var _0x518a25=_0x10c4[_0x524145];return _0x518a25;};'use strict';var BPromise=require(_0x410c('0x0'));var util=require('util');var _=require(_0x410c('0x1'));var moment=require(_0x410c('0x2'));var Agent=require(_0x410c('0x3'));var Telephone=require(_0x410c('0x4'));var Trunk=require(_0x410c('0x5'));var VoiceQueue=require(_0x410c('0x6'));var Trigger=require('../model/trigger');var Template=require(_0x410c('0x7'));var Campaign=require(_0x410c('0x8'));var VoiceExtension=require(_0x410c('0x9'));var ZendeskAccount=require(_0x410c('0xa'));var SalesforceAccount=require(_0x410c('0xb'));var FreshdeskAccount=require(_0x410c('0xc'));var SugarcrmAccount=require(_0x410c('0xd'));var ZohoAccount=require(_0x410c('0xe'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x410c('0xf'));var ServicenowAccount=require(_0x410c('0x10'));var Dynamics365Account=require(_0x410c('0x11'));var FaxAccount=require(_0x410c('0x12'));var Realtime=function(){this[_0x410c('0x13')]={};this[_0x410c('0x14')]={};this[_0x410c('0x15')]={};this[_0x410c('0x16')]={};this[_0x410c('0x17')]={};this[_0x410c('0x18')]={};this['templates']={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x410c('0x19')]={};this[_0x410c('0x1a')]={};this[_0x410c('0x1b')]={};this[_0x410c('0x1c')]={};this[_0x410c('0x1d')]={};this['zendeskAccounts']={};this[_0x410c('0x1e')]={};this['sugarcrmAccounts']={};this[_0x410c('0x1f')]={};this[_0x410c('0x20')]={};this['deskAccounts']={};this[_0x410c('0x21')]={};this[_0x410c('0x22')]={};this[_0x410c('0x23')]={};this[_0x410c('0x24')]={};};function freeIsNotKey(_0x4a58a4,_0x376615,_0x15b1f1){var _0x3e0f4f=_[_0x410c('0x25')](_0x4a58a4,function(_0x3cf0d2,_0x33e93a){return _0x3cf0d2[_0x15b1f1];});for(var _0x3e7428 in _0x376615){if(_0x376615['hasOwnProperty'](_0x3e7428)){if(!_0x3e0f4f[_0x3e7428]){delete _0x376615[_0x3e7428];}}}}function freeIsNotKeySip(_0x454353,_0x478dc5){var _0x4b723b=_[_0x410c('0x25')](_0x454353,function(_0x199321,_0x6c0376){return util[_0x410c('0x26')]('SIP/%s',_0x199321[_0x410c('0x27')]);});for(var _0x346cfc in _0x478dc5){if(_0x478dc5['hasOwnProperty'](_0x346cfc)){if(!_0x4b723b[_0x346cfc]){delete _0x478dc5[_0x346cfc];}}}}function freeIsNotKeyAgent(_0x2e3567,_0x2d10c6){var _0x3f889f=_['mapKeys'](_0x2e3567,function(_0x525b61,_0x394f5d){var _0x389054=_[_0x410c('0x28')](_0x525b61['interface'])?util[_0x410c('0x26')]('SIP/%s',_0x525b61[_0x410c('0x27')]):_0x525b61['interface'];return _0x389054;});for(var _0x8c5304 in _0x2d10c6){if(_0x2d10c6[_0x410c('0x29')](_0x8c5304)){if(!_0x3f889f[_0x8c5304]){delete _0x2d10c6[_0x8c5304];}}}}function clearVoiceCallReports(_0x4f2f34){_0x4f2f34[_0x410c('0x2a')]=0x0;_0x4f2f34[_0x410c('0x2b')]=0x0;_0x4f2f34[_0x410c('0x2c')]=0x0;_0x4f2f34[_0x410c('0x2d')]=0x0;_0x4f2f34[_0x410c('0x2e')]=0x0;}function clearCampaigns(_0x347db1){if(!_[_0x410c('0x2f')](_0x347db1)){for(var _0x1b7968 in _0x347db1){if(_0x347db1[_0x410c('0x29')](_0x1b7968)){_0x347db1[_0x1b7968][_0x410c('0x30')]=0x0;_0x347db1[_0x1b7968]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x37ae90){if(!_[_0x410c('0x2f')](_0x37ae90)){for(var _0x5e37f7 in _0x37ae90){if(_0x37ae90[_0x410c('0x29')](_0x5e37f7)){_0x37ae90[_0x5e37f7][_0x410c('0x2a')]=0x0;_0x37ae90[_0x5e37f7][_0x410c('0x2b')]=0x0;_0x37ae90[_0x5e37f7]['unmanaged']=0x0;_0x37ae90[_0x5e37f7][_0x410c('0x31')]=0x0;_0x37ae90[_0x5e37f7]['sumHoldTime']=0x0;_0x37ae90[_0x5e37f7][_0x410c('0x2d')]=0x0;_0x37ae90[_0x5e37f7][_0x410c('0x2e')]=0x0;_0x37ae90[_0x5e37f7][_0x410c('0x32')]=0x0;_0x37ae90[_0x5e37f7]['outboundNoAnswerCallsDay']=0x0;_0x37ae90[_0x5e37f7][_0x410c('0x33')]=0x0;_0x37ae90[_0x5e37f7][_0x410c('0x34')]=0x0;_0x37ae90[_0x5e37f7][_0x410c('0x35')]=0x0;_0x37ae90[_0x5e37f7]['outboundUnknownCallsDay']=0x0;_0x37ae90[_0x5e37f7]['outboundDropCallsDayTimeout']=0x0;_0x37ae90[_0x5e37f7][_0x410c('0x36')]=0x0;_0x37ae90[_0x5e37f7]['outboundBlacklistCallsDay']=0x0;_0x37ae90[_0x5e37f7][_0x410c('0x37')]=0x0;_0x37ae90[_0x5e37f7]['outboundRejectCallsDay']=0x0;_0x37ae90[_0x5e37f7]['outboundReCallsDay']=0x0;_0x37ae90[_0x5e37f7][_0x410c('0x32')]=0x0;_0x37ae90[_0x5e37f7][_0x410c('0x38')]=0x0;_0x37ae90[_0x5e37f7][_0x410c('0x39')]=!![];}}}}Realtime[_0x410c('0x3a')][_0x410c('0x3b')]=function(_0x3e60d9,_0x2c674a){for(var _0x345034 in _0x2c674a){if(_0x3e60d9['hasOwnProperty'](_0x345034)){_0x3e60d9[_0x345034]=_0x2c674a[_0x345034];}}};Realtime[_0x410c('0x3a')][_0x410c('0x3c')]=function(){var _0x582e24=this;return function(_0x475a43){if(_0x475a43){freeIsNotKeyAgent(_0x475a43,_0x582e24[_0x410c('0x13')]);for(var _0xc1e7f9=0x0,_0x50f47a={},_0x268fd8={};_0xc1e7f9<_0x475a43[_0x410c('0x3d')];_0xc1e7f9+=0x1){_0x50f47a=_0x475a43[_0xc1e7f9];var _0x4cd183=_[_0x410c('0x28')](_0x50f47a[_0x410c('0x3e')])?util['format'](_0x410c('0x3f'),_0x50f47a[_0x410c('0x27')]):_0x50f47a[_0x410c('0x3e')];if(_[_0x410c('0x40')](_0x582e24['agents'][_0x4cd183])){_0x582e24[_0x410c('0x13')][_0x4cd183]=new Agent(_0x50f47a);}else{_0x582e24[_0x410c('0x3b')](_0x582e24[_0x410c('0x13')][_0x4cd183],_0x50f47a);}}}return _0x582e24[_0x410c('0x13')];};};Realtime[_0x410c('0x3a')][_0x410c('0x41')]=function(){var _0x35d6c7=this;return function(_0x1f2894){if(_0x1f2894){freeIsNotKeySip(_0x1f2894,_0x35d6c7[_0x410c('0x14')]);for(var _0xf23039=0x0,_0x486956={},_0x32ed17={};_0xf23039<_0x1f2894[_0x410c('0x3d')];_0xf23039+=0x1){_0x486956=_0x1f2894[_0xf23039];if(_[_0x410c('0x40')](_0x35d6c7[_0x410c('0x14')][util['format']('SIP/%s',_0x486956[_0x410c('0x27')])])){_0x35d6c7['telephones'][util[_0x410c('0x26')](_0x410c('0x3f'),_0x486956['name'])]=new Telephone(_0x486956);}else{_0x35d6c7[_0x410c('0x3b')](_0x35d6c7['telephones'][util[_0x410c('0x26')]('SIP/%s',_0x486956[_0x410c('0x27')])],_0x486956);}}}return _0x35d6c7[_0x410c('0x14')];};};Realtime[_0x410c('0x3a')][_0x410c('0x42')]=function(){var _0x16d928=this;return function(_0x49d823){if(_0x49d823){freeIsNotKeySip(_0x49d823,_0x16d928[_0x410c('0x15')]);for(var _0x258dcb=0x0,_0xb00e0f={},_0x3f78fa={};_0x258dcb<_0x49d823[_0x410c('0x3d')];_0x258dcb+=0x1){_0xb00e0f=_0x49d823[_0x258dcb];if(_[_0x410c('0x40')](_0x16d928[_0x410c('0x15')][util[_0x410c('0x26')](_0x410c('0x3f'),_0xb00e0f[_0x410c('0x27')])])){_0x16d928[_0x410c('0x15')][util['format'](_0x410c('0x3f'),_0xb00e0f[_0x410c('0x27')])]=new Trunk(_0xb00e0f);}else{_0x16d928[_0x410c('0x3b')](_0x16d928['trunks'][util[_0x410c('0x26')](_0x410c('0x3f'),_0xb00e0f['name'])],_0xb00e0f);}}}return _0x16d928[_0x410c('0x15')];};};Realtime[_0x410c('0x3a')]['initVoiceQueues']=function(){var _0x3773d4=this;return function(_0x4649be){if(_0x4649be){freeIsNotKey(_0x4649be,_0x3773d4['voiceQueues'],_0x410c('0x27'));for(var _0x2aac0b=0x0,_0x1abd14={},_0x3a0670={};_0x2aac0b<_0x4649be['length'];_0x2aac0b+=0x1){_0x1abd14=_0x4649be[_0x2aac0b];if(_['isUndefined'](_0x3773d4['voiceQueues'][_0x1abd14[_0x410c('0x27')]])){_0x3773d4[_0x410c('0x16')][_0x1abd14[_0x410c('0x27')]]=new VoiceQueue(_0x1abd14);}else{_0x3773d4[_0x410c('0x3b')](_0x3773d4[_0x410c('0x16')][_0x1abd14[_0x410c('0x27')]],_0x1abd14);}}}return _0x3773d4[_0x410c('0x16')];};};Realtime[_0x410c('0x3a')]['initTriggers']=function(){var _0xb03307=this;return function(_0x167d8c){if(_0x167d8c){freeIsNotKey(_0x167d8c,_0xb03307[_0x410c('0x17')],'id');for(var _0x28b763=0x0,_0x281bf0={},_0x5bc009={};_0x28b763<_0x167d8c[_0x410c('0x3d')];_0x28b763+=0x1){_0x281bf0=_0x167d8c[_0x28b763];if(_['isUndefined'](_0xb03307[_0x410c('0x17')][_0x281bf0['id']])){_0xb03307[_0x410c('0x17')][_0x281bf0['id']]=new Trigger(_0x281bf0);}else{_0xb03307[_0x410c('0x3b')](_0xb03307['triggers'][_0x281bf0['id']],_0x281bf0);}}}return _0xb03307[_0x410c('0x17')];};};Realtime[_0x410c('0x3a')][_0x410c('0x43')]=function(){var _0x3e1c76=this;return function(_0x517734){if(_0x517734){freeIsNotKey(_0x517734,_0x3e1c76[_0x410c('0x44')],'id');for(var _0x1526c1=0x0,_0x21dc66={},_0x47690c={};_0x1526c1<_0x517734[_0x410c('0x3d')];_0x1526c1+=0x1){_0x21dc66=_0x517734[_0x1526c1];if(_[_0x410c('0x40')](_0x3e1c76[_0x410c('0x44')][_0x21dc66['id']])){_0x3e1c76['templates'][_0x21dc66['id']]=new Template(_0x21dc66);}else{_0x3e1c76[_0x410c('0x3b')](_0x3e1c76[_0x410c('0x44')][_0x21dc66['id']],_0x21dc66);}}}return _0x3e1c76[_0x410c('0x44')];};};Realtime[_0x410c('0x3a')][_0x410c('0x45')]=function(){var _0x290619=this;return function(_0x5ad9d3){if(_0x5ad9d3){freeIsNotKey(_0x5ad9d3,_0x290619[_0x410c('0x46')],'id');for(var _0x4dcc9d=0x0,_0x3821ba={},_0x47b2b5={};_0x4dcc9d<_0x5ad9d3['length'];_0x4dcc9d+=0x1){_0x3821ba=_0x5ad9d3[_0x4dcc9d];if(_[_0x410c('0x40')](_0x290619['zendeskAccounts'][_0x3821ba['id']])){_0x290619[_0x410c('0x46')][_0x3821ba['id']]=new ZendeskAccount(_0x3821ba);}else{_0x290619[_0x410c('0x3b')](_0x290619[_0x410c('0x46')][_0x3821ba['id']],_0x3821ba);}}}return _0x290619[_0x410c('0x46')];};};Realtime[_0x410c('0x3a')][_0x410c('0x47')]=function(){var _0x4a070d=this;return function(_0xfe9496){if(_0xfe9496){freeIsNotKey(_0xfe9496,_0x4a070d[_0x410c('0x1e')],'id');for(var _0x4d34ca=0x0,_0x16edcb={},_0x1bc850={};_0x4d34ca<_0xfe9496[_0x410c('0x3d')];_0x4d34ca+=0x1){_0x16edcb=_0xfe9496[_0x4d34ca];if(_[_0x410c('0x40')](_0x4a070d[_0x410c('0x1e')][_0x16edcb['id']])){_0x4a070d[_0x410c('0x1e')][_0x16edcb['id']]=new SalesforceAccount(_0x16edcb);}else{_0x4a070d[_0x410c('0x3b')](_0x4a070d[_0x410c('0x1e')][_0x16edcb['id']],_0x16edcb);}}}return _0x4a070d[_0x410c('0x1e')];};};Realtime[_0x410c('0x3a')][_0x410c('0x48')]=function(){var _0x1798d0=this;return function(_0x430dde){if(_0x430dde){freeIsNotKey(_0x430dde,_0x1798d0['freshdeskAccounts'],'id');for(var _0x2f96e9=0x0,_0x244b65={},_0x32e9ed={};_0x2f96e9<_0x430dde[_0x410c('0x3d')];_0x2f96e9+=0x1){_0x244b65=_0x430dde[_0x2f96e9];if(_[_0x410c('0x40')](_0x1798d0[_0x410c('0x1f')][_0x244b65['id']])){_0x1798d0[_0x410c('0x1f')][_0x244b65['id']]=new FreshdeskAccount(_0x244b65);}else{_0x1798d0[_0x410c('0x3b')](_0x1798d0[_0x410c('0x1f')][_0x244b65['id']],_0x244b65);}}}return _0x1798d0[_0x410c('0x1f')];};};Realtime[_0x410c('0x3a')][_0x410c('0x49')]=function(){var _0x3182ce=this;return function(_0x3a37b2){if(_0x3a37b2){freeIsNotKey(_0x3a37b2,_0x3182ce['zohoAccounts'],'id');for(var _0x6689d6=0x0,_0x2c98b4={},_0x576a83={};_0x6689d6<_0x3a37b2[_0x410c('0x3d')];_0x6689d6+=0x1){_0x2c98b4=_0x3a37b2[_0x6689d6];if(_[_0x410c('0x40')](_0x3182ce[_0x410c('0x20')][_0x2c98b4['id']])){_0x3182ce['zohoAccounts'][_0x2c98b4['id']]=new ZohoAccount(_0x2c98b4);}else{_0x3182ce[_0x410c('0x3b')](_0x3182ce['zohoAccounts'][_0x2c98b4['id']],_0x2c98b4);}}}return _0x3182ce[_0x410c('0x20')];};};Realtime['prototype'][_0x410c('0x4a')]=function(){var _0x40ca82=this;return function(_0x24f090){if(_0x24f090){freeIsNotKey(_0x24f090,_0x40ca82[_0x410c('0x4b')],'id');for(var _0x439d83=0x0,_0x1f8ca8={},_0x41effb={};_0x439d83<_0x24f090[_0x410c('0x3d')];_0x439d83+=0x1){_0x1f8ca8=_0x24f090[_0x439d83];if(_[_0x410c('0x40')](_0x40ca82[_0x410c('0x4b')][_0x1f8ca8['id']])){_0x40ca82['deskAccounts'][_0x1f8ca8['id']]=new DeskAccount(_0x1f8ca8);}else{_0x40ca82[_0x410c('0x3b')](_0x40ca82[_0x410c('0x4b')][_0x1f8ca8['id']],_0x1f8ca8);}}}return _0x40ca82[_0x410c('0x4b')];};};Realtime[_0x410c('0x3a')]['initSugarcrmAccounts']=function(){var _0x509fd5=this;return function(_0x599cd7){if(_0x599cd7){freeIsNotKey(_0x599cd7,_0x509fd5[_0x410c('0x4c')],'id');for(var _0x2abf7a=0x0,_0x2a95f2={},_0x540e7b={};_0x2abf7a<_0x599cd7[_0x410c('0x3d')];_0x2abf7a+=0x1){_0x2a95f2=_0x599cd7[_0x2abf7a];if(_['isUndefined'](_0x509fd5[_0x410c('0x4c')][_0x2a95f2['id']])){_0x509fd5[_0x410c('0x4c')][_0x2a95f2['id']]=new SugarcrmAccount(_0x2a95f2);}else{_0x509fd5[_0x410c('0x3b')](_0x509fd5['sugarcrmAccounts'][_0x2a95f2['id']],_0x2a95f2);}}}return _0x509fd5[_0x410c('0x4c')];};};Realtime[_0x410c('0x3a')][_0x410c('0x4d')]=function(){var _0xca4991=this;return function(_0x4dbb0e){if(_0x4dbb0e){freeIsNotKey(_0x4dbb0e,_0xca4991[_0x410c('0x21')],'id');for(var _0x126bdc=0x0,_0xd99000={},_0x5adda7={};_0x126bdc<_0x4dbb0e[_0x410c('0x3d')];_0x126bdc+=0x1){_0xd99000=_0x4dbb0e[_0x126bdc];if(_[_0x410c('0x40')](_0xca4991[_0x410c('0x21')][_0xd99000['id']])){_0xca4991['vtigerAccounts'][_0xd99000['id']]=new VtigerAccount(_0xd99000);}else{_0xca4991[_0x410c('0x3b')](_0xca4991[_0x410c('0x21')][_0xd99000['id']],_0xd99000);}}}return _0xca4991['vtigerAccounts'];};};Realtime[_0x410c('0x3a')][_0x410c('0x4e')]=function(){var _0x77f46f=this;return function(_0x2fa08a){if(_0x2fa08a){freeIsNotKey(_0x2fa08a,_0x77f46f[_0x410c('0x22')],'id');for(var _0x192492=0x0,_0x127dc4={},_0x1fde0f={};_0x192492<_0x2fa08a[_0x410c('0x3d')];_0x192492+=0x1){_0x127dc4=_0x2fa08a[_0x192492];if(_[_0x410c('0x40')](_0x77f46f[_0x410c('0x22')][_0x127dc4['id']])){_0x77f46f['servicenowAccounts'][_0x127dc4['id']]=new ServicenowAccount(_0x127dc4);}else{_0x77f46f[_0x410c('0x3b')](_0x77f46f[_0x410c('0x22')][_0x127dc4['id']],_0x127dc4);}}}return _0x77f46f[_0x410c('0x22')];};};Realtime['prototype'][_0x410c('0x4f')]=function(){var _0x4b74e3=this;return function(_0x196755){if(_0x196755){freeIsNotKey(_0x196755,_0x4b74e3['dynamics365Accounts'],'id');for(var _0x2bd8f0=0x0,_0xc19dea={},_0x219631={};_0x2bd8f0<_0x196755[_0x410c('0x3d')];_0x2bd8f0+=0x1){_0xc19dea=_0x196755[_0x2bd8f0];if(_[_0x410c('0x40')](_0x4b74e3[_0x410c('0x23')][_0xc19dea['id']])){_0x4b74e3[_0x410c('0x23')][_0xc19dea['id']]=new Dynamics365Account(_0xc19dea);}else{_0x4b74e3['mergeFromDatabase'](_0x4b74e3['dynamics365Accounts'][_0xc19dea['id']],_0xc19dea);}}}return _0x4b74e3['dynamics365Accounts'];};};Realtime[_0x410c('0x3a')]['initVoiceQueueHopperHistory']=function(){var _0x422264=this;return function(_0x577917){for(var _0x5615b7=0x0;_0x5615b7<_0x577917['length'];_0x5615b7+=0x1){_[_0x410c('0x50')](_0x422264[_0x410c('0x16')][_0x577917[_0x5615b7][_0x410c('0x27')]],_0x577917[_0x5615b7]);}return _0x422264[_0x410c('0x16')];};};Realtime['prototype'][_0x410c('0x51')]=function(){var _0x518e13=this;return function(_0x23675e){clearVoiceQueues(_0x518e13['voiceQueues']);if(_0x23675e){_0x23675e=_[_0x410c('0x52')](_0x23675e,_0x410c('0x53'));for(var _0x486a49 in _0x23675e){if(_0x23675e[_0x410c('0x29')](_0x486a49)){var _0x10649d={};for(var _0x35ceb4=0x0;_0x35ceb4<_0x23675e[_0x486a49][_0x410c('0x3d')];_0x35ceb4+=0x1){var _0x1aa2ec=_0x23675e[_0x486a49][_0x35ceb4][_0x410c('0x54')];if(_0x518e13[_0x410c('0x16')][_0x1aa2ec]){if(_0x23675e[_0x486a49][_0x35ceb4][_0x410c('0x55')]){_0x518e13[_0x410c('0x16')][_0x1aa2ec]['unmanaged']+=0x1;}if(_0x23675e[_0x486a49][_0x35ceb4][_0x410c('0x56')]){_0x518e13[_0x410c('0x16')][_0x1aa2ec][_0x410c('0x31')]+=0x1;}_0x518e13[_0x410c('0x16')][_0x1aa2ec]['sumHoldTime']+=moment(_0x23675e[_0x486a49][_0x35ceb4]['queuecallerleaveAt'])[_0x410c('0x57')](moment(_0x23675e[_0x486a49][_0x35ceb4][_0x410c('0x58')]),'seconds')||0x0;if(_0x35ceb4===_0x23675e[_0x486a49][_0x410c('0x3d')]-0x1){_0x518e13[_0x410c('0x16')][_0x1aa2ec][_0x410c('0x2d')]+=moment(_0x23675e[_0x486a49][_0x35ceb4][_0x410c('0x59')]||_0x23675e[_0x486a49][_0x35ceb4][_0x410c('0x5a')]||_0x23675e[_0x486a49][_0x35ceb4][_0x410c('0x5b')])['diff'](moment(_0x23675e[_0x486a49][_0x35ceb4][_0x410c('0x58')]),_0x410c('0x5c'))||0x0;_0x518e13[_0x410c('0x16')][_0x1aa2ec]['total']+=0x1;if(_0x23675e[_0x486a49][_0x35ceb4][_0x410c('0x5d')]){_0x518e13['voiceQueues'][_0x1aa2ec][_0x410c('0x2b')]+=0x1;_0x518e13[_0x410c('0x16')][_0x1aa2ec][_0x410c('0x2e')]+=moment(_0x23675e[_0x486a49][_0x35ceb4]['queuecallercompleteAt'])['diff'](moment(_0x23675e[_0x486a49][_0x35ceb4][_0x410c('0x5e')]),_0x410c('0x5c'))||0x0;}}else{_0x518e13[_0x410c('0x16')][_0x1aa2ec][_0x410c('0x2d')]+=_0x518e13[_0x410c('0x16')][_0x1aa2ec]['sumHoldTime']||0x0;}}}}}}return _0x518e13['voiceQueues'];};};Realtime[_0x410c('0x3a')]['initVoiceCallReports']=function(){var _0xa0b723=this;return function(_0xf57c13){clearVoiceCallReports(_0xa0b723['outbound']);if(_0xf57c13){for(var _0x52ec12=0x0;_0x52ec12<_0xf57c13['length'];_0x52ec12+=0x1){_0xa0b723[_0x410c('0x5f')][_0x410c('0x2a')]+=0x1;_0xa0b723[_0x410c('0x5f')][_0x410c('0x2d')]+=_0xf57c13[_0x52ec12][_0x410c('0x60')];if(_0xf57c13[_0x52ec12][_0x410c('0x61')]===_0x410c('0x62')){_0xa0b723[_0x410c('0x5f')][_0x410c('0x2b')]+=0x1;_0xa0b723[_0x410c('0x5f')]['sumHoldTime']+=_0xf57c13[_0x52ec12]['duration']-_0xf57c13[_0x52ec12]['billableseconds']||0x0;_0xa0b723[_0x410c('0x5f')][_0x410c('0x2e')]+=_0xf57c13[_0x52ec12][_0x410c('0x63')];}}}return _0xa0b723['outbound'];};};Realtime[_0x410c('0x3a')][_0x410c('0x64')]=function(){var _0x2d24cf=this;return function(_0x49e464){if(_0x49e464){freeIsNotKey(_0x49e464,_0x2d24cf['campaigns'],_0x410c('0x27'));for(var _0x1cd3d3=0x0,_0x4833d4={};_0x1cd3d3<_0x49e464[_0x410c('0x3d')];_0x1cd3d3+=0x1){_0x4833d4=_0x49e464[_0x1cd3d3];if(_['isUndefined'](_0x2d24cf[_0x410c('0x18')][_0x4833d4[_0x410c('0x27')]])){_0x2d24cf[_0x410c('0x18')][_0x4833d4[_0x410c('0x27')]]=new Campaign(_0x4833d4);}else{_0x2d24cf[_0x410c('0x3b')](_0x2d24cf['campaigns'][_0x4833d4[_0x410c('0x27')]],_0x4833d4);}}}return _0x2d24cf['campaigns'];};};Realtime[_0x410c('0x3a')][_0x410c('0x65')]=function(){var _0x1e9c0e=this;return function(_0x21fbcd){if(_0x21fbcd){freeIsNotKey(_0x21fbcd,_0x1e9c0e[_0x410c('0x19')],'id');for(var _0x110eac=0x0,_0xaf8ef0={};_0x110eac<_0x21fbcd[_0x410c('0x3d')];_0x110eac+=0x1){_0xaf8ef0=_0x21fbcd[_0x110eac];if(_[_0x410c('0x40')](_0x1e9c0e[_0x410c('0x19')][_0xaf8ef0['id']])){_0x1e9c0e[_0x410c('0x19')][_0xaf8ef0['id']]=new VoiceExtension(_0xaf8ef0);}else{_0x1e9c0e[_0x410c('0x3b')](_0x1e9c0e[_0x410c('0x19')][_0xaf8ef0['id']],_0xaf8ef0);}}}return _0x1e9c0e[_0x410c('0x19')];};};Realtime['prototype'][_0x410c('0x66')]=function(){var _0x2d1710=this;return function(_0x48130a){clearCampaigns(_0x2d1710[_0x410c('0x18')]);for(var _0x209d58=0x0;_0x209d58<_0x48130a['length'];_0x209d58+=0x1){_[_0x410c('0x50')](_0x2d1710[_0x410c('0x18')][_0x48130a[_0x209d58][_0x410c('0x27')]],_0x48130a[_0x209d58]);}return _0x2d1710[_0x410c('0x18')];};};Realtime['prototype'][_0x410c('0x67')]=function(){var _0x3d7faf=this;return function(_0x2b2c2f){if(_0x2b2c2f){freeIsNotKey(_0x2b2c2f,_0x3d7faf[_0x410c('0x24')],'id');for(var _0x32fad0=0x0,_0x537f0e={},_0x52484d={};_0x32fad0<_0x2b2c2f[_0x410c('0x3d')];_0x32fad0+=0x1){_0x537f0e=_0x2b2c2f[_0x32fad0];if(_['isUndefined'](_0x3d7faf[_0x410c('0x24')][_0x537f0e['id']])){_0x3d7faf[_0x410c('0x24')][_0x537f0e['id']]=new FaxAccount(_0x537f0e);}else{_0x3d7faf[_0x410c('0x3b')](_0x3d7faf[_0x410c('0x24')][_0x537f0e['id']],_0x537f0e);}}}return _0x3d7faf[_0x410c('0x24')];};};module[_0x410c('0x68')]=Realtime; \ No newline at end of file +var _0xf322=['initFaxAccounts','faxAccounts','exports','bluebird','util','moment','../model/agent','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','templates','voiceExtensions','channels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','answered','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','length','isUndefined','mergeFromDatabase','initTrunks','initTriggers','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','queue','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','initVoiceExtensions','initCampaignHopperHistory'];(function(_0x29d2b8,_0xa6fb43){var _0xc50e0c=function(_0x32ff67){while(--_0x32ff67){_0x29d2b8['push'](_0x29d2b8['shift']());}};_0xc50e0c(++_0xa6fb43);}(_0xf322,0x141));var _0x2f32=function(_0x75db0,_0x6b613b){_0x75db0=_0x75db0-0x0;var _0x1bafc3=_0xf322[_0x75db0];return _0x1bafc3;};'use strict';var BPromise=require(_0x2f32('0x0'));var util=require(_0x2f32('0x1'));var _=require('lodash');var moment=require(_0x2f32('0x2'));var Agent=require(_0x2f32('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x2f32('0x4'));var VoiceQueue=require(_0x2f32('0x5'));var Trigger=require('../model/trigger');var Template=require(_0x2f32('0x6'));var Campaign=require(_0x2f32('0x7'));var VoiceExtension=require(_0x2f32('0x8'));var ZendeskAccount=require(_0x2f32('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x2f32('0xa'));var SugarcrmAccount=require(_0x2f32('0xb'));var ZohoAccount=require(_0x2f32('0xc'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x2f32('0xd'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x2f32('0xe'));var FaxAccount=require(_0x2f32('0xf'));var Realtime=function(){this[_0x2f32('0x10')]={};this[_0x2f32('0x11')]={};this[_0x2f32('0x12')]={};this[_0x2f32('0x13')]={};this[_0x2f32('0x14')]={};this['campaigns']={};this[_0x2f32('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x2f32('0x16')]={};this[_0x2f32('0x17')]={};this['queueChannels']={};this[_0x2f32('0x18')]={};this[_0x2f32('0x19')]={};this['zendeskAccounts']={};this[_0x2f32('0x1a')]={};this[_0x2f32('0x1b')]={};this['freshdeskAccounts']={};this[_0x2f32('0x1c')]={};this[_0x2f32('0x1d')]={};this[_0x2f32('0x1e')]={};this[_0x2f32('0x1f')]={};this[_0x2f32('0x20')]={};this['faxAccounts']={};};function freeIsNotKey(_0x21ee39,_0x264153,_0x18f6e2){var _0x5471f5=_[_0x2f32('0x21')](_0x21ee39,function(_0x191e1b,_0x386d64){return _0x191e1b[_0x18f6e2];});for(var _0x1b9b5a in _0x264153){if(_0x264153[_0x2f32('0x22')](_0x1b9b5a)){if(!_0x5471f5[_0x1b9b5a]){delete _0x264153[_0x1b9b5a];}}}}function freeIsNotKeySip(_0x4bf72a,_0x5c599f){var _0x3b160a=_[_0x2f32('0x21')](_0x4bf72a,function(_0x2cbf40,_0x3289da){return util[_0x2f32('0x23')](_0x2f32('0x24'),_0x2cbf40[_0x2f32('0x25')]);});for(var _0x342fb7 in _0x5c599f){if(_0x5c599f['hasOwnProperty'](_0x342fb7)){if(!_0x3b160a[_0x342fb7]){delete _0x5c599f[_0x342fb7];}}}}function freeIsNotKeyAgent(_0x387e87,_0x4731af){var _0x10818a=_[_0x2f32('0x21')](_0x387e87,function(_0x2e6cda,_0x2b8ea0){var _0x4798ff=_[_0x2f32('0x26')](_0x2e6cda[_0x2f32('0x27')])?util[_0x2f32('0x23')](_0x2f32('0x24'),_0x2e6cda['name']):_0x2e6cda[_0x2f32('0x27')];return _0x4798ff;});for(var _0x5ac29e in _0x4731af){if(_0x4731af[_0x2f32('0x22')](_0x5ac29e)){if(!_0x10818a[_0x5ac29e]){delete _0x4731af[_0x5ac29e];}}}}function clearVoiceCallReports(_0x1cba41){_0x1cba41['total']=0x0;_0x1cba41[_0x2f32('0x28')]=0x0;_0x1cba41['sumHoldTime']=0x0;_0x1cba41[_0x2f32('0x29')]=0x0;_0x1cba41[_0x2f32('0x2a')]=0x0;}function clearCampaigns(_0x54dff5){if(!_[_0x2f32('0x2b')](_0x54dff5)){for(var _0x166ee3 in _0x54dff5){if(_0x54dff5[_0x2f32('0x22')](_0x166ee3)){_0x54dff5[_0x166ee3][_0x2f32('0x2c')]=0x0;_0x54dff5[_0x166ee3][_0x2f32('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x1e31e4){if(!_[_0x2f32('0x2b')](_0x1e31e4)){for(var _0x42eb02 in _0x1e31e4){if(_0x1e31e4[_0x2f32('0x22')](_0x42eb02)){_0x1e31e4[_0x42eb02][_0x2f32('0x2e')]=0x0;_0x1e31e4[_0x42eb02][_0x2f32('0x28')]=0x0;_0x1e31e4[_0x42eb02][_0x2f32('0x2f')]=0x0;_0x1e31e4[_0x42eb02][_0x2f32('0x30')]=0x0;_0x1e31e4[_0x42eb02][_0x2f32('0x31')]=0x0;_0x1e31e4[_0x42eb02][_0x2f32('0x29')]=0x0;_0x1e31e4[_0x42eb02]['sumBillable']=0x0;_0x1e31e4[_0x42eb02][_0x2f32('0x32')]=0x0;_0x1e31e4[_0x42eb02][_0x2f32('0x33')]=0x0;_0x1e31e4[_0x42eb02]['outboundBusyCallsDay']=0x0;_0x1e31e4[_0x42eb02][_0x2f32('0x34')]=0x0;_0x1e31e4[_0x42eb02][_0x2f32('0x35')]=0x0;_0x1e31e4[_0x42eb02][_0x2f32('0x36')]=0x0;_0x1e31e4[_0x42eb02][_0x2f32('0x37')]=0x0;_0x1e31e4[_0x42eb02][_0x2f32('0x38')]=0x0;_0x1e31e4[_0x42eb02][_0x2f32('0x39')]=0x0;_0x1e31e4[_0x42eb02]['outboundOriginateFailureCallsDay']=0x0;_0x1e31e4[_0x42eb02][_0x2f32('0x3a')]=0x0;_0x1e31e4[_0x42eb02][_0x2f32('0x3b')]=0x0;_0x1e31e4[_0x42eb02][_0x2f32('0x32')]=0x0;_0x1e31e4[_0x42eb02][_0x2f32('0x3c')]=0x0;_0x1e31e4[_0x42eb02][_0x2f32('0x3d')]=!![];}}}}Realtime[_0x2f32('0x3e')]['mergeFromDatabase']=function(_0x160535,_0x40017c){for(var _0x492464 in _0x40017c){if(_0x160535[_0x2f32('0x22')](_0x492464)){_0x160535[_0x492464]=_0x40017c[_0x492464];}}};Realtime[_0x2f32('0x3e')][_0x2f32('0x3f')]=function(){var _0x1ec218=this;return function(_0x3aa162){if(_0x3aa162){freeIsNotKeyAgent(_0x3aa162,_0x1ec218[_0x2f32('0x10')]);for(var _0x3144b8=0x0,_0xa2ab67={},_0x20f62c={};_0x3144b8<_0x3aa162[_0x2f32('0x40')];_0x3144b8+=0x1){_0xa2ab67=_0x3aa162[_0x3144b8];var _0x1a64e5=_[_0x2f32('0x26')](_0xa2ab67[_0x2f32('0x27')])?util[_0x2f32('0x23')](_0x2f32('0x24'),_0xa2ab67[_0x2f32('0x25')]):_0xa2ab67[_0x2f32('0x27')];if(_[_0x2f32('0x41')](_0x1ec218[_0x2f32('0x10')][_0x1a64e5])){_0x1ec218['agents'][_0x1a64e5]=new Agent(_0xa2ab67);}else{_0x1ec218[_0x2f32('0x42')](_0x1ec218[_0x2f32('0x10')][_0x1a64e5],_0xa2ab67);}}}return _0x1ec218[_0x2f32('0x10')];};};Realtime['prototype']['initTelephones']=function(){var _0xa566b9=this;return function(_0x2d9874){if(_0x2d9874){freeIsNotKeySip(_0x2d9874,_0xa566b9[_0x2f32('0x11')]);for(var _0x2acfff=0x0,_0xecc1f8={},_0x21ebb3={};_0x2acfff<_0x2d9874['length'];_0x2acfff+=0x1){_0xecc1f8=_0x2d9874[_0x2acfff];if(_['isUndefined'](_0xa566b9[_0x2f32('0x11')][util['format'](_0x2f32('0x24'),_0xecc1f8['name'])])){_0xa566b9[_0x2f32('0x11')][util[_0x2f32('0x23')]('SIP/%s',_0xecc1f8['name'])]=new Telephone(_0xecc1f8);}else{_0xa566b9[_0x2f32('0x42')](_0xa566b9[_0x2f32('0x11')][util[_0x2f32('0x23')](_0x2f32('0x24'),_0xecc1f8['name'])],_0xecc1f8);}}}return _0xa566b9[_0x2f32('0x11')];};};Realtime[_0x2f32('0x3e')][_0x2f32('0x43')]=function(){var _0xff739e=this;return function(_0x63e7c3){if(_0x63e7c3){freeIsNotKeySip(_0x63e7c3,_0xff739e['trunks']);for(var _0x12c8cb=0x0,_0x3eb9a9={},_0xc4ed3a={};_0x12c8cb<_0x63e7c3[_0x2f32('0x40')];_0x12c8cb+=0x1){_0x3eb9a9=_0x63e7c3[_0x12c8cb];if(_[_0x2f32('0x41')](_0xff739e['trunks'][util[_0x2f32('0x23')]('SIP/%s',_0x3eb9a9[_0x2f32('0x25')])])){_0xff739e[_0x2f32('0x12')][util['format'](_0x2f32('0x24'),_0x3eb9a9[_0x2f32('0x25')])]=new Trunk(_0x3eb9a9);}else{_0xff739e[_0x2f32('0x42')](_0xff739e[_0x2f32('0x12')][util[_0x2f32('0x23')](_0x2f32('0x24'),_0x3eb9a9[_0x2f32('0x25')])],_0x3eb9a9);}}}return _0xff739e[_0x2f32('0x12')];};};Realtime[_0x2f32('0x3e')]['initVoiceQueues']=function(){var _0x19c675=this;return function(_0x43dc28){if(_0x43dc28){freeIsNotKey(_0x43dc28,_0x19c675[_0x2f32('0x13')],'name');for(var _0x12bff4=0x0,_0x1f0f7c={},_0x153179={};_0x12bff4<_0x43dc28[_0x2f32('0x40')];_0x12bff4+=0x1){_0x1f0f7c=_0x43dc28[_0x12bff4];if(_[_0x2f32('0x41')](_0x19c675['voiceQueues'][_0x1f0f7c[_0x2f32('0x25')]])){_0x19c675[_0x2f32('0x13')][_0x1f0f7c['name']]=new VoiceQueue(_0x1f0f7c);}else{_0x19c675[_0x2f32('0x42')](_0x19c675['voiceQueues'][_0x1f0f7c[_0x2f32('0x25')]],_0x1f0f7c);}}}return _0x19c675['voiceQueues'];};};Realtime[_0x2f32('0x3e')][_0x2f32('0x44')]=function(){var _0x175419=this;return function(_0x1898c5){if(_0x1898c5){freeIsNotKey(_0x1898c5,_0x175419[_0x2f32('0x14')],'id');for(var _0x554bb6=0x0,_0x2584f8={},_0x3810f6={};_0x554bb6<_0x1898c5['length'];_0x554bb6+=0x1){_0x2584f8=_0x1898c5[_0x554bb6];if(_['isUndefined'](_0x175419[_0x2f32('0x14')][_0x2584f8['id']])){_0x175419[_0x2f32('0x14')][_0x2584f8['id']]=new Trigger(_0x2584f8);}else{_0x175419['mergeFromDatabase'](_0x175419[_0x2f32('0x14')][_0x2584f8['id']],_0x2584f8);}}}return _0x175419[_0x2f32('0x14')];};};Realtime[_0x2f32('0x3e')][_0x2f32('0x45')]=function(){var _0x3dc280=this;return function(_0x3ce16c){if(_0x3ce16c){freeIsNotKey(_0x3ce16c,_0x3dc280[_0x2f32('0x15')],'id');for(var _0x56d6e7=0x0,_0x2a6080={},_0x52faef={};_0x56d6e7<_0x3ce16c[_0x2f32('0x40')];_0x56d6e7+=0x1){_0x2a6080=_0x3ce16c[_0x56d6e7];if(_[_0x2f32('0x41')](_0x3dc280[_0x2f32('0x15')][_0x2a6080['id']])){_0x3dc280[_0x2f32('0x15')][_0x2a6080['id']]=new Template(_0x2a6080);}else{_0x3dc280[_0x2f32('0x42')](_0x3dc280['templates'][_0x2a6080['id']],_0x2a6080);}}}return _0x3dc280['templates'];};};Realtime[_0x2f32('0x3e')][_0x2f32('0x46')]=function(){var _0x25f09f=this;return function(_0x1289c2){if(_0x1289c2){freeIsNotKey(_0x1289c2,_0x25f09f[_0x2f32('0x47')],'id');for(var _0x3c85a4=0x0,_0x46fb67={},_0x413421={};_0x3c85a4<_0x1289c2[_0x2f32('0x40')];_0x3c85a4+=0x1){_0x46fb67=_0x1289c2[_0x3c85a4];if(_[_0x2f32('0x41')](_0x25f09f[_0x2f32('0x47')][_0x46fb67['id']])){_0x25f09f['zendeskAccounts'][_0x46fb67['id']]=new ZendeskAccount(_0x46fb67);}else{_0x25f09f['mergeFromDatabase'](_0x25f09f[_0x2f32('0x47')][_0x46fb67['id']],_0x46fb67);}}}return _0x25f09f[_0x2f32('0x47')];};};Realtime[_0x2f32('0x3e')][_0x2f32('0x48')]=function(){var _0x3cb7dc=this;return function(_0x1e46fc){if(_0x1e46fc){freeIsNotKey(_0x1e46fc,_0x3cb7dc[_0x2f32('0x1a')],'id');for(var _0x5761e4=0x0,_0x5d52d9={},_0x5b4d7b={};_0x5761e4<_0x1e46fc[_0x2f32('0x40')];_0x5761e4+=0x1){_0x5d52d9=_0x1e46fc[_0x5761e4];if(_[_0x2f32('0x41')](_0x3cb7dc[_0x2f32('0x1a')][_0x5d52d9['id']])){_0x3cb7dc[_0x2f32('0x1a')][_0x5d52d9['id']]=new SalesforceAccount(_0x5d52d9);}else{_0x3cb7dc['mergeFromDatabase'](_0x3cb7dc[_0x2f32('0x1a')][_0x5d52d9['id']],_0x5d52d9);}}}return _0x3cb7dc[_0x2f32('0x1a')];};};Realtime['prototype'][_0x2f32('0x49')]=function(){var _0xebdb8c=this;return function(_0x53e256){if(_0x53e256){freeIsNotKey(_0x53e256,_0xebdb8c[_0x2f32('0x4a')],'id');for(var _0x89bd04=0x0,_0x5cc5d9={},_0x2b1cd7={};_0x89bd04<_0x53e256[_0x2f32('0x40')];_0x89bd04+=0x1){_0x5cc5d9=_0x53e256[_0x89bd04];if(_[_0x2f32('0x41')](_0xebdb8c['freshdeskAccounts'][_0x5cc5d9['id']])){_0xebdb8c[_0x2f32('0x4a')][_0x5cc5d9['id']]=new FreshdeskAccount(_0x5cc5d9);}else{_0xebdb8c[_0x2f32('0x42')](_0xebdb8c[_0x2f32('0x4a')][_0x5cc5d9['id']],_0x5cc5d9);}}}return _0xebdb8c[_0x2f32('0x4a')];};};Realtime[_0x2f32('0x3e')][_0x2f32('0x4b')]=function(){var _0x5221ac=this;return function(_0x1ee19c){if(_0x1ee19c){freeIsNotKey(_0x1ee19c,_0x5221ac[_0x2f32('0x1c')],'id');for(var _0x4bbeda=0x0,_0x58fe01={},_0x1565b8={};_0x4bbeda<_0x1ee19c['length'];_0x4bbeda+=0x1){_0x58fe01=_0x1ee19c[_0x4bbeda];if(_[_0x2f32('0x41')](_0x5221ac['zohoAccounts'][_0x58fe01['id']])){_0x5221ac[_0x2f32('0x1c')][_0x58fe01['id']]=new ZohoAccount(_0x58fe01);}else{_0x5221ac['mergeFromDatabase'](_0x5221ac[_0x2f32('0x1c')][_0x58fe01['id']],_0x58fe01);}}}return _0x5221ac[_0x2f32('0x1c')];};};Realtime[_0x2f32('0x3e')][_0x2f32('0x4c')]=function(){var _0xfc4898=this;return function(_0x48b52e){if(_0x48b52e){freeIsNotKey(_0x48b52e,_0xfc4898[_0x2f32('0x1d')],'id');for(var _0x3fcba8=0x0,_0x2b45cc={},_0x6874d3={};_0x3fcba8<_0x48b52e['length'];_0x3fcba8+=0x1){_0x2b45cc=_0x48b52e[_0x3fcba8];if(_[_0x2f32('0x41')](_0xfc4898[_0x2f32('0x1d')][_0x2b45cc['id']])){_0xfc4898['deskAccounts'][_0x2b45cc['id']]=new DeskAccount(_0x2b45cc);}else{_0xfc4898['mergeFromDatabase'](_0xfc4898[_0x2f32('0x1d')][_0x2b45cc['id']],_0x2b45cc);}}}return _0xfc4898[_0x2f32('0x1d')];};};Realtime['prototype']['initSugarcrmAccounts']=function(){var _0x24d6db=this;return function(_0x22cacd){if(_0x22cacd){freeIsNotKey(_0x22cacd,_0x24d6db[_0x2f32('0x1b')],'id');for(var _0x14cbe8=0x0,_0xccacb0={},_0x46fabd={};_0x14cbe8<_0x22cacd['length'];_0x14cbe8+=0x1){_0xccacb0=_0x22cacd[_0x14cbe8];if(_[_0x2f32('0x41')](_0x24d6db[_0x2f32('0x1b')][_0xccacb0['id']])){_0x24d6db[_0x2f32('0x1b')][_0xccacb0['id']]=new SugarcrmAccount(_0xccacb0);}else{_0x24d6db[_0x2f32('0x42')](_0x24d6db[_0x2f32('0x1b')][_0xccacb0['id']],_0xccacb0);}}}return _0x24d6db[_0x2f32('0x1b')];};};Realtime[_0x2f32('0x3e')][_0x2f32('0x4d')]=function(){var _0x4e9ae2=this;return function(_0x3927fa){if(_0x3927fa){freeIsNotKey(_0x3927fa,_0x4e9ae2[_0x2f32('0x1e')],'id');for(var _0x1fd5ca=0x0,_0x5deb6a={},_0x34ddf6={};_0x1fd5ca<_0x3927fa[_0x2f32('0x40')];_0x1fd5ca+=0x1){_0x5deb6a=_0x3927fa[_0x1fd5ca];if(_[_0x2f32('0x41')](_0x4e9ae2['vtigerAccounts'][_0x5deb6a['id']])){_0x4e9ae2['vtigerAccounts'][_0x5deb6a['id']]=new VtigerAccount(_0x5deb6a);}else{_0x4e9ae2[_0x2f32('0x42')](_0x4e9ae2[_0x2f32('0x1e')][_0x5deb6a['id']],_0x5deb6a);}}}return _0x4e9ae2['vtigerAccounts'];};};Realtime[_0x2f32('0x3e')][_0x2f32('0x4e')]=function(){var _0x42a623=this;return function(_0xfcaa21){if(_0xfcaa21){freeIsNotKey(_0xfcaa21,_0x42a623[_0x2f32('0x1f')],'id');for(var _0x786325=0x0,_0x15eff7={},_0x5a006e={};_0x786325<_0xfcaa21[_0x2f32('0x40')];_0x786325+=0x1){_0x15eff7=_0xfcaa21[_0x786325];if(_[_0x2f32('0x41')](_0x42a623[_0x2f32('0x1f')][_0x15eff7['id']])){_0x42a623[_0x2f32('0x1f')][_0x15eff7['id']]=new ServicenowAccount(_0x15eff7);}else{_0x42a623[_0x2f32('0x42')](_0x42a623[_0x2f32('0x1f')][_0x15eff7['id']],_0x15eff7);}}}return _0x42a623['servicenowAccounts'];};};Realtime[_0x2f32('0x3e')][_0x2f32('0x4f')]=function(){var _0x2e8da6=this;return function(_0x12b612){if(_0x12b612){freeIsNotKey(_0x12b612,_0x2e8da6[_0x2f32('0x20')],'id');for(var _0x2857c0=0x0,_0x47fe35={},_0x35d198={};_0x2857c0<_0x12b612['length'];_0x2857c0+=0x1){_0x47fe35=_0x12b612[_0x2857c0];if(_[_0x2f32('0x41')](_0x2e8da6[_0x2f32('0x20')][_0x47fe35['id']])){_0x2e8da6[_0x2f32('0x20')][_0x47fe35['id']]=new Dynamics365Account(_0x47fe35);}else{_0x2e8da6[_0x2f32('0x42')](_0x2e8da6[_0x2f32('0x20')][_0x47fe35['id']],_0x47fe35);}}}return _0x2e8da6[_0x2f32('0x20')];};};Realtime['prototype'][_0x2f32('0x50')]=function(){var _0x5e377e=this;return function(_0x3cb990){for(var _0x3927d3=0x0;_0x3927d3<_0x3cb990[_0x2f32('0x40')];_0x3927d3+=0x1){_[_0x2f32('0x51')](_0x5e377e[_0x2f32('0x13')][_0x3cb990[_0x3927d3][_0x2f32('0x25')]],_0x3cb990[_0x3927d3]);}return _0x5e377e[_0x2f32('0x13')];};};Realtime[_0x2f32('0x3e')][_0x2f32('0x52')]=function(){var _0x588048=this;return function(_0x246eea){clearVoiceQueues(_0x588048[_0x2f32('0x13')]);if(_0x246eea){_0x246eea=_['groupBy'](_0x246eea,_0x2f32('0x53'));for(var _0x494aa0 in _0x246eea){if(_0x246eea[_0x2f32('0x22')](_0x494aa0)){var _0x3c6e9e={};for(var _0x5514be=0x0;_0x5514be<_0x246eea[_0x494aa0]['length'];_0x5514be+=0x1){var _0x3c7b39=_0x246eea[_0x494aa0][_0x5514be][_0x2f32('0x54')];if(_0x588048['voiceQueues'][_0x3c7b39]){if(_0x246eea[_0x494aa0][_0x5514be]['queuecallerexit']){_0x588048[_0x2f32('0x13')][_0x3c7b39][_0x2f32('0x2f')]+=0x1;}if(_0x246eea[_0x494aa0][_0x5514be]['queuecallerabandon']){_0x588048[_0x2f32('0x13')][_0x3c7b39][_0x2f32('0x30')]+=0x1;}_0x588048[_0x2f32('0x13')][_0x3c7b39][_0x2f32('0x31')]+=moment(_0x246eea[_0x494aa0][_0x5514be][_0x2f32('0x55')])[_0x2f32('0x56')](moment(_0x246eea[_0x494aa0][_0x5514be][_0x2f32('0x57')]),_0x2f32('0x58'))||0x0;if(_0x5514be===_0x246eea[_0x494aa0][_0x2f32('0x40')]-0x1){_0x588048[_0x2f32('0x13')][_0x3c7b39][_0x2f32('0x29')]+=moment(_0x246eea[_0x494aa0][_0x5514be][_0x2f32('0x59')]||_0x246eea[_0x494aa0][_0x5514be][_0x2f32('0x5a')]||_0x246eea[_0x494aa0][_0x5514be][_0x2f32('0x5b')])[_0x2f32('0x56')](moment(_0x246eea[_0x494aa0][_0x5514be][_0x2f32('0x57')]),_0x2f32('0x58'))||0x0;_0x588048[_0x2f32('0x13')][_0x3c7b39]['total']+=0x1;if(_0x246eea[_0x494aa0][_0x5514be][_0x2f32('0x5c')]){_0x588048['voiceQueues'][_0x3c7b39]['answered']+=0x1;_0x588048[_0x2f32('0x13')][_0x3c7b39][_0x2f32('0x2a')]+=moment(_0x246eea[_0x494aa0][_0x5514be]['queuecallercompleteAt'])[_0x2f32('0x56')](moment(_0x246eea[_0x494aa0][_0x5514be][_0x2f32('0x55')]),'seconds')||0x0;}}else{_0x588048['voiceQueues'][_0x3c7b39]['sumDuration']+=_0x588048['voiceQueues'][_0x3c7b39]['sumHoldTime']||0x0;}}}}}}return _0x588048[_0x2f32('0x13')];};};Realtime[_0x2f32('0x3e')][_0x2f32('0x5d')]=function(){var _0x7a8716=this;return function(_0x66d188){clearVoiceCallReports(_0x7a8716[_0x2f32('0x5e')]);if(_0x66d188){for(var _0x87e8f4=0x0;_0x87e8f4<_0x66d188[_0x2f32('0x40')];_0x87e8f4+=0x1){_0x7a8716[_0x2f32('0x5e')][_0x2f32('0x2e')]+=0x1;_0x7a8716[_0x2f32('0x5e')][_0x2f32('0x29')]+=_0x66d188[_0x87e8f4][_0x2f32('0x5f')];if(_0x66d188[_0x87e8f4][_0x2f32('0x60')]===_0x2f32('0x61')){_0x7a8716[_0x2f32('0x5e')][_0x2f32('0x28')]+=0x1;_0x7a8716[_0x2f32('0x5e')][_0x2f32('0x31')]+=_0x66d188[_0x87e8f4][_0x2f32('0x5f')]-_0x66d188[_0x87e8f4]['billableseconds']||0x0;_0x7a8716['outbound']['sumBillable']+=_0x66d188[_0x87e8f4][_0x2f32('0x62')];}}}return _0x7a8716['outbound'];};};Realtime['prototype'][_0x2f32('0x63')]=function(){var _0x40ad3a=this;return function(_0x462b3f){if(_0x462b3f){freeIsNotKey(_0x462b3f,_0x40ad3a[_0x2f32('0x64')],_0x2f32('0x25'));for(var _0x39cd71=0x0,_0xc21450={};_0x39cd71<_0x462b3f['length'];_0x39cd71+=0x1){_0xc21450=_0x462b3f[_0x39cd71];if(_[_0x2f32('0x41')](_0x40ad3a['campaigns'][_0xc21450['name']])){_0x40ad3a['campaigns'][_0xc21450[_0x2f32('0x25')]]=new Campaign(_0xc21450);}else{_0x40ad3a[_0x2f32('0x42')](_0x40ad3a[_0x2f32('0x64')][_0xc21450[_0x2f32('0x25')]],_0xc21450);}}}return _0x40ad3a[_0x2f32('0x64')];};};Realtime[_0x2f32('0x3e')][_0x2f32('0x65')]=function(){var _0x424da7=this;return function(_0x12665c){if(_0x12665c){freeIsNotKey(_0x12665c,_0x424da7[_0x2f32('0x16')],'id');for(var _0x40de70=0x0,_0x37186d={};_0x40de70<_0x12665c['length'];_0x40de70+=0x1){_0x37186d=_0x12665c[_0x40de70];if(_[_0x2f32('0x41')](_0x424da7[_0x2f32('0x16')][_0x37186d['id']])){_0x424da7[_0x2f32('0x16')][_0x37186d['id']]=new VoiceExtension(_0x37186d);}else{_0x424da7[_0x2f32('0x42')](_0x424da7['voiceExtensions'][_0x37186d['id']],_0x37186d);}}}return _0x424da7[_0x2f32('0x16')];};};Realtime[_0x2f32('0x3e')][_0x2f32('0x66')]=function(){var _0xcb04d8=this;return function(_0x384ecf){clearCampaigns(_0xcb04d8[_0x2f32('0x64')]);for(var _0x5f2f26=0x0;_0x5f2f26<_0x384ecf[_0x2f32('0x40')];_0x5f2f26+=0x1){_[_0x2f32('0x51')](_0xcb04d8[_0x2f32('0x64')][_0x384ecf[_0x5f2f26][_0x2f32('0x25')]],_0x384ecf[_0x5f2f26]);}return _0xcb04d8['campaigns'];};};Realtime[_0x2f32('0x3e')][_0x2f32('0x67')]=function(){var _0x54d0e1=this;return function(_0x5a553a){if(_0x5a553a){freeIsNotKey(_0x5a553a,_0x54d0e1[_0x2f32('0x68')],'id');for(var _0x224122=0x0,_0x2aeea8={},_0x19f590={};_0x224122<_0x5a553a[_0x2f32('0x40')];_0x224122+=0x1){_0x2aeea8=_0x5a553a[_0x224122];if(_['isUndefined'](_0x54d0e1[_0x2f32('0x68')][_0x2aeea8['id']])){_0x54d0e1['faxAccounts'][_0x2aeea8['id']]=new FaxAccount(_0x2aeea8);}else{_0x54d0e1[_0x2f32('0x42')](_0x54d0e1[_0x2f32('0x68')][_0x2aeea8['id']],_0x2aeea8);}}}return _0x54d0e1['faxAccounts'];};};module[_0x2f32('0x69')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index be41fff..f7a9e31 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 _0x9796=['disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','monitor','monitorFilename','monitors','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','startsWith','Local','substring','indexOf','phone','lastIndexOf','voiceDialReport','blindTransfer','attendedTransfer','exports','bluebird','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','findAgent','find','accountcode','name','interface','voiceQueueReport','length','connectedlinenum','lastAssignedTo','isNil','format','SIP/%s','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','voiceCallReport','destination','exten','dialer','lastapplication','lastdata','queue','from-voip-provider','callerid','context','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel'];(function(_0x34ab65,_0x356d84){var _0x31532c=function(_0x23761b){while(--_0x23761b){_0x34ab65['push'](_0x34ab65['shift']());}};_0x31532c(++_0x356d84);}(_0x9796,0x1ba));var _0x6979=function(_0x5e0ecb,_0x548141){_0x5e0ecb=_0x5e0ecb-0x0;var _0x30b135=_0x9796[_0x5e0ecb];return _0x30b135;};'use strict';var BPromise=require(_0x6979('0x0'));var _=require('lodash');var moment=require('moment');var util=require('util');var logger=require('../../../config/logger')('ami');var ami=require('../ami');var RpcVoiceAgentReport=require(_0x6979('0x1'));var RpcVoiceCallReport=require(_0x6979('0x2'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x6979('0x3'));var RpcVoiceQueueReport=require(_0x6979('0x4'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x6979('0x5'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x6979('0x6'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x6979('0x7'));var UserReport=require(_0x6979('0x8'));function Report(_0x2e9a1b){this[_0x6979('0x9')]=_0x2e9a1b;this['agents']=_0x2e9a1b[_0x6979('0xa')];this[_0x6979('0xb')]=_0x2e9a1b[_0x6979('0xb')];}Report[_0x6979('0xc')][_0x6979('0xd')]=function(_0x3134c5){var _0xddeae6=new VoiceQueueReport(this[_0x6979('0x9')]);var _0x5c2dc9=new VoiceAgentReport(this[_0x6979('0x9')]);var _0x457a7d=new VoiceDialReport(this[_0x6979('0x9')]);var _0x30149a=new VoiceCallReport(this[_0x6979('0x9')]);var _0x4fa38b=new UserReport(this[_0x6979('0x9')]);};Report[_0x6979('0xc')][_0x6979('0xe')]=function(_0x579313){var _0x3f716f=undefined;_0x3f716f=_[_0x6979('0xf')](this[_0x6979('0xa')],function(_0x1df827){return _0x1df827[_0x6979('0x10')]==_0x579313||_0x1df827[_0x6979('0x11')]==_0x579313;});if(_['isNil'](_0x3f716f)){var _0x5b00d1=_[_0x6979('0xf')](this[_0x6979('0xb')],function(_0x320f83){return _0x320f83['accountcode']==_0x579313||_0x320f83[_0x6979('0x11')]==_0x579313;});if(_0x5b00d1){_0x3f716f=_[_0x6979('0xf')](this[_0x6979('0xa')],function(_0x348245){return _0x348245[_0x6979('0x12')]==util['format']('SIP/%s',_0x5b00d1['name']);});}}return _0x3f716f;};Report['prototype'][_0x6979('0x13')]=function(_0xa8bbd4){for(var _0x530c53=0x0;_0x530c53<_0xa8bbd4[_0x6979('0x14')];_0x530c53+=0x1){var _0x414b76=this[_0x6979('0xe')](_0xa8bbd4[_0x530c53][_0x6979('0x15')]);if(_0x414b76){_0xa8bbd4[_0x530c53][_0x6979('0x10')]=_0x414b76[_0x6979('0x10')];_0xa8bbd4[_0x530c53]['assigned']=!![];_0xa8bbd4[_0x530c53][_0x6979('0x16')]=_0x414b76[_0x6979('0x11')];_0xa8bbd4[_0x530c53][_0x6979('0x12')]=_[_0x6979('0x17')](_0x414b76[_0x6979('0x12')])?util[_0x6979('0x18')](_0x6979('0x19'),_0x414b76[_0x6979('0x11')]):_0x414b76[_0x6979('0x12')];if(_0xa8bbd4[_0x530c53]['queuecallercomplete']){_0xa8bbd4[_0x530c53][_0x6979('0x1a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0xa8bbd4[_0x530c53][_0x6979('0x1b')]){_0xa8bbd4[_0x530c53][_0x6979('0x1c')]=moment()['format'](_0x6979('0x1d'));}RpcMemberReport['voiceQueueReport'](_0xa8bbd4[_0x530c53]);}RpcVoiceQueueReport[_0x6979('0x1e')](_0xa8bbd4[_0x530c53]);}};function extractCalleridNumber(_0x205022){var _0x5cfc8f=_0x205022['match'](/<(.*?)>/);return _0x5cfc8f?_0x5cfc8f[0x1]:_0x205022;}Report[_0x6979('0xc')][_0x6979('0x1f')]=function(_0x2b6315){_0x2b6315[_0x6979('0x20')]=_0x2b6315[_0x6979('0x20')]||_0x2b6315[_0x6979('0x21')];if(_0x2b6315['type']==_0x6979('0x22')){_0x2b6315[_0x6979('0x23')]='queue';_0x2b6315[_0x6979('0x24')]=_0x2b6315[_0x6979('0x25')];if(_0x2b6315['context']==_0x6979('0x26')){_0x2b6315[_0x6979('0x10')]='';_0x2b6315[_0x6979('0x20')]=extractCalleridNumber(_0x2b6315[_0x6979('0x27')]);}else if(_0x2b6315[_0x6979('0x28')]==_0x6979('0x29')){if(_0x2b6315[_0x6979('0x20')]==_0x6979('0x2a')){_0x2b6315[_0x6979('0x20')]=extractCalleridNumber(_0x2b6315[_0x6979('0x2b')]);_0x2b6315[_0x6979('0x2c')]=_0x2b6315[_0x6979('0x2d')];_0x2b6315[_0x6979('0x2e')]=[_0x2b6315[_0x6979('0x2f')],_0x2b6315[_0x6979('0x2f')]=_0x2b6315[_0x6979('0x2e')]][0x0];_0x2b6315['callerid']=_0x2b6315[_0x6979('0x2b')];}else{_0x2b6315[_0x6979('0x20')]=_0x2b6315['calleridnum'];_0x2b6315[_0x6979('0x2c')]=_0x2b6315['originatecalleridnum'];if(_0x2b6315[_0x6979('0x30')]==_0x6979('0x31')){_0x2b6315[_0x6979('0x10')]=_0x2b6315[_0x6979('0x15')];}else{_0x2b6315[_0x6979('0x10')]='';}}}}else{_0x2b6315['callerid']=util[_0x6979('0x18')](_0x6979('0x32'),_0x2b6315[_0x6979('0x33')],_0x2b6315[_0x6979('0x2c')]);}RpcVoiceCallReport['create'](_0x2b6315);if(_0x2b6315[_0x6979('0x34')]){for(var _0x575a3d=0x0;_0x575a3d<_0x2b6315['monitors']['length'];_0x575a3d+=0x1){_0x2b6315[_0x6979('0x35')]=_0x2b6315[_0x6979('0x36')][_0x575a3d][_0x6979('0x37')];_0x2b6315[_0x6979('0x38')]=_0x2b6315[_0x6979('0x36')][_0x575a3d][_0x6979('0x38')];if(_0x2b6315[_0x6979('0x21')]=='xcally-motion-preview'){_0x2b6315['calleridnum']=_0x2b6315[_0x6979('0x15')];_0x2b6315[_0x6979('0x33')]=_0x2b6315[_0x6979('0x39')];_0x2b6315[_0x6979('0x15')]=_0x2b6315[_0x6979('0x10')];_0x2b6315[_0x6979('0x39')]=_0x2b6315[_0x6979('0x3a')];_0x2b6315['exten']=_0x2b6315[_0x6979('0x2d')];}else if(_0x2b6315['exten']==_0x6979('0x3b')){_0x2b6315[_0x6979('0x2c')]=_0x2b6315[_0x6979('0x20')];_0x2b6315[_0x6979('0x21')]=_0x2b6315[_0x6979('0x2d')];}RpcVoiceRecording[_0x6979('0x1e')](_0x2b6315);}}};Report['prototype']['voiceAgentReport']=function(_0x3501fe){RpcVoiceAgentReport[_0x6979('0x1e')](_0x3501fe);};Report['prototype']['voiceDialReport']=function(_0x741257){RpcVoiceDialReport[_0x6979('0x1e')](_0x741257);var _0x4d7158=undefined;var _0x15d8b3=_0x741257[_0x6979('0x2f')];if(_[_0x6979('0x3c')](_0x15d8b3,_0x6979('0x3d'))){var _0x4be763=_0x15d8b3[_0x6979('0x3e')](_0x15d8b3[_0x6979('0x3f')]('/')+0x1,_0x15d8b3['indexOf']('@'));_0x4d7158=_[_0x6979('0xf')](this[_0x6979('0xa')],function(_0x5d5dc1){return _0x5d5dc1['mobile']==_0x4be763||_0x5d5dc1[_0x6979('0x40')]==_0x4be763||_0x5d5dc1[_0x6979('0x10')]==_0x4be763;});}else{var _0x4be763=_0x15d8b3[_0x6979('0x3e')](_0x15d8b3[_0x6979('0x3f')]('/')+0x1,_0x15d8b3[_0x6979('0x41')]('-'));_0x4d7158=this[_0x6979('0xe')](_0x4be763);}if(_0x4d7158){_0x741257[_0x6979('0x12')]=_['isNil'](_0x4d7158[_0x6979('0x12')])?util[_0x6979('0x18')](_0x6979('0x19'),_0x4d7158[_0x6979('0x11')]):_0x4d7158[_0x6979('0x12')];_0x741257[_0x6979('0x3a')]=_0x4d7158['name'];_0x741257['accountcode']=_0x4d7158[_0x6979('0x10')];RpcMemberReport[_0x6979('0x42')](_0x741257);}};Report[_0x6979('0xc')][_0x6979('0x43')]=function(_0x1f4727){RpcVoiceTransferReport['blindTransfer'](_0x1f4727);};Report[_0x6979('0xc')][_0x6979('0x44')]=function(_0x2f4bb3){RpcVoiceTransferReport[_0x6979('0x44')](_0x2f4bb3);};module[_0x6979('0x45')]=Report; \ No newline at end of file +var _0x6669=['SIP/%s','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','voiceCallReport','destination','exten','type','dialer','lastapplication','queue','lastdata','from-voip-provider','callerid','context','calleridnum','originatecalleridnum','destinationchannel','channel','calleridpreview','disposition','connectedlinenum','calleridname','create','monitor','monitors','createdAt','xcally-motion-preview','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','voiceDialReport','startsWith','substring','indexOf','mobile','phone','lastIndexOf','blindTransfer','attendedTransfer','exports','bluebird','lodash','moment','util','../../../config/logger','ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','findAgent','find','accountcode','name','isNil','interface','format','length','lastAssignedTo'];(function(_0x1880e3,_0x4eaa42){var _0x36f956=function(_0x32711c){while(--_0x32711c){_0x1880e3['push'](_0x1880e3['shift']());}};_0x36f956(++_0x4eaa42);}(_0x6669,0x72));var _0x9666=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x6669[_0x3826ad];return _0x17b900;};'use strict';var BPromise=require(_0x9666('0x0'));var _=require(_0x9666('0x1'));var moment=require(_0x9666('0x2'));var util=require(_0x9666('0x3'));var logger=require(_0x9666('0x4'))(_0x9666('0x5'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x9666('0x6'));var RpcVoiceCallReport=require(_0x9666('0x7'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x9666('0x8'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x9666('0x9'));var RpcVoiceTransferReport=require(_0x9666('0xa'));var VoiceQueueReport=require(_0x9666('0xb'));var VoiceCallReport=require(_0x9666('0xc'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x9666('0xd'));var UserReport=require(_0x9666('0xe'));function Report(_0x41a5fe){this[_0x9666('0xf')]=_0x41a5fe;this[_0x9666('0x10')]=_0x41a5fe[_0x9666('0x10')];this[_0x9666('0x11')]=_0x41a5fe[_0x9666('0x11')];}Report[_0x9666('0x12')]['sync']=function(_0x26a4e9){var _0x144f0e=new VoiceQueueReport(this[_0x9666('0xf')]);var _0x34c79f=new VoiceAgentReport(this[_0x9666('0xf')]);var _0x138c88=new VoiceDialReport(this[_0x9666('0xf')]);var _0x563d6c=new VoiceCallReport(this[_0x9666('0xf')]);var _0x1750a0=new UserReport(this[_0x9666('0xf')]);};Report[_0x9666('0x12')][_0x9666('0x13')]=function(_0x1f473){var _0x3cb686=undefined;_0x3cb686=_[_0x9666('0x14')](this[_0x9666('0x10')],function(_0xb976a6){return _0xb976a6[_0x9666('0x15')]==_0x1f473||_0xb976a6[_0x9666('0x16')]==_0x1f473;});if(_[_0x9666('0x17')](_0x3cb686)){var _0x5bd8fa=_['find'](this[_0x9666('0x11')],function(_0x27cfaa){return _0x27cfaa[_0x9666('0x15')]==_0x1f473||_0x27cfaa[_0x9666('0x16')]==_0x1f473;});if(_0x5bd8fa){_0x3cb686=_[_0x9666('0x14')](this[_0x9666('0x10')],function(_0x4dadc0){return _0x4dadc0[_0x9666('0x18')]==util[_0x9666('0x19')]('SIP/%s',_0x5bd8fa[_0x9666('0x16')]);});}}return _0x3cb686;};Report['prototype']['voiceQueueReport']=function(_0x315f0f){for(var _0x2faf1e=0x0;_0x2faf1e<_0x315f0f[_0x9666('0x1a')];_0x2faf1e+=0x1){var _0x314a66=this[_0x9666('0x13')](_0x315f0f[_0x2faf1e]['connectedlinenum']);if(_0x314a66){_0x315f0f[_0x2faf1e][_0x9666('0x15')]=_0x314a66[_0x9666('0x15')];_0x315f0f[_0x2faf1e]['assigned']=!![];_0x315f0f[_0x2faf1e][_0x9666('0x1b')]=_0x314a66['name'];_0x315f0f[_0x2faf1e][_0x9666('0x18')]=_['isNil'](_0x314a66[_0x9666('0x18')])?util['format'](_0x9666('0x1c'),_0x314a66['name']):_0x314a66[_0x9666('0x18')];if(_0x315f0f[_0x2faf1e][_0x9666('0x1d')]){_0x315f0f[_0x2faf1e]['queuecallercompleteAt']=moment()[_0x9666('0x19')](_0x9666('0x1e'));}if(_0x315f0f[_0x2faf1e][_0x9666('0x1f')]){_0x315f0f[_0x2faf1e][_0x9666('0x20')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x315f0f[_0x2faf1e]);}RpcVoiceQueueReport['create'](_0x315f0f[_0x2faf1e]);}};function extractCalleridNumber(_0x11e957){var _0x2c8055=_0x11e957['match'](/<(.*?)>/);return _0x2c8055?_0x2c8055[0x1]:_0x11e957;}Report[_0x9666('0x12')][_0x9666('0x21')]=function(_0x4f5133){_0x4f5133[_0x9666('0x22')]=_0x4f5133['destination']||_0x4f5133[_0x9666('0x23')];if(_0x4f5133[_0x9666('0x24')]==_0x9666('0x25')){_0x4f5133[_0x9666('0x26')]=_0x9666('0x27');_0x4f5133[_0x9666('0x28')]=_0x4f5133[_0x9666('0x27')];if(_0x4f5133['context']==_0x9666('0x29')){_0x4f5133['accountcode']='';_0x4f5133[_0x9666('0x22')]=extractCalleridNumber(_0x4f5133[_0x9666('0x2a')]);}else if(_0x4f5133[_0x9666('0x2b')]=='from-sip'){if(_0x4f5133[_0x9666('0x22')]=='xcally-motion-preview'){_0x4f5133['destination']=extractCalleridNumber(_0x4f5133['calleridpreview']);_0x4f5133[_0x9666('0x2c')]=_0x4f5133[_0x9666('0x2d')];_0x4f5133[_0x9666('0x2e')]=[_0x4f5133[_0x9666('0x2f')],_0x4f5133[_0x9666('0x2f')]=_0x4f5133[_0x9666('0x2e')]][0x0];_0x4f5133[_0x9666('0x2a')]=_0x4f5133[_0x9666('0x30')];}else{_0x4f5133[_0x9666('0x22')]=_0x4f5133['calleridnum'];_0x4f5133[_0x9666('0x2c')]=_0x4f5133['originatecalleridnum'];if(_0x4f5133[_0x9666('0x31')]=='ANSWERED'){_0x4f5133[_0x9666('0x15')]=_0x4f5133[_0x9666('0x32')];}else{_0x4f5133['accountcode']='';}}}}else{_0x4f5133['callerid']=util[_0x9666('0x19')]('\x22%s\x22\x20<%s>',_0x4f5133[_0x9666('0x33')],_0x4f5133['calleridnum']);}RpcVoiceCallReport[_0x9666('0x34')](_0x4f5133);if(_0x4f5133[_0x9666('0x35')]){for(var _0x1837d2=0x0;_0x1837d2<_0x4f5133[_0x9666('0x36')]['length'];_0x1837d2+=0x1){_0x4f5133['monitorFilename']=_0x4f5133['monitors'][_0x1837d2]['filename'];_0x4f5133['createdAt']=_0x4f5133[_0x9666('0x36')][_0x1837d2][_0x9666('0x37')];if(_0x4f5133[_0x9666('0x23')]==_0x9666('0x38')){_0x4f5133[_0x9666('0x2c')]=_0x4f5133['connectedlinenum'];_0x4f5133['calleridname']=_0x4f5133[_0x9666('0x39')];_0x4f5133[_0x9666('0x32')]=_0x4f5133[_0x9666('0x15')];_0x4f5133[_0x9666('0x39')]=_0x4f5133[_0x9666('0x3a')];_0x4f5133[_0x9666('0x23')]=_0x4f5133['originatecalleridnum'];}else if(_0x4f5133[_0x9666('0x23')]==_0x9666('0x3b')){_0x4f5133[_0x9666('0x2c')]=_0x4f5133['destination'];_0x4f5133[_0x9666('0x23')]=_0x4f5133['originatecalleridnum'];}RpcVoiceRecording[_0x9666('0x34')](_0x4f5133);}}};Report[_0x9666('0x12')][_0x9666('0x3c')]=function(_0x57fb3d){RpcVoiceAgentReport[_0x9666('0x34')](_0x57fb3d);};Report[_0x9666('0x12')][_0x9666('0x3d')]=function(_0x47ebca){RpcVoiceDialReport[_0x9666('0x34')](_0x47ebca);var _0x5a8245=undefined;var _0x28dc9e=_0x47ebca['channel'];if(_[_0x9666('0x3e')](_0x28dc9e,'Local')){var _0x591f57=_0x28dc9e[_0x9666('0x3f')](_0x28dc9e[_0x9666('0x40')]('/')+0x1,_0x28dc9e[_0x9666('0x40')]('@'));_0x5a8245=_[_0x9666('0x14')](this[_0x9666('0x10')],function(_0x12d100){return _0x12d100[_0x9666('0x41')]==_0x591f57||_0x12d100[_0x9666('0x42')]==_0x591f57||_0x12d100[_0x9666('0x15')]==_0x591f57;});}else{var _0x591f57=_0x28dc9e[_0x9666('0x3f')](_0x28dc9e[_0x9666('0x40')]('/')+0x1,_0x28dc9e[_0x9666('0x43')]('-'));_0x5a8245=this[_0x9666('0x13')](_0x591f57);}if(_0x5a8245){_0x47ebca[_0x9666('0x18')]=_[_0x9666('0x17')](_0x5a8245['interface'])?util[_0x9666('0x19')]('SIP/%s',_0x5a8245[_0x9666('0x16')]):_0x5a8245['interface'];_0x47ebca['membername']=_0x5a8245[_0x9666('0x16')];_0x47ebca[_0x9666('0x15')]=_0x5a8245[_0x9666('0x15')];RpcMemberReport['voiceDialReport'](_0x47ebca);}};Report[_0x9666('0x12')][_0x9666('0x44')]=function(_0x4c5999){RpcVoiceTransferReport[_0x9666('0x44')](_0x4c5999);};Report[_0x9666('0x12')][_0x9666('0x45')]=function(_0x163b0b){RpcVoiceTransferReport[_0x9666('0x45')](_0x163b0b);};module[_0x9666('0x46')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 09a4dd4..0b25c1e 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 _0x0246=['actionid','state','name','trunk:save','error','[syncRegistry][UserReport]','device','local','toLowerCase','inuse','stateTime','format','updateStatusRealtime','toNumber','telephone:%s','trunk:%s','startsWith','Queue','substring','indexOf','find','phone','accountcode','[syncDeviceState][UserReport]','inspect','peer','registered','status','address','telephone:save','[syncPeerStatus][UserReport]','exports','lodash','bluebird','ioredis','../../../config/logger','ami','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','bind','syncRegistry','syncDeviceState','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','[loopSyncRealTimeShow]','catch','isUndefined','prototype','emit','isNotNull','stateRegistry','omit','event'];(function(_0x1f813a,_0x102327){var _0x5e0b7b=function(_0x41348b){while(--_0x41348b){_0x1f813a['push'](_0x1f813a['shift']());}};_0x5e0b7b(++_0x102327);}(_0x0246,0xe0));var _0x6024=function(_0xa0c9aa,_0x1206bf){_0xa0c9aa=_0xa0c9aa-0x0;var _0x18be39=_0x0246[_0xa0c9aa];return _0x18be39;};'use strict';var _=require(_0x6024('0x0'));var moment=require('moment');var BPromise=require(_0x6024('0x1'));var util=require('util');var Redis=require(_0x6024('0x2'));var config=require('../../../config/environment');var logger=require(_0x6024('0x3'))(_0x6024('0x4'));var ami=require('../ami');config[_0x6024('0x5')]=_['defaults'](config['redis'],{'host':_0x6024('0x6'),'port':0x18eb});var io=require(_0x6024('0x7'))(new Redis(config['redis']));function UserReport(_0x24cea7){this['trunks']=_0x24cea7[_0x6024('0x8')];this[_0x6024('0x9')]=_0x24cea7['agents'];this[_0x6024('0xa')]=_0x24cea7[_0x6024('0xa')];ami['on'](_0x6024('0xb'),this['syncRegistry'][_0x6024('0xc')](this));ami['on']('registry',this[_0x6024('0xd')][_0x6024('0xc')](this));ami['on']('devicestatechange',this[_0x6024('0xe')]['bind'](this));ami['on'](_0x6024('0xf'),this[_0x6024('0x10')][_0x6024('0xc')](this));this[_0x6024('0x11')]();return BPromise[_0x6024('0x12')]()[_0x6024('0x13')](ami[_0x6024('0x14')]())[_0x6024('0x13')](ami[_0x6024('0x15')]())[_0x6024('0x13')](ami[_0x6024('0x16')]())['catch'](loggerCatch(_0x6024('0x17')));}function loggerCatch(_0xc445a3){return function(_0x1316fb){logger['error'](_0xc445a3,util['inspect'](_0x1316fb,{'showHidden':![],'depth':null}));};}UserReport['prototype'][_0x6024('0x11')]=function(){setInterval(function(){BPromise['resolve']()[_0x6024('0x13')](ami[_0x6024('0x14')]())['then'](ami[_0x6024('0x15')]())['then'](ami[_0x6024('0x16')]())[_0x6024('0x18')](loggerCatch(_0x6024('0x17')));},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x125dd7){return _0x125dd7!==null&&!_[_0x6024('0x19')](_0x125dd7);};UserReport[_0x6024('0x1a')][_0x6024('0x1b')]=function(_0x16e7d1,_0x3ee692,_0x29fb1c){io['to'](_0x16e7d1)[_0x6024('0x1b')](_0x3ee692,_0x29fb1c);};UserReport['prototype'][_0x6024('0xd')]=function(_0x443820){try{if(this[_0x6024('0x1c')](_0x443820)){var _0x54511f=_['find'](this[_0x6024('0x8')],{'registry':_0x443820['username']});if(_0x54511f){_0x443820[_0x6024('0x1d')]=_0x443820['state'];_['merge'](_0x54511f,_[_0x6024('0x1e')](_0x443820,[_0x6024('0x1f'),_0x6024('0x20'),'username',_0x6024('0x21')]));this['emit'](util['format']('trunk:%s',_0x54511f[_0x6024('0x22')]),_0x6024('0x23'),_0x54511f);}}}catch(_0x5b4878){logger[_0x6024('0x24')](_0x6024('0x25'),util['inspect'](_0x5b4878,{'showHidden':![],'depth':null}));}};UserReport[_0x6024('0x1a')]['syncDeviceState']=function(_0x3051b2){try{if(this['isNotNull'](_0x3051b2)){if(this[_0x6024('0x9')][_0x3051b2[_0x6024('0x26')]]){if(!this[_0x6024('0x9')][_0x3051b2[_0x6024('0x26')]][_0x6024('0x27')]||_0x3051b2['state'][_0x6024('0x28')]()==_0x6024('0x29')){this[_0x6024('0x9')][_0x3051b2[_0x6024('0x26')]][_0x6024('0x27')]=![];if(this[_0x6024('0x9')][_0x3051b2[_0x6024('0x26')]][_0x6024('0x21')]!==_0x3051b2['state']['toLowerCase']()){this['agents'][_0x3051b2[_0x6024('0x26')]][_0x6024('0x2a')]=_['toNumber'](moment()[_0x6024('0x2b')]('x'));}this[_0x6024('0x9')][_0x3051b2[_0x6024('0x26')]][_0x6024('0x21')]=_0x3051b2[_0x6024('0x21')][_0x6024('0x28')]();this[_0x6024('0x9')][_0x3051b2['device']][_0x6024('0x2c')](_0x3051b2);}}else if(this['telephones'][_0x3051b2[_0x6024('0x26')]]){if(this['telephones'][_0x3051b2[_0x6024('0x26')]][_0x6024('0x21')]!==_0x3051b2[_0x6024('0x21')][_0x6024('0x28')]()){this[_0x6024('0xa')][_0x3051b2[_0x6024('0x26')]][_0x6024('0x2a')]=_[_0x6024('0x2d')](moment()[_0x6024('0x2b')]('x'));}this[_0x6024('0xa')][_0x3051b2[_0x6024('0x26')]][_0x6024('0x21')]=_0x3051b2[_0x6024('0x21')][_0x6024('0x28')]();this['emit'](util['format'](_0x6024('0x2e'),this[_0x6024('0xa')][_0x3051b2[_0x6024('0x26')]]['name']),'telephone:save',this['telephones'][_0x3051b2[_0x6024('0x26')]]);}else if(this[_0x6024('0x8')][_0x3051b2[_0x6024('0x26')]]){if(this[_0x6024('0x8')][_0x3051b2[_0x6024('0x26')]][_0x6024('0x21')]!==_0x3051b2[_0x6024('0x21')][_0x6024('0x28')]()){this[_0x6024('0x8')][_0x3051b2['device']][_0x6024('0x2a')]=_[_0x6024('0x2d')](moment()[_0x6024('0x2b')]('x'));}this[_0x6024('0x8')][_0x3051b2['device']][_0x6024('0x21')]=_0x3051b2[_0x6024('0x21')][_0x6024('0x28')]();this[_0x6024('0x1b')](util[_0x6024('0x2b')](_0x6024('0x2f'),this[_0x6024('0x8')][_0x3051b2[_0x6024('0x26')]]['name']),_0x6024('0x23'),this[_0x6024('0x8')][_0x3051b2[_0x6024('0x26')]]);}else if(_[_0x6024('0x30')](_0x3051b2[_0x6024('0x26')],_0x6024('0x31'))){}else if(_[_0x6024('0x30')](_0x3051b2[_0x6024('0x26')],'Local')){var _0x2a02a3=_0x3051b2[_0x6024('0x26')];var _0x1c376f=_0x2a02a3[_0x6024('0x32')](_0x2a02a3[_0x6024('0x33')]('/')+0x1,_0x2a02a3[_0x6024('0x33')]('@'));var _0x336fed=_[_0x6024('0x34')](this[_0x6024('0x9')],function(_0x238a43){return _0x238a43['mobile']==_0x1c376f||_0x238a43[_0x6024('0x35')]==_0x1c376f||_0x238a43[_0x6024('0x36')]==_0x1c376f;});if(_0x336fed){if(_0x336fed['state']!==_0x3051b2[_0x6024('0x21')][_0x6024('0x28')]()){_0x336fed[_0x6024('0x2a')]=_[_0x6024('0x2d')](moment()[_0x6024('0x2b')]('x'));}_0x336fed['state']=_0x3051b2[_0x6024('0x21')][_0x6024('0x28')]();_0x336fed[_0x6024('0x27')]=!![];_0x336fed[_0x6024('0x2c')](_0x3051b2);}}else{}}}catch(_0x2a4f3e){logger['error'](_0x6024('0x37'),util[_0x6024('0x38')](_0x2a4f3e,{'showHidden':![],'depth':null}));}};UserReport[_0x6024('0x1a')][_0x6024('0x10')]=function(_0x530135){try{if(this[_0x6024('0x1c')](_0x530135)&&this[_0x6024('0x1c')](_0x530135['peerstatus'])){if(this['agents'][_0x530135[_0x6024('0x39')]]){if(!this[_0x6024('0x9')][_0x530135[_0x6024('0x39')]]['local']||_0x530135['peerstatus'][_0x6024('0x28')]()==_0x6024('0x3a')){this[_0x6024('0x9')][_0x530135[_0x6024('0x39')]]['local']=![];this['agents'][_0x530135[_0x6024('0x39')]][_0x6024('0x3b')]=_0x530135[_0x6024('0xf')][_0x6024('0x28')]();this[_0x6024('0x9')][_0x530135[_0x6024('0x39')]][_0x6024('0x3c')]=_0x530135[_0x6024('0x3c')];this['agents'][_0x530135[_0x6024('0x39')]][_0x6024('0x2c')](_0x530135);}}else if(this[_0x6024('0xa')][_0x530135[_0x6024('0x39')]]){this['telephones'][_0x530135[_0x6024('0x39')]][_0x6024('0x3b')]=_0x530135['peerstatus'][_0x6024('0x28')]();this[_0x6024('0xa')][_0x530135['peer']][_0x6024('0x3c')]=_0x530135['address'];this[_0x6024('0x1b')](util[_0x6024('0x2b')](_0x6024('0x2e'),this[_0x6024('0xa')][_0x530135[_0x6024('0x39')]][_0x6024('0x22')]),_0x6024('0x3d'),this['telephones'][_0x530135[_0x6024('0x39')]]);}else if(this[_0x6024('0x8')][_0x530135[_0x6024('0x39')]]){this[_0x6024('0x8')][_0x530135['peer']][_0x6024('0x3b')]=_0x530135['peerstatus'][_0x6024('0x28')]();this[_0x6024('0x8')][_0x530135['peer']][_0x6024('0x3c')]=_0x530135[_0x6024('0x3c')];this[_0x6024('0x1b')](util[_0x6024('0x2b')](_0x6024('0x2f'),this[_0x6024('0x8')][_0x530135[_0x6024('0x39')]][_0x6024('0x22')]),_0x6024('0x23'),this[_0x6024('0x8')][_0x530135[_0x6024('0x39')]]);}else{}}}catch(_0x382f2a){logger[_0x6024('0x24')](_0x6024('0x3e'),util[_0x6024('0x38')](_0x382f2a,{'showHidden':![],'depth':null}));}};module[_0x6024('0x3f')]=UserReport; \ No newline at end of file +var _0x06ff=['toNumber','updateStatusRealtime','telephones','format','telephone:%s','telephone:save','startsWith','Queue','Local','substring','indexOf','mobile','phone','[syncDeviceState][UserReport]','peer','registered','status','address','[syncPeerStatus][UserReport]','exports','lodash','bluebird','ioredis','../../../config/environment','../ami','redis','localhost','socket.io-emitter','trunks','agents','registryentry','syncRegistry','registry','devicestatechange','bind','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','catch','error','inspect','prototype','isNotNull','find','username','stateRegistry','state','merge','omit','event','actionid','emit','trunk:%s','name','trunk:save','syncDeviceState','device','local','inuse','toLowerCase','stateTime'];(function(_0x50c9f2,_0x53cbc8){var _0x40b105=function(_0x516cca){while(--_0x516cca){_0x50c9f2['push'](_0x50c9f2['shift']());}};_0x40b105(++_0x53cbc8);}(_0x06ff,0xda));var _0xf06f=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x06ff[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xf06f('0x0'));var moment=require('moment');var BPromise=require(_0xf06f('0x1'));var util=require('util');var Redis=require(_0xf06f('0x2'));var config=require(_0xf06f('0x3'));var logger=require('../../../config/logger')('ami');var ami=require(_0xf06f('0x4'));config[_0xf06f('0x5')]=_['defaults'](config[_0xf06f('0x5')],{'host':_0xf06f('0x6'),'port':0x18eb});var io=require(_0xf06f('0x7'))(new Redis(config[_0xf06f('0x5')]));function UserReport(_0x1d69bc){this[_0xf06f('0x8')]=_0x1d69bc[_0xf06f('0x8')];this[_0xf06f('0x9')]=_0x1d69bc[_0xf06f('0x9')];this['telephones']=_0x1d69bc['telephones'];ami['on'](_0xf06f('0xa'),this[_0xf06f('0xb')]['bind'](this));ami['on'](_0xf06f('0xc'),this['syncRegistry']['bind'](this));ami['on'](_0xf06f('0xd'),this['syncDeviceState'][_0xf06f('0xe')](this));ami['on'](_0xf06f('0xf'),this[_0xf06f('0x10')][_0xf06f('0xe')](this));this[_0xf06f('0x11')]();return BPromise[_0xf06f('0x12')]()[_0xf06f('0x13')](ami[_0xf06f('0x14')]())[_0xf06f('0x13')](ami[_0xf06f('0x15')]())[_0xf06f('0x13')](ami[_0xf06f('0x16')]())[_0xf06f('0x17')](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x5a00b6){return function(_0x5558b0){logger[_0xf06f('0x18')](_0x5a00b6,util[_0xf06f('0x19')](_0x5558b0,{'showHidden':![],'depth':null}));};}UserReport[_0xf06f('0x1a')][_0xf06f('0x11')]=function(){setInterval(function(){BPromise[_0xf06f('0x12')]()[_0xf06f('0x13')](ami['actionSipShowRegistry']())[_0xf06f('0x13')](ami[_0xf06f('0x15')]())[_0xf06f('0x13')](ami[_0xf06f('0x16')]())['catch'](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport['prototype'][_0xf06f('0x1b')]=function(_0x1b383f){return _0x1b383f!==null&&!_['isUndefined'](_0x1b383f);};UserReport[_0xf06f('0x1a')]['emit']=function(_0x24eab4,_0x4a400e,_0x4ab9f1){io['to'](_0x24eab4)['emit'](_0x4a400e,_0x4ab9f1);};UserReport['prototype'][_0xf06f('0xb')]=function(_0x148315){try{if(this[_0xf06f('0x1b')](_0x148315)){var _0x1e72e4=_[_0xf06f('0x1c')](this[_0xf06f('0x8')],{'registry':_0x148315[_0xf06f('0x1d')]});if(_0x1e72e4){_0x148315[_0xf06f('0x1e')]=_0x148315[_0xf06f('0x1f')];_[_0xf06f('0x20')](_0x1e72e4,_[_0xf06f('0x21')](_0x148315,[_0xf06f('0x22'),_0xf06f('0x23'),_0xf06f('0x1d'),'state']));this[_0xf06f('0x24')](util['format'](_0xf06f('0x25'),_0x1e72e4[_0xf06f('0x26')]),_0xf06f('0x27'),_0x1e72e4);}}}catch(_0x4e0d8d){logger[_0xf06f('0x18')]('[syncRegistry][UserReport]',util[_0xf06f('0x19')](_0x4e0d8d,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xf06f('0x28')]=function(_0x32e807){try{if(this[_0xf06f('0x1b')](_0x32e807)){if(this[_0xf06f('0x9')][_0x32e807[_0xf06f('0x29')]]){if(!this[_0xf06f('0x9')][_0x32e807[_0xf06f('0x29')]][_0xf06f('0x2a')]||_0x32e807['state']['toLowerCase']()==_0xf06f('0x2b')){this[_0xf06f('0x9')][_0x32e807['device']][_0xf06f('0x2a')]=![];if(this['agents'][_0x32e807[_0xf06f('0x29')]][_0xf06f('0x1f')]!==_0x32e807[_0xf06f('0x1f')][_0xf06f('0x2c')]()){this[_0xf06f('0x9')][_0x32e807[_0xf06f('0x29')]][_0xf06f('0x2d')]=_[_0xf06f('0x2e')](moment()['format']('x'));}this['agents'][_0x32e807[_0xf06f('0x29')]][_0xf06f('0x1f')]=_0x32e807[_0xf06f('0x1f')][_0xf06f('0x2c')]();this[_0xf06f('0x9')][_0x32e807[_0xf06f('0x29')]][_0xf06f('0x2f')](_0x32e807);}}else if(this[_0xf06f('0x30')][_0x32e807[_0xf06f('0x29')]]){if(this['telephones'][_0x32e807[_0xf06f('0x29')]][_0xf06f('0x1f')]!==_0x32e807[_0xf06f('0x1f')][_0xf06f('0x2c')]()){this[_0xf06f('0x30')][_0x32e807[_0xf06f('0x29')]][_0xf06f('0x2d')]=_[_0xf06f('0x2e')](moment()[_0xf06f('0x31')]('x'));}this[_0xf06f('0x30')][_0x32e807[_0xf06f('0x29')]][_0xf06f('0x1f')]=_0x32e807[_0xf06f('0x1f')][_0xf06f('0x2c')]();this[_0xf06f('0x24')](util[_0xf06f('0x31')](_0xf06f('0x32'),this[_0xf06f('0x30')][_0x32e807[_0xf06f('0x29')]][_0xf06f('0x26')]),_0xf06f('0x33'),this[_0xf06f('0x30')][_0x32e807[_0xf06f('0x29')]]);}else if(this[_0xf06f('0x8')][_0x32e807[_0xf06f('0x29')]]){if(this[_0xf06f('0x8')][_0x32e807[_0xf06f('0x29')]][_0xf06f('0x1f')]!==_0x32e807[_0xf06f('0x1f')][_0xf06f('0x2c')]()){this[_0xf06f('0x8')][_0x32e807['device']][_0xf06f('0x2d')]=_['toNumber'](moment()[_0xf06f('0x31')]('x'));}this[_0xf06f('0x8')][_0x32e807[_0xf06f('0x29')]][_0xf06f('0x1f')]=_0x32e807[_0xf06f('0x1f')][_0xf06f('0x2c')]();this[_0xf06f('0x24')](util[_0xf06f('0x31')](_0xf06f('0x25'),this[_0xf06f('0x8')][_0x32e807[_0xf06f('0x29')]][_0xf06f('0x26')]),_0xf06f('0x27'),this['trunks'][_0x32e807[_0xf06f('0x29')]]);}else if(_[_0xf06f('0x34')](_0x32e807[_0xf06f('0x29')],_0xf06f('0x35'))){}else if(_[_0xf06f('0x34')](_0x32e807[_0xf06f('0x29')],_0xf06f('0x36'))){var _0x53910c=_0x32e807[_0xf06f('0x29')];var _0x2c2f7b=_0x53910c[_0xf06f('0x37')](_0x53910c[_0xf06f('0x38')]('/')+0x1,_0x53910c[_0xf06f('0x38')]('@'));var _0x355626=_[_0xf06f('0x1c')](this[_0xf06f('0x9')],function(_0x515957){return _0x515957[_0xf06f('0x39')]==_0x2c2f7b||_0x515957[_0xf06f('0x3a')]==_0x2c2f7b||_0x515957['accountcode']==_0x2c2f7b;});if(_0x355626){if(_0x355626['state']!==_0x32e807['state'][_0xf06f('0x2c')]()){_0x355626['stateTime']=_[_0xf06f('0x2e')](moment()[_0xf06f('0x31')]('x'));}_0x355626['state']=_0x32e807[_0xf06f('0x1f')][_0xf06f('0x2c')]();_0x355626['local']=!![];_0x355626[_0xf06f('0x2f')](_0x32e807);}}else{}}}catch(_0x1780e9){logger[_0xf06f('0x18')](_0xf06f('0x3b'),util[_0xf06f('0x19')](_0x1780e9,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xf06f('0x10')]=function(_0x14d490){try{if(this[_0xf06f('0x1b')](_0x14d490)&&this[_0xf06f('0x1b')](_0x14d490[_0xf06f('0xf')])){if(this[_0xf06f('0x9')][_0x14d490[_0xf06f('0x3c')]]){if(!this[_0xf06f('0x9')][_0x14d490[_0xf06f('0x3c')]][_0xf06f('0x2a')]||_0x14d490['peerstatus'][_0xf06f('0x2c')]()==_0xf06f('0x3d')){this[_0xf06f('0x9')][_0x14d490[_0xf06f('0x3c')]]['local']=![];this[_0xf06f('0x9')][_0x14d490['peer']][_0xf06f('0x3e')]=_0x14d490[_0xf06f('0xf')][_0xf06f('0x2c')]();this[_0xf06f('0x9')][_0x14d490['peer']][_0xf06f('0x3f')]=_0x14d490[_0xf06f('0x3f')];this['agents'][_0x14d490[_0xf06f('0x3c')]][_0xf06f('0x2f')](_0x14d490);}}else if(this[_0xf06f('0x30')][_0x14d490[_0xf06f('0x3c')]]){this['telephones'][_0x14d490[_0xf06f('0x3c')]][_0xf06f('0x3e')]=_0x14d490['peerstatus'][_0xf06f('0x2c')]();this[_0xf06f('0x30')][_0x14d490[_0xf06f('0x3c')]][_0xf06f('0x3f')]=_0x14d490[_0xf06f('0x3f')];this[_0xf06f('0x24')](util[_0xf06f('0x31')](_0xf06f('0x32'),this[_0xf06f('0x30')][_0x14d490['peer']]['name']),_0xf06f('0x33'),this[_0xf06f('0x30')][_0x14d490[_0xf06f('0x3c')]]);}else if(this[_0xf06f('0x8')][_0x14d490[_0xf06f('0x3c')]]){this['trunks'][_0x14d490[_0xf06f('0x3c')]][_0xf06f('0x3e')]=_0x14d490[_0xf06f('0xf')][_0xf06f('0x2c')]();this[_0xf06f('0x8')][_0x14d490[_0xf06f('0x3c')]][_0xf06f('0x3f')]=_0x14d490[_0xf06f('0x3f')];this[_0xf06f('0x24')](util[_0xf06f('0x31')](_0xf06f('0x25'),this[_0xf06f('0x8')][_0x14d490[_0xf06f('0x3c')]]['name']),_0xf06f('0x27'),this[_0xf06f('0x8')][_0x14d490[_0xf06f('0x3c')]]);}else{}}}catch(_0x3d51f8){logger[_0xf06f('0x18')](_0xf06f('0x40'),util[_0xf06f('0x19')](_0x3d51f8,{'showHidden':![],'depth':null}));}};module[_0xf06f('0x41')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 39c70f6..6cd7de7 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 _0x282b=['prototype','log','format','%s|%s','membername','queue','exten','calleridnum','join','addTime','seconds','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','interface','isNil','assign','emit','channels','destchannel','calleridname','destcalleridnum','destcalleridname','accountcode','destaccountcode','channel','uniqueid','destuniqueid','destexten','voiceQueues','inbound','mandatoryDisposition','agent','called','custom:agentcalled','user:%s','user:called','CALLED','error','holdtime','ringtime','connect','agentconnectAt','agentcalledAt','custom:agentconnect','user:agentconnect','CONNECT','stack','find','onhold','updateStatusRealtime','agentringnoanswerAt','RINGNOANSWER','syncQueueCallerAbandon','position','originalposition','abandoned','custom:agentqueuecallerabandon','talktime','reason','complete','acw','acwTimeout','agentcompleteAt','COMPLETE','clear','cause','answered_elsewhere','custom:agentcomplete','HANGUP','custom:voiceAgentReport','cause-txt','user:save','syncAttendedTransfer','ATTENDED','secondtransfereruniqueid','transfer','transfertargetchannel','recalculate','transfererchannel','BLIND','transfereeuniqueid','extension','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','keys','variable','includes','value','exports','lodash','moment','util','ioredis','../../../config/environment','../ami','defaults','redis','localhost','socket.io-emitter','agents','variables','agentcalled','syncAgentCalled','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','attendedtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop'];(function(_0x28288a,_0x39866c){var _0x358327=function(_0x1e932d){while(--_0x1e932d){_0x28288a['push'](_0x28288a['shift']());}};_0x358327(++_0x39866c);}(_0x282b,0xec));var _0xb282=function(_0xbe0aaa,_0x118955){_0xbe0aaa=_0xbe0aaa-0x0;var _0x2ba546=_0x282b[_0xbe0aaa];return _0x2ba546;};'use strict';var _=require(_0xb282('0x0'));var moment=require(_0xb282('0x1'));var util=require(_0xb282('0x2'));var Redis=require(_0xb282('0x3'));var config=require(_0xb282('0x4'));var logger=require('../../../config/logger')('ami');var ami=require(_0xb282('0x5'));config['redis']=_[_0xb282('0x6')](config[_0xb282('0x7')],{'host':_0xb282('0x8'),'port':0x18eb});var io=require(_0xb282('0x9'))(new Redis(config[_0xb282('0x7')]));function VoiceAgentReport(_0x33635f){this['voiceQueues']=_0x33635f['voiceQueues'];this[_0xb282('0xa')]=_0x33635f[_0xb282('0xa')];this['channels']={};this[_0xb282('0xb')]={};ami['on'](_0xb282('0xc'),this[_0xb282('0xd')][_0xb282('0xe')](this));ami['on']('agentconnect',this['syncAgentConnect'][_0xb282('0xe')](this));ami['on'](_0xb282('0xf'),this[_0xb282('0x10')][_0xb282('0xe')](this));ami['on'](_0xb282('0x11'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0xb282('0x12'),this[_0xb282('0x13')][_0xb282('0xe')](this));ami['on'](_0xb282('0x14'),this[_0xb282('0x15')]['bind'](this));ami['on'](_0xb282('0x16'),this['syncHangup'][_0xb282('0xe')](this));ami['on'](_0xb282('0x17'),this['syncAttendedTransfer']['bind'](this));ami['on']('blindtransfer',this[_0xb282('0x18')][_0xb282('0xe')](this));ami['on'](_0xb282('0x19'),this[_0xb282('0x1a')][_0xb282('0xe')](this));ami['on']('musiconholdstop',this[_0xb282('0x1b')][_0xb282('0xe')](this));}VoiceAgentReport[_0xb282('0x1c')][_0xb282('0x1d')]=function(_0x3f8a3f,_0x492d20){logger['info'](util[_0xb282('0x1e')](_0xb282('0x1f'),_0x3f8a3f,[_0x492d20['uniqueid'],_0x492d20[_0xb282('0x20')],_0x492d20[_0xb282('0x21')],_0x492d20[_0xb282('0x22')],_0x492d20[_0xb282('0x23')]][_0xb282('0x24')]('|')));};VoiceAgentReport['prototype'][_0xb282('0x25')]=function(_0x16a656,_0x1f3e12){return moment(_0x16a656)['add'](_0x1f3e12,_0xb282('0x26'))[_0xb282('0x1e')](_0xb282('0x27'));};VoiceAgentReport[_0xb282('0x1c')][_0xb282('0x28')]=function(_0x56645f,_0x4d624f){return moment(_0x56645f)[_0xb282('0x29')](moment(_0x4d624f),_0xb282('0x26'));};VoiceAgentReport['prototype']['syncAgentCalled']=function(_0x34774d){try{var _0x114f77=this[_0xb282('0xa')][_0x34774d[_0xb282('0x2a')]];if(!_[_0xb282('0x2b')](_0x114f77)){_0x114f77=_[_0xb282('0x2c')](_0x114f77,{'queue':_0x34774d['queue'],'destconnectedlinenum':_0x34774d[_0xb282('0x23')]});io[_0xb282('0x2d')]('user:save',_0x114f77);}var _0x22d895=this[_0xb282('0x2e')][_0x34774d[_0xb282('0x2f')]]={'agentcalledAt':moment()[_0xb282('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'calleridnum':_0x34774d[_0xb282('0x23')],'calleridname':_0x34774d[_0xb282('0x30')],'connectedlinenum':_0x34774d[_0xb282('0x31')],'connectedlinename':_0x34774d[_0xb282('0x32')],'accountcode':_0x34774d[_0xb282('0x33')],'destaccountcode':_0x34774d[_0xb282('0x34')],'channel':_0x34774d[_0xb282('0x35')],'destchannel':_0x34774d['destchannel'],'uniqueid':_0x34774d[_0xb282('0x36')],'destuniqueid':_0x34774d[_0xb282('0x37')],'destcalleridnum':_0x34774d[_0xb282('0x31')],'destcalleridname':_0x34774d[_0xb282('0x32')],'destexten':_0x34774d[_0xb282('0x38')],'context':_0x34774d['context'],'exten':_0x34774d[_0xb282('0x22')],'priority':_0x34774d['priority'],'queue':_0x34774d[_0xb282('0x21')],'type':this[_0xb282('0x39')][_0x34774d[_0xb282('0x21')]]?this['voiceQueues'][_0x34774d[_0xb282('0x21')]]['type']||_0xb282('0x3a'):_0xb282('0x3a'),'interface':_0x34774d[_0xb282('0x2a')],'mandatoryDisposition':this[_0xb282('0x39')][_0x34774d[_0xb282('0x21')]][_0xb282('0x3b')]||0x0,'membername':_0x34774d['membername'],'agentconnect':![],'agentconnectAt':null,'holdtime':0x0,'ringtime':0x0,'agentcomplete':![],'agentcompleteAt':null,'talktime':0x0,'agentringnoanswer':![],'agentringnoanswerAt':null,'reason':_0xb282('0x3c'),'transfer':![],'transferAt':null,'transfertype':null,'transferuniqueid':null,'transfercontext':null,'transferextension':null,'position':null,'originalposition':null,'cause':'','cause-txt':'','UserId':this[_0xb282('0xa')][_0x34774d['interface']]?this['agents'][_0x34774d[_0xb282('0x2a')]]['id']:null,'lastevent':_0xb282('0x3d'),'agentacw':![],'acwtime':0x0,'variables':this[_0xb282('0xb')][_0x34774d['channel']]?this['variables'][_0x34774d['channel']]:{}};ami[_0xb282('0x2d')](_0xb282('0x3e'),_0x22d895);io['to'](util[_0xb282('0x1e')](_0xb282('0x3f'),_0x22d895[_0xb282('0x20')]))[_0xb282('0x2d')](_0xb282('0x40'),_0x22d895);this['log'](_0xb282('0x41'),this['channels'][_0x34774d[_0xb282('0x2f')]]);}catch(_0x45f9d9){logger[_0xb282('0x42')](_0x45f9d9['stack']);}};VoiceAgentReport[_0xb282('0x1c')]['syncAgentConnect']=function(_0x3bd325){try{var _0x13eb0f=this[_0xb282('0x2e')][_0x3bd325[_0xb282('0x2f')]];if(!_['isNil'](_0x13eb0f)){_0x13eb0f=_['assign'](_0x13eb0f,{'holdtime':parseInt(_0x3bd325[_0xb282('0x43')],0xa),'ringtime':parseInt(_0x3bd325[_0xb282('0x44')],0xa),'agentconnect':!![],'lastevent':_0xb282('0x45')});_0x13eb0f[_0xb282('0x46')]=this['addTime'](_0x13eb0f[_0xb282('0x47')],_0x13eb0f['ringtime']);ami[_0xb282('0x2d')](_0xb282('0x48'),_0x13eb0f);io['to'](util['format'](_0xb282('0x3f'),_0x13eb0f[_0xb282('0x20')]))[_0xb282('0x2d')](_0xb282('0x49'),_0x13eb0f);this[_0xb282('0x1d')](_0xb282('0x4a'),_0x13eb0f);}}catch(_0x43e87e){logger[_0xb282('0x42')](_0x43e87e[_0xb282('0x4b')]);}};VoiceAgentReport[_0xb282('0x1c')][_0xb282('0x1a')]=function(_0x91fe43){try{var _0x1caff0=_[_0xb282('0x4c')](this[_0xb282('0x2e')],{'channel':_0x91fe43[_0xb282('0x35')],'agentconnect':!![]});if(!_[_0xb282('0x2b')](_0x1caff0)){if(!_[_0xb282('0x2b')](this['agents'][_0x1caff0[_0xb282('0x2a')]])){this['agents'][_0x1caff0[_0xb282('0x2a')]][_0xb282('0x4d')]=!![];this[_0xb282('0xa')][_0x1caff0[_0xb282('0x2a')]][_0xb282('0x4e')]();}}}catch(_0x3ddf56){logger['error'](_0x3ddf56['stack']);}};VoiceAgentReport[_0xb282('0x1c')]['syncMusicOnHoldStop']=function(_0x1a2dc5){try{var _0x273c3e=_['find'](this[_0xb282('0x2e')],{'channel':_0x1a2dc5[_0xb282('0x35')],'agentconnect':!![]});if(!_[_0xb282('0x2b')](_0x273c3e)){if(!_['isNil'](this['agents'][_0x273c3e[_0xb282('0x2a')]])){this['agents'][_0x273c3e[_0xb282('0x2a')]][_0xb282('0x4d')]=![];this[_0xb282('0xa')][_0x273c3e[_0xb282('0x2a')]][_0xb282('0x4e')]();}}}catch(_0x99a380){logger['error'](_0x99a380[_0xb282('0x4b')]);}};VoiceAgentReport[_0xb282('0x1c')][_0xb282('0x10')]=function(_0x5862e5){try{var _0xacf42e=this['channels'][_0x5862e5[_0xb282('0x2f')]];if(!_['isNil'](_0xacf42e)){_0xacf42e=_[_0xb282('0x2c')](_0xacf42e,{'ringtime':parseInt(_0x5862e5['ringtime'],0xa)/0x3e8,'agentringnoanswer':!![],'reason':'rejected','lastevent':'rejected'});_0xacf42e[_0xb282('0x4f')]=this[_0xb282('0x25')](_0xacf42e[_0xb282('0x47')],_0xacf42e[_0xb282('0x44')]);ami['emit']('custom:agentringnoanswer',_0xacf42e);this['log'](_0xb282('0x50'),_0xacf42e);}}catch(_0x255ad5){logger[_0xb282('0x42')](_0x255ad5[_0xb282('0x4b')]);}};VoiceAgentReport['prototype'][_0xb282('0x51')]=function(_0x32bcdb){try{for(var _0x552703 in this[_0xb282('0x2e')]){var _0x9f4d79=this[_0xb282('0x2e')][_0x552703];if(!_[_0xb282('0x2b')](_0x9f4d79)&&_0x9f4d79[_0xb282('0x35')]==_0x32bcdb['channel']){_0x9f4d79=_[_0xb282('0x2c')](_0x9f4d79,{'holdtime':parseInt(_0x32bcdb[_0xb282('0x43')],0xa),'position':parseInt(_0x32bcdb[_0xb282('0x52')],0xa),'originalposition':parseInt(_0x32bcdb[_0xb282('0x53')],0xa),'agentringnoanswer':!![],'agentringnoanswerAt':moment()[_0xb282('0x1e')](_0xb282('0x27')),'reason':'abandoned','lastevent':_0xb282('0x54')});ami['emit'](_0xb282('0x55'),_0x9f4d79);this[_0xb282('0x1d')]('CALLERABANDON',_0x9f4d79);}}}catch(_0x33b658){logger[_0xb282('0x42')](_0x33b658[_0xb282('0x4b')]);}};VoiceAgentReport['prototype']['syncAgentComplete']=function(_0x1028b9){try{var _0x2e2966=this[_0xb282('0x2e')][_0x1028b9['destchannel']];if(!_[_0xb282('0x2b')](_0x2e2966)){_0x2e2966=_['assign'](_0x2e2966,{'talktime':parseInt(_0x1028b9[_0xb282('0x56')],0xa),'reason':_0x1028b9[_0xb282('0x57')]=='transfer'?_0xb282('0x3c'):_0x1028b9['reason'],'agentcomplete':!![],'lastevent':_0xb282('0x58'),'agentacw':this[_0xb282('0x39')][_0x2e2966[_0xb282('0x21')]]&&this[_0xb282('0x39')][_0x2e2966[_0xb282('0x21')]][_0xb282('0x59')]?!![]:![],'acwtime':this['voiceQueues'][_0x2e2966[_0xb282('0x21')]]&&this['voiceQueues'][_0x2e2966[_0xb282('0x21')]][_0xb282('0x59')]?this['voiceQueues'][_0x2e2966['queue']][_0xb282('0x5a')]:0x0});_0x2e2966[_0xb282('0x5b')]=this[_0xb282('0x25')](_0x2e2966['agentconnectAt'],_0x2e2966['talktime']);this[_0xb282('0x1d')](_0xb282('0x5c'),_0x2e2966);}}catch(_0x3716b0){logger['error'](_0x3716b0[_0xb282('0x4b')]);}};VoiceAgentReport['prototype'][_0xb282('0x5d')]=function(_0x1de487){try{switch(_0x1de487[_0xb282('0x5e')]){case 0x1a:_0x1de487=_[_0xb282('0x2c')](_0x1de487,{'agentringnoanswer':!![],'reason':_0xb282('0x5f'),'lastevent':_0xb282('0x5f')});var _0x1eb2bd=_['find'](this[_0xb282('0x2e')],{'channel':_0x1de487[_0xb282('0x35')],'agentconnect':!![]});if(!_[_0xb282('0x2b')](_0x1eb2bd)){_0x1de487=_['assign'](_0x1de487,{'agentringnoanswerAt':_0x1eb2bd['agentconnectAt'],'answeredelsewheremembername':_0x1eb2bd[_0xb282('0x20')],'answeredelsewheredestinationuniqueid':_0x1eb2bd[_0xb282('0x37')]});}ami[_0xb282('0x2d')]('custom:agentansweredelsewhere',_0x1de487);break;}if(_0x1de487['agentcomplete']){ami[_0xb282('0x2d')](_0xb282('0x60'),_0x1de487);io['to'](util['format'](_0xb282('0x3f'),_0x1de487[_0xb282('0x20')]))[_0xb282('0x2d')]('user:agentcomplete',_0x1de487);}this[_0xb282('0x1d')](_0xb282('0x61'),_0x1de487);ami['emit'](_0xb282('0x62'),_0x1de487);if(this[_0xb282('0x2e')][_0x1de487[_0xb282('0x2f')]]){delete this[_0xb282('0x2e')][_0x1de487['destchannel']];}}catch(_0x4a129d){logger[_0xb282('0x42')](_0x4a129d);}};VoiceAgentReport[_0xb282('0x1c')]['syncHangup']=function(_0x3cdcf5){try{var _0x1b0e1f=this[_0xb282('0x2e')][_0x3cdcf5[_0xb282('0x35')]];if(!_[_0xb282('0x2b')](_0x1b0e1f)){_0x1b0e1f=_[_0xb282('0x2c')](_0x1b0e1f,{'cause':parseInt(_0x3cdcf5[_0xb282('0x5e')],0xa),'cause-txt':_0x3cdcf5[_0xb282('0x63')]});if(_0x1b0e1f['recalculate']){_0x1b0e1f=_[_0xb282('0x2c')](_0x1b0e1f,{'agentcomplete':!![],'agentcompleteAt':moment()[_0xb282('0x1e')](_0xb282('0x27')),'lastevent':'complete','agentacw':this[_0xb282('0x39')][_0x1b0e1f[_0xb282('0x21')]]&&this['voiceQueues'][_0x1b0e1f['queue']][_0xb282('0x59')]?!![]:![],'acwtime':this[_0xb282('0x39')][_0x1b0e1f[_0xb282('0x21')]]&&this[_0xb282('0x39')][_0x1b0e1f[_0xb282('0x21')]][_0xb282('0x59')]?this[_0xb282('0x39')][_0x1b0e1f[_0xb282('0x21')]][_0xb282('0x5a')]:0x0});_0x1b0e1f[_0xb282('0x56')]=this[_0xb282('0x28')](_0x1b0e1f[_0xb282('0x5b')],_0x1b0e1f[_0xb282('0x46')]);}var _0x2eae62=this[_0xb282('0xa')][_0x1b0e1f[_0xb282('0x2a')]];if(!_['isNil'](_0x2eae62)){_0x2eae62=_[_0xb282('0x2c')](_0x2eae62,{'queue':null,'destconnectedlinenum':null});io[_0xb282('0x2d')](_0xb282('0x64'),_0x2eae62);}setTimeout(this[_0xb282('0x5d')][_0xb282('0xe')](this,_0x1b0e1f),0x3e8);}if(this[_0xb282('0xb')][_0x3cdcf5[_0xb282('0x35')]]){delete this[_0xb282('0xb')][_0x3cdcf5[_0xb282('0x35')]];}}catch(_0x2d237e){logger[_0xb282('0x42')](_0x2d237e['stack']);}};VoiceAgentReport[_0xb282('0x1c')][_0xb282('0x65')]=function(_0x27076b){try{var _0x3e8ef9=this[_0xb282('0x2e')][_0x27076b['origtransfererchannel']];if(!_['isNil'](_0x3e8ef9)){_0x3e8ef9=_[_0xb282('0x2c')](_0x3e8ef9,{'transfer':!![],'transferAt':moment()[_0xb282('0x1e')](_0xb282('0x27')),'transfertype':_0xb282('0x66'),'agentcomplete':!![],'agentcompleteAt':moment()[_0xb282('0x1e')](_0xb282('0x27')),'transferuniqueid':_0x27076b[_0xb282('0x67')],'transfercontext':_0x27076b['secondtransfererexten'],'transferextension':_0x27076b['secondtransferercontext'],'reason':_0xb282('0x68'),'lastevent':_0xb282('0x58'),'agentacw':this['voiceQueues'][_0x3e8ef9['queue']]&&this[_0xb282('0x39')][_0x3e8ef9[_0xb282('0x21')]][_0xb282('0x59')]?!![]:![],'acwtime':this[_0xb282('0x39')][_0x3e8ef9[_0xb282('0x21')]]&&this[_0xb282('0x39')][_0x3e8ef9[_0xb282('0x21')]]['acw']?this[_0xb282('0x39')][_0x3e8ef9[_0xb282('0x21')]][_0xb282('0x5a')]:0x0});_0x3e8ef9[_0xb282('0x56')]=this[_0xb282('0x28')](_0x3e8ef9[_0xb282('0x5b')],_0x3e8ef9[_0xb282('0x46')]);this[_0xb282('0x1d')](_0xb282('0x66'),_0x3e8ef9);}if(!_[_0xb282('0x2b')](this['channels'][_0x27076b[_0xb282('0x69')]])){this[_0xb282('0x2e')][_0x27076b[_0xb282('0x69')]][_0xb282('0x6a')]=!![];}}catch(_0xc5ed41){logger[_0xb282('0x42')](_0xc5ed41[_0xb282('0x4b')]);}};VoiceAgentReport[_0xb282('0x1c')]['syncBlindTransfer']=function(_0x199c02){try{var _0x400f2a=this[_0xb282('0x2e')][_0x199c02[_0xb282('0x6b')]];if(!_[_0xb282('0x2b')](_0x400f2a)){_0x400f2a=_[_0xb282('0x2c')](_0x400f2a,{'transfer':!![],'transferAt':moment()['format'](_0xb282('0x27')),'transfertype':_0xb282('0x6c'),'transferuniqueid':_0x199c02[_0xb282('0x6d')],'transfercontext':_0x199c02['context'],'transferextension':_0x199c02[_0xb282('0x6e')],'agentcomplete':!![],'agentcompleteAt':moment()[_0xb282('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xb282('0x68'),'lastevent':_0xb282('0x58'),'agentacw':this[_0xb282('0x39')][_0x400f2a[_0xb282('0x21')]]&&this[_0xb282('0x39')][_0x400f2a[_0xb282('0x21')]][_0xb282('0x59')]?!![]:![],'acwtime':this['voiceQueues'][_0x400f2a['queue']]&&this[_0xb282('0x39')][_0x400f2a['queue']][_0xb282('0x59')]?this[_0xb282('0x39')][_0x400f2a[_0xb282('0x21')]][_0xb282('0x5a')]:0x0});_0x400f2a[_0xb282('0x6a')]=!![];this['log'](_0xb282('0x6c'),_0x400f2a);}}catch(_0x1fb9c2){logger[_0xb282('0x42')](_0x1fb9c2['stack']);}};VoiceAgentReport[_0xb282('0x1c')][_0xb282('0x15')]=function(_0x37c951){var _0x2a0042=[_0xb282('0x6f'),_0xb282('0x70'),'rtpaudioqosjitter',_0xb282('0x71'),_0xb282('0x72'),_0xb282('0x73'),_0xb282('0x74'),'rtpaudioqosrttbridged',_0xb282('0x75'),_0xb282('0x76'),_0xb282('0x77'),_0xb282('0x78'),_0xb282('0x79'),_0xb282('0x7a'),_0xb282('0x7b'),_0xb282('0x7c'),_0xb282('0x20'),_0xb282('0x7d'),_0xb282('0x7e')];try{var _0x5dab16=_[_0xb282('0x7f')](_0x37c951[_0xb282('0x80')])[0x0];if(!_['isNil'](_0x5dab16)&&!_[_0xb282('0x81')](_0x2a0042,_0x5dab16)){if(!this[_0xb282('0xb')][_0x37c951[_0xb282('0x35')]]){this[_0xb282('0xb')][_0x37c951[_0xb282('0x35')]]={};}this[_0xb282('0xb')][_0x37c951[_0xb282('0x35')]][_0x5dab16]=_0x37c951[_0xb282('0x82')];}}catch(_0x463896){logger[_0xb282('0x42')](_0x463896['stack']);}};module[_0xb282('0x83')]=VoiceAgentReport; \ No newline at end of file +var _0x8f4c=['rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','keys','variable','value','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','voiceQueues','agents','channels','variables','agentcalled','bind','agentconnect','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','syncMusicOnHoldStop','prototype','log','info','format','%s|%s','uniqueid','membername','queue','exten','join','addTime','add','seconds','diffTime','syncAgentCalled','isNil','assign','calleridnum','user:save','destchannel','YYYY-MM-DD\x20HH:mm:ss','calleridname','destcalleridnum','accountcode','destaccountcode','channel','destuniqueid','context','priority','inbound','interface','mandatoryDisposition','agent','called','emit','custom:agentcalled','user:%s','user:called','CALLED','error','stack','holdtime','ringtime','connect','agentconnectAt','agentcalledAt','custom:agentconnect','user:agentconnect','CONNECT','find','onhold','updateStatusRealtime','rejected','agentringnoanswerAt','RINGNOANSWER','position','originalposition','abandoned','custom:agentqueuecallerabandon','CALLERABANDON','talktime','reason','transfer','complete','agentcompleteAt','COMPLETE','clear','cause','answered_elsewhere','user:agentcomplete','cause-txt','recalculate','acw','acwTimeout','origtransfererchannel','secondtransfereruniqueid','secondtransfererexten','secondtransferercontext','BLIND','transfereeuniqueid','extension','rtpaudioqos','rtpaudioqosbridged'];(function(_0x742178,_0x5a5533){var _0x15b773=function(_0x138d64){while(--_0x138d64){_0x742178['push'](_0x742178['shift']());}};_0x15b773(++_0x5a5533);}(_0x8f4c,0x113));var _0xc8f4=function(_0x482fc8,_0x4d40ce){_0x482fc8=_0x482fc8-0x0;var _0x1ba080=_0x8f4c[_0x482fc8];return _0x1ba080;};'use strict';var _=require(_0xc8f4('0x0'));var moment=require(_0xc8f4('0x1'));var util=require(_0xc8f4('0x2'));var Redis=require(_0xc8f4('0x3'));var config=require(_0xc8f4('0x4'));var logger=require(_0xc8f4('0x5'))('ami');var ami=require(_0xc8f4('0x6'));config[_0xc8f4('0x7')]=_[_0xc8f4('0x8')](config['redis'],{'host':_0xc8f4('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceAgentReport(_0x520063){this[_0xc8f4('0xa')]=_0x520063['voiceQueues'];this[_0xc8f4('0xb')]=_0x520063[_0xc8f4('0xb')];this[_0xc8f4('0xc')]={};this[_0xc8f4('0xd')]={};ami['on'](_0xc8f4('0xe'),this['syncAgentCalled'][_0xc8f4('0xf')](this));ami['on'](_0xc8f4('0x10'),this[_0xc8f4('0x11')][_0xc8f4('0xf')](this));ami['on']('agentringnoanswer',this[_0xc8f4('0x12')]['bind'](this));ami['on'](_0xc8f4('0x13'),this[_0xc8f4('0x14')][_0xc8f4('0xf')](this));ami['on'](_0xc8f4('0x15'),this[_0xc8f4('0x16')]['bind'](this));ami['on'](_0xc8f4('0x17'),this[_0xc8f4('0x18')][_0xc8f4('0xf')](this));ami['on'](_0xc8f4('0x19'),this[_0xc8f4('0x1a')][_0xc8f4('0xf')](this));ami['on']('attendedtransfer',this[_0xc8f4('0x1b')][_0xc8f4('0xf')](this));ami['on'](_0xc8f4('0x1c'),this[_0xc8f4('0x1d')][_0xc8f4('0xf')](this));ami['on']('musiconholdstart',this[_0xc8f4('0x1e')]['bind'](this));ami['on']('musiconholdstop',this[_0xc8f4('0x1f')][_0xc8f4('0xf')](this));}VoiceAgentReport[_0xc8f4('0x20')][_0xc8f4('0x21')]=function(_0x4763c1,_0x374761){logger[_0xc8f4('0x22')](util[_0xc8f4('0x23')](_0xc8f4('0x24'),_0x4763c1,[_0x374761[_0xc8f4('0x25')],_0x374761[_0xc8f4('0x26')],_0x374761[_0xc8f4('0x27')],_0x374761[_0xc8f4('0x28')],_0x374761['calleridnum']][_0xc8f4('0x29')]('|')));};VoiceAgentReport[_0xc8f4('0x20')][_0xc8f4('0x2a')]=function(_0x208bcb,_0xdbc027){return moment(_0x208bcb)[_0xc8f4('0x2b')](_0xdbc027,_0xc8f4('0x2c'))[_0xc8f4('0x23')]('YYYY-MM-DD\x20HH:mm:ss');};VoiceAgentReport[_0xc8f4('0x20')][_0xc8f4('0x2d')]=function(_0x3195ff,_0x1d159e){return moment(_0x3195ff)['diff'](moment(_0x1d159e),_0xc8f4('0x2c'));};VoiceAgentReport['prototype'][_0xc8f4('0x2e')]=function(_0x540b25){try{var _0x177a44=this[_0xc8f4('0xb')][_0x540b25['interface']];if(!_[_0xc8f4('0x2f')](_0x177a44)){_0x177a44=_[_0xc8f4('0x30')](_0x177a44,{'queue':_0x540b25[_0xc8f4('0x27')],'destconnectedlinenum':_0x540b25[_0xc8f4('0x31')]});io['emit'](_0xc8f4('0x32'),_0x177a44);}var _0x3484b6=this['channels'][_0x540b25[_0xc8f4('0x33')]]={'agentcalledAt':moment()[_0xc8f4('0x23')](_0xc8f4('0x34')),'calleridnum':_0x540b25[_0xc8f4('0x31')],'calleridname':_0x540b25[_0xc8f4('0x35')],'connectedlinenum':_0x540b25[_0xc8f4('0x36')],'connectedlinename':_0x540b25['destcalleridname'],'accountcode':_0x540b25[_0xc8f4('0x37')],'destaccountcode':_0x540b25[_0xc8f4('0x38')],'channel':_0x540b25[_0xc8f4('0x39')],'destchannel':_0x540b25['destchannel'],'uniqueid':_0x540b25[_0xc8f4('0x25')],'destuniqueid':_0x540b25[_0xc8f4('0x3a')],'destcalleridnum':_0x540b25['destcalleridnum'],'destcalleridname':_0x540b25['destcalleridname'],'destexten':_0x540b25['destexten'],'context':_0x540b25[_0xc8f4('0x3b')],'exten':_0x540b25[_0xc8f4('0x28')],'priority':_0x540b25[_0xc8f4('0x3c')],'queue':_0x540b25[_0xc8f4('0x27')],'type':this[_0xc8f4('0xa')][_0x540b25[_0xc8f4('0x27')]]?this[_0xc8f4('0xa')][_0x540b25[_0xc8f4('0x27')]]['type']||_0xc8f4('0x3d'):_0xc8f4('0x3d'),'interface':_0x540b25[_0xc8f4('0x3e')],'mandatoryDisposition':this['voiceQueues'][_0x540b25[_0xc8f4('0x27')]][_0xc8f4('0x3f')]||0x0,'membername':_0x540b25['membername'],'agentconnect':![],'agentconnectAt':null,'holdtime':0x0,'ringtime':0x0,'agentcomplete':![],'agentcompleteAt':null,'talktime':0x0,'agentringnoanswer':![],'agentringnoanswerAt':null,'reason':_0xc8f4('0x40'),'transfer':![],'transferAt':null,'transfertype':null,'transferuniqueid':null,'transfercontext':null,'transferextension':null,'position':null,'originalposition':null,'cause':'','cause-txt':'','UserId':this[_0xc8f4('0xb')][_0x540b25[_0xc8f4('0x3e')]]?this['agents'][_0x540b25[_0xc8f4('0x3e')]]['id']:null,'lastevent':_0xc8f4('0x41'),'agentacw':![],'acwtime':0x0,'variables':this[_0xc8f4('0xd')][_0x540b25['channel']]?this[_0xc8f4('0xd')][_0x540b25[_0xc8f4('0x39')]]:{}};ami[_0xc8f4('0x42')](_0xc8f4('0x43'),_0x3484b6);io['to'](util[_0xc8f4('0x23')](_0xc8f4('0x44'),_0x3484b6[_0xc8f4('0x26')]))[_0xc8f4('0x42')](_0xc8f4('0x45'),_0x3484b6);this[_0xc8f4('0x21')](_0xc8f4('0x46'),this[_0xc8f4('0xc')][_0x540b25[_0xc8f4('0x33')]]);}catch(_0x12e63b){logger[_0xc8f4('0x47')](_0x12e63b[_0xc8f4('0x48')]);}};VoiceAgentReport['prototype'][_0xc8f4('0x11')]=function(_0x5424cc){try{var _0x7d06d3=this['channels'][_0x5424cc[_0xc8f4('0x33')]];if(!_[_0xc8f4('0x2f')](_0x7d06d3)){_0x7d06d3=_[_0xc8f4('0x30')](_0x7d06d3,{'holdtime':parseInt(_0x5424cc[_0xc8f4('0x49')],0xa),'ringtime':parseInt(_0x5424cc[_0xc8f4('0x4a')],0xa),'agentconnect':!![],'lastevent':_0xc8f4('0x4b')});_0x7d06d3[_0xc8f4('0x4c')]=this['addTime'](_0x7d06d3[_0xc8f4('0x4d')],_0x7d06d3[_0xc8f4('0x4a')]);ami[_0xc8f4('0x42')](_0xc8f4('0x4e'),_0x7d06d3);io['to'](util['format'](_0xc8f4('0x44'),_0x7d06d3[_0xc8f4('0x26')]))[_0xc8f4('0x42')](_0xc8f4('0x4f'),_0x7d06d3);this[_0xc8f4('0x21')](_0xc8f4('0x50'),_0x7d06d3);}}catch(_0xca3cc){logger[_0xc8f4('0x47')](_0xca3cc[_0xc8f4('0x48')]);}};VoiceAgentReport[_0xc8f4('0x20')][_0xc8f4('0x1e')]=function(_0xd56415){try{var _0x5257e3=_[_0xc8f4('0x51')](this[_0xc8f4('0xc')],{'channel':_0xd56415[_0xc8f4('0x39')],'agentconnect':!![]});if(!_[_0xc8f4('0x2f')](_0x5257e3)){if(!_['isNil'](this['agents'][_0x5257e3[_0xc8f4('0x3e')]])){this[_0xc8f4('0xb')][_0x5257e3['interface']][_0xc8f4('0x52')]=!![];this[_0xc8f4('0xb')][_0x5257e3['interface']]['updateStatusRealtime']();}}}catch(_0x3c8569){logger[_0xc8f4('0x47')](_0x3c8569[_0xc8f4('0x48')]);}};VoiceAgentReport[_0xc8f4('0x20')][_0xc8f4('0x1f')]=function(_0x23c99f){try{var _0x4de3d1=_['find'](this[_0xc8f4('0xc')],{'channel':_0x23c99f[_0xc8f4('0x39')],'agentconnect':!![]});if(!_[_0xc8f4('0x2f')](_0x4de3d1)){if(!_['isNil'](this['agents'][_0x4de3d1['interface']])){this['agents'][_0x4de3d1['interface']][_0xc8f4('0x52')]=![];this[_0xc8f4('0xb')][_0x4de3d1[_0xc8f4('0x3e')]][_0xc8f4('0x53')]();}}}catch(_0x1a1b20){logger[_0xc8f4('0x47')](_0x1a1b20['stack']);}};VoiceAgentReport[_0xc8f4('0x20')][_0xc8f4('0x12')]=function(_0x586e0b){try{var _0x4a6fd5=this[_0xc8f4('0xc')][_0x586e0b[_0xc8f4('0x33')]];if(!_[_0xc8f4('0x2f')](_0x4a6fd5)){_0x4a6fd5=_[_0xc8f4('0x30')](_0x4a6fd5,{'ringtime':parseInt(_0x586e0b['ringtime'],0xa)/0x3e8,'agentringnoanswer':!![],'reason':'rejected','lastevent':_0xc8f4('0x54')});_0x4a6fd5[_0xc8f4('0x55')]=this[_0xc8f4('0x2a')](_0x4a6fd5[_0xc8f4('0x4d')],_0x4a6fd5[_0xc8f4('0x4a')]);ami[_0xc8f4('0x42')]('custom:agentringnoanswer',_0x4a6fd5);this['log'](_0xc8f4('0x56'),_0x4a6fd5);}}catch(_0x447473){logger[_0xc8f4('0x47')](_0x447473[_0xc8f4('0x48')]);}};VoiceAgentReport[_0xc8f4('0x20')][_0xc8f4('0x14')]=function(_0x1405f0){try{for(var _0x1798a1 in this[_0xc8f4('0xc')]){var _0x5b4035=this['channels'][_0x1798a1];if(!_[_0xc8f4('0x2f')](_0x5b4035)&&_0x5b4035[_0xc8f4('0x39')]==_0x1405f0[_0xc8f4('0x39')]){_0x5b4035=_[_0xc8f4('0x30')](_0x5b4035,{'holdtime':parseInt(_0x1405f0[_0xc8f4('0x49')],0xa),'position':parseInt(_0x1405f0[_0xc8f4('0x57')],0xa),'originalposition':parseInt(_0x1405f0[_0xc8f4('0x58')],0xa),'agentringnoanswer':!![],'agentringnoanswerAt':moment()[_0xc8f4('0x23')](_0xc8f4('0x34')),'reason':_0xc8f4('0x59'),'lastevent':_0xc8f4('0x59')});ami[_0xc8f4('0x42')](_0xc8f4('0x5a'),_0x5b4035);this['log'](_0xc8f4('0x5b'),_0x5b4035);}}}catch(_0x345576){logger[_0xc8f4('0x47')](_0x345576[_0xc8f4('0x48')]);}};VoiceAgentReport['prototype'][_0xc8f4('0x16')]=function(_0x450059){try{var _0x4b4de3=this['channels'][_0x450059[_0xc8f4('0x33')]];if(!_['isNil'](_0x4b4de3)){_0x4b4de3=_[_0xc8f4('0x30')](_0x4b4de3,{'talktime':parseInt(_0x450059[_0xc8f4('0x5c')],0xa),'reason':_0x450059[_0xc8f4('0x5d')]==_0xc8f4('0x5e')?_0xc8f4('0x40'):_0x450059[_0xc8f4('0x5d')],'agentcomplete':!![],'lastevent':_0xc8f4('0x5f'),'agentacw':this[_0xc8f4('0xa')][_0x4b4de3[_0xc8f4('0x27')]]&&this[_0xc8f4('0xa')][_0x4b4de3[_0xc8f4('0x27')]]['acw']?!![]:![],'acwtime':this[_0xc8f4('0xa')][_0x4b4de3[_0xc8f4('0x27')]]&&this[_0xc8f4('0xa')][_0x4b4de3[_0xc8f4('0x27')]]['acw']?this[_0xc8f4('0xa')][_0x4b4de3['queue']]['acwTimeout']:0x0});_0x4b4de3[_0xc8f4('0x60')]=this[_0xc8f4('0x2a')](_0x4b4de3[_0xc8f4('0x4c')],_0x4b4de3[_0xc8f4('0x5c')]);this[_0xc8f4('0x21')](_0xc8f4('0x61'),_0x4b4de3);}}catch(_0x5aba71){logger['error'](_0x5aba71[_0xc8f4('0x48')]);}};VoiceAgentReport[_0xc8f4('0x20')][_0xc8f4('0x62')]=function(_0x137227){try{switch(_0x137227[_0xc8f4('0x63')]){case 0x1a:_0x137227=_[_0xc8f4('0x30')](_0x137227,{'agentringnoanswer':!![],'reason':_0xc8f4('0x64'),'lastevent':'answered_elsewhere'});var _0xaca3b9=_[_0xc8f4('0x51')](this['channels'],{'channel':_0x137227[_0xc8f4('0x39')],'agentconnect':!![]});if(!_[_0xc8f4('0x2f')](_0xaca3b9)){_0x137227=_[_0xc8f4('0x30')](_0x137227,{'agentringnoanswerAt':_0xaca3b9[_0xc8f4('0x4c')],'answeredelsewheremembername':_0xaca3b9[_0xc8f4('0x26')],'answeredelsewheredestinationuniqueid':_0xaca3b9[_0xc8f4('0x3a')]});}ami[_0xc8f4('0x42')]('custom:agentansweredelsewhere',_0x137227);break;}if(_0x137227[_0xc8f4('0x15')]){ami[_0xc8f4('0x42')]('custom:agentcomplete',_0x137227);io['to'](util['format'](_0xc8f4('0x44'),_0x137227['membername']))[_0xc8f4('0x42')](_0xc8f4('0x65'),_0x137227);}this['log']('HANGUP',_0x137227);ami['emit']('custom:voiceAgentReport',_0x137227);if(this['channels'][_0x137227['destchannel']]){delete this[_0xc8f4('0xc')][_0x137227['destchannel']];}}catch(_0x17e9d1){logger[_0xc8f4('0x47')](_0x17e9d1);}};VoiceAgentReport[_0xc8f4('0x20')][_0xc8f4('0x1a')]=function(_0x5ea840){try{var _0x3f2596=this[_0xc8f4('0xc')][_0x5ea840[_0xc8f4('0x39')]];if(!_[_0xc8f4('0x2f')](_0x3f2596)){_0x3f2596=_['assign'](_0x3f2596,{'cause':parseInt(_0x5ea840[_0xc8f4('0x63')],0xa),'cause-txt':_0x5ea840[_0xc8f4('0x66')]});if(_0x3f2596[_0xc8f4('0x67')]){_0x3f2596=_[_0xc8f4('0x30')](_0x3f2596,{'agentcomplete':!![],'agentcompleteAt':moment()['format'](_0xc8f4('0x34')),'lastevent':_0xc8f4('0x5f'),'agentacw':this['voiceQueues'][_0x3f2596[_0xc8f4('0x27')]]&&this[_0xc8f4('0xa')][_0x3f2596[_0xc8f4('0x27')]][_0xc8f4('0x68')]?!![]:![],'acwtime':this[_0xc8f4('0xa')][_0x3f2596[_0xc8f4('0x27')]]&&this['voiceQueues'][_0x3f2596[_0xc8f4('0x27')]][_0xc8f4('0x68')]?this[_0xc8f4('0xa')][_0x3f2596['queue']][_0xc8f4('0x69')]:0x0});_0x3f2596[_0xc8f4('0x5c')]=this[_0xc8f4('0x2d')](_0x3f2596['agentcompleteAt'],_0x3f2596[_0xc8f4('0x4c')]);}var _0x38a486=this[_0xc8f4('0xb')][_0x3f2596[_0xc8f4('0x3e')]];if(!_['isNil'](_0x38a486)){_0x38a486=_[_0xc8f4('0x30')](_0x38a486,{'queue':null,'destconnectedlinenum':null});io[_0xc8f4('0x42')]('user:save',_0x38a486);}setTimeout(this[_0xc8f4('0x62')][_0xc8f4('0xf')](this,_0x3f2596),0x3e8);}if(this['variables'][_0x5ea840[_0xc8f4('0x39')]]){delete this[_0xc8f4('0xd')][_0x5ea840[_0xc8f4('0x39')]];}}catch(_0x40ed61){logger[_0xc8f4('0x47')](_0x40ed61[_0xc8f4('0x48')]);}};VoiceAgentReport[_0xc8f4('0x20')][_0xc8f4('0x1b')]=function(_0x5a6cfe){try{var _0x2d363c=this[_0xc8f4('0xc')][_0x5a6cfe[_0xc8f4('0x6a')]];if(!_[_0xc8f4('0x2f')](_0x2d363c)){_0x2d363c=_[_0xc8f4('0x30')](_0x2d363c,{'transfer':!![],'transferAt':moment()['format'](_0xc8f4('0x34')),'transfertype':'ATTENDED','agentcomplete':!![],'agentcompleteAt':moment()[_0xc8f4('0x23')](_0xc8f4('0x34')),'transferuniqueid':_0x5a6cfe[_0xc8f4('0x6b')],'transfercontext':_0x5a6cfe[_0xc8f4('0x6c')],'transferextension':_0x5a6cfe[_0xc8f4('0x6d')],'reason':_0xc8f4('0x5e'),'lastevent':_0xc8f4('0x5f'),'agentacw':this[_0xc8f4('0xa')][_0x2d363c[_0xc8f4('0x27')]]&&this[_0xc8f4('0xa')][_0x2d363c[_0xc8f4('0x27')]]['acw']?!![]:![],'acwtime':this[_0xc8f4('0xa')][_0x2d363c[_0xc8f4('0x27')]]&&this[_0xc8f4('0xa')][_0x2d363c[_0xc8f4('0x27')]]['acw']?this['voiceQueues'][_0x2d363c[_0xc8f4('0x27')]]['acwTimeout']:0x0});_0x2d363c[_0xc8f4('0x5c')]=this['diffTime'](_0x2d363c[_0xc8f4('0x60')],_0x2d363c['agentconnectAt']);this['log']('ATTENDED',_0x2d363c);}if(!_['isNil'](this['channels'][_0x5a6cfe['transfertargetchannel']])){this[_0xc8f4('0xc')][_0x5a6cfe['transfertargetchannel']][_0xc8f4('0x67')]=!![];}}catch(_0x3ad7dd){logger[_0xc8f4('0x47')](_0x3ad7dd[_0xc8f4('0x48')]);}};VoiceAgentReport[_0xc8f4('0x20')]['syncBlindTransfer']=function(_0x181955){try{var _0x3bfc1c=this[_0xc8f4('0xc')][_0x181955['transfererchannel']];if(!_[_0xc8f4('0x2f')](_0x3bfc1c)){_0x3bfc1c=_[_0xc8f4('0x30')](_0x3bfc1c,{'transfer':!![],'transferAt':moment()[_0xc8f4('0x23')](_0xc8f4('0x34')),'transfertype':_0xc8f4('0x6e'),'transferuniqueid':_0x181955[_0xc8f4('0x6f')],'transfercontext':_0x181955[_0xc8f4('0x3b')],'transferextension':_0x181955[_0xc8f4('0x70')],'agentcomplete':!![],'agentcompleteAt':moment()['format'](_0xc8f4('0x34')),'reason':_0xc8f4('0x5e'),'lastevent':_0xc8f4('0x5f'),'agentacw':this[_0xc8f4('0xa')][_0x3bfc1c[_0xc8f4('0x27')]]&&this[_0xc8f4('0xa')][_0x3bfc1c[_0xc8f4('0x27')]][_0xc8f4('0x68')]?!![]:![],'acwtime':this[_0xc8f4('0xa')][_0x3bfc1c[_0xc8f4('0x27')]]&&this[_0xc8f4('0xa')][_0x3bfc1c['queue']][_0xc8f4('0x68')]?this[_0xc8f4('0xa')][_0x3bfc1c['queue']][_0xc8f4('0x69')]:0x0});_0x3bfc1c[_0xc8f4('0x67')]=!![];this['log'](_0xc8f4('0x6e'),_0x3bfc1c);}}catch(_0x2bbf57){logger['error'](_0x2bbf57['stack']);}};VoiceAgentReport[_0xc8f4('0x20')][_0xc8f4('0x18')]=function(_0x2d3e5c){var _0x59881d=[_0xc8f4('0x71'),_0xc8f4('0x72'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0xc8f4('0x73'),_0xc8f4('0x74'),_0xc8f4('0x75'),'rtpaudioqosrttbridged',_0xc8f4('0x76'),_0xc8f4('0x77'),_0xc8f4('0x78'),'bridgepvtcallid',_0xc8f4('0x79'),_0xc8f4('0x7a'),_0xc8f4('0x7b'),_0xc8f4('0x7c'),_0xc8f4('0x26'),_0xc8f4('0x7d'),_0xc8f4('0x7e')];try{var _0x319538=_[_0xc8f4('0x7f')](_0x2d3e5c[_0xc8f4('0x80')])[0x0];if(!_[_0xc8f4('0x2f')](_0x319538)&&!_['includes'](_0x59881d,_0x319538)){if(!this[_0xc8f4('0xd')][_0x2d3e5c['channel']]){this[_0xc8f4('0xd')][_0x2d3e5c[_0xc8f4('0x39')]]={};}this[_0xc8f4('0xd')][_0x2d3e5c[_0xc8f4('0x39')]][_0x319538]=_0x2d3e5c[_0xc8f4('0x81')];}}catch(_0x33f636){logger[_0xc8f4('0x47')](_0x33f636[_0xc8f4('0x48')]);}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 0bd40d3..2024b87 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 _0x6f3f=['YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','pick','context','split','format','name','user:agentconnect','accountcode','exten','[syncNewChannel][VoiceCallReport]','linkedid','toLowerCase','applicationdata','appdata','duration','seconds','includes','lastapplication','application','startsWith','cdr(','match','[syncNewExten][VoiceCallReport]','answered','holdtime','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','calleridname','destinationchannel','toNumber','UserId','membername','[syncNewState][VoiceCallReport]','monitor','.wav49','.WAV','monitorFilename','find','monitors','isNil','push','rec','variable','mixmonitor_filename','syncMixMonitorFilename','value','xmd-callerid','callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid','parse','[syncVarSet][VoiceCallReport]','endtime','diff','billableseconds','answertime','destconnectedlinenum','user:%s','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','unknown','not_inuse','inuse','busy','ringing','ringinuse','onhold','set','queue','dial','playback','NO\x20ANSWER','FAILED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','varset','syncVarSet','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','resolve','actionCoreShowChannels','catch','prototype','isNotNull','isUndefined','emit','uniqueid','merge','keys','error','inspect','channel','OutgoingSpoolFailed','starttime'];(function(_0x16fc43,_0x549a46){var _0x3df60b=function(_0x1398ee){while(--_0x1398ee){_0x16fc43['push'](_0x16fc43['shift']());}};_0x3df60b(++_0x549a46);}(_0x6f3f,0x18b));var _0xf6f3=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x6f3f[_0x27af45];return _0x18df21;};'use strict';var BPromise=require(_0xf6f3('0x0'));var _=require(_0xf6f3('0x1'));var moment=require(_0xf6f3('0x2'));var util=require(_0xf6f3('0x3'));var path=require('path');var Redis=require('ioredis');var config=require(_0xf6f3('0x4'));var logger=require(_0xf6f3('0x5'))(_0xf6f3('0x6'));var ami=require(_0xf6f3('0x7'));var Channel=require('../model/channel');var statusDesc=[_0xf6f3('0x8'),_0xf6f3('0x9'),_0xf6f3('0xa'),_0xf6f3('0xb'),'invalid','unavailable',_0xf6f3('0xc'),_0xf6f3('0xd'),_0xf6f3('0xe')];var applications=[_0xf6f3('0xf'),_0xf6f3('0x10'),'agi',_0xf6f3('0x11'),_0xf6f3('0x12'),'voicemail'];var dispositions=[_0xf6f3('0x13'),_0xf6f3('0x14'),_0xf6f3('0x14'),_0xf6f3('0x13'),_0xf6f3('0x13'),_0xf6f3('0x13'),'ANSWERED',_0xf6f3('0x15'),_0xf6f3('0x14'),_0xf6f3('0x14'),_0xf6f3('0x14')];var actions={};config[_0xf6f3('0x16')]=_[_0xf6f3('0x17')](config[_0xf6f3('0x16')],{'host':_0xf6f3('0x18'),'port':0x18eb});var io=require(_0xf6f3('0x19'))(new Redis(config[_0xf6f3('0x16')]));function VoiceCallReport(_0x38f9d8){this[_0xf6f3('0x1a')]=_0x38f9d8['channels'];this[_0xf6f3('0x1b')]=_0x38f9d8[_0xf6f3('0x1b')];ami['on']('coreshowchannel',this[_0xf6f3('0x1c')][_0xf6f3('0x1d')](this));ami['on'](_0xf6f3('0x1e'),this['syncNewExten']['bind'](this));ami['on'](_0xf6f3('0x1f'),this[_0xf6f3('0x20')]['bind'](this));ami['on'](_0xf6f3('0x21'),this['syncNewState']['bind'](this));ami['on'](_0xf6f3('0x22'),this[_0xf6f3('0x23')][_0xf6f3('0x1d')](this));ami['on'](_0xf6f3('0x24'),this[_0xf6f3('0x25')]['bind'](this));ami['on'](_0xf6f3('0x26'),this['syncNewCallerId'][_0xf6f3('0x1d')](this));ami['on'](_0xf6f3('0x27'),this[_0xf6f3('0x28')][_0xf6f3('0x1d')](this));ami['on'](_0xf6f3('0x29'),this[_0xf6f3('0x2a')][_0xf6f3('0x1d')](this));ami['on'](_0xf6f3('0x2b'),this[_0xf6f3('0x2c')]['bind'](this));ami['on']('musiconholdstop',this[_0xf6f3('0x2d')][_0xf6f3('0x1d')](this));return BPromise[_0xf6f3('0x2e')]()['then'](ami[_0xf6f3('0x2f')]())[_0xf6f3('0x30')](function(_0x101210){console['log'](_0x101210);});}VoiceCallReport[_0xf6f3('0x31')][_0xf6f3('0x32')]=function(_0x25c654){return _0x25c654!==null&&!_[_0xf6f3('0x33')](_0x25c654);};VoiceCallReport[_0xf6f3('0x31')]['emit']=function(_0xa1df3f,_0x59c02f,_0x1abbe5){io['to'](_0xa1df3f)[_0xf6f3('0x34')](_0x59c02f,_0x1abbe5);};VoiceCallReport[_0xf6f3('0x31')]['syncNewCallerId']=function(_0x44830a){try{if(this[_0xf6f3('0x32')](_0x44830a)){if(_0x44830a[_0xf6f3('0x35')]===_0x44830a['linkedid']){if(!_['isUndefined'](this['channels'][_0x44830a[_0xf6f3('0x35')]])){_[_0xf6f3('0x36')](this[_0xf6f3('0x1a')][_0x44830a[_0xf6f3('0x35')]],_['pick'](_0x44830a,_[_0xf6f3('0x37')](this[_0xf6f3('0x1a')][_0x44830a[_0xf6f3('0x35')]])));}}}}catch(_0x2e6dbb){logger[_0xf6f3('0x38')]('[syncNewCallerId][VoiceCallReport]',util[_0xf6f3('0x39')](_0x2e6dbb,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf6f3('0x31')][_0xf6f3('0x20')]=function(_0x599d8e){try{if(this[_0xf6f3('0x32')](_0x599d8e)){if(_0x599d8e[_0xf6f3('0x35')]===_0x599d8e['linkedid']&&_0x599d8e[_0xf6f3('0x3a')]!=_0xf6f3('0x3b')){if(_[_0xf6f3('0x33')](this[_0xf6f3('0x1a')][_0x599d8e[_0xf6f3('0x35')]])){this[_0xf6f3('0x1a')][_0x599d8e[_0xf6f3('0x35')]]=new Channel();this[_0xf6f3('0x1a')][_0x599d8e[_0xf6f3('0x35')]][_0xf6f3('0x3c')]=moment()['format'](_0xf6f3('0x3d'));this[_0xf6f3('0x1a')][_0x599d8e[_0xf6f3('0x35')]][_0xf6f3('0x3e')]=dispositions[_['toNumber'](_0x599d8e[_0xf6f3('0x3f')])];_[_0xf6f3('0x36')](this[_0xf6f3('0x1a')][_0x599d8e[_0xf6f3('0x35')]],_[_0xf6f3('0x40')](_0x599d8e,_[_0xf6f3('0x37')](this[_0xf6f3('0x1a')][_0x599d8e[_0xf6f3('0x35')]])));if(_0x599d8e[_0xf6f3('0x41')]==='from-sip'){if(this[_0xf6f3('0x1b')][_0x599d8e[_0xf6f3('0x3a')][_0xf6f3('0x42')]('-')[0x0]]){this[_0xf6f3('0x1b')][_0x599d8e[_0xf6f3('0x3a')]['split']('-')[0x0]]['destconnectedlinenum']=_0x599d8e['exten'];this['emit'](util[_0xf6f3('0x43')]('user:%s',this['agents'][_0x599d8e[_0xf6f3('0x3a')][_0xf6f3('0x42')]('-')[0x0]][_0xf6f3('0x44')]),_0xf6f3('0x45'),{'destaccountcode':this['agents'][_0x599d8e[_0xf6f3('0x3a')][_0xf6f3('0x42')]('-')[0x0]][_0xf6f3('0x46')],'destconnectedlinenum':_0x599d8e[_0xf6f3('0x47')]});}}}}}}catch(_0x4bb406){logger['error'](_0xf6f3('0x48'),util[_0xf6f3('0x39')](_0x4bb406,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewExten']=function(_0x357a9d){try{if(this[_0xf6f3('0x32')](_0x357a9d)){if(_0x357a9d[_0xf6f3('0x35')]===_0x357a9d[_0xf6f3('0x49')]&&_0x357a9d[_0xf6f3('0x47')]!='h'&&_0x357a9d[_0xf6f3('0x3a')]!='OutgoingSpoolFailed'){_0x357a9d['application']=_0x357a9d['application'][_0xf6f3('0x4a')]();_0x357a9d[_0xf6f3('0x4b')]=(_0x357a9d[_0xf6f3('0x4c')]||_0x357a9d['applicationdata'])[_0xf6f3('0x4a')]();if(_[_0xf6f3('0x33')](this['channels'][_0x357a9d[_0xf6f3('0x35')]])){this[_0xf6f3('0x1a')][_0x357a9d[_0xf6f3('0x35')]]=new Channel();this[_0xf6f3('0x1a')][_0x357a9d['uniqueid']][_0xf6f3('0x3c')]=_0x357a9d['duration']?moment()['subtract'](moment['duration'](_0x357a9d[_0xf6f3('0x4d')])[_0xf6f3('0x4e')](),_0xf6f3('0x4e'))[_0xf6f3('0x43')](_0xf6f3('0x3d')):moment()[_0xf6f3('0x43')](_0xf6f3('0x3d'));this[_0xf6f3('0x1a')][_0x357a9d[_0xf6f3('0x35')]][_0xf6f3('0x3e')]=_0xf6f3('0x13');}_[_0xf6f3('0x36')](this[_0xf6f3('0x1a')][_0x357a9d[_0xf6f3('0x35')]],_[_0xf6f3('0x40')](_0x357a9d,_[_0xf6f3('0x37')](this[_0xf6f3('0x1a')][_0x357a9d['uniqueid']])));if(_[_0xf6f3('0x4f')](applications,_0x357a9d['application'])){this[_0xf6f3('0x1a')][_0x357a9d[_0xf6f3('0x35')]][_0xf6f3('0x50')]=_0x357a9d[_0xf6f3('0x51')];this[_0xf6f3('0x1a')][_0x357a9d[_0xf6f3('0x35')]]['lastdata']=_0x357a9d[_0xf6f3('0x4b')];if(_0x357a9d[_0xf6f3('0x51')]===_0xf6f3('0xf')&&_[_0xf6f3('0x52')](_0x357a9d[_0xf6f3('0x4b')],_0xf6f3('0x53'))){var _0x39c1f1=_0x357a9d[_0xf6f3('0x4b')][_0xf6f3('0x42')]('=');var _0x11329c=_0x39c1f1[0x0][_0xf6f3('0x54')](/cdr\((.*)\)/);if(_0x11329c){this[_0xf6f3('0x1a')][_0x357a9d[_0xf6f3('0x35')]][_0x11329c[0x1]]=_0x39c1f1[0x1];}}else if(_0x357a9d[_0xf6f3('0x51')]==='queue'){this[_0xf6f3('0x1a')][_0x357a9d[_0xf6f3('0x35')]]['queue']=_0x357a9d['applicationdata']['split'](',')[0x0];}}}}}catch(_0x341bad){logger[_0xf6f3('0x38')](_0xf6f3('0x55'),util[_0xf6f3('0x39')](_0x341bad,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf6f3('0x31')]['syncNewState']=function(_0x32a77c){try{if(this[_0xf6f3('0x32')](_0x32a77c)){if(_0x32a77c['uniqueid']!==_0x32a77c[_0xf6f3('0x49')]){if(this[_0xf6f3('0x1a')][_0x32a77c[_0xf6f3('0x49')]]){if(_0x32a77c[_0xf6f3('0x3f')]==='6'){if(!this[_0xf6f3('0x1a')][_0x32a77c[_0xf6f3('0x49')]][_0xf6f3('0x56')]){var _0x4070bc=moment();this['channels'][_0x32a77c[_0xf6f3('0x49')]][_0xf6f3('0x56')]=!![];this[_0xf6f3('0x1a')][_0x32a77c['linkedid']]['answertime']=_0x4070bc['format'](_0xf6f3('0x3d'));if(this['channels'][_0x32a77c[_0xf6f3('0x49')]][_0xf6f3('0x3c')]){this[_0xf6f3('0x1a')][_0x32a77c['linkedid']][_0xf6f3('0x57')]=_0x4070bc['diff'](this[_0xf6f3('0x1a')][_0x32a77c[_0xf6f3('0x49')]][_0xf6f3('0x3c')],_0xf6f3('0x4e'));}}this[_0xf6f3('0x1a')][_0x32a77c[_0xf6f3('0x49')]][_0xf6f3('0x49')]=_0x32a77c[_0xf6f3('0x35')];if(_0x32a77c[_0xf6f3('0x58')]!==_0xf6f3('0x59')){this[_0xf6f3('0x1a')][_0x32a77c[_0xf6f3('0x49')]][_0xf6f3('0x5a')]=_0x32a77c[_0xf6f3('0x58')];}this[_0xf6f3('0x1a')][_0x32a77c[_0xf6f3('0x49')]][_0xf6f3('0x5b')]=_0x32a77c[_0xf6f3('0x5c')];this[_0xf6f3('0x1a')][_0x32a77c[_0xf6f3('0x49')]][_0xf6f3('0x5d')]=_0x32a77c[_0xf6f3('0x3a')];this['channels'][_0x32a77c['linkedid']][_0xf6f3('0x3e')]=dispositions[_[_0xf6f3('0x5e')](_0x32a77c['channelstate'])];if(this[_0xf6f3('0x1b')][_0x32a77c[_0xf6f3('0x3a')][_0xf6f3('0x42')]('-')[0x0]]){this[_0xf6f3('0x1a')][_0x32a77c[_0xf6f3('0x49')]][_0xf6f3('0x5f')]=this[_0xf6f3('0x1b')][_0x32a77c[_0xf6f3('0x3a')]['split']('-')[0x0]]['id'];this[_0xf6f3('0x1a')][_0x32a77c[_0xf6f3('0x49')]]['membername']=this['agents'][_0x32a77c[_0xf6f3('0x3a')]['split']('-')[0x0]][_0xf6f3('0x44')];}}}}else{if(this['channels'][_0x32a77c[_0xf6f3('0x35')]]){if(_0x32a77c[_0xf6f3('0x3f')]==='6'){if(this[_0xf6f3('0x1b')][_0x32a77c['channel'][_0xf6f3('0x42')]('-')[0x0]]){this[_0xf6f3('0x1a')][_0x32a77c[_0xf6f3('0x35')]][_0xf6f3('0x5f')]=this[_0xf6f3('0x1b')][_0x32a77c[_0xf6f3('0x3a')]['split']('-')[0x0]]['id'];this[_0xf6f3('0x1a')][_0x32a77c['uniqueid']][_0xf6f3('0x60')]=this[_0xf6f3('0x1b')][_0x32a77c[_0xf6f3('0x3a')][_0xf6f3('0x42')]('-')[0x0]]['name'];}}}}}}catch(_0x5b7483){logger[_0xf6f3('0x38')](_0xf6f3('0x61'),util[_0xf6f3('0x39')](_0x5b7483,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf6f3('0x31')]['syncMixMonitorFilename']=function(_0x18023e,_0x5331b9){if(this[_0xf6f3('0x1a')][_0x18023e]){this['channels'][_0x18023e][_0xf6f3('0x62')]=!![];if(_['endsWith'](_0x5331b9,'.wav49')){_0x5331b9=_0x5331b9['replace'](_0xf6f3('0x63'),_0xf6f3('0x64'));}this[_0xf6f3('0x1a')][_0x18023e][_0xf6f3('0x65')]=_0x5331b9;var _0x1743ee=_[_0xf6f3('0x66')](this[_0xf6f3('0x1a')][_0x18023e][_0xf6f3('0x67')],{'filename':_0x5331b9});if(_[_0xf6f3('0x68')](_0x1743ee)){this[_0xf6f3('0x1a')][_0x18023e][_0xf6f3('0x67')][_0xf6f3('0x69')]({'filename':_0x5331b9,'createdAt':moment()[_0xf6f3('0x43')](_0xf6f3('0x3d')),'mixmonitorid':'','status':_0xf6f3('0x6a')});}}};VoiceCallReport['prototype'][_0xf6f3('0x23')]=function(_0x802df3){try{if(this['isNotNull'](_0x802df3)){if(this[_0xf6f3('0x1a')][_0x802df3[_0xf6f3('0x35')]]&&_0x802df3[_0xf6f3('0x3a')]!=_0xf6f3('0x3b')){if(this[_0xf6f3('0x32')](_0x802df3[_0xf6f3('0x6b')])){if(this[_0xf6f3('0x32')](_0x802df3['variable'][_0xf6f3('0x6c')])){this[_0xf6f3('0x6d')](_0x802df3[_0xf6f3('0x35')],_0x802df3[_0xf6f3('0x6e')]);}else if(this[_0xf6f3('0x32')](_0x802df3['variable']['xmd-phone'])){this[_0xf6f3('0x1a')][_0x802df3[_0xf6f3('0x35')]][_0xf6f3('0x58')]=_0x802df3['value'];}else if(this['isNotNull'](_0x802df3[_0xf6f3('0x6b')][_0xf6f3('0x6f')])){this[_0xf6f3('0x1a')][_0x802df3[_0xf6f3('0x35')]][_0xf6f3('0x70')]=_0x802df3[_0xf6f3('0x6e')];}else if(this['isNotNull'](_0x802df3[_0xf6f3('0x6b')][_0xf6f3('0x71')])){this[_0xf6f3('0x1a')][_0x802df3[_0xf6f3('0x35')]][_0xf6f3('0x72')]=_0x802df3['value'];}else if(this[_0xf6f3('0x32')](_0x802df3[_0xf6f3('0x6b')][_0xf6f3('0x73')])){this[_0xf6f3('0x1a')][_0x802df3[_0xf6f3('0x35')]][_0xf6f3('0x10')]=_0x802df3[_0xf6f3('0x6e')][_0xf6f3('0x42')](',')[0x0];}else if(this['isNotNull'](_0x802df3['variable'][_0xf6f3('0x74')])){this[_0xf6f3('0x1a')][_0x802df3['uniqueid']][_0xf6f3('0x75')]=_0x802df3[_0xf6f3('0x6e')];}else if(this[_0xf6f3('0x32')](_0x802df3['variable'][_0xf6f3('0x76')])){this[_0xf6f3('0x1a')][_0x802df3[_0xf6f3('0x35')]][_0xf6f3('0x77')]=_0x802df3[_0xf6f3('0x6e')];}else if(this[_0xf6f3('0x32')](_0x802df3['variable']['xmd-callerid-preview'])){this['channels'][_0x802df3[_0xf6f3('0x35')]][_0xf6f3('0x78')]=_0x802df3[_0xf6f3('0x6e')];}else if(this[_0xf6f3('0x32')](_0x802df3['variable'][_0xf6f3('0x79')])){this[_0xf6f3('0x1a')][_0x802df3[_0xf6f3('0x35')]][_0xf6f3('0x10')]=_0x802df3[_0xf6f3('0x6e')];}else if(this[_0xf6f3('0x32')](_0x802df3[_0xf6f3('0x6b')][_0xf6f3('0x7a')])){this[_0xf6f3('0x1a')][_0x802df3[_0xf6f3('0x35')]][_0xf6f3('0x7b')]=_0x802df3[_0xf6f3('0x6e')];}}}else if(this[_0xf6f3('0x32')](_0x802df3[_0xf6f3('0x6b')][_0xf6f3('0x6c')])){if(_0x802df3[_0xf6f3('0x6e')]){var _0x233a8=path[_0xf6f3('0x7c')](_0x802df3['value'])[_0xf6f3('0x44')];this[_0xf6f3('0x6d')](_0x233a8,_0x802df3['value']);}}else if(this[_0xf6f3('0x1a')][_0x802df3[_0xf6f3('0x49')]]){if(this[_0xf6f3('0x32')](_0x802df3[_0xf6f3('0x6b')])){if(this[_0xf6f3('0x32')](_0x802df3[_0xf6f3('0x6b')][_0xf6f3('0x7a')])){this['channels'][_0x802df3[_0xf6f3('0x49')]]['sipcalllinkedid']=_0x802df3['value'];}}}}}catch(_0x5b4d9d){logger['error'](_0xf6f3('0x7d'),util['inspect'](_0x5b4d9d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf6f3('0x31')][_0xf6f3('0x25')]=function(_0x594e7a){try{if(this[_0xf6f3('0x32')](_0x594e7a)){if(this['channels'][_0x594e7a['uniqueid']]){var _0x4aa097=moment();this[_0xf6f3('0x1a')][_0x594e7a[_0xf6f3('0x35')]][_0xf6f3('0x7e')]=_0x4aa097['format'](_0xf6f3('0x3d'));this[_0xf6f3('0x1a')][_0x594e7a[_0xf6f3('0x35')]][_0xf6f3('0x4d')]=_0x4aa097[_0xf6f3('0x7f')](this['channels'][_0x594e7a['uniqueid']][_0xf6f3('0x3c')],_0xf6f3('0x4e'));if(this['channels'][_0x594e7a[_0xf6f3('0x35')]]['answered']){this[_0xf6f3('0x1a')][_0x594e7a['uniqueid']][_0xf6f3('0x80')]=_0x4aa097[_0xf6f3('0x7f')](this[_0xf6f3('0x1a')][_0x594e7a['uniqueid']][_0xf6f3('0x81')],_0xf6f3('0x4e'));this['channels'][_0x594e7a[_0xf6f3('0x35')]][_0xf6f3('0x57')]=this[_0xf6f3('0x1a')][_0x594e7a[_0xf6f3('0x35')]][_0xf6f3('0x4d')]-this[_0xf6f3('0x1a')][_0x594e7a[_0xf6f3('0x35')]][_0xf6f3('0x80')];}if(_0x594e7a[_0xf6f3('0x41')]==='from-sip'){if(this[_0xf6f3('0x1b')][_0x594e7a[_0xf6f3('0x3a')][_0xf6f3('0x42')]('-')[0x0]]){this[_0xf6f3('0x1b')][_0x594e7a['channel'][_0xf6f3('0x42')]('-')[0x0]]=_['omit'](this[_0xf6f3('0x1b')][_0x594e7a['channel']['split']('-')[0x0]],[_0xf6f3('0x82')]);this[_0xf6f3('0x34')](util[_0xf6f3('0x43')](_0xf6f3('0x83'),this[_0xf6f3('0x1b')][_0x594e7a[_0xf6f3('0x3a')][_0xf6f3('0x42')]('-')[0x0]][_0xf6f3('0x44')]),'user:agentcomplete',{'destaccountcode':this[_0xf6f3('0x1b')][_0x594e7a[_0xf6f3('0x3a')][_0xf6f3('0x42')]('-')[0x0]][_0xf6f3('0x46')]});}}ami['emit'](_0xf6f3('0x84'),this[_0xf6f3('0x1a')][_0x594e7a[_0xf6f3('0x35')]]);delete this['channels'][_0x594e7a['uniqueid']];}}}catch(_0x3ae7ca){logger['error'](_0xf6f3('0x85'),util[_0xf6f3('0x39')](_0x3ae7ca,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf6f3('0x31')]['syncAttendedTransfer']=function(_0x2d3828){try{if(this[_0xf6f3('0x32')](_0x2d3828)){if(this['channels'][_0x2d3828[_0xf6f3('0x86')]]){this[_0xf6f3('0x1a')][_0x2d3828['transfereeuniqueid']]['transfercalleridnum']=_0x2d3828[_0xf6f3('0x87')];this[_0xf6f3('0x1a')][_0x2d3828['transfereeuniqueid']][_0xf6f3('0x88')]=_0x2d3828['transfertargetcalleridnum'];if(this['channels'][_0x2d3828['secondtransfereruniqueid']]){var _0x142034=this[_0xf6f3('0x1a')][_0x2d3828[_0xf6f3('0x89')]];this[_0xf6f3('0x1a')][_0x2d3828[_0xf6f3('0x89')]]=this[_0xf6f3('0x1a')][_0x2d3828[_0xf6f3('0x86')]];this['channels'][_0x2d3828['transfereeuniqueid']]=_0x142034;}}else if(this[_0xf6f3('0x1a')][_0x2d3828['transfertargetuniqueid']]){this[_0xf6f3('0x1a')][_0x2d3828[_0xf6f3('0x8a')]][_0xf6f3('0x8b')]=_0x2d3828[_0xf6f3('0x87')];this['channels'][_0x2d3828[_0xf6f3('0x8a')]]['transferconnectedlinenum']=_0x2d3828['transfertargetcalleridnum'];if(this[_0xf6f3('0x1a')][_0x2d3828[_0xf6f3('0x8c')]]){var _0x142034=this[_0xf6f3('0x1a')][_0x2d3828[_0xf6f3('0x8c')]];this[_0xf6f3('0x1a')][_0x2d3828[_0xf6f3('0x8c')]]=this[_0xf6f3('0x1a')][_0x2d3828['transfertargetuniqueid']];this['channels'][_0x2d3828[_0xf6f3('0x8a')]]=_0x142034;}}}}catch(_0x7b011f){logger['error'](_0xf6f3('0x8d'),util['inspect'](_0x7b011f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncBlindTransfer']=function(_0x123fc2){try{if(this[_0xf6f3('0x32')](_0x123fc2)){if(this['channels'][_0x123fc2[_0xf6f3('0x86')]]){this['channels'][_0x123fc2[_0xf6f3('0x86')]][_0xf6f3('0x8b')]=_0x123fc2[_0xf6f3('0x8e')];this[_0xf6f3('0x1a')][_0x123fc2['transfereeuniqueid']][_0xf6f3('0x88')]=_0x123fc2[_0xf6f3('0x8f')];this[_0xf6f3('0x25')]({'event':_0xf6f3('0x90'),'uniqueid':_0x123fc2[_0xf6f3('0x86')],'context':_0x123fc2[_0xf6f3('0x41')],'channel':_0x123fc2[_0xf6f3('0x91')]});}}}catch(_0x1ca778){logger[_0xf6f3('0x38')](_0xf6f3('0x92'),util[_0xf6f3('0x39')](_0x1ca778,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf6f3('0x31')][_0xf6f3('0x2c')]=function(_0x5b46f9){try{if(this[_0xf6f3('0x32')](_0x5b46f9)){if(this[_0xf6f3('0x1a')][_0x5b46f9[_0xf6f3('0x35')]]){if(!_[_0xf6f3('0x68')](this[_0xf6f3('0x1a')][_0x5b46f9['uniqueid']][_0xf6f3('0x81')])){this['channels'][_0x5b46f9[_0xf6f3('0x35')]][_0xf6f3('0x93')]=moment()[_0xf6f3('0x43')](_0xf6f3('0x3d'));}}}}catch(_0x3a8bfa){logger['error']('[syncMusicOnHoldStart][VoiceCallReport]',util[_0xf6f3('0x39')](_0x3a8bfa,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf6f3('0x2d')]=function(_0x4a9b6f){try{if(this[_0xf6f3('0x32')](_0x4a9b6f)){if(this[_0xf6f3('0x1a')][_0x4a9b6f['uniqueid']]){if(!_[_0xf6f3('0x68')](this['channels'][_0x4a9b6f[_0xf6f3('0x35')]]['mohstarttime'])){this[_0xf6f3('0x1a')][_0x4a9b6f[_0xf6f3('0x35')]][_0xf6f3('0x94')]+=moment()[_0xf6f3('0x95')](0x0)[_0xf6f3('0x7f')](this[_0xf6f3('0x1a')][_0x4a9b6f[_0xf6f3('0x35')]][_0xf6f3('0x93')],'seconds');delete this['channels'][_0x4a9b6f[_0xf6f3('0x35')]][_0xf6f3('0x93')];}}}}catch(_0x18d3cf){logger['error'](_0xf6f3('0x96'),util[_0xf6f3('0x39')](_0x18d3cf,{'showHidden':![],'depth':null}));}};module[_0xf6f3('0x97')]=VoiceCallReport; \ No newline at end of file +var _0xcbc5=['unknown','inuse','busy','invalid','unavailable','ringinuse','set','queue','agi','voicemail','NO\x20ANSWER','ANSWERED','BUSY','FAILED','defaults','redis','localhost','socket.io-emitter','channels','agents','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','hangup','syncHangup','newcallerid','syncNewCallerId','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','then','actionCoreShowChannels','catch','log','prototype','isNotNull','uniqueid','linkedid','isUndefined','merge','pick','keys','[syncNewCallerId][VoiceCallReport]','inspect','channel','OutgoingSpoolFailed','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','context','from-sip','split','exten','user:%s','name','user:agentconnect','accountcode','error','[syncNewChannel][VoiceCallReport]','application','toLowerCase','applicationdata','appdata','duration','seconds','includes','lastdata','startsWith','cdr(','answered','answertime','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinename','destinationchannel','UserId','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','isNil','push','rec','syncVarSet','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','[syncVarSet][VoiceCallReport]','endtime','destconnectedlinenum','emit','[syncHangup][VoiceCallReport]','syncAttendedTransfer','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','extension','BlindTransfer','transfererchannel','[syncMusicOnHoldStart][VoiceCallReport]','mohstarttime','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami'];(function(_0x4230d3,_0x1c4921){var _0x45f60c=function(_0x273030){while(--_0x273030){_0x4230d3['push'](_0x4230d3['shift']());}};_0x45f60c(++_0x1c4921);}(_0xcbc5,0x1ba));var _0x5cbc=function(_0x11963b,_0x5d2da7){_0x11963b=_0x11963b-0x0;var _0x5d451e=_0xcbc5[_0x11963b];return _0x5d451e;};'use strict';var BPromise=require(_0x5cbc('0x0'));var _=require('lodash');var moment=require(_0x5cbc('0x1'));var util=require(_0x5cbc('0x2'));var path=require(_0x5cbc('0x3'));var Redis=require(_0x5cbc('0x4'));var config=require(_0x5cbc('0x5'));var logger=require(_0x5cbc('0x6'))(_0x5cbc('0x7'));var ami=require('../ami');var Channel=require('../model/channel');var statusDesc=[_0x5cbc('0x8'),'not_inuse',_0x5cbc('0x9'),_0x5cbc('0xa'),_0x5cbc('0xb'),_0x5cbc('0xc'),'ringing',_0x5cbc('0xd'),'onhold'];var applications=[_0x5cbc('0xe'),_0x5cbc('0xf'),_0x5cbc('0x10'),'dial','playback',_0x5cbc('0x11')];var dispositions=[_0x5cbc('0x12'),'FAILED','FAILED',_0x5cbc('0x12'),_0x5cbc('0x12'),'NO\x20ANSWER',_0x5cbc('0x13'),_0x5cbc('0x14'),'FAILED',_0x5cbc('0x15'),'FAILED'];var actions={};config['redis']=_[_0x5cbc('0x16')](config[_0x5cbc('0x17')],{'host':_0x5cbc('0x18'),'port':0x18eb});var io=require(_0x5cbc('0x19'))(new Redis(config[_0x5cbc('0x17')]));function VoiceCallReport(_0x1b757b){this[_0x5cbc('0x1a')]=_0x1b757b['channels'];this['agents']=_0x1b757b[_0x5cbc('0x1b')];ami['on']('coreshowchannel',this[_0x5cbc('0x1c')][_0x5cbc('0x1d')](this));ami['on'](_0x5cbc('0x1e'),this[_0x5cbc('0x1c')][_0x5cbc('0x1d')](this));ami['on'](_0x5cbc('0x1f'),this[_0x5cbc('0x20')]['bind'](this));ami['on'](_0x5cbc('0x21'),this[_0x5cbc('0x22')][_0x5cbc('0x1d')](this));ami['on'](_0x5cbc('0x23'),this['syncVarSet'][_0x5cbc('0x1d')](this));ami['on'](_0x5cbc('0x24'),this[_0x5cbc('0x25')][_0x5cbc('0x1d')](this));ami['on'](_0x5cbc('0x26'),this[_0x5cbc('0x27')]['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x5cbc('0x1d')](this));ami['on'](_0x5cbc('0x28'),this[_0x5cbc('0x29')][_0x5cbc('0x1d')](this));ami['on'](_0x5cbc('0x2a'),this[_0x5cbc('0x2b')][_0x5cbc('0x1d')](this));ami['on'](_0x5cbc('0x2c'),this[_0x5cbc('0x2d')][_0x5cbc('0x1d')](this));return BPromise['resolve']()[_0x5cbc('0x2e')](ami[_0x5cbc('0x2f')]())[_0x5cbc('0x30')](function(_0x27ce2b){console[_0x5cbc('0x31')](_0x27ce2b);});}VoiceCallReport[_0x5cbc('0x32')][_0x5cbc('0x33')]=function(_0x3ddee5){return _0x3ddee5!==null&&!_['isUndefined'](_0x3ddee5);};VoiceCallReport[_0x5cbc('0x32')]['emit']=function(_0x17e998,_0x2c20c1,_0x485d85){io['to'](_0x17e998)['emit'](_0x2c20c1,_0x485d85);};VoiceCallReport[_0x5cbc('0x32')][_0x5cbc('0x27')]=function(_0x427b47){try{if(this['isNotNull'](_0x427b47)){if(_0x427b47[_0x5cbc('0x34')]===_0x427b47[_0x5cbc('0x35')]){if(!_[_0x5cbc('0x36')](this[_0x5cbc('0x1a')][_0x427b47['uniqueid']])){_[_0x5cbc('0x37')](this['channels'][_0x427b47[_0x5cbc('0x34')]],_[_0x5cbc('0x38')](_0x427b47,_[_0x5cbc('0x39')](this[_0x5cbc('0x1a')][_0x427b47[_0x5cbc('0x34')]])));}}}}catch(_0x9aa2a9){logger['error'](_0x5cbc('0x3a'),util[_0x5cbc('0x3b')](_0x9aa2a9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5cbc('0x32')][_0x5cbc('0x20')]=function(_0x1cdf8f){try{if(this[_0x5cbc('0x33')](_0x1cdf8f)){if(_0x1cdf8f[_0x5cbc('0x34')]===_0x1cdf8f[_0x5cbc('0x35')]&&_0x1cdf8f[_0x5cbc('0x3c')]!=_0x5cbc('0x3d')){if(_[_0x5cbc('0x36')](this[_0x5cbc('0x1a')][_0x1cdf8f['uniqueid']])){this[_0x5cbc('0x1a')][_0x1cdf8f[_0x5cbc('0x34')]]=new Channel();this[_0x5cbc('0x1a')][_0x1cdf8f[_0x5cbc('0x34')]][_0x5cbc('0x3e')]=moment()[_0x5cbc('0x3f')](_0x5cbc('0x40'));this[_0x5cbc('0x1a')][_0x1cdf8f[_0x5cbc('0x34')]][_0x5cbc('0x41')]=dispositions[_[_0x5cbc('0x42')](_0x1cdf8f[_0x5cbc('0x43')])];_[_0x5cbc('0x37')](this[_0x5cbc('0x1a')][_0x1cdf8f[_0x5cbc('0x34')]],_[_0x5cbc('0x38')](_0x1cdf8f,_['keys'](this[_0x5cbc('0x1a')][_0x1cdf8f['uniqueid']])));if(_0x1cdf8f[_0x5cbc('0x44')]===_0x5cbc('0x45')){if(this[_0x5cbc('0x1b')][_0x1cdf8f['channel']['split']('-')[0x0]]){this[_0x5cbc('0x1b')][_0x1cdf8f[_0x5cbc('0x3c')][_0x5cbc('0x46')]('-')[0x0]]['destconnectedlinenum']=_0x1cdf8f[_0x5cbc('0x47')];this['emit'](util[_0x5cbc('0x3f')](_0x5cbc('0x48'),this[_0x5cbc('0x1b')][_0x1cdf8f[_0x5cbc('0x3c')][_0x5cbc('0x46')]('-')[0x0]][_0x5cbc('0x49')]),_0x5cbc('0x4a'),{'destaccountcode':this[_0x5cbc('0x1b')][_0x1cdf8f['channel'][_0x5cbc('0x46')]('-')[0x0]][_0x5cbc('0x4b')],'destconnectedlinenum':_0x1cdf8f[_0x5cbc('0x47')]});}}}}}}catch(_0x18b290){logger[_0x5cbc('0x4c')](_0x5cbc('0x4d'),util[_0x5cbc('0x3b')](_0x18b290,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5cbc('0x32')][_0x5cbc('0x1c')]=function(_0x2e5dff){try{if(this[_0x5cbc('0x33')](_0x2e5dff)){if(_0x2e5dff[_0x5cbc('0x34')]===_0x2e5dff['linkedid']&&_0x2e5dff[_0x5cbc('0x47')]!='h'&&_0x2e5dff[_0x5cbc('0x3c')]!='OutgoingSpoolFailed'){_0x2e5dff[_0x5cbc('0x4e')]=_0x2e5dff[_0x5cbc('0x4e')][_0x5cbc('0x4f')]();_0x2e5dff[_0x5cbc('0x50')]=(_0x2e5dff[_0x5cbc('0x51')]||_0x2e5dff['applicationdata'])[_0x5cbc('0x4f')]();if(_[_0x5cbc('0x36')](this[_0x5cbc('0x1a')][_0x2e5dff['uniqueid']])){this[_0x5cbc('0x1a')][_0x2e5dff[_0x5cbc('0x34')]]=new Channel();this[_0x5cbc('0x1a')][_0x2e5dff['uniqueid']][_0x5cbc('0x3e')]=_0x2e5dff[_0x5cbc('0x52')]?moment()['subtract'](moment['duration'](_0x2e5dff['duration'])[_0x5cbc('0x53')](),_0x5cbc('0x53'))[_0x5cbc('0x3f')](_0x5cbc('0x40')):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x5cbc('0x1a')][_0x2e5dff[_0x5cbc('0x34')]][_0x5cbc('0x41')]=_0x5cbc('0x12');}_['merge'](this[_0x5cbc('0x1a')][_0x2e5dff[_0x5cbc('0x34')]],_[_0x5cbc('0x38')](_0x2e5dff,_[_0x5cbc('0x39')](this[_0x5cbc('0x1a')][_0x2e5dff[_0x5cbc('0x34')]])));if(_[_0x5cbc('0x54')](applications,_0x2e5dff[_0x5cbc('0x4e')])){this['channels'][_0x2e5dff[_0x5cbc('0x34')]]['lastapplication']=_0x2e5dff[_0x5cbc('0x4e')];this[_0x5cbc('0x1a')][_0x2e5dff[_0x5cbc('0x34')]][_0x5cbc('0x55')]=_0x2e5dff['applicationdata'];if(_0x2e5dff[_0x5cbc('0x4e')]===_0x5cbc('0xe')&&_[_0x5cbc('0x56')](_0x2e5dff[_0x5cbc('0x50')],_0x5cbc('0x57'))){var _0x17a032=_0x2e5dff[_0x5cbc('0x50')]['split']('=');var _0x250377=_0x17a032[0x0]['match'](/cdr\((.*)\)/);if(_0x250377){this['channels'][_0x2e5dff[_0x5cbc('0x34')]][_0x250377[0x1]]=_0x17a032[0x1];}}else if(_0x2e5dff[_0x5cbc('0x4e')]===_0x5cbc('0xf')){this[_0x5cbc('0x1a')][_0x2e5dff[_0x5cbc('0x34')]][_0x5cbc('0xf')]=_0x2e5dff[_0x5cbc('0x50')]['split'](',')[0x0];}}}}}catch(_0x16bc97){logger['error']('[syncNewExten][VoiceCallReport]',util[_0x5cbc('0x3b')](_0x16bc97,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5cbc('0x32')][_0x5cbc('0x22')]=function(_0xb33769){try{if(this[_0x5cbc('0x33')](_0xb33769)){if(_0xb33769['uniqueid']!==_0xb33769[_0x5cbc('0x35')]){if(this[_0x5cbc('0x1a')][_0xb33769[_0x5cbc('0x35')]]){if(_0xb33769[_0x5cbc('0x43')]==='6'){if(!this[_0x5cbc('0x1a')][_0xb33769[_0x5cbc('0x35')]][_0x5cbc('0x58')]){var _0x4b6bf5=moment();this[_0x5cbc('0x1a')][_0xb33769[_0x5cbc('0x35')]]['answered']=!![];this[_0x5cbc('0x1a')][_0xb33769[_0x5cbc('0x35')]][_0x5cbc('0x59')]=_0x4b6bf5[_0x5cbc('0x3f')](_0x5cbc('0x40'));if(this[_0x5cbc('0x1a')][_0xb33769[_0x5cbc('0x35')]][_0x5cbc('0x3e')]){this[_0x5cbc('0x1a')][_0xb33769[_0x5cbc('0x35')]][_0x5cbc('0x5a')]=_0x4b6bf5[_0x5cbc('0x5b')](this[_0x5cbc('0x1a')][_0xb33769[_0x5cbc('0x35')]]['starttime'],_0x5cbc('0x53'));}}this['channels'][_0xb33769['linkedid']][_0x5cbc('0x35')]=_0xb33769['uniqueid'];if(_0xb33769[_0x5cbc('0x5c')]!==_0x5cbc('0x5d')){this[_0x5cbc('0x1a')][_0xb33769[_0x5cbc('0x35')]]['connectedlinenum']=_0xb33769[_0x5cbc('0x5c')];}this[_0x5cbc('0x1a')][_0xb33769[_0x5cbc('0x35')]][_0x5cbc('0x5e')]=_0xb33769['calleridname'];this[_0x5cbc('0x1a')][_0xb33769[_0x5cbc('0x35')]][_0x5cbc('0x5f')]=_0xb33769['channel'];this[_0x5cbc('0x1a')][_0xb33769[_0x5cbc('0x35')]]['disposition']=dispositions[_[_0x5cbc('0x42')](_0xb33769['channelstate'])];if(this[_0x5cbc('0x1b')][_0xb33769[_0x5cbc('0x3c')][_0x5cbc('0x46')]('-')[0x0]]){this[_0x5cbc('0x1a')][_0xb33769['linkedid']][_0x5cbc('0x60')]=this[_0x5cbc('0x1b')][_0xb33769[_0x5cbc('0x3c')][_0x5cbc('0x46')]('-')[0x0]]['id'];this[_0x5cbc('0x1a')][_0xb33769[_0x5cbc('0x35')]][_0x5cbc('0x61')]=this['agents'][_0xb33769[_0x5cbc('0x3c')]['split']('-')[0x0]][_0x5cbc('0x49')];}}}}else{if(this['channels'][_0xb33769['uniqueid']]){if(_0xb33769[_0x5cbc('0x43')]==='6'){if(this[_0x5cbc('0x1b')][_0xb33769[_0x5cbc('0x3c')][_0x5cbc('0x46')]('-')[0x0]]){this[_0x5cbc('0x1a')][_0xb33769[_0x5cbc('0x34')]][_0x5cbc('0x60')]=this[_0x5cbc('0x1b')][_0xb33769['channel'][_0x5cbc('0x46')]('-')[0x0]]['id'];this[_0x5cbc('0x1a')][_0xb33769[_0x5cbc('0x34')]][_0x5cbc('0x61')]=this['agents'][_0xb33769[_0x5cbc('0x3c')]['split']('-')[0x0]][_0x5cbc('0x49')];}}}}}}catch(_0x43a57d){logger['error'](_0x5cbc('0x62'),util[_0x5cbc('0x3b')](_0x43a57d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5cbc('0x32')][_0x5cbc('0x63')]=function(_0xf77170,_0x3726e3){if(this[_0x5cbc('0x1a')][_0xf77170]){this[_0x5cbc('0x1a')][_0xf77170][_0x5cbc('0x64')]=!![];if(_[_0x5cbc('0x65')](_0x3726e3,_0x5cbc('0x66'))){_0x3726e3=_0x3726e3[_0x5cbc('0x67')](_0x5cbc('0x66'),_0x5cbc('0x68'));}this[_0x5cbc('0x1a')][_0xf77170][_0x5cbc('0x69')]=_0x3726e3;var _0x66320=_[_0x5cbc('0x6a')](this[_0x5cbc('0x1a')][_0xf77170]['monitors'],{'filename':_0x3726e3});if(_[_0x5cbc('0x6b')](_0x66320)){this[_0x5cbc('0x1a')][_0xf77170]['monitors'][_0x5cbc('0x6c')]({'filename':_0x3726e3,'createdAt':moment()[_0x5cbc('0x3f')](_0x5cbc('0x40')),'mixmonitorid':'','status':_0x5cbc('0x6d')});}}};VoiceCallReport['prototype'][_0x5cbc('0x6e')]=function(_0x5b95c4){try{if(this[_0x5cbc('0x33')](_0x5b95c4)){if(this[_0x5cbc('0x1a')][_0x5b95c4[_0x5cbc('0x34')]]&&_0x5b95c4['channel']!=_0x5cbc('0x3d')){if(this[_0x5cbc('0x33')](_0x5b95c4[_0x5cbc('0x6f')])){if(this[_0x5cbc('0x33')](_0x5b95c4[_0x5cbc('0x6f')][_0x5cbc('0x70')])){this[_0x5cbc('0x63')](_0x5b95c4['uniqueid'],_0x5b95c4[_0x5cbc('0x71')]);}else if(this['isNotNull'](_0x5b95c4['variable'][_0x5cbc('0x72')])){this[_0x5cbc('0x1a')][_0x5b95c4['uniqueid']][_0x5cbc('0x5c')]=_0x5b95c4[_0x5cbc('0x71')];}else if(this['isNotNull'](_0x5b95c4[_0x5cbc('0x6f')][_0x5cbc('0x73')])){this['channels'][_0x5b95c4[_0x5cbc('0x34')]][_0x5cbc('0x74')]=_0x5b95c4[_0x5cbc('0x71')];}else if(this[_0x5cbc('0x33')](_0x5b95c4[_0x5cbc('0x6f')][_0x5cbc('0x75')])){this[_0x5cbc('0x1a')][_0x5b95c4[_0x5cbc('0x34')]][_0x5cbc('0x76')]=_0x5b95c4[_0x5cbc('0x71')];}else if(this[_0x5cbc('0x33')](_0x5b95c4[_0x5cbc('0x6f')][_0x5cbc('0x77')])){this['channels'][_0x5b95c4[_0x5cbc('0x34')]][_0x5cbc('0xf')]=_0x5b95c4['value'][_0x5cbc('0x46')](',')[0x0];}else if(this[_0x5cbc('0x33')](_0x5b95c4[_0x5cbc('0x6f')][_0x5cbc('0x78')])){this[_0x5cbc('0x1a')][_0x5b95c4[_0x5cbc('0x34')]]['originatecalleridnum']=_0x5b95c4[_0x5cbc('0x71')];}else if(this['isNotNull'](_0x5b95c4[_0x5cbc('0x6f')][_0x5cbc('0x79')])){this[_0x5cbc('0x1a')][_0x5b95c4[_0x5cbc('0x34')]][_0x5cbc('0x7a')]=_0x5b95c4[_0x5cbc('0x71')];}else if(this[_0x5cbc('0x33')](_0x5b95c4[_0x5cbc('0x6f')][_0x5cbc('0x7b')])){this[_0x5cbc('0x1a')][_0x5b95c4[_0x5cbc('0x34')]][_0x5cbc('0x7c')]=_0x5b95c4[_0x5cbc('0x71')];}else if(this[_0x5cbc('0x33')](_0x5b95c4['variable'][_0x5cbc('0x7d')])){this[_0x5cbc('0x1a')][_0x5b95c4[_0x5cbc('0x34')]][_0x5cbc('0xf')]=_0x5b95c4['value'];}else if(this[_0x5cbc('0x33')](_0x5b95c4['variable'][_0x5cbc('0x7e')])){this['channels'][_0x5b95c4[_0x5cbc('0x34')]][_0x5cbc('0x7f')]=_0x5b95c4[_0x5cbc('0x71')];}}}else if(this[_0x5cbc('0x33')](_0x5b95c4[_0x5cbc('0x6f')]['mixmonitor_filename'])){if(_0x5b95c4['value']){var _0x5c78e0=path['parse'](_0x5b95c4[_0x5cbc('0x71')])['name'];this[_0x5cbc('0x63')](_0x5c78e0,_0x5b95c4[_0x5cbc('0x71')]);}}else if(this[_0x5cbc('0x1a')][_0x5b95c4[_0x5cbc('0x35')]]){if(this[_0x5cbc('0x33')](_0x5b95c4[_0x5cbc('0x6f')])){if(this['isNotNull'](_0x5b95c4[_0x5cbc('0x6f')]['sipcallid'])){this['channels'][_0x5b95c4[_0x5cbc('0x35')]]['sipcalllinkedid']=_0x5b95c4['value'];}}}}}catch(_0x3f7ebc){logger[_0x5cbc('0x4c')](_0x5cbc('0x80'),util['inspect'](_0x3f7ebc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5cbc('0x32')][_0x5cbc('0x25')]=function(_0x3513bf){try{if(this[_0x5cbc('0x33')](_0x3513bf)){if(this[_0x5cbc('0x1a')][_0x3513bf[_0x5cbc('0x34')]]){var _0x2efb07=moment();this[_0x5cbc('0x1a')][_0x3513bf['uniqueid']][_0x5cbc('0x81')]=_0x2efb07[_0x5cbc('0x3f')](_0x5cbc('0x40'));this['channels'][_0x3513bf[_0x5cbc('0x34')]][_0x5cbc('0x52')]=_0x2efb07[_0x5cbc('0x5b')](this[_0x5cbc('0x1a')][_0x3513bf[_0x5cbc('0x34')]][_0x5cbc('0x3e')],_0x5cbc('0x53'));if(this['channels'][_0x3513bf['uniqueid']][_0x5cbc('0x58')]){this[_0x5cbc('0x1a')][_0x3513bf[_0x5cbc('0x34')]]['billableseconds']=_0x2efb07[_0x5cbc('0x5b')](this[_0x5cbc('0x1a')][_0x3513bf['uniqueid']]['answertime'],_0x5cbc('0x53'));this[_0x5cbc('0x1a')][_0x3513bf['uniqueid']][_0x5cbc('0x5a')]=this[_0x5cbc('0x1a')][_0x3513bf[_0x5cbc('0x34')]]['duration']-this[_0x5cbc('0x1a')][_0x3513bf['uniqueid']]['billableseconds'];}if(_0x3513bf[_0x5cbc('0x44')]==='from-sip'){if(this['agents'][_0x3513bf[_0x5cbc('0x3c')][_0x5cbc('0x46')]('-')[0x0]]){this['agents'][_0x3513bf[_0x5cbc('0x3c')][_0x5cbc('0x46')]('-')[0x0]]=_['omit'](this[_0x5cbc('0x1b')][_0x3513bf[_0x5cbc('0x3c')][_0x5cbc('0x46')]('-')[0x0]],[_0x5cbc('0x82')]);this[_0x5cbc('0x83')](util['format']('user:%s',this[_0x5cbc('0x1b')][_0x3513bf['channel']['split']('-')[0x0]]['name']),'user:agentcomplete',{'destaccountcode':this['agents'][_0x3513bf[_0x5cbc('0x3c')][_0x5cbc('0x46')]('-')[0x0]][_0x5cbc('0x4b')]});}}ami[_0x5cbc('0x83')]('custom:voiceCallReport',this[_0x5cbc('0x1a')][_0x3513bf[_0x5cbc('0x34')]]);delete this[_0x5cbc('0x1a')][_0x3513bf[_0x5cbc('0x34')]];}}}catch(_0x3eaa7c){logger['error'](_0x5cbc('0x84'),util[_0x5cbc('0x3b')](_0x3eaa7c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x5cbc('0x85')]=function(_0x4b39bf){try{if(this['isNotNull'](_0x4b39bf)){if(this[_0x5cbc('0x1a')][_0x4b39bf[_0x5cbc('0x86')]]){this[_0x5cbc('0x1a')][_0x4b39bf[_0x5cbc('0x86')]][_0x5cbc('0x87')]=_0x4b39bf[_0x5cbc('0x88')];this[_0x5cbc('0x1a')][_0x4b39bf[_0x5cbc('0x86')]][_0x5cbc('0x89')]=_0x4b39bf['transfertargetcalleridnum'];if(this[_0x5cbc('0x1a')][_0x4b39bf[_0x5cbc('0x8a')]]){var _0x253f9b=this[_0x5cbc('0x1a')][_0x4b39bf[_0x5cbc('0x8a')]];this['channels'][_0x4b39bf[_0x5cbc('0x8a')]]=this[_0x5cbc('0x1a')][_0x4b39bf[_0x5cbc('0x86')]];this[_0x5cbc('0x1a')][_0x4b39bf['transfereeuniqueid']]=_0x253f9b;}}else if(this['channels'][_0x4b39bf[_0x5cbc('0x8b')]]){this[_0x5cbc('0x1a')][_0x4b39bf[_0x5cbc('0x8b')]][_0x5cbc('0x87')]=_0x4b39bf[_0x5cbc('0x88')];this['channels'][_0x4b39bf[_0x5cbc('0x8b')]][_0x5cbc('0x89')]=_0x4b39bf['transfertargetcalleridnum'];if(this[_0x5cbc('0x1a')][_0x4b39bf['origtransfereruniqueid']]){var _0x253f9b=this[_0x5cbc('0x1a')][_0x4b39bf[_0x5cbc('0x8c')]];this[_0x5cbc('0x1a')][_0x4b39bf[_0x5cbc('0x8c')]]=this[_0x5cbc('0x1a')][_0x4b39bf['transfertargetuniqueid']];this[_0x5cbc('0x1a')][_0x4b39bf[_0x5cbc('0x8b')]]=_0x253f9b;}}}}catch(_0x18ba1e){logger['error']('[syncAttendedTransfer][VoiceCallReport]',util[_0x5cbc('0x3b')](_0x18ba1e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5cbc('0x32')][_0x5cbc('0x29')]=function(_0x382bb8){try{if(this[_0x5cbc('0x33')](_0x382bb8)){if(this[_0x5cbc('0x1a')][_0x382bb8['transfereeuniqueid']]){this['channels'][_0x382bb8['transfereeuniqueid']][_0x5cbc('0x87')]=_0x382bb8['transfereecalleridnum'];this[_0x5cbc('0x1a')][_0x382bb8['transfereeuniqueid']][_0x5cbc('0x89')]=_0x382bb8[_0x5cbc('0x8d')];this[_0x5cbc('0x25')]({'event':_0x5cbc('0x8e'),'uniqueid':_0x382bb8[_0x5cbc('0x86')],'context':_0x382bb8[_0x5cbc('0x44')],'channel':_0x382bb8[_0x5cbc('0x8f')]});}}}catch(_0x3dad65){logger[_0x5cbc('0x4c')]('[syncBlindTransfer][VoiceCallReport]',util[_0x5cbc('0x3b')](_0x3dad65,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5cbc('0x32')][_0x5cbc('0x2b')]=function(_0x5c06db){try{if(this['isNotNull'](_0x5c06db)){if(this['channels'][_0x5c06db[_0x5cbc('0x34')]]){if(!_['isNil'](this[_0x5cbc('0x1a')][_0x5c06db['uniqueid']][_0x5cbc('0x59')])){this['channels'][_0x5c06db[_0x5cbc('0x34')]]['mohstarttime']=moment()['format'](_0x5cbc('0x40'));}}}}catch(_0x1d7b75){logger[_0x5cbc('0x4c')](_0x5cbc('0x90'),util['inspect'](_0x1d7b75,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5cbc('0x32')][_0x5cbc('0x2d')]=function(_0x1cda0f){try{if(this[_0x5cbc('0x33')](_0x1cda0f)){if(this[_0x5cbc('0x1a')][_0x1cda0f[_0x5cbc('0x34')]]){if(!_[_0x5cbc('0x6b')](this[_0x5cbc('0x1a')][_0x1cda0f[_0x5cbc('0x34')]][_0x5cbc('0x91')])){this['channels'][_0x1cda0f[_0x5cbc('0x34')]][_0x5cbc('0x92')]+=moment()[_0x5cbc('0x93')](0x0)['diff'](this[_0x5cbc('0x1a')][_0x1cda0f[_0x5cbc('0x34')]][_0x5cbc('0x91')],_0x5cbc('0x53'));delete this[_0x5cbc('0x1a')][_0x1cda0f[_0x5cbc('0x34')]][_0x5cbc('0x91')];}}}}catch(_0x539da4){logger[_0x5cbc('0x4c')](_0x5cbc('0x94'),util[_0x5cbc('0x3b')](_0x539da4,{'showHidden':![],'depth':null}));}};module[_0x5cbc('0x95')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 57fa35a..bc86869 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 _0xbbf0=['sipcallid','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','endtime','diff','starttime','seconds','lastevent','complete','total','answered','sumHoldTime','holdtime','billableseconds','sumDuration','duration','custom:voiceDialReport','custom:dialend','voice_outbound:save','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','moment','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels','outbound','variables','dialbegin','syncDialBegin','bind','varset','syncVarSet','syncHangup','prototype','isNotNull','isUndefined','emit','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','lastIndexOf','omit','event','privilege','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','syncDialEnd','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','custom:dialconnect','[syncDialEnd][VoiceDialReport]','inspect','addVariable','keys','variable','value','outboundrouteid','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt'];(function(_0x3f34e2,_0x6d8153){var _0x172dbc=function(_0xd76b06){while(--_0xd76b06){_0x3f34e2['push'](_0x3f34e2['shift']());}};_0x172dbc(++_0x6d8153);}(_0xbbf0,0x6e));var _0x0bbf=function(_0x4850e5,_0x379763){_0x4850e5=_0x4850e5-0x0;var _0x4d7996=_0xbbf0[_0x4850e5];return _0x4d7996;};'use strict';var _=require('lodash');var moment=require(_0x0bbf('0x0'));var util=require(_0x0bbf('0x1'));var Redis=require('ioredis');var config=require(_0x0bbf('0x2'));var logger=require(_0x0bbf('0x3'))(_0x0bbf('0x4'));var ami=require(_0x0bbf('0x5'));config[_0x0bbf('0x6')]=_[_0x0bbf('0x7')](config[_0x0bbf('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0bbf('0x8'))(new Redis(config[_0x0bbf('0x6')]));function VoiceDialReport(_0x125a7c){this[_0x0bbf('0x9')]=_0x125a7c['outboundChannels'];this['outbound']=_0x125a7c[_0x0bbf('0xa')];this[_0x0bbf('0xb')]={};ami['on'](_0x0bbf('0xc'),this[_0x0bbf('0xd')][_0x0bbf('0xe')](this));ami['on']('dialend',this['syncDialEnd'][_0x0bbf('0xe')](this));ami['on'](_0x0bbf('0xf'),this[_0x0bbf('0x10')][_0x0bbf('0xe')](this));ami['on']('hangup',this[_0x0bbf('0x11')][_0x0bbf('0xe')](this));}VoiceDialReport[_0x0bbf('0x12')][_0x0bbf('0x13')]=function(_0x32d4a7){return _0x32d4a7!==null&&!_[_0x0bbf('0x14')](_0x32d4a7);};VoiceDialReport['prototype'][_0x0bbf('0x15')]=function(_0x22032d,_0x3cd0ba,_0x57f816){io['to'](_0x22032d)['emit'](_0x3cd0ba,_0x57f816);};VoiceDialReport[_0x0bbf('0x12')]['syncDialBegin']=function(_0x3141d3){try{if(this[_0x0bbf('0x13')](_0x3141d3)){if(this[_0x0bbf('0x9')][_0x3141d3[_0x0bbf('0x16')]]){_[_0x0bbf('0x17')](this[_0x0bbf('0x9')][_0x3141d3[_0x0bbf('0x16')]],{'starttime':moment()[_0x0bbf('0x18')](_0x0bbf('0x19')),'lastevent':'called','interface':_0x3141d3[_0x0bbf('0x1a')]['substring'](0x0,_0x3141d3[_0x0bbf('0x1a')][_0x0bbf('0x1b')]('-')),'membername':_0x3141d3[_0x0bbf('0x1a')]['substring'](_0x3141d3[_0x0bbf('0x1a')]['lastIndexOf']('/')+0x1,_0x3141d3[_0x0bbf('0x1a')][_0x0bbf('0x1b')]('-'))},_[_0x0bbf('0x1c')](_0x3141d3,[_0x0bbf('0x1d'),_0x0bbf('0x1e')]));this[_0x0bbf('0x15')](_0x0bbf('0x1f'),_0x0bbf('0x20'),this[_0x0bbf('0x9')][_0x3141d3[_0x0bbf('0x16')]]);ami['emit'](_0x0bbf('0x21'),this[_0x0bbf('0x9')][_0x3141d3['uniqueid']]);}}}catch(_0x5da891){logger[_0x0bbf('0x22')](_0x0bbf('0x23'),util['inspect'](_0x5da891,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0bbf('0x12')][_0x0bbf('0x24')]=function(_0xfcdf0f){try{if(this[_0x0bbf('0x13')](_0xfcdf0f)){if(this['channels'][_0xfcdf0f[_0x0bbf('0x16')]]){this['channels'][_0xfcdf0f['uniqueid']]['dialstatus']=_0xfcdf0f[_0x0bbf('0x25')];if(_0xfcdf0f[_0x0bbf('0x25')]===_0x0bbf('0x26')){this['channels'][_0xfcdf0f[_0x0bbf('0x16')]][_0x0bbf('0x27')]=_0xfcdf0f[_0x0bbf('0x27')];this['channels'][_0xfcdf0f[_0x0bbf('0x16')]]['connectedlinename']=_0xfcdf0f[_0x0bbf('0x28')];this[_0x0bbf('0x9')][_0xfcdf0f['uniqueid']][_0x0bbf('0x29')]=moment()[_0x0bbf('0x18')](_0x0bbf('0x19'));this[_0x0bbf('0x9')][_0xfcdf0f[_0x0bbf('0x16')]]['lastevent']='connect';ami[_0x0bbf('0x15')](_0x0bbf('0x2a'),this[_0x0bbf('0x9')][_0xfcdf0f[_0x0bbf('0x16')]]);}this['emit'](_0x0bbf('0x1f'),_0x0bbf('0x20'),this[_0x0bbf('0x9')][_0xfcdf0f['uniqueid']]);}}}catch(_0x56f3a1){logger[_0x0bbf('0x22')](_0x0bbf('0x2b'),util[_0x0bbf('0x2c')](_0x56f3a1,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0bbf('0x12')][_0x0bbf('0x10')]=function(_0x5808cb){try{if(this[_0x0bbf('0x13')](_0x5808cb)){this[_0x0bbf('0x2d')](_0x5808cb[_0x0bbf('0x16')],_[_0x0bbf('0x2e')](_0x5808cb[_0x0bbf('0x2f')])[0x0],_0x5808cb[_0x0bbf('0x30')]);if(this[_0x0bbf('0x13')](_0x5808cb[_0x0bbf('0x2f')])&&this['isNotNull'](_0x5808cb[_0x0bbf('0x2f')][_0x0bbf('0x31')])){if(_[_0x0bbf('0x14')](this[_0x0bbf('0x9')][_0x5808cb[_0x0bbf('0x16')]])){this[_0x0bbf('0x9')][_0x5808cb[_0x0bbf('0x16')]]={'routeId':_0x5808cb[_0x0bbf('0x30')],'variables':this[_0x0bbf('0xb')][_0x5808cb[_0x0bbf('0x16')]]};this[_0x0bbf('0x15')](_0x0bbf('0x1f'),_0x0bbf('0x20'),this[_0x0bbf('0x9')][_0x5808cb['uniqueid']]);}}}}catch(_0x1749a9){logger[_0x0bbf('0x22')](_0x0bbf('0x32'),util[_0x0bbf('0x2c')](_0x1749a9,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x0bbf('0x2d')]=function(_0x50220a,_0x2c8cc4,_0x1db283){var _0x51a0d1=[_0x0bbf('0x33'),_0x0bbf('0x34'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x0bbf('0x35'),_0x0bbf('0x36'),_0x0bbf('0x37'),'rtpaudioqosrttbridged',_0x0bbf('0x38'),'sipuri','bridgepeer',_0x0bbf('0x39'),_0x0bbf('0x3a'),_0x0bbf('0x3b'),_0x0bbf('0x3c'),_0x0bbf('0x3d'),'membername',_0x0bbf('0x3e'),_0x0bbf('0x3f')];if(!_['isNil'](_0x2c8cc4)&&!_[_0x0bbf('0x40')](_0x51a0d1,_0x2c8cc4)){if(_[_0x0bbf('0x14')](this[_0x0bbf('0xb')][_0x50220a])){this[_0x0bbf('0xb')][_0x50220a]={};}this['variables'][_0x50220a][_0x2c8cc4]=_0x1db283;}};VoiceDialReport[_0x0bbf('0x12')][_0x0bbf('0x11')]=function(_0xb13e26){try{if(this[_0x0bbf('0x13')](_0xb13e26)){if(this[_0x0bbf('0x9')][_0xb13e26[_0x0bbf('0x16')]]){this[_0x0bbf('0x9')][_0xb13e26[_0x0bbf('0x16')]][_0x0bbf('0x41')]=moment()['format'](_0x0bbf('0x19'));this[_0x0bbf('0x9')][_0xb13e26[_0x0bbf('0x16')]]['duration']=moment(this[_0x0bbf('0x9')][_0xb13e26[_0x0bbf('0x16')]][_0x0bbf('0x41')])[_0x0bbf('0x42')](this[_0x0bbf('0x9')][_0xb13e26['uniqueid']][_0x0bbf('0x43')],_0x0bbf('0x44'));this['channels'][_0xb13e26[_0x0bbf('0x16')]][_0x0bbf('0x45')]=_0x0bbf('0x46');this[_0x0bbf('0xa')][_0x0bbf('0x47')]+=0x1;if(this[_0x0bbf('0x9')][_0xb13e26[_0x0bbf('0x16')]][_0x0bbf('0x29')]){this[_0x0bbf('0xa')][_0x0bbf('0x48')]+=0x1;this['channels'][_0xb13e26[_0x0bbf('0x16')]]['holdtime']=moment(this[_0x0bbf('0x9')][_0xb13e26[_0x0bbf('0x16')]]['answertime'])['diff'](this[_0x0bbf('0x9')][_0xb13e26[_0x0bbf('0x16')]]['starttime'],_0x0bbf('0x44'));this['channels'][_0xb13e26[_0x0bbf('0x16')]]['billableseconds']=moment(this[_0x0bbf('0x9')][_0xb13e26[_0x0bbf('0x16')]]['endtime'])[_0x0bbf('0x42')](this[_0x0bbf('0x9')][_0xb13e26[_0x0bbf('0x16')]][_0x0bbf('0x29')],_0x0bbf('0x44'));this[_0x0bbf('0xa')][_0x0bbf('0x49')]+=this['channels'][_0xb13e26[_0x0bbf('0x16')]][_0x0bbf('0x4a')]||0x0;this[_0x0bbf('0xa')]['sumBillable']+=this[_0x0bbf('0x9')][_0xb13e26[_0x0bbf('0x16')]][_0x0bbf('0x4b')];}this['outbound'][_0x0bbf('0x4c')]+=this['channels'][_0xb13e26[_0x0bbf('0x16')]][_0x0bbf('0x4d')];ami['emit'](_0x0bbf('0x4e'),this[_0x0bbf('0x9')][_0xb13e26[_0x0bbf('0x16')]]);ami[_0x0bbf('0x15')](_0x0bbf('0x4f'),this[_0x0bbf('0x9')][_0xb13e26[_0x0bbf('0x16')]]);this[_0x0bbf('0x15')](_0x0bbf('0x1f'),_0x0bbf('0x50'),this[_0x0bbf('0xa')]);this[_0x0bbf('0x15')](_0x0bbf('0x1f'),_0x0bbf('0x51'),this[_0x0bbf('0x9')][_0xb13e26[_0x0bbf('0x16')]]);delete this['channels'][_0xb13e26[_0x0bbf('0x16')]];}if(this[_0x0bbf('0xb')][_0xb13e26[_0x0bbf('0x16')]]){delete this[_0x0bbf('0xb')][_0xb13e26['uniqueid']];}}}catch(_0xd83e3c){logger[_0x0bbf('0x22')](_0x0bbf('0x52'),util[_0x0bbf('0x2c')](_0xd83e3c,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0x59ad=['endtime','starttime','lastevent','complete','total','answered','diff','billableseconds','seconds','sumHoldTime','holdtime','sumBillable','sumDuration','custom:voiceDialReport','[syncHangup][VoiceDialReport]','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','socket.io-emitter','channels','outbound','dialbegin','bind','syncDialEnd','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','emit','syncDialBegin','uniqueid','merge','YYYY-MM-DD\x20HH:mm:ss','substring','channel','lastIndexOf','event','privilege','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','format','connect','voice:outbound','[syncDialEnd][VoiceDialReport]','addVariable','variable','value','isUndefined','variables','voice_outbound_channel:save','error','[syncVarSet][VoiceDialReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberrealtime','isNil','includes','duration'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x59ad,0x1b4));var _0xd59a=function(_0x11c2d3,_0x144ea2){_0x11c2d3=_0x11c2d3-0x0;var _0x4e3b7a=_0x59ad[_0x11c2d3];return _0x4e3b7a;};'use strict';var _=require(_0xd59a('0x0'));var moment=require(_0xd59a('0x1'));var util=require('util');var Redis=require(_0xd59a('0x2'));var config=require(_0xd59a('0x3'));var logger=require(_0xd59a('0x4'))(_0xd59a('0x5'));var ami=require(_0xd59a('0x6'));config['redis']=_['defaults'](config[_0xd59a('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xd59a('0x8'))(new Redis(config[_0xd59a('0x7')]));function VoiceDialReport(_0x5271ef){this[_0xd59a('0x9')]=_0x5271ef['outboundChannels'];this['outbound']=_0x5271ef[_0xd59a('0xa')];this['variables']={};ami['on'](_0xd59a('0xb'),this['syncDialBegin'][_0xd59a('0xc')](this));ami['on']('dialend',this[_0xd59a('0xd')][_0xd59a('0xc')](this));ami['on'](_0xd59a('0xe'),this[_0xd59a('0xf')]['bind'](this));ami['on'](_0xd59a('0x10'),this[_0xd59a('0x11')]['bind'](this));}VoiceDialReport[_0xd59a('0x12')][_0xd59a('0x13')]=function(_0x5235e2){return _0x5235e2!==null&&!_['isUndefined'](_0x5235e2);};VoiceDialReport[_0xd59a('0x12')][_0xd59a('0x14')]=function(_0x7968db,_0x36d1a0,_0x584580){io['to'](_0x7968db)[_0xd59a('0x14')](_0x36d1a0,_0x584580);};VoiceDialReport['prototype'][_0xd59a('0x15')]=function(_0x193666){try{if(this[_0xd59a('0x13')](_0x193666)){if(this[_0xd59a('0x9')][_0x193666[_0xd59a('0x16')]]){_[_0xd59a('0x17')](this[_0xd59a('0x9')][_0x193666['uniqueid']],{'starttime':moment()['format'](_0xd59a('0x18')),'lastevent':'called','interface':_0x193666['channel'][_0xd59a('0x19')](0x0,_0x193666[_0xd59a('0x1a')][_0xd59a('0x1b')]('-')),'membername':_0x193666[_0xd59a('0x1a')]['substring'](_0x193666['channel'][_0xd59a('0x1b')]('/')+0x1,_0x193666[_0xd59a('0x1a')][_0xd59a('0x1b')]('-'))},_['omit'](_0x193666,[_0xd59a('0x1c'),_0xd59a('0x1d')]));this[_0xd59a('0x14')]('voice:outbound','voice_outbound_channel:save',this[_0xd59a('0x9')][_0x193666[_0xd59a('0x16')]]);ami[_0xd59a('0x14')]('custom:dialbegin',this[_0xd59a('0x9')][_0x193666[_0xd59a('0x16')]]);}}}catch(_0x2ebaf4){logger['error'](_0xd59a('0x1e'),util[_0xd59a('0x1f')](_0x2ebaf4,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd59a('0x12')][_0xd59a('0xd')]=function(_0x4a385b){try{if(this[_0xd59a('0x13')](_0x4a385b)){if(this[_0xd59a('0x9')][_0x4a385b[_0xd59a('0x16')]]){this[_0xd59a('0x9')][_0x4a385b[_0xd59a('0x16')]][_0xd59a('0x20')]=_0x4a385b[_0xd59a('0x20')];if(_0x4a385b[_0xd59a('0x20')]===_0xd59a('0x21')){this[_0xd59a('0x9')][_0x4a385b[_0xd59a('0x16')]]['connectedlinenum']=_0x4a385b[_0xd59a('0x22')];this['channels'][_0x4a385b[_0xd59a('0x16')]]['connectedlinename']=_0x4a385b[_0xd59a('0x23')];this['channels'][_0x4a385b[_0xd59a('0x16')]][_0xd59a('0x24')]=moment()[_0xd59a('0x25')](_0xd59a('0x18'));this['channels'][_0x4a385b[_0xd59a('0x16')]]['lastevent']=_0xd59a('0x26');ami[_0xd59a('0x14')]('custom:dialconnect',this[_0xd59a('0x9')][_0x4a385b[_0xd59a('0x16')]]);}this['emit'](_0xd59a('0x27'),'voice_outbound_channel:save',this[_0xd59a('0x9')][_0x4a385b[_0xd59a('0x16')]]);}}}catch(_0xc41e60){logger['error'](_0xd59a('0x28'),util[_0xd59a('0x1f')](_0xc41e60,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xd59a('0xf')]=function(_0x12c962){try{if(this[_0xd59a('0x13')](_0x12c962)){this[_0xd59a('0x29')](_0x12c962[_0xd59a('0x16')],_['keys'](_0x12c962[_0xd59a('0x2a')])[0x0],_0x12c962[_0xd59a('0x2b')]);if(this[_0xd59a('0x13')](_0x12c962['variable'])&&this['isNotNull'](_0x12c962['variable']['outboundrouteid'])){if(_[_0xd59a('0x2c')](this[_0xd59a('0x9')][_0x12c962['uniqueid']])){this[_0xd59a('0x9')][_0x12c962[_0xd59a('0x16')]]={'routeId':_0x12c962[_0xd59a('0x2b')],'variables':this[_0xd59a('0x2d')][_0x12c962[_0xd59a('0x16')]]};this[_0xd59a('0x14')](_0xd59a('0x27'),_0xd59a('0x2e'),this[_0xd59a('0x9')][_0x12c962[_0xd59a('0x16')]]);}}}}catch(_0x440d60){logger[_0xd59a('0x2f')](_0xd59a('0x30'),util[_0xd59a('0x1f')](_0x440d60,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd59a('0x12')]['addVariable']=function(_0x2c0fb9,_0x4ed805,_0x3450e1){var _0x5a19ee=['rtpaudioqos',_0xd59a('0x31'),_0xd59a('0x32'),_0xd59a('0x33'),'rtpaudioqosloss',_0xd59a('0x34'),_0xd59a('0x35'),_0xd59a('0x36'),_0xd59a('0x37'),_0xd59a('0x38'),_0xd59a('0x39'),_0xd59a('0x3a'),_0xd59a('0x3b'),_0xd59a('0x3c'),_0xd59a('0x3d'),_0xd59a('0x3e'),_0xd59a('0x3f'),'memberpenalty',_0xd59a('0x40')];if(!_[_0xd59a('0x41')](_0x4ed805)&&!_[_0xd59a('0x42')](_0x5a19ee,_0x4ed805)){if(_[_0xd59a('0x2c')](this[_0xd59a('0x2d')][_0x2c0fb9])){this[_0xd59a('0x2d')][_0x2c0fb9]={};}this[_0xd59a('0x2d')][_0x2c0fb9][_0x4ed805]=_0x3450e1;}};VoiceDialReport[_0xd59a('0x12')][_0xd59a('0x11')]=function(_0xcf419f){try{if(this['isNotNull'](_0xcf419f)){if(this['channels'][_0xcf419f[_0xd59a('0x16')]]){this['channels'][_0xcf419f[_0xd59a('0x16')]]['endtime']=moment()[_0xd59a('0x25')](_0xd59a('0x18'));this[_0xd59a('0x9')][_0xcf419f[_0xd59a('0x16')]][_0xd59a('0x43')]=moment(this['channels'][_0xcf419f[_0xd59a('0x16')]][_0xd59a('0x44')])['diff'](this[_0xd59a('0x9')][_0xcf419f[_0xd59a('0x16')]][_0xd59a('0x45')],'seconds');this[_0xd59a('0x9')][_0xcf419f[_0xd59a('0x16')]][_0xd59a('0x46')]=_0xd59a('0x47');this['outbound'][_0xd59a('0x48')]+=0x1;if(this[_0xd59a('0x9')][_0xcf419f[_0xd59a('0x16')]]['answertime']){this[_0xd59a('0xa')][_0xd59a('0x49')]+=0x1;this[_0xd59a('0x9')][_0xcf419f[_0xd59a('0x16')]]['holdtime']=moment(this[_0xd59a('0x9')][_0xcf419f['uniqueid']][_0xd59a('0x24')])[_0xd59a('0x4a')](this[_0xd59a('0x9')][_0xcf419f[_0xd59a('0x16')]]['starttime'],'seconds');this[_0xd59a('0x9')][_0xcf419f[_0xd59a('0x16')]][_0xd59a('0x4b')]=moment(this[_0xd59a('0x9')][_0xcf419f[_0xd59a('0x16')]][_0xd59a('0x44')])[_0xd59a('0x4a')](this[_0xd59a('0x9')][_0xcf419f[_0xd59a('0x16')]]['answertime'],_0xd59a('0x4c'));this[_0xd59a('0xa')][_0xd59a('0x4d')]+=this['channels'][_0xcf419f[_0xd59a('0x16')]][_0xd59a('0x4e')]||0x0;this[_0xd59a('0xa')][_0xd59a('0x4f')]+=this[_0xd59a('0x9')][_0xcf419f[_0xd59a('0x16')]][_0xd59a('0x4b')];}this[_0xd59a('0xa')][_0xd59a('0x50')]+=this['channels'][_0xcf419f[_0xd59a('0x16')]][_0xd59a('0x43')];ami[_0xd59a('0x14')](_0xd59a('0x51'),this[_0xd59a('0x9')][_0xcf419f['uniqueid']]);ami['emit']('custom:dialend',this['channels'][_0xcf419f[_0xd59a('0x16')]]);this[_0xd59a('0x14')]('voice:outbound','voice_outbound:save',this[_0xd59a('0xa')]);this['emit'](_0xd59a('0x27'),'voice_outbound_channel:remove',this['channels'][_0xcf419f[_0xd59a('0x16')]]);delete this['channels'][_0xcf419f[_0xd59a('0x16')]];}if(this[_0xd59a('0x2d')][_0xcf419f['uniqueid']]){delete this[_0xd59a('0x2d')][_0xcf419f['uniqueid']];}}}catch(_0x3ead96){logger[_0xd59a('0x2f')](_0xd59a('0x52'),util[_0xd59a('0x1f')](_0x3ead96,{'showHidden':![],'depth':null}));}};module[_0xd59a('0x53')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 3b41ae4..0266938 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 _0xd630=['transferexten','destexten','transferuniqueid','COMPLETEDBY','toUpperCase','syncVarSet','addVariable','value','variable','queuestatus','EXITWITHKEY','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','memberinterface','memberlastcall','membername','memberrealtime','includes','diff','length','total','answered','sumBillable','milliseconds','seconds','queuecallercompleteAt','lastevent','custom:queuecallerunmanaged','sumHoldTime','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','transfereeuniqueid','secondtransfererexten','ATTENDEDTRANSFER','ATTENDED','secondtransfereruniqueid','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','syncBlindTransfer','BLINDTRANSFER','BLIND','extension','BlindTransfer','context','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','mohstarttime','[syncMusicOnHoldStart][VoiceQueueReport]','mohtime','[syncMusicOnHoldStop][VoiceQueueReport]','exports','lodash','moment','bluebird','md5','ioredis','../../../config/logger','ami','../ami','../model/queueReport','defaults','localhost','socket.io-emitter','redis','prototype','tail','finally','sequence','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','bind','queuesummarycomplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','loopQueueSummary','isUndefined','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','clearZombieChannels','switch','enqueue','isNil','Action','status','channel','message','[voiceQueueReport][checkChannel]','queueReports','[voiceQueueReport][checkQueueReport]','error','[voiceQueueReport][checkVariables]','clearQueueReport','inspect','emit','emitVoiceQueueChannelSave','format','voice:queue:%s','name','voice_queue_channel:save','emitVoiceQueueChannelRemove','voice_queue_channel:remove','type','inbound','strategy','available','loggedIn','sumDuration','unmanaged','abandoned','Trunk','active','Interval','stringify','loopQueueShow','catch','[queues]','syncQueueSummary','isNotNull','queue','countBy','toNumber','loggedin','callers','emitVoiceQueueSummary','[syncQueueSummary][VoiceQueueReport]','syncQueueSummaryComplete','syncNewExten','uniqueid','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','pick','keys','push','last','queuecallercomplete','holdtime','originalposition','queuecallerabandonAt','ABANDONED','syncQueueCallerLeave','queuecallerleaveAt','connectedlinenum','connectedlinename','queuecallerexitreason','COMPLETEDBYAGENT','[syncAgentConnect][VoiceQueueReport]','assigned','lastAssignedTo','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','startsWith','toLowerCase','local/','linkedid','add','FORWARDTRANSFER','transfertype','FORWARD'];(function(_0xca9718,_0x59369e){var _0x14f91a=function(_0x31a654){while(--_0x31a654){_0xca9718['push'](_0xca9718['shift']());}};_0x14f91a(++_0x59369e);}(_0xd630,0x1c7));var _0x0d63=function(_0x6aa7c3,_0x2309e0){_0x6aa7c3=_0x6aa7c3-0x0;var _0x5cf418=_0xd630[_0x6aa7c3];return _0x5cf418;};'use strict';var _=require(_0x0d63('0x0'));var moment=require(_0x0d63('0x1'));var BPromise=require(_0x0d63('0x2'));var util=require('util');var md5=require(_0x0d63('0x3'));var Redis=require(_0x0d63('0x4'));var config=require('../../../config/environment');var logger=require(_0x0d63('0x5'))(_0x0d63('0x6'));var ami=require(_0x0d63('0x7'));var QueueReport=require(_0x0d63('0x8'));config['redis']=_[_0x0d63('0x9')](config['redis'],{'host':_0x0d63('0xa'),'port':0x18eb});var io=require(_0x0d63('0xb'))(new Redis(config[_0x0d63('0xc')]));var Sequence=function(){};Sequence[_0x0d63('0xd')]['enqueue']=function(_0x1647e4){this[_0x0d63('0xe')]=this[_0x0d63('0xe')]?this[_0x0d63('0xe')][_0x0d63('0xf')](_0x1647e4):_0x1647e4();};function VoiceQueueReport(_0x4a56d3){this[_0x0d63('0x10')]=new Sequence();this['queueReports']={};this[_0x0d63('0x11')]=_0x4a56d3[_0x0d63('0x11')];this[_0x0d63('0x12')]=_0x4a56d3[_0x0d63('0x13')];this[_0x0d63('0x14')]=_0x4a56d3[_0x0d63('0x14')];this[_0x0d63('0x15')]=!![];this[_0x0d63('0x16')]=_0x4a56d3['campaigns'];this[_0x0d63('0x17')]={};ami['on'](_0x0d63('0x18'),this['syncQueueSummary'][_0x0d63('0x19')](this));ami['on'](_0x0d63('0x1a'),this['syncQueueSummaryComplete'][_0x0d63('0x19')](this));ami['on'](_0x0d63('0x1b'),this[_0x0d63('0x1c')]['bind'](this));ami['on'](_0x0d63('0x1d'),this['syncQueueCallerAbandon'][_0x0d63('0x19')](this));ami['on'](_0x0d63('0x1e'),this['syncQueueCallerLeave'][_0x0d63('0x19')](this));ami['on'](_0x0d63('0x1f'),this[_0x0d63('0x20')][_0x0d63('0x19')](this));ami['on'](_0x0d63('0x21'),this[_0x0d63('0x22')][_0x0d63('0x19')](this));ami['on'](_0x0d63('0x23'),this['syncVarSet']['bind'](this));ami['on'](_0x0d63('0x24'),this[_0x0d63('0x25')][_0x0d63('0x19')](this));ami['on'](_0x0d63('0x26'),this[_0x0d63('0x27')]['bind'](this));ami['on'](_0x0d63('0x28'),this[_0x0d63('0x29')][_0x0d63('0x19')](this));ami['on'](_0x0d63('0x2a'),this[_0x0d63('0x2b')]['bind'](this));ami['on'](_0x0d63('0x2c'),this[_0x0d63('0x2d')][_0x0d63('0x19')](this));ami['on'](_0x0d63('0x2e'),this['syncBlindTransfer'][_0x0d63('0x19')](this));this[_0x0d63('0x2f')]();this['loopQueueShow']();}function isNotNull(_0x481939){return _0x481939!==null&&!_[_0x0d63('0x30')](_0x481939);}function clearChannels(_0x26c856){if(!_[_0x0d63('0x31')](_0x26c856)){for(var _0x29debc in _0x26c856){if(_0x26c856[_0x0d63('0x32')](_0x29debc)){delete _0x26c856[_0x29debc];}}}}function clearCampaigns(_0x5c773c){if(!_[_0x0d63('0x31')](_0x5c773c)){for(var _0x1b00f3 in _0x5c773c){if(_0x5c773c[_0x0d63('0x32')](_0x1b00f3)){_0x5c773c[_0x1b00f3]['originated']=0x0;}}}}function clearVoiceQueues(_0x3126d9){if(!_[_0x0d63('0x31')](_0x3126d9)){for(var _0x5f225b in _0x3126d9){if(_0x3126d9[_0x0d63('0x32')](_0x5f225b)){_0x3126d9[_0x5f225b][_0x0d63('0x33')]=0x0;_0x3126d9[_0x5f225b][_0x0d63('0x34')]=0x0;_0x3126d9[_0x5f225b][_0x0d63('0x35')]=0x0;_0x3126d9[_0x5f225b][_0x0d63('0x36')]=0x0;_0x3126d9[_0x5f225b][_0x0d63('0x37')]=!![];}}}}function clearAgentBooked(_0x3c0c33){if(!_[_0x0d63('0x31')](_0x3c0c33)){for(var _0x1be362 in _0x3c0c33){if(_0x3c0c33[_0x0d63('0x32')](_0x1be362)){_0x3c0c33[_0x1be362][_0x0d63('0x38')]=!![];}}}}VoiceQueueReport['prototype'][_0x0d63('0x39')]=function(){var _0x1607fe=this;for(var _0x346d6d in this[_0x0d63('0x12')]){if(this[_0x0d63('0x12')][_0x0d63('0x32')](_0x346d6d)&&!this['channels'][_0x346d6d][_0x0d63('0x3a')]){this[_0x0d63('0x10')][_0x0d63('0x3b')](function(){if(!_[_0x0d63('0x3c')](_0x1607fe['channels'][_0x346d6d])){return ami[_0x0d63('0x3d')]({'action':_0x0d63('0x3e'),'channel':_0x1607fe['channels'][_0x346d6d][_0x0d63('0x3f')]})['catch'](function(_0x1010a7){if(_0x1010a7[_0x0d63('0x40')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x1607fe[_0x0d63('0x12')][_0x346d6d]){delete _0x1607fe[_0x0d63('0x12')][_0x346d6d];logger['error'](_0x0d63('0x41'),_0x346d6d);}if(_0x1607fe['queueReports'][_0x346d6d]){delete _0x1607fe[_0x0d63('0x42')][_0x346d6d];logger['error'](_0x0d63('0x43'),_0x346d6d);}if(_0x1607fe[_0x0d63('0x17')][_0x346d6d]){delete _0x1607fe[_0x0d63('0x17')][_0x346d6d];logger[_0x0d63('0x44')](_0x0d63('0x45'),_0x346d6d);}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0x0d63('0x27')]=function(){logger[_0x0d63('0x44')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0x0d63('0x12')]);this[_0x0d63('0x46')](this[_0x0d63('0x42')]);clearAgentBooked(this[_0x0d63('0x11')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0x0d63('0x16')]);};VoiceQueueReport['prototype'][_0x0d63('0x46')]=function(_0x2adc03){var _0x2aedcf=this;if(!_[_0x0d63('0x31')](_0x2adc03)){for(var _0x16034c in _0x2adc03){if(_0x2adc03['hasOwnProperty'](_0x16034c)){_0x2aedcf['emitVoiceQueueChannelRemove'](_0x2adc03[_0x16034c]);delete _0x2adc03[_0x16034c];}}}};function loggerCatch(_0x1038d1){return function(_0x2c9381){logger['error'](_0x1038d1,util[_0x0d63('0x47')](_0x2c9381,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0x0d63('0xd')][_0x0d63('0x48')]=function(_0x4b31ba,_0x52c2d6,_0x2b9a03){io['to'](_0x4b31ba)['emit'](_0x52c2d6,_0x2b9a03);};VoiceQueueReport['prototype'][_0x0d63('0x49')]=function(_0x3c95d8){this['emit'](util[_0x0d63('0x4a')](_0x0d63('0x4b'),_0x3c95d8[_0x0d63('0x4c')]),_0x0d63('0x4d'),_0x3c95d8);};VoiceQueueReport[_0x0d63('0xd')][_0x0d63('0x4e')]=function(_0x243aa0){this[_0x0d63('0x48')](util[_0x0d63('0x4a')](_0x0d63('0x4b'),_0x243aa0['name']),_0x0d63('0x4f'),_0x243aa0);};VoiceQueueReport[_0x0d63('0xd')]['emitVoiceQueueSummary']=function(_0x2f462f){if(_0x2f462f[_0x0d63('0x50')]===_0x0d63('0x51')){var _0x2d7fa5={'id':_0x2f462f['id'],'name':_0x2f462f[_0x0d63('0x4c')],'strategy':_0x2f462f[_0x0d63('0x52')],'answered':_0x2f462f['answered'],'available':_0x2f462f[_0x0d63('0x53')],'loggedIn':_0x2f462f[_0x0d63('0x54')],'pTalking':_0x2f462f['pTalking'],'sumBillable':_0x2f462f['sumBillable'],'sumDuration':_0x2f462f[_0x0d63('0x55')],'sumHoldTime':_0x2f462f['sumHoldTime']||0x0,'talking':_0x2f462f['talking'],'total':_0x2f462f['total'],'type':_0x2f462f['type'],'unmanaged':_0x2f462f[_0x0d63('0x56')],'abandoned':_0x2f462f[_0x0d63('0x57')],'waiting':_0x2f462f[_0x0d63('0x36')]};if(_0x2f462f[_0x0d63('0x58')]){_0x2d7fa5[_0x0d63('0x58')]={'id':_0x2f462f[_0x0d63('0x58')]['id'],'name':_0x2f462f[_0x0d63('0x58')][_0x0d63('0x4c')],'active':_0x2f462f['Trunk'][_0x0d63('0x59')],'callerid':_0x2f462f['Trunk']['callerid']};}if(_0x2f462f[_0x0d63('0x5a')]){_0x2d7fa5[_0x0d63('0x5a')]={'id':_0x2f462f[_0x0d63('0x5a')]['id'],'name':_0x2f462f[_0x0d63('0x5a')][_0x0d63('0x4c')]};}var _0x4120b5=md5(JSON[_0x0d63('0x5b')](_0x2d7fa5));if(_0x2f462f[_0x0d63('0x3')]!==_0x4120b5){_0x2f462f[_0x0d63('0x3')]=_0x4120b5;this[_0x0d63('0x48')](util[_0x0d63('0x4a')](_0x0d63('0x4b'),_0x2d7fa5[_0x0d63('0x4c')]),'voice_queue:save',_0x2d7fa5);}}};VoiceQueueReport[_0x0d63('0xd')]['isNotNull']=function(_0x5878e4){return _0x5878e4!==null&&!_[_0x0d63('0x30')](_0x5878e4);};VoiceQueueReport[_0x0d63('0xd')][_0x0d63('0x5c')]=function(){var _0x58faca=this;setInterval(function(){_0x58faca[_0x0d63('0x39')]();ami[_0x0d63('0x3d')]({'action':'queues'})[_0x0d63('0x5d')](loggerCatch(_0x0d63('0x5e')));},0x2710);};VoiceQueueReport[_0x0d63('0xd')][_0x0d63('0x2f')]=function(){var _0x50e883=this;setInterval(function(){if(_0x50e883[_0x0d63('0x15')]){return ami[_0x0d63('0x3d')]({'action':_0x0d63('0x18')})['then'](function(_0x1aa8cd){_0x50e883[_0x0d63('0x15')]=![];})[_0x0d63('0x5d')](loggerCatch('[queuesummary]'));}},0x3e8);};VoiceQueueReport[_0x0d63('0xd')][_0x0d63('0x5f')]=function(_0x25764e){try{if(this[_0x0d63('0x60')](_0x25764e)&&this[_0x0d63('0x60')](_0x25764e[_0x0d63('0x61')])){if(this[_0x0d63('0x14')][_0x25764e[_0x0d63('0x61')]]){var _0x35bbae=_[_0x0d63('0x62')](this[_0x0d63('0x12')],_0x0d63('0x61'))[_0x25764e[_0x0d63('0x61')]]||0x0;var _0x9c0a6f=_0x35bbae-_0x25764e['callers'];if(this[_0x0d63('0x14')][_0x25764e['queue']]['waiting']!==_[_0x0d63('0x63')](_0x25764e['callers'])||this['voiceQueues'][_0x25764e['queue']][_0x0d63('0x54')]!==_['toNumber'](_0x25764e[_0x0d63('0x64')])||this[_0x0d63('0x14')][_0x25764e[_0x0d63('0x61')]]['available']!==_[_0x0d63('0x63')](_0x25764e['available'])||this[_0x0d63('0x14')][_0x25764e[_0x0d63('0x61')]][_0x0d63('0x34')]!==_0x9c0a6f){this['voiceQueues'][_0x25764e[_0x0d63('0x61')]][_0x0d63('0x36')]=_[_0x0d63('0x63')](_0x25764e[_0x0d63('0x65')]);this[_0x0d63('0x14')][_0x25764e[_0x0d63('0x61')]][_0x0d63('0x54')]=_[_0x0d63('0x63')](_0x25764e[_0x0d63('0x64')]);this[_0x0d63('0x14')][_0x25764e[_0x0d63('0x61')]][_0x0d63('0x53')]=_['toNumber'](_0x25764e[_0x0d63('0x53')]);this[_0x0d63('0x14')][_0x25764e[_0x0d63('0x61')]][_0x0d63('0x34')]=_0x9c0a6f>0x0?_0x9c0a6f:0x0;this[_0x0d63('0x14')][_0x25764e['queue']][_0x0d63('0x34')]=this[_0x0d63('0x14')][_0x25764e[_0x0d63('0x61')]]['talking']>_['toNumber'](_0x25764e['loggedin'])?_[_0x0d63('0x63')](_0x25764e[_0x0d63('0x64')]):this[_0x0d63('0x14')][_0x25764e[_0x0d63('0x61')]][_0x0d63('0x34')];this[_0x0d63('0x66')](this[_0x0d63('0x14')][_0x25764e[_0x0d63('0x61')]]);}ami['emit']('custom:queuesummary',this[_0x0d63('0x14')][_0x25764e[_0x0d63('0x61')]]);}}}catch(_0x48f26d){logger[_0x0d63('0x44')](_0x0d63('0x67'),util['inspect'](_0x48f26d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0d63('0xd')][_0x0d63('0x68')]=function(_0x149b90){this['flagQueueSummary']=!![];};VoiceQueueReport[_0x0d63('0xd')][_0x0d63('0x69')]=function(_0x480020){};VoiceQueueReport['prototype'][_0x0d63('0x1c')]=function(_0x20f602){try{if(this[_0x0d63('0x60')](_0x20f602)){if(_[_0x0d63('0x30')](this[_0x0d63('0x42')][_0x20f602['uniqueid']])){this[_0x0d63('0x42')][_0x20f602[_0x0d63('0x6a')]]=[];this['channels'][_0x20f602[_0x0d63('0x6a')]]={};}var _0x3efdef=new QueueReport();_0x3efdef[_0x0d63('0x4c')]=_0x20f602[_0x0d63('0x61')];_0x3efdef[_0x0d63('0x50')]=this[_0x0d63('0x14')][_0x3efdef[_0x0d63('0x4c')]]&&this['voiceQueues'][_0x3efdef['name']][_0x0d63('0x50')]?this['voiceQueues'][_0x3efdef[_0x0d63('0x4c')]][_0x0d63('0x50')]||_0x0d63('0x51'):_0x0d63('0x51');_0x3efdef['queue']=_0x20f602[_0x0d63('0x61')];_0x3efdef[_0x0d63('0x6b')]=moment()[_0x0d63('0x4a')](_0x0d63('0x6c'));_0x3efdef['position']=_0x20f602[_0x0d63('0x6d')];_0x3efdef['count']=_0x20f602[_0x0d63('0x6e')];_['merge'](_0x3efdef,_[_0x0d63('0x6f')](_0x20f602,_[_0x0d63('0x70')](_0x3efdef)));this['queueReports'][_0x20f602[_0x0d63('0x6a')]][_0x0d63('0x71')](_0x3efdef);this[_0x0d63('0x12')][_0x20f602[_0x0d63('0x6a')]]=_0x3efdef;this['emitVoiceQueueChannelSave'](_0x3efdef);}}catch(_0x607fe9){logger[_0x0d63('0x44')]('[syncQueueCallerJoin][VoiceQueueReport]',util['inspect'](_0x607fe9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0d63('0xd')]['syncQueueCallerAbandon']=function(_0xeff055){try{if(this[_0x0d63('0x60')](_0xeff055)){if(this[_0x0d63('0x42')][_0xeff055[_0x0d63('0x6a')]]){var _0x561a44=_[_0x0d63('0x72')](this[_0x0d63('0x42')][_0xeff055['uniqueid']]);_0x561a44[_0x0d63('0x73')]=![];_0x561a44['queuecallercompleteAt']=null;_0x561a44[_0x0d63('0x74')]=_0xeff055[_0x0d63('0x74')];_0x561a44[_0x0d63('0x75')]=_0xeff055[_0x0d63('0x75')];_0x561a44[_0x0d63('0x1d')]=!![];_0x561a44[_0x0d63('0x76')]=moment()[_0x0d63('0x4a')](_0x0d63('0x6c'));_0x561a44['queuecallerexitreason']=_0x0d63('0x77');_0x561a44['lastAssignedTo']=null;this['channels'][_0xeff055['uniqueid']]=_0x561a44;this[_0x0d63('0x4e')](_0x561a44);}}}catch(_0x72312b){logger['error']('[syncQueueCallerAbandon][VoiceQueueReport]',util[_0x0d63('0x47')](_0x72312b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0d63('0x78')]=function(_0x5e8f7f){try{if(this[_0x0d63('0x60')](_0x5e8f7f)){if(this[_0x0d63('0x42')][_0x5e8f7f[_0x0d63('0x6a')]]){var _0x38a112=_[_0x0d63('0x72')](this['queueReports'][_0x5e8f7f[_0x0d63('0x6a')]]);_0x38a112[_0x0d63('0x79')]=moment()['format'](_0x0d63('0x6c'));_0x38a112[_0x0d63('0x7a')]=_0x5e8f7f[_0x0d63('0x7a')];_0x38a112[_0x0d63('0x7b')]=_0x5e8f7f[_0x0d63('0x7b')];this['channels'][_0x5e8f7f[_0x0d63('0x6a')]]=_0x38a112;this[_0x0d63('0x49')](_0x38a112);}}}catch(_0xce02e6){logger[_0x0d63('0x44')]('[syncQueueCallerLeave][VoiceQueueReport]',util[_0x0d63('0x47')](_0xce02e6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0d63('0xd')][_0x0d63('0x22')]=function(_0x7cd28b){try{if(this[_0x0d63('0x60')](_0x7cd28b)){if(this['queueReports'][_0x7cd28b[_0x0d63('0x6a')]]){var _0x507ca6=_[_0x0d63('0x72')](this[_0x0d63('0x42')][_0x7cd28b[_0x0d63('0x6a')]]);_0x507ca6['queuecallercomplete']=!![];_0x507ca6[_0x0d63('0x7c')]=_0x0d63('0x7d');}}}catch(_0x2e8816){logger[_0x0d63('0x44')](_0x0d63('0x7e'),util[_0x0d63('0x47')](_0x2e8816,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0d63('0xd')]['syncAgentComplete']=function(_0x4db849){try{if(this[_0x0d63('0x60')](_0x4db849)){if(this[_0x0d63('0x42')][_0x4db849[_0x0d63('0x6a')]]){var _0x49a83a=_['last'](this[_0x0d63('0x42')][_0x4db849['uniqueid']]);_0x49a83a[_0x0d63('0x1d')]=![];_0x49a83a[_0x0d63('0x76')]=null;_0x49a83a[_0x0d63('0x7f')]=!![];_0x49a83a[_0x0d63('0x80')]=_0x4db849['membername'];_0x49a83a['holdtime']=_0x4db849['holdtime'];_0x49a83a[_0x0d63('0x73')]=!![];_0x49a83a[_0x0d63('0x81')]=![];_0x49a83a[_0x0d63('0x82')]=null;if(!_0x49a83a[_0x0d63('0x83')]){if(_0x4db849[_0x0d63('0x84')]=='transfer'){_0x49a83a[_0x0d63('0x7c')]=_0x0d63('0x85');}else{if(_[_0x0d63('0x86')](_0x4db849[_0x0d63('0x3f')][_0x0d63('0x87')](),_0x0d63('0x88'))){if(this[_0x0d63('0x42')][_0x4db849[_0x0d63('0x89')]]){var _0x5aafb4=_[_0x0d63('0x72')](this['queueReports'][_0x4db849['linkedid']]);_0x5aafb4['queuecallercomplete']=![];_0x5aafb4[_0x0d63('0x81')]=!![];_0x5aafb4[_0x0d63('0x82')]=moment(_0x49a83a[_0x0d63('0x6b')])[_0x0d63('0x8a')](_0x4db849[_0x0d63('0x74')],'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5aafb4[_0x0d63('0x7c')]=_0x0d63('0x8b');_0x5aafb4[_0x0d63('0x83')]=!![];_0x5aafb4[_0x0d63('0x8c')]=_0x0d63('0x8d');_0x5aafb4[_0x0d63('0x8e')]=_0x4db849[_0x0d63('0x8f')];_0x5aafb4[_0x0d63('0x90')]=_0x4db849[_0x0d63('0x6a')];var _0xaca4f1=this[_0x0d63('0x42')][_0x4db849[_0x0d63('0x89')]];this[_0x0d63('0x42')][_0x4db849[_0x0d63('0x89')]]=this[_0x0d63('0x42')][_0x4db849[_0x0d63('0x6a')]];this['queueReports'][_0x4db849[_0x0d63('0x6a')]]=_0xaca4f1;}}else{_0x49a83a[_0x0d63('0x7c')]=_0x0d63('0x91')+_0x4db849['reason'][_0x0d63('0x92')]();}}}this[_0x0d63('0x12')][_0x4db849[_0x0d63('0x6a')]]=_0x49a83a;this[_0x0d63('0x4e')](_0x49a83a);}}}catch(_0x5027f5){logger['error']('[syncAgentComplete][VoiceQueueReport]',util[_0x0d63('0x47')](_0x5027f5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0d63('0xd')][_0x0d63('0x93')]=function(_0x6c6ad9){try{if(this[_0x0d63('0x60')](_0x6c6ad9)){this[_0x0d63('0x94')](_0x6c6ad9[_0x0d63('0x6a')],_[_0x0d63('0x70')](_0x6c6ad9['variable'])[0x0],_0x6c6ad9[_0x0d63('0x95')]);if(this[_0x0d63('0x42')][_0x6c6ad9[_0x0d63('0x6a')]]){var _0x59dec1=_[_0x0d63('0x72')](this['queueReports'][_0x6c6ad9[_0x0d63('0x6a')]]);if(_0x59dec1){if(this[_0x0d63('0x60')](_0x6c6ad9[_0x0d63('0x96')])&&this['isNotNull'](_0x6c6ad9[_0x0d63('0x96')][_0x0d63('0x97')])){switch(_0x6c6ad9[_0x0d63('0x95')]){case'CONTINUE':_0x59dec1[_0x0d63('0x81')]=![];_0x59dec1[_0x0d63('0x82')]=null;break;default:_0x59dec1[_0x0d63('0x81')]=!![];_0x59dec1[_0x0d63('0x82')]=moment()[_0x0d63('0x4a')](_0x0d63('0x6c'));_0x59dec1[_0x0d63('0x79')]=moment()[_0x0d63('0x4a')](_0x0d63('0x6c'));}_0x59dec1[_0x0d63('0x1d')]=![];_0x59dec1[_0x0d63('0x76')]=null;_0x59dec1[_0x0d63('0x7c')]=_0x6c6ad9[_0x0d63('0x95')];this[_0x0d63('0x12')][_0x6c6ad9[_0x0d63('0x6a')]]=_0x59dec1;this['emitVoiceQueueChannelRemove'](_0x59dec1);}else if(this['isNotNull'](_0x6c6ad9[_0x0d63('0x96')])&&this['isNotNull'](_0x6c6ad9[_0x0d63('0x96')]['queueposition'])){if(!_0x59dec1[_0x0d63('0x1d')]){_0x59dec1[_0x0d63('0x81')]=!![];_0x59dec1[_0x0d63('0x82')]=moment()[_0x0d63('0x4a')](_0x0d63('0x6c'));_0x59dec1[_0x0d63('0x7c')]=_0x0d63('0x98');_0x59dec1[_0x0d63('0x79')]=moment()[_0x0d63('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x0d63('0x12')][_0x6c6ad9[_0x0d63('0x6a')]]=_0x59dec1;}}_0x59dec1[_0x0d63('0x17')]=this['variables'][_0x6c6ad9[_0x0d63('0x6a')]];}}}}catch(_0x33d55a){logger['error']('[syncVarSet][VoiceQueueReport]',util[_0x0d63('0x47')](_0x33d55a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0d63('0xd')][_0x0d63('0x94')]=function(_0x5f4c27,_0x5025d7,_0x7a23fa){var _0x39f930=['rtpaudioqos','rtpaudioqosbridged',_0x0d63('0x99'),_0x0d63('0x9a'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x0d63('0x9b'),_0x0d63('0x9c'),_0x0d63('0x9d'),'sipuri',_0x0d63('0x9e'),_0x0d63('0x9f'),'membercalls','memberdynamic',_0x0d63('0xa0'),_0x0d63('0xa1'),_0x0d63('0xa2'),'memberpenalty',_0x0d63('0xa3')];if(!_[_0x0d63('0x3c')](_0x5025d7)&&!_[_0x0d63('0xa4')](_0x39f930,_0x5025d7)){if(_['isUndefined'](this[_0x0d63('0x17')][_0x5f4c27])){this[_0x0d63('0x17')][_0x5f4c27]={};}this['variables'][_0x5f4c27][_0x5025d7]=_0x7a23fa;}};VoiceQueueReport['prototype']['syncHangup']=function(_0x10cbfe){try{if(this['isNotNull'](_0x10cbfe)){if(this[_0x0d63('0x42')][_0x10cbfe[_0x0d63('0x6a')]]){for(var _0x4bf84e=0x0,_0x523a5b={};_0x4bf84e0x0?_0x3513ff:0x0;this[_0x7844('0x13')][_0x1f061b['queue']][_0x7844('0x54')]=this[_0x7844('0x13')][_0x1f061b['queue']][_0x7844('0x54')]>_[_0x7844('0x64')](_0x1f061b[_0x7844('0x65')])?_['toNumber'](_0x1f061b[_0x7844('0x65')]):this['voiceQueues'][_0x1f061b[_0x7844('0x61')]][_0x7844('0x54')];this[_0x7844('0x4c')](this[_0x7844('0x13')][_0x1f061b['queue']]);}ami[_0x7844('0x46')]('custom:queuesummary',this[_0x7844('0x13')][_0x1f061b[_0x7844('0x61')]]);}}}catch(_0x5acf0e){logger[_0x7844('0x3f')](_0x7844('0x67'),util['inspect'](_0x5acf0e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7844('0x42')]['syncQueueSummaryComplete']=function(_0x10ec8f){this[_0x7844('0x14')]=!![];};VoiceQueueReport[_0x7844('0x42')][_0x7844('0x68')]=function(_0x3e8f66){};VoiceQueueReport[_0x7844('0x42')][_0x7844('0x1d')]=function(_0x5b5dd1){try{if(this[_0x7844('0x5c')](_0x5b5dd1)){if(_[_0x7844('0x31')](this[_0x7844('0x41')][_0x5b5dd1[_0x7844('0x69')]])){this[_0x7844('0x41')][_0x5b5dd1[_0x7844('0x69')]]=[];this[_0x7844('0x11')][_0x5b5dd1[_0x7844('0x69')]]={};}var _0x32683a=new QueueReport();_0x32683a[_0x7844('0x49')]=_0x5b5dd1[_0x7844('0x61')];_0x32683a[_0x7844('0x4d')]=this[_0x7844('0x13')][_0x32683a['name']]&&this[_0x7844('0x13')][_0x32683a[_0x7844('0x49')]]['type']?this[_0x7844('0x13')][_0x32683a[_0x7844('0x49')]][_0x7844('0x4d')]||'inbound':'inbound';_0x32683a[_0x7844('0x61')]=_0x5b5dd1[_0x7844('0x61')];_0x32683a[_0x7844('0x6a')]=moment()[_0x7844('0x48')](_0x7844('0x6b'));_0x32683a['position']=_0x5b5dd1['position'];_0x32683a[_0x7844('0x6c')]=_0x5b5dd1[_0x7844('0x6c')];_[_0x7844('0x6d')](_0x32683a,_['pick'](_0x5b5dd1,_[_0x7844('0x6e')](_0x32683a)));this[_0x7844('0x41')][_0x5b5dd1[_0x7844('0x69')]][_0x7844('0x6f')](_0x32683a);this[_0x7844('0x11')][_0x5b5dd1['uniqueid']]=_0x32683a;this[_0x7844('0x47')](_0x32683a);}}catch(_0x37e441){logger['error'](_0x7844('0x70'),util['inspect'](_0x37e441,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7844('0x42')][_0x7844('0x1f')]=function(_0x4a3fc5){try{if(this[_0x7844('0x5c')](_0x4a3fc5)){if(this['queueReports'][_0x4a3fc5['uniqueid']]){var _0x276090=_[_0x7844('0x71')](this['queueReports'][_0x4a3fc5['uniqueid']]);_0x276090[_0x7844('0x72')]=![];_0x276090[_0x7844('0x73')]=null;_0x276090[_0x7844('0x74')]=_0x4a3fc5[_0x7844('0x74')];_0x276090[_0x7844('0x75')]=_0x4a3fc5[_0x7844('0x75')];_0x276090['queuecallerabandon']=!![];_0x276090[_0x7844('0x76')]=moment()['format'](_0x7844('0x6b'));_0x276090[_0x7844('0x77')]=_0x7844('0x78');_0x276090[_0x7844('0x79')]=null;this[_0x7844('0x11')][_0x4a3fc5[_0x7844('0x69')]]=_0x276090;this[_0x7844('0x44')](_0x276090);}}}catch(_0x2f285a){logger['error'](_0x7844('0x7a'),util[_0x7844('0x45')](_0x2f285a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7844('0x42')][_0x7844('0x7b')]=function(_0x3dea3e){try{if(this['isNotNull'](_0x3dea3e)){if(this[_0x7844('0x41')][_0x3dea3e[_0x7844('0x69')]]){var _0x3428d7=_['last'](this[_0x7844('0x41')][_0x3dea3e[_0x7844('0x69')]]);_0x3428d7[_0x7844('0x7c')]=moment()[_0x7844('0x48')](_0x7844('0x6b'));_0x3428d7[_0x7844('0x7d')]=_0x3dea3e['connectedlinenum'];_0x3428d7[_0x7844('0x7e')]=_0x3dea3e[_0x7844('0x7e')];this[_0x7844('0x11')][_0x3dea3e[_0x7844('0x69')]]=_0x3428d7;this['emitVoiceQueueChannelSave'](_0x3428d7);}}}catch(_0x1fa475){logger[_0x7844('0x3f')](_0x7844('0x7f'),util[_0x7844('0x45')](_0x1fa475,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7844('0x23')]=function(_0x4e1868){try{if(this[_0x7844('0x5c')](_0x4e1868)){if(this[_0x7844('0x41')][_0x4e1868[_0x7844('0x69')]]){var _0x5d1dca=_[_0x7844('0x71')](this[_0x7844('0x41')][_0x4e1868['uniqueid']]);_0x5d1dca[_0x7844('0x72')]=!![];_0x5d1dca[_0x7844('0x77')]='COMPLETEDBYAGENT';}}}catch(_0x11b385){logger['error'](_0x7844('0x80'),util['inspect'](_0x11b385,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7844('0x42')]['syncAgentComplete']=function(_0x5e19ce){try{if(this[_0x7844('0x5c')](_0x5e19ce)){if(this['queueReports'][_0x5e19ce[_0x7844('0x69')]]){var _0x27dfe2=_[_0x7844('0x71')](this['queueReports'][_0x5e19ce['uniqueid']]);_0x27dfe2['queuecallerabandon']=![];_0x27dfe2['queuecallerabandonAt']=null;_0x27dfe2[_0x7844('0x81')]=!![];_0x27dfe2['lastAssignedTo']=_0x5e19ce['membername'];_0x27dfe2[_0x7844('0x74')]=_0x5e19ce[_0x7844('0x74')];_0x27dfe2[_0x7844('0x72')]=!![];_0x27dfe2[_0x7844('0x82')]=![];_0x27dfe2[_0x7844('0x83')]=null;if(!_0x27dfe2[_0x7844('0x84')]){if(_0x5e19ce[_0x7844('0x85')]==_0x7844('0x84')){_0x27dfe2['queuecallerexitreason']=_0x7844('0x86');}else{if(_[_0x7844('0x87')](_0x5e19ce[_0x7844('0x3c')][_0x7844('0x88')](),_0x7844('0x89'))){if(this['queueReports'][_0x5e19ce[_0x7844('0x8a')]]){var _0x3652fc=_[_0x7844('0x71')](this[_0x7844('0x41')][_0x5e19ce[_0x7844('0x8a')]]);_0x3652fc[_0x7844('0x72')]=![];_0x3652fc[_0x7844('0x82')]=!![];_0x3652fc[_0x7844('0x83')]=moment(_0x27dfe2[_0x7844('0x6a')])[_0x7844('0x8b')](_0x5e19ce[_0x7844('0x74')],_0x7844('0x8c'))[_0x7844('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x3652fc[_0x7844('0x77')]=_0x7844('0x8d');_0x3652fc[_0x7844('0x84')]=!![];_0x3652fc[_0x7844('0x8e')]=_0x7844('0x8f');_0x3652fc[_0x7844('0x90')]=_0x5e19ce[_0x7844('0x91')];_0x3652fc[_0x7844('0x92')]=_0x5e19ce[_0x7844('0x69')];var _0x33465a=this['queueReports'][_0x5e19ce[_0x7844('0x8a')]];this[_0x7844('0x41')][_0x5e19ce[_0x7844('0x8a')]]=this[_0x7844('0x41')][_0x5e19ce['uniqueid']];this[_0x7844('0x41')][_0x5e19ce[_0x7844('0x69')]]=_0x33465a;}}else{_0x27dfe2['queuecallerexitreason']=_0x7844('0x93')+_0x5e19ce[_0x7844('0x85')][_0x7844('0x94')]();}}}this[_0x7844('0x11')][_0x5e19ce['uniqueid']]=_0x27dfe2;this[_0x7844('0x44')](_0x27dfe2);}}}catch(_0x568120){logger[_0x7844('0x3f')](_0x7844('0x95'),util[_0x7844('0x45')](_0x568120,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7844('0x42')][_0x7844('0x25')]=function(_0x357770){try{if(this[_0x7844('0x5c')](_0x357770)){this[_0x7844('0x96')](_0x357770['uniqueid'],_[_0x7844('0x6e')](_0x357770[_0x7844('0x97')])[0x0],_0x357770[_0x7844('0x98')]);if(this['queueReports'][_0x357770['uniqueid']]){var _0x379aa9=_[_0x7844('0x71')](this[_0x7844('0x41')][_0x357770[_0x7844('0x69')]]);if(_0x379aa9){if(this['isNotNull'](_0x357770['variable'])&&this[_0x7844('0x5c')](_0x357770[_0x7844('0x97')][_0x7844('0x99')])){switch(_0x357770[_0x7844('0x98')]){case _0x7844('0x9a'):_0x379aa9['queuecallerexit']=![];_0x379aa9[_0x7844('0x83')]=null;break;default:_0x379aa9[_0x7844('0x82')]=!![];_0x379aa9[_0x7844('0x83')]=moment()[_0x7844('0x48')](_0x7844('0x6b'));_0x379aa9[_0x7844('0x7c')]=moment()['format'](_0x7844('0x6b'));}_0x379aa9[_0x7844('0x1e')]=![];_0x379aa9[_0x7844('0x76')]=null;_0x379aa9['queuecallerexitreason']=_0x357770[_0x7844('0x98')];this[_0x7844('0x11')][_0x357770[_0x7844('0x69')]]=_0x379aa9;this[_0x7844('0x44')](_0x379aa9);}else if(this[_0x7844('0x5c')](_0x357770['variable'])&&this[_0x7844('0x5c')](_0x357770['variable'][_0x7844('0x9b')])){if(!_0x379aa9[_0x7844('0x1e')]){_0x379aa9[_0x7844('0x82')]=!![];_0x379aa9[_0x7844('0x83')]=moment()[_0x7844('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x379aa9[_0x7844('0x77')]=_0x7844('0x9c');_0x379aa9[_0x7844('0x7c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x7844('0x11')][_0x357770[_0x7844('0x69')]]=_0x379aa9;}}_0x379aa9[_0x7844('0x16')]=this['variables'][_0x357770[_0x7844('0x69')]];}}}}catch(_0x43f66a){logger[_0x7844('0x3f')](_0x7844('0x9d'),util[_0x7844('0x45')](_0x43f66a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7844('0x96')]=function(_0x47a4f8,_0x130184,_0x373ae5){var _0x2a646e=['rtpaudioqos',_0x7844('0x9e'),_0x7844('0x9f'),_0x7844('0xa0'),_0x7844('0xa1'),'rtpaudioqoslossbridged',_0x7844('0xa2'),'rtpaudioqosrttbridged',_0x7844('0xa3'),_0x7844('0xa4'),_0x7844('0xa5'),'bridgepvtcallid',_0x7844('0xa6'),_0x7844('0xa7'),_0x7844('0xa8'),'memberlastcall','membername','memberpenalty',_0x7844('0xa9')];if(!_[_0x7844('0x39')](_0x130184)&&!_[_0x7844('0xaa')](_0x2a646e,_0x130184)){if(_[_0x7844('0x31')](this[_0x7844('0x16')][_0x47a4f8])){this['variables'][_0x47a4f8]={};}this['variables'][_0x47a4f8][_0x130184]=_0x373ae5;}};VoiceQueueReport[_0x7844('0x42')][_0x7844('0x27')]=function(_0x3dcc39){try{if(this['isNotNull'](_0x3dcc39)){if(this[_0x7844('0x41')][_0x3dcc39[_0x7844('0x69')]]){for(var _0x31ec68=0x0,_0x27c700={};_0x31ec68=0x0?moment(_0x4adff1['endtime'])['diff'](_0x4adff1['starttime'],_0x1cc0('0xf')):null,'data1':_0x1cc0('0x1a'),'data2':_0x4adff1[_0x1cc0('0x1b')],'data3':_0x4adff1[_0x1cc0('0x12')],'data4':_0x4adff1[_0x1cc0('0x1c')]||null,'role':_0x1cc0('0x14'),'internal':_0x4adff1['accountcode']?_[_0x1cc0('0x1d')](_0x4adff1[_0x1cc0('0x1b')]):undefined,'uniqueid':_0x4adff1[_0x1cc0('0x1e')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x684b=['moment','lodash','util','voiceQueueReport','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','SIP/%s','interface','TALKING','queuecallerleaveAt','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','starttime','endtime','diff','seconds','dialstring'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x684b,0x195));var _0xb684=function(_0x1c25a9,_0x372fff){_0x1c25a9=_0x1c25a9-0x0;var _0x18331f=_0x684b[_0x1c25a9];return _0x18331f;};'use strict';var moment=require(_0xb684('0x0'));var _=require(_0xb684('0x1'));var util=require(_0xb684('0x2'));var client=require('../client');exports[_0xb684('0x3')]=function(_0x180903){var _0x3bb28e=_0x180903['queuecallercompleteAt']||_0x180903[_0xb684('0x4')];return client[_0xb684('0x5')](_0xb684('0x6'),{'body':{'channel':_0xb684('0x7'),'membername':_0x180903[_0xb684('0x8')],'interface':_['isNil'](_0x180903['interface'])?util['format'](_0xb684('0x9'),_0x180903['lastAssignedTo']):_0x180903[_0xb684('0xa')],'type':_0xb684('0xb'),'enterAt':_0x180903[_0xb684('0xc')],'exitAt':_0x3bb28e,'duration':moment(_0x3bb28e)['diff'](_0x180903[_0xb684('0xc')],'seconds'),'data1':_0xb684('0xd'),'data2':_0x180903[_0xb684('0xe')],'data3':_0x180903[_0xb684('0xf')],'data4':null,'data5':_0x180903[_0xb684('0x10')],'role':_0xb684('0x11'),'internal':_0x180903[_0xb684('0x12')]?_[_0xb684('0x13')](_0x180903[_0xb684('0x12')]):undefined,'uniqueid':_0x180903[_0xb684('0x14')]},'log':'CreateMemberReport'});};exports[_0xb684('0x15')]=function(_0xc9edbd){return client[_0xb684('0x5')]('CreateMemberReport',{'body':{'channel':'voice','membername':_0xc9edbd['membername'],'interface':_0xc9edbd[_0xb684('0xa')],'type':_0xb684('0xb'),'enterAt':_0xc9edbd[_0xb684('0x16')],'exitAt':_0xc9edbd['endtime'],'duration':moment(_0xc9edbd[_0xb684('0x17')])[_0xb684('0x18')](_0xc9edbd[_0xb684('0x16')],_0xb684('0x19'))>=0x0?moment(_0xc9edbd['endtime'])['diff'](_0xc9edbd[_0xb684('0x16')],_0xb684('0x19')):null,'data1':'outbound','data2':_0xc9edbd['accountcode'],'data3':_0xc9edbd['exten'],'data4':_0xc9edbd[_0xb684('0x1a')]||null,'role':_0xb684('0x11'),'internal':_0xc9edbd[_0xb684('0x12')]?_[_0xb684('0x13')](_0xc9edbd[_0xb684('0x12')]):undefined,'uniqueid':_0xc9edbd['uniqueid']},'log':_0xb684('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index ea9f377..40f535d 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 _0x3ca7=['GetTemplate','name','../client','getTemplates','Request'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x3ca7,0x17e));var _0x73ca=function(_0x40b493,_0x4050de){_0x40b493=_0x40b493-0x0;var _0x548365=_0x3ca7[_0x40b493];return _0x548365;};'use strict';var client=require(_0x73ca('0x0'));exports[_0x73ca('0x1')]=function(_0x299b08){return function(_0x20ef0e){return client[_0x73ca('0x2')](_0x73ca('0x3'),{'options':{'raw':!![],'attributes':['id',_0x73ca('0x4'),'html']},'log':_0x73ca('0x3')});};}; \ No newline at end of file +var _0xc22f=['Request','GetTemplate','name','html','../client','getTemplates'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc22f,0xee));var _0xfc22=function(_0x206e37,_0x15182a){_0x206e37=_0x206e37-0x0;var _0x57b28e=_0xc22f[_0x206e37];return _0x57b28e;};'use strict';var client=require(_0xfc22('0x0'));exports[_0xfc22('0x1')]=function(_0x5e76f1){return function(_0x5bc5c3){return client[_0xfc22('0x2')](_0xfc22('0x3'),{'options':{'raw':!![],'attributes':['id',_0xfc22('0x4'),_0xfc22('0x5')]},'log':_0xfc22('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index c177842..f3b83b3 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(_0x56469a,_0x1680d4){var _0x47fc39=function(_0x146d00){while(--_0x146d00){_0x56469a['push'](_0x56469a['shift']());}};_0x47fc39(++_0x1680d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x5552fa,_0x4603c6){var _0x46d969=function(_0xa19085){while(--_0xa19085){_0x5552fa['push'](_0x5552fa['shift']());}};_0x46d969(++_0x4603c6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 8ba670f..1e05ae1 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 _0x8da9=['Request','name','registry'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x8da9,0x17d));var _0x98da=function(_0x550d2a,_0x3b1087){_0x550d2a=_0x550d2a-0x0;var _0x2009b4=_0x8da9[_0x550d2a];return _0x2009b4;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x51cd7d){return function(_0xd23f5f){return client[_0x98da('0x0')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x98da('0x1'),_0x98da('0x2')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x687f=['GetTrunk','../client','getTrunks','Request','name','registry'];(function(_0x7c9f16,_0x1a5b08){var _0x5a9326=function(_0x2144b3){while(--_0x2144b3){_0x7c9f16['push'](_0x7c9f16['shift']());}};_0x5a9326(++_0x1a5b08);}(_0x687f,0x73));var _0xf687=function(_0x35a274,_0x98b399){_0x35a274=_0x35a274-0x0;var _0x40d905=_0x687f[_0x35a274];return _0x40d905;};'use strict';var client=require(_0xf687('0x0'));exports[_0xf687('0x1')]=function(_0xd7f329){return function(_0x34ef5b){return client[_0xf687('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xf687('0x3'),_0xf687('0x4')]},'log':_0xf687('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index cf62524..57d8aef 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 _0x29b8=['lastPauseAt','voicePause','phone','mobile','interface','telephone','internal','getTelephones','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','fullname','getAgents','Request','GetUser','agent','name','email','accountcode','online','lastLoginAt','pauseType'];(function(_0x29ff67,_0x55c98a){var _0x1db5b7=function(_0x4eaffe){while(--_0x4eaffe){_0x29ff67['push'](_0x29ff67['shift']());}};_0x1db5b7(++_0x55c98a);}(_0x29b8,0xf0));var _0x829b=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0x29b8[_0x292f93];return _0x5a94b1;};'use strict';var client=require('../client');exports[_0x829b('0x0')]=function(){return function(){return client[_0x829b('0x1')](_0x829b('0x2'),{'options':{'raw':![],'where':{'role':_0x829b('0x3')},'attributes':['id',_0x829b('0x4'),_0x829b('0x5'),_0x829b('0x6'),'fullname',_0x829b('0x7'),_0x829b('0x8'),_0x829b('0x9'),_0x829b('0xa'),_0x829b('0xb'),_0x829b('0xc'),_0x829b('0xd'),_0x829b('0xe')]},'log':_0x829b('0x0')});};};exports['getTelephones']=function(){return function(){return client['Request'](_0x829b('0x2'),{'options':{'raw':!![],'where':{'role':_0x829b('0xf')},'attributes':['id',_0x829b('0x4'),_0x829b('0x6'),_0x829b('0x10')]},'log':_0x829b('0x11')});};};exports[_0x829b('0x12')]=function(_0x34f354,_0x219378,_0x9e0de4){return client[_0x829b('0x1')](_0x829b('0x13'),{'body':{'type':_0x219378,'uniqueid':_0x9e0de4},'options':{'where':{'id':_0x34f354['id']}},'log':_0x829b('0x12')});};exports[_0x829b('0x14')]=function(_0x114290){return client['Request'](_0x829b('0x15'),{'body':{},'options':{'where':{'id':_0x114290['id']}},'log':_0x829b('0x12')});};exports[_0x829b('0x16')]=function(_0x5c66a6){return client['Request'](_0x829b('0x17'),{'options':{'raw':![],'where':{'role':'agent','id':_0x5c66a6},'attributes':['id',_0x829b('0x4'),'email','accountcode',_0x829b('0x18'),_0x829b('0x7'),_0x829b('0x8'),_0x829b('0x9'),_0x829b('0xa'),'voicePause',_0x829b('0xe')]},'log':'getAgent'});}; \ No newline at end of file +var _0x9b3d=['ShowUser','email','online','interface','../client','agent','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','getAgents','getTelephones','GetUser','telephone','name','internal','Request','PauseUser','savePause','saveUnpause','UnpauseUser','getAgent'];(function(_0x4fa3d2,_0x1bb8db){var _0x1ea3fd=function(_0x4d832e){while(--_0x4d832e){_0x4fa3d2['push'](_0x4fa3d2['shift']());}};_0x1ea3fd(++_0x1bb8db);}(_0x9b3d,0x156));var _0xd9b3=function(_0x552dec,_0x27a96d){_0x552dec=_0x552dec-0x0;var _0xcd5ca6=_0x9b3d[_0x552dec];return _0xcd5ca6;};'use strict';var client=require(_0xd9b3('0x0'));exports['getAgents']=function(){return function(){return client['Request']('GetUser',{'options':{'raw':![],'where':{'role':_0xd9b3('0x1')},'attributes':['id','name','email',_0xd9b3('0x2'),_0xd9b3('0x3'),'online',_0xd9b3('0x4'),_0xd9b3('0x5'),_0xd9b3('0x6'),_0xd9b3('0x7'),_0xd9b3('0x8'),_0xd9b3('0x9'),'interface']},'log':_0xd9b3('0xa')});};};exports[_0xd9b3('0xb')]=function(){return function(){return client['Request'](_0xd9b3('0xc'),{'options':{'raw':!![],'where':{'role':_0xd9b3('0xd')},'attributes':['id',_0xd9b3('0xe'),_0xd9b3('0x2'),_0xd9b3('0xf')]},'log':'getTelephones'});};};exports['savePause']=function(_0x17374f,_0xd20eac,_0x70e3f6){return client[_0xd9b3('0x10')](_0xd9b3('0x11'),{'body':{'type':_0xd20eac,'uniqueid':_0x70e3f6},'options':{'where':{'id':_0x17374f['id']}},'log':_0xd9b3('0x12')});};exports[_0xd9b3('0x13')]=function(_0x16ba8f){return client[_0xd9b3('0x10')](_0xd9b3('0x14'),{'body':{},'options':{'where':{'id':_0x16ba8f['id']}},'log':'savePause'});};exports[_0xd9b3('0x15')]=function(_0x1057a5){return client[_0xd9b3('0x10')](_0xd9b3('0x16'),{'options':{'raw':![],'where':{'role':_0xd9b3('0x1'),'id':_0x1057a5},'attributes':['id',_0xd9b3('0xe'),_0xd9b3('0x17'),_0xd9b3('0x2'),_0xd9b3('0x3'),_0xd9b3('0x18'),_0xd9b3('0x4'),_0xd9b3('0x5'),_0xd9b3('0x6'),_0xd9b3('0x7'),_0xd9b3('0x19')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index b4124c4..dcffa58 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 _0x15db=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x47ee06,_0x52878c){var _0x3a1f8f=function(_0x325cfc){while(--_0x325cfc){_0x47ee06['push'](_0x47ee06['shift']());}};_0x3a1f8f(++_0x52878c);}(_0x15db,0x8d));var _0xb15d=function(_0x285665,_0x45c041){_0x285665=_0x285665-0x0;var _0x3c5584=_0x15db[_0x285665];return _0x3c5584;};'use strict';var client=require(_0xb15d('0x0'));exports[_0xb15d('0x1')]=function(_0x2cec83){return client[_0xb15d('0x2')](_0xb15d('0x3'),{'body':_0x2cec83,'log':_0xb15d('0x3')});};exports[_0xb15d('0x4')]=function(_0x307662,_0x3174d1,_0xdbd0a4){return client['Request']('UpdateVoiceAgentReport',{'body':_0x307662,'options':{'where':{'uniqueid':_0x3174d1,'interface':_0xdbd0a4}},'log':_0xb15d('0x5')});}; \ No newline at end of file +var _0xb5a3=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','create','Request'];(function(_0x362c1f,_0x4fccd9){var _0x32bd2a=function(_0xfe09e5){while(--_0xfe09e5){_0x362c1f['push'](_0x362c1f['shift']());}};_0x32bd2a(++_0x4fccd9);}(_0xb5a3,0x1e8));var _0x3b5a=function(_0x5a60ce,_0x48f080){_0x5a60ce=_0x5a60ce-0x0;var _0x393e5e=_0xb5a3[_0x5a60ce];return _0x393e5e;};'use strict';var client=require('../client');exports[_0x3b5a('0x0')]=function(_0x370060){return client[_0x3b5a('0x1')](_0x3b5a('0x2'),{'body':_0x370060,'log':_0x3b5a('0x2')});};exports[_0x3b5a('0x3')]=function(_0x225133,_0xeff50c,_0x58b011){return client[_0x3b5a('0x1')](_0x3b5a('0x4'),{'body':_0x225133,'options':{'where':{'uniqueid':_0xeff50c,'interface':_0x58b011}},'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 ee9987a..eeb4fff 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 _0x2d4a=['day','type','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','create','Request','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','GetVoiceCallReport','outbound','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x2d4a,0x6e));var _0xa2d4=function(_0x6c1f28,_0x1a3b55){_0x6c1f28=_0x6c1f28-0x0;var _0x4b6c83=_0x2d4a[_0x6c1f28];return _0x4b6c83;};'use strict';var moment=require(_0xa2d4('0x0'));var util=require(_0xa2d4('0x1'));var _=require(_0xa2d4('0x2'));var client=require('../client');exports[_0xa2d4('0x3')]=function(_0x5143b0){return client[_0xa2d4('0x4')](_0xa2d4('0x5'),{'body':_[_0xa2d4('0x6')](_0x5143b0,{'source':_0x5143b0['calleridnum'],'destinationcontext':_0x5143b0[_0xa2d4('0x7')],'callerid':_0x5143b0[_0xa2d4('0x8')],'amaflags':_0xa2d4('0x9')}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client[_0xa2d4('0x4')](_0xa2d4('0xa'),{'options':{'where':{'type':[_0xa2d4('0xb')],'createdAt':{'$between':[moment()[_0xa2d4('0xc')]('day')[_0xa2d4('0xd')](_0xa2d4('0xe')),moment()[_0xa2d4('0xf')](_0xa2d4('0x10'))[_0xa2d4('0xd')](_0xa2d4('0xe'))]}},'attributes':[_0xa2d4('0x11'),'disposition',_0xa2d4('0x12'),_0xa2d4('0x13')]},'log':_0xa2d4('0x14')});};}; \ No newline at end of file +var _0x2b18=['merge','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','disposition','duration','moment','util','lodash','../client','create','Request','CreateVoiceCallReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b18,0x7e));var _0x82b1=function(_0xa909fa,_0xdc79ab){_0xa909fa=_0xa909fa-0x0;var _0x5cbb61=_0x2b18[_0xa909fa];return _0x5cbb61;};'use strict';var moment=require(_0x82b1('0x0'));var util=require(_0x82b1('0x1'));var _=require(_0x82b1('0x2'));var client=require(_0x82b1('0x3'));exports[_0x82b1('0x4')]=function(_0x160c15){return client[_0x82b1('0x5')](_0x82b1('0x6'),{'body':_[_0x82b1('0x7')](_0x160c15,{'source':_0x160c15['calleridnum'],'destinationcontext':_0x160c15[_0x82b1('0x8')],'callerid':_0x160c15[_0x82b1('0x9')],'amaflags':_0x82b1('0xa')}),'log':_0x82b1('0x6')});};exports[_0x82b1('0xb')]=function(){return function(){return client[_0x82b1('0x5')](_0x82b1('0xc'),{'options':{'where':{'type':[_0x82b1('0xd')],'createdAt':{'$between':[moment()[_0x82b1('0xe')](_0x82b1('0xf'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf']('day')[_0x82b1('0x10')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0x82b1('0x11'),_0x82b1('0x12'),'billableseconds']},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 5306b2e..60955ee 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 _0x68b6=['../client','create','Request','CreateVoiceDialReport'];(function(_0x49fb23,_0x5340d4){var _0x4ef27b=function(_0xe79ef4){while(--_0xe79ef4){_0x49fb23['push'](_0x49fb23['shift']());}};_0x4ef27b(++_0x5340d4);}(_0x68b6,0x70));var _0x668b=function(_0x472f88,_0x280c8e){_0x472f88=_0x472f88-0x0;var _0xb2b64f=_0x68b6[_0x472f88];return _0xb2b64f;};'use strict';var client=require(_0x668b('0x0'));exports[_0x668b('0x1')]=function(_0x1ef98b){return client[_0x668b('0x2')](_0x668b('0x3'),{'body':_0x1ef98b,'log':_0x668b('0x3')});}; \ No newline at end of file +var _0xed48=['CreateVoiceDialReport','../client','create','Request'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xed48,0xd5));var _0x8ed4=function(_0x4e170e,_0x207e58){_0x4e170e=_0x4e170e-0x0;var _0x338291=_0xed48[_0x4e170e];return _0x338291;};'use strict';var client=require(_0x8ed4('0x0'));exports[_0x8ed4('0x1')]=function(_0x392b83){return client[_0x8ed4('0x2')](_0x8ed4('0x3'),{'body':_0x392b83,'log':_0x8ed4('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 14e4de4..fb64f2f 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 _0xe44b=['getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat'];(function(_0x3c4274,_0x858023){var _0x36a214=function(_0x5273e5){while(--_0x5273e5){_0x3c4274['push'](_0x3c4274['shift']());}};_0x36a214(++_0x858023);}(_0xe44b,0xc3));var _0xbe44=function(_0x278a0a,_0x4958b5){_0x278a0a=_0x278a0a-0x0;var _0x1fcbc9=_0xe44b[_0x278a0a];return _0x1fcbc9;};'use strict';var client=require('../client');exports[_0xbe44('0x0')]=function(){return function(){return client[_0xbe44('0x1')](_0xbe44('0x2'),{'options':{'raw':!![],'attributes':['id',_0xbe44('0x3'),_0xbe44('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xbe44('0x0')});};}; \ No newline at end of file +var _0xdd53=['../client','getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat'];(function(_0x11d488,_0xeca1c0){var _0x13a366=function(_0x145f1c){while(--_0x145f1c){_0x11d488['push'](_0x11d488['shift']());}};_0x13a366(++_0xeca1c0);}(_0xdd53,0x156));var _0x3dd5=function(_0x31acab,_0x5aefbe){_0x31acab=_0x31acab-0x0;var _0x3ab11f=_0xdd53[_0x31acab];return _0x3ab11f;};'use strict';var client=require(_0x3dd5('0x0'));exports[_0x3dd5('0x1')]=function(){return function(){return client[_0x3dd5('0x2')](_0x3dd5('0x3'),{'options':{'raw':!![],'attributes':['id',_0x3dd5('0x4'),_0x3dd5('0x5')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 9e667ba..58552bf 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 _0x0caf=['dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','mandatoryDisposition','Trunk','active','mandatoryDispositionPause','TrunkBackup','callerid','Interval','Intervals','interval','getVoiceQueues','GetVoiceQueue','name','acw','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence'];(function(_0x2b1747,_0xdcfa4b){var _0x3fdaeb=function(_0x425db5){while(--_0x425db5){_0x2b1747['push'](_0x2b1747['shift']());}};_0x3fdaeb(++_0xdcfa4b);}(_0x0caf,0x9f));var _0xf0ca=function(_0x3d44fc,_0x598eca){_0x3d44fc=_0x3d44fc-0x0;var _0x53cc55=_0x0caf[_0x3d44fc];return _0x53cc55;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client['Request'](_0xf0ca('0x0'),{'options':{'raw':![],'attributes':['id',_0xf0ca('0x1'),_0xf0ca('0x2'),'acwTimeout','autopause',_0xf0ca('0x3'),_0xf0ca('0x4'),'dialActive',_0xf0ca('0x5'),_0xf0ca('0x6'),_0xf0ca('0x7'),'dialPowerLevel',_0xf0ca('0x8'),_0xf0ca('0x9'),_0xf0ca('0xa'),_0xf0ca('0xb'),_0xf0ca('0xc'),_0xf0ca('0xd'),_0xf0ca('0xe'),'dialQueueTimeout',_0xf0ca('0xf'),_0xf0ca('0x10'),_0xf0ca('0x11'),_0xf0ca('0x12'),_0xf0ca('0x13'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency',_0xf0ca('0x14'),'dialTimezone',_0xf0ca('0x15'),'dialPrefix',_0xf0ca('0x16'),_0xf0ca('0x17'),_0xf0ca('0x18'),_0xf0ca('0x19'),_0xf0ca('0x1a'),_0xf0ca('0x1b'),'dialAMDMinWordLength',_0xf0ca('0x1c'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0xf0ca('0x1d'),_0xf0ca('0x1e'),_0xf0ca('0x1f'),_0xf0ca('0x20'),_0xf0ca('0x21'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0xf0ca('0x22'),'monitor_format','strategy',_0xf0ca('0x23'),_0xf0ca('0x24'),_0xf0ca('0x25')],'include':[{'model':_0xf0ca('0x26'),'as':_0xf0ca('0x26'),'attributes':['id',_0xf0ca('0x1'),'callerid',_0xf0ca('0x27')]},{'model':'Pause','as':_0xf0ca('0x28'),'attributes':['id',_0xf0ca('0x1')]},{'model':'Trunk','as':_0xf0ca('0x29'),'attributes':['id',_0xf0ca('0x1'),_0xf0ca('0x2a'),_0xf0ca('0x27')]},{'model':_0xf0ca('0x2b'),'as':_0xf0ca('0x2b'),'attributes':['id',_0xf0ca('0x1')],'include':[{'model':'Interval','as':_0xf0ca('0x2c'),'attributes':['id',_0xf0ca('0x1'),_0xf0ca('0x2d')]}]}]},'log':_0xf0ca('0x2e')});};}; \ No newline at end of file +var _0x8d08=['mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','callerid','Pause'];(function(_0x5d1225,_0x5ae39c){var _0x1bffc2=function(_0x43dfce){while(--_0x43dfce){_0x5d1225['push'](_0x5d1225['shift']());}};_0x1bffc2(++_0x5ae39c);}(_0x8d08,0x118));var _0x88d0=function(_0x2cbec0,_0x262fef){_0x2cbec0=_0x2cbec0-0x0;var _0x3d4101=_0x8d08[_0x2cbec0];return _0x3d4101;};'use strict';var client=require(_0x88d0('0x0'));exports[_0x88d0('0x1')]=function(){return function(){return client[_0x88d0('0x2')](_0x88d0('0x3'),{'options':{'raw':![],'attributes':['id',_0x88d0('0x4'),_0x88d0('0x5'),_0x88d0('0x6'),_0x88d0('0x7'),_0x88d0('0x8'),_0x88d0('0x9'),_0x88d0('0xa'),_0x88d0('0xb'),'dialLimitChannel',_0x88d0('0xc'),_0x88d0('0xd'),'dialPredictiveOptimization',_0x88d0('0xe'),'dialPredictiveInterval',_0x88d0('0xf'),'dialOriginateCallerIdNumber',_0x88d0('0x10'),_0x88d0('0x11'),_0x88d0('0x12'),'dialQueueProject',_0x88d0('0x13'),_0x88d0('0x14'),'dialBusyMaxRetry',_0x88d0('0x15'),'dialNoAnswerMaxRetry',_0x88d0('0x16'),_0x88d0('0x17'),_0x88d0('0x18'),'dialGlobalInterval','dialPrefix','dialCheckDuplicateType',_0x88d0('0x19'),_0x88d0('0x1a'),_0x88d0('0x1b'),'dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength',_0x88d0('0x1c'),_0x88d0('0x1d'),'dialAMDSilenceThreshold',_0x88d0('0x1e'),_0x88d0('0x1f'),_0x88d0('0x20'),_0x88d0('0x21'),'dialOrderByScheduledAt',_0x88d0('0x22'),_0x88d0('0x23'),_0x88d0('0x24'),_0x88d0('0x8'),'strategy',_0x88d0('0x25'),_0x88d0('0x26'),'mandatoryDisposition'],'include':[{'model':_0x88d0('0x27'),'as':_0x88d0('0x27'),'attributes':['id','name',_0x88d0('0x28'),'active']},{'model':_0x88d0('0x29'),'as':_0x88d0('0x2a'),'attributes':['id','name']},{'model':_0x88d0('0x27'),'as':_0x88d0('0x2b'),'attributes':['id',_0x88d0('0x4'),_0x88d0('0x28'),'active']},{'model':_0x88d0('0x2c'),'as':_0x88d0('0x2c'),'attributes':['id',_0x88d0('0x4')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x88d0('0x4'),_0x88d0('0x2d')]}]}]},'log':_0x88d0('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 5ec2061..97a6fae 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 _0xe93d=['queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','../client','create','Request','CreateVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue'];(function(_0x291a9b,_0x104ad1){var _0x2b8028=function(_0xf01e22){while(--_0xf01e22){_0x291a9b['push'](_0x291a9b['shift']());}};_0x2b8028(++_0x104ad1);}(_0xe93d,0x192));var _0xde93=function(_0x546500,_0xaac2ae){_0x546500=_0x546500-0x0;var _0x383018=_0xe93d[_0x546500];return _0x383018;};'use strict';var moment=require(_0xde93('0x0'));var _=require('lodash');var client=require(_0xde93('0x1'));exports[_0xde93('0x2')]=function(_0x382737){return client[_0xde93('0x3')](_0xde93('0x4'),{'body':_0x382737,'log':_0xde93('0x4')});};exports['getVoiceQueueReports']=function(){return function(){return client[_0xde93('0x3')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0xde93('0x5')](_0xde93('0x6'))[_0xde93('0x7')](_0xde93('0x8')),moment()[_0xde93('0x9')](_0xde93('0x6'))[_0xde93('0x7')](_0xde93('0x8'))]}},'attributes':[_0xde93('0xa'),_0xde93('0xb'),'queuecallerjoinAt','queuecallerleaveAt',_0xde93('0xc'),_0xde93('0xd'),_0xde93('0xe'),'queuecallerexitAt',_0xde93('0xf'),_0xde93('0x10')]},'log':_0xde93('0x11')});};}; \ No newline at end of file +var _0x6076=['queuecallerabandonAt','GetVoiceQueueReports','lodash','../client','create','CreateVoiceQueueReport','getVoiceQueueReports','Request','GetVoiceQueueReport','format','YYYY-MM-DD\x20HH:mm:ss','day','uniqueid','queuecallerjoinAt','queuecallerleaveAt','queuecallercompleteAt','queuecallerexit','queuecallerabandon'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6076,0xa4));var _0x6607=function(_0x5c9b79,_0x335cd3){_0x5c9b79=_0x5c9b79-0x0;var _0x5a7065=_0x6076[_0x5c9b79];return _0x5a7065;};'use strict';var moment=require('moment');var _=require(_0x6607('0x0'));var client=require(_0x6607('0x1'));exports[_0x6607('0x2')]=function(_0xaac8ba){return client['Request'](_0x6607('0x3'),{'body':_0xaac8ba,'log':'CreateVoiceQueueReport'});};exports[_0x6607('0x4')]=function(){return function(){return client[_0x6607('0x5')](_0x6607('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf']('day')[_0x6607('0x7')](_0x6607('0x8')),moment()['endOf'](_0x6607('0x9'))[_0x6607('0x7')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x6607('0xa'),'queue',_0x6607('0xb'),_0x6607('0xc'),'queuecallercomplete',_0x6607('0xd'),_0x6607('0xe'),'queuecallerexitAt',_0x6607('0xf'),_0x6607('0x10')]},'log':_0x6607('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 028be36..aba8023 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 _0xe463=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client'];(function(_0x35bd4c,_0x19535a){var _0xba8104=function(_0x54c26f){while(--_0x54c26f){_0x35bd4c['push'](_0x35bd4c['shift']());}};_0xba8104(++_0x19535a);}(_0xe463,0x1cd));var _0x3e46=function(_0x39563c,_0x41d32e){_0x39563c=_0x39563c-0x0;var _0x15ef90=_0xe463[_0x39563c];return _0x15ef90;};'use strict';var client=require(_0x3e46('0x0'));exports['getVoiceQueueRtPauses']=function(_0x151787){return function(){return client['Request'](_0x3e46('0x1'),{'options':{'where':{'VoiceQueueId':_0x151787,'paused':!![]},'raw':!![]},'log':_0x3e46('0x2')});};}; \ No newline at end of file +var _0x672c=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0x672c,0xe9));var _0xc672=function(_0x113eea,_0xa899a4){_0x113eea=_0x113eea-0x0;var _0x387d57=_0x672c[_0x113eea];return _0x387d57;};'use strict';var client=require('../client');exports[_0xc672('0x0')]=function(_0x44540d){return function(){return client[_0xc672('0x1')](_0xc672('0x2'),{'options':{'where':{'VoiceQueueId':_0x44540d,'paused':!![]},'raw':!![]},'log':_0xc672('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 74d0e02..d8fadf5 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 _0x3ba8=['create','Request','CreateVoiceRecording','merge','../client'];(function(_0x4ec42,_0x36177b){var _0x385e11=function(_0x44e535){while(--_0x44e535){_0x4ec42['push'](_0x4ec42['shift']());}};_0x385e11(++_0x36177b);}(_0x3ba8,0xc7));var _0x83ba=function(_0x49b715,_0x5e9d08){_0x49b715=_0x49b715-0x0;var _0x48e1ff=_0x3ba8[_0x49b715];return _0x48e1ff;};'use strict';var _=require('lodash');var client=require(_0x83ba('0x0'));exports[_0x83ba('0x1')]=function(_0x5cc1ee){return client[_0x83ba('0x2')](_0x83ba('0x3'),{'body':_[_0x83ba('0x4')](_0x5cc1ee,{'value':_0x5cc1ee['monitorFilename']}),'log':_0x83ba('0x3')});}; \ No newline at end of file +var _0x171e=['lodash','../client','create','Request','CreateVoiceRecording'];(function(_0x571f7c,_0x450489){var _0x374a19=function(_0x5ddfdf){while(--_0x5ddfdf){_0x571f7c['push'](_0x571f7c['shift']());}};_0x374a19(++_0x450489);}(_0x171e,0xa0));var _0xe171=function(_0x3be7a9,_0x3fbebb){_0x3be7a9=_0x3be7a9-0x0;var _0x42feec=_0x171e[_0x3be7a9];return _0x42feec;};'use strict';var _=require(_0xe171('0x0'));var client=require(_0xe171('0x1'));exports[_0xe171('0x2')]=function(_0x29684c){return client[_0xe171('0x3')](_0xe171('0x4'),{'body':_['merge'](_0x29684c,{'value':_0x29684c['monitorFilename']}),'log':_0xe171('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index d8cc168..253391b 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 _0x2344=['transfertargetconnectedlinenum','transfertargetcontext','transfertargetlinkedid','isexternal','origtransfererexten','attended','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2344,0xd8));var _0x4234=function(_0x4053c9,_0x39e34a){_0x4053c9=_0x4053c9-0x0;var _0x50149d=_0x2344[_0x4053c9];return _0x50149d;};'use strict';var client=require(_0x4234('0x0'));exports[_0x4234('0x1')]=function(_0x2991c3){return client[_0x4234('0x2')](_0x4234('0x3'),{'body':{'result':_0x2991c3[_0x4234('0x4')],'transfererchannel':_0x2991c3[_0x4234('0x5')],'transferercalleridnum':_0x2991c3[_0x4234('0x6')],'transferercalleridname':_0x2991c3['transferercalleridname'],'transfererconnectedlinenum':_0x2991c3['transfererconnectedlinenum'],'transfererconnectedlinename':_0x2991c3['transfererconnectedlinename'],'transfereraccountcode':_0x2991c3[_0x4234('0x7')],'transferercontext':_0x2991c3[_0x4234('0x8')],'transfererexten':_0x2991c3[_0x4234('0x9')],'transfererlinkedid':_0x2991c3[_0x4234('0xa')],'transfereechannel':_0x2991c3[_0x4234('0xb')],'transfereecalleridnum':_0x2991c3[_0x4234('0xc')],'transfereecalleridname':_0x2991c3[_0x4234('0xd')],'transfereeconnectedlinenum':_0x2991c3[_0x4234('0xe')],'transfereeconnectedlinename':_0x2991c3[_0x4234('0xf')],'transfereeaccountcode':_0x2991c3[_0x4234('0x10')],'transfereecontext':_0x2991c3[_0x4234('0x11')],'transfereeexten':_0x2991c3[_0x4234('0x12')],'transfereelinkedid':_0x2991c3[_0x4234('0x13')],'isexternal':_0x2991c3['isexternal'],'context':_0x2991c3[_0x4234('0x14')],'extension':_0x2991c3[_0x4234('0x15')],'type':_0x4234('0x16')},'log':'CreateVoiceTransferReport'});};exports[_0x4234('0x17')]=function(_0x1e2383){return client[_0x4234('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x1e2383['result'],'transfererchannel':_0x1e2383[_0x4234('0x18')],'transferercalleridnum':_0x1e2383[_0x4234('0x19')],'transferercalleridname':_0x1e2383[_0x4234('0x1a')],'transfererconnectedlinenum':_0x1e2383[_0x4234('0x1b')],'transfererconnectedlinename':_0x1e2383[_0x4234('0x1c')],'transfereraccountcode':_0x1e2383[_0x4234('0x1d')],'transferercontext':_0x1e2383[_0x4234('0x1e')],'transfererexten':_0x1e2383[_0x4234('0x1f')],'transfererlinkedid':_0x1e2383[_0x4234('0x20')],'transfereechannel':_0x1e2383[_0x4234('0x21')],'transfereecalleridnum':_0x1e2383[_0x4234('0x22')],'transfereecalleridname':_0x1e2383[_0x4234('0x23')],'transfereeconnectedlinenum':_0x1e2383[_0x4234('0x24')],'transfereeconnectedlinename':_0x1e2383['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1e2383['transfertargetaccountcode'],'transfereecontext':_0x1e2383[_0x4234('0x25')],'transfereeexten':_0x1e2383['transfertargetexten'],'transfereelinkedid':_0x1e2383[_0x4234('0x26')],'isexternal':_0x1e2383[_0x4234('0x27')],'context':_0x1e2383['origtransferercontext'],'extension':_0x1e2383[_0x4234('0x28')],'type':_0x4234('0x29')},'log':_0x4234('0x3')});}; \ No newline at end of file +var _0x0e81=['transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','CreateVoiceTransferReport','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','origtransferercontext','attended','../client','blindTransfer','Request','transfererchannel','transferercalleridnum'];(function(_0x5cd531,_0x3912fc){var _0x2ead28=function(_0x5b2880){while(--_0x5b2880){_0x5cd531['push'](_0x5cd531['shift']());}};_0x2ead28(++_0x3912fc);}(_0x0e81,0xd3));var _0x10e8=function(_0x1cfc39,_0x1d3913){_0x1cfc39=_0x1cfc39-0x0;var _0x957a28=_0x0e81[_0x1cfc39];return _0x957a28;};'use strict';var client=require(_0x10e8('0x0'));exports[_0x10e8('0x1')]=function(_0x3750bb){return client[_0x10e8('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x3750bb['result'],'transfererchannel':_0x3750bb[_0x10e8('0x3')],'transferercalleridnum':_0x3750bb[_0x10e8('0x4')],'transferercalleridname':_0x3750bb['transferercalleridname'],'transfererconnectedlinenum':_0x3750bb[_0x10e8('0x5')],'transfererconnectedlinename':_0x3750bb[_0x10e8('0x6')],'transfereraccountcode':_0x3750bb[_0x10e8('0x7')],'transferercontext':_0x3750bb[_0x10e8('0x8')],'transfererexten':_0x3750bb['transfererexten'],'transfererlinkedid':_0x3750bb[_0x10e8('0x9')],'transfereechannel':_0x3750bb[_0x10e8('0xa')],'transfereecalleridnum':_0x3750bb[_0x10e8('0xb')],'transfereecalleridname':_0x3750bb[_0x10e8('0xc')],'transfereeconnectedlinenum':_0x3750bb['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x3750bb['transfereeconnectedlinename'],'transfereeaccountcode':_0x3750bb['transfereeaccountcode'],'transfereecontext':_0x3750bb[_0x10e8('0xd')],'transfereeexten':_0x3750bb[_0x10e8('0xe')],'transfereelinkedid':_0x3750bb[_0x10e8('0xf')],'isexternal':_0x3750bb[_0x10e8('0x10')],'context':_0x3750bb[_0x10e8('0x11')],'extension':_0x3750bb[_0x10e8('0x12')],'type':_0x10e8('0x13')},'log':_0x10e8('0x14')});};exports['attendedTransfer']=function(_0x36537c){return client['Request'](_0x10e8('0x14'),{'body':{'result':_0x36537c[_0x10e8('0x15')],'transfererchannel':_0x36537c[_0x10e8('0x16')],'transferercalleridnum':_0x36537c[_0x10e8('0x17')],'transferercalleridname':_0x36537c[_0x10e8('0x18')],'transfererconnectedlinenum':_0x36537c[_0x10e8('0x19')],'transfererconnectedlinename':_0x36537c['secondtransfererconnectedlinename'],'transfereraccountcode':_0x36537c[_0x10e8('0x1a')],'transferercontext':_0x36537c[_0x10e8('0x1b')],'transfererexten':_0x36537c[_0x10e8('0x1c')],'transfererlinkedid':_0x36537c['origtransfererlinkedid'],'transfereechannel':_0x36537c[_0x10e8('0x1d')],'transfereecalleridnum':_0x36537c[_0x10e8('0x1e')],'transfereecalleridname':_0x36537c['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x36537c['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x36537c[_0x10e8('0x1f')],'transfereeaccountcode':_0x36537c['transfertargetaccountcode'],'transfereecontext':_0x36537c[_0x10e8('0x20')],'transfereeexten':_0x36537c[_0x10e8('0x21')],'transfereelinkedid':_0x36537c['transfertargetlinkedid'],'isexternal':_0x36537c[_0x10e8('0x10')],'context':_0x36537c[_0x10e8('0x22')],'extension':_0x36537c['origtransfererexten'],'type':_0x10e8('0x23')},'log':_0x10e8('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 619a31d..65c0875 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 _0x949d=['StopMixMonitor','destinationchannel','stop','monitors','queueChannels','voicequeuechannel','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','outbound','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','send','server','http','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','../../../config/environment','../ami','format','%s/%s','SIP','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','message','catch','error','isConnected','command','Command','content','voiceQueues','hasOwnProperty','name','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','type','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','originated','Trunk','active','callerid','Interval','length','values','channels','voicechannel','validate','map','find','channel','%s.%s','filename','uniqueid','wav','MixMonitor','ai(mixmonitorid)','then','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','rec','mixmonitorid','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve'];(function(_0x219204,_0xe7c011){var _0x1125a3=function(_0x4c7215){while(--_0x4c7215){_0x219204['push'](_0x219204['shift']());}};_0x1125a3(++_0xe7c011);}(_0x949d,0x9e));var _0xd949=function(_0x26def5,_0x5622d5){_0x26def5=_0x26def5-0x0;var _0x3b9a59=_0x949d[_0x26def5];return _0x3b9a59;};'use strict';var _=require('lodash');var util=require('util');var jayson=require(_0xd949('0x0'));var schema=require('validate');var BPromise=require(_0xd949('0x1'));var moment=require('moment');var config=require(_0xd949('0x2'));var properties=require('../properties');var ami=require(_0xd949('0x3'));exports['listen']=function(_0x26c027,_0x2d0781,_0x4a18d6){return new BPromise(function(_0x58b05e,_0x46085b){var _0x1e487c={'QueuePause':function(_0x2aa3e0){return new Promise(function(_0x246db7,_0x48b42d){var _0x5a52fc=util[_0xd949('0x4')](_0xd949('0x5'),_0xd949('0x6'),_0x2aa3e0['name']);if(_0x26c027['timers']&&_0x26c027[_0xd949('0x7')][_0x5a52fc]&&_0x26c027['timers'][_0x5a52fc][_0xd949('0x8')]){_0x26c027[_0xd949('0x7')][_0x5a52fc][_0xd949('0x9')]();}if(_0x26c027[_0xd949('0xa')][_0x5a52fc]){_0x26c027[_0xd949('0xa')][_0x5a52fc][_0xd949('0xb')]({'statePause':_0x2aa3e0['pause']?!![]:![]});}_0x246db7({'code':0xc8,'message':_0xd949('0xc')});});},'Reload':function(_0x2133bf){var _0x591748=this;return new Promise(function(_0x555ee3,_0x22c68b){if(ami['isConnected']()==![]){return _0x22c68b(_0x591748['error'](0x1f4,[config[_0xd949('0xd')]['ip'],config['asterisk'][_0xd949('0xe')],_0xd949('0xf')][_0xd949('0x10')]('\x20')));}_0x2133bf=_[_0xd949('0x11')](_0x2133bf,_[_0xd949('0x12')](properties[_0xd949('0x13')]));_0x2133bf[_0xd949('0x14')]=_0xd949('0x15');return ami[_0xd949('0x16')](_0x2133bf)['then'](function(_0x9906b7){_0x555ee3({'code':0xc8,'message':_0x9906b7[_0xd949('0x17')]});})[_0xd949('0x18')](function(_0x13243c){_0x22c68b(_0x591748[_0xd949('0x19')](0x1f5,_0x13243c[_0xd949('0x17')]));});});},'Command':function(_0x17f3c2){var _0x2b400d=this;return new Promise(function(_0x35ba1f,_0x63a49e){if(ami[_0xd949('0x1a')]()==![]){return _0x63a49e(_0x2b400d[_0xd949('0x19')](0x1f4,[config[_0xd949('0xd')]['ip'],config[_0xd949('0xd')][_0xd949('0xe')],'ami\x20disconnected'][_0xd949('0x10')]('\x20')));}_0x17f3c2=_[_0xd949('0x11')](_0x17f3c2,_0xd949('0x1b'));_0x17f3c2['action']=_0xd949('0x1c');return ami['Action'](_0x17f3c2)['then'](function(_0x4b7f6b){_0x35ba1f({'code':0xc8,'message':_0x4b7f6b[_0xd949('0x1d')]});})['catch'](function(_0x1a6699){_0x63a49e(_0x2b400d[_0xd949('0x19')](0x1f5,_0x1a6699[_0xd949('0x17')]));});});},'VoiceQueues':function(_0xf243cf){return new Promise(function(_0x5e0667,_0x14642e){var _0x215954=[];for(var _0x1e6333 in _0x26c027[_0xd949('0x1e')]){if(_0x26c027['voiceQueues'][_0xd949('0x1f')](_0x1e6333)){var _0x15268a=_0x26c027[_0xd949('0x1e')][_0x1e6333];var _0x6d01b1={'id':_0x15268a['id'],'name':_0x15268a[_0xd949('0x20')],'strategy':_0x15268a['strategy'],'answered':_0x15268a[_0xd949('0x21')],'available':_0x15268a[_0xd949('0x22')],'loggedIn':_0x15268a[_0xd949('0x23')],'pTalking':_0x15268a[_0xd949('0x24')],'sumBillable':_0x15268a[_0xd949('0x25')],'sumDuration':_0x15268a[_0xd949('0x26')],'sumHoldTime':_0x15268a[_0xd949('0x27')]||0x0,'talking':_0x15268a[_0xd949('0x28')],'total':_0x15268a[_0xd949('0x29')],'type':_0x15268a['type'],'unmanaged':_0x15268a[_0xd949('0x2a')],'abandoned':_0x15268a['abandoned'],'waiting':_0x15268a[_0xd949('0x2b')],'loggedInDb':_0x15268a['loggedInDb']};if(_0x15268a[_0xd949('0x2c')]==='outbound'){_0x6d01b1[_0xd949('0x2d')]=_0x15268a[_0xd949('0x2d')];_0x6d01b1[_0xd949('0x2e')]=_0x15268a['dialMethod'];_0x6d01b1[_0xd949('0x2f')]=_0x15268a[_0xd949('0x2f')];_0x6d01b1['dialOriginateCallerIdNumber']=_0x15268a[_0xd949('0x30')];_0x6d01b1[_0xd949('0x31')]=_0x15268a[_0xd949('0x31')];_0x6d01b1[_0xd949('0x32')]=_0x15268a[_0xd949('0x32')];_0x6d01b1['outboundAnswerAgiCallsDay']=_0x15268a[_0xd949('0x33')];_0x6d01b1[_0xd949('0x34')]=_0x15268a['outboundAnswerCallsDay'];_0x6d01b1[_0xd949('0x35')]=_0x15268a[_0xd949('0x35')];_0x6d01b1['outboundBusyCallsDay']=_0x15268a['outboundBusyCallsDay'];_0x6d01b1['outboundCongestionCallsDay']=_0x15268a[_0xd949('0x36')];_0x6d01b1['outboundDropCallsDayACS']=_0x15268a['outboundDropCallsDayACS'];_0x6d01b1[_0xd949('0x37')]=_0x15268a[_0xd949('0x37')];_0x6d01b1[_0xd949('0x38')]=_0x15268a[_0xd949('0x38')];_0x6d01b1['outboundNoAnswerCallsDay']=_0x15268a['outboundNoAnswerCallsDay'];_0x6d01b1[_0xd949('0x39')]=_0x15268a[_0xd949('0x39')];_0x6d01b1[_0xd949('0x3a')]=_0x15268a[_0xd949('0x3a')];_0x6d01b1['outboundReCallsDay']=_0x15268a['outboundReCallsDay'];_0x6d01b1['outboundRejectCallsDay']=_0x15268a['outboundRejectCallsDay'];_0x6d01b1[_0xd949('0x3b')]=_0x15268a[_0xd949('0x3b')];_0x6d01b1[_0xd949('0x3c')]=_0x15268a[_0xd949('0x3c')];_0x6d01b1[_0xd949('0x3d')]=_0x15268a[_0xd949('0x3d')];_0x6d01b1[_0xd949('0x3e')]=_0x15268a[_0xd949('0x3e')];_0x6d01b1['predictiveIntervalDroppedCallsCallersExit']=_0x15268a[_0xd949('0x3f')];_0x6d01b1[_0xd949('0x40')]=_0x15268a[_0xd949('0x40')];_0x6d01b1[_0xd949('0x41')]=_0x15268a[_0xd949('0x41')];_0x6d01b1[_0xd949('0x42')]=_0x15268a['predictiveIntervalErlangCallsDroppedCalls'];_0x6d01b1['predictiveIntervalHitRate']=_0x15268a[_0xd949('0x43')];_0x6d01b1[_0xd949('0x44')]=_0x15268a[_0xd949('0x44')];_0x6d01b1[_0xd949('0x45')]=_0x15268a['predictiveIntervalMultiplicativeFactor'];_0x6d01b1[_0xd949('0x46')]=_0x15268a[_0xd949('0x46')];_0x6d01b1['predictiveIntervalTotalCalls']=_0x15268a['predictiveIntervalTotalCalls'];_0x6d01b1[_0xd949('0x17')]=_0x15268a['message'];_0x6d01b1['originated']=_0x15268a[_0xd949('0x47')];}if(_0x15268a[_0xd949('0x48')]){_0x6d01b1[_0xd949('0x48')]={'id':_0x15268a[_0xd949('0x48')]['id'],'name':_0x15268a[_0xd949('0x48')][_0xd949('0x20')],'active':_0x15268a['Trunk'][_0xd949('0x49')],'callerid':_0x15268a['Trunk'][_0xd949('0x4a')]};}if(_0x15268a[_0xd949('0x4b')]){_0x6d01b1[_0xd949('0x4b')]={'id':_0x15268a[_0xd949('0x4b')]['id'],'name':_0x15268a[_0xd949('0x4b')]['name']};}_0x215954['push'](_0x6d01b1);}}_0x5e0667({'count':_0x215954[_0xd949('0x4c')],'rows':_0x215954});});},'VoiceChannels':function(_0x4a36f3){return new Promise(function(_0x5255f6,_0x12d3fe){var _0x1c7ebd=_[_0xd949('0x4d')](_0x26c027[_0xd949('0x4e')]);_0x5255f6({'count':_0x1c7ebd[_0xd949('0x4c')],'rows':_0x1c7ebd});});},'VoiceChannelMixMonitor':function(_0x4a52b1){var _0x28c826=this;return new Promise(function(_0x3756d0,_0x50366c){if(ami[_0xd949('0x1a')]()==![]){return _0x50366c(_0x28c826[_0xd949('0x19')](0x1f4,[config[_0xd949('0xd')]['ip'],config[_0xd949('0xd')]['username'],_0xd949('0xf')][_0xd949('0x10')]('\x20')));}var _0x23c41e=schema(properties[_0xd949('0x4f')])[_0xd949('0x50')](_0x4a52b1);if(_0x23c41e['length']>0x0){return _0x50366c(_0x28c826[_0xd949('0x19')](0x1f4,_[_0xd949('0x51')](_0x23c41e,_0xd949('0x17'))[_0xd949('0x10')](',\x20')));}var _0x1d6317=_[_0xd949('0x52')](_0x26c027[_0xd949('0x4e')],{'uniqueid':_0x4a52b1['uniqueid']});if(_0x1d6317&&_0x1d6317[_0xd949('0x53')]){var _0x208dcb=util['format'](_0xd949('0x54'),_0x4a52b1[_0xd949('0x55')]||_0x4a52b1[_0xd949('0x56')],_0x4a52b1[_0xd949('0x4')]||_0xd949('0x57'));return ami[_0xd949('0x16')]({'action':_0xd949('0x58'),'channel':_0x1d6317[_0xd949('0x53')],'file':_0x208dcb,'options':_0xd949('0x59')})[_0xd949('0x5a')](function(_0x58fc01){var _0x2fd27c=_[_0xd949('0x52')](_0x1d6317['monitors'],{'filename':_0xd949('0x5b')+_0x208dcb[_0xd949('0x5c')]()});if(_[_0xd949('0x5d')](_0x2fd27c)){_0x1d6317['monitors'][_0xd949('0x5e')]({'filename':_0xd949('0x5b')+_0x208dcb[_0xd949('0x5c')](),'createdAt':moment()[_0xd949('0x4')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x58fc01['mixmonitorid'],'status':_0xd949('0x5f')});}else{_0x2fd27c['mixmonitorid']=_0x58fc01[_0xd949('0x60')];_0x2fd27c['status']=_0xd949('0x5f');}_0x3756d0({'code':0xc8,'message':[_0x4a52b1[_0xd949('0x56')],_0xd949('0x61'),_0x58fc01[_0xd949('0x60')]][_0xd949('0x10')]('\x20'),'mixmonitorid':_0x58fc01[_0xd949('0x60')]});})[_0xd949('0x18')](function(_0x25a4b0){_0x50366c(_0x28c826[_0xd949('0x19')](0x1f5,[_0x4a52b1[_0xd949('0x56')],_0x25a4b0['message'][_0xd949('0x5c')]()][_0xd949('0x10')]('\x20')));});}else{return _0x50366c(_0x28c826[_0xd949('0x19')](0x1f5,_0xd949('0x62')));}});},'VoiceChannelStopMixMonitor':function(_0x71fe70){var _0x2f7478=this;return new Promise(function(_0x285761,_0x559ed6){if(ami[_0xd949('0x1a')]()==![]){return _0x559ed6(_0x2f7478[_0xd949('0x19')](0x1f4,[config[_0xd949('0xd')]['ip'],config['asterisk']['username'],'ami\x20disconnected']['join']('\x20')));}var _0x14e8f2=schema(properties[_0xd949('0x4f')])[_0xd949('0x50')](_0x71fe70);if(_0x14e8f2[_0xd949('0x4c')]>0x0){return _0x559ed6(_0x2f7478[_0xd949('0x19')](0x1f4,_['map'](_0x14e8f2,_0xd949('0x17'))[_0xd949('0x10')](',\x20')));}var _0x15d0a2=_[_0xd949('0x52')](_0x26c027[_0xd949('0x4e')],{'uniqueid':_0x71fe70['uniqueid']});if(_0x15d0a2){return BPromise[_0xd949('0x63')]()['then'](function(){if(_0x15d0a2[_0xd949('0x53')]){return ami['Action']({'action':_0xd949('0x64'),'channel':_0x15d0a2[_0xd949('0x53')],'mixmonitorid':_0x71fe70[_0xd949('0x60')]})['catch'](function(_0x129ac3){});}})[_0xd949('0x5a')](function(){if(_0x15d0a2[_0xd949('0x65')]){return ami[_0xd949('0x16')]({'action':'StopMixMonitor','channel':_0x15d0a2[_0xd949('0x65')],'mixmonitorid':_0x71fe70[_0xd949('0x60')]})[_0xd949('0x18')](function(_0x1deae2){});}})[_0xd949('0x5a')](function(_0x1e29f8){var _0xbde8=_[_0xd949('0x52')](_0x15d0a2['monitors'],{'mixmonitorid':_0x71fe70['mixmonitorid']});if(_0xbde8){_0xbde8['status']=_0xd949('0x66');}})['then'](function(){var _0x5818b6=util[_0xd949('0x4')](_0xd949('0x54'),_0x71fe70[_0xd949('0x55')]||_0x71fe70[_0xd949('0x56')],_0x71fe70['format']||_0xd949('0x57'));var _0x12dc5d=_['find'](_0x15d0a2[_0xd949('0x67')],{'filename':'/var/spool/asterisk/monitor/'+_0x5818b6[_0xd949('0x5c')]()});if(_0x12dc5d){_0x12dc5d['status']=_0xd949('0x66');}})['then'](function(){_0x285761({'code':0xc8,'message':[_0x71fe70[_0xd949('0x56')],'StopMixMonitor\x20Success'][_0xd949('0x10')]('\x20')});})[_0xd949('0x18')](function(_0x560a65){_0x559ed6(_0x2f7478['error'](0x1f5,[_0x71fe70[_0xd949('0x56')],_0x560a65[_0xd949('0x17')][_0xd949('0x5c')]()][_0xd949('0x10')]('\x20')));});}else{return _0x559ed6(_0x2f7478[_0xd949('0x19')](0x1f5,_0xd949('0x62')));}});},'VoiceQueuesChannels':function(_0x1b2b43){return new Promise(function(_0x9aeffd,_0x28ebc6){var _0x57788d=_[_0xd949('0x4d')](_0x26c027[_0xd949('0x68')]);_0x9aeffd({'count':_0x57788d[_0xd949('0x4c')],'rows':_0x57788d});});},'VoiceQueuesChannel':function(_0xa8ce5b){var _0x352d3b=this;return new Promise(function(_0x38b1fe,_0x22bcf1){var _0x49a12d=schema(properties[_0xd949('0x69')])['validate'](_0xa8ce5b);if(_0x49a12d['length']>0x0){return _0x22bcf1(_0x352d3b['error'](0x1f4,_[_0xd949('0x51')](_0x49a12d,'message')[_0xd949('0x10')](',\x20')));}var _0x3f0e98=_[_0xd949('0x52')](_0x26c027[_0xd949('0x68')],{'uniqueid':_0xa8ce5b[_0xd949('0x56')]});if(_0x3f0e98){_0x38b1fe(_0x3f0e98);}else{return _0x22bcf1(_0x352d3b[_0xd949('0x19')](0x1f5,_0xd949('0x62')));}});},'VoiceQueuesChannelHangup':function(_0x862822){var _0xdb6509=this;return new Promise(function(_0x21c551,_0x35f120){if(ami['isConnected']()==![]){return _0x35f120(_0xdb6509[_0xd949('0x19')](0x1f4,[config[_0xd949('0xd')]['ip'],config[_0xd949('0xd')]['username'],_0xd949('0xf')][_0xd949('0x10')]('\x20')));}var _0x5b8aa0=schema(properties['voicequeuechannelhangup'])[_0xd949('0x50')](_0x862822);if(_0x5b8aa0[_0xd949('0x4c')]>0x0){return _0x35f120(_0xdb6509[_0xd949('0x19')](0x1f4,_['map'](_0x5b8aa0,_0xd949('0x17'))[_0xd949('0x10')](',\x20')));}var _0x427fdb=_[_0xd949('0x52')](_0x26c027[_0xd949('0x68')],{'uniqueid':_0x862822[_0xd949('0x56')]});if(_0x427fdb&&_0x427fdb['channel']){return ami[_0xd949('0x16')]({'action':_0xd949('0x6a'),'channel':_0x427fdb[_0xd949('0x53')]})[_0xd949('0x5a')](function(_0x329b3a){_0x21c551({'code':0xc8,'message':[_0x862822[_0xd949('0x56')],_0x329b3a[_0xd949('0x17')][_0xd949('0x5c')]()][_0xd949('0x10')]('\x20')});})[_0xd949('0x18')](function(_0x40c4fe){_0x35f120(_0xdb6509[_0xd949('0x19')](0x1f5,[_0x862822[_0xd949('0x56')],_0x40c4fe[_0xd949('0x17')][_0xd949('0x5c')]()][_0xd949('0x10')]('\x20')));});}else{return _0x35f120(_0xdb6509[_0xd949('0x19')](0x1f5,_0xd949('0x62')));}});},'VoiceQueuesChannelRedirect':function(_0x20ebd5){var _0x58a7f9=this;return new Promise(function(_0x1b6326,_0x36a968){if(ami[_0xd949('0x1a')]()==![]){return _0x36a968(_0x58a7f9['error'](0x1f4,[config[_0xd949('0xd')]['ip'],config[_0xd949('0xd')][_0xd949('0xe')],_0xd949('0xf')][_0xd949('0x10')]('\x20')));}var _0x53c818=schema(properties[_0xd949('0x6b')])[_0xd949('0x50')](_0x20ebd5);if(_0x53c818[_0xd949('0x4c')]>0x0){return _0x36a968(_0x58a7f9[_0xd949('0x19')](0x1f4,_[_0xd949('0x51')](_0x53c818,_0xd949('0x17'))['join'](',\x20')));}var _0x2a402c=_[_0xd949('0x52')](_0x26c027[_0xd949('0x68')],{'uniqueid':_0x20ebd5[_0xd949('0x56')]});if(_0x2a402c&&_0x2a402c['channel']){return ami['Action']({'action':_0xd949('0x6c'),'channel':_0x2a402c[_0xd949('0x53')],'exten':_0x20ebd5[_0xd949('0x6d')],'context':_0x20ebd5[_0xd949('0x6e')]||_0x2a402c[_0xd949('0x6e')],'priority':0x1})[_0xd949('0x5a')](function(_0x3f0d49){_0x1b6326({'code':0xc8,'message':[_0x20ebd5[_0xd949('0x56')],_0x3f0d49['message'][_0xd949('0x5c')]()][_0xd949('0x10')]('\x20')});})['catch'](function(_0x5088dd){_0x36a968(_0x58a7f9[_0xd949('0x19')](0x1f5,[_0x20ebd5[_0xd949('0x56')],_0x5088dd[_0xd949('0x17')][_0xd949('0x5c')]()][_0xd949('0x10')]('\x20')));});}else{return _0x36a968(_0x58a7f9['error'](0x1f5,_0xd949('0x62')));}});},'Agents':function(_0x33ab69){return new Promise(function(_0x1a33dc,_0x51c97d){var _0x5f15d0=_[_0xd949('0x4d')](_0x26c027[_0xd949('0xa')]);_0x1a33dc({'count':_0x5f15d0[_0xd949('0x4c')],'rows':_0x5f15d0});});},'Telephones':function(_0x1db320){return new Promise(function(_0x3f8400,_0x4cd52c){var _0x3e5be5=_[_0xd949('0x4d')](_0x26c027[_0xd949('0x6f')]);_0x3f8400({'count':_0x3e5be5[_0xd949('0x4c')],'rows':_0x3e5be5});});},'Trunks':function(_0x1ba103){return new Promise(function(_0x781b0d,_0x56fd67){var _0x110d33=_['values'](_0x26c027[_0xd949('0x70')]);_0x781b0d({'count':_0x110d33[_0xd949('0x4c')],'rows':_0x110d33});});},'OutboundChannels':function(_0x2c69a2){return new Promise(function(_0x1424a7,_0x19d805){var _0x1ad622=_['values'](_0x26c027[_0xd949('0x71')]);_0x1424a7({'count':_0x1ad622['length'],'rows':_0x1ad622});});},'Outbound':function(_0x2fe17b){return new Promise(function(_0x4b8885,_0x500e5a){_0x4b8885(_0x26c027[_0xd949('0x72')]);});},'Campaigns':function(_0x5a2d45){return new Promise(function(_0x109457,_0x12fadc){var _0x2189f9=_[_0xd949('0x4d')](_0x26c027[_0xd949('0x73')]);_0x109457({'count':_0x2189f9[_0xd949('0x4c')],'rows':_0x2189f9});});},'VoiceQueuesPreview':function(_0x411af5){var _0x4f5c96=this;return new Promise(function(_0x47010a,_0x1a9625){_0x2d0781[_0xd949('0x74')](_0x411af5['id'])[_0xd949('0x5a')](function(_0x931c3b){_0x47010a({'code':0xc8,'message':_0x931c3b[_0xd949('0x17')]});})[_0xd949('0x18')](function(_0x323c1b){_0x1a9625(_0x4f5c96['error'](0x1f4,_0x323c1b['message']));});});},'EventManager':function(_0x30a4d1){var _0x2f44c8=this;return new Promise(function(_0x561bde,_0x24633a){if(!_0x30a4d1[_0xd949('0x75')]){return _0x24633a(_0x2f44c8[_0xd949('0x19')](0x1f4,_0xd949('0x76')));}ami[_0xd949('0x77')](_0xd949('0x78')+_0x30a4d1['event'],_0x30a4d1[_0xd949('0x17')]);_0x561bde({'code':0xc8,'message':_0x30a4d1});});},'FaxAccounts':function(_0x559af8){return new Promise(function(_0x187001,_0x336542){var _0x160169=_[_0xd949('0x4d')](_0x26c027['faxAccounts']);_0x187001({'count':_0x160169[_0xd949('0x4c')],'rows':_0x160169});});},'SendFax':function(_0x2ebce4){var _0x390b42=this;return new Promise(function(_0x3a6839,_0x4cff93){_0x4a18d6[_0xd949('0x79')](_0x2ebce4)[_0xd949('0x5a')](function(_0x1facd0){_0x3a6839({'code':0xc8,'message':_0x1facd0['message']});})[_0xd949('0x18')](function(_0x15c91e){_0x4cff93(_0x390b42[_0xd949('0x19')](0x1f4,_0x15c91e[_0xd949('0x17')]));});});},'CheckAfterSend':function(_0x54d5d8){var _0x43b34f=this;return new Promise(function(_0x4f263d,_0x21350e){_0x4a18d6['checkAfterSend'](_0x54d5d8)[_0xd949('0x5a')](function(_0x28e425){_0x4f263d({'code':0xc8,'message':_0x28e425['message']});})[_0xd949('0x18')](function(_0x30c992){_0x21350e(_0x43b34f[_0xd949('0x19')](0x1f4,_0x30c992['message']));});});}};var _0x418694=jayson[_0xd949('0x7a')](_0x1e487c)[_0xd949('0x7b')]();_0x418694['on'](_0xd949('0x19'),function(_0x4d1959){return _0x46085b(_0x4d1959);});_0x418694[_0xd949('0x7c')](0x232a,_0xd949('0x7d'),function(){console[_0xd949('0x7e')](_0xd949('0x7f'),0x232a);return _0x58b05e(_0xd949('0x80')+0x232a);});});}; \ No newline at end of file +var _0x40b2=['../properties','../ami','listen','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','isConnected','asterisk','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','message','error','username','command','Command','then','content','catch','voiceQueues','hasOwnProperty','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','Trunk','active','callerid','Interval','values','channels','length','map','channel','format','%s.%s','uniqueid','wav','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','Channel\x20doesn\x27t\x20exist','voicechannel','StopMixMonitor','destinationchannel','find','stop','filename','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','faxAccounts','checkAfterSend','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment'];(function(_0xd214b3,_0x5eb0bf){var _0x391545=function(_0x229082){while(--_0x229082){_0xd214b3['push'](_0xd214b3['shift']());}};_0x391545(++_0x5eb0bf);}(_0x40b2,0x17f));var _0x240b=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x40b2[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x240b('0x0'));var util=require(_0x240b('0x1'));var jayson=require(_0x240b('0x2'));var schema=require(_0x240b('0x3'));var BPromise=require(_0x240b('0x4'));var moment=require(_0x240b('0x5'));var config=require(_0x240b('0x6'));var properties=require(_0x240b('0x7'));var ami=require(_0x240b('0x8'));exports[_0x240b('0x9')]=function(_0xd46e25,_0x14e74b,_0x3a6698){return new BPromise(function(_0xae1d24,_0x31c64b){var _0xc76949={'QueuePause':function(_0x1a1678){return new Promise(function(_0x29089c,_0x3e8333){var _0x37499c=util['format']('%s/%s',_0x240b('0xa'),_0x1a1678[_0x240b('0xb')]);if(_0xd46e25['timers']&&_0xd46e25[_0x240b('0xc')][_0x37499c]&&_0xd46e25['timers'][_0x37499c][_0x240b('0xd')]){_0xd46e25['timers'][_0x37499c][_0x240b('0xe')]();}if(_0xd46e25[_0x240b('0xf')][_0x37499c]){_0xd46e25[_0x240b('0xf')][_0x37499c][_0x240b('0x10')]({'statePause':_0x1a1678[_0x240b('0x11')]?!![]:![]});}_0x29089c({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x36a0f){var _0x392cf5=this;return new Promise(function(_0x507c92,_0x44954d){if(ami[_0x240b('0x12')]()==![]){return _0x44954d(_0x392cf5['error'](0x1f4,[config[_0x240b('0x13')]['ip'],config[_0x240b('0x13')]['username'],_0x240b('0x14')][_0x240b('0x15')]('\x20')));}_0x36a0f=_[_0x240b('0x16')](_0x36a0f,_[_0x240b('0x17')](properties[_0x240b('0x18')]));_0x36a0f[_0x240b('0x19')]=_0x240b('0x1a');return ami[_0x240b('0x1b')](_0x36a0f)['then'](function(_0x4a6d2f){_0x507c92({'code':0xc8,'message':_0x4a6d2f[_0x240b('0x1c')]});})['catch'](function(_0x350c6b){_0x44954d(_0x392cf5[_0x240b('0x1d')](0x1f5,_0x350c6b['message']));});});},'Command':function(_0x2064b3){var _0x41e73a=this;return new Promise(function(_0x4af24b,_0x128979){if(ami[_0x240b('0x12')]()==![]){return _0x128979(_0x41e73a[_0x240b('0x1d')](0x1f4,[config['asterisk']['ip'],config[_0x240b('0x13')][_0x240b('0x1e')],_0x240b('0x14')][_0x240b('0x15')]('\x20')));}_0x2064b3=_[_0x240b('0x16')](_0x2064b3,_0x240b('0x1f'));_0x2064b3[_0x240b('0x19')]=_0x240b('0x20');return ami[_0x240b('0x1b')](_0x2064b3)[_0x240b('0x21')](function(_0x4535aa){_0x4af24b({'code':0xc8,'message':_0x4535aa[_0x240b('0x22')]});})[_0x240b('0x23')](function(_0x1721f3){_0x128979(_0x41e73a[_0x240b('0x1d')](0x1f5,_0x1721f3[_0x240b('0x1c')]));});});},'VoiceQueues':function(_0x1d947e){return new Promise(function(_0x1692b3,_0x29646e){var _0x5d0923=[];for(var _0x4440fa in _0xd46e25[_0x240b('0x24')]){if(_0xd46e25[_0x240b('0x24')][_0x240b('0x25')](_0x4440fa)){var _0x535bef=_0xd46e25['voiceQueues'][_0x4440fa];var _0x10590a={'id':_0x535bef['id'],'name':_0x535bef['name'],'strategy':_0x535bef[_0x240b('0x26')],'answered':_0x535bef[_0x240b('0x27')],'available':_0x535bef['available'],'loggedIn':_0x535bef[_0x240b('0x28')],'pTalking':_0x535bef[_0x240b('0x29')],'sumBillable':_0x535bef[_0x240b('0x2a')],'sumDuration':_0x535bef[_0x240b('0x2b')],'sumHoldTime':_0x535bef[_0x240b('0x2c')]||0x0,'talking':_0x535bef[_0x240b('0x2d')],'total':_0x535bef[_0x240b('0x2e')],'type':_0x535bef[_0x240b('0x2f')],'unmanaged':_0x535bef[_0x240b('0x30')],'abandoned':_0x535bef['abandoned'],'waiting':_0x535bef[_0x240b('0x31')],'loggedInDb':_0x535bef['loggedInDb']};if(_0x535bef['type']==='outbound'){_0x10590a[_0x240b('0x32')]=_0x535bef[_0x240b('0x32')];_0x10590a[_0x240b('0x33')]=_0x535bef[_0x240b('0x33')];_0x10590a[_0x240b('0x34')]=_0x535bef[_0x240b('0x34')];_0x10590a[_0x240b('0x35')]=_0x535bef['dialOriginateCallerIdNumber'];_0x10590a[_0x240b('0x36')]=_0x535bef[_0x240b('0x36')];_0x10590a[_0x240b('0x37')]=_0x535bef['dialPrefix'];_0x10590a['outboundAnswerAgiCallsDay']=_0x535bef['outboundAnswerAgiCallsDay'];_0x10590a[_0x240b('0x38')]=_0x535bef[_0x240b('0x38')];_0x10590a['outboundBlacklistCallsDay']=_0x535bef['outboundBlacklistCallsDay'];_0x10590a[_0x240b('0x39')]=_0x535bef[_0x240b('0x39')];_0x10590a[_0x240b('0x3a')]=_0x535bef['outboundCongestionCallsDay'];_0x10590a[_0x240b('0x3b')]=_0x535bef[_0x240b('0x3b')];_0x10590a[_0x240b('0x3c')]=_0x535bef[_0x240b('0x3c')];_0x10590a[_0x240b('0x3d')]=_0x535bef[_0x240b('0x3d')];_0x10590a[_0x240b('0x3e')]=_0x535bef[_0x240b('0x3e')];_0x10590a['outboundNoSuchCallsDay']=_0x535bef[_0x240b('0x3f')];_0x10590a['outboundOriginateFailureCallsDay']=_0x535bef[_0x240b('0x40')];_0x10590a[_0x240b('0x41')]=_0x535bef['outboundReCallsDay'];_0x10590a[_0x240b('0x42')]=_0x535bef[_0x240b('0x42')];_0x10590a[_0x240b('0x43')]=_0x535bef[_0x240b('0x43')];_0x10590a['predictiveIntervalAnsweredCalls']=_0x535bef[_0x240b('0x44')];_0x10590a[_0x240b('0x45')]=_0x535bef[_0x240b('0x45')];_0x10590a[_0x240b('0x46')]=_0x535bef[_0x240b('0x46')];_0x10590a[_0x240b('0x47')]=_0x535bef['predictiveIntervalDroppedCallsCallersExit'];_0x10590a[_0x240b('0x48')]=_0x535bef[_0x240b('0x48')];_0x10590a[_0x240b('0x49')]=_0x535bef[_0x240b('0x49')];_0x10590a[_0x240b('0x4a')]=_0x535bef[_0x240b('0x4a')];_0x10590a[_0x240b('0x4b')]=_0x535bef[_0x240b('0x4b')];_0x10590a['predictiveIntervalLowerLimit']=_0x535bef['predictiveIntervalLowerLimit'];_0x10590a[_0x240b('0x4c')]=_0x535bef[_0x240b('0x4c')];_0x10590a['predictiveIntervalPauses']=_0x535bef[_0x240b('0x4d')];_0x10590a[_0x240b('0x4e')]=_0x535bef['predictiveIntervalTotalCalls'];_0x10590a[_0x240b('0x1c')]=_0x535bef[_0x240b('0x1c')];_0x10590a[_0x240b('0x4f')]=_0x535bef[_0x240b('0x4f')];}if(_0x535bef['Trunk']){_0x10590a[_0x240b('0x50')]={'id':_0x535bef['Trunk']['id'],'name':_0x535bef[_0x240b('0x50')][_0x240b('0xb')],'active':_0x535bef[_0x240b('0x50')][_0x240b('0x51')],'callerid':_0x535bef[_0x240b('0x50')][_0x240b('0x52')]};}if(_0x535bef[_0x240b('0x53')]){_0x10590a[_0x240b('0x53')]={'id':_0x535bef['Interval']['id'],'name':_0x535bef[_0x240b('0x53')]['name']};}_0x5d0923['push'](_0x10590a);}}_0x1692b3({'count':_0x5d0923['length'],'rows':_0x5d0923});});},'VoiceChannels':function(_0x2bf2d0){return new Promise(function(_0x1c1ff7,_0x364da4){var _0x58dfc1=_[_0x240b('0x54')](_0xd46e25[_0x240b('0x55')]);_0x1c1ff7({'count':_0x58dfc1[_0x240b('0x56')],'rows':_0x58dfc1});});},'VoiceChannelMixMonitor':function(_0x561deb){var _0x554da9=this;return new Promise(function(_0x24006a,_0x38aa49){if(ami[_0x240b('0x12')]()==![]){return _0x38aa49(_0x554da9[_0x240b('0x1d')](0x1f4,[config['asterisk']['ip'],config[_0x240b('0x13')][_0x240b('0x1e')],_0x240b('0x14')][_0x240b('0x15')]('\x20')));}var _0x207906=schema(properties['voicechannel'])[_0x240b('0x3')](_0x561deb);if(_0x207906['length']>0x0){return _0x38aa49(_0x554da9[_0x240b('0x1d')](0x1f4,_[_0x240b('0x57')](_0x207906,_0x240b('0x1c'))[_0x240b('0x15')](',\x20')));}var _0x20d9d4=_['find'](_0xd46e25['channels'],{'uniqueid':_0x561deb['uniqueid']});if(_0x20d9d4&&_0x20d9d4[_0x240b('0x58')]){var _0x1505e0=util[_0x240b('0x59')](_0x240b('0x5a'),_0x561deb['filename']||_0x561deb[_0x240b('0x5b')],_0x561deb['format']||_0x240b('0x5c'));return ami['Action']({'action':'MixMonitor','channel':_0x20d9d4[_0x240b('0x58')],'file':_0x1505e0,'options':_0x240b('0x5d')})[_0x240b('0x21')](function(_0x31bea3){var _0x10ce17=_['find'](_0x20d9d4[_0x240b('0x5e')],{'filename':_0x240b('0x5f')+_0x1505e0[_0x240b('0x60')]()});if(_[_0x240b('0x61')](_0x10ce17)){_0x20d9d4[_0x240b('0x5e')]['push']({'filename':_0x240b('0x5f')+_0x1505e0[_0x240b('0x60')](),'createdAt':moment()[_0x240b('0x59')](_0x240b('0x62')),'mixmonitorid':_0x31bea3[_0x240b('0x63')],'status':'rec'});}else{_0x10ce17[_0x240b('0x63')]=_0x31bea3[_0x240b('0x63')];_0x10ce17[_0x240b('0x64')]=_0x240b('0x65');}_0x24006a({'code':0xc8,'message':[_0x561deb[_0x240b('0x5b')],'MixMonitor\x20Success',_0x31bea3[_0x240b('0x63')]][_0x240b('0x15')]('\x20'),'mixmonitorid':_0x31bea3[_0x240b('0x63')]});})['catch'](function(_0x134777){_0x38aa49(_0x554da9[_0x240b('0x1d')](0x1f5,[_0x561deb[_0x240b('0x5b')],_0x134777[_0x240b('0x1c')][_0x240b('0x60')]()][_0x240b('0x15')]('\x20')));});}else{return _0x38aa49(_0x554da9[_0x240b('0x1d')](0x1f5,_0x240b('0x66')));}});},'VoiceChannelStopMixMonitor':function(_0x4e993d){var _0x499195=this;return new Promise(function(_0x382f33,_0x50bb63){if(ami[_0x240b('0x12')]()==![]){return _0x50bb63(_0x499195[_0x240b('0x1d')](0x1f4,[config[_0x240b('0x13')]['ip'],config[_0x240b('0x13')][_0x240b('0x1e')],_0x240b('0x14')][_0x240b('0x15')]('\x20')));}var _0x51b2ce=schema(properties[_0x240b('0x67')])[_0x240b('0x3')](_0x4e993d);if(_0x51b2ce[_0x240b('0x56')]>0x0){return _0x50bb63(_0x499195[_0x240b('0x1d')](0x1f4,_[_0x240b('0x57')](_0x51b2ce,_0x240b('0x1c'))[_0x240b('0x15')](',\x20')));}var _0x30cafc=_['find'](_0xd46e25[_0x240b('0x55')],{'uniqueid':_0x4e993d[_0x240b('0x5b')]});if(_0x30cafc){return BPromise['resolve']()[_0x240b('0x21')](function(){if(_0x30cafc[_0x240b('0x58')]){return ami['Action']({'action':_0x240b('0x68'),'channel':_0x30cafc[_0x240b('0x58')],'mixmonitorid':_0x4e993d[_0x240b('0x63')]})[_0x240b('0x23')](function(_0x3b0947){});}})['then'](function(){if(_0x30cafc[_0x240b('0x69')]){return ami['Action']({'action':_0x240b('0x68'),'channel':_0x30cafc[_0x240b('0x69')],'mixmonitorid':_0x4e993d['mixmonitorid']})[_0x240b('0x23')](function(_0x25ed24){});}})[_0x240b('0x21')](function(_0x56edb8){var _0x2901fa=_[_0x240b('0x6a')](_0x30cafc['monitors'],{'mixmonitorid':_0x4e993d['mixmonitorid']});if(_0x2901fa){_0x2901fa[_0x240b('0x64')]=_0x240b('0x6b');}})[_0x240b('0x21')](function(){var _0x4c291a=util[_0x240b('0x59')]('%s.%s',_0x4e993d[_0x240b('0x6c')]||_0x4e993d[_0x240b('0x5b')],_0x4e993d[_0x240b('0x59')]||_0x240b('0x5c'));var _0x571e06=_[_0x240b('0x6a')](_0x30cafc[_0x240b('0x5e')],{'filename':_0x240b('0x5f')+_0x4c291a[_0x240b('0x60')]()});if(_0x571e06){_0x571e06['status']='stop';}})[_0x240b('0x21')](function(){_0x382f33({'code':0xc8,'message':[_0x4e993d['uniqueid'],_0x240b('0x6d')][_0x240b('0x15')]('\x20')});})['catch'](function(_0x11561b){_0x50bb63(_0x499195['error'](0x1f5,[_0x4e993d[_0x240b('0x5b')],_0x11561b['message']['toLowerCase']()][_0x240b('0x15')]('\x20')));});}else{return _0x50bb63(_0x499195[_0x240b('0x1d')](0x1f5,_0x240b('0x66')));}});},'VoiceQueuesChannels':function(_0xa1c8df){return new Promise(function(_0x2771c1,_0x2bc0ea){var _0x51fa4b=_[_0x240b('0x54')](_0xd46e25[_0x240b('0x6e')]);_0x2771c1({'count':_0x51fa4b[_0x240b('0x56')],'rows':_0x51fa4b});});},'VoiceQueuesChannel':function(_0x1ad2f1){var _0xcfe2e6=this;return new Promise(function(_0x493c0b,_0x96bb9d){var _0x13a025=schema(properties[_0x240b('0x6f')])['validate'](_0x1ad2f1);if(_0x13a025[_0x240b('0x56')]>0x0){return _0x96bb9d(_0xcfe2e6[_0x240b('0x1d')](0x1f4,_[_0x240b('0x57')](_0x13a025,_0x240b('0x1c'))[_0x240b('0x15')](',\x20')));}var _0x22ebbb=_[_0x240b('0x6a')](_0xd46e25[_0x240b('0x6e')],{'uniqueid':_0x1ad2f1['uniqueid']});if(_0x22ebbb){_0x493c0b(_0x22ebbb);}else{return _0x96bb9d(_0xcfe2e6[_0x240b('0x1d')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x323643){var _0x37a213=this;return new Promise(function(_0x3875bb,_0x66d0fa){if(ami['isConnected']()==![]){return _0x66d0fa(_0x37a213[_0x240b('0x1d')](0x1f4,[config['asterisk']['ip'],config[_0x240b('0x13')][_0x240b('0x1e')],_0x240b('0x14')]['join']('\x20')));}var _0x446a6d=schema(properties[_0x240b('0x70')])[_0x240b('0x3')](_0x323643);if(_0x446a6d[_0x240b('0x56')]>0x0){return _0x66d0fa(_0x37a213['error'](0x1f4,_[_0x240b('0x57')](_0x446a6d,_0x240b('0x1c'))[_0x240b('0x15')](',\x20')));}var _0x7a631c=_[_0x240b('0x6a')](_0xd46e25[_0x240b('0x6e')],{'uniqueid':_0x323643[_0x240b('0x5b')]});if(_0x7a631c&&_0x7a631c[_0x240b('0x58')]){return ami[_0x240b('0x1b')]({'action':_0x240b('0x71'),'channel':_0x7a631c[_0x240b('0x58')]})[_0x240b('0x21')](function(_0x51da6e){_0x3875bb({'code':0xc8,'message':[_0x323643['uniqueid'],_0x51da6e[_0x240b('0x1c')][_0x240b('0x60')]()][_0x240b('0x15')]('\x20')});})[_0x240b('0x23')](function(_0x3a703f){_0x66d0fa(_0x37a213[_0x240b('0x1d')](0x1f5,[_0x323643[_0x240b('0x5b')],_0x3a703f[_0x240b('0x1c')][_0x240b('0x60')]()][_0x240b('0x15')]('\x20')));});}else{return _0x66d0fa(_0x37a213['error'](0x1f5,_0x240b('0x66')));}});},'VoiceQueuesChannelRedirect':function(_0x2e6c56){var _0x4a0ad6=this;return new Promise(function(_0x1d4a06,_0x455c11){if(ami[_0x240b('0x12')]()==![]){return _0x455c11(_0x4a0ad6[_0x240b('0x1d')](0x1f4,[config[_0x240b('0x13')]['ip'],config['asterisk'][_0x240b('0x1e')],_0x240b('0x14')][_0x240b('0x15')]('\x20')));}var _0x23f66e=schema(properties[_0x240b('0x72')])[_0x240b('0x3')](_0x2e6c56);if(_0x23f66e[_0x240b('0x56')]>0x0){return _0x455c11(_0x4a0ad6[_0x240b('0x1d')](0x1f4,_[_0x240b('0x57')](_0x23f66e,_0x240b('0x1c'))[_0x240b('0x15')](',\x20')));}var _0x11b343=_[_0x240b('0x6a')](_0xd46e25[_0x240b('0x6e')],{'uniqueid':_0x2e6c56[_0x240b('0x5b')]});if(_0x11b343&&_0x11b343[_0x240b('0x58')]){return ami[_0x240b('0x1b')]({'action':_0x240b('0x73'),'channel':_0x11b343[_0x240b('0x58')],'exten':_0x2e6c56[_0x240b('0x74')],'context':_0x2e6c56[_0x240b('0x75')]||_0x11b343[_0x240b('0x75')],'priority':0x1})[_0x240b('0x21')](function(_0x24deb3){_0x1d4a06({'code':0xc8,'message':[_0x2e6c56['uniqueid'],_0x24deb3[_0x240b('0x1c')][_0x240b('0x60')]()][_0x240b('0x15')]('\x20')});})[_0x240b('0x23')](function(_0x2aae70){_0x455c11(_0x4a0ad6[_0x240b('0x1d')](0x1f5,[_0x2e6c56[_0x240b('0x5b')],_0x2aae70[_0x240b('0x1c')][_0x240b('0x60')]()][_0x240b('0x15')]('\x20')));});}else{return _0x455c11(_0x4a0ad6['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x44d8bd){return new Promise(function(_0x36fdca,_0xfc3e21){var _0x4c30a0=_[_0x240b('0x54')](_0xd46e25[_0x240b('0xf')]);_0x36fdca({'count':_0x4c30a0[_0x240b('0x56')],'rows':_0x4c30a0});});},'Telephones':function(_0x3df82f){return new Promise(function(_0x54a09e,_0x214773){var _0x4fe98e=_['values'](_0xd46e25['telephones']);_0x54a09e({'count':_0x4fe98e['length'],'rows':_0x4fe98e});});},'Trunks':function(_0x515d07){return new Promise(function(_0x43337c,_0x1ea6b3){var _0xee4b07=_[_0x240b('0x54')](_0xd46e25[_0x240b('0x76')]);_0x43337c({'count':_0xee4b07[_0x240b('0x56')],'rows':_0xee4b07});});},'OutboundChannels':function(_0x4a0595){return new Promise(function(_0x137910,_0x4430f3){var _0x30645a=_['values'](_0xd46e25[_0x240b('0x77')]);_0x137910({'count':_0x30645a[_0x240b('0x56')],'rows':_0x30645a});});},'Outbound':function(_0x508656){return new Promise(function(_0x31450b,_0x2276b4){_0x31450b(_0xd46e25['outbound']);});},'Campaigns':function(_0x296c89){return new Promise(function(_0x4b53af,_0x3a28c3){var _0x2dfa82=_[_0x240b('0x54')](_0xd46e25[_0x240b('0x78')]);_0x4b53af({'count':_0x2dfa82[_0x240b('0x56')],'rows':_0x2dfa82});});},'VoiceQueuesPreview':function(_0x2de001){var _0x3c2afa=this;return new Promise(function(_0x2b2234,_0x517396){_0x14e74b[_0x240b('0x79')](_0x2de001['id'])[_0x240b('0x21')](function(_0x4a4a43){_0x2b2234({'code':0xc8,'message':_0x4a4a43['message']});})[_0x240b('0x23')](function(_0x30706c){_0x517396(_0x3c2afa[_0x240b('0x1d')](0x1f4,_0x30706c[_0x240b('0x1c')]));});});},'EventManager':function(_0x4f3ae8){var _0xa8651c=this;return new Promise(function(_0x1eb599,_0x535e3e){if(!_0x4f3ae8[_0x240b('0x7a')]){return _0x535e3e(_0xa8651c[_0x240b('0x1d')](0x1f4,_0x240b('0x7b')));}ami[_0x240b('0x7c')]('custom:'+_0x4f3ae8[_0x240b('0x7a')],_0x4f3ae8['message']);_0x1eb599({'code':0xc8,'message':_0x4f3ae8});});},'FaxAccounts':function(_0x3f1937){return new Promise(function(_0x258cd1,_0x3b3e51){var _0x10cc7e=_[_0x240b('0x54')](_0xd46e25[_0x240b('0x7d')]);_0x258cd1({'count':_0x10cc7e[_0x240b('0x56')],'rows':_0x10cc7e});});},'SendFax':function(_0x377933){var _0x64fa43=this;return new Promise(function(_0x460309,_0x428d16){_0x3a6698['send'](_0x377933)[_0x240b('0x21')](function(_0x5e08aa){_0x460309({'code':0xc8,'message':_0x5e08aa[_0x240b('0x1c')]});})[_0x240b('0x23')](function(_0x30a198){_0x428d16(_0x64fa43[_0x240b('0x1d')](0x1f4,_0x30a198[_0x240b('0x1c')]));});});},'CheckAfterSend':function(_0x458e37){var _0x438a50=this;return new Promise(function(_0x4129ea,_0x517450){_0x3a6698[_0x240b('0x7e')](_0x458e37)['then'](function(_0x536aca){_0x4129ea({'code':0xc8,'message':_0x536aca['message']});})[_0x240b('0x23')](function(_0x3b1697){_0x517450(_0x438a50[_0x240b('0x1d')](0x1f4,_0x3b1697['message']));});});}};var _0x4e09be=jayson['server'](_0xc76949)['http']();_0x4e09be['on'](_0x240b('0x1d'),function(_0x35753e){return _0x31c64b(_0x35753e);});_0x4e09be['listen'](0x232a,_0x240b('0x7f'),function(){console[_0x240b('0x80')](_0x240b('0x81'),0x232a);return _0xae1d24('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index ea6596e..ea972de 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 _0x4e35=['autoCreate','data2','data1','calleridnum','routeId','firstName','calleridname','destcalleridname','destcalleridnum','uniqueid','','resolve','then','showContact','omit','xmd-contactid2','format','user:%s','name','trigger:%s','action','toLowerCase','merge','createContact','catch','error','Error\x20creating\x20contact','stringify','bluebird','util','lodash','ioredis','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults'];(function(_0x1a5d97,_0x5eab88){var _0x20bc68=function(_0x2d82ea){while(--_0x2d82ea){_0x1a5d97['push'](_0x1a5d97['shift']());}};_0x20bc68(++_0x5eab88);}(_0x4e35,0x144));var _0x54e3=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x4e35[_0x576170];return _0x397c70;};'use strict';var BPromise=require(_0x54e3('0x0'));var util=require(_0x54e3('0x1'));var _=require(_0x54e3('0x2'));var Redis=require(_0x54e3('0x3'));var config=require(_0x54e3('0x4'));var logger=require(_0x54e3('0x5'))('trigger');var cmContactRpc=require(_0x54e3('0x6'));config[_0x54e3('0x7')]=_[_0x54e3('0x8')](config[_0x54e3('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x4d0ad7,_0x5b7b6c,_0xa8d082){logger['info'](_0x4d0ad7,_0x5b7b6c,JSON['stringify'](_0xa8d082));io['to'](_0x4d0ad7)['emit'](_0x5b7b6c,_0xa8d082);}exports['exec']=function(_0x529b81,_0x3055ab,_0x24723b){_0x24723b[_0x54e3('0x9')]=0x0;if(_0x3055ab[_0x54e3('0xa')]&&parseInt(_0x3055ab['data2'],0xa)){var _0x413c75={'ListId':parseInt(_0x3055ab[_0x54e3('0xb')],0xa),'phone':_0x24723b[_0x54e3('0xc')]};if(_['isNil'](_0x24723b[_0x54e3('0xd')])){_0x413c75[_0x54e3('0xe')]=_0x24723b['calleridname']&&_0x24723b['calleridname']!==''?_0x24723b[_0x54e3('0xf')]:_0x24723b[_0x54e3('0xc')]||_0x24723b['uniqueid'];}else{_0x413c75['firstName']=_0x24723b[_0x54e3('0x10')]&&_0x24723b['destcalleridname']!==''?_0x24723b[_0x54e3('0x10')]:_0x24723b[_0x54e3('0x11')]||_0x24723b[_0x54e3('0x12')];_0x413c75['phone']=_0x24723b[_0x54e3('0x10')]&&_0x24723b[_0x54e3('0x10')]!==_0x54e3('0x13')?_0x24723b[_0x54e3('0x10')]:_0x24723b[_0x54e3('0x11')]||_0x24723b[_0x54e3('0x12')];}BPromise[_0x54e3('0x14')]()[_0x54e3('0x15')](cmContactRpc[_0x54e3('0x16')]({'where':_[_0x54e3('0x17')](_0x413c75,['firstName'])}))[_0x54e3('0x15')](function(_0x137c8a){if(_0x137c8a){_0x24723b[_0x54e3('0x18')]=_0x137c8a['id'];emit(util[_0x54e3('0x19')](_0x54e3('0x1a'),_0x529b81[_0x54e3('0x1b')]),util['format'](_0x54e3('0x1c'),_0x3055ab[_0x54e3('0x1d')][_0x54e3('0x1e')]()),_[_0x54e3('0x1f')](_0x24723b,{'ListId':parseInt(_0x3055ab[_0x54e3('0xb')],0xa)}));return;}else{return BPromise[_0x54e3('0x14')]()[_0x54e3('0x15')](cmContactRpc[_0x54e3('0x20')](_0x413c75));}})['then'](function(_0x58cf02){if(_0x58cf02){_0x24723b[_0x54e3('0x18')]=_0x58cf02['id'];emit(util[_0x54e3('0x19')](_0x54e3('0x1a'),_0x529b81['name']),util[_0x54e3('0x19')](_0x54e3('0x1c'),_0x3055ab[_0x54e3('0x1d')][_0x54e3('0x1e')]()),_[_0x54e3('0x1f')](_0x24723b,{'ListId':parseInt(_0x3055ab[_0x54e3('0xb')],0xa)}));}})[_0x54e3('0x21')](function(_0x55034e){logger[_0x54e3('0x22')](_0x54e3('0x23'),JSON[_0x54e3('0x24')](_0x55034e));});}else{if(_0x529b81){emit(util[_0x54e3('0x19')](_0x54e3('0x1a'),_0x529b81['name']),util[_0x54e3('0x19')](_0x54e3('0x1c'),_0x3055ab[_0x54e3('0x1d')][_0x54e3('0x1e')]()),_[_0x54e3('0x1f')]({'ListId':parseInt(_0x3055ab[_0x54e3('0xb')],0xa)},_0x24723b));}}}; \ No newline at end of file +var _0x06ee=['destcalleridnum','then','showContact','omit','xmd-contactid2','format','user:%s','name','trigger:%s','action','toLowerCase','merge','resolve','createContact','catch','error','Error\x20creating\x20contact','bluebird','lodash','ioredis','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','defaults','redis','socket.io-emitter','stringify','emit','exec','autoCreate','data1','calleridnum','isNil','routeId','firstName','calleridname','uniqueid','destcalleridname',''];(function(_0x3d86cb,_0x3278fd){var _0x192eed=function(_0x5f1f34){while(--_0x5f1f34){_0x3d86cb['push'](_0x3d86cb['shift']());}};_0x192eed(++_0x3278fd);}(_0x06ee,0xad));var _0xe06e=function(_0x1a7768,_0x515b35){_0x1a7768=_0x1a7768-0x0;var _0x1df5fa=_0x06ee[_0x1a7768];return _0x1df5fa;};'use strict';var BPromise=require(_0xe06e('0x0'));var util=require('util');var _=require(_0xe06e('0x1'));var Redis=require(_0xe06e('0x2'));var config=require(_0xe06e('0x3'));var logger=require(_0xe06e('0x4'))('trigger');var cmContactRpc=require(_0xe06e('0x5'));config['redis']=_[_0xe06e('0x6')](config[_0xe06e('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xe06e('0x8'))(new Redis(config[_0xe06e('0x7')]));function emit(_0x362a7f,_0x4476f5,_0x126cfe){logger['info'](_0x362a7f,_0x4476f5,JSON[_0xe06e('0x9')](_0x126cfe));io['to'](_0x362a7f)[_0xe06e('0xa')](_0x4476f5,_0x126cfe);}exports[_0xe06e('0xb')]=function(_0x3d6198,_0x4692ef,_0x29523f){_0x29523f[_0xe06e('0xc')]=0x0;if(_0x4692ef['data2']&&parseInt(_0x4692ef['data2'],0xa)){var _0x2b201b={'ListId':parseInt(_0x4692ef[_0xe06e('0xd')],0xa),'phone':_0x29523f[_0xe06e('0xe')]};if(_[_0xe06e('0xf')](_0x29523f[_0xe06e('0x10')])){_0x2b201b[_0xe06e('0x11')]=_0x29523f['calleridname']&&_0x29523f[_0xe06e('0x12')]!==''?_0x29523f[_0xe06e('0x12')]:_0x29523f['calleridnum']||_0x29523f[_0xe06e('0x13')];}else{_0x2b201b[_0xe06e('0x11')]=_0x29523f[_0xe06e('0x14')]&&_0x29523f[_0xe06e('0x14')]!==_0xe06e('0x15')?_0x29523f[_0xe06e('0x14')]:_0x29523f['destcalleridnum']||_0x29523f[_0xe06e('0x13')];_0x2b201b['phone']=_0x29523f[_0xe06e('0x14')]&&_0x29523f['destcalleridname']!==_0xe06e('0x15')?_0x29523f[_0xe06e('0x14')]:_0x29523f[_0xe06e('0x16')]||_0x29523f[_0xe06e('0x13')];}BPromise['resolve']()[_0xe06e('0x17')](cmContactRpc[_0xe06e('0x18')]({'where':_[_0xe06e('0x19')](_0x2b201b,[_0xe06e('0x11')])}))[_0xe06e('0x17')](function(_0x235769){if(_0x235769){_0x29523f[_0xe06e('0x1a')]=_0x235769['id'];emit(util[_0xe06e('0x1b')](_0xe06e('0x1c'),_0x3d6198[_0xe06e('0x1d')]),util[_0xe06e('0x1b')](_0xe06e('0x1e'),_0x4692ef[_0xe06e('0x1f')][_0xe06e('0x20')]()),_[_0xe06e('0x21')](_0x29523f,{'ListId':parseInt(_0x4692ef[_0xe06e('0xd')],0xa)}));return;}else{return BPromise[_0xe06e('0x22')]()['then'](cmContactRpc[_0xe06e('0x23')](_0x2b201b));}})[_0xe06e('0x17')](function(_0x3f0bfb){if(_0x3f0bfb){_0x29523f[_0xe06e('0x1a')]=_0x3f0bfb['id'];emit(util['format'](_0xe06e('0x1c'),_0x3d6198[_0xe06e('0x1d')]),util[_0xe06e('0x1b')](_0xe06e('0x1e'),_0x4692ef['action'][_0xe06e('0x20')]()),_[_0xe06e('0x21')](_0x29523f,{'ListId':parseInt(_0x4692ef[_0xe06e('0xd')],0xa)}));}})[_0xe06e('0x24')](function(_0xb1732b){logger[_0xe06e('0x25')](_0xe06e('0x26'),JSON['stringify'](_0xb1732b));});}else{if(_0x3d6198){emit(util[_0xe06e('0x1b')](_0xe06e('0x1c'),_0x3d6198[_0xe06e('0x1d')]),util[_0xe06e('0x1b')](_0xe06e('0x1e'),_0x4692ef[_0xe06e('0x1f')]['toLowerCase']()),_[_0xe06e('0x21')]({'ListId':parseInt(_0x4692ef[_0xe06e('0xd')],0xa)},_0x29523f));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 2fcd0c2..afd9ab8 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 _0xcffe=['exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','../rpc/cmContact','../../../config/environment','../ami','redis','defaults','localhost','socket.io-emitter','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:queuecallerabandon','custom:dialend','custom:incomingmessage','custom:acceptmessage','prototype','info','emit','clone','checkTriggers','hasOwnProperty','status','checkTrigger','Actions','length','interface','action','contactmanager','motionbar','browser','data1','TemplateId','data2','html','template\x20not\x20found','uri','buildUri','data3','isNil','data4','location','uriLocation','windowWidth','800','data5','data6','600','winapp','winApplication','winArguments','render','format','user:%s','name','trigger:%s:%s','toLowerCase','merge','jscripty','trigger:%s','exec','integration','queue','routeId','urlforward','parse','query','checkConditions','AnyConditions','channel','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','event','lastevent'];(function(_0x210718,_0x247b55){var _0x541bfc=function(_0x5dbcad){while(--_0x5dbcad){_0x210718['push'](_0x210718['shift']());}};_0x541bfc(++_0x247b55);}(_0xcffe,0x1a1));var _0xecff=function(_0x79cd47,_0x16102d){_0x79cd47=_0x79cd47-0x0;var _0x3b9484=_0xcffe[_0x79cd47];return _0x3b9484;};'use strict';var util=require(_0xecff('0x0'));var _=require(_0xecff('0x1'));var url=require(_0xecff('0x2'));var Mustache=require(_0xecff('0x3'));var Redis=require(_0xecff('0x4'));var urlforward=require(_0xecff('0x5'));var integration=require(_0xecff('0x6'));var cmContact=require(_0xecff('0x7'));var cmContactRpc=require(_0xecff('0x8'));var config=require(_0xecff('0x9'));var logger=require('../../../config/logger')('trigger');var ami=require(_0xecff('0xa'));config[_0xecff('0xb')]=_[_0xecff('0xc')](config[_0xecff('0xb')],{'host':_0xecff('0xd'),'port':0x18eb});var io=require(_0xecff('0xe'))(new Redis(config[_0xecff('0xb')]));var operators={'equals':function(_0x4d4458,_0x672de1){return _0x4d4458==_0x672de1;},'not_equals':function(_0x3eefb9,_0x195b15){return _0x3eefb9!=_0x195b15;}};var barAndWebActions=[_0xecff('0xf'),_0xecff('0x2'),'winapp'];function Trigger(_0x425380){this[_0xecff('0x10')]=_0x425380[_0xecff('0x10')];this[_0xecff('0x11')]=_0x425380[_0xecff('0x11')];this[_0xecff('0x12')]=_0x425380[_0xecff('0x12')];this[_0xecff('0x13')]=_0x425380[_0xecff('0x13')];this[_0xecff('0x14')]=_0x425380[_0xecff('0x14')];this[_0xecff('0x15')]=_0x425380[_0xecff('0x15')];this[_0xecff('0x16')]=_0x425380['freshdeskAccounts'];this['salesforceAccounts']=_0x425380[_0xecff('0x17')];this[_0xecff('0x18')]=_0x425380['sugarcrmAccounts'];this[_0xecff('0x19')]=_0x425380[_0xecff('0x19')];this[_0xecff('0x1a')]=_0x425380['deskAccounts'];this['vtigerAccounts']=_0x425380[_0xecff('0x1b')];this[_0xecff('0x1c')]=_0x425380['servicenowAccounts'];this[_0xecff('0x1d')]=_0x425380[_0xecff('0x1d')];this[_0xecff('0x1e')]={'zendesk':this[_0xecff('0x15')],'salesforce':this[_0xecff('0x17')],'freshdesk':this[_0xecff('0x16')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0xecff('0x19')],'desk':this[_0xecff('0x1a')],'vtiger':this[_0xecff('0x1b')],'servicenow':this[_0xecff('0x1c')],'dynamics365':this['dynamics365Accounts']};ami['on'](_0xecff('0x1f'),this[_0xecff('0x20')][_0xecff('0x21')](this));ami['on'](_0xecff('0x22'),this[_0xecff('0x20')][_0xecff('0x21')](this));ami['on']('custom:agentringnoanswer',this[_0xecff('0x20')]['bind'](this));ami['on']('custom:agentcomplete',this[_0xecff('0x20')]['bind'](this));ami['on'](_0xecff('0x23'),this['syncCustomEvent'][_0xecff('0x21')](this));ami['on']('custom:dialbegin',this[_0xecff('0x20')][_0xecff('0x21')](this));ami['on']('custom:dialconnect',this[_0xecff('0x20')][_0xecff('0x21')](this));ami['on'](_0xecff('0x24'),this[_0xecff('0x20')][_0xecff('0x21')](this));ami['on']('custom:newinteraction',this['syncCustomEvent'][_0xecff('0x21')](this));ami['on']('custom:closedinteraction',this[_0xecff('0x20')][_0xecff('0x21')](this));ami['on'](_0xecff('0x25'),this[_0xecff('0x20')]['bind'](this));ami['on']('custom:outgoingmessage',this['syncCustomEvent'][_0xecff('0x21')](this));ami['on'](_0xecff('0x26'),this[_0xecff('0x20')][_0xecff('0x21')](this));ami['on']('custom:rejectmessage',this[_0xecff('0x20')][_0xecff('0x21')](this));}Trigger[_0xecff('0x27')]['emit']=function(_0x1c9757,_0x2c80a7,_0x266ef7){logger[_0xecff('0x28')](_0x1c9757,_0x2c80a7,JSON['stringify'](_0x266ef7));io['to'](_0x1c9757)[_0xecff('0x29')](_0x2c80a7,_0x266ef7);};Trigger[_0xecff('0x27')]['syncCustomEvent']=function(_0x222df6){var _0x2921b4=_[_0xecff('0x2a')](_0x222df6);this[_0xecff('0x2b')](_0x2921b4);};Trigger['prototype'][_0xecff('0x2b')]=function(_0x298c34){var _0x3fe6ce;for(var _0x55c232 in this[_0xecff('0x10')]){if(this[_0xecff('0x10')][_0xecff('0x2c')](_0x55c232)){if(this[_0xecff('0x10')][_0x55c232][_0xecff('0x2d')]){_0x3fe6ce=this[_0xecff('0x2e')](this['triggers'][_0x55c232],_0x298c34);if(_0x3fe6ce){_['merge'](_0x298c34,_0x298c34['variables']);for(var _0x2d2f8b=0x0,_0x5bbec5,_0x3fda93,_0x21411b;_0x2d2f8b0x0){_0x342367=_[_0xda82('0x28')](_0x2c7063,_0x3fefdb);}return _0x342367;}function getCustomFields(_0x5e2917,_0x51d048){var _0x552723=[];var _0x1ea154={'custom_fields':{}};if(_0x5e2917['length']>0x0){_[_0xda82('0x29')](_0x5e2917,function(_0x388a5a){if(_0x388a5a[_0xda82('0x2a')]===_0xda82('0x2b')&&_0x388a5a[_0xda82('0x2c')]&&!_0x388a5a[_0xda82('0x2d')]){_0x1ea154[_0x388a5a[_0xda82('0x2c')]['toLowerCase']()]=_0x388a5a[_0xda82('0x2e')][_0xda82('0x2f')]();}else if(_0x388a5a[_0xda82('0x2a')]==='string'&&_0x388a5a['idField']&&_0x388a5a[_0xda82('0x2d')]){_0x1ea154[_0xda82('0x30')][_0x388a5a[_0xda82('0x31')]]=_0x388a5a[_0xda82('0x2e')][_0xda82('0x2f')]();}else if(_0x388a5a[_0xda82('0x2a')]==='variable'&&_0x388a5a[_0xda82('0x32')]&&_0x388a5a['idField']&&_0x388a5a['customField']){_0x51d048[_0x388a5a[_0xda82('0x32')]]&&(_0x1ea154[_0xda82('0x30')][_0x388a5a[_0xda82('0x31')]]=_0x51d048[_0x388a5a[_0xda82('0x32')]]['toString']());}else if(_0x388a5a[_0xda82('0x2a')]===_0xda82('0x33')&&_0x388a5a['Variable']&&_0x388a5a['Variable']['name']&&_0x388a5a[_0xda82('0x31')]&&_0x388a5a[_0xda82('0x2d')]){_0x51d048[_0x388a5a[_0xda82('0x34')][_0xda82('0x35')][_0xda82('0x36')]()]&&(_0x1ea154[_0xda82('0x30')][_0x388a5a['idField']]=_0x51d048[_0x388a5a[_0xda82('0x34')]['name'][_0xda82('0x36')]()]['toString']());}});}if(_0x1ea154[_0xda82('0x37')]){_0x1ea154['priority']=Number(_0x1ea154[_0xda82('0x37')]);}return _0x1ea154;}function getTicket(_0x85123c,_0xf10bfc,_0x51f8ad,_0x55b628,_0x25a8fe){logger['info'](_0xda82('0x38'));var _0x5d0079=_[_0xda82('0x39')]({'subject':intUtil[_0xda82('0x3a')](_0x55b628['Subjects'],_0x25a8fe,'\x20'),'type':_0xda82('0x3b'),'status':_0xda82('0x3c'),'labels':[_0xda82('0x3d'),_0xda82('0x3e'),_0xda82('0x3f')][_0xda82('0x40')](getTags(_0x55b628['Tags'],_0xda82('0x35'))),'description':intUtil[_0xda82('0x3a')](_0x55b628[_0xda82('0x41')],_0x25a8fe,'\x0a'),'_links':{'assigned_user':{'href':util[_0xda82('0xc')](_0xda82('0x42'),_0xf10bfc['id']),'class':_0xda82('0x43')}},'message':{'direction':'in','body':intUtil[_0xda82('0x3a')](_0x55b628[_0xda82('0x41')],_0x25a8fe,'\x0a')}},getCustomFields(_0x55b628[_0xda82('0x44')],_0x25a8fe));return request({'uri':util[_0xda82('0xc')]('%s/customers/%d/cases',_0x85123c[_0xda82('0xe')],_0x51f8ad['id']),'method':_0xda82('0x25'),'body':_0x5d0079});}exports[_0xda82('0x45')]=function(_0x19feb7,_0x5cf4d3,_0x748fdd,_0x5d2134,_0x58fdb4,_0xaee761){var _0x3b59c8,_0x33ae41;_0xaee761[_0xda82('0xe')]=intUtil[_0xda82('0x46')](_0xaee761[_0xda82('0xe')]);_0xaee761['serverUrl']=intUtil['stripTrailingSlash'](_0xaee761[_0xda82('0x47')]);if(_0x58fdb4&&_0x58fdb4[_0xda82('0x48')]){logger[_0xda82('0xa')](_0xda82('0x49'),'Recording\x20is\x20enabled!');_0x5cf4d3[_0xda82('0x4a')]=util[_0xda82('0xc')](_0xda82('0x4b'),_0xaee761[_0xda82('0x47')],_0x5cf4d3[_0xda82('0x4c')],md5(_0x5cf4d3[_0xda82('0x4c')]));}else{_0x5cf4d3[_0xda82('0x4a')]='';}headers[_0xda82('0x4d')]=getAuth(_0xaee761);return getUser(_0xaee761,_0x5d2134[_0xda82('0x4e')])['then'](function(_0x5772d7){_0x3b59c8=_0x5772d7;logger[_0xda82('0xa')]('The\x20User\x20ID\x20is:',_0x3b59c8['id']);return getEndUser(_0xaee761,_0x5cf4d3[_0xda82('0x4f')],_0x5cf4d3[_0xda82('0x50')]);})[_0xda82('0x20')](function(_0x389049){_0x33ae41=_0x389049;logger[_0xda82('0xa')](_0xda82('0x51'),_0x33ae41['id']);return getTicket(_0xaee761,_0x3b59c8,_0x33ae41,_0x748fdd,_0x5cf4d3);})['then'](function(_0x3ab09f){if(_0x3ab09f){logger[_0xda82('0xa')](_0xda82('0x52'));logger[_0xda82('0xa')](_0xda82('0x53'),_0x3ab09f['id']);switch(_0xaee761[_0xda82('0x2a')]){case'integrationTab':logger[_0xda82('0xa')](_0xda82('0x49'),_0xda82('0x54'));emit(util[_0xda82('0xc')](_0xda82('0x55'),_0x5d2134[_0xda82('0x35')]),_0xda82('0x56'),{'recordId':_0x3ab09f['id']});break;case _0xda82('0x57'):logger[_0xda82('0xa')](_0xda82('0x49'),_0xda82('0x58'));emit(util[_0xda82('0xc')](_0xda82('0x55'),_0x5d2134[_0xda82('0x35')]),'trigger:browser:url',{'uri':util[_0xda82('0xc')](_0xda82('0x59'),_0x3ab09f['id'])});break;default:logger[_0xda82('0x5a')]('[QUEUE]',_0xda82('0x5b'));}}})[_0xda82('0x5c')](function(_0x501976){console[_0xda82('0x5a')](_0x501976);logger[_0xda82('0x5a')]('[QUEUE]',JSON[_0xda82('0x15')](_0x501976));});};exports['outbound']=function(_0x25c520,_0x3da241,_0x548129,_0xd51ae9,_0x43f5de,_0x5bad6b,_0x5c9cd2){var _0x2b9220,_0x32eaed;_0x5bad6b[_0xda82('0xe')]=intUtil[_0xda82('0x46')](_0x5bad6b[_0xda82('0xe')]);_0x5bad6b[_0xda82('0x47')]=intUtil[_0xda82('0x46')](_0x5bad6b[_0xda82('0x47')]);if(_0x5c9cd2&&_0x5c9cd2[_0xda82('0x5d')]&&_0x5c9cd2[_0xda82('0x5d')]!=='none'){logger[_0xda82('0xa')](_0xda82('0x5e'),_0xda82('0x5f'));_0x3da241[_0xda82('0x4a')]=util['format'](_0xda82('0x4b'),_0x5bad6b[_0xda82('0x47')],_0x3da241[_0xda82('0x4c')],md5(_0x3da241[_0xda82('0x4c')]));}headers['Authorization']=getAuth(_0x5bad6b);return getUser(_0x5bad6b,_0xd51ae9[_0xda82('0x4e')])[_0xda82('0x20')](function(_0x2e4909){_0x2b9220=_0x2e4909;logger[_0xda82('0xa')](_0xda82('0x60'),_0x2b9220['id']);return getEndUser(_0x5bad6b,_0x3da241['destcalleridname'],_0x3da241['destcalleridnum']);})['then'](function(_0x329f04){_0x32eaed=_0x329f04;logger[_0xda82('0xa')](_0xda82('0x51'),_0x32eaed['id']);return getTicket(_0x5bad6b,_0x2b9220,_0x32eaed,_0x548129,_0x3da241);})['then'](function(_0x47f613){if(_0x47f613){logger[_0xda82('0xa')](_0xda82('0x52'));logger[_0xda82('0xa')](_0xda82('0x53'),_0x47f613['id']);switch(_0x5bad6b[_0xda82('0x2a')]){case _0xda82('0x61'):logger[_0xda82('0xa')]('[QUEUE]',_0xda82('0x54'));emit(util[_0xda82('0xc')](_0xda82('0x55'),_0xd51ae9[_0xda82('0x35')]),'trigger:desk:display',{'recordId':_0x47f613['id']});break;case _0xda82('0x57'):logger['info'](_0xda82('0x49'),_0xda82('0x58'));emit(util['format']('user:%s',_0xd51ae9[_0xda82('0x35')]),'trigger:browser:url',{'uri':util['format'](_0xda82('0x62'),_0x5bad6b['remoteUri'],_0x47f613['id'])});break;default:logger[_0xda82('0x5a')](_0xda82('0x5e'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xda82('0x5c')](function(_0x2720e7){logger[_0xda82('0x5a')]('[OUTBOUND]',JSON['stringify'](_0x2720e7));});};exports[_0xda82('0x63')]=function(_0x21c3de,_0x13794c,_0x1a81ad,_0x4353fe,_0x38d6d8,_0x558785){var _0x13c4a5,_0x378374;_0x558785[_0xda82('0xe')]=intUtil[_0xda82('0x46')](_0x558785[_0xda82('0xe')]);_0x558785['serverUrl']=intUtil[_0xda82('0x46')](_0x558785[_0xda82('0x47')]);if(_0x38d6d8&&_0x38d6d8['monitor_format']){logger[_0xda82('0xa')](_0xda82('0x64'),'Recording\x20is\x20enabled!');_0x13794c[_0xda82('0x4a')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x558785[_0xda82('0x47')],_0x13794c[_0xda82('0x4c')],md5(_0x13794c[_0xda82('0x4c')]));}else{_0x13794c[_0xda82('0x4a')]='';}headers[_0xda82('0x4d')]=getAuth(_0x558785);return getUser(_0x558785)['then'](function(_0x2e700f){_0x13c4a5=_0x2e700f;logger[_0xda82('0xa')]('The\x20User\x20ID\x20is:',_0x13c4a5['id']);return getEndUser(_0x558785,_0x13794c[_0xda82('0x4f')],_0x13794c['calleridnum']);})['then'](function(_0x49cbe6){_0x378374=_0x49cbe6;logger['info'](_0xda82('0x51'),_0x378374['id']);return getTicket(_0x558785,_0x13c4a5,_0x378374,_0x1a81ad,_0x13794c);})['then'](function(_0x18e0ea){if(_0x18e0ea){logger[_0xda82('0xa')]('Ticket\x20created!');logger['info'](_0xda82('0x53'),_0x18e0ea['id']);}})['catch'](function(_0x53968d){logger[_0xda82('0x5a')]('[ABANDONED]',JSON[_0xda82('0x15')](_0x53968d));});}; \ No newline at end of file +var _0x630d=['none','Recording\x20is\x20enabled!','email','destcalleridname','destcalleridnum','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','%s/agent/tickets/%s','[OUTBOUND]','Desk\x20account\x20type\x20not\x20recognized','[ABANDONED]','lodash','md5','./util','../../../../config/environment','../../../../config/logger','desk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','total_entries','find','_embedded','entries','then','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','format','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','GET','authType','%s:%s','password','token','%s/token:%s','username','Basic\x20%s','toString','Searching\x20enduser\x20with\x20phone','%s/customers/search','length','map','forEach','type','string','nameField','customField','toLowerCase','content','custom_fields','idField','variable','variableName','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','phone','xCALLY','Motion','Tags','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','stringify','outbound','recordingFormat'];(function(_0x55315c,_0x210939){var _0x3979e9=function(_0x287693){while(--_0x287693){_0x55315c['push'](_0x55315c['shift']());}};_0x3979e9(++_0x210939);}(_0x630d,0x1a8));var _0xd630=function(_0x4335b4,_0xe02877){_0x4335b4=_0x4335b4-0x0;var _0x5b4b2e=_0x630d[_0x4335b4];return _0x5b4b2e;};'use strict';var _=require(_0xd630('0x0'));var rp=require('request-promise');var md5=require(_0xd630('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xd630('0x2'));var config=require(_0xd630('0x3'));var logger=require(_0xd630('0x4'))(_0xd630('0x5'));config[_0xd630('0x6')]=_[_0xd630('0x7')](config[_0xd630('0x6')],{'host':_0xd630('0x8'),'port':0x18eb});var io=require(_0xd630('0x9'))(new Redis(config[_0xd630('0x6')]));function emit(_0x33743b,_0xc7e3b8,_0x3ea0cd){io['to'](_0x33743b)[_0xd630('0xa')](_0xc7e3b8,_0x3ea0cd);}var headers={'Content-Type':_0xd630('0xb'),'Accept':_0xd630('0xb')};function getUser(_0x3cd154,_0x38a89c){if(intUtil['validateEmail'](_0x38a89c)===!![]){logger[_0xd630('0xc')](_0xd630('0xd'),_0x38a89c);return request({'uri':util['format']('%s/users',_0x3cd154['remoteUri'])})['then'](function(_0x5b5722){if(_0x5b5722[_0xd630('0xe')]){return _[_0xd630('0xf')](_0x5b5722[_0xd630('0x10')][_0xd630('0x11')],{'email':_0x38a89c});}})[_0xd630('0x12')](function(_0x48fa4a){if(_0x48fa4a){logger[_0xd630('0xc')](_0xd630('0x13'));return _0x48fa4a;}else{logger[_0xd630('0xc')](_0xd630('0x14'));return request({'uri':util[_0xd630('0x15')](_0xd630('0x16'),_0x3cd154[_0xd630('0x17')])});}});}else{logger[_0xd630('0xc')](_0xd630('0x18'));return request({'uri':util[_0xd630('0x15')]('%s/users/me',_0x3cd154[_0xd630('0x17')])});}}function request(_0x45ce25){logger[_0xd630('0x19')](_0xd630('0x1a'),JSON['stringify'](_0x45ce25));return rp(_[_0xd630('0x7')](_0x45ce25,{'method':_0xd630('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x2c01d5){var _0x1b8c3a;if(_0x2c01d5[_0xd630('0x1c')]==='basic'){_0x1b8c3a=util[_0xd630('0x15')](_0xd630('0x1d'),_0x2c01d5['username'],_0x2c01d5[_0xd630('0x1e')]);}else if(_0x2c01d5['authType']===_0xd630('0x1f')){_0x1b8c3a=util[_0xd630('0x15')](_0xd630('0x20'),_0x2c01d5[_0xd630('0x21')],_0x2c01d5[_0xd630('0x1f')]);}return util['format'](_0xd630('0x22'),new Buffer(_0x1b8c3a)[_0xd630('0x23')]('base64'));}function getEndUser(_0x4935e9,_0x34b26a,_0x2be3d2){logger[_0xd630('0xc')](_0xd630('0x24'),_0x2be3d2);return request({'uri':util[_0xd630('0x15')](_0xd630('0x25'),_0x4935e9[_0xd630('0x17')]),'qs':{'phone':_0x2be3d2}})['then'](function(_0x5ad9c6){if(_0x5ad9c6['total_entries']){logger[_0xd630('0xc')]('Enduser\x20found!');return _0x5ad9c6[_0xd630('0x10')][_0xd630('0x11')][0x0];}else{logger[_0xd630('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xd630('0x15')]('%s/customers',_0x4935e9['remoteUri']),'method':'POST','body':{'first_name':_0x34b26a,'title':_0x34b26a,'phone_numbers':[{'type':'work','value':_0x2be3d2}]}});}});}function getTags(_0x27c503,_0xc06d8){var _0x454949=[];if(_0x27c503&&_0x27c503[_0xd630('0x26')]>0x0){_0x454949=_[_0xd630('0x27')](_0x27c503,_0xc06d8);}return _0x454949;}function getCustomFields(_0x48e2b6,_0x408023){var _0x9fd9d6=[];var _0x4a0747={'custom_fields':{}};if(_0x48e2b6['length']>0x0){_[_0xd630('0x28')](_0x48e2b6,function(_0x5030b9){if(_0x5030b9[_0xd630('0x29')]===_0xd630('0x2a')&&_0x5030b9[_0xd630('0x2b')]&&!_0x5030b9[_0xd630('0x2c')]){_0x4a0747[_0x5030b9[_0xd630('0x2b')][_0xd630('0x2d')]()]=_0x5030b9[_0xd630('0x2e')][_0xd630('0x23')]();}else if(_0x5030b9['type']===_0xd630('0x2a')&&_0x5030b9['idField']&&_0x5030b9[_0xd630('0x2c')]){_0x4a0747[_0xd630('0x2f')][_0x5030b9[_0xd630('0x30')]]=_0x5030b9[_0xd630('0x2e')][_0xd630('0x23')]();}else if(_0x5030b9[_0xd630('0x29')]===_0xd630('0x31')&&_0x5030b9[_0xd630('0x32')]&&_0x5030b9['idField']&&_0x5030b9[_0xd630('0x2c')]){_0x408023[_0x5030b9['variableName']]&&(_0x4a0747[_0xd630('0x2f')][_0x5030b9[_0xd630('0x30')]]=_0x408023[_0x5030b9[_0xd630('0x32')]]['toString']());}else if(_0x5030b9[_0xd630('0x29')]===_0xd630('0x33')&&_0x5030b9[_0xd630('0x34')]&&_0x5030b9[_0xd630('0x34')]['name']&&_0x5030b9[_0xd630('0x30')]&&_0x5030b9[_0xd630('0x2c')]){_0x408023[_0x5030b9['Variable']['name'][_0xd630('0x2d')]()]&&(_0x4a0747['custom_fields'][_0x5030b9[_0xd630('0x30')]]=_0x408023[_0x5030b9[_0xd630('0x34')][_0xd630('0x35')][_0xd630('0x2d')]()]['toString']());}});}if(_0x4a0747['priority']){_0x4a0747[_0xd630('0x36')]=Number(_0x4a0747[_0xd630('0x36')]);}return _0x4a0747;}function getTicket(_0x40715f,_0x405a24,_0x57a188,_0x944d57,_0x5b6e77){logger['info'](_0xd630('0x37'));var _0x36b071=_['merge']({'subject':intUtil[_0xd630('0x38')](_0x944d57[_0xd630('0x39')],_0x5b6e77,'\x20'),'type':_0xd630('0x3a'),'status':'new','labels':[_0xd630('0x3b'),_0xd630('0x3c'),'CTI']['concat'](getTags(_0x944d57[_0xd630('0x3d')],_0xd630('0x35'))),'description':intUtil[_0xd630('0x38')](_0x944d57[_0xd630('0x3e')],_0x5b6e77,'\x0a'),'_links':{'assigned_user':{'href':util[_0xd630('0x15')](_0xd630('0x3f'),_0x405a24['id']),'class':_0xd630('0x40')}},'message':{'direction':'in','body':intUtil[_0xd630('0x38')](_0x944d57[_0xd630('0x3e')],_0x5b6e77,'\x0a')}},getCustomFields(_0x944d57[_0xd630('0x41')],_0x5b6e77));return request({'uri':util['format'](_0xd630('0x42'),_0x40715f[_0xd630('0x17')],_0x57a188['id']),'method':'POST','body':_0x36b071});}exports[_0xd630('0x43')]=function(_0x5cd020,_0x56150e,_0x28a625,_0x42b973,_0x1f5fc6,_0x33d6a0){var _0x4dd539,_0x1e0d6a;_0x33d6a0['remoteUri']=intUtil[_0xd630('0x44')](_0x33d6a0['remoteUri']);_0x33d6a0[_0xd630('0x45')]=intUtil['stripTrailingSlash'](_0x33d6a0[_0xd630('0x45')]);if(_0x1f5fc6&&_0x1f5fc6[_0xd630('0x46')]){logger[_0xd630('0xc')](_0xd630('0x47'),'Recording\x20is\x20enabled!');_0x56150e[_0xd630('0x48')]=util[_0xd630('0x15')](_0xd630('0x49'),_0x33d6a0['serverUrl'],_0x56150e[_0xd630('0x4a')],md5(_0x56150e[_0xd630('0x4a')]));}else{_0x56150e[_0xd630('0x48')]='';}headers[_0xd630('0x4b')]=getAuth(_0x33d6a0);return getUser(_0x33d6a0,_0x42b973['email'])['then'](function(_0x18deda){_0x4dd539=_0x18deda;logger['info']('The\x20User\x20ID\x20is:',_0x4dd539['id']);return getEndUser(_0x33d6a0,_0x56150e[_0xd630('0x4c')],_0x56150e[_0xd630('0x4d')]);})[_0xd630('0x12')](function(_0x1b7336){_0x1e0d6a=_0x1b7336;logger[_0xd630('0xc')](_0xd630('0x4e'),_0x1e0d6a['id']);return getTicket(_0x33d6a0,_0x4dd539,_0x1e0d6a,_0x28a625,_0x56150e);})[_0xd630('0x12')](function(_0xe4081c){if(_0xe4081c){logger['info'](_0xd630('0x4f'));logger[_0xd630('0xc')](_0xd630('0x50'),_0xe4081c['id']);switch(_0x33d6a0[_0xd630('0x29')]){case'integrationTab':logger['info'](_0xd630('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xd630('0x15')](_0xd630('0x51'),_0x42b973[_0xd630('0x35')]),_0xd630('0x52'),{'recordId':_0xe4081c['id']});break;case'newTab':logger['info']('[QUEUE]',_0xd630('0x53'));emit(util[_0xd630('0x15')](_0xd630('0x51'),_0x42b973[_0xd630('0x35')]),_0xd630('0x54'),{'uri':util['format'](_0xd630('0x55'),_0xe4081c['id'])});break;default:logger[_0xd630('0x56')](_0xd630('0x47'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xd630('0x57')](function(_0x14c0a2){console[_0xd630('0x56')](_0x14c0a2);logger[_0xd630('0x56')](_0xd630('0x47'),JSON[_0xd630('0x58')](_0x14c0a2));});};exports[_0xd630('0x59')]=function(_0x5089d7,_0x5d9bf5,_0x2d25c5,_0x4626c9,_0x181eee,_0x4be5a7,_0x45c3fa){var _0x119431,_0x25a0ac;_0x4be5a7[_0xd630('0x17')]=intUtil[_0xd630('0x44')](_0x4be5a7[_0xd630('0x17')]);_0x4be5a7[_0xd630('0x45')]=intUtil['stripTrailingSlash'](_0x4be5a7['serverUrl']);if(_0x45c3fa&&_0x45c3fa[_0xd630('0x5a')]&&_0x45c3fa[_0xd630('0x5a')]!==_0xd630('0x5b')){logger[_0xd630('0xc')]('[OUTBOUND]',_0xd630('0x5c'));_0x5d9bf5[_0xd630('0x48')]=util[_0xd630('0x15')](_0xd630('0x49'),_0x4be5a7['serverUrl'],_0x5d9bf5[_0xd630('0x4a')],md5(_0x5d9bf5['uniqueid']));}headers[_0xd630('0x4b')]=getAuth(_0x4be5a7);return getUser(_0x4be5a7,_0x4626c9[_0xd630('0x5d')])[_0xd630('0x12')](function(_0x213963){_0x119431=_0x213963;logger[_0xd630('0xc')]('The\x20User\x20ID\x20is:',_0x119431['id']);return getEndUser(_0x4be5a7,_0x5d9bf5[_0xd630('0x5e')],_0x5d9bf5[_0xd630('0x5f')]);})[_0xd630('0x12')](function(_0x4be4a9){_0x25a0ac=_0x4be4a9;logger['info'](_0xd630('0x4e'),_0x25a0ac['id']);return getTicket(_0x4be5a7,_0x119431,_0x25a0ac,_0x2d25c5,_0x5d9bf5);})[_0xd630('0x12')](function(_0x2dd64c){if(_0x2dd64c){logger['info'](_0xd630('0x4f'));logger[_0xd630('0xc')](_0xd630('0x50'),_0x2dd64c['id']);switch(_0x4be5a7[_0xd630('0x29')]){case _0xd630('0x60'):logger[_0xd630('0xc')](_0xd630('0x47'),_0xd630('0x61'));emit(util[_0xd630('0x15')]('user:%s',_0x4626c9[_0xd630('0x35')]),'trigger:desk:display',{'recordId':_0x2dd64c['id']});break;case _0xd630('0x62'):logger['info']('[QUEUE]',_0xd630('0x53'));emit(util[_0xd630('0x15')]('user:%s',_0x4626c9[_0xd630('0x35')]),_0xd630('0x54'),{'uri':util[_0xd630('0x15')](_0xd630('0x63'),_0x4be5a7['remoteUri'],_0x2dd64c['id'])});break;default:logger[_0xd630('0x56')](_0xd630('0x64'),_0xd630('0x65'));}}})['catch'](function(_0x3a9a0b){logger[_0xd630('0x56')]('[OUTBOUND]',JSON[_0xd630('0x58')](_0x3a9a0b));});};exports['abandoned']=function(_0x4957b5,_0x4c5498,_0x26936d,_0x18111a,_0x193fb6,_0x14e9c5){var _0x2421cc,_0x7e9705;_0x14e9c5[_0xd630('0x17')]=intUtil[_0xd630('0x44')](_0x14e9c5['remoteUri']);_0x14e9c5[_0xd630('0x45')]=intUtil[_0xd630('0x44')](_0x14e9c5[_0xd630('0x45')]);if(_0x193fb6&&_0x193fb6[_0xd630('0x46')]){logger['info']('[ABANDONED]',_0xd630('0x5c'));_0x4c5498[_0xd630('0x48')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x14e9c5[_0xd630('0x45')],_0x4c5498['uniqueid'],md5(_0x4c5498[_0xd630('0x4a')]));}else{_0x4c5498[_0xd630('0x48')]='';}headers[_0xd630('0x4b')]=getAuth(_0x14e9c5);return getUser(_0x14e9c5)[_0xd630('0x12')](function(_0x38ddea){_0x2421cc=_0x38ddea;logger[_0xd630('0xc')]('The\x20User\x20ID\x20is:',_0x2421cc['id']);return getEndUser(_0x14e9c5,_0x4c5498[_0xd630('0x4c')],_0x4c5498[_0xd630('0x4d')]);})[_0xd630('0x12')](function(_0x595ac0){_0x7e9705=_0x595ac0;logger['info'](_0xd630('0x4e'),_0x7e9705['id']);return getTicket(_0x14e9c5,_0x2421cc,_0x7e9705,_0x26936d,_0x4c5498);})[_0xd630('0x12')](function(_0x2dbfd5){if(_0x2dbfd5){logger['info'](_0xd630('0x4f'));logger[_0xd630('0xc')](_0xd630('0x50'),_0x2dbfd5['id']);}})[_0xd630('0x57')](function(_0x3911f1){logger['error'](_0xd630('0x66'),JSON[_0xd630('0x58')](_0x3911f1));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 065f366..e5d8b1c 100644 --- a/server/services/ami/trigger/integration/dynamics365.js +++ b/server/services/ami/trigger/integration/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf40=['message','GET','systemusers?$select=internalemailaddress','Bearer\x20','validateEmail','userEmail','length','email','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','systemuserid','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','substring','lastIndexOf','enduserId','contacts?$select=telephone1','4.0','value','telephone1','contactid','forEach','type','customField','idField','indexOf','content','ticketType','incident','assign','getString','Descriptions','/contacts(','Fields','phonecall','Subjects','callDirection','queue','odata-entityid','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','abandoned','format','remoteUri','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','The\x20User\x20email\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Enduser\x20phone\x20is:','The\x20%s\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','toUpperCase',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','localhost','redis','POST','clientId','username','password','then','access_token','catch','error',']\x20Wrong\x20credentials!'];(function(_0x2a74a6,_0x10592f){var _0xc2e34a=function(_0x8497c9){while(--_0x8497c9){_0x2a74a6['push'](_0x2a74a6['shift']());}};_0xc2e34a(++_0x10592f);}(_0xbf40,0xad));var _0x0bf4=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xbf40[_0x87b0ff];return _0x3bc0b2;};'use strict';var _=require(_0x0bf4('0x0'));var BPromise=require(_0x0bf4('0x1'));var rp=require(_0x0bf4('0x2'));var util=require(_0x0bf4('0x3'));var intUtil=require(_0x0bf4('0x4'));var md5=require(_0x0bf4('0x5'));var Redis=require(_0x0bf4('0x6'));var logger=require(_0x0bf4('0x7'))(_0x0bf4('0x8'));var config=require(_0x0bf4('0x9'));config['redis']=_['defaults'](config['redis'],{'host':_0x0bf4('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0bf4('0xb')]));function getAuthToken(_0x4ac380,_0x464c5d,_0x285ddf){var _0x5261d6={'method':_0x0bf4('0xc'),'uri':_0x464c5d,'form':{'client_id':_0x4ac380[_0x0bf4('0xd')],'resource':_0x4ac380['remoteUri'],'username':_0x4ac380[_0x0bf4('0xe')],'password':_0x4ac380[_0x0bf4('0xf')],'grant_type':_0x0bf4('0xf'),'client_secret':_0x4ac380['clientSecret']},'json':!![]};return rp(_0x5261d6)[_0x0bf4('0x10')](function(_0x214d8d){return _0x214d8d[_0x0bf4('0x11')];})[_0x0bf4('0x12')](function(_0x1e20cb){logger[_0x0bf4('0x13')]('['+[_0x285ddf['toUpperCase']()]+_0x0bf4('0x14'));return _0x1e20cb[_0x0bf4('0x15')];});}function getUser(_0x44ef41,_0x52ffc8,_0x2254d6,_0x202842,_0x527b8b,_0x4ce691){return new BPromise(function(_0x377da7,_0xa5dbc8){return getAuthToken(_0x52ffc8,_0x202842,_0x4ce691)[_0x0bf4('0x10')](function(_0x371d50){var _0x217a4e={'method':_0x0bf4('0x16'),'uri':_0x527b8b+_0x0bf4('0x17'),'headers':{'Authorization':_0x0bf4('0x18')+_0x371d50,'OData-Version':'4.0'},'json':!![]};return rp(_0x217a4e);})[_0x0bf4('0x10')](function(_0x4a1bd4){var _0x332c10=_0x4a1bd4['value'];var _0x4869fc=![];var _0x485a4e=null;if(_0x2254d6&&intUtil[_0x0bf4('0x19')](_0x2254d6['email'])){_0x44ef41[_0x0bf4('0x1a')]=_0x2254d6['email'];for(_0x485a4e=0x0;_0x485a4e<_0x332c10[_0x0bf4('0x1b')];_0x485a4e++){if(_0x332c10[_0x485a4e]['internalemailaddress']===_0x2254d6[_0x0bf4('0x1c')]){_0x4869fc=!![];_0x44ef41[_0x0bf4('0x1d')]=_0x332c10[_0x485a4e]['systemuserid'];}}}if(!_0x4869fc){logger[_0x0bf4('0x1e')]('['+[_0x4ce691['toUpperCase']()]+_0x0bf4('0x1f'));_0x44ef41[_0x0bf4('0x1a')]=_0x52ffc8['username'];for(_0x485a4e=0x0;_0x485a4e<_0x332c10[_0x0bf4('0x1b')];_0x485a4e++){if(_0x332c10[_0x485a4e]['internalemailaddress']===_0x52ffc8[_0x0bf4('0xe')]){_0x44ef41[_0x0bf4('0x1d')]=_0x332c10[_0x485a4e][_0x0bf4('0x20')];}}}_0x377da7(_0x44ef41);})['catch'](function(_0x1d0b6d){_0xa5dbc8(_0x1d0b6d[_0x0bf4('0x15')]);});});}function createEndUser(_0x1e70c4,_0x3b43e0,_0xd7977,_0x3a753d,_0x125200,_0x1f1271){return new BPromise(function(_0x19044b,_0x33cdeb){return getAuthToken(_0x3b43e0,_0xd7977,_0x1f1271)[_0x0bf4('0x10')](function(_0x2af2e9){var _0x1f57be=_0x1f1271[_0x0bf4('0x21')]()===_0x0bf4('0x22')?_0x125200[_0x0bf4('0x23')]:_0x125200[_0x0bf4('0x24')];var _0x109de5={'method':_0x0bf4('0xc'),'uri':_0x3a753d+_0x0bf4('0x25'),'body':{'telephone1':_0x1f57be,'fullname':_0x1f57be,'firstname':_0x1f57be,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x0bf4('0x26')+_0x1e70c4[_0x0bf4('0x1d')]+')'},'headers':{'Authorization':_0x0bf4('0x18')+_0x2af2e9,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x109de5);})[_0x0bf4('0x10')](function(_0x5e2763){var _0x458ab0=_0x5e2763[_0x0bf4('0x27')]['odata-entityid'];var _0x2871bf=_0x458ab0[_0x0bf4('0x28')](_0x458ab0['lastIndexOf']('(')+0x1,_0x458ab0[_0x0bf4('0x29')](')'));_0x1e70c4[_0x0bf4('0x2a')]=_0x2871bf;_0x19044b(_0x1e70c4);})['catch'](function(_0x5b019a){_0x33cdeb(_0x5b019a[_0x0bf4('0x15')]);});});}function getEndUser(_0x3d93d4,_0x12bc4f,_0x477174,_0x45970d,_0x3925ef,_0x5ed247){return new BPromise(function(_0x254aa7,_0x381dc4){return getAuthToken(_0x12bc4f,_0x477174,_0x5ed247)[_0x0bf4('0x10')](function(_0x42c912){var _0x503448={'method':_0x0bf4('0x16'),'uri':_0x45970d+_0x0bf4('0x2b'),'headers':{'Authorization':_0x0bf4('0x18')+_0x42c912,'If-None-Match':null,'OData-Version':_0x0bf4('0x2c')},'json':!![]};return rp(_0x503448);})[_0x0bf4('0x10')](function(_0x2e0bc4){var _0x3a0f86=null;if(_0x2e0bc4){var _0x1170bd=_0x2e0bc4[_0x0bf4('0x2d')];var _0x340156=![];for(_0x3a0f86=0x0;_0x3a0f86<_0x1170bd[_0x0bf4('0x1b')];_0x3a0f86++){var _0xdcf85=_0x5ed247[_0x0bf4('0x21')]()===_0x0bf4('0x22')?_0x3925ef[_0x0bf4('0x23')]:_0x3925ef[_0x0bf4('0x24')];if(_0x1170bd[_0x3a0f86][_0x0bf4('0x2e')]===_0xdcf85){_0x340156=!![];_0x3d93d4[_0x0bf4('0x2a')]=_0x1170bd[_0x3a0f86][_0x0bf4('0x2f')];}}if(_0x340156){_0x254aa7(_0x3d93d4);}else{return createEndUser(_0x3d93d4,_0x12bc4f,_0x477174,_0x45970d,_0x3925ef,_0x5ed247)[_0x0bf4('0x10')](function(_0x5be3a4){_0x254aa7(_0x5be3a4);});}}else{return createEndUser(_0x3d93d4,_0x12bc4f,_0x477174,_0x45970d,_0x3925ef,_0x5ed247)[_0x0bf4('0x10')](function(_0x3dba1a){_0x254aa7(_0x3dba1a);});}});});}function getCustomFields(_0xfa4713,_0x379c9c,_0x1a8d65){var _0x7b9689={};if(_0xfa4713[_0x0bf4('0x1b')]>0x0){_[_0x0bf4('0x30')](_0xfa4713,function(_0x1c171f){if(_0x1c171f[_0x0bf4('0x31')]==='string'&&_0x1c171f['nameField']&&!_0x1c171f[_0x0bf4('0x32')]){var _0x1e562b=_0x1c171f[_0x0bf4('0x33')]['toLowerCase']();var _0x19568d=_0x1e562b['substring'](0x0,_0x1e562b[_0x0bf4('0x34')]('_'));var _0x3b528e=_0x1e562b[_0x0bf4('0x28')](_0x1e562b[_0x0bf4('0x34')]('_')+0x1);if(_0x19568d===_0x1a8d65){_0x7b9689[_0x3b528e]=_0x1c171f[_0x0bf4('0x35')];}}});}return _0x7b9689;}function getTicket(_0x1c02c2,_0x4eceb2,_0x25cee3,_0x92939,_0x279273,_0xd85f76,_0x24ef6c){return new BPromise(function(_0x473e2d,_0xf948d3){var _0x473430;return getAuthToken(_0x4eceb2,_0x25cee3,_0x24ef6c)[_0x0bf4('0x10')](function(_0x30af19){if(_0xd85f76[_0x0bf4('0x36')]===_0x0bf4('0x37')){_0x473430={'method':'POST','uri':_0x92939+'incidents','body':Object[_0x0bf4('0x38')]({},{'title':intUtil[_0x0bf4('0x39')](_0xd85f76['Subjects'],_0x279273,'\x20'),'description':intUtil[_0x0bf4('0x39')](_0xd85f76[_0x0bf4('0x3a')],_0x279273,'\x0a'),'customerid_contact@odata.bind':_0x0bf4('0x3b')+_0x1c02c2['enduserId']+')','ownerid@odata.bind':_0x0bf4('0x26')+_0x1c02c2['userId']+')','caseorigincode':'1'},getCustomFields(_0xd85f76[_0x0bf4('0x3c')],_0x279273,_0xd85f76[_0x0bf4('0x36')])),'headers':{'Authorization':'Bearer\x20'+_0x30af19,'OData-Version':_0x0bf4('0x2c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0xd85f76[_0x0bf4('0x36')]===_0x0bf4('0x3d')){_0x473430={'method':_0x0bf4('0xc'),'uri':_0x92939+'phonecalls','body':Object[_0x0bf4('0x38')]({},{'subject':intUtil[_0x0bf4('0x39')](_0xd85f76[_0x0bf4('0x3e')],_0x279273,'\x20'),'phonenumber':String(_0x279273[_0x0bf4('0x24')]),'description':intUtil['getString'](_0xd85f76[_0x0bf4('0x3a')],_0x279273,'\x0a'),'regardingobjectid_contact@odata.bind':_0x0bf4('0x3b')+_0x1c02c2[_0x0bf4('0x2a')]+')','ownerid@odata.bind':_0x0bf4('0x26')+_0x1c02c2[_0x0bf4('0x1d')]+')','directioncode':_0x1c02c2[_0x0bf4('0x3f')]===_0x0bf4('0x40')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x0bf4('0x26')+_0x1c02c2[_0x0bf4('0x1d')]+')','participationtypemask':_0x1c02c2[_0x0bf4('0x3f')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x1c02c2['enduserId']+')','participationtypemask':_0x1c02c2[_0x0bf4('0x3f')]===_0x0bf4('0x40')?0x1:0x2}]},getCustomFields(_0xd85f76[_0x0bf4('0x3c')],_0x279273,_0xd85f76['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x30af19,'OData-Version':_0x0bf4('0x2c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x473430);})[_0x0bf4('0x10')](function(_0x8b3f77){var _0x4e6425=_0x8b3f77[_0x0bf4('0x27')][_0x0bf4('0x41')];var _0x1d0902=_0x4e6425[_0x0bf4('0x28')](_0x4e6425['lastIndexOf']('(')+0x1,_0x4e6425['lastIndexOf'](')'));_0x1c02c2[_0x0bf4('0x42')]=_0x1d0902;_0x473e2d(_0x1c02c2);})[_0x0bf4('0x12')](function(_0x3421e8){_0xf948d3(_0x3421e8[_0x0bf4('0x15')]);});});}function emit(_0x1aa2d9,_0x26fbf4,_0x57f7c3,_0x2a944a){var _0x3143e7={'uri':util['format'](_0x0bf4('0x43'),_0x1aa2d9,_0x57f7c3,_0x2a944a)};io['to'](util['format'](_0x0bf4('0x44'),_0x26fbf4))[_0x0bf4('0x45')](_0x0bf4('0x46'),_0x3143e7);}exports['cs']=function(_0x40d0a2,_0x431ab8,_0x1ab75d,_0xf65b8e,_0x23a9e7,_0x5823a2,_0xb5e5ef,_0xf1fde9){var _0x166e1e={};_0x5823a2['remoteUri']=intUtil[_0x0bf4('0x47')](_0x5823a2['remoteUri']);_0x5823a2[_0x0bf4('0x48')]=intUtil[_0x0bf4('0x47')](_0x5823a2[_0x0bf4('0x48')]);_0x166e1e[_0x0bf4('0x3f')]=_0xf1fde9===_0x0bf4('0x40')||_0xf1fde9===_0x0bf4('0x49')?_0x0bf4('0x40'):_0x0bf4('0x22');var _0x424f79=util[_0x0bf4('0x4a')]('%s/api/data/v9.0/',_0x5823a2[_0x0bf4('0x4b')]);var _0x2e9e40=util['format'](_0x0bf4('0x4c'),_0x5823a2['tenantId']);var _0x1eaedc=util['format'](_0x0bf4('0x4d'),_0x5823a2[_0x0bf4('0x48')],_0x431ab8['uniqueid'],md5(_0x431ab8[_0x0bf4('0x4e')]));if(_0x23a9e7&&_0x23a9e7[_0x0bf4('0x4f')]){logger[_0x0bf4('0x1e')](_0x0bf4('0x50'),'Recording\x20is\x20enabled!');_0x431ab8[_0x0bf4('0x51')]=_0x1eaedc;}else if(_0xb5e5ef&&_0xb5e5ef[_0x0bf4('0x52')]&&_0xb5e5ef['recordingFormat']!==_0x0bf4('0x53')){logger[_0x0bf4('0x1e')](_0x0bf4('0x54'),_0x0bf4('0x55'));_0x431ab8[_0x0bf4('0x51')]=_0x1eaedc;}else{_0x431ab8[_0x0bf4('0x51')]='';}return getUser(_0x166e1e,_0x5823a2,_0xf65b8e,_0x2e9e40,_0x424f79,_0xf1fde9)['then'](function(_0x144f35){logger['info'](_0x0bf4('0x56'),_0x144f35['userId']);logger[_0x0bf4('0x1e')](_0x0bf4('0x57'),_0x144f35[_0x0bf4('0x1a')]);return getEndUser(_0x144f35,_0x5823a2,_0x2e9e40,_0x424f79,_0x431ab8,_0xf1fde9);})[_0x0bf4('0x10')](function(_0x5138df){logger[_0x0bf4('0x1e')](_0x0bf4('0x58'),_0x5138df[_0x0bf4('0x2a')]);logger[_0x0bf4('0x1e')](_0x0bf4('0x59'),_0x431ab8[_0x0bf4('0x24')]);return getTicket(_0x5138df,_0x5823a2,_0x2e9e40,_0x424f79,_0x431ab8,_0x1ab75d,_0xf1fde9);})[_0x0bf4('0x10')](function(_0x4e6d75){logger[_0x0bf4('0x1e')](util[_0x0bf4('0x4a')](_0x0bf4('0x5a'),_0x1ab75d['ticketType'],_0x4e6d75[_0x0bf4('0x42')]));logger[_0x0bf4('0x1e')](util[_0x0bf4('0x4a')](_0x0bf4('0x5b'),_0xf1fde9));if(_0xf1fde9!==_0x0bf4('0x49')){logger[_0x0bf4('0x1e')]('['+_0xf1fde9['toUpperCase']()+']',_0x0bf4('0x5c'));emit(_0x5823a2[_0x0bf4('0x4b')],_0xf65b8e[_0x0bf4('0x5d')],_0x1ab75d['ticketType'],_0x4e6d75['ticketId']);}})[_0x0bf4('0x12')](function(_0x2d8c23){logger['error']('['+_0xf1fde9[_0x0bf4('0x5e')]()+_0x0bf4('0x5f'),util[_0x0bf4('0x60')](_0x2d8c23,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3c3c=['uniqueid','monitor_format','info','[QUEUE]','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20User\x20ID\x20is:','The\x20User\x20email\x20is:','The\x20Enduser\x20phone\x20is:','call\x20direction:\x20%s','abandoned','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','util','./util','md5','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','clientId','remoteUri','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress','Bearer\x20','4.0','validateEmail','email','userEmail','length','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','message','toLowerCase','outbound','destcalleridnum','POST','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','telephone1','forEach','string','nameField','customField','indexOf','ticketType','incident','incidents','Subjects','Descriptions','Fields','phonecall','phonecalls','/contacts(','callDirection','queue','ticketId','format','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x4bbeb7,_0x58a8ae){var _0xd4c1cb=function(_0x349f51){while(--_0x349f51){_0x4bbeb7['push'](_0x4bbeb7['shift']());}};_0xd4c1cb(++_0x58a8ae);}(_0x3c3c,0x1c3));var _0xc3c3=function(_0x30cd01,_0x223ce7){_0x30cd01=_0x30cd01-0x0;var _0x2bfa05=_0x3c3c[_0x30cd01];return _0x2bfa05;};'use strict';var _=require('lodash');var BPromise=require(_0xc3c3('0x0'));var rp=require('request-promise');var util=require(_0xc3c3('0x1'));var intUtil=require(_0xc3c3('0x2'));var md5=require(_0xc3c3('0x3'));var Redis=require('ioredis');var logger=require(_0xc3c3('0x4'))(_0xc3c3('0x5'));var config=require(_0xc3c3('0x6'));config[_0xc3c3('0x7')]=_[_0xc3c3('0x8')](config[_0xc3c3('0x7')],{'host':_0xc3c3('0x9'),'port':0x18eb});var io=require(_0xc3c3('0xa'))(new Redis(config[_0xc3c3('0x7')]));function getAuthToken(_0x5e6bb1,_0x2b5cf8,_0x323cf4){var _0x13b7c1={'method':'POST','uri':_0x2b5cf8,'form':{'client_id':_0x5e6bb1[_0xc3c3('0xb')],'resource':_0x5e6bb1[_0xc3c3('0xc')],'username':_0x5e6bb1['username'],'password':_0x5e6bb1[_0xc3c3('0xd')],'grant_type':_0xc3c3('0xd'),'client_secret':_0x5e6bb1[_0xc3c3('0xe')]},'json':!![]};return rp(_0x13b7c1)[_0xc3c3('0xf')](function(_0x3ea443){return _0x3ea443[_0xc3c3('0x10')];})[_0xc3c3('0x11')](function(_0xaf3e4a){logger[_0xc3c3('0x12')]('['+[_0x323cf4[_0xc3c3('0x13')]()]+_0xc3c3('0x14'));return _0xaf3e4a['message'];});}function getUser(_0x5e5480,_0x129191,_0x374e80,_0xfa5af5,_0x3d9645,_0x348c65){return new BPromise(function(_0x49f620,_0x878522){return getAuthToken(_0x129191,_0xfa5af5,_0x348c65)[_0xc3c3('0xf')](function(_0x2c83a4){var _0x3e678f={'method':_0xc3c3('0x15'),'uri':_0x3d9645+_0xc3c3('0x16'),'headers':{'Authorization':_0xc3c3('0x17')+_0x2c83a4,'OData-Version':_0xc3c3('0x18')},'json':!![]};return rp(_0x3e678f);})['then'](function(_0x93d66){var _0x383d6a=_0x93d66['value'];var _0x4fb306=![];var _0x40bdf6=null;if(_0x374e80&&intUtil[_0xc3c3('0x19')](_0x374e80[_0xc3c3('0x1a')])){_0x5e5480[_0xc3c3('0x1b')]=_0x374e80[_0xc3c3('0x1a')];for(_0x40bdf6=0x0;_0x40bdf6<_0x383d6a[_0xc3c3('0x1c')];_0x40bdf6++){if(_0x383d6a[_0x40bdf6]['internalemailaddress']===_0x374e80[_0xc3c3('0x1a')]){_0x4fb306=!![];_0x5e5480[_0xc3c3('0x1d')]=_0x383d6a[_0x40bdf6]['systemuserid'];}}}if(!_0x4fb306){logger['info']('['+[_0x348c65[_0xc3c3('0x13')]()]+_0xc3c3('0x1e'));_0x5e5480[_0xc3c3('0x1b')]=_0x129191[_0xc3c3('0x1f')];for(_0x40bdf6=0x0;_0x40bdf6<_0x383d6a[_0xc3c3('0x1c')];_0x40bdf6++){if(_0x383d6a[_0x40bdf6]['internalemailaddress']===_0x129191[_0xc3c3('0x1f')]){_0x5e5480[_0xc3c3('0x1d')]=_0x383d6a[_0x40bdf6]['systemuserid'];}}}_0x49f620(_0x5e5480);})[_0xc3c3('0x11')](function(_0x1f3e8a){_0x878522(_0x1f3e8a[_0xc3c3('0x20')]);});});}function createEndUser(_0x2d346e,_0x18e90e,_0x5b4282,_0x22a42f,_0x21b2d1,_0x519489){return new BPromise(function(_0x62a439,_0x1d3c49){return getAuthToken(_0x18e90e,_0x5b4282,_0x519489)['then'](function(_0x260350){var _0x27934c=_0x519489[_0xc3c3('0x21')]()===_0xc3c3('0x22')?_0x21b2d1[_0xc3c3('0x23')]:_0x21b2d1['calleridnum'];var _0x20ebec={'method':_0xc3c3('0x24'),'uri':_0x22a42f+_0xc3c3('0x25'),'body':{'telephone1':_0x27934c,'fullname':_0x27934c,'firstname':_0x27934c,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xc3c3('0x26')+_0x2d346e[_0xc3c3('0x1d')]+')'},'headers':{'Authorization':_0xc3c3('0x17')+_0x260350,'OData-Version':_0xc3c3('0x18')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x20ebec);})[_0xc3c3('0xf')](function(_0x18c3c5){var _0x28b287=_0x18c3c5[_0xc3c3('0x27')][_0xc3c3('0x28')];var _0x37676f=_0x28b287[_0xc3c3('0x29')](_0x28b287[_0xc3c3('0x2a')]('(')+0x1,_0x28b287[_0xc3c3('0x2a')](')'));_0x2d346e[_0xc3c3('0x2b')]=_0x37676f;_0x62a439(_0x2d346e);})[_0xc3c3('0x11')](function(_0x1e3772){_0x1d3c49(_0x1e3772[_0xc3c3('0x20')]);});});}function getEndUser(_0x571e2e,_0x3cbcc0,_0x1b5677,_0x3efdf6,_0x33e9d7,_0x182936){return new BPromise(function(_0x24d0a9,_0x2f3921){return getAuthToken(_0x3cbcc0,_0x1b5677,_0x182936)[_0xc3c3('0xf')](function(_0x1d4c13){var _0x5f2a13={'method':_0xc3c3('0x15'),'uri':_0x3efdf6+'contacts?$select=telephone1','headers':{'Authorization':'Bearer\x20'+_0x1d4c13,'If-None-Match':null,'OData-Version':_0xc3c3('0x18')},'json':!![]};return rp(_0x5f2a13);})[_0xc3c3('0xf')](function(_0x265817){var _0x248bcc=null;if(_0x265817){var _0x5ab1de=_0x265817['value'];var _0xf0ee79=![];for(_0x248bcc=0x0;_0x248bcc<_0x5ab1de[_0xc3c3('0x1c')];_0x248bcc++){var _0x46437b=_0x182936[_0xc3c3('0x21')]()===_0xc3c3('0x22')?_0x33e9d7[_0xc3c3('0x23')]:_0x33e9d7['calleridnum'];if(_0x5ab1de[_0x248bcc][_0xc3c3('0x2c')]===_0x46437b){_0xf0ee79=!![];_0x571e2e[_0xc3c3('0x2b')]=_0x5ab1de[_0x248bcc]['contactid'];}}if(_0xf0ee79){_0x24d0a9(_0x571e2e);}else{return createEndUser(_0x571e2e,_0x3cbcc0,_0x1b5677,_0x3efdf6,_0x33e9d7,_0x182936)[_0xc3c3('0xf')](function(_0x415a68){_0x24d0a9(_0x415a68);});}}else{return createEndUser(_0x571e2e,_0x3cbcc0,_0x1b5677,_0x3efdf6,_0x33e9d7,_0x182936)[_0xc3c3('0xf')](function(_0x1a6a0c){_0x24d0a9(_0x1a6a0c);});}});});}function getCustomFields(_0x108f7e,_0x50a537,_0x323e4a){var _0x8a37ab={};if(_0x108f7e[_0xc3c3('0x1c')]>0x0){_[_0xc3c3('0x2d')](_0x108f7e,function(_0x260dfb){if(_0x260dfb['type']===_0xc3c3('0x2e')&&_0x260dfb[_0xc3c3('0x2f')]&&!_0x260dfb[_0xc3c3('0x30')]){var _0x32b274=_0x260dfb['idField'][_0xc3c3('0x21')]();var _0x58e451=_0x32b274[_0xc3c3('0x29')](0x0,_0x32b274[_0xc3c3('0x31')]('_'));var _0x4eb1ed=_0x32b274[_0xc3c3('0x29')](_0x32b274['indexOf']('_')+0x1);if(_0x58e451===_0x323e4a){_0x8a37ab[_0x4eb1ed]=_0x260dfb['content'];}}});}return _0x8a37ab;}function getTicket(_0x48a853,_0x70d66,_0x30dbdb,_0x275b53,_0x42bf46,_0x7ea936,_0x36737b){return new BPromise(function(_0x56a0cc,_0x5ae343){var _0x2bf55a;return getAuthToken(_0x70d66,_0x30dbdb,_0x36737b)[_0xc3c3('0xf')](function(_0x511d71){if(_0x7ea936[_0xc3c3('0x32')]===_0xc3c3('0x33')){_0x2bf55a={'method':_0xc3c3('0x24'),'uri':_0x275b53+_0xc3c3('0x34'),'body':Object['assign']({},{'title':intUtil['getString'](_0x7ea936[_0xc3c3('0x35')],_0x42bf46,'\x20'),'description':intUtil['getString'](_0x7ea936[_0xc3c3('0x36')],_0x42bf46,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x48a853['enduserId']+')','ownerid@odata.bind':_0xc3c3('0x26')+_0x48a853[_0xc3c3('0x1d')]+')','caseorigincode':'1'},getCustomFields(_0x7ea936[_0xc3c3('0x37')],_0x42bf46,_0x7ea936[_0xc3c3('0x32')])),'headers':{'Authorization':_0xc3c3('0x17')+_0x511d71,'OData-Version':_0xc3c3('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x7ea936[_0xc3c3('0x32')]===_0xc3c3('0x38')){_0x2bf55a={'method':'POST','uri':_0x275b53+_0xc3c3('0x39'),'body':Object['assign']({},{'subject':intUtil['getString'](_0x7ea936[_0xc3c3('0x35')],_0x42bf46,'\x20'),'phonenumber':String(_0x42bf46['calleridnum']),'description':intUtil['getString'](_0x7ea936[_0xc3c3('0x36')],_0x42bf46,'\x0a'),'regardingobjectid_contact@odata.bind':_0xc3c3('0x3a')+_0x48a853[_0xc3c3('0x2b')]+')','ownerid@odata.bind':'/systemusers('+_0x48a853[_0xc3c3('0x1d')]+')','directioncode':_0x48a853[_0xc3c3('0x3b')]===_0xc3c3('0x3c')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x48a853[_0xc3c3('0x1d')]+')','participationtypemask':_0x48a853[_0xc3c3('0x3b')]===_0xc3c3('0x3c')?0x2:0x1},{'partyid_contact@odata.bind':_0xc3c3('0x3a')+_0x48a853[_0xc3c3('0x2b')]+')','participationtypemask':_0x48a853[_0xc3c3('0x3b')]===_0xc3c3('0x3c')?0x1:0x2}]},getCustomFields(_0x7ea936[_0xc3c3('0x37')],_0x42bf46,_0x7ea936[_0xc3c3('0x32')])),'headers':{'Authorization':_0xc3c3('0x17')+_0x511d71,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2bf55a);})[_0xc3c3('0xf')](function(_0x40ab68){var _0x2b80aa=_0x40ab68[_0xc3c3('0x27')][_0xc3c3('0x28')];var _0x25eded=_0x2b80aa[_0xc3c3('0x29')](_0x2b80aa[_0xc3c3('0x2a')]('(')+0x1,_0x2b80aa[_0xc3c3('0x2a')](')'));_0x48a853[_0xc3c3('0x3d')]=_0x25eded;_0x56a0cc(_0x48a853);})[_0xc3c3('0x11')](function(_0x32d9b9){_0x5ae343(_0x32d9b9[_0xc3c3('0x20')]);});});}function emit(_0xe93ecb,_0x4c7104,_0x40b196,_0x237392){var _0x25dcda={'uri':util[_0xc3c3('0x3e')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0xe93ecb,_0x40b196,_0x237392)};io['to'](util[_0xc3c3('0x3e')](_0xc3c3('0x3f'),_0x4c7104))['emit'](_0xc3c3('0x40'),_0x25dcda);}exports['cs']=function(_0x21fb4e,_0x24ca1a,_0x1be514,_0x2354e2,_0x9735a5,_0x551390,_0x4ee61d,_0x274754){var _0x56da7c={};_0x551390[_0xc3c3('0xc')]=intUtil[_0xc3c3('0x41')](_0x551390[_0xc3c3('0xc')]);_0x551390['serverUrl']=intUtil[_0xc3c3('0x41')](_0x551390[_0xc3c3('0x42')]);_0x56da7c['callDirection']=_0x274754==='queue'||_0x274754==='abandoned'?_0xc3c3('0x3c'):_0xc3c3('0x22');var _0x22baad=util[_0xc3c3('0x3e')](_0xc3c3('0x43'),_0x551390[_0xc3c3('0xc')]);var _0x4ac848=util[_0xc3c3('0x3e')](_0xc3c3('0x44'),_0x551390[_0xc3c3('0x45')]);var _0x35bce6=util[_0xc3c3('0x3e')](_0xc3c3('0x46'),_0x551390[_0xc3c3('0x42')],_0x24ca1a['uniqueid'],md5(_0x24ca1a[_0xc3c3('0x47')]));if(_0x9735a5&&_0x9735a5[_0xc3c3('0x48')]){logger[_0xc3c3('0x49')](_0xc3c3('0x4a'),'Recording\x20is\x20enabled!');_0x24ca1a['recordingURL']=_0x35bce6;}else if(_0x4ee61d&&_0x4ee61d['recordingFormat']&&_0x4ee61d[_0xc3c3('0x4b')]!==_0xc3c3('0x4c')){logger['info'](_0xc3c3('0x4d'),'Recording\x20is\x20enabled!');_0x24ca1a[_0xc3c3('0x4e')]=_0x35bce6;}else{_0x24ca1a[_0xc3c3('0x4e')]='';}return getUser(_0x56da7c,_0x551390,_0x2354e2,_0x4ac848,_0x22baad,_0x274754)[_0xc3c3('0xf')](function(_0x224c1c){logger[_0xc3c3('0x49')](_0xc3c3('0x4f'),_0x224c1c[_0xc3c3('0x1d')]);logger['info'](_0xc3c3('0x50'),_0x224c1c[_0xc3c3('0x1b')]);return getEndUser(_0x224c1c,_0x551390,_0x4ac848,_0x22baad,_0x24ca1a,_0x274754);})[_0xc3c3('0xf')](function(_0x4696f7){logger[_0xc3c3('0x49')]('The\x20Enduser\x20ID\x20is:',_0x4696f7['enduserId']);logger[_0xc3c3('0x49')](_0xc3c3('0x51'),_0x24ca1a['calleridnum']);return getTicket(_0x4696f7,_0x551390,_0x4ac848,_0x22baad,_0x24ca1a,_0x1be514,_0x274754);})['then'](function(_0x276039){logger[_0xc3c3('0x49')](util[_0xc3c3('0x3e')]('The\x20%s\x20ID\x20is:\x20%s',_0x1be514['ticketType'],_0x276039[_0xc3c3('0x3d')]));logger['info'](util['format'](_0xc3c3('0x52'),_0x274754));if(_0x274754!==_0xc3c3('0x53')){logger[_0xc3c3('0x49')]('['+_0x274754[_0xc3c3('0x13')]()+']',_0xc3c3('0x54'));emit(_0x551390['remoteUri'],_0x2354e2['name'],_0x1be514['ticketType'],_0x276039[_0xc3c3('0x3d')]);}})[_0xc3c3('0x11')](function(_0x1889d3){logger[_0xc3c3('0x12')]('['+_0x274754[_0xc3c3('0x13')]()+_0xc3c3('0x55'),util[_0xc3c3('0x56')](_0x1889d3,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index f2df514..2fb5391 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 _0x2227=['Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','toString','debug','[HTTP]','stringify','map','forEach','type','nameField','toLowerCase','content','string','customField','idField','variable','variableName','push','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','abandoned','[ABANDONED]','Authorization','error','lodash','request-promise','util','ioredis','../../../../config/logger','redis','defaults','socket.io-emitter','application/json','info','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','Descriptions','
','Tags','Fields','custom_fields','mapValues','keyBy','value','format','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','then','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!'];(function(_0x151334,_0x1e11ac){var _0x3d03da=function(_0x2099cf){while(--_0x2099cf){_0x151334['push'](_0x151334['shift']());}};_0x3d03da(++_0x1e11ac);}(_0x2227,0x140));var _0x7222=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x2227[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0x7222('0x0'));var rp=require(_0x7222('0x1'));var md5=require('md5');var util=require(_0x7222('0x2'));var Redis=require(_0x7222('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x7222('0x4'))('freshdesk');config[_0x7222('0x5')]=_[_0x7222('0x6')](config[_0x7222('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x7222('0x7'))(new Redis(config[_0x7222('0x5')]));var headers={'Content-Type':_0x7222('0x8'),'Accept':_0x7222('0x8')};function emit(_0x163e84,_0x448280,_0x97816a){io['to'](_0x163e84)['emit'](_0x448280,_0x97816a);}function getTicket(_0x575475,_0x40a1c7,_0x404e94,_0x4abe54,_0x416a05){logger[_0x7222('0x9')]('Creating\x20new\x20ticket...');var _0x189358=_['merge']({'responder_id':_0x40a1c7['id'],'requester_id':_0x404e94['id'],'name':util['format'](_0x7222('0xa'),_0x416a05[_0x7222('0xb')]),'phone':_0x416a05[_0x7222('0xc')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x4abe54[_0x7222('0xd')],_0x416a05,'\x20'),'description':intUtil[_0x7222('0xe')](_0x4abe54[_0x7222('0xf')],_0x416a05,_0x7222('0x10')),'tags':getTags(_0x4abe54[_0x7222('0x11')],'name')},getCustomFields(_0x4abe54[_0x7222('0x12')],_0x416a05));_0x189358[_0x7222('0x13')]=_[_0x7222('0x14')](_[_0x7222('0x15')](_0x189358[_0x7222('0x13')],'id'),_0x7222('0x16'));return request({'uri':util[_0x7222('0x17')]('%s/api/v2/tickets',_0x575475['remoteUri']),'method':'POST','body':_0x189358})['then'](function(_0x733882){logger[_0x7222('0x9')](_0x7222('0x18'));return _0x733882;});}function getUser(_0x1b4675,_0x392db1){if(intUtil[_0x7222('0x19')](_0x392db1)){return request({'uri':util[_0x7222('0x17')](_0x7222('0x1a'),_0x1b4675[_0x7222('0x1b')]),'qs':{'email':_0x392db1}})['then'](function(_0x98852a){if(_0x98852a['length']){logger[_0x7222('0x9')]('Agent\x20found!');return _[_0x7222('0x1c')](_0x98852a,function(_0x191edc){return _0x191edc[_0x7222('0x1d')][_0x7222('0x1e')]===_0x392db1;});}else{logger[_0x7222('0x9')](_0x7222('0x1f'));return request({'uri':util[_0x7222('0x17')](_0x7222('0x20'),_0x1b4675[_0x7222('0x1b')])})[_0x7222('0x21')](function(_0x392943){logger['info'](_0x7222('0x22'));return _0x392943;});}});}else{logger[_0x7222('0x9')](_0x7222('0x23'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x1b4675[_0x7222('0x1b')])})[_0x7222('0x21')](function(_0x890796){logger[_0x7222('0x9')](_0x7222('0x22'));return _0x890796;});}}function getEndUser(_0x464644,_0x3eb102,_0x40a48a){logger[_0x7222('0x9')](_0x7222('0x24'),_0x40a48a);return request({'uri':util[_0x7222('0x17')](_0x7222('0x25'),_0x464644[_0x7222('0x1b')]),'qs':{'phone':_0x40a48a}})['then'](function(_0x39aacf){if(_0x39aacf[_0x7222('0x26')]){logger[_0x7222('0x9')](_0x7222('0x27'));return _[_0x7222('0x1c')](_0x39aacf,{'phone':_0x40a48a});}else{logger[_0x7222('0x9')](_0x7222('0x28'));return request({'uri':util['format'](_0x7222('0x25'),_0x464644['remoteUri']),'method':_0x7222('0x29'),'body':{'name':_0x3eb102,'phone':_0x40a48a}})[_0x7222('0x21')](function(_0x589499){logger['info'](_0x7222('0x2a'));return _0x589499;});}});}function getAuth(_0x3e2374){return util[_0x7222('0x17')](_0x7222('0x2b'),new Buffer(_0x3e2374['apiKey']+':X')[_0x7222('0x2c')]('base64'));}function request(_0x26a465){logger[_0x7222('0x2d')](_0x7222('0x2e'),JSON[_0x7222('0x2f')](_0x26a465));return rp(_['defaults'](_0x26a465,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x3a8612,_0x191e1f){var _0x5a9859=[];if(_0x3a8612&&_0x3a8612[_0x7222('0x26')]>0x0){_0x5a9859=_[_0x7222('0x30')](_0x3a8612,_0x191e1f);}return _0x5a9859;}function getCustomFields(_0x2b4e53,_0x1b9181){var _0x7427f=[];var _0x3a5f16={'custom_fields':[]};if(_0x2b4e53[_0x7222('0x26')]>0x0){_[_0x7222('0x31')](_0x2b4e53,function(_0x29548f){if(_0x29548f[_0x7222('0x32')]==='string'&&_0x29548f[_0x7222('0x33')]&&!_0x29548f['customField']){_0x3a5f16[_0x29548f['nameField'][_0x7222('0x34')]()]=_0x29548f[_0x7222('0x35')][_0x7222('0x2c')]();}else if(_0x29548f[_0x7222('0x32')]===_0x7222('0x36')&&_0x29548f['idField']&&_0x29548f[_0x7222('0x37')]){_0x3a5f16[_0x7222('0x13')]['push']({'id':_0x29548f[_0x7222('0x38')],'value':_0x29548f[_0x7222('0x35')][_0x7222('0x2c')]()});}else if(_0x29548f['type']===_0x7222('0x39')&&_0x29548f[_0x7222('0x3a')]&&_0x29548f['idField']&&_0x29548f['customField']){_0x1b9181[_0x29548f[_0x7222('0x3a')]]&&_0x3a5f16[_0x7222('0x13')][_0x7222('0x3b')]({'id':_0x29548f['idField'],'value':_0x1b9181[_0x29548f['variableName']][_0x7222('0x2c')]()});}else if(_0x29548f[_0x7222('0x32')]===_0x7222('0x3c')&&_0x29548f[_0x7222('0x3d')]&&_0x29548f[_0x7222('0x3d')][_0x7222('0x3e')]&&_0x29548f[_0x7222('0x38')]&&_0x29548f[_0x7222('0x37')]){_0x1b9181[_0x29548f[_0x7222('0x3d')][_0x7222('0x3e')][_0x7222('0x34')]()]&&_0x3a5f16[_0x7222('0x13')][_0x7222('0x3b')]({'id':_0x29548f['idField'],'value':_0x1b9181[_0x29548f['Variable'][_0x7222('0x3e')][_0x7222('0x34')]()]['toString']()});}});}return _0x3a5f16;}exports[_0x7222('0x3f')]=function(_0x2967e6,_0x532e3a,_0x1e5cc7,_0x779ac0,_0x118732,_0x33931e){var _0xb4c1c1,_0x63f491;_0x33931e[_0x7222('0x1b')]=intUtil[_0x7222('0x40')](_0x33931e[_0x7222('0x1b')]);_0x33931e[_0x7222('0x41')]=intUtil['stripTrailingSlash'](_0x33931e[_0x7222('0x41')]);if(_0x118732&&_0x118732[_0x7222('0x42')]){logger['info']('[QUEUE]',_0x7222('0x43'));_0x532e3a[_0x7222('0x44')]=util['format'](_0x7222('0x45'),_0x33931e[_0x7222('0x41')],_0x532e3a['uniqueid'],md5(_0x532e3a[_0x7222('0x46')]));}else{_0x532e3a['recordingURL']='';}headers['Authorization']=getAuth(_0x33931e);return getUser(_0x33931e,_0x779ac0['email'])[_0x7222('0x21')](function(_0x3de891){_0xb4c1c1=_0x3de891;logger[_0x7222('0x9')]('The\x20User\x20ID\x20is:',_0xb4c1c1['id']);return getEndUser(_0x33931e,_0x532e3a[_0x7222('0xb')],_0x532e3a[_0x7222('0xc')]);})['then'](function(_0x395f44){_0x63f491=_0x395f44;logger[_0x7222('0x9')](_0x7222('0x47'),_0x63f491['id']);return getTicket(_0x33931e,_0xb4c1c1,_0x63f491,_0x1e5cc7,_0x532e3a);})[_0x7222('0x21')](function(_0x4374b5){if(_0x4374b5&&_0x4374b5['id']){logger[_0x7222('0x9')](_0x7222('0x18'));logger['info'](_0x7222('0x48'),_0x4374b5['id']);logger['info']('[QUEUE]',_0x7222('0x49'));emit(util[_0x7222('0x17')](_0x7222('0x4a'),_0x779ac0[_0x7222('0x3e')]),'trigger:browser:url',{'uri':util[_0x7222('0x17')](_0x7222('0x4b'),_0x33931e[_0x7222('0x1b')],_0x4374b5['id'])});}})[_0x7222('0x4c')](function(_0x49a663){logger['error'](_0x7222('0x4d'),JSON[_0x7222('0x2f')](_0x49a663));});};exports[_0x7222('0x4e')]=function(_0xfb0b7c,_0x36b2d7,_0x4ea99e,_0x5423fe,_0x46750c,_0xf20814,_0x2d0851){var _0x2fe048,_0x2af189;_0xf20814[_0x7222('0x1b')]=intUtil[_0x7222('0x40')](_0xf20814[_0x7222('0x1b')]);_0xf20814['serverUrl']=intUtil['stripTrailingSlash'](_0xf20814[_0x7222('0x41')]);if(_0x2d0851&&_0x2d0851[_0x7222('0x4f')]&&_0x2d0851[_0x7222('0x4f')]!==_0x7222('0x50')){logger[_0x7222('0x9')](_0x7222('0x51'),_0x7222('0x43'));_0x36b2d7[_0x7222('0x44')]=util[_0x7222('0x17')](_0x7222('0x45'),_0xf20814[_0x7222('0x41')],_0x36b2d7['uniqueid'],md5(_0x36b2d7[_0x7222('0x46')]));}headers['Authorization']=getAuth(_0xf20814);return getUser(_0xf20814,_0x5423fe[_0x7222('0x1e')])[_0x7222('0x21')](function(_0x3cb610){_0x2fe048=_0x3cb610;logger[_0x7222('0x9')](_0x7222('0x52'),_0x2fe048['id']);return getEndUser(_0xf20814,_0x36b2d7[_0x7222('0x53')],_0x36b2d7[_0x7222('0x54')]);})[_0x7222('0x21')](function(_0x1e0242){_0x2af189=_0x1e0242;logger[_0x7222('0x9')](_0x7222('0x47'),_0x2af189['id']);return getTicket(_0xf20814,_0x2fe048,_0x2af189,_0x4ea99e,_0x36b2d7);})['then'](function(_0x40435e){if(_0x40435e&&_0x40435e['id']){logger[_0x7222('0x9')](_0x7222('0x18'));logger[_0x7222('0x9')](_0x7222('0x48'),_0x40435e['id']);logger[_0x7222('0x9')](_0x7222('0x51'),_0x7222('0x49'));emit(util[_0x7222('0x17')](_0x7222('0x4a'),_0x5423fe[_0x7222('0x3e')]),'trigger:browser:url',{'uri':util[_0x7222('0x17')]('%s/helpdesk/tickets/%d',_0xf20814[_0x7222('0x1b')],_0x40435e['id'])});}})[_0x7222('0x4c')](function(_0x30205c){logger['error'](_0x7222('0x51'),JSON['stringify'](_0x30205c));});};exports[_0x7222('0x55')]=function(_0x1e0efd,_0x2badff,_0x5ced32,_0x7f3fc2,_0xa64484,_0x310283){var _0x49c694,_0x40c5d3;_0x310283[_0x7222('0x1b')]=intUtil[_0x7222('0x40')](_0x310283['remoteUri']);_0x310283[_0x7222('0x41')]=intUtil[_0x7222('0x40')](_0x310283[_0x7222('0x41')]);if(_0xa64484&&_0xa64484[_0x7222('0x42')]){logger[_0x7222('0x9')](_0x7222('0x56'),_0x7222('0x43'));_0x2badff[_0x7222('0x44')]=util[_0x7222('0x17')](_0x7222('0x45'),_0x310283['serverUrl'],_0x2badff['uniqueid'],md5(_0x2badff[_0x7222('0x46')]));}else{_0x2badff[_0x7222('0x44')]='';}headers[_0x7222('0x57')]=getAuth(_0x310283);return getUser(_0x310283,'')[_0x7222('0x21')](function(_0x50c69b){_0x49c694=_0x50c69b;logger[_0x7222('0x9')](_0x7222('0x52'),_0x49c694['id']);return getEndUser(_0x310283,_0x2badff[_0x7222('0xb')],_0x2badff[_0x7222('0xc')]);})['then'](function(_0x25ba08){_0x40c5d3=_0x25ba08;logger['info']('The\x20Enduser\x20ID\x20is:',_0x40c5d3['id']);return getTicket(_0x310283,_0x49c694,_0x40c5d3,_0x5ced32,_0x2badff);})[_0x7222('0x21')](function(_0x16d4e2){if(_0x16d4e2){logger[_0x7222('0x9')](_0x7222('0x18'));logger[_0x7222('0x9')](_0x7222('0x48'),_0x16d4e2['id']);}})[_0x7222('0x4c')](function(_0x4cd324){logger[_0x7222('0x58')](_0x7222('0x56'),JSON[_0x7222('0x2f')](_0x4cd324));});}; \ No newline at end of file +var _0x4b65=['Fields','mapValues','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','find','Enduser\x20created.','Basic\x20%s','apiKey','base64','[HTTP]','stringify','map','string','customField','toLowerCase','type','idField','custom_fields','push','content','toString','variable','variableName','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','error','abandoned','[ABANDONED]','lodash','request-promise','md5','ioredis','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
','Tags','name'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4b65,0x9a));var _0x54b6=function(_0x30d455,_0x3d31b0){_0x30d455=_0x30d455-0x0;var _0x19abb1=_0x4b65[_0x30d455];return _0x19abb1;};'use strict';var _=require(_0x54b6('0x0'));var rp=require(_0x54b6('0x1'));var md5=require(_0x54b6('0x2'));var util=require('util');var Redis=require(_0x54b6('0x3'));var intUtil=require(_0x54b6('0x4'));var config=require('../../../../config/environment');var logger=require(_0x54b6('0x5'))('freshdesk');config[_0x54b6('0x6')]=_[_0x54b6('0x7')](config[_0x54b6('0x6')],{'host':_0x54b6('0x8'),'port':0x18eb});var io=require(_0x54b6('0x9'))(new Redis(config[_0x54b6('0x6')]));var headers={'Content-Type':_0x54b6('0xa'),'Accept':_0x54b6('0xa')};function emit(_0x1878ee,_0x14e5df,_0x9cb474){io['to'](_0x1878ee)[_0x54b6('0xb')](_0x14e5df,_0x9cb474);}function getTicket(_0x50df35,_0x4399d0,_0xb9fe23,_0x2515c5,_0x371bfd){logger[_0x54b6('0xc')](_0x54b6('0xd'));var _0x449b29=_[_0x54b6('0xe')]({'responder_id':_0x4399d0['id'],'requester_id':_0xb9fe23['id'],'name':util[_0x54b6('0xf')](_0x54b6('0x10'),_0x371bfd['calleridname']),'phone':_0x371bfd[_0x54b6('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x54b6('0x12')](_0x2515c5[_0x54b6('0x13')],_0x371bfd,'\x20'),'description':intUtil[_0x54b6('0x12')](_0x2515c5[_0x54b6('0x14')],_0x371bfd,_0x54b6('0x15')),'tags':getTags(_0x2515c5[_0x54b6('0x16')],_0x54b6('0x17'))},getCustomFields(_0x2515c5[_0x54b6('0x18')],_0x371bfd));_0x449b29['custom_fields']=_[_0x54b6('0x19')](_['keyBy'](_0x449b29['custom_fields'],'id'),_0x54b6('0x1a'));return request({'uri':util[_0x54b6('0xf')](_0x54b6('0x1b'),_0x50df35[_0x54b6('0x1c')]),'method':_0x54b6('0x1d'),'body':_0x449b29})[_0x54b6('0x1e')](function(_0x4fd2d1){logger[_0x54b6('0xc')](_0x54b6('0x1f'));return _0x4fd2d1;});}function getUser(_0x351ffb,_0x29edb3){if(intUtil[_0x54b6('0x20')](_0x29edb3)){return request({'uri':util['format'](_0x54b6('0x21'),_0x351ffb[_0x54b6('0x1c')]),'qs':{'email':_0x29edb3}})['then'](function(_0x2d0ad8){if(_0x2d0ad8[_0x54b6('0x22')]){logger[_0x54b6('0xc')](_0x54b6('0x23'));return _['find'](_0x2d0ad8,function(_0x2d7f26){return _0x2d7f26[_0x54b6('0x24')]['email']===_0x29edb3;});}else{logger['info'](_0x54b6('0x25'));return request({'uri':util[_0x54b6('0xf')](_0x54b6('0x26'),_0x351ffb['remoteUri'])})['then'](function(_0x501e83){logger['info'](_0x54b6('0x27'));return _0x501e83;});}});}else{logger['info'](_0x54b6('0x28'));return request({'uri':util[_0x54b6('0xf')](_0x54b6('0x26'),_0x351ffb[_0x54b6('0x1c')])})[_0x54b6('0x1e')](function(_0x6ef829){logger[_0x54b6('0xc')]('Admin\x20account\x20selected.');return _0x6ef829;});}}function getEndUser(_0x3b7b85,_0x55674a,_0x40badf){logger[_0x54b6('0xc')](_0x54b6('0x29'),_0x40badf);return request({'uri':util[_0x54b6('0xf')]('%s/api/v2/contacts',_0x3b7b85[_0x54b6('0x1c')]),'qs':{'phone':_0x40badf}})[_0x54b6('0x1e')](function(_0x4c6674){if(_0x4c6674[_0x54b6('0x22')]){logger[_0x54b6('0xc')]('Enduser\x20found!');return _[_0x54b6('0x2a')](_0x4c6674,{'phone':_0x40badf});}else{logger[_0x54b6('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x54b6('0xf')]('%s/api/v2/contacts',_0x3b7b85[_0x54b6('0x1c')]),'method':'POST','body':{'name':_0x55674a,'phone':_0x40badf}})[_0x54b6('0x1e')](function(_0x1c87a0){logger[_0x54b6('0xc')](_0x54b6('0x2b'));return _0x1c87a0;});}});}function getAuth(_0x18d2f4){return util['format'](_0x54b6('0x2c'),new Buffer(_0x18d2f4[_0x54b6('0x2d')]+':X')['toString'](_0x54b6('0x2e')));}function request(_0x33f463){logger['debug'](_0x54b6('0x2f'),JSON[_0x54b6('0x30')](_0x33f463));return rp(_['defaults'](_0x33f463,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x7095cb,_0x370f17){var _0x435b1b=[];if(_0x7095cb&&_0x7095cb[_0x54b6('0x22')]>0x0){_0x435b1b=_[_0x54b6('0x31')](_0x7095cb,_0x370f17);}return _0x435b1b;}function getCustomFields(_0x565470,_0x3bedb4){var _0x51c36d=[];var _0x3ec3d4={'custom_fields':[]};if(_0x565470[_0x54b6('0x22')]>0x0){_['forEach'](_0x565470,function(_0x37c982){if(_0x37c982['type']===_0x54b6('0x32')&&_0x37c982['nameField']&&!_0x37c982[_0x54b6('0x33')]){_0x3ec3d4[_0x37c982['nameField'][_0x54b6('0x34')]()]=_0x37c982['content']['toString']();}else if(_0x37c982[_0x54b6('0x35')]==='string'&&_0x37c982[_0x54b6('0x36')]&&_0x37c982[_0x54b6('0x33')]){_0x3ec3d4[_0x54b6('0x37')][_0x54b6('0x38')]({'id':_0x37c982[_0x54b6('0x36')],'value':_0x37c982[_0x54b6('0x39')][_0x54b6('0x3a')]()});}else if(_0x37c982[_0x54b6('0x35')]===_0x54b6('0x3b')&&_0x37c982[_0x54b6('0x3c')]&&_0x37c982[_0x54b6('0x36')]&&_0x37c982[_0x54b6('0x33')]){_0x3bedb4[_0x37c982[_0x54b6('0x3c')]]&&_0x3ec3d4['custom_fields'][_0x54b6('0x38')]({'id':_0x37c982['idField'],'value':_0x3bedb4[_0x37c982['variableName']][_0x54b6('0x3a')]()});}else if(_0x37c982[_0x54b6('0x35')]==='customVariable'&&_0x37c982[_0x54b6('0x3d')]&&_0x37c982[_0x54b6('0x3d')][_0x54b6('0x17')]&&_0x37c982[_0x54b6('0x36')]&&_0x37c982[_0x54b6('0x33')]){_0x3bedb4[_0x37c982['Variable'][_0x54b6('0x17')][_0x54b6('0x34')]()]&&_0x3ec3d4[_0x54b6('0x37')][_0x54b6('0x38')]({'id':_0x37c982[_0x54b6('0x36')],'value':_0x3bedb4[_0x37c982['Variable']['name'][_0x54b6('0x34')]()][_0x54b6('0x3a')]()});}});}return _0x3ec3d4;}exports['queue']=function(_0x4b0fa9,_0x894fb1,_0x118867,_0x2c0390,_0x118077,_0x5df9c5){var _0xe13f2d,_0x47f386;_0x5df9c5['remoteUri']=intUtil['stripTrailingSlash'](_0x5df9c5[_0x54b6('0x1c')]);_0x5df9c5['serverUrl']=intUtil[_0x54b6('0x3e')](_0x5df9c5[_0x54b6('0x3f')]);if(_0x118077&&_0x118077[_0x54b6('0x40')]){logger['info'](_0x54b6('0x41'),_0x54b6('0x42'));_0x894fb1[_0x54b6('0x43')]=util['format'](_0x54b6('0x44'),_0x5df9c5[_0x54b6('0x3f')],_0x894fb1[_0x54b6('0x45')],md5(_0x894fb1[_0x54b6('0x45')]));}else{_0x894fb1[_0x54b6('0x43')]='';}headers[_0x54b6('0x46')]=getAuth(_0x5df9c5);return getUser(_0x5df9c5,_0x2c0390[_0x54b6('0x47')])[_0x54b6('0x1e')](function(_0x4f4aee){_0xe13f2d=_0x4f4aee;logger[_0x54b6('0xc')](_0x54b6('0x48'),_0xe13f2d['id']);return getEndUser(_0x5df9c5,_0x894fb1[_0x54b6('0x49')],_0x894fb1[_0x54b6('0x11')]);})[_0x54b6('0x1e')](function(_0x19865a){_0x47f386=_0x19865a;logger[_0x54b6('0xc')](_0x54b6('0x4a'),_0x47f386['id']);return getTicket(_0x5df9c5,_0xe13f2d,_0x47f386,_0x118867,_0x894fb1);})[_0x54b6('0x1e')](function(_0x4b96cc){if(_0x4b96cc&&_0x4b96cc['id']){logger['info'](_0x54b6('0x1f'));logger[_0x54b6('0xc')](_0x54b6('0x4b'),_0x4b96cc['id']);logger[_0x54b6('0xc')](_0x54b6('0x41'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x54b6('0x4c'),_0x2c0390[_0x54b6('0x17')]),_0x54b6('0x4d'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x5df9c5['remoteUri'],_0x4b96cc['id'])});}})[_0x54b6('0x4e')](function(_0x2b238d){logger['error'](_0x54b6('0x41'),JSON[_0x54b6('0x30')](_0x2b238d));});};exports[_0x54b6('0x4f')]=function(_0x2755d3,_0x44968c,_0x3106f9,_0x553734,_0x26a06a,_0x479f98,_0x46dc2a){var _0x4ec283,_0x554e75;_0x479f98[_0x54b6('0x1c')]=intUtil['stripTrailingSlash'](_0x479f98[_0x54b6('0x1c')]);_0x479f98[_0x54b6('0x3f')]=intUtil[_0x54b6('0x3e')](_0x479f98[_0x54b6('0x3f')]);if(_0x46dc2a&&_0x46dc2a[_0x54b6('0x50')]&&_0x46dc2a['recordingFormat']!==_0x54b6('0x51')){logger[_0x54b6('0xc')](_0x54b6('0x52'),_0x54b6('0x42'));_0x44968c[_0x54b6('0x43')]=util[_0x54b6('0xf')](_0x54b6('0x44'),_0x479f98['serverUrl'],_0x44968c[_0x54b6('0x45')],md5(_0x44968c[_0x54b6('0x45')]));}headers[_0x54b6('0x46')]=getAuth(_0x479f98);return getUser(_0x479f98,_0x553734['email'])['then'](function(_0x8f2e0f){_0x4ec283=_0x8f2e0f;logger[_0x54b6('0xc')]('The\x20User\x20ID\x20is:',_0x4ec283['id']);return getEndUser(_0x479f98,_0x44968c[_0x54b6('0x53')],_0x44968c['destcalleridnum']);})[_0x54b6('0x1e')](function(_0x1aff86){_0x554e75=_0x1aff86;logger[_0x54b6('0xc')](_0x54b6('0x4a'),_0x554e75['id']);return getTicket(_0x479f98,_0x4ec283,_0x554e75,_0x3106f9,_0x44968c);})[_0x54b6('0x1e')](function(_0x59a62d){if(_0x59a62d&&_0x59a62d['id']){logger[_0x54b6('0xc')](_0x54b6('0x1f'));logger[_0x54b6('0xc')](_0x54b6('0x4b'),_0x59a62d['id']);logger[_0x54b6('0xc')](_0x54b6('0x52'),_0x54b6('0x54'));emit(util[_0x54b6('0xf')](_0x54b6('0x4c'),_0x553734[_0x54b6('0x17')]),_0x54b6('0x4d'),{'uri':util[_0x54b6('0xf')](_0x54b6('0x55'),_0x479f98[_0x54b6('0x1c')],_0x59a62d['id'])});}})[_0x54b6('0x4e')](function(_0x55e081){logger[_0x54b6('0x56')](_0x54b6('0x52'),JSON['stringify'](_0x55e081));});};exports[_0x54b6('0x57')]=function(_0x30b403,_0x2eee95,_0x1468f7,_0x1d20ed,_0xb827b4,_0x5ea457){var _0x311309,_0x381415;_0x5ea457['remoteUri']=intUtil[_0x54b6('0x3e')](_0x5ea457[_0x54b6('0x1c')]);_0x5ea457[_0x54b6('0x3f')]=intUtil[_0x54b6('0x3e')](_0x5ea457[_0x54b6('0x3f')]);if(_0xb827b4&&_0xb827b4[_0x54b6('0x40')]){logger[_0x54b6('0xc')](_0x54b6('0x58'),_0x54b6('0x42'));_0x2eee95[_0x54b6('0x43')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5ea457[_0x54b6('0x3f')],_0x2eee95[_0x54b6('0x45')],md5(_0x2eee95[_0x54b6('0x45')]));}else{_0x2eee95['recordingURL']='';}headers['Authorization']=getAuth(_0x5ea457);return getUser(_0x5ea457,'')[_0x54b6('0x1e')](function(_0x84d70e){_0x311309=_0x84d70e;logger['info'](_0x54b6('0x48'),_0x311309['id']);return getEndUser(_0x5ea457,_0x2eee95[_0x54b6('0x49')],_0x2eee95[_0x54b6('0x11')]);})[_0x54b6('0x1e')](function(_0x4d64be){_0x381415=_0x4d64be;logger[_0x54b6('0xc')]('The\x20Enduser\x20ID\x20is:',_0x381415['id']);return getTicket(_0x5ea457,_0x311309,_0x381415,_0x1468f7,_0x2eee95);})['then'](function(_0x59dd36){if(_0x59dd36){logger['info'](_0x54b6('0x1f'));logger[_0x54b6('0xc')](_0x54b6('0x4b'),_0x59dd36['id']);}})[_0x54b6('0x4e')](function(_0x50ac39){logger['error'](_0x54b6('0x58'),JSON[_0x54b6('0x30')](_0x50ac39));});}; \ 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 75b37a7..51cec5e 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 _0x063c=['servicenow','exec','data1','data2','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','abandoned','toLowerCase','zendesk','freshdesk','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','salesforce','sugarcrm','zoho','desk','vtiger'];(function(_0x5e9a93,_0x3f3437){var _0x4c1942=function(_0x31a857){while(--_0x31a857){_0x5e9a93['push'](_0x5e9a93['shift']());}};_0x4c1942(++_0x3f3437);}(_0x063c,0xba));var _0xc063=function(_0x35a199,_0x5560aa){_0x35a199=_0x35a199-0x0;var _0xeb1142=_0x063c[_0x35a199];return _0xeb1142;};'use strict';var _=require('lodash');var util=require(_0xc063('0x0'));var zendesk=require(_0xc063('0x1'));var salesforce=require(_0xc063('0x2'));var sugarcrm=require(_0xc063('0x3'));var freshdesk=require(_0xc063('0x4'));var zoho=require(_0xc063('0x5'));var desk=require('./desk');var vtiger=require(_0xc063('0x6'));var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var integrations=['zendesk',_0xc063('0x7'),_0xc063('0x8'),'freshdesk',_0xc063('0x9'),_0xc063('0xa'),_0xc063('0xb'),_0xc063('0xc'),'dynamics365'];exports[_0xc063('0xd')]=function(_0x421328,_0x4e788f,_0x34d40a,_0x401bdc,_0x50e5fa,_0xacddee){if(_0x34d40a){if(_['includes'](integrations,_0x421328['data1']['toLowerCase']())){try{var _0x1abcf5=null;var _0x21ad22='';var _0x4ec772=_0x34d40a[_0x421328[_0xc063('0xe')]['toLowerCase']()];if(_0x4ec772){var _0x14f55e=_0x4ec772[_0x421328[_0xc063('0xf')]];if(_0x14f55e){var _0x2f2816=_['find'](_0x14f55e[_0xc063('0x10')],{'id':parseInt(_0x421328[_0xc063('0x11')],0xa)});if(_0x2f2816){if(_0x401bdc){if(_0x50e5fa&&_0x4e788f[_0xc063('0x12')]){_0x21ad22=_0xc063('0x12');}else if(_0x4e788f[_0xc063('0x13')]){_0x21ad22=_0xc063('0x14');}else{console[_0xc063('0x15')](_0xc063('0x16'),_0x4e788f);}}else{_0x21ad22=_0xc063('0x17');}switch(_0x421328['data1'][_0xc063('0x18')]()){case _0xc063('0x19'):zendesk[_0x21ad22](_0x421328,_0x4e788f,_0x2f2816,_0x401bdc,_0x50e5fa,_0x14f55e,_0xacddee);break;case'salesforce':salesforce[_0x21ad22](_0x421328,_0x4e788f,_0x2f2816,_0x401bdc,_0x50e5fa,_0x14f55e,_0xacddee);break;case _0xc063('0x8'):sugarcrm[_0x21ad22](_0x421328,_0x4e788f,_0x2f2816,_0x401bdc,_0x50e5fa,_0x14f55e,_0xacddee);break;case _0xc063('0x1a'):freshdesk[_0x21ad22](_0x421328,_0x4e788f,_0x2f2816,_0x401bdc,_0x50e5fa,_0x14f55e,_0xacddee);break;case'zoho':zoho[_0x21ad22](_0x421328,_0x4e788f,_0x2f2816,_0x401bdc,_0x50e5fa,_0x14f55e,_0xacddee);break;case _0xc063('0xa'):desk[_0x21ad22](_0x421328,_0x4e788f,_0x2f2816,_0x401bdc,_0x50e5fa,_0x14f55e,_0xacddee);break;case _0xc063('0xb'):vtiger[_0x21ad22](_0x421328,_0x4e788f,_0x2f2816,_0x401bdc,_0x50e5fa,_0x14f55e,_0xacddee);break;case _0xc063('0xc'):servicenow['cs'](_0x421328,_0x4e788f,_0x2f2816,_0x401bdc,_0x50e5fa,_0x14f55e,_0xacddee,_0x21ad22);case _0xc063('0x1b'):dynamics365['cs'](_0x421328,_0x4e788f,_0x2f2816,_0x401bdc,_0x50e5fa,_0x14f55e,_0xacddee,_0x21ad22);break;default:console['log'](_0xc063('0x1c'));}}else{_0x1abcf5=require(_0xc063('0x1d'))(_0x421328[_0xc063('0xe')]['toLowerCase']());_0x1abcf5[_0xc063('0x1e')](_0xc063('0x1f'),util['format'](_0xc063('0x20'),_0x421328[_0xc063('0xe')][_0xc063('0x18')](),_0x421328[_0xc063('0x11')]));}}else{_0x1abcf5=require(_0xc063('0x1d'))(_0x421328['data1']['toLowerCase']());_0x1abcf5['error'](_0xc063('0x1f'),util['format']('%s\x20account\x20#%s\x20not\x20found',_0x421328['data1'][_0xc063('0x18')](),_0x421328[_0xc063('0xf')]));}}else{}}catch(_0x1bffbf){console[_0xc063('0x1e')](_0x1bffbf);}}}}; \ No newline at end of file +var _0x8caf=['./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','zoho','desk','vtiger','servicenow','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','abandoned','freshdesk','dynamics365','../../../../config/logger','error','[EXEC]','format','util','./zendesk'];(function(_0x18e046,_0x42af62){var _0x35e433=function(_0x41ccda){while(--_0x41ccda){_0x18e046['push'](_0x18e046['shift']());}};_0x35e433(++_0x42af62);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x406ddc,_0x233a84){_0x406ddc=_0x406ddc-0x0;var _0x4a2bf2=_0x8caf[_0x406ddc];return _0x4a2bf2;};'use strict';var _=require('lodash');var util=require(_0xf8ca('0x0'));var zendesk=require(_0xf8ca('0x1'));var salesforce=require(_0xf8ca('0x2'));var sugarcrm=require(_0xf8ca('0x3'));var freshdesk=require(_0xf8ca('0x4'));var zoho=require(_0xf8ca('0x5'));var desk=require('./desk');var vtiger=require(_0xf8ca('0x6'));var servicenow=require(_0xf8ca('0x7'));var dynamics365=require(_0xf8ca('0x8'));var integrations=[_0xf8ca('0x9'),_0xf8ca('0xa'),_0xf8ca('0xb'),'freshdesk',_0xf8ca('0xc'),_0xf8ca('0xd'),_0xf8ca('0xe'),_0xf8ca('0xf'),'dynamics365'];exports['exec']=function(_0x3a9674,_0x576e9d,_0x2f67c5,_0x2e86a6,_0x2daa43,_0x2be477){if(_0x2f67c5){if(_['includes'](integrations,_0x3a9674[_0xf8ca('0x10')][_0xf8ca('0x11')]())){try{var _0x16e3bb=null;var _0x9d3406='';var _0x5b9325=_0x2f67c5[_0x3a9674[_0xf8ca('0x10')][_0xf8ca('0x11')]()];if(_0x5b9325){var _0x485cab=_0x5b9325[_0x3a9674[_0xf8ca('0x12')]];if(_0x485cab){var _0x1f4539=_[_0xf8ca('0x13')](_0x485cab[_0xf8ca('0x14')],{'id':parseInt(_0x3a9674[_0xf8ca('0x15')],0xa)});if(_0x1f4539){if(_0x2e86a6){if(_0x2daa43&&_0x576e9d[_0xf8ca('0x16')]){_0x9d3406=_0xf8ca('0x16');}else if(_0x576e9d[_0xf8ca('0x17')]){_0x9d3406=_0xf8ca('0x18');}else{console[_0xf8ca('0x19')]('EVENT\x20UNKNOWN',_0x576e9d);}}else{_0x9d3406=_0xf8ca('0x1a');}switch(_0x3a9674[_0xf8ca('0x10')][_0xf8ca('0x11')]()){case _0xf8ca('0x9'):zendesk[_0x9d3406](_0x3a9674,_0x576e9d,_0x1f4539,_0x2e86a6,_0x2daa43,_0x485cab,_0x2be477);break;case _0xf8ca('0xa'):salesforce[_0x9d3406](_0x3a9674,_0x576e9d,_0x1f4539,_0x2e86a6,_0x2daa43,_0x485cab,_0x2be477);break;case _0xf8ca('0xb'):sugarcrm[_0x9d3406](_0x3a9674,_0x576e9d,_0x1f4539,_0x2e86a6,_0x2daa43,_0x485cab,_0x2be477);break;case _0xf8ca('0x1b'):freshdesk[_0x9d3406](_0x3a9674,_0x576e9d,_0x1f4539,_0x2e86a6,_0x2daa43,_0x485cab,_0x2be477);break;case _0xf8ca('0xc'):zoho[_0x9d3406](_0x3a9674,_0x576e9d,_0x1f4539,_0x2e86a6,_0x2daa43,_0x485cab,_0x2be477);break;case'desk':desk[_0x9d3406](_0x3a9674,_0x576e9d,_0x1f4539,_0x2e86a6,_0x2daa43,_0x485cab,_0x2be477);break;case _0xf8ca('0xe'):vtiger[_0x9d3406](_0x3a9674,_0x576e9d,_0x1f4539,_0x2e86a6,_0x2daa43,_0x485cab,_0x2be477);break;case _0xf8ca('0xf'):servicenow['cs'](_0x3a9674,_0x576e9d,_0x1f4539,_0x2e86a6,_0x2daa43,_0x485cab,_0x2be477,_0x9d3406);case _0xf8ca('0x1c'):dynamics365['cs'](_0x3a9674,_0x576e9d,_0x1f4539,_0x2e86a6,_0x2daa43,_0x485cab,_0x2be477,_0x9d3406);break;default:console[_0xf8ca('0x19')]('unknown\x20integration');}}else{_0x16e3bb=require(_0xf8ca('0x1d'))(_0x3a9674[_0xf8ca('0x10')][_0xf8ca('0x11')]());_0x16e3bb[_0xf8ca('0x1e')](_0xf8ca('0x1f'),util[_0xf8ca('0x20')]('%s\x20configuration\x20#%s\x20not\x20found',_0x3a9674[_0xf8ca('0x10')]['toLowerCase'](),_0x3a9674[_0xf8ca('0x15')]));}}else{_0x16e3bb=require(_0xf8ca('0x1d'))(_0x3a9674[_0xf8ca('0x10')][_0xf8ca('0x11')]());_0x16e3bb[_0xf8ca('0x1e')](_0xf8ca('0x1f'),util['format']('%s\x20account\x20#%s\x20not\x20found',_0x3a9674[_0xf8ca('0x10')][_0xf8ca('0x11')](),_0x3a9674['data2']));}}else{}}catch(_0x55b944){console[_0xf8ca('0x1e')](_0x55b944);}}}}; \ 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 f9fcb6c..915e129 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 _0xfa47=['info','Agent\x20%s\x20found.','resolve','Name','identity','then','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','contact_lead','execute','Lead','contact','lead','Phone','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.','Company','upperFirst','forEach','idField','content','toString','type','variableName','customVariable','Variable','name','toLowerCase','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','abandoned','[ABANDONED]\x20Ticket\x20%s\x20created.','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','jsforce','ioredis','../../../../config/environment','salesforce','redis','defaults','localhost','socket.io-emitter','emit','merge','utc','getString','Subjects','Descriptions','WhoId','sobject','Task','create','find','length','Email'];(function(_0x375554,_0xa0aad6){var _0x232a3d=function(_0x12fdc2){while(--_0x12fdc2){_0x375554['push'](_0x375554['shift']());}};_0x232a3d(++_0xa0aad6);}(_0xfa47,0x1db));var _0x7fa4=function(_0x414f67,_0x861aed){_0x414f67=_0x414f67-0x0;var _0x338537=_0xfa47[_0x414f67];return _0x338537;};'use strict';var _=require(_0x7fa4('0x0'));var rp=require(_0x7fa4('0x1'));var moment=require('moment');var BPromise=require(_0x7fa4('0x2'));var md5=require(_0x7fa4('0x3'));var jsforce=require(_0x7fa4('0x4'));var util=require('util');var Redis=require(_0x7fa4('0x5'));var intUtil=require('./util');var config=require(_0x7fa4('0x6'));var logger=require('../../../../config/logger')(_0x7fa4('0x7'));config[_0x7fa4('0x8')]=_[_0x7fa4('0x9')](config[_0x7fa4('0x8')],{'host':_0x7fa4('0xa'),'port':0x18eb});var io=require(_0x7fa4('0xb'))(new Redis(config[_0x7fa4('0x8')]));function emit(_0x219ca5,_0x5fec83,_0x3b7eb3){io['to'](_0x219ca5)[_0x7fa4('0xc')](_0x5fec83,_0x3b7eb3);}function getTicket(_0x4d5f07,_0xac1516,_0x2e3771,_0x188bac,_0x290f89,_0x53e062,_0x2f141a){var _0x3e6cd1=_[_0x7fa4('0xd')]({'OwnerId':_0xac1516['id'],'ActivityDate':moment[_0x7fa4('0xe')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x7fa4('0xf')](_0x188bac[_0x7fa4('0x10')],_0x290f89,'\x20'),'Description':intUtil[_0x7fa4('0xf')](_0x188bac[_0x7fa4('0x11')],_0x290f89,'\x0a')},getCustomFields(_0x53e062,_0x290f89));if(_0x2e3771){_0x3e6cd1[_0x7fa4('0x12')]=_0x2e3771['id'];}return _0x2f141a[_0x7fa4('0x13')](_0x7fa4('0x14'))[_0x7fa4('0x15')](_0x3e6cd1);}function getUser(_0x550cc7,_0x15c819,_0x548823){if(intUtil['validateEmail'](_0x15c819)){var _0x5c42a1={'Email':_0x15c819};var _0x407b1b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x548823[_0x7fa4('0x13')]('User')[_0x7fa4('0x16')](_0x5c42a1,_0x407b1b)['execute']()['then'](function(_0x300bea){if(_0x300bea[_0x7fa4('0x17')]){var _0x28af29=_[_0x7fa4('0x16')](_0x300bea,function(_0x3e7610){return _0x3e7610[_0x7fa4('0x18')]===_0x15c819;});if(_0x28af29){logger[_0x7fa4('0x19')](_0x7fa4('0x1a'),_0x15c819);return BPromise[_0x7fa4('0x1b')]({'id':_0x28af29['Id'],'name':_0x28af29[_0x7fa4('0x1c')]});}}else{logger[_0x7fa4('0x19')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x15c819);return _0x548823[_0x7fa4('0x1d')]()[_0x7fa4('0x1e')](function(_0x462518){return BPromise[_0x7fa4('0x1b')]({'id':_0x462518[_0x7fa4('0x1f')],'name':_0x462518[_0x7fa4('0x20')]});});}});}else{logger['info'](_0x7fa4('0x21'),_0x15c819);return _0x548823[_0x7fa4('0x1d')]()[_0x7fa4('0x1e')](function(_0x3e50d3){return BPromise[_0x7fa4('0x1b')]({'id':_0x3e50d3[_0x7fa4('0x1f')],'name':_0x3e50d3[_0x7fa4('0x20')]});});}}function getEndUser(_0xa67002,_0x3cbd92,_0x4cf30b,_0x404ff7,_0x722e6){var _0x306542={'Phone':_0x404ff7};var _0x4c1d0c={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x7fa4('0x1b')]()[_0x7fa4('0x1e')](function(){logger[_0x7fa4('0x19')](_0x7fa4('0x22'),_0x404ff7,_0x3cbd92['moduleSearch']);switch(_0x3cbd92['moduleSearch']){case _0x7fa4('0x23'):return _0x722e6[_0x7fa4('0x13')]('Contact')['find'](_0x306542,_0x4c1d0c)[_0x7fa4('0x24')]()['then'](function(_0x2b9d30){if(_0x2b9d30&&_0x2b9d30[_0x7fa4('0x17')]){return _0x2b9d30;}else{return _0x722e6[_0x7fa4('0x13')](_0x7fa4('0x25'))['find'](_0x306542,_0x4c1d0c);}});case _0x7fa4('0x26'):return _0x722e6['sobject']('Contact')[_0x7fa4('0x16')](_0x306542,_0x4c1d0c)[_0x7fa4('0x24')]();case _0x7fa4('0x27'):return _0x722e6['sobject'](_0x7fa4('0x25'))['find'](_0x306542,_0x4c1d0c);default:return null;}})[_0x7fa4('0x1e')](function(_0x3565d9){if(_0x3565d9&&_0x3565d9[_0x7fa4('0x17')]){var _0x137480=_['find'](_0x3565d9,function(_0x5a6803){return _0x5a6803[_0x7fa4('0x28')]===_0x404ff7;});if(_0x137480){return BPromise[_0x7fa4('0x1b')]({'id':_0x137480['Id'],'name':_0x137480[_0x7fa4('0x1c')],'phone':_0x137480[_0x7fa4('0x28')]});}}})['then'](function(_0x1739b9){if(_0x1739b9){logger[_0x7fa4('0x19')](_0x7fa4('0x29'),_0x404ff7);return BPromise[_0x7fa4('0x1b')](_0x1739b9);}else{logger[_0x7fa4('0x19')](_0x7fa4('0x2a'),_0x404ff7);var _0x321668={'LastName':_0x4cf30b!==_0x7fa4('0x2b')?_0x4cf30b:util[_0x7fa4('0x2c')](_0x7fa4('0x2d'),_0x404ff7),'Phone':_0x404ff7};if(_0x3cbd92['moduleCreate']){switch(_0x3cbd92[_0x7fa4('0x2e')]){case _0x7fa4('0x26'):logger[_0x7fa4('0x19')](_0x7fa4('0x2f'),_0x404ff7,_0x3cbd92[_0x7fa4('0x2e')]);break;case _0x7fa4('0x27'):logger['info'](_0x7fa4('0x2f'),_0x404ff7,_0x3cbd92[_0x7fa4('0x2e')]);_0x321668[_0x7fa4('0x30')]='No\x20Company';break;default:return null;}}return _0x722e6[_0x7fa4('0x13')](_[_0x7fa4('0x31')](_0x3cbd92[_0x7fa4('0x2e')]))['create'](_0x321668);}});}function getCustomFields(_0x25a900,_0xcc8dd4){var _0x89bad5={};if(_0x25a900[_0x7fa4('0x17')]>0x0){_[_0x7fa4('0x32')](_0x25a900,function(_0xe53e53){if(_0xe53e53['type']==='string'&&_0xe53e53['idField']){_0x89bad5[_0xe53e53[_0x7fa4('0x33')]]=_0xe53e53[_0x7fa4('0x34')][_0x7fa4('0x35')]();}else if(_0xe53e53[_0x7fa4('0x36')]==='variable'&&_0xe53e53['variableName']&&_0xe53e53[_0x7fa4('0x33')]){_0xcc8dd4[_0xe53e53[_0x7fa4('0x37')]]&&(_0x89bad5[_0xe53e53['idField']]=_0xcc8dd4[_0xe53e53[_0x7fa4('0x37')]][_0x7fa4('0x35')]());}else if(_0xe53e53[_0x7fa4('0x36')]===_0x7fa4('0x38')&&_0xe53e53[_0x7fa4('0x39')]&&_0xe53e53['Variable'][_0x7fa4('0x3a')]&&_0xe53e53[_0x7fa4('0x33')]){_0xcc8dd4[_0xe53e53[_0x7fa4('0x39')][_0x7fa4('0x3a')][_0x7fa4('0x3b')]()]&&(_0x89bad5[_0xe53e53[_0x7fa4('0x33')]]=_0xcc8dd4[_0xe53e53['Variable']['name'][_0x7fa4('0x3b')]()][_0x7fa4('0x35')]());}});}return _0x89bad5;}function getConnection(_0x48dbc8){var _0x92205f=_0x48dbc8[_0x7fa4('0x3c')]['concat'](_0x48dbc8[_0x7fa4('0x3d')]);var _0x29b0e6=new jsforce[(_0x7fa4('0x3e'))]({'oauth2':{'loginUrl':_0x48dbc8[_0x7fa4('0x3f')]||_0x7fa4('0x40'),'clientId':_0x48dbc8[_0x7fa4('0x41')],'clientSecret':_0x48dbc8['clientSecret']}});return _0x29b0e6['login'](_0x48dbc8['username'],_0x92205f)[_0x7fa4('0x1e')](function(){logger[_0x7fa4('0x19')](_0x7fa4('0x42'));return _0x29b0e6;});}exports[_0x7fa4('0x43')]=function(_0x14e220,_0x90fb5c,_0x4259e8,_0x3ba547,_0x4cc087,_0x1a0ee4){var _0x1542a0,_0x26150d,_0x21767f,_0x5b0003;_0x1a0ee4[_0x7fa4('0x44')]=intUtil['stripTrailingSlash'](_0x1a0ee4[_0x7fa4('0x44')]);_0x1a0ee4[_0x7fa4('0x3f')]=intUtil[_0x7fa4('0x45')](_0x1a0ee4[_0x7fa4('0x3f')]);if(_0x4cc087&&_0x4cc087['monitor_format']){logger[_0x7fa4('0x19')](_0x7fa4('0x46'),_0x7fa4('0x47'));_0x90fb5c[_0x7fa4('0x48')]=util[_0x7fa4('0x2c')](_0x7fa4('0x49'),_0x1a0ee4['serverUrl'],_0x90fb5c['uniqueid'],md5(_0x90fb5c[_0x7fa4('0x4a')]));}else{_0x90fb5c[_0x7fa4('0x48')]='';}return getConnection(_0x1a0ee4)['then'](function(_0x8b0828){_0x5b0003=_0x8b0828;return getUser(_0x1a0ee4,_0x3ba547[_0x7fa4('0x4b')],_0x5b0003);})[_0x7fa4('0x1e')](function(_0x5010e6){_0x1542a0=_0x5010e6;return getEndUser(_0x1a0ee4,_0x4259e8,_0x90fb5c['calleridname'],_0x90fb5c[_0x7fa4('0x4c')],_0x5b0003);})[_0x7fa4('0x1e')](function(_0xdd8b2d){_0x26150d=_0xdd8b2d;return getTicket(_0x1a0ee4,_0x1542a0,_0x26150d,_0x4259e8,_0x90fb5c,_0x4259e8[_0x7fa4('0x4d')],_0x5b0003);})[_0x7fa4('0x1e')](function(_0x493968){_0x21767f=_0x493968;logger[_0x7fa4('0x19')](_0x7fa4('0x4e'),_0x21767f['id']);logger[_0x7fa4('0x19')](_0x7fa4('0x4f'),_0x21767f['id'],_0x3ba547['name'],_0x1a0ee4['type']);switch(_0x1a0ee4[_0x7fa4('0x36')]){case _0x7fa4('0x50'):emit(util[_0x7fa4('0x2c')](_0x7fa4('0x51'),_0x3ba547[_0x7fa4('0x3a')]),_0x7fa4('0x52'),{'recordId':_0x21767f['id']});break;case'newTab':emit(util['format'](_0x7fa4('0x51'),_0x3ba547[_0x7fa4('0x3a')]),_0x7fa4('0x53'),{'uri':util[_0x7fa4('0x2c')](_0x7fa4('0x54'),_0x5b0003[_0x7fa4('0x55')],_0x21767f['id'])});break;default:logger['error'](_0x7fa4('0x56'));}})[_0x7fa4('0x57')](function(_0x13b946){logger[_0x7fa4('0x58')]('[QUEUE]',JSON[_0x7fa4('0x59')](_0x13b946));});};exports['outbound']=function(_0x155b28,_0x1af0ee,_0x162623,_0x4deda9,_0xe1cbd2,_0x54f4d2,_0xd37933){var _0x56d246,_0x5be6c3,_0x204a5a,_0x4fcd15;_0x54f4d2[_0x7fa4('0x44')]=intUtil[_0x7fa4('0x45')](_0x54f4d2['serverUrl']);_0x54f4d2[_0x7fa4('0x3f')]=intUtil[_0x7fa4('0x45')](_0x54f4d2['remoteUri']);if(_0xd37933&&_0xd37933['recordingFormat']&&_0xd37933[_0x7fa4('0x5a')]!==_0x7fa4('0x5b')){logger['info'](_0x7fa4('0x5c'),'Recording\x20is\x20enabled!');_0x1af0ee[_0x7fa4('0x48')]=util['format'](_0x7fa4('0x49'),_0x54f4d2[_0x7fa4('0x44')],_0x1af0ee[_0x7fa4('0x4a')],md5(_0x1af0ee[_0x7fa4('0x4a')]));}return getConnection(_0x54f4d2)['then'](function(_0x5401e2){_0x4fcd15=_0x5401e2;return getUser(_0x54f4d2,_0x4deda9[_0x7fa4('0x4b')],_0x4fcd15);})[_0x7fa4('0x1e')](function(_0x23b280){_0x56d246=_0x23b280;return getEndUser(_0x54f4d2,_0x162623,_0x1af0ee[_0x7fa4('0x5d')],_0x1af0ee[_0x7fa4('0x5e')],_0x4fcd15);})[_0x7fa4('0x1e')](function(_0xbb747f){_0x5be6c3=_0xbb747f;return getTicket(_0x54f4d2,_0x56d246,_0x5be6c3,_0x162623,_0x1af0ee,_0x162623[_0x7fa4('0x4d')],_0x4fcd15);})[_0x7fa4('0x1e')](function(_0x129c5a){_0x204a5a=_0x129c5a;logger['info'](_0x7fa4('0x5f'),_0x204a5a['id']);logger['info'](_0x7fa4('0x60'),_0x204a5a['id'],_0x4deda9[_0x7fa4('0x3a')],_0x54f4d2['type']);switch(_0x54f4d2[_0x7fa4('0x36')]){case _0x7fa4('0x50'):emit(util['format']('user:%s',_0x4deda9[_0x7fa4('0x3a')]),_0x7fa4('0x52'),{'recordId':_0x204a5a['id']});break;case'newTab':emit(util['format'](_0x7fa4('0x51'),_0x4deda9[_0x7fa4('0x3a')]),_0x7fa4('0x53'),{'uri':util[_0x7fa4('0x2c')](_0x7fa4('0x54'),_0x4fcd15[_0x7fa4('0x55')],_0x204a5a['id'])});break;default:logger['error'](_0x7fa4('0x5c'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x7fa4('0x57')](function(_0x79404d){logger['error'](_0x7fa4('0x5c'),JSON[_0x7fa4('0x59')](_0x79404d));});};exports[_0x7fa4('0x61')]=function(_0x41fb1b,_0x589840,_0x45e5c2,_0x387130,_0x5e06ac,_0x2ae26d){var _0x37f4a0,_0x42e711,_0x3fab40,_0x363b9f;_0x2ae26d[_0x7fa4('0x44')]=intUtil['stripTrailingSlash'](_0x2ae26d[_0x7fa4('0x44')]);_0x2ae26d[_0x7fa4('0x3f')]=intUtil['stripTrailingSlash'](_0x2ae26d[_0x7fa4('0x3f')]);if(_0x5e06ac&&_0x5e06ac['monitor_format']){logger[_0x7fa4('0x19')]('[ABANDONED]',_0x7fa4('0x47'));_0x589840[_0x7fa4('0x48')]=util[_0x7fa4('0x2c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2ae26d['serverUrl'],_0x589840[_0x7fa4('0x4a')],md5(_0x589840[_0x7fa4('0x4a')]));}else{_0x589840[_0x7fa4('0x48')]='';}return getConnection(_0x2ae26d)[_0x7fa4('0x1e')](function(_0x8253f3){_0x363b9f=_0x8253f3;return getUser(_0x2ae26d,_0x387130['email'],_0x363b9f);})[_0x7fa4('0x1e')](function(_0x3e484e){_0x37f4a0=_0x3e484e;return getEndUser(_0x2ae26d,_0x45e5c2,_0x589840['calleridname'],_0x589840[_0x7fa4('0x4c')],_0x363b9f);})[_0x7fa4('0x1e')](function(_0x3f9859){_0x42e711=_0x3f9859;return getTicket(_0x2ae26d,_0x37f4a0,_0x42e711,_0x45e5c2,_0x589840,_0x45e5c2['Fields'],_0x363b9f);})[_0x7fa4('0x1e')](function(_0x543028){_0x3fab40=_0x543028;logger[_0x7fa4('0x19')](_0x7fa4('0x62'),_0x3fab40['id']);logger[_0x7fa4('0x19')](_0x7fa4('0x63'),_0x2ae26d[_0x7fa4('0x36')]);})['catch'](function(_0x5e6437){logger[_0x7fa4('0x58')]('[ABANDONED]',JSON[_0x7fa4('0x59')](_0x5e6437));});}; \ No newline at end of file +var _0x83bd=['trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','abandoned','[ABANDONED]','[ABANDONED]\x20Ticket\x20%s\x20created.','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','utc','getString','Subjects','Descriptions','WhoId','Task','validateEmail','sobject','User','execute','then','length','find','Email','Agent\x20%s\x20found.','resolve','Name','info','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','Lead','contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','create','forEach','type','string','idField','content','toString','variable','variableName','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','clientId','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.'];(function(_0x9e5cfb,_0x5e1a0f){var _0x5a3140=function(_0x287290){while(--_0x287290){_0x9e5cfb['push'](_0x9e5cfb['shift']());}};_0x5a3140(++_0x5e1a0f);}(_0x83bd,0x160));var _0xd83b=function(_0x2fa1c6,_0x4a5b8d){_0x2fa1c6=_0x2fa1c6-0x0;var _0x5f3257=_0x83bd[_0x2fa1c6];return _0x5f3257;};'use strict';var _=require(_0xd83b('0x0'));var rp=require('request-promise');var moment=require(_0xd83b('0x1'));var BPromise=require(_0xd83b('0x2'));var md5=require(_0xd83b('0x3'));var jsforce=require(_0xd83b('0x4'));var util=require(_0xd83b('0x5'));var Redis=require(_0xd83b('0x6'));var intUtil=require(_0xd83b('0x7'));var config=require(_0xd83b('0x8'));var logger=require('../../../../config/logger')('salesforce');config[_0xd83b('0x9')]=_[_0xd83b('0xa')](config[_0xd83b('0x9')],{'host':_0xd83b('0xb'),'port':0x18eb});var io=require(_0xd83b('0xc'))(new Redis(config[_0xd83b('0x9')]));function emit(_0x48f709,_0x1d67ad,_0x2fd323){io['to'](_0x48f709)['emit'](_0x1d67ad,_0x2fd323);}function getTicket(_0x365f3a,_0xe3f729,_0x102f06,_0x4061ef,_0x2f14f2,_0x17b505,_0xfade4a){var _0x5ec4dc=_['merge']({'OwnerId':_0xe3f729['id'],'ActivityDate':moment[_0xd83b('0xd')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xd83b('0xe')](_0x4061ef[_0xd83b('0xf')],_0x2f14f2,'\x20'),'Description':intUtil[_0xd83b('0xe')](_0x4061ef[_0xd83b('0x10')],_0x2f14f2,'\x0a')},getCustomFields(_0x17b505,_0x2f14f2));if(_0x102f06){_0x5ec4dc[_0xd83b('0x11')]=_0x102f06['id'];}return _0xfade4a['sobject'](_0xd83b('0x12'))['create'](_0x5ec4dc);}function getUser(_0x36b289,_0x4b134f,_0x374332){if(intUtil[_0xd83b('0x13')](_0x4b134f)){var _0x13a05f={'Email':_0x4b134f};var _0x3f726e={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x374332[_0xd83b('0x14')](_0xd83b('0x15'))['find'](_0x13a05f,_0x3f726e)[_0xd83b('0x16')]()[_0xd83b('0x17')](function(_0xbe8f2f){if(_0xbe8f2f[_0xd83b('0x18')]){var _0x27d60e=_[_0xd83b('0x19')](_0xbe8f2f,function(_0x1641b5){return _0x1641b5[_0xd83b('0x1a')]===_0x4b134f;});if(_0x27d60e){logger['info'](_0xd83b('0x1b'),_0x4b134f);return BPromise[_0xd83b('0x1c')]({'id':_0x27d60e['Id'],'name':_0x27d60e[_0xd83b('0x1d')]});}}else{logger[_0xd83b('0x1e')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x4b134f);return _0x374332[_0xd83b('0x1f')]()[_0xd83b('0x17')](function(_0x36c32d){return BPromise[_0xd83b('0x1c')]({'id':_0x36c32d[_0xd83b('0x20')],'name':_0x36c32d[_0xd83b('0x21')]});});}});}else{logger[_0xd83b('0x1e')](_0xd83b('0x22'),_0x4b134f);return _0x374332['identity']()[_0xd83b('0x17')](function(_0xd5b58d){return BPromise[_0xd83b('0x1c')]({'id':_0xd5b58d[_0xd83b('0x20')],'name':_0xd5b58d[_0xd83b('0x21')]});});}}function getEndUser(_0x310583,_0x188a4f,_0x211602,_0x163438,_0x10be09){var _0x37f6e3={'Phone':_0x163438};var _0x56fc82={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xd83b('0x17')](function(){logger[_0xd83b('0x1e')](_0xd83b('0x23'),_0x163438,_0x188a4f[_0xd83b('0x24')]);switch(_0x188a4f[_0xd83b('0x24')]){case _0xd83b('0x25'):return _0x10be09[_0xd83b('0x14')](_0xd83b('0x26'))[_0xd83b('0x19')](_0x37f6e3,_0x56fc82)[_0xd83b('0x16')]()[_0xd83b('0x17')](function(_0xb57e1){if(_0xb57e1&&_0xb57e1[_0xd83b('0x18')]){return _0xb57e1;}else{return _0x10be09['sobject'](_0xd83b('0x27'))[_0xd83b('0x19')](_0x37f6e3,_0x56fc82);}});case _0xd83b('0x28'):return _0x10be09['sobject'](_0xd83b('0x26'))[_0xd83b('0x19')](_0x37f6e3,_0x56fc82)['execute']();case _0xd83b('0x29'):return _0x10be09[_0xd83b('0x14')](_0xd83b('0x27'))[_0xd83b('0x19')](_0x37f6e3,_0x56fc82);default:return null;}})[_0xd83b('0x17')](function(_0x395ed7){if(_0x395ed7&&_0x395ed7[_0xd83b('0x18')]){var _0x15340a=_['find'](_0x395ed7,function(_0x59f07b){return _0x59f07b[_0xd83b('0x2a')]===_0x163438;});if(_0x15340a){return BPromise['resolve']({'id':_0x15340a['Id'],'name':_0x15340a[_0xd83b('0x1d')],'phone':_0x15340a[_0xd83b('0x2a')]});}}})['then'](function(_0x53e3ca){if(_0x53e3ca){logger[_0xd83b('0x1e')](_0xd83b('0x2b'),_0x163438);return BPromise[_0xd83b('0x1c')](_0x53e3ca);}else{logger[_0xd83b('0x1e')]('Enduser\x20with\x20phone\x20%s\x20not\x20found.',_0x163438);var _0x3d42ac={'LastName':_0x211602!==''?_0x211602:util['format'](_0xd83b('0x2c'),_0x163438),'Phone':_0x163438};if(_0x188a4f[_0xd83b('0x2d')]){switch(_0x188a4f[_0xd83b('0x2d')]){case _0xd83b('0x28'):logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x163438,_0x188a4f[_0xd83b('0x2d')]);break;case _0xd83b('0x29'):logger[_0xd83b('0x1e')](_0xd83b('0x2e'),_0x163438,_0x188a4f['moduleCreate']);_0x3d42ac[_0xd83b('0x2f')]=_0xd83b('0x30');break;default:return null;}}return _0x10be09[_0xd83b('0x14')](_[_0xd83b('0x31')](_0x188a4f[_0xd83b('0x2d')]))[_0xd83b('0x32')](_0x3d42ac);}});}function getCustomFields(_0x5b3796,_0x310d07){var _0xed1319={};if(_0x5b3796[_0xd83b('0x18')]>0x0){_[_0xd83b('0x33')](_0x5b3796,function(_0x3e0170){if(_0x3e0170[_0xd83b('0x34')]===_0xd83b('0x35')&&_0x3e0170[_0xd83b('0x36')]){_0xed1319[_0x3e0170[_0xd83b('0x36')]]=_0x3e0170[_0xd83b('0x37')][_0xd83b('0x38')]();}else if(_0x3e0170[_0xd83b('0x34')]===_0xd83b('0x39')&&_0x3e0170[_0xd83b('0x3a')]&&_0x3e0170[_0xd83b('0x36')]){_0x310d07[_0x3e0170['variableName']]&&(_0xed1319[_0x3e0170['idField']]=_0x310d07[_0x3e0170[_0xd83b('0x3a')]][_0xd83b('0x38')]());}else if(_0x3e0170[_0xd83b('0x34')]==='customVariable'&&_0x3e0170[_0xd83b('0x3b')]&&_0x3e0170[_0xd83b('0x3b')][_0xd83b('0x3c')]&&_0x3e0170[_0xd83b('0x36')]){_0x310d07[_0x3e0170[_0xd83b('0x3b')][_0xd83b('0x3c')][_0xd83b('0x3d')]()]&&(_0xed1319[_0x3e0170[_0xd83b('0x36')]]=_0x310d07[_0x3e0170['Variable'][_0xd83b('0x3c')][_0xd83b('0x3d')]()][_0xd83b('0x38')]());}});}return _0xed1319;}function getConnection(_0x345172){var _0x409eac=_0x345172[_0xd83b('0x3e')][_0xd83b('0x3f')](_0x345172[_0xd83b('0x40')]);var _0x46e967=new jsforce[(_0xd83b('0x41'))]({'oauth2':{'loginUrl':_0x345172[_0xd83b('0x42')]||'https://login.salesforce.com','clientId':_0x345172[_0xd83b('0x43')],'clientSecret':_0x345172[_0xd83b('0x44')]}});return _0x46e967[_0xd83b('0x45')](_0x345172[_0xd83b('0x46')],_0x409eac)[_0xd83b('0x17')](function(){logger[_0xd83b('0x1e')](_0xd83b('0x47'));return _0x46e967;});}exports[_0xd83b('0x48')]=function(_0x4e740c,_0x5bb1e3,_0x739f23,_0x27efd4,_0x36c305,_0x489f9e){var _0x3efb12,_0x4e3961,_0x294e7e,_0x2eab24;_0x489f9e['serverUrl']=intUtil[_0xd83b('0x49')](_0x489f9e[_0xd83b('0x4a')]);_0x489f9e[_0xd83b('0x42')]=intUtil[_0xd83b('0x49')](_0x489f9e[_0xd83b('0x42')]);if(_0x36c305&&_0x36c305[_0xd83b('0x4b')]){logger[_0xd83b('0x1e')](_0xd83b('0x4c'),_0xd83b('0x4d'));_0x5bb1e3[_0xd83b('0x4e')]=util[_0xd83b('0x4f')](_0xd83b('0x50'),_0x489f9e[_0xd83b('0x4a')],_0x5bb1e3[_0xd83b('0x51')],md5(_0x5bb1e3[_0xd83b('0x51')]));}else{_0x5bb1e3[_0xd83b('0x4e')]='';}return getConnection(_0x489f9e)[_0xd83b('0x17')](function(_0x55cc42){_0x2eab24=_0x55cc42;return getUser(_0x489f9e,_0x27efd4[_0xd83b('0x52')],_0x2eab24);})[_0xd83b('0x17')](function(_0x64d0c5){_0x3efb12=_0x64d0c5;return getEndUser(_0x489f9e,_0x739f23,_0x5bb1e3[_0xd83b('0x53')],_0x5bb1e3[_0xd83b('0x54')],_0x2eab24);})[_0xd83b('0x17')](function(_0x505152){_0x4e3961=_0x505152;return getTicket(_0x489f9e,_0x3efb12,_0x4e3961,_0x739f23,_0x5bb1e3,_0x739f23[_0xd83b('0x55')],_0x2eab24);})['then'](function(_0x4558ed){_0x294e7e=_0x4558ed;logger[_0xd83b('0x1e')](_0xd83b('0x56'),_0x294e7e['id']);logger[_0xd83b('0x1e')](_0xd83b('0x57'),_0x294e7e['id'],_0x27efd4['name'],_0x489f9e[_0xd83b('0x34')]);switch(_0x489f9e[_0xd83b('0x34')]){case'integrationTab':emit(util['format']('user:%s',_0x27efd4['name']),_0xd83b('0x58'),{'recordId':_0x294e7e['id']});break;case _0xd83b('0x59'):emit(util[_0xd83b('0x4f')](_0xd83b('0x5a'),_0x27efd4[_0xd83b('0x3c')]),_0xd83b('0x5b'),{'uri':util[_0xd83b('0x4f')](_0xd83b('0x5c'),_0x2eab24[_0xd83b('0x5d')],_0x294e7e['id'])});break;default:logger[_0xd83b('0x5e')](_0xd83b('0x5f'));}})[_0xd83b('0x60')](function(_0x5cb680){logger[_0xd83b('0x5e')](_0xd83b('0x4c'),JSON[_0xd83b('0x61')](_0x5cb680));});};exports[_0xd83b('0x62')]=function(_0x587987,_0x36211b,_0x284a6c,_0x399af7,_0x5adf64,_0x519a3c,_0xb78696){var _0x16fdb9,_0x4be7cd,_0x151de8,_0x2cefcb;_0x519a3c[_0xd83b('0x4a')]=intUtil['stripTrailingSlash'](_0x519a3c[_0xd83b('0x4a')]);_0x519a3c[_0xd83b('0x42')]=intUtil['stripTrailingSlash'](_0x519a3c[_0xd83b('0x42')]);if(_0xb78696&&_0xb78696[_0xd83b('0x63')]&&_0xb78696[_0xd83b('0x63')]!=='none'){logger[_0xd83b('0x1e')](_0xd83b('0x64'),_0xd83b('0x4d'));_0x36211b['recordingURL']=util[_0xd83b('0x4f')](_0xd83b('0x50'),_0x519a3c['serverUrl'],_0x36211b[_0xd83b('0x51')],md5(_0x36211b[_0xd83b('0x51')]));}return getConnection(_0x519a3c)[_0xd83b('0x17')](function(_0x2a2f2a){_0x2cefcb=_0x2a2f2a;return getUser(_0x519a3c,_0x399af7[_0xd83b('0x52')],_0x2cefcb);})['then'](function(_0x1515b2){_0x16fdb9=_0x1515b2;return getEndUser(_0x519a3c,_0x284a6c,_0x36211b[_0xd83b('0x65')],_0x36211b[_0xd83b('0x66')],_0x2cefcb);})[_0xd83b('0x17')](function(_0x2dce06){_0x4be7cd=_0x2dce06;return getTicket(_0x519a3c,_0x16fdb9,_0x4be7cd,_0x284a6c,_0x36211b,_0x284a6c['Fields'],_0x2cefcb);})[_0xd83b('0x17')](function(_0x255aaa){_0x151de8=_0x255aaa;logger[_0xd83b('0x1e')](_0xd83b('0x67'),_0x151de8['id']);logger[_0xd83b('0x1e')](_0xd83b('0x68'),_0x151de8['id'],_0x399af7[_0xd83b('0x3c')],_0x519a3c['type']);switch(_0x519a3c[_0xd83b('0x34')]){case _0xd83b('0x69'):emit(util[_0xd83b('0x4f')](_0xd83b('0x5a'),_0x399af7[_0xd83b('0x3c')]),'trigger:salesforce:display',{'recordId':_0x151de8['id']});break;case _0xd83b('0x59'):emit(util['format'](_0xd83b('0x5a'),_0x399af7['name']),_0xd83b('0x5b'),{'uri':util[_0xd83b('0x4f')](_0xd83b('0x5c'),_0x2cefcb[_0xd83b('0x5d')],_0x151de8['id'])});break;default:logger[_0xd83b('0x5e')](_0xd83b('0x64'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xd83b('0x60')](function(_0x4f948f){logger[_0xd83b('0x5e')](_0xd83b('0x64'),JSON[_0xd83b('0x61')](_0x4f948f));});};exports[_0xd83b('0x6a')]=function(_0xb9f6f5,_0x3ddaa2,_0x5cfbba,_0xc2b9d0,_0x259b60,_0x54b91c){var _0x6b8573,_0x1e9f73,_0x556c14,_0x219b74;_0x54b91c[_0xd83b('0x4a')]=intUtil[_0xd83b('0x49')](_0x54b91c['serverUrl']);_0x54b91c[_0xd83b('0x42')]=intUtil['stripTrailingSlash'](_0x54b91c[_0xd83b('0x42')]);if(_0x259b60&&_0x259b60[_0xd83b('0x4b')]){logger[_0xd83b('0x1e')](_0xd83b('0x6b'),_0xd83b('0x4d'));_0x3ddaa2[_0xd83b('0x4e')]=util[_0xd83b('0x4f')](_0xd83b('0x50'),_0x54b91c[_0xd83b('0x4a')],_0x3ddaa2[_0xd83b('0x51')],md5(_0x3ddaa2['uniqueid']));}else{_0x3ddaa2['recordingURL']='';}return getConnection(_0x54b91c)[_0xd83b('0x17')](function(_0x1433c6){_0x219b74=_0x1433c6;return getUser(_0x54b91c,_0xc2b9d0[_0xd83b('0x52')],_0x219b74);})[_0xd83b('0x17')](function(_0x4eafb4){_0x6b8573=_0x4eafb4;return getEndUser(_0x54b91c,_0x5cfbba,_0x3ddaa2[_0xd83b('0x53')],_0x3ddaa2['calleridnum'],_0x219b74);})['then'](function(_0x3443f4){_0x1e9f73=_0x3443f4;return getTicket(_0x54b91c,_0x6b8573,_0x1e9f73,_0x5cfbba,_0x3ddaa2,_0x5cfbba[_0xd83b('0x55')],_0x219b74);})[_0xd83b('0x17')](function(_0x396c40){_0x556c14=_0x396c40;logger[_0xd83b('0x1e')](_0xd83b('0x6c'),_0x556c14['id']);logger[_0xd83b('0x1e')](_0xd83b('0x6d'),_0x54b91c[_0xd83b('0x34')]);})[_0xd83b('0x60')](function(_0x592632){logger[_0xd83b('0x5e')](_0xd83b('0x6b'),JSON[_0xd83b('0x61')](_0x592632));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/servicenow.js b/server/services/ami/trigger/integration/servicenow.js index 5659950..5f4a2e7 100644 --- a/server/services/ami/trigger/integration/servicenow.js +++ b/server/services/ami/trigger/integration/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53af=['all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','serverUrl','%s/api/now/table/','remoteUri','email','destcalleridnum','callDirection','queue','abandoned','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','GET','result','length','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','userId','adminEmail','],\x20getUser\x20crm','sys_user?','user','true','System','endUserNumber','then','],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','forEach','string','nameField','customField','idField','toLowerCase','content','toString','type','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','Incident','push'];(function(_0x49063e,_0x4a6d30){var _0x52876d=function(_0x27d4b8){while(--_0x27d4b8){_0x49063e['push'](_0x49063e['shift']());}};_0x52876d(++_0x4a6d30);}(_0x53af,0x159));var _0xf53a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x53af[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xf53a('0x0'));var Promise=require(_0xf53a('0x1'));var rp=require('request-promise');var util=require('util');var md5=require('md5');var Redis=require(_0xf53a('0x2'));var intUtil=require(_0xf53a('0x3'));var config=require(_0xf53a('0x4'));var logger=require(_0xf53a('0x5'))(_0xf53a('0x6'));config[_0xf53a('0x7')]=_[_0xf53a('0x8')](config['redis'],{'host':_0xf53a('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf53a('0x7')]));function getAdminUser(_0x23b22d,_0x21a0a6,_0x2c3d14,_0x37e794,_0x47ab5b,_0x44f1b7){return new Promise(function(_0x5d1b88,_0x18f216){var _0x24b3b1={'method':_0xf53a('0xa'),'uri':_0x37e794+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x47ab5b+'&'+_0x44f1b7,'auth':_0x21a0a6,'json':!![]};return rp(_0x24b3b1)['then'](function(_0x88ad9){if(_0x88ad9[_0xf53a('0xb')][_0xf53a('0xc')]>0x0){_0x2c3d14[_0xf53a('0xd')]=_0x88ad9[_0xf53a('0xb')][0x0][_0xf53a('0xe')];}logger[_0xf53a('0xf')]('['+[_0x23b22d['toUpperCase']()]+_0xf53a('0x10'),_0x2c3d14);_0x5d1b88(_0x2c3d14);})[_0xf53a('0x11')](function(_0x2851c3){logger[_0xf53a('0x12')]('['+[_0x23b22d[_0xf53a('0x13')]()]+']',_0x2851c3[_0xf53a('0x14')]);_0x18f216(_0x2851c3[_0xf53a('0x14')]);});});}function getUser(_0x5d36bd,_0x2d1fdc,_0x25ae3c,_0x1ebdb8,_0x42cb83){return function(_0x4052eb){logger['info']('['+[_0x5d36bd[_0xf53a('0x13')]()]+_0xf53a('0x15'),_0x4052eb);return new Promise(function(_0x3f90fe,_0x37e45c){var _0x15125e={'method':_0xf53a('0xa'),'uri':_0x25ae3c+'sys_user?sysparm_query=email%3D'+_0x4052eb[_0xf53a('0x16')]+'&'+_0x1ebdb8+'&'+_0x42cb83,'auth':_0x2d1fdc,'json':!![]};logger[_0xf53a('0xf')]('['+[_0x5d36bd[_0xf53a('0x13')]()]+_0xf53a('0x17'),_0x15125e);return rp(_0x15125e)['then'](function(_0x26f9f6){logger[_0xf53a('0xf')]('['+[_0x5d36bd[_0xf53a('0x13')]()]+_0xf53a('0x18'),_0x26f9f6);if(_0x26f9f6['result']['length']>0x0&&intUtil['validateEmail'](_0x4052eb[_0xf53a('0x16')])){_0x4052eb['userId']=_0x26f9f6[_0xf53a('0xb')][0x0][_0xf53a('0xe')];}else{_0x4052eb[_0xf53a('0x19')]=_0x4052eb[_0xf53a('0xd')];_0x4052eb[_0xf53a('0x16')]=_0x4052eb[_0xf53a('0x1a')];}logger[_0xf53a('0xf')]('['+[_0x5d36bd['toUpperCase']()]+_0xf53a('0x1b'),_0x4052eb);_0x3f90fe(_0x4052eb);})['catch'](function(_0xa80681){logger[_0xf53a('0x12')]('['+[_0x5d36bd['toUpperCase']()]+']',_0xa80681['message']);_0x37e45c(_0xa80681[_0xf53a('0x14')]);});});};}function createEndUser(_0x1f5856,_0x4d55f2,_0x516a6e,_0x3c668c,_0x38599e){logger[_0xf53a('0xf')]('['+[_0x1f5856[_0xf53a('0x13')]()]+'],\x20createEndUser\x20input\x20crm',_0x516a6e);return new Promise(function(_0xd72311,_0x525930){var _0x2406f7={'method':'POST','uri':_0x3c668c+_0xf53a('0x1c')+_0x38599e,'body':{'user_name':_0x516a6e['endUserNumber'],'roles':_0xf53a('0x1d'),'first_name':_0x516a6e['endUserNumber'],'active':_0xf53a('0x1e'),'date_format':_0xf53a('0x1f'),'phone':_0x516a6e[_0xf53a('0x20')]},'auth':_0x4d55f2,'json':!![]};return rp(_0x2406f7)[_0xf53a('0x21')](function(_0x2a4ff1){logger['info']('['+[_0x1f5856[_0xf53a('0x13')]()]+_0xf53a('0x22'),_0x2a4ff1['result']);_0x516a6e['endUserId']=_0x2a4ff1[_0xf53a('0xb')][_0xf53a('0xe')];_0xd72311(_0x516a6e);})['catch'](function(_0x4a3fbb){logger[_0xf53a('0x12')]('['+[_0x1f5856[_0xf53a('0x13')]()]+']',_0x4a3fbb['message']);_0x525930(_0x4a3fbb['message']);});});}function getEndUser(_0x3cecf3,_0x398a6d,_0x17d285,_0x3a2f4a,_0x202a37){return function(_0xf12ad0){logger[_0xf53a('0xf')]('['+[_0x3cecf3[_0xf53a('0x13')]()]+'],\x20getEndUser\x20input\x20crm',_0xf12ad0);return new Promise(function(_0x5e7bc1,_0x175fd4){var _0x2c8b33={'method':_0xf53a('0xa'),'uri':_0x17d285+_0xf53a('0x23')+_0xf12ad0[_0xf53a('0x20')]+'&'+_0x3a2f4a+'&'+_0x202a37,'auth':_0x398a6d,'json':!![]};return rp(_0x2c8b33)[_0xf53a('0x21')](function(_0xee40ff){if(_0xee40ff[_0xf53a('0xb')][_0xf53a('0xc')]>0x0){_0xf12ad0[_0xf53a('0x24')]=_0xee40ff['result'][0x0][_0xf53a('0xe')];logger[_0xf53a('0xf')]('['+[_0x3cecf3['toUpperCase']()]+_0xf53a('0x25'),_0xf12ad0);_0x5e7bc1(_0xf12ad0);}else{return createEndUser(_0x3cecf3,_0x398a6d,_0xf12ad0,_0x17d285,_0x3a2f4a)[_0xf53a('0x21')](function(_0x10bfcd){logger['info']('['+[_0x3cecf3[_0xf53a('0x13')]()]+'],\x20createEndUser\x20crm',_0x10bfcd);_0x5e7bc1(_0x10bfcd);});}})[_0xf53a('0x11')](function(_0x4a3031){logger[_0xf53a('0x12')]('['+[_0x3cecf3[_0xf53a('0x13')]()]+']',_0x4a3031['message']);_0x175fd4(_0x4a3031[_0xf53a('0x14')]);});});};}function getCustomFields(_0x16e705,_0x14c70d){var _0xb2e861={};if(_0x16e705[_0xf53a('0xc')]>0x0){_[_0xf53a('0x26')](_0x16e705,function(_0x194127){if(_0x194127['type']===_0xf53a('0x27')&&_0x194127[_0xf53a('0x28')]&&!_0x194127[_0xf53a('0x29')]){_0xb2e861[_0x194127[_0xf53a('0x2a')][_0xf53a('0x2b')]()]=_0x194127[_0xf53a('0x2c')][_0xf53a('0x2d')]();}else if(_0x194127[_0xf53a('0x2e')]===_0xf53a('0x27')&&_0x194127[_0xf53a('0x2a')]&&_0x194127[_0xf53a('0x29')]){_0xb2e861[_0x194127[_0xf53a('0x2a')]['toLowerCase']()]=_0x194127['content']['toString']();}else if(_0x194127[_0xf53a('0x2e')]===_0xf53a('0x2f')&&_0x194127[_0xf53a('0x30')]&&_0x194127[_0xf53a('0x2a')]&&_0x194127['customField']){_0xb2e861[_0x194127[_0xf53a('0x2a')][_0xf53a('0x2b')]()]=_0x14c70d[_0x194127['variableName']][_0xf53a('0x2d')]();}else if(_0x194127[_0xf53a('0x2e')]===_0xf53a('0x31')&&_0x194127['Variable']&&_0x194127[_0xf53a('0x32')][_0xf53a('0x33')]&&_0x194127[_0xf53a('0x2a')]&&_0x194127[_0xf53a('0x29')]){_0xb2e861[_0x194127[_0xf53a('0x2a')][_0xf53a('0x2b')]()]=_0x14c70d[_0x194127['Variable'][_0xf53a('0x33')][_0xf53a('0x2b')]()][_0xf53a('0x2d')]();}});}return _0xb2e861;}function getTicket(_0x47a65e,_0xd9d0dc,_0x366464,_0x49e98f,_0xbb6c8f,_0x7fe364){return function(_0xd2ad8){logger[_0xf53a('0xf')]('['+[_0x47a65e[_0xf53a('0x13')]()]+_0xf53a('0x34'),_0xd2ad8);return new Promise(function(_0x3e7369,_0x1d7746){var _0x24ae33=_0x47a65e[_0xf53a('0x2b')]()===_0xf53a('0x35')?_0xd2ad8[_0xf53a('0x19')]:_0xd2ad8[_0xf53a('0x24')];var _0x26cc13={'method':_0xf53a('0x36'),'uri':_0x366464+_0xf53a('0x37')+'?'+_0x7fe364,'body':Object[_0xf53a('0x38')]({},{'active':_0xf53a('0x1e'),'caller_id':_0x24ae33,'short_description':intUtil[_0xf53a('0x39')](_0x49e98f['Subjects'],_0xbb6c8f,'\x20'),'description':intUtil[_0xf53a('0x39')](_0x49e98f[_0xf53a('0x3a')],_0xbb6c8f,'\x0a')},getCustomFields(_0x49e98f[_0xf53a('0x3b')],_0xbb6c8f)),'auth':_0xd9d0dc,'json':!![]};return rp(_0x26cc13)[_0xf53a('0x21')](function(_0x4dd89a){logger[_0xf53a('0xf')]('['+[_0x47a65e['toUpperCase']()]+_0xf53a('0x3c'),_0x4dd89a['result']);_0xd2ad8[_0xf53a('0x3d')]=_0x4dd89a[_0xf53a('0xb')]['sys_id'];_0xd2ad8[_0xf53a('0x3e')]=_0x4dd89a[_0xf53a('0xb')][_0xf53a('0x3f')];logger[_0xf53a('0xf')]('['+[_0x47a65e['toUpperCase']()]+']\x20getTicket\x20crm',_0xd2ad8);_0x3e7369(_0xd2ad8);})[_0xf53a('0x11')](function(_0x174567){logger[_0xf53a('0x12')]('['+[_0x47a65e[_0xf53a('0x13')]()]+']',_0x174567[_0xf53a('0x14')]);_0x1d7746(_0x174567[_0xf53a('0x14')]);});});};}function createRemoteTag(_0xafe2c7,_0x26a41d,_0x1a4f0c,_0x1e3e06){return new Promise(function(_0xb94b21,_0x220d6e){var _0x550af2={'method':_0xf53a('0x36'),'uri':_0x1a4f0c+'label'+'?'+_0x1e3e06,'body':{'short_description':_0xafe2c7,'global':!![],'active':!![],'name':_0xafe2c7},'auth':_0x26a41d,'json':!![]};return rp(_0x550af2)[_0xf53a('0x21')](function(_0x589609){var _0x4ac20f=_0x589609['result']['sys_id'];_0xb94b21(_0x4ac20f);});});}function getRemoteTag(_0x503020,_0x20848d,_0x4217eb,_0x3abbf4,_0x58e593){return new Promise(function(_0x2c93b6,_0x739293){var _0x23164d={'method':'GET','uri':_0x4217eb+_0xf53a('0x40')+'?sysparm_query=name%3D'+_0x503020+'&'+_0x3abbf4,'auth':_0x20848d,'json':!![]};return rp(_0x23164d)[_0xf53a('0x21')](function(_0x14058a){if(_0x14058a[_0xf53a('0xb')]['length']>0x0){var _0x1465d2=_0x14058a['result'][0x0]['sys_id'];_0x2c93b6(_0x1465d2);}else{return createRemoteTag(_0x503020,_0x20848d,_0x4217eb,_0x3abbf4)[_0xf53a('0x21')](function(_0xc46009){_0x2c93b6(_0xc46009);});}});});}function assignTagToIncident(_0x311e10,_0xa87800,_0x897111,_0x28eadd,_0x44c82c){return new Promise(function(_0x42bcd0,_0x1479cb){var _0x8f6050={'method':_0xf53a('0x36'),'uri':_0x897111+'label_entry'+'?'+_0x44c82c,'body':{'label':_0x311e10,'table':_0xf53a('0x37'),'id_type':_0xf53a('0x41'),'table_key':_0x28eadd[_0xf53a('0x3d')],'title':'Incident\x20-\x20'+_0x28eadd[_0xf53a('0x3e')],'id_display':_0x28eadd[_0xf53a('0x3e')]},'auth':_0xa87800,'json':!![]};return rp(_0x8f6050)['then'](function(_0x2dae78){_0x42bcd0();})[_0xf53a('0x11')](function(){_0x42bcd0();});});}function manageTags(_0x16fd38,_0x8dfe2b,_0x151a3e,_0x554313,_0x243328,_0x39a1b2,_0x3d5171){return new Promise(function(_0x4d7ff2,_0x1e0bd9){var _0x477f78=[];_0x8dfe2b['forEach'](function(_0x47854a){_0x477f78[_0xf53a('0x42')](getRemoteTag(_0x47854a,_0x151a3e,_0x554313,_0x39a1b2,_0x3d5171));});return Promise[_0xf53a('0x43')](_0x477f78)[_0xf53a('0x21')](function(_0x384d02){if(_0x384d02[_0xf53a('0xc')]){logger['info']('['+[_0x16fd38[_0xf53a('0x13')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x384d02);var _0x706e90=[];_0x384d02['forEach'](function(_0x3448a4){_0x706e90[_0xf53a('0x42')](assignTagToIncident(_0x3448a4,_0x151a3e,_0x554313,_0x243328,_0x39a1b2));});return Promise[_0xf53a('0x43')](_0x706e90)[_0xf53a('0x21')](function(){_0x4d7ff2();})[_0xf53a('0x11')](function(){_0x4d7ff2();});}else{_0x4d7ff2();}});});}function getTags(_0x202054,_0x5157d2,_0xf22211,_0x181ce9,_0x500e79,_0x411705){return function(_0x561755){return new Promise(function(_0x14d2e4,_0x1d546e){var _0x4ddf95=[];var _0x15f3be=_0x181ce9[_0xf53a('0x44')];if(_0x15f3be&&_0x15f3be['length']>0x0){_0x4ddf95=_[_0xf53a('0x45')](_0x15f3be,'name');}if(_0x4ddf95[_0xf53a('0xc')]>0x0){return manageTags(_0x202054,_0x4ddf95,_0x5157d2,_0xf22211,_0x561755,_0x500e79,_0x411705)[_0xf53a('0x21')](function(){_0x14d2e4(_0x561755);});}else{_0x14d2e4(_0x561755);}});};}function emit(_0x203b6f,_0x563c6c,_0xfcb335){var _0x3b34f4=_0xf53a('0x46')+_0xf53a('0x47')+_0xf53a('0x48')+_0xf53a('0x49');var _0x378398={'uri':_0x203b6f+_0xf53a('0x4a')+_0xfcb335+_0x3b34f4};io['to'](util[_0xf53a('0x4b')]('user:%s',_0x563c6c))[_0xf53a('0x4c')](_0xf53a('0x4d'),_0x378398);}exports['cs']=function(_0x2199a9,_0x3ae908,_0x39b5e0,_0x1b15a8,_0x2eb43c,_0x2a15ac,_0x18a992,_0x3e0879){var _0x907fb7={};var _0xaf066={'user':_0x2a15ac[_0xf53a('0x4e')],'pass':_0x2a15ac[_0xf53a('0x4f')]};var _0x4f9de9=_0xf53a('0x50');var _0x39dcb8=_0xf53a('0x51');_0x2a15ac['remoteUri']=intUtil[_0xf53a('0x52')](_0x2a15ac['remoteUri']);_0x2a15ac[_0xf53a('0x53')]=intUtil[_0xf53a('0x52')](_0x2a15ac[_0xf53a('0x53')]);var _0x2bc0aa=util['format'](_0xf53a('0x54'),_0x2a15ac[_0xf53a('0x55')]);_0x907fb7['userEmail']=_0x1b15a8[_0xf53a('0x56')];_0x907fb7[_0xf53a('0x1a')]=_0x2a15ac[_0xf53a('0x56')];_0x907fb7['endUserNumber']=_0x3e0879['toLowerCase']()===_0xf53a('0x35')?_0x3ae908[_0xf53a('0x57')]:_0x3ae908['calleridnum'];_0x907fb7[_0xf53a('0x58')]=_0x3e0879===_0xf53a('0x59')||_0x3e0879===_0xf53a('0x5a')?'queue':'outbound';var _0x2ebe2f=util['format'](_0xf53a('0x5b'),_0x2a15ac['serverUrl'],_0x3ae908[_0xf53a('0x5c')],md5(_0x3ae908[_0xf53a('0x5c')]));if(_0x2eb43c&&_0x2eb43c['monitor_format']){logger[_0xf53a('0xf')](_0xf53a('0x5d'),_0xf53a('0x5e'));_0x3ae908[_0xf53a('0x5f')]=_0x2ebe2f;}else if(_0x18a992&&_0x18a992[_0xf53a('0x60')]&&_0x18a992[_0xf53a('0x60')]!==_0xf53a('0x61')){logger[_0xf53a('0xf')](_0xf53a('0x62'),_0xf53a('0x5e'));_0x3ae908[_0xf53a('0x5f')]=_0x2ebe2f;}else{_0x3ae908[_0xf53a('0x5f')]='';}return getAdminUser(_0x3e0879,_0xaf066,_0x907fb7,_0x2bc0aa,_0x39dcb8,_0x4f9de9)['then'](getUser(_0x3e0879,_0xaf066,_0x2bc0aa,_0x39dcb8,_0x4f9de9))[_0xf53a('0x21')](getEndUser(_0x3e0879,_0xaf066,_0x2bc0aa,_0x39dcb8,_0x4f9de9))['then'](getTicket(_0x3e0879,_0xaf066,_0x2bc0aa,_0x39b5e0,_0x3ae908,_0x39dcb8))['then'](function(_0xe403a3){logger[_0xf53a('0xf')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0xe403a3[_0xf53a('0x3d')]));logger['info'](util[_0xf53a('0x4b')](_0xf53a('0x63'),_0x3e0879));if(_0x3e0879!==_0xf53a('0x5a')){logger['info']('['+[_0x3e0879[_0xf53a('0x13')]()]+']',_0xf53a('0x64'));emit(_0x2a15ac[_0xf53a('0x55')],_0x1b15a8[_0xf53a('0x33')],_0xe403a3['ticketId']);}})[_0xf53a('0x11')](function(_0x312a6d){logger['error']('['+[_0x3e0879[_0xf53a('0x13')]()]+_0xf53a('0x65'),util[_0xf53a('0x66')](_0x312a6d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8e21=['info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','],\x20getUser\x20input\x20crm','GET','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','then','result','validateEmail','userId','sys_id','],\x20getUser\x20crm','message','POST','sys_user?','user','endUserNumber','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','length','forEach','type','nameField','customField','idField','content','toString','toLowerCase','variable','variableName','customVariable','Variable','name','outbound','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','incident','Incident','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','adminEmail','destcalleridnum','calleridnum','callDirection','queue','abandoned','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin'];(function(_0x107573,_0x510db7){var _0x18559d=function(_0x5ff6cb){while(--_0x5ff6cb){_0x107573['push'](_0x107573['shift']());}};_0x18559d(++_0x510db7);}(_0x8e21,0x198));var _0x18e2=function(_0x1f62c3,_0x1ff95b){_0x1f62c3=_0x1f62c3-0x0;var _0x385c1c=_0x8e21[_0x1f62c3];return _0x385c1c;};'use strict';var _=require(_0x18e2('0x0'));var Promise=require(_0x18e2('0x1'));var rp=require('request-promise');var util=require('util');var md5=require(_0x18e2('0x2'));var Redis=require(_0x18e2('0x3'));var intUtil=require(_0x18e2('0x4'));var config=require(_0x18e2('0x5'));var logger=require(_0x18e2('0x6'))('servicenow');config['redis']=_[_0x18e2('0x7')](config[_0x18e2('0x8')],{'host':_0x18e2('0x9'),'port':0x18eb});var io=require(_0x18e2('0xa'))(new Redis(config[_0x18e2('0x8')]));function getAdminUser(_0x2f18f2,_0x5f4ef5,_0x38d49c,_0x32f652,_0x199cf2,_0x4a5876){return new Promise(function(_0x4a4d07,_0x18c3f8){var _0x497416={'method':'GET','uri':_0x32f652+_0x18e2('0xb')+'&'+_0x199cf2+'&'+_0x4a5876,'auth':_0x5f4ef5,'json':!![]};return rp(_0x497416)['then'](function(_0x32a8b1){if(_0x32a8b1['result']['length']>0x0){_0x38d49c['adminId']=_0x32a8b1['result'][0x0]['sys_id'];}logger[_0x18e2('0xc')]('['+[_0x2f18f2[_0x18e2('0xd')]()]+_0x18e2('0xe'),_0x38d49c);_0x4a4d07(_0x38d49c);})[_0x18e2('0xf')](function(_0x3e45af){logger[_0x18e2('0x10')]('['+[_0x2f18f2[_0x18e2('0xd')]()]+']',_0x3e45af['message']);_0x18c3f8(_0x3e45af['message']);});});}function getUser(_0x1ddd1c,_0x5c08c3,_0x410f93,_0xfa3915,_0x2332d1){return function(_0x3ee6b5){logger[_0x18e2('0xc')]('['+[_0x1ddd1c[_0x18e2('0xd')]()]+_0x18e2('0x11'),_0x3ee6b5);return new Promise(function(_0x5c0af7,_0x13062d){var _0x2f111a={'method':_0x18e2('0x12'),'uri':_0x410f93+_0x18e2('0x13')+_0x3ee6b5[_0x18e2('0x14')]+'&'+_0xfa3915+'&'+_0x2332d1,'auth':_0x5c08c3,'json':!![]};logger[_0x18e2('0xc')]('['+[_0x1ddd1c[_0x18e2('0xd')]()]+_0x18e2('0x15'),_0x2f111a);return rp(_0x2f111a)[_0x18e2('0x16')](function(_0x4234e8){logger['info']('['+[_0x1ddd1c[_0x18e2('0xd')]()]+'],\x20getUser\x20entity',_0x4234e8);if(_0x4234e8[_0x18e2('0x17')]['length']>0x0&&intUtil[_0x18e2('0x18')](_0x3ee6b5[_0x18e2('0x14')])){_0x3ee6b5[_0x18e2('0x19')]=_0x4234e8[_0x18e2('0x17')][0x0][_0x18e2('0x1a')];}else{_0x3ee6b5['userId']=_0x3ee6b5['adminId'];_0x3ee6b5['userEmail']=_0x3ee6b5['adminEmail'];}logger['info']('['+[_0x1ddd1c[_0x18e2('0xd')]()]+_0x18e2('0x1b'),_0x3ee6b5);_0x5c0af7(_0x3ee6b5);})[_0x18e2('0xf')](function(_0x119541){logger['error']('['+[_0x1ddd1c[_0x18e2('0xd')]()]+']',_0x119541[_0x18e2('0x1c')]);_0x13062d(_0x119541[_0x18e2('0x1c')]);});});};}function createEndUser(_0x4dfcb8,_0x24b1ef,_0xc0c0d9,_0x2c3b58,_0x11c053){logger[_0x18e2('0xc')]('['+[_0x4dfcb8['toUpperCase']()]+'],\x20createEndUser\x20input\x20crm',_0xc0c0d9);return new Promise(function(_0xed8973,_0x3345e5){var _0x1fd620={'method':_0x18e2('0x1d'),'uri':_0x2c3b58+_0x18e2('0x1e')+_0x11c053,'body':{'user_name':_0xc0c0d9['endUserNumber'],'roles':_0x18e2('0x1f'),'first_name':_0xc0c0d9[_0x18e2('0x20')],'active':_0x18e2('0x21'),'date_format':_0x18e2('0x22'),'phone':_0xc0c0d9[_0x18e2('0x20')]},'auth':_0x24b1ef,'json':!![]};return rp(_0x1fd620)['then'](function(_0x363a64){logger[_0x18e2('0xc')]('['+[_0x4dfcb8[_0x18e2('0xd')]()]+_0x18e2('0x23'),_0x363a64[_0x18e2('0x17')]);_0xc0c0d9[_0x18e2('0x24')]=_0x363a64[_0x18e2('0x17')][_0x18e2('0x1a')];_0xed8973(_0xc0c0d9);})['catch'](function(_0x2fc57e){logger[_0x18e2('0x10')]('['+[_0x4dfcb8['toUpperCase']()]+']',_0x2fc57e['message']);_0x3345e5(_0x2fc57e[_0x18e2('0x1c')]);});});}function getEndUser(_0x46f569,_0xa2e53e,_0x20003f,_0x4c024a,_0x25128f){return function(_0x380d01){logger['info']('['+[_0x46f569[_0x18e2('0xd')]()]+_0x18e2('0x25'),_0x380d01);return new Promise(function(_0x495f50,_0x415f17){var _0x44e184={'method':_0x18e2('0x12'),'uri':_0x20003f+_0x18e2('0x26')+_0x380d01['endUserNumber']+'&'+_0x4c024a+'&'+_0x25128f,'auth':_0xa2e53e,'json':!![]};return rp(_0x44e184)['then'](function(_0x4a9ba8){if(_0x4a9ba8[_0x18e2('0x17')][_0x18e2('0x27')]>0x0){_0x380d01[_0x18e2('0x24')]=_0x4a9ba8[_0x18e2('0x17')][0x0]['sys_id'];logger[_0x18e2('0xc')]('['+[_0x46f569['toUpperCase']()]+'],\x20getEndUser\x20crm',_0x380d01);_0x495f50(_0x380d01);}else{return createEndUser(_0x46f569,_0xa2e53e,_0x380d01,_0x20003f,_0x4c024a)[_0x18e2('0x16')](function(_0x2feb17){logger[_0x18e2('0xc')]('['+[_0x46f569['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x2feb17);_0x495f50(_0x2feb17);});}})[_0x18e2('0xf')](function(_0x29eac0){logger[_0x18e2('0x10')]('['+[_0x46f569[_0x18e2('0xd')]()]+']',_0x29eac0['message']);_0x415f17(_0x29eac0[_0x18e2('0x1c')]);});});};}function getCustomFields(_0x3d729d,_0x3cd039){var _0xbee824={};if(_0x3d729d[_0x18e2('0x27')]>0x0){_[_0x18e2('0x28')](_0x3d729d,function(_0x2ef651){if(_0x2ef651[_0x18e2('0x29')]==='string'&&_0x2ef651[_0x18e2('0x2a')]&&!_0x2ef651[_0x18e2('0x2b')]){_0xbee824[_0x2ef651[_0x18e2('0x2c')]['toLowerCase']()]=_0x2ef651[_0x18e2('0x2d')][_0x18e2('0x2e')]();}else if(_0x2ef651[_0x18e2('0x29')]==='string'&&_0x2ef651['idField']&&_0x2ef651[_0x18e2('0x2b')]){_0xbee824[_0x2ef651[_0x18e2('0x2c')][_0x18e2('0x2f')]()]=_0x2ef651['content'][_0x18e2('0x2e')]();}else if(_0x2ef651[_0x18e2('0x29')]===_0x18e2('0x30')&&_0x2ef651[_0x18e2('0x31')]&&_0x2ef651[_0x18e2('0x2c')]&&_0x2ef651[_0x18e2('0x2b')]){_0xbee824[_0x2ef651[_0x18e2('0x2c')][_0x18e2('0x2f')]()]=_0x3cd039[_0x2ef651['variableName']]['toString']();}else if(_0x2ef651[_0x18e2('0x29')]===_0x18e2('0x32')&&_0x2ef651['Variable']&&_0x2ef651[_0x18e2('0x33')]['name']&&_0x2ef651[_0x18e2('0x2c')]&&_0x2ef651[_0x18e2('0x2b')]){_0xbee824[_0x2ef651[_0x18e2('0x2c')]['toLowerCase']()]=_0x3cd039[_0x2ef651[_0x18e2('0x33')][_0x18e2('0x34')]['toLowerCase']()]['toString']();}});}return _0xbee824;}function getTicket(_0x410734,_0x1e4985,_0x4f9bc4,_0xd18f60,_0x2ed862,_0x5572cf){return function(_0x2a685d){logger[_0x18e2('0xc')]('['+[_0x410734[_0x18e2('0xd')]()]+']\x20getTicket\x20input\x20crm',_0x2a685d);return new Promise(function(_0x2d6559,_0x1a462b){var _0x411904=_0x410734[_0x18e2('0x2f')]()===_0x18e2('0x35')?_0x2a685d['userId']:_0x2a685d[_0x18e2('0x24')];var _0x46ab91={'method':_0x18e2('0x1d'),'uri':_0x4f9bc4+'incident'+'?'+_0x5572cf,'body':Object[_0x18e2('0x36')]({},{'active':'true','caller_id':_0x411904,'short_description':intUtil[_0x18e2('0x37')](_0xd18f60[_0x18e2('0x38')],_0x2ed862,'\x20'),'description':intUtil[_0x18e2('0x37')](_0xd18f60[_0x18e2('0x39')],_0x2ed862,'\x0a')},getCustomFields(_0xd18f60[_0x18e2('0x3a')],_0x2ed862)),'auth':_0x1e4985,'json':!![]};return rp(_0x46ab91)[_0x18e2('0x16')](function(_0x5ccdd7){logger['info']('['+[_0x410734['toUpperCase']()]+_0x18e2('0x3b'),_0x5ccdd7[_0x18e2('0x17')]);_0x2a685d[_0x18e2('0x3c')]=_0x5ccdd7['result'][_0x18e2('0x1a')];_0x2a685d[_0x18e2('0x3d')]=_0x5ccdd7[_0x18e2('0x17')][_0x18e2('0x3e')];logger['info']('['+[_0x410734[_0x18e2('0xd')]()]+_0x18e2('0x3f'),_0x2a685d);_0x2d6559(_0x2a685d);})['catch'](function(_0x3f7414){logger[_0x18e2('0x10')]('['+[_0x410734[_0x18e2('0xd')]()]+']',_0x3f7414[_0x18e2('0x1c')]);_0x1a462b(_0x3f7414[_0x18e2('0x1c')]);});});};}function createRemoteTag(_0x90b96f,_0x12ba52,_0x11f646,_0xc40c96){return new Promise(function(_0x3eefef,_0x28f34d){var _0x2b383a={'method':_0x18e2('0x1d'),'uri':_0x11f646+_0x18e2('0x40')+'?'+_0xc40c96,'body':{'short_description':_0x90b96f,'global':!![],'active':!![],'name':_0x90b96f},'auth':_0x12ba52,'json':!![]};return rp(_0x2b383a)['then'](function(_0x159971){var _0x3e6350=_0x159971[_0x18e2('0x17')][_0x18e2('0x1a')];_0x3eefef(_0x3e6350);});});}function getRemoteTag(_0x142e61,_0x3d5a91,_0x2fe698,_0x5354d7,_0x3caf91){return new Promise(function(_0xdee9eb,_0x442533){var _0xd6a906={'method':_0x18e2('0x12'),'uri':_0x2fe698+_0x18e2('0x40')+_0x18e2('0x41')+_0x142e61+'&'+_0x5354d7,'auth':_0x3d5a91,'json':!![]};return rp(_0xd6a906)['then'](function(_0x1b0a13){if(_0x1b0a13[_0x18e2('0x17')][_0x18e2('0x27')]>0x0){var _0x32cb0d=_0x1b0a13[_0x18e2('0x17')][0x0][_0x18e2('0x1a')];_0xdee9eb(_0x32cb0d);}else{return createRemoteTag(_0x142e61,_0x3d5a91,_0x2fe698,_0x5354d7)[_0x18e2('0x16')](function(_0x265f49){_0xdee9eb(_0x265f49);});}});});}function assignTagToIncident(_0x4ad4b0,_0x1ab2c6,_0x4d1f5b,_0x3eacbb,_0x354484){return new Promise(function(_0x55d7e2,_0x20de13){var _0x561839={'method':_0x18e2('0x1d'),'uri':_0x4d1f5b+_0x18e2('0x42')+'?'+_0x354484,'body':{'label':_0x4ad4b0,'table':_0x18e2('0x43'),'id_type':_0x18e2('0x44'),'table_key':_0x3eacbb[_0x18e2('0x3c')],'title':'Incident\x20-\x20'+_0x3eacbb[_0x18e2('0x3d')],'id_display':_0x3eacbb[_0x18e2('0x3d')]},'auth':_0x1ab2c6,'json':!![]};return rp(_0x561839)[_0x18e2('0x16')](function(_0x5c38d1){_0x55d7e2();})[_0x18e2('0xf')](function(){_0x55d7e2();});});}function manageTags(_0x2d0c94,_0x487c17,_0x4cbfff,_0x238311,_0x433cb7,_0x5abfc1,_0x34b714){return new Promise(function(_0xaab9fe,_0x22c466){var _0x2f02fe=[];_0x487c17[_0x18e2('0x28')](function(_0x5cf381){_0x2f02fe['push'](getRemoteTag(_0x5cf381,_0x4cbfff,_0x238311,_0x5abfc1,_0x34b714));});return Promise[_0x18e2('0x45')](_0x2f02fe)[_0x18e2('0x16')](function(_0x4dda71){if(_0x4dda71[_0x18e2('0x27')]){logger[_0x18e2('0xc')]('['+[_0x2d0c94['toUpperCase']()]+_0x18e2('0x46'),_0x4dda71);var _0x472a5a=[];_0x4dda71[_0x18e2('0x28')](function(_0x4b90dd){_0x472a5a[_0x18e2('0x47')](assignTagToIncident(_0x4b90dd,_0x4cbfff,_0x238311,_0x433cb7,_0x5abfc1));});return Promise[_0x18e2('0x45')](_0x472a5a)[_0x18e2('0x16')](function(){_0xaab9fe();})[_0x18e2('0xf')](function(){_0xaab9fe();});}else{_0xaab9fe();}});});}function getTags(_0x4e2f8c,_0x25d3c8,_0x4724e6,_0x9d08af,_0x5e48f2,_0x43103f){return function(_0x56f156){return new Promise(function(_0x5de1e0,_0x55c4f5){var _0x5dd013=[];var _0x26a771=_0x9d08af[_0x18e2('0x48')];if(_0x26a771&&_0x26a771[_0x18e2('0x27')]>0x0){_0x5dd013=_[_0x18e2('0x49')](_0x26a771,'name');}if(_0x5dd013['length']>0x0){return manageTags(_0x4e2f8c,_0x5dd013,_0x25d3c8,_0x4724e6,_0x56f156,_0x5e48f2,_0x43103f)[_0x18e2('0x16')](function(){_0x5de1e0(_0x56f156);});}else{_0x5de1e0(_0x56f156);}});};}function emit(_0x55fad3,_0x30cb9a,_0x834706){var _0x3f29bb='%26sysparm_record_target%3Dincident'+_0x18e2('0x4a')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x18e2('0x4b');var _0x85aecb={'uri':_0x55fad3+_0x18e2('0x4c')+_0x834706+_0x3f29bb};io['to'](util[_0x18e2('0x4d')](_0x18e2('0x4e'),_0x30cb9a))['emit']('trigger:browser:url',_0x85aecb);}exports['cs']=function(_0x35e132,_0x184c33,_0x4c6220,_0x3e280a,_0x2b9345,_0x3f493b,_0x319368,_0x3c1d6c){var _0x474a33={};var _0x1c9404={'user':_0x3f493b[_0x18e2('0x4f')],'pass':_0x3f493b[_0x18e2('0x50')]};var _0x17070d=_0x18e2('0x51');var _0x86d33b=_0x18e2('0x52');_0x3f493b[_0x18e2('0x53')]=intUtil[_0x18e2('0x54')](_0x3f493b[_0x18e2('0x53')]);_0x3f493b[_0x18e2('0x55')]=intUtil[_0x18e2('0x54')](_0x3f493b[_0x18e2('0x55')]);var _0x5275c4=util[_0x18e2('0x4d')](_0x18e2('0x56'),_0x3f493b['remoteUri']);_0x474a33[_0x18e2('0x14')]=_0x3e280a[_0x18e2('0x57')];_0x474a33[_0x18e2('0x58')]=_0x3f493b[_0x18e2('0x57')];_0x474a33[_0x18e2('0x20')]=_0x3c1d6c[_0x18e2('0x2f')]()==='outbound'?_0x184c33[_0x18e2('0x59')]:_0x184c33[_0x18e2('0x5a')];_0x474a33[_0x18e2('0x5b')]=_0x3c1d6c===_0x18e2('0x5c')||_0x3c1d6c===_0x18e2('0x5d')?_0x18e2('0x5c'):_0x18e2('0x35');var _0x4e647e=util['format'](_0x18e2('0x5e'),_0x3f493b[_0x18e2('0x55')],_0x184c33[_0x18e2('0x5f')],md5(_0x184c33[_0x18e2('0x5f')]));if(_0x2b9345&&_0x2b9345[_0x18e2('0x60')]){logger[_0x18e2('0xc')]('[QUEUE]',_0x18e2('0x61'));_0x184c33[_0x18e2('0x62')]=_0x4e647e;}else if(_0x319368&&_0x319368[_0x18e2('0x63')]&&_0x319368[_0x18e2('0x63')]!=='none'){logger[_0x18e2('0xc')](_0x18e2('0x64'),_0x18e2('0x61'));_0x184c33[_0x18e2('0x62')]=_0x4e647e;}else{_0x184c33[_0x18e2('0x62')]='';}return getAdminUser(_0x3c1d6c,_0x1c9404,_0x474a33,_0x5275c4,_0x86d33b,_0x17070d)[_0x18e2('0x16')](getUser(_0x3c1d6c,_0x1c9404,_0x5275c4,_0x86d33b,_0x17070d))['then'](getEndUser(_0x3c1d6c,_0x1c9404,_0x5275c4,_0x86d33b,_0x17070d))[_0x18e2('0x16')](getTicket(_0x3c1d6c,_0x1c9404,_0x5275c4,_0x4c6220,_0x184c33,_0x86d33b))[_0x18e2('0x16')](function(_0x21d1ae){logger[_0x18e2('0xc')](util[_0x18e2('0x4d')](_0x18e2('0x65'),_0x21d1ae[_0x18e2('0x3c')]));logger[_0x18e2('0xc')](util['format'](_0x18e2('0x66'),_0x3c1d6c));if(_0x3c1d6c!=='abandoned'){logger[_0x18e2('0xc')]('['+[_0x3c1d6c[_0x18e2('0xd')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x3f493b[_0x18e2('0x53')],_0x3e280a[_0x18e2('0x34')],_0x21d1ae[_0x18e2('0x3c')]);}})[_0x18e2('0xf')](function(_0x34a41f){logger[_0x18e2('0x10')]('['+[_0x3c1d6c[_0x18e2('0xd')]()]+_0x18e2('0x67'),util[_0x18e2('0x68')](_0x34a41f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index 6a46577..8bd64ee 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 _0xc782=['Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','stripTrailingSlash','%s/service/v4_1/rest.php','recordingFormat','none','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','version','charAt','[OUTBOUND]','abandoned','[ABANDONED]','The\x20User\x20ID\x20is:','request-promise','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','emit','info','name','getString','Subjects','assigned_user_id','description','Descriptions','date_start','toISOString','slice','duration_hours','parent_type','Contacts','direction','forEach','variableName','push','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','toString','stringify','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','length','find','entry_list','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','type','string','nameField','customField','idField','custom_fields','content','variable','customVariable','Variable','toLowerCase','POST','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','remoteUri','serverUrl','uri','monitor_format'];(function(_0x55c7ae,_0x41c9c9){var _0x5f4df1=function(_0x1d7a09){while(--_0x1d7a09){_0x55c7ae['push'](_0x55c7ae['shift']());}};_0x5f4df1(++_0x41c9c9);}(_0xc782,0x106));var _0x2c78=function(_0x913b85,_0x213182){_0x913b85=_0x913b85-0x0;var _0x1ce434=_0xc782[_0x913b85];return _0x1ce434;};'use strict';var _=require('lodash');var rp=require(_0x2c78('0x0'));var BPromise=require(_0x2c78('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0x2c78('0x2'));var intUtil=require(_0x2c78('0x3'));var config=require(_0x2c78('0x4'));var logger=require(_0x2c78('0x5'))(_0x2c78('0x6'));config[_0x2c78('0x7')]=_[_0x2c78('0x8')](config[_0x2c78('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x2c78('0x9'))(new Redis(config[_0x2c78('0x7')]));var def={'method':'POST','json':!![]};function emit(_0x135a3a,_0x5cf447,_0xb2403c){io['to'](_0x135a3a)[_0x2c78('0xa')](_0x5cf447,_0xb2403c);}function getTicket(_0x415f78,_0x39fab1,_0x233f85,_0x229b76,_0x194fbe,_0x48c83e,_0x3313a0,_0x2d3c13){logger[_0x2c78('0xb')]('Creating\x20new\x20ticket...');var _0x3277b1=new Date();var _0x16cf04=[{'name':_0x2c78('0xc'),'value':intUtil[_0x2c78('0xd')](_0x229b76[_0x2c78('0xe')],_0x194fbe,'\x20')},{'name':_0x2c78('0xf'),'value':_0x39fab1['id']},{'name':'created_by','value':_0x39fab1['id']},{'name':_0x2c78('0x10'),'value':intUtil[_0x2c78('0xd')](_0x229b76[_0x2c78('0x11')],_0x194fbe,'\x0a')},{'name':_0x2c78('0x12'),'value':_0x3277b1[_0x2c78('0x13')]()[_0x2c78('0x14')](0x0,0x13)['replace']('T','\x20')},{'name':_0x2c78('0x15'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x233f85['id']},{'name':_0x2c78('0x16'),'value':_0x2c78('0x17')},{'name':'parent_name','value':_0x233f85[_0x2c78('0xc')]},{'name':_0x2c78('0x18'),'value':_0x2d3c13}];if(_0x48c83e['length']){_[_0x2c78('0x19')](_0x48c83e,function(_0x507e5f){if(_0x194fbe[_0x507e5f[_0x2c78('0x1a')]]){_0x16cf04[_0x2c78('0x1b')]({'name':_0x507e5f['idField'],'value':_0x194fbe[_0x507e5f['variableName']]});}});}return request({'form':{'method':_0x2c78('0x1c'),'input_type':_0x2c78('0x1d'),'response_type':_0x2c78('0x1d'),'rest_data':JSON['stringify']({'session':_0x3313a0['id'],'module_name':_0x2c78('0x1e'),'name_value_list':_0x16cf04})}});}function getAuth(_0x467015){return util[_0x2c78('0x1f')](_0x2c78('0x20'),new Buffer(_0x467015[_0x2c78('0x21')]+':X')[_0x2c78('0x22')]('base64'));}function getServerInfo(_0x5cb8a2){return request({'form':{'method':'get_server_info','input_type':_0x2c78('0x1d'),'response_type':_0x2c78('0x1d'),'rest_data':JSON[_0x2c78('0x23')]({'session':_0x5cb8a2['id']})}});}function getUser(_0x11c9d1,_0xdafeee,_0x1c23a0){if(_0xdafeee){logger['info'](_0x2c78('0x24'),_0xdafeee);return request({'form':{'method':'get_entry_list','input_type':_0x2c78('0x1d'),'response_type':'JSON','rest_data':JSON[_0x2c78('0x23')]({'session':_0x1c23a0['id'],'module_name':_0x2c78('0x25'),'query':util[_0x2c78('0x1f')](_0x2c78('0x26'),_0xdafeee),'order_by':'','offset':'0','select_fields':['id',_0x2c78('0xc'),_0x2c78('0x27')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x2c78('0x28')](function(_0x46df8b){if(_0x46df8b['entry_list'][_0x2c78('0x29')]){var _0x5971f9=_[_0x2c78('0x2a')](_0x46df8b[_0x2c78('0x2b')],function(_0xe1409d){return _0xe1409d[_0x2c78('0x2c')][_0x2c78('0x27')][_0x2c78('0x2d')]===_0xdafeee;});if(_0x5971f9){logger[_0x2c78('0xb')]('Agent\x20found!');return BPromise[_0x2c78('0x2e')]({'id':_0x5971f9['name_value_list']['id']['value'],'name':_0x5971f9[_0x2c78('0x2c')][_0x2c78('0xc')]['value']});}}logger[_0x2c78('0xb')](_0x2c78('0x2f'));return BPromise[_0x2c78('0x2e')]({'id':_0x1c23a0[_0x2c78('0x2c')][_0x2c78('0x30')][_0x2c78('0x2d')],'name':_0x1c23a0['name_value_list'][_0x2c78('0x27')][_0x2c78('0x2d')]});});}else{logger['info'](_0x2c78('0x31'));return BPromise[_0x2c78('0x2e')]({'id':_0x1c23a0['name_value_list']['user_id']['value'],'name':_0x1c23a0['name_value_list'][_0x2c78('0x27')][_0x2c78('0x2d')]});}}function getEndUser(_0x44c13e,_0x3696ea,_0x479726,_0xd2cf67){logger['info'](_0x2c78('0x32'),_0x479726);return request({'form':{'method':'get_entry_list','input_type':_0x2c78('0x1d'),'response_type':_0x2c78('0x1d'),'rest_data':JSON[_0x2c78('0x23')]({'session':_0xd2cf67['id'],'module_name':_0x2c78('0x17'),'query':util[_0x2c78('0x1f')](_0x2c78('0x33'),_0x479726),'order_by':'','offset':'0','select_fields':['id','name',_0x2c78('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x2c78('0x28')](function(_0x1181be){if(_0x1181be[_0x2c78('0x2b')][_0x2c78('0x29')]){var _0x1f81ef=_[_0x2c78('0x2a')](_0x1181be['entry_list'],function(_0x1aa44a){return _0x1aa44a[_0x2c78('0x2c')][_0x2c78('0x34')][_0x2c78('0x2d')]===_0x479726;});if(_0x1f81ef){logger['info']('Enduser\x20found!');return BPromise['resolve']({'id':_0x1f81ef[_0x2c78('0x2c')]['id'][_0x2c78('0x2d')],'name':_0x1f81ef[_0x2c78('0x2c')][_0x2c78('0xc')][_0x2c78('0x2d')],'phone':_0x1f81ef[_0x2c78('0x2c')][_0x2c78('0x34')]['value']});}}else{logger[_0x2c78('0xb')](_0x2c78('0x35'));return request({'form':{'method':'set_entry','input_type':_0x2c78('0x1d'),'response_type':'JSON','rest_data':JSON[_0x2c78('0x23')]({'session':_0xd2cf67['id'],'module_name':_0x2c78('0x17'),'name_value_list':[{'name':_0x2c78('0x36'),'value':_0x3696ea!==_0x2c78('0x37')?_0x3696ea:util[_0x2c78('0x1f')](_0x2c78('0x38'),_0x479726)},{'name':_0x2c78('0x34'),'value':_0x479726}]})}})['then'](function(_0x36efed){logger[_0x2c78('0xb')](_0x2c78('0x39'));return BPromise[_0x2c78('0x2e')]({'id':_0x36efed['id'],'name':_0x36efed[_0x2c78('0x2b')][_0x2c78('0x36')][_0x2c78('0x2d')],'phone':_0x36efed['entry_list'][_0x2c78('0x34')][_0x2c78('0x2d')]});});}});}function request(_0x34d403){logger[_0x2c78('0x3a')](_0x2c78('0x3b'),JSON[_0x2c78('0x23')](_0x34d403));return rp(_[_0x2c78('0x3c')](def,_0x34d403));}function getTags(_0x5db6c5,_0x1f1280){var _0x46889b=[];if(_0x5db6c5&&_0x5db6c5[_0x2c78('0x29')]>0x0){_0x46889b=_['map'](_0x5db6c5,_0x1f1280);}return _0x46889b;}function getCustomFields(_0x2229d5,_0x30fbf7){var _0x4f5a0c=[];var _0x3bd776={'custom_fields':[]};if(_0x2229d5['length']>0x0){_[_0x2c78('0x19')](_0x2229d5,function(_0x56fca9){if(_0x56fca9[_0x2c78('0x3d')]===_0x2c78('0x3e')&&_0x56fca9[_0x2c78('0x3f')]&&!_0x56fca9[_0x2c78('0x40')]){_0x3bd776[_0x56fca9['nameField']['toLowerCase']()]=_0x56fca9['content'][_0x2c78('0x22')]();}else if(_0x56fca9[_0x2c78('0x3d')]===_0x2c78('0x3e')&&_0x56fca9[_0x2c78('0x41')]&&_0x56fca9[_0x2c78('0x40')]){_0x3bd776[_0x2c78('0x42')][_0x2c78('0x1b')]({'id':_0x56fca9[_0x2c78('0x41')],'value':_0x56fca9[_0x2c78('0x43')][_0x2c78('0x22')]()});}else if(_0x56fca9[_0x2c78('0x3d')]===_0x2c78('0x44')&&_0x56fca9[_0x2c78('0x1a')]&&_0x56fca9[_0x2c78('0x41')]&&_0x56fca9[_0x2c78('0x40')]){_0x30fbf7[_0x56fca9[_0x2c78('0x1a')]]&&_0x3bd776['custom_fields']['push']({'id':_0x56fca9[_0x2c78('0x41')],'value':_0x30fbf7[_0x56fca9[_0x2c78('0x1a')]][_0x2c78('0x22')]()});}else if(_0x56fca9[_0x2c78('0x3d')]===_0x2c78('0x45')&&_0x56fca9[_0x2c78('0x46')]&&_0x56fca9['Variable'][_0x2c78('0xc')]&&_0x56fca9[_0x2c78('0x41')]&&_0x56fca9[_0x2c78('0x40')]){_0x30fbf7[_0x56fca9[_0x2c78('0x46')]['name'][_0x2c78('0x47')]()]&&_0x3bd776['custom_fields'][_0x2c78('0x1b')]({'id':_0x56fca9['idField'],'value':_0x30fbf7[_0x56fca9[_0x2c78('0x46')][_0x2c78('0xc')]['toLowerCase']()][_0x2c78('0x22')]()});}});}return _0x3bd776;}function getConnection(_0x132499){return request({'method':_0x2c78('0x48'),'form':{'method':_0x2c78('0x49'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x2c78('0x23')]({'user_auth':{'user_name':_0x132499['username'],'password':_0x132499[_0x2c78('0x4a')],'encryption':_0x2c78('0x4b')},'application':_0x2c78('0x4c')})}})[_0x2c78('0x28')](function(_0xa0ea08){var _0x290e07=_0xa0ea08;if(_0x290e07['id']){def[_0x2c78('0x4d')]=_0x290e07['id'];return BPromise[_0x2c78('0x2e')](_0x290e07);}else{throw new Error(util[_0x2c78('0x1f')]('Account\x20%d\x20is\x20not\x20valid',_0x132499['id']));}});}function setRelationship(_0x470bce,_0x3ee5eb,_0x49c0eb,_0x1d2dc6){return request({'form':{'method':_0x2c78('0x4e'),'input_type':_0x2c78('0x1d'),'response_type':_0x2c78('0x1d'),'rest_data':JSON[_0x2c78('0x23')]({'session':_0x470bce['id'],'module_name':_0x2c78('0x1e'),'module_id':_0x49c0eb['id'],'link_field_name':_0x1d2dc6,'related_ids':[_0x3ee5eb['id']]})}});}exports['queue']=function(_0x4c2990,_0x8a7590,_0x3ce7,_0x353268,_0x1f52bb,_0x553353){var _0x7e8b7e,_0x338c8b,_0x4e6436,_0x2cb359;_0x553353['remoteUri']=intUtil['stripTrailingSlash'](_0x553353[_0x2c78('0x4f')]);_0x553353[_0x2c78('0x50')]=intUtil['stripTrailingSlash'](_0x553353[_0x2c78('0x50')]);def[_0x2c78('0x51')]=util['format']('%s/service/v4_1/rest.php',_0x553353['remoteUri']);if(_0x1f52bb&&_0x1f52bb[_0x2c78('0x52')]){logger['info']('[QUEUE]',_0x2c78('0x53'));_0x8a7590[_0x2c78('0x54')]=util[_0x2c78('0x1f')](_0x2c78('0x55'),_0x553353[_0x2c78('0x50')],_0x8a7590[_0x2c78('0x56')],md5(_0x8a7590[_0x2c78('0x56')]));}else{_0x8a7590[_0x2c78('0x54')]='';}return getConnection(_0x553353)[_0x2c78('0x28')](function(_0x18eb5b){_0x2cb359=_0x18eb5b;return getUser(_0x553353,_0x353268[_0x2c78('0xc')],_0x2cb359);})['then'](function(_0x43f87b){_0x7e8b7e=_0x43f87b;logger['info']('The\x20User\x20ID\x20is:',_0x7e8b7e['id']);return getEndUser(_0x553353,_0x8a7590['calleridname'],_0x8a7590[_0x2c78('0x57')],_0x2cb359);})['then'](function(_0x39c8e1){_0x338c8b=_0x39c8e1;logger[_0x2c78('0xb')]('The\x20Enduser\x20ID\x20is:',_0x338c8b['id']);return getTicket(_0x553353,_0x7e8b7e,_0x338c8b,_0x3ce7,_0x8a7590,_0x3ce7[_0x2c78('0x58')],_0x2cb359,_0x2c78('0x59'));})['then'](function(_0x1f53fe){_0x4e6436=_0x1f53fe;logger[_0x2c78('0xb')](_0x2c78('0x5a'));logger[_0x2c78('0xb')](_0x2c78('0x5b'),_0x4e6436['id']);return setRelationship(_0x2cb359,_0x7e8b7e,_0x4e6436,_0x2c78('0x5c'));})[_0x2c78('0x28')](function(){return setRelationship(_0x2cb359,_0x338c8b,_0x4e6436,_0x2c78('0x5d'));})[_0x2c78('0x28')](function(){return getServerInfo(_0x2cb359);})[_0x2c78('0x28')](function(_0x403b83){var _0x14625d=parseInt(_0x403b83['version']['charAt'](0x0));var _0x2aba11=util[_0x2c78('0x1f')](_0x2c78('0x5e'),_0x553353['remoteUri'],_0x4e6436['id']);if(_0x14625d>0x6){_0x2aba11=util['format'](_0x2c78('0x5f'),_0x553353[_0x2c78('0x4f')],_0x4e6436['id']);}logger[_0x2c78('0xb')]('[QUEUE]',_0x2c78('0x60'));emit(util[_0x2c78('0x1f')](_0x2c78('0x61'),_0x353268['name']),_0x2c78('0x62'),{'uri':_0x2aba11});})[_0x2c78('0x63')](function(_0x568421){logger[_0x2c78('0x64')]('[QUEUE]',JSON[_0x2c78('0x23')](_0x568421));});};exports[_0x2c78('0x65')]=function(_0x4a702a,_0x2bc597,_0x1dd608,_0x1e8792,_0x417ca0,_0x263c45,_0x1f64a8){var _0x1b6779,_0x1a966d,_0x3deab3,_0x28637e;_0x263c45[_0x2c78('0x4f')]=intUtil[_0x2c78('0x66')](_0x263c45[_0x2c78('0x4f')]);_0x263c45['serverUrl']=intUtil[_0x2c78('0x66')](_0x263c45[_0x2c78('0x50')]);def[_0x2c78('0x51')]=util['format'](_0x2c78('0x67'),_0x263c45[_0x2c78('0x4f')]);if(_0x1f64a8&&_0x1f64a8[_0x2c78('0x68')]&&_0x1f64a8['recordingFormat']!==_0x2c78('0x69')){logger['info']('[OUTBOUND]',_0x2c78('0x53'));_0x2bc597[_0x2c78('0x54')]=util[_0x2c78('0x1f')](_0x2c78('0x55'),_0x263c45[_0x2c78('0x50')],_0x2bc597[_0x2c78('0x56')],md5(_0x2bc597['uniqueid']));}return getConnection(_0x263c45)[_0x2c78('0x28')](function(_0x58d541){_0x28637e=_0x58d541;return getUser(_0x263c45,_0x1e8792[_0x2c78('0xc')],_0x28637e);})[_0x2c78('0x28')](function(_0x2cdee0){_0x1b6779=_0x2cdee0;logger[_0x2c78('0xb')]('The\x20User\x20ID\x20is:',_0x1b6779['id']);return getEndUser(_0x263c45,_0x2bc597[_0x2c78('0x6a')],_0x2bc597[_0x2c78('0x6b')],_0x28637e);})[_0x2c78('0x28')](function(_0x2e9296){_0x1a966d=_0x2e9296;logger[_0x2c78('0xb')](_0x2c78('0x6c'),_0x1a966d['id']);return getTicket(_0x263c45,_0x1b6779,_0x1a966d,_0x1dd608,_0x2bc597,_0x1dd608[_0x2c78('0x58')],_0x28637e,'Outbound');})[_0x2c78('0x28')](function(_0x4e0f23){_0x3deab3=_0x4e0f23;logger[_0x2c78('0xb')](_0x2c78('0x5a'));logger[_0x2c78('0xb')](_0x2c78('0x5b'),_0x3deab3['id']);return setRelationship(_0x28637e,_0x1b6779,_0x3deab3,'users');})['then'](function(){return setRelationship(_0x28637e,_0x1a966d,_0x3deab3,_0x2c78('0x5d'));})[_0x2c78('0x28')](function(){return getServerInfo(_0x28637e);})[_0x2c78('0x28')](function(_0x3c0d5f){var _0x359300=parseInt(_0x3c0d5f[_0x2c78('0x6d')][_0x2c78('0x6e')](0x0));var _0x3cbcc0=util[_0x2c78('0x1f')](_0x2c78('0x5e'),_0x263c45[_0x2c78('0x4f')],_0x3deab3['id']);if(_0x359300>0x6){_0x3cbcc0=util[_0x2c78('0x1f')](_0x2c78('0x5f'),_0x263c45['remoteUri'],_0x3deab3['id']);}logger[_0x2c78('0xb')]('[OUTBOUND]',_0x2c78('0x60'));emit(util[_0x2c78('0x1f')](_0x2c78('0x61'),_0x1e8792[_0x2c78('0xc')]),_0x2c78('0x62'),{'uri':_0x3cbcc0});})[_0x2c78('0x63')](function(_0x205abd){logger[_0x2c78('0x64')](_0x2c78('0x6f'),JSON[_0x2c78('0x23')](_0x205abd));});};exports[_0x2c78('0x70')]=function(_0x4fbf34,_0x23466f,_0x536abb,_0x297245,_0x50285a,_0x313d03){var _0x1373a4,_0x4a70f0,_0x2ce8fa,_0x282384;_0x313d03['remoteUri']=intUtil[_0x2c78('0x66')](_0x313d03[_0x2c78('0x4f')]);_0x313d03['serverUrl']=intUtil[_0x2c78('0x66')](_0x313d03['serverUrl']);def[_0x2c78('0x51')]=util['format'](_0x2c78('0x67'),_0x313d03[_0x2c78('0x4f')]);if(_0x50285a&&_0x50285a[_0x2c78('0x52')]){logger['info'](_0x2c78('0x71'),_0x2c78('0x53'));_0x23466f['recordingURL']=util['format'](_0x2c78('0x55'),_0x313d03[_0x2c78('0x50')],_0x23466f[_0x2c78('0x56')],md5(_0x23466f['uniqueid']));}else{_0x23466f[_0x2c78('0x54')]='';}return getConnection(_0x313d03)[_0x2c78('0x28')](function(_0xd282f4){_0x282384=_0xd282f4;return getUser(_0x313d03,_0x297245[_0x2c78('0xc')],_0x282384);})[_0x2c78('0x28')](function(_0x6abbbc){_0x1373a4=_0x6abbbc;logger[_0x2c78('0xb')](_0x2c78('0x72'),_0x1373a4['id']);return getEndUser(_0x313d03,_0x23466f['calleridname'],_0x23466f[_0x2c78('0x57')],_0x282384);})[_0x2c78('0x28')](function(_0x13ec63){_0x4a70f0=_0x13ec63;logger[_0x2c78('0xb')](_0x2c78('0x6c'),_0x4a70f0['id']);return getTicket(_0x313d03,_0x1373a4,_0x4a70f0,_0x536abb,_0x23466f,_0x536abb['Fields'],_0x282384,_0x2c78('0x59'));})['then'](function(_0x5b437e){_0x2ce8fa=_0x5b437e;logger[_0x2c78('0xb')](_0x2c78('0x5a'));logger[_0x2c78('0xb')](_0x2c78('0x5b'),_0x2ce8fa['id']);return setRelationship(_0x282384,_0x1373a4,_0x2ce8fa,_0x2c78('0x5c'));})['then'](function(){return setRelationship(_0x282384,_0x4a70f0,_0x2ce8fa,_0x2c78('0x5d'));})[_0x2c78('0x28')](function(){return getServerInfo(_0x282384);})['catch'](function(_0x10f148){logger[_0x2c78('0x64')](_0x2c78('0x71'),JSON[_0x2c78('0x23')](_0x10f148));});}; \ No newline at end of file +var _0xe9bb=['error','outbound','stripTrailingSlash','none','destcalleridname','destcalleridnum','Outbound','users','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','abandoned','monitor_format','[ABANDONED]','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','emit','Creating\x20new\x20ticket...','name','getString','created_by','Descriptions','toISOString','replace','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','forEach','variableName','push','set_entry','JSON','stringify','Calls','format','Basic\x20%s','toString','base64','get_server_info','info','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','Enduser\x20found!','','Caller\x20-\x20%s','phone_home','Enduser\x20created.','first_name','debug','[HTTP]','type','nameField','customField','content','string','custom_fields','variable','idField','customVariable','Variable','toLowerCase','POST','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','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','[QUEUE]','trigger:browser:url','catch'];(function(_0x2b0b81,_0x39d4e1){var _0x3f6cb6=function(_0x3cf8f0){while(--_0x3cf8f0){_0x2b0b81['push'](_0x2b0b81['shift']());}};_0x3f6cb6(++_0x39d4e1);}(_0xe9bb,0xfa));var _0xbe9b=function(_0x33cc4f,_0x24a58b){_0x33cc4f=_0x33cc4f-0x0;var _0x24df80=_0xe9bb[_0x33cc4f];return _0x24df80;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0xbe9b('0x0'));var md5=require(_0xbe9b('0x1'));var util=require(_0xbe9b('0x2'));var Redis=require('ioredis');var intUtil=require(_0xbe9b('0x3'));var config=require(_0xbe9b('0x4'));var logger=require(_0xbe9b('0x5'))('sugarcrm');config['redis']=_[_0xbe9b('0x6')](config[_0xbe9b('0x7')],{'host':_0xbe9b('0x8'),'port':0x18eb});var io=require(_0xbe9b('0x9'))(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x56537e,_0x1d5b8a,_0x1a14c4){io['to'](_0x56537e)[_0xbe9b('0xa')](_0x1d5b8a,_0x1a14c4);}function getTicket(_0x1b9f68,_0x3d240e,_0x186a4b,_0x398662,_0x386b2d,_0x1d333d,_0x4596bf,_0x3ed280){logger['info'](_0xbe9b('0xb'));var _0x4f222c=new Date();var _0x1bf62a=[{'name':_0xbe9b('0xc'),'value':intUtil[_0xbe9b('0xd')](_0x398662['Subjects'],_0x386b2d,'\x20')},{'name':'assigned_user_id','value':_0x3d240e['id']},{'name':_0xbe9b('0xe'),'value':_0x3d240e['id']},{'name':'description','value':intUtil[_0xbe9b('0xd')](_0x398662[_0xbe9b('0xf')],_0x386b2d,'\x0a')},{'name':'date_start','value':_0x4f222c[_0xbe9b('0x10')]()['slice'](0x0,0x13)[_0xbe9b('0x11')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xbe9b('0x12'),'value':'15'},{'name':_0xbe9b('0x13'),'value':_0x186a4b['id']},{'name':_0xbe9b('0x14'),'value':_0xbe9b('0x15')},{'name':_0xbe9b('0x16'),'value':_0x186a4b[_0xbe9b('0xc')]},{'name':_0xbe9b('0x17'),'value':_0x3ed280}];if(_0x1d333d['length']){_[_0xbe9b('0x18')](_0x1d333d,function(_0x401153){if(_0x386b2d[_0x401153[_0xbe9b('0x19')]]){_0x1bf62a[_0xbe9b('0x1a')]({'name':_0x401153['idField'],'value':_0x386b2d[_0x401153['variableName']]});}});}return request({'form':{'method':_0xbe9b('0x1b'),'input_type':_0xbe9b('0x1c'),'response_type':_0xbe9b('0x1c'),'rest_data':JSON[_0xbe9b('0x1d')]({'session':_0x4596bf['id'],'module_name':_0xbe9b('0x1e'),'name_value_list':_0x1bf62a})}});}function getAuth(_0x59e4b3){return util[_0xbe9b('0x1f')](_0xbe9b('0x20'),new Buffer(_0x59e4b3['apiKey']+':X')[_0xbe9b('0x21')](_0xbe9b('0x22')));}function getServerInfo(_0x2874d6){return request({'form':{'method':_0xbe9b('0x23'),'input_type':_0xbe9b('0x1c'),'response_type':_0xbe9b('0x1c'),'rest_data':JSON[_0xbe9b('0x1d')]({'session':_0x2874d6['id']})}});}function getUser(_0x4cea88,_0x20b523,_0x3a8543){if(_0x20b523){logger[_0xbe9b('0x24')]('Getting\x20agent\x20with\x20name',_0x20b523);return request({'form':{'method':_0xbe9b('0x25'),'input_type':'JSON','response_type':_0xbe9b('0x1c'),'rest_data':JSON[_0xbe9b('0x1d')]({'session':_0x3a8543['id'],'module_name':'Employees','query':util[_0xbe9b('0x1f')](_0xbe9b('0x26'),_0x20b523),'order_by':'','offset':'0','select_fields':['id',_0xbe9b('0xc'),_0xbe9b('0x27')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xbe9b('0x28')](function(_0x3f888f){if(_0x3f888f[_0xbe9b('0x29')][_0xbe9b('0x2a')]){var _0x264259=_[_0xbe9b('0x2b')](_0x3f888f[_0xbe9b('0x29')],function(_0x5f4c75){return _0x5f4c75[_0xbe9b('0x2c')][_0xbe9b('0x27')][_0xbe9b('0x2d')]===_0x20b523;});if(_0x264259){logger[_0xbe9b('0x24')](_0xbe9b('0x2e'));return BPromise[_0xbe9b('0x2f')]({'id':_0x264259[_0xbe9b('0x2c')]['id']['value'],'name':_0x264259[_0xbe9b('0x2c')]['name'][_0xbe9b('0x2d')]});}}logger['info'](_0xbe9b('0x30'));return BPromise['resolve']({'id':_0x3a8543['name_value_list'][_0xbe9b('0x31')][_0xbe9b('0x2d')],'name':_0x3a8543[_0xbe9b('0x2c')][_0xbe9b('0x27')]['value']});});}else{logger[_0xbe9b('0x24')](_0xbe9b('0x32'));return BPromise[_0xbe9b('0x2f')]({'id':_0x3a8543[_0xbe9b('0x2c')][_0xbe9b('0x31')]['value'],'name':_0x3a8543['name_value_list']['user_name'][_0xbe9b('0x2d')]});}}function getEndUser(_0x109019,_0x3ec90a,_0xd4af0b,_0x130ae1){logger['info'](_0xbe9b('0x33'),_0xd4af0b);return request({'form':{'method':_0xbe9b('0x25'),'input_type':_0xbe9b('0x1c'),'response_type':'JSON','rest_data':JSON[_0xbe9b('0x1d')]({'session':_0x130ae1['id'],'module_name':_0xbe9b('0x15'),'query':util['format'](_0xbe9b('0x34'),_0xd4af0b),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xbe9b('0x28')](function(_0x3c45ad){if(_0x3c45ad['entry_list'][_0xbe9b('0x2a')]){var _0x4ce32a=_[_0xbe9b('0x2b')](_0x3c45ad[_0xbe9b('0x29')],function(_0x207dab){return _0x207dab['name_value_list']['phone_home'][_0xbe9b('0x2d')]===_0xd4af0b;});if(_0x4ce32a){logger[_0xbe9b('0x24')](_0xbe9b('0x35'));return BPromise[_0xbe9b('0x2f')]({'id':_0x4ce32a[_0xbe9b('0x2c')]['id'][_0xbe9b('0x2d')],'name':_0x4ce32a[_0xbe9b('0x2c')]['name']['value'],'phone':_0x4ce32a[_0xbe9b('0x2c')]['phone_home'][_0xbe9b('0x2d')]});}}else{logger[_0xbe9b('0x24')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xbe9b('0x1b'),'input_type':_0xbe9b('0x1c'),'response_type':_0xbe9b('0x1c'),'rest_data':JSON[_0xbe9b('0x1d')]({'session':_0x130ae1['id'],'module_name':_0xbe9b('0x15'),'name_value_list':[{'name':'first_name','value':_0x3ec90a!==_0xbe9b('0x36')?_0x3ec90a:util[_0xbe9b('0x1f')](_0xbe9b('0x37'),_0xd4af0b)},{'name':_0xbe9b('0x38'),'value':_0xd4af0b}]})}})['then'](function(_0x1d814b){logger[_0xbe9b('0x24')](_0xbe9b('0x39'));return BPromise[_0xbe9b('0x2f')]({'id':_0x1d814b['id'],'name':_0x1d814b[_0xbe9b('0x29')][_0xbe9b('0x3a')][_0xbe9b('0x2d')],'phone':_0x1d814b[_0xbe9b('0x29')][_0xbe9b('0x38')]['value']});});}});}function request(_0x4826f0){logger[_0xbe9b('0x3b')](_0xbe9b('0x3c'),JSON[_0xbe9b('0x1d')](_0x4826f0));return rp(_['merge'](def,_0x4826f0));}function getTags(_0x1ce3aa,_0xabaae0){var _0xcfc417=[];if(_0x1ce3aa&&_0x1ce3aa[_0xbe9b('0x2a')]>0x0){_0xcfc417=_['map'](_0x1ce3aa,_0xabaae0);}return _0xcfc417;}function getCustomFields(_0x59c7a9,_0x3c3daf){var _0x204101=[];var _0x4ceace={'custom_fields':[]};if(_0x59c7a9[_0xbe9b('0x2a')]>0x0){_['forEach'](_0x59c7a9,function(_0x313e3c){if(_0x313e3c[_0xbe9b('0x3d')]==='string'&&_0x313e3c[_0xbe9b('0x3e')]&&!_0x313e3c[_0xbe9b('0x3f')]){_0x4ceace[_0x313e3c['nameField']['toLowerCase']()]=_0x313e3c[_0xbe9b('0x40')][_0xbe9b('0x21')]();}else if(_0x313e3c[_0xbe9b('0x3d')]===_0xbe9b('0x41')&&_0x313e3c['idField']&&_0x313e3c[_0xbe9b('0x3f')]){_0x4ceace[_0xbe9b('0x42')][_0xbe9b('0x1a')]({'id':_0x313e3c['idField'],'value':_0x313e3c['content'][_0xbe9b('0x21')]()});}else if(_0x313e3c['type']===_0xbe9b('0x43')&&_0x313e3c['variableName']&&_0x313e3c[_0xbe9b('0x44')]&&_0x313e3c[_0xbe9b('0x3f')]){_0x3c3daf[_0x313e3c[_0xbe9b('0x19')]]&&_0x4ceace[_0xbe9b('0x42')][_0xbe9b('0x1a')]({'id':_0x313e3c[_0xbe9b('0x44')],'value':_0x3c3daf[_0x313e3c['variableName']][_0xbe9b('0x21')]()});}else if(_0x313e3c['type']===_0xbe9b('0x45')&&_0x313e3c[_0xbe9b('0x46')]&&_0x313e3c['Variable'][_0xbe9b('0xc')]&&_0x313e3c['idField']&&_0x313e3c['customField']){_0x3c3daf[_0x313e3c['Variable']['name'][_0xbe9b('0x47')]()]&&_0x4ceace[_0xbe9b('0x42')][_0xbe9b('0x1a')]({'id':_0x313e3c[_0xbe9b('0x44')],'value':_0x3c3daf[_0x313e3c[_0xbe9b('0x46')][_0xbe9b('0xc')][_0xbe9b('0x47')]()][_0xbe9b('0x21')]()});}});}return _0x4ceace;}function getConnection(_0x4f9e8d){return request({'method':_0xbe9b('0x48'),'form':{'method':'login','input_type':'JSON','response_type':_0xbe9b('0x1c'),'rest_data':JSON[_0xbe9b('0x1d')]({'user_auth':{'user_name':_0x4f9e8d[_0xbe9b('0x49')],'password':_0x4f9e8d[_0xbe9b('0x4a')],'encryption':_0xbe9b('0x4b')},'application':_0xbe9b('0x4c')})}})[_0xbe9b('0x28')](function(_0x1bb9a5){var _0xe5f2cd=_0x1bb9a5;if(_0xe5f2cd['id']){def[_0xbe9b('0x4d')]=_0xe5f2cd['id'];return BPromise[_0xbe9b('0x2f')](_0xe5f2cd);}else{throw new Error(util[_0xbe9b('0x1f')](_0xbe9b('0x4e'),_0x4f9e8d['id']));}});}function setRelationship(_0x4dceca,_0x46e170,_0xc1ceac,_0xb09ed3){return request({'form':{'method':_0xbe9b('0x4f'),'input_type':'JSON','response_type':_0xbe9b('0x1c'),'rest_data':JSON['stringify']({'session':_0x4dceca['id'],'module_name':_0xbe9b('0x1e'),'module_id':_0xc1ceac['id'],'link_field_name':_0xb09ed3,'related_ids':[_0x46e170['id']]})}});}exports[_0xbe9b('0x50')]=function(_0x501f41,_0x591323,_0x3b6ba7,_0x6e0ddc,_0x4de47d,_0x436c5b){var _0x1724c7,_0x284a8f,_0x179d1d,_0x13a7ff;_0x436c5b[_0xbe9b('0x51')]=intUtil['stripTrailingSlash'](_0x436c5b[_0xbe9b('0x51')]);_0x436c5b[_0xbe9b('0x52')]=intUtil['stripTrailingSlash'](_0x436c5b['serverUrl']);def[_0xbe9b('0x53')]=util[_0xbe9b('0x1f')](_0xbe9b('0x54'),_0x436c5b['remoteUri']);if(_0x4de47d&&_0x4de47d['monitor_format']){logger['info']('[QUEUE]',_0xbe9b('0x55'));_0x591323[_0xbe9b('0x56')]=util[_0xbe9b('0x1f')](_0xbe9b('0x57'),_0x436c5b[_0xbe9b('0x52')],_0x591323[_0xbe9b('0x58')],md5(_0x591323[_0xbe9b('0x58')]));}else{_0x591323[_0xbe9b('0x56')]='';}return getConnection(_0x436c5b)[_0xbe9b('0x28')](function(_0x54c27f){_0x13a7ff=_0x54c27f;return getUser(_0x436c5b,_0x6e0ddc[_0xbe9b('0xc')],_0x13a7ff);})[_0xbe9b('0x28')](function(_0x295a2d){_0x1724c7=_0x295a2d;logger[_0xbe9b('0x24')](_0xbe9b('0x59'),_0x1724c7['id']);return getEndUser(_0x436c5b,_0x591323[_0xbe9b('0x5a')],_0x591323['calleridnum'],_0x13a7ff);})['then'](function(_0x22eed2){_0x284a8f=_0x22eed2;logger['info'](_0xbe9b('0x5b'),_0x284a8f['id']);return getTicket(_0x436c5b,_0x1724c7,_0x284a8f,_0x3b6ba7,_0x591323,_0x3b6ba7[_0xbe9b('0x5c')],_0x13a7ff,_0xbe9b('0x5d'));})[_0xbe9b('0x28')](function(_0x6fc415){_0x179d1d=_0x6fc415;logger[_0xbe9b('0x24')](_0xbe9b('0x5e'));logger[_0xbe9b('0x24')](_0xbe9b('0x5f'),_0x179d1d['id']);return setRelationship(_0x13a7ff,_0x1724c7,_0x179d1d,'users');})[_0xbe9b('0x28')](function(){return setRelationship(_0x13a7ff,_0x284a8f,_0x179d1d,_0xbe9b('0x60'));})[_0xbe9b('0x28')](function(){return getServerInfo(_0x13a7ff);})[_0xbe9b('0x28')](function(_0x38fa92){var _0x2358d9=parseInt(_0x38fa92[_0xbe9b('0x61')][_0xbe9b('0x62')](0x0));var _0x5d7517=util[_0xbe9b('0x1f')](_0xbe9b('0x63'),_0x436c5b['remoteUri'],_0x179d1d['id']);if(_0x2358d9>0x6){_0x5d7517=util[_0xbe9b('0x1f')](_0xbe9b('0x64'),_0x436c5b[_0xbe9b('0x51')],_0x179d1d['id']);}logger['info'](_0xbe9b('0x65'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x6e0ddc[_0xbe9b('0xc')]),_0xbe9b('0x66'),{'uri':_0x5d7517});})[_0xbe9b('0x67')](function(_0x7d491d){logger[_0xbe9b('0x68')](_0xbe9b('0x65'),JSON[_0xbe9b('0x1d')](_0x7d491d));});};exports[_0xbe9b('0x69')]=function(_0xcd049,_0x2539bc,_0x3469cd,_0xe45b67,_0x57372a,_0x375f3c,_0x1c887b){var _0x201100,_0x336aaa,_0x91d0a,_0x3e6267;_0x375f3c[_0xbe9b('0x51')]=intUtil[_0xbe9b('0x6a')](_0x375f3c['remoteUri']);_0x375f3c[_0xbe9b('0x52')]=intUtil['stripTrailingSlash'](_0x375f3c[_0xbe9b('0x52')]);def[_0xbe9b('0x53')]=util['format'](_0xbe9b('0x54'),_0x375f3c[_0xbe9b('0x51')]);if(_0x1c887b&&_0x1c887b['recordingFormat']&&_0x1c887b['recordingFormat']!==_0xbe9b('0x6b')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2539bc[_0xbe9b('0x56')]=util[_0xbe9b('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x375f3c['serverUrl'],_0x2539bc[_0xbe9b('0x58')],md5(_0x2539bc['uniqueid']));}return getConnection(_0x375f3c)[_0xbe9b('0x28')](function(_0x53496a){_0x3e6267=_0x53496a;return getUser(_0x375f3c,_0xe45b67['name'],_0x3e6267);})[_0xbe9b('0x28')](function(_0x485e56){_0x201100=_0x485e56;logger[_0xbe9b('0x24')]('The\x20User\x20ID\x20is:',_0x201100['id']);return getEndUser(_0x375f3c,_0x2539bc[_0xbe9b('0x6c')],_0x2539bc[_0xbe9b('0x6d')],_0x3e6267);})[_0xbe9b('0x28')](function(_0x3374e0){_0x336aaa=_0x3374e0;logger['info'](_0xbe9b('0x5b'),_0x336aaa['id']);return getTicket(_0x375f3c,_0x201100,_0x336aaa,_0x3469cd,_0x2539bc,_0x3469cd[_0xbe9b('0x5c')],_0x3e6267,_0xbe9b('0x6e'));})[_0xbe9b('0x28')](function(_0x3cfb7f){_0x91d0a=_0x3cfb7f;logger[_0xbe9b('0x24')](_0xbe9b('0x5e'));logger[_0xbe9b('0x24')](_0xbe9b('0x5f'),_0x91d0a['id']);return setRelationship(_0x3e6267,_0x201100,_0x91d0a,_0xbe9b('0x6f'));})[_0xbe9b('0x28')](function(){return setRelationship(_0x3e6267,_0x336aaa,_0x91d0a,_0xbe9b('0x60'));})[_0xbe9b('0x28')](function(){return getServerInfo(_0x3e6267);})[_0xbe9b('0x28')](function(_0x35430a){var _0x1e0379=parseInt(_0x35430a[_0xbe9b('0x61')]['charAt'](0x0));var _0x5398e2=util[_0xbe9b('0x1f')](_0xbe9b('0x63'),_0x375f3c[_0xbe9b('0x51')],_0x91d0a['id']);if(_0x1e0379>0x6){_0x5398e2=util[_0xbe9b('0x1f')](_0xbe9b('0x64'),_0x375f3c['remoteUri'],_0x91d0a['id']);}logger[_0xbe9b('0x24')](_0xbe9b('0x70'),_0xbe9b('0x71'));emit(util[_0xbe9b('0x1f')](_0xbe9b('0x72'),_0xe45b67['name']),_0xbe9b('0x66'),{'uri':_0x5398e2});})['catch'](function(_0x31f236){logger[_0xbe9b('0x68')](_0xbe9b('0x70'),JSON[_0xbe9b('0x1d')](_0x31f236));});};exports[_0xbe9b('0x73')]=function(_0x3aa730,_0x5338c2,_0x4d1959,_0x4b654d,_0x4c23c7,_0x40046d){var _0x36d85b,_0x10b427,_0x51551e,_0x5079a8;_0x40046d[_0xbe9b('0x51')]=intUtil[_0xbe9b('0x6a')](_0x40046d[_0xbe9b('0x51')]);_0x40046d[_0xbe9b('0x52')]=intUtil[_0xbe9b('0x6a')](_0x40046d[_0xbe9b('0x52')]);def[_0xbe9b('0x53')]=util[_0xbe9b('0x1f')]('%s/service/v4_1/rest.php',_0x40046d[_0xbe9b('0x51')]);if(_0x4c23c7&&_0x4c23c7[_0xbe9b('0x74')]){logger[_0xbe9b('0x24')](_0xbe9b('0x75'),'Recording\x20is\x20enabled!');_0x5338c2[_0xbe9b('0x56')]=util[_0xbe9b('0x1f')](_0xbe9b('0x57'),_0x40046d[_0xbe9b('0x52')],_0x5338c2[_0xbe9b('0x58')],md5(_0x5338c2['uniqueid']));}else{_0x5338c2[_0xbe9b('0x56')]='';}return getConnection(_0x40046d)[_0xbe9b('0x28')](function(_0x5f3567){_0x5079a8=_0x5f3567;return getUser(_0x40046d,_0x4b654d[_0xbe9b('0xc')],_0x5079a8);})['then'](function(_0x14e293){_0x36d85b=_0x14e293;logger['info'](_0xbe9b('0x59'),_0x36d85b['id']);return getEndUser(_0x40046d,_0x5338c2[_0xbe9b('0x5a')],_0x5338c2['calleridnum'],_0x5079a8);})[_0xbe9b('0x28')](function(_0x386607){_0x10b427=_0x386607;logger[_0xbe9b('0x24')](_0xbe9b('0x5b'),_0x10b427['id']);return getTicket(_0x40046d,_0x36d85b,_0x10b427,_0x4d1959,_0x5338c2,_0x4d1959[_0xbe9b('0x5c')],_0x5079a8,'Inbound');})[_0xbe9b('0x28')](function(_0x22314f){_0x51551e=_0x22314f;logger[_0xbe9b('0x24')](_0xbe9b('0x5e'));logger[_0xbe9b('0x24')](_0xbe9b('0x5f'),_0x51551e['id']);return setRelationship(_0x5079a8,_0x36d85b,_0x51551e,'users');})[_0xbe9b('0x28')](function(){return setRelationship(_0x5079a8,_0x10b427,_0x51551e,_0xbe9b('0x60'));})[_0xbe9b('0x28')](function(){return getServerInfo(_0x5079a8);})[_0xbe9b('0x67')](function(_0xc8b6c1){logger[_0xbe9b('0x68')]('[ABANDONED]',JSON[_0xbe9b('0x1d')](_0xc8b6c1));});}; \ 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 1af5e27..ab106f5 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 _0x8216=['customVariable','join','stripTrailingSlash','substr','validateEmail','test','lodash','length','sortBy','type','string','content','variable','variableName','push','toString','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s','keyContent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8216,0xf6));var _0x6821=function(_0x579574,_0x3f2462){_0x579574=_0x579574-0x0;var _0x5661c0=_0x8216[_0x579574];return _0x5661c0;};'use strict';var _=require(_0x6821('0x0'));var util=require('util');exports['getString']=function(_0xbce1f6,_0xc5dec0,_0xccf5){var _0x39f8db=[];if(_0xbce1f6[_0x6821('0x1')]>0x0){var _0x3d2330=_[_0x6821('0x2')](_0xbce1f6,['id']);for(var _0x1909b1=0x0;_0x1909b1<_0x3d2330[_0x6821('0x1')];_0x1909b1++){var _0x41e271=_0x3d2330[_0x1909b1];if(_0x41e271[_0x6821('0x3')]===_0x6821('0x4')){_0x39f8db['push'](_0x41e271[_0x6821('0x5')]);}else if(_0x41e271[_0x6821('0x3')]===_0x6821('0x6')&&_0x41e271[_0x6821('0x7')]){_0xc5dec0[_0x41e271[_0x6821('0x7')]]&&_0x39f8db[_0x6821('0x8')](_0xc5dec0[_0x41e271[_0x6821('0x7')]][_0x6821('0x9')]());}else if(_0x41e271[_0x6821('0x3')]==='customVariable'&&_0x41e271[_0x6821('0xa')]&&_0x41e271[_0x6821('0xa')][_0x6821('0xb')]){_0xc5dec0[_0x41e271[_0x6821('0xa')]['name']['toLowerCase']()]&&_0x39f8db[_0x6821('0x8')](_0xc5dec0[_0x41e271[_0x6821('0xa')][_0x6821('0xb')][_0x6821('0xc')]()][_0x6821('0x9')]());}else if(_0x41e271[_0x6821('0x3')]==='keyValue'){if(_0x41e271[_0x6821('0xd')]===_0x6821('0x4')&&_0x41e271[_0x6821('0xe')]){_0x39f8db[_0x6821('0x8')](util[_0x6821('0xf')](_0x6821('0x10'),_0x41e271['key'],_0x41e271[_0x6821('0x11')]));}else if(_0x41e271['keyType']==='variable'&&_0x41e271[_0x6821('0x7')]&&_0x41e271['key']){_0xc5dec0[_0x41e271['variableName']]&&_0x39f8db['push'](util['format'](_0x6821('0x10'),_0x41e271[_0x6821('0xe')],_0xc5dec0[_0x41e271[_0x6821('0x7')]]));}else if(_0x41e271[_0x6821('0xd')]===_0x6821('0x12')&&_0x41e271[_0x6821('0xa')]&&_0x41e271['Variable']['name']&&_0x41e271[_0x6821('0xe')]){_0xc5dec0[_0x41e271[_0x6821('0xa')][_0x6821('0xb')][_0x6821('0xc')]()]&&_0x39f8db[_0x6821('0x8')](util['format'](_0x6821('0x10'),_0x41e271[_0x6821('0xe')],_0xc5dec0[_0x41e271[_0x6821('0xa')][_0x6821('0xb')]['toLowerCase']()]));}}}}return _0x39f8db[_0x6821('0x13')](_0xccf5);};exports[_0x6821('0x14')]=function(_0x20cf0d){if(_0x20cf0d&&_0x20cf0d['substr'](-0x1)==='/'){return _0x20cf0d[_0x6821('0x15')](0x0,_0x20cf0d['length']-0x1);}return _0x20cf0d;};exports[_0x6821('0x16')]=function(_0x563cf9){if(_0x563cf9&&_0x563cf9!==''){var _0x21bcd7=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x21bcd7[_0x6821('0x17')](String(_0x563cf9)[_0x6821('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x4969=['key','push','keyContent','%s:\x20%s','join','substr','validateEmail','test','util','getString','length','sortBy','type','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','string'];(function(_0x5dc3f2,_0x1b983f){var _0x49db74=function(_0xd515b6){while(--_0xd515b6){_0x5dc3f2['push'](_0x5dc3f2['shift']());}};_0x49db74(++_0x1b983f);}(_0x4969,0x1ec));var _0x9496=function(_0x196f40,_0x417e6e){_0x196f40=_0x196f40-0x0;var _0x544d7b=_0x4969[_0x196f40];return _0x544d7b;};'use strict';var _=require('lodash');var util=require(_0x9496('0x0'));exports[_0x9496('0x1')]=function(_0x3b6d62,_0x52554c,_0x45e7cd){var _0x10df68=[];if(_0x3b6d62[_0x9496('0x2')]>0x0){var _0x1893b5=_[_0x9496('0x3')](_0x3b6d62,['id']);for(var _0x4af479=0x0;_0x4af479<_0x1893b5['length'];_0x4af479++){var _0x4f1a56=_0x1893b5[_0x4af479];if(_0x4f1a56[_0x9496('0x4')]==='string'){_0x10df68['push'](_0x4f1a56[_0x9496('0x5')]);}else if(_0x4f1a56[_0x9496('0x4')]===_0x9496('0x6')&&_0x4f1a56[_0x9496('0x7')]){_0x52554c[_0x4f1a56['variableName']]&&_0x10df68['push'](_0x52554c[_0x4f1a56[_0x9496('0x7')]][_0x9496('0x8')]());}else if(_0x4f1a56[_0x9496('0x4')]===_0x9496('0x9')&&_0x4f1a56['Variable']&&_0x4f1a56[_0x9496('0xa')][_0x9496('0xb')]){_0x52554c[_0x4f1a56[_0x9496('0xa')][_0x9496('0xb')][_0x9496('0xc')]()]&&_0x10df68['push'](_0x52554c[_0x4f1a56['Variable'][_0x9496('0xb')]['toLowerCase']()][_0x9496('0x8')]());}else if(_0x4f1a56['type']==='keyValue'){if(_0x4f1a56['keyType']===_0x9496('0xd')&&_0x4f1a56[_0x9496('0xe')]){_0x10df68[_0x9496('0xf')](util['format']('%s:\x20%s',_0x4f1a56[_0x9496('0xe')],_0x4f1a56[_0x9496('0x10')]));}else if(_0x4f1a56['keyType']===_0x9496('0x6')&&_0x4f1a56[_0x9496('0x7')]&&_0x4f1a56[_0x9496('0xe')]){_0x52554c[_0x4f1a56[_0x9496('0x7')]]&&_0x10df68[_0x9496('0xf')](util['format'](_0x9496('0x11'),_0x4f1a56[_0x9496('0xe')],_0x52554c[_0x4f1a56[_0x9496('0x7')]]));}else if(_0x4f1a56['keyType']===_0x9496('0x9')&&_0x4f1a56[_0x9496('0xa')]&&_0x4f1a56[_0x9496('0xa')]['name']&&_0x4f1a56[_0x9496('0xe')]){_0x52554c[_0x4f1a56[_0x9496('0xa')][_0x9496('0xb')][_0x9496('0xc')]()]&&_0x10df68[_0x9496('0xf')](util['format'](_0x9496('0x11'),_0x4f1a56['key'],_0x52554c[_0x4f1a56[_0x9496('0xa')][_0x9496('0xb')][_0x9496('0xc')]()]));}}}}return _0x10df68[_0x9496('0x12')](_0x45e7cd);};exports['stripTrailingSlash']=function(_0x4e69d4){if(_0x4e69d4&&_0x4e69d4[_0x9496('0x13')](-0x1)==='/'){return _0x4e69d4[_0x9496('0x13')](0x0,_0x4e69d4[_0x9496('0x2')]-0x1);}return _0x4e69d4;};exports[_0x9496('0x14')]=function(_0x2c060b){if(_0x2c060b&&_0x2c060b!==''){var _0x4c75a8=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x4c75a8[_0x9496('0x15')](String(_0x2c060b)[_0x9496('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index eb164fe..e896450 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 _0xb58b=['[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridnum','The\x20Enduser\x20ID\x20is:','abandoned','The\x20User\x20ID\x20is:','request-promise','bluebird','md5','ioredis','./util','../../../../config/logger','redis','defaults','socket.io-emitter','emit','length','forEach','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Open','getString','Subjects','Descriptions','POST','format','%s/webservice.php','create','sessionName','HelpDesk','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','remoteUri','query','admin','Agent\x20found!','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','username','getUser','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','accessKey','getchallenge','login','token','getConnection','[HTTP]','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','serverUrl','recordingFormat','none'];(function(_0x40eb43,_0x51b961){var _0x27dcf5=function(_0x2b3e69){while(--_0x2b3e69){_0x40eb43['push'](_0x40eb43['shift']());}};_0x27dcf5(++_0x51b961);}(_0xb58b,0x1f1));var _0xbb58=function(_0x5b8aa9,_0xf9e326){_0x5b8aa9=_0x5b8aa9-0x0;var _0x4afc73=_0xb58b[_0x5b8aa9];return _0x4afc73;};'use strict';var _=require('lodash');var rp=require(_0xbb58('0x0'));var BPromise=require(_0xbb58('0x1'));var md5=require(_0xbb58('0x2'));var util=require('util');var Redis=require(_0xbb58('0x3'));var intUtil=require(_0xbb58('0x4'));var config=require('../../../../config/environment');var logger=require(_0xbb58('0x5'))('vTiger');config[_0xbb58('0x6')]=_[_0xbb58('0x7')](config[_0xbb58('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xbb58('0x8'))(new Redis(config[_0xbb58('0x6')]));function emit(_0xe874f2,_0x5d7fe8,_0xd94f1){io['to'](_0xe874f2)[_0xbb58('0x9')](_0x5d7fe8,_0xd94f1);}function getCustomFields(_0xc9e5bc,_0x36ca50){var _0x429e75={};if(_0xc9e5bc[_0xbb58('0xa')]>0x0){_[_0xbb58('0xb')](_0xc9e5bc,function(_0x4bb8c5){if(_0x4bb8c5[_0xbb58('0xc')]==='string'&&_0x4bb8c5[_0xbb58('0xd')]){_0x429e75[_0x4bb8c5[_0xbb58('0xd')]]=_0x4bb8c5[_0xbb58('0xe')][_0xbb58('0xf')]();}else if(_0x4bb8c5['type']===_0xbb58('0x10')&&_0x4bb8c5[_0xbb58('0x11')]&&_0x4bb8c5['idField']&&_0x36ca50[_0x4bb8c5[_0xbb58('0x11')]]){_0x429e75[_0x4bb8c5[_0xbb58('0xd')]]=_0x36ca50[_0x4bb8c5[_0xbb58('0x11')]][_0xbb58('0xf')]();}else if(_0x4bb8c5[_0xbb58('0xc')]==='customVariable'&&_0x4bb8c5[_0xbb58('0x12')]&&_0x4bb8c5[_0xbb58('0x12')]['name']&&_0x4bb8c5['idField']&&_0x36ca50[_0x4bb8c5[_0xbb58('0x12')][_0xbb58('0x13')][_0xbb58('0x14')]()]){_0x429e75[_0x4bb8c5['idField']]=_0x36ca50[_0x4bb8c5['Variable']['name']['toLowerCase']()][_0xbb58('0xf')]();}});}return _0x429e75;}function createTicket(_0x3134ea,_0x48f3e0,_0xbee66,_0x497653,_0x2cf892,_0xe0bd6c,_0x3c33d9){logger[_0xbb58('0x15')](_0xbb58('0x16'));var _0x37a655=_[_0xbb58('0x17')]({'parent_id':'','assigned_user_id':_0x48f3e0['id'],'ticketpriorities':'Normal','ticketstatus':_0xbb58('0x18'),'ticket_title':intUtil[_0xbb58('0x19')](_0x497653[_0xbb58('0x1a')],_0x2cf892,'\x20'),'description':intUtil[_0xbb58('0x19')](_0x497653[_0xbb58('0x1b')],_0x2cf892,'\x0a'),'contact_id':_0xbee66['id']},getCustomFields(_0xe0bd6c,_0x2cf892));var _0x5d4a91={'method':_0xbb58('0x1c'),'uri':util[_0xbb58('0x1d')](_0xbb58('0x1e'),_0x3134ea['remoteUri']),'form':{'operation':_0xbb58('0x1f'),'username':'admin','sessionName':_0x3c33d9[_0xbb58('0x20')],'elementType':_0xbb58('0x21'),'element':JSON[_0xbb58('0x22')](_0x37a655)},'json':!![]};return request(_0x5d4a91)[_0xbb58('0x23')](function(_0x2d111c){if(_0x2d111c[_0xbb58('0x24')]){return BPromise[_0xbb58('0x25')]({'id':_0x2d111c[_0xbb58('0x26')]['id']});}else{throw new Error(util['format'](_0xbb58('0x27'),JSON[_0xbb58('0x22')](_0x2d111c[_0xbb58('0x28')])));}})[_0xbb58('0x29')](function(_0x8e9ed9){var _0x521d0c=_0x8e9ed9[_0xbb58('0x2a')]||0x1f4;logger[_0xbb58('0x28')](_0xbb58('0x2b'),_0xbb58('0x2c'),_0x521d0c,JSON[_0xbb58('0x22')](_0x8e9ed9));});}function getUser(_0x28b3a3,_0x2a0481,_0x4157c4){if(intUtil[_0xbb58('0x2d')](_0x2a0481)){logger['info'](_0xbb58('0x2e'),_0x2a0481);return request({'method':_0xbb58('0x2f'),'uri':util[_0xbb58('0x1d')](_0xbb58('0x1e'),_0x28b3a3[_0xbb58('0x30')]),'qs':{'operation':_0xbb58('0x31'),'username':_0xbb58('0x32'),'sessionName':_0x4157c4[_0xbb58('0x20')],'query':util[_0xbb58('0x1d')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x2a0481)},'json':!![]})[_0xbb58('0x23')](function(_0x22329b){if(_0x22329b[_0xbb58('0x24')]&&_0x22329b[_0xbb58('0x26')][_0xbb58('0xa')]){logger[_0xbb58('0x15')](_0xbb58('0x33'));return BPromise[_0xbb58('0x25')]({'id':_0x22329b[_0xbb58('0x26')][0x0]['id'],'email':_0x22329b[_0xbb58('0x26')][0x0][_0xbb58('0x34')],'name':_0x22329b[_0xbb58('0x26')][0x0][_0xbb58('0x35')]+'\x20'+_0x22329b['result']['last_name']});}else{logger['info'](_0xbb58('0x36'));return BPromise[_0xbb58('0x25')]({'id':_0x4157c4[_0xbb58('0x37')],'email':_0x28b3a3[_0xbb58('0x38')],'name':_0xbb58('0x32')});}})[_0xbb58('0x29')](function(_0x3093bf){var _0x29137f=_0x3093bf['statusCode']||0x1f4;logger[_0xbb58('0x28')](_0xbb58('0x2b'),'getUser',_0x29137f,JSON[_0xbb58('0x22')](_0x3093bf));});}else{logger['info'](_0xbb58('0x36'));return BPromise['resolve']({'id':_0x4157c4[_0xbb58('0x37')],'email':_0x28b3a3[_0xbb58('0x38')],'name':'admin'})[_0xbb58('0x29')](function(_0x300c7b){var _0x12626c=_0x300c7b[_0xbb58('0x2a')]||0x1f4;logger[_0xbb58('0x28')](_0xbb58('0x2b'),_0xbb58('0x39'),_0x12626c,JSON[_0xbb58('0x22')](_0x300c7b));});}}function getEndUser(_0x4e9c19,_0x238662,_0x31aa4b,_0x2da5ff){logger['info']('Searching\x20end\x20user\x20with\x20phone',_0x31aa4b);return request({'method':_0xbb58('0x2f'),'uri':util['format'](_0xbb58('0x1e'),_0x4e9c19[_0xbb58('0x30')]),'qs':{'operation':_0xbb58('0x31'),'username':'admin','sessionName':_0x2da5ff['sessionName'],'query':util[_0xbb58('0x1d')](_0xbb58('0x3a'),_0x31aa4b,_0x31aa4b,_0x31aa4b,_0x31aa4b,_0x31aa4b)},'json':!![]})[_0xbb58('0x23')](function(_0x24d82d){if(_0x24d82d[_0xbb58('0x24')]&&_0x24d82d[_0xbb58('0x26')]['length']){logger[_0xbb58('0x15')](_0xbb58('0x3b'));return BPromise[_0xbb58('0x25')]({'id':_0x24d82d[_0xbb58('0x26')][0x0]['id'],'name':_0x24d82d[_0xbb58('0x26')][0x0][_0xbb58('0x3c')]+'\x20'+_0x24d82d['result'][0x0][_0xbb58('0x3d')],'phone':_0x31aa4b});}else{logger['info'](_0xbb58('0x3e'));return request({'method':_0xbb58('0x1c'),'uri':util[_0xbb58('0x1d')](_0xbb58('0x1e'),_0x4e9c19['remoteUri']),'form':{'operation':_0xbb58('0x1f'),'sessionName':_0x2da5ff[_0xbb58('0x20')],'elementType':_0xbb58('0x3f'),'element':JSON[_0xbb58('0x22')]({'lastname':_0x238662,'phone':_0x31aa4b,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x2ecc1b){logger['info'](_0xbb58('0x40'));return BPromise[_0xbb58('0x25')]({'id':_0x2ecc1b[_0xbb58('0x26')]['id'],'name':_0x2ecc1b[_0xbb58('0x26')][_0xbb58('0x3d')],'phone':_0x2ecc1b[_0xbb58('0x26')][_0xbb58('0x41')]});})[_0xbb58('0x29')](function(_0x18799c){var _0x444906=_0x18799c[_0xbb58('0x2a')]||0x1f4;logger[_0xbb58('0x28')](_0xbb58('0x2b'),'getEndUser',_0x444906,JSON[_0xbb58('0x22')](_0x18799c));});}});}function getConnection(_0x5b5190){var _0x5c1878=_0x5b5190[_0xbb58('0x38')];var _0x75cc18=_0x5b5190[_0xbb58('0x42')];return request({'method':_0xbb58('0x2f'),'uri':util[_0xbb58('0x1d')](_0xbb58('0x1e'),_0x5b5190[_0xbb58('0x30')]),'qs':{'operation':_0xbb58('0x43'),'username':_0x5c1878},'json':!![]})[_0xbb58('0x23')](function(_0x39995e){if(_0x39995e[_0xbb58('0x24')]){return request({'method':'POST','uri':util[_0xbb58('0x1d')](_0xbb58('0x1e'),_0x5b5190['remoteUri']),'form':{'operation':_0xbb58('0x44'),'username':_0xbb58('0x32'),'accessKey':md5(_0x39995e[_0xbb58('0x26')][_0xbb58('0x45')]+_0x75cc18)},'json':!![]});}})['then'](function(_0x17418c){if(_0x17418c['success']){return BPromise[_0xbb58('0x25')](_0x17418c[_0xbb58('0x26')]);}else{throw new Error(util[_0xbb58('0x1d')]('Account\x20%d\x20is\x20not\x20valid',_0x5b5190['id']));}})[_0xbb58('0x29')](function(_0xc30dbd){var _0x51c9ee=_0xc30dbd[_0xbb58('0x2a')]||0x1f4;logger['error'](_0xbb58('0x2b'),_0xbb58('0x46'),_0x51c9ee,JSON[_0xbb58('0x22')](_0xc30dbd));});}function request(_0x1ec976){logger[_0xbb58('0x15')](_0xbb58('0x47'),JSON[_0xbb58('0x22')](_0x1ec976));return rp(_0x1ec976);}exports['queue']=function(_0x449088,_0x1fd892,_0x592da8,_0x3efbc6,_0x98157,_0x5c19b7){var _0x22802c,_0x44636b,_0x44d579,_0x4e21e0;_0x5c19b7[_0xbb58('0x30')]=intUtil[_0xbb58('0x48')](_0x5c19b7[_0xbb58('0x30')]);if(_0x98157&&_0x98157['monitor_format']){logger[_0xbb58('0x15')]('[QUEUE]',_0xbb58('0x49'));_0x1fd892[_0xbb58('0x4a')]=util[_0xbb58('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5c19b7['serverUrl'],_0x1fd892[_0xbb58('0x4b')],md5(_0x1fd892[_0xbb58('0x4b')]));}else{_0x1fd892[_0xbb58('0x4a')]='';}return getConnection(_0x5c19b7)[_0xbb58('0x23')](function(_0x45114b){_0x4e21e0=_0x45114b;return getUser(_0x5c19b7,_0x3efbc6['email'],_0x4e21e0);})[_0xbb58('0x23')](function(_0x44ed8b){_0x22802c=_0x44ed8b;logger[_0xbb58('0x15')]('The\x20User\x20ID\x20is:',_0x22802c['id']);return getEndUser(_0x5c19b7,_0x1fd892[_0xbb58('0x4c')],_0x1fd892[_0xbb58('0x4d')],_0x4e21e0);})[_0xbb58('0x23')](function(_0x3365ae){_0x44636b=_0x3365ae;logger[_0xbb58('0x15')]('The\x20Enduser\x20ID\x20is:',_0x44636b['id']);return createTicket(_0x5c19b7,_0x22802c,_0x44636b,_0x592da8,_0x1fd892,_0x592da8[_0xbb58('0x4e')],_0x4e21e0);})[_0xbb58('0x23')](function(_0x1553d6){_0x44d579=_0x1553d6;logger[_0xbb58('0x15')](_0xbb58('0x4f'));logger[_0xbb58('0x15')](_0xbb58('0x50'),_0x44d579['id']);var _0x58ced2=util['format'](_0xbb58('0x51'),_0x5c19b7['remoteUri'],_[_0xbb58('0x52')](_0x44d579['id'],'x')[0x1]);logger[_0xbb58('0x15')](_0xbb58('0x53'),_0xbb58('0x54'));emit(util[_0xbb58('0x1d')](_0xbb58('0x55'),_0x3efbc6[_0xbb58('0x13')]),_0xbb58('0x56'),{'uri':_0x58ced2});})[_0xbb58('0x29')](function(_0x11ddd7){logger[_0xbb58('0x28')]('[QUEUE]',JSON[_0xbb58('0x22')](_0x11ddd7));});};exports[_0xbb58('0x57')]=function(_0xbb6b8,_0x586b5c,_0x39e70c,_0x4d5419,_0x2d6f45,_0x906b9a,_0x56b703){var _0x143a40,_0x2ad5a5,_0x452da6,_0x18a817;_0x906b9a[_0xbb58('0x30')]=intUtil['stripTrailingSlash'](_0x906b9a['remoteUri']);_0x906b9a[_0xbb58('0x58')]=intUtil[_0xbb58('0x48')](_0x906b9a[_0xbb58('0x58')]);if(_0x56b703&&_0x56b703['recordingFormat']&&_0x56b703[_0xbb58('0x59')]!==_0xbb58('0x5a')){logger['info'](_0xbb58('0x5b'),_0xbb58('0x49'));_0x586b5c['recordingURL']=util[_0xbb58('0x1d')](_0xbb58('0x5c'),_0x906b9a[_0xbb58('0x58')],_0x586b5c[_0xbb58('0x4b')],md5(_0x586b5c[_0xbb58('0x4b')]));}return getConnection(_0x906b9a)['then'](function(_0x1b611b){_0x18a817=_0x1b611b;return getUser(_0x906b9a,_0x4d5419[_0xbb58('0x5d')],_0x18a817);})[_0xbb58('0x23')](function(_0x1da9c7){_0x143a40=_0x1da9c7;logger[_0xbb58('0x15')]('The\x20User\x20ID\x20is:',_0x143a40['id']);return getEndUser(_0x906b9a,_0x586b5c['destcalleridname'],_0x586b5c[_0xbb58('0x5e')],_0x18a817);})['then'](function(_0x31a8d1){_0x2ad5a5=_0x31a8d1;logger[_0xbb58('0x15')](_0xbb58('0x5f'),_0x2ad5a5['id']);return createTicket(_0x906b9a,_0x143a40,_0x2ad5a5,_0x39e70c,_0x586b5c,_0x39e70c[_0xbb58('0x4e')],_0x18a817);})[_0xbb58('0x23')](function(_0x3e63a6){_0x452da6=_0x3e63a6;logger[_0xbb58('0x15')](_0xbb58('0x4f'));logger[_0xbb58('0x15')](_0xbb58('0x50'),_0x452da6['id']);var _0x4c1162=util[_0xbb58('0x1d')](_0xbb58('0x51'),_0x906b9a[_0xbb58('0x30')],_['split'](_0x452da6['id'],'x')[0x1]);logger[_0xbb58('0x15')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xbb58('0x1d')](_0xbb58('0x55'),_0x4d5419[_0xbb58('0x13')]),_0xbb58('0x56'),{'uri':_0x4c1162});})['catch'](function(_0x51c6f9){logger[_0xbb58('0x28')](_0xbb58('0x5b'),JSON['stringify'](_0x51c6f9));});};exports[_0xbb58('0x60')]=function(_0x2ba4a9,_0x3cd96a,_0x32cb70,_0x382d16,_0x55d3c5,_0x30b8d2){var _0x5b27d2,_0x52cf79,_0x11896d,_0x38d171;_0x30b8d2[_0xbb58('0x30')]=intUtil['stripTrailingSlash'](_0x30b8d2[_0xbb58('0x30')]);_0x30b8d2[_0xbb58('0x58')]=intUtil[_0xbb58('0x48')](_0x30b8d2[_0xbb58('0x58')]);if(_0x55d3c5&&_0x55d3c5['monitor_format']){logger[_0xbb58('0x15')]('[ABANDONED]','Recording\x20is\x20enabled!');_0x3cd96a[_0xbb58('0x4a')]=util[_0xbb58('0x1d')](_0xbb58('0x5c'),_0x30b8d2['serverUrl'],_0x3cd96a['uniqueid'],md5(_0x3cd96a[_0xbb58('0x4b')]));}else{_0x3cd96a[_0xbb58('0x4a')]='';}return getConnection(_0x30b8d2)[_0xbb58('0x23')](function(_0x2627a8){_0x38d171=_0x2627a8;return getUser(_0x30b8d2,'',_0x38d171);})[_0xbb58('0x23')](function(_0x39b402){_0x5b27d2=_0x39b402;logger[_0xbb58('0x15')](_0xbb58('0x61'),_0x5b27d2['id']);return getEndUser(_0x30b8d2,_0x3cd96a[_0xbb58('0x4c')],_0x3cd96a[_0xbb58('0x4d')],_0x38d171);})[_0xbb58('0x23')](function(_0x5b4590){_0x52cf79=_0x5b4590;logger['info'](_0xbb58('0x5f'),_0x52cf79['id']);return createTicket(_0x30b8d2,_0x5b27d2,_0x52cf79,_0x32cb70,_0x3cd96a,_0x32cb70[_0xbb58('0x4e')],_0x38d171);})[_0xbb58('0x23')](function(_0x54cd7d){_0x11896d=_0x54cd7d;logger[_0xbb58('0x15')](_0xbb58('0x4f'));logger[_0xbb58('0x15')]('The\x20Ticket\x20ID\x20is:',_0x11896d['id']);})[_0xbb58('0x29')](function(_0x599926){logger[_0xbb58('0x28')]('[ABANDONED]',JSON[_0xbb58('0x22')](_0x599926));});}; \ No newline at end of file +var _0x7b6b=['getString','Descriptions','POST','format','%s/webservice.php','remoteUri','create','admin','sessionName','HelpDesk','stringify','then','success','result','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','resolve','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','getUser','userId','username','Searching\x20end\x20user\x20with\x20phone','query','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','lastname','phone','getEndUser','accessKey','getchallenge','getConnection','[HTTP]','queue','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','serverUrl','uniqueid','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridnum','split','The\x20Ticket\x20ID\x20is:','lodash','bluebird','md5','util','./util','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','type','string','idField','content','toString','variable','variableName','Variable','toLowerCase','name','info','merge'];(function(_0xde06d1,_0x101962){var _0x3d713e=function(_0x2f3a8f){while(--_0x2f3a8f){_0xde06d1['push'](_0xde06d1['shift']());}};_0x3d713e(++_0x101962);}(_0x7b6b,0xac));var _0xb7b6=function(_0x4e0f18,_0xc40b52){_0x4e0f18=_0x4e0f18-0x0;var _0xeb833d=_0x7b6b[_0x4e0f18];return _0xeb833d;};'use strict';var _=require(_0xb7b6('0x0'));var rp=require('request-promise');var BPromise=require(_0xb7b6('0x1'));var md5=require(_0xb7b6('0x2'));var util=require(_0xb7b6('0x3'));var Redis=require('ioredis');var intUtil=require(_0xb7b6('0x4'));var config=require('../../../../config/environment');var logger=require(_0xb7b6('0x5'))(_0xb7b6('0x6'));config[_0xb7b6('0x7')]=_[_0xb7b6('0x8')](config[_0xb7b6('0x7')],{'host':_0xb7b6('0x9'),'port':0x18eb});var io=require(_0xb7b6('0xa'))(new Redis(config[_0xb7b6('0x7')]));function emit(_0x36cd51,_0x31809b,_0xb5b26f){io['to'](_0x36cd51)[_0xb7b6('0xb')](_0x31809b,_0xb5b26f);}function getCustomFields(_0x60acc0,_0x313aa8){var _0x22ee5f={};if(_0x60acc0[_0xb7b6('0xc')]>0x0){_[_0xb7b6('0xd')](_0x60acc0,function(_0x2b34df){if(_0x2b34df[_0xb7b6('0xe')]===_0xb7b6('0xf')&&_0x2b34df['idField']){_0x22ee5f[_0x2b34df[_0xb7b6('0x10')]]=_0x2b34df[_0xb7b6('0x11')][_0xb7b6('0x12')]();}else if(_0x2b34df[_0xb7b6('0xe')]===_0xb7b6('0x13')&&_0x2b34df[_0xb7b6('0x14')]&&_0x2b34df[_0xb7b6('0x10')]&&_0x313aa8[_0x2b34df[_0xb7b6('0x14')]]){_0x22ee5f[_0x2b34df[_0xb7b6('0x10')]]=_0x313aa8[_0x2b34df[_0xb7b6('0x14')]][_0xb7b6('0x12')]();}else if(_0x2b34df[_0xb7b6('0xe')]==='customVariable'&&_0x2b34df['Variable']&&_0x2b34df[_0xb7b6('0x15')]['name']&&_0x2b34df['idField']&&_0x313aa8[_0x2b34df[_0xb7b6('0x15')]['name'][_0xb7b6('0x16')]()]){_0x22ee5f[_0x2b34df[_0xb7b6('0x10')]]=_0x313aa8[_0x2b34df[_0xb7b6('0x15')][_0xb7b6('0x17')][_0xb7b6('0x16')]()][_0xb7b6('0x12')]();}});}return _0x22ee5f;}function createTicket(_0x3dc0f8,_0x7bb633,_0x5667d9,_0x314049,_0x2db570,_0x4e1ca3,_0xddaed6){logger[_0xb7b6('0x18')]('Creating\x20new\x20ticket...');var _0x23bc07=_[_0xb7b6('0x19')]({'parent_id':'','assigned_user_id':_0x7bb633['id'],'ticketpriorities':'Normal','ticketstatus':'Open','ticket_title':intUtil[_0xb7b6('0x1a')](_0x314049['Subjects'],_0x2db570,'\x20'),'description':intUtil[_0xb7b6('0x1a')](_0x314049[_0xb7b6('0x1b')],_0x2db570,'\x0a'),'contact_id':_0x5667d9['id']},getCustomFields(_0x4e1ca3,_0x2db570));var _0xdb7eca={'method':_0xb7b6('0x1c'),'uri':util[_0xb7b6('0x1d')](_0xb7b6('0x1e'),_0x3dc0f8[_0xb7b6('0x1f')]),'form':{'operation':_0xb7b6('0x20'),'username':_0xb7b6('0x21'),'sessionName':_0xddaed6[_0xb7b6('0x22')],'elementType':_0xb7b6('0x23'),'element':JSON[_0xb7b6('0x24')](_0x23bc07)},'json':!![]};return request(_0xdb7eca)[_0xb7b6('0x25')](function(_0x56804d){if(_0x56804d[_0xb7b6('0x26')]){return BPromise['resolve']({'id':_0x56804d[_0xb7b6('0x27')]['id']});}else{throw new Error(util['format']('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON['stringify'](_0x56804d[_0xb7b6('0x28')])));}})['catch'](function(_0x5bd431){var _0x449d06=_0x5bd431[_0xb7b6('0x29')]||0x1f4;logger[_0xb7b6('0x28')](_0xb7b6('0x2a'),_0xb7b6('0x2b'),_0x449d06,JSON[_0xb7b6('0x24')](_0x5bd431));});}function getUser(_0x3dc58e,_0x5c610a,_0x5d546a){if(intUtil[_0xb7b6('0x2c')](_0x5c610a)){logger[_0xb7b6('0x18')](_0xb7b6('0x2d'),_0x5c610a);return request({'method':_0xb7b6('0x2e'),'uri':util[_0xb7b6('0x1d')]('%s/webservice.php',_0x3dc58e[_0xb7b6('0x1f')]),'qs':{'operation':'query','username':'admin','sessionName':_0x5d546a[_0xb7b6('0x22')],'query':util[_0xb7b6('0x1d')](_0xb7b6('0x2f'),_0x5c610a)},'json':!![]})[_0xb7b6('0x25')](function(_0x899fda){if(_0x899fda['success']&&_0x899fda['result'][_0xb7b6('0xc')]){logger[_0xb7b6('0x18')](_0xb7b6('0x30'));return BPromise[_0xb7b6('0x31')]({'id':_0x899fda[_0xb7b6('0x27')][0x0]['id'],'email':_0x899fda[_0xb7b6('0x27')][0x0][_0xb7b6('0x32')],'name':_0x899fda['result'][0x0][_0xb7b6('0x33')]+'\x20'+_0x899fda[_0xb7b6('0x27')][_0xb7b6('0x34')]});}else{logger['info'](_0xb7b6('0x35'));return BPromise[_0xb7b6('0x31')]({'id':_0x5d546a['userId'],'email':_0x3dc58e['username'],'name':'admin'});}})[_0xb7b6('0x36')](function(_0x5c80a2){var _0x370c6c=_0x5c80a2[_0xb7b6('0x29')]||0x1f4;logger[_0xb7b6('0x28')](_0xb7b6('0x2a'),_0xb7b6('0x37'),_0x370c6c,JSON['stringify'](_0x5c80a2));});}else{logger['info'](_0xb7b6('0x35'));return BPromise[_0xb7b6('0x31')]({'id':_0x5d546a[_0xb7b6('0x38')],'email':_0x3dc58e[_0xb7b6('0x39')],'name':_0xb7b6('0x21')})[_0xb7b6('0x36')](function(_0x288f5f){var _0x46030d=_0x288f5f['statusCode']||0x1f4;logger[_0xb7b6('0x28')](_0xb7b6('0x2a'),'getUser',_0x46030d,JSON[_0xb7b6('0x24')](_0x288f5f));});}}function getEndUser(_0x2ca328,_0x36993e,_0x54a606,_0x5283a2){logger[_0xb7b6('0x18')](_0xb7b6('0x3a'),_0x54a606);return request({'method':_0xb7b6('0x2e'),'uri':util['format']('%s/webservice.php',_0x2ca328[_0xb7b6('0x1f')]),'qs':{'operation':_0xb7b6('0x3b'),'username':_0xb7b6('0x21'),'sessionName':_0x5283a2[_0xb7b6('0x22')],'query':util[_0xb7b6('0x1d')](_0xb7b6('0x3c'),_0x54a606,_0x54a606,_0x54a606,_0x54a606,_0x54a606)},'json':!![]})['then'](function(_0x1b2e67){if(_0x1b2e67[_0xb7b6('0x26')]&&_0x1b2e67['result']['length']){logger[_0xb7b6('0x18')](_0xb7b6('0x3d'));return BPromise[_0xb7b6('0x31')]({'id':_0x1b2e67['result'][0x0]['id'],'name':_0x1b2e67[_0xb7b6('0x27')][0x0][_0xb7b6('0x3e')]+'\x20'+_0x1b2e67[_0xb7b6('0x27')][0x0]['lastname'],'phone':_0x54a606});}else{logger[_0xb7b6('0x18')](_0xb7b6('0x3f'));return request({'method':_0xb7b6('0x1c'),'uri':util[_0xb7b6('0x1d')](_0xb7b6('0x1e'),_0x2ca328['remoteUri']),'form':{'operation':_0xb7b6('0x20'),'sessionName':_0x5283a2['sessionName'],'elementType':'Contacts','element':JSON[_0xb7b6('0x24')]({'lastname':_0x36993e,'phone':_0x54a606,'assigned_user_id':'\x20'})},'json':!![]})[_0xb7b6('0x25')](function(_0xa038dd){logger[_0xb7b6('0x18')](_0xb7b6('0x40'));return BPromise['resolve']({'id':_0xa038dd[_0xb7b6('0x27')]['id'],'name':_0xa038dd[_0xb7b6('0x27')][_0xb7b6('0x41')],'phone':_0xa038dd[_0xb7b6('0x27')][_0xb7b6('0x42')]});})[_0xb7b6('0x36')](function(_0x59b74b){var _0x2536c8=_0x59b74b[_0xb7b6('0x29')]||0x1f4;logger[_0xb7b6('0x28')](_0xb7b6('0x2a'),_0xb7b6('0x43'),_0x2536c8,JSON[_0xb7b6('0x24')](_0x59b74b));});}});}function getConnection(_0x1ecd4b){var _0x54dd43=_0x1ecd4b[_0xb7b6('0x39')];var _0x2eb4f1=_0x1ecd4b[_0xb7b6('0x44')];return request({'method':_0xb7b6('0x2e'),'uri':util[_0xb7b6('0x1d')]('%s/webservice.php',_0x1ecd4b[_0xb7b6('0x1f')]),'qs':{'operation':_0xb7b6('0x45'),'username':_0x54dd43},'json':!![]})[_0xb7b6('0x25')](function(_0x5e194f){if(_0x5e194f[_0xb7b6('0x26')]){return request({'method':'POST','uri':util[_0xb7b6('0x1d')]('%s/webservice.php',_0x1ecd4b[_0xb7b6('0x1f')]),'form':{'operation':'login','username':_0xb7b6('0x21'),'accessKey':md5(_0x5e194f['result']['token']+_0x2eb4f1)},'json':!![]});}})['then'](function(_0x53a9ad){if(_0x53a9ad[_0xb7b6('0x26')]){return BPromise[_0xb7b6('0x31')](_0x53a9ad[_0xb7b6('0x27')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x1ecd4b['id']));}})[_0xb7b6('0x36')](function(_0x3254eb){var _0x4497d2=_0x3254eb[_0xb7b6('0x29')]||0x1f4;logger[_0xb7b6('0x28')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xb7b6('0x46'),_0x4497d2,JSON[_0xb7b6('0x24')](_0x3254eb));});}function request(_0x524846){logger['info'](_0xb7b6('0x47'),JSON[_0xb7b6('0x24')](_0x524846));return rp(_0x524846);}exports[_0xb7b6('0x48')]=function(_0x51915d,_0x1b2b83,_0x225ef8,_0x3a47c1,_0x2684e5,_0x382cf8){var _0x3aa819,_0x24c04d,_0x38d405,_0x3b3b9a;_0x382cf8[_0xb7b6('0x1f')]=intUtil[_0xb7b6('0x49')](_0x382cf8[_0xb7b6('0x1f')]);if(_0x2684e5&&_0x2684e5[_0xb7b6('0x4a')]){logger[_0xb7b6('0x18')](_0xb7b6('0x4b'),'Recording\x20is\x20enabled!');_0x1b2b83[_0xb7b6('0x4c')]=util[_0xb7b6('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x382cf8[_0xb7b6('0x4d')],_0x1b2b83[_0xb7b6('0x4e')],md5(_0x1b2b83[_0xb7b6('0x4e')]));}else{_0x1b2b83['recordingURL']='';}return getConnection(_0x382cf8)[_0xb7b6('0x25')](function(_0x2fe2b7){_0x3b3b9a=_0x2fe2b7;return getUser(_0x382cf8,_0x3a47c1[_0xb7b6('0x4f')],_0x3b3b9a);})[_0xb7b6('0x25')](function(_0x3154e5){_0x3aa819=_0x3154e5;logger[_0xb7b6('0x18')]('The\x20User\x20ID\x20is:',_0x3aa819['id']);return getEndUser(_0x382cf8,_0x1b2b83[_0xb7b6('0x50')],_0x1b2b83[_0xb7b6('0x51')],_0x3b3b9a);})['then'](function(_0x5b970d){_0x24c04d=_0x5b970d;logger[_0xb7b6('0x18')](_0xb7b6('0x52'),_0x24c04d['id']);return createTicket(_0x382cf8,_0x3aa819,_0x24c04d,_0x225ef8,_0x1b2b83,_0x225ef8[_0xb7b6('0x53')],_0x3b3b9a);})['then'](function(_0x38567c){_0x38d405=_0x38567c;logger[_0xb7b6('0x18')](_0xb7b6('0x54'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x38d405['id']);var _0x386a9f=util[_0xb7b6('0x1d')](_0xb7b6('0x55'),_0x382cf8[_0xb7b6('0x1f')],_['split'](_0x38d405['id'],'x')[0x1]);logger[_0xb7b6('0x18')]('[QUEUE]',_0xb7b6('0x56'));emit(util[_0xb7b6('0x1d')](_0xb7b6('0x57'),_0x3a47c1[_0xb7b6('0x17')]),_0xb7b6('0x58'),{'uri':_0x386a9f});})[_0xb7b6('0x36')](function(_0x540ac4){logger[_0xb7b6('0x28')](_0xb7b6('0x4b'),JSON[_0xb7b6('0x24')](_0x540ac4));});};exports[_0xb7b6('0x59')]=function(_0x4554c0,_0x12eadc,_0x38c9de,_0x1a55f8,_0x2e287e,_0x8874f7,_0x5b406d){var _0x4ef12f,_0x1ef0f9,_0x536bff,_0x5eb554;_0x8874f7[_0xb7b6('0x1f')]=intUtil[_0xb7b6('0x49')](_0x8874f7[_0xb7b6('0x1f')]);_0x8874f7[_0xb7b6('0x4d')]=intUtil[_0xb7b6('0x49')](_0x8874f7[_0xb7b6('0x4d')]);if(_0x5b406d&&_0x5b406d[_0xb7b6('0x5a')]&&_0x5b406d[_0xb7b6('0x5a')]!==_0xb7b6('0x5b')){logger[_0xb7b6('0x18')](_0xb7b6('0x5c'),_0xb7b6('0x5d'));_0x12eadc[_0xb7b6('0x4c')]=util[_0xb7b6('0x1d')](_0xb7b6('0x5e'),_0x8874f7['serverUrl'],_0x12eadc[_0xb7b6('0x4e')],md5(_0x12eadc[_0xb7b6('0x4e')]));}return getConnection(_0x8874f7)[_0xb7b6('0x25')](function(_0xba94c7){_0x5eb554=_0xba94c7;return getUser(_0x8874f7,_0x1a55f8[_0xb7b6('0x4f')],_0x5eb554);})[_0xb7b6('0x25')](function(_0x220f00){_0x4ef12f=_0x220f00;logger[_0xb7b6('0x18')](_0xb7b6('0x5f'),_0x4ef12f['id']);return getEndUser(_0x8874f7,_0x12eadc['destcalleridname'],_0x12eadc[_0xb7b6('0x60')],_0x5eb554);})[_0xb7b6('0x25')](function(_0x5367d4){_0x1ef0f9=_0x5367d4;logger['info']('The\x20Enduser\x20ID\x20is:',_0x1ef0f9['id']);return createTicket(_0x8874f7,_0x4ef12f,_0x1ef0f9,_0x38c9de,_0x12eadc,_0x38c9de[_0xb7b6('0x53')],_0x5eb554);})[_0xb7b6('0x25')](function(_0x2b094b){_0x536bff=_0x2b094b;logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x536bff['id']);var _0x4bead2=util['format'](_0xb7b6('0x55'),_0x8874f7[_0xb7b6('0x1f')],_[_0xb7b6('0x61')](_0x536bff['id'],'x')[0x1]);logger[_0xb7b6('0x18')](_0xb7b6('0x5c'),_0xb7b6('0x56'));emit(util['format'](_0xb7b6('0x57'),_0x1a55f8['name']),_0xb7b6('0x58'),{'uri':_0x4bead2});})[_0xb7b6('0x36')](function(_0xc69ff9){logger['error'](_0xb7b6('0x5c'),JSON[_0xb7b6('0x24')](_0xc69ff9));});};exports['abandoned']=function(_0x250ba6,_0x39b7ee,_0x291a46,_0x299660,_0x1507ea,_0x1c085d){var _0x2259b0,_0x49bb2e,_0x5ab7ba,_0x558fb2;_0x1c085d[_0xb7b6('0x1f')]=intUtil['stripTrailingSlash'](_0x1c085d['remoteUri']);_0x1c085d['serverUrl']=intUtil[_0xb7b6('0x49')](_0x1c085d[_0xb7b6('0x4d')]);if(_0x1507ea&&_0x1507ea[_0xb7b6('0x4a')]){logger[_0xb7b6('0x18')]('[ABANDONED]',_0xb7b6('0x5d'));_0x39b7ee['recordingURL']=util[_0xb7b6('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1c085d[_0xb7b6('0x4d')],_0x39b7ee[_0xb7b6('0x4e')],md5(_0x39b7ee[_0xb7b6('0x4e')]));}else{_0x39b7ee['recordingURL']='';}return getConnection(_0x1c085d)['then'](function(_0x440b33){_0x558fb2=_0x440b33;return getUser(_0x1c085d,'',_0x558fb2);})[_0xb7b6('0x25')](function(_0x46e152){_0x2259b0=_0x46e152;logger[_0xb7b6('0x18')]('The\x20User\x20ID\x20is:',_0x2259b0['id']);return getEndUser(_0x1c085d,_0x39b7ee[_0xb7b6('0x50')],_0x39b7ee[_0xb7b6('0x51')],_0x558fb2);})['then'](function(_0x357082){_0x49bb2e=_0x357082;logger[_0xb7b6('0x18')](_0xb7b6('0x52'),_0x49bb2e['id']);return createTicket(_0x1c085d,_0x2259b0,_0x49bb2e,_0x291a46,_0x39b7ee,_0x291a46[_0xb7b6('0x53')],_0x558fb2);})[_0xb7b6('0x25')](function(_0x301403){_0x5ab7ba=_0x301403;logger[_0xb7b6('0x18')](_0xb7b6('0x54'));logger[_0xb7b6('0x18')](_0xb7b6('0x62'),_0x5ab7ba['id']);})['catch'](function(_0x174c08){logger[_0xb7b6('0x28')]('[ABANDONED]',JSON[_0xb7b6('0x24')](_0x174c08));});}; \ 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 711bbb1..7ee11fb 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 _0xf3dd=['trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','uniqueid','destcalleridname','destcalleridnum','[OUTBOUND]','newTab','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','abandoned','[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','POST','merge','Tags','name','getString','Descriptions','Fields','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','remoteUri','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','length','filter','end-user','first','Enduser\x20found!','Caller\x20-\x20%s','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','string','nameField','customField','type','custom_fields','idField','variable','variableName','push','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf3dd,0x7b));var _0xdf3d=function(_0x546f45,_0x3a0b48){_0x546f45=_0x546f45-0x0;var _0x3058cc=_0xf3dd[_0x546f45];return _0x3058cc;};'use strict';var _=require(_0xdf3d('0x0'));var rp=require('request-promise');var md5=require(_0xdf3d('0x1'));var util=require(_0xdf3d('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xdf3d('0x3'));var logger=require(_0xdf3d('0x4'))(_0xdf3d('0x5'));config[_0xdf3d('0x6')]=_[_0xdf3d('0x7')](config[_0xdf3d('0x6')],{'host':_0xdf3d('0x8'),'port':0x18eb});var io=require(_0xdf3d('0x9'))(new Redis(config[_0xdf3d('0x6')]));function emit(_0x39ddfa,_0x366dd7,_0x2144f8){io['to'](_0x39ddfa)[_0xdf3d('0xa')](_0x366dd7,_0x2144f8);}var headers={'Content-Type':_0xdf3d('0xb'),'Accept':'application/json'};function getTicket(_0x41c768,_0x1b6dfe,_0x4af844,_0x6b063f,_0x25de58){logger[_0xdf3d('0xc')](_0xdf3d('0xd'));return request({'uri':util[_0xdf3d('0xe')]('%s/tickets.json',_0x41c768['remoteUri']),'method':_0xdf3d('0xf'),'body':{'ticket':_[_0xdf3d('0x10')]({'requester_id':_0x4af844['id'],'submitter_id':_0x1b6dfe?_0x1b6dfe['id']:undefined,'assignee_id':_0x1b6dfe?_0x1b6dfe['id']:undefined,'tags':getTags(_0x6b063f[_0xdf3d('0x11')],_0xdf3d('0x12')),'subject':intUtil[_0xdf3d('0x13')](_0x6b063f['Subjects'],_0x25de58,'\x20'),'description':intUtil[_0xdf3d('0x13')](_0x6b063f[_0xdf3d('0x14')],_0x25de58,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x6b063f['Descriptions'],_0x25de58,'\x0a')}},getCustomFields(_0x6b063f[_0xdf3d('0x15')],_0x25de58))}})[_0xdf3d('0x16')](function(_0x4b7ad0){logger['info'](_0xdf3d('0x17'));return _0x4b7ad0['ticket'];});}function getUser(_0x480ceb,_0x430e22){if(intUtil[_0xdf3d('0x18')](_0x430e22)){logger[_0xdf3d('0xc')](_0xdf3d('0x19'),_0x430e22);return request({'uri':util[_0xdf3d('0xe')]('%s/search.json',_0x480ceb['remoteUri']),'qs':{'query':util[_0xdf3d('0xe')](_0xdf3d('0x1a'),_0x430e22)}})[_0xdf3d('0x16')](function(_0x153d06){if(_0x153d06[_0xdf3d('0x1b')]){logger[_0xdf3d('0xc')](_0xdf3d('0x1c'));return _[_0xdf3d('0x1d')](_0x153d06[_0xdf3d('0x1e')],{'email':_0x430e22,'role':_0xdf3d('0x1f')});}else{logger[_0xdf3d('0xc')](_0xdf3d('0x20'));return request({'uri':util[_0xdf3d('0xe')](_0xdf3d('0x21'),_0x480ceb[_0xdf3d('0x22')])})[_0xdf3d('0x16')](function(_0x262758){logger[_0xdf3d('0xc')](_0xdf3d('0x23'));return _0x262758['user'];});}});}else{logger[_0xdf3d('0xc')](_0xdf3d('0x20'));return request({'uri':util['format'](_0xdf3d('0x21'),_0x480ceb[_0xdf3d('0x22')])})[_0xdf3d('0x16')](function(_0x4287ef){logger[_0xdf3d('0xc')](_0xdf3d('0x23'));return _0x4287ef[_0xdf3d('0x24')];});}}function getEndUser(_0x8c780c,_0x436052,_0x2c0e73){logger[_0xdf3d('0xc')](_0xdf3d('0x25'),_0x2c0e73);return request({'uri':util[_0xdf3d('0xe')]('%s/search.json',_0x8c780c['remoteUri']),'qs':{'query':util[_0xdf3d('0xe')]('type:user\x20role:end-user\x20phone:%s',_0x2c0e73)}})[_0xdf3d('0x16')](function(_0x11931e){var _0x9ca15c;if(_0x11931e[_0xdf3d('0x1e')][_0xdf3d('0x26')]){_0x11931e[_0xdf3d('0x1e')]=_[_0xdf3d('0x27')](_0x11931e[_0xdf3d('0x1e')],{'suspended':![],'role':_0xdf3d('0x28')});if(_0x11931e[_0xdf3d('0x1e')][_0xdf3d('0x26')]){_0x9ca15c=_[_0xdf3d('0x29')](_0x11931e['results']);}}if(_0x9ca15c){logger[_0xdf3d('0xc')](_0xdf3d('0x2a'));return _0x9ca15c;}else{logger[_0xdf3d('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xdf3d('0xe')]('%s/users.json',_0x8c780c['remoteUri']),'method':'POST','body':{'user':{'role':'end-user','name':util[_0xdf3d('0xe')](_0xdf3d('0x2b'),_0x436052||_0x2c0e73),'phone':_0x2c0e73}}})[_0xdf3d('0x16')](function(_0x3f9760){logger[_0xdf3d('0xc')]('Enduser\x20created.');return _0x3f9760['user'];});}});}function getAuth(_0x27a3f8){var _0x1993d1;if(_0x27a3f8[_0xdf3d('0x2c')]===_0xdf3d('0x2d')){_0x1993d1=util[_0xdf3d('0xe')](_0xdf3d('0x2e'),_0x27a3f8[_0xdf3d('0x2f')],_0x27a3f8[_0xdf3d('0x2d')]);}else if(_0x27a3f8[_0xdf3d('0x2c')]===_0xdf3d('0x30')){_0x1993d1=util[_0xdf3d('0xe')](_0xdf3d('0x31'),_0x27a3f8[_0xdf3d('0x2f')],_0x27a3f8[_0xdf3d('0x30')]);}return util[_0xdf3d('0xe')](_0xdf3d('0x32'),new Buffer(_0x1993d1)[_0xdf3d('0x33')](_0xdf3d('0x34')));}function request(_0x5d9c09){logger[_0xdf3d('0x35')](_0xdf3d('0x36'),JSON[_0xdf3d('0x37')](_0x5d9c09));return rp(_[_0xdf3d('0x7')](_0x5d9c09,{'method':_0xdf3d('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x19c891,_0x2d3a9b){var _0x5e8b76=[];if(_0x19c891&&_0x19c891['length']>0x0){_0x5e8b76=_[_0xdf3d('0x39')](_0x19c891,_0x2d3a9b);}return _0x5e8b76;}function getCustomFields(_0x1f13b2,_0x3c24a5){var _0x44d0c1=[];var _0x20acd4={'custom_fields':[]};if(_0x1f13b2['length']>0x0){_[_0xdf3d('0x3a')](_0x1f13b2,function(_0x2392e2){if(_0x2392e2['type']===_0xdf3d('0x3b')&&_0x2392e2[_0xdf3d('0x3c')]&&!_0x2392e2[_0xdf3d('0x3d')]){_0x20acd4[_0x2392e2[_0xdf3d('0x3c')]['toLowerCase']()]=_0x2392e2['content'][_0xdf3d('0x33')]();}else if(_0x2392e2[_0xdf3d('0x3e')]==='string'&&_0x2392e2['idField']&&_0x2392e2['customField']){_0x20acd4[_0xdf3d('0x3f')]['push']({'id':_0x2392e2[_0xdf3d('0x40')],'value':_0x2392e2['content'][_0xdf3d('0x33')]()});}else if(_0x2392e2['type']===_0xdf3d('0x41')&&_0x2392e2[_0xdf3d('0x42')]&&_0x2392e2['idField']&&_0x2392e2[_0xdf3d('0x3d')]){_0x3c24a5[_0x2392e2[_0xdf3d('0x42')]]&&_0x20acd4[_0xdf3d('0x3f')][_0xdf3d('0x43')]({'id':_0x2392e2[_0xdf3d('0x40')],'value':_0x3c24a5[_0x2392e2[_0xdf3d('0x42')]]['toString']()});}else if(_0x2392e2[_0xdf3d('0x3e')]==='customVariable'&&_0x2392e2[_0xdf3d('0x44')]&&_0x2392e2[_0xdf3d('0x44')][_0xdf3d('0x12')]&&_0x2392e2['idField']&&_0x2392e2['customField']){_0x3c24a5[_0x2392e2[_0xdf3d('0x44')][_0xdf3d('0x12')][_0xdf3d('0x45')]()]&&_0x20acd4['custom_fields']['push']({'id':_0x2392e2[_0xdf3d('0x40')],'value':_0x3c24a5[_0x2392e2[_0xdf3d('0x44')]['name']['toLowerCase']()][_0xdf3d('0x33')]()});}});}return _0x20acd4;}exports[_0xdf3d('0x46')]=function(_0x4d1f27,_0x3cba62,_0x2d6a25,_0x1e7043,_0x51c18d,_0x1f3bbe){var _0x239f15,_0x4884ae;_0x1f3bbe[_0xdf3d('0x22')]=intUtil[_0xdf3d('0x47')](_0x1f3bbe[_0xdf3d('0x22')]);_0x1f3bbe[_0xdf3d('0x48')]=intUtil[_0xdf3d('0x47')](_0x1f3bbe[_0xdf3d('0x48')]);if(_0x51c18d&&_0x51c18d[_0xdf3d('0x49')]){logger[_0xdf3d('0xc')](_0xdf3d('0x4a'),_0xdf3d('0x4b'));_0x3cba62[_0xdf3d('0x4c')]=util['format'](_0xdf3d('0x4d'),_0x1f3bbe[_0xdf3d('0x48')],_0x3cba62['uniqueid'],md5(_0x3cba62['uniqueid']));}else{_0x3cba62['recordingURL']='';}headers[_0xdf3d('0x4e')]=getAuth(_0x1f3bbe);return getUser(_0x1f3bbe,_0x1e7043[_0xdf3d('0x4f')])[_0xdf3d('0x16')](function(_0x2052d7){_0x239f15=_0x2052d7;logger[_0xdf3d('0xc')](_0xdf3d('0x50'),_0x239f15['id']);return getEndUser(_0x1f3bbe,_0x3cba62[_0xdf3d('0x51')],_0x3cba62[_0xdf3d('0x52')]);})['then'](function(_0x4bf788){_0x4884ae=_0x4bf788;logger[_0xdf3d('0xc')](_0xdf3d('0x53'),_0x4884ae['id']);return getTicket(_0x1f3bbe,_0x239f15,_0x4884ae,_0x2d6a25,_0x3cba62);})[_0xdf3d('0x16')](function(_0x5592e2){if(_0x5592e2){logger[_0xdf3d('0xc')](_0xdf3d('0x54'),_0x5592e2['id']);switch(_0x1f3bbe[_0xdf3d('0x3e')]){case'integrationTab':logger[_0xdf3d('0xc')]('[QUEUE]',_0xdf3d('0x55'));return request({'uri':util[_0xdf3d('0xe')](_0xdf3d('0x56'),_0x1f3bbe[_0xdf3d('0x22')],_0x239f15['id'],_0x5592e2['id']),'method':_0xdf3d('0xf')});case'newTab':logger['info'](_0xdf3d('0x4a'),_0xdf3d('0x57'));emit(util[_0xdf3d('0xe')](_0xdf3d('0x58'),_0x1e7043[_0xdf3d('0x12')]),_0xdf3d('0x59'),{'uri':util[_0xdf3d('0xe')](_0xdf3d('0x5a'),_0x1f3bbe[_0xdf3d('0x22')],_0x5592e2['id'])});break;default:logger[_0xdf3d('0x5b')]('[QUEUE]',_0xdf3d('0x5c'));}}})[_0xdf3d('0x5d')](function(_0x1d6c55){logger['error'](_0xdf3d('0x5e'),util[_0xdf3d('0x5f')](_0x1d6c55,{'showHidden':!![],'depth':null}));});};exports[_0xdf3d('0x60')]=function(_0x46b223,_0x398064,_0x8b07f4,_0x59fc34,_0x27228c,_0x1d9ca8,_0x1f0f99){var _0xf8fd1,_0x18b7f6;_0x1d9ca8[_0xdf3d('0x22')]=intUtil[_0xdf3d('0x47')](_0x1d9ca8[_0xdf3d('0x22')]);_0x1d9ca8[_0xdf3d('0x48')]=intUtil[_0xdf3d('0x47')](_0x1d9ca8[_0xdf3d('0x48')]);if(_0x1f0f99&&_0x1f0f99[_0xdf3d('0x61')]&&_0x1f0f99[_0xdf3d('0x61')]!=='none'){logger[_0xdf3d('0xc')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x398064[_0xdf3d('0x4c')]=util[_0xdf3d('0xe')](_0xdf3d('0x4d'),_0x1d9ca8[_0xdf3d('0x48')],_0x398064[_0xdf3d('0x62')],md5(_0x398064[_0xdf3d('0x62')]));}headers[_0xdf3d('0x4e')]=getAuth(_0x1d9ca8);return getUser(_0x1d9ca8,_0x59fc34[_0xdf3d('0x4f')])[_0xdf3d('0x16')](function(_0x42bd9c){_0xf8fd1=_0x42bd9c;logger[_0xdf3d('0xc')](_0xdf3d('0x50'),_0xf8fd1['id']);return getEndUser(_0x1d9ca8,_0x398064[_0xdf3d('0x63')],_0x398064[_0xdf3d('0x64')]);})[_0xdf3d('0x16')](function(_0x3bb9c5){_0x18b7f6=_0x3bb9c5;logger[_0xdf3d('0xc')](_0xdf3d('0x53'),_0x18b7f6['id']);return getTicket(_0x1d9ca8,_0xf8fd1,_0x18b7f6,_0x8b07f4,_0x398064);})[_0xdf3d('0x16')](function(_0x4caa75){if(_0x4caa75){logger[_0xdf3d('0xc')](_0xdf3d('0x54'),_0x4caa75['id']);switch(_0x1d9ca8[_0xdf3d('0x3e')]){case'integrationTab':logger['info'](_0xdf3d('0x65'),_0xdf3d('0x55'));return request({'uri':util['format'](_0xdf3d('0x56'),_0x1d9ca8[_0xdf3d('0x22')],_0xf8fd1['id'],_0x4caa75['id']),'method':_0xdf3d('0xf')});case _0xdf3d('0x66'):logger[_0xdf3d('0xc')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xdf3d('0xe')](_0xdf3d('0x58'),_0x59fc34[_0xdf3d('0x12')]),_0xdf3d('0x59'),{'uri':util['format'](_0xdf3d('0x5a'),_0x1d9ca8[_0xdf3d('0x22')],_0x4caa75['id'])});break;default:logger[_0xdf3d('0x5b')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xdf3d('0x5d')](function(_0x32cb54){logger[_0xdf3d('0x5b')](_0xdf3d('0x67'),util[_0xdf3d('0x5f')](_0x32cb54,{'showHidden':!![],'depth':null}));});};exports[_0xdf3d('0x68')]=function(_0x3cbd83,_0x18ca12,_0x413586,_0x2952fd,_0xd1a6c4,_0x41e292){var _0xa99ead,_0x526ae2;_0x41e292[_0xdf3d('0x22')]=intUtil['stripTrailingSlash'](_0x41e292[_0xdf3d('0x22')]);_0x41e292[_0xdf3d('0x48')]=intUtil[_0xdf3d('0x47')](_0x41e292[_0xdf3d('0x48')]);if(_0xd1a6c4&&_0xd1a6c4[_0xdf3d('0x49')]){logger['info']('[ABANDONED]','Recording\x20is\x20enabled!');_0x18ca12['recordingURL']=util[_0xdf3d('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x41e292[_0xdf3d('0x48')],_0x18ca12[_0xdf3d('0x62')],md5(_0x18ca12[_0xdf3d('0x62')]));}else{_0x18ca12[_0xdf3d('0x4c')]='';}headers['Authorization']=getAuth(_0x41e292);return getUser(_0x41e292)[_0xdf3d('0x16')](function(_0x4cb278){_0xa99ead=_0x4cb278;logger[_0xdf3d('0xc')]('The\x20User\x20ID\x20is:',_0xa99ead['id']);return getEndUser(_0x41e292,_0x18ca12[_0xdf3d('0x51')],_0x18ca12[_0xdf3d('0x52')]);})[_0xdf3d('0x16')](function(_0x3e2897){_0x526ae2=_0x3e2897;logger[_0xdf3d('0xc')](_0xdf3d('0x53'),_0x526ae2['id']);return getTicket(_0x41e292,_0xa99ead,_0x526ae2,_0x413586,_0x18ca12);})['then'](function(_0x1c2fa9){if(_0x1c2fa9){logger['info'](_0xdf3d('0x54'),_0x1c2fa9['id']);}})[_0xdf3d('0x5d')](function(_0x93f089){logger['error'](_0xdf3d('0x69'),util[_0xdf3d('0x5f')](_0x93f089,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x51ae=['The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','trigger:browser:url','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','email','destcalleridnum','[OUTBOUND]','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','abandoned','[ABANDONED]','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','name','getString','Descriptions','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','authType','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','type','string','nameField','customField','toLowerCase','content','idField','variableName','custom_fields','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization'];(function(_0x248f7c,_0xb2dbe7){var _0x1a0e9e=function(_0x333c18){while(--_0x333c18){_0x248f7c['push'](_0x248f7c['shift']());}};_0x1a0e9e(++_0xb2dbe7);}(_0x51ae,0xed));var _0xe51a=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x51ae[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0xe51a('0x0'));var rp=require('request-promise');var md5=require(_0xe51a('0x1'));var util=require(_0xe51a('0x2'));var Redis=require(_0xe51a('0x3'));var intUtil=require(_0xe51a('0x4'));var config=require(_0xe51a('0x5'));var logger=require(_0xe51a('0x6'))(_0xe51a('0x7'));config[_0xe51a('0x8')]=_[_0xe51a('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xe51a('0xa'))(new Redis(config[_0xe51a('0x8')]));function emit(_0x5e5a09,_0x5cbbbf,_0x3baeb2){io['to'](_0x5e5a09)[_0xe51a('0xb')](_0x5cbbbf,_0x3baeb2);}var headers={'Content-Type':_0xe51a('0xc'),'Accept':'application/json'};function getTicket(_0x2b4486,_0x1590c1,_0x44636a,_0x21478d,_0x3f69a4){logger[_0xe51a('0xd')](_0xe51a('0xe'));return request({'uri':util[_0xe51a('0xf')](_0xe51a('0x10'),_0x2b4486[_0xe51a('0x11')]),'method':_0xe51a('0x12'),'body':{'ticket':_[_0xe51a('0x13')]({'requester_id':_0x44636a['id'],'submitter_id':_0x1590c1?_0x1590c1['id']:undefined,'assignee_id':_0x1590c1?_0x1590c1['id']:undefined,'tags':getTags(_0x21478d['Tags'],_0xe51a('0x14')),'subject':intUtil['getString'](_0x21478d['Subjects'],_0x3f69a4,'\x20'),'description':intUtil[_0xe51a('0x15')](_0x21478d[_0xe51a('0x16')],_0x3f69a4,'\x0a'),'comment':{'public':![],'body':intUtil[_0xe51a('0x15')](_0x21478d[_0xe51a('0x16')],_0x3f69a4,'\x0a')}},getCustomFields(_0x21478d['Fields'],_0x3f69a4))}})[_0xe51a('0x17')](function(_0x32d371){logger[_0xe51a('0xd')](_0xe51a('0x18'));return _0x32d371[_0xe51a('0x19')];});}function getUser(_0x4dfcc0,_0x224204){if(intUtil[_0xe51a('0x1a')](_0x224204)){logger[_0xe51a('0xd')]('Getting\x20agent\x20with\x20email',_0x224204);return request({'uri':util[_0xe51a('0xf')](_0xe51a('0x1b'),_0x4dfcc0[_0xe51a('0x11')]),'qs':{'query':util[_0xe51a('0xf')](_0xe51a('0x1c'),_0x224204)}})[_0xe51a('0x17')](function(_0x4e2b69){if(_0x4e2b69[_0xe51a('0x1d')]){logger[_0xe51a('0xd')](_0xe51a('0x1e'));return _[_0xe51a('0x1f')](_0x4e2b69[_0xe51a('0x20')],{'email':_0x224204,'role':_0xe51a('0x21')});}else{logger[_0xe51a('0xd')](_0xe51a('0x22'));return request({'uri':util[_0xe51a('0xf')](_0xe51a('0x23'),_0x4dfcc0['remoteUri'])})[_0xe51a('0x17')](function(_0x40ed83){logger[_0xe51a('0xd')]('Admin\x20account\x20selected.');return _0x40ed83[_0xe51a('0x24')];});}});}else{logger[_0xe51a('0xd')](_0xe51a('0x22'));return request({'uri':util[_0xe51a('0xf')](_0xe51a('0x23'),_0x4dfcc0[_0xe51a('0x11')])})[_0xe51a('0x17')](function(_0x265152){logger[_0xe51a('0xd')](_0xe51a('0x25'));return _0x265152[_0xe51a('0x24')];});}}function getEndUser(_0x1bfab7,_0x2efbd7,_0x23ea92){logger[_0xe51a('0xd')](_0xe51a('0x26'),_0x23ea92);return request({'uri':util[_0xe51a('0xf')](_0xe51a('0x1b'),_0x1bfab7['remoteUri']),'qs':{'query':util[_0xe51a('0xf')](_0xe51a('0x27'),_0x23ea92)}})[_0xe51a('0x17')](function(_0x16d563){var _0x5b2cfb;if(_0x16d563[_0xe51a('0x20')][_0xe51a('0x28')]){_0x16d563[_0xe51a('0x20')]=_[_0xe51a('0x29')](_0x16d563['results'],{'suspended':![],'role':_0xe51a('0x2a')});if(_0x16d563[_0xe51a('0x20')]['length']){_0x5b2cfb=_[_0xe51a('0x2b')](_0x16d563['results']);}}if(_0x5b2cfb){logger[_0xe51a('0xd')](_0xe51a('0x2c'));return _0x5b2cfb;}else{logger['info'](_0xe51a('0x2d'));return request({'uri':util[_0xe51a('0xf')]('%s/users.json',_0x1bfab7[_0xe51a('0x11')]),'method':_0xe51a('0x12'),'body':{'user':{'role':_0xe51a('0x2a'),'name':util['format']('Caller\x20-\x20%s',_0x2efbd7||_0x23ea92),'phone':_0x23ea92}}})['then'](function(_0x33af){logger[_0xe51a('0xd')](_0xe51a('0x2e'));return _0x33af[_0xe51a('0x24')];});}});}function getAuth(_0x6a8da0){var _0x3a0b52;if(_0x6a8da0[_0xe51a('0x2f')]==='password'){_0x3a0b52=util[_0xe51a('0xf')](_0xe51a('0x30'),_0x6a8da0[_0xe51a('0x31')],_0x6a8da0[_0xe51a('0x32')]);}else if(_0x6a8da0[_0xe51a('0x2f')]===_0xe51a('0x33')){_0x3a0b52=util[_0xe51a('0xf')](_0xe51a('0x34'),_0x6a8da0['username'],_0x6a8da0['token']);}return util['format'](_0xe51a('0x35'),new Buffer(_0x3a0b52)[_0xe51a('0x36')](_0xe51a('0x37')));}function request(_0x34535f){logger[_0xe51a('0x38')](_0xe51a('0x39'),JSON[_0xe51a('0x3a')](_0x34535f));return rp(_[_0xe51a('0x9')](_0x34535f,{'method':_0xe51a('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0x3eddbe,_0x42cb7b){var _0xc7e034=[];if(_0x3eddbe&&_0x3eddbe[_0xe51a('0x28')]>0x0){_0xc7e034=_['map'](_0x3eddbe,_0x42cb7b);}return _0xc7e034;}function getCustomFields(_0x100992,_0x277c08){var _0x5a2b51=[];var _0x3d6f37={'custom_fields':[]};if(_0x100992[_0xe51a('0x28')]>0x0){_['forEach'](_0x100992,function(_0x67824){if(_0x67824[_0xe51a('0x3c')]===_0xe51a('0x3d')&&_0x67824[_0xe51a('0x3e')]&&!_0x67824[_0xe51a('0x3f')]){_0x3d6f37[_0x67824[_0xe51a('0x3e')][_0xe51a('0x40')]()]=_0x67824[_0xe51a('0x41')][_0xe51a('0x36')]();}else if(_0x67824[_0xe51a('0x3c')]===_0xe51a('0x3d')&&_0x67824['idField']&&_0x67824[_0xe51a('0x3f')]){_0x3d6f37['custom_fields']['push']({'id':_0x67824[_0xe51a('0x42')],'value':_0x67824[_0xe51a('0x41')]['toString']()});}else if(_0x67824[_0xe51a('0x3c')]==='variable'&&_0x67824[_0xe51a('0x43')]&&_0x67824['idField']&&_0x67824[_0xe51a('0x3f')]){_0x277c08[_0x67824[_0xe51a('0x43')]]&&_0x3d6f37[_0xe51a('0x44')][_0xe51a('0x45')]({'id':_0x67824[_0xe51a('0x42')],'value':_0x277c08[_0x67824[_0xe51a('0x43')]][_0xe51a('0x36')]()});}else if(_0x67824[_0xe51a('0x3c')]===_0xe51a('0x46')&&_0x67824[_0xe51a('0x47')]&&_0x67824[_0xe51a('0x47')][_0xe51a('0x14')]&&_0x67824[_0xe51a('0x42')]&&_0x67824['customField']){_0x277c08[_0x67824[_0xe51a('0x47')][_0xe51a('0x14')]['toLowerCase']()]&&_0x3d6f37[_0xe51a('0x44')][_0xe51a('0x45')]({'id':_0x67824[_0xe51a('0x42')],'value':_0x277c08[_0x67824[_0xe51a('0x47')]['name'][_0xe51a('0x40')]()][_0xe51a('0x36')]()});}});}return _0x3d6f37;}exports[_0xe51a('0x48')]=function(_0x4c6633,_0x168e2e,_0x50fc74,_0x3848cc,_0x1a5e01,_0x31af48){var _0xc571e6,_0x36d94d;_0x31af48[_0xe51a('0x11')]=intUtil[_0xe51a('0x49')](_0x31af48[_0xe51a('0x11')]);_0x31af48[_0xe51a('0x4a')]=intUtil['stripTrailingSlash'](_0x31af48['serverUrl']);if(_0x1a5e01&&_0x1a5e01[_0xe51a('0x4b')]){logger[_0xe51a('0xd')]('[QUEUE]',_0xe51a('0x4c'));_0x168e2e[_0xe51a('0x4d')]=util[_0xe51a('0xf')](_0xe51a('0x4e'),_0x31af48['serverUrl'],_0x168e2e[_0xe51a('0x4f')],md5(_0x168e2e[_0xe51a('0x4f')]));}else{_0x168e2e['recordingURL']='';}headers[_0xe51a('0x50')]=getAuth(_0x31af48);return getUser(_0x31af48,_0x3848cc['email'])[_0xe51a('0x17')](function(_0x24311e){_0xc571e6=_0x24311e;logger['info'](_0xe51a('0x51'),_0xc571e6['id']);return getEndUser(_0x31af48,_0x168e2e['calleridname'],_0x168e2e[_0xe51a('0x52')]);})[_0xe51a('0x17')](function(_0x902712){_0x36d94d=_0x902712;logger[_0xe51a('0xd')](_0xe51a('0x53'),_0x36d94d['id']);return getTicket(_0x31af48,_0xc571e6,_0x36d94d,_0x50fc74,_0x168e2e);})['then'](function(_0x59f405){if(_0x59f405){logger[_0xe51a('0xd')](_0xe51a('0x54'),_0x59f405['id']);switch(_0x31af48[_0xe51a('0x3c')]){case _0xe51a('0x55'):logger[_0xe51a('0xd')](_0xe51a('0x56'),_0xe51a('0x57'));return request({'uri':util[_0xe51a('0xf')](_0xe51a('0x58'),_0x31af48['remoteUri'],_0xc571e6['id'],_0x59f405['id']),'method':_0xe51a('0x12')});case'newTab':logger[_0xe51a('0xd')](_0xe51a('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xe51a('0x59'),_0x3848cc[_0xe51a('0x14')]),_0xe51a('0x5a'),{'uri':util[_0xe51a('0xf')]('%s/agent/tickets/%s',_0x31af48[_0xe51a('0x11')],_0x59f405['id'])});break;default:logger[_0xe51a('0x5b')]('[QUEUE]',_0xe51a('0x5c'));}}})[_0xe51a('0x5d')](function(_0x2956f5){logger['error'](_0xe51a('0x5e'),util[_0xe51a('0x5f')](_0x2956f5,{'showHidden':!![],'depth':null}));});};exports[_0xe51a('0x60')]=function(_0x346c69,_0x4bb206,_0x1bceac,_0x40b62c,_0x12af49,_0x2d642f,_0xb4751a){var _0x23b3b8,_0x1bf1a9;_0x2d642f[_0xe51a('0x11')]=intUtil[_0xe51a('0x49')](_0x2d642f[_0xe51a('0x11')]);_0x2d642f['serverUrl']=intUtil[_0xe51a('0x49')](_0x2d642f[_0xe51a('0x4a')]);if(_0xb4751a&&_0xb4751a['recordingFormat']&&_0xb4751a[_0xe51a('0x61')]!=='none'){logger[_0xe51a('0xd')]('[OUTBOUND]',_0xe51a('0x4c'));_0x4bb206['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2d642f['serverUrl'],_0x4bb206['uniqueid'],md5(_0x4bb206[_0xe51a('0x4f')]));}headers[_0xe51a('0x50')]=getAuth(_0x2d642f);return getUser(_0x2d642f,_0x40b62c[_0xe51a('0x62')])[_0xe51a('0x17')](function(_0x79dd6d){_0x23b3b8=_0x79dd6d;logger[_0xe51a('0xd')](_0xe51a('0x51'),_0x23b3b8['id']);return getEndUser(_0x2d642f,_0x4bb206['destcalleridname'],_0x4bb206[_0xe51a('0x63')]);})[_0xe51a('0x17')](function(_0x5775bc){_0x1bf1a9=_0x5775bc;logger[_0xe51a('0xd')](_0xe51a('0x53'),_0x1bf1a9['id']);return getTicket(_0x2d642f,_0x23b3b8,_0x1bf1a9,_0x1bceac,_0x4bb206);})[_0xe51a('0x17')](function(_0x21e35a){if(_0x21e35a){logger['info']('The\x20Ticket\x20ID\x20is:',_0x21e35a['id']);switch(_0x2d642f[_0xe51a('0x3c')]){case _0xe51a('0x55'):logger[_0xe51a('0xd')](_0xe51a('0x64'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xe51a('0xf')](_0xe51a('0x58'),_0x2d642f[_0xe51a('0x11')],_0x23b3b8['id'],_0x21e35a['id']),'method':_0xe51a('0x12')});case _0xe51a('0x65'):logger[_0xe51a('0xd')](_0xe51a('0x64'),_0xe51a('0x66'));emit(util[_0xe51a('0xf')](_0xe51a('0x59'),_0x40b62c['name']),'trigger:browser:url',{'uri':util[_0xe51a('0xf')]('%s/agent/tickets/%s',_0x2d642f[_0xe51a('0x11')],_0x21e35a['id'])});break;default:logger['error']('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x811a65){logger[_0xe51a('0x5b')](_0xe51a('0x67'),util[_0xe51a('0x5f')](_0x811a65,{'showHidden':!![],'depth':null}));});};exports[_0xe51a('0x68')]=function(_0x13f177,_0x7a5e19,_0x4b0fbb,_0x372181,_0x86fe31,_0x2d21bc){var _0x50ffb7,_0x2a18c7;_0x2d21bc[_0xe51a('0x11')]=intUtil[_0xe51a('0x49')](_0x2d21bc[_0xe51a('0x11')]);_0x2d21bc[_0xe51a('0x4a')]=intUtil[_0xe51a('0x49')](_0x2d21bc[_0xe51a('0x4a')]);if(_0x86fe31&&_0x86fe31[_0xe51a('0x4b')]){logger['info'](_0xe51a('0x69'),_0xe51a('0x4c'));_0x7a5e19['recordingURL']=util[_0xe51a('0xf')](_0xe51a('0x4e'),_0x2d21bc[_0xe51a('0x4a')],_0x7a5e19[_0xe51a('0x4f')],md5(_0x7a5e19[_0xe51a('0x4f')]));}else{_0x7a5e19[_0xe51a('0x4d')]='';}headers[_0xe51a('0x50')]=getAuth(_0x2d21bc);return getUser(_0x2d21bc)[_0xe51a('0x17')](function(_0x4c67b8){_0x50ffb7=_0x4c67b8;logger['info'](_0xe51a('0x51'),_0x50ffb7['id']);return getEndUser(_0x2d21bc,_0x7a5e19['calleridname'],_0x7a5e19[_0xe51a('0x52')]);})['then'](function(_0x13ddf3){_0x2a18c7=_0x13ddf3;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2a18c7['id']);return getTicket(_0x2d21bc,_0x50ffb7,_0x2a18c7,_0x4b0fbb,_0x7a5e19);})[_0xe51a('0x17')](function(_0x46bbbf){if(_0x46bbbf){logger[_0xe51a('0xd')]('The\x20Ticket\x20ID\x20is:',_0x46bbbf['id']);}})[_0xe51a('0x5d')](function(_0xac8e70){logger[_0xe51a('0x5b')]('[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0xac8e70,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zoho.js b/server/services/ami/trigger/integration/zoho.js index 5daaecb..116c588 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 _0xe14d=['format','YYYY-MM-DD\x20HH:mm:ss','getString','Descriptions','Fields','called','Call\x20Result','Called','complete','connect','Answered','rejected','Rejected','Abandoned','talktime','Call\x20Duration','mm:ss','endtime','utc','diff','CONTACTID','SEMODULE','Leads','SEID','LEADID','','hasOwnProperty','%s','encodeXML','','POST','host','authToken','crmapi','toJson','response','result','recorddetail','Error\x20on\x20call\x20creation:\x20','GET','https://crm.%s/crm/private/json/Users/getUsers','AllUsers','then','users','user','find','Agent\x20found!','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','((Phone:%s))','Contacts','row','length','content','https://crm.%s/crm/private/json/Leads/searchRecords','Enduser\x20found\x20in\x20Leads!','val','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','https://crm.%s/crm/private/xml/Leads/insertRecords','%s%s%s','parse','Enduser\x20created.','Error\x20on\x20Lead\x20creation:\x20','Error\x20on\x20Lead\x20retrieve:\x20','[HTTP]','stringify','forEach','idField','type','variable','variableName','toString','Variable','name','toLowerCase','split','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.%s/crm/EntityInfo.do?module=Calls&id=%s','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','monitor_format','[ABANDONED]','lodash','request-promise','md5','util','xml2json','entities','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20call...','merge','inbound','outbound','starttime','agentcalledAt'];(function(_0x5b7d9c,_0x57ffab){var _0x13c160=function(_0xcaa1a){while(--_0xcaa1a){_0x5b7d9c['push'](_0x5b7d9c['shift']());}};_0x13c160(++_0x57ffab);}(_0xe14d,0x1ee));var _0xde14=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xe14d[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0xde14('0x0'));var rp=require(_0xde14('0x1'));var md5=require(_0xde14('0x2'));var util=require(_0xde14('0x3'));var intUtil=require('./util');var parser=require(_0xde14('0x4'));var entities=require(_0xde14('0x5'));var moment=require('moment');var Redis=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var logger=require(_0xde14('0x8'))(_0xde14('0x9'));config[_0xde14('0xa')]=_[_0xde14('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xde14('0xc'))(new Redis(config[_0xde14('0xa')]));function emit(_0x2b0e7c,_0x9f13dc,_0xb25b00){io['to'](_0x2b0e7c)[_0xde14('0xd')](_0x9f13dc,_0xb25b00);}var headers={'Content-Type':_0xde14('0xe'),'Accept':_0xde14('0xe')};function getCall(_0x4b2b15,_0x1a7167,_0xe785fb,_0x417269,_0x4357c7,_0x8e0e){logger[_0xde14('0xf')](_0xde14('0x10'));var _0x3d5a29=_[_0xde14('0x11')]({'SMOWNERID':_0x1a7167['id'],'Call Type':_0x8e0e||_0xde14('0x12'),'Call Start Time':(_0x8e0e===_0xde14('0x13')?_0x4357c7[_0xde14('0x14')]:_0x4357c7[_0xde14('0x15')])||moment()[_0xde14('0x16')](_0xde14('0x17')),'Subject':intUtil['getString'](_0x417269['Subjects'],_0x4357c7,'\x20'),'Description':intUtil[_0xde14('0x18')](_0x417269[_0xde14('0x19')],_0x4357c7,'\x0a')},getCustomFields(_0x417269[_0xde14('0x1a')],_0x4357c7));switch(_0x4357c7['lastevent']){case _0xde14('0x1b'):_0x3d5a29[_0xde14('0x1c')]=_0xde14('0x1d');break;case _0xde14('0x1e'):case _0xde14('0x1f'):_0x3d5a29[_0xde14('0x1c')]=_0xde14('0x20');break;case _0xde14('0x21'):_0x3d5a29[_0xde14('0x1c')]=_0xde14('0x22');break;case'abandoned':_0x3d5a29[_0xde14('0x1c')]=_0xde14('0x23');break;default:}if(_0x4357c7[_0xde14('0x24')]){_0x3d5a29[_0xde14('0x25')]=moment['utc'](parseInt(_0x4357c7[_0xde14('0x24')])*0x3e8)['format'](_0xde14('0x26'));}else if(_0x4357c7['answertime']&&_0x4357c7[_0xde14('0x27')]){_0x3d5a29[_0xde14('0x25')]=moment[_0xde14('0x28')](moment(_0x4357c7[_0xde14('0x27')],_0xde14('0x17'))[_0xde14('0x29')](moment(_0x4357c7[_0xde14('0x14')],_0xde14('0x17'))))[_0xde14('0x16')](_0xde14('0x26'));}if(_0xe785fb[_0xde14('0x2a')]){_0x3d5a29[_0xde14('0x2a')]=_0xe785fb[_0xde14('0x2a')];}else if(_0xe785fb['LEADID']){_0x3d5a29[_0xde14('0x2b')]=_0xde14('0x2c');_0x3d5a29[_0xde14('0x2d')]=_0xe785fb[_0xde14('0x2e')];}var _0x1bb7be=_0xde14('0x2f');for(var _0x310d75 in _0x3d5a29){if(_0x3d5a29[_0xde14('0x30')](_0x310d75)){_0x1bb7be+=util[_0xde14('0x16')](_0xde14('0x31'),entities['encodeXML'](_0x310d75),entities[_0xde14('0x32')](_0x3d5a29[_0x310d75]));}}_0x1bb7be+=_0xde14('0x33');return request({'method':_0xde14('0x34'),'uri':util[_0xde14('0x16')]('https://crm.%s/crm/private/xml/Calls/insertRecords',_0x4b2b15[_0xde14('0x35')]),'qs':{'authtoken':_0x4b2b15[_0xde14('0x36')],'scope':_0xde14('0x37'),'xmlData':_0x1bb7be},'json':!![]})['then'](function(_0x4655fb){_0x4655fb=JSON['parse'](parser[_0xde14('0x38')](_0x4655fb));if(_0x4655fb[_0xde14('0x39')]){if(_0x4655fb[_0xde14('0x39')][_0xde14('0x3a')]&&_0x4655fb[_0xde14('0x39')][_0xde14('0x3a')][_0xde14('0x3b')]){logger[_0xde14('0xf')]('Call\x20created!');return{'id':_0x4655fb[_0xde14('0x39')][_0xde14('0x3a')]['recorddetail']['FL'][0x0]['$t']};}}throw new Error(_0xde14('0x3c')+JSON['stringify'](_0x4655fb));});}function getUser(_0x2e40ad,_0x44e88a){return request({'method':_0xde14('0x3d'),'uri':util[_0xde14('0x16')](_0xde14('0x3e'),_0x2e40ad['host']),'qs':{'type':_0xde14('0x3f'),'authtoken':_0x2e40ad[_0xde14('0x36')],'scope':'crmapi'},'json':!![]})[_0xde14('0x40')](function(_0x3c943b){if(_0x3c943b[_0xde14('0x41')]&&_0x3c943b[_0xde14('0x41')][_0xde14('0x42')]){var _0xa41c1e;if(_0x44e88a){_0xa41c1e=_[_0xde14('0x43')](_0x3c943b[_0xde14('0x41')][_0xde14('0x42')],{'email':_0x44e88a,'profile':'Standard'});}if(_0xa41c1e){logger['info'](_0xde14('0x44'));}else{logger[_0xde14('0xf')](_0xde14('0x45'));_0xa41c1e=_[_0xde14('0x43')](_0x3c943b[_0xde14('0x41')][_0xde14('0x42')],{'profile':_0xde14('0x46')});}return _0xa41c1e;}else{logger[_0xde14('0x47')](_0xde14('0x48'),JSON['stringify'](_0x3c943b));throw new Error(_0xde14('0x49')+JSON['stringify'](_0x3c943b));}});}function getEndUser(_0x4a363c,_0x4c1e37,_0xb0eba6){logger[_0xde14('0xf')](_0xde14('0x4a'),_0xb0eba6);return request({'method':_0xde14('0x3d'),'uri':util[_0xde14('0x16')](_0xde14('0x4b'),_0x4a363c[_0xde14('0x35')]),'qs':{'authtoken':_0x4a363c[_0xde14('0x36')],'scope':'crmapi','criteria':util[_0xde14('0x16')](_0xde14('0x4c'),_0xb0eba6)},'json':!![]})[_0xde14('0x40')](function(_0x2b3004){if(_0x2b3004[_0xde14('0x39')]&&_0x2b3004[_0xde14('0x39')][_0xde14('0x3a')]){logger[_0xde14('0xf')]('Enduser\x20found\x20in\x20Contacts!');var _0x225164={};var _0xb6b2ee=_0x2b3004[_0xde14('0x39')][_0xde14('0x3a')]['Contacts']['row']['no']?_0x2b3004[_0xde14('0x39')][_0xde14('0x3a')][_0xde14('0x4d')][_0xde14('0x4e')]['FL']:_0x2b3004[_0xde14('0x39')]['result'][_0xde14('0x4d')][_0xde14('0x4e')][0x0]['FL'];for(var _0x1d3cc1=0x0,_0x595fd5=_0xb6b2ee[_0xde14('0x4f')];_0x1d3cc1<_0x595fd5;_0x1d3cc1++){_0x225164[_0xb6b2ee[_0x1d3cc1]['val']]=_0xb6b2ee[_0x1d3cc1][_0xde14('0x50')];}return _0x225164;}else{return request({'method':'GET','uri':util[_0xde14('0x16')](_0xde14('0x51'),_0x4a363c[_0xde14('0x35')]),'qs':{'authtoken':_0x4a363c[_0xde14('0x36')],'scope':_0xde14('0x37'),'criteria':util[_0xde14('0x16')](_0xde14('0x4c'),_0xb0eba6)},'json':!![]})[_0xde14('0x40')](function(_0x5b18b0){if(_0x5b18b0[_0xde14('0x39')]&&_0x5b18b0['response'][_0xde14('0x3a')]){logger['info'](_0xde14('0x52'));var _0x3997e9={};var _0x437466=_0x5b18b0[_0xde14('0x39')][_0xde14('0x3a')][_0xde14('0x2c')][_0xde14('0x4e')]['no']?_0x5b18b0[_0xde14('0x39')]['result'][_0xde14('0x2c')][_0xde14('0x4e')]['FL']:_0x5b18b0[_0xde14('0x39')][_0xde14('0x3a')]['Leads'][_0xde14('0x4e')][0x0]['FL'];for(var _0x111d27=0x0,_0x1229f0=_0x437466[_0xde14('0x4f')];_0x111d27<_0x1229f0;_0x111d27++){_0x3997e9[_0x437466[_0x111d27][_0xde14('0x53')]]=_0x437466[_0x111d27][_0xde14('0x50')];}return _0x3997e9;}else{logger['info'](_0xde14('0x54'));_0x4c1e37=getName(_0x4c1e37);return request({'method':'POST','uri':util[_0xde14('0x16')](_0xde14('0x55'),_0x4a363c['host']),'qs':{'authtoken':_0x4a363c[_0xde14('0x36')],'scope':_0xde14('0x37'),'xmlData':util[_0xde14('0x16')](_0xde14('0x56'),entities[_0xde14('0x32')](_0x4c1e37[0x0]),entities[_0xde14('0x32')](_0x4c1e37[0x1]),_0xb0eba6)},'json':!![]})[_0xde14('0x40')](function(_0x51f35f){_0x51f35f=JSON[_0xde14('0x57')](parser['toJson'](_0x51f35f));if(_0x51f35f[_0xde14('0x39')]){if(_0x51f35f[_0xde14('0x39')][_0xde14('0x3a')]&&_0x51f35f[_0xde14('0x39')][_0xde14('0x3a')][_0xde14('0x3b')]){logger[_0xde14('0xf')](_0xde14('0x58'));return request({'method':_0xde14('0x3d'),'uri':util[_0xde14('0x16')]('https://crm.%s/crm/private/json/Leads/getRecordById',_0x4a363c[_0xde14('0x35')]),'qs':{'authtoken':_0x4a363c[_0xde14('0x36')],'scope':_0xde14('0x37'),'id':_0x51f35f[_0xde14('0x39')][_0xde14('0x3a')]['recorddetail']['FL'][0x0]['$t']},'json':!![]});}}throw new Error(_0xde14('0x59')+JSON['stringify'](_0x51f35f));})[_0xde14('0x40')](function(_0x31e7a6){if(_0x31e7a6[_0xde14('0x39')]){if(_0x31e7a6[_0xde14('0x39')][_0xde14('0x3a')]){var _0x53a1c8={};for(var _0x5356fe=0x0,_0x435964=_0x31e7a6['response'][_0xde14('0x3a')][_0xde14('0x2c')][_0xde14('0x4e')]['FL'][_0xde14('0x4f')];_0x5356fe<_0x435964;_0x5356fe++){_0x53a1c8[_0x31e7a6[_0xde14('0x39')][_0xde14('0x3a')][_0xde14('0x2c')][_0xde14('0x4e')]['FL'][_0x5356fe][_0xde14('0x53')]]=_0x31e7a6['response'][_0xde14('0x3a')][_0xde14('0x2c')][_0xde14('0x4e')]['FL'][_0x5356fe][_0xde14('0x50')];}return _0x53a1c8;}}throw new Error(_0xde14('0x5a')+JSON['stringify'](_0x31e7a6));});}});}});}function request(_0xb2d69c){logger['debug'](_0xde14('0x5b'),JSON[_0xde14('0x5c')](_0xb2d69c));return rp(_0xb2d69c);}function getCustomFields(_0x2526ca,_0x4dbeaf){var _0x32d48f={};if(_0x2526ca[_0xde14('0x4f')]>0x0){_[_0xde14('0x5d')](_0x2526ca,function(_0x409a59){if(_0x409a59['type']==='string'&&_0x409a59['idField']){_0x32d48f[_0x409a59[_0xde14('0x5e')]]=_0x409a59['content']['toString']();}else if(_0x409a59[_0xde14('0x5f')]===_0xde14('0x60')&&_0x409a59[_0xde14('0x61')]&&_0x409a59[_0xde14('0x5e')]&&_0x4dbeaf[_0x409a59[_0xde14('0x61')]]){_0x32d48f[_0x409a59[_0xde14('0x5e')]]=_0x4dbeaf[_0x409a59[_0xde14('0x61')]][_0xde14('0x62')]();}else if(_0x409a59[_0xde14('0x5f')]==='customVariable'&&_0x409a59[_0xde14('0x63')]&&_0x409a59[_0xde14('0x63')][_0xde14('0x64')]&&_0x409a59['idField']&&_0x4dbeaf[_0x409a59[_0xde14('0x63')]['name'][_0xde14('0x65')]()]){_0x32d48f[_0x409a59[_0xde14('0x5e')]]=_0x4dbeaf[_0x409a59[_0xde14('0x63')][_0xde14('0x64')][_0xde14('0x65')]()][_0xde14('0x62')]();}});}return _0x32d48f;}function getName(_0x1a88b3){if(_0x1a88b3['indexOf']('\x20')>0x0){var _0x3a357a=_0x1a88b3[_0xde14('0x66')](/ (.+)/);if(_0x3a357a[0x1]){return _0x3a357a;}}return[_0x1a88b3,_0x1a88b3];}exports[_0xde14('0x67')]=function(_0x40fcda,_0x28f399,_0x70a2e1,_0x439118,_0x4cdf99,_0x4a9e85){var _0x4563ba,_0x19a162;_0x4a9e85[_0xde14('0x35')]=intUtil['stripTrailingSlash'](_0x4a9e85[_0xde14('0x35')]);_0x4a9e85[_0xde14('0x68')]=intUtil[_0xde14('0x69')](_0x4a9e85[_0xde14('0x68')]);if(_0x4cdf99&&_0x4cdf99['monitor_format']){logger['info'](_0xde14('0x6a'),_0xde14('0x6b'));_0x28f399[_0xde14('0x6c')]=util[_0xde14('0x16')](_0xde14('0x6d'),_0x4a9e85[_0xde14('0x68')],_0x28f399[_0xde14('0x6e')],md5(_0x28f399[_0xde14('0x6e')]));}else{_0x28f399[_0xde14('0x6c')]='';}return getUser(_0x4a9e85,_0x439118[_0xde14('0x6f')])[_0xde14('0x40')](function(_0x299b69){_0x4563ba=_0x299b69;logger[_0xde14('0xf')](_0xde14('0x70'),_0x4563ba['id']);return getEndUser(_0x4a9e85,_0x28f399[_0xde14('0x71')],_0x28f399[_0xde14('0x72')]);})[_0xde14('0x40')](function(_0x31ebbd){_0x19a162=_0x31ebbd;logger[_0xde14('0xf')](_0xde14('0x73'),_0x19a162[_0xde14('0x2a')]||_0x19a162[_0xde14('0x2e')]);return getCall(_0x4a9e85,_0x4563ba,_0x19a162,_0x70a2e1,_0x28f399,_0xde14('0x74'));})['then'](function(_0x1084fb){if(_0x1084fb){logger['info'](_0xde14('0x75'),_0x1084fb['id']);logger['info'](_0xde14('0x6a'),_0xde14('0x76'));emit(util[_0xde14('0x16')]('user:%s',_0x439118['name']),_0xde14('0x77'),{'uri':util[_0xde14('0x16')](_0xde14('0x78'),_0x4a9e85[_0xde14('0x35')],_0x1084fb['id'])});}})['catch'](function(_0x162f3b){logger[_0xde14('0x47')](_0xde14('0x6a'),JSON['stringify'](_0x162f3b));});};exports['outbound']=function(_0x49dc83,_0x58ccb4,_0x24b354,_0x30f0f0,_0x20cee9,_0x5b1a32,_0x32e579){var _0x37f7c3,_0x371c1b;_0x5b1a32[_0xde14('0x35')]=intUtil[_0xde14('0x69')](_0x5b1a32[_0xde14('0x35')]);_0x5b1a32['serverUrl']=intUtil['stripTrailingSlash'](_0x5b1a32[_0xde14('0x68')]);if(_0x32e579&&_0x32e579[_0xde14('0x79')]&&_0x32e579['recordingFormat']!==_0xde14('0x7a')){logger[_0xde14('0xf')](_0xde14('0x7b'),_0xde14('0x6b'));_0x58ccb4[_0xde14('0x6c')]=util[_0xde14('0x16')](_0xde14('0x6d'),_0x5b1a32['serverUrl'],_0x58ccb4['uniqueid'],md5(_0x58ccb4['uniqueid']));}return getUser(_0x5b1a32,_0x30f0f0['email'])[_0xde14('0x40')](function(_0x271d90){_0x37f7c3=_0x271d90;logger['info']('The\x20User\x20ID\x20is:',_0x37f7c3['id']);return getEndUser(_0x5b1a32,_0x58ccb4[_0xde14('0x7c')],_0x58ccb4[_0xde14('0x7d')]);})[_0xde14('0x40')](function(_0x5805ec){_0x371c1b=_0x5805ec;logger[_0xde14('0xf')](_0xde14('0x73'),_0x371c1b['CONTACTID']||_0x371c1b[_0xde14('0x2e')]);return getCall(_0x5b1a32,_0x37f7c3,_0x371c1b,_0x24b354,_0x58ccb4,_0xde14('0x7e'));})[_0xde14('0x40')](function(_0x301928){if(_0x301928){logger['info'](_0xde14('0x75'),_0x301928['id']);logger['info'](_0xde14('0x7b'),_0xde14('0x76'));emit(util[_0xde14('0x16')]('user:%s',_0x30f0f0[_0xde14('0x64')]),_0xde14('0x77'),{'uri':util[_0xde14('0x16')](_0xde14('0x78'),_0x5b1a32[_0xde14('0x35')],_0x301928['id'])});}})['catch'](function(_0x53433d){logger[_0xde14('0x47')](_0xde14('0x7b'),JSON[_0xde14('0x5c')](_0x53433d));});};exports['abandoned']=function(_0x246ddf,_0x1a12b5,_0x43cc47,_0x85f5d5,_0x27f2ba,_0x2cc5b7){var _0x38ac02,_0x4a5963;_0x2cc5b7[_0xde14('0x35')]=intUtil[_0xde14('0x69')](_0x2cc5b7[_0xde14('0x35')]);_0x2cc5b7[_0xde14('0x68')]=intUtil[_0xde14('0x69')](_0x2cc5b7[_0xde14('0x68')]);if(_0x27f2ba&&_0x27f2ba[_0xde14('0x7f')]){logger['info'](_0xde14('0x80'),_0xde14('0x6b'));_0x1a12b5['recordingURL']=util[_0xde14('0x16')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2cc5b7[_0xde14('0x68')],_0x1a12b5['uniqueid'],md5(_0x1a12b5[_0xde14('0x6e')]));}else{_0x1a12b5[_0xde14('0x6c')]='';}return getUser(_0x2cc5b7)[_0xde14('0x40')](function(_0x33cfe0){_0x38ac02=_0x33cfe0;logger[_0xde14('0xf')](_0xde14('0x70'),_0x38ac02['id']);return getEndUser(_0x2cc5b7,_0x1a12b5['calleridname'],_0x1a12b5[_0xde14('0x72')]);})[_0xde14('0x40')](function(_0x1db63e){_0x4a5963=_0x1db63e;logger['info'](_0xde14('0x73'),_0x4a5963[_0xde14('0x2a')]||_0x4a5963[_0xde14('0x2e')]);return getCall(_0x2cc5b7,_0x38ac02,_0x4a5963,_0x43cc47,_0x1a12b5,'Inbound');})[_0xde14('0x40')](function(_0x2419ef){if(_0x2419ef){logger[_0xde14('0xf')]('The\x20Call\x20ID\x20is:',_0x2419ef['id']);}})['catch'](function(_0x495741){logger['error'](_0xde14('0x80'),JSON[_0xde14('0x5c')](_0x495741));});}; \ No newline at end of file +var _0x5178=['redis','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20call...','inbound','outbound','starttime','agentcalledAt','format','getString','Subjects','Descriptions','Fields','lastevent','called','Call\x20Result','Called','complete','connect','rejected','Rejected','abandoned','Abandoned','talktime','utc','mm:ss','answertime','endtime','Call\x20Duration','YYYY-MM-DD\x20HH:mm:ss','CONTACTID','LEADID','SEMODULE','SEID','%s','encodeXML','','POST','https://crm.%s/crm/private/xml/Calls/insertRecords','authToken','crmapi','then','parse','toJson','response','result','recorddetail','Call\x20created!','Error\x20on\x20call\x20creation:\x20','GET','AllUsers','users','user','find','Agent\x20found!','Administrator','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','Searching\x20enduser\x20with\x20phone','https://crm.%s/crm/private/json/Contacts/searchRecords','((Phone:%s))','Enduser\x20found\x20in\x20Contacts!','Contacts','row','length','content','https://crm.%s/crm/private/json/Leads/searchRecords','host','Enduser\x20found\x20in\x20Leads!','Leads','val','%s%s%s','Enduser\x20created.','Error\x20on\x20Lead\x20creation:\x20','Error\x20on\x20Lead\x20retrieve:\x20','forEach','type','string','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','queue','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','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','error','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','[ABANDONED]','request-promise','md5','util','./util','xml2json','ioredis','../../../../config/environment','zoho','defaults'];(function(_0x516b4d,_0x39fe59){var _0x5271a4=function(_0x22999e){while(--_0x22999e){_0x516b4d['push'](_0x516b4d['shift']());}};_0x5271a4(++_0x39fe59);}(_0x5178,0x171));var _0x8517=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5178[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var rp=require(_0x8517('0x0'));var md5=require(_0x8517('0x1'));var util=require(_0x8517('0x2'));var intUtil=require(_0x8517('0x3'));var parser=require(_0x8517('0x4'));var entities=require('entities');var moment=require('moment');var Redis=require(_0x8517('0x5'));var config=require(_0x8517('0x6'));var logger=require('../../../../config/logger')(_0x8517('0x7'));config['redis']=_[_0x8517('0x8')](config[_0x8517('0x9')],{'host':_0x8517('0xa'),'port':0x18eb});var io=require(_0x8517('0xb'))(new Redis(config[_0x8517('0x9')]));function emit(_0x49739b,_0x46f6aa,_0x526e51){io['to'](_0x49739b)['emit'](_0x46f6aa,_0x526e51);}var headers={'Content-Type':_0x8517('0xc'),'Accept':_0x8517('0xc')};function getCall(_0x4dac4d,_0xdd6cfb,_0x24172f,_0x203154,_0x3be6b0,_0x1b4fc2){logger[_0x8517('0xd')](_0x8517('0xe'));var _0x12388f=_['merge']({'SMOWNERID':_0xdd6cfb['id'],'Call Type':_0x1b4fc2||_0x8517('0xf'),'Call Start Time':(_0x1b4fc2===_0x8517('0x10')?_0x3be6b0[_0x8517('0x11')]:_0x3be6b0[_0x8517('0x12')])||moment()[_0x8517('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'Subject':intUtil[_0x8517('0x14')](_0x203154[_0x8517('0x15')],_0x3be6b0,'\x20'),'Description':intUtil[_0x8517('0x14')](_0x203154[_0x8517('0x16')],_0x3be6b0,'\x0a')},getCustomFields(_0x203154[_0x8517('0x17')],_0x3be6b0));switch(_0x3be6b0[_0x8517('0x18')]){case _0x8517('0x19'):_0x12388f[_0x8517('0x1a')]=_0x8517('0x1b');break;case _0x8517('0x1c'):case _0x8517('0x1d'):_0x12388f[_0x8517('0x1a')]='Answered';break;case _0x8517('0x1e'):_0x12388f[_0x8517('0x1a')]=_0x8517('0x1f');break;case _0x8517('0x20'):_0x12388f[_0x8517('0x1a')]=_0x8517('0x21');break;default:}if(_0x3be6b0[_0x8517('0x22')]){_0x12388f['Call\x20Duration']=moment[_0x8517('0x23')](parseInt(_0x3be6b0['talktime'])*0x3e8)['format'](_0x8517('0x24'));}else if(_0x3be6b0[_0x8517('0x25')]&&_0x3be6b0[_0x8517('0x26')]){_0x12388f[_0x8517('0x27')]=moment[_0x8517('0x23')](moment(_0x3be6b0[_0x8517('0x26')],'YYYY-MM-DD\x20HH:mm:ss')['diff'](moment(_0x3be6b0[_0x8517('0x11')],_0x8517('0x28'))))[_0x8517('0x13')](_0x8517('0x24'));}if(_0x24172f[_0x8517('0x29')]){_0x12388f[_0x8517('0x29')]=_0x24172f['CONTACTID'];}else if(_0x24172f[_0x8517('0x2a')]){_0x12388f[_0x8517('0x2b')]='Leads';_0x12388f[_0x8517('0x2c')]=_0x24172f[_0x8517('0x2a')];}var _0x42c779='';for(var _0x634092 in _0x12388f){if(_0x12388f['hasOwnProperty'](_0x634092)){_0x42c779+=util[_0x8517('0x13')](_0x8517('0x2d'),entities[_0x8517('0x2e')](_0x634092),entities[_0x8517('0x2e')](_0x12388f[_0x634092]));}}_0x42c779+=_0x8517('0x2f');return request({'method':_0x8517('0x30'),'uri':util['format'](_0x8517('0x31'),_0x4dac4d['host']),'qs':{'authtoken':_0x4dac4d[_0x8517('0x32')],'scope':_0x8517('0x33'),'xmlData':_0x42c779},'json':!![]})[_0x8517('0x34')](function(_0x355aa6){_0x355aa6=JSON[_0x8517('0x35')](parser[_0x8517('0x36')](_0x355aa6));if(_0x355aa6['response']){if(_0x355aa6[_0x8517('0x37')]['result']&&_0x355aa6[_0x8517('0x37')][_0x8517('0x38')][_0x8517('0x39')]){logger[_0x8517('0xd')](_0x8517('0x3a'));return{'id':_0x355aa6[_0x8517('0x37')][_0x8517('0x38')][_0x8517('0x39')]['FL'][0x0]['$t']};}}throw new Error(_0x8517('0x3b')+JSON['stringify'](_0x355aa6));});}function getUser(_0x3e8f81,_0x1031b3){return request({'method':_0x8517('0x3c'),'uri':util['format']('https://crm.%s/crm/private/json/Users/getUsers',_0x3e8f81['host']),'qs':{'type':_0x8517('0x3d'),'authtoken':_0x3e8f81[_0x8517('0x32')],'scope':_0x8517('0x33')},'json':!![]})[_0x8517('0x34')](function(_0x5ed2a9){if(_0x5ed2a9[_0x8517('0x3e')]&&_0x5ed2a9['users'][_0x8517('0x3f')]){var _0x234da4;if(_0x1031b3){_0x234da4=_[_0x8517('0x40')](_0x5ed2a9['users'][_0x8517('0x3f')],{'email':_0x1031b3,'profile':'Standard'});}if(_0x234da4){logger[_0x8517('0xd')](_0x8517('0x41'));}else{logger['info']('Using\x20the\x20admin\x20account!');_0x234da4=_[_0x8517('0x40')](_0x5ed2a9[_0x8517('0x3e')][_0x8517('0x3f')],{'profile':_0x8517('0x42')});}return _0x234da4;}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0x8517('0x43')](_0x5ed2a9));throw new Error(_0x8517('0x44')+JSON[_0x8517('0x43')](_0x5ed2a9));}});}function getEndUser(_0x516fb1,_0x2f975c,_0x10f4c1){logger['info'](_0x8517('0x45'),_0x10f4c1);return request({'method':_0x8517('0x3c'),'uri':util[_0x8517('0x13')](_0x8517('0x46'),_0x516fb1['host']),'qs':{'authtoken':_0x516fb1[_0x8517('0x32')],'scope':_0x8517('0x33'),'criteria':util[_0x8517('0x13')](_0x8517('0x47'),_0x10f4c1)},'json':!![]})[_0x8517('0x34')](function(_0x22592a){if(_0x22592a[_0x8517('0x37')]&&_0x22592a[_0x8517('0x37')][_0x8517('0x38')]){logger[_0x8517('0xd')](_0x8517('0x48'));var _0x42e62f={};var _0x232e49=_0x22592a['response']['result'][_0x8517('0x49')][_0x8517('0x4a')]['no']?_0x22592a[_0x8517('0x37')][_0x8517('0x38')][_0x8517('0x49')]['row']['FL']:_0x22592a[_0x8517('0x37')][_0x8517('0x38')]['Contacts'][_0x8517('0x4a')][0x0]['FL'];for(var _0x34fd09=0x0,_0x32fba6=_0x232e49[_0x8517('0x4b')];_0x34fd09<_0x32fba6;_0x34fd09++){_0x42e62f[_0x232e49[_0x34fd09]['val']]=_0x232e49[_0x34fd09][_0x8517('0x4c')];}return _0x42e62f;}else{return request({'method':_0x8517('0x3c'),'uri':util['format'](_0x8517('0x4d'),_0x516fb1[_0x8517('0x4e')]),'qs':{'authtoken':_0x516fb1[_0x8517('0x32')],'scope':'crmapi','criteria':util[_0x8517('0x13')](_0x8517('0x47'),_0x10f4c1)},'json':!![]})[_0x8517('0x34')](function(_0x404a40){if(_0x404a40[_0x8517('0x37')]&&_0x404a40[_0x8517('0x37')][_0x8517('0x38')]){logger['info'](_0x8517('0x4f'));var _0x1ea1fb={};var _0x5382b2=_0x404a40[_0x8517('0x37')][_0x8517('0x38')][_0x8517('0x50')][_0x8517('0x4a')]['no']?_0x404a40[_0x8517('0x37')][_0x8517('0x38')]['Leads'][_0x8517('0x4a')]['FL']:_0x404a40[_0x8517('0x37')][_0x8517('0x38')]['Leads'][_0x8517('0x4a')][0x0]['FL'];for(var _0x197480=0x0,_0x56d08b=_0x5382b2[_0x8517('0x4b')];_0x197480<_0x56d08b;_0x197480++){_0x1ea1fb[_0x5382b2[_0x197480][_0x8517('0x51')]]=_0x5382b2[_0x197480]['content'];}return _0x1ea1fb;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');_0x2f975c=getName(_0x2f975c);return request({'method':_0x8517('0x30'),'uri':util[_0x8517('0x13')]('https://crm.%s/crm/private/xml/Leads/insertRecords',_0x516fb1[_0x8517('0x4e')]),'qs':{'authtoken':_0x516fb1['authToken'],'scope':'crmapi','xmlData':util[_0x8517('0x13')](_0x8517('0x52'),entities[_0x8517('0x2e')](_0x2f975c[0x0]),entities[_0x8517('0x2e')](_0x2f975c[0x1]),_0x10f4c1)},'json':!![]})['then'](function(_0x282601){_0x282601=JSON[_0x8517('0x35')](parser[_0x8517('0x36')](_0x282601));if(_0x282601['response']){if(_0x282601[_0x8517('0x37')][_0x8517('0x38')]&&_0x282601[_0x8517('0x37')][_0x8517('0x38')][_0x8517('0x39')]){logger[_0x8517('0xd')](_0x8517('0x53'));return request({'method':'GET','uri':util[_0x8517('0x13')]('https://crm.%s/crm/private/json/Leads/getRecordById',_0x516fb1['host']),'qs':{'authtoken':_0x516fb1[_0x8517('0x32')],'scope':_0x8517('0x33'),'id':_0x282601[_0x8517('0x37')][_0x8517('0x38')]['recorddetail']['FL'][0x0]['$t']},'json':!![]});}}throw new Error(_0x8517('0x54')+JSON[_0x8517('0x43')](_0x282601));})['then'](function(_0x50880b){if(_0x50880b[_0x8517('0x37')]){if(_0x50880b[_0x8517('0x37')][_0x8517('0x38')]){var _0x53b617={};for(var _0x26444e=0x0,_0x5c7e2f=_0x50880b[_0x8517('0x37')][_0x8517('0x38')][_0x8517('0x50')][_0x8517('0x4a')]['FL'][_0x8517('0x4b')];_0x26444e<_0x5c7e2f;_0x26444e++){_0x53b617[_0x50880b[_0x8517('0x37')][_0x8517('0x38')][_0x8517('0x50')][_0x8517('0x4a')]['FL'][_0x26444e]['val']]=_0x50880b['response'][_0x8517('0x38')][_0x8517('0x50')][_0x8517('0x4a')]['FL'][_0x26444e]['content'];}return _0x53b617;}}throw new Error(_0x8517('0x55')+JSON[_0x8517('0x43')](_0x50880b));});}});}});}function request(_0x445f9b){logger['debug']('[HTTP]',JSON[_0x8517('0x43')](_0x445f9b));return rp(_0x445f9b);}function getCustomFields(_0x345e02,_0x919ff8){var _0x35c46e={};if(_0x345e02[_0x8517('0x4b')]>0x0){_[_0x8517('0x56')](_0x345e02,function(_0x3d8773){if(_0x3d8773[_0x8517('0x57')]===_0x8517('0x58')&&_0x3d8773[_0x8517('0x59')]){_0x35c46e[_0x3d8773[_0x8517('0x59')]]=_0x3d8773[_0x8517('0x4c')][_0x8517('0x5a')]();}else if(_0x3d8773[_0x8517('0x57')]===_0x8517('0x5b')&&_0x3d8773[_0x8517('0x5c')]&&_0x3d8773['idField']&&_0x919ff8[_0x3d8773[_0x8517('0x5c')]]){_0x35c46e[_0x3d8773[_0x8517('0x59')]]=_0x919ff8[_0x3d8773[_0x8517('0x5c')]][_0x8517('0x5a')]();}else if(_0x3d8773[_0x8517('0x57')]===_0x8517('0x5d')&&_0x3d8773[_0x8517('0x5e')]&&_0x3d8773['Variable'][_0x8517('0x5f')]&&_0x3d8773[_0x8517('0x59')]&&_0x919ff8[_0x3d8773[_0x8517('0x5e')][_0x8517('0x5f')][_0x8517('0x60')]()]){_0x35c46e[_0x3d8773['idField']]=_0x919ff8[_0x3d8773[_0x8517('0x5e')]['name'][_0x8517('0x60')]()][_0x8517('0x5a')]();}});}return _0x35c46e;}function getName(_0x4147cf){if(_0x4147cf[_0x8517('0x61')]('\x20')>0x0){var _0x2351a9=_0x4147cf['split'](/ (.+)/);if(_0x2351a9[0x1]){return _0x2351a9;}}return[_0x4147cf,_0x4147cf];}exports[_0x8517('0x62')]=function(_0x31928a,_0x37a9b1,_0x45bd1c,_0x575d0d,_0x4f4b32,_0x11a447){var _0x4bc83e,_0x6fde20;_0x11a447[_0x8517('0x4e')]=intUtil['stripTrailingSlash'](_0x11a447[_0x8517('0x4e')]);_0x11a447[_0x8517('0x63')]=intUtil['stripTrailingSlash'](_0x11a447[_0x8517('0x63')]);if(_0x4f4b32&&_0x4f4b32[_0x8517('0x64')]){logger[_0x8517('0xd')](_0x8517('0x65'),_0x8517('0x66'));_0x37a9b1[_0x8517('0x67')]=util[_0x8517('0x13')](_0x8517('0x68'),_0x11a447['serverUrl'],_0x37a9b1[_0x8517('0x69')],md5(_0x37a9b1[_0x8517('0x69')]));}else{_0x37a9b1[_0x8517('0x67')]='';}return getUser(_0x11a447,_0x575d0d[_0x8517('0x6a')])['then'](function(_0x1bc0fb){_0x4bc83e=_0x1bc0fb;logger['info'](_0x8517('0x6b'),_0x4bc83e['id']);return getEndUser(_0x11a447,_0x37a9b1[_0x8517('0x6c')],_0x37a9b1[_0x8517('0x6d')]);})[_0x8517('0x34')](function(_0x52af58){_0x6fde20=_0x52af58;logger['info'](_0x8517('0x6e'),_0x6fde20[_0x8517('0x29')]||_0x6fde20[_0x8517('0x2a')]);return getCall(_0x11a447,_0x4bc83e,_0x6fde20,_0x45bd1c,_0x37a9b1,_0x8517('0x6f'));})['then'](function(_0x11a801){if(_0x11a801){logger[_0x8517('0xd')](_0x8517('0x70'),_0x11a801['id']);logger[_0x8517('0xd')](_0x8517('0x65'),_0x8517('0x71'));emit(util[_0x8517('0x13')](_0x8517('0x72'),_0x575d0d[_0x8517('0x5f')]),_0x8517('0x73'),{'uri':util['format'](_0x8517('0x74'),_0x11a447[_0x8517('0x4e')],_0x11a801['id'])});}})[_0x8517('0x75')](function(_0x512a09){logger[_0x8517('0x76')]('[QUEUE]',JSON[_0x8517('0x43')](_0x512a09));});};exports[_0x8517('0x10')]=function(_0x4d690e,_0x2504d3,_0x5e973c,_0x2c2e5d,_0x88c069,_0x1c7f45,_0x1236ba){var _0x53525c,_0x258280;_0x1c7f45['host']=intUtil[_0x8517('0x77')](_0x1c7f45[_0x8517('0x4e')]);_0x1c7f45[_0x8517('0x63')]=intUtil[_0x8517('0x77')](_0x1c7f45['serverUrl']);if(_0x1236ba&&_0x1236ba[_0x8517('0x78')]&&_0x1236ba[_0x8517('0x78')]!==_0x8517('0x79')){logger['info'](_0x8517('0x7a'),_0x8517('0x66'));_0x2504d3[_0x8517('0x67')]=util[_0x8517('0x13')](_0x8517('0x68'),_0x1c7f45[_0x8517('0x63')],_0x2504d3[_0x8517('0x69')],md5(_0x2504d3['uniqueid']));}return getUser(_0x1c7f45,_0x2c2e5d[_0x8517('0x6a')])['then'](function(_0x5179ae){_0x53525c=_0x5179ae;logger[_0x8517('0xd')](_0x8517('0x6b'),_0x53525c['id']);return getEndUser(_0x1c7f45,_0x2504d3[_0x8517('0x7b')],_0x2504d3['destcalleridnum']);})[_0x8517('0x34')](function(_0x62f8a8){_0x258280=_0x62f8a8;logger['info'](_0x8517('0x6e'),_0x258280['CONTACTID']||_0x258280['LEADID']);return getCall(_0x1c7f45,_0x53525c,_0x258280,_0x5e973c,_0x2504d3,_0x8517('0x7c'));})[_0x8517('0x34')](function(_0x16243c){if(_0x16243c){logger[_0x8517('0xd')](_0x8517('0x70'),_0x16243c['id']);logger['info'](_0x8517('0x7a'),_0x8517('0x71'));emit(util['format']('user:%s',_0x2c2e5d[_0x8517('0x5f')]),_0x8517('0x73'),{'uri':util[_0x8517('0x13')](_0x8517('0x74'),_0x1c7f45[_0x8517('0x4e')],_0x16243c['id'])});}})[_0x8517('0x75')](function(_0x5eabfe){logger['error'](_0x8517('0x7a'),JSON[_0x8517('0x43')](_0x5eabfe));});};exports['abandoned']=function(_0x2967e7,_0x111b70,_0x577a90,_0x3a0597,_0x3304ee,_0x3c1b7e){var _0x590a99,_0x5195a2;_0x3c1b7e[_0x8517('0x4e')]=intUtil[_0x8517('0x77')](_0x3c1b7e[_0x8517('0x4e')]);_0x3c1b7e[_0x8517('0x63')]=intUtil[_0x8517('0x77')](_0x3c1b7e['serverUrl']);if(_0x3304ee&&_0x3304ee[_0x8517('0x64')]){logger[_0x8517('0xd')]('[ABANDONED]',_0x8517('0x66'));_0x111b70[_0x8517('0x67')]=util[_0x8517('0x13')](_0x8517('0x68'),_0x3c1b7e[_0x8517('0x63')],_0x111b70[_0x8517('0x69')],md5(_0x111b70[_0x8517('0x69')]));}else{_0x111b70[_0x8517('0x67')]='';}return getUser(_0x3c1b7e)[_0x8517('0x34')](function(_0x1103b9){_0x590a99=_0x1103b9;logger[_0x8517('0xd')](_0x8517('0x6b'),_0x590a99['id']);return getEndUser(_0x3c1b7e,_0x111b70[_0x8517('0x6c')],_0x111b70[_0x8517('0x6d')]);})[_0x8517('0x34')](function(_0x227077){_0x5195a2=_0x227077;logger[_0x8517('0xd')](_0x8517('0x6e'),_0x5195a2[_0x8517('0x29')]||_0x5195a2['LEADID']);return getCall(_0x3c1b7e,_0x590a99,_0x5195a2,_0x577a90,_0x111b70,_0x8517('0x6f'));})[_0x8517('0x34')](function(_0x41b3ea){if(_0x41b3ea){logger[_0x8517('0xd')](_0x8517('0x70'),_0x41b3ea['id']);}})[_0x8517('0x75')](function(_0x225ee6){logger['error'](_0x8517('0x7d'),JSON[_0x8517('0x43')](_0x225ee6));});}; \ 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 7f5c028..5a50967 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 _0x6852=['%s\x20%s\x20%s\x20[%s]:%s','statusCode','name','util','mustache','../../../../config/logger','exec','toUpperCase','render','data2','data1','body','data7','then','info','format','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6852,0xe0));var _0x2685=function(_0x1e0a9b,_0x567c5a){_0x1e0a9b=_0x1e0a9b-0x0;var _0x38e9b0=_0x6852[_0x1e0a9b];return _0x38e9b0;};'use strict';var rp=require('request-promise');var util=require(_0x2685('0x0'));var Mustache=require(_0x2685('0x1'));var logger=require(_0x2685('0x2'))('trigger');exports[_0x2685('0x3')]=function(_0x541425,_0x317377){var _0x2eebab={'method':_0x541425['data1'][_0x2685('0x4')](),'uri':encodeURI(Mustache[_0x2685('0x5')](_0x541425[_0x2685('0x6')],_0x317377)),'json':!![],'resolveWithFullResponse':!![]};switch(_0x541425[_0x2685('0x7')][_0x2685('0x4')]()){case'GET':_0x2eebab['qs']=_0x317377;break;case'POST':_0x2eebab[_0x2685('0x8')]=_0x541425['data7']?Mustache[_0x2685('0x5')](_0x541425[_0x2685('0x9')],_0x317377):_0x317377;break;}rp(_0x2eebab)[_0x2685('0xa')](function(_0x1f15d8){logger[_0x2685('0xb')](util[_0x2685('0xc')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20body:\x20%s',_0x541425[_0x2685('0x7')],_0x541425[_0x2685('0x6')],_0x1f15d8['statusCode'],_0x1f15d8['body']));})[_0x2685('0xd')](function(_0x1ef295){logger['error'](util['format'](_0x2685('0xe'),_0x541425[_0x2685('0x7')],_0x541425[_0x2685('0x6')],_0x1ef295[_0x2685('0xf')],_0x1ef295[_0x2685('0x10')],_0x1ef295['message']));});}; \ No newline at end of file +var _0x9912=['statusCode','name','request-promise','util','mustache','../../../../config/logger','trigger','data1','toUpperCase','render','data2','GET','body','data7','info','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20body:\x20%s','catch','%s\x20%s\x20%s\x20[%s]:%s'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9912,0x11f));var _0x2991=function(_0x2e15bc,_0x43ce5d){_0x2e15bc=_0x2e15bc-0x0;var _0x551f89=_0x9912[_0x2e15bc];return _0x551f89;};'use strict';var rp=require(_0x2991('0x0'));var util=require(_0x2991('0x1'));var Mustache=require(_0x2991('0x2'));var logger=require(_0x2991('0x3'))(_0x2991('0x4'));exports['exec']=function(_0x2cfff1,_0x5f4bfa){var _0x5397e5={'method':_0x2cfff1[_0x2991('0x5')][_0x2991('0x6')](),'uri':encodeURI(Mustache[_0x2991('0x7')](_0x2cfff1[_0x2991('0x8')],_0x5f4bfa)),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2cfff1[_0x2991('0x5')][_0x2991('0x6')]()){case _0x2991('0x9'):_0x5397e5['qs']=_0x5f4bfa;break;case'POST':_0x5397e5[_0x2991('0xa')]=_0x2cfff1[_0x2991('0xb')]?Mustache['render'](_0x2cfff1[_0x2991('0xb')],_0x5f4bfa):_0x5f4bfa;break;}rp(_0x5397e5)['then'](function(_0x2f37a1){logger[_0x2991('0xc')](util[_0x2991('0xd')](_0x2991('0xe'),_0x2cfff1[_0x2991('0x5')],_0x2cfff1[_0x2991('0x8')],_0x2f37a1['statusCode'],_0x2f37a1[_0x2991('0xa')]));})[_0x2991('0xf')](function(_0x1a32d3){logger['error'](util['format'](_0x2991('0x10'),_0x2cfff1['data1'],_0x2cfff1[_0x2991('0x8')],_0x1a32d3[_0x2991('0x11')],_0x1a32d3[_0x2991('0x12')],_0x1a32d3['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 1244f19..fc93133 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 _0xb8ca=['then','debug','routing','error','rpc','message','exports','jayson/promise','bluebird','../../config/logger','client','http','request'];(function(_0x245e2d,_0x1515a6){var _0x2d1b6f=function(_0xd5b890){while(--_0xd5b890){_0x245e2d['push'](_0x245e2d['shift']());}};_0x2d1b6f(++_0x1515a6);}(_0xb8ca,0x89));var _0xab8c=function(_0x524321,_0x6d45a1){_0x524321=_0x524321-0x0;var _0x242737=_0xb8ca[_0x524321];return _0x242737;};'use strict';var jayson=require(_0xab8c('0x0'));var BPromise=require(_0xab8c('0x1'));var logger=require(_0xab8c('0x2'))('routing');var client=jayson[_0xab8c('0x3')][_0xab8c('0x4')]({'port':0x2329});client['Request']=function(_0x4bf8af,_0x40c0b4){return new BPromise(function(_0x293bde,_0x38f81f){return client[_0xab8c('0x5')](_0x4bf8af,_0x40c0b4)[_0xab8c('0x6')](function(_0x340159){logger[_0xab8c('0x7')]('rpc',_0xab8c('0x8'),_0x4bf8af,_0x40c0b4,_0x340159);if(_0x340159['error']){logger[_0xab8c('0x9')](_0xab8c('0xa'),_0xab8c('0x8'),_0x4bf8af,_0x340159[_0xab8c('0x9')][_0xab8c('0xb')],_0x40c0b4);return _0x38f81f(_0x340159['error'][_0xab8c('0xb')]);}else{return _0x293bde(_0x340159['result']);}})['catch'](function(_0x56d0b6){logger[_0xab8c('0x9')](_0xab8c('0xa'),_0xab8c('0x8'),_0x4bf8af,_0x56d0b6,_0x40c0b4);return _0x38f81f(_0x56d0b6);});});};module[_0xab8c('0xc')]=client; \ No newline at end of file +var _0x6e12=['message','catch','jayson/promise','bluebird','../../config/logger','routing','http','Request','request','then','debug','error','rpc'];(function(_0x4dabce,_0x36a567){var _0x286b7b=function(_0x52077d){while(--_0x52077d){_0x4dabce['push'](_0x4dabce['shift']());}};_0x286b7b(++_0x36a567);}(_0x6e12,0x154));var _0x26e1=function(_0x46a2e9,_0x58774f){_0x46a2e9=_0x46a2e9-0x0;var _0x5a3796=_0x6e12[_0x46a2e9];return _0x5a3796;};'use strict';var jayson=require(_0x26e1('0x0'));var BPromise=require(_0x26e1('0x1'));var logger=require(_0x26e1('0x2'))(_0x26e1('0x3'));var client=jayson['client'][_0x26e1('0x4')]({'port':0x2329});client[_0x26e1('0x5')]=function(_0x23bd68,_0x47f8ce){return new BPromise(function(_0x4f55d8,_0x396e0f){return client[_0x26e1('0x6')](_0x23bd68,_0x47f8ce)[_0x26e1('0x7')](function(_0x2073c9){logger[_0x26e1('0x8')]('rpc',_0x26e1('0x3'),_0x23bd68,_0x47f8ce,_0x2073c9);if(_0x2073c9[_0x26e1('0x9')]){logger[_0x26e1('0x9')](_0x26e1('0xa'),_0x26e1('0x3'),_0x23bd68,_0x2073c9['error'][_0x26e1('0xb')],_0x47f8ce);return _0x396e0f(_0x2073c9[_0x26e1('0x9')][_0x26e1('0xb')]);}else{return _0x4f55d8(_0x2073c9['result']);}})[_0x26e1('0xc')](function(_0x128c3c){logger[_0x26e1('0x9')](_0x26e1('0xa'),_0x26e1('0x3'),_0x23bd68,_0x128c3c,_0x47f8ce);return _0x396e0f(_0x128c3c);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index e72b9a3..fb8126f 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 _0x5cf8=['then','initMailAccounts','refresh','listen','catch','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','getMailAccounts'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0x5cf8,0x156));var _0x85cf=function(_0x32905d,_0x2ed18c){_0x32905d=_0x32905d-0x0;var _0x2c3f12=_0x5cf8[_0x32905d];return _0x2c3f12;};'use strict';var BPromise=require(_0x85cf('0x0'));var server=require(_0x85cf('0x1'));var Realtime=require(_0x85cf('0x2'));var EmailChannel=require(_0x85cf('0x3'));var mailAccount=require(_0x85cf('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()['then'](mailAccount[_0x85cf('0x5')]())[_0x85cf('0x6')](realtime[_0x85cf('0x7')]())[_0x85cf('0x6')](function(){email[_0x85cf('0x8')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x85cf('0x9')](realtime,email)[_0x85cf('0x6')](function(_0x34d2d2){return initRealtime();})[_0x85cf('0x6')](function(_0x54e6b6){return setInterval(initRealtime,0x2710);})[_0x85cf('0xa')](function(_0x32072c){console[_0x85cf('0xb')](_0x32072c);});}main(); \ No newline at end of file +var _0x7a81=['then','refresh','listen','catch','log','bluebird','./server','./rpc/mailAccount','resolve','getMailAccounts'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7a81,0x1bd));var _0x17a8=function(_0x3c9f10,_0x163982){_0x3c9f10=_0x3c9f10-0x0;var _0x2b732a=_0x7a81[_0x3c9f10];return _0x2b732a;};'use strict';var BPromise=require(_0x17a8('0x0'));var server=require(_0x17a8('0x1'));var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require(_0x17a8('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x17a8('0x3')]()['then'](mailAccount[_0x17a8('0x4')]())[_0x17a8('0x5')](realtime['initMailAccounts']())[_0x17a8('0x5')](function(){email[_0x17a8('0x6')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x17a8('0x7')](realtime,email)[_0x17a8('0x5')](function(_0xea96b3){return initRealtime();})[_0x17a8('0x5')](function(_0x51107a){return setInterval(initRealtime,0x2710);})[_0x17a8('0x8')](function(_0xf8403f){console[_0x17a8('0x9')](_0xf8403f);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index b770c2d..bbbb3a0 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 _0xc1c6=['ioredis','../../../config/logger','email','redis','localhost','./smtp','../rpc/mailAccount','info','mailAccounts','smtp','prototype','emit','name','active','Imap','status','messageStatus','total','isNil','stringify','md5','mailAccount:update','hasOwnProperty','imapAccounts','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','verifySmtp','Smtp','lastSync','verify','verified','catch','lodash','moment','bluebird'];(function(_0x48e4d6,_0x499fc4){var _0x381211=function(_0x4e2395){while(--_0x4e2395){_0x48e4d6['push'](_0x48e4d6['shift']());}};_0x381211(++_0x499fc4);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x35854c,_0x2ff0ec){_0x35854c=_0x35854c-0x0;var _0x5fbd8e=_0xc1c6[_0x35854c];return _0x5fbd8e;};'use strict';var _=require(_0x6c1c('0x0'));var moment=require(_0x6c1c('0x1'));var BPromise=require(_0x6c1c('0x2'));var md5=require('md5');var Redis=require(_0x6c1c('0x3'));var config=require('../../../config/environment');var logger=require(_0x6c1c('0x4'))(_0x6c1c('0x5'));config[_0x6c1c('0x6')]=_['defaults'](config['redis'],{'host':_0x6c1c('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6c1c('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x6c1c('0x8'));var mailAccount=require(_0x6c1c('0x9'));var md5Accounts={};function EmailChannel(_0x38369d){logger[_0x6c1c('0xa')]('start\x20email\x20channel');this[_0x6c1c('0xb')]=_0x38369d[_0x6c1c('0xb')];this['imapAccounts']={};this[_0x6c1c('0xc')]=new EmailSmtp();}EmailChannel[_0x6c1c('0xd')][_0x6c1c('0xe')]=function(_0x1137e8){var _0x49fb01=this[_0x6c1c('0xb')][_0x1137e8];var _0x2a4fd4={'id':_0x49fb01['id'],'name':_0x49fb01[_0x6c1c('0xf')],'key':_0x49fb01['key'],'active':_0x49fb01[_0x6c1c('0x10')],'Imap':{'status':_0x49fb01[_0x6c1c('0x11')][_0x6c1c('0x12')],'messageStatus':_0x49fb01['Imap'][_0x6c1c('0x13')],'total':_0x49fb01['Imap'][_0x6c1c('0x14')]}};if(_[_0x6c1c('0x15')](md5Accounts[_0x1137e8])){md5Accounts[_0x1137e8]={};}var _0x2d279e=md5(JSON[_0x6c1c('0x16')](_0x2a4fd4));if(md5Accounts[_0x1137e8][_0x6c1c('0x17')]!==_0x2d279e){md5Accounts[_0x1137e8][_0x6c1c('0x17')]=_0x2d279e;io[_0x6c1c('0xe')](_0x6c1c('0x18'),_0x2a4fd4);}};EmailChannel[_0x6c1c('0xd')]['refresh']=function(_0x3df1b7){for(var _0x174657 in _0x3df1b7){if(_0x3df1b7['hasOwnProperty'](_0x174657)){if(_0x3df1b7[_0x174657][_0x6c1c('0x11')]&&_0x3df1b7[_0x174657][_0x6c1c('0x10')]){var _0x494ffc=_0x3df1b7[_0x174657][_0x6c1c('0x11')];if(!this['imapAccounts'][_0x6c1c('0x19')](_0x494ffc['id'])){this[_0x6c1c('0x1a')][_0x494ffc['id']]=new EmailImap(_0x494ffc,_0x3df1b7[_0x174657]['email']);this[_0x6c1c('0x1a')][_0x494ffc['id']]['on']('box',this[_0x6c1c('0x1b')][_0x6c1c('0x1c')](this,_0x174657));this[_0x6c1c('0x1a')][_0x494ffc['id']]['on'](_0x6c1c('0x5'),this[_0x6c1c('0x1d')][_0x6c1c('0x1c')](this,_0x174657));this[_0x6c1c('0x1a')][_0x494ffc['id']]['on'](_0x6c1c('0x1e'),this[_0x6c1c('0x1f')][_0x6c1c('0x1c')](this,_0x174657));this[_0x6c1c('0x1a')][_0x494ffc['id']]['on'](_0x6c1c('0x20'),this[_0x6c1c('0x21')][_0x6c1c('0x1c')](this,_0x174657));}}else{if(_[_0x6c1c('0x15')](this[_0x6c1c('0xb')][_0x174657][_0x6c1c('0x11')])){this[_0x6c1c('0xb')][_0x174657][_0x6c1c('0x11')]={};}this[_0x6c1c('0xb')][_0x174657][_0x6c1c('0x11')][_0x6c1c('0x12')]=_0x6c1c('0x22');this[_0x6c1c('0xb')][_0x174657][_0x6c1c('0x11')][_0x6c1c('0x13')]='';this[_0x6c1c('0xe')](_0x174657);}}}};EmailChannel[_0x6c1c('0xd')][_0x6c1c('0x1b')]=function(_0x5f4568,_0x2595c3){if(this['mailAccounts'][_0x5f4568]){this[_0x6c1c('0xb')][_0x5f4568]['Imap'][_0x6c1c('0x12')]='connected';this[_0x6c1c('0xb')][_0x5f4568][_0x6c1c('0x11')]['messageStatus']=_0x2595c3[_0x6c1c('0xf')];if(_0x2595c3[_0x6c1c('0x23')]){this['mailAccounts'][_0x5f4568][_0x6c1c('0x11')][_0x6c1c('0x14')]=_0x2595c3[_0x6c1c('0x23')][_0x6c1c('0x14')];}return this['emit'](_0x5f4568);}};EmailChannel['prototype'][_0x6c1c('0x1d')]=function(_0x45128c,_0x21acef){logger[_0x6c1c('0xa')](_0x6c1c('0x24'),_0x21acef[_0x6c1c('0x25')],_0x21acef['lastName'],_0x21acef[_0x6c1c('0x26')],_0x45128c);if(this[_0x6c1c('0xb')][_0x45128c]){return mailAccount['notify'](_0x45128c,_0x21acef)[_0x6c1c('0x27')](function(_0x7cb3c){if(_0x7cb3c){logger[_0x6c1c('0xa')](_0x6c1c('0x28'));}})['catch'](function(_0x322cff){logger[_0x6c1c('0x20')](_0x6c1c('0x29'),JSON['stringify'](_0x322cff));});}};EmailChannel[_0x6c1c('0xd')]['handleImapEnd']=function(_0x6870a4){if(this['mailAccounts'][_0x6870a4]&&this[_0x6c1c('0xb')][_0x6870a4][_0x6c1c('0x11')]){if(this[_0x6c1c('0x1a')][this['mailAccounts'][_0x6870a4]['Imap']['id']]){delete this[_0x6c1c('0x1a')][this[_0x6c1c('0xb')][_0x6870a4][_0x6c1c('0x11')]['id']];}this['mailAccounts'][_0x6870a4][_0x6c1c('0x11')]['lastSync']=moment();this['emit'](_0x6870a4);}};EmailChannel[_0x6c1c('0xd')][_0x6c1c('0x21')]=function(_0x30d0fe,_0x3215a9){if(this['mailAccounts'][_0x30d0fe]){this[_0x6c1c('0xb')][_0x30d0fe][_0x6c1c('0x11')][_0x6c1c('0x12')]=_0x6c1c('0x20');this[_0x6c1c('0xb')][_0x30d0fe][_0x6c1c('0x11')][_0x6c1c('0x13')]=_0x3215a9;return this[_0x6c1c('0xe')](_0x30d0fe);}};EmailChannel[_0x6c1c('0xd')][_0x6c1c('0x2a')]=function(_0x47d75e,_0xb05b38){return this[_0x6c1c('0xc')][_0x6c1c('0x2b')](_0x47d75e,_0xb05b38);};EmailChannel[_0x6c1c('0xd')][_0x6c1c('0x2c')]=function(_0x5c8177){var _0x58dd30=this;if(this['mailAccounts'][_0x5c8177['id']]){if(_[_0x6c1c('0x15')](this['mailAccounts'][_0x5c8177['id']]['Smtp'])){this[_0x6c1c('0xb')][_0x5c8177['id']][_0x6c1c('0x2d')]={};}this['mailAccounts'][_0x5c8177['id']][_0x6c1c('0x2d')][_0x6c1c('0x2e')]=moment();return new BPromise(function(_0x3d61aa,_0x5abdcc){return _0x58dd30[_0x6c1c('0xc')][_0x6c1c('0x2f')](_0x5c8177)['then'](function(_0x201940){_0x58dd30['mailAccounts'][_0x5c8177['id']][_0x6c1c('0x2d')][_0x6c1c('0x12')]=_0x6c1c('0x30');_0x58dd30[_0x6c1c('0xb')][_0x5c8177['id']][_0x6c1c('0x2d')]['messageStatus']='';_0x58dd30[_0x6c1c('0xe')](_0x5c8177['id']);_0x3d61aa(_0x201940);})[_0x6c1c('0x31')](function(_0x1e55cc){_0x58dd30['mailAccounts'][_0x5c8177['id']][_0x6c1c('0x2d')][_0x6c1c('0x12')]=_0x6c1c('0x20');_0x58dd30[_0x6c1c('0xb')][_0x5c8177['id']][_0x6c1c('0x2d')]['messageStatus']=_0x1e55cc;_0x58dd30[_0x6c1c('0xe')](_0x5c8177['id']);_0x5abdcc(_0x1e55cc);});});}return this['smtp']['verify'](_0x5c8177);};module['exports']=EmailChannel; \ No newline at end of file +var _0x66fa=['then','verified','catch','exports','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','key','Imap','status','total','emit','mailAccount:update','prototype','hasOwnProperty','active','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','isNil','messageStatus','connected','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','error','stringify','lastSync','sendMail','verifySmtp','Smtp','smtp','verify'];(function(_0x3292ed,_0x4f08da){var _0x3395cd=function(_0x4c0e47){while(--_0x4c0e47){_0x3292ed['push'](_0x3292ed['shift']());}};_0x3395cd(++_0x4f08da);}(_0x66fa,0x117));var _0xa66f=function(_0x355f8f,_0x420d6c){_0x355f8f=_0x355f8f-0x0;var _0x7b107=_0x66fa[_0x355f8f];return _0x7b107;};'use strict';var _=require(_0xa66f('0x0'));var moment=require(_0xa66f('0x1'));var BPromise=require('bluebird');var md5=require(_0xa66f('0x2'));var Redis=require(_0xa66f('0x3'));var config=require(_0xa66f('0x4'));var logger=require(_0xa66f('0x5'))(_0xa66f('0x6'));config[_0xa66f('0x7')]=_[_0xa66f('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xa66f('0x9'))(new Redis(config[_0xa66f('0x7')]));var EmailImap=require(_0xa66f('0xa'));var EmailSmtp=require(_0xa66f('0xb'));var mailAccount=require(_0xa66f('0xc'));var md5Accounts={};function EmailChannel(_0x5096bf){logger[_0xa66f('0xd')]('start\x20email\x20channel');this[_0xa66f('0xe')]=_0x5096bf['mailAccounts'];this[_0xa66f('0xf')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x1e1997){var _0x825868=this['mailAccounts'][_0x1e1997];var _0x14d31e={'id':_0x825868['id'],'name':_0x825868['name'],'key':_0x825868[_0xa66f('0x10')],'active':_0x825868['active'],'Imap':{'status':_0x825868[_0xa66f('0x11')][_0xa66f('0x12')],'messageStatus':_0x825868[_0xa66f('0x11')]['messageStatus'],'total':_0x825868['Imap'][_0xa66f('0x13')]}};if(_['isNil'](md5Accounts[_0x1e1997])){md5Accounts[_0x1e1997]={};}var _0x528427=md5(JSON['stringify'](_0x14d31e));if(md5Accounts[_0x1e1997][_0xa66f('0x2')]!==_0x528427){md5Accounts[_0x1e1997][_0xa66f('0x2')]=_0x528427;io[_0xa66f('0x14')](_0xa66f('0x15'),_0x14d31e);}};EmailChannel[_0xa66f('0x16')]['refresh']=function(_0x5510dc){for(var _0x19b5ac in _0x5510dc){if(_0x5510dc[_0xa66f('0x17')](_0x19b5ac)){if(_0x5510dc[_0x19b5ac][_0xa66f('0x11')]&&_0x5510dc[_0x19b5ac][_0xa66f('0x18')]){var _0x5c67f5=_0x5510dc[_0x19b5ac][_0xa66f('0x11')];if(!this['imapAccounts']['hasOwnProperty'](_0x5c67f5['id'])){this[_0xa66f('0xf')][_0x5c67f5['id']]=new EmailImap(_0x5c67f5,_0x5510dc[_0x19b5ac][_0xa66f('0x6')]);this[_0xa66f('0xf')][_0x5c67f5['id']]['on'](_0xa66f('0x19'),this[_0xa66f('0x1a')][_0xa66f('0x1b')](this,_0x19b5ac));this[_0xa66f('0xf')][_0x5c67f5['id']]['on'](_0xa66f('0x6'),this[_0xa66f('0x1c')][_0xa66f('0x1b')](this,_0x19b5ac));this[_0xa66f('0xf')][_0x5c67f5['id']]['on'](_0xa66f('0x1d'),this[_0xa66f('0x1e')][_0xa66f('0x1b')](this,_0x19b5ac));this[_0xa66f('0xf')][_0x5c67f5['id']]['on']('error',this[_0xa66f('0x1f')][_0xa66f('0x1b')](this,_0x19b5ac));}}else{if(_[_0xa66f('0x20')](this[_0xa66f('0xe')][_0x19b5ac]['Imap'])){this[_0xa66f('0xe')][_0x19b5ac][_0xa66f('0x11')]={};}this[_0xa66f('0xe')][_0x19b5ac][_0xa66f('0x11')]['status']='disabled';this[_0xa66f('0xe')][_0x19b5ac]['Imap'][_0xa66f('0x21')]='';this[_0xa66f('0x14')](_0x19b5ac);}}}};EmailChannel[_0xa66f('0x16')]['handleImapBox']=function(_0x4683c7,_0x1c2903){if(this[_0xa66f('0xe')][_0x4683c7]){this[_0xa66f('0xe')][_0x4683c7][_0xa66f('0x11')][_0xa66f('0x12')]=_0xa66f('0x22');this[_0xa66f('0xe')][_0x4683c7][_0xa66f('0x11')][_0xa66f('0x21')]=_0x1c2903[_0xa66f('0x23')];if(_0x1c2903[_0xa66f('0x24')]){this[_0xa66f('0xe')][_0x4683c7][_0xa66f('0x11')]['total']=_0x1c2903['messages'][_0xa66f('0x13')];}return this[_0xa66f('0x14')](_0x4683c7);}};EmailChannel['prototype'][_0xa66f('0x1c')]=function(_0x2de5f3,_0x4cd7f2){logger[_0xa66f('0xd')](_0xa66f('0x25'),_0x4cd7f2[_0xa66f('0x26')],_0x4cd7f2[_0xa66f('0x27')],_0x4cd7f2[_0xa66f('0x28')],_0x2de5f3);if(this['mailAccounts'][_0x2de5f3]){return mailAccount[_0xa66f('0x29')](_0x2de5f3,_0x4cd7f2)['then'](function(_0x306b35){if(_0x306b35){logger[_0xa66f('0xd')](_0xa66f('0x2a'));}})['catch'](function(_0x2b1a90){logger[_0xa66f('0x2b')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xa66f('0x2c')](_0x2b1a90));});}};EmailChannel[_0xa66f('0x16')][_0xa66f('0x1e')]=function(_0x3e7ac5){if(this[_0xa66f('0xe')][_0x3e7ac5]&&this[_0xa66f('0xe')][_0x3e7ac5][_0xa66f('0x11')]){if(this[_0xa66f('0xf')][this[_0xa66f('0xe')][_0x3e7ac5][_0xa66f('0x11')]['id']]){delete this['imapAccounts'][this[_0xa66f('0xe')][_0x3e7ac5]['Imap']['id']];}this[_0xa66f('0xe')][_0x3e7ac5][_0xa66f('0x11')][_0xa66f('0x2d')]=moment();this[_0xa66f('0x14')](_0x3e7ac5);}};EmailChannel[_0xa66f('0x16')][_0xa66f('0x1f')]=function(_0x173da6,_0xcee582){if(this['mailAccounts'][_0x173da6]){this[_0xa66f('0xe')][_0x173da6]['Imap'][_0xa66f('0x12')]=_0xa66f('0x2b');this[_0xa66f('0xe')][_0x173da6]['Imap']['messageStatus']=_0xcee582;return this[_0xa66f('0x14')](_0x173da6);}};EmailChannel[_0xa66f('0x16')][_0xa66f('0x2e')]=function(_0x1f5a5f,_0x330169){return this['smtp']['send'](_0x1f5a5f,_0x330169);};EmailChannel['prototype'][_0xa66f('0x2f')]=function(_0x4aeeb4){var _0x4d2d27=this;if(this['mailAccounts'][_0x4aeeb4['id']]){if(_[_0xa66f('0x20')](this['mailAccounts'][_0x4aeeb4['id']][_0xa66f('0x30')])){this[_0xa66f('0xe')][_0x4aeeb4['id']][_0xa66f('0x30')]={};}this[_0xa66f('0xe')][_0x4aeeb4['id']][_0xa66f('0x30')][_0xa66f('0x2d')]=moment();return new BPromise(function(_0x192033,_0x261089){return _0x4d2d27[_0xa66f('0x31')][_0xa66f('0x32')](_0x4aeeb4)[_0xa66f('0x33')](function(_0x93f6ff){_0x4d2d27[_0xa66f('0xe')][_0x4aeeb4['id']][_0xa66f('0x30')]['status']=_0xa66f('0x34');_0x4d2d27[_0xa66f('0xe')][_0x4aeeb4['id']]['Smtp'][_0xa66f('0x21')]='';_0x4d2d27['emit'](_0x4aeeb4['id']);_0x192033(_0x93f6ff);})[_0xa66f('0x35')](function(_0x27adf4){_0x4d2d27['mailAccounts'][_0x4aeeb4['id']][_0xa66f('0x30')][_0xa66f('0x12')]=_0xa66f('0x2b');_0x4d2d27['mailAccounts'][_0x4aeeb4['id']][_0xa66f('0x30')]['messageStatus']=_0x27adf4;_0x4d2d27[_0xa66f('0x14')](_0x4aeeb4['id']);_0x261089(_0x27adf4);});});}return this[_0xa66f('0x31')][_0xa66f('0x32')](_0x4aeeb4);};module[_0xa66f('0x36')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 97566f7..2bd8512 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 _0xe2e2=['error','handleError','connect','inherits','prototype','getAccount','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','getHost','openBox','handleOpenBox','box','readUnseen','handleCloseBox','end','UNSEEN','length','fetch','message','handleFetchMessage','handleFetchEnd','handleMessageBody','attributes','handleMessageEnd','handleMessageAttributes','handleSimpleParser','account','emit','email','closeBox','handleFetchError','stringify','textCode','hasOwnProperty','exports','path','util','imap','lodash','randomstring','simpleParser','events','EventEmitter','./utils','../../../config/logger','mailbox','INBOX','once','handleReady','bind','handleEnd'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xe2e2,0x158));var _0x2e2e=function(_0x32a79a,_0x581d44){_0x32a79a=_0x32a79a-0x0;var _0x485f14=_0xe2e2[_0x32a79a];return _0x485f14;};'use strict';var fs=require('fs');var path=require(_0x2e2e('0x0'));var util=require(_0x2e2e('0x1'));var Imap=require(_0x2e2e('0x2'));var _=require(_0x2e2e('0x3'));var rs=require(_0x2e2e('0x4'));var simpleParser=require('mailparser')[_0x2e2e('0x5')];var EventEmitter=require(_0x2e2e('0x6'))[_0x2e2e('0x7')];var utils=require(_0x2e2e('0x8'));var logger=require(_0x2e2e('0x9'))('email');function EmailImap(_0x5e9a29,_0x1ed448){this[_0x2e2e('0xa')]=_0x2e2e('0xb');this['account']=this['getAccount'](_0x5e9a29,_0x1ed448);this['imap']=new Imap(this['account']);this[_0x2e2e('0x2')][_0x2e2e('0xc')]('ready',this[_0x2e2e('0xd')][_0x2e2e('0xe')](this));this['imap'][_0x2e2e('0xc')]('end',this[_0x2e2e('0xf')][_0x2e2e('0xe')](this));this['imap']['on'](_0x2e2e('0x10'),this[_0x2e2e('0x11')][_0x2e2e('0xe')](this));this['imap'][_0x2e2e('0x12')]();}util[_0x2e2e('0x13')](EmailImap,EventEmitter);EmailImap[_0x2e2e('0x14')][_0x2e2e('0x15')]=function(_0x455136,_0x42cfae){var _0x42c525={'connTimeout':_0x455136[_0x2e2e('0x16')]?_0x455136[_0x2e2e('0x16')]*0x3e8:0x2710,'authTimeout':_0x455136[_0x2e2e('0x17')]?_0x455136[_0x2e2e('0x17')]*0x3e8:0x1388};if(_[_0x2e2e('0x18')](_0x455136[_0x2e2e('0x19')])){if(_0x455136[_0x2e2e('0x1a')]){_0x42c525[_0x2e2e('0x1b')]=_0x455136['user'];_0x42c525[_0x2e2e('0x1c')]=_0x455136[_0x2e2e('0x1c')];}_0x42c525[_0x2e2e('0x1d')]=_0x455136[_0x2e2e('0x1d')];_0x42c525[_0x2e2e('0x1e')]=_0x455136['port']||0x3e1;if(_0x455136[_0x2e2e('0x1f')]){_0x42c525[_0x2e2e('0x1f')]=!![];}else{_0x42c525[_0x2e2e('0x1f')]=![];_0x42c525[_0x2e2e('0x20')]='required';}}else{_0x42c525[_0x2e2e('0x1b')]=_0x455136[_0x2e2e('0x1b')];_0x42c525['password']=_0x455136[_0x2e2e('0x1c')];_0x42c525[_0x2e2e('0x1d')]=utils[_0x2e2e('0x21')](_0x455136[_0x2e2e('0x19')]);_0x42c525['port']=0x3e1;_0x42c525[_0x2e2e('0x1f')]=!![];}_0x42c525['email']=_0x42cfae||_0x455136[_0x2e2e('0x1b')]||'anonymous@xcally.com';return _0x42c525;};EmailImap[_0x2e2e('0x14')]['handleReady']=function(){this[_0x2e2e('0x2')][_0x2e2e('0x22')](this[_0x2e2e('0xa')],![],this[_0x2e2e('0x23')]['bind'](this));};EmailImap[_0x2e2e('0x14')]['handleOpenBox']=function(_0x2e0555,_0x43d8cb){if(_0x2e0555){this[_0x2e2e('0x11')](_0x2e0555,!![]);}else{this['emit'](_0x2e2e('0x24'),_0x43d8cb);this[_0x2e2e('0x25')]();}};EmailImap[_0x2e2e('0x14')][_0x2e2e('0x26')]=function(_0x23aa94){if(_0x23aa94){this['handleError'](_0x23aa94,!![]);}else{this[_0x2e2e('0x2')][_0x2e2e('0x27')]();}};EmailImap[_0x2e2e('0x14')][_0x2e2e('0x25')]=function(){this[_0x2e2e('0x2')]['search']([_0x2e2e('0x28')],this['handleReadUnseen'][_0x2e2e('0xe')](this));};EmailImap[_0x2e2e('0x14')]['handleReadUnseen']=function(_0x59593,_0x55f05f){if(_0x59593){this[_0x2e2e('0x11')](_0x59593,!![]);}else{if(_0x55f05f[_0x2e2e('0x29')]){try{var _0x4a2a3a=this[_0x2e2e('0x2')][_0x2e2e('0x2a')](_0x55f05f,{'bodies':'','markSeen':!![]});_0x4a2a3a['on'](_0x2e2e('0x2b'),this[_0x2e2e('0x2c')][_0x2e2e('0xe')](this));_0x4a2a3a[_0x2e2e('0xc')]('error',this['handleFetchError'][_0x2e2e('0xe')](this));_0x4a2a3a[_0x2e2e('0xc')](_0x2e2e('0x27'),this[_0x2e2e('0x2d')][_0x2e2e('0xe')](this));}catch(_0x1d5727){logger[_0x2e2e('0x10')](_0x1d5727);}}else{this[_0x2e2e('0x2')]['closeBox'](!![],this['handleCloseBox']['bind'](this));}}};EmailImap[_0x2e2e('0x14')][_0x2e2e('0x2c')]=function(_0xf9ef6d,_0x187066){_0xf9ef6d['on']('body',this[_0x2e2e('0x2e')]['bind'](this));_0xf9ef6d[_0x2e2e('0xc')](_0x2e2e('0x2f'),this['handleMessageAttributes']['bind'](this));_0xf9ef6d[_0x2e2e('0xc')](_0x2e2e('0x27'),this[_0x2e2e('0x30')][_0x2e2e('0xe')](this));};EmailImap[_0x2e2e('0x14')]['handleMessageBody']=function(_0x213e47,_0x3be6ce){simpleParser(_0x213e47,this['handleSimpleParser'][_0x2e2e('0xe')](this));};EmailImap[_0x2e2e('0x14')][_0x2e2e('0x31')]=function(_0x4daa8a){};EmailImap[_0x2e2e('0x14')][_0x2e2e('0x30')]=function(){};EmailImap[_0x2e2e('0x14')][_0x2e2e('0x32')]=function(_0x4f0a19,_0xe2228b){if(_0x4f0a19){logger['error'](_0x4f0a19);}else{var _0x45c59a=this;utils['parser'](this[_0x2e2e('0x33')],_0xe2228b,function(_0x1bc0f9){_0x45c59a[_0x2e2e('0x34')](_0x2e2e('0x35'),_0x1bc0f9);});}};EmailImap[_0x2e2e('0x14')][_0x2e2e('0x2d')]=function(){this[_0x2e2e('0x2')][_0x2e2e('0x36')](!![],this[_0x2e2e('0x26')][_0x2e2e('0xe')](this));};EmailImap[_0x2e2e('0x14')][_0x2e2e('0x37')]=function(_0x54ce8d){this[_0x2e2e('0x11')](_0x54ce8d);this['imap']['closeBox'](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x2e2e('0x14')][_0x2e2e('0xf')]=function(){this[_0x2e2e('0x34')]('end');};EmailImap['prototype']['handleError']=function(_0x4c7725,_0x215a82){logger[_0x2e2e('0x10')](_0x2e2e('0x11'),this[_0x2e2e('0x33')]['email'],JSON[_0x2e2e('0x38')](_0x4c7725));var _0x527854='';if(_0x4c7725){if(_0x4c7725[_0x2e2e('0x39')]){_0x527854=_0x4c7725[_0x2e2e('0x39')];}else{for(var _0x42d16d in _0x4c7725){if(_0x4c7725[_0x2e2e('0x3a')](_0x42d16d)){_0x527854+=_['upperFirst'](_0x42d16d)+':\x20'+_0x4c7725[_0x42d16d]+'\x0a';}}}}if(_0x215a82){this[_0x2e2e('0x2')]['end']();}else{this[_0x2e2e('0x34')](_0x2e2e('0x10'),_0x527854);this[_0x2e2e('0x34')](_0x2e2e('0x27'));}};module[_0x2e2e('0x3b')]=EmailImap; \ No newline at end of file +var _0xf47d=['imap','lodash','randomstring','simpleParser','events','EventEmitter','../../../config/logger','email','mailbox','account','getAccount','once','ready','handleReady','end','error','handleError','bind','connect','inherits','prototype','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','getHost','service','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','message','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','body','attributes','handleMessageBody','handleMessageAttributes','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','path','util'];(function(_0x44235f,_0x32e1bd){var _0x51a20f=function(_0x288fd2){while(--_0x288fd2){_0x44235f['push'](_0x44235f['shift']());}};_0x51a20f(++_0x32e1bd);}(_0xf47d,0x19b));var _0xdf47=function(_0x4d08b8,_0x34c445){_0x4d08b8=_0x4d08b8-0x0;var _0x70214a=_0xf47d[_0x4d08b8];return _0x70214a;};'use strict';var fs=require('fs');var path=require(_0xdf47('0x0'));var util=require(_0xdf47('0x1'));var Imap=require(_0xdf47('0x2'));var _=require(_0xdf47('0x3'));var rs=require(_0xdf47('0x4'));var simpleParser=require('mailparser')[_0xdf47('0x5')];var EventEmitter=require(_0xdf47('0x6'))[_0xdf47('0x7')];var utils=require('./utils');var logger=require(_0xdf47('0x8'))(_0xdf47('0x9'));function EmailImap(_0xaa9536,_0x3f285f){this[_0xdf47('0xa')]='INBOX';this[_0xdf47('0xb')]=this[_0xdf47('0xc')](_0xaa9536,_0x3f285f);this[_0xdf47('0x2')]=new Imap(this[_0xdf47('0xb')]);this['imap'][_0xdf47('0xd')](_0xdf47('0xe'),this[_0xdf47('0xf')]['bind'](this));this[_0xdf47('0x2')]['once'](_0xdf47('0x10'),this['handleEnd']['bind'](this));this[_0xdf47('0x2')]['on'](_0xdf47('0x11'),this[_0xdf47('0x12')][_0xdf47('0x13')](this));this[_0xdf47('0x2')][_0xdf47('0x14')]();}util[_0xdf47('0x15')](EmailImap,EventEmitter);EmailImap[_0xdf47('0x16')][_0xdf47('0xc')]=function(_0x491ae3,_0x4fae6a){var _0x162f79={'connTimeout':_0x491ae3['connTimeout']?_0x491ae3[_0xdf47('0x17')]*0x3e8:0x2710,'authTimeout':_0x491ae3[_0xdf47('0x18')]?_0x491ae3['authTimeout']*0x3e8:0x1388};if(_[_0xdf47('0x19')](_0x491ae3['service'])){if(_0x491ae3[_0xdf47('0x1a')]){_0x162f79[_0xdf47('0x1b')]=_0x491ae3[_0xdf47('0x1b')];_0x162f79[_0xdf47('0x1c')]=_0x491ae3[_0xdf47('0x1c')];}_0x162f79[_0xdf47('0x1d')]=_0x491ae3[_0xdf47('0x1d')];_0x162f79[_0xdf47('0x1e')]=_0x491ae3[_0xdf47('0x1e')]||0x3e1;if(_0x491ae3[_0xdf47('0x1f')]){_0x162f79['tls']=!![];}else{_0x162f79[_0xdf47('0x1f')]=![];_0x162f79['autotls']='required';}}else{_0x162f79['user']=_0x491ae3['user'];_0x162f79[_0xdf47('0x1c')]=_0x491ae3[_0xdf47('0x1c')];_0x162f79[_0xdf47('0x1d')]=utils[_0xdf47('0x20')](_0x491ae3[_0xdf47('0x21')]);_0x162f79[_0xdf47('0x1e')]=0x3e1;_0x162f79[_0xdf47('0x1f')]=!![];}_0x162f79['email']=_0x4fae6a||_0x491ae3[_0xdf47('0x1b')]||_0xdf47('0x22');return _0x162f79;};EmailImap[_0xdf47('0x16')]['handleReady']=function(){this[_0xdf47('0x2')][_0xdf47('0x23')](this['mailbox'],![],this['handleOpenBox'][_0xdf47('0x13')](this));};EmailImap['prototype'][_0xdf47('0x24')]=function(_0x1908fd,_0x40a642){if(_0x1908fd){this[_0xdf47('0x12')](_0x1908fd,!![]);}else{this[_0xdf47('0x25')](_0xdf47('0x26'),_0x40a642);this[_0xdf47('0x27')]();}};EmailImap[_0xdf47('0x16')][_0xdf47('0x28')]=function(_0x883e04){if(_0x883e04){this[_0xdf47('0x12')](_0x883e04,!![]);}else{this[_0xdf47('0x2')][_0xdf47('0x10')]();}};EmailImap['prototype'][_0xdf47('0x27')]=function(){this[_0xdf47('0x2')][_0xdf47('0x29')]([_0xdf47('0x2a')],this[_0xdf47('0x2b')]['bind'](this));};EmailImap[_0xdf47('0x16')][_0xdf47('0x2b')]=function(_0x12460c,_0x80c03f){if(_0x12460c){this[_0xdf47('0x12')](_0x12460c,!![]);}else{if(_0x80c03f['length']){try{var _0x3c3cf2=this[_0xdf47('0x2')]['fetch'](_0x80c03f,{'bodies':'','markSeen':!![]});_0x3c3cf2['on'](_0xdf47('0x2c'),this['handleFetchMessage'][_0xdf47('0x13')](this));_0x3c3cf2[_0xdf47('0xd')](_0xdf47('0x11'),this[_0xdf47('0x2d')][_0xdf47('0x13')](this));_0x3c3cf2['once'](_0xdf47('0x10'),this[_0xdf47('0x2e')][_0xdf47('0x13')](this));}catch(_0x40cbad){logger[_0xdf47('0x11')](_0x40cbad);}}else{this[_0xdf47('0x2')][_0xdf47('0x2f')](!![],this[_0xdf47('0x28')]['bind'](this));}}};EmailImap[_0xdf47('0x16')][_0xdf47('0x30')]=function(_0x51c2e1,_0x40fb38){_0x51c2e1['on'](_0xdf47('0x31'),this['handleMessageBody']['bind'](this));_0x51c2e1[_0xdf47('0xd')](_0xdf47('0x32'),this['handleMessageAttributes']['bind'](this));_0x51c2e1['once'](_0xdf47('0x10'),this['handleMessageEnd'][_0xdf47('0x13')](this));};EmailImap[_0xdf47('0x16')][_0xdf47('0x33')]=function(_0xfa79d6,_0x24cfef){simpleParser(_0xfa79d6,this['handleSimpleParser'][_0xdf47('0x13')](this));};EmailImap[_0xdf47('0x16')][_0xdf47('0x34')]=function(_0x27d884){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0xdf47('0x16')][_0xdf47('0x35')]=function(_0x4b3316,_0x3aed0b){if(_0x4b3316){logger[_0xdf47('0x11')](_0x4b3316);}else{var _0x444853=this;utils[_0xdf47('0x36')](this['account'],_0x3aed0b,function(_0x58793b){_0x444853[_0xdf47('0x25')]('email',_0x58793b);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0xdf47('0x2')][_0xdf47('0x2f')](!![],this[_0xdf47('0x28')][_0xdf47('0x13')](this));};EmailImap['prototype'][_0xdf47('0x2d')]=function(_0x221bd8){this['handleError'](_0x221bd8);this[_0xdf47('0x2')][_0xdf47('0x2f')](!![],this[_0xdf47('0x28')][_0xdf47('0x13')](this));};EmailImap[_0xdf47('0x16')]['handleEnd']=function(){this[_0xdf47('0x25')](_0xdf47('0x10'));};EmailImap[_0xdf47('0x16')][_0xdf47('0x12')]=function(_0x2f58df,_0x33f85f){logger['error'](_0xdf47('0x12'),this[_0xdf47('0xb')][_0xdf47('0x9')],JSON[_0xdf47('0x37')](_0x2f58df));var _0x2aa3e6='';if(_0x2f58df){if(_0x2f58df[_0xdf47('0x38')]){_0x2aa3e6=_0x2f58df[_0xdf47('0x38')];}else{for(var _0x6f0ef in _0x2f58df){if(_0x2f58df[_0xdf47('0x39')](_0x6f0ef)){_0x2aa3e6+=_[_0xdf47('0x3a')](_0x6f0ef)+':\x20'+_0x2f58df[_0x6f0ef]+'\x0a';}}}}if(_0x33f85f){this[_0xdf47('0x2')][_0xdf47('0x10')]();}else{this[_0xdf47('0x25')](_0xdf47('0x11'),_0x2aa3e6);this[_0xdf47('0x25')](_0xdf47('0x10'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 7b6f8a3..a0c9ddf 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 _0x6781=['nodemailer-plugin-inline-base64','createTransport','use','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','bluebird'];(function(_0x1e5cc3,_0x238a87){var _0x15c596=function(_0x27bb04){while(--_0x27bb04){_0x1e5cc3['push'](_0x1e5cc3['shift']());}};_0x15c596(++_0x238a87);}(_0x6781,0x6c));var _0x1678=function(_0x27b302,_0x21f40f){_0x27b302=_0x27b302-0x0;var _0x4164cf=_0x6781[_0x27b302];return _0x4164cf;};'use strict';var nodemailer=require(_0x1678('0x0'));var BPromise=require(_0x1678('0x1'));var inlineBase64=require(_0x1678('0x2'));function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x44cfa4,_0x21a9fc){return new BPromise(function(_0x187ff3,_0x38815a){var _0x6ac20f=nodemailer[_0x1678('0x3')](_0x44cfa4);_0x6ac20f[_0x1678('0x4')]('compile',inlineBase64());_0x6ac20f[_0x1678('0x5')](_0x21a9fc,function(_0x5bc4ee,_0x1d3c74){if(_0x5bc4ee){_0x38815a(_0x5bc4ee[_0x1678('0x6')]());}else{_0x187ff3(_0x1d3c74);}});});};EmailSmtp['prototype'][_0x1678('0x7')]=function(_0x5cfea9){return new BPromise(function(_0x8c7cef,_0x4fbed6){var _0x36f9a7=nodemailer[_0x1678('0x3')](_0x5cfea9);_0x36f9a7['verify'](function(_0x43136e,_0x12fcda){if(_0x43136e){_0x4fbed6(_0x43136e[_0x1678('0x6')]());}else{if(_0x12fcda){_0x8c7cef(_0x12fcda);}else{_0x4fbed6(_0x1678('0x8'));}}});});};module[_0x1678('0x9')]=EmailSmtp; \ No newline at end of file +var _0xf09d=['Not\x20verifired','exports','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport','sendMail','toString','verify'];(function(_0xdf5f51,_0x2e32d1){var _0x18b69f=function(_0x469d5d){while(--_0x469d5d){_0xdf5f51['push'](_0xdf5f51['shift']());}};_0x18b69f(++_0x2e32d1);}(_0xf09d,0x1b0));var _0xdf09=function(_0x22de09,_0x3db597){_0x22de09=_0x22de09-0x0;var _0x4a13dc=_0xf09d[_0x22de09];return _0x4a13dc;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0xdf09('0x0'));var inlineBase64=require(_0xdf09('0x1'));function EmailSmtp(){}EmailSmtp[_0xdf09('0x2')][_0xdf09('0x3')]=function(_0x5f585f,_0x2dcffe){return new BPromise(function(_0x4882c9,_0x1d28b4){var _0x348f01=nodemailer[_0xdf09('0x4')](_0x5f585f);_0x348f01['use']('compile',inlineBase64());_0x348f01[_0xdf09('0x5')](_0x2dcffe,function(_0x361e83,_0xf2b0ee){if(_0x361e83){_0x1d28b4(_0x361e83[_0xdf09('0x6')]());}else{_0x4882c9(_0xf2b0ee);}});});};EmailSmtp[_0xdf09('0x2')]['verify']=function(_0x57687c){return new BPromise(function(_0xd96490,_0x5dbe22){var _0xea8366=nodemailer[_0xdf09('0x4')](_0x57687c);_0xea8366[_0xdf09('0x7')](function(_0x17a260,_0x975bc0){if(_0x17a260){_0x5dbe22(_0x17a260[_0xdf09('0x6')]());}else{if(_0x975bc0){_0xd96490(_0x975bc0);}else{_0x5dbe22(_0xdf09('0x8'));}}});});};module[_0xdf09('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 27d1021..ec4782d 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 _0x034e=['parser','from','subject','messageId','inReplyTo','filter','application/ms-tnef','info','parseBuffer','BodyHTML','

Empty\x20message

','Attachments','Title','Data','gmail','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','127.0.0.1','lodash','randomstring','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','length','slice','join','Anonymous','split','pop','isEmpty','html','test','replace','body','textAsHtml','0x1?_0x47f7d9[_0xe034('0x13')]():'';}return'';}function getMails(_0x24ff51,_0x58598){var _0xaaba8c='';for(var _0x5df898=0x0;_0x5df898<_0x58598[_0xe034('0x8')][_0xe034('0xe')];_0x5df898+=0x1){if(_0x58598[_0xe034('0x8')][_0x5df898]['address']!==_0x24ff51){if(!_[_0xe034('0x14')](_0xaaba8c)){_0xaaba8c+=',';}_0xaaba8c+=_0x58598[_0xe034('0x8')][_0x5df898][_0xe034('0xd')]||_0x58598[_0xe034('0x8')][_0x5df898][_0xe034('0x9')]||'';_0xaaba8c+='\x20<';_0xaaba8c+=_0x58598[_0xe034('0x8')][_0x5df898]['address']?_0x58598[_0xe034('0x8')][_0x5df898][_0xe034('0x9')]:'anonymous'+random['generate'](0x6)+_0xe034('0xc');_0xaaba8c+='>';}}return _0xaaba8c;}function parseEmail(_0x302ff0,_0x3f02b9,_0x1da146){if(_0x3f02b9[_0xe034('0x15')]){var _0x4f642d=/)<[^<]*)*<\/script>/gi;while(_0x4f642d[_0xe034('0x16')](_0x3f02b9['html'])){_0x3f02b9['html']=_0x3f02b9[_0xe034('0x15')][_0xe034('0x17')](_0x4f642d,'');}_0x1da146[_0xe034('0x18')]=_0x3f02b9[_0xe034('0x15')];}else{_0x1da146[_0xe034('0x18')]=_0x3f02b9[_0xe034('0x19')];}if(_0x1da146[_0xe034('0x18')]){_0x1da146[_0xe034('0x18')]=_0x1da146[_0xe034('0x18')][_0xe034('0x17')](/Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8e2,0x14e));var _0x2a8e=function(_0x1dbfbc,_0x3ea4b2){_0x1dbfbc=_0x1dbfbc-0x0;var _0x2a5a2e=_0xa8e2[_0x1dbfbc];return _0x2a5a2e;};'use strict';var _=require(_0x2a8e('0x0'));var moment=require('moment');var random=require(_0x2a8e('0x1'));var fs=require('fs');var path=require(_0x2a8e('0x2'));var util=require(_0x2a8e('0x3'));var tnef=require(_0x2a8e('0x4'));var logger=require(_0x2a8e('0x5'))(_0x2a8e('0x6'));var config=require('../../../config/environment');function getAddress(_0x2e6cbb){var _0xa55fb5=_[_0x2a8e('0x7')](_0x2e6cbb[_0x2a8e('0x8')]);return _0xa55fb5&&_0xa55fb5[_0x2a8e('0x9')]?_0xa55fb5[_0x2a8e('0x9')]:_0x2a8e('0xa')+random[_0x2a8e('0xb')](0x6)+_0x2a8e('0xc');}function getFirstName(_0x5cd950){var _0x20d557=_['head'](_0x5cd950[_0x2a8e('0x8')]);if(_0x20d557&&_0x20d557[_0x2a8e('0xd')]){var _0x12390e=_0x20d557['name'][_0x2a8e('0xe')](/\s+/);return _0x12390e['length']?_0x12390e[_0x2a8e('0xf')](0x0,-0x1)['join']('\x20'):_0x20d557[_0x2a8e('0xd')];}return _0x2a8e('0x10');}function getLastName(_0x1ed25c){var _0x886e95=_['head'](_0x1ed25c['value']);if(_0x886e95&&_0x886e95['name']){var _0x3edeb4=_0x886e95['name'][_0x2a8e('0xe')](/\s+/);return _0x3edeb4[_0x2a8e('0x11')]>0x1?_0x3edeb4['pop']():'';}return'';}function getMails(_0x3b7e02,_0x403678){var _0x40dc6c='';for(var _0x4112e6=0x0;_0x4112e6<_0x403678[_0x2a8e('0x8')]['length'];_0x4112e6+=0x1){if(_0x403678['value'][_0x4112e6][_0x2a8e('0x9')]!==_0x3b7e02){if(!_[_0x2a8e('0x12')](_0x40dc6c)){_0x40dc6c+=',';}_0x40dc6c+=_0x403678['value'][_0x4112e6][_0x2a8e('0xd')]||_0x403678['value'][_0x4112e6]['address']||'';_0x40dc6c+='\x20<';_0x40dc6c+=_0x403678[_0x2a8e('0x8')][_0x4112e6][_0x2a8e('0x9')]?_0x403678['value'][_0x4112e6][_0x2a8e('0x9')]:_0x2a8e('0xa')+random[_0x2a8e('0xb')](0x6)+_0x2a8e('0xc');_0x40dc6c+='>';}}return _0x40dc6c;}function parseEmail(_0x4b560d,_0x3cf481,_0x4da041){if(_0x3cf481['html']){var _0x4891ce=/)<[^<]*)*<\/script>/gi;while(_0x4891ce[_0x2a8e('0x13')](_0x3cf481[_0x2a8e('0x14')])){_0x3cf481['html']=_0x3cf481[_0x2a8e('0x14')]['replace'](_0x4891ce,'');}_0x4da041['body']=_0x3cf481[_0x2a8e('0x14')];}else{_0x4da041['body']=_0x3cf481[_0x2a8e('0x15')];}if(_0x4da041[_0x2a8e('0x16')]){_0x4da041[_0x2a8e('0x16')]=_0x4da041['body'][_0x2a8e('0x17')](/0x0){if(this[_0x4e2101+'Capacity']>0x0&&this[_0x4e2101+_0xa435('0x25')]>=this[_0x4e2101+_0xa435('0x26')]){return _0xa435('0x27');}else{return'working';}}else{return _0xa435('0x28');}};Agent[_0xa435('0x23')][_0xa435('0x29')]=function(){var _0x327f7c=['mail',_0xa435('0x2a'),_0xa435('0x2b'),'fax',_0xa435('0x2c')];for(var _0x106069=0x0;_0x106069<_0x327f7c[_0xa435('0x2d')];_0x106069+=0x1){var _0x95b0fa=this[_0xa435('0x24')](_0x327f7c[_0x106069]);if(this[_0x327f7c[_0x106069]+_0xa435('0x2e')]!==_0x95b0fa){this[_0x327f7c[_0x106069]+'StatusTime']=_[_0xa435('0x2f')](moment()['format']('x'));}this[_0x327f7c[_0x106069]+'Status']=_0x95b0fa;}var _0x5f1be6={'id':this['id'],'name':this[_0xa435('0x9')],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0xa435('0xc')],'mailPause':this[_0xa435('0xd')],'smsPause':this[_0xa435('0x30')],'faxPause':this[_0xa435('0xe')],'openchannelPause':this[_0xa435('0xf')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xa435('0x11')],'chatCapacity':this[_0xa435('0x12')],'chatCurrentCapacity':this[_0xa435('0x31')],'mailStatus':this[_0xa435('0x13')],'mailStatusTime':this[_0xa435('0x14')],'mailCapacity':this[_0xa435('0x15')],'mailCurrentCapacity':this[_0xa435('0x16')],'faxStatus':this[_0xa435('0x17')],'faxStatusTime':this[_0xa435('0x18')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xa435('0x1a')],'smsStatus':this[_0xa435('0x1b')],'smsStatusTime':this[_0xa435('0x1c')],'smsCapacity':this[_0xa435('0x1d')],'smsCurrentCapacity':this[_0xa435('0x1e')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xa435('0x32')],'openchannelCapacity':this[_0xa435('0x20')],'openchannelCurrentCapacity':this[_0xa435('0x33')],'busy':this['busy'],'busyQueue':this[_0xa435('0x22')]};var _0x1765a9=md5(JSON['stringify'](_0x5f1be6));if(this['md5']!==_0x1765a9){this[_0xa435('0x2')]=_0x1765a9;io[_0xa435('0x34')]('user:save',_0x5f1be6);}};module[_0xa435('0x35')]=Agent; \ No newline at end of file +var _0x1a4d=['lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','getChannelStatus','CurrentCapacity','Capacity','working','idle','prototype','updateRealtime','chat','openchannel','fax','sms','length','Status','StatusTime','toNumber','mailStatusTime','faxStatus','smsStatus','smsCurrentCapacity','busyQueue','emit','user:save','exports'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x1a4d,0x156));var _0xd1a4=function(_0x2608ba,_0x495fae){_0x2608ba=_0x2608ba-0x0;var _0x5dbf3f=_0x1a4d[_0x2608ba];return _0x5dbf3f;};'use strict';var _=require(_0xd1a4('0x0'));var moment=require(_0xd1a4('0x1'));var md5=require(_0xd1a4('0x2'));var Redis=require(_0xd1a4('0x3'));var config=require(_0xd1a4('0x4'));config[_0xd1a4('0x5')]=_[_0xd1a4('0x6')](config[_0xd1a4('0x5')],{'host':_0xd1a4('0x7'),'port':0x18eb});var io=require(_0xd1a4('0x8'))(new Redis(config[_0xd1a4('0x5')]));function Agent(_0x48ffc4){this['id']=_0x48ffc4['id']||0x0;this['name']=_0x48ffc4[_0xd1a4('0x9')]||'';this['online']=_0x48ffc4[_0xd1a4('0xa')]||!![];this['voicePause']=_0x48ffc4[_0xd1a4('0xb')]||![];this[_0xd1a4('0xc')]=_0x48ffc4[_0xd1a4('0xc')]||![];this[_0xd1a4('0xd')]=_0x48ffc4[_0xd1a4('0xd')]||![];this[_0xd1a4('0xe')]=_0x48ffc4['faxPause']||![];this[_0xd1a4('0xf')]=_0x48ffc4['smsPause']||![];this[_0xd1a4('0x10')]=_0x48ffc4[_0xd1a4('0x10')]||![];this[_0xd1a4('0x11')]=_0xd1a4('0x12');this[_0xd1a4('0x13')]=0x0;this[_0xd1a4('0x14')]=_0x48ffc4[_0xd1a4('0x14')]||0x0;this[_0xd1a4('0x15')]=0x0;this[_0xd1a4('0x16')]=_0xd1a4('0x12');this['mailStatusTime']=0x0;this[_0xd1a4('0x17')]=_0x48ffc4[_0xd1a4('0x17')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']='unknown';this[_0xd1a4('0x18')]=0x0;this[_0xd1a4('0x19')]=_0x48ffc4[_0xd1a4('0x19')]||0x0;this[_0xd1a4('0x1a')]=0x0;this['smsStatus']='unknown';this[_0xd1a4('0x1b')]=0x0;this[_0xd1a4('0x1c')]=_0x48ffc4[_0xd1a4('0x1c')]||0x0;this['smsCurrentCapacity']=0x0;this[_0xd1a4('0x1d')]=_0xd1a4('0x12');this[_0xd1a4('0x1e')]=0x0;this[_0xd1a4('0x1f')]=_0x48ffc4[_0xd1a4('0x1f')]||0x0;this[_0xd1a4('0x20')]=0x0;this[_0xd1a4('0x21')]=![];this['busyQueue']=undefined;this[_0xd1a4('0x2')]='';this['updateRealtime']();}Agent['prototype'][_0xd1a4('0x22')]=function(_0xe05c15){if(this[_0xe05c15+_0xd1a4('0x23')]>0x0){if(this[_0xe05c15+_0xd1a4('0x24')]>0x0&&this[_0xe05c15+_0xd1a4('0x23')]>=this[_0xe05c15+_0xd1a4('0x24')]){return'maxcapacity';}else{return _0xd1a4('0x25');}}else{return _0xd1a4('0x26');}};Agent[_0xd1a4('0x27')][_0xd1a4('0x28')]=function(){var _0xa4b297=['mail',_0xd1a4('0x29'),_0xd1a4('0x2a'),_0xd1a4('0x2b'),_0xd1a4('0x2c')];for(var _0x330cb9=0x0;_0x330cb9<_0xa4b297[_0xd1a4('0x2d')];_0x330cb9+=0x1){var _0x5bae88=this[_0xd1a4('0x22')](_0xa4b297[_0x330cb9]);if(this[_0xa4b297[_0x330cb9]+_0xd1a4('0x2e')]!==_0x5bae88){this[_0xa4b297[_0x330cb9]+_0xd1a4('0x2f')]=_[_0xd1a4('0x30')](moment()['format']('x'));}this[_0xa4b297[_0x330cb9]+_0xd1a4('0x2e')]=_0x5bae88;}var _0x5a6716={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0xd1a4('0xc')],'mailPause':this[_0xd1a4('0xd')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0xd1a4('0x10')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xd1a4('0x13')],'chatCapacity':this[_0xd1a4('0x14')],'chatCurrentCapacity':this[_0xd1a4('0x15')],'mailStatus':this[_0xd1a4('0x16')],'mailStatusTime':this[_0xd1a4('0x31')],'mailCapacity':this[_0xd1a4('0x17')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xd1a4('0x32')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xd1a4('0x1a')],'smsStatus':this[_0xd1a4('0x33')],'smsStatusTime':this[_0xd1a4('0x1b')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xd1a4('0x34')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xd1a4('0x21')],'busyQueue':this[_0xd1a4('0x35')]};var _0x38a175=md5(JSON['stringify'](_0x5a6716));if(this[_0xd1a4('0x2')]!==_0x38a175){this['md5']=_0x38a175;io[_0xd1a4('0x36')](_0xd1a4('0x37'),_0x5a6716);}};module[_0xd1a4('0x38')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 6f540a0..e4cf139 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 _0xe35d=['ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','loggedIn','paused','length','online','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5'];(function(_0x4ffa03,_0x363a82){var _0x30d661=function(_0x36ba86){while(--_0x36ba86){_0x4ffa03['push'](_0x4ffa03['shift']());}};_0x30d661(++_0x363a82);}(_0xe35d,0x13d));var _0xde35=function(_0xbb5122,_0x4e11c9){_0xbb5122=_0xbb5122-0x0;var _0x55c6dc=_0xe35d[_0xbb5122];return _0x55c6dc;};'use strict';var _=require(_0xde35('0x0'));var md5=require(_0xde35('0x1'));var util=require('util');var Redis=require(_0xde35('0x2'));var config=require(_0xde35('0x3'));config[_0xde35('0x4')]=_[_0xde35('0x5')](config[_0xde35('0x4')],{'host':_0xde35('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x5abb69){this['id']=_0x5abb69['id']||0x0;this[_0xde35('0x7')]=_0x5abb69['name']||'';this[_0xde35('0x8')]=_0x5abb69[_0xde35('0x8')]||0xa;this[_0xde35('0x9')]=_0x5abb69[_0xde35('0x9')]||_0xde35('0xa');this[_0xde35('0xb')]=_0x5abb69[_0xde35('0xb')];this[_0xde35('0xc')]={};this[_0xde35('0xd')]=0x0;this[_0xde35('0x1')]='';this[_0xde35('0xe')]();this[_0xde35('0xf')]();}ChatQueue['prototype'][_0xde35('0xe')]=function(){var _0x156ac3=this['mapAgentsId'][_0xde35('0x10')];this['mapAgentsId']=_[_0xde35('0x11')](this[_0xde35('0xb')],'id');this[_0xde35('0xc')][_0xde35('0x10')]=_0x156ac3;};ChatQueue['prototype'][_0xde35('0xf')]=function(){this[_0xde35('0x12')]=0x0;this[_0xde35('0x13')]=0x0;for(var _0x3a8187=0x0;_0x3a8187=0x0?this['available']:0x0;var _0xfc35ae={'id':this['id'],'available':this[_0xde35('0x16')],'loggedIn':this[_0xde35('0x12')],'name':this[_0xde35('0x7')],'paused':this[_0xde35('0x13')],'waiting':this[_0xde35('0xd')]};var _0x261905=md5(JSON[_0xde35('0x17')](_0xfc35ae));if(this[_0xde35('0x1')]!==_0x261905){this[_0xde35('0x1')]=_0x261905;io['to'](util[_0xde35('0x18')](_0xde35('0x19'),_0xfc35ae[_0xde35('0x7')]))[_0xde35('0x1a')](_0xde35('0x1b'),_0xfc35ae);}};module[_0xde35('0x1c')]=ChatQueue; \ No newline at end of file +var _0xa123=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','chatPause','available','stringify','format','chat:queue:%s','chat_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x3cb790,_0x54c61e){var _0x14a458=function(_0x4b9df3){while(--_0x4b9df3){_0x3cb790['push'](_0x3cb790['shift']());}};_0x14a458(++_0x54c61e);}(_0xa123,0x12f));var _0x3a12=function(_0x41f937,_0x1fd97e){_0x41f937=_0x41f937-0x0;var _0x543198=_0xa123[_0x41f937];return _0x543198;};'use strict';var _=require('lodash');var md5=require(_0x3a12('0x0'));var util=require(_0x3a12('0x1'));var Redis=require(_0x3a12('0x2'));var config=require(_0x3a12('0x3'));config[_0x3a12('0x4')]=_[_0x3a12('0x5')](config[_0x3a12('0x4')],{'host':_0x3a12('0x6'),'port':0x18eb});var io=require(_0x3a12('0x7'))(new Redis(config['redis']));function ChatQueue(_0x23cfa9){this['id']=_0x23cfa9['id']||0x0;this[_0x3a12('0x8')]=_0x23cfa9[_0x3a12('0x8')]||'';this[_0x3a12('0x9')]=_0x23cfa9['timeout']||0xa;this[_0x3a12('0xa')]=_0x23cfa9['strategy']||_0x3a12('0xb');this['Agents']=_0x23cfa9[_0x3a12('0xc')];this[_0x3a12('0xd')]={};this[_0x3a12('0xe')]=0x0;this[_0x3a12('0x0')]='';this[_0x3a12('0xf')]();this[_0x3a12('0x10')]();}ChatQueue[_0x3a12('0x11')][_0x3a12('0xf')]=function(){var _0x53536a=this[_0x3a12('0xd')][_0x3a12('0x12')];this[_0x3a12('0xd')]=_[_0x3a12('0x13')](this[_0x3a12('0xc')],'id');this[_0x3a12('0xd')][_0x3a12('0x12')]=_0x53536a;};ChatQueue[_0x3a12('0x11')][_0x3a12('0x10')]=function(){this[_0x3a12('0x14')]=0x0;this[_0x3a12('0x15')]=0x0;for(var _0xcdf9e1=0x0;_0xcdf9e1=0x0?this['available']:0x0;var _0x55c71b={'id':this['id'],'available':this[_0x3a12('0x19')],'loggedIn':this[_0x3a12('0x14')],'name':this[_0x3a12('0x8')],'paused':this[_0x3a12('0x15')],'waiting':this['waiting']};var _0x4cc069=md5(JSON[_0x3a12('0x1a')](_0x55c71b));if(this[_0x3a12('0x0')]!==_0x4cc069){this['md5']=_0x4cc069;io['to'](util[_0x3a12('0x1b')](_0x3a12('0x1c'),_0x55c71b['name']))['emit'](_0x3a12('0x1d'),_0x55c71b);}};module[_0x3a12('0x1e')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index fdbe16e..ef1b406 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 _0x543f=['updateRealtime','loggedIn','paused','length','online','faxPause','available','format','fax:queue:%s','fax_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','_rr','map'];(function(_0x52fe53,_0xf3b659){var _0x23352b=function(_0x474029){while(--_0x474029){_0x52fe53['push'](_0x52fe53['shift']());}};_0x23352b(++_0xf3b659);}(_0x543f,0xeb));var _0xf543=function(_0x18dece,_0x10834d){_0x18dece=_0x18dece-0x0;var _0x1c3245=_0x543f[_0x18dece];return _0x1c3245;};'use strict';var _=require(_0xf543('0x0'));var md5=require(_0xf543('0x1'));var util=require(_0xf543('0x2'));var Redis=require('ioredis');var config=require(_0xf543('0x3'));config[_0xf543('0x4')]=_[_0xf543('0x5')](config[_0xf543('0x4')],{'host':_0xf543('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x31730e){this['id']=_0x31730e['id']||0x0;this[_0xf543('0x7')]=_0x31730e[_0xf543('0x7')]||'';this['timeout']=_0x31730e[_0xf543('0x8')]||0xa;this[_0xf543('0x9')]=_0x31730e[_0xf543('0x9')]||_0xf543('0xa');this[_0xf543('0xb')]=_0x31730e[_0xf543('0xb')];this[_0xf543('0xc')]={};this[_0xf543('0xd')]=0x0;this[_0xf543('0x1')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0xf543('0xe')]['updateRouting']=function(){var _0xd26c8f=this[_0xf543('0xc')][_0xf543('0xf')];this[_0xf543('0xc')]=_[_0xf543('0x10')](this[_0xf543('0xb')],'id');this[_0xf543('0xc')][_0xf543('0xf')]=_0xd26c8f;};FaxQueue[_0xf543('0xe')][_0xf543('0x11')]=function(){this[_0xf543('0x12')]=0x0;this[_0xf543('0x13')]=0x0;for(var _0x5ce267=0x0;_0x5ce267=0x0?this[_0xf543('0x17')]:0x0;var _0x3cdd1f={'id':this['id'],'available':this['available'],'loggedIn':this[_0xf543('0x12')],'name':this[_0xf543('0x7')],'paused':this[_0xf543('0x13')],'waiting':this[_0xf543('0xd')]};var _0x186661=md5(JSON['stringify'](_0x3cdd1f));if(this[_0xf543('0x1')]!==_0x186661){this[_0xf543('0x1')]=_0x186661;io['to'](util[_0xf543('0x18')](_0xf543('0x19'),_0x3cdd1f[_0xf543('0x7')]))['emit'](_0xf543('0x1a'),_0x3cdd1f);}};module[_0xf543('0x1b')]=FaxQueue; \ No newline at end of file +var _0xfc69=['updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','faxPause','available','stringify','emit','fax_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xfc69,0x7e));var _0x9fc6=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xfc69[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0x9fc6('0x0'));var md5=require(_0x9fc6('0x1'));var util=require(_0x9fc6('0x2'));var Redis=require(_0x9fc6('0x3'));var config=require(_0x9fc6('0x4'));config[_0x9fc6('0x5')]=_[_0x9fc6('0x6')](config[_0x9fc6('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9fc6('0x7'))(new Redis(config[_0x9fc6('0x5')]));function FaxQueue(_0x56fb03){this['id']=_0x56fb03['id']||0x0;this[_0x9fc6('0x8')]=_0x56fb03[_0x9fc6('0x8')]||'';this[_0x9fc6('0x9')]=_0x56fb03[_0x9fc6('0x9')]||0xa;this[_0x9fc6('0xa')]=_0x56fb03['strategy']||_0x9fc6('0xb');this[_0x9fc6('0xc')]=_0x56fb03[_0x9fc6('0xc')];this[_0x9fc6('0xd')]={};this['waiting']=0x0;this[_0x9fc6('0x1')]='';this[_0x9fc6('0xe')]();this[_0x9fc6('0xf')]();}FaxQueue[_0x9fc6('0x10')][_0x9fc6('0xe')]=function(){var _0x256c96=this[_0x9fc6('0xd')][_0x9fc6('0x11')];this[_0x9fc6('0xd')]=_[_0x9fc6('0x12')](this[_0x9fc6('0xc')],'id');this[_0x9fc6('0xd')][_0x9fc6('0x11')]=_0x256c96;};FaxQueue['prototype'][_0x9fc6('0xf')]=function(){this[_0x9fc6('0x13')]=0x0;this[_0x9fc6('0x14')]=0x0;for(var _0x2b9f2d=0x0;_0x2b9f2d=0x0?this['available']:0x0;var _0x75940b={'id':this['id'],'available':this[_0x9fc6('0x18')],'loggedIn':this[_0x9fc6('0x13')],'name':this[_0x9fc6('0x8')],'paused':this[_0x9fc6('0x14')],'waiting':this['waiting']};var _0x28d7b4=md5(JSON[_0x9fc6('0x19')](_0x75940b));if(this['md5']!==_0x28d7b4){this['md5']=_0x28d7b4;io['to'](util['format']('fax:queue:%s',_0x75940b[_0x9fc6('0x8')]))[_0x9fc6('0x1a')](_0x9fc6('0x1b'),_0x75940b);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 2ef588d..cac1712 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 _0x816f=['Intervals','name'];(function(_0x2b2c71,_0x251a5d){var _0x459569=function(_0x437733){while(--_0x437733){_0x2b2c71['push'](_0x2b2c71['shift']());}};_0x459569(++_0x251a5d);}(_0x816f,0x8b));var _0xf816=function(_0x218722,_0x358e9a){_0x218722=_0x218722-0x0;var _0x4ffcc7=_0x816f[_0x218722];return _0x4ffcc7;};'use strict';function Interval(_0x19db6b){this['id']=_0x19db6b['id']||0x0;this[_0xf816('0x0')]=_0x19db6b[_0xf816('0x0')]||'';this[_0xf816('0x1')]=_0x19db6b['Intervals']||{};}module['exports']=Interval; \ No newline at end of file +var _0xd1af=['name','Intervals','exports'];(function(_0x36dca0,_0x598b6b){var _0x205f36=function(_0x25e6b6){while(--_0x25e6b6){_0x36dca0['push'](_0x36dca0['shift']());}};_0x205f36(++_0x598b6b);}(_0xd1af,0xae));var _0xfd1a=function(_0x57cda2,_0x24da77){_0x57cda2=_0x57cda2-0x0;var _0x5a1749=_0xd1af[_0x57cda2];return _0x5a1749;};'use strict';function Interval(_0x30e516){this['id']=_0x30e516['id']||0x0;this[_0xfd1a('0x0')]=_0x30e516[_0xfd1a('0x0')]||'';this[_0xfd1a('0x1')]=_0x30e516[_0xfd1a('0x1')]||{};}module[_0xfd1a('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 12caaf3..9fb63e9 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 _0x8458=['mail_queue:save','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','online','available','waiting','stringify','format','emit'];(function(_0x35c97a,_0x513aba){var _0x388917=function(_0xa1f4e1){while(--_0xa1f4e1){_0x35c97a['push'](_0x35c97a['shift']());}};_0x388917(++_0x513aba);}(_0x8458,0x1a5));var _0x8845=function(_0x3129ca,_0x1f64b6){_0x3129ca=_0x3129ca-0x0;var _0x16ffe9=_0x8458[_0x3129ca];return _0x16ffe9;};'use strict';var _=require(_0x8845('0x0'));var md5=require('md5');var util=require(_0x8845('0x1'));var Redis=require(_0x8845('0x2'));var config=require(_0x8845('0x3'));config[_0x8845('0x4')]=_[_0x8845('0x5')](config['redis'],{'host':_0x8845('0x6'),'port':0x18eb});var io=require(_0x8845('0x7'))(new Redis(config[_0x8845('0x4')]));function MailQueue(_0x2201e4){this['id']=_0x2201e4['id']||0x0;this[_0x8845('0x8')]=_0x2201e4['name']||'';this[_0x8845('0x9')]=_0x2201e4['timeout']||0xa;this[_0x8845('0xa')]=_0x2201e4[_0x8845('0xa')]||_0x8845('0xb');this['Agents']=_0x2201e4[_0x8845('0xc')];this[_0x8845('0xd')]={};this['waiting']=0x0;this[_0x8845('0xe')]='';this[_0x8845('0xf')]();this['updateRealtime']();}MailQueue[_0x8845('0x10')][_0x8845('0xf')]=function(){var _0x1cac23=this[_0x8845('0xd')][_0x8845('0x11')];this[_0x8845('0xd')]=_[_0x8845('0x12')](this[_0x8845('0xc')],'id');this[_0x8845('0xd')][_0x8845('0x11')]=_0x1cac23;};MailQueue[_0x8845('0x10')][_0x8845('0x13')]=function(){this[_0x8845('0x14')]=0x0;this[_0x8845('0x15')]=0x0;for(var _0x4a3a96=0x0;_0x4a3a96=0x0?this[_0x8845('0x18')]:0x0;var _0x27761f={'id':this['id'],'available':this[_0x8845('0x18')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0x8845('0x19')]};var _0x13cc8f=md5(JSON[_0x8845('0x1a')](_0x27761f));if(this[_0x8845('0xe')]!==_0x13cc8f){this['md5']=_0x13cc8f;io['to'](util[_0x8845('0x1b')]('mail:queue:%s',_0x27761f['name']))[_0x8845('0x1c')](_0x8845('0x1d'),_0x27761f);}};module['exports']=MailQueue; \ No newline at end of file +var _0x9bb8=['map','prototype','length','online','loggedIn','mailPause','paused','available','waiting','stringify','format','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','updateRouting','_rr'];(function(_0x4b6687,_0x3e2ae0){var _0x3a5a56=function(_0x426a98){while(--_0x426a98){_0x4b6687['push'](_0x4b6687['shift']());}};_0x3a5a56(++_0x3e2ae0);}(_0x9bb8,0x1ae));var _0x89bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9bb8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x89bb('0x0'));var md5=require(_0x89bb('0x1'));var util=require(_0x89bb('0x2'));var Redis=require(_0x89bb('0x3'));var config=require(_0x89bb('0x4'));config[_0x89bb('0x5')]=_[_0x89bb('0x6')](config[_0x89bb('0x5')],{'host':_0x89bb('0x7'),'port':0x18eb});var io=require(_0x89bb('0x8'))(new Redis(config[_0x89bb('0x5')]));function MailQueue(_0x46884f){this['id']=_0x46884f['id']||0x0;this['name']=_0x46884f[_0x89bb('0x9')]||'';this[_0x89bb('0xa')]=_0x46884f[_0x89bb('0xa')]||0xa;this[_0x89bb('0xb')]=_0x46884f[_0x89bb('0xb')]||_0x89bb('0xc');this['Agents']=_0x46884f[_0x89bb('0xd')];this[_0x89bb('0xe')]={};this['waiting']=0x0;this[_0x89bb('0x1')]='';this['updateRouting']();this[_0x89bb('0xf')]();}MailQueue['prototype'][_0x89bb('0x10')]=function(){var _0x48daec=this[_0x89bb('0xe')][_0x89bb('0x11')];this[_0x89bb('0xe')]=_[_0x89bb('0x12')](this['Agents'],'id');this[_0x89bb('0xe')][_0x89bb('0x11')]=_0x48daec;};MailQueue[_0x89bb('0x13')][_0x89bb('0xf')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0xa4b4ff=0x0;_0xa4b4ff=0x0?this[_0x89bb('0x19')]:0x0;var _0x58f826={'id':this['id'],'available':this[_0x89bb('0x19')],'loggedIn':this[_0x89bb('0x16')],'name':this[_0x89bb('0x9')],'paused':this[_0x89bb('0x18')],'waiting':this[_0x89bb('0x1a')]};var _0x340822=md5(JSON[_0x89bb('0x1b')](_0x58f826));if(this[_0x89bb('0x1')]!==_0x340822){this[_0x89bb('0x1')]=_0x340822;io['to'](util[_0x89bb('0x1c')]('mail:queue:%s',_0x58f826[_0x89bb('0x9')]))[_0x89bb('0x1d')](_0x89bb('0x1e'),_0x58f826);}};module[_0x89bb('0x1f')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 41140ef..7db2ab6 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 _0x4718=['../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','openchannelPause','available','format','openchannel:queue:%s','openchannel_queue:save','exports','md5','ioredis'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x4718,0x1e4));var _0x8471=function(_0x202d24,_0x5e8641){_0x202d24=_0x202d24-0x0;var _0x2b3a8e=_0x4718[_0x202d24];return _0x2b3a8e;};'use strict';var _=require('lodash');var md5=require(_0x8471('0x0'));var util=require('util');var Redis=require(_0x8471('0x1'));var config=require(_0x8471('0x2'));config[_0x8471('0x3')]=_[_0x8471('0x4')](config[_0x8471('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x8471('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x26df03){this['id']=_0x26df03['id']||0x0;this[_0x8471('0x6')]=_0x26df03[_0x8471('0x6')]||'';this[_0x8471('0x7')]=_0x26df03[_0x8471('0x7')]||0xa;this[_0x8471('0x8')]=_0x26df03[_0x8471('0x8')]||_0x8471('0x9');this[_0x8471('0xa')]=_0x26df03[_0x8471('0xa')];this[_0x8471('0xb')]={};this[_0x8471('0xc')]=0x0;this[_0x8471('0x0')]='';this['updateRouting']();this[_0x8471('0xd')]();}OpenchannelQueue[_0x8471('0xe')]['updateRouting']=function(){var _0x23e1af=this[_0x8471('0xb')][_0x8471('0xf')];this[_0x8471('0xb')]=_[_0x8471('0x10')](this['Agents'],'id');this[_0x8471('0xb')][_0x8471('0xf')]=_0x23e1af;};OpenchannelQueue[_0x8471('0xe')][_0x8471('0xd')]=function(){this[_0x8471('0x11')]=0x0;this[_0x8471('0x12')]=0x0;for(var _0x24c212=0x0;_0x24c212=0x0?this['available']:0x0;var _0xcfc2ee={'id':this['id'],'available':this[_0x8471('0x16')],'loggedIn':this[_0x8471('0x11')],'name':this[_0x8471('0x6')],'paused':this[_0x8471('0x12')],'waiting':this[_0x8471('0xc')]};var _0x1a05d7=md5(JSON['stringify'](_0xcfc2ee));if(this[_0x8471('0x0')]!==_0x1a05d7){this[_0x8471('0x0')]=_0x1a05d7;io['to'](util[_0x8471('0x17')](_0x8471('0x18'),_0xcfc2ee[_0x8471('0x6')]))['emit'](_0x8471('0x19'),_0xcfc2ee);}};module[_0x8471('0x1a')]=OpenchannelQueue; \ No newline at end of file +var _0xc1a7=['lodash','md5','util','ioredis','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','loggedIn','paused','length','online','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','exports'];(function(_0x43c226,_0x573d65){var _0x7ebf43=function(_0x49f0b0){while(--_0x49f0b0){_0x43c226['push'](_0x43c226['shift']());}};_0x7ebf43(++_0x573d65);}(_0xc1a7,0xe0));var _0x7c1a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc1a7[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x7c1a('0x0'));var md5=require(_0x7c1a('0x1'));var util=require(_0x7c1a('0x2'));var Redis=require(_0x7c1a('0x3'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x7c1a('0x4')],{'host':_0x7c1a('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function OpenchannelQueue(_0x38b287){this['id']=_0x38b287['id']||0x0;this['name']=_0x38b287[_0x7c1a('0x6')]||'';this[_0x7c1a('0x7')]=_0x38b287[_0x7c1a('0x7')]||0xa;this[_0x7c1a('0x8')]=_0x38b287['strategy']||_0x7c1a('0x9');this[_0x7c1a('0xa')]=_0x38b287[_0x7c1a('0xa')];this[_0x7c1a('0xb')]={};this[_0x7c1a('0xc')]=0x0;this[_0x7c1a('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x7c1a('0xd')][_0x7c1a('0xe')]=function(){var _0x55a726=this[_0x7c1a('0xb')][_0x7c1a('0xf')];this[_0x7c1a('0xb')]=_['map'](this[_0x7c1a('0xa')],'id');this['mapAgentsId'][_0x7c1a('0xf')]=_0x55a726;};OpenchannelQueue[_0x7c1a('0xd')]['updateRealtime']=function(){this[_0x7c1a('0x10')]=0x0;this[_0x7c1a('0x11')]=0x0;for(var _0x518dc1=0x0;_0x518dc1=0x0?this['available']:0x0;var _0x205aa5={'id':this['id'],'available':this[_0x7c1a('0x15')],'loggedIn':this[_0x7c1a('0x10')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x7c1a('0xc')]};var _0x42077d=md5(JSON[_0x7c1a('0x16')](_0x205aa5));if(this[_0x7c1a('0x1')]!==_0x42077d){this[_0x7c1a('0x1')]=_0x42077d;io['to'](util[_0x7c1a('0x17')](_0x7c1a('0x18'),_0x205aa5[_0x7c1a('0x6')]))[_0x7c1a('0x19')](_0x7c1a('0x1a'),_0x205aa5);}};module[_0x7c1a('0x1b')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 4c60c5a..02a544f 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 _0xcc56=['sms_queue:save','exports','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','online','smsPause','available','stringify','format','sms:queue:%s'];(function(_0x58fcff,_0x56a330){var _0x41eff3=function(_0x52e0ac){while(--_0x52e0ac){_0x58fcff['push'](_0x58fcff['shift']());}};_0x41eff3(++_0x56a330);}(_0xcc56,0x76));var _0x6cc5=function(_0x326c48,_0x31eee6){_0x326c48=_0x326c48-0x0;var _0xf71bc5=_0xcc56[_0x326c48];return _0xf71bc5;};'use strict';var _=require('lodash');var md5=require(_0x6cc5('0x0'));var util=require('util');var Redis=require(_0x6cc5('0x1'));var config=require(_0x6cc5('0x2'));config['redis']=_[_0x6cc5('0x3')](config[_0x6cc5('0x4')],{'host':_0x6cc5('0x5'),'port':0x18eb});var io=require(_0x6cc5('0x6'))(new Redis(config[_0x6cc5('0x4')]));function SmsQueue(_0x5ddf09){this['id']=_0x5ddf09['id']||0x0;this[_0x6cc5('0x7')]=_0x5ddf09[_0x6cc5('0x7')]||'';this['timeout']=_0x5ddf09[_0x6cc5('0x8')]||0xa;this[_0x6cc5('0x9')]=_0x5ddf09[_0x6cc5('0x9')]||'beepall';this[_0x6cc5('0xa')]=_0x5ddf09[_0x6cc5('0xa')];this[_0x6cc5('0xb')]={};this[_0x6cc5('0xc')]=0x0;this[_0x6cc5('0x0')]='';this['updateRouting']();this[_0x6cc5('0xd')]();}SmsQueue[_0x6cc5('0xe')][_0x6cc5('0xf')]=function(){var _0x5dec7a=this[_0x6cc5('0xb')][_0x6cc5('0x10')];this[_0x6cc5('0xb')]=_[_0x6cc5('0x11')](this['Agents'],'id');this[_0x6cc5('0xb')][_0x6cc5('0x10')]=_0x5dec7a;};SmsQueue['prototype'][_0x6cc5('0xd')]=function(){this[_0x6cc5('0x12')]=0x0;this[_0x6cc5('0x13')]=0x0;for(var _0x927c06=0x0;_0x927c06=0x0?this[_0x6cc5('0x17')]:0x0;var _0x2543b2={'id':this['id'],'available':this[_0x6cc5('0x17')],'loggedIn':this[_0x6cc5('0x12')],'name':this['name'],'paused':this[_0x6cc5('0x13')],'waiting':this[_0x6cc5('0xc')]};var _0x2ff9da=md5(JSON[_0x6cc5('0x18')](_0x2543b2));if(this['md5']!==_0x2ff9da){this[_0x6cc5('0x0')]=_0x2ff9da;io['to'](util[_0x6cc5('0x19')](_0x6cc5('0x1a'),_0x2543b2[_0x6cc5('0x7')]))['emit'](_0x6cc5('0x1b'),_0x2543b2);}};module[_0x6cc5('0x1c')]=SmsQueue; \ No newline at end of file +var _0x8c0b=['loggedIn','length','online','smsPause','paused','available','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','map','updateRealtime'];(function(_0x987202,_0x5401a1){var _0x36bda9=function(_0x33a6d0){while(--_0x33a6d0){_0x987202['push'](_0x987202['shift']());}};_0x36bda9(++_0x5401a1);}(_0x8c0b,0x167));var _0xb8c0=function(_0x2b43c1,_0x32a182){_0x2b43c1=_0x2b43c1-0x0;var _0x323054=_0x8c0b[_0x2b43c1];return _0x323054;};'use strict';var _=require(_0xb8c0('0x0'));var md5=require(_0xb8c0('0x1'));var util=require('util');var Redis=require(_0xb8c0('0x2'));var config=require('../../../config/environment');config[_0xb8c0('0x3')]=_[_0xb8c0('0x4')](config['redis'],{'host':_0xb8c0('0x5'),'port':0x18eb});var io=require(_0xb8c0('0x6'))(new Redis(config[_0xb8c0('0x3')]));function SmsQueue(_0x5d8d67){this['id']=_0x5d8d67['id']||0x0;this[_0xb8c0('0x7')]=_0x5d8d67['name']||'';this[_0xb8c0('0x8')]=_0x5d8d67[_0xb8c0('0x8')]||0xa;this['strategy']=_0x5d8d67['strategy']||_0xb8c0('0x9');this['Agents']=_0x5d8d67[_0xb8c0('0xa')];this[_0xb8c0('0xb')]={};this[_0xb8c0('0xc')]=0x0;this[_0xb8c0('0x1')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0xb8c0('0xd')][_0xb8c0('0xe')]=function(){var _0x2dc41e=this[_0xb8c0('0xb')][_0xb8c0('0xf')];this[_0xb8c0('0xb')]=_[_0xb8c0('0x10')](this[_0xb8c0('0xa')],'id');this['mapAgentsId']['_rr']=_0x2dc41e;};SmsQueue[_0xb8c0('0xd')][_0xb8c0('0x11')]=function(){this[_0xb8c0('0x12')]=0x0;this['paused']=0x0;for(var _0x38332a=0x0;_0x38332a=0x0?this['available']:0x0;var _0x3cd5f0={'id':this['id'],'available':this[_0xb8c0('0x17')],'loggedIn':this[_0xb8c0('0x12')],'name':this[_0xb8c0('0x7')],'paused':this[_0xb8c0('0x16')],'waiting':this['waiting']};var _0x470c07=md5(JSON['stringify'](_0x3cd5f0));if(this[_0xb8c0('0x1')]!==_0x470c07){this[_0xb8c0('0x1')]=_0x470c07;io['to'](util[_0xb8c0('0x18')](_0xb8c0('0x19'),_0x3cd5f0['name']))[_0xb8c0('0x1a')](_0xb8c0('0x1b'),_0x3cd5f0);}};module[_0xb8c0('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 5bc87ad..19b33f3 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 _0x93c2=['../model/mailQueue','../model/faxQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','initIntervals','isUndefined','initOpenchannelQueues','updateRouting','initChatQueues','updateRealtime','initSmsQueues','initMailQueues','mailQueues','initFaxQueues','exports','bluebird','util','lodash','moment','../model/interval','../model/smsQueue'];(function(_0x1a4884,_0x3ad42d){var _0x34bb2d=function(_0x31d728){while(--_0x31d728){_0x1a4884['push'](_0x1a4884['shift']());}};_0x34bb2d(++_0x3ad42d);}(_0x93c2,0xc6));var _0x293c=function(_0x4bf622,_0x30de87){_0x4bf622=_0x4bf622-0x0;var _0x4cd564=_0x93c2[_0x4bf622];return _0x4cd564;};'use strict';var BPromise=require(_0x293c('0x0'));var util=require(_0x293c('0x1'));var _=require(_0x293c('0x2'));var moment=require(_0x293c('0x3'));var Agent=require('../model/agent');var Interval=require(_0x293c('0x4'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require('../model/chatQueue');var SmsQueue=require(_0x293c('0x5'));var MailQueue=require(_0x293c('0x6'));var FaxQueue=require(_0x293c('0x7'));var Realtime=function(){this[_0x293c('0x8')]={};this[_0x293c('0x9')]={};this[_0x293c('0xa')]={};this[_0x293c('0xb')]={};this[_0x293c('0xc')]={};this['mailQueues']={};this[_0x293c('0xd')]={};this[_0x293c('0xe')]={};this[_0x293c('0xf')]={};this[_0x293c('0x10')]={};this[_0x293c('0x11')]={};this['faxQueuesWaitingInteractions']={};};function freeIsNotKey(_0x9f43b6,_0x55554a,_0x2d7d56){var _0x5b8b7c=_[_0x293c('0x12')](_0x9f43b6,function(_0x406ad8,_0x359158){return _0x406ad8[_0x2d7d56];});for(var _0x53237c in _0x55554a){if(_0x55554a['hasOwnProperty'](_0x53237c)){if(!_0x5b8b7c[_0x53237c]){delete _0x55554a[_0x53237c];}}}}Realtime[_0x293c('0x13')][_0x293c('0x14')]=function(_0x3d6d5a,_0xc01cf2){for(var _0x21e69d in _0xc01cf2){if(_0x3d6d5a['hasOwnProperty'](_0x21e69d)){_0x3d6d5a[_0x21e69d]=_0xc01cf2[_0x21e69d];}}};Realtime[_0x293c('0x13')][_0x293c('0x15')]=function(){var _0x5d1b2c=this;return function(_0x441b61){if(_0x441b61){freeIsNotKey(_0x441b61,_0x5d1b2c[_0x293c('0x8')],'id');for(var _0x554cbd=0x0,_0x10dea0={},_0x33c1e6={};_0x554cbd<_0x441b61[_0x293c('0x16')];_0x554cbd+=0x1){_0x10dea0=_0x441b61[_0x554cbd];if(_['isUndefined'](_0x5d1b2c[_0x293c('0x8')][_0x10dea0['id']])){_0x5d1b2c['agents'][_0x10dea0['id']]=new Agent(_0x10dea0);}else{_0x5d1b2c['mergeFromDatabase'](_0x5d1b2c[_0x293c('0x8')][_0x10dea0['id']],_0x10dea0);}}}return _0x5d1b2c[_0x293c('0x8')];};};Realtime[_0x293c('0x13')][_0x293c('0x17')]=function(){var _0x59a1b0=this;return function(_0x58e6b0){if(_0x58e6b0){freeIsNotKey(_0x58e6b0,_0x59a1b0['intervals'],'id');for(var _0x5efcea=0x0,_0x3bef78={},_0x2a7f2b={};_0x5efcea<_0x58e6b0[_0x293c('0x16')];_0x5efcea+=0x1){_0x3bef78=_0x58e6b0[_0x5efcea];if(_[_0x293c('0x18')](_0x59a1b0[_0x293c('0x9')][_0x3bef78['id']])){_0x59a1b0[_0x293c('0x9')][_0x3bef78['id']]=new Interval(_0x3bef78);}else{_0x59a1b0[_0x293c('0x14')](_0x59a1b0[_0x293c('0x9')][_0x3bef78['id']],_0x3bef78);}}}return _0x59a1b0[_0x293c('0x9')];};};Realtime[_0x293c('0x13')][_0x293c('0x19')]=function(){var _0x3dbcc0=this;return function(_0x1f14f1){if(_0x1f14f1){freeIsNotKey(_0x1f14f1,_0x3dbcc0['openchannelQueues'],'id');for(var _0xcaec5c=0x0,_0x4e0cdb={},_0x25b5e6={};_0xcaec5c<_0x1f14f1['length'];_0xcaec5c+=0x1){_0x4e0cdb=_0x1f14f1[_0xcaec5c];if(_['isUndefined'](_0x3dbcc0['openchannelQueues'][_0x4e0cdb['id']])){_0x3dbcc0[_0x293c('0xa')][_0x4e0cdb['id']]=new OpenchannelQueue(_0x4e0cdb);}else{_0x3dbcc0[_0x293c('0x14')](_0x3dbcc0[_0x293c('0xa')][_0x4e0cdb['id']],_0x4e0cdb);}_0x3dbcc0[_0x293c('0xa')][_0x4e0cdb['id']][_0x293c('0x1a')]();_0x3dbcc0[_0x293c('0xa')][_0x4e0cdb['id']]['updateRealtime']();}}return _0x3dbcc0[_0x293c('0xa')];};};Realtime[_0x293c('0x13')][_0x293c('0x1b')]=function(){var _0x41c4da=this;return function(_0x31cb46){if(_0x31cb46){freeIsNotKey(_0x31cb46,_0x41c4da[_0x293c('0xb')],'id');for(var _0x19cfd7=0x0,_0x203ec4={},_0x44bced={};_0x19cfd7<_0x31cb46[_0x293c('0x16')];_0x19cfd7+=0x1){_0x203ec4=_0x31cb46[_0x19cfd7];if(_['isUndefined'](_0x41c4da[_0x293c('0xb')][_0x203ec4['id']])){_0x41c4da[_0x293c('0xb')][_0x203ec4['id']]=new ChatQueue(_0x203ec4);}else{_0x41c4da['mergeFromDatabase'](_0x41c4da['chatQueues'][_0x203ec4['id']],_0x203ec4);}_0x41c4da[_0x293c('0xb')][_0x203ec4['id']][_0x293c('0x1a')]();_0x41c4da[_0x293c('0xb')][_0x203ec4['id']][_0x293c('0x1c')]();}}return _0x41c4da[_0x293c('0xb')];};};Realtime[_0x293c('0x13')][_0x293c('0x1d')]=function(){var _0x42c0a1=this;return function(_0x5552d5){if(_0x5552d5){freeIsNotKey(_0x5552d5,_0x42c0a1[_0x293c('0xc')],'id');for(var _0x159c56=0x0,_0x59c2c6={},_0x159939={};_0x159c56<_0x5552d5[_0x293c('0x16')];_0x159c56+=0x1){_0x59c2c6=_0x5552d5[_0x159c56];if(_[_0x293c('0x18')](_0x42c0a1[_0x293c('0xc')][_0x59c2c6['id']])){_0x42c0a1[_0x293c('0xc')][_0x59c2c6['id']]=new SmsQueue(_0x59c2c6);}else{_0x42c0a1[_0x293c('0x14')](_0x42c0a1[_0x293c('0xc')][_0x59c2c6['id']],_0x59c2c6);}_0x42c0a1[_0x293c('0xc')][_0x59c2c6['id']][_0x293c('0x1a')]();_0x42c0a1[_0x293c('0xc')][_0x59c2c6['id']][_0x293c('0x1c')]();}}return _0x42c0a1[_0x293c('0xc')];};};Realtime[_0x293c('0x13')][_0x293c('0x1e')]=function(){var _0xe3ff2f=this;return function(_0x59be5b){if(_0x59be5b){freeIsNotKey(_0x59be5b,_0xe3ff2f[_0x293c('0x1f')],'id');for(var _0x369d55=0x0,_0x2c62e9={},_0xc19ae8={};_0x369d55<_0x59be5b[_0x293c('0x16')];_0x369d55+=0x1){_0x2c62e9=_0x59be5b[_0x369d55];if(_[_0x293c('0x18')](_0xe3ff2f[_0x293c('0x1f')][_0x2c62e9['id']])){_0xe3ff2f[_0x293c('0x1f')][_0x2c62e9['id']]=new MailQueue(_0x2c62e9);}else{_0xe3ff2f[_0x293c('0x14')](_0xe3ff2f['mailQueues'][_0x2c62e9['id']],_0x2c62e9);}_0xe3ff2f['mailQueues'][_0x2c62e9['id']][_0x293c('0x1a')]();_0xe3ff2f['mailQueues'][_0x2c62e9['id']][_0x293c('0x1c')]();}}return _0xe3ff2f[_0x293c('0x1f')];};};Realtime[_0x293c('0x13')][_0x293c('0x20')]=function(){var _0x32d0fa=this;return function(_0x37b56d){if(_0x37b56d){freeIsNotKey(_0x37b56d,_0x32d0fa[_0x293c('0xd')],'id');for(var _0x2e05c4=0x0,_0x26a778={},_0x2a3e64={};_0x2e05c4<_0x37b56d[_0x293c('0x16')];_0x2e05c4+=0x1){_0x26a778=_0x37b56d[_0x2e05c4];if(_[_0x293c('0x18')](_0x32d0fa[_0x293c('0xd')][_0x26a778['id']])){_0x32d0fa[_0x293c('0xd')][_0x26a778['id']]=new FaxQueue(_0x26a778);}else{_0x32d0fa[_0x293c('0x14')](_0x32d0fa[_0x293c('0xd')][_0x26a778['id']],_0x26a778);}_0x32d0fa['faxQueues'][_0x26a778['id']]['updateRouting']();_0x32d0fa[_0x293c('0xd')][_0x26a778['id']]['updateRealtime']();}}return _0x32d0fa[_0x293c('0xd')];};};module[_0x293c('0x21')]=Realtime; \ No newline at end of file +var _0xc200=['initFaxQueues','exports','bluebird','util','moment','../model/agent','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','agents','chatQueues','mailQueues','faxQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','length','isUndefined','initIntervals','intervals','initOpenchannelQueues','openchannelQueues','initChatQueues','updateRouting','updateRealtime','initSmsQueues','smsQueues'];(function(_0x4382bc,_0x231a2d){var _0x13c82a=function(_0x3723b0){while(--_0x3723b0){_0x4382bc['push'](_0x4382bc['shift']());}};_0x13c82a(++_0x231a2d);}(_0xc200,0x16d));var _0x0c20=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xc200[_0x13b8f3];return _0x1a6d06;};'use strict';var BPromise=require(_0x0c20('0x0'));var util=require(_0x0c20('0x1'));var _=require('lodash');var moment=require(_0x0c20('0x2'));var Agent=require(_0x0c20('0x3'));var Interval=require(_0x0c20('0x4'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0c20('0x5'));var SmsQueue=require(_0x0c20('0x6'));var MailQueue=require(_0x0c20('0x7'));var FaxQueue=require(_0x0c20('0x8'));var Realtime=function(){this[_0x0c20('0x9')]={};this['intervals']={};this['openchannelQueues']={};this[_0x0c20('0xa')]={};this['smsQueues']={};this[_0x0c20('0xb')]={};this[_0x0c20('0xc')]={};this[_0x0c20('0xd')]={};this['mailQueuesWaitingInteractions']={};this[_0x0c20('0xe')]={};this[_0x0c20('0xf')]={};this[_0x0c20('0x10')]={};};function freeIsNotKey(_0xcfb9df,_0x9860bd,_0x4c0179){var _0x3069bc=_[_0x0c20('0x11')](_0xcfb9df,function(_0x273a79,_0x40f7b5){return _0x273a79[_0x4c0179];});for(var _0x84db3f in _0x9860bd){if(_0x9860bd['hasOwnProperty'](_0x84db3f)){if(!_0x3069bc[_0x84db3f]){delete _0x9860bd[_0x84db3f];}}}}Realtime[_0x0c20('0x12')][_0x0c20('0x13')]=function(_0x318bd2,_0x38dbf2){for(var _0x4e8402 in _0x38dbf2){if(_0x318bd2['hasOwnProperty'](_0x4e8402)){_0x318bd2[_0x4e8402]=_0x38dbf2[_0x4e8402];}}};Realtime[_0x0c20('0x12')]['initAgents']=function(){var _0xcd7ae9=this;return function(_0x579405){if(_0x579405){freeIsNotKey(_0x579405,_0xcd7ae9[_0x0c20('0x9')],'id');for(var _0x5821dd=0x0,_0x287ff8={},_0x17b278={};_0x5821dd<_0x579405[_0x0c20('0x14')];_0x5821dd+=0x1){_0x287ff8=_0x579405[_0x5821dd];if(_[_0x0c20('0x15')](_0xcd7ae9['agents'][_0x287ff8['id']])){_0xcd7ae9[_0x0c20('0x9')][_0x287ff8['id']]=new Agent(_0x287ff8);}else{_0xcd7ae9[_0x0c20('0x13')](_0xcd7ae9[_0x0c20('0x9')][_0x287ff8['id']],_0x287ff8);}}}return _0xcd7ae9[_0x0c20('0x9')];};};Realtime['prototype'][_0x0c20('0x16')]=function(){var _0x3983b2=this;return function(_0x111230){if(_0x111230){freeIsNotKey(_0x111230,_0x3983b2['intervals'],'id');for(var _0x89d54e=0x0,_0x492fea={},_0x2b7e3c={};_0x89d54e<_0x111230[_0x0c20('0x14')];_0x89d54e+=0x1){_0x492fea=_0x111230[_0x89d54e];if(_[_0x0c20('0x15')](_0x3983b2[_0x0c20('0x17')][_0x492fea['id']])){_0x3983b2[_0x0c20('0x17')][_0x492fea['id']]=new Interval(_0x492fea);}else{_0x3983b2[_0x0c20('0x13')](_0x3983b2[_0x0c20('0x17')][_0x492fea['id']],_0x492fea);}}}return _0x3983b2[_0x0c20('0x17')];};};Realtime[_0x0c20('0x12')][_0x0c20('0x18')]=function(){var _0xc513c9=this;return function(_0x1b1db4){if(_0x1b1db4){freeIsNotKey(_0x1b1db4,_0xc513c9[_0x0c20('0x19')],'id');for(var _0x2711a5=0x0,_0x456d1b={},_0x47edf5={};_0x2711a5<_0x1b1db4['length'];_0x2711a5+=0x1){_0x456d1b=_0x1b1db4[_0x2711a5];if(_['isUndefined'](_0xc513c9[_0x0c20('0x19')][_0x456d1b['id']])){_0xc513c9[_0x0c20('0x19')][_0x456d1b['id']]=new OpenchannelQueue(_0x456d1b);}else{_0xc513c9[_0x0c20('0x13')](_0xc513c9[_0x0c20('0x19')][_0x456d1b['id']],_0x456d1b);}_0xc513c9[_0x0c20('0x19')][_0x456d1b['id']]['updateRouting']();_0xc513c9[_0x0c20('0x19')][_0x456d1b['id']]['updateRealtime']();}}return _0xc513c9['openchannelQueues'];};};Realtime[_0x0c20('0x12')][_0x0c20('0x1a')]=function(){var _0x1bfc12=this;return function(_0x5b2018){if(_0x5b2018){freeIsNotKey(_0x5b2018,_0x1bfc12[_0x0c20('0xa')],'id');for(var _0x2c9d96=0x0,_0x158cdd={},_0x462450={};_0x2c9d96<_0x5b2018[_0x0c20('0x14')];_0x2c9d96+=0x1){_0x158cdd=_0x5b2018[_0x2c9d96];if(_[_0x0c20('0x15')](_0x1bfc12[_0x0c20('0xa')][_0x158cdd['id']])){_0x1bfc12[_0x0c20('0xa')][_0x158cdd['id']]=new ChatQueue(_0x158cdd);}else{_0x1bfc12[_0x0c20('0x13')](_0x1bfc12['chatQueues'][_0x158cdd['id']],_0x158cdd);}_0x1bfc12[_0x0c20('0xa')][_0x158cdd['id']][_0x0c20('0x1b')]();_0x1bfc12[_0x0c20('0xa')][_0x158cdd['id']][_0x0c20('0x1c')]();}}return _0x1bfc12[_0x0c20('0xa')];};};Realtime[_0x0c20('0x12')][_0x0c20('0x1d')]=function(){var _0x379ea3=this;return function(_0xd656e5){if(_0xd656e5){freeIsNotKey(_0xd656e5,_0x379ea3[_0x0c20('0x1e')],'id');for(var _0x3eedcc=0x0,_0x12917e={},_0x1dfc3d={};_0x3eedcc<_0xd656e5['length'];_0x3eedcc+=0x1){_0x12917e=_0xd656e5[_0x3eedcc];if(_[_0x0c20('0x15')](_0x379ea3[_0x0c20('0x1e')][_0x12917e['id']])){_0x379ea3['smsQueues'][_0x12917e['id']]=new SmsQueue(_0x12917e);}else{_0x379ea3[_0x0c20('0x13')](_0x379ea3[_0x0c20('0x1e')][_0x12917e['id']],_0x12917e);}_0x379ea3['smsQueues'][_0x12917e['id']]['updateRouting']();_0x379ea3[_0x0c20('0x1e')][_0x12917e['id']]['updateRealtime']();}}return _0x379ea3[_0x0c20('0x1e')];};};Realtime[_0x0c20('0x12')]['initMailQueues']=function(){var _0x1bb6c0=this;return function(_0xf1c424){if(_0xf1c424){freeIsNotKey(_0xf1c424,_0x1bb6c0[_0x0c20('0xb')],'id');for(var _0x3b00fd=0x0,_0x35be8c={},_0x1444a6={};_0x3b00fd<_0xf1c424[_0x0c20('0x14')];_0x3b00fd+=0x1){_0x35be8c=_0xf1c424[_0x3b00fd];if(_[_0x0c20('0x15')](_0x1bb6c0[_0x0c20('0xb')][_0x35be8c['id']])){_0x1bb6c0[_0x0c20('0xb')][_0x35be8c['id']]=new MailQueue(_0x35be8c);}else{_0x1bb6c0['mergeFromDatabase'](_0x1bb6c0[_0x0c20('0xb')][_0x35be8c['id']],_0x35be8c);}_0x1bb6c0['mailQueues'][_0x35be8c['id']][_0x0c20('0x1b')]();_0x1bb6c0[_0x0c20('0xb')][_0x35be8c['id']][_0x0c20('0x1c')]();}}return _0x1bb6c0[_0x0c20('0xb')];};};Realtime[_0x0c20('0x12')][_0x0c20('0x1f')]=function(){var _0xbe4251=this;return function(_0x39fada){if(_0x39fada){freeIsNotKey(_0x39fada,_0xbe4251[_0x0c20('0xc')],'id');for(var _0x40af8a=0x0,_0x2cefae={},_0x3ed394={};_0x40af8a<_0x39fada[_0x0c20('0x14')];_0x40af8a+=0x1){_0x2cefae=_0x39fada[_0x40af8a];if(_[_0x0c20('0x15')](_0xbe4251[_0x0c20('0xc')][_0x2cefae['id']])){_0xbe4251[_0x0c20('0xc')][_0x2cefae['id']]=new FaxQueue(_0x2cefae);}else{_0xbe4251['mergeFromDatabase'](_0xbe4251[_0x0c20('0xc')][_0x2cefae['id']],_0x2cefae);}_0xbe4251[_0x0c20('0xc')][_0x2cefae['id']][_0x0c20('0x1b')]();_0xbe4251[_0x0c20('0xc')][_0x2cefae['id']][_0x0c20('0x1c')]();}}return _0xbe4251[_0x0c20('0xc')];};};module[_0x0c20('0x20')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 4d9e518..dafe33d 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 _0x8c51=['Request','update','UpdateChatInteraction','addTags'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8c51,0xd5));var _0x18c5=function(_0xa6a60d,_0x5b5899){_0xa6a60d=_0xa6a60d-0x0;var _0x660ea2=_0x8c51[_0xa6a60d];return _0x660ea2;};'use strict';var client=require('../client');exports[_0x18c5('0x0')]=function(_0xabc97e,_0x3820b7){return client['Request'](_0x18c5('0x1'),{'body':_0x3820b7,'options':{'where':{'id':_0xabc97e}},'log':'updateChatInteraction'});};exports[_0x18c5('0x2')]=function(_0x45fc6d,_0x462c56){return client[_0x18c5('0x3')]('AddTagsToChatInteraction',{'body':_0x462c56,'options':{'where':{'id':_0x45fc6d}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x4802=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','UpdateChatInteraction','updateChatInteraction','addTags','Request'];(function(_0x1ccc19,_0x2a5e47){var _0x393065=function(_0x1ffa38){while(--_0x1ffa38){_0x1ccc19['push'](_0x1ccc19['shift']());}};_0x393065(++_0x2a5e47);}(_0x4802,0x19a));var _0x2480=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x4802[_0x23e7c1];return _0x1add43;};'use strict';var client=require(_0x2480('0x0'));exports[_0x2480('0x1')]=function(_0xb89c08,_0xbdf64b){return client['Request'](_0x2480('0x2'),{'body':_0xbdf64b,'options':{'where':{'id':_0xb89c08}},'log':_0x2480('0x3')});};exports[_0x2480('0x4')]=function(_0x15e259,_0x2eec67){return client[_0x2480('0x5')](_0x2480('0x6'),{'body':_0x2eec67,'options':{'where':{'id':_0x15e259}},'log':_0x2480('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 4fd0895..2ac3266 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 _0xe632=['../client','create'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xe632,0x9a));var _0x2e63=function(_0x4b416e,_0x1f9fea){_0x4b416e=_0x4b416e-0x0;var _0x11f02b=_0xe632[_0x4b416e];return _0x11f02b;};'use strict';var client=require(_0x2e63('0x0'));exports[_0x2e63('0x1')]=function(_0x452ae3){return client['Request']('CreateChatMessage',{'body':_0x452ae3,'log':'createChatMessage'});}; \ No newline at end of file +var _0xa597=['create','Request'];(function(_0x32bb6b,_0x1a5fbe){var _0x58dcb4=function(_0x402ee2){while(--_0x402ee2){_0x32bb6b['push'](_0x32bb6b['shift']());}};_0x58dcb4(++_0x1a5fbe);}(_0xa597,0xea));var _0x7a59=function(_0x2b2d33,_0x364135){_0x2b2d33=_0x2b2d33-0x0;var _0x29d035=_0xa597[_0x2b2d33];return _0x29d035;};'use strict';var client=require('../client');exports[_0x7a59('0x0')]=function(_0x3c8237){return client[_0x7a59('0x1')]('CreateChatMessage',{'body':_0x3c8237,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index ea84ca4..5e07ecb 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 _0x23ee=['GetChatQueue','name','strategy','online','chatPause','getChatQueues','Request'];(function(_0x587439,_0x153c32){var _0x138c81=function(_0x36bb26){while(--_0x36bb26){_0x587439['push'](_0x587439['shift']());}};_0x138c81(++_0x153c32);}(_0x23ee,0x140));var _0xe23e=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0x23ee[_0x1b02bb];return _0x131245;};'use strict';var client=require('../client');exports[_0xe23e('0x0')]=function(){return function(){return client[_0xe23e('0x1')](_0xe23e('0x2'),{'options':{'raw':![],'attributes':['id',_0xe23e('0x3'),'timeout',_0xe23e('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0xe23e('0x5'),_0xe23e('0x6')]}]},'log':_0xe23e('0x0')});};}; \ No newline at end of file +var _0xbca4=['Request','GetChatQueue','name','timeout','strategy','Agents','chatPause','getChatQueues'];(function(_0x25f4a6,_0x5c702b){var _0x2b623f=function(_0x3776d0){while(--_0x3776d0){_0x25f4a6['push'](_0x25f4a6['shift']());}};_0x2b623f(++_0x5c702b);}(_0xbca4,0xf7));var _0x4bca=function(_0x60725c,_0x49b69c){_0x60725c=_0x60725c-0x0;var _0x2fb29d=_0xbca4[_0x60725c];return _0x2fb29d;};'use strict';var client=require('../client');exports[_0x4bca('0x0')]=function(){return function(){return client[_0x4bca('0x1')](_0x4bca('0x2'),{'options':{'raw':![],'attributes':['id',_0x4bca('0x3'),_0x4bca('0x4'),_0x4bca('0x5')],'include':[{'model':'User','as':_0x4bca('0x6'),'attributes':['id',_0x4bca('0x3'),'online',_0x4bca('0x7')]}]},'log':_0x4bca('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 700f82b..aebbc13 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 _0xaba6=['UpdateChatQueueReport','../client','create','update','Request'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0xaba6,0xe2));var _0x6aba=function(_0xd4d369,_0x4f6ad2){_0xd4d369=_0xd4d369-0x0;var _0x293e5d=_0xaba6[_0xd4d369];return _0x293e5d;};'use strict';var client=require(_0x6aba('0x0'));exports[_0x6aba('0x1')]=function(_0x518305){return client['Request']('CreateChatQueueReport',{'body':_0x518305,'log':'CreateChatQueueReport'});};exports[_0x6aba('0x2')]=function(_0x5e8543,_0x58d8a8){return client[_0x6aba('0x3')](_0x6aba('0x4'),{'body':_0x58d8a8,'options':{'where':{'uniqueid':_0x5e8543},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xc39c=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x2d5df3,_0x5206a1){var _0x312d3b=function(_0x5d6d81){while(--_0x5d6d81){_0x2d5df3['push'](_0x2d5df3['shift']());}};_0x312d3b(++_0x5206a1);}(_0xc39c,0xd2));var _0xcc39=function(_0x42d6e9,_0x5278bb){_0x42d6e9=_0x42d6e9-0x0;var _0x423e51=_0xc39c[_0x42d6e9];return _0x423e51;};'use strict';var client=require('../client');exports[_0xcc39('0x0')]=function(_0x3380ff){return client[_0xcc39('0x1')]('CreateChatQueueReport',{'body':_0x3380ff,'log':_0xcc39('0x2')});};exports[_0xcc39('0x3')]=function(_0x2da5dd,_0x5bc333){return client[_0xcc39('0x1')](_0xcc39('0x4'),{'body':_0x5bc333,'options':{'where':{'uniqueid':_0x2da5dd},'order':[['id',_0xcc39('0x5')]],'limit':0x1},'log':_0xcc39('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 8813bd4..3f345ea 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 _0xac60=['updateFaxInteraction','addTags','../client','Request','UpdateFaxInteraction'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xac60,0x98));var _0x0ac6=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xac60[_0x484e36];return _0xafc85d;};'use strict';var client=require(_0x0ac6('0x0'));exports['update']=function(_0x5d0f48,_0x3459b3){return client[_0x0ac6('0x1')](_0x0ac6('0x2'),{'body':_0x3459b3,'options':{'where':{'id':_0x5d0f48}},'log':_0x0ac6('0x3')});};exports[_0x0ac6('0x4')]=function(_0x1e73a8,_0xac8b2b){return client[_0x0ac6('0x1')]('AddTagsToFaxInteraction',{'body':_0xac8b2b,'options':{'where':{'id':_0x1e73a8}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7541=['updateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','Request','UpdateFaxInteraction'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7541,0x1ac));var _0x1754=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x7541[_0x2aea9e];return _0x430b92;};'use strict';var client=require(_0x1754('0x0'));exports[_0x1754('0x1')]=function(_0xb60f18,_0x4f02ea){return client[_0x1754('0x2')](_0x1754('0x3'),{'body':_0x4f02ea,'options':{'where':{'id':_0xb60f18}},'log':_0x1754('0x4')});};exports[_0x1754('0x5')]=function(_0xbe514b,_0x5de669){return client[_0x1754('0x2')](_0x1754('0x6'),{'body':_0x5de669,'options':{'where':{'id':_0xbe514b}},'log':_0x1754('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 8f59d51..0b94ceb 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 _0xae84=['createFaxMessage','../client','create','CreateFaxMessage'];(function(_0x20c769,_0x37873e){var _0x265d8=function(_0x2fbbf8){while(--_0x2fbbf8){_0x20c769['push'](_0x20c769['shift']());}};_0x265d8(++_0x37873e);}(_0xae84,0x65));var _0x4ae8=function(_0x5495c9,_0x24ada4){_0x5495c9=_0x5495c9-0x0;var _0x33f299=_0xae84[_0x5495c9];return _0x33f299;};'use strict';var client=require(_0x4ae8('0x0'));exports[_0x4ae8('0x1')]=function(_0x3b9ae3){return client['Request'](_0x4ae8('0x2'),{'body':_0x3b9ae3,'log':_0x4ae8('0x3')});}; \ No newline at end of file +var _0x7377=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x3f38b0,_0x38ba25){var _0x475fd9=function(_0x4d9ccf){while(--_0x4d9ccf){_0x3f38b0['push'](_0x3f38b0['shift']());}};_0x475fd9(++_0x38ba25);}(_0x7377,0xee));var _0x7737=function(_0x390ae7,_0x58c15b){_0x390ae7=_0x390ae7-0x0;var _0xe569b4=_0x7377[_0x390ae7];return _0xe569b4;};'use strict';var client=require(_0x7737('0x0'));exports[_0x7737('0x1')]=function(_0x333b83){return client[_0x7737('0x2')](_0x7737('0x3'),{'body':_0x333b83,'log':_0x7737('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 38cc505..16b463e 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 _0x8d86=['getFaxQueues','Request','GetFaxQueue','name','strategy','User','Agents','faxPause','../client'];(function(_0x22a80a,_0x43928d){var _0x18ea17=function(_0x53381d){while(--_0x53381d){_0x22a80a['push'](_0x22a80a['shift']());}};_0x18ea17(++_0x43928d);}(_0x8d86,0xbc));var _0x68d8=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x8d86[_0x3305de];return _0x3b5a84;};'use strict';var client=require(_0x68d8('0x0'));exports[_0x68d8('0x1')]=function(){return function(){return client[_0x68d8('0x2')](_0x68d8('0x3'),{'options':{'raw':![],'attributes':['id',_0x68d8('0x4'),'timeout',_0x68d8('0x5')],'include':[{'model':_0x68d8('0x6'),'as':_0x68d8('0x7'),'attributes':['id',_0x68d8('0x4'),'online',_0x68d8('0x8')]}]},'log':_0x68d8('0x1')});};}; \ No newline at end of file +var _0xb326=['Request','GetFaxQueue','name','timeout','strategy','User','Agents','online','getFaxQueues','../client'];(function(_0x3584c7,_0x584915){var _0xc87366=function(_0x34d078){while(--_0x34d078){_0x3584c7['push'](_0x3584c7['shift']());}};_0xc87366(++_0x584915);}(_0xb326,0x153));var _0x6b32=function(_0x8ce908,_0xde006a){_0x8ce908=_0x8ce908-0x0;var _0x4120ce=_0xb326[_0x8ce908];return _0x4120ce;};'use strict';var client=require(_0x6b32('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x6b32('0x1')](_0x6b32('0x2'),{'options':{'raw':![],'attributes':['id',_0x6b32('0x3'),_0x6b32('0x4'),_0x6b32('0x5')],'include':[{'model':_0x6b32('0x6'),'as':_0x6b32('0x7'),'attributes':['id',_0x6b32('0x3'),_0x6b32('0x8'),'faxPause']}]},'log':_0x6b32('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index a51a388..6a7a136 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 _0x05f1=['../client','create','Request','CreateFaxQueueReport','UpdateFaxQueueReport'];(function(_0xbb9b8a,_0xee9592){var _0x527448=function(_0x1c7c89){while(--_0x1c7c89){_0xbb9b8a['push'](_0xbb9b8a['shift']());}};_0x527448(++_0xee9592);}(_0x05f1,0xfa));var _0x105f=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x05f1[_0x4a53d];return _0x27410e;};'use strict';var client=require(_0x105f('0x0'));exports[_0x105f('0x1')]=function(_0x14be16){return client[_0x105f('0x2')](_0x105f('0x3'),{'body':_0x14be16,'log':_0x105f('0x3')});};exports['update']=function(_0x2ddb56,_0x26ebe5){return client[_0x105f('0x2')](_0x105f('0x4'),{'body':_0x26ebe5,'options':{'where':{'uniqueid':_0x2ddb56},'order':[['id','DESC']],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x79a8=['UpdateFaxQueueReport','DESC','../client','Request','CreateFaxQueueReport','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x79a8,0x1d0));var _0x879a=function(_0x597351,_0x5aed9f){_0x597351=_0x597351-0x0;var _0x410cd7=_0x79a8[_0x597351];return _0x410cd7;};'use strict';var client=require(_0x879a('0x0'));exports['create']=function(_0x244704){return client[_0x879a('0x1')](_0x879a('0x2'),{'body':_0x244704,'log':'CreateFaxQueueReport'});};exports[_0x879a('0x3')]=function(_0x49b7c0,_0x46ee67){return client[_0x879a('0x1')](_0x879a('0x4'),{'body':_0x46ee67,'options':{'where':{'uniqueid':_0x49b7c0},'order':[['id',_0x879a('0x5')]],'limit':0x1},'log':_0x879a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index e3338f6..9d8b6df 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 _0x823c=['getIntervals','../client','Request','GetInterval','name','Interval','Intervals'];(function(_0x5a173c,_0x54aebf){var _0x174a55=function(_0x2713ba){while(--_0x2713ba){_0x5a173c['push'](_0x5a173c['shift']());}};_0x174a55(++_0x54aebf);}(_0x823c,0x143));var _0xc823=function(_0x404248,_0x3ac316){_0x404248=_0x404248-0x0;var _0x2af3f6=_0x823c[_0x404248];return _0x2af3f6;};'use strict';var client=require(_0xc823('0x0'));exports['getIntervals']=function(){return function(){return client[_0xc823('0x1')](_0xc823('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xc823('0x3')],'include':[{'model':_0xc823('0x4'),'as':_0xc823('0x5'),'attributes':['id',_0xc823('0x3'),'interval']}]},'log':_0xc823('0x6')});};}; \ No newline at end of file +var _0x13f6=['name','Interval','Intervals','interval','../client','getIntervals'];(function(_0x2df387,_0x1d3ea1){var _0x3b1708=function(_0x49c05b){while(--_0x49c05b){_0x2df387['push'](_0x2df387['shift']());}};_0x3b1708(++_0x1d3ea1);}(_0x13f6,0x124));var _0x613f=function(_0x3f8793,_0x51fbad){_0x3f8793=_0x3f8793-0x0;var _0x319415=_0x13f6[_0x3f8793];return _0x319415;};'use strict';var client=require(_0x613f('0x0'));exports[_0x613f('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x613f('0x2')],'include':[{'model':_0x613f('0x3'),'as':_0x613f('0x4'),'attributes':['id','name',_0x613f('0x5')]}]},'log':_0x613f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 2202cbe..9eed86f 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 _0x0137=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x43e511,_0x3fb744){var _0x584864=function(_0x58f34f){while(--_0x58f34f){_0x43e511['push'](_0x43e511['shift']());}};_0x584864(++_0x3fb744);}(_0x0137,0xa4));var _0x7013=function(_0x372433,_0xb55d02){_0x372433=_0x372433-0x0;var _0x375ac3=_0x0137[_0x372433];return _0x375ac3;};'use strict';var client=require(_0x7013('0x0'));exports['update']=function(_0x21491a,_0x4242bd){return client[_0x7013('0x1')](_0x7013('0x2'),{'body':_0x4242bd,'options':{'where':{'id':_0x21491a}},'log':_0x7013('0x3')});};exports['addTags']=function(_0x547329,_0x232446){return client[_0x7013('0x1')](_0x7013('0x4'),{'body':_0x232446,'options':{'where':{'id':_0x547329}},'log':_0x7013('0x5')});}; \ No newline at end of file +var _0x4918=['update','Request','UpdateMailInteraction','updateMailInteraction','addTagsToChatInteraction'];(function(_0x77b71d,_0x38e802){var _0x1b6255=function(_0x534ef8){while(--_0x534ef8){_0x77b71d['push'](_0x77b71d['shift']());}};_0x1b6255(++_0x38e802);}(_0x4918,0x1ae));var _0x8491=function(_0x27c24e,_0x5db1c7){_0x27c24e=_0x27c24e-0x0;var _0x39004a=_0x4918[_0x27c24e];return _0x39004a;};'use strict';var client=require('../client');exports[_0x8491('0x0')]=function(_0x58e9e0,_0x30fc29){return client[_0x8491('0x1')](_0x8491('0x2'),{'body':_0x30fc29,'options':{'where':{'id':_0x58e9e0}},'log':_0x8491('0x3')});};exports['addTags']=function(_0x67731c,_0x3c820c){return client['Request']('AddTagsToMailInteraction',{'body':_0x3c820c,'options':{'where':{'id':_0x67731c}},'log':_0x8491('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index c43f45b..7cd1fbe 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 _0x7043=['Request','CreateMailMessage','createMailMessage','create'];(function(_0x127b52,_0x5ef4e4){var _0x49025b=function(_0x5e6d30){while(--_0x5e6d30){_0x127b52['push'](_0x127b52['shift']());}};_0x49025b(++_0x5ef4e4);}(_0x7043,0xa7));var _0x3704=function(_0x204106,_0x3e2e12){_0x204106=_0x204106-0x0;var _0x157a1a=_0x7043[_0x204106];return _0x157a1a;};'use strict';var client=require('../client');exports[_0x3704('0x0')]=function(_0x31834e){return client[_0x3704('0x1')](_0x3704('0x2'),{'body':_0x31834e,'log':_0x3704('0x3')});}; \ No newline at end of file +var _0xb987=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0xd333a1,_0x1f61a0){var _0x553a60=function(_0x13761f){while(--_0x13761f){_0xd333a1['push'](_0xd333a1['shift']());}};_0x553a60(++_0x1f61a0);}(_0xb987,0xdb));var _0x7b98=function(_0x2bdfad,_0x221116){_0x2bdfad=_0x2bdfad-0x0;var _0x2ce379=_0xb987[_0x2bdfad];return _0x2ce379;};'use strict';var client=require(_0x7b98('0x0'));exports[_0x7b98('0x1')]=function(_0x43e935){return client[_0x7b98('0x2')](_0x7b98('0x3'),{'body':_0x43e935,'log':_0x7b98('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index fe3b844..c59c8e3 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 _0x4ec0=['Request','GetMailQueue','name','strategy','User','Agents','online','../client','getMailQueues'];(function(_0x37f004,_0x62b34f){var _0x26e286=function(_0x39d65a){while(--_0x39d65a){_0x37f004['push'](_0x37f004['shift']());}};_0x26e286(++_0x62b34f);}(_0x4ec0,0xb2));var _0x04ec=function(_0x21e1e7,_0x151f03){_0x21e1e7=_0x21e1e7-0x0;var _0x6635a0=_0x4ec0[_0x21e1e7];return _0x6635a0;};'use strict';var client=require(_0x04ec('0x0'));exports[_0x04ec('0x1')]=function(){return function(){return client[_0x04ec('0x2')](_0x04ec('0x3'),{'options':{'raw':![],'attributes':['id',_0x04ec('0x4'),'timeout',_0x04ec('0x5')],'include':[{'model':_0x04ec('0x6'),'as':_0x04ec('0x7'),'attributes':['id','name',_0x04ec('0x8'),'mailPause']}]},'log':_0x04ec('0x1')});};}; \ No newline at end of file +var _0x15ea=['User','Agents','name','online','getMailQueues','GetMailQueue'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x15ea,0x89));var _0xa15e=function(_0x259e2e,_0x3fb186){_0x259e2e=_0x259e2e-0x0;var _0x537fe5=_0x15ea[_0x259e2e];return _0x537fe5;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client['Request'](_0xa15e('0x0'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0xa15e('0x1'),'as':_0xa15e('0x2'),'attributes':['id',_0xa15e('0x3'),_0xa15e('0x4'),'mailPause']}]},'log':_0xa15e('0x5')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index d65054e..e465e60 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 _0x5e97=['../client','Request','UpdateMailQueueReport','DESC'];(function(_0x64edb0,_0x4dd13c){var _0x580a4b=function(_0x3e6636){while(--_0x3e6636){_0x64edb0['push'](_0x64edb0['shift']());}};_0x580a4b(++_0x4dd13c);}(_0x5e97,0x198));var _0x75e9=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5e97[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0x75e9('0x0'));exports['create']=function(_0xb38f3d){return client[_0x75e9('0x1')]('CreateMailQueueReport',{'body':_0xb38f3d,'log':'CreateMailQueueReport'});};exports['update']=function(_0x386004,_0x3dd897){return client[_0x75e9('0x1')](_0x75e9('0x2'),{'body':_0x3dd897,'options':{'where':{'uniqueid':_0x386004},'order':[['id',_0x75e9('0x3')]],'limit':0x1},'log':_0x75e9('0x2')});}; \ No newline at end of file +var _0x8771=['../client','Request','update','UpdateMailQueueReport','DESC'];(function(_0x41d567,_0x41d7b3){var _0x494225=function(_0x2e144c){while(--_0x2e144c){_0x41d567['push'](_0x41d567['shift']());}};_0x494225(++_0x41d7b3);}(_0x8771,0x13b));var _0x1877=function(_0x3cf4d3,_0x48065e){_0x3cf4d3=_0x3cf4d3-0x0;var _0x4e547b=_0x8771[_0x3cf4d3];return _0x4e547b;};'use strict';var client=require(_0x1877('0x0'));exports['create']=function(_0x1c3b82){return client[_0x1877('0x1')]('CreateMailQueueReport',{'body':_0x1c3b82,'log':'CreateMailQueueReport'});};exports[_0x1877('0x2')]=function(_0x30fe75,_0x17494a){return client['Request'](_0x1877('0x3'),{'body':_0x17494a,'options':{'where':{'uniqueid':_0x30fe75},'order':[['id',_0x1877('0x4')]],'limit':0x1},'log':_0x1877('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 344cc1b..1ab4d74 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 _0xd25c=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x23b2b4,_0x1af875){var _0x4918ae=function(_0x17829a){while(--_0x17829a){_0x23b2b4['push'](_0x23b2b4['shift']());}};_0x4918ae(++_0x1af875);}(_0xd25c,0xe7));var _0xcd25=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xd25c[_0x1abb09];return _0xea1c07;};'use strict';var client=require(_0xcd25('0x0'));exports['update']=function(_0x56e663,_0x2c3289){return client['Request'](_0xcd25('0x1'),{'body':_0x2c3289,'options':{'where':{'id':_0x56e663}},'log':_0xcd25('0x2')});};exports[_0xcd25('0x3')]=function(_0x3feb7e,_0x1b7fac){return client['Request'](_0xcd25('0x4'),{'body':_0x1b7fac,'options':{'where':{'id':_0x3feb7e}},'log':_0xcd25('0x5')});}; \ No newline at end of file +var _0x1b75=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','update'];(function(_0x32968b,_0x2ada9e){var _0x503768=function(_0x207697){while(--_0x207697){_0x32968b['push'](_0x32968b['shift']());}};_0x503768(++_0x2ada9e);}(_0x1b75,0xe3));var _0x51b7=function(_0x10dbf6,_0x3ff964){_0x10dbf6=_0x10dbf6-0x0;var _0x452147=_0x1b75[_0x10dbf6];return _0x452147;};'use strict';var client=require('../client');exports[_0x51b7('0x0')]=function(_0x29f632,_0x29bcc5){return client[_0x51b7('0x1')](_0x51b7('0x2'),{'body':_0x29bcc5,'options':{'where':{'id':_0x29f632}},'log':_0x51b7('0x3')});};exports['addTags']=function(_0xec4057,_0x327396){return client[_0x51b7('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0x327396,'options':{'where':{'id':_0xec4057}},'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 bd93aef..7b9ae66 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 _0xcb91=['CreateOpenchannelMessage','createOpenchannelMessage','Request'];(function(_0x4f9f8c,_0x29cc8e){var _0x5e820b=function(_0x291792){while(--_0x291792){_0x4f9f8c['push'](_0x4f9f8c['shift']());}};_0x5e820b(++_0x29cc8e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5dfc2a,_0x1a953f){_0x5dfc2a=_0x5dfc2a-0x0;var _0x3f1a71=_0xcb91[_0x5dfc2a];return _0x3f1a71;};'use strict';var client=require('../client');exports['create']=function(_0x26fe42){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'body':_0x26fe42,'log':_0x1cb9('0x2')});}; \ No newline at end of file +var _0x70e0=['createOpenchannelMessage','../client','create'];(function(_0x4a6699,_0x115a0a){var _0x436bfc=function(_0xa3b96e){while(--_0xa3b96e){_0x4a6699['push'](_0x4a6699['shift']());}};_0x436bfc(++_0x115a0a);}(_0x70e0,0x17b));var _0x070e=function(_0x365d76,_0xcd065a){_0x365d76=_0x365d76-0x0;var _0x4a8573=_0x70e0[_0x365d76];return _0x4a8573;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateOpenchannelMessage',{'body':_0x198c2e,'log':_0x070e('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 803e499..6e056b0 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 _0xcad0=['GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','../client','getOpenchannelQueues','Request'];(function(_0x5de524,_0x34df59){var _0x4635df=function(_0x1d83c4){while(--_0x1d83c4){_0x5de524['push'](_0x5de524['shift']());}};_0x4635df(++_0x34df59);}(_0xcad0,0xcf));var _0x0cad=function(_0x5e5f5d,_0xa2fbf2){_0x5e5f5d=_0x5e5f5d-0x0;var _0x510b43=_0xcad0[_0x5e5f5d];return _0x510b43;};'use strict';var client=require(_0x0cad('0x0'));exports[_0x0cad('0x1')]=function(){return function(){return client[_0x0cad('0x2')](_0x0cad('0x3'),{'options':{'raw':![],'attributes':['id',_0x0cad('0x4'),_0x0cad('0x5'),_0x0cad('0x6')],'include':[{'model':_0x0cad('0x7'),'as':_0x0cad('0x8'),'attributes':['id',_0x0cad('0x4'),_0x0cad('0x9'),'openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xcaf3=['User','Agents','name','../client','getOpenchannelQueues','GetOpenchannelQueue','timeout','strategy'];(function(_0x3b73d1,_0x1a7b6a){var _0x1c9e3d=function(_0x3d636e){while(--_0x3d636e){_0x3b73d1['push'](_0x3b73d1['shift']());}};_0x1c9e3d(++_0x1a7b6a);}(_0xcaf3,0x1db));var _0x3caf=function(_0x1ad926,_0x3e1fed){_0x1ad926=_0x1ad926-0x0;var _0x1b81dc=_0xcaf3[_0x1ad926];return _0x1b81dc;};'use strict';var client=require(_0x3caf('0x0'));exports[_0x3caf('0x1')]=function(){return function(){return client['Request'](_0x3caf('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x3caf('0x3'),_0x3caf('0x4')],'include':[{'model':_0x3caf('0x5'),'as':_0x3caf('0x6'),'attributes':['id',_0x3caf('0x7'),'online','openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index f6accfb..c490b22 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 _0x3c34=['../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x7c0074,_0x1ffdcf){var _0x13e95b=function(_0x521212){while(--_0x521212){_0x7c0074['push'](_0x7c0074['shift']());}};_0x13e95b(++_0x1ffdcf);}(_0x3c34,0x1c0));var _0x43c3=function(_0x79b649,_0x2115b3){_0x79b649=_0x79b649-0x0;var _0x1af9b1=_0x3c34[_0x79b649];return _0x1af9b1;};'use strict';var client=require(_0x43c3('0x0'));exports[_0x43c3('0x1')]=function(_0x2ad92d){return client[_0x43c3('0x2')](_0x43c3('0x3'),{'body':_0x2ad92d,'log':_0x43c3('0x3')});};exports[_0x43c3('0x4')]=function(_0xfeaa97,_0x50fbfa){return client[_0x43c3('0x2')](_0x43c3('0x5'),{'body':_0x50fbfa,'options':{'where':{'uniqueid':_0xfeaa97},'order':[['id',_0x43c3('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x2723=['DESC','../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x473ee7,_0x4dd754){var _0x30f0d4=function(_0x4d961d){while(--_0x4d961d){_0x473ee7['push'](_0x473ee7['shift']());}};_0x30f0d4(++_0x4dd754);}(_0x2723,0x190));var _0x3272=function(_0x5e7522,_0x57d4ef){_0x5e7522=_0x5e7522-0x0;var _0x41eebd=_0x2723[_0x5e7522];return _0x41eebd;};'use strict';var client=require(_0x3272('0x0'));exports[_0x3272('0x1')]=function(_0x174ba0){return client[_0x3272('0x2')](_0x3272('0x3'),{'body':_0x174ba0,'log':'CreateOpenchannelQueueReport'});};exports[_0x3272('0x4')]=function(_0x21219f,_0x345738){return client[_0x3272('0x2')](_0x3272('0x5'),{'body':_0x345738,'options':{'where':{'uniqueid':_0x21219f},'order':[['id',_0x3272('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 9a6bd37..a14d355 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 _0xf603=['Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','../client','update'];(function(_0x49ce24,_0x56264a){var _0x2f9809=function(_0x40fe97){while(--_0x40fe97){_0x49ce24['push'](_0x49ce24['shift']());}};_0x2f9809(++_0x56264a);}(_0xf603,0x124));var _0x3f60=function(_0x25082a,_0x415e07){_0x25082a=_0x25082a-0x0;var _0x3d9d54=_0xf603[_0x25082a];return _0x3d9d54;};'use strict';var client=require(_0x3f60('0x0'));exports[_0x3f60('0x1')]=function(_0x47e6ea,_0x2aaed8){return client[_0x3f60('0x2')](_0x3f60('0x3'),{'body':_0x2aaed8,'options':{'where':{'id':_0x47e6ea}},'log':_0x3f60('0x4')});};exports[_0x3f60('0x5')]=function(_0x1403db,_0x21a566){return client[_0x3f60('0x2')](_0x3f60('0x6'),{'body':_0x21a566,'options':{'where':{'id':_0x1403db}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0xff43=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xff43,0x65));var _0x3ff4=function(_0x2ed841,_0x17582a){_0x2ed841=_0x2ed841-0x0;var _0x5a0b79=_0xff43[_0x2ed841];return _0x5a0b79;};'use strict';var client=require('../client');exports[_0x3ff4('0x0')]=function(_0x3d4d25,_0x3ccc00){return client[_0x3ff4('0x1')](_0x3ff4('0x2'),{'body':_0x3ccc00,'options':{'where':{'id':_0x3d4d25}},'log':_0x3ff4('0x3')});};exports[_0x3ff4('0x4')]=function(_0x51c220,_0x50e13d){return client[_0x3ff4('0x1')](_0x3ff4('0x5'),{'body':_0x50e13d,'options':{'where':{'id':_0x51c220}},'log':_0x3ff4('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index c7b413e..de25895 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 _0x0502=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x0502,0x99));var _0x2050=function(_0x3f8f10,_0x110c48){_0x3f8f10=_0x3f8f10-0x0;var _0x4d1cab=_0x0502[_0x3f8f10];return _0x4d1cab;};'use strict';var client=require(_0x2050('0x0'));exports[_0x2050('0x1')]=function(_0x1b66a8){return client[_0x2050('0x2')](_0x2050('0x3'),{'body':_0x1b66a8,'log':_0x2050('0x4')});}; \ No newline at end of file +var _0x5eff=['CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x5eff,0x76));var _0xf5ef=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x5eff[_0x1969a7];return _0x3d665f;};'use strict';var client=require(_0xf5ef('0x0'));exports[_0xf5ef('0x1')]=function(_0x439a8f){return client['Request'](_0xf5ef('0x2'),{'body':_0x439a8f,'log':_0xf5ef('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 0045d97..cfc54bf 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 _0xd4f0=['online','smsPause','../client','getSmsQueues','Request','GetSmsQueue','User','Agents','name'];(function(_0x1bef82,_0x1db250){var _0x4002f5=function(_0x27b7ce){while(--_0x27b7ce){_0x1bef82['push'](_0x1bef82['shift']());}};_0x4002f5(++_0x1db250);}(_0xd4f0,0x122));var _0x0d4f=function(_0x5c2a2b,_0x22c94e){_0x5c2a2b=_0x5c2a2b-0x0;var _0x19921f=_0xd4f0[_0x5c2a2b];return _0x19921f;};'use strict';var client=require(_0x0d4f('0x0'));exports[_0x0d4f('0x1')]=function(){return function(){return client[_0x0d4f('0x2')](_0x0d4f('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0x0d4f('0x4'),'as':_0x0d4f('0x5'),'attributes':['id',_0x0d4f('0x6'),_0x0d4f('0x7'),_0x0d4f('0x8')]}]},'log':_0x0d4f('0x1')});};}; \ No newline at end of file +var _0xf18a=['GetSmsQueue','name','timeout','online','smsPause','../client','getSmsQueues','Request'];(function(_0x4afc65,_0x1f23f3){var _0xca056=function(_0x260094){while(--_0x260094){_0x4afc65['push'](_0x4afc65['shift']());}};_0xca056(++_0x1f23f3);}(_0xf18a,0x19d));var _0xaf18=function(_0x1425d2,_0x1ea77b){_0x1425d2=_0x1425d2-0x0;var _0x50f6c6=_0xf18a[_0x1425d2];return _0x50f6c6;};'use strict';var client=require(_0xaf18('0x0'));exports[_0xaf18('0x1')]=function(){return function(){return client[_0xaf18('0x2')](_0xaf18('0x3'),{'options':{'raw':![],'attributes':['id',_0xaf18('0x4'),_0xaf18('0x5'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0xaf18('0x4'),_0xaf18('0x6'),_0xaf18('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 80001e3..d2a9242 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 _0x65ac=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x375c32,_0x21a492){var _0x50ebcc=function(_0x2417f4){while(--_0x2417f4){_0x375c32['push'](_0x375c32['shift']());}};_0x50ebcc(++_0x21a492);}(_0x65ac,0x1a3));var _0xc65a=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x65ac[_0x4bb66f];return _0xf2772f;};'use strict';var client=require(_0xc65a('0x0'));exports[_0xc65a('0x1')]=function(_0x2eccf0){return client[_0xc65a('0x2')]('CreateSmsQueueReport',{'body':_0x2eccf0,'log':_0xc65a('0x3')});};exports[_0xc65a('0x4')]=function(_0x29748a,_0x499474){return client['Request'](_0xc65a('0x5'),{'body':_0x499474,'options':{'where':{'uniqueid':_0x29748a},'order':[['id',_0xc65a('0x6')]],'limit':0x1},'log':_0xc65a('0x5')});}; \ No newline at end of file +var _0xe9d0=['UpdateSmsQueueReport','DESC','../client','Request','CreateSmsQueueReport'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xe9d0,0x84));var _0x0e9d=function(_0x305ea7,_0x9764c){_0x305ea7=_0x305ea7-0x0;var _0x3b9b60=_0xe9d0[_0x305ea7];return _0x3b9b60;};'use strict';var client=require(_0x0e9d('0x0'));exports['create']=function(_0x11c785){return client[_0x0e9d('0x1')](_0x0e9d('0x2'),{'body':_0x11c785,'log':_0x0e9d('0x2')});};exports['update']=function(_0x428742,_0x573288){return client['Request'](_0x0e9d('0x3'),{'body':_0x573288,'options':{'where':{'uniqueid':_0x428742},'order':[['id',_0x0e9d('0x4')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 049d081..5d411c1 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 _0x6793=['GetUser','agent','name','online','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','getAgents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6793,0x10f));var _0x3679=function(_0x2c1a1f,_0x5af589){_0x2c1a1f=_0x2c1a1f-0x0;var _0x5915bd=_0x6793[_0x2c1a1f];return _0x5915bd;};'use strict';var client=require('../client');exports[_0x3679('0x0')]=function(){return function(){return client['Request'](_0x3679('0x1'),{'options':{'raw':!![],'where':{'role':_0x3679('0x2')},'attributes':['id',_0x3679('0x3'),_0x3679('0x4'),_0x3679('0x5'),_0x3679('0x6'),_0x3679('0x7'),_0x3679('0x8'),_0x3679('0x9'),'faxPause',_0x3679('0xa'),_0x3679('0xb'),_0x3679('0xc'),_0x3679('0xd'),_0x3679('0xe'),_0x3679('0xf'),'openchannelCapacity']},'log':_0x3679('0x0')});};}; \ No newline at end of file +var _0x98d9=['lastPauseAt','mailPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','openchannelCapacity','../client','getAgents','Request','agent','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x98d9,0x119));var _0x998d=function(_0x1aefcf,_0xe31b2d){_0x1aefcf=_0x1aefcf-0x0;var _0x30090b=_0x98d9[_0x1aefcf];return _0x30090b;};'use strict';var client=require(_0x998d('0x0'));exports[_0x998d('0x1')]=function(){return function(){return client[_0x998d('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x998d('0x3')},'attributes':['id',_0x998d('0x4'),'online','pauseType',_0x998d('0x5'),'voicePause','chatPause',_0x998d('0x6'),'faxPause','smsPause',_0x998d('0x7'),_0x998d('0x8'),_0x998d('0x9'),_0x998d('0xa'),_0x998d('0xb'),_0x998d('0xc')]},'log':'getAgents'});};}; \ 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 de0cf3a..fbe14c1 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 _0xfece=['createQueue','atimeout','channel','format','START:%s','end','close','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','stop','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','message','agents'];(function(_0x5f46e7,_0x62f9f8){var _0x567e95=function(_0x5cb693){while(--_0x5cb693){_0x5f46e7['push'](_0x5f46e7['shift']());}};_0x567e95(++_0x62f9f8);}(_0xfece,0x73));var _0xefec=function(_0x1ff8ad,_0x4459eb){_0x1ff8ad=_0x1ff8ad-0x0;var _0x532093=_0xfece[_0x1ff8ad];return _0x532093;};'use strict';var schema=require(_0xefec('0x0'));var _=require(_0xefec('0x1'));var util=require('util');var seqqueue=require(_0xefec('0x2'));var logger=require(_0xefec('0x3'))(_0xefec('0x4'));var strategy=require(_0xefec('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':_0xefec('0x6')},'timeout':{'type':'number','message':_0xefec('0x7')}});function writeLog(_0x311774,_0x4eafb0,_0x4e8994){return logger[_0xefec('0x8')](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0x311774,_0x4eafb0[_0xefec('0x9')],_0x4e8994));}function handleFindAgent(_0x15e5fd){return function(_0x395382){return _0x395382[_0xefec('0x9')][_0xefec('0xa')]()===_0x15e5fd[_0xefec('0xa')]();};}exports['consequence']=function(_0x276a07,_0x2b8b89,_0x56ead2,_0x8344f0){return function(_0xef2ba0){try{var _0xcfbe12={'name':_0x2b8b89[0x0],'timeout':_0x2b8b89[0x1]};var _0x7ec418=queue['validate'](_0xcfbe12,{'typecast':!![]});if(_0x7ec418[_0xefec('0xb')]){logger[_0xefec('0xc')](_0xefec('0xd'),_0x276a07,_[_0xefec('0xe')](_0x7ec418,_0xefec('0xf'))['join'](',\x20'));_0xef2ba0['stop']();}else{var _0x2ee4b6=_['find'](_0x56ead2[_0xefec('0x10')],handleFindAgent(_0xcfbe12[_0xefec('0x9')]));if(_0x2ee4b6){var _0x118373=(_0xcfbe12['timeout']||0xa)*0x3e8;var _0xb446b9,_0x69e06d;var _0x4caecf=seqqueue[_0xefec('0x11')](_0x118373);_0x4caecf['id']=_0x276a07;_0x4caecf[_0xefec('0x12')]=_0x118373;_0x4caecf[_0xefec('0x13')]=_0x8344f0[_0xefec('0x13')];writeLog(_0x276a07,_0x2ee4b6,util[_0xefec('0x14')](_0xefec('0x15'),_0x118373));_0x56ead2['rules'][_0x276a07]['on'](_0xefec('0x16'),function(){_0x4caecf[_0xefec('0x17')]();clearTimeout(_0x69e06d);_0x69e06d=undefined;if(_0x56ead2[_0xefec('0x18')][_0x276a07]){delete _0x56ead2[_0xefec('0x18')][_0x276a07];}logger[_0xefec('0x8')](_0xefec('0x19'),_0x276a07);_0xef2ba0[_0xefec('0x1a')]();});_0x69e06d=setTimeout(function(){clearTimeout(_0x69e06d);_0x4caecf[_0xefec('0x17')]();logger[_0xefec('0x8')]('[%s][AGENT]\x20ROUTING\x20END',_0x276a07);_0xef2ba0[_0xefec('0x1b')]();},_0x118373);strategy[_0xefec('0x1c')](_0x4caecf,_0x2ee4b6,_0x56ead2,_0x8344f0);}else{logger['error'](_0xefec('0x1d'),_0x276a07,_0xcfbe12[_0xefec('0x9')]);_0xef2ba0[_0xefec('0x1a')]();}}}catch(_0x58dae1){console[_0xefec('0x1e')](_0x58dae1);logger[_0xefec('0xc')](_0xefec('0x1f'),_0x276a07,_0x58dae1[_0xefec('0x20')]);_0xef2ba0[_0xefec('0x1a')]();}};}; \ No newline at end of file +var _0x9aae=['message','join','stop','find','agents','timeout','createQueue','atimeout','START:%s','end','close','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','[%s][AGENT]\x20ROUTING\x20END','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','validate','util','seq-queue','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','map'];(function(_0x1ffd7a,_0x2367ff){var _0x3bf111=function(_0x28a589){while(--_0x28a589){_0x1ffd7a['push'](_0x1ffd7a['shift']());}};_0x3bf111(++_0x2367ff);}(_0x9aae,0x145));var _0xe9aa=function(_0x59a516,_0x2dd0aa){_0x59a516=_0x59a516-0x0;var _0x5b5db0=_0x9aae[_0x59a516];return _0x5b5db0;};'use strict';var schema=require(_0xe9aa('0x0'));var _=require('lodash');var util=require(_0xe9aa('0x1'));var seqqueue=require(_0xe9aa('0x2'));var logger=require(_0xe9aa('0x3'))(_0xe9aa('0x4'));var strategy=require(_0xe9aa('0x5'));var queue=schema({'name':{'type':_0xe9aa('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xe9aa('0x7'),'message':_0xe9aa('0x8')}});function writeLog(_0x275820,_0x366c2d,_0xac1140){return logger[_0xe9aa('0x9')](util[_0xe9aa('0xa')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x275820,_0x366c2d[_0xe9aa('0xb')],_0xac1140));}function handleFindAgent(_0x3340e7){return function(_0x51e27c){return _0x51e27c[_0xe9aa('0xb')][_0xe9aa('0xc')]()===_0x3340e7[_0xe9aa('0xc')]();};}exports[_0xe9aa('0xd')]=function(_0x512abc,_0x226744,_0x250761,_0x2eb34f){return function(_0x55eec7){try{var _0x280ddf={'name':_0x226744[0x0],'timeout':_0x226744[0x1]};var _0xc15d27=queue[_0xe9aa('0x0')](_0x280ddf,{'typecast':!![]});if(_0xc15d27['length']){logger['error']('[%s][AGENT]\x20%s',_0x512abc,_[_0xe9aa('0xe')](_0xc15d27,_0xe9aa('0xf'))[_0xe9aa('0x10')](',\x20'));_0x55eec7[_0xe9aa('0x11')]();}else{var _0x150dd5=_[_0xe9aa('0x12')](_0x250761[_0xe9aa('0x13')],handleFindAgent(_0x280ddf['name']));if(_0x150dd5){var _0x373050=(_0x280ddf[_0xe9aa('0x14')]||0xa)*0x3e8;var _0x169503,_0x1f8484;var _0x5ec4c1=seqqueue[_0xe9aa('0x15')](_0x373050);_0x5ec4c1['id']=_0x512abc;_0x5ec4c1[_0xe9aa('0x16')]=_0x373050;_0x5ec4c1['channel']=_0x2eb34f['channel'];writeLog(_0x512abc,_0x150dd5,util['format'](_0xe9aa('0x17'),_0x373050));_0x250761['rules'][_0x512abc]['on'](_0xe9aa('0x18'),function(){_0x5ec4c1[_0xe9aa('0x19')]();clearTimeout(_0x1f8484);_0x1f8484=undefined;if(_0x250761[_0xe9aa('0x1a')][_0x512abc]){delete _0x250761[_0xe9aa('0x1a')][_0x512abc];}logger['info'](_0xe9aa('0x1b'),_0x512abc);_0x55eec7[_0xe9aa('0x11')]();});_0x1f8484=setTimeout(function(){clearTimeout(_0x1f8484);_0x5ec4c1[_0xe9aa('0x19')]();logger[_0xe9aa('0x9')](_0xe9aa('0x1c'),_0x512abc);_0x55eec7[_0xe9aa('0x1d')]();},_0x373050);strategy[_0xe9aa('0x1e')](_0x5ec4c1,_0x150dd5,_0x250761,_0x2eb34f);}else{logger[_0xe9aa('0x1f')](_0xe9aa('0x20'),_0x512abc,_0x280ddf[_0xe9aa('0xb')]);_0x55eec7[_0xe9aa('0x11')]();}}}catch(_0x28bde8){console['log'](_0x28bde8);logger['error'](_0xe9aa('0x21'),_0x512abc,_0x28bde8['stack']);_0x55eec7[_0xe9aa('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 5d6b265..df4af66 100644 --- a/server/services/routing/server/applications/amazonlex.js +++ b/server/services/routing/server/applications/amazonlex.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1c9=['catch','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','error','amazonlex','then','dialogState','Failed','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','consequence','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','Message','create','info','body'];(function(_0x1e6d1b,_0x3c9a9d){var _0x165acc=function(_0x19ec1a){while(--_0x19ec1a){_0x1e6d1b['push'](_0x1e6d1b['shift']());}};_0x165acc(++_0x3c9a9d);}(_0xa1c9,0x189));var _0x9a1c=function(_0x7a0496,_0x3b4dbc){_0x7a0496=_0x7a0496-0x0;var _0x4d5a25=_0xa1c9[_0x7a0496];return _0x4d5a25;};'use strict';var _=require('lodash');var moment=require(_0x9a1c('0x0'));var AWS=require(_0x9a1c('0x1'));var utils=require(_0x9a1c('0x2'));var logger=require(_0x9a1c('0x3'))('routing');var rpc={'chatMessage':require(_0x9a1c('0x4')),'openchannelMessage':require(_0x9a1c('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage')};exports[_0x9a1c('0x6')]=function(_0x50e9fd,_0x174ba8){return function(_0x17cfe7){try{if(!_[_0x9a1c('0x7')](this[_0x9a1c('0x8')][_0x9a1c('0x9')])){logger['info'](_0x9a1c('0xa'),_0x50e9fd,_0x9a1c('0xb'));return _0x17cfe7[_0x9a1c('0xc')]();}var _0x3d9976={'ContactId':this[_0x9a1c('0xd')]['id'],'sentAt':moment()['format'](_0x9a1c('0xe')),'direction':_0x9a1c('0xf')};var _0x47115e=this['channel'];if(_0x47115e===_0x9a1c('0x10')){_0x3d9976[_0x9a1c('0x11')]=this[_0x9a1c('0x12')]['id'];}else{_0x3d9976[_[_0x9a1c('0x13')](_0x47115e)+_0x9a1c('0x14')]=this[_0x9a1c('0x12')]['id'];}_0x3d9976[_[_0x9a1c('0x13')](_0x47115e)+_0x9a1c('0x15')]=this[_0x9a1c('0x8')]['id'];if(this[_0x9a1c('0x8')][_0x9a1c('0x16')]){var _0x2c8413=_0x174ba8[0x4];if(!_['isEmpty'](_0x2c8413)){_0x3d9976['body']=utils['getMustacheRender'](_0x2c8413,this);return rpc[_0x47115e+_0x9a1c('0x17')][_0x9a1c('0x18')](_0x3d9976)['then'](function(_0x3ccec2){logger[_0x9a1c('0x19')](_0x9a1c('0xa'),_0x50e9fd,_0x3d9976[_0x9a1c('0x1a')]);})[_0x9a1c('0x1b')](function(_0x5f3a31){logger['error'](_0x9a1c('0xa'),_0x50e9fd,JSON[_0x9a1c('0x1c')](_0x5f3a31));})[_0x9a1c('0x1d')](function(){logger[_0x9a1c('0x19')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x50e9fd);_0x17cfe7[_0x9a1c('0x1e')]();});}else{logger[_0x9a1c('0x19')](_0x9a1c('0x1f'),_0x50e9fd);_0x17cfe7[_0x9a1c('0x1e')]();}}else{var _0x2200bb=this;var _0x221e37=new AWS[(_0x9a1c('0x20'))]({'accessKeyId':_0x174ba8[0x0],'secretAccessKey':_0x174ba8[0x1],'region':_0x174ba8[0x2]});var _0x262425={'botAlias':_0x9a1c('0x21'),'botName':_0x174ba8[0x3],'inputText':this[_0x9a1c('0x22')][_0x9a1c('0x1a')],'userId':this[_0x9a1c('0x8')]['id'][_0x9a1c('0x23')]()};_0x221e37[_0x9a1c('0x24')](_0x262425,function(_0x475442,_0x394456){if(_0x475442){logger[_0x9a1c('0x25')](_0x9a1c('0xa'),_0x50e9fd,_0x475442[_0x9a1c('0x22')]);_0x17cfe7[_0x9a1c('0xc')]();}else if(_0x394456&&_0x394456[_0x9a1c('0x22')]){_0x2200bb[_0x9a1c('0x1a')][_0x9a1c('0x26')]=_0x394456;_0x3d9976[_0x9a1c('0x1a')]=_0x394456[_0x9a1c('0x22')];return rpc[_0x47115e+_0x9a1c('0x17')][_0x9a1c('0x18')](_0x3d9976)[_0x9a1c('0x27')](function(_0x52feea){logger['info'](_0x9a1c('0xa'),_0x50e9fd,_0x3d9976[_0x9a1c('0x1a')]);if(_0x394456[_0x9a1c('0x28')]==_0x9a1c('0x29')){_0x17cfe7[_0x9a1c('0xc')]();}else{_0x17cfe7[_0x9a1c('0x1e')]();}})['catch'](function(_0x133c30){logger[_0x9a1c('0x25')](_0x9a1c('0xa'),_0x50e9fd,JSON[_0x9a1c('0x1c')](_0x133c30));_0x17cfe7[_0x9a1c('0xc')]();});}else{_0x17cfe7[_0x9a1c('0xc')]();}});}}catch(_0x66e5a5){logger[_0x9a1c('0x25')]('[%s][AMAZONLEX]\x20%s',_0x50e9fd,JSON[_0x9a1c('0x1c')](_0x66e5a5));_0x17cfe7[_0x9a1c('0x1e')]();}};}; \ No newline at end of file +var _0xbafa=['contact','format','out','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','create','then','info','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','postText','Message','dialogState','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','isNil','interaction','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next'];(function(_0x39e2af,_0x3d4baf){var _0x4ce86d=function(_0x3b8b55){while(--_0x3b8b55){_0x39e2af['push'](_0x39e2af['shift']());}};_0x4ce86d(++_0x3d4baf);}(_0xbafa,0x92));var _0xabaf=function(_0x49fdaf,_0x37104a){_0x49fdaf=_0x49fdaf-0x0;var _0x228bc9=_0xbafa[_0x49fdaf];return _0x228bc9;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0xabaf('0x0'));var logger=require(_0xabaf('0x1'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xabaf('0x2')),'mailMessage':require(_0xabaf('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xabaf('0x4'))};exports['consequence']=function(_0x5a1814,_0x16e734){return function(_0x205bd6){try{if(!_[_0xabaf('0x5')](this[_0xabaf('0x6')]['UserId'])){logger['info'](_0xabaf('0x7'),_0x5a1814,_0xabaf('0x8'));return _0x205bd6[_0xabaf('0x9')]();}var _0x51c043={'ContactId':this[_0xabaf('0xa')]['id'],'sentAt':moment()[_0xabaf('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xabaf('0xc')};var _0x2eecc2=this[_0xabaf('0xd')];if(_0x2eecc2===_0xabaf('0xe')){_0x51c043[_0xabaf('0xf')]=this[_0xabaf('0x10')]['id'];}else{_0x51c043[_[_0xabaf('0x11')](_0x2eecc2)+_0xabaf('0x12')]=this[_0xabaf('0x10')]['id'];}_0x51c043[_[_0xabaf('0x11')](_0x2eecc2)+_0xabaf('0x13')]=this[_0xabaf('0x6')]['id'];if(this[_0xabaf('0x6')][_0xabaf('0x14')]){var _0x302a11=_0x16e734[0x4];if(!_[_0xabaf('0x15')](_0x302a11)){_0x51c043[_0xabaf('0x16')]=utils[_0xabaf('0x17')](_0x302a11,this);return rpc[_0x2eecc2+'Message'][_0xabaf('0x18')](_0x51c043)[_0xabaf('0x19')](function(_0x22ed8c){logger[_0xabaf('0x1a')](_0xabaf('0x7'),_0x5a1814,_0x51c043['body']);})[_0xabaf('0x1b')](function(_0x296ccb){logger[_0xabaf('0x1c')](_0xabaf('0x7'),_0x5a1814,JSON[_0xabaf('0x1d')](_0x296ccb));})['finally'](function(){logger[_0xabaf('0x1a')](_0xabaf('0x1e'),_0x5a1814);_0x205bd6[_0xabaf('0x1f')]();});}else{logger[_0xabaf('0x1a')](_0xabaf('0x20'),_0x5a1814);_0x205bd6[_0xabaf('0x1f')]();}}else{var _0x5d0e13=this;var _0x3755c7=new AWS[(_0xabaf('0x21'))]({'accessKeyId':_0x16e734[0x0],'secretAccessKey':_0x16e734[0x1],'region':_0x16e734[0x2]});var _0x21c0d9={'botAlias':_0xabaf('0x22'),'botName':_0x16e734[0x3],'inputText':this[_0xabaf('0x23')][_0xabaf('0x16')],'userId':this[_0xabaf('0x6')]['id']['toString']()};_0x3755c7[_0xabaf('0x24')](_0x21c0d9,function(_0x48dd6a,_0x41131d){if(_0x48dd6a){logger[_0xabaf('0x1c')](_0xabaf('0x7'),_0x5a1814,_0x48dd6a[_0xabaf('0x23')]);_0x205bd6[_0xabaf('0x9')]();}else if(_0x41131d&&_0x41131d[_0xabaf('0x23')]){_0x5d0e13[_0xabaf('0x16')]['amazonlex']=_0x41131d;_0x51c043[_0xabaf('0x16')]=_0x41131d['message'];return rpc[_0x2eecc2+_0xabaf('0x25')][_0xabaf('0x18')](_0x51c043)[_0xabaf('0x19')](function(_0x166abb){logger[_0xabaf('0x1a')]('[%s][AMAZONLEX]\x20%s',_0x5a1814,_0x51c043['body']);if(_0x41131d[_0xabaf('0x26')]=='Failed'){_0x205bd6[_0xabaf('0x9')]();}else{_0x205bd6[_0xabaf('0x1f')]();}})['catch'](function(_0x3bf15f){logger['error']('[%s][AMAZONLEX]\x20%s',_0x5a1814,JSON[_0xabaf('0x1d')](_0x3bf15f));_0x205bd6[_0xabaf('0x9')]();});}else{_0x205bd6[_0xabaf('0x9')]();}});}}catch(_0x37d9b2){logger['error'](_0xabaf('0x7'),_0x5a1814,JSON['stringify'](_0x37d9b2));_0x205bd6[_0xabaf('0x1f')]();}};}; \ 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 016ea34..ca031e8 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 _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 +var _0x9c44=['message','from','phone','read','subject','startsWith','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','mail','service','host','Smtp','secure','authentication','user','pass','inReplyTo','messageId','html','','replace','body','','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','then','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','next','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../mailRpc','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','channel','getMustacheRender','contact','out'];(function(_0x5d4876,_0x11e6b0){var _0x6927ac=function(_0x2e9a3a){while(--_0x2e9a3a){_0x5d4876['push'](_0x5d4876['shift']());}};_0x6927ac(++_0x11e6b0);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require(_0x49c4('0x0'));var logger=require(_0x49c4('0x1'))(_0x49c4('0x2'));var rpc={'chatMessage':require(_0x49c4('0x3')),'openchannelMessage':require(_0x49c4('0x4')),'mailMessage':require(_0x49c4('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage')};var mailRpc=require(_0x49c4('0x6'));exports['consequence']=function(_0xc1278f,_0x6030ae){return function(_0x69bc41){try{if(_0x6030ae[0x0]==='1'&&(_[_0x49c4('0x7')](this[_0x49c4('0x8')]['created'])||!this[_0x49c4('0x8')][_0x49c4('0x9')])){logger[_0x49c4('0xa')](_0x49c4('0xb'),_0xc1278f,'Autoreply\x20already\x20sent');return _0x69bc41['next']();}var _0x451ea6=this[_0x49c4('0xc')];var _0x58cad7={'body':utils[_0x49c4('0xd')](_0x6030ae[0x1],this),'ContactId':this[_0x49c4('0xe')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x49c4('0xf')};if(this[_0x49c4('0x10')]){_0x58cad7['to']=this['message'][_0x49c4('0x11')]||'';_0x58cad7['cc']=this[_0x49c4('0x10')]['cc']||'';_0x58cad7['from']=this[_0x49c4('0x10')]['to']||'';_0x58cad7[_0x49c4('0x12')]=this[_0x49c4('0x10')][_0x49c4('0x12')]||'';_0x58cad7[_0x49c4('0x13')]=!![];if(this[_0x49c4('0x10')][_0x49c4('0x14')]){_0x58cad7[_0x49c4('0x14')]='';_0x58cad7['subject']+=_[_0x49c4('0x15')](this[_0x49c4('0x10')][_0x49c4('0x14')],_0x49c4('0x16'))?'':_0x49c4('0x17');_0x58cad7['subject']+=this[_0x49c4('0x10')][_0x49c4('0x14')];}}if(this['channel']==='chat'){_0x58cad7[_0x49c4('0x18')]=this[_0x49c4('0x19')]['id'];}else{_0x58cad7[_[_0x49c4('0x1a')](this['channel'])+_0x49c4('0x1b')]=this['account']['id'];}_0x58cad7[_[_0x49c4('0x1a')](this[_0x49c4('0xc')])+_0x49c4('0x1c')]=this[_0x49c4('0x8')]['id'];if(rpc[this[_0x49c4('0xc')]+_0x49c4('0x1d')]){if(this[_0x49c4('0xc')]===_0x49c4('0x1e')){var _0x2197d2={'tls':{'rejectUnauthorized':![]}};if(this['account']['Smtp']['service']){_0x2197d2[_0x49c4('0x1f')]=this['account']['Smtp'][_0x49c4('0x1f')];}else{_0x2197d2[_0x49c4('0x20')]=this[_0x49c4('0x19')][_0x49c4('0x21')]['host'];_0x2197d2['port']=this[_0x49c4('0x19')][_0x49c4('0x21')]['port'];_0x2197d2[_0x49c4('0x22')]=this[_0x49c4('0x19')][_0x49c4('0x21')][_0x49c4('0x22')];}if(this['account']['Smtp'][_0x49c4('0x23')]){_0x2197d2['auth']={'user':this[_0x49c4('0x19')][_0x49c4('0x21')][_0x49c4('0x24')],'pass':this[_0x49c4('0x19')]['Smtp'][_0x49c4('0x25')]};}_0x58cad7[_0x49c4('0x26')]=this[_0x49c4('0x10')][_0x49c4('0x27')];_0x58cad7[_0x49c4('0x28')]=_0x49c4('0x29')+_[_0x49c4('0x2a')](_0x58cad7[_0x49c4('0x2b')],_0x49c4('0x2c'),_0x49c4('0x2d'))+_0x49c4('0x2e');return mailRpc['sendMailMessage'](_0x2197d2,_0x58cad7)['then'](function(_0x59eb84){logger[_0x49c4('0xa')](_0x49c4('0x2f'),_0xc1278f);_0x58cad7[_0x49c4('0x27')]=_0x59eb84[_0x49c4('0x10')][_0x49c4('0x27')];return rpc[_0x451ea6+'Message'][_0x49c4('0x30')](_0x58cad7);})[_0x49c4('0x31')](function(_0x2e7a69){logger[_0x49c4('0xa')]('[%s][AUTOREPLY]\x20%s',_0xc1278f,JSON['stringify'](_0x2e7a69));})[_0x49c4('0x32')](function(_0x9a1bed){logger[_0x49c4('0x33')](_0x49c4('0x34'),_0xc1278f,JSON[_0x49c4('0x35')](_0x9a1bed));})['finally'](function(){_0x69bc41[_0x49c4('0x36')]();});}else{return rpc[this[_0x49c4('0xc')]+_0x49c4('0x1d')]['create'](_0x58cad7)['then'](function(_0x85dce2){logger[_0x49c4('0xa')](_0x49c4('0xb'),_0xc1278f,_0x58cad7[_0x49c4('0x2b')]);})[_0x49c4('0x32')](function(_0x2cf897){logger[_0x49c4('0x33')](_0x49c4('0xb'),_0xc1278f,JSON[_0x49c4('0x35')](_0x2cf897));})['finally'](function(){_0x69bc41[_0x49c4('0x36')]();});}}}catch(_0x5b96df){logger[_0x49c4('0x33')](_0x49c4('0xb'),_0xc1278f,JSON[_0x49c4('0x35')](_0x5b96df));_0x69bc41[_0x49c4('0x37')]();}};}; \ 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 3fc6c15..200d16b 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 _0x2ea1=['../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','stringify','finally','stop','error','[%s][CLOSE]\x20%s','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x7ee493,_0x2cc2cb){var _0x1f2c25=function(_0x243745){while(--_0x243745){_0x7ee493['push'](_0x7ee493['shift']());}};_0x1f2c25(++_0x2cc2cb);}(_0x2ea1,0xca));var _0x12ea=function(_0x192576,_0x52a594){_0x192576=_0x192576-0x0;var _0x44cc9a=_0x2ea1[_0x192576];return _0x44cc9a;};'use strict';var moment=require(_0x12ea('0x0'));var logger=require(_0x12ea('0x1'))(_0x12ea('0x2'));var rpc={'chatInteraction':require(_0x12ea('0x3')),'openchannelInteraction':require(_0x12ea('0x4')),'smsInteraction':require(_0x12ea('0x5')),'mailInteraction':require(_0x12ea('0x6')),'faxInteraction':require(_0x12ea('0x7'))};exports['consequence']=function(_0xe2a3db,_0x473244,_0x2f2b99,_0x551f0b){return function(_0x132217){try{logger[_0x12ea('0x8')](_0x12ea('0x9'),_0xe2a3db,_0x473244[0x0]);var _0x18108b={'closed':0x1,'closedAt':moment()[_0x12ea('0xa')](_0x12ea('0xb')),'closeReason':_0x12ea('0xc'),'disposition':_0x473244[0x0]};if(rpc[_0x551f0b['channel']+'Interaction']){rpc[_0x551f0b[_0x12ea('0xd')]+'Interaction'][_0x12ea('0xe')](_0x551f0b[_0x12ea('0xf')]['id'],_0x18108b)[_0x12ea('0x10')](function(_0x371d91){logger['info'](_0x12ea('0x11'),_0xe2a3db,_0x551f0b[_0x12ea('0xf')]['id']);})['catch'](function(_0xba3241){logger['error']('[%s][CLOSE]\x20%s',_0xe2a3db,JSON[_0x12ea('0x12')](_0xba3241));})[_0x12ea('0x13')](function(){_0x132217[_0x12ea('0x14')]();});}}catch(_0x25405b){logger[_0x12ea('0x15')](_0x12ea('0x16'),_0xe2a3db,JSON[_0x12ea('0x12')](_0x25405b));_0x132217[_0x12ea('0x14')]();}};}; \ No newline at end of file +var _0x8768=['moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','Interaction','channel','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','finally','stop'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x8768,0xa1));var _0x8876=function(_0x25e5ed,_0x3d1eb2){_0x25e5ed=_0x25e5ed-0x0;var _0x374160=_0x8768[_0x25e5ed];return _0x374160;};'use strict';var moment=require(_0x8876('0x0'));var logger=require(_0x8876('0x1'))(_0x8876('0x2'));var rpc={'chatInteraction':require(_0x8876('0x3')),'openchannelInteraction':require(_0x8876('0x4')),'smsInteraction':require(_0x8876('0x5')),'mailInteraction':require(_0x8876('0x6')),'faxInteraction':require(_0x8876('0x7'))};exports[_0x8876('0x8')]=function(_0x3b436f,_0x270336,_0x293a6f,_0x159d68){return function(_0x5431cb){try{logger[_0x8876('0x9')](_0x8876('0xa'),_0x3b436f,_0x270336[0x0]);var _0x42dbda={'closed':0x1,'closedAt':moment()[_0x8876('0xb')](_0x8876('0xc')),'closeReason':'system','disposition':_0x270336[0x0]};if(rpc[_0x159d68['channel']+_0x8876('0xd')]){rpc[_0x159d68[_0x8876('0xe')]+'Interaction']['update'](_0x159d68[_0x8876('0xf')]['id'],_0x42dbda)[_0x8876('0x10')](function(_0x477cf9){logger[_0x8876('0x9')](_0x8876('0x11'),_0x3b436f,_0x159d68[_0x8876('0xf')]['id']);})[_0x8876('0x12')](function(_0x4f17d0){logger[_0x8876('0x13')](_0x8876('0x14'),_0x3b436f,JSON['stringify'](_0x4f17d0));})[_0x8876('0x15')](function(){_0x5431cb[_0x8876('0x16')]();});}}catch(_0xbc531b){logger[_0x8876('0x13')](_0x8876('0x14'),_0x3b436f,JSON['stringify'](_0xbc531b));_0x5431cb[_0x8876('0x16')]();}};}; \ 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 1650034..5dce3b8 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 _0x60bc=['next','contact','YYYY-MM-DD\x20HH:mm:ss','out','chat','account','upperFirst','AccountId','created','getMustacheRender','Message','create','then','catch','error','stringify','finally','stop','message','body','result','speech','endConversation','lodash','moment','apiai-promise','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x60bc,0x137));var _0xc60b=function(_0xe4936,_0x3cd5c0){_0xe4936=_0xe4936-0x0;var _0x254fee=_0x60bc[_0xe4936];return _0x254fee;};'use strict';var _=require(_0xc60b('0x0'));var moment=require(_0xc60b('0x1'));var apiai=require(_0xc60b('0x2'));var md5=require('md5');var utils=require('./utils');var logger=require(_0xc60b('0x3'))(_0xc60b('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc60b('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xc60b('0x6'))};exports[_0xc60b('0x7')]=function(_0x3bc524,_0x53b525){return function(_0x1c0135){try{if(!_[_0xc60b('0x8')](this[_0xc60b('0x9')][_0xc60b('0xa')])){logger[_0xc60b('0xb')](_0xc60b('0xc'),_0x3bc524,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x1c0135[_0xc60b('0xd')]();}var _0x5f08f5={'ContactId':this[_0xc60b('0xe')]['id'],'sentAt':moment()['format'](_0xc60b('0xf')),'direction':_0xc60b('0x10')};var _0x31395e=this['channel'];if(_0x31395e===_0xc60b('0x11')){_0x5f08f5['ChatWebsiteId']=this[_0xc60b('0x12')]['id'];}else{_0x5f08f5[_[_0xc60b('0x13')](_0x31395e)+_0xc60b('0x14')]=this['account']['id'];}_0x5f08f5[_[_0xc60b('0x13')](_0x31395e)+'InteractionId']=this[_0xc60b('0x9')]['id'];if(this[_0xc60b('0x9')][_0xc60b('0x15')]){var _0x4641e0=_0x53b525[0x2];if(!_['isEmpty'](_0x4641e0)){_0x5f08f5['body']=utils[_0xc60b('0x16')](_0x4641e0,this);return rpc[_0x31395e+_0xc60b('0x17')][_0xc60b('0x18')](_0x5f08f5)[_0xc60b('0x19')](function(_0x1b0f9b){logger[_0xc60b('0xb')](_0xc60b('0xc'),_0x3bc524,_0x5f08f5['body']);})[_0xc60b('0x1a')](function(_0x4e3fa3){logger[_0xc60b('0x1b')]('[%s][DIALOGFLOW]\x20%s',_0x3bc524,JSON[_0xc60b('0x1c')](_0x4e3fa3));})[_0xc60b('0x1d')](function(){logger[_0xc60b('0xb')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x3bc524);_0x1c0135[_0xc60b('0x1e')]();});}else{logger[_0xc60b('0xb')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3bc524);_0x1c0135[_0xc60b('0x1e')]();}}else{var _0x5df0b8=this;var _0x3bcbba=apiai(_0x53b525[0x0],{'language':_0x53b525[0x1]||'en'});return _0x3bcbba['textRequest'](this[_0xc60b('0x1f')][_0xc60b('0x20')],{'sessionId':md5(this[_0xc60b('0x9')]['id'])})['then'](function(_0x357d00){_0x5df0b8['body']['dialogflow']=_0x357d00;_0x5f08f5['body']=_0x357d00[_0xc60b('0x21')]['fulfillment'][_0xc60b('0x22')];return rpc[_0x31395e+'Message']['create'](_0x5f08f5)['then'](function(_0x2ec8f1){logger[_0xc60b('0xb')]('[%s][DIALOGFLOW]\x20%s',_0x3bc524,_0x5f08f5[_0xc60b('0x20')]);if(_0x357d00['result']['metadata'][_0xc60b('0x23')]){_0x1c0135['next']();}else{_0x1c0135[_0xc60b('0x1e')]();}})[_0xc60b('0x1a')](function(_0x2c5dfa){logger[_0xc60b('0x1b')](_0xc60b('0xc'),_0x3bc524,JSON[_0xc60b('0x1c')](_0x2c5dfa));_0x1c0135[_0xc60b('0xd')]();});})[_0xc60b('0x1a')](function(_0x4b8ec2){logger[_0xc60b('0x1b')](_0xc60b('0xc'),_0x3bc524,_0x4b8ec2[_0xc60b('0x1f')]);_0x1c0135[_0xc60b('0xd')]();});}}catch(_0x3f774c){logger[_0xc60b('0x1b')](_0xc60b('0xc'),_0x3bc524,JSON[_0xc60b('0x1c')](_0x3f774c));_0x1c0135[_0xc60b('0x1e')]();}};}; \ No newline at end of file +var _0xed18=['create','metadata','endConversation','md5','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','info','[%s][DIALOGFLOW]\x20%s','next','contact','YYYY-MM-DD\x20HH:mm:ss','channel','ChatWebsiteId','upperFirst','account','InteractionId','interaction','created','getMustacheRender','Message','then','body','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','dialogflow','result','fulfillment','speech'];(function(_0x5db5b9,_0x10249a){var _0x19519e=function(_0x5a6141){while(--_0x5a6141){_0x5db5b9['push'](_0x5db5b9['shift']());}};_0x19519e(++_0x10249a);}(_0xed18,0xc1));var _0x8ed1=function(_0xa9db74,_0x45e441){_0xa9db74=_0xa9db74-0x0;var _0x3c8d7a=_0xed18[_0xa9db74];return _0x3c8d7a;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require('apiai-promise');var md5=require(_0x8ed1('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x8ed1('0x1')),'openchannelMessage':require(_0x8ed1('0x2')),'mailMessage':require(_0x8ed1('0x3')),'smsMessage':require(_0x8ed1('0x4')),'faxMessage':require(_0x8ed1('0x5'))};exports['consequence']=function(_0x4371f3,_0x2735c2){return function(_0x5a5909){try{if(!_[_0x8ed1('0x6')](this['interaction']['UserId'])){logger[_0x8ed1('0x7')](_0x8ed1('0x8'),_0x4371f3,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x5a5909[_0x8ed1('0x9')]();}var _0x1ff2cc={'ContactId':this[_0x8ed1('0xa')]['id'],'sentAt':moment()['format'](_0x8ed1('0xb')),'direction':'out'};var _0xb69e94=this[_0x8ed1('0xc')];if(_0xb69e94==='chat'){_0x1ff2cc[_0x8ed1('0xd')]=this['account']['id'];}else{_0x1ff2cc[_[_0x8ed1('0xe')](_0xb69e94)+'AccountId']=this[_0x8ed1('0xf')]['id'];}_0x1ff2cc[_[_0x8ed1('0xe')](_0xb69e94)+_0x8ed1('0x10')]=this[_0x8ed1('0x11')]['id'];if(this[_0x8ed1('0x11')][_0x8ed1('0x12')]){var _0xae9e77=_0x2735c2[0x2];if(!_['isEmpty'](_0xae9e77)){_0x1ff2cc['body']=utils[_0x8ed1('0x13')](_0xae9e77,this);return rpc[_0xb69e94+_0x8ed1('0x14')]['create'](_0x1ff2cc)[_0x8ed1('0x15')](function(_0x122222){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x4371f3,_0x1ff2cc[_0x8ed1('0x16')]);})[_0x8ed1('0x17')](function(_0x2593d1){logger[_0x8ed1('0x18')](_0x8ed1('0x8'),_0x4371f3,JSON[_0x8ed1('0x19')](_0x2593d1));})[_0x8ed1('0x1a')](function(){logger[_0x8ed1('0x7')](_0x8ed1('0x1b'),_0x4371f3);_0x5a5909[_0x8ed1('0x1c')]();});}else{logger[_0x8ed1('0x7')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x4371f3);_0x5a5909['stop']();}}else{var _0x547473=this;var _0x51a18e=apiai(_0x2735c2[0x0],{'language':_0x2735c2[0x1]||'en'});return _0x51a18e[_0x8ed1('0x1d')](this[_0x8ed1('0x1e')][_0x8ed1('0x16')],{'sessionId':md5(this['interaction']['id'])})['then'](function(_0x56f169){_0x547473['body'][_0x8ed1('0x1f')]=_0x56f169;_0x1ff2cc['body']=_0x56f169[_0x8ed1('0x20')][_0x8ed1('0x21')][_0x8ed1('0x22')];return rpc[_0xb69e94+_0x8ed1('0x14')][_0x8ed1('0x23')](_0x1ff2cc)[_0x8ed1('0x15')](function(_0x441be7){logger['info'](_0x8ed1('0x8'),_0x4371f3,_0x1ff2cc[_0x8ed1('0x16')]);if(_0x56f169[_0x8ed1('0x20')][_0x8ed1('0x24')][_0x8ed1('0x25')]){_0x5a5909[_0x8ed1('0x9')]();}else{_0x5a5909[_0x8ed1('0x1c')]();}})['catch'](function(_0x52bd63){logger[_0x8ed1('0x18')](_0x8ed1('0x8'),_0x4371f3,JSON['stringify'](_0x52bd63));_0x5a5909[_0x8ed1('0x9')]();});})['catch'](function(_0x37f171){logger[_0x8ed1('0x18')]('[%s][DIALOGFLOW]\x20%s',_0x4371f3,_0x37f171[_0x8ed1('0x1e')]);_0x5a5909[_0x8ed1('0x9')]();});}}catch(_0xb096b6){logger[_0x8ed1('0x18')](_0x8ed1('0x8'),_0x4371f3,JSON[_0x8ed1('0x19')](_0xb096b6));_0x5a5909[_0x8ed1('0x1c')]();}};}; \ 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 c2db94b..e4a38b8 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 _0xd536=['condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','consequence','fromString','getMustacheRender','map','message','join','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','error','[%s][GOTOIF]\x20%s','stringify','validate','lodash','./utils','../../../../config/logger','string'];(function(_0x350258,_0x4e0a50){var _0x3714b3=function(_0x8918f7){while(--_0x8918f7){_0x350258['push'](_0x350258['shift']());}};_0x3714b3(++_0x4e0a50);}(_0xd536,0x78));var _0x6d53=function(_0x230926,_0x5bc64c){_0x230926=_0x230926-0x0;var _0x50eb96=_0xd536[_0x230926];return _0x50eb96;};'use strict';var schema=require(_0x6d53('0x0'));var _=require(_0x6d53('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x6d53('0x2'));var logger=require(_0x6d53('0x3'))('routing');var gotoif=schema({'condition':{'type':_0x6d53('0x4'),'required':!![],'message':_0x6d53('0x5')},'priorityTrue':{'type':'number','message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x6d53('0x6'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x6d53('0x7')]=function(_0x22cf5c,_0x133b77){return function(_0x136cad){try{var _0x4ce3ce={'condition':htmlToText[_0x6d53('0x8')](utils[_0x6d53('0x9')](_0x133b77[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x133b77[0x1],'priorityFalse':_0x133b77[0x2]};var _0x470129=gotoif[_0x6d53('0x0')](_0x4ce3ce,{'typecast':!![]});if(_0x470129['length']){logger['error']('[%s][GOTOIF]\x20%s',_0x22cf5c,_[_0x6d53('0xa')](_0x470129,_0x6d53('0xb'))[_0x6d53('0xc')](',\x20'));_0x136cad[_0x6d53('0xd')]();}else{try{var _0x297c72=eval('('+_0x4ce3ce[_0x6d53('0xe')]+')');var _0x40f267=_0x297c72?_0x4ce3ce[_0x6d53('0xf')]:_0x4ce3ce['priorityFalse'];logger[_0x6d53('0x10')](_0x6d53('0x11'),_0x22cf5c,_0x4ce3ce[_0x6d53('0xe')],_0x297c72,_0x40f267||_0x6d53('0x12'));if(_0x40f267){var _0x1b51be=_[_0x6d53('0x13')](_0x136cad[_0x6d53('0x14')](),{'p':_0x40f267});if(_0x1b51be>=0x0){logger[_0x6d53('0x10')](_0x6d53('0x15'),_0x22cf5c,_0x40f267||_0x6d53('0x12'),_0x1b51be);_0x136cad[_0x6d53('0x12')](_0x1b51be);}else{logger[_0x6d53('0x10')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x22cf5c,_0x40f267||'next');_0x136cad[_0x6d53('0xd')]();}}else{_0x136cad[_0x6d53('0x12')]();}}catch(_0x50d6c1){logger[_0x6d53('0x16')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x22cf5c,_0x50d6c1[_0x6d53('0xb')]);_0x136cad[_0x6d53('0xd')]();}}}catch(_0x3d17ab){logger[_0x6d53('0x16')](_0x6d53('0x17'),_0x22cf5c,JSON[_0x6d53('0x18')](_0x3d17ab));_0x136cad[_0x6d53('0xd')]();}};}; \ No newline at end of file +var _0x0eab=['priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify','validate','lodash','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x0eab,0xe1));var _0xb0ea=function(_0x10758e,_0xff099f){_0x10758e=_0x10758e-0x0;var _0xa39bf8=_0x0eab[_0x10758e];return _0xa39bf8;};'use strict';var schema=require(_0xb0ea('0x0'));var _=require(_0xb0ea('0x1'));var htmlToText=require('html-to-text');var utils=require('./utils');var logger=require(_0xb0ea('0x2'))(_0xb0ea('0x3'));var gotoif=schema({'condition':{'type':_0xb0ea('0x4'),'required':!![],'message':_0xb0ea('0x5')},'priorityTrue':{'type':_0xb0ea('0x6'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xb0ea('0x6'),'message':_0xb0ea('0x7')}});exports[_0xb0ea('0x8')]=function(_0x1f4a3e,_0x1b949b){return function(_0x2061a2){try{var _0xc8de06={'condition':htmlToText[_0xb0ea('0x9')](utils[_0xb0ea('0xa')](_0x1b949b[0x0],this),{'wordwrap':![]})[_0xb0ea('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1b949b[0x1],'priorityFalse':_0x1b949b[0x2]};var _0x2d48fa=gotoif[_0xb0ea('0x0')](_0xc8de06,{'typecast':!![]});if(_0x2d48fa[_0xb0ea('0xc')]){logger[_0xb0ea('0xd')]('[%s][GOTOIF]\x20%s',_0x1f4a3e,_['map'](_0x2d48fa,_0xb0ea('0xe'))[_0xb0ea('0xf')](',\x20'));_0x2061a2[_0xb0ea('0x10')]();}else{try{var _0xe67a5d=eval('('+_0xc8de06[_0xb0ea('0x11')]+')');var _0x28ae6d=_0xe67a5d?_0xc8de06[_0xb0ea('0x12')]:_0xc8de06[_0xb0ea('0x13')];logger[_0xb0ea('0x14')](_0xb0ea('0x15'),_0x1f4a3e,_0xc8de06[_0xb0ea('0x11')],_0xe67a5d,_0x28ae6d||_0xb0ea('0x16'));if(_0x28ae6d){var _0x42e7c6=_[_0xb0ea('0x17')](_0x2061a2['rules'](),{'p':_0x28ae6d});if(_0x42e7c6>=0x0){logger[_0xb0ea('0x14')](_0xb0ea('0x18'),_0x1f4a3e,_0x28ae6d||'next',_0x42e7c6);_0x2061a2['next'](_0x42e7c6);}else{logger[_0xb0ea('0x14')](_0xb0ea('0x19'),_0x1f4a3e,_0x28ae6d||'next');_0x2061a2[_0xb0ea('0x10')]();}}else{_0x2061a2['next']();}}catch(_0x18dd0a){logger[_0xb0ea('0xd')](_0xb0ea('0x1a'),_0x1f4a3e,_0x18dd0a['message']);_0x2061a2[_0xb0ea('0x10')]();}}}catch(_0x3d720a){logger[_0xb0ea('0xd')](_0xb0ea('0x1b'),_0x1f4a3e,JSON[_0xb0ea('0x1c')](_0x3d720a));_0x2061a2[_0xb0ea('0x10')]();}};}; \ 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 f4432f6..57d5c92 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 _0x5fd4=['stringify','validate','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next'];(function(_0x289e48,_0x2fe387){var _0x56d497=function(_0x2abb13){while(--_0x2abb13){_0x289e48['push'](_0x289e48['shift']());}};_0x56d497(++_0x2fe387);}(_0x5fd4,0x1a3));var _0x45fd=function(_0x39a4f6,_0x4df9ba){_0x39a4f6=_0x39a4f6-0x0;var _0x519758=_0x5fd4[_0x39a4f6];return _0x519758;};'use strict';var schema=require(_0x45fd('0x0'));var _=require('lodash');var logger=require(_0x45fd('0x1'))(_0x45fd('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x45fd('0x3')}});exports['consequence']=function(_0x64c6b7,_0x11257c){return function(_0x34b6e1){try{var _0x13e183={'priority':_0x11257c[0x0]};var _0x5c9af2=gotop['validate'](_0x13e183,{'typecast':!![]});if(_0x5c9af2[_0x45fd('0x4')]){logger[_0x45fd('0x5')](_0x45fd('0x6'),_0x64c6b7,_[_0x45fd('0x7')](_0x5c9af2,'message')[_0x45fd('0x8')](',\x20'));_0x34b6e1[_0x45fd('0x9')]();}else{logger['info'](_0x45fd('0xa'),_0x64c6b7,_0x13e183[_0x45fd('0xb')]);if(_0x13e183['priority']){var _0x53eb30=_[_0x45fd('0xc')](_0x34b6e1[_0x45fd('0xd')](),{'p':_0x13e183['priority']});if(_0x53eb30>=0x0){logger[_0x45fd('0xe')](_0x45fd('0xf'),_0x64c6b7,_0x13e183[_0x45fd('0xb')]||'next',_0x53eb30);_0x34b6e1['next'](_0x53eb30);}else{logger[_0x45fd('0xe')](_0x45fd('0x10'),_0x64c6b7,_0x13e183[_0x45fd('0xb')]||_0x45fd('0x11'));_0x34b6e1[_0x45fd('0x9')]();}}else{_0x34b6e1[_0x45fd('0x11')]();}}}catch(_0x50c731){logger['error'](_0x45fd('0x6'),_0x64c6b7,JSON[_0x45fd('0x12')](_0x50c731));_0x34b6e1[_0x45fd('0x9')]();}};}; \ No newline at end of file +var _0xb9c6=['findIndex','priority','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xb9c6,0xc4));var _0x6b9c=function(_0x24232a,_0x11de97){_0x24232a=_0x24232a-0x0;var _0x54f410=_0xb9c6[_0x24232a];return _0x54f410;};'use strict';var schema=require(_0x6b9c('0x0'));var _=require(_0x6b9c('0x1'));var logger=require(_0x6b9c('0x2'))(_0x6b9c('0x3'));var gotop=schema({'priority':{'type':_0x6b9c('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x6b9c('0x5')]=function(_0x3c6661,_0x264fea){return function(_0x52d69c){try{var _0x32e54b={'priority':_0x264fea[0x0]};var _0xc1fc4b=gotop[_0x6b9c('0x0')](_0x32e54b,{'typecast':!![]});if(_0xc1fc4b[_0x6b9c('0x6')]){logger[_0x6b9c('0x7')](_0x6b9c('0x8'),_0x3c6661,_[_0x6b9c('0x9')](_0xc1fc4b,_0x6b9c('0xa'))[_0x6b9c('0xb')](',\x20'));_0x52d69c[_0x6b9c('0xc')]();}else{logger['info'](_0x6b9c('0xd'),_0x3c6661,_0x32e54b['priority']);if(_0x32e54b['priority']){var _0x570af2=_[_0x6b9c('0xe')](_0x52d69c['rules'](),{'p':_0x32e54b[_0x6b9c('0xf')]});if(_0x570af2>=0x0){logger[_0x6b9c('0x10')](_0x6b9c('0x11'),_0x3c6661,_0x32e54b[_0x6b9c('0xf')]||_0x6b9c('0x12'),_0x570af2);_0x52d69c['next'](_0x570af2);}else{logger[_0x6b9c('0x10')](_0x6b9c('0x13'),_0x3c6661,_0x32e54b['priority']||_0x6b9c('0x12'));_0x52d69c['stop']();}}else{_0x52d69c['next']();}}}catch(_0x2b5e4e){logger['error'](_0x6b9c('0x8'),_0x3c6661,JSON[_0x6b9c('0x14')](_0x2b5e4e));_0x52d69c[_0x6b9c('0xc')]();}};}; \ 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 921fc8e..9fa2fa5 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 _0x4e74=['upperFirst','InteractionId','Message','create','then','body','next','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','./utils','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','getMustacheRender','channel','chat','ChatWebsiteId','account','AccountId'];(function(_0x3c664e,_0x5e41cb){var _0x52a5ad=function(_0x9111e6){while(--_0x9111e6){_0x3c664e['push'](_0x3c664e['shift']());}};_0x52a5ad(++_0x5e41cb);}(_0x4e74,0x1bc));var _0x44e7=function(_0x14e9f0,_0x287f90){_0x14e9f0=_0x14e9f0-0x0;var _0xa63f7e=_0x4e74[_0x14e9f0];return _0xa63f7e;};'use strict';var _=require('lodash');var utils=require(_0x44e7('0x0'));var logger=require('../../../../config/logger')(_0x44e7('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x44e7('0x2')),'mailMessage':require(_0x44e7('0x3')),'smsMessage':require(_0x44e7('0x4')),'faxMessage':require('../../rpc/faxMessage')};exports[_0x44e7('0x5')]=function(_0x12c61e,_0x5e880f){return function(_0x4aed63){try{var _0x2dbfe0={'body':utils[_0x44e7('0x6')](_0x5e880f[0x0],this),'ContactId':this['contact']['id']};if(this[_0x44e7('0x7')]===_0x44e7('0x8')){_0x2dbfe0[_0x44e7('0x9')]=this[_0x44e7('0xa')]['id'];}else{_0x2dbfe0[_['upperFirst'](this[_0x44e7('0x7')])+_0x44e7('0xb')]=this[_0x44e7('0xa')]['id'];}_0x2dbfe0[_[_0x44e7('0xc')](this['channel'])+_0x44e7('0xd')]=this['interaction']['id'];if(rpc[this[_0x44e7('0x7')]+_0x44e7('0xe')]){return rpc[this[_0x44e7('0x7')]+_0x44e7('0xe')][_0x44e7('0xf')](_0x2dbfe0)[_0x44e7('0x10')](function(_0x36fb99){logger['info']('[%s][MESSAGE]\x20%s',_0x12c61e,_0x2dbfe0[_0x44e7('0x11')]);_0x4aed63[_0x44e7('0x12')]();})[_0x44e7('0x13')](function(_0x45e819){logger[_0x44e7('0x14')](_0x44e7('0x15'),_0x12c61e,JSON[_0x44e7('0x16')](_0x45e819));_0x4aed63['stop']();});}}catch(_0x487431){logger[_0x44e7('0x14')](_0x44e7('0x15'),_0x12c61e,JSON[_0x44e7('0x16')](_0x487431));_0x4aed63[_0x44e7('0x17')]();}};}; \ No newline at end of file +var _0x4aa1=['account','upperFirst','AccountId','InteractionId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stop','stringify','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','channel','chat','ChatWebsiteId'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x4aa1,0x127));var _0x14aa=function(_0x27e1d6,_0x556395){_0x27e1d6=_0x27e1d6-0x0;var _0x5d6dbd=_0x4aa1[_0x27e1d6];return _0x5d6dbd;};'use strict';var _=require(_0x14aa('0x0'));var utils=require(_0x14aa('0x1'));var logger=require('../../../../config/logger')(_0x14aa('0x2'));var rpc={'chatMessage':require(_0x14aa('0x3')),'openchannelMessage':require(_0x14aa('0x4')),'mailMessage':require(_0x14aa('0x5')),'smsMessage':require(_0x14aa('0x6')),'faxMessage':require(_0x14aa('0x7'))};exports[_0x14aa('0x8')]=function(_0x3865dd,_0x32c6bd){return function(_0x5389d1){try{var _0x5cb6b9={'body':utils[_0x14aa('0x9')](_0x32c6bd[0x0],this),'ContactId':this['contact']['id']};if(this[_0x14aa('0xa')]===_0x14aa('0xb')){_0x5cb6b9[_0x14aa('0xc')]=this[_0x14aa('0xd')]['id'];}else{_0x5cb6b9[_[_0x14aa('0xe')](this[_0x14aa('0xa')])+_0x14aa('0xf')]=this[_0x14aa('0xd')]['id'];}_0x5cb6b9[_['upperFirst'](this['channel'])+_0x14aa('0x10')]=this[_0x14aa('0x11')]['id'];if(rpc[this[_0x14aa('0xa')]+_0x14aa('0x12')]){return rpc[this[_0x14aa('0xa')]+_0x14aa('0x12')]['create'](_0x5cb6b9)[_0x14aa('0x13')](function(_0x27ee97){logger[_0x14aa('0x14')](_0x14aa('0x15'),_0x3865dd,_0x5cb6b9[_0x14aa('0x16')]);_0x5389d1[_0x14aa('0x17')]();})[_0x14aa('0x18')](function(_0xd93dd8){logger[_0x14aa('0x19')]('[%s][MESSAGE]\x20%s',_0x3865dd,JSON['stringify'](_0xd93dd8));_0x5389d1[_0x14aa('0x1a')]();});}}catch(_0x5e8dd6){logger[_0x14aa('0x19')](_0x14aa('0x15'),_0x3865dd,JSON[_0x14aa('0x1b')](_0x5e8dd6));_0x5389d1[_0x14aa('0x1a')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index f43bd83..bc76ad2 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 _0xc329=['../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','stop','./utils'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xc329,0x1c1));var _0x9c32=function(_0x2afbb0,_0x44f16d){_0x2afbb0=_0x2afbb0-0x0;var _0x411ff2=_0xc329[_0x2afbb0];return _0x411ff2;};'use strict';var utils=require(_0x9c32('0x0'));var logger=require(_0x9c32('0x1'))(_0x9c32('0x2'));exports[_0x9c32('0x3')]=function(_0x5b6770,_0x2f3005){return function(_0x537707){try{logger[_0x9c32('0x4')](_0x9c32('0x5'),_0x5b6770,utils[_0x9c32('0x6')](_0x2f3005[0x0],this));_0x537707[_0x9c32('0x7')]();}catch(_0x1ee98e){logger['error'](_0x9c32('0x5'),_0x5b6770,JSON['stringify'](_0x1ee98e));_0x537707[_0x9c32('0x8')]();}};}; \ No newline at end of file +var _0x10a0=['error','stringify','stop','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x10a0,0xd5));var _0x010a=function(_0x5a6d15,_0x20cf6c){_0x5a6d15=_0x5a6d15-0x0;var _0xd88e08=_0x10a0[_0x5a6d15];return _0xd88e08;};'use strict';var utils=require('./utils');var logger=require(_0x010a('0x0'))(_0x010a('0x1'));exports[_0x010a('0x2')]=function(_0x55e10d,_0x5a828){return function(_0x2ca664){try{logger[_0x010a('0x3')](_0x010a('0x4'),_0x55e10d,utils[_0x010a('0x5')](_0x5a828[0x0],this));_0x2ca664[_0x010a('0x6')]();}catch(_0x49aa02){logger[_0x010a('0x7')]('[%s][NOOP]\x20%s',_0x55e10d,JSON[_0x010a('0x8')](_0x49aa02));_0x2ca664[_0x010a('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 64fa93f..f1e8b93 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 _0x83fd=['body','from','YYYY-MM-DD\x20HH:mm:ss','list','channel','QueueId','upperFirst','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','update','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','timeout','createQueue','atimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','util','seq-queue','moment','../../../../config/logger','routing','./strategy','defaults','redis','localhost','socket.io-emitter','queue_id','account','queue','joinAt','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting'];(function(_0x2c908c,_0x4bef8a){var _0x51db86=function(_0x2ea562){while(--_0x2ea562){_0x2c908c['push'](_0x2c908c['shift']());}};_0x51db86(++_0x4bef8a);}(_0x83fd,0xbd));var _0xd83f=function(_0x198ddf,_0x262489){_0x198ddf=_0x198ddf-0x0;var _0x4a35ee=_0x83fd[_0x198ddf];return _0x4a35ee;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0xd83f('0x0'));var seqqueue=require(_0xd83f('0x1'));var moment=require(_0xd83f('0x2'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0xd83f('0x3'))(_0xd83f('0x4'));var strategy=require(_0xd83f('0x5'));config['redis']=_[_0xd83f('0x6')](config[_0xd83f('0x7')],{'host':_0xd83f('0x8'),'port':0x18eb});var io=require(_0xd83f('0x9'))(new Redis(config[_0xd83f('0x7')]));var attributes=['id',_0xd83f('0xa'),_0xd83f('0xb'),_0xd83f('0xc'),'from',_0xd83f('0xd')];function emit(_0x4d00bd,_0x246c1e,_0x53b0c4){io['to'](_0x4d00bd)['emit'](_0x246c1e,_0x53b0c4);}function emitChannelQueueInteraction(_0x1eb02d,_0x1b3516,_0x21b526,_0x335884,_0x119241,_0x13c4e0,_0x563178,_0x300e19){_0x21b526[_0xd83f('0xa')]=_0x300e19;_0x21b526[_0xd83f('0xc')]=_0x1b3516;_0x21b526[_0xd83f('0xb')]=_0x335884;_0x21b526['id']=_0x119241;if(_0x13c4e0){_0x563178[util[_0xd83f('0xe')]('%sQueuesWaitingInteractions',_0x1eb02d)][_0x119241]=_[_0xd83f('0xf')](_0x21b526,attributes);}else{delete _0x563178[util[_0xd83f('0xe')](_0xd83f('0x10'),_0x1eb02d)][_0x119241];}emit(util['format'](_0xd83f('0x11'),_0x1eb02d,_0x1b3516),util[_0xd83f('0xe')](_0xd83f('0x12'),_0x1eb02d,_0x13c4e0?'save':'remove'),_[_0xd83f('0xf')](_0x21b526,attributes));}var rpc={'openchannelQueueReport':require(_0xd83f('0x13')),'mailQueueReport':require(_0xd83f('0x14')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xd83f('0x15'))};var queue=schema({'name':{'type':_0xd83f('0x16'),'required':!![],'message':_0xd83f('0x17')},'timeout':{'type':_0xd83f('0x18'),'message':_0xd83f('0x19')}});function startRouting(_0x5e613e,_0x1baa2e,_0x381f14,_0x52447b){if(_0x5e613e&&_0x1baa2e&&_0x381f14){_0x1baa2e[_0xd83f('0x1a')]+=0x1;var _0x30404c={'uniqueid':_0x5e613e,'from':_0x381f14[_0xd83f('0x1b')]?_0x381f14['body'][_0xd83f('0x1c')]:'','joinAt':moment()[_0xd83f('0xe')](_0xd83f('0x1d')),'ContactId':_0x381f14['contact']?_0x381f14['contact']['id']:null,'ListId':_0x381f14[_0xd83f('0x1e')]?_0x381f14['list']['id']:null};_0x30404c[_['upperFirst'](_0x381f14[_0xd83f('0x1f')])+_0xd83f('0x20')]=_0x1baa2e['id']||null;_0x30404c[_[_0xd83f('0x21')](_0x381f14[_0xd83f('0x1f')])+'InteractionId']=_0x381f14[_0xd83f('0x22')]?_0x381f14['interaction']['id']:null;_0x30404c[_[_0xd83f('0x21')](_0x381f14['channel'])+_0xd83f('0x23')]=_0x381f14[_0xd83f('0x24')]?_0x381f14[_0xd83f('0x24')]['id']:null;_0x30404c[_[_0xd83f('0x21')](_0x381f14['channel'])+(_0x381f14['channel']!==_0xd83f('0x25')?_0xd83f('0x26'):_0xd83f('0x27'))]=_0x381f14['account']?_0x381f14['account']['id']:null;logger[_0xd83f('0x28')](util[_0xd83f('0xe')](_0xd83f('0x29'),_0x5e613e,_0x1baa2e['name']));emitChannelQueueInteraction(_0x381f14['channel'],_0x1baa2e[_0xd83f('0x2a')],_0x30404c,_0x381f14[_0xd83f('0xb')][_0xd83f('0x2a')],_0x381f14['message']['id'],!![],_0x52447b,_0x1baa2e['id']);if(rpc[_0x381f14[_0xd83f('0x1f')]+_0xd83f('0x2b')]){return rpc[_0x381f14[_0xd83f('0x1f')]+_0xd83f('0x2b')]['create'](_0x30404c)[_0xd83f('0x2c')](function(_0x179b6a){logger[_0xd83f('0x2d')](_0xd83f('0x2e'));});}}}function stopRouting(_0x51db22,_0x278901,_0xbfb2de,_0x3f7c54){if(_0x51db22&&_0x278901){_0x278901[_0xd83f('0x1a')]-=0x1;var _0x414573={'leaveAt':moment()[_0xd83f('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xd83f('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger[_0xd83f('0x28')](util[_0xd83f('0xe')](_0xd83f('0x2f'),_0x51db22,_0x278901[_0xd83f('0x2a')]));emitChannelQueueInteraction(_0xbfb2de[_0xd83f('0x1f')],_0x278901[_0xd83f('0x2a')],_0xbfb2de[_0xd83f('0x1b')],_0xbfb2de[_0xd83f('0xb')][_0xd83f('0x2a')],_0xbfb2de[_0xd83f('0x24')]['id'],![],_0x3f7c54,_0x278901['id']);if(rpc[_0xbfb2de[_0xd83f('0x1f')]+'QueueReport']){return rpc[_0xbfb2de['channel']+_0xd83f('0x2b')][_0xd83f('0x30')](_0x51db22,_0x414573)['catch'](function(_0x3f5071){logger[_0xd83f('0x2d')]('update\x20queue\x20report');});}}}function endRouting(_0x568991,_0x111ed2,_0x2f5208,_0x4e4530){if(_0x568991&&_0x111ed2){_0x111ed2[_0xd83f('0x1a')]-=0x1;var _0x5db8c8={'leaveAt':moment()[_0xd83f('0xe')](_0xd83f('0x1d')),'exitAt':moment()[_0xd83f('0xe')](_0xd83f('0x1d')),'reason':'timeout'};logger[_0xd83f('0x28')](util['format'](_0xd83f('0x31'),_0x568991,_0x111ed2[_0xd83f('0x2a')]));emitChannelQueueInteraction(_0x2f5208[_0xd83f('0x1f')],_0x111ed2['name'],_0x2f5208[_0xd83f('0x1b')],_0x2f5208[_0xd83f('0xb')][_0xd83f('0x2a')],_0x2f5208[_0xd83f('0x24')]['id'],![],_0x4e4530);if(rpc[_0x2f5208['channel']+_0xd83f('0x2b')]){return rpc[_0x2f5208['channel']+'QueueReport']['update'](_0x568991,_0x5db8c8)[_0xd83f('0x2c')](function(_0x4a06e6){logger[_0xd83f('0x2d')]('update\x20queue\x20report');});}}}function handleFindQueue(_0xc9956c){return function(_0x56564d){return _0x56564d[_0xd83f('0x2a')]['toLowerCase']()===_0xc9956c[_0xd83f('0x32')]();};}exports[_0xd83f('0x33')]=function(_0x22a203,_0x59afb6,_0x2c4d71,_0xe97a32){return function(_0x2858dd){try{var _0x2cc442={'name':_0x59afb6[0x0],'timeout':_0x59afb6[0x1]};var _0x14b613=queue[_0xd83f('0x34')](_0x2cc442,{'typecast':!![]});if(_0x14b613[_0xd83f('0x35')]){logger[_0xd83f('0x2d')](_0xd83f('0x36'),_0x22a203,_[_0xd83f('0x37')](_0x14b613,_0xd83f('0x24'))[_0xd83f('0x38')](',\x20'));_0x2858dd[_0xd83f('0x39')]();}else{var _0x292cbe=_[_0xd83f('0x3a')](_0x2c4d71[_0xe97a32[_0xd83f('0x1f')]+_0xd83f('0x3b')],handleFindQueue(_0x2cc442['name']));if(_0x292cbe){startRouting(_0x22a203,_0x292cbe,_0xe97a32,_0x2c4d71);var _0x2826b0=(_0x292cbe[_0xd83f('0x3c')]||0xa)*0x3e8;var _0x47ac06=(_0x2cc442[_0xd83f('0x3c')]||0x14)*0x3e8;var _0x52ee53,_0x484db7;if(_0x2826b0>_0x47ac06){_0x47ac06=_0x2826b0;}var _0x10e694=seqqueue[_0xd83f('0x3d')](_0x2826b0);_0x10e694['id']=_0x22a203;_0x10e694[_0xd83f('0x3e')]=_0x2826b0;_0x10e694['qtimeout']=_0x47ac06;_0x10e694[_0xd83f('0x1f')]=_0xe97a32['channel'];_0x2c4d71[_0xd83f('0x3f')][_0x22a203]['on']('end',function(){stopRouting(_0x22a203,_0x292cbe,_0xe97a32,_0x2c4d71);_0x10e694['close'](!![]);clearTimeout(_0x52ee53);_0x52ee53=undefined;if(_0x2c4d71[_0xd83f('0x3f')][_0x22a203]){delete _0x2c4d71[_0xd83f('0x3f')][_0x22a203];}logger['info'](_0xd83f('0x40'),_0x22a203);_0x2858dd[_0xd83f('0x39')]();});_0x52ee53=setTimeout(function(){endRouting(_0x22a203,_0x292cbe,_0xe97a32,_0x2c4d71);clearTimeout(_0x52ee53);_0x10e694['close'](!![]);logger[_0xd83f('0x28')]('[%s][QUEUE]\x20ROUTING\x20END',_0x22a203);_0x2858dd[_0xd83f('0x41')]();},_0x47ac06);switch(_0x292cbe[_0xd83f('0x42')]){case _0xd83f('0x43'):strategy[_0xd83f('0x43')](_0x10e694,_0x292cbe,_0x2c4d71,_0xe97a32);break;default:strategy[_0xd83f('0x44')](_0x10e694,_0x292cbe,_0x2c4d71,_0xe97a32);}}else{logger[_0xd83f('0x2d')](_0xd83f('0x45'),_0x22a203,_0x2cc442[_0xd83f('0x2a')]);_0x2858dd[_0xd83f('0x39')]();}}}catch(_0x55002c){console[_0xd83f('0x46')](_0x55002c);logger[_0xd83f('0x2d')](_0xd83f('0x36'),_0x22a203,_0x55002c[_0xd83f('0x47')]);_0x2858dd[_0xd83f('0x39')]();}};}; \ No newline at end of file +var _0x4458=['error','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','map','join','stop','Queues','timeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20ROUTING\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','defaults','localhost','socket.io-emitter','redis','queue_id','account','queue','from','joinAt','%sQueuesWaitingInteractions','format','%s:queue:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','body','contact','list','upperFirst','channel','InteractionId','interaction','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','waiting','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]'];(function(_0x4ba17b,_0x55f724){var _0x1f0669=function(_0x424ce2){while(--_0x424ce2){_0x4ba17b['push'](_0x4ba17b['shift']());}};_0x1f0669(++_0x55f724);}(_0x4458,0xf4));var _0x8445=function(_0x162639,_0x28c80e){_0x162639=_0x162639-0x0;var _0x5e60fa=_0x4458[_0x162639];return _0x5e60fa;};'use strict';var schema=require(_0x8445('0x0'));var _=require(_0x8445('0x1'));var util=require('util');var seqqueue=require(_0x8445('0x2'));var moment=require(_0x8445('0x3'));var Redis=require(_0x8445('0x4'));var config=require(_0x8445('0x5'));var logger=require(_0x8445('0x6'))(_0x8445('0x7'));var strategy=require(_0x8445('0x8'));config['redis']=_[_0x8445('0x9')](config['redis'],{'host':_0x8445('0xa'),'port':0x18eb});var io=require(_0x8445('0xb'))(new Redis(config[_0x8445('0xc')]));var attributes=['id',_0x8445('0xd'),_0x8445('0xe'),_0x8445('0xf'),_0x8445('0x10'),_0x8445('0x11')];function emit(_0x344b0e,_0x30052e,_0x348132){io['to'](_0x344b0e)['emit'](_0x30052e,_0x348132);}function emitChannelQueueInteraction(_0x329a75,_0x3b5bf0,_0xbf892e,_0xb319da,_0x2688ca,_0x466110,_0xb34ac9,_0x40e22c){_0xbf892e['queue_id']=_0x40e22c;_0xbf892e['queue']=_0x3b5bf0;_0xbf892e[_0x8445('0xe')]=_0xb319da;_0xbf892e['id']=_0x2688ca;if(_0x466110){_0xb34ac9[util['format'](_0x8445('0x12'),_0x329a75)][_0x2688ca]=_['pick'](_0xbf892e,attributes);}else{delete _0xb34ac9[util[_0x8445('0x13')]('%sQueuesWaitingInteractions',_0x329a75)][_0x2688ca];}emit(util[_0x8445('0x13')](_0x8445('0x14'),_0x329a75,_0x3b5bf0),util[_0x8445('0x13')]('%s_queue_waiting_interaction:%s',_0x329a75,_0x466110?_0x8445('0x15'):_0x8445('0x16')),_['pick'](_0xbf892e,attributes));}var rpc={'openchannelQueueReport':require(_0x8445('0x17')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x8445('0x18')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x8445('0x19'))};var queue=schema({'name':{'type':_0x8445('0x1a'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x8445('0x1b'),'message':_0x8445('0x1c')}});function startRouting(_0x4bfad3,_0x5b0edf,_0x23efe7,_0x218409){if(_0x4bfad3&&_0x5b0edf&&_0x23efe7){_0x5b0edf['waiting']+=0x1;var _0x365864={'uniqueid':_0x4bfad3,'from':_0x23efe7[_0x8445('0x1d')]?_0x23efe7['body'][_0x8445('0x10')]:'','joinAt':moment()[_0x8445('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x23efe7[_0x8445('0x1e')]?_0x23efe7[_0x8445('0x1e')]['id']:null,'ListId':_0x23efe7[_0x8445('0x1f')]?_0x23efe7['list']['id']:null};_0x365864[_[_0x8445('0x20')](_0x23efe7[_0x8445('0x21')])+'QueueId']=_0x5b0edf['id']||null;_0x365864[_['upperFirst'](_0x23efe7['channel'])+_0x8445('0x22')]=_0x23efe7[_0x8445('0x23')]?_0x23efe7[_0x8445('0x23')]['id']:null;_0x365864[_['upperFirst'](_0x23efe7[_0x8445('0x21')])+'MessageId']=_0x23efe7['message']?_0x23efe7[_0x8445('0x24')]['id']:null;_0x365864[_['upperFirst'](_0x23efe7[_0x8445('0x21')])+(_0x23efe7[_0x8445('0x21')]!==_0x8445('0x25')?_0x8445('0x26'):'WebsiteId')]=_0x23efe7[_0x8445('0xe')]?_0x23efe7[_0x8445('0xe')]['id']:null;logger[_0x8445('0x27')](util[_0x8445('0x13')](_0x8445('0x28'),_0x4bfad3,_0x5b0edf['name']));emitChannelQueueInteraction(_0x23efe7['channel'],_0x5b0edf[_0x8445('0x29')],_0x365864,_0x23efe7[_0x8445('0xe')]['name'],_0x23efe7['message']['id'],!![],_0x218409,_0x5b0edf['id']);if(rpc[_0x23efe7[_0x8445('0x21')]+_0x8445('0x2a')]){return rpc[_0x23efe7[_0x8445('0x21')]+_0x8445('0x2a')]['create'](_0x365864)[_0x8445('0x2b')](function(_0x22ec33){logger['error']('create\x20queue\x20report');});}}}function stopRouting(_0x3a810d,_0x1b6cc4,_0x41e733,_0x23e845){if(_0x3a810d&&_0x1b6cc4){_0x1b6cc4[_0x8445('0x2c')]-=0x1;var _0x505dfc={'leaveAt':moment()[_0x8445('0x13')](_0x8445('0x2d')),'acceptAt':moment()['format'](_0x8445('0x2d')),'reason':_0x8445('0x2e')};logger[_0x8445('0x27')](util[_0x8445('0x13')](_0x8445('0x2f'),_0x3a810d,_0x1b6cc4[_0x8445('0x29')]));emitChannelQueueInteraction(_0x41e733[_0x8445('0x21')],_0x1b6cc4[_0x8445('0x29')],_0x41e733[_0x8445('0x1d')],_0x41e733[_0x8445('0xe')]['name'],_0x41e733[_0x8445('0x24')]['id'],![],_0x23e845,_0x1b6cc4['id']);if(rpc[_0x41e733[_0x8445('0x21')]+'QueueReport']){return rpc[_0x41e733[_0x8445('0x21')]+_0x8445('0x2a')]['update'](_0x3a810d,_0x505dfc)[_0x8445('0x2b')](function(_0x31f022){logger[_0x8445('0x30')](_0x8445('0x31'));});}}}function endRouting(_0x2a14eb,_0x4f31de,_0x5e61be,_0x2606eb){if(_0x2a14eb&&_0x4f31de){_0x4f31de[_0x8445('0x2c')]-=0x1;var _0x55a05f={'leaveAt':moment()[_0x8445('0x13')](_0x8445('0x2d')),'exitAt':moment()['format'](_0x8445('0x2d')),'reason':'timeout'};logger[_0x8445('0x27')](util[_0x8445('0x13')](_0x8445('0x32'),_0x2a14eb,_0x4f31de[_0x8445('0x29')]));emitChannelQueueInteraction(_0x5e61be['channel'],_0x4f31de[_0x8445('0x29')],_0x5e61be[_0x8445('0x1d')],_0x5e61be['account'][_0x8445('0x29')],_0x5e61be[_0x8445('0x24')]['id'],![],_0x2606eb);if(rpc[_0x5e61be['channel']+_0x8445('0x2a')]){return rpc[_0x5e61be[_0x8445('0x21')]+_0x8445('0x2a')][_0x8445('0x33')](_0x2a14eb,_0x55a05f)[_0x8445('0x2b')](function(_0x32c123){logger[_0x8445('0x30')](_0x8445('0x31'));});}}}function handleFindQueue(_0x3c854e){return function(_0x333261){return _0x333261[_0x8445('0x29')][_0x8445('0x34')]()===_0x3c854e[_0x8445('0x34')]();};}exports[_0x8445('0x35')]=function(_0x13e8bd,_0x3a7e14,_0x8074da,_0x427491){return function(_0x5c8e1c){try{var _0x54518c={'name':_0x3a7e14[0x0],'timeout':_0x3a7e14[0x1]};var _0x2110d1=queue[_0x8445('0x0')](_0x54518c,{'typecast':!![]});if(_0x2110d1[_0x8445('0x36')]){logger['error']('[%s][QUEUE]\x20%s',_0x13e8bd,_[_0x8445('0x37')](_0x2110d1,_0x8445('0x24'))[_0x8445('0x38')](',\x20'));_0x5c8e1c[_0x8445('0x39')]();}else{var _0x5ef4bc=_['find'](_0x8074da[_0x427491[_0x8445('0x21')]+_0x8445('0x3a')],handleFindQueue(_0x54518c[_0x8445('0x29')]));if(_0x5ef4bc){startRouting(_0x13e8bd,_0x5ef4bc,_0x427491,_0x8074da);var _0x2e1ec9=(_0x5ef4bc[_0x8445('0x3b')]||0xa)*0x3e8;var _0x59eeae=(_0x54518c[_0x8445('0x3b')]||0x14)*0x3e8;var _0x39119b,_0x3e098e;if(_0x2e1ec9>_0x59eeae){_0x59eeae=_0x2e1ec9;}var _0x23e8b1=seqqueue['createQueue'](_0x2e1ec9);_0x23e8b1['id']=_0x13e8bd;_0x23e8b1['atimeout']=_0x2e1ec9;_0x23e8b1[_0x8445('0x3c')]=_0x59eeae;_0x23e8b1['channel']=_0x427491[_0x8445('0x21')];_0x8074da[_0x8445('0x3d')][_0x13e8bd]['on'](_0x8445('0x3e'),function(){stopRouting(_0x13e8bd,_0x5ef4bc,_0x427491,_0x8074da);_0x23e8b1['close'](!![]);clearTimeout(_0x39119b);_0x39119b=undefined;if(_0x8074da[_0x8445('0x3d')][_0x13e8bd]){delete _0x8074da[_0x8445('0x3d')][_0x13e8bd];}logger['info'](_0x8445('0x3f'),_0x13e8bd);_0x5c8e1c[_0x8445('0x39')]();});_0x39119b=setTimeout(function(){endRouting(_0x13e8bd,_0x5ef4bc,_0x427491,_0x8074da);clearTimeout(_0x39119b);_0x23e8b1['close'](!![]);logger[_0x8445('0x27')](_0x8445('0x40'),_0x13e8bd);_0x5c8e1c[_0x8445('0x41')]();},_0x59eeae);switch(_0x5ef4bc[_0x8445('0x42')]){case _0x8445('0x43'):strategy[_0x8445('0x43')](_0x23e8b1,_0x5ef4bc,_0x8074da,_0x427491);break;default:strategy[_0x8445('0x44')](_0x23e8b1,_0x5ef4bc,_0x8074da,_0x427491);}}else{logger[_0x8445('0x30')](_0x8445('0x45'),_0x13e8bd,_0x54518c[_0x8445('0x29')]);_0x5c8e1c[_0x8445('0x39')]();}}}catch(_0xb39e8d){console[_0x8445('0x46')](_0xb39e8d);logger['error'](_0x8445('0x47'),_0x13e8bd,_0xb39e8d[_0x8445('0x48')]);_0x5c8e1c[_0x8445('0x39')]();}};}; \ 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 e4f9305..6079ace 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 _0x9df6=['agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','squeue','realtime','push','handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','info','agent','isNil'];(function(_0x4c0d42,_0x1fdc54){var _0x3fdaee=function(_0x31d8b5){while(--_0x31d8b5){_0x4c0d42['push'](_0x4c0d42['shift']());}};_0x3fdaee(++_0x1fdc54);}(_0x9df6,0x1ca));var _0x69df=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x9df6[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x69df('0x0'));var uuid=require(_0x69df('0x1'));var util=require(_0x69df('0x2'));var logger=require(_0x69df('0x3'))(_0x69df('0x4'));var Agent=function(_0x4ea21d,_0x431498,_0x3a1c4c,_0x2e5da3){this['notificationId']=uuid['v4']();this[_0x69df('0x5')]=_0x4ea21d;this['agent']=_0x431498;this[_0x69df('0x6')]=_0x3a1c4c;this[_0x69df('0x4')]=_0x2e5da3;this[_0x69df('0x5')][_0x69df('0x7')](this[_0x69df('0x8')][_0x69df('0x9')](this),this['handleTimeout']['bind'](this));this[_0x69df('0x5')]['on'](_0x69df('0xa'),this[_0x69df('0xb')]['bind'](this));this[_0x69df('0x5')]['on'](_0x69df('0xc'),this['handleDrained']['bind'](this));};Agent['prototype']['push']=function(){this[_0x69df('0x5')][_0x69df('0x7')](this[_0x69df('0x8')][_0x69df('0x9')](this),this[_0x69df('0xb')][_0x69df('0x9')](this));};Agent['prototype'][_0x69df('0xd')]=function(){this['handleTimeout'](!![]);};Agent[_0x69df('0xe')][_0x69df('0x8')]=function(_0xcc7011){logger[_0x69df('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x69df('0x5')]['id'],this[_0x69df('0x10')]['id']);if(_[_0x69df('0x11')](this['realtime'][_0x69df('0x12')][this[_0x69df('0x10')]['id']])){logger['info'](_0x69df('0x13'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x69df('0x7')][_0x69df('0x9')](this),0x3e8);}else{if(this[_0x69df('0x4')]['forcedOwnership']||util[_0x69df('0x14')](this[_0x69df('0x5')]['id'],this[_0x69df('0x6')][_0x69df('0x12')][this[_0x69df('0x10')]['id']],this['squeue'][_0x69df('0x15')],![])){this[_0x69df('0x6')][_0x69df('0x12')][this[_0x69df('0x10')]['id']][_0x69df('0x16')]=!![];this[_0x69df('0x6')][_0x69df('0x12')][this['agent']['id']][_0x69df('0x17')]=undefined;util[_0x69df('0x18')](this['notificationId'],this[_0x69df('0x5')]['id'],this['realtime'][_0x69df('0x12')][this[_0x69df('0x10')]['id']],null,this['routing']);util[_0x69df('0x19')](this[_0x69df('0x5')]['id'],this[_0x69df('0x6')][_0x69df('0x12')][this[_0x69df('0x10')]['id']],_0x69df('0x1a')+(this[_0x69df('0x4')][_0x69df('0x1b')]?_0x69df('0x1c'):''));}else{logger[_0x69df('0xf')](_0x69df('0x1d'),this['squeue']['id'],this[_0x69df('0x10')]['id']);setTimeout(this[_0x69df('0x7')][_0x69df('0x9')](this),0x3e8);}}};Agent['prototype'][_0x69df('0xb')]=function(_0x43d1a5){if(_[_0x69df('0x11')](this['realtime'][_0x69df('0x12')][this[_0x69df('0x10')]['id']])){return logger[_0x69df('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x69df('0x5')]['id'],this[_0x69df('0x10')]['id']);}else{logger[_0x69df('0xf')](_0x69df('0x1e'),this[_0x69df('0x5')]['id'],this[_0x69df('0x10')]['id']);util[_0x69df('0x1f')](this['notificationId'],this[_0x69df('0x5')]['id'],this[_0x69df('0x6')][_0x69df('0x12')][this[_0x69df('0x10')]['id']],null,this[_0x69df('0x4')]);this[_0x69df('0x6')]['agents'][this[_0x69df('0x10')]['id']][_0x69df('0x16')]=![];this[_0x69df('0x6')][_0x69df('0x12')][this[_0x69df('0x10')]['id']]['busyQueue']=undefined;util[_0x69df('0x19')](this[_0x69df('0x5')]['id'],this['realtime'][_0x69df('0x12')][this['agent']['id']],_0x43d1a5?'STOP':_0x69df('0x20'));}if(!_0x43d1a5){setTimeout(this['push'][_0x69df('0x9')](this),0x3e8);}};function agent(_0x42471c,_0xcd1c53,_0x31e3c2,_0x4c88eb){return new Agent(_0x42471c,_0xcd1c53,_0x31e3c2,_0x4c88eb);}module[_0x69df('0x21')]=agent; \ No newline at end of file +var _0x0a4b=['bind','handleTimeout','drained','prototype','push','info','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','realtime','channel','busy','busyQueue',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','writeLog','TIMEOUT','exports','lodash','./util','../../../../../config/logger','notificationId','squeue','agent','routing'];(function(_0xd7dbb2,_0x2741d6){var _0x36ec51=function(_0x304a47){while(--_0x304a47){_0xd7dbb2['push'](_0xd7dbb2['shift']());}};_0x36ec51(++_0x2741d6);}(_0x0a4b,0x6d));var _0xb0a4=function(_0x2bb4c2,_0x36402a){_0x2bb4c2=_0x2bb4c2-0x0;var _0x5234f6=_0x0a4b[_0x2bb4c2];return _0x5234f6;};'use strict';var _=require(_0xb0a4('0x0'));var uuid=require('uuid');var util=require(_0xb0a4('0x1'));var logger=require(_0xb0a4('0x2'))('routing');var Agent=function(_0x5cef06,_0x5ab14f,_0x4d81e0,_0x41c7db){this[_0xb0a4('0x3')]=uuid['v4']();this[_0xb0a4('0x4')]=_0x5cef06;this[_0xb0a4('0x5')]=_0x5ab14f;this['realtime']=_0x4d81e0;this[_0xb0a4('0x6')]=_0x41c7db;this[_0xb0a4('0x4')]['push'](this['handleRun'][_0xb0a4('0x7')](this),this[_0xb0a4('0x8')]['bind'](this));this['squeue']['on']('timeout',this[_0xb0a4('0x8')][_0xb0a4('0x7')](this));this[_0xb0a4('0x4')]['on'](_0xb0a4('0x9'),this['handleDrained'][_0xb0a4('0x7')](this));};Agent[_0xb0a4('0xa')][_0xb0a4('0xb')]=function(){this[_0xb0a4('0x4')][_0xb0a4('0xb')](this['handleRun'][_0xb0a4('0x7')](this),this[_0xb0a4('0x8')]['bind'](this));};Agent[_0xb0a4('0xa')]['handleDrained']=function(){this[_0xb0a4('0x8')](!![]);};Agent[_0xb0a4('0xa')]['handleRun']=function(_0x54df27){logger[_0xb0a4('0xc')](_0xb0a4('0xd'),this[_0xb0a4('0x4')]['id'],this[_0xb0a4('0x5')]['id']);if(_['isNil'](this['realtime'][_0xb0a4('0xe')][this['agent']['id']])){logger[_0xb0a4('0xc')](_0xb0a4('0xf'),this[_0xb0a4('0x4')]['id'],this[_0xb0a4('0x5')]['id']);setTimeout(this['push'][_0xb0a4('0x7')](this),0x3e8);}else{if(this[_0xb0a4('0x6')][_0xb0a4('0x10')]||util[_0xb0a4('0x11')](this['squeue']['id'],this[_0xb0a4('0x12')][_0xb0a4('0xe')][this[_0xb0a4('0x5')]['id']],this['squeue'][_0xb0a4('0x13')],![])){this[_0xb0a4('0x12')][_0xb0a4('0xe')][this[_0xb0a4('0x5')]['id']][_0xb0a4('0x14')]=!![];this[_0xb0a4('0x12')][_0xb0a4('0xe')][this[_0xb0a4('0x5')]['id']][_0xb0a4('0x15')]=undefined;util['showNotification'](this[_0xb0a4('0x3')],this[_0xb0a4('0x4')]['id'],this['realtime'][_0xb0a4('0xe')][this['agent']['id']],null,this[_0xb0a4('0x6')]);util['writeLog'](this[_0xb0a4('0x4')]['id'],this[_0xb0a4('0x12')]['agents'][this[_0xb0a4('0x5')]['id']],'RINGING'+(this[_0xb0a4('0x6')][_0xb0a4('0x10')]?_0xb0a4('0x16'):''));}else{logger['info'](_0xb0a4('0x17'),this['squeue']['id'],this[_0xb0a4('0x5')]['id']);setTimeout(this[_0xb0a4('0xb')][_0xb0a4('0x7')](this),0x3e8);}}};Agent[_0xb0a4('0xa')][_0xb0a4('0x8')]=function(_0xd299dc){if(_[_0xb0a4('0x18')](this['realtime']['agents'][this[_0xb0a4('0x5')]['id']])){return logger['info'](_0xb0a4('0xf'),this[_0xb0a4('0x4')]['id'],this[_0xb0a4('0x5')]['id']);}else{logger['info'](_0xb0a4('0x19'),this['squeue']['id'],this['agent']['id']);util['hideNotification'](this[_0xb0a4('0x3')],this[_0xb0a4('0x4')]['id'],this[_0xb0a4('0x12')][_0xb0a4('0xe')][this[_0xb0a4('0x5')]['id']],null,this[_0xb0a4('0x6')]);this[_0xb0a4('0x12')][_0xb0a4('0xe')][this[_0xb0a4('0x5')]['id']]['busy']=![];this['realtime'][_0xb0a4('0xe')][this[_0xb0a4('0x5')]['id']]['busyQueue']=undefined;util[_0xb0a4('0x1a')](this[_0xb0a4('0x4')]['id'],this[_0xb0a4('0x12')][_0xb0a4('0xe')][this['agent']['id']],_0xd299dc?'STOP':_0xb0a4('0x1b'));}if(!_0xd299dc){setTimeout(this[_0xb0a4('0xb')][_0xb0a4('0x7')](this),0x3e8);}};function agent(_0x2e569a,_0xf745c4,_0x4d0676,_0x496782){return new Agent(_0x2e569a,_0xf745c4,_0x4d0676,_0x496782);}module[_0xb0a4('0x1c')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index b81dc8a..a433a55 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 _0xec94=['notificationId','queue','realtime','squeue','push','handleRun','bind','timeout','handleTimeout','handleDrained','prototype','isNil','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','RINGING','busy','busyQueue','name','showNotification','hideNotification','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','routing'];(function(_0x10c51f,_0x11270f){var _0x56a0cd=function(_0x563ac6){while(--_0x563ac6){_0x10c51f['push'](_0x10c51f['shift']());}};_0x56a0cd(++_0x11270f);}(_0xec94,0x167));var _0x4ec9=function(_0x568616,_0x24b755){_0x568616=_0x568616-0x0;var _0x4ce55e=_0xec94[_0x568616];return _0x4ce55e;};'use strict';var _=require(_0x4ec9('0x0'));var uuid=require(_0x4ec9('0x1'));var util=require(_0x4ec9('0x2'));var logger=require('../../../../../config/logger')(_0x4ec9('0x3'));var Beepall=function(_0x1a2815,_0x45c11b,_0x6ac1f3,_0x2c470a){this[_0x4ec9('0x4')]=uuid['v4']();this['squeue']=_0x1a2815;this[_0x4ec9('0x5')]=_0x45c11b;this[_0x4ec9('0x6')]=_0x6ac1f3;this[_0x4ec9('0x3')]=_0x2c470a;this[_0x4ec9('0x7')][_0x4ec9('0x8')](this[_0x4ec9('0x9')][_0x4ec9('0xa')](this),this['handleTimeout'][_0x4ec9('0xa')](this));this[_0x4ec9('0x7')]['on'](_0x4ec9('0xb'),this[_0x4ec9('0xc')][_0x4ec9('0xa')](this));this[_0x4ec9('0x7')]['on']('drained',this[_0x4ec9('0xd')][_0x4ec9('0xa')](this));};Beepall['prototype'][_0x4ec9('0x8')]=function(){this[_0x4ec9('0x7')][_0x4ec9('0x8')](this[_0x4ec9('0x9')][_0x4ec9('0xa')](this),this[_0x4ec9('0xc')][_0x4ec9('0xa')](this));};Beepall[_0x4ec9('0xe')][_0x4ec9('0xd')]=function(_0x3b56d0){this[_0x4ec9('0xc')](!![]);};Beepall[_0x4ec9('0xe')][_0x4ec9('0x9')]=function(_0xe9627a){var _0x2d755b=!![];if(!_[_0x4ec9('0xf')](this[_0x4ec9('0x5')])&&!_['isNil'](this[_0x4ec9('0x5')][_0x4ec9('0x10')])&&this[_0x4ec9('0x5')][_0x4ec9('0x10')][_0x4ec9('0x11')]>0x0){for(var _0x56bfdf=0x0,_0x2cb979;_0x56bfdf0x0){for(var _0x2f2235=0x0,_0x521ddc;_0x2f22350x0&&_0x1d0e68[_0x282a75+_0x4e80('0x23')]>=_0x1d0e68[_0x282a75+_0x4e80('0x22')]){writeLog(_0x542e00,_0x1d0e68,_0x282a75[_0x4e80('0x24')]()+_0x4e80('0x25'));return![];}}return!![];};exports[_0x4e80('0x26')]=function(_0x470ce9,_0x3b3d15,_0x1428d5,_0x70015d,_0x1c67b1){return sendNotification(!![],_0x470ce9,_0x3b3d15,_0x1428d5,_0x70015d,_0x1c67b1);};exports[_0x4e80('0x27')]=function(_0x34079f,_0x2c9928,_0x578529,_0x58eb33,_0x18bebc){return sendNotification(![],_0x34079f,_0x2c9928,_0x578529,_0x58eb33,_0x18bebc);};exports[_0x4e80('0x28')]=writeLog; \ No newline at end of file +var _0x15b0=['notificationShake','queue','body','msg','getMustacheRender','notificationTemplate','error','[%s][QUEUE]\x20%s','message','notification:%s','save','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','online','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','hideNotification','writeLog','lodash','util','../utils','mustache','../../../../../config/environment','../../../../../config/logger','routing','localhost','emit','format','user:%s','name','user:save','split','\x20interaction','account'];(function(_0x4de427,_0xa6d227){var _0x5e19ae=function(_0x225d2d){while(--_0x225d2d){_0x4de427['push'](_0x4de427['shift']());}};_0x5e19ae(++_0xa6d227);}(_0x15b0,0x146));var _0x015b=function(_0x5b5947,_0x11623c){_0x5b5947=_0x5b5947-0x0;var _0x7623e0=_0x15b0[_0x5b5947];return _0x7623e0;};'use strict';var _=require(_0x015b('0x0'));var util=require(_0x015b('0x1'));var utils=require(_0x015b('0x2'));var Mustache=require(_0x015b('0x3'));var Redis=require('ioredis');var config=require(_0x015b('0x4'));var logger=require(_0x015b('0x5'))(_0x015b('0x6'));config['redis']=_['defaults'](config['redis'],{'host':_0x015b('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x487854,_0x122e9d,_0x56160a){io['to'](_0x487854)[_0x015b('0x8')](_0x122e9d,_0x56160a);}function sendNotification(_0x35ecd2,_0x40cdf5,_0x5c8492,_0x4e6401,_0x55be14,_0x3b14c8){io['to'](util[_0x015b('0x9')](_0x015b('0xa'),_0x4e6401[_0x015b('0xb')]))[_0x015b('0x8')](_0x015b('0xc'),_0x4e6401);var _0x578cd4=_0x3b14c8||{};var _0x53b855=_0x5c8492[_0x015b('0xd')]('.');var _0x1484eb={'uniqueid':_0x40cdf5,'channel':_0x53b855[0x0],'id':_0x53b855[0x1],'title':_0x53b855[0x0]+_0x015b('0xe'),'interactionId':_0x53b855[0x2],'queue':_0x55be14?_0x55be14[_0x015b('0xb')]:null,'sound':_0x578cd4['account']['notificationSound'],'shake':_0x578cd4[_0x015b('0xf')][_0x015b('0x10')]};try{if(!_0x578cd4['body']){_0x578cd4['body']={};}if(_0x55be14){_0x578cd4['body'][_0x015b('0x11')]=_0x55be14;}else if(_0x578cd4[_0x015b('0x12')][_0x015b('0x11')]){delete _0x578cd4[_0x015b('0x12')][_0x015b('0x11')];}_0x1484eb[_0x015b('0x13')]=utils[_0x015b('0x14')](_0x578cd4[_0x015b('0xf')][_0x015b('0x15')],_0x578cd4);}catch(_0x43c45f){_0x1484eb['msg']='I\x20can\x27t\x20render\x20your\x20template';logger[_0x015b('0x16')](util[_0x015b('0x9')](_0x015b('0x17'),_0x40cdf5,_0x43c45f[_0x015b('0x18')]));}io['to'](util[_0x015b('0x9')](_0x015b('0xa'),_0x4e6401['name']))[_0x015b('0x8')](util[_0x015b('0x9')](_0x015b('0x19'),_0x35ecd2?_0x015b('0x1a'):'remove'),_0x1484eb);}function writeLog(_0xc86756,_0x31aae4,_0x208fac){return logger[_0x015b('0x1b')](util[_0x015b('0x9')](_0x015b('0x1c'),_0xc86756,_0x31aae4['name'],_0x208fac));}exports['isAgentAvailable']=function(_0x2c593c,_0x2b9b2d,_0x3f76c5,_0x149f8a){if(_0x2b9b2d['busy']){writeLog(_0x2c593c,_0x2b9b2d,'BUSY');return![];}if(!_0x2b9b2d[_0x015b('0x1d')]){writeLog(_0x2c593c,_0x2b9b2d,'OFFLINE');return![];}if(_0x2b9b2d[_0x3f76c5+_0x015b('0x1e')]){writeLog(_0x2c593c,_0x2b9b2d,_0x015b('0x1f'));return![];}if(_0x149f8a&&_0x2b9b2d[_0x015b('0x20')](_0x3f76c5+'Capacity')&&_0x2b9b2d[_0x015b('0x20')](_0x3f76c5+'CurrentCapacity')){if(_0x2b9b2d[_0x3f76c5+_0x015b('0x21')]>0x0&&_0x2b9b2d[_0x3f76c5+_0x015b('0x22')]>=_0x2b9b2d[_0x3f76c5+_0x015b('0x21')]){writeLog(_0x2c593c,_0x2b9b2d,_0x3f76c5['toUpperCase']()+_0x015b('0x23'));return![];}}return!![];};exports['showNotification']=function(_0x345f04,_0x867216,_0x21c187,_0x1067d9,_0x4a9dde){return sendNotification(!![],_0x345f04,_0x867216,_0x21c187,_0x1067d9,_0x4a9dde);};exports[_0x015b('0x24')]=function(_0x4f5109,_0xc091d5,_0x190013,_0x5bd262,_0x2ba25e){return sendNotification(![],_0x4f5109,_0xc091d5,_0x190013,_0x5bd262,_0x2ba25e);};exports[_0x015b('0x25')]=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 b4c82a0..d817fa8 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 _0x97ed=['trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','shelljs','lodash','../../../../config/logger','routing','string','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s'];(function(_0x59a2bf,_0x5d571b){var _0x57f842=function(_0x58ff96){while(--_0x58ff96){_0x59a2bf['push'](_0x59a2bf['shift']());}};_0x57f842(++_0x5d571b);}(_0x97ed,0xf3));var _0xd97e=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x97ed[_0x1928c9];return _0x51b5fb;};'use strict';var schema=require(_0xd97e('0x0'));var sh=require(_0xd97e('0x1'));var _=require(_0xd97e('0x2'));var utils=require('./utils');var logger=require(_0xd97e('0x3'))(_0xd97e('0x4'));var system=schema({'command':{'type':_0xd97e('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xd97e('0x6')]=function(_0x2ee3c4,_0x31e486){return function(_0x3f83ed){try{var _0x449642={'command':_0x31e486[0x0]};var _0x4421a3=system[_0xd97e('0x0')](_0x449642,{'typecast':!![]});if(_0x4421a3[_0xd97e('0x7')]){logger[_0xd97e('0x8')](_0xd97e('0x9'),_0x2ee3c4,_[_0xd97e('0xa')](_0x4421a3,_0xd97e('0xb'))[_0xd97e('0xc')](',\x20'));logger[_0xd97e('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2ee3c4);_0x3f83ed[_0xd97e('0xe')]();}else{var _0x2d61cc=this;var _0x58adf7=utils[_0xd97e('0xf')](_0x31e486[0x0],this);logger[_0xd97e('0xd')](_0xd97e('0x10'),_0x2ee3c4,_0x58adf7);sh['exec'](_[_0xd97e('0x11')](_0x58adf7),function(_0x478c47,_0x536a07){logger[_0xd97e('0xd')](_0xd97e('0x12'),_0x2ee3c4,_0x478c47);if(_0x478c47==0x0){var _0x233f20=_0x536a07[_0xd97e('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0xd97e('0x14')](_0x31e486[0x1])||_[_0xd97e('0x15')](_0x31e486[0x1])){logger[_0xd97e('0xd')](_0xd97e('0x16'),_0x2ee3c4);_0x2d61cc[_0xd97e('0x17')][_0x31e486[0x1]]=_0x233f20;}else{logger[_0xd97e('0xd')](_0xd97e('0x18'),_0x2ee3c4,_0x31e486[0x1],_0x233f20);_0x2d61cc['body'][_0x31e486[0x1]]=_0x233f20;}}_0x3f83ed[_0xd97e('0xe')]();});}}catch(_0x1b58ca){logger[_0xd97e('0x8')]('[%s][SYSTEM]\x20%s',_0x2ee3c4,_[_0xd97e('0x19')](_0x1b58ca)?JSON['stringify'](_0x1b58ca):_0x1b58ca);logger[_0xd97e('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2ee3c4);_0x3f83ed['next']();}};}; \ No newline at end of file +var _0x8ad2=['[%s][SYSTEM]\x20no\x20variable','body','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','map','join','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace'];(function(_0x5e6113,_0x275431){var _0x17085c=function(_0x5d1c08){while(--_0x5d1c08){_0x5e6113['push'](_0x5e6113['shift']());}};_0x17085c(++_0x275431);}(_0x8ad2,0x9a));var _0x28ad=function(_0x3ca3b9,_0x5bb602){_0x3ca3b9=_0x3ca3b9-0x0;var _0x4ccefd=_0x8ad2[_0x3ca3b9];return _0x4ccefd;};'use strict';var schema=require(_0x28ad('0x0'));var sh=require(_0x28ad('0x1'));var _=require(_0x28ad('0x2'));var utils=require(_0x28ad('0x3'));var logger=require(_0x28ad('0x4'))(_0x28ad('0x5'));var system=schema({'command':{'type':_0x28ad('0x6'),'required':!![],'message':_0x28ad('0x7')}});exports['consequence']=function(_0x3a4029,_0x478456){return function(_0xe26adf){try{var _0xb69d7={'command':_0x478456[0x0]};var _0x327c77=system[_0x28ad('0x0')](_0xb69d7,{'typecast':!![]});if(_0x327c77[_0x28ad('0x8')]){logger[_0x28ad('0x9')](_0x28ad('0xa'),_0x3a4029,_[_0x28ad('0xb')](_0x327c77,'message')[_0x28ad('0xc')](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3a4029);_0xe26adf[_0x28ad('0xd')]();}else{var _0x45d8a5=this;var _0x28b693=utils[_0x28ad('0xe')](_0x478456[0x0],this);logger[_0x28ad('0xf')](_0x28ad('0x10'),_0x3a4029,_0x28b693);sh[_0x28ad('0x11')](_[_0x28ad('0x12')](_0x28b693),function(_0x3051bd,_0x3576ed){logger[_0x28ad('0xf')](_0x28ad('0x13'),_0x3a4029,_0x3051bd);if(_0x3051bd==0x0){var _0x4e4cb9=_0x3576ed[_0x28ad('0x14')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x478456[0x1])||_['isEmpty'](_0x478456[0x1])){logger[_0x28ad('0xf')](_0x28ad('0x15'),_0x3a4029);_0x45d8a5['body'][_0x478456[0x1]]=_0x4e4cb9;}else{logger[_0x28ad('0xf')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x3a4029,_0x478456[0x1],_0x4e4cb9);_0x45d8a5[_0x28ad('0x16')][_0x478456[0x1]]=_0x4e4cb9;}}_0xe26adf[_0x28ad('0xd')]();});}}catch(_0x1e9be3){logger[_0x28ad('0x9')](_0x28ad('0xa'),_0x3a4029,_[_0x28ad('0x17')](_0x1e9be3)?JSON[_0x28ad('0x18')](_0x1e9be3):_0x1e9be3);logger[_0x28ad('0xf')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3a4029);_0xe26adf[_0x28ad('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 d029e6b..095c401 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(_0x338d1b,_0x4d180b){var _0x1c23ab=function(_0x420ea3){while(--_0x420ea3){_0x338d1b['push'](_0x338d1b['shift']());}};_0x1c23ab(++_0x4d180b);}(_0x7a54,0x106));var _0x47a5=function(_0x331ce5,_0x2b4e89){_0x331ce5=_0x331ce5-0x0;var _0x4af15f=_0x7a54[_0x331ce5];return _0x4af15f;};'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(_0x175ffb,_0x1b4168){var _0x4d1b4b=function(_0x5e2b41){while(--_0x5e2b41){_0x175ffb['push'](_0x175ffb['shift']());}};_0x4d1b4b(++_0x1b4168);}(_0x7a54,0x106));var _0x47a5=function(_0x5ea70a,_0x4ad862){_0x5ea70a=_0x5ea70a-0x0;var _0x31dc86=_0x7a54[_0x5ea70a];return _0x31dc86;};'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 1288aa4..9aad1d1 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 _0xdf0c=['contact','account','interaction','mustache','exports','render','merge','body'];(function(_0xed190,_0x5a6f7f){var _0x4b0465=function(_0xa7e075){while(--_0xa7e075){_0xed190['push'](_0xed190['shift']());}};_0x4b0465(++_0x5a6f7f);}(_0xdf0c,0x1ab));var _0xcdf0=function(_0x26cf77,_0x183d5c){_0x26cf77=_0x26cf77-0x0;var _0x58b93f=_0xdf0c[_0x26cf77];return _0x58b93f;};'use strict';var Mustache=require(_0xcdf0('0x0'));var _=require('lodash');module[_0xcdf0('0x1')]={'getMustacheRender':function(_0x31d472,_0x5233f6){return Mustache[_0xcdf0('0x2')](_0x31d472,_[_0xcdf0('0x3')](_0x5233f6[_0xcdf0('0x4')],{'contact':_0x5233f6[_0xcdf0('0x5')],'message':_0x5233f6['message'],'account':_0x5233f6[_0xcdf0('0x6')],'interaction':_0x5233f6[_0xcdf0('0x7')],'list':_0x5233f6['list']}))||'';}}; \ No newline at end of file +var _0x0c6d=['list','lodash','exports','render','merge','contact'];(function(_0x585ee5,_0x1c9dba){var _0x470808=function(_0x35c90d){while(--_0x35c90d){_0x585ee5['push'](_0x585ee5['shift']());}};_0x470808(++_0x1c9dba);}(_0x0c6d,0xf7));var _0xd0c6=function(_0x8e969b,_0x1258aa){_0x8e969b=_0x8e969b-0x0;var _0xc6f780=_0x0c6d[_0x8e969b];return _0xc6f780;};'use strict';var Mustache=require('mustache');var _=require(_0xd0c6('0x0'));module[_0xd0c6('0x1')]={'getMustacheRender':function(_0xa7819f,_0x42a166){return Mustache[_0xd0c6('0x2')](_0xa7819f,_[_0xd0c6('0x3')](_0x42a166['body'],{'contact':_0x42a166[_0xd0c6('0x4')],'message':_0x42a166['message'],'account':_0x42a166['account'],'interaction':_0x42a166['interaction'],'list':_0x42a166[_0xd0c6('0x5')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 8b36e17..2342453 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 _0x61de=['routing\x20is\x20empty','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','smsQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','applications','isArray','length','existsSync','join','app','toLowerCase','autoreply','appdata','split','push','slice','amazonlex','TagId','%s:%s:%s','./interval','condition','./applications/','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','info','Applications\x20executed','stringify','matchPath','emit','end','No\x20applications\x20to\x20execute','stack'];(function(_0x1dd5f4,_0x28b67a){var _0x1dfe18=function(_0x948bb4){while(--_0x948bb4){_0x1dd5f4['push'](_0x1dd5f4['shift']());}};_0x1dfe18(++_0x28b67a);}(_0x61de,0x1cd));var _0xe61d=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x61de[_0x5037ab];return _0x512adb;};'use strict';var _=require(_0xe61d('0x0'));var util=require(_0xe61d('0x1'));var path=require(_0xe61d('0x2'));var fs=require('fs');var jayson=require(_0xe61d('0x3'));var BPromise=require(_0xe61d('0x4'));var uuid=require('uuid');var config=require(_0xe61d('0x5'));var logger=require('../../../config/logger')(_0xe61d('0x6'));var rpc={'openchannelQueueReport':require(_0xe61d('0x7'))};var rpc={'openchannelQueueReport':require(_0xe61d('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xe61d('0x8')),'smsQueueReport':require(_0xe61d('0x9')),'faxQueueReport':require(_0xe61d('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0xc8f4dd,_0x46297d,_0x4967b0){return util[_0xe61d('0xb')](_0xe61d('0xc'),_0xc8f4dd,_0x46297d||0x0,_0x4967b0||0x0);}function getIntervals(_0x281279,_0x26db6a){var _0x5abfdf=[];if(!_['isNil'](_0x26db6a['IntervalId'])&&!_[_0xe61d('0xd')](_0x281279[_0x26db6a[_0xe61d('0xe')]])&&!_['isNil'](_0x281279[_0x26db6a['IntervalId']][_0xe61d('0xf')])){_0x5abfdf=_[_0xe61d('0x10')](_0x281279[_0x26db6a['IntervalId']][_0xe61d('0xf')],'interval');}else if(!_[_0xe61d('0xd')](_0x26db6a[_0xe61d('0x11')])){_0x5abfdf=[_0x26db6a[_0xe61d('0x11')]];}return _0x5abfdf;}exports[_0xe61d('0x12')]=function(_0x5baefa){_0x5baefa['rules']={};return new BPromise(function(_0x395ffe,_0x87c327){var _0x1e409e={'Start':function(_0x86c34e){var _0x3db2f5=this;return new Promise(function(_0x2b027f,_0x3dff45){if(_0x86c34e){try{var _0x34c0db=[];var _0x5e5ce1=getId(_0x86c34e[_0xe61d('0x13')],_0x86c34e['message']?_0x86c34e[_0xe61d('0x14')]['id']:0x0,_0x86c34e[_0xe61d('0x15')]?_0x86c34e[_0xe61d('0x15')]['id']:0x0);if(_0x86c34e[_0xe61d('0x16')]&&_[_0xe61d('0x17')](_0x86c34e[_0xe61d('0x16')])&&_0x86c34e['applications']['length']){for(var _0x298973=0x0;_0x298973<_0x86c34e['applications'][_0xe61d('0x18')];_0x298973+=0x1){var _0x557030=_0x86c34e[_0xe61d('0x16')][_0x298973];if(fs[_0xe61d('0x19')](path[_0xe61d('0x1a')](__dirname,_0xe61d('0x16'),_0x557030[_0xe61d('0x1b')]+'.js'))){var _0x39a15c=[];switch(_0x557030['app'][_0xe61d('0x1c')]()){case _0xe61d('0x1d'):var _0x4403e8=_0x557030[_0xe61d('0x1e')][_0xe61d('0x1f')](',');_0x39a15c[_0xe61d('0x20')](_0x4403e8[0x0]);_0x39a15c[_0xe61d('0x20')](_0x4403e8[_0xe61d('0x21')](0x1,_0x4403e8[_0xe61d('0x18')])[_0xe61d('0x1a')](','));break;case'dialogflow':var _0x4403e8=_0x557030[_0xe61d('0x1e')][_0xe61d('0x1f')](',');_0x39a15c[_0xe61d('0x20')](_0x4403e8[0x0]);_0x39a15c[_0xe61d('0x20')](_0x4403e8[0x1]);_0x39a15c[_0xe61d('0x20')](_0x4403e8[_0xe61d('0x21')](0x2,_0x4403e8['length'])[_0xe61d('0x1a')](','));break;case _0xe61d('0x22'):var _0x4403e8=_0x557030['appdata'][_0xe61d('0x1f')](',');_0x39a15c[_0xe61d('0x20')](_0x4403e8[0x0]);_0x39a15c[_0xe61d('0x20')](_0x4403e8[0x1]);_0x39a15c['push'](_0x4403e8[0x2]);_0x39a15c[_0xe61d('0x20')](_0x4403e8[0x3]);_0x39a15c['push'](_0x4403e8[_0xe61d('0x21')](0x4,_0x4403e8['length'])[_0xe61d('0x1a')](','));break;case _0xe61d('0x14'):_0x39a15c['push'](_0x557030['appdata']);break;case'tag':_0x39a15c[_0xe61d('0x20')](_0x557030[_0xe61d('0x23')]);_0x39a15c[_0xe61d('0x20')](_0x557030['appdata']);break;default:_0x39a15c=_[_0xe61d('0xd')](_0x557030[_0xe61d('0x1e')])?[]:_0x557030[_0xe61d('0x1e')][_0xe61d('0x1f')](',');}var _0x5b372c={'id':util[_0xe61d('0xb')](_0xe61d('0x24'),_0x5e5ce1,_0x557030['id'],_0x557030[_0xe61d('0x1b')]),'condition':require(_0xe61d('0x25'))[_0xe61d('0x26')](_0x5e5ce1,getIntervals(_0x5baefa['intervals'],_0x557030),_0x5baefa),'consequence':require(_0xe61d('0x27')+_0x557030[_0xe61d('0x1b')])['consequence'](_0x5e5ce1,_0x39a15c,_0x5baefa,_0x86c34e),'p':_0x557030['priority']||0x0};logger['info'](_0xe61d('0x28'),_0x5b372c['id'],_0xe61d('0x29'),getIntervals(_0x5baefa[_0xe61d('0x2a')],_0x557030)[_0xe61d('0x1a')](_0xe61d('0x2b')));_0x34c0db[_0xe61d('0x20')](_0x5b372c);}else{logger[_0xe61d('0x2c')](_0xe61d('0x2d'),path['join'](__dirname,'applications',_0x557030[_0xe61d('0x1b')]+'.js'));}}_0x5baefa['rules'][_0x5e5ce1]=new RuleEngine(_0x34c0db);_0x5baefa[_0xe61d('0x2e')][_0x5e5ce1]['execute'](_0x86c34e,function(_0x2b6649){logger[_0xe61d('0x2f')](_0xe61d('0x30'),JSON[_0xe61d('0x31')](_0x2b6649[_0xe61d('0x32')]));if(_0x5baefa[_0xe61d('0x2e')][_0x5e5ce1]){_0x5baefa[_0xe61d('0x2e')][_0x5e5ce1][_0xe61d('0x33')](_0xe61d('0x34'));}});return _0x2b027f({'code':0xc8,'message':_0x86c34e});}else{logger[_0xe61d('0x2f')](_0xe61d('0x35'));return _0x2b027f({'code':0xc8,'message':_0x86c34e});}}catch(_0x26bdbd){logger[_0xe61d('0x2c')](_0x26bdbd[_0xe61d('0x36')]);return _0x3dff45(_0x3db2f5[_0xe61d('0x2c')](0x1f4,_0x26bdbd));}}return _0x3dff45(_0xe61d('0x37'));});},'AcceptMessage':function(_0x3c8a60){var _0x539c75=this;return new Promise(function(_0x4b5f31,_0x5b2960){if(_0x3c8a60['message']&&_0x3c8a60[_0xe61d('0x14')]['id']){try{var _0x23d0c7=getId(_0x3c8a60[_0xe61d('0x13')],_0x3c8a60[_0xe61d('0x14')]?_0x3c8a60[_0xe61d('0x14')]['id']:0x0,_0x3c8a60[_0xe61d('0x15')]?_0x3c8a60[_0xe61d('0x15')]['id']:0x0);if(_0x5baefa[_0xe61d('0x2e')][_0x23d0c7]){_0x5baefa['rules'][_0x23d0c7]['emit'](_0xe61d('0x34'));if(rpc[_0x3c8a60[_0xe61d('0x13')]+'QueueReport']){rpc[_0x3c8a60['channel']+_0xe61d('0x38')][_0xe61d('0x39')](_0x23d0c7,{'UserId':_0x3c8a60[_0xe61d('0x14')][_0xe61d('0x3a')]})[_0xe61d('0x3b')](function(_0x53f382){logger['error'](_0xe61d('0x3c'));});}}return _0x4b5f31({'code':0xc8,'message':_0x3c8a60});}catch(_0x5cc96b){logger[_0xe61d('0x2c')](_0x5cc96b[_0xe61d('0x36')]);return _0x5b2960(_0x539c75[_0xe61d('0x2c')](0x1f4,_0x5cc96b));}}logger[_0xe61d('0x2c')](_0xe61d('0x3d'));return _0x5b2960(_0x539c75[_0xe61d('0x2c')](0x1f4,_0xe61d('0x3d')));});},'RejectMessage':function(_0x2d7939){var _0x3d73f5=this;return new Promise(function(_0x3528d8,_0x376a88){if(_0x2d7939['agent']&&_0x2d7939[_0xe61d('0x3e')]['id']){try{if(_0x5baefa['agents'][_0x2d7939['agent']['id']]){_0x5baefa[_0xe61d('0x3f')][_0x2d7939[_0xe61d('0x3e')]['id']]['busy']=![];_0x5baefa['agents'][_0x2d7939[_0xe61d('0x3e')]['id']]['busyQueue']=undefined;}return _0x3528d8({'code':0xc8,'message':_0x2d7939});}catch(_0x3d2840){logger[_0xe61d('0x2c')](_0x3d2840[_0xe61d('0x36')]);return _0x376a88(_0x3d73f5['error'](0x1f4,_0x3d2840));}}logger[_0xe61d('0x2c')](_0xe61d('0x3d'));return _0x376a88(_0x3d73f5[_0xe61d('0x2c')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x47fbb3){var _0xe972a0=this;return new Promise(function(_0x557849,_0x356736){if(_0x47fbb3[_0xe61d('0x13')]&&_0x47fbb3[_0xe61d('0x15')]&&_0x47fbb3[_0xe61d('0x15')]['id']){try{var _0x1a534f=getId(_0x47fbb3[_0xe61d('0x13')],_0x47fbb3[_0xe61d('0x14')]?_0x47fbb3['message']['id']:0x0,_0x47fbb3['interaction']?_0x47fbb3[_0xe61d('0x15')]['id']:0x0);if(_0x5baefa['rules'][_0x1a534f]){_0x5baefa[_0xe61d('0x2e')][_0x1a534f][_0xe61d('0x33')]('end');}return _0x557849({'code':0xc8,'message':_0x47fbb3});}catch(_0xf99bee){logger[_0xe61d('0x2c')](_0xf99bee[_0xe61d('0x36')]);return _0x356736(_0xe972a0[_0xe61d('0x2c')](0x1f4,_0xf99bee));}}logger[_0xe61d('0x2c')]('message\x20is\x20empty');return _0x356736(_0xe972a0[_0xe61d('0x2c')](0x1f4,_0xe61d('0x3d')));});},'AgentCapacity':function(_0x34022a){var _0x4f8293=this;return new Promise(function(_0xef5f6a,_0x5edc2e){if(_0x5baefa[_0xe61d('0x3f')][_0xe61d('0x40')](_0x34022a['id'])){for(var _0x38f12d in _0x34022a[_0xe61d('0x41')]){if(_0x34022a[_0xe61d('0x41')][_0xe61d('0x40')](_0x38f12d)){if(_0x5baefa[_0xe61d('0x3f')][_0x34022a['id']][_0xe61d('0x40')](_0x38f12d+_0xe61d('0x42'))){_0x5baefa[_0xe61d('0x3f')][_0x34022a['id']][_0x38f12d+'CurrentCapacity']=parseInt(_0x34022a[_0xe61d('0x41')][_0x38f12d],0xa);}}}_0x5baefa[_0xe61d('0x3f')][_0x34022a['id']]['updateRealtime']();return _0xef5f6a({'code':0xc8,'message':_0x5baefa[_0xe61d('0x3f')][_0x34022a['id']]});}else{return _0x5edc2e(_0x4f8293['error'](0x1f4,_0xe61d('0x43')));}});},'Agents':function(_0x17df51){return new Promise(function(_0x5804a9,_0x1686e8){var _0x337d1c=_[_0xe61d('0x44')](_0x5baefa[_0xe61d('0x3f')]);_0x5804a9({'count':_0x337d1c['length'],'rows':_0x337d1c});});},'ChatQueues':function(_0x501e25){return new Promise(function(_0xc5dbb2,_0x1b0187){var _0x5a91e2=[];for(var _0x5b4117 in _0x5baefa[_0xe61d('0x45')]){if(_0x5baefa[_0xe61d('0x45')]['hasOwnProperty'](_0x5b4117)){var _0x3d5cbe=_0x5baefa[_0xe61d('0x45')][_0x5b4117];var _0x10ab2e={'id':_0x3d5cbe['id'],'available':_0x3d5cbe[_0xe61d('0x46')],'loggedIn':_0x3d5cbe['loggedIn'],'name':_0x3d5cbe[_0xe61d('0x47')],'paused':_0x3d5cbe[_0xe61d('0x48')],'waiting':_0x3d5cbe[_0xe61d('0x49')]};_0x5a91e2[_0xe61d('0x20')](_0x10ab2e);}}_0xc5dbb2({'count':_0x5a91e2[_0xe61d('0x18')],'rows':_0x5a91e2});});},'MailQueues':function(_0xa5b89f){return new Promise(function(_0xf1e0e,_0x595d83){var _0x1fb142=[];for(var _0x5dc623 in _0x5baefa[_0xe61d('0x4a')]){if(_0x5baefa[_0xe61d('0x4a')][_0xe61d('0x40')](_0x5dc623)){var _0x1106be=_0x5baefa[_0xe61d('0x4a')][_0x5dc623];var _0x3c33a3={'id':_0x1106be['id'],'available':_0x1106be['available'],'loggedIn':_0x1106be[_0xe61d('0x4b')],'name':_0x1106be['name'],'paused':_0x1106be[_0xe61d('0x48')],'waiting':_0x1106be[_0xe61d('0x49')]};_0x1fb142['push'](_0x3c33a3);}}_0xf1e0e({'count':_0x1fb142[_0xe61d('0x18')],'rows':_0x1fb142});});},'OpenchannelQueues':function(_0xa60f67){return new Promise(function(_0x4b3eb6,_0xe7e213){var _0x35db06=[];for(var _0x4c7828 in _0x5baefa['openchannelQueues']){if(_0x5baefa['openchannelQueues'][_0xe61d('0x40')](_0x4c7828)){var _0xffbb6d=_0x5baefa['openchannelQueues'][_0x4c7828];var _0xbc83a2={'id':_0xffbb6d['id'],'available':_0xffbb6d[_0xe61d('0x46')],'loggedIn':_0xffbb6d[_0xe61d('0x4b')],'name':_0xffbb6d[_0xe61d('0x47')],'paused':_0xffbb6d['paused'],'waiting':_0xffbb6d[_0xe61d('0x49')]};_0x35db06['push'](_0xbc83a2);}}_0x4b3eb6({'count':_0x35db06[_0xe61d('0x18')],'rows':_0x35db06});});},'SmsQueues':function(_0x27cf65){return new Promise(function(_0x5f03ba,_0x346893){var _0x192ae8=[];for(var _0x26bc2e in _0x5baefa[_0xe61d('0x4c')]){if(_0x5baefa[_0xe61d('0x4c')][_0xe61d('0x40')](_0x26bc2e)){var _0x4b7058=_0x5baefa[_0xe61d('0x4c')][_0x26bc2e];var _0x11c32b={'id':_0x4b7058['id'],'available':_0x4b7058[_0xe61d('0x46')],'loggedIn':_0x4b7058[_0xe61d('0x4b')],'name':_0x4b7058[_0xe61d('0x47')],'paused':_0x4b7058[_0xe61d('0x48')],'waiting':_0x4b7058[_0xe61d('0x49')]};_0x192ae8['push'](_0x11c32b);}}_0x5f03ba({'count':_0x192ae8[_0xe61d('0x18')],'rows':_0x192ae8});});},'FaxQueues':function(_0x249ab4){return new Promise(function(_0x372019,_0x78739){var _0x2d102c=[];for(var _0x498f96 in _0x5baefa[_0xe61d('0x4d')]){if(_0x5baefa['faxQueues'][_0xe61d('0x40')](_0x498f96)){var _0x23a2e6=_0x5baefa['faxQueues'][_0x498f96];var _0x5c2b69={'id':_0x23a2e6['id'],'available':_0x23a2e6[_0xe61d('0x46')],'loggedIn':_0x23a2e6[_0xe61d('0x4b')],'name':_0x23a2e6['name'],'paused':_0x23a2e6[_0xe61d('0x48')],'waiting':_0x23a2e6[_0xe61d('0x49')]};_0x2d102c['push'](_0x5c2b69);}}_0x372019({'count':_0x2d102c['length'],'rows':_0x2d102c});});},'ChatQueuesWaitingInteractions':function(_0x126877){return new Promise(function(_0x4c4994,_0x512262){var _0xd160ee=_['values'](_0x5baefa[_0xe61d('0x4e')]);_0x4c4994({'count':_0xd160ee[_0xe61d('0x18')],'rows':_0xd160ee});});},'MailQueuesWaitingInteractions':function(_0x32e77b){return new Promise(function(_0x480811,_0x14f1cc){var _0x497b00=_[_0xe61d('0x44')](_0x5baefa[_0xe61d('0x4f')]);_0x480811({'count':_0x497b00[_0xe61d('0x18')],'rows':_0x497b00});});},'OpenchannelQueuesWaitingInteractions':function(_0x7897d7){return new Promise(function(_0x13a65e,_0x32d134){var _0x39eec3=_[_0xe61d('0x44')](_0x5baefa['openchannelQueuesWaitingInteractions']);_0x13a65e({'count':_0x39eec3[_0xe61d('0x18')],'rows':_0x39eec3});});},'SmsQueuesWaitingInteractions':function(_0x17f5c8){return new Promise(function(_0x463e9a,_0x5a5a69){var _0x53ecc2=_['values'](_0x5baefa['smsQueuesWaitingInteractions']);_0x463e9a({'count':_0x53ecc2['length'],'rows':_0x53ecc2});});},'FaxQueuesWaitingInteractions':function(_0x51b601){return new Promise(function(_0x1e97b5,_0x59876e){var _0x18b3c7=_['values'](_0x5baefa['faxQueuesWaitingInteractions']);_0x1e97b5({'count':_0x18b3c7[_0xe61d('0x18')],'rows':_0x18b3c7});});}};var _0x5bc94e=jayson[_0xe61d('0x50')](_0x1e409e)[_0xe61d('0x51')]();_0x5bc94e['on'](_0xe61d('0x2c'),function(_0x581c11){logger[_0xe61d('0x2c')](JSON[_0xe61d('0x31')](_0x581c11));return _0x87c327(_0x581c11);});_0x5bc94e[_0xe61d('0x12')](0x232c,_0xe61d('0x52'),function(){console[_0xe61d('0x53')](_0xe61d('0x54'),0x232c);return _0x395ffe(_0xe61d('0x55')+0x232c);});});}; \ No newline at end of file +var _0x4135=['UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','path','jayson/promise','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','message','interaction','applications','isArray','length','app','.js','toLowerCase','autoreply','split','push','slice','join','dialogflow','amazonlex','appdata','tag','TagId','%s:%s:%s','./interval','intervals','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','stringify','emit','end','No\x20applications\x20to\x20execute','error','stack','channel','QueueReport','update'];(function(_0x3e1829,_0xc8ccda){var _0x129345=function(_0x2357c0){while(--_0x2357c0){_0x3e1829['push'](_0x3e1829['shift']());}};_0x129345(++_0xc8ccda);}(_0x4135,0xd3));var _0x5413=function(_0x2a3c44,_0x27e10d){_0x2a3c44=_0x2a3c44-0x0;var _0x35f5db=_0x4135[_0x2a3c44];return _0x35f5db;};'use strict';var _=require('lodash');var util=require('util');var path=require(_0x5413('0x0'));var fs=require('fs');var jayson=require(_0x5413('0x1'));var BPromise=require('bluebird');var uuid=require(_0x5413('0x2'));var config=require(_0x5413('0x3'));var logger=require(_0x5413('0x4'))('routing');var rpc={'openchannelQueueReport':require(_0x5413('0x5'))};var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x5413('0x6')),'chatQueueReport':require(_0x5413('0x7')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x5413('0x8'))};var RuleEngine=require(_0x5413('0x9'));function getId(_0xe31a47,_0x51313f,_0x181e02){return util[_0x5413('0xa')](_0x5413('0xb'),_0xe31a47,_0x51313f||0x0,_0x181e02||0x0);}function getIntervals(_0x2e346c,_0x3687d5){var _0x5c67de=[];if(!_[_0x5413('0xc')](_0x3687d5['IntervalId'])&&!_['isNil'](_0x2e346c[_0x3687d5['IntervalId']])&&!_[_0x5413('0xc')](_0x2e346c[_0x3687d5[_0x5413('0xd')]][_0x5413('0xe')])){_0x5c67de=_[_0x5413('0xf')](_0x2e346c[_0x3687d5['IntervalId']]['Intervals'],_0x5413('0x10'));}else if(!_['isNil'](_0x3687d5[_0x5413('0x10')])){_0x5c67de=[_0x3687d5[_0x5413('0x10')]];}return _0x5c67de;}exports['listen']=function(_0x5caf5e){_0x5caf5e['rules']={};return new BPromise(function(_0x47449f,_0x8ac191){var _0x4ec4a8={'Start':function(_0x3e919b){var _0x59286d=this;return new Promise(function(_0x3e8f0b,_0x45e609){if(_0x3e919b){try{var _0x3334b8=[];var _0x575581=getId(_0x3e919b['channel'],_0x3e919b[_0x5413('0x11')]?_0x3e919b['message']['id']:0x0,_0x3e919b[_0x5413('0x12')]?_0x3e919b['interaction']['id']:0x0);if(_0x3e919b[_0x5413('0x13')]&&_[_0x5413('0x14')](_0x3e919b['applications'])&&_0x3e919b[_0x5413('0x13')][_0x5413('0x15')]){for(var _0x3eaa27=0x0;_0x3eaa27<_0x3e919b['applications'][_0x5413('0x15')];_0x3eaa27+=0x1){var _0x43eae3=_0x3e919b[_0x5413('0x13')][_0x3eaa27];if(fs['existsSync'](path['join'](__dirname,_0x5413('0x13'),_0x43eae3[_0x5413('0x16')]+_0x5413('0x17')))){var _0x1475b3=[];switch(_0x43eae3[_0x5413('0x16')][_0x5413('0x18')]()){case _0x5413('0x19'):var _0x286109=_0x43eae3['appdata'][_0x5413('0x1a')](',');_0x1475b3[_0x5413('0x1b')](_0x286109[0x0]);_0x1475b3[_0x5413('0x1b')](_0x286109[_0x5413('0x1c')](0x1,_0x286109[_0x5413('0x15')])[_0x5413('0x1d')](','));break;case _0x5413('0x1e'):var _0x286109=_0x43eae3['appdata'][_0x5413('0x1a')](',');_0x1475b3['push'](_0x286109[0x0]);_0x1475b3['push'](_0x286109[0x1]);_0x1475b3['push'](_0x286109[_0x5413('0x1c')](0x2,_0x286109[_0x5413('0x15')])[_0x5413('0x1d')](','));break;case _0x5413('0x1f'):var _0x286109=_0x43eae3['appdata'][_0x5413('0x1a')](',');_0x1475b3[_0x5413('0x1b')](_0x286109[0x0]);_0x1475b3[_0x5413('0x1b')](_0x286109[0x1]);_0x1475b3[_0x5413('0x1b')](_0x286109[0x2]);_0x1475b3[_0x5413('0x1b')](_0x286109[0x3]);_0x1475b3[_0x5413('0x1b')](_0x286109[_0x5413('0x1c')](0x4,_0x286109['length'])[_0x5413('0x1d')](','));break;case _0x5413('0x11'):_0x1475b3[_0x5413('0x1b')](_0x43eae3[_0x5413('0x20')]);break;case _0x5413('0x21'):_0x1475b3[_0x5413('0x1b')](_0x43eae3[_0x5413('0x22')]);_0x1475b3[_0x5413('0x1b')](_0x43eae3[_0x5413('0x20')]);break;default:_0x1475b3=_[_0x5413('0xc')](_0x43eae3['appdata'])?[]:_0x43eae3['appdata'][_0x5413('0x1a')](',');}var _0x3da518={'id':util[_0x5413('0xa')](_0x5413('0x23'),_0x575581,_0x43eae3['id'],_0x43eae3[_0x5413('0x16')]),'condition':require(_0x5413('0x24'))['condition'](_0x575581,getIntervals(_0x5caf5e[_0x5413('0x25')],_0x43eae3),_0x5caf5e),'consequence':require('./applications/'+_0x43eae3[_0x5413('0x16')])[_0x5413('0x26')](_0x575581,_0x1475b3,_0x5caf5e,_0x3e919b),'p':_0x43eae3[_0x5413('0x27')]||0x0};logger[_0x5413('0x28')](_0x5413('0x29'),_0x3da518['id'],_0x5413('0x2a'),getIntervals(_0x5caf5e[_0x5413('0x25')],_0x43eae3)[_0x5413('0x1d')](_0x5413('0x2b')));_0x3334b8[_0x5413('0x1b')](_0x3da518);}else{logger['error'](_0x5413('0x2c'),path[_0x5413('0x1d')](__dirname,_0x5413('0x13'),_0x43eae3[_0x5413('0x16')]+'.js'));}}_0x5caf5e['rules'][_0x575581]=new RuleEngine(_0x3334b8);_0x5caf5e[_0x5413('0x2d')][_0x575581][_0x5413('0x2e')](_0x3e919b,function(_0x528394){logger[_0x5413('0x28')]('Applications\x20executed',JSON[_0x5413('0x2f')](_0x528394['matchPath']));if(_0x5caf5e['rules'][_0x575581]){_0x5caf5e[_0x5413('0x2d')][_0x575581][_0x5413('0x30')](_0x5413('0x31'));}});return _0x3e8f0b({'code':0xc8,'message':_0x3e919b});}else{logger[_0x5413('0x28')](_0x5413('0x32'));return _0x3e8f0b({'code':0xc8,'message':_0x3e919b});}}catch(_0x2df16b){logger[_0x5413('0x33')](_0x2df16b[_0x5413('0x34')]);return _0x45e609(_0x59286d[_0x5413('0x33')](0x1f4,_0x2df16b));}}return _0x45e609('routing\x20is\x20empty');});},'AcceptMessage':function(_0x5cbacf){var _0x405853=this;return new Promise(function(_0x2d5029,_0x5ae7ae){if(_0x5cbacf['message']&&_0x5cbacf['message']['id']){try{var _0x1d4411=getId(_0x5cbacf[_0x5413('0x35')],_0x5cbacf[_0x5413('0x11')]?_0x5cbacf[_0x5413('0x11')]['id']:0x0,_0x5cbacf[_0x5413('0x12')]?_0x5cbacf['interaction']['id']:0x0);if(_0x5caf5e[_0x5413('0x2d')][_0x1d4411]){_0x5caf5e['rules'][_0x1d4411]['emit'](_0x5413('0x31'));if(rpc[_0x5cbacf[_0x5413('0x35')]+_0x5413('0x36')]){rpc[_0x5cbacf[_0x5413('0x35')]+_0x5413('0x36')][_0x5413('0x37')](_0x1d4411,{'UserId':_0x5cbacf['message'][_0x5413('0x38')]})['catch'](function(_0x55786){logger[_0x5413('0x33')](_0x5413('0x39'));});}}return _0x2d5029({'code':0xc8,'message':_0x5cbacf});}catch(_0x3e980d){logger[_0x5413('0x33')](_0x3e980d[_0x5413('0x34')]);return _0x5ae7ae(_0x405853[_0x5413('0x33')](0x1f4,_0x3e980d));}}logger[_0x5413('0x33')](_0x5413('0x3a'));return _0x5ae7ae(_0x405853[_0x5413('0x33')](0x1f4,_0x5413('0x3a')));});},'RejectMessage':function(_0x1406e3){var _0x46b80d=this;return new Promise(function(_0x5e1191,_0x3618c1){if(_0x1406e3[_0x5413('0x3b')]&&_0x1406e3['agent']['id']){try{if(_0x5caf5e[_0x5413('0x3c')][_0x1406e3[_0x5413('0x3b')]['id']]){_0x5caf5e[_0x5413('0x3c')][_0x1406e3['agent']['id']]['busy']=![];_0x5caf5e[_0x5413('0x3c')][_0x1406e3[_0x5413('0x3b')]['id']][_0x5413('0x3d')]=undefined;}return _0x5e1191({'code':0xc8,'message':_0x1406e3});}catch(_0xa27334){logger['error'](_0xa27334[_0x5413('0x34')]);return _0x3618c1(_0x46b80d[_0x5413('0x33')](0x1f4,_0xa27334));}}logger['error']('message\x20is\x20empty');return _0x3618c1(_0x46b80d['error'](0x1f4,_0x5413('0x3a')));});},'AbandonInteraction':function(_0x5ab864){var _0xc84675=this;return new Promise(function(_0x26c95b,_0x4e2014){if(_0x5ab864['channel']&&_0x5ab864['interaction']&&_0x5ab864['interaction']['id']){try{var _0x44aa47=getId(_0x5ab864[_0x5413('0x35')],_0x5ab864[_0x5413('0x11')]?_0x5ab864['message']['id']:0x0,_0x5ab864[_0x5413('0x12')]?_0x5ab864[_0x5413('0x12')]['id']:0x0);if(_0x5caf5e[_0x5413('0x2d')][_0x44aa47]){_0x5caf5e[_0x5413('0x2d')][_0x44aa47]['emit'](_0x5413('0x31'));}return _0x26c95b({'code':0xc8,'message':_0x5ab864});}catch(_0x5161af){logger[_0x5413('0x33')](_0x5161af[_0x5413('0x34')]);return _0x4e2014(_0xc84675['error'](0x1f4,_0x5161af));}}logger[_0x5413('0x33')]('message\x20is\x20empty');return _0x4e2014(_0xc84675[_0x5413('0x33')](0x1f4,_0x5413('0x3a')));});},'AgentCapacity':function(_0x13ad69){var _0x483c48=this;return new Promise(function(_0x1c5e46,_0x2b4a8a){if(_0x5caf5e[_0x5413('0x3c')][_0x5413('0x3e')](_0x13ad69['id'])){for(var _0xa9756 in _0x13ad69['capacity']){if(_0x13ad69[_0x5413('0x3f')][_0x5413('0x3e')](_0xa9756)){if(_0x5caf5e[_0x5413('0x3c')][_0x13ad69['id']]['hasOwnProperty'](_0xa9756+'CurrentCapacity')){_0x5caf5e['agents'][_0x13ad69['id']][_0xa9756+_0x5413('0x40')]=parseInt(_0x13ad69['capacity'][_0xa9756],0xa);}}}_0x5caf5e[_0x5413('0x3c')][_0x13ad69['id']][_0x5413('0x41')]();return _0x1c5e46({'code':0xc8,'message':_0x5caf5e[_0x5413('0x3c')][_0x13ad69['id']]});}else{return _0x2b4a8a(_0x483c48[_0x5413('0x33')](0x1f4,_0x5413('0x42')));}});},'Agents':function(_0x249ba2){return new Promise(function(_0x56c605,_0x4b95be){var _0x5a6cab=_['values'](_0x5caf5e[_0x5413('0x3c')]);_0x56c605({'count':_0x5a6cab[_0x5413('0x15')],'rows':_0x5a6cab});});},'ChatQueues':function(_0x2a783b){return new Promise(function(_0x4d031b,_0x166d1b){var _0x56bd93=[];for(var _0x35810f in _0x5caf5e[_0x5413('0x43')]){if(_0x5caf5e[_0x5413('0x43')][_0x5413('0x3e')](_0x35810f)){var _0x54bb5c=_0x5caf5e[_0x5413('0x43')][_0x35810f];var _0x50929c={'id':_0x54bb5c['id'],'available':_0x54bb5c[_0x5413('0x44')],'loggedIn':_0x54bb5c[_0x5413('0x45')],'name':_0x54bb5c[_0x5413('0x46')],'paused':_0x54bb5c['paused'],'waiting':_0x54bb5c[_0x5413('0x47')]};_0x56bd93[_0x5413('0x1b')](_0x50929c);}}_0x4d031b({'count':_0x56bd93[_0x5413('0x15')],'rows':_0x56bd93});});},'MailQueues':function(_0x151597){return new Promise(function(_0x5ccffe,_0x53a0e1){var _0x1d9e6a=[];for(var _0x1cfa2f in _0x5caf5e[_0x5413('0x48')]){if(_0x5caf5e['mailQueues'][_0x5413('0x3e')](_0x1cfa2f)){var _0x25baac=_0x5caf5e[_0x5413('0x48')][_0x1cfa2f];var _0x5a8d65={'id':_0x25baac['id'],'available':_0x25baac['available'],'loggedIn':_0x25baac[_0x5413('0x45')],'name':_0x25baac[_0x5413('0x46')],'paused':_0x25baac[_0x5413('0x49')],'waiting':_0x25baac[_0x5413('0x47')]};_0x1d9e6a['push'](_0x5a8d65);}}_0x5ccffe({'count':_0x1d9e6a[_0x5413('0x15')],'rows':_0x1d9e6a});});},'OpenchannelQueues':function(_0x2c612f){return new Promise(function(_0x270437,_0x21e83e){var _0x3b83e8=[];for(var _0x3623cf in _0x5caf5e[_0x5413('0x4a')]){if(_0x5caf5e[_0x5413('0x4a')][_0x5413('0x3e')](_0x3623cf)){var _0x3c3ba4=_0x5caf5e[_0x5413('0x4a')][_0x3623cf];var _0x23411a={'id':_0x3c3ba4['id'],'available':_0x3c3ba4[_0x5413('0x44')],'loggedIn':_0x3c3ba4[_0x5413('0x45')],'name':_0x3c3ba4['name'],'paused':_0x3c3ba4['paused'],'waiting':_0x3c3ba4['waiting']};_0x3b83e8[_0x5413('0x1b')](_0x23411a);}}_0x270437({'count':_0x3b83e8[_0x5413('0x15')],'rows':_0x3b83e8});});},'SmsQueues':function(_0x186eb8){return new Promise(function(_0x49e5d4,_0x1c9116){var _0x4e934c=[];for(var _0x5606fb in _0x5caf5e[_0x5413('0x4b')]){if(_0x5caf5e['smsQueues']['hasOwnProperty'](_0x5606fb)){var _0x106331=_0x5caf5e[_0x5413('0x4b')][_0x5606fb];var _0x1d39cf={'id':_0x106331['id'],'available':_0x106331['available'],'loggedIn':_0x106331[_0x5413('0x45')],'name':_0x106331[_0x5413('0x46')],'paused':_0x106331['paused'],'waiting':_0x106331[_0x5413('0x47')]};_0x4e934c['push'](_0x1d39cf);}}_0x49e5d4({'count':_0x4e934c['length'],'rows':_0x4e934c});});},'FaxQueues':function(_0xb63f9b){return new Promise(function(_0x2e32f5,_0x4fdbf7){var _0x11c467=[];for(var _0x4cb7a6 in _0x5caf5e[_0x5413('0x4c')]){if(_0x5caf5e['faxQueues'][_0x5413('0x3e')](_0x4cb7a6)){var _0x56290c=_0x5caf5e[_0x5413('0x4c')][_0x4cb7a6];var _0x3386d4={'id':_0x56290c['id'],'available':_0x56290c[_0x5413('0x44')],'loggedIn':_0x56290c[_0x5413('0x45')],'name':_0x56290c[_0x5413('0x46')],'paused':_0x56290c[_0x5413('0x49')],'waiting':_0x56290c[_0x5413('0x47')]};_0x11c467['push'](_0x3386d4);}}_0x2e32f5({'count':_0x11c467[_0x5413('0x15')],'rows':_0x11c467});});},'ChatQueuesWaitingInteractions':function(_0xa3adea){return new Promise(function(_0x3427fc,_0x3edcb4){var _0x35a66a=_[_0x5413('0x4d')](_0x5caf5e[_0x5413('0x4e')]);_0x3427fc({'count':_0x35a66a['length'],'rows':_0x35a66a});});},'MailQueuesWaitingInteractions':function(_0xf76029){return new Promise(function(_0xab280,_0x3fbac5){var _0x17b3d5=_[_0x5413('0x4d')](_0x5caf5e[_0x5413('0x4f')]);_0xab280({'count':_0x17b3d5[_0x5413('0x15')],'rows':_0x17b3d5});});},'OpenchannelQueuesWaitingInteractions':function(_0x1732e1){return new Promise(function(_0x4514db,_0x55a68d){var _0xba8a5d=_[_0x5413('0x4d')](_0x5caf5e[_0x5413('0x50')]);_0x4514db({'count':_0xba8a5d[_0x5413('0x15')],'rows':_0xba8a5d});});},'SmsQueuesWaitingInteractions':function(_0x1e5b91){return new Promise(function(_0x4f3e99,_0xca2696){var _0x415ef6=_['values'](_0x5caf5e[_0x5413('0x51')]);_0x4f3e99({'count':_0x415ef6[_0x5413('0x15')],'rows':_0x415ef6});});},'FaxQueuesWaitingInteractions':function(_0x398916){return new Promise(function(_0x4bc25a,_0x4739d1){var _0x5e959a=_[_0x5413('0x4d')](_0x5caf5e['faxQueuesWaitingInteractions']);_0x4bc25a({'count':_0x5e959a[_0x5413('0x15')],'rows':_0x5e959a});});}};var _0x4cb8e3=jayson[_0x5413('0x52')](_0x4ec4a8)[_0x5413('0x53')]();_0x4cb8e3['on']('error',function(_0x3940f1){logger[_0x5413('0x33')](JSON['stringify'](_0x3940f1));return _0x8ac191(_0x3940f1);});_0x4cb8e3[_0x5413('0x54')](0x232c,_0x5413('0x55'),function(){console[_0x5413('0x56')](_0x5413('0x57'),0x232c);return _0x47449f(_0x5413('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 2f1b46c..7f2909b 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 _0xbf33=['all','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','join','stack','util','bluebird','jayson/promise','lodash','routing','client','request','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','then','message','[%s][INTERVAL]\x20%s'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xbf33,0x18d));var _0x3bf3=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xbf33[_0x2cfb58];return _0xd99951;};'use strict';var util=require(_0x3bf3('0x0'));var BPromise=require(_0x3bf3('0x1'));var jayson=require(_0x3bf3('0x2'));var _=require(_0x3bf3('0x3'));var logger=require('../../../config/logger')(_0x3bf3('0x4'));var client=jayson[_0x3bf3('0x5')]['http']({'port':0x232a});function request(_0x2d0cb7,_0xe2e417){return new BPromise(function(_0x542e30,_0xa63fa6){return client[_0x3bf3('0x6')](_0x2d0cb7,_0xe2e417)['then'](function(_0x339fb7){if(_0x339fb7[_0x3bf3('0x7')]){return _0xa63fa6(_0x339fb7[_0x3bf3('0x7')]['message']);}else{return _0x542e30(_0x339fb7[_0x3bf3('0x8')]);}})[_0x3bf3('0x9')](function(_0x42138){return _0xa63fa6(_0x42138);});});}exports[_0x3bf3('0xa')]=function(_0x68699,_0x5c9976,_0x4ac4ca){return function(_0x11c476){if(_0x4ac4ca[_0x3bf3('0xb')]&&!_0x4ac4ca['rules'][_0x68699]){logger[_0x3bf3('0xc')](_0x3bf3('0xd'),_0x68699);return _0x11c476[_0x3bf3('0xe')]();}var _0x28d26d=[];for(var _0x6261ca=0x0;_0x6261ca<_0x5c9976[_0x3bf3('0xf')];_0x6261ca+=0x1){_0x28d26d[_0x3bf3('0x10')](request(_0x3bf3('0x11'),{'command':util[_0x3bf3('0x12')](_0x3bf3('0x13'),_0x5c9976[_0x6261ca])})[_0x3bf3('0x14')](function(_0x33a487){return _0x33a487&&_0x33a487[_0x3bf3('0x15')]&&_0x33a487[_0x3bf3('0x15')]['indexOf']('true')>=0x0?!![]:![];})[_0x3bf3('0x9')](function(_0x4852f0){logger[_0x3bf3('0x7')](_0x3bf3('0x16'),_0x68699,_0x5c9976[_0x6261ca]);}));}BPromise[_0x3bf3('0x17')](_0x28d26d)[_0x3bf3('0x14')](function(_0x133ff7){var _0x5c1eac=_['some'](_0x133ff7);logger[_0x3bf3('0xc')](_0x3bf3('0x18'),_0x68699,_0x5c9976['join'](_0x3bf3('0x19')),_0x5c1eac);_0x11c476[_0x3bf3('0x1a')](_0x5c1eac);})['catch'](function(_0x1c9c96){console[_0x3bf3('0x1b')](_0x1c9c96);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x68699,_0x5c9976[_0x3bf3('0x1c')](_0x3bf3('0x19')),_0x1c9c96[_0x3bf3('0x1d')]);_0x11c476[_0x3bf3('0xe')]();});};}; \ No newline at end of file +var _0x8c9d=['all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','util','lodash','../../../config/logger','routing','http','request','then','error','message','result','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','iftime\x20%s','indexOf','true','catch','[%s][INTERVAL]\x20%s'];(function(_0x206248,_0x3995d3){var _0x4676ad=function(_0xd16d76){while(--_0xd16d76){_0x206248['push'](_0x206248['shift']());}};_0x4676ad(++_0x3995d3);}(_0x8c9d,0x97));var _0xd8c9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8c9d[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0xd8c9('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0xd8c9('0x1'));var logger=require(_0xd8c9('0x2'))(_0xd8c9('0x3'));var client=jayson['client'][_0xd8c9('0x4')]({'port':0x232a});function request(_0x1f1b41,_0x2cf194){return new BPromise(function(_0x3d7d04,_0x4d20a4){return client[_0xd8c9('0x5')](_0x1f1b41,_0x2cf194)[_0xd8c9('0x6')](function(_0x4637dc){if(_0x4637dc[_0xd8c9('0x7')]){return _0x4d20a4(_0x4637dc[_0xd8c9('0x7')][_0xd8c9('0x8')]);}else{return _0x3d7d04(_0x4637dc[_0xd8c9('0x9')]);}})['catch'](function(_0x23d9e0){return _0x4d20a4(_0x23d9e0);});});}exports[_0xd8c9('0xa')]=function(_0x17269f,_0x346d22,_0x3a3650){return function(_0x572a4d){if(_0x3a3650[_0xd8c9('0xb')]&&!_0x3a3650[_0xd8c9('0xb')][_0x17269f]){logger[_0xd8c9('0xc')](_0xd8c9('0xd'),_0x17269f);return _0x572a4d[_0xd8c9('0xe')]();}var _0x582c39=[];for(var _0x171d35=0x0;_0x171d35<_0x346d22[_0xd8c9('0xf')];_0x171d35+=0x1){_0x582c39[_0xd8c9('0x10')](request(_0xd8c9('0x11'),{'command':util['format'](_0xd8c9('0x12'),_0x346d22[_0x171d35])})['then'](function(_0x5e8f64){return _0x5e8f64&&_0x5e8f64[_0xd8c9('0x8')]&&_0x5e8f64[_0xd8c9('0x8')][_0xd8c9('0x13')](_0xd8c9('0x14'))>=0x0?!![]:![];})[_0xd8c9('0x15')](function(_0x536100){logger[_0xd8c9('0x7')](_0xd8c9('0x16'),_0x17269f,_0x346d22[_0x171d35]);}));}BPromise[_0xd8c9('0x17')](_0x582c39)[_0xd8c9('0x6')](function(_0x48dca9){var _0x532fce=_['some'](_0x48dca9);logger[_0xd8c9('0xc')](_0xd8c9('0x18'),_0x17269f,_0x346d22[_0xd8c9('0x19')](_0xd8c9('0x1a')),_0x532fce);_0x572a4d[_0xd8c9('0x1b')](_0x532fce);})[_0xd8c9('0x15')](function(_0x4dd334){console[_0xd8c9('0x1c')](_0x4dd334);logger['error'](_0xd8c9('0x18'),_0x17269f,_0x346d22[_0xd8c9('0x19')](_0xd8c9('0x1a')),_0x4dd334['stack']);_0x572a4d[_0xd8c9('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index e83ab6c..b68c905 100644 --- a/server/services/xdr/agents.controller.js +++ b/server/services/xdr/agents.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c70=['connectedlinenum','queue','then','type','agentacw','acwTimeout','request','CreateVoiceAgentReport','agentringnoanswer','agentconnect','agentcalled','assign','now','called','isNil','destchannel','rejected','queuecallerabandon','forIn','connect','answered_elsewhere','destuniqueid','agentcomplete','complete','blindtransfer','transfererchannel','attendedtransfer','origtransfererchannel','clone','transfertargetchannel','transfertargetconnectedlinenum','secondtransfererchannel','transfereechannel','transfereecalleridname','destinationchannel','agentconnectAt','endtime','agentcalledAt','answertime','starttime','transfer','lodash','util','./utils','info','format','channel','membername','interface'];(function(_0x3a3933,_0x36de17){var _0x15a978=function(_0x178b8f){while(--_0x178b8f){_0x3a3933['push'](_0x3a3933['shift']());}};_0x15a978(++_0x36de17);}(_0x3c70,0x1e2));var _0x03c7=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x3c70[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x03c7('0x0'));var util=require(_0x03c7('0x1'));var utils=require(_0x03c7('0x2'));var agents={};var transfers={};function writeDB(_0x134d75){utils[_0x03c7('0x3')](util[_0x03c7('0x4')]('AGENT|%s|%s|%s|%s|%s|%s|%s|%s',_0x134d75['uniqueid'],_0x134d75[_0x03c7('0x5')],_0x134d75['queue'],_0x134d75[_0x03c7('0x6')],_0x134d75[_0x03c7('0x7')],_0x134d75['calleridnum'],_0x134d75[_0x03c7('0x8')],_0x134d75['lastevent']));if(_0x134d75[_0x03c7('0x9')]){utils['getVoiceQueueByName'](_0x134d75[_0x03c7('0x9')])[_0x03c7('0xa')](function(_0x7d7d96){if(_0x7d7d96){_0x134d75[_0x03c7('0xb')]=_0x7d7d96[_0x03c7('0xb')];_0x134d75[_0x03c7('0xc')]=_0x134d75['agentcomplete']?_0x7d7d96['acw']:![];_0x134d75['acwtime']=_0x134d75['agentacw']?_0x7d7d96[_0x03c7('0xd')]:null;}utils[_0x03c7('0xe')]('CreateVoiceAgentReport',_0x134d75);});}else{utils[_0x03c7('0xe')](_0x03c7('0xf'),_0x134d75);}delete agents[_0x134d75['destchannel']];}function isClosed(_0x506098){return _0x506098[_0x03c7('0x10')]||_0x506098[_0x03c7('0x11')]||_0x506098['agentcomplete'];}exports[_0x03c7('0x12')]=function(_0x570195){agents[_0x570195['destchannel']]=_[_0x03c7('0x13')](_0x570195,{'agentcalled':!![],'agentcalledAt':utils[_0x03c7('0x14')](),'lastevent':_0x03c7('0x15')});};exports[_0x03c7('0x10')]=function(_0x500055){if(!_[_0x03c7('0x16')](agents[_0x500055[_0x03c7('0x17')]])){agents[_0x500055[_0x03c7('0x17')]]=_[_0x03c7('0x13')](agents[_0x500055[_0x03c7('0x17')]],_0x500055,{'agentringnoanswer':!![],'agentringnoanswerAt':utils[_0x03c7('0x14')](),'lastevent':_0x03c7('0x18'),'reason':_0x03c7('0x18')});}};exports[_0x03c7('0x19')]=function(_0xe79d25){_[_0x03c7('0x1a')](agents,function(_0xd6bc24,_0x1b0d7b){if(_0xd6bc24[_0x03c7('0x5')]==_0xe79d25[_0x03c7('0x5')]){if(!isClosed(_0xd6bc24)){_0xd6bc24=_[_0x03c7('0x13')](_0xd6bc24,{'agentringnoanswer':!![],'agentringnoanswerAt':utils['now'](),'lastevent':'abandon','reason':'abandon'});}}});};exports[_0x03c7('0x11')]=function(_0xa890e6){if(!_[_0x03c7('0x16')](agents[_0xa890e6['destchannel']])){agents[_0xa890e6['destchannel']]=_[_0x03c7('0x13')](agents[_0xa890e6['destchannel']],_0xa890e6,{'agentconnect':!![],'agentconnectAt':utils[_0x03c7('0x14')](),'lastevent':_0x03c7('0x1b')});_[_0x03c7('0x1a')](agents,function(_0x541bbe,_0x3bd1f7){if(_0x541bbe[_0x03c7('0x5')]==_0xa890e6[_0x03c7('0x5')]){if(!isClosed(_0x541bbe)){_0x541bbe=_[_0x03c7('0x13')](_0x541bbe,{'agentringnoanswer':!![],'agentringnoanswerAt':utils[_0x03c7('0x14')](),'lastevent':_0x03c7('0x1c'),'reason':'answered_elsewhere','answeredelsewheredestinationuniqueid':_0xa890e6[_0x03c7('0x1d')],'answeredelsewheremembername':_0xa890e6['membername']});}}});}};exports[_0x03c7('0x1e')]=function(_0x2fab54){if(!_['isNil'](agents[_0x2fab54[_0x03c7('0x17')]])){agents[_0x2fab54['destchannel']]=_[_0x03c7('0x13')](agents[_0x2fab54[_0x03c7('0x17')]],_0x2fab54,{'agentcomplete':!![],'agentcompleteAt':utils[_0x03c7('0x14')](),'lastevent':_0x03c7('0x1f')});}};exports[_0x03c7('0x20')]=function(_0x4f53cd){if(!_['isNil'](agents[_0x4f53cd[_0x03c7('0x21')]])){this['cdr']({'destinationchannel':_0x4f53cd[_0x03c7('0x21')]});}};exports[_0x03c7('0x22')]=function(_0x31274e){_[_0x03c7('0x1a')](agents,function(_0x3bb1f0){if(_0x3bb1f0[_0x03c7('0x5')]==_0x31274e[_0x03c7('0x23')]){transfers[_0x3bb1f0[_0x03c7('0x17')]]=_[_0x03c7('0x24')](_0x3bb1f0);transfers[_0x3bb1f0[_0x03c7('0x17')]]=_[_0x03c7('0x13')](transfers[_0x3bb1f0['destchannel']],{'channel':_0x31274e[_0x03c7('0x25')],'calleridname':_0x31274e['transfertargetcalleridname'],'calleridnum':_0x31274e[_0x03c7('0x26')]});}else if(_0x3bb1f0[_0x03c7('0x5')]==_0x31274e[_0x03c7('0x27')]){transfers[_0x3bb1f0['destchannel']]=_[_0x03c7('0x24')](_0x3bb1f0);transfers[_0x3bb1f0[_0x03c7('0x17')]]=_[_0x03c7('0x13')](transfers[_0x3bb1f0[_0x03c7('0x17')]],{'channel':_0x31274e[_0x03c7('0x28')],'calleridname':_0x31274e[_0x03c7('0x29')],'calleridnum':_0x31274e['transfereeconnectedlinenum']});}});};exports['cdr']=function(_0x41a24f){if(!_[_0x03c7('0x16')](agents[_0x41a24f[_0x03c7('0x2a')]])){if(!_[_0x03c7('0x16')](agents[_0x41a24f[_0x03c7('0x2a')]][_0x03c7('0x2b')])){agents[_0x41a24f[_0x03c7('0x2a')]]=_['assign'](agents[_0x41a24f[_0x03c7('0x2a')]],{'agentcomplete':!![],'agentcompleteAt':_0x41a24f[_0x03c7('0x2c')],'holdtime':utils['diffTime'](agents[_0x41a24f[_0x03c7('0x2a')]]['agentconnectAt'],agents[_0x41a24f['destinationchannel']][_0x03c7('0x2d')]),'talktime':utils['diffTime'](_0x41a24f['endtime'],agents[_0x41a24f[_0x03c7('0x2a')]][_0x03c7('0x2b')]),'lastevent':_0x03c7('0x1f')});}else if(_[_0x03c7('0x16')](agents[_0x41a24f['destinationchannel']]['agentringnoanswerAt'])){agents[_0x41a24f[_0x03c7('0x2a')]]=_['assign'](agents[_0x41a24f[_0x03c7('0x2a')]],{'agentringnoanswer':!![],'agentringnoanswerAt':_0x41a24f[_0x03c7('0x2e')]||_0x41a24f[_0x03c7('0x2f')],'reason':'unknown'});}writeDB(agents[_0x41a24f['destinationchannel']]);if(!_['isNil'](transfers[_0x41a24f['destinationchannel']])){agents[_0x41a24f[_0x03c7('0x2a')]]=_[_0x03c7('0x13')](transfers[_0x41a24f[_0x03c7('0x2a')]],{'agentcalledAt':utils[_0x03c7('0x14')](),'agentconnectAt':transfers[_0x41a24f[_0x03c7('0x2a')]][_0x03c7('0x11')]?utils['now']():null,'lastevent':'connect','reason':_0x03c7('0x30')});delete transfers[_0x41a24f['destinationchannel']];}}}; \ No newline at end of file +var _0x28a2=['destuniqueid','complete','transfererchannel','cdr','origtransfererchannel','clone','secondtransfererchannel','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','destinationchannel','agentconnectAt','endtime','diffTime','agentringnoanswerAt','answertime','starttime','unknown','util','./utils','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','queue','interface','calleridnum','connectedlinenum','lastevent','then','type','agentacw','acw','acwtime','request','CreateVoiceAgentReport','destchannel','agentringnoanswer','agentconnect','agentcomplete','agentcalled','assign','now','called','rejected','forIn','channel','abandon','isNil','connect','answered_elsewhere'];(function(_0x5240f1,_0x223650){var _0xa18c04=function(_0x49dbc5){while(--_0x49dbc5){_0x5240f1['push'](_0x5240f1['shift']());}};_0xa18c04(++_0x223650);}(_0x28a2,0x76));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x228a('0x0'));var utils=require(_0x228a('0x1'));var agents={};var transfers={};function writeDB(_0x1265c2){utils['info'](util[_0x228a('0x2')](_0x228a('0x3'),_0x1265c2[_0x228a('0x4')],_0x1265c2['channel'],_0x1265c2[_0x228a('0x5')],_0x1265c2['membername'],_0x1265c2[_0x228a('0x6')],_0x1265c2[_0x228a('0x7')],_0x1265c2[_0x228a('0x8')],_0x1265c2[_0x228a('0x9')]));if(_0x1265c2[_0x228a('0x5')]){utils['getVoiceQueueByName'](_0x1265c2['queue'])[_0x228a('0xa')](function(_0x151704){if(_0x151704){_0x1265c2['type']=_0x151704[_0x228a('0xb')];_0x1265c2[_0x228a('0xc')]=_0x1265c2['agentcomplete']?_0x151704[_0x228a('0xd')]:![];_0x1265c2[_0x228a('0xe')]=_0x1265c2[_0x228a('0xc')]?_0x151704['acwTimeout']:null;}utils['request']('CreateVoiceAgentReport',_0x1265c2);});}else{utils[_0x228a('0xf')](_0x228a('0x10'),_0x1265c2);}delete agents[_0x1265c2[_0x228a('0x11')]];}function isClosed(_0x8abb5e){return _0x8abb5e[_0x228a('0x12')]||_0x8abb5e[_0x228a('0x13')]||_0x8abb5e[_0x228a('0x14')];}exports[_0x228a('0x15')]=function(_0x35d557){agents[_0x35d557[_0x228a('0x11')]]=_[_0x228a('0x16')](_0x35d557,{'agentcalled':!![],'agentcalledAt':utils[_0x228a('0x17')](),'lastevent':_0x228a('0x18')});};exports[_0x228a('0x12')]=function(_0x11bf5a){if(!_['isNil'](agents[_0x11bf5a[_0x228a('0x11')]])){agents[_0x11bf5a[_0x228a('0x11')]]=_[_0x228a('0x16')](agents[_0x11bf5a[_0x228a('0x11')]],_0x11bf5a,{'agentringnoanswer':!![],'agentringnoanswerAt':utils[_0x228a('0x17')](),'lastevent':_0x228a('0x19'),'reason':'rejected'});}};exports['queuecallerabandon']=function(_0x415bf8){_[_0x228a('0x1a')](agents,function(_0x3d7d47,_0x3d5a62){if(_0x3d7d47[_0x228a('0x1b')]==_0x415bf8[_0x228a('0x1b')]){if(!isClosed(_0x3d7d47)){_0x3d7d47=_[_0x228a('0x16')](_0x3d7d47,{'agentringnoanswer':!![],'agentringnoanswerAt':utils['now'](),'lastevent':_0x228a('0x1c'),'reason':_0x228a('0x1c')});}}});};exports['agentconnect']=function(_0x240ce4){if(!_[_0x228a('0x1d')](agents[_0x240ce4[_0x228a('0x11')]])){agents[_0x240ce4[_0x228a('0x11')]]=_[_0x228a('0x16')](agents[_0x240ce4['destchannel']],_0x240ce4,{'agentconnect':!![],'agentconnectAt':utils[_0x228a('0x17')](),'lastevent':_0x228a('0x1e')});_['forIn'](agents,function(_0x42d4da,_0x335dc8){if(_0x42d4da['channel']==_0x240ce4['channel']){if(!isClosed(_0x42d4da)){_0x42d4da=_[_0x228a('0x16')](_0x42d4da,{'agentringnoanswer':!![],'agentringnoanswerAt':utils['now'](),'lastevent':_0x228a('0x1f'),'reason':_0x228a('0x1f'),'answeredelsewheredestinationuniqueid':_0x240ce4[_0x228a('0x20')],'answeredelsewheremembername':_0x240ce4['membername']});}}});}};exports[_0x228a('0x14')]=function(_0x37af39){if(!_['isNil'](agents[_0x37af39[_0x228a('0x11')]])){agents[_0x37af39[_0x228a('0x11')]]=_['assign'](agents[_0x37af39[_0x228a('0x11')]],_0x37af39,{'agentcomplete':!![],'agentcompleteAt':utils['now'](),'lastevent':_0x228a('0x21')});}};exports['blindtransfer']=function(_0x11a700){if(!_['isNil'](agents[_0x11a700[_0x228a('0x22')]])){this[_0x228a('0x23')]({'destinationchannel':_0x11a700[_0x228a('0x22')]});}};exports['attendedtransfer']=function(_0x475094){_[_0x228a('0x1a')](agents,function(_0x58c0ee){if(_0x58c0ee[_0x228a('0x1b')]==_0x475094[_0x228a('0x24')]){transfers[_0x58c0ee['destchannel']]=_[_0x228a('0x25')](_0x58c0ee);transfers[_0x58c0ee[_0x228a('0x11')]]=_[_0x228a('0x16')](transfers[_0x58c0ee['destchannel']],{'channel':_0x475094['transfertargetchannel'],'calleridname':_0x475094['transfertargetcalleridname'],'calleridnum':_0x475094['transfertargetconnectedlinenum']});}else if(_0x58c0ee[_0x228a('0x1b')]==_0x475094[_0x228a('0x26')]){transfers[_0x58c0ee[_0x228a('0x11')]]=_[_0x228a('0x25')](_0x58c0ee);transfers[_0x58c0ee[_0x228a('0x11')]]=_[_0x228a('0x16')](transfers[_0x58c0ee[_0x228a('0x11')]],{'channel':_0x475094[_0x228a('0x27')],'calleridname':_0x475094[_0x228a('0x28')],'calleridnum':_0x475094[_0x228a('0x29')]});}});};exports[_0x228a('0x23')]=function(_0x15ba99){if(!_[_0x228a('0x1d')](agents[_0x15ba99[_0x228a('0x2a')]])){if(!_[_0x228a('0x1d')](agents[_0x15ba99[_0x228a('0x2a')]][_0x228a('0x2b')])){agents[_0x15ba99['destinationchannel']]=_[_0x228a('0x16')](agents[_0x15ba99[_0x228a('0x2a')]],{'agentcomplete':!![],'agentcompleteAt':_0x15ba99[_0x228a('0x2c')],'holdtime':utils[_0x228a('0x2d')](agents[_0x15ba99[_0x228a('0x2a')]]['agentconnectAt'],agents[_0x15ba99[_0x228a('0x2a')]]['agentcalledAt']),'talktime':utils[_0x228a('0x2d')](_0x15ba99['endtime'],agents[_0x15ba99[_0x228a('0x2a')]][_0x228a('0x2b')]),'lastevent':'complete'});}else if(_[_0x228a('0x1d')](agents[_0x15ba99[_0x228a('0x2a')]][_0x228a('0x2e')])){agents[_0x15ba99[_0x228a('0x2a')]]=_['assign'](agents[_0x15ba99[_0x228a('0x2a')]],{'agentringnoanswer':!![],'agentringnoanswerAt':_0x15ba99[_0x228a('0x2f')]||_0x15ba99[_0x228a('0x30')],'reason':_0x228a('0x31')});}writeDB(agents[_0x15ba99[_0x228a('0x2a')]]);if(!_[_0x228a('0x1d')](transfers[_0x15ba99[_0x228a('0x2a')]])){agents[_0x15ba99[_0x228a('0x2a')]]=_[_0x228a('0x16')](transfers[_0x15ba99[_0x228a('0x2a')]],{'agentcalledAt':utils[_0x228a('0x17')](),'agentconnectAt':transfers[_0x15ba99[_0x228a('0x2a')]]['agentconnect']?utils[_0x228a('0x17')]():null,'lastevent':'connect','reason':'transfer'});delete transfers[_0x15ba99[_0x228a('0x2a')]];}}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 1dd6d74..5848d75 100644 --- a/server/services/xdr/calls.controller.js +++ b/server/services/xdr/calls.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf91=['xmd-callerid-preview','xmd-callerid','xmd-queue','lastapplication','lastdata','ContactId','outboundrouteid','routeid','newexten','toLowerCase','set','cdr','appdata','substring','lastIndexOf','assign','isBefore','starttime','isAfter','endtime','startsWith','destinationchannel','duration','diffTime','billableseconds','hangup','lodash','util','./utils','answertime','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','channel','type','accountcode','source','destination','callerid','disposition','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','isNil','uniqueid','linkedid','musiconholdstartAt','now','varset','xmd-originatecalleridnum','value','xmd-phone','variable'];(function(_0x11b4fb,_0x10c784){var _0x56cbb5=function(_0x56d812){while(--_0x56d812){_0x11b4fb['push'](_0x11b4fb['shift']());}};_0x56cbb5(++_0x10c784);}(_0xbf91,0x1da));var _0x1bf9=function(_0x4475a1,_0x360982){_0x4475a1=_0x4475a1-0x0;var _0x5245ed=_0xbf91[_0x4475a1];return _0x5245ed;};'use strict';var _=require(_0x1bf9('0x0'));var util=require(_0x1bf9('0x1'));var utils=require(_0x1bf9('0x2'));var channels={};var timeouts={};function writeDB(_0x3f5e04){return function(){_0x3f5e04[_0x1bf9('0x3')]=_0x3f5e04['answertime']||null;utils[_0x1bf9('0x4')](util[_0x1bf9('0x5')](_0x1bf9('0x6'),_0x3f5e04['uniqueid'],_0x3f5e04[_0x1bf9('0x7')],_0x3f5e04[_0x1bf9('0x8')],_0x3f5e04[_0x1bf9('0x9')],_0x3f5e04[_0x1bf9('0xa')],_0x3f5e04[_0x1bf9('0xb')],_0x3f5e04[_0x1bf9('0xc')],_0x3f5e04[_0x1bf9('0xd')]));if(_0x3f5e04[_0x1bf9('0x9')]){utils[_0x1bf9('0xe')](_0x3f5e04[_0x1bf9('0x9')])[_0x1bf9('0xf')](function(_0x415b8d){if(_0x415b8d){_0x3f5e04[_0x1bf9('0x10')]=_0x415b8d['id'];}utils[_0x1bf9('0x11')](_0x1bf9('0x12'),_0x3f5e04);});}else{utils['request']('CreateVoiceCallReport',_0x3f5e04);}if(channels[_0x3f5e04[_0x1bf9('0x7')]]){delete channels[_0x3f5e04[_0x1bf9('0x7')]];}if(timeouts[_0x3f5e04[_0x1bf9('0x7')]]){delete timeouts[_0x3f5e04[_0x1bf9('0x7')]];}};}exports[_0x1bf9('0x13')]=function(_0x8a55a2){if(_[_0x1bf9('0x14')](channels[_0x8a55a2[_0x1bf9('0x7')]])&&_0x8a55a2[_0x1bf9('0x15')]==_0x8a55a2[_0x1bf9('0x16')]){channels[_0x8a55a2[_0x1bf9('0x7')]]={'mohtime':0x0};if(_0x8a55a2[_0x1bf9('0x9')]){channels[_0x8a55a2[_0x1bf9('0x7')]][_0x1bf9('0x9')]=_0x8a55a2[_0x1bf9('0x9')];}}};exports['musiconholdstart']=function(_0x1659e8){if(!_[_0x1bf9('0x14')](channels[_0x1659e8['channel']])){channels[_0x1659e8[_0x1bf9('0x7')]][_0x1bf9('0x17')]=utils[_0x1bf9('0x18')]();}};exports['musiconholdstop']=function(_0x474362){if(!_[_0x1bf9('0x14')](channels[_0x474362[_0x1bf9('0x7')]])){if(!_['isNil'](channels[_0x474362[_0x1bf9('0x7')]][_0x1bf9('0x17')])){channels[_0x474362['channel']]['mohtime']+=utils['diffTime'](utils[_0x1bf9('0x18')](),channels[_0x474362[_0x1bf9('0x7')]][_0x1bf9('0x17')]);delete channels[_0x474362['channel']][_0x1bf9('0x17')];}}};exports[_0x1bf9('0x19')]=function(_0x4f0614){if(!_['isNil'](channels[_0x4f0614[_0x1bf9('0x7')]])){if(!_[_0x1bf9('0x14')](_0x4f0614['variable'][_0x1bf9('0x1a')])){channels[_0x4f0614['channel']]['source']=_0x4f0614[_0x1bf9('0x1b')];}if(!_[_0x1bf9('0x14')](_0x4f0614['variable'][_0x1bf9('0x1c')])){channels[_0x4f0614[_0x1bf9('0x7')]][_0x1bf9('0xb')]=_0x4f0614[_0x1bf9('0x1b')];}if(!_[_0x1bf9('0x14')](_0x4f0614[_0x1bf9('0x1d')][_0x1bf9('0x1e')])||!_['isNil'](_0x4f0614[_0x1bf9('0x1d')][_0x1bf9('0x1f')])){channels[_0x4f0614[_0x1bf9('0x7')]]['callerid']=_0x4f0614[_0x1bf9('0x1b')];}if(!_[_0x1bf9('0x14')](_0x4f0614[_0x1bf9('0x1d')][_0x1bf9('0x20')])){channels[_0x4f0614[_0x1bf9('0x7')]][_0x1bf9('0x21')]='Queue';channels[_0x4f0614['channel']][_0x1bf9('0x22')]=_0x4f0614[_0x1bf9('0x1b')];channels[_0x4f0614['channel']]['queue']=!![];}if(!_[_0x1bf9('0x14')](_0x4f0614['variable']['xmd-contactid'])){channels[_0x4f0614[_0x1bf9('0x7')]][_0x1bf9('0x23')]=_0x4f0614[_0x1bf9('0x1b')];}if(!_[_0x1bf9('0x14')](_0x4f0614[_0x1bf9('0x1d')][_0x1bf9('0x24')])){channels[_0x4f0614[_0x1bf9('0x7')]][_0x1bf9('0x25')]=_0x4f0614[_0x1bf9('0x1b')];}}};exports[_0x1bf9('0x26')]=function(_0x4923fd){if(!_['isNil'](channels[_0x4923fd[_0x1bf9('0x7')]])){if(_0x4923fd['application'][_0x1bf9('0x27')]()==_0x1bf9('0x28')&&_['startsWith'](_0x4923fd['appdata'][_0x1bf9('0x27')](),_0x1bf9('0x29'))){var _0x127f91=_0x4923fd[_0x1bf9('0x2a')]['split']('=');var _0x361cfa=_0x127f91[0x0][_0x1bf9('0x2b')](_0x127f91[0x0][_0x1bf9('0x2c')]('(')+0x1,_0x127f91[0x0][_0x1bf9('0x2c')](')'));var _0x390105=_0x127f91[0x1];channels[_0x4923fd[_0x1bf9('0x7')]][_0x361cfa]=_0x390105;}}};exports['agentcomplete']=function(_0x590014){if(!_[_0x1bf9('0x14')](channels[_0x590014[_0x1bf9('0x7')]])){channels[_0x590014[_0x1bf9('0x7')]][_0x1bf9('0x9')]=_0x590014['destaccountcode'];}};function handleCDR(_0x173c96){if(_[_0x1bf9('0x14')](timeouts[_0x173c96['channel']])){channels[_0x173c96[_0x1bf9('0x7')]]=_['assign'](_0x173c96,channels[_0x173c96[_0x1bf9('0x7')]]);}else{clearTimeout(timeouts[_0x173c96['channel']]);channels[_0x173c96[_0x1bf9('0x7')]]=_[_0x1bf9('0x2d')](channels[_0x173c96[_0x1bf9('0x7')]],{'starttime':utils[_0x1bf9('0x2e')](_0x173c96['starttime'],channels[_0x173c96[_0x1bf9('0x7')]][_0x1bf9('0x2f')])?_0x173c96['starttime']:channels[_0x173c96[_0x1bf9('0x7')]][_0x1bf9('0x2f')],'answertime':utils[_0x1bf9('0x2e')](_0x173c96[_0x1bf9('0x3')],channels[_0x173c96['channel']][_0x1bf9('0x3')])?_0x173c96[_0x1bf9('0x3')]:channels[_0x173c96[_0x1bf9('0x7')]][_0x1bf9('0x3')]});if(utils[_0x1bf9('0x30')](_0x173c96[_0x1bf9('0x31')],channels[_0x173c96[_0x1bf9('0x7')]]['endtime'])){channels[_0x173c96[_0x1bf9('0x7')]]=_['assign'](channels[_0x173c96[_0x1bf9('0x7')]],{'endtime':_0x173c96[_0x1bf9('0x31')],'destinationchannel':_[_0x1bf9('0x32')](_0x173c96[_0x1bf9('0x33')],'Local/_attended@transfer')?channels[_0x173c96[_0x1bf9('0x7')]][_0x1bf9('0x33')]:_0x173c96[_0x1bf9('0x33')]});}channels[_0x173c96['channel']][_0x1bf9('0x34')]=utils[_0x1bf9('0x35')](channels[_0x173c96['channel']][_0x1bf9('0x31')],channels[_0x173c96[_0x1bf9('0x7')]][_0x1bf9('0x2f')]);channels[_0x173c96['channel']][_0x1bf9('0x36')]=utils['diffTime'](channels[_0x173c96[_0x1bf9('0x7')]][_0x1bf9('0x31')],channels[_0x173c96[_0x1bf9('0x7')]][_0x1bf9('0x3')]);if(_0x173c96['lastapplication'][_0x1bf9('0x27')]()!=_0x1bf9('0x37')){channels[_0x173c96[_0x1bf9('0x7')]][_0x1bf9('0x22')]=_0x173c96[_0x1bf9('0x22')];channels[_0x173c96['channel']][_0x1bf9('0x21')]=_0x173c96[_0x1bf9('0x21')];}}timeouts[_0x173c96[_0x1bf9('0x7')]]=setTimeout(writeDB(channels[_0x173c96[_0x1bf9('0x7')]]),0x3e8);}exports['cdr']=function(_0x55a177){if(!_['isNil'](channels[_0x55a177['channel']])){handleCDR(_0x55a177);}else if(!_[_0x1bf9('0x14')](channels[_0x55a177[_0x1bf9('0x33')]])){_0x55a177[_0x1bf9('0x7')]=_0x55a177['destinationchannel'];handleCDR(_0x55a177);}}; \ No newline at end of file +var _0xc057=['accountcode','source','destination','disposition','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','isNil','linkedid','musiconholdstart','musiconholdstartAt','now','musiconholdstop','diffTime','varset','variable','value','xmd-phone','xmd-callerid-preview','xmd-callerid','callerid','xmd-queue','lastdata','queue','xmd-contactid','ContactId','outboundrouteid','routeid','newexten','application','toLowerCase','set','startsWith','cdr','appdata','split','lastIndexOf','agentcomplete','destaccountcode','assign','isBefore','starttime','answertime','endtime','destinationchannel','duration','billableseconds','lastapplication','hangup','lodash','util','./utils','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','type'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xc057,0xac));var _0x7c05=function(_0x2ca0f4,_0x2ac047){_0x2ca0f4=_0x2ca0f4-0x0;var _0x52b579=_0xc057[_0x2ca0f4];return _0x52b579;};'use strict';var _=require(_0x7c05('0x0'));var util=require(_0x7c05('0x1'));var utils=require(_0x7c05('0x2'));var channels={};var timeouts={};function writeDB(_0x2a0b03){return function(){_0x2a0b03['answertime']=_0x2a0b03['answertime']||null;utils['info'](util[_0x7c05('0x3')](_0x7c05('0x4'),_0x2a0b03[_0x7c05('0x5')],_0x2a0b03[_0x7c05('0x6')],_0x2a0b03[_0x7c05('0x7')],_0x2a0b03[_0x7c05('0x8')],_0x2a0b03[_0x7c05('0x9')],_0x2a0b03[_0x7c05('0xa')],_0x2a0b03['callerid'],_0x2a0b03[_0x7c05('0xb')]));if(_0x2a0b03[_0x7c05('0x8')]){utils[_0x7c05('0xc')](_0x2a0b03[_0x7c05('0x8')])[_0x7c05('0xd')](function(_0x29d8c5){if(_0x29d8c5){_0x2a0b03[_0x7c05('0xe')]=_0x29d8c5['id'];}utils[_0x7c05('0xf')]('CreateVoiceCallReport',_0x2a0b03);});}else{utils[_0x7c05('0xf')](_0x7c05('0x10'),_0x2a0b03);}if(channels[_0x2a0b03['channel']]){delete channels[_0x2a0b03[_0x7c05('0x6')]];}if(timeouts[_0x2a0b03[_0x7c05('0x6')]]){delete timeouts[_0x2a0b03[_0x7c05('0x6')]];}};}exports[_0x7c05('0x11')]=function(_0x118609){if(_[_0x7c05('0x12')](channels[_0x118609['channel']])&&_0x118609[_0x7c05('0x5')]==_0x118609[_0x7c05('0x13')]){channels[_0x118609[_0x7c05('0x6')]]={'mohtime':0x0};if(_0x118609[_0x7c05('0x8')]){channels[_0x118609[_0x7c05('0x6')]][_0x7c05('0x8')]=_0x118609[_0x7c05('0x8')];}}};exports[_0x7c05('0x14')]=function(_0x457f92){if(!_['isNil'](channels[_0x457f92['channel']])){channels[_0x457f92[_0x7c05('0x6')]][_0x7c05('0x15')]=utils[_0x7c05('0x16')]();}};exports[_0x7c05('0x17')]=function(_0x39e629){if(!_[_0x7c05('0x12')](channels[_0x39e629[_0x7c05('0x6')]])){if(!_[_0x7c05('0x12')](channels[_0x39e629[_0x7c05('0x6')]][_0x7c05('0x15')])){channels[_0x39e629['channel']]['mohtime']+=utils[_0x7c05('0x18')](utils[_0x7c05('0x16')](),channels[_0x39e629[_0x7c05('0x6')]][_0x7c05('0x15')]);delete channels[_0x39e629[_0x7c05('0x6')]][_0x7c05('0x15')];}}};exports[_0x7c05('0x19')]=function(_0x222993){if(!_[_0x7c05('0x12')](channels[_0x222993[_0x7c05('0x6')]])){if(!_[_0x7c05('0x12')](_0x222993[_0x7c05('0x1a')]['xmd-originatecalleridnum'])){channels[_0x222993[_0x7c05('0x6')]][_0x7c05('0x9')]=_0x222993[_0x7c05('0x1b')];}if(!_['isNil'](_0x222993[_0x7c05('0x1a')][_0x7c05('0x1c')])){channels[_0x222993[_0x7c05('0x6')]][_0x7c05('0xa')]=_0x222993[_0x7c05('0x1b')];}if(!_[_0x7c05('0x12')](_0x222993['variable'][_0x7c05('0x1d')])||!_[_0x7c05('0x12')](_0x222993['variable'][_0x7c05('0x1e')])){channels[_0x222993['channel']][_0x7c05('0x1f')]=_0x222993['value'];}if(!_['isNil'](_0x222993[_0x7c05('0x1a')][_0x7c05('0x20')])){channels[_0x222993[_0x7c05('0x6')]]['lastapplication']='Queue';channels[_0x222993[_0x7c05('0x6')]][_0x7c05('0x21')]=_0x222993[_0x7c05('0x1b')];channels[_0x222993[_0x7c05('0x6')]][_0x7c05('0x22')]=!![];}if(!_[_0x7c05('0x12')](_0x222993[_0x7c05('0x1a')][_0x7c05('0x23')])){channels[_0x222993['channel']][_0x7c05('0x24')]=_0x222993['value'];}if(!_[_0x7c05('0x12')](_0x222993[_0x7c05('0x1a')][_0x7c05('0x25')])){channels[_0x222993[_0x7c05('0x6')]][_0x7c05('0x26')]=_0x222993[_0x7c05('0x1b')];}}};exports[_0x7c05('0x27')]=function(_0x58beaa){if(!_['isNil'](channels[_0x58beaa['channel']])){if(_0x58beaa[_0x7c05('0x28')][_0x7c05('0x29')]()==_0x7c05('0x2a')&&_[_0x7c05('0x2b')](_0x58beaa['appdata'][_0x7c05('0x29')](),_0x7c05('0x2c'))){var _0x5965d5=_0x58beaa[_0x7c05('0x2d')][_0x7c05('0x2e')]('=');var _0x84337c=_0x5965d5[0x0]['substring'](_0x5965d5[0x0][_0x7c05('0x2f')]('(')+0x1,_0x5965d5[0x0][_0x7c05('0x2f')](')'));var _0x2d28c0=_0x5965d5[0x1];channels[_0x58beaa[_0x7c05('0x6')]][_0x84337c]=_0x2d28c0;}}};exports[_0x7c05('0x30')]=function(_0xaa371){if(!_[_0x7c05('0x12')](channels[_0xaa371[_0x7c05('0x6')]])){channels[_0xaa371[_0x7c05('0x6')]][_0x7c05('0x8')]=_0xaa371[_0x7c05('0x31')];}};function handleCDR(_0x1ab7e1){if(_[_0x7c05('0x12')](timeouts[_0x1ab7e1[_0x7c05('0x6')]])){channels[_0x1ab7e1[_0x7c05('0x6')]]=_[_0x7c05('0x32')](_0x1ab7e1,channels[_0x1ab7e1[_0x7c05('0x6')]]);}else{clearTimeout(timeouts[_0x1ab7e1[_0x7c05('0x6')]]);channels[_0x1ab7e1[_0x7c05('0x6')]]=_['assign'](channels[_0x1ab7e1[_0x7c05('0x6')]],{'starttime':utils[_0x7c05('0x33')](_0x1ab7e1[_0x7c05('0x34')],channels[_0x1ab7e1[_0x7c05('0x6')]][_0x7c05('0x34')])?_0x1ab7e1[_0x7c05('0x34')]:channels[_0x1ab7e1[_0x7c05('0x6')]][_0x7c05('0x34')],'answertime':utils['isBefore'](_0x1ab7e1[_0x7c05('0x35')],channels[_0x1ab7e1['channel']][_0x7c05('0x35')])?_0x1ab7e1[_0x7c05('0x35')]:channels[_0x1ab7e1[_0x7c05('0x6')]][_0x7c05('0x35')]});if(utils['isAfter'](_0x1ab7e1['endtime'],channels[_0x1ab7e1['channel']][_0x7c05('0x36')])){channels[_0x1ab7e1[_0x7c05('0x6')]]=_[_0x7c05('0x32')](channels[_0x1ab7e1[_0x7c05('0x6')]],{'endtime':_0x1ab7e1[_0x7c05('0x36')],'destinationchannel':_['startsWith'](_0x1ab7e1[_0x7c05('0x37')],'Local/_attended@transfer')?channels[_0x1ab7e1[_0x7c05('0x6')]][_0x7c05('0x37')]:_0x1ab7e1[_0x7c05('0x37')]});}channels[_0x1ab7e1[_0x7c05('0x6')]][_0x7c05('0x38')]=utils[_0x7c05('0x18')](channels[_0x1ab7e1['channel']]['endtime'],channels[_0x1ab7e1['channel']][_0x7c05('0x34')]);channels[_0x1ab7e1['channel']][_0x7c05('0x39')]=utils['diffTime'](channels[_0x1ab7e1[_0x7c05('0x6')]][_0x7c05('0x36')],channels[_0x1ab7e1[_0x7c05('0x6')]]['answertime']);if(_0x1ab7e1[_0x7c05('0x3a')]['toLowerCase']()!=_0x7c05('0x3b')){channels[_0x1ab7e1[_0x7c05('0x6')]][_0x7c05('0x21')]=_0x1ab7e1['lastdata'];channels[_0x1ab7e1[_0x7c05('0x6')]]['lastapplication']=_0x1ab7e1[_0x7c05('0x3a')];}}timeouts[_0x1ab7e1[_0x7c05('0x6')]]=setTimeout(writeDB(channels[_0x1ab7e1[_0x7c05('0x6')]]),0x3e8);}exports[_0x7c05('0x2c')]=function(_0x23314a){if(!_['isNil'](channels[_0x23314a['channel']])){handleCDR(_0x23314a);}else if(!_[_0x7c05('0x12')](channels[_0x23314a[_0x7c05('0x37')]])){_0x23314a['channel']=_0x23314a[_0x7c05('0x37')];handleCDR(_0x23314a);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index a42db23..b665c62 100644 --- a/server/services/xdr/core.controller.js +++ b/server/services/xdr/core.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed64=['FULLYBOOTED','error','close','managerevent','./utils','shutdown','info','fullybooted'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xed64,0xec));var _0x4ed6=function(_0x4ed17b,_0x2b1745){_0x4ed17b=_0x4ed17b-0x0;var _0x24b248=_0xed64[_0x4ed17b];return _0x24b248;};'use strict';var utils=require(_0x4ed6('0x0'));exports['connect']=function(){utils['info']('CONNECTED');};exports[_0x4ed6('0x1')]=function(){utils[_0x4ed6('0x2')]('SHUTDOWN');};exports[_0x4ed6('0x3')]=function(){utils[_0x4ed6('0x2')](_0x4ed6('0x4'));};exports[_0x4ed6('0x5')]=function(_0x218ce7){utils['error'](_0x218ce7);};exports[_0x4ed6('0x6')]=function(){utils[_0x4ed6('0x2')]('CLOSE');};exports[_0x4ed6('0x7')]=function(_0x36649b){}; \ No newline at end of file +var _0xfed0=['error','close','managerevent','./utils','info','CONNECTED','FULLYBOOTED'];(function(_0x35355f,_0x507937){var _0x2c1224=function(_0x29141c){while(--_0x29141c){_0x35355f['push'](_0x35355f['shift']());}};_0x2c1224(++_0x507937);}(_0xfed0,0xf1));var _0x0fed=function(_0x1c19fd,_0x436fc4){_0x1c19fd=_0x1c19fd-0x0;var _0x59a04c=_0xfed0[_0x1c19fd];return _0x59a04c;};'use strict';var utils=require(_0x0fed('0x0'));exports['connect']=function(){utils[_0x0fed('0x1')](_0x0fed('0x2'));};exports['shutdown']=function(){utils['info']('SHUTDOWN');};exports['fullybooted']=function(){utils[_0x0fed('0x1')](_0x0fed('0x3'));};exports[_0x0fed('0x4')]=function(_0x274093){utils[_0x0fed('0x4')](_0x274093);};exports[_0x0fed('0x5')]=function(){utils[_0x0fed('0x1')]('CLOSE');};exports[_0x0fed('0x6')]=function(_0x8a2b49){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 50dfc3a..82e7f73 100644 --- a/server/services/xdr/dials.controller.js +++ b/server/services/xdr/dials.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['application','toLowerCase','cdr(routeid)','appdata','split','routeid','variable','outboundrouteid','dialbegin','destcontext','from-voip-provider','assign','called','dialend','dialstatus','ANSWER','now','connect','complete','duration','diffTime','starttime','holdtime','billableseconds','answertime','lodash','util','./utils','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','isNil','newexten'];(function(_0x45dbe3,_0xd2bf96){var _0x1e71cf=function(_0x47d46d){while(--_0x47d46d){_0x45dbe3['push'](_0x45dbe3['shift']());}};_0x1e71cf(++_0xd2bf96);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var utils=require(_0x0a9e('0x2'));var dials={};var channels={};function writeDB(_0x5dd881){utils['info'](util[_0x0a9e('0x3')]('DIAL|%s|%s|%s|%s|%s|%s',_0x5dd881[_0x0a9e('0x4')],_0x5dd881[_0x0a9e('0x5')],_0x5dd881[_0x0a9e('0x6')],_0x5dd881[_0x0a9e('0x7')],_0x5dd881[_0x0a9e('0x8')],_0x5dd881['dialstatus']));utils[_0x0a9e('0x9')](_0x0a9e('0xa'),_0x5dd881);delete dials[_0x5dd881[_0x0a9e('0x5')]];}exports['newchannel']=function(_0x503809){if(_[_0x0a9e('0xb')](channels[_0x503809['channel']])){channels[_0x503809['channel']]={'routeid':null};}};exports[_0x0a9e('0xc')]=function(_0xf81284){if(!_[_0x0a9e('0xb')](channels[_0xf81284[_0x0a9e('0x5')]])){if(_0xf81284[_0x0a9e('0xd')][_0x0a9e('0xe')]()=='set'&&_['startsWith'](_0xf81284['appdata']['toLowerCase'](),_0x0a9e('0xf'))){var _0x36471c=_0xf81284[_0x0a9e('0x10')][_0x0a9e('0x11')]('=');channels[_0xf81284[_0x0a9e('0x5')]][_0x0a9e('0x12')]=_0x36471c[0x1];}}};exports['varset']=function(_0x4283ce){if(!_[_0x0a9e('0xb')](channels[_0x4283ce[_0x0a9e('0x5')]])){if(!_[_0x0a9e('0xb')](_0x4283ce[_0x0a9e('0x13')][_0x0a9e('0x14')])){channels[_0x4283ce['channel']][_0x0a9e('0x12')]=_0x4283ce['value'];}}};exports[_0x0a9e('0x15')]=function(_0x519dfd){if(_0x519dfd[_0x0a9e('0x16')]==_0x0a9e('0x17')){dials[_0x519dfd['channel']]=_[_0x0a9e('0x18')](_0x519dfd,{'starttime':utils['now'](),'lastevent':_0x0a9e('0x19')});}};exports[_0x0a9e('0x1a')]=function(_0x106033){if(!_[_0x0a9e('0xb')](dials[_0x106033[_0x0a9e('0x5')]])){dials[_0x106033[_0x0a9e('0x5')]]=_[_0x0a9e('0x18')](dials[_0x106033[_0x0a9e('0x5')]],_0x106033,{'answertime':_0x106033[_0x0a9e('0x1b')]==_0x0a9e('0x1c')?utils[_0x0a9e('0x1d')]():null,'lastevent':_0x106033[_0x0a9e('0x1b')]=='ANSWER'?_0x0a9e('0x1e'):_0x0a9e('0x19')});}};exports['cdr']=function(_0x20f109){if(!_['isNil'](channels[_0x20f109['channel']])){if(!_[_0x0a9e('0xb')](dials[_0x20f109[_0x0a9e('0x5')]])){dials[_0x20f109[_0x0a9e('0x5')]]=_[_0x0a9e('0x18')](dials[_0x20f109['channel']],{'endtime':utils[_0x0a9e('0x1d')](),'routeId':channels[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x12')],'lastevent':_0x0a9e('0x1f')});dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x20')]=utils[_0x0a9e('0x21')](dials[_0x20f109['channel']]['endtime'],dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x22')]);dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x23')]=utils['diffTime'](dials[_0x20f109[_0x0a9e('0x5')]]['answertime']||dials[_0x20f109[_0x0a9e('0x5')]]['endtime'],dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x22')]);dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x24')]=dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x25')]?utils[_0x0a9e('0x21')](dials[_0x20f109[_0x0a9e('0x5')]]['endtime'],dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x25')]):0x0;writeDB(dials[_0x20f109[_0x0a9e('0x5')]]);}delete channels[_0x20f109[_0x0a9e('0x5')]];}}; \ No newline at end of file +var _0xa9e0=['application','toLowerCase','cdr(routeid)','appdata','split','routeid','variable','outboundrouteid','dialbegin','destcontext','from-voip-provider','assign','called','dialend','dialstatus','ANSWER','now','connect','complete','duration','diffTime','starttime','holdtime','billableseconds','answertime','lodash','util','./utils','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','isNil','newexten'];(function(_0x5706fb,_0xacfe3c){var _0x21799d=function(_0x9a813e){while(--_0x9a813e){_0x5706fb['push'](_0x5706fb['shift']());}};_0x21799d(++_0xacfe3c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var utils=require(_0x0a9e('0x2'));var dials={};var channels={};function writeDB(_0x5dd881){utils['info'](util[_0x0a9e('0x3')]('DIAL|%s|%s|%s|%s|%s|%s',_0x5dd881[_0x0a9e('0x4')],_0x5dd881[_0x0a9e('0x5')],_0x5dd881[_0x0a9e('0x6')],_0x5dd881[_0x0a9e('0x7')],_0x5dd881[_0x0a9e('0x8')],_0x5dd881['dialstatus']));utils[_0x0a9e('0x9')](_0x0a9e('0xa'),_0x5dd881);delete dials[_0x5dd881[_0x0a9e('0x5')]];}exports['newchannel']=function(_0x503809){if(_[_0x0a9e('0xb')](channels[_0x503809['channel']])){channels[_0x503809['channel']]={'routeid':null};}};exports[_0x0a9e('0xc')]=function(_0xf81284){if(!_[_0x0a9e('0xb')](channels[_0xf81284[_0x0a9e('0x5')]])){if(_0xf81284[_0x0a9e('0xd')][_0x0a9e('0xe')]()=='set'&&_['startsWith'](_0xf81284['appdata']['toLowerCase'](),_0x0a9e('0xf'))){var _0x36471c=_0xf81284[_0x0a9e('0x10')][_0x0a9e('0x11')]('=');channels[_0xf81284[_0x0a9e('0x5')]][_0x0a9e('0x12')]=_0x36471c[0x1];}}};exports['varset']=function(_0x4283ce){if(!_[_0x0a9e('0xb')](channels[_0x4283ce[_0x0a9e('0x5')]])){if(!_[_0x0a9e('0xb')](_0x4283ce[_0x0a9e('0x13')][_0x0a9e('0x14')])){channels[_0x4283ce['channel']][_0x0a9e('0x12')]=_0x4283ce['value'];}}};exports[_0x0a9e('0x15')]=function(_0x519dfd){if(_0x519dfd[_0x0a9e('0x16')]==_0x0a9e('0x17')){dials[_0x519dfd['channel']]=_[_0x0a9e('0x18')](_0x519dfd,{'starttime':utils['now'](),'lastevent':_0x0a9e('0x19')});}};exports[_0x0a9e('0x1a')]=function(_0x106033){if(!_[_0x0a9e('0xb')](dials[_0x106033[_0x0a9e('0x5')]])){dials[_0x106033[_0x0a9e('0x5')]]=_[_0x0a9e('0x18')](dials[_0x106033[_0x0a9e('0x5')]],_0x106033,{'answertime':_0x106033[_0x0a9e('0x1b')]==_0x0a9e('0x1c')?utils[_0x0a9e('0x1d')]():null,'lastevent':_0x106033[_0x0a9e('0x1b')]=='ANSWER'?_0x0a9e('0x1e'):_0x0a9e('0x19')});}};exports['cdr']=function(_0x20f109){if(!_['isNil'](channels[_0x20f109['channel']])){if(!_[_0x0a9e('0xb')](dials[_0x20f109[_0x0a9e('0x5')]])){dials[_0x20f109[_0x0a9e('0x5')]]=_[_0x0a9e('0x18')](dials[_0x20f109['channel']],{'endtime':utils[_0x0a9e('0x1d')](),'routeId':channels[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x12')],'lastevent':_0x0a9e('0x1f')});dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x20')]=utils[_0x0a9e('0x21')](dials[_0x20f109['channel']]['endtime'],dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x22')]);dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x23')]=utils['diffTime'](dials[_0x20f109[_0x0a9e('0x5')]]['answertime']||dials[_0x20f109[_0x0a9e('0x5')]]['endtime'],dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x22')]);dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x24')]=dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x25')]?utils[_0x0a9e('0x21')](dials[_0x20f109[_0x0a9e('0x5')]]['endtime'],dials[_0x20f109[_0x0a9e('0x5')]][_0x0a9e('0x25')]):0x0;writeDB(dials[_0x20f109[_0x0a9e('0x5')]]);}delete channels[_0x20f109[_0x0a9e('0x5')]];}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index a246734..c0b9e1d 100644 --- a/server/services/xdr/index.js +++ b/server/services/xdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7266=['close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','./agents.controller','./calls.controller','./queues.controller','./dials.controller','./transfers.controller','asterisk','port','username','password','keepConnected','connect','shutdown','fullybooted','error'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7266,0xec));var _0x6726=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x7266[_0x3ab9ee];return _0x82ee88;};var AsteriskManager=require(_0x6726('0x0'));var config=require(_0x6726('0x1'));var agents=require(_0x6726('0x2'));var calls=require(_0x6726('0x3'));var queues=require(_0x6726('0x4'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0x6726('0x5'));var transfers=require(_0x6726('0x6'));var core=require('./core.controller');var utils=require('./utils');var ami=new AsteriskManager(config[_0x6726('0x7')][_0x6726('0x8')],config[_0x6726('0x7')]['ip'],config[_0x6726('0x7')][_0x6726('0x9')],config[_0x6726('0x7')][_0x6726('0xa')],!![]);ami[_0x6726('0xb')]();ami['on'](_0x6726('0xc'),core[_0x6726('0xc')]);ami['on'](_0x6726('0xd'),core[_0x6726('0xd')]);ami['on'](_0x6726('0xe'),core['fullybooted']);ami['on'](_0x6726('0xf'),core[_0x6726('0xf')]);ami['on'](_0x6726('0x10'),core[_0x6726('0x10')]);ami['on']('managerevent',core[_0x6726('0x11')]);ami['on']('devicestatechange',function(_0x137f29){try{members[_0x6726('0x12')](_0x137f29);}catch(_0x59c044){utils[_0x6726('0xf')](_0x59c044);}});ami['on'](_0x6726('0x13'),function(_0x1182b2){try{agents[_0x6726('0x13')](_0x1182b2);}catch(_0x587b52){utils[_0x6726('0xf')](_0x587b52);}});ami['on'](_0x6726('0x14'),function(_0x4dc47d){try{agents[_0x6726('0x14')](_0x4dc47d);}catch(_0x5d3458){utils[_0x6726('0xf')](_0x5d3458);}});ami['on'](_0x6726('0x15'),function(_0xc1fed9){try{agents[_0x6726('0x15')](_0xc1fed9);recordings['agentconnect'](_0xc1fed9);queues[_0x6726('0x15')](_0xc1fed9);}catch(_0x46c5f5){utils['error'](_0x46c5f5);}});ami['on'](_0x6726('0x16'),function(_0x562f30){try{agents['agentcomplete'](_0x562f30);queues['agentcomplete'](_0x562f30);members[_0x6726('0x16')](_0x562f30);calls[_0x6726('0x16')](_0x562f30);}catch(_0x5860c5){utils[_0x6726('0xf')](_0x5860c5);}});ami['on'](_0x6726('0x17'),function(_0x27562c){try{agents[_0x6726('0x17')](_0x27562c);queues[_0x6726('0x17')](_0x27562c);}catch(_0x37f0ad){utils['error'](_0x37f0ad);}});ami['on'](_0x6726('0x18'),function(_0x559f07){try{queues[_0x6726('0x18')](_0x559f07);}catch(_0x1efc5b){utils[_0x6726('0xf')](_0x1efc5b);}});ami['on'](_0x6726('0x19'),function(_0xd10662){try{queues[_0x6726('0x19')](_0xd10662);}catch(_0x562058){utils[_0x6726('0xf')](_0x562058);}});ami['on'](_0x6726('0x1a'),function(_0xf9d466){try{queues[_0x6726('0x1a')](_0xf9d466);calls['musiconholdstart'](_0xf9d466);}catch(_0x21f043){utils['error'](_0x21f043);}});ami['on']('musiconholdstop',function(_0x3cce96){try{queues[_0x6726('0x1b')](_0x3cce96);calls[_0x6726('0x1b')](_0x3cce96);}catch(_0x3b0abf){utils['error'](_0x3b0abf);}});ami['on'](_0x6726('0x1c'),function(_0x2c8068){try{calls[_0x6726('0x1c')](_0x2c8068);agents['cdr'](_0x2c8068);queues[_0x6726('0x1c')](_0x2c8068);recordings['cdr'](_0x2c8068);dials['cdr'](_0x2c8068);members['cdr'](_0x2c8068);}catch(_0x23e557){utils[_0x6726('0xf')](_0x23e557);}});ami['on'](_0x6726('0x1d'),function(_0x35382d){try{queues['blindtransfer'](_0x35382d);agents[_0x6726('0x1d')](_0x35382d);transfers[_0x6726('0x1d')](_0x35382d);}catch(_0x2c648a){utils['error'](_0x2c648a);}});ami['on'](_0x6726('0x1e'),function(_0xcf8209){try{queues['attendedtransfer'](_0xcf8209);transfers[_0x6726('0x1e')](_0xcf8209);agents[_0x6726('0x1e')](_0xcf8209);}catch(_0x385bda){utils[_0x6726('0xf')](_0x385bda);}});ami['on'](_0x6726('0x1f'),function(_0x1b498a){try{queues[_0x6726('0x1f')](_0x1b498a);recordings[_0x6726('0x1f')](_0x1b498a);calls['varset'](_0x1b498a);dials[_0x6726('0x1f')](_0x1b498a);}catch(_0x12c705){utils[_0x6726('0xf')](_0x12c705);}});ami['on'](_0x6726('0x20'),function(_0x3af1e0){try{calls[_0x6726('0x20')](_0x3af1e0);dials[_0x6726('0x20')](_0x3af1e0);}catch(_0x39b516){utils['error'](_0x39b516);}});ami['on']('newchannel',function(_0x24e944){try{calls['newchannel'](_0x24e944);dials[_0x6726('0x21')](_0x24e944);}catch(_0x273e74){utils['error'](_0x273e74);}});ami['on'](_0x6726('0x22'),function(_0x41ec6b){try{dials[_0x6726('0x22')](_0x41ec6b);}catch(_0x4f7241){utils[_0x6726('0xf')](_0x4f7241);}});ami['on'](_0x6726('0x23'),function(_0x5c8c64){try{dials['dialend'](_0x5c8c64);}catch(_0x192012){utils[_0x6726('0xf')](_0x192012);}}); \ No newline at end of file +var _0xb28a=['devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','../../config/environment','./agents.controller','./queues.controller','./transfers.controller','./core.controller','./utils','asterisk','port','username','keepConnected','connect','shutdown','fullybooted','error','close','managerevent'];(function(_0x29a08d,_0x551eca){var _0x10fc1a=function(_0x4a2117){while(--_0x4a2117){_0x29a08d['push'](_0x29a08d['shift']());}};_0x10fc1a(++_0x551eca);}(_0xb28a,0x166));var _0xab28=function(_0x3d5904,_0x5e4596){_0x3d5904=_0x3d5904-0x0;var _0xfcc8d7=_0xb28a[_0x3d5904];return _0xfcc8d7;};var AsteriskManager=require('asterisk-manager');var config=require(_0xab28('0x0'));var agents=require(_0xab28('0x1'));var calls=require('./calls.controller');var queues=require(_0xab28('0x2'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0xab28('0x3'));var core=require(_0xab28('0x4'));var utils=require(_0xab28('0x5'));var ami=new AsteriskManager(config[_0xab28('0x6')][_0xab28('0x7')],config[_0xab28('0x6')]['ip'],config[_0xab28('0x6')][_0xab28('0x8')],config['asterisk']['password'],!![]);ami[_0xab28('0x9')]();ami['on'](_0xab28('0xa'),core[_0xab28('0xa')]);ami['on'](_0xab28('0xb'),core[_0xab28('0xb')]);ami['on'](_0xab28('0xc'),core['fullybooted']);ami['on'](_0xab28('0xd'),core['error']);ami['on'](_0xab28('0xe'),core[_0xab28('0xe')]);ami['on'](_0xab28('0xf'),core[_0xab28('0xf')]);ami['on'](_0xab28('0x10'),function(_0x3c53a2){try{members[_0xab28('0x10')](_0x3c53a2);}catch(_0x1976a5){utils['error'](_0x1976a5);}});ami['on'](_0xab28('0x11'),function(_0x1b0b7b){try{agents[_0xab28('0x11')](_0x1b0b7b);}catch(_0x389fc3){utils[_0xab28('0xd')](_0x389fc3);}});ami['on'](_0xab28('0x12'),function(_0x554954){try{agents['agentringnoanswer'](_0x554954);}catch(_0x7c1921){utils[_0xab28('0xd')](_0x7c1921);}});ami['on'](_0xab28('0x13'),function(_0xaaeb24){try{agents['agentconnect'](_0xaaeb24);recordings[_0xab28('0x13')](_0xaaeb24);queues['agentconnect'](_0xaaeb24);}catch(_0x2be1a4){utils['error'](_0x2be1a4);}});ami['on'](_0xab28('0x14'),function(_0x2b0b5c){try{agents[_0xab28('0x14')](_0x2b0b5c);queues[_0xab28('0x14')](_0x2b0b5c);members[_0xab28('0x14')](_0x2b0b5c);calls[_0xab28('0x14')](_0x2b0b5c);}catch(_0x397097){utils[_0xab28('0xd')](_0x397097);}});ami['on']('queuecallerabandon',function(_0x35fa87){try{agents[_0xab28('0x15')](_0x35fa87);queues[_0xab28('0x15')](_0x35fa87);}catch(_0x170a80){utils[_0xab28('0xd')](_0x170a80);}});ami['on'](_0xab28('0x16'),function(_0x1b0fc6){try{queues['queuecallerjoin'](_0x1b0fc6);}catch(_0x116c2c){utils['error'](_0x116c2c);}});ami['on'](_0xab28('0x17'),function(_0x127e2b){try{queues['queuecallerleave'](_0x127e2b);}catch(_0x19d70b){utils[_0xab28('0xd')](_0x19d70b);}});ami['on'](_0xab28('0x18'),function(_0x46a24b){try{queues[_0xab28('0x18')](_0x46a24b);calls[_0xab28('0x18')](_0x46a24b);}catch(_0x3332eb){utils['error'](_0x3332eb);}});ami['on'](_0xab28('0x19'),function(_0x50ae27){try{queues[_0xab28('0x19')](_0x50ae27);calls[_0xab28('0x19')](_0x50ae27);}catch(_0x5069d0){utils[_0xab28('0xd')](_0x5069d0);}});ami['on']('cdr',function(_0x2fd3aa){try{calls[_0xab28('0x1a')](_0x2fd3aa);agents[_0xab28('0x1a')](_0x2fd3aa);queues['cdr'](_0x2fd3aa);recordings[_0xab28('0x1a')](_0x2fd3aa);dials[_0xab28('0x1a')](_0x2fd3aa);members['cdr'](_0x2fd3aa);}catch(_0x6a494e){utils[_0xab28('0xd')](_0x6a494e);}});ami['on'](_0xab28('0x1b'),function(_0x1fe502){try{queues['blindtransfer'](_0x1fe502);agents[_0xab28('0x1b')](_0x1fe502);transfers[_0xab28('0x1b')](_0x1fe502);}catch(_0x33e5ce){utils[_0xab28('0xd')](_0x33e5ce);}});ami['on'](_0xab28('0x1c'),function(_0x4114fd){try{queues[_0xab28('0x1c')](_0x4114fd);transfers[_0xab28('0x1c')](_0x4114fd);agents[_0xab28('0x1c')](_0x4114fd);}catch(_0x383e05){utils['error'](_0x383e05);}});ami['on']('varset',function(_0x41126b){try{queues['varset'](_0x41126b);recordings['varset'](_0x41126b);calls[_0xab28('0x1d')](_0x41126b);dials[_0xab28('0x1d')](_0x41126b);}catch(_0xcf5d05){utils[_0xab28('0xd')](_0xcf5d05);}});ami['on'](_0xab28('0x1e'),function(_0x1911fa){try{calls['newexten'](_0x1911fa);dials[_0xab28('0x1e')](_0x1911fa);}catch(_0x1f3199){utils[_0xab28('0xd')](_0x1f3199);}});ami['on']('newchannel',function(_0x9ab55){try{calls['newchannel'](_0x9ab55);dials[_0xab28('0x1f')](_0x9ab55);}catch(_0x267aaa){utils['error'](_0x267aaa);}});ami['on'](_0xab28('0x20'),function(_0x12b5df){try{dials[_0xab28('0x20')](_0x12b5df);}catch(_0xb5e561){utils[_0xab28('0xd')](_0xb5e561);}});ami['on'](_0xab28('0x21'),function(_0x4f5e45){try{dials[_0xab28('0x21')](_0x4f5e45);}catch(_0x471a30){utils['error'](_0x471a30);}}); \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index fa63f8c..2d539d3 100644 --- a/server/services/xdr/members.controller.js +++ b/server/services/xdr/members.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9be4=['CreateMemberReport','error','startsWith','state','INUSE','BUSY','device','voice','TALKING','now','agent','exitAt','diffTime','enterAt','agentcomplete','isNil','assign','queue','cdr','data1','source','data3','destination','destinationchannel','lodash','util','Local/_attended@transfer','info','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','getUserByName','split','request'];(function(_0x2d51bd,_0x115935){var _0x18ab72=function(_0x1dde3f){while(--_0x1dde3f){_0x2d51bd['push'](_0x2d51bd['shift']());}};_0x18ab72(++_0x115935);}(_0x9be4,0x6e));var _0x49be=function(_0x200af6,_0x3b2bd5){_0x200af6=_0x200af6-0x0;var _0x1d70ed=_0x9be4[_0x200af6];return _0x1d70ed;};'use strict';var _=require(_0x49be('0x0'));var util=require(_0x49be('0x1'));var utils=require('./utils');var members={};var exclude=[_0x49be('0x2'),'Queue:'];function writeDB(_0x3e15eb){utils[_0x49be('0x3')](util[_0x49be('0x4')](_0x49be('0x5'),_0x3e15eb[_0x49be('0x6')],_0x3e15eb[_0x49be('0x7')],_0x3e15eb[_0x49be('0x8')],_0x3e15eb[_0x49be('0x9')],_0x3e15eb[_0x49be('0xa')],_0x3e15eb[_0x49be('0xb')]));if(_0x3e15eb[_0x49be('0x7')]){utils[_0x49be('0xc')](_0x3e15eb[_0x49be('0x7')])[_0x49be('0xd')](function(_0x39f35b){if(_0x39f35b){_0x3e15eb[_0x49be('0xa')]=_0x39f35b[_0x49be('0xe')];_0x3e15eb['internal']=_0x39f35b[_0x49be('0xf')];utils['request']('CreateMemberReport',_0x3e15eb);}else{utils[_0x49be('0x10')](_0x3e15eb[_0x49be('0x7')][_0x49be('0x11')]('/')[0x1])[_0x49be('0xd')](function(_0x35ee33){if(_0x35ee33){_0x3e15eb[_0x49be('0xa')]=_0x35ee33['name'];_0x3e15eb[_0x49be('0xf')]=_0x35ee33[_0x49be('0xf')];utils[_0x49be('0x12')](_0x49be('0x13'),_0x3e15eb);}});}})['catch'](function(_0x161d75){utils[_0x49be('0x14')](_0x161d75);});}delete members[_0x3e15eb[_0x49be('0x7')]];}function startsWith(_0x241090,_0x5d8d6b){return _['some'](_0x241090,function(_0x19832c){return _[_0x49be('0x15')](_0x5d8d6b,_0x19832c);});}exports['devicestatechange']=function(_0x22b11f){switch(_0x22b11f[_0x49be('0x16')]){case _0x49be('0x17'):case _0x49be('0x18'):if(!startsWith(exclude,_0x22b11f[_0x49be('0x19')])){members[_0x22b11f[_0x49be('0x19')]]={'channel':_0x49be('0x1a'),'interface':_0x22b11f[_0x49be('0x19')],'type':_0x49be('0x1b'),'enterAt':utils[_0x49be('0x1c')](),'role':_0x49be('0x1d')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x22b11f[_0x49be('0x19')]])){members[_0x22b11f[_0x49be('0x19')]][_0x49be('0x1e')]=utils[_0x49be('0x1c')]();members[_0x22b11f[_0x49be('0x19')]]['duration']=utils[_0x49be('0x1f')](members[_0x22b11f[_0x49be('0x19')]][_0x49be('0x1e')],members[_0x22b11f[_0x49be('0x19')]][_0x49be('0x20')]);if(members[_0x22b11f['device']][_0x49be('0x6')]){writeDB(members[_0x22b11f[_0x49be('0x19')]]);}}default:break;}};exports[_0x49be('0x21')]=function(_0x5129f2){if(!_[_0x49be('0x22')](members[_0x5129f2[_0x49be('0x7')]])){members[_0x5129f2[_0x49be('0x7')]]=_[_0x49be('0x23')](members[_0x5129f2['interface']],{'data4':_0x5129f2[_0x49be('0x24')],'uniqueid':_0x5129f2[_0x49be('0x6')]});}};exports[_0x49be('0x25')]=function(_0x3c4719){if(_0x3c4719[_0x49be('0x8')]){var _0x3f8782=_0x3c4719['channel'][_0x49be('0x11')]('-')[0x0];if(!_[_0x49be('0x22')](members[_0x3f8782])){members[_0x3f8782]=_[_0x49be('0x23')](members[_0x3f8782],{'data1':members[_0x3f8782][_0x49be('0x26')]||_0x3c4719[_0x49be('0xb')],'data2':members[_0x3f8782][_0x49be('0x9')]||_0x3c4719[_0x49be('0x27')],'data3':members[_0x3f8782][_0x49be('0x28')]||_0x3c4719[_0x49be('0x29')],'uniqueid':members[_0x3f8782][_0x49be('0x6')]||_0x3c4719['uniqueid']});if(members[_0x3f8782][_0x49be('0x1e')]){writeDB(members[_0x3f8782]);}}}if(_0x3c4719[_0x49be('0x2a')]){var _0x427c9a=_0x3c4719['destinationchannel'][_0x49be('0x11')]('-')[0x0];if(!_[_0x49be('0x22')](members[_0x427c9a])){members[_0x427c9a]=_[_0x49be('0x23')](members[_0x427c9a],{'data1':members[_0x427c9a][_0x49be('0x26')]||_0x3c4719[_0x49be('0xb')],'data2':members[_0x427c9a][_0x49be('0x9')]||_0x3c4719[_0x49be('0x27')],'data3':members[_0x427c9a][_0x49be('0x28')]||_0x3c4719[_0x49be('0x29')],'uniqueid':members[_0x427c9a]['uniqueid']||_0x3c4719[_0x49be('0x6')]});if(members[_0x427c9a][_0x49be('0x1e')]){writeDB(members[_0x427c9a]);}}}}; \ No newline at end of file +var _0xe1dc=['split','type','data2','source','data3','destination','destinationchannel','data1','lodash','Local/_attended@transfer','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','channel','membername','interface','getUserByInterface','then','name','internal','CreateMemberReport','getUserByName','request','startsWith','devicestatechange','state','BUSY','device','voice','TALKING','now','NOT_INUSE','exitAt','duration','enterAt','agentcomplete','isNil','assign','cdr'];(function(_0x3802f3,_0x4364e7){var _0x212c72=function(_0x1190bf){while(--_0x1190bf){_0x3802f3['push'](_0x3802f3['shift']());}};_0x212c72(++_0x4364e7);}(_0xe1dc,0xd5));var _0xce1d=function(_0x51fc37,_0xdc2c74){_0x51fc37=_0x51fc37-0x0;var _0x3ea2b6=_0xe1dc[_0x51fc37];return _0x3ea2b6;};'use strict';var _=require(_0xce1d('0x0'));var util=require('util');var utils=require('./utils');var members={};var exclude=[_0xce1d('0x1'),_0xce1d('0x2')];function writeDB(_0x5bfca0){utils[_0xce1d('0x3')](util[_0xce1d('0x4')](_0xce1d('0x5'),_0x5bfca0[_0xce1d('0x6')],_0x5bfca0['interface'],_0x5bfca0[_0xce1d('0x7')],_0x5bfca0['data2'],_0x5bfca0[_0xce1d('0x8')],_0x5bfca0['type']));if(_0x5bfca0[_0xce1d('0x9')]){utils[_0xce1d('0xa')](_0x5bfca0['interface'])[_0xce1d('0xb')](function(_0x31146a){if(_0x31146a){_0x5bfca0[_0xce1d('0x8')]=_0x31146a[_0xce1d('0xc')];_0x5bfca0[_0xce1d('0xd')]=_0x31146a[_0xce1d('0xd')];utils['request'](_0xce1d('0xe'),_0x5bfca0);}else{utils[_0xce1d('0xf')](_0x5bfca0[_0xce1d('0x9')]['split']('/')[0x1])[_0xce1d('0xb')](function(_0xfa0256){if(_0xfa0256){_0x5bfca0[_0xce1d('0x8')]=_0xfa0256[_0xce1d('0xc')];_0x5bfca0[_0xce1d('0xd')]=_0xfa0256[_0xce1d('0xd')];utils[_0xce1d('0x10')]('CreateMemberReport',_0x5bfca0);}});}})['catch'](function(_0x3871e2){utils['error'](_0x3871e2);});}delete members[_0x5bfca0[_0xce1d('0x9')]];}function startsWith(_0x1a4b87,_0x27325f){return _['some'](_0x1a4b87,function(_0x2f1622){return _[_0xce1d('0x11')](_0x27325f,_0x2f1622);});}exports[_0xce1d('0x12')]=function(_0xd7fcf7){switch(_0xd7fcf7[_0xce1d('0x13')]){case'INUSE':case _0xce1d('0x14'):if(!startsWith(exclude,_0xd7fcf7[_0xce1d('0x15')])){members[_0xd7fcf7['device']]={'channel':_0xce1d('0x16'),'interface':_0xd7fcf7['device'],'type':_0xce1d('0x17'),'enterAt':utils[_0xce1d('0x18')](),'role':'agent'};}break;case _0xce1d('0x19'):if(!_['isNil'](members[_0xd7fcf7[_0xce1d('0x15')]])){members[_0xd7fcf7[_0xce1d('0x15')]][_0xce1d('0x1a')]=utils[_0xce1d('0x18')]();members[_0xd7fcf7[_0xce1d('0x15')]][_0xce1d('0x1b')]=utils['diffTime'](members[_0xd7fcf7[_0xce1d('0x15')]][_0xce1d('0x1a')],members[_0xd7fcf7[_0xce1d('0x15')]][_0xce1d('0x1c')]);if(members[_0xd7fcf7['device']][_0xce1d('0x6')]){writeDB(members[_0xd7fcf7[_0xce1d('0x15')]]);}}default:break;}};exports[_0xce1d('0x1d')]=function(_0x148e22){if(!_[_0xce1d('0x1e')](members[_0x148e22[_0xce1d('0x9')]])){members[_0x148e22[_0xce1d('0x9')]]=_[_0xce1d('0x1f')](members[_0x148e22[_0xce1d('0x9')]],{'data4':_0x148e22['queue'],'uniqueid':_0x148e22[_0xce1d('0x6')]});}};exports[_0xce1d('0x20')]=function(_0x497deb){if(_0x497deb['channel']){var _0x5b1534=_0x497deb[_0xce1d('0x7')][_0xce1d('0x21')]('-')[0x0];if(!_[_0xce1d('0x1e')](members[_0x5b1534])){members[_0x5b1534]=_['assign'](members[_0x5b1534],{'data1':members[_0x5b1534]['data1']||_0x497deb[_0xce1d('0x22')],'data2':members[_0x5b1534][_0xce1d('0x23')]||_0x497deb[_0xce1d('0x24')],'data3':members[_0x5b1534][_0xce1d('0x25')]||_0x497deb[_0xce1d('0x26')],'uniqueid':members[_0x5b1534][_0xce1d('0x6')]||_0x497deb[_0xce1d('0x6')]});if(members[_0x5b1534][_0xce1d('0x1a')]){writeDB(members[_0x5b1534]);}}}if(_0x497deb[_0xce1d('0x27')]){var _0x550cb5=_0x497deb[_0xce1d('0x27')][_0xce1d('0x21')]('-')[0x0];if(!_[_0xce1d('0x1e')](members[_0x550cb5])){members[_0x550cb5]=_['assign'](members[_0x550cb5],{'data1':members[_0x550cb5][_0xce1d('0x28')]||_0x497deb[_0xce1d('0x22')],'data2':members[_0x550cb5]['data2']||_0x497deb[_0xce1d('0x24')],'data3':members[_0x550cb5][_0xce1d('0x25')]||_0x497deb[_0xce1d('0x26')],'uniqueid':members[_0x550cb5][_0xce1d('0x6')]||_0x497deb[_0xce1d('0x6')]});if(members[_0x550cb5][_0xce1d('0x1a')]){writeDB(members[_0x550cb5]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index ff56892..0de878d 100644 --- a/server/services/xdr/queues.controller.js +++ b/server/services/xdr/queues.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa299=['transfereechannel','BLIND','extension','transfereeuniqueid','BLINDTRANSFER','attendedtransfer','forIn','transfertargetchannel','transfertargetcalleridname','transfertargetcalleridnum','ATTENDED','ATTENDEDTRANSFER','origtransfererexten','origtransfereruniqueid','origtransfererchannel','secondtransfererchannel','transfereecalleridname','secondtransfererexten','secondtransfereruniqueid','musiconholdstart','musiconholdstartAt','musiconholdstop','cdr','assigned','COMPLETED','lodash','util','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','accountcode','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','queuecallerjoin','isNil','clone','assign','varset','variable','queuestatus','value','CONTINUE','now','toUpperCase','queuecallerleave','diffTime','queuecallerjoinAt','connectedlinenum','membername','reason','transfer','COMPLETEDBY','blindtransfer'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xa299,0x1f1));var _0x9a29=function(_0x8e6f3e,_0x2076c5){_0x8e6f3e=_0x8e6f3e-0x0;var _0x352ec4=_0xa299[_0x8e6f3e];return _0x352ec4;};'use strict';var _=require(_0x9a29('0x0'));var util=require(_0x9a29('0x1'));var utils=require('./utils');var queues={};var transfers={};function writeDB(_0x1c1608,_0x4f7638){utils[_0x9a29('0x2')](util[_0x9a29('0x3')](_0x9a29('0x4'),_0x1c1608[_0x9a29('0x5')],_0x1c1608[_0x9a29('0x6')],_0x1c1608[_0x9a29('0x7')],_0x1c1608['lastAssignedTo'],_0x1c1608['calleridnum'],_0x1c1608[_0x9a29('0x8')],_0x1c1608[_0x9a29('0x9')]));if(_0x1c1608[_0x9a29('0x7')]){utils[_0x9a29('0xa')](_0x1c1608[_0x9a29('0x7')])['then'](function(_0x3056cb){if(_0x3056cb){_0x1c1608[_0x9a29('0xb')]=_0x3056cb[_0x9a29('0xb')];}utils[_0x9a29('0xc')](_0x9a29('0xd'),_0x1c1608);});}else{utils[_0x9a29('0xc')](_0x9a29('0xd'),_0x1c1608);}if(_0x4f7638){delete queues[_0x1c1608[_0x9a29('0x6')]];}}exports[_0x9a29('0xe')]=function(_0x570fed){if(!_[_0x9a29('0xf')](queues[_0x570fed[_0x9a29('0x6')]])){writeDB(_[_0x9a29('0x10')](queues[_0x570fed[_0x9a29('0x6')]]),![]);}queues[_0x570fed[_0x9a29('0x6')]]=_[_0x9a29('0x11')](_0x570fed,{'originalposition':_0x570fed['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});};exports[_0x9a29('0x12')]=function(_0x1a41de){if(!_[_0x9a29('0xf')](queues[_0x1a41de[_0x9a29('0x6')]])){if(!_[_0x9a29('0xf')](_0x1a41de[_0x9a29('0x13')][_0x9a29('0x14')])){if(_0x1a41de[_0x9a29('0x15')]!=_0x9a29('0x16')){queues[_0x1a41de[_0x9a29('0x6')]]=_[_0x9a29('0x11')](queues[_0x1a41de[_0x9a29('0x6')]],{'queuecallerabandon':![],'queuecallerabandonAt':null,'queuecallerexit':!![],'queuecallerexitAt':utils[_0x9a29('0x17')](),'queuecallerexitreason':_0x1a41de[_0x9a29('0x15')][_0x9a29('0x18')]()});}}}};exports['queuecallerabandon']=function(_0x353a23){var _0x5d9b86={'queuecallerabandon':!![],'queuecallerabandonAt':utils[_0x9a29('0x17')](),'queuecallerexitreason':'ABANDONED'};if(!_[_0x9a29('0xf')](queues[_0x353a23[_0x9a29('0x6')]])){queues[_0x353a23[_0x9a29('0x6')]]=_[_0x9a29('0x11')](queues[_0x353a23[_0x9a29('0x6')]],_0x5d9b86);}if(!_['isNil'](transfers[_0x353a23[_0x9a29('0x6')]])){transfers[_0x353a23['channel']]=_['assign'](transfers[_0x353a23['channel']],_0x5d9b86);}};exports[_0x9a29('0x19')]=function(_0x3e2108){if(!_['isNil'](queues[_0x3e2108[_0x9a29('0x6')]])){queues[_0x3e2108[_0x9a29('0x6')]]=_[_0x9a29('0x11')](queues[_0x3e2108[_0x9a29('0x6')]],{'queuecallerleave':!![],'queuecallerleaveAt':utils[_0x9a29('0x17')](),'holdtime':utils[_0x9a29('0x1a')](utils['now'](),queues[_0x3e2108[_0x9a29('0x6')]]['queuecallerjoinAt'])});}if(!_[_0x9a29('0xf')](transfers[_0x3e2108[_0x9a29('0x6')]])){transfers[_0x3e2108[_0x9a29('0x6')]]=_[_0x9a29('0x11')](transfers[_0x3e2108[_0x9a29('0x6')]],{'queuecallerleave':!![],'queuecallerleaveAt':utils['now'](),'holdtime':utils['diffTime'](utils[_0x9a29('0x17')](),transfers[_0x3e2108[_0x9a29('0x6')]][_0x9a29('0x1b')])});}};exports['agentconnect']=function(_0x32de96){var _0x5772c9={'connectedlinenum':_0x32de96[_0x9a29('0x1c')],'connectedlinename':_0x32de96['connectedlinename'],'assigned':!![],'lastAssignedTo':_0x32de96[_0x9a29('0x1d')]};if(!_[_0x9a29('0xf')](queues[_0x32de96['channel']])){queues[_0x32de96[_0x9a29('0x6')]]=_[_0x9a29('0x11')](queues[_0x32de96['channel']],_0x5772c9);}if(!_[_0x9a29('0xf')](transfers[_0x32de96[_0x9a29('0x6')]])){transfers[_0x32de96[_0x9a29('0x6')]]=_[_0x9a29('0x11')](transfers[_0x32de96['channel']],_0x5772c9);}};exports['agentcomplete']=function(_0x145d88){var _0x4ee7d8={'queuecallercomplete':!![],'queuecallercompleteAt':utils[_0x9a29('0x17')]()};if(_0x145d88[_0x9a29('0x1e')]!=_0x9a29('0x1f')){_0x4ee7d8[_0x9a29('0x9')]=_0x9a29('0x20')+_0x145d88[_0x9a29('0x1e')][_0x9a29('0x18')]();}if(!_[_0x9a29('0xf')](queues[_0x145d88[_0x9a29('0x6')]])){queues[_0x145d88[_0x9a29('0x6')]]=_[_0x9a29('0x11')](queues[_0x145d88[_0x9a29('0x6')]],_0x4ee7d8);writeDB(queues[_0x145d88[_0x9a29('0x6')]],!![]);}};exports[_0x9a29('0x21')]=function(_0x3b93c6){if(!_[_0x9a29('0xf')](queues[_0x3b93c6['transfereechannel']])){queues[_0x3b93c6['transfereechannel']]=_[_0x9a29('0x11')](queues[_0x3b93c6[_0x9a29('0x22')]],{'transfer':!![],'transfertype':_0x9a29('0x23'),'transferexten':_0x3b93c6[_0x9a29('0x24')],'transferuniqueid':_0x3b93c6[_0x9a29('0x25')],'queuecallerexitreason':_0x9a29('0x26')});}};exports[_0x9a29('0x27')]=function(_0x5a18b3){_[_0x9a29('0x28')](queues,function(_0x2d5806){if(_0x2d5806[_0x9a29('0x6')]==_0x5a18b3['origtransfererchannel']){transfers[_0x5a18b3[_0x9a29('0x29')]]=_[_0x9a29('0x10')](_0x2d5806);transfers[_0x5a18b3[_0x9a29('0x29')]]=_[_0x9a29('0x11')](transfers[_0x5a18b3[_0x9a29('0x29')]],{'queuecallerjoinAt':utils['now'](),'queuecallerleaveAt':utils[_0x9a29('0x17')](),'channel':_0x5a18b3['transfertargetchannel'],'calleridname':_0x5a18b3[_0x9a29('0x2a')],'calleridnum':_0x5a18b3[_0x9a29('0x2b')],'queuecallerenterreason':0x2});queues[_0x5a18b3['transfertargetchannel']]=_[_0x9a29('0x11')](queues[_0x5a18b3[_0x9a29('0x29')]],{'transfer':!![],'transfertype':_0x9a29('0x2c'),'queuecallerexitreason':_0x9a29('0x2d'),'transferexten':_0x5a18b3[_0x9a29('0x2e')],'transferuniqueid':_0x5a18b3[_0x9a29('0x2f')]});queues[_0x5a18b3[_0x9a29('0x30')]]=_[_0x9a29('0x11')](queues[_0x5a18b3['origtransfererchannel']],{'queuecallerexitreason':_0x9a29('0x2c'),'queuecallerenterreason':0x1});}else if(_0x2d5806[_0x9a29('0x6')]==_0x5a18b3[_0x9a29('0x31')]){transfers[_0x5a18b3['transfereechannel']]=_[_0x9a29('0x10')](_0x2d5806);transfers[_0x5a18b3['transfereechannel']]=_[_0x9a29('0x11')](transfers[_0x5a18b3[_0x9a29('0x22')]],{'queuecallerjoinAt':utils[_0x9a29('0x17')](),'queuecallerleaveAt':utils[_0x9a29('0x17')](),'channel':_0x5a18b3[_0x9a29('0x22')],'calleridname':_0x5a18b3[_0x9a29('0x32')],'calleridnum':_0x5a18b3['transfereecalleridnum'],'queuecallerenterreason':0x2});queues[_0x5a18b3[_0x9a29('0x22')]]=_['assign'](queues[_0x5a18b3['transfereechannel']],{'transfer':!![],'transfertype':_0x9a29('0x2c'),'queuecallerexitreason':_0x9a29('0x2d'),'transferexten':_0x5a18b3[_0x9a29('0x33')],'transferuniqueid':_0x5a18b3[_0x9a29('0x34')]});queues[_0x5a18b3['secondtransfererchannel']]=_[_0x9a29('0x11')](queues[_0x5a18b3[_0x9a29('0x31')]],{'queuecallerexitreason':_0x9a29('0x2c'),'queuecallerenterreason':0x1});}});};exports[_0x9a29('0x35')]=function(_0x4e200a){if(!_['isNil'](queues[_0x4e200a['channel']])){queues[_0x4e200a['channel']][_0x9a29('0x36')]=utils['now']();}};exports[_0x9a29('0x37')]=function(_0x1407b1){if(!_[_0x9a29('0xf')](queues[_0x1407b1['channel']])){if(!_['isNil'](queues[_0x1407b1['channel']]['musiconholdstartAt'])){queues[_0x1407b1['channel']]['mohtime']+=utils['diffTime'](utils['now'](),queues[_0x1407b1[_0x9a29('0x6')]][_0x9a29('0x36')]);delete queues[_0x1407b1[_0x9a29('0x6')]][_0x9a29('0x36')];}}};exports[_0x9a29('0x38')]=function(_0x41327a){if(!_[_0x9a29('0xf')](queues[_0x41327a[_0x9a29('0x6')]])){writeDB(queues[_0x41327a['channel']],!![]);}if(!_['isNil'](transfers[_0x41327a[_0x9a29('0x6')]])){if(transfers[_0x41327a['channel']][_0x9a29('0x39')]){transfers[_0x41327a[_0x9a29('0x6')]]=_[_0x9a29('0x11')](transfers[_0x41327a[_0x9a29('0x6')]],{'queuecallercomplete':!![],'queuecallercompleteAt':utils[_0x9a29('0x17')](),'queuecallerexitreason':_0x9a29('0x3a')});}writeDB(transfers[_0x41327a['channel']],![]);delete transfers[_0x41327a[_0x9a29('0x6')]];}}; \ No newline at end of file +var _0x29e5=['secondtransfererexten','secondtransfereruniqueid','musiconholdstartAt','musiconholdstop','mohtime','cdr','COMPLETED','util','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','channel','lastAssignedTo','calleridnum','queuecallerexitreason','queue','getVoiceQueueByName','then','type','queuecallerjoin','assign','position','now','isNil','variable','queuestatus','value','queuecallerabandon','ABANDONED','queuecallerleave','diffTime','agentconnect','connectedlinenum','connectedlinename','agentcomplete','transfer','COMPLETEDBY','reason','blindtransfer','transfereechannel','extension','transfereeuniqueid','BLINDTRANSFER','attendedtransfer','origtransfererchannel','clone','transfertargetchannel','transfertargetcalleridname','ATTENDED','ATTENDEDTRANSFER','origtransfererexten','origtransfereruniqueid','secondtransfererchannel','transfereecalleridnum'];(function(_0x40cc69,_0x5935e3){var _0x5a8780=function(_0x16c099){while(--_0x16c099){_0x40cc69['push'](_0x40cc69['shift']());}};_0x5a8780(++_0x5935e3);}(_0x29e5,0x188));var _0x529e=function(_0x28d583,_0x3bc9f2){_0x28d583=_0x28d583-0x0;var _0x1f28c9=_0x29e5[_0x28d583];return _0x1f28c9;};'use strict';var _=require('lodash');var util=require(_0x529e('0x0'));var utils=require(_0x529e('0x1'));var queues={};var transfers={};function writeDB(_0x5b7ee3,_0x570dc3){utils[_0x529e('0x2')](util[_0x529e('0x3')](_0x529e('0x4'),_0x5b7ee3['uniqueid'],_0x5b7ee3[_0x529e('0x5')],_0x5b7ee3['queue'],_0x5b7ee3[_0x529e('0x6')],_0x5b7ee3[_0x529e('0x7')],_0x5b7ee3['accountcode'],_0x5b7ee3[_0x529e('0x8')]));if(_0x5b7ee3[_0x529e('0x9')]){utils[_0x529e('0xa')](_0x5b7ee3['queue'])[_0x529e('0xb')](function(_0x11ae3a){if(_0x11ae3a){_0x5b7ee3[_0x529e('0xc')]=_0x11ae3a[_0x529e('0xc')];}utils['request']('CreateVoiceQueueReport',_0x5b7ee3);});}else{utils['request']('CreateVoiceQueueReport',_0x5b7ee3);}if(_0x570dc3){delete queues[_0x5b7ee3['channel']];}}exports[_0x529e('0xd')]=function(_0x5141e3){if(!_['isNil'](queues[_0x5141e3['channel']])){writeDB(_['clone'](queues[_0x5141e3[_0x529e('0x5')]]),![]);}queues[_0x5141e3['channel']]=_[_0x529e('0xe')](_0x5141e3,{'originalposition':_0x5141e3[_0x529e('0xf')],'queuecallerjoinAt':utils[_0x529e('0x10')](),'mohtime':0x0});};exports['varset']=function(_0x16bde7){if(!_[_0x529e('0x11')](queues[_0x16bde7[_0x529e('0x5')]])){if(!_[_0x529e('0x11')](_0x16bde7[_0x529e('0x12')][_0x529e('0x13')])){if(_0x16bde7[_0x529e('0x14')]!='CONTINUE'){queues[_0x16bde7[_0x529e('0x5')]]=_['assign'](queues[_0x16bde7[_0x529e('0x5')]],{'queuecallerabandon':![],'queuecallerabandonAt':null,'queuecallerexit':!![],'queuecallerexitAt':utils[_0x529e('0x10')](),'queuecallerexitreason':_0x16bde7[_0x529e('0x14')]['toUpperCase']()});}}}};exports[_0x529e('0x15')]=function(_0x19e28c){var _0x5db5ef={'queuecallerabandon':!![],'queuecallerabandonAt':utils['now'](),'queuecallerexitreason':_0x529e('0x16')};if(!_[_0x529e('0x11')](queues[_0x19e28c[_0x529e('0x5')]])){queues[_0x19e28c[_0x529e('0x5')]]=_[_0x529e('0xe')](queues[_0x19e28c[_0x529e('0x5')]],_0x5db5ef);}if(!_[_0x529e('0x11')](transfers[_0x19e28c[_0x529e('0x5')]])){transfers[_0x19e28c[_0x529e('0x5')]]=_['assign'](transfers[_0x19e28c[_0x529e('0x5')]],_0x5db5ef);}};exports[_0x529e('0x17')]=function(_0xef35b7){if(!_[_0x529e('0x11')](queues[_0xef35b7['channel']])){queues[_0xef35b7[_0x529e('0x5')]]=_[_0x529e('0xe')](queues[_0xef35b7[_0x529e('0x5')]],{'queuecallerleave':!![],'queuecallerleaveAt':utils[_0x529e('0x10')](),'holdtime':utils[_0x529e('0x18')](utils[_0x529e('0x10')](),queues[_0xef35b7[_0x529e('0x5')]]['queuecallerjoinAt'])});}if(!_[_0x529e('0x11')](transfers[_0xef35b7[_0x529e('0x5')]])){transfers[_0xef35b7['channel']]=_[_0x529e('0xe')](transfers[_0xef35b7[_0x529e('0x5')]],{'queuecallerleave':!![],'queuecallerleaveAt':utils[_0x529e('0x10')](),'holdtime':utils[_0x529e('0x18')](utils[_0x529e('0x10')](),transfers[_0xef35b7[_0x529e('0x5')]]['queuecallerjoinAt'])});}};exports[_0x529e('0x19')]=function(_0x58797a){var _0x4bbe03={'connectedlinenum':_0x58797a[_0x529e('0x1a')],'connectedlinename':_0x58797a[_0x529e('0x1b')],'assigned':!![],'lastAssignedTo':_0x58797a['membername']};if(!_[_0x529e('0x11')](queues[_0x58797a[_0x529e('0x5')]])){queues[_0x58797a['channel']]=_['assign'](queues[_0x58797a[_0x529e('0x5')]],_0x4bbe03);}if(!_[_0x529e('0x11')](transfers[_0x58797a[_0x529e('0x5')]])){transfers[_0x58797a[_0x529e('0x5')]]=_['assign'](transfers[_0x58797a['channel']],_0x4bbe03);}};exports[_0x529e('0x1c')]=function(_0x5c7110){var _0x225248={'queuecallercomplete':!![],'queuecallercompleteAt':utils['now']()};if(_0x5c7110['reason']!=_0x529e('0x1d')){_0x225248[_0x529e('0x8')]=_0x529e('0x1e')+_0x5c7110[_0x529e('0x1f')]['toUpperCase']();}if(!_[_0x529e('0x11')](queues[_0x5c7110['channel']])){queues[_0x5c7110[_0x529e('0x5')]]=_[_0x529e('0xe')](queues[_0x5c7110[_0x529e('0x5')]],_0x225248);writeDB(queues[_0x5c7110[_0x529e('0x5')]],!![]);}};exports[_0x529e('0x20')]=function(_0xa558a2){if(!_[_0x529e('0x11')](queues[_0xa558a2[_0x529e('0x21')]])){queues[_0xa558a2[_0x529e('0x21')]]=_[_0x529e('0xe')](queues[_0xa558a2[_0x529e('0x21')]],{'transfer':!![],'transfertype':'BLIND','transferexten':_0xa558a2[_0x529e('0x22')],'transferuniqueid':_0xa558a2[_0x529e('0x23')],'queuecallerexitreason':_0x529e('0x24')});}};exports[_0x529e('0x25')]=function(_0x4bcec9){_['forIn'](queues,function(_0x42779e){if(_0x42779e[_0x529e('0x5')]==_0x4bcec9[_0x529e('0x26')]){transfers[_0x4bcec9['transfertargetchannel']]=_[_0x529e('0x27')](_0x42779e);transfers[_0x4bcec9['transfertargetchannel']]=_[_0x529e('0xe')](transfers[_0x4bcec9[_0x529e('0x28')]],{'queuecallerjoinAt':utils[_0x529e('0x10')](),'queuecallerleaveAt':utils[_0x529e('0x10')](),'channel':_0x4bcec9['transfertargetchannel'],'calleridname':_0x4bcec9[_0x529e('0x29')],'calleridnum':_0x4bcec9['transfertargetcalleridnum'],'queuecallerenterreason':0x2});queues[_0x4bcec9[_0x529e('0x28')]]=_['assign'](queues[_0x4bcec9[_0x529e('0x28')]],{'transfer':!![],'transfertype':_0x529e('0x2a'),'queuecallerexitreason':_0x529e('0x2b'),'transferexten':_0x4bcec9[_0x529e('0x2c')],'transferuniqueid':_0x4bcec9[_0x529e('0x2d')]});queues[_0x4bcec9[_0x529e('0x26')]]=_[_0x529e('0xe')](queues[_0x4bcec9[_0x529e('0x26')]],{'queuecallerexitreason':_0x529e('0x2a'),'queuecallerenterreason':0x1});}else if(_0x42779e[_0x529e('0x5')]==_0x4bcec9[_0x529e('0x2e')]){transfers[_0x4bcec9['transfereechannel']]=_['clone'](_0x42779e);transfers[_0x4bcec9['transfereechannel']]=_['assign'](transfers[_0x4bcec9['transfereechannel']],{'queuecallerjoinAt':utils[_0x529e('0x10')](),'queuecallerleaveAt':utils[_0x529e('0x10')](),'channel':_0x4bcec9[_0x529e('0x21')],'calleridname':_0x4bcec9['transfereecalleridname'],'calleridnum':_0x4bcec9[_0x529e('0x2f')],'queuecallerenterreason':0x2});queues[_0x4bcec9[_0x529e('0x21')]]=_[_0x529e('0xe')](queues[_0x4bcec9[_0x529e('0x21')]],{'transfer':!![],'transfertype':'ATTENDED','queuecallerexitreason':_0x529e('0x2b'),'transferexten':_0x4bcec9[_0x529e('0x30')],'transferuniqueid':_0x4bcec9[_0x529e('0x31')]});queues[_0x4bcec9['secondtransfererchannel']]=_['assign'](queues[_0x4bcec9[_0x529e('0x2e')]],{'queuecallerexitreason':'ATTENDED','queuecallerenterreason':0x1});}});};exports['musiconholdstart']=function(_0x2a59d4){if(!_[_0x529e('0x11')](queues[_0x2a59d4['channel']])){queues[_0x2a59d4[_0x529e('0x5')]][_0x529e('0x32')]=utils[_0x529e('0x10')]();}};exports[_0x529e('0x33')]=function(_0x55008b){if(!_['isNil'](queues[_0x55008b['channel']])){if(!_[_0x529e('0x11')](queues[_0x55008b[_0x529e('0x5')]][_0x529e('0x32')])){queues[_0x55008b[_0x529e('0x5')]][_0x529e('0x34')]+=utils[_0x529e('0x18')](utils['now'](),queues[_0x55008b['channel']][_0x529e('0x32')]);delete queues[_0x55008b[_0x529e('0x5')]]['musiconholdstartAt'];}}};exports[_0x529e('0x35')]=function(_0x570de8){if(!_[_0x529e('0x11')](queues[_0x570de8[_0x529e('0x5')]])){writeDB(queues[_0x570de8['channel']],!![]);}if(!_[_0x529e('0x11')](transfers[_0x570de8[_0x529e('0x5')]])){if(transfers[_0x570de8[_0x529e('0x5')]]['assigned']){transfers[_0x570de8[_0x529e('0x5')]]=_[_0x529e('0xe')](transfers[_0x570de8['channel']],{'queuecallercomplete':!![],'queuecallercompleteAt':utils[_0x529e('0x10')](),'queuecallerexitreason':_0x529e('0x36')});}writeDB(transfers[_0x570de8[_0x529e('0x5')]],![]);delete transfers[_0x570de8['channel']];}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index bdd819e..54aa057 100644 --- a/server/services/xdr/recordings.controller.js +++ b/server/services/xdr/recordings.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e54=['calleridnum','lodash','debug','accountcode','getUserByInternal','then','membername','UserId','request','CreateVoiceRecording','channel','isNil','variable','mixmonitor_filename','value','.wav49','replace','.WAV','assign','agentconnect','queue','connectedlinenum','cdr','type','destinationchannel','uniqueid','destinationcontext','lastdata'];(function(_0x1fd9e7,_0x24cdbe){var _0x1781f2=function(_0x2bd0a3){while(--_0x2bd0a3){_0x1fd9e7['push'](_0x1fd9e7['shift']());}};_0x1781f2(++_0x24cdbe);}(_0x2e54,0x1dd));var _0x42e5=function(_0x561c78,_0x363b3c){_0x561c78=_0x561c78-0x0;var _0x4bb0d4=_0x2e54[_0x561c78];return _0x4bb0d4;};'use strict';var _=require(_0x42e5('0x0'));var utils=require('./utils');var recordings={};function writeDB(_0x527a1a){utils[_0x42e5('0x1')](_0x527a1a);if(_0x527a1a[_0x42e5('0x2')]){utils[_0x42e5('0x3')](_0x527a1a[_0x42e5('0x2')])[_0x42e5('0x4')](function(_0x153440){if(_0x153440){_0x527a1a[_0x42e5('0x5')]=_0x153440['name'];_0x527a1a[_0x42e5('0x6')]=_0x153440['id'];}utils[_0x42e5('0x7')](_0x42e5('0x8'),_0x527a1a);});}else{utils['request'](_0x42e5('0x8'),_0x527a1a);}if(recordings[_0x527a1a['channel']]){delete recordings[_0x527a1a[_0x42e5('0x9')]];}}exports['varset']=function(_0x3a8494){if(!_[_0x42e5('0xa')](_0x3a8494[_0x42e5('0xb')])&&!_[_0x42e5('0xa')](_0x3a8494[_0x42e5('0xb')][_0x42e5('0xc')])){if(!_[_0x42e5('0xa')](recordings[_0x3a8494[_0x42e5('0x9')]])){writeDB(recordings[_0x3a8494[_0x42e5('0x9')]]);}if(_['endsWith'](_0x3a8494[_0x42e5('0xd')],_0x42e5('0xe'))){_0x3a8494['value']=_0x3a8494[_0x42e5('0xd')][_0x42e5('0xf')](_0x42e5('0xe'),_0x42e5('0x10'));}recordings[_0x3a8494[_0x42e5('0x9')]]=_[_0x42e5('0x11')](_0x3a8494,{});}};exports[_0x42e5('0x12')]=function(_0x96fae2){if(!_[_0x42e5('0xa')](recordings[_0x96fae2[_0x42e5('0x9')]])){recordings[_0x96fae2['channel']]=_[_0x42e5('0x11')](recordings[_0x96fae2[_0x42e5('0x9')]],{'membername':_0x96fae2[_0x42e5('0x5')],'queue':_0x96fae2[_0x42e5('0x13')],'accountcode':_0x96fae2[_0x42e5('0x14')]});}};exports[_0x42e5('0x15')]=function(_0x1a26c6){if(!_[_0x42e5('0xa')](recordings[_0x1a26c6[_0x42e5('0x9')]])){recordings[_0x1a26c6[_0x42e5('0x9')]]=_[_0x42e5('0x11')](recordings[_0x1a26c6[_0x42e5('0x9')]],{'type':_0x1a26c6[_0x42e5('0x16')]});writeDB(recordings[_0x1a26c6[_0x42e5('0x9')]]);}else if(!_['isNil'](recordings[_0x1a26c6[_0x42e5('0x17')]])){recordings[_0x1a26c6['channel']]=recordings[_0x1a26c6['destinationchannel']];delete recordings[_0x1a26c6[_0x42e5('0x17')]];if(_0x1a26c6[_0x42e5('0x16')]=='dialer'){recordings[_0x1a26c6[_0x42e5('0x9')]]=_[_0x42e5('0x11')](recordings[_0x1a26c6[_0x42e5('0x9')]],{'type':_0x1a26c6[_0x42e5('0x16')],'uniqueid':_0x1a26c6[_0x42e5('0x18')],'context':_0x1a26c6[_0x42e5('0x19')],'queue':_0x1a26c6[_0x42e5('0x1a')],'connectedlinenum':_0x1a26c6['accountcode'],'connectedlinename':'','calleridnum':_0x1a26c6['destination'],'exten':recordings[_0x1a26c6[_0x42e5('0x9')]]['calleridnum']});}else{recordings[_0x1a26c6[_0x42e5('0x9')]]=_[_0x42e5('0x11')](recordings[_0x1a26c6[_0x42e5('0x9')]],{'type':_0x1a26c6[_0x42e5('0x16')],'channel':_0x1a26c6[_0x42e5('0x9')],'exten':_0x1a26c6['destination'],'context':_0x1a26c6[_0x42e5('0x19')],'uniqueid':_0x1a26c6[_0x42e5('0x18')],'calleridnum':recordings[_0x1a26c6[_0x42e5('0x9')]][_0x42e5('0x14')],'calleridname':recordings[_0x1a26c6[_0x42e5('0x9')]]['connectedlinename'],'connectedlinenum':recordings[_0x1a26c6['channel']][_0x42e5('0x1b')],'connectedlinename':recordings[_0x1a26c6['channel']]['calleridname']});}writeDB(recordings[_0x1a26c6[_0x42e5('0x9')]]);}}; \ No newline at end of file +var _0x4dd3=['assign','agentconnect','queue','connectedlinenum','type','destinationchannel','uniqueid','destinationcontext','lastdata','destination','connectedlinename','calleridnum','calleridname','lodash','./utils','getUserByInternal','then','membername','UserId','request','CreateVoiceRecording','varset','isNil','variable','mixmonitor_filename','channel','value','.wav49','replace'];(function(_0x16f271,_0x290aed){var _0x3a9a92=function(_0x4c79b8){while(--_0x4c79b8){_0x16f271['push'](_0x16f271['shift']());}};_0x3a9a92(++_0x290aed);}(_0x4dd3,0xf5));var _0x34dd=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0x4dd3[_0x3227c1];return _0x31fd48;};'use strict';var _=require(_0x34dd('0x0'));var utils=require(_0x34dd('0x1'));var recordings={};function writeDB(_0x3be607){utils['debug'](_0x3be607);if(_0x3be607['accountcode']){utils[_0x34dd('0x2')](_0x3be607['accountcode'])[_0x34dd('0x3')](function(_0x29d4bd){if(_0x29d4bd){_0x3be607[_0x34dd('0x4')]=_0x29d4bd['name'];_0x3be607[_0x34dd('0x5')]=_0x29d4bd['id'];}utils[_0x34dd('0x6')](_0x34dd('0x7'),_0x3be607);});}else{utils[_0x34dd('0x6')](_0x34dd('0x7'),_0x3be607);}if(recordings[_0x3be607['channel']]){delete recordings[_0x3be607['channel']];}}exports[_0x34dd('0x8')]=function(_0x471534){if(!_[_0x34dd('0x9')](_0x471534['variable'])&&!_[_0x34dd('0x9')](_0x471534[_0x34dd('0xa')][_0x34dd('0xb')])){if(!_[_0x34dd('0x9')](recordings[_0x471534[_0x34dd('0xc')]])){writeDB(recordings[_0x471534[_0x34dd('0xc')]]);}if(_['endsWith'](_0x471534[_0x34dd('0xd')],_0x34dd('0xe'))){_0x471534[_0x34dd('0xd')]=_0x471534[_0x34dd('0xd')][_0x34dd('0xf')]('.wav49','.WAV');}recordings[_0x471534[_0x34dd('0xc')]]=_[_0x34dd('0x10')](_0x471534,{});}};exports[_0x34dd('0x11')]=function(_0x510970){if(!_[_0x34dd('0x9')](recordings[_0x510970['channel']])){recordings[_0x510970[_0x34dd('0xc')]]=_[_0x34dd('0x10')](recordings[_0x510970[_0x34dd('0xc')]],{'membername':_0x510970[_0x34dd('0x4')],'queue':_0x510970[_0x34dd('0x12')],'accountcode':_0x510970[_0x34dd('0x13')]});}};exports['cdr']=function(_0x351c8a){if(!_[_0x34dd('0x9')](recordings[_0x351c8a[_0x34dd('0xc')]])){recordings[_0x351c8a[_0x34dd('0xc')]]=_[_0x34dd('0x10')](recordings[_0x351c8a[_0x34dd('0xc')]],{'type':_0x351c8a[_0x34dd('0x14')]});writeDB(recordings[_0x351c8a[_0x34dd('0xc')]]);}else if(!_[_0x34dd('0x9')](recordings[_0x351c8a[_0x34dd('0x15')]])){recordings[_0x351c8a[_0x34dd('0xc')]]=recordings[_0x351c8a[_0x34dd('0x15')]];delete recordings[_0x351c8a[_0x34dd('0x15')]];if(_0x351c8a[_0x34dd('0x14')]=='dialer'){recordings[_0x351c8a['channel']]=_[_0x34dd('0x10')](recordings[_0x351c8a[_0x34dd('0xc')]],{'type':_0x351c8a[_0x34dd('0x14')],'uniqueid':_0x351c8a[_0x34dd('0x16')],'context':_0x351c8a[_0x34dd('0x17')],'queue':_0x351c8a[_0x34dd('0x18')],'connectedlinenum':_0x351c8a['accountcode'],'connectedlinename':'','calleridnum':_0x351c8a[_0x34dd('0x19')],'exten':recordings[_0x351c8a[_0x34dd('0xc')]]['calleridnum']});}else{recordings[_0x351c8a['channel']]=_['assign'](recordings[_0x351c8a[_0x34dd('0xc')]],{'type':_0x351c8a['type'],'channel':_0x351c8a[_0x34dd('0xc')],'exten':_0x351c8a[_0x34dd('0x19')],'context':_0x351c8a[_0x34dd('0x17')],'uniqueid':_0x351c8a[_0x34dd('0x16')],'calleridnum':recordings[_0x351c8a[_0x34dd('0xc')]]['connectedlinenum'],'calleridname':recordings[_0x351c8a['channel']][_0x34dd('0x1a')],'connectedlinenum':recordings[_0x351c8a['channel']][_0x34dd('0x1b')],'connectedlinename':recordings[_0x351c8a[_0x34dd('0xc')]][_0x34dd('0x1c')]});}writeDB(recordings[_0x351c8a[_0x34dd('0xc')]]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index d141bd3..87bec62 100644 --- a/server/services/xdr/transfers.controller.js +++ b/server/services/xdr/transfers.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f0f=['secondtransferercontext','origtransfererlinkedid','origtransferercontext','attended','isNil','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','./utils','info','type','request','CreateVoiceTransferReport','blindtransfer','blind','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode'];(function(_0x36f458,_0x2ebcc4){var _0x250784=function(_0x26120a){while(--_0x26120a){_0x36f458['push'](_0x36f458['shift']());}};_0x250784(++_0x2ebcc4);}(_0x3f0f,0x1d8));var _0xf3f0=function(_0x47d5d9,_0x4f017a){_0x47d5d9=_0x47d5d9-0x0;var _0x7f2e80=_0x3f0f[_0x47d5d9];return _0x7f2e80;};'use strict';var _=require('lodash');var util=require(_0xf3f0('0x0'));var utils=require(_0xf3f0('0x1'));function writeDB(_0x4887c9){utils[_0xf3f0('0x2')](util['format']('TRANSFER|%s',_0x4887c9[_0xf3f0('0x3')]));utils[_0xf3f0('0x4')](_0xf3f0('0x5'),_0x4887c9);}exports[_0xf3f0('0x6')]=function(_0x16d41e){_0x16d41e[_0xf3f0('0x3')]=_0xf3f0('0x7');writeDB(_0x16d41e);};exports[_0xf3f0('0x8')]=function(_0x3db67a){_0x3db67a=_[_0xf3f0('0x9')](_0x3db67a,{'transfererchannel':_0x3db67a[_0xf3f0('0xa')],'transferercalleridnum':_0x3db67a[_0xf3f0('0xb')],'transferercalleridname':_0x3db67a['origtransferercalleridname'],'transfererconnectedlinenum':_0x3db67a[_0xf3f0('0xc')],'transfererconnectedlinename':_0x3db67a['secondtransfererconnectedlinename'],'transfereraccountcode':_0x3db67a[_0xf3f0('0xd')],'transferercontext':_0x3db67a[_0xf3f0('0xe')],'transfererexten':_0x3db67a['secondtransfererexten'],'transfererlinkedid':_0x3db67a[_0xf3f0('0xf')],'context':_0x3db67a[_0xf3f0('0x10')],'extension':_0x3db67a['origtransfererexten'],'type':_0xf3f0('0x11')});if(_[_0xf3f0('0x12')](_0x3db67a['transfereechannel'])){_0x3db67a=_[_0xf3f0('0x9')](_0x3db67a,{'transfereechannel':_0x3db67a[_0xf3f0('0x13')],'transfereecalleridnum':_0x3db67a[_0xf3f0('0x14')],'transfereecalleridname':_0x3db67a[_0xf3f0('0x15')],'transfereeconnectedlinenum':_0x3db67a[_0xf3f0('0x16')],'transfereeconnectedlinename':_0x3db67a[_0xf3f0('0x17')],'transfereeaccountcode':_0x3db67a['transfertargetaccountcode'],'transfereecontext':_0x3db67a[_0xf3f0('0x18')],'transfereeexten':_0x3db67a[_0xf3f0('0x19')],'transfereelinkedid':_0x3db67a[_0xf3f0('0x1a')]});}writeDB(_0x3db67a);}; \ No newline at end of file +var _0xc23c=['assign','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','format','type','CreateVoiceTransferReport','blindtransfer','attendedtransfer'];(function(_0x418980,_0x397796){var _0x510a02=function(_0x37b26e){while(--_0x37b26e){_0x418980['push'](_0x418980['shift']());}};_0x510a02(++_0x397796);}(_0xc23c,0x1d4));var _0xcc23=function(_0x2a1ff7,_0x4e44cb){_0x2a1ff7=_0x2a1ff7-0x0;var _0x168537=_0xc23c[_0x2a1ff7];return _0x168537;};'use strict';var _=require(_0xcc23('0x0'));var util=require(_0xcc23('0x1'));var utils=require('./utils');function writeDB(_0x249eff){utils['info'](util[_0xcc23('0x2')]('TRANSFER|%s',_0x249eff[_0xcc23('0x3')]));utils['request'](_0xcc23('0x4'),_0x249eff);}exports[_0xcc23('0x5')]=function(_0x2b1f44){_0x2b1f44[_0xcc23('0x3')]='blind';writeDB(_0x2b1f44);};exports[_0xcc23('0x6')]=function(_0x235c4a){_0x235c4a=_[_0xcc23('0x7')](_0x235c4a,{'transfererchannel':_0x235c4a['origtransfererchannel'],'transferercalleridnum':_0x235c4a[_0xcc23('0x8')],'transferercalleridname':_0x235c4a[_0xcc23('0x9')],'transfererconnectedlinenum':_0x235c4a['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x235c4a[_0xcc23('0xa')],'transfereraccountcode':_0x235c4a['origtransfereraccountcode'],'transferercontext':_0x235c4a[_0xcc23('0xb')],'transfererexten':_0x235c4a[_0xcc23('0xc')],'transfererlinkedid':_0x235c4a[_0xcc23('0xd')],'context':_0x235c4a[_0xcc23('0xe')],'extension':_0x235c4a[_0xcc23('0xf')],'type':'attended'});if(_[_0xcc23('0x10')](_0x235c4a[_0xcc23('0x11')])){_0x235c4a=_[_0xcc23('0x7')](_0x235c4a,{'transfereechannel':_0x235c4a['transfertargetchannel'],'transfereecalleridnum':_0x235c4a['transfertargetcalleridnum'],'transfereecalleridname':_0x235c4a[_0xcc23('0x12')],'transfereeconnectedlinenum':_0x235c4a[_0xcc23('0x13')],'transfereeconnectedlinename':_0x235c4a[_0xcc23('0x14')],'transfereeaccountcode':_0x235c4a[_0xcc23('0x15')],'transfereecontext':_0x235c4a[_0xcc23('0x16')],'transfereeexten':_0x235c4a[_0xcc23('0x17')],'transfereelinkedid':_0x235c4a[_0xcc23('0x18')]});}writeDB(_0x235c4a);}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 767f019..af48b46 100644 --- a/server/services/xdr/utils.js +++ b/server/services/xdr/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb06=['NOTFOUND','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','seconds','diffTime','diff','sumTime','isAfter','isBefore','jayson/promise','moment','client','http','../../config/logger','info','debug','stringify','stack','request','GetUser','internal','name','GETUSER|','length','result','error','getUserByName','then','GetVoiceQueue','type','acw','acwTimeout','GETVOICEQUEUEBYNAME|','FOUND'];(function(_0x55da13,_0x3193cf){var _0x3db98f=function(_0x6c43cd){while(--_0x6c43cd){_0x55da13['push'](_0x55da13['shift']());}};_0x3db98f(++_0x3193cf);}(_0xcb06,0x159));var _0x6cb0=function(_0x4a73dd,_0x58e46c){_0x4a73dd=_0x4a73dd-0x0;var _0x279e6b=_0xcb06[_0x4a73dd];return _0x279e6b;};'use strict';var jayson=require(_0x6cb0('0x0'));var moment=require(_0x6cb0('0x1'));var BPromise=require('bluebird');var client=jayson[_0x6cb0('0x2')][_0x6cb0('0x3')]({'port':0x2329});var logger=require(_0x6cb0('0x4'))('xdr');exports[_0x6cb0('0x5')]=function(_0x2337d2){logger[_0x6cb0('0x5')](_0x2337d2);};exports[_0x6cb0('0x6')]=function(_0x33002d){logger[_0x6cb0('0x6')](JSON[_0x6cb0('0x7')](_0x33002d));};exports['error']=function(_0x33cfd2){logger['error'](_0x33cfd2[_0x6cb0('0x8')]);};exports[_0x6cb0('0x9')]=function(_0x2dae98,_0x4c2aa4){return client[_0x6cb0('0x9')](_0x2dae98,{'body':_0x4c2aa4})['then'](function(_0xb59780){logger[_0x6cb0('0x6')](JSON['stringify'](_0xb59780));})['catch'](function(_0x2df6b6){logger['error'](_0x2df6b6[_0x6cb0('0x8')]);});};function getUser(_0x4d101e){return client[_0x6cb0('0x9')](_0x6cb0('0xa'),{'options':{'raw':!![],'attributes':['id',_0x6cb0('0xb'),_0x6cb0('0xc'),'interface'],'where':_0x4d101e,'limit':0x1}})['then'](function(_0x452ac0){logger[_0x6cb0('0x5')](_0x6cb0('0xd')+JSON[_0x6cb0('0x7')](_0x4d101e)+'|'+(_0x452ac0['result'][_0x6cb0('0xe')]?'FOUND':'NOTFOUND'));return _0x452ac0[_0x6cb0('0xf')][_0x6cb0('0xe')]?_0x452ac0[_0x6cb0('0xf')][0x0]:null;});}exports['getUserByInternal']=function(_0x4cfdf0){return new BPromise(function(_0xcf7d38,_0x49e99b){if(_0x4cfdf0){return getUser({'internal':_0x4cfdf0})['then'](function(_0x4e32b9){return _0xcf7d38(_0x4e32b9);})['catch'](function(_0x4aaf2b){logger[_0x6cb0('0x10')](_0x4aaf2b[_0x6cb0('0x8')]);return _0xcf7d38(null);});}else{return _0xcf7d38(null);}});};exports['getUserByInterface']=function(_0x3b388e){return new BPromise(function(_0x276e3d,_0x4692e3){if(_0x3b388e){return getUser({'interface':_0x3b388e})['then'](function(_0x2b9a5d){return _0x276e3d(_0x2b9a5d);})['catch'](function(_0x1433ef){logger[_0x6cb0('0x10')](_0x1433ef[_0x6cb0('0x8')]);return _0x276e3d(null);});}else{return _0x276e3d(null);}});};exports[_0x6cb0('0x11')]=function(_0x479c8c){return new BPromise(function(_0x44e0a4,_0x260ff9){if(_0x479c8c){return getUser({'name':_0x479c8c})[_0x6cb0('0x12')](function(_0x1ad6d8){return _0x44e0a4(_0x1ad6d8);})['catch'](function(_0x4222a1){logger[_0x6cb0('0x10')](_0x4222a1['stack']);return _0x44e0a4(null);});}else{return _0x44e0a4(null);}});};exports['getVoiceQueueByName']=function(_0x53cdf8){return new BPromise(function(_0x118e7f,_0x525d72){if(_0x53cdf8){return client['request'](_0x6cb0('0x13'),{'options':{'raw':!![],'attributes':['id',_0x6cb0('0xc'),_0x6cb0('0x14'),_0x6cb0('0x15'),_0x6cb0('0x16')],'where':{'name':_0x53cdf8},'limit':0x1}})['then'](function(_0x3c285d){logger[_0x6cb0('0x5')](_0x6cb0('0x17')+_0x53cdf8+'|'+(_0x3c285d[_0x6cb0('0xf')]['length']?_0x6cb0('0x18'):_0x6cb0('0x19')));return _0x118e7f(_0x3c285d[_0x6cb0('0xf')]['length']?_0x3c285d[_0x6cb0('0xf')][0x0]:null);})['catch'](function(_0xff56f9){logger[_0x6cb0('0x10')](_0xff56f9[_0x6cb0('0x8')]);return _0x118e7f(null);});}else{return _0x118e7f(null);}});};exports[_0x6cb0('0x1a')]=function(_0x3475b9,_0x18e1f7){return moment(_0x3475b9)[_0x6cb0('0x1b')](_0x18e1f7,'seconds')[_0x6cb0('0x1c')](_0x6cb0('0x1d'));};exports[_0x6cb0('0x1e')]=function(_0x1e0297,_0xf85df){return moment(_0x1e0297)['subtract'](_0xf85df,_0x6cb0('0x1f'))[_0x6cb0('0x1c')](_0x6cb0('0x1d'));};exports[_0x6cb0('0x20')]=function(_0x5c0627,_0x25a0b9){return moment(_0x5c0627)[_0x6cb0('0x21')](moment(_0x25a0b9),_0x6cb0('0x1f'));};exports[_0x6cb0('0x22')]=function(_0x1860af,_0x8f8fc5){return parseInt(_0x1860af,0xa)+parseInt(_0x8f8fc5,0xa);};exports['now']=function(){return moment()['format'](_0x6cb0('0x1d'));};exports[_0x6cb0('0x23')]=function(_0x5531a4,_0x18bb42){if(_0x18bb42){return moment(_0x5531a4)[_0x6cb0('0x23')](_0x18bb42);}else{return!![];}};exports[_0x6cb0('0x24')]=function(_0x24ea81,_0x186942){if(_0x186942){return moment(_0x24ea81)[_0x6cb0('0x24')](_0x186942);}else if(_0x24ea81){return!![];}else{return![];}}; \ No newline at end of file +var _0xaaed=['stringify','error','stack','request','then','catch','internal','name','interface','GETUSER|','result','FOUND','NOTFOUND','length','getUserByInternal','getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','GETVOICEQUEUEBYNAME|','addTime','seconds','format','subtractTime','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','now','isAfter','isBefore','jayson/promise','moment','bluebird','client','http','../../config/logger','xdr','info','debug'];(function(_0x14091c,_0xd740c0){var _0x729bfd=function(_0x4c77ff){while(--_0x4c77ff){_0x14091c['push'](_0x14091c['shift']());}};_0x729bfd(++_0xd740c0);}(_0xaaed,0xed));var _0xdaae=function(_0x11a42c,_0x3c10fc){_0x11a42c=_0x11a42c-0x0;var _0x42303=_0xaaed[_0x11a42c];return _0x42303;};'use strict';var jayson=require(_0xdaae('0x0'));var moment=require(_0xdaae('0x1'));var BPromise=require(_0xdaae('0x2'));var client=jayson[_0xdaae('0x3')][_0xdaae('0x4')]({'port':0x2329});var logger=require(_0xdaae('0x5'))(_0xdaae('0x6'));exports[_0xdaae('0x7')]=function(_0x2a8e5e){logger[_0xdaae('0x7')](_0x2a8e5e);};exports[_0xdaae('0x8')]=function(_0x38d8f4){logger[_0xdaae('0x8')](JSON[_0xdaae('0x9')](_0x38d8f4));};exports['error']=function(_0x5aecf6){logger[_0xdaae('0xa')](_0x5aecf6[_0xdaae('0xb')]);};exports[_0xdaae('0xc')]=function(_0x3ce123,_0x48c743){return client[_0xdaae('0xc')](_0x3ce123,{'body':_0x48c743})[_0xdaae('0xd')](function(_0x317a79){logger[_0xdaae('0x8')](JSON[_0xdaae('0x9')](_0x317a79));})[_0xdaae('0xe')](function(_0x154e4f){logger[_0xdaae('0xa')](_0x154e4f['stack']);});};function getUser(_0x41f7b4){return client[_0xdaae('0xc')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0xdaae('0xf'),_0xdaae('0x10'),_0xdaae('0x11')],'where':_0x41f7b4,'limit':0x1}})[_0xdaae('0xd')](function(_0xcb4a0d){logger[_0xdaae('0x7')](_0xdaae('0x12')+JSON['stringify'](_0x41f7b4)+'|'+(_0xcb4a0d[_0xdaae('0x13')]['length']?_0xdaae('0x14'):_0xdaae('0x15')));return _0xcb4a0d['result'][_0xdaae('0x16')]?_0xcb4a0d[_0xdaae('0x13')][0x0]:null;});}exports[_0xdaae('0x17')]=function(_0x177a48){return new BPromise(function(_0x40cd17,_0x337407){if(_0x177a48){return getUser({'internal':_0x177a48})[_0xdaae('0xd')](function(_0x48a630){return _0x40cd17(_0x48a630);})[_0xdaae('0xe')](function(_0xa23b27){logger[_0xdaae('0xa')](_0xa23b27['stack']);return _0x40cd17(null);});}else{return _0x40cd17(null);}});};exports[_0xdaae('0x18')]=function(_0x5bcf91){return new BPromise(function(_0x32a6d2,_0x229ab1){if(_0x5bcf91){return getUser({'interface':_0x5bcf91})[_0xdaae('0xd')](function(_0x41f08f){return _0x32a6d2(_0x41f08f);})['catch'](function(_0x3ae12a){logger[_0xdaae('0xa')](_0x3ae12a['stack']);return _0x32a6d2(null);});}else{return _0x32a6d2(null);}});};exports[_0xdaae('0x19')]=function(_0x4a7b70){return new BPromise(function(_0x2cb5a1,_0x449b6e){if(_0x4a7b70){return getUser({'name':_0x4a7b70})['then'](function(_0x1cb780){return _0x2cb5a1(_0x1cb780);})[_0xdaae('0xe')](function(_0x30a50f){logger[_0xdaae('0xa')](_0x30a50f[_0xdaae('0xb')]);return _0x2cb5a1(null);});}else{return _0x2cb5a1(null);}});};exports[_0xdaae('0x1a')]=function(_0x11d886){return new BPromise(function(_0x2cf018,_0x1d8e62){if(_0x11d886){return client['request'](_0xdaae('0x1b'),{'options':{'raw':!![],'attributes':['id',_0xdaae('0x10'),_0xdaae('0x1c'),'acw',_0xdaae('0x1d')],'where':{'name':_0x11d886},'limit':0x1}})[_0xdaae('0xd')](function(_0x354dcd){logger[_0xdaae('0x7')](_0xdaae('0x1e')+_0x11d886+'|'+(_0x354dcd[_0xdaae('0x13')]['length']?_0xdaae('0x14'):'NOTFOUND'));return _0x2cf018(_0x354dcd[_0xdaae('0x13')][_0xdaae('0x16')]?_0x354dcd[_0xdaae('0x13')][0x0]:null);})[_0xdaae('0xe')](function(_0x4e5b0f){logger[_0xdaae('0xa')](_0x4e5b0f['stack']);return _0x2cf018(null);});}else{return _0x2cf018(null);}});};exports[_0xdaae('0x1f')]=function(_0x32bc55,_0xb55747){return moment(_0x32bc55)['add'](_0xb55747,_0xdaae('0x20'))[_0xdaae('0x21')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xdaae('0x22')]=function(_0x4ae788,_0x3b6555){return moment(_0x4ae788)['subtract'](_0x3b6555,'seconds')[_0xdaae('0x21')](_0xdaae('0x23'));};exports[_0xdaae('0x24')]=function(_0x5c90bb,_0x5af519){return moment(_0x5c90bb)[_0xdaae('0x25')](moment(_0x5af519),_0xdaae('0x20'));};exports['sumTime']=function(_0x55f490,_0x71cc7f){return parseInt(_0x55f490,0xa)+parseInt(_0x71cc7f,0xa);};exports[_0xdaae('0x26')]=function(){return moment()[_0xdaae('0x21')](_0xdaae('0x23'));};exports[_0xdaae('0x27')]=function(_0x3694a0,_0x4eb21c){if(_0x4eb21c){return moment(_0x3694a0)[_0xdaae('0x27')](_0x4eb21c);}else{return!![];}};exports[_0xdaae('0x28')]=function(_0x5d7be6,_0x5839e0){if(_0x5839e0){return moment(_0x5d7be6)[_0xdaae('0x28')](_0x5839e0);}else if(_0x5d7be6){return!![];}else{return![];}}; \ No newline at end of file -- 1.7.1